@genesislcap/ai-assistant 14.450.0 → 14.451.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/ai-assistant.api.json +85 -15
- package/dist/ai-assistant.d.ts +94 -3
- package/dist/dts/components/chat-driver/chat-driver.d.ts +7 -1
- package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts.map +1 -1
- package/dist/dts/main/main.d.ts +48 -2
- package/dist/dts/main/main.d.ts.map +1 -1
- package/dist/dts/state/debug-event-log.d.ts +82 -0
- package/dist/dts/state/debug-event-log.d.ts.map +1 -0
- package/dist/esm/components/chat-driver/chat-driver.js +83 -4
- package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +19 -3
- package/dist/esm/main/main.js +149 -14
- package/dist/esm/state/debug-event-log.js +118 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -16
- package/src/components/chat-driver/chat-driver.ts +84 -8
- package/src/components/orchestrating-driver/orchestrating-driver.ts +19 -2
- package/src/main/main.ts +152 -6
- package/src/state/debug-event-log.ts +194 -0
|
@@ -2570,6 +2570,14 @@
|
|
|
2570
2570
|
"kind": "Content",
|
|
2571
2571
|
"text": "number"
|
|
2572
2572
|
},
|
|
2573
|
+
{
|
|
2574
|
+
"kind": "Content",
|
|
2575
|
+
"text": ", \n sessionKey?: "
|
|
2576
|
+
},
|
|
2577
|
+
{
|
|
2578
|
+
"kind": "Content",
|
|
2579
|
+
"text": "string"
|
|
2580
|
+
},
|
|
2573
2581
|
{
|
|
2574
2582
|
"kind": "Content",
|
|
2575
2583
|
"text": ");"
|
|
@@ -2642,6 +2650,14 @@
|
|
|
2642
2650
|
"endIndex": 17
|
|
2643
2651
|
},
|
|
2644
2652
|
"isOptional": true
|
|
2653
|
+
},
|
|
2654
|
+
{
|
|
2655
|
+
"parameterName": "sessionKey",
|
|
2656
|
+
"parameterTypeTokenRange": {
|
|
2657
|
+
"startIndex": 18,
|
|
2658
|
+
"endIndex": 19
|
|
2659
|
+
},
|
|
2660
|
+
"isOptional": true
|
|
2645
2661
|
}
|
|
2646
2662
|
]
|
|
2647
2663
|
},
|
|
@@ -4904,16 +4920,79 @@
|
|
|
4904
4920
|
},
|
|
4905
4921
|
{
|
|
4906
4922
|
"kind": "Content",
|
|
4907
|
-
"text": "{\n
|
|
4923
|
+
"text": "{\n readme: readonly string[];\n timeline: ({\n systemPrompt: string;\n turnIndex: number;\n timestamp: string;\n agentName?: string;\n toolNames: string[];\n agentLabel?: string;\n agentSnapshot?: unknown;\n kind: \"turn\";\n } | {\n role: import(\"@genesislcap/foundation-ai\")."
|
|
4908
4924
|
},
|
|
4909
4925
|
{
|
|
4910
4926
|
"kind": "Reference",
|
|
4911
|
-
"text": "
|
|
4912
|
-
"canonicalReference": "@genesislcap/foundation-ai!
|
|
4927
|
+
"text": "ChatRole",
|
|
4928
|
+
"canonicalReference": "@genesislcap/foundation-ai!ChatRole:type"
|
|
4929
|
+
},
|
|
4930
|
+
{
|
|
4931
|
+
"kind": "Content",
|
|
4932
|
+
"text": ";\n content: string;\n timestamp?: string;\n toolCalls?: import(\"@genesislcap/foundation-ai\")."
|
|
4933
|
+
},
|
|
4934
|
+
{
|
|
4935
|
+
"kind": "Reference",
|
|
4936
|
+
"text": "ChatToolCall",
|
|
4937
|
+
"canonicalReference": "@genesislcap/foundation-ai!ChatToolCall:type"
|
|
4938
|
+
},
|
|
4939
|
+
{
|
|
4940
|
+
"kind": "Content",
|
|
4941
|
+
"text": "[];\n toolResult?: import(\"@genesislcap/foundation-ai\")."
|
|
4942
|
+
},
|
|
4943
|
+
{
|
|
4944
|
+
"kind": "Reference",
|
|
4945
|
+
"text": "ChatToolResult",
|
|
4946
|
+
"canonicalReference": "@genesislcap/foundation-ai!ChatToolResult:interface"
|
|
4947
|
+
},
|
|
4948
|
+
{
|
|
4949
|
+
"kind": "Content",
|
|
4950
|
+
"text": ";\n attachments?: "
|
|
4951
|
+
},
|
|
4952
|
+
{
|
|
4953
|
+
"kind": "Reference",
|
|
4954
|
+
"text": "ChatAttachment",
|
|
4955
|
+
"canonicalReference": "@genesislcap/foundation-ai!ChatAttachment:interface"
|
|
4913
4956
|
},
|
|
4914
4957
|
{
|
|
4915
4958
|
"kind": "Content",
|
|
4916
|
-
"text": "[];\n
|
|
4959
|
+
"text": "[];\n interaction?: import(\"@genesislcap/foundation-ai\")."
|
|
4960
|
+
},
|
|
4961
|
+
{
|
|
4962
|
+
"kind": "Reference",
|
|
4963
|
+
"text": "ChatInteraction",
|
|
4964
|
+
"canonicalReference": "@genesislcap/foundation-ai!ChatInteraction:interface"
|
|
4965
|
+
},
|
|
4966
|
+
{
|
|
4967
|
+
"kind": "Content",
|
|
4968
|
+
"text": ";\n thinking?: boolean;\n agentName?: string;\n agentLabel?: string;\n inputTokens?: number;\n outputTokens?: number;\n cost?: number;\n kind: \"message\";\n } | {\n index: number;\n timestamp: string;\n type: "
|
|
4969
|
+
},
|
|
4970
|
+
{
|
|
4971
|
+
"kind": "Reference",
|
|
4972
|
+
"text": "MetaEventType",
|
|
4973
|
+
"canonicalReference": "@genesislcap/ai-assistant!~MetaEventType:type"
|
|
4974
|
+
},
|
|
4975
|
+
{
|
|
4976
|
+
"kind": "Content",
|
|
4977
|
+
"text": ";\n importance: import(\"../state/debug-event-log\")."
|
|
4978
|
+
},
|
|
4979
|
+
{
|
|
4980
|
+
"kind": "Reference",
|
|
4981
|
+
"text": "MetaEventImportance",
|
|
4982
|
+
"canonicalReference": "@genesislcap/ai-assistant!~MetaEventImportance:type"
|
|
4983
|
+
},
|
|
4984
|
+
{
|
|
4985
|
+
"kind": "Content",
|
|
4986
|
+
"text": ";\n detail?: "
|
|
4987
|
+
},
|
|
4988
|
+
{
|
|
4989
|
+
"kind": "Reference",
|
|
4990
|
+
"text": "Record",
|
|
4991
|
+
"canonicalReference": "!Record:type"
|
|
4992
|
+
},
|
|
4993
|
+
{
|
|
4994
|
+
"kind": "Content",
|
|
4995
|
+
"text": "<string, unknown>;\n kind: \"event\";\n })[];\n meta: {\n timestamp: string;\n host: string;\n agentSummary: ({\n toolDefinitions: string | import(\"@genesislcap/foundation-ai\")."
|
|
4917
4996
|
},
|
|
4918
4997
|
{
|
|
4919
4998
|
"kind": "Reference",
|
|
@@ -5066,16 +5145,7 @@
|
|
|
5066
5145
|
},
|
|
5067
5146
|
{
|
|
5068
5147
|
"kind": "Content",
|
|
5069
|
-
"text": "[];\n activeFoldStack: string[];\n context: {\n model: string;\n contextTokens: number;\n contextLimit: number;\n contextUsagePercent: number;\n sessionCostUsd: number;\n };\n activeDebugSnapshot: unknown;\n
|
|
5070
|
-
},
|
|
5071
|
-
{
|
|
5072
|
-
"kind": "Reference",
|
|
5073
|
-
"text": "TurnSnapshot",
|
|
5074
|
-
"canonicalReference": "@genesislcap/ai-assistant!TurnSnapshot:interface"
|
|
5075
|
-
},
|
|
5076
|
-
{
|
|
5077
|
-
"kind": "Content",
|
|
5078
|
-
"text": "[];\n debug: unknown;\n };\n }"
|
|
5148
|
+
"text": "[];\n activeFoldStack: string[];\n context: {\n model: string;\n contextTokens: number;\n contextLimit: number;\n contextUsagePercent: number;\n sessionCostUsd: number;\n };\n activeDebugSnapshot: unknown;\n debug: unknown;\n };\n }"
|
|
5079
5149
|
},
|
|
5080
5150
|
{
|
|
5081
5151
|
"kind": "Content",
|
|
@@ -5085,7 +5155,7 @@
|
|
|
5085
5155
|
"isStatic": false,
|
|
5086
5156
|
"returnTypeTokenRange": {
|
|
5087
5157
|
"startIndex": 1,
|
|
5088
|
-
"endIndex":
|
|
5158
|
+
"endIndex": 52
|
|
5089
5159
|
},
|
|
5090
5160
|
"releaseTag": "Beta",
|
|
5091
5161
|
"isProtected": false,
|
package/dist/ai-assistant.d.ts
CHANGED
|
@@ -5,9 +5,13 @@ 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';
|
|
8
9
|
import type { ChatMessage } from '@genesislcap/foundation-ai';
|
|
10
|
+
import { ChatRole } from '@genesislcap/foundation-ai';
|
|
11
|
+
import { ChatToolCall } from '@genesislcap/foundation-ai';
|
|
9
12
|
import { ChatToolDefinition } from '@genesislcap/foundation-ai';
|
|
10
13
|
import type { ChatToolHandlers } from '@genesislcap/foundation-ai';
|
|
14
|
+
import { ChatToolResult } from '@genesislcap/foundation-ai';
|
|
11
15
|
import { GenesisElement } from '@genesislcap/web-core';
|
|
12
16
|
import type { InteractionRequestOptions } from '@genesislcap/foundation-ai';
|
|
13
17
|
import type { InteractionResult } from '@genesislcap/foundation-ai';
|
|
@@ -557,8 +561,12 @@ declare interface BaseAgentConfig {
|
|
|
557
561
|
export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
558
562
|
private readonly providerRegistry;
|
|
559
563
|
private readonly maxToolIterations;
|
|
564
|
+
/** Session identity used to file meta events onto the shared debug-log timeline. */
|
|
565
|
+
private readonly sessionKey;
|
|
560
566
|
private history;
|
|
561
567
|
private busy;
|
|
568
|
+
/** Epoch ms when the current turn loop began — drives the `turn.end` duration. */
|
|
569
|
+
private turnStartedAt;
|
|
562
570
|
private pendingInteractions;
|
|
563
571
|
private systemPrompt?;
|
|
564
572
|
/**
|
|
@@ -663,7 +671,9 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
663
671
|
private lastResolvedProviderName?;
|
|
664
672
|
/** Last dispatched `provider-changed` name; avoids duplicate events on stable turns. */
|
|
665
673
|
private lastDispatchedProviderName?;
|
|
666
|
-
constructor(providerRegistry: AIProviderRegistry, toolHandlers?: ToolHandlersInput, toolDefinitions?: ToolDefinitionsInput, systemPrompt?: SystemPromptInput, primerHistory?: ChatMessage[], maxToolIterations?: number, maxFoldOperations?: number, maxTurnSnapshots?: number
|
|
674
|
+
constructor(providerRegistry: AIProviderRegistry, toolHandlers?: ToolHandlersInput, toolDefinitions?: ToolDefinitionsInput, systemPrompt?: SystemPromptInput, primerHistory?: ChatMessage[], maxToolIterations?: number, maxFoldOperations?: number, maxTurnSnapshots?: number,
|
|
675
|
+
/** Session identity used to file meta events onto the shared debug-log timeline. */
|
|
676
|
+
sessionKey?: string);
|
|
667
677
|
/**
|
|
668
678
|
* Swap in a new agent's configuration. Called by OrchestratingDriver before
|
|
669
679
|
* each specialist turn so the shared driver runs with the right tools and prompt.
|
|
@@ -1136,6 +1146,12 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
1136
1146
|
private _userScrolledAway;
|
|
1137
1147
|
private _scrollListener?;
|
|
1138
1148
|
private static readonly SCROLL_BOTTOM_THRESHOLD_PX;
|
|
1149
|
+
/** Context-usage percentage that fires the one-shot `context.threshold-crossed` event. */
|
|
1150
|
+
private static readonly CONTEXT_USAGE_WARN_PERCENT;
|
|
1151
|
+
/** Last `contextTokens` logged to the timeline — dedupes the `context.updated` event. */
|
|
1152
|
+
private _lastLoggedContextTokens?;
|
|
1153
|
+
/** Whether the one-shot ≥80% `context.threshold-crossed` event has fired this session. */
|
|
1154
|
+
private _contextThresholdCrossed;
|
|
1139
1155
|
/**
|
|
1140
1156
|
* Interaction widgets that grow mid-lifecycle (e.g. expanding a "More info"
|
|
1141
1157
|
* panel, appending an SSE status row, revealing generated code) bubble a
|
|
@@ -1222,6 +1238,14 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
1222
1238
|
handlePopout(): void;
|
|
1223
1239
|
/** Returns a cache key for this instance, or undefined if the component has no identity. */
|
|
1224
1240
|
private getStateKey;
|
|
1241
|
+
/**
|
|
1242
|
+
* Record a meta/lifecycle event onto this session's debug-log timeline
|
|
1243
|
+
* (exported via {@link FoundationAiAssistant.getDebugLog}). Every event
|
|
1244
|
+
* auto-carries `placement` so a session emitted from both the bubble and the
|
|
1245
|
+
* layout panel stays disambiguated. Keyed by `stateKey` so the timeline is
|
|
1246
|
+
* shared across pop-in/pop-out and survives driver rebuilds.
|
|
1247
|
+
*/
|
|
1248
|
+
private logMeta;
|
|
1225
1249
|
private readonly _settingsToggle;
|
|
1226
1250
|
toggleSettings(): void;
|
|
1227
1251
|
private readonly _agentPickerToggle;
|
|
@@ -1276,7 +1300,39 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
1276
1300
|
toggleShowAgentSwitchIndicator(): void;
|
|
1277
1301
|
setEnabledAnimations(animations: AiAssistantAnimation[]): void;
|
|
1278
1302
|
getDebugLog(): {
|
|
1279
|
-
|
|
1303
|
+
readme: readonly string[];
|
|
1304
|
+
timeline: ({
|
|
1305
|
+
systemPrompt: string;
|
|
1306
|
+
turnIndex: number;
|
|
1307
|
+
timestamp: string;
|
|
1308
|
+
agentName?: string;
|
|
1309
|
+
toolNames: string[];
|
|
1310
|
+
agentLabel?: string;
|
|
1311
|
+
agentSnapshot?: unknown;
|
|
1312
|
+
kind: "turn";
|
|
1313
|
+
} | {
|
|
1314
|
+
role: ChatRole;
|
|
1315
|
+
content: string;
|
|
1316
|
+
timestamp?: string;
|
|
1317
|
+
toolCalls?: ChatToolCall[];
|
|
1318
|
+
toolResult?: ChatToolResult;
|
|
1319
|
+
attachments?: ChatAttachment[];
|
|
1320
|
+
interaction?: ChatInteraction;
|
|
1321
|
+
thinking?: boolean;
|
|
1322
|
+
agentName?: string;
|
|
1323
|
+
agentLabel?: string;
|
|
1324
|
+
inputTokens?: number;
|
|
1325
|
+
outputTokens?: number;
|
|
1326
|
+
cost?: number;
|
|
1327
|
+
kind: "message";
|
|
1328
|
+
} | {
|
|
1329
|
+
index: number;
|
|
1330
|
+
timestamp: string;
|
|
1331
|
+
type: MetaEventType;
|
|
1332
|
+
importance: MetaEventImportance;
|
|
1333
|
+
detail?: Record<string, unknown>;
|
|
1334
|
+
kind: "event";
|
|
1335
|
+
})[];
|
|
1280
1336
|
meta: {
|
|
1281
1337
|
timestamp: string;
|
|
1282
1338
|
host: string;
|
|
@@ -1325,7 +1381,6 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
1325
1381
|
sessionCostUsd: number;
|
|
1326
1382
|
};
|
|
1327
1383
|
activeDebugSnapshot: unknown;
|
|
1328
|
-
turnSnapshots: readonly TurnSnapshot[];
|
|
1329
1384
|
debug: unknown;
|
|
1330
1385
|
};
|
|
1331
1386
|
};
|
|
@@ -1471,6 +1526,42 @@ export declare interface ManualSelectionConfig {
|
|
|
1471
1526
|
hint?: string;
|
|
1472
1527
|
}
|
|
1473
1528
|
|
|
1529
|
+
/**
|
|
1530
|
+
* How much a reader should care about an event — lets a consumer (or an AI
|
|
1531
|
+
* agent) filter the timeline: skip `low` UI/bookkeeping noise, skim `normal`
|
|
1532
|
+
* session flow, or jump straight to `high` problem/limit signals when triaging.
|
|
1533
|
+
*/
|
|
1534
|
+
declare type MetaEventImportance = 'high' | 'normal' | 'low';
|
|
1535
|
+
|
|
1536
|
+
/**
|
|
1537
|
+
* Module-level append-only timeline of meta/lifecycle events, keyed by session
|
|
1538
|
+
* identity (the same `stateKey` space used by the driver registry and the
|
|
1539
|
+
* session store).
|
|
1540
|
+
*
|
|
1541
|
+
* Why a module registry rather than the redux store or the driver:
|
|
1542
|
+
* - **Survives the pop-in/pop-out element churn.** A single session can be
|
|
1543
|
+
* emitted from up to two element instances (an `expand` bubble + a `collapse`
|
|
1544
|
+
* panel) sharing one driver; keying by `stateKey` unifies them into one
|
|
1545
|
+
* timeline.
|
|
1546
|
+
* - **Survives driver rebuilds.** The driver is torn down and recreated when the
|
|
1547
|
+
* host swaps the agents array (see `agentsChanged` / `deleteDriver`), so a
|
|
1548
|
+
* driver-owned buffer would lose the timeline mid-session. The `stateKey`
|
|
1549
|
+
* outlives the driver.
|
|
1550
|
+
* - **Stays out of redux reactivity.** These appends never drive the UI, so
|
|
1551
|
+
* there's no reason to pay immutable-reducer cost or flood the Redux DevTools
|
|
1552
|
+
* action log with debug noise.
|
|
1553
|
+
*
|
|
1554
|
+
* Surfaced under `getDebugLog().meta.events`. Ring-buffered so a long-lived
|
|
1555
|
+
* session can't grow the timeline unbounded.
|
|
1556
|
+
*
|
|
1557
|
+
* @internal
|
|
1558
|
+
*/
|
|
1559
|
+
/**
|
|
1560
|
+
* Catalogue of meta event names. This is the documented surface — extend it as
|
|
1561
|
+
* new events are wired in (Tier 2/3 lifecycle, interaction, provider events).
|
|
1562
|
+
*/
|
|
1563
|
+
declare type MetaEventType = 'assistant.connected' | 'assistant.disconnected' | 'assistant.popout' | 'assistant.popin' | 'driver.created' | 'driver.wired' | 'driver.unwired' | 'state.changed' | 'turn.start' | 'turn.end' | 'turn.error' | 'tool.failed' | 'agent.handoff' | 'agent.pinned' | 'agent.unpinned' | 'provider.selected' | 'interaction.requested' | 'interaction.resolved' | 'context.updated' | 'context.threshold-crossed' | 'panel.toggled' | 'attachment.added' | 'file.read-failed' | 'suggestions.failed';
|
|
1564
|
+
|
|
1474
1565
|
/**
|
|
1475
1566
|
* Orchestrates multiple specialist agents. Sits between `FoundationAiAssistant`
|
|
1476
1567
|
* and `ChatDriver`, classifying each user message and routing it to the right
|
|
@@ -52,8 +52,12 @@ export interface TurnSnapshot {
|
|
|
52
52
|
export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
53
53
|
private readonly providerRegistry;
|
|
54
54
|
private readonly maxToolIterations;
|
|
55
|
+
/** Session identity used to file meta events onto the shared debug-log timeline. */
|
|
56
|
+
private readonly sessionKey;
|
|
55
57
|
private history;
|
|
56
58
|
private busy;
|
|
59
|
+
/** Epoch ms when the current turn loop began — drives the `turn.end` duration. */
|
|
60
|
+
private turnStartedAt;
|
|
57
61
|
private pendingInteractions;
|
|
58
62
|
private systemPrompt?;
|
|
59
63
|
/**
|
|
@@ -158,7 +162,9 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
158
162
|
private lastResolvedProviderName?;
|
|
159
163
|
/** Last dispatched `provider-changed` name; avoids duplicate events on stable turns. */
|
|
160
164
|
private lastDispatchedProviderName?;
|
|
161
|
-
constructor(providerRegistry: AIProviderRegistry, toolHandlers?: ToolHandlersInput, toolDefinitions?: ToolDefinitionsInput, systemPrompt?: SystemPromptInput, primerHistory?: ChatMessage[], maxToolIterations?: number, maxFoldOperations?: number, maxTurnSnapshots?: number
|
|
165
|
+
constructor(providerRegistry: AIProviderRegistry, toolHandlers?: ToolHandlersInput, toolDefinitions?: ToolDefinitionsInput, systemPrompt?: SystemPromptInput, primerHistory?: ChatMessage[], maxToolIterations?: number, maxFoldOperations?: number, maxTurnSnapshots?: number,
|
|
166
|
+
/** Session identity used to file meta events onto the shared debug-log timeline. */
|
|
167
|
+
sessionKey?: string);
|
|
162
168
|
/**
|
|
163
169
|
* Swap in a new agent's configuration. Called by OrchestratingDriver before
|
|
164
170
|
* each specialist turn so the shared driver runs with the right tools and prompt.
|
|
@@ -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,EAKX,yBAAyB,EAE1B,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EACV,WAAW,EAGX,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EAClB,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,EAKX,yBAAyB,EAE1B,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EACV,WAAW,EAGX,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,KAA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GG;IACI,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,IAAI;IA0BnE;;;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;IAqC/F;;;;;;;;OAQG;IACH,OAAO,CAAC,mBAAmB;IAsC3B;;;;;OAKG;YACW,cAAc;IA8F5B;;;OAGG;IACG,mBAAmB,CAAC,eAAe,CAAC,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAsCrF,wFAAwF;IACxF,OAAO,CAAC,OAAO;IAKf;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAc1B;;;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;IAyZzB,OAAO,CAAC,eAAe;CAoBxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrating-driver.d.ts","sourceRoot":"","sources":["../../../../src/components/orchestrating-driver/orchestrating-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,WAAW,EAEZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,WAAW,EAKZ,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"orchestrating-driver.d.ts","sourceRoot":"","sources":["../../../../src/components/orchestrating-driver/orchestrating-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,WAAW,EAEZ,MAAM,4BAA4B,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EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI;IAIhE,MAAM,IAAI,OAAO;IAIjB,qEAAqE;IACrE,qBAAqB,IAAI,MAAM;IAI/B;;;;;OAKG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIzC;;;;;OAKG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIvC,WAAW,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAI;IAI1C,aAAa,IAAI,SAAS,WAAW,EAAE;IAIvC,4EAA4E;IAC5E,gBAAgB,IAAI,aAAa,CAAC,YAAY,CAAC;IAIzC,cAAc,CAClB,OAAO,EAAE,WAAW,EAAE,EACtB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,eAAe,EAAE,GAC/B,OAAO,CAAC,MAAM,EAAE,CAAC;IAgBd,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAwErF,mBAAmB,CAAC,eAAe,CAAC,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;YAIvE,UAAU;IAmGxB;;;;;;;;;;OAUG;YACW,kBAAkB;IAuBhC;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YAiBhB,QAAQ;IAwGtB;;;;;;;OAOG;IACH,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,mBAAmB;CAU5B"}
|
package/dist/dts/main/main.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { AIProviderRegistryStatusEntry, ChatAttachment, ChatConfig, ChatInp
|
|
|
2
2
|
import { AIProviderRegistry } from '@genesislcap/foundation-ai';
|
|
3
3
|
import { GenesisElement } from '@genesislcap/web-core';
|
|
4
4
|
import type { AgentConfig } from '../config/config';
|
|
5
|
+
import { type MetaEventType } from '../state/debug-event-log';
|
|
5
6
|
import type { AgentPickerMode, AiAssistantAnimation, AiAssistantState, PopoutMode, SubmitMessageResult, SuggestionsState } from './main.types';
|
|
6
7
|
/**
|
|
7
8
|
* Foundation AI Assistant component.
|
|
@@ -190,6 +191,12 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
190
191
|
private _userScrolledAway;
|
|
191
192
|
private _scrollListener?;
|
|
192
193
|
private static readonly SCROLL_BOTTOM_THRESHOLD_PX;
|
|
194
|
+
/** Context-usage percentage that fires the one-shot `context.threshold-crossed` event. */
|
|
195
|
+
private static readonly CONTEXT_USAGE_WARN_PERCENT;
|
|
196
|
+
/** Last `contextTokens` logged to the timeline — dedupes the `context.updated` event. */
|
|
197
|
+
private _lastLoggedContextTokens?;
|
|
198
|
+
/** Whether the one-shot ≥80% `context.threshold-crossed` event has fired this session. */
|
|
199
|
+
private _contextThresholdCrossed;
|
|
193
200
|
/**
|
|
194
201
|
* Interaction widgets that grow mid-lifecycle (e.g. expanding a "More info"
|
|
195
202
|
* panel, appending an SSE status row, revealing generated code) bubble a
|
|
@@ -276,6 +283,14 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
276
283
|
handlePopout(): void;
|
|
277
284
|
/** Returns a cache key for this instance, or undefined if the component has no identity. */
|
|
278
285
|
private getStateKey;
|
|
286
|
+
/**
|
|
287
|
+
* Record a meta/lifecycle event onto this session's debug-log timeline
|
|
288
|
+
* (exported via {@link FoundationAiAssistant.getDebugLog}). Every event
|
|
289
|
+
* auto-carries `placement` so a session emitted from both the bubble and the
|
|
290
|
+
* layout panel stays disambiguated. Keyed by `stateKey` so the timeline is
|
|
291
|
+
* shared across pop-in/pop-out and survives driver rebuilds.
|
|
292
|
+
*/
|
|
293
|
+
private logMeta;
|
|
279
294
|
private readonly _settingsToggle;
|
|
280
295
|
toggleSettings(): void;
|
|
281
296
|
private readonly _agentPickerToggle;
|
|
@@ -330,7 +345,39 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
330
345
|
toggleShowAgentSwitchIndicator(): void;
|
|
331
346
|
setEnabledAnimations(animations: AiAssistantAnimation[]): void;
|
|
332
347
|
getDebugLog(): {
|
|
333
|
-
|
|
348
|
+
readme: readonly string[];
|
|
349
|
+
timeline: ({
|
|
350
|
+
systemPrompt: string;
|
|
351
|
+
turnIndex: number;
|
|
352
|
+
timestamp: string;
|
|
353
|
+
agentName?: string;
|
|
354
|
+
toolNames: string[];
|
|
355
|
+
agentLabel?: string;
|
|
356
|
+
agentSnapshot?: unknown;
|
|
357
|
+
kind: "turn";
|
|
358
|
+
} | {
|
|
359
|
+
role: import("@genesislcap/foundation-ai").ChatRole;
|
|
360
|
+
content: string;
|
|
361
|
+
timestamp?: string;
|
|
362
|
+
toolCalls?: import("@genesislcap/foundation-ai").ChatToolCall[];
|
|
363
|
+
toolResult?: import("@genesislcap/foundation-ai").ChatToolResult;
|
|
364
|
+
attachments?: ChatAttachment[];
|
|
365
|
+
interaction?: import("@genesislcap/foundation-ai").ChatInteraction;
|
|
366
|
+
thinking?: boolean;
|
|
367
|
+
agentName?: string;
|
|
368
|
+
agentLabel?: string;
|
|
369
|
+
inputTokens?: number;
|
|
370
|
+
outputTokens?: number;
|
|
371
|
+
cost?: number;
|
|
372
|
+
kind: "message";
|
|
373
|
+
} | {
|
|
374
|
+
index: number;
|
|
375
|
+
timestamp: string;
|
|
376
|
+
type: MetaEventType;
|
|
377
|
+
importance: import("../state/debug-event-log").MetaEventImportance;
|
|
378
|
+
detail?: Record<string, unknown>;
|
|
379
|
+
kind: "event";
|
|
380
|
+
})[];
|
|
334
381
|
meta: {
|
|
335
382
|
timestamp: string;
|
|
336
383
|
host: string;
|
|
@@ -379,7 +426,6 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
379
426
|
sessionCostUsd: number;
|
|
380
427
|
};
|
|
381
428
|
activeDebugSnapshot: unknown;
|
|
382
|
-
turnSnapshots: readonly import("../components/chat-driver/chat-driver").TurnSnapshot[];
|
|
383
429
|
debug: unknown;
|
|
384
430
|
};
|
|
385
431
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/main/main.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EACV,6BAA6B,EAC7B,cAAc,EACd,UAAU,EACV,4BAA4B,EAC5B,WAAW,EACZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAGL,cAAc,EAIf,MAAM,uBAAuB,CAAC;AAW/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/main/main.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EACV,6BAA6B,EAC7B,cAAc,EACd,UAAU,EACV,4BAA4B,EAC5B,WAAW,EACZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAGL,cAAc,EAIf,MAAM,uBAAuB,CAAC;AAW/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAC;AAgBlC,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAmEtB;;;;;;;;;;;;;;;;GAgBG;AACH,qBAOa,qBAAsB,SAAQ,cAAc;IACnC,gBAAgB,EAAG,kBAAkB,CAAC;IAE9C,kBAAkB,EAAE,MAAM,CAAW;IACZ,WAAW,EAAE,MAAM,CAAuB;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC5C,WAAW,EAAE,MAAM,CAA0B;IACrD;;;;;OAKG;IACiC,UAAU,CAAC,EAAE,U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AgB;YA6DhB,IAAI;IAyClB,qBAAqB,CAAC,CAAC,EAAE,UAAU;IAYnC,0BAA0B,CAAC,CAAC,EAAE,KAAK;CAQpC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module-level append-only timeline of meta/lifecycle events, keyed by session
|
|
3
|
+
* identity (the same `stateKey` space used by the driver registry and the
|
|
4
|
+
* session store).
|
|
5
|
+
*
|
|
6
|
+
* Why a module registry rather than the redux store or the driver:
|
|
7
|
+
* - **Survives the pop-in/pop-out element churn.** A single session can be
|
|
8
|
+
* emitted from up to two element instances (an `expand` bubble + a `collapse`
|
|
9
|
+
* panel) sharing one driver; keying by `stateKey` unifies them into one
|
|
10
|
+
* timeline.
|
|
11
|
+
* - **Survives driver rebuilds.** The driver is torn down and recreated when the
|
|
12
|
+
* host swaps the agents array (see `agentsChanged` / `deleteDriver`), so a
|
|
13
|
+
* driver-owned buffer would lose the timeline mid-session. The `stateKey`
|
|
14
|
+
* outlives the driver.
|
|
15
|
+
* - **Stays out of redux reactivity.** These appends never drive the UI, so
|
|
16
|
+
* there's no reason to pay immutable-reducer cost or flood the Redux DevTools
|
|
17
|
+
* action log with debug noise.
|
|
18
|
+
*
|
|
19
|
+
* Surfaced under `getDebugLog().meta.events`. Ring-buffered so a long-lived
|
|
20
|
+
* session can't grow the timeline unbounded.
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Catalogue of meta event names. This is the documented surface — extend it as
|
|
26
|
+
* new events are wired in (Tier 2/3 lifecycle, interaction, provider events).
|
|
27
|
+
*/
|
|
28
|
+
export type MetaEventType = 'assistant.connected' | 'assistant.disconnected' | 'assistant.popout' | 'assistant.popin' | 'driver.created' | 'driver.wired' | 'driver.unwired' | 'state.changed' | 'turn.start' | 'turn.end' | 'turn.error' | 'tool.failed' | 'agent.handoff' | 'agent.pinned' | 'agent.unpinned' | 'provider.selected' | 'interaction.requested' | 'interaction.resolved' | 'context.updated' | 'context.threshold-crossed' | 'panel.toggled' | 'attachment.added' | 'file.read-failed' | 'suggestions.failed';
|
|
29
|
+
/**
|
|
30
|
+
* How much a reader should care about an event — lets a consumer (or an AI
|
|
31
|
+
* agent) filter the timeline: skip `low` UI/bookkeeping noise, skim `normal`
|
|
32
|
+
* session flow, or jump straight to `high` problem/limit signals when triaging.
|
|
33
|
+
*/
|
|
34
|
+
export type MetaEventImportance = 'high' | 'normal' | 'low';
|
|
35
|
+
/**
|
|
36
|
+
* Importance is intrinsic to the event *type*, not the instance, so it's
|
|
37
|
+
* defined once here and stamped automatically by {@link recordMetaEvent} — call
|
|
38
|
+
* sites never pass it. The `Record` is exhaustive: adding a `MetaEventType`
|
|
39
|
+
* without a level here is a compile error.
|
|
40
|
+
*
|
|
41
|
+
* - `high` — failures and hard limits you almost always want to see.
|
|
42
|
+
* - `normal` — meaningful session flow you read to follow what happened.
|
|
43
|
+
* - `low` — frequent UI / bookkeeping noise, usually safe to skip.
|
|
44
|
+
*/
|
|
45
|
+
export declare const META_EVENT_IMPORTANCE: Record<MetaEventType, MetaEventImportance>;
|
|
46
|
+
/** One entry in the meta-event timeline. */
|
|
47
|
+
export interface MetaEvent {
|
|
48
|
+
/** Monotonic counter across the session's lifetime (does not reset on driver rebuild). */
|
|
49
|
+
index: number;
|
|
50
|
+
/** ISO timestamp, matching the format used elsewhere in the debug log. */
|
|
51
|
+
timestamp: string;
|
|
52
|
+
/** Event name — see {@link MetaEventType}. */
|
|
53
|
+
type: MetaEventType;
|
|
54
|
+
/** How much to care about this event — see {@link META_EVENT_IMPORTANCE}. */
|
|
55
|
+
importance: MetaEventImportance;
|
|
56
|
+
/** Optional structured payload. */
|
|
57
|
+
detail?: Record<string, unknown>;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Append a meta event to the timeline for `key`. Evicts the oldest entry once
|
|
61
|
+
* the buffer exceeds {@link DEFAULT_MAX_META_EVENTS}. An empty `key` is bucketed
|
|
62
|
+
* under `''`, matching how drivers/stores handle an absent session identity, so
|
|
63
|
+
* callers never need to guard.
|
|
64
|
+
*/
|
|
65
|
+
export declare function recordMetaEvent(key: string, type: MetaEventType, detail?: Record<string, unknown>): void;
|
|
66
|
+
/** Returns the meta-event timeline for `key`, or an empty array if none recorded. */
|
|
67
|
+
export declare function getMetaEvents(key: string): ReadonlyArray<MetaEvent>;
|
|
68
|
+
/**
|
|
69
|
+
* Human/agent-facing guide emitted as the first key of the exported debug log,
|
|
70
|
+
* so whoever opens the JSON (often an AI agent) knows how to read it without
|
|
71
|
+
* reverse-engineering the shape. Kept here next to the event catalogue it
|
|
72
|
+
* describes so the two stay in sync.
|
|
73
|
+
*/
|
|
74
|
+
export declare const DEBUG_LOG_README: readonly string[];
|
|
75
|
+
/**
|
|
76
|
+
* Removes all entries. Exposed for test isolation only — not part of the
|
|
77
|
+
* public API.
|
|
78
|
+
*
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
export declare function clearMetaEventRegistry(): void;
|
|
82
|
+
//# sourceMappingURL=debug-event-log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-event-log.d.ts","sourceRoot":"","sources":["../../../src/state/debug-event-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;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,aAAa,GAEb,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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