@dudousxd/nestjs-agent-core 0.39.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,10 +1,9 @@
1
- import { M as ModelMessage, c as ToolDefinition, d as ToolCallRequest, e as MessageUsage, f as AgentUiComponent, a as Actor, A as AgentStreamEvent, T as ToolSpec, Q as QuotaState, g as AgentRunInput, H as HumanReply, h as MessageAttachment, i as ToolKind, j as ToolCallStatus, k as ToolCallApproval, l as AgentDefinition, P as Persona, m as PersonaCatalogEntry, n as HistoryPolicy, o as PageContext, p as AgentStore, q as AgentDelegation, D as DetachedDelivery, r as PromptBuilder, s as PromptContributor, t as ToolTransientRetrySetting, u as AgentIntake, v as Decision, E as ElicitationRequest, L as LlmStepEnvelope, w as ToolStepEnvelope, C as ChatQueueStore, x as CreateThreadInput, y as ThreadSummary, z as ThreadDetail, B as ToolCallApprovalState, U as UpdateThreadInput, R as RecordRunStartInput, F as EnqueueMessageInput, G as QueuedMessage, I as QueuedMessagePatch, J as QueuePause, K as AppendMessageInput, S as StoredMessage, N as ToolResult, O as MessageFeedback, V as RecordToolCallInput, W as ToolCallOutcome, X as UpdateToolCallInput, Y as RecordUsageInput } from './stream-events-CbVEowYb.js';
2
- export { Z as ALL_AGENTS, _ as ASK_TOOL_DESCRIPTION, $ as ASK_TOOL_NAME, a0 as AgentApprovalRequest, a1 as AgentApprovalSettlement, a2 as AgentAttachmentConfig, a3 as AgentCatalogEntry, a4 as AgentClientConfig, a5 as AgentHistoryWindow, a6 as AgentStreamErrorCode, a7 as AskToolInput, a8 as ChatQueueState, a9 as DEFAULT_INTAKE_PREAMBLE, aa as DEFAULT_TOOL_TRANSIENT_RETRY_ATTEMPTS, ab as DEFAULT_TOOL_TRANSIENT_RETRY_BACKOFF_MS, ac as ELICITATION_INPUT_TYPES, ad as ElicitationInput, ae as ElicitationInputType, af as ElicitationOption, ag as ElicitationOutcome, ah as ElicitationQuestion, ai as ElicitationReply, aj as ElicitationResult, ak as HistoryPolicyContext, al as HistorySelection, am as HistorySummary, an as InvokeWithTransientRetryOptions, ao as MAX_ASK_QUESTIONS, ap as MessageFeedbackValue, aq as MessageRole, ar as PersonaRef, as as PromptContext, at as QueuePauseReason, au as QueuedMessageView, av as QuotaView, aw as RUN_ENDED_BEFORE_TOOL_CALL, ax as RecordRunEndInput, ay as ThreadTurnPage, az as ThreadTurnQuery, aA as ThreadTurnReader, aB as ToolCallApprovalStatus, aC as ToolCatalogEntry, aD as ToolConfirmation, b as ToolPresentation, aE as ToolPresentationTone, aF as ToolResultField, aG as ToolResultView, aH as ToolStepCtx, aI as ToolTransientRetryNumbers, aJ as ToolTransientRetryOptions, aK as TurnPersona, aL as UNFINISHED_TOOL_CALL, aM as UsagePurpose, aN as askInputSchema, aO as askToolDefinition, aP as danglingToolCallIds, aQ as decodeStreamEvent, aR as encodeStreamEvent, aS as invokeWithTransientRetry, aT as isChatQueueStore, aU as isTransientToolError, aV as isTypedQuestion, aW as normalizeElicitationReply, aX as questionOptions, aY as queuedMessageView, aZ as readElicitationInput, a_ as readElicitationQuestions, a$ as releaseThreadRun, b0 as renderElicitationAnswers, b1 as resolveElicitation, b2 as resolveToolTransientRetryNumbers, b3 as settleDanglingToolCalls, b4 as settleElicitation, b5 as validateElicitationAnswer, b6 as validateElicitationValue } from './stream-events-CbVEowYb.js';
3
- import { A as AiToolCtx, T as ToolHandler, a as ToolDescribeScope } from './tool-_iq4xRyk.js';
4
- export { b as ToolDescription } from './tool-_iq4xRyk.js';
1
+ import { M as ModelMessage, d as ToolDefinition, e as ToolCallRequest, f as MessageUsage, g as AgentUiComponent, a as Actor, h as AiToolCtx, A as AgentStreamEvent, T as ToolSpec, Q as QuotaState, i as AgentRunInput, H as HumanReply, j as MessageAttachment, k as ActionProposalMutationResult, b as ToolHandler, l as AgentDefinition, m as Persona, o as PersonaCatalogEntry, q as HistoryPolicy, r as PageContext, s as AgentStore, t as AgentDelegation, D as DetachedDelivery, u as ToolDescribeScope, w as ToolPreflightResult, x as ApprovalPolicy, y as PromptBuilder, z as PromptContributor, B as ToolTransientRetrySetting, C as AgentIntake, E as Decision, F as ElicitationRequest, L as LlmStepEnvelope, G as ToolStepEnvelope, I as ClaimActionProposal, J as ActionProposal, K as ActionProposalStore, N as ActionProposalStoreOptions, O as CreateActionProposal, R as CreateActionProposalResult, S as ActionProposalScope, V as ListActionProposals, W as ActionProposalDecisionCommand, X as ExtendActionProposalLease, Y as SettleActionProposal, Z as ActionProposalOutcome, _ as ActionProposalOutcomeLease, $ as ToolCallStatus, a0 as ChatQueueStore, a1 as ActionProposalOutcomeStore, a2 as CreateThreadInput, a3 as ThreadSummary, a4 as ThreadDetail, a5 as ToolCallApprovalState, a6 as UpdateThreadInput, a7 as RecordRunStartInput, a8 as EnqueueMessageInput, a9 as QueuedMessage, aa as QueuedMessagePatch, ab as QueuePause, ac as AppendMessageInput, ad as StoredMessage, ae as ToolResult, af as MessageFeedback, ag as RecordToolCallInput, ah as ToolCallOutcome, ai as UpdateToolCallInput, aj as RecordUsageInput, ak as ToolConfirmation, al as ActionProposalDecision, am as ActionProposalSupersessionStore } from './stream-events-DAmes2Of.js';
2
+ export { an as ALL_AGENTS, ao as ASK_TOOL_DESCRIPTION, ap as ASK_TOOL_NAME, aq as ActionProposalDecisionAudit, ar as ActionProposalExecution, as as ActionProposalExecutionContext, at as ActionProposalLease, au as ActionProposalOutcomeDelivery, av as AgentApprovalRequest, aw as AgentApprovalSettlement, ax as AgentAttachmentConfig, ay as AgentCatalogEntry, az as AgentClientConfig, aA as AgentHistoryWindow, aB as AgentStreamErrorCode, aC as ApprovalDecisionRef, aD as ApprovalRequirement, aE as ApprovalThreadRef, aF as ApprovalToolRef, aG as AskToolInput, aH as ChatQueueState, aI as ClaimedActionApproval, aJ as DEFAULT_INTAKE_PREAMBLE, aK as DEFAULT_TOOL_TRANSIENT_RETRY_ATTEMPTS, aL as DEFAULT_TOOL_TRANSIENT_RETRY_BACKOFF_MS, aM as DefaultApprovalPolicy, aN as ELICITATION_INPUT_TYPES, aO as ElicitationInput, aP as ElicitationInputType, aQ as ElicitationOption, aR as ElicitationOutcome, aS as ElicitationQuestion, aT as ElicitationReply, aU as ElicitationResult, aV as EmitUiOptions, aW as HistoryPolicyContext, aX as HistorySelection, aY as HistorySummary, aZ as InvokeWithTransientRetryOptions, a_ as MAX_ASK_QUESTIONS, a$ as MessageFeedbackValue, b0 as MessageRole, b1 as PersonaRef, b2 as PromptContext, b3 as QueuePauseReason, b4 as QueuedMessageView, b5 as QuotaView, b6 as REQUESTER_APPROVER, b7 as RUN_ENDED_BEFORE_TOOL_CALL, b8 as RecordRunEndInput, b9 as ResolveActionProposalApprovalInput, ba as ThreadTurnPage, bb as ThreadTurnQuery, bc as ThreadTurnReader, bd as ToolCallApproval, be as ToolCallApprovalColumns, bf as ToolCallApprovalStatus, bg as ToolCatalogEntry, bh as ToolDescription, bi as ToolKind, bj as ToolPreflightOptions, c as ToolPresentation, bk as ToolPresentationTone, bl as ToolResultField, bm as ToolResultView, bn as ToolStepCtx, bo as ToolTransientRetryNumbers, bp as ToolTransientRetryOptions, bq as TurnPersona, br as UNFINISHED_TOOL_CALL, bs as UsagePurpose, bt as askInputSchema, bu as askToolDefinition, bv as danglingToolCallIds, bw as decodeStreamEvent, bx as defaultCanDecide, by as encodeStreamEvent, bz as invokeWithTransientRetry, bA as isChatQueueStore, bB as isTransientToolError, bC as isTypedQuestion, bD as mayDecideApproval, bE as normalizeElicitationReply, bF as questionOptions, bG as queuedMessageView, bH as readElicitationInput, bI as readElicitationQuestions, bJ as releaseThreadRun, bK as renderElicitationAnswers, bL as resolveActionProposalApproval, bM as resolveElicitation, bN as resolveToolTransientRetryNumbers, bO as settleDanglingToolCalls, bP as settleElicitation, bQ as toolCallApprovalFromRow, bR as validateElicitationAnswer, bS as validateElicitationValue } from './stream-events-DAmes2Of.js';
5
3
  import { StandardSchemaV1 } from '@standard-schema/spec';
