@oh-my-pi/pi-web-ui 1.341.0 → 2.1.1337
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/dist/app.css +2 -0
- package/example/package.json +2 -1
- package/example/src/main.ts +1 -1
- package/package.json +6 -5
- package/scripts/count-prompt-tokens.ts +1 -1
- package/src/ChatPanel.ts +8 -8
- package/src/components/AgentInterface.ts +9 -9
- package/src/components/AttachmentTile.ts +3 -3
- package/src/components/ConsoleBlock.ts +1 -1
- package/src/components/CustomProviderCard.ts +1 -1
- package/src/components/Input.ts +1 -1
- package/src/components/MessageEditor.ts +2 -2
- package/src/components/MessageList.ts +1 -1
- package/src/components/Messages.ts +4 -4
- package/src/components/ProviderKeyInput.ts +3 -3
- package/src/components/SandboxedIframe.ts +4 -4
- package/src/components/sandbox/ArtifactsRuntimeProvider.ts +2 -2
- package/src/components/sandbox/AttachmentsRuntimeProvider.ts +3 -3
- package/src/components/sandbox/ConsoleRuntimeProvider.ts +1 -1
- package/src/components/sandbox/FileDownloadRuntimeProvider.ts +1 -1
- package/src/components/sandbox/RuntimeMessageRouter.ts +1 -1
- package/src/dialogs/ApiKeyPromptDialog.ts +2 -2
- package/src/dialogs/AttachmentOverlay.ts +2 -2
- package/src/dialogs/CustomProviderDialog.ts +3 -3
- package/src/dialogs/ModelSelector.ts +6 -6
- package/src/dialogs/PersistentStorageDialog.ts +1 -1
- package/src/dialogs/ProvidersModelsTab.ts +5 -5
- package/src/dialogs/SessionListDialog.ts +4 -4
- package/src/dialogs/SettingsDialog.ts +1 -1
- package/src/index.ts +62 -62
- package/src/storage/app-storage.ts +5 -5
- package/src/storage/backends/indexeddb-storage-backend.ts +1 -1
- package/src/storage/store.ts +1 -1
- package/src/storage/stores/custom-providers-store.ts +2 -2
- package/src/storage/stores/provider-keys-store.ts +2 -2
- package/src/storage/stores/sessions-store.ts +2 -2
- package/src/storage/stores/settings-store.ts +2 -2
- package/src/tools/artifacts/ArtifactPill.ts +1 -1
- package/src/tools/artifacts/Console.ts +1 -1
- package/src/tools/artifacts/DocxArtifact.ts +2 -2
- package/src/tools/artifacts/ExcelArtifact.ts +2 -2
- package/src/tools/artifacts/GenericArtifact.ts +2 -2
- package/src/tools/artifacts/HtmlArtifact.ts +6 -6
- package/src/tools/artifacts/ImageArtifact.ts +2 -2
- package/src/tools/artifacts/MarkdownArtifact.ts +2 -2
- package/src/tools/artifacts/PdfArtifact.ts +2 -2
- package/src/tools/artifacts/SvgArtifact.ts +2 -2
- package/src/tools/artifacts/TextArtifact.ts +2 -2
- package/src/tools/artifacts/artifacts-tool-renderer.ts +5 -5
- package/src/tools/artifacts/artifacts.ts +17 -17
- package/src/tools/artifacts/index.ts +7 -7
- package/src/tools/extract-document.ts +5 -5
- package/src/tools/index.ts +4 -4
- package/src/tools/javascript-repl.ts +6 -6
- package/src/tools/renderer-registry.ts +1 -1
- package/src/tools/renderers/BashRenderer.ts +3 -3
- package/src/tools/renderers/CalculateRenderer.ts +3 -3
- package/src/tools/renderers/DefaultRenderer.ts +3 -3
- package/src/tools/renderers/GetCurrentTimeRenderer.ts +3 -3
- package/src/utils/attachment-utils.ts +1 -1
- package/src/utils/auth-token.ts +1 -1
package/src/index.ts
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
export type { Agent, AgentMessage, AgentState, ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
|
4
4
|
export type { Model } from "@oh-my-pi/pi-ai";
|
|
5
|
-
export { ChatPanel } from "./ChatPanel
|
|
5
|
+
export { ChatPanel } from "./ChatPanel";
|
|
6
6
|
// Components
|
|
7
|
-
export { AgentInterface } from "./components/AgentInterface
|
|
8
|
-
export { AttachmentTile } from "./components/AttachmentTile
|
|
9
|
-
export { ConsoleBlock } from "./components/ConsoleBlock
|
|
10
|
-
export { ExpandableSection } from "./components/ExpandableSection
|
|
11
|
-
export { Input } from "./components/Input
|
|
12
|
-
export { MessageEditor } from "./components/MessageEditor
|
|
13
|
-
export { MessageList } from "./components/MessageList
|
|
7
|
+
export { AgentInterface } from "./components/AgentInterface";
|
|
8
|
+
export { AttachmentTile } from "./components/AttachmentTile";
|
|
9
|
+
export { ConsoleBlock } from "./components/ConsoleBlock";
|
|
10
|
+
export { ExpandableSection } from "./components/ExpandableSection";
|
|
11
|
+
export { Input } from "./components/Input";
|
|
12
|
+
export { MessageEditor } from "./components/MessageEditor";
|
|
13
|
+
export { MessageList } from "./components/MessageList";
|
|
14
14
|
// Message components
|
|
15
|
-
export type { ArtifactMessage, UserMessageWithAttachments } from "./components/Messages
|
|
15
|
+
export type { ArtifactMessage, UserMessageWithAttachments } from "./components/Messages";
|
|
16
16
|
export {
|
|
17
17
|
AssistantMessage,
|
|
18
18
|
convertAttachments,
|
|
@@ -21,7 +21,7 @@ export {
|
|
|
21
21
|
isUserMessageWithAttachments,
|
|
22
22
|
ToolMessage,
|
|
23
23
|
UserMessage,
|
|
24
|
-
} from "./components/Messages
|
|
24
|
+
} from "./components/Messages";
|
|
25
25
|
// Message renderer registry
|
|
26
26
|
export {
|
|
27
27
|
getMessageRenderer,
|
|
@@ -29,53 +29,53 @@ export {
|
|
|
29
29
|
type MessageRole,
|
|
30
30
|
registerMessageRenderer,
|
|
31
31
|
renderMessage,
|
|
32
|
-
} from "./components/message-renderer-registry
|
|
32
|
+
} from "./components/message-renderer-registry";
|
|
33
33
|
export {
|
|
34
34
|
type SandboxFile,
|
|
35
35
|
SandboxIframe,
|
|
36
36
|
type SandboxResult,
|
|
37
37
|
type SandboxUrlProvider,
|
|
38
|
-
} from "./components/SandboxedIframe
|
|
39
|
-
export { StreamingMessageContainer } from "./components/StreamingMessageContainer
|
|
38
|
+
} from "./components/SandboxedIframe";
|
|
39
|
+
export { StreamingMessageContainer } from "./components/StreamingMessageContainer";
|
|
40
40
|
// Sandbox Runtime Providers
|
|
41
|
-
export { ArtifactsRuntimeProvider } from "./components/sandbox/ArtifactsRuntimeProvider
|
|
42
|
-
export { AttachmentsRuntimeProvider } from "./components/sandbox/AttachmentsRuntimeProvider
|
|
43
|
-
export { type ConsoleLog, ConsoleRuntimeProvider } from "./components/sandbox/ConsoleRuntimeProvider
|
|
41
|
+
export { ArtifactsRuntimeProvider } from "./components/sandbox/ArtifactsRuntimeProvider";
|
|
42
|
+
export { AttachmentsRuntimeProvider } from "./components/sandbox/AttachmentsRuntimeProvider";
|
|
43
|
+
export { type ConsoleLog, ConsoleRuntimeProvider } from "./components/sandbox/ConsoleRuntimeProvider";
|
|
44
44
|
export {
|
|
45
45
|
type DownloadableFile,
|
|
46
46
|
FileDownloadRuntimeProvider,
|
|
47
|
-
} from "./components/sandbox/FileDownloadRuntimeProvider
|
|
48
|
-
export { RuntimeMessageBridge } from "./components/sandbox/RuntimeMessageBridge
|
|
49
|
-
export { RUNTIME_MESSAGE_ROUTER } from "./components/sandbox/RuntimeMessageRouter
|
|
50
|
-
export type { SandboxRuntimeProvider } from "./components/sandbox/SandboxRuntimeProvider
|
|
51
|
-
export { ThinkingBlock } from "./components/ThinkingBlock
|
|
52
|
-
export { ApiKeyPromptDialog } from "./dialogs/ApiKeyPromptDialog
|
|
53
|
-
export { AttachmentOverlay } from "./dialogs/AttachmentOverlay
|
|
47
|
+
} from "./components/sandbox/FileDownloadRuntimeProvider";
|
|
48
|
+
export { RuntimeMessageBridge } from "./components/sandbox/RuntimeMessageBridge";
|
|
49
|
+
export { RUNTIME_MESSAGE_ROUTER } from "./components/sandbox/RuntimeMessageRouter";
|
|
50
|
+
export type { SandboxRuntimeProvider } from "./components/sandbox/SandboxRuntimeProvider";
|
|
51
|
+
export { ThinkingBlock } from "./components/ThinkingBlock";
|
|
52
|
+
export { ApiKeyPromptDialog } from "./dialogs/ApiKeyPromptDialog";
|
|
53
|
+
export { AttachmentOverlay } from "./dialogs/AttachmentOverlay";
|
|
54
54
|
// Dialogs
|
|
55
|
-
export { ModelSelector } from "./dialogs/ModelSelector
|
|
56
|
-
export { PersistentStorageDialog } from "./dialogs/PersistentStorageDialog
|
|
57
|
-
export { ProvidersModelsTab } from "./dialogs/ProvidersModelsTab
|
|
58
|
-
export { SessionListDialog } from "./dialogs/SessionListDialog
|
|
59
|
-
export { ApiKeysTab, ProxyTab, SettingsDialog, SettingsTab } from "./dialogs/SettingsDialog
|
|
55
|
+
export { ModelSelector } from "./dialogs/ModelSelector";
|
|
56
|
+
export { PersistentStorageDialog } from "./dialogs/PersistentStorageDialog";
|
|
57
|
+
export { ProvidersModelsTab } from "./dialogs/ProvidersModelsTab";
|
|
58
|
+
export { SessionListDialog } from "./dialogs/SessionListDialog";
|
|
59
|
+
export { ApiKeysTab, ProxyTab, SettingsDialog, SettingsTab } from "./dialogs/SettingsDialog";
|
|
60
60
|
// Prompts
|
|
61
61
|
export {
|
|
62
62
|
ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RO,
|
|
63
63
|
ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RW,
|
|
64
64
|
ATTACHMENTS_RUNTIME_DESCRIPTION,
|
|
65
|
-
} from "./prompts/prompts
|
|
65
|
+
} from "./prompts/prompts";
|
|
66
66
|
// Storage
|
|
67
|
-
export { AppStorage, getAppStorage, setAppStorage } from "./storage/app-storage
|
|
68
|
-
export { IndexedDBStorageBackend } from "./storage/backends/indexeddb-storage-backend
|
|
69
|
-
export { Store } from "./storage/store
|
|
67
|
+
export { AppStorage, getAppStorage, setAppStorage } from "./storage/app-storage";
|
|
68
|
+
export { IndexedDBStorageBackend } from "./storage/backends/indexeddb-storage-backend";
|
|
69
|
+
export { Store } from "./storage/store";
|
|
70
70
|
export type {
|
|
71
71
|
AutoDiscoveryProviderType,
|
|
72
72
|
CustomProvider,
|
|
73
73
|
CustomProviderType,
|
|
74
|
-
} from "./storage/stores/custom-providers-store
|
|
75
|
-
export { CustomProvidersStore } from "./storage/stores/custom-providers-store
|
|
76
|
-
export { ProviderKeysStore } from "./storage/stores/provider-keys-store
|
|
77
|
-
export { SessionsStore } from "./storage/stores/sessions-store
|
|
78
|
-
export { SettingsStore } from "./storage/stores/settings-store
|
|
74
|
+
} from "./storage/stores/custom-providers-store";
|
|
75
|
+
export { CustomProvidersStore } from "./storage/stores/custom-providers-store";
|
|
76
|
+
export { ProviderKeysStore } from "./storage/stores/provider-keys-store";
|
|
77
|
+
export { SessionsStore } from "./storage/stores/sessions-store";
|
|
78
|
+
export { SettingsStore } from "./storage/stores/settings-store";
|
|
79
79
|
export type {
|
|
80
80
|
IndexConfig,
|
|
81
81
|
IndexedDBConfig,
|
|
@@ -84,32 +84,32 @@ export type {
|
|
|
84
84
|
StorageBackend,
|
|
85
85
|
StorageTransaction,
|
|
86
86
|
StoreConfig,
|
|
87
|
-
} from "./storage/types
|
|
87
|
+
} from "./storage/types";
|
|
88
88
|
// Artifacts
|
|
89
|
-
export { ArtifactElement } from "./tools/artifacts/ArtifactElement
|
|
90
|
-
export { ArtifactPill } from "./tools/artifacts/ArtifactPill
|
|
91
|
-
export { type Artifact, ArtifactsPanel, type ArtifactsParams } from "./tools/artifacts/artifacts
|
|
92
|
-
export { ArtifactsToolRenderer } from "./tools/artifacts/artifacts-tool-renderer
|
|
93
|
-
export { HtmlArtifact } from "./tools/artifacts/HtmlArtifact
|
|
94
|
-
export { ImageArtifact } from "./tools/artifacts/ImageArtifact
|
|
95
|
-
export { MarkdownArtifact } from "./tools/artifacts/MarkdownArtifact
|
|
96
|
-
export { SvgArtifact } from "./tools/artifacts/SvgArtifact
|
|
97
|
-
export { TextArtifact } from "./tools/artifacts/TextArtifact
|
|
98
|
-
export { createExtractDocumentTool, extractDocumentTool } from "./tools/extract-document
|
|
89
|
+
export { ArtifactElement } from "./tools/artifacts/ArtifactElement";
|
|
90
|
+
export { ArtifactPill } from "./tools/artifacts/ArtifactPill";
|
|
91
|
+
export { type Artifact, ArtifactsPanel, type ArtifactsParams } from "./tools/artifacts/artifacts";
|
|
92
|
+
export { ArtifactsToolRenderer } from "./tools/artifacts/artifacts-tool-renderer";
|
|
93
|
+
export { HtmlArtifact } from "./tools/artifacts/HtmlArtifact";
|
|
94
|
+
export { ImageArtifact } from "./tools/artifacts/ImageArtifact";
|
|
95
|
+
export { MarkdownArtifact } from "./tools/artifacts/MarkdownArtifact";
|
|
96
|
+
export { SvgArtifact } from "./tools/artifacts/SvgArtifact";
|
|
97
|
+
export { TextArtifact } from "./tools/artifacts/TextArtifact";
|
|
98
|
+
export { createExtractDocumentTool, extractDocumentTool } from "./tools/extract-document";
|
|
99
99
|
// Tools
|
|
100
|
-
export { getToolRenderer, registerToolRenderer, renderTool, setShowJsonMode } from "./tools/index
|
|
101
|
-
export { createJavaScriptReplTool, javascriptReplTool } from "./tools/javascript-repl
|
|
102
|
-
export { renderCollapsibleHeader, renderHeader } from "./tools/renderer-registry
|
|
103
|
-
export { BashRenderer } from "./tools/renderers/BashRenderer
|
|
104
|
-
export { CalculateRenderer } from "./tools/renderers/CalculateRenderer
|
|
100
|
+
export { getToolRenderer, registerToolRenderer, renderTool, setShowJsonMode } from "./tools/index";
|
|
101
|
+
export { createJavaScriptReplTool, javascriptReplTool } from "./tools/javascript-repl";
|
|
102
|
+
export { renderCollapsibleHeader, renderHeader } from "./tools/renderer-registry";
|
|
103
|
+
export { BashRenderer } from "./tools/renderers/BashRenderer";
|
|
104
|
+
export { CalculateRenderer } from "./tools/renderers/CalculateRenderer";
|
|
105
105
|
// Tool renderers
|
|
106
|
-
export { DefaultRenderer } from "./tools/renderers/DefaultRenderer
|
|
107
|
-
export { GetCurrentTimeRenderer } from "./tools/renderers/GetCurrentTimeRenderer
|
|
108
|
-
export type { ToolRenderer, ToolRenderResult } from "./tools/types
|
|
109
|
-
export type { Attachment } from "./utils/attachment-utils
|
|
106
|
+
export { DefaultRenderer } from "./tools/renderers/DefaultRenderer";
|
|
107
|
+
export { GetCurrentTimeRenderer } from "./tools/renderers/GetCurrentTimeRenderer";
|
|
108
|
+
export type { ToolRenderer, ToolRenderResult } from "./tools/types";
|
|
109
|
+
export type { Attachment } from "./utils/attachment-utils";
|
|
110
110
|
// Utils
|
|
111
|
-
export { loadAttachment } from "./utils/attachment-utils
|
|
112
|
-
export { clearAuthToken, getAuthToken } from "./utils/auth-token
|
|
113
|
-
export { formatCost, formatModelCost, formatTokenCount, formatUsage } from "./utils/format
|
|
114
|
-
export { i18n, setLanguage, translations } from "./utils/i18n
|
|
115
|
-
export { applyProxyIfNeeded, createStreamFn, isCorsError, shouldUseProxyForProvider } from "./utils/proxy-utils
|
|
111
|
+
export { loadAttachment } from "./utils/attachment-utils";
|
|
112
|
+
export { clearAuthToken, getAuthToken } from "./utils/auth-token";
|
|
113
|
+
export { formatCost, formatModelCost, formatTokenCount, formatUsage } from "./utils/format";
|
|
114
|
+
export { i18n, setLanguage, translations } from "./utils/i18n";
|
|
115
|
+
export { applyProxyIfNeeded, createStreamFn, isCorsError, shouldUseProxyForProvider } from "./utils/proxy-utils";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { CustomProvidersStore } from "./stores/custom-providers-store
|
|
2
|
-
import type { ProviderKeysStore } from "./stores/provider-keys-store
|
|
3
|
-
import type { SessionsStore } from "./stores/sessions-store
|
|
4
|
-
import type { SettingsStore } from "./stores/settings-store
|
|
5
|
-
import type { StorageBackend } from "./types
|
|
1
|
+
import type { CustomProvidersStore } from "./stores/custom-providers-store";
|
|
2
|
+
import type { ProviderKeysStore } from "./stores/provider-keys-store";
|
|
3
|
+
import type { SessionsStore } from "./stores/sessions-store";
|
|
4
|
+
import type { SettingsStore } from "./stores/settings-store";
|
|
5
|
+
import type { StorageBackend } from "./types";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* High-level storage API providing access to all storage operations.
|
package/src/storage/store.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Model } from "@oh-my-pi/pi-ai";
|
|
2
|
-
import { Store } from "../store
|
|
3
|
-
import type { StoreConfig } from "../types
|
|
2
|
+
import { Store } from "../store";
|
|
3
|
+
import type { StoreConfig } from "../types";
|
|
4
4
|
|
|
5
5
|
export type AutoDiscoveryProviderType = "ollama" | "llama.cpp" | "vllm" | "lmstudio";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AgentState } from "@oh-my-pi/pi-agent-core";
|
|
2
|
-
import { Store } from "../store
|
|
3
|
-
import type { SessionData, SessionMetadata, StoreConfig } from "../types
|
|
2
|
+
import { Store } from "../store";
|
|
3
|
+
import type { SessionData, SessionMetadata, StoreConfig } from "../types";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Store for chat sessions (data and metadata).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { icon } from "@mariozechner/mini-lit";
|
|
2
2
|
import { html, type TemplateResult } from "lit";
|
|
3
3
|
import { FileCode2 } from "lucide";
|
|
4
|
-
import type { ArtifactsPanel } from "./artifacts
|
|
4
|
+
import type { ArtifactsPanel } from "./artifacts";
|
|
5
5
|
|
|
6
6
|
export function ArtifactPill(filename: string, artifactsPanel?: ArtifactsPanel): TemplateResult {
|
|
7
7
|
const handleClick = (e: Event) => {
|
|
@@ -5,7 +5,7 @@ import { customElement, property, state } from "lit/decorators.js";
|
|
|
5
5
|
import { createRef, type Ref, ref } from "lit/directives/ref.js";
|
|
6
6
|
import { repeat } from "lit/directives/repeat.js";
|
|
7
7
|
import { ChevronDown, ChevronRight, ChevronsDown, Lock } from "lucide";
|
|
8
|
-
import { i18n } from "../../utils/i18n
|
|
8
|
+
import { i18n } from "../../utils/i18n";
|
|
9
9
|
|
|
10
10
|
interface LogEntry {
|
|
11
11
|
type: "log" | "error";
|
|
@@ -2,8 +2,8 @@ import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js";
|
|
|
2
2
|
import { renderAsync } from "docx-preview";
|
|
3
3
|
import { html, type TemplateResult } from "lit";
|
|
4
4
|
import { customElement, property, state } from "lit/decorators.js";
|
|
5
|
-
import { i18n } from "../../utils/i18n
|
|
6
|
-
import { ArtifactElement } from "./ArtifactElement
|
|
5
|
+
import { i18n } from "../../utils/i18n";
|
|
6
|
+
import { ArtifactElement } from "./ArtifactElement";
|
|
7
7
|
|
|
8
8
|
@customElement("docx-artifact")
|
|
9
9
|
export class DocxArtifact extends ArtifactElement {
|
|
@@ -2,8 +2,8 @@ import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js";
|
|
|
2
2
|
import { html, type TemplateResult } from "lit";
|
|
3
3
|
import { customElement, property, state } from "lit/decorators.js";
|
|
4
4
|
import * as XLSX from "xlsx";
|
|
5
|
-
import { i18n } from "../../utils/i18n
|
|
6
|
-
import { ArtifactElement } from "./ArtifactElement
|
|
5
|
+
import { i18n } from "../../utils/i18n";
|
|
6
|
+
import { ArtifactElement } from "./ArtifactElement";
|
|
7
7
|
|
|
8
8
|
@customElement("excel-artifact")
|
|
9
9
|
export class ExcelArtifact extends ArtifactElement {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js";
|
|
2
2
|
import { html, type TemplateResult } from "lit";
|
|
3
3
|
import { customElement, property } from "lit/decorators.js";
|
|
4
|
-
import { i18n } from "../../utils/i18n
|
|
5
|
-
import { ArtifactElement } from "./ArtifactElement
|
|
4
|
+
import { i18n } from "../../utils/i18n";
|
|
5
|
+
import { ArtifactElement } from "./ArtifactElement";
|
|
6
6
|
|
|
7
7
|
@customElement("generic-artifact")
|
|
8
8
|
export class GenericArtifact extends ArtifactElement {
|
|
@@ -4,13 +4,13 @@ import { customElement, property, state } from "lit/decorators.js";
|
|
|
4
4
|
import { createRef, type Ref, ref } from "lit/directives/ref.js";
|
|
5
5
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
6
6
|
import { RefreshCw } from "lucide";
|
|
7
|
-
import type { SandboxIframe } from "../../components/SandboxedIframe
|
|
8
|
-
import { type MessageConsumer, RUNTIME_MESSAGE_ROUTER } from "../../components/sandbox/RuntimeMessageRouter
|
|
9
|
-
import type { SandboxRuntimeProvider } from "../../components/sandbox/SandboxRuntimeProvider
|
|
10
|
-
import { i18n } from "../../utils/i18n
|
|
7
|
+
import type { SandboxIframe } from "../../components/SandboxedIframe";
|
|
8
|
+
import { type MessageConsumer, RUNTIME_MESSAGE_ROUTER } from "../../components/sandbox/RuntimeMessageRouter";
|
|
9
|
+
import type { SandboxRuntimeProvider } from "../../components/sandbox/SandboxRuntimeProvider";
|
|
10
|
+
import { i18n } from "../../utils/i18n";
|
|
11
11
|
import "../../components/SandboxedIframe.js";
|
|
12
|
-
import { ArtifactElement } from "./ArtifactElement
|
|
13
|
-
import type { Console } from "./Console
|
|
12
|
+
import { ArtifactElement } from "./ArtifactElement";
|
|
13
|
+
import type { Console } from "./Console";
|
|
14
14
|
import "./Console.js";
|
|
15
15
|
import { icon } from "@mariozechner/mini-lit";
|
|
16
16
|
import { Button } from "@mariozechner/mini-lit/dist/Button.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js";
|
|
2
2
|
import { html, type TemplateResult } from "lit";
|
|
3
3
|
import { customElement, property } from "lit/decorators.js";
|
|
4
|
-
import { i18n } from "../../utils/i18n
|
|
5
|
-
import { ArtifactElement } from "./ArtifactElement
|
|
4
|
+
import { i18n } from "../../utils/i18n";
|
|
5
|
+
import { ArtifactElement } from "./ArtifactElement";
|
|
6
6
|
|
|
7
7
|
@customElement("image-artifact")
|
|
8
8
|
export class ImageArtifact extends ArtifactElement {
|
|
@@ -2,12 +2,12 @@ import hljs from "highlight.js";
|
|
|
2
2
|
import { html } from "lit";
|
|
3
3
|
import { customElement, property, state } from "lit/decorators.js";
|
|
4
4
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
5
|
-
import { i18n } from "../../utils/i18n
|
|
5
|
+
import { i18n } from "../../utils/i18n";
|
|
6
6
|
import "@mariozechner/mini-lit/dist/MarkdownBlock.js";
|
|
7
7
|
import { CopyButton } from "@mariozechner/mini-lit/dist/CopyButton.js";
|
|
8
8
|
import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js";
|
|
9
9
|
import { PreviewCodeToggle } from "@mariozechner/mini-lit/dist/PreviewCodeToggle.js";
|
|
10
|
-
import { ArtifactElement } from "./ArtifactElement
|
|
10
|
+
import { ArtifactElement } from "./ArtifactElement";
|
|
11
11
|
|
|
12
12
|
@customElement("markdown-artifact")
|
|
13
13
|
export class MarkdownArtifact extends ArtifactElement {
|
|
@@ -2,8 +2,8 @@ import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js";
|
|
|
2
2
|
import { html, type TemplateResult } from "lit";
|
|
3
3
|
import { customElement, property, state } from "lit/decorators.js";
|
|
4
4
|
import * as pdfjsLib from "pdfjs-dist";
|
|
5
|
-
import { i18n } from "../../utils/i18n
|
|
6
|
-
import { ArtifactElement } from "./ArtifactElement
|
|
5
|
+
import { i18n } from "../../utils/i18n";
|
|
6
|
+
import { ArtifactElement } from "./ArtifactElement";
|
|
7
7
|
|
|
8
8
|
// Configure PDF.js worker
|
|
9
9
|
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL("pdfjs-dist/build/pdf.worker.min.mjs", import.meta.url).toString();
|
|
@@ -5,8 +5,8 @@ import hljs from "highlight.js";
|
|
|
5
5
|
import { html } from "lit";
|
|
6
6
|
import { customElement, property, state } from "lit/decorators.js";
|
|
7
7
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
8
|
-
import { i18n } from "../../utils/i18n
|
|
9
|
-
import { ArtifactElement } from "./ArtifactElement
|
|
8
|
+
import { i18n } from "../../utils/i18n";
|
|
9
|
+
import { ArtifactElement } from "./ArtifactElement";
|
|
10
10
|
|
|
11
11
|
@customElement("svg-artifact")
|
|
12
12
|
export class SvgArtifact extends ArtifactElement {
|
|
@@ -4,8 +4,8 @@ import hljs from "highlight.js";
|
|
|
4
4
|
import { html } from "lit";
|
|
5
5
|
import { customElement, property } from "lit/decorators.js";
|
|
6
6
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
7
|
-
import { i18n } from "../../utils/i18n
|
|
8
|
-
import { ArtifactElement } from "./ArtifactElement
|
|
7
|
+
import { i18n } from "../../utils/i18n";
|
|
8
|
+
import { ArtifactElement } from "./ArtifactElement";
|
|
9
9
|
|
|
10
10
|
// Known code file extensions for highlighting
|
|
11
11
|
const CODE_EXTENSIONS = [
|
|
@@ -5,11 +5,11 @@ import { FileCode2 } from "lucide";
|
|
|
5
5
|
import "../../components/ConsoleBlock.js";
|
|
6
6
|
import { Diff } from "@mariozechner/mini-lit/dist/Diff.js";
|
|
7
7
|
import { html, type TemplateResult } from "lit";
|
|
8
|
-
import { i18n } from "../../utils/i18n
|
|
9
|
-
import { renderCollapsibleHeader, renderHeader } from "../renderer-registry
|
|
10
|
-
import type { ToolRenderer, ToolRenderResult } from "../types
|
|
11
|
-
import { ArtifactPill } from "./ArtifactPill
|
|
12
|
-
import type { ArtifactsPanel, ArtifactsParams } from "./artifacts
|
|
8
|
+
import { i18n } from "../../utils/i18n";
|
|
9
|
+
import { renderCollapsibleHeader, renderHeader } from "../renderer-registry";
|
|
10
|
+
import type { ToolRenderer, ToolRenderResult } from "../types";
|
|
11
|
+
import { ArtifactPill } from "./ArtifactPill";
|
|
12
|
+
import type { ArtifactsPanel, ArtifactsParams } from "./artifacts";
|
|
13
13
|
|
|
14
14
|
// Helper to extract text from content blocks
|
|
15
15
|
function getTextOutput(result: ToolResultMessage<any> | undefined): string {
|
|
@@ -8,27 +8,27 @@ import { html, LitElement, type TemplateResult } from "lit";
|
|
|
8
8
|
import { customElement, property, state } from "lit/decorators.js";
|
|
9
9
|
import { createRef, type Ref, ref } from "lit/directives/ref.js";
|
|
10
10
|
import { X } from "lucide";
|
|
11
|
-
import type { ArtifactMessage } from "../../components/Messages
|
|
12
|
-
import { ArtifactsRuntimeProvider } from "../../components/sandbox/ArtifactsRuntimeProvider
|
|
13
|
-
import { AttachmentsRuntimeProvider } from "../../components/sandbox/AttachmentsRuntimeProvider
|
|
14
|
-
import type { SandboxRuntimeProvider } from "../../components/sandbox/SandboxRuntimeProvider
|
|
11
|
+
import type { ArtifactMessage } from "../../components/Messages";
|
|
12
|
+
import { ArtifactsRuntimeProvider } from "../../components/sandbox/ArtifactsRuntimeProvider";
|
|
13
|
+
import { AttachmentsRuntimeProvider } from "../../components/sandbox/AttachmentsRuntimeProvider";
|
|
14
|
+
import type { SandboxRuntimeProvider } from "../../components/sandbox/SandboxRuntimeProvider";
|
|
15
15
|
import {
|
|
16
16
|
ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RO,
|
|
17
17
|
ARTIFACTS_TOOL_DESCRIPTION,
|
|
18
18
|
ATTACHMENTS_RUNTIME_DESCRIPTION,
|
|
19
|
-
} from "../../prompts/prompts
|
|
20
|
-
import type { Attachment } from "../../utils/attachment-utils
|
|
21
|
-
import { i18n } from "../../utils/i18n
|
|
22
|
-
import type { ArtifactElement } from "./ArtifactElement
|
|
23
|
-
import { DocxArtifact } from "./DocxArtifact
|
|
24
|
-
import { ExcelArtifact } from "./ExcelArtifact
|
|
25
|
-
import { GenericArtifact } from "./GenericArtifact
|
|
26
|
-
import { HtmlArtifact } from "./HtmlArtifact
|
|
27
|
-
import { ImageArtifact } from "./ImageArtifact
|
|
28
|
-
import { MarkdownArtifact } from "./MarkdownArtifact
|
|
29
|
-
import { PdfArtifact } from "./PdfArtifact
|
|
30
|
-
import { SvgArtifact } from "./SvgArtifact
|
|
31
|
-
import { TextArtifact } from "./TextArtifact
|
|
19
|
+
} from "../../prompts/prompts";
|
|
20
|
+
import type { Attachment } from "../../utils/attachment-utils";
|
|
21
|
+
import { i18n } from "../../utils/i18n";
|
|
22
|
+
import type { ArtifactElement } from "./ArtifactElement";
|
|
23
|
+
import { DocxArtifact } from "./DocxArtifact";
|
|
24
|
+
import { ExcelArtifact } from "./ExcelArtifact";
|
|
25
|
+
import { GenericArtifact } from "./GenericArtifact";
|
|
26
|
+
import { HtmlArtifact } from "./HtmlArtifact";
|
|
27
|
+
import { ImageArtifact } from "./ImageArtifact";
|
|
28
|
+
import { MarkdownArtifact } from "./MarkdownArtifact";
|
|
29
|
+
import { PdfArtifact } from "./PdfArtifact";
|
|
30
|
+
import { SvgArtifact } from "./SvgArtifact";
|
|
31
|
+
import { TextArtifact } from "./TextArtifact";
|
|
32
32
|
|
|
33
33
|
// Simple artifact model
|
|
34
34
|
export interface Artifact {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { ArtifactElement } from "./ArtifactElement
|
|
2
|
-
export { type Artifact, ArtifactsPanel, type ArtifactsParams } from "./artifacts
|
|
3
|
-
export { ArtifactsToolRenderer } from "./artifacts-tool-renderer
|
|
4
|
-
export { HtmlArtifact } from "./HtmlArtifact
|
|
5
|
-
export { MarkdownArtifact } from "./MarkdownArtifact
|
|
6
|
-
export { SvgArtifact } from "./SvgArtifact
|
|
7
|
-
export { TextArtifact } from "./TextArtifact
|
|
1
|
+
export { ArtifactElement } from "./ArtifactElement";
|
|
2
|
+
export { type Artifact, ArtifactsPanel, type ArtifactsParams } from "./artifacts";
|
|
3
|
+
export { ArtifactsToolRenderer } from "./artifacts-tool-renderer";
|
|
4
|
+
export { HtmlArtifact } from "./HtmlArtifact";
|
|
5
|
+
export { MarkdownArtifact } from "./MarkdownArtifact";
|
|
6
|
+
export { SvgArtifact } from "./SvgArtifact";
|
|
7
|
+
export { TextArtifact } from "./TextArtifact";
|
|
@@ -4,11 +4,11 @@ import { type Static, Type } from "@sinclair/typebox";
|
|
|
4
4
|
import { html } from "lit";
|
|
5
5
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
6
6
|
import { FileText } from "lucide";
|
|
7
|
-
import { EXTRACT_DOCUMENT_DESCRIPTION } from "../prompts/prompts
|
|
8
|
-
import { loadAttachment } from "../utils/attachment-utils
|
|
9
|
-
import { isCorsError } from "../utils/proxy-utils
|
|
10
|
-
import { registerToolRenderer, renderCollapsibleHeader, renderHeader } from "./renderer-registry
|
|
11
|
-
import type { ToolRenderer, ToolRenderResult } from "./types
|
|
7
|
+
import { EXTRACT_DOCUMENT_DESCRIPTION } from "../prompts/prompts";
|
|
8
|
+
import { loadAttachment } from "../utils/attachment-utils";
|
|
9
|
+
import { isCorsError } from "../utils/proxy-utils";
|
|
10
|
+
import { registerToolRenderer, renderCollapsibleHeader, renderHeader } from "./renderer-registry";
|
|
11
|
+
import type { ToolRenderer, ToolRenderResult } from "./types";
|
|
12
12
|
|
|
13
13
|
// ============================================================================
|
|
14
14
|
// TYPES
|
package/src/tools/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ToolResultMessage } from "@oh-my-pi/pi-ai";
|
|
2
2
|
import "./javascript-repl.js"; // Auto-registers the renderer
|
|
3
3
|
import "./extract-document.js"; // Auto-registers the renderer
|
|
4
|
-
import { getToolRenderer, registerToolRenderer } from "./renderer-registry
|
|
5
|
-
import { BashRenderer } from "./renderers/BashRenderer
|
|
6
|
-
import { DefaultRenderer } from "./renderers/DefaultRenderer
|
|
7
|
-
import type { ToolRenderResult } from "./types
|
|
4
|
+
import { getToolRenderer, registerToolRenderer } from "./renderer-registry";
|
|
5
|
+
import { BashRenderer } from "./renderers/BashRenderer";
|
|
6
|
+
import { DefaultRenderer } from "./renderers/DefaultRenderer";
|
|
7
|
+
import type { ToolRenderResult } from "./types";
|
|
8
8
|
|
|
9
9
|
// Register all built-in tool renderers
|
|
10
10
|
registerToolRenderer("bash", new BashRenderer());
|
|
@@ -5,12 +5,12 @@ import { type Static, Type } from "@sinclair/typebox";
|
|
|
5
5
|
import { html } from "lit";
|
|
6
6
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
7
7
|
import { Code } from "lucide";
|
|
8
|
-
import { type SandboxFile, SandboxIframe, type SandboxResult } from "../components/SandboxedIframe
|
|
9
|
-
import type { SandboxRuntimeProvider } from "../components/sandbox/SandboxRuntimeProvider
|
|
10
|
-
import { JAVASCRIPT_REPL_TOOL_DESCRIPTION } from "../prompts/prompts
|
|
11
|
-
import type { Attachment } from "../utils/attachment-utils
|
|
12
|
-
import { registerToolRenderer, renderCollapsibleHeader, renderHeader } from "./renderer-registry
|
|
13
|
-
import type { ToolRenderer, ToolRenderResult } from "./types
|
|
8
|
+
import { type SandboxFile, SandboxIframe, type SandboxResult } from "../components/SandboxedIframe";
|
|
9
|
+
import type { SandboxRuntimeProvider } from "../components/sandbox/SandboxRuntimeProvider";
|
|
10
|
+
import { JAVASCRIPT_REPL_TOOL_DESCRIPTION } from "../prompts/prompts";
|
|
11
|
+
import type { Attachment } from "../utils/attachment-utils";
|
|
12
|
+
import { registerToolRenderer, renderCollapsibleHeader, renderHeader } from "./renderer-registry";
|
|
13
|
+
import type { ToolRenderer, ToolRenderResult } from "./types";
|
|
14
14
|
|
|
15
15
|
// Execute JavaScript code with attachments using SandboxedIframe
|
|
16
16
|
export async function executeJavaScript(
|
|
@@ -3,7 +3,7 @@ import { html, type TemplateResult } from "lit";
|
|
|
3
3
|
import type { Ref } from "lit/directives/ref.js";
|
|
4
4
|
import { ref } from "lit/directives/ref.js";
|
|
5
5
|
import { ChevronsUpDown, ChevronUp, Loader } from "lucide";
|
|
6
|
-
import type { ToolRenderer } from "./types
|
|
6
|
+
import type { ToolRenderer } from "./types";
|
|
7
7
|
|
|
8
8
|
// Registry of tool renderers
|
|
9
9
|
export const toolRenderers = new Map<string, ToolRenderer>();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ToolResultMessage } from "@oh-my-pi/pi-ai";
|
|
2
2
|
import { html } from "lit";
|
|
3
3
|
import { SquareTerminal } from "lucide";
|
|
4
|
-
import { i18n } from "../../utils/i18n
|
|
5
|
-
import { renderHeader } from "../renderer-registry
|
|
6
|
-
import type { ToolRenderer, ToolRenderResult } from "../types
|
|
4
|
+
import { i18n } from "../../utils/i18n";
|
|
5
|
+
import { renderHeader } from "../renderer-registry";
|
|
6
|
+
import type { ToolRenderer, ToolRenderResult } from "../types";
|
|
7
7
|
|
|
8
8
|
interface BashParams {
|
|
9
9
|
command: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ToolResultMessage } from "@oh-my-pi/pi-ai";
|
|
2
2
|
import { html } from "lit";
|
|
3
3
|
import { Calculator } from "lucide";
|
|
4
|
-
import { i18n } from "../../utils/i18n
|
|
5
|
-
import { renderHeader } from "../renderer-registry
|
|
6
|
-
import type { ToolRenderer, ToolRenderResult } from "../types
|
|
4
|
+
import { i18n } from "../../utils/i18n";
|
|
5
|
+
import { renderHeader } from "../renderer-registry";
|
|
6
|
+
import type { ToolRenderer, ToolRenderResult } from "../types";
|
|
7
7
|
|
|
8
8
|
interface CalculateParams {
|
|
9
9
|
expression: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ToolResultMessage } from "@oh-my-pi/pi-ai";
|
|
2
2
|
import { html } from "lit";
|
|
3
3
|
import { Code } from "lucide";
|
|
4
|
-
import { i18n } from "../../utils/i18n
|
|
5
|
-
import { renderHeader } from "../renderer-registry
|
|
6
|
-
import type { ToolRenderer, ToolRenderResult } from "../types
|
|
4
|
+
import { i18n } from "../../utils/i18n";
|
|
5
|
+
import { renderHeader } from "../renderer-registry";
|
|
6
|
+
import type { ToolRenderer, ToolRenderResult } from "../types";
|
|
7
7
|
|
|
8
8
|
export class DefaultRenderer implements ToolRenderer {
|
|
9
9
|
render(params: any | undefined, result: ToolResultMessage | undefined, isStreaming?: boolean): ToolRenderResult {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ToolResultMessage } from "@oh-my-pi/pi-ai";
|
|
2
2
|
import { html } from "lit";
|
|
3
3
|
import { Clock } from "lucide";
|
|
4
|
-
import { i18n } from "../../utils/i18n
|
|
5
|
-
import { renderHeader } from "../renderer-registry
|
|
6
|
-
import type { ToolRenderer, ToolRenderResult } from "../types
|
|
4
|
+
import { i18n } from "../../utils/i18n";
|
|
5
|
+
import { renderHeader } from "../renderer-registry";
|
|
6
|
+
import type { ToolRenderer, ToolRenderResult } from "../types";
|
|
7
7
|
|
|
8
8
|
interface GetCurrentTimeParams {
|
|
9
9
|
timezone?: string;
|
|
@@ -3,7 +3,7 @@ import JSZip from "jszip";
|
|
|
3
3
|
import type { PDFDocumentProxy } from "pdfjs-dist";
|
|
4
4
|
import * as pdfjsLib from "pdfjs-dist";
|
|
5
5
|
import * as XLSX from "xlsx";
|
|
6
|
-
import { i18n } from "./i18n
|
|
6
|
+
import { i18n } from "./i18n";
|
|
7
7
|
|
|
8
8
|
// Configure PDF.js worker - we'll need to bundle this
|
|
9
9
|
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL("pdfjs-dist/build/pdf.worker.min.mjs", import.meta.url).toString();
|
package/src/utils/auth-token.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import PromptDialog from "@mariozechner/mini-lit/dist/PromptDialog.js";
|
|
2
|
-
import { i18n } from "./i18n
|
|
2
|
+
import { i18n } from "./i18n";
|
|
3
3
|
|
|
4
4
|
export async function getAuthToken(): Promise<string | undefined> {
|
|
5
5
|
let authToken: string | undefined = localStorage.getItem(`auth-token`) || "";
|