@draht/web-ui 2026.3.2-7 → 2026.3.2-8
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.
- package/CHANGELOG.md +6 -0
- package/README.md +22 -22
- package/example/README.md +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @draht/web-ui
|
|
2
2
|
|
|
3
|
-
Reusable web UI components for building AI chat interfaces powered by [@
|
|
3
|
+
Reusable web UI components for building AI chat interfaces powered by [@draht/ai](../ai) and [@draht/agent-core](../agent).
|
|
4
4
|
|
|
5
5
|
Built with [mini-lit](https://github.com/badlogic/mini-lit) web components and Tailwind CSS v4.
|
|
6
6
|
|
|
@@ -17,7 +17,7 @@ Built with [mini-lit](https://github.com/badlogic/mini-lit) web components and T
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
|
|
20
|
+
bun add @draht/web-ui @draht/agent-core @draht/ai
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Quick Start
|
|
@@ -25,8 +25,8 @@ npm install @mariozechner/pi-web-ui @mariozechner/pi-agent-core @mariozechner/pi
|
|
|
25
25
|
See the [example](./example) directory for a complete working application.
|
|
26
26
|
|
|
27
27
|
```typescript
|
|
28
|
-
import { Agent } from '@
|
|
29
|
-
import { getModel } from '@
|
|
28
|
+
import { Agent } from '@draht/agent-core';
|
|
29
|
+
import { getModel } from '@draht/ai';
|
|
30
30
|
import {
|
|
31
31
|
ChatPanel,
|
|
32
32
|
AppStorage,
|
|
@@ -37,8 +37,8 @@ import {
|
|
|
37
37
|
setAppStorage,
|
|
38
38
|
defaultConvertToLlm,
|
|
39
39
|
ApiKeyPromptDialog,
|
|
40
|
-
} from '@
|
|
41
|
-
import '@
|
|
40
|
+
} from '@draht/web-ui';
|
|
41
|
+
import '@draht/web-ui/app.css';
|
|
42
42
|
|
|
43
43
|
// Set up storage
|
|
44
44
|
const settings = new SettingsStore();
|
|
@@ -169,7 +169,7 @@ Properties:
|
|
|
169
169
|
### Agent (from pi-agent-core)
|
|
170
170
|
|
|
171
171
|
```typescript
|
|
172
|
-
import { Agent } from '@
|
|
172
|
+
import { Agent } from '@draht/agent-core';
|
|
173
173
|
|
|
174
174
|
const agent = new Agent({
|
|
175
175
|
initialState: {
|
|
@@ -259,7 +259,7 @@ interface SystemNotification {
|
|
|
259
259
|
timestamp: string;
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
declare module '@
|
|
262
|
+
declare module '@draht/agent-core' {
|
|
263
263
|
interface CustomAgentMessages {
|
|
264
264
|
'system-notification': SystemNotification;
|
|
265
265
|
}
|
|
@@ -287,7 +287,7 @@ function myConvertToLlm(messages: AgentMessage[]): Message[] {
|
|
|
287
287
|
`convertToLlm` transforms app messages to LLM-compatible format:
|
|
288
288
|
|
|
289
289
|
```typescript
|
|
290
|
-
import { defaultConvertToLlm, convertAttachments } from '@
|
|
290
|
+
import { defaultConvertToLlm, convertAttachments } from '@draht/web-ui';
|
|
291
291
|
|
|
292
292
|
// defaultConvertToLlm handles:
|
|
293
293
|
// - UserMessageWithAttachments → user message with image/text content blocks
|
|
@@ -302,7 +302,7 @@ import { defaultConvertToLlm, convertAttachments } from '@mariozechner/pi-web-ui
|
|
|
302
302
|
Execute JavaScript in a sandboxed browser environment:
|
|
303
303
|
|
|
304
304
|
```typescript
|
|
305
|
-
import { createJavaScriptReplTool } from '@
|
|
305
|
+
import { createJavaScriptReplTool } from '@draht/web-ui';
|
|
306
306
|
|
|
307
307
|
const replTool = createJavaScriptReplTool();
|
|
308
308
|
|
|
@@ -320,7 +320,7 @@ agent.setTools([replTool]);
|
|
|
320
320
|
Extract text from documents at URLs:
|
|
321
321
|
|
|
322
322
|
```typescript
|
|
323
|
-
import { createExtractDocumentTool } from '@
|
|
323
|
+
import { createExtractDocumentTool } from '@draht/web-ui';
|
|
324
324
|
|
|
325
325
|
const extractTool = createExtractDocumentTool();
|
|
326
326
|
extractTool.corsProxyUrl = 'https://corsproxy.io/?';
|
|
@@ -343,7 +343,7 @@ agent.setTools([artifactsPanel.tool]);
|
|
|
343
343
|
### Custom Tool Renderers
|
|
344
344
|
|
|
345
345
|
```typescript
|
|
346
|
-
import { registerToolRenderer, type ToolRenderer } from '@
|
|
346
|
+
import { registerToolRenderer, type ToolRenderer } from '@draht/web-ui';
|
|
347
347
|
|
|
348
348
|
const myRenderer: ToolRenderer = {
|
|
349
349
|
render(params, result, isStreaming) {
|
|
@@ -371,7 +371,7 @@ import {
|
|
|
371
371
|
CustomProvidersStore,
|
|
372
372
|
setAppStorage,
|
|
373
373
|
getAppStorage,
|
|
374
|
-
} from '@
|
|
374
|
+
} from '@draht/web-ui';
|
|
375
375
|
|
|
376
376
|
// Create stores
|
|
377
377
|
const settings = new SettingsStore();
|
|
@@ -466,7 +466,7 @@ const all = await storage.customProviders.getAll();
|
|
|
466
466
|
Load and process files:
|
|
467
467
|
|
|
468
468
|
```typescript
|
|
469
|
-
import { loadAttachment, type Attachment } from '@
|
|
469
|
+
import { loadAttachment, type Attachment } from '@draht/web-ui';
|
|
470
470
|
|
|
471
471
|
// From File input
|
|
472
472
|
const file = inputElement.files[0];
|
|
@@ -498,7 +498,7 @@ Supported formats: PDF, DOCX, XLSX, PPTX, images, text files.
|
|
|
498
498
|
For browser environments with CORS restrictions:
|
|
499
499
|
|
|
500
500
|
```typescript
|
|
501
|
-
import { createStreamFn, shouldUseProxyForProvider, isCorsError } from '@
|
|
501
|
+
import { createStreamFn, shouldUseProxyForProvider, isCorsError } from '@draht/web-ui';
|
|
502
502
|
|
|
503
503
|
// AgentInterface auto-configures proxy from settings
|
|
504
504
|
// For manual setup:
|
|
@@ -517,7 +517,7 @@ agent.streamFn = createStreamFn(async () => {
|
|
|
517
517
|
### SettingsDialog
|
|
518
518
|
|
|
519
519
|
```typescript
|
|
520
|
-
import { SettingsDialog, ProvidersModelsTab, ProxyTab, ApiKeysTab } from '@
|
|
520
|
+
import { SettingsDialog, ProvidersModelsTab, ProxyTab, ApiKeysTab } from '@draht/web-ui';
|
|
521
521
|
|
|
522
522
|
SettingsDialog.open([
|
|
523
523
|
new ProvidersModelsTab(), // Custom providers + model list
|
|
@@ -529,7 +529,7 @@ SettingsDialog.open([
|
|
|
529
529
|
### SessionListDialog
|
|
530
530
|
|
|
531
531
|
```typescript
|
|
532
|
-
import { SessionListDialog } from '@
|
|
532
|
+
import { SessionListDialog } from '@draht/web-ui';
|
|
533
533
|
|
|
534
534
|
SessionListDialog.open(
|
|
535
535
|
async (sessionId) => { /* load session */ },
|
|
@@ -540,7 +540,7 @@ SessionListDialog.open(
|
|
|
540
540
|
### ApiKeyPromptDialog
|
|
541
541
|
|
|
542
542
|
```typescript
|
|
543
|
-
import { ApiKeyPromptDialog } from '@
|
|
543
|
+
import { ApiKeyPromptDialog } from '@draht/web-ui';
|
|
544
544
|
|
|
545
545
|
const success = await ApiKeyPromptDialog.prompt('anthropic');
|
|
546
546
|
```
|
|
@@ -548,7 +548,7 @@ const success = await ApiKeyPromptDialog.prompt('anthropic');
|
|
|
548
548
|
### ModelSelector
|
|
549
549
|
|
|
550
550
|
```typescript
|
|
551
|
-
import { ModelSelector } from '@
|
|
551
|
+
import { ModelSelector } from '@draht/web-ui';
|
|
552
552
|
|
|
553
553
|
ModelSelector.open(currentModel, (selectedModel) => {
|
|
554
554
|
agent.setModel(selectedModel);
|
|
@@ -560,7 +560,7 @@ ModelSelector.open(currentModel, (selectedModel) => {
|
|
|
560
560
|
Import the pre-built CSS:
|
|
561
561
|
|
|
562
562
|
```typescript
|
|
563
|
-
import '@
|
|
563
|
+
import '@draht/web-ui/app.css';
|
|
564
564
|
```
|
|
565
565
|
|
|
566
566
|
Or use Tailwind with custom config:
|
|
@@ -575,7 +575,7 @@ Or use Tailwind with custom config:
|
|
|
575
575
|
## Internationalization
|
|
576
576
|
|
|
577
577
|
```typescript
|
|
578
|
-
import { i18n, setLanguage, translations } from '@
|
|
578
|
+
import { i18n, setLanguage, translations } from '@draht/web-ui';
|
|
579
579
|
|
|
580
580
|
// Add translations
|
|
581
581
|
translations.de = {
|
package/example/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draht/web-ui",
|
|
3
|
-
"version": "2026.3.2-
|
|
3
|
+
"version": "2026.3.2-8",
|
|
4
4
|
"description": "Reusable web UI components for AI chat interfaces powered by @draht/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@lmstudio/sdk": "^1.5.0",
|
|
21
|
-
"@draht/ai": "2026.3.2-
|
|
22
|
-
"@draht/tui": "2026.3.2-
|
|
21
|
+
"@draht/ai": "2026.3.2-8",
|
|
22
|
+
"@draht/tui": "2026.3.2-8",
|
|
23
23
|
"docx-preview": "^0.3.7",
|
|
24
24
|
"jszip": "^3.10.1",
|
|
25
25
|
"lucide": "^0.544.0",
|
|
26
26
|
"ollama": "^0.6.0",
|
|
27
27
|
"pdfjs-dist": "5.4.394",
|
|
28
28
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
|
|
29
|
-
"@draht/agent-core": "2026.3.2-
|
|
29
|
+
"@draht/agent-core": "2026.3.2-8",
|
|
30
30
|
"highlight.js": "^11.11.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|