import { Answerers, Msg } from "./agent-runtime.js"; //#region src/supervise.d.ts export declare const SUPERVISE_CONTRACT_VERSION = 1; export type PendingOrigin = { source: string; kind: string; channelId: string; threadId?: string; user?: { id: string; name?: string; attested?: boolean; }; text?: string; principal?: never; raw?: never; }; export type Resolution = { outcome: "answered" | "retired"; decision?: Decision["kind"]; by?: string; at: string; }; export type PendingAction = { id: string; agent: string; session: string; turnId: string; inputId: string; prompt: string; schema?: unknown; answerers?: Answerers; action?: { tool: string; input: unknown; callId: string; }; origin?: PendingOrigin; queued: number; parkedAt: string; status: "pending" | "answered" | "retired"; resolution?: Resolution; }; export type Decision = { kind: "approve"; input?: unknown; } | { kind: "reject"; note?: string; }; export type TraceStep = { callId: string; tool: string; input: unknown; status: "done" | "error" | "pending"; result?: unknown; }; export type TurnTrace = { agent: string; session: string; turnId: string; prompt: string; by?: string; steps: TraceStep[]; text?: string; }; export type PendingPage = { items: PendingAction[]; next?: string; }; export type InboxEvent = { kind: "pending.created"; cursor: string; at: string; pending: PendingAction; } | { kind: "pending.updated"; cursor: string; at: string; pendingId: string; queued: number; } | { kind: "pending.resolved"; cursor: string; at: string; pendingId: string; resolution: Resolution; }; export type AnyInboxEvent = InboxEvent | { kind: string; cursor: string; at: string; [field: string]: unknown; }; export declare function isKnownInboxEvent(e: AnyInboxEvent): e is InboxEvent; export type SuperviseError = { error: "unauthorized" | "forbidden" | "not_found" | "already_resolved" | "invalid" | (string & {}); message: string; resolution?: Resolution; }; export declare function traceTurn(msgs: Msg[], ids: { agent: string; session: string; turnId: string; }): TurnTrace | undefined; export declare const SUPERVISE_SCHEMA_ID = "urn:june:supervise:1"; export declare const superviseSchema: { readonly $schema: "https://json-schema.org/draft/2020-12/schema"; readonly $id: "urn:june:supervise:1"; readonly title: "June agent supervision contract"; readonly $defs: { readonly Answerers: { readonly oneOf: readonly [{ readonly type: "object"; readonly required: readonly ["user"]; readonly properties: { readonly user: { readonly type: "string"; }; }; }, { readonly type: "object"; readonly required: readonly ["policy"]; readonly properties: { readonly policy: { readonly type: "string"; }; readonly scope: {}; }; }]; }; readonly PendingOrigin: { readonly type: "object"; readonly required: readonly ["source", "kind", "channelId"]; readonly properties: { readonly source: { readonly type: "string"; }; readonly kind: { readonly type: "string"; }; readonly channelId: { readonly type: "string"; }; readonly threadId: { readonly type: "string"; }; readonly user: { readonly type: "object"; readonly required: readonly ["id"]; readonly properties: { readonly id: { readonly type: "string"; }; readonly name: { readonly type: "string"; }; readonly attested: { readonly type: "boolean"; }; }; }; readonly text: { readonly type: "string"; }; readonly principal: false; readonly raw: false; }; }; readonly Resolution: { readonly type: "object"; readonly required: readonly ["outcome", "at"]; readonly properties: { readonly outcome: { readonly enum: readonly ["answered", "retired"]; }; readonly decision: { readonly enum: readonly ["approve", "reject"]; }; readonly by: { readonly type: "string"; }; readonly at: { readonly type: "string"; readonly format: "date-time"; }; }; }; readonly PendingAction: { readonly type: "object"; readonly required: readonly ["id", "agent", "session", "turnId", "inputId", "prompt", "queued", "parkedAt", "status"]; readonly properties: { readonly id: { readonly type: "string"; }; readonly agent: { readonly type: "string"; }; readonly session: { readonly type: "string"; }; readonly turnId: { readonly type: "string"; }; readonly inputId: { readonly type: "string"; }; readonly prompt: { readonly type: "string"; }; readonly schema: {}; readonly answerers: { $ref: string; }; readonly action: { readonly type: "object"; readonly required: readonly ["tool", "input", "callId"]; readonly properties: { readonly tool: { readonly type: "string"; }; readonly input: {}; readonly callId: { readonly type: "string"; }; }; }; readonly origin: { $ref: string; }; readonly queued: { readonly type: "integer"; readonly minimum: 0; }; readonly parkedAt: { readonly type: "string"; readonly format: "date-time"; }; readonly status: { readonly enum: readonly ["pending", "answered", "retired"]; }; readonly resolution: { $ref: string; }; }; readonly if: { readonly properties: { readonly status: { readonly const: "pending"; }; }; }; readonly then: { readonly properties: { readonly resolution: false; }; }; readonly else: { readonly required: readonly ["resolution"]; }; }; readonly Decision: { readonly oneOf: readonly [{ readonly type: "object"; readonly required: readonly ["kind"]; readonly properties: { readonly kind: { readonly const: "approve"; }; readonly input: {}; }; }, { readonly type: "object"; readonly required: readonly ["kind"]; readonly properties: { readonly kind: { readonly const: "reject"; }; readonly note: { readonly type: "string"; }; }; }]; }; readonly TraceStep: { readonly type: "object"; readonly required: readonly ["callId", "tool", "input", "status"]; readonly properties: { readonly callId: { readonly type: "string"; }; readonly tool: { readonly type: "string"; }; readonly input: {}; readonly status: { readonly enum: readonly ["done", "error", "pending"]; }; readonly result: {}; }; }; readonly TurnTrace: { readonly type: "object"; readonly required: readonly ["agent", "session", "turnId", "prompt", "steps"]; readonly properties: { readonly agent: { readonly type: "string"; }; readonly session: { readonly type: "string"; }; readonly turnId: { readonly type: "string"; }; readonly prompt: { readonly type: "string"; }; readonly by: { readonly type: "string"; }; readonly steps: { readonly type: "array"; readonly items: { $ref: string; }; }; readonly text: { readonly type: "string"; }; }; }; readonly PendingPage: { readonly type: "object"; readonly required: readonly ["items"]; readonly properties: { readonly items: { readonly type: "array"; readonly items: { $ref: string; }; }; readonly next: { readonly type: "string"; }; }; }; readonly InboxEvent: { readonly type: "object"; readonly required: readonly ["kind", "cursor", "at"]; readonly properties: { readonly kind: { readonly type: "string"; }; readonly cursor: { readonly type: "string"; }; readonly at: { readonly type: "string"; readonly format: "date-time"; }; }; readonly allOf: readonly [{ readonly if: { readonly properties: { readonly kind: { readonly const: "pending.created"; }; }; }; readonly then: { readonly required: readonly ["pending"]; readonly properties: { readonly pending: { $ref: string; }; }; }; }, { readonly if: { readonly properties: { readonly kind: { readonly const: "pending.updated"; }; }; }; readonly then: { readonly required: readonly ["pendingId", "queued"]; readonly properties: { readonly pendingId: { readonly type: "string"; }; readonly queued: { readonly type: "integer"; readonly minimum: 0; }; }; }; }, { readonly if: { readonly properties: { readonly kind: { readonly const: "pending.resolved"; }; }; }; readonly then: { readonly required: readonly ["pendingId", "resolution"]; readonly properties: { readonly pendingId: { readonly type: "string"; }; readonly resolution: { $ref: string; }; }; }; }]; }; readonly SuperviseError: { readonly type: "object"; readonly required: readonly ["error", "message"]; readonly properties: { readonly error: { readonly type: "string"; }; readonly message: { readonly type: "string"; }; readonly resolution: { $ref: string; }; }; }; }; }; //#endregion