@genesislcap/ai-assistant 14.496.1-GENC-1461.5 → 14.496.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/ai-assistant.api.json +0 -132
- package/dist/ai-assistant.d.ts +0 -35
- package/dist/chat-driver.cjs +0 -153
- package/dist/chat-driver.cjs.map +3 -3
- package/dist/chat-driver.mjs +0 -147
- package/dist/chat-driver.mjs.map +3 -3
- package/dist/custom-elements.json +13 -168
- package/dist/dts/chat-driver-node.d.ts +1 -7
- package/dist/dts/chat-driver-node.d.ts.map +1 -1
- package/dist/dts/components/ai-driver/ai-driver.d.ts +0 -8
- package/dist/dts/components/ai-driver/ai-driver.d.ts.map +1 -1
- package/dist/dts/components/chat-driver/chat-driver.d.ts +0 -27
- package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts +0 -3
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts.map +1 -1
- package/dist/dts/main/main.d.ts.map +1 -1
- package/dist/dts/state/debug-event-log.d.ts +1 -1
- package/dist/dts/state/debug-event-log.d.ts.map +1 -1
- package/dist/esm/chat-driver-node.js +1 -16
- package/dist/esm/components/chat-driver/chat-driver.js +0 -89
- package/dist/esm/components/chat-driver/chat-driver.test.js +0 -130
- package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +0 -4
- package/dist/esm/main/main.js +28 -18
- package/dist/esm/state/debug-event-log.js +0 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -17
- package/src/chat-driver-node.ts +0 -20
- package/src/components/ai-driver/ai-driver.ts +0 -9
- package/src/components/chat-driver/chat-driver.test.ts +0 -170
- package/src/components/chat-driver/chat-driver.ts +0 -93
- package/src/components/orchestrating-driver/orchestrating-driver.ts +0 -6
- package/src/main/main.ts +30 -17
- package/src/state/debug-event-log.ts +0 -3
- package/dist/dts/state/persistence/build-timeline-entries.d.ts +0 -37
- package/dist/dts/state/persistence/build-timeline-entries.d.ts.map +0 -1
- package/dist/esm/state/persistence/build-timeline-entries.js +0 -46
- package/src/state/persistence/build-timeline-entries.ts +0 -66
|
@@ -2780,48 +2780,6 @@
|
|
|
2780
2780
|
"parameters": [],
|
|
2781
2781
|
"name": "getActiveProviderName"
|
|
2782
2782
|
},
|
|
2783
|
-
{
|
|
2784
|
-
"kind": "MethodSignature",
|
|
2785
|
-
"canonicalReference": "@genesislcap/ai-assistant!AiDriver#getExternalDiagnostics:member(1)",
|
|
2786
|
-
"docComment": "/**\n * Diagnostic-log entries harvested from resolved interactions (e.g. a server-side ChatDriver's collated debug log, returned on `InteractionResult.diagnostics`). The host folds these into its debug log. Optional for the same leaf/orchestrator reason as `getTurnSnapshots`. (GENC-1461 unified diagnostics.)\n */\n",
|
|
2787
|
-
"excerptTokens": [
|
|
2788
|
-
{
|
|
2789
|
-
"kind": "Content",
|
|
2790
|
-
"text": "getExternalDiagnostics?(): "
|
|
2791
|
-
},
|
|
2792
|
-
{
|
|
2793
|
-
"kind": "Reference",
|
|
2794
|
-
"text": "ReadonlyArray",
|
|
2795
|
-
"canonicalReference": "!ReadonlyArray:interface"
|
|
2796
|
-
},
|
|
2797
|
-
{
|
|
2798
|
-
"kind": "Content",
|
|
2799
|
-
"text": "<"
|
|
2800
|
-
},
|
|
2801
|
-
{
|
|
2802
|
-
"kind": "Reference",
|
|
2803
|
-
"text": "DiagnosticEntry",
|
|
2804
|
-
"canonicalReference": "@genesislcap/ai-assistant!DiagnosticEntry:interface"
|
|
2805
|
-
},
|
|
2806
|
-
{
|
|
2807
|
-
"kind": "Content",
|
|
2808
|
-
"text": ">"
|
|
2809
|
-
},
|
|
2810
|
-
{
|
|
2811
|
-
"kind": "Content",
|
|
2812
|
-
"text": ";"
|
|
2813
|
-
}
|
|
2814
|
-
],
|
|
2815
|
-
"isOptional": true,
|
|
2816
|
-
"returnTypeTokenRange": {
|
|
2817
|
-
"startIndex": 1,
|
|
2818
|
-
"endIndex": 5
|
|
2819
|
-
},
|
|
2820
|
-
"releaseTag": "Beta",
|
|
2821
|
-
"overloadIndex": 1,
|
|
2822
|
-
"parameters": [],
|
|
2823
|
-
"name": "getExternalDiagnostics"
|
|
2824
|
-
},
|
|
2825
2783
|
{
|
|
2826
2784
|
"kind": "MethodSignature",
|
|
2827
2785
|
"canonicalReference": "@genesislcap/ai-assistant!AiDriver#getInteractionContext:member(1)",
|
|
@@ -4607,51 +4565,6 @@
|
|
|
4607
4565
|
"isAbstract": false,
|
|
4608
4566
|
"name": "getAgentReleaseRequested"
|
|
4609
4567
|
},
|
|
4610
|
-
{
|
|
4611
|
-
"kind": "Method",
|
|
4612
|
-
"canonicalReference": "@genesislcap/ai-assistant!ChatDriver#getExternalDiagnostics:member(1)",
|
|
4613
|
-
"docComment": "/**\n * The `turn` + `message` diagnostic-log entries harvested from resolved interactions' `InteractionResult.diagnostics` (e.g. a server-side ChatDriver's collated debug log). The host concatenates these into its own debug log so `downloadDebugLog`/the persisted diagnostics stream include external-engine logs; `event` entries are excluded here because they're merged into the session's meta-event registry instead (see `resolveInteraction`) and reach the log via `getMetaEvents`. Opaque, chronologically sorted by the host at assemble time. (GENC-1461.)\n */\n",
|
|
4614
|
-
"excerptTokens": [
|
|
4615
|
-
{
|
|
4616
|
-
"kind": "Content",
|
|
4617
|
-
"text": "getExternalDiagnostics(): "
|
|
4618
|
-
},
|
|
4619
|
-
{
|
|
4620
|
-
"kind": "Reference",
|
|
4621
|
-
"text": "ReadonlyArray",
|
|
4622
|
-
"canonicalReference": "!ReadonlyArray:interface"
|
|
4623
|
-
},
|
|
4624
|
-
{
|
|
4625
|
-
"kind": "Content",
|
|
4626
|
-
"text": "<"
|
|
4627
|
-
},
|
|
4628
|
-
{
|
|
4629
|
-
"kind": "Reference",
|
|
4630
|
-
"text": "DiagnosticEntry",
|
|
4631
|
-
"canonicalReference": "@genesislcap/ai-assistant!DiagnosticEntry:interface"
|
|
4632
|
-
},
|
|
4633
|
-
{
|
|
4634
|
-
"kind": "Content",
|
|
4635
|
-
"text": ">"
|
|
4636
|
-
},
|
|
4637
|
-
{
|
|
4638
|
-
"kind": "Content",
|
|
4639
|
-
"text": ";"
|
|
4640
|
-
}
|
|
4641
|
-
],
|
|
4642
|
-
"isStatic": false,
|
|
4643
|
-
"returnTypeTokenRange": {
|
|
4644
|
-
"startIndex": 1,
|
|
4645
|
-
"endIndex": 5
|
|
4646
|
-
},
|
|
4647
|
-
"releaseTag": "Beta",
|
|
4648
|
-
"isProtected": false,
|
|
4649
|
-
"overloadIndex": 1,
|
|
4650
|
-
"parameters": [],
|
|
4651
|
-
"isOptional": false,
|
|
4652
|
-
"isAbstract": false,
|
|
4653
|
-
"name": "getExternalDiagnostics"
|
|
4654
|
-
},
|
|
4655
4568
|
{
|
|
4656
4569
|
"kind": "Method",
|
|
4657
4570
|
"canonicalReference": "@genesislcap/ai-assistant!ChatDriver#getHistory:member(1)",
|
|
@@ -13369,51 +13282,6 @@
|
|
|
13369
13282
|
"isAbstract": false,
|
|
13370
13283
|
"name": "getActiveProviderName"
|
|
13371
13284
|
},
|
|
13372
|
-
{
|
|
13373
|
-
"kind": "Method",
|
|
13374
|
-
"canonicalReference": "@genesislcap/ai-assistant!OrchestratingDriver#getExternalDiagnostics:member(1)",
|
|
13375
|
-
"docComment": "/**\n * Delegates to the inner {@link ChatDriver} — interactions resolve there, so it holds the buffer.\n */\n",
|
|
13376
|
-
"excerptTokens": [
|
|
13377
|
-
{
|
|
13378
|
-
"kind": "Content",
|
|
13379
|
-
"text": "getExternalDiagnostics(): "
|
|
13380
|
-
},
|
|
13381
|
-
{
|
|
13382
|
-
"kind": "Reference",
|
|
13383
|
-
"text": "ReadonlyArray",
|
|
13384
|
-
"canonicalReference": "!ReadonlyArray:interface"
|
|
13385
|
-
},
|
|
13386
|
-
{
|
|
13387
|
-
"kind": "Content",
|
|
13388
|
-
"text": "<"
|
|
13389
|
-
},
|
|
13390
|
-
{
|
|
13391
|
-
"kind": "Reference",
|
|
13392
|
-
"text": "DiagnosticEntry",
|
|
13393
|
-
"canonicalReference": "@genesislcap/ai-assistant!DiagnosticEntry:interface"
|
|
13394
|
-
},
|
|
13395
|
-
{
|
|
13396
|
-
"kind": "Content",
|
|
13397
|
-
"text": ">"
|
|
13398
|
-
},
|
|
13399
|
-
{
|
|
13400
|
-
"kind": "Content",
|
|
13401
|
-
"text": ";"
|
|
13402
|
-
}
|
|
13403
|
-
],
|
|
13404
|
-
"isStatic": false,
|
|
13405
|
-
"returnTypeTokenRange": {
|
|
13406
|
-
"startIndex": 1,
|
|
13407
|
-
"endIndex": 5
|
|
13408
|
-
},
|
|
13409
|
-
"releaseTag": "Beta",
|
|
13410
|
-
"isProtected": false,
|
|
13411
|
-
"overloadIndex": 1,
|
|
13412
|
-
"parameters": [],
|
|
13413
|
-
"isOptional": false,
|
|
13414
|
-
"isAbstract": false,
|
|
13415
|
-
"name": "getExternalDiagnostics"
|
|
13416
|
-
},
|
|
13417
13285
|
{
|
|
13418
13286
|
"kind": "Method",
|
|
13419
13287
|
"canonicalReference": "@genesislcap/ai-assistant!OrchestratingDriver#getInteractionContext:member(1)",
|
package/dist/ai-assistant.d.ts
CHANGED
|
@@ -604,13 +604,6 @@ export declare interface AiDriver extends EventTarget {
|
|
|
604
604
|
* orchestrator just delegates to its inner `ChatDriver`.
|
|
605
605
|
*/
|
|
606
606
|
getTurnSnapshots?(): ReadonlyArray<TurnSnapshot>;
|
|
607
|
-
/**
|
|
608
|
-
* Diagnostic-log entries harvested from resolved interactions (e.g. a server-side ChatDriver's
|
|
609
|
-
* collated debug log, returned on `InteractionResult.diagnostics`). The host folds these into its
|
|
610
|
-
* debug log. Optional for the same leaf/orchestrator reason as `getTurnSnapshots`.
|
|
611
|
-
* (GENC-1461 unified diagnostics.)
|
|
612
|
-
*/
|
|
613
|
-
getExternalDiagnostics?(): ReadonlyArray<DiagnosticEntry>;
|
|
614
607
|
/**
|
|
615
608
|
* Name of the AI provider used on the most recent turn. Falls back to the
|
|
616
609
|
* registry's default name when no turn has run yet.
|
|
@@ -1197,23 +1190,6 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
1197
1190
|
* arrive. See {@link TurnSnapshot} for the captured shape.
|
|
1198
1191
|
*/
|
|
1199
1192
|
private turnSnapshots;
|
|
1200
|
-
/**
|
|
1201
|
-
* `turn` + `message` diagnostic-log entries harvested from an out-of-band source (a resolved
|
|
1202
|
-
* interaction whose widget returned `InteractionResult.diagnostics` — e.g. a server-side
|
|
1203
|
-
* ChatDriver's debug log). `event` entries are NOT kept here — they're folded into the session's
|
|
1204
|
-
* meta-event registry via `mergeMetaEvents` (see `resolveInteraction`) so they inherit fresh host
|
|
1205
|
-
* indices, and reach the log through `getMetaEvents`. Append-only; the host folds these into its
|
|
1206
|
-
* debug log alongside this driver's own timeline. Not cleared here — it lives with the driver
|
|
1207
|
-
* instance, like `turnSnapshots`, so a new chat (fresh driver) starts empty while a compaction
|
|
1208
|
-
* (same instance) keeps it. (GENC-1461.)
|
|
1209
|
-
*/
|
|
1210
|
-
private readonly externalDiagnostics;
|
|
1211
|
-
/**
|
|
1212
|
-
* Monotonic count of external-diagnostics batches harvested this driver-lifetime. Namespaces each
|
|
1213
|
-
* batch's re-keyed `turn` entries so distinct server generations in one chat session can't collide
|
|
1214
|
-
* on `turnIndex` in the forward-capture persister (which dedups turns by that key). (GENC-1461.)
|
|
1215
|
-
*/
|
|
1216
|
-
private externalDiagnosticsBatches;
|
|
1217
1193
|
/** Monotonic counter that survives agent swaps — useful for cross-referencing with history. */
|
|
1218
1194
|
private globalTurnIndex;
|
|
1219
1195
|
/** Captured from `applyAgent` so we don't store the whole `AgentConfig`. */
|
|
@@ -1468,15 +1444,6 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
1468
1444
|
* Ring-buffered at `MAX_TURN_SNAPSHOTS`; older entries are dropped.
|
|
1469
1445
|
*/
|
|
1470
1446
|
getTurnSnapshots(): ReadonlyArray<TurnSnapshot>;
|
|
1471
|
-
/**
|
|
1472
|
-
* The `turn` + `message` diagnostic-log entries harvested from resolved interactions'
|
|
1473
|
-
* `InteractionResult.diagnostics` (e.g. a server-side ChatDriver's collated debug log). The host
|
|
1474
|
-
* concatenates these into its own debug log so `downloadDebugLog`/the persisted diagnostics stream
|
|
1475
|
-
* include external-engine logs; `event` entries are excluded here because they're merged into the
|
|
1476
|
-
* session's meta-event registry instead (see `resolveInteraction`) and reach the log via
|
|
1477
|
-
* `getMetaEvents`. Opaque, chronologically sorted by the host at assemble time. (GENC-1461.)
|
|
1478
|
-
*/
|
|
1479
|
-
getExternalDiagnostics(): ReadonlyArray<DiagnosticEntry>;
|
|
1480
1447
|
/**
|
|
1481
1448
|
* Merge a sub-agent's turn snapshots into this driver's buffer so they surface
|
|
1482
1449
|
* as `kind:'turn'` entries in the exported debug log. The child runs as a
|
|
@@ -3112,8 +3079,6 @@ export declare class OrchestratingDriver extends EventTarget implements AiDriver
|
|
|
3112
3079
|
canCompact(): boolean;
|
|
3113
3080
|
/** Delegates to the inner {@link ChatDriver} — turns are captured there. */
|
|
3114
3081
|
getTurnSnapshots(): ReadonlyArray<TurnSnapshot>;
|
|
3115
|
-
/** Delegates to the inner {@link ChatDriver} — interactions resolve there, so it holds the buffer. */
|
|
3116
|
-
getExternalDiagnostics(): ReadonlyArray<DiagnosticEntry>;
|
|
3117
3082
|
getSuggestions(history: ChatMessage[], prompt: string, count: number, allAgentInfo?: AllAgentSummary[]): Promise<string[]>;
|
|
3118
3083
|
sendMessage(input: string, attachments?: ChatAttachment[]): Promise<ChatDriverResult>;
|
|
3119
3084
|
continueFromHistory(transientPrimer?: ChatMessage[]): Promise<ChatDriverResult>;
|
package/dist/chat-driver.cjs
CHANGED
|
@@ -29,16 +29,10 @@ __export(chat_driver_node_exports, {
|
|
|
29
29
|
NOOP_ACTIVITY_BUS: () => NOOP_ACTIVITY_BUS,
|
|
30
30
|
OrchestratingDriver: () => OrchestratingDriver,
|
|
31
31
|
REQUEST_CONTINUATION_TOOL: () => REQUEST_CONTINUATION_TOOL,
|
|
32
|
-
SUPPORTED_ANTHROPIC_MODEL_IDS: () => SUPPORTED_ANTHROPIC_MODEL_IDS,
|
|
33
|
-
SUPPORTED_GEMINI_MODEL_IDS: () => SUPPORTED_GEMINI_MODEL_IDS,
|
|
34
32
|
agenticActivityBus: () => agenticActivityBus,
|
|
35
|
-
assembleDebugLog: () => assembleDebugLog,
|
|
36
|
-
buildTimelineEntries: () => buildTimelineEntries,
|
|
37
|
-
clearSession: () => clearSession,
|
|
38
33
|
defineAgent: () => defineAgent,
|
|
39
34
|
defineStatefulAgent: () => defineStatefulAgent,
|
|
40
35
|
friendlyFallbackAgent: () => friendlyFallbackAgent,
|
|
41
|
-
getMetaEvents: () => getMetaEvents,
|
|
42
36
|
isObservableAIProviderRegistry: () => isObservableAIProviderRegistry,
|
|
43
37
|
restoreMachine: () => restoreMachine,
|
|
44
38
|
strictFallbackAgent: () => strictFallbackAgent
|
|
@@ -2636,7 +2630,6 @@ var META_EVENT_IMPORTANCE = {
|
|
|
2636
2630
|
"provider.selected": "normal",
|
|
2637
2631
|
"interaction.requested": "normal",
|
|
2638
2632
|
"interaction.resolved": "normal",
|
|
2639
|
-
"external-diagnostics.folded": "normal",
|
|
2640
2633
|
"session.cleared": "normal",
|
|
2641
2634
|
"session.switched": "low",
|
|
2642
2635
|
"session.switch-deferred": "low",
|
|
@@ -3133,23 +3126,6 @@ var ChatDriver = class _ChatDriver extends EventTarget {
|
|
|
3133
3126
|
* arrive. See {@link TurnSnapshot} for the captured shape.
|
|
3134
3127
|
*/
|
|
3135
3128
|
this.turnSnapshots = [];
|
|
3136
|
-
/**
|
|
3137
|
-
* `turn` + `message` diagnostic-log entries harvested from an out-of-band source (a resolved
|
|
3138
|
-
* interaction whose widget returned `InteractionResult.diagnostics` — e.g. a server-side
|
|
3139
|
-
* ChatDriver's debug log). `event` entries are NOT kept here — they're folded into the session's
|
|
3140
|
-
* meta-event registry via `mergeMetaEvents` (see `resolveInteraction`) so they inherit fresh host
|
|
3141
|
-
* indices, and reach the log through `getMetaEvents`. Append-only; the host folds these into its
|
|
3142
|
-
* debug log alongside this driver's own timeline. Not cleared here — it lives with the driver
|
|
3143
|
-
* instance, like `turnSnapshots`, so a new chat (fresh driver) starts empty while a compaction
|
|
3144
|
-
* (same instance) keeps it. (GENC-1461.)
|
|
3145
|
-
*/
|
|
3146
|
-
this.externalDiagnostics = [];
|
|
3147
|
-
/**
|
|
3148
|
-
* Monotonic count of external-diagnostics batches harvested this driver-lifetime. Namespaces each
|
|
3149
|
-
* batch's re-keyed `turn` entries so distinct server generations in one chat session can't collide
|
|
3150
|
-
* on `turnIndex` in the forward-capture persister (which dedups turns by that key). (GENC-1461.)
|
|
3151
|
-
*/
|
|
3152
|
-
this.externalDiagnosticsBatches = 0;
|
|
3153
3129
|
/** Monotonic counter that survives agent swaps — useful for cross-referencing with history. */
|
|
3154
3130
|
this.globalTurnIndex = 0;
|
|
3155
3131
|
/**
|
|
@@ -3524,17 +3500,6 @@ var ChatDriver = class _ChatDriver extends EventTarget {
|
|
|
3524
3500
|
getTurnSnapshots() {
|
|
3525
3501
|
return this.turnSnapshots;
|
|
3526
3502
|
}
|
|
3527
|
-
/**
|
|
3528
|
-
* The `turn` + `message` diagnostic-log entries harvested from resolved interactions'
|
|
3529
|
-
* `InteractionResult.diagnostics` (e.g. a server-side ChatDriver's collated debug log). The host
|
|
3530
|
-
* concatenates these into its own debug log so `downloadDebugLog`/the persisted diagnostics stream
|
|
3531
|
-
* include external-engine logs; `event` entries are excluded here because they're merged into the
|
|
3532
|
-
* session's meta-event registry instead (see `resolveInteraction`) and reach the log via
|
|
3533
|
-
* `getMetaEvents`. Opaque, chronologically sorted by the host at assemble time. (GENC-1461.)
|
|
3534
|
-
*/
|
|
3535
|
-
getExternalDiagnostics() {
|
|
3536
|
-
return this.externalDiagnostics;
|
|
3537
|
-
}
|
|
3538
3503
|
/**
|
|
3539
3504
|
* Merge a sub-agent's turn snapshots into this driver's buffer so they surface
|
|
3540
3505
|
* as `kind:'turn'` entries in the exported debug log. The child runs as a
|
|
@@ -3844,34 +3809,6 @@ Output format (strict):
|
|
|
3844
3809
|
const interaction = this.pendingInteractions.get(interactionId);
|
|
3845
3810
|
if (interaction) {
|
|
3846
3811
|
if (interaction.timeoutHandle) clearTimeout(interaction.timeoutHandle);
|
|
3847
|
-
const harvestedDiagnostics = result?.diagnostics;
|
|
3848
|
-
if (Array.isArray(harvestedDiagnostics) && harvestedDiagnostics.length) {
|
|
3849
|
-
const batch = this.externalDiagnosticsBatches += 1;
|
|
3850
|
-
const externalEvents = [];
|
|
3851
|
-
let turnCount = 0;
|
|
3852
|
-
let messageCount = 0;
|
|
3853
|
-
for (const entry of harvestedDiagnostics) {
|
|
3854
|
-
if (entry.kind === "event") {
|
|
3855
|
-
const { kind: _kind, ...event } = entry;
|
|
3856
|
-
externalEvents.push(event);
|
|
3857
|
-
} else if (entry.kind === "turn") {
|
|
3858
|
-
this.externalDiagnostics.push({
|
|
3859
|
-
...entry,
|
|
3860
|
-
turnIndex: `server-generation.${batch}:${turnCount}`
|
|
3861
|
-
});
|
|
3862
|
-
turnCount += 1;
|
|
3863
|
-
} else {
|
|
3864
|
-
messageCount += 1;
|
|
3865
|
-
this.externalDiagnostics.push(entry);
|
|
3866
|
-
}
|
|
3867
|
-
}
|
|
3868
|
-
if (externalEvents.length) mergeMetaEvents(this.sessionKey, externalEvents);
|
|
3869
|
-
recordMetaEvent(this.sessionKey, "external-diagnostics.folded", {
|
|
3870
|
-
interactionId,
|
|
3871
|
-
batch,
|
|
3872
|
-
counts: { turn: turnCount, event: externalEvents.length, message: messageCount }
|
|
3873
|
-
});
|
|
3874
|
-
}
|
|
3875
3812
|
const idx = this.history.findIndex((m) => m.interaction?.interactionId === interactionId);
|
|
3876
3813
|
if (idx !== -1) {
|
|
3877
3814
|
const costUsd = typeof result?.costUsd === "number" && Number.isFinite(result.costUsd) && result.costUsd > 0 ? result.costUsd : void 0;
|
|
@@ -5139,10 +5076,6 @@ var OrchestratingDriver = class extends EventTarget {
|
|
|
5139
5076
|
getTurnSnapshots() {
|
|
5140
5077
|
return this.chatDriver.getTurnSnapshots();
|
|
5141
5078
|
}
|
|
5142
|
-
/** Delegates to the inner {@link ChatDriver} — interactions resolve there, so it holds the buffer. */
|
|
5143
|
-
getExternalDiagnostics() {
|
|
5144
|
-
return this.chatDriver.getExternalDiagnostics();
|
|
5145
|
-
}
|
|
5146
5079
|
async getSuggestions(history, prompt2, count, allAgentInfo) {
|
|
5147
5080
|
const pinned = this.resolvePinnedAgent();
|
|
5148
5081
|
const candidates = pinned && isSpecialist(pinned) ? [pinned] : this.specialists;
|
|
@@ -5656,86 +5589,6 @@ var strictFallbackAgent = {
|
|
|
5656
5589
|
fallback: true,
|
|
5657
5590
|
systemPrompt: `You are a concise assistant. The user's request is outside your scope. Respond with a single short sentence stating what you can assist with. Do not elaborate. The available specialists are: {{agents}}.`
|
|
5658
5591
|
};
|
|
5659
|
-
|
|
5660
|
-
// src/utils/flatten-sub-agent-messages.ts
|
|
5661
|
-
function flattenSubAgentMessages(messages, prefix = "", depth = 0, subAgentOf) {
|
|
5662
|
-
return messages.flatMap((m) => {
|
|
5663
|
-
const breadcrumb = prefix ? `${prefix} \u203A ${m.agentName ?? "?"}` : m.agentName;
|
|
5664
|
-
const traceCalls = m.toolCalls?.filter((tc) => tc.subAgentTrace?.length) ?? [];
|
|
5665
|
-
const entry = {
|
|
5666
|
-
kind: "message",
|
|
5667
|
-
...m,
|
|
5668
|
-
// Move the (about-to-be-hoisted) child conversations out of the emitted tool
|
|
5669
|
-
// calls. Setting it to `undefined` drops the key from the serialized export.
|
|
5670
|
-
...traceCalls.length > 0 && {
|
|
5671
|
-
toolCalls: m.toolCalls.map(
|
|
5672
|
-
(tc) => tc.subAgentTrace ? { ...tc, subAgentTrace: void 0 } : tc
|
|
5673
|
-
)
|
|
5674
|
-
},
|
|
5675
|
-
// Mark + breadcrumb hoisted sub-agent messages; top-level (depth 0) stays as-is.
|
|
5676
|
-
...depth > 0 && {
|
|
5677
|
-
agentName: breadcrumb,
|
|
5678
|
-
subAgentName: m.agentName,
|
|
5679
|
-
subAgentDepth: depth,
|
|
5680
|
-
subAgentOf
|
|
5681
|
-
}
|
|
5682
|
-
};
|
|
5683
|
-
if (traceCalls.length === 0) return [entry];
|
|
5684
|
-
const hoisted = traceCalls.flatMap(
|
|
5685
|
-
(tc) => flattenSubAgentMessages(tc.subAgentTrace, breadcrumb ?? "", depth + 1, tc.id)
|
|
5686
|
-
);
|
|
5687
|
-
return [entry, ...hoisted];
|
|
5688
|
-
});
|
|
5689
|
-
}
|
|
5690
|
-
|
|
5691
|
-
// src/state/persistence/build-timeline-entries.ts
|
|
5692
|
-
function buildTimelineEntries(input) {
|
|
5693
|
-
const { turnSnapshots, messages, metaEvents } = input;
|
|
5694
|
-
let lastFullPrompt;
|
|
5695
|
-
let lastFullIndex = "";
|
|
5696
|
-
const turns = turnSnapshots.map((t) => {
|
|
5697
|
-
let { systemPrompt } = t;
|
|
5698
|
-
if (systemPrompt != null && systemPrompt === lastFullPrompt) {
|
|
5699
|
-
systemPrompt = `<repeated \u2014 identical to turn ${lastFullIndex}>`;
|
|
5700
|
-
} else if (systemPrompt != null) {
|
|
5701
|
-
lastFullPrompt = systemPrompt;
|
|
5702
|
-
lastFullIndex = t.turnIndex;
|
|
5703
|
-
}
|
|
5704
|
-
return { kind: "turn", ...t, systemPrompt };
|
|
5705
|
-
});
|
|
5706
|
-
const messageEntries = flattenSubAgentMessages(messages);
|
|
5707
|
-
const eventEntries = metaEvents.map((e) => ({ kind: "event", ...e }));
|
|
5708
|
-
return [...messageEntries, ...turns, ...eventEntries];
|
|
5709
|
-
}
|
|
5710
|
-
|
|
5711
|
-
// src/state/persistence/diagnostics.ts
|
|
5712
|
-
var KIND_RANK = { event: 0, turn: 1, message: 2 };
|
|
5713
|
-
var UNKNOWN_KIND_RANK = 99;
|
|
5714
|
-
function assembleDebugLog(entries, readme) {
|
|
5715
|
-
const seen = /* @__PURE__ */ new Set();
|
|
5716
|
-
let latestMeta;
|
|
5717
|
-
const timeline = [];
|
|
5718
|
-
for (const entry of entries) {
|
|
5719
|
-
const id = JSON.stringify(entry);
|
|
5720
|
-
if (seen.has(id)) continue;
|
|
5721
|
-
seen.add(id);
|
|
5722
|
-
if (entry.kind === "meta-snapshot") {
|
|
5723
|
-
if (!latestMeta || (entry.timestamp ?? "") >= (latestMeta.timestamp ?? "")) {
|
|
5724
|
-
latestMeta = entry;
|
|
5725
|
-
}
|
|
5726
|
-
} else {
|
|
5727
|
-
timeline.push(entry);
|
|
5728
|
-
}
|
|
5729
|
-
}
|
|
5730
|
-
timeline.sort((a, b) => {
|
|
5731
|
-
const ta = a.timestamp ?? "";
|
|
5732
|
-
const tb = b.timestamp ?? "";
|
|
5733
|
-
if (ta < tb) return -1;
|
|
5734
|
-
if (ta > tb) return 1;
|
|
5735
|
-
return (KIND_RANK[a.kind] ?? UNKNOWN_KIND_RANK) - (KIND_RANK[b.kind] ?? UNKNOWN_KIND_RANK);
|
|
5736
|
-
});
|
|
5737
|
-
return { readme, timeline, meta: latestMeta?.meta };
|
|
5738
|
-
}
|
|
5739
5592
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5740
5593
|
0 && (module.exports = {
|
|
5741
5594
|
AgenticActivityBus,
|
|
@@ -5748,16 +5601,10 @@ function assembleDebugLog(entries, readme) {
|
|
|
5748
5601
|
NOOP_ACTIVITY_BUS,
|
|
5749
5602
|
OrchestratingDriver,
|
|
5750
5603
|
REQUEST_CONTINUATION_TOOL,
|
|
5751
|
-
SUPPORTED_ANTHROPIC_MODEL_IDS,
|
|
5752
|
-
SUPPORTED_GEMINI_MODEL_IDS,
|
|
5753
5604
|
agenticActivityBus,
|
|
5754
|
-
assembleDebugLog,
|
|
5755
|
-
buildTimelineEntries,
|
|
5756
|
-
clearSession,
|
|
5757
5605
|
defineAgent,
|
|
5758
5606
|
defineStatefulAgent,
|
|
5759
5607
|
friendlyFallbackAgent,
|
|
5760
|
-
getMetaEvents,
|
|
5761
5608
|
isObservableAIProviderRegistry,
|
|
5762
5609
|
restoreMachine,
|
|
5763
5610
|
strictFallbackAgent
|