@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.
Files changed (64) hide show
  1. package/dist/ai-assistant.api.json +1110 -2791
  2. package/dist/ai-assistant.d.ts +45 -267
  3. package/dist/dts/channel/ai-activity-channel.d.ts +0 -1
  4. package/dist/dts/channel/ai-activity-channel.d.ts.map +1 -1
  5. package/dist/dts/components/chat-driver/chat-driver.d.ts +7 -25
  6. package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
  7. package/dist/dts/components/halo-overlay.d.ts +1 -13
  8. package/dist/dts/components/halo-overlay.d.ts.map +1 -1
  9. package/dist/dts/config/config.d.ts +15 -43
  10. package/dist/dts/config/config.d.ts.map +1 -1
  11. package/dist/dts/config/index.d.ts +0 -1
  12. package/dist/dts/config/index.d.ts.map +1 -1
  13. package/dist/dts/index.d.ts +0 -4
  14. package/dist/dts/index.d.ts.map +1 -1
  15. package/dist/dts/main/main.d.ts +7 -16
  16. package/dist/dts/main/main.d.ts.map +1 -1
  17. package/dist/dts/main/main.styles.d.ts.map +1 -1
  18. package/dist/dts/main/main.template.d.ts.map +1 -1
  19. package/dist/esm/components/chat-driver/chat-driver.js +31 -86
  20. package/dist/esm/components/halo-overlay.js +7 -53
  21. package/dist/esm/config/index.js +0 -1
  22. package/dist/esm/index.js +0 -4
  23. package/dist/esm/main/main.js +45 -103
  24. package/dist/esm/main/main.styles.js +4 -145
  25. package/dist/esm/main/main.template.js +61 -97
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/package.json +15 -15
  28. package/src/channel/ai-activity-channel.ts +0 -1
  29. package/src/components/chat-driver/chat-driver.ts +35 -116
  30. package/src/components/halo-overlay.ts +7 -45
  31. package/src/config/config.ts +15 -45
  32. package/src/config/index.ts +0 -1
  33. package/src/index.ts +0 -4
  34. package/src/main/main.styles.ts +4 -145
  35. package/src/main/main.template.ts +78 -116
  36. package/src/main/main.ts +50 -105
  37. package/dist/dts/components/ai-driver/ai-driver.d.ts +0 -38
  38. package/dist/dts/components/ai-driver/ai-driver.d.ts.map +0 -1
  39. package/dist/dts/components/ai-driver/index.d.ts +0 -2
  40. package/dist/dts/components/ai-driver/index.d.ts.map +0 -1
  41. package/dist/dts/components/orchestrating-driver/index.d.ts +0 -2
  42. package/dist/dts/components/orchestrating-driver/index.d.ts.map +0 -1
  43. package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts +0 -36
  44. package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts.map +0 -1
  45. package/dist/dts/components/popout-manager/index.d.ts +0 -2
  46. package/dist/dts/components/popout-manager/index.d.ts.map +0 -1
  47. package/dist/dts/components/popout-manager/popout-manager.d.ts +0 -74
  48. package/dist/dts/components/popout-manager/popout-manager.d.ts.map +0 -1
  49. package/dist/dts/config/fallback-agents.d.ts +0 -20
  50. package/dist/dts/config/fallback-agents.d.ts.map +0 -1
  51. package/dist/esm/components/ai-driver/ai-driver.js +0 -1
  52. package/dist/esm/components/ai-driver/index.js +0 -1
  53. package/dist/esm/components/orchestrating-driver/index.js +0 -1
  54. package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +0 -229
  55. package/dist/esm/components/popout-manager/index.js +0 -1
  56. package/dist/esm/components/popout-manager/popout-manager.js +0 -119
  57. package/dist/esm/config/fallback-agents.js +0 -26
  58. package/src/components/ai-driver/ai-driver.ts +0 -42
  59. package/src/components/ai-driver/index.ts +0 -1
  60. package/src/components/orchestrating-driver/index.ts +0 -1
  61. package/src/components/orchestrating-driver/orchestrating-driver.ts +0 -300
  62. package/src/components/popout-manager/index.ts +0 -1
  63. package/src/components/popout-manager/popout-manager.ts +0 -144
  64. package/src/config/fallback-agents.ts +0 -29
