@draht/web-ui 2026.5.12 → 2026.7.7
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 +14 -0
- package/dist/ChatPanel.js.map +1 -1
- package/dist/components/AgentInterface.js +1 -1
- package/dist/components/AgentInterface.js.map +1 -1
- package/dist/components/MessageEditor.d.ts +1 -1
- package/dist/components/MessageEditor.d.ts.map +1 -1
- package/dist/components/MessageEditor.js +3 -0
- package/dist/components/MessageEditor.js.map +1 -1
- package/dist/components/MessageList.d.ts.map +1 -1
- package/dist/components/MessageList.js.map +1 -1
- package/dist/components/Messages.d.ts +2 -2
- package/dist/components/Messages.d.ts.map +1 -1
- package/dist/components/ProviderKeyInput.js +1 -1
- package/dist/components/ProviderKeyInput.js.map +1 -1
- package/dist/components/StreamingMessageContainer.d.ts +1 -1
- package/dist/components/StreamingMessageContainer.d.ts.map +1 -1
- package/dist/dialogs/ModelSelector.d.ts +1 -1
- package/dist/dialogs/ModelSelector.d.ts.map +1 -1
- package/dist/dialogs/ModelSelector.js +4 -1
- package/dist/dialogs/ModelSelector.js.map +1 -1
- package/dist/dialogs/ProvidersModelsTab.js +1 -1
- package/dist/dialogs/ProvidersModelsTab.js.map +1 -1
- package/dist/dialogs/SettingsDialog.js +1 -1
- package/dist/dialogs/SettingsDialog.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/storage/stores/custom-providers-store.d.ts +1 -1
- package/dist/storage/stores/custom-providers-store.d.ts.map +1 -1
- package/dist/storage/types.d.ts +1 -1
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/tools/artifacts/SvgArtifact.d.ts +5 -0
- package/dist/tools/artifacts/SvgArtifact.d.ts.map +1 -1
- package/dist/tools/artifacts/SvgArtifact.js +39 -2
- package/dist/tools/artifacts/SvgArtifact.js.map +1 -1
- package/dist/tools/artifacts/artifacts-tool-renderer.d.ts +1 -1
- package/dist/tools/artifacts/artifacts-tool-renderer.d.ts.map +1 -1
- package/dist/tools/artifacts/artifacts.d.ts +7 -7
- package/dist/tools/artifacts/artifacts.d.ts.map +1 -1
- package/dist/tools/artifacts/artifacts.js +2 -2
- package/dist/tools/artifacts/artifacts.js.map +1 -1
- package/dist/tools/extract-document.d.ts +5 -5
- package/dist/tools/extract-document.d.ts.map +1 -1
- package/dist/tools/extract-document.js +1 -1
- package/dist/tools/extract-document.js.map +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/javascript-repl.d.ts +7 -7
- package/dist/tools/javascript-repl.d.ts.map +1 -1
- package/dist/tools/javascript-repl.js +1 -1
- package/dist/tools/javascript-repl.js.map +1 -1
- package/dist/tools/renderers/BashRenderer.d.ts +1 -1
- package/dist/tools/renderers/BashRenderer.d.ts.map +1 -1
- package/dist/tools/renderers/CalculateRenderer.d.ts +1 -1
- package/dist/tools/renderers/CalculateRenderer.d.ts.map +1 -1
- package/dist/tools/renderers/DefaultRenderer.d.ts +1 -1
- package/dist/tools/renderers/DefaultRenderer.d.ts.map +1 -1
- package/dist/tools/renderers/GetCurrentTimeRenderer.d.ts +1 -1
- package/dist/tools/renderers/GetCurrentTimeRenderer.d.ts.map +1 -1
- package/dist/tools/types.d.ts +1 -1
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils/format.d.ts +1 -1
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/model-discovery.d.ts +1 -1
- package/dist/utils/model-discovery.d.ts.map +1 -1
- package/dist/utils/proxy-utils.d.ts +1 -1
- package/dist/utils/proxy-utils.d.ts.map +1 -1
- package/dist/utils/proxy-utils.js +1 -1
- package/dist/utils/proxy-utils.js.map +1 -1
- package/example/src/custom-messages.ts +2 -2
- package/example/src/main.ts +8 -8
- package/package.json +5 -4
- package/src/ChatPanel.ts +1 -1
- package/src/components/AgentInterface.ts +1 -1
- package/src/components/MessageEditor.ts +4 -1
- package/src/components/MessageList.ts +4 -1
- package/src/components/Messages.ts +2 -2
- package/src/components/ProviderKeyInput.ts +1 -1
- package/src/components/StreamingMessageContainer.ts +1 -1
- package/src/dialogs/CustomProviderDialog.ts +1 -1
- package/src/dialogs/ModelSelector.ts +4 -1
- package/src/dialogs/ProvidersModelsTab.ts +1 -1
- package/src/dialogs/SettingsDialog.ts +1 -1
- package/src/index.ts +1 -1
- package/src/storage/stores/custom-providers-store.ts +1 -1
- package/src/storage/types.ts +1 -1
- package/src/tools/artifacts/SvgArtifact.ts +43 -2
- package/src/tools/artifacts/artifacts-tool-renderer.ts +1 -1
- package/src/tools/artifacts/artifacts.ts +2 -2
- package/src/tools/extract-document.ts +2 -2
- package/src/tools/index.ts +1 -1
- package/src/tools/javascript-repl.ts +4 -4
- package/src/tools/renderers/BashRenderer.ts +1 -1
- package/src/tools/renderers/CalculateRenderer.ts +1 -1
- package/src/tools/renderers/DefaultRenderer.ts +1 -1
- package/src/tools/renderers/GetCurrentTimeRenderer.ts +1 -1
- package/src/tools/types.ts +1 -1
- package/src/utils/format.ts +1 -1
- package/src/utils/model-discovery.ts +1 -1
- package/src/utils/proxy-utils.ts +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Message } from "@draht/ai";
|
|
1
|
+
import type { Message } from "@draht/ai/compat";
|
|
2
2
|
import type { AgentMessage, MessageRenderer } from "@draht/web-ui";
|
|
3
3
|
import { defaultConvertToLlm, registerMessageRenderer } from "@draht/web-ui";
|
|
4
4
|
import { Alert } from "@mariozechner/mini-lit/dist/Alert.js";
|
|
@@ -17,7 +17,7 @@ export interface SystemNotificationMessage {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
// Extend CustomAgentMessages interface via declaration merging
|
|
20
|
-
// This must target
|
|
20
|
+
// This must target pi-agent-core where CustomAgentMessages is defined
|
|
21
21
|
declare module "@draht/agent-core" {
|
|
22
22
|
interface CustomAgentMessages {
|
|
23
23
|
"system-notification": SystemNotificationMessage;
|
package/example/src/main.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "@mariozechner/mini-lit/dist/ThemeToggle.js";
|
|
2
2
|
import { Agent, type AgentMessage } from "@draht/agent-core";
|
|
3
|
-
import { getModel } from "@draht/ai";
|
|
3
|
+
import { getModel, type TextContent } from "@draht/ai/compat";
|
|
4
4
|
import {
|
|
5
5
|
type AgentState,
|
|
6
6
|
ApiKeyPromptDialog,
|
|
@@ -47,7 +47,7 @@ const configs = [
|
|
|
47
47
|
|
|
48
48
|
// Create backend
|
|
49
49
|
const backend = new IndexedDBStorageBackend({
|
|
50
|
-
dbName: "
|
|
50
|
+
dbName: "pi-web-ui-example",
|
|
51
51
|
version: 2, // Incremented for custom-providers store
|
|
52
52
|
stores: configs,
|
|
53
53
|
});
|
|
@@ -70,8 +70,8 @@ let chatPanel: ChatPanel;
|
|
|
70
70
|
let agentUnsubscribe: (() => void) | undefined;
|
|
71
71
|
|
|
72
72
|
const generateTitle = (messages: AgentMessage[]): string => {
|
|
73
|
-
const firstUserMsg = messages.find((m) => m.role === "user"
|
|
74
|
-
if (!firstUserMsg
|
|
73
|
+
const firstUserMsg = messages.find((m) => m.role === "user");
|
|
74
|
+
if (!firstUserMsg) return "";
|
|
75
75
|
|
|
76
76
|
let text = "";
|
|
77
77
|
const content = firstUserMsg.content;
|
|
@@ -79,8 +79,8 @@ const generateTitle = (messages: AgentMessage[]): string => {
|
|
|
79
79
|
if (typeof content === "string") {
|
|
80
80
|
text = content;
|
|
81
81
|
} else {
|
|
82
|
-
const textBlocks = content.filter((c:
|
|
83
|
-
text = textBlocks.map((c
|
|
82
|
+
const textBlocks = content.filter((c): c is TextContent => c.type === "text");
|
|
83
|
+
text = textBlocks.map((c) => c.text || "").join(" ");
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
text = text.trim();
|
|
@@ -94,8 +94,8 @@ const generateTitle = (messages: AgentMessage[]): string => {
|
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
const shouldSaveSession = (messages: AgentMessage[]): boolean => {
|
|
97
|
-
const hasUserMsg = messages.some((m
|
|
98
|
-
const hasAssistantMsg = messages.some((m
|
|
97
|
+
const hasUserMsg = messages.some((m) => m.role === "user");
|
|
98
|
+
const hasAssistantMsg = messages.some((m) => m.role === "assistant");
|
|
99
99
|
return hasUserMsg && hasAssistantMsg;
|
|
100
100
|
};
|
|
101
101
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draht/web-ui",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.7.7",
|
|
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",
|
|
@@ -19,9 +19,10 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@lmstudio/sdk": "^1.5.0",
|
|
21
21
|
"@sinclair/typebox": "^0.34.41",
|
|
22
|
-
"
|
|
23
|
-
"@draht/
|
|
24
|
-
"@draht/
|
|
22
|
+
"typebox": "^1.1.24",
|
|
23
|
+
"@draht/agent-core": "2026.7.7",
|
|
24
|
+
"@draht/ai": "2026.7.7",
|
|
25
|
+
"@draht/tui": "2026.7.7",
|
|
25
26
|
"highlight.js": "^11.11.1",
|
|
26
27
|
"docx-preview": "^0.3.7",
|
|
27
28
|
"jszip": "^3.10.1",
|
package/src/ChatPanel.ts
CHANGED
|
@@ -97,7 +97,7 @@ export class ChatPanel extends LitElement {
|
|
|
97
97
|
const attachments: Attachment[] = [];
|
|
98
98
|
for (const message of this.agent!.state.messages) {
|
|
99
99
|
if (message.role === "user-with-attachments") {
|
|
100
|
-
message.attachments?.forEach((a
|
|
100
|
+
message.attachments?.forEach((a) => {
|
|
101
101
|
attachments.push(a);
|
|
102
102
|
});
|
|
103
103
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { streamSimple, type ToolResultMessage, type Usage } from "@draht/ai";
|
|
1
|
+
import { streamSimple, type ToolResultMessage, type Usage } from "@draht/ai/compat";
|
|
2
2
|
import { html, LitElement } from "lit";
|
|
3
3
|
import { customElement, property, query } from "lit/decorators.js";
|
|
4
4
|
import { ModelSelector } from "../dialogs/ModelSelector.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Model } from "@draht/ai";
|
|
1
|
+
import type { Model } from "@draht/ai/compat";
|
|
2
2
|
import { icon } from "@mariozechner/mini-lit";
|
|
3
3
|
import { Button } from "@mariozechner/mini-lit/dist/Button.js";
|
|
4
4
|
import { Select, type SelectOption } from "@mariozechner/mini-lit/dist/Select.js";
|
|
@@ -60,6 +60,9 @@ export class MessageEditor extends LitElement {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
private handleKeyDown = (e: KeyboardEvent) => {
|
|
63
|
+
// Ignore key events during IME composition (e.g. CJK input)
|
|
64
|
+
if (e.isComposing || e.key === "Process") return;
|
|
65
|
+
|
|
63
66
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
64
67
|
e.preventDefault();
|
|
65
68
|
if (!this.isStreaming && !this.processingFiles && (this.value.trim() || this.attachments.length > 0)) {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { AgentMessage, AgentTool } from "@draht/agent-core";
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
AssistantMessage as AssistantMessageType,
|
|
4
|
+
ToolResultMessage as ToolResultMessageType,
|
|
5
|
+
} from "@draht/ai/compat";
|
|
3
6
|
import { html, LitElement, type TemplateResult } from "lit";
|
|
4
7
|
import { property } from "lit/decorators.js";
|
|
5
8
|
import { repeat } from "lit/directives/repeat.js";
|
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
ToolCall,
|
|
6
6
|
ToolResultMessage as ToolResultMessageType,
|
|
7
7
|
UserMessage as UserMessageType,
|
|
8
|
-
} from "@draht/ai";
|
|
8
|
+
} from "@draht/ai/compat";
|
|
9
9
|
import { html, LitElement, type TemplateResult } from "lit";
|
|
10
10
|
import { customElement, property } from "lit/decorators.js";
|
|
11
11
|
import { renderTool } from "../tools/index.js";
|
|
@@ -297,7 +297,7 @@ export class AbortedMessage extends LitElement {
|
|
|
297
297
|
// ============================================================================
|
|
298
298
|
|
|
299
299
|
import type { AgentMessage } from "@draht/agent-core";
|
|
300
|
-
import type { Message } from "@draht/ai";
|
|
300
|
+
import type { Message } from "@draht/ai/compat";
|
|
301
301
|
|
|
302
302
|
/**
|
|
303
303
|
* Convert attachments to content blocks for LLM.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Context, complete, getModel } from "@draht/ai";
|
|
1
|
+
import { type Context, complete, getModel } from "@draht/ai/compat";
|
|
2
2
|
import { i18n } from "@mariozechner/mini-lit";
|
|
3
3
|
import { Badge } from "@mariozechner/mini-lit/dist/Badge.js";
|
|
4
4
|
import { Button } from "@mariozechner/mini-lit/dist/Button.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentMessage, AgentTool } from "@draht/agent-core";
|
|
2
|
-
import type { ToolResultMessage } from "@draht/ai";
|
|
2
|
+
import type { ToolResultMessage } from "@draht/ai/compat";
|
|
3
3
|
import { html, LitElement } from "lit";
|
|
4
4
|
import { property, state } from "lit/decorators.js";
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Model } from "@draht/ai";
|
|
1
|
+
import type { Model } from "@draht/ai/compat";
|
|
2
2
|
import { i18n } from "@mariozechner/mini-lit";
|
|
3
3
|
import { Button } from "@mariozechner/mini-lit/dist/Button.js";
|
|
4
4
|
import { DialogBase } from "@mariozechner/mini-lit/dist/DialogBase.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getModels, getProviders, type Model, modelsAreEqual } from "@draht/ai";
|
|
1
|
+
import { getModels, getProviders, type Model, modelsAreEqual } from "@draht/ai/compat";
|
|
2
2
|
import { icon } from "@mariozechner/mini-lit";
|
|
3
3
|
import { Badge } from "@mariozechner/mini-lit/dist/Badge.js";
|
|
4
4
|
import { Button } from "@mariozechner/mini-lit/dist/Button.js";
|
|
@@ -113,6 +113,9 @@ export class ModelSelector extends DialogBase {
|
|
|
113
113
|
|
|
114
114
|
// Add global keyboard handler for the dialog
|
|
115
115
|
this.addEventListener("keydown", (e: KeyboardEvent) => {
|
|
116
|
+
// Ignore key events during IME composition (e.g. CJK input)
|
|
117
|
+
if (e.isComposing || e.key === "Process") return;
|
|
118
|
+
|
|
116
119
|
// Get filtered models to know the bounds
|
|
117
120
|
const filteredModels = this.getFilteredModels();
|
|
118
121
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getProviders } from "@draht/ai";
|
|
1
|
+
import { getProviders } from "@draht/ai/compat";
|
|
2
2
|
import { i18n } from "@mariozechner/mini-lit";
|
|
3
3
|
import { Dialog, DialogContent, DialogHeader } from "@mariozechner/mini-lit/dist/Dialog.js";
|
|
4
4
|
import { Input } from "@mariozechner/mini-lit/dist/Input.js";
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Main chat interface
|
|
2
2
|
|
|
3
3
|
export type { Agent, AgentMessage, AgentState, ThinkingLevel } from "@draht/agent-core";
|
|
4
|
-
export type { Model } from "@draht/ai";
|
|
4
|
+
export type { Model } from "@draht/ai/compat";
|
|
5
5
|
export { ChatPanel } from "./ChatPanel.js";
|
|
6
6
|
// Components
|
|
7
7
|
export { AgentInterface } from "./components/AgentInterface.js";
|
package/src/storage/types.ts
CHANGED
|
@@ -13,11 +13,17 @@ export class SvgArtifact extends ArtifactElement {
|
|
|
13
13
|
@property() override filename = "";
|
|
14
14
|
|
|
15
15
|
private _content = "";
|
|
16
|
+
@state() private previewUrl = "";
|
|
17
|
+
|
|
16
18
|
override get content(): string {
|
|
17
19
|
return this._content;
|
|
18
20
|
}
|
|
19
21
|
override set content(value: string) {
|
|
22
|
+
if (this._content === value) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
20
25
|
this._content = value;
|
|
26
|
+
this.updatePreviewUrl();
|
|
21
27
|
this.requestUpdate();
|
|
22
28
|
}
|
|
23
29
|
|
|
@@ -31,6 +37,21 @@ export class SvgArtifact extends ArtifactElement {
|
|
|
31
37
|
this.viewMode = mode;
|
|
32
38
|
}
|
|
33
39
|
|
|
40
|
+
private revokePreviewUrl() {
|
|
41
|
+
if (this.previewUrl) {
|
|
42
|
+
URL.revokeObjectURL(this.previewUrl);
|
|
43
|
+
this.previewUrl = "";
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private updatePreviewUrl() {
|
|
48
|
+
this.revokePreviewUrl();
|
|
49
|
+
if (!this._content) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
this.previewUrl = URL.createObjectURL(new Blob([this._content], { type: "image/svg+xml" }));
|
|
53
|
+
}
|
|
54
|
+
|
|
34
55
|
public getHeaderButtons() {
|
|
35
56
|
const toggle = new PreviewCodeToggle();
|
|
36
57
|
toggle.mode = this.viewMode;
|
|
@@ -52,14 +73,34 @@ export class SvgArtifact extends ArtifactElement {
|
|
|
52
73
|
`;
|
|
53
74
|
}
|
|
54
75
|
|
|
76
|
+
override connectedCallback() {
|
|
77
|
+
super.connectedCallback();
|
|
78
|
+
if (this._content && !this.previewUrl) {
|
|
79
|
+
this.updatePreviewUrl();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
override disconnectedCallback() {
|
|
84
|
+
super.disconnectedCallback();
|
|
85
|
+
this.revokePreviewUrl();
|
|
86
|
+
}
|
|
87
|
+
|
|
55
88
|
override render() {
|
|
56
89
|
return html`
|
|
57
90
|
<div class="h-full flex flex-col">
|
|
58
91
|
<div class="flex-1 overflow-auto">
|
|
59
92
|
${
|
|
60
93
|
this.viewMode === "preview"
|
|
61
|
-
? html`<div class="h-full flex items-center justify-center">
|
|
62
|
-
${
|
|
94
|
+
? html`<div class="h-full flex items-center justify-center p-4">
|
|
95
|
+
${
|
|
96
|
+
this.previewUrl
|
|
97
|
+
? html`<img
|
|
98
|
+
class="max-w-full max-h-full w-full h-full object-contain"
|
|
99
|
+
src="${this.previewUrl}"
|
|
100
|
+
alt="${this.filename}"
|
|
101
|
+
/>`
|
|
102
|
+
: ""
|
|
103
|
+
}
|
|
63
104
|
</div>`
|
|
64
105
|
: html`<pre class="m-0 p-4 text-xs"><code class="hljs language-xml">${unsafeHTML(
|
|
65
106
|
hljs.highlight(this.content, { language: "xml", ignoreIllegals: true }).value,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "@mariozechner/mini-lit/dist/CodeBlock.js";
|
|
2
|
-
import type { ToolResultMessage } from "@draht/ai";
|
|
2
|
+
import type { ToolResultMessage } from "@draht/ai/compat";
|
|
3
3
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
4
4
|
import { FileCode2 } from "lucide";
|
|
5
5
|
import "../../components/ConsoleBlock.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { icon } from "@mariozechner/mini-lit";
|
|
2
2
|
import "@mariozechner/mini-lit/dist/MarkdownBlock.js";
|
|
3
3
|
import type { Agent, AgentMessage, AgentTool } from "@draht/agent-core";
|
|
4
|
-
import { StringEnum, type ToolCall } from "@draht/ai";
|
|
4
|
+
import { StringEnum, type ToolCall } from "@draht/ai/compat";
|
|
5
5
|
import { Button } from "@mariozechner/mini-lit/dist/Button.js";
|
|
6
|
-
import { type Static, Type } from "@sinclair/typebox";
|
|
7
6
|
import { html, LitElement, type TemplateResult } from "lit";
|
|
8
7
|
import { customElement, property, state } from "lit/decorators.js";
|
|
9
8
|
import { createRef, type Ref, ref } from "lit/directives/ref.js";
|
|
10
9
|
import { X } from "lucide";
|
|
10
|
+
import { type Static, Type } from "typebox";
|
|
11
11
|
import type { ArtifactMessage } from "../../components/Messages.js";
|
|
12
12
|
import { ArtifactsRuntimeProvider } from "../../components/sandbox/ArtifactsRuntimeProvider.js";
|
|
13
13
|
import { AttachmentsRuntimeProvider } from "../../components/sandbox/AttachmentsRuntimeProvider.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { AgentTool } from "@draht/agent-core";
|
|
2
|
-
import type { ToolResultMessage } from "@draht/ai";
|
|
3
|
-
import { type Static, Type } from "@sinclair/typebox";
|
|
2
|
+
import type { ToolResultMessage } from "@draht/ai/compat";
|
|
4
3
|
import { html } from "lit";
|
|
5
4
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
6
5
|
import { FileText } from "lucide";
|
|
6
|
+
import { type Static, Type } from "typebox";
|
|
7
7
|
import { EXTRACT_DOCUMENT_DESCRIPTION } from "../prompts/prompts.js";
|
|
8
8
|
import { loadAttachment } from "../utils/attachment-utils.js";
|
|
9
9
|
import { isCorsError } from "../utils/proxy-utils.js";
|
package/src/tools/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ToolResultMessage } from "@draht/ai";
|
|
1
|
+
import type { ToolResultMessage } from "@draht/ai/compat";
|
|
2
2
|
import "./javascript-repl.js"; // Auto-registers the renderer
|
|
3
3
|
import "./extract-document.js"; // Auto-registers the renderer
|
|
4
4
|
import { getToolRenderer, registerToolRenderer } from "./renderer-registry.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { AgentTool } from "@draht/agent-core";
|
|
2
|
-
import type { ToolResultMessage } from "@draht/ai";
|
|
2
|
+
import type { ToolResultMessage } from "@draht/ai/compat";
|
|
3
3
|
import { i18n } from "@mariozechner/mini-lit";
|
|
4
|
-
import { type Static, Type } from "@sinclair/typebox";
|
|
5
4
|
import { html } from "lit";
|
|
6
5
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
7
6
|
import { Code } from "lucide";
|
|
7
|
+
import { type Static, Type } from "typebox";
|
|
8
8
|
import { type SandboxFile, SandboxIframe, type SandboxResult } from "../components/SandboxedIframe.js";
|
|
9
9
|
import type { SandboxRuntimeProvider } from "../components/sandbox/SandboxRuntimeProvider.js";
|
|
10
10
|
import { JAVASCRIPT_REPL_TOOL_DESCRIPTION } from "../prompts/prompts.js";
|
|
@@ -137,8 +137,8 @@ export function createJavaScriptReplTool(): AgentTool<typeof javascriptReplSchem
|
|
|
137
137
|
get description() {
|
|
138
138
|
const runtimeProviderDescriptions =
|
|
139
139
|
this.runtimeProvidersFactory?.()
|
|
140
|
-
.map((d
|
|
141
|
-
.filter((d
|
|
140
|
+
.map((d) => d.getDescription())
|
|
141
|
+
.filter((d) => d.trim().length > 0) || [];
|
|
142
142
|
return JAVASCRIPT_REPL_TOOL_DESCRIPTION(runtimeProviderDescriptions);
|
|
143
143
|
},
|
|
144
144
|
parameters: javascriptReplSchema,
|
package/src/tools/types.ts
CHANGED
package/src/utils/format.ts
CHANGED
package/src/utils/proxy-utils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Api, Context, Model, SimpleStreamOptions } from "@draht/ai";
|
|
2
|
-
import { streamSimple } from "@draht/ai";
|
|
1
|
+
import type { Api, Context, Model, SimpleStreamOptions } from "@draht/ai/compat";
|
|
2
|
+
import { streamSimple } from "@draht/ai/compat";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Centralized proxy decision logic.
|