@genesislcap/ai-assistant 14.467.1 → 14.467.2
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/ai-assistant.api.json +39 -53
- package/dist/ai-assistant.d.ts +20 -25
- package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/main/main.d.ts +1 -20
- package/dist/dts/main/main.d.ts.map +1 -1
- package/dist/dts/state/debug-event-log.d.ts +16 -0
- package/dist/dts/state/debug-event-log.d.ts.map +1 -1
- package/dist/dts/state/debug-event-log.test.d.ts +2 -0
- package/dist/dts/state/debug-event-log.test.d.ts.map +1 -0
- package/dist/dts/utils/flatten-sub-agent-messages.d.ts +51 -0
- package/dist/dts/utils/flatten-sub-agent-messages.d.ts.map +1 -0
- package/dist/dts/utils/flatten-sub-agent-messages.test.d.ts +2 -0
- package/dist/dts/utils/flatten-sub-agent-messages.test.d.ts.map +1 -0
- package/dist/dts/utils/strip-agent-handlers.d.ts +29 -0
- package/dist/dts/utils/strip-agent-handlers.d.ts.map +1 -0
- package/dist/dts/utils/strip-agent-handlers.test.d.ts +2 -0
- package/dist/dts/utils/strip-agent-handlers.test.d.ts.map +1 -0
- package/dist/esm/components/chat-driver/chat-driver.js +48 -12
- package/dist/esm/components/chat-driver/chat-driver.test.js +29 -0
- package/dist/esm/main/main.js +14 -38
- package/dist/esm/state/debug-event-log.js +47 -0
- package/dist/esm/state/debug-event-log.test.js +67 -0
- package/dist/esm/utils/flatten-sub-agent-messages.js +49 -0
- package/dist/esm/utils/flatten-sub-agent-messages.test.js +139 -0
- package/dist/esm/utils/strip-agent-handlers.js +51 -0
- package/dist/esm/utils/strip-agent-handlers.test.js +81 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -16
- package/src/components/chat-driver/chat-driver.test.ts +43 -0
- package/src/components/chat-driver/chat-driver.ts +64 -10
- package/src/index.ts +1 -0
- package/src/main/main.ts +16 -37
- package/src/state/debug-event-log.test.ts +89 -0
- package/src/state/debug-event-log.ts +48 -0
- package/src/utils/flatten-sub-agent-messages.test.ts +163 -0
- package/src/utils/flatten-sub-agent-messages.ts +88 -0
- package/src/utils/strip-agent-handlers.test.ts +99 -0
- package/src/utils/strip-agent-handlers.ts +52 -0
|
@@ -5385,70 +5385,25 @@
|
|
|
5385
5385
|
},
|
|
5386
5386
|
{
|
|
5387
5387
|
"kind": "Content",
|
|
5388
|
-
"text": "{\n readme: readonly string[];\n timeline: (
|
|
5388
|
+
"text": "{\n readme: readonly string[];\n timeline: (import(\"../utils/flatten-sub-agent-messages\")."
|
|
5389
5389
|
},
|
|
5390
5390
|
{
|
|
5391
5391
|
"kind": "Reference",
|
|
5392
|
-
"text": "
|
|
5393
|
-
"canonicalReference": "@genesislcap/
|
|
5394
|
-
},
|
|
5395
|
-
{
|
|
5396
|
-
"kind": "Content",
|
|
5397
|
-
"text": ";\n agentLabel?: string;\n agentSnapshot?: unknown;\n kind: \"turn\";\n } | {\n role: import(\"@genesislcap/foundation-ai\")."
|
|
5398
|
-
},
|
|
5399
|
-
{
|
|
5400
|
-
"kind": "Reference",
|
|
5401
|
-
"text": "ChatRole",
|
|
5402
|
-
"canonicalReference": "@genesislcap/foundation-ai!ChatRole:type"
|
|
5392
|
+
"text": "TimelineMessage",
|
|
5393
|
+
"canonicalReference": "@genesislcap/ai-assistant!TimelineMessage:type"
|
|
5403
5394
|
},
|
|
5404
5395
|
{
|
|
5405
5396
|
"kind": "Content",
|
|
5406
|
-
"text": ";\n
|
|
5397
|
+
"text": " | {\n systemPrompt: string;\n turnIndex: string;\n timestamp: string;\n agentName?: string;\n toolNames: string[];\n temperature?: number;\n toolChoice?: import(\"@genesislcap/foundation-ai\")."
|
|
5407
5398
|
},
|
|
5408
5399
|
{
|
|
5409
5400
|
"kind": "Reference",
|
|
5410
|
-
"text": "
|
|
5411
|
-
"canonicalReference": "@genesislcap/foundation-ai!
|
|
5412
|
-
},
|
|
5413
|
-
{
|
|
5414
|
-
"kind": "Content",
|
|
5415
|
-
"text": "[];\n toolResult?: import(\"@genesislcap/foundation-ai\")."
|
|
5416
|
-
},
|
|
5417
|
-
{
|
|
5418
|
-
"kind": "Reference",
|
|
5419
|
-
"text": "ChatToolResult",
|
|
5420
|
-
"canonicalReference": "@genesislcap/foundation-ai!ChatToolResult:interface"
|
|
5421
|
-
},
|
|
5422
|
-
{
|
|
5423
|
-
"kind": "Content",
|
|
5424
|
-
"text": ";\n attachments?: "
|
|
5425
|
-
},
|
|
5426
|
-
{
|
|
5427
|
-
"kind": "Reference",
|
|
5428
|
-
"text": "ChatAttachment",
|
|
5429
|
-
"canonicalReference": "@genesislcap/foundation-ai!ChatAttachment:interface"
|
|
5430
|
-
},
|
|
5431
|
-
{
|
|
5432
|
-
"kind": "Content",
|
|
5433
|
-
"text": "[];\n interaction?: import(\"@genesislcap/foundation-ai\")."
|
|
5434
|
-
},
|
|
5435
|
-
{
|
|
5436
|
-
"kind": "Reference",
|
|
5437
|
-
"text": "ChatInteraction",
|
|
5438
|
-
"canonicalReference": "@genesislcap/foundation-ai!ChatInteraction:interface"
|
|
5439
|
-
},
|
|
5440
|
-
{
|
|
5441
|
-
"kind": "Content",
|
|
5442
|
-
"text": ";\n thinking?: boolean;\n agentName?: string;\n agentLabel?: string;\n inputTokens?: number;\n outputTokens?: number;\n cost?: number;\n externalCostUsd?: number;\n responseMeta?: import(\"@genesislcap/foundation-ai\")."
|
|
5443
|
-
},
|
|
5444
|
-
{
|
|
5445
|
-
"kind": "Reference",
|
|
5446
|
-
"text": "ChatResponseMeta",
|
|
5447
|
-
"canonicalReference": "@genesislcap/foundation-ai!ChatResponseMeta:interface"
|
|
5401
|
+
"text": "ChatToolChoice",
|
|
5402
|
+
"canonicalReference": "@genesislcap/foundation-ai!ChatToolChoice:type"
|
|
5448
5403
|
},
|
|
5449
5404
|
{
|
|
5450
5405
|
"kind": "Content",
|
|
5451
|
-
"text": ";\n
|
|
5406
|
+
"text": ";\n agentLabel?: string;\n agentSnapshot?: unknown;\n kind: \"turn\";\n } | {\n index: number;\n timestamp: string;\n type: "
|
|
5452
5407
|
},
|
|
5453
5408
|
{
|
|
5454
5409
|
"kind": "Reference",
|
|
@@ -5629,7 +5584,7 @@
|
|
|
5629
5584
|
"isStatic": false,
|
|
5630
5585
|
"returnTypeTokenRange": {
|
|
5631
5586
|
"startIndex": 1,
|
|
5632
|
-
"endIndex":
|
|
5587
|
+
"endIndex": 44
|
|
5633
5588
|
},
|
|
5634
5589
|
"releaseTag": "Beta",
|
|
5635
5590
|
"isProtected": false,
|
|
@@ -10373,6 +10328,37 @@
|
|
|
10373
10328
|
"endIndex": 6
|
|
10374
10329
|
}
|
|
10375
10330
|
},
|
|
10331
|
+
{
|
|
10332
|
+
"kind": "TypeAlias",
|
|
10333
|
+
"canonicalReference": "@genesislcap/ai-assistant!TimelineMessage:type",
|
|
10334
|
+
"docComment": "/**\n * A chat message lifted into the debug-log timeline as a `kind: 'message'` entry.\n *\n * @beta\n */\n",
|
|
10335
|
+
"excerptTokens": [
|
|
10336
|
+
{
|
|
10337
|
+
"kind": "Content",
|
|
10338
|
+
"text": "export type TimelineMessage = "
|
|
10339
|
+
},
|
|
10340
|
+
{
|
|
10341
|
+
"kind": "Reference",
|
|
10342
|
+
"text": "ChatMessage",
|
|
10343
|
+
"canonicalReference": "@genesislcap/foundation-ai!ChatMessage:interface"
|
|
10344
|
+
},
|
|
10345
|
+
{
|
|
10346
|
+
"kind": "Content",
|
|
10347
|
+
"text": " & {\n kind: 'message';\n subAgentName?: string;\n subAgentDepth?: number;\n subAgentOf?: string;\n}"
|
|
10348
|
+
},
|
|
10349
|
+
{
|
|
10350
|
+
"kind": "Content",
|
|
10351
|
+
"text": ";"
|
|
10352
|
+
}
|
|
10353
|
+
],
|
|
10354
|
+
"fileUrlPath": "src/utils/flatten-sub-agent-messages.ts",
|
|
10355
|
+
"releaseTag": "Beta",
|
|
10356
|
+
"name": "TimelineMessage",
|
|
10357
|
+
"typeTokenRange": {
|
|
10358
|
+
"startIndex": 1,
|
|
10359
|
+
"endIndex": 3
|
|
10360
|
+
}
|
|
10361
|
+
},
|
|
10376
10362
|
{
|
|
10377
10363
|
"kind": "TypeAlias",
|
|
10378
10364
|
"canonicalReference": "@genesislcap/ai-assistant!ToolChoiceInput:type",
|
package/dist/ai-assistant.d.ts
CHANGED
|
@@ -5,15 +5,10 @@ import type { ChatAttachment } from '@genesislcap/foundation-ai';
|
|
|
5
5
|
import type { ChatConfig } from '@genesislcap/foundation-ai';
|
|
6
6
|
import type { ChatDriverResult } from '@genesislcap/foundation-ai';
|
|
7
7
|
import type { ChatInputDuringExecutionMode } from '@genesislcap/foundation-ai';
|
|
8
|
-
import { ChatInteraction } from '@genesislcap/foundation-ai';
|
|
9
8
|
import type { ChatMessage } from '@genesislcap/foundation-ai';
|
|
10
|
-
import { ChatResponseMeta } from '@genesislcap/foundation-ai';
|
|
11
|
-
import { ChatRole } from '@genesislcap/foundation-ai';
|
|
12
|
-
import { ChatToolCall } from '@genesislcap/foundation-ai';
|
|
13
9
|
import { ChatToolChoice } from '@genesislcap/foundation-ai';
|
|
14
10
|
import { ChatToolDefinition } from '@genesislcap/foundation-ai';
|
|
15
11
|
import type { ChatToolHandlers } from '@genesislcap/foundation-ai';
|
|
16
|
-
import { ChatToolResult } from '@genesislcap/foundation-ai';
|
|
17
12
|
import { GenesisElement } from '@genesislcap/web-core';
|
|
18
13
|
import type { InteractionRequestOptions } from '@genesislcap/foundation-ai';
|
|
19
14
|
import type { InteractionResult } from '@genesislcap/foundation-ai';
|
|
@@ -1680,7 +1675,7 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
1680
1675
|
setEnabledAnimations(animations: AiAssistantAnimation[]): void;
|
|
1681
1676
|
getDebugLog(): {
|
|
1682
1677
|
readme: readonly string[];
|
|
1683
|
-
timeline: ({
|
|
1678
|
+
timeline: (TimelineMessage | {
|
|
1684
1679
|
systemPrompt: string;
|
|
1685
1680
|
turnIndex: string;
|
|
1686
1681
|
timestamp: string;
|
|
@@ -1691,25 +1686,6 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
1691
1686
|
agentLabel?: string;
|
|
1692
1687
|
agentSnapshot?: unknown;
|
|
1693
1688
|
kind: "turn";
|
|
1694
|
-
} | {
|
|
1695
|
-
role: ChatRole;
|
|
1696
|
-
content: string;
|
|
1697
|
-
timestamp?: string;
|
|
1698
|
-
toolCalls?: ChatToolCall[];
|
|
1699
|
-
toolResult?: ChatToolResult;
|
|
1700
|
-
attachments?: ChatAttachment[];
|
|
1701
|
-
interaction?: ChatInteraction;
|
|
1702
|
-
thinking?: boolean;
|
|
1703
|
-
agentName?: string;
|
|
1704
|
-
agentLabel?: string;
|
|
1705
|
-
inputTokens?: number;
|
|
1706
|
-
outputTokens?: number;
|
|
1707
|
-
cost?: number;
|
|
1708
|
-
externalCostUsd?: number;
|
|
1709
|
-
responseMeta?: ChatResponseMeta;
|
|
1710
|
-
model?: string;
|
|
1711
|
-
providerName?: string;
|
|
1712
|
-
kind: "message";
|
|
1713
1689
|
} | {
|
|
1714
1690
|
index: number;
|
|
1715
1691
|
timestamp: string;
|
|
@@ -2373,6 +2349,25 @@ export declare type SystemPromptInput = string | ((ctx: SystemPromptContext) =>
|
|
|
2373
2349
|
*/
|
|
2374
2350
|
export declare type TemperatureInput = number | ((ctx: SystemPromptContext) => number | Promise<number>);
|
|
2375
2351
|
|
|
2352
|
+
/**
|
|
2353
|
+
* A chat message lifted into the debug-log timeline as a `kind: 'message'` entry.
|
|
2354
|
+
*
|
|
2355
|
+
* @beta
|
|
2356
|
+
*/
|
|
2357
|
+
export declare type TimelineMessage = ChatMessage & {
|
|
2358
|
+
kind: 'message';
|
|
2359
|
+
/**
|
|
2360
|
+
* Set only on entries hoisted out of a `subAgentTrace`: the sub-agent's own
|
|
2361
|
+
* (un-breadcrumbed) `agentName`, kept for filtering since the displayed
|
|
2362
|
+
* `agentName` is rewritten to a `"<parent> › <sub-agent>"` breadcrumb.
|
|
2363
|
+
*/
|
|
2364
|
+
subAgentName?: string;
|
|
2365
|
+
/** Delegation depth — absent/0 for top-level, 1 for a sub-agent, 2 for a sub-agent's sub-agent, … */
|
|
2366
|
+
subAgentDepth?: number;
|
|
2367
|
+
/** Id of the parent tool call that spawned this run — correlates a hoisted message back to its delegation. */
|
|
2368
|
+
subAgentOf?: string;
|
|
2369
|
+
};
|
|
2370
|
+
|
|
2376
2371
|
/**
|
|
2377
2372
|
* Symbol used to attach ToolFold metadata to a facade handler function.
|
|
2378
2373
|
* The ChatDriver inspects this to detect fold facades at runtime.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-driver.d.ts","sourceRoot":"","sources":["../../../../src/components/chat-driver/chat-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,WAAW,EAGX,cAAc,EAGd,yBAAyB,EAEzB,qBAAqB,EAEtB,MAAM,4BAA4B,CAAC;AAMpC,OAAO,KAAK,EACV,WAAW,EAGX,iBAAiB,EAGjB,oBAAoB,EACpB,iBAAiB,EAElB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"chat-driver.d.ts","sourceRoot":"","sources":["../../../../src/components/chat-driver/chat-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,WAAW,EAGX,cAAc,EAGd,yBAAyB,EAEzB,qBAAqB,EAEtB,MAAM,4BAA4B,CAAC;AAMpC,OAAO,KAAK,EACV,WAAW,EAGX,iBAAiB,EAGjB,oBAAoB,EACpB,iBAAiB,EAElB,MAAM,qBAAqB,CAAC;AAc7B,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AA8CxE,wFAAwF;AACxF,eAAO,MAAM,yBAAyB,yBA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C/B,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,GAAG,EACT,OAAO,CAAC,EAAE,yBAAyB,GAClC,OAAO,CAAC,CAAC,CAAC;IAgEb;;;OAGG;IACI,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,IAAI;IAuDnE;;;;;;;OAOG;IACH,OAAO,CAAC,yBAAyB;IASjC;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAI;IAS3C,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA4C/F;;;;;;;;OAQG;IACH,OAAO,CAAC,mBAAmB;IAyC3B;;;;;OAKG;YACW,cAAc;IAoN5B;;;OAGG;IACG,mBAAmB,CAAC,eAAe,CAAC,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA6CrF,wFAAwF;IACxF,OAAO,CAAC,OAAO;IAKf;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAc1B;;;;;;;;;OASG;IACH,OAAO,CAAC,cAAc;IAMtB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IA+BxB,uFAAuF;IACvF,OAAO,CAAC,QAAQ;IAqChB,OAAO,CAAC,aAAa;IAQrB,8EAA8E;IAC9E,OAAO,CAAC,SAAS;IAWjB,mFAAmF;IACnF,OAAO,CAAC,2BAA2B;YAkCrB,WAAW;IAuqBzB,OAAO,CAAC,eAAe;CAoBxB"}
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './config/config';
|
|
|
12
12
|
export * from './config/define-stateful-agent';
|
|
13
13
|
export * from './config/fallback-agents';
|
|
14
14
|
export * from './utils/tool-fold';
|
|
15
|
+
export type { TimelineMessage } from './utils/flatten-sub-agent-messages';
|
|
15
16
|
export type { AiChatWidget } from './types/ai-chat-widget';
|
|
16
17
|
export { AiChatMarkdown } from './components/chat-markdown/chat-markdown';
|
|
17
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/dts/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,YAAY,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC"}
|
package/dist/dts/main/main.d.ts
CHANGED
|
@@ -412,7 +412,7 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
412
412
|
setEnabledAnimations(animations: AiAssistantAnimation[]): void;
|
|
413
413
|
getDebugLog(): {
|
|
414
414
|
readme: readonly string[];
|
|
415
|
-
timeline: ({
|
|
415
|
+
timeline: (import("../utils/flatten-sub-agent-messages").TimelineMessage | {
|
|
416
416
|
systemPrompt: string;
|
|
417
417
|
turnIndex: string;
|
|
418
418
|
timestamp: string;
|
|
@@ -423,25 +423,6 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
423
423
|
agentLabel?: string;
|
|
424
424
|
agentSnapshot?: unknown;
|
|
425
425
|
kind: "turn";
|
|
426
|
-
} | {
|
|
427
|
-
role: import("@genesislcap/foundation-ai").ChatRole;
|
|
428
|
-
content: string;
|
|
429
|
-
timestamp?: string;
|
|
430
|
-
toolCalls?: import("@genesislcap/foundation-ai").ChatToolCall[];
|
|
431
|
-
toolResult?: import("@genesislcap/foundation-ai").ChatToolResult;
|
|
432
|
-
attachments?: ChatAttachment[];
|
|
433
|
-
interaction?: import("@genesislcap/foundation-ai").ChatInteraction;
|
|
434
|
-
thinking?: boolean;
|
|
435
|
-
agentName?: string;
|
|
436
|
-
agentLabel?: string;
|
|
437
|
-
inputTokens?: number;
|
|
438
|
-
outputTokens?: number;
|
|
439
|
-
cost?: number;
|
|
440
|
-
externalCostUsd?: number;
|
|
441
|
-
responseMeta?: import("@genesislcap/foundation-ai").ChatResponseMeta;
|
|
442
|
-
model?: string;
|
|
443
|
-
providerName?: string;
|
|
444
|
-
kind: "message";
|
|
445
426
|
} | {
|
|
446
427
|
index: number;
|
|
447
428
|
timestamp: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/main/main.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EACV,6BAA6B,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 +94,22 @@ export declare function recordTurnError(key: string, reason: TurnFailureReason,
|
|
|
94
94
|
export declare function recordTurnRetry(key: string, reason: TurnFailureReason, detail?: Record<string, unknown>): void;
|
|
95
95
|
/** Returns the meta-event timeline for `key`, or an empty array if none recorded. */
|
|
96
96
|
export declare function getMetaEvents(key: string): ReadonlyArray<MetaEvent>;
|
|
97
|
+
/**
|
|
98
|
+
* Merge pre-built meta events into the timeline for `targetKey`, **preserving each
|
|
99
|
+
* event's original `timestamp`** (so it interleaves chronologically on export)
|
|
100
|
+
* while re-indexing onto the target buffer's monotonic counter. Used to fold a
|
|
101
|
+
* sub-agent's harvested events into the parent session — see
|
|
102
|
+
* `ChatDriver.invokeSubAgent`. Unlike {@link recordMetaEvent} it does not stamp a
|
|
103
|
+
* fresh timestamp; the same non-`high` eviction policy is applied once after the
|
|
104
|
+
* batch so the buffer stays bounded.
|
|
105
|
+
*/
|
|
106
|
+
export declare function mergeMetaEvents(targetKey: string, events: readonly MetaEvent[]): void;
|
|
107
|
+
/**
|
|
108
|
+
* Drop the entire timeline for `key`. Used to discard a sub-agent's transient
|
|
109
|
+
* per-invocation session once its events have been harvested into the parent, so
|
|
110
|
+
* the module registry doesn't accumulate one orphaned bucket per sub-agent run.
|
|
111
|
+
*/
|
|
112
|
+
export declare function clearSession(key: string): void;
|
|
97
113
|
/**
|
|
98
114
|
* Human/agent-facing guide emitted as the first key of the exported debug log,
|
|
99
115
|
* so whoever opens the JSON (often an AI agent) knows how to read it without
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug-event-log.d.ts","sourceRoot":"","sources":["../../../src/state/debug-event-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;GAGG;AACH,MAAM,MAAM,aAAa,GAErB,qBAAqB,GACrB,wBAAwB,GACxB,kBAAkB,GAClB,iBAAiB,GAEjB,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAEhB,eAAe,GACf,YAAY,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;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,iBAAiB,EACzB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,IAAI,CAEN;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,CAEnE;AAED;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"debug-event-log.d.ts","sourceRoot":"","sources":["../../../src/state/debug-event-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;GAGG;AACH,MAAM,MAAM,aAAa,GAErB,qBAAqB,GACrB,wBAAwB,GACxB,kBAAkB,GAClB,iBAAiB,GAEjB,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAEhB,eAAe,GACf,YAAY,GACZ,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,aAAa,GACb,iBAAiB,GACjB,kBAAkB,GAClB,oBAAoB,GACpB,iBAAiB,GAEjB,eAAe,GACf,cAAc,GACd,gBAAgB,GAChB,mBAAmB,GAEnB,uBAAuB,GACvB,sBAAsB,GAEtB,iBAAiB,GACjB,2BAA2B,GAE3B,eAAe,GACf,kBAAkB,GAClB,kBAAkB,GAClB,oBAAoB,CAAC;AAEzB;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE5D;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,aAAa,EAAE,mBAAmB,CAgC5E,CAAC;AAEF,4CAA4C;AAC5C,MAAM,WAAW,SAAS;IACxB,0FAA0F;IAC1F,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,IAAI,EAAE,a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"file":"debug-event-log.test.d.ts","sourceRoot":"","sources":["../../../src/state/debug-event-log.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ChatMessage } from '@genesislcap/foundation-ai';
|
|
2
|
+
/**
|
|
3
|
+
* A chat message lifted into the debug-log timeline as a `kind: 'message'` entry.
|
|
4
|
+
*
|
|
5
|
+
* @beta
|
|
6
|
+
*/
|
|
7
|
+
export type TimelineMessage = ChatMessage & {
|
|
8
|
+
kind: 'message';
|
|
9
|
+
/**
|
|
10
|
+
* Set only on entries hoisted out of a `subAgentTrace`: the sub-agent's own
|
|
11
|
+
* (un-breadcrumbed) `agentName`, kept for filtering since the displayed
|
|
12
|
+
* `agentName` is rewritten to a `"<parent> › <sub-agent>"` breadcrumb.
|
|
13
|
+
*/
|
|
14
|
+
subAgentName?: string;
|
|
15
|
+
/** Delegation depth — absent/0 for top-level, 1 for a sub-agent, 2 for a sub-agent's sub-agent, … */
|
|
16
|
+
subAgentDepth?: number;
|
|
17
|
+
/** Id of the parent tool call that spawned this run — correlates a hoisted message back to its delegation. */
|
|
18
|
+
subAgentOf?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Flatten sub-agent conversations into a single top-level message stream for the
|
|
22
|
+
* debug-log timeline.
|
|
23
|
+
*
|
|
24
|
+
* A tool call that delegates to a sub-agent carries the sub-agent's entire
|
|
25
|
+
* conversation on `toolCall.subAgentTrace`. The live UI reads that nested shape,
|
|
26
|
+
* but a top-to-bottom timeline reads far better with those messages inline next to
|
|
27
|
+
* the turn that produced them. This walks the list and, for every tool call with a
|
|
28
|
+
* `subAgentTrace`, hoists the sub-agent's messages up as their own timeline
|
|
29
|
+
* entries while **removing** the nested copy from the emitted parent tool call — a
|
|
30
|
+
* move, not a copy. The data is relocated, never duplicated: the export stays the
|
|
31
|
+
* same size and a naive `sum(timeline[].cost)` does not double-count (the
|
|
32
|
+
* canonical `sumCosts` total still reads the un-flattened history).
|
|
33
|
+
*
|
|
34
|
+
* Hoisted entries are:
|
|
35
|
+
* - **breadcrumbed**: `agentName` becomes `"<parent> › <sub-agent>"`, composing for
|
|
36
|
+
* nested sub-agents (`"<parent> › <sub> › <subsub>"`); the raw sub-agent name is
|
|
37
|
+
* preserved on `subAgentName`.
|
|
38
|
+
* - **depth-tagged** (`subAgentDepth`) and **correlated** to the spawning tool call
|
|
39
|
+
* (`subAgentOf`), so the delegation tree is reconstructable even when two
|
|
40
|
+
* sub-agents run within the same parent turn.
|
|
41
|
+
*
|
|
42
|
+
* Top-level messages (depth 0) are emitted unchanged apart from the trace strip.
|
|
43
|
+
* Order is preserved within each list; the caller sorts the whole timeline by
|
|
44
|
+
* timestamp afterwards, and every sub-agent message carries its own timestamp, so
|
|
45
|
+
* hoisted entries interleave chronologically between the parent's tool-call and
|
|
46
|
+
* tool-result messages.
|
|
47
|
+
*
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
export declare function flattenSubAgentMessages(messages: readonly ChatMessage[], prefix?: string, depth?: number, subAgentOf?: string): TimelineMessage[];
|
|
51
|
+
//# sourceMappingURL=flatten-sub-agent-messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flatten-sub-agent-messages.d.ts","sourceRoot":"","sources":["../../../src/utils/flatten-sub-agent-messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG;IAC1C,IAAI,EAAE,SAAS,CAAC;IAChB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qGAAqG;IACrG,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,8GAA8G;IAC9G,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,SAAS,WAAW,EAAE,EAChC,MAAM,SAAK,EACX,KAAK,SAAI,EACT,UAAU,CAAC,EAAE,MAAM,GAClB,eAAe,EAAE,CA+BnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flatten-sub-agent-messages.test.d.ts","sourceRoot":"","sources":["../../../src/utils/flatten-sub-agent-messages.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AgentConfig } from '../config/config';
|
|
2
|
+
/**
|
|
3
|
+
* Project an `AgentConfig` down to a JSON-serializable shape for the redux
|
|
4
|
+
* session store. Drops two kinds of field:
|
|
5
|
+
*
|
|
6
|
+
* 1. **Directly function-valued** — the lifecycle/dispatch hooks (`onActivate`,
|
|
7
|
+
* `onDeactivate`, `getDebugSnapshot`, `onUnresolvedTool`) and the function
|
|
8
|
+
* form of the per-turn resolvers (`systemPrompt`, `toolDefinitions`,
|
|
9
|
+
* `displayName`, `provider`, `temperature`, `toolChoice`, `toolHandlers`).
|
|
10
|
+
* 2. **Object "handler bags" whose *values* are functions** — `toolHandlers` in
|
|
11
|
+
* its object form is `{ name: handler }`, so `typeof` is `'object'`, not
|
|
12
|
+
* `'function'`. A by-value check on the field alone misses it, leaking a live
|
|
13
|
+
* handler into store state and tripping redux's serializability check (the
|
|
14
|
+
* regression this guards against — top-level agents tend to use the factory
|
|
15
|
+
* function form, but sub-agents commonly declare an object literal).
|
|
16
|
+
*
|
|
17
|
+
* `subAgents` are projected recursively. Static forms (string / number / array /
|
|
18
|
+
* plain data object) pass through unchanged.
|
|
19
|
+
*
|
|
20
|
+
* Filtering by value rather than an explicit field list means a new
|
|
21
|
+
* function-valued field on `AgentConfig` is handled automatically — no denylist
|
|
22
|
+
* to maintain. The live config on the driver stays the source of truth; the
|
|
23
|
+
* slice only holds this serializable projection and functions are never read
|
|
24
|
+
* back from it.
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export declare function stripAgentHandlers(agent: AgentConfig): Omit<AgentConfig, 'toolHandlers'>;
|
|
29
|
+
//# sourceMappingURL=strip-agent-handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strip-agent-handlers.d.ts","sourceRoot":"","sources":["../../../src/utils/strip-agent-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAuBxF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strip-agent-handlers.test.d.ts","sourceRoot":"","sources":["../../../src/utils/strip-agent-handlers.test.ts"],"names":[],"mappings":""}
|
|
@@ -2,7 +2,7 @@ import { __awaiter } from "tslib";
|
|
|
2
2
|
import { isObservableAIProviderRegistry, MalformedFunctionCallError, } from '@genesislcap/foundation-ai';
|
|
3
3
|
import { agenticActivityBus } from '../../channel/ai-activity-bus';
|
|
4
4
|
import { resolveChatProvider } from '../../config/validate-providers';
|
|
5
|
-
import { recordMetaEvent, recordTurnError, recordTurnRetry } from '../../state/debug-event-log';
|
|
5
|
+
import { clearSession, getMetaEvents, mergeMetaEvents, recordMetaEvent, recordTurnError, recordTurnRetry, } from '../../state/debug-event-log';
|
|
6
6
|
import { applyHistoryCap } from '../../utils/history-transform';
|
|
7
7
|
import { logger } from '../../utils/logger';
|
|
8
8
|
import { TOOL_FOLD_SYMBOL } from '../../utils/tool-fold';
|
|
@@ -32,6 +32,22 @@ const MAX_EMPTY_RESPONSE_RETRIES = 3;
|
|
|
32
32
|
// SAME iteration up to this many times before propagating, rather than tearing down the turn.
|
|
33
33
|
const MAX_SETUP_TRANSPORT_RETRIES = 3;
|
|
34
34
|
const SUGGESTIONS_HISTORY_WINDOW = 8;
|
|
35
|
+
/**
|
|
36
|
+
* Sub-agent meta events worth folding into the parent's debug timeline: the
|
|
37
|
+
* per-attempt and per-failure signals that do NOT otherwise surface in the
|
|
38
|
+
* sub-agent's (now hoisted) messages — a retried-away malformed/empty attempt
|
|
39
|
+
* produces no message, and the stale-vs-hallucinated/streak diagnostics live only
|
|
40
|
+
* on the event. High-volume, message-derivable events (turn.start/turn.end,
|
|
41
|
+
* provider.selected, context.updated) are intentionally excluded: read the
|
|
42
|
+
* sub-agent's hoisted messages for model/tokens/cost and turn-by-turn activity.
|
|
43
|
+
* See `ChatDriver.invokeSubAgent`.
|
|
44
|
+
*/
|
|
45
|
+
const HARVESTED_SUBAGENT_EVENTS = new Set([
|
|
46
|
+
'turn.retry',
|
|
47
|
+
'turn.error',
|
|
48
|
+
'tool.failed',
|
|
49
|
+
'tool.unresolved',
|
|
50
|
+
]);
|
|
35
51
|
/** Name reserved for the cross-agent handoff tool — injected by OrchestratingDriver. */
|
|
36
52
|
export const REQUEST_CONTINUATION_TOOL = 'request_continuation';
|
|
37
53
|
/** Paired in history for each `request_continuation` so tool_calls stay balanced for the provider. */
|
|
@@ -937,7 +953,7 @@ export class ChatDriver extends EventTarget {
|
|
|
937
953
|
*/
|
|
938
954
|
invokeSubAgent(name, options) {
|
|
939
955
|
return __awaiter(this, void 0, void 0, function* () {
|
|
940
|
-
var _a, _b, _c, _d;
|
|
956
|
+
var _a, _b, _c, _d, _e;
|
|
941
957
|
const subConfig = this.subAgentsMap.get(name);
|
|
942
958
|
if (!subConfig) {
|
|
943
959
|
const available = [...this.subAgentsMap.keys()].join(', ') || '(none)';
|
|
@@ -960,7 +976,13 @@ export class ChatDriver extends EventTarget {
|
|
|
960
976
|
...contextMessages,
|
|
961
977
|
...((_b = subConfig.primerHistory) !== null && _b !== void 0 ? _b : []),
|
|
962
978
|
];
|
|
963
|
-
|
|
979
|
+
// Unique per-invocation id — reused for the lifecycle event bracket below —
|
|
980
|
+
// and a child session key derived from it. The child files its meta events
|
|
981
|
+
// under this own bucket (rather than the shared empty-key sink), so they can
|
|
982
|
+
// be harvested into THIS session on completion and then discarded.
|
|
983
|
+
const invocationId = crypto.randomUUID();
|
|
984
|
+
const childSessionKey = `${this.sessionKey}::sub:${invocationId}`;
|
|
985
|
+
const child = new ChatDriver(this.providerRegistry, {}, [], undefined, undefined, undefined, undefined, undefined, childSessionKey);
|
|
964
986
|
// Mark before the first turn so the child forces tool use and reports a
|
|
965
987
|
// typed failure (rather than user-facing text) if it never completes.
|
|
966
988
|
child.markAsSubAgent();
|
|
@@ -994,9 +1016,6 @@ export class ChatDriver extends EventTarget {
|
|
|
994
1016
|
};
|
|
995
1017
|
child.addEventListener('history-updated', forwardTrace);
|
|
996
1018
|
child.addEventListener('provider-changed', forwardProviderChanged);
|
|
997
|
-
// Unique per-invocation id so listeners can pair start/stop reliably even
|
|
998
|
-
// when the same sub-agent runs multiple times in parallel.
|
|
999
|
-
const invocationId = crypto.randomUUID();
|
|
1000
1019
|
const chatInputDuringExecution = options === null || options === void 0 ? void 0 : options.chatInputDuringExecution;
|
|
1001
1020
|
const lifecycleDetail = { name, invocationId, chatInputDuringExecution };
|
|
1002
1021
|
this.dispatchEvent(new CustomEvent('sub-agent-start', { detail: lifecycleDetail }));
|
|
@@ -1056,13 +1075,30 @@ export class ChatDriver extends EventTarget {
|
|
|
1056
1075
|
// settled) lifecycle, so the snapshot/completion reads below still work.
|
|
1057
1076
|
child.dispose();
|
|
1058
1077
|
this.dispatchEvent(new CustomEvent('sub-agent-stop', { detail: lifecycleDetail }));
|
|
1078
|
+
// Capture the child's diagnostics into THIS session, then ALWAYS discard its
|
|
1079
|
+
// transient bucket — done in the `finally` so an unexpected `sendMessage`
|
|
1080
|
+
// rejection (which propagates out of this method) can't orphan the bucket in
|
|
1081
|
+
// the registry, and a crashed sub-agent still leaves its turns/events behind.
|
|
1082
|
+
// Forward the child's per-LLM-call snapshots so they show as `kind:'turn'`
|
|
1083
|
+
// entries in the exported debug log, re-numbered under the activating parent turn.
|
|
1084
|
+
this.forwardSubAgentSnapshots(child.getTurnSnapshots());
|
|
1085
|
+
// Fold the sub-agent's high-value meta events (retries/errors/tool failures —
|
|
1086
|
+
// see HARVESTED_SUBAGENT_EVENTS) into THIS session, preserving their original
|
|
1087
|
+
// timestamps so they interleave within the subagent.started→completed/failed
|
|
1088
|
+
// bracket. Each is breadcrumbed `"<parent> › <sub-agent>"`, composing for a
|
|
1089
|
+
// nested sub-agent whose own breadcrumb the child already merged.
|
|
1090
|
+
const parentName = (_c = this.activeAgentName) !== null && _c !== void 0 ? _c : '?';
|
|
1091
|
+
const harvested = getMetaEvents(childSessionKey)
|
|
1092
|
+
.filter((e) => HARVESTED_SUBAGENT_EVENTS.has(e.type))
|
|
1093
|
+
.map((e) => {
|
|
1094
|
+
var _a;
|
|
1095
|
+
const existing = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.subAgent;
|
|
1096
|
+
return Object.assign(Object.assign({}, e), { detail: Object.assign(Object.assign({}, e.detail), { subAgent: `${parentName} › ${existing !== null && existing !== void 0 ? existing : name}` }) });
|
|
1097
|
+
});
|
|
1098
|
+
mergeMetaEvents(this.sessionKey, harvested);
|
|
1099
|
+
clearSession(childSessionKey);
|
|
1059
1100
|
}
|
|
1060
1101
|
const trace = child.getHistory();
|
|
1061
|
-
// Forward the child's per-LLM-call snapshots onto this (parent) driver's
|
|
1062
|
-
// buffer so they show as `kind:'turn'` entries in the exported debug log,
|
|
1063
|
-
// re-numbered under the activating parent turn. Runs for both success and
|
|
1064
|
-
// failure so the sub-agent's turns are always visible.
|
|
1065
|
-
this.forwardSubAgentSnapshots(child.getTurnSnapshots());
|
|
1066
1102
|
if (timedOut) {
|
|
1067
1103
|
// Same failure shape as any other non-completion — the parent handler
|
|
1068
1104
|
// recovers on its existing `{ ok: false }` branch. Recorded under THIS
|
|
@@ -1081,7 +1117,7 @@ export class ChatDriver extends EventTarget {
|
|
|
1081
1117
|
// provider ignored forced tool use and returned text). The previous
|
|
1082
1118
|
// final-text fallback is intentionally gone — sub-agents return a
|
|
1083
1119
|
// structured outcome only, and the parent handler decides how to recover.
|
|
1084
|
-
const reason = (
|
|
1120
|
+
const reason = (_e = (_d = child.getSubAgentFailure()) === null || _d === void 0 ? void 0 : _d.reason) !== null && _e !== void 0 ? _e : 'max_iterations';
|
|
1085
1121
|
// Record under THIS (parent) driver's session so the failure lands on the
|
|
1086
1122
|
// user-visible debug-log timeline — the child ran under its own session key.
|
|
1087
1123
|
// This is also the only telemetry for the defensive default above, where the
|
|
@@ -581,6 +581,35 @@ subagent('resolves { ok: false, reason } and records telemetry when the sub-agen
|
|
|
581
581
|
}), 'a subagent.failed meta event should be recorded under the parent session');
|
|
582
582
|
assert.not.ok(getMetaEvents('').some((e) => e.type === 'subagent.failed'), 'the failure must not be orphaned in the child default session bucket');
|
|
583
583
|
}));
|
|
584
|
+
subagent("folds the sub-agent's high-value meta events into the parent session, breadcrumbed", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
585
|
+
var _a;
|
|
586
|
+
const sessionKey = 'subagent-meta-harvest-test';
|
|
587
|
+
clearMetaEventRegistry();
|
|
588
|
+
const worker = agent({
|
|
589
|
+
name: 'worker',
|
|
590
|
+
toolDefinitions: [def('real')],
|
|
591
|
+
toolHandlers: { real: () => __awaiter(void 0, void 0, void 0, function* () { return 'ok'; }) },
|
|
592
|
+
});
|
|
593
|
+
const parent = delegatingParent(worker, () => { });
|
|
594
|
+
// The worker trips the unknown-tool limit — emitting tool.unresolved + a
|
|
595
|
+
// turn.error under its own transient session, which the parent harvests.
|
|
596
|
+
const provider = scriptedProvider([
|
|
597
|
+
callsTool('delegate', 'd1'),
|
|
598
|
+
...Array.from({ length: 5 }, (_unused, i) => callsTool('made_up', `u${i}`)),
|
|
599
|
+
]);
|
|
600
|
+
yield makeDriver(parent, provider, sessionKey).sendMessage('go');
|
|
601
|
+
const events = getMetaEvents(sessionKey);
|
|
602
|
+
// The sub-agent's turn.error is folded onto the parent timeline, breadcrumbed.
|
|
603
|
+
const harvestedError = events.find((e) => { var _a; return e.type === 'turn.error' && ((_a = e.detail) === null || _a === void 0 ? void 0 : _a.subAgent) === 'boss › worker'; });
|
|
604
|
+
assert.ok(harvestedError, "the sub-agent's turn.error is folded in, breadcrumbed");
|
|
605
|
+
assert.is((_a = harvestedError.detail) === null || _a === void 0 ? void 0 : _a.reason, 'unknown-tool-limit');
|
|
606
|
+
// ... as are its per-attempt tool.unresolved signals.
|
|
607
|
+
assert.ok(events.some((e) => { var _a; return e.type === 'tool.unresolved' && ((_a = e.detail) === null || _a === void 0 ? void 0 : _a.subAgent) === 'boss › worker'; }), "the sub-agent's tool.unresolved events are folded in too");
|
|
608
|
+
// High-volume, message-derivable events are NOT merged.
|
|
609
|
+
assert.not.ok(events.some((e) => { var _a; return e.type === 'turn.start' && ((_a = e.detail) === null || _a === void 0 ? void 0 : _a.subAgent) === 'boss › worker'; }), 'turn.start is intentionally excluded from the harvest');
|
|
610
|
+
// The child's transient bucket is cleared, never polluting the empty-key sink.
|
|
611
|
+
assert.is(getMetaEvents('').length, 0);
|
|
612
|
+
}));
|
|
584
613
|
subagent('defaults to { ok: false, reason: "max_iterations" } when the sub-agent ends without completing', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
585
614
|
const sessionKey = 'subagent-default-fail-test';
|
|
586
615
|
clearMetaEventRegistry();
|