@hyperspaceng/neural-web-ui 0.60.0

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 (86) hide show
  1. package/CHANGELOG.md +329 -0
  2. package/README.md +601 -0
  3. package/example/README.md +61 -0
  4. package/example/index.html +13 -0
  5. package/example/package.json +25 -0
  6. package/example/src/app.css +1 -0
  7. package/example/src/custom-messages.ts +99 -0
  8. package/example/src/main.ts +421 -0
  9. package/example/tsconfig.json +23 -0
  10. package/example/vite.config.ts +6 -0
  11. package/package.json +51 -0
  12. package/scripts/count-prompt-tokens.ts +88 -0
  13. package/src/ChatPanel.ts +209 -0
  14. package/src/app.css +68 -0
  15. package/src/components/AgentInterface.ts +401 -0
  16. package/src/components/AttachmentTile.ts +107 -0
  17. package/src/components/ConsoleBlock.ts +72 -0
  18. package/src/components/CustomProviderCard.ts +100 -0
  19. package/src/components/ExpandableSection.ts +46 -0
  20. package/src/components/Input.ts +113 -0
  21. package/src/components/MessageEditor.ts +402 -0
  22. package/src/components/MessageList.ts +98 -0
  23. package/src/components/Messages.ts +383 -0
  24. package/src/components/ProviderKeyInput.ts +153 -0
  25. package/src/components/SandboxedIframe.ts +626 -0
  26. package/src/components/StreamingMessageContainer.ts +103 -0
  27. package/src/components/ThinkingBlock.ts +43 -0
  28. package/src/components/message-renderer-registry.ts +28 -0
  29. package/src/components/sandbox/ArtifactsRuntimeProvider.ts +219 -0
  30. package/src/components/sandbox/AttachmentsRuntimeProvider.ts +66 -0
  31. package/src/components/sandbox/ConsoleRuntimeProvider.ts +186 -0
  32. package/src/components/sandbox/FileDownloadRuntimeProvider.ts +110 -0
  33. package/src/components/sandbox/RuntimeMessageBridge.ts +82 -0
  34. package/src/components/sandbox/RuntimeMessageRouter.ts +216 -0
  35. package/src/components/sandbox/SandboxRuntimeProvider.ts +52 -0
  36. package/src/dialogs/ApiKeyPromptDialog.ts +75 -0
  37. package/src/dialogs/AttachmentOverlay.ts +636 -0
  38. package/src/dialogs/CustomProviderDialog.ts +274 -0
  39. package/src/dialogs/ModelSelector.ts +367 -0
  40. package/src/dialogs/PersistentStorageDialog.ts +144 -0
  41. package/src/dialogs/ProvidersModelsTab.ts +212 -0
  42. package/src/dialogs/SessionListDialog.ts +150 -0
  43. package/src/dialogs/SettingsDialog.ts +218 -0
  44. package/src/index.ts +120 -0
  45. package/src/prompts/prompts.ts +282 -0
  46. package/src/storage/app-storage.ts +60 -0
  47. package/src/storage/backends/indexeddb-storage-backend.ts +193 -0
  48. package/src/storage/store.ts +33 -0
  49. package/src/storage/stores/custom-providers-store.ts +62 -0
  50. package/src/storage/stores/provider-keys-store.ts +33 -0
  51. package/src/storage/stores/sessions-store.ts +136 -0
  52. package/src/storage/stores/settings-store.ts +34 -0
  53. package/src/storage/types.ts +206 -0
  54. package/src/tools/artifacts/ArtifactElement.ts +14 -0
  55. package/src/tools/artifacts/ArtifactPill.ts +26 -0
  56. package/src/tools/artifacts/Console.ts +93 -0
  57. package/src/tools/artifacts/DocxArtifact.ts +213 -0
  58. package/src/tools/artifacts/ExcelArtifact.ts +231 -0
  59. package/src/tools/artifacts/GenericArtifact.ts +117 -0
  60. package/src/tools/artifacts/HtmlArtifact.ts +195 -0
  61. package/src/tools/artifacts/ImageArtifact.ts +116 -0
  62. package/src/tools/artifacts/MarkdownArtifact.ts +82 -0
  63. package/src/tools/artifacts/PdfArtifact.ts +201 -0
  64. package/src/tools/artifacts/SvgArtifact.ts +78 -0
  65. package/src/tools/artifacts/TextArtifact.ts +148 -0
  66. package/src/tools/artifacts/artifacts-tool-renderer.ts +310 -0
  67. package/src/tools/artifacts/artifacts.ts +713 -0
  68. package/src/tools/artifacts/index.ts +7 -0
  69. package/src/tools/extract-document.ts +275 -0
  70. package/src/tools/index.ts +46 -0
  71. package/src/tools/javascript-repl.ts +293 -0
  72. package/src/tools/renderer-registry.ts +130 -0
  73. package/src/tools/renderers/BashRenderer.ts +52 -0
  74. package/src/tools/renderers/CalculateRenderer.ts +58 -0
  75. package/src/tools/renderers/DefaultRenderer.ts +103 -0
  76. package/src/tools/renderers/GetCurrentTimeRenderer.ts +92 -0
  77. package/src/tools/types.ts +15 -0
  78. package/src/utils/attachment-utils.ts +472 -0
  79. package/src/utils/auth-token.ts +22 -0
  80. package/src/utils/format.ts +42 -0
  81. package/src/utils/i18n.ts +653 -0
  82. package/src/utils/model-discovery.ts +277 -0
  83. package/src/utils/proxy-utils.ts +139 -0
  84. package/src/utils/test-sessions.ts +2357 -0
  85. package/tsconfig.build.json +20 -0
  86. package/tsconfig.json +7 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,329 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased]
