@oh-my-pi/pi-web-ui 0.1.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.
- package/CHANGELOG.md +149 -0
- package/README.md +609 -0
- package/example/README.md +61 -0
- package/example/index.html +13 -0
- package/example/package.json +25 -0
- package/example/src/app.css +1 -0
- package/example/src/custom-messages.ts +99 -0
- package/example/src/main.ts +420 -0
- package/example/tsconfig.json +23 -0
- package/example/vite.config.ts +6 -0
- package/package.json +58 -0
- package/scripts/count-prompt-tokens.ts +88 -0
- package/src/ChatPanel.ts +218 -0
- package/src/app.css +68 -0
- package/src/components/AgentInterface.ts +390 -0
- package/src/components/AttachmentTile.ts +107 -0
- package/src/components/ConsoleBlock.ts +74 -0
- package/src/components/CustomProviderCard.ts +96 -0
- package/src/components/ExpandableSection.ts +46 -0
- package/src/components/Input.ts +113 -0
- package/src/components/MessageEditor.ts +404 -0
- package/src/components/MessageList.ts +97 -0
- package/src/components/Messages.ts +384 -0
- package/src/components/ProviderKeyInput.ts +152 -0
- package/src/components/SandboxedIframe.ts +626 -0
- package/src/components/StreamingMessageContainer.ts +107 -0
- package/src/components/ThinkingBlock.ts +45 -0
- package/src/components/message-renderer-registry.ts +28 -0
- package/src/components/sandbox/ArtifactsRuntimeProvider.ts +219 -0
- package/src/components/sandbox/AttachmentsRuntimeProvider.ts +66 -0
- package/src/components/sandbox/ConsoleRuntimeProvider.ts +186 -0
- package/src/components/sandbox/FileDownloadRuntimeProvider.ts +110 -0
- package/src/components/sandbox/RuntimeMessageBridge.ts +82 -0
- package/src/components/sandbox/RuntimeMessageRouter.ts +216 -0
- package/src/components/sandbox/SandboxRuntimeProvider.ts +52 -0
- package/src/dialogs/ApiKeyPromptDialog.ts +75 -0
- package/src/dialogs/AttachmentOverlay.ts +640 -0
- package/src/dialogs/CustomProviderDialog.ts +274 -0
- package/src/dialogs/ModelSelector.ts +314 -0
- package/src/dialogs/PersistentStorageDialog.ts +146 -0
- package/src/dialogs/ProvidersModelsTab.ts +212 -0
- package/src/dialogs/SessionListDialog.ts +157 -0
- package/src/dialogs/SettingsDialog.ts +216 -0
- package/src/index.ts +115 -0
- package/src/prompts/prompts.ts +282 -0
- package/src/storage/app-storage.ts +60 -0
- package/src/storage/backends/indexeddb-storage-backend.ts +193 -0
- package/src/storage/store.ts +33 -0
- package/src/storage/stores/custom-providers-store.ts +62 -0
- package/src/storage/stores/provider-keys-store.ts +33 -0
- package/src/storage/stores/sessions-store.ts +136 -0
- package/src/storage/stores/settings-store.ts +34 -0
- package/src/storage/types.ts +206 -0
- package/src/tools/artifacts/ArtifactElement.ts +14 -0
- package/src/tools/artifacts/ArtifactPill.ts +26 -0
- package/src/tools/artifacts/Console.ts +102 -0
- package/src/tools/artifacts/DocxArtifact.ts +213 -0
- package/src/tools/artifacts/ExcelArtifact.ts +231 -0
- package/src/tools/artifacts/GenericArtifact.ts +118 -0
- package/src/tools/artifacts/HtmlArtifact.ts +203 -0
- package/src/tools/artifacts/ImageArtifact.ts +116 -0
- package/src/tools/artifacts/MarkdownArtifact.ts +83 -0
- package/src/tools/artifacts/PdfArtifact.ts +201 -0
- package/src/tools/artifacts/SvgArtifact.ts +82 -0
- package/src/tools/artifacts/TextArtifact.ts +148 -0
- package/src/tools/artifacts/artifacts-tool-renderer.ts +371 -0
- package/src/tools/artifacts/artifacts.ts +713 -0
- package/src/tools/artifacts/index.ts +7 -0
- package/src/tools/extract-document.ts +271 -0
- package/src/tools/index.ts +46 -0
- package/src/tools/javascript-repl.ts +316 -0
- package/src/tools/renderer-registry.ts +127 -0
- package/src/tools/renderers/BashRenderer.ts +52 -0
- package/src/tools/renderers/CalculateRenderer.ts +58 -0
- package/src/tools/renderers/DefaultRenderer.ts +95 -0
- package/src/tools/renderers/GetCurrentTimeRenderer.ts +92 -0
- package/src/tools/types.ts +15 -0
- package/src/utils/attachment-utils.ts +606 -0
- package/src/utils/auth-token.ts +22 -0
- package/src/utils/format.ts +42 -0
- package/src/utils/i18n.ts +653 -0
- package/src/utils/model-discovery.ts +277 -0
- package/src/utils/proxy-utils.ts +134 -0
- package/src/utils/test-sessions.ts +2324 -0
- package/tsconfig.build.json +20 -0
- package/tsconfig.json +7 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
## [0.1.0] - 2026-01-05
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Resize large image attachments before sending (max 1920x1080 if dimension exceeds 2048) and convert >2MB images to JPEG
|
|
10
|
+
|
|
11
|
+
## [3.14.0] - 2026-01-04
|
|
12
|
+
|
|
13
|
+
## [3.13.1337] - 2026-01-04
|
|
14
|
+
|
|
15
|
+
## [3.9.1337] - 2026-01-04
|
|
16
|
+
|
|
17
|
+
## [3.8.1337] - 2026-01-04
|
|
18
|
+
|
|
19
|
+
## [3.7.1337] - 2026-01-04
|
|
20
|
+
|
|
21
|
+
## [3.6.1337] - 2026-01-03
|
|
22
|
+
|
|
23
|
+
## [3.5.1337] - 2026-01-03
|
|
24
|
+
|
|
25
|
+
## [3.4.1337] - 2026-01-03
|
|
26
|
+
|
|
27
|
+
## [3.3.1337] - 2026-01-03
|
|
28
|
+
|
|
29
|
+
## [3.1.1337] - 2026-01-03
|
|
30
|
+
|
|
31
|
+
## [3.0.1337] - 2026-01-03
|
|
32
|
+
|
|
33
|
+
## [2.3.1337] - 2026-01-03
|
|
34
|
+
|
|
35
|
+
## [2.2.1337] - 2026-01-03
|
|
36
|
+
|
|
37
|
+
## [2.1.1337] - 2026-01-03
|
|
38
|
+
|
|
39
|
+
## [2.0.1337] - 2026-01-03
|
|
40
|
+
|
|
41
|
+
## [1.500.0] - 2026-01-03
|
|
42
|
+
|
|
43
|
+
## [1.341.0] - 2026-01-03
|
|
44
|
+
|
|
45
|
+
## [1.338.0] - 2026-01-03
|
|
46
|
+
|
|
47
|
+
## [1.337.1] - 2026-01-02
|
|
48
|
+
|
|
49
|
+
### Changed
|
|
50
|
+
|
|
51
|
+
- Forked to @oh-my-pi scope with unified versioning across all packages
|
|
52
|
+
- Added repository field for npm provenance
|
|
53
|
+
|
|
54
|
+
## [1.337.0] - 2026-01-02
|
|
55
|
+
|
|
56
|
+
Initial release under @oh-my-pi scope. See previous releases at [badlogic/pi-mono](https://github.com/badlogic/pi-mono).
|
|
57
|
+
|
|
58
|
+
## [0.31.1] - 2026-01-02
|
|
59
|
+
|
|
60
|
+
## [0.31.0] - 2026-01-02
|
|
61
|
+
|
|
62
|
+
### Breaking Changes
|
|
63
|
+
|
|
64
|
+
- **Agent class moved to `@oh-my-pi/pi-agent-core`**: The `Agent` class, `AgentState`, and related types are no longer exported from this package. Import them from `@oh-my-pi/pi-agent-core` instead.
|
|
65
|
+
|
|
66
|
+
- **Transport abstraction removed**: `ProviderTransport`, `AppTransport`, `AgentTransport` interface, and related types have been removed. The `Agent` class now uses `streamFn` for custom streaming.
|
|
67
|
+
|
|
68
|
+
- **`AppMessage` renamed to `AgentMessage`**: Now imported from `@oh-my-pi/pi-agent-core`. Custom message types use declaration merging on `CustomAgentMessages` interface.
|
|
69
|
+
|
|
70
|
+
- **`UserMessageWithAttachments` is now a custom message type**: Has `role: "user-with-attachments"` instead of `role: "user"`. Use `isUserMessageWithAttachments()` type guard.
|
|
71
|
+
|
|
72
|
+
- **`CustomMessages` interface removed**: Use declaration merging on `CustomAgentMessages` from `@oh-my-pi/pi-agent-core` instead.
|
|
73
|
+
|
|
74
|
+
- **`agent.appendMessage()` removed**: Use `agent.queueMessage()` instead.
|
|
75
|
+
|
|
76
|
+
- **Agent event types changed**: `AgentInterface` now handles new event types from `@oh-my-pi/pi-agent-core`: `message_start`, `message_end`, `message_update`, `turn_start`, `turn_end`, `agent_start`, `agent_end`.
|
|
77
|
+
|
|
78
|
+
### Added
|
|
79
|
+
|
|
80
|
+
- **`defaultConvertToLlm`**: Default message transformer that handles `UserMessageWithAttachments` and `ArtifactMessage`. Apps can extend this for custom message types.
|
|
81
|
+
|
|
82
|
+
- **`convertAttachments`**: Utility to convert `Attachment[]` to LLM content blocks (images and extracted document text).
|
|
83
|
+
|
|
84
|
+
- **`isUserMessageWithAttachments` / `isArtifactMessage`**: Type guard functions for custom message types.
|
|
85
|
+
|
|
86
|
+
- **`createStreamFn`**: Creates a stream function with CORS proxy support. Reads proxy settings on each call for dynamic configuration.
|
|
87
|
+
|
|
88
|
+
- **Default `streamFn` and `getApiKey`**: `AgentInterface` now sets sensible defaults if not provided:
|
|
89
|
+
|
|
90
|
+
- `streamFn`: Uses `createStreamFn` with proxy settings from storage
|
|
91
|
+
- `getApiKey`: Reads from `providerKeys` storage
|
|
92
|
+
|
|
93
|
+
- **Proxy utilities exported**: `applyProxyIfNeeded`, `shouldUseProxyForProvider`, `isCorsError`, `createStreamFn`
|
|
94
|
+
|
|
95
|
+
### Removed
|
|
96
|
+
|
|
97
|
+
- `Agent` class (moved to `@oh-my-pi/pi-agent-core`)
|
|
98
|
+
- `ProviderTransport` class
|
|
99
|
+
- `AppTransport` class
|
|
100
|
+
- `AgentTransport` interface
|
|
101
|
+
- `AgentRunConfig` type
|
|
102
|
+
- `ProxyAssistantMessageEvent` type
|
|
103
|
+
- `test-sessions.ts` example file
|
|
104
|
+
|
|
105
|
+
### Migration Guide
|
|
106
|
+
|
|
107
|
+
**Before (0.30.x):**
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
import { Agent, ProviderTransport, type AppMessage } from '@oh-my-pi/pi-web-ui';
|
|
111
|
+
|
|
112
|
+
const agent = new Agent({
|
|
113
|
+
transport: new ProviderTransport(),
|
|
114
|
+
messageTransformer: (messages: AppMessage[]) => messages.filter(...)
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**After:**
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
import { Agent, type AgentMessage } from "@oh-my-pi/pi-agent-core";
|
|
122
|
+
import { defaultConvertToLlm } from "@oh-my-pi/pi-web-ui";
|
|
123
|
+
|
|
124
|
+
const agent = new Agent({
|
|
125
|
+
convertToLlm: (messages: AgentMessage[]) => {
|
|
126
|
+
// Extend defaultConvertToLlm for custom types
|
|
127
|
+
return defaultConvertToLlm(messages);
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
// AgentInterface will set streamFn and getApiKey defaults automatically
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Custom message types:**
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
// Before: declaration merging on CustomMessages
|
|
137
|
+
declare module "@oh-my-pi/pi-web-ui" {
|
|
138
|
+
interface CustomMessages {
|
|
139
|
+
"my-message": MyMessage;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// After: declaration merging on CustomAgentMessages
|
|
144
|
+
declare module "@oh-my-pi/pi-agent-core" {
|
|
145
|
+
interface CustomAgentMessages {
|
|
146
|
+
"my-message": MyMessage;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|