6
- import { O as OutputProcessor, P as ProcessorContext, I as InputProcessor, a as ProcessedPrompt, M as ModelAnswer } from './processors-Bp5XmF6V.js';
7
- export { D as DEFAULT_INCREMENTAL_LOOKBACK_CHARS, b as IncrementalGating, c as OutputRejectedError, d as OutputVerdict, e as ProcessorFailedError } from './processors-Bp5XmF6V.js';
4
+ import { O as OutputProcessor, P as ProcessorContext, I as InputProcessor, a as ProcessedPrompt, M as ModelAnswer } from './processors-BR3nICcp.js';
5
+ export { D as DEFAULT_INCREMENTAL_LOOKBACK_CHARS, b as IncrementalGating, c as OutputRejectedError, d as OutputVerdict, e as ProcessorFailedError } from './processors-BR3nICcp.js';
6
+ import { a as Catalog } from './catalog-CrzetM3_.js';
8
7
  import { ChannelRegistry } from '@dudousxd/nestjs-diagnostics';
9
8
 
10
9
  /**
@@ -335,11 +334,15 @@ declare function observeTurnFrames(writer: SinkWriter, now?: () => number): Obse
335
334
  declare function withTurnFrames<T extends ModelTurnResult>(result: T, frames: TurnFrameSummary): T;
336
335
 
337
336
  /** The tool step's journaled result: the bare output, or the output plus the components it pushed. */
338
- declare function wrapToolStepOutput(output: unknown, ui: readonly AgentUiComponent[]): unknown;
337
+ declare function wrapToolStepOutput(output: unknown, ui: readonly AgentUiComponent[], text?: string): unknown;
338
+ /** Carry domain refusal across a remote step without losing its type in error serialization. */
339
+ declare function wrapToolPreflightDenied(reason: string): unknown;
339
340
  /** Read a tool step's result back — either shape. */
340
341
  declare function unwrapToolStepOutput(raw: unknown): {
341
342
  output: unknown;
342
343
  ui: AgentUiComponent[];
344
+ preflightDenied?: string;
345
+ text?: string;
343
346
  };
344
347
  type EmitUi = AiToolCtx['emitUi'];
345
348
  /**
@@ -366,6 +369,8 @@ interface UiCollector {
366
369
  declare function createUiCollector(toolCallId: string, write?: (event: AgentStreamEvent) => void | Promise<void>): UiCollector;
367
370
  /** Merge component lists: first-seen order, the last props for each id. */
368
371
  declare function mergeUi(...lists: readonly (readonly AgentUiComponent[] | undefined)[]): AgentUiComponent[];
372
+ /** Escape code units native PostgreSQL/MySQL TEXT cannot store; retain ordinary prose and emoji. */
373
+ declare function escapeUnsafeToolUiText(text: string): string;
369
374
 
370
375
  /**
371
376
  * Decides whether an actor may invoke a tool. The default impl checks the actor's role
@@ -1137,6 +1142,22 @@ interface AttachmentStagingDescription {
1137
1142
  * approvals inbox renders read-only.
1138
1143
  */
