Introduces a chat loop where users send instructions to an agent that applies changes (create/update/delete phases, tasks, pages) and stays alive for follow-up messages. Includes schema + migration, repository layer, chat prompt, file-io action field extension, output handler chat mode, revert support for deletes, tRPC procedures, events, frontend slide-over UI with inline changeset display and revert, and docs.
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
/**
|
|
* Change Set Repository Port Interface
|
|
*
|
|
* Port for ChangeSet aggregate operations.
|
|
* Implementations (Drizzle, etc.) are adapters.
|
|
*/
|
|
|
|
import type { ChangeSet, ChangeSetEntry } from '../schema.js';
|
|
|
|
export type CreateChangeSetData = {
|
|
agentId: string | null;
|
|
agentName: string;
|
|
initiativeId: string;
|
|
mode: 'plan' | 'detail' | 'refine' | 'chat';
|
|
summary?: string | null;
|
|
};
|
|
|
|
export type CreateChangeSetEntryData = {
|
|
entityType: 'page' | 'phase' | 'task' | 'phase_dependency' | 'task_dependency';
|
|
entityId: string;
|
|
action: 'create' | 'update' | 'delete';
|
|
previousState?: string | null;
|
|
newState?: string | null;
|
|
sortOrder?: number;
|
|
};
|
|
|
|
export type ChangeSetWithEntries = ChangeSet & { entries: ChangeSetEntry[] };
|
|
|
|
export interface ChangeSetRepository {
|
|
createWithEntries(data: CreateChangeSetData, entries: CreateChangeSetEntryData[]): Promise<ChangeSet>;
|
|
findById(id: string): Promise<ChangeSet | null>;
|
|
findByIdWithEntries(id: string): Promise<ChangeSetWithEntries | null>;
|
|
findByInitiativeId(initiativeId: string): Promise<ChangeSet[]>;
|
|
findByAgentId(agentId: string): Promise<ChangeSet[]>;
|
|
markReverted(id: string): Promise<ChangeSet>;
|
|
}
|