@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/ag-ui/index.cjs +78 -0
- package/dist/ag-ui/index.cjs.map +1 -1
- package/dist/ag-ui/index.d.cts +12 -2
- package/dist/ag-ui/index.d.ts +12 -2
- package/dist/ag-ui/index.js +77 -0
- package/dist/ag-ui/index.js.map +1 -1
- package/dist/genui/builtins.cjs +2 -0
- package/dist/genui/builtins.cjs.map +1 -1
- package/dist/genui/builtins.js +2 -0
- package/dist/genui/builtins.js.map +1 -1
- package/dist/genui/index.cjs +120 -38
- package/dist/genui/index.cjs.map +1 -1
- package/dist/genui/index.d.cts +2 -2
- package/dist/genui/index.d.ts +2 -2
- package/dist/genui/index.js +116 -37
- package/dist/genui/index.js.map +1 -1
- package/dist/guardrails/index.d.cts +3 -3
- package/dist/guardrails/index.d.ts +3 -3
- package/dist/index.cjs +2340 -136
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +280 -93
- package/dist/index.d.ts +280 -93
- package/dist/index.js +2301 -131
- package/dist/index.js.map +1 -1
- package/dist/{processors-6p9nrqEi.d.cts → processors-B7nfbU6E.d.cts} +1 -1
- package/dist/{processors-Bp5XmF6V.d.ts → processors-BR3nICcp.d.ts} +1 -1
- package/dist/{stream-events-CbVEowYb.d.cts → stream-events-DAmes2Of.d.ts} +595 -86
- package/dist/{stream-events-CbVEowYb.d.ts → stream-events-M0jc7lSW.d.cts} +595 -86
- package/package.json +1 -1
- package/dist/tool-DZYLEKnl.d.cts +0 -121
- package/dist/tool-_iq4xRyk.d.ts +0 -121
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
+
import { a as Catalog } from './catalog-CrzetM3_.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Typed answers for a question set: a question that asks for a number, a date, an email or a
|
|
@@ -69,6 +70,419 @@ declare function readElicitationInput(raw: unknown): ElicitationInput | undefine
|
|
|
69
70
|
*/
|
|
70
71
|
declare function readElicitationQuestions(input: unknown): ElicitationQuestion[];
|
|
71
72
|
|
|
73
|
+
/**
|
|
74
|
+
* How a person-facing surface talks about a tool WITHOUT ever naming it. Declared on the server,
|
|
75
|
+
* beside the tool's input schema, because whoever changes the input is the one who has to re-word
|
|
76
|
+
* the sentence that mentions it — and a client that shipped its own name-to-sentence map would go
|
|
77
|
+
* stale the moment a tool was renamed. A tool name is an identifier, never copy.
|
|
78
|
+
*
|
|
79
|
+
* `running` / `done` (and `confirm.title`, `confirm.detail`, `result.text`) are templates:
|
|
80
|
+
* `{dotted.path}` placeholders are filled from the call's INPUT (or, for `result`, its OUTPUT), so one
|
|
81
|
+
* declaration covers every call the tool will ever receive and replays identically from history.
|
|
82
|
+
* A placeholder with nothing behind it collapses along with the space before it.
|
|
83
|
+
*/
|
|
84
|
+
interface ToolPresentation {
|
|
85
|
+
/** Noun phrase, for counts and headings: "Database query", "Knowledge base". */
|
|
86
|
+
label: string;
|
|
87
|
+
/** Present progressive, while the call is in flight: "Reading {bucket}". */
|
|
88
|
+
running: string;
|
|
89
|
+
/** Settled, once the output is in: "Read {bucket}". */
|
|
90
|
+
done: string;
|
|
91
|
+
/** A key into the client's own glyph map (`database`, `search`, …). Unknown keys fall back to a generic glyph there. */
|
|
92
|
+
icon?: string;
|
|
93
|
+
/** One line naming what the tool reaches, for when the activity line is opened. */
|
|
94
|
+
detail?: string;
|
|
95
|
+
/** `destructive` earns the warning treatment on an approval prompt. */
|
|
96
|
+
tone?: ToolPresentationTone;
|
|
97
|
+
/** What a person is being asked to allow when an `action` call parks for approval. */
|
|
98
|
+
confirm?: ToolConfirmation;
|
|
99
|
+
/** How the call's OUTPUT reads as content. */
|
|
100
|
+
result?: ToolResultView;
|
|
101
|
+
}
|
|
102
|
+
type ToolPresentationTone = 'neutral' | 'destructive';
|
|
103
|
+
interface ToolConfirmation {
|
|
104
|
+
/** "Delete {count} files?" */
|
|
105
|
+
title: string;
|
|
106
|
+
/** The button: "Delete". */
|
|
107
|
+
verb: string;
|
|
108
|
+
/** A sentence under the title, when the title alone does not say what changes. */
|
|
109
|
+
detail?: string;
|
|
110
|
+
}
|
|
111
|
+
/** A value read out of a tool's output by dotted path, with the words to put next to it. */
|
|
112
|
+
interface ToolResultField {
|
|
113
|
+
path: string;
|
|
114
|
+
label: string;
|
|
115
|
+
unit?: string;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* How a tool's output reads as content. Every variant names dotted paths into the output rather
|
|
119
|
+
* than shapes, so a renderer never has to recognise which tool it is drawing: it receives
|
|
120
|
+
* `{ view, output }` and draws it.
|
|
121
|
+
*/
|
|
122
|
+
type ToolResultView =
|
|
123
|
+
/** A row of labelled readings — one result, several facets. */
|
|
124
|
+
{
|
|
125
|
+
kind: 'metrics';
|
|
126
|
+
fields: ToolResultField[];
|
|
127
|
+
}
|
|
128
|
+
/** `rows` is a path to an array; each column's `path` is read WITHIN a row. */
|
|
129
|
+
| {
|
|
130
|
+
kind: 'table';
|
|
131
|
+
columns: ToolResultField[];
|
|
132
|
+
rows: string;
|
|
133
|
+
empty?: string;
|
|
134
|
+
}
|
|
135
|
+
/** `lines` is a path to an array of strings, drawn as a log tail. */
|
|
136
|
+
| {
|
|
137
|
+
kind: 'log';
|
|
138
|
+
lines: string;
|
|
139
|
+
}
|
|
140
|
+
/** One sentence, templated over the output. */
|
|
141
|
+
| {
|
|
142
|
+
kind: 'note';
|
|
143
|
+
text: string;
|
|
144
|
+
}
|
|
145
|
+
/** The output is drawn somewhere else on the screen already (a pushed component, a side panel). */
|
|
146
|
+
| {
|
|
147
|
+
kind: 'elsewhere';
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* `GET <base>/tools?agent=*` (and `useToolCatalog({ agent: ALL_AGENTS })`): every tool the actor
|
|
151
|
+
* reaches through ANY agent, each once — for a surface that shows several agents' conversations.
|
|
152
|
+
*/
|
|
153
|
+
declare const ALL_AGENTS = "*";
|
|
154
|
+
/**
|
|
155
|
+
* One tool as `GET <base>/tools` reports it: the tools THIS actor may be offered by the chosen agent,
|
|
156
|
+
* with how each is spoken about. `presentation` is absent for a tool that declared none — a client
|
|
157
|
+
* then narrates it generically rather than falling back to its name.
|
|
158
|
+
*/
|
|
159
|
+
interface ToolCatalogEntry {
|
|
160
|
+
/** The wire name tool parts carry (`tool-<name>`) — the key a client looks a call up by. */
|
|
161
|
+
name: string;
|
|
162
|
+
kind: ToolKind;
|
|
163
|
+
presentation?: ToolPresentation;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** The approver that means "the person the run is acting for" — the thread's own actor. */
|
|
167
|
+
declare const REQUESTER_APPROVER = "requester";
|
|
168
|
+
/** The tool a requirement is asked about. `spec` is absent where this process cannot resolve it. */
|
|
169
|
+
interface ApprovalToolRef {
|
|
170
|
+
name: string;
|
|
171
|
+
kind: ToolKind;
|
|
172
|
+
spec?: ToolSpec;
|
|
173
|
+
}
|
|
174
|
+
/** Where the call is being made. */
|
|
175
|
+
interface ApprovalThreadRef {
|
|
176
|
+
threadId: string;
|
|
177
|
+
runId: string;
|
|
178
|
+
agentName?: string;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* What an action tool call needs before it runs.
|
|
182
|
+
*
|
|
183
|
+
* - `required: false` → the call runs without asking anyone (it is still recorded as an action).
|
|
184
|
+
* - `approver` → who may decide: {@link REQUESTER_APPROVER} (the thread's own actor — the default)
|
|
185
|
+
* or any other string, which the default {@link ApprovalPolicy.canDecide} reads as a ROLE the
|
|
186
|
+
* decider must hold. Streamed on `approval-requested` and persisted on the call.
|
|
187
|
+
* - `ttlMs` → how long the request stays open. When it lapses the call settles `expired` and the
|
|
188
|
+
* model is told nobody approved it. Absent → it waits indefinitely.
|
|
189
|
+
*/
|
|
190
|
+
interface ApprovalRequirement {
|
|
191
|
+
required: boolean;
|
|
192
|
+
approver: string;
|
|
193
|
+
ttlMs?: number;
|
|
194
|
+
}
|
|
195
|
+
/** A decision about to be taken on a call, as {@link ApprovalPolicy.canDecide} sees it. */
|
|
196
|
+
interface ApprovalDecisionRef {
|
|
197
|
+
toolCallId: string;
|
|
198
|
+
/** The approver recorded on the call when it was put to a person. */
|
|
199
|
+
approver: string;
|
|
200
|
+
/** The actorRef the run is acting for — the owner of the call's thread. */
|
|
201
|
+
requesterRef: string;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Who has to approve an action tool call, and for how long the request stays open.
|
|
205
|
+
*
|
|
206
|
+
* Consulted by the LOOP once per `action` call, inside the call's `persist:toolcall` checkpoint — so
|
|
207
|
+
* a durable run reads the answer back on every replay instead of re-deciding it against a policy
|
|
208
|
+
* that may have changed while it was parked. Only `action` calls are asked about: a policy cannot
|
|
209
|
+
* put a `read` behind an approval, and an `ask` (a question set) is always the requester's.
|
|
210
|
+
*/
|
|
211
|
+
interface ApprovalPolicy {
|
|
212
|
+
requirementFor(tool: ApprovalToolRef, actor: Actor, thread: ApprovalThreadRef): ApprovalRequirement | Promise<ApprovalRequirement>;
|
|
213
|
+
/**
|
|
214
|
+
* May `actor` settle this call? Checked by the approve/reject routes before a decision is
|
|
215
|
+
* signalled. Absent → {@link defaultCanDecide}: the requester approver means the thread's own
|
|
216
|
+
* actor, anything else is a role the actor must hold. Plug an authz Gate here for abilities.
|
|
217
|
+
*/
|
|
218
|
+
canDecide?(actor: Actor, decision: ApprovalDecisionRef): boolean | Promise<boolean>;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* The behaviour the lib always had: every `action` call waits on the person who asked, with no
|
|
222
|
+
* expiry.
|
|
223
|
+
*/
|
|
224
|
+
declare class DefaultApprovalPolicy implements ApprovalPolicy {
|
|
225
|
+
requirementFor(tool: ApprovalToolRef): ApprovalRequirement;
|
|
226
|
+
}
|
|
227
|
+
/** The default decider rule — see {@link ApprovalPolicy.canDecide}. */
|
|
228
|
+
declare function defaultCanDecide(actor: Actor, decision: ApprovalDecisionRef): boolean;
|
|
229
|
+
/** Resolve whether `actor` may decide, through the policy's own rule when it has one. */
|
|
230
|
+
declare function mayDecideApproval(policy: ApprovalPolicy | undefined, actor: Actor, decision: ApprovalDecisionRef): Promise<boolean>;
|
|
231
|
+
/** The columns a store keeps for one call's approval, however it names them. */
|
|
232
|
+
interface ToolCallApprovalColumns {
|
|
233
|
+
proposalId?: string | null;
|
|
234
|
+
confirmation?: ToolConfirmation | null | undefined;
|
|
235
|
+
toolCallId: string;
|
|
236
|
+
status: ToolCallStatus;
|
|
237
|
+
approver: string | null | undefined;
|
|
238
|
+
expiresAt: string | Date | null | undefined;
|
|
239
|
+
remember: boolean | null | undefined;
|
|
240
|
+
executedByRef: string | null | undefined;
|
|
241
|
+
decidedVia: string | null | undefined;
|
|
242
|
+
error: string | null | undefined;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Read a tool-call row back as the {@link ToolCallApproval} a thread carries, or `null` for a call
|
|
246
|
+
* no policy put to anyone (no approver recorded). Shared by every store so they agree on the
|
|
247
|
+
* status mapping: a call that ran — or ran and failed — after a decision was APPROVED.
|
|
248
|
+
*/
|
|
249
|
+
declare function toolCallApprovalFromRow(row: ToolCallApprovalColumns): ToolCallApproval | null;
|
|
250
|
+
|
|
251
|
+
type ClaimedActionApproval = {
|
|
252
|
+
mode: 'auto';
|
|
253
|
+
} | {
|
|
254
|
+
mode: 'remembered';
|
|
255
|
+
approver: string;
|
|
256
|
+
} | {
|
|
257
|
+
mode: 'ask';
|
|
258
|
+
approver: string;
|
|
259
|
+
ttlMs?: number;
|
|
260
|
+
expiresAt?: string;
|
|
261
|
+
};
|
|
262
|
+
interface ResolveActionProposalApprovalInput {
|
|
263
|
+
actor: Actor;
|
|
264
|
+
thread: ApprovalThreadRef;
|
|
265
|
+
tool: ApprovalToolRef;
|
|
266
|
+
store: {
|
|
267
|
+
rememberedApprovals?(threadId: string): Promise<string[]>;
|
|
268
|
+
};
|
|
269
|
+
policy?: ApprovalPolicy;
|
|
270
|
+
clock?: () => number;
|
|
271
|
+
}
|
|
272
|
+
/** Journal this result on the trusted producer before choosing strict proposal preparation. */
|
|
273
|
+
declare function resolveActionProposalApproval(input: ResolveActionProposalApprovalInput): Promise<ClaimedActionApproval>;
|
|
274
|
+
|
|
275
|
+
/** Renderer support only. Component definitions and authorization remain server-owned. */
|
|
276
|
+
interface UiCapabilities {
|
|
277
|
+
components: Array<{
|
|
278
|
+
name: string;
|
|
279
|
+
version: number;
|
|
280
|
+
}>;
|
|
281
|
+
}
|
|
282
|
+
declare function validateUiCapabilities(value: unknown): UiCapabilities;
|
|
283
|
+
declare function negotiateCatalog(catalog: Catalog, capabilities?: UiCapabilities): Catalog;
|
|
284
|
+
type PreparedUiEmission = {
|
|
285
|
+
kind: 'ui';
|
|
286
|
+
component: string;
|
|
287
|
+
props: Record<string, unknown>;
|
|
288
|
+
version: number;
|
|
289
|
+
fallbackText: string;
|
|
290
|
+
componentVersions?: Record<string, number>;
|
|
291
|
+
} | {
|
|
292
|
+
kind: 'text';
|
|
293
|
+
text: string;
|
|
294
|
+
};
|
|
295
|
+
/** Validate against current trusted definitions before drawing or generating complete text. */
|
|
296
|
+
declare function prepareUiEmission(catalog: Catalog, capabilities: UiCapabilities | undefined, component: string, props: Record<string, unknown>, version?: number): Promise<PreparedUiEmission>;
|
|
297
|
+
|
|
298
|
+
interface ActionProposalScope {
|
|
299
|
+
/** Explicit null or string; scope strings have at most 255 UTF-16 code units. */
|
|
300
|
+
tenantRef: string | null;
|
|
301
|
+
actorRef: string;
|
|
302
|
+
threadId: string;
|
|
303
|
+
}
|
|
304
|
+
/** Persisted JSON execution descriptor; identity is resolved fresh from proposal scope. */
|
|
305
|
+
interface ActionProposalExecutionContext {
|
|
306
|
+
agentName?: string;
|
|
307
|
+
persona?: string;
|
|
308
|
+
requestId: string;
|
|
309
|
+
uiCapabilities?: UiCapabilities;
|
|
310
|
+
pageContext?: PageContext;
|
|
311
|
+
}
|
|
312
|
+
interface CreateActionProposal extends ActionProposalScope {
|
|
313
|
+
/** Globally unique deterministic identifier, at most 255 UTF-16 code units. */
|
|
314
|
+
id: string;
|
|
315
|
+
originRunId: string;
|
|
316
|
+
originMessageId: string;
|
|
317
|
+
originToolCallId: string;
|
|
318
|
+
toolName: string;
|
|
319
|
+
/** JSON-serializable immutable snapshot. */
|
|
320
|
+
input: unknown;
|
|
321
|
+
/** Original JSON before schema parsing; absence on legacy rows falls back to input. Null is present. */
|
|
322
|
+
preparationInput?: unknown;
|
|
323
|
+
/** Original execution address, never requester roles or transport/host handles. */
|
|
324
|
+
executionContext?: ActionProposalExecutionContext;
|
|
325
|
+
confirmation: ToolConfirmation;
|
|
326
|
+
approver: string;
|
|
327
|
+
/** Milliseconds since epoch; null means no expiry. */
|
|
328
|
+
expiresAt: number | null;
|
|
329
|
+
/** Stable across claims and crash recovery; tools must honor this key. */
|
|
330
|
+
idempotencyKey: string;
|
|
331
|
+
/** Explicit tool-authored replacement identity; never inferred from model text. */
|
|
332
|
+
replacementKey?: string;
|
|
333
|
+
}
|
|
334
|
+
type ActionProposalDecision = 'pending' | 'approved' | 'rejected' | 'expired' | 'superseded';
|
|
335
|
+
interface ActionProposalDecisionCommand {
|
|
336
|
+
decision: 'approved' | 'rejected' | 'expired';
|
|
337
|
+
actorRef: string;
|
|
338
|
+
via: string;
|
|
339
|
+
reason?: string;
|
|
340
|
+
remember?: boolean;
|
|
341
|
+
}
|
|
342
|
+
interface ActionProposalDecisionAudit extends Omit<ActionProposalDecisionCommand, 'decision'> {
|
|
343
|
+
at: number;
|
|
344
|
+
replacementProposalId?: string;
|
|
345
|
+
}
|
|
346
|
+
interface ActionProposalLease {
|
|
347
|
+
token: string;
|
|
348
|
+
generation: number;
|
|
349
|
+
workerId: string;
|
|
350
|
+
expiresAt: number;
|
|
351
|
+
}
|
|
352
|
+
interface ActionProposalExecution {
|
|
353
|
+
status: 'queued' | 'executing' | 'succeeded' | 'failed';
|
|
354
|
+
generation: number;
|
|
355
|
+
lease: ActionProposalLease | null;
|
|
356
|
+
result?: unknown;
|
|
357
|
+
error?: string;
|
|
358
|
+
}
|
|
359
|
+
interface ActionProposal extends CreateActionProposal {
|
|
360
|
+
decision: ActionProposalDecision;
|
|
361
|
+
decisionAudit: ActionProposalDecisionAudit | null;
|
|
362
|
+
/** Embedded durable execution work: created atomically with approval, absent before it. */
|
|
363
|
+
execution: ActionProposalExecution | null;
|
|
364
|
+
supersededBy?: string;
|
|
365
|
+
outcome?: ActionProposalOutcome;
|
|
366
|
+
outcomeDelivery?: ActionProposalOutcomeDelivery;
|
|
367
|
+
createdAt: number;
|
|
368
|
+
updatedAt: number;
|
|
369
|
+
}
|
|
370
|
+
interface CreateActionProposalResult {
|
|
371
|
+
status: 'created' | 'unchanged' | 'conflict';
|
|
372
|
+
proposal?: ActionProposal;
|
|
373
|
+
}
|
|
374
|
+
interface ActionProposalMutationResult {
|
|
375
|
+
status: 'applied' | 'unchanged' | 'conflict' | 'not_found' | 'expired';
|
|
376
|
+
/** Snapshot observed after the operation; concurrent operations may advance it. */
|
|
377
|
+
proposal?: ActionProposal;
|
|
378
|
+
}
|
|
379
|
+
interface ClaimActionProposal {
|
|
380
|
+
workerId: string;
|
|
381
|
+
leaseMs: number;
|
|
382
|
+
}
|
|
383
|
+
interface ExtendActionProposalLease {
|
|
384
|
+
token: string;
|
|
385
|
+
generation: number;
|
|
386
|
+
leaseMs: number;
|
|
387
|
+
}
|
|
388
|
+
type SettleActionProposal = {
|
|
389
|
+
token: string;
|
|
390
|
+
generation: number;
|
|
391
|
+
ui?: AgentUiComponent[];
|
|
392
|
+
text?: string;
|
|
393
|
+
} & ({
|
|
394
|
+
status: 'succeeded';
|
|
395
|
+
result?: unknown;
|
|
396
|
+
error?: never;
|
|
397
|
+
} | {
|
|
398
|
+
status: 'failed';
|
|
399
|
+
error: string;
|
|
400
|
+
result?: never;
|
|
401
|
+
});
|
|
402
|
+
interface ListActionProposals {
|
|
403
|
+
/** Default 100; integer 1..1000. Ties order by UTF-16 lexical logical id. */
|
|
404
|
+
limit?: number;
|
|
405
|
+
decision?: ActionProposalDecision;
|
|
406
|
+
/** Exclusive cursor in the same creation-time / exact logical-id order. */
|
|
407
|
+
after?: {
|
|
408
|
+
createdAt: number;
|
|
409
|
+
id: string;
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
interface ActionProposalStoreOptions {
|
|
413
|
+
/** Server-configured trusted clock, never a timestamp from a request. */
|
|
414
|
+
clock?: () => number;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Independent capability; AgentStore implementations are not required to implement it.
|
|
418
|
+
* All identifiers are looked up within the complete scope. Creation must compare the original
|
|
419
|
+
* immutable payload on replay and reject mismatches without disclosing a differently scoped row.
|
|
420
|
+
* Decisions are first-wins CAS; approving atomically queues durable execution work. At now >=
|
|
421
|
+
* expiresAt a pending proposal expires and cannot be approved or rejected. An explicit expiry
|
|
422
|
+
* before that instant conflicts. Duplicate matching decisions are unchanged without replacing
|
|
423
|
+
* audit data. Lease claims and recovery are atomic and fenced by token AND generation. Settlement
|
|
424
|
+
* and renewal require a matching, unexpired lease; leaseMs must be a positive safe integer.
|
|
425
|
+
* Execution recovery preserves the idempotency key (delivery is at least once, not exactly once).
|
|
426
|
+
*/
|
|
427
|
+
interface ActionProposalStore {
|
|
428
|
+
createActionProposal(input: CreateActionProposal): Promise<CreateActionProposalResult>;
|
|
429
|
+
getActionProposal(scope: ActionProposalScope, id: string): Promise<ActionProposal | null>;
|
|
430
|
+
listActionProposals(scope: ActionProposalScope, query?: ListActionProposals): Promise<ActionProposal[]>;
|
|
431
|
+
decideActionProposal(scope: ActionProposalScope, id: string, command: ActionProposalDecisionCommand): Promise<ActionProposalMutationResult>;
|
|
432
|
+
claimActionProposal(scope: ActionProposalScope, id: string, command: ClaimActionProposal): Promise<ActionProposalMutationResult>;
|
|
433
|
+
extendActionProposalLease(scope: ActionProposalScope, id: string, command: ExtendActionProposalLease): Promise<ActionProposalMutationResult>;
|
|
434
|
+
settleActionProposal(scope: ActionProposalScope, id: string, command: SettleActionProposal): Promise<ActionProposalMutationResult>;
|
|
435
|
+
}
|
|
436
|
+
interface ActionProposalSupersessionStore {
|
|
437
|
+
createReplacingActionProposal(input: CreateActionProposal): Promise<CreateActionProposalResult>;
|
|
438
|
+
supersedeActionProposal(scope: ActionProposalScope, id: string, command: {
|
|
439
|
+
replacementProposalId: string;
|
|
440
|
+
actorRef: string;
|
|
441
|
+
via: string;
|
|
442
|
+
}): Promise<ActionProposalMutationResult>;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
interface ActionProposalOutcome extends ActionProposalScope {
|
|
446
|
+
id: string;
|
|
447
|
+
proposalId: string;
|
|
448
|
+
outcomeVersion: 1;
|
|
449
|
+
originRunId: string;
|
|
450
|
+
originToolCallId: string;
|
|
451
|
+
toolName: string;
|
|
452
|
+
decision: ActionProposalDecision;
|
|
453
|
+
executionStatus?: 'succeeded' | 'failed';
|
|
454
|
+
result?: unknown;
|
|
455
|
+
error?: string;
|
|
456
|
+
ui: AgentUiComponent[];
|
|
457
|
+
text?: string;
|
|
458
|
+
createdAt: number;
|
|
459
|
+
}
|
|
460
|
+
interface ActionProposalOutcomeDelivery {
|
|
461
|
+
status: 'pending' | 'admitted' | 'discarded';
|
|
462
|
+
generation: number;
|
|
463
|
+
lease: ActionProposalLease | null;
|
|
464
|
+
messageId?: string;
|
|
465
|
+
}
|
|
466
|
+
interface ActionProposalOutcomeLease {
|
|
467
|
+
outcomeId: string;
|
|
468
|
+
token: string;
|
|
469
|
+
generation: number;
|
|
470
|
+
}
|
|
471
|
+
interface ActionProposalOutcomeStore {
|
|
472
|
+
getThreadActionProposalScope(threadId: string): Promise<ActionProposalScope | null>;
|
|
473
|
+
claimNextActionProposalOutcome(command: {
|
|
474
|
+
workerId: string;
|
|
475
|
+
leaseMs: number;
|
|
476
|
+
}): Promise<{
|
|
477
|
+
outcome: ActionProposalOutcome;
|
|
478
|
+
lease: ActionProposalOutcomeLease;
|
|
479
|
+
} | null>;
|
|
480
|
+
admitActionProposalOutcome(command: ActionProposalOutcomeLease): Promise<{
|
|
481
|
+
status: 'applied' | 'unchanged' | 'busy' | 'conflict' | 'not_found' | 'discarded';
|
|
482
|
+
messageId?: string;
|
|
483
|
+
}>;
|
|
484
|
+
}
|
|
485
|
+
|
|
72
486
|
/**
|
|
73
487
|
* What a store knows about a tool call, read back when its message carries no result for it — see
|
|
74
488
|
* {@link import('./spi/agent-store.js').AgentStore.toolCallOutcomes}.
|
|
@@ -119,6 +533,7 @@ interface CreateThreadInput {
|
|
|
119
533
|
persona?: string;
|
|
120
534
|
}
|
|
121
535
|
interface AppendMessageInput {
|
|
536
|
+
actionProposalOutcome?: ActionProposalOutcome;
|
|
122
537
|
threadId: string;
|
|
123
538
|
role: StoredMessage['role'];
|
|
124
539
|
content: string;
|
|
@@ -148,6 +563,9 @@ interface AppendMessageInput {
|
|
|
148
563
|
ui?: AgentUiComponent[];
|
|
149
564
|
}
|
|
150
565
|
interface RecordToolCallInput {
|
|
566
|
+
proposalId?: string;
|
|
567
|
+
/** Resolved confirmation from the action preflight; overrides presentation templates. */
|
|
568
|
+
confirmation?: ToolConfirmation;
|
|
151
569
|
toolCallId: string;
|
|
152
570
|
messageId: string;
|
|
153
571
|
toolName: string;
|
|
@@ -500,6 +918,7 @@ interface QueuedMessage {
|
|
|
500
918
|
persona?: string;
|
|
501
919
|
model?: string;
|
|
502
920
|
pageContext?: PageContext;
|
|
921
|
+
uiCapabilities?: UiCapabilities;
|
|
503
922
|
/**
|
|
504
923
|
* Queued by an interrupt (`POST chat { mode: 'interrupt' }`): the running turn was cancelled to
|
|
505
924
|
* make room for it, so the cancel starts it instead of pausing the queue.
|
|
@@ -538,6 +957,7 @@ interface EnqueueMessageInput {
|
|
|
538
957
|
persona?: string;
|
|
539
958
|
model?: string;
|
|
540
959
|
pageContext?: PageContext;
|
|
960
|
+
uiCapabilities?: UiCapabilities;
|
|
541
961
|
interrupt?: boolean;
|
|
542
962
|
/** `'tail'` (default) runs it after everything already waiting; `'head'` runs it next. */
|
|
543
963
|
at?: 'tail' | 'head';
|
|
@@ -703,96 +1123,145 @@ interface AgentHistoryWindow {
|
|
|
703
1123
|
}
|
|
704
1124
|
|
|
705
1125
|
/**
|
|
706
|
-
*
|
|
707
|
-
*
|
|
708
|
-
*
|
|
709
|
-
* stale the moment a tool was renamed. A tool name is an identifier, never copy.
|
|
710
|
-
*
|
|
711
|
-
* `running` / `done` (and `confirm.title`, `confirm.detail`, `result.text`) are templates:
|
|
712
|
-
* `{dotted.path}` placeholders are filled from the call's INPUT (or, for `result`, its OUTPUT), so one
|
|
713
|
-
* declaration covers every call the tool will ever receive and replays identically from history.
|
|
714
|
-
* A placeholder with nothing behind it collapses along with the space before it.
|
|
1126
|
+
* Per-invocation context handed to a tool handler. Host-supplied bits are optional. Identity lives
|
|
1127
|
+
* on {@link AiToolCtx.actor} — read `ctx.actor.id` / `ctx.actor.tenantRef` (single source of truth;
|
|
1128
|
+
* no denormalized copies).
|
|
715
1129
|
*/
|
|
716
|
-
interface
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
/**
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
/**
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
1130
|
+
interface AiToolCtx {
|
|
1131
|
+
uiCapabilities?: UiCapabilities;
|
|
1132
|
+
actor: Actor;
|
|
1133
|
+
threadId: string;
|
|
1134
|
+
runId: string;
|
|
1135
|
+
requestId: string;
|
|
1136
|
+
/**
|
|
1137
|
+
* The id of the tool call this invocation serves. Absent where a tool is invoked outside a turn
|
|
1138
|
+
* (the MCP server, a direct `registry.invoke`).
|
|
1139
|
+
*/
|
|
1140
|
+
toolCallId?: string;
|
|
1141
|
+
/**
|
|
1142
|
+
* `<runId>:<toolCallId>` — the same value for every execution of THIS call, and for no other.
|
|
1143
|
+
*
|
|
1144
|
+
* A tool's side effect and the checkpoint that records it are two writes. Under the durable
|
|
1145
|
+
* runner a worker that dies between them leaves a call the journal does not know ran, and the
|
|
1146
|
+
* runtime's recovery runs it again; an in-step transient retry (a deadlock, a lock-wait timeout)
|
|
1147
|
+
* re-invokes it too. The library cannot make your write atomic with its journal — so it hands you
|
|
1148
|
+
* the key that makes the second attempt recognisable: pass it to whatever you call as its
|
|
1149
|
+
* idempotency key (a payment provider's `Idempotency-Key`, a unique column on the row you insert,
|
|
1150
|
+
* a workflow's `id`), and a re-execution lands on the first one's result instead of doing it
|
|
1151
|
+
* twice. Stable across replays and across pods: the run id is the run's own, and the call id
|
|
1152
|
+
* comes out of the journaled model step.
|
|
1153
|
+
*
|
|
1154
|
+
* Absent where a tool is invoked outside a turn (the MCP server, a direct `registry.invoke`).
|
|
1155
|
+
*/
|
|
1156
|
+
idempotencyKey?: string;
|
|
1157
|
+
/** The name of the agent running this turn — provenance a tool can scope on (e.g. capability sets). */
|
|
1158
|
+
agentName?: string;
|
|
1159
|
+
/** The persona of {@link agentName} the turn runs under, when it runs under one. */
|
|
1160
|
+
persona?: string;
|
|
1161
|
+
pageContext?: PageContext;
|
|
1162
|
+
/** Optional host handle (e.g. an ORM EntityManager) the app threads through options. */
|
|
1163
|
+
host?: unknown;
|
|
1164
|
+
/**
|
|
1165
|
+
* Push a component into the assistant message: streamed live as a `ui` frame and persisted on
|
|
1166
|
+
* the message, so a reload shows it where the live stream did. Resolves to the component's id.
|
|
1167
|
+
*
|
|
1168
|
+
* `id` defaults to `<toolCallId>:ui:<n>` (the n-th push without an `id` in this invocation), so a retried or
|
|
1169
|
+
* re-executed call REPLACES what it pushed before instead of adding a second copy; pass your own
|
|
1170
|
+
* `id` to update one component across pushes (streaming rows into a table). `props` must be
|
|
1171
|
+
* JSON; it is snapshotted when pushed.
|
|
1172
|
+
*
|
|
1173
|
+
* Replay-safe under the durable runner: the pushed components ride the tool step's journaled
|
|
1174
|
+
* result, so a replay neither streams nor persists them again.
|
|
1175
|
+
*
|
|
1176
|
+
* Always present. On a surface with no conversation to push into (the MCP server, a direct
|
|
1177
|
+
* `registry.invoke` without one) it is a no-op that still resolves to an id, so a tool calls
|
|
1178
|
+
* `ctx.emitUi(…)` unconditionally.
|
|
1179
|
+
*/
|
|
1180
|
+
emitUi(component: string, props: Record<string, unknown>, options?: EmitUiOptions): Promise<{
|
|
1181
|
+
id: string;
|
|
1182
|
+
}>;
|
|
748
1183
|
}
|
|
749
|
-
/**
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
* `{ view, output }` and draws it.
|
|
753
|
-
*/
|
|
754
|
-
type ToolResultView =
|
|
755
|
-
/** A row of labelled readings — one result, several facets. */
|
|
756
|
-
{
|
|
757
|
-
kind: 'metrics';
|
|
758
|
-
fields: ToolResultField[];
|
|
1184
|
+
/** When the action state is being checked. */
|
|
1185
|
+
interface ToolPreflightOptions {
|
|
1186
|
+
phase: 'prepare' | 'execute';
|
|
759
1187
|
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
1188
|
+
type ToolPreflightResult<O = unknown> = {
|
|
1189
|
+
status: 'ready';
|
|
1190
|
+
confirmation?: ToolConfirmation;
|
|
1191
|
+
} | {
|
|
1192
|
+
status: 'denied';
|
|
1193
|
+
reason: string;
|
|
1194
|
+
} | {
|
|
1195
|
+
status: 'completed';
|
|
1196
|
+
output: O;
|
|
1197
|
+
};
|
|
1198
|
+
/** A tool implementation. `I` is the input parsed by its registered Standard Schema. */
|
|
1199
|
+
interface ToolHandler<I = unknown, O = unknown> {
|
|
1200
|
+
execute(input: I, ctx: AiToolCtx): Promise<O>;
|
|
1201
|
+
/** Read-only action check. Runs after authorization and validation, before approval and again
|
|
1202
|
+
* immediately before execution. Confirmation strings are resolved, never templates. */
|
|
1203
|
+
preflight?(input: I, ctx: AiToolCtx, options: ToolPreflightOptions): ToolPreflightResult<O> | Promise<ToolPreflightResult<O>>;
|
|
1204
|
+
/**
|
|
1205
|
+
* Whether this tool exists in this deployment at all — evaluated per turn, BEFORE the roles
|
|
1206
|
+
* policy, so a `false` here means the model is never shown the tool rather than being shown one
|
|
1207
|
+
* it will be refused. Omit → always enabled.
|
|
1208
|
+
*
|
|
1209
|
+
* This is the seam for a feature flag or a licensing tier: the handler is an ordinary provider,
|
|
1210
|
+
* so it can read injected config (`this.config.featureX`) that a decorator, evaluated at import
|
|
1211
|
+
* time, cannot. Answering "does this capability exist here?"; `roles`/`RolesPolicy` answers the
|
|
1212
|
+
* separate question "may THIS actor use it?", and both still run.
|
|
1213
|
+
*
|
|
1214
|
+
* Prefer this over conditionally registering the provider: registration happens while the
|
|
1215
|
+
* `@Module` metadata is built, which in most apps is before configuration is loaded.
|
|
1216
|
+
*/
|
|
1217
|
+
isEnabled?(): boolean | Promise<boolean>;
|
|
1218
|
+
/**
|
|
1219
|
+
* Whether THIS actor may use the tool, decided per turn. Omit → the role gate alone decides.
|
|
1220
|
+
*
|
|
1221
|
+
* The three existing gates all answer the question somewhere else: `roles` is static data,
|
|
1222
|
+
* `RolesPolicy` is one app-wide rule for every tool, and an agent's `tools` allow-list is fixed
|
|
1223
|
+
* when the agent is declared. This one lives on the tool and runs with DI, so it can ask the
|
|
1224
|
+
* questions only the tool knows to ask — is this user's org on the plan that includes it, does
|
|
1225
|
+
* this actor own the base being queried, is the per-user override in the DB set today.
|
|
1226
|
+
*
|
|
1227
|
+
* Runs AFTER {@link isEnabled} and the `RolesPolicy`, and all of them must pass. Applied both
|
|
1228
|
+
* when the turn's tool list is built (a denied actor is never shown it) and again on invoke.
|
|
1229
|
+
*/
|
|
1230
|
+
canUse?(actor: Actor): boolean | Promise<boolean>;
|
|
1231
|
+
/**
|
|
1232
|
+
* What the model is told about this tool for THIS turn — a description and/or input schema that
|
|
1233
|
+
* depend on who is asking (a per-tenant component catalog, a per-plan list of options). Called
|
|
1234
|
+
* when the turn's tool list is built, after every gate has passed; whatever it returns replaces
|
|
1235
|
+
* the registered spec's `description` / `inputSchema` in the definition the model sees. Omit, or
|
|
1236
|
+
* return `undefined`, to use the registered spec as is.
|
|
1237
|
+
*
|
|
1238
|
+
* It shapes what the model is SHOWN only: the registry still validates a call against the
|
|
1239
|
+
* registered `inputSchema`, so a tool whose accepted input varies per turn registers a permissive
|
|
1240
|
+
* schema and validates in `execute`.
|
|
1241
|
+
*/
|
|
1242
|
+
describe?(scope: ToolDescribeScope): ToolDescription | undefined | Promise<ToolDescription | undefined>;
|
|
766
1243
|
}
|
|
767
|
-
/**
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
1244
|
+
/** Who a turn's tool list is being built for — what {@link ToolHandler.describe} can vary on. */
|
|
1245
|
+
interface ToolDescribeScope {
|
|
1246
|
+
uiCapabilities?: UiCapabilities;
|
|
1247
|
+
actor: Actor;
|
|
1248
|
+
/** Absent where the list is built outside a conversation (the MCP server's `tools/list`). */
|
|
1249
|
+
threadId?: string;
|
|
1250
|
+
agentName?: string;
|
|
771
1251
|
}
|
|
772
|
-
/**
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
1252
|
+
/** A per-turn override of a tool's model-facing definition ({@link ToolHandler.describe}). */
|
|
1253
|
+
interface ToolDescription {
|
|
1254
|
+
/** False removes this tool from the current model-facing catalog. */
|
|
1255
|
+
available?: boolean;
|
|
1256
|
+
description?: string;
|
|
1257
|
+
inputSchema?: StandardSchemaV1;
|
|
776
1258
|
}
|
|
777
|
-
/**
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
* reaches through ANY agent, each once — for a surface that shows several agents' conversations.
|
|
784
|
-
*/
|
|
785
|
-
declare const ALL_AGENTS = "*";
|
|
786
|
-
/**
|
|
787
|
-
* One tool as `GET <base>/tools` reports it: the tools THIS actor may be offered by the chosen agent,
|
|
788
|
-
* with how each is spoken about. `presentation` is absent for a tool that declared none — a client
|
|
789
|
-
* then narrates it generically rather than falling back to its name.
|
|
790
|
-
*/
|
|
791
|
-
interface ToolCatalogEntry {
|
|
792
|
-
/** The wire name tool parts carry (`tool-<name>`) — the key a client looks a call up by. */
|
|
793
|
-
name: string;
|
|
794
|
-
kind: ToolKind;
|
|
795
|
-
presentation?: ToolPresentation;
|
|
1259
|
+
/** Metadata recorded with a pushed UI component. */
|
|
1260
|
+
interface EmitUiOptions {
|
|
1261
|
+
id?: string;
|
|
1262
|
+
version?: number;
|
|
1263
|
+
fallbackText?: string;
|
|
1264
|
+
componentVersions?: Record<string, number>;
|
|
796
1265
|
}
|
|
797
1266
|
|
|
798
1267
|
/**
|
|
@@ -911,6 +1380,8 @@ interface DetachedDelivery {
|
|
|
911
1380
|
* remedy is the read-back that lets them delete it.
|
|
912
1381
|
*/
|
|
913
1382
|
interface ToolSpec {
|
|
1383
|
+
/** Explicit domain identity for pending-only replacement; evaluated on approved normalized input. */
|
|
1384
|
+
replacementKey?: string | ((input: unknown, ctx: AiToolCtx) => string | undefined | Promise<string | undefined>);
|
|
914
1385
|
name: string;
|
|
915
1386
|
kind: ToolKind;
|
|
916
1387
|
description: string;
|
|
@@ -980,6 +1451,19 @@ interface ToolDefinition {
|
|
|
980
1451
|
}
|
|
981
1452
|
/** A tool call the model asked for during a turn. */
|
|
982
1453
|
interface ToolCallRequest {
|
|
1454
|
+
actionApproval?: ClaimedActionApproval;
|
|
1455
|
+
prepared?: {
|
|
1456
|
+
preparationInput: unknown;
|
|
1457
|
+
input: unknown;
|
|
1458
|
+
preflight: ToolPreflightResult;
|
|
1459
|
+
replacementKey?: string;
|
|
1460
|
+
};
|
|
1461
|
+
/** Trusted action preparation from the dispatched model worker, journaled with its turn.
|
|
1462
|
+
* Model-provider supplied values are overwritten by the worker. Absent on legacy turns. */
|
|
1463
|
+
preflight?: ToolPreflightResult | {
|
|
1464
|
+
status: 'failed';
|
|
1465
|
+
error: string;
|
|
1466
|
+
};
|
|
983
1467
|
id: string;
|
|
984
1468
|
name: string;
|
|
985
1469
|
input: unknown;
|
|
@@ -1149,6 +1633,7 @@ interface PromptContext {
|
|
|
1149
1633
|
/** The selected agent's name. */
|
|
1150
1634
|
agentName: string;
|
|
1151
1635
|
pageContext?: PageContext;
|
|
1636
|
+
uiCapabilities?: UiCapabilities;
|
|
1152
1637
|
/**
|
|
1153
1638
|
* The persona this turn runs under, when it runs under one — so an agent's own `@SystemPrompt`
|
|
1154
1639
|
* (or a contributor) can vary by persona without the persona carrying a prompt of its own.
|
|
@@ -1236,6 +1721,7 @@ interface AgentRunInput {
|
|
|
1236
1721
|
/** Files attached to the latest user message (image/PDF). Persisted with it and sent to the model. */
|
|
1237
1722
|
attachments?: MessageAttachment[];
|
|
1238
1723
|
pageContext?: PageContext;
|
|
1724
|
+
uiCapabilities?: UiCapabilities;
|
|
1239
1725
|
/** YYYY-MM-DD stamped by the runner so quota/day stays deterministic under durable replay. */
|
|
1240
1726
|
day?: string;
|
|
1241
1727
|
/** Which named agent runs this turn. Omitted → the default/single agent. */
|
|
@@ -1411,6 +1897,7 @@ interface ThreadSummary {
|
|
|
1411
1897
|
persona?: string | null;
|
|
1412
1898
|
}
|
|
1413
1899
|
interface StoredMessage {
|
|
1900
|
+
actionProposalOutcome?: ActionProposalOutcome;
|
|
1414
1901
|
id: string;
|
|
1415
1902
|
role: MessageRole;
|
|
1416
1903
|
content: string;
|
|
@@ -1476,6 +1963,14 @@ interface MessageFeedback {
|
|
|
1476
1963
|
type ToolCallApprovalStatus = 'pending' | 'approved' | 'rejected' | 'expired';
|
|
1477
1964
|
/** The persisted approval metadata of one action tool call. See {@link StoredMessage.approvals}. */
|
|
1478
1965
|
interface ToolCallApproval {
|
|
1966
|
+
target?: {
|
|
1967
|
+
kind: 'proposal';
|
|
1968
|
+
proposalId: string;
|
|
1969
|
+
threadId?: string;
|
|
1970
|
+
};
|
|
1971
|
+
proposalId?: string;
|
|
1972
|
+
/** Resolved confirmation from the action preflight; overrides presentation templates. */
|
|
1973
|
+
confirmation?: ToolConfirmation;
|
|
1479
1974
|
toolCallId: string;
|
|
1480
1975
|
/** Who may decide: `'requester'` (the thread's own actor) or a role name. */
|
|
1481
1976
|
approver: string;
|
|
@@ -1500,7 +1995,7 @@ interface ThreadDetail extends ThreadSummary {
|
|
|
1500
1995
|
*/
|
|
1501
1996
|
queue?: ChatQueueState;
|
|
1502
1997
|
}
|
|
1503
|
-
type ToolCallStatus = 'auto_executed' | 'pending_approval' | 'executed' | 'rejected' | 'failed'
|
|
1998
|
+
type ToolCallStatus = 'proposed' | 'auto_executed' | 'pending_approval' | 'executed' | 'rejected' | 'failed'
|
|
1504
1999
|
/** An approval request lapsed before anyone decided; the tool never ran. */
|
|
1505
2000
|
| 'expired';
|
|
1506
2001
|
/**
|
|
@@ -1508,6 +2003,9 @@ type ToolCallStatus = 'auto_executed' | 'pending_approval' | 'executed' | 'rejec
|
|
|
1508
2003
|
* re-resolves the model/sink/registry from its own DI via AGENT_DEPS_FACTORY.forAgent(agentName).
|
|
1509
2004
|
*/
|
|
1510
2005
|
interface LlmStepEnvelope {
|
|
2006
|
+
actionApprovalMode?: 'blocking' | 'independent';
|
|
2007
|
+
/** Full invocation identity for action preparation at the worker. Optional for old envelopes. */
|
|
2008
|
+
preflightContext?: ToolStepCtx;
|
|
1511
2009
|
/** Undefined = default agent (same semantics as {@link AgentRunInput.agentName}). */
|
|
1512
2010
|
agentName?: string;
|
|
1513
2011
|
system: string;
|
|
@@ -1547,6 +2045,7 @@ interface ToolStepCtx {
|
|
|
1547
2045
|
/** The persona the turn runs under ({@link AiToolCtx.persona}). */
|
|
1548
2046
|
persona?: string;
|
|
1549
2047
|
pageContext?: PageContext;
|
|
2048
|
+
uiCapabilities?: UiCapabilities;
|
|
1550
2049
|
}
|
|
1551
2050
|
/** Serializable input for a dispatched tool-execution step. */
|
|
1552
2051
|
interface ToolStepEnvelope {
|
|
@@ -1839,6 +2338,10 @@ interface AgentUiComponent {
|
|
|
1839
2338
|
props: Record<string, unknown>;
|
|
1840
2339
|
/** Schema version of `props`, so a client can keep rendering components persisted by an older server. */
|
|
1841
2340
|
version?: number;
|
|
2341
|
+
/** Validated readable fallback retained for clients without this renderer. */
|
|
2342
|
+
fallbackText?: string;
|
|
2343
|
+
/** Trusted schema versions for every component in a persisted tree. */
|
|
2344
|
+
componentVersions?: Record<string, number>;
|
|
1842
2345
|
/**
|
|
1843
2346
|
* The tool call that pushed the component (`ctx.emitUi`), when one did. Lets a client place it
|
|
1844
2347
|
* with that call — a reloaded message puts it right after the call's tool part, where the live
|
|
@@ -1851,6 +2354,12 @@ interface AgentUiComponent {
|
|
|
1851
2354
|
* settled through the tool-call approve/reject routes, by its `toolCallId`.
|
|
1852
2355
|
*/
|
|
1853
2356
|
interface AgentApprovalRequest {
|
|
2357
|
+
target?: {
|
|
2358
|
+
kind: 'proposal';
|
|
2359
|
+
proposalId: string;
|
|
2360
|
+
};
|
|
2361
|
+
/** Resolved confirmation from the action preflight; overrides presentation templates. */
|
|
2362
|
+
confirmation?: ToolConfirmation;
|
|
1854
2363
|
/** The tool call awaiting the decision — the `id` of a call already announced on this stream. */
|
|
1855
2364
|
id: string;
|
|
1856
2365
|
/**
|
|
@@ -2066,4 +2575,4 @@ type AgentStreamErrorCode = 'quota_exceeded' | 'output_rejected' | 'structured_o
|
|
|
2066
2575
|
/** A model call ended without producing anything. */
|
|
2067
2576
|
| 'model_no_output' | 'run_failed';
|
|
2068
2577
|
|
|
2069
|
-
export {
|
|
2578
|
+
export { type ToolCallStatus as $, type AgentStreamEvent as A, type ToolTransientRetrySetting as B, type AgentIntake as C, type DetachedDelivery as D, type Decision as E, type ElicitationRequest as F, type ToolStepEnvelope as G, type HumanReply as H, type ClaimActionProposal as I, type ActionProposal as J, type ActionProposalStore as K, type LlmStepEnvelope as L, type ModelMessage as M, type ActionProposalStoreOptions as N, type CreateActionProposal as O, type PreparedUiEmission as P, type QuotaState as Q, type CreateActionProposalResult as R, type ActionProposalScope as S, type ToolSpec as T, type UiCapabilities as U, type ListActionProposals as V, type ActionProposalDecisionCommand as W, type ExtendActionProposalLease as X, type SettleActionProposal as Y, type ActionProposalOutcome as Z, type ActionProposalOutcomeLease as _, type Actor as a, type MessageFeedbackValue as a$, type ChatQueueStore as a0, type ActionProposalOutcomeStore as a1, type CreateThreadInput as a2, type ThreadSummary as a3, type ThreadDetail as a4, type ToolCallApprovalState as a5, type UpdateThreadInput as a6, type RecordRunStartInput as a7, type EnqueueMessageInput as a8, type QueuedMessage as a9, type AgentHistoryWindow as aA, type AgentStreamErrorCode as aB, type ApprovalDecisionRef as aC, type ApprovalRequirement as aD, type ApprovalThreadRef as aE, type ApprovalToolRef as aF, type AskToolInput as aG, type ChatQueueState as aH, type ClaimedActionApproval as aI, DEFAULT_INTAKE_PREAMBLE as aJ, DEFAULT_TOOL_TRANSIENT_RETRY_ATTEMPTS as aK, DEFAULT_TOOL_TRANSIENT_RETRY_BACKOFF_MS as aL, DefaultApprovalPolicy as aM, ELICITATION_INPUT_TYPES as aN, type ElicitationInput as aO, type ElicitationInputType as aP, type ElicitationOption as aQ, type ElicitationOutcome as aR, type ElicitationQuestion as aS, type ElicitationReply as aT, type ElicitationResult as aU, type EmitUiOptions as aV, type HistoryPolicyContext as aW, type HistorySelection as aX, type HistorySummary as aY, type InvokeWithTransientRetryOptions as aZ, MAX_ASK_QUESTIONS as a_, type QueuedMessagePatch as aa, type QueuePause as ab, type AppendMessageInput as ac, type StoredMessage as ad, type ToolResult as ae, type MessageFeedback as af, type RecordToolCallInput as ag, type ToolCallOutcome as ah, type UpdateToolCallInput as ai, type RecordUsageInput as aj, type ToolConfirmation as ak, type ActionProposalDecision as al, type ActionProposalSupersessionStore as am, ALL_AGENTS as an, ASK_TOOL_DESCRIPTION as ao, ASK_TOOL_NAME as ap, type ActionProposalDecisionAudit as aq, type ActionProposalExecution as ar, type ActionProposalExecutionContext as as, type ActionProposalLease as at, type ActionProposalOutcomeDelivery as au, type AgentApprovalRequest as av, type AgentApprovalSettlement as aw, type AgentAttachmentConfig as ax, type AgentCatalogEntry as ay, type AgentClientConfig as az, type ToolHandler as b, type MessageRole as b0, type PersonaRef as b1, type PromptContext as b2, type QueuePauseReason as b3, type QueuedMessageView as b4, type QuotaView as b5, REQUESTER_APPROVER as b6, RUN_ENDED_BEFORE_TOOL_CALL as b7, type RecordRunEndInput as b8, type ResolveActionProposalApprovalInput as b9, isChatQueueStore as bA, isTransientToolError as bB, isTypedQuestion as bC, mayDecideApproval as bD, normalizeElicitationReply as bE, questionOptions as bF, queuedMessageView as bG, readElicitationInput as bH, readElicitationQuestions as bI, releaseThreadRun as bJ, renderElicitationAnswers as bK, resolveActionProposalApproval as bL, resolveElicitation as bM, resolveToolTransientRetryNumbers as bN, settleDanglingToolCalls as bO, settleElicitation as bP, toolCallApprovalFromRow as bQ, validateElicitationAnswer as bR, validateElicitationValue as bS, type ThreadTurnPage as ba, type ThreadTurnQuery as bb, type ThreadTurnReader as bc, type ToolCallApproval as bd, type ToolCallApprovalColumns as be, type ToolCallApprovalStatus as bf, type ToolCatalogEntry as bg, type ToolDescription as bh, type ToolKind as bi, type ToolPreflightOptions as bj, type ToolPresentationTone as bk, type ToolResultField as bl, type ToolResultView as bm, type ToolStepCtx as bn, type ToolTransientRetryNumbers as bo, type ToolTransientRetryOptions as bp, type TurnPersona as bq, UNFINISHED_TOOL_CALL as br, type UsagePurpose as bs, askInputSchema as bt, askToolDefinition as bu, danglingToolCallIds as bv, decodeStreamEvent as bw, defaultCanDecide as bx, encodeStreamEvent as by, invokeWithTransientRetry as bz, type ToolPresentation as c, type ToolDefinition as d, type ToolCallRequest as e, type MessageUsage as f, type AgentUiComponent as g, type AiToolCtx as h, type AgentRunInput as i, type MessageAttachment as j, type ActionProposalMutationResult as k, type AgentDefinition as l, type Persona as m, negotiateCatalog as n, type PersonaCatalogEntry as o, prepareUiEmission as p, type HistoryPolicy as q, type PageContext as r, type AgentStore as s, type AgentDelegation as t, type ToolDescribeScope as u, validateUiCapabilities as v, type ToolPreflightResult as w, type ApprovalPolicy as x, type PromptBuilder as y, type PromptContributor as z };
|