@genesislcap/ai-assistant 14.431.0 → 14.432.1-FUI-2489.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 (35) hide show
  1. package/api-extractor.json +2 -2
  2. package/dist/ai-assistant.api.json +136 -4
  3. package/dist/ai-assistant.d.ts +55 -2
  4. package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.d.ts.map +1 -1
  5. package/dist/dts/components/popout-manager/popout-manager.d.ts.map +1 -1
  6. package/dist/dts/config/config.d.ts +20 -0
  7. package/dist/dts/config/config.d.ts.map +1 -1
  8. package/dist/dts/main/main.d.ts +22 -1
  9. package/dist/dts/main/main.d.ts.map +1 -1
  10. package/dist/dts/main/main.template.d.ts.map +1 -1
  11. package/dist/dts/suggestions/chat-suggestions.d.ts.map +1 -1
  12. package/dist/dts/tags/index.d.ts +1 -0
  13. package/dist/dts/tags/index.d.ts.map +1 -1
  14. package/dist/dts/types/ai-chat-widget.d.ts +12 -1
  15. package/dist/dts/types/ai-chat-widget.d.ts.map +1 -1
  16. package/dist/esm/components/chat-driver/chat-driver.js +2 -2
  17. package/dist/esm/components/chat-interaction-wrapper/chat-interaction-wrapper.js +6 -0
  18. package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +4 -4
  19. package/dist/esm/components/popout-manager/popout-manager.js +1 -0
  20. package/dist/esm/main/main.js +59 -12
  21. package/dist/esm/main/main.template.js +30 -29
  22. package/dist/esm/suggestions/chat-suggestions.js +1 -2
  23. package/dist/esm/tags/index.js +1 -0
  24. package/package.json +16 -16
  25. package/src/components/chat-driver/chat-driver.ts +2 -2
  26. package/src/components/chat-interaction-wrapper/chat-interaction-wrapper.ts +6 -0
  27. package/src/components/orchestrating-driver/orchestrating-driver.ts +4 -4
  28. package/src/components/popout-manager/popout-manager.ts +1 -0
  29. package/src/config/config.ts +21 -0
  30. package/src/main/main.template.ts +47 -42
  31. package/src/main/main.ts +52 -9
  32. package/src/suggestions/chat-suggestions.ts +9 -2
  33. package/src/tags/index.ts +1 -0
  34. package/src/types/ai-chat-widget.ts +12 -1
  35. package/tsconfig.json +1 -3
@@ -1,4 +1,4 @@
1
1
  {
2
- "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../../api-extractor.json"
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "../../../../api-extractor.json"
4
4
  }
@@ -963,7 +963,7 @@
963
963
  {
964
964
  "kind": "Interface",
965
965
  "canonicalReference": "@genesislcap/ai-assistant!AiChatWidget:interface",
966
- "docComment": "/**\n * Interface that AI inline interaction components can implement. The `AiChatInteractionWrapper` always sets `data` and `resolved` on the rendered element.\n *\n * @beta\n */\n",
966
+ "docComment": "/**\n * Interface that AI inline interaction components can implement. The `AiChatInteractionWrapper` always sets `data`, `resolved`, and `shouldAutoFocus` on the rendered element.\n *\n * @beta\n */\n",
967
967
  "excerptTokens": [
968
968
  {
969
969
  "kind": "Content",
@@ -1033,6 +1033,33 @@
1033
1033
  "startIndex": 1,
1034
1034
  "endIndex": 3
1035
1035
  }
1036
+ },
1037
+ {
1038
+ "kind": "PropertySignature",
1039
+ "canonicalReference": "@genesislcap/ai-assistant!AiChatWidget#shouldAutoFocus:member",
1040
+ "docComment": "/**\n * True when the widget is being mounted fresh and the assistant currently has the user's engagement (last pointer/focus interaction was inside the assistant). Widgets with input fields should use this to decide whether to call `.focus()` on mount. False when: - the user has interacted with something outside the assistant, or - this widget has already been resolved (we're re-rendering history due to a layout-lifecycle remount, dock/undock, etc.).\n */\n",
1041
+ "excerptTokens": [
1042
+ {
1043
+ "kind": "Content",
1044
+ "text": "shouldAutoFocus?: "
1045
+ },
1046
+ {
1047
+ "kind": "Content",
1048
+ "text": "boolean"
1049
+ },
1050
+ {
1051
+ "kind": "Content",
1052
+ "text": ";"
1053
+ }
1054
+ ],
1055
+ "isReadonly": false,
1056
+ "isOptional": true,
1057
+ "releaseTag": "Beta",
1058
+ "name": "shouldAutoFocus",
1059
+ "propertyTypeTokenRange": {
1060
+ "startIndex": 1,
1061
+ "endIndex": 2
1062
+ }
1036
1063
  }
1037
1064
  ],
