@genesislcap/ai-assistant 14.434.0 → 14.436.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 +1513 -70
- package/dist/ai-assistant.d.ts +367 -7
- package/dist/dts/components/ai-driver/ai-driver.d.ts +8 -0
- package/dist/dts/components/ai-driver/ai-driver.d.ts.map +1 -1
- package/dist/dts/components/chat-driver/chat-driver.d.ts +79 -3
- package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts +23 -0
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts.map +1 -1
- package/dist/dts/config/config.d.ts +106 -2
- package/dist/dts/config/config.d.ts.map +1 -1
- package/dist/dts/config/define-stateful-agent.d.ts +115 -0
- package/dist/dts/config/define-stateful-agent.d.ts.map +1 -0
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/main/main.d.ts +36 -4
- package/dist/dts/main/main.d.ts.map +1 -1
- package/dist/dts/main/main.template.d.ts.map +1 -1
- package/dist/esm/components/chat-driver/chat-driver.js +126 -11
- package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +192 -33
- package/dist/esm/config/define-stateful-agent.js +174 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/main/main.js +164 -21
- package/dist/esm/main/main.template.js +2 -11
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -16
- package/src/components/ai-driver/ai-driver.ts +9 -0
- package/src/components/chat-driver/chat-driver.ts +178 -8
- package/src/components/orchestrating-driver/orchestrating-driver.ts +191 -17
- package/src/config/config.ts +112 -2
- package/src/config/define-stateful-agent.ts +293 -0
- package/src/index.ts +1 -0
- package/src/main/main.template.ts +2 -9
- package/src/main/main.ts +167 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-driver.d.ts","sourceRoot":"","sources":["../../../../src/components/chat-driver/chat-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,WAAW,
|
|
1
|
+
{"version":3,"file":"chat-driver.d.ts","sourceRoot":"","sources":["../../../../src/components/chat-driver/chat-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,WAAW,EAIX,gBAAgB,EAEjB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EACV,WAAW,EAEX,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAUxE,wFAAwF;AACxF,eAAO,MAAM,yBAAyB,yBAAyB,CAAC;AAMhE;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC;AAE9E;;;;;;;;;GASG;AACH,MAAM,WAAW,YAAY;IAC3B,qFAAqF;IACrF,SAAS,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qGAAqG;IACrG,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,gGAAgG;IAChG,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAQD;;;;;;;;;GASG;AACH,qBAAa,UAAW,SAAQ,WAAY,YAAW,QAAQ;IAgF3D,OAAO,CAAC,QAAQ,CAAC,UAAU;IAK3B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IApFpC,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,mBAAmB,CAGvB;IAEJ,OAAO,CAAC,YAAY,CAAC,CA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mBAAmB,CAAC,eAAe,CAAC,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAwBrF,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;YAiCrB,WAAW;IAyWzB,OAAO,CAAC,eAAe;CAWxB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AIProvider, ChatAttachment, ChatDriverResult, ChatMessage } from '@genesislcap/foundation-ai';
|
|
2
2
|
import type { AgentConfig } from '../../config/config';
|
|
3
3
|
import type { AiDriver, AllAgentSummary } from '../ai-driver/ai-driver';
|
|
4
|
+
import { type TurnSnapshot } from '../chat-driver/chat-driver';
|
|
4
5
|
/**
|
|
5
6
|
* Orchestrates multiple specialist agents. Sits between `FoundationAiAssistant`
|
|
6
7
|
* and `ChatDriver`, classifying each user message and routing it to the right
|
|
@@ -17,14 +18,22 @@ export declare class OrchestratingDriver extends EventTarget implements AiDriver
|
|
|
17
18
|
private readonly maxHandoffs;
|
|
18
19
|
private readonly classifierHistoryLength;
|
|
19
20
|
private readonly classifierRetries;
|
|
21
|
+
private readonly sessionKey;
|
|
22
|
+
/**
|
|
23
|
+
* Aborted on driver disposal. Threaded into `AgentLifecycleContext.signal`
|
|
24
|
+
* so long-running `onActivate` work can bail if the session disconnects.
|
|
25
|
+
*/
|
|
26
|
+
private readonly lifecycleAbortController;
|
|
20
27
|
private pinnedAgentName;
|
|
21
28
|
activeAgent?: AgentConfig;
|
|
22
29
|
constructor(aiProvider: AIProvider, agents: AgentConfig[], options?: {
|
|
30
|
+
sessionKey?: string;
|
|
23
31
|
maxHandoffs?: number;
|
|
24
32
|
classifierHistoryLength?: number;
|
|
25
33
|
classifierRetries?: number;
|
|
26
34
|
maxToolIterations?: number;
|
|
27
35
|
maxFoldOperations?: number;
|
|
36
|
+
maxTurnSnapshots?: number;
|
|
28
37
|
});
|
|
29
38
|
resolveInteraction(interactionId: string, result: unknown): void;
|
|
30
39
|
isBusy(): boolean;
|
|
@@ -37,10 +46,24 @@ export declare class OrchestratingDriver extends EventTarget implements AiDriver
|
|
|
37
46
|
setPinnedAgent(name: string | null): void;
|
|
38
47
|
loadHistory(messages: ChatMessage[]): void;
|
|
39
48
|
getRawHistory(): readonly ChatMessage[];
|
|
49
|
+
/** Delegates to the inner {@link ChatDriver} — turns are captured there. */
|
|
50
|
+
getTurnSnapshots(): ReadonlyArray<TurnSnapshot>;
|
|
40
51
|
getSuggestions(history: ChatMessage[], prompt: string, count: number, allAgentInfo?: AllAgentSummary[]): Promise<string[]>;
|
|
41
52
|
sendMessage(input: string, attachments?: ChatAttachment[]): Promise<ChatDriverResult>;
|
|
42
53
|
continueFromHistory(transientPrimer?: ChatMessage[]): Promise<ChatDriverResult>;
|
|
43
54
|
private applyAgent;
|
|
55
|
+
/**
|
|
56
|
+
* Release the current stateful agent: fire `onDeactivate`, clear the pin,
|
|
57
|
+
* dispatch events so the host (and Redux) reflect the unpinned state. Called
|
|
58
|
+
* automatically when a tool handler invokes `context.releaseAgent`.
|
|
59
|
+
*/
|
|
60
|
+
private releaseActiveAgent;
|
|
61
|
+
/**
|
|
62
|
+
* Fire `onDeactivate` on the current active agent and abort any pending
|
|
63
|
+
* lifecycle work. Called by the host on session teardown so machines can
|
|
64
|
+
* release resources cleanly.
|
|
65
|
+
*/
|
|
66
|
+
dispose(): Promise<void>;
|
|
44
67
|
private classify;
|
|
45
68
|
/**
|
|
46
69
|
* Returns the pinned agent if `pinnedAgentName` matches a known specialist or
|
|
@@ -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,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,WAAW,EAEZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"orchestrating-driver.d.ts","sourceRoot":"","sources":["../../../../src/components/orchestrating-driver/orchestrating-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,WAAW,EAEZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,WAAW,EAKZ,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,4BAA4B,CAAC;AAoDpC;;;;;;GAMG;AACH,qBAAa,mBAAoB,SAAQ,WAAY,YAAW,QAAQ;IAkBpE,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAlBzB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA0B;IACtD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAsB;IAChD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAS;IACjD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAyB;IAClE,OAAO,CAAC,eAAe,CAAuB;IAE9C,WAAW,CAAC,EAAE,WAAW,CAAC;gBAGP,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,WAAW,EAAE,EACtC,OAAO,GAAE;QACP,UAAU,CAAC,EAAE,MAAM,CAAC;QACp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
|
|
2
2
|
export type { ChatInputDuringExecutionMode };
|
|
3
|
+
/**
|
|
4
|
+
* Context passed to `onActivate` / `onDeactivate` lifecycle hooks on an agent.
|
|
5
|
+
*
|
|
6
|
+
* @beta
|
|
7
|
+
*/
|
|
8
|
+
export interface AgentLifecycleContext {
|
|
9
|
+
/** The agent the hook is firing for. */
|
|
10
|
+
agentName: string;
|
|
11
|
+
/** The assistant session key — stable across reloads, unique per assistant instance. */
|
|
12
|
+
sessionKey: string;
|
|
13
|
+
/** The agent that was active immediately before this one, if any. Only set on `onActivate`. */
|
|
14
|
+
previousAgentName?: string;
|
|
15
|
+
/** Aborted if the session disconnects mid-activation. */
|
|
16
|
+
signal: AbortSignal;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Context passed to the function form of `systemPrompt` / `toolDefinitions`.
|
|
20
|
+
* Resolved each tool-loop iteration so the agent can vary what the LLM sees per turn.
|
|
21
|
+
*
|
|
22
|
+
* @beta
|
|
23
|
+
*/
|
|
24
|
+
export interface SystemPromptContext {
|
|
25
|
+
/** The active agent's name. */
|
|
26
|
+
agentName: string;
|
|
27
|
+
/** Full conversation history up to (but not including) the message being processed. */
|
|
28
|
+
history: ReadonlyArray<ChatMessage>;
|
|
29
|
+
/** 0 = first LLM call this turn; > 0 = retry or subsequent tool-loop iteration. */
|
|
30
|
+
turnIndex: number;
|
|
31
|
+
/** Aborted if the turn is cancelled. */
|
|
32
|
+
signal: AbortSignal;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* System prompt for an agent. Either a static string (resolved once) or a function
|
|
36
|
+
* resolved each tool-loop iteration. The function form lets the agent compute the
|
|
37
|
+
* prompt from external state — e.g. a state machine's current step.
|
|
38
|
+
*
|
|
39
|
+
* @beta
|
|
40
|
+
*/
|
|
41
|
+
export type SystemPromptInput = string | ((ctx: SystemPromptContext) => string | Promise<string>);
|
|
42
|
+
/**
|
|
43
|
+
* Tool definitions for an agent. Either a static array (the conventional shape) or
|
|
44
|
+
* a function resolved each tool-loop iteration. The function form lets the agent
|
|
45
|
+
* narrow the tool surface per turn — e.g. expose only the tools valid in the
|
|
46
|
+
* current state of a state machine.
|
|
47
|
+
*
|
|
48
|
+
* @beta
|
|
49
|
+
*/
|
|
50
|
+
export type ToolDefinitionsInput = ChatToolDefinition[] | ((ctx: SystemPromptContext) => ChatToolDefinition[] | Promise<ChatToolDefinition[]>);
|
|
3
51
|
/**
|
|
4
52
|
* Opts an agent in to manual selection from the assistant's agent picker.
|
|
5
53
|
*
|
|
@@ -26,12 +74,21 @@ interface BaseAgentConfig {
|
|
|
26
74
|
name: string;
|
|
27
75
|
/**
|
|
28
76
|
* System prompt injected into every conversation turn for this agent.
|
|
77
|
+
*
|
|
78
|
+
* Either a string (resolved once) or a function resolved each tool-loop
|
|
79
|
+
* iteration — pick the function form when the prompt depends on per-turn state
|
|
80
|
+
* (e.g. a state machine's current step). See {@link SystemPromptInput}.
|
|
29
81
|
*/
|
|
30
|
-
systemPrompt?:
|
|
82
|
+
systemPrompt?: SystemPromptInput;
|
|
31
83
|
/**
|
|
32
84
|
* Tool definitions (JSON Schema) passed to the AI provider for this agent.
|
|
85
|
+
*
|
|
86
|
+
* Either a static array or a function resolved each tool-loop iteration —
|
|
87
|
+
* pick the function form to narrow the tool surface per turn (e.g. expose
|
|
88
|
+
* only the tools valid in the current state of a state machine).
|
|
89
|
+
* See {@link ToolDefinitionsInput}.
|
|
33
90
|
*/
|
|
34
|
-
toolDefinitions?:
|
|
91
|
+
toolDefinitions?: ToolDefinitionsInput;
|
|
35
92
|
/**
|
|
36
93
|
* Tool handler implementations for this agent.
|
|
37
94
|
*/
|
|
@@ -56,6 +113,40 @@ interface BaseAgentConfig {
|
|
|
56
113
|
* disabled. See {@link ManualSelectionConfig}.
|
|
57
114
|
*/
|
|
58
115
|
manualSelection?: ManualSelectionConfig;
|
|
116
|
+
/**
|
|
117
|
+
* Fires when this agent becomes the active specialist (including being pinned).
|
|
118
|
+
* Use to instantiate per-agent state that should outlive a single turn — e.g.
|
|
119
|
+
* a state machine the agent owns across the conversation. Awaited before the
|
|
120
|
+
* agent's first turn runs.
|
|
121
|
+
*
|
|
122
|
+
* Capture dependencies (services, redux store refs, etc.) via closure on the
|
|
123
|
+
* host element rather than expecting them on the context.
|
|
124
|
+
*
|
|
125
|
+
* @beta
|
|
126
|
+
*/
|
|
127
|
+
onActivate?: (ctx: AgentLifecycleContext) => void | Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Fires when this agent is being deactivated (the user switches to another
|
|
130
|
+
* agent, the session is torn down, or the agent is unpinned and replaced).
|
|
131
|
+
* Use to dispose per-agent state created in `onActivate`. Awaited before the
|
|
132
|
+
* incoming agent's `onActivate` runs.
|
|
133
|
+
*
|
|
134
|
+
* @beta
|
|
135
|
+
*/
|
|
136
|
+
onDeactivate?: (ctx: AgentLifecycleContext) => void | Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Returns an agent-supplied debug payload for the export log. Called once per
|
|
139
|
+
* LLM call by the driver (alongside the resolved prompt and tool list) and
|
|
140
|
+
* once at log-export time for the latest snapshot. Stateful agents should
|
|
141
|
+
* return their machine state and captured context so the exported timeline
|
|
142
|
+
* captures what drove each turn.
|
|
143
|
+
*
|
|
144
|
+
* Return value must be JSON-serializable. {@link defineStatefulAgent} wires a
|
|
145
|
+
* sensible default that snapshots any machine-shaped state automatically.
|
|
146
|
+
*
|
|
147
|
+
* @beta
|
|
148
|
+
*/
|
|
149
|
+
getDebugSnapshot?: () => unknown;
|
|
59
150
|
}
|
|
60
151
|
/**
|
|
61
152
|
* Configuration for a specialist agent.
|
|
@@ -73,6 +164,19 @@ export interface SpecialistAgentConfig extends BaseAgentConfig {
|
|
|
73
164
|
*/
|
|
74
165
|
description: string;
|
|
75
166
|
fallback?: never;
|
|
167
|
+
/**
|
|
168
|
+
* When `true`, the classifier never auto-routes to this agent. The user can
|
|
169
|
+
* still select it manually via the picker, provided both prerequisites are
|
|
170
|
+
* met: this agent has `manualSelection.enabled` set to `true`, *and* the
|
|
171
|
+
* assistant has the picker enabled via `chatConfig.picker.mode`.
|
|
172
|
+
*
|
|
173
|
+
* Use this for agents that overlap heavily with a sibling (e.g. a guided
|
|
174
|
+
* wizard sitting next to a free-form agent in the same domain) and should
|
|
175
|
+
* only be reached intentionally rather than via classifier routing.
|
|
176
|
+
*
|
|
177
|
+
* @beta
|
|
178
|
+
*/
|
|
179
|
+
excludeFromClassifier?: boolean;
|
|
76
180
|
}
|
|
77
181
|
/**
|
|
78
182
|
* Configuration for a fallback agent.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AAEpC,YAAY,EAAE,4BAA4B,EAAE,CAAC;AAE7C;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,UAAU,eAAe;IACvB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AAEpC,YAAY,EAAE,4BAA4B,EAAE,CAAC;AAE7C;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,wFAAwF;IACxF,UAAU,EAAE,MAAM,CAAC;IACnB,+FAA+F;IAC/F,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,yDAAyD;IACzD,MAAM,EAAE,WAAW,CAAC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,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,qBAAqB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE;;;;;;;;;;;OAWG;IACH,gBAAgB,CAAC,EAAE,MAAM,OAAO,CAAC;CAClC;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB;;;;;;;;;;;OAWG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D;;OAEG;IACH,QAAQ,EAAE,IAAI,CAAC;IACf,WAAW,CAAC,EAAE,KAAK,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,qBAAqB,GAAG,mBAAmB,CAAC;AAEtE;;;;;;;;;;;;;;GAcG;AAEH,wBAAgB,WAAW,CAAC,KAAK,CAAC,CAAC,SAAS,WAAW,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAErE"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { ChatMessage, ChatToolDefinition, ChatToolHandlers } from '@genesislcap/foundation-ai';
|
|
2
|
+
import type { AgentConfig, AgentLifecycleContext, ChatInputDuringExecutionMode, ManualSelectionConfig, SystemPromptContext } from './config';
|
|
3
|
+
/**
|
|
4
|
+
* Init options for {@link defineStatefulAgent}. Generic over the state shape `S`
|
|
5
|
+
* the agent owns (a state machine, an observable controller, anything).
|
|
6
|
+
*
|
|
7
|
+
* The helper threads `state` through `systemPrompt`, `toolDefinitions`, and the
|
|
8
|
+
* `toolHandlers` factory so consumer code never has to reach for a closure or
|
|
9
|
+
* a module-level mutable.
|
|
10
|
+
*
|
|
11
|
+
* @beta
|
|
12
|
+
*/
|
|
13
|
+
export interface StatefulAgentInit<S> {
|
|
14
|
+
/** Display name — must be unique within the agents array. */
|
|
15
|
+
name: string;
|
|
16
|
+
/** Plain-language description used by the classifier. Required: stateful agents are always specialists. */
|
|
17
|
+
description: string;
|
|
18
|
+
/**
|
|
19
|
+
* Hide this agent from the classifier — only reachable via manual pinning.
|
|
20
|
+
* Stateful agents are always specialists; they cannot be the fallback (a
|
|
21
|
+
* fallback is a leaf invoked when no specialist matches, with no flow to
|
|
22
|
+
* own state for).
|
|
23
|
+
*/
|
|
24
|
+
excludeFromClassifier?: boolean;
|
|
25
|
+
/** Static primer history prepended to every call (not visible to the user). */
|
|
26
|
+
primerHistory?: ChatMessage[];
|
|
27
|
+
/** Sub-agents available to this agent's tool handlers via `requestSubAgent`. */
|
|
28
|
+
subAgents?: AgentConfig[];
|
|
29
|
+
/** Opt this agent in to manual picker selection. */
|
|
30
|
+
manualSelection?: ManualSelectionConfig;
|
|
31
|
+
/** How the main chat input behaves while this agent is executing. */
|
|
32
|
+
chatInputDuringExecution?: ChatInputDuringExecutionMode;
|
|
33
|
+
/**
|
|
34
|
+
* Construct the agent-scoped state. Called by the framework when this agent
|
|
35
|
+
* becomes active (`onActivate`). Awaited before the agent's first turn runs.
|
|
36
|
+
*/
|
|
37
|
+
init: (ctx: AgentLifecycleContext) => S | Promise<S>;
|
|
38
|
+
/**
|
|
39
|
+
* Tear down the agent-scoped state. Called when the agent is being replaced.
|
|
40
|
+
* Awaited before the incoming agent's `init` runs.
|
|
41
|
+
*/
|
|
42
|
+
dispose?: (ctx: AgentLifecycleContext & {
|
|
43
|
+
state: S;
|
|
44
|
+
}) => void | Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* System prompt composed from current state. Resolved each tool-loop
|
|
47
|
+
* iteration. Use this to feed the LLM whatever the current state implies
|
|
48
|
+
* (e.g. a state machine's `meta.systemPrompt` plus captured context).
|
|
49
|
+
*/
|
|
50
|
+
systemPrompt?: (ctx: SystemPromptContext & {
|
|
51
|
+
state: S;
|
|
52
|
+
}) => string | Promise<string>;
|
|
53
|
+
/**
|
|
54
|
+
* Tool definitions the LLM sees. Either a static array (resolved once) or a
|
|
55
|
+
* function resolved each tool-loop iteration. The function form is how a
|
|
56
|
+
* machine-driven agent narrows the surface per state.
|
|
57
|
+
*
|
|
58
|
+
* **Constraint:** the resolved handlers (returned from {@link StatefulAgentInit.toolHandlers})
|
|
59
|
+
* must not include fold facades. Folds are an LLM-driven UX optimisation
|
|
60
|
+
* that competes with the machine for control of the tool view; one of them
|
|
61
|
+
* has to be in charge. Helper throws at init time if a fold-tagged handler
|
|
62
|
+
* is detected.
|
|
63
|
+
*/
|
|
64
|
+
toolDefinitions?: ChatToolDefinition[] | ((ctx: SystemPromptContext & {
|
|
65
|
+
state: S;
|
|
66
|
+
}) => ChatToolDefinition[] | Promise<ChatToolDefinition[]>);
|
|
67
|
+
/**
|
|
68
|
+
* Factory returning the tool handler map. Called with the live `state` at
|
|
69
|
+
* `onActivate` time; the handlers it returns are cached for the lifetime of
|
|
70
|
+
* this activation. Each handler closes over `state` and any other deps you
|
|
71
|
+
* captured.
|
|
72
|
+
*
|
|
73
|
+
* The handler set returned must be the **union** of every tool name your
|
|
74
|
+
* agent might advertise across all states — `toolDefinitions` filters which
|
|
75
|
+
* are visible to the LLM per turn, but every name still needs an entry here.
|
|
76
|
+
*/
|
|
77
|
+
toolHandlers?: (state: S) => ChatToolHandlers;
|
|
78
|
+
/**
|
|
79
|
+
* Optional getter for the debug-log snapshot. Defaults to auto-snapshotting
|
|
80
|
+
* any property on `state` that looks like a foundation-state-machine
|
|
81
|
+
* instance (has `state`, `context`, and `complete` fields). Override when
|
|
82
|
+
* the default doesn't capture what you need — e.g. multiple machines, or
|
|
83
|
+
* non-machine state worth recording.
|
|
84
|
+
*
|
|
85
|
+
* Return value must be JSON-serializable.
|
|
86
|
+
*/
|
|
87
|
+
getDebugSnapshot?: (state: S) => unknown;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Build an `AgentConfig` whose `systemPrompt`, `toolDefinitions`, and tool
|
|
91
|
+
* handlers all close over a long-lived state object created on activation.
|
|
92
|
+
*
|
|
93
|
+
* The framework wires the lifecycle: `init` on `onActivate`, `dispose` on
|
|
94
|
+
* `onDeactivate`. State is held inside the helper's closure — never exposed on
|
|
95
|
+
* the resulting `AgentConfig` — so the redux serializer doesn't see it.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* const guidedBooking = defineStatefulAgent<{ machine: GuidedBookingMachine }>({
|
|
100
|
+
* name: 'Guided Booking',
|
|
101
|
+
* description: 'Books a trade via a guided wizard.',
|
|
102
|
+
* excludeFromClassifier: true,
|
|
103
|
+
* manualSelection: { enabled: true, hint: 'Step-by-step trade booking' },
|
|
104
|
+
* init: () => ({ machine: new GuidedBookingMachine() }),
|
|
105
|
+
* dispose: ({ state }) => state.machine.stop(),
|
|
106
|
+
* systemPrompt: ({ state }) => composeFromMachine(state.machine),
|
|
107
|
+
* toolDefinitions: ({ state }) => toolsForState(state.machine.state),
|
|
108
|
+
* toolHandlers: ({ machine }) => ({ ... }),
|
|
109
|
+
* });
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* @beta
|
|
113
|
+
*/
|
|
114
|
+
export declare function defineStatefulAgent<S>(opts: StatefulAgentInit<S>): AgentConfig;
|
|
115
|
+
//# sourceMappingURL=define-stateful-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-stateful-agent.d.ts","sourceRoot":"","sources":["../../../src/config/define-stateful-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEpG,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACrB,4BAA4B,EAC5B,qBAAqB,EACrB,mBAAmB,EAEpB,MAAM,UAAU,C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AAC;CAC1C;AAsCD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,WAAW,CAiI9E"}
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from './components/popout-manager';
|
|
|
9
9
|
export * from './channel/ai-activity-channel';
|
|
10
10
|
export * from './channel/ai-activity-bus';
|
|
11
11
|
export * from './config/config';
|
|
12
|
+
export * from './config/define-stateful-agent';
|
|
12
13
|
export * from './config/fallback-agents';
|
|
13
14
|
export * from './utils/tool-fold';
|
|
14
15
|
export type { AiChatWidget } from './types/ai-chat-widget';
|
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,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,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC"}
|
package/dist/dts/main/main.d.ts
CHANGED
|
@@ -177,6 +177,14 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
177
177
|
* current agent configuration. Does not wire event listeners or register in
|
|
178
178
|
* the driver registry.
|
|
179
179
|
*/
|
|
180
|
+
/**
|
|
181
|
+
* Warn at config time if any stateful agent (one with lifecycle hooks) is
|
|
182
|
+
* configured in a way that makes it unreachable: `excludeFromClassifier`
|
|
183
|
+
* removes the classifier path, so the only entry left is manual pinning —
|
|
184
|
+
* which requires both `manualSelection.enabled` on the agent and the picker
|
|
185
|
+
* itself being enabled at the assistant level.
|
|
186
|
+
*/
|
|
187
|
+
private warnUnreachableStatefulAgents;
|
|
180
188
|
private createDriver;
|
|
181
189
|
/**
|
|
182
190
|
* Attaches event listeners to the current driver. Stores a cleanup function
|
|
@@ -235,6 +243,21 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
235
243
|
get agentPickerEnabled(): boolean;
|
|
236
244
|
/** Hint text for the currently pinned agent, if any. Used in the toggle button tooltip. */
|
|
237
245
|
get pinnedAgentHint(): string | undefined;
|
|
246
|
+
/**
|
|
247
|
+
* The pin is locked when a stateful agent (one with lifecycle hooks) is
|
|
248
|
+
* *actively running* — i.e. its `onActivate` has fired and it owns live
|
|
249
|
+
* state. Until the user sends their first message, a freshly pinned stateful
|
|
250
|
+
* agent is not yet active and the picker should remain free; the user might
|
|
251
|
+
* change their mind and unpin without anything to clean up.
|
|
252
|
+
*
|
|
253
|
+
* We derive from `activeAgent` (set by the orchestrator after `onActivate`
|
|
254
|
+
* completes) rather than `pinnedAgentName` (set immediately on picker
|
|
255
|
+
* click). The serialized `activeAgent` strips lifecycle hooks, so we look
|
|
256
|
+
* up the live config from `this.agents` to check for them.
|
|
257
|
+
*/
|
|
258
|
+
get pinLocked(): boolean;
|
|
259
|
+
/** Tooltip shown on the picker toggle button. */
|
|
260
|
+
get agentToggleTitle(): string;
|
|
238
261
|
/**
|
|
239
262
|
* Tint applied to the pin icon when an agent is pinned. Picked from the
|
|
240
263
|
* brand palette by agent position (modulo the palette length), so each agent
|
|
@@ -259,23 +282,30 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
259
282
|
timestamp: string;
|
|
260
283
|
host: string;
|
|
261
284
|
agentSummary: ({
|
|
262
|
-
toolDefinitions: import("../utils/tool-fold").ToolTreeNode[];
|
|
285
|
+
toolDefinitions: string | import("../utils/tool-fold").ToolTreeNode[];
|
|
263
286
|
toolHandlers: any;
|
|
287
|
+
onActivate: any;
|
|
288
|
+
onDeactivate: any;
|
|
289
|
+
getDebugSnapshot: any;
|
|
264
290
|
description: string;
|
|
265
291
|
fallback?: never;
|
|
292
|
+
excludeFromClassifier?: boolean;
|
|
266
293
|
name: string;
|
|
267
|
-
systemPrompt?:
|
|
294
|
+
systemPrompt?: import("../config/config").SystemPromptInput;
|
|
268
295
|
primerHistory?: ChatMessage[];
|
|
269
296
|
subAgents?: AgentConfig[];
|
|
270
297
|
chatInputDuringExecution?: ChatInputDuringExecutionMode;
|
|
271
298
|
manualSelection?: import("../config/config").ManualSelectionConfig;
|
|
272
299
|
} | {
|
|
273
|
-
toolDefinitions: import("../utils/tool-fold").ToolTreeNode[];
|
|
300
|
+
toolDefinitions: string | import("../utils/tool-fold").ToolTreeNode[];
|
|
274
301
|
toolHandlers: any;
|
|
302
|
+
onActivate: any;
|
|
303
|
+
onDeactivate: any;
|
|
304
|
+
getDebugSnapshot: any;
|
|
275
305
|
fallback: true;
|
|
276
306
|
description?: never;
|
|
277
307
|
name: string;
|
|
278
|
-
systemPrompt?:
|
|
308
|
+
systemPrompt?: import("../config/config").SystemPromptInput;
|
|
279
309
|
primerHistory?: ChatMessage[];
|
|
280
310
|
subAgents?: AgentConfig[];
|
|
281
311
|
chatInputDuringExecution?: ChatInputDuringExecutionMode;
|
|
@@ -284,6 +314,8 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
284
314
|
activeSystemPrompt: string;
|
|
285
315
|
activePrimerHistory: ChatMessage[];
|
|
286
316
|
activeFoldStack: string[];
|
|
317
|
+
activeDebugSnapshot: unknown;
|
|
318
|
+
turnSnapshots: readonly import("../components/chat-driver/chat-driver").TurnSnapshot[];
|
|
287
319
|
debug: unknown;
|
|
288
320
|
};
|
|
289
321
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/main/main.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,4BAA4B,EAC5B,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAGL,cAAc,EAIf,MAAM,uBAAuB,CAAC;AAW/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAgBpD,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EACjB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/main/main.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,4BAA4B,EAC5B,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAGL,cAAc,EAIf,MAAM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;IAI9B,oBAAoB,CAAC,UAAU,EAAE,oBAAoB,EAAE;IAIvD,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiDX,gBAAgB;IAehB,gBAAgB,IAAI,IAAI;IAIxB,gBAAgB,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI;IAIhC,gBAAgB,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI;IAIlD,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAU5C,OAAO,CAAC,cAAc;IAetB,OAAO,CAAC,cAAc;YASR,iBAAiB;IAmC/B,eAAe;IAIf,qBAAqB,CAAC,UAAU,EAAE,MAAM;YAK1B,gBAAgB;YA4DhB,IAAI;IAwClB,qBAAqB,CAAC,CAAC,EAAE,UAAU;IAYnC,0BAA0B,CAAC,CAAC,EAAE,KAAK;CAQpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.template.d.ts","sourceRoot":"","sources":["../../../src/main/main.template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAA2B,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAiIpD,gBAAgB;AAChB,eAAO,MAAM,6BAA6B,GACxC,oBAAoB,MAAM,KACzB,YAAY,CAAC,qBAAqB,
|
|
1
|
+
{"version":3,"file":"main.template.d.ts","sourceRoot":"","sources":["../../../src/main/main.template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAA2B,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAiIpD,gBAAgB;AAChB,eAAO,MAAM,6BAA6B,GACxC,oBAAoB,MAAM,KACzB,YAAY,CAAC,qBAAqB,CA0dpC,CAAC"}
|