@genesislcap/ai-assistant 14.432.2 → 14.433.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/api-extractor.json +8 -1
- package/dist/ai-assistant.api.json +1216 -141
- package/dist/ai-assistant.d.ts +216 -15
- package/dist/dts/components/agent-picker/agent-picker.d.ts +69 -0
- package/dist/dts/components/agent-picker/agent-picker.d.ts.map +1 -0
- package/dist/dts/components/agent-picker/agent-picker.styles.d.ts +2 -0
- package/dist/dts/components/agent-picker/agent-picker.styles.d.ts.map +1 -0
- package/dist/dts/components/agent-picker/agent-picker.template.d.ts +5 -0
- package/dist/dts/components/agent-picker/agent-picker.template.d.ts.map +1 -0
- package/dist/dts/components/agent-picker/index.d.ts +2 -0
- package/dist/dts/components/agent-picker/index.d.ts.map +1 -0
- package/dist/dts/components/chat-driver/chat-driver.d.ts +21 -0
- package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts +14 -0
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts.map +1 -1
- package/dist/dts/config/config.d.ts +22 -12
- package/dist/dts/config/config.d.ts.map +1 -1
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/main/main.d.ts +72 -4
- 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/dts/main/main.types.d.ts +1 -0
- package/dist/dts/main/main.types.d.ts.map +1 -1
- package/dist/dts/state/ai-assistant-slice.d.ts +39 -1
- package/dist/dts/state/ai-assistant-slice.d.ts.map +1 -1
- package/dist/dts/state/session-store.d.ts +6 -0
- package/dist/dts/state/session-store.d.ts.map +1 -1
- package/dist/dts/utils/animated-panel-toggle.d.ts +26 -0
- package/dist/dts/utils/animated-panel-toggle.d.ts.map +1 -0
- package/dist/dts/utils/index.d.ts +1 -0
- package/dist/dts/utils/index.d.ts.map +1 -1
- package/dist/esm/components/agent-picker/agent-picker.js +157 -0
- package/dist/esm/components/agent-picker/agent-picker.styles.js +73 -0
- package/dist/esm/components/agent-picker/agent-picker.template.js +72 -0
- package/dist/esm/components/agent-picker/index.js +1 -0
- package/dist/esm/components/chat-driver/chat-driver.js +48 -6
- package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +43 -6
- package/dist/esm/index.js +1 -0
- package/dist/esm/main/main.js +215 -21
- package/dist/esm/main/main.styles.js +59 -0
- package/dist/esm/main/main.template.js +66 -12
- package/dist/esm/state/ai-assistant-slice.js +15 -0
- package/dist/esm/utils/animated-panel-toggle.js +62 -0
- package/dist/esm/utils/index.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/gemini-empty-response.md +110 -0
- package/package.json +16 -16
- package/src/components/agent-picker/agent-picker.styles.ts +74 -0
- package/src/components/agent-picker/agent-picker.template.ts +88 -0
- package/src/components/agent-picker/agent-picker.ts +148 -0
- package/src/components/agent-picker/index.ts +1 -0
- package/src/components/chat-driver/chat-driver.ts +65 -8
- package/src/components/orchestrating-driver/orchestrating-driver.ts +45 -6
- package/src/config/config.ts +28 -11
- package/src/index.ts +1 -0
- package/src/main/main.styles.ts +59 -0
- package/src/main/main.template.ts +79 -13
- package/src/main/main.ts +220 -19
- package/src/main/main.types.ts +2 -0
- package/src/state/ai-assistant-slice.ts +51 -1
- package/src/utils/animated-panel-toggle.ts +62 -0
- package/src/utils/index.ts +1 -0
package/dist/dts/main/main.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AIProvider } from '@genesislcap/foundation-ai';
|
|
2
|
-
import type { ChatAttachment, ChatConfig, ChatMessage } from '@genesislcap/foundation-ai';
|
|
2
|
+
import type { ChatAttachment, ChatConfig, ChatInputDuringExecutionMode, ChatMessage } from '@genesislcap/foundation-ai';
|
|
3
3
|
import { GenesisElement } from '@genesislcap/web-core';
|
|
4
4
|
import type { AgentConfig } from '../config/config';
|
|
5
|
-
import type { AiAssistantAnimation, AiAssistantState, PopoutMode, SuggestionsState } from './main.types';
|
|
5
|
+
import type { AgentPickerMode, AiAssistantAnimation, AiAssistantState, PopoutMode, SuggestionsState } from './main.types';
|
|
6
6
|
/**
|
|
7
7
|
* Foundation AI Assistant component.
|
|
8
8
|
*
|
|
@@ -36,6 +36,11 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
36
36
|
*/
|
|
37
37
|
agents?: AgentConfig[];
|
|
38
38
|
chatConfig: ChatConfig;
|
|
39
|
+
/**
|
|
40
|
+
* Resolved agent picker mode from `chatConfig.picker.mode`. Defaults to
|
|
41
|
+
* `'disabled'`.
|
|
42
|
+
*/
|
|
43
|
+
get agentPicker(): AgentPickerMode;
|
|
39
44
|
debugStateFactory?: () => unknown;
|
|
40
45
|
/** When set, enables Redux DevTools for this instance's session store. */
|
|
41
46
|
debugRedux: boolean;
|
|
@@ -70,10 +75,35 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
70
75
|
/** Currently enabled animations. */
|
|
71
76
|
get enabledAnimations(): AiAssistantAnimation[];
|
|
72
77
|
set enabledAnimations(value: AiAssistantAnimation[]);
|
|
78
|
+
/**
|
|
79
|
+
* Whether the agent picker slide-out panel is open. Lives on the session
|
|
80
|
+
* store so the bubble-dialog and popout-panel instances stay in sync.
|
|
81
|
+
*/
|
|
82
|
+
get agentPickerOpen(): boolean;
|
|
83
|
+
set agentPickerOpen(value: boolean);
|
|
84
|
+
/**
|
|
85
|
+
* Name of the agent the user has pinned via the agent picker. `null` means
|
|
86
|
+
* automatic routing (Auto). Persisted on the session store, so it survives
|
|
87
|
+
* pop-in/pop-out but resets on page refresh.
|
|
88
|
+
*/
|
|
89
|
+
get pinnedAgentName(): string | null;
|
|
90
|
+
set pinnedAgentName(value: string | null);
|
|
73
91
|
get liveSubAgentTrace(): ChatMessage[];
|
|
74
92
|
set liveSubAgentTrace(value: ChatMessage[]);
|
|
75
93
|
get liveSubAgentName(): string | null;
|
|
76
94
|
set liveSubAgentName(value: string | null);
|
|
95
|
+
/**
|
|
96
|
+
* In-flight per-call chat-input overrides pushed by `requestSubAgent`
|
|
97
|
+
* invocations. Empty means no override is active.
|
|
98
|
+
*/
|
|
99
|
+
get subAgentInputOverrides(): import("../state/ai-assistant-slice").SubAgentInputOverride[];
|
|
100
|
+
/**
|
|
101
|
+
* Resolves the effective chat-input behaviour while the assistant is
|
|
102
|
+
* executing. Sub-agent overrides take precedence over the agent-level
|
|
103
|
+
* config; among overrides the most restrictive wins (`'hidden'` >
|
|
104
|
+
* `'disabled'`). Falls back to the active agent's config, then `'disabled'`.
|
|
105
|
+
*/
|
|
106
|
+
get effectiveChatInputDuringExecution(): ChatInputDuringExecutionMode;
|
|
77
107
|
/** Most recent prompt token count from the AI provider, if available. */
|
|
78
108
|
get contextTokens(): number | undefined;
|
|
79
109
|
set contextTokens(value: number | undefined);
|
|
@@ -182,7 +212,43 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
182
212
|
handlePopout(): void;
|
|
183
213
|
/** Returns a cache key for this instance, or undefined if the component has no identity. */
|
|
184
214
|
private getStateKey;
|
|
215
|
+
private readonly _settingsToggle;
|
|
185
216
|
toggleSettings(): void;
|
|
217
|
+
private readonly _agentPickerToggle;
|
|
218
|
+
toggleAgentPicker(): void;
|
|
219
|
+
/**
|
|
220
|
+
* Programmatically pin an agent by name. Returns `true` if the pin was
|
|
221
|
+
* applied, `false` if the agent isn't in the configured agents array or
|
|
222
|
+
* the call was suppressed by `force: false`.
|
|
223
|
+
*
|
|
224
|
+
* With `force: false`, the call is a no-op when a `picker.defaultAgent` is
|
|
225
|
+
* configured and the user has already moved away from it (either by picking
|
|
226
|
+
* another agent or by switching to Auto). This lets hosts seed an opinion
|
|
227
|
+
* without overriding an explicit user choice.
|
|
228
|
+
*
|
|
229
|
+
* @public
|
|
230
|
+
*/
|
|
231
|
+
setAgent(agentName: string, options?: {
|
|
232
|
+
force?: boolean;
|
|
233
|
+
}): boolean;
|
|
234
|
+
/** Whether the picker toggle button should appear. Mirrors the picker's own visibility rule. */
|
|
235
|
+
get agentPickerEnabled(): boolean;
|
|
236
|
+
/** Hint text for the currently pinned agent, if any. Used in the toggle button tooltip. */
|
|
237
|
+
get pinnedAgentHint(): string | undefined;
|
|
238
|
+
/**
|
|
239
|
+
* Tint applied to the pin icon when an agent is pinned. Picked from the
|
|
240
|
+
* brand palette by agent position (modulo the palette length), so each agent
|
|
241
|
+
* gets a consistent colour across renders. `undefined` when nothing is
|
|
242
|
+
* pinned, the agent isn't in the current array, or the host has opted out
|
|
243
|
+
* via `chatConfig.picker.disablePinColours`.
|
|
244
|
+
*/
|
|
245
|
+
get pinnedAgentColour(): string | undefined;
|
|
246
|
+
/**
|
|
247
|
+
* Placeholder shown in the chat input. Substitutes the pinned agent's name
|
|
248
|
+
* when one is selected so the user has a clearer signal of where their
|
|
249
|
+
* message will go; otherwise falls back to the host-provided placeholder.
|
|
250
|
+
*/
|
|
251
|
+
get effectivePlaceholder(): string;
|
|
186
252
|
toggleShowToolCalls(): void;
|
|
187
253
|
toggleShowThinkingSteps(): void;
|
|
188
254
|
toggleShowAgentSwitchIndicator(): void;
|
|
@@ -201,7 +267,8 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
201
267
|
systemPrompt?: string;
|
|
202
268
|
primerHistory?: ChatMessage[];
|
|
203
269
|
subAgents?: AgentConfig[];
|
|
204
|
-
chatInputDuringExecution?:
|
|
270
|
+
chatInputDuringExecution?: ChatInputDuringExecutionMode;
|
|
271
|
+
manualSelection?: import("../config/config").ManualSelectionConfig;
|
|
205
272
|
} | {
|
|
206
273
|
toolDefinitions: import("../utils/tool-fold").ToolTreeNode[];
|
|
207
274
|
toolHandlers: any;
|
|
@@ -211,7 +278,8 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
211
278
|
systemPrompt?: string;
|
|
212
279
|
primerHistory?: ChatMessage[];
|
|
213
280
|
subAgents?: AgentConfig[];
|
|
214
|
-
chatInputDuringExecution?:
|
|
281
|
+
chatInputDuringExecution?: ChatInputDuringExecutionMode;
|
|
282
|
+
manualSelection?: import("../config/config").ManualSelectionConfig;
|
|
215
283
|
})[];
|
|
216
284
|
activeSystemPrompt: string;
|
|
217
285
|
activePrimerHistory: ChatMessage[];
|
|
@@ -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,
|
|
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;AAgDtB;;;;;;;;;;;;;GAaG;AACH,qBAOa,qBAAsB,SAAQ,cAAc;IAC3C,UAAU,EAAG,UAAU,CAAC;IAExB,kBAAkB,EAAE,MAAM,CAAW;IACZ,WAAW,EAAE,MAAM,CAAuB;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC5C,WAAW,EAAE,MAAM,CAA0B;IACrD;;;;;OAKG;IACiC,UAAU,CAAC,EAAE,UAAU,CAAC;IAC5D;;;OAGG;IACS,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,UAAU,EAAE,UAAU,CAAM;IAExC;;;OAGG;IACH,IAAI,WAAW,IAAI,e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IAEF,cAAc;IAId,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAQjC;IAEF,iBAAiB;IAIjB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO;IAWnE,gGAAgG;IAChG,IACI,kBAAkB,IAAI,OAAO,CAIhC;IAED,2FAA2F;IAC3F,IACI,eAAe,IAAI,MAAM,GAAG,SAAS,CAGxC;IAED;;;;;;OAMG;IACH,IACI,iBAAiB,IAAI,MAAM,GAAG,SAAS,CAM1C;IAED;;;;OAIG;IACH,IACI,oBAAoB,IAAI,MAAM,CAGjC;IAED,mBAAmB;IAInB,uBAAuB;IAIvB,8BAA8B;IAI9B,oBAAoB,CAAC,UAAU,EAAE,oBAAoB,EAAE;IAIvD,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqBX,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;YAuDhB,IAAI;IAwClB,qBAAqB,CAAC,CAAC,EAAE,UAAU;IAYnC,0BAA0B,CAAC,CAAC,EAAE,KAAK;CAQpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.styles.d.ts","sourceRoot":"","sources":["../../../src/main/main.styles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"main.styles.d.ts","sourceRoot":"","sources":["../../../src/main/main.styles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,MAAM,iDAoqBlB,CAAC"}
|
|
@@ -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,CAiepC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.types.d.ts","sourceRoot":"","sources":["../../../src/main/main.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAE5D;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE/C;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GACxB;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAClB;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,GACrB;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE,GAC3C;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,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O,MAAM,cAAc,EAAkC,oBAAoB,EAAE,CAAC"}
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
import type { ChatMessage } from '@genesislcap/foundation-ai';
|
|
1
|
+
import type { ChatInputDuringExecutionMode, ChatMessage } from '@genesislcap/foundation-ai';
|
|
2
2
|
import type { PayloadAction } from '@genesislcap/foundation-redux';
|
|
3
3
|
import type { AgentConfig } from '../config/config';
|
|
4
4
|
import type { AiAssistantAnimation, AiAssistantState, SuggestionsState } from '../main/main.types';
|
|
5
|
+
/**
|
|
6
|
+
* A single in-flight per-call chat-input override pushed by a `requestSubAgent`
|
|
7
|
+
* invocation. Tracked as an array (not a counter) so the slice can survive
|
|
8
|
+
* pop-in/pop-out and so a listener that connects mid-execution can compute the
|
|
9
|
+
* effective mode without having seen the start event.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export interface SubAgentInputOverride {
|
|
14
|
+
/** Unique per-invocation id, paired with the start/stop events. */
|
|
15
|
+
id: string;
|
|
16
|
+
/** The mode requested for this invocation. */
|
|
17
|
+
mode: ChatInputDuringExecutionMode;
|
|
18
|
+
}
|
|
5
19
|
/**
|
|
6
20
|
* Shape of a single AI assistant session's serializable state.
|
|
7
21
|
*
|
|
@@ -18,12 +32,30 @@ export interface AiAssistantSessionState {
|
|
|
18
32
|
contextTokens: number | undefined;
|
|
19
33
|
contextLimit: number | undefined;
|
|
20
34
|
activeAgent: Omit<AgentConfig, 'toolHandlers'> | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Name of the agent the user has pinned via the picker. `null` means the
|
|
37
|
+
* orchestrator chooses each turn (Auto). Survives lifecycle events but
|
|
38
|
+
* resets on page refresh.
|
|
39
|
+
*/
|
|
40
|
+
pinnedAgentName: string | null;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the agent picker slide-out panel is currently open. Lives in the
|
|
43
|
+
* slice so the bubble-dialog and popout-panel instances stay in sync as the
|
|
44
|
+
* user pops in and out.
|
|
45
|
+
*/
|
|
46
|
+
agentPickerOpen: boolean;
|
|
21
47
|
/** Draft text in the input box — preserved across pop-in/pop-out cycles. */
|
|
22
48
|
inputValue: string;
|
|
23
49
|
/** Live trace from a currently-executing sub-agent. Cleared on sub-agent-stop. */
|
|
24
50
|
liveSubAgentTrace: ChatMessage[];
|
|
25
51
|
/** Name of the currently-executing sub-agent, or null when idle. */
|
|
26
52
|
liveSubAgentName: string | null;
|
|
53
|
+
/**
|
|
54
|
+
* In-flight per-call chat-input overrides pushed by `requestSubAgent` calls.
|
|
55
|
+
* The most restrictive entry (`'hidden'` > `'disabled'`) wins; an empty list
|
|
56
|
+
* means the agent-level `chatInputDuringExecution` applies.
|
|
57
|
+
*/
|
|
58
|
+
subAgentInputOverrides: SubAgentInputOverride[];
|
|
27
59
|
}
|
|
28
60
|
export declare const defaultSessionState: AiAssistantSessionState;
|
|
29
61
|
export declare const aiAssistantSlice: import("@reduxjs/toolkit").Slice<AiAssistantSessionState, {
|
|
@@ -37,8 +69,14 @@ export declare const aiAssistantSlice: import("@reduxjs/toolkit").Slice<AiAssist
|
|
|
37
69
|
setContextTokens(state: import("immer").WritableDraft<AiAssistantSessionState>, action: PayloadAction<number | undefined>): void;
|
|
38
70
|
setContextLimit(state: import("immer").WritableDraft<AiAssistantSessionState>, action: PayloadAction<number | undefined>): void;
|
|
39
71
|
setActiveAgent(state: import("immer").WritableDraft<AiAssistantSessionState>, action: PayloadAction<Omit<AgentConfig, "toolHandlers"> | undefined>): void;
|
|
72
|
+
setPinnedAgentName(state: import("immer").WritableDraft<AiAssistantSessionState>, action: PayloadAction<string | null>): void;
|
|
73
|
+
setAgentPickerOpen(state: import("immer").WritableDraft<AiAssistantSessionState>, action: PayloadAction<boolean>): void;
|
|
40
74
|
setInputValue(state: import("immer").WritableDraft<AiAssistantSessionState>, action: PayloadAction<string>): void;
|
|
41
75
|
setLiveSubAgentTrace(state: import("immer").WritableDraft<AiAssistantSessionState>, action: PayloadAction<ChatMessage[]>): void;
|
|
42
76
|
setLiveSubAgentName(state: import("immer").WritableDraft<AiAssistantSessionState>, action: PayloadAction<string | null>): void;
|
|
77
|
+
addSubAgentInputOverride(state: import("immer").WritableDraft<AiAssistantSessionState>, action: PayloadAction<SubAgentInputOverride>): void;
|
|
78
|
+
removeSubAgentInputOverride(state: import("immer").WritableDraft<AiAssistantSessionState>, action: PayloadAction<{
|
|
79
|
+
id: string;
|
|
80
|
+
}>): void;
|
|
43
81
|
}, "aiAssistant", "aiAssistant", {}>;
|
|
44
82
|
//# sourceMappingURL=ai-assistant-slice.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-assistant-slice.d.ts","sourceRoot":"","sources":["../../../src/state/ai-assistant-slice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"ai-assistant-slice.d.ts","sourceRoot":"","sources":["../../../src/state/ai-assistant-slice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE5F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEnG;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAqB;IACpC,mEAAmE;IACnE,EAAE,EAAE,MAAM,CAAC;IACX,8CAA8C;IAC9C,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,KAAK,EAAE,gBAAgB,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,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AAM,GAAG,IAAI,CAAC;oGAGvB,aAAa,CAAC,qBAAqB,CAAC;uGAGjC,aAAa,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;oCAO1E,CAAC"}
|
|
@@ -11,9 +11,15 @@ declare function makeStore(devTools: boolean | undefined): import("@genesislcap/
|
|
|
11
11
|
setContextTokens(state: import("immer").WritableDraft<AiAssistantSessionState>, action: import("@reduxjs/toolkit").PayloadAction<number | undefined>): void;
|
|
12
12
|
setContextLimit(state: import("immer").WritableDraft<AiAssistantSessionState>, action: import("@reduxjs/toolkit").PayloadAction<number | undefined>): void;
|
|
13
13
|
setActiveAgent(state: import("immer").WritableDraft<AiAssistantSessionState>, action: import("@reduxjs/toolkit").PayloadAction<Omit<import("..").AgentConfig, "toolHandlers"> | undefined>): void;
|
|
14
|
+
setPinnedAgentName(state: import("immer").WritableDraft<AiAssistantSessionState>, action: import("@reduxjs/toolkit").PayloadAction<string | null>): void;
|
|
15
|
+
setAgentPickerOpen(state: import("immer").WritableDraft<AiAssistantSessionState>, action: import("@reduxjs/toolkit").PayloadAction<boolean>): void;
|
|
14
16
|
setInputValue(state: import("immer").WritableDraft<AiAssistantSessionState>, action: import("@reduxjs/toolkit").PayloadAction<string>): void;
|
|
15
17
|
setLiveSubAgentTrace(state: import("immer").WritableDraft<AiAssistantSessionState>, action: import("@reduxjs/toolkit").PayloadAction<import("@genesislcap/foundation-ai").ChatMessage[]>): void;
|
|
16
18
|
setLiveSubAgentName(state: import("immer").WritableDraft<AiAssistantSessionState>, action: import("@reduxjs/toolkit").PayloadAction<string | null>): void;
|
|
19
|
+
addSubAgentInputOverride(state: import("immer").WritableDraft<AiAssistantSessionState>, action: import("@reduxjs/toolkit").PayloadAction<import("./ai-assistant-slice").SubAgentInputOverride>): void;
|
|
20
|
+
removeSubAgentInputOverride(state: import("immer").WritableDraft<AiAssistantSessionState>, action: import("@reduxjs/toolkit").PayloadAction<{
|
|
21
|
+
id: string;
|
|
22
|
+
}>): void;
|
|
17
23
|
}, "aiAssistant", "aiAssistant", {}>[]>;
|
|
18
24
|
/**
|
|
19
25
|
* Returns the session store for the given key, creating one if it does not
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-store.d.ts","sourceRoot":"","sources":["../../../src/state/session-store.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,sBAAsB,CAAC;AAE9B,KAAK,kBAAkB,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAIvD,iBAAS,SAAS,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS
|
|
1
|
+
{"version":3,"file":"session-store.d.ts","sourceRoot":"","sources":["../../../src/state/session-store.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,sBAAsB,CAAC;AAE9B,KAAK,kBAAkB,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAIvD,iBAAS,SAAS,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;wCAM/C;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAMnF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED,YAAY,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drives the open/close lifecycle of a slide-out panel inside a component's
|
|
3
|
+
* shadow root, with a tracked close timer instead of an `animationend`
|
|
4
|
+
* listener so the panel cannot wedge open if it's unmounted mid-animation
|
|
5
|
+
* (pop-in/pop-out, dock change, host disconnect).
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare class AnimatedPanelToggle {
|
|
10
|
+
private readonly host;
|
|
11
|
+
private readonly selector;
|
|
12
|
+
private readonly closeDurationMs;
|
|
13
|
+
private readonly getOpen;
|
|
14
|
+
private readonly setOpen;
|
|
15
|
+
private timer?;
|
|
16
|
+
constructor(host: HTMLElement, selector: string, closeDurationMs: number, getOpen: () => boolean, setOpen: (v: boolean) => void);
|
|
17
|
+
private queryPanel;
|
|
18
|
+
toggle(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Synchronously finalise an in-flight close — call from
|
|
21
|
+
* `disconnectedCallback` so the closed state lands in the store before any
|
|
22
|
+
* session ref is cleared.
|
|
23
|
+
*/
|
|
24
|
+
finalize(): void;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=animated-panel-toggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animated-panel-toggle.d.ts","sourceRoot":"","sources":["../../../src/utils/animated-panel-toggle.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,mBAAmB;IAI5B,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAP1B,OAAO,CAAC,KAAK,CAAC,CAAgC;gBAG3B,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,MAAM,OAAO,EACtB,OAAO,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI;IAGhD,OAAO,CAAC,UAAU;IAIlB,MAAM,IAAI,IAAI;IA2Bd;;;;OAIG;IACH,QAAQ,IAAI,IAAI;CAMjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, customElement, GenesisElement, html, observable, volatile, } from '@genesislcap/web-core';
|
|
3
|
+
import { styles } from './agent-picker.styles';
|
|
4
|
+
import { AgentPickerTemplate } from './agent-picker.template';
|
|
5
|
+
/** Sentinel value used by the segmented control / select to represent "Auto". */
|
|
6
|
+
export const AGENT_PICKER_AUTO_VALUE = '__auto__';
|
|
7
|
+
/** Tolerance for `scrollWidth > clientWidth` overflow detection (sub-pixel rounding). */
|
|
8
|
+
const OVERFLOW_TOLERANCE_PX = 1;
|
|
9
|
+
/**
|
|
10
|
+
* User-facing agent picker rendered above the chat input.
|
|
11
|
+
*
|
|
12
|
+
* Renders `Auto` plus each top-level agent that has `manualSelection.enabled`.
|
|
13
|
+
* Sub-agents and non-selectable specialists are excluded. Hidden when fewer
|
|
14
|
+
* than two agents are configured or none are manually selectable.
|
|
15
|
+
*
|
|
16
|
+
* @fires agent-pinned - Fired when the user changes selection. `detail` is the
|
|
17
|
+
* agent name (string) or `null` for Auto.
|
|
18
|
+
*
|
|
19
|
+
* @beta
|
|
20
|
+
*/
|
|
21
|
+
let AgentPicker = class AgentPicker extends GenesisElement {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
/** Design-system tag prefix, e.g. `'rapid'` for `rapid-segmented-control`. */
|
|
25
|
+
this.designSystemPrefix = 'rapid';
|
|
26
|
+
/** Picker variant, sourced from the assistant's `chatConfig.agentPicker`. */
|
|
27
|
+
this.mode = 'disabled';
|
|
28
|
+
/** Top-level agents passed to the assistant. */
|
|
29
|
+
this.agents = [];
|
|
30
|
+
/** Currently pinned agent name, or `null` for Auto. */
|
|
31
|
+
this.pinnedAgentName = null;
|
|
32
|
+
/**
|
|
33
|
+
* @internal — true when the segmented row's content overflows its container.
|
|
34
|
+
* Drives the fallback to `select` rendering. Only meaningful when
|
|
35
|
+
* `mode === 'segmented-control'`.
|
|
36
|
+
*/
|
|
37
|
+
this.overflowing = false;
|
|
38
|
+
}
|
|
39
|
+
/** Top-level agents that opted in to manual selection. */
|
|
40
|
+
get selectableAgents() {
|
|
41
|
+
var _a;
|
|
42
|
+
return ((_a = this.agents) !== null && _a !== void 0 ? _a : []).filter((a) => { var _a; return (_a = a.manualSelection) === null || _a === void 0 ? void 0 : _a.enabled; });
|
|
43
|
+
}
|
|
44
|
+
/** Whether the picker should render at all. */
|
|
45
|
+
get visible() {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
if (this.mode === 'disabled')
|
|
48
|
+
return false;
|
|
49
|
+
if (((_b = (_a = this.agents) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) <= 1)
|
|
50
|
+
return false;
|
|
51
|
+
if (this.selectableAgents.length === 0)
|
|
52
|
+
return false;
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The variant actually rendered: `'select'` if user-configured or if the
|
|
57
|
+
* segmented row currently overflows; `'segmented-control'` otherwise.
|
|
58
|
+
*/
|
|
59
|
+
get effectiveMode() {
|
|
60
|
+
if (this.mode === 'segmented-control') {
|
|
61
|
+
return this.overflowing ? 'select' : 'segmented-control';
|
|
62
|
+
}
|
|
63
|
+
return 'select';
|
|
64
|
+
}
|
|
65
|
+
connectedCallback() {
|
|
66
|
+
super.connectedCallback();
|
|
67
|
+
if (typeof ResizeObserver === 'undefined')
|
|
68
|
+
return;
|
|
69
|
+
this.resizeObserver = new ResizeObserver(() => this.measureOverflow());
|
|
70
|
+
this.resizeObserver.observe(this);
|
|
71
|
+
}
|
|
72
|
+
disconnectedCallback() {
|
|
73
|
+
var _a;
|
|
74
|
+
super.disconnectedCallback();
|
|
75
|
+
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
76
|
+
this.resizeObserver = undefined;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Re-measure when agents change — newly added selectable agents may push the
|
|
80
|
+
* segmented row past the container's width.
|
|
81
|
+
*/
|
|
82
|
+
agentsChanged() {
|
|
83
|
+
queueMicrotask(() => this.measureOverflow());
|
|
84
|
+
}
|
|
85
|
+
modeChanged() {
|
|
86
|
+
queueMicrotask(() => this.measureOverflow());
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Measures whether the segmented row's natural content width exceeds the
|
|
90
|
+
* container's visible width. Bails when the row isn't currently rendered
|
|
91
|
+
* (e.g. when `mode !== 'segmented-control'`).
|
|
92
|
+
*/
|
|
93
|
+
measureOverflow() {
|
|
94
|
+
const row = this.segmentedRowEl;
|
|
95
|
+
if (!row) {
|
|
96
|
+
this.overflowing = false;
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
this.overflowing = row.scrollWidth > row.clientWidth + OVERFLOW_TOLERANCE_PX;
|
|
100
|
+
}
|
|
101
|
+
selectAgent(name) {
|
|
102
|
+
this.pinnedAgentName = name;
|
|
103
|
+
// Always emit — the host may close a slide-out panel on click even when
|
|
104
|
+
// the selection didn't change.
|
|
105
|
+
this.$emit('agent-pinned', name);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Maps a value from the segmented-control or select (which uses
|
|
109
|
+
* {@link AGENT_PICKER_AUTO_VALUE} for Auto) back to the `string | null` form
|
|
110
|
+
* expected by `selectAgent`.
|
|
111
|
+
*/
|
|
112
|
+
selectByValue(value) {
|
|
113
|
+
this.selectAgent(value === AGENT_PICKER_AUTO_VALUE ? null : value);
|
|
114
|
+
}
|
|
115
|
+
/** Current pinned agent name as a value the segmented-control / select can bind to. */
|
|
116
|
+
get currentValue() {
|
|
117
|
+
var _a;
|
|
118
|
+
return (_a = this.pinnedAgentName) !== null && _a !== void 0 ? _a : AGENT_PICKER_AUTO_VALUE;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
__decorate([
|
|
122
|
+
attr({ attribute: 'design-system-prefix' })
|
|
123
|
+
], AgentPicker.prototype, "designSystemPrefix", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
observable
|
|
126
|
+
], AgentPicker.prototype, "mode", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
observable
|
|
129
|
+
], AgentPicker.prototype, "agents", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
observable
|
|
132
|
+
], AgentPicker.prototype, "pinnedAgentName", void 0);
|
|
133
|
+
__decorate([
|
|
134
|
+
observable
|
|
135
|
+
], AgentPicker.prototype, "overflowing", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
volatile
|
|
138
|
+
], AgentPicker.prototype, "selectableAgents", null);
|
|
139
|
+
__decorate([
|
|
140
|
+
volatile
|
|
141
|
+
], AgentPicker.prototype, "visible", null);
|
|
142
|
+
__decorate([
|
|
143
|
+
volatile
|
|
144
|
+
], AgentPicker.prototype, "effectiveMode", null);
|
|
145
|
+
__decorate([
|
|
146
|
+
volatile
|
|
147
|
+
], AgentPicker.prototype, "currentValue", null);
|
|
148
|
+
AgentPicker = __decorate([
|
|
149
|
+
customElement({
|
|
150
|
+
name: 'foundation-ai-agent-picker',
|
|
151
|
+
template: html `
|
|
152
|
+
${(x) => AgentPickerTemplate(x.designSystemPrefix)}
|
|
153
|
+
`,
|
|
154
|
+
styles,
|
|
155
|
+
})
|
|
156
|
+
], AgentPicker);
|
|
157
|
+
export { AgentPicker };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { css } from '@genesislcap/web-core';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
:host([hidden]) {
|
|
8
|
+
display: none;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.picker {
|
|
12
|
+
position: relative;
|
|
13
|
+
padding: 6px calc(var(--design-unit) * 3px);
|
|
14
|
+
background-color: var(--neutral-layer-2);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Clipping wrapper. The inner segmented-control is naturally inline-flex
|
|
18
|
+
and auto-sizes to its segments, so it would overflow the panel without
|
|
19
|
+
ever reporting scrollWidth > clientWidth. By giving the wrapper a
|
|
20
|
+
constrained width (flex+min-width:0) and overflow:hidden, the wrapper's
|
|
21
|
+
scrollWidth reflects the segments' natural width while clientWidth is
|
|
22
|
+
the available width — that's what we measure to decide on the fallback. */
|
|
23
|
+
.segmented-row {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex: 1 1 auto;
|
|
26
|
+
min-width: 0;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* When the fallback select is showing, take the segmented row out of layout
|
|
31
|
+
but keep it in the DOM so the ResizeObserver can re-measure when the
|
|
32
|
+
container grows back and we can swap back to segmented-control. */
|
|
33
|
+
.picker[data-effective='select'] .segmented-row {
|
|
34
|
+
position: absolute;
|
|
35
|
+
inset: 6px calc(var(--design-unit) * 3px);
|
|
36
|
+
visibility: hidden;
|
|
37
|
+
pointer-events: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.segmented-control {
|
|
41
|
+
flex: 0 0 auto;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.select-fallback {
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
gap: 6px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.select-label {
|
|
51
|
+
font-family: var(--body-font);
|
|
52
|
+
font-size: 0.8em;
|
|
53
|
+
color: var(--neutral-foreground-hint, var(--neutral-foreground-rest));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.select-control {
|
|
57
|
+
flex: 1 1 auto;
|
|
58
|
+
min-width: 0;
|
|
59
|
+
padding: 4px 8px;
|
|
60
|
+
background: var(--neutral-layer-3);
|
|
61
|
+
color: var(--neutral-foreground-rest);
|
|
62
|
+
border: 1px solid var(--neutral-stroke-rest);
|
|
63
|
+
border-radius: 4px;
|
|
64
|
+
font-family: var(--body-font);
|
|
65
|
+
font-size: 0.85em;
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.select-control:focus-visible {
|
|
70
|
+
outline: 2px solid var(--accent-fill-rest);
|
|
71
|
+
outline-offset: 1px;
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { html, ref, repeat, when } from '@genesislcap/web-core';
|
|
2
|
+
import { AGENT_PICKER_AUTO_VALUE } from './agent-picker';
|
|
3
|
+
const AUTO_LABEL = 'Auto';
|
|
4
|
+
const AUTO_HINT = 'Let the orchestrator pick the right agent for each message.';
|
|
5
|
+
/** @internal */
|
|
6
|
+
export const AgentPickerTemplate = (designSystemPrefix) => {
|
|
7
|
+
const segmentedControlTag = `${designSystemPrefix}-segmented-control`;
|
|
8
|
+
const segmentedItemTag = `${designSystemPrefix}-segmented-item`;
|
|
9
|
+
return html `
|
|
10
|
+
<div class="picker" data-effective="${(x) => x.effectiveMode}" part="picker">
|
|
11
|
+
${when((x) => x.mode === 'segmented-control', html `
|
|
12
|
+
<div class="segmented-row" ${ref('segmentedRowEl')}>
|
|
13
|
+
<${segmentedControlTag}
|
|
14
|
+
class="segmented-control"
|
|
15
|
+
appearance="primary"
|
|
16
|
+
aria-label="Active agent"
|
|
17
|
+
:value="${(x) => x.currentValue}"
|
|
18
|
+
@change="${(x, c) => {
|
|
19
|
+
const value = c.event.currentTarget.value;
|
|
20
|
+
// The segmented-control re-emits 'change' on its initial value
|
|
21
|
+
// sync; ignore it so we don't close the panel on open.
|
|
22
|
+
if (typeof value !== 'string' || value === x.currentValue)
|
|
23
|
+
return;
|
|
24
|
+
x.selectByValue(value);
|
|
25
|
+
}}"
|
|
26
|
+
>
|
|
27
|
+
<${segmentedItemTag}
|
|
28
|
+
value="${AGENT_PICKER_AUTO_VALUE}"
|
|
29
|
+
title="${AUTO_HINT}"
|
|
30
|
+
>${AUTO_LABEL}</${segmentedItemTag}>
|
|
31
|
+
${repeat((x) => x.selectableAgents, html `
|
|
32
|
+
<${segmentedItemTag}
|
|
33
|
+
value="${(a) => a.name}"
|
|
34
|
+
title="${(a) => { var _a, _b; return (_b = (_a = a.manualSelection) === null || _a === void 0 ? void 0 : _a.hint) !== null && _b !== void 0 ? _b : ''; }}"
|
|
35
|
+
>${(a) => a.name}</${segmentedItemTag}>
|
|
36
|
+
`)}
|
|
37
|
+
</${segmentedControlTag}>
|
|
38
|
+
</div>
|
|
39
|
+
`)}
|
|
40
|
+
${when((x) => x.effectiveMode === 'select', html `
|
|
41
|
+
<div class="select-fallback">
|
|
42
|
+
<span class="select-label">Agent:</span>
|
|
43
|
+
<select
|
|
44
|
+
class="select-control"
|
|
45
|
+
aria-label="Active agent"
|
|
46
|
+
@change="${(x, c) => {
|
|
47
|
+
const value = c.event.target.value;
|
|
48
|
+
x.selectByValue(value);
|
|
49
|
+
}}"
|
|
50
|
+
>
|
|
51
|
+
<option
|
|
52
|
+
value="${AGENT_PICKER_AUTO_VALUE}"
|
|
53
|
+
title="${AUTO_HINT}"
|
|
54
|
+
?selected="${(x) => x.pinnedAgentName === null}"
|
|
55
|
+
>
|
|
56
|
+
${AUTO_LABEL}
|
|
57
|
+
</option>
|
|
58
|
+
${repeat((x) => x.selectableAgents, html `
|
|
59
|
+
<option
|
|
60
|
+
value="${(a) => a.name}"
|
|
61
|
+
title="${(a) => { var _a, _b; return (_b = (_a = a.manualSelection) === null || _a === void 0 ? void 0 : _a.hint) !== null && _b !== void 0 ? _b : ''; }}"
|
|
62
|
+
?selected="${(a, c) => c.parent.pinnedAgentName === a.name}"
|
|
63
|
+
>
|
|
64
|
+
${(a) => { var _a; return ((_a = a.manualSelection) === null || _a === void 0 ? void 0 : _a.hint) ? `${a.name} — ${a.manualSelection.hint}` : a.name; }}
|
|
65
|
+
</option>
|
|
66
|
+
`)}
|
|
67
|
+
</select>
|
|
68
|
+
</div>
|
|
69
|
+
`)}
|
|
70
|
+
</div>
|
|
71
|
+
`;
|
|
72
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './agent-picker';
|