1038
1065
  "extendsTokenRanges": []
@@ -2638,6 +2665,32 @@
2638
2665
  "endIndex": 7
2639
2666
  }
2640
2667
  },
2668
+ {
2669
+ "kind": "TypeAlias",
2670
+ "canonicalReference": "@genesislcap/ai-assistant!ChatInputDuringExecutionMode:type",
2671
+ "docComment": "/**\n * Controls how the main chat input area behaves while this agent is executing (i.e. while `state === 'loading'` — covers both LLM thinking and pending widget interactions).\n *\n * - `'disabled'` (default): input stays visible but disabled. - `'hidden'`: the entire input row (attach button, textarea, send button) is hidden. Useful for agents whose interaction widgets contain their own input affordances and where a second disabled chat input is redundant or confusing — typically long-running agents (planners) where one transition in/out is less jarring than mid-run flicker.\n *\n * @beta\n */\n",
2672
+ "excerptTokens": [
2673
+ {
2674
+ "kind": "Content",
2675
+ "text": "export type ChatInputDuringExecutionMode = "
2676
+ },
2677
+ {
2678
+ "kind": "Content",
2679
+ "text": "'disabled' | 'hidden'"
2680
+ },
2681
+ {
2682
+ "kind": "Content",
2683
+ "text": ";"
2684
+ }
2685
+ ],
2686
+ "fileUrlPath": "src/config/config.ts",
2687
+ "releaseTag": "Beta",
2688
+ "name": "ChatInputDuringExecutionMode",
2689
+ "typeTokenRange": {
2690
+ "startIndex": 1,
2691
+ "endIndex": 2
2692
+ }
2693
+ },
2641
2694
  {
2642
2695
  "kind": "Function",
2643
2696
  "canonicalReference": "@genesislcap/ai-assistant!createToolFold:function(1)",
@@ -3229,6 +3282,37 @@
3229
3282
  "isAbstract": false,
3230
3283
  "name": "chatConfigChanged"
3231
3284
  },
3285
+ {
3286
+ "kind": "Property",
3287
+ "canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#chatInputEl:member",
3288
+ "docComment": "/**\n * Bound to the rapid-text-area chat input via the template ref.\n */\n",
3289
+ "excerptTokens": [
3290
+ {
3291
+ "kind": "Content",
3292
+ "text": "chatInputEl?: "
3293
+ },
3294
+ {
3295
+ "kind": "Reference",
3296
+ "text": "HTMLElement",
3297
+ "canonicalReference": "!HTMLElement:interface"
3298
+ },
3299
+ {
3300
+ "kind": "Content",
3301
+ "text": ";"
3302
+ }
3303
+ ],
3304
+ "isReadonly": false,
3305
+ "isOptional": true,
3306
+ "releaseTag": "Beta",
3307
+ "name": "chatInputEl",
3308
+ "propertyTypeTokenRange": {
3309
+ "startIndex": 1,
3310
+ "endIndex": 2
3311
+ },
3312
+ "isStatic": false,
3313
+ "isProtected": false,
3314
+ "isAbstract": false
3315
+ },
3232
3316
  {
3233
3317
  "kind": "Method",
3234
3318
  "canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#connectedCallback:member(1)",
@@ -3563,7 +3647,16 @@
3563
3647
  },
3564
3648
  {
3565
3649
  "kind": "Content",
3566
- "text": "[];\n } | {\n toolDefinitions: import(\"../utils/tool-fold\")."
3650
+ "text": "[];\n chatInputDuringExecution?: import(\"../config/config\")."
3651
+ },
3652
+ {
3653
+ "kind": "Reference",
3654
+ "text": "ChatInputDuringExecutionMode",
3655
+ "canonicalReference": "@genesislcap/ai-assistant!ChatInputDuringExecutionMode:type"
3656
+ },
3657
+ {
3658
+ "kind": "Content",
3659
+ "text": ";\n } | {\n toolDefinitions: import(\"../utils/tool-fold\")."
3567
3660
  },