1139
1144
  interface AgentApprovalPort {
1145
+ approveActionProposal?(actor: Actor, target: {
1146
+ kind: 'proposal';
1147
+ threadId: string;
1148
+ proposalId: string;
1149
+ }, opts?: {
1150
+ remember?: boolean;
1151
+ decidedVia?: string;
1152
+ }): Promise<ActionProposalMutationResult>;
1153
+ rejectActionProposal?(actor: Actor, target: {
1154
+ kind: 'proposal';
1155
+ threadId: string;
1156
+ proposalId: string;
1157
+ }, opts?: {
1158
+ reason?: string;
1159
+ decidedVia?: string;
1160
+ }): Promise<ActionProposalMutationResult>;
1140
1161
  /**
1141
1162
  * `remember` approves later calls of the same tool in the same thread; `decidedVia` names the
1142
1163
  * surface the decision came through (`'console'`, `'slack'`, …) and is persisted with the call.
@@ -1153,89 +1174,6 @@ interface AgentApprovalPort {
1153
1174
  }): Promise<void>;
1154
1175
  }
1155
1176
 
1156
- /** The approver that means "the person the run is acting for" — the thread's own actor. */
1157
- declare const REQUESTER_APPROVER = "requester";
1158
- /** The tool a requirement is asked about. `spec` is absent where this process cannot resolve it. */
1159
- interface ApprovalToolRef {
1160
- name: string;
1161
- kind: ToolKind;
1162
- spec?: ToolSpec;
1163
- }
1164
- /** Where the call is being made. */
1165
- interface ApprovalThreadRef {
1166
- threadId: string;
1167
- runId: string;
1168
- agentName?: string;
1169
- }
1170
- /**
1171
- * What an action tool call needs before it runs.
1172
- *
1173
- * - `required: false` → the call runs without asking anyone (it is still recorded as an action).
1174
- * - `approver` → who may decide: {@link REQUESTER_APPROVER} (the thread's own actor — the default)
1175
- * or any other string, which the default {@link ApprovalPolicy.canDecide} reads as a ROLE the
1176
- * decider must hold. Streamed on `approval-requested` and persisted on the call.
1177
- * - `ttlMs` → how long the request stays open. When it lapses the call settles `expired` and the
1178
- * model is told nobody approved it. Absent → it waits indefinitely.
1179
- */
1180
- interface ApprovalRequirement {
1181
- required: boolean;
1182
- approver: string;
1183
- ttlMs?: number;
1184
- }
1185
- /** A decision about to be taken on a call, as {@link ApprovalPolicy.canDecide} sees it. */
1186
- interface ApprovalDecisionRef {
1187
- toolCallId: string;
1188
- /** The approver recorded on the call when it was put to a person. */
1189
- approver: string;
1190
- /** The actorRef the run is acting for — the owner of the call's thread. */
1191
- requesterRef: string;
1192
- }
1193
- /**
1194
- * Who has to approve an action tool call, and for how long the request stays open.
1195
- *
1196
- * Consulted by the LOOP once per `action` call, inside the call's `persist:toolcall` checkpoint — so
1197
- * a durable run reads the answer back on every replay instead of re-deciding it against a policy
1198
- * that may have changed while it was parked. Only `action` calls are asked about: a policy cannot
1199
- * put a `read` behind an approval, and an `ask` (a question set) is always the requester's.
1200
- */
1201
- interface ApprovalPolicy {
1202
- requirementFor(tool: ApprovalToolRef, actor: Actor, thread: ApprovalThreadRef): ApprovalRequirement | Promise<ApprovalRequirement>;
1203
- /**
1204
- * May `actor` settle this call? Checked by the approve/reject routes before a decision is
1205
- * signalled. Absent → {@link defaultCanDecide}: the requester approver means the thread's own
1206
- * actor, anything else is a role the actor must hold. Plug an authz Gate here for abilities.
1207
- */
1208
- canDecide?(actor: Actor, decision: ApprovalDecisionRef): boolean | Promise<boolean>;
1209
- }
1210
- /**
1211
- * The behaviour the lib always had: every `action` call waits on the person who asked, with no
1212
- * expiry.
1213
- */
1214
- declare class DefaultApprovalPolicy implements ApprovalPolicy {
1215
- requirementFor(tool: ApprovalToolRef): ApprovalRequirement;
1216
- }
1217
- /** The default decider rule — see {@link ApprovalPolicy.canDecide}. */
1218
- declare function defaultCanDecide(actor: Actor, decision: ApprovalDecisionRef): boolean;
1219
- /** Resolve whether `actor` may decide, through the policy's own rule when it has one. */
1220
- declare function mayDecideApproval(policy: ApprovalPolicy | undefined, actor: Actor, decision: ApprovalDecisionRef): Promise<boolean>;
1221
- /** The columns a store keeps for one call's approval, however it names them. */
1222
- interface ToolCallApprovalColumns {
1223
- toolCallId: string;
1224
- status: ToolCallStatus;
1225
- approver: string | null | undefined;
1226
- expiresAt: string | Date | null | undefined;
1227
- remember: boolean | null | undefined;
1228
- executedByRef: string | null | undefined;
1229
- decidedVia: string | null | undefined;
1230
- error: string | null | undefined;
1231
- }
1232
- /**
1233
- * Read a tool-call row back as the {@link ToolCallApproval} a thread carries, or `null` for a call
1234
- * no policy put to anyone (no approver recorded). Shared by every store so they agree on the
1235
- * status mapping: a call that ran — or ran and failed — after a decision was APPROVED.
1236
- */
1237
- declare function toolCallApprovalFromRow(row: ToolCallApprovalColumns): ToolCallApproval | null;
1238
-
1239
1177
  /**
1240
1178
  * The pure aggregation core shared by every {@link import('../spi/governance-queries.js').AgentGovernanceQueries}
1241
1179
  * adapter (MikroORM, Drizzle, in-memory). An adapter's only job is the DB-specific row fetch; the
@@ -2553,6 +2491,17 @@ declare class ToolInputInvalidError extends Error {
2553
2491
  readonly issues: readonly StandardSchemaV1.Issue[];
2554
2492
  constructor(toolName: string, issues: readonly StandardSchemaV1.Issue[]);
2555
2493
  }
2494
+ /** An action refused by its current domain state, rather than by a person. */
2495
+ declare class ToolPreflightDeniedError extends Error {
2496
+ readonly toolName: string;
2497
+ readonly reason: string;
2498
+ constructor(toolName: string, reason: string);
2499
+ }
2500
+ /** Trusted preparation or a fresh schema parse changed the approved JSON input. */
2501
+ declare class ToolInputDriftError extends Error {
2502
+ readonly toolName: string;
2503
+ constructor(toolName: string);
2504
+ }
2556
2505
  /**
2557
2506
  * Holds every registered tool and gates invocation.
2558
2507
  *
@@ -2601,6 +2550,11 @@ declare class ToolRegistry {
2601
2550
  * moved, neither of which went through `definitionsFor` again) and re-parses the input via Zod.
2602
2551
  */
2603
2552
  invoke(name: string, input: unknown, ctx: AiToolCtx, policy: RolesPolicy, options?: InvokeOptions): Promise<unknown>;
2553
+ /** Authorize and validate without executing. The caller journals this result before approval. */
2554
+ prepare(name: string, input: unknown, ctx: AiToolCtx, policy: RolesPolicy, options?: PrepareOptions): Promise<ToolPreflightResult>;
2555
+ /** Expose the single schema parse; snapshotInput opts proposal callers into immutable JSON. */
2556
+ prepareValidated(name: string, input: unknown, ctx: AiToolCtx, policy: RolesPolicy, options?: PrepareOptions): Promise<ToolPreparationResult>;
2557
+ private validated;
2604
2558
  }
2605
2559
  /** Per-call narrowing for {@link ToolRegistry.invoke}. */
