@genesislcap/ai-assistant 15.85.1 → 15.86.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 (40) hide show
  1. package/dist/ai-assistant.api.json +65 -4
  2. package/dist/ai-assistant.d.ts +56 -2
  3. package/dist/chat-driver.cjs +2 -0
  4. package/dist/chat-driver.cjs.map +2 -2
  5. package/dist/chat-driver.mjs +2 -0
  6. package/dist/chat-driver.mjs.map +2 -2
  7. package/dist/custom-elements.json +1181 -993
  8. package/dist/dts/autopilot/autopilot-driver.d.ts +46 -2
  9. package/dist/dts/autopilot/autopilot-driver.d.ts.map +1 -1
  10. package/dist/dts/components/chat-bubble/chat-bubble.d.ts +9 -2
  11. package/dist/dts/components/chat-bubble/chat-bubble.d.ts.map +1 -1
  12. package/dist/dts/components/chat-markdown/chat-markdown.d.ts.map +1 -1
  13. package/dist/dts/genesis/write-review/write-review.d.ts +23 -0
  14. package/dist/dts/genesis/write-review/write-review.d.ts.map +1 -1
  15. package/dist/dts/genesis/write-review/write-review.styles.d.ts.map +1 -1
  16. package/dist/dts/genesis/write-review/write-review.template.d.ts.map +1 -1
  17. package/dist/dts/main/main.d.ts +8 -0
  18. package/dist/dts/main/main.d.ts.map +1 -1
  19. package/dist/dts/main/main.styles.d.ts.map +1 -1
  20. package/dist/dts/main/main.template.d.ts.map +1 -1
  21. package/dist/dts/main/main.types.d.ts +2 -0
  22. package/dist/dts/main/main.types.d.ts.map +1 -1
  23. package/dist/dts/react.d.ts +1 -0
  24. package/dist/dts/state/debug-event-log.d.ts +1 -1
  25. package/dist/dts/state/debug-event-log.d.ts.map +1 -1
  26. package/dist/esm/autopilot/autopilot-driver.js +112 -6
  27. package/dist/esm/components/chat-bubble/chat-bubble.js +18 -21
  28. package/dist/esm/components/chat-markdown/chat-markdown.js +18 -2
  29. package/dist/esm/genesis/write-review/write-review.js +48 -0
  30. package/dist/esm/genesis/write-review/write-review.styles.js +67 -1
  31. package/dist/esm/genesis/write-review/write-review.template.js +44 -27
  32. package/dist/esm/main/main.js +13 -0
  33. package/dist/esm/main/main.styles.js +42 -0
  34. package/dist/esm/main/main.template.js +11 -1
  35. package/dist/esm/main/main.types.js +2 -0
  36. package/dist/esm/state/debug-event-log.js +3 -1
  37. package/dist/react.cjs +6 -1
  38. package/dist/react.mjs +6 -1
  39. package/docs/styling.md +10 -4
  40. package/package.json +17 -17
@@ -3547,7 +3547,7 @@
3547
3547
  },
3548
3548
  {
3549
3549
  "kind": "Content",
3550
- "text": "{\n readonly SessionCleared: \"session-cleared\";\n readonly ChatHeaderMouseDown: \"chat-header-mousedown\";\n readonly HandOffStarted: \"handoff-started\";\n readonly HandOffReturned: \"handoff-returned\";\n readonly HandOffUnwound: \"handoff-unwound\";\n}"
3550
+ "text": "{\n readonly SessionCleared: \"session-cleared\";\n readonly ChatHeaderMouseDown: \"chat-header-mousedown\";\n readonly HandOffStarted: \"handoff-started\";\n readonly HandOffReturned: \"handoff-returned\";\n readonly HandOffUnwound: \"handoff-unwound\";\n readonly CloseRequested: \"close-requested\";\n}"
3551
3551
  }
3552
3552
  ],
3553
3553
  "fileUrlPath": "src/main/main.types.ts",
