@genesislcap/ai-assistant 14.409.0-FUI-2495.2 → 14.409.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 +1110 -2791
- package/dist/ai-assistant.d.ts +45 -267
- package/dist/dts/channel/ai-activity-channel.d.ts +0 -1
- package/dist/dts/channel/ai-activity-channel.d.ts.map +1 -1
- package/dist/dts/components/chat-driver/chat-driver.d.ts +7 -25
- package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
- package/dist/dts/components/halo-overlay.d.ts +1 -13
- package/dist/dts/components/halo-overlay.d.ts.map +1 -1
- package/dist/dts/config/config.d.ts +15 -43
- package/dist/dts/config/config.d.ts.map +1 -1
- package/dist/dts/config/index.d.ts +0 -1
- package/dist/dts/config/index.d.ts.map +1 -1
- package/dist/dts/index.d.ts +0 -4
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/main/main.d.ts +7 -16
- package/dist/dts/main/main.d.ts.map +1 -1
- package/dist/dts/main/main.styles.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 +31 -86
- package/dist/esm/components/halo-overlay.js +7 -53
- package/dist/esm/config/index.js +0 -1
- package/dist/esm/index.js +0 -4
- package/dist/esm/main/main.js +45 -103
- package/dist/esm/main/main.styles.js +4 -145
- package/dist/esm/main/main.template.js +61 -97
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -15
- package/src/channel/ai-activity-channel.ts +0 -1
- package/src/components/chat-driver/chat-driver.ts +35 -116
- package/src/components/halo-overlay.ts +7 -45
- package/src/config/config.ts +15 -45
- package/src/config/index.ts +0 -1
- package/src/index.ts +0 -4
- package/src/main/main.styles.ts +4 -145
- package/src/main/main.template.ts +78 -116
- package/src/main/main.ts +50 -105
- package/dist/dts/components/ai-driver/ai-driver.d.ts +0 -38
- package/dist/dts/components/ai-driver/ai-driver.d.ts.map +0 -1
- package/dist/dts/components/ai-driver/index.d.ts +0 -2
- package/dist/dts/components/ai-driver/index.d.ts.map +0 -1
- package/dist/dts/components/orchestrating-driver/index.d.ts +0 -2
- package/dist/dts/components/orchestrating-driver/index.d.ts.map +0 -1
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts +0 -36
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts.map +0 -1
- package/dist/dts/components/popout-manager/index.d.ts +0 -2
- package/dist/dts/components/popout-manager/index.d.ts.map +0 -1
- package/dist/dts/components/popout-manager/popout-manager.d.ts +0 -74
- package/dist/dts/components/popout-manager/popout-manager.d.ts.map +0 -1
- package/dist/dts/config/fallback-agents.d.ts +0 -20
- package/dist/dts/config/fallback-agents.d.ts.map +0 -1
- package/dist/esm/components/ai-driver/ai-driver.js +0 -1
- package/dist/esm/components/ai-driver/index.js +0 -1
- package/dist/esm/components/orchestrating-driver/index.js +0 -1
- package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +0 -229
- package/dist/esm/components/popout-manager/index.js +0 -1
- package/dist/esm/components/popout-manager/popout-manager.js +0 -119
- package/dist/esm/config/fallback-agents.js +0 -26
- package/src/components/ai-driver/ai-driver.ts +0 -42
- package/src/components/ai-driver/index.ts +0 -1
- package/src/components/orchestrating-driver/index.ts +0 -1
- package/src/components/orchestrating-driver/orchestrating-driver.ts +0 -300
- package/src/components/popout-manager/index.ts +0 -1
- package/src/components/popout-manager/popout-manager.ts +0 -144
- package/src/config/fallback-agents.ts +0 -29
package/dist/ai-assistant.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { AIProvider } from '@genesislcap/foundation-ai';
|
|
2
2
|
import type { ChatAttachment } from '@genesislcap/foundation-ai';
|
|
3
3
|
import type { ChatConfig } from '@genesislcap/foundation-ai';
|
|
4
|
-
import type { ChatDriverResult } from '@genesislcap/foundation-ai';
|
|
5
4
|
import type { ChatMessage } from '@genesislcap/foundation-ai';
|
|
6
5
|
import type { ChatToolDefinition } from '@genesislcap/foundation-ai';
|
|
7
6
|
import type { ChatToolHandlers } from '@genesislcap/foundation-ai';
|
|
@@ -9,14 +8,42 @@ import { GenesisElement } from '@genesislcap/web-core';
|
|
|
9
8
|
import { ViewTemplate } from '@genesislcap/web-core';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
|
-
* Configuration for
|
|
11
|
+
* Configuration for a single specialist agent.
|
|
13
12
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* When multiple agents are provided to `FoundationAiAssistant`, an orchestrating layer
|
|
14
|
+
* will route each user message to the appropriate specialist based on intent. When only
|
|
15
|
+
* one agent is configured, routing is skipped.
|
|
16
16
|
*
|
|
17
17
|
* @beta
|
|
18
18
|
*/
|
|
19
|
-
export declare
|
|
19
|
+
export declare interface AgentConfig {
|
|
20
|
+
/**
|
|
21
|
+
* Display name shown in the chat header when this agent is active.
|
|
22
|
+
*/
|
|
23
|
+
name: string;
|
|
24
|
+
/**
|
|
25
|
+
* Plain-language description of what this agent handles.
|
|
26
|
+
* Used by the classifier to auto-generate its routing prompt.
|
|
27
|
+
*/
|
|
28
|
+
description: string;
|
|
29
|
+
/**
|
|
30
|
+
* System prompt injected into every conversation turn for this agent.
|
|
31
|
+
*/
|
|
32
|
+
systemPrompt?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Tool definitions (JSON Schema) passed to the AI provider for this agent.
|
|
35
|
+
*/
|
|
36
|
+
toolDefinitions?: ChatToolDefinition[];
|
|
37
|
+
/**
|
|
38
|
+
* Tool handler implementations for this agent.
|
|
39
|
+
*/
|
|
40
|
+
toolHandlers?: ChatToolHandlers;
|
|
41
|
+
/**
|
|
42
|
+
* Optional primer history prepended to every call (not visible to the user).
|
|
43
|
+
* Used to establish agent identity and behavioural rules.
|
|
44
|
+
*/
|
|
45
|
+
primerHistory?: ChatMessage[];
|
|
46
|
+
}
|
|
20
47
|
|
|
21
48
|
/**
|
|
22
49
|
* Typed in-process event bus for AI assistant activity events.
|
|
@@ -156,7 +183,6 @@ export declare interface AiAssistantSerializedState {
|
|
|
156
183
|
messages: ChatMessage[];
|
|
157
184
|
showToolCalls: boolean;
|
|
158
185
|
showThinkingSteps: boolean;
|
|
159
|
-
showAgentSwitchIndicator: boolean;
|
|
160
186
|
enabledAnimations: AiAssistantAnimation[];
|
|
161
187
|
}
|
|
162
188
|
|
|
@@ -179,67 +205,6 @@ export declare interface AiChatWidget {
|
|
|
179
205
|
resolved?: boolean;
|
|
180
206
|
}
|
|
181
207
|
|
|
182
|
-
/**
|
|
183
|
-
* Contract for pages that support docking the AI assistant.
|
|
184
|
-
* Register an implementation with {@link getAiPopoutManager} on mount and deregister on unmount.
|
|
185
|
-
*
|
|
186
|
-
* @beta
|
|
187
|
-
*/
|
|
188
|
-
export declare interface AiDockProvider {
|
|
189
|
-
/**
|
|
190
|
-
* Called when the user expands the bubble. Receives the assistant element and the
|
|
191
|
-
* serialized state to restore. The provider is responsible for inserting the element
|
|
192
|
-
* into its layout and calling `applyState` once the element is connected.
|
|
193
|
-
* Resolves when the element is connected and state has been applied.
|
|
194
|
-
*/
|
|
195
|
-
onDock(element: HTMLElement, state: AiAssistantSerializedState | undefined): Promise<void>;
|
|
196
|
-
/** Called when the user collapses the panel or before navigation. */
|
|
197
|
-
onUndock(): Promise<void>;
|
|
198
|
-
/**
|
|
199
|
-
* Called by `collapseIfDocked` before navigation. The provider is responsible for
|
|
200
|
-
* finding the docked assistant element and calling `handlePopout()` on it, which
|
|
201
|
-
* publishes `chat-popin` and returns the assistant to the bubble.
|
|
202
|
-
*/
|
|
203
|
-
initiateCollapse(): void;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Common interface implemented by both `ChatDriver` (single-agent) and
|
|
208
|
-
* `OrchestratingDriver` (multi-agent). `FoundationAiAssistant` depends only
|
|
209
|
-
* on this interface — the concrete class is chosen at startup based on how
|
|
210
|
-
* many agents are configured.
|
|
211
|
-
*
|
|
212
|
-
* Extends `EventTarget` so consumers can subscribe to `history-updated` events
|
|
213
|
-
* without knowing the concrete implementation.
|
|
214
|
-
*
|
|
215
|
-
* @beta
|
|
216
|
-
*/
|
|
217
|
-
export declare interface AiDriver extends EventTarget {
|
|
218
|
-
/**
|
|
219
|
-
* Send a user message and run the tool loop to completion.
|
|
220
|
-
*/
|
|
221
|
-
sendMessage(input: string, attachments?: ChatAttachment[]): Promise<ChatDriverResult>;
|
|
222
|
-
/**
|
|
223
|
-
* Continue the tool loop from the current history without appending a new
|
|
224
|
-
* user message. Used by `OrchestratingDriver` on agent handoffs — the
|
|
225
|
-
* handoff context is already in history; `transientPrimer` is injected as
|
|
226
|
-
* an invisible one-shot message for this call only.
|
|
227
|
-
*/
|
|
228
|
-
continueFromHistory(transientPrimer?: ChatMessage[]): Promise<ChatDriverResult>;
|
|
229
|
-
/**
|
|
230
|
-
* Resolve a pending blocking interaction with the given result.
|
|
231
|
-
*/
|
|
232
|
-
resolveInteraction(interactionId: string, result: unknown): void;
|
|
233
|
-
/**
|
|
234
|
-
* Seed the driver's message history (called on state restore / pop-in).
|
|
235
|
-
*/
|
|
236
|
-
loadHistory(messages: ChatMessage[]): void;
|
|
237
|
-
/**
|
|
238
|
-
* Return the full, unredacted conversation history.
|
|
239
|
-
*/
|
|
240
|
-
getRawHistory?(): readonly ChatMessage[];
|
|
241
|
-
}
|
|
242
|
-
|
|
243
208
|
/**
|
|
244
209
|
* All available animation names, derived from the registry.
|
|
245
210
|
*
|
|
@@ -264,30 +229,6 @@ export declare const ANIMATION_DEFS: {
|
|
|
264
229
|
};
|
|
265
230
|
};
|
|
266
231
|
|
|
267
|
-
declare interface BaseAgentConfig {
|
|
268
|
-
/**
|
|
269
|
-
* Display name shown in the chat header when this agent is active.
|
|
270
|
-
*/
|
|
271
|
-
name: string;
|
|
272
|
-
/**
|
|
273
|
-
* System prompt injected into every conversation turn for this agent.
|
|
274
|
-
*/
|
|
275
|
-
systemPrompt?: string;
|
|
276
|
-
/**
|
|
277
|
-
* Tool definitions (JSON Schema) passed to the AI provider for this agent.
|
|
278
|
-
*/
|
|
279
|
-
toolDefinitions?: ChatToolDefinition[];
|
|
280
|
-
/**
|
|
281
|
-
* Tool handler implementations for this agent.
|
|
282
|
-
*/
|
|
283
|
-
toolHandlers?: ChatToolHandlers;
|
|
284
|
-
/**
|
|
285
|
-
* Optional primer history prepended to every call (not visible to the user).
|
|
286
|
-
* Used to establish agent identity and behavioural rules.
|
|
287
|
-
*/
|
|
288
|
-
primerHistory?: ChatMessage[];
|
|
289
|
-
}
|
|
290
|
-
|
|
291
232
|
/**
|
|
292
233
|
* Plain TS class that drives a multi-turn chat conversation, including the tool-call loop.
|
|
293
234
|
* Owned by `FoundationAiAssistant` — created in `connectedCallback`, torn down in `disconnectedCallback`.
|
|
@@ -296,25 +237,18 @@ declare interface BaseAgentConfig {
|
|
|
296
237
|
*
|
|
297
238
|
* @beta
|
|
298
239
|
*/
|
|
299
|
-
export declare class ChatDriver extends EventTarget
|
|
240
|
+
export declare class ChatDriver extends EventTarget {
|
|
300
241
|
private readonly aiProvider;
|
|
242
|
+
private readonly toolHandlers;
|
|
243
|
+
private readonly toolDefinitions;
|
|
244
|
+
private readonly systemPrompt?;
|
|
245
|
+
private readonly primerHistory?;
|
|
301
246
|
private readonly maxToolIterations;
|
|
302
247
|
private history;
|
|
303
248
|
private busy;
|
|
304
249
|
private pendingInteractions;
|
|
305
|
-
private systemPrompt?;
|
|
306
|
-
private toolDefinitions;
|
|
307
|
-
private toolHandlers;
|
|
308
|
-
private primerHistory?;
|
|
309
|
-
private activeAgentName?;
|
|
310
250
|
constructor(aiProvider: AIProvider, toolHandlers?: ChatToolHandlers, toolDefinitions?: ChatToolDefinition[], systemPrompt?: string, primerHistory?: ChatMessage[], maxToolIterations?: number);
|
|
311
|
-
/**
|
|
312
|
-
* Swap in a new agent's configuration. Called by OrchestratingDriver before
|
|
313
|
-
* each specialist turn so the shared driver runs with the right tools and prompt.
|
|
314
|
-
*/
|
|
315
|
-
applyAgent(config: AgentConfig): void;
|
|
316
251
|
getHistory(): ReadonlyArray<ChatMessage>;
|
|
317
|
-
getRawHistory(): readonly ChatMessage[];
|
|
318
252
|
isBusy(): boolean;
|
|
319
253
|
/**
|
|
320
254
|
* Request a custom UI interaction. Emits a new message with the interaction.
|
|
@@ -334,14 +268,7 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
334
268
|
* can continue an existing conversation. Call this before the first user message.
|
|
335
269
|
*/
|
|
336
270
|
loadHistory(messages: ChatMessage[]): void;
|
|
337
|
-
sendMessage(userInput: string, attachments?: ChatAttachment[]): Promise<
|
|
338
|
-
/**
|
|
339
|
-
* Continue the tool loop from current history without appending a new user message.
|
|
340
|
-
* Used by OrchestratingDriver after an agent handoff — the handoff context is
|
|
341
|
-
* already in history; `transientPrimer` is injected as an invisible one-shot
|
|
342
|
-
* message for this call only.
|
|
343
|
-
*/
|
|
344
|
-
continueFromHistory(transientPrimer?: ChatMessage[]): Promise<ChatDriverResult>;
|
|
271
|
+
sendMessage(userInput: string, attachments?: ChatAttachment[]): Promise<void>;
|
|
345
272
|
private runToolLoop;
|
|
346
273
|
private appendToHistory;
|
|
347
274
|
}
|
|
@@ -353,29 +280,12 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
353
280
|
*/
|
|
354
281
|
export declare type ChatHistoryUpdatedEvent = CustomEvent<ReadonlyArray<ChatMessage>>;
|
|
355
282
|
|
|
356
|
-
/**
|
|
357
|
-
* Configuration for a fallback agent.
|
|
358
|
-
*
|
|
359
|
-
* Invoked when the classifier returns no match. Excluded from the classifier
|
|
360
|
-
* prompt. Only one fallback is permitted per agents array.
|
|
361
|
-
*
|
|
362
|
-
* @beta
|
|
363
|
-
*/
|
|
364
|
-
export declare interface FallbackAgentConfig extends BaseAgentConfig {
|
|
365
|
-
/**
|
|
366
|
-
* Marks this agent as the fallback for unrecognised requests.
|
|
367
|
-
*/
|
|
368
|
-
fallback: true;
|
|
369
|
-
description?: never;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
283
|
/**
|
|
373
284
|
* Foundation AI Assistant component.
|
|
374
285
|
*
|
|
375
286
|
* @remarks
|
|
376
287
|
* Inject an `AIProvider` through the DI container. Pass agent configuration via the `agents`
|
|
377
|
-
* property. The component creates a `ChatDriver`
|
|
378
|
-
* (multiple agents) to manage the conversation loop.
|
|
288
|
+
* property. The component creates a `ChatDriver` to manage the conversation loop.
|
|
379
289
|
*
|
|
380
290
|
* @beta
|
|
381
291
|
*/
|
|
@@ -404,13 +314,10 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
404
314
|
inputValue: string;
|
|
405
315
|
attachments: ChatAttachment[];
|
|
406
316
|
attachmentErrors: string[];
|
|
407
|
-
activeAgent?: AgentConfig;
|
|
408
317
|
/** Current user-facing toggle state for tool call visibility. */
|
|
409
318
|
showToolCalls: boolean;
|
|
410
319
|
/** Current user-facing toggle state for thinking step visibility. */
|
|
411
320
|
showThinkingSteps: boolean;
|
|
412
|
-
/** Current user-facing toggle state for agent switch indicator visibility. */
|
|
413
|
-
showAgentSwitchIndicator: boolean;
|
|
414
321
|
/** Currently enabled animations. */
|
|
415
322
|
enabledAnimations: AiAssistantAnimation[];
|
|
416
323
|
/** Whether the loading spinner is currently visible. Controlled by the loading delay timer. */
|
|
@@ -421,7 +328,11 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
421
328
|
private loadingTimer;
|
|
422
329
|
private unsubBus?;
|
|
423
330
|
private haloStartPublished;
|
|
424
|
-
|
|
331
|
+
/**
|
|
332
|
+
* Whether the halo animation should be shown.
|
|
333
|
+
* True when the AI is actively computing (loading state, no pending interaction).
|
|
334
|
+
*/
|
|
335
|
+
showHalo: boolean;
|
|
425
336
|
private syncShowHalo;
|
|
426
337
|
/** True when there is a pending (unresolved) interaction — disables the popout button. */
|
|
427
338
|
get hasActivePendingInteraction(): boolean;
|
|
@@ -452,17 +363,8 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
452
363
|
toggleSettings(): void;
|
|
453
364
|
toggleShowToolCalls(): void;
|
|
454
365
|
toggleShowThinkingSteps(): void;
|
|
455
|
-
toggleShowAgentSwitchIndicator(): void;
|
|
456
366
|
setEnabledAnimations(animations: AiAssistantAnimation[]): void;
|
|
457
|
-
|
|
458
|
-
messages: readonly ChatMessage[];
|
|
459
|
-
agentSummary: AgentConfig[];
|
|
460
|
-
host: string;
|
|
461
|
-
activeSystemPrompt: string;
|
|
462
|
-
activePrimerHistory: ChatMessage[];
|
|
463
|
-
debug: unknown;
|
|
464
|
-
};
|
|
465
|
-
downloadDebugLog(): void;
|
|
367
|
+
downloadHistory(): void;
|
|
466
368
|
triggerFileInput(): void;
|
|
467
369
|
handleFileSelect(e: Event): void;
|
|
468
370
|
removeAttachment(attachment: ChatAttachment): void;
|
|
@@ -480,100 +382,6 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
480
382
|
/** @internal */
|
|
481
383
|
export declare const FoundationAiAssistantTemplate: (designSystemPrefix: string) => ViewTemplate<FoundationAiAssistant>;
|
|
482
384
|
|
|
483
|
-
/**
|
|
484
|
-
* App-shell component that owns the pop-out/pop-in lifecycle for the AI assistant bubble.
|
|
485
|
-
*
|
|
486
|
-
* @remarks
|
|
487
|
-
* Place this in the persistent app shell, wrapping a `foundation-ai-chat-bubble` that
|
|
488
|
-
* contains an AI assistant element in the `dialog-content` slot. The component will
|
|
489
|
-
* auto-create a matching collapse-mode element for docking into pages, and will
|
|
490
|
-
* control the expand button visibility based on whether a dock provider is registered.
|
|
491
|
-
*
|
|
492
|
-
* Pages that support docking call `aiPopoutManager.registerDockProvider()` on mount
|
|
493
|
-
* and `aiPopoutManager.deregisterDockProvider()` on unmount.
|
|
494
|
-
*
|
|
495
|
-
* @example
|
|
496
|
-
* ```html
|
|
497
|
-
* <foundation-ai-popout-manager>
|
|
498
|
-
* <foundation-ai-chat-bubble title="My Assistant">
|
|
499
|
-
* <my-assistant slot="dialog-content"></my-assistant>
|
|
500
|
-
* </foundation-ai-chat-bubble>
|
|
501
|
-
* </foundation-ai-popout-manager>
|
|
502
|
-
* ```
|
|
503
|
-
*
|
|
504
|
-
* @beta
|
|
505
|
-
*/
|
|
506
|
-
export declare class FoundationAiPopoutManager extends GenesisElement {
|
|
507
|
-
/** True when a dock provider is registered — controls expand button visibility. */
|
|
508
|
-
canDock: boolean;
|
|
509
|
-
private collapseEl;
|
|
510
|
-
private dockProvider;
|
|
511
|
-
private isDocked;
|
|
512
|
-
private unsubBus?;
|
|
513
|
-
connectedCallback(): void;
|
|
514
|
-
disconnectedCallback(): void;
|
|
515
|
-
canDockChanged(): void;
|
|
516
|
-
registerDockProvider(provider: AiDockProvider): void;
|
|
517
|
-
deregisterDockProvider(): void;
|
|
518
|
-
/**
|
|
519
|
-
* If the assistant is currently docked, collapses it back into the bubble.
|
|
520
|
-
* Await this in `onBeforeNavButtonClick` to ensure cleanup before navigation.
|
|
521
|
-
*/
|
|
522
|
-
collapseIfDocked(): Promise<void>;
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
/**
|
|
526
|
-
* A warm, conversational fallback agent. Acknowledges it can't help directly,
|
|
527
|
-
* explains what the available specialists can do, and invites the user to retry.
|
|
528
|
-
*
|
|
529
|
-
* The system prompt is generated at runtime by `OrchestratingDriver` from the
|
|
530
|
-
* specialist list — no manual authoring required.
|
|
531
|
-
*
|
|
532
|
-
* @beta
|
|
533
|
-
*/
|
|
534
|
-
export declare const friendlyFallbackAgent: FallbackAgentConfig;
|
|
535
|
-
|
|
536
|
-
/**
|
|
537
|
-
* Returns the active `FoundationAiPopoutManager` instance, or `undefined` if none is mounted.
|
|
538
|
-
* Import this in pages to call `registerDockProvider` / `deregisterDockProvider`.
|
|
539
|
-
*
|
|
540
|
-
* @beta
|
|
541
|
-
*/
|
|
542
|
-
export declare function getAiPopoutManager(): FoundationAiPopoutManager | undefined;
|
|
543
|
-
|
|
544
|
-
/**
|
|
545
|
-
* Orchestrates multiple specialist agents. Sits between `FoundationAiAssistant`
|
|
546
|
-
* and `ChatDriver`, classifying each user message and routing it to the right
|
|
547
|
-
* specialist — each with its own focused system prompt, tools, and primer.
|
|
548
|
-
*
|
|
549
|
-
* @beta
|
|
550
|
-
*/
|
|
551
|
-
export declare class OrchestratingDriver extends EventTarget implements AiDriver {
|
|
552
|
-
private readonly aiProvider;
|
|
553
|
-
private readonly agents;
|
|
554
|
-
private readonly chatDriver;
|
|
555
|
-
private readonly specialists;
|
|
556
|
-
private readonly fallback?;
|
|
557
|
-
private readonly maxHandoffs;
|
|
558
|
-
private readonly classifierHistoryLength;
|
|
559
|
-
private readonly classifierRetries;
|
|
560
|
-
activeAgent?: AgentConfig;
|
|
561
|
-
constructor(aiProvider: AIProvider, agents: AgentConfig[], options?: {
|
|
562
|
-
maxHandoffs?: number;
|
|
563
|
-
classifierHistoryLength?: number;
|
|
564
|
-
classifierRetries?: number;
|
|
565
|
-
maxToolIterations?: number;
|
|
566
|
-
});
|
|
567
|
-
resolveInteraction(interactionId: string, result: unknown): void;
|
|
568
|
-
loadHistory(messages: ChatMessage[]): void;
|
|
569
|
-
getRawHistory(): readonly ChatMessage[];
|
|
570
|
-
sendMessage(input: string, attachments?: ChatAttachment[]): Promise<ChatDriverResult>;
|
|
571
|
-
continueFromHistory(transientPrimer?: ChatMessage[]): Promise<ChatDriverResult>;
|
|
572
|
-
private applyAgent;
|
|
573
|
-
private classify;
|
|
574
|
-
private appendInlineMessage;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
385
|
/**
|
|
578
386
|
* Controls the pop-out button shown in the assistant header.
|
|
579
387
|
* - `"expand"` — assistant is embedded in the bubble dialog; button expands it to a layout panel.
|
|
@@ -583,34 +391,4 @@ export declare class OrchestratingDriver extends EventTarget implements AiDriver
|
|
|
583
391
|
*/
|
|
584
392
|
export declare type PopoutMode = 'expand' | 'collapse';
|
|
585
393
|
|
|
586
|
-
/** Name reserved for the cross-agent handoff tool — injected by OrchestratingDriver. */
|
|
587
|
-
export declare const REQUEST_CONTINUATION_TOOL = "request_continuation";
|
|
588
|
-
|
|
589
|
-
/**
|
|
590
|
-
* Configuration for a specialist agent.
|
|
591
|
-
*
|
|
592
|
-
* Specialist agents are offered to the classifier for intent routing. The
|
|
593
|
-
* `description` is used to auto-generate the classifier prompt — no manual
|
|
594
|
-
* routing prompt authoring required.
|
|
595
|
-
*
|
|
596
|
-
* @beta
|
|
597
|
-
*/
|
|
598
|
-
export declare interface SpecialistAgentConfig extends BaseAgentConfig {
|
|
599
|
-
/**
|
|
600
|
-
* Plain-language description of what this agent handles.
|
|
601
|
-
* Used by the classifier to auto-generate its routing prompt.
|
|
602
|
-
*/
|
|
603
|
-
description: string;
|
|
604
|
-
fallback?: never;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
/**
|
|
608
|
-
* A brief, professional fallback agent. States what is available without
|
|
609
|
-
* elaboration. The `{{agents}}` placeholder is replaced at runtime by
|
|
610
|
-
* `OrchestratingDriver` with the generated specialist list.
|
|
611
|
-
*
|
|
612
|
-
* @beta
|
|
613
|
-
*/
|
|
614
|
-
export declare const strictFallbackAgent: FallbackAgentConfig;
|
|
615
|
-
|
|
616
394
|
export { }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-activity-channel.d.ts","sourceRoot":"","sources":["../../../src/channel/ai-activity-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,
|
|
1
|
+
{"version":3,"file":"ai-activity-channel.d.ts","sourceRoot":"","sources":["../../../src/channel/ai-activity-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,oBAAoB,EAAE,CAAC;CAC3C;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,qBAAqB;IACpC,2FAA2F;IAC3F,YAAY,EAAE;QAAE,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IACtC,iFAAiF;IACjF,WAAW,EAAE,SAAS,CAAC;IACvB,8FAA8F;IAC9F,aAAa,EAAE;QAAE,KAAK,EAAE,0BAA0B,CAAA;KAAE,CAAC;IACrD,mGAAmG;IACnG,YAAY,EAAE;QAAE,KAAK,EAAE,0BAA0B,CAAA;KAAE,CAAC;CACrD"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import type { AIProvider, ChatAttachment,
|
|
2
|
-
import type { AgentConfig } from '../../config/config';
|
|
3
|
-
import type { AiDriver } from '../ai-driver/ai-driver';
|
|
4
|
-
/** Name reserved for the cross-agent handoff tool — injected by OrchestratingDriver. */
|
|
5
|
-
export declare const REQUEST_CONTINUATION_TOOL = "request_continuation";
|
|
1
|
+
import type { AIProvider, ChatAttachment, ChatMessage, ChatToolDefinition, ChatToolHandlers } from '@genesislcap/foundation-ai';
|
|
6
2
|
/**
|
|
7
3
|
* Event emitted when the chat history is updated (new message appended).
|
|
8
4
|
*
|
|
@@ -17,25 +13,18 @@ export type ChatHistoryUpdatedEvent = CustomEvent<ReadonlyArray<ChatMessage>>;
|
|
|
17
13
|
*
|
|
18
14
|
* @beta
|
|
19
15
|
*/
|
|
20
|
-
export declare class ChatDriver extends EventTarget
|
|
16
|
+
export declare class ChatDriver extends EventTarget {
|
|
21
17
|
private readonly aiProvider;
|
|
18
|
+
private readonly toolHandlers;
|
|
19
|
+
private readonly toolDefinitions;
|
|
20
|
+
private readonly systemPrompt?;
|
|
21
|
+
private readonly primerHistory?;
|
|
22
22
|
private readonly maxToolIterations;
|
|
23
23
|
private history;
|
|
24
24
|
private busy;
|
|
25
25
|
private pendingInteractions;
|
|
26
|
-
private systemPrompt?;
|
|
27
|
-
private toolDefinitions;
|
|
28
|
-
private toolHandlers;
|
|
29
|
-
private primerHistory?;
|
|
30
|
-
private activeAgentName?;
|
|
31
26
|
constructor(aiProvider: AIProvider, toolHandlers?: ChatToolHandlers, toolDefinitions?: ChatToolDefinition[], systemPrompt?: string, primerHistory?: ChatMessage[], maxToolIterations?: number);
|
|
32
|
-
/**
|
|
33
|
-
* Swap in a new agent's configuration. Called by OrchestratingDriver before
|
|
34
|
-
* each specialist turn so the shared driver runs with the right tools and prompt.
|
|
35
|
-
*/
|
|
36
|
-
applyAgent(config: AgentConfig): void;
|
|
37
27
|
getHistory(): ReadonlyArray<ChatMessage>;
|
|
38
|
-
getRawHistory(): readonly ChatMessage[];
|
|
39
28
|
isBusy(): boolean;
|
|
40
29
|
/**
|
|
41
30
|
* Request a custom UI interaction. Emits a new message with the interaction.
|
|
@@ -55,14 +44,7 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
55
44
|
* can continue an existing conversation. Call this before the first user message.
|
|
56
45
|
*/
|
|
57
46
|
loadHistory(messages: ChatMessage[]): void;
|
|
58
|
-
sendMessage(userInput: string, attachments?: ChatAttachment[]): Promise<
|
|
59
|
-
/**
|
|
60
|
-
* Continue the tool loop from current history without appending a new user message.
|
|
61
|
-
* Used by OrchestratingDriver after an agent handoff — the handoff context is
|
|
62
|
-
* already in history; `transientPrimer` is injected as an invisible one-shot
|
|
63
|
-
* message for this call only.
|
|
64
|
-
*/
|
|
65
|
-
continueFromHistory(transientPrimer?: ChatMessage[]): Promise<ChatDriverResult>;
|
|
47
|
+
sendMessage(userInput: string, attachments?: ChatAttachment[]): Promise<void>;
|
|
66
48
|
private runToolLoop;
|
|
67
49
|
private appendToHistory;
|
|
68
50
|
}
|
|
@@ -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,
|
|
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,WAAW,EAEX,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AAOpC;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC;AAE9E;;;;;;;GAOG;AACH,qBAAa,UAAW,SAAQ,WAAW;IASvC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;IAC9B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;IAC/B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAbpC,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,mBAAmB,CAGvB;gBAGe,UAAU,EAAE,UAAU,EACtB,YAAY,GAAE,gBAAqB,EACnC,eAAe,GAAE,kBAAkB,EAAO,EAC1C,YAAY,CAAC,EAAE,MAAM,EACrB,aAAa,CAAC,EAAE,WAAW,EAAE,EAC7B,iBAAiB,GAAE,MAAoC;IAU1E,UAAU,IAAI,aAAa,CAAC,WAAW,CAAC;IAIxC,MAAM,IAAI,OAAO;IAIjB;;;;;;OAMG;IACU,kBAAkB,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC;IAYhF;;;OAGG;IACI,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,IAAI;IAqBnE;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAI;IAI3C,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;YAoBrE,WAAW;IA2HzB,OAAO,CAAC,eAAe;CAQxB"}
|
|
@@ -14,19 +14,7 @@ import { GenesisElement } from '@genesislcap/web-core';
|
|
|
14
14
|
*/
|
|
15
15
|
export declare class AiHaloOverlay extends GenesisElement {
|
|
16
16
|
active: boolean;
|
|
17
|
-
|
|
18
|
-
speed: number;
|
|
19
|
-
/** Rotation direction. Default: 'cw' (clockwise). */
|
|
20
|
-
direction: 'cw' | 'ccw';
|
|
21
|
-
/** Border thickness in px. Default: 3. */
|
|
22
|
-
borderSize: number;
|
|
23
|
-
/** Glow layer opacity (0–1). Default: 0.35. */
|
|
24
|
-
glowOpacity: number;
|
|
25
|
-
/** Transparent stop of the radial glow mask as a percentage (0–100). Higher = less spread. Default: 70. */
|
|
26
|
-
glowSpread: number;
|
|
27
|
-
borderSizeChanged(): void;
|
|
28
|
-
glowOpacityChanged(): void;
|
|
29
|
-
glowSpreadChanged(): void;
|
|
17
|
+
private static readonly DEG_PER_FRAME;
|
|
30
18
|
private static readonly FULL_ROTATION_DEG;
|
|
31
19
|
private angle;
|
|
32
20
|
private animFrame?;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"halo-overlay.d.ts","sourceRoot":"","sources":["../../../src/components/halo-overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,cAAc,EAAQ,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"halo-overlay.d.ts","sourceRoot":"","sources":["../../../src/components/halo-overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,cAAc,EAAQ,MAAM,uBAAuB,CAAC;AAQvF;;;;;;;;;;;;GAYG;AACH,qBAkEa,aAAc,SAAQ,cAAc;IACpB,MAAM,EAAE,OAAO,CAAS;IASnD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAO;IAC5C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAO;IAEhD,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,SAAS,CAAC,CAAS;IAE3B,iBAAiB;IAKjB,oBAAoB;IAOpB,OAAO,CAAC,IAAI;CAKb"}
|
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import type { ChatMessage, ChatToolDefinition, ChatToolHandlers } from '@genesislcap/foundation-ai';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for a single specialist agent.
|
|
4
|
+
*
|
|
5
|
+
* When multiple agents are provided to `FoundationAiAssistant`, an orchestrating layer
|
|
6
|
+
* will route each user message to the appropriate specialist based on intent. When only
|
|
7
|
+
* one agent is configured, routing is skipped.
|
|
8
|
+
*
|
|
9
|
+
* @beta
|
|
10
|
+
*/
|
|
11
|
+
export interface AgentConfig {
|
|
3
12
|
/**
|
|
4
13
|
* Display name shown in the chat header when this agent is active.
|
|
5
14
|
*/
|
|
6
15
|
name: string;
|
|
16
|
+
/**
|
|
17
|
+
* Plain-language description of what this agent handles.
|
|
18
|
+
* Used by the classifier to auto-generate its routing prompt.
|
|
19
|
+
*/
|
|
20
|
+
description: string;
|
|
7
21
|
/**
|
|
8
22
|
* System prompt injected into every conversation turn for this agent.
|
|
9
23
|
*/
|
|
@@ -22,46 +36,4 @@ interface BaseAgentConfig {
|
|
|
22
36
|
*/
|
|
23
37
|
primerHistory?: ChatMessage[];
|
|
24
38
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Configuration for a specialist agent.
|
|
27
|
-
*
|
|
28
|
-
* Specialist agents are offered to the classifier for intent routing. The
|
|
29
|
-
* `description` is used to auto-generate the classifier prompt — no manual
|
|
30
|
-
* routing prompt authoring required.
|
|
31
|
-
*
|
|
32
|
-
* @beta
|
|
33
|
-
*/
|
|
34
|
-
export interface SpecialistAgentConfig extends BaseAgentConfig {
|
|
35
|
-
/**
|
|
36
|
-
* Plain-language description of what this agent handles.
|
|
37
|
-
* Used by the classifier to auto-generate its routing prompt.
|
|
38
|
-
*/
|
|
39
|
-
description: string;
|
|
40
|
-
fallback?: never;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Configuration for a fallback agent.
|
|
44
|
-
*
|
|
45
|
-
* Invoked when the classifier returns no match. Excluded from the classifier
|
|
46
|
-
* prompt. Only one fallback is permitted per agents array.
|
|
47
|
-
*
|
|
48
|
-
* @beta
|
|
49
|
-
*/
|
|
50
|
-
export interface FallbackAgentConfig extends BaseAgentConfig {
|
|
51
|
-
/**
|
|
52
|
-
* Marks this agent as the fallback for unrecognised requests.
|
|
53
|
-
*/
|
|
54
|
-
fallback: true;
|
|
55
|
-
description?: never;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Configuration for an agent passed to `FoundationAiAssistant`.
|
|
59
|
-
*
|
|
60
|
-
* Either a specialist (requires `description`) or a fallback (requires
|
|
61
|
-
* `fallback: true`). Passing both or neither is a compile error.
|
|
62
|
-
*
|
|
63
|
-
* @beta
|
|
64
|
-
*/
|
|
65
|
-
export type AgentConfig = SpecialistAgentConfig | FallbackAgentConfig;
|
|
66
|
-
export {};
|
|
67
39
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEpG,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEpG;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,eAAe,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACvC;;OAEG;IACH,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC;;;OAGG;IACH,aAAa,CAAC,EAAE,WAAW,EAAE,CAAC;CAC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
export * from './main/main';
|
|
2
2
|
export * from './main/main.types';
|
|
3
3
|
export * from './main/main.template';
|
|
4
|
-
export * from './components/ai-driver';
|
|
5
4
|
export * from './components/chat-driver';
|
|
6
|
-
export * from './components/orchestrating-driver';
|
|
7
|
-
export * from './components/popout-manager';
|
|
8
5
|
export * from './channel/ai-activity-channel';
|
|
9
6
|
export * from './channel/ai-activity-bus';
|
|
10
7
|
export * from './config/config';
|
|
11
|
-
export * from './config/fallback-agents';
|
|
12
8
|
export type { AiChatWidget } from './types/ai-chat-widget';
|
|
13
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/dts/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,
|
|
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,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC"}
|