@@ -9,8 +9,7 @@ import type { AiAssistantAnimation, AiAssistantState, PopoutMode } from './main.
9
9
  *
10
10
  * @remarks
11
11
  * Inject an `AIProvider` through the DI container. Pass agent configuration via the `agents`
12
- * property. The component creates a `ChatDriver` (single agent) or `OrchestratingDriver`
13
- * (multiple agents) to manage the conversation loop.
12
+ * property. The component creates a `ChatDriver` to manage the conversation loop.
14
13
  *
15
14
  * @beta
16
15
  */
@@ -39,13 +38,10 @@ export declare class FoundationAiAssistant extends GenesisElement {
39
38
  inputValue: string;
40
39
  attachments: ChatAttachment[];
41
40
  attachmentErrors: string[];
42
- activeAgent?: AgentConfig;
43
41
  /** Current user-facing toggle state for tool call visibility. */
44
42
  showToolCalls: boolean;
45
43
  /** Current user-facing toggle state for thinking step visibility. */
46
44
  showThinkingSteps: boolean;
47
- /** Current user-facing toggle state for agent switch indicator visibility. */
48
- showAgentSwitchIndicator: boolean;
49
45
  /** Currently enabled animations. */
50
46
  enabledAnimations: AiAssistantAnimation[];
51
47
  /** Whether the loading spinner is currently visible. Controlled by the loading delay timer. */
@@ -56,7 +52,11 @@ export declare class FoundationAiAssistant extends GenesisElement {
56
52
  private loadingTimer;
57
53
  private unsubBus?;
58
54
  private haloStartPublished;
59
- showHalo: 'no' | 'orchestrating' | 'agent';
55
+ /**
56
+ * Whether the halo animation should be shown.
57
+ * True when the AI is actively computing (loading state, no pending interaction).
58
+ */
59
+ showHalo: boolean;
60
60
  private syncShowHalo;
61
61
  /** True when there is a pending (unresolved) interaction — disables the popout button. */
62
62
  get hasActivePendingInteraction(): boolean;
@@ -87,17 +87,8 @@ export declare class FoundationAiAssistant extends GenesisElement {
87
87
  toggleSettings(): void;
88
88
  toggleShowToolCalls(): void;
89
89
  toggleShowThinkingSteps(): void;
90
- toggleShowAgentSwitchIndicator(): void;
91
90
  setEnabledAnimations(animations: AiAssistantAnimation[]): void;
92
- getDebugLog(): {
93
- messages: readonly ChatMessage[];
94
- agentSummary: AgentConfig[];
95
- host: string;
96
- activeSystemPrompt: string;
97
- activePrimerHistory: ChatMessage[];
98
- debug: unknown;
99
- };
100
- downloadDebugLog(): void;
91
+ downloadHistory(): void;
101
92
  triggerFileInput(): void;
102
93
  handleFileSelect(e: Event): void;
103
94
  removeAttachment(attachment: ChatAttachment): void;
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/main/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE1F,OAAO,EAGL,cAAc,EAIf,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AASjF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAKpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAWvF;;;;;;;;;GASG;AACH,qBAOa,qBAAsB,SAAQ,cAAc;IAC3C,UAAU,EAAG,UAAU,CAAC;IAExB,kBAAkB,EAAE,MAAM,CAAW;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACxB,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;IAC5B,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC;IAElC,QAAQ,EAAE,WAAW,EAAE,CAAM;IAC7B,KAAK,EAAE,gBAAgB,CAAU;IACjC,UAAU,SAAM;IAChB,WAAW,EAAE,cAAc,EAAE,CAAM;IACnC,gBAAgB,EAAE,MAAM,EAAE,CAAM;IAChC,WAAW,CAAC,EAAE,WAAW,CAAC;IAEtC,iEAAiE;IACrD,aAAa,UAAS;IAClC,qEAAqE;IACzD,iBAAiB,UAAS;IACtC,8EAA8E;IAClE,wBAAwB,UAAS;IAC7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IlD,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAU5C,OAAO,CAAC,cAAc;IAetB,OAAO,CAAC,cAAc;YASR,iBAAiB;IAmC/B,eAAe;YAID,IAAI;IAqBlB,OAAO,CAAC,yBAAyB;IAWjC,qBAAqB,CAAC,CAAC,EAAE,UAAU;IAYnC,0BAA0B,CAAC,CAAC,EAAE,KAAK;CAOpC"}
@@ -1 +1 @@
1
- {"version":3,"file":"main.styles.d.ts","sourceRoot":"","sources":["../../../src/main/main.styles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,MAAM,iDAoflB,CAAC"}
1
+ {"version":3,"file":"main.styles.d.ts","sourceRoot":"","sources":["../../../src/main/main.styles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,MAAM,iDAuWlB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"main.template.d.ts","sourceRoot":"","sources":["../../../src/main/main.template.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AA6DpD,gBAAgB;AAChB,eAAO,MAAM,6BAA6B,GACxC,oBAAoB,MAAM,KACzB,YAAY,CAAC,qBAAqB,CAsVpC,CAAC"}
1
+ {"version":3,"file":"main.template.d.ts","sourceRoot":"","sources":["../../../src/main/main.template.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAuDpD,gBAAgB;AAChB,eAAO,MAAM,6BAA6B,GACxC,oBAAoB,MAAM,KACzB,YAAY,CAAC,qBAAqB,CAsTpC,CAAC"}
@@ -3,8 +3,6 @@ import { MalformedFunctionCallError } from '@genesislcap/foundation-ai';
3
3
  import { logger } from '../../utils/logger';
4
4
  const DEFAULT_MAX_TOOL_ITERATIONS = 50;
5
5
  const MAX_MALFORMED_RETRIES = 2;
6
- /** Name reserved for the cross-agent handoff tool — injected by OrchestratingDriver. */
7
- export const REQUEST_CONTINUATION_TOOL = 'request_continuation';
8
6
  /**
9
7
  * Plain TS class that drives a multi-turn chat conversation, including the tool-call loop.
10
8
  * Owned by `FoundationAiAssistant` — created in `connectedCallback`, torn down in `disconnectedCallback`.
@@ -17,33 +15,21 @@ export class ChatDriver extends EventTarget {
17
15
  constructor(aiProvider, toolHandlers = {}, toolDefinitions = [], systemPrompt, primerHistory, maxToolIterations = DEFAULT_MAX_TOOL_ITERATIONS) {
18
16
  super();
19
17
  this.aiProvider = aiProvider;
20
- this.maxToolIterations = maxToolIterations;
21
- this.history = [];
22
- this.busy = false;
23
- this.pendingInteractions = new Map();
24
18
  this.toolHandlers = toolHandlers;
25
19
  this.toolDefinitions = toolDefinitions;
26
20
  this.systemPrompt = systemPrompt;
27
21
  this.primerHistory = primerHistory;
28
- }
29
- /**
30
- * Swap in a new agent's configuration. Called by OrchestratingDriver before
31
- * each specialist turn so the shared driver runs with the right tools and prompt.
32
- */
33
- applyAgent(config) {
34
- var _a, _b;
35
- this.systemPrompt = config.systemPrompt;
36
- this.toolDefinitions = (_a = config.toolDefinitions) !== null && _a !== void 0 ? _a : [];
37
- this.toolHandlers = (_b = config.toolHandlers) !== null && _b !== void 0 ? _b : {};
38
- this.primerHistory = config.primerHistory;
39
- this.activeAgentName = config.name;
22
+ this.maxToolIterations = maxToolIterations;
23
+ this.history = [];
24
+ this.busy = false;
25
+ this.pendingInteractions = new Map();
26
+ if (!systemPrompt) {
27
+ logger.error('ChatDriver: no systemPrompt provided. The assistant will have no instructions — set the systemPrompt property on foundation-ai-assistant.');
28
+ }
40
29
  }
41
30
  getHistory() {
42
31
  return this.history;
43
32
  }
44
- getRawHistory() {
45
- return this.history;
46
- }
47
33
  isBusy() {
48
34
  return this.busy;
49
35
  }
@@ -96,88 +82,53 @@ export class ChatDriver extends EventTarget {
96
82
  */
97
83
  loadHistory(messages) {
98
84
  this.history = [...messages];
99
- this.dispatchEvent(new CustomEvent('history-updated', {
100
- detail: this.history,
101
- }));
102
85
  }
103
86
  sendMessage(userInput, attachments) {
104
87
  return __awaiter(this, void 0, void 0, function* () {
105
88
  if (this.busy || (!userInput.trim() && !(attachments === null || attachments === void 0 ? void 0 : attachments.length)))
106
- return { reason: 'done' };
89
+ return;
107
90
  if (!this.aiProvider.chat) {
108
91
  logger.warn('ChatDriver: AIProvider does not implement chat()');
109
- return { reason: 'done' };
92
+ return;
110
93
  }
111
94
  this.busy = true;
112
95
  this.appendToHistory({ role: 'user', content: userInput, attachments });
113
96
  try {
114
- return yield this.runToolLoop(userInput, attachments);
97
+ yield this.runToolLoop(userInput, attachments);
115
98
  }
116
99
  catch (e) {
117
100
  logger.error('ChatDriver error:', e);
118
101
  this.appendToHistory({ role: 'assistant', content: 'Sorry, something went wrong.' });
119
- return { reason: 'done' };
120
102
  }
121
103
  finally {
122
104
  this.busy = false;
123
105
  }
124
106
  });
125
107
  }
126
- /**
127
- * Continue the tool loop from current history without appending a new user message.
128
- * Used by OrchestratingDriver after an agent handoff — the handoff context is
129
- * already in history; `transientPrimer` is injected as an invisible one-shot
130
- * message for this call only.
131
- */
132
- continueFromHistory(transientPrimer) {
133
- return __awaiter(this, void 0, void 0, function* () {
134
- if (this.busy)
135
- return { reason: 'done' };
136
- if (!this.aiProvider.chat) {
137
- logger.warn('ChatDriver: AIProvider does not implement chat()');
138
- return { reason: 'done' };
139
- }
140
- this.busy = true;
141
- try {
142
- return yield this.runToolLoop('', undefined, transientPrimer);
143
- }
144
- catch (e) {
145
- logger.error('ChatDriver error:', e);
146
- this.appendToHistory({ role: 'assistant', content: 'Sorry, something went wrong.' });
147
- return { reason: 'done' };
148
- }
149
- finally {
150
- this.busy = false;
151
- }
152
- });
153
- }
154
- runToolLoop(userInput, attachments, transientPrimer) {
108
+ runToolLoop(userInput, attachments) {
155
109
  return __awaiter(this, void 0, void 0, function* () {
156
110
  var _a, _b, _c, _d, _e, _f;
157
- if (!this.systemPrompt) {
158
- logger.warn('ChatDriver: no systemPrompt set. The assistant will have no instructions — provide a systemPrompt via agents config or the foundation-ai-assistant property.');
159
- }
160
111
  const baseOptions = {
161
112
  systemPrompt: this.systemPrompt,
162
113
  tools: this.toolDefinitions.length ? this.toolDefinitions : undefined,
163
114
  };
115
+ // History has the user message at the end — pass everything before it as history,
116
+ // and the user input as the userMessage argument.
164
117
  let currentInput = userInput;
165
118
  let currentAttachments = attachments;
166
119
  let iterations = 0;
167
120
  let malformedAttempts = 0;
168
- // continueFromHistory callers pass empty input — start at iteration 1 so
169
- // the first LLM call sees the full history (no slice-off-last logic).
170
- const startIteration = currentInput ? 1 : 0;
171
121
  while (iterations < this.maxToolIterations) {
172
122
  iterations += 1;
173
- // On the first iteration of a normal sendMessage call, the last item in
174
- // history is the user message passed separately — exclude it from history.
175
- // On continueFromHistory calls (startIteration=0) or subsequent iterations,
176
- // the full history is sent and currentInput is empty.
177
- const primer = [...((_a = this.primerHistory) !== null && _a !== void 0 ? _a : []), ...(transientPrimer !== null && transientPrimer !== void 0 ? transientPrimer : [])];
178
- const historyForCall = iterations === startIteration
179
- ? [...primer, ...this.history.slice(0, -1)]
180
- : [...primer, ...this.history];
123
+ // On the first iteration, the last item in history is the user message which is
124
+ // passed separately as currentInput — exclude it. On subsequent iterations, the
125
+ // full history (including tool results) should be sent and currentInput is empty.
126
+ // primerHistory (if provided) is prepended to every call but never stored in
127
+ // this.history and never shown in the UI.
128
+ const primer = (_a = this.primerHistory) !== null && _a !== void 0 ? _a : [];
129
+ const historyForCall = iterations === 1 ? [...primer, ...this.history.slice(0, -1)] : [...primer, ...this.history];
130
+ // On malformed-call retries, augment the system prompt to steer the model
131
+ // away from generating Python-style batched function call syntax.
181
132
  const systemPrompt = malformedAttempts > 0
182
133
  ? `${(_b = baseOptions.systemPrompt) !== null && _b !== void 0 ? _b : ''}\n\nIMPORTANT: Use only the structured function-call API to invoke tools. Do not write Python code or use Python-style syntax to call tools.`
183
134
  : baseOptions.systemPrompt;
@@ -192,7 +143,7 @@ export class ChatDriver extends EventTarget {
192
143
  malformedAttempts += 1;
193
144
  if (malformedAttempts < MAX_MALFORMED_RETRIES) {
194
145
  logger.warn(`ChatDriver: MALFORMED_FUNCTION_CALL, retrying (${malformedAttempts}/${MAX_MALFORMED_RETRIES})`);
195
- iterations -= 1;
146
+ iterations -= 1; // don't consume an iteration budget slot for a failed attempt
196
147
  continue;
197
148
  }
198
149
  logger.error('ChatDriver: MALFORMED_FUNCTION_CALL, max retries reached');
@@ -200,17 +151,18 @@ export class ChatDriver extends EventTarget {
200
151
  role: 'assistant',
201
152
  content: "I'm sorry, I wasn't able to complete that request. Please try rephrasing or breaking it into smaller steps.",
202
153
  });
203
- return { reason: 'done' };
154
+ return;
204
155
  }
205
156
  throw e;
206
157
  }
207
- currentAttachments = undefined;
158
+ currentAttachments = undefined; // attachments only sent on first call
208
159
  const isThinkingStep = response.content && ((_c = response.toolCalls) === null || _c === void 0 ? void 0 : _c.length);
209
160
  const isEmptyResponse = !((_d = response.content) === null || _d === void 0 ? void 0 : _d.trim()) && !((_e = response.toolCalls) === null || _e === void 0 ? void 0 : _e.length);
210
161
  if (isEmptyResponse) {
211
- // Discard empty/whitespace-only responses
162
+ // Do nothing, discard empty/whitespace-only responses
212
163
  }
213
164
  else if (isThinkingStep) {
165
+ // Separate thinking message and tool call message
214
166
  this.appendToHistory(Object.assign(Object.assign({}, response), { toolCalls: undefined, thinking: true }));
215
167
  this.appendToHistory(Object.assign(Object.assign({}, response), { content: '' }));
216
168
  }
@@ -218,15 +170,10 @@ export class ChatDriver extends EventTarget {
218
170
  this.appendToHistory(response);
219
171
  }
220
172
  if (!((_f = response.toolCalls) === null || _f === void 0 ? void 0 : _f.length)) {
173
+ // Terminal text response — done
221
174
  break;
222
175
  }
223
- // Check for request_continuation before executing tool calls it is a
224
- // system tool intercepted by OrchestratingDriver, not a real handler.
225
- const continuationCall = response.toolCalls.find((tc) => tc.name === REQUEST_CONTINUATION_TOOL);
226
- if (continuationCall) {
227
- const { summary, remaining_task: remainingTask } = continuationCall.args;
228
- return { reason: 'agent-handoff', summary, remainingTask };
229
- }
176
+ // Execute all tool calls for this iteration concurrently, then append results in order
230
177
  // eslint-disable-next-line no-await-in-loop
231
178
  const toolResults = yield Promise.all(response.toolCalls.map((tc) => __awaiter(this, void 0, void 0, function* () {
232
179
  const handler = this.toolHandlers[tc.name];
@@ -253,18 +200,16 @@ export class ChatDriver extends EventTarget {
253
200
  toolResult: result,
254
201
  });
255
202
  }
203
+ // Next iteration sends an empty string — the tool results are in history
256
204
  currentInput = '';
257
205
  }
258
206
  if (iterations >= this.maxToolIterations) {
259
207
  logger.warn('ChatDriver: reached max tool iterations, stopping');
260
208
  }
261
- return { reason: 'done' };
262
209
  });
263
210
  }
264
211
  appendToHistory(message) {
265
- const tagged = this.activeAgentName
266
- ? Object.assign(Object.assign({}, message), { agentName: this.activeAgentName }) : message;
267
- this.history = [...this.history, tagged];
212
+ this.history = [...this.history, message];
268
213
  this.dispatchEvent(new CustomEvent('history-updated', {
269
214
  detail: this.history,
270
215
  }));
@@ -2,10 +2,6 @@ var AiHaloOverlay_1;
2
2
  import { __decorate } from "tslib";
3
3
  import { attr, css, customElement, GenesisElement, html } from '@genesislcap/web-core';
4
4
  import { AI_COLOUR_AMBER, AI_COLOUR_CYAN, AI_COLOUR_PINK, AI_COLOUR_VIOLET, } from '../styles/ai-colours';
5
- const HALO_DEFAULT_SPEED = 1.5;
6
- const HALO_DEFAULT_BORDER_SIZE = 3;
7
- const HALO_DEFAULT_GLOW_OPACITY = 0.35;
8
- const HALO_DEFAULT_GLOW_SPREAD = 70;
9
5
  /**
10
6
  * Animated halo overlay — rotating conic-gradient border with an inward glow.
11
7
  *
@@ -23,27 +19,8 @@ let AiHaloOverlay = AiHaloOverlay_1 = class AiHaloOverlay extends GenesisElement
23
19
  constructor() {
24
20
  super(...arguments);
25
21
  this.active = false;
26
- /** Rotation speed in degrees per frame. Default: 1.5 (≈ 4 s per full revolution at 60 fps). */
27
- this.speed = HALO_DEFAULT_SPEED;
28
- /** Rotation direction. Default: 'cw' (clockwise). */
29
- this.direction = 'cw';
30
- /** Border thickness in px. Default: 3. */
31
- this.borderSize = HALO_DEFAULT_BORDER_SIZE;
32
- /** Glow layer opacity (0–1). Default: 0.35. */
33
- this.glowOpacity = HALO_DEFAULT_GLOW_OPACITY;
34
- /** Transparent stop of the radial glow mask as a percentage (0–100). Higher = less spread. Default: 70. */
35
- this.glowSpread = HALO_DEFAULT_GLOW_SPREAD;
36
22
  this.angle = 0;
37
23
  }
38
- borderSizeChanged() {
39
- this.style.setProperty('--halo-border-size', `${this.borderSize}px`);
40
- }
41
- glowOpacityChanged() {
42
- this.style.setProperty('--halo-glow-opacity', String(this.glowOpacity));
43
- }
44
- glowSpreadChanged() {
45
- this.style.setProperty('--halo-glow-spread', `${this.glowSpread}%`);
46
- }
47
24
  connectedCallback() {
48
25
  super.connectedCallback();
49
26
  this.tick();
@@ -55,9 +32,7 @@ let AiHaloOverlay = AiHaloOverlay_1 = class AiHaloOverlay extends GenesisElement
55
32
  }
56
33
  }
57
34
  tick() {
58
- const step = this.direction === 'ccw' ? -this.speed : this.speed;
59
- this.angle =
60
- (this.angle + step + AiHaloOverlay_1.FULL_ROTATION_DEG) % AiHaloOverlay_1.FULL_ROTATION_DEG;
35
+ this.angle = (this.angle + AiHaloOverlay_1.DEG_PER_FRAME) % AiHaloOverlay_1.FULL_ROTATION_DEG;
61
36
  this.style.setProperty('--halo-angle', `${this.angle}deg`);
62
37
  this.animFrame = requestAnimationFrame(() => this.tick());
63
38
  }
@@ -67,25 +42,12 @@ let AiHaloOverlay = AiHaloOverlay_1 = class AiHaloOverlay extends GenesisElement
67
42
  // 2. The loop ticks even when `active` is false (idle cost is negligible but non-zero).
68
43
  // Once @property inside Shadow DOM has solid cross-browser support, consider switching back
69
44
  // to a CSS @keyframes approach and removing connectedCallback/disconnectedCallback/tick().
45
+ // 1.5° per frame @ 60 fps ≈ 4 s per full revolution
46
+ AiHaloOverlay.DEG_PER_FRAME = 1.5;
70
47
  AiHaloOverlay.FULL_ROTATION_DEG = 360;
71
48
  __decorate([
72
49
  attr({ mode: 'boolean' })
73
50
  ], AiHaloOverlay.prototype, "active", void 0);
74
- __decorate([
75
- attr({ converter: { fromView: Number, toView: String } })
76
- ], AiHaloOverlay.prototype, "speed", void 0);
77
- __decorate([
78
- attr
79
- ], AiHaloOverlay.prototype, "direction", void 0);
80
- __decorate([
81
- attr({ attribute: 'border-size', converter: { fromView: Number, toView: String } })
82
- ], AiHaloOverlay.prototype, "borderSize", void 0);
83
- __decorate([
84
- attr({ attribute: 'glow-opacity', converter: { fromView: Number, toView: String } })
85
- ], AiHaloOverlay.prototype, "glowOpacity", void 0);
86
- __decorate([
87
- attr({ attribute: 'glow-spread', converter: { fromView: Number, toView: String } })
88
- ], AiHaloOverlay.prototype, "glowSpread", void 0);
89
51
  AiHaloOverlay = AiHaloOverlay_1 = __decorate([
90
52
  customElement({
91
53
  name: 'ai-halo-overlay',
@@ -114,7 +76,7 @@ AiHaloOverlay = AiHaloOverlay_1 = __decorate([
114
76
  position: absolute;
115
77
  inset: 0;
116
78
  border-radius: inherit;
117
- padding: var(--halo-border-size, 3px);
79
+ padding: 3px;
118
80
  background: repeating-conic-gradient(
119
81
  from var(--halo-angle, 0deg),
120
82
  ${AI_COLOUR_AMBER},
@@ -147,17 +109,9 @@ AiHaloOverlay = AiHaloOverlay_1 = __decorate([
147
109
  ${AI_COLOUR_VIOLET},
148
110
  ${AI_COLOUR_AMBER}
149
111
  );
150
- opacity: var(--halo-glow-opacity, 0.35);
151
- -webkit-mask-image: radial-gradient(
152
- ellipse at center,
153
- transparent var(--halo-glow-spread, 70%),
154
- black 100%
155
- );
156
- mask-image: radial-gradient(
157
- ellipse at center,
158
- transparent var(--halo-glow-spread, 70%),
159
- black 100%
160
- );
112
+ opacity: 0.35;
113
+ -webkit-mask-image: radial-gradient(ellipse at center, transparent 70%, black 100%);
114
+ mask-image: radial-gradient(ellipse at center, transparent 70%, black 100%);
161
115
  }
162
116
  `,
163
117
  })
@@ -1,2 +1 @@
1
1
  export * from './config';
2
- export * from './fallback-agents';
package/dist/esm/index.js CHANGED
@@ -1,11 +1,7 @@
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';