@pyxis-llm/react 0.0.0-stage → 0.5.3

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 (192) hide show
  1. package/dist/AgentProfileEditor.d.ts +48 -0
  2. package/dist/AgentProfileEditor.d.ts.map +1 -0
  3. package/dist/AgentProfileEditor.js +122 -0
  4. package/dist/AgentProfileList.d.ts +17 -0
  5. package/dist/AgentProfileList.d.ts.map +1 -0
  6. package/dist/AgentProfileList.js +46 -0
  7. package/dist/AskCardAnswerChip.d.ts +8 -0
  8. package/dist/AskCardAnswerChip.d.ts.map +1 -0
  9. package/dist/AskCardAnswerChip.js +21 -0
  10. package/dist/AskCardView.d.ts +85 -0
  11. package/dist/AskCardView.d.ts.map +1 -0
  12. package/dist/AskCardView.js +158 -0
  13. package/dist/CatalogColumnBrowser.d.ts +33 -0
  14. package/dist/CatalogColumnBrowser.d.ts.map +1 -0
  15. package/dist/CatalogColumnBrowser.js +219 -0
  16. package/dist/CatalogModelPicker.d.ts +68 -0
  17. package/dist/CatalogModelPicker.d.ts.map +1 -0
  18. package/dist/CatalogModelPicker.js +119 -0
  19. package/dist/CatalogModelPickerMenuContent.d.ts +17 -0
  20. package/dist/CatalogModelPickerMenuContent.d.ts.map +1 -0
  21. package/dist/CatalogModelPickerMenuContent.js +103 -0
  22. package/dist/CatalogPickerMenuItem.d.ts +17 -0
  23. package/dist/CatalogPickerMenuItem.d.ts.map +1 -0
  24. package/dist/CatalogPickerMenuItem.js +15 -0
  25. package/dist/CatalogTreePickerOptions.d.ts +52 -0
  26. package/dist/CatalogTreePickerOptions.d.ts.map +1 -0
  27. package/dist/CatalogTreePickerOptions.js +248 -0
  28. package/dist/ChatMessage.d.ts +172 -0
  29. package/dist/ChatMessage.d.ts.map +1 -0
  30. package/dist/ChatMessage.js +295 -0
  31. package/dist/ChatPanel.d.ts +252 -0
  32. package/dist/ChatPanel.d.ts.map +1 -0
  33. package/dist/ChatPanel.js +247 -0
  34. package/dist/ChatTranscriptFind.d.ts +19 -0
  35. package/dist/ChatTranscriptFind.d.ts.map +1 -0
  36. package/dist/ChatTranscriptFind.js +224 -0
  37. package/dist/ChatTranscriptFindBar.d.ts +15 -0
  38. package/dist/ChatTranscriptFindBar.d.ts.map +1 -0
  39. package/dist/ChatTranscriptFindBar.js +22 -0
  40. package/dist/Composer.d.ts +43 -0
  41. package/dist/Composer.d.ts.map +1 -0
  42. package/dist/Composer.js +45 -0
  43. package/dist/ComposerAttachments.d.ts +101 -0
  44. package/dist/ComposerAttachments.d.ts.map +1 -0
  45. package/dist/ComposerAttachments.js +126 -0
  46. package/dist/DisplayCards.d.ts +18 -0
  47. package/dist/DisplayCards.d.ts.map +1 -0
  48. package/dist/DisplayCards.js +72 -0
  49. package/dist/ErrorBoundary.d.ts +27 -0
  50. package/dist/ErrorBoundary.d.ts.map +1 -0
  51. package/dist/ErrorBoundary.js +107 -0
  52. package/dist/ImageDisplayCard.d.ts +6 -0
  53. package/dist/ImageDisplayCard.d.ts.map +1 -0
  54. package/dist/ImageDisplayCard.js +57 -0
  55. package/dist/MarkdownCodeComponents.d.ts +23 -0
  56. package/dist/MarkdownCodeComponents.d.ts.map +1 -0
  57. package/dist/MarkdownCodeComponents.js +256 -0
  58. package/dist/MermaidDiagram.d.ts +18 -0
  59. package/dist/MermaidDiagram.d.ts.map +1 -0
  60. package/dist/MermaidDiagram.js +66 -0
  61. package/dist/MessageContentWithPastes.d.ts +14 -0
  62. package/dist/MessageContentWithPastes.d.ts.map +1 -0
  63. package/dist/MessageContentWithPastes.js +44 -0
  64. package/dist/PastePill.d.ts +16 -0
  65. package/dist/PastePill.d.ts.map +1 -0
  66. package/dist/PastePill.js +43 -0
  67. package/dist/ProviderAuthTerminal.d.ts +12 -0
  68. package/dist/ProviderAuthTerminal.d.ts.map +1 -0
  69. package/dist/ProviderAuthTerminal.js +50 -0
  70. package/dist/ProviderConnectForm.d.ts +62 -0
  71. package/dist/ProviderConnectForm.d.ts.map +1 -0
  72. package/dist/ProviderConnectForm.js +206 -0
  73. package/dist/ProviderList.d.ts +18 -0
  74. package/dist/ProviderList.d.ts.map +1 -0
  75. package/dist/ProviderList.js +67 -0
  76. package/dist/QueueStrip.d.ts +17 -0
  77. package/dist/QueueStrip.d.ts.map +1 -0
  78. package/dist/QueueStrip.js +60 -0
  79. package/dist/SettingsScreen.d.ts +10 -0
  80. package/dist/SettingsScreen.d.ts.map +1 -0
  81. package/dist/SettingsScreen.js +26 -0
  82. package/dist/StreamingMarkdown.d.ts +47 -0
  83. package/dist/StreamingMarkdown.d.ts.map +1 -0
  84. package/dist/StreamingMarkdown.js +103 -0
  85. package/dist/TurnTimer.d.ts +72 -0
  86. package/dist/TurnTimer.d.ts.map +1 -0
  87. package/dist/TurnTimer.js +114 -0
  88. package/dist/VegaChart.d.ts +36 -0
  89. package/dist/VegaChart.d.ts.map +1 -0
  90. package/dist/VegaChart.js +180 -0
  91. package/dist/browser.d.ts +7 -0
  92. package/dist/browser.d.ts.map +1 -0
  93. package/dist/browser.js +18 -0
  94. package/dist/catalogColumnBrowserTree.d.ts +9 -0
  95. package/dist/catalogColumnBrowserTree.d.ts.map +1 -0
  96. package/dist/catalogColumnBrowserTree.js +48 -0
  97. package/dist/catalogPickerMenuStyles.d.ts +81 -0
  98. package/dist/catalogPickerMenuStyles.d.ts.map +1 -0
  99. package/dist/catalogPickerMenuStyles.js +130 -0
  100. package/dist/charts.d.ts +12 -0
  101. package/dist/charts.d.ts.map +1 -0
  102. package/dist/charts.js +45 -0
  103. package/dist/chatMessageScroll.d.ts +40 -0
  104. package/dist/chatMessageScroll.d.ts.map +1 -0
  105. package/dist/chatMessageScroll.js +62 -0
  106. package/dist/chatModelOptions.d.ts +28 -0
  107. package/dist/chatModelOptions.d.ts.map +1 -0
  108. package/dist/chatModelOptions.js +59 -0
  109. package/dist/chatTranscriptFindHighlights.d.ts +9 -0
  110. package/dist/chatTranscriptFindHighlights.d.ts.map +1 -0
  111. package/dist/chatTranscriptFindHighlights.js +88 -0
  112. package/dist/draftStore.d.ts +13 -0
  113. package/dist/draftStore.d.ts.map +1 -0
  114. package/dist/draftStore.js +38 -0
  115. package/dist/highlight.d.ts +4 -0
  116. package/dist/highlight.d.ts.map +1 -0
  117. package/dist/highlight.js +47 -0
  118. package/dist/index.d.ts +74 -0
  119. package/dist/index.d.ts.map +1 -0
  120. package/dist/index.js +48 -0
  121. package/dist/keyboardShortcuts.d.ts +5 -0
  122. package/dist/keyboardShortcuts.d.ts.map +1 -0
  123. package/dist/keyboardShortcuts.js +19 -0
  124. package/dist/markdownClipboard.d.ts +22 -0
  125. package/dist/markdownClipboard.d.ts.map +1 -0
  126. package/dist/markdownClipboard.js +98 -0
  127. package/dist/markdownPlugins.d.ts +31 -0
  128. package/dist/markdownPlugins.d.ts.map +1 -0
  129. package/dist/markdownPlugins.js +32 -0
  130. package/dist/mermaid.d.ts +17 -0
  131. package/dist/mermaid.d.ts.map +1 -0
  132. package/dist/mermaid.js +11 -0
  133. package/dist/mermaidRuntime.d.ts +21 -0
  134. package/dist/mermaidRuntime.d.ts.map +1 -0
  135. package/dist/mermaidRuntime.js +140 -0
  136. package/dist/modelCatalogHelpers.d.ts +14 -0
  137. package/dist/modelCatalogHelpers.d.ts.map +1 -0
  138. package/dist/modelCatalogHelpers.js +65 -0
  139. package/dist/modelCatalogSource.d.ts +22 -0
  140. package/dist/modelCatalogSource.d.ts.map +1 -0
  141. package/dist/modelCatalogSource.js +26 -0
  142. package/dist/modelCatalogTree.d.ts +24 -0
  143. package/dist/modelCatalogTree.d.ts.map +1 -0
  144. package/dist/modelCatalogTree.js +77 -0
  145. package/dist/node.d.ts +9 -0
  146. package/dist/node.d.ts.map +1 -0
  147. package/dist/node.js +13 -0
  148. package/dist/pasteFences.d.ts +20 -0
  149. package/dist/pasteFences.d.ts.map +1 -0
  150. package/dist/pasteFences.js +157 -0
  151. package/dist/pasteFormat.d.ts +5 -0
  152. package/dist/pasteFormat.d.ts.map +1 -0
  153. package/dist/pasteFormat.js +18 -0
  154. package/dist/plugins.d.ts +110 -0
  155. package/dist/plugins.d.ts.map +1 -0
  156. package/dist/plugins.js +98 -0
  157. package/dist/remarkAlerts.d.ts +12 -0
  158. package/dist/remarkAlerts.d.ts.map +1 -0
  159. package/dist/remarkAlerts.js +52 -0
  160. package/dist/sendMode.d.ts +69 -0
  161. package/dist/sendMode.d.ts.map +1 -0
  162. package/dist/sendMode.js +66 -0
  163. package/dist/useLlmdChatDriver.d.ts +367 -0
  164. package/dist/useLlmdChatDriver.d.ts.map +1 -0
  165. package/dist/useLlmdChatDriver.js +1739 -0
  166. package/dist/useLlmdModelCatalog.d.ts +23 -0
  167. package/dist/useLlmdModelCatalog.d.ts.map +1 -0
  168. package/dist/useLlmdModelCatalog.js +89 -0
  169. package/dist/useLlmdSessionModel.d.ts +34 -0
  170. package/dist/useLlmdSessionModel.d.ts.map +1 -0
  171. package/dist/useLlmdSessionModel.js +79 -0
  172. package/dist/useProviderAuthCommand.d.ts +26 -0
  173. package/dist/useProviderAuthCommand.d.ts.map +1 -0
  174. package/dist/useProviderAuthCommand.js +80 -0
  175. package/dist/vegaRuntime.d.ts +83 -0
  176. package/dist/vegaRuntime.d.ts.map +1 -0
  177. package/dist/vegaRuntime.js +314 -0
  178. package/dist/vendor/llmd-types/conversationEvents.d.ts +238 -0
  179. package/dist/vendor/llmd-types/conversationEvents.d.ts.map +1 -0
  180. package/dist/vendor/llmd-types/conversationEvents.js +98 -0
  181. package/dist/vendor/llmd-types/index.d.ts +4 -0
  182. package/dist/vendor/llmd-types/index.d.ts.map +1 -0
  183. package/dist/vendor/llmd-types/index.js +5 -0
  184. package/dist/vendor/llmd-types/messages.d.ts +67 -0
  185. package/dist/vendor/llmd-types/messages.d.ts.map +1 -0
  186. package/dist/vendor/llmd-types/messages.js +71 -0
  187. package/dist/vendor/llmd-types/sessionQueue.d.ts +54 -0
  188. package/dist/vendor/llmd-types/sessionQueue.d.ts.map +1 -0
  189. package/dist/vendor/llmd-types/sessionQueue.js +40 -0
  190. package/package.json +120 -4
  191. package/styles.css +389 -0
  192. package/README.md +0 -3