4
+
5
+ ## [0.60.0] - 2026-03-18
6
+
7
+ ## [0.59.0] - 2026-03-17
8
+
9
+ ### Added
10
+
11
+ - Exported `CustomProviderDialog` from `@mariozechner/pi-web-ui` ([#2267](https://github.com/badlogic/pi-mono/issues/2267))
12
+
13
+ ## [0.58.4] - 2026-03-16
14
+
15
+ ### Added
16
+
17
+ - `onModelSelect` callback on `AgentInterface` and `ChatPanel.setAgent` config
18
+ - `allowedProviders` filter on `ModelSelector.open()` to restrict visible models
19
+ - `onClose` callback on `SettingsDialog.open()`
20
+ - `state_change` event emitted by Agent on `setModel()` and `setThinkingLevel()`
21
+ - Subsequence-based fuzzy search in model selector (replaces substring matching)
22
+ - `openai-codex` and `github-copilot` to `shouldUseProxyForProvider`
23
+
24
+ ### Changed
25
+
26
+ - Anthropic test model updated from `claude-3-5-haiku-20241022` to `claude-haiku-4-5`
27
+
28
+ ### Fixed
29
+
30
+ - `AgentInterface` clears streaming container on `message_end` to prevent duplicate tool rendering
31
+
32
+ ## [0.58.3] - 2026-03-15
33
+
34
+ ### Fixed
35
+
36
+ - Build `@mariozechner/pi-web-ui` with `tsc` instead of `tsgo` so Lit decorator-based state updates rerender correctly.
37
+
38
+ ## [0.58.2] - 2026-03-15
39
+
40
+ ## [0.58.1] - 2026-03-14
41
+
42
+ ## [0.58.0] - 2026-03-14
43
+
44
+ ## [0.57.1] - 2026-03-07
45
+
46
+ ## [0.57.0] - 2026-03-07
47
+
48
+ ## [0.56.3] - 2026-03-06
49
+
50
+ ## [0.56.2] - 2026-03-05
51
+
52
+ ## [0.56.1] - 2026-03-05
53
+
54
+ ## [0.56.0] - 2026-03-04
55
+
56
+ ## [0.55.4] - 2026-03-02
57
+
58
+ ## [0.55.3] - 2026-02-27
59
+
60
+ ## [0.55.2] - 2026-02-27
61
+
62
+ ## [0.55.1] - 2026-02-26
63
+
64
+ ## [0.55.0] - 2026-02-24
65
+
66
+ ## [0.54.2] - 2026-02-23
67
+
68
+ ## [0.54.1] - 2026-02-22
69
+
70
+ ## [0.54.0] - 2026-02-19
71
+
72
+ ## [0.53.1] - 2026-02-19
73
+
74
+ ## [0.53.0] - 2026-02-17
75
+
76
+ ## [0.52.12] - 2026-02-13
77
+
78
+ ## [0.52.11] - 2026-02-13
79
+
80
+ ## [0.52.10] - 2026-02-12
81
+
82
+ ### Fixed
83
+
84
+ - Made model selector search case-insensitive by normalizing query tokens, fixing auto-capitalized mobile input filtering ([#1443](https://github.com/badlogic/pi-mono/issues/1443))
85
+
86
+ ## [0.52.9] - 2026-02-08
87
+
88
+ ## [0.52.8] - 2026-02-07
89
+
90
+ ## [0.52.7] - 2026-02-06
91
+
92
+ ## [0.52.6] - 2026-02-05
93
+
94
+ ## [0.52.5] - 2026-02-05
95
+
96
+ ## [0.52.4] - 2026-02-05
97
+
98
+ ## [0.52.3] - 2026-02-05
99
+
100
+ ## [0.52.2] - 2026-02-05
101
+
102
+ ## [0.52.1] - 2026-02-05
103
+
104
+ ## [0.52.0] - 2026-02-05
105
+
106
+ ## [0.51.6] - 2026-02-04
107
+
108
+ ## [0.51.5] - 2026-02-04
109
+
110
+ ## [0.51.4] - 2026-02-03
111
+
112
+ ## [0.51.3] - 2026-02-03
113
+
114
+ ## [0.51.2] - 2026-02-03
115
+
116
+ ## [0.51.1] - 2026-02-02
117
+
118
+ ## [0.51.0] - 2026-02-01
119
+
120
+ ## [0.50.9] - 2026-02-01
121
+
122
+ ## [0.50.8] - 2026-02-01
123
+
124
+ ## [0.50.7] - 2026-01-31
125
+
126
+ ## [0.50.6] - 2026-01-30
127
+
128
+ ## [0.50.5] - 2026-01-30
129
+
130
+ ## [0.50.3] - 2026-01-29
131
+
132
+ ## [0.50.2] - 2026-01-29
133
+
134
+ ### Added
135
+
136
+ - Exported `CustomProviderCard`, `ProviderKeyInput`, `AbortedMessage`, and `ToolMessageDebugView` components for custom UIs ([#1015](https://github.com/badlogic/pi-mono/issues/1015))
137
+
138
+ ## [0.50.1] - 2026-01-26
139
+
140
+ ## [0.50.0] - 2026-01-26
141
+
142
+ ## [0.49.3] - 2026-01-22
143
+
144
+ ### Changed
145
+
146
+ - Updated tsgo to 7.0.0-dev.20260120.1 for decorator support ([#873](https://github.com/badlogic/pi-mono/issues/873))
147
+
148
+ ## [0.49.2] - 2026-01-19
149
+
150
+ ## [0.49.1] - 2026-01-18
151
+
152
+ ## [0.49.0] - 2026-01-17
153
+
154
+ ## [0.48.0] - 2026-01-16
155
+
156
+ ## [0.47.0] - 2026-01-16
157
+
158
+ ## [0.46.0] - 2026-01-15
159
+
160
+ ## [0.45.7] - 2026-01-13
161
+
162
+ ## [0.45.6] - 2026-01-13
163
+
164
+ ## [0.45.5] - 2026-01-13
165
+
166
+ ## [0.45.4] - 2026-01-13
167
+
168
+ ## [0.45.3] - 2026-01-13
169
+
170
+ ## [0.45.2] - 2026-01-13
171
+
172
+ ## [0.45.1] - 2026-01-13
173
+
174
+ ## [0.45.0] - 2026-01-13
175
+
176
+ ## [0.44.0] - 2026-01-12
177
+
178
+ ## [0.43.0] - 2026-01-11
179
+
180
+ ## [0.42.5] - 2026-01-11
181
+
182
+ ## [0.42.4] - 2026-01-10
183
+
184
+ ## [0.42.3] - 2026-01-10
185
+
186
+ ## [0.42.2] - 2026-01-10
187
+
188
+ ## [0.42.1] - 2026-01-09
189
+
190
+ ## [0.42.0] - 2026-01-09
191
+
192
+ ## [0.41.0] - 2026-01-09
193
+
194
+ ## [0.40.1] - 2026-01-09
195
+
196
+ ## [0.40.0] - 2026-01-08
197
+
198
+ ## [0.39.1] - 2026-01-08
199
+
200
+ ## [0.39.0] - 2026-01-08
201
+
202
+ ## [0.38.0] - 2026-01-08
203
+
204
+ ## [0.37.8] - 2026-01-07
205
+
206
+ ## [0.37.7] - 2026-01-07
207
+
208
+ ## [0.37.6] - 2026-01-06
209
+
210
+ ## [0.37.5] - 2026-01-06
211
+
212
+ ## [0.37.4] - 2026-01-06
213
+
214
+ ## [0.37.3] - 2026-01-06
215
+
216
+ ## [0.37.2] - 2026-01-05
217
+
218
+ ## [0.37.1] - 2026-01-05
219
+
220
+ ## [0.37.0] - 2026-01-05
221
+
222
+ ## [0.36.0] - 2026-01-05
223
+
224
+ ## [0.35.0] - 2026-01-05
225
+
226
+ ## [0.34.2] - 2026-01-04
227
+
228
+ ## [0.34.1] - 2026-01-04
229
+
230
+ ## [0.34.0] - 2026-01-04
231
+
232
+ ## [0.33.0] - 2026-01-04
233
+
234
+ ## [0.32.3] - 2026-01-03
235
+
236
+ ## [0.32.2] - 2026-01-03
237
+
238
+ ## [0.32.1] - 2026-01-03
239
+
240
+ ## [0.32.0] - 2026-01-03
241
+
242
+ ## [0.31.1] - 2026-01-02
243
+
244
+ ## [0.31.0] - 2026-01-02
245
+
246
+ ### Breaking Changes
247
+
248
+ - **Agent class moved to `@mariozechner/pi-agent-core`**: The `Agent` class, `AgentState`, and related types are no longer exported from this package. Import them from `@mariozechner/pi-agent-core` instead.
249
+
250
+ - **Transport abstraction removed**: `ProviderTransport`, `AppTransport`, `AgentTransport` interface, and related types have been removed. The `Agent` class now uses `streamFn` for custom streaming.
251
+
252
+ - **`AppMessage` renamed to `AgentMessage`**: Now imported from `@mariozechner/pi-agent-core`. Custom message types use declaration merging on `CustomAgentMessages` interface.
253
+
254
+ - **`UserMessageWithAttachments` is now a custom message type**: Has `role: "user-with-attachments"` instead of `role: "user"`. Use `isUserMessageWithAttachments()` type guard.
255
+
256
+ - **`CustomMessages` interface removed**: Use declaration merging on `CustomAgentMessages` from `@mariozechner/pi-agent-core` instead.
257
+
258
+ - **`agent.appendMessage()` removed**: Use `agent.queueMessage()` instead.
259
+
260
+ - **Agent event types changed**: `AgentInterface` now handles new event types from `@mariozechner/pi-agent-core`: `message_start`, `message_end`, `message_update`, `turn_start`, `turn_end`, `agent_start`, `agent_end`.
261
+
262
+ ### Added
263
+
264
+ - **`defaultConvertToLlm`**: Default message transformer that handles `UserMessageWithAttachments` and `ArtifactMessage`. Apps can extend this for custom message types.
265
+
266
+ - **`convertAttachments`**: Utility to convert `Attachment[]` to LLM content blocks (images and extracted document text).
267
+
268
+ - **`isUserMessageWithAttachments` / `isArtifactMessage`**: Type guard functions for custom message types.
269
+
270
+ - **`createStreamFn`**: Creates a stream function with CORS proxy support. Reads proxy settings on each call for dynamic configuration.
271
+
272
+ - **Default `streamFn` and `getApiKey`**: `AgentInterface` now sets sensible defaults if not provided:
273
+ - `streamFn`: Uses `createStreamFn` with proxy settings from storage
274
+ - `getApiKey`: Reads from `providerKeys` storage
275
+
276
+ - **Proxy utilities exported**: `applyProxyIfNeeded`, `shouldUseProxyForProvider`, `isCorsError`, `createStreamFn`
277
+
278
+ ### Removed
279
+
280
+ - `Agent` class (moved to `@mariozechner/pi-agent-core`)
281
+ - `ProviderTransport` class
282
+ - `AppTransport` class
283
+ - `AgentTransport` interface
284
+ - `AgentRunConfig` type
285
+ - `ProxyAssistantMessageEvent` type
286
+ - `test-sessions.ts` example file
287
+
288
+ ### Migration Guide
289
+
290
+ **Before (0.30.x):**
291
+ ```typescript
292
+ import { Agent, ProviderTransport, type AppMessage } from '@mariozechner/pi-web-ui';
293
+
294
+ const agent = new Agent({
295
+ transport: new ProviderTransport(),
296
+ messageTransformer: (messages: AppMessage[]) => messages.filter(...)
297
+ });
298
+ ```
299
+
300
+ **After:**
301
+ ```typescript
302
+ import { Agent, type AgentMessage } from '@mariozechner/pi-agent-core';
303
+ import { defaultConvertToLlm } from '@mariozechner/pi-web-ui';
304
+
305
+ const agent = new Agent({
306
+ convertToLlm: (messages: AgentMessage[]) => {
307
+ // Extend defaultConvertToLlm for custom types
308
+ return defaultConvertToLlm(messages);
309
+ }
310
+ });
311
+ // AgentInterface will set streamFn and getApiKey defaults automatically
312
+ ```
313
+
314
+ **Custom message types:**
315
+ ```typescript
316
+ // Before: declaration merging on CustomMessages
317
+ declare module "@mariozechner/pi-web-ui" {
318
+ interface CustomMessages {
319
+ "my-message": MyMessage;
320
+ }
321
+ }
322
+
323
+ // After: declaration merging on CustomAgentMessages
324
+ declare module "@mariozechner/pi-agent-core" {
325
+ interface CustomAgentMessages {
326
+ "my-message": MyMessage;
327
+ }
328
+ }
329
+ ```