@genesislcap/ai-assistant 14.466.0 → 14.467.0-GNEC-1369.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 +229 -86
- package/dist/ai-assistant.d.ts +100 -28
- package/dist/dts/components/chat-driver/chat-driver.d.ts +28 -0
- package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
- package/dist/dts/config/config.d.ts +48 -0
- package/dist/dts/config/config.d.ts.map +1 -1
- package/dist/dts/config/define-stateful-agent.d.ts +14 -1
- package/dist/dts/config/define-stateful-agent.d.ts.map +1 -1
- package/dist/dts/config/define-stateful-agent.test.d.ts +2 -0
- package/dist/dts/config/define-stateful-agent.test.d.ts.map +1 -0
- package/dist/dts/main/main.d.ts +8 -27
- 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/dts/utils/condense-history.d.ts +85 -0
- package/dist/dts/utils/condense-history.d.ts.map +1 -0
- package/dist/dts/utils/condense-history.test.d.ts +2 -0
- package/dist/dts/utils/condense-history.test.d.ts.map +1 -0
- package/dist/esm/components/chat-driver/chat-driver.js +90 -9
- package/dist/esm/components/chat-driver/chat-driver.test.js +173 -1
- package/dist/esm/config/define-stateful-agent.js +13 -0
- package/dist/esm/config/define-stateful-agent.test.js +53 -0
- package/dist/esm/main/main.js +44 -26
- package/dist/esm/state/debug-event-log.js +3 -2
- package/dist/esm/utils/condense-history.js +172 -0
- package/dist/esm/utils/condense-history.test.js +208 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -16
- package/src/components/chat-driver/chat-driver.test.ts +245 -1
- package/src/components/chat-driver/chat-driver.ts +128 -8
- package/src/config/config.ts +52 -0
- package/src/config/define-stateful-agent.test.ts +64 -0
- package/src/config/define-stateful-agent.ts +31 -0
- package/src/main/main.ts +30 -40
- package/src/state/debug-event-log.ts +4 -2
- package/src/utils/condense-history.test.ts +256 -0
- package/src/utils/condense-history.ts +229 -0
|
@@ -5475,7 +5475,7 @@
|
|
|
5475
5475
|
},
|
|
5476
5476
|
{
|
|
5477
5477
|
"kind": "Content",
|
|
5478
|
-
"text": "<string, unknown>;\n kind: \"event\";\n })[];\n meta: {\n timestamp: string;\n host: string;\n agentSummary:
|
|
5478
|
+
"text": "<string, unknown>;\n kind: \"event\";\n })[];\n meta: {\n timestamp: string;\n host: string;\n agentSummary: {\n toolDefinitions: string | import(\"@genesislcap/foundation-ai\")."
|
|
5479
5479
|
},
|
|
5480
5480
|
{
|
|
5481
5481
|
"kind": "Reference",
|
|
@@ -5484,16 +5484,25 @@
|
|
|
5484
5484
|
},
|
|
5485
5485
|
{
|
|
5486
5486
|
"kind": "Content",
|
|
5487
|
-
"text": "[];\n
|
|
5487
|
+
"text": "[];\n name: string;\n provider?: import(\"../config/config\")."
|
|
5488
5488
|
},
|
|
5489
5489
|
{
|
|
5490
5490
|
"kind": "Reference",
|
|
5491
|
-
"text": "
|
|
5492
|
-
"canonicalReference": "@genesislcap/ai-assistant!
|
|
5491
|
+
"text": "ProviderInput",
|
|
5492
|
+
"canonicalReference": "@genesislcap/ai-assistant!ProviderInput:type"
|
|
5493
5493
|
},
|
|
5494
5494
|
{
|
|
5495
5495
|
"kind": "Content",
|
|
5496
|
-
"text": ";\n
|
|
5496
|
+
"text": ";\n chatInputDuringExecution?: "
|
|
5497
|
+
},
|
|
5498
|
+
{
|
|
5499
|
+
"kind": "Reference",
|
|
5500
|
+
"text": "ChatInputDuringExecutionMode",
|
|
5501
|
+
"canonicalReference": "@genesislcap/foundation-ai!ChatInputDuringExecutionMode:type"
|
|
5502
|
+
},
|
|
5503
|
+
{
|
|
5504
|
+
"kind": "Content",
|
|
5505
|
+
"text": ";\n description?: string;\n fallback?: true;\n displayName?: import(\"../config/config\")."
|
|
5497
5506
|
},
|
|
5498
5507
|
{
|
|
5499
5508
|
"kind": "Reference",
|
|
@@ -5502,12 +5511,12 @@
|
|
|
5502
5511
|
},
|
|
5503
5512
|
{
|
|
5504
5513
|
"kind": "Content",
|
|
5505
|
-
"text": ";\n
|
|
5514
|
+
"text": ";\n systemPrompt?: import(\"../config/config\")."
|
|
5506
5515
|
},
|
|
5507
5516
|
{
|
|
5508
5517
|
"kind": "Reference",
|
|
5509
|
-
"text": "
|
|
5510
|
-
"canonicalReference": "@genesislcap/ai-assistant!
|
|
5518
|
+
"text": "SystemPromptInput",
|
|
5519
|
+
"canonicalReference": "@genesislcap/ai-assistant!SystemPromptInput:type"
|
|
5511
5520
|
},
|
|
5512
5521
|
{
|
|
5513
5522
|
"kind": "Content",
|
|
@@ -5529,34 +5538,34 @@
|
|
|
5529
5538
|
},
|
|
5530
5539
|
{
|
|
5531
5540
|
"kind": "Content",
|
|
5532
|
-
"text": ";\n
|
|
5541
|
+
"text": ";\n onUnresolvedTool?: import(\"../config/config\")."
|
|
5533
5542
|
},
|
|
5534
5543
|
{
|
|
5535
5544
|
"kind": "Reference",
|
|
5536
|
-
"text": "
|
|
5537
|
-
"canonicalReference": "@genesislcap/
|
|
5545
|
+
"text": "UnresolvedToolInput",
|
|
5546
|
+
"canonicalReference": "@genesislcap/ai-assistant!UnresolvedToolInput:type"
|
|
5538
5547
|
},
|
|
5539
5548
|
{
|
|
5540
5549
|
"kind": "Content",
|
|
5541
|
-
"text": "
|
|
5550
|
+
"text": ";\n primerHistory?: "
|
|
5542
5551
|
},
|
|
5543
5552
|
{
|
|
5544
5553
|
"kind": "Reference",
|
|
5545
|
-
"text": "
|
|
5546
|
-
"canonicalReference": "@genesislcap/ai
|
|
5554
|
+
"text": "ChatMessage",
|
|
5555
|
+
"canonicalReference": "@genesislcap/foundation-ai!ChatMessage:interface"
|
|
5547
5556
|
},
|
|
5548
5557
|
{
|
|
5549
5558
|
"kind": "Content",
|
|
5550
|
-
"text": "[];\n
|
|
5559
|
+
"text": "[];\n subAgents?: "
|
|
5551
5560
|
},
|
|
5552
5561
|
{
|
|
5553
5562
|
"kind": "Reference",
|
|
5554
|
-
"text": "
|
|
5555
|
-
"canonicalReference": "@genesislcap/
|
|
5563
|
+
"text": "AgentConfig",
|
|
5564
|
+
"canonicalReference": "@genesislcap/ai-assistant!AgentConfig:type"
|
|
5556
5565
|
},
|
|
5557
5566
|
{
|
|
5558
5567
|
"kind": "Content",
|
|
5559
|
-
"text": ";\n manualSelection?: import(\"../config/config\")."
|
|
5568
|
+
"text": "[];\n manualSelection?: import(\"../config/config\")."
|
|
5560
5569
|
},
|
|
5561
5570
|
{
|
|
5562
5571
|
"kind": "Reference",
|
|
@@ -5565,97 +5574,43 @@
|
|
|
5565
5574
|
},
|
|
5566
5575
|
{
|
|
5567
5576
|
"kind": "Content",
|
|
5568
|
-
"text": ";\n
|
|
5569
|
-
},
|
|
5570
|
-
{
|
|
5571
|
-
"kind": "Reference",
|
|
5572
|
-
"text": "ChatToolDefinition",
|
|
5573
|
-
"canonicalReference": "@genesislcap/foundation-ai!ChatToolDefinition:interface"
|
|
5574
|
-
},
|
|
5575
|
-
{
|
|
5576
|
-
"kind": "Content",
|
|
5577
|
-
"text": "[];\n toolHandlers: any;\n onActivate: any;\n onDeactivate: any;\n getDebugSnapshot: any;\n fallback: true;\n description?: never;\n name: string;\n displayName?: import(\"../config/config\")."
|
|
5578
|
-
},
|
|
5579
|
-
{
|
|
5580
|
-
"kind": "Reference",
|
|
5581
|
-
"text": "SystemPromptInput",
|
|
5582
|
-
"canonicalReference": "@genesislcap/ai-assistant!SystemPromptInput:type"
|
|
5583
|
-
},
|
|
5584
|
-
{
|
|
5585
|
-
"kind": "Content",
|
|
5586
|
-
"text": ";\n systemPrompt?: import(\"../config/config\")."
|
|
5587
|
-
},
|
|
5588
|
-
{
|
|
5589
|
-
"kind": "Reference",
|
|
5590
|
-
"text": "SystemPromptInput",
|
|
5591
|
-
"canonicalReference": "@genesislcap/ai-assistant!SystemPromptInput:type"
|
|
5592
|
-
},
|
|
5593
|
-
{
|
|
5594
|
-
"kind": "Content",
|
|
5595
|
-
"text": ";\n provider?: import(\"../config/config\")."
|
|
5596
|
-
},
|
|
5597
|
-
{
|
|
5598
|
-
"kind": "Reference",
|
|
5599
|
-
"text": "ProviderInput",
|
|
5600
|
-
"canonicalReference": "@genesislcap/ai-assistant!ProviderInput:type"
|
|
5601
|
-
},
|
|
5602
|
-
{
|
|
5603
|
-
"kind": "Content",
|
|
5604
|
-
"text": ";\n temperature?: import(\"../config/config\")."
|
|
5605
|
-
},
|
|
5606
|
-
{
|
|
5607
|
-
"kind": "Reference",
|
|
5608
|
-
"text": "TemperatureInput",
|
|
5609
|
-
"canonicalReference": "@genesislcap/ai-assistant!TemperatureInput:type"
|
|
5610
|
-
},
|
|
5611
|
-
{
|
|
5612
|
-
"kind": "Content",
|
|
5613
|
-
"text": ";\n toolChoice?: import(\"../config/config\")."
|
|
5614
|
-
},
|
|
5615
|
-
{
|
|
5616
|
-
"kind": "Reference",
|
|
5617
|
-
"text": "ToolChoiceInput",
|
|
5618
|
-
"canonicalReference": "@genesislcap/ai-assistant!ToolChoiceInput:type"
|
|
5619
|
-
},
|
|
5620
|
-
{
|
|
5621
|
-
"kind": "Content",
|
|
5622
|
-
"text": ";\n primerHistory?: "
|
|
5577
|
+
"text": ";\n onActivate?: (ctx: import(\"../config/config\")."
|
|
5623
5578
|
},
|
|
5624
5579
|
{
|
|
5625
5580
|
"kind": "Reference",
|
|
5626
|
-
"text": "
|
|
5627
|
-
"canonicalReference": "@genesislcap/
|
|
5581
|
+
"text": "AgentLifecycleContext",
|
|
5582
|
+
"canonicalReference": "@genesislcap/ai-assistant!AgentLifecycleContext:interface"
|
|
5628
5583
|
},
|
|
5629
5584
|
{
|
|
5630
5585
|
"kind": "Content",
|
|
5631
|
-
"text": "
|
|
5586
|
+
"text": ") => void | "
|
|
5632
5587
|
},
|
|
5633
5588
|
{
|
|
5634
5589
|
"kind": "Reference",
|
|
5635
|
-
"text": "
|
|
5636
|
-
"canonicalReference": "
|
|
5590
|
+
"text": "Promise",
|
|
5591
|
+
"canonicalReference": "!Promise:interface"
|
|
5637
5592
|
},
|
|
5638
5593
|
{
|
|
5639
5594
|
"kind": "Content",
|
|
5640
|
-
"text": "
|
|
5595
|
+
"text": "<void>;\n onDeactivate?: (ctx: import(\"../config/config\")."
|
|
5641
5596
|
},
|
|
5642
5597
|
{
|
|
5643
5598
|
"kind": "Reference",
|
|
5644
|
-
"text": "
|
|
5645
|
-
"canonicalReference": "@genesislcap/
|
|
5599
|
+
"text": "AgentLifecycleContext",
|
|
5600
|
+
"canonicalReference": "@genesislcap/ai-assistant!AgentLifecycleContext:interface"
|
|
5646
5601
|
},
|
|
5647
5602
|
{
|
|
5648
5603
|
"kind": "Content",
|
|
5649
|
-
"text": "
|
|
5604
|
+
"text": ") => void | "
|
|
5650
5605
|
},
|
|
5651
5606
|
{
|
|
5652
5607
|
"kind": "Reference",
|
|
5653
|
-
"text": "
|
|
5654
|
-
"canonicalReference": "
|
|
5608
|
+
"text": "Promise",
|
|
5609
|
+
"canonicalReference": "!Promise:interface"
|
|
5655
5610
|
},
|
|
5656
5611
|
{
|
|
5657
5612
|
"kind": "Content",
|
|
5658
|
-
"text": ";\n }
|
|
5613
|
+
"text": "<void>;\n getDebugSnapshot?: () => unknown;\n }[];\n activeSystemPrompt: string;\n activePrimerHistory: "
|
|
5659
5614
|
},
|
|
5660
5615
|
{
|
|
5661
5616
|
"kind": "Reference",
|
|
@@ -5674,7 +5629,7 @@
|
|
|
5674
5629
|
"isStatic": false,
|
|
5675
5630
|
"returnTypeTokenRange": {
|
|
5676
5631
|
"startIndex": 1,
|
|
5677
|
-
"endIndex":
|
|
5632
|
+
"endIndex": 54
|
|
5678
5633
|
},
|
|
5679
5634
|
"releaseTag": "Beta",
|
|
5680
5635
|
"isProtected": false,
|
|
@@ -9630,6 +9585,51 @@
|
|
|
9630
9585
|
"endIndex": 2
|
|
9631
9586
|
}
|
|
9632
9587
|
},
|
|
9588
|
+
{
|
|
9589
|
+
"kind": "PropertySignature",
|
|
9590
|
+
"canonicalReference": "@genesislcap/ai-assistant!StatefulAgentInit#onUnresolvedTool:member",
|
|
9591
|
+
"docComment": "/**\n * Hook consulted when the model calls a tool that isn't dispatchable in the current state — a *stale* tool (valid in an earlier state of this agent) or an *unknown* one. Receives the current `state` alongside the attempted tool name and the currently dispatchable tools, so a machine-driven agent can return a step-aware redirect (e.g. \"that belongs to a later step — finish this one first\"). Return `undefined` to keep the framework default; a pre-init call also degrades to the default rather than throwing. See {@link UnresolvedToolContext}.\n */\n",
|
|
9592
|
+
"excerptTokens": [
|
|
9593
|
+
{
|
|
9594
|
+
"kind": "Content",
|
|
9595
|
+
"text": "onUnresolvedTool?: "
|
|
9596
|
+
},
|
|
9597
|
+
{
|
|
9598
|
+
"kind": "Content",
|
|
9599
|
+
"text": "(ctx: "
|
|
9600
|
+
},
|
|
9601
|
+
{
|
|
9602
|
+
"kind": "Reference",
|
|
9603
|
+
"text": "UnresolvedToolContext",
|
|
9604
|
+
"canonicalReference": "@genesislcap/ai-assistant!UnresolvedToolContext:interface"
|
|
9605
|
+
},
|
|
9606
|
+
{
|
|
9607
|
+
"kind": "Content",
|
|
9608
|
+
"text": " & {\n state: S;\n }) => string | undefined | "
|
|
9609
|
+
},
|
|
9610
|
+
{
|
|
9611
|
+
"kind": "Reference",
|
|
9612
|
+
"text": "Promise",
|
|
9613
|
+
"canonicalReference": "!Promise:interface"
|
|
9614
|
+
},
|
|
9615
|
+
{
|
|
9616
|
+
"kind": "Content",
|
|
9617
|
+
"text": "<string | undefined>"
|
|
9618
|
+
},
|
|
9619
|
+
{
|
|
9620
|
+
"kind": "Content",
|
|
9621
|
+
"text": ";"
|
|
9622
|
+
}
|
|
9623
|
+
],
|
|
9624
|
+
"isReadonly": false,
|
|
9625
|
+
"isOptional": true,
|
|
9626
|
+
"releaseTag": "Beta",
|
|
9627
|
+
"name": "onUnresolvedTool",
|
|
9628
|
+
"propertyTypeTokenRange": {
|
|
9629
|
+
"startIndex": 1,
|
|
9630
|
+
"endIndex": 6
|
|
9631
|
+
}
|
|
9632
|
+
},
|
|
9633
9633
|
{
|
|
9634
9634
|
"kind": "PropertySignature",
|
|
9635
9635
|
"canonicalReference": "@genesislcap/ai-assistant!StatefulAgentInit#primerHistory:member",
|
|
@@ -10974,6 +10974,149 @@
|
|
|
10974
10974
|
],
|
|
10975
10975
|
"extendsTokenRanges": []
|
|
10976
10976
|
},
|
|
10977
|
+
{
|
|
10978
|
+
"kind": "Interface",
|
|
10979
|
+
"canonicalReference": "@genesislcap/ai-assistant!UnresolvedToolContext:interface",
|
|
10980
|
+
"docComment": "/**\n * Context passed to an agent's `onUnresolvedTool` hook when the model calls a tool the driver cannot dispatch.\n *\n * @beta\n */\n",
|
|
10981
|
+
"excerptTokens": [
|
|
10982
|
+
{
|
|
10983
|
+
"kind": "Content",
|
|
10984
|
+
"text": "export interface UnresolvedToolContext "
|
|
10985
|
+
}
|
|
10986
|
+
],
|
|
10987
|
+
"fileUrlPath": "src/config/config.ts",
|
|
10988
|
+
"releaseTag": "Beta",
|
|
10989
|
+
"name": "UnresolvedToolContext",
|
|
10990
|
+
"preserveMemberOrder": false,
|
|
10991
|
+
"members": [
|
|
10992
|
+
{
|
|
10993
|
+
"kind": "PropertySignature",
|
|
10994
|
+
"canonicalReference": "@genesislcap/ai-assistant!UnresolvedToolContext#availableTools:member",
|
|
10995
|
+
"docComment": "/**\n * The tool names dispatchable right now, so the hook can steer the model back to a valid call.\n */\n",
|
|
10996
|
+
"excerptTokens": [
|
|
10997
|
+
{
|
|
10998
|
+
"kind": "Content",
|
|
10999
|
+
"text": "availableTools: "
|
|
11000
|
+
},
|
|
11001
|
+
{
|
|
11002
|
+
"kind": "Content",
|
|
11003
|
+
"text": "string[]"
|
|
11004
|
+
},
|
|
11005
|
+
{
|
|
11006
|
+
"kind": "Content",
|
|
11007
|
+
"text": ";"
|
|
11008
|
+
}
|
|
11009
|
+
],
|
|
11010
|
+
"isReadonly": false,
|
|
11011
|
+
"isOptional": false,
|
|
11012
|
+
"releaseTag": "Beta",
|
|
11013
|
+
"name": "availableTools",
|
|
11014
|
+
"propertyTypeTokenRange": {
|
|
11015
|
+
"startIndex": 1,
|
|
11016
|
+
"endIndex": 2
|
|
11017
|
+
}
|
|
11018
|
+
},
|
|
11019
|
+
{
|
|
11020
|
+
"kind": "PropertySignature",
|
|
11021
|
+
"canonicalReference": "@genesislcap/ai-assistant!UnresolvedToolContext#kind:member",
|
|
11022
|
+
"docComment": "/**\n * Why the call could not be dispatched: - `'stale'` — the tool was advertised earlier this activation but is not part of the current step (e.g. a stateful agent has moved on). - `'unknown'` — the tool was never advertised this activation (a hallucinated name).\n */\n",
|
|
11023
|
+
"excerptTokens": [
|
|
11024
|
+
{
|
|
11025
|
+
"kind": "Content",
|
|
11026
|
+
"text": "kind: "
|
|
11027
|
+
},
|
|
11028
|
+
{
|
|
11029
|
+
"kind": "Content",
|
|
11030
|
+
"text": "'stale' | 'unknown'"
|
|
11031
|
+
},
|
|
11032
|
+
{
|
|
11033
|
+
"kind": "Content",
|
|
11034
|
+
"text": ";"
|
|
11035
|
+
}
|
|
11036
|
+
],
|
|
11037
|
+
"isReadonly": false,
|
|
11038
|
+
"isOptional": false,
|
|
11039
|
+
"releaseTag": "Beta",
|
|
11040
|
+
"name": "kind",
|
|
11041
|
+
"propertyTypeTokenRange": {
|
|
11042
|
+
"startIndex": 1,
|
|
11043
|
+
"endIndex": 2
|
|
11044
|
+
}
|
|
11045
|
+
},
|
|
11046
|
+
{
|
|
11047
|
+
"kind": "PropertySignature",
|
|
11048
|
+
"canonicalReference": "@genesislcap/ai-assistant!UnresolvedToolContext#toolName:member",
|
|
11049
|
+
"docComment": "/**\n * The tool name the model attempted to call.\n */\n",
|
|
11050
|
+
"excerptTokens": [
|
|
11051
|
+
{
|
|
11052
|
+
"kind": "Content",
|
|
11053
|
+
"text": "toolName: "
|
|
11054
|
+
},
|
|
11055
|
+
{
|
|
11056
|
+
"kind": "Content",
|
|
11057
|
+
"text": "string"
|
|
11058
|
+
},
|
|
11059
|
+
{
|
|
11060
|
+
"kind": "Content",
|
|
11061
|
+
"text": ";"
|
|
11062
|
+
}
|
|
11063
|
+
],
|
|
11064
|
+
"isReadonly": false,
|
|
11065
|
+
"isOptional": false,
|
|
11066
|
+
"releaseTag": "Beta",
|
|
11067
|
+
"name": "toolName",
|
|
11068
|
+
"propertyTypeTokenRange": {
|
|
11069
|
+
"startIndex": 1,
|
|
11070
|
+
"endIndex": 2
|
|
11071
|
+
}
|
|
11072
|
+
}
|
|
11073
|
+
],
|
|
11074
|
+
"extendsTokenRanges": []
|
|
11075
|
+
},
|
|
11076
|
+
{
|
|
11077
|
+
"kind": "TypeAlias",
|
|
11078
|
+
"canonicalReference": "@genesislcap/ai-assistant!UnresolvedToolInput:type",
|
|
11079
|
+
"docComment": "/**\n * Optional per-agent hook consulted only on the already-failing unresolved-tool path — when the model calls a tool the driver cannot dispatch. Lets the agent replace the framework's default message with a context-aware redirect.\n *\n * Return a non-empty string to override the default tool-result message; return `undefined` (or an empty/whitespace string, or throw) to fall back to the framework default. The happy path is never affected. See {@link UnresolvedToolContext}.\n *\n * @beta\n */\n",
|
|
11080
|
+
"excerptTokens": [
|
|
11081
|
+
{
|
|
11082
|
+
"kind": "Content",
|
|
11083
|
+
"text": "export type UnresolvedToolInput = "
|
|
11084
|
+
},
|
|
11085
|
+
{
|
|
11086
|
+
"kind": "Content",
|
|
11087
|
+
"text": "(ctx: "
|
|
11088
|
+
},
|
|
11089
|
+
{
|
|
11090
|
+
"kind": "Reference",
|
|
11091
|
+
"text": "UnresolvedToolContext",
|
|
11092
|
+
"canonicalReference": "@genesislcap/ai-assistant!UnresolvedToolContext:interface"
|
|
11093
|
+
},
|
|
11094
|
+
{
|
|
11095
|
+
"kind": "Content",
|
|
11096
|
+
"text": ") => string | undefined | "
|
|
11097
|
+
},
|
|
11098
|
+
{
|
|
11099
|
+
"kind": "Reference",
|
|
11100
|
+
"text": "Promise",
|
|
11101
|
+
"canonicalReference": "!Promise:interface"
|
|
11102
|
+
},
|
|
11103
|
+
{
|
|
11104
|
+
"kind": "Content",
|
|
11105
|
+
"text": "<string | undefined>"
|
|
11106
|
+
},
|
|
11107
|
+
{
|
|
11108
|
+
"kind": "Content",
|
|
11109
|
+
"text": ";"
|
|
11110
|
+
}
|
|
11111
|
+
],
|
|
11112
|
+
"fileUrlPath": "src/config/config.ts",
|
|
11113
|
+
"releaseTag": "Beta",
|
|
11114
|
+
"name": "UnresolvedToolInput",
|
|
11115
|
+
"typeTokenRange": {
|
|
11116
|
+
"startIndex": 1,
|
|
11117
|
+
"endIndex": 6
|
|
11118
|
+
}
|
|
11119
|
+
},
|
|
10977
11120
|
{
|
|
10978
11121
|
"kind": "Variable",
|
|
10979
11122
|
"canonicalReference": "@genesislcap/ai-assistant!userIconSvg:var",
|
package/dist/ai-assistant.d.ts
CHANGED
|
@@ -578,6 +578,18 @@ declare interface BaseAgentConfig {
|
|
|
578
578
|
* @beta
|
|
579
579
|
*/
|
|
580
580
|
toolChoice?: ToolChoiceInput;
|
|
581
|
+
/**
|
|
582
|
+
* Optional hook consulted when the model calls a tool the driver cannot
|
|
583
|
+
* dispatch — either a *stale* tool (advertised earlier this activation but
|
|
584
|
+
* not part of the current step) or an *unknown* one (never advertised this
|
|
585
|
+
* activation). Return a context-aware redirect string to replace the
|
|
586
|
+
* framework's default message, or `undefined` to keep it. Consulted only on
|
|
587
|
+
* the already-failing unresolved-tool path; the happy path is unaffected.
|
|
588
|
+
* See {@link UnresolvedToolInput}.
|
|
589
|
+
*
|
|
590
|
+
* @beta
|
|
591
|
+
*/
|
|
592
|
+
onUnresolvedTool?: UnresolvedToolInput;
|
|
581
593
|
/**
|
|
582
594
|
* Optional primer history prepended to every call (not visible to the user).
|
|
583
595
|
* Used to establish agent identity and behavioural rules.
|
|
@@ -705,6 +717,14 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
705
717
|
* sent to the model — stored `history` stays unchanged for UI and logging.
|
|
706
718
|
*/
|
|
707
719
|
private providerHistoryTransform?;
|
|
720
|
+
/**
|
|
721
|
+
* Tool-declared condensation policies, keyed by tool-call id. Populated by
|
|
722
|
+
* `condenseWhen` (first-wins per call); read by `applyCondensation` before each
|
|
723
|
+
* provider call to collapse stale payloads from the model-bound history only.
|
|
724
|
+
* Accumulates across agents on a shared driver (a superseded read collapses no
|
|
725
|
+
* matter which agent made it) and is never cleared — it dies with the driver.
|
|
726
|
+
*/
|
|
727
|
+
private readonly condensePolicies;
|
|
708
728
|
/** Stack of fold frames — grows when a fold opens, shrinks when it closes. */
|
|
709
729
|
private foldStack;
|
|
710
730
|
/** Consecutive fold open/close ops without a real tool call. Reset on real tool execution. */
|
|
@@ -813,6 +833,13 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
813
833
|
* call; top-level turns are `'auto'`).
|
|
814
834
|
*/
|
|
815
835
|
private activeToolChoiceInput?;
|
|
836
|
+
/**
|
|
837
|
+
* Active agent's unresolved-tool hook, captured from `applyAgent`. Consulted
|
|
838
|
+
* only when a tool call cannot be dispatched (a stale or hallucinated name);
|
|
839
|
+
* `undefined` keeps the framework's default messages. See
|
|
840
|
+
* `resolveUnresolvedToolContent`.
|
|
841
|
+
*/
|
|
842
|
+
private activeOnUnresolvedTool?;
|
|
816
843
|
/**
|
|
817
844
|
* Caches validated provider lookups per name within the current agent. Cleared
|
|
818
845
|
* by `applyAgent` so each new agent's static/function-resolved names are
|
|
@@ -888,6 +915,15 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
888
915
|
* each specialist turn so the shared driver runs with the right tools and prompt.
|
|
889
916
|
*/
|
|
890
917
|
applyAgent(config: AgentConfig): void;
|
|
918
|
+
/**
|
|
919
|
+
* Resolve the tool-result content for an unresolved tool call. Consults the
|
|
920
|
+
* active agent's `onUnresolvedTool` hook (if any) with the attempted tool
|
|
921
|
+
* name, the failure `kind`, and the currently dispatchable tools, and returns
|
|
922
|
+
* the hook's non-empty string. Falls back to `fallback` when no hook is set,
|
|
923
|
+
* the hook returns nothing/empty, or the hook throws — so a misbehaving hook
|
|
924
|
+
* can never break tool dispatch.
|
|
925
|
+
*/
|
|
926
|
+
private resolveUnresolvedToolContent;
|
|
891
927
|
/**
|
|
892
928
|
* Returns the most recently resolved provider name. Falls back to the
|
|
893
929
|
* registry's default when no per-turn resolution has happened yet.
|
|
@@ -1045,6 +1081,10 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
1045
1081
|
* Centralised here so fold shortcut dispatch and the main tool loop use the
|
|
1046
1082
|
* same context without duplication.
|
|
1047
1083
|
*
|
|
1084
|
+
* @param active - The tool call this context belongs to (id + current loop
|
|
1085
|
+
* iteration). Threaded so `condenseWhen` can register against the right call
|
|
1086
|
+
* and stamp its age clock. Absent for dispatch paths with no addressable tool
|
|
1087
|
+
* call (e.g. the fold-close handler), where `condenseWhen` is a no-op.
|
|
1048
1088
|
* @param traceCapture - Optional per-invocation slot. When provided, the trace
|
|
1049
1089
|
* from any sub-agent call is written here rather than to shared instance state,
|
|
1050
1090
|
* so parallel tool calls each capture their own trace independently.
|
|
@@ -1693,44 +1733,25 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
1693
1733
|
meta: {
|
|
1694
1734
|
timestamp: string;
|
|
1695
1735
|
host: string;
|
|
1696
|
-
agentSummary:
|
|
1736
|
+
agentSummary: {
|
|
1697
1737
|
toolDefinitions: string | ChatToolDefinition[];
|
|
1698
|
-
toolHandlers: any;
|
|
1699
|
-
onActivate: any;
|
|
1700
|
-
onDeactivate: any;
|
|
1701
|
-
getDebugSnapshot: any;
|
|
1702
|
-
description: string;
|
|
1703
|
-
fallback?: never;
|
|
1704
|
-
excludeFromClassifier?: boolean;
|
|
1705
1738
|
name: string;
|
|
1706
|
-
displayName?: SystemPromptInput;
|
|
1707
|
-
systemPrompt?: SystemPromptInput;
|
|
1708
1739
|
provider?: ProviderInput;
|
|
1709
|
-
temperature?: TemperatureInput;
|
|
1710
|
-
toolChoice?: ToolChoiceInput;
|
|
1711
|
-
primerHistory?: ChatMessage[];
|
|
1712
|
-
subAgents?: AgentConfig[];
|
|
1713
1740
|
chatInputDuringExecution?: ChatInputDuringExecutionMode;
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
toolDefinitions: string | ChatToolDefinition[];
|
|
1717
|
-
toolHandlers: any;
|
|
1718
|
-
onActivate: any;
|
|
1719
|
-
onDeactivate: any;
|
|
1720
|
-
getDebugSnapshot: any;
|
|
1721
|
-
fallback: true;
|
|
1722
|
-
description?: never;
|
|
1723
|
-
name: string;
|
|
1741
|
+
description?: string;
|
|
1742
|
+
fallback?: true;
|
|
1724
1743
|
displayName?: SystemPromptInput;
|
|
1725
1744
|
systemPrompt?: SystemPromptInput;
|
|
1726
|
-
provider?: ProviderInput;
|
|
1727
1745
|
temperature?: TemperatureInput;
|
|
1728
1746
|
toolChoice?: ToolChoiceInput;
|
|
1747
|
+
onUnresolvedTool?: UnresolvedToolInput;
|
|
1729
1748
|
primerHistory?: ChatMessage[];
|
|
1730
1749
|
subAgents?: AgentConfig[];
|
|
1731
|
-
chatInputDuringExecution?: ChatInputDuringExecutionMode;
|
|
1732
1750
|
manualSelection?: ManualSelectionConfig;
|
|
1733
|
-
|
|
1751
|
+
onActivate?: (ctx: AgentLifecycleContext) => void | Promise<void>;
|
|
1752
|
+
onDeactivate?: (ctx: AgentLifecycleContext) => void | Promise<void>;
|
|
1753
|
+
getDebugSnapshot?: () => unknown;
|
|
1754
|
+
}[];
|
|
1734
1755
|
activeSystemPrompt: string;
|
|
1735
1756
|
activePrimerHistory: ChatMessage[];
|
|
1736
1757
|
activeFoldStack: string[];
|
|
@@ -1958,7 +1979,7 @@ declare type MetaEventImportance = 'high' | 'normal' | 'low';
|
|
|
1958
1979
|
* Catalogue of meta event names. This is the documented surface — extend it as
|
|
1959
1980
|
* new events are wired in (Tier 2/3 lifecycle, interaction, provider events).
|
|
1960
1981
|
*/
|
|
1961
|
-
declare type MetaEventType = 'assistant.connected' | 'assistant.disconnected' | 'assistant.popout' | 'assistant.popin' | 'driver.created' | 'driver.wired' | 'driver.unwired' | 'state.changed' | 'turn.start' | 'turn.end' | 'turn.retry' | 'turn.error' | 'tool.failed' | 'tool.unresolved' | 'subagent.started' | 'subagent.completed' | 'subagent.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';
|
|
1982
|
+
declare type MetaEventType = 'assistant.connected' | 'assistant.disconnected' | 'assistant.popout' | 'assistant.popin' | 'driver.created' | 'driver.wired' | 'driver.unwired' | 'state.changed' | 'turn.start' | 'turn.end' | 'turn.retry' | 'turn.error' | 'tool.failed' | 'tool.unresolved' | 'subagent.started' | 'subagent.completed' | 'subagent.failed' | 'agent.handoff' | 'agent.pinned' | 'agent.unpinned' | 'provider.selected' | 'interaction.requested' | 'interaction.resolved' | 'context.updated' | 'context.threshold-crossed' | 'context.condensed' | 'panel.toggled' | 'attachment.added' | 'file.read-failed' | 'suggestions.failed';
|
|
1962
1983
|
|
|
1963
1984
|
/**
|
|
1964
1985
|
* Orchestrates multiple specialist agents. Sits between `FoundationAiAssistant`
|
|
@@ -2260,6 +2281,19 @@ export declare interface StatefulAgentInit<S> {
|
|
|
2260
2281
|
* for the default.
|
|
2261
2282
|
*/
|
|
2262
2283
|
toolChoice?: ChatToolChoice | ((ctx: StatefulAgentContext<S>) => ChatToolChoice | Promise<ChatToolChoice>);
|
|
2284
|
+
/**
|
|
2285
|
+
* Hook consulted when the model calls a tool that isn't dispatchable in the
|
|
2286
|
+
* current state — a *stale* tool (valid in an earlier state of this agent) or
|
|
2287
|
+
* an *unknown* one. Receives the current `state` alongside the attempted tool
|
|
2288
|
+
* name and the currently dispatchable tools, so a machine-driven agent can
|
|
2289
|
+
* return a step-aware redirect (e.g. "that belongs to a later step — finish
|
|
2290
|
+
* this one first"). Return `undefined` to keep the framework default; a
|
|
2291
|
+
* pre-init call also degrades to the default rather than throwing.
|
|
2292
|
+
* See {@link UnresolvedToolContext}.
|
|
2293
|
+
*/
|
|
2294
|
+
onUnresolvedTool?: (ctx: UnresolvedToolContext & {
|
|
2295
|
+
state: S;
|
|
2296
|
+
}) => string | undefined | Promise<string | undefined>;
|
|
2263
2297
|
/**
|
|
2264
2298
|
* Optional getter for the debug-log snapshot. Defaults to auto-snapshotting
|
|
2265
2299
|
* any property on `state` that looks like a foundation-state-machine
|
|
@@ -2497,6 +2531,44 @@ export declare interface TurnSnapshot {
|
|
|
2497
2531
|
agentSnapshot?: unknown;
|
|
2498
2532
|
}
|
|
2499
2533
|
|
|
2534
|
+
/**
|
|
2535
|
+
* Context passed to an agent's `onUnresolvedTool` hook when the model calls a
|
|
2536
|
+
* tool the driver cannot dispatch.
|
|
2537
|
+
*
|
|
2538
|
+
* @beta
|
|
2539
|
+
*/
|
|
2540
|
+
export declare interface UnresolvedToolContext {
|
|
2541
|
+
/** The tool name the model attempted to call. */
|
|
2542
|
+
toolName: string;
|
|
2543
|
+
/**
|
|
2544
|
+
* Why the call could not be dispatched:
|
|
2545
|
+
* - `'stale'` — the tool was advertised earlier this activation but is not
|
|
2546
|
+
* part of the current step (e.g. a stateful agent has moved on).
|
|
2547
|
+
* - `'unknown'` — the tool was never advertised this activation (a
|
|
2548
|
+
* hallucinated name).
|
|
2549
|
+
*/
|
|
2550
|
+
kind: 'stale' | 'unknown';
|
|
2551
|
+
/**
|
|
2552
|
+
* The tool names dispatchable right now, so the hook can steer the model
|
|
2553
|
+
* back to a valid call.
|
|
2554
|
+
*/
|
|
2555
|
+
availableTools: string[];
|
|
2556
|
+
}
|
|
2557
|
+
|
|
2558
|
+
/**
|
|
2559
|
+
* Optional per-agent hook consulted only on the already-failing unresolved-tool
|
|
2560
|
+
* path — when the model calls a tool the driver cannot dispatch. Lets the agent
|
|
2561
|
+
* replace the framework's default message with a context-aware redirect.
|
|
2562
|
+
*
|
|
2563
|
+
* Return a non-empty string to override the default tool-result message; return
|
|
2564
|
+
* `undefined` (or an empty/whitespace string, or throw) to fall back to the
|
|
2565
|
+
* framework default. The happy path is never affected. See
|
|
2566
|
+
* {@link UnresolvedToolContext}.
|
|
2567
|
+
*
|
|
2568
|
+
* @beta
|
|
2569
|
+
*/
|
|
2570
|
+
export declare type UnresolvedToolInput = (ctx: UnresolvedToolContext) => string | undefined | Promise<string | undefined>;
|
|
2571
|
+
|
|
2500
2572
|
/** Person silhouette — default user avatar. */
|
|
2501
2573
|
export declare const userIconSvg = "<svg viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z\" fill=\"currentColor\"/></svg>";
|
|
2502
2574
|
|