@@ -9733,7 +9733,7 @@
9733
9733
  {
9734
9734
  "kind": "Method",
9735
9735
  "canonicalReference": "@genesislcap/ai-assistant!AutopilotDriver#getPersistedMode:member(1)",
9736
- "docComment": "/**\n * The mode to save with the session, while it is set for the current flow.\n */\n",
9736
+ "docComment": "/**\n * The mode to save with the session, while it is set for the current flow — or kept for a hand-off's caller while its target releases, saved for that target, as the stack saves it.\n */\n",
9737
9737
  "excerptTokens": [
9738
9738
  {
9739
9739
  "kind": "Content",
@@ -19628,7 +19628,7 @@
19628
19628
  {
19629
19629
  "kind": "Class",
19630
19630
  "canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant:class",
19631
- "docComment": "/**\n * Foundation AI Assistant component.\n *\n * @remarks\n *\n * Register one or more AI providers via `registerAIProviders` from `@genesislcap/foundation-ai`; this element resolves the `AIProviderRegistry` through the DI container. Pass agent configuration via the `agents` property — each agent can override which registered provider it uses via `provider:`. The component creates a `ChatDriver` (single agent) or `OrchestratingDriver` (multiple agents) to manage the conversation loop.\n *\n * Popout/collapse coordination uses `agenticActivityBus` topics `chat-popout` and `chat-popin` — not DOM `CustomEvent`s on this element.\n *\n * **Cost build history:** opt-in via `chatConfig.costHistory.enabled`. When enabled, each session's usage is kept as exactly ONE row per session key in `localStorage` (scoped by `costHistory.scope`, the element `id`, or `'default'`), upserted as spend accrues. So a row is a project's lifetime usage rather than a visit to it, and the Usage tab's total is the sum of the rows alone — the live session is never added on top, because the active project's own row already reflects it. Hosts may call {@link FoundationAiAssistant.finalizeCostSession} to flush early; it is idempotent.\n *\n * @fires\n *\n * chat-header-mousedown - Fired when the user presses the chat header in `popout-mode=\"expand\"` (for drag-to-popout hosts). Bubbles and composed. detail: `ChatHeaderMouseDownDetail`\n *\n * @fires\n *\n * session-cleared - Fired after the session is wiped (the lifecycle menu's Clear). The payload is captured before teardown so the host can clean up any external state the active agent was working on. Bubbles and composed. detail: `SessionClearedDetail`\n *\n * @fires\n *\n * handoff-started - Fired when an agent's `handOff` takes effect and its target becomes active. Bubbles and composed. detail: `HandOffFrame`\n *\n * @fires\n *\n * handoff-returned - Fired when a hand-off ends and its caller is active again; `detail.outcome` says how it ended. Bubbles and composed. detail: `HandOffFrame`\n *\n * @fires\n *\n * handoff-unwound - Fired when a hand-off ends with no hand-back: the chat was cleared, the agents changed, or a restore found it could not resume. Bubbles and composed. detail: `HandOffFrame`\n *\n * @beta\n */\n",
19631
+ "docComment": "/**\n * Foundation AI Assistant component.\n *\n * @remarks\n *\n * Register one or more AI providers via `registerAIProviders` from `@genesislcap/foundation-ai`; this element resolves the `AIProviderRegistry` through the DI container. Pass agent configuration via the `agents` property — each agent can override which registered provider it uses via `provider:`. The component creates a `ChatDriver` (single agent) or `OrchestratingDriver` (multiple agents) to manage the conversation loop.\n *\n * Popout/collapse coordination uses `agenticActivityBus` topics `chat-popout` and `chat-popin` — not DOM `CustomEvent`s on this element.\n *\n * **Cost build history:** opt-in via `chatConfig.costHistory.enabled`. When enabled, each session's usage is kept as exactly ONE row per session key in `localStorage` (scoped by `costHistory.scope`, the element `id`, or `'default'`), upserted as spend accrues. So a row is a project's lifetime usage rather than a visit to it, and the Usage tab's total is the sum of the rows alone — the live session is never added on top, because the active project's own row already reflects it. Hosts may call {@link FoundationAiAssistant.finalizeCostSession} to flush early; it is idempotent.\n *\n * @fires\n *\n * chat-header-mousedown - Fired when the user presses the chat header in `popout-mode=\"expand\"` (for drag-to-popout hosts). Bubbles and composed. detail: `ChatHeaderMouseDownDetail`\n *\n * @fires\n *\n * close-requested - Fired when the user presses the header's Close button, which shows while `closable` is set (the chat bubble sets it while the assistant is in its dialog). Bubbles and composed.\n *\n * @fires\n *\n * session-cleared - Fired after the session is wiped (the lifecycle menu's Clear). The payload is captured before teardown so the host can clean up any external state the active agent was working on. Bubbles and composed. detail: `SessionClearedDetail`\n *\n * @fires\n *\n * handoff-started - Fired when an agent's `handOff` takes effect and its target becomes active. Bubbles and composed. detail: `HandOffFrame`\n *\n * @fires\n *\n * handoff-returned - Fired when a hand-off ends and its caller is active again; `detail.outcome` says how it ended. Bubbles and composed. detail: `HandOffFrame`\n *\n * @fires\n *\n * handoff-unwound - Fired when a hand-off ends with no hand-back: the chat was cleared, the agents changed, or a restore found it could not resume. Bubbles and composed. detail: `HandOffFrame`\n *\n * @beta\n */\n",
19632
19632
  "excerptTokens": [
19633
19633
  {
19634
19634
  "kind": "Content",
@@ -20806,6 +20806,36 @@
20806
20806
  "isAbstract": false,
20807
20807
  "name": "clearSession"
20808
20808
  },
20809
+ {
20810
+ "kind": "Property",
20811
+ "canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#closable:member",
20812
+ "docComment": "/**\n * Shows a Close button in the header, which fires `close-requested` and leaves the closing to whatever holds the assistant. The chat bubble sets it while the assistant is in its dialog.\n */\n",
20813
+ "excerptTokens": [
20814
+ {
20815
+ "kind": "Content",
20816
+ "text": "closable: "
20817
+ },
20818
+ {
20819
+ "kind": "Content",
20820
+ "text": "boolean"
20821
+ },
20822
+ {
20823
+ "kind": "Content",
20824
+ "text": ";"
20825
+ }
20826
+ ],
20827
+ "isReadonly": false,
20828
+ "isOptional": false,
20829
+ "releaseTag": "Beta",
20830
+ "name": "closable",
20831
+ "propertyTypeTokenRange": {
20832
+ "startIndex": 1,
20833
+ "endIndex": 2
20834
+ },
20835
+ "isStatic": false,
20836
+ "isProtected": false,
20837
+ "isAbstract": false
20838
+ },
20809
20839
  {
20810
20840
  "kind": "Method",
20811
20841
  "canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#closeSettingsModal:member(1)",
@@ -22568,6 +22598,37 @@
22568
22598
  "isAbstract": false,
22569
22599
  "name": "handleAutopilotResume"
22570
22600
  },
22601
+ {
22602
+ "kind": "Method",
22603
+ "canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#handleClose:member(1)",
22604
+ "docComment": "/**\n * Called when the user clicks the header's Close button.\n */\n",
22605
+ "excerptTokens": [
22606
+ {
22607
+ "kind": "Content",
22608
+ "text": "handleClose(): "
22609
+ },
22610
+ {
22611
+ "kind": "Content",
22612
+ "text": "void"
22613
+ },
22614
+ {
22615
+ "kind": "Content",
22616
+ "text": ";"
22617
+ }
22618
+ ],
22619
+ "isStatic": false,
22620
+ "returnTypeTokenRange": {
22621
+ "startIndex": 1,
22622
+ "endIndex": 2
22623
+ },
22624
+ "releaseTag": "Beta",
22625
+ "isProtected": false,
22626
+ "overloadIndex": 1,
22627
+ "parameters": [],
22628
+ "isOptional": false,
22629
+ "isAbstract": false,
22630
+ "name": "handleClose"
22631
+ },
22571
22632
  {
22572
22633
  "kind": "Method",
22573
22634
  "canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#handleFileSelect:member(1)",
@@ -33076,7 +33137,7 @@
33076
33137
  {
33077
33138
  "kind": "Interface",
33078
33139
  "canonicalReference": "@genesislcap/ai-assistant!PersistedAutopilotMode:interface",
33079
- "docComment": "/**\n * The autopilot's mode as saved with the session (GENC-1660 §4.8): which flow it was set for, and whether it was running. Cleared when that flow ends, so a saved mode never outlives its flow.\n *\n * @beta\n */\n",
33140
+ "docComment": "/**\n * The autopilot's mode as saved with the session (GENC-1660 §4.8): which flow it was set for, and whether it was running. Cleared when that flow ends, so a saved mode never outlives its flow. A hand-off does not end it: the mode goes with the task to the target, and back (GENC-1751).\n *\n * @beta\n */\n",
33080
33141
  "excerptTokens": [
33081
33142
  {
33082
33143
  "kind": "Content",
@@ -799,6 +799,8 @@ export declare const AiAssistantEvent: {
799
799
  readonly HandOffReturned: "handoff-returned";
800
800
  /** A hand-off ended with no hand-back. `detail`: `HandOffFrame`, with `outcome`. */
801
801
  readonly HandOffUnwound: "handoff-unwound";
802
+ /** The header's Close button pressed, shown while `closable` is set. No `detail`. */
803
+ readonly CloseRequested: "close-requested";
802
804
  };
803
805
 
804
806
  /**
@@ -1965,6 +1967,16 @@ export declare class AutopilotDriver extends BaseDriverDecorator implements Auto
1965
1967
  private turnHandBack?;
1966
1968
  /** A mode restored with the session, waiting for its flow to become the owner again. */
1967
1969
  private restored?;
1970
+ /**
1971
+ * The mode of a hand-off's target that has released, kept for its caller, which has not taken the
1972
+ * lock back yet (GENC-1751): the flow has no owner in between. See `carriedTo`.
1973
+ */
1974
+ private handingBack?;
1975
+ /**
1976
+ * The mode of the flow that just ended, should a one-way hand-off with nobody waiting turn out to
1977
+ * have ended it: that switch announces itself only after the owner has changed (GENC-1751).
1978
+ */
1979
+ private switchedFrom?;
1968
1980
  /**
1969
1981
  * Bumped on every pause and resume, and when its sessions end. A written answer is sent only if
1970
1982
  * none came between asking for it and its landing: one started before a pause is stale after it,
@@ -2005,7 +2017,10 @@ export declare class AutopilotDriver extends BaseDriverDecorator implements Auto
2005
2017
  pause(): void;
2006
2018
  resume(): void;
2007
2019
  stop(): void;
2008
- /** The mode to save with the session, while it is set for the current flow. */
2020
+ /**
2021
+ * The mode to save with the session, while it is set for the current flow — or kept for a
2022
+ * hand-off's caller while its target releases, saved for that target, as the stack saves it.
2023
+ */
2009
2024
  getPersistedMode(): PersistedAutopilotMode | undefined;
2010
2025
  /**
2011
2026
  * Bring back a saved mode. It applies once its flow is the owner again — at once if it already
@@ -2157,6 +2172,36 @@ export declare class AutopilotDriver extends BaseDriverDecorator implements Auto
2157
2172
  /** A claimed interaction settled, whoever settled it. */
2158
2173
  private onSettled;
2159
2174
  private onFlowOwnerChanged;
2175
+ /**
2176
+ * A one-way hand-off with nobody waiting is a plain switch, the caller deactivated, so nothing on
2177
+ * the stack says the owner it changed to took over the same task: its event, raised once the
2178
+ * target is active, does (GENC-1751).
2179
+ */
2180
+ private onHandOffStarted;
2181
+ /** The mode set for the current flow, or kept for the caller of a hand-back under way. */
2182
+ private current;
2183
+ /**
2184
+ * The mode that carries to `owner` because the owner changed for a hand-off or its hand-back, as
2185
+ * the hand-off stack shows it at that moment (GENC-1751):
2186
+ * - a hand-off: `owner` is the top frame's target, which has not finished. Its frame is on the
2187
+ * stack before the target is activated, and so is a waiting caller's passed on by a one-way
2188
+ * hand-off from a target;
2189
+ * - a hand-back: the top frame's target, which the mode is set for, has finished, and `owner` is
2190
+ * its caller, or no one while the target releases. Its frame leaves the stack only after the
2191
+ * caller is active again.
2192
+ *
2193
+ * Clear and an agents change empty the stack before the flow ends, so the mode ends with it, as
2194
+ * it ends with any flow. A turn routed away from the target ends the hand-offs the same way.
2195
+ */
2196
+ private carriedTo;
2197
+ /** Whether `owner` is the caller the top hand-off hands back to from `target`. */
2198
+ private handsBack;
2199
+ /**
2200
+ * Set `carried`'s mode for `owner`, which took the task over in a hand-off or its hand-back. A
2201
+ * pause the person chose carries with it; the autopilot's own hand-back of an interaction does
2202
+ * not, since that interaction settled before the hand-off could start.
2203
+ */
2204
+ private carry;
2160
2205
  private capabilityFor;
2161
2206
  private flowOwner;
2162
2207
  private bindingFor;
@@ -4903,6 +4948,7 @@ export declare function formatBlockedReason(budget?: Partial<Extract<ChatDriverR
4903
4948
  * {@link FoundationAiAssistant.finalizeCostSession} to flush early; it is idempotent.
4904
4949
  *
4905
4950
  * @fires chat-header-mousedown - Fired when the user presses the chat header in `popout-mode="expand"` (for drag-to-popout hosts). Bubbles and composed. detail: `ChatHeaderMouseDownDetail`
4951
+ * @fires close-requested - Fired when the user presses the header's Close button, which shows while `closable` is set (the chat bubble sets it while the assistant is in its dialog). Bubbles and composed.
4906
4952
  * @fires session-cleared - Fired after the session is wiped (the lifecycle menu's Clear). The payload is captured before teardown so the host can clean up any external state the active agent was working on. Bubbles and composed. detail: `SessionClearedDetail`
4907
4953
  * @fires handoff-started - Fired when an agent's `handOff` takes effect and its target becomes active. Bubbles and composed. detail: `HandOffFrame`
4908
4954
  * @fires handoff-returned - Fired when a hand-off ends and its caller is active again; `detail.outcome` says how it ended. Bubbles and composed. detail: `HandOffFrame`
@@ -4987,6 +5033,11 @@ export declare class FoundationAiAssistant extends GenesisElement {
4987
5033
  * Absent — no button (default standalone behaviour, no breaking change).
4988
5034
  */
4989
5035
  popoutMode?: PopoutMode;
5036
+ /**
5037
+ * Shows a Close button in the header, which fires `close-requested` and leaves the closing to
5038
+ * whatever holds the assistant. The chat bubble sets it while the assistant is in its dialog.
5039
+ */
5040
+ closable: boolean;
4990
5041
  /**
4991
5042
  * Agent configuration. Each user message is routed to the appropriate specialist
4992
5043
  * based on intent. With a single entry, orchestration is skipped.
@@ -6950,6 +7001,8 @@ export declare class FoundationAiAssistant extends GenesisElement {
6950
7001
  * run inside one of the parent's.
6951
7002
  */
6952
7003
  private reportTurnEnded;
7004
+ /** Called when the user clicks the header's Close button. */
7005
+ handleClose(): void;
6953
7006
  onChatHeaderMouseDown(e: MouseEvent): void;
6954
7007
  handleInteractionCompleted(e: Event): void;
6955
7008
  /**
@@ -8300,7 +8353,8 @@ export declare const PERSISTED_SESSION_VERSION = 1;
8300
8353
 
8301
8354
  /**
8302
8355
  * The autopilot's mode as saved with the session (GENC-1660 §4.8): which flow it was set for, and
8303
- * whether it was running. Cleared when that flow ends, so a saved mode never outlives its flow.
8356
+ * whether it was running. Cleared when that flow ends, so a saved mode never outlives its flow. A
8357
+ * hand-off does not end it: the mode goes with the task to the target, and back (GENC-1751).
8304
8358
  *
8305
8359
  * @beta
8306
8360
  */
@@ -4133,6 +4133,8 @@ var META_EVENT_IMPORTANCE = {
4133
4133
  "autopilot.handed-back": "normal",
4134
4134
  "autopilot.paused": "normal",
4135
4135
  "autopilot.resumed": "normal",
4136
+ // The mode went with the task across a hand-off or its hand-back, rather than ending with the flow.
4137
+ "autopilot.carried": "normal",
4136
4138
  // The wrapper itself failed: the journey stops being automatic without anyone choosing that.
4137
4139
  "autopilot.error": "high",
4138
4140
  // A written answer counted against the step's limit; reaching it withdraws `reply`.