3568
3661
  {
3569
3662
  "kind": "Reference",
@@ -3590,7 +3683,16 @@
3590
3683
  },
3591
3684
  {
3592
3685
  "kind": "Content",
3593
- "text": "[];\n })[];\n activeSystemPrompt: string;\n activePrimerHistory: "
3686
+ "text": "[];\n chatInputDuringExecution?: import(\"../config/config\")."
3687
+ },
3688
+ {
3689
+ "kind": "Reference",
3690
+ "text": "ChatInputDuringExecutionMode",
3691
+ "canonicalReference": "@genesislcap/ai-assistant!ChatInputDuringExecutionMode:type"
3692
+ },
3693
+ {
3694
+ "kind": "Content",
3695
+ "text": ";\n })[];\n activeSystemPrompt: string;\n activePrimerHistory: "
3594
3696
  },
3595
3697
  {
3596
3698
  "kind": "Reference",
@@ -3609,7 +3711,7 @@
3609
3711
  "isStatic": false,
3610
3712
  "returnTypeTokenRange": {
3611
3713
  "startIndex": 1,
3612
- "endIndex": 18
3714
+ "endIndex": 22
3613
3715
  },
3614
3716
  "releaseTag": "Beta",
3615
3717
  "isProtected": false,
@@ -3947,6 +4049,36 @@
3947
4049
  "isProtected": false,
3948
4050
  "isAbstract": false
3949
4051
  },
