Something went wrong. Try again.
An agent harness for spec-driven development.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240export type JsonPrimitive = string | number | boolean | null;export type JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };export type JsonObject = { [key: string]: JsonValue };
export type SpecDocumentKind = | "architecture" | "decision" | "task" | "glossary" | "experience" | "note" | "unknown";
export interface MarkdownHeading { depth: number; text: string; slug: string;}
export interface SpecMarkdownDocument { /** Stable document identity. Comes from frontmatter.id, or else from relative path. */ id: string; /** POSIX path relative to the spec root, e.g. architecture/runtime.md. */ path: string; title: string; kind: SpecDocumentKind; status?: string; frontmatter: JsonObject; body: string; raw: string; headings: MarkdownHeading[]; sha256: string; sizeBytes: number; mtimeMs: number;}
export interface SpecDocumentRow { id: string; path: string; title: string; kind: SpecDocumentKind; status: string; body: string; frontmatterJson: string; headingsJson: string; sha256: string; sizeBytes: number; mtimeMs: number; importedAt: string;}
export type ProjectEventType = | "spec.document.upserted" | "spec.document.unchanged" | "spec.document.deleted" | "consumer.registered" | "consumer.updated" | "consumer.matched" | "agent.packet.created" | "agent.request.created" | "agent.request.executing" | "agent.request.executed" | "agent.request.failed" | "agent.request.blocked" | "agent.request.ignored";
export interface ProjectEventRow { id: string; type: ProjectEventType; documentId: string; path: string; sha256?: string; occurredAt: string; authority: "importer.sync" | "human.file" | "human.ui" | "agent.proposal" | "agent.applied" | "charter.agent" | "charter.system"; sourceJazzRowId?: string; sourceField?: string;}
export type WorkItemStatus = "queued" | "claimed" | "running" | "done" | "ignored" | "failed" | "blocked";export type WorkItemKind = "spec-change" | "agent-request" | "manual";export type AgentPacketStatus = "planned" | "executing" | "executed" | "failed" | "blocked" | "ignored";
export interface WorkItemRow { id: string; kind: WorkItemKind; status: WorkItemStatus; eventId: string; documentId: string; path: string; title: string; createdAt: string; updatedAt: string; authority: ProjectEventRow["authority"]; attachedDocumentIds: string[]; matchedConsumerIds: string[]; sourceJazzRowId?: string; sourceField?: string; claimedBy?: string; claimedAt?: string; requestId?: string; resultText?: string; reportedAt?: string;}
export interface SpecImportPlan { projectRoot: string; specRoot: string; generatedAt: string; documents: SpecMarkdownDocument[]; rows: SpecDocumentRow[]; events: ProjectEventRow[];}
export type AgentRequestStatus = "planned" | "executing" | "executed" | "failed" | "blocked";export type AgentReportStatus = "done" | "failed" | "blocked" | "ignored";
export type AgentConsumerStatus = "active" | "paused" | "archived";export type AgentRunnerKind = "letta" | "codex" | "claude-code" | "script" | "custom";
export interface AgentConsumerRow { id: string; name: string; status: AgentConsumerStatus; runnerKind: AgentRunnerKind; runnerCommand?: string; runnerConfigJson: string; eventTypes: string[]; documentSelectors: string[]; promptDocumentIds: string[]; defaultContextDocumentIds: string[]; cursorJson: string; createdAt: string; updatedAt: string;}
export interface AgentPacketRow { id: string; status: AgentPacketStatus; createdAt: string; updatedAt: string; consumerId?: string; requestId?: string; command: string; workItemIds: string[]; eventIds: string[]; affectedDocumentIds: string[]; promptDocumentIds: string[]; attachedDocumentIds: string[]; documentVersionIds: Record<string, string>; prompt: string; promptSha256: string; outputContract: string; resultText?: string; stdoutText?: string; stderrText?: string; outputText?: string; reportStatus?: AgentReportStatus; reportedAt?: string; exitCode?: number;}
export interface AgentRequestRow { id: string; status: AgentRequestStatus; createdAt: string; updatedAt: string; requestedBy: "charter.agent"; consumerId?: string; packetId?: string; command: string; changeIds: string[]; workItemIds: string[]; attachedDocumentIds: string[]; prompt: string; promptSha256: string; resultText?: string; stdoutText?: string; stderrText?: string; outputText?: string; reportStatus?: AgentReportStatus; reportedAt?: string; exitCode?: number;}
export interface CharterDatabaseSnapshot { projectId: string; updatedAt: string; documents: Record<string, SpecDocumentRow>; pathIndex: Record<string, string>; events: ProjectEventRow[]; workItems: Record<string, WorkItemRow>; consumers: Record<string, AgentConsumerRow>; packets: Record<string, AgentPacketRow>; requests: Record<string, AgentRequestRow>;}
export interface SpecLink { kind: "markdown" | "wikilink"; raw: string; target: string; normalizedTarget: string; text?: string;}
export interface SpecIndexDocument { id: string; path: string; title: string; kind: SpecDocumentKind; status: string; sha256: string; headings: MarkdownHeading[]; links: SpecLink[]; terms: string[];}
export interface SpecIndex { projectRoot: string; specRoot: string; generatedAt: string; documents: Record<string, SpecIndexDocument>; pathIndex: Record<string, string>; termIndex: Record<string, string[]>; backlinks: Record<string, string[]>;}
export type SpecChangeType = "added" | "modified" | "deleted" | "unchanged";
export interface SpecChange { type: SpecChangeType; documentId: string; path: string; title: string; previousSha256?: string; currentSha256?: string; previousPath?: string; currentPath?: string;}