import * as s from '../schemas'; import type { Transport } from './transport'; /** * The client-facing write body for a state declaration (`PUT /api/states/{name}`), the * wire shape of `tai42_contract.states.StateDeclaration` minus the platform-computed * `effective_schema`/`regimes` (those are read-only, refused on a write). `schema` is the * `TemplatedText | dict` union: an inline JSON-schema object, or a stored template reference * (`id` + render `kwargs`) the platform renders to the schema. `retention_days` is `null` to * keep records forever. */ export interface StateDeclarationBody { readonly name: string; readonly description?: string; readonly schema: s.TemplatedText | Record; readonly subject_kinds: readonly string[]; readonly default_subject_kind: string; readonly retention_days?: number | null; } /** * A state-template document write body (`PUT /api/state-templates/{name}`, the platform half). * `schema` is the `TemplatedText | dict` union — an inline fragment schema, or a stored * template reference the platform renders to the fragment. */ export interface StateTemplateBody { readonly name: string; readonly description?: string; readonly parameters?: Record; readonly schema: s.TemplatedText | Record; readonly regimes?: Record[]; readonly declarations?: Record | null; readonly trace?: Record; } /** A template attach / re-attach body (`PUT|PATCH /api/states/{name}/attachments/{template}`). */ export interface StateAttachmentBody { readonly path?: string[]; readonly parameters?: Record; readonly declarations?: Record; readonly options?: Record; } /** The four-part subject a record route addresses in its path. */ export interface StateSubjectRef { readonly target_kind: string; readonly target_name: string; readonly kind: string; readonly key: string; } /** A keyset page request: an optional size and the opaque cursor a prior page returned. */ export interface StatePageQuery { readonly limit?: number; readonly cursor?: string; } export declare function statesClient(t: Transport): { listStates: (signal?: AbortSignal) => Promise<{ default_subject_kind: string; description: string; effective_schema: Record | null; name: string; regimes: Record[] | null; retention_days: number | null; subject_kinds: string[]; updated_at: string | null; schema?: Record | { content?: string | undefined; id?: string | undefined; kwargs?: Record | undefined; } | undefined; }[]>; getState: (name: string, signal?: AbortSignal) => Promise<{ default_subject_kind: string; description: string; effective_schema: Record | null; name: string; regimes: Record[] | null; retention_days: number | null; subject_kinds: string[]; updated_at: string | null; attachments: { template: string; path: string[]; parameters: Record; declarations: Record; }[]; schema?: Record | { content?: string | undefined; id?: string | undefined; kwargs?: Record | undefined; } | undefined; }>; putState: (name: string, body: StateDeclarationBody) => Promise<{ default_subject_kind: string; description: string; effective_schema: Record | null; name: string; regimes: Record[] | null; retention_days: number | null; subject_kinds: string[]; updated_at: string | null; attachments: { template: string; path: string[]; parameters: Record; declarations: Record; }[]; schema?: Record | { content?: string | undefined; id?: string | undefined; kwargs?: Record | undefined; } | undefined; }>; deleteState: (name: string) => Promise<{ name: string; deleted: true; }>; getStateStats: (name: string, signal?: AbortSignal) => Promise<{ records: number; per_field: Record; per_kind: Record; consumers: number; }>; listStateAttachments: (name: string, signal?: AbortSignal) => Promise<{ template: string; path: string[]; parameters: Record; declarations: Record; }[]>; getStateAttachment: (name: string, template: string, signal?: AbortSignal) => Promise<{ template: string; path: string[]; parameters: Record; declarations: Record; }>; attachStateTemplate: (name: string, template: string, body: StateAttachmentBody) => Promise<{ attached: true; state: string; template: string; }>; patchStateAttachment: (name: string, template: string, body: StateAttachmentBody) => Promise<{ updated: true; state: string; template: string; }>; detachStateTemplate: (name: string, template: string) => Promise<{ detached: true; state: string; template: string; }>; listStateSubjects: (name: string, params: { kind?: string; } & StatePageQuery, signal?: AbortSignal) => Promise<{ subjects: { subject: { target_kind: "tool" | "agent"; target_name: string; kind: string; key: string; }; updated_at: number; }[]; next_cursor: string | null; }>; searchStateRecords: (name: string, body: { filters: Record; } & StatePageQuery, signal?: AbortSignal) => Promise<{ matches: { subject: { target_kind: "tool" | "agent"; target_name: string; kind: string; key: string; }; updated_at: number; }[]; next_cursor: string | null; }>; getStateRecord: (name: string, subject: StateSubjectRef, signal?: AbortSignal) => Promise<{ state: string; subject: { target_kind: "tool" | "agent"; target_name: string; kind: string; key: string; }; data: Record; seq: number; canonical_subject: { target_kind: "tool" | "agent"; target_name: string; kind: string; key: string; }; folded_from: { target_kind: "tool" | "agent"; target_name: string; kind: string; key: string; }[]; } | null>; putStateRecord: (name: string, subject: StateSubjectRef, data: Record) => Promise<{ state: string; subject: { target_kind: "tool" | "agent"; target_name: string; kind: string; key: string; }; data: Record; seq: number; canonical_subject: { target_kind: "tool" | "agent"; target_name: string; kind: string; key: string; }; folded_from: { target_kind: "tool" | "agent"; target_name: string; kind: string; key: string; }[]; }>; patchStateRecord: (name: string, subject: StateSubjectRef, data: Record) => Promise<{ state: string; subject: { target_kind: "tool" | "agent"; target_name: string; kind: string; key: string; }; data: Record; seq: number; canonical_subject: { target_kind: "tool" | "agent"; target_name: string; kind: string; key: string; }; folded_from: { target_kind: "tool" | "agent"; target_name: string; kind: string; key: string; }[]; }>; applyStateRecord: (name: string, subject: StateSubjectRef, ops: readonly Record[]) => Promise<{ applied: boolean; data: Record | null; seq: number | null; skipped: Record[]; }>; evalTemplateJq: (name: string, subject: StateSubjectRef, jqName: string, params?: Record, signal?: AbortSignal) => Promise<{ name: string; purpose: "input"; value: unknown; }>; applyTemplateJq: (name: string, subject: StateSubjectRef, jqName: string, body?: { input?: unknown; op_id?: string; }) => Promise<{ name: string; applied: boolean; data: Record | null; seq: number | null; skipped: Record[]; }>; deleteStateRecord: (name: string, subject: StateSubjectRef) => Promise<{ erased: true; }>; foldStateRecord: (name: string, subject: StateSubjectRef, into: StateSubjectRef, mode: "switch" | "merge") => Promise<{ mode: "switch" | "merge"; from: { kind: string; key: string; }; into: { kind: string; key: string; }; already: boolean; flattened: number; }>; listStateWrites: (name: string, subject: StateSubjectRef, params?: StatePageQuery, signal?: AbortSignal) => Promise<{ items: { seq: number; at: string; origin: { consumer: string | null; meta: Record | null; run_id: string | null; op_id: string | null; door: string; actor: string | null; turn_id: string | null; inbound_id: string | null; }; paths: (string | number)[][]; }[]; next_cursor: string | null; }>; stateConsumers: (name: string, signal?: AbortSignal) => Promise<{ kind: string; name: string | null; detail: string | null; link: { token: string | null; plugin_path: string | null; search: Record | null; } | null; unavailable: string | null; }[]>; listStateTemplates: (signal?: AbortSignal) => Promise<{ declarations: { check: { content?: string | undefined; id?: string | undefined; kwargs?: Record | undefined; } | null; schema: Record; } | null; description: string; kind: "state-template"; name: string; parameters: Record; reconcile: { close: { content?: string | undefined; id?: string | undefined; kwargs?: Record | undefined; }; orphans: { content?: string | undefined; id?: string | undefined; kwargs?: Record | undefined; }; resolutions: { content?: string | undefined; id?: string | undefined; kwargs?: Record | undefined; }; } | null; regimes: Record[]; template_jq: Record | undefined; }; params: string[]; purpose: "input" | "update"; reads: string[][]; writes: string[][]; }> | null; trace: Record; attached_to: number; shipped_default: boolean; schema?: Record | { content?: string | undefined; id?: string | undefined; kwargs?: Record | undefined; } | undefined; }[]>; getStateTemplate: (name: string, signal?: AbortSignal) => Promise<{ declarations: { check: { content?: string | undefined; id?: string | undefined; kwargs?: Record | undefined; } | null; schema: Record; } | null; description: string; kind: "state-template"; name: string; parameters: Record; reconcile: { close: { content?: string | undefined; id?: string | undefined; kwargs?: Record | undefined; }; orphans: { content?: string | undefined; id?: string | undefined; kwargs?: Record | undefined; }; resolutions: { content?: string | undefined; id?: string | undefined; kwargs?: Record | undefined; }; } | null; regimes: Record[]; template_jq: Record | undefined; }; params: string[]; purpose: "input" | "update"; reads: string[][]; writes: string[][]; }> | null; trace: Record; schema?: Record | { content?: string | undefined; id?: string | undefined; kwargs?: Record | undefined; } | undefined; }>; putStateTemplate: (name: string, body: StateTemplateBody, replace?: boolean) => Promise<{ declarations: { check: { content?: string | undefined; id?: string | undefined; kwargs?: Record | undefined; } | null; schema: Record; } | null; description: string; kind: "state-template"; name: string; parameters: Record; reconcile: { close: { content?: string | undefined; id?: string | undefined; kwargs?: Record | undefined; }; orphans: { content?: string | undefined; id?: string | undefined; kwargs?: Record | undefined; }; resolutions: { content?: string | undefined; id?: string | undefined; kwargs?: Record | undefined; }; } | null; regimes: Record[]; template_jq: Record | undefined; }; params: string[]; purpose: "input" | "update"; reads: string[][]; writes: string[][]; }> | null; trace: Record; schema?: Record | { content?: string | undefined; id?: string | undefined; kwargs?: Record | undefined; } | undefined; }>; deleteStateTemplate: (name: string) => Promise<{ name: string; deleted: true; }>; pruneStateRetention: () => Promise<{ pruned: Record; }>; }; //# sourceMappingURL=states-client.d.ts.map