@mariozechner/pi-web-ui 0.5.44
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/README.md +252 -0
- package/dist/ChatPanel.d.ts +23 -0
- package/dist/ChatPanel.d.ts.map +1 -0
- package/dist/ChatPanel.js +224 -0
- package/dist/ChatPanel.js.map +1 -0
- package/dist/app.css +2 -0
- package/dist/components/AgentInterface.d.ts +35 -0
- package/dist/components/AgentInterface.d.ts.map +1 -0
- package/dist/components/AgentInterface.js +308 -0
- package/dist/components/AgentInterface.js.map +1 -0
- package/dist/components/AttachmentTile.d.ts +12 -0
- package/dist/components/AttachmentTile.d.ts.map +1 -0
- package/dist/components/AttachmentTile.js +114 -0
- package/dist/components/AttachmentTile.js.map +1 -0
- package/dist/components/ConsoleBlock.d.ts +11 -0
- package/dist/components/ConsoleBlock.d.ts.map +1 -0
- package/dist/components/ConsoleBlock.js +77 -0
- package/dist/components/ConsoleBlock.js.map +1 -0
- package/dist/components/Input.d.ts +26 -0
- package/dist/components/Input.d.ts.map +1 -0
- package/dist/components/Input.js +56 -0
- package/dist/components/Input.js.map +1 -0
- package/dist/components/MessageEditor.d.ts +38 -0
- package/dist/components/MessageEditor.d.ts.map +1 -0
- package/dist/components/MessageEditor.js +296 -0
- package/dist/components/MessageEditor.js.map +1 -0
- package/dist/components/MessageList.d.ts +13 -0
- package/dist/components/MessageList.d.ts.map +1 -0
- package/dist/components/MessageList.js +88 -0
- package/dist/components/MessageList.js.map +1 -0
- package/dist/components/Messages.d.ts +53 -0
- package/dist/components/Messages.d.ts.map +1 -0
- package/dist/components/Messages.js +323 -0
- package/dist/components/Messages.js.map +1 -0
- package/dist/components/ProviderKeyInput.d.ts +16 -0
- package/dist/components/ProviderKeyInput.d.ts.map +1 -0
- package/dist/components/ProviderKeyInput.js +183 -0
- package/dist/components/ProviderKeyInput.js.map +1 -0
- package/dist/components/SandboxedIframe.d.ts +63 -0
- package/dist/components/SandboxedIframe.d.ts.map +1 -0
- package/dist/components/SandboxedIframe.js +435 -0
- package/dist/components/SandboxedIframe.js.map +1 -0
- package/dist/components/StreamingMessageContainer.d.ts +17 -0
- package/dist/components/StreamingMessageContainer.d.ts.map +1 -0
- package/dist/components/StreamingMessageContainer.js +114 -0
- package/dist/components/StreamingMessageContainer.js.map +1 -0
- package/dist/dialogs/ApiKeyPromptDialog.d.ts +15 -0
- package/dist/dialogs/ApiKeyPromptDialog.d.ts.map +1 -0
- package/dist/dialogs/ApiKeyPromptDialog.js +80 -0
- package/dist/dialogs/ApiKeyPromptDialog.js.map +1 -0
- package/dist/dialogs/AttachmentOverlay.d.ts +32 -0
- package/dist/dialogs/AttachmentOverlay.d.ts.map +1 -0
- package/dist/dialogs/AttachmentOverlay.js +575 -0
- package/dist/dialogs/AttachmentOverlay.js.map +1 -0
- package/dist/dialogs/ModelSelector.d.ts +27 -0
- package/dist/dialogs/ModelSelector.d.ts.map +1 -0
- package/dist/dialogs/ModelSelector.js +334 -0
- package/dist/dialogs/ModelSelector.js.map +1 -0
- package/dist/dialogs/SettingsDialog.d.ts +31 -0
- package/dist/dialogs/SettingsDialog.d.ts.map +1 -0
- package/dist/dialogs/SettingsDialog.js +228 -0
- package/dist/dialogs/SettingsDialog.js.map +1 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/state/agent-session.d.ts +58 -0
- package/dist/state/agent-session.d.ts.map +1 -0
- package/dist/state/agent-session.js +252 -0
- package/dist/state/agent-session.js.map +1 -0
- package/dist/state/transports/AppTransport.d.ts +13 -0
- package/dist/state/transports/AppTransport.d.ts.map +1 -0
- package/dist/state/transports/AppTransport.js +316 -0
- package/dist/state/transports/AppTransport.js.map +1 -0
- package/dist/state/transports/ProviderTransport.d.ts +12 -0
- package/dist/state/transports/ProviderTransport.d.ts.map +1 -0
- package/dist/state/transports/ProviderTransport.js +44 -0
- package/dist/state/transports/ProviderTransport.js.map +1 -0
- package/dist/state/transports/index.d.ts +4 -0
- package/dist/state/transports/index.d.ts.map +1 -0
- package/dist/state/transports/index.js +4 -0
- package/dist/state/transports/index.js.map +1 -0
- package/dist/state/transports/proxy-types.d.ts +48 -0
- package/dist/state/transports/proxy-types.d.ts.map +1 -0
- package/dist/state/transports/proxy-types.js +2 -0
- package/dist/state/transports/proxy-types.js.map +1 -0
- package/dist/state/transports/types.d.ts +11 -0
- package/dist/state/transports/types.d.ts.map +1 -0
- package/dist/state/transports/types.js +2 -0
- package/dist/state/transports/types.js.map +1 -0
- package/dist/state/types.d.ts +15 -0
- package/dist/state/types.d.ts.map +1 -0
- package/dist/state/types.js +2 -0
- package/dist/state/types.js.map +1 -0
- package/dist/storage/app-storage.d.ts +26 -0
- package/dist/storage/app-storage.d.ts.map +1 -0
- package/dist/storage/app-storage.js +44 -0
- package/dist/storage/app-storage.js.map +1 -0
- package/dist/storage/backends/chrome-storage-backend.d.ts +18 -0
- package/dist/storage/backends/chrome-storage-backend.d.ts.map +1 -0
- package/dist/storage/backends/chrome-storage-backend.js +67 -0
- package/dist/storage/backends/chrome-storage-backend.js.map +1 -0
- package/dist/storage/backends/indexeddb-backend.d.ts +20 -0
- package/dist/storage/backends/indexeddb-backend.d.ts.map +1 -0
- package/dist/storage/backends/indexeddb-backend.js +89 -0
- package/dist/storage/backends/indexeddb-backend.js.map +1 -0
- package/dist/storage/backends/local-storage-backend.d.ts +18 -0
- package/dist/storage/backends/local-storage-backend.d.ts.map +1 -0
- package/dist/storage/backends/local-storage-backend.js +69 -0
- package/dist/storage/backends/local-storage-backend.js.map +1 -0
- package/dist/storage/repositories/provider-keys-repository.d.ts +34 -0
- package/dist/storage/repositories/provider-keys-repository.d.ts.map +1 -0
- package/dist/storage/repositories/provider-keys-repository.js +50 -0
- package/dist/storage/repositories/provider-keys-repository.js.map +1 -0
- package/dist/storage/repositories/settings-repository.d.ts +34 -0
- package/dist/storage/repositories/settings-repository.d.ts.map +1 -0
- package/dist/storage/repositories/settings-repository.js +46 -0
- package/dist/storage/repositories/settings-repository.js.map +1 -0
- package/dist/storage/types.d.ts +43 -0
- package/dist/storage/types.d.ts.map +1 -0
- package/dist/storage/types.js +2 -0
- package/dist/storage/types.js.map +1 -0
- package/dist/tools/artifacts/ArtifactElement.d.ts +10 -0
- package/dist/tools/artifacts/ArtifactElement.d.ts.map +1 -0
- package/dist/tools/artifacts/ArtifactElement.js +12 -0
- package/dist/tools/artifacts/ArtifactElement.js.map +1 -0
- package/dist/tools/artifacts/HtmlArtifact.d.ts +30 -0
- package/dist/tools/artifacts/HtmlArtifact.d.ts.map +1 -0
- package/dist/tools/artifacts/HtmlArtifact.js +217 -0
- package/dist/tools/artifacts/HtmlArtifact.js.map +1 -0
- package/dist/tools/artifacts/MarkdownArtifact.d.ts +20 -0
- package/dist/tools/artifacts/MarkdownArtifact.d.ts.map +1 -0
- package/dist/tools/artifacts/MarkdownArtifact.js +84 -0
- package/dist/tools/artifacts/MarkdownArtifact.js.map +1 -0
- package/dist/tools/artifacts/SvgArtifact.d.ts +19 -0
- package/dist/tools/artifacts/SvgArtifact.d.ts.map +1 -0
- package/dist/tools/artifacts/SvgArtifact.js +80 -0
- package/dist/tools/artifacts/SvgArtifact.js.map +1 -0
- package/dist/tools/artifacts/TextArtifact.d.ts +20 -0
- package/dist/tools/artifacts/TextArtifact.d.ts.map +1 -0
- package/dist/tools/artifacts/TextArtifact.js +147 -0
- package/dist/tools/artifacts/TextArtifact.js.map +1 -0
- package/dist/tools/artifacts/artifacts.d.ts +67 -0
- package/dist/tools/artifacts/artifacts.d.ts.map +1 -0
- package/dist/tools/artifacts/artifacts.js +836 -0
- package/dist/tools/artifacts/artifacts.js.map +1 -0
- package/dist/tools/artifacts/index.d.ts +7 -0
- package/dist/tools/artifacts/index.d.ts.map +1 -0
- package/dist/tools/artifacts/index.js +7 -0
- package/dist/tools/artifacts/index.js.map +1 -0
- package/dist/tools/index.d.ts +14 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +29 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/javascript-repl.d.ts +43 -0
- package/dist/tools/javascript-repl.d.ts.map +1 -0
- package/dist/tools/javascript-repl.js +252 -0
- package/dist/tools/javascript-repl.js.map +1 -0
- package/dist/tools/renderer-registry.d.ts +11 -0
- package/dist/tools/renderer-registry.d.ts.map +1 -0
- package/dist/tools/renderer-registry.js +15 -0
- package/dist/tools/renderer-registry.js.map +1 -0
- package/dist/tools/renderers/BashRenderer.d.ts +12 -0
- package/dist/tools/renderers/BashRenderer.d.ts.map +1 -0
- package/dist/tools/renderers/BashRenderer.js +35 -0
- package/dist/tools/renderers/BashRenderer.js.map +1 -0
- package/dist/tools/renderers/CalculateRenderer.d.ts +12 -0
- package/dist/tools/renderers/CalculateRenderer.d.ts.map +1 -0
- package/dist/tools/renderers/CalculateRenderer.js +38 -0
- package/dist/tools/renderers/CalculateRenderer.js.map +1 -0
- package/dist/tools/renderers/DefaultRenderer.d.ts +8 -0
- package/dist/tools/renderers/DefaultRenderer.d.ts.map +1 -0
- package/dist/tools/renderers/DefaultRenderer.js +31 -0
- package/dist/tools/renderers/DefaultRenderer.js.map +1 -0
- package/dist/tools/renderers/GetCurrentTimeRenderer.d.ts +12 -0
- package/dist/tools/renderers/GetCurrentTimeRenderer.d.ts.map +1 -0
- package/dist/tools/renderers/GetCurrentTimeRenderer.js +30 -0
- package/dist/tools/renderers/GetCurrentTimeRenderer.js.map +1 -0
- package/dist/tools/types.d.ts +7 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/utils/attachment-utils.d.ts +19 -0
- package/dist/utils/attachment-utils.d.ts.map +1 -0
- package/dist/utils/attachment-utils.js +415 -0
- package/dist/utils/attachment-utils.js.map +1 -0
- package/dist/utils/auth-token.d.ts +3 -0
- package/dist/utils/auth-token.d.ts.map +1 -0
- package/dist/utils/auth-token.js +19 -0
- package/dist/utils/auth-token.js.map +1 -0
- package/dist/utils/format.d.ts +6 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +47 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/i18n.d.ts +111 -0
- package/dist/utils/i18n.d.ts.map +1 -0
- package/dist/utils/i18n.js +224 -0
- package/dist/utils/i18n.js.map +1 -0
- package/dist/utils/test-sessions.d.ts +347 -0
- package/dist/utils/test-sessions.d.ts.map +1 -0
- package/dist/utils/test-sessions.js +2215 -0
- package/dist/utils/test-sessions.js.map +1 -0
- package/example/README.md +61 -0
- package/example/index.html +13 -0
- package/example/package-lock.json +1965 -0
- package/example/package.json +22 -0
- package/example/src/app.css +1 -0
- package/example/src/main.ts +57 -0
- package/example/src/test-sessions.ts +104 -0
- package/example/tsconfig.json +15 -0
- package/example/vite.config.ts +6 -0
- package/package.json +45 -0
- package/src/ChatPanel.ts +214 -0
- package/src/app.css +44 -0
- package/src/components/AgentInterface.ts +316 -0
- package/src/components/AttachmentTile.ts +112 -0
- package/src/components/ConsoleBlock.ts +67 -0
- package/src/components/Input.ts +112 -0
- package/src/components/MessageEditor.ts +272 -0
- package/src/components/MessageList.ts +82 -0
- package/src/components/Messages.ts +310 -0
- package/src/components/ProviderKeyInput.ts +170 -0
- package/src/components/SandboxedIframe.ts +525 -0
- package/src/components/StreamingMessageContainer.ts +101 -0
- package/src/dialogs/ApiKeyPromptDialog.ts +76 -0
- package/src/dialogs/AttachmentOverlay.ts +635 -0
- package/src/dialogs/ModelSelector.ts +324 -0
- package/src/dialogs/SettingsDialog.ts +223 -0
- package/src/index.ts +63 -0
- package/src/state/agent-session.ts +311 -0
- package/src/state/transports/AppTransport.ts +363 -0
- package/src/state/transports/ProviderTransport.ts +49 -0
- package/src/state/transports/index.ts +3 -0
- package/src/state/transports/proxy-types.ts +15 -0
- package/src/state/transports/types.ts +16 -0
- package/src/state/types.ts +11 -0
- package/src/storage/app-storage.ts +53 -0
- package/src/storage/backends/chrome-storage-backend.ts +82 -0
- package/src/storage/backends/indexeddb-backend.ts +107 -0
- package/src/storage/backends/local-storage-backend.ts +74 -0
- package/src/storage/repositories/provider-keys-repository.ts +55 -0
- package/src/storage/repositories/settings-repository.ts +51 -0
- package/src/storage/types.ts +48 -0
- package/src/tools/artifacts/ArtifactElement.ts +15 -0
- package/src/tools/artifacts/HtmlArtifact.ts +221 -0
- package/src/tools/artifacts/MarkdownArtifact.ts +81 -0
- package/src/tools/artifacts/SvgArtifact.ts +77 -0
- package/src/tools/artifacts/TextArtifact.ts +148 -0
- package/src/tools/artifacts/artifacts.ts +888 -0
- package/src/tools/artifacts/index.ts +6 -0
- package/src/tools/index.ts +35 -0
- package/src/tools/javascript-repl.ts +309 -0
- package/src/tools/renderer-registry.ts +18 -0
- package/src/tools/renderers/BashRenderer.ts +45 -0
- package/src/tools/renderers/CalculateRenderer.ts +49 -0
- package/src/tools/renderers/DefaultRenderer.ts +36 -0
- package/src/tools/renderers/GetCurrentTimeRenderer.ts +39 -0
- package/src/tools/types.ts +7 -0
- package/src/utils/attachment-utils.ts +472 -0
- package/src/utils/auth-token.ts +22 -0
- package/src/utils/format.ts +42 -0
- package/src/utils/i18n.ts +343 -0
- package/src/utils/test-sessions.ts +2247 -0
- package/tsconfig.build.json +20 -0
- package/tsconfig.json +7 -0
package/README.md
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# @mariozechner/pi-web-ui
|
|
2
|
+
|
|
3
|
+
Reusable web UI components for building AI chat interfaces powered by [@mariozechner/pi-ai](../ai).
|
|
4
|
+
|
|
5
|
+
Built with [mini-lit](https://github.com/mariozechner/mini-lit) web components and Tailwind CSS v4.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- 🎨 **Modern Chat Interface** - Complete chat UI with message history, streaming responses, and tool execution
|
|
10
|
+
- 🔧 **Tool Support** - Built-in renderers for calculator, bash, time, and custom tools
|
|
11
|
+
- 📎 **Attachments** - PDF, Office documents, images with preview and text extraction
|
|
12
|
+
- 🎭 **Artifacts** - HTML, SVG, Markdown, and text artifact rendering with sandboxed execution
|
|
13
|
+
- 🔌 **Pluggable Transports** - Direct API calls or proxy server support
|
|
14
|
+
- 🌐 **Platform Agnostic** - Works in browser extensions, web apps, VS Code extensions, Electron apps
|
|
15
|
+
- 🎯 **TypeScript** - Full type safety with TypeScript
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @mariozechner/pi-web-ui
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
See the [example](./example) directory for a complete working application.
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { ChatPanel } from '@mariozechner/pi-web-ui';
|
|
29
|
+
import { calculateTool, getCurrentTimeTool } from '@mariozechner/pi-ai';
|
|
30
|
+
import '@mariozechner/pi-web-ui/app.css';
|
|
31
|
+
|
|
32
|
+
// Create a chat panel
|
|
33
|
+
const chatPanel = new ChatPanel();
|
|
34
|
+
chatPanel.systemPrompt = 'You are a helpful assistant.';
|
|
35
|
+
chatPanel.additionalTools = [calculateTool, getCurrentTimeTool];
|
|
36
|
+
|
|
37
|
+
document.body.appendChild(chatPanel);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Run the example:**
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
cd example
|
|
44
|
+
npm install
|
|
45
|
+
npm run dev
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Core Components
|
|
49
|
+
|
|
50
|
+
### ChatPanel
|
|
51
|
+
|
|
52
|
+
The main chat interface component. Manages agent sessions, model selection, and conversation flow.
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { ChatPanel } from '@mariozechner/pi-web-ui';
|
|
56
|
+
|
|
57
|
+
const panel = new ChatPanel({
|
|
58
|
+
initialModel: 'anthropic/claude-sonnet-4-20250514',
|
|
59
|
+
systemPrompt: 'You are a helpful assistant.',
|
|
60
|
+
transportMode: 'direct', // or 'proxy'
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### AgentInterface
|
|
65
|
+
|
|
66
|
+
Lower-level chat interface for custom implementations.
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import { AgentInterface } from '@mariozechner/pi-web-ui';
|
|
70
|
+
|
|
71
|
+
const chat = new AgentInterface();
|
|
72
|
+
chat.session = myAgentSession;
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## State Management
|
|
76
|
+
|
|
77
|
+
### AgentSession
|
|
78
|
+
|
|
79
|
+
Manages conversation state, tool execution, and streaming.
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
import { AgentSession, DirectTransport } from '@mariozechner/pi-web-ui';
|
|
83
|
+
import { getModel, calculateTool, getCurrentTimeTool } from '@mariozechner/pi-ai';
|
|
84
|
+
|
|
85
|
+
const session = new AgentSession({
|
|
86
|
+
initialState: {
|
|
87
|
+
model: getModel('anthropic', 'claude-3-5-haiku-20241022'),
|
|
88
|
+
systemPrompt: 'You are a helpful assistant.',
|
|
89
|
+
tools: [calculateTool, getCurrentTimeTool],
|
|
90
|
+
messages: [],
|
|
91
|
+
},
|
|
92
|
+
transportMode: 'direct',
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Subscribe to state changes
|
|
96
|
+
session.subscribe((state) => {
|
|
97
|
+
console.log('Messages:', state.messages);
|
|
98
|
+
console.log('Streaming:', state.streaming);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// Send a message
|
|
102
|
+
await session.send('What is 25 * 18?');
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Transports
|
|
106
|
+
|
|
107
|
+
Transport layers handle communication with AI providers.
|
|
108
|
+
|
|
109
|
+
#### DirectTransport
|
|
110
|
+
|
|
111
|
+
Calls AI provider APIs directly from the browser using API keys stored locally.
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import { DirectTransport, KeyStore } from '@mariozechner/pi-web-ui';
|
|
115
|
+
|
|
116
|
+
// Set API keys
|
|
117
|
+
const keyStore = new KeyStore();
|
|
118
|
+
await keyStore.setKey('anthropic', 'sk-ant-...');
|
|
119
|
+
await keyStore.setKey('openai', 'sk-...');
|
|
120
|
+
|
|
121
|
+
// Use direct transport (default)
|
|
122
|
+
const session = new AgentSession({
|
|
123
|
+
transportMode: 'direct',
|
|
124
|
+
// ...
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### ProxyTransport
|
|
129
|
+
|
|
130
|
+
Routes requests through a proxy server using auth tokens.
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
import { ProxyTransport, setAuthToken } from '@mariozechner/pi-web-ui';
|
|
134
|
+
|
|
135
|
+
// Set auth token
|
|
136
|
+
setAuthToken('your-auth-token');
|
|
137
|
+
|
|
138
|
+
// Use proxy transport
|
|
139
|
+
const session = new AgentSession({
|
|
140
|
+
transportMode: 'proxy',
|
|
141
|
+
// ...
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Tool Renderers
|
|
146
|
+
|
|
147
|
+
Customize how tool calls and results are displayed.
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
import { registerToolRenderer, type ToolRenderer } from '@mariozechner/pi-web-ui';
|
|
151
|
+
import { html } from '@mariozechner/mini-lit';
|
|
152
|
+
|
|
153
|
+
const myRenderer: ToolRenderer = {
|
|
154
|
+
renderParams(params, isStreaming) {
|
|
155
|
+
return html`<div>Calling tool with: ${JSON.stringify(params)}</div>`;
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
renderResult(params, result) {
|
|
159
|
+
return html`<div>Result: ${result.output}</div>`;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
registerToolRenderer('my_tool', myRenderer);
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Artifacts
|
|
167
|
+
|
|
168
|
+
Render rich content with sandboxed execution.
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
import { artifactTools } from '@mariozechner/pi-web-ui';
|
|
172
|
+
import { getModel } from '@mariozechner/pi-ai';
|
|
173
|
+
|
|
174
|
+
const session = new AgentSession({
|
|
175
|
+
initialState: {
|
|
176
|
+
tools: [...artifactTools],
|
|
177
|
+
// ...
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// AI can now create HTML artifacts, SVG diagrams, etc.
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Styling
|
|
185
|
+
|
|
186
|
+
The package includes pre-built Tailwind CSS with the Claude theme:
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
import '@mariozechner/pi-web-ui/app.css';
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Or customize with your own Tailwind config:
|
|
193
|
+
|
|
194
|
+
```css
|
|
195
|
+
@import '@mariozechner/mini-lit/themes/claude.css';
|
|
196
|
+
@tailwind base;
|
|
197
|
+
@tailwind components;
|
|
198
|
+
@tailwind utilities;
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Platform Integration
|
|
202
|
+
|
|
203
|
+
### Browser Extension
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
import { ChatPanel, KeyStore } from '@mariozechner/pi-web-ui';
|
|
207
|
+
|
|
208
|
+
// Use chrome.storage for persistence
|
|
209
|
+
const keyStore = new KeyStore({
|
|
210
|
+
get: async (key) => {
|
|
211
|
+
const result = await chrome.storage.local.get(key);
|
|
212
|
+
return result[key];
|
|
213
|
+
},
|
|
214
|
+
set: async (key, value) => {
|
|
215
|
+
await chrome.storage.local.set({ [key]: value });
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Web Application
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
import { ChatPanel } from '@mariozechner/pi-web-ui';
|
|
224
|
+
|
|
225
|
+
// Uses localStorage by default
|
|
226
|
+
const panel = new ChatPanel();
|
|
227
|
+
document.querySelector('#app').appendChild(panel);
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### VS Code Extension
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
import { AgentSession, DirectTransport } from '@mariozechner/pi-web-ui';
|
|
234
|
+
|
|
235
|
+
// Custom storage using VS Code's globalState
|
|
236
|
+
const storage = {
|
|
237
|
+
get: async (key) => context.globalState.get(key),
|
|
238
|
+
set: async (key, value) => context.globalState.update(key, value)
|
|
239
|
+
};
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## Examples
|
|
243
|
+
|
|
244
|
+
See the [browser-extension](../browser-extension) package for a complete implementation example.
|
|
245
|
+
|
|
246
|
+
## API Reference
|
|
247
|
+
|
|
248
|
+
See [src/index.ts](src/index.ts) for the full public API.
|
|
249
|
+
|
|
250
|
+
## License
|
|
251
|
+
|
|
252
|
+
MIT
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type AgentTool } from "@mariozechner/pi-ai";
|
|
2
|
+
import { LitElement } from "lit";
|
|
3
|
+
import "./components/AgentInterface.js";
|
|
4
|
+
export declare class ChatPanel extends LitElement {
|
|
5
|
+
private session;
|
|
6
|
+
private artifactsPanel;
|
|
7
|
+
private hasArtifacts;
|
|
8
|
+
private artifactCount;
|
|
9
|
+
private showArtifactsPanel;
|
|
10
|
+
private windowWidth;
|
|
11
|
+
systemPrompt: string;
|
|
12
|
+
additionalTools: AgentTool<any, any>[];
|
|
13
|
+
sandboxUrlProvider?: () => string;
|
|
14
|
+
onApiKeyRequired?: (provider: string) => Promise<boolean>;
|
|
15
|
+
private resizeHandler;
|
|
16
|
+
createRenderRoot(): this;
|
|
17
|
+
connectedCallback(): Promise<void>;
|
|
18
|
+
disconnectedCallback(): void;
|
|
19
|
+
toggleArtifactsPanel(): void;
|
|
20
|
+
get artifactsPanelVisible(): boolean;
|
|
21
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=ChatPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatPanel.d.ts","sourceRoot":"","sources":["../src/ChatPanel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEjC,OAAO,gCAAgC,CAAC;AAUxC,qBACa,SAAU,SAAQ,UAAU;IAC/B,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,cAAc,CAAkB;IACxC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,WAAW,CAAqB;IACrB,YAAY,SAAqC;IAClD,eAAe,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAM;IACvC,kBAAkB,CAAC,EAAE,MAAM,MAAM,CAAC;IAClC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAE1F,OAAO,CAAC,aAAa,CAGnB;IAEF,gBAAgB;IAID,iBAAiB;IAgGvB,oBAAoB;IAMtB,oBAAoB;IAM3B,IAAW,qBAAqB,IAAI,OAAO,CAE1C;IAED,MAAM;CAiEN"}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Badge, html } from "@mariozechner/mini-lit";
|
|
8
|
+
import { getModel } from "@mariozechner/pi-ai";
|
|
9
|
+
import { LitElement } from "lit";
|
|
10
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
11
|
+
import "./components/AgentInterface.js";
|
|
12
|
+
import { AgentSession } from "./state/agent-session.js";
|
|
13
|
+
import { ArtifactsPanel } from "./tools/artifacts/index.js";
|
|
14
|
+
import { createJavaScriptReplTool } from "./tools/javascript-repl.js";
|
|
15
|
+
import { registerToolRenderer } from "./tools/renderer-registry.js";
|
|
16
|
+
import { getAuthToken } from "./utils/auth-token.js";
|
|
17
|
+
import { i18n } from "./utils/i18n.js";
|
|
18
|
+
const BREAKPOINT = 800; // px - switch between overlay and side-by-side
|
|
19
|
+
let ChatPanel = class ChatPanel extends LitElement {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.hasArtifacts = false;
|
|
23
|
+
this.artifactCount = 0;
|
|
24
|
+
this.showArtifactsPanel = false;
|
|
25
|
+
this.windowWidth = window.innerWidth;
|
|
26
|
+
this.systemPrompt = "You are a helpful AI assistant.";
|
|
27
|
+
this.additionalTools = [];
|
|
28
|
+
this.resizeHandler = () => {
|
|
29
|
+
this.windowWidth = window.innerWidth;
|
|
30
|
+
this.requestUpdate();
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
createRenderRoot() {
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
async connectedCallback() {
|
|
37
|
+
super.connectedCallback();
|
|
38
|
+
// Listen to window resize
|
|
39
|
+
window.addEventListener("resize", this.resizeHandler);
|
|
40
|
+
// Ensure panel fills height and allows flex layout
|
|
41
|
+
this.style.display = "flex";
|
|
42
|
+
this.style.flexDirection = "column";
|
|
43
|
+
this.style.height = "100%";
|
|
44
|
+
this.style.minHeight = "0";
|
|
45
|
+
// Create JavaScript REPL tool with attachments provider
|
|
46
|
+
const javascriptReplTool = createJavaScriptReplTool();
|
|
47
|
+
if (this.sandboxUrlProvider) {
|
|
48
|
+
javascriptReplTool.sandboxUrlProvider = this.sandboxUrlProvider;
|
|
49
|
+
}
|
|
50
|
+
// Set up artifacts panel
|
|
51
|
+
this.artifactsPanel = new ArtifactsPanel();
|
|
52
|
+
if (this.sandboxUrlProvider) {
|
|
53
|
+
this.artifactsPanel.sandboxUrlProvider = this.sandboxUrlProvider;
|
|
54
|
+
}
|
|
55
|
+
registerToolRenderer("artifacts", this.artifactsPanel);
|
|
56
|
+
// Attachments provider for both REPL and artifacts
|
|
57
|
+
const getAttachments = () => {
|
|
58
|
+
// Get all attachments from conversation messages
|
|
59
|
+
const attachments = [];
|
|
60
|
+
for (const message of this.session.state.messages) {
|
|
61
|
+
if (message.role === "user") {
|
|
62
|
+
const content = Array.isArray(message.content) ? message.content : [message.content];
|
|
63
|
+
for (const block of content) {
|
|
64
|
+
if (typeof block !== "string" && block.type === "image") {
|
|
65
|
+
attachments.push({
|
|
66
|
+
id: `image-${attachments.length}`,
|
|
67
|
+
fileName: "image.png",
|
|
68
|
+
mimeType: block.mimeType || "image/png",
|
|
69
|
+
size: 0,
|
|
70
|
+
content: block.data,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return attachments;
|
|
77
|
+
};
|
|
78
|
+
javascriptReplTool.attachmentsProvider = getAttachments;
|
|
79
|
+
this.artifactsPanel.attachmentsProvider = getAttachments;
|
|
80
|
+
this.artifactsPanel.onArtifactsChange = () => {
|
|
81
|
+
const count = this.artifactsPanel.artifacts?.size ?? 0;
|
|
82
|
+
const created = count > this.artifactCount;
|
|
83
|
+
this.hasArtifacts = count > 0;
|
|
84
|
+
this.artifactCount = count;
|
|
85
|
+
// Auto-open when new artifacts are created
|
|
86
|
+
if (this.hasArtifacts && created) {
|
|
87
|
+
this.showArtifactsPanel = true;
|
|
88
|
+
}
|
|
89
|
+
this.requestUpdate();
|
|
90
|
+
};
|
|
91
|
+
this.artifactsPanel.onClose = () => {
|
|
92
|
+
this.showArtifactsPanel = false;
|
|
93
|
+
this.requestUpdate();
|
|
94
|
+
};
|
|
95
|
+
this.artifactsPanel.onOpen = () => {
|
|
96
|
+
this.showArtifactsPanel = true;
|
|
97
|
+
this.requestUpdate();
|
|
98
|
+
};
|
|
99
|
+
const initialState = {
|
|
100
|
+
systemPrompt: this.systemPrompt,
|
|
101
|
+
model: getModel("anthropic", "claude-sonnet-4-5-20250929"),
|
|
102
|
+
tools: [...this.additionalTools, javascriptReplTool, this.artifactsPanel.tool],
|
|
103
|
+
thinkingLevel: "off",
|
|
104
|
+
messages: [],
|
|
105
|
+
};
|
|
106
|
+
// initialState = { ...initialState, ...(simpleHtml as any) };
|
|
107
|
+
// initialState = { ...initialState, ...(longSession as any) };
|
|
108
|
+
// Create agent session first so attachments provider works
|
|
109
|
+
this.session = new AgentSession({
|
|
110
|
+
initialState,
|
|
111
|
+
authTokenProvider: async () => getAuthToken(),
|
|
112
|
+
transportMode: "provider", // Use provider mode by default (API keys from storage, optional CORS proxy)
|
|
113
|
+
});
|
|
114
|
+
// Reconstruct artifacts panel from initial messages (session must exist first)
|
|
115
|
+
await this.artifactsPanel.reconstructFromMessages(initialState.messages);
|
|
116
|
+
this.hasArtifacts = this.artifactsPanel.artifacts.size > 0;
|
|
117
|
+
}
|
|
118
|
+
disconnectedCallback() {
|
|
119
|
+
super.disconnectedCallback();
|
|
120
|
+
window.removeEventListener("resize", this.resizeHandler);
|
|
121
|
+
}
|
|
122
|
+
// Expose method to toggle artifacts panel
|
|
123
|
+
toggleArtifactsPanel() {
|
|
124
|
+
this.showArtifactsPanel = !this.showArtifactsPanel;
|
|
125
|
+
this.requestUpdate();
|
|
126
|
+
}
|
|
127
|
+
// Check if artifacts panel is currently visible
|
|
128
|
+
get artifactsPanelVisible() {
|
|
129
|
+
return this.showArtifactsPanel;
|
|
130
|
+
}
|
|
131
|
+
render() {
|
|
132
|
+
if (!this.session) {
|
|
133
|
+
return html `<div class="flex items-center justify-center h-full">
|
|
134
|
+
<div class="text-muted-foreground">Loading...</div>
|
|
135
|
+
</div>`;
|
|
136
|
+
}
|
|
137
|
+
const isMobile = this.windowWidth < BREAKPOINT;
|
|
138
|
+
// Set panel props
|
|
139
|
+
if (this.artifactsPanel) {
|
|
140
|
+
this.artifactsPanel.collapsed = !this.showArtifactsPanel;
|
|
141
|
+
this.artifactsPanel.overlay = isMobile;
|
|
142
|
+
}
|
|
143
|
+
return html `
|
|
144
|
+
<div class="relative w-full h-full overflow-hidden flex">
|
|
145
|
+
<div class="h-full" style="${!isMobile && this.showArtifactsPanel && this.hasArtifacts ? "width: 50%;" : "width: 100%;"}">
|
|
146
|
+
<agent-interface
|
|
147
|
+
.session=${this.session}
|
|
148
|
+
.enableAttachments=${true}
|
|
149
|
+
.enableModelSelector=${true}
|
|
150
|
+
.enableThinking=${true}
|
|
151
|
+
.showThemeToggle=${false}
|
|
152
|
+
.showDebugToggle=${false}
|
|
153
|
+
.onApiKeyRequired=${this.onApiKeyRequired}
|
|
154
|
+
></agent-interface>
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
<!-- Floating pill when artifacts exist and panel is collapsed -->
|
|
158
|
+
${this.hasArtifacts && !this.showArtifactsPanel
|
|
159
|
+
? html `
|
|
160
|
+
<button
|
|
161
|
+
class="absolute z-30 top-4 left-1/2 -translate-x-1/2 pointer-events-auto"
|
|
162
|
+
@click=${() => {
|
|
163
|
+
this.showArtifactsPanel = true;
|
|
164
|
+
this.requestUpdate();
|
|
165
|
+
}}
|
|
166
|
+
title=${i18n("Show artifacts")}
|
|
167
|
+
>
|
|
168
|
+
${Badge(html `
|
|
169
|
+
<span class="inline-flex items-center gap-1">
|
|
170
|
+
<span>${i18n("Artifacts")}</span>
|
|
171
|
+
${this.artifactCount > 1
|
|
172
|
+
? html `<span
|
|
173
|
+
class="text-[10px] leading-none bg-primary-foreground/20 text-primary-foreground rounded px-1 font-mono tabular-nums"
|
|
174
|
+
>${this.artifactCount}</span
|
|
175
|
+
>`
|
|
176
|
+
: ""}
|
|
177
|
+
</span>
|
|
178
|
+
`)}
|
|
179
|
+
</button>
|
|
180
|
+
`
|
|
181
|
+
: ""}
|
|
182
|
+
|
|
183
|
+
<div class="h-full ${isMobile ? "absolute inset-0 pointer-events-none" : ""}" style="${!isMobile ? (!this.hasArtifacts || !this.showArtifactsPanel ? "display: none;" : "width: 50%;") : ""}">
|
|
184
|
+
${this.artifactsPanel}
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
`;
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
__decorate([
|
|
191
|
+
state()
|
|
192
|
+
], ChatPanel.prototype, "session", void 0);
|
|
193
|
+
__decorate([
|
|
194
|
+
state()
|
|
195
|
+
], ChatPanel.prototype, "artifactsPanel", void 0);
|
|
196
|
+
__decorate([
|
|
197
|
+
state()
|
|
198
|
+
], ChatPanel.prototype, "hasArtifacts", void 0);
|
|
199
|
+
__decorate([
|
|
200
|
+
state()
|
|
201
|
+
], ChatPanel.prototype, "artifactCount", void 0);
|
|
202
|
+
__decorate([
|
|
203
|
+
state()
|
|
204
|
+
], ChatPanel.prototype, "showArtifactsPanel", void 0);
|
|
205
|
+
__decorate([
|
|
206
|
+
state()
|
|
207
|
+
], ChatPanel.prototype, "windowWidth", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
property({ type: String })
|
|
210
|
+
], ChatPanel.prototype, "systemPrompt", void 0);
|
|
211
|
+
__decorate([
|
|
212
|
+
property({ type: Array })
|
|
213
|
+
], ChatPanel.prototype, "additionalTools", void 0);
|
|
214
|
+
__decorate([
|
|
215
|
+
property({ attribute: false })
|
|
216
|
+
], ChatPanel.prototype, "sandboxUrlProvider", void 0);
|
|
217
|
+
__decorate([
|
|
218
|
+
property({ attribute: false })
|
|
219
|
+
], ChatPanel.prototype, "onApiKeyRequired", void 0);
|
|
220
|
+
ChatPanel = __decorate([
|
|
221
|
+
customElement("pi-chat-panel")
|
|
222
|
+
], ChatPanel);
|
|
223
|
+
export { ChatPanel };
|
|
224
|
+
//# sourceMappingURL=ChatPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatPanel.js","sourceRoot":"","sources":["../src/ChatPanel.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAkB,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAAE,YAAY,EAA8C,MAAM,0BAA0B,CAAC;AACpG,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,MAAM,UAAU,GAAG,GAAG,CAAC,CAAC,+CAA+C;AAGhE,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAAlC;;QAGW,iBAAY,GAAG,KAAK,CAAC;QACrB,kBAAa,GAAG,CAAC,CAAC;QAClB,uBAAkB,GAAG,KAAK,CAAC;QAC3B,gBAAW,GAAG,MAAM,CAAC,UAAU,CAAC;QACrB,iBAAY,GAAG,iCAAiC,CAAC;QAClD,oBAAe,GAA0B,EAAE,CAAC;QAI/D,kBAAa,GAAG,GAAG,EAAE;YAC5B,IAAI,CAAC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