@@ -0,0 +1,98 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright 2026 John Ewart <john@johnewart.net>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * llmd's one extension point for what the chat can render. A plugin may
8
+ * contribute any of:
9
+ *
10
+ * - `highlighter`: syntax highlighting for fenced code (`@pyxis-llm/react/highlight`);
11
+ * - `languages`: a renderer for a whole fence language (```mermaid, ```vega-lite);
12
+ * - `displayCards`: a renderer for a display card type (@pyxis-llm/core
13
+ * DISPLAY_CARD_KIND, e.g. "chart" from `@pyxis-llm/react/charts`);
14
+ * - `attachments`: a renderer (and transcript placement) for a host's own
15
+ * attachment kind (e.g. a command-proposal card).
16
+ *
17
+ * Plugins reach the chat two ways, and both merge:
18
+ *
19
+ * - `registerLlmdPlugin(plugin)`: global, for the whole page. Importing
20
+ * `@pyxis-llm/react/charts` does this itself, so "import it" is all a host
21
+ * needs to do to get charts.
22
+ * - `<LlmdPluginProvider plugins={[...]}>`: scoped to a subtree; nested
23
+ * providers stack. Use it for plugins that depend on where they render.
24
+ *
25
+ * Later registrations win (a provider beats the global registry; the last
26
+ * plugin in a list beats earlier ones), so a host can override anything llmd
27
+ * ships, including the built-in image card.
28
+ *
29
+ * Renderers are components, not callbacks: one that needs host state (e.g. a
30
+ * "pin this" action) reads it from the host's own React context.
31
+ */
32
+ import { createContext, useContext, useMemo, useSyncExternalStore } from 'react';
33
+ // Type-only imports in the other direction keep this free of a runtime cycle.
34
+ import { imageCardPlugin } from './ImageDisplayCard.js';
35
+ export function resolveLlmdPlugins(plugins) {
36
+ const out = { languages: {}, displayCards: {}, attachments: {}, attachmentKindPlugins: [] };
37
+ for (const p of plugins) {
38
+ if (p.highlighter)
39
+ out.highlighter = p.highlighter;
40
+ Object.assign(out.languages, lowerKeys(p.languages));
41
+ Object.assign(out.displayCards, p.displayCards);
42
+ Object.assign(out.attachments, p.attachments);
43
+ }
44
+ for (const [kind, r] of Object.entries(out.attachments)) {
45
+ if (r.placement)
46
+ out.attachmentKindPlugins.push({ kind, ...r.placement });
47
+ }
48
+ return out;
49
+ }
50
+ function lowerKeys(rec) {
51
+ const out = {};
52
+ for (const [k, v] of Object.entries(rec ?? {}))
53
+ out[k.toLowerCase()] = v;
54
+ return out;
55
+ }
56
+ /* ---- Global registry ---- */
57
+ let registered = [];
58
+ const listeners = new Set();
59
+ /**
60
+ * Register a plugin for the whole page. Re-registering an id replaces it (so
61
+ * hot reload and double imports are harmless). Returns an unregister function.
62
+ */
63
+ export function registerLlmdPlugin(plugin) {
64
+ registered = [...registered.filter((p) => p.id !== plugin.id), plugin];
65
+ for (const l of listeners)
66
+ l();
67
+ return () => {
68
+ if (!registered.includes(plugin))
69
+ return;
70
+ registered = registered.filter((p) => p !== plugin);
71
+ for (const l of listeners)
72
+ l();
73
+ };
74
+ }
75
+ /** The globally registered plugins, in registration order. */
76
+ export function registeredLlmdPlugins() {
77
+ return registered;
78
+ }
79
+ function subscribe(l) {
80
+ listeners.add(l);
81
+ return () => listeners.delete(l);
82
+ }
83
+ /* ---- Scoped providers ---- */
84
+ const ScopedPluginsContext = createContext([]);
85
+ /** Add plugins for everything below. Nested providers stack on their parent's. */
86
+ export function LlmdPluginProvider({ plugins, children }) {
87
+ const parent = useContext(ScopedPluginsContext);
88
+ const stacked = useMemo(() => (plugins.length ? [...parent, ...plugins] : parent), [parent, plugins]);
89
+ return _jsx(ScopedPluginsContext.Provider, { value: stacked, children: children });
90
+ }
91
+ /** llmd's built-ins (the image card). Always first, so anything overrides them. */
92
+ const builtins = [imageCardPlugin];
93
+ /** Everything in effect here: llmd's built-ins, then global registrations, then providers. */
94
+ export function useLlmdPlugins() {
95
+ const global = useSyncExternalStore(subscribe, registeredLlmdPlugins, registeredLlmdPlugins);
96
+ const scoped = useContext(ScopedPluginsContext);
97
+ return useMemo(() => resolveLlmdPlugins([...builtins, ...global, ...scoped]), [global, scoped]);
98
+ }
@@ -0,0 +1,12 @@
1
+ type MdNode = {
2
+ type: string;
3
+ value?: string;
4
+ children?: MdNode[];
5
+ data?: {
6
+ hName?: string;
7
+ hProperties?: Record<string, unknown>;
8
+ };
9
+ };
10
+ export declare function remarkAlerts(): (tree: MdNode) => void;
11
+ export {};
12
+ //# sourceMappingURL=remarkAlerts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remarkAlerts.d.ts","sourceRoot":"","sources":["../src/remarkAlerts.ts"],"names":[],"mappings":"AAUA,KAAK,MAAM,GAAG;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;CAClE,CAAC;AAuCF,wBAAgB,YAAY,KAClB,MAAM,MAAM,UAGrB"}
@@ -0,0 +1,52 @@
1
+ /*
2
+ * Copyright 2026 John Ewart <john@johnewart.net>
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /** Remark plugin: GitHub alert blockquotes (`> [!NOTE]`) become styled callouts. */
6
+ const KINDS = new Set(['note', 'tip', 'important', 'warning', 'caution']);
7
+ const MARKER = /^\s*\[!([A-Za-z]+)\][ \t]*(?:\r?\n)?/;
8
+ function applyAlert(quote) {
9
+ const para = quote.children?.[0];
10
+ if (!para || para.type !== 'paragraph' || !para.children?.length)
11
+ return;
12
+ const first = para.children[0];
13
+ if (first.type !== 'text' || typeof first.value !== 'string')
14
+ return;
15
+ const m = MARKER.exec(first.value);
16
+ if (!m)
17
+ return;
18
+ const kind = m[1].toLowerCase();
19
+ if (!KINDS.has(kind))
20
+ return;
21
+ const rest = first.value.slice(m[0].length);
22
+ if (rest) {
23
+ first.value = rest;
24
+ }
25
+ else {
26
+ para.children.shift();
27
+ if (para.children[0]?.type === 'break')
28
+ para.children.shift();
29
+ }
30
+ if (para.children.length === 0)
31
+ quote.children.shift();
32
+ quote.children.unshift({
33
+ type: 'paragraph',
34
+ data: { hName: 'div', hProperties: { className: ['llmd-callout__title'] } },
35
+ children: [{ type: 'text', value: kind.charAt(0).toUpperCase() + kind.slice(1) }],
36
+ });
37
+ quote.data = {
38
+ ...quote.data,
39
+ hName: 'blockquote',
40
+ hProperties: { className: ['llmd-callout', `llmd-callout--${kind}`] },
41
+ };
42
+ }
43
+ function walk(node) {
44
+ if (node.type === 'blockquote')
45
+ applyAlert(node);
46
+ node.children?.forEach(walk);
47
+ }
48
+ export function remarkAlerts() {
49
+ return (tree) => {
50
+ walk(tree);
51
+ };
52
+ }
@@ -0,0 +1,69 @@
1
+ /**
2
+ * What a send does right now, and what to call it on the button.
3
+ *
4
+ * Two behaviors (the `behavior` argument of useLlmdChatDriver's `send`):
5
+ * - `'queue'`: run after whatever is running or already queued. llmd decides
6
+ * whether that means "now" (idle session) or "later".
7
+ * - `'interrupt'`: run now, stopping a running turn first.
8
+ *
9
+ * Which one plain Enter / the button gives depends on the queue:
10
+ * - queue running (the normal case): Enter QUEUES; holding ⌥/Ctrl/⌘ interrupts.
11
+ * - queue paused: Enter SENDS NOW (the paused entries are being held on
12
+ * purpose; a fresh message means "do this now"); holding a modifier adds it
13
+ * to the paused queue instead.
14
+ * A host can pin plain Enter with `defaultSendBehavior`; the modifier then
15
+ * always gives the other one.
16
+ *
17
+ * Labels say what will actually happen: "Send" when it runs immediately,
18
+ * "Queue" when it will wait, "Interrupt" when it stops a running turn.
19
+ */
20
+ import { type FocusEvent, type KeyboardEvent } from 'react';
21
+ export type SendBehavior = 'queue' | 'interrupt';
22
+ export type SendModeLabel = 'Send' | 'Queue' | 'Interrupt';
23
+ export type SendModeContext = {
24
+ /** A turn is running (the driver's `streaming`). */
25
+ streaming: boolean;
26
+ /** The session queue is paused (the driver's `queuePaused`). */
27
+ queuePaused?: boolean;
28
+ /** Entries waiting in the session queue (the driver's `queue.length`). */
29
+ queueLength?: number;
30
+ /** Pin what plain Enter does; omitted = follow the queue (see module doc). */
31
+ defaultSendBehavior?: SendBehavior;
32
+ };
33
+ /** True for the keys that flip a send to its alternate: ⌥ (Alt), Ctrl, ⌘ (Meta). */
34
+ export declare function isAlternateSend(e: {
35
+ altKey?: boolean;
36
+ ctrlKey?: boolean;
37
+ metaKey?: boolean;
38
+ }): boolean;
39
+ /** The behavior a send gets, plain (`alternate` false) or with a modifier held. */
40
+ export declare function sendBehaviorFor(ctx: SendModeContext, alternate: boolean): SendBehavior;
41
+ /** What a send with `behavior` will do right now, as a button label. */
42
+ export declare function sendLabelFor(behavior: SendBehavior, ctx: SendModeContext): SendModeLabel;
43
+ /** Placeholder hint for the input: what Enter and modifier+Enter do. */
44
+ export declare function sendHintFor(ctx: SendModeContext): string;
45
+ export type SendMode = {
46
+ /** True while ⌥/Ctrl/⌘ is held in the element the key handlers are attached to. */
47
+ alternateHeld: boolean;
48
+ /** The behavior the button / Enter gives right now (follows `alternateHeld`). */
49
+ behavior: SendBehavior;
50
+ /** Label for the send button right now (follows `alternateHeld`). */
51
+ label: SendModeLabel;
52
+ /** The behavior for an explicit alternate flag (e.g. from a keydown event). */
53
+ behaviorFor: (alternate: boolean) => SendBehavior;
54
+ /** Placeholder hint describing both keys. */
55
+ hint: string;
56
+ /**
57
+ * Attach to the text input (or any element containing it) so holding a
58
+ * modifier flips the button live. Blur resets it, so a key released
59
+ * elsewhere never leaves the button stuck.
60
+ */
61
+ keyHandlers: {
62
+ onKeyDown: (e: KeyboardEvent<HTMLElement>) => void;
63
+ onKeyUp: (e: KeyboardEvent<HTMLElement>) => void;
64
+ onBlur: (e: FocusEvent<HTMLElement>) => void;
65
+ };
66
+ };
67
+ /** Live send mode for a composer: behavior + label, flipping while a modifier is held. */
68
+ export declare function useSendMode(ctx: SendModeContext): SendMode;
69
+ //# sourceMappingURL=sendMode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendMode.d.ts","sourceRoot":"","sources":["../src/sendMode.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAkC,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAE5F,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,WAAW,CAAC;AAEjD,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,WAAW,CAAC;AAE3D,MAAM,MAAM,eAAe,GAAG;IAC5B,oDAAoD;IACpD,SAAS,EAAE,OAAO,CAAC;IACnB,gEAAgE;IAChE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,mBAAmB,CAAC,EAAE,YAAY,CAAC;CACpC,CAAC;AAEF,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAEtG;AAED,mFAAmF;AACnF,wBAAgB,eAAe,CAAC,GAAG,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,GAAG,YAAY,CAItF;AAED,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,EAAE,eAAe,GAAG,aAAa,CAIxF;AAED,wEAAwE;AACxE,wBAAgB,WAAW,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAGxD;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,mFAAmF;IACnF,aAAa,EAAE,OAAO,CAAC;IACvB,iFAAiF;IACjF,QAAQ,EAAE,YAAY,CAAC;IACvB,qEAAqE;IACrE,KAAK,EAAE,aAAa,CAAC;IACrB,+EAA+E;IAC/E,WAAW,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,YAAY,CAAC;IAClD,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,WAAW,EAAE;QACX,SAAS,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;QACnD,OAAO,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;QACjD,MAAM,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;KAC9C,CAAC;CACH,CAAC;AAEF,0FAA0F;AAC1F,wBAAgB,WAAW,CAAC,GAAG,EAAE,eAAe,GAAG,QAAQ,CAiB1D"}
@@ -0,0 +1,66 @@
1
+ /*
2
+ * Copyright 2026 John Ewart <john@johnewart.net>
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /**
6
+ * What a send does right now, and what to call it on the button.
7
+ *
8
+ * Two behaviors (the `behavior` argument of useLlmdChatDriver's `send`):
9
+ * - `'queue'`: run after whatever is running or already queued. llmd decides
10
+ * whether that means "now" (idle session) or "later".
11
+ * - `'interrupt'`: run now, stopping a running turn first.
12
+ *
13
+ * Which one plain Enter / the button gives depends on the queue:
14
+ * - queue running (the normal case): Enter QUEUES; holding ⌥/Ctrl/⌘ interrupts.
15
+ * - queue paused: Enter SENDS NOW (the paused entries are being held on
16
+ * purpose; a fresh message means "do this now"); holding a modifier adds it
17
+ * to the paused queue instead.
18
+ * A host can pin plain Enter with `defaultSendBehavior`; the modifier then
19
+ * always gives the other one.
20
+ *
21
+ * Labels say what will actually happen: "Send" when it runs immediately,
22
+ * "Queue" when it will wait, "Interrupt" when it stops a running turn.
23
+ */
24
+ import { useCallback, useMemo, useState } from 'react';
25
+ /** True for the keys that flip a send to its alternate: ⌥ (Alt), Ctrl, ⌘ (Meta). */
26
+ export function isAlternateSend(e) {
27
+ return !!(e.altKey || e.ctrlKey || e.metaKey);
28
+ }
29
+ /** The behavior a send gets, plain (`alternate` false) or with a modifier held. */
30
+ export function sendBehaviorFor(ctx, alternate) {
31
+ const plain = ctx.defaultSendBehavior ?? (ctx.queuePaused ? 'interrupt' : 'queue');
32
+ if (!alternate)
33
+ return plain;
34
+ return plain === 'queue' ? 'interrupt' : 'queue';
35
+ }
36
+ /** What a send with `behavior` will do right now, as a button label. */
37
+ export function sendLabelFor(behavior, ctx) {
38
+ if (behavior === 'interrupt')
39
+ return ctx.streaming ? 'Interrupt' : 'Send';
40
+ const waits = ctx.streaming || !!ctx.queuePaused || (ctx.queueLength ?? 0) > 0;
41
+ return waits ? 'Queue' : 'Send';
42
+ }
43
+ /** Placeholder hint for the input: what Enter and modifier+Enter do. */
44
+ export function sendHintFor(ctx) {
45
+ const verb = (b) => sendLabelFor(b, ctx).toLowerCase();
46
+ return `Enter to ${verb(sendBehaviorFor(ctx, false))} · ⌥/Ctrl+Enter to ${verb(sendBehaviorFor(ctx, true))}`;
47
+ }
48
+ /** Live send mode for a composer: behavior + label, flipping while a modifier is held. */
49
+ export function useSendMode(ctx) {
50
+ const [alternateHeld, setAlternateHeld] = useState(false);
51
+ const track = useCallback((e) => setAlternateHeld(isAlternateSend(e)), []);
52
+ const reset = useCallback(() => setAlternateHeld(false), []);
53
+ const { streaming, queuePaused, queueLength, defaultSendBehavior } = ctx;
54
+ return useMemo(() => {
55
+ const c = { streaming, queuePaused, queueLength, defaultSendBehavior };
56
+ const behavior = sendBehaviorFor(c, alternateHeld);
57
+ return {
58
+ alternateHeld,
59
+ behavior,
60
+ label: sendLabelFor(behavior, c),
61
+ behaviorFor: (alternate) => sendBehaviorFor(c, alternate),
62
+ hint: sendHintFor(c),
63
+ keyHandlers: { onKeyDown: track, onKeyUp: track, onBlur: reset },
64
+ };
65
+ }, [alternateHeld, streaming, queuePaused, queueLength, defaultSendBehavior, track, reset]);
66
+ }
@@ -0,0 +1,367 @@
1
+ import { ConversationEventType, type AssistantMessage, type ConversationEvent, type Message, type QueuedMessage, type SessionQueue, type SessionTodoItem, type SessionTurnTiming } from './vendor/llmd-types/index.js';
2
+ import type { ChatMessageData } from './ChatMessage.js';
3
+ import type { TurnTiming } from './TurnTimer.js';
4
+ import { type DraftStore } from './draftStore.js';
5
+ import type { AskCardSubmitOptions } from './AskCardView.js';
6
+ import { type AskCardResponse, type LlmdMessageAttachment } from '@pyxis-llm/core';
7
+ /**
8
+ * Minimal transport-agnostic surface this driver needs. `@pyxis-llm/client`'s
9
+ * `LlmdClient` satisfies this structurally on either transport binding
10
+ * (`@pyxis-llm/client/node`, `@pyxis-llm/client/web`) — the driver only ever calls
11
+ * `chatStreamEvents`.
12
+ */
13
+ export interface ChatStreamCapableClient<TOptions = unknown> {
14
+ chatStreamEvents(messages: Message[], options?: TOptions): AsyncGenerator<{
15
+ kind: 'event';
16
+ event: ConversationEvent;
17
+ } | {
18
+ kind: 'complete';
19
+ message: AssistantMessage;
20
+ }>;
21
+ }
22
+ /**
23
+ * Optional capability a {@link ChatStreamCapableClient} may also implement:
24
+ * the live side-channel described in this module's doc comment.
25
+ * `@pyxis-llm/client`'s `LlmdClient` implements this on both transports — the
26
+ * `SubscribeSessionEvents` RPC via `@pyxis-llm/client/node`, the WebSocket
27
+ * `/ws/session-events` feed via `@pyxis-llm/client/web`; a client that doesn't just
28
+ * won't get the automatic subscription.
29
+ */
30
+ export interface SessionEventsSubscribableClient {
31
+ subscribeSessionEvents(options?: {
32
+ afterSeq?: number;
33
+ signal?: AbortSignal;
34
+ }): AsyncGenerator<ConversationEvent>;
35
+ }
36
+ /**
37
+ * Optional capability: explicit turn cancellation. A turn runs server-side
38
+ * independently of any client stream — aborting `chatStreamEvents` only
39
+ * detaches this client (navigation, reload and unmount must NOT stop the
40
+ * model). `cancelTurn` is the actual Stop. Without it, `stop()` can only
41
+ * detach and the turn runs to completion.
42
+ */
43
+ export interface TurnControlCapableClient {
44
+ cancelTurn(reason?: string): Promise<boolean>;
45
+ }
46
+ /**
47
+ * Optional capability: session state for rejoining. Tells the driver on mount
48
+ * whether a turn is still running server-side (the user left mid-reply and came
49
+ * back) and the event-log cursors to subscribe from, so the running reply can be
50
+ * rebuilt live and nothing older is replayed.
51
+ */
52
+ export interface SessionStateCapableClient {
53
+ getSessionState(): Promise<{
54
+ messages: Message[];
55
+ turnInProgress: boolean;
56
+ eventsSeq: number;
57
+ turnStartSeq: number;
58
+ } & SessionTurnTiming>;
59
+ }
60
+ /**
61
+ * Optional capability: the rejoin status of {@link SessionStateCapableClient}
62
+ * without the transcript. When present the driver uses it to pick its
63
+ * subscription cursor and to poll a rejoined turn, and only falls back to the
64
+ * (much heavier) getSessionState when it actually has to replace the
65
+ * displayed transcript.
66
+ */
67
+ export interface SessionStatusCapableClient {
68
+ getSessionStatus(): Promise<{
69
+ turnInProgress: boolean;
70
+ eventsSeq: number;
71
+ turnStartSeq: number;
72
+ } & SessionTurnTiming>;
73
+ }
74
+ /**
75
+ * Optional capability: the session's persisted title and todo list. The
76
+ * session-events channel only carries CHANGES to these, so without a snapshot a
77
+ * freshly opened (or switched-to) session would show no title and no todos until
78
+ * the agent next touched them.
79
+ */
80
+ export interface SessionInfoCapableClient {
81
+ /** `status`: the current turn's set_status headline, "" when none (optional for older clients). */
82
+ getSessionInfo(): Promise<{
83
+ title: string;
84
+ todos: SessionTodoItem[];
85
+ status?: string;
86
+ }>;
87
+ }
88
+ /**
89
+ * Optional capability: the session's persisted attachments (ask cards and
90
+ * their answers) and a way to write one. With it the driver owns the whole
91
+ * card lifecycle — load, live updates, answering — and exposes a ready-made
92
+ * `attachmentIndex`; without it (an older client) cards only arrive live.
93
+ */
94
+ export interface SessionAttachmentsCapableClient {
95
+ getSessionAttachmentRows(): Promise<Array<{
96
+ content: string;
97
+ toolCallId: string;
98
+ }>>;
99
+ upsertSessionAttachment(anchorMessageId: string, attachment: {
100
+ id: string;
101
+ kind: string;
102
+ payloadJson: string;
103
+ afterToolCallId?: string;
104
+ content?: string;
105
+ }): Promise<void>;
106
+ }
107
+ /**
108
+ * Optional capability: deleting a session attachment (DeleteSessionAttachment).
109
+ * Needed to dismiss an ask card; without it `dismissAskCard` reports an error.
110
+ */
111
+ export interface AttachmentDeleteCapableClient {
112
+ deleteSessionAttachment(attachmentId: string): Promise<void>;
113
+ }
114
+ /**
115
+ * Optional capability: llmd's AnswerAskCard RPC. With it an answer is queued at
116
+ * the front of the session queue (so the agent resumes on it) and re-answers
117
+ * update in place; without it (an older client/server) the driver falls back
118
+ * to writing the answer attachment directly, which records it but does not
119
+ * resume the agent.
120
+ */
121
+ export interface AskCardAnswerCapableClient {
122
+ answerAskCard(cardId: string, responseJson: string, opts?: {
123
+ continueWithTools?: boolean;
124
+ }): Promise<{
125
+ entry?: QueuedMessage;
126
+ updatedExisting: boolean;
127
+ }>;
128
+ }
129
+ /**
130
+ * Optional capability: a stable key for the session the client addresses.
131
+ * Lets the driver reset only when the SESSION changes, not whenever a host
132
+ * rebuilds an equivalent client object (e.g. creating it during render without
133
+ * useMemo). Without it the driver falls back to object identity.
134
+ */
135
+ export interface SessionKeyCapableClient {
136
+ sessionKey(): string;
137
+ }
138
+ /**
139
+ * Optional capability: the per-session composer draft and message queue.
140
+ *
141
+ * Feature-detected rather than required, the same way the session-events side
142
+ * channel is — an older `@pyxis-llm/client` build simply has no draft persistence and
143
+ * no queue, and the driver degrades to purely local composer text instead of
144
+ * failing to mount.
145
+ */
146
+ export interface SessionQueueCapableClient {
147
+ saveDraft(content: string): Promise<void>;
148
+ getDraft(): Promise<string>;
149
+ clearDraft(): Promise<void>;
150
+ enqueueMessage(content: string, attachments?: OutgoingAttachment[]): Promise<QueuedMessage>;
151
+ listQueue(): Promise<SessionQueue>;
152
+ removeQueuedMessage(entryId: string): Promise<boolean>;
153
+ reorderQueue(entryIds: string[]): Promise<QueuedMessage[]>;
154
+ setQueuePaused(paused: boolean): Promise<void>;
155
+ }
156
+ /**
157
+ * Options passed through to a `ChatStreamCapableClient`'s `chatStreamEvents`;
158
+ * always includes `signal`. Deliberately has no index signature — concrete
159
+ * option types like `LlmdClient`'s `LLMOptions` are plain interfaces without
160
+ * one, and TypeScript
161
+ * only allows a type to satisfy `extends Record<string, unknown>` if it
162
+ * itself declares an index signature, which would break generic inference
163
+ * for `TOptions` at every call site.
164
+ */
165
+ export type LlmdChatDriverOptions = {
166
+ signal?: AbortSignal;
167
+ };
168
+ /**
169
+ * What sending does while a turn is already running: `'queue'` appends the
170
+ * message to the session queue (it runs after the current turn), `'interrupt'`
171
+ * stops the running turn and starts this one now. When nothing is running both
172
+ * just send.
173
+ */
174
+ export type SendBehavior = 'queue' | 'interrupt';
175
+ /**
176
+ * An attachment sent ON a user message (composer attachments, ask-card
177
+ * answers, host kinds). llmd persists it anchored to that message; `content`
178
+ * is what the model sees (spliced into the message), `payloadJson` is
179
+ * client-only display data.
180
+ */
181
+ export type OutgoingAttachment = {
182
+ id: string;
183
+ kind: string;
184
+ payloadJson: string;
185
+ afterToolCallId?: string;
186
+ content?: string;
187
+ };
188
+ /** Driver behaviour switches (the 5th `useLlmdChatDriver` argument). */
189
+ export type LlmdChatDriverConfig = {
190
+ /**
191
+ * Drain the session queue from this client while it is mounted: claim the
192
+ * next entry whenever nothing is running, send it as a turn (with its
193
+ * attachments), and retire it — following @pyxis-llm/client's drainer contract
194
+ * (claim → markStarted → heartbeat → retire/release). Needed where llmd will
195
+ * not drain itself: sessions with client-owned tools, or a host that runs
196
+ * llmd with server draining disabled. Safe alongside the server drainer and
197
+ * other windows (claims are atomic). Off by default.
198
+ */
199
+ drainQueue?: boolean;
200
+ /**
201
+ * Keep an assistant turn's text segments apart at each tool call instead of
202
+ * concatenating them: the message carries `segments` (live, rejoined and
203
+ * loaded from history), and ChatMessage shows the in-between ones as a
204
+ * collapsed "N steps" list plus the final segment. Off by default.
205
+ */
206
+ segmentedTurns?: boolean;
207
+ };
208
+ /**
209
+ * Optional capability: the client-drainer half of the queue API. Required for
210
+ * `drainQueue`.
211
+ */
212
+ export interface QueueDrainCapableClient {
213
+ claimNextQueuedMessage(owner: string): Promise<{
214
+ entry?: QueuedMessage;
215
+ paused: boolean;
216
+ }>;
217
+ heartbeatQueuedMessage(entryId: string, owner: string): Promise<void>;
218
+ markQueuedMessageStarted(entryId: string, owner: string, turnId: string): Promise<void>;
219
+ retireQueuedMessage(entryId: string, owner: string): Promise<void>;
220
+ releaseQueuedMessage(entryId: string, owner: string): Promise<void>;
221
+ }
222
+ /** The five tool-related event types, narrowed out of `ConversationEvent` for `onToolEvent`. */
223
+ export type ToolConversationEvent = Extract<ConversationEvent, {
224
+ type: ConversationEventType.ToolCallStreamStarted | ConversationEventType.ToolCallArgsDelta | ConversationEventType.ToolCallStreamFinished | ConversationEventType.ToolExecutionStarted | ConversationEventType.ToolExecutionFinished;
225
+ }>;
226
+ export type LlmdChatDriver = {
227
+ messages: ChatMessageData[];
228
+ streaming: boolean;
229
+ /**
230
+ * When the current (or last) user turn on THIS session started, and once it
231
+ * ends how long it took. Started from llmd's UserTurnCommitted timestamp, so
232
+ * it is right after a reload, a rejoin or switching sessions; reset on every
233
+ * session switch. Pass to `ChatPanel`'s `turnTiming` or `<TurnTimer timing>`.
234
+ */
235
+ turnTiming: TurnTiming;
236
+ /** Id of the in-flight assistant message, for `ChatPanel`'s `streamingMessageId` prop. */
237
+ streamingMessageId?: string;
238
+ /**
239
+ * Sends a message. While a turn is running, `behavior` decides what happens
240
+ * (default `'queue'`): queue it behind the running turn, or interrupt. Falls
241
+ * back to interrupting when the client has no queue support.
242
+ */
243
+ send: (text: string, behavior?: SendBehavior, attachments?: OutgoingAttachment[]) => void;
244
+ /** Sends a message now, interrupting a running turn first (see module doc). */
245
+ interrupt: (text: string) => void;
246
+ /**
247
+ * Pulls a not-yet-started entry out of the queue and sends it as an
248
+ * interrupt. The entry is removed first; if the server already started it
249
+ * (removal fails) nothing is sent, so it never runs twice.
250
+ */
251
+ interruptWithQueued: (entryId: string) => Promise<void>;
252
+ /**
253
+ * Stops the running turn: `cancelTurn` on llmd (the model stops and the
254
+ * partial is saved as interrupted), then detaches this client's stream. Also
255
+ * stops a turn this driver rejoined after a reload.
256
+ */
257
+ stop: () => void;
258
+ /** Set the whole transcript (e.g. after loading persisted session history). Purely local/display — see module doc. */
259
+ setMessages: (messages: ChatMessageData[]) => void;
260
+ /** Seeds the display transcript from real `Message[]` (e.g. `client.getHistory()`) — e.g. resuming a session after a remount/reload. Purely local/display. */
261
+ hydrate: (messages: Message[]) => void;
262
+ error: Error | null;
263
+ /** Latest agent-authored status headline (set_status tool), or undefined if none has been emitted this session. Turn-scoped: llmd clears it (an empty EvSessionStatus) when a turn starts and ends, and it is seeded from the session on every (re)connect, so it never shows a previous turn's headline. */
264
+ sessionStatus?: string;
265
+ /** Latest agent-authored session title (set_session_title tool), or undefined if never set via this driver's stream. */
266
+ sessionTitle?: string;
267
+ /** Current todo list (add_todo/update_todo tools), most-recently-known state. Empty until the first todos_updated event. */
268
+ todos: SessionTodoItem[];
269
+ /**
270
+ * Every attachment on this session (ask cards, their answers, host kinds):
271
+ * loaded from llmd on (re)connect and kept current from the session-events
272
+ * channel, so a card the agent asks mid-turn — or an answer given in
273
+ * another window — shows up without a reload. Pass straight to `ChatPanel`'s
274
+ * `attachmentIndex`. Empty with a client lacking attachment support.
275
+ */
276
+ attachmentIndex: Map<string, LlmdMessageAttachment>;
277
+ /** Ask-card answers in `attachmentIndex`, keyed by the card id they answer (`ChatPanel`'s `askCardResponses`). */
278
+ askCardResponses: Map<string, AskCardResponse>;
279
+ /**
280
+ * Answers an ask card via llmd's AnswerAskCard: the first answer is queued at
281
+ * the front of the session queue as "Answer to: <title>" (so the agent
282
+ * resumes on it, subject to pause); a re-answer replaces the queued answer
283
+ * or, once sent, updates it in place. The card reads as answered as soon as
284
+ * the answer is queued. Failures are reported via `attachmentsError` and
285
+ * rethrown. With an older client lacking `answerAskCard` it falls back to
286
+ * writing the answer attachment directly (recorded, but the agent does not
287
+ * resume). Wire to `ChatPanel`'s `onAskCardSubmit`.
288
+ *
289
+ * `options.continueWithTools` ("Answer & continue") lets the answer's turn
290
+ * run tools; omitted or false ("Answer & stop") runs it with tools off.
291
+ */
292
+ submitAskCard: (response: AskCardResponse, options?: AskCardSubmitOptions) => Promise<void>;
293
+ /**
294
+ * Dismisses an ask card as though it was never asked: the card's attachment
295
+ * is deleted on llmd (every window drops it via `attachment_deleted`).
296
+ * Silent: nothing is queued and the agent is not told; it learns from
297
+ * whatever the user says next. Removed locally at once; restored, with the
298
+ * failure in `attachmentsError`, if the delete fails. Wire to `ChatPanel`'s
299
+ * `onAskCardDismiss`.
300
+ */
301
+ dismissAskCard: (cardId: string) => Promise<void>;
302
+ /** Set when loading attachments or saving an ask-card answer failed; cleared by the next success. */
303
+ attachmentsError?: Error;
304
+ /**
305
+ * Set when the automatic session-events side-channel subscription (see
306
+ * module doc, "Side-channel subscription") fails or disconnects —
307
+ * distinct from `error`, which is reserved for the primary
308
+ * `chatStreamEvents` turn. `undefined` while connected/not yet attempted.
309
+ * A failure here means tool-execution visibility for CLI-backed sessions
310
+ * (Claude Code, Cursor CLI) is silently degraded to nothing — worth
311
+ * surfacing somewhere in the UI (a small "live updates unavailable"
312
+ * indicator), not just logging, since the host has no other way to know.
313
+ * Always also logged via `console.error` regardless of whether a host
314
+ * reads this field.
315
+ */
316
+ sessionEventsError?: Error;
317
+ /**
318
+ * Current composer text, hydrated from llmd's persisted draft on mount.
319
+ *
320
+ * A store, not a string: the driver lives in the host page, and plain state
321
+ * here would re-render that whole page on every keystroke. Read it with
322
+ * `useDraft(driver.draft)` in the component that renders the input, or pass
323
+ * it to `ChatPanel` as `composerDraft` (with {@link setDraft} as
324
+ * `onComposerValueChange`) and only the composer re-renders while typing.
325
+ * Either way an unsent message survives a reload, a crash, or closing the
326
+ * laptop. Without that wiring the composer keeps its own local state and
327
+ * nothing is persisted.
328
+ */
329
+ draft: DraftStore;
330
+ /** Updates the composer text and persists it (debounced). */
331
+ setDraft: (text: string) => void;
332
+ /**
333
+ * This session's message queue, in run order — pending and running alike.
334
+ * Kept current from the session-events side channel, so edits made in another
335
+ * window show up here too.
336
+ */
337
+ queue: QueuedMessage[];
338
+ /** True while draining is paused. Server-enforced, so it holds for every drainer. */
339
+ queuePaused: boolean;
340
+ /** Appends a message to the back of the queue instead of sending it now. */
341
+ enqueue: (text: string, attachments?: OutgoingAttachment[]) => Promise<void>;
342
+ /** Drops a queued entry. */
343
+ removeQueued: (entryId: string) => Promise<void>;
344
+ /** Sets queue order to exactly these ids (pass the full order you want). */
345
+ reorderQueue: (entryIds: string[]) => Promise<void>;
346
+ /** Pauses or resumes draining for this session. */
347
+ setQueuePaused: (paused: boolean) => Promise<void>;
348
+ };
349
+ /**
350
+ * Turns any {@link ChatStreamCapableClient} into the driver shape `ChatPanel`
351
+ * consumes. `client` may be `null`/`undefined` while a host is still setting
352
+ * up its connection — `send` is a no-op until it's provided.
353
+ */
354
+ export declare function useLlmdChatDriver<TOptions extends LlmdChatDriverOptions = LlmdChatDriverOptions>(client: ChatStreamCapableClient<TOptions> | null | undefined, options?: TOptions, onToolEvent?: (event: ToolConversationEvent) => void,
355
+ /**
356
+ * Fires once per user turn (llmd's UserTurnCommitted: one per message sent,
357
+ * covering every model round and tool call that answers it) — for every
358
+ * turn on the session: ones this driver sent, and ones started in another
359
+ * window or by the queue. This is THE signal for per-turn host UI: a host
360
+ * must clear what it accumulates from `onToolEvent` (its tool log) here.
361
+ * (`sessionStatus` needs nothing from the host: llmd clears it itself.)
362
+ *
363
+ * Not AssistantTurnStarted: llmd emits that once per model call, so an
364
+ * agent loop produces several per user turn.
365
+ */
366
+ onTurnStart?: (userMessageId: string) => void, config?: LlmdChatDriverConfig): LlmdChatDriver;
367
+ //# sourceMappingURL=useLlmdChatDriver.d.ts.map