4052
+ {
4053
+ "kind": "Property",
4054
+ "canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#isEngaged:member",
4055
+ "docComment": "/**\n * True when the user's last interaction (pointer or keyboard focus) was inside the assistant. Defaults to true so the assistant claims focus on first mount. Auto-focus features (chat input on idle, widget inputs on mount) gate on this to avoid stealing focus from elsewhere on the page.\n */\n",
4056
+ "excerptTokens": [
4057
+ {
4058
+ "kind": "Content",
4059
+ "text": "isEngaged: "
4060
+ },
4061
+ {
4062
+ "kind": "Content",
4063
+ "text": "boolean"
4064
+ },
4065
+ {
4066
+ "kind": "Content",
4067
+ "text": ";"
4068
+ }
4069
+ ],
4070
+ "isReadonly": false,
4071
+ "isOptional": false,
4072
+ "releaseTag": "Beta",
4073
+ "name": "isEngaged",
4074
+ "propertyTypeTokenRange": {
4075
+ "startIndex": 1,
4076
+ "endIndex": 2
4077
+ },
4078
+ "isStatic": false,
4079
+ "isProtected": false,
4080
+ "isAbstract": false
4081
+ },
3950
4082
  {
3951
4083
  "kind": "Property",
3952
4084
  "canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#liveSubAgentName:member",
@@ -159,7 +159,8 @@ export declare class AiChatMarkdown extends GenesisElement {
159
159
 
160
160
  /**
161
161
  * Interface that AI inline interaction components can implement.
162
- * The `AiChatInteractionWrapper` always sets `data` and `resolved` on the rendered element.
162
+ * The `AiChatInteractionWrapper` always sets `data`, `resolved`, and
163
+ * `shouldAutoFocus` on the rendered element.
163
164
  *
164
165
  * @beta
165
166
  */
@@ -167,6 +168,16 @@ export declare interface AiChatWidget {
167
168
  data: unknown;
168
169
  /** The result when the interaction has been resolved. Truthy = resolved; value contains status/payload for display. */
169
170
  resolved?: InteractionResult<unknown>;
171
+ /**
172
+ * True when the widget is being mounted fresh and the assistant currently has
173
+ * the user's engagement (last pointer/focus interaction was inside the
174
+ * assistant). Widgets with input fields should use this to decide whether to
175
+ * call `.focus()` on mount. False when:
176
+ * - the user has interacted with something outside the assistant, or
177
+ * - this widget has already been resolved (we're re-rendering history due
178
+ * to a layout-lifecycle remount, dock/undock, etc.).
179
+ */
180
+ shouldAutoFocus?: boolean;
170
181
  }
171
182
 
172
183
  /**
@@ -294,6 +305,11 @@ declare interface BaseAgentConfig {
294
305
  * Sub-agents available to this agent's tool handlers via `requestSubAgent`.
295
306
  */
296
307
  subAgents?: AgentConfig[];
308
+ /**
309
+ * How the main chat input area behaves while this agent is executing.
310
+ * Defaults to `'disabled'`. See {@link ChatInputDuringExecutionMode}.
311
+ */
312
+ chatInputDuringExecution?: ChatInputDuringExecutionMode;
297
313
  }
298
314
 
299
315
  /**
@@ -433,6 +449,22 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
433
449
  */
434
450
  export declare type ChatHistoryUpdatedEvent = CustomEvent<ReadonlyArray<ChatMessage>>;
435
451
 
452
+ /**
453
+ * Controls how the main chat input area behaves while this agent is executing
454
+ * (i.e. while `state === 'loading'` — covers both LLM thinking and pending
455
+ * widget interactions).
456
+ *
457
+ * - `'disabled'` (default): input stays visible but disabled.
458
+ * - `'hidden'`: the entire input row (attach button, textarea, send button) is
459
+ * hidden. Useful for agents whose interaction widgets contain their own
460
+ * input affordances and where a second disabled chat input is redundant or
461
+ * confusing — typically long-running agents (planners) where one transition
462
+ * in/out is less jarring than mid-run flicker.
463
+ *
464
+ * @beta
465
+ */
466
+ export declare type ChatInputDuringExecutionMode = 'disabled' | 'hidden';
467
+
436
468
  /**
437
469
  * Creates a tool fold — a facade that hides a group of related tools behind a single
438
470
  * named entry, revealing them progressively when the model invokes the facade.
@@ -581,6 +613,16 @@ export declare class FoundationAiAssistant extends GenesisElement {
581
613
  set messages(value: ChatMessage[]);
582
614
  get state(): AiAssistantState;
583
615
  set state(value: AiAssistantState);
616
+ /**
617
+ * Focus the main chat input if the user is still engaged with the assistant.
618
+ * Deferred to the next frame so any conditional re-render (e.g. unhiding the
619
+ * input row when an agent's `chatInputDuringExecution: 'hidden'` execution
620
+ * ends) has committed before we call `.focus()`.
621
+ *
622
+ * `rapid-text-area` does not delegate focus to its inner native `<textarea>`,
623
+ * so we drill into its shadow root and focus the textarea directly.
624
+ */
625
+ private maybeAutoFocusChatInput;
584
626
  get activeAgent(): Omit<AgentConfig, 'toolHandlers'> | undefined;
585
627
  set activeAgent(value: AgentConfig | undefined);
586
628
  get suggestionsState(): SuggestionsState;
@@ -627,6 +669,16 @@ export declare class FoundationAiAssistant extends GenesisElement {
627
669
  private _driverAgentsKey?;
628
670
  /** Bound to the messages container via the template ref — assigned by FAST before connectedCallback logic runs. */
629
671
  messagesEl?: HTMLElement;
672
+ /** Bound to the rapid-text-area chat input via the template ref. */
673
+ chatInputEl?: HTMLElement;
674
+ /**
675
+ * True when the user's last interaction (pointer or keyboard focus) was inside
676
+ * the assistant. Defaults to true so the assistant claims focus on first mount.
677
+ * Auto-focus features (chat input on idle, widget inputs on mount) gate on this
678
+ * to avoid stealing focus from elsewhere on the page.
679
+ */
680
+ isEngaged: boolean;
681
+ private _handleGlobalInteraction;
630
682
  /** True when the user has intentionally scrolled away from the bottom — suppresses auto-scroll. */
631
683
  private _userScrolledAway;
632
684
  private _scrollListener?;
@@ -718,6 +770,7 @@ export declare class FoundationAiAssistant extends GenesisElement {
718
770
  systemPrompt?: string;
719
771
  primerHistory?: ChatMessage[];
720
772
  subAgents?: AgentConfig[];
773
+ chatInputDuringExecution?: ChatInputDuringExecutionMode;
721
774
  } | {
722
775
  toolDefinitions: ToolTreeNode[];
723
776
  toolHandlers: any;
@@ -727,6 +780,7 @@ export declare class FoundationAiAssistant extends GenesisElement {
727
780
  systemPrompt?: string;
728
781
  primerHistory?: ChatMessage[];
729
782
  subAgents?: AgentConfig[];
783
+ chatInputDuringExecution?: ChatInputDuringExecutionMode;
730
784
  })[];
731
785
  activeSystemPrompt: string;
732
786
  activePrimerHistory: ChatMessage[];
@@ -746,7 +800,6 @@ export declare class FoundationAiAssistant extends GenesisElement {
746
800
  handleSuggestionClick(suggestion: string): void;
747
801
  private fetchSuggestions;
748
802
  private send;
749
- private restoreFocusIfAppropriate;
750
803
  onChatHeaderMouseDown(e: MouseEvent): void;
751
804
  handleInteractionCompleted(e: Event): void;
752
805
  }
@@ -1 +1 @@
1
- {"version":3,"file":"chat-interaction-wrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/chat-interaction-wrapper/chat-interaction-wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAiB,cAAc,EAAc,MAAM,uBAAuB,CAAC;AAKlF,MAAM,MAAM,wBAAwB,GAAG;IACrC,uBAAuB,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;CACjF,CAAC;AAEF;;;;;GAKG;AACH,qBAKa,wBAAyB,SAAQ,cAAc;IAC1D,gBAAgB;IACJ,aAAa,EAAE,MAAM,CAAM;IACvC,gBAAgB;IACJ,IAAI,EAAE,GAAG,CAAC;IACtB,gBAAgB;IACJ,aAAa,EAAE,MAAM,CAAM;IACvC,6GAA6G;IACjG,QAAQ,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG,SAAS,CAAa;IAEzE,gBAAgB;IAChB,SAAS,EAAG,WAAW,CAAC;IAExB,iBAAiB;IAKjB,oBAAoB;IAIpB,eAAe;IAOf,OAAO,CAAC,eAAe;CA8CxB"}
1
+ {"version":3,"file":"chat-interaction-wrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/chat-interaction-wrapper/chat-interaction-wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAiB,cAAc,EAAc,MAAM,uBAAuB,CAAC;AAKlF,MAAM,MAAM,wBAAwB,GAAG;IACrC,uBAAuB,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;CACjF,CAAC;AAEF;;;;;GAKG;AACH,qBAKa,wBAAyB,SAAQ,cAAc;IAC1D,gBAAgB;IACJ,aAAa,EAAE,MAAM,CAAM;IACvC,gBAAgB;IACJ,IAAI,EAAE,GAAG,CAAC;IACtB,gBAAgB;IACJ,aAAa,EAAE,MAAM,CAAM;IACvC,6GAA6G;IACjG,QAAQ,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG,SAAS,CAAa;IAEzE,gBAAgB;IAChB,SAAS,EAAG,WAAW,CAAC;IAExB,iBAAiB;IAKjB,oBAAoB;IAIpB,eAAe;IAOf,OAAO,CAAC,eAAe;CAoDxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"popout-manager.d.ts","sourceRoot":"","sources":["../../../../src/components/popout-manager/popout-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,EAAoB,MAAM,uBAAuB,CAAC;AAGxF;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,qEAAqE;IACrE,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B;;;;OAIG;IACH,gBAAgB,IAAI,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAMa,yBAA0B,SAAQ,cAAc;IAC3D,mFAAmF;IACvE,OAAO,UAAS;IAE5B,OAAO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B,kBAAkB,IAAI,yBAAyB,GAAG,SAAS,CAE1E"}
@@ -1,4 +1,19 @@
1
1
  import type { ChatMessage, ChatToolDefinition, ChatToolHandlers } from '@genesislcap/foundation-ai';
2
+ /**
3
+ * Controls how the main chat input area behaves while this agent is executing
4
+ * (i.e. while `state === 'loading'` — covers both LLM thinking and pending
5
+ * widget interactions).
6
+ *
7
+ * - `'disabled'` (default): input stays visible but disabled.
8
+ * - `'hidden'`: the entire input row (attach button, textarea, send button) is
9
+ * hidden. Useful for agents whose interaction widgets contain their own
10
+ * input affordances and where a second disabled chat input is redundant or
11
+ * confusing — typically long-running agents (planners) where one transition
12
+ * in/out is less jarring than mid-run flicker.
13
+ *
14
+ * @beta
15
+ */
16
+ export type ChatInputDuringExecutionMode = 'disabled' | 'hidden';
2
17
  interface BaseAgentConfig {
3
18
  /**
4
19
  * Display name shown in the chat header when this agent is active.
@@ -25,6 +40,11 @@ interface BaseAgentConfig {
25
40
  * Sub-agents available to this agent's tool handlers via `requestSubAgent`.
26
41
  */
27
42
  subAgents?: AgentConfig[];
43
+ /**
44
+ * How the main chat input area behaves while this agent is executing.
45
+ * Defaults to `'disabled'`. See {@link ChatInputDuringExecutionMode}.
46
+ */
47
+ chatInputDuringExecution?: ChatInputDuringExecutionMode;
28
48
  }
29
49
  /**
30
50
  * Configuration for a specialist agent.
@@ -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,UAAU,eAAe;IACvB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;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;I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;;;GAQG;AACH,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D;;OAEG;IACH,QAAQ,EAAE,IAAI,CAAC;IACf,WAAW,CAAC,EAAE,KAAK,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,qBAAqB,GAAG,mBAAmB,CAAC;AAEtE;;;;;;;;;;;;;;GAcG;AAEH,wBAAgB,WAAW,CAAC,KAAK,CAAC,CAAC,SAAS,WAAW,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAErE"}
@@ -44,6 +44,16 @@ export declare class FoundationAiAssistant extends GenesisElement {
44
44
  set messages(value: ChatMessage[]);
45
45
  get state(): AiAssistantState;
46
46
  set state(value: AiAssistantState);
47
+ /**
48
+ * Focus the main chat input if the user is still engaged with the assistant.
49
+ * Deferred to the next frame so any conditional re-render (e.g. unhiding the
50
+ * input row when an agent's `chatInputDuringExecution: 'hidden'` execution
51
+ * ends) has committed before we call `.focus()`.
52
+ *
53
+ * `rapid-text-area` does not delegate focus to its inner native `<textarea>`,
54
+ * so we drill into its shadow root and focus the textarea directly.
55
+ */
56
+ private maybeAutoFocusChatInput;
47
57
  get activeAgent(): Omit<AgentConfig, 'toolHandlers'> | undefined;
48
58
  set activeAgent(value: AgentConfig | undefined);
49
59
  get suggestionsState(): SuggestionsState;
@@ -90,6 +100,16 @@ export declare class FoundationAiAssistant extends GenesisElement {
90
100
  private _driverAgentsKey?;
91
101
  /** Bound to the messages container via the template ref — assigned by FAST before connectedCallback logic runs. */
92
102
  messagesEl?: HTMLElement;
103
+ /** Bound to the rapid-text-area chat input via the template ref. */
104
+ chatInputEl?: HTMLElement;
105
+ /**
106
+ * True when the user's last interaction (pointer or keyboard focus) was inside
107
+ * the assistant. Defaults to true so the assistant claims focus on first mount.
108
+ * Auto-focus features (chat input on idle, widget inputs on mount) gate on this
109
+ * to avoid stealing focus from elsewhere on the page.
110
+ */
111
+ isEngaged: boolean;
112
+ private _handleGlobalInteraction;
93
113
  /** True when the user has intentionally scrolled away from the bottom — suppresses auto-scroll. */
94
114
  private _userScrolledAway;
95
115
  private _scrollListener?;
@@ -181,6 +201,7 @@ export declare class FoundationAiAssistant extends GenesisElement {
181
201
  systemPrompt?: string;
182
202
  primerHistory?: ChatMessage[];
183
203
  subAgents?: AgentConfig[];
204
+ chatInputDuringExecution?: import("../config/config").ChatInputDuringExecutionMode;
184
205
  } | {
185
206
  toolDefinitions: import("../utils/tool-fold").ToolTreeNode[];
186
207
  toolHandlers: any;
@@ -190,6 +211,7 @@ export declare class FoundationAiAssistant extends GenesisElement {
190
211
  systemPrompt?: string;
191
212
  primerHistory?: ChatMessage[];
192
213
  subAgents?: AgentConfig[];
214
+ chatInputDuringExecution?: import("../config/config").ChatInputDuringExecutionMode;
193
215
  })[];
194
216
  activeSystemPrompt: string;
195
217
  activePrimerHistory: ChatMessage[];
@@ -209,7 +231,6 @@ export declare class FoundationAiAssistant extends GenesisElement {
209
231
  handleSuggestionClick(suggestion: string): void;
210
232
  private fetchSuggestions;
211
233
  private send;
212
- private restoreFocusIfAppropriate;
213
234
  onChatHeaderMouseDown(e: MouseEvent): void;
214
235
  handleInteractionCompleted(e: Event): void;
215
236
  }
@@ -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,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE1F,OAAO,EAGL,cAAc,EAIf,MAAM,uBAAuB,CAAC;AAU/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AASpD,OAAO,KAAK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AC,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;IAqClB,qBAAqB,CAAC,CAAC,EAAE,UAAU;IAYnC,0BAA0B,CAAC,CAAC,EAAE,KAAK;CAQpC"}
@@ -1 +1 @@
1
- {"version":3,"file":"main.template.d.ts","sourceRoot":"","sources":["../../../src/main/main.template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAA2B,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAiIpD,gBAAgB;AAChB,eAAO,MAAM,6BAA6B,GACxC,oBAAoB,MAAM,KACzB,YAAY,CAAC,qBAAqB,CA0ZpC,CAAC"}
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,CA+ZpC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"chat-suggestions.d.ts","sourceRoot":"","sources":["../../../src/suggestions/chat-suggestions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AA+I3D,qBAKa,eAAgB,SAAQ,cAAc;IAEjD,KAAK,EAAE,gBAAgB,CAAsB;IAE7C,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;CAGhD"}
1
+ {"version":3,"file":"chat-suggestions.d.ts","sourceRoot":"","sources":["../../../src/suggestions/chat-suggestions.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAMf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AA+I3D,qBAKa,eAAgB,SAAQ,cAAc;IAEjD,KAAK,EAAE,gBAAgB,CAAsB;IAE7C,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;CAGhD"}
@@ -1 +1,2 @@
1
+ export {};
1
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tags/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tags/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import type { InteractionResult } from '@genesislcap/foundation-ai';
2
2
  /**
3
3
  * Interface that AI inline interaction components can implement.
4
- * The `AiChatInteractionWrapper` always sets `data` and `resolved` on the rendered element.
4
+ * The `AiChatInteractionWrapper` always sets `data`, `resolved`, and
5
+ * `shouldAutoFocus` on the rendered element.
5
6
  *
6
7
  * @beta
7
8
  */
@@ -9,5 +10,15 @@ export interface AiChatWidget {
9
10
  data: unknown;
10
11
  /** The result when the interaction has been resolved. Truthy = resolved; value contains status/payload for display. */
11
12
  resolved?: InteractionResult<unknown>;
13
+ /**
14
+ * True when the widget is being mounted fresh and the assistant currently has
15
+ * the user's engagement (last pointer/focus interaction was inside the
16
+ * assistant). Widgets with input fields should use this to decide whether to
17
+ * call `.focus()` on mount. False when:
18
+ * - the user has interacted with something outside the assistant, or
19
+ * - this widget has already been resolved (we're re-rendering history due
20
+ * to a layout-lifecycle remount, dock/undock, etc.).
21
+ */
22
+ shouldAutoFocus?: boolean;
12
23
  }
13
24
  //# sourceMappingURL=ai-chat-widget.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ai-chat-widget.d.ts","sourceRoot":"","sources":["../../../src/types/ai-chat-widget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,uHAAuH;IACvH,QAAQ,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;CACvC"}
1
+ {"version":3,"file":"ai-chat-widget.d.ts","sourceRoot":"","sources":["../../../src/types/ai-chat-widget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,uHAAuH;IACvH,QAAQ,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACtC;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B"}
@@ -496,6 +496,7 @@ export class ChatDriver extends EventTarget {
496
496
  // `iterations` because fold operations decrement iterations, which would incorrectly
497
497
  // re-trigger the slice on subsequent calls after a fold open/close.
498
498
  let firstLlmCall = !!currentInput;
499
+ /* oxlint-disable no-await-in-loop -- tool loop: each iteration depends on prior model response */
499
500
  while (iterations < this.maxToolIterations) {
500
501
  iterations += 1;
501
502
  const foldSuffix = this.buildFoldSystemPromptSuffix();
@@ -522,7 +523,6 @@ export class ChatDriver extends EventTarget {
522
523
  };
523
524
  let response;
524
525
  try {
525
- // eslint-disable-next-line no-await-in-loop
526
526
  response = yield this.aiProvider.chat(historyForCall, currentInput, options);
527
527
  }
528
528
  catch (e) {
@@ -581,7 +581,6 @@ export class ChatDriver extends EventTarget {
581
581
  let anyRealToolExecuted = false;
582
582
  let hitUnknownToolLimit = false;
583
583
  if (toolCalls.length > 0) {
584
- // eslint-disable-next-line no-await-in-loop
585
584
  yield Promise.all(toolCalls.map((tc) => __awaiter(this, void 0, void 0, function* () {
586
585
  // Check for fold facade
587
586
  const fold = this.getFold(tc.name);
@@ -741,6 +740,7 @@ export class ChatDriver extends EventTarget {
741
740
  }
742
741
  currentInput = '';
743
742
  }
743
+ /* oxlint-enable no-await-in-loop */
744
744
  if (iterations >= this.maxToolIterations) {
745
745
  logger.warn('ChatDriver: reached max tool iterations, stopping');
746
746
  this.appendToHistory({
@@ -52,6 +52,12 @@ let AiChatInteractionWrapper = class AiChatInteractionWrapper extends GenesisEle
52
52
  element.data = this.data;
53
53
  }
54
54
  element.resolved = this.resolved;
55
+ // Pierce the wrapper's shadow boundary to read engagement from the
56
+ // assistant host. False if the widget is already resolved — re-renders
57
+ // from history (layout remount, dock/undock) must never steal focus.
58
+ const root = this.getRootNode();
59
+ const host = root instanceof ShadowRoot ? root.host : null;
60
+ element.shouldAutoFocus = !this.resolved && !!(host === null || host === void 0 ? void 0 : host.isEngaged);
55
61
  // Handle completion from the inner component.
56
62
  // Guard against re-emission if the interaction was already resolved
57
63
  // (e.g. auto-resolve components fire on connectedCallback when rendering history).
@@ -119,11 +119,11 @@ export class OrchestratingDriver extends EventTarget {
119
119
  const contextPrimer = handoffSummary
120
120
  ? [{ role: 'user', content: `[Context from previous agent]: ${handoffSummary}` }]
121
121
  : [];
122
- // eslint-disable-next-line no-await-in-loop
122
+ // oxlint-disable-next-line no-await-in-loop
123
123
  result = yield this.chatDriver.continueFromHistory(contextPrimer);
124
124
  }
125
125
  else {
126
- // eslint-disable-next-line no-await-in-loop
126
+ // oxlint-disable-next-line no-await-in-loop
127
127
  result = yield this.chatDriver.sendMessage(input, attachments);
128
128
  }
129
129
  if (result.reason !== 'agent-handoff' || isFallback(currentAgent)) {
@@ -139,7 +139,7 @@ export class OrchestratingDriver extends EventTarget {
139
139
  isHandoff = true;
140
140
  const updatedHistory = this.chatDriver.getHistory();
141
141
  this.dispatchEvent(new CustomEvent('orchestrating-start'));
142
- // eslint-disable-next-line no-await-in-loop
142
+ // oxlint-disable-next-line no-await-in-loop
143
143
  currentAgent = yield this.classify(remainingTask, updatedHistory);
144
144
  }
145
145
  return { reason: 'done' };
@@ -205,7 +205,7 @@ export class OrchestratingDriver extends EventTarget {
205
205
  systemPrompt: classifierPrompt,
206
206
  tools: [routingTool],
207
207
  };
208
- // eslint-disable-next-line no-await-in-loop
208
+ // oxlint-disable-next-line no-await-in-loop
209
209
  const response = yield this.aiProvider.chat([], input, options);
210
210
  const tc = (_b = response.toolCalls) === null || _b === void 0 ? void 0 : _b[0];
211
211
  const index = (tc === null || tc === void 0 ? void 0 : tc.name) === 'select_agent' ? tc.args.agent_index : -1;
@@ -35,6 +35,7 @@ let FoundationAiPopoutManager = class FoundationAiPopoutManager extends GenesisE
35
35
  }
36
36
  connectedCallback() {
37
37
  super.connectedCallback();
38
+ // oxlint-disable-next-line typescript-eslint(no-this-alias) -- module-level singleton, not a local alias
38
39
  _aiPopoutManager = this;
39
40
  const bubble = this.querySelector('foundation-ai-chat-bubble');
40
41
  const assistantEl = bubble === null || bubble === void 0 ? void 0 : bubble.querySelector('[slot="dialog-content"]');