Something went wrong. Try again.
watches turns and automatically creates and resolves tasks that get pinned into main agent context
Something went wrong. Try again.
1.5 kB · 55 lines
TypeScript
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556export const OBSERVER_STATUSES = ["open", "active", "waiting", "blocked", "done", "cancelled", "superseded"] as const;
export type ObserverStatus = (typeof OBSERVER_STATUSES)[number];export type ThreadStatus = ObserverStatus | "dismissed";
export interface Thread { id: string; canonicalRequest: string; status: ThreadStatus; createdAt: number; updatedAt: number;}
export interface ObservedThread { id?: string; canonicalRequest: string; status: ObserverStatus;}
export interface ObserverOutput { existing: ObservedThread[]; additions: ObservedThread[];}
export interface UserMessageRecord { messageId: string; text: string; at: number;}
export interface ObservationFailure { kind: "observer_failure"; messageIds: string[]; error: string; at: number;}
export type CommitmentEvent = | { kind: "user_message"; messageId: string; text: string; at: number } | { kind: "observation"; reconciled: string[]; output: ObserverOutput; at: number } | { kind: "user_action"; threadId: string; action: "accept" | "dismiss" | "reopen" | "drop"; reason?: string; at: number } | { kind: "correction"; threadId: string; canonicalRequest?: string; status?: ThreadStatus; at: number } | ObservationFailure;
export interface Registry { threads: Thread[]; unreconciled: UserMessageRecord[]; created: number;}
export interface ObserverPacket { threads: Thread[]; userMessages: UserMessageRecord[]; completedAssistantTurn: string;}