@ouhuang/pi-web-ui 0.65.1
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 +349 -0
- package/README.md +601 -0
- package/dist/ChatPanel.d.ts +29 -0
- package/dist/ChatPanel.d.ts.map +1 -0
- package/dist/ChatPanel.js +194 -0
- package/dist/ChatPanel.js.map +1 -0
- package/dist/app.css +2 -0
- package/dist/components/AgentInterface.d.ts +40 -0
- package/dist/components/AgentInterface.d.ts.map +1 -0
- package/dist/components/AgentInterface.js +388 -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 +111 -0
- package/dist/components/AttachmentTile.js.map +1 -0
- package/dist/components/ConsoleBlock.d.ts +12 -0
- package/dist/components/ConsoleBlock.d.ts.map +1 -0
- package/dist/components/ConsoleBlock.js +84 -0
- package/dist/components/ConsoleBlock.js.map +1 -0
- package/dist/components/CustomProviderCard.d.ts +17 -0
- package/dist/components/CustomProviderCard.d.ts.map +1 -0
- package/dist/components/CustomProviderCard.js +110 -0
- package/dist/components/CustomProviderCard.js.map +1 -0
- package/dist/components/ExpandableSection.d.ts +15 -0
- package/dist/components/ExpandableSection.d.ts.map +1 -0
- package/dist/components/ExpandableSection.js +63 -0
- package/dist/components/ExpandableSection.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 +57 -0
- package/dist/components/Input.js.map +1 -0
- package/dist/components/MessageEditor.d.ts +44 -0
- package/dist/components/MessageEditor.d.ts.map +1 -0
- package/dist/components/MessageEditor.js +416 -0
- package/dist/components/MessageEditor.js.map +1 -0
- package/dist/components/MessageList.d.ts +14 -0
- package/dist/components/MessageList.d.ts.map +1 -0
- package/dist/components/MessageList.js +105 -0
- package/dist/components/MessageList.js.map +1 -0
- package/dist/components/Messages.d.ts +95 -0
- package/dist/components/Messages.d.ts.map +1 -0
- package/dist/components/Messages.js +362 -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 +171 -0
- package/dist/components/ProviderKeyInput.js.map +1 -0
- package/dist/components/SandboxedIframe.d.ts +85 -0
- package/dist/components/SandboxedIframe.d.ts.map +1 -0
- package/dist/components/SandboxedIframe.js +511 -0
- package/dist/components/SandboxedIframe.js.map +1 -0
- package/dist/components/StreamingMessageContainer.d.ts +19 -0
- package/dist/components/StreamingMessageContainer.d.ts.map +1 -0
- package/dist/components/StreamingMessageContainer.js +117 -0
- package/dist/components/StreamingMessageContainer.js.map +1 -0
- package/dist/components/ThinkingBlock.d.ts +11 -0
- package/dist/components/ThinkingBlock.d.ts.map +1 -0
- package/dist/components/ThinkingBlock.js +58 -0
- package/dist/components/ThinkingBlock.js.map +1 -0
- package/dist/components/message-renderer-registry.d.ts +12 -0
- package/dist/components/message-renderer-registry.d.ts.map +1 -0
- package/dist/components/message-renderer-registry.js +12 -0
- package/dist/components/message-renderer-registry.js.map +1 -0
- package/dist/components/sandbox/ArtifactsRuntimeProvider.d.ts +38 -0
- package/dist/components/sandbox/ArtifactsRuntimeProvider.d.ts.map +1 -0
- package/dist/components/sandbox/ArtifactsRuntimeProvider.js +189 -0
- package/dist/components/sandbox/ArtifactsRuntimeProvider.js.map +1 -0
- package/dist/components/sandbox/AttachmentsRuntimeProvider.d.ts +17 -0
- package/dist/components/sandbox/AttachmentsRuntimeProvider.d.ts.map +1 -0
- package/dist/components/sandbox/AttachmentsRuntimeProvider.js +64 -0
- package/dist/components/sandbox/AttachmentsRuntimeProvider.js.map +1 -0
- package/dist/components/sandbox/ConsoleRuntimeProvider.d.ts +42 -0
- package/dist/components/sandbox/ConsoleRuntimeProvider.d.ts.map +1 -0
- package/dist/components/sandbox/ConsoleRuntimeProvider.js +161 -0
- package/dist/components/sandbox/ConsoleRuntimeProvider.js.map +1 -0
- package/dist/components/sandbox/FileDownloadRuntimeProvider.d.ts +30 -0
- package/dist/components/sandbox/FileDownloadRuntimeProvider.d.ts.map +1 -0
- package/dist/components/sandbox/FileDownloadRuntimeProvider.js +97 -0
- package/dist/components/sandbox/FileDownloadRuntimeProvider.js.map +1 -0
- package/dist/components/sandbox/RuntimeMessageBridge.d.ts +19 -0
- package/dist/components/sandbox/RuntimeMessageBridge.d.ts.map +1 -0
- package/dist/components/sandbox/RuntimeMessageBridge.js +74 -0
- package/dist/components/sandbox/RuntimeMessageBridge.js.map +1 -0
- package/dist/components/sandbox/RuntimeMessageRouter.d.ts +65 -0
- package/dist/components/sandbox/RuntimeMessageRouter.d.ts.map +1 -0
- package/dist/components/sandbox/RuntimeMessageRouter.js +168 -0
- package/dist/components/sandbox/RuntimeMessageRouter.js.map +1 -0
- package/dist/components/sandbox/SandboxRuntimeProvider.d.ts +48 -0
- package/dist/components/sandbox/SandboxRuntimeProvider.d.ts.map +1 -0
- package/dist/components/sandbox/SandboxRuntimeProvider.js +2 -0
- package/dist/components/sandbox/SandboxRuntimeProvider.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 +79 -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 +576 -0
- package/dist/dialogs/AttachmentOverlay.js.map +1 -0
- package/dist/dialogs/CustomProviderDialog.d.ts +25 -0
- package/dist/dialogs/CustomProviderDialog.d.ts.map +1 -0
- package/dist/dialogs/CustomProviderDialog.js +270 -0
- package/dist/dialogs/CustomProviderDialog.js.map +1 -0
- package/dist/dialogs/ModelSelector.d.ts +28 -0
- package/dist/dialogs/ModelSelector.d.ts.map +1 -0
- package/dist/dialogs/ModelSelector.js +368 -0
- package/dist/dialogs/ModelSelector.js.map +1 -0
- package/dist/dialogs/PersistentStorageDialog.d.ts +17 -0
- package/dist/dialogs/PersistentStorageDialog.d.ts.map +1 -0
- package/dist/dialogs/PersistentStorageDialog.js +147 -0
- package/dist/dialogs/PersistentStorageDialog.js.map +1 -0
- package/dist/dialogs/ProvidersModelsTab.d.ts +20 -0
- package/dist/dialogs/ProvidersModelsTab.d.ts.map +1 -0
- package/dist/dialogs/ProvidersModelsTab.js +191 -0
- package/dist/dialogs/ProvidersModelsTab.js.map +1 -0
- package/dist/dialogs/SessionListDialog.d.ts +19 -0
- package/dist/dialogs/SessionListDialog.d.ts.map +1 -0
- package/dist/dialogs/SessionListDialog.js +154 -0
- package/dist/dialogs/SessionListDialog.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 +231 -0
- package/dist/dialogs/SettingsDialog.js.map +1 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +71 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/prompts.d.ts +11 -0
- package/dist/prompts/prompts.d.ts.map +1 -0
- package/dist/prompts/prompts.js +272 -0
- package/dist/prompts/prompts.js.map +1 -0
- package/dist/storage/app-storage.d.ts +33 -0
- package/dist/storage/app-storage.d.ts.map +1 -0
- package/dist/storage/app-storage.js +38 -0
- package/dist/storage/app-storage.js.map +1 -0
- package/dist/storage/backends/indexeddb-storage-backend.d.ts +27 -0
- package/dist/storage/backends/indexeddb-storage-backend.d.ts.map +1 -0
- package/dist/storage/backends/indexeddb-storage-backend.js +166 -0
- package/dist/storage/backends/indexeddb-storage-backend.js.map +1 -0
- package/dist/storage/store.d.ts +23 -0
- package/dist/storage/store.d.ts.map +1 -0
- package/dist/storage/store.js +26 -0
- package/dist/storage/store.js.map +1 -0
- package/dist/storage/stores/custom-providers-store.d.ts +25 -0
- package/dist/storage/stores/custom-providers-store.d.ts.map +1 -0
- package/dist/storage/stores/custom-providers-store.js +35 -0
- package/dist/storage/stores/custom-providers-store.js.map +1 -0
- package/dist/storage/stores/provider-keys-store.d.ts +14 -0
- package/dist/storage/stores/provider-keys-store.d.ts.map +1 -0
- package/dist/storage/stores/provider-keys-store.js +27 -0
- package/dist/storage/stores/provider-keys-store.js.map +1 -0
- package/dist/storage/stores/sessions-store.d.ts +32 -0
- package/dist/storage/stores/sessions-store.d.ts.map +1 -0
- package/dist/storage/stores/sessions-store.js +113 -0
- package/dist/storage/stores/sessions-store.js.map +1 -0
- package/dist/storage/stores/settings-store.d.ts +14 -0
- package/dist/storage/stores/settings-store.d.ts.map +1 -0
- package/dist/storage/stores/settings-store.js +28 -0
- package/dist/storage/stores/settings-store.js.map +1 -0
- package/dist/storage/types.d.ts +176 -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 +9 -0
- package/dist/tools/artifacts/ArtifactElement.d.ts.map +1 -0
- package/dist/tools/artifacts/ArtifactElement.js +11 -0
- package/dist/tools/artifacts/ArtifactElement.js.map +1 -0
- package/dist/tools/artifacts/ArtifactPill.d.ts +4 -0
- package/dist/tools/artifacts/ArtifactPill.d.ts.map +1 -0
- package/dist/tools/artifacts/ArtifactPill.js +23 -0
- package/dist/tools/artifacts/ArtifactPill.js.map +1 -0
- package/dist/tools/artifacts/Console.d.ts +18 -0
- package/dist/tools/artifacts/Console.d.ts.map +1 -0
- package/dist/tools/artifacts/Console.js +95 -0
- package/dist/tools/artifacts/Console.js.map +1 -0
- package/dist/tools/artifacts/DocxArtifact.d.ts +22 -0
- package/dist/tools/artifacts/DocxArtifact.d.ts.map +1 -0
- package/dist/tools/artifacts/DocxArtifact.js +208 -0
- package/dist/tools/artifacts/DocxArtifact.js.map +1 -0
- package/dist/tools/artifacts/ExcelArtifact.d.ts +24 -0
- package/dist/tools/artifacts/ExcelArtifact.d.ts.map +1 -0
- package/dist/tools/artifacts/ExcelArtifact.js +216 -0
- package/dist/tools/artifacts/ExcelArtifact.js.map +1 -0
- package/dist/tools/artifacts/GenericArtifact.d.ts +19 -0
- package/dist/tools/artifacts/GenericArtifact.d.ts.map +1 -0
- package/dist/tools/artifacts/GenericArtifact.js +117 -0
- package/dist/tools/artifacts/GenericArtifact.js.map +1 -0
- package/dist/tools/artifacts/HtmlArtifact.d.ts +27 -0
- package/dist/tools/artifacts/HtmlArtifact.d.ts.map +1 -0
- package/dist/tools/artifacts/HtmlArtifact.js +189 -0
- package/dist/tools/artifacts/HtmlArtifact.js.map +1 -0
- package/dist/tools/artifacts/ImageArtifact.d.ts +20 -0
- package/dist/tools/artifacts/ImageArtifact.d.ts.map +1 -0
- package/dist/tools/artifacts/ImageArtifact.js +120 -0
- package/dist/tools/artifacts/ImageArtifact.js.map +1 -0
- package/dist/tools/artifacts/MarkdownArtifact.d.ts +19 -0
- package/dist/tools/artifacts/MarkdownArtifact.d.ts.map +1 -0
- package/dist/tools/artifacts/MarkdownArtifact.js +82 -0
- package/dist/tools/artifacts/MarkdownArtifact.js.map +1 -0
- package/dist/tools/artifacts/PdfArtifact.d.ts +25 -0
- package/dist/tools/artifacts/PdfArtifact.d.ts.map +1 -0
- package/dist/tools/artifacts/PdfArtifact.js +184 -0
- package/dist/tools/artifacts/PdfArtifact.js.map +1 -0
- package/dist/tools/artifacts/SvgArtifact.d.ts +18 -0
- package/dist/tools/artifacts/SvgArtifact.d.ts.map +1 -0
- package/dist/tools/artifacts/SvgArtifact.js +78 -0
- package/dist/tools/artifacts/SvgArtifact.js.map +1 -0
- package/dist/tools/artifacts/TextArtifact.d.ts +19 -0
- package/dist/tools/artifacts/TextArtifact.d.ts.map +1 -0
- package/dist/tools/artifacts/TextArtifact.js +144 -0
- package/dist/tools/artifacts/TextArtifact.js.map +1 -0
- package/dist/tools/artifacts/artifacts-tool-renderer.d.ts +11 -0
- package/dist/tools/artifacts/artifacts-tool-renderer.d.ts.map +1 -0
- package/dist/tools/artifacts/artifacts-tool-renderer.js +272 -0
- package/dist/tools/artifacts/artifacts-tool-renderer.js.map +1 -0
- package/dist/tools/artifacts/artifacts.d.ts +63 -0
- package/dist/tools/artifacts/artifacts.d.ts.map +1 -0
- package/dist/tools/artifacts/artifacts.js +659 -0
- package/dist/tools/artifacts/artifacts.js.map +1 -0
- package/dist/tools/artifacts/index.d.ts +8 -0
- package/dist/tools/artifacts/index.d.ts.map +1 -0
- package/dist/tools/artifacts/index.js +8 -0
- package/dist/tools/artifacts/index.js.map +1 -0
- package/dist/tools/extract-document.d.ts +24 -0
- package/dist/tools/extract-document.d.ts.map +1 -0
- package/dist/tools/extract-document.js +216 -0
- package/dist/tools/extract-document.js.map +1 -0
- package/dist/tools/index.d.ts +16 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +33 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/javascript-repl.d.ts +44 -0
- package/dist/tools/javascript-repl.d.ts.map +1 -0
- package/dist/tools/javascript-repl.js +224 -0
- package/dist/tools/javascript-repl.js.map +1 -0
- package/dist/tools/renderer-registry.d.ts +23 -0
- package/dist/tools/renderer-registry.d.ts.map +1 -0
- package/dist/tools/renderer-registry.js +107 -0
- package/dist/tools/renderer-registry.js.map +1 -0
- package/dist/tools/renderers/BashRenderer.d.ts +10 -0
- package/dist/tools/renderers/BashRenderer.d.ts.map +1 -0
- package/dist/tools/renderers/BashRenderer.js +42 -0
- package/dist/tools/renderers/BashRenderer.js.map +1 -0
- package/dist/tools/renderers/CalculateRenderer.d.ts +10 -0
- package/dist/tools/renderers/CalculateRenderer.d.ts.map +1 -0
- package/dist/tools/renderers/CalculateRenderer.js +45 -0
- package/dist/tools/renderers/CalculateRenderer.js.map +1 -0
- package/dist/tools/renderers/DefaultRenderer.d.ts +6 -0
- package/dist/tools/renderers/DefaultRenderer.d.ts.map +1 -0
- package/dist/tools/renderers/DefaultRenderer.js +94 -0
- package/dist/tools/renderers/DefaultRenderer.js.map +1 -0
- package/dist/tools/renderers/GetCurrentTimeRenderer.d.ts +10 -0
- package/dist/tools/renderers/GetCurrentTimeRenderer.d.ts.map +1 -0
- package/dist/tools/renderers/GetCurrentTimeRenderer.js +72 -0
- package/dist/tools/renderers/GetCurrentTimeRenderer.js.map +1 -0
- package/dist/tools/types.d.ts +10 -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 +636 -0
- package/dist/utils/i18n.d.ts.map +1 -0
- package/dist/utils/i18n.js +418 -0
- package/dist/utils/i18n.js.map +1 -0
- package/dist/utils/model-discovery.d.ts +38 -0
- package/dist/utils/model-discovery.d.ts.map +1 -0
- package/dist/utils/model-discovery.js +243 -0
- package/dist/utils/model-discovery.js.map +1 -0
- package/dist/utils/proxy-utils.d.ts +45 -0
- package/dist/utils/proxy-utils.d.ts.map +1 -0
- package/dist/utils/proxy-utils.js +120 -0
- package/dist/utils/proxy-utils.js.map +1 -0
- package/dist/utils/test-sessions.d.ts +359 -0
- package/dist/utils/test-sessions.d.ts.map +1 -0
- package/dist/utils/test-sessions.js +2325 -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.json +25 -0
- package/example/src/app.css +1 -0
- package/example/src/custom-messages.ts +99 -0
- package/example/src/main.ts +421 -0
- package/example/tsconfig.json +23 -0
- package/example/vite.config.ts +6 -0
- package/package.json +51 -0
- package/scripts/count-prompt-tokens.ts +88 -0
- package/src/ChatPanel.ts +209 -0
- package/src/app.css +68 -0
- package/src/components/AgentInterface.ts +403 -0
- package/src/components/AttachmentTile.ts +107 -0
- package/src/components/ConsoleBlock.ts +72 -0
- package/src/components/CustomProviderCard.ts +100 -0
- package/src/components/ExpandableSection.ts +46 -0
- package/src/components/Input.ts +113 -0
- package/src/components/MessageEditor.ts +402 -0
- package/src/components/MessageList.ts +98 -0
- package/src/components/Messages.ts +384 -0
- package/src/components/ProviderKeyInput.ts +153 -0
- package/src/components/SandboxedIframe.ts +626 -0
- package/src/components/StreamingMessageContainer.ts +103 -0
- package/src/components/ThinkingBlock.ts +43 -0
- package/src/components/message-renderer-registry.ts +28 -0
- package/src/components/sandbox/ArtifactsRuntimeProvider.ts +220 -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 +636 -0
- package/src/dialogs/CustomProviderDialog.ts +274 -0
- package/src/dialogs/ModelSelector.ts +367 -0
- package/src/dialogs/PersistentStorageDialog.ts +144 -0
- package/src/dialogs/ProvidersModelsTab.ts +212 -0
- package/src/dialogs/SessionListDialog.ts +150 -0
- package/src/dialogs/SettingsDialog.ts +218 -0
- package/src/index.ts +120 -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 +93 -0
- package/src/tools/artifacts/DocxArtifact.ts +213 -0
- package/src/tools/artifacts/ExcelArtifact.ts +231 -0
- package/src/tools/artifacts/GenericArtifact.ts +117 -0
- package/src/tools/artifacts/HtmlArtifact.ts +195 -0
- package/src/tools/artifacts/ImageArtifact.ts +116 -0
- package/src/tools/artifacts/MarkdownArtifact.ts +82 -0
- package/src/tools/artifacts/PdfArtifact.ts +201 -0
- package/src/tools/artifacts/SvgArtifact.ts +78 -0
- package/src/tools/artifacts/TextArtifact.ts +148 -0
- package/src/tools/artifacts/artifacts-tool-renderer.ts +310 -0
- package/src/tools/artifacts/artifacts.ts +713 -0
- package/src/tools/artifacts/index.ts +7 -0
- package/src/tools/extract-document.ts +275 -0
- package/src/tools/index.ts +46 -0
- package/src/tools/javascript-repl.ts +293 -0
- package/src/tools/renderer-registry.ts +130 -0
- package/src/tools/renderers/BashRenderer.ts +52 -0
- package/src/tools/renderers/CalculateRenderer.ts +58 -0
- package/src/tools/renderers/DefaultRenderer.ts +103 -0
- package/src/tools/renderers/GetCurrentTimeRenderer.ts +92 -0
- package/src/tools/types.ts +15 -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 +653 -0
- package/src/utils/model-discovery.ts +277 -0
- package/src/utils/proxy-utils.ts +139 -0
- package/src/utils/test-sessions.ts +2357 -0
- package/tsconfig.build.json +26 -0
- package/tsconfig.json +13 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export type { Agent, AgentMessage, AgentState, ThinkingLevel } from "@ouhuang/pi-agent-core";
|
|
2
|
+
export type { Model } from "@ouhuang/pi-ai";
|
|
3
|
+
export { ChatPanel } from "./ChatPanel.js";
|
|
4
|
+
export { AgentInterface } from "./components/AgentInterface.js";
|
|
5
|
+
export { AttachmentTile } from "./components/AttachmentTile.js";
|
|
6
|
+
export { ConsoleBlock } from "./components/ConsoleBlock.js";
|
|
7
|
+
export { CustomProviderCard } from "./components/CustomProviderCard.js";
|
|
8
|
+
export { ExpandableSection } from "./components/ExpandableSection.js";
|
|
9
|
+
export { Input } from "./components/Input.js";
|
|
10
|
+
export { MessageEditor } from "./components/MessageEditor.js";
|
|
11
|
+
export { MessageList } from "./components/MessageList.js";
|
|
12
|
+
export type { ArtifactMessage, UserMessageWithAttachments } from "./components/Messages.js";
|
|
13
|
+
export { AbortedMessage, AssistantMessage, convertAttachments, defaultConvertToLlm, isArtifactMessage, isUserMessageWithAttachments, ToolMessage, ToolMessageDebugView, UserMessage, } from "./components/Messages.js";
|
|
14
|
+
export { getMessageRenderer, type MessageRenderer, type MessageRole, registerMessageRenderer, renderMessage, } from "./components/message-renderer-registry.js";
|
|
15
|
+
export { ProviderKeyInput } from "./components/ProviderKeyInput.js";
|
|
16
|
+
export { type SandboxFile, SandboxIframe, type SandboxResult, type SandboxUrlProvider, } from "./components/SandboxedIframe.js";
|
|
17
|
+
export { StreamingMessageContainer } from "./components/StreamingMessageContainer.js";
|
|
18
|
+
export { ArtifactsRuntimeProvider } from "./components/sandbox/ArtifactsRuntimeProvider.js";
|
|
19
|
+
export { AttachmentsRuntimeProvider } from "./components/sandbox/AttachmentsRuntimeProvider.js";
|
|
20
|
+
export { type ConsoleLog, ConsoleRuntimeProvider } from "./components/sandbox/ConsoleRuntimeProvider.js";
|
|
21
|
+
export { type DownloadableFile, FileDownloadRuntimeProvider, } from "./components/sandbox/FileDownloadRuntimeProvider.js";
|
|
22
|
+
export { RuntimeMessageBridge } from "./components/sandbox/RuntimeMessageBridge.js";
|
|
23
|
+
export { RUNTIME_MESSAGE_ROUTER } from "./components/sandbox/RuntimeMessageRouter.js";
|
|
24
|
+
export type { SandboxRuntimeProvider } from "./components/sandbox/SandboxRuntimeProvider.js";
|
|
25
|
+
export { ThinkingBlock } from "./components/ThinkingBlock.js";
|
|
26
|
+
export { ApiKeyPromptDialog } from "./dialogs/ApiKeyPromptDialog.js";
|
|
27
|
+
export { AttachmentOverlay } from "./dialogs/AttachmentOverlay.js";
|
|
28
|
+
export { CustomProviderDialog } from "./dialogs/CustomProviderDialog.js";
|
|
29
|
+
export { ModelSelector } from "./dialogs/ModelSelector.js";
|
|
30
|
+
export { PersistentStorageDialog } from "./dialogs/PersistentStorageDialog.js";
|
|
31
|
+
export { ProvidersModelsTab } from "./dialogs/ProvidersModelsTab.js";
|
|
32
|
+
export { SessionListDialog } from "./dialogs/SessionListDialog.js";
|
|
33
|
+
export { ApiKeysTab, ProxyTab, SettingsDialog, SettingsTab } from "./dialogs/SettingsDialog.js";
|
|
34
|
+
export { ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RO, ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RW, ATTACHMENTS_RUNTIME_DESCRIPTION, } from "./prompts/prompts.js";
|
|
35
|
+
export { AppStorage, getAppStorage, setAppStorage } from "./storage/app-storage.js";
|
|
36
|
+
export { IndexedDBStorageBackend } from "./storage/backends/indexeddb-storage-backend.js";
|
|
37
|
+
export { Store } from "./storage/store.js";
|
|
38
|
+
export type { AutoDiscoveryProviderType, CustomProvider, CustomProviderType, } from "./storage/stores/custom-providers-store.js";
|
|
39
|
+
export { CustomProvidersStore } from "./storage/stores/custom-providers-store.js";
|
|
40
|
+
export { ProviderKeysStore } from "./storage/stores/provider-keys-store.js";
|
|
41
|
+
export { SessionsStore } from "./storage/stores/sessions-store.js";
|
|
42
|
+
export { SettingsStore } from "./storage/stores/settings-store.js";
|
|
43
|
+
export type { IndexConfig, IndexedDBConfig, SessionData, SessionMetadata, StorageBackend, StorageTransaction, StoreConfig, } from "./storage/types.js";
|
|
44
|
+
export { ArtifactElement } from "./tools/artifacts/ArtifactElement.js";
|
|
45
|
+
export { ArtifactPill } from "./tools/artifacts/ArtifactPill.js";
|
|
46
|
+
export { type Artifact, ArtifactsPanel, type ArtifactsParams } from "./tools/artifacts/artifacts.js";
|
|
47
|
+
export { ArtifactsToolRenderer } from "./tools/artifacts/artifacts-tool-renderer.js";
|
|
48
|
+
export { HtmlArtifact } from "./tools/artifacts/HtmlArtifact.js";
|
|
49
|
+
export { ImageArtifact } from "./tools/artifacts/ImageArtifact.js";
|
|
50
|
+
export { MarkdownArtifact } from "./tools/artifacts/MarkdownArtifact.js";
|
|
51
|
+
export { SvgArtifact } from "./tools/artifacts/SvgArtifact.js";
|
|
52
|
+
export { TextArtifact } from "./tools/artifacts/TextArtifact.js";
|
|
53
|
+
export { createExtractDocumentTool, extractDocumentTool } from "./tools/extract-document.js";
|
|
54
|
+
export { getToolRenderer, registerToolRenderer, renderTool, setShowJsonMode } from "./tools/index.js";
|
|
55
|
+
export { createJavaScriptReplTool, javascriptReplTool } from "./tools/javascript-repl.js";
|
|
56
|
+
export { renderCollapsibleHeader, renderHeader } from "./tools/renderer-registry.js";
|
|
57
|
+
export { BashRenderer } from "./tools/renderers/BashRenderer.js";
|
|
58
|
+
export { CalculateRenderer } from "./tools/renderers/CalculateRenderer.js";
|
|
59
|
+
export { DefaultRenderer } from "./tools/renderers/DefaultRenderer.js";
|
|
60
|
+
export { GetCurrentTimeRenderer } from "./tools/renderers/GetCurrentTimeRenderer.js";
|
|
61
|
+
export type { ToolRenderer, ToolRenderResult } from "./tools/types.js";
|
|
62
|
+
export type { Attachment } from "./utils/attachment-utils.js";
|
|
63
|
+
export { loadAttachment } from "./utils/attachment-utils.js";
|
|
64
|
+
export { clearAuthToken, getAuthToken } from "./utils/auth-token.js";
|
|
65
|
+
export { formatCost, formatModelCost, formatTokenCount, formatUsage } from "./utils/format.js";
|
|
66
|
+
export { i18n, setLanguage, translations } from "./utils/i18n.js";
|
|
67
|
+
export { applyProxyIfNeeded, createStreamFn, isCorsError, shouldUseProxyForProvider } from "./utils/proxy-utils.js";
|
|
68
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC7F,YAAY,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,YAAY,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAC5F,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,4BAA4B,EAC5B,WAAW,EACX,oBAAoB,EACpB,WAAW,GACX,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACN,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,uBAAuB,EACvB,aAAa,GACb,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,O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C;AAC1F,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACvE,YAAY,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC/F,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Main chat interface
|
|
2
|
+
export { ChatPanel } from "./ChatPanel.js";
|
|
3
|
+
// Components
|
|
4
|
+
export { AgentInterface } from "./components/AgentInterface.js";
|
|
5
|
+
export { AttachmentTile } from "./components/AttachmentTile.js";
|
|
6
|
+
export { ConsoleBlock } from "./components/ConsoleBlock.js";
|
|
7
|
+
export { CustomProviderCard } from "./components/CustomProviderCard.js";
|
|
8
|
+
export { ExpandableSection } from "./components/ExpandableSection.js";
|
|
9
|
+
export { Input } from "./components/Input.js";
|
|
10
|
+
export { MessageEditor } from "./components/MessageEditor.js";
|
|
11
|
+
export { MessageList } from "./components/MessageList.js";
|
|
12
|
+
export { AbortedMessage, AssistantMessage, convertAttachments, defaultConvertToLlm, isArtifactMessage, isUserMessageWithAttachments, ToolMessage, ToolMessageDebugView, UserMessage, } from "./components/Messages.js";
|
|
13
|
+
// Message renderer registry
|
|
14
|
+
export { getMessageRenderer, registerMessageRenderer, renderMessage, } from "./components/message-renderer-registry.js";
|
|
15
|
+
export { ProviderKeyInput } from "./components/ProviderKeyInput.js";
|
|
16
|
+
export { SandboxIframe, } from "./components/SandboxedIframe.js";
|
|
17
|
+
export { StreamingMessageContainer } from "./components/StreamingMessageContainer.js";
|
|
18
|
+
// Sandbox Runtime Providers
|
|
19
|
+
export { ArtifactsRuntimeProvider } from "./components/sandbox/ArtifactsRuntimeProvider.js";
|
|
20
|
+
export { AttachmentsRuntimeProvider } from "./components/sandbox/AttachmentsRuntimeProvider.js";
|
|
21
|
+
export { ConsoleRuntimeProvider } from "./components/sandbox/ConsoleRuntimeProvider.js";
|
|
22
|
+
export { FileDownloadRuntimeProvider, } from "./components/sandbox/FileDownloadRuntimeProvider.js";
|
|
23
|
+
export { RuntimeMessageBridge } from "./components/sandbox/RuntimeMessageBridge.js";
|
|
24
|
+
export { RUNTIME_MESSAGE_ROUTER } from "./components/sandbox/RuntimeMessageRouter.js";
|
|
25
|
+
export { ThinkingBlock } from "./components/ThinkingBlock.js";
|
|
26
|
+
export { ApiKeyPromptDialog } from "./dialogs/ApiKeyPromptDialog.js";
|
|
27
|
+
export { AttachmentOverlay } from "./dialogs/AttachmentOverlay.js";
|
|
28
|
+
export { CustomProviderDialog } from "./dialogs/CustomProviderDialog.js";
|
|
29
|
+
// Dialogs
|
|
30
|
+
export { ModelSelector } from "./dialogs/ModelSelector.js";
|
|
31
|
+
export { PersistentStorageDialog } from "./dialogs/PersistentStorageDialog.js";
|
|
32
|
+
export { ProvidersModelsTab } from "./dialogs/ProvidersModelsTab.js";
|
|
33
|
+
export { SessionListDialog } from "./dialogs/SessionListDialog.js";
|
|
34
|
+
export { ApiKeysTab, ProxyTab, SettingsDialog, SettingsTab } from "./dialogs/SettingsDialog.js";
|
|
35
|
+
// Prompts
|
|
36
|
+
export { ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RO, ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RW, ATTACHMENTS_RUNTIME_DESCRIPTION, } from "./prompts/prompts.js";
|
|
37
|
+
// Storage
|
|
38
|
+
export { AppStorage, getAppStorage, setAppStorage } from "./storage/app-storage.js";
|
|
39
|
+
export { IndexedDBStorageBackend } from "./storage/backends/indexeddb-storage-backend.js";
|
|
40
|
+
export { Store } from "./storage/store.js";
|
|
41
|
+
export { CustomProvidersStore } from "./storage/stores/custom-providers-store.js";
|
|
42
|
+
export { ProviderKeysStore } from "./storage/stores/provider-keys-store.js";
|
|
43
|
+
export { SessionsStore } from "./storage/stores/sessions-store.js";
|
|
44
|
+
export { SettingsStore } from "./storage/stores/settings-store.js";
|
|
45
|
+
// Artifacts
|
|
46
|
+
export { ArtifactElement } from "./tools/artifacts/ArtifactElement.js";
|
|
47
|
+
export { ArtifactPill } from "./tools/artifacts/ArtifactPill.js";
|
|
48
|
+
export { ArtifactsPanel } from "./tools/artifacts/artifacts.js";
|
|
49
|
+
export { ArtifactsToolRenderer } from "./tools/artifacts/artifacts-tool-renderer.js";
|
|
50
|
+
export { HtmlArtifact } from "./tools/artifacts/HtmlArtifact.js";
|
|
51
|
+
export { ImageArtifact } from "./tools/artifacts/ImageArtifact.js";
|
|
52
|
+
export { MarkdownArtifact } from "./tools/artifacts/MarkdownArtifact.js";
|
|
53
|
+
export { SvgArtifact } from "./tools/artifacts/SvgArtifact.js";
|
|
54
|
+
export { TextArtifact } from "./tools/artifacts/TextArtifact.js";
|
|
55
|
+
export { createExtractDocumentTool, extractDocumentTool } from "./tools/extract-document.js";
|
|
56
|
+
// Tools
|
|
57
|
+
export { getToolRenderer, registerToolRenderer, renderTool, setShowJsonMode } from "./tools/index.js";
|
|
58
|
+
export { createJavaScriptReplTool, javascriptReplTool } from "./tools/javascript-repl.js";
|
|
59
|
+
export { renderCollapsibleHeader, renderHeader } from "./tools/renderer-registry.js";
|
|
60
|
+
export { BashRenderer } from "./tools/renderers/BashRenderer.js";
|
|
61
|
+
export { CalculateRenderer } from "./tools/renderers/CalculateRenderer.js";
|
|
62
|
+
// Tool renderers
|
|
63
|
+
export { DefaultRenderer } from "./tools/renderers/DefaultRenderer.js";
|
|
64
|
+
export { GetCurrentTimeRenderer } from "./tools/renderers/GetCurrentTimeRenderer.js";
|
|
65
|
+
// Utils
|
|
66
|
+
export { loadAttachment } from "./utils/attachment-utils.js";
|
|
67
|
+
export { clearAuthToken, getAuthToken } from "./utils/auth-token.js";
|
|
68
|
+
export { formatCost, formatModelCost, formatTokenCount, formatUsage } from "./utils/format.js";
|
|
69
|
+
export { i18n, setLanguage, translations } from "./utils/i18n.js";
|
|
70
|
+
export { applyProxyIfNeeded, createStreamFn, isCorsError, shouldUseProxyForProvider } from "./utils/proxy-utils.js";
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sBAAsB;AAItB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,aAAa;AACb,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAG1D,OAAO,EACN,cAAc,E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EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,iBAAiB;AACjB,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAGrF,QAAQ;AACR,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC/F,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized tool prompts/descriptions.
|
|
3
|
+
* Each prompt is either a string constant or a template function.
|
|
4
|
+
*/
|
|
5
|
+
export declare const JAVASCRIPT_REPL_TOOL_DESCRIPTION: (runtimeProviderDescriptions: string[]) => string;
|
|
6
|
+
export declare const ARTIFACTS_TOOL_DESCRIPTION: (runtimeProviderDescriptions: string[]) => string;
|
|
7
|
+
export declare const ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RW = "\n### Artifacts Storage\n\nCreate, read, update, and delete files in artifacts storage.\n\n#### When to Use\n- Store intermediate results between tool calls\n- Save generated files (images, CSVs, processed data) for user to view and download\n\n#### Do NOT Use For\n- Content you author directly, like summaries of content you read (use artifacts tool instead)\n\n#### Functions\n- listArtifacts() - List all artifact filenames, returns Promise<string[]>\n- getArtifact(filename) - Read artifact content, returns Promise<string | object>. JSON files auto-parse to objects, binary files return base64 string\n- createOrUpdateArtifact(filename, content, mimeType?) - Create or update artifact, returns Promise<void>. JSON files auto-stringify objects, binary requires base64 string with mimeType\n- deleteArtifact(filename) - Delete artifact, returns Promise<void>\n\n#### Example\nJSON workflow:\n```javascript\n// Fetch and save\nconst response = await fetch('https://api.example.com/products');\nconst products = await response.json();\nawait createOrUpdateArtifact('products.json', products);\n\n// Later: read and filter\nconst all = await getArtifact('products.json');\nconst cheap = all.filter(p => p.price < 100);\nawait createOrUpdateArtifact('cheap.json', cheap);\n```\n\nBinary file (image):\n```javascript\nconst canvas = document.createElement('canvas');\ncanvas.width = 800; canvas.height = 600;\nconst ctx = canvas.getContext('2d');\nctx.fillStyle = 'blue';\nctx.fillRect(0, 0, 800, 600);\n// Remove data:image/png;base64, prefix\nconst base64 = canvas.toDataURL().split(',')[1];\nawait createOrUpdateArtifact('chart.png', base64, 'image/png');\n```\n";
|
|
8
|
+
export declare const ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RO = "\n### Artifacts Storage\n\nRead files from artifacts storage.\n\n#### When to Use\n- Read artifacts created by REPL or artifacts tool\n- Access data from other HTML artifacts\n- Load configuration or data files\n\n#### Do NOT Use For\n- Creating new artifacts (not available in HTML artifacts)\n- Modifying artifacts (read-only access)\n\n#### Functions\n- listArtifacts() - List all artifact filenames, returns Promise<string[]>\n- getArtifact(filename) - Read artifact content, returns Promise<string | object>. JSON files auto-parse to objects, binary files return base64 string\n\n#### Example\nJSON data:\n```javascript\nconst products = await getArtifact('products.json');\nconst html = products.map(p => `<div>${p.name}: $${p.price}</div>`).join('');\ndocument.body.innerHTML = html;\n```\n\nBinary image:\n```javascript\nconst base64 = await getArtifact('chart.png');\nconst img = document.createElement('img');\nimg.src = 'data:image/png;base64,' + base64;\ndocument.body.appendChild(img);\n```\n";
|
|
9
|
+
export declare const ATTACHMENTS_RUNTIME_DESCRIPTION = "\n### User Attachments\n\nRead files the user uploaded to the conversation.\n\n#### When to Use\n- Process user-uploaded files (CSV, JSON, Excel, images, PDFs)\n\n#### Functions\n- listAttachments() - List all attachments, returns array of {id, fileName, mimeType, size}\n- readTextAttachment(id) - Read attachment as text, returns string\n- readBinaryAttachment(id) - Read attachment as binary data, returns Uint8Array\n\n#### Example\nCSV file:\n```javascript\nconst files = listAttachments();\nconst csvFile = files.find(f => f.fileName.endsWith('.csv'));\nconst csvData = readTextAttachment(csvFile.id);\nconst rows = csvData.split('\\n').map(row => row.split(','));\n```\n\nExcel file:\n```javascript\nconst XLSX = await import('https://esm.run/xlsx');\nconst files = listAttachments();\nconst xlsxFile = files.find(f => f.fileName.endsWith('.xlsx'));\nconst bytes = readBinaryAttachment(xlsxFile.id);\nconst workbook = XLSX.read(bytes);\nconst data = XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]]);\n```\n";
|
|
10
|
+
export declare const EXTRACT_DOCUMENT_DESCRIPTION = "# Extract Document\n\nExtract plain text from documents on the web (PDF, DOCX, XLSX, PPTX).\n\n## When to Use\nUser wants you to read a document at a URL.\n\n## Input\n- { url: \"https://example.com/document.pdf\" } - URL to PDF, DOCX, XLSX, or PPTX\n\n## Returns\nStructured plain text with page/sheet/slide delimiters.";
|
|
11
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/prompts/prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,eAAO,MAAM,gCAAgC,GAAI,6BAA6B,MAAM,EAAE,WAsDrF,CAAC;AAMF,eAAO,MAAM,0BAA0B,GAAI,6BAA6B,MAAM,EAAE,WA0E/E,CAAC;AAMF,eAAO,MAAM,yCAAyC,qoDA2CrD,CAAC;AAEF,eAAO,MAAM,yCAAyC,k/BAiCrD,CAAC;AAMF,eAAO,MAAM,+BAA+B,2gCA+B3C,CAAC;AAMF,eAAO,MAAM,4BAA4B,qUAWe,CAAC"}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized tool prompts/descriptions.
|
|
3
|
+
* Each prompt is either a string constant or a template function.
|
|
4
|
+
*/
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// JavaScript REPL Tool
|
|
7
|
+
// ============================================================================
|
|
8
|
+
export const JAVASCRIPT_REPL_TOOL_DESCRIPTION = (runtimeProviderDescriptions) => `# JavaScript REPL
|
|
9
|
+
|
|
10
|
+
## Purpose
|
|
11
|
+
Execute JavaScript code in a sandboxed browser environment with full Web APIs.
|
|
12
|
+
|
|
13
|
+
## When to Use
|
|
14
|
+
- Quick calculations or data transformations
|
|
15
|
+
- Testing JavaScript code snippets in isolation
|
|
16
|
+
- Processing data with libraries (XLSX, CSV, etc.)
|
|
17
|
+
- Creating artifacts from data
|
|
18
|
+
|
|
19
|
+
## Environment
|
|
20
|
+
- ES2023+ JavaScript (async/await, optional chaining, nullish coalescing, etc.)
|
|
21
|
+
- All browser APIs: DOM, Canvas, WebGL, Fetch, Web Workers, WebSockets, Crypto, etc.
|
|
22
|
+
- Import any npm package: await import('https://esm.run/package-name')
|
|
23
|
+
|
|
24
|
+
## Common Libraries
|
|
25
|
+
- XLSX: const XLSX = await import('https://esm.run/xlsx');
|
|
26
|
+
- CSV: const Papa = (await import('https://esm.run/papaparse')).default;
|
|
27
|
+
- Chart.js: const Chart = (await import('https://esm.run/chart.js/auto')).default;
|
|
28
|
+
- Three.js: const THREE = await import('https://esm.run/three');
|
|
29
|
+
|
|
30
|
+
## Persistence between tool calls
|
|
31
|
+
- Objects stored on global scope do not persist between calls.
|
|
32
|
+
- Use artifacts as a key-value JSON object store:
|
|
33
|
+
- Use createOrUpdateArtifact(filename, content) to persist data between calls. JSON objects are auto-stringified.
|
|
34
|
+
- Use listArtifacts() and getArtifact(filename) to read persisted data. JSON files are auto-parsed to objects.
|
|
35
|
+
- Prefer to use a single artifact throughout the session to store intermediate data (e.g. 'data.json').
|
|
36
|
+
|
|
37
|
+
## Input
|
|
38
|
+
- You have access to the user's attachments via listAttachments(), readTextAttachment(id), and readBinaryAttachment(id)
|
|
39
|
+
- You have access to previously created artifacts via listArtifacts() and getArtifact(filename)
|
|
40
|
+
|
|
41
|
+
## Output
|
|
42
|
+
- All console.log() calls are captured for you to inspect. The user does not see these logs.
|
|
43
|
+
- Create artifacts for file results (images, JSON, CSV, etc.) which persiste throughout the
|
|
44
|
+
session and are accessible to you and the user.
|
|
45
|
+
|
|
46
|
+
## Example
|
|
47
|
+
const data = [10, 20, 15, 25];
|
|
48
|
+
const sum = data.reduce((a, b) => a + b, 0);
|
|
49
|
+
const avg = sum / data.length;
|
|
50
|
+
console.log('Sum:', sum, 'Average:', avg);
|
|
51
|
+
|
|
52
|
+
## Important Notes
|
|
53
|
+
- Graphics: Use fixed dimensions (800x600), NOT window.innerWidth/Height
|
|
54
|
+
- Chart.js: Set options: { responsive: false, animation: false }
|
|
55
|
+
- Three.js: renderer.setSize(800, 600) with matching aspect ratio
|
|
56
|
+
|
|
57
|
+
## Helper Functions (Automatically Available)
|
|
58
|
+
|
|
59
|
+
These functions are injected into the execution environment and available globally:
|
|
60
|
+
|
|
61
|
+
${runtimeProviderDescriptions.join("\n\n")}
|
|
62
|
+
`;
|
|
63
|
+
// ============================================================================
|
|
64
|
+
// Artifacts Tool
|
|
65
|
+
// ============================================================================
|
|
66
|
+
export const ARTIFACTS_TOOL_DESCRIPTION = (runtimeProviderDescriptions) => `# Artifacts
|
|
67
|
+
|
|
68
|
+
Create and manage persistent files that live alongside the conversation.
|
|
69
|
+
|
|
70
|
+
## When to Use - Artifacts Tool vs REPL
|
|
71
|
+
|
|
72
|
+
**Use artifacts tool when YOU are the author:**
|
|
73
|
+
- Writing research summaries, analysis, ideas, documentation
|
|
74
|
+
- Creating markdown notes for user to read
|
|
75
|
+
- Building HTML applications/visualizations that present data
|
|
76
|
+
- Creating HTML artifacts that render charts from programmatically generated data
|
|
77
|
+
|
|
78
|
+
**Use repl + artifact storage functions when CODE processes data:**
|
|
79
|
+
- Scraping workflows that extract and store data
|
|
80
|
+
- Processing CSV/Excel files programmatically
|
|
81
|
+
- Data transformation pipelines
|
|
82
|
+
- Binary file generation requiring libraries (PDF, DOCX)
|
|
83
|
+
|
|
84
|
+
**Pattern: REPL generates data → Artifacts tool creates HTML that visualizes it**
|
|
85
|
+
Example: repl scrapes products → stores products.json → you author dashboard.html that reads products.json and renders Chart.js visualizations
|
|
86
|
+
|
|
87
|
+
## Input
|
|
88
|
+
- { action: "create", filename: "notes.md", content: "..." } - Create new file
|
|
89
|
+
- { action: "update", filename: "notes.md", old_str: "...", new_str: "..." } - Update part of file (PREFERRED)
|
|
90
|
+
- { action: "rewrite", filename: "notes.md", content: "..." } - Replace entire file (LAST RESORT)
|
|
91
|
+
- { action: "get", filename: "data.json" } - Retrieve file content
|
|
92
|
+
- { action: "delete", filename: "old.csv" } - Delete file
|
|
93
|
+
- { action: "htmlArtifactLogs", filename: "app.html" } - Get console logs from HTML artifact
|
|
94
|
+
|
|
95
|
+
## Returns
|
|
96
|
+
Depends on action:
|
|
97
|
+
- create/update/rewrite/delete: Success status or error
|
|
98
|
+
- get: File content
|
|
99
|
+
- htmlArtifactLogs: Console logs and errors
|
|
100
|
+
|
|
101
|
+
## Supported File Types
|
|
102
|
+
✅ Text-based files you author: .md, .txt, .html, .js, .css, .json, .csv, .svg
|
|
103
|
+
❌ Binary files requiring libraries (use repl): .pdf, .docx
|
|
104
|
+
|
|
105
|
+
## Critical - Prefer Update Over Rewrite
|
|
106
|
+
❌ NEVER: get entire file + rewrite to change small sections
|
|
107
|
+
✅ ALWAYS: update for targeted edits (token efficient)
|
|
108
|
+
✅ Ask: Can I describe the change as old_str → new_str? Use update.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## HTML Artifacts
|
|
113
|
+
|
|
114
|
+
Interactive HTML applications that can visualize data from other artifacts.
|
|
115
|
+
|
|
116
|
+
### Data Access
|
|
117
|
+
- Can read artifacts created by repl and user attachments
|
|
118
|
+
- Use to build dashboards, visualizations, interactive tools
|
|
119
|
+
- See Helper Functions section below for available functions
|
|
120
|
+
|
|
121
|
+
### Requirements
|
|
122
|
+
- Self-contained single file
|
|
123
|
+
- Import ES modules from esm.sh: <script type="module">import X from 'https://esm.sh/pkg';</script>
|
|
124
|
+
- Use Tailwind CDN: <script src="https://cdn.tailwindcss.com"></script>
|
|
125
|
+
- Can embed images from any domain: <img src="https://example.com/image.jpg">
|
|
126
|
+
- MUST set background color explicitly (avoid transparent)
|
|
127
|
+
- Inline CSS or Tailwind utility classes
|
|
128
|
+
- No localStorage/sessionStorage
|
|
129
|
+
|
|
130
|
+
### Styling
|
|
131
|
+
- Use Tailwind utility classes for clean, functional designs
|
|
132
|
+
- Ensure responsive layout (iframe may be resized)
|
|
133
|
+
- Avoid purple gradients, AI aesthetic clichés, and emojis
|
|
134
|
+
|
|
135
|
+
### Helper Functions (Automatically Available)
|
|
136
|
+
|
|
137
|
+
These functions are injected into HTML artifact sandbox:
|
|
138
|
+
|
|
139
|
+
${runtimeProviderDescriptions.join("\n\n")}
|
|
140
|
+
`;
|
|
141
|
+
// ============================================================================
|
|
142
|
+
// Artifacts Runtime Provider
|
|
143
|
+
// ============================================================================
|
|
144
|
+
export const ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RW = `
|
|
145
|
+
### Artifacts Storage
|
|
146
|
+
|
|
147
|
+
Create, read, update, and delete files in artifacts storage.
|
|
148
|
+
|
|
149
|
+
#### When to Use
|
|
150
|
+
- Store intermediate results between tool calls
|
|
151
|
+
- Save generated files (images, CSVs, processed data) for user to view and download
|
|
152
|
+
|
|
153
|
+
#### Do NOT Use For
|
|
154
|
+
- Content you author directly, like summaries of content you read (use artifacts tool instead)
|
|
155
|
+
|
|
156
|
+
#### Functions
|
|
157
|
+
- listArtifacts() - List all artifact filenames, returns Promise<string[]>
|
|
158
|
+
- getArtifact(filename) - Read artifact content, returns Promise<string | object>. JSON files auto-parse to objects, binary files return base64 string
|
|
159
|
+
- createOrUpdateArtifact(filename, content, mimeType?) - Create or update artifact, returns Promise<void>. JSON files auto-stringify objects, binary requires base64 string with mimeType
|
|
160
|
+
- deleteArtifact(filename) - Delete artifact, returns Promise<void>
|
|
161
|
+
|
|
162
|
+
#### Example
|
|
163
|
+
JSON workflow:
|
|
164
|
+
\`\`\`javascript
|
|
165
|
+
// Fetch and save
|
|
166
|
+
const response = await fetch('https://api.example.com/products');
|
|
167
|
+
const products = await response.json();
|
|
168
|
+
await createOrUpdateArtifact('products.json', products);
|
|
169
|
+
|
|
170
|
+
// Later: read and filter
|
|
171
|
+
const all = await getArtifact('products.json');
|
|
172
|
+
const cheap = all.filter(p => p.price < 100);
|
|
173
|
+
await createOrUpdateArtifact('cheap.json', cheap);
|
|
174
|
+
\`\`\`
|
|
175
|
+
|
|
176
|
+
Binary file (image):
|
|
177
|
+
\`\`\`javascript
|
|
178
|
+
const canvas = document.createElement('canvas');
|
|
179
|
+
canvas.width = 800; canvas.height = 600;
|
|
180
|
+
const ctx = canvas.getContext('2d');
|
|
181
|
+
ctx.fillStyle = 'blue';
|
|
182
|
+
ctx.fillRect(0, 0, 800, 600);
|
|
183
|
+
// Remove data:image/png;base64, prefix
|
|
184
|
+
const base64 = canvas.toDataURL().split(',')[1];
|
|
185
|
+
await createOrUpdateArtifact('chart.png', base64, 'image/png');
|
|
186
|
+
\`\`\`
|
|
187
|
+
`;
|
|
188
|
+
export const ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RO = `
|
|
189
|
+
### Artifacts Storage
|
|
190
|
+
|
|
191
|
+
Read files from artifacts storage.
|
|
192
|
+
|
|
193
|
+
#### When to Use
|
|
194
|
+
- Read artifacts created by REPL or artifacts tool
|
|
195
|
+
- Access data from other HTML artifacts
|
|
196
|
+
- Load configuration or data files
|
|
197
|
+
|
|
198
|
+
#### Do NOT Use For
|
|
199
|
+
- Creating new artifacts (not available in HTML artifacts)
|
|
200
|
+
- Modifying artifacts (read-only access)
|
|
201
|
+
|
|
202
|
+
#### Functions
|
|
203
|
+
- listArtifacts() - List all artifact filenames, returns Promise<string[]>
|
|
204
|
+
- getArtifact(filename) - Read artifact content, returns Promise<string | object>. JSON files auto-parse to objects, binary files return base64 string
|
|
205
|
+
|
|
206
|
+
#### Example
|
|
207
|
+
JSON data:
|
|
208
|
+
\`\`\`javascript
|
|
209
|
+
const products = await getArtifact('products.json');
|
|
210
|
+
const html = products.map(p => \`<div>\${p.name}: $\${p.price}</div>\`).join('');
|
|
211
|
+
document.body.innerHTML = html;
|
|
212
|
+
\`\`\`
|
|
213
|
+
|
|
214
|
+
Binary image:
|
|
215
|
+
\`\`\`javascript
|
|
216
|
+
const base64 = await getArtifact('chart.png');
|
|
217
|
+
const img = document.createElement('img');
|
|
218
|
+
img.src = 'data:image/png;base64,' + base64;
|
|
219
|
+
document.body.appendChild(img);
|
|
220
|
+
\`\`\`
|
|
221
|
+
`;
|
|
222
|
+
// ============================================================================
|
|
223
|
+
// Attachments Runtime Provider
|
|
224
|
+
// ============================================================================
|
|
225
|
+
export const ATTACHMENTS_RUNTIME_DESCRIPTION = `
|
|
226
|
+
### User Attachments
|
|
227
|
+
|
|
228
|
+
Read files the user uploaded to the conversation.
|
|
229
|
+
|
|
230
|
+
#### When to Use
|
|
231
|
+
- Process user-uploaded files (CSV, JSON, Excel, images, PDFs)
|
|
232
|
+
|
|
233
|
+
#### Functions
|
|
234
|
+
- listAttachments() - List all attachments, returns array of {id, fileName, mimeType, size}
|
|
235
|
+
- readTextAttachment(id) - Read attachment as text, returns string
|
|
236
|
+
- readBinaryAttachment(id) - Read attachment as binary data, returns Uint8Array
|
|
237
|
+
|
|
238
|
+
#### Example
|
|
239
|
+
CSV file:
|
|
240
|
+
\`\`\`javascript
|
|
241
|
+
const files = listAttachments();
|
|
242
|
+
const csvFile = files.find(f => f.fileName.endsWith('.csv'));
|
|
243
|
+
const csvData = readTextAttachment(csvFile.id);
|
|
244
|
+
const rows = csvData.split('\\n').map(row => row.split(','));
|
|
245
|
+
\`\`\`
|
|
246
|
+
|
|
247
|
+
Excel file:
|
|
248
|
+
\`\`\`javascript
|
|
249
|
+
const XLSX = await import('https://esm.run/xlsx');
|
|
250
|
+
const files = listAttachments();
|
|
251
|
+
const xlsxFile = files.find(f => f.fileName.endsWith('.xlsx'));
|
|
252
|
+
const bytes = readBinaryAttachment(xlsxFile.id);
|
|
253
|
+
const workbook = XLSX.read(bytes);
|
|
254
|
+
const data = XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]]);
|
|
255
|
+
\`\`\`
|
|
256
|
+
`;
|
|
257
|
+
// ============================================================================
|
|
258
|
+
// Extract Document Tool
|
|
259
|
+
// ============================================================================
|
|
260
|
+
export const EXTRACT_DOCUMENT_DESCRIPTION = `# Extract Document
|
|
261
|
+
|
|
262
|
+
Extract plain text from documents on the web (PDF, DOCX, XLSX, PPTX).
|
|
263
|
+
|
|
264
|
+
## When to Use
|
|
265
|
+
User wants you to read a document at a URL.
|
|
266
|
+
|
|
267
|
+
## Input
|
|
268
|
+
- { url: "https://example.com/document.pdf" } - URL to PDF, DOCX, XLSX, or PPTX
|
|
269
|
+
|
|
270
|
+
## Returns
|
|
271
|
+
Structured plain text with page/sheet/slide delimiters.`;
|
|
272
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/prompts/prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,2BAAqC,EAAE,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqDzF,2BAA2B,CAAC,IAAI,CAAC,MAAM,CAAC;CACzC,CAAC;AAEF,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,2BAAqC,EAAE,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyEnF,2BAA2B,CAAC,IAAI,CAAC,MAAM,CAAC;CACzC,CAAC;AAEF,+EAA+E;AAC/E,6BAA6B;AAC7B,+EAA+E;AAE/E,MAAM,CAAC,MAAM,yCAAyC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CxD,CAAC;AAEF,MAAM,CAAC,MAAM,yCAAyC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCxD,CAAC;AAEF,+EAA+E;AAC/E,+BAA+B;AAC/B,+EAA+E;AAE/E,MAAM,CAAC,MAAM,+BAA+B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+B9C,CAAC;AAEF,+EAA+E;AAC/E,wBAAwB;AACxB,+EAA+E;AAE/E,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;;;wDAWY,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { CustomProvidersStore } from "./stores/custom-providers-store.js";
|
|
2
|
+
import type { ProviderKeysStore } from "./stores/provider-keys-store.js";
|
|
3
|
+
import type { SessionsStore } from "./stores/sessions-store.js";
|
|
4
|
+
import type { SettingsStore } from "./stores/settings-store.js";
|
|
5
|
+
import type { StorageBackend } from "./types.js";
|
|
6
|
+
/**
|
|
7
|
+
* High-level storage API providing access to all storage operations.
|
|
8
|
+
* Subclasses can extend this to add domain-specific stores.
|
|
9
|
+
*/
|
|
10
|
+
export declare class AppStorage {
|
|
11
|
+
readonly backend: StorageBackend;
|
|
12
|
+
readonly settings: SettingsStore;
|
|
13
|
+
readonly providerKeys: ProviderKeysStore;
|
|
14
|
+
readonly sessions: SessionsStore;
|
|
15
|
+
readonly customProviders: CustomProvidersStore;
|
|
16
|
+
constructor(settings: SettingsStore, providerKeys: ProviderKeysStore, sessions: SessionsStore, customProviders: CustomProvidersStore, backend: StorageBackend);
|
|
17
|
+
getQuotaInfo(): Promise<{
|
|
18
|
+
usage: number;
|
|
19
|
+
quota: number;
|
|
20
|
+
percent: number;
|
|
21
|
+
}>;
|
|
22
|
+
requestPersistence(): Promise<boolean>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get the global AppStorage instance.
|
|
26
|
+
* Throws if not initialized.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getAppStorage(): AppStorage;
|
|
29
|
+
/**
|
|
30
|
+
* Set the global AppStorage instance.
|
|
31
|
+
*/
|
|
32
|
+
export declare function setAppStorage(storage: AppStorage): void;
|
|
33
|
+
//# sourceMappingURL=app-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-storage.d.ts","sourceRoot":"","sources":["../../src/storage/app-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;GAGG;AACH,qBAAa,UAAU;IACtB,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACzC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,oBAAoB,CAAC;gBAG9C,QAAQ,EAAE,aAAa,EACvB,YAAY,EAAE,iBAAiB,EAC/B,QAAQ,EAAE,aAAa,EACvB,eAAe,EAAE,oBAAoB,EACrC,OAAO,EAAE,cAAc;IASlB,YAAY,IAAI,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAI1E,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC;CAG5C;AAKD;;;GAGG;AACH,wBAAgB,aAAa,IAAI,UAAU,CAK1C;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAEvD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* High-level storage API providing access to all storage operations.
|
|
3
|
+
* Subclasses can extend this to add domain-specific stores.
|
|
4
|
+
*/
|
|
5
|
+
export class AppStorage {
|
|
6
|
+
constructor(settings, providerKeys, sessions, customProviders, backend) {
|
|
7
|
+
this.settings = settings;
|
|
8
|
+
this.providerKeys = providerKeys;
|
|
9
|
+
this.sessions = sessions;
|
|
10
|
+
this.customProviders = customProviders;
|
|
11
|
+
this.backend = backend;
|
|
12
|
+
}
|
|
13
|
+
async getQuotaInfo() {
|
|
14
|
+
return this.backend.getQuotaInfo();
|
|
15
|
+
}
|
|
16
|
+
async requestPersistence() {
|
|
17
|
+
return this.backend.requestPersistence();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
// Global instance management
|
|
21
|
+
let globalAppStorage = null;
|
|
22
|
+
/**
|
|
23
|
+
* Get the global AppStorage instance.
|
|
24
|
+
* Throws if not initialized.
|
|
25
|
+
*/
|
|
26
|
+
export function getAppStorage() {
|
|
27
|
+
if (!globalAppStorage) {
|
|
28
|
+
throw new Error("AppStorage not initialized. Call setAppStorage() first.");
|
|
29
|
+
}
|
|
30
|
+
return globalAppStorage;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Set the global AppStorage instance.
|
|
34
|
+
*/
|
|
35
|
+
export function setAppStorage(storage) {
|
|
36
|
+
globalAppStorage = storage;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=app-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-storage.js","sourceRoot":"","sources":["../../src/storage/app-storage.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,OAAO,UAAU;IAOtB,YACC,QAAuB,EACvB,YAA+B,EAC/B,QAAuB,EACvB,eAAqC,EACrC,OAAuB;QAEvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,YAAY;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,kBAAkB;QACvB,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAC1C,CAAC;CACD;AAED,6BAA6B;AAC7B,IAAI,gBAAgB,GAAsB,IAAI,CAAC;AAE/C;;;GAGG;AACH,MAAM,UAAU,aAAa;IAC5B,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,gBAAgB,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,OAAmB;IAChD,gBAAgB,GAAG,OAAO,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { IndexedDBConfig, StorageBackend, StorageTransaction } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* IndexedDB implementation of StorageBackend.
|
|
4
|
+
* Provides multi-store key-value storage with transactions and quota management.
|
|
5
|
+
*/
|
|
6
|
+
export declare class IndexedDBStorageBackend implements StorageBackend {
|
|
7
|
+
private config;
|
|
8
|
+
private dbPromise;
|
|
9
|
+
constructor(config: IndexedDBConfig);
|
|
10
|
+
private getDB;
|
|
11
|
+
private promisifyRequest;
|
|
12
|
+
get<T = unknown>(storeName: string, key: string): Promise<T | null>;
|
|
13
|
+
set<T = unknown>(storeName: string, key: string, value: T): Promise<void>;
|
|
14
|
+
delete(storeName: string, key: string): Promise<void>;
|
|
15
|
+
keys(storeName: string, prefix?: string): Promise<string[]>;
|
|
16
|
+
getAllFromIndex<T = unknown>(storeName: string, indexName: string, direction?: "asc" | "desc"): Promise<T[]>;
|
|
17
|
+
clear(storeName: string): Promise<void>;
|
|
18
|
+
has(storeName: string, key: string): Promise<boolean>;
|
|
19
|
+
transaction<T>(storeNames: string[], mode: "readonly" | "readwrite", operation: (tx: StorageTransaction) => Promise<T>): Promise<T>;
|
|
20
|
+
getQuotaInfo(): Promise<{
|
|
21
|
+
usage: number;
|
|
22
|
+
quota: number;
|
|
23
|
+
percent: number;
|
|
24
|
+
}>;
|
|
25
|
+
requestPersistence(): Promise<boolean>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=indexeddb-storage-backend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexeddb-storage-backend.d.ts","sourceRoot":"","sources":["../../../src/storage/backends/indexeddb-storage-backend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEvF;;;GAGG;AACH,qBAAa,uBAAwB,YAAW,cAAc;IAGjD,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,SAAS,CAAqC;gBAElC,MAAM,EAAE,eAAe;YAE7B,KAAK;IAoCnB,OAAO,CAAC,gBAAgB;IAOlB,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAA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