2606
2560
  interface InvokeOptions {
@@ -2609,6 +2563,16 @@ interface InvokeOptions {
2609
2563
  * roles policy and `canUse`. Undefined → no such check (every caller predating personas).
2610
2564
  */
2611
2565
  allowedTools?: readonly string[];
2566
+ /** Trusted normalized JSON input. Own-property presence requires comparison even if undefined. */
2567
+ approvedInput?: unknown;
2568
+ }
2569
+ interface PrepareOptions extends InvokeOptions {
2570
+ /** Preserve a detached normalized JSON snapshot and refuse mutation by the prepare hook. */
2571
+ snapshotInput?: boolean;
2572
+ }
2573
+ interface ToolPreparationResult {
2574
+ input: unknown;
2575
+ preflight: ToolPreflightResult;
2612
2576
  }
2613
2577
  /**
2614
2578
  * Default gate: a tool that names `roles` is callable by an actor holding one of them; a tool that
@@ -2658,7 +2622,27 @@ declare class ClosedRolesPolicy extends DefaultRolesPolicy {
2658
2622
  */
2659
2623
  declare function closeEmptyRoles(inner: RolesPolicy): RolesPolicy;
2660
2624
 
2625
+ type ActionApprovalMode = 'blocking' | 'independent';
2626
+ type ActionProposalTarget = {
2627
+ kind: 'proposal';
2628
+ proposalId: string;
2629
+ };
2630
+ interface ActionProposalReceipt {
2631
+ proposalId: string;
2632
+ status: 'pending';
2633
+ executed: false;
2634
+ }
2635
+ declare function actionProposalReceipt(proposalId: string): ActionProposalReceipt;
2636
+
2637
+ type ResolveToolUiCatalog = (scope: ToolDescribeScope) => Catalog | Promise<Catalog>;
2638
+ interface NegotiatedUiCollector extends UiCollector {
2639
+ text(): string;
2640
+ }
2641
+ declare function createNegotiatedUiCollector(toolCallId: string, scope: ToolDescribeScope, resolveCatalog?: ResolveToolUiCatalog, write?: (event: AgentStreamEvent) => void | Promise<void>): NegotiatedUiCollector;
2642
+
2661
2643
  interface AgentLoopDeps<TOutput = unknown> {
2644
+ actionApprovalMode?: ActionApprovalMode;
2645
+ resolveUiCatalog?: ResolveToolUiCatalog;
2662
2646
  model: ModelProvider;
2663
2647
  store: AgentStore;
2664
2648
  registry: ToolRegistry;
@@ -3399,6 +3383,51 @@ type AgentDiagnosticKey = `agent:${AgentDiagnosticEvent}`;
3399
3383
  */
3400
3384
  declare function agentDiagnosticKey(event: AgentDiagnosticEvent): AgentDiagnosticKey;
3401
3385
 
3386
+ /** Privileged worker-only discovery; never expose this unscoped capability on public routes. */
3387
+ interface ActionProposalWorkerStore {
3388
+ /** Claim one queued or expired-lease action across scopes; null means no claim was won. */
3389
+ claimNextActionProposal(command: ClaimActionProposal): Promise<ActionProposal | null>;
3390
+ /** Expire at most limit (1..1000) due pending proposals using the store's trusted clock. */
3391
+ expireActionProposals(command: {
3392
+ limit: number;
3393
+ }): Promise<number>;
3394
+ }
3395
+ /** SQL upgrade capability. Run bounded batches after additive DDL and before starting workers. */
3396
+ interface ActionProposalDiscoveryIndexStore {
3397
+ backfillActionProposalDiscoveryIndex(command: {
3398
+ limit: number;
3399
+ }): Promise<number>;
3400
+ }
3401
+
3402
+ /** Reference single-process implementation; durable adapters use the same transitions under CAS. */
3403
+ declare class InMemoryActionProposalStore implements ActionProposalStore, ActionProposalWorkerStore {
3404
+ protected readonly rows: Map<string, ActionProposal>;
3405
+ protected readonly clock: () => number;
3406
+ constructor(options?: ActionProposalStoreOptions);
3407
+ createActionProposal(input: CreateActionProposal): Promise<CreateActionProposalResult>;
3408
+ getActionProposal(scope: ActionProposalScope, id: string): Promise<ActionProposal | null>;
3409
+ listActionProposals(scope: ActionProposalScope, query?: ListActionProposals): Promise<ActionProposal[]>;
3410
+ private mutate;
3411
+ decideActionProposal(scope: ActionProposalScope, id: string, command: ActionProposalDecisionCommand): Promise<ActionProposalMutationResult>;
3412
+ claimActionProposal(scope: ActionProposalScope, id: string, command: ClaimActionProposal): Promise<ActionProposalMutationResult>;
3413
+ extendActionProposalLease(scope: ActionProposalScope, id: string, command: ExtendActionProposalLease): Promise<ActionProposalMutationResult>;
3414
+ settleActionProposal(scope: ActionProposalScope, id: string, command: SettleActionProposal): Promise<ActionProposalMutationResult>;
3415
+ claimNextActionProposal(command: ClaimActionProposal): Promise<ActionProposal | null>;
3416
+ expireActionProposals(command: {
3417
+ limit: number;
3418
+ }): Promise<number>;
3419
+ claimNextActionProposalOutcome(command: ClaimActionProposal): Promise<{
3420
+ outcome: ActionProposalOutcome;
3421
+ lease: ActionProposalOutcomeLease;
3422
+ } | null>;
3423
+ createReplacingActionProposal(input: CreateActionProposal): Promise<CreateActionProposalResult>;
3424
+ supersedeActionProposal(scope: ActionProposalScope, id: string, command: {
3425
+ replacementProposalId: string;
3426
+ actorRef: string;
3427
+ via: string;
3428
+ }): Promise<ActionProposalMutationResult>;
3429
+ }
3430
+
3402
3431
  /** A recorded usage row exposed to the governance read-model (input/output split + thread/day). */
3403
3432
  interface GovernanceUsageRow {
3404
3433
  actorRef: string;
@@ -3484,7 +3513,7 @@ interface GovernanceRunRow {
3484
3513
  parentRunId?: string;
3485
3514
  }
3486
3515
  /** A fully in-memory `AgentStore` for tests and the offline demo. */
3487
- declare class InMemoryAgentStore implements AgentStore, ChatQueueStore {
3516
+ declare class InMemoryAgentStore extends InMemoryActionProposalStore implements AgentStore, ChatQueueStore, ActionProposalOutcomeStore {
3488
3517
  private readonly threads;
3489
3518
  /** Each thread's waiting messages, in run order. */
3490
3519
  private readonly queues;
@@ -3553,6 +3582,8 @@ declare class InMemoryAgentStore implements AgentStore, ChatQueueStore {
3553
3582
  queuePause(threadId: string): Promise<QueuePause | null>;
3554
3583
  setQueuePause(threadId: string, pause: QueuePause | null): Promise<void>;
3555
3584
  private findQueued;
3585
+ getThreadActionProposalScope(threadId: string): Promise<ActionProposalScope | null>;
3586
+ admitActionProposalOutcome(command: ActionProposalOutcomeLease): ReturnType<ActionProposalOutcomeStore['admitActionProposalOutcome']>;
3556
3587
  appendMessage(input: AppendMessageInput): Promise<StoredMessage>;
3557
3588
  setMessageToolResults(messageId: string, results: ToolResult[]): Promise<void>;
3558
3589
  setMessageUi(messageId: string, ui: AgentUiComponent[]): Promise<void>;
@@ -3901,7 +3932,11 @@ interface StreamFrameTable {
3901
3932
  remove(runIds: readonly string[]): Promise<void>;
3902
3933
  /** Runs whose LAST row was written before `cutoff` (epoch-ms). */
3903
3934
  lapsedRuns(cutoff: number): Promise<string[]>;
3904
- /** Is this error a lost race for a `(run_id, seq)` — and nothing else (a missing table, a dead connection)? */
3935
+ /**
3936
+ * Is this error a lost race for a `(run_id, seq)` — a duplicate key, or the database rolling this
3937
+ * writer back as a deadlock victim (InnoDB's way of settling two concurrent `INSERT … SELECT`) —
3938
+ * and nothing else (a missing table, a dead connection)?
3939
+ */
3905
3940
  isUniqueViolation(error: unknown): boolean;
3906
3941
  }
3907
3942
  interface SqlTokenStreamSinkOptions {
@@ -4001,4 +4036,156 @@ declare class SqlTokenStreamSink implements TokenStreamSink {
4001
4036
  private purgeInBackground;
4002
4037
  }
4003
4038
 
4004
- export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_ATTACHMENT_STAGING, AGENT_CONFIRM_TOKEN_STORE, AGENT_DEPS_FACTORY, AGENT_DIAGNOSTIC_EVENTS, AGENT_DURABLE_RUNNER, AGENT_EMBEDDING_PROVIDER, AGENT_GOVERNANCE_QUERIES, AGENT_MEMORY, AGENT_MODEL, AGENT_MODEL_CATALOG, AGENT_OPTIONS, AGENT_PRICING_STORE, AGENT_PROMPT_CONTRIBUTORS, AGENT_QUOTA_PROVIDER, AGENT_QUOTA_STORE, AGENT_REGISTRY, AGENT_RETRIEVER, AGENT_ROLES_POLICY, AGENT_RUNNER, AGENT_SINK, AGENT_SKILLS, AGENT_SKILL_SOURCES, AGENT_SPAN_EVENTS, AGENT_STORE, AGENT_TOOL_REGISTRY, APPROVAL_EXPIRED_REASON, Actor, type ActorDirectory, type ActorResolver, type ActorSpendRow, type AgentApprovalPort, AgentDefinition, type AgentDelegated, AgentDelegation, type AgentDiagnosticEvent, type AgentDiagnosticKey, type AgentFollowUpsSpan, type AgentGovernanceQueries, AgentIntake, type AgentLlmTurnSpan, type AgentLoopDeps, type AgentLoopHooks, type AgentLoopResult, type AgentMemoryResolved, type AgentMemoryWritten, type AgentMessageEvent, type AgentPricingStore, type AgentQuotaExceeded, AgentRegistry, type AgentRetrievalSpan, type AgentRetrieved, type AgentRunFailed, type AgentRunFinished, AgentRunInput, type AgentRunStartOptions, type AgentRunStarted, type AgentRunner, type AgentSkillsResolved, type AgentSpanEvent, AgentStore, AgentStreamError, AgentStreamEvent, type AgentStructuredOutputSpan, type AgentToolCallEvent, type AgentToolExecutionSpan, type AgentToolRetry, AgentUiComponent, AiToolCtx, AppendMessageInput, type ApprovalDecisionRef, type ApprovalPolicy, type ApprovalRequirement, type ApprovalThreadRef, type ApprovalToolRef, type ApprovalWhere, type AttachmentRef, type AttachmentStagingDescription, type AttachmentStagingStore, type BufferedModelTurnResult, type BuildMemoryBlockInput, CONFIRM_JSON_SCHEMA_PROPERTIES, ChatQueueStore, ClosedRolesPolicy, type ConfirmFields, type ConfirmTokenClaim, ConfirmTokenError, type ConfirmTokenStore, type ConfirmTokenSubject, type ConfirmedTool, type ConfirmedToolDone, type ConfirmedToolMessages, type ConfirmedToolOptions, type ConfirmedToolOutcome, type ConfirmedToolPreview, type ConfirmedToolResult, type ConfirmedToolSteps, type CostUsage, CreateThreadInput, type CurrentModelPrice, DEFAULT_CONFIRM_TTL_MS, DEFAULT_HISTORY_SUMMARY_INSTRUCTION, DEFAULT_MAX_FACT_CHARS, DEFAULT_MAX_MEMORIES, DEFAULT_MAX_SKILLS, DEFAULT_REFUSAL_REASON, DEFAULT_STRUCTURED_OUTPUT_INSTRUCTION, Decision, DefaultApprovalPolicy, DefaultRolesPolicy, type DetachedDelegationOutcome, type DetachedDelegationReceipt, DetachedDelivery, type DetailThreadRef, ElicitationRequest, type EmbeddingProvider, type EmitUi, type EmptyRoles, EnqueueMessageInput, type ForgetMemoryInput, type FrameBuffer, GLOBAL_SCOPE, type GovernanceMessageRow, type GovernancePage, type GovernancePageQuery, type GovernancePendingApprovalRow, type GovernanceRange, type GovernanceRunDetail, type GovernanceRunRow, type GovernanceThreadDetail, type GovernanceThreadDetailQuery, type GovernanceThreadRow, type GovernanceToolCallRow, type GovernanceUsageInput, type GovernanceUsageRow, HistoryPolicy, HumanReply, InMemoryAgentStore, InMemoryConfirmTokenStore, type IncrementalGate, InputProcessor, type InvokeOptions, type ListMemoriesInput, type ListSkillsInput, type ListStagedAttachmentsInput, LlmStepEnvelope, type LoadSkillInput, type MemoryAuthor, type MemoryConfig, type MemoryDigest, type MemoryDigestEntry, type MemoryFact, type MemoryForgetRequest, type MemoryOrigin, type MemoryProvider, type MemoryRecord, type MemoryVerdict, type MemoryWriteOutcome, type MemoryWriteRequest, MessageAttachment, MessageFeedback, MessageUsage, ModelAnswer, type ModelCatalog, type ModelCatalogEntry, type ModelCatalogLock, type ModelCatalogProviderGroup, type ModelCatalogQuery, type ModelCatalogView, ModelMessage, type ModelPrice, type ModelPriceInput, type ModelProvider, type ModelSpendRow, type ModelTurnArgs, type ModelTurnResult, type ObservedTurnFrames, type OfferMemoriesInput, type OutputGateMode, type OutputGateResult, OutputProcessor, type OverriddenMemory, PageContext, type Passage, type PendingApprovalRow, Persona, type PersonaAlias, PersonaCatalogEntry, ProcessedPrompt, ProcessorContext, PromptBuilder, PromptContributor, QueuePause, QueuedMessage, QueuedMessagePatch, type QuotaBlock, QuotaExceededError, type QuotaPeriod, type QuotaProvider, type QuotaQuery, type QuotaReport, QuotaState, type QuotaStore, type QuotaWarning, type QuotaWindow, REMEMBER_TOOL_DESCRIPTION, REMEMBER_TOOL_NAME, REQUESTER_APPROVER, RUN_FAILED_MESSAGE, RUN_NOT_ACTIVE_CODE, RUN_NOT_ACTIVE_MESSAGE, RUN_NO_LONGER_RUNNING, type RecentRunRow, RecordRunStartInput, RecordToolCallInput, RecordUsageInput, type RememberToolInput, type RerankOptions, type Reranker, type ResolveAttachmentInput, type ResolveMemoryDigestInput, type ResolvedDelegation, type RetrieveOptions, type Retriever, type RolesPolicy, type RolesPolicyOptions, type RunAgentBreakdownRow, RunCancelledError, type RunErrorBreakdownRow, type RunMetrics, type RunToolCallRow, type RunTrendPoint, type RunWhere, SCHEMA_EXTENSION, SKILL_TOOL_DESCRIPTION, SKILL_TOOL_NAME, type SchemaExtension, type ScopeContext, type ScopeResolver, type SearchMemoriesInput, type SettleDeadRunInput, type SettledTask, type SinkWriter, type Skill, type SkillAuthor, type SkillCatalogEntry, type SkillContext, type SkillLoadOutcome, type SkillOffer, type SkillProvider, type SkillSummary, type SkillToolInput, type SkillWriteRequest, type SkillWriteVerdict, type SkillsConfig, SqlTokenStreamSink, type SqlTokenStreamSinkOptions, type StageAttachmentInput, type StagedAttachment, type StoreMemoryInput, StoredMessage, type StreamError, type StreamFrameRow, type StreamFrameTable, type StructuredOutcome, StructuredOutputError, THREAD_DETAIL_CONTENT_CHARS, type ThreadActivityRow, ThreadDetail, type ThreadMessageRow, type ThreadMeta, type ThreadSpendRow, ThreadSummary, type ThreadUsageRollup, type ThreadWhere, type TokenStreamSink, type ToolCallActivityRow, ToolCallApproval, type ToolCallApprovalColumns, ToolCallApprovalState, ToolCallOutcome, ToolCallRequest, ToolCallStatus, type ToolCallWhere, ToolDefinition, ToolDescribeScope, ToolDisabledError, ToolForbiddenError, ToolHandler, ToolInputInvalidError, ToolKind, type ToolKindDeps, ToolNotFoundError, ToolRegistry, ToolResult, ToolSpec, type ToolStatRow, ToolStepEnvelope, ToolTransientRetrySetting, type TurnFrameSummary, type UiCollector, UpdateThreadInput, UpdateToolCallInput, type UsageTrendPoint, type WindowHistoryOptions, type WithMemoryToolInput, type WriteMemoryInput, actorScope, agentDiagnosticKey, agentFailureCode, bucketByActor, bucketByModel, bucketByThread, bucketUsageTrend, buildMemoryBlock, buildSkillsBlock, canActorUseTool, canonicalJson, closeEmptyRoles, compositeSkillProvider, confirmTokenExpiry, createFrameBuffer, createIncrementalGate, createNoopEmitUi, createUiCollector, dayBoundsUtc, defaultCanDecide, defaultScopeResolver, defineConfirmedTool, detachedDelivered, detachedStarted, detachedUnsettled, estimateCost, estimateMessageTokens, exhaustedWindow, exposeStreamErrorDetails, extractJson, filterToolsByAllowList, filterToolsByCanUse, filterToolsByEnabled, filterToolsByRole, findCatalogModel, findPersona, gateFollowUps, gateTail, hashConfirmToken, intersectAllowLists, isControlFlowSignal, isReplayIntegrityError, isToolEnabled, loadSkill, mayDecideApproval, memoryForgetVerdict, memoryWriteVerdict, mergeUi, normalizeDelegation, observeTurnFrames, offerMemories, offerSkills, personaCatalogEntry, publishAgentDelegated, publishAgentMemoryResolved, publishAgentMemoryWritten, publishAgentMessage, publishAgentQuotaExceeded, publishAgentRetrieved, publishAgentRunFailed, publishAgentRunFinished, publishAgentRunStarted, publishAgentSkillsResolved, publishAgentToolCall, publishAgentToolRetry, quotaPeriodRange, quotaUsedRatio, quotaWarning, releaseGatedFrames, rememberInputSchema, rememberToolDefinition, repairInstruction, resolveGateLookback, resolveMemoryDigest, resolveOutputGateMode, resolvePersonaAlias, resolveSkillCatalog, rollupThreadUsage, runAgentLoop, runInputProcessors, runOutputProcessors, schemaExtensionOf, seedModelPrices, settleAll, settleDeadRun, settleUnsettledDelegation, signConfirmToken, skillInputSchema, skillToolDefinition, skillWriteVerdict, stampToolKinds, staticModelCatalog, staticSkillProvider, streamFailure, summarizeWithModel, tenantScope, toolCallApprovalFromRow, toolCallContext, traceLlmTurn, traceToolExecution, truncateDetailContent, unwrapToolStepOutput, validateStructured, verifyConfirmToken, windowHistory, withAskTool, withConfirmFields, withMemoryTool, withSelectedModel, withSkillTool, withToolTimeout, withTurnFrames, wrapToolStepOutput, writeMemory };
4039
+ declare function validateActionProposalCreation(input: CreateActionProposal): void;
4040
+ declare function validateActionProposalListQuery(query?: ListActionProposals): number;
4041
+ /** Canonical JSON snapshots keep replay equality independent of object key insertion order. */
4042
+ declare function canonicalActionProposalJson(value: unknown): string;
4043
+ declare function snapshotActionProposal<T>(value: T): T;
4044
+ declare function actionProposalScopeMatches(row: ActionProposalScope, scope: ActionProposalScope): boolean;
4045
+ declare function initialActionProposal(input: CreateActionProposal, now: number): ActionProposal;
4046
+ declare function actionProposalCreationMatches(row: ActionProposal, input: CreateActionProposal): boolean;
4047
+ declare function transitionActionProposalDecision(row: ActionProposal, command: ActionProposalDecisionCommand, now: number): ActionProposalMutationResult;
4048
+ declare function transitionActionProposalClaim(row: ActionProposal, command: ClaimActionProposal, now: number, token: string): ActionProposalMutationResult;
4049
+ declare function transitionActionProposalLease(row: ActionProposal, command: ExtendActionProposalLease, now: number): ActionProposalMutationResult;
4050
+ declare function transitionActionProposalSettlement(row: ActionProposal, command: SettleActionProposal, now: number): ActionProposalMutationResult;
4051
+ /** Caller must obtain the replacement through the same full scope and persistence authority. */
4052
+ declare function transitionActionProposalSupersession(row: ActionProposal, replacement: ActionProposal, command: {
4053
+ replacementProposalId: string;
4054
+ actorRef: string;
4055
+ via: string;
4056
+ }, now: number): ActionProposalMutationResult;
4057
+
4058
+ /** Trusted producer path: retain the original JSON and the exact data shown for approval. */
4059
+ declare function prepareActionProposal(registry: ToolRegistry, name: string, input: unknown, ctx: AiToolCtx, policy: RolesPolicy, options?: InvokeOptions): Promise<{
4060
+ preparationInput: unknown;
4061
+ input: unknown;
4062
+ preflight: {
4063
+ status: "ready";
4064
+ confirmation?: ToolConfirmation;
4065
+ } | {
4066
+ status: "denied";
4067
+ reason: string;
4068
+ } | {
4069
+ status: "completed";
4070
+ output: unknown;
4071
+ };
4072
+ replacementKey?: string;
4073
+ }>;
4074
+
4075
+ declare function validateActionProposalWorkerClaim(command: ClaimActionProposal, now: number): void;
4076
+ declare function validateActionProposalExpiryBatch(command: {
4077
+ limit: number;
4078
+ }, now: number): void;
4079
+ declare function validateActionProposalDiscoveryIndexBatch(command: {
4080
+ limit: number;
4081
+ }): void;
4082
+
4083
+ /** Resolves current server authority; persisted role snapshots are never execution authority. */
4084
+ interface BackgroundActorResolver {
4085
+ resolve(ref: {
4086
+ actorRef: string;
4087
+ tenantRef: string | null;
4088
+ }): Promise<Actor | null>;
4089
+ }
4090
+
4091
+ declare function attachActionProposalOutcome(row: ActionProposal, now: number, ui?: AgentUiComponent[], text?: string): ActionProposal;
4092
+ declare function claimActionProposalOutcome(row: ActionProposal, command: {
4093
+ workerId: string;
4094
+ leaseMs: number;
4095
+ }, now: number, token: string): ActionProposal | null;
4096
+ declare function actionProposalOutcomeFenceValid(row: ActionProposal, command: ActionProposalOutcomeLease, now: number): boolean;
4097
+ declare function actionProposalOutcomeScope(outcome: ActionProposalOutcome): ActionProposalScope;
4098
+ declare function actionProposalOutcomeText(outcome: ActionProposalOutcome): string;
4099
+
4100
+ interface TextActionProposalCandidate {
4101
+ id: string;
4102
+ decision: ActionProposalDecision;
4103
+ }
4104
+ type TextActionProposalResolution = {
4105
+ status: 'unmatched';
4106
+ } | {
4107
+ status: 'ambiguous';
4108
+ proposalIds: string[];
4109
+ } | {
4110
+ status: 'decision';
4111
+ proposalId: string;
4112
+ decision: 'approved' | 'rejected';
4113
+ remember: boolean;
4114
+ };
4115
+ /**
4116
+ * Recognizes complete, explicit decision messages. This grants no authority: callers must
4117
+ * resolve the authenticated actor and use the normal scoped decision service with via=text.
4118
+ * Never feed model output here or consume an unmatched message as an approval.
4119
+ */
4120
+ declare function resolveTextActionProposalDecision(text: string, proposals: readonly TextActionProposalCandidate[]): TextActionProposalResolution;
4121
+ type TextActionProposalCommand = {
4122
+ status: 'unmatched';
4123
+ } | {
4124
+ status: 'command';
4125
+ decision: 'approved' | 'rejected';
4126
+ remember: boolean;
4127
+ proposalId?: string;
4128
+ };
4129
+ /** Parse exact consent syntax only. Authentication and target lookup remain the caller's responsibility. */
4130
+ declare function parseTextActionProposalCommand(text: string): TextActionProposalCommand;
4131
+
4132
+ interface ActionProposalExecutionDeps {
4133
+ registry: ToolRegistry;
4134
+ rolesPolicy: RolesPolicy;
4135
+ allowedTools?: string[];
4136
+ host?: unknown;
4137
+ resolveUiCatalog?: ResolveToolUiCatalog;
4138
+ }
4139
+ interface ActionProposalExecutorOptions {
4140
+ resolver: BackgroundActorResolver;
4141
+ /** Resolve exact recorded agent/persona against current configuration; throw if it disappeared. */
4142
+ resolveExecution(proposal: ActionProposal, actor: Actor): Promise<ActionProposalExecutionDeps>;
4143
+ }
4144
+ type ActionProposalExecutionResult = {
4145
+ status: 'succeeded';
4146
+ result?: unknown;
4147
+ ui: AgentUiComponent[];
4148
+ text?: string;
4149
+ } | {
4150
+ status: 'failed';
4151
+ error: string;
4152
+ ui: AgentUiComponent[];
4153
+ text?: string;
4154
+ };
4155
+ declare class ActionProposalExecutor {
4156
+ private readonly options;
4157
+ constructor(options: ActionProposalExecutorOptions);
4158
+ execute(proposal: ActionProposal): Promise<ActionProposalExecutionResult>;
4159
+ }
4160
+
4161
+ interface ActionProposalWorkerOptions {
4162
+ store: ActionProposalStore & ActionProposalWorkerStore & ActionProposalOutcomeStore;
4163
+ executor: ActionProposalExecutor;
4164
+ workerId: string;
4165
+ pollIntervalMs?: number;
4166
+ leaseMs?: number;
4167
+ maxConcurrency?: number;
4168
+ onError?(error: unknown): void;
4169
+ onSettled?(proposal: ActionProposal): Promise<void>;
4170
+ }
4171
+ declare class ActionProposalWorker {
4172
+ private readonly options;
4173
+ private readonly leaseMs;
4174
+ private readonly pollIntervalMs;
4175
+ private readonly maxConcurrency;
4176
+ private timer?;
4177
+ private stopped;
4178
+ private readonly renewals;
4179
+ private active;
4180
+ constructor(options: ActionProposalWorkerOptions);
4181
+ start(): void;
4182
+ stop(): Promise<void>;
4183
+ runOnce(): Promise<void>;
4184
+ private tick;
4185
+ private execute;
4186
+ }
4187
+
4188
+ type ActionProposalRuntimeStore = AgentStore & ActionProposalStore & ActionProposalWorkerStore & ActionProposalOutcomeStore & ActionProposalSupersessionStore;
4189
+ declare function assertIndependentActionCapabilities(store: AgentStore, resolver: BackgroundActorResolver | undefined): asserts store is ActionProposalRuntimeStore;
4190
+
4191
+ export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_ATTACHMENT_STAGING, AGENT_CONFIRM_TOKEN_STORE, AGENT_DEPS_FACTORY, AGENT_DIAGNOSTIC_EVENTS, AGENT_DURABLE_RUNNER, AGENT_EMBEDDING_PROVIDER, AGENT_GOVERNANCE_QUERIES, AGENT_MEMORY, AGENT_MODEL, AGENT_MODEL_CATALOG, AGENT_OPTIONS, AGENT_PRICING_STORE, AGENT_PROMPT_CONTRIBUTORS, AGENT_QUOTA_PROVIDER, AGENT_QUOTA_STORE, AGENT_REGISTRY, AGENT_RETRIEVER, AGENT_ROLES_POLICY, AGENT_RUNNER, AGENT_SINK, AGENT_SKILLS, AGENT_SKILL_SOURCES, AGENT_SPAN_EVENTS, AGENT_STORE, AGENT_TOOL_REGISTRY, APPROVAL_EXPIRED_REASON, type ActionApprovalMode, ActionProposal, ActionProposalDecision, ActionProposalDecisionCommand, type ActionProposalDiscoveryIndexStore, type ActionProposalExecutionDeps, type ActionProposalExecutionResult, ActionProposalExecutor, type ActionProposalExecutorOptions, ActionProposalMutationResult, ActionProposalOutcome, ActionProposalOutcomeLease, ActionProposalOutcomeStore, type ActionProposalReceipt, type ActionProposalRuntimeStore, ActionProposalScope, ActionProposalStore, ActionProposalStoreOptions, ActionProposalSupersessionStore, type ActionProposalTarget, ActionProposalWorker, type ActionProposalWorkerOptions, type ActionProposalWorkerStore, Actor, type ActorDirectory, type ActorResolver, type ActorSpendRow, type AgentApprovalPort, AgentDefinition, type AgentDelegated, AgentDelegation, type AgentDiagnosticEvent, type AgentDiagnosticKey, type AgentFollowUpsSpan, type AgentGovernanceQueries, AgentIntake, type AgentLlmTurnSpan, type AgentLoopDeps, type AgentLoopHooks, type AgentLoopResult, type AgentMemoryResolved, type AgentMemoryWritten, type AgentMessageEvent, type AgentPricingStore, type AgentQuotaExceeded, AgentRegistry, type AgentRetrievalSpan, type AgentRetrieved, type AgentRunFailed, type AgentRunFinished, AgentRunInput, type AgentRunStartOptions, type AgentRunStarted, type AgentRunner, type AgentSkillsResolved, type AgentSpanEvent, AgentStore, AgentStreamError, AgentStreamEvent, type AgentStructuredOutputSpan, type AgentToolCallEvent, type AgentToolExecutionSpan, type AgentToolRetry, AgentUiComponent, AiToolCtx, AppendMessageInput, ApprovalPolicy, type ApprovalWhere, type AttachmentRef, type AttachmentStagingDescription, type AttachmentStagingStore, type BackgroundActorResolver, type BufferedModelTurnResult, type BuildMemoryBlockInput, CONFIRM_JSON_SCHEMA_PROPERTIES, ChatQueueStore, ClaimActionProposal, ClosedRolesPolicy, type ConfirmFields, type ConfirmTokenClaim, ConfirmTokenError, type ConfirmTokenStore, type ConfirmTokenSubject, type ConfirmedTool, type ConfirmedToolDone, type ConfirmedToolMessages, type ConfirmedToolOptions, type ConfirmedToolOutcome, type ConfirmedToolPreview, type ConfirmedToolResult, type ConfirmedToolSteps, type CostUsage, CreateActionProposal, CreateActionProposalResult, CreateThreadInput, type CurrentModelPrice, DEFAULT_CONFIRM_TTL_MS, DEFAULT_HISTORY_SUMMARY_INSTRUCTION, DEFAULT_MAX_FACT_CHARS, DEFAULT_MAX_MEMORIES, DEFAULT_MAX_SKILLS, DEFAULT_REFUSAL_REASON, DEFAULT_STRUCTURED_OUTPUT_INSTRUCTION, Decision, DefaultRolesPolicy, type DetachedDelegationOutcome, type DetachedDelegationReceipt, DetachedDelivery, type DetailThreadRef, ElicitationRequest, type EmbeddingProvider, type EmitUi, type EmptyRoles, EnqueueMessageInput, ExtendActionProposalLease, type ForgetMemoryInput, type FrameBuffer, GLOBAL_SCOPE, type GovernanceMessageRow, type GovernancePage, type GovernancePageQuery, type GovernancePendingApprovalRow, type GovernanceRange, type GovernanceRunDetail, type GovernanceRunRow, type GovernanceThreadDetail, type GovernanceThreadDetailQuery, type GovernanceThreadRow, type GovernanceToolCallRow, type GovernanceUsageInput, type GovernanceUsageRow, HistoryPolicy, HumanReply, InMemoryActionProposalStore, InMemoryAgentStore, InMemoryConfirmTokenStore, type IncrementalGate, InputProcessor, type InvokeOptions, ListActionProposals, type ListMemoriesInput, type ListSkillsInput, type ListStagedAttachmentsInput, LlmStepEnvelope, type LoadSkillInput, type MemoryAuthor, type MemoryConfig, type MemoryDigest, type MemoryDigestEntry, type MemoryFact, type MemoryForgetRequest, type MemoryOrigin, type MemoryProvider, type MemoryRecord, type MemoryVerdict, type MemoryWriteOutcome, type MemoryWriteRequest, MessageAttachment, MessageFeedback, MessageUsage, ModelAnswer, type ModelCatalog, type ModelCatalogEntry, type ModelCatalogLock, type ModelCatalogProviderGroup, type ModelCatalogQuery, type ModelCatalogView, ModelMessage, type ModelPrice, type ModelPriceInput, type ModelProvider, type ModelSpendRow, type ModelTurnArgs, type ModelTurnResult, type NegotiatedUiCollector, type ObservedTurnFrames, type OfferMemoriesInput, type OutputGateMode, type OutputGateResult, OutputProcessor, type OverriddenMemory, PageContext, type Passage, type PendingApprovalRow, Persona, type PersonaAlias, PersonaCatalogEntry, type PrepareOptions, ProcessedPrompt, ProcessorContext, PromptBuilder, PromptContributor, QueuePause, QueuedMessage, QueuedMessagePatch, type QuotaBlock, QuotaExceededError, type QuotaPeriod, type QuotaProvider, type QuotaQuery, type QuotaReport, QuotaState, type QuotaStore, type QuotaWarning, type QuotaWindow, REMEMBER_TOOL_DESCRIPTION, REMEMBER_TOOL_NAME, RUN_FAILED_MESSAGE, RUN_NOT_ACTIVE_CODE, RUN_NOT_ACTIVE_MESSAGE, RUN_NO_LONGER_RUNNING, type RecentRunRow, RecordRunStartInput, RecordToolCallInput, RecordUsageInput, type RememberToolInput, type RerankOptions, type Reranker, type ResolveAttachmentInput, type ResolveMemoryDigestInput, type ResolveToolUiCatalog, type ResolvedDelegation, type RetrieveOptions, type Retriever, type RolesPolicy, type RolesPolicyOptions, type RunAgentBreakdownRow, RunCancelledError, type RunErrorBreakdownRow, type RunMetrics, type RunToolCallRow, type RunTrendPoint, type RunWhere, SCHEMA_EXTENSION, SKILL_TOOL_DESCRIPTION, SKILL_TOOL_NAME, type SchemaExtension, type ScopeContext, type ScopeResolver, type SearchMemoriesInput, SettleActionProposal, type SettleDeadRunInput, type SettledTask, type SinkWriter, type Skill, type SkillAuthor, type SkillCatalogEntry, type SkillContext, type SkillLoadOutcome, type SkillOffer, type SkillProvider, type SkillSummary, type SkillToolInput, type SkillWriteRequest, type SkillWriteVerdict, type SkillsConfig, SqlTokenStreamSink, type SqlTokenStreamSinkOptions, type StageAttachmentInput, type StagedAttachment, type StoreMemoryInput, StoredMessage, type StreamError, type StreamFrameRow, type StreamFrameTable, type StructuredOutcome, StructuredOutputError, THREAD_DETAIL_CONTENT_CHARS, type TextActionProposalCandidate, type TextActionProposalCommand, type TextActionProposalResolution, type ThreadActivityRow, ThreadDetail, type ThreadMessageRow, type ThreadMeta, type ThreadSpendRow, ThreadSummary, type ThreadUsageRollup, type ThreadWhere, type TokenStreamSink, type ToolCallActivityRow, ToolCallApprovalState, ToolCallOutcome, ToolCallRequest, ToolCallStatus, type ToolCallWhere, ToolConfirmation, ToolDefinition, ToolDescribeScope, ToolDisabledError, ToolForbiddenError, ToolHandler, ToolInputDriftError, ToolInputInvalidError, type ToolKindDeps, ToolNotFoundError, ToolPreflightDeniedError, ToolPreflightResult, type ToolPreparationResult, ToolRegistry, ToolResult, ToolSpec, type ToolStatRow, ToolStepEnvelope, ToolTransientRetrySetting, type TurnFrameSummary, type UiCollector, UpdateThreadInput, UpdateToolCallInput, type UsageTrendPoint, type WindowHistoryOptions, type WithMemoryToolInput, type WriteMemoryInput, actionProposalCreationMatches, actionProposalOutcomeFenceValid, actionProposalOutcomeScope, actionProposalOutcomeText, actionProposalReceipt, actionProposalScopeMatches, actorScope, agentDiagnosticKey, agentFailureCode, assertIndependentActionCapabilities, attachActionProposalOutcome, bucketByActor, bucketByModel, bucketByThread, bucketUsageTrend, buildMemoryBlock, buildSkillsBlock, canActorUseTool, canonicalActionProposalJson, canonicalJson, claimActionProposalOutcome, closeEmptyRoles, compositeSkillProvider, confirmTokenExpiry, createFrameBuffer, createIncrementalGate, createNegotiatedUiCollector, createNoopEmitUi, createUiCollector, dayBoundsUtc, defaultScopeResolver, defineConfirmedTool, detachedDelivered, detachedStarted, detachedUnsettled, escapeUnsafeToolUiText, estimateCost, estimateMessageTokens, exhaustedWindow, exposeStreamErrorDetails, extractJson, filterToolsByAllowList, filterToolsByCanUse, filterToolsByEnabled, filterToolsByRole, findCatalogModel, findPersona, gateFollowUps, gateTail, hashConfirmToken, initialActionProposal, intersectAllowLists, isControlFlowSignal, isReplayIntegrityError, isToolEnabled, loadSkill, memoryForgetVerdict, memoryWriteVerdict, mergeUi, normalizeDelegation, observeTurnFrames, offerMemories, offerSkills, parseTextActionProposalCommand, personaCatalogEntry, prepareActionProposal, publishAgentDelegated, publishAgentMemoryResolved, publishAgentMemoryWritten, publishAgentMessage, publishAgentQuotaExceeded, publishAgentRetrieved, publishAgentRunFailed, publishAgentRunFinished, publishAgentRunStarted, publishAgentSkillsResolved, publishAgentToolCall, publishAgentToolRetry, quotaPeriodRange, quotaUsedRatio, quotaWarning, releaseGatedFrames, rememberInputSchema, rememberToolDefinition, repairInstruction, resolveGateLookback, resolveMemoryDigest, resolveOutputGateMode, resolvePersonaAlias, resolveSkillCatalog, resolveTextActionProposalDecision, rollupThreadUsage, runAgentLoop, runInputProcessors, runOutputProcessors, schemaExtensionOf, seedModelPrices, settleAll, settleDeadRun, settleUnsettledDelegation, signConfirmToken, skillInputSchema, skillToolDefinition, skillWriteVerdict, snapshotActionProposal, stampToolKinds, staticModelCatalog, staticSkillProvider, streamFailure, summarizeWithModel, tenantScope, toolCallContext, traceLlmTurn, traceToolExecution, transitionActionProposalClaim, transitionActionProposalDecision, transitionActionProposalLease, transitionActionProposalSettlement, transitionActionProposalSupersession, truncateDetailContent, unwrapToolStepOutput, validateActionProposalCreation, validateActionProposalDiscoveryIndexBatch, validateActionProposalExpiryBatch, validateActionProposalListQuery, validateActionProposalWorkerClaim, validateStructured, verifyConfirmToken, windowHistory, withAskTool, withConfirmFields, withMemoryTool, withSelectedModel, withSkillTool, withToolTimeout, withTurnFrames, wrapToolPreflightDenied, wrapToolStepOutput, writeMemory };