@genesislcap/foundation-ai 14.456.3-alpha-964727d.0 → 14.457.1
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/dts/transports/anthropic-transport.d.ts.map +1 -1
- package/dist/dts/transports/gemini-transport.d.ts.map +1 -1
- package/dist/dts/types/chat.types.d.ts +71 -3
- package/dist/dts/types/chat.types.d.ts.map +1 -1
- package/dist/esm/transports/anthropic-transport.js +4 -1
- package/dist/esm/transports/gemini-transport.js +4 -1
- package/dist/foundation-ai.api.json +113 -5
- package/dist/foundation-ai.d.ts +71 -3
- package/package.json +11 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic-transport.d.ts","sourceRoot":"","sources":["../../../src/transports/anthropic-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC7B,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAEV,WAAW,EACX,kBAAkB,EAGnB,MAAM,qBAAqB,CAAC;AAqE7B,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA8DD;;;;;;;;;GASG;AACH,qBAAa,kBAAmB,YAAW,WAAW,EAAE,aAAa,EAAE,sBAAsB;IAC3F,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;IACzC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAA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,aAAa;IAyBrB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAK;IACxC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAO;IAChD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CAAO;IACzD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAGxC;IACF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAQ;YAEjC,IAAI;IA+DlB,OAAO,CAAC,eAAe;CAexB"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Role of a message in a chat conversation.
|
|
3
3
|
*
|
|
4
|
+
* `'synthetic-user'` is a display-only pseudo-role (like `'system-event'`): it is
|
|
5
|
+
* tracked in history and rendered exactly like a `'user'` message, but it is
|
|
6
|
+
* never serialized to the LLM. It lets an interaction widget echo its outcome on
|
|
7
|
+
* the user's side of the chat without re-feeding it to the model — the model
|
|
8
|
+
* already learns the outcome from the tool handler's return value. See
|
|
9
|
+
* {@link InteractionResult.userMessage}.
|
|
10
|
+
*
|
|
4
11
|
* @beta
|
|
5
12
|
*/
|
|
6
|
-
export type ChatRole = 'user' | 'assistant' | 'system' | 'tool' | 'system-event';
|
|
13
|
+
export type ChatRole = 'user' | 'assistant' | 'system' | 'tool' | 'system-event' | 'synthetic-user';
|
|
7
14
|
/**
|
|
8
15
|
* A tool call requested by the assistant.
|
|
9
16
|
*
|
|
@@ -88,9 +95,36 @@ export interface ChatToolResult {
|
|
|
88
95
|
* @beta
|
|
89
96
|
*/
|
|
90
97
|
export type InteractionResult<T = unknown> = {
|
|
91
|
-
|
|
98
|
+
/**
|
|
99
|
+
* `'timeout'` is set by the driver — not a widget — when the interaction was
|
|
100
|
+
* requested with `InteractionRequestOptions.timeoutMs` and the user did not
|
|
101
|
+
* respond in time. The widget is closed read-only and the awaiting tool
|
|
102
|
+
* handler receives this result so it can recover. Type the `requestInteraction`
|
|
103
|
+
* result as an `InteractionResult` (or otherwise carry `status`) to handle it.
|
|
104
|
+
*/
|
|
105
|
+
status: 'approved' | 'rejected' | 'timeout';
|
|
92
106
|
payload?: T;
|
|
93
107
|
message?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Optional user-facing echo of the interaction outcome. When a widget returns
|
|
110
|
+
* a non-empty string here, the driver appends it to history as a
|
|
111
|
+
* `'synthetic-user'` message so it renders on the user's side of the chat
|
|
112
|
+
* (e.g. the answer the user picked). Display-only — it is never sent to the
|
|
113
|
+
* LLM. Markdown is rendered. Omit it (or return an empty string) to keep the
|
|
114
|
+
* previous behaviour, where the outcome is shown only by the resolved widget
|
|
115
|
+
* itself. Independent of `message`, which carries a rejection reason for the
|
|
116
|
+
* calling tool handler.
|
|
117
|
+
*/
|
|
118
|
+
userMessage?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Optional USD cost the widget itself accrued — e.g. it called an external
|
|
121
|
+
* service that runs its own AI. The driver folds this onto the interaction's
|
|
122
|
+
* message (as `ChatMessage.externalCostUsd`) so it joins the host's running
|
|
123
|
+
* session-cost total alongside provider-reported LLM cost. Omit it (the common
|
|
124
|
+
* case) when the widget incurs no cost of its own. Must be a non-negative,
|
|
125
|
+
* already-priced USD amount — the host does not convert tokens to cost.
|
|
126
|
+
*/
|
|
127
|
+
costUsd?: number;
|
|
94
128
|
};
|
|
95
129
|
/**
|
|
96
130
|
* A user interaction component request.
|
|
@@ -160,6 +194,15 @@ export interface ChatMessage {
|
|
|
160
194
|
* cost without re-deriving rates.
|
|
161
195
|
*/
|
|
162
196
|
cost?: number;
|
|
197
|
+
/**
|
|
198
|
+
* Optional USD cost NOT attributable to an LLM request — e.g. cost a widget
|
|
199
|
+
* accrued calling an external service that runs its own AI, reported via
|
|
200
|
+
* {@link InteractionResult.costUsd} and folded onto the widget's interaction
|
|
201
|
+
* message by the driver. Kept separate from `cost` (provider/LLM cost) so the
|
|
202
|
+
* two stay distinct for attribution and the debug log; hosts sum both into the
|
|
203
|
+
* running session total.
|
|
204
|
+
*/
|
|
205
|
+
externalCostUsd?: number;
|
|
163
206
|
/**
|
|
164
207
|
* Provider diagnostic for the request that produced this message — the raw
|
|
165
208
|
* finish reason plus, where the provider reports them, the reasoning-token
|
|
@@ -241,6 +284,14 @@ export interface SubAgentRequestOptions {
|
|
|
241
284
|
* parallel the most restrictive wins (`'hidden'` > `'disabled'`).
|
|
242
285
|
*/
|
|
243
286
|
chatInputDuringExecution?: ChatInputDuringExecutionMode;
|
|
287
|
+
/**
|
|
288
|
+
* Maximum time, in milliseconds, to wait for the sub-agent to finish. When the
|
|
289
|
+
* deadline passes the sub-agent run is aborted and `requestSubAgent` resolves
|
|
290
|
+
* with `{ ok: false, reason: 'timeout' }` — the same failure shape as any other
|
|
291
|
+
* non-completion, so the parent handler recovers on its existing `{ ok: false }`
|
|
292
|
+
* branch. Unset means no timeout — the sub-agent runs to completion.
|
|
293
|
+
*/
|
|
294
|
+
timeoutMs?: number;
|
|
244
295
|
}
|
|
245
296
|
/**
|
|
246
297
|
* Options passed to `requestInteraction` at call time.
|
|
@@ -257,6 +308,14 @@ export interface InteractionRequestOptions {
|
|
|
257
308
|
* (`'hidden'` > `'disabled'`).
|
|
258
309
|
*/
|
|
259
310
|
chatInputDuringExecution?: ChatInputDuringExecutionMode;
|
|
311
|
+
/**
|
|
312
|
+
* Maximum time, in milliseconds, to wait for the user to complete the
|
|
313
|
+
* interaction. When the deadline passes without a response, the widget is
|
|
314
|
+
* closed read-only and `requestInteraction` resolves with an
|
|
315
|
+
* {@link InteractionResult} of `status: 'timeout'` (it never rejects). Unset
|
|
316
|
+
* means no timeout — the interaction waits indefinitely.
|
|
317
|
+
*/
|
|
318
|
+
timeoutMs?: number;
|
|
260
319
|
}
|
|
261
320
|
/**
|
|
262
321
|
* Why a sub-agent run ended without producing a structured result via
|
|
@@ -272,10 +331,12 @@ export interface InteractionRequestOptions {
|
|
|
272
331
|
* retries.
|
|
273
332
|
* - `unknown_tool_limit` — the model repeatedly called tools that aren't
|
|
274
333
|
* available to it.
|
|
334
|
+
* - `timeout` — the sub-agent did not finish within
|
|
335
|
+
* {@link SubAgentRequestOptions.timeoutMs}; its run was aborted.
|
|
275
336
|
*
|
|
276
337
|
* @beta
|
|
277
338
|
*/
|
|
278
|
-
export type SubAgentFailureReason = 'max_iterations' | 'malformed_tool_call' | 'empty_response' | 'unknown_tool_limit';
|
|
339
|
+
export type SubAgentFailureReason = 'max_iterations' | 'malformed_tool_call' | 'empty_response' | 'unknown_tool_limit' | 'timeout';
|
|
279
340
|
/**
|
|
280
341
|
* Map of tool name to async handler function.
|
|
281
342
|
*
|
|
@@ -520,6 +581,13 @@ export interface ChatUiConfig {
|
|
|
520
581
|
* - `false` — hidden
|
|
521
582
|
*/
|
|
522
583
|
showActiveModel?: boolean;
|
|
584
|
+
/**
|
|
585
|
+
* Allow the user to drag a handle above the message input to resize its
|
|
586
|
+
* height.
|
|
587
|
+
* - `true` or `undefined` (default) — the resize handle is shown
|
|
588
|
+
* - `false` — the handle is hidden and the input keeps its default height
|
|
589
|
+
*/
|
|
590
|
+
resizableInput?: boolean;
|
|
523
591
|
}
|
|
524
592
|
/**
|
|
525
593
|
* Agent engine configuration for the chat assistant.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.types.d.ts","sourceRoot":"","sources":["../../../src/types/chat.types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"chat.types.d.ts","sourceRoot":"","sources":["../../../src/types/chat.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,cAAc,GAAG,gBAAgB,CAAC;AAEpG;;;;GAIG;AACH,KAAK,gBAAgB,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAA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,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -229,7 +229,10 @@ export class AnthropicTransport {
|
|
|
229
229
|
messages.push({ role, content: [block] });
|
|
230
230
|
};
|
|
231
231
|
for (const msg of history) {
|
|
232
|
-
if (msg.role === 'system' ||
|
|
232
|
+
if (msg.role === 'system' ||
|
|
233
|
+
msg.role === 'system-event' ||
|
|
234
|
+
msg.role === 'synthetic-user' ||
|
|
235
|
+
msg.thinking)
|
|
233
236
|
continue;
|
|
234
237
|
if (msg.toolResult) {
|
|
235
238
|
pushBlock('user', {
|
|
@@ -259,7 +259,10 @@ export class GeminiTransport {
|
|
|
259
259
|
// Our internal IDs are UUIDs, so build a lookup from ID → function name as we go.
|
|
260
260
|
const toolCallNameById = new Map();
|
|
261
261
|
for (const msg of history) {
|
|
262
|
-
if (msg.role === 'system' ||
|
|
262
|
+
if (msg.role === 'system' ||
|
|
263
|
+
msg.role === 'system-event' ||
|
|
264
|
+
msg.role === 'synthetic-user' ||
|
|
265
|
+
msg.thinking)
|
|
263
266
|
continue;
|
|
264
267
|
const role = msg.role === 'user' ? 'user' : 'model';
|
|
265
268
|
if (msg.toolResult) {
|
|
@@ -3200,6 +3200,33 @@
|
|
|
3200
3200
|
"endIndex": 2
|
|
3201
3201
|
}
|
|
3202
3202
|
},
|
|
3203
|
+
{
|
|
3204
|
+
"kind": "PropertySignature",
|
|
3205
|
+
"canonicalReference": "@genesislcap/foundation-ai!ChatMessage#externalCostUsd:member",
|
|
3206
|
+
"docComment": "/**\n * Optional USD cost NOT attributable to an LLM request — e.g. cost a widget accrued calling an external service that runs its own AI, reported via {@link InteractionResult.costUsd} and folded onto the widget's interaction message by the driver. Kept separate from `cost` (provider/LLM cost) so the two stay distinct for attribution and the debug log; hosts sum both into the running session total.\n */\n",
|
|
3207
|
+
"excerptTokens": [
|
|
3208
|
+
{
|
|
3209
|
+
"kind": "Content",
|
|
3210
|
+
"text": "externalCostUsd?: "
|
|
3211
|
+
},
|
|
3212
|
+
{
|
|
3213
|
+
"kind": "Content",
|
|
3214
|
+
"text": "number"
|
|
3215
|
+
},
|
|
3216
|
+
{
|
|
3217
|
+
"kind": "Content",
|
|
3218
|
+
"text": ";"
|
|
3219
|
+
}
|
|
3220
|
+
],
|
|
3221
|
+
"isReadonly": false,
|
|
3222
|
+
"isOptional": true,
|
|
3223
|
+
"releaseTag": "Beta",
|
|
3224
|
+
"name": "externalCostUsd",
|
|
3225
|
+
"propertyTypeTokenRange": {
|
|
3226
|
+
"startIndex": 1,
|
|
3227
|
+
"endIndex": 2
|
|
3228
|
+
}
|
|
3229
|
+
},
|
|
3203
3230
|
{
|
|
3204
3231
|
"kind": "PropertySignature",
|
|
3205
3232
|
"canonicalReference": "@genesislcap/foundation-ai!ChatMessage#inputTokens:member",
|
|
@@ -3776,7 +3803,7 @@
|
|
|
3776
3803
|
{
|
|
3777
3804
|
"kind": "TypeAlias",
|
|
3778
3805
|
"canonicalReference": "@genesislcap/foundation-ai!ChatRole:type",
|
|
3779
|
-
"docComment": "/**\n * Role of a message in a chat conversation.\n *\n * @beta\n */\n",
|
|
3806
|
+
"docComment": "/**\n * Role of a message in a chat conversation.\n *\n * `'synthetic-user'` is a display-only pseudo-role (like `'system-event'`): it is tracked in history and rendered exactly like a `'user'` message, but it is never serialized to the LLM. It lets an interaction widget echo its outcome on the user's side of the chat without re-feeding it to the model — the model already learns the outcome from the tool handler's return value. See {@link InteractionResult.userMessage}.\n *\n * @beta\n */\n",
|
|
3780
3807
|
"excerptTokens": [
|
|
3781
3808
|
{
|
|
3782
3809
|
"kind": "Content",
|
|
@@ -3784,7 +3811,7 @@
|
|
|
3784
3811
|
},
|
|
3785
3812
|
{
|
|
3786
3813
|
"kind": "Content",
|
|
3787
|
-
"text": "'user' | 'assistant' | 'system' | 'tool' | 'system-event'"
|
|
3814
|
+
"text": "'user' | 'assistant' | 'system' | 'tool' | 'system-event' | 'synthetic-user'"
|
|
3788
3815
|
},
|
|
3789
3816
|
{
|
|
3790
3817
|
"kind": "Content",
|
|
@@ -4734,6 +4761,33 @@
|
|
|
4734
4761
|
"endIndex": 2
|
|
4735
4762
|
}
|
|
4736
4763
|
},
|
|
4764
|
+
{
|
|
4765
|
+
"kind": "PropertySignature",
|
|
4766
|
+
"canonicalReference": "@genesislcap/foundation-ai!ChatUiConfig#resizableInput:member",
|
|
4767
|
+
"docComment": "/**\n * Allow the user to drag a handle above the message input to resize its height. - `true` or `undefined` (default) — the resize handle is shown - `false` — the handle is hidden and the input keeps its default height\n */\n",
|
|
4768
|
+
"excerptTokens": [
|
|
4769
|
+
{
|
|
4770
|
+
"kind": "Content",
|
|
4771
|
+
"text": "resizableInput?: "
|
|
4772
|
+
},
|
|
4773
|
+
{
|
|
4774
|
+
"kind": "Content",
|
|
4775
|
+
"text": "boolean"
|
|
4776
|
+
},
|
|
4777
|
+
{
|
|
4778
|
+
"kind": "Content",
|
|
4779
|
+
"text": ";"
|
|
4780
|
+
}
|
|
4781
|
+
],
|
|
4782
|
+
"isReadonly": false,
|
|
4783
|
+
"isOptional": true,
|
|
4784
|
+
"releaseTag": "Beta",
|
|
4785
|
+
"name": "resizableInput",
|
|
4786
|
+
"propertyTypeTokenRange": {
|
|
4787
|
+
"startIndex": 1,
|
|
4788
|
+
"endIndex": 2
|
|
4789
|
+
}
|
|
4790
|
+
},
|
|
4737
4791
|
{
|
|
4738
4792
|
"kind": "PropertySignature",
|
|
4739
4793
|
"canonicalReference": "@genesislcap/foundation-ai!ChatUiConfig#showActiveModel:member",
|
|
@@ -6553,6 +6607,33 @@
|
|
|
6553
6607
|
"startIndex": 1,
|
|
6554
6608
|
"endIndex": 2
|
|
6555
6609
|
}
|
|
6610
|
+
},
|
|
6611
|
+
{
|
|
6612
|
+
"kind": "PropertySignature",
|
|
6613
|
+
"canonicalReference": "@genesislcap/foundation-ai!InteractionRequestOptions#timeoutMs:member",
|
|
6614
|
+
"docComment": "/**\n * Maximum time, in milliseconds, to wait for the user to complete the interaction. When the deadline passes without a response, the widget is closed read-only and `requestInteraction` resolves with an {@link InteractionResult} of `status: 'timeout'` (it never rejects). Unset means no timeout — the interaction waits indefinitely.\n */\n",
|
|
6615
|
+
"excerptTokens": [
|
|
6616
|
+
{
|
|
6617
|
+
"kind": "Content",
|
|
6618
|
+
"text": "timeoutMs?: "
|
|
6619
|
+
},
|
|
6620
|
+
{
|
|
6621
|
+
"kind": "Content",
|
|
6622
|
+
"text": "number"
|
|
6623
|
+
},
|
|
6624
|
+
{
|
|
6625
|
+
"kind": "Content",
|
|
6626
|
+
"text": ";"
|
|
6627
|
+
}
|
|
6628
|
+
],
|
|
6629
|
+
"isReadonly": false,
|
|
6630
|
+
"isOptional": true,
|
|
6631
|
+
"releaseTag": "Beta",
|
|
6632
|
+
"name": "timeoutMs",
|
|
6633
|
+
"propertyTypeTokenRange": {
|
|
6634
|
+
"startIndex": 1,
|
|
6635
|
+
"endIndex": 2
|
|
6636
|
+
}
|
|
6556
6637
|
}
|
|
6557
6638
|
],
|
|
6558
6639
|
"extendsTokenRanges": []
|
|
@@ -6576,7 +6657,7 @@
|
|
|
6576
6657
|
},
|
|
6577
6658
|
{
|
|
6578
6659
|
"kind": "Content",
|
|
6579
|
-
"text": "{\n status: 'approved' | 'rejected';\n payload?: T;\n message?: string;\n}"
|
|
6660
|
+
"text": "{\n status: 'approved' | 'rejected' | 'timeout';\n payload?: T;\n message?: string;\n userMessage?: string;\n costUsd?: number;\n}"
|
|
6580
6661
|
},
|
|
6581
6662
|
{
|
|
6582
6663
|
"kind": "Content",
|
|
@@ -7229,7 +7310,7 @@
|
|
|
7229
7310
|
{
|
|
7230
7311
|
"kind": "TypeAlias",
|
|
7231
7312
|
"canonicalReference": "@genesislcap/foundation-ai!SubAgentFailureReason:type",
|
|
7232
|
-
"docComment": "/**\n * Why a sub-agent run ended without producing a structured result via `completeSubAgent`. Surfaced on the `{ ok: false }` branch of `requestSubAgent` so the parent tool handler can decide how to recover.\n *\n * - `max_iterations` — the sub-agent's tool loop ended without calling its completion tool (hit the iteration cap, or — defensively — a provider ignored forced tool use and returned a free-text turn). - `malformed_tool_call` — the provider repeatedly returned an unparseable tool call (e.g. Gemini `MALFORMED_FUNCTION_CALL`) after retries. - `empty_response` — the model repeatedly returned an empty response after retries. - `unknown_tool_limit` — the model repeatedly called tools that aren't available to it.\n *\n * @beta\n */\n",
|
|
7313
|
+
"docComment": "/**\n * Why a sub-agent run ended without producing a structured result via `completeSubAgent`. Surfaced on the `{ ok: false }` branch of `requestSubAgent` so the parent tool handler can decide how to recover.\n *\n * - `max_iterations` — the sub-agent's tool loop ended without calling its completion tool (hit the iteration cap, or — defensively — a provider ignored forced tool use and returned a free-text turn). - `malformed_tool_call` — the provider repeatedly returned an unparseable tool call (e.g. Gemini `MALFORMED_FUNCTION_CALL`) after retries. - `empty_response` — the model repeatedly returned an empty response after retries. - `unknown_tool_limit` — the model repeatedly called tools that aren't available to it. - `timeout` — the sub-agent did not finish within {@link SubAgentRequestOptions.timeoutMs}; its run was aborted.\n *\n * @beta\n */\n",
|
|
7233
7314
|
"excerptTokens": [
|
|
7234
7315
|
{
|
|
7235
7316
|
"kind": "Content",
|
|
@@ -7237,7 +7318,7 @@
|
|
|
7237
7318
|
},
|
|
7238
7319
|
{
|
|
7239
7320
|
"kind": "Content",
|
|
7240
|
-
"text": "'max_iterations' | 'malformed_tool_call' | 'empty_response' | 'unknown_tool_limit'"
|
|
7321
|
+
"text": "'max_iterations' | 'malformed_tool_call' | 'empty_response' | 'unknown_tool_limit' | 'timeout'"
|
|
7241
7322
|
},
|
|
7242
7323
|
{
|
|
7243
7324
|
"kind": "Content",
|
|
@@ -7380,6 +7461,33 @@
|
|
|
7380
7461
|
"startIndex": 1,
|
|
7381
7462
|
"endIndex": 2
|
|
7382
7463
|
}
|
|
7464
|
+
},
|
|
7465
|
+
{
|
|
7466
|
+
"kind": "PropertySignature",
|
|
7467
|
+
"canonicalReference": "@genesislcap/foundation-ai!SubAgentRequestOptions#timeoutMs:member",
|
|
7468
|
+
"docComment": "/**\n * Maximum time, in milliseconds, to wait for the sub-agent to finish. When the deadline passes the sub-agent run is aborted and `requestSubAgent` resolves with `{ ok: false, reason: 'timeout' }` — the same failure shape as any other non-completion, so the parent handler recovers on its existing `{ ok: false }` branch. Unset means no timeout — the sub-agent runs to completion.\n */\n",
|
|
7469
|
+
"excerptTokens": [
|
|
7470
|
+
{
|
|
7471
|
+
"kind": "Content",
|
|
7472
|
+
"text": "timeoutMs?: "
|
|
7473
|
+
},
|
|
7474
|
+
{
|
|
7475
|
+
"kind": "Content",
|
|
7476
|
+
"text": "number"
|
|
7477
|
+
},
|
|
7478
|
+
{
|
|
7479
|
+
"kind": "Content",
|
|
7480
|
+
"text": ";"
|
|
7481
|
+
}
|
|
7482
|
+
],
|
|
7483
|
+
"isReadonly": false,
|
|
7484
|
+
"isOptional": true,
|
|
7485
|
+
"releaseTag": "Beta",
|
|
7486
|
+
"name": "timeoutMs",
|
|
7487
|
+
"propertyTypeTokenRange": {
|
|
7488
|
+
"startIndex": 1,
|
|
7489
|
+
"endIndex": 2
|
|
7490
|
+
}
|
|
7383
7491
|
}
|
|
7384
7492
|
],
|
|
7385
7493
|
"extendsTokenRanges": []
|
package/dist/foundation-ai.d.ts
CHANGED
|
@@ -512,6 +512,15 @@ export declare interface ChatMessage {
|
|
|
512
512
|
* cost without re-deriving rates.
|
|
513
513
|
*/
|
|
514
514
|
cost?: number;
|
|
515
|
+
/**
|
|
516
|
+
* Optional USD cost NOT attributable to an LLM request — e.g. cost a widget
|
|
517
|
+
* accrued calling an external service that runs its own AI, reported via
|
|
518
|
+
* {@link InteractionResult.costUsd} and folded onto the widget's interaction
|
|
519
|
+
* message by the driver. Kept separate from `cost` (provider/LLM cost) so the
|
|
520
|
+
* two stay distinct for attribution and the debug log; hosts sum both into the
|
|
521
|
+
* running session total.
|
|
522
|
+
*/
|
|
523
|
+
externalCostUsd?: number;
|
|
515
524
|
/**
|
|
516
525
|
* Provider diagnostic for the request that produced this message — the raw
|
|
517
526
|
* finish reason plus, where the provider reports them, the reasoning-token
|
|
@@ -592,9 +601,16 @@ export declare interface ChatResponseMeta {
|
|
|
592
601
|
/**
|
|
593
602
|
* Role of a message in a chat conversation.
|
|
594
603
|
*
|
|
604
|
+
* `'synthetic-user'` is a display-only pseudo-role (like `'system-event'`): it is
|
|
605
|
+
* tracked in history and rendered exactly like a `'user'` message, but it is
|
|
606
|
+
* never serialized to the LLM. It lets an interaction widget echo its outcome on
|
|
607
|
+
* the user's side of the chat without re-feeding it to the model — the model
|
|
608
|
+
* already learns the outcome from the tool handler's return value. See
|
|
609
|
+
* {@link InteractionResult.userMessage}.
|
|
610
|
+
*
|
|
595
611
|
* @beta
|
|
596
612
|
*/
|
|
597
|
-
export declare type ChatRole = 'user' | 'assistant' | 'system' | 'tool' | 'system-event';
|
|
613
|
+
export declare type ChatRole = 'user' | 'assistant' | 'system' | 'tool' | 'system-event' | 'synthetic-user';
|
|
598
614
|
|
|
599
615
|
/**
|
|
600
616
|
* A streaming chunk from a chat response.
|
|
@@ -938,6 +954,13 @@ export declare interface ChatUiConfig {
|
|
|
938
954
|
* - `false` — hidden
|
|
939
955
|
*/
|
|
940
956
|
showActiveModel?: boolean;
|
|
957
|
+
/**
|
|
958
|
+
* Allow the user to drag a handle above the message input to resize its
|
|
959
|
+
* height.
|
|
960
|
+
* - `true` or `undefined` (default) — the resize handle is shown
|
|
961
|
+
* - `false` — the handle is hidden and the input keeps its default height
|
|
962
|
+
*/
|
|
963
|
+
resizableInput?: boolean;
|
|
941
964
|
}
|
|
942
965
|
|
|
943
966
|
/**
|
|
@@ -1191,6 +1214,14 @@ export declare interface InteractionRequestOptions {
|
|
|
1191
1214
|
* (`'hidden'` > `'disabled'`).
|
|
1192
1215
|
*/
|
|
1193
1216
|
chatInputDuringExecution?: ChatInputDuringExecutionMode;
|
|
1217
|
+
/**
|
|
1218
|
+
* Maximum time, in milliseconds, to wait for the user to complete the
|
|
1219
|
+
* interaction. When the deadline passes without a response, the widget is
|
|
1220
|
+
* closed read-only and `requestInteraction` resolves with an
|
|
1221
|
+
* {@link InteractionResult} of `status: 'timeout'` (it never rejects). Unset
|
|
1222
|
+
* means no timeout — the interaction waits indefinitely.
|
|
1223
|
+
*/
|
|
1224
|
+
timeoutMs?: number;
|
|
1194
1225
|
}
|
|
1195
1226
|
|
|
1196
1227
|
/**
|
|
@@ -1199,9 +1230,36 @@ export declare interface InteractionRequestOptions {
|
|
|
1199
1230
|
* @beta
|
|
1200
1231
|
*/
|
|
1201
1232
|
export declare type InteractionResult<T = unknown> = {
|
|
1202
|
-
|
|
1233
|
+
/**
|
|
1234
|
+
* `'timeout'` is set by the driver — not a widget — when the interaction was
|
|
1235
|
+
* requested with `InteractionRequestOptions.timeoutMs` and the user did not
|
|
1236
|
+
* respond in time. The widget is closed read-only and the awaiting tool
|
|
1237
|
+
* handler receives this result so it can recover. Type the `requestInteraction`
|
|
1238
|
+
* result as an `InteractionResult` (or otherwise carry `status`) to handle it.
|
|
1239
|
+
*/
|
|
1240
|
+
status: 'approved' | 'rejected' | 'timeout';
|
|
1203
1241
|
payload?: T;
|
|
1204
1242
|
message?: string;
|
|
1243
|
+
/**
|
|
1244
|
+
* Optional user-facing echo of the interaction outcome. When a widget returns
|
|
1245
|
+
* a non-empty string here, the driver appends it to history as a
|
|
1246
|
+
* `'synthetic-user'` message so it renders on the user's side of the chat
|
|
1247
|
+
* (e.g. the answer the user picked). Display-only — it is never sent to the
|
|
1248
|
+
* LLM. Markdown is rendered. Omit it (or return an empty string) to keep the
|
|
1249
|
+
* previous behaviour, where the outcome is shown only by the resolved widget
|
|
1250
|
+
* itself. Independent of `message`, which carries a rejection reason for the
|
|
1251
|
+
* calling tool handler.
|
|
1252
|
+
*/
|
|
1253
|
+
userMessage?: string;
|
|
1254
|
+
/**
|
|
1255
|
+
* Optional USD cost the widget itself accrued — e.g. it called an external
|
|
1256
|
+
* service that runs its own AI. The driver folds this onto the interaction's
|
|
1257
|
+
* message (as `ChatMessage.externalCostUsd`) so it joins the host's running
|
|
1258
|
+
* session-cost total alongside provider-reported LLM cost. Omit it (the common
|
|
1259
|
+
* case) when the widget incurs no cost of its own. Must be a non-negative,
|
|
1260
|
+
* already-priced USD amount — the host does not convert tokens to cost.
|
|
1261
|
+
*/
|
|
1262
|
+
costUsd?: number;
|
|
1205
1263
|
};
|
|
1206
1264
|
|
|
1207
1265
|
/** Returns true when AI features (beta) are enabled via ?feature.ai URL param or GENX_ENABLE_AI=true env var. */
|
|
@@ -1362,10 +1420,12 @@ declare interface StructuredPromptOptions {
|
|
|
1362
1420
|
* retries.
|
|
1363
1421
|
* - `unknown_tool_limit` — the model repeatedly called tools that aren't
|
|
1364
1422
|
* available to it.
|
|
1423
|
+
* - `timeout` — the sub-agent did not finish within
|
|
1424
|
+
* {@link SubAgentRequestOptions.timeoutMs}; its run was aborted.
|
|
1365
1425
|
*
|
|
1366
1426
|
* @beta
|
|
1367
1427
|
*/
|
|
1368
|
-
export declare type SubAgentFailureReason = 'max_iterations' | 'malformed_tool_call' | 'empty_response' | 'unknown_tool_limit';
|
|
1428
|
+
export declare type SubAgentFailureReason = 'max_iterations' | 'malformed_tool_call' | 'empty_response' | 'unknown_tool_limit' | 'timeout';
|
|
1369
1429
|
|
|
1370
1430
|
/**
|
|
1371
1431
|
* Options passed to `requestSubAgent` at call time.
|
|
@@ -1388,6 +1448,14 @@ export declare interface SubAgentRequestOptions {
|
|
|
1388
1448
|
* parallel the most restrictive wins (`'hidden'` > `'disabled'`).
|
|
1389
1449
|
*/
|
|
1390
1450
|
chatInputDuringExecution?: ChatInputDuringExecutionMode;
|
|
1451
|
+
/**
|
|
1452
|
+
* Maximum time, in milliseconds, to wait for the sub-agent to finish. When the
|
|
1453
|
+
* deadline passes the sub-agent run is aborted and `requestSubAgent` resolves
|
|
1454
|
+
* with `{ ok: false, reason: 'timeout' }` — the same failure shape as any other
|
|
1455
|
+
* non-completion, so the parent handler recovers on its existing `{ ok: false }`
|
|
1456
|
+
* branch. Unset means no timeout — the sub-agent runs to completion.
|
|
1457
|
+
*/
|
|
1458
|
+
timeoutMs?: number;
|
|
1391
1459
|
}
|
|
1392
1460
|
|
|
1393
1461
|
/** @beta */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-ai",
|
|
3
3
|
"description": "Genesis Foundation AI - Provider-agnostic AI configuration and shared utilities",
|
|
4
|
-
"version": "14.
|
|
4
|
+
"version": "14.457.1",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -52,17 +52,17 @@
|
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@genesislcap/foundation-testing": "14.
|
|
56
|
-
"@genesislcap/genx": "14.
|
|
57
|
-
"@genesislcap/rollup-builder": "14.
|
|
58
|
-
"@genesislcap/ts-builder": "14.
|
|
59
|
-
"@genesislcap/uvu-playwright-builder": "14.
|
|
60
|
-
"@genesislcap/vite-builder": "14.
|
|
61
|
-
"@genesislcap/webpack-builder": "14.
|
|
55
|
+
"@genesislcap/foundation-testing": "14.457.1",
|
|
56
|
+
"@genesislcap/genx": "14.457.1",
|
|
57
|
+
"@genesislcap/rollup-builder": "14.457.1",
|
|
58
|
+
"@genesislcap/ts-builder": "14.457.1",
|
|
59
|
+
"@genesislcap/uvu-playwright-builder": "14.457.1",
|
|
60
|
+
"@genesislcap/vite-builder": "14.457.1",
|
|
61
|
+
"@genesislcap/webpack-builder": "14.457.1"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@genesislcap/foundation-logger": "14.
|
|
65
|
-
"@genesislcap/foundation-utils": "14.
|
|
64
|
+
"@genesislcap/foundation-logger": "14.457.1",
|
|
65
|
+
"@genesislcap/foundation-utils": "14.457.1",
|
|
66
66
|
"@microsoft/fast-foundation": "2.50.0"
|
|
67
67
|
},
|
|
68
68
|
"repository": {
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "d11a46202d4f1404deffdaa867fcbe5b2c8225dc"
|
|
77
77
|
}
|