@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,206 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright 2026 John Ewart <john@johnewart.net>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ *
6
+ * One "just works" panel for creating *and* editing any llmd LLM provider
7
+ * config. Covers every field on every `llm.v1.*LlmConfig` proto message
8
+ * (anthropic/openai/gemini/openrouter/ollama/bedrock/cursor_cli/claude_code_v2) via
9
+ * conditional per-type sub-panels, sharing one field-value type
10
+ * (`RegisterProviderConfig` from `@pyxis-llm/client`) with `registerProvider` /
11
+ * `getProviderConfig` / `updateProviderConfig` on both TS clients.
12
+ *
13
+ * Per project rule: this component is hand-maintained, not reflection-driven.
14
+ * If you add a field to a provider's proto message, add it here too, in the
15
+ * same change.
16
+ */
17
+ import { useEffect, useMemo, useState } from 'react';
18
+ import { Alert, Button, NumberInput, PasswordInput, Select, Stack, Switch, Text, Textarea, TextInput, } from '@mantine/core';
19
+ const PROVIDER_TYPE_LABELS = {
20
+ anthropic: 'Anthropic',
21
+ openai: 'OpenAI',
22
+ gemini: 'Google Gemini',
23
+ openrouter: 'OpenRouter',
24
+ ollama: 'Ollama',
25
+ bedrock: 'Amazon Bedrock',
26
+ cursor_cli: 'Cursor CLI',
27
+ claude_code_v2: 'Claude Code',
28
+ };
29
+ const ALL_PROVIDER_TYPES = [
30
+ 'anthropic',
31
+ 'openai',
32
+ 'gemini',
33
+ 'openrouter',
34
+ 'ollama',
35
+ 'bedrock',
36
+ 'cursor_cli',
37
+ 'claude_code_v2',
38
+ ];
39
+ function requiresApiKey(type) {
40
+ return type === 'anthropic' || type === 'openai' || type === 'gemini' || type === 'openrouter';
41
+ }
42
+ /** API-backed provider types (everything except the CLI-backed ones). */
43
+ export function isApiProviderType(type) {
44
+ return type !== 'cursor_cli' && type !== 'claude_code_v2';
45
+ }
46
+ function emptyConfigForType(type) {
47
+ switch (type) {
48
+ case 'anthropic':
49
+ return { type, apiKey: '' };
50
+ case 'openai':
51
+ return { type, apiKey: '' };
52
+ case 'gemini':
53
+ return { type, apiKey: '' };
54
+ case 'openrouter':
55
+ return { type, apiKey: '' };
56
+ case 'ollama':
57
+ return { type };
58
+ case 'bedrock':
59
+ return { type, region: '' };
60
+ case 'cursor_cli':
61
+ return { type };
62
+ case 'claude_code_v2':
63
+ return { type };
64
+ }
65
+ }
66
+ function str(v) {
67
+ return v ?? '';
68
+ }
69
+ function trimmedOrUndefined(v) {
70
+ const t = v.trim();
71
+ return t.length > 0 ? t : undefined;
72
+ }
73
+ function multilineToArray(v) {
74
+ const lines = v
75
+ .split('\n')
76
+ .map((l) => l.trim())
77
+ .filter((l) => l.length > 0);
78
+ return lines.length > 0 ? lines : undefined;
79
+ }
80
+ function arrayToMultiline(v) {
81
+ return (v ?? []).join('\n');
82
+ }
83
+ const OPENROUTER_SORT_OPTIONS = [
84
+ { value: 'price', label: 'Price' },
85
+ { value: 'throughput', label: 'Throughput' },
86
+ { value: 'latency', label: 'Latency' },
87
+ ];
88
+ const CURSOR_CLI_MODE_OPTIONS = [
89
+ { value: 'default', label: 'Default' },
90
+ { value: 'ask', label: 'Ask' },
91
+ { value: 'plan', label: 'Plan' },
92
+ ];
93
+ const CLAUDE_PERMISSION_MODE_OPTIONS = [
94
+ { value: 'default', label: 'Default' },
95
+ { value: 'acceptEdits', label: 'Accept edits' },
96
+ { value: 'bypassPermissions', label: 'Bypass permissions' },
97
+ { value: 'dontAsk', label: "Don't ask" },
98
+ { value: 'plan', label: 'Plan' },
99
+ ];
100
+ const CLAUDE_EFFORT_OPTIONS = [
101
+ { value: 'low', label: 'Low' },
102
+ { value: 'medium', label: 'Medium' },
103
+ { value: 'high', label: 'High' },
104
+ { value: 'xhigh', label: 'X-high' },
105
+ { value: 'max', label: 'Max' },
106
+ ];
107
+ const CLAUDE_THINKING_TYPE_OPTIONS = [
108
+ { value: 'enabled', label: 'Enabled' },
109
+ { value: 'disabled', label: 'Disabled' },
110
+ { value: 'adaptive', label: 'Adaptive' },
111
+ ];
112
+ /** Renders diagnostics from a connection test. Shows only server-reported fields, never the config. */
113
+ function ConnectionTestResult({ result }) {
114
+ const ok = result.status === 'ok';
115
+ return (_jsx(Alert, { color: ok ? 'green' : 'red', title: ok ? 'Connection OK' : `Connection failed (${result.status})`, "data-testid": "connection-test-result", children: _jsxs(Stack, { gap: 2, children: [result.message ? _jsx(Text, { size: "sm", children: result.message }) : null, _jsxs(Text, { size: "sm", children: ["Credential source: ", result.credentialSource] }), result.assumedRoleArn ? (_jsxs(Text, { size: "sm", children: ["Assumed role: ", result.assumedRoleArn] })) : null, result.callerIdentity ? (_jsxs(Text, { size: "sm", children: ["Identity: ", result.callerIdentity.arn, " (account ", result.callerIdentity.account, ", user", ' ', result.callerIdentity.userId, ")"] })) : null, result.warnings.map((w, i) => (_jsxs(Text, { size: "sm", c: "yellow.8", children: ["Warning: ", w] }, i))), result.error ? (_jsxs(Text, { size: "sm", children: ["Error: kind ", result.error.kind, result.error.providerStatus ? `, status ${result.error.providerStatus}` : '', result.error.retryable ? ', retryable' : ''] })) : null] }) }));
116
+ }
117
+ /**
118
+ * A single config form covering every llmd provider type, for both creating
119
+ * a new provider and editing an existing one's config.
120
+ */
121
+ export function ProviderConnectForm({ mode = 'create', providerId, onProviderIdChange, onSubmit, onRegister, onTestConnection, initialConfig, submitting = false, error = null, allowedTypes = ALL_PROVIDER_TYPES, successMessage, }) {
122
+ const isEdit = mode === 'edit';
123
+ const submit = onSubmit ?? onRegister;
124
+ const [type, setType] = useState(initialConfig?.type ?? allowedTypes[0] ?? 'anthropic');
125
+ const [config, setConfig] = useState(initialConfig ?? emptyConfigForType(type));
126
+ const [submitted, setSubmitted] = useState(false);
127
+ const [testing, setTesting] = useState(false);
128
+ const [testResult, setTestResult] = useState(null);
129
+ const [testError, setTestError] = useState(null);
130
+ // Re-seed when switching to a genuinely different initial config (e.g. host
131
+ // finished loading getProviderConfig, or switched which provider is being edited).
132
+ useEffect(() => {
133
+ if (initialConfig) {
134
+ setType(initialConfig.type);
135
+ setConfig(initialConfig);
136
+ }
137
+ // eslint-disable-next-line react-hooks/exhaustive-deps
138
+ }, [initialConfig]);
139
+ const typeOptions = useMemo(() => allowedTypes.map((t) => ({ value: t, label: PROVIDER_TYPE_LABELS[t] })), [allowedTypes]);
140
+ const handleTypeChange = (next) => {
141
+ setType(next);
142
+ setConfig(emptyConfigForType(next));
143
+ setTestResult(null);
144
+ setTestError(null);
145
+ };
146
+ const handleTest = async () => {
147
+ if (!onTestConnection)
148
+ return;
149
+ setTesting(true);
150
+ setTestResult(null);
151
+ setTestError(null);
152
+ try {
153
+ setTestResult(await onTestConnection(config));
154
+ }
155
+ catch (e) {
156
+ // Message only: the config (which holds secrets) is never included.
157
+ setTestError(e instanceof Error ? e.message : String(e));
158
+ }
159
+ finally {
160
+ setTesting(false);
161
+ }
162
+ };
163
+ const update = (patch) => {
164
+ setConfig((prev) => ({ ...prev, ...patch }));
165
+ };
166
+ const canSubmit = (isEdit || providerId.trim().length > 0) &&
167
+ (!requiresApiKey(type) ||
168
+ (config.type === 'anthropic' ||
169
+ config.type === 'openai' ||
170
+ config.type === 'gemini' ||
171
+ config.type === 'openrouter'
172
+ ? config.apiKey.trim().length > 0
173
+ : false)) &&
174
+ (type !== 'bedrock' || (config.type === 'bedrock' && config.region.trim().length > 0)) &&
175
+ !submitting;
176
+ const handleSubmit = async () => {
177
+ if (!canSubmit || !submit)
178
+ return;
179
+ setSubmitted(false);
180
+ await submit(config);
181
+ setSubmitted(true);
182
+ };
183
+ return (_jsxs(Stack, { gap: "sm", style: { maxWidth: 480 }, children: [_jsx(TextInput, { label: "Provider id", placeholder: "e.g. my-anthropic", value: providerId, onChange: (e) => onProviderIdChange(e.currentTarget.value), disabled: isEdit }), _jsx(Select, { label: "Provider type", data: typeOptions, value: type, onChange: (v) => v && handleTypeChange(v), allowDeselect: false, disabled: isEdit }), config.type === 'anthropic' || config.type === 'openai' || config.type === 'gemini' ? (_jsx(ApiKeyShapedFields, { config: config, onChange: update, maxTokensLabel: "Max output tokens (optional)", maxTokensKey: "maxOutputTokens" })) : null, config.type === 'openrouter' ? _jsx(OpenRouterFields, { config: config, onChange: update }) : null, config.type === 'ollama' ? (_jsxs(_Fragment, { children: [_jsx(TextInput, { label: "Base URL (optional)", placeholder: "http://127.0.0.1:11434", value: str(config.baseUrl), onChange: (e) => update({ baseUrl: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(TextInput, { label: "Default model (optional)", value: str(config.defaultModel), onChange: (e) => update({ defaultModel: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(NumberInput, { label: "Max tokens (optional)", value: config.maxTokens, onChange: (v) => update({ maxTokens: typeof v === 'number' ? v : undefined }) })] })) : null, config.type === 'bedrock' ? (_jsxs(_Fragment, { children: [_jsx(TextInput, { label: "AWS region", placeholder: "us-east-1", value: config.region, onChange: (e) => update({ region: e.currentTarget.value }) }), _jsx(TextInput, { label: "AWS profile (optional)", value: str(config.profile), onChange: (e) => update({ profile: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(TextInput, { label: "Default model (optional)", value: str(config.defaultModel), onChange: (e) => update({ defaultModel: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(TextInput, { label: "Endpoint URL (optional)", value: str(config.endpointUrl), onChange: (e) => update({ endpointUrl: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(TextInput, { label: "Assume role ARN (optional)", placeholder: "arn:aws:iam::123456789012:role/name", value: str(config.assumeRoleArn), onChange: (e) => update({ assumeRoleArn: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(TextInput, { label: "Role session name (optional)", description: "Leave empty to let llmd use its default session name.", value: str(config.roleSessionName), onChange: (e) => update({ roleSessionName: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(TextInput, { type: "password", autoComplete: "off", label: "External ID (optional)", description: "Write-only; never shown after saving.", value: str(config.externalId), onChange: (e) => update({ externalId: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(NumberInput, { label: "Max output tokens (optional)", value: config.maxOutputTokens, onChange: (v) => update({ maxOutputTokens: typeof v === 'number' ? v : undefined }) })] })) : null, config.type === 'cursor_cli' ? (_jsxs(_Fragment, { children: [_jsx(TextInput, { label: "CLI binary path (optional)", value: str(config.binary), onChange: (e) => update({ binary: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(TextInput, { label: "Working directory (optional)", value: str(config.cwd), onChange: (e) => update({ cwd: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(TextInput, { label: "Workspace (optional)", value: str(config.workspace), onChange: (e) => update({ workspace: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(TextInput, { label: "API key (optional)", type: "password", value: str(config.apiKey), onChange: (e) => update({ apiKey: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(TextInput, { label: "Default model (optional)", value: str(config.defaultModel), onChange: (e) => update({ defaultModel: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(Select, { label: "CLI mode (optional)", placeholder: "Default", clearable: true, data: CURSOR_CLI_MODE_OPTIONS, value: config.cliMode ?? null, onChange: (v) => update({ cliMode: v ?? undefined }) }), _jsx(TextInput, { label: "Session id (optional)", value: str(config.sessionId), onChange: (e) => update({ sessionId: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(NumberInput, { label: "Max output tokens (optional)", value: config.maxOutputTokens, onChange: (v) => update({ maxOutputTokens: typeof v === 'number' ? v : undefined }) }), _jsx(Switch, { label: "Trust workspace", checked: config.trust ?? false, onChange: (e) => update({ trust: e.currentTarget.checked }) }), _jsx(Switch, { label: "Auto-approve MCP servers", checked: config.approveMcps ?? false, onChange: (e) => update({ approveMcps: e.currentTarget.checked }) }), _jsx(Switch, { label: "Force", checked: config.force ?? false, onChange: (e) => update({ force: e.currentTarget.checked }) })] })) : null, config.type === 'claude_code_v2' ? (_jsxs(_Fragment, { children: [_jsx(TextInput, { label: "CLI binary path (optional)", value: str(config.binary), onChange: (e) => update({ binary: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(TextInput, { label: "Working directory (optional)", value: str(config.cwd), onChange: (e) => update({ cwd: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(TextInput, { label: "Agent (optional)", value: str(config.agent), onChange: (e) => update({ agent: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(TextInput, { label: "Default model (optional)", value: str(config.defaultModel), onChange: (e) => update({ defaultModel: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(Textarea, { label: "System prompt (optional)", autosize: true, minRows: 2, value: str(config.systemPrompt), onChange: (e) => update({ systemPrompt: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(Textarea, { label: "Append to system prompt (optional)", autosize: true, minRows: 2, value: str(config.appendSystemPrompt), onChange: (e) => update({ appendSystemPrompt: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(Select, { label: "Effort (optional)", placeholder: "Default", clearable: true, data: CLAUDE_EFFORT_OPTIONS, value: config.effort ?? null, onChange: (v) => update({ effort: v ?? undefined }) }), _jsx(Select, { label: "Permission mode (optional)", placeholder: "Default", clearable: true, data: CLAUDE_PERMISSION_MODE_OPTIONS, value: config.permissionMode ?? null, onChange: (v) => update({ permissionMode: v ?? undefined }) }), _jsx(NumberInput, { label: "Max budget (USD, optional)", value: config.maxBudgetUsd, onChange: (v) => update({ maxBudgetUsd: typeof v === 'number' ? v : undefined }) }), _jsx(NumberInput, { label: "Max turns (optional)", value: config.maxTurns, onChange: (v) => update({ maxTurns: typeof v === 'number' ? v : undefined }) }), _jsx(NumberInput, { label: "Timeout (ms, optional)", value: config.timeoutMs, onChange: (v) => update({ timeoutMs: typeof v === 'number' ? v : undefined }) }), _jsx(Textarea, { label: "Additional directories (optional, one per line)", autosize: true, minRows: 2, value: arrayToMultiline(config.addDir), onChange: (e) => update({ addDir: multilineToArray(e.currentTarget.value) }) }), _jsx(Textarea, { label: "Allowed tools (optional, one per line)", autosize: true, minRows: 2, value: arrayToMultiline(config.allowedTools), onChange: (e) => update({ allowedTools: multilineToArray(e.currentTarget.value) }) }), _jsx(Textarea, { label: "Disallowed tools (optional, one per line)", autosize: true, minRows: 2, value: arrayToMultiline(config.disallowedTools), onChange: (e) => update({ disallowedTools: multilineToArray(e.currentTarget.value) }) }), _jsx(TextInput, { label: "MCP config path (optional)", value: str(config.mcpConfigPath), onChange: (e) => update({ mcpConfigPath: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(Textarea, { label: "Setting sources (optional, one per line: user, project, local)", autosize: true, minRows: 2, value: arrayToMultiline(config.settingSources), onChange: (e) => update({ settingSources: multilineToArray(e.currentTarget.value) }) }), _jsx(Select, { label: "Thinking (optional)", placeholder: "Default", clearable: true, data: CLAUDE_THINKING_TYPE_OPTIONS, value: config.thinkingType ?? null, onChange: (v) => update({ thinkingType: v ?? undefined }) }), _jsx(NumberInput, { label: "Thinking budget (tokens, optional)", value: config.thinkingBudgetTokens, onChange: (v) => update({ thinkingBudgetTokens: typeof v === 'number' ? v : undefined }) }), _jsx(Textarea, { label: "Hooks (JSON, optional)", autosize: true, minRows: 3, value: str(config.hooksJson), onChange: (e) => update({ hooksJson: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(TextInput, { label: "Custom config directory (optional)", value: str(config.configDir), onChange: (e) => update({ configDir: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(PasswordInput, { label: "OAuth token (optional)", description: "From `claude setup-token`. Used instead of the login stored in the config directory.", value: str(config.oauthToken), onChange: (e) => update({ oauthToken: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(Switch, { label: "Strict MCP config", checked: config.strictMcpConfig ?? false, onChange: (e) => update({ strictMcpConfig: e.currentTarget.checked }) }), _jsx(Switch, { label: "Include hook events", checked: config.includeHookEvents ?? false, onChange: (e) => update({ includeHookEvents: e.currentTarget.checked }) }), _jsx(Switch, { label: "Use my Claude config", checked: config.useMyClaudeConfig ?? false, onChange: (e) => update({ useMyClaudeConfig: e.currentTarget.checked }) }), _jsx(Switch, { label: "Defer tool schemas", checked: config.deferToolSchemas ?? false, onChange: (e) => update({ deferToolSchemas: e.currentTarget.checked }) }), _jsx(Switch, { label: "Use Claude Code preset", checked: config.useClaudeCodePreset ?? false, onChange: (e) => update({ useClaudeCodePreset: e.currentTarget.checked }) })] })) : null, error ? (_jsx(Alert, { color: "red", title: isEdit ? "Couldn't save provider config" : "Couldn't connect provider", children: error.message })) : null, onTestConnection && isApiProviderType(config.type) ? (_jsx(Button, { variant: "default", onClick: () => void handleTest(), loading: testing, children: "Test connection" })) : null, testResult ? _jsx(ConnectionTestResult, { result: testResult }) : null, testError ? (_jsx(Alert, { color: "red", title: "Couldn't test connection", children: testError })) : null, submitted && !error && successMessage ? successMessage : null, _jsx(Button, { onClick: () => void handleSubmit(), loading: submitting, disabled: !canSubmit, children: isEdit ? 'Save' : 'Connect' })] }));
184
+ }
185
+ function OpenRouterFields({ config, onChange, }) {
186
+ const opts = config.defaultCallOptions ?? {};
187
+ const setOpts = (patch) => {
188
+ const next = { ...opts, ...patch };
189
+ const empty = next.sort === undefined &&
190
+ next.order === undefined &&
191
+ next.only === undefined &&
192
+ next.ignore === undefined &&
193
+ next.allowFallbacks === undefined;
194
+ onChange({ defaultCallOptions: empty ? undefined : next });
195
+ };
196
+ return (_jsxs(_Fragment, { children: [_jsx(PasswordInput, { label: "API key", description: "Shown redacted when editing; only sent if you change it.", value: config.apiKey, onChange: (e) => onChange({ apiKey: e.currentTarget.value }) }), _jsx(TextInput, { label: "Base URL (optional)", value: str(config.baseUrl), onChange: (e) => onChange({ baseUrl: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(TextInput, { label: "Default model (optional)", value: str(config.defaultModel), onChange: (e) => onChange({ defaultModel: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(Select, { label: "Routing sort (optional)", placeholder: "Default", clearable: true, data: OPENROUTER_SORT_OPTIONS, value: opts.sort ?? null, onChange: (v) => setOpts({ sort: v ?? undefined }) }), _jsx(Textarea, { label: "Preferred upstream providers (optional, one per line, in order)", autosize: true, minRows: 2, value: arrayToMultiline(opts.order), onChange: (e) => setOpts({ order: multilineToArray(e.currentTarget.value) }) }), _jsx(Textarea, { label: "Only these upstream providers (optional, one per line)", autosize: true, minRows: 2, value: arrayToMultiline(opts.only), onChange: (e) => setOpts({ only: multilineToArray(e.currentTarget.value) }) }), _jsx(Textarea, { label: "Ignore upstream providers (optional, one per line)", autosize: true, minRows: 2, value: arrayToMultiline(opts.ignore), onChange: (e) => setOpts({ ignore: multilineToArray(e.currentTarget.value) }) }), _jsx(Switch, { label: "Allow fallbacks to other upstream providers", checked: opts.allowFallbacks ?? true, onChange: (e) => setOpts({ allowFallbacks: e.currentTarget.checked }) }), _jsx(Switch, { label: "Avoid unhealthy upstream endpoints", checked: config.avoidUnhealthyEndpoints ?? true, onChange: (e) => onChange({ avoidUnhealthyEndpoints: e.currentTarget.checked }) }), _jsx(TextInput, { label: "Endpoint health cache TTL in seconds (optional, default 60)", type: "number", min: 1, value: config.endpointHealthTtlSeconds ?? '', onChange: (e) => {
197
+ const n = Number.parseInt(e.currentTarget.value, 10);
198
+ onChange({ endpointHealthTtlSeconds: Number.isFinite(n) && n > 0 ? n : undefined });
199
+ } })] }));
200
+ }
201
+ function ApiKeyShapedFields({ config, onChange, maxTokensLabel, }) {
202
+ const maxTokens = config.type === 'openai' ? config.maxTokens : config.maxOutputTokens;
203
+ return (_jsxs(_Fragment, { children: [_jsx(TextInput, { label: "API key", type: "password", value: config.apiKey, onChange: (e) => onChange({ apiKey: e.currentTarget.value }) }), _jsx(TextInput, { label: "Base URL (optional)", value: str(config.baseUrl), onChange: (e) => onChange({ baseUrl: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(TextInput, { label: "Default model (optional)", value: str(config.defaultModel), onChange: (e) => onChange({ defaultModel: trimmedOrUndefined(e.currentTarget.value) }) }), _jsx(NumberInput, { label: config.type === 'openai' ? 'Max tokens (optional)' : maxTokensLabel, value: maxTokens, onChange: (v) => onChange((config.type === 'openai'
204
+ ? { maxTokens: typeof v === 'number' ? v : undefined }
205
+ : { maxOutputTokens: typeof v === 'number' ? v : undefined })) })] }));
206
+ }
@@ -0,0 +1,18 @@
1
+ import type { CatalogModelSummaryLike, LlmProviderSummaryLike } from './modelCatalogSource.js';
2
+ import { type ProviderConnectConfig } from './ProviderConnectForm.js';
3
+ export type ProviderListProps = {
4
+ providers: LlmProviderSummaryLike[];
5
+ models: CatalogModelSummaryLike[];
6
+ /** Re-scan a provider's catalog (e.g. `refreshProvider(id)`). */
7
+ onRefresh: (providerId: string) => Promise<void> | void;
8
+ /** Register a new provider (e.g. `registerProvider`). */
9
+ onAdd: (providerId: string, config: ProviderConnectConfig) => Promise<void> | void;
10
+ /** Update an existing provider (e.g. `updateProviderConfig`). */
11
+ onUpdate: (providerId: string, config: ProviderConnectConfig) => Promise<void> | void;
12
+ /** Remove a provider. */
13
+ onRemove: (providerId: string) => Promise<void> | void;
14
+ /** Load a provider's config for editing (e.g. `getProviderConfig`). */
15
+ loadConfig: (providerId: string) => Promise<ProviderConnectConfig>;
16
+ };
17
+ export declare function ProviderList({ providers, models, onRefresh, onAdd, onUpdate, onRemove, loadConfig, }: ProviderListProps): import("react").JSX.Element;
18
+ //# sourceMappingURL=ProviderList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProviderList.d.ts","sourceRoot":"","sources":["../src/ProviderList.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAC/F,OAAO,EAAuB,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAE3F,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,sBAAsB,EAAE,CAAC;IACpC,MAAM,EAAE,uBAAuB,EAAE,CAAC;IAClC,iEAAiE;IACjE,SAAS,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACxD,yDAAyD;IACzD,KAAK,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACnF,iEAAiE;IACjE,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACtF,yBAAyB;IACzB,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACvD,uEAAuE;IACvE,UAAU,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACpE,CAAC;AAIF,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,MAAM,EACN,SAAS,EACT,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,GACX,EAAE,iBAAiB,+BAkJnB"}
@@ -0,0 +1,67 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright 2026 John Ewart <john@johnewart.net>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ *
6
+ * Lists llmd providers with expandable catalog models, a refresh action, and
7
+ * add / edit / remove flows built on ProviderConnectForm. Transport-agnostic:
8
+ * the host wires the callbacks to its @pyxis-llm/client calls.
9
+ */
10
+ import { useState } from 'react';
11
+ import { Alert, Badge, Button, Collapse, Group, Paper, Stack, Text } from '@mantine/core';
12
+ import { ProviderConnectForm } from './ProviderConnectForm.js';
13
+ export function ProviderList({ providers, models, onRefresh, onAdd, onUpdate, onRemove, loadConfig, }) {
14
+ const [expanded, setExpanded] = useState(new Set());
15
+ const [editing, setEditing] = useState(null);
16
+ const [newId, setNewId] = useState('');
17
+ const [busy, setBusy] = useState(false);
18
+ const [error, setError] = useState(null);
19
+ const run = async (fn) => {
20
+ setBusy(true);
21
+ setError(null);
22
+ try {
23
+ await fn();
24
+ return true;
25
+ }
26
+ catch (e) {
27
+ setError(e instanceof Error ? e : new Error(String(e)));
28
+ return false;
29
+ }
30
+ finally {
31
+ setBusy(false);
32
+ }
33
+ };
34
+ const toggle = (id) => setExpanded((prev) => {
35
+ const next = new Set(prev);
36
+ if (next.has(id))
37
+ next.delete(id);
38
+ else
39
+ next.add(id);
40
+ return next;
41
+ });
42
+ const startEdit = async (id) => {
43
+ await run(async () => {
44
+ const config = await loadConfig(id);
45
+ setEditing({ mode: 'edit', id, config });
46
+ });
47
+ };
48
+ const submit = async (config) => {
49
+ if (!editing)
50
+ return;
51
+ const ok = await run(() => editing.mode === 'create' ? onAdd(newId.trim(), config) : onUpdate(editing.id, config));
52
+ if (ok) {
53
+ setEditing(null);
54
+ setNewId('');
55
+ }
56
+ };
57
+ return (_jsxs(Stack, { gap: "sm", children: [error && !editing ? (_jsx(Alert, { color: "red", title: "Provider action failed", children: error.message })) : null, providers.length === 0 ? _jsx(Text, { c: "dimmed", children: "No providers configured." }) : null, providers.map((p) => {
58
+ const pModels = models.filter((m) => m.providerId === p.id);
59
+ const open = expanded.has(p.id);
60
+ return (_jsxs(Paper, { withBorder: true, p: "sm", "data-testid": `provider-${p.id}`, children: [_jsxs(Group, { justify: "space-between", children: [_jsxs(Group, { gap: "xs", children: [_jsx(Text, { fw: 600, children: p.id }), _jsx(Badge, { variant: "light", children: p.type }), _jsxs(Text, { size: "sm", c: "dimmed", children: [pModels.length || p.catalogModelCount, " models"] }), _jsx(Text, { size: "sm", c: "dimmed", "data-testid": `refreshed-${p.id}`, children: p.modelsRefreshedUnixMs
61
+ ? `refreshed ${new Date(p.modelsRefreshedUnixMs).toLocaleString()}`
62
+ : 'never refreshed' })] }), _jsxs(Group, { gap: "xs", children: [_jsx(Button, { size: "xs", variant: "subtle", onClick: () => toggle(p.id), children: open ? 'Hide models' : 'Show models' }), _jsx(Button, { size: "xs", variant: "subtle", disabled: busy, onClick: () => void run(() => onRefresh(p.id)), children: "Refresh" }), p.userRegistered ? (_jsxs(_Fragment, { children: [_jsx(Button, { size: "xs", variant: "subtle", disabled: busy, onClick: () => void startEdit(p.id), children: "Edit" }), _jsx(Button, { size: "xs", variant: "subtle", color: "red", disabled: busy, onClick: () => void run(() => onRemove(p.id)), children: "Remove" })] })) : null] })] }), _jsx(Collapse, { in: open, children: _jsx(Stack, { gap: 2, mt: "xs", children: pModels.length === 0 ? (_jsx(Text, { size: "sm", c: "dimmed", children: "No models in catalog." })) : (pModels.map((m) => (_jsx(Text, { size: "sm", children: (m.displayName ?? '').trim() || m.modelId }, m.modelId)))) }) })] }, p.id));
63
+ }), editing ? (_jsxs(Paper, { withBorder: true, p: "sm", children: [_jsx(ProviderConnectForm, { mode: editing.mode, providerId: editing.mode === 'edit' ? editing.id : newId, onProviderIdChange: setNewId, initialConfig: editing.mode === 'edit' ? editing.config : undefined, onSubmit: submit, submitting: busy, error: error }), _jsx(Button, { mt: "xs", variant: "default", onClick: () => setEditing(null), children: "Cancel" })] })) : (_jsx(Group, { children: _jsx(Button, { onClick: () => {
64
+ setError(null);
65
+ setEditing({ mode: 'create' });
66
+ }, children: "Add provider" }) }))] }));
67
+ }
@@ -0,0 +1,17 @@
1
+ import type { QueuedMessage } from './vendor/llmd-types/index.js';
2
+ export type QueueStripProps = {
3
+ queue: QueuedMessage[];
4
+ paused: boolean;
5
+ onRemove?: (entryId: string) => void | Promise<void>;
6
+ /** Called with the full desired order (see the driver's `reorderQueue`). */
7
+ onReorder?: (entryIds: string[]) => void | Promise<void>;
8
+ onSetPaused?: (paused: boolean) => void | Promise<void>;
9
+ /**
10
+ * Send this entry now as an interrupt, taking it out of the queue (see the
11
+ * driver's `interruptWithQueued`). Offered on every entry that has not started.
12
+ */
13
+ onInterruptWith?: (entryId: string) => void | Promise<void>;
14
+ className?: string;
15
+ };
16
+ export declare function QueueStrip({ queue, paused, onRemove, onReorder, onSetPaused, onInterruptWith, className, }: QueueStripProps): import("react").JSX.Element | null;
17
+ //# sourceMappingURL=QueueStrip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueueStrip.d.ts","sourceRoot":"","sources":["../src/QueueStrip.tsx"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,4EAA4E;IAC5E,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAQF,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,EACT,WAAW,EACX,eAAe,EACf,SAAS,GACV,EAAE,eAAe,sCA2IjB"}
@@ -0,0 +1,60 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright 2026 John Ewart <john@johnewart.net>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ *
6
+ * The session's message queue, rendered above the composer.
7
+ *
8
+ * Designed to slot into `ChatPanel`'s `composerBefore`, so it composes rather
9
+ * than adding another half-dozen props to ChatPanel:
10
+ *
11
+ * <ChatPanel
12
+ * composerBefore={
13
+ * <QueueStrip
14
+ * queue={driver.queue}
15
+ * paused={driver.queuePaused}
16
+ * onRemove={driver.removeQueued}
17
+ * onReorder={driver.reorderQueue}
18
+ * onSetPaused={driver.setQueuePaused}
19
+ * />
20
+ * }
21
+ * ...
22
+ * />
23
+ *
24
+ * Renders nothing at all when the queue is empty and not paused: a queue that
25
+ * is not in use should take up no space.
26
+ */
27
+ import { ActionIcon, Tooltip } from '@mantine/core';
28
+ import { IconArrowDown, IconArrowUp, IconPlayerPause, IconBolt, IconPlayerPlay, IconX, } from '@tabler/icons-react';
29
+ /** One-line preview, so a long queued message does not dominate the strip. */
30
+ function preview(content, max = 80) {
31
+ const flat = content.replace(/\s+/g, ' ').trim();
32
+ return flat.length > max ? `${flat.slice(0, max - 1)}…` : flat;
33
+ }
34
+ export function QueueStrip({ queue, paused, onRemove, onReorder, onSetPaused, onInterruptWith, className, }) {
35
+ if (queue.length === 0 && !paused)
36
+ return null;
37
+ const ids = queue.map((q) => q.id);
38
+ const move = (index, delta) => {
39
+ const next = [...ids];
40
+ const target = index + delta;
41
+ if (target < 0 || target >= next.length)
42
+ return;
43
+ [next[index], next[target]] = [next[target], next[index]];
44
+ void onReorder?.(next);
45
+ };
46
+ return (_jsxs("div", { className: ['llmd-queue-strip', className].filter(Boolean).join(' '), style: { display: 'flex', flexDirection: 'column', gap: 4, width: '100%' }, children: [_jsxs("div", { className: "llmd-queue-strip__header", style: { display: 'flex', alignItems: 'center', gap: 6 }, children: [_jsx("span", { className: "llmd-queue-strip__count", style: { fontSize: '0.7rem', textTransform: 'uppercase', letterSpacing: '0.05em', opacity: 0.7 }, children: queue.length === 0
47
+ ? 'Queue paused'
48
+ : `${queue.length} queued${paused ? ' · paused' : ''}` }), onSetPaused && (_jsx(Tooltip, { label: paused
49
+ ? 'Resume — queued messages will start running again'
50
+ : 'Pause — queued messages stay put until resumed', withArrow: true, children: _jsx(ActionIcon, { type: "button", variant: "subtle", size: "xs", color: "gray", "aria-label": paused ? 'Resume queue' : 'Pause queue', className: "llmd-queue-strip__pause", onClick: () => void onSetPaused(!paused), children: paused ? _jsx(IconPlayerPlay, { size: 14 }) : _jsx(IconPlayerPause, { size: 14 }) }) }))] }), queue.map((entry, index) => {
51
+ const running = entry.state === 'running';
52
+ return (_jsxs("div", { className: `llmd-queue-strip__item${running ? ' llmd-queue-strip__item--running' : ''}`, "data-queue-entry-id": entry.id, style: {
53
+ display: 'flex',
54
+ alignItems: 'center',
55
+ gap: 6,
56
+ fontSize: '0.78rem',
57
+ opacity: running ? 1 : 0.85,
58
+ }, children: [_jsx("span", { className: "llmd-queue-strip__state", style: { fontSize: '0.62rem', textTransform: 'uppercase', opacity: 0.6, minWidth: 52 }, children: running ? 'running' : `#${index + 1}` }), _jsx("span", { className: "llmd-queue-strip__content", style: { flex: 1, minWidth: 0 }, children: preview(entry.content) }), !running && onInterruptWith && (_jsx(Tooltip, { label: "Send now \u2014 interrupt the running turn", withArrow: true, children: _jsx(ActionIcon, { type: "button", variant: "subtle", size: "xs", color: "orange", "aria-label": `Interrupt with: ${preview(entry.content, 24)}`, className: "llmd-queue-strip__interrupt", onClick: () => void onInterruptWith(entry.id), children: _jsx(IconBolt, { size: 13 }) }) })), !running && onReorder && (_jsxs(_Fragment, { children: [_jsx(ActionIcon, { type: "button", variant: "subtle", size: "xs", color: "gray", "aria-label": `Move up: ${preview(entry.content, 24)}`, disabled: index === 0, onClick: () => move(index, -1), children: _jsx(IconArrowUp, { size: 13 }) }), _jsx(ActionIcon, { type: "button", variant: "subtle", size: "xs", color: "gray", "aria-label": `Move down: ${preview(entry.content, 24)}`, disabled: index === queue.length - 1, onClick: () => move(index, 1), children: _jsx(IconArrowDown, { size: 13 }) })] })), !running && onRemove && (_jsx(ActionIcon, { type: "button", variant: "subtle", size: "xs", color: "gray", "aria-label": `Remove from queue: ${preview(entry.content, 24)}`, className: "llmd-queue-strip__remove", onClick: () => void onRemove(entry.id), children: _jsx(IconX, { size: 13 }) }))] }, entry.id));
59
+ })] }));
60
+ }
@@ -0,0 +1,10 @@
1
+ import { type ProviderConnectConfig } from './ProviderConnectForm.js';
2
+ export type SettingsScreenProps = {
3
+ /** Any llmd client exposing `registerProvider` (e.g. from `createLlmdClient`). */
4
+ client: {
5
+ registerProvider: (providerId: string, config: ProviderConnectConfig) => Promise<void>;
6
+ };
7
+ onRegistered?: (providerId: string) => void;
8
+ };
9
+ export declare function SettingsScreen({ client, onRegistered }: SettingsScreenProps): import("react").JSX.Element;
10
+ //# sourceMappingURL=SettingsScreen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SettingsScreen.d.ts","sourceRoot":"","sources":["../src/SettingsScreen.tsx"],"names":[],"mappings":"AACA,OAAO,EAAuB,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAE3F,MAAM,MAAM,mBAAmB,GAAG;IAChC,kFAAkF;IAClF,MAAM,EAAE;QACN,gBAAgB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KACxF,CAAC;IACF,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C,CAAC;AAEF,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,mBAAmB,+BAkC3E"}
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { ProviderConnectForm } from './ProviderConnectForm.js';
4
+ export function SettingsScreen({ client, onRegistered }) {
5
+ const [providerId, setProviderId] = useState('');
6
+ const [submitting, setSubmitting] = useState(false);
7
+ const [error, setError] = useState(null);
8
+ const [saved, setSaved] = useState(false);
9
+ const handleSubmit = async (config) => {
10
+ setSubmitting(true);
11
+ setError(null);
12
+ setSaved(false);
13
+ try {
14
+ await client.registerProvider(providerId, config);
15
+ setSaved(true);
16
+ onRegistered?.(providerId);
17
+ }
18
+ catch (e) {
19
+ setError(e instanceof Error ? e : new Error(String(e)));
20
+ }
21
+ finally {
22
+ setSubmitting(false);
23
+ }
24
+ };
25
+ return (_jsxs("div", { children: [_jsx("h2", { children: "Settings" }), _jsx(ProviderConnectForm, { providerId: providerId, onProviderIdChange: setProviderId, onSubmit: handleSubmit, submitting: submitting, error: error, successMessage: saved ? _jsx("span", { children: "Provider registered." }) : undefined })] }));
26
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Progressive ("block-freezing") markdown renderer for streamed agent text.
3
+ *
4
+ * Rendering a growing markdown document by re-parsing the whole string on every
5
+ * token is O(n) parse per token — O(n²) over a stream — and remounts the DOM
6
+ * each render (flicker). Instead we split the stream into:
7
+ *
8
+ * - committed blocks: everything up to the last SAFE block boundary (a blank
9
+ * line that is not inside an open code fence). Each block is parsed to
10
+ * markdown ONCE and memoized, so it never re-renders as more text streams in.
11
+ * - a live tail: the trailing, still-growing block, rendered as cheap plain
12
+ * pre-wrap text (flicker-free; no half-parsed markdown flashing).
13
+ *
14
+ * When a new boundary is crossed the tail's completed portion freezes into the
15
+ * committed stack. Net cost is ~O(n) total instead of O(n²), and frozen blocks
16
+ * get `content-visibility: auto` so off-screen ones skip layout/paint.
17
+ */
18
+ import React from 'react';
19
+ type SplitResult = {
20
+ blocks: string[];
21
+ tail: string;
22
+ };
23
+ /**
24
+ * Split streamed markdown into fully-committed blocks + a live trailing block.
25
+ * Boundaries are blank lines at the top level; a blank line inside an open
26
+ * ``` / ~~~ code fence is NOT a boundary, so fenced code (which may contain
27
+ * blank lines) is never split mid-block.
28
+ */
29
+ export declare function splitStreamingMarkdown(text: string): SplitResult;
30
+ /**
31
+ * Render streamed markdown progressively: committed blocks as memoized markdown,
32
+ * the still-streaming trailing block as plain text.
33
+ */
34
+ export declare function StreamingMarkdown({ text, complete, }: {
35
+ text: string;
36
+ /**
37
+ * The run has finished, so nothing is still arriving: parse the WHOLE text as
38
+ * markdown instead of leaving the trailing block as plain text. Callers that
39
+ * re-render a finished message from the persisted transcript never need this;
40
+ * callers that keep displaying the streamed text after the run ends (e.g. an
41
+ * in-document ask card) would otherwise show the last block — and for a short
42
+ * answer, the entire response — unformatted.
43
+ */
44
+ complete?: boolean;
45
+ }): React.JSX.Element;
46
+ export {};
47
+ //# sourceMappingURL=StreamingMarkdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StreamingMarkdown.d.ts","sourceRoot":"","sources":["../src/StreamingMarkdown.tsx"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAKvC,KAAK,WAAW,GAAG;IAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CA0ChE;AAgDD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,QAAgB,GACjB,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,qBAyBA"}
@@ -0,0 +1,103 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright 2026 John Ewart <john@johnewart.net>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Progressive ("block-freezing") markdown renderer for streamed agent text.
8
+ *
9
+ * Rendering a growing markdown document by re-parsing the whole string on every
10
+ * token is O(n) parse per token — O(n²) over a stream — and remounts the DOM
11
+ * each render (flicker). Instead we split the stream into:
12
+ *
13
+ * - committed blocks: everything up to the last SAFE block boundary (a blank
14
+ * line that is not inside an open code fence). Each block is parsed to
15
+ * markdown ONCE and memoized, so it never re-renders as more text streams in.
16
+ * - a live tail: the trailing, still-growing block, rendered as cheap plain
17
+ * pre-wrap text (flicker-free; no half-parsed markdown flashing).
18
+ *
19
+ * When a new boundary is crossed the tail's completed portion freezes into the
20
+ * committed stack. Net cost is ~O(n) total instead of O(n²), and frozen blocks
21
+ * get `content-visibility: auto` so off-screen ones skip layout/paint.
22
+ */
23
+ import React, { useMemo } from 'react';
24
+ import ReactMarkdown from 'react-markdown';
25
+ import { useMarkdownPlugins } from './markdownPlugins.js';
26
+ import { markdownThinkingStreamCodeComponents } from './MarkdownCodeComponents.js';
27
+ /**
28
+ * Split streamed markdown into fully-committed blocks + a live trailing block.
29
+ * Boundaries are blank lines at the top level; a blank line inside an open
30
+ * ``` / ~~~ code fence is NOT a boundary, so fenced code (which may contain
31
+ * blank lines) is never split mid-block.
32
+ */
33
+ export function splitStreamingMarkdown(text) {
34
+ if (!text)
35
+ return { blocks: [], tail: '' };
36
+ const lines = text.split('\n');
37
+ const blocks = [];
38
+ let current = [];
39
+ let inFence = false;
40
+ let fenceMarker = '';
41
+ for (const line of lines) {
42
+ const trimmed = line.trimStart();
43
+ const fenceHit = trimmed.startsWith('```')
44
+ ? '```'
45
+ : trimmed.startsWith('~~~')
46
+ ? '~~~'
47
+ : '';
48
+ if (fenceHit) {
49
+ if (!inFence) {
50
+ inFence = true;
51
+ fenceMarker = fenceHit;
52
+ }
53
+ else if (trimmed.startsWith(fenceMarker)) {
54
+ inFence = false;
55
+ }
56
+ current.push(line);
57
+ continue;
58
+ }
59
+ if (!inFence && line.trim() === '') {
60
+ // Block boundary — freeze the current block (collapsing consecutive blanks).
61
+ if (current.length > 0) {
62
+ blocks.push(current.join('\n'));
63
+ current = [];
64
+ }
65
+ continue;
66
+ }
67
+ current.push(line);
68
+ }
69
+ // The trailing block stays "live" until a blank line terminates it, so the
70
+ // paragraph currently being written is always the (cheap, plain-text) tail.
71
+ return { blocks, tail: current.join('\n') };
72
+ }
73
+ /**
74
+ * One frozen markdown block. Memoized on its (immutable, once-committed) content
75
+ * so it is parsed exactly once; `content-visibility: auto` lets the browser skip
76
+ * layout/paint for blocks scrolled off screen. `contain-intrinsic-size: auto …`
77
+ * caches the real size after first render so re-showing does not jump the scroll.
78
+ */
79
+ const MarkdownBlock = React.memo(function MarkdownBlock({ content, virtualize, }) {
80
+ const { remarkPlugins, rehypePlugins } = useMarkdownPlugins();
81
+ return (_jsx("div", { className: "streaming-markdown-block", style: virtualize
82
+ ? {
83
+ contentVisibility: 'auto',
84
+ containIntrinsicSize: 'auto 32px',
85
+ }
86
+ : undefined, children: _jsx(ReactMarkdown, { remarkPlugins: remarkPlugins, rehypePlugins: rehypePlugins, components: markdownThinkingStreamCodeComponents, children: content }) }));
87
+ });
88
+ /**
89
+ * Render streamed markdown progressively: committed blocks as memoized markdown,
90
+ * the still-streaming trailing block as plain text.
91
+ */
92
+ export function StreamingMarkdown({ text, complete = false, }) {
93
+ const { blocks, tail } = useMemo(() => splitStreamingMarkdown(text), [text]);
94
+ if (complete) {
95
+ return _jsx(MarkdownBlock, { content: text, virtualize: false });
96
+ }
97
+ return (_jsxs(_Fragment, { children: [blocks.map((block, i) => (
98
+ // Stable prefix: index i always maps to the same frozen content, so the
99
+ // string-equality memo skips re-parsing already-committed blocks. The
100
+ // newest block (last index) is never virtualized so the auto-scroll can
101
+ // measure its real height and reach the bottom.
102
+ _jsx(MarkdownBlock, { content: block, virtualize: i < blocks.length - 1 }, i))), tail ? (_jsx("div", { className: "streaming-markdown-tail", style: { whiteSpace: 'pre-wrap' }, children: tail })) : null] }));
103
+ }