From 42d843297d00214837db9d3f961ff33c743592c9 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 6 Dec 2025 05:01:28 +0100 Subject: [PATCH] mac: bundle web chat assets --- apps/macos/Package.swift | 1 + .../Clawdis/Resources/WebChat/ChatPanel.d.ts | 29 + .../Resources/WebChat/ChatPanel.d.ts.map | 1 + .../Clawdis/Resources/WebChat/ChatPanel.js | 193 ++ .../Resources/WebChat/ChatPanel.js.map | 1 + .../Resources/WebChat/agent/agent.d.ts | 62 + .../Resources/WebChat/agent/agent.d.ts.map | 1 + .../Clawdis/Resources/WebChat/agent/agent.js | 272 ++ .../Resources/WebChat/agent/agent.js.map | 1 + .../agent/transports/AppTransport.d.ts | 11 + .../agent/transports/AppTransport.d.ts.map | 1 + .../WebChat/agent/transports/AppTransport.js | 318 +++ .../agent/transports/AppTransport.js.map | 1 + .../agent/transports/ProviderTransport.d.ts | 10 + .../transports/ProviderTransport.d.ts.map | 1 + .../agent/transports/ProviderTransport.js | 38 + .../agent/transports/ProviderTransport.js.map | 1 + .../WebChat/agent/transports/index.d.ts | 4 + .../WebChat/agent/transports/index.d.ts.map | 1 + .../WebChat/agent/transports/index.js | 4 + .../WebChat/agent/transports/index.js.map | 1 + .../WebChat/agent/transports/proxy-types.d.ts | 48 + .../agent/transports/proxy-types.d.ts.map | 1 + .../WebChat/agent/transports/proxy-types.js | 2 + .../agent/transports/proxy-types.js.map | 1 + .../WebChat/agent/transports/types.d.ts | 12 + .../WebChat/agent/transports/types.d.ts.map | 1 + .../WebChat/agent/transports/types.js | 2 + .../WebChat/agent/transports/types.js.map | 1 + .../Resources/WebChat/agent/types.d.ts | 15 + .../Resources/WebChat/agent/types.d.ts.map | 1 + .../Clawdis/Resources/WebChat/agent/types.js | 2 + .../Resources/WebChat/agent/types.js.map | 1 + .../Sources/Clawdis/Resources/WebChat/app.css | 2 + .../WebChat/components/AgentInterface.d.ts | 39 + .../components/AgentInterface.d.ts.map | 1 + .../WebChat/components/AgentInterface.js | 330 +++ .../WebChat/components/AgentInterface.js.map | 1 + .../WebChat/components/AttachmentTile.d.ts | 12 + .../components/AttachmentTile.d.ts.map | 1 + .../WebChat/components/AttachmentTile.js | 115 + .../WebChat/components/AttachmentTile.js.map | 1 + .../WebChat/components/ConsoleBlock.d.ts | 12 + .../WebChat/components/ConsoleBlock.d.ts.map | 1 + .../WebChat/components/ConsoleBlock.js | 84 + .../WebChat/components/ConsoleBlock.js.map | 1 + .../components/CustomProviderCard.d.ts | 17 + .../components/CustomProviderCard.d.ts.map | 1 + .../WebChat/components/CustomProviderCard.js | 110 + .../components/CustomProviderCard.js.map | 1 + .../WebChat/components/ExpandableSection.d.ts | 15 + .../components/ExpandableSection.d.ts.map | 1 + .../WebChat/components/ExpandableSection.js | 63 + .../components/ExpandableSection.js.map | 1 + .../Resources/WebChat/components/Input.d.ts | 26 + .../WebChat/components/Input.d.ts.map | 1 + .../Resources/WebChat/components/Input.js | 57 + .../Resources/WebChat/components/Input.js.map | 1 + .../WebChat/components/MessageEditor.d.ts | 43 + .../WebChat/components/MessageEditor.d.ts.map | 1 + .../WebChat/components/MessageEditor.js | 414 +++ .../WebChat/components/MessageEditor.js.map | 1 + .../WebChat/components/MessageList.d.ts | 15 + .../WebChat/components/MessageList.d.ts.map | 1 + .../WebChat/components/MessageList.js | 104 + .../WebChat/components/MessageList.js.map | 1 + .../WebChat/components/Messages.d.ts | 64 + .../WebChat/components/Messages.d.ts.map | 1 + .../Resources/WebChat/components/Messages.js | 275 ++ .../WebChat/components/Messages.js.map | 1 + .../WebChat/components/ProviderKeyInput.d.ts | 16 + .../components/ProviderKeyInput.d.ts.map | 1 + .../WebChat/components/ProviderKeyInput.js | 170 ++ .../components/ProviderKeyInput.js.map | 1 + .../WebChat/components/SandboxedIframe.d.ts | 85 + .../components/SandboxedIframe.d.ts.map | 1 + .../WebChat/components/SandboxedIframe.js | 511 ++++ .../WebChat/components/SandboxedIframe.js.map | 1 + .../components/StreamingMessageContainer.d.ts | 18 + .../StreamingMessageContainer.d.ts.map | 1 + .../components/StreamingMessageContainer.js | 117 + .../StreamingMessageContainer.js.map | 1 + .../WebChat/components/ThinkingBlock.d.ts | 11 + .../WebChat/components/ThinkingBlock.d.ts.map | 1 + .../WebChat/components/ThinkingBlock.js | 58 + .../WebChat/components/ThinkingBlock.js.map | 1 + .../components/message-renderer-registry.d.ts | 12 + .../message-renderer-registry.d.ts.map | 1 + .../components/message-renderer-registry.js | 12 + .../message-renderer-registry.js.map | 1 + .../sandbox/ArtifactsRuntimeProvider.d.ts | 35 + .../sandbox/ArtifactsRuntimeProvider.d.ts.map | 1 + .../sandbox/ArtifactsRuntimeProvider.js | 189 ++ .../sandbox/ArtifactsRuntimeProvider.js.map | 1 + .../sandbox/AttachmentsRuntimeProvider.d.ts | 17 + .../AttachmentsRuntimeProvider.d.ts.map | 1 + .../sandbox/AttachmentsRuntimeProvider.js | 64 + .../sandbox/AttachmentsRuntimeProvider.js.map | 1 + .../sandbox/ConsoleRuntimeProvider.d.ts | 42 + .../sandbox/ConsoleRuntimeProvider.d.ts.map | 1 + .../sandbox/ConsoleRuntimeProvider.js | 161 ++ .../sandbox/ConsoleRuntimeProvider.js.map | 1 + .../sandbox/FileDownloadRuntimeProvider.d.ts | 30 + .../FileDownloadRuntimeProvider.d.ts.map | 1 + .../sandbox/FileDownloadRuntimeProvider.js | 97 + .../FileDownloadRuntimeProvider.js.map | 1 + .../sandbox/RuntimeMessageBridge.d.ts | 19 + .../sandbox/RuntimeMessageBridge.d.ts.map | 1 + .../sandbox/RuntimeMessageBridge.js | 74 + .../sandbox/RuntimeMessageBridge.js.map | 1 + .../sandbox/RuntimeMessageRouter.d.ts | 65 + .../sandbox/RuntimeMessageRouter.d.ts.map | 1 + .../sandbox/RuntimeMessageRouter.js | 168 ++ .../sandbox/RuntimeMessageRouter.js.map | 1 + .../sandbox/SandboxRuntimeProvider.d.ts | 48 + .../sandbox/SandboxRuntimeProvider.d.ts.map | 1 + .../sandbox/SandboxRuntimeProvider.js | 2 + .../sandbox/SandboxRuntimeProvider.js.map | 1 + .../WebChat/dialogs/ApiKeyPromptDialog.d.ts | 15 + .../dialogs/ApiKeyPromptDialog.d.ts.map | 1 + .../WebChat/dialogs/ApiKeyPromptDialog.js | 79 + .../WebChat/dialogs/ApiKeyPromptDialog.js.map | 1 + .../WebChat/dialogs/AttachmentOverlay.d.ts | 32 + .../dialogs/AttachmentOverlay.d.ts.map | 1 + .../WebChat/dialogs/AttachmentOverlay.js | 576 +++++ .../WebChat/dialogs/AttachmentOverlay.js.map | 1 + .../WebChat/dialogs/CustomProviderDialog.d.ts | 25 + .../dialogs/CustomProviderDialog.d.ts.map | 1 + .../WebChat/dialogs/CustomProviderDialog.js | 270 ++ .../dialogs/CustomProviderDialog.js.map | 1 + .../WebChat/dialogs/ModelSelector.d.ts | 27 + .../WebChat/dialogs/ModelSelector.d.ts.map | 1 + .../WebChat/dialogs/ModelSelector.js | 320 +++ .../WebChat/dialogs/ModelSelector.js.map | 1 + .../dialogs/PersistentStorageDialog.d.ts | 17 + .../dialogs/PersistentStorageDialog.d.ts.map | 1 + .../dialogs/PersistentStorageDialog.js | 147 ++ .../dialogs/PersistentStorageDialog.js.map | 1 + .../WebChat/dialogs/ProvidersModelsTab.d.ts | 20 + .../dialogs/ProvidersModelsTab.d.ts.map | 1 + .../WebChat/dialogs/ProvidersModelsTab.js | 191 ++ .../WebChat/dialogs/ProvidersModelsTab.js.map | 1 + .../WebChat/dialogs/SessionListDialog.d.ts | 19 + .../dialogs/SessionListDialog.d.ts.map | 1 + .../WebChat/dialogs/SessionListDialog.js | 154 ++ .../WebChat/dialogs/SessionListDialog.js.map | 1 + .../WebChat/dialogs/SettingsDialog.d.ts | 30 + .../WebChat/dialogs/SettingsDialog.d.ts.map | 1 + .../WebChat/dialogs/SettingsDialog.js | 229 ++ .../WebChat/dialogs/SettingsDialog.js.map | 1 + .../Clawdis/Resources/WebChat/index.d.ts | 68 + .../Clawdis/Resources/WebChat/index.d.ts.map | 1 + .../Clawdis/Resources/WebChat/index.js | 72 + .../Clawdis/Resources/WebChat/index.js.map | 1 + .../Resources/WebChat/prompts/prompts.d.ts | 11 + .../WebChat/prompts/prompts.d.ts.map | 1 + .../Resources/WebChat/prompts/prompts.js | 272 ++ .../Resources/WebChat/prompts/prompts.js.map | 1 + .../WebChat/storage/app-storage.d.ts | 33 + .../WebChat/storage/app-storage.d.ts.map | 1 + .../Resources/WebChat/storage/app-storage.js | 38 + .../WebChat/storage/app-storage.js.map | 1 + .../backends/indexeddb-storage-backend.d.ts | 27 + .../indexeddb-storage-backend.d.ts.map | 1 + .../backends/indexeddb-storage-backend.js | 166 ++ .../backends/indexeddb-storage-backend.js.map | 1 + .../Resources/WebChat/storage/store.d.ts | 23 + .../Resources/WebChat/storage/store.d.ts.map | 1 + .../Resources/WebChat/storage/store.js | 26 + .../Resources/WebChat/storage/store.js.map | 1 + .../stores/custom-providers-store.d.ts | 25 + .../stores/custom-providers-store.d.ts.map | 1 + .../storage/stores/custom-providers-store.js | 35 + .../stores/custom-providers-store.js.map | 1 + .../storage/stores/provider-keys-store.d.ts | 14 + .../stores/provider-keys-store.d.ts.map | 1 + .../storage/stores/provider-keys-store.js | 27 + .../storage/stores/provider-keys-store.js.map | 1 + .../storage/stores/sessions-store.d.ts | 32 + .../storage/stores/sessions-store.d.ts.map | 1 + .../WebChat/storage/stores/sessions-store.js | 112 + .../storage/stores/sessions-store.js.map | 1 + .../storage/stores/settings-store.d.ts | 14 + .../storage/stores/settings-store.d.ts.map | 1 + .../WebChat/storage/stores/settings-store.js | 28 + .../storage/stores/settings-store.js.map | 1 + .../Resources/WebChat/storage/types.d.ts | 175 ++ .../Resources/WebChat/storage/types.d.ts.map | 1 + .../Resources/WebChat/storage/types.js | 2 + .../Resources/WebChat/storage/types.js.map | 1 + .../tools/artifacts/ArtifactElement.d.ts | 9 + .../tools/artifacts/ArtifactElement.d.ts.map | 1 + .../tools/artifacts/ArtifactElement.js | 11 + .../tools/artifacts/ArtifactElement.js.map | 1 + .../WebChat/tools/artifacts/ArtifactPill.d.ts | 4 + .../tools/artifacts/ArtifactPill.d.ts.map | 1 + .../WebChat/tools/artifacts/ArtifactPill.js | 23 + .../tools/artifacts/ArtifactPill.js.map | 1 + .../WebChat/tools/artifacts/Console.d.ts | 18 + .../WebChat/tools/artifacts/Console.d.ts.map | 1 + .../WebChat/tools/artifacts/Console.js | 95 + .../WebChat/tools/artifacts/Console.js.map | 1 + .../WebChat/tools/artifacts/DocxArtifact.d.ts | 22 + .../tools/artifacts/DocxArtifact.d.ts.map | 1 + .../WebChat/tools/artifacts/DocxArtifact.js | 208 ++ .../tools/artifacts/DocxArtifact.js.map | 1 + .../tools/artifacts/ExcelArtifact.d.ts | 24 + .../tools/artifacts/ExcelArtifact.d.ts.map | 1 + .../WebChat/tools/artifacts/ExcelArtifact.js | 216 ++ .../tools/artifacts/ExcelArtifact.js.map | 1 + .../tools/artifacts/GenericArtifact.d.ts | 19 + .../tools/artifacts/GenericArtifact.d.ts.map | 1 + .../tools/artifacts/GenericArtifact.js | 117 + .../tools/artifacts/GenericArtifact.js.map | 1 + .../WebChat/tools/artifacts/HtmlArtifact.d.ts | 27 + .../tools/artifacts/HtmlArtifact.d.ts.map | 1 + .../WebChat/tools/artifacts/HtmlArtifact.js | 189 ++ .../tools/artifacts/HtmlArtifact.js.map | 1 + .../tools/artifacts/ImageArtifact.d.ts | 20 + .../tools/artifacts/ImageArtifact.d.ts.map | 1 + .../WebChat/tools/artifacts/ImageArtifact.js | 120 + .../tools/artifacts/ImageArtifact.js.map | 1 + .../tools/artifacts/MarkdownArtifact.d.ts | 19 + .../tools/artifacts/MarkdownArtifact.d.ts.map | 1 + .../tools/artifacts/MarkdownArtifact.js | 82 + .../tools/artifacts/MarkdownArtifact.js.map | 1 + .../WebChat/tools/artifacts/PdfArtifact.d.ts | 25 + .../tools/artifacts/PdfArtifact.d.ts.map | 1 + .../WebChat/tools/artifacts/PdfArtifact.js | 184 ++ .../tools/artifacts/PdfArtifact.js.map | 1 + .../WebChat/tools/artifacts/SvgArtifact.d.ts | 18 + .../tools/artifacts/SvgArtifact.d.ts.map | 1 + .../WebChat/tools/artifacts/SvgArtifact.js | 78 + .../tools/artifacts/SvgArtifact.js.map | 1 + .../WebChat/tools/artifacts/TextArtifact.d.ts | 19 + .../tools/artifacts/TextArtifact.d.ts.map | 1 + .../WebChat/tools/artifacts/TextArtifact.js | 144 ++ .../tools/artifacts/TextArtifact.js.map | 1 + .../artifacts/artifacts-tool-renderer.d.ts | 11 + .../artifacts-tool-renderer.d.ts.map | 1 + .../artifacts/artifacts-tool-renderer.js | 272 ++ .../artifacts/artifacts-tool-renderer.js.map | 1 + .../WebChat/tools/artifacts/artifacts.d.ts | 64 + .../tools/artifacts/artifacts.d.ts.map | 1 + .../WebChat/tools/artifacts/artifacts.js | 659 +++++ .../WebChat/tools/artifacts/artifacts.js.map | 1 + .../WebChat/tools/artifacts/index.d.ts | 8 + .../WebChat/tools/artifacts/index.d.ts.map | 1 + .../WebChat/tools/artifacts/index.js | 8 + .../WebChat/tools/artifacts/index.js.map | 1 + .../WebChat/tools/extract-document.d.ts | 24 + .../WebChat/tools/extract-document.d.ts.map | 1 + .../WebChat/tools/extract-document.js | 216 ++ .../WebChat/tools/extract-document.js.map | 1 + .../Resources/WebChat/tools/index.d.ts | 16 + .../Resources/WebChat/tools/index.d.ts.map | 1 + .../Clawdis/Resources/WebChat/tools/index.js | 33 + .../Resources/WebChat/tools/index.js.map | 1 + .../WebChat/tools/javascript-repl.d.ts | 44 + .../WebChat/tools/javascript-repl.d.ts.map | 1 + .../WebChat/tools/javascript-repl.js | 224 ++ .../WebChat/tools/javascript-repl.js.map | 1 + .../WebChat/tools/renderer-registry.d.ts | 23 + .../WebChat/tools/renderer-registry.d.ts.map | 1 + .../WebChat/tools/renderer-registry.js | 107 + .../WebChat/tools/renderer-registry.js.map | 1 + .../WebChat/tools/renderers/BashRenderer.d.ts | 10 + .../tools/renderers/BashRenderer.d.ts.map | 1 + .../WebChat/tools/renderers/BashRenderer.js | 42 + .../tools/renderers/BashRenderer.js.map | 1 + .../tools/renderers/CalculateRenderer.d.ts | 10 + .../renderers/CalculateRenderer.d.ts.map | 1 + .../tools/renderers/CalculateRenderer.js | 45 + .../tools/renderers/CalculateRenderer.js.map | 1 + .../tools/renderers/DefaultRenderer.d.ts | 6 + .../tools/renderers/DefaultRenderer.d.ts.map | 1 + .../tools/renderers/DefaultRenderer.js | 94 + .../tools/renderers/DefaultRenderer.js.map | 1 + .../renderers/GetCurrentTimeRenderer.d.ts | 10 + .../renderers/GetCurrentTimeRenderer.d.ts.map | 1 + .../tools/renderers/GetCurrentTimeRenderer.js | 72 + .../renderers/GetCurrentTimeRenderer.js.map | 1 + .../Resources/WebChat/tools/types.d.ts | 10 + .../Resources/WebChat/tools/types.d.ts.map | 1 + .../Clawdis/Resources/WebChat/tools/types.js | 2 + .../Resources/WebChat/tools/types.js.map | 1 + .../WebChat/utils/attachment-utils.d.ts | 19 + .../WebChat/utils/attachment-utils.d.ts.map | 1 + .../WebChat/utils/attachment-utils.js | 415 +++ .../WebChat/utils/attachment-utils.js.map | 1 + .../Resources/WebChat/utils/auth-token.d.ts | 3 + .../WebChat/utils/auth-token.d.ts.map | 1 + .../Resources/WebChat/utils/auth-token.js | 19 + .../Resources/WebChat/utils/auth-token.js.map | 1 + .../Resources/WebChat/utils/format.d.ts | 6 + .../Resources/WebChat/utils/format.d.ts.map | 1 + .../Clawdis/Resources/WebChat/utils/format.js | 47 + .../Resources/WebChat/utils/format.js.map | 1 + .../Clawdis/Resources/WebChat/utils/i18n.d.ts | 636 +++++ .../Resources/WebChat/utils/i18n.d.ts.map | 1 + .../Clawdis/Resources/WebChat/utils/i18n.js | 418 ++++ .../Resources/WebChat/utils/i18n.js.map | 1 + .../WebChat/utils/model-discovery.d.ts | 38 + .../WebChat/utils/model-discovery.d.ts.map | 1 + .../WebChat/utils/model-discovery.js | 243 ++ .../WebChat/utils/model-discovery.js.map | 1 + .../Resources/WebChat/utils/proxy-utils.d.ts | 37 + .../WebChat/utils/proxy-utils.d.ts.map | 1 + .../Resources/WebChat/utils/proxy-utils.js | 97 + .../WebChat/utils/proxy-utils.js.map | 1 + .../WebChat/utils/test-sessions.d.ts | 347 +++ .../WebChat/utils/test-sessions.d.ts.map | 1 + .../Resources/WebChat/utils/test-sessions.js | 2215 +++++++++++++++++ .../WebChat/utils/test-sessions.js.map | 1 + .../macos/Sources/Clawdis/WebChatWindow.swift | 49 +- 315 files changed, 16618 insertions(+), 20 deletions(-) create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/ChatPanel.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/ChatPanel.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/ChatPanel.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/ChatPanel.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/agent.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/agent.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/agent.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/agent.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/AppTransport.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/AppTransport.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/AppTransport.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/AppTransport.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/ProviderTransport.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/ProviderTransport.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/ProviderTransport.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/ProviderTransport.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/index.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/index.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/index.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/index.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/proxy-types.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/proxy-types.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/proxy-types.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/proxy-types.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/types.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/types.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/types.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/types.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/types.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/types.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/types.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/agent/types.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/app.css create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/AgentInterface.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/AgentInterface.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/AgentInterface.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/AgentInterface.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/AttachmentTile.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/AttachmentTile.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/AttachmentTile.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/AttachmentTile.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/ConsoleBlock.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/ConsoleBlock.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/ConsoleBlock.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/ConsoleBlock.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/CustomProviderCard.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/CustomProviderCard.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/CustomProviderCard.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/CustomProviderCard.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/ExpandableSection.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/ExpandableSection.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/ExpandableSection.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/ExpandableSection.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/Input.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/Input.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/Input.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/Input.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageEditor.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageEditor.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageEditor.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageEditor.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageList.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageList.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageList.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageList.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/Messages.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/Messages.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/Messages.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/Messages.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/ProviderKeyInput.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/ProviderKeyInput.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/ProviderKeyInput.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/ProviderKeyInput.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/SandboxedIframe.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/SandboxedIframe.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/SandboxedIframe.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/SandboxedIframe.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/StreamingMessageContainer.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/StreamingMessageContainer.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/StreamingMessageContainer.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/StreamingMessageContainer.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/ThinkingBlock.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/ThinkingBlock.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/ThinkingBlock.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/ThinkingBlock.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/message-renderer-registry.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/message-renderer-registry.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/message-renderer-registry.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/message-renderer-registry.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ArtifactsRuntimeProvider.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ArtifactsRuntimeProvider.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ArtifactsRuntimeProvider.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ArtifactsRuntimeProvider.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/AttachmentsRuntimeProvider.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/AttachmentsRuntimeProvider.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/AttachmentsRuntimeProvider.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/AttachmentsRuntimeProvider.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ConsoleRuntimeProvider.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ConsoleRuntimeProvider.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ConsoleRuntimeProvider.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ConsoleRuntimeProvider.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/FileDownloadRuntimeProvider.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/FileDownloadRuntimeProvider.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/FileDownloadRuntimeProvider.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/FileDownloadRuntimeProvider.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageBridge.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageBridge.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageBridge.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageBridge.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageRouter.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageRouter.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageRouter.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageRouter.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/SandboxRuntimeProvider.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/SandboxRuntimeProvider.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/SandboxRuntimeProvider.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/SandboxRuntimeProvider.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ApiKeyPromptDialog.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ApiKeyPromptDialog.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ApiKeyPromptDialog.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ApiKeyPromptDialog.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/AttachmentOverlay.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/AttachmentOverlay.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/AttachmentOverlay.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/AttachmentOverlay.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/CustomProviderDialog.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/CustomProviderDialog.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/CustomProviderDialog.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/CustomProviderDialog.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ModelSelector.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ModelSelector.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ModelSelector.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ModelSelector.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/PersistentStorageDialog.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/PersistentStorageDialog.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/PersistentStorageDialog.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/PersistentStorageDialog.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ProvidersModelsTab.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ProvidersModelsTab.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ProvidersModelsTab.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ProvidersModelsTab.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SessionListDialog.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SessionListDialog.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SessionListDialog.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SessionListDialog.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SettingsDialog.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SettingsDialog.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SettingsDialog.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SettingsDialog.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/index.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/index.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/index.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/index.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/prompts/prompts.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/prompts/prompts.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/prompts/prompts.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/prompts/prompts.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/app-storage.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/app-storage.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/app-storage.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/app-storage.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/backends/indexeddb-storage-backend.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/backends/indexeddb-storage-backend.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/backends/indexeddb-storage-backend.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/backends/indexeddb-storage-backend.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/store.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/store.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/store.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/store.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/custom-providers-store.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/custom-providers-store.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/custom-providers-store.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/custom-providers-store.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/provider-keys-store.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/provider-keys-store.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/provider-keys-store.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/provider-keys-store.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/sessions-store.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/sessions-store.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/sessions-store.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/sessions-store.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/settings-store.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/settings-store.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/settings-store.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/settings-store.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/types.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/types.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/types.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/storage/types.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactElement.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactElement.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactElement.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactElement.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactPill.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactPill.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactPill.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactPill.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/Console.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/Console.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/Console.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/Console.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/DocxArtifact.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/DocxArtifact.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/DocxArtifact.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/DocxArtifact.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ExcelArtifact.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ExcelArtifact.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ExcelArtifact.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ExcelArtifact.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/GenericArtifact.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/GenericArtifact.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/GenericArtifact.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/GenericArtifact.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/HtmlArtifact.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/HtmlArtifact.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/HtmlArtifact.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/HtmlArtifact.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ImageArtifact.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ImageArtifact.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ImageArtifact.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ImageArtifact.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/MarkdownArtifact.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/MarkdownArtifact.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/MarkdownArtifact.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/MarkdownArtifact.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/PdfArtifact.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/PdfArtifact.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/PdfArtifact.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/PdfArtifact.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/SvgArtifact.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/SvgArtifact.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/SvgArtifact.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/SvgArtifact.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/TextArtifact.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/TextArtifact.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/TextArtifact.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/TextArtifact.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts-tool-renderer.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts-tool-renderer.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts-tool-renderer.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts-tool-renderer.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/index.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/index.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/index.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/index.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/extract-document.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/extract-document.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/extract-document.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/extract-document.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/index.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/index.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/index.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/index.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/javascript-repl.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/javascript-repl.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/javascript-repl.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/javascript-repl.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderer-registry.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderer-registry.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderer-registry.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderer-registry.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/BashRenderer.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/BashRenderer.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/BashRenderer.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/BashRenderer.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/CalculateRenderer.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/CalculateRenderer.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/CalculateRenderer.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/CalculateRenderer.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/DefaultRenderer.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/DefaultRenderer.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/DefaultRenderer.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/DefaultRenderer.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/GetCurrentTimeRenderer.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/GetCurrentTimeRenderer.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/GetCurrentTimeRenderer.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/GetCurrentTimeRenderer.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/types.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/types.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/types.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/tools/types.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/attachment-utils.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/attachment-utils.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/attachment-utils.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/attachment-utils.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/auth-token.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/auth-token.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/auth-token.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/auth-token.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/format.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/format.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/format.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/format.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/i18n.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/i18n.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/i18n.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/i18n.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/model-discovery.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/model-discovery.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/model-discovery.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/model-discovery.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/proxy-utils.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/proxy-utils.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/proxy-utils.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/proxy-utils.js.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/test-sessions.d.ts create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/test-sessions.d.ts.map create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/test-sessions.js create mode 100644 apps/macos/Sources/Clawdis/Resources/WebChat/utils/test-sessions.js.map diff --git a/apps/macos/Package.swift b/apps/macos/Package.swift index 0ebe9357e..f676cff56 100644 --- a/apps/macos/Package.swift +++ b/apps/macos/Package.swift @@ -34,6 +34,7 @@ let package = Package( ], resources: [ .copy("Resources/Clawdis.icns"), + .copy("Resources/WebChat"), ], swiftSettings: [ .enableUpcomingFeature("StrictConcurrency"), diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/ChatPanel.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/ChatPanel.d.ts new file mode 100644 index 000000000..cfc33b3d2 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/ChatPanel.d.ts @@ -0,0 +1,29 @@ +import { LitElement } from "lit"; +import type { Agent } from "./agent/agent.js"; +import "./components/AgentInterface.js"; +import type { AgentTool } from "@mariozechner/pi-ai"; +import type { AgentInterface } from "./components/AgentInterface.js"; +import type { SandboxRuntimeProvider } from "./components/sandbox/SandboxRuntimeProvider.js"; +import { ArtifactsPanel } from "./tools/artifacts/index.js"; +export declare class ChatPanel extends LitElement { + agent?: Agent; + agentInterface?: AgentInterface; + artifactsPanel?: ArtifactsPanel; + private hasArtifacts; + private artifactCount; + private showArtifactsPanel; + private windowWidth; + private resizeHandler; + createRenderRoot(): this; + connectedCallback(): void; + disconnectedCallback(): void; + setAgent(agent: Agent, config?: { + onApiKeyRequired?: (provider: string) => Promise; + onBeforeSend?: () => void | Promise; + onCostClick?: () => void; + sandboxUrlProvider?: () => string; + toolsFactory?: (agent: Agent, agentInterface: AgentInterface, artifactsPanel: ArtifactsPanel, runtimeProvidersFactory: () => SandboxRuntimeProvider[]) => AgentTool[]; + }): Promise; + render(): import("lit-html").TemplateResult<1>; +} +//# sourceMappingURL=ChatPanel.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/ChatPanel.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/ChatPanel.d.ts.map new file mode 100644 index 000000000..7b61b0592 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/ChatPanel.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ChatPanel.d.ts","sourceRoot":"","sources":["../src/ChatPanel.ts"],"names":[],"mappings":"AACA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apps/macos/Sources/Clawdis/Resources/WebChat/ChatPanel.js b/apps/macos/Sources/Clawdis/Resources/WebChat/ChatPanel.js new file mode 100644 index 000000000..076a39a95 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/ChatPanel.js @@ -0,0 +1,193 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { Badge } from "@mariozechner/mini-lit/dist/Badge.js"; +import { html, LitElement } from "lit"; +import { customElement, state } from "lit/decorators.js"; +import "./components/AgentInterface.js"; +import { ArtifactsRuntimeProvider } from "./components/sandbox/ArtifactsRuntimeProvider.js"; +import { AttachmentsRuntimeProvider } from "./components/sandbox/AttachmentsRuntimeProvider.js"; +import { ArtifactsPanel, ArtifactsToolRenderer } from "./tools/artifacts/index.js"; +import { registerToolRenderer } from "./tools/renderer-registry.js"; +import { i18n } from "./utils/i18n.js"; +const BREAKPOINT = 800; // px - switch between overlay and side-by-side +let ChatPanel = class ChatPanel extends LitElement { + constructor() { + super(...arguments); + this.hasArtifacts = false; + this.artifactCount = 0; + this.showArtifactsPanel = false; + this.windowWidth = 0; + this.resizeHandler = () => { + this.windowWidth = window.innerWidth; + this.requestUpdate(); + }; + } + createRenderRoot() { + return this; + } + connectedCallback() { + super.connectedCallback(); + this.windowWidth = window.innerWidth; // Set initial width after connection + window.addEventListener("resize", this.resizeHandler); + this.style.display = "flex"; + this.style.flexDirection = "column"; + this.style.height = "100%"; + this.style.minHeight = "0"; + // Update width after initial render + requestAnimationFrame(() => { + this.windowWidth = window.innerWidth; + this.requestUpdate(); + }); + } + disconnectedCallback() { + super.disconnectedCallback(); + window.removeEventListener("resize", this.resizeHandler); + } + async setAgent(agent, config) { + this.agent = agent; + // Create AgentInterface + this.agentInterface = document.createElement("agent-interface"); + this.agentInterface.session = agent; + this.agentInterface.enableAttachments = true; + this.agentInterface.enableModelSelector = true; + this.agentInterface.enableThinkingSelector = true; + this.agentInterface.showThemeToggle = false; + this.agentInterface.onApiKeyRequired = config?.onApiKeyRequired; + this.agentInterface.onBeforeSend = config?.onBeforeSend; + this.agentInterface.onCostClick = config?.onCostClick; + // Set up artifacts panel + this.artifactsPanel = new ArtifactsPanel(); + this.artifactsPanel.agent = agent; // Pass agent for HTML artifact runtime providers + if (config?.sandboxUrlProvider) { + this.artifactsPanel.sandboxUrlProvider = config.sandboxUrlProvider; + } + // Register the standalone tool renderer (not the panel itself) + registerToolRenderer("artifacts", new ArtifactsToolRenderer(this.artifactsPanel)); + // Runtime providers factory for REPL tools (read-write access) + const runtimeProvidersFactory = () => { + const attachments = []; + for (const message of this.agent.state.messages) { + if (message.role === "user") { + message.attachments?.forEach((a) => { + attachments.push(a); + }); + } + } + const providers = []; + // Add attachments provider if there are attachments + if (attachments.length > 0) { + providers.push(new AttachmentsRuntimeProvider(attachments)); + } + // Add artifacts provider with read-write access (for REPL) + providers.push(new ArtifactsRuntimeProvider(this.artifactsPanel, this.agent, true)); + return providers; + }; + this.artifactsPanel.onArtifactsChange = () => { + const count = this.artifactsPanel?.artifacts?.size ?? 0; + const created = count > this.artifactCount; + this.hasArtifacts = count > 0; + this.artifactCount = count; + if (this.hasArtifacts && created) { + this.showArtifactsPanel = true; + } + this.requestUpdate(); + }; + this.artifactsPanel.onClose = () => { + this.showArtifactsPanel = false; + this.requestUpdate(); + }; + this.artifactsPanel.onOpen = () => { + this.showArtifactsPanel = true; + this.requestUpdate(); + }; + // Set tools on the agent + // Pass runtimeProvidersFactory so consumers can configure their own REPL tools + const additionalTools = config?.toolsFactory?.(agent, this.agentInterface, this.artifactsPanel, runtimeProvidersFactory) || []; + const tools = [this.artifactsPanel.tool, ...additionalTools]; + this.agent.setTools(tools); + // Reconstruct artifacts from existing messages + // Temporarily disable the onArtifactsChange callback to prevent auto-opening on load + const originalCallback = this.artifactsPanel.onArtifactsChange; + this.artifactsPanel.onArtifactsChange = undefined; + await this.artifactsPanel.reconstructFromMessages(this.agent.state.messages); + this.artifactsPanel.onArtifactsChange = originalCallback; + this.hasArtifacts = this.artifactsPanel.artifacts.size > 0; + this.artifactCount = this.artifactsPanel.artifacts.size; + this.requestUpdate(); + } + render() { + if (!this.agent || !this.agentInterface) { + return html `
+
No agent set
+
`; + } + const isMobile = this.windowWidth < BREAKPOINT; + // Set panel props + if (this.artifactsPanel) { + this.artifactsPanel.collapsed = !this.showArtifactsPanel; + this.artifactsPanel.overlay = isMobile; + } + return html ` +
+
+ ${this.agentInterface} +
+ + + ${this.hasArtifacts && !this.showArtifactsPanel + ? html ` + + ` + : ""} + +
+ ${this.artifactsPanel} +
+
+ `; + } +}; +__decorate([ + state() +], ChatPanel.prototype, "agent", void 0); +__decorate([ + state() +], ChatPanel.prototype, "agentInterface", void 0); +__decorate([ + state() +], ChatPanel.prototype, "artifactsPanel", void 0); +__decorate([ + state() +], ChatPanel.prototype, "hasArtifacts", void 0); +__decorate([ + state() +], ChatPanel.prototype, "artifactCount", void 0); +__decorate([ + state() +], ChatPanel.prototype, "showArtifactsPanel", void 0); +__decorate([ + state() +], ChatPanel.prototype, "windowWidth", void 0); +ChatPanel = __decorate([ + customElement("pi-chat-panel") +], ChatPanel); +export { ChatPanel }; +//# sourceMappingURL=ChatPanel.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/ChatPanel.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/ChatPanel.js.map new file mode 100644 index 000000000..1bcd14871 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/ChatPanel.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ChatPanel.js","sourceRoot":"","sources":["../src/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E,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE;OACxL,IAAI,CAAC,cAAc;;;GAGvB,CAAC;IACH,CAAC;CACD,CAAA;AA5LgB;IAAf,KAAK,EAAE;wCAAsB;AACd;IAAf,KAAK,EAAE;iDAAwC;AAChC;IAAf,KAAK,EAAE;iDAAwC;AAC/B;IAAhB,KAAK,EAAE;+CAA8B;AACrB;IAAhB,KAAK,EAAE;gDAA2B;AAClB;IAAhB,KAAK,EAAE;qDAAoC;AAC3B;IAAhB,KAAK,EAAE;8CAAyB;AAPrB,SAAS;IADrB,aAAa,CAAC,eAAe,CAAC;GAClB,SAAS,CA6LrB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/agent.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/agent.d.ts new file mode 100644 index 000000000..8a5e8bc94 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/agent.d.ts @@ -0,0 +1,62 @@ +import { type AgentTool, type Message, type Model } from "@mariozechner/pi-ai"; +import type { AppMessage } from "../components/Messages.js"; +import type { Attachment } from "../utils/attachment-utils.js"; +import type { AgentTransport } from "./transports/types.js"; +import type { DebugLogEntry } from "./types.js"; +export type ThinkingLevel = "off" | "minimal" | "low" | "medium" | "high"; +export interface AgentState { + systemPrompt: string; + model: Model; + thinkingLevel: ThinkingLevel; + tools: AgentTool[]; + messages: AppMessage[]; + isStreaming: boolean; + streamMessage: Message | null; + pendingToolCalls: Set; + error?: string; +} +export type AgentEvent = { + type: "state-update"; + state: AgentState; +} | { + type: "error-no-model"; +} | { + type: "error-no-api-key"; + provider: string; +} | { + type: "started"; +} | { + type: "completed"; +}; +export interface AgentOptions { + initialState?: Partial; + debugListener?: (entry: DebugLogEntry) => void; + transport: AgentTransport; + messageTransformer?: (messages: AppMessage[]) => Message[] | Promise; +} +export declare class Agent { + private _state; + private listeners; + private abortController?; + private transport; + private debugListener?; + private messageTransformer; + private messageQueue; + constructor(opts: AgentOptions); + get state(): AgentState; + subscribe(fn: (e: AgentEvent) => void): () => void; + setSystemPrompt(v: string): void; + setModel(m: Model): void; + setThinkingLevel(l: ThinkingLevel): void; + setTools(t: AgentTool[]): void; + replaceMessages(ms: AppMessage[]): void; + appendMessage(m: AppMessage): void; + queueMessage(m: AppMessage): Promise; + clearMessages(): void; + abort(): void; + private logState; + prompt(input: string, attachments?: Attachment[]): Promise; + private patch; + private emit; +} +//# sourceMappingURL=agent.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/agent.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/agent.d.ts.map new file mode 100644 index 000000000..3849ca9e5 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/agent.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/agent/agent.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,SAAS,EAId,KAAK,OAAO,EACZ,KAAK,KAAK,EAEV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAkB,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAmBhD,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE1E,MAAM,WAAW,UAAU;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,C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,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,GAAG,MAAM,IAAI;IAOlD,eAAe,CAAC,CAAC,EAAE,MAAM;IAGzB,QAAQ,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC;IAGtB,gBAAgB,CAAC,CAAC,EAAE,aAAa;IAGjC,QAAQ,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE;IAG5B,eAAe,CAAC,EAAE,EAAE,UAAU,EAAE;IAGhC,aAAa,CAAC,CAAC,EAAE,UAAU;IAGrB,YAAY,CAAC,CAAC,EAAE,UAAU;IAQhC,aAAa;IAIb,KAAK;IAIL,OAAO,CAAC,QAAQ;IAKV,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,UAAU,EAAE;IA8LtD,OAAO,CAAC,KAAK;IAKb,OAAO,CAAC,IAAI;CAKZ"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/agent.js b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/agent.js new file mode 100644 index 000000000..306816e9a --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/agent.js @@ -0,0 +1,272 @@ +import { getModel, } from "@mariozechner/pi-ai"; +// Default transformer: Keep only LLM-compatible messages, strip app-specific fields +function defaultMessageTransformer(messages) { + return messages + .filter((m) => { + // Only keep standard LLM message roles + return m.role === "user" || m.role === "assistant" || m.role === "toolResult"; + }) + .map((m) => { + if (m.role === "user") { + // Strip attachments field (app-specific) + const { attachments, ...rest } = m; + return rest; + } + return m; + }); +} +export class Agent { + constructor(opts) { + this._state = { + systemPrompt: "", + model: getModel("google", "gemini-2.5-flash-lite-preview-06-17"), + thinkingLevel: "off", + tools: [], + messages: [], + isStreaming: false, + streamMessage: null, + pendingToolCalls: new Set(), + error: undefined, + }; + this.listeners = new Set(); + this.messageQueue = []; + this._state = { ...this._state, ...opts.initialState }; + this.debugListener = opts.debugListener; + this.transport = opts.transport; + this.messageTransformer = opts.messageTransformer || defaultMessageTransformer; + } + get state() { + return this._state; + } + subscribe(fn) { + this.listeners.add(fn); + fn({ type: "state-update", state: this._state }); + return () => this.listeners.delete(fn); + } + // Mutators + setSystemPrompt(v) { + this.patch({ systemPrompt: v }); + } + setModel(m) { + this.patch({ model: m }); + } + setThinkingLevel(l) { + this.patch({ thinkingLevel: l }); + } + setTools(t) { + this.patch({ tools: t }); + } + replaceMessages(ms) { + this.patch({ messages: ms.slice() }); + } + appendMessage(m) { + this.patch({ messages: [...this._state.messages, m] }); + } + async queueMessage(m) { + // Transform message and queue it for injection at next turn + const transformed = await this.messageTransformer([m]); + this.messageQueue.push({ + original: m, + llm: transformed[0], // undefined if filtered out + }); + } + clearMessages() { + this.patch({ messages: [] }); + } + abort() { + this.abortController?.abort(); + } + logState(message) { + const { systemPrompt, model, messages } = this._state; + console.log(message, { systemPrompt, model, messages }); + } + async prompt(input, attachments) { + const model = this._state.model; + if (!model) { + this.emit({ type: "error-no-model" }); + return; + } + // Build user message with attachments + const content = [{ type: "text", text: input }]; + if (attachments?.length) { + for (const a of attachments) { + if (a.type === "image") { + content.push({ type: "image", data: a.content, mimeType: a.mimeType }); + } + else if (a.type === "document" && a.extractedText) { + content.push({ + type: "text", + text: `\n\n[Document: ${a.fileName}]\n${a.extractedText}`, + isDocument: true, + }); + } + } + } + const userMessage = { + role: "user", + content, + attachments: attachments?.length ? attachments : undefined, + timestamp: Date.now(), + }; + this.abortController = new AbortController(); + this.patch({ isStreaming: true, streamMessage: null, error: undefined }); + this.emit({ type: "started" }); + const reasoning = this._state.thinkingLevel === "off" + ? undefined + : this._state.thinkingLevel === "minimal" + ? "low" + : this._state.thinkingLevel; + const cfg = { + systemPrompt: this._state.systemPrompt, + tools: this._state.tools, + model, + reasoning, + getQueuedMessages: async () => { + // Return queued messages (they'll be added to state via message_end event) + const queued = this.messageQueue.slice(); + this.messageQueue = []; + return queued; + }, + }; + try { + let partial = null; + let turnDebug = null; + let turnStart = 0; + this.logState("prompt started, current state:"); + // Transform app messages to LLM-compatible messages (initial set) + const llmMessages = await this.messageTransformer(this._state.messages); + console.log("transformed messages:", llmMessages); + for await (const ev of this.transport.run(llmMessages, userMessage, cfg, this.abortController.signal)) { + switch (ev.type) { + case "turn_start": { + turnStart = performance.now(); + // Build request context snapshot (use transformed messages) + const ctx = { + systemPrompt: this._state.systemPrompt, + messages: [...llmMessages], + tools: this._state.tools, + }; + turnDebug = { + timestamp: new Date().toISOString(), + request: { + provider: cfg.model.provider, + model: cfg.model.id, + context: { ...ctx }, + }, + sseEvents: [], + }; + break; + } + case "message_start": + case "message_update": { + partial = ev.message; + // Collect SSE-like events for debug (drop heavy partial) + if (ev.type === "message_update" && ev.assistantMessageEvent && turnDebug) { + const copy = { ...ev.assistantMessageEvent }; + if (copy && "partial" in copy) + delete copy.partial; + turnDebug.sseEvents.push(JSON.stringify(copy)); + if (!turnDebug.ttft) + turnDebug.ttft = performance.now() - turnStart; + } + this.patch({ streamMessage: ev.message }); + break; + } + case "message_end": { + partial = null; + this.appendMessage(ev.message); + this.patch({ streamMessage: null }); + if (turnDebug) { + if (ev.message.role !== "assistant" && ev.message.role !== "toolResult") { + turnDebug.request.context.messages.push(ev.message); + } + if (ev.message.role === "assistant") + turnDebug.response = ev.message; + } + break; + } + case "tool_execution_start": { + const s = new Set(this._state.pendingToolCalls); + s.add(ev.toolCallId); + this.patch({ pendingToolCalls: s }); + break; + } + case "tool_execution_end": { + const s = new Set(this._state.pendingToolCalls); + s.delete(ev.toolCallId); + this.patch({ pendingToolCalls: s }); + break; + } + case "turn_end": { + // finalize current turn + if (turnDebug) { + turnDebug.totalTime = performance.now() - turnStart; + this.debugListener?.(turnDebug); + turnDebug = null; + } + break; + } + case "agent_end": { + this.patch({ streamMessage: null }); + break; + } + } + } + if (partial && partial.role === "assistant" && partial.content.length > 0) { + const onlyEmpty = !partial.content.some((c) => (c.type === "thinking" && c.thinking.trim().length > 0) || + (c.type === "text" && c.text.trim().length > 0) || + (c.type === "toolCall" && c.name.trim().length > 0)); + if (!onlyEmpty) { + this.appendMessage(partial); + } + else { + if (this.abortController?.signal.aborted) { + throw new Error("Request was aborted"); + } + } + } + } + catch (err) { + if (String(err?.message || err) === "no-api-key") { + this.emit({ type: "error-no-api-key", provider: model.provider }); + } + else { + const msg = { + role: "assistant", + content: [{ type: "text", text: "" }], + api: model.api, + provider: model.provider, + model: model.id, + usage: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }, + }, + stopReason: this.abortController?.signal.aborted ? "aborted" : "error", + errorMessage: err?.message || String(err), + timestamp: Date.now(), + }; + this.appendMessage(msg); + this.patch({ error: err?.message || String(err) }); + } + } + finally { + this.patch({ isStreaming: false, streamMessage: null, pendingToolCalls: new Set() }); + this.abortController = undefined; + this.emit({ type: "completed" }); + } + this.logState("final state:"); + } + patch(p) { + this._state = { ...this._state, ...p }; + this.emit({ type: "state-update", state: this._state }); + } + emit(e) { + for (const listener of this.listeners) { + listener(e); + } + } +} +//# sourceMappingURL=agent.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/agent.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/agent.js.map new file mode 100644 index 000000000..4309f47bd --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/agent.js.map @@ -0,0 +1 @@ +{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/agent/agent.ts"],"names":[],"mappings":"AACA,OAAO,EAGN,QAAQ,GAKR,MAAM,qBAAqB,CAAC;AAM7B,oFAAoF;AACpF,SAAS,yBAAyB,CAAC,QAAsB;IACxD,OAAO,QAAQ;SACb,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;QACb,uCAAuC;QACvC,OAAO,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW,IAAI,CAAC,CAA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ransport.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/AppTransport.d.ts new file mode 100644 index 000000000..05981c7d4 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/AppTransport.d.ts @@ -0,0 +1,11 @@ +import type { Message } from "@mariozechner/pi-ai"; +import type { AgentRunConfig, AgentTransport } from "./types.js"; +/** + * Transport that uses an app server with user authentication tokens. + * The server manages user accounts and proxies requests to LLM providers. + */ +export declare class AppTransport implements AgentTransport { + private readonly proxyUrl; + run(messages: Message[], userMessage: Message, cfg: AgentRunConfig, signal?: AbortSignal): AsyncGenerator; +} +//# sourceMappingURL=AppTransport.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/AppTransport.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/AppTransport.d.ts.map new file mode 100644 index 000000000..fc05b6ad5 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/AppTransport.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"AppTransport.d.ts","sourceRoot":"","sources":["../../../src/agent/transports/AppTransport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAOX,OAAO,EAKP,MAAM,qBAAqB,CAAC;AAO7B,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA0SjE;;;GAGG;AACH,qBAAa,YAAa,YAAW,cAAc;IAElD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmC;IAErD,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,WAAW;CAsC/F"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/AppTransport.js b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/AppTransport.js new file mode 100644 index 000000000..5695f4a03 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/AppTransport.js @@ -0,0 +1,318 @@ +import { agentLoop } from "@mariozechner/pi-ai"; +import { AssistantMessageEventStream } from "@mariozechner/pi-ai/dist/utils/event-stream.js"; +import { parseStreamingJson } from "@mariozechner/pi-ai/dist/utils/json-parse.js"; +import { clearAuthToken, getAuthToken } from "../../utils/auth-token.js"; +import { i18n } from "../../utils/i18n.js"; +/** + * Stream function that proxies through a server instead of calling providers directly. + * The server strips the partial field from delta events to reduce bandwidth. + * We reconstruct the partial message client-side. + */ +function streamSimpleProxy(model, context, options, proxyUrl) { + const stream = new AssistantMessageEventStream(); + (async () => { + // Initialize the partial message that we'll build up from events + const partial = { + role: "assistant", + stopReason: "stop", + content: [], + api: model.api, + provider: model.provider, + model: model.id, + usage: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }, + }, + timestamp: Date.now(), + }; + let reader; + // Set up abort handler to cancel the reader + const abortHandler = () => { + if (reader) { + reader.cancel("Request aborted by user").catch(() => { }); + } + }; + if (options.signal) { + options.signal.addEventListener("abort", abortHandler); + } + try { + const response = await fetch(`${proxyUrl}/api/stream`, { + method: "POST", + headers: { + Authorization: `Bearer ${options.authToken}`, + "Content-Type": "application/json", + }, + body: JSON.stringify({ + model, + context, + options: { + temperature: options.temperature, + maxTokens: options.maxTokens, + reasoning: options.reasoning, + // Don't send apiKey or signal - those are added server-side + }, + }), + signal: options.signal, + }); + if (!response.ok) { + let errorMessage = `Proxy error: ${response.status} ${response.statusText}`; + try { + const errorData = await response.json(); + if (errorData.error) { + errorMessage = `Proxy error: ${errorData.error}`; + } + } + catch { + // Couldn't parse error response, use default message + } + throw new Error(errorMessage); + } + // Parse SSE stream + reader = response.body.getReader(); + const decoder = new TextDecoder(); + let buffer = ""; + while (true) { + const { done, value } = await reader.read(); + if (done) + break; + // Check if aborted after reading + if (options.signal?.aborted) { + throw new Error("Request aborted by user"); + } + buffer += decoder.decode(value, { stream: true }); + const lines = buffer.split("\n"); + buffer = lines.pop() || ""; + for (const line of lines) { + if (line.startsWith("data: ")) { + const data = line.slice(6).trim(); + if (data) { + const proxyEvent = JSON.parse(data); + let event; + // Handle different event types + // Server sends events with partial for non-delta events, + // and without partial for delta events + switch (proxyEvent.type) { + case "start": + event = { type: "start", partial }; + break; + case "text_start": + partial.content[proxyEvent.contentIndex] = { + type: "text", + text: "", + }; + event = { type: "text_start", contentIndex: proxyEvent.contentIndex, partial }; + break; + case "text_delta": { + const content = partial.content[proxyEvent.contentIndex]; + if (content?.type === "text") { + content.text += proxyEvent.delta; + event = { + type: "text_delta", + contentIndex: proxyEvent.contentIndex, + delta: proxyEvent.delta, + partial, + }; + } + else { + throw new Error("Received text_delta for non-text content"); + } + break; + } + case "text_end": { + const content = partial.content[proxyEvent.contentIndex]; + if (content?.type === "text") { + content.textSignature = proxyEvent.contentSignature; + event = { + type: "text_end", + contentIndex: proxyEvent.contentIndex, + content: content.text, + partial, + }; + } + else { + throw new Error("Received text_end for non-text content"); + } + break; + } + case "thinking_start": + partial.content[proxyEvent.contentIndex] = { + type: "thinking", + thinking: "", + }; + event = { type: "thinking_start", contentIndex: proxyEvent.contentIndex, partial }; + break; + case "thinking_delta": { + const content = partial.content[proxyEvent.contentIndex]; + if (content?.type === "thinking") { + content.thinking += proxyEvent.delta; + event = { + type: "thinking_delta", + contentIndex: proxyEvent.contentIndex, + delta: proxyEvent.delta, + partial, + }; + } + else { + throw new Error("Received thinking_delta for non-thinking content"); + } + break; + } + case "thinking_end": { + const content = partial.content[proxyEvent.contentIndex]; + if (content?.type === "thinking") { + content.thinkingSignature = proxyEvent.contentSignature; + event = { + type: "thinking_end", + contentIndex: proxyEvent.contentIndex, + content: content.thinking, + partial, + }; + } + else { + throw new Error("Received thinking_end for non-thinking content"); + } + break; + } + case "toolcall_start": + partial.content[proxyEvent.contentIndex] = { + type: "toolCall", + id: proxyEvent.id, + name: proxyEvent.toolName, + arguments: {}, + partialJson: "", + }; + event = { type: "toolcall_start", contentIndex: proxyEvent.contentIndex, partial }; + break; + case "toolcall_delta": { + const content = partial.content[proxyEvent.contentIndex]; + if (content?.type === "toolCall") { + content.partialJson += proxyEvent.delta; + content.arguments = parseStreamingJson(content.partialJson) || {}; + event = { + type: "toolcall_delta", + contentIndex: proxyEvent.contentIndex, + delta: proxyEvent.delta, + partial, + }; + partial.content[proxyEvent.contentIndex] = { ...content }; // Trigger reactivity + } + else { + throw new Error("Received toolcall_delta for non-toolCall content"); + } + break; + } + case "toolcall_end": { + const content = partial.content[proxyEvent.contentIndex]; + if (content?.type === "toolCall") { + delete content.partialJson; + event = { + type: "toolcall_end", + contentIndex: proxyEvent.contentIndex, + toolCall: content, + partial, + }; + } + break; + } + case "done": + partial.stopReason = proxyEvent.reason; + partial.usage = proxyEvent.usage; + event = { type: "done", reason: proxyEvent.reason, message: partial }; + break; + case "error": + partial.stopReason = proxyEvent.reason; + partial.errorMessage = proxyEvent.errorMessage; + partial.usage = proxyEvent.usage; + event = { type: "error", reason: proxyEvent.reason, error: partial }; + break; + default: { + // Exhaustive check + const _exhaustiveCheck = proxyEvent; + console.warn(`Unhandled event type: ${proxyEvent.type}`); + break; + } + } + // Push the event to stream + if (event) { + stream.push(event); + } + else { + throw new Error("Failed to create event from proxy event"); + } + } + } + } + } + // Check if aborted after reading + if (options.signal?.aborted) { + throw new Error("Request aborted by user"); + } + stream.end(); + } + catch (error) { + const errorMessage = error instanceof Error ? error.message : String(error); + if (errorMessage.toLowerCase().includes("proxy") && errorMessage.includes("Unauthorized")) { + clearAuthToken(); + } + partial.stopReason = options.signal?.aborted ? "aborted" : "error"; + partial.errorMessage = errorMessage; + stream.push({ + type: "error", + reason: partial.stopReason, + error: partial, + }); + stream.end(); + } + finally { + // Clean up abort handler + if (options.signal) { + options.signal.removeEventListener("abort", abortHandler); + } + } + })(); + return stream; +} +// Proxy transport executes the turn using a remote proxy server +/** + * Transport that uses an app server with user authentication tokens. + * The server manages user accounts and proxies requests to LLM providers. + */ +export class AppTransport { + constructor() { + // Hardcoded proxy URL for now - will be made configurable later + this.proxyUrl = "https://genai.mariozechner.at"; + } + async *run(messages, userMessage, cfg, signal) { + const authToken = await getAuthToken(); + if (!authToken) { + throw new Error(i18n("Auth token is required for proxy transport")); + } + // Use proxy - no local API key needed + const streamFn = (model, context, options) => { + return streamSimpleProxy(model, context, { + ...options, + authToken, + }, this.proxyUrl); + }; + // Messages are already LLM-compatible (filtered by Agent) + const context = { + systemPrompt: cfg.systemPrompt, + messages, + tools: cfg.tools, + }; + const pc = { + model: cfg.model, + reasoning: cfg.reasoning, + getQueuedMessages: cfg.getQueuedMessages, + }; + // Yield events from the upstream agentLoop iterator + // Pass streamFn as the 5th parameter to use proxy + for await (const ev of agentLoop(userMessage, context, pc, signal, streamFn)) { + yield ev; + } + } +} +//# sourceMappingURL=AppTransport.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/AppTransport.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/AppTransport.js.map new file mode 100644 index 000000000..73909e86a --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/AppTransport.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AppTransport.js","sourceRoot":"","sources":["../../../src/agent/transports/AppTransport.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAI3C;;;;GAIG;AACH,SAAS,iBAAiB,CACzB,KAAiB,EACjB,OAAgB,EAChB,OAAoD,EACpD,QAAgB;IAEhB,MAAM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AE,GAAoB;YAC3B,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,iBAAiB,EAAE,GAAG,CAAC,iBAAiB;SACxC,CAAC;QAEF,oDAAoD;QACpD,kDAAkD;QAClD,IAAI,KAAK,EAAE,MAAM,EAAE,IAAI,SAAS,CAAC,WAAqC,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,QAAe,CAAC,EAAE,CAAC;YAC/G,MAAM,EAAE,CAAC;QACV,CAAC;IACF,CAAC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/ProviderTransport.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/ProviderTransport.d.ts new file mode 100644 index 000000000..bd933a3ac --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/ProviderTransport.d.ts @@ -0,0 +1,10 @@ +import { type Message } from "@mariozechner/pi-ai"; +import type { AgentRunConfig, AgentTransport } from "./types.js"; +/** + * Transport that calls LLM providers directly. + * Uses CORS proxy only for providers that require it (Anthropic OAuth, Z-AI). + */ +export declare class ProviderTransport implements AgentTransport { + run(messages: Message[], userMessage: Message, cfg: AgentRunConfig, signal?: AbortSignal): AsyncGenerator; +} +//# sourceMappingURL=ProviderTransport.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/ProviderTransport.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/ProviderTransport.d.ts.map new file mode 100644 index 000000000..9d316a692 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/ProviderTransport.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ProviderTransport.d.ts","sourceRoot":"","sources":["../../../src/agent/transports/ProviderTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,OAAO,EAEZ,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjE;;;GAGG;AACH,qBAAa,iBAAkB,YAAW,cAAc;IAChD,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,WAAW;CAiC/F"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/ProviderTransport.js b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/ProviderTransport.js new file mode 100644 index 000000000..798089588 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/ProviderTransport.js @@ -0,0 +1,38 @@ +import { agentLoop, } from "@mariozechner/pi-ai"; +import { getAppStorage } from "../../storage/app-storage.js"; +import { applyProxyIfNeeded } from "../../utils/proxy-utils.js"; +/** + * Transport that calls LLM providers directly. + * Uses CORS proxy only for providers that require it (Anthropic OAuth, Z-AI). + */ +export class ProviderTransport { + async *run(messages, userMessage, cfg, signal) { + // Get API key from storage + const apiKey = await getAppStorage().providerKeys.get(cfg.model.provider); + if (!apiKey) { + throw new Error("no-api-key"); + } + // Get proxy URL from settings (if available) + const proxyEnabled = await getAppStorage().settings.get("proxy.enabled"); + const proxyUrl = await getAppStorage().settings.get("proxy.url"); + // Apply proxy only if this provider/key combination requires it + const model = applyProxyIfNeeded(cfg.model, apiKey, proxyEnabled ? proxyUrl || undefined : undefined); + // Messages are already LLM-compatible (filtered by Agent) + const context = { + systemPrompt: cfg.systemPrompt, + messages, + tools: cfg.tools, + }; + const pc = { + model, + reasoning: cfg.reasoning, + apiKey, + getQueuedMessages: cfg.getQueuedMessages, + }; + // Yield events from agentLoop + for await (const ev of agentLoop(userMessage, context, pc, signal)) { + yield ev; + } + } +} +//# sourceMappingURL=ProviderTransport.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/ProviderTransport.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/ProviderTransport.js.map new file mode 100644 index 000000000..c7507186a --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/ProviderTransport.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ProviderTransport.js","sourceRoot":"","sources":["../../../src/agent/transports/ProviderTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,SAAS,GAGT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IAC7B,KAAK,CAAC,CAAC,GAAG,CAAC,QAAmB,EAAE,WAAoB,EAAE,GAAmB,EAAE,MAAoB;QAC9F,2BAA2B;QAC3B,MAAM,MAAM,GAAG,MAAM,aAAa,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC1E,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;QAC/B,CAAC;QAED,6CAA6C;QAC7C,MAAM,YAAY,GAAG,MAAM,aAAa,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAU,eAAe,CAAC,CAAC;QAClF,MAAM,QAAQ,GAAG,MAAM,aAAa,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAS,WAAW,CAAC,CAAC;QAEzE,gEAAgE;QAChE,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,QAAQ,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAEtG,0DAA0D;QAC1D,MAAM,OAAO,GAAiB;YAC7B,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,QAAQ;YACR,KAAK,EAAE,GAAG,CAAC,KAAK;SAChB,CAAC;QAEF,MAAM,EAAE,GAAoB;YAC3B,KAAK;YACL,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,MAAM;YACN,iBAAiB,EAAE,GAAG,CAAC,iBAAiB;SACxC,CAAC;QAEF,8BAA8B;QAC9B,IAAI,KAAK,EAAE,MAAM,EAAE,IAAI,SAAS,CAAC,WAAqC,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC;YAC9F,MAAM,EAAE,CAAC;QACV,CAAC;IACF,CAAC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/index.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/index.d.ts new file mode 100644 index 000000000..ce5f79e45 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/index.d.ts @@ -0,0 +1,4 @@ +export * from "./AppTransport.js"; +export * from "./ProviderTransport.js"; +export * from "./types.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/index.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/index.d.ts.map new file mode 100644 index 000000000..4236a8892 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/transports/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/index.js b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/index.js new file mode 100644 index 000000000..dae7877a1 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/index.js @@ -0,0 +1,4 @@ +export * from "./AppTransport.js"; +export * from "./ProviderTransport.js"; +export * from "./types.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/index.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/index.js.map new file mode 100644 index 000000000..dfc0e6932 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agent/transports/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/proxy-types.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/proxy-types.d.ts new file mode 100644 index 000000000..479e4a4d1 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/proxy-types.d.ts @@ -0,0 +1,48 @@ +import type { StopReason, Usage } from "@mariozechner/pi-ai"; +export type ProxyAssistantMessageEvent = { + type: "start"; +} | { + type: "text_start"; + contentIndex: number; +} | { + type: "text_delta"; + contentIndex: number; + delta: string; +} | { + type: "text_end"; + contentIndex: number; + contentSignature?: string; +} | { + type: "thinking_start"; + contentIndex: number; +} | { + type: "thinking_delta"; + contentIndex: number; + delta: string; +} | { + type: "thinking_end"; + contentIndex: number; + contentSignature?: string; +} | { + type: "toolcall_start"; + contentIndex: number; + id: string; + toolName: string; +} | { + type: "toolcall_delta"; + contentIndex: number; + delta: string; +} | { + type: "toolcall_end"; + contentIndex: number; +} | { + type: "done"; + reason: Extract; + usage: Usage; +} | { + type: "error"; + reason: Extract; + errorMessage: string; + usage: Usage; +}; +//# sourceMappingURL=proxy-types.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/proxy-types.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/proxy-types.d.ts.map new file mode 100644 index 000000000..d38bb8033 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/proxy-types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"proxy-types.d.ts","sourceRoot":"","sources":["../../../src/agent/transports/proxy-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,MAAM,0BAA0B,GACnC;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAC5C;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC3D;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,GACrE;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/D;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,GACzE;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC9E;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/D;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAC9C;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GAC1F;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/proxy-types.js b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/proxy-types.js new file mode 100644 index 000000000..7582b11c9 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/proxy-types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=proxy-types.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/proxy-types.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/proxy-types.js.map new file mode 100644 index 000000000..c96b0b07a --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/proxy-types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"proxy-types.js","sourceRoot":"","sources":["../../../src/agent/transports/proxy-types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/types.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/types.d.ts new file mode 100644 index 000000000..25d2c5f80 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/types.d.ts @@ -0,0 +1,12 @@ +import type { AgentEvent, AgentTool, Message, Model, QueuedMessage } from "@mariozechner/pi-ai"; +export interface AgentRunConfig { + systemPrompt: string; + tools: AgentTool[]; + model: Model; + reasoning?: "low" | "medium" | "high"; + getQueuedMessages?: () => Promise[]>; +} +export interface AgentTransport { + run(messages: Message[], userMessage: Message, config: AgentRunConfig, signal?: AbortSignal): AsyncIterable; +} +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/types.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/types.d.ts.map new file mode 100644 index 000000000..e6dda3a25 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/agent/transports/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGhG,MAAM,WAAW,cAAc;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACtC,iBAAiB,CAAC,EAAE,CAAC,CAAC,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;CACzD;AAKD,MAAM,WAAW,cAAc;IAC9B,GAAG,CACF,QAAQ,EAAE,OAAO,EAAE,EACnB,WAAW,EAAE,OAAO,EACpB,MAAM,EAAE,cAAc,EACtB,MAAM,CAAC,EAAE,WAAW,GAClB,aAAa,CAAC,UAAU,CAAC,CAAC;CAC7B"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/types.js b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/types.js new file mode 100644 index 000000000..718fd38ae --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/types.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/types.js.map new file mode 100644 index 000000000..66ffd98ea --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/transports/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/agent/transports/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/types.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/types.d.ts new file mode 100644 index 000000000..532caf682 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/types.d.ts @@ -0,0 +1,15 @@ +import type { AssistantMessage, Context } from "@mariozechner/pi-ai"; +export interface DebugLogEntry { + timestamp: string; + request: { + provider: string; + model: string; + context: Context; + }; + response?: AssistantMessage; + error?: unknown; + sseEvents: string[]; + ttft?: number; + totalTime?: number; +} +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/types.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/types.d.ts.map new file mode 100644 index 000000000..31a37bdd4 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agent/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAErE,MAAM,WAAW,aAAa;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAC/D,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/types.js b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/types.js new file mode 100644 index 000000000..718fd38ae --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/agent/types.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/types.js.map new file mode 100644 index 000000000..f0e743be3 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/agent/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/agent/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/app.css b/apps/macos/Sources/Clawdis/Resources/WebChat/app.css new file mode 100644 index 000000000..da46cb9e3 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/app.css @@ -0,0 +1,2 @@ +/*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */ +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight:initial;--tw-leading:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-x-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-content:""}}}:root{--syntax-keyword:oklch(57.7% .245 27.325);--syntax-entity:oklch(51.1% .136 307.715);--syntax-constant:oklch(43.5% .141 237.016);--syntax-string:oklch(29.6% .103 244.038);--syntax-variable:oklch(60.8% .178 54.291);--syntax-comment:oklch(54% .019 247.858);--syntax-tag:oklch(40.3% .111 145.348);--syntax-heading:oklch(43.5% .141 237.016);--syntax-list:oklch(53.7% .108 88.766);--syntax-addition-bg:oklch(98.4% .029 166.113);--syntax-addition-fg:oklch(40.3% .111 145.348);--syntax-deletion-bg:oklch(98.1% .025 17.672);--syntax-deletion-fg:oklch(43.1% .183 27.522)}.dark{--syntax-keyword:oklch(69.8% .159 21.174);--syntax-entity:oklch(79.2% .124 307.715);--syntax-constant:oklch(73.2% .137 237.016);--syntax-string:oklch(78.6% .08 237.016);--syntax-variable:oklch(74% .141 54.291);--syntax-comment:oklch(62.6% .025 247.858);--syntax-tag:oklch(81.2% .159 145.348);--syntax-heading:oklch(52.3% .181 237.016);--syntax-list:oklch(86.6% .141 88.766);--syntax-addition-bg:oklch(18.8% .06 166.113);--syntax-addition-fg:oklch(87% .147 145.348);--syntax-deletion-bg:oklch(23.3% .129 17.672);--syntax-deletion-fg:oklch(92% .067 17.672)}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:var(--syntax-keyword)}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:var(--syntax-entity)}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-variable,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id{color:var(--syntax-constant)}.hljs-regexp,.hljs-string,.hljs-meta .hljs-string{color:var(--syntax-string)}.hljs-built_in,.hljs-symbol{color:var(--syntax-variable)}.hljs-comment,.hljs-code,.hljs-formula{color:var(--syntax-comment)}.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo{color:var(--syntax-tag)}.hljs-subst{color:var(--color-text-primary)}.hljs-section{color:var(--syntax-heading);font-weight:700}.hljs-bullet{color:var(--syntax-list)}.hljs-emphasis{color:var(--color-text-primary);font-style:italic}.hljs-strong{color:var(--color-text-primary);font-weight:700}.hljs-addition{color:var(--syntax-addition-fg);background-color:var(--syntax-addition-bg)}.hljs-deletion{color:var(--syntax-deletion-fg);background-color:var(--syntax-deletion-bg)}@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(fonts/KaTeX_AMS-Regular.woff2)format("woff2"),url(fonts/KaTeX_AMS-Regular.woff)format("woff"),url(fonts/KaTeX_AMS-Regular.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(fonts/KaTeX_Caligraphic-Bold.woff2)format("woff2"),url(fonts/KaTeX_Caligraphic-Bold.woff)format("woff"),url(fonts/KaTeX_Caligraphic-Bold.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Caligraphic-Regular.woff2)format("woff2"),url(fonts/KaTeX_Caligraphic-Regular.woff)format("woff"),url(fonts/KaTeX_Caligraphic-Regular.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(fonts/KaTeX_Fraktur-Bold.woff2)format("woff2"),url(fonts/KaTeX_Fraktur-Bold.woff)format("woff"),url(fonts/KaTeX_Fraktur-Bold.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Fraktur-Regular.woff2)format("woff2"),url(fonts/KaTeX_Fraktur-Regular.woff)format("woff"),url(fonts/KaTeX_Fraktur-Regular.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(fonts/KaTeX_Main-Bold.woff2)format("woff2"),url(fonts/KaTeX_Main-Bold.woff)format("woff"),url(fonts/KaTeX_Main-Bold.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(fonts/KaTeX_Main-BoldItalic.woff2)format("woff2"),url(fonts/KaTeX_Main-BoldItalic.woff)format("woff"),url(fonts/KaTeX_Main-BoldItalic.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(fonts/KaTeX_Main-Italic.woff2)format("woff2"),url(fonts/KaTeX_Main-Italic.woff)format("woff"),url(fonts/KaTeX_Main-Italic.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Main-Regular.woff2)format("woff2"),url(fonts/KaTeX_Main-Regular.woff)format("woff"),url(fonts/KaTeX_Main-Regular.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(fonts/KaTeX_Math-BoldItalic.woff2)format("woff2"),url(fonts/KaTeX_Math-BoldItalic.woff)format("woff"),url(fonts/KaTeX_Math-BoldItalic.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(fonts/KaTeX_Math-Italic.woff2)format("woff2"),url(fonts/KaTeX_Math-Italic.woff)format("woff"),url(fonts/KaTeX_Math-Italic.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(fonts/KaTeX_SansSerif-Bold.woff2)format("woff2"),url(fonts/KaTeX_SansSerif-Bold.woff)format("woff"),url(fonts/KaTeX_SansSerif-Bold.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(fonts/KaTeX_SansSerif-Italic.woff2)format("woff2"),url(fonts/KaTeX_SansSerif-Italic.woff)format("woff"),url(fonts/KaTeX_SansSerif-Italic.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(fonts/KaTeX_SansSerif-Regular.woff2)format("woff2"),url(fonts/KaTeX_SansSerif-Regular.woff)format("woff"),url(fonts/KaTeX_SansSerif-Regular.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Script-Regular.woff2)format("woff2"),url(fonts/KaTeX_Script-Regular.woff)format("woff"),url(fonts/KaTeX_Script-Regular.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Size1-Regular.woff2)format("woff2"),url(fonts/KaTeX_Size1-Regular.woff)format("woff"),url(fonts/KaTeX_Size1-Regular.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Size2-Regular.woff2)format("woff2"),url(fonts/KaTeX_Size2-Regular.woff)format("woff"),url(fonts/KaTeX_Size2-Regular.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Size3-Regular.woff2)format("woff2"),url(fonts/KaTeX_Size3-Regular.woff)format("woff"),url(fonts/KaTeX_Size3-Regular.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Size4-Regular.woff2)format("woff2"),url(fonts/KaTeX_Size4-Regular.woff)format("woff"),url(fonts/KaTeX_Size4-Regular.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Typewriter-Regular.woff2)format("woff2"),url(fonts/KaTeX_Typewriter-Regular.woff)format("woff"),url(fonts/KaTeX_Typewriter-Regular.ttf)format("truetype")}.katex{text-indent:0;text-rendering:auto;font:1.21em/1.2 KaTeX_Main,Times New Roman,serif}.katex *{border-color:currentColor;-ms-high-contrast-adjust:none!important}.katex .katex-version:after{content:"0.16.25"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;width:1px;height:1px;padding:0;position:absolute;overflow:hidden}.katex .katex-html>.newline{display:block}.katex .base{white-space:nowrap;width:min-content;position:relative}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;table-layout:fixed;display:inline-table}.katex .vlist-r{display:table-row}.katex .vlist{vertical-align:bottom;display:table-cell;position:relative}.katex .vlist>span{height:0;display:block;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{width:0;overflow:hidden}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{vertical-align:bottom;width:2px;min-width:2px;font-size:1px;display:table-cell}.katex .vbox{flex-direction:column;align-items:baseline;display:inline-flex}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{flex-direction:row;display:inline-flex}.katex .thinbox{width:0;max-width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;width:100%;display:inline-block}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{width:0;position:relative}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;width:100%;display:inline-block}.katex .hdashline{border-bottom-style:dashed;width:100%;display:inline-block}.katex .sqrt>.root{margin-left:.277778em;margin-right:-.555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.833333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.16667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.33333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.66667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.45667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.14667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.714286em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.857143em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.14286em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.28571em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.42857em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.71429em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.05714em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.46857em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.96286em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.55429em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.11111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.33333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.30444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.76444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.416667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.583333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.833333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.72833em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.07333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.347222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.416667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.486111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.694444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.833333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.44028em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.72778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.289352em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.347222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.405093em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.520833em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.578704em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.694444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.833333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.20023em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.43981em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.24108em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.289296em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.385728em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.433944em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.48216em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.578592em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.694311em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.833173em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.19961em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.200965em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.241158em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.281351em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.321543em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.361736em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.401929em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.482315em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.694534em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.833601em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{width:.12em;display:inline-block}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{min-width:1px;display:inline-block}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;height:inherit;width:100%;display:block;position:absolute}.katex svg path{stroke:none}.katex img{border-style:none;min-width:0;max-width:none;min-height:0;max-height:none}.katex .stretchy{width:100%;display:block;position:relative;overflow:hidden}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{width:100%;position:relative;overflow:hidden}.katex .halfarrow-left{width:50.2%;position:absolute;left:0;overflow:hidden}.katex .halfarrow-right{width:50.2%;position:absolute;right:0;overflow:hidden}.katex .brace-left{width:25.1%;position:absolute;left:0;overflow:hidden}.katex .brace-center{width:50%;position:absolute;left:25%;overflow:hidden}.katex .brace-right{width:25.1%;position:absolute;right:0;overflow:hidden}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{box-sizing:border-box;border:.04em solid}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{box-sizing:border-box;border-top:.049em solid;border-right:.049em solid;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo)")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo)")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{text-align:left;display:inline-block;position:absolute;right:calc(50% + .3em)}.katex .cd-label-right{text-align:right;display:inline-block;position:absolute;left:calc(50% + .3em)}.katex-display{text-align:center;margin:1em 0;display:block}.katex-display>.katex{text-align:center;white-space:nowrap;display:block}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{text-align:left;padding-left:2em}body{counter-reset:katexEqnNo mmlEqnNo}.katex-display{margin:0}.markdown-content h1{margin-top:calc(var(--spacing)*5);margin-bottom:calc(var(--spacing)*2);font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.markdown-content h2{margin-top:calc(var(--spacing)*4);margin-bottom:calc(var(--spacing)*2);font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.markdown-content h3{margin-top:calc(var(--spacing)*3);margin-bottom:calc(var(--spacing)*2);font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.markdown-content h4{margin-top:calc(var(--spacing)*3);margin-bottom:calc(var(--spacing)*2);font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.markdown-content h5{margin-top:calc(var(--spacing)*2);margin-bottom:calc(var(--spacing)*1);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.markdown-content h6{margin-top:calc(var(--spacing)*2);margin-bottom:calc(var(--spacing)*1);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.markdown-content p{margin-top:calc(var(--spacing)*4);--tw-leading:var(--leading-relaxed);max-width:100%;line-height:var(--leading-relaxed)}.markdown-content p:first-child{margin-top:calc(var(--spacing)*0)}.markdown-content a{color:var(--primary);text-decoration-line:underline}@media (hover:hover){.markdown-content a:hover{color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.markdown-content a:hover{color:color-mix(in oklab,var(--primary)80%,transparent)}}}.markdown-content strong{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.markdown-content em{font-style:italic}.markdown-content ul{margin-block:calc(var(--spacing)*4);list-style-type:disc}:where(.markdown-content ul>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}.markdown-content ul{padding-left:calc(var(--spacing)*6)}.markdown-content ol{margin-block:calc(var(--spacing)*4);list-style-type:decimal}:where(.markdown-content ol>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}.markdown-content ol{padding-left:calc(var(--spacing)*6)}.markdown-content li{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.markdown-content li>ul,.markdown-content li>ol{margin-top:calc(var(--spacing)*2);margin-bottom:calc(var(--spacing)*0)}.markdown-content li>p{margin-bottom:calc(var(--spacing)*2)}.markdown-content li>p:last-child{margin-bottom:calc(var(--spacing)*0)}.markdown-content blockquote{margin-block:calc(var(--spacing)*4);border-left-style:var(--tw-border-style);border-left-width:4px;border-color:var(--border);padding-left:calc(var(--spacing)*4);color:var(--muted-foreground)}.markdown-content code:not(.hljs){background-color:var(--muted);padding-inline:calc(var(--spacing)*1.5);padding-block:calc(var(--spacing)*.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--foreground);border-radius:.25rem}.markdown-content table{margin:calc(var(--spacing)*0);border-collapse:collapse;width:100%}.markdown-content th{border-right-style:var(--tw-border-style);border-right-width:1px;border-bottom-style:var(--tw-border-style);border-bottom-width:1px;border-color:var(--border);background-color:var(--muted);padding:calc(var(--spacing)*2);text-align:left;--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--foreground)}.markdown-content th:last-child{border-right-style:var(--tw-border-style);border-right-width:0}.markdown-content td{border-right-style:var(--tw-border-style);border-right-width:1px;border-bottom-style:var(--tw-border-style);border-bottom-width:1px;border-color:var(--border);padding:calc(var(--spacing)*2);color:var(--foreground)}.markdown-content td:last-child{border-right-style:var(--tw-border-style);border-right-width:0}.markdown-content tr:last-child td{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.markdown-content hr{margin-block:calc(var(--spacing)*8);border-style:var(--tw-border-style);border-width:0;border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--border)}:root,:host{--color-border:var(--border);--shadow-2xs:var(--shadow-2xs);--shadow-xs:var(--shadow-xs);--shadow-sm:var(--shadow-sm);--shadow:var(--shadow);--shadow-md:var(--shadow-md);--shadow-lg:var(--shadow-lg);--shadow-xl:var(--shadow-xl);--shadow-2xl:var(--shadow-2xl);--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-serif:ui-serif,Georgia,Cambria,"Times New Roman",Times,serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-yellow-50:oklch(98.7% .026 102.212);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-950:oklch(28.6% .066 53.813);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-blue-50:oklch(97% .014 254.604);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-950:oklch(28.2% .091 267.935);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-6xl:72rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height:calc(1.5/1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25/1.875);--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--text-5xl:3rem;--text-5xl--line-height:1;--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--leading-tight:1.25;--leading-relaxed:1.625;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}:root{--background:oklch(100% 0 0);--foreground:oklch(14.5% 0 0);--card:oklch(100% 0 0);--card-foreground:oklch(14.5% 0 0);--popover:oklch(100% 0 0);--popover-foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--muted:oklch(97% 0 0);--muted-foreground:oklch(55.6% 0 0);--accent:oklch(97% 0 0);--accent-foreground:oklch(40% .18 240);--destructive:oklch(57.7% .245 27.325);--destructive-foreground:oklch(100% 0 0);--border:oklch(92.2% 0 0);--input:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--chart-1:oklch(81% .1 252);--chart-2:oklch(53.553% .02798 259.829);--chart-3:oklch(55% .22 263);--chart-4:oklch(49% .22 264);--chart-5:oklch(42% .18 266);--sidebar:oklch(98.5% 0 0);--sidebar-foreground:oklch(14.5% 0 0);--sidebar-primary:oklch(20.5% 0 0);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(97% 0 0);--sidebar-accent-foreground:oklch(20.5% 0 0);--sidebar-border:oklch(92.2% 0 0);--sidebar-ring:oklch(70.8% 0 0);--font-sans:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-serif:ui-serif,Georgia,Cambria,"Times New Roman",Times,serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--radius:.625rem;--shadow-2xs:0 1px 3px 0px #0000000d;--shadow-xs:0 1px 3px 0px #0000000d;--shadow-sm:0 1px 3px 0px #0000001a,0 1px 2px -1px #0000001a;--shadow:0 1px 3px 0px #0000001a,0 1px 2px -1px #0000001a;--shadow-md:0 1px 3px 0px #0000001a,0 2px 4px -1px #0000001a;--shadow-lg:0 1px 3px 0px #0000001a,0 4px 6px -1px #0000001a;--shadow-xl:0 1px 3px 0px #0000001a,0 8px 10px -1px #0000001a;--shadow-2xl:0 1px 3px 0px #00000040;--tracking-normal:0em;--spacing:.25rem}.dark{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20.5% 0 0);--card-foreground:oklch(98.5% 0 0);--popover:oklch(26.9% 0 0);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(26.9% 0 0);--muted-foreground:oklch(70.8% 0 0);--accent:oklch(37.1% 0 0);--accent-foreground:oklch(75% .18 85);--destructive:oklch(70.4% .191 22.216);--destructive-foreground:oklch(98.5% 0 0);--border:oklch(27.5% 0 0);--input:oklch(32.5% 0 0);--ring:oklch(55.6% 0 0);--chart-1:oklch(81% .1 252);--chart-2:oklch(62% .19 260);--chart-3:oklch(55% .22 263);--chart-4:oklch(49% .22 264);--chart-5:oklch(42% .18 266);--sidebar:oklch(20.5% 0 0);--sidebar-foreground:oklch(98.5% 0 0);--sidebar-primary:oklch(48.8% .243 264.376);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(26.9% 0 0);--sidebar-accent-foreground:oklch(98.5% 0 0);--sidebar-border:oklch(27.5% 0 0);--sidebar-ring:oklch(43.9% 0 0);--font-sans:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-serif:ui-serif,Georgia,Cambria,"Times New Roman",Times,serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--radius:.625rem;--shadow-2xs:0 1px 3px 0px #0000000d;--shadow-xs:0 1px 3px 0px #0000000d;--shadow-sm:0 1px 3px 0px #0000001a,0 1px 2px -1px #0000001a;--shadow:0 1px 3px 0px #0000001a,0 1px 2px -1px #0000001a;--shadow-md:0 1px 3px 0px #0000001a,0 2px 4px -1px #0000001a;--shadow-lg:0 1px 3px 0px #0000001a,0 4px 6px -1px #0000001a;--shadow-xl:0 1px 3px 0px #0000001a,0 8px 10px -1px #0000001a;--shadow-2xl:0 1px 3px 0px #00000040}@layer theme;@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-1{top:calc(var(--spacing)*-1)}.top-0{top:calc(var(--spacing)*0)}.top-1\/2{top:50%}.top-4{top:calc(var(--spacing)*4)}.-right-1{right:calc(var(--spacing)*-1)}.right-0{right:calc(var(--spacing)*0)}.right-2{right:calc(var(--spacing)*2)}.right-4{right:calc(var(--spacing)*4)}.-bottom-4{bottom:calc(var(--spacing)*-4)}.bottom-0{bottom:calc(var(--spacing)*0)}.left-0{left:calc(var(--spacing)*0)}.left-1\/2{left:50%}.left-4{left:calc(var(--spacing)*4)}.z-10{z-index:10}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.col-start-2{grid-column-start:2}.row-span-2{grid-row:span 2/span 2}.row-start-1{grid-row-start:1}.float-left{float:left}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.m-0{margin:calc(var(--spacing)*0)}.mx-1{margin-inline:calc(var(--spacing)*1)}.mx-4{margin-inline:calc(var(--spacing)*4)}.mx-auto{margin-inline:auto}.my-2{margin-block:calc(var(--spacing)*2)}.my-4{margin-block:calc(var(--spacing)*4)}.my-8{margin-block:calc(var(--spacing)*8)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mr-2{margin-right:calc(var(--spacing)*2)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.mb-10{margin-bottom:calc(var(--spacing)*10)}.-ml-6{margin-left:calc(var(--spacing)*-6)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.h-1{height:calc(var(--spacing)*1)}.h-2{height:calc(var(--spacing)*2)}.h-3{height:calc(var(--spacing)*3)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-11{height:calc(var(--spacing)*11)}.h-12{height:calc(var(--spacing)*12)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-\[1px\]{height:1px}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-0{max-height:calc(var(--spacing)*0)}.max-h-16{max-height:calc(var(--spacing)*16)}.max-h-48{max-height:calc(var(--spacing)*48)}.max-h-64{max-height:calc(var(--spacing)*64)}.max-h-96{max-height:calc(var(--spacing)*96)}.max-h-\[2000px\]{max-height:2000px}.max-h-full{max-height:100%}.min-h-\[80px\]{min-height:80px}.min-h-screen{min-height:100vh}.w-1{width:calc(var(--spacing)*1)}.w-1\/2{width:50%}.w-1\/3{width:33.3333%}.w-2{width:calc(var(--spacing)*2)}.w-3{width:calc(var(--spacing)*3)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-8{width:calc(var(--spacing)*8)}.w-10{width:calc(var(--spacing)*10)}.w-11{width:calc(var(--spacing)*11)}.w-12{width:calc(var(--spacing)*12)}.w-16{width:calc(var(--spacing)*16)}.w-64{width:calc(var(--spacing)*64)}.w-240{width:calc(var(--spacing)*240)}.w-\[1px\]{width:1px}.w-fit{width:fit-content}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-\[1000px\]{max-width:1000px}.max-w-full{max-width:100%}.max-w-md{max-width:var(--container-md)}.max-w-none{max-width:none}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-\[80px\]{min-width:80px}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x:calc(calc(1/2*100%)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-x-full{--tw-translate-x:-100%;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-0{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y:calc(calc(1/2*100%)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.rotate-90{rotate:90deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-col-resize{cursor:col-resize}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.cursor-row-resize{cursor:row-resize}.resize{resize:both}.resize-none{resize:none}.resize-x{resize:horizontal}.resize-y{resize:vertical}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.appearance-none{appearance:none}.auto-rows-min{grid-auto-rows:min-content}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-rows-\[auto_auto\]{grid-template-rows:auto auto}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-12>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*12)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*12)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*2)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-x-reverse)))}.self-start{align-self:flex-start}.justify-self-end{justify-self:flex-end}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.\!rounded-none{border-radius:0!important}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.rounded-b-lg{border-bottom-right-radius:var(--radius);border-bottom-left-radius:var(--radius)}.\!border-0{border-style:var(--tw-border-style)!important;border-width:0!important}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-solid{--tw-border-style:solid;border-style:solid}.border-border{border-color:var(--border)}.border-destructive,.border-destructive\/50{border-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.border-destructive\/50{border-color:color-mix(in oklab,var(--destructive)50%,transparent)}}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-gray-400{border-color:var(--color-gray-400)}.border-input{border-color:var(--input)}.border-primary{border-color:var(--primary)}.border-transparent{border-color:#0000}.\!bg-background{background-color:var(--background)!important}.\!bg-red-500{background-color:var(--color-red-500)!important}.\!bg-transparent{background-color:#0000!important}.bg-accent,.bg-accent\/50{background-color:var(--accent)}@supports (color:color-mix(in lab, red, red)){.bg-accent\/50{background-color:color-mix(in oklab,var(--accent)50%,transparent)}}.bg-background,.bg-background\/90{background-color:var(--background)}@supports (color:color-mix(in lab, red, red)){.bg-background\/90{background-color:color-mix(in oklab,var(--background)90%,transparent)}}.bg-background\/95{background-color:var(--background)}@supports (color:color-mix(in lab, red, red)){.bg-background\/95{background-color:color-mix(in oklab,var(--background)95%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\/90{background-color:#000000e6}@supports (color:color-mix(in lab, red, red)){.bg-black\/90{background-color:color-mix(in oklab,var(--color-black)90%,transparent)}}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-border{background-color:var(--border)}.bg-card{background-color:var(--card)}.bg-destructive,.bg-destructive\/10{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.bg-destructive\/10{background-color:color-mix(in oklab,var(--destructive)10%,transparent)}}.bg-emerald-500\/15{background-color:#00bb7f26}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/15{background-color:color-mix(in oklab,var(--color-emerald-500)15%,transparent)}}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-500{background-color:var(--color-gray-500)}.bg-muted{background-color:var(--muted)}.bg-muted-foreground,.bg-muted-foreground\/30{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.bg-muted-foreground\/30{background-color:color-mix(in oklab,var(--muted-foreground)30%,transparent)}}.bg-muted\/30{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.bg-muted\/30{background-color:color-mix(in oklab,var(--muted)30%,transparent)}}.bg-muted\/50{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.bg-muted\/50{background-color:color-mix(in oklab,var(--muted)50%,transparent)}}.bg-muted\/60{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.bg-muted\/60{background-color:color-mix(in oklab,var(--muted)60%,transparent)}}.bg-popover{background-color:var(--popover)}.bg-primary{background-color:var(--primary)}.bg-primary-foreground\/20{background-color:var(--primary-foreground)}@supports (color:color-mix(in lab, red, red)){.bg-primary-foreground\/20{background-color:color-mix(in oklab,var(--primary-foreground)20%,transparent)}}.bg-primary\/5{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.bg-primary\/5{background-color:color-mix(in oklab,var(--primary)5%,transparent)}}.bg-primary\/10{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.bg-primary\/10{background-color:color-mix(in oklab,var(--primary)10%,transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/15{background-color:color-mix(in oklab,var(--color-red-500)15%,transparent)}}.bg-secondary{background-color:var(--secondary)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-yellow-50{background-color:var(--color-yellow-50)}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-muted-foreground{--tw-gradient-from:var(--muted-foreground);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-foreground{--tw-gradient-via:var(--foreground);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-muted-foreground{--tw-gradient-to:var(--muted-foreground);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.bg-\[length\:200\%_100\%\]{background-size:200% 100%}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.bg-center{background-position:50%}.bg-no-repeat{background-repeat:no-repeat}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing)*0)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-2\.5{padding:calc(var(--spacing)*2.5)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-0{padding-inline:calc(var(--spacing)*0)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.px-8{padding-inline:calc(var(--spacing)*8)}.py-0{padding-block:calc(var(--spacing)*0)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-10{padding-block:calc(var(--spacing)*10)}.py-15{padding-block:calc(var(--spacing)*15)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-10{padding-top:calc(var(--spacing)*10)}.pr-6{padding-right:calc(var(--spacing)*6)}.pr-8{padding-right:calc(var(--spacing)*8)}.pb-0{padding-bottom:calc(var(--spacing)*0)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-4{padding-left:calc(var(--spacing)*4)}.text-center{text-align:center}.text-left{text-align:left}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.break-words{overflow-wrap:break-word}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent-foreground{color:var(--accent-foreground)}.text-card-foreground{color:var(--card-foreground)}.text-current{color:currentColor}.text-destructive{color:var(--destructive)}.text-destructive-foreground{color:var(--destructive-foreground)}.text-emerald-600{color:var(--color-emerald-600)}.text-foreground{color:var(--foreground)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-green-500{color:var(--color-green-500)}.text-green-600{color:var(--color-green-600)}.text-muted-foreground,.text-muted-foreground\/50{color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.text-muted-foreground\/50{color:color-mix(in oklab,var(--muted-foreground)50%,transparent)}}.text-popover-foreground{color:var(--popover-foreground)}.text-primary{color:var(--primary)}.text-primary-foreground{color:var(--primary-foreground)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-secondary-foreground{color:var(--secondary-foreground)}.text-transparent{color:#0000}.text-white{color:var(--color-white)}.text-yellow-500{color:var(--color-yellow-500)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.placeholder-muted-foreground::placeholder{color:var(--muted-foreground)}.opacity-0{opacity:0}.opacity-25{opacity:.25}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-90{opacity:.9}.opacity-100{opacity:1}.shadow{--tw-shadow:var(--shadow);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:var(--shadow-2xl);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:var(--shadow-lg);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:var(--shadow-md);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:var(--shadow-sm);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:var(--shadow-xl);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:var(--shadow-xs);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-card{--tw-shadow-color:var(--card)}@supports (color:color-mix(in lab, red, red)){.shadow-card{--tw-shadow-color:color-mix(in oklab,var(--card)var(--tw-shadow-alpha),transparent)}}.ring-offset-background{--tw-ring-offset-color:var(--background)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition-\[color\,box-shadow\]{transition-property:color,box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-shadow{transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-300{--tw-duration:.3s;transition-duration:.3s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}@media (hover:hover){.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-70:is(:where(.peer):disabled~*){opacity:.7}.selection\:bg-primary ::selection{background-color:var(--primary)}.selection\:bg-primary::selection{background-color:var(--primary)}.selection\:text-primary-foreground ::selection{color:var(--primary-foreground)}.selection\:text-primary-foreground::selection{color:var(--primary-foreground)}.file\:inline-flex::file-selector-button{display:inline-flex}.file\:h-7::file-selector-button{height:calc(var(--spacing)*7)}.file\:border-0::file-selector-button{border-style:var(--tw-border-style);border-width:0}.file\:bg-transparent::file-selector-button{background-color:#0000}.file\:text-sm::file-selector-button{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.file\:font-medium::file-selector-button{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.placeholder\:text-muted-foreground::placeholder{color:var(--muted-foreground)}.before\:absolute:before{content:var(--tw-content);position:absolute}.before\:inset-x-0:before{content:var(--tw-content);inset-inline:calc(var(--spacing)*0)}.before\:inset-y-0:before{content:var(--tw-content);inset-block:calc(var(--spacing)*0)}.before\:-top-2:before{content:var(--tw-content);top:calc(var(--spacing)*-2)}.before\:-right-2:before{content:var(--tw-content);right:calc(var(--spacing)*-2)}.before\:-bottom-2:before{content:var(--tw-content);bottom:calc(var(--spacing)*-2)}.before\:-left-2:before{content:var(--tw-content);left:calc(var(--spacing)*-2)}.before\:h-5:before{content:var(--tw-content);height:calc(var(--spacing)*5)}.before\:w-5:before{content:var(--tw-content);width:calc(var(--spacing)*5)}.before\:content-\[\'\'\]:before{--tw-content:"";content:var(--tw-content)}.last\:mb-0:last-child{margin-bottom:calc(var(--spacing)*0)}@media (hover:hover){.hover\:border-b-2:hover{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.hover\:border-border:hover{border-color:var(--border)}.hover\:border-gray-400:hover{border-color:var(--color-gray-400)}.hover\:border-muted-foreground\/50:hover{border-color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.hover\:border-muted-foreground\/50:hover{border-color:color-mix(in oklab,var(--muted-foreground)50%,transparent)}}.hover\:\!bg-accent:hover{background-color:var(--accent)!important}.hover\:bg-accent:hover,.hover\:bg-accent\/50:hover{background-color:var(--accent)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/50:hover{background-color:color-mix(in oklab,var(--accent)50%,transparent)}}.hover\:bg-blue-600:hover{background-color:var(--color-blue-600)}.hover\:bg-destructive\/10:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-destructive\/10:hover{background-color:color-mix(in oklab,var(--destructive)10%,transparent)}}.hover\:bg-destructive\/80:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-destructive\/80:hover{background-color:color-mix(in oklab,var(--destructive)80%,transparent)}}.hover\:bg-destructive\/90:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab,var(--destructive)90%,transparent)}}.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\:bg-gray-300:hover{background-color:var(--color-gray-300)}.hover\:bg-gray-600:hover{background-color:var(--color-gray-600)}.hover\:bg-muted:hover{background-color:var(--muted)}.hover\:bg-primary\/80:hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-primary\/80:hover{background-color:color-mix(in oklab,var(--primary)80%,transparent)}}.hover\:bg-primary\/90:hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,var(--primary)90%,transparent)}}.hover\:bg-red-600:hover{background-color:var(--color-red-600)}.hover\:bg-secondary:hover,.hover\:bg-secondary\/50:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-secondary\/50:hover{background-color:color-mix(in oklab,var(--secondary)50%,transparent)}}.hover\:bg-secondary\/80:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-secondary\/80:hover{background-color:color-mix(in oklab,var(--secondary)80%,transparent)}}.hover\:text-accent-foreground:hover{color:var(--accent-foreground)}.hover\:text-foreground:hover{color:var(--foreground)}.hover\:no-underline:hover{text-decoration-line:none}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-md:hover{--tw-shadow:var(--shadow-md);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-ring:focus{--tw-ring-color:var(--ring)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:ring-offset-background:focus{--tw-ring-offset-color:var(--background)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:border-ring:focus-visible{border-color:var(--ring)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-ring:focus-visible,.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:color-mix(in oklab,var(--ring)50%,transparent)}}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color:var(--background)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.has-\[ui-card-action\]\:grid-cols-\[1fr_auto\]:has(:is(ui-card-action)){grid-template-columns:1fr auto}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-inline:calc(var(--spacing)*2.5)}.aria-invalid\:border-destructive[aria-invalid=true]{border-color:var(--destructive)}.aria-invalid\:ring-destructive\/20[aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.aria-invalid\:ring-destructive\/20[aria-invalid=true]{--tw-ring-color:color-mix(in oklab,var(--destructive)20%,transparent)}}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:var(--muted-foreground)}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x:calc(var(--spacing)*5);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=checked\]\:border-destructive[data-state=checked]{border-color:var(--destructive)}.data-\[state\=checked\]\:border-primary[data-state=checked]{border-color:var(--primary)}.data-\[state\=checked\]\:bg-destructive[data-state=checked]{background-color:var(--destructive)}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:var(--primary)}.data-\[state\=checked\]\:text-destructive-foreground[data-state=checked]{color:var(--destructive-foreground)}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:var(--primary-foreground)}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:var(--input)}@media (min-width:40rem){.sm\:mb-1{margin-bottom:calc(var(--spacing)*1)}.sm\:mb-2{margin-bottom:calc(var(--spacing)*2)}.sm\:block{display:block}.sm\:hidden{display:none}.sm\:translate-x-0{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:px-8{padding-inline:calc(var(--spacing)*8)}.sm\:py-4{padding-block:calc(var(--spacing)*4)}.sm\:text-left{text-align:left}}@media (min-width:48rem){.md\:top-0{top:calc(var(--spacing)*0)}.md\:right-0{right:calc(var(--spacing)*0)}.md\:left-auto{left:auto}.md\:float-none{float:none}.md\:m-0{margin:calc(var(--spacing)*0)}.md\:mt-0{margin-top:calc(var(--spacing)*0)}.md\:block{display:block}.md\:hidden{display:none}.md\:inline-block{display:inline-block}.md\:w-full{width:100%}.md\:translate-x-0{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:border-0{border-style:var(--tw-border-style);border-width:0}.md\:border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.md\:border-solid{--tw-border-style:solid;border-style:solid}.md\:border-gray-400{border-color:var(--color-gray-400)}.md\:p-0{padding:calc(var(--spacing)*0)}.md\:px-8{padding-inline:calc(var(--spacing)*8)}.md\:py-8{padding-block:calc(var(--spacing)*8)}.md\:pr-0{padding-right:calc(var(--spacing)*0)}.md\:pb-10{padding-bottom:calc(var(--spacing)*10)}.md\:pl-6{padding-left:calc(var(--spacing)*6)}.md\:text-left{text-align:left}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.md\:before\:-top-1:before{content:var(--tw-content);top:calc(var(--spacing)*-1)}.md\:before\:-right-1:before{content:var(--tw-content);right:calc(var(--spacing)*-1)}.md\:before\:-bottom-1:before{content:var(--tw-content);bottom:calc(var(--spacing)*-1)}.md\:before\:-left-1:before{content:var(--tw-content);left:calc(var(--spacing)*-1)}.md\:before\:h-3:before{content:var(--tw-content);height:calc(var(--spacing)*3)}.md\:before\:w-3:before{content:var(--tw-content);width:calc(var(--spacing)*3)}}@media (min-width:64rem){.lg\:hidden{display:none}.lg\:w-full{width:100%}.lg\:translate-x-0{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.lg\:px-8{padding-inline:calc(var(--spacing)*8)}.lg\:pt-6{padding-top:calc(var(--spacing)*6)}.lg\:text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}}@media (min-width:80rem){.xl\:hidden{display:none}.xl\:translate-x-0{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}}.dark\:border-destructive:where(.dark,.dark *){border-color:var(--destructive)}.dark\:bg-blue-950:where(.dark,.dark *){background-color:var(--color-blue-950)}.dark\:bg-input\/30:where(.dark,.dark *){background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-input\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--input)30%,transparent)}}.dark\:bg-yellow-950:where(.dark,.dark *){background-color:var(--color-yellow-950)}.dark\:text-gray-400:where(.dark,.dark *){color:var(--color-gray-400)}.dark\:text-green-400:where(.dark,.dark *){color:var(--color-green-400)}.dark\:text-green-500:where(.dark,.dark *){color:var(--color-green-500)}.dark\:aria-invalid\:ring-destructive\/40:where(.dark,.dark *)[aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\:aria-invalid\:ring-destructive\/40:where(.dark,.dark *)[aria-invalid=true]{--tw-ring-color:color-mix(in oklab,var(--destructive)40%,transparent)}}.\[\&_p\]\:leading-relaxed p{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.\[\&\>\*\:last-child\]\:\!mb-0>:last-child{margin-bottom:calc(var(--spacing)*0)!important}.\[\&\>button\]\:\!bg-transparent>button{background-color:#0000!important}@media (hover:hover){.\[\&\>button\]\:hover\:\!bg-accent>button:hover{background-color:var(--accent)!important}}.\[\&\>svg\]\:pointer-events-none>svg{pointer-events:none}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:top-4>svg{top:calc(var(--spacing)*4)}.\[\&\>svg\]\:left-4>svg{left:calc(var(--spacing)*4)}.\[\&\>svg\]\:size-3>svg{width:calc(var(--spacing)*3);height:calc(var(--spacing)*3)}.\[\&\>svg\]\:text-destructive>svg{color:var(--destructive)}.\[\&\>svg\]\:text-foreground>svg{color:var(--foreground)}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y:-3px;translate:var(--tw-translate-x)var(--tw-translate-y)}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:calc(var(--spacing)*7)}@media (hover:hover){.\[\@media\(hover\:hover\)\]\:opacity-0{opacity:0}@media (hover:hover){.\[\@media\(hover\:hover\)\]\:group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}}}body{-webkit-font-smoothing:antialiased;font-size:16px}*{scrollbar-width:thin;scrollbar-color:var(--color-border)#0000}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background-color:var(--color-border);border-radius:4px}::-webkit-scrollbar-thumb:hover{background-color:#0000}.fixed.inset-0 button[aria-label*=Close],.fixed.inset-0 button[type=button]{cursor:pointer}@keyframes shimmer{0%{background-position:-200% 0}to{background-position:200% 0}}.animate-shimmer{animation:2s ease-in-out infinite shimmer}.user-message-container{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background:linear-gradient(135deg,#d94f001f,#ff6b001f,#d4a5001f);border:1px solid #ff6b0040;max-width:100%;transition:all .2s cubic-bezier(.4,0,.2,1);position:relative}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-leading{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/AgentInterface.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/AgentInterface.d.ts new file mode 100644 index 000000000..2ad48b958 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/AgentInterface.d.ts @@ -0,0 +1,39 @@ +import { LitElement } from "lit"; +import "./MessageEditor.js"; +import "./MessageList.js"; +import "./Messages.js"; +import type { Agent } from "../agent/agent.js"; +import "./StreamingMessageContainer.js"; +import type { Attachment } from "../utils/attachment-utils.js"; +export declare class AgentInterface extends LitElement { + session?: Agent; + enableAttachments: boolean; + enableModelSelector: boolean; + enableThinkingSelector: boolean; + showThemeToggle: boolean; + onApiKeyRequired?: (provider: string) => Promise; + onBeforeSend?: () => void | Promise; + onBeforeToolCall?: (toolName: string, args: any) => boolean | Promise; + onCostClick?: () => void; + private _messageEditor; + private _streamingContainer; + private _autoScroll; + private _lastScrollTop; + private _lastClientHeight; + private _scrollContainer?; + private _resizeObserver?; + private _unsubscribeSession?; + setInput(text: string, attachments?: Attachment[]): void; + setAutoScroll(enabled: boolean): void; + protected createRenderRoot(): HTMLElement | DocumentFragment; + willUpdate(changedProperties: Map): void; + connectedCallback(): Promise; + disconnectedCallback(): void; + private setupSessionSubscription; + private _handleScroll; + sendMessage(input: string, attachments?: Attachment[]): Promise; + private renderMessages; + private renderStats; + render(): import("lit-html").TemplateResult<1>; +} +//# sourceMappingURL=AgentInterface.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/AgentInterface.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/AgentInterface.d.ts.map new file mode 100644 index 000000000..90e8e7880 --- /dev/null +++ b/apps/macos/Sources/Clawd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IAWjD,aAAa,CAAC,OAAO,EAAE,OAAO;cAIlB,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAI5D,UAAU,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;IASxC,iBAAiB;IAkCvB,oBAAoB;IAmB7B,OAAO,CAAC,wBAAwB;IAqBhC,OAAO,CAAC,aAAa,CAwBnB;IAEW,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,UAAU,EAAE;IAsClE,OAAO,CAAC,cAAc;IAmCtB,OAAO,CAAC,WAAW;IAgDV,MAAM;CA4Cf"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/AgentInterface.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/AgentInterface.js new file mode 100644 index 000000000..2b32b1026 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/AgentInterface.js @@ -0,0 +1,330 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { html, LitElement } from "lit"; +import { customElement, property, query } from "lit/decorators.js"; +import { ModelSelector } from "../dialogs/ModelSelector.js"; +import "./MessageEditor.js"; +import "./MessageList.js"; +import "./Messages.js"; // Import for side effects to register the custom elements +import { getAppStorage } from "../storage/app-storage.js"; +import "./StreamingMessageContainer.js"; +import { formatUsage } from "../utils/format.js"; +import { i18n } from "../utils/i18n.js"; +let AgentInterface = class AgentInterface extends LitElement { + constructor() { + super(...arguments); + this.enableAttachments = true; + this.enableModelSelector = true; + this.enableThinkingSelector = true; + this.showThemeToggle = false; + this._autoScroll = true; + this._lastScrollTop = 0; + this._lastClientHeight = 0; + this._handleScroll = (_ev) => { + if (!this._scrollContainer) + return; + const currentScrollTop = this._scrollContainer.scrollTop; + const scrollHeight = this._scrollContainer.scrollHeight; + const clientHeight = this._scrollContainer.clientHeight; + const distanceFromBottom = scrollHeight - currentScrollTop - clientHeight; + // Ignore relayout due to message editor getting pushed up by stats + if (clientHeight < this._lastClientHeight) { + this._lastClientHeight = clientHeight; + return; + } + // Only disable auto-scroll if user scrolled UP or is far from bottom + if (currentScrollTop !== 0 && currentScrollTop < this._lastScrollTop && distanceFromBottom > 50) { + this._autoScroll = false; + } + else if (distanceFromBottom < 10) { + // Re-enable if very close to bottom + this._autoScroll = true; + } + this._lastScrollTop = currentScrollTop; + this._lastClientHeight = clientHeight; + }; + } + setInput(text, attachments) { + const update = () => { + if (!this._messageEditor) + requestAnimationFrame(update); + else { + this._messageEditor.value = text; + this._messageEditor.attachments = attachments || []; + } + }; + update(); + } + setAutoScroll(enabled) { + this._autoScroll = enabled; + } + createRenderRoot() { + return this; + } + willUpdate(changedProperties) { + super.willUpdate(changedProperties); + // Re-subscribe when session property changes + if (changedProperties.has("session")) { + this.setupSessionSubscription(); + } + } + async connectedCallback() { + super.connectedCallback(); + this.style.display = "flex"; + this.style.flexDirection = "column"; + this.style.height = "100%"; + this.style.minHeight = "0"; + // Wait for first render to get scroll container + await this.updateComplete; + this._scrollContainer = this.querySelector(".overflow-y-auto"); + if (this._scrollContainer) { + // Set up ResizeObserver to detect content changes + this._resizeObserver = new ResizeObserver(() => { + if (this._autoScroll && this._scrollContainer) { + this._scrollContainer.scrollTop = this._scrollContainer.scrollHeight; + } + }); + // Observe the content container inside the scroll container + const contentContainer = this._scrollContainer.querySelector(".max-w-3xl"); + if (contentContainer) { + this._resizeObserver.observe(contentContainer); + } + // Set up scroll listener with better detection + this._scrollContainer.addEventListener("scroll", this._handleScroll); + } + // Subscribe to external session if provided + this.setupSessionSubscription(); + } + disconnectedCallback() { + super.disconnectedCallback(); + // Clean up observers and listeners + if (this._resizeObserver) { + this._resizeObserver.disconnect(); + this._resizeObserver = undefined; + } + if (this._scrollContainer) { + this._scrollContainer.removeEventListener("scroll", this._handleScroll); + } + if (this._unsubscribeSession) { + this._unsubscribeSession(); + this._unsubscribeSession = undefined; + } + } + setupSessionSubscription() { + if (this._unsubscribeSession) { + this._unsubscribeSession(); + this._unsubscribeSession = undefined; + } + if (!this.session) + return; + this._unsubscribeSession = this.session.subscribe(async (ev) => { + if (ev.type === "state-update") { + if (this._streamingContainer) { + this._streamingContainer.isStreaming = ev.state.isStreaming; + this._streamingContainer.setMessage(ev.state.streamMessage, !ev.state.isStreaming); + } + this.requestUpdate(); + } + else if (ev.type === "error-no-model") { + // TODO show some UI feedback + } + else if (ev.type === "error-no-api-key") { + // Handled by onApiKeyRequired callback + } + }); + } + async sendMessage(input, attachments) { + if ((!input.trim() && attachments?.length === 0) || this.session?.state.isStreaming) + return; + const session = this.session; + if (!session) + throw new Error("No session set on AgentInterface"); + if (!session.state.model) + throw new Error("No model set on AgentInterface"); + // Check if API key exists for the provider (only needed in direct mode) + const provider = session.state.model.provider; + const apiKey = await getAppStorage().providerKeys.get(provider); + // If no API key, prompt for it + if (!apiKey) { + if (!this.onApiKeyRequired) { + console.error("No API key configured and no onApiKeyRequired handler set"); + return; + } + const success = await this.onApiKeyRequired(provider); + // If still no API key, abort the send + if (!success) { + return; + } + } + // Call onBeforeSend hook before sending + if (this.onBeforeSend) { + await this.onBeforeSend(); + } + // Only clear editor after we know we can send + this._messageEditor.value = ""; + this._messageEditor.attachments = []; + this._autoScroll = true; // Enable auto-scroll when sending a message + await this.session?.prompt(input, attachments); + } + renderMessages() { + if (!this.session) + return html `
${i18n("No session available")}
`; + const state = this.session.state; + // Build a map of tool results to allow inline rendering in assistant messages + const toolResultsById = new Map(); + for (const message of state.messages) { + if (message.role === "toolResult") { + toolResultsById.set(message.toolCallId, message); + } + } + return html ` +
+ + + + + +
+ `; + } + renderStats() { + if (!this.session) + return html `
`; + const state = this.session.state; + const totals = state.messages + .filter((m) => m.role === "assistant") + .reduce((acc, msg) => { + const usage = msg.usage; + if (usage) { + acc.input += usage.input; + acc.output += usage.output; + acc.cacheRead += usage.cacheRead; + acc.cacheWrite += usage.cacheWrite; + acc.cost.total += usage.cost.total; + } + return acc; + }, { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }, + }); + const hasTotals = totals.input || totals.output || totals.cacheRead || totals.cacheWrite; + const totalsText = hasTotals ? formatUsage(totals) : ""; + return html ` +
+
+ ${this.showThemeToggle ? html `` : html ``} +
+
+ ${totalsText + ? this.onCostClick + ? html `${totalsText}` + : html `${totalsText}` + : ""} +
+
+ `; + } + render() { + if (!this.session) + return html `
${i18n("No session set")}
`; + const session = this.session; + const state = this.session.state; + return html ` +
+ +
+
${this.renderMessages()}
+
+ + +
+
+ { + this.sendMessage(input, attachments); + }} + .onAbort=${() => session.abort()} + .onModelSelect=${() => { + ModelSelector.open(state.model, (model) => session.setModel(model)); + }} + .onThinkingChange=${this.enableThinkingSelector + ? (level) => { + session.setThinkingLevel(level); + } + : undefined} + > + ${this.renderStats()} +
+
+
+ `; + } +}; +__decorate([ + property({ attribute: false }) +], AgentInterface.prototype, "session", void 0); +__decorate([ + property({ type: Boolean }) +], AgentInterface.prototype, "enableAttachments", void 0); +__decorate([ + property({ type: Boolean }) +], AgentInterface.prototype, "enableModelSelector", void 0); +__decorate([ + property({ type: Boolean }) +], AgentInterface.prototype, "enableThinkingSelector", void 0); +__decorate([ + property({ type: Boolean }) +], AgentInterface.prototype, "showThemeToggle", void 0); +__decorate([ + property({ attribute: false }) +], AgentInterface.prototype, "onApiKeyRequired", void 0); +__decorate([ + property({ attribute: false }) +], AgentInterface.prototype, "onBeforeSend", void 0); +__decorate([ + property({ attribute: false }) +], AgentInterface.prototype, "onBeforeToolCall", void 0); +__decorate([ + property({ attribute: false }) +], AgentInterface.prototype, "onCostClick", void 0); +__decorate([ + query("message-editor") +], AgentInterface.prototype, "_messageEditor", void 0); +__decorate([ + query("streaming-message-container") +], AgentInterface.prototype, "_streamingContainer", void 0); +AgentInterface = __decorate([ + customElement("agent-interface") +], AgentInterface); +export { AgentInterface }; +// Register custom element with guard +if (!customElements.get("agent-interface")) { + customElements.define("agent-interface", AgentInterface); +} +//# sourceMappingURL=AgentInterface.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/AgentInterface.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/AgentInterface.js.map new file mode 100644 index 000000000..345944390 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/AgentInterface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AgentInterface.js","sourceRoot":"","sources":["../../src/components/AgentInterface.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,oBAAoB,CAAC;AAC5B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,eAAe,CAAC,CAAC,0DAA0D;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,gCAAgC,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAIjC,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,UAAU;IAAvC;;QAGuB,sBAAiB,GAAG,IAAI,CAAC;QACzB,wBAAmB,GAAG,IAAI,CAAC;QAC3B,2BAAsB,GAAG,IAAI,CAAC;QAC9B,oBAAe,GAAG,KAAK,CAAC;QAc7C,gBAAW,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lF,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAgU1B;;AAED,qCAAqC;AACrC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAAC;IAC5C,cAAc,CAAC,MAAM,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC;AAC1D,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/AttachmentTile.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/AttachmentTile.d.ts new file mode 100644 index 000000000..e7ce66585 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/AttachmentTile.d.ts @@ -0,0 +1,12 @@ +import { LitElement } from "lit"; +import type { Attachment } from "../utils/attachment-utils.js"; +export declare class AttachmentTile extends LitElement { + attachment: Attachment; + showDelete: boolean; + onDelete?: () => void; + protected createRenderRoot(): HTMLElement | DocumentFragment; + connectedCallback(): void; + private handleClick; + render(): import("lit-html").TemplateResult<1>; +} +//# sourceMappingURL=AttachmentTile.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/AttachmentTile.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/AttachmentTile.d.ts.map new file mode 100644 index 000000000..3c393ae5d --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/AttachmentTile.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"AttachmentTile.d.ts","sourceRoot":"","sources":["../../src/components/AttachmentTile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAKjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAG/D,qBACa,cAAe,SAAQ,UAAU;IACjB,UAAU,EAAG,UAAU,CAAC;IACvB,UAAU,UAAS;IACpC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;cAEf,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAI5D,iBAAiB,IAAI,IAAI;IAMlC,OAAO,CAAC,WAAW,CAEjB;IAEO,MAAM;CAmFf"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/AttachmentTile.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/AttachmentTile.js new file mode 100644 index 000000000..b1fca310c --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/AttachmentTile.js @@ -0,0 +1,115 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { icon } from "@mariozechner/mini-lit/dist/icons.js"; +import { LitElement } from "lit"; +import { customElement, property } from "lit/decorators.js"; +import { html } from "lit/html.js"; +import { FileSpreadsheet, FileText, X } from "lucide"; +import { AttachmentOverlay } from "../dialogs/AttachmentOverlay.js"; +import { i18n } from "../utils/i18n.js"; +let AttachmentTile = class AttachmentTile extends LitElement { + constructor() { + super(...arguments); + this.showDelete = false; + this.handleClick = () => { + AttachmentOverlay.open(this.attachment); + }; + } + createRenderRoot() { + return this; + } + connectedCallback() { + super.connectedCallback(); + this.style.display = "block"; + this.classList.add("max-h-16"); + } + render() { + const hasPreview = !!this.attachment.preview; + const isImage = this.attachment.type === "image"; + const isPdf = this.attachment.mimeType === "application/pdf"; + const isDocx = this.attachment.mimeType?.includes("wordprocessingml") || + this.attachment.fileName.toLowerCase().endsWith(".docx"); + const isPptx = this.attachment.mimeType?.includes("presentationml") || + this.attachment.fileName.toLowerCase().endsWith(".pptx"); + const isExcel = this.attachment.mimeType?.includes("spreadsheetml") || + this.attachment.fileName.toLowerCase().endsWith(".xlsx") || + this.attachment.fileName.toLowerCase().endsWith(".xls"); + // Choose the appropriate icon + const getDocumentIcon = () => { + if (isExcel) + return icon(FileSpreadsheet, "md"); + return icon(FileText, "md"); + }; + return html ` +
+ ${hasPreview + ? html ` +
+ ${this.attachment.fileName} + ${isPdf + ? html ` + +
+
${i18n("PDF")}
+
+ ` + : ""} +
+ ` + : html ` + +
+ ${getDocumentIcon()} +
+ ${this.attachment.fileName.length > 10 + ? this.attachment.fileName.substring(0, 8) + "..." + : this.attachment.fileName} +
+
+ `} + ${this.showDelete + ? html ` + + ` + : ""} +
+ `; + } +}; +__decorate([ + property({ type: Object }) +], AttachmentTile.prototype, "attachment", void 0); +__decorate([ + property({ type: Boolean }) +], AttachmentTile.prototype, "showDelete", void 0); +__decorate([ + property() +], AttachmentTile.prototype, "onDelete", void 0); +AttachmentTile = __decorate([ + customElement("attachment-tile") +], AttachmentTile); +export { AttachmentTile }; +//# sourceMappingURL=AttachmentTile.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/AttachmentTile.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/AttachmentTile.js.map new file mode 100644 index 000000000..f6e09f0b8 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/AttachmentTile.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AttachmentTile.js","sourceRoot":"","sources":["../../src/components/AttachmentTile.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,iBAAiB,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,EAAE,CAAC;gBACpB,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;YACnB,CAAC;;iBAEQ,IAAI,CAAC,QAAQ,CAAC;;UAErB,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;;OAEhB;YACD,CAAC,CAAC,EACJ;;GAED,CAAC;IACH,CAAC;CACD,CAAA;AArG4B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAyB;AACvB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAoB;AACpC;IAAX,QAAQ,EAAE;gDAAuB;AAHtB,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAsG1B"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/ConsoleBlock.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ConsoleBlock.d.ts new file mode 100644 index 000000000..e2881e9e7 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ConsoleBlock.d.ts @@ -0,0 +1,12 @@ +import { LitElement } from "lit"; +export declare class ConsoleBlock extends LitElement { + content: string; + variant: "default" | "error"; + private copied; + protected createRenderRoot(): HTMLElement | DocumentFragment; + connectedCallback(): void; + private copy; + updated(): void; + render(): import("lit-html").TemplateResult<1>; +} +//# sourceMappingURL=ConsoleBlock.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/ConsoleBlock.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ConsoleBlock.d.ts.map new file mode 100644 index 000000000..c2fc14cee --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ConsoleBlock.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ConsoleBlock.d.ts","sourceRoot":"","sources":["../../src/components/ConsoleBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAMjC,qBAAa,YAAa,SAAQ,UAAU;IAC/B,OAAO,EAAE,MAAM,CAAM;IACrB,OAAO,EAAE,SAAS,GAAG,OAAO,CAAa;IAC5C,OAAO,CAAC,MAAM,CAAS;cAEb,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAI5D,iBAAiB,IAAI,IAAI;YAKpB,IAAI;IAYT,OAAO;IAQP,MAAM;CAyBf"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/ConsoleBlock.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ConsoleBlock.js new file mode 100644 index 000000000..70a33a55a --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ConsoleBlock.js @@ -0,0 +1,84 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { icon } from "@mariozechner/mini-lit"; +import { LitElement } from "lit"; +import { property, state } from "lit/decorators.js"; +import { html } from "lit/html.js"; +import { Check, Copy } from "lucide"; +import { i18n } from "../utils/i18n.js"; +export class ConsoleBlock extends LitElement { + constructor() { + super(...arguments); + this.content = ""; + this.variant = "default"; + this.copied = false; + } + createRenderRoot() { + return this; + } + connectedCallback() { + super.connectedCallback(); + this.style.display = "block"; + } + async copy() { + try { + await navigator.clipboard.writeText(this.content || ""); + this.copied = true; + setTimeout(() => { + this.copied = false; + }, 1500); + } + catch (e) { + console.error("Copy failed", e); + } + } + updated() { + // Auto-scroll to bottom on content changes + const container = this.querySelector(".console-scroll"); + if (container) { + container.scrollTop = container.scrollHeight; + } + } + render() { + const isError = this.variant === "error"; + const textClass = isError ? "text-destructive" : "text-foreground"; + return html ` +
+
+ ${i18n("console")} + +
+
+
+${this.content || ""}
+
+
+ `; + } +} +__decorate([ + property() +], ConsoleBlock.prototype, "content", void 0); +__decorate([ + property() +], ConsoleBlock.prototype, "variant", void 0); +__decorate([ + state() +], ConsoleBlock.prototype, "copied", void 0); +// Register custom element +if (!customElements.get("console-block")) { + customElements.define("console-block", ConsoleBlock); +} +//# sourceMappingURL=ConsoleBlock.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/ConsoleBlock.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ConsoleBlock.js.map new file mode 100644 index 000000000..d27539c3c --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ConsoleBlock.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ConsoleBlock.js","sourceRoot":"","sources":["../../src/components/ConsoleBlock.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,MAAM,OAAO,YAAa,SAAQ,UAAU;IAA5C;;QACa,YAAO,GAAW,EAAE,CAAC;QACrB,YAAO,GAAwB,SAAS,CAAC;QACpC,WAAM,GAAG,KAAK,CAAC;IAwDjC,CAAC;IAtDmB,gBAAgB;QAClC,OAAO,IAAI,CAAC;IACb,CAAC;IAEQ,iBAAiB;QACzB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IAC9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AIjB,CAAC;IACH,CAAC;CACD;AA1DY;IAAX,QAAQ,EAAE;6CAAsB;AACrB;IAAX,QAAQ,EAAE;6CAA0C;AACpC;IAAhB,KAAK,EAAE;4CAAwB;AA0DjC,0BAA0B;AAC1B,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC;IAC1C,cAAc,CAAC,MAAM,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;AACtD,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/CustomProviderCard.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/CustomProviderCard.d.ts new file mode 100644 index 000000000..bf16b4493 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/CustomProviderCard.d.ts @@ -0,0 +1,17 @@ +import { LitElement, type TemplateResult } from "lit"; +import type { CustomProvider } from "../storage/stores/custom-providers-store.js"; +export declare class CustomProviderCard extends LitElement { + provider: CustomProvider; + isAutoDiscovery: boolean; + status?: { + modelCount: number; + status: "connected" | "disconnected" | "checking"; + }; + onRefresh?: (provider: CustomProvider) => void; + onEdit?: (provider: CustomProvider) => void; + onDelete?: (provider: CustomProvider) => void; + protected createRenderRoot(): this; + private renderStatus; + render(): TemplateResult; +} +//# sourceMappingURL=CustomProviderCard.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/CustomProviderCard.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/CustomProviderCard.d.ts.map new file mode 100644 index 000000000..06ae57470 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/CustomProviderCard.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"CustomProviderCard.d.ts","sourceRoot":"","sources":["../../src/components/CustomProviderCard.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAE5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAElF,qBACa,kBAAmB,SAAQ,UAAU;IACrB,QAAQ,EAAG,cAAc,CAAC;IACzB,eAAe,UAAS;IACzB,MAAM,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,WAAW,GAAG,cAAc,GAAG,UAAU,CAAA;KAAE,CAAC;IACnG,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,CAAC;IAC/C,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,CAAC;IAE1D,SAAS,CAAC,gBAAgB;IAI1B,OAAO,CAAC,YAAY;IAgCpB,MAAM,IAAI,cAAc;CAgDxB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/CustomProviderCard.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/CustomProviderCard.js new file mode 100644 index 000000000..6d8551edc --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/CustomProviderCard.js @@ -0,0 +1,110 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { i18n } from "@mariozechner/mini-lit"; +import { Button } from "@mariozechner/mini-lit/dist/Button.js"; +import { html, LitElement } from "lit"; +import { customElement, property } from "lit/decorators.js"; +let CustomProviderCard = class CustomProviderCard extends LitElement { + constructor() { + super(...arguments); + this.isAutoDiscovery = false; + } + createRenderRoot() { + return this; + } + renderStatus() { + if (!this.isAutoDiscovery) { + return html ` +
+ ${i18n("Models")}: ${this.provider.models?.length || 0} +
+ `; + } + if (!this.status) + return html ``; + const statusIcon = this.status.status === "connected" + ? html `` + : this.status.status === "checking" + ? html `` + : html ``; + const statusText = this.status.status === "connected" + ? `${this.status.modelCount} ${i18n("models")}` + : this.status.status === "checking" + ? i18n("Checking...") + : i18n("Disconnected"); + return html ` +
+ ${statusIcon} ${statusText} +
+ `; + } + render() { + return html ` +
+
+
+
${this.provider.name}
+
+ ${this.provider.type} + ${this.provider.baseUrl ? html ` • ${this.provider.baseUrl}` : ""} +
+ ${this.renderStatus()} +
+
+ ${this.isAutoDiscovery && this.onRefresh + ? Button({ + onClick: () => this.onRefresh?.(this.provider), + variant: "ghost", + size: "sm", + children: i18n("Refresh"), + }) + : ""} + ${this.onEdit + ? Button({ + onClick: () => this.onEdit?.(this.provider), + variant: "ghost", + size: "sm", + children: i18n("Edit"), + }) + : ""} + ${this.onDelete + ? Button({ + onClick: () => this.onDelete?.(this.provider), + variant: "ghost", + size: "sm", + children: i18n("Delete"), + }) + : ""} +
+
+
+ `; + } +}; +__decorate([ + property({ type: Object }) +], CustomProviderCard.prototype, "provider", void 0); +__decorate([ + property({ type: Boolean }) +], CustomProviderCard.prototype, "isAutoDiscovery", void 0); +__decorate([ + property({ type: Object }) +], CustomProviderCard.prototype, "status", void 0); +__decorate([ + property() +], CustomProviderCard.prototype, "onRefresh", void 0); +__decorate([ + property() +], CustomProviderCard.prototype, "onEdit", void 0); +__decorate([ + property() +], CustomProviderCard.prototype, "onDelete", void 0); +CustomProviderCard = __decorate([ + customElement("custom-provider-card") +], CustomProviderCard); +export { CustomProviderCard }; +//# sourceMappingURL=CustomProviderCard.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/CustomProviderCard.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/CustomProviderCard.js.map new file mode 100644 index 000000000..651757980 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/CustomProviderCard.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CustomProviderCard.js","sourceRoot":"","sources":["../../src/components/CustomProviderCard.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAIrD,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,UAAU;IAA3C;;QAEuB,oBAAe,GAAG,KAAK,CAAC;IA0FtD,CAAC;IApFU,gBAAgB;QACzB,OAAO,IAAI,CAAC;IACb,CAAC;IAEO,YAAY;QACnB,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAA;;OAEP,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;;IAEvD,CAAC;QACH,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAA,EAAE,CAAC;QAEhC,MAAM,UAAU,GACf,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,WAAW;YACjC,CAAC,CAAC,IAAI,CAAA,uCAAuC;YAC7C,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,UAAU;gBAClC,CAAC,CAAC,IAAI,CAAA,wCAAwC;gBAC9C,CAAC,CAAC,IAAI,CAAA,qCAAqC,CAAC;QAE/C,MAAM,UAAU,GACf,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,WAAW;YACjC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE;YAC/C,CAA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BAC7C,OAAO,EAAE,OAAO;gBAChB,IAAI,EAAE,IAAI;gBACV,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC;aACxB,CAAC;YACH,CAAC,CAAC,EACJ;;;;GAIH,CAAC;IACH,CAAC;CACD,CAAA;AA3F4B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAA2B;AACzB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2DAAyB;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAoF;AACnG;IAAX,QAAQ,EAAE;qDAAgD;AAC/C;IAAX,QAAQ,EAAE;kDAA6C;AAC5C;IAAX,QAAQ,EAAE;oDAA+C;AAN9C,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CA4F9B"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/ExpandableSection.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ExpandableSection.d.ts new file mode 100644 index 000000000..ba097f259 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ExpandableSection.d.ts @@ -0,0 +1,15 @@ +import { LitElement, type TemplateResult } from "lit"; +/** + * Reusable expandable section component for tool renderers. + * Captures children in connectedCallback and re-renders them in the details area. + */ +export declare class ExpandableSection extends LitElement { + summary: string; + defaultExpanded: boolean; + private expanded; + private capturedChildren; + protected createRenderRoot(): this; + connectedCallback(): void; + render(): TemplateResult; +} +//# sourceMappingURL=ExpandableSection.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/ExpandableSection.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ExpandableSection.d.ts.map new file mode 100644 index 000000000..1d4c599a2 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ExpandableSection.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ExpandableSection.d.ts","sourceRoot":"","sources":["../../src/components/ExpandableSection.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAI5D;;;GAGG;AACH,qBACa,iBAAkB,SAAQ,UAAU;IACpC,OAAO,EAAG,MAAM,CAAC;IACA,eAAe,UAAS;IAC5C,OAAO,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,gBAAgB,CAAc;IAEtC,SAAS,CAAC,gBAAgB;IAIjB,iBAAiB;IASjB,MAAM,IAAI,cAAc;CAgBjC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/ExpandableSection.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ExpandableSection.js new file mode 100644 index 000000000..fe323b412 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ExpandableSection.js @@ -0,0 +1,63 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { icon } from "@mariozechner/mini-lit"; +import { html, LitElement } from "lit"; +import { customElement, property, state } from "lit/decorators.js"; +import { ChevronDown, ChevronRight } from "lucide"; +/** + * Reusable expandable section component for tool renderers. + * Captures children in connectedCallback and re-renders them in the details area. + */ +let ExpandableSection = class ExpandableSection extends LitElement { + constructor() { + super(...arguments); + this.defaultExpanded = false; + this.expanded = false; + this.capturedChildren = []; + } + createRenderRoot() { + return this; // light DOM + } + connectedCallback() { + super.connectedCallback(); + // Capture children before first render + this.capturedChildren = Array.from(this.childNodes); + // Clear children (we'll re-insert them in render) + this.innerHTML = ""; + this.expanded = this.defaultExpanded; + } + render() { + return html ` +
+ + ${this.expanded ? html `
${this.capturedChildren}
` : ""} +
+ `; + } +}; +__decorate([ + property() +], ExpandableSection.prototype, "summary", void 0); +__decorate([ + property({ type: Boolean }) +], ExpandableSection.prototype, "defaultExpanded", void 0); +__decorate([ + state() +], ExpandableSection.prototype, "expanded", void 0); +ExpandableSection = __decorate([ + customElement("expandable-section") +], ExpandableSection); +export { ExpandableSection }; +//# sourceMappingURL=ExpandableSection.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/ExpandableSection.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ExpandableSection.js.map new file mode 100644 index 000000000..eaafa43fd --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ExpandableSection.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ExpandableSection.js","sourceRoot":"","sources":["../../src/components/ExpandableSection.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEnD;;;GAGG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IAA1C;;QAEuB,oBAAe,GAAG,KAAK,CAAC;QACpC,aAAQ,GAAG,KAAK,CAAC;QAC1B,qBAAgB,GAAW,EAAE,CAAC;IA+BvC,CAAC;IA7BU,gBAAgB;QACzB,OAAO,IAAI,CAAC,CAAC,YAAY;IAC1B,CAAC;IAEQ,iBAAiB;QACzB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,uCAAuC;QACvC,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACpD,kDAAkD;QAClD,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC;IACtC,CAAC;IAEQ,MAAM;QACd,OAAO,IAAI,CAAA;;;cAGC,GAAG,EAAE;YACb,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;QAChC,CAAC;;;OAGC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,EAAE,IAAI,CAAC;aAChD,IAAI,CAAC,OAAO;;MAEnB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAA,qBAAqB,IAAI,CAAC,gBAAgB,QAAQ,CAAC,CAAC,CAAC,EAAE;;GAE9E,CAAC;IACH,CAAC;CACD,CAAA;AAlCY;IAAX,QAAQ,EAAE;kDAAkB;AACA;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0DAAyB;AACpC;IAAhB,KAAK,EAAE;mDAA0B;AAHtB,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CAmC7B"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/Input.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/Input.d.ts new file mode 100644 index 000000000..035326652 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/Input.d.ts @@ -0,0 +1,26 @@ +import { type BaseComponentProps } from "@mariozechner/mini-lit/dist/mini.js"; +import { type Ref } from "lit/directives/ref.js"; +export type InputType = "text" | "email" | "password" | "number" | "url" | "tel" | "search"; +export type InputSize = "sm" | "md" | "lg"; +export interface InputProps extends BaseComponentProps { + type?: InputType; + size?: InputSize; + value?: string; + placeholder?: string; + label?: string; + error?: string; + disabled?: boolean; + required?: boolean; + name?: string; + autocomplete?: string; + min?: number; + max?: number; + step?: number; + inputRef?: Ref; + onInput?: (e: Event) => void; + onChange?: (e: Event) => void; + onKeyDown?: (e: KeyboardEvent) => void; + onKeyUp?: (e: KeyboardEvent) => void; +} +export declare const Input: import("@mariozechner/mini-lit/dist/mini.js").Component; +//# sourceMappingURL=Input.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/Input.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/Input.d.ts.map new file mode 100644 index 000000000..7641e5066 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/Input.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../src/components/Input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAM,MAAM,qCAAqC,CAAC;AAElF,OAAO,EAAE,KAAK,GAAG,EAAO,MAAM,uBAAuB,CAAC;AAGtD,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;AAC5F,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C,MAAM,WAAW,UAAW,SAAQ,kBAAkB;IACrD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAC7B,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAC9B,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,KAAK,qEAmFjB,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/Input.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/Input.js new file mode 100644 index 000000000..7d160be04 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/Input.js @@ -0,0 +1,57 @@ +import { fc } from "@mariozechner/mini-lit/dist/mini.js"; +import { html } from "lit"; +import { ref } from "lit/directives/ref.js"; +import { i18n } from "../utils/i18n.js"; +export const Input = fc(({ type = "text", size = "md", value = "", placeholder = "", label = "", error = "", disabled = false, required = false, name = "", autocomplete = "", min, max, step, inputRef, onInput, onChange, onKeyDown, onKeyUp, className = "", }) => { + const sizeClasses = { + sm: "h-8 px-3 py-1 text-sm", + md: "h-9 px-3 py-1 text-sm md:text-sm", + lg: "h-10 px-4 py-1 text-base", + }; + const baseClasses = "flex w-full min-w-0 rounded-md border bg-transparent text-foreground shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium"; + const interactionClasses = "placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground"; + const focusClasses = "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]"; + const darkClasses = "dark:bg-input/30"; + const stateClasses = error + ? "border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40" + : "border-input"; + const disabledClasses = "disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50"; + const handleInput = (e) => { + onInput?.(e); + }; + const handleChange = (e) => { + onChange?.(e); + }; + return html ` +
+ ${label + ? html ` + + ` + : ""} + + ${error ? html `${error}` : ""} +
+ `; +}); +//# sourceMappingURL=Input.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/Input.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/Input.js.map new file mode 100644 index 000000000..3b5225d8c --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/Input.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../src/components/Input.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,EAAE,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAY,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AA0BxC,MAAM,CAAC,MAAM,KAAK,GAAG,EAAE,CACtB,CAAC,EACA,IAAI,GAAG,MAAM,EACb,IAAI,GAAG,IAAI,EACX,KAAK,GAAG,EAAE,EACV,WAAW,GAAG,EAAE,EAChB,KAAK,GAAG,EAAE,EACV,KAAK,GAAG,EAAE,EACV,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,KAAK,EAChB,IAAI,GAAG,EAAE,EACT,YAAY,GAAG,EAAE,EACjB,GAAG,EACH,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,SAAS,EACT,OAAO,EACP,SAAS,GAAG,EAAE,GACd,EAAE,EAAE;IACJ,MAAM,WAAW,GAAG;QACnB,EAAE,EAAE,uBAAuB;QAC3B,EAAE,EAAE,kCAAkC;QACtC,EAAE,EA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S,CAAC,CAAC,CAAC,EAAE;;GAE5E,CAAC;AACH,CAAC,CACD,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageEditor.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageEditor.d.ts new file mode 100644 index 000000000..4855ec8ef --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageEditor.d.ts @@ -0,0 +1,43 @@ +import type { Model } from "@mariozechner/pi-ai"; +import { LitElement } from "lit"; +import { type Attachment } from "../utils/attachment-utils.js"; +import "./AttachmentTile.js"; +export declare class MessageEditor extends LitElement { + private _value; + private textareaRef; + get value(): string; + set value(val: string); + isStreaming: boolean; + currentModel?: Model; + thinkingLevel: "off" | "minimal" | "low" | "medium" | "high"; + showAttachmentButton: boolean; + showModelSelector: boolean; + showThinkingSelector: boolean; + onInput?: (value: string) => void; + onSend?: (input: string, attachments: Attachment[]) => void; + onAbort?: () => void; + onModelSelect?: () => void; + onThinkingChange?: (level: "off" | "minimal" | "low" | "medium" | "high") => void; + onFilesChange?: (files: Attachment[]) => void; + attachments: Attachment[]; + maxFiles: number; + maxFileSize: number; + acceptedTypes: string; + processingFiles: boolean; + isDragging: boolean; + private fileInputRef; + protected createRenderRoot(): HTMLElement | DocumentFragment; + private handleTextareaInput; + private handleKeyDown; + private handlePaste; + private handleSend; + private handleAttachmentClick; + private handleFilesSelected; + private removeFile; + private handleDragOver; + private handleDragLeave; + private handleDrop; + firstUpdated(): void; + render(): import("lit-html").TemplateResult<1>; +} +//# sourceMappingURL=MessageEditor.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageEditor.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageEditor.d.ts.map new file mode 100644 index 000000000..0ca819a2b --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageEditor.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"MessageEditor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,CAAC,YAAY,CAAiC;cAElC,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAIrE,OAAO,CAAC,mBAAmB,CAIzB;IAEF,OAAO,CAAC,aAAa,CAUnB;IAEF,OAAO,CAAC,WAAW,CAgDjB;IAEF,OAAO,CAAC,UAAU,CAEhB;IAEF,OAAO,CAAC,qBAAqB,CAE3B;YAEY,mBAAmB;IAmCjC,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,cAAc,CAMpB;IAEF,OAAO,CAAC,eAAe,CAUrB;IAEF,OAAO,CAAC,UAAU,CAkChB;IAEO,YAAY;IAOZ,MAAM;CAqKf"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageEditor.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageEditor.js new file mode 100644 index 000000000..675b15546 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageEditor.js @@ -0,0 +1,414 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { icon } from "@mariozechner/mini-lit"; +import { Button } from "@mariozechner/mini-lit/dist/Button.js"; +import { Select } from "@mariozechner/mini-lit/dist/Select.js"; +import { html, LitElement } from "lit"; +import { customElement, property, state } from "lit/decorators.js"; +import { createRef, ref } from "lit/directives/ref.js"; +import { Brain, Loader2, Paperclip, Send, Sparkles, Square } from "lucide"; +import { loadAttachment } from "../utils/attachment-utils.js"; +import { i18n } from "../utils/i18n.js"; +import "./AttachmentTile.js"; +let MessageEditor = class MessageEditor extends LitElement { + constructor() { + super(...arguments); + this._value = ""; + this.textareaRef = createRef(); + this.isStreaming = false; + this.thinkingLevel = "off"; + this.showAttachmentButton = true; + this.showModelSelector = true; + this.showThinkingSelector = true; + this.attachments = []; + this.maxFiles = 10; + this.maxFileSize = 20 * 1024 * 1024; // 20MB + this.acceptedTypes = "image/*,application/pdf,.docx,.pptx,.xlsx,.xls,.txt,.md,.json,.xml,.html,.css,.js,.ts,.jsx,.tsx,.yml,.yaml"; + this.processingFiles = false; + this.isDragging = false; + this.fileInputRef = createRef(); + this.handleTextareaInput = (e) => { + const textarea = e.target; + this.value = textarea.value; + this.onInput?.(this.value); + }; + this.handleKeyDown = (e) => { + if (e.key === "Enter" && !e.shiftKey) { + e.preventDefault(); + if (!this.isStreaming && !this.processingFiles && (this.value.trim() || this.attachments.length > 0)) { + this.handleSend(); + } + } + else if (e.key === "Escape" && this.isStreaming) { + e.preventDefault(); + this.onAbort?.(); + } + }; + this.handlePaste = async (e) => { + const items = e.clipboardData?.items; + if (!items) + return; + const imageFiles = []; + // Check for image items in clipboard + for (let i = 0; i < items.length; i++) { + const item = items[i]; + if (item.type.startsWith("image/")) { + const file = item.getAsFile(); + if (file) { + imageFiles.push(file); + } + } + } + // If we found images, process them + if (imageFiles.length > 0) { + e.preventDefault(); // Prevent default paste behavior + if (imageFiles.length + this.attachments.length > this.maxFiles) { + alert(`Maximum ${this.maxFiles} files allowed`); + return; + } + this.processingFiles = true; + const newAttachments = []; + for (const file of imageFiles) { + try { + if (file.size > this.maxFileSize) { + alert(`Image exceeds maximum size of ${Math.round(this.maxFileSize / 1024 / 1024)}MB`); + continue; + } + const attachment = await loadAttachment(file); + newAttachments.push(attachment); + } + catch (error) { + console.error("Error processing pasted image:", error); + alert(`Failed to process pasted image: ${String(error)}`); + } + } + this.attachments = [...this.attachments, ...newAttachments]; + this.onFilesChange?.(this.attachments); + this.processingFiles = false; + } + }; + this.handleSend = () => { + this.onSend?.(this.value, this.attachments); + }; + this.handleAttachmentClick = () => { + this.fileInputRef.value?.click(); + }; + this.handleDragOver = (e) => { + e.preventDefault(); + e.stopPropagation(); + if (!this.isDragging) { + this.isDragging = true; + } + }; + this.handleDragLeave = (e) => { + e.preventDefault(); + e.stopPropagation(); + // Only set isDragging to false if we're leaving the entire component + const rect = e.currentTarget.getBoundingClientRect(); + const x = e.clientX; + const y = e.clientY; + if (x <= rect.left || x >= rect.right || y <= rect.top || y >= rect.bottom) { + this.isDragging = false; + } + }; + this.handleDrop = async (e) => { + e.preventDefault(); + e.stopPropagation(); + this.isDragging = false; + const files = Array.from(e.dataTransfer?.files || []); + if (files.length === 0) + return; + if (files.length + this.attachments.length > this.maxFiles) { + alert(`Maximum ${this.maxFiles} files allowed`); + return; + } + this.processingFiles = true; + const newAttachments = []; + for (const file of files) { + try { + if (file.size > this.maxFileSize) { + alert(`${file.name} exceeds maximum size of ${Math.round(this.maxFileSize / 1024 / 1024)}MB`); + continue; + } + const attachment = await loadAttachment(file); + newAttachments.push(attachment); + } + catch (error) { + console.error(`Error processing ${file.name}:`, error); + alert(`Failed to process ${file.name}: ${String(error)}`); + } + } + this.attachments = [...this.attachments, ...newAttachments]; + this.onFilesChange?.(this.attachments); + this.processingFiles = false; + }; + } + get value() { + return this._value; + } + set value(val) { + const oldValue = this._value; + this._value = val; + this.requestUpdate("value", oldValue); + } + createRenderRoot() { + return this; + } + async handleFilesSelected(e) { + const input = e.target; + const files = Array.from(input.files || []); + if (files.length === 0) + return; + if (files.length + this.attachments.length > this.maxFiles) { + alert(`Maximum ${this.maxFiles} files allowed`); + input.value = ""; + return; + } + this.processingFiles = true; + const newAttachments = []; + for (const file of files) { + try { + if (file.size > this.maxFileSize) { + alert(`${file.name} exceeds maximum size of ${Math.round(this.maxFileSize / 1024 / 1024)}MB`); + continue; + } + const attachment = await loadAttachment(file); + newAttachments.push(attachment); + } + catch (error) { + console.error(`Error processing ${file.name}:`, error); + alert(`Failed to process ${file.name}: ${String(error)}`); + } + } + this.attachments = [...this.attachments, ...newAttachments]; + this.onFilesChange?.(this.attachments); + this.processingFiles = false; + input.value = ""; // Reset input + } + removeFile(fileId) { + this.attachments = this.attachments.filter((f) => f.id !== fileId); + this.onFilesChange?.(this.attachments); + } + firstUpdated() { + const textarea = this.textareaRef.value; + if (textarea) { + textarea.focus(); + } + } + render() { + // Check if current model supports thinking/reasoning + const model = this.currentModel; + const supportsThinking = model?.reasoning === true; // Models with reasoning:true support thinking + return html ` +
+ + ${this.isDragging + ? html ` +
+
${i18n("Drop files here")}
+
+ ` + : ""} + + + ${this.attachments.length > 0 + ? html ` +
+ ${this.attachments.map((attachment) => html ` + this.removeFile(attachment.id)} + > + `)} +
+ ` + : ""} + + + + + + + +
+ +
+ ${this.showAttachmentButton + ? this.processingFiles + ? html ` +
+ ${icon(Loader2, "sm", "animate-spin text-muted-foreground")} +
+ ` + : html ` + ${Button({ + variant: "ghost", + size: "icon", + className: "h-8 w-8", + onClick: this.handleAttachmentClick, + children: icon(Paperclip, "sm"), + })} + ` + : ""} + ${supportsThinking && this.showThinkingSelector + ? html ` + ${Select({ + value: this.thinkingLevel, + placeholder: i18n("Off"), + options: [ + { value: "off", label: i18n("Off"), icon: icon(Brain, "sm") }, + { value: "minimal", label: i18n("Minimal"), icon: icon(Brain, "sm") }, + { value: "low", label: i18n("Low"), icon: icon(Brain, "sm") }, + { value: "medium", label: i18n("Medium"), icon: icon(Brain, "sm") }, + { value: "high", label: i18n("High"), icon: icon(Brain, "sm") }, + ], + onChange: (value) => { + this.onThinkingChange?.(value); + }, + width: "80px", + size: "sm", + variant: "ghost", + fitContent: true, + })} + ` + : ""} +
+ + +
+ ${this.showModelSelector && this.currentModel + ? html ` + ${Button({ + variant: "ghost", + size: "sm", + onClick: () => { + // Focus textarea before opening model selector so focus returns there + this.textareaRef.value?.focus(); + // Wait for next frame to ensure focus takes effect before dialog captures it + requestAnimationFrame(() => { + this.onModelSelect?.(); + }); + }, + children: html ` + ${icon(Sparkles, "sm")} + ${this.currentModel.id} + `, + className: "h-8 text-xs truncate", + })} + ` + : ""} + ${this.isStreaming + ? html ` + ${Button({ + variant: "ghost", + size: "icon", + onClick: this.onAbort, + children: icon(Square, "sm"), + className: "h-8 w-8", + })} + ` + : html ` + ${Button({ + variant: "ghost", + size: "icon", + onClick: this.handleSend, + disabled: (!this.value.trim() && this.attachments.length === 0) || this.processingFiles, + children: html `
${icon(Send, "sm")}
`, + className: "h-8 w-8", + })} + `} +
+
+
+ `; + } +}; +__decorate([ + property() +], MessageEditor.prototype, "value", null); +__decorate([ + property() +], MessageEditor.prototype, "isStreaming", void 0); +__decorate([ + property() +], MessageEditor.prototype, "currentModel", void 0); +__decorate([ + property() +], MessageEditor.prototype, "thinkingLevel", void 0); +__decorate([ + property() +], MessageEditor.prototype, "showAttachmentButton", void 0); +__decorate([ + property() +], MessageEditor.prototype, "showModelSelector", void 0); +__decorate([ + property() +], MessageEditor.prototype, "showThinkingSelector", void 0); +__decorate([ + property() +], MessageEditor.prototype, "onInput", void 0); +__decorate([ + property() +], MessageEditor.prototype, "onSend", void 0); +__decorate([ + property() +], MessageEditor.prototype, "onAbort", void 0); +__decorate([ + property() +], MessageEditor.prototype, "onModelSelect", void 0); +__decorate([ + property() +], MessageEditor.prototype, "onThinkingChange", void 0); +__decorate([ + property() +], MessageEditor.prototype, "onFilesChange", void 0); +__decorate([ + property() +], MessageEditor.prototype, "attachments", void 0); +__decorate([ + property() +], MessageEditor.prototype, "maxFiles", void 0); +__decorate([ + property() +], MessageEditor.prototype, "maxFileSize", void 0); +__decorate([ + property() +], MessageEditor.prototype, "acceptedTypes", void 0); +__decorate([ + state() +], MessageEditor.prototype, "processingFiles", void 0); +__decorate([ + state() +], MessageEditor.prototype, "isDragging", void 0); +MessageEditor = __decorate([ + customElement("message-editor") +], MessageEditor); +export { MessageEditor }; +//# sourceMappingURL=MessageEditor.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageEditor.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageEditor.js.map new file mode 100644 index 000000000..c72d689ee --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageEditor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MessageEditor.js","sourceRoot":"","sources":["../../src/components/MessageEditor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAqB,MAAM,uCAAuC,CAAC;AAElF,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC3E,OAAO,EAAmB,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,qBAAqB,CAAC;AAGtB,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QACE,WAAM,GAAG,EAAE,CAAC;QACZ,gBAAW,GAAG,SAAS,EAAuB,CAAC;QAa3C,gBAAW,GAAG,KAAK,CAAC;QAEpB,kBAAa,GAAkD,KAAK,CAAC;QACrE,yBAAoB,GAAG,IAAI,CAAC;QAC5B,sBAAiB,GAAG,IAAI,CAAC;QACzB,yBAAoB,GAAG,IAAI,CAAC;QAO5B,gBAAW,GAAiB,EAAE,CAAC;QAC/B,aAAQ,GAAG,EAAE,CAAC;QACd,gBAAW,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,OAAO;QACvC,kBAAa,GACxB,4GAA4G,CAAC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AAK,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,eAAe;gBACvF,QAAQ,EAAE,IAAI,CAAA,0CAA0C,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ;gBAChF,SAAS,EAAE,SAAS;aACpB,CAAC;SAEL;;;;GAIH,CAAC;IACH,CAAC;CACD,CAAA;AA5XA;IADC,QAAQ,EAAE;0CAGV;AAQW;IAAX,QAAQ,EAAE;kDAAqB;AACpB;IAAX,QAAQ,EAAE;mDAA2B;AAC1B;IAAX,QAAQ,EAAE;oDAAsE;AACrE;IAAX,QAAQ,EAAE;2DAA6B;AAC5B;IAAX,QAAQ,EAAE;wDAA0B;AACzB;IAAX,QAAQ,EAAE;2DAA6B;AAC5B;IAAX,QAAQ,EAAE;8CAAmC;AAClC;IAAX,QAAQ,EAAE;6CAA6D;AAC5D;IAAX,QAAQ,EAAE;8CAAsB;AACrB;IAAX,QAAQ,EAAE;oDAA4B;AAC3B;IAAX,QAAQ,EAAE;uDAAmF;AAClF;IAAX,QAAQ,EAAE;oDAA+C;AAC9C;IAAX,QAAQ,EAAE;kDAAgC;AAC/B;IAAX,QAAQ,EAAE;+CAAe;AACd;IAAX,QAAQ,EAAE;kDAAgC;AAC/B;IAAX,QAAQ,EAAE;oDACmG;AAErG;IAAR,KAAK,EAAE;sDAAyB;AACxB;IAAR,KAAK,EAAE;iDAAoB;AAlChB,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CAiYzB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageList.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageList.d.ts new file mode 100644 index 000000000..d84bf60c0 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageList.d.ts @@ -0,0 +1,15 @@ +import type { AgentTool } from "@mariozechner/pi-ai"; +import { LitElement, type TemplateResult } from "lit"; +import type { AppMessage } from "./Messages.js"; +export declare class MessageList extends LitElement { + messages: AppMessage[]; + tools: AgentTool[]; + pendingToolCalls?: Set; + isStreaming: boolean; + onCostClick?: () => void; + protected createRenderRoot(): HTMLElement | DocumentFragment; + connectedCallback(): void; + private buildRenderItems; + render(): TemplateResult<1>; +} +//# sourceMappingURL=MessageList.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageList.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageList.d.ts.map new file mode 100644 index 000000000..f2039df5a --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageList.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../src/components/MessageList.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,SAAS,EAGT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAQ,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAG5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,qBAAa,WAAY,SAAQ,UAAU;IACf,QAAQ,EAAE,UAAU,EAAE,CAAM;IAC5B,KAAK,EAAE,SAAS,EAAE,CAAM;IACvB,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,WAAW,EAAE,OAAO,CAAS;IAC1B,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;cAEtC,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAI5D,iBAAiB,IAAI,IAAI;IAKlC,OAAO,CAAC,gBAAgB;IAuDf,MAAM;CAUf"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageList.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageList.js new file mode 100644 index 000000000..54542570a --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageList.js @@ -0,0 +1,104 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { html, LitElement } from "lit"; +import { property } from "lit/decorators.js"; +import { repeat } from "lit/directives/repeat.js"; +import { renderMessage } from "./message-renderer-registry.js"; +export class MessageList extends LitElement { + constructor() { + super(...arguments); + this.messages = []; + this.tools = []; + this.isStreaming = false; + } + createRenderRoot() { + return this; + } + connectedCallback() { + super.connectedCallback(); + this.style.display = "block"; + } + buildRenderItems() { + // Map tool results by call id for quick lookup + const resultByCallId = new Map(); + for (const message of this.messages) { + if (message.role === "toolResult") { + resultByCallId.set(message.toolCallId, message); + } + } + const items = []; + let index = 0; + for (const msg of this.messages) { + // Skip artifact messages - they're for session persistence only, not UI display + if (msg.role === "artifact") { + continue; + } + // Try custom renderer first + const customTemplate = renderMessage(msg); + if (customTemplate) { + items.push({ key: `msg:${index}`, template: customTemplate }); + index++; + continue; + } + // Fall back to built-in renderers + if (msg.role === "user") { + items.push({ + key: `msg:${index}`, + template: html ``, + }); + index++; + } + else if (msg.role === "assistant") { + const amsg = msg; + items.push({ + key: `msg:${index}`, + template: html ``, + }); + index++; + } + else { + // Skip standalone toolResult messages; they are rendered via paired tool-message above + // Skip unknown roles + } + } + return items; + } + render() { + const items = this.buildRenderItems(); + return html `
+ ${repeat(items, (it) => it.key, (it) => it.template)} +
`; + } +} +__decorate([ + property({ type: Array }) +], MessageList.prototype, "messages", void 0); +__decorate([ + property({ type: Array }) +], MessageList.prototype, "tools", void 0); +__decorate([ + property({ type: Object }) +], MessageList.prototype, "pendingToolCalls", void 0); +__decorate([ + property({ type: Boolean }) +], MessageList.prototype, "isStreaming", void 0); +__decorate([ + property({ attribute: false }) +], MessageList.prototype, "onCostClick", void 0); +// Register custom element +if (!customElements.get("message-list")) { + customElements.define("message-list", MessageList); +} +//# sourceMappingURL=MessageList.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageList.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageList.js.map new file mode 100644 index 000000000..73905f843 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/MessageList.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MessageList.js","sourceRoot":"","sources":["../../src/components/MessageList.ts"],"names":[],"mappings":";;;;;;AAKA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,MAAM,OAAO,WAAY,SAAQ,UAAU;IAA3C;;QAC4B,aAAQ,GAAiB,EAAE,CAAC;QAC5B,UAAK,GAAgB,EAAE,CAAC;QAEtB,gBAAW,GAAY,KAAK,CAAC;IA6E3D,CAAC;IA1EmB,gBAAgB;QAClC,OAAO,IAAI,CAAC;IACb,CAAC;IAEQ,iBAAiB;QACzB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IAC9B,CAAC;IAEO,gBAAgB;QACvB,+CAA+C;QAC/C,MAAM,cAAc,GAAG,IAAI,GAAG,EAAiC,CAAC;QAChE,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACrC,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;gBACnC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,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D,OAAO,KAAK,CAAC;IACd,CAAC;IAEQ,MAAM;QACd,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtC,OAAO,IAAI,CAAA;KACR,MAAM,CACP,KAAK,EACL,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,EACd,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CACnB;SACK,CAAC;IACT,CAAC;CACD;AAhF2B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;6CAA6B;AAC5B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;0CAAyB;AACvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAAgC;AAC9B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAA8B;AAC1B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;gDAA0B;AA8E1D,0BAA0B;AAC1B,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC;IACzC,cAAc,CAAC,MAAM,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;AACpD,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/Messages.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/Messages.d.ts new file mode 100644 index 000000000..11bc3640a --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/Messages.d.ts @@ -0,0 +1,64 @@ +import type { AgentTool, AssistantMessage as AssistantMessageType, ToolCall, ToolResultMessage as ToolResultMessageType, UserMessage as UserMessageType } from "@mariozechner/pi-ai"; +import { LitElement, type TemplateResult } from "lit"; +import type { Attachment } from "../utils/attachment-utils.js"; +import "./ThinkingBlock.js"; +export type UserMessageWithAttachments = UserMessageType & { + attachments?: Attachment[]; +}; +export interface ArtifactMessage { + role: "artifact"; + action: "create" | "update" | "delete"; + filename: string; + content?: string; + title?: string; + timestamp: string; +} +type BaseMessage = AssistantMessageType | UserMessageWithAttachments | ToolResultMessageType | ArtifactMessage; +export interface CustomMessages { +} +export type AppMessage = BaseMessage | CustomMessages[keyof CustomMessages]; +export declare class UserMessage extends LitElement { + message: UserMessageWithAttachments; + protected createRenderRoot(): HTMLElement | DocumentFragment; + connectedCallback(): void; + render(): TemplateResult<1>; +} +export declare class AssistantMessage extends LitElement { + message: AssistantMessageType; + tools?: AgentTool[]; + pendingToolCalls?: Set; + hideToolCalls: boolean; + toolResultsById?: Map; + isStreaming: boolean; + onCostClick?: () => void; + protected createRenderRoot(): HTMLElement | DocumentFragment; + connectedCallback(): void; + render(): TemplateResult<1>; +} +export declare class ToolMessageDebugView extends LitElement { + callArgs: any; + result?: ToolResultMessageType; + hasResult: boolean; + protected createRenderRoot(): HTMLElement | DocumentFragment; + connectedCallback(): void; + private pretty; + render(): TemplateResult<1>; +} +export declare class ToolMessage extends LitElement { + toolCall: ToolCall; + tool?: AgentTool; + result?: ToolResultMessageType; + pending: boolean; + aborted: boolean; + isStreaming: boolean; + protected createRenderRoot(): HTMLElement | DocumentFragment; + connectedCallback(): void; + render(): TemplateResult; +} +export declare class AbortedMessage extends LitElement { + protected createRenderRoot(): HTMLElement | DocumentFragment; + connectedCallback(): void; + protected render(): unknown; +} +export {}; +//# sourceMappingURL=Messages.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/Messages.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/Messages.d.ts.map new file mode 100644 index 000000000..fb4bcb385 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/Messages.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Messages.d.ts","sourceRoot":"","sources":["../../src/components/Messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,SAAS,EACT,gBAAgB,IAAI,o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,EAAE,OAAO,CAAS;IAC1B,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;cAEtC,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAI5D,iBAAiB,IAAI,IAAI;IAKzB,MAAM;CA2Df;AAED,qBACa,oBAAqB,SAAQ,UAAU;IACvB,QAAQ,EAAE,GAAG,CAAC;IACd,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC9B,SAAS,EAAE,OAAO,CAAS;cAErC,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAI5D,iBAAiB,IAAI,IAAI;IAKlC,OAAO,CAAC,MAAM;IAYL,MAAM;CA2Bf;AAED,qBACa,WAAY,SAAQ,UAAU;IACd,QAAQ,EAAG,QAAQ,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;IACtB,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAS;IACzB,OAAO,EAAE,OAAO,CAAS;IACzB,WAAW,EAAE,OAAO,CAAS;cAEvC,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAI5D,iBAAiB,IAAI,IAAI;IAKzB,MAAM;CAiCf;AAED,qBACa,cAAe,SAAQ,UAAU;cAC1B,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAI5D,iBAAiB,IAAI,IAAI;cAKf,MAAM,IAAI,OAAO;CAGpC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/Messages.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/Messages.js new file mode 100644 index 000000000..20b3f36fe --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/Messages.js @@ -0,0 +1,275 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { html, LitElement } from "lit"; +import { customElement, property } from "lit/decorators.js"; +import { renderTool } from "../tools/index.js"; +import { formatUsage } from "../utils/format.js"; +import { i18n } from "../utils/i18n.js"; +import "./ThinkingBlock.js"; +let UserMessage = class UserMessage extends LitElement { + createRenderRoot() { + return this; + } + connectedCallback() { + super.connectedCallback(); + this.style.display = "block"; + } + render() { + const content = typeof this.message.content === "string" + ? this.message.content + : this.message.content.find((c) => c.type === "text")?.text || ""; + return html ` +
+
+ + ${this.message.attachments && this.message.attachments.length > 0 + ? html ` +
+ ${this.message.attachments.map((attachment) => html ` `)} +
+ ` + : ""} +
+
+ `; + } +}; +__decorate([ + property({ type: Object }) +], UserMessage.prototype, "message", void 0); +UserMessage = __decorate([ + customElement("user-message") +], UserMessage); +export { UserMessage }; +let AssistantMessage = class AssistantMessage extends LitElement { + constructor() { + super(...arguments); + this.hideToolCalls = false; + this.isStreaming = false; + } + createRenderRoot() { + return this; + } + connectedCallback() { + super.connectedCallback(); + this.style.display = "block"; + } + render() { + // Render content in the order it appears + const orderedParts = []; + for (const chunk of this.message.content) { + if (chunk.type === "text" && chunk.text.trim() !== "") { + orderedParts.push(html ``); + } + else if (chunk.type === "thinking" && chunk.thinking.trim() !== "") { + orderedParts.push(html ``); + } + else if (chunk.type === "toolCall") { + if (!this.hideToolCalls) { + const tool = this.tools?.find((t) => t.name === chunk.name); + const pending = this.pendingToolCalls?.has(chunk.id) ?? false; + const result = this.toolResultsById?.get(chunk.id); + // A tool call is aborted if the message was aborted and there's no result for this tool call + const aborted = this.message.stopReason === "aborted" && !result; + orderedParts.push(html ``); + } + } + } + return html ` +
+ ${orderedParts.length ? html `
${orderedParts}
` : ""} + ${this.message.usage && !this.isStreaming + ? this.onCostClick + ? html `
${formatUsage(this.message.usage)}
` + : html `
${formatUsage(this.message.usage)}
` + : ""} + ${this.message.stopReason === "error" && this.message.errorMessage + ? html ` +
+ ${i18n("Error:")} ${this.message.errorMessage} +
+ ` + : ""} + ${this.message.stopReason === "aborted" + ? html `${i18n("Request aborted")}` + : ""} +
+ `; + } +}; +__decorate([ + property({ type: Object }) +], AssistantMessage.prototype, "message", void 0); +__decorate([ + property({ type: Array }) +], AssistantMessage.prototype, "tools", void 0); +__decorate([ + property({ type: Object }) +], AssistantMessage.prototype, "pendingToolCalls", void 0); +__decorate([ + property({ type: Boolean }) +], AssistantMessage.prototype, "hideToolCalls", void 0); +__decorate([ + property({ type: Object }) +], AssistantMessage.prototype, "toolResultsById", void 0); +__decorate([ + property({ type: Boolean }) +], AssistantMessage.prototype, "isStreaming", void 0); +__decorate([ + property({ attribute: false }) +], AssistantMessage.prototype, "onCostClick", void 0); +AssistantMessage = __decorate([ + customElement("assistant-message") +], AssistantMessage); +export { AssistantMessage }; +let ToolMessageDebugView = class ToolMessageDebugView extends LitElement { + constructor() { + super(...arguments); + this.hasResult = false; + } + createRenderRoot() { + return this; // light DOM for shared styles + } + connectedCallback() { + super.connectedCallback(); + this.style.display = "block"; + } + pretty(value) { + try { + if (typeof value === "string") { + const maybeJson = JSON.parse(value); + return { content: JSON.stringify(maybeJson, null, 2), isJson: true }; + } + return { content: JSON.stringify(value, null, 2), isJson: true }; + } + catch { + return { content: typeof value === "string" ? value : String(value), isJson: false }; + } + } + render() { + const textOutput = this.result?.content + ?.filter((c) => c.type === "text") + .map((c) => c.text) + .join("\n") || ""; + const output = this.pretty(textOutput); + const details = this.pretty(this.result?.details); + return html ` +
+
+
${i18n("Call")}
+ +
+
+
${i18n("Result")}
+ ${this.hasResult + ? html ` + ` + : html `
${i18n("(no result)")}
`} +
+
+ `; + } +}; +__decorate([ + property({ type: Object }) +], ToolMessageDebugView.prototype, "callArgs", void 0); +__decorate([ + property({ type: Object }) +], ToolMessageDebugView.prototype, "result", void 0); +__decorate([ + property({ type: Boolean }) +], ToolMessageDebugView.prototype, "hasResult", void 0); +ToolMessageDebugView = __decorate([ + customElement("tool-message-debug") +], ToolMessageDebugView); +export { ToolMessageDebugView }; +let ToolMessage = class ToolMessage extends LitElement { + constructor() { + super(...arguments); + this.pending = false; + this.aborted = false; + this.isStreaming = false; + } + createRenderRoot() { + return this; + } + connectedCallback() { + super.connectedCallback(); + this.style.display = "block"; + } + render() { + const toolName = this.tool?.name || this.toolCall.name; + // Render tool content (renderer handles errors and styling) + const result = this.aborted + ? { + role: "toolResult", + isError: true, + content: [], + toolCallId: this.toolCall.id, + toolName: this.toolCall.name, + timestamp: Date.now(), + } + : this.result; + const renderResult = renderTool(toolName, this.toolCall.arguments, result, !this.aborted && (this.isStreaming || this.pending)); + // Handle custom rendering (no card wrapper) + if (renderResult.isCustom) { + return renderResult.content; + } + // Default: wrap in card + return html ` +
+ ${renderResult.content} +
+ `; + } +}; +__decorate([ + property({ type: Object }) +], ToolMessage.prototype, "toolCall", void 0); +__decorate([ + property({ type: Object }) +], ToolMessage.prototype, "tool", void 0); +__decorate([ + property({ type: Object }) +], ToolMessage.prototype, "result", void 0); +__decorate([ + property({ type: Boolean }) +], ToolMessage.prototype, "pending", void 0); +__decorate([ + property({ type: Boolean }) +], ToolMessage.prototype, "aborted", void 0); +__decorate([ + property({ type: Boolean }) +], ToolMessage.prototype, "isStreaming", void 0); +ToolMessage = __decorate([ + customElement("tool-message") +], ToolMessage); +export { ToolMessage }; +let AbortedMessage = class AbortedMessage extends LitElement { + createRenderRoot() { + return this; + } + connectedCallback() { + super.connectedCallback(); + this.style.display = "block"; + } + render() { + return html `${i18n("Request aborted")}`; + } +}; +AbortedMessage = __decorate([ + customElement("aborted-message") +], AbortedMessage); +export { AbortedMessage }; +//# sourceMappingURL=Messages.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/Messages.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/Messages.js.map new file mode 100644 index 000000000..496f5db60 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/Messages.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Messages.js","sourceRoot":"","sources":["../../src/components/Messages.ts"],"names":[],"mappings":";;;;;;AAOA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,oBAAoB,CAAC;AAgCrB,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAGvB,gBAAgB;QAClC,OAAO,IAAI,CAAC;IACb,CAAC;IAEQ,iBAAiB;QACzB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IAC9B,CAAC;IAEQ,MAAM;QACd,MAAM,OAAO,GACZ,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,QAAQ;YACvC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO;YACtB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,EAAE,IAAI,IAAI,EAAE,CAAC;QAEpE,OAAO,IAAI,CAAA;;;gCAGmB,OAAO;OAEjC,IAAI,CAAC,OAAO,CAAC,WAAW,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC;YAC9D,CAAC,CAAC,IAAI,CAAA;;WAEF,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAC7B,CAAC,UAAU,EAAE,EAAE,CAAC,IA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IAC9B,CAAC;IAEkB,MAAM;QACxB,OAAO,IAAI,CAAA,iDAAiD,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC;IAC9F,CAAC;CACD,CAAA;AAbY,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAa1B"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/ProviderKeyInput.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ProviderKeyInput.d.ts new file mode 100644 index 000000000..45237cd3d --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ProviderKeyInput.d.ts @@ -0,0 +1,16 @@ +import { LitElement } from "lit"; +export declare class ProviderKeyInput extends LitElement { + provider: string; + private keyInput; + private testing; + private failed; + private hasKey; + private inputChanged; + protected createRenderRoot(): this; + connectedCallback(): Promise; + private checkKeyStatus; + private testApiKey; + private saveKey; + render(): import("lit-html").TemplateResult<1>; +} +//# sourceMappingURL=ProviderKeyInput.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/ProviderKeyInput.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ProviderKeyInput.d.ts.map new file mode 100644 index 000000000..8dbdccaa6 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ProviderKeyInput.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ProviderKeyInput.d.ts","sourceRoot":"","sources":["../../src/components/ProviderKeyInput.ts"],"names":[],"mappings":"AAIA,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAkBvC,qBACa,gBAAiB,SAAQ,UAAU;IACnC,QAAQ,SAAM;IACjB,OAAO,CAAC,QAAQ,CAAM;IACtB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,YAAY,CAAS;IAEtC,SAAS,CAAC,gBAAgB;IAIX,iBAAiB;YAKlB,cAAc;YASd,UAAU;YAgCV,OAAO;IAiCrB,MAAM;CAqCN"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/ProviderKeyInput.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ProviderKeyInput.js new file mode 100644 index 000000000..bf7c989cb --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ProviderKeyInput.js @@ -0,0 +1,170 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { i18n } from "@mariozechner/mini-lit"; +import { Badge } from "@mariozechner/mini-lit/dist/Badge.js"; +import { Button } from "@mariozechner/mini-lit/dist/Button.js"; +import { complete, getModel } from "@mariozechner/pi-ai"; +import { html, LitElement } from "lit"; +import { customElement, property, state } from "lit/decorators.js"; +import { getAppStorage } from "../storage/app-storage.js"; +import { applyProxyIfNeeded } from "../utils/proxy-utils.js"; +import { Input } from "./Input.js"; +// Test models for each provider +const TEST_MODELS = { + anthropic: "claude-3-5-haiku-20241022", + openai: "gpt-4o-mini", + google: "gemini-2.5-flash", + groq: "openai/gpt-oss-20b", + openrouter: "z-ai/glm-4.6", + cerebras: "gpt-oss-120b", + xai: "grok-4-fast-non-reasoning", + zai: "glm-4.5-air", +}; +let ProviderKeyInput = class ProviderKeyInput extends LitElement { + constructor() { + super(...arguments); + this.provider = ""; + this.keyInput = ""; + this.testing = false; + this.failed = false; + this.hasKey = false; + this.inputChanged = false; + } + createRenderRoot() { + return this; + } + async connectedCallback() { + super.connectedCallback(); + await this.checkKeyStatus(); + } + async checkKeyStatus() { + try { + const key = await getAppStorage().providerKeys.get(this.provider); + this.hasKey = !!key; + } + catch (error) { + console.error("Failed to check key status:", error); + } + } + async testApiKey(provider, apiKey) { + try { + const modelId = TEST_MODELS[provider]; + // Returning true here for Ollama and friends. Can' know which model to use for testing + if (!modelId) + return true; + let model = getModel(provider, modelId); + if (!model) + return false; + // Get proxy URL from settings (if available) + const proxyEnabled = await getAppStorage().settings.get("proxy.enabled"); + const proxyUrl = await getAppStorage().settings.get("proxy.url"); + // Apply proxy only if this provider/key combination requires it + model = applyProxyIfNeeded(model, apiKey, proxyEnabled ? proxyUrl || undefined : undefined); + const context = { + messages: [{ role: "user", content: "Reply with: ok", timestamp: Date.now() }], + }; + const result = await complete(model, context, { + apiKey, + maxTokens: 200, + }); + return result.stopReason === "stop"; + } + catch (error) { + console.error(`API key test failed for ${provider}:`, error); + return false; + } + } + async saveKey() { + if (!this.keyInput) + return; + this.testing = true; + this.failed = false; + const success = await this.testApiKey(this.provider, this.keyInput); + this.testing = false; + if (success) { + try { + await getAppStorage().providerKeys.set(this.provider, this.keyInput); + this.hasKey = true; + this.inputChanged = false; + this.requestUpdate(); + } + catch (error) { + console.error("Failed to save API key:", error); + this.failed = true; + setTimeout(() => { + this.failed = false; + this.requestUpdate(); + }, 5000); + } + } + else { + this.failed = true; + setTimeout(() => { + this.failed = false; + this.requestUpdate(); + }, 5000); + } + } + render() { + return html ` +
+
+ ${this.provider} + ${this.testing + ? Badge({ children: i18n("Testing..."), variant: "secondary" }) + : this.hasKey + ? html `` + : ""} + ${this.failed ? Badge({ children: i18n("✗ Invalid"), variant: "destructive" }) : ""} +
+
+ ${Input({ + type: "password", + placeholder: this.hasKey ? "••••••••••••" : i18n("Enter API key"), + value: this.keyInput, + onInput: (e) => { + this.keyInput = e.target.value; + this.inputChanged = true; + this.requestUpdate(); + }, + className: "flex-1", + })} + ${Button({ + onClick: () => this.saveKey(), + variant: "default", + size: "sm", + disabled: !this.keyInput || this.testing || (this.hasKey && !this.inputChanged), + children: i18n("Save"), + })} +
+
+ `; + } +}; +__decorate([ + property() +], ProviderKeyInput.prototype, "provider", void 0); +__decorate([ + state() +], ProviderKeyInput.prototype, "keyInput", void 0); +__decorate([ + state() +], ProviderKeyInput.prototype, "testing", void 0); +__decorate([ + state() +], ProviderKeyInput.prototype, "failed", void 0); +__decorate([ + state() +], ProviderKeyInput.prototype, "hasKey", void 0); +__decorate([ + state() +], ProviderKeyInput.prototype, "inputChanged", void 0); +ProviderKeyInput = __decorate([ + customElement("provider-key-input") +], ProviderKeyInput); +export { ProviderKeyInput }; +//# sourceMappingURL=ProviderKeyInput.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/ProviderKeyInput.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ProviderKeyInput.js.map new file mode 100644 index 000000000..1e6c204e5 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ProviderKeyInput.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ProviderKeyInput.js","sourceRoot":"","sources":["../../src/components/ProviderKeyInput.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAgB,QAAQ,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,gCAA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,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE;;;OAGjF,KAAK,CAAC;YACP,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC;YACjE,KAAK,EAAE,IAAI,CAAC,QAAQ;YACpB,OAAO,EAAE,CAAC,CAAQ,EAAE,EAAE;gBACrB,IAAI,CAAC,QAAQ,GAAI,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAC;gBACrD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;gBACzB,IAAI,CAAC,aAAa,EAAE,CAAC;YACtB,CAAC;YACD,SAAS,EAAE,QAAQ;SACnB,CAAC;OACA,MAAM,CAAC;YACR,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE;YAC7B,OAAO,EAAE,SAAS;YAClB,IAAI,EAAE,IAAI;YACV,QAAQ,EAAE,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;YAC/E,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC;SACtB,CAAC;;;GAGJ,CAAC;IACH,CAAC;CACD,CAAA;AA/HY;IAAX,QAAQ,EAAE;kDAAe;AACT;IAAhB,KAAK,EAAE;kDAAuB;AACd;IAAhB,KAAK,EAAE;iDAAyB;AAChB;IAAhB,KAAK,EAAE;gDAAwB;AACf;IAAhB,KAAK,EAAE;gDAAwB;AACf;IAAhB,KAAK,EAAE;sDAA8B;AAN1B,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAgI5B"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/SandboxedIframe.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/SandboxedIframe.d.ts new file mode 100644 index 000000000..35907334e --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/SandboxedIframe.d.ts @@ -0,0 +1,85 @@ +import { LitElement } from "lit"; +import { type MessageConsumer } from "./sandbox/RuntimeMessageRouter.js"; +import type { SandboxRuntimeProvider } from "./sandbox/SandboxRuntimeProvider.js"; +export interface SandboxFile { + fileName: string; + content: string | Uint8Array; + mimeType: string; +} +export interface SandboxResult { + success: boolean; + console: Array<{ + type: string; + text: string; + }>; + files?: SandboxFile[]; + error?: { + message: string; + stack: string; + }; + returnValue?: any; +} +/** + * Function that returns the URL to the sandbox HTML file. + * Used in browser extensions to load sandbox.html via chrome.runtime.getURL(). + */ +export type SandboxUrlProvider = () => string; +/** + * Configuration for prepareHtmlDocument + */ +export interface PrepareHtmlOptions { + /** True if this is an HTML artifact (inject into existing HTML), false if REPL (wrap in HTML) */ + isHtmlArtifact: boolean; + /** True if this is a standalone download (no runtime bridge, no navigation interceptor) */ + isStandalone?: boolean; +} +export declare class SandboxIframe extends LitElement { + private iframe?; + /** + * Optional: Provide a function that returns the sandbox HTML URL. + * If provided, the iframe will use this URL instead of srcdoc. + * This is required for browser extensions with strict CSP. + */ + sandboxUrlProvider?: SandboxUrlProvider; + createRenderRoot(): this; + connectedCallback(): void; + disconnectedCallback(): void; + /** + * Load HTML content into sandbox and keep it displayed (for HTML artifacts) + * @param sandboxId Unique ID + * @param htmlContent Full HTML content + * @param providers Runtime providers to inject + * @param consumers Message consumers to register (optional) + */ + loadContent(sandboxId: string, htmlContent: string, providers?: SandboxRuntimeProvider[], consumers?: MessageConsumer[]): void; + private loadViaSandboxUrl; + private loadViaSrcdoc; + /** + * Execute code in sandbox + * @param sandboxId Unique ID for this execution + * @param code User code (plain JS for REPL, or full HTML for artifacts) + * @param providers Runtime providers to inject + * @param consumers Additional message consumers (optional, execute has its own internal consumer) + * @param signal Abort signal + * @returns Promise resolving to execution result + */ + execute(sandboxId: string, code: string, providers?: SandboxRuntimeProvider[], consumers?: MessageConsumer[], signal?: AbortSignal, isHtmlArtifact?: boolean): Promise; + /** + * Validate HTML using DOMParser - returns error message if invalid, null if valid + * Note: JavaScript syntax validation is done in sandbox.js to avoid CSP restrictions + */ + private validateHtml; + /** + * Prepare complete HTML document with runtime + user code + * PUBLIC so HtmlArtifact can use it for download button + */ + prepareHtmlDocument(sandboxId: string, userCode: string, providers?: SandboxRuntimeProvider[], options?: PrepareHtmlOptions): string; + /** + * Generate runtime script from providers + * @param sandboxId Unique sandbox ID + * @param providers Runtime providers + * @param isStandalone If true, skip runtime bridge and navigation interceptor (for standalone downloads) + */ + private getRuntimeScript; +} +//# sourceMappingURL=SandboxedIframe.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/SandboxedIframe.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/SandboxedIframe.d.ts.map new file mode 100644 index 000000000..b65ab0bcd --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/SandboxedIframe.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"SandboxedIframe.d.ts","sourceRoot":"","sources":["../../src/components/SandboxedIframe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAIjC,OAAO,EAAE,KAAK,eAAe,EAA0B,MAAM,mCAAmC,CAAC;AACjG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAElF,MAAM,WAAW,WAAW;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,KAAK,CAAC,EAAE,W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of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/SandboxedIframe.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/SandboxedIframe.js new file mode 100644 index 000000000..efe474a33 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/SandboxedIframe.js @@ -0,0 +1,511 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { LitElement } from "lit"; +import { customElement, property } from "lit/decorators.js"; +import { ConsoleRuntimeProvider } from "./sandbox/ConsoleRuntimeProvider.js"; +import { RuntimeMessageBridge } from "./sandbox/RuntimeMessageBridge.js"; +import { RUNTIME_MESSAGE_ROUTER } from "./sandbox/RuntimeMessageRouter.js"; +/** + * Escape HTML special sequences in code to prevent premature tag closure + * @param code Code that will be injected into in user code to prevent premature tag closure + const escapedUserCode = escapeScriptContent(userCode); + return ` + + + ${runtime} + + + + +`; + } + } + /** + * Generate runtime script from providers + * @param sandboxId Unique sandbox ID + * @param providers Runtime providers + * @param isStandalone If true, skip runtime bridge and navigation interceptor (for standalone downloads) + */ + getRuntimeScript(sandboxId, providers = [], isStandalone = false) { + // Collect all data from providers + const allData = {}; + for (const provider of providers) { + Object.assign(allData, provider.getData()); + } + // Generate bridge code (skip if standalone) + const bridgeCode = isStandalone + ? "" + : RuntimeMessageBridge.generateBridgeCode({ + context: "sandbox-iframe", + sandboxId, + }); + // Collect all runtime functions - pass sandboxId as string literal + const runtimeFunctions = []; + for (const provider of providers) { + runtimeFunctions.push(`(${provider.getRuntime().toString()})(${JSON.stringify(sandboxId)});`); + } + // Build script with HTML escaping + // Escape to prevent premature tag closure in HTML parser + const dataInjection = Object.entries(allData) + .map(([key, value]) => { + const jsonStr = JSON.stringify(value).replace(/<\/script/gi, "<\\/script"); + return `window.${key} = ${jsonStr};`; + }) + .join("\n"); + // TODO the font-size is needed, as chrome seems to inject a stylesheet into iframes + // found in an extension context like sidepanel, settin body { font-size: 75% }. It's + // definitely not our code doing that. + // See https://stackoverflow.com/questions/71480433/chrome-is-injecting-some-stylesheet-in-popup-ui-which-reduces-the-font-size-to-7 + // Navigation interceptor (only if NOT standalone) + const navigationInterceptor = isStandalone + ? "" + : ` +// Navigation interceptor: prevent all navigation and open externally +(function() { + // Intercept link clicks + document.addEventListener('click', function(e) { + const link = e.target.closest('a'); + if (link && link.href) { + // Check if it's an external link (not javascript: or #hash) + if (link.href.startsWith('http://') || link.href.startsWith('https://')) { + e.preventDefault(); + e.stopPropagation(); + window.parent.postMessage({ type: 'open-external-url', url: link.href }, '*'); + } + } + }, true); + + // Intercept form submissions + document.addEventListener('submit', function(e) { + const form = e.target; + if (form && form.action) { + e.preventDefault(); + e.stopPropagation(); + window.parent.postMessage({ type: 'open-external-url', url: form.action }, '*'); + } + }, true); + + // Prevent window.location changes (only if not already redefined) + try { + const originalLocation = window.location; + Object.defineProperty(window, 'location', { + get: function() { return originalLocation; }, + set: function(url) { + window.parent.postMessage({ type: 'open-external-url', url: url.toString() }, '*'); + } + }); + } catch (e) { + // Already defined, skip + } +})(); +`; + return ` +`; + } +}; +__decorate([ + property({ attribute: false }) +], SandboxIframe.prototype, "sandboxUrlProvider", void 0); +SandboxIframe = __decorate([ + customElement("sandbox-iframe") +], SandboxIframe); +export { SandboxIframe }; +//# sourceMappingURL=SandboxedIframe.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/SandboxedIframe.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/SandboxedIframe.js.map new file mode 100644 index 000000000..2fa38ecf3 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/SandboxedIframe.js.map @@ -0,0 +1 @@ +{"version":3,"file":"SandboxedIframe.js","sourceRoot":"","sources":["../../src/components/SandboxedIframe.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAwB,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAiCjG;;;;GAIG;AACH,SAAS,mBAAmB,CAAC,IAAY;IACxC,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;AAClD,CAAC;AAGM,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAU5C,gBAAgB;QACf,OAAO,IAAI,CAAC;IACb,CAAC;IAEQ,iBAAiB;QACzB,KAAK,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IAEQ,oBAAoB;QAC5B,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC7B,oEAAoE;QACpE,gEAAgE;QAChE,2EAA2E;QAC3E,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IACvB,CAAC;IAED;;;;;;OAMG;IACI,WAAW,CACjB,SAAiB,EACjB,WAAmB,EACnB,YAAsC,EAAE,EACxC,YAA+B,EAAE;QAEjC,wCAAwC;QACxC,IAAI,CAAC;YACJ,sBAAsB,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QACrD,CAAC;QAAC,MAAM,CAAC;YACR,qCAAqC;QACtC,CAAC;QAED,SAAS,GAAG,CAAC,IAAI,sBAAsB,EAAE,EAAE,GAAG,SAAS,CAAC,CAAC;QAEzD,sBAAsB,CAAC,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,S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D,CAAA;AA1jBgC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;yDAAyC;AAR5D,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CAkkBzB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/StreamingMessageContainer.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/StreamingMessageContainer.d.ts new file mode 100644 index 000000000..83086d6a5 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/StreamingMessageContainer.d.ts @@ -0,0 +1,18 @@ +import type { AgentTool, Message, ToolResultMessage } from "@mariozechner/pi-ai"; +import { LitElement } from "lit"; +export declare class StreamingMessageContainer extends LitElement { + tools: AgentTool[]; + isStreaming: boolean; + pendingToolCalls?: Set; + toolResultsById?: Map; + onCostClick?: () => void; + private _message; + private _pendingMessage; + private _updateScheduled; + private _immediateUpdate; + protected createRenderRoot(): HTMLElement | DocumentFragment; + connectedCallback(): void; + setMessage(message: Message | null, immediate?: boolean): void; + render(): import("lit-html").TemplateResult<1> | undefined; +} +//# sourceMappingURL=StreamingMessageContainer.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/StreamingMessageContainer.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/StreamingMessageContainer.d.ts.map new file mode 100644 index 000000000..e33259136 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/StreamingMessageContainer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"StreamingMessageContainer.d.ts","sourceRoot":"","sources":["../../src/components/StreamingMessageContainer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAGvC,qBAAa,yBAA0B,SAAQ,UAAU;IAC7B,KAAK,EAAE,SAAS,EAAE,CAAM;IACtB,WAAW,UAAS;IACrB,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC7C,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IAEhD,OAAO,CAAC,QAAQ,CAAwB;IACjD,OAAO,CAAC,eAAe,CAAwB;IAC/C,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,gBAAgB,CAAS;cAEd,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAI5D,iBAAiB,IAAI,IAAI;IAM3B,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,EAAE,SAAS,UAAQ;IAmCnD,MAAM;CAmCf"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/StreamingMessageContainer.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/StreamingMessageContainer.js new file mode 100644 index 000000000..6f913c5f0 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/StreamingMessageContainer.js @@ -0,0 +1,117 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { html, LitElement } from "lit"; +import { property, state } from "lit/decorators.js"; +export class StreamingMessageContainer extends LitElement { + constructor() { + super(...arguments); + this.tools = []; + this.isStreaming = false; + this._message = null; + this._pendingMessage = null; + this._updateScheduled = false; + this._immediateUpdate = false; + } + createRenderRoot() { + return this; + } + connectedCallback() { + super.connectedCallback(); + this.style.display = "block"; + } + // Public method to update the message with batching for performance + setMessage(message, immediate = false) { + // Store the latest message + this._pendingMessage = message; + // If this is an immediate update (like clearing), apply it right away + if (immediate || message === null) { + this._immediateUpdate = true; + this._message = message; + this.requestUpdate(); + // Cancel any pending updates since we're clearing + this._pendingMessage = null; + this._updateScheduled = false; + return; + } + // Otherwise batch updates for performance during streaming + if (!this._updateScheduled) { + this._updateScheduled = true; + requestAnimationFrame(async () => { + // Only apply the update if we haven't been cleared + if (!this._immediateUpdate && this._pendingMessage !== null) { + // Deep clone the message to ensure Lit detects changes in nested properties + // (like toolCall.arguments being mutated during streaming) + this._message = JSON.parse(JSON.stringify(this._pendingMessage)); + this.requestUpdate(); + } + // Reset for next batch + this._pendingMessage = null; + this._updateScheduled = false; + this._immediateUpdate = false; + }); + } + } + render() { + // Show loading indicator if loading but no message yet + if (!this._message) { + if (this.isStreaming) + return html `
+ +
`; + return html ``; // Empty until a message is set + } + const msg = this._message; + if (msg.role === "toolResult") { + // Skip standalone tool result in streaming; the stable list will render paired tool-message + return html ``; + } + else if (msg.role === "user") { + // Skip standalone tool result in streaming; the stable list will render it immediiately + return html ``; + } + else if (msg.role === "assistant") { + // Assistant message - render inline tool messages during streaming + return html ` +
+ + ${this.isStreaming ? html `` : ""} +
+ `; + } + } +} +__decorate([ + property({ type: Array }) +], StreamingMessageContainer.prototype, "tools", void 0); +__decorate([ + property({ type: Boolean }) +], StreamingMessageContainer.prototype, "isStreaming", void 0); +__decorate([ + property({ type: Object }) +], StreamingMessageContainer.prototype, "pendingToolCalls", void 0); +__decorate([ + property({ type: Object }) +], StreamingMessageContainer.prototype, "toolResultsById", void 0); +__decorate([ + property({ attribute: false }) +], StreamingMessageContainer.prototype, "onCostClick", void 0); +__decorate([ + state() +], StreamingMessageContainer.prototype, "_message", void 0); +// Register custom element +if (!customElements.get("streaming-message-container")) { + customElements.define("streaming-message-container", StreamingMessageContainer); +} +//# sourceMappingURL=StreamingMessageContainer.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/StreamingMessageContainer.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/StreamingMessageContainer.js.map new file mode 100644 index 000000000..013ad53ab --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/StreamingMessageContainer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"StreamingMessageContainer.js","sourceRoot":"","sources":["../../src/components/StreamingMessageContainer.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,OAAO,yBAA0B,SAAQ,UAAU;IAAzD;;QAC4B,UAAK,GAAgB,EAAE,CAAC;QACtB,gBAAW,GAAG,KAAK,CAAC;QAKhC,aAAQ,GAAmB,IAAI,CAAC;QACzC,oBAAe,GAAmB,IAAI,CAAC;QACvC,qBAAgB,GAAG,KAAK,CAAC;QACzB,qBAAgB,GAAG,KAAK,CAAC;IAkFlC,CAAC;IAhFmB,gBAAgB;QAClC,OAAO,IAAI,CAAC;IACb,CAAC;IAEQ,iBAAiB;QACzB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IAC9B,CAAC;IAED,oEAAoE;IAC7D,UAAU,CAAC,OAAuB,EAAE,SAAS,GAAG,KAAK;QAC3D,2BAA2B;QAC3B,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC;QAE/B,sEAAsE;QACtE,IAAI,SAAS,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACnC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC7B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;YACxB,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,kDAAkD;YAClD,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;YAC5B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C,IAAI,KAAK,WAAW,EAAE,CAAC;YACrC,mEAAmE;YACnE,OAAO,IAAI,CAAA;;;iBAGG,GAAG;eACL,IAAI,CAAC,KAAK;qBACJ,IAAI,CAAC,WAAW;0BACX,IAAI,CAAC,gBAAgB;yBACtB,IAAI,CAAC,eAAe;uBACtB,KAAK;qBACP,IAAI,CAAC,WAAW;;OAE9B,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAA,mFAAmF,CAAC,CAAC,CAAC,EAAE;;IAElH,CAAC;QACH,CAAC;IACF,CAAC;CACD;AA3F2B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;wDAAyB;AACtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8DAAqB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mEAAgC;AAC/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kEAAkD;AAC7C;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;8DAA0B;AAExC;IAAhB,KAAK,EAAE;2DAAyC;AAuFlD,0BAA0B;AAC1B,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,6BAA6B,CAAC,EAAE,CAAC;IACxD,cAAc,CAAC,MAAM,CAAC,6BAA6B,EAAE,yBAAyB,CAAC,CAAC;AACjF,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/ThinkingBlock.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ThinkingBlock.d.ts new file mode 100644 index 000000000..0f54e4c6d --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ThinkingBlock.d.ts @@ -0,0 +1,11 @@ +import { LitElement } from "lit"; +export declare class ThinkingBlock extends LitElement { + content: string; + isStreaming: boolean; + private isExpanded; + protected createRenderRoot(): HTMLElement | DocumentFragment; + connectedCallback(): void; + private toggleExpanded; + render(): import("lit-html").TemplateResult<1>; +} +//# sourceMappingURL=ThinkingBlock.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/ThinkingBlock.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ThinkingBlock.d.ts.map new file mode 100644 index 000000000..4562d78d1 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ThinkingBlock.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ThinkingBlock.d.ts","sourceRoot":"","sources":["../../src/components/ThinkingBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAIvC,qBACa,aAAc,SAAQ,UAAU;IAChC,OAAO,EAAG,MAAM,CAAC;IACA,WAAW,UAAS;IACxC,OAAO,CAAC,UAAU,CAAS;cAEjB,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAI5D,iBAAiB,IAAI,IAAI;IAKlC,OAAO,CAAC,cAAc;IAIb,MAAM;CAkBf"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/ThinkingBlock.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ThinkingBlock.js new file mode 100644 index 000000000..404e93573 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ThinkingBlock.js @@ -0,0 +1,58 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { icon } from "@mariozechner/mini-lit"; +import { html, LitElement } from "lit"; +import { customElement, property, state } from "lit/decorators.js"; +import { ChevronRight } from "lucide"; +let ThinkingBlock = class ThinkingBlock extends LitElement { + constructor() { + super(...arguments); + this.isStreaming = false; + this.isExpanded = false; + } + createRenderRoot() { + return this; + } + connectedCallback() { + super.connectedCallback(); + this.style.display = "block"; + } + toggleExpanded() { + this.isExpanded = !this.isExpanded; + } + render() { + const shimmerClasses = this.isStreaming + ? "animate-shimmer bg-gradient-to-r from-muted-foreground via-foreground to-muted-foreground bg-[length:200%_100%] bg-clip-text text-transparent" + : ""; + return html ` +
+
+ ${icon(ChevronRight, "sm")} + Thinking... +
+ ${this.isExpanded ? html `` : ""} +
+ `; + } +}; +__decorate([ + property() +], ThinkingBlock.prototype, "content", void 0); +__decorate([ + property({ type: Boolean }) +], ThinkingBlock.prototype, "isStreaming", void 0); +__decorate([ + state() +], ThinkingBlock.prototype, "isExpanded", void 0); +ThinkingBlock = __decorate([ + customElement("thinking-block") +], ThinkingBlock); +export { ThinkingBlock }; +//# sourceMappingURL=ThinkingBlock.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/ThinkingBlock.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ThinkingBlock.js.map new file mode 100644 index 000000000..836325f76 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/ThinkingBlock.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ThinkingBlock.js","sourceRoot":"","sources":["../../src/components/ThinkingBlock.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAG/B,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QAEuB,gBAAW,GAAG,KAAK,CAAC;QAChC,eAAU,GAAG,KAAK,CAAC;IAiCrC,CAAC;IA/BmB,gBAAgB;QAClC,OAAO,IAAI,CAAC;IACb,CAAC;IAEQ,iBAAiB;QACzB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IAC9B,CAAC;IAEO,cAAc;QACrB,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC;IACpC,CAAC;IAEQ,MAAM;QACd,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW;YACtC,CAAC,CAAC,+IAA+I;YACjJ,CAAC,CAAC,EAAE,CAAC;QAEN,OAAO,IAAI,CAAA;;;;cAIC,IAAI,CAAC,cAAc;;sDAEqB,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC;oBACjG,cAAc;;MAE5B,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAA,4BAA4B,IAAI,CAAC,OAAO,gBAAgB,IAAI,oBAAoB,CAAC,CAAC,CAAC,EAAE;;GAE9G,CAAC;IACH,CAAC;CACD,CAAA;AAnCY;IAAX,QAAQ,EAAE;8CAAkB;AACA;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAqB;AAChC;IAAhB,KAAK,EAAE;iDAA4B;AAHxB,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CAoCzB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/message-renderer-registry.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/message-renderer-registry.d.ts new file mode 100644 index 000000000..65c0ecbf1 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/message-renderer-registry.d.ts @@ -0,0 +1,12 @@ +import type { TemplateResult } from "lit"; +import type { AppMessage } from "./Messages.js"; +export type MessageRole = AppMessage["role"]; +export interface MessageRenderer { + render(message: TMessage): TemplateResult; +} +export declare function registerMessageRenderer(role: TRole, renderer: MessageRenderer>): void; +export declare function getMessageRenderer(role: MessageRole): MessageRenderer | undefined; +export declare function renderMessage(message: AppMessage): TemplateResult | undefined; +//# sourceMappingURL=message-renderer-registry.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/message-renderer-registry.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/message-renderer-registry.d.ts.map new file mode 100644 index 000000000..afe58ce94 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/message-renderer-registry.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"message-renderer-registry.d.ts","sourceRoot":"","sources":["../../src/components/message-renderer-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;AAG7C,MAAM,WAAW,eAAe,CAAC,QAAQ,SAAS,UAAU,GAAG,UAAU;IACxE,MAAM,CAAC,OAAO,EAAE,QAAQ,GAAG,cAAc,CAAC;CAC1C;AAKD,wBAAgB,uBAAuB,CAAC,KAAK,SAAS,WAAW,EAChE,IAAI,EAAE,KAAK,EACX,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC,GAC7D,IAAI,CAEN;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,GAAG,eAAe,GAAG,SAAS,CAEjF;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,cAAc,GAAG,SAAS,CAE7E"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/message-renderer-registry.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/message-renderer-registry.js new file mode 100644 index 000000000..9b4d86996 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/message-renderer-registry.js @@ -0,0 +1,12 @@ +// Registry of custom message renderers by role +const messageRenderers = new Map(); +export function registerMessageRenderer(role, renderer) { + messageRenderers.set(role, renderer); +} +export function getMessageRenderer(role) { + return messageRenderers.get(role); +} +export function renderMessage(message) { + return messageRenderers.get(message.role)?.render(message); +} +//# sourceMappingURL=message-renderer-registry.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/message-renderer-registry.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/message-renderer-registry.js.map new file mode 100644 index 000000000..8ae3d6c95 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/message-renderer-registry.js.map @@ -0,0 +1 @@ +{"version":3,"file":"message-renderer-registry.js","sourceRoot":"","sources":["../../src/components/message-renderer-registry.ts"],"names":[],"mappings":"AAWA,+CAA+C;AAC/C,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAqC,CAAC;AAEtE,MAAM,UAAU,uBAAuB,CACtC,IAAW,EACX,QAA+D;IAE/D,gBAAgB,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAiB;IACnD,OAAO,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAmB;IAChD,OAAO,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;AAC5D,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ArtifactsRuntimeProvider.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ArtifactsRuntimeProvider.d.ts new file mode 100644 index 000000000..a06f7a484 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ArtifactsRuntimeProvider.d.ts @@ -0,0 +1,35 @@ +import type { SandboxRuntimeProvider } from "./SandboxRuntimeProvider.js"; +interface ArtifactsPanelLike { + artifacts: Map; + tool: { + execute(toolCallId: string, args: { + command: string; + filename: string; + content?: string; + }): Promise; + }; +} +interface AgentLike { + appendMessage(message: any): void; +} +/** + * Artifacts Runtime Provider + * + * Provides programmatic access to session artifacts from sandboxed code. + * Allows code to create, read, update, and delete artifacts dynamically. + * Supports both online (extension) and offline (downloaded HTML) modes. + */ +export declare class ArtifactsRuntimeProvider implements SandboxRuntimeProvider { + private artifactsPanel; + private agent?; + private readWrite; + constructor(artifactsPanel: ArtifactsPanelLike, agent?: AgentLike | undefined, readWrite?: boolean); + getData(): Record; + getRuntime(): (sandboxId: string) => void; + handleMessage(message: any, respond: (response: any) => void): Promise; + getDescription(): string; +} +export {}; +//# sourceMappingURL=ArtifactsRuntimeProvider.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ArtifactsRuntimeProvider.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ArtifactsRuntimeProvider.d.ts.map new file mode 100644 index 000000000..7f52327e3 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ArtifactsRuntimeProvider.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ArtifactsRuntimeProvider.d.ts","sourceRoot":"","sources":["../../../src/components/sandbox/ArtifactsRuntimeProvider.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAG1E,UAAU,kBAAkB;IAC3B,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5C,IAAI,EAAE;QACL,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;KACzG,CAAC;CACF;AAED,UAAU,SAAS;IAClB,aAAa,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI,CAAC;CAClC;AAED;;;;;;GAMG;AACH,qBAAa,wBAAyB,YAAW,sBAAsB;IAErE,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,KAAK,CAAC;IACd,OAAO,CAAC,SAAS;gBAFT,cAAc,EAAE,kBAAkB,EAClC,KAAK,CAAC,EAAE,SAAS,YAAA,EACjB,SAAS,GAAE,OAAc;IAGlC,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAS9B,UAAU,IAAI,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI;IAgGnC,aAAa,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IA8ElF,cAAc,IAAI,MAAM;CAGxB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ArtifactsRuntimeProvider.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ArtifactsRuntimeProvider.js new file mode 100644 index 000000000..fb5331f6c --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ArtifactsRuntimeProvider.js @@ -0,0 +1,189 @@ +import { ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RO, ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RW, } from "../../prompts/prompts.js"; +/** + * Artifacts Runtime Provider + * + * Provides programmatic access to session artifacts from sandboxed code. + * Allows code to create, read, update, and delete artifacts dynamically. + * Supports both online (extension) and offline (downloaded HTML) modes. + */ +export class ArtifactsRuntimeProvider { + constructor(artifactsPanel, agent, readWrite = true) { + this.artifactsPanel = artifactsPanel; + this.agent = agent; + this.readWrite = readWrite; + } + getData() { + // Inject artifact snapshot for offline mode + const snapshot = {}; + this.artifactsPanel.artifacts.forEach((artifact, filename) => { + snapshot[filename] = artifact.content; + }); + return { artifacts: snapshot }; + } + getRuntime() { + // This function will be stringified, so no external references! + return (_sandboxId) => { + // Auto-parse/stringify for .json files + const isJsonFile = (filename) => filename.endsWith(".json"); + window.listArtifacts = async () => { + // Online: ask extension + if (window.sendRuntimeMessage) { + const response = await window.sendRuntimeMessage({ + type: "artifact-operation", + action: "list", + }); + if (!response.success) + throw new Error(response.error); + return response.result; + } + // Offline: return snapshot keys + else { + return Object.keys(window.artifacts || {}); + } + }; + window.getArtifact = async (filename) => { + let content; + // Online: ask extension + if (window.sendRuntimeMessage) { + const response = await window.sendRuntimeMessage({ + type: "artifact-operation", + action: "get", + filename, + }); + if (!response.success) + throw new Error(response.error); + content = response.result; + } + // Offline: read snapshot + else { + if (!window.artifacts?.[filename]) { + throw new Error(`Artifact not found (offline mode): ${filename}`); + } + content = window.artifacts[filename]; + } + // Auto-parse .json files + if (isJsonFile(filename)) { + try { + return JSON.parse(content); + } + catch (e) { + throw new Error(`Failed to parse JSON from ${filename}: ${e}`); + } + } + return content; + }; + window.createOrUpdateArtifact = async (filename, content, mimeType) => { + if (!window.sendRuntimeMessage) { + throw new Error("Cannot create/update artifacts in offline mode (read-only)"); + } + let finalContent = content; + // Auto-stringify .json files + if (isJsonFile(filename) && typeof content !== "string") { + finalContent = JSON.stringify(content, null, 2); + } + else if (typeof content !== "string") { + finalContent = JSON.stringify(content, null, 2); + } + const response = await window.sendRuntimeMessage({ + type: "artifact-operation", + action: "createOrUpdate", + filename, + content: finalContent, + mimeType, + }); + if (!response.success) + throw new Error(response.error); + }; + window.deleteArtifact = async (filename) => { + if (!window.sendRuntimeMessage) { + throw new Error("Cannot delete artifacts in offline mode (read-only)"); + } + const response = await window.sendRuntimeMessage({ + type: "artifact-operation", + action: "delete", + filename, + }); + if (!response.success) + throw new Error(response.error); + }; + }; + } + async handleMessage(message, respond) { + if (message.type !== "artifact-operation") { + return; + } + const { action, filename, content, mimeType } = message; + try { + switch (action) { + case "list": { + const filenames = Array.from(this.artifactsPanel.artifacts.keys()); + respond({ success: true, result: filenames }); + break; + } + case "get": { + const artifact = this.artifactsPanel.artifacts.get(filename); + if (!artifact) { + respond({ success: false, error: `Artifact not found: ${filename}` }); + } + else { + respond({ success: true, result: artifact.content }); + } + break; + } + case "createOrUpdate": { + try { + const exists = this.artifactsPanel.artifacts.has(filename); + const command = exists ? "rewrite" : "create"; + const action = exists ? "update" : "create"; + await this.artifactsPanel.tool.execute("", { + command, + filename, + content, + }); + this.agent?.appendMessage({ + role: "artifact", + action, + filename, + content, + ...(action === "create" && { title: filename }), + timestamp: new Date().toISOString(), + }); + respond({ success: true }); + } + catch (err) { + respond({ success: false, error: err.message }); + } + break; + } + case "delete": { + try { + await this.artifactsPanel.tool.execute("", { + command: "delete", + filename, + }); + this.agent?.appendMessage({ + role: "artifact", + action: "delete", + filename, + timestamp: new Date().toISOString(), + }); + respond({ success: true }); + } + catch (err) { + respond({ success: false, error: err.message }); + } + break; + } + default: + respond({ success: false, error: `Unknown artifact action: ${action}` }); + } + } + catch (error) { + respond({ success: false, error: error.message }); + } + } + getDescription() { + return this.readWrite ? ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RW : ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RO; + } +} +//# sourceMappingURL=ArtifactsRuntimeProvider.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ArtifactsRuntimeProvider.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ArtifactsRuntimeProvider.js.map new file mode 100644 index 000000000..2ae6848ad --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ArtifactsRuntimeProvider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ArtifactsRuntimeProvider.js","sourceRoot":"","sources":["../../../src/components/sandbox/ArtifactsRuntimeProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,yCAAyC,EACzC,yCAAyC,GACzC,MAAM,0BAA0B,CAAC;AAelC;;;;;;GAMG;AACH,MAAM,OAAO,wBAAwB;IACpC,YACS,cAAkC,EAClC,KAAiB,EACjB,YAAqB,IAAI;QAFzB,mBAAc,GAAd,cAAc,CAAoB;QAClC,UAAK,GAAL,KAAK,CAAY;QACjB,cAAS,GAAT,SAAS,CAAgB;IAC/B,CAAC;IAEJ,OAAO;QACN,4CAA4C;QAC5C,MAAM,QAAQ,GAA2B,EAAE,CAAC;QAC5C,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE;YAC5D,QAAQ,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC;QACvC,CAAC,CAAC,CAAC;QACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;IAChC,CAAC;IAED,UAAU;QACT,gEAAgE;QAChE,OAAO,CAAC,UAAkB,EAAE,EAAE;YAC7B,uCAAuC;YACvC,MAAM,UAAU,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAEnE,MAAc,CAAC,aAAa,GAAG,KAAK,IAAuB,EAAE;gBAC7D,wBAAwB;gBACxB,IAAK,MAAc,CAAC,kBAAkB,EAAE,CAAC;oBACxC,MAAM,QAAQ,GAAG,MAAO,MAAc,CAAC,kBAAkB,CAAC;wBACzD,IAAI,EAAE,oBAAoB;wBAC1B,MAAM,EAAE,MAAM;qBACd,CAAC,CAAC;oBACH,IAAI,CAAC,QAAQ,CAAC,OAAO;wBAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,CA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,EAAE,IAAI,EAAE,CAAC,CAAC;oBAC5B,CAAC;oBAAC,OAAO,GAAQ,EAAE,CAAC;wBACnB,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;oBACjD,CAAC;oBACD,MAAM;gBACP,CAAC;gBAED;oBACC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,4BAA4B,MAAM,EAAE,EAAE,CAAC,CAAC;YAC3E,CAAC;QACF,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACrB,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACnD,CAAC;IACF,CAAC;IAED,cAAc;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,yCAAyC,CAAC,CAAC,CAAC,yCAAyC,CAAC;IAC/G,CAAC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/AttachmentsRuntimeProvider.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/AttachmentsRuntimeProvider.d.ts new file mode 100644 index 000000000..057019415 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/AttachmentsRuntimeProvider.d.ts @@ -0,0 +1,17 @@ +import type { Attachment } from "../../utils/attachment-utils.js"; +import type { SandboxRuntimeProvider } from "./SandboxRuntimeProvider.js"; +/** + * Attachments Runtime Provider + * + * OPTIONAL provider that provides file access APIs to sandboxed code. + * Only needed when attachments are present. + * Attachments are read-only snapshot data - no messaging needed. + */ +export declare class AttachmentsRuntimeProvider implements SandboxRuntimeProvider { + private attachments; + constructor(attachments: Attachment[]); + getData(): Record; + getRuntime(): (sandboxId: string) => void; + getDescription(): string; +} +//# sourceMappingURL=AttachmentsRuntimeProvider.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/AttachmentsRuntimeProvider.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/AttachmentsRuntimeProvider.d.ts.map new file mode 100644 index 000000000..c80233077 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/AttachmentsRuntimeProvider.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"AttachmentsRuntimeProvider.d.ts","sourceRoot":"","sources":["../../../src/components/sandbox/AttachmentsRuntimeProvider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAE1E;;;;;;GAMG;AACH,qBAAa,0BAA2B,YAAW,sBAAsB;IAC5D,OAAO,CAAC,WAAW;gBAAX,WAAW,EAAE,UAAU,EAAE;IAE7C,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAa9B,UAAU,IAAI,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI;IAmCzC,cAAc,IAAI,MAAM;CAGxB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/AttachmentsRuntimeProvider.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/AttachmentsRuntimeProvider.js new file mode 100644 index 000000000..557e6e24a --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/AttachmentsRuntimeProvider.js @@ -0,0 +1,64 @@ +import { ATTACHMENTS_RUNTIME_DESCRIPTION } from "../../prompts/prompts.js"; +/** + * Attachments Runtime Provider + * + * OPTIONAL provider that provides file access APIs to sandboxed code. + * Only needed when attachments are present. + * Attachments are read-only snapshot data - no messaging needed. + */ +export class AttachmentsRuntimeProvider { + constructor(attachments) { + this.attachments = attachments; + } + getData() { + const attachmentsData = this.attachments.map((a) => ({ + id: a.id, + fileName: a.fileName, + mimeType: a.mimeType, + size: a.size, + content: a.content, + extractedText: a.extractedText, + })); + return { attachments: attachmentsData }; + } + getRuntime() { + // This function will be stringified, so no external references! + // These functions read directly from window.attachments + // Works both online AND offline (no messaging needed!) + return (_sandboxId) => { + window.listAttachments = () => (window.attachments || []).map((a) => ({ + id: a.id, + fileName: a.fileName, + mimeType: a.mimeType, + size: a.size, + })); + window.readTextAttachment = (attachmentId) => { + const a = (window.attachments || []).find((x) => x.id === attachmentId); + if (!a) + throw new Error("Attachment not found: " + attachmentId); + if (a.extractedText) + return a.extractedText; + try { + return atob(a.content); + } + catch { + throw new Error("Failed to decode text content for: " + attachmentId); + } + }; + window.readBinaryAttachment = (attachmentId) => { + const a = (window.attachments || []).find((x) => x.id === attachmentId); + if (!a) + throw new Error("Attachment not found: " + attachmentId); + const bin = atob(a.content); + const bytes = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; i++) + bytes[i] = bin.charCodeAt(i); + return bytes; + }; + }; + } + getDescription() { + return ATTACHMENTS_RUNTIME_DESCRIPTION; + } +} +//# sourceMappingURL=AttachmentsRuntimeProvider.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/AttachmentsRuntimeProvider.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/AttachmentsRuntimeProvider.js.map new file mode 100644 index 000000000..4409f5578 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/AttachmentsRuntimeProvider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AttachmentsRuntimeProvider.js","sourceRoot":"","sources":["../../../src/components/sandbox/AttachmentsRuntimeProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAC;AAI3E;;;;;;GAMG;AACH,MAAM,OAAO,0BAA0B;IACtC,YAAoB,WAAyB;QAAzB,gBAAW,GAAX,WAAW,CAAc;IAAG,CAAC;IAEjD,OAAO;QACN,MAAM,eAAe,GAAG,IAAI,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AAC;gBACxB,CAAC;gBAAC,MAAM,CAAC;oBACR,MAAM,IAAI,KAAK,CAAC,qCAAqC,GAAG,YAAY,CAAC,CAAC;gBACvE,CAAC;YACF,CAAC,CAAC;YAED,MAAc,CAAC,oBAAoB,GAAG,CAAC,YAAoB,EAAE,EAAE;gBAC/D,MAAM,CAAC,GAAG,CAAE,MAAc,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,YAAY,CAAC,CAAC;gBACtF,IAAI,CAAC,CAAC;oBAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,YAAY,CAAC,CAAC;gBACjE,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;gBAC5B,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE;oBAAE,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;gBAClE,OAAO,KAAK,CAAC;YACd,CAAC,CAAC;QACH,CAAC,CAAC;IACH,CAAC;IAED,cAAc;QACb,OAAO,+BAA+B,CAAC;IACxC,CAAC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ConsoleRuntimeProvider.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ConsoleRuntimeProvider.d.ts new file mode 100644 index 000000000..203bdf34b --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ConsoleRuntimeProvider.d.ts @@ -0,0 +1,42 @@ +import type { SandboxRuntimeProvider } from "./SandboxRuntimeProvider.js"; +export interface ConsoleLog { + type: "log" | "warn" | "error" | "info"; + text: string; + args?: unknown[]; +} +/** + * Console Runtime Provider + * + * REQUIRED provider that should always be included first. + * Provides console capture, error handling, and execution lifecycle management. + * Collects console output for retrieval by caller. + */ +export declare class ConsoleRuntimeProvider implements SandboxRuntimeProvider { + private logs; + private completionError; + private completed; + getData(): Record; + getDescription(): string; + getRuntime(): (sandboxId: string) => void; + handleMessage(message: any, respond: (response: any) => void): Promise; + /** + * Get collected console logs + */ + getLogs(): ConsoleLog[]; + /** + * Get completion status + */ + isCompleted(): boolean; + /** + * Get completion error if any + */ + getCompletionError(): { + message: string; + stack: string; + } | null; + /** + * Reset state for reuse + */ + reset(): void; +} +//# sourceMappingURL=ConsoleRuntimeProvider.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ConsoleRuntimeProvider.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ConsoleRuntimeProvider.d.ts.map new file mode 100644 index 000000000..b2727d9d5 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ConsoleRuntimeProvider.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ConsoleRuntimeProvider.d.ts","sourceRoot":"","sources":["../../../src/components/sandbox/ConsoleRuntimeProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAE1E,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;CACjB;AAED;;;;;;GAMG;AACH,qBAAa,sBAAuB,YAAW,sBAAsB;IACpE,OAAO,CAAC,IAAI,CAAoB;IAChC,OAAO,CAAC,eAAe,CAAmD;IAC1E,OAAO,CAAC,SAAS,CAAS;IAE1B,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAK9B,cAAc,IAAI,MAAM;IAIxB,UAAU,IAAI,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI;IA4GnC,aAAa,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBlF;;OAEG;IACH,OAAO,IAAI,UAAU,EAAE;IAIvB;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,kBAAkB,IAAI;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAI/D;;OAEG;IACH,KAAK,IAAI,IAAI;CAKb"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ConsoleRuntimeProvider.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ConsoleRuntimeProvider.js new file mode 100644 index 000000000..ec36b31b9 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ConsoleRuntimeProvider.js @@ -0,0 +1,161 @@ +/** + * Console Runtime Provider + * + * REQUIRED provider that should always be included first. + * Provides console capture, error handling, and execution lifecycle management. + * Collects console output for retrieval by caller. + */ +export class ConsoleRuntimeProvider { + constructor() { + this.logs = []; + this.completionError = null; + this.completed = false; + } + getData() { + // No data needed + return {}; + } + getDescription() { + return ""; + } + getRuntime() { + return (_sandboxId) => { + // Store truly original console methods on first wrap only + // This prevents accumulation of wrapper functions across multiple executions + if (!window.__originalConsole) { + window.__originalConsole = { + log: console.log.bind(console), + error: console.error.bind(console), + warn: console.warn.bind(console), + info: console.info.bind(console), + }; + } + // Always use the truly original console, not the current (possibly wrapped) one + const originalConsole = window.__originalConsole; + // Track pending send promises to wait for them in onCompleted + const pendingSends = []; + ["log", "error", "warn", "info"].forEach((method) => { + console[method] = (...args) => { + const text = args + .map((arg) => { + try { + return typeof arg === "object" ? JSON.stringify(arg) : String(arg); + } + catch { + return String(arg); + } + }) + .join(" "); + // Always log locally too (using truly original console) + originalConsole[method].apply(console, args); + // Send immediately and track the promise (only in extension context) + if (window.sendRuntimeMessage) { + const sendPromise = window + .sendRuntimeMessage({ + type: "console", + method, + text, + args, + }) + .catch(() => { }); + pendingSends.push(sendPromise); + } + }; + }); + // Register completion callback to wait for all pending sends + if (window.onCompleted) { + window.onCompleted(async (_success) => { + // Wait for all pending console sends to complete + if (pendingSends.length > 0) { + await Promise.all(pendingSends); + } + }); + } + // Track errors for HTML artifacts + let lastError = null; + // Error handlers - track errors but don't log them + // (they'll be shown via execution-error message) + window.addEventListener("error", (e) => { + const text = (e.error?.stack || e.message || String(e)) + " at line " + (e.lineno || "?") + ":" + (e.colno || "?"); + lastError = { + message: e.error?.message || e.message || String(e), + stack: e.error?.stack || text, + }; + }); + window.addEventListener("unhandledrejection", (e) => { + const text = "Unhandled promise rejection: " + (e.reason?.message || e.reason || "Unknown error"); + lastError = { + message: e.reason?.message || String(e.reason) || "Unhandled promise rejection", + stack: e.reason?.stack || text, + }; + }); + // Expose complete() method for user code to call + let completionSent = false; + window.complete = async (error, returnValue) => { + if (completionSent) + return; + completionSent = true; + const finalError = error || lastError; + if (window.sendRuntimeMessage) { + if (finalError) { + await window.sendRuntimeMessage({ + type: "execution-error", + error: finalError, + }); + } + else { + await window.sendRuntimeMessage({ + type: "execution-complete", + returnValue, + }); + } + } + }; + }; + } + async handleMessage(message, respond) { + if (message.type === "console") { + // Collect console output + this.logs.push({ + type: message.method === "error" + ? "error" + : message.method === "warn" + ? "warn" + : message.method === "info" + ? "info" + : "log", + text: message.text, + args: message.args, + }); + // Acknowledge receipt + respond({ success: true }); + } + } + /** + * Get collected console logs + */ + getLogs() { + return this.logs; + } + /** + * Get completion status + */ + isCompleted() { + return this.completed; + } + /** + * Get completion error if any + */ + getCompletionError() { + return this.completionError; + } + /** + * Reset state for reuse + */ + reset() { + this.logs = []; + this.completionError = null; + this.completed = false; + } +} +//# sourceMappingURL=ConsoleRuntimeProvider.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ConsoleRuntimeProvider.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ConsoleRuntimeProvider.js.map new file mode 100644 index 000000000..0895d4bbb --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/ConsoleRuntimeProvider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ConsoleRuntimeProvider.js","sourceRoot":"","sources":["../../../src/components/sandbox/ConsoleRuntimeProvider.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,MAAM,OAAO,sBAAsB;IAAnC;QACS,SAAI,GAAiB,EAAE,CAAC;QACxB,oBAAe,GAA8C,IAAI,CAAC;QAClE,cAAS,GAAG,KAAK,CAAC;IAwK3B,CAAC;IAtKA,OAAO;QACN,iBAAiB;QACjB,OAAO,EAAE,CAAC;IACX,CAAC;IAED,cAAc;QACb,OAAO,EAAE,CAAC;IACX,CAAC;IAED,UAAU;QACT,OAAO,CAAC,UAAkB,EAAE,EAAE;YAC7B,0DAA0D;YAC1D,6EAA6E;YAC7E,IAAI,CAAE,MAAc,CAAC,iBAAiB,EAAE,CAAC;gBACvC,MAAc,CAAC,iBAAiB,GAAG;oBACnC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;oBAC9B,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;oBAClC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;oBAChC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;iBAChC,CAAC;YACH,CAAC;YAED,gFAAgF;YAChF,MAAM,eAAe,GAAI,MAAc,CAAC,iBAAiB,CAAC;YAE1D,8DAA8D;YAC9D,MAAM,YAAY,GAAmB,EAAE,CAAC;YAExC,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,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Ae,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,KAAK;QACJ,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IACxB,CAAC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/FileDownloadRuntimeProvider.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/FileDownloadRuntimeProvider.d.ts new file mode 100644 index 000000000..d17f39e4a --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/FileDownloadRuntimeProvider.d.ts @@ -0,0 +1,30 @@ +import type { SandboxRuntimeProvider } from "./SandboxRuntimeProvider.js"; +export interface DownloadableFile { + fileName: string; + content: string | Uint8Array; + mimeType: string; +} +/** + * File Download Runtime Provider + * + * Provides returnDownloadableFile() for creating user downloads. + * Files returned this way are NOT accessible to the LLM later (one-time download). + * Works both online (sends to extension) and offline (triggers browser download directly). + * Collects files for retrieval by caller. + */ +export declare class FileDownloadRuntimeProvider implements SandboxRuntimeProvider { + private files; + getData(): Record; + getRuntime(): (sandboxId: string) => void; + handleMessage(message: any, respond: (response: any) => void): Promise; + /** + * Get collected files + */ + getFiles(): DownloadableFile[]; + /** + * Reset state for reuse + */ + reset(): void; + getDescription(): string; +} +//# sourceMappingURL=FileDownloadRuntimeProvider.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/FileDownloadRuntimeProvider.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/FileDownloadRuntimeProvider.d.ts.map new file mode 100644 index 000000000..a85c8009a --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/FileDownloadRuntimeProvider.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"FileDownloadRuntimeProvider.d.ts","sourceRoot":"","sources":["../../../src/components/sandbox/FileDownloadRuntimeProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAE1E,MAAM,WAAW,gBAAgB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,qBAAa,2BAA4B,YAAW,sBAAsB;IACzE,OAAO,CAAC,KAAK,CAA0B;IAEvC,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAK9B,UAAU,IAAI,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI;IAuDnC,aAAa,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAalF;;OAEG;IACH,QAAQ,IAAI,gBAAgB,EAAE;IAI9B;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb,cAAc,IAAI,MAAM;CAGxB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/FileDownloadRuntimeProvider.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/FileDownloadRuntimeProvider.js new file mode 100644 index 000000000..9951b3ef7 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/FileDownloadRuntimeProvider.js @@ -0,0 +1,97 @@ +/** + * File Download Runtime Provider + * + * Provides returnDownloadableFile() for creating user downloads. + * Files returned this way are NOT accessible to the LLM later (one-time download). + * Works both online (sends to extension) and offline (triggers browser download directly). + * Collects files for retrieval by caller. + */ +export class FileDownloadRuntimeProvider { + constructor() { + this.files = []; + } + getData() { + // No data needed + return {}; + } + getRuntime() { + return (_sandboxId) => { + window.returnDownloadableFile = async (fileName, content, mimeType) => { + let finalContent, finalMimeType; + if (content instanceof Blob) { + const arrayBuffer = await content.arrayBuffer(); + finalContent = new Uint8Array(arrayBuffer); + finalMimeType = mimeType || content.type || "application/octet-stream"; + if (!mimeType && !content.type) { + throw new Error("returnDownloadableFile: MIME type is required for Blob content. Please provide a mimeType parameter (e.g., 'image/png')."); + } + } + else if (content instanceof Uint8Array) { + finalContent = content; + if (!mimeType) { + throw new Error("returnDownloadableFile: MIME type is required for Uint8Array content. Please provide a mimeType parameter (e.g., 'image/png')."); + } + finalMimeType = mimeType; + } + else if (typeof content === "string") { + finalContent = content; + finalMimeType = mimeType || "text/plain"; + } + else { + finalContent = JSON.stringify(content, null, 2); + finalMimeType = mimeType || "application/json"; + } + // Send to extension if in extension context (online mode) + if (window.sendRuntimeMessage) { + const response = await window.sendRuntimeMessage({ + type: "file-returned", + fileName, + content: finalContent, + mimeType: finalMimeType, + }); + if (response.error) + throw new Error(response.error); + } + else { + // Offline mode: trigger browser download directly + const blob = new Blob([finalContent instanceof Uint8Array ? finalContent : finalContent], { + type: finalMimeType, + }); + const url = URL.createObjectURL(blob); + const a = document.createElement("a"); + a.href = url; + a.download = fileName; + a.click(); + URL.revokeObjectURL(url); + } + }; + }; + } + async handleMessage(message, respond) { + if (message.type === "file-returned") { + // Collect file for caller + this.files.push({ + fileName: message.fileName, + content: message.content, + mimeType: message.mimeType, + }); + respond({ success: true }); + } + } + /** + * Get collected files + */ + getFiles() { + return this.files; + } + /** + * Reset state for reuse + */ + reset() { + this.files = []; + } + getDescription() { + return "returnDownloadableFile(filename, content, mimeType?) - Create downloadable file for user (one-time download, not accessible later)"; + } +} +//# sourceMappingURL=FileDownloadRuntimeProvider.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/FileDownloadRuntimeProvider.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/FileDownloadRuntimeProvider.js.map new file mode 100644 index 000000000..87633a86f --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/FileDownloadRuntimeProvider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"FileDownloadRuntimeProvider.js","sourceRoot":"","sources":["../../../src/components/sandbox/FileDownloadRuntimeProvider.ts"],"names":[],"mappings":"AAQA;;;;;;;GAOG;AACH,MAAM,OAAO,2BAA2B;IAAxC;QACS,UAAK,GAAuB,EAAE,CAAC;IA4FxC,CAAC;IA1FA,OAAO;QACN,iBAAiB;QACjB,OAAO,EAAE,CAAC;IACX,CAAC;IAED,UAAU;QACT,OAAO,CAAC,UAAkB,EAAE,EAAE;YAC5B,MAAc,CAAC,sBAAsB,GAAG,KAAK,EAAE,QAAgB,EAAE,OAAY,EAAE,QAAiB,EAAE,EAAE;gBACpG,IAAI,YAAiB,EAAE,aAAqB,CAAC;gBAE7C,IAAI,OAAO,YAAY,IAAI,EAAE,CAAC;oBAC7B,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,WAAW,EAAE,CAAC;oBAChD,YAAY,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;oBAC3C,aAAa,GAAG,QAAQ,IAAI,OAAO,CAAC,IAAI,IAAI,0BAA0B,CAAC;oBACvE,IAAI,CAAC,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;wBAChC,MAAM,IAAI,KAAK,CACd,0HAA0H,CAC1H,CAAC;oBACH,CAAC;gBACF,CAAC;qBAAM,IAAI,OAAO,YAAY,UAAU,EAAE,CAAC;oBAC1C,YAAY,GAAG,OAAO,CAAC;oBACvB,IAAI,CAAC,QAAQ,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CACd,gIAAgI,CAChI,CAAC;oBACH,CAAC;oBACD,aAAa,GAAG,QAAQ,CAAC;gBAC1B,CAAC;qBAAM,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;oBACxC,YAAY,GAAG,OAAO,CAAC;oBACvB,aAAa,GAAG,QAAQ,IAAI,YAAY,CAAC;gBAC1C,CAAC;qBAAM,CAAC;oBACP,YAAY,GAAG,IAAI,CA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O,EAAE,OAAO,CAAC,OAAO;gBACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;aAC1B,CAAC,CAAC;YAEH,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5B,CAAC;IACF,CAAC;IAED;;OAEG;IACH,QAAQ;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,KAAK;QACJ,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IACjB,CAAC;IAED,cAAc;QACb,OAAO,oIAAoI,CAAC;IAC7I,CAAC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageBridge.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageBridge.d.ts new file mode 100644 index 000000000..3b1b28123 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageBridge.d.ts @@ -0,0 +1,19 @@ +/** + * Generates sendRuntimeMessage() function for injection into execution contexts. + * Provides unified messaging API that works in both sandbox iframe and user script contexts. + */ +export type MessageType = "request-response" | "fire-and-forget"; +export interface RuntimeMessageBridgeOptions { + context: "sandbox-iframe" | "user-script"; + sandboxId: string; +} +export declare class RuntimeMessageBridge { + /** + * Generate sendRuntimeMessage() function as injectable string. + * Returns the function source code to be injected into target context. + */ + static generateBridgeCode(options: RuntimeMessageBridgeOptions): string; + private static generateSandboxBridge; + private static generateUserScriptBridge; +} +//# sourceMappingURL=RuntimeMessageBridge.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageBridge.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageBridge.d.ts.map new file mode 100644 index 000000000..4590fd17b --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageBridge.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"RuntimeMessageBridge.d.ts","sourceRoot":"","sources":["../../../src/components/sandbox/RuntimeMessageBridge.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,WAAW,GAAG,kBAAkB,GAAG,iBAAiB,CAAC;AAEjE,MAAM,WAAW,2BAA2B;IAC3C,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAAC;IAC1C,SAAS,EAAE,MAAM,CAAC;CAClB;AAGD,qBAAa,oBAAoB;IAChC;;;OAGG;IACH,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,2BAA2B,GAAG,MAAM;IAQvE,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAwCpC,OAAO,CAAC,MAAM,CAAC,wBAAwB;CAevC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageBridge.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageBridge.js new file mode 100644 index 000000000..d84c5a263 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageBridge.js @@ -0,0 +1,74 @@ +/** + * Generates sendRuntimeMessage() function for injection into execution contexts. + * Provides unified messaging API that works in both sandbox iframe and user script contexts. + */ +// biome-ignore lint/complexity/noStaticOnlyClass: fine +export class RuntimeMessageBridge { + /** + * Generate sendRuntimeMessage() function as injectable string. + * Returns the function source code to be injected into target context. + */ + static generateBridgeCode(options) { + if (options.context === "sandbox-iframe") { + return RuntimeMessageBridge.generateSandboxBridge(options.sandboxId); + } + else { + return RuntimeMessageBridge.generateUserScriptBridge(options.sandboxId); + } + } + static generateSandboxBridge(sandboxId) { + // Returns stringified function that uses window.parent.postMessage + return ` +window.__completionCallbacks = []; +window.sendRuntimeMessage = async (message) => { + const messageId = 'msg_' + Date.now() + '_' + Math.random().toString(36).substring(2, 9); + + return new Promise((resolve, reject) => { + const handler = (e) => { + if (e.data.type === 'runtime-response' && e.data.messageId === messageId) { + window.removeEventListener('message', handler); + if (e.data.success) { + resolve(e.data); + } else { + reject(new Error(e.data.error || 'Operation failed')); + } + } + }; + + window.addEventListener('message', handler); + + window.parent.postMessage({ + ...message, + sandboxId: ${JSON.stringify(sandboxId)}, + messageId: messageId + }, '*'); + + // Timeout after 30s + setTimeout(() => { + window.removeEventListener('message', handler); + reject(new Error('Runtime message timeout')); + }, 30000); + }); +}; +window.onCompleted = (callback) => { + window.__completionCallbacks.push(callback); +}; +`.trim(); + } + static generateUserScriptBridge(sandboxId) { + // Returns stringified function that uses chrome.runtime.sendMessage + return ` +window.__completionCallbacks = []; +window.sendRuntimeMessage = async (message) => { + return await chrome.runtime.sendMessage({ + ...message, + sandboxId: ${JSON.stringify(sandboxId)} + }); +}; +window.onCompleted = (callback) => { + window.__completionCallbacks.push(callback); +}; +`.trim(); + } +} +//# sourceMappingURL=RuntimeMessageBridge.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageBridge.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageBridge.js.map new file mode 100644 index 000000000..c20cea087 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageBridge.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RuntimeMessageBridge.js","sourceRoot":"","sources":["../../../src/components/sandbox/RuntimeMessageBridge.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,uDAAuD;AACvD,MAAM,OAAO,oBAAoB;IAChC;;;OAGG;IACH,MAAM,CAAC,kBAAkB,CAAC,OAAoC;QAC7D,IAAI,OAAO,CAAC,OAAO,KAAK,gBAAgB,EAAE,CAAC;YAC1C,OAAO,oBAAoB,CAAC,qBAAqB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACtE,CAAC;aAAM,CAAC;YACP,OAAO,oBAAoB,CAAC,wBAAwB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACzE,CAAC;IACF,CAAC;IAEO,MAAM,CAAC,qBAAqB,CAAC,SAAiB;QACrD,mEAAmE;QACnE,OAAO;;;;;;;;;;;;;;;;;;;;;yBAqBgB,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;;;;;;;;;;;;;;CAcjD,CAAC,IAAI,EAAE,CAAC;IACR,CAAC;IAEO,MAAM,CAAC,wBAAwB,CAAC,SAAiB;QACxD,oEAAoE;QACpE,OAAO;;;;;qBAKY,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;;;;;;CAM7C,CAAC,IAAI,EAAE,CAAC;IACR,CAAC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageRouter.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageRouter.d.ts new file mode 100644 index 000000000..5e686db53 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageRouter.d.ts @@ -0,0 +1,65 @@ +import type { SandboxRuntimeProvider } from "./SandboxRuntimeProvider.js"; +/** + * Message consumer interface - components that want to receive messages from sandboxes + */ +export interface MessageConsumer { + /** + * Handle a message from a sandbox. + * All consumers receive all messages - decide internally what to handle. + */ + handleMessage(message: any): Promise; +} +/** + * Centralized message router for all runtime communication. + * + * This singleton replaces all individual window.addEventListener("message") calls + * with a single global listener that routes messages to the appropriate handlers. + * Also handles user script messages from chrome.runtime.onUserScriptMessage. + * + * Benefits: + * - Single global listener instead of multiple independent listeners + * - Automatic cleanup when sandboxes are destroyed + * - Support for bidirectional communication (providers) and broadcasting (consumers) + * - Works with both sandbox iframes and user scripts + * - Clear lifecycle management + */ +export declare class RuntimeMessageRouter { + private sandboxes; + private messageListener; + private userScriptMessageListener; + /** + * Register a new sandbox with its runtime providers. + * Call this BEFORE creating the iframe (for sandbox contexts) or executing user script. + */ + registerSandbox(sandboxId: string, providers: SandboxRuntimeProvider[], consumers: MessageConsumer[]): void; + /** + * Update the iframe reference for a sandbox. + * Call this AFTER creating the iframe. + * This is needed so providers can send responses back to the sandbox. + */ + setSandboxIframe(sandboxId: string, iframe: HTMLIFrameElement): void; + /** + * Unregister a sandbox and remove all its consumers. + * Call this when the sandbox is destroyed. + */ + unregisterSandbox(sandboxId: string): void; + /** + * Add a message consumer for a sandbox. + * Consumers receive broadcast messages (console, execution-complete, etc.) + */ + addConsumer(sandboxId: string, consumer: MessageConsumer): void; + /** + * Remove a message consumer from a sandbox. + */ + removeConsumer(sandboxId: string, consumer: MessageConsumer): void; + /** + * Setup the global message listeners (called automatically) + */ + private setupListener; +} +/** + * Global singleton instance. + * Import this from wherever you need to interact with the message router. + */ +export declare const RUNTIME_MESSAGE_ROUTER: RuntimeMessageRouter; +//# sourceMappingURL=RuntimeMessageRouter.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageRouter.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageRouter.d.ts.map new file mode 100644 index 000000000..880842131 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageRouter.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"RuntimeMessageRouter.d.ts","sourceRoot":"","sources":["../../../src/components/sandbox/RuntimeMessageRouter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAK1E;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B;;;OAGG;IACH,aAAa,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C;AAYD;;;;;;;;;;;;;GAaG;AACH,qBAAa,oBAAoB;IAChC,OAAO,CAAC,SAAS,CAAqC;IACtD,OAAO,CAAC,eAAe,CAA4C;IACnE,OAAO,CAAC,yBAAyB,CAElB;IAEf;;;OAGG;IACH,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,sBAAsB,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,IAAI;IAY3G;;;;OAIG;IACH,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAOpE;;;OAGG;IACH,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAmB1C;;;OAGG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,GAAG,IAAI;IAO/D;;OAEG;IACH,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,GAAG,IAAI;IAOlE;;OAEG;IACH,OAAO,CAAC,aAAa;CAuFrB;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,sBAA6B,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageRouter.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageRouter.js new file mode 100644 index 000000000..7516aa111 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageRouter.js @@ -0,0 +1,168 @@ +/** + * Centralized message router for all runtime communication. + * + * This singleton replaces all individual window.addEventListener("message") calls + * with a single global listener that routes messages to the appropriate handlers. + * Also handles user script messages from chrome.runtime.onUserScriptMessage. + * + * Benefits: + * - Single global listener instead of multiple independent listeners + * - Automatic cleanup when sandboxes are destroyed + * - Support for bidirectional communication (providers) and broadcasting (consumers) + * - Works with both sandbox iframes and user scripts + * - Clear lifecycle management + */ +export class RuntimeMessageRouter { + constructor() { + this.sandboxes = new Map(); + this.messageListener = null; + this.userScriptMessageListener = null; + } + /** + * Register a new sandbox with its runtime providers. + * Call this BEFORE creating the iframe (for sandbox contexts) or executing user script. + */ + registerSandbox(sandboxId, providers, consumers) { + this.sandboxes.set(sandboxId, { + sandboxId, + iframe: null, // Will be set via setSandboxIframe() for sandbox contexts + providers, + consumers: new Set(consumers), + }); + // Setup global listener if not already done + this.setupListener(); + } + /** + * Update the iframe reference for a sandbox. + * Call this AFTER creating the iframe. + * This is needed so providers can send responses back to the sandbox. + */ + setSandboxIframe(sandboxId, iframe) { + const context = this.sandboxes.get(sandboxId); + if (context) { + context.iframe = iframe; + } + } + /** + * Unregister a sandbox and remove all its consumers. + * Call this when the sandbox is destroyed. + */ + unregisterSandbox(sandboxId) { + this.sandboxes.delete(sandboxId); + // If no more sandboxes, remove global listeners + if (this.sandboxes.size === 0) { + // Remove iframe listener + if (this.messageListener) { + window.removeEventListener("message", this.messageListener); + this.messageListener = null; + } + // Remove user script listener + if (this.userScriptMessageListener && typeof chrome !== "undefined" && chrome.runtime?.onUserScriptMessage) { + chrome.runtime.onUserScriptMessage.removeListener(this.userScriptMessageListener); + this.userScriptMessageListener = null; + } + } + } + /** + * Add a message consumer for a sandbox. + * Consumers receive broadcast messages (console, execution-complete, etc.) + */ + addConsumer(sandboxId, consumer) { + const context = this.sandboxes.get(sandboxId); + if (context) { + context.consumers.add(consumer); + } + } + /** + * Remove a message consumer from a sandbox. + */ + removeConsumer(sandboxId, consumer) { + const context = this.sandboxes.get(sandboxId); + if (context) { + context.consumers.delete(consumer); + } + } + /** + * Setup the global message listeners (called automatically) + */ + setupListener() { + // Setup sandbox iframe listener + if (!this.messageListener) { + this.messageListener = async (e) => { + const { sandboxId, messageId } = e.data; + if (!sandboxId) + return; + const context = this.sandboxes.get(sandboxId); + if (!context) { + return; + } + // Create respond() function for bidirectional communication + const respond = (response) => { + context.iframe?.contentWindow?.postMessage({ + type: "runtime-response", + messageId, + sandboxId, + ...response, + }, "*"); + }; + // 1. Try provider handlers first (for bidirectional comm) + for (const provider of context.providers) { + if (provider.handleMessage) { + await provider.handleMessage(e.data, respond); + // Don't stop - let consumers also handle the message + } + } + // 2. Broadcast to consumers (one-way messages or lifecycle events) + for (const consumer of context.consumers) { + await consumer.handleMessage(e.data); + // Don't stop - let all consumers see the message + } + }; + window.addEventListener("message", this.messageListener); + } + // Setup user script message listener + if (!this.userScriptMessageListener) { + // Guard: check if we're in extension context + if (typeof chrome === "undefined" || !chrome.runtime?.onUserScriptMessage) { + return; + } + this.userScriptMessageListener = (message, _sender, sendResponse) => { + const { sandboxId } = message; + if (!sandboxId) + return false; + const context = this.sandboxes.get(sandboxId); + if (!context) + return false; + const respond = (response) => { + sendResponse({ + ...response, + sandboxId, + }); + }; + // Route to providers (async) + (async () => { + // 1. Try provider handlers first (for bidirectional comm) + for (const provider of context.providers) { + if (provider.handleMessage) { + await provider.handleMessage(message, respond); + // Don't stop - let consumers also handle the message + } + } + // 2. Broadcast to consumers (one-way messages or lifecycle events) + for (const consumer of context.consumers) { + await consumer.handleMessage(message); + // Don't stop - let all consumers see the message + } + })(); + return true; // Indicates async response + }; + chrome.runtime.onUserScriptMessage.addListener(this.userScriptMessageListener); + } + } +} +/** + * Global singleton instance. + * Import this from wherever you need to interact with the message router. + */ +export const RUNTIME_MESSAGE_ROUTER = new RuntimeMessageRouter(); +//# sourceMappingURL=RuntimeMessageRouter.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageRouter.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageRouter.js.map new file mode 100644 index 000000000..bdc1479a1 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/RuntimeMessageRouter.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RuntimeMessageRouter.js","sourceRoot":"","sources":["../../../src/components/sandbox/RuntimeMessageRouter.ts"],"names":[],"mappings":"AA0BA;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,oBAAoB;IAAjC;QACS,cAAS,GAAG,IAAI,GAAG,EAA0B,CAAC;QAC9C,oBAAe,GAAuC,IAAI,CAAC;QAC3D,8BAAyB,GAEvB,IAAI,CAAC;IAoKhB,CAAC;IAlKA;;;OAGG;IACH,eAAe,CAAC,S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,OAAO,EAAE,OAAO,CAAC,CAAC;4BAC/C,qDAAqD;wBACtD,CAAC;oBACF,CAAC;oBAED,mEAAmE;oBACnE,KAAK,MAAM,QAAQ,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;wBAC1C,MAAM,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;wBACtC,iDAAiD;oBAClD,CAAC;gBACF,CAAC,CAAC,EAAE,CAAC;gBAEL,OAAO,IAAI,CAAC,CAAC,2BAA2B;YACzC,CAAC,CAAC;YAEF,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,WAAW,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QAChF,CAAC;IACF,CAAC;CACD;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,oBAAoB,EAAE,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/SandboxRuntimeProvider.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/SandboxRuntimeProvider.d.ts new file mode 100644 index 000000000..e7f181c8c --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/SandboxRuntimeProvider.d.ts @@ -0,0 +1,48 @@ +/** + * Interface for providing runtime capabilities to sandboxed iframes. + * Each provider injects data and runtime functions into the sandbox context. + */ +export interface SandboxRuntimeProvider { + /** + * Returns data to inject into window scope. + * Keys become window properties (e.g., { attachments: [...] } -> window.attachments) + */ + getData(): Record; + /** + * Returns a runtime function that will be stringified and executed in the sandbox. + * The function receives sandboxId and has access to data from getData() via window. + * + * IMPORTANT: This function will be converted to string via .toString() and injected + * into the sandbox, so it cannot reference external variables or imports. + */ + getRuntime(): (sandboxId: string) => void; + /** + * Optional message handler for bidirectional communication. + * All providers receive all messages - decide internally what to handle. + * + * @param message - The message from the sandbox + * @param respond - Function to send a response back to the sandbox + */ + handleMessage?(message: any, respond: (response: any) => void): Promise; + /** + * Optional documentation describing what globals/functions this provider injects. + * This will be appended to tool descriptions dynamically so the LLM knows what's available. + */ + getDescription(): string; + /** + * Optional lifecycle callback invoked when sandbox execution starts. + * Providers can use this to track abort signals for cancellation of async operations. + * + * @param sandboxId - The unique identifier for this sandbox execution + * @param signal - Optional AbortSignal that will be triggered if execution is cancelled + */ + onExecutionStart?(sandboxId: string, signal?: AbortSignal): void; + /** + * Optional lifecycle callback invoked when sandbox execution ends (success, error, or abort). + * Providers can use this to clean up any resources associated with the sandbox. + * + * @param sandboxId - The unique identifier for this sandbox execution + */ + onExecutionEnd?(sandboxId: string): void; +} +//# sourceMappingURL=SandboxRuntimeProvider.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/SandboxRuntimeProvider.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/SandboxRuntimeProvider.d.ts.map new file mode 100644 index 000000000..59dfb2899 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/SandboxRuntimeProvider.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"SandboxRuntimeProvider.d.ts","sourceRoot":"","sources":["../../../src/components/sandbox/SandboxRuntimeProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACtC;;;OAGG;IACH,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE/B;;;;;;OAMG;IACH,UAAU,IAAI,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAE1C;;;;;;OAMG;IACH,aAAa,CAAC,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9E;;;OAGG;IACH,cAAc,IAAI,MAAM,CAAC;IAEzB;;;;;;OAMG;IACH,gBAAgB,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAEjE;;;;;OAKG;IACH,cAAc,CAAC,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/SandboxRuntimeProvider.js b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/SandboxRuntimeProvider.js new file mode 100644 index 000000000..8a362020d --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/SandboxRuntimeProvider.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=SandboxRuntimeProvider.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/SandboxRuntimeProvider.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/SandboxRuntimeProvider.js.map new file mode 100644 index 000000000..787d858d8 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/components/sandbox/SandboxRuntimeProvider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"SandboxRuntimeProvider.js","sourceRoot":"","sources":["../../../src/components/sandbox/SandboxRuntimeProvider.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ApiKeyPromptDialog.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ApiKeyPromptDialog.d.ts new file mode 100644 index 000000000..21c674b28 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ApiKeyPromptDialog.d.ts @@ -0,0 +1,15 @@ +import "../components/ProviderKeyInput.js"; +import { DialogBase } from "@mariozechner/mini-lit/dist/DialogBase.js"; +export declare class ApiKeyPromptDialog extends DialogBase { + private provider; + private resolvePromise?; + private unsubscribe?; + protected modalWidth: string; + protected modalHeight: string; + static prompt(provider: string): Promise; + connectedCallback(): Promise; + disconnectedCallback(): void; + close(): void; + protected renderContent(): import("lit-html").TemplateResult<1>; +} +//# sourceMappingURL=ApiKeyPromptDialog.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ApiKeyPromptDialog.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ApiKeyPromptDialog.d.ts.map new file mode 100644 index 000000000..a5166ff1b --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ApiKeyPromptDialog.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ApiKeyPromptDialog.d.ts","sourceRoot":"","sources":["../../src/dialogs/ApiKeyPromptDialog.ts"],"names":[],"mappings":"AACA,OAAO,mCAAmC,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AAKvE,qBACa,kBAAmB,SAAQ,UAAU;IACxC,OAAO,CAAC,QAAQ,CAAM;IAE/B,OAAO,CAAC,cAAc,CAAC,CAA6B;IACpD,OAAO,CAAC,WAAW,CAAC,CAAa;IAEjC,SAAS,CAAC,UAAU,SAAsB;IAC1C,SAAS,CAAC,WAAW,SAAU;WAElB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAUxC,iBAAiB;IAmBvB,oBAAoB;IAQpB,KAAK;cAOK,aAAa;CAYhC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ApiKeyPromptDialog.js b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ApiKeyPromptDialog.js new file mode 100644 index 000000000..f9f1d91d7 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ApiKeyPromptDialog.js @@ -0,0 +1,79 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var ApiKeyPromptDialog_1; +import { customElement, state } from "lit/decorators.js"; +import "../components/ProviderKeyInput.js"; +import { DialogContent, DialogHeader } from "@mariozechner/mini-lit/dist/Dialog.js"; +import { DialogBase } from "@mariozechner/mini-lit/dist/DialogBase.js"; +import { html } from "lit"; +import { getAppStorage } from "../storage/app-storage.js"; +import { i18n } from "../utils/i18n.js"; +let ApiKeyPromptDialog = ApiKeyPromptDialog_1 = class ApiKeyPromptDialog extends DialogBase { + constructor() { + super(...arguments); + this.provider = ""; + this.modalWidth = "min(500px, 90vw)"; + this.modalHeight = "auto"; + } + static async prompt(provider) { + const dialog = new ApiKeyPromptDialog_1(); + dialog.provider = provider; + dialog.open(); + return new Promise((resolve) => { + dialog.resolvePromise = resolve; + }); + } + async connectedCallback() { + super.connectedCallback(); + // Poll for key existence - when key is added, resolve and close + const checkInterval = setInterval(async () => { + const hasKey = !!(await getAppStorage().providerKeys.get(this.provider)); + if (hasKey) { + clearInterval(checkInterval); + if (this.resolvePromise) { + this.resolvePromise(true); + this.resolvePromise = undefined; + } + this.close(); + } + }, 500); + this.unsubscribe = () => clearInterval(checkInterval); + } + disconnectedCallback() { + super.disconnectedCallback(); + if (this.unsubscribe) { + this.unsubscribe(); + this.unsubscribe = undefined; + } + } + close() { + super.close(); + if (this.resolvePromise) { + this.resolvePromise(false); + } + } + renderContent() { + return html ` + ${DialogContent({ + children: html ` + ${DialogHeader({ + title: i18n("API Key Required"), + })} + + `, + })} + `; + } +}; +__decorate([ + state() +], ApiKeyPromptDialog.prototype, "provider", void 0); +ApiKeyPromptDialog = ApiKeyPromptDialog_1 = __decorate([ + customElement("api-key-prompt-dialog") +], ApiKeyPromptDialog); +export { ApiKeyPromptDialog }; +//# sourceMappingURL=ApiKeyPromptDialog.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ApiKeyPromptDialog.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ApiKeyPromptDialog.js.map new file mode 100644 index 000000000..8d13c8e5f --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ApiKeyPromptDialog.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ApiKeyPromptDialog.js","sourceRoot":"","sources":["../../src/dialogs/ApiKeyPromptDialog.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGjC,IAAM,kBAAkB,0BAAxB,MAAM,kBAAmB,SAAQ,UAAU;IAA3C;;QACW,aAAQ,GAAG,EAAE,CAAC;QAKrB,eAAU,GAAG,kBAAkB,CAAC;QAChC,gBAAW,GAAG,MAAM,CAAC;IA0DhC,CAAC;IAxDA,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAgB;QACnC,MAAM,MAAM,GAAG,IAAI,oBAAkB,EAAE,CAAC;QACxC,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC3B,MAAM,CAAC,IAAI,EAAE,CAAC;QAEd,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC9B,MAAM,CAAC,cAAc,GAAG,OAAO,CAAC;QACjC,CAAC,CAAC,CAAC;IACJ,CAAC;IAEQ,KAAK,CAAC,iBAAiB;QAC/B,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAE1B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;IAD9B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,kBAAkB,CAiE9B"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/AttachmentOverlay.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/AttachmentOverlay.d.ts new file mode 100644 index 000000000..b08d5ae69 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/AttachmentOverlay.d.ts @@ -0,0 +1,32 @@ +import "@mariozechner/mini-lit/dist/ModeToggle.js"; +import { LitElement } from "lit"; +import type { Attachment } from "../utils/attachment-utils.js"; +export declare class AttachmentOverlay extends LitElement { + private attachment?; + private showExtractedText; + private error; + private currentLoadingTask; + private onCloseCallback?; + private boundHandleKeyDown?; + protected createRenderRoot(): HTMLElement | DocumentFragment; + static open(attachment: Attachment, onClose?: () => void): void; + private setupEventListeners; + private close; + private getFileType; + private getFileTypeLabel; + private handleBackdropClick; + private handleDownload; + private cleanup; + render(): import("lit-html").TemplateResult<1>; + private renderToggle; + private renderContent; + private renderFileContent; + updated(changedProperties: Map): Promise; + private renderPdf; + private renderDocx; + private renderExcel; + private renderExcelSheet; + private base64ToArrayBuffer; + private renderExtractedText; +} +//# sourceMappingURL=AttachmentOverlay.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/AttachmentOverlay.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/AttachmentOverlay.d.ts.map new file mode 100644 index 000000000..bb8475c27 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/AttachmentOverlay.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"AttachmentOverlay.d.ts","sourceRoot":"","sources":["../../src/dialogs/AttachmentOverlay.ts"],"names":[],"mappings":"AAAA,OAAO,2CAA2C,CAAC;AAInD,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAKvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAK/D,qBAAa,iBAAkB,SAAQ,UAAU;IACvC,OAAO,CAAC,UAAU,CAAC,CAAa;IAChC,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,KAAK,CAAuB;IAG7C,OAAO,CAAC,kBAAkB,CAAa;IACvC,OAAO,CAAC,eAAe,CAAC,CAAa;IACrC,OAAO,CAAC,kBAAkB,CAAC,CAA6B;cAErC,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAIrE,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,IAAI;IAQxD,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,KAAK;IASb,OAAO,CAAC,WAAW;IAsBnB,OAAO,CAAC,gBAAgB;IAgBxB,OAAO,CAAC,mBAAmB,CAEzB;IAEF,OAAO,CAAC,cAAc,CAqBpB;IAEF,OAAO,CAAC,OAAO;IAUN,MAAM;IAwCf,OAAO,CAAC,YAAY;IAwBpB,OAAO,CAAC,aAAa;IAiBrB,OAAO,CAAC,iBAAiB;IA+DV,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;YA6B5C,SAAS;YAgFT,UAAU;YAqGV,WAAW;IA2EzB,OAAO,CAAC,gBAAgB;IAyCxB,OAAO,CAAC,mBAAmB;YASb,mBAAmB;CAsBjC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/AttachmentOverlay.js b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/AttachmentOverlay.js new file mode 100644 index 000000000..a1f0c1859 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/AttachmentOverlay.js @@ -0,0 +1,576 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import "@mariozechner/mini-lit/dist/ModeToggle.js"; +import { icon } from "@mariozechner/mini-lit"; +import { Button } from "@mariozechner/mini-lit/dist/Button.js"; +import { renderAsync } from "docx-preview"; +import { html, LitElement } from "lit"; +import { state } from "lit/decorators.js"; +import { Download, X } from "lucide"; +import * as pdfjsLib from "pdfjs-dist"; +import * as XLSX from "xlsx"; +import { i18n } from "../utils/i18n.js"; +export class AttachmentOverlay extends LitElement { + constructor() { + super(...arguments); + this.showExtractedText = false; + this.error = null; + // Track current loading task to cancel if needed + this.currentLoadingTask = null; + this.handleBackdropClick = () => { + this.close(); + }; + this.handleDownload = () => { + if (!this.attachment) + return; + // Create a blob from the base64 content + const byteCharacters = atob(this.attachment.content); + const byteNumbers = new Array(byteCharacters.length); + for (let i = 0; i < byteCharacters.length; i++) { + byteNumbers[i] = byteCharacters.charCodeAt(i); + } + const byteArray = new Uint8Array(byteNumbers); + const blob = new Blob([byteArray], { type: this.attachment.mimeType }); + // Create download link + const url = URL.createObjectURL(blob); + const a = document.createElement("a"); + a.href = url; + a.download = this.attachment.fileName; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + URL.revokeObjectURL(url); + }; + } + createRenderRoot() { + return this; + } + static open(attachment, onClose) { + const overlay = new AttachmentOverlay(); + overlay.attachment = attachment; + overlay.onCloseCallback = onClose; + document.body.appendChild(overlay); + overlay.setupEventListeners(); + } + setupEventListeners() { + this.boundHandleKeyDown = (e) => { + if (e.key === "Escape") { + this.close(); + } + }; + window.addEventListener("keydown", this.boundHandleKeyDown); + } + close() { + this.cleanup(); + if (this.boundHandleKeyDown) { + window.removeEventListener("keydown", this.boundHandleKeyDown); + } + this.onCloseCallback?.(); + this.remove(); + } + getFileType() { + if (!this.attachment) + return "text"; + if (this.attachment.type === "image") + return "image"; + if (this.attachment.mimeType === "application/pdf") + return "pdf"; + if (this.attachment.mimeType?.includes("wordprocessingml")) + return "docx"; + if (this.attachment.mimeType?.includes("presentationml") || + this.attachment.fileName.toLowerCase().endsWith(".pptx")) + return "pptx"; + if (this.attachment.mimeType?.includes("spreadsheetml") || + this.attachment.mimeType?.includes("ms-excel") || + this.attachment.fileName.toLowerCase().endsWith(".xlsx") || + this.attachment.fileName.toLowerCase().endsWith(".xls")) + return "excel"; + return "text"; + } + getFileTypeLabel() { + const type = this.getFileType(); + switch (type) { + case "pdf": + return i18n("PDF"); + case "docx": + return i18n("Document"); + case "pptx": + return i18n("Presentation"); + case "excel": + return i18n("Spreadsheet"); + default: + return ""; + } + } + cleanup() { + this.showExtractedText = false; + this.error = null; + // Cancel any loading PDF task when closing + if (this.currentLoadingTask) { + this.currentLoadingTask.destroy(); + this.currentLoadingTask = null; + } + } + render() { + if (!this.attachment) + return html ``; + return html ` + +
+ +
e.stopPropagation()}> +
+
+ ${this.attachment.fileName} +
+
+ ${this.renderToggle()} + ${Button({ + variant: "ghost", + size: "icon", + onClick: this.handleDownload, + children: icon(Download, "sm"), + className: "h-8 w-8", + })} + ${Button({ + variant: "ghost", + size: "icon", + onClick: () => this.close(), + children: icon(X, "sm"), + className: "h-8 w-8", + })} +
+
+
+ + +
e.stopPropagation()}> + ${this.renderContent()} +
+
+ `; + } + renderToggle() { + if (!this.attachment) + return html ``; + const fileType = this.getFileType(); + const hasExtractedText = !!this.attachment.extractedText; + const showToggle = fileType !== "image" && fileType !== "text" && fileType !== "pptx" && hasExtractedText; + if (!showToggle) + return html ``; + const fileTypeLabel = this.getFileTypeLabel(); + return html ` + { + e.stopPropagation(); + this.showExtractedText = e.detail.index === 1; + this.error = null; + }} + > + `; + } + renderContent() { + if (!this.attachment) + return html ``; + // Error state + if (this.error) { + return html ` +
+
${i18n("Error loading file")}
+
${this.error}
+
+ `; + } + // Content based on file type + return this.renderFileContent(); + } + renderFileContent() { + if (!this.attachment) + return html ``; + const fileType = this.getFileType(); + // Show extracted text if toggled + if (this.showExtractedText && fileType !== "image") { + return html ` +
+
${this.attachment.extractedText || i18n("No text content available")}
+
+ `; + } + // Render based on file type + switch (fileType) { + case "image": { + const imageUrl = `data:${this.attachment.mimeType};base64,${this.attachment.content}`; + return html ` + ${this.attachment.fileName} + `; + } + case "pdf": + return html ` +
+ `; + case "docx": + return html ` +
+ `; + case "excel": + return html `
`; + case "pptx": + return html ` +
+ `; + default: + return html ` +
+
${this.attachment.extractedText || i18n("No content available")}
+
+ `; + } + } + async updated(changedProperties) { + super.updated(changedProperties); + // Only process if we need to render the actual file (not extracted text) + if ((changedProperties.has("attachment") || changedProperties.has("showExtractedText")) && + this.attachment && + !this.showExtractedText && + !this.error) { + const fileType = this.getFileType(); + switch (fileType) { + case "pdf": + await this.renderPdf(); + break; + case "docx": + await this.renderDocx(); + break; + case "excel": + await this.renderExcel(); + break; + case "pptx": + await this.renderExtractedText(); + break; + } + } + } + async renderPdf() { + const container = this.querySelector("#pdf-container"); + if (!container || !this.attachment) + return; + let pdf = null; + try { + // Convert base64 to ArrayBuffer + const arrayBuffer = this.base64ToArrayBuffer(this.attachment.content); + // Cancel any existing loading task + if (this.currentLoadingTask) { + this.currentLoadingTask.destroy(); + } + // Load the PDF + this.currentLoadingTask = pdfjsLib.getDocument({ data: arrayBuffer }); + pdf = await this.currentLoadingTask.promise; + this.currentLoadingTask = null; + // Clear container and add wrapper + container.innerHTML = ""; + const wrapper = document.createElement("div"); + wrapper.className = ""; + container.appendChild(wrapper); + // Render all pages + for (let pageNum = 1; pageNum <= pdf.numPages; pageNum++) { + const page = await pdf.getPage(pageNum); + // Create a container for each page + const pageContainer = document.createElement("div"); + pageContainer.className = "mb-4 last:mb-0"; + // Create canvas for this page + const canvas = document.createElement("canvas"); + const context = canvas.getContext("2d"); + // Set scale for reasonable resolution + const viewport = page.getViewport({ scale: 1.5 }); + canvas.height = viewport.height; + canvas.width = viewport.width; + // Style the canvas + canvas.className = "w-full max-w-full h-auto block mx-auto bg-white rounded shadow-sm border border-border"; + // Fill white background for proper PDF rendering + if (context) { + context.fillStyle = "white"; + context.fillRect(0, 0, canvas.width, canvas.height); + } + // Render page + await page.render({ + canvasContext: context, + viewport: viewport, + canvas: canvas, + }).promise; + pageContainer.appendChild(canvas); + // Add page separator for multi-page documents + if (pageNum < pdf.numPages) { + const separator = document.createElement("div"); + separator.className = "h-px bg-border my-4"; + pageContainer.appendChild(separator); + } + wrapper.appendChild(pageContainer); + } + } + catch (error) { + console.error("Error rendering PDF:", error); + this.error = error?.message || i18n("Failed to load PDF"); + } + finally { + if (pdf) { + pdf.destroy(); + } + } + } + async renderDocx() { + const container = this.querySelector("#docx-container"); + if (!container || !this.attachment) + return; + try { + // Convert base64 to ArrayBuffer + const arrayBuffer = this.base64ToArrayBuffer(this.attachment.content); + // Clear container first + container.innerHTML = ""; + // Create a wrapper div for the document + const wrapper = document.createElement("div"); + wrapper.className = "docx-wrapper-custom"; + container.appendChild(wrapper); + // Render the DOCX file into the wrapper + await renderAsync(arrayBuffer, wrapper, undefined, { + className: "docx", + inWrapper: true, + ignoreWidth: true, // Let it be responsive + ignoreHeight: false, + ignoreFonts: false, + breakPages: true, + ignoreLastRenderedPageBreak: true, + experimental: false, + trimXmlDeclaration: true, + useBase64URL: false, + renderHeaders: true, + renderFooters: true, + renderFootnotes: true, + renderEndnotes: true, + }); + // Apply custom styles to match theme and fix sizing + const style = document.createElement("style"); + style.textContent = ` + #docx-container { + padding: 0; + } + + #docx-container .docx-wrapper-custom { + max-width: 100%; + overflow-x: auto; + } + + #docx-container .docx-wrapper { + max-width: 100% !important; + margin: 0 !important; + background: transparent !important; + padding: 0em !important; + } + + #docx-container .docx-wrapper > section.docx { + box-shadow: none !important; + border: none !important; + border-radius: 0 !important; + margin: 0 !important; + padding: 2em !important; + background: white !important; + color: black !important; + max-width: 100% !important; + width: 100% !important; + min-width: 0 !important; + overflow-x: auto !important; + } + + /* Fix tables and wide content */ + #docx-container table { + max-width: 100% !important; + width: auto !important; + overflow-x: auto !important; + display: block !important; + } + + #docx-container img { + max-width: 100% !important; + height: auto !important; + } + + /* Fix paragraphs and text */ + #docx-container p, + #docx-container span, + #docx-container div { + max-width: 100% !important; + word-wrap: break-word !important; + overflow-wrap: break-word !important; + } + + /* Hide page breaks in web view */ + #docx-container .docx-page-break { + display: none !important; + } + `; + container.appendChild(style); + } + catch (error) { + console.error("Error rendering DOCX:", error); + this.error = error?.message || i18n("Failed to load document"); + } + } + async renderExcel() { + const container = this.querySelector("#excel-container"); + if (!container || !this.attachment) + return; + try { + // Convert base64 to ArrayBuffer + const arrayBuffer = this.base64ToArrayBuffer(this.attachment.content); + // Read the workbook + const workbook = XLSX.read(arrayBuffer, { type: "array" }); + // Clear container + container.innerHTML = ""; + const wrapper = document.createElement("div"); + wrapper.className = "overflow-auto h-full flex flex-col"; + container.appendChild(wrapper); + // Create tabs for multiple sheets + if (workbook.SheetNames.length > 1) { + const tabContainer = document.createElement("div"); + tabContainer.className = "flex gap-2 mb-4 border-b border-border sticky top-0 bg-card z-10"; + const sheetContents = []; + workbook.SheetNames.forEach((sheetName, index) => { + // Create tab button + const tab = document.createElement("button"); + tab.textContent = sheetName; + tab.className = + index === 0 + ? "px-4 py-2 text-sm font-medium border-b-2 border-primary text-primary" + : "px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground hover:border-b-2 hover:border-border transition-colors"; + // Create sheet content + const sheetDiv = document.createElement("div"); + sheetDiv.style.display = index === 0 ? "flex" : "none"; + sheetDiv.className = "flex-1 overflow-auto"; + sheetDiv.appendChild(this.renderExcelSheet(workbook.Sheets[sheetName], sheetName)); + sheetContents.push(sheetDiv); + // Tab click handler + tab.onclick = () => { + // Update tab styles + tabContainer.querySelectorAll("button").forEach((btn, btnIndex) => { + if (btnIndex === index) { + btn.className = "px-4 py-2 text-sm font-medium border-b-2 border-primary text-primary"; + } + else { + btn.className = + "px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground hover:border-b-2 hover:border-border transition-colors"; + } + }); + // Show/hide sheets + sheetContents.forEach((content, contentIndex) => { + content.style.display = contentIndex === index ? "flex" : "none"; + }); + }; + tabContainer.appendChild(tab); + }); + wrapper.appendChild(tabContainer); + sheetContents.forEach((content) => { + wrapper.appendChild(content); + }); + } + else { + // Single sheet + const sheetName = workbook.SheetNames[0]; + wrapper.appendChild(this.renderExcelSheet(workbook.Sheets[sheetName], sheetName)); + } + } + catch (error) { + console.error("Error rendering Excel:", error); + this.error = error?.message || i18n("Failed to load spreadsheet"); + } + } + renderExcelSheet(worksheet, sheetName) { + const sheetDiv = document.createElement("div"); + // Generate HTML table + const htmlTable = XLSX.utils.sheet_to_html(worksheet, { id: `sheet-${sheetName}` }); + const tempDiv = document.createElement("div"); + tempDiv.innerHTML = htmlTable; + // Find and style the table + const table = tempDiv.querySelector("table"); + if (table) { + table.className = "w-full border-collapse text-foreground"; + // Style all cells + table.querySelectorAll("td, th").forEach((cell) => { + const cellEl = cell; + cellEl.className = "border border-border px-3 py-2 text-sm text-left"; + }); + // Style header row + const headerCells = table.querySelectorAll("thead th, tr:first-child td"); + if (headerCells.length > 0) { + headerCells.forEach((th) => { + const thEl = th; + thEl.className = + "border border-border px-3 py-2 text-sm font-semibold bg-muted text-foreground sticky top-0"; + }); + } + // Alternate row colors + table.querySelectorAll("tbody tr:nth-child(even)").forEach((row) => { + const rowEl = row; + rowEl.className = "bg-muted/30"; + }); + sheetDiv.appendChild(table); + } + return sheetDiv; + } + base64ToArrayBuffer(base64) { + const binaryString = atob(base64); + const bytes = new Uint8Array(binaryString.length); + for (let i = 0; i < binaryString.length; i++) { + bytes[i] = binaryString.charCodeAt(i); + } + return bytes.buffer; + } + async renderExtractedText() { + const container = this.querySelector("#pptx-container"); + if (!container || !this.attachment) + return; + try { + // Display the extracted text content + container.innerHTML = ""; + const wrapper = document.createElement("div"); + wrapper.className = "p-6 overflow-auto"; + // Create a pre element to preserve formatting + const pre = document.createElement("pre"); + pre.className = "whitespace-pre-wrap text-sm text-foreground font-mono"; + pre.textContent = this.attachment.extractedText || i18n("No text content available"); + wrapper.appendChild(pre); + container.appendChild(wrapper); + } + catch (error) { + console.error("Error rendering extracted text:", error); + this.error = error?.message || i18n("Failed to display text content"); + } + } +} +__decorate([ + state() +], AttachmentOverlay.prototype, "attachment", void 0); +__decorate([ + state() +], AttachmentOverlay.prototype, "showExtractedText", void 0); +__decorate([ + state() +], AttachmentOverlay.prototype, "error", void 0); +// Register the custom element only once +if (!customElements.get("attachment-overlay")) { + customElements.define("attachment-overlay", AttachmentOverlay); +} +//# sourceMappingURL=AttachmentOverlay.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/AttachmentOverlay.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/AttachmentOverlay.js.map new file mode 100644 index 000000000..12a31dad0 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/AttachmentOverlay.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AttachmentOverlay.js","sourceRoot":"","sources":["../../src/dialogs/AttachmentOverlay.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,2CAA2C,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB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OAAO,IAAI,IAAI,CAAC,gCAAgC,CAAC,CAAC;QACvE,CAAC;IACF,CAAC;CACD;AAvmBiB;IAAhB,KAAK,EAAE;qDAAiC;AACxB;IAAhB,KAAK,EAAE;4DAAmC;AAC1B;IAAhB,KAAK,EAAE;gDAAqC;AAumB9C,wCAAwC;AACxC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,CAAC;IAC/C,cAAc,CAAC,MAAM,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,CAAC;AAChE,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/CustomProviderDialog.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/CustomProviderDialog.d.ts new file mode 100644 index 000000000..a8f0a1bfb --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/CustomProviderDialog.d.ts @@ -0,0 +1,25 @@ +import { DialogBase } from "@mariozechner/mini-lit/dist/DialogBase.js"; +import { type TemplateResult } from "lit"; +import type { CustomProvider, CustomProviderType } from "../storage/stores/custom-providers-store.js"; +export declare class CustomProviderDialog extends DialogBase { + private provider?; + private initialType?; + private onSaveCallback?; + private name; + private type; + private baseUrl; + private apiKey; + private testing; + private testError; + private discoveredModels; + protected modalWidth: string; + protected modalHeight: string; + static open(provider: CustomProvider | undefined, initialType: CustomProviderType | undefined, onSave?: () => void): Promise; + private initializeFromProvider; + private updateDefaultBaseUrl; + private isAutoDiscoveryType; + private testConnection; + private save; + protected renderContent(): TemplateResult; +} +//# sourceMappingURL=CustomProviderDialog.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/CustomProviderDialog.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/CustomProviderDialog.d.ts.map new file mode 100644 index 000000000..0856cf100 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/CustomProviderDialog.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"CustomProviderDialog.d.ts","sourceRoot":"","sources":["../../src/dialogs/CustomProviderDialog.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AAKvE,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAGhD,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAGtG,qBAAa,oBAAqB,SAAQ,UAAU;IACnD,OAAO,CAAC,QAAQ,CAAC,CAAiB;IAClC,OAAO,CAAC,WAAW,CAAC,CAAqB;IACzC,OAAO,CAAC,cAAc,CAAC,CAAa;IAE3B,OAAO,CAAC,IAAI,CAAM;IAClB,OAAO,CAAC,IAAI,CAA4C;IACxD,OAAO,CAAC,OAAO,CAAM;IACrB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,SAAS,CAAM;IACvB,OAAO,CAAC,gBAAgB,CAAoB;IAErD,SAAS,CAAC,UAAU,SAAsB;IAC1C,SAAS,CAAC,WAAW,SAAsB;WAE9B,IAAI,CAChB,QAAQ,EAAE,cAAc,GAAG,SAAS,EACpC,WAAW,EAAE,kBAAkB,GAAG,SAAS,EAC3C,MAAM,CAAC,EAAE,MAAM,IAAI;IAYpB,OAAO,CAAC,sBAAsB;IAmB9B,OAAO,CAAC,oBAAoB;IAgB5B,OAAO,CAAC,mBAAmB;YAIb,cAAc;YA6Bd,IAAI;cA8BC,aAAa,IAAI,cAAc;CAiIlD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/CustomProviderDialog.js b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/CustomProviderDialog.js new file mode 100644 index 000000000..0b9bb50ab --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/CustomProviderDialog.js @@ -0,0 +1,270 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { i18n } from "@mariozechner/mini-lit"; +import { Button } from "@mariozechner/mini-lit/dist/Button.js"; +import { DialogBase } from "@mariozechner/mini-lit/dist/DialogBase.js"; +import { Input } from "@mariozechner/mini-lit/dist/Input.js"; +import { Label } from "@mariozechner/mini-lit/dist/Label.js"; +import { Select } from "@mariozechner/mini-lit/dist/Select.js"; +import { html } from "lit"; +import { state } from "lit/decorators.js"; +import { getAppStorage } from "../storage/app-storage.js"; +import { discoverModels } from "../utils/model-discovery.js"; +export class CustomProviderDialog extends DialogBase { + constructor() { + super(...arguments); + this.name = ""; + this.type = "openai-completions"; + this.baseUrl = ""; + this.apiKey = ""; + this.testing = false; + this.testError = ""; + this.discoveredModels = []; + this.modalWidth = "min(800px, 90vw)"; + this.modalHeight = "min(700px, 90vh)"; + } + static async open(provider, initialType, onSave) { + const dialog = new CustomProviderDialog(); + dialog.provider = provider; + dialog.initialType = initialType; + dialog.onSaveCallback = onSave; + document.body.appendChild(dialog); + dialog.initializeFromProvider(); + dialog.open(); + dialog.requestUpdate(); + } + initializeFromProvider() { + if (this.provider) { + this.name = this.provider.name; + this.type = this.provider.type; + this.baseUrl = this.provider.baseUrl; + this.apiKey = this.provider.apiKey || ""; + this.discoveredModels = this.provider.models || []; + } + else { + this.name = ""; + this.type = this.initialType || "openai-completions"; + this.baseUrl = ""; + this.updateDefaultBaseUrl(); + this.apiKey = ""; + this.discoveredModels = []; + } + this.testError = ""; + this.testing = false; + } + updateDefaultBaseUrl() { + if (this.baseUrl) + return; + const defaults = { + ollama: "http://localhost:11434", + "llama.cpp": "http://localhost:8080", + vllm: "http://localhost:8000", + lmstudio: "http://localhost:1234", + "openai-completions": "", + "openai-responses": "", + "anthropic-messages": "", + }; + this.baseUrl = defaults[this.type] || ""; + } + isAutoDiscoveryType() { + return this.type === "ollama" || this.type === "llama.cpp" || this.type === "vllm" || this.type === "lmstudio"; + } + async testConnection() { + if (!this.isAutoDiscoveryType()) + return; + this.testing = true; + this.testError = ""; + this.discoveredModels = []; + try { + const models = await discoverModels(this.type, this.baseUrl, this.apiKey || undefined); + this.discoveredModels = models.map((model) => ({ + ...model, + provider: this.name || this.type, + })); + this.testError = ""; + } + catch (error) { + this.testError = error instanceof Error ? error.message : String(error); + this.discoveredModels = []; + } + finally { + this.testing = false; + this.requestUpdate(); + } + } + async save() { + if (!this.name || !this.baseUrl) { + alert(i18n("Please fill in all required fields")); + return; + } + try { + const storage = getAppStorage(); + const provider = { + id: this.provider?.id || crypto.randomUUID(), + name: this.name, + type: this.type, + baseUrl: this.baseUrl, + apiKey: this.apiKey || undefined, + models: this.isAutoDiscoveryType() ? undefined : this.provider?.models || [], + }; + await storage.customProviders.set(provider); + if (this.onSaveCallback) { + this.onSaveCallback(); + } + this.close(); + } + catch (error) { + console.error("Failed to save provider:", error); + alert(i18n("Failed to save provider")); + } + } + renderContent() { + const providerTypes = [ + { value: "ollama", label: "Ollama (auto-discovery)" }, + { value: "llama.cpp", label: "llama.cpp (auto-discovery)" }, + { value: "vllm", label: "vLLM (auto-discovery)" }, + { value: "lmstudio", label: "LM Studio (auto-discovery)" }, + { value: "openai-completions", label: "OpenAI Completions Compatible" }, + { value: "openai-responses", label: "OpenAI Responses Compatible" }, + { value: "anthropic-messages", label: "Anthropic Messages Compatible" }, + ]; + return html ` +
+
+

+ ${this.provider ? i18n("Edit Provider") : i18n("Add Provider")} +

+
+ +
+
+
+ ${Label({ htmlFor: "provider-name", children: i18n("Provider Name") })} + ${Input({ + value: this.name, + placeholder: i18n("e.g., My Ollama Server"), + onInput: (e) => { + this.name = e.target.value; + this.requestUpdate(); + }, + })} +
+ +
+ ${Label({ htmlFor: "provider-type", children: i18n("Provider Type") })} + ${Select({ + value: this.type, + options: providerTypes.map((pt) => ({ + value: pt.value, + label: pt.label, + })), + onChange: (value) => { + this.type = value; + this.baseUrl = ""; + this.updateDefaultBaseUrl(); + this.requestUpdate(); + }, + width: "100%", + })} +
+ +
+ ${Label({ htmlFor: "base-url", children: i18n("Base URL") })} + ${Input({ + value: this.baseUrl, + placeholder: i18n("e.g., http://localhost:11434"), + onInput: (e) => { + this.baseUrl = e.target.value; + this.requestUpdate(); + }, + })} +
+ +
+ ${Label({ htmlFor: "api-key", children: i18n("API Key (Optional)") })} + ${Input({ + type: "password", + value: this.apiKey, + placeholder: i18n("Leave empty if not required"), + onInput: (e) => { + this.apiKey = e.target.value; + this.requestUpdate(); + }, + })} +
+ + ${this.isAutoDiscoveryType() + ? html ` +
+ ${Button({ + onClick: () => this.testConnection(), + variant: "outline", + disabled: this.testing || !this.baseUrl, + children: this.testing ? i18n("Testing...") : i18n("Test Connection"), + })} + ${this.testError ? html `
${this.testError}
` : ""} + ${this.discoveredModels.length > 0 + ? html ` +
+ ${i18n("Discovered")} ${this.discoveredModels.length} ${i18n("models")}: +
    + ${this.discoveredModels.slice(0, 5).map((model) => html `
  • ${model.name}
  • `)} + ${this.discoveredModels.length > 5 + ? html `
  • ...${i18n("and")} ${this.discoveredModels.length - 5} ${i18n("more")}
  • ` + : ""} +
+
+ ` + : ""} +
+ ` + : html `
+ ${i18n("For manual provider types, add models after saving the provider.")} +
`} +
+
+ +
+ ${Button({ + onClick: () => this.close(), + variant: "ghost", + children: i18n("Cancel"), + })} + ${Button({ + onClick: () => this.save(), + variant: "default", + disabled: !this.name || !this.baseUrl, + children: i18n("Save"), + })} +
+
+ `; + } +} +__decorate([ + state() +], CustomProviderDialog.prototype, "name", void 0); +__decorate([ + state() +], CustomProviderDialog.prototype, "type", void 0); +__decorate([ + state() +], CustomProviderDialog.prototype, "baseUrl", void 0); +__decorate([ + state() +], CustomProviderDialog.prototype, "apiKey", void 0); +__decorate([ + state() +], CustomProviderDialog.prototype, "testing", void 0); +__decorate([ + state() +], CustomProviderDialog.prototype, "testError", void 0); +__decorate([ + state() +], CustomProviderDialog.prototype, "discoveredModels", void 0); +customElements.define("custom-provider-dialog", CustomProviderDialog); +//# sourceMappingURL=CustomProviderDialog.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/CustomProviderDialog.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/CustomProviderDialog.js.map new file mode 100644 index 000000000..79926ee1d --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/CustomProviderDialog.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CustomProviderDialog.js","sourceRoot":"","sources":["../../src/dialogs/CustomProviderDialog.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAE/D,OAAO,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,MAAM,OAAO,oBAAqB,SAAQ,UAAU;IAApD;;QAKkB,SAAI,GAAG,EAAE,CAAC;QACV,SAAI,GAAuB,oBAAoB,CAAC;QAChD,YAAO,GAAG,EAAE,CAAC;QACb,WAAM,GAAG,EA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AAC,MAAM,CAAC,OAAO;oBACtF,CAAC,CAAC,EACJ;;;aAGF;gBACD,CAAC,CAAC,EACJ;;SAED;YACD,CAAC,CAAC,IAAI,CAAA;WACH,IAAI,CAAC,kEAAkE,CAAC;eAE7E;;;;;OAKC,MAAM,CAAC;YACR,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE;YAC3B,OAAO,EAAE,OAAO;YAChB,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC;SACxB,CAAC;OACA,MAAM,CAAC;YACR,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE;YAC1B,OAAO,EAAE,SAAS;YAClB,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO;YACrC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC;SACtB,CAAC;;;GAGJ,CAAC;IACH,CAAC;CACD;AA7PiB;IAAhB,KAAK,EAAE;kDAAmB;AACV;IAAhB,KAAK,EAAE;kDAAyD;AAChD;IAAhB,KAAK,EAAE;qDAAsB;AACb;IAAhB,KAAK,EAAE;oDAAqB;AACZ;IAAhB,KAAK,EAAE;qDAAyB;AAChB;IAAhB,KAAK,EAAE;uDAAwB;AACf;IAAhB,KAAK,EAAE;8DAA6C;AAyPtD,cAAc,CAAC,MAAM,CAAC,wBAAwB,EAAE,oBAAoB,CAAC,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ModelSelector.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ModelSelector.d.ts new file mode 100644 index 000000000..400f5b12c --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ModelSelector.d.ts @@ -0,0 +1,27 @@ +import { DialogBase } from "@mariozechner/mini-lit/dist/DialogBase.js"; +import { type Model } from "@mariozechner/pi-ai"; +import { type PropertyValues, type TemplateResult } from "lit"; +export declare class ModelSelector extends DialogBase { + currentModel: Model | null; + searchQuery: string; + filterThinking: boolean; + filterVision: boolean; + customProvidersLoading: boolean; + selectedIndex: number; + private navigationMode; + private customProviderModels; + private onSelectCallback?; + private scrollContainerRef; + private searchInputRef; + private lastMousePosition; + protected modalWidth: string; + static open(currentModel: Model | null, onSelect: (model: Model) => void): Promise; + firstUpdated(changedProperties: PropertyValues): Promise; + private loadCustomProviders; + private formatTokens; + private handleSelect; + private getFilteredModels; + private scrollToSelected; + protected renderContent(): TemplateResult; +} +//# sourceMappingURL=ModelSelector.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ModelSelector.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ModelSelector.d.ts.map new file mode 100644 index 000000000..5dab4c3cb --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ModelSelector.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ModelSelector.d.ts","sourceRoot":"","sources":["../../src/dialogs/ModelSelector.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,EAA2B,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAQ,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAWrE,qBACa,aAAc,SAAQ,UAAU;IACnC,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAQ;IACvC,WAAW,SAAM;IACjB,cAAc,UAAS;IACvB,YAAY,UAAS;IACrB,sBAAsB,UAAS;IAC/B,aAAa,SAAK;IAClB,OAAO,CAAC,cAAc,CAAiC;IACvD,OAAO,CAAC,oBAAoB,CAAoB;IAEzD,OAAO,CAAC,gBAAgB,CAAC,CAA8B;IACvD,OAAO,CAAC,kBAAkB,CAA+B;IACzD,OAAO,CAAC,cAAc,CAAiC;IACvD,OAAO,CAAC,iBAAiB,CAAkB;IAE3C,UAAmB,UAAU,SAAsB;WAEtC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI;IAQzE,YAAY,CAAC,iBAAiB,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;YAuD/D,mBAAmB;IA+CjC,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,iBAAiB;IAiDzB,OAAO,CAAC,gBAAgB;cAYL,aAAa,IAAI,cAAc;CA0FlD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ModelSelector.js b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ModelSelector.js new file mode 100644 index 000000000..d4d1f86ff --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ModelSelector.js @@ -0,0 +1,320 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var ModelSelector_1; +import { icon } from "@mariozechner/mini-lit"; +import { Badge } from "@mariozechner/mini-lit/dist/Badge.js"; +import { Button } from "@mariozechner/mini-lit/dist/Button.js"; +import { DialogHeader } from "@mariozechner/mini-lit/dist/Dialog.js"; +import { DialogBase } from "@mariozechner/mini-lit/dist/DialogBase.js"; +import { getModels, getProviders } from "@mariozechner/pi-ai"; +import { html } from "lit"; +import { customElement, state } from "lit/decorators.js"; +import { createRef, ref } from "lit/directives/ref.js"; +import { Brain, Image as ImageIcon } from "lucide"; +import { Input } from "../components/Input.js"; +import { getAppStorage } from "../storage/app-storage.js"; +import { formatModelCost } from "../utils/format.js"; +import { i18n } from "../utils/i18n.js"; +import { discoverModels } from "../utils/model-discovery.js"; +let ModelSelector = ModelSelector_1 = class ModelSelector extends DialogBase { + constructor() { + super(...arguments); + this.currentModel = null; + this.searchQuery = ""; + this.filterThinking = false; + this.filterVision = false; + this.customProvidersLoading = false; + this.selectedIndex = 0; + this.navigationMode = "mouse"; + this.customProviderModels = []; + this.scrollContainerRef = createRef(); + this.searchInputRef = createRef(); + this.lastMousePosition = { x: 0, y: 0 }; + this.modalWidth = "min(400px, 90vw)"; + } + static async open(currentModel, onSelect) { + const selector = new ModelSelector_1(); + selector.currentModel = currentModel; + selector.onSelectCallback = onSelect; + selector.open(); + selector.loadCustomProviders(); + } + async firstUpdated(changedProperties) { + super.firstUpdated(changedProperties); + // Wait for dialog to be fully rendered + await this.updateComplete; + // Focus the search input when dialog opens + this.searchInputRef.value?.focus(); + // Track actual mouse movement + this.addEventListener("mousemove", (e) => { + // Check if mouse actually moved + if (e.clientX !== this.lastMousePosition.x || e.clientY !== this.lastMousePosition.y) { + this.lastMousePosition = { x: e.clientX, y: e.clientY }; + // Only switch to mouse mode on actual mouse movement + if (this.navigationMode === "keyboard") { + this.navigationMode = "mouse"; + // Update selection to the item under the mouse + const target = e.target; + const modelItem = target.closest("[data-model-item]"); + if (modelItem) { + const allItems = this.scrollContainerRef.value?.querySelectorAll("[data-model-item]"); + if (allItems) { + const index = Array.from(allItems).indexOf(modelItem); + if (index !== -1) { + this.selectedIndex = index; + } + } + } + } + } + }); + // Add global keyboard handler for the dialog + this.addEventListener("keydown", (e) => { + // Get filtered models to know the bounds + const filteredModels = this.getFilteredModels(); + if (e.key === "ArrowDown") { + e.preventDefault(); + this.navigationMode = "keyboard"; + this.selectedIndex = Math.min(this.selectedIndex + 1, filteredModels.length - 1); + this.scrollToSelected(); + } + else if (e.key === "ArrowUp") { + e.preventDefault(); + this.navigationMode = "keyboard"; + this.selectedIndex = Math.max(this.selectedIndex - 1, 0); + this.scrollToSelected(); + } + else if (e.key === "Enter") { + e.preventDefault(); + if (filteredModels[this.selectedIndex]) { + this.handleSelect(filteredModels[this.selectedIndex].model); + } + } + }); + } + async loadCustomProviders() { + this.customProvidersLoading = true; + const allCustomModels = []; + try { + const storage = getAppStorage(); + const customProviders = await storage.customProviders.getAll(); + // Load models from custom providers + for (const provider of customProviders) { + const isAutoDiscovery = provider.type === "ollama" || + provider.type === "llama.cpp" || + provider.type === "vllm" || + provider.type === "lmstudio"; + if (isAutoDiscovery) { + try { + const models = await discoverModels(provider.type, provider.baseUrl, provider.apiKey); + const modelsWithProvider = models.map((model) => ({ + ...model, + provider: provider.name, + })); + allCustomModels.push(...modelsWithProvider); + } + catch (error) { + console.debug(`Failed to load models from ${provider.name}:`, error); + } + } + else if (provider.models) { + // Manual provider - models already defined + allCustomModels.push(...provider.models); + } + } + } + catch (error) { + console.error("Failed to load custom providers:", error); + } + finally { + this.customProviderModels = allCustomModels; + this.customProvidersLoading = false; + this.requestUpdate(); + } + } + formatTokens(tokens) { + if (tokens >= 1000000) + return `${(tokens / 1000000).toFixed(0)}M`; + if (tokens >= 1000) + return `${(tokens / 1000).toFixed(0)}`; + return String(tokens); + } + handleSelect(model) { + if (model) { + this.onSelectCallback?.(model); + this.close(); + } + } + getFilteredModels() { + // Collect all models from known providers + const allModels = []; + const knownProviders = getProviders(); + for (const provider of knownProviders) { + const models = getModels(provider); + for (const model of models) { + allModels.push({ provider, id: model.id, model }); + } + } + // Add custom provider models + for (const model of this.customProviderModels) { + allModels.push({ provider: model.provider, id: model.id, model }); + } + // Filter models based on search and capability filters + let filteredModels = allModels; + // Apply search filter + if (this.searchQuery) { + filteredModels = filteredModels.filter(({ provider, id, model }) => { + const searchTokens = this.searchQuery.split(/\s+/).filter((t) => t); + const searchText = `${provider} ${id} ${model.name}`.toLowerCase(); + return searchTokens.every((token) => searchText.includes(token)); + }); + } + // Apply capability filters + if (this.filterThinking) { + filteredModels = filteredModels.filter(({ model }) => model.reasoning); + } + if (this.filterVision) { + filteredModels = filteredModels.filter(({ model }) => model.input.includes("image")); + } + // Sort: current model first, then by provider + filteredModels.sort((a, b) => { + const aIsCurrent = this.currentModel?.id === a.model.id; + const bIsCurrent = this.currentModel?.id === b.model.id; + if (aIsCurrent && !bIsCurrent) + return -1; + if (!aIsCurrent && bIsCurrent) + return 1; + return a.provider.localeCompare(b.provider); + }); + return filteredModels; + } + scrollToSelected() { + requestAnimationFrame(() => { + const scrollContainer = this.scrollContainerRef.value; + const selectedElement = scrollContainer?.querySelectorAll("[data-model-item]")[this.selectedIndex]; + if (selectedElement) { + selectedElement.scrollIntoView({ block: "nearest", behavior: "smooth" }); + } + }); + } + renderContent() { + const filteredModels = this.getFilteredModels(); + return html ` + +
+ ${DialogHeader({ title: i18n("Select Model") })} + ${Input({ + placeholder: i18n("Search models..."), + value: this.searchQuery, + inputRef: this.searchInputRef, + onInput: (e) => { + this.searchQuery = e.target.value; + this.selectedIndex = 0; + // Reset scroll position when search changes + if (this.scrollContainerRef.value) { + this.scrollContainerRef.value.scrollTop = 0; + } + }, + })} +
+ ${Button({ + variant: this.filterThinking ? "default" : "secondary", + size: "sm", + onClick: () => { + this.filterThinking = !this.filterThinking; + this.selectedIndex = 0; + if (this.scrollContainerRef.value) { + this.scrollContainerRef.value.scrollTop = 0; + } + }, + className: "rounded-full", + children: html `${icon(Brain, "sm")} ${i18n("Thinking")}`, + })} + ${Button({ + variant: this.filterVision ? "default" : "secondary", + size: "sm", + onClick: () => { + this.filterVision = !this.filterVision; + this.selectedIndex = 0; + if (this.scrollContainerRef.value) { + this.scrollContainerRef.value.scrollTop = 0; + } + }, + className: "rounded-full", + children: html `${icon(ImageIcon, "sm")} ${i18n("Vision")}`, + })} +
+
+ + +
+ ${filteredModels.map(({ provider, id, model }, index) => { + const isCurrent = this.currentModel?.id === model.id && this.currentModel?.provider === model.provider; + const isSelected = index === this.selectedIndex; + return html ` +
this.handleSelect(model)} + @mouseenter=${() => { + // Only update selection in mouse mode + if (this.navigationMode === "mouse") { + this.selectedIndex = index; + } + }} + > +
+
+ ${id} + ${isCurrent ? html `` : ""} +
+ ${Badge(provider, "outline")} +
+
+
+ ${icon(Brain, "sm")} + ${icon(ImageIcon, "sm")} + ${this.formatTokens(model.contextWindow)}K/${this.formatTokens(model.maxTokens)}K +
+ ${formatModelCost(model.cost)} +
+
+ `; + })} +
+ `; + } +}; +__decorate([ + state() +], ModelSelector.prototype, "currentModel", void 0); +__decorate([ + state() +], ModelSelector.prototype, "searchQuery", void 0); +__decorate([ + state() +], ModelSelector.prototype, "filterThinking", void 0); +__decorate([ + state() +], ModelSelector.prototype, "filterVision", void 0); +__decorate([ + state() +], ModelSelector.prototype, "customProvidersLoading", void 0); +__decorate([ + state() +], ModelSelector.prototype, "selectedIndex", void 0); +__decorate([ + state() +], ModelSelector.prototype, "navigationMode", void 0); +__decorate([ + state() +], ModelSelector.prototype, "customProviderModels", void 0); +ModelSelector = ModelSelector_1 = __decorate([ + customElement("agent-model-selector") +], ModelSelector); +export { ModelSelector }; +//# sourceMappingURL=ModelSelector.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ModelSelector.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ModelSelector.js.map new file mode 100644 index 000000000..9de4a65ae --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ModelSelector.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ModelSelector.js","sourceRoot":"","sources":["../../src/dialogs/ModelSelector.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAA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E,IAAI,CAAC;wBACzD,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,KAAK,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC;iBAClF,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC;;gBAE9E,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC;;;MAGrC,CAAC;QACH,CAAC,CAAC;;GAEH,CAAC;IACH,CAAC;CACD,CAAA;AAlSS;IAAR,KAAK,EAAE;mDAAwC;AACvC;IAAR,KAAK,EAAE;kDAAkB;AACjB;IAAR,KAAK,EAAE;qDAAwB;AACvB;IAAR,KAAK,EAAE;mDAAsB;AACrB;IAAR,KAAK,EAAE;6DAAgC;AAC/B;IAAR,KAAK,EAAE;oDAAmB;AACV;IAAhB,KAAK,EAAE;qDAAwD;AAC/C;IAAhB,KAAK,EAAE;2DAAiD;AAR7C,aAAa;IADzB,aAAa,CAAC,sBAAsB,CAAC;GACzB,aAAa,CAmSzB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/PersistentStorageDialog.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/PersistentStorageDialog.d.ts new file mode 100644 index 000000000..8365b6def --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/PersistentStorageDialog.d.ts @@ -0,0 +1,17 @@ +import { DialogBase } from "@mariozechner/mini-lit/dist/DialogBase.js"; +export declare class PersistentStorageDialog extends DialogBase { + private requesting; + private resolvePromise?; + protected modalWidth: string; + protected modalHeight: string; + /** + * Request persistent storage permission. + * Returns true if browser granted persistent storage, false otherwise. + */ + static request(): Promise; + private handleGrant; + private handleDeny; + close(): void; + protected renderContent(): import("lit-html").TemplateResult<1>; +} +//# sourceMappingURL=PersistentStorageDialog.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/PersistentStorageDialog.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/PersistentStorageDialog.d.ts.map new file mode 100644 index 000000000..f0e06b34a --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/PersistentStorageDialog.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PersistentStorageDialog.d.ts","sourceRoot":"","sources":["../../src/dialogs/PersistentStorageDialog.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AAKvE,qBACa,uBAAwB,SAAQ,UAAU;IAC7C,OAAO,CAAC,UAAU,CAAS;IAEpC,OAAO,CAAC,cAAc,CAAC,CAAkC;IAEzD,SAAS,CAAC,UAAU,SAAsB;IAC1C,SAAS,CAAC,WAAW,SAAU;IAE/B;;;OAGG;WACU,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IA2CxC,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,UAAU;IAQT,KAAK;cAOK,aAAa;CAyDhC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/PersistentStorageDialog.js b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/PersistentStorageDialog.js new file mode 100644 index 000000000..8cbc0b077 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/PersistentStorageDialog.js @@ -0,0 +1,147 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var PersistentStorageDialog_1; +import { Button } from "@mariozechner/mini-lit/dist/Button.js"; +import { DialogContent, DialogHeader } from "@mariozechner/mini-lit/dist/Dialog.js"; +import { DialogBase } from "@mariozechner/mini-lit/dist/DialogBase.js"; +import { html } from "lit"; +import { customElement, state } from "lit/decorators.js"; +import { i18n } from "../utils/i18n.js"; +let PersistentStorageDialog = PersistentStorageDialog_1 = class PersistentStorageDialog extends DialogBase { + constructor() { + super(...arguments); + this.requesting = false; + this.modalWidth = "min(500px, 90vw)"; + this.modalHeight = "auto"; + } + /** + * Request persistent storage permission. + * Returns true if browser granted persistent storage, false otherwise. + */ + static async request() { + // Check if already persisted + if (navigator.storage?.persisted) { + const alreadyPersisted = await navigator.storage.persisted(); + if (alreadyPersisted) { + console.log("✓ Persistent storage already granted"); + return true; + } + } + // Show dialog and wait for user response + const dialog = new PersistentStorageDialog_1(); + dialog.open(); + const userApproved = await new Promise((resolve) => { + dialog.resolvePromise = resolve; + }); + if (!userApproved) { + console.warn("⚠ User declined persistent storage - sessions may be lost"); + return false; + } + // User approved, request from browser + if (!navigator.storage?.persist) { + console.warn("⚠ Persistent storage API not available"); + return false; + } + try { + const granted = await navigator.storage.persist(); + if (granted) { + console.log("✓ Persistent storage granted - sessions will be preserved"); + } + else { + console.warn("⚠ Browser denied persistent storage - sessions may be lost under storage pressure"); + } + return granted; + } + catch (error) { + console.error("Failed to request persistent storage:", error); + return false; + } + } + handleGrant() { + if (this.resolvePromise) { + this.resolvePromise(true); + this.resolvePromise = undefined; + } + this.close(); + } + handleDeny() { + if (this.resolvePromise) { + this.resolvePromise(false); + this.resolvePromise = undefined; + } + this.close(); + } + close() { + super.close(); + if (this.resolvePromise) { + this.resolvePromise(false); + } + } + renderContent() { + return html ` + ${DialogContent({ + children: html ` + ${DialogHeader({ + title: i18n("Storage Permission Required"), + description: i18n("This app needs persistent storage to save your conversations"), + })} + +
+
+
+ + + + + +
+
+

${i18n("Why is this needed?")}

+

+ ${i18n("Without persistent storage, your browser may delete saved conversations when it needs disk space. Granting this permission ensures your chat history is preserved.")} +

+
+
+ +
+

${i18n("What this means:")}

+
    +
  • ${i18n("Your conversations will be saved locally in your browser")}
  • +
  • ${i18n("Data will not be deleted automatically to free up space")}
  • +
  • ${i18n("You can still manually clear data at any time")}
  • +
  • ${i18n("No data is sent to external servers")}
  • +
+
+
+ +
+ ${Button({ + variant: "outline", + onClick: () => this.handleDeny(), + disabled: this.requesting, + children: i18n("Continue Anyway"), + })} + ${Button({ + variant: "default", + onClick: () => this.handleGrant(), + disabled: this.requesting, + children: this.requesting ? i18n("Requesting...") : i18n("Grant Permission"), + })} +
+ `, + })} + `; + } +}; +__decorate([ + state() +], PersistentStorageDialog.prototype, "requesting", void 0); +PersistentStorageDialog = PersistentStorageDialog_1 = __decorate([ + customElement("persistent-storage-dialog") +], PersistentStorageDialog); +export { PersistentStorageDialog }; +//# sourceMappingURL=PersistentStorageDialog.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/PersistentStorageDialog.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/PersistentStorageDialog.js.map new file mode 100644 index 000000000..0258e66d2 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/PersistentStorageDialog.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PersistentStorageDialog.js","sourceRoot":"","sources":["../../src/dialogs/PersistentStorageDialog.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGjC,IA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AAqC,CAAC;;;;;;QAMjD,MAAM,CAAC;gBACR,OAAO,EAAE,SAAS;gBAClB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE;gBAChC,QAAQ,EAAE,IAAI,CAAC,UAAU;gBACzB,QAAQ,EAAE,IAAI,CAAC,iBAAiB,CAAC;aACjC,CAAC;QACA,MAAM,CAAC;gBACR,OAAO,EAAE,SAAS;gBAClB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE;gBACjC,QAAQ,EAAE,IAAI,CAAC,UAAU;gBACzB,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC;aAC5E,CAAC;;KAEH;SACD,CAAC;GACF,CAAC;IACH,CAAC;CACD,CAAA;AAtIiB;IAAhB,KAAK,EAAE;2DAA4B;AADxB,uBAAuB;IADnC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,uBAAuB,CAuInC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ProvidersModelsTab.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ProvidersModelsTab.d.ts new file mode 100644 index 000000000..fe1fa6012 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ProvidersModelsTab.d.ts @@ -0,0 +1,20 @@ +import { type TemplateResult } from "lit"; +import "../components/CustomProviderCard.js"; +import "../components/ProviderKeyInput.js"; +import { SettingsTab } from "./SettingsDialog.js"; +export declare class ProvidersModelsTab extends SettingsTab { + private customProviders; + private providerStatus; + connectedCallback(): Promise; + private loadCustomProviders; + getTabName(): string; + private checkProviderStatus; + private renderKnownProviders; + private renderCustomProviders; + private addCustomProvider; + private editProvider; + private refreshProvider; + private deleteProvider; + render(): TemplateResult; +} +//# sourceMappingURL=ProvidersModelsTab.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ProvidersModelsTab.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ProvidersModelsTab.d.ts.map new file mode 100644 index 000000000..e191d2c77 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ProvidersModelsTab.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ProvidersModelsTab.d.ts","sourceRoot":"","sources":["../../src/dialogs/ProvidersModelsTab.ts"],"names":[],"mappings":"AAGA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAEhD,OAAO,qCAAqC,CAAC;AAC7C,OAAO,mCAAmC,CAAC;AAS3C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,qBACa,kBAAmB,SAAQ,WAAW;IACzC,OAAO,CAAC,eAAe,CAAwB;IAC/C,OAAO,CAAC,cAAc,CAGjB;IAEC,iBAAiB;YAKlB,mBAAmB;IAqBjC,UAAU,IAAI,MAAM;YAIN,mBAAmB;IAkBjC,OAAO,CAAC,oBAAoB;IAkB5B,OAAO,CAAC,qBAAqB;YA0Df,iBAAiB;YAOjB,YAAY;YAOZ,eAAe;YAwBf,cAAc;IAe5B,MAAM,IAAI,cAAc;CASxB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ProvidersModelsTab.js b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ProvidersModelsTab.js new file mode 100644 index 000000000..ec87621f6 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ProvidersModelsTab.js @@ -0,0 +1,191 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { i18n } from "@mariozechner/mini-lit"; +import { Select } from "@mariozechner/mini-lit/dist/Select.js"; +import { getProviders } from "@mariozechner/pi-ai"; +import { html } from "lit"; +import { customElement, state } from "lit/decorators.js"; +import "../components/CustomProviderCard.js"; +import "../components/ProviderKeyInput.js"; +import { getAppStorage } from "../storage/app-storage.js"; +import { discoverModels } from "../utils/model-discovery.js"; +import { CustomProviderDialog } from "./CustomProviderDialog.js"; +import { SettingsTab } from "./SettingsDialog.js"; +let ProvidersModelsTab = class ProvidersModelsTab extends SettingsTab { + constructor() { + super(...arguments); + this.customProviders = []; + this.providerStatus = new Map(); + } + async connectedCallback() { + super.connectedCallback(); + await this.loadCustomProviders(); + } + async loadCustomProviders() { + try { + const storage = getAppStorage(); + this.customProviders = await storage.customProviders.getAll(); + // Check status for auto-discovery providers + for (const provider of this.customProviders) { + const isAutoDiscovery = provider.type === "ollama" || + provider.type === "llama.cpp" || + provider.type === "vllm" || + provider.type === "lmstudio"; + if (isAutoDiscovery) { + this.checkProviderStatus(provider); + } + } + } + catch (error) { + console.error("Failed to load custom providers:", error); + } + } + getTabName() { + return "Providers & Models"; + } + async checkProviderStatus(provider) { + this.providerStatus.set(provider.id, { modelCount: 0, status: "checking" }); + this.requestUpdate(); + try { + const models = await discoverModels(provider.type, provider.baseUrl, provider.apiKey); + this.providerStatus.set(provider.id, { modelCount: models.length, status: "connected" }); + } + catch (error) { + this.providerStatus.set(provider.id, { modelCount: 0, status: "disconnected" }); + } + this.requestUpdate(); + } + renderKnownProviders() { + const providers = getProviders(); + return html ` +
+
+

Cloud Providers

+

+ Cloud LLM providers with predefined models. API keys are stored locally in your browser. +

+
+
+ ${providers.map((provider) => html ` `)} +
+
+ `; + } + renderCustomProviders() { + const isAutoDiscovery = (type) => type === "ollama" || type === "llama.cpp" || type === "vllm" || type === "lmstudio"; + return html ` +
+
+
+

Custom Providers

+

+ User-configured servers with auto-discovered or manually defined models. +

+
+ ${Select({ + placeholder: i18n("Add Provider"), + options: [ + { value: "ollama", label: "Ollama" }, + { value: "llama.cpp", label: "llama.cpp" }, + { value: "vllm", label: "vLLM" }, + { value: "lmstudio", label: "LM Studio" }, + { value: "openai-completions", label: i18n("OpenAI Completions Compatible") }, + { value: "openai-responses", label: i18n("OpenAI Responses Compatible") }, + { value: "anthropic-messages", label: i18n("Anthropic Messages Compatible") }, + ], + onChange: (value) => this.addCustomProvider(value), + variant: "outline", + size: "sm", + })} +
+ + ${this.customProviders.length === 0 + ? html ` +
+ No custom providers configured. Click 'Add Provider' to get started. +
+ ` + : html ` +
+ ${this.customProviders.map((provider) => html ` + this.refreshProvider(p)} + .onEdit=${(p) => this.editProvider(p)} + .onDelete=${(p) => this.deleteProvider(p)} + > + `)} +
+ `} +
+ `; + } + async addCustomProvider(type) { + await CustomProviderDialog.open(undefined, type, async () => { + await this.loadCustomProviders(); + this.requestUpdate(); + }); + } + async editProvider(provider) { + await CustomProviderDialog.open(provider, undefined, async () => { + await this.loadCustomProviders(); + this.requestUpdate(); + }); + } + async refreshProvider(provider) { + this.providerStatus.set(provider.id, { modelCount: 0, status: "checking" }); + this.requestUpdate(); + try { + const models = await discoverModels(provider.type, provider.baseUrl, provider.apiKey); + this.providerStatus.set(provider.id, { modelCount: models.length, status: "connected" }); + this.requestUpdate(); + console.log(`Refreshed ${models.length} models from ${provider.name}`); + } + catch (error) { + this.providerStatus.set(provider.id, { modelCount: 0, status: "disconnected" }); + this.requestUpdate(); + console.error(`Failed to refresh provider ${provider.name}:`, error); + alert(`Failed to refresh provider: ${error instanceof Error ? error.message : String(error)}`); + } + } + async deleteProvider(provider) { + if (!confirm("Are you sure you want to delete this provider?")) { + return; + } + try { + const storage = getAppStorage(); + await storage.customProviders.delete(provider.id); + await this.loadCustomProviders(); + this.requestUpdate(); + } + catch (error) { + console.error("Failed to delete provider:", error); + } + } + render() { + return html ` +
+ ${this.renderKnownProviders()} +
+ ${this.renderCustomProviders()} +
+ `; + } +}; +__decorate([ + state() +], ProvidersModelsTab.prototype, "customProviders", void 0); +__decorate([ + state() +], ProvidersModelsTab.prototype, "providerStatus", void 0); +ProvidersModelsTab = __decorate([ + customElement("providers-models-tab") +], ProvidersModelsTab); +export { ProvidersModelsTab }; +//# sourceMappingURL=ProvidersModelsTab.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ProvidersModelsTab.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ProvidersModelsTab.js.map new file mode 100644 index 000000000..f08697ffd --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/ProvidersModelsTab.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ProvidersModelsTab.js","sourceRoot":"","sources":["../../src/dialogs/ProvidersModelsTab.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,qCAAqC,CAAC;AAC7C,OAAO,mCAAmC,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAM1D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAG3C,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,WAAW;IAA5C;;QACW,oBAAe,GAAqB,EAAE,CAAC;QACvC,mBAAc,GAG3B,IAAI,GAAG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AEO,KAAK,CAAC,cAAc,CAAC,QAAwB;QACpD,IAAI,CAAC,OAAO,CAAC,gDAAgD,CAAC,EAAE,CAAC;YAChE,OAAO;QACR,CAAC;QAED,IAAI,CAAC;YACJ,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;YAChC,MAAM,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAClD,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACjC,IAAI,CAAC,aAAa,EAAE,CAAC;QACtB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACpD,CAAC;IACF,CAAC;IAED,MAAM;QACL,OAAO,IAAI,CAAA;;MAEP,IAAI,CAAC,oBAAoB,EAAE;;MAE3B,IAAI,CAAC,qBAAqB,EAAE;;GAE/B,CAAC;IACH,CAAC;CACD,CAAA;AAhMiB;IAAhB,KAAK,EAAE;2DAAgD;AACvC;IAAhB,KAAK,EAAE;0DAGM;AALF,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAiM9B"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SessionListDialog.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SessionListDialog.d.ts new file mode 100644 index 000000000..ce0ea0aa4 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SessionListDialog.d.ts @@ -0,0 +1,19 @@ +import { DialogBase } from "@mariozechner/mini-lit/dist/DialogBase.js"; +export declare class SessionListDialog extends DialogBase { + private sessions; + private loading; + private onSelectCallback?; + private onDeleteCallback?; + private deletedSessions; + private closedViaSelection; + protected modalWidth: string; + protected modalHeight: string; + static open(onSelect: (sessionId: string) => void, onDelete?: (sessionId: string) => void): Promise; + private loadSessions; + private handleDelete; + close(): void; + private handleSelect; + private formatDate; + protected renderContent(): import("lit-html").TemplateResult<1>; +} +//# sourceMappingURL=SessionListDialog.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SessionListDialog.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SessionListDialog.d.ts.map new file mode 100644 index 000000000..a790f61b2 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SessionListDialog.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"SessionListDialog.d.ts","sourceRoot":"","sources":["../../src/dialogs/SessionListDialog.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AAQvE,qBACa,iBAAkB,SAAQ,UAAU;IACvC,OAAO,CAAC,QAAQ,CAAyB;IACzC,OAAO,CAAC,OAAO,CAAQ;IAEhC,OAAO,CAAC,gBAAgB,CAAC,CAA8B;IACvD,OAAO,CAAC,gBAAgB,CAAC,CAA8B;IACvD,OAAO,CAAC,eAAe,CAAqB;IAC5C,OAAO,CAAC,kBAAkB,CAAS;IAEnC,SAAS,CAAC,UAAU,SAAsB;IAC1C,SAAS,CAAC,WAAW,SAAsB;WAE9B,IAAI,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI;YAQjF,YAAY;YAaZ,YAAY;IAqBjB,KAAK;IAWd,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,UAAU;cAiBC,aAAa;CAiDhC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SessionListDialog.js b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SessionListDialog.js new file mode 100644 index 000000000..120a894ac --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SessionListDialog.js @@ -0,0 +1,154 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var SessionListDialog_1; +import { DialogContent, DialogHeader } from "@mariozechner/mini-lit/dist/Dialog.js"; +import { DialogBase } from "@mariozechner/mini-lit/dist/DialogBase.js"; +import { html } from "lit"; +import { customElement, state } from "lit/decorators.js"; +import { getAppStorage } from "../storage/app-storage.js"; +import { formatUsage } from "../utils/format.js"; +import { i18n } from "../utils/i18n.js"; +let SessionListDialog = SessionListDialog_1 = class SessionListDialog extends DialogBase { + constructor() { + super(...arguments); + this.sessions = []; + this.loading = true; + this.deletedSessions = new Set(); + this.closedViaSelection = false; + this.modalWidth = "min(600px, 90vw)"; + this.modalHeight = "min(700px, 90vh)"; + } + static async open(onSelect, onDelete) { + const dialog = new SessionListDialog_1(); + dialog.onSelectCallback = onSelect; + dialog.onDeleteCallback = onDelete; + dialog.open(); + await dialog.loadSessions(); + } + async loadSessions() { + this.loading = true; + try { + const storage = getAppStorage(); + this.sessions = await storage.sessions.getAllMetadata(); + } + catch (err) { + console.error("Failed to load sessions:", err); + this.sessions = []; + } + finally { + this.loading = false; + } + } + async handleDelete(sessionId, event) { + event.stopPropagation(); + if (!confirm(i18n("Delete this session?"))) { + return; + } + try { + const storage = getAppStorage(); + if (!storage.sessions) + return; + await storage.sessions.deleteSession(sessionId); + await this.loadSessions(); + // Track deleted session + this.deletedSessions.add(sessionId); + } + catch (err) { + console.error("Failed to delete session:", err); + } + } + close() { + super.close(); + // Only notify about deleted sessions if dialog wasn't closed via selection + if (!this.closedViaSelection && this.onDeleteCallback && this.deletedSessions.size > 0) { + for (const sessionId of this.deletedSessions) { + this.onDeleteCallback(sessionId); + } + } + } + handleSelect(sessionId) { + this.closedViaSelection = true; + if (this.onSelectCallback) { + this.onSelectCallback(sessionId); + } + this.close(); + } + formatDate(isoString) { + const date = new Date(isoString); + const now = new Date(); + const diff = now.getTime() - date.getTime(); + const days = Math.floor(diff / (1000 * 60 * 60 * 24)); + if (days === 0) { + return i18n("Today"); + } + else if (days === 1) { + return i18n("Yesterday"); + } + else if (days < 7) { + return i18n("{days} days ago").replace("{days}", days.toString()); + } + else { + return date.toLocaleDateString(); + } + } + renderContent() { + return html ` + ${DialogContent({ + className: "h-full flex flex-col", + children: html ` + ${DialogHeader({ + title: i18n("Sessions"), + description: i18n("Load a previous conversation"), + })} + +
+ ${this.loading + ? html `
${i18n("Loading...")}
` + : this.sessions.length === 0 + ? html `
${i18n("No sessions yet")}
` + : this.sessions.map((session) => html ` +
this.handleSelect(session.id)} + > +
+
${session.title}
+
${this.formatDate(session.lastModified)}
+
+ ${session.messageCount} ${i18n("messages")} · ${formatUsage(session.usage)} +
+
+ +
+ `)} +
+ `, + })} + `; + } +}; +__decorate([ + state() +], SessionListDialog.prototype, "sessions", void 0); +__decorate([ + state() +], SessionListDialog.prototype, "loading", void 0); +SessionListDialog = SessionListDialog_1 = __decorate([ + customElement("session-list-dialog") +], SessionListDialog); +export { SessionListDialog }; +//# sourceMappingURL=SessionListDialog.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SessionListDialog.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SessionListDialog.js.map new file mode 100644 index 000000000..acb7d199b --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SessionListDialog.js.map @@ -0,0 +1 @@ +{"version":3,"file":"SessionListDialog.js","sourceRoot":"","sources":["../../src/dialogs/SessionListDialog.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,EAAE,UAAU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AAI,CAAC,iBAAiB,CAAC,QAAQ;oBAC5F,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CACjB,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAA;;;qBAGP,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC;;;yEAGiB,OAAO,CAAC,KAAK;+DACvB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC;;gBAEpF,OAAO,CAAC,YAAY,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC;;;;;sBAKlE,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;qBAC/C,IAAI,CAAC,QAAQ,CAAC;;;;;;;;;WASxB,CAEL;;KAED;SACD,CAAC;GACF,CAAC;IACH,CAAC;CACD,CAAA;AA1IiB;IAAhB,KAAK,EAAE;mDAA0C;AACjC;IAAhB,KAAK,EAAE;kDAAwB;AAFpB,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CA2I7B"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SettingsDialog.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SettingsDialog.d.ts new file mode 100644 index 000000000..cede7b592 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SettingsDialog.d.ts @@ -0,0 +1,30 @@ +import { LitElement, type TemplateResult } from "lit"; +import "../components/ProviderKeyInput.js"; +export declare abstract class SettingsTab extends LitElement { + abstract getTabName(): string; + protected createRenderRoot(): this; +} +export declare class ApiKeysTab extends SettingsTab { + getTabName(): string; + render(): TemplateResult; +} +export declare class ProxyTab extends SettingsTab { + private proxyEnabled; + private proxyUrl; + connectedCallback(): Promise; + private saveProxySettings; + getTabName(): string; + render(): TemplateResult; +} +export declare class SettingsDialog extends LitElement { + tabs: SettingsTab[]; + private isOpen; + private activeTabIndex; + protected createRenderRoot(): this; + static open(tabs: SettingsTab[]): Promise; + private setActiveTab; + private renderSidebarItem; + private renderMobileTab; + render(): TemplateResult; +} +//# sourceMappingURL=SettingsDialog.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SettingsDialog.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SettingsDialog.d.ts.map new file mode 100644 index 000000000..97568b623 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SettingsDialog.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"SettingsDialog.d.ts","sourceRoot":"","sources":["../../src/dialogs/SettingsDialog.ts"],"names":[],"mappings":"AAMA,OAAO,EAAQ,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAE5D,OAAO,mCAAmC,CAAC;AAI3C,8BAAsB,WAAY,SAAQ,UAAU;IACnD,QAAQ,CAAC,UAAU,IAAI,MAAM;IAE7B,SAAS,CAAC,gBAAgB;CAG1B;AAGD,qBACa,UAAW,SAAQ,WAAW;IAC1C,UAAU,IAAI,MAAM;IAIpB,MAAM,IAAI,cAAc;CAYxB;AAGD,qBACa,QAAS,SAAQ,WAAW;IAC/B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAA2B;IAErC,iBAAiB;YAelB,iBAAiB;IAU/B,UAAU,IAAI,MAAM;IAIpB,MAAM,IAAI,cAAc;CAoCxB;AAED,qBACa,cAAe,SAAQ,UAAU;IACA,IAAI,EAAE,WAAW,EAAE,CAAM;IAC7D,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,cAAc,CAAK;IAEpC,SAAS,CAAC,gBAAgB;WAIb,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE;IAOrC,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,eAAe;IAcvB,MAAM;CAgDN"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SettingsDialog.js b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SettingsDialog.js new file mode 100644 index 000000000..e3a7385f2 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SettingsDialog.js @@ -0,0 +1,229 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var SettingsDialog_1; +import { i18n } from "@mariozechner/mini-lit"; +import { Dialog, DialogContent, DialogHeader } from "@mariozechner/mini-lit/dist/Dialog.js"; +import { Input } from "@mariozechner/mini-lit/dist/Input.js"; +import { Label } from "@mariozechner/mini-lit/dist/Label.js"; +import { Switch } from "@mariozechner/mini-lit/dist/Switch.js"; +import { getProviders } from "@mariozechner/pi-ai"; +import { html, LitElement } from "lit"; +import { customElement, property, state } from "lit/decorators.js"; +import "../components/ProviderKeyInput.js"; +import { getAppStorage } from "../storage/app-storage.js"; +// Base class for settings tabs +export class SettingsTab extends LitElement { + createRenderRoot() { + return this; + } +} +// API Keys Tab +let ApiKeysTab = class ApiKeysTab extends SettingsTab { + getTabName() { + return i18n("API Keys"); + } + render() { + const providers = getProviders(); + return html ` +
+

+ ${i18n("Configure API keys for LLM providers. Keys are stored locally in your browser.")} +

+ ${providers.map((provider) => html ``)} +
+ `; + } +}; +ApiKeysTab = __decorate([ + customElement("api-keys-tab") +], ApiKeysTab); +export { ApiKeysTab }; +// Proxy Tab +let ProxyTab = class ProxyTab extends SettingsTab { + constructor() { + super(...arguments); + this.proxyEnabled = false; + this.proxyUrl = "http://localhost:3001"; + } + async connectedCallback() { + super.connectedCallback(); + // Load proxy settings when tab is connected + try { + const storage = getAppStorage(); + const enabled = await storage.settings.get("proxy.enabled"); + const url = await storage.settings.get("proxy.url"); + if (enabled !== null) + this.proxyEnabled = enabled; + if (url !== null) + this.proxyUrl = url; + } + catch (error) { + console.error("Failed to load proxy settings:", error); + } + } + async saveProxySettings() { + try { + const storage = getAppStorage(); + await storage.settings.set("proxy.enabled", this.proxyEnabled); + await storage.settings.set("proxy.url", this.proxyUrl); + } + catch (error) { + console.error("Failed to save proxy settings:", error); + } + } + getTabName() { + return i18n("Proxy"); + } + render() { + return html ` +
+

+ ${i18n("Allows browser-based apps to bypass CORS restrictions when calling LLM providers. Required for Z-AI and Anthropic with OAuth token.")} +

+ +
+ ${i18n("Use CORS Proxy")} + ${Switch({ + checked: this.proxyEnabled, + onChange: (checked) => { + this.proxyEnabled = checked; + this.saveProxySettings(); + }, + })} +
+ +
+ ${Label({ children: i18n("Proxy URL") })} + ${Input({ + type: "text", + value: this.proxyUrl, + disabled: !this.proxyEnabled, + onInput: (e) => { + this.proxyUrl = e.target.value; + }, + onChange: () => this.saveProxySettings(), + })} +

+ ${i18n("Format: The proxy must accept requests as /?url=")} +

+
+
+ `; + } +}; +__decorate([ + state() +], ProxyTab.prototype, "proxyEnabled", void 0); +__decorate([ + state() +], ProxyTab.prototype, "proxyUrl", void 0); +ProxyTab = __decorate([ + customElement("proxy-tab") +], ProxyTab); +export { ProxyTab }; +let SettingsDialog = SettingsDialog_1 = class SettingsDialog extends LitElement { + constructor() { + super(...arguments); + this.tabs = []; + this.isOpen = false; + this.activeTabIndex = 0; + } + createRenderRoot() { + return this; + } + static async open(tabs) { + const dialog = new SettingsDialog_1(); + dialog.tabs = tabs; + dialog.isOpen = true; + document.body.appendChild(dialog); + } + setActiveTab(index) { + this.activeTabIndex = index; + } + renderSidebarItem(tab, index) { + const isActive = this.activeTabIndex === index; + return html ` + + `; + } + renderMobileTab(tab, index) { + const isActive = this.activeTabIndex === index; + return html ` + + `; + } + render() { + if (this.tabs.length === 0) { + return html ``; + } + return Dialog({ + isOpen: this.isOpen, + onClose: () => { + this.isOpen = false; + this.remove(); + }, + width: "min(1000px, 90vw)", + height: "min(800px, 90vh)", + backdropClassName: "bg-black/50 backdrop-blur-sm", + children: html ` + ${DialogContent({ + className: "h-full p-6", + children: html ` +
+ +
${DialogHeader({ title: i18n("Settings") })}
+ + +
+ ${this.tabs.map((tab, index) => this.renderMobileTab(tab, index))} +
+ + +
+ + + + +
+ ${this.tabs.map((tab, index) => html `
${tab}
`)} +
+
+
+ `, + })} + `, + }); + } +}; +__decorate([ + property({ type: Array, attribute: false }) +], SettingsDialog.prototype, "tabs", void 0); +__decorate([ + state() +], SettingsDialog.prototype, "isOpen", void 0); +__decorate([ + state() +], SettingsDialog.prototype, "activeTabIndex", void 0); +SettingsDialog = SettingsDialog_1 = __decorate([ + customElement("settings-dialog") +], SettingsDialog); +export { SettingsDialog }; +//# sourceMappingURL=SettingsDialog.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SettingsDialog.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SettingsDialog.js.map new file mode 100644 index 000000000..c5c89253f --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/dialogs/SettingsDialog.js.map @@ -0,0 +1 @@ +{"version":3,"file":"SettingsDialog.js","sourceRoot":"","sources":["../../src/dialogs/SettingsDialog.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC5F,OAAO,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAC7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G,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;;;;;WAKjE,IAAI,CAAC,IAAI,CAAC,GAAG,CACd,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CACd,IAAI,CAAA,wBAAwB,IAAI,CAAC,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,KAAK,GAAG,QAAQ,CAC7F;;;;MAIJ;aACD,CAAC;IACF;SACD,CAAC,CAAC;IACJ,CAAC;CACD,CAAA;AAjG6C;IAA5C,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CAA0B;AACrD;IAAhB,KAAK,EAAE;8CAAwB;AACf;IAAhB,KAAK,EAAE;sDAA4B;AAHxB,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAkG1B"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/index.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/index.d.ts new file mode 100644 index 000000000..78aef6c02 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/index.d.ts @@ -0,0 +1,68 @@ +export type { AgentState, ThinkingLevel } from "./agent/agent.js"; +export { Agent } from "./agent/agent.js"; +export { AppTransport } from "./agent/transports/AppTransport.js"; +export { ProviderTransport } from "./agent/transports/ProviderTransport.js"; +export type { ProxyAssistantMessageEvent } from "./agent/transports/proxy-types.js"; +export type { AgentRunConfig, AgentTransport } from "./agent/transports/types.js"; +export { ChatPanel } from "./ChatPanel.js"; +export { AgentInterface } from "./components/AgentInterface.js"; +export { AttachmentTile } from "./components/AttachmentTile.js"; +export { ConsoleBlock } from "./components/ConsoleBlock.js"; +export { ExpandableSection } from "./components/ExpandableSection.js"; +export { Input } from "./components/Input.js"; +export { MessageEditor } from "./components/MessageEditor.js"; +export { MessageList } from "./components/MessageList.js"; +export type { AppMessage, CustomMessages, UserMessageWithAttachments } from "./components/Messages.js"; +export { AssistantMessage, ToolMessage, UserMessage } from "./components/Messages.js"; +export { getMessageRenderer, type MessageRenderer, type MessageRole, registerMessageRenderer, renderMessage, } from "./components/message-renderer-registry.js"; +export { type SandboxFile, SandboxIframe, type SandboxResult, type SandboxUrlProvider, } from "./components/SandboxedIframe.js"; +export { StreamingMessageContainer } from "./components/StreamingMessageContainer.js"; +export { ArtifactsRuntimeProvider } from "./components/sandbox/ArtifactsRuntimeProvider.js"; +export { AttachmentsRuntimeProvider } from "./components/sandbox/AttachmentsRuntimeProvider.js"; +export { type ConsoleLog, ConsoleRuntimeProvider } from "./components/sandbox/ConsoleRuntimeProvider.js"; +export { type DownloadableFile, FileDownloadRuntimeProvider, } from "./components/sandbox/FileDownloadRuntimeProvider.js"; +export { RuntimeMessageBridge } from "./components/sandbox/RuntimeMessageBridge.js"; +export { RUNTIME_MESSAGE_ROUTER } from "./components/sandbox/RuntimeMessageRouter.js"; +export type { SandboxRuntimeProvider } from "./components/sandbox/SandboxRuntimeProvider.js"; +export { ThinkingBlock } from "./components/ThinkingBlock.js"; +export { ApiKeyPromptDialog } from "./dialogs/ApiKeyPromptDialog.js"; +export { AttachmentOverlay } from "./dialogs/AttachmentOverlay.js"; +export { ModelSelector } from "./dialogs/ModelSelector.js"; +export { PersistentStorageDialog } from "./dialogs/PersistentStorageDialog.js"; +export { ProvidersModelsTab } from "./dialogs/ProvidersModelsTab.js"; +export { SessionListDialog } from "./dialogs/SessionListDialog.js"; +export { ApiKeysTab, ProxyTab, SettingsDialog, SettingsTab } from "./dialogs/SettingsDialog.js"; +export { ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RO, ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RW, ATTACHMENTS_RUNTIME_DESCRIPTION, } from "./prompts/prompts.js"; +export { AppStorage, getAppStorage, setAppStorage } from "./storage/app-storage.js"; +export { IndexedDBStorageBackend } from "./storage/backends/indexeddb-storage-backend.js"; +export { Store } from "./storage/store.js"; +export type { AutoDiscoveryProviderType, CustomProvider, CustomProviderType, } from "./storage/stores/custom-providers-store.js"; +export { CustomProvidersStore } from "./storage/stores/custom-providers-store.js"; +export { ProviderKeysStore } from "./storage/stores/provider-keys-store.js"; +export { SessionsStore } from "./storage/stores/sessions-store.js"; +export { SettingsStore } from "./storage/stores/settings-store.js"; +export type { IndexConfig, IndexedDBConfig, SessionData, SessionMetadata, StorageBackend, StorageTransaction, StoreConfig, } from "./storage/types.js"; +export { ArtifactElement } from "./tools/artifacts/ArtifactElement.js"; +export { ArtifactPill } from "./tools/artifacts/ArtifactPill.js"; +export { type Artifact, ArtifactsPanel, type ArtifactsParams } from "./tools/artifacts/artifacts.js"; +export { ArtifactsToolRenderer } from "./tools/artifacts/artifacts-tool-renderer.js"; +export { HtmlArtifact } from "./tools/artifacts/HtmlArtifact.js"; +export { ImageArtifact } from "./tools/artifacts/ImageArtifact.js"; +export { MarkdownArtifact } from "./tools/artifacts/MarkdownArtifact.js"; +export { SvgArtifact } from "./tools/artifacts/SvgArtifact.js"; +export { TextArtifact } from "./tools/artifacts/TextArtifact.js"; +export { createExtractDocumentTool, extractDocumentTool } from "./tools/extract-document.js"; +export { getToolRenderer, registerToolRenderer, renderTool, setShowJsonMode } from "./tools/index.js"; +export { createJavaScriptReplTool, javascriptReplTool } from "./tools/javascript-repl.js"; +export { renderCollapsibleHeader, renderHeader } from "./tools/renderer-registry.js"; +export { BashRenderer } from "./tools/renderers/BashRenderer.js"; +export { CalculateRenderer } from "./tools/renderers/CalculateRenderer.js"; +export { DefaultRenderer } from "./tools/renderers/DefaultRenderer.js"; +export { GetCurrentTimeRenderer } from "./tools/renderers/GetCurrentTimeRenderer.js"; +export type { ToolRenderer, ToolRenderResult } from "./tools/types.js"; +export type { Attachment } from "./utils/attachment-utils.js"; +export { loadAttachment } from "./utils/attachment-utils.js"; +export { clearAuthToken, getAuthToken } from "./utils/auth-token.js"; +export { formatCost, formatModelCost, formatTokenCount, formatUsage } from "./utils/format.js"; +export { i18n, setLanguage, translations } from "./utils/i18n.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/index.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/index.d.ts.map new file mode 100644 index 000000000..6698713bb --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAElE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,YAAY,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClF,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,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,UAAU,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACvG,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW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AAe,EAAE,MAAM,kBAAkB,CAAC;AACtG,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;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"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/index.js b/apps/macos/Sources/Clawdis/Resources/WebChat/index.js new file mode 100644 index 000000000..ccd9558b4 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/index.js @@ -0,0 +1,72 @@ +// Main chat interface +// State management +export { Agent } from "./agent/agent.js"; +// Transports +export { AppTransport } from "./agent/transports/AppTransport.js"; +export { ProviderTransport } from "./agent/transports/ProviderTransport.js"; +export { ChatPanel } from "./ChatPanel.js"; +// Components +export { AgentInterface } from "./components/AgentInterface.js"; +export { AttachmentTile } from "./components/AttachmentTile.js"; +export { ConsoleBlock } from "./components/ConsoleBlock.js"; +export { ExpandableSection } from "./components/ExpandableSection.js"; +export { Input } from "./components/Input.js"; +export { MessageEditor } from "./components/MessageEditor.js"; +export { MessageList } from "./components/MessageList.js"; +export { AssistantMessage, ToolMessage, UserMessage } from "./components/Messages.js"; +// Message renderer registry +export { getMessageRenderer, registerMessageRenderer, renderMessage, } from "./components/message-renderer-registry.js"; +export { SandboxIframe, } from "./components/SandboxedIframe.js"; +export { StreamingMessageContainer } from "./components/StreamingMessageContainer.js"; +// Sandbox Runtime Providers +export { ArtifactsRuntimeProvider } from "./components/sandbox/ArtifactsRuntimeProvider.js"; +export { AttachmentsRuntimeProvider } from "./components/sandbox/AttachmentsRuntimeProvider.js"; +export { ConsoleRuntimeProvider } from "./components/sandbox/ConsoleRuntimeProvider.js"; +export { FileDownloadRuntimeProvider, } from "./components/sandbox/FileDownloadRuntimeProvider.js"; +export { RuntimeMessageBridge } from "./components/sandbox/RuntimeMessageBridge.js"; +export { RUNTIME_MESSAGE_ROUTER } from "./components/sandbox/RuntimeMessageRouter.js"; +export { ThinkingBlock } from "./components/ThinkingBlock.js"; +export { ApiKeyPromptDialog } from "./dialogs/ApiKeyPromptDialog.js"; +export { AttachmentOverlay } from "./dialogs/AttachmentOverlay.js"; +// Dialogs +export { ModelSelector } from "./dialogs/ModelSelector.js"; +export { PersistentStorageDialog } from "./dialogs/PersistentStorageDialog.js"; +export { ProvidersModelsTab } from "./dialogs/ProvidersModelsTab.js"; +export { SessionListDialog } from "./dialogs/SessionListDialog.js"; +export { ApiKeysTab, ProxyTab, SettingsDialog, SettingsTab } from "./dialogs/SettingsDialog.js"; +// Prompts +export { ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RO, ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RW, ATTACHMENTS_RUNTIME_DESCRIPTION, } from "./prompts/prompts.js"; +// Storage +export { AppStorage, getAppStorage, setAppStorage } from "./storage/app-storage.js"; +export { IndexedDBStorageBackend } from "./storage/backends/indexeddb-storage-backend.js"; +export { Store } from "./storage/store.js"; +export { CustomProvidersStore } from "./storage/stores/custom-providers-store.js"; +export { ProviderKeysStore } from "./storage/stores/provider-keys-store.js"; +export { SessionsStore } from "./storage/stores/sessions-store.js"; +export { SettingsStore } from "./storage/stores/settings-store.js"; +// Artifacts +export { ArtifactElement } from "./tools/artifacts/ArtifactElement.js"; +export { ArtifactPill } from "./tools/artifacts/ArtifactPill.js"; +export { ArtifactsPanel } from "./tools/artifacts/artifacts.js"; +export { ArtifactsToolRenderer } from "./tools/artifacts/artifacts-tool-renderer.js"; +export { HtmlArtifact } from "./tools/artifacts/HtmlArtifact.js"; +export { ImageArtifact } from "./tools/artifacts/ImageArtifact.js"; +export { MarkdownArtifact } from "./tools/artifacts/MarkdownArtifact.js"; +export { SvgArtifact } from "./tools/artifacts/SvgArtifact.js"; +export { TextArtifact } from "./tools/artifacts/TextArtifact.js"; +export { createExtractDocumentTool, extractDocumentTool } from "./tools/extract-document.js"; +// Tools +export { getToolRenderer, registerToolRenderer, renderTool, setShowJsonMode } from "./tools/index.js"; +export { createJavaScriptReplTool, javascriptReplTool } from "./tools/javascript-repl.js"; +export { renderCollapsibleHeader, renderHeader } from "./tools/renderer-registry.js"; +export { BashRenderer } from "./tools/renderers/BashRenderer.js"; +export { CalculateRenderer } from "./tools/renderers/CalculateRenderer.js"; +// Tool renderers +export { DefaultRenderer } from "./tools/renderers/DefaultRenderer.js"; +export { GetCurrentTimeRenderer } from "./tools/renderers/GetCurrentTimeRenderer.js"; +// Utils +export { loadAttachment } from "./utils/attachment-utils.js"; +export { clearAuthToken, getAuthToken } from "./utils/auth-token.js"; +export { formatCost, formatModelCost, formatTokenCount, formatUsage } from "./utils/format.js"; +export { i18n, setLanguage, translations } from "./utils/i18n.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/index.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/index.js.map new file mode 100644 index 000000000..a255f17b3 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/index.js.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EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAC7F,QAAQ;AACR,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACtG,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;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;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"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/prompts/prompts.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/prompts/prompts.d.ts new file mode 100644 index 000000000..07c4790db --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/prompts/prompts.d.ts @@ -0,0 +1,11 @@ +/** + * Centralized tool prompts/descriptions. + * Each prompt is either a string constant or a template function. + */ +export declare const JAVASCRIPT_REPL_TOOL_DESCRIPTION: (runtimeProviderDescriptions: string[]) => string; +export declare const ARTIFACTS_TOOL_DESCRIPTION: (runtimeProviderDescriptions: string[]) => string; +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\n- getArtifact(filename) - Read artifact content, returns Promise. JSON files auto-parse to objects, binary files return base64 string\n- createOrUpdateArtifact(filename, content, mimeType?) - Create or update artifact, returns Promise. JSON files auto-stringify objects, binary requires base64 string with mimeType\n- deleteArtifact(filename) - Delete artifact, returns Promise\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"; +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\n- getArtifact(filename) - Read artifact content, returns Promise. 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 => `
${p.name}: $${p.price}
`).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"; +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"; +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."; +//# sourceMappingURL=prompts.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/prompts/prompts.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/prompts/prompts.d.ts.map new file mode 100644 index 000000000..41b6667fe --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/prompts/prompts.d.ts.map @@ -0,0 +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"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/prompts/prompts.js b/apps/macos/Sources/Clawdis/Resources/WebChat/prompts/prompts.js new file mode 100644 index 000000000..7cdfc67b1 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/prompts/prompts.js @@ -0,0 +1,272 @@ +/** + * Centralized tool prompts/descriptions. + * Each prompt is either a string constant or a template function. + */ +// ============================================================================ +// JavaScript REPL Tool +// ============================================================================ +export const JAVASCRIPT_REPL_TOOL_DESCRIPTION = (runtimeProviderDescriptions) => `# JavaScript REPL + +## Purpose +Execute JavaScript code in a sandboxed browser environment with full Web APIs. + +## When to Use +- Quick calculations or data transformations +- Testing JavaScript code snippets in isolation +- Processing data with libraries (XLSX, CSV, etc.) +- Creating artifacts from data + +## Environment +- ES2023+ JavaScript (async/await, optional chaining, nullish coalescing, etc.) +- All browser APIs: DOM, Canvas, WebGL, Fetch, Web Workers, WebSockets, Crypto, etc. +- Import any npm package: await import('https://esm.run/package-name') + +## Common Libraries +- XLSX: const XLSX = await import('https://esm.run/xlsx'); +- CSV: const Papa = (await import('https://esm.run/papaparse')).default; +- Chart.js: const Chart = (await import('https://esm.run/chart.js/auto')).default; +- Three.js: const THREE = await import('https://esm.run/three'); + +## Persistence between tool calls +- Objects stored on global scope do not persist between calls. +- Use artifacts as a key-value JSON object store: + - Use createOrUpdateArtifact(filename, content) to persist data between calls. JSON objects are auto-stringified. + - Use listArtifacts() and getArtifact(filename) to read persisted data. JSON files are auto-parsed to objects. + - Prefer to use a single artifact throughout the session to store intermediate data (e.g. 'data.json'). + +## Input +- You have access to the user's attachments via listAttachments(), readTextAttachment(id), and readBinaryAttachment(id) +- You have access to previously created artifacts via listArtifacts() and getArtifact(filename) + +## Output +- All console.log() calls are captured for you to inspect. The user does not see these logs. +- Create artifacts for file results (images, JSON, CSV, etc.) which persiste throughout the + session and are accessible to you and the user. + +## Example +const data = [10, 20, 15, 25]; +const sum = data.reduce((a, b) => a + b, 0); +const avg = sum / data.length; +console.log('Sum:', sum, 'Average:', avg); + +## Important Notes +- Graphics: Use fixed dimensions (800x600), NOT window.innerWidth/Height +- Chart.js: Set options: { responsive: false, animation: false } +- Three.js: renderer.setSize(800, 600) with matching aspect ratio + +## Helper Functions (Automatically Available) + +These functions are injected into the execution environment and available globally: + +${runtimeProviderDescriptions.join("\n\n")} +`; +// ============================================================================ +// Artifacts Tool +// ============================================================================ +export const ARTIFACTS_TOOL_DESCRIPTION = (runtimeProviderDescriptions) => `# Artifacts + +Create and manage persistent files that live alongside the conversation. + +## When to Use - Artifacts Tool vs REPL + +**Use artifacts tool when YOU are the author:** +- Writing research summaries, analysis, ideas, documentation +- Creating markdown notes for user to read +- Building HTML applications/visualizations that present data +- Creating HTML artifacts that render charts from programmatically generated data + +**Use repl + artifact storage functions when CODE processes data:** +- Scraping workflows that extract and store data +- Processing CSV/Excel files programmatically +- Data transformation pipelines +- Binary file generation requiring libraries (PDF, DOCX) + +**Pattern: REPL generates data → Artifacts tool creates HTML that visualizes it** +Example: repl scrapes products → stores products.json → you author dashboard.html that reads products.json and renders Chart.js visualizations + +## Input +- { action: "create", filename: "notes.md", content: "..." } - Create new file +- { action: "update", filename: "notes.md", old_str: "...", new_str: "..." } - Update part of file (PREFERRED) +- { action: "rewrite", filename: "notes.md", content: "..." } - Replace entire file (LAST RESORT) +- { action: "get", filename: "data.json" } - Retrieve file content +- { action: "delete", filename: "old.csv" } - Delete file +- { action: "htmlArtifactLogs", filename: "app.html" } - Get console logs from HTML artifact + +## Returns +Depends on action: +- create/update/rewrite/delete: Success status or error +- get: File content +- htmlArtifactLogs: Console logs and errors + +## Supported File Types +✅ Text-based files you author: .md, .txt, .html, .js, .css, .json, .csv, .svg +❌ Binary files requiring libraries (use repl): .pdf, .docx + +## Critical - Prefer Update Over Rewrite +❌ NEVER: get entire file + rewrite to change small sections +✅ ALWAYS: update for targeted edits (token efficient) +✅ Ask: Can I describe the change as old_str → new_str? Use update. + +--- + +## HTML Artifacts + +Interactive HTML applications that can visualize data from other artifacts. + +### Data Access +- Can read artifacts created by repl and user attachments +- Use to build dashboards, visualizations, interactive tools +- See Helper Functions section below for available functions + +### Requirements +- Self-contained single file +- Import ES modules from esm.sh: +- Use Tailwind CDN: +- Can embed images from any domain: +- MUST set background color explicitly (avoid transparent) +- Inline CSS or Tailwind utility classes +- No localStorage/sessionStorage + +### Styling +- Use Tailwind utility classes for clean, functional designs +- Ensure responsive layout (iframe may be resized) +- Avoid purple gradients, AI aesthetic clichés, and emojis + +### Helper Functions (Automatically Available) + +These functions are injected into HTML artifact sandbox: + +${runtimeProviderDescriptions.join("\n\n")} +`; +// ============================================================================ +// Artifacts Runtime Provider +// ============================================================================ +export const ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RW = ` +### Artifacts Storage + +Create, read, update, and delete files in artifacts storage. + +#### When to Use +- Store intermediate results between tool calls +- Save generated files (images, CSVs, processed data) for user to view and download + +#### Do NOT Use For +- Content you author directly, like summaries of content you read (use artifacts tool instead) + +#### Functions +- listArtifacts() - List all artifact filenames, returns Promise +- getArtifact(filename) - Read artifact content, returns Promise. JSON files auto-parse to objects, binary files return base64 string +- createOrUpdateArtifact(filename, content, mimeType?) - Create or update artifact, returns Promise. JSON files auto-stringify objects, binary requires base64 string with mimeType +- deleteArtifact(filename) - Delete artifact, returns Promise + +#### Example +JSON workflow: +\`\`\`javascript +// Fetch and save +const response = await fetch('https://api.example.com/products'); +const products = await response.json(); +await createOrUpdateArtifact('products.json', products); + +// Later: read and filter +const all = await getArtifact('products.json'); +const cheap = all.filter(p => p.price < 100); +await createOrUpdateArtifact('cheap.json', cheap); +\`\`\` + +Binary file (image): +\`\`\`javascript +const canvas = document.createElement('canvas'); +canvas.width = 800; canvas.height = 600; +const ctx = canvas.getContext('2d'); +ctx.fillStyle = 'blue'; +ctx.fillRect(0, 0, 800, 600); +// Remove data:image/png;base64, prefix +const base64 = canvas.toDataURL().split(',')[1]; +await createOrUpdateArtifact('chart.png', base64, 'image/png'); +\`\`\` +`; +export const ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RO = ` +### Artifacts Storage + +Read files from artifacts storage. + +#### When to Use +- Read artifacts created by REPL or artifacts tool +- Access data from other HTML artifacts +- Load configuration or data files + +#### Do NOT Use For +- Creating new artifacts (not available in HTML artifacts) +- Modifying artifacts (read-only access) + +#### Functions +- listArtifacts() - List all artifact filenames, returns Promise +- getArtifact(filename) - Read artifact content, returns Promise. JSON files auto-parse to objects, binary files return base64 string + +#### Example +JSON data: +\`\`\`javascript +const products = await getArtifact('products.json'); +const html = products.map(p => \`
\${p.name}: $\${p.price}
\`).join(''); +document.body.innerHTML = html; +\`\`\` + +Binary image: +\`\`\`javascript +const base64 = await getArtifact('chart.png'); +const img = document.createElement('img'); +img.src = 'data:image/png;base64,' + base64; +document.body.appendChild(img); +\`\`\` +`; +// ============================================================================ +// Attachments Runtime Provider +// ============================================================================ +export const ATTACHMENTS_RUNTIME_DESCRIPTION = ` +### User Attachments + +Read files the user uploaded to the conversation. + +#### When to Use +- Process user-uploaded files (CSV, JSON, Excel, images, PDFs) + +#### Functions +- listAttachments() - List all attachments, returns array of {id, fileName, mimeType, size} +- readTextAttachment(id) - Read attachment as text, returns string +- readBinaryAttachment(id) - Read attachment as binary data, returns Uint8Array + +#### Example +CSV file: +\`\`\`javascript +const files = listAttachments(); +const csvFile = files.find(f => f.fileName.endsWith('.csv')); +const csvData = readTextAttachment(csvFile.id); +const rows = csvData.split('\\n').map(row => row.split(',')); +\`\`\` + +Excel file: +\`\`\`javascript +const XLSX = await import('https://esm.run/xlsx'); +const files = listAttachments(); +const xlsxFile = files.find(f => f.fileName.endsWith('.xlsx')); +const bytes = readBinaryAttachment(xlsxFile.id); +const workbook = XLSX.read(bytes); +const data = XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]]); +\`\`\` +`; +// ============================================================================ +// Extract Document Tool +// ============================================================================ +export const EXTRACT_DOCUMENT_DESCRIPTION = `# Extract Document + +Extract plain text from documents on the web (PDF, DOCX, XLSX, PPTX). + +## When to Use +User wants you to read a document at a URL. + +## Input +- { url: "https://example.com/document.pdf" } - URL to PDF, DOCX, XLSX, or PPTX + +## Returns +Structured plain text with page/sheet/slide delimiters.`; +//# sourceMappingURL=prompts.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/prompts/prompts.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/prompts/prompts.js.map new file mode 100644 index 000000000..e9c4fc29b --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/prompts/prompts.js.map @@ -0,0 +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"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/app-storage.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/app-storage.d.ts new file mode 100644 index 000000000..8c75cf80a --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/app-storage.d.ts @@ -0,0 +1,33 @@ +import type { CustomProvidersStore } from "./stores/custom-providers-store.js"; +import type { ProviderKeysStore } from "./stores/provider-keys-store.js"; +import type { SessionsStore } from "./stores/sessions-store.js"; +import type { SettingsStore } from "./stores/settings-store.js"; +import type { StorageBackend } from "./types.js"; +/** + * High-level storage API providing access to all storage operations. + * Subclasses can extend this to add domain-specific stores. + */ +export declare class AppStorage { + readonly backend: StorageBackend; + readonly settings: SettingsStore; + readonly providerKeys: ProviderKeysStore; + readonly sessions: SessionsStore; + readonly customProviders: CustomProvidersStore; + constructor(settings: SettingsStore, providerKeys: ProviderKeysStore, sessions: SessionsStore, customProviders: CustomProvidersStore, backend: StorageBackend); + getQuotaInfo(): Promise<{ + usage: number; + quota: number; + percent: number; + }>; + requestPersistence(): Promise; +} +/** + * Get the global AppStorage instance. + * Throws if not initialized. + */ +export declare function getAppStorage(): AppStorage; +/** + * Set the global AppStorage instance. + */ +export declare function setAppStorage(storage: AppStorage): void; +//# sourceMappingURL=app-storage.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/app-storage.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/app-storage.d.ts.map new file mode 100644 index 000000000..39ca8f0f1 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/app-storage.d.ts.map @@ -0,0 +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"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/app-storage.js b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/app-storage.js new file mode 100644 index 000000000..6b95ee280 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/app-storage.js @@ -0,0 +1,38 @@ +/** + * High-level storage API providing access to all storage operations. + * Subclasses can extend this to add domain-specific stores. + */ +export class AppStorage { + constructor(settings, providerKeys, sessions, customProviders, backend) { + this.settings = settings; + this.providerKeys = providerKeys; + this.sessions = sessions; + this.customProviders = customProviders; + this.backend = backend; + } + async getQuotaInfo() { + return this.backend.getQuotaInfo(); + } + async requestPersistence() { + return this.backend.requestPersistence(); + } +} +// Global instance management +let globalAppStorage = null; +/** + * Get the global AppStorage instance. + * Throws if not initialized. + */ +export function getAppStorage() { + if (!globalAppStorage) { + throw new Error("AppStorage not initialized. Call setAppStorage() first."); + } + return globalAppStorage; +} +/** + * Set the global AppStorage instance. + */ +export function setAppStorage(storage) { + globalAppStorage = storage; +} +//# sourceMappingURL=app-storage.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/app-storage.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/app-storage.js.map new file mode 100644 index 000000000..52976f676 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/app-storage.js.map @@ -0,0 +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"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/backends/indexeddb-storage-backend.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/backends/indexeddb-storage-backend.d.ts new file mode 100644 index 000000000..550c9e389 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/backends/indexeddb-storage-backend.d.ts @@ -0,0 +1,27 @@ +import type { IndexedDBConfig, StorageBackend, StorageTransaction } from "../types.js"; +/** + * IndexedDB implementation of StorageBackend. + * Provides multi-store key-value storage with transactions and quota management. + */ +export declare class IndexedDBStorageBackend implements StorageBackend { + private config; + private dbPromise; + constructor(config: IndexedDBConfig); + private getDB; + private promisifyRequest; + get(storeName: string, key: string): Promise; + set(storeName: string, key: string, value: T): Promise; + delete(storeName: string, key: string): Promise; + keys(storeName: string, prefix?: string): Promise; + getAllFromIndex(storeName: string, indexName: string, direction?: "asc" | "desc"): Promise; + clear(storeName: string): Promise; + has(storeName: string, key: string): Promise; + transaction(storeNames: string[], mode: "readonly" | "readwrite", operation: (tx: StorageTransaction) => Promise): Promise; + getQuotaInfo(): Promise<{ + usage: number; + quota: number; + percent: number; + }>; + requestPersistence(): Promise; +} +//# sourceMappingURL=indexeddb-storage-backend.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/backends/indexeddb-storage-backend.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/backends/indexeddb-storage-backend.d.ts.map new file mode 100644 index 000000000..1993c9b2c --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/backends/indexeddb-storage-backend.d.ts.map @@ -0,0 +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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is/Resources/WebChat/storage/backends/indexeddb-storage-backend.js new file mode 100644 index 000000000..f808f2097 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/backends/indexeddb-storage-backend.js @@ -0,0 +1,166 @@ +/** + * IndexedDB implementation of StorageBackend. + * Provides multi-store key-value storage with transactions and quota management. + */ +export class IndexedDBStorageBackend { + constructor(config) { + this.config = config; + this.dbPromise = null; + } + async getDB() { + if (!this.dbPromise) { + this.dbPromise = new Promise((resolve, reject) => { + const request = indexedDB.open(this.config.dbName, this.config.version); + request.onerror = () => reject(request.error); + request.onsuccess = () => resolve(request.result); + request.onupgradeneeded = (_event) => { + const db = request.result; + // Create object stores from config + for (const storeConfig of this.config.stores) { + if (!db.objectStoreNames.contains(storeConfig.name)) { + const store = db.createObjectStore(storeConfig.name, { + keyPath: storeConfig.keyPath, + autoIncrement: storeConfig.autoIncrement, + }); + // Create indices + if (storeConfig.indices) { + for (const indexConfig of storeConfig.indices) { + store.createIndex(indexConfig.name, indexConfig.keyPath, { + unique: indexConfig.unique, + }); + } + } + } + } + }; + }); + } + return this.dbPromise; + } + promisifyRequest(request) { + return new Promise((resolve, reject) => { + request.onsuccess = () => resolve(request.result); + request.onerror = () => reject(request.error); + }); + } + async get(storeName, key) { + const db = await this.getDB(); + const tx = db.transaction(storeName, "readonly"); + const store = tx.objectStore(storeName); + const result = await this.promisifyRequest(store.get(key)); + return result ?? null; + } + async set(storeName, key, value) { + const db = await this.getDB(); + const tx = db.transaction(storeName, "readwrite"); + const store = tx.objectStore(storeName); + // If store has keyPath, only pass value (in-line key) + // Otherwise pass both value and key (out-of-line key) + if (store.keyPath) { + await this.promisifyRequest(store.put(value)); + } + else { + await this.promisifyRequest(store.put(value, key)); + } + } + async delete(storeName, key) { + const db = await this.getDB(); + const tx = db.transaction(storeName, "readwrite"); + const store = tx.objectStore(storeName); + await this.promisifyRequest(store.delete(key)); + } + async keys(storeName, prefix) { + const db = await this.getDB(); + const tx = db.transaction(storeName, "readonly"); + const store = tx.objectStore(storeName); + if (prefix) { + // Use IDBKeyRange for efficient prefix filtering + const range = IDBKeyRange.bound(prefix, prefix + "\uffff", false, false); + const keys = await this.promisifyRequest(store.getAllKeys(range)); + return keys.map((k) => String(k)); + } + else { + const keys = await this.promisifyRequest(store.getAllKeys()); + return keys.map((k) => String(k)); + } + } + async getAllFromIndex(storeName, indexName, direction = "asc") { + const db = await this.getDB(); + const tx = db.transaction(storeName, "readonly"); + const store = tx.objectStore(storeName); + const index = store.index(indexName); + return new Promise((resolve, reject) => { + const results = []; + const request = index.openCursor(null, direction === "desc" ? "prev" : "next"); + request.onsuccess = () => { + const cursor = request.result; + if (cursor) { + results.push(cursor.value); + cursor.continue(); + } + else { + resolve(results); + } + }; + request.onerror = () => reject(request.error); + }); + } + async clear(storeName) { + const db = await this.getDB(); + const tx = db.transaction(storeName, "readwrite"); + const store = tx.objectStore(storeName); + await this.promisifyRequest(store.clear()); + } + async has(storeName, key) { + const db = await this.getDB(); + const tx = db.transaction(storeName, "readonly"); + const store = tx.objectStore(storeName); + const result = await this.promisifyRequest(store.getKey(key)); + return result !== undefined; + } + async transaction(storeNames, mode, operation) { + const db = await this.getDB(); + const idbTx = db.transaction(storeNames, mode); + const storageTx = { + get: async (storeName, key) => { + const store = idbTx.objectStore(storeName); + const result = await this.promisifyRequest(store.get(key)); + return (result ?? null); + }, + set: async (storeName, key, value) => { + const store = idbTx.objectStore(storeName); + // If store has keyPath, only pass value (in-line key) + // Otherwise pass both value and key (out-of-line key) + if (store.keyPath) { + await this.promisifyRequest(store.put(value)); + } + else { + await this.promisifyRequest(store.put(value, key)); + } + }, + delete: async (storeName, key) => { + const store = idbTx.objectStore(storeName); + await this.promisifyRequest(store.delete(key)); + }, + }; + return operation(storageTx); + } + async getQuotaInfo() { + if (navigator.storage?.estimate) { + const estimate = await navigator.storage.estimate(); + return { + usage: estimate.usage || 0, + quota: estimate.quota || 0, + percent: estimate.quota ? ((estimate.usage || 0) / estimate.quota) * 100 : 0, + }; + } + return { usage: 0, quota: 0, percent: 0 }; + } + async requestPersistence() { + if (navigator.storage?.persist) { + return await navigator.storage.persist(); + } + return false; + } +} +//# sourceMappingURL=indexeddb-storage-backend.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/backends/indexeddb-storage-backend.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/backends/indexeddb-storage-backend.js.map new file mode 100644 index 000000000..0357b58fb --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/backends/indexeddb-storage-backend.js.map @@ -0,0 +1 @@ +{"version":3,"file":"indexeddb-storage-backend.js","sourceRoot":"","sources":["../../../src/storage/backends/indexeddb-storage-backend.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,uBAAuB;IAGnC,YAAoB,MAAuB;QAAvB,WAAM,GAAN,MAAM,CAAiB;QAFnC,cAAS,GAAgC,IAAI,CAAC;IAER,CAAC;IAEvC,KAAK,CAAC,KAAK;QAClB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACrB,IAAI,CAAC,SAAS,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBAChD,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBAExE,OAAO,CAAC,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBAC9C,OAAO,CAAC,SAAS,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBAElD,OAAO,CAAC,eAAe,GAAG,CAAC,MAAM,EAAE,EAAE;oBACpC,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;oBAE1B,mCAAmC;oBACnC,KAAK,MAAM,WAAW,IAAI,IAAI,CA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AC,GAAG,CAAC,CAAC,CAAC;YAChD,CAAC;SACD,CAAC;QAEF,OAAO,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,YAAY;QACjB,IAAI,SAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC;YACjC,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YACpD,OAAO;gBACN,KAAK,EAAE,QAAQ,CAAC,KAAK,IAAI,CAAC;gBAC1B,KAAK,EAAE,QAAQ,CAAC,KAAK,IAAI,CAAC;gBAC1B,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;aAC5E,CAAC;QACH,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,kBAAkB;QACvB,IAAI,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;YAChC,OAAO,MAAM,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QAC1C,CAAC;QACD,OAAO,KAAK,CAAC;IACd,CAAC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/store.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/store.d.ts new file mode 100644 index 000000000..4009fb1fb --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/store.d.ts @@ -0,0 +1,23 @@ +import type { StorageBackend, StoreConfig } from "./types.js"; +/** + * Base class for all storage stores. + * Each store defines its IndexedDB schema and provides domain-specific methods. + */ +export declare abstract class Store { + private backend; + /** + * Returns the IndexedDB configuration for this store. + * Defines store name, key path, and indices. + */ + abstract getConfig(): StoreConfig; + /** + * Sets the storage backend. Called by AppStorage after backend creation. + */ + setBackend(backend: StorageBackend): void; + /** + * Gets the storage backend. Throws if backend not set. + * Concrete stores must use this to access the backend. + */ + protected getBackend(): StorageBackend; +} +//# sourceMappingURL=store.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/store.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/store.d.ts.map new file mode 100644 index 000000000..d64ac59db --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/store.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/storage/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D;;;GAGG;AACH,8BAAsB,KAAK;IAC1B,OAAO,CAAC,OAAO,CAA+B;IAE9C;;;OAGG;IACH,QAAQ,CAAC,SAAS,IAAI,WAAW;IAEjC;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAIzC;;;OAGG;IACH,SAAS,CAAC,UAAU,IAAI,cAAc;CAMtC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/store.js b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/store.js new file mode 100644 index 000000000..53a84fcab --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/store.js @@ -0,0 +1,26 @@ +/** + * Base class for all storage stores. + * Each store defines its IndexedDB schema and provides domain-specific methods. + */ +export class Store { + constructor() { + this.backend = null; + } + /** + * Sets the storage backend. Called by AppStorage after backend creation. + */ + setBackend(backend) { + this.backend = backend; + } + /** + * Gets the storage backend. Throws if backend not set. + * Concrete stores must use this to access the backend. + */ + getBackend() { + if (!this.backend) { + throw new Error(`Backend not set on ${this.constructor.name}`); + } + return this.backend; + } +} +//# sourceMappingURL=store.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/store.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/store.js.map new file mode 100644 index 000000000..f616314d5 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/store.js.map @@ -0,0 +1 @@ +{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/storage/store.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAgB,KAAK;IAA3B;QACS,YAAO,GAA0B,IAAI,CAAC;IAyB/C,CAAC;IAjBA;;OAEG;IACH,UAAU,CAAC,OAAuB;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;IAED;;;OAGG;IACO,UAAU;QACnB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,sBAAsB,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/custom-providers-store.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/custom-providers-store.d.ts new file mode 100644 index 000000000..8279d1f5d --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/custom-providers-store.d.ts @@ -0,0 +1,25 @@ +import type { Model } from "@mariozechner/pi-ai"; +import { Store } from "../store.js"; +import type { StoreConfig } from "../types.js"; +export type AutoDiscoveryProviderType = "ollama" | "llama.cpp" | "vllm" | "lmstudio"; +export type CustomProviderType = AutoDiscoveryProviderType | "openai-completions" | "openai-responses" | "anthropic-messages"; +export interface CustomProvider { + id: string; + name: string; + type: CustomProviderType; + baseUrl: string; + apiKey?: string; + models?: Model[]; +} +/** + * Store for custom LLM providers (auto-discovery servers + manual providers). + */ +export declare class CustomProvidersStore extends Store { + getConfig(): StoreConfig; + get(id: string): Promise; + set(provider: CustomProvider): Promise; + delete(id: string): Promise; + getAll(): Promise; + has(id: string): Promise; +} +//# sourceMappingURL=custom-providers-store.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/custom-providers-store.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/custom-providers-store.d.ts.map new file mode 100644 index 000000000..ebef65f06 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/custom-providers-store.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"custom-providers-store.d.ts","sourceRoot":"","sources":["../../../src/storage/stores/custom-providers-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,MAAM,yBAAyB,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,GAAG,UAAU,CAAC;AAErF,MAAM,MAAM,kBAAkB,GAC3B,yBAAyB,GACzB,oBAAoB,GACpB,kBAAkB,GAClB,oBAAoB,CAAC;AAExB,MAAM,WAAW,cAAc;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAIhB,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC9C,SAAS,IAAI,WAAW;IAMlB,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAI/C,GAAG,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5C,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjC,MAAM,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAYnC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAGvC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/custom-providers-store.js b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/custom-providers-store.js new file mode 100644 index 000000000..51c2ff90d --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/custom-providers-store.js @@ -0,0 +1,35 @@ +import { Store } from "../store.js"; +/** + * Store for custom LLM providers (auto-discovery servers + manual providers). + */ +export class CustomProvidersStore extends Store { + getConfig() { + return { + name: "custom-providers", + }; + } + async get(id) { + return this.getBackend().get("custom-providers", id); + } + async set(provider) { + await this.getBackend().set("custom-providers", provider.id, provider); + } + async delete(id) { + await this.getBackend().delete("custom-providers", id); + } + async getAll() { + const keys = await this.getBackend().keys("custom-providers"); + const providers = []; + for (const key of keys) { + const provider = await this.get(key); + if (provider) { + providers.push(provider); + } + } + return providers; + } + async has(id) { + return this.getBackend().has("custom-providers", id); + } +} +//# sourceMappingURL=custom-providers-store.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/custom-providers-store.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/custom-providers-store.js.map new file mode 100644 index 000000000..d75fee74a --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/custom-providers-store.js.map @@ -0,0 +1 @@ +{"version":3,"file":"custom-providers-store.js","sourceRoot":"","sources":["../../../src/storage/stores/custom-providers-store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAuBpC;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC9C,SAAS;QACR,OAAO;YACN,IAAI,EAAE,kBAAkB;SACxB,CAAC;IACH,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,EAAU;QACnB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,QAAwB;QACjC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,kBAAkB,EAAE,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU;QACtB,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,MAAM;QACX,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC9D,MAAM,SAAS,GAAqB,EAAE,CAAC;QACvC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACxB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACrC,IAAI,QAAQ,EAAE,CAAC;gBACd,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC1B,CAAC;QACF,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,EAAU;QACnB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;IACtD,CAAC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/provider-keys-store.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/provider-keys-store.d.ts new file mode 100644 index 000000000..d82198370 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/provider-keys-store.d.ts @@ -0,0 +1,14 @@ +import { Store } from "../store.js"; +import type { StoreConfig } from "../types.js"; +/** + * Store for LLM provider API keys (Anthropic, OpenAI, etc.). + */ +export declare class ProviderKeysStore extends Store { + getConfig(): StoreConfig; + get(provider: string): Promise; + set(provider: string, key: string): Promise; + delete(provider: string): Promise; + list(): Promise; + has(provider: string): Promise; +} +//# sourceMappingURL=provider-keys-store.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/provider-keys-store.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/provider-keys-store.d.ts.map new file mode 100644 index 000000000..0fb3e2834 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/provider-keys-store.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-keys-store.d.ts","sourceRoot":"","sources":["../../../src/storage/stores/provider-keys-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC3C,SAAS,IAAI,WAAW;IAMlB,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAI7C,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjD,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAIzB,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAG7C"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/provider-keys-store.js b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/provider-keys-store.js new file mode 100644 index 000000000..96eff5e95 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/provider-keys-store.js @@ -0,0 +1,27 @@ +import { Store } from "../store.js"; +/** + * Store for LLM provider API keys (Anthropic, OpenAI, etc.). + */ +export class ProviderKeysStore extends Store { + getConfig() { + return { + name: "provider-keys", + }; + } + async get(provider) { + return this.getBackend().get("provider-keys", provider); + } + async set(provider, key) { + await this.getBackend().set("provider-keys", provider, key); + } + async delete(provider) { + await this.getBackend().delete("provider-keys", provider); + } + async list() { + return this.getBackend().keys("provider-keys"); + } + async has(provider) { + return this.getBackend().has("provider-keys", provider); + } +} +//# sourceMappingURL=provider-keys-store.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/provider-keys-store.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/provider-keys-store.js.map new file mode 100644 index 000000000..7ce0f66c9 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/provider-keys-store.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-keys-store.js","sourceRoot":"","sources":["../../../src/storage/stores/provider-keys-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC3C,SAAS;QACR,OAAO;YACN,IAAI,EAAE,eAAe;SACrB,CAAC;IACH,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,QAAgB;QACzB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,QAAgB,EAAE,GAAW;QACtC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,eAAe,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,QAAgB;QAC5B,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,IAAI;QACT,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,QAAgB;QACzB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;IACzD,CAAC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/sessions-store.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/sessions-store.d.ts new file mode 100644 index 000000000..8a566c060 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/sessions-store.d.ts @@ -0,0 +1,32 @@ +import type { AgentState } from "../../agent/agent.js"; +import { Store } from "../store.js"; +import type { SessionData, SessionMetadata, StoreConfig } from "../types.js"; +/** + * Store for chat sessions (data and metadata). + * Uses two object stores: sessions (full data) and sessions-metadata (lightweight). + */ +export declare class SessionsStore extends Store { + getConfig(): StoreConfig; + /** + * Additional config for sessions-metadata store. + * Must be included when creating the backend. + */ + static getMetadataConfig(): StoreConfig; + save(data: SessionData, metadata: SessionMetadata): Promise; + get(id: string): Promise; + getMetadata(id: string): Promise; + getAllMetadata(): Promise; + delete(id: string): Promise; + deleteSession(id: string): Promise; + updateTitle(id: string, title: string): Promise; + getQuotaInfo(): Promise<{ + usage: number; + quota: number; + percent: number; + }>; + requestPersistence(): Promise; + saveSession(id: string, state: AgentState, metadata: SessionMetadata | undefined, title?: string): Promise; + loadSession(id: string): Promise; + getLatestSessionId(): Promise; +} +//# sourceMappingURL=sessions-store.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/sessions-store.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/sessions-store.d.ts.map new file mode 100644 index 000000000..8951ca012 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/sessions-store.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sessions-store.d.ts","sourceRoot":"","sources":["../../../src/storage/stores/sessions-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE7E;;;GAGG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACvC,SAAS,IAAI,WAAW;IAQxB;;;OAGG;IACH,MAAM,CAAC,iBAAiB,IAAI,WAAW;IAQjC,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAOjE,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAI5C,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAIxD,cAAc,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IAK5C,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQjC,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxC,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAerD,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;IAKtC,WAAW,CAChB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,eAAe,GAAG,SAAS,EACrC,KAAK,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC;IAgCV,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAIpD,kBAAkB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAQlD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/sessions-store.js b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/sessions-store.js new file mode 100644 index 000000000..df0121c6f --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/sessions-store.js @@ -0,0 +1,112 @@ +import { Store } from "../store.js"; +/** + * Store for chat sessions (data and metadata). + * Uses two object stores: sessions (full data) and sessions-metadata (lightweight). + */ +export class SessionsStore extends Store { + getConfig() { + return { + name: "sessions", + keyPath: "id", + indices: [{ name: "lastModified", keyPath: "lastModified" }], + }; + } + /** + * Additional config for sessions-metadata store. + * Must be included when creating the backend. + */ + static getMetadataConfig() { + return { + name: "sessions-metadata", + keyPath: "id", + indices: [{ name: "lastModified", keyPath: "lastModified" }], + }; + } + async save(data, metadata) { + await this.getBackend().transaction(["sessions", "sessions-metadata"], "readwrite", async (tx) => { + await tx.set("sessions", data.id, data); + await tx.set("sessions-metadata", metadata.id, metadata); + }); + } + async get(id) { + return this.getBackend().get("sessions", id); + } + async getMetadata(id) { + return this.getBackend().get("sessions-metadata", id); + } + async getAllMetadata() { + // Use the lastModified index to get sessions sorted by most recent first + return this.getBackend().getAllFromIndex("sessions-metadata", "lastModified", "desc"); + } + async delete(id) { + await this.getBackend().transaction(["sessions", "sessions-metadata"], "readwrite", async (tx) => { + await tx.delete("sessions", id); + await tx.delete("sessions-metadata", id); + }); + } + // Alias for backward compatibility + async deleteSession(id) { + return this.delete(id); + } + async updateTitle(id, title) { + const metadata = await this.getMetadata(id); + if (metadata) { + metadata.title = title; + await this.getBackend().set("sessions-metadata", id, metadata); + } + // Also update in full session data + const data = await this.get(id); + if (data) { + data.title = title; + await this.getBackend().set("sessions", id, data); + } + } + async getQuotaInfo() { + return this.getBackend().getQuotaInfo(); + } + async requestPersistence() { + return this.getBackend().requestPersistence(); + } + // Alias methods for backward compatibility + async saveSession(id, state, metadata, title) { + // If metadata is provided, use it; otherwise create it from state + const meta = metadata || { + id, + title: title || "", + createdAt: new Date().toISOString(), + lastModified: new Date().toISOString(), + messageCount: state.messages?.length || 0, + usage: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }, + }, + thinkingLevel: state.thinkingLevel || "off", + preview: "", + }; + const data = { + id, + title: title || meta.title, + model: state.model, + thinkingLevel: state.thinkingLevel, + messages: state.messages || [], + createdAt: meta.createdAt, + lastModified: new Date().toISOString(), + }; + await this.save(data, meta); + } + async loadSession(id) { + return this.get(id); + } + async getLatestSessionId() { + const allMetadata = await this.getAllMetadata(); + if (allMetadata.length === 0) + return null; + // Sort by lastModified descending + allMetadata.sort((a, b) => b.lastModified.localeCompare(a.lastModified)); + return allMetadata[0].id; + } +} +//# sourceMappingURL=sessions-store.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/sessions-store.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/sessions-store.js.map new file mode 100644 index 000000000..cde6f8bc0 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/sessions-store.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sessions-store.js","sourceRoot":"","sources":["../../../src/storage/stores/sessions-store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC;;;GAGG;AACH,MAAM,OAAO,aAAc,S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AW,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAChD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAE1C,kCAAkC;QAClC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;QACzE,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1B,CAAC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/settings-store.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/settings-store.d.ts new file mode 100644 index 000000000..c09588813 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/settings-store.d.ts @@ -0,0 +1,14 @@ +import { Store } from "../store.js"; +import type { StoreConfig } from "../types.js"; +/** + * Store for application settings (theme, proxy config, etc.). + */ +export declare class SettingsStore extends Store { + getConfig(): StoreConfig; + get(key: string): Promise; + set(key: string, value: T): Promise; + delete(key: string): Promise; + list(): Promise; + clear(): Promise; +} +//# sourceMappingURL=settings-store.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/settings-store.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/settings-store.d.ts.map new file mode 100644 index 000000000..54e999463 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/settings-store.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"settings-store.d.ts","sourceRoot":"","sources":["../../../src/storage/stores/settings-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;GAEG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACvC,SAAS,IAAI,WAAW;IAOlB,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAItC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlC,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAIzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG5B"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/settings-store.js b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/settings-store.js new file mode 100644 index 000000000..44f15271d --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/settings-store.js @@ -0,0 +1,28 @@ +import { Store } from "../store.js"; +/** + * Store for application settings (theme, proxy config, etc.). + */ +export class SettingsStore extends Store { + getConfig() { + return { + name: "settings", + // No keyPath - uses out-of-line keys + }; + } + async get(key) { + return this.getBackend().get("settings", key); + } + async set(key, value) { + await this.getBackend().set("settings", key, value); + } + async delete(key) { + await this.getBackend().delete("settings", key); + } + async list() { + return this.getBackend().keys("settings"); + } + async clear() { + await this.getBackend().clear("settings"); + } +} +//# sourceMappingURL=settings-store.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/settings-store.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/settings-store.js.map new file mode 100644 index 000000000..7f17d63a7 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/stores/settings-store.js.map @@ -0,0 +1 @@ +{"version":3,"file":"settings-store.js","sourceRoot":"","sources":["../../../src/storage/stores/settings-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IACvC,SAAS;QACR,OAAO;YACN,IAAI,EAAE,UAAU;YAChB,qCAAqC;SACrC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,GAAG,CAAI,GAAW;QACvB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,GAAG,CAAI,GAAW,EAAE,KAAQ;QACjC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACrD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAW;QACvB,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,IAAI;QACT,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,KAAK;QACV,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/types.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/types.d.ts new file mode 100644 index 000000000..dfb43cf12 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/types.d.ts @@ -0,0 +1,175 @@ +import type { Model } from "@mariozechner/pi-ai"; +import type { ThinkingLevel } from "../agent/agent.js"; +import type { AppMessage } from "../components/Messages.js"; +/** + * Transaction interface for atomic operations across stores. + */ +export interface StorageTransaction { + /** + * Get a value by key from a specific store. + */ + get(storeName: string, key: string): Promise; + /** + * Set a value for a key in a specific store. + */ + set(storeName: string, key: string, value: T): Promise; + /** + * Delete a key from a specific store. + */ + delete(storeName: string, key: string): Promise; +} +/** + * Base interface for all storage backends. + * Multi-store key-value storage abstraction that can be implemented + * by IndexedDB, remote APIs, or any other multi-collection storage system. + */ +export interface StorageBackend { + /** + * Get a value by key from a specific store. Returns null if key doesn't exist. + */ + get(storeName: string, key: string): Promise; + /** + * Set a value for a key in a specific store. + */ + set(storeName: string, key: string, value: T): Promise; + /** + * Delete a key from a specific store. + */ + delete(storeName: string, key: string): Promise; + /** + * Get all keys from a specific store, optionally filtered by prefix. + */ + keys(storeName: string, prefix?: string): Promise; + /** + * Get all values from a specific store, ordered by an index. + * @param storeName - The store to query + * @param indexName - The index to use for ordering + * @param direction - Sort direction ("asc" or "desc") + */ + getAllFromIndex(storeName: string, indexName: string, direction?: "asc" | "desc"): Promise; + /** + * Clear all data from a specific store. + */ + clear(storeName: string): Promise; + /** + * Check if a key exists in a specific store. + */ + has(storeName: string, key: string): Promise; + /** + * Execute atomic operations across multiple stores. + */ + transaction(storeNames: string[], mode: "readonly" | "readwrite", operation: (tx: StorageTransaction) => Promise): Promise; + /** + * Get storage quota information. + * Used for warning users when approaching limits. + */ + getQuotaInfo(): Promise<{ + usage: number; + quota: number; + percent: number; + }>; + /** + * Request persistent storage (prevents eviction). + * Returns true if granted, false otherwise. + */ + requestPersistence(): Promise; +} +/** + * Lightweight session metadata for listing and searching. + * Stored separately from full session data for performance. + */ +export interface SessionMetadata { + /** Unique session identifier (UUID v4) */ + id: string; + /** User-defined title or auto-generated from first message */ + title: string; + /** ISO 8601 UTC timestamp of creation */ + createdAt: string; + /** ISO 8601 UTC timestamp of last modification */ + lastModified: string; + /** Total number of messages (user + assistant + tool results) */ + messageCount: number; + /** Cumulative usage statistics */ + usage: { + /** Total input tokens */ + input: number; + /** Total output tokens */ + output: number; + /** Total cache read tokens */ + cacheRead: number; + /** Total cache write tokens */ + cacheWrite: number; + /** Total cost breakdown */ + cost: { + input: number; + output: number; + cacheRead: number; + cacheWrite: number; + total: number; + }; + }; + /** Last used thinking level */ + thinkingLevel: ThinkingLevel; + /** + * Preview text for search and display. + * First 2KB of conversation text (user + assistant messages in sequence). + * Tool calls and tool results are excluded. + */ + preview: string; +} +/** + * Full session data including all messages. + * Only loaded when user opens a specific session. + */ +export interface SessionData { + /** Unique session identifier (UUID v4) */ + id: string; + /** User-defined title or auto-generated from first message */ + title: string; + /** Last selected model */ + model: Model; + /** Last selected thinking level */ + thinkingLevel: ThinkingLevel; + /** Full conversation history (with attachments inline) */ + messages: AppMessage[]; + /** ISO 8601 UTC timestamp of creation */ + createdAt: string; + /** ISO 8601 UTC timestamp of last modification */ + lastModified: string; +} +/** + * Configuration for IndexedDB backend. + */ +export interface IndexedDBConfig { + /** Database name */ + dbName: string; + /** Database version */ + version: number; + /** Object stores to create */ + stores: StoreConfig[]; +} +/** + * Configuration for an IndexedDB object store. + */ +export interface StoreConfig { + /** Store name */ + name: string; + /** Key path (optional, for auto-extracting keys from objects) */ + keyPath?: string; + /** Auto-increment keys (optional) */ + autoIncrement?: boolean; + /** Indices to create on this store */ + indices?: IndexConfig[]; +} +/** + * Configuration for an IndexedDB index. + */ +export interface IndexConfig { + /** Index name */ + name: string; + /** Key path to index on */ + keyPath: string; + /** Unique constraint (optional) */ + unique?: boolean; +} +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/types.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/types.d.ts.map new file mode 100644 index 000000000..fd0b9a6e5 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/storage/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D;;GAEG;AAC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,EAAE,MAAM,CAAC;SACd,CAAC;KACF,CAAC;IAEF,+BAA+B;IAC/B,aAAa,EAAE,aAAa,CAAC;IAE7B;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B,0CAA0C;IAC1C,EAAE,EAAE,MAAM,CAAC;IAEX,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IAEd,0BAA0B;IAC1B,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAElB,mCAAmC;IACnC,aAAa,EAAE,aAAa,CAAC;IAE7B,0DAA0D;IAC1D,QAAQ,EAAE,UAAU,EAAE,CAAC;IAEvB,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAC;IAElB,kDAAkD;IAClD,YAAY,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,oBAAoB;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,MAAM,EAAE,WAAW,EAAE,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,sCAAsC;IACtC,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/types.js b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/types.js new file mode 100644 index 000000000..718fd38ae --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/storage/types.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/types.js.map new file mode 100644 index 000000000..1a0d3a4a5 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/storage/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/storage/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactElement.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactElement.d.ts new file mode 100644 index 000000000..cdf3eb586 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactElement.d.ts @@ -0,0 +1,9 @@ +import { LitElement, type TemplateResult } from "lit"; +export declare abstract class ArtifactElement extends LitElement { + filename: string; + protected createRenderRoot(): HTMLElement | DocumentFragment; + abstract get content(): string; + abstract set content(value: string); + abstract getHeaderButtons(): TemplateResult | HTMLElement; +} +//# sourceMappingURL=ArtifactElement.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactElement.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactElement.d.ts.map new file mode 100644 index 000000000..d72a22e0b --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactElement.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ArtifactElement.d.ts","sourceRoot":"","sources":["../../../src/tools/artifacts/ArtifactElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAEtD,8BAAsB,eAAgB,SAAQ,UAAU;IAChD,QAAQ,SAAM;cAEF,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAIrE,aAAoB,OAAO,IAAI,MAAM,CAAC;IACtC,aAAoB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE;IAE3C,QAAQ,CAAC,gBAAgB,IAAI,cAAc,GAAG,WAAW;CACzD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactElement.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactElement.js new file mode 100644 index 000000000..d543533c6 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactElement.js @@ -0,0 +1,11 @@ +import { LitElement } from "lit"; +export class ArtifactElement extends LitElement { + constructor() { + super(...arguments); + this.filename = ""; + } + createRenderRoot() { + return this; // light DOM for shared styles + } +} +//# sourceMappingURL=ArtifactElement.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactElement.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactElement.js.map new file mode 100644 index 000000000..5180b3b3f --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactElement.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ArtifactElement.js","sourceRoot":"","sources":["../../../src/tools/artifacts/ArtifactElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAEtD,MAAM,OAAgB,eAAgB,SAAQ,UAAU;IAAxD;;QACQ,aAAQ,GAAG,EAAE,CAAC;IAUtB,CAAC;IARmB,gBAAgB;QAClC,OAAO,IAAI,CAAC,CAAC,8BAA8B;IAC5C,CAAC;CAMD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactPill.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactPill.d.ts new file mode 100644 index 000000000..c5b0c079f --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactPill.d.ts @@ -0,0 +1,4 @@ +import { type TemplateResult } from "lit"; +import type { ArtifactsPanel } from "./artifacts.js"; +export declare function ArtifactPill(filename: string, artifactsPanel?: ArtifactsPanel): TemplateResult; +//# sourceMappingURL=ArtifactPill.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactPill.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactPill.d.ts.map new file mode 100644 index 000000000..74f975180 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactPill.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ArtifactPill.d.ts","sourceRoot":"","sources":["../../../src/tools/artifacts/ArtifactPill.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc,GAAG,cAAc,CAoB9F"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactPill.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactPill.js new file mode 100644 index 000000000..7eee82a6c --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactPill.js @@ -0,0 +1,23 @@ +import { icon } from "@mariozechner/mini-lit"; +import { html } from "lit"; +import { FileCode2 } from "lucide"; +export function ArtifactPill(filename, artifactsPanel) { + const handleClick = (e) => { + if (!artifactsPanel) + return; + e.preventDefault(); + e.stopPropagation(); + // openArtifact will show the artifact and call onOpen() to open the panel if needed + artifactsPanel.openArtifact(filename); + }; + return html ` + + ${icon(FileCode2, "sm")} + ${filename} + + `; +} +//# sourceMappingURL=ArtifactPill.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactPill.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactPill.js.map new file mode 100644 index 000000000..312765f31 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ArtifactPill.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ArtifactPill.js","sourceRoot":"","sources":["../../../src/tools/artifacts/ArtifactPill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGnC,MAAM,UAAU,YAAY,CAAC,QAAgB,EAAE,cAA+B;IAC7E,MAAM,WAAW,GAAG,CAAC,CAAQ,EAAE,EAAE;QAChC,IAAI,CAAC,cAAc;YAAE,OAAO;QAC5B,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,CAAC,CAAC,eAAe,EAAE,CAAC;QACpB,oFAAoF;QACpF,cAAc,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC,CAAC;IAEF,OAAO,IAAI,CAAA;;wGAGR,cAAc,CAAC,CAAC,CAAC,iDAAiD,CAAC,CAAC,CAAC,EACtE;YACS,cAAc,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;;KAE1C,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC;mCACS,QAAQ;;EAEzC,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/Console.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/Console.d.ts new file mode 100644 index 000000000..1025d1fc6 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/Console.d.ts @@ -0,0 +1,18 @@ +import "@mariozechner/mini-lit/dist/CopyButton.js"; +import { LitElement, type TemplateResult } from "lit"; +interface LogEntry { + type: "log" | "error"; + text: string; +} +export declare class Console extends LitElement { + logs: LogEntry[]; + private expanded; + private autoscroll; + private logsContainerRef; + protected createRenderRoot(): this; + updated(): void; + private getLogsText; + render(): TemplateResult; +} +export {}; +//# sourceMappingURL=Console.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/Console.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/Console.d.ts.map new file mode 100644 index 000000000..13868c830 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/Console.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Console.d.ts","sourceRoot":"","sources":["../../../src/tools/artifacts/Console.ts"],"names":[],"mappings":"AACA,OAAO,2CAA2C,CAAC;AACnD,OAAO,EAAQ,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAO5D,UAAU,QAAQ;IACjB,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;CACb;AAED,qBACa,OAAQ,SAAQ,UAAU;IACN,IAAI,EAAE,QAAQ,EAAE,CAAM;IAC7C,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAAQ;IACnC,OAAO,CAAC,gBAAgB,CAAoC;IAE5D,SAAS,CAAC,gBAAgB;IAIjB,OAAO;IAOhB,OAAO,CAAC,WAAW;IAIV,MAAM,IAAI,cAAc;CAwDjC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/Console.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/Console.js new file mode 100644 index 000000000..3d1c671d7 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/Console.js @@ -0,0 +1,95 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { icon } from "@mariozechner/mini-lit"; +import "@mariozechner/mini-lit/dist/CopyButton.js"; +import { html, LitElement } from "lit"; +import { customElement, property, state } from "lit/decorators.js"; +import { createRef, ref } from "lit/directives/ref.js"; +import { repeat } from "lit/directives/repeat.js"; +import { ChevronDown, ChevronRight, ChevronsDown, Lock } from "lucide"; +import { i18n } from "../../utils/i18n.js"; +let Console = class Console extends LitElement { + constructor() { + super(...arguments); + this.logs = []; + this.expanded = false; + this.autoscroll = true; + this.logsContainerRef = createRef(); + } + createRenderRoot() { + return this; // light DOM + } + updated() { + // Autoscroll to bottom when new logs arrive + if (this.autoscroll && this.expanded && this.logsContainerRef.value) { + this.logsContainerRef.value.scrollTop = this.logsContainerRef.value.scrollHeight; + } + } + getLogsText() { + return this.logs.map((l) => `[${l.type}] ${l.text}`).join("\n"); + } + render() { + const errorCount = this.logs.filter((l) => l.type === "error").length; + const summary = errorCount > 0 + ? `${i18n("console")} (${errorCount} ${errorCount === 1 ? "error" : "errors"})` + : `${i18n("console")} (${this.logs.length})`; + return html ` +
+
+ + ${this.expanded + ? html ` + + + ` + : ""} +
+ ${this.expanded + ? html ` +
+ ${repeat(this.logs, (_log, index) => index, (log) => html ` +
+ [${log.type}] ${log.text} +
+ `)} +
+ ` + : ""} +
+ `; + } +}; +__decorate([ + property({ attribute: false }) +], Console.prototype, "logs", void 0); +__decorate([ + state() +], Console.prototype, "expanded", void 0); +__decorate([ + state() +], Console.prototype, "autoscroll", void 0); +Console = __decorate([ + customElement("artifact-console") +], Console); +export { Console }; +//# sourceMappingURL=Console.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/Console.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/Console.js.map new file mode 100644 index 000000000..ddd4e3df4 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/Console.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Console.js","sourceRoot":"","sources":["../../../src/tools/artifacts/Console.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,2CAA2C,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAY,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAQpC,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,UAAU;IAAhC;;QAC0B,SAAI,GAAe,EAAE,CAAC;QACrC,aAAQ,GAAG,KAAK,CAAC;QACjB,eAAU,GAAG,IAAI,CAAC;QAC3B,qBAAgB,GAAwB,SAAS,EAAE,CAAC;IAyE7D,CAAC;IAvEU,gBAAgB;QACzB,OAAO,IAAI,CAAC,CAAC,YAAY;IAC1B,CAAC;IAEQ,OAAO;QACf,4CAA4C;QAC5C,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,gBAAgB,CAAC,KAA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C,gBAAgB;gBACtG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC;;UAEhF,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC;;4BAE/B,IAAI,CAAC,WAAW,EAAE,UAAU,IAAI,CAAC,WAAW,CAAC,cAAc,KAAK;OACrF;YACA,CAAC,CAAC,EACJ;;MAGA,IAAI,CAAC,QAAQ;YACZ,CAAC,CAAC,IAAI,CAAA;6DACiD,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC;SAC9E,MAAM,CACP,IAAI,CAAC,IAAI,EACT,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EACtB,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAA;yCACoB,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,uBAAuB;aAC/F,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI;;SAEzB,CACD;;MAEF;YACA,CAAC,CAAC,EACJ;;GAED,CAAC;IACH,CAAC;CACD,CAAA;AA5EgC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;qCAAuB;AACrC;IAAhB,KAAK,EAAE;yCAA0B;AACjB;IAAhB,KAAK,EAAE;2CAA2B;AAHvB,OAAO;IADnB,aAAa,CAAC,kBAAkB,CAAC;GACrB,OAAO,CA6EnB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/DocxArtifact.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/DocxArtifact.d.ts new file mode 100644 index 000000000..09b0d2b4b --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/DocxArtifact.d.ts @@ -0,0 +1,22 @@ +import { type TemplateResult } from "lit"; +import { ArtifactElement } from "./ArtifactElement.js"; +export declare class DocxArtifact extends ArtifactElement { + private _content; + private error; + get content(): string; + set content(value: string); + protected createRenderRoot(): HTMLElement | DocumentFragment; + connectedCallback(): void; + private base64ToArrayBuffer; + private decodeBase64; + getHeaderButtons(): TemplateResult<1>; + updated(changedProperties: Map): Promise; + private renderDocx; + render(): TemplateResult; +} +declare global { + interface HTMLElementTagNameMap { + "docx-artifact": DocxArtifact; + } +} +//# sourceMappingURL=DocxArtifact.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/DocxArtifact.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/DocxArtifact.d.ts.map new file mode 100644 index 000000000..7455778ee --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/DocxArtifact.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"DocxArtifact.d.ts","sourceRoot":"","sources":["../../../src/tools/artifacts/DocxArtifact.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAGhD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,qBACa,YAAa,SAAQ,eAAe;IACpB,OAAO,CAAC,QAAQ,CAAM;IACzC,OAAO,CAAC,KAAK,CAAuB;IAE7C,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,MAAM,EAIxB;cAEkB,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAI5D,iBAAiB,IAAI,IAAI;IAMlC,OAAO,CAAC,mBAAmB;IAkB3B,OAAO,CAAC,YAAY;IAiBb,gBAAgB;IAaR,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;YAQ5C,UAAU;IAoGf,MAAM,IAAI,cAAc;CAkBjC;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,eAAe,EAAE,YAAY,CAAC;KAC9B;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/DocxArtifact.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/DocxArtifact.js new file mode 100644 index 000000000..b9fc2f462 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/DocxArtifact.js @@ -0,0 +1,208 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js"; +import { renderAsync } from "docx-preview"; +import { html } from "lit"; +import { customElement, property, state } from "lit/decorators.js"; +import { i18n } from "../../utils/i18n.js"; +import { ArtifactElement } from "./ArtifactElement.js"; +let DocxArtifact = class DocxArtifact extends ArtifactElement { + constructor() { + super(...arguments); + this._content = ""; + this.error = null; + } + get content() { + return this._content; + } + set content(value) { + this._content = value; + this.error = null; + this.requestUpdate(); + } + createRenderRoot() { + return this; + } + connectedCallback() { + super.connectedCallback(); + this.style.display = "block"; + this.style.height = "100%"; + } + base64ToArrayBuffer(base64) { + // Remove data URL prefix if present + let base64Data = base64; + if (base64.startsWith("data:")) { + const base64Match = base64.match(/base64,(.+)/); + if (base64Match) { + base64Data = base64Match[1]; + } + } + const binaryString = atob(base64Data); + const bytes = new Uint8Array(binaryString.length); + for (let i = 0; i < binaryString.length; i++) { + bytes[i] = binaryString.charCodeAt(i); + } + return bytes.buffer; + } + decodeBase64() { + let base64Data = this._content; + if (this._content.startsWith("data:")) { + const base64Match = this._content.match(/base64,(.+)/); + if (base64Match) { + base64Data = base64Match[1]; + } + } + const binaryString = atob(base64Data); + const bytes = new Uint8Array(binaryString.length); + for (let i = 0; i < binaryString.length; i++) { + bytes[i] = binaryString.charCodeAt(i); + } + return bytes; + } + getHeaderButtons() { + return html ` +
+ ${DownloadButton({ + content: this.decodeBase64(), + filename: this.filename, + mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + title: i18n("Download"), + })} +
+ `; + } + async updated(changedProperties) { + super.updated(changedProperties); + if (changedProperties.has("_content") && this._content && !this.error) { + await this.renderDocx(); + } + } + async renderDocx() { + const container = this.querySelector("#docx-container"); + if (!container || !this._content) + return; + try { + const arrayBuffer = this.base64ToArrayBuffer(this._content); + // Clear container first + container.innerHTML = ""; + // Create a wrapper div for the document + const wrapper = document.createElement("div"); + wrapper.className = "docx-wrapper-custom"; + container.appendChild(wrapper); + // Render the DOCX file into the wrapper + await renderAsync(arrayBuffer, wrapper, undefined, { + className: "docx", + inWrapper: true, + ignoreWidth: true, + ignoreHeight: false, + ignoreFonts: false, + breakPages: true, + ignoreLastRenderedPageBreak: true, + experimental: false, + trimXmlDeclaration: true, + useBase64URL: false, + renderHeaders: true, + renderFooters: true, + renderFootnotes: true, + renderEndnotes: true, + }); + // Apply custom styles to match theme and fix sizing + const style = document.createElement("style"); + style.textContent = ` + #docx-container { + padding: 0; + } + + #docx-container .docx-wrapper-custom { + max-width: 100%; + overflow-x: auto; + } + + #docx-container .docx-wrapper { + max-width: 100% !important; + margin: 0 !important; + background: transparent !important; + padding: 0em !important; + } + + #docx-container .docx-wrapper > section.docx { + box-shadow: none !important; + border: none !important; + border-radius: 0 !important; + margin: 0 !important; + padding: 2em !important; + background: white !important; + color: black !important; + max-width: 100% !important; + width: 100% !important; + min-width: 0 !important; + overflow-x: auto !important; + } + + /* Fix tables and wide content */ + #docx-container table { + max-width: 100% !important; + width: auto !important; + overflow-x: auto !important; + display: block !important; + } + + #docx-container img { + max-width: 100% !important; + height: auto !important; + } + + /* Fix paragraphs and text */ + #docx-container p, + #docx-container span, + #docx-container div { + max-width: 100% !important; + word-wrap: break-word !important; + overflow-wrap: break-word !important; + } + + /* Hide page breaks in web view */ + #docx-container .docx-page-break { + display: none !important; + } + `; + container.appendChild(style); + } + catch (error) { + console.error("Error rendering DOCX:", error); + this.error = error?.message || i18n("Failed to load document"); + } + } + render() { + if (this.error) { + return html ` +
+
+
${i18n("Error loading document")}
+
${this.error}
+
+
+ `; + } + return html ` +
+
+
+ `; + } +}; +__decorate([ + property({ type: String }) +], DocxArtifact.prototype, "_content", void 0); +__decorate([ + state() +], DocxArtifact.prototype, "error", void 0); +DocxArtifact = __decorate([ + customElement("docx-artifact") +], DocxArtifact); +export { DocxArtifact }; +//# sourceMappingURL=DocxArtifact.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/DocxArtifact.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/DocxArtifact.js.map new file mode 100644 index 000000000..4900802e3 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/DocxArtifact.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DocxArtifact.js","sourceRoot":"","sources":["../../../src/tools/artifacts/DocxArtifact.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGhD,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,eAAe;I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C,CAAC;YAC9C,IAAI,CAAC,KAAK,GAAG,KAAK,EAAE,OAAO,IAAI,IAAI,CAAC,yBAAyB,CAAC,CAAC;QAChE,CAAC;IACF,CAAC;IAEQ,MAAM;QACd,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,OAAO,IAAI,CAAA;;;sCAGwB,IAAI,CAAC,wBAAwB,CAAC;wCAC5B,IAAI,CAAC,KAAK;;;IAG9C,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAA;;;;GAIV,CAAC;IACH,CAAC;CACD,CAAA;AArMoC;IAAnC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAuB;AACjC;IAAhB,KAAK,EAAE;2CAAqC;AAFjC,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAsMxB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ExcelArtifact.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ExcelArtifact.d.ts new file mode 100644 index 000000000..71822a4c5 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ExcelArtifact.d.ts @@ -0,0 +1,24 @@ +import { type TemplateResult } from "lit"; +import { ArtifactElement } from "./ArtifactElement.js"; +export declare class ExcelArtifact extends ArtifactElement { + private _content; + private error; + get content(): string; + set content(value: string); + protected createRenderRoot(): HTMLElement | DocumentFragment; + connectedCallback(): void; + private base64ToArrayBuffer; + private decodeBase64; + private getMimeType; + getHeaderButtons(): TemplateResult<1>; + updated(changedProperties: Map): Promise; + private renderExcel; + private renderExcelSheet; + render(): TemplateResult; +} +declare global { + interface HTMLElementTagNameMap { + "excel-artifact": ExcelArtifact; + } +} +//# sourceMappingURL=ExcelArtifact.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ExcelArtifact.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ExcelArtifact.d.ts.map new file mode 100644 index 000000000..f8f1a01e0 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ExcelArtifact.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ExcelArtifact.d.ts","sourceRoot":"","sources":["../../../src/tools/artifacts/ExcelArtifact.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAIhD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,qBACa,aAAc,SAAQ,eAAe;IACrB,OAAO,CAAC,QAAQ,CAAM;IACzC,OAAO,CAAC,KAAK,CAAuB;IAE7C,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,MAAM,EAIxB;cAEkB,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAI5D,iBAAiB,IAAI,IAAI;IAMlC,OAAO,CAAC,mBAAmB;IAkB3B,OAAO,CAAC,YAAY;IAiBpB,OAAO,CAAC,WAAW;IAMZ,gBAAgB;IAaR,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;YAQ5C,WAAW;IAuEzB,OAAO,CAAC,gBAAgB;IAyCf,MAAM,IAAI,cAAc;CAkBjC;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,gBAAgB,EAAE,aAAa,CAAC;KAChC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ExcelArtifact.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ExcelArtifact.js new file mode 100644 index 000000000..1e02ca43a --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ExcelArtifact.js @@ -0,0 +1,216 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js"; +import { html } from "lit"; +import { customElement, property, state } from "lit/decorators.js"; +import * as XLSX from "xlsx"; +import { i18n } from "../../utils/i18n.js"; +import { ArtifactElement } from "./ArtifactElement.js"; +let ExcelArtifact = class ExcelArtifact extends ArtifactElement { + constructor() { + super(...arguments); + this._content = ""; + this.error = null; + } + get content() { + return this._content; + } + set content(value) { + this._content = value; + this.error = null; + this.requestUpdate(); + } + createRenderRoot() { + return this; + } + connectedCallback() { + super.connectedCallback(); + this.style.display = "block"; + this.style.height = "100%"; + } + base64ToArrayBuffer(base64) { + // Remove data URL prefix if present + let base64Data = base64; + if (base64.startsWith("data:")) { + const base64Match = base64.match(/base64,(.+)/); + if (base64Match) { + base64Data = base64Match[1]; + } + } + const binaryString = atob(base64Data); + const bytes = new Uint8Array(binaryString.length); + for (let i = 0; i < binaryString.length; i++) { + bytes[i] = binaryString.charCodeAt(i); + } + return bytes.buffer; + } + decodeBase64() { + let base64Data = this._content; + if (this._content.startsWith("data:")) { + const base64Match = this._content.match(/base64,(.+)/); + if (base64Match) { + base64Data = base64Match[1]; + } + } + const binaryString = atob(base64Data); + const bytes = new Uint8Array(binaryString.length); + for (let i = 0; i < binaryString.length; i++) { + bytes[i] = binaryString.charCodeAt(i); + } + return bytes; + } + getMimeType() { + const ext = this.filename.split(".").pop()?.toLowerCase(); + if (ext === "xls") + return "application/vnd.ms-excel"; + return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; + } + getHeaderButtons() { + return html ` +
+ ${DownloadButton({ + content: this.decodeBase64(), + filename: this.filename, + mimeType: this.getMimeType(), + title: i18n("Download"), + })} +
+ `; + } + async updated(changedProperties) { + super.updated(changedProperties); + if (changedProperties.has("_content") && this._content && !this.error) { + await this.renderExcel(); + } + } + async renderExcel() { + const container = this.querySelector("#excel-container"); + if (!container || !this._content) + return; + try { + const arrayBuffer = this.base64ToArrayBuffer(this._content); + const workbook = XLSX.read(arrayBuffer, { type: "array" }); + container.innerHTML = ""; + const wrapper = document.createElement("div"); + wrapper.className = "overflow-auto h-full flex flex-col"; + container.appendChild(wrapper); + // Create tabs for multiple sheets + if (workbook.SheetNames.length > 1) { + const tabContainer = document.createElement("div"); + tabContainer.className = "flex gap-2 mb-4 border-b border-border sticky top-0 bg-background z-10"; + const sheetContents = []; + workbook.SheetNames.forEach((sheetName, index) => { + // Create tab button + const tab = document.createElement("button"); + tab.textContent = sheetName; + tab.className = + index === 0 + ? "px-4 py-2 text-sm font-medium border-b-2 border-primary text-primary" + : "px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground hover:border-b-2 hover:border-border transition-colors"; + // Create sheet content + const sheetDiv = document.createElement("div"); + sheetDiv.style.display = index === 0 ? "flex" : "none"; + sheetDiv.className = "flex-1 overflow-auto"; + sheetDiv.appendChild(this.renderExcelSheet(workbook.Sheets[sheetName], sheetName)); + sheetContents.push(sheetDiv); + // Tab click handler + tab.onclick = () => { + // Update tab styles + tabContainer.querySelectorAll("button").forEach((btn, btnIndex) => { + if (btnIndex === index) { + btn.className = "px-4 py-2 text-sm font-medium border-b-2 border-primary text-primary"; + } + else { + btn.className = + "px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground hover:border-b-2 hover:border-border transition-colors"; + } + }); + // Show/hide sheets + sheetContents.forEach((content, contentIndex) => { + content.style.display = contentIndex === index ? "flex" : "none"; + }); + }; + tabContainer.appendChild(tab); + }); + wrapper.appendChild(tabContainer); + sheetContents.forEach((content) => { + wrapper.appendChild(content); + }); + } + else { + // Single sheet + const sheetName = workbook.SheetNames[0]; + wrapper.appendChild(this.renderExcelSheet(workbook.Sheets[sheetName], sheetName)); + } + } + catch (error) { + console.error("Error rendering Excel:", error); + this.error = error?.message || i18n("Failed to load spreadsheet"); + } + } + renderExcelSheet(worksheet, sheetName) { + const sheetDiv = document.createElement("div"); + // Generate HTML table + const htmlTable = XLSX.utils.sheet_to_html(worksheet, { id: `sheet-${sheetName}` }); + const tempDiv = document.createElement("div"); + tempDiv.innerHTML = htmlTable; + // Find and style the table + const table = tempDiv.querySelector("table"); + if (table) { + table.className = "w-full border-collapse text-foreground"; + // Style all cells + table.querySelectorAll("td, th").forEach((cell) => { + const cellEl = cell; + cellEl.className = "border border-border px-3 py-2 text-sm text-left"; + }); + // Style header row + const headerCells = table.querySelectorAll("thead th, tr:first-child td"); + if (headerCells.length > 0) { + headerCells.forEach((th) => { + const thEl = th; + thEl.className = + "border border-border px-3 py-2 text-sm font-semibold bg-muted text-foreground sticky top-0"; + }); + } + // Alternate row colors + table.querySelectorAll("tbody tr:nth-child(even)").forEach((row) => { + const rowEl = row; + rowEl.className = "bg-muted/30"; + }); + sheetDiv.appendChild(table); + } + return sheetDiv; + } + render() { + if (this.error) { + return html ` +
+
+
${i18n("Error loading spreadsheet")}
+
${this.error}
+
+
+ `; + } + return html ` +
+
+
+ `; + } +}; +__decorate([ + property({ type: String }) +], ExcelArtifact.prototype, "_content", void 0); +__decorate([ + state() +], ExcelArtifact.prototype, "error", void 0); +ExcelArtifact = __decorate([ + customElement("excel-artifact") +], ExcelArtifact); +export { ExcelArtifact }; +//# sourceMappingURL=ExcelArtifact.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ExcelArtifact.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ExcelArtifact.js.map new file mode 100644 index 000000000..146f71764 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ExcelArtifact.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ExcelArtifact.js","sourceRoot":"","sources":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,IAAI,CAAA;;;sCAGwB,IAAI,CAAC,2BAA2B,CAAC;wCAC/B,IAAI,CAAC,KAAK;;;IAG9C,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAA;;;;GAIV,CAAC;IACH,CAAC;CACD,CAAA;AAvNoC;IAAnC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAuB;AACjC;IAAhB,KAAK,EAAE;4CAAqC;AAFjC,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CAwNzB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/GenericArtifact.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/GenericArtifact.d.ts new file mode 100644 index 000000000..2f2e58441 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/GenericArtifact.d.ts @@ -0,0 +1,19 @@ +import { type TemplateResult } from "lit"; +import { ArtifactElement } from "./ArtifactElement.js"; +export declare class GenericArtifact extends ArtifactElement { + private _content; + get content(): string; + set content(value: string); + protected createRenderRoot(): HTMLElement | DocumentFragment; + connectedCallback(): void; + private decodeBase64; + private getMimeType; + getHeaderButtons(): TemplateResult<1>; + render(): TemplateResult; +} +declare global { + interface HTMLElementTagNameMap { + "generic-artifact": GenericArtifact; + } +} +//# sourceMappingURL=GenericArtifact.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/GenericArtifact.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/GenericArtifact.d.ts.map new file mode 100644 index 000000000..f4e9fa9e8 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/GenericArtifact.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"GenericArtifact.d.ts","sourceRoot":"","sources":["../../../src/tools/artifacts/GenericArtifact.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAGhD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,qBACa,eAAgB,SAAQ,eAAe;IACvB,OAAO,CAAC,QAAQ,CAAM;IAElD,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,MAAM,EAGxB;cAEkB,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAI5D,iBAAiB,IAAI,IAAI;IAMlC,OAAO,CAAC,YAAY;IAiBpB,OAAO,CAAC,WAAW;IAuBZ,gBAAgB;IAad,MAAM,IAAI,cAAc;CA4BjC;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,kBAAkB,EAAE,eAAe,CAAC;KACpC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/GenericArtifact.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/GenericArtifact.js new file mode 100644 index 000000000..e85b3e86f --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/GenericArtifact.js @@ -0,0 +1,117 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js"; +import { html } from "lit"; +import { customElement, property } from "lit/decorators.js"; +import { i18n } from "../../utils/i18n.js"; +import { ArtifactElement } from "./ArtifactElement.js"; +let GenericArtifact = class GenericArtifact extends ArtifactElement { + constructor() { + super(...arguments); + this._content = ""; + } + get content() { + return this._content; + } + set content(value) { + this._content = value; + this.requestUpdate(); + } + createRenderRoot() { + return this; + } + connectedCallback() { + super.connectedCallback(); + this.style.display = "block"; + this.style.height = "100%"; + } + decodeBase64() { + let base64Data = this._content; + if (this._content.startsWith("data:")) { + const base64Match = this._content.match(/base64,(.+)/); + if (base64Match) { + base64Data = base64Match[1]; + } + } + const binaryString = atob(base64Data); + const bytes = new Uint8Array(binaryString.length); + for (let i = 0; i < binaryString.length; i++) { + bytes[i] = binaryString.charCodeAt(i); + } + return bytes; + } + getMimeType() { + const ext = this.filename.split(".").pop()?.toLowerCase(); + // Add common MIME types + const mimeTypes = { + pdf: "application/pdf", + zip: "application/zip", + tar: "application/x-tar", + gz: "application/gzip", + rar: "application/vnd.rar", + "7z": "application/x-7z-compressed", + mp3: "audio/mpeg", + mp4: "video/mp4", + avi: "video/x-msvideo", + mov: "video/quicktime", + wav: "audio/wav", + ogg: "audio/ogg", + json: "application/json", + xml: "application/xml", + bin: "application/octet-stream", + }; + return mimeTypes[ext || ""] || "application/octet-stream"; + } + getHeaderButtons() { + return html ` +
+ ${DownloadButton({ + content: this.decodeBase64(), + filename: this.filename, + mimeType: this.getMimeType(), + title: i18n("Download"), + })} +
+ `; + } + render() { + return html ` +
+
+
+ + + +
${this.filename}
+

+ ${i18n("Preview not available for this file type.")} ${i18n("Click the download button above to view it on your computer.")} +

+
+
+
+ `; + } +}; +__decorate([ + property({ type: String }) +], GenericArtifact.prototype, "_content", void 0); +GenericArtifact = __decorate([ + customElement("generic-artifact") +], GenericArtifact); +export { GenericArtifact }; +//# sourceMappingURL=GenericArtifact.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/GenericArtifact.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/GenericArtifact.js.map new file mode 100644 index 000000000..d45b3ab4d --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/GenericArtifact.js.map @@ -0,0 +1 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AAC;IAEQ,MAAM;QACd,OAAO,IAAI,CAAA;;;;;;;;;;;;;;;;;;sDAkByC,IAAI,CAAC,QAAQ;;SAE1D,IAAI,CAAC,2CAA2C,CAAC,IAAI,IAAI,CAAC,8DAA8D,CAAC;;;;;GAK/H,CAAC;IACH,CAAC;CACD,CAAA;AAtGoC;IAAnC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAuB;AADtC,eAAe;IAD3B,aAAa,CAAC,kBAAkB,CAAC;GACrB,eAAe,CAuG3B"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/HtmlArtifact.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/HtmlArtifact.d.ts new file mode 100644 index 000000000..48c128b77 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/HtmlArtifact.d.ts @@ -0,0 +1,27 @@ +import { type Ref } from "lit/directives/ref.js"; +import type { SandboxIframe } from "../../components/SandboxedIframe.js"; +import type { SandboxRuntimeProvider } from "../../components/sandbox/SandboxRuntimeProvider.js"; +import "../../components/SandboxedIframe.js"; +import { ArtifactElement } from "./ArtifactElement.js"; +import "./Console.js"; +export declare class HtmlArtifact extends ArtifactElement { + filename: string; + runtimeProviders: SandboxRuntimeProvider[]; + sandboxUrlProvider?: () => string; + private _content; + private logs; + sandboxIframeRef: Ref; + private consoleRef; + private viewMode; + private setViewMode; + getHeaderButtons(): import("lit-html").TemplateResult<1>; + set content(value: string); + executeContent(html: string): void; + get content(): string; + disconnectedCallback(): void; + firstUpdated(): void; + updated(changedProperties: Map): void; + getLogs(): string; + render(): import("lit-html").TemplateResult<1>; +} +//# sourceMappingURL=HtmlArtifact.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/HtmlArtifact.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/HtmlArtifact.d.ts.map new file mode 100644 index 000000000..7f00078da --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/HtmlArtifact.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"HtmlArtifact.d.ts","sourceRoot":"","sources":["../../../src/tools/artifacts/HtmlArtifact.ts"],"names":[],"mappings":"AAGA,OAAO,EAAa,KAAK,GAAG,EAAO,MAAM,uBAAuB,CAAC;AAGjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEzE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAEjG,OAAO,qCAAqC,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,cAAc,CAAC;AAOtB,qBACa,YAAa,SAAQ,eAAe;IAC3B,QAAQ,SAAM;IACH,gBAAgB,EAAE,sBAAsB,EAAE,CAAM;IAChD,kBAAkB,CAAC,EAAE,MAAM,MAAM,CAAC;IAElE,OAAO,CAAC,QAAQ,CAAM;IACtB,OAAO,CAAC,IAAI,CAAsD;IAG3D,gBAAgB,EAAE,GAAG,CAAC,aAAa,CAAC,CAAe;IAC1D,OAAO,CAAC,UAAU,CAA6B;IAEtC,OAAO,CAAC,QAAQ,CAAiC;IAE1D,OAAO,CAAC,WAAW;IAIZ,gBAAgB;IAwCvB,IAAa,OAAO,CAAC,KAAK,EAAE,MAAM,EAYjC;IAEM,cAAc,CAAC,IAAI,EAAE,MAAM;IA6ClC,IAAa,OAAO,IAAI,MAAM,CAE7B;IAEQ,oBAAoB;IAOpB,YAAY;IAOZ,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC;IASnE,OAAO,IAAI,MAAM;IAKf,MAAM;CAwBf"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/HtmlArtifact.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/HtmlArtifact.js new file mode 100644 index 000000000..77ea917a2 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/HtmlArtifact.js @@ -0,0 +1,189 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import hljs from "highlight.js"; +import { html } from "lit"; +import { customElement, property, state } from "lit/decorators.js"; +import { createRef, ref } from "lit/directives/ref.js"; +import { unsafeHTML } from "lit/directives/unsafe-html.js"; +import { RefreshCw } from "lucide"; +import { RUNTIME_MESSAGE_ROUTER } from "../../components/sandbox/RuntimeMessageRouter.js"; +import { i18n } from "../../utils/i18n.js"; +import "../../components/SandboxedIframe.js"; +import { ArtifactElement } from "./ArtifactElement.js"; +import "./Console.js"; +import { icon } from "@mariozechner/mini-lit"; +import { Button } from "@mariozechner/mini-lit/dist/Button.js"; +import { CopyButton } from "@mariozechner/mini-lit/dist/CopyButton.js"; +import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js"; +import { PreviewCodeToggle } from "@mariozechner/mini-lit/dist/PreviewCodeToggle.js"; +let HtmlArtifact = class HtmlArtifact extends ArtifactElement { + constructor() { + super(...arguments); + this.filename = ""; + this.runtimeProviders = []; + this._content = ""; + this.logs = []; + // Refs for DOM elements + this.sandboxIframeRef = createRef(); + this.consoleRef = createRef(); + this.viewMode = "preview"; + } + setViewMode(mode) { + this.viewMode = mode; + } + getHeaderButtons() { + const toggle = new PreviewCodeToggle(); + toggle.mode = this.viewMode; + toggle.addEventListener("mode-change", (e) => { + this.setViewMode(e.detail); + }); + const copyButton = new CopyButton(); + copyButton.text = this._content; + copyButton.title = i18n("Copy HTML"); + copyButton.showText = false; + // Generate standalone HTML with all runtime code injected for download + const sandbox = this.sandboxIframeRef.value; + const sandboxId = `artifact-${this.filename}`; + const downloadContent = sandbox?.prepareHtmlDocument(sandboxId, this._content, this.runtimeProviders || [], { + isHtmlArtifact: true, + isStandalone: true, // Skip runtime bridge and navigation interceptor for standalone downloads + }) || this._content; + return html ` +
+ ${toggle} + ${Button({ + variant: "ghost", + size: "sm", + onClick: () => { + this.logs = []; + this.executeContent(this._content); + }, + title: i18n("Reload HTML"), + children: icon(RefreshCw, "sm"), + })} + ${copyButton} + ${DownloadButton({ content: downloadContent, filename: this.filename, mimeType: "text/html", title: i18n("Download HTML") })} +
+ `; + } + set content(value) { + const oldValue = this._content; + this._content = value; + if (oldValue !== value) { + // Reset logs when content changes + this.logs = []; + this.requestUpdate(); + // Execute content in sandbox if it exists + if (this.sandboxIframeRef.value && value) { + this.executeContent(value); + } + } + } + executeContent(html) { + const sandbox = this.sandboxIframeRef.value; + if (!sandbox) + return; + // Configure sandbox URL provider if provided (for browser extensions) + if (this.sandboxUrlProvider) { + sandbox.sandboxUrlProvider = this.sandboxUrlProvider; + } + const sandboxId = `artifact-${this.filename}`; + // Create consumer for console messages + const consumer = { + handleMessage: async (message) => { + if (message.type === "console") { + // Create new array reference for Lit reactivity + this.logs = [ + ...this.logs, + { + type: message.method === "error" ? "error" : "log", + text: message.text, + }, + ]; + this.requestUpdate(); // Re-render to show console + } + }, + }; + // Inject window.complete() call at the end of the HTML to signal when page is loaded + // HTML artifacts don't time out - they call complete() when ready + let modifiedHtml = html; + if (modifiedHtml.includes("")) { + modifiedHtml = modifiedHtml.replace("", ""); + } + else { + // If no closing tag, append the script + modifiedHtml += ""; + } + // Load content - this handles sandbox registration, consumer registration, and iframe creation + sandbox.loadContent(sandboxId, modifiedHtml, this.runtimeProviders, [consumer]); + } + get content() { + return this._content; + } + disconnectedCallback() { + super.disconnectedCallback(); + // Unregister sandbox when element is removed from DOM + const sandboxId = `artifact-${this.filename}`; + RUNTIME_MESSAGE_ROUTER.unregisterSandbox(sandboxId); + } + firstUpdated() { + // Execute initial content + if (this._content && this.sandboxIframeRef.value) { + this.executeContent(this._content); + } + } + updated(changedProperties) { + super.updated(changedProperties); + // If we have content but haven't executed yet (e.g., during reconstruction), + // execute when the iframe ref becomes available + if (this._content && this.sandboxIframeRef.value && this.logs.length === 0) { + this.executeContent(this._content); + } + } + getLogs() { + if (this.logs.length === 0) + return i18n("No logs for {filename}").replace("{filename}", this.filename); + return this.logs.map((l) => `[${l.type}] ${l.text}`).join("\n"); + } + render() { + return html ` +
+
+ +
+ + ${this.logs.length > 0 + ? html `` + : ""} +
+ + +
+
${unsafeHTML(hljs.highlight(this._content, { language: "html" }).value)}
+
+
+
+ `; + } +}; +__decorate([ + property() +], HtmlArtifact.prototype, "filename", void 0); +__decorate([ + property({ attribute: false }) +], HtmlArtifact.prototype, "runtimeProviders", void 0); +__decorate([ + property({ attribute: false }) +], HtmlArtifact.prototype, "sandboxUrlProvider", void 0); +__decorate([ + state() +], HtmlArtifact.prototype, "viewMode", void 0); +HtmlArtifact = __decorate([ + customElement("html-artifact") +], HtmlArtifact); +export { HtmlArtifact }; +//# sourceMappingURL=HtmlArtifact.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/HtmlArtifact.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/HtmlArtifact.js.map new file mode 100644 index 000000000..127cda6b1 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/HtmlArtifact.js.map @@ -0,0 +1 @@ +{"version":3,"file":"HtmlArtifact.js","sourceRoot":"","sources":["../../../src/tools/artifacts/HtmlArtifact.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,IAAI,MAAM,cAAc,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE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KxB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ImageArtifact.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ImageArtifact.d.ts new file mode 100644 index 000000000..3527d9b63 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ImageArtifact.d.ts @@ -0,0 +1,20 @@ +import { type TemplateResult } from "lit"; +import { ArtifactElement } from "./ArtifactElement.js"; +export declare class ImageArtifact extends ArtifactElement { + private _content; + get content(): string; + set content(value: string); + protected createRenderRoot(): HTMLElement | DocumentFragment; + connectedCallback(): void; + private getMimeType; + private getImageUrl; + private decodeBase64; + getHeaderButtons(): TemplateResult<1>; + render(): TemplateResult; +} +declare global { + interface HTMLElementTagNameMap { + "image-artifact": ImageArtifact; + } +} +//# sourceMappingURL=ImageArtifact.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ImageArtifact.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ImageArtifact.d.ts.map new file mode 100644 index 000000000..85831506d --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ImageArtifact.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ImageArtifact.d.ts","sourceRoot":"","sources":["../../../src/tools/artifacts/ImageArtifact.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAGhD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,qBACa,aAAc,SAAQ,eAAe;IACrB,OAAO,CAAC,QAAQ,CAAM;IAElD,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,MAAM,EAGxB;cAEkB,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAI5D,iBAAiB,IAAI,IAAI;IAMlC,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,YAAY;IA6Bb,gBAAgB;IAad,MAAM,IAAI,cAAc;CAkBjC;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,gBAAgB,EAAE,aAAa,CAAC;KAChC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ImageArtifact.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ImageArtifact.js new file mode 100644 index 000000000..59db40e50 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ImageArtifact.js @@ -0,0 +1,120 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js"; +import { html } from "lit"; +import { customElement, property } from "lit/decorators.js"; +import { i18n } from "../../utils/i18n.js"; +import { ArtifactElement } from "./ArtifactElement.js"; +let ImageArtifact = class ImageArtifact extends ArtifactElement { + constructor() { + super(...arguments); + this._content = ""; + } + get content() { + return this._content; + } + set content(value) { + this._content = value; + this.requestUpdate(); + } + createRenderRoot() { + return this; + } + connectedCallback() { + super.connectedCallback(); + this.style.display = "block"; + this.style.height = "100%"; + } + getMimeType() { + const ext = this.filename.split(".").pop()?.toLowerCase(); + if (ext === "jpg" || ext === "jpeg") + return "image/jpeg"; + if (ext === "gif") + return "image/gif"; + if (ext === "webp") + return "image/webp"; + if (ext === "svg") + return "image/svg+xml"; + if (ext === "bmp") + return "image/bmp"; + if (ext === "ico") + return "image/x-icon"; + return "image/png"; + } + getImageUrl() { + // If content is already a data URL, use it directly + if (this._content.startsWith("data:")) { + return this._content; + } + // Otherwise assume it's base64 and construct data URL + return `data:${this.getMimeType()};base64,${this._content}`; + } + decodeBase64() { + let base64Data; + // If content is a data URL, extract the base64 part + if (this._content.startsWith("data:")) { + const base64Match = this._content.match(/base64,(.+)/); + if (base64Match) { + base64Data = base64Match[1]; + } + else { + // Not a base64 data URL, return empty + return new Uint8Array(0); + } + } + else { + // Otherwise use content as-is + base64Data = this._content; + } + // Decode base64 to binary string + const binaryString = atob(base64Data); + // Convert binary string to Uint8Array + const bytes = new Uint8Array(binaryString.length); + for (let i = 0; i < binaryString.length; i++) { + bytes[i] = binaryString.charCodeAt(i); + } + return bytes; + } + getHeaderButtons() { + return html ` +
+ ${DownloadButton({ + content: this.decodeBase64(), + filename: this.filename, + mimeType: this.getMimeType(), + title: i18n("Download"), + })} +
+ `; + } + render() { + return html ` +
+
+ ${this.filename} { + const target = e.target; + target.src = + "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ctext x='50' y='50' text-anchor='middle' dominant-baseline='middle' fill='%23999'%3EImage Error%3C/text%3E%3C/svg%3E"; + }} + /> +
+
+ `; + } +}; +__decorate([ + property({ type: String }) +], ImageArtifact.prototype, "_content", void 0); +ImageArtifact = __decorate([ + customElement("image-artifact") +], ImageArtifact); +export { ImageArtifact }; +//# sourceMappingURL=ImageArtifact.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ImageArtifact.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ImageArtifact.js.map new file mode 100644 index 000000000..454f603e6 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/ImageArtifact.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ImageArtifact.js","sourceRoot":"","sources":["../../../src/tools/artifacts/ImageArtifact.ts"],"names":[],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AO,IAAI,CAAA;;MAEP,cAAc,CAAC;YAChB,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE;YAC5B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE;YAC5B,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC;SACvB,CAAC;;GAEH,CAAC;IACH,CAAC;IAEQ,MAAM;QACd,OAAO,IAAI,CAAA;;;;aAIA,IAAI,CAAC,WAAW,EAAE;aAClB,IAAI,CAAC,QAAQ;;eAEX,CAAC,CAAQ,EAAE,EAAE;YACrB,MAAM,MAAM,GAAG,CAAC,CAAC,MAA0B,CAAC;YAC5C,MAAM,CAAC,GAAG;gBACT,6MAA6M,CAAC;QAChN,CAAC;;;;GAIJ,CAAC;IACH,CAAC;CACD,CAAA;AArGoC;IAAnC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAuB;AADtC,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CAsGzB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/MarkdownArtifact.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/MarkdownArtifact.d.ts new file mode 100644 index 000000000..a664be50f --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/MarkdownArtifact.d.ts @@ -0,0 +1,19 @@ +import "@mariozechner/mini-lit/dist/MarkdownBlock.js"; +import { ArtifactElement } from "./ArtifactElement.js"; +export declare class MarkdownArtifact extends ArtifactElement { + filename: string; + private _content; + get content(): string; + set content(value: string); + private viewMode; + protected createRenderRoot(): HTMLElement | DocumentFragment; + private setViewMode; + getHeaderButtons(): import("lit-html").TemplateResult<1>; + render(): import("lit-html").TemplateResult<1>; +} +declare global { + interface HTMLElementTagNameMap { + "markdown-artifact": MarkdownArtifact; + } +} +//# sourceMappingURL=MarkdownArtifact.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/MarkdownArtifact.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/MarkdownArtifact.d.ts.map new file mode 100644 index 000000000..1445e0bac --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/MarkdownArtifact.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"MarkdownArtifact.d.ts","sourceRoot":"","sources":["../../../src/tools/artifacts/MarkdownArtifact.ts"],"names":[],"mappings":"AAKA,OAAO,8CAA8C,CAAC;AAItD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,qBACa,gBAAiB,SAAQ,eAAe;IAC/B,QAAQ,SAAM;IAEnC,OAAO,CAAC,QAAQ,CAAM;IACtB,IAAa,OAAO,IAAI,MAAM,CAE7B;IACD,IAAa,OAAO,CAAC,KAAK,EAAE,MAAM,EAGjC;IAEQ,OAAO,CAAC,QAAQ,CAAiC;cAEvC,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAIrE,OAAO,CAAC,WAAW;IAIZ,gBAAgB;IA0Bd,MAAM;CAef;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,mBAAmB,EAAE,gBAAgB,CAAC;KACtC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/MarkdownArtifact.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/MarkdownArtifact.js new file mode 100644 index 000000000..2081d1b4a --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/MarkdownArtifact.js @@ -0,0 +1,82 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import hljs from "highlight.js"; +import { html } from "lit"; +import { customElement, property, state } from "lit/decorators.js"; +import { unsafeHTML } from "lit/directives/unsafe-html.js"; +import { i18n } from "../../utils/i18n.js"; +import "@mariozechner/mini-lit/dist/MarkdownBlock.js"; +import { CopyButton } from "@mariozechner/mini-lit/dist/CopyButton.js"; +import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js"; +import { PreviewCodeToggle } from "@mariozechner/mini-lit/dist/PreviewCodeToggle.js"; +import { ArtifactElement } from "./ArtifactElement.js"; +let MarkdownArtifact = class MarkdownArtifact extends ArtifactElement { + constructor() { + super(...arguments); + this.filename = ""; + this._content = ""; + this.viewMode = "preview"; + } + get content() { + return this._content; + } + set content(value) { + this._content = value; + this.requestUpdate(); + } + createRenderRoot() { + return this; // light DOM + } + setViewMode(mode) { + this.viewMode = mode; + } + getHeaderButtons() { + const toggle = new PreviewCodeToggle(); + toggle.mode = this.viewMode; + toggle.addEventListener("mode-change", (e) => { + this.setViewMode(e.detail); + }); + const copyButton = new CopyButton(); + copyButton.text = this._content; + copyButton.title = i18n("Copy Markdown"); + copyButton.showText = false; + return html ` +
+ ${toggle} + ${copyButton} + ${DownloadButton({ + content: this._content, + filename: this.filename, + mimeType: "text/markdown", + title: i18n("Download Markdown"), + })} +
+ `; + } + render() { + return html ` +
+
+ ${this.viewMode === "preview" + ? html `
` + : html `
${unsafeHTML(hljs.highlight(this.content, { language: "markdown", ignoreIllegals: true }).value)}
`} +
+
+ `; + } +}; +__decorate([ + property() +], MarkdownArtifact.prototype, "filename", void 0); +__decorate([ + state() +], MarkdownArtifact.prototype, "viewMode", void 0); +MarkdownArtifact = __decorate([ + customElement("markdown-artifact") +], MarkdownArtifact); +export { MarkdownArtifact }; +//# sourceMappingURL=MarkdownArtifact.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/MarkdownArtifact.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/MarkdownArtifact.js.map new file mode 100644 index 000000000..0dc1bd285 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/MarkdownArtifact.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MarkdownArtifact.js","sourceRoot":"","sources":["../../../src/tools/artifacts/MarkdownArtifact.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,IAAI,MAAM,cAAc,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,8CAA8C,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGhD,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,eAAe;IAA9C;;QACe,aAAQ,GAAG,EAAE,CAAC;QAE3B,aAAQ,GAAG,EAAE,CAAC;QASL,aAAQ,GAAuB,SAAS,CAAC;IAmD3D,CAAC;IA3DA,IAAa,OAAO;QACnB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IACD,IAAa,OAAO,CAAC,KAAa;QACjC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,aAAa,EAAE,CAAC;IACtB,CAAC;IAIkB,gBAAgB;QAClC,OAAO,IAAI,C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E;kDAAwB;AAWlB;IAAhB,KAAK,EAAE;kDAAkD;AAZ9C,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CA+D5B"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/PdfArtifact.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/PdfArtifact.d.ts new file mode 100644 index 000000000..a0c85801f --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/PdfArtifact.d.ts @@ -0,0 +1,25 @@ +import { type TemplateResult } from "lit"; +import { ArtifactElement } from "./ArtifactElement.js"; +export declare class PdfArtifact extends ArtifactElement { + private _content; + private error; + private currentLoadingTask; + get content(): string; + set content(value: string); + protected createRenderRoot(): HTMLElement | DocumentFragment; + connectedCallback(): void; + disconnectedCallback(): void; + private cleanup; + private base64ToArrayBuffer; + private decodeBase64; + getHeaderButtons(): TemplateResult<1>; + updated(changedProperties: Map): Promise; + private renderPdf; + render(): TemplateResult; +} +declare global { + interface HTMLElementTagNameMap { + "pdf-artifact": PdfArtifact; + } +} +//# sourceMappingURL=PdfArtifact.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/PdfArtifact.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/PdfArtifact.d.ts.map new file mode 100644 index 000000000..023fea872 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/PdfArtifact.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PdfArtifact.d.ts","sourceRoot":"","sources":["../../../src/tools/artifacts/PdfArtifact.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAIhD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAKvD,qBACa,WAAY,SAAQ,eAAe;IACnB,OAAO,CAAC,QAAQ,CAAM;IACzC,OAAO,CAAC,KAAK,CAAuB;IAC7C,OAAO,CAAC,kBAAkB,CAAa;IAEvC,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,MAAM,EAIxB;cAEkB,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAI5D,iBAAiB,IAAI,IAAI;IAMzB,oBAAoB,IAAI,IAAI;IAKrC,OAAO,CAAC,OAAO;IAOf,OAAO,CAAC,mBAAmB;IAkB3B,OAAO,CAAC,YAAY;IAiBb,gBAAgB;IAaR,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;YAQ5C,SAAS;IAwEd,MAAM,IAAI,cAAc;CAkBjC;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,cAAc,EAAE,WAAW,CAAC;KAC5B;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/PdfArtifact.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/PdfArtifact.js new file mode 100644 index 000000000..92bbb6f69 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/PdfArtifact.js @@ -0,0 +1,184 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js"; +import { html } from "lit"; +import { customElement, property, state } from "lit/decorators.js"; +import * as pdfjsLib from "pdfjs-dist"; +import { i18n } from "../../utils/i18n.js"; +import { ArtifactElement } from "./ArtifactElement.js"; +// Configure PDF.js worker +pdfjsLib.GlobalWorkerOptions.workerSrc = new URL("pdfjs-dist/build/pdf.worker.min.mjs", import.meta.url).toString(); +let PdfArtifact = class PdfArtifact extends ArtifactElement { + constructor() { + super(...arguments); + this._content = ""; + this.error = null; + this.currentLoadingTask = null; + } + get content() { + return this._content; + } + set content(value) { + this._content = value; + this.error = null; + this.requestUpdate(); + } + createRenderRoot() { + return this; + } + connectedCallback() { + super.connectedCallback(); + this.style.display = "block"; + this.style.height = "100%"; + } + disconnectedCallback() { + super.disconnectedCallback(); + this.cleanup(); + } + cleanup() { + if (this.currentLoadingTask) { + this.currentLoadingTask.destroy(); + this.currentLoadingTask = null; + } + } + base64ToArrayBuffer(base64) { + // Remove data URL prefix if present + let base64Data = base64; + if (base64.startsWith("data:")) { + const base64Match = base64.match(/base64,(.+)/); + if (base64Match) { + base64Data = base64Match[1]; + } + } + const binaryString = atob(base64Data); + const bytes = new Uint8Array(binaryString.length); + for (let i = 0; i < binaryString.length; i++) { + bytes[i] = binaryString.charCodeAt(i); + } + return bytes.buffer; + } + decodeBase64() { + let base64Data = this._content; + if (this._content.startsWith("data:")) { + const base64Match = this._content.match(/base64,(.+)/); + if (base64Match) { + base64Data = base64Match[1]; + } + } + const binaryString = atob(base64Data); + const bytes = new Uint8Array(binaryString.length); + for (let i = 0; i < binaryString.length; i++) { + bytes[i] = binaryString.charCodeAt(i); + } + return bytes; + } + getHeaderButtons() { + return html ` +
+ ${DownloadButton({ + content: this.decodeBase64(), + filename: this.filename, + mimeType: "application/pdf", + title: i18n("Download"), + })} +
+ `; + } + async updated(changedProperties) { + super.updated(changedProperties); + if (changedProperties.has("_content") && this._content && !this.error) { + await this.renderPdf(); + } + } + async renderPdf() { + const container = this.querySelector("#pdf-container"); + if (!container || !this._content) + return; + let pdf = null; + try { + const arrayBuffer = this.base64ToArrayBuffer(this._content); + // Cancel any existing loading task + if (this.currentLoadingTask) { + this.currentLoadingTask.destroy(); + } + // Load the PDF + this.currentLoadingTask = pdfjsLib.getDocument({ data: arrayBuffer }); + pdf = await this.currentLoadingTask.promise; + this.currentLoadingTask = null; + // Clear container + container.innerHTML = ""; + const wrapper = document.createElement("div"); + wrapper.className = "p-4"; + container.appendChild(wrapper); + // Render all pages + for (let pageNum = 1; pageNum <= pdf.numPages; pageNum++) { + const page = await pdf.getPage(pageNum); + const pageContainer = document.createElement("div"); + pageContainer.className = "mb-4 last:mb-0"; + const canvas = document.createElement("canvas"); + const context = canvas.getContext("2d"); + const viewport = page.getViewport({ scale: 1.5 }); + canvas.height = viewport.height; + canvas.width = viewport.width; + canvas.className = "w-full max-w-full h-auto block mx-auto bg-white rounded shadow-sm border border-border"; + if (context) { + context.fillStyle = "white"; + context.fillRect(0, 0, canvas.width, canvas.height); + } + await page.render({ + canvasContext: context, + viewport: viewport, + canvas: canvas, + }).promise; + pageContainer.appendChild(canvas); + if (pageNum < pdf.numPages) { + const separator = document.createElement("div"); + separator.className = "h-px bg-border my-4"; + pageContainer.appendChild(separator); + } + wrapper.appendChild(pageContainer); + } + } + catch (error) { + console.error("Error rendering PDF:", error); + this.error = error?.message || i18n("Failed to load PDF"); + } + finally { + if (pdf) { + pdf.destroy(); + } + } + } + render() { + if (this.error) { + return html ` +
+
+
${i18n("Error loading PDF")}
+
${this.error}
+
+
+ `; + } + return html ` +
+
+
+ `; + } +}; +__decorate([ + property({ type: String }) +], PdfArtifact.prototype, "_content", void 0); +__decorate([ + state() +], PdfArtifact.prototype, "error", void 0); +PdfArtifact = __decorate([ + customElement("pdf-artifact") +], PdfArtifact); +export { PdfArtifact }; +//# sourceMappingURL=PdfArtifact.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/PdfArtifact.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/PdfArtifact.js.map new file mode 100644 index 000000000..19bb5ed9e --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/P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AAA;AAtLoC;IAAnC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAuB;AACjC;IAAhB,KAAK,EAAE;0CAAqC;AAFjC,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAuLvB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/SvgArtifact.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/SvgArtifact.d.ts new file mode 100644 index 000000000..0677f3e93 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/SvgArtifact.d.ts @@ -0,0 +1,18 @@ +import { ArtifactElement } from "./ArtifactElement.js"; +export declare class SvgArtifact extends ArtifactElement { + filename: string; + private _content; + get content(): string; + set content(value: string); + private viewMode; + protected createRenderRoot(): HTMLElement | DocumentFragment; + private setViewMode; + getHeaderButtons(): import("lit-html").TemplateResult<1>; + render(): import("lit-html").TemplateResult<1>; +} +declare global { + interface HTMLElementTagNameMap { + "svg-artifact": SvgArtifact; + } +} +//# sourceMappingURL=SvgArtifact.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/SvgArtifact.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/SvgArtifact.d.ts.map new file mode 100644 index 000000000..cfe5bd828 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/SvgArtifact.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"SvgArtifact.d.ts","sourceRoot":"","sources":["../../../src/tools/artifacts/SvgArtifact.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,qBACa,WAAY,SAAQ,eAAe;IAC1B,QAAQ,SAAM;IAEnC,OAAO,CAAC,QAAQ,CAAM;IACtB,IAAa,OAAO,IAAI,MAAM,CAE7B;IACD,IAAa,OAAO,CAAC,KAAK,EAAE,MAAM,EAGjC;IAEQ,OAAO,CAAC,QAAQ,CAAiC;cAEvC,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAIrE,OAAO,CAAC,WAAW;IAIZ,gBAAgB;IAqBd,MAAM;CAiBf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,cAAc,EAAE,WAAW,CAAC;KAC5B;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/SvgArtifact.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/SvgArtifact.js new file mode 100644 index 000000000..d52ae9c00 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/SvgArtifact.js @@ -0,0 +1,78 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { CopyButton } from "@mariozechner/mini-lit/dist/CopyButton.js"; +import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js"; +import { PreviewCodeToggle } from "@mariozechner/mini-lit/dist/PreviewCodeToggle.js"; +import hljs from "highlight.js"; +import { html } from "lit"; +import { customElement, property, state } from "lit/decorators.js"; +import { unsafeHTML } from "lit/directives/unsafe-html.js"; +import { i18n } from "../../utils/i18n.js"; +import { ArtifactElement } from "./ArtifactElement.js"; +let SvgArtifact = class SvgArtifact extends ArtifactElement { + constructor() { + super(...arguments); + this.filename = ""; + this._content = ""; + this.viewMode = "preview"; + } + get content() { + return this._content; + } + set content(value) { + this._content = value; + this.requestUpdate(); + } + createRenderRoot() { + return this; // light DOM + } + setViewMode(mode) { + this.viewMode = mode; + } + getHeaderButtons() { + const toggle = new PreviewCodeToggle(); + toggle.mode = this.viewMode; + toggle.addEventListener("mode-change", (e) => { + this.setViewMode(e.detail); + }); + const copyButton = new CopyButton(); + copyButton.text = this._content; + copyButton.title = i18n("Copy SVG"); + copyButton.showText = false; + return html ` +
+ ${toggle} + ${copyButton} + ${DownloadButton({ content: this._content, filename: this.filename, mimeType: "image/svg+xml", title: i18n("Download SVG") })} +
+ `; + } + render() { + return html ` +
+
+ ${this.viewMode === "preview" + ? html `
+ ${unsafeHTML(this.content.replace(/)/i, (_m, p1) => `` + : html `
${unsafeHTML(hljs.highlight(this.content, { language: "xml", ignoreIllegals: true }).value)}
`} +
+
+ `; + } +}; +__decorate([ + property() +], SvgArtifact.prototype, "filename", void 0); +__decorate([ + state() +], SvgArtifact.prototype, "viewMode", void 0); +SvgArtifact = __decorate([ + customElement("svg-artifact") +], SvgArtifact); +export { SvgArtifact }; +//# sourceMappingURL=SvgArtifact.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/SvgArtifact.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/SvgArtifact.js.map new file mode 100644 index 000000000..993188459 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/SvgArtifact.js.map @@ -0,0 +1 @@ +{"version":3,"file":"SvgArtifact.js","sourceRoot":"","sources":["../../../src/tools/artifacts/SvgArtifact.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AACrF,OAAO,IAAI,MAAM,cAAc,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,QAAQ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MACV,cAAc,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC;;GAE9H,CAAC;IACH,CAAC;IAEQ,MAAM;QACd,OAAO,IAAI,CAAA;;;OAIP,IAAI,CAAC,QAAQ,KAAK,SAAS;YAC1B,CAAC,CAAC,IAAI,CAAA;UACH,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC;cAC1F;YACP,CAAC,CAAC,IAAI,CAAA,gEAAgE,UAAU,CAC9E,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAC7E,eACJ;;;GAGF,CAAC;IACH,CAAC;CACD,CAAA;AA3DqB;IAApB,QAAQ,EAAE;6CAAwB;AAWlB;IAAhB,KAAK,EAAE;6CAAkD;AAZ9C,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CA4DvB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/TextArtifact.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/TextArtifact.d.ts new file mode 100644 index 000000000..6f234474a --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/TextArtifact.d.ts @@ -0,0 +1,19 @@ +import { ArtifactElement } from "./ArtifactElement.js"; +export declare class TextArtifact extends ArtifactElement { + filename: string; + private _content; + get content(): string; + set content(value: string); + protected createRenderRoot(): HTMLElement | DocumentFragment; + private isCode; + private getLanguageFromExtension; + private getMimeType; + getHeaderButtons(): import("lit-html").TemplateResult<1>; + render(): import("lit-html").TemplateResult<1>; +} +declare global { + interface HTMLElementTagNameMap { + "text-artifact": TextArtifact; + } +} +//# sourceMappingURL=TextArtifact.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/TextArtifact.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/TextArtifact.d.ts.map new file mode 100644 index 000000000..73dcc914d --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/TextArtifact.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"TextArtifact.d.ts","sourceRoot":"","sources":["../../../src/tools/artifacts/TextArtifact.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAiDvD,qBACa,YAAa,SAAQ,eAAe;IAC3B,QAAQ,SAAM;IAEnC,OAAO,CAAC,QAAQ,CAAM;IACtB,IAAa,OAAO,IAAI,MAAM,CAE7B;IACD,IAAa,OAAO,CAAC,KAAK,EAAE,MAAM,EAGjC;cAEkB,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAIrE,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,wBAAwB;IAahC,OAAO,CAAC,WAAW;IAOZ,gBAAgB;IAmBd,MAAM;CAwBf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,eAAe,EAAE,YAAY,CAAC;KAC9B;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/TextArtifact.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/TextArtifact.js new file mode 100644 index 000000000..2875df8c4 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/TextArtifact.js @@ -0,0 +1,144 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { CopyButton } from "@mariozechner/mini-lit/dist/CopyButton.js"; +import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js"; +import hljs from "highlight.js"; +import { html } from "lit"; +import { customElement, property } from "lit/decorators.js"; +import { unsafeHTML } from "lit/directives/unsafe-html.js"; +import { i18n } from "../../utils/i18n.js"; +import { ArtifactElement } from "./ArtifactElement.js"; +// Known code file extensions for highlighting +const CODE_EXTENSIONS = [ + "js", + "javascript", + "ts", + "typescript", + "jsx", + "tsx", + "py", + "python", + "java", + "c", + "cpp", + "cs", + "php", + "rb", + "ruby", + "go", + "rust", + "swift", + "kotlin", + "scala", + "dart", + "html", + "css", + "scss", + "sass", + "less", + "json", + "xml", + "yaml", + "yml", + "toml", + "sql", + "sh", + "bash", + "ps1", + "bat", + "r", + "matlab", + "julia", + "lua", + "perl", + "vue", + "svelte", +]; +let TextArtifact = class TextArtifact extends ArtifactElement { + constructor() { + super(...arguments); + this.filename = ""; + this._content = ""; + } + get content() { + return this._content; + } + set content(value) { + this._content = value; + this.requestUpdate(); + } + createRenderRoot() { + return this; // light DOM + } + isCode() { + const ext = this.filename.split(".").pop()?.toLowerCase() || ""; + return CODE_EXTENSIONS.includes(ext); + } + getLanguageFromExtension(ext) { + const languageMap = { + js: "javascript", + ts: "typescript", + py: "python", + rb: "ruby", + yml: "yaml", + ps1: "powershell", + bat: "batch", + }; + return languageMap[ext] || ext; + } + getMimeType() { + const ext = this.filename.split(".").pop()?.toLowerCase() || ""; + if (ext === "svg") + return "image/svg+xml"; + if (ext === "md" || ext === "markdown") + return "text/markdown"; + return "text/plain"; + } + getHeaderButtons() { + const copyButton = new CopyButton(); + copyButton.text = this.content; + copyButton.title = i18n("Copy"); + copyButton.showText = false; + return html ` +
+ ${copyButton} + ${DownloadButton({ + content: this.content, + filename: this.filename, + mimeType: this.getMimeType(), + title: i18n("Download"), + })} +
+ `; + } + render() { + const isCode = this.isCode(); + const ext = this.filename.split(".").pop() || ""; + return html ` +
+
+ ${isCode + ? html ` +
${unsafeHTML(hljs.highlight(this.content, {
+                language: this.getLanguageFromExtension(ext.toLowerCase()),
+                ignoreIllegals: true,
+            }).value)}
+ ` + : html `
${this.content}
`} +
+
+ `; + } +}; +__decorate([ + property() +], TextArtifact.prototype, "filename", void 0); +TextArtifact = __decorate([ + customElement("text-artifact") +], TextArtifact); +export { TextArtifact }; +//# sourceMappingURL=TextArtifact.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/TextArtifact.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/TextArtifact.js.map new file mode 100644 index 000000000..ffc9f3636 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/TextArtifact.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextArtifact.js","sourceRoot":"","sources":["../../../src/tools/artifacts/TextArtifact.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,IAAI,MAAM,cAAc,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,8CAA8C;AAC9C,MAAM,eAAe,GAAG;IACvB,IAAI;IACJ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KAAK,UAAU,CACf,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE;gBAC5B,QAAQ,EAAE,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;gBAC1D,cAAc,EAAE,IAAI;aACpB,CAAC,CAAC,KAAK,CACR;QACD;YACD,CAAC,CAAC,IAAI,CAAA,2CAA2C,IAAI,CAAC,OAAO,SAC/D;;;GAGF,CAAC;IACH,CAAC;CACD,CAAA;AAnFqB;IAApB,QAAQ,EAAE;8CAAwB;AADvB,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAoFxB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts-tool-renderer.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts-tool-renderer.d.ts new file mode 100644 index 000000000..a2ebf7125 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts-tool-renderer.d.ts @@ -0,0 +1,11 @@ +import "@mariozechner/mini-lit/dist/CodeBlock.js"; +import type { ToolResultMessage } from "@mariozechner/pi-ai"; +import "../../components/ConsoleBlock.js"; +import type { ToolRenderer, ToolRenderResult } from "../types.js"; +import type { ArtifactsPanel, ArtifactsParams } from "./artifacts.js"; +export declare class ArtifactsToolRenderer implements ToolRenderer { + artifactsPanel?: ArtifactsPanel | undefined; + constructor(artifactsPanel?: ArtifactsPanel | undefined); + render(params: ArtifactsParams | undefined, result: ToolResultMessage | undefined, isStreaming?: boolean): ToolRenderResult; +} +//# sourceMappingURL=artifacts-tool-renderer.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts-tool-renderer.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts-tool-renderer.d.ts.map new file mode 100644 index 000000000..3ae1a2e67 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts-tool-renderer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"artifacts-tool-renderer.d.ts","sourceRoot":"","sources":["../../../src/tools/artifacts/artifacts-tool-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAG7D,OAAO,kCAAkC,CAAC;AAK1C,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAElE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAkDtE,qBAAa,qBAAsB,YAAW,YAAY,CAAC,eAAe,EAAE,SAAS,CAAC;IAClE,cAAc,CAAC,EAAE,cAAc;gBAA/B,cAAc,CAAC,EAAE,cAAc,YAAA;IAElD,MAAM,CACL,MAAM,EAAE,eAAe,GAAG,SAAS,EACnC,MAAM,EAAE,iBAAiB,CAAC,SAAS,CAAC,GAAG,SAAS,EAChD,WAAW,CAAC,EAAE,OAAO,GACnB,gBAAgB;CAiPnB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts-tool-renderer.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts-tool-renderer.js new file mode 100644 index 000000000..108d99fc2 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts-tool-renderer.js @@ -0,0 +1,272 @@ +import "@mariozechner/mini-lit/dist/CodeBlock.js"; +import { createRef, ref } from "lit/directives/ref.js"; +import { FileCode2 } from "lucide"; +import "../../components/ConsoleBlock.js"; +import { Diff } from "@mariozechner/mini-lit/dist/Diff.js"; +import { html } from "lit"; +import { i18n } from "../../utils/i18n.js"; +import { renderCollapsibleHeader, renderHeader } from "../renderer-registry.js"; +import { ArtifactPill } from "./ArtifactPill.js"; +// Helper to extract text from content blocks +function getTextOutput(result) { + if (!result) + return ""; + return (result.content + ?.filter((c) => c.type === "text") + .map((c) => c.text) + .join("\n") || ""); +} +// Helper to determine language for syntax highlighting +function getLanguageFromFilename(filename) { + if (!filename) + return "text"; + const ext = filename.split(".").pop()?.toLowerCase(); + const languageMap = { + js: "javascript", + jsx: "javascript", + ts: "typescript", + tsx: "typescript", + html: "html", + css: "css", + scss: "scss", + json: "json", + py: "python", + md: "markdown", + svg: "xml", + xml: "xml", + yaml: "yaml", + yml: "yaml", + sh: "bash", + bash: "bash", + sql: "sql", + java: "java", + c: "c", + cpp: "cpp", + cs: "csharp", + go: "go", + rs: "rust", + php: "php", + rb: "ruby", + swift: "swift", + kt: "kotlin", + r: "r", + }; + return languageMap[ext || ""] || "text"; +} +export class ArtifactsToolRenderer { + constructor(artifactsPanel) { + this.artifactsPanel = artifactsPanel; + } + render(params, result, isStreaming) { + const state = result ? (result.isError ? "error" : "complete") : isStreaming ? "inprogress" : "complete"; + // Create refs for collapsible sections + const contentRef = createRef(); + const chevronRef = createRef(); + // Helper to get command labels + const getCommandLabels = (command) => { + const labels = { + create: { streaming: i18n("Creating artifact"), complete: i18n("Created artifact") }, + update: { streaming: i18n("Updating artifact"), complete: i18n("Updated artifact") }, + rewrite: { streaming: i18n("Rewriting artifact"), complete: i18n("Rewrote artifact") }, + get: { streaming: i18n("Getting artifact"), complete: i18n("Got artifact") }, + delete: { streaming: i18n("Deleting artifact"), complete: i18n("Deleted artifact") }, + logs: { streaming: i18n("Getting logs"), complete: i18n("Got logs") }, + }; + return labels[command] || { streaming: i18n("Processing artifact"), complete: i18n("Processed artifact") }; + }; + // Helper to render header text with inline artifact pill + const renderHeaderWithPill = (labelText, filename) => { + if (filename) { + return html `${labelText} ${ArtifactPill(filename, this.artifactsPanel)}`; + } + return html `${labelText}`; + }; + // Error handling + if (result?.isError) { + const command = params?.command; + const filename = params?.filename; + const labels = command + ? getCommandLabels(command) + : { streaming: i18n("Processing artifact"), complete: i18n("Processed artifact") }; + const headerText = labels.streaming; + // For create/update/rewrite errors, show code block + console/error + if (command === "create" || command === "update" || command === "rewrite") { + const content = params?.content || ""; + const { old_str, new_str } = params || {}; + const isDiff = command === "update"; + const diffContent = old_str !== undefined && new_str !== undefined ? Diff({ oldText: old_str, newText: new_str }) : ""; + const isHtml = filename?.endsWith(".html"); + return { + content: html ` +
+ ${renderCollapsibleHeader(state, FileCode2, renderHeaderWithPill(headerText, filename), contentRef, chevronRef, false)} +
+ ${isDiff ? diffContent : content ? html `` : ""} + ${isHtml + ? html `` + : html `
${getTextOutput(result) || i18n("An error occurred")}
`} +
+
+ `, + isCustom: false, + }; + } + // For other errors, just show error message + return { + content: html ` +
+ ${renderHeader(state, FileCode2, headerText)} +
${getTextOutput(result) || i18n("An error occurred")}
+
+ `, + isCustom: false, + }; + } + // Full params + result + if (result && params) { + const { command, filename, content } = params; + const labels = command + ? getCommandLabels(command) + : { streaming: i18n("Processing artifact"), complete: i18n("Processed artifact") }; + const headerText = labels.complete; + // GET command: show code block with file content + if (command === "get") { + const fileContent = getTextOutput(result) || i18n("(no output)"); + return { + content: html ` +
+ ${renderCollapsibleHeader(state, FileCode2, renderHeaderWithPill(headerText, filename), contentRef, chevronRef, false)} +
+ +
+
+ `, + isCustom: false, + }; + } + // LOGS command: show console block + if (command === "logs") { + const logs = getTextOutput(result) || i18n("(no output)"); + return { + content: html ` +
+ ${renderCollapsibleHeader(state, FileCode2, renderHeaderWithPill(headerText, filename), contentRef, chevronRef, false)} +
+ +
+
+ `, + isCustom: false, + }; + } + // CREATE/UPDATE/REWRITE: always show code block, + console block for .html files + if (command === "create" || command === "rewrite") { + const codeContent = content || ""; + const isHtml = filename?.endsWith(".html"); + const logs = getTextOutput(result) || ""; + return { + content: html ` +
+ ${renderCollapsibleHeader(state, FileCode2, renderHeaderWithPill(headerText, filename), contentRef, chevronRef, false)} +
+ ${codeContent ? html `` : ""} + ${isHtml && logs ? html `` : ""} +
+
+ `, + isCustom: false, + }; + } + if (command === "update") { + const isHtml = filename?.endsWith(".html"); + const logs = getTextOutput(result) || ""; + return { + content: html ` +
+ ${renderCollapsibleHeader(state, FileCode2, renderHeaderWithPill(headerText, filename), contentRef, chevronRef, false)} +
+ ${Diff({ oldText: params.old_str || "", newText: params.new_str || "" })} + ${isHtml && logs ? html `` : ""} +
+
+ `, + isCustom: false, + }; + } + // For DELETE, just show header + return { + content: html ` +
+ ${renderHeader(state, FileCode2, renderHeaderWithPill(headerText, filename))} +
+ `, + isCustom: false, + }; + } + // Params only (streaming or waiting for result) + if (params) { + const { command, filename, content, old_str, new_str } = params; + // If no command yet + if (!command) { + return { content: renderHeader(state, FileCode2, i18n("Preparing artifact...")), isCustom: false }; + } + const labels = getCommandLabels(command); + const headerText = labels.streaming; + // Render based on command type + switch (command) { + case "create": + case "rewrite": + return { + content: html ` +
+ ${renderCollapsibleHeader(state, FileCode2, renderHeaderWithPill(headerText, filename), contentRef, chevronRef, false)} +
+ ${content + ? html `` + : ""} +
+
+ `, + isCustom: false, + }; + case "update": + return { + content: html ` +
+ ${renderCollapsibleHeader(state, FileCode2, renderHeaderWithPill(headerText, filename), contentRef, chevronRef, false)} +
+ ${old_str !== undefined && new_str !== undefined + ? Diff({ oldText: old_str, newText: new_str }) + : ""} +
+
+ `, + isCustom: false, + }; + case "get": + case "logs": + return { + content: html ` +
+ ${renderCollapsibleHeader(state, FileCode2, renderHeaderWithPill(headerText, filename), contentRef, chevronRef, false)} +
+
+ `, + isCustom: false, + }; + default: + return { + content: html ` +
+ ${renderHeader(state, FileCode2, renderHeaderWithPill(headerText, filename))} +
+ `, + isCustom: false, + }; + } + } + // No params or result yet + return { content: renderHeader(state, FileCode2, i18n("Preparing artifact...")), isCustom: false }; + } +} +//# sourceMappingURL=artifacts-tool-renderer.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts-tool-renderer.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts-tool-renderer.js.map new file mode 100644 index 000000000..6e69c51a3 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts-tool-renderer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"artifacts-tool-renderer.js","sourceRoot":"","sources":["../../../src/tools/artifacts/artifacts-tool-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,0CAA0C,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,6CAA6C;AAC7C,SAAS,aAAa,CAAC,MAA0C;IAChE,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,OAAO,CACN,MAAM,CAAC,OAAO;QACb,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC;SACjC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;SACvB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAClB,CAAC;AACH,CAAC;AAED,uDAAuD;AACvD,SAAS,uBAAuB,CAAC,QAAiB;IACjD,IAAI,CAAC,QAAQ;QAAE,OAAO,MAAM,CAAC;IAC7B,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,CAAC;IACrD,MAAM,WAAW,GAA2B;QAC3C,EAAE,EAAE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U,EAAE,QAAQ,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,CAAC;cAC/G,GAAG,CAAC,UAAU,CAAC;;MAEvB;wBACA,QAAQ,EAAE,KAAK;qBACf,CAAC;gBAEH;oBACC,OAAO;wBACN,OAAO,EAAE,IAAI,CAAA;;SAEV,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,oBAAoB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;;MAE7E;wBACA,QAAQ,EAAE,KAAK;qBACf,CAAC;YACJ,CAAC;QACF,CAAC;QAED,0BAA0B;QAC1B,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,uBAAuB,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IACpG,CAAC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts.d.ts new file mode 100644 index 000000000..61c351a9d --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts.d.ts @@ -0,0 +1,64 @@ +import "@mariozechner/mini-lit/dist/MarkdownBlock.js"; +import { type AgentTool, type Message } from "@mariozechner/pi-ai"; +import { type Static } from "@sinclair/typebox"; +import { LitElement, type TemplateResult } from "lit"; +import type { Agent } from "../../agent/agent.js"; +export interface Artifact { + filename: string; + content: string; + createdAt: Date; + updatedAt: Date; +} +declare const artifactsParamsSchema: import("@sinclair/typebox").TObject<{ + command: import("@sinclair/typebox").TUnsafe; + filename: import("@sinclair/typebox").TString; + content: import("@sinclair/typebox").TOptional; + old_str: import("@sinclair/typebox").TOptional; + new_str: import("@sinclair/typebox").TOptional; +}>; +export type ArtifactsParams = Static; +export declare class ArtifactsPanel extends LitElement { + private _artifacts; + private _activeFilename; + private artifactElements; + private contentRef; + agent?: Agent; + sandboxUrlProvider?: () => string; + onArtifactsChange?: () => void; + onClose?: () => void; + onOpen?: () => void; + collapsed: boolean; + overlay: boolean; + get artifacts(): Map; + private getHtmlArtifactRuntimeProviders; + protected createRenderRoot(): HTMLElement | DocumentFragment; + connectedCallback(): void; + disconnectedCallback(): void; + private getFileType; + private getOrCreateArtifactElement; + private showArtifact; + openArtifact(filename: string): void; + get tool(): AgentTool; + reconstructFromMessages(messages: Array): Promise; + private executeCommand; + private waitForHtmlExecution; + private reloadAllHtmlArtifacts; + private createArtifact; + private updateArtifact; + private rewriteArtifact; + private getArtifact; + private deleteArtifact; + private getLogs; + render(): TemplateResult; +} +declare global { + interface HTMLElementTagNameMap { + "artifacts-panel": ArtifactsPanel; + } +} +export {}; +//# sourceMappingURL=artifacts.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts.d.ts.map new file mode 100644 index 000000000..a6c4526f6 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../../src/tools/artifacts/artifacts.ts"],"names":[],"mappings":"AACA,OAAO,8CAA8C,CAAC;AAEtD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAA6B,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAQ,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAI5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAwBlD,MAAM,WAAW,QAAQ;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CAChB;AAGD,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qDjC;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,iBAAiB,EAAE,cAAc,CAAC;KAClC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts.js new file mode 100644 index 000000000..7dd431a9b --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts.js @@ -0,0 +1,659 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { icon } from "@mariozechner/mini-lit"; +import "@mariozechner/mini-lit/dist/MarkdownBlock.js"; +import { Button } from "@mariozechner/mini-lit/dist/Button.js"; +import { StringEnum } from "@mariozechner/pi-ai"; +import { Type } from "@sinclair/typebox"; +import { html, LitElement } from "lit"; +import { customElement, property, state } from "lit/decorators.js"; +import { createRef, ref } from "lit/directives/ref.js"; +import { X } from "lucide"; +import { ArtifactsRuntimeProvider } from "../../components/sandbox/ArtifactsRuntimeProvider.js"; +import { AttachmentsRuntimeProvider } from "../../components/sandbox/AttachmentsRuntimeProvider.js"; +import { ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RO, ARTIFACTS_TOOL_DESCRIPTION, ATTACHMENTS_RUNTIME_DESCRIPTION, } from "../../prompts/prompts.js"; +import { i18n } from "../../utils/i18n.js"; +import { DocxArtifact } from "./DocxArtifact.js"; +import { ExcelArtifact } from "./ExcelArtifact.js"; +import { GenericArtifact } from "./GenericArtifact.js"; +import { HtmlArtifact } from "./HtmlArtifact.js"; +import { ImageArtifact } from "./ImageArtifact.js"; +import { MarkdownArtifact } from "./MarkdownArtifact.js"; +import { PdfArtifact } from "./PdfArtifact.js"; +import { SvgArtifact } from "./SvgArtifact.js"; +import { TextArtifact } from "./TextArtifact.js"; +// JSON-schema friendly parameters object (LLM-facing) +const artifactsParamsSchema = Type.Object({ + command: StringEnum(["create", "update", "rewrite", "get", "delete", "logs"], { + description: "The operation to perform", + }), + filename: Type.String({ description: "Filename including extension (e.g., 'index.html', 'script.js')" }), + content: Type.Optional(Type.String({ description: "File content" })), + old_str: Type.Optional(Type.String({ description: "String to replace (for update command)" })), + new_str: Type.Optional(Type.String({ description: "Replacement string (for update command)" })), +}); +let ArtifactsPanel = class ArtifactsPanel extends LitElement { + constructor() { + super(...arguments); + this._artifacts = new Map(); + this._activeFilename = null; + // Programmatically managed artifact elements + this.artifactElements = new Map(); + this.contentRef = createRef(); + // Collapsed mode: hides panel content but can show a floating reopen pill + this.collapsed = false; + // Overlay mode: when true, panel renders full-screen overlay (mobile) + this.overlay = false; + } + // Public getter for artifacts + get artifacts() { + return this._artifacts; + } + // Get runtime providers for HTML artifacts (read-only: attachments + artifacts) + getHtmlArtifactRuntimeProviders() { + const providers = []; + // Get attachments from agent messages + if (this.agent) { + const attachments = []; + for (const message of this.agent.state.messages) { + if (message.role === "user" && message.attachments) { + attachments.push(...message.attachments); + } + } + if (attachments.length > 0) { + providers.push(new AttachmentsRuntimeProvider(attachments)); + } + } + // Add read-only artifacts provider + providers.push(new ArtifactsRuntimeProvider(this, this.agent, false)); + return providers; + } + createRenderRoot() { + return this; // light DOM for shared styles + } + connectedCallback() { + super.connectedCallback(); + this.style.display = "block"; + this.style.height = "100%"; + // Reattach existing artifact elements when panel is re-inserted into the DOM + requestAnimationFrame(() => { + const container = this.contentRef.value; + if (!container) + return; + // Ensure we have an active filename + if (!this._activeFilename && this._artifacts.size > 0) { + this._activeFilename = Array.from(this._artifacts.keys())[0]; + } + this.artifactElements.forEach((element, name) => { + if (!element.parentElement) + container.appendChild(element); + element.style.display = name === this._activeFilename ? "block" : "none"; + }); + }); + } + disconnectedCallback() { + super.disconnectedCallback(); + // Do not tear down artifact elements; keep them to restore on next mount + } + // Helper to determine file type from extension + getFileType(filename) { + const ext = filename.split(".").pop()?.toLowerCase(); + if (ext === "html") + return "html"; + if (ext === "svg") + return "svg"; + if (ext === "md" || ext === "markdown") + return "markdown"; + if (ext === "pdf") + return "pdf"; + if (ext === "xlsx" || ext === "xls") + return "excel"; + if (ext === "docx") + return "docx"; + if (ext === "png" || + ext === "jpg" || + ext === "jpeg" || + ext === "gif" || + ext === "webp" || + ext === "bmp" || + ext === "ico") + return "image"; + // Text files + if (ext === "txt" || + ext === "json" || + ext === "xml" || + ext === "yaml" || + ext === "yml" || + ext === "csv" || + ext === "js" || + ext === "ts" || + ext === "jsx" || + ext === "tsx" || + ext === "py" || + ext === "java" || + ext === "c" || + ext === "cpp" || + ext === "h" || + ext === "css" || + ext === "scss" || + ext === "sass" || + ext === "less" || + ext === "sh") + return "text"; + // Everything else gets generic fallback + return "generic"; + } + // Get or create artifact element + getOrCreateArtifactElement(filename, content) { + let element = this.artifactElements.get(filename); + if (!element) { + const type = this.getFileType(filename); + if (type === "html") { + element = new HtmlArtifact(); + element.runtimeProviders = this.getHtmlArtifactRuntimeProviders(); + if (this.sandboxUrlProvider) { + element.sandboxUrlProvider = this.sandboxUrlProvider; + } + } + else if (type === "svg") { + element = new SvgArtifact(); + } + else if (type === "markdown") { + element = new MarkdownArtifact(); + } + else if (type === "image") { + element = new ImageArtifact(); + } + else if (type === "pdf") { + element = new PdfArtifact(); + } + else if (type === "excel") { + element = new ExcelArtifact(); + } + else if (type === "docx") { + element = new DocxArtifact(); + } + else if (type === "text") { + element = new TextArtifact(); + } + else { + element = new GenericArtifact(); + } + element.filename = filename; + element.content = content; + element.style.display = "none"; + element.style.height = "100%"; + // Store element + this.artifactElements.set(filename, element); + // Add to DOM - try immediately if container exists, otherwise schedule + const newElement = element; + if (this.contentRef.value) { + this.contentRef.value.appendChild(newElement); + } + else { + requestAnimationFrame(() => { + if (this.contentRef.value && !newElement.parentElement) { + this.contentRef.value.appendChild(newElement); + } + }); + } + } + else { + // Just update content + element.content = content; + if (element instanceof HtmlArtifact) { + element.runtimeProviders = this.getHtmlArtifactRuntimeProviders(); + } + } + return element; + } + // Show/hide artifact elements + showArtifact(filename) { + // Ensure the active element is in the DOM + requestAnimationFrame(() => { + this.artifactElements.forEach((element, name) => { + if (this.contentRef.value && !element.parentElement) { + this.contentRef.value.appendChild(element); + } + element.style.display = name === filename ? "block" : "none"; + }); + }); + this._activeFilename = filename; + this.requestUpdate(); // Only for tab bar update + // Scroll the active tab into view after render + requestAnimationFrame(() => { + const activeButton = this.querySelector(`button[data-filename="${filename}"]`); + if (activeButton) { + activeButton.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "center" }); + } + }); + } + // Open panel and focus an artifact tab by filename + openArtifact(filename) { + if (this._artifacts.has(filename)) { + this.showArtifact(filename); + // Ask host to open panel (AgentInterface demo listens to onOpen) + this.onOpen?.(); + } + } + // Build the AgentTool (no details payload; return only output strings) + get tool() { + return { + label: "Artifacts", + name: "artifacts", + get description() { + // HTML artifacts have read-only access to attachments and artifacts + const runtimeProviderDescriptions = [ + ATTACHMENTS_RUNTIME_DESCRIPTION, + ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RO, + ]; + return ARTIFACTS_TOOL_DESCRIPTION(runtimeProviderDescriptions); + }, + parameters: artifactsParamsSchema, + // Execute mutates our local store and returns a plain output + execute: async (_toolCallId, args, _signal) => { + const output = await this.executeCommand(args); + return { content: [{ type: "text", text: output }], details: undefined }; + }, + }; + } + // Re-apply artifacts by scanning a message list (optional utility) + async reconstructFromMessages(messages) { + const toolCalls = new Map(); + const artifactToolName = "artifacts"; + // 1) Collect tool calls from assistant messages + for (const message of messages) { + if (message.role === "assistant") { + for (const block of message.content) { + if (block.type === "toolCall" && block.name === artifactToolName) { + toolCalls.set(block.id, block); + } + } + } + } + // 2) Build an ordered list of successful artifact operations + const operations = []; + for (const m of messages) { + if (m.role === "artifact") { + const artifactMsg = m; + switch (artifactMsg.action) { + case "create": + operations.push({ + command: "create", + filename: artifactMsg.filename, + content: artifactMsg.content, + }); + break; + case "update": + operations.push({ + command: "rewrite", + filename: artifactMsg.filename, + content: artifactMsg.content, + }); + break; + case "delete": + operations.push({ + command: "delete", + filename: artifactMsg.filename, + }); + break; + } + } + // Handle tool result messages (from artifacts tool calls) + else if (m.role === "toolResult" && m.toolName === artifactToolName && !m.isError) { + const toolCallId = m.toolCallId; + const call = toolCalls.get(toolCallId); + if (!call) + continue; + const params = call.arguments; + if (params.command === "get" || params.command === "logs") + continue; // no state change + operations.push(params); + } + } + // 3) Compute final state per filename by simulating operations in-memory + const finalArtifacts = new Map(); + for (const op of operations) { + const filename = op.filename; + switch (op.command) { + case "create": { + if (op.content) { + finalArtifacts.set(filename, op.content); + } + break; + } + case "rewrite": { + if (op.content) { + finalArtifacts.set(filename, op.content); + } + break; + } + case "update": { + let existing = finalArtifacts.get(filename); + if (!existing) + break; // skip invalid update (shouldn't happen for successful results) + if (op.old_str !== undefined && op.new_str !== undefined) { + existing = existing.replace(op.old_str, op.new_str); + finalArtifacts.set(filename, existing); + } + break; + } + case "delete": { + finalArtifacts.delete(filename); + break; + } + case "get": + case "logs": + // Ignored above, just for completeness + break; + } + } + // 4) Reset current UI state before bulk create + this._artifacts.clear(); + this.artifactElements.forEach((el) => { + el.remove(); + }); + this.artifactElements.clear(); + this._activeFilename = null; + this._artifacts = new Map(this._artifacts); + // 5) Create artifacts in a single pass without waiting for iframe execution or tab switching + for (const [filename, content] of finalArtifacts.entries()) { + const createParams = { command: "create", filename, content }; + try { + await this.createArtifact(createParams, { skipWait: true, silent: true }); + } + catch { + // Ignore failures during reconstruction + } + } + // 6) Show first artifact if any exist, and notify listeners once + if (!this._activeFilename && this._artifacts.size > 0) { + this.showArtifact(Array.from(this._artifacts.keys())[0]); + } + this.onArtifactsChange?.(); + this.requestUpdate(); + } + // Core command executor + async executeCommand(params, options = {}) { + switch (params.command) { + case "create": + return await this.createArtifact(params, options); + case "update": + return await this.updateArtifact(params, options); + case "rewrite": + return await this.rewriteArtifact(params, options); + case "get": + return this.getArtifact(params); + case "delete": + return this.deleteArtifact(params); + case "logs": + return this.getLogs(params); + default: + // Should never happen with TypeBox validation + return `Error: Unknown command ${params.command}`; + } + } + // Wait for HTML artifact execution and get logs + async waitForHtmlExecution(filename) { + const element = this.artifactElements.get(filename); + if (!(element instanceof HtmlArtifact)) { + return ""; + } + return new Promise((resolve) => { + // Fallback timeout - just get logs after execution should complete + setTimeout(() => { + // Get whatever logs we have + const logs = element.getLogs(); + resolve(logs); + }, 1500); + }); + } + // Reload all HTML artifacts (called when any artifact changes) + reloadAllHtmlArtifacts() { + this.artifactElements.forEach((element) => { + if (element instanceof HtmlArtifact && element.sandboxIframeRef.value) { + // Update runtime providers with latest artifact state + element.runtimeProviders = this.getHtmlArtifactRuntimeProviders(); + // Re-execute the HTML content + element.executeContent(element.content); + } + }); + } + async createArtifact(params, options = {}) { + if (!params.filename || !params.content) { + return "Error: create command requires filename and content"; + } + if (this._artifacts.has(params.filename)) { + return `Error: File ${params.filename} already exists`; + } + const artifact = { + filename: params.filename, + content: params.content, + createdAt: new Date(), + updatedAt: new Date(), + }; + this._artifacts.set(params.filename, artifact); + this._artifacts = new Map(this._artifacts); + // Create or update element + this.getOrCreateArtifactElement(params.filename, params.content); + if (!options.silent) { + this.showArtifact(params.filename); + this.onArtifactsChange?.(); + this.requestUpdate(); + } + // Reload all HTML artifacts since they might depend on this new artifact + this.reloadAllHtmlArtifacts(); + // For HTML files, wait for execution + let result = `Created file ${params.filename}`; + if (this.getFileType(params.filename) === "html" && !options.skipWait) { + const logs = await this.waitForHtmlExecution(params.filename); + result += `\n${logs}`; + } + return result; + } + async updateArtifact(params, options = {}) { + const artifact = this._artifacts.get(params.filename); + if (!artifact) { + const files = Array.from(this._artifacts.keys()); + if (files.length === 0) + return `Error: File ${params.filename} not found. No files have been created yet.`; + return `Error: File ${params.filename} not found. Available files: ${files.join(", ")}`; + } + if (!params.old_str || params.new_str === undefined) { + return "Error: update command requires old_str and new_str"; + } + if (!artifact.content.includes(params.old_str)) { + return `Error: String not found in file. Here is the full content:\n\n${artifact.content}`; + } + artifact.content = artifact.content.replace(params.old_str, params.new_str); + artifact.updatedAt = new Date(); + this._artifacts.set(params.filename, artifact); + // Update element + this.getOrCreateArtifactElement(params.filename, artifact.content); + if (!options.silent) { + this.onArtifactsChange?.(); + this.requestUpdate(); + } + // Show the artifact + this.showArtifact(params.filename); + // Reload all HTML artifacts since they might depend on this updated artifact + this.reloadAllHtmlArtifacts(); + // For HTML files, wait for execution + let result = `Updated file ${params.filename}`; + if (this.getFileType(params.filename) === "html" && !options.skipWait) { + const logs = await this.waitForHtmlExecution(params.filename); + result += `\n${logs}`; + } + return result; + } + async rewriteArtifact(params, options = {}) { + const artifact = this._artifacts.get(params.filename); + if (!artifact) { + const files = Array.from(this._artifacts.keys()); + if (files.length === 0) + return `Error: File ${params.filename} not found. No files have been created yet.`; + return `Error: File ${params.filename} not found. Available files: ${files.join(", ")}`; + } + if (!params.content) { + return "Error: rewrite command requires content"; + } + artifact.content = params.content; + artifact.updatedAt = new Date(); + this._artifacts.set(params.filename, artifact); + // Update element + this.getOrCreateArtifactElement(params.filename, artifact.content); + if (!options.silent) { + this.onArtifactsChange?.(); + } + // Show the artifact + this.showArtifact(params.filename); + // Reload all HTML artifacts since they might depend on this rewritten artifact + this.reloadAllHtmlArtifacts(); + // For HTML files, wait for execution + let result = ""; + if (this.getFileType(params.filename) === "html" && !options.skipWait) { + const logs = await this.waitForHtmlExecution(params.filename); + result += `\n${logs}`; + } + return result; + } + getArtifact(params) { + const artifact = this._artifacts.get(params.filename); + if (!artifact) { + const files = Array.from(this._artifacts.keys()); + if (files.length === 0) + return `Error: File ${params.filename} not found. No files have been created yet.`; + return `Error: File ${params.filename} not found. Available files: ${files.join(", ")}`; + } + return artifact.content; + } + deleteArtifact(params) { + const artifact = this._artifacts.get(params.filename); + if (!artifact) { + const files = Array.from(this._artifacts.keys()); + if (files.length === 0) + return `Error: File ${params.filename} not found. No files have been created yet.`; + return `Error: File ${params.filename} not found. Available files: ${files.join(", ")}`; + } + this._artifacts.delete(params.filename); + this._artifacts = new Map(this._artifacts); + // Remove element + const element = this.artifactElements.get(params.filename); + if (element) { + element.remove(); + this.artifactElements.delete(params.filename); + } + // Show another artifact if this was active + if (this._activeFilename === params.filename) { + const remaining = Array.from(this._artifacts.keys()); + if (remaining.length > 0) { + this.showArtifact(remaining[0]); + } + else { + this._activeFilename = null; + this.requestUpdate(); + } + } + this.onArtifactsChange?.(); + this.requestUpdate(); + // Reload all HTML artifacts since they might have depended on this deleted artifact + this.reloadAllHtmlArtifacts(); + return `Deleted file ${params.filename}`; + } + getLogs(params) { + const element = this.artifactElements.get(params.filename); + if (!element) { + const files = Array.from(this._artifacts.keys()); + if (files.length === 0) + return `Error: File ${params.filename} not found. No files have been created yet.`; + return `Error: File ${params.filename} not found. Available files: ${files.join(", ")}`; + } + if (!(element instanceof HtmlArtifact)) { + return `Error: File ${params.filename} is not an HTML file. Logs are only available for HTML files.`; + } + return element.getLogs(); + } + render() { + const artifacts = Array.from(this._artifacts.values()); + // Panel is hidden when collapsed OR when there are no artifacts + const showPanel = artifacts.length > 0 && !this.collapsed; + return html ` +
+ +
+
+ ${artifacts.map((a) => { + const isActive = a.filename === this._activeFilename; + const activeClass = isActive + ? "border-primary text-primary" + : "border-transparent text-muted-foreground hover:text-foreground"; + return html ` + + `; + })} +
+
+ ${(() => { + const active = this._activeFilename ? this.artifactElements.get(this._activeFilename) : undefined; + return active ? active.getHeaderButtons() : ""; + })()} + ${Button({ + variant: "ghost", + size: "sm", + onClick: () => this.onClose?.(), + title: i18n("Close artifacts"), + children: icon(X, "sm"), + })} +
+
+ + +
+
+ `; + } +}; +__decorate([ + state() +], ArtifactsPanel.prototype, "_artifacts", void 0); +__decorate([ + state() +], ArtifactsPanel.prototype, "_activeFilename", void 0); +__decorate([ + property({ attribute: false }) +], ArtifactsPanel.prototype, "agent", void 0); +__decorate([ + property({ attribute: false }) +], ArtifactsPanel.prototype, "sandboxUrlProvider", void 0); +__decorate([ + property({ attribute: false }) +], ArtifactsPanel.prototype, "onArtifactsChange", void 0); +__decorate([ + property({ attribute: false }) +], ArtifactsPanel.prototype, "onClose", void 0); +__decorate([ + property({ attribute: false }) +], ArtifactsPanel.prototype, "onOpen", void 0); +__decorate([ + property({ type: Boolean }) +], ArtifactsPanel.prototype, "collapsed", void 0); +__decorate([ + property({ type: Boolean }) +], ArtifactsPanel.prototype, "overlay", void 0); +ArtifactsPanel = __decorate([ + customElement("artifacts-panel") +], ArtifactsPanel); +export { ArtifactsPanel }; +//# sourceMappingURL=artifacts.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts.js.map new file mode 100644 index 000000000..2def8593d --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/artifacts.js.map @@ -0,0 +1 @@ +{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../../src/tools/artifacts/artifacts.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,8CAA8C,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAgC,UAAU,EAAiB,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,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C/B,KAAK,EAAE,IAAI,CAAC,iBAAiB,CAAC;YAC9B,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;SACvB,CAAC;;;;;0CAKkC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC;;GAE3D,CAAC;IACH,CAAC;CACD,CAAA;AA5oBiB;IAAhB,KAAK,EAAE;kDAAkD;AACzC;IAAhB,KAAK,EAAE;uDAA+C;AAOvB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;6CAAe;AAEd;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;0DAAmC;AAElC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;yDAAgC;AAC/B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;+CAAsB;AACrB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;8CAAqB;AAEvB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDAAmB;AAElB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CAAiB;AAnBjC,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CA6oB1B"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/index.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/index.d.ts new file mode 100644 index 000000000..bcc6be7bf --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/index.d.ts @@ -0,0 +1,8 @@ +export { ArtifactElement } from "./ArtifactElement.js"; +export { type Artifact, ArtifactsPanel, type ArtifactsParams } from "./artifacts.js"; +export { ArtifactsToolRenderer } from "./artifacts-tool-renderer.js"; +export { HtmlArtifact } from "./HtmlArtifact.js"; +export { MarkdownArtifact } from "./MarkdownArtifact.js"; +export { SvgArtifact } from "./SvgArtifact.js"; +export { TextArtifact } from "./TextArtifact.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/index.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/index.d.ts.map new file mode 100644 index 000000000..83858b864 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/artifacts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,KAAK,QAAQ,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/index.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/index.js new file mode 100644 index 000000000..f501dbad8 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/index.js @@ -0,0 +1,8 @@ +export { ArtifactElement } from "./ArtifactElement.js"; +export { ArtifactsPanel } from "./artifacts.js"; +export { ArtifactsToolRenderer } from "./artifacts-tool-renderer.js"; +export { HtmlArtifact } from "./HtmlArtifact.js"; +export { MarkdownArtifact } from "./MarkdownArtifact.js"; +export { SvgArtifact } from "./SvgArtifact.js"; +export { TextArtifact } from "./TextArtifact.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/index.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/index.js.map new file mode 100644 index 000000000..ef4212ed9 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/artifacts/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/artifacts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAiB,cAAc,EAAwB,MAAM,gBAAgB,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/extract-document.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/extract-document.d.ts new file mode 100644 index 000000000..29f31d991 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/extract-document.d.ts @@ -0,0 +1,24 @@ +import type { AgentTool } from "@mariozechner/pi-ai"; +import { type Static } from "@sinclair/typebox"; +import type { ToolRenderer } from "./types.js"; +declare const extractDocumentSchema: import("@sinclair/typebox").TObject<{ + url: import("@sinclair/typebox").TString; +}>; +export type ExtractDocumentParams = Static; +export interface ExtractDocumentResult { + extractedText: string; + format: string; + fileName: string; + size: number; +} +export declare function createExtractDocumentTool(): AgentTool & { + corsProxyUrl?: string; +}; +export declare const extractDocumentTool: AgentTool, ExtractDocumentResult> & { + corsProxyUrl?: string; +}; +export declare const extractDocumentRenderer: ToolRenderer; +export {}; +//# sourceMappingURL=extract-document.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/extract-document.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/extract-document.d.ts.map new file mode 100644 index 000000000..9766395da --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/extract-document.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"extract-document.d.ts","sourceRoot":"","sources":["../../src/tools/extract-document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAqB,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAQtD,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,YAAY,CAAC;AAMjE,QAAA,MAAM,qBAAqB;;EAIzB,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEzE,MAAM,WAAW,qBAAqB;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACb;AAMD,wBAAgB,yBAAyB,IAAI,SAAS,CAAC,OAAO,qBAAqB,EAAE,qBAAqB,CAAC,GAAG;IAC7G,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB,CA+IA;AAGD,eAAO,MAAM,mBAAmB;;;mBAnJhB,MAAM;CAmJwC,CAAC;AAM/D,eAAO,MAAM,uBAAuB,EAAE,YAAY,CAAC,qBAAqB,EAAE,qBAAqB,CAkF9F,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/extract-document.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/extract-document.js new file mode 100644 index 000000000..002d59104 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/extract-document.js @@ -0,0 +1,216 @@ +import { Type } from "@sinclair/typebox"; +import { html } from "lit"; +import { createRef, ref } from "lit/directives/ref.js"; +import { FileText } from "lucide"; +import { EXTRACT_DOCUMENT_DESCRIPTION } from "../prompts/prompts.js"; +import { loadAttachment } from "../utils/attachment-utils.js"; +import { isCorsError } from "../utils/proxy-utils.js"; +import { registerToolRenderer, renderCollapsibleHeader, renderHeader } from "./renderer-registry.js"; +// ============================================================================ +// TYPES +// ============================================================================ +const extractDocumentSchema = Type.Object({ + url: Type.String({ + description: "URL of the document to extract text from (PDF, DOCX, XLSX, or PPTX)", + }), +}); +// ============================================================================ +// TOOL +// ============================================================================ +export function createExtractDocumentTool() { + const tool = { + label: "Extract Document", + name: "extract_document", + corsProxyUrl: undefined, // Can be set by consumer (e.g., from user settings) + description: EXTRACT_DOCUMENT_DESCRIPTION, + parameters: extractDocumentSchema, + execute: async (_toolCallId, args, signal) => { + if (signal?.aborted) { + throw new Error("Extract document aborted"); + } + const url = args.url.trim(); + if (!url) { + throw new Error("URL is required"); + } + // Validate URL format + try { + new URL(url); + } + catch { + throw new Error(`Invalid URL: ${url}`); + } + // Size limit: 50MB + const MAX_SIZE = 50 * 1024 * 1024; + // Helper function to fetch and process document + const fetchAndProcess = async (fetchUrl) => { + const response = await fetch(fetchUrl, { signal }); + if (!response.ok) { + throw new Error(`TELL USER: Unable to download the document (${response.status} ${response.statusText}). The site likely blocks automated downloads.\n\n` + + `INSTRUCT USER: Please download the file manually and attach it to your message using the attachment button (paperclip icon) in the message input area. I can then extract the text from the attached file.`); + } + // Check size before downloading + const contentLength = response.headers.get("content-length"); + if (contentLength) { + const size = Number.parseInt(contentLength, 10); + if (size > MAX_SIZE) { + throw new Error(`Document is too large (${(size / 1024 / 1024).toFixed(1)}MB). Maximum supported size is 50MB.`); + } + } + // Download the document + const arrayBuffer = await response.arrayBuffer(); + const size = arrayBuffer.byteLength; + if (size > MAX_SIZE) { + throw new Error(`Document is too large (${(size / 1024 / 1024).toFixed(1)}MB). Maximum supported size is 50MB.`); + } + return arrayBuffer; + }; + // Try without proxy first, fallback to proxy on CORS error + let arrayBuffer; + try { + // Attempt direct fetch first + arrayBuffer = await fetchAndProcess(url); + } + catch (directError) { + // If CORS error and proxy is available, retry with proxy + if (isCorsError(directError) && tool.corsProxyUrl) { + try { + const proxiedUrl = tool.corsProxyUrl + encodeURIComponent(url); + arrayBuffer = await fetchAndProcess(proxiedUrl); + } + catch (proxyError) { + // Proxy fetch also failed - throw helpful message + throw new Error(`TELL USER: Unable to fetch the document due to CORS restrictions.\n\n` + + `Tried with proxy but it also failed: ${proxyError.message}\n\n` + + `INSTRUCT USER: Please download the file manually and attach it to your message using the attachment button (paperclip icon) in the message input area. I can then extract the text from the attached file.`); + } + } + else if (isCorsError(directError) && !tool.corsProxyUrl) { + // CORS error but no proxy configured + throw new Error(`TELL USER: Unable to fetch the document due to CORS restrictions (the server blocks requests from browser extensions).\n\n` + + `To fix this, you need to configure a CORS proxy in Sitegeist settings:\n` + + `1. Open Sitegeist settings\n` + + `2. Find "CORS Proxy URL" setting\n` + + `3. Enter a proxy URL like: https://corsproxy.io/?\n` + + `4. Save and try again\n\n` + + `Alternatively, download the file manually and attach it to your message using the attachment button (paperclip icon).`); + } + else { + // Not a CORS error - re-throw + throw directError; + } + } + // Extract filename from URL + const urlParts = url.split("/"); + let fileName = urlParts[urlParts.length - 1]?.split("?")[0] || "document"; + if (url.startsWith("https://arxiv.org/")) { + fileName = fileName + ".pdf"; + } + // Use loadAttachment to process the document + const attachment = await loadAttachment(arrayBuffer, fileName); + if (!attachment.extractedText) { + throw new Error(`Document format not supported. Supported formats:\n` + + `- PDF (.pdf)\n` + + `- Word (.docx)\n` + + `- Excel (.xlsx, .xls)\n` + + `- PowerPoint (.pptx)`); + } + // Determine format from attachment + let format = "unknown"; + if (attachment.mimeType.includes("pdf")) { + format = "pdf"; + } + else if (attachment.mimeType.includes("wordprocessingml")) { + format = "docx"; + } + else if (attachment.mimeType.includes("spreadsheetml") || attachment.mimeType.includes("ms-excel")) { + format = "xlsx"; + } + else if (attachment.mimeType.includes("presentationml")) { + format = "pptx"; + } + return { + content: [{ type: "text", text: attachment.extractedText }], + details: { + extractedText: attachment.extractedText, + format, + fileName: attachment.fileName, + size: attachment.size, + }, + }; + }, + }; + return tool; +} +// Export a default instance +export const extractDocumentTool = createExtractDocumentTool(); +// ============================================================================ +// RENDERER +// ============================================================================ +export const extractDocumentRenderer = { + render(params, result, isStreaming) { + // Determine status + const state = result ? (result.isError ? "error" : "complete") : isStreaming ? "inprogress" : "complete"; + // Create refs for collapsible sections + const contentRef = createRef(); + const chevronRef = createRef(); + // With result: show params + result + if (result && params) { + const details = result.details; + const title = details + ? result.isError + ? `Failed to extract ${details.fileName || "document"}` + : `Extracted text from ${details.fileName} (${details.format.toUpperCase()}, ${(details.size / 1024).toFixed(1)}KB)` + : result.isError + ? "Failed to extract document" + : "Extracted text from document"; + const output = result.content + ?.filter((c) => c.type === "text") + .map((c) => c.text) + .join("\n") || ""; + return { + content: html ` +
+ ${renderCollapsibleHeader(state, FileText, title, contentRef, chevronRef, false)} +
+ ${params.url + ? html `
+ URL: ${params.url} +
` + : ""} + ${output && !result.isError + ? html `` + : ""} + ${result.isError && output + ? html `` + : ""} +
+
+ `, + isCustom: false, + }; + } + // Just params (streaming or waiting for result) + if (params) { + const title = "Extracting document..."; + return { + content: html ` +
+ ${renderCollapsibleHeader(state, FileText, title, contentRef, chevronRef, false)} +
+
URL: ${params.url}
+
+
+ `, + isCustom: false, + }; + } + // No params or result yet + return { + content: renderHeader(state, FileText, "Preparing extraction..."), + isCustom: false, + }; + }, +}; +// Auto-register the renderer +registerToolRenderer("extract_document", extractDocumentRenderer); +//# sourceMappingURL=extract-document.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/extract-document.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/extract-document.js.map new file mode 100644 index 000000000..c8f2b9c48 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/extract-document.js.map @@ -0,0 +1 @@ +{"version":3,"file":"extract-document.js","sourceRoot":"","sources":["../../src/tools/extract-document.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGrG,+EAA+E;AAC/E,QAAQ;AACR,+EAA+E;AAE/E,MAAM,qBAAqB,GAAG,IAAI,CAAC,MAAM,CAAC;IACzC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC;QAChB,WAAW,EAAE,qEAAqE;KAClF,CAAC;CACF,CAAC,CAAC;AAWH,+EAA+E;AAC/E,OAAO;AACP,+EAA+E;AAE/E,MAAM,UAAU,yBAAyB;IAGxC,MAAM,IAAI,GAAG;QACZ,KAAK,EAAE,kBAAkB;QACzB,IAAI,EAAE,kBAAkB;QACxB,YAAY,EAAE,SAA+B,EAAE,oDAAoD;QACnG,WAAW,EAAE,4BAA4B;QACzC,UAAU,EAAE,qBAAqB;QACjC,OAAO,EAAE,KAAK,EAAE,WAAmB,EAAE,IAA2B,EAAE,MAAoB,EAAE,EAAE;YACzF,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;gBACrB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;YAC7C,CAAC;YAED,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YAC5B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;QAC1B,OAAO;YACN,OAAO,EAAE,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,yBAAyB,CAAC;YACjE,QAAQ,EAAE,KAAK;SACf,CAAC;IACH,CAAC;CACD,CAAC;AAEF,6BAA6B;AAC7B,oBAAoB,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/index.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/index.d.ts new file mode 100644 index 000000000..86223e462 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/index.d.ts @@ -0,0 +1,16 @@ +import type { ToolResultMessage } from "@mariozechner/pi-ai"; +import "./javascript-repl.js"; +import "./extract-document.js"; +import { getToolRenderer, registerToolRenderer } from "./renderer-registry.js"; +import type { ToolRenderResult } from "./types.js"; +/** + * Enable or disable show JSON mode + * When enabled, all tool renderers will use the default JSON renderer + */ +export declare function setShowJsonMode(enabled: boolean): void; +/** + * Render tool - unified function that handles params, result, and streaming state + */ +export declare function renderTool(toolName: string, params: any | undefined, result: ToolResultMessage | undefined, isStreaming?: boolean): ToolRenderResult; +export { getToolRenderer, registerToolRenderer }; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/index.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/index.d.ts.map new file mode 100644 index 000000000..f466570dc --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,sBAAsB,CAAC;AAC9B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAUnD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAEtD;AAED;;GAEG;AACH,wBAAgB,UAAU,CACzB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,GAAG,GAAG,SAAS,EACvB,MAAM,EAAE,iBAAiB,GAAG,SAAS,EACrC,WAAW,CAAC,EAAE,OAAO,GACnB,gBAAgB,CAWlB;AAED,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/index.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/index.js new file mode 100644 index 000000000..f735a6b02 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/index.js @@ -0,0 +1,33 @@ +import "./javascript-repl.js"; // Auto-registers the renderer +import "./extract-document.js"; // Auto-registers the renderer +import { getToolRenderer, registerToolRenderer } from "./renderer-registry.js"; +import { BashRenderer } from "./renderers/BashRenderer.js"; +import { DefaultRenderer } from "./renderers/DefaultRenderer.js"; +// Register all built-in tool renderers +registerToolRenderer("bash", new BashRenderer()); +const defaultRenderer = new DefaultRenderer(); +// Global flag to force default JSON rendering for all tools +let showJsonMode = false; +/** + * Enable or disable show JSON mode + * When enabled, all tool renderers will use the default JSON renderer + */ +export function setShowJsonMode(enabled) { + showJsonMode = enabled; +} +/** + * Render tool - unified function that handles params, result, and streaming state + */ +export function renderTool(toolName, params, result, isStreaming) { + // If showJsonMode is enabled, always use the default renderer + if (showJsonMode) { + return defaultRenderer.render(params, result, isStreaming); + } + const renderer = getToolRenderer(toolName); + if (renderer) { + return renderer.render(params, result, isStreaming); + } + return defaultRenderer.render(params, result, isStreaming); +} +export { getToolRenderer, registerToolRenderer }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/index.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/index.js.map new file mode 100644 index 000000000..af2a1e93c --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,sBAAsB,CAAC,CAAC,8BAA8B;AAC7D,OAAO,uBAAuB,CAAC,CAAC,8BAA8B;AAC9D,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGjE,uCAAuC;AACvC,oBAAoB,CAAC,MAAM,EAAE,IAAI,YAAY,EAAE,CAAC,CAAC;AAEjD,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;AAE9C,4DAA4D;AAC5D,IAAI,YAAY,GAAG,KAAK,CAAC;AAEzB;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAAgB;IAC/C,YAAY,GAAG,OAAO,CAAC;AACxB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CACzB,QAAgB,EAChB,MAAuB,EACvB,MAAqC,EACrC,WAAqB;IAErB,8DAA8D;IAC9D,IAAI,YAAY,EAAE,CAAC;QAClB,OAAO,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC3C,IAAI,QAAQ,EAAE,CAAC;QACd,OAAO,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;AAC5D,CAAC;AAED,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/javascript-repl.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/javascript-repl.d.ts new file mode 100644 index 000000000..ffca42350 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/javascript-repl.d.ts @@ -0,0 +1,44 @@ +import type { AgentTool } from "@mariozechner/pi-ai"; +import { type Static } from "@sinclair/typebox"; +import { type SandboxFile } from "../components/SandboxedIframe.js"; +import type { SandboxRuntimeProvider } from "../components/sandbox/SandboxRuntimeProvider.js"; +import type { ToolRenderer } from "./types.js"; +export declare function executeJavaScript(code: string, runtimeProviders: SandboxRuntimeProvider[], signal?: AbortSignal, sandboxUrlProvider?: () => string): Promise<{ + output: string; + files?: SandboxFile[]; +}>; +export type JavaScriptReplToolResult = { + files?: { + fileName: string; + contentBase64: string; + mimeType: string; + }[] | undefined; +}; +declare const javascriptReplSchema: import("@sinclair/typebox").TObject<{ + title: import("@sinclair/typebox").TString; + code: import("@sinclair/typebox").TString; +}>; +export type JavaScriptReplParams = Static; +interface JavaScriptReplResult { + output?: string; + files?: Array<{ + fileName: string; + mimeType: string; + size: number; + contentBase64: string; + }>; +} +export declare function createJavaScriptReplTool(): AgentTool & { + runtimeProvidersFactory?: () => SandboxRuntimeProvider[]; + sandboxUrlProvider?: () => string; +}; +export declare const javascriptReplTool: AgentTool, JavaScriptReplToolResult> & { + runtimeProvidersFactory?: () => SandboxRuntimeProvider[]; + sandboxUrlProvider?: () => string; +}; +export declare const javascriptReplRenderer: ToolRenderer; +export {}; +//# sourceMappingURL=javascript-repl.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/javascript-repl.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/javascript-repl.d.ts.map new file mode 100644 index 000000000..d7000fc43 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/javascript-repl.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"javascript-repl.d.ts","sourceRoot":"","sources":["../../src/tools/javascript-repl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAqB,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAItD,OAAO,EAAE,KAAK,WAAW,EAAqC,MAAM,kCAAkC,CAAC;AACvG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAC;AAI9F,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,YAAY,CAAC;AAGjE,wBAAsB,iBAAiB,CACtC,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,sBAAsB,EAAE,EAC1C,MAAM,CAAC,EAAE,WAAW,EACpB,kBAAkB,CAAC,EAAE,MAAM,MAAM,GAC/B,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,WAAW,EAAE,CAAA;CAAE,CAAC,CA2EpD;AAED,MAAM,MAAM,wBAAwB,GAAG;IACtC,KAAK,CAAC,EACH;QACA,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE,MAAM,CAAC;QACtB,QAAQ,EAAE,MAAM,CAAC;KAChB,EAAE,GACH,SAAS,CAAC;CACb,CAAC;AAEF,QAAA,MAAM,oBAAoB;;;EAMxB,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEvE,UAAU,oBAAoB;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,aAAa,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;CACH;AAED,wBAAgB,wBAAwB,IAAI,SAAS,CAAC,OAAO,oBAAoB,EAAE,wBAAwB,CAAC,GAAG;IAC9G,uBAAuB,CAAC,EAAE,MAAM,sBAAsB,EAAE,CAAC;IACzD,kBAAkB,CAAC,EAAE,MAAM,MAAM,CAAC;CAClC,CAgEA;AAGD,eAAO,MAAM,kBAAkB;;;;8BArEJ,MAAM,sBAAsB,EAAE;yBACnC,MAAM,MAAM;CAoE0B,CAAC;AAE7D,eAAO,MAAM,sBAAsB,EAAE,YAAY,CAAC,oBAAoB,EAAE,oBAAoB,CA0F3F,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/javascript-repl.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/javascript-repl.js new file mode 100644 index 000000000..2961bccfb --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/javascript-repl.js @@ -0,0 +1,224 @@ +import { i18n } from "@mariozechner/mini-lit"; +import { Type } from "@sinclair/typebox"; +import { html } from "lit"; +import { createRef, ref } from "lit/directives/ref.js"; +import { Code } from "lucide"; +import { SandboxIframe } from "../components/SandboxedIframe.js"; +import { JAVASCRIPT_REPL_TOOL_DESCRIPTION } from "../prompts/prompts.js"; +import { registerToolRenderer, renderCollapsibleHeader, renderHeader } from "./renderer-registry.js"; +// Execute JavaScript code with attachments using SandboxedIframe +export async function executeJavaScript(code, runtimeProviders, signal, sandboxUrlProvider) { + if (!code) { + throw new Error("Code parameter is required"); + } + // Check for abort before starting + if (signal?.aborted) { + throw new Error("Execution aborted"); + } + // Create a SandboxedIframe instance for execution + const sandbox = new SandboxIframe(); + if (sandboxUrlProvider) { + sandbox.sandboxUrlProvider = sandboxUrlProvider; + } + sandbox.style.display = "none"; + document.body.appendChild(sandbox); + try { + const sandboxId = `repl-${Date.now()}-${Math.random().toString(36).substring(7)}`; + // Pass providers to execute (router handles all message routing) + // No additional consumers needed - execute() has its own internal consumer + const result = await sandbox.execute(sandboxId, code, runtimeProviders, [], signal); + // Remove the sandbox iframe after execution + sandbox.remove(); + // Build plain text response + let output = ""; + // Add console output - result.console contains { type: string, text: string } from sandbox.js + if (result.console && result.console.length > 0) { + for (const entry of result.console) { + output += entry.text + "\n"; + } + } + // Add error if execution failed + if (!result.success) { + if (output) + output += "\n"; + output += `Error: ${result.error?.message || "Unknown error"}\n${result.error?.stack || ""}`; + // Throw error so tool call is marked as failed + throw new Error(output.trim()); + } + // Add return value if present + if (result.returnValue !== undefined) { + if (output) + output += "\n"; + output += `=> ${typeof result.returnValue === "object" ? JSON.stringify(result.returnValue, null, 2) : result.returnValue}`; + } + // Add file notifications + if (result.files && result.files.length > 0) { + output += `\n[Files returned: ${result.files.length}]\n`; + for (const file of result.files) { + output += ` - ${file.fileName} (${file.mimeType})\n`; + } + } + else { + // Explicitly note when no files were returned (helpful for debugging) + if (code.includes("returnFile")) { + output += "\n[No files returned - check async operations]"; + } + } + return { + output: output.trim() || "Code executed successfully (no output)", + files: result.files, + }; + } + catch (error) { + // Clean up on error + sandbox.remove(); + throw new Error(error.message || "Execution failed"); + } +} +const javascriptReplSchema = Type.Object({ + title: Type.String({ + description: "Brief title describing what the code snippet tries to achieve in active form, e.g. 'Calculating sum'", + }), + code: Type.String({ description: "JavaScript code to execute" }), +}); +export function createJavaScriptReplTool() { + return { + label: "JavaScript REPL", + name: "javascript_repl", + runtimeProvidersFactory: () => [], // default to empty array + sandboxUrlProvider: undefined, // optional, for browser extensions + get description() { + const runtimeProviderDescriptions = this.runtimeProvidersFactory?.() + .map((d) => d.getDescription()) + .filter((d) => d.trim().length > 0) || []; + return JAVASCRIPT_REPL_TOOL_DESCRIPTION(runtimeProviderDescriptions); + }, + parameters: javascriptReplSchema, + execute: async function (_toolCallId, args, signal) { + const result = await executeJavaScript(args.code, this.runtimeProvidersFactory?.() ?? [], signal, this.sandboxUrlProvider); + // Convert files to JSON-serializable with base64 payloads + const files = (result.files || []).map((f) => { + const toBase64 = (input) => { + if (input instanceof Uint8Array) { + let binary = ""; + const chunk = 0x8000; + for (let i = 0; i < input.length; i += chunk) { + binary += String.fromCharCode(...input.subarray(i, i + chunk)); + } + return { base64: btoa(binary), size: input.length }; + } + else if (typeof input === "string") { + const enc = new TextEncoder(); + const bytes = enc.encode(input); + let binary = ""; + const chunk = 0x8000; + for (let i = 0; i < bytes.length; i += chunk) { + binary += String.fromCharCode(...bytes.subarray(i, i + chunk)); + } + return { base64: btoa(binary), size: bytes.length }; + } + else { + const s = String(input); + const enc = new TextEncoder(); + const bytes = enc.encode(s); + let binary = ""; + const chunk = 0x8000; + for (let i = 0; i < bytes.length; i += chunk) { + binary += String.fromCharCode(...bytes.subarray(i, i + chunk)); + } + return { base64: btoa(binary), size: bytes.length }; + } + }; + const { base64, size } = toBase64(f.content); + return { + fileName: f.fileName || "file", + mimeType: f.mimeType || "application/octet-stream", + size, + contentBase64: base64, + }; + }); + return { content: [{ type: "text", text: result.output }], details: { files } }; + }, + }; +} +// Export a default instance for backward compatibility +export const javascriptReplTool = createJavaScriptReplTool(); +export const javascriptReplRenderer = { + render(params, result, isStreaming) { + // Determine status + const state = result ? (result.isError ? "error" : "complete") : isStreaming ? "inprogress" : "complete"; + // Create refs for collapsible code section + const codeContentRef = createRef(); + const codeChevronRef = createRef(); + // With result: show params + result + if (result && params) { + const output = result.content + ?.filter((c) => c.type === "text") + .map((c) => c.text) + .join("\n") || ""; + const files = result.details?.files || []; + const attachments = files.map((f, i) => { + // Decode base64 content for text files to show in overlay + let extractedText; + const isTextBased = f.mimeType?.startsWith("text/") || + f.mimeType === "application/json" || + f.mimeType === "application/javascript" || + f.mimeType?.includes("xml"); + if (isTextBased && f.contentBase64) { + try { + extractedText = atob(f.contentBase64); + } + catch (e) { + console.warn("Failed to decode base64 content for", f.fileName); + } + } + return { + id: `repl-${Date.now()}-${i}`, + type: f.mimeType?.startsWith("image/") ? "image" : "document", + fileName: f.fileName || `file-${i}`, + mimeType: f.mimeType || "application/octet-stream", + size: f.size ?? 0, + content: f.contentBase64, + preview: f.mimeType?.startsWith("image/") ? f.contentBase64 : undefined, + extractedText, + }; + }); + return { + content: html ` +
+ ${renderCollapsibleHeader(state, Code, params.title ? params.title : i18n("Executing JavaScript"), codeContentRef, codeChevronRef, false)} +
+ + ${output ? html `` : ""} +
+ ${attachments.length + ? html `
+ ${attachments.map((att) => html ``)} +
` + : ""} +
+ `, + isCustom: false, + }; + } + // Just params (streaming or waiting for result) + if (params) { + return { + content: html ` +
+ ${renderCollapsibleHeader(state, Code, params.title ? params.title : i18n("Executing JavaScript"), codeContentRef, codeChevronRef, false)} +
+ ${params.code ? html `` : ""} +
+
+ `, + isCustom: false, + }; + } + // No params or result yet + return { content: renderHeader(state, Code, i18n("Preparing JavaScript...")), isCustom: false }; + }, +}; +// Auto-register the renderer +registerToolRenderer(javascriptReplTool.name, javascriptReplRenderer); +//# sourceMappingURL=javascript-repl.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/javascript-repl.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/javascript-repl.js.map new file mode 100644 index 000000000..bf73be13a --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/javascript-repl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"javascript-repl.js","sourceRoot":"","sources":["../../src/tools/javascript-repl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAoB,aAAa,EAAsB,MAAM,kCAAkC,CAAC;AAEvG,OAAO,EAAE,gCAAgC,EAAE,MAAM,uBAAuB,CAAC;AAEzE,OAAO,EAAE,oBAAoB,EAAE,uBAA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AAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,mBAAmB,CAAC,CAAC,CAAC,EAAE;;QAGzH,WAAW,CAAC,MAAM;oBACjB,CAAC,CAAC,IAAI,CAAA;WACH,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAA,gCAAgC,GAAG,qBAAqB,CAAC;gBACjF;oBACR,CAAC,CAAC,EACJ;;KAED;gBACD,QAAQ,EAAE,KAAK;aACf,CAAC;QACH,CAAC;QAED,gDAAgD;QAChD,IAAI,MAAM,EAAE,CAAC;YACZ,OAAO;gBACN,OAAO,EAAE,IAAI,CAAA;;QAET,uBAAuB,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,EAAE,cAAc,EAAE,cAAc,EAAE,KAAK,CAAC;aAClI,GAAG,CAAC,cAAc,CAAC;SACvB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA,qBAAqB,MAAM,CAAC,IAAI,sCAAsC,CAAC,CAAC,CAAC,EAAE;;;KAGjG;gBACD,QAAQ,EAAE,KAAK;aACf,CAAC;QACH,CAAC;QAED,0BAA0B;QAC1B,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,yBAAyB,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IACjG,CAAC;CACD,CAAC;AAEF,6BAA6B;AAC7B,oBAAoB,CAAC,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderer-registry.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderer-registry.d.ts new file mode 100644 index 000000000..aac688dd0 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderer-registry.d.ts @@ -0,0 +1,23 @@ +import { type TemplateResult } from "lit"; +import type { Ref } from "lit/directives/ref.js"; +import type { ToolRenderer } from "./types.js"; +export declare const toolRenderers: Map>; +/** + * Register a custom tool renderer + */ +export declare function registerToolRenderer(toolName: string, renderer: ToolRenderer): void; +/** + * Get a tool renderer by name + */ +export declare function getToolRenderer(toolName: string): ToolRenderer | undefined; +/** + * Helper to render a header for tool renderers + * Shows icon on left when complete/error, spinner on right when in progress + */ +export declare function renderHeader(state: "inprogress" | "complete" | "error", toolIcon: any, text: string | TemplateResult): TemplateResult; +/** + * Helper to render a collapsible header for tool renderers + * Same as renderHeader but with a chevron button that toggles visibility of content + */ +export declare function renderCollapsibleHeader(state: "inprogress" | "complete" | "error", toolIcon: any, text: string | TemplateResult, contentRef: Ref, chevronRef: Ref, defaultExpanded?: boolean): TemplateResult; +//# sourceMappingURL=renderer-registry.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderer-registry.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderer-registry.d.ts.map new file mode 100644 index 000000000..9fa7cd571 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderer-registry.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"renderer-registry.d.ts","sourceRoot":"","sources":["../../src/tools/renderer-registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAGjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,eAAO,MAAM,aAAa,qCAAkC,CAAC;AAE7D;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,IAAI,CAEnF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAE1E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC3B,KAAK,EAAE,YAAY,GAAG,UAAU,GAAG,OAAO,EAC1C,QAAQ,EAAE,GAAG,EACb,IAAI,EAAE,MAAM,GAAG,cAAc,GAC3B,cAAc,CA8BhB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACtC,KAAK,EAAE,YAAY,GAAG,UAAU,GAAG,OAAO,EAC1C,QAAQ,EAAE,GAAG,EACb,IAAI,EAAE,MAAM,GAAG,cAAc,EAC7B,UAAU,EAAE,GAAG,CAAC,WAAW,CAAC,EAC5B,UAAU,EAAE,GAAG,CAAC,WAAW,CAAC,EAC5B,eAAe,UAAQ,GACrB,cAAc,CAsDhB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderer-registry.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderer-registry.js new file mode 100644 index 000000000..f1039f532 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderer-registry.js @@ -0,0 +1,107 @@ +import { icon } from "@mariozechner/mini-lit"; +import { html } from "lit"; +import { ref } from "lit/directives/ref.js"; +import { ChevronsUpDown, ChevronUp, Loader } from "lucide"; +// Registry of tool renderers +export const toolRenderers = new Map(); +/** + * Register a custom tool renderer + */ +export function registerToolRenderer(toolName, renderer) { + toolRenderers.set(toolName, renderer); +} +/** + * Get a tool renderer by name + */ +export function getToolRenderer(toolName) { + return toolRenderers.get(toolName); +} +/** + * Helper to render a header for tool renderers + * Shows icon on left when complete/error, spinner on right when in progress + */ +export function renderHeader(state, toolIcon, text) { + const statusIcon = (iconComponent, color) => html `${icon(iconComponent, "sm")}`; + switch (state) { + case "inprogress": + return html ` +
+
+ ${statusIcon(toolIcon, "text-foreground")} + ${text} +
+ ${statusIcon(Loader, "text-foreground animate-spin")} +
+ `; + case "complete": + return html ` +
+ ${statusIcon(toolIcon, "text-green-600 dark:text-green-500")} + ${text} +
+ `; + case "error": + return html ` +
+ ${statusIcon(toolIcon, "text-destructive")} + ${text} +
+ `; + } +} +/** + * Helper to render a collapsible header for tool renderers + * Same as renderHeader but with a chevron button that toggles visibility of content + */ +export function renderCollapsibleHeader(state, toolIcon, text, contentRef, chevronRef, defaultExpanded = false) { + const statusIcon = (iconComponent, color) => html `${icon(iconComponent, "sm")}`; + const toggleContent = (e) => { + e.preventDefault(); + const content = contentRef.value; + const chevron = chevronRef.value; + if (content && chevron) { + const isCollapsed = content.classList.contains("max-h-0"); + if (isCollapsed) { + content.classList.remove("max-h-0"); + content.classList.add("max-h-[2000px]", "mt-3"); + // Show ChevronUp, hide ChevronsUpDown + const upIcon = chevron.querySelector(".chevron-up"); + const downIcon = chevron.querySelector(".chevrons-up-down"); + if (upIcon && downIcon) { + upIcon.classList.remove("hidden"); + downIcon.classList.add("hidden"); + } + } + else { + content.classList.remove("max-h-[2000px]", "mt-3"); + content.classList.add("max-h-0"); + // Show ChevronsUpDown, hide ChevronUp + const upIcon = chevron.querySelector(".chevron-up"); + const downIcon = chevron.querySelector(".chevrons-up-down"); + if (upIcon && downIcon) { + upIcon.classList.add("hidden"); + downIcon.classList.remove("hidden"); + } + } + } + }; + const toolIconColor = state === "complete" + ? "text-green-600 dark:text-green-500" + : state === "error" + ? "text-destructive" + : "text-foreground"; + return html ` + + `; +} +//# sourceMappingURL=renderer-registry.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderer-registry.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderer-registry.js.map new file mode 100644 index 000000000..956da9a8f --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderer-registry.js.map @@ -0,0 +1 @@ +{"version":3,"file":"renderer-registry.js","sourceRoot":"","sources":["../../src/tools/renderer-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,E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CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;gBACpD,MAAM,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;gBAC5D,IAAI,MAAM,IAAI,QAAQ,EAAE,CAAC;oBACxB,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;oBAC/B,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBACrC,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC,CAAC;IAEF,MAAM,aAAa,GAClB,KAAK,KAAK,UAAU;QACnB,CAAC,CAAC,oCAAoC;QACtC,CAAC,CAAC,KAAK,KAAK,OAAO;YAClB,CAAC,CAAC,kBAAkB;YACpB,CAAC,CAAC,iBAAiB,CAAC;IAEvB,OAAO,IAAI,CAAA;mBACO,aAAa;;MAE1B,KAAK,KAAK,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAAC,CAAC,CAAC,EAAE;MAChF,UAAU,CAAC,QAAQ,EAAE,aAAa,CAAC;MACnC,IAAI;;sDAE4C,GAAG,CAAC,UAAU,CAAC;8BACvC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC;oCACnD,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC;;;EAGhG,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/BashRenderer.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/BashRenderer.d.ts new file mode 100644 index 000000000..a2bdf500c --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/BashRenderer.d.ts @@ -0,0 +1,10 @@ +import type { ToolResultMessage } from "@mariozechner/pi-ai"; +import type { ToolRenderer, ToolRenderResult } from "../types.js"; +interface BashParams { + command: string; +} +export declare class BashRenderer implements ToolRenderer { + render(params: BashParams | undefined, result: ToolResultMessage | undefined): ToolRenderResult; +} +export {}; +//# sourceMappingURL=BashRenderer.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/BashRenderer.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/BashRenderer.d.ts.map new file mode 100644 index 000000000..d8b2864b3 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/BashRenderer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"BashRenderer.d.ts","sourceRoot":"","sources":["../../../src/tools/renderers/BashRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAK7D,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAElE,UAAU,UAAU;IACnB,OAAO,EAAE,MAAM,CAAC;CAChB;AAGD,qBAAa,YAAa,YAAW,YAAY,CAAC,UAAU,EAAE,SAAS,CAAC;IACvE,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,EAAE,MAAM,EAAE,iBAAiB,CAAC,SAAS,CAAC,GAAG,SAAS,GAAG,gBAAgB;CAsC1G"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/BashRenderer.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/BashRenderer.js new file mode 100644 index 000000000..b9458d9ec --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/BashRenderer.js @@ -0,0 +1,42 @@ +import { html } from "lit"; +import { SquareTerminal } from "lucide"; +import { i18n } from "../../utils/i18n.js"; +import { renderHeader } from "../renderer-registry.js"; +// Bash tool has undefined details (only uses output) +export class BashRenderer { + render(params, result) { + const state = result ? (result.isError ? "error" : "complete") : "inprogress"; + // With result: show command + output + if (result && params?.command) { + const output = result.content + ?.filter((c) => c.type === "text") + .map((c) => c.text) + .join("\n") || ""; + const combined = output ? `> ${params.command}\n\n${output}` : `> ${params.command}`; + return { + content: html ` +
+ ${renderHeader(state, SquareTerminal, i18n("Running command..."))} + +
+ `, + isCustom: false, + }; + } + // Just params (streaming or waiting) + if (params?.command) { + return { + content: html ` +
+ ${renderHeader(state, SquareTerminal, i18n("Running command..."))} + ${params.command}`}> +
+ `, + isCustom: false, + }; + } + // No params yet + return { content: renderHeader(state, SquareTerminal, i18n("Waiting for command...")), isCustom: false }; + } +} +//# sourceMappingURL=BashRenderer.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/BashRenderer.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/BashRenderer.js.map new file mode 100644 index 000000000..27f788574 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/BashRenderer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"BashRenderer.js","sourceRoot":"","sources":["../../../src/tools/renderers/BashRenderer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAOvD,qDAAqD;AACrD,MAAM,OAAO,YAAY;IACxB,MAAM,CAAC,MAA8B,EAAE,MAAgD;QACtF,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC;QAE9E,qCAAqC;QACrC,IAAI,MAAM,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YAC/B,MAAM,MAAM,GACX,MAAM,CAAC,OAAO;gBACb,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC;iBACjC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;iBACvB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACpB,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,OAAO,OAAO,MAAM,EAAE,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC;YACrF,OAAO;gBACN,OAAO,EAAE,IAAI,CAAA;;QAET,YAAY,CAAC,KAAK,EAAE,cAAc,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;gCACvC,QAAQ,aAAa,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;;KAEpF;gBACD,QAAQ,EAAE,KAAK;aACf,CAAC;QACH,CAAC;QAED,qCAAqC;QACrC,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YACrB,OAAO;gBACN,OAAO,EAAE,IAAI,CAAA;;QAET,YAAY,CAAC,KAAK,EAAE,cAAc,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;gCACvC,KAAK,MAAM,CAAC,OAAO,EAAE;;KAEhD;gBACD,QAAQ,EAAE,KAAK;aACf,CAAC;QACH,CAAC;QAED,gBAAgB;QAChB,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,KAAK,EAAE,cAAc,EAAE,IAAI,CAAC,wBAAwB,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC1G,CAAC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/CalculateRenderer.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/CalculateRenderer.d.ts new file mode 100644 index 000000000..32eb33e98 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/CalculateRenderer.d.ts @@ -0,0 +1,10 @@ +import type { ToolResultMessage } from "@mariozechner/pi-ai"; +import type { ToolRenderer, ToolRenderResult } from "../types.js"; +interface CalculateParams { + expression: string; +} +export declare class CalculateRenderer implements ToolRenderer { + render(params: CalculateParams | undefined, result: ToolResultMessage | undefined): ToolRenderResult; +} +export {}; +//# sourceMappingURL=CalculateRenderer.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/CalculateRenderer.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/CalculateRenderer.d.ts.map new file mode 100644 index 000000000..c60ef0db1 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/CalculateRenderer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"CalculateRenderer.d.ts","sourceRoot":"","sources":["../../../src/tools/renderers/CalculateRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAK7D,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAElE,UAAU,eAAe;IACxB,UAAU,EAAE,MAAM,CAAC;CACnB;AAGD,qBAAa,iBAAkB,YAAW,YAAY,CAAC,eAAe,EAAE,SAAS,CAAC;IACjF,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,EAAE,MAAM,EAAE,iBAAiB,CAAC,SAAS,CAAC,GAAG,SAAS,GAAG,gBAAgB;CA4C/G"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/CalculateRenderer.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/CalculateRenderer.js new file mode 100644 index 000000000..5fc6eb874 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/CalculateRenderer.js @@ -0,0 +1,45 @@ +import { html } from "lit"; +import { Calculator } from "lucide"; +import { i18n } from "../../utils/i18n.js"; +import { renderHeader } from "../renderer-registry.js"; +// Calculate tool has undefined details (only uses output) +export class CalculateRenderer { + render(params, result) { + const state = result ? (result.isError ? "error" : "complete") : "inprogress"; + // Full params + full result + if (result && params?.expression) { + const output = result.content + ?.filter((c) => c.type === "text") + .map((c) => c.text) + .join("\n") || ""; + // Error: show expression in header, error below + if (result.isError) { + return { + content: html ` +
+ ${renderHeader(state, Calculator, params.expression)} +
${output}
+
+ `, + isCustom: false, + }; + } + // Success: show expression = result in header + return { content: renderHeader(state, Calculator, `${params.expression} = ${output}`), isCustom: false }; + } + // Full params, no result: just show header with expression in it + if (params?.expression) { + return { + content: renderHeader(state, Calculator, `${i18n("Calculating")} ${params.expression}`), + isCustom: false, + }; + } + // Partial params (empty expression), no result + if (params && !params.expression) { + return { content: renderHeader(state, Calculator, i18n("Writing expression...")), isCustom: false }; + } + // No params, no result + return { content: renderHeader(state, Calculator, i18n("Waiting for expression...")), isCustom: false }; + } +} +//# sourceMappingURL=CalculateRenderer.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/CalculateRenderer.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/CalculateRenderer.js.map new file mode 100644 index 000000000..9db29186b --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/CalculateRenderer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CalculateRenderer.js","sourceRoot":"","sources":["../../../src/tools/renderers/CalculateRenderer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAOvD,0DAA0D;AA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IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YAClC,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,uBAAuB,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;QACrG,CAAC;QAED,uBAAuB;QACvB,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,2BAA2B,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IACzG,CAAC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/DefaultRenderer.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/DefaultRenderer.d.ts new file mode 100644 index 000000000..8bc36cad1 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/DefaultRenderer.d.ts @@ -0,0 +1,6 @@ +import type { ToolResultMessage } from "@mariozechner/pi-ai"; +import type { ToolRenderer, ToolRenderResult } from "../types.js"; +export declare class DefaultRenderer implements ToolRenderer { + render(params: any | undefined, result: ToolResultMessage | undefined, isStreaming?: boolean): ToolRenderResult; +} +//# sourceMappingURL=DefaultRenderer.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/DefaultRenderer.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/DefaultRenderer.d.ts.map new file mode 100644 index 000000000..71a0946c6 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/DefaultRenderer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"DefaultRenderer.d.ts","sourceRoot":"","sources":["../../../src/tools/renderers/DefaultRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAK7D,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAElE,qBAAa,eAAgB,YAAW,YAAY;IACnD,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,SAAS,EAAE,MAAM,EAAE,iBAAiB,GAAG,SAAS,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,gBAAgB;CA8F/G"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/DefaultRenderer.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/DefaultRenderer.js new file mode 100644 index 000000000..406c139d9 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/DefaultRenderer.js @@ -0,0 +1,94 @@ +import { html } from "lit"; +import { Code } from "lucide"; +import { i18n } from "../../utils/i18n.js"; +import { renderHeader } from "../renderer-registry.js"; +export class DefaultRenderer { + render(params, result, isStreaming) { + const state = result ? (result.isError ? "error" : "complete") : isStreaming ? "inprogress" : "complete"; + // Format params as JSON + let paramsJson = ""; + if (params) { + try { + paramsJson = JSON.stringify(JSON.parse(params), null, 2); + } + catch { + try { + paramsJson = JSON.stringify(params, null, 2); + } + catch { + paramsJson = String(params); + } + } + } + // With result: show header + params + result + if (result) { + let outputJson = result.content + ?.filter((c) => c.type === "text") + .map((c) => c.text) + .join("\n") || i18n("(no output)"); + let outputLanguage = "text"; + // Try to parse and pretty-print if it's valid JSON + try { + const parsed = JSON.parse(outputJson); + outputJson = JSON.stringify(parsed, null, 2); + outputLanguage = "json"; + } + catch { + // Not valid JSON, leave as-is and use text highlighting + } + return { + content: html ` +
+ ${renderHeader(state, Code, "Tool Call")} + ${paramsJson + ? html `
+
${i18n("Input")}
+ +
` + : ""} +
+
${i18n("Output")}
+ +
+
+ `, + isCustom: false, + }; + } + // Just params (streaming or waiting for result) + if (params) { + if (isStreaming && (!paramsJson || paramsJson === "{}" || paramsJson === "null")) { + return { + content: html ` +
+ ${renderHeader(state, Code, "Preparing tool parameters...")} +
+ `, + isCustom: false, + }; + } + return { + content: html ` +
+ ${renderHeader(state, Code, "Tool Call")} +
+
${i18n("Input")}
+ +
+
+ `, + isCustom: false, + }; + } + // No params or result yet + return { + content: html ` +
+ ${renderHeader(state, Code, "Preparing tool...")} +
+ `, + isCustom: false, + }; + } +} +//# sourceMappingURL=DefaultRenderer.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/DefaultRenderer.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/DefaultRenderer.js.map new file mode 100644 index 000000000..a282c45f9 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/DefaultRenderer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DefaultRenderer.js","sourceRoot":"","sources":["../../../src/tools/renderers/DefaultRenderer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGvD,MAAM,OAAO,eAAe;IAC3B,MAAM,CAAC,MAAuB,EAAE,MAAqC,EAAE,WAAqB;QAC3F,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC;QAEzG,wBAAwB;QACxB,IAAI,UAAU,GAAG,EAAE,CAAC;QACpB,IAAI,MAAM,EAAE,CAAC;YACZ,IAAI,CAAC;gBACJ,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YAC1D,CAAC;YAAC,MAAM,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,IAAI,WAAW,IAAI,CAAC,CAAC,UAAU,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,MAAM,CAAC,EAAE,CAAC;gBAClF,OAAO;oBACN,OAAO,EAAE,IAAI,CAAA;;SAET,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,8BAA8B,CAAC;;MAE5D;oBACD,QAAQ,EAAE,KAAK;iBACf,CAAC;YACH,CAAC;YAED,OAAO;gBACN,OAAO,EAAE,IAAI,CAAA;;QAET,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC;;qEAEuB,IAAI,CAAC,OAAO,CAAC;2BACvD,UAAU;;;KAGhC;gBACD,QAAQ,EAAE,KAAK;aACf,CAAC;QACH,CAAC;QAED,0BAA0B;QAC1B,OAAO;YACN,OAAO,EAAE,IAAI,CAAA;;OAET,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,mBAAmB,CAAC;;IAEjD;YACD,QAAQ,EAAE,KAAK;SACf,CAAC;IACH,CAAC;CACD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/GetCurrentTimeRenderer.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/GetCurrentTimeRenderer.d.ts new file mode 100644 index 000000000..008e311da --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/GetCurrentTimeRenderer.d.ts @@ -0,0 +1,10 @@ +import type { ToolResultMessage } from "@mariozechner/pi-ai"; +import type { ToolRenderer, ToolRenderResult } from "../types.js"; +interface GetCurrentTimeParams { + timezone?: string; +} +export declare class GetCurrentTimeRenderer implements ToolRenderer { + render(params: GetCurrentTimeParams | undefined, result: ToolResultMessage | undefined): ToolRenderResult; +} +export {}; +//# sourceMappingURL=GetCurrentTimeRenderer.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/GetCurrentTimeRenderer.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/GetCurrentTimeRenderer.d.ts.map new file mode 100644 index 000000000..478cd1abb --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/GetCurrentTimeRenderer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"GetCurrentTimeRenderer.d.ts","sourceRoot":"","sources":["../../../src/tools/renderers/GetCurrentTimeRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAK7D,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAElE,UAAU,oBAAoB;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD,qBAAa,sBAAuB,YAAW,YAAY,CAAC,oBAAoB,EAAE,SAAS,CAAC;IAC3F,MAAM,CACL,MAAM,EAAE,oBAAoB,GAAG,SAAS,EACxC,MAAM,EAAE,iBAAiB,CAAC,SAAS,CAAC,GAAG,SAAS,GAC9C,gBAAgB;CA2EnB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/GetCurrentTimeRenderer.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/GetCurrentTimeRenderer.js new file mode 100644 index 000000000..8eeb1ed36 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/GetCurrentTimeRenderer.js @@ -0,0 +1,72 @@ +import { html } from "lit"; +import { Clock } from "lucide"; +import { i18n } from "../../utils/i18n.js"; +import { renderHeader } from "../renderer-registry.js"; +// GetCurrentTime tool has undefined details (only uses output) +export class GetCurrentTimeRenderer { + render(params, result) { + const state = result ? (result.isError ? "error" : "complete") : "inprogress"; + // Full params + full result + if (result && params) { + const output = result.content + ?.filter((c) => c.type === "text") + .map((c) => c.text) + .join("\n") || ""; + const headerText = params.timezone + ? `${i18n("Getting current time in")} ${params.timezone}` + : i18n("Getting current date and time"); + // Error: show header, error below + if (result.isError) { + return { + content: html ` +
+ ${renderHeader(state, Clock, headerText)} +
${output}
+
+ `, + isCustom: false, + }; + } + // Success: show time in header + return { content: renderHeader(state, Clock, `${headerText}: ${output}`), isCustom: false }; + } + // Full result, no params + if (result) { + const output = result.content + ?.filter((c) => c.type === "text") + .map((c) => c.text) + .join("\n") || ""; + // Error: show header, error below + if (result.isError) { + return { + content: html ` +
+ ${renderHeader(state, Clock, i18n("Getting current date and time"))} +
${output}
+
+ `, + isCustom: false, + }; + } + // Success: show time in header + return { + content: renderHeader(state, Clock, `${i18n("Getting current date and time")}: ${output}`), + isCustom: false, + }; + } + // Full params, no result: show timezone info in header + if (params?.timezone) { + return { + content: renderHeader(state, Clock, `${i18n("Getting current time in")} ${params.timezone}`), + isCustom: false, + }; + } + // Partial params (no timezone) or empty params, no result + if (params) { + return { content: renderHeader(state, Clock, i18n("Getting current date and time")), isCustom: false }; + } + // No params, no result + return { content: renderHeader(state, Clock, i18n("Getting time...")), isCustom: false }; + } +} +//# sourceMappingURL=GetCurrentTimeRenderer.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/GetCurrentTimeRenderer.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/GetCurrentTimeRenderer.js.map new file mode 100644 index 000000000..03f1b838d --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/renderers/GetCurrentTimeRenderer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"GetCurrentTimeRenderer.js","sourceRoot":"","sources":["../../../src/tools/renderers/GetCurrentTimeRenderer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAOvD,+DAA+D;AAC/D,MAAM,OAAO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Chat/tools/types.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/types.d.ts new file mode 100644 index 000000000..1224c58e2 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/types.d.ts @@ -0,0 +1,10 @@ +import type { ToolResultMessage } from "@mariozechner/pi-ai"; +import type { TemplateResult } from "lit"; +export interface ToolRenderResult { + content: TemplateResult; + isCustom: boolean; +} +export interface ToolRenderer { + render(params: TParams | undefined, result: ToolResultMessage | undefined, isStreaming?: boolean): ToolRenderResult; +} +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/types.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/types.d.ts.map new file mode 100644 index 000000000..4169ce0f7 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAE1C,MAAM,WAAW,gBAAgB;IAChC,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,YAAY,CAAC,OAAO,GAAG,GAAG,EAAE,QAAQ,GAAG,GAAG;IAC1D,MAAM,CACL,MAAM,EAAE,OAAO,GAAG,SAAS,EAC3B,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,GAAG,SAAS,EAC/C,WAAW,CAAC,EAAE,OAAO,GACnB,gBAAgB,CAAC;CACpB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/types.js b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/types.js new file mode 100644 index 000000000..718fd38ae --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/tools/types.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/types.js.map new file mode 100644 index 000000000..9b8fe63a1 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/tools/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/attachment-utils.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/attachment-utils.d.ts new file mode 100644 index 000000000..7b6d7b4dd --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/attachment-utils.d.ts @@ -0,0 +1,19 @@ +export interface Attachment { + id: string; + type: "image" | "document"; + fileName: string; + mimeType: string; + size: number; + content: string; + extractedText?: string; + preview?: string; +} +/** + * Load an attachment from various sources + * @param source - URL string, File, Blob, or ArrayBuffer + * @param fileName - Optional filename override + * @returns Promise + * @throws Error if loading fails + */ +export declare function loadAttachment(source: string | File | Blob | ArrayBuffer, fileName?: string): Promise; +//# sourceMappingURL=attachment-utils.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/attachment-utils.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/attachment-utils.d.ts.map new file mode 100644 index 000000000..a5d549283 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/attachment-utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"attachment-utils.d.ts","sourceRoot":"","sources":["../../src/utils/attachment-utils.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,UAAU;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,OAAO,GAAG,UAAU,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CACnC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,WAAW,EAC1C,QAAQ,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,UAAU,CAAC,CAyKrB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/attachment-utils.js b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/attachment-utils.js new file mode 100644 index 000000000..e739dbbd6 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/attachment-utils.js @@ -0,0 +1,415 @@ +import { parseAsync } from "docx-preview"; +import JSZip from "jszip"; +import * as pdfjsLib from "pdfjs-dist"; +import * as XLSX from "xlsx"; +import { i18n } from "./i18n.js"; +// Configure PDF.js worker - we'll need to bundle this +pdfjsLib.GlobalWorkerOptions.workerSrc = new URL("pdfjs-dist/build/pdf.worker.min.mjs", import.meta.url).toString(); +/** + * Load an attachment from various sources + * @param source - URL string, File, Blob, or ArrayBuffer + * @param fileName - Optional filename override + * @returns Promise + * @throws Error if loading fails + */ +export async function loadAttachment(source, fileName) { + let arrayBuffer; + let detectedFileName = fileName || "unnamed"; + let mimeType = "application/octet-stream"; + let size = 0; + // Convert source to ArrayBuffer + if (typeof source === "string") { + // It's a URL - fetch it + const response = await fetch(source); + if (!response.ok) { + throw new Error(i18n("Failed to fetch file")); + } + arrayBuffer = await response.arrayBuffer(); + size = arrayBuffer.byteLength; + mimeType = response.headers.get("content-type") || mimeType; + if (!fileName) { + // Try to extract filename from URL + const urlParts = source.split("/"); + detectedFileName = urlParts[urlParts.length - 1] || "document"; + } + } + else if (source instanceof File) { + arrayBuffer = await source.arrayBuffer(); + size = source.size; + mimeType = source.type || mimeType; + detectedFileName = fileName || source.name; + } + else if (source instanceof Blob) { + arrayBuffer = await source.arrayBuffer(); + size = source.size; + mimeType = source.type || mimeType; + } + else if (source instanceof ArrayBuffer) { + arrayBuffer = source; + size = source.byteLength; + } + else { + throw new Error(i18n("Invalid source type")); + } + // Convert ArrayBuffer to base64 - handle large files properly + const uint8Array = new Uint8Array(arrayBuffer); + let binary = ""; + const chunkSize = 0x8000; // Process in 32KB chunks to avoid stack overflow + for (let i = 0; i < uint8Array.length; i += chunkSize) { + const chunk = uint8Array.slice(i, i + chunkSize); + binary += String.fromCharCode(...chunk); + } + const base64Content = btoa(binary); + // Detect type and process accordingly + const id = `${detectedFileName}_${Date.now()}_${Math.random()}`; + // Check if it's a PDF + if (mimeType === "application/pdf" || detectedFileName.toLowerCase().endsWith(".pdf")) { + const { extractedText, preview } = await processPdf(arrayBuffer, detectedFileName); + return { + id, + type: "document", + fileName: detectedFileName, + mimeType: "application/pdf", + size, + content: base64Content, + extractedText, + preview, + }; + } + // Check if it's a DOCX file + if (mimeType === "application/vnd.openxmlformats-officedocument.wordprocessingml.document" || + detectedFileName.toLowerCase().endsWith(".docx")) { + const { extractedText } = await processDocx(arrayBuffer, detectedFileName); + return { + id, + type: "document", + fileName: detectedFileName, + mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + size, + content: base64Content, + extractedText, + }; + } + // Check if it's a PPTX file + if (mimeType === "application/vnd.openxmlformats-officedocument.presentationml.presentation" || + detectedFileName.toLowerCase().endsWith(".pptx")) { + const { extractedText } = await processPptx(arrayBuffer, detectedFileName); + return { + id, + type: "document", + fileName: detectedFileName, + mimeType: "application/vnd.openxmlformats-officedocument.presentationml.presentation", + size, + content: base64Content, + extractedText, + }; + } + // Check if it's an Excel file (XLSX/XLS) + const excelMimeTypes = [ + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "application/vnd.ms-excel", + ]; + if (excelMimeTypes.includes(mimeType) || + detectedFileName.toLowerCase().endsWith(".xlsx") || + detectedFileName.toLowerCase().endsWith(".xls")) { + const { extractedText } = await processExcel(arrayBuffer, detectedFileName); + return { + id, + type: "document", + fileName: detectedFileName, + mimeType: mimeType.startsWith("application/vnd") + ? mimeType + : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + size, + content: base64Content, + extractedText, + }; + } + // Check if it's an image + if (mimeType.startsWith("image/")) { + return { + id, + type: "image", + fileName: detectedFileName, + mimeType, + size, + content: base64Content, + preview: base64Content, // For images, preview is the same as content + }; + } + // Check if it's a text document + const textExtensions = [ + ".txt", + ".md", + ".json", + ".xml", + ".html", + ".css", + ".js", + ".ts", + ".jsx", + ".tsx", + ".yml", + ".yaml", + ]; + const isTextFile = mimeType.startsWith("text/") || textExtensions.some((ext) => detectedFileName.toLowerCase().endsWith(ext)); + if (isTextFile) { + const decoder = new TextDecoder(); + const text = decoder.decode(arrayBuffer); + return { + id, + type: "document", + fileName: detectedFileName, + mimeType: mimeType.startsWith("text/") ? mimeType : "text/plain", + size, + content: base64Content, + extractedText: text, + }; + } + throw new Error(`Unsupported file type: ${mimeType}`); +} +async function processPdf(arrayBuffer, fileName) { + let pdf = null; + try { + pdf = await pdfjsLib.getDocument({ data: arrayBuffer }).promise; + // Extract text with page structure + let extractedText = ``; + for (let i = 1; i <= pdf.numPages; i++) { + const page = await pdf.getPage(i); + const textContent = await page.getTextContent(); + const pageText = textContent.items + .map((item) => item.str) + .filter((str) => str.trim()) + .join(" "); + extractedText += `\n\n${pageText}\n`; + } + extractedText += "\n"; + // Generate preview from first page + const preview = await generatePdfPreview(pdf); + return { extractedText, preview }; + } + catch (error) { + console.error("Error processing PDF:", error); + throw new Error(`Failed to process PDF: ${String(error)}`); + } + finally { + // Clean up PDF resources + if (pdf) { + pdf.destroy(); + } + } +} +async function generatePdfPreview(pdf) { + try { + const page = await pdf.getPage(1); + const viewport = page.getViewport({ scale: 1.0 }); + // Create canvas with reasonable size for thumbnail (160x160 max) + const scale = Math.min(160 / viewport.width, 160 / viewport.height); + const scaledViewport = page.getViewport({ scale }); + const canvas = document.createElement("canvas"); + const context = canvas.getContext("2d"); + if (!context) { + return undefined; + } + canvas.height = scaledViewport.height; + canvas.width = scaledViewport.width; + const renderContext = { + canvasContext: context, + viewport: scaledViewport, + canvas: canvas, + }; + await page.render(renderContext).promise; + // Return base64 without data URL prefix + return canvas.toDataURL("image/png").split(",")[1]; + } + catch (error) { + console.error("Error generating PDF preview:", error); + return undefined; + } +} +async function processDocx(arrayBuffer, fileName) { + try { + // Parse document structure + const wordDoc = await parseAsync(arrayBuffer); + // Extract structured text from document body + let extractedText = `\n\n`; + const body = wordDoc.documentPart?.body; + if (body?.children) { + // Walk through document elements and extract text + const texts = []; + for (const element of body.children) { + const text = extractTextFromElement(element); + if (text) { + texts.push(text); + } + } + extractedText += texts.join("\n"); + } + extractedText += `\n\n`; + return { extractedText }; + } + catch (error) { + console.error("Error processing DOCX:", error); + throw new Error(`Failed to process DOCX: ${String(error)}`); + } +} +function extractTextFromElement(element) { + let text = ""; + // Check type with lowercase + const elementType = element.type?.toLowerCase() || ""; + // Handle paragraphs + if (elementType === "paragraph" && element.children) { + for (const child of element.children) { + const childType = child.type?.toLowerCase() || ""; + if (childType === "run" && child.children) { + for (const textChild of child.children) { + const textType = textChild.type?.toLowerCase() || ""; + if (textType === "text") { + text += textChild.text || ""; + } + } + } + else if (childType === "text") { + text += child.text || ""; + } + } + } + // Handle tables + else if (elementType === "table") { + if (element.children) { + const tableTexts = []; + for (const row of element.children) { + const rowType = row.type?.toLowerCase() || ""; + if (rowType === "tablerow" && row.children) { + const rowTexts = []; + for (const cell of row.children) { + const cellType = cell.type?.toLowerCase() || ""; + if (cellType === "tablecell" && cell.children) { + const cellTexts = []; + for (const cellElement of cell.children) { + const cellText = extractTextFromElement(cellElement); + if (cellText) + cellTexts.push(cellText); + } + if (cellTexts.length > 0) + rowTexts.push(cellTexts.join(" ")); + } + } + if (rowTexts.length > 0) + tableTexts.push(rowTexts.join(" | ")); + } + } + if (tableTexts.length > 0) { + text = "\n[Table]\n" + tableTexts.join("\n") + "\n[/Table]\n"; + } + } + } + // Recursively handle other container elements + else if (element.children && Array.isArray(element.children)) { + const childTexts = []; + for (const child of element.children) { + const childText = extractTextFromElement(child); + if (childText) + childTexts.push(childText); + } + text = childTexts.join(" "); + } + return text.trim(); +} +async function processPptx(arrayBuffer, fileName) { + try { + // Load the PPTX file as a ZIP + const zip = await JSZip.loadAsync(arrayBuffer); + // PPTX slides are stored in ppt/slides/slide[n].xml + let extractedText = ``; + // Get all slide files and sort them numerically + const slideFiles = Object.keys(zip.files) + .filter((name) => name.match(/ppt\/slides\/slide\d+\.xml$/)) + .sort((a, b) => { + const numA = Number.parseInt(a.match(/slide(\d+)\.xml$/)?.[1] || "0", 10); + const numB = Number.parseInt(b.match(/slide(\d+)\.xml$/)?.[1] || "0", 10); + return numA - numB; + }); + // Extract text from each slide + for (let i = 0; i < slideFiles.length; i++) { + const slideFile = zip.file(slideFiles[i]); + if (slideFile) { + const slideXml = await slideFile.async("text"); + // Extract text from XML (simple regex approach) + // Looking for tags which contain text in PPTX + const textMatches = slideXml.match(/]*>([^<]+)<\/a:t>/g); + if (textMatches) { + extractedText += `\n`; + const slideTexts = textMatches + .map((match) => { + const textMatch = match.match(/]*>([^<]+)<\/a:t>/); + return textMatch ? textMatch[1] : ""; + }) + .filter((t) => t.trim()); + if (slideTexts.length > 0) { + extractedText += "\n" + slideTexts.join("\n"); + } + extractedText += "\n"; + } + } + } + // Also try to extract text from notes + const notesFiles = Object.keys(zip.files) + .filter((name) => name.match(/ppt\/notesSlides\/notesSlide\d+\.xml$/)) + .sort((a, b) => { + const numA = Number.parseInt(a.match(/notesSlide(\d+)\.xml$/)?.[1] || "0", 10); + const numB = Number.parseInt(b.match(/notesSlide(\d+)\.xml$/)?.[1] || "0", 10); + return numA - numB; + }); + if (notesFiles.length > 0) { + extractedText += "\n"; + for (const noteFile of notesFiles) { + const file = zip.file(noteFile); + if (file) { + const noteXml = await file.async("text"); + const textMatches = noteXml.match(/]*>([^<]+)<\/a:t>/g); + if (textMatches) { + const noteTexts = textMatches + .map((match) => { + const textMatch = match.match(/]*>([^<]+)<\/a:t>/); + return textMatch ? textMatch[1] : ""; + }) + .filter((t) => t.trim()); + if (noteTexts.length > 0) { + const slideNum = noteFile.match(/notesSlide(\d+)\.xml$/)?.[1]; + extractedText += `\n[Slide ${slideNum} notes]: ${noteTexts.join(" ")}`; + } + } + } + } + extractedText += "\n"; + } + extractedText += "\n"; + return { extractedText }; + } + catch (error) { + console.error("Error processing PPTX:", error); + throw new Error(`Failed to process PPTX: ${String(error)}`); + } +} +async function processExcel(arrayBuffer, fileName) { + try { + // Read the workbook + const workbook = XLSX.read(arrayBuffer, { type: "array" }); + let extractedText = ``; + // Process each sheet + for (const [index, sheetName] of workbook.SheetNames.entries()) { + const worksheet = workbook.Sheets[sheetName]; + // Extract text as CSV for the extractedText field + const csvText = XLSX.utils.sheet_to_csv(worksheet); + extractedText += `\n\n${csvText}\n`; + } + extractedText += "\n"; + return { extractedText }; + } + catch (error) { + console.error("Error processing Excel:", error); + throw new Error(`Failed to process Excel: ${String(error)}`); + } +} +//# sourceMappingURL=attachment-utils.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/attachment-utils.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/attachment-utils.js.map new file mode 100644 index 000000000..56b2e7a46 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/attachment-utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"attachment-utils.js","sourceRoot":"","sources":["../../src/utils/attachment-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE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C,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,4BAA4B,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC9D,CAAC;AACF,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/auth-token.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/auth-token.d.ts new file mode 100644 index 000000000..2c58c2451 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/auth-token.d.ts @@ -0,0 +1,3 @@ +export declare function getAuthToken(): Promise; +export declare function clearAuthToken(): Promise; +//# sourceMappingURL=auth-token.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/auth-token.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/auth-token.d.ts.map new file mode 100644 index 000000000..1e2f56635 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/auth-token.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"auth-token.d.ts","sourceRoot":"","sources":["../../src/utils/auth-token.ts"],"names":[],"mappings":"AAGA,wBAAsB,YAAY,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAchE;AAED,wBAAsB,cAAc,kBAEnC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/auth-token.js b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/auth-token.js new file mode 100644 index 000000000..498da5f24 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/auth-token.js @@ -0,0 +1,19 @@ +import PromptDialog from "@mariozechner/mini-lit/dist/PromptDialog.js"; +import { i18n } from "./i18n.js"; +export async function getAuthToken() { + let authToken = localStorage.getItem(`auth-token`) || ""; + if (authToken) + return authToken; + while (true) { + authToken = (await PromptDialog.ask(i18n("Enter Auth Token"), i18n("Please enter your auth token."), "", true))?.trim(); + if (authToken) { + localStorage.setItem(`auth-token`, authToken); + break; + } + } + return authToken?.trim() || undefined; +} +export async function clearAuthToken() { + localStorage.removeItem(`auth-token`); +} +//# sourceMappingURL=auth-token.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/auth-token.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/auth-token.js.map new file mode 100644 index 000000000..a8e269048 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/auth-token.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth-token.js","sourceRoot":"","sources":["../../src/utils/auth-token.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,6CAA6C,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,CAAC,KAAK,UAAU,YAAY;IACjC,IAAI,SAAS,GAAuB,YAAY,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;IAC7E,IAAI,SAAS;QAAE,OAAO,SAAS,CAAC;IAEhC,OAAO,IAAI,EAAE,CAAC;QACb,SAAS,GAAG,CACX,MAAM,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,IAAI,CAAC,+BAA+B,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,CACjG,EAAE,IAAI,EAAE,CAAC;QACV,IAAI,SAAS,EAAE,CAAC;YACf,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;YAC9C,MAAM;QACP,CAAC;IACF,CAAC;IACD,OAAO,SAAS,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;AACvC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc;IACnC,YAAY,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AACvC,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/format.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/format.d.ts new file mode 100644 index 000000000..899c71c28 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/format.d.ts @@ -0,0 +1,6 @@ +import type { Usage } from "@mariozechner/pi-ai"; +export declare function formatCost(cost: number): string; +export declare function formatModelCost(cost: any): string; +export declare function formatUsage(usage: Usage): string; +export declare function formatTokenCount(count: number): string; +//# sourceMappingURL=format.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/format.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/format.d.ts.map new file mode 100644 index 000000000..5cb3fe2c6 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/format.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,CAejD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,UAWvC;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAItD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/format.js b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/format.js new file mode 100644 index 000000000..fbdc00de8 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/format.js @@ -0,0 +1,47 @@ +import { i18n } from "@mariozechner/mini-lit"; +export function formatCost(cost) { + return `$${cost.toFixed(4)}`; +} +export function formatModelCost(cost) { + if (!cost) + return i18n("Free"); + const input = cost.input || 0; + const output = cost.output || 0; + if (input === 0 && output === 0) + return i18n("Free"); + // Format numbers with appropriate precision + const formatNum = (num) => { + if (num >= 100) + return num.toFixed(0); + if (num >= 10) + return num.toFixed(1).replace(/\.0$/, ""); + if (num >= 1) + return num.toFixed(2).replace(/\.?0+$/, ""); + return num.toFixed(3).replace(/\.?0+$/, ""); + }; + return `$${formatNum(input)}/$${formatNum(output)}`; +} +export function formatUsage(usage) { + if (!usage) + return ""; + const parts = []; + if (usage.input) + parts.push(`↑${formatTokenCount(usage.input)}`); + if (usage.output) + parts.push(`↓${formatTokenCount(usage.output)}`); + if (usage.cacheRead) + parts.push(`R${formatTokenCount(usage.cacheRead)}`); + if (usage.cacheWrite) + parts.push(`W${formatTokenCount(usage.cacheWrite)}`); + if (usage.cost?.total) + parts.push(formatCost(usage.cost.total)); + return parts.join(" "); +} +export function formatTokenCount(count) { + if (count < 1000) + return count.toString(); + if (count < 10000) + return (count / 1000).toFixed(1) + "k"; + return Math.round(count / 1000) + "k"; +} +//# sourceMappingURL=format.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/format.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/format.js.map new file mode 100644 index 000000000..99cc3d6d3 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/format.js.map @@ -0,0 +1 @@ +{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAG9C,MAAM,UAAU,UAAU,CAAC,IAAY;IACtC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAS;IACxC,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;IAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;IAChC,IAAI,KAAK,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC,MAAM,C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CAAC;IAC3E,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK;QAAE,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAEhE,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC7C,IAAI,KAAK,GAAG,IAAI;QAAE,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC1C,IAAI,KAAK,GAAG,KAAK;QAAE,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;IAC1D,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC;AACvC,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/i18n.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/i18n.d.ts new file mode 100644 index 000000000..0aa1b0b3a --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/i18n.d.ts @@ -0,0 +1,636 @@ +import { type MiniLitRequiredMessages } from "@mariozechner/mini-lit"; +declare module "@mariozechner/mini-lit" { + interface i18nMessages extends MiniLitRequiredMessages { + Free: string; + "Input Required": string; + Cancel: string; + Confirm: string; + "Select Model": string; + "Search models...": string; + Format: string; + Thinking: string; + Vision: string; + You: string; + Assistant: string; + "Thinking...": string; + "Type your message...": string; + "API Keys Configuration": string; + "Configure API keys for LLM providers. Keys are stored locally in your browser.": string; + Configured: string; + "Not configured": string; + "✓ Valid": string; + "✗ Invalid": string; + "Testing...": string; + Update: string; + Test: string; + Remove: string; + Save: string; + "Update API key": string; + "Enter API key": string; + "Type a message...": string; + "Failed to fetch file": string; + "Invalid source type": string; + PDF: string; + Document: string; + Presentation: string; + Spreadsheet: string; + Text: string; + "Error loading file": string; + "No text content available": string; + "Failed to load PDF": string; + "Failed to load document": string; + "Failed to load spreadsheet": string; + "Error loading PDF": string; + "Error loading document": string; + "Error loading spreadsheet": string; + "Preview not available for this file type.": string; + "Click the download button above to view it on your computer.": string; + "No content available": string; + "Failed to display text content": string; + "API keys are required to use AI models. Get your keys from the provider's website.": string; + console: string; + "Copy output": string; + "Copied!": string; + "Error:": string; + "Request aborted": string; + Call: string; + Result: string; + "(no result)": string; + "Waiting for tool result…": string; + "Call was aborted; no result.": string; + "No session available": string; + "No session set": string; + "Preparing tool parameters...": string; + "(no output)": string; + Input: string; + Output: string; + "Writing expression...": string; + "Waiting for expression...": string; + Calculating: string; + "Getting current time in": string; + "Getting current date and time": string; + "Waiting for command...": string; + "Writing command...": string; + "Running command...": string; + "Command failed:": string; + "Enter Auth Token": string; + "Please enter your auth token.": string; + "Auth token is required for proxy transport": string; + "Execution aborted": string; + "Code parameter is required": string; + "Unknown error": string; + "Code executed successfully (no output)": string; + "Execution failed": string; + "JavaScript REPL": string; + "JavaScript code to execute": string; + "Writing JavaScript code...": string; + "Executing JavaScript": string; + "Preparing JavaScript...": string; + "Preparing command...": string; + "Preparing calculation...": string; + "Preparing tool...": string; + "Getting time...": string; + "Processing artifact...": string; + "Preparing artifact...": string; + "Processing artifact": string; + "Processed artifact": string; + "Creating artifact": string; + "Created artifact": string; + "Updating artifact": string; + "Updated artifact": string; + "Rewriting artifact": string; + "Rewrote artifact": string; + "Getting artifact": string; + "Got artifact": string; + "Deleting artifact": string; + "Deleted artifact": string; + "Getting logs": string; + "Got logs": string; + "An error occurred": string; + "Copy logs": string; + "Autoscroll enabled": string; + "Autoscroll disabled": string; + Processing: string; + Create: string; + Rewrite: string; + Get: string; + Delete: string; + "Get logs": string; + "Show artifacts": string; + "Close artifacts": string; + Artifacts: string; + "Copy HTML": string; + "Download HTML": string; + "Reload HTML": string; + "Copy SVG": string; + "Download SVG": string; + "Copy Markdown": string; + "Download Markdown": string; + Download: string; + "No logs for {filename}": string; + "API Keys Settings": string; + Settings: string; + "API Keys": string; + Proxy: string; + "Use CORS Proxy": string; + "Proxy URL": string; + "Format: The proxy must accept requests as /?url=": string; + "Settings are stored locally in your browser": string; + Clear: string; + "API Key Required": string; + "Enter your API key for {provider}": string; + "Allows browser-based apps to bypass CORS restrictions when calling LLM providers. Required for Z-AI and Anthropic with OAuth token.": string; + Off: string; + Minimal: string; + Low: string; + Medium: string; + High: string; + "Storage Permission Required": string; + "This app needs persistent storage to save your conversations": string; + "Why is this needed?": string; + "Without persistent storage, your browser may delete saved conversations when it needs disk space. Granting this permission ensures your chat history is preserved.": string; + "What this means:": string; + "Your conversations will be saved locally in your browser": string; + "Data will not be deleted automatically to free up space": string; + "You can still manually clear data at any time": string; + "No data is sent to external servers": string; + "Continue Anyway": string; + "Requesting...": string; + "Grant Permission": string; + Sessions: string; + "Load a previous conversation": string; + "No sessions yet": string; + "Delete this session?": string; + Today: string; + Yesterday: string; + "{days} days ago": string; + messages: string; + tokens: string; + "Drop files here": string; + "Providers & Models": string; + "Cloud Providers": string; + "Cloud LLM providers with predefined models. API keys are stored locally in your browser.": string; + "Custom Providers": string; + "User-configured servers with auto-discovered or manually defined models.": string; + "Add Provider": string; + "No custom providers configured. Click 'Add Provider' to get started.": string; + Models: string; + "auto-discovered": string; + Refresh: string; + Edit: string; + "Are you sure you want to delete this provider?": string; + "Edit Provider": string; + "Provider Name": string; + "e.g., My Ollama Server": string; + "Provider Type": string; + "Base URL": string; + "e.g., http://localhost:11434": string; + "API Key (Optional)": string; + "Leave empty if not required": string; + "Test Connection": string; + Discovered: string; + models: string; + and: string; + more: string; + "For manual provider types, add models after saving the provider.": string; + "Please fill in all required fields": string; + "Failed to save provider": string; + "OpenAI Completions Compatible": string; + "OpenAI Responses Compatible": string; + "Anthropic Messages Compatible": string; + "Checking...": string; + Disconnected: string; + } +} +export declare const translations: { + en: { + Free: string; + "Input Required": string; + Cancel: string; + Confirm: string; + "Select Model": string; + "Search models...": string; + Format: string; + Thinking: string; + Vision: string; + You: string; + Assistant: string; + "Thinking...": string; + "Type your message...": string; + "API Keys Configuration": string; + "Configure API keys for LLM providers. Keys are stored locally in your browser.": string; + Configured: string; + "Not configured": string; + "\u2713 Valid": string; + "\u2717 Invalid": string; + "Testing...": string; + Update: string; + Test: string; + Remove: string; + Save: string; + "Update API key": string; + "Enter API key": string; + "Type a message...": string; + "Failed to fetch file": string; + "Invalid source type": string; + PDF: string; + Document: string; + Presentation: string; + Spreadsheet: string; + Text: string; + "Error loading file": string; + "No text content available": string; + "Failed to load PDF": string; + "Failed to load document": string; + "Failed to load spreadsheet": string; + "Error loading PDF": string; + "Error loading document": string; + "Error loading spreadsheet": string; + "Preview not available for this file type.": string; + "Click the download button above to view it on your computer.": string; + "No content available": string; + "Failed to display text content": string; + "API keys are required to use AI models. Get your keys from the provider's website.": string; + console: string; + "Copy output": string; + "Copied!": string; + "Error:": string; + "Request aborted": string; + Call: string; + Result: string; + "(no result)": string; + "Waiting for tool result\u2026": string; + "Call was aborted; no result.": string; + "No session available": string; + "No session set": string; + "Preparing tool parameters...": string; + "(no output)": string; + Input: string; + Output: string; + "Waiting for expression...": string; + "Writing expression...": string; + Calculating: string; + "Getting current time in": string; + "Getting current date and time": string; + "Waiting for command...": string; + "Writing command...": string; + "Running command...": string; + "Command failed": string; + "Enter Auth Token": string; + "Please enter your auth token.": string; + "Auth token is required for proxy transport": string; + "Execution aborted": string; + "Code parameter is required": string; + "Unknown error": string; + "Code executed successfully (no output)": string; + "Execution failed": string; + "JavaScript REPL": string; + "JavaScript code to execute": string; + "Writing JavaScript code...": string; + "Executing JavaScript": string; + "Preparing JavaScript...": string; + "Preparing command...": string; + "Preparing calculation...": string; + "Preparing tool...": string; + "Getting time...": string; + "Processing artifact...": string; + "Preparing artifact...": string; + "Processing artifact": string; + "Processed artifact": string; + "Creating artifact": string; + "Created artifact": string; + "Updating artifact": string; + "Updated artifact": string; + "Rewriting artifact": string; + "Rewrote artifact": string; + "Getting artifact": string; + "Got artifact": string; + "Deleting artifact": string; + "Deleted artifact": string; + "Getting logs": string; + "Got logs": string; + "An error occurred": string; + "Copy logs": string; + "Autoscroll enabled": string; + "Autoscroll disabled": string; + Processing: string; + Create: string; + Rewrite: string; + Get: string; + "Get logs": string; + "Show artifacts": string; + "Close artifacts": string; + Artifacts: string; + "Copy HTML": string; + "Download HTML": string; + "Reload HTML": string; + "Copy SVG": string; + "Download SVG": string; + "Copy Markdown": string; + "Download Markdown": string; + Download: string; + "No logs for {filename}": string; + "API Keys Settings": string; + Settings: string; + "API Keys": string; + Proxy: string; + "Use CORS Proxy": string; + "Proxy URL": string; + "Format: The proxy must accept requests as /?url=": string; + "Settings are stored locally in your browser": string; + Clear: string; + "API Key Required": string; + "Enter your API key for {provider}": string; + "Allows browser-based apps to bypass CORS restrictions when calling LLM providers. Required for Z-AI and Anthropic with OAuth token.": string; + Off: string; + Minimal: string; + Low: string; + Medium: string; + High: string; + "Storage Permission Required": string; + "This app needs persistent storage to save your conversations": string; + "Why is this needed?": string; + "Without persistent storage, your browser may delete saved conversations when it needs disk space. Granting this permission ensures your chat history is preserved.": string; + "What this means:": string; + "Your conversations will be saved locally in your browser": string; + "Data will not be deleted automatically to free up space": string; + "You can still manually clear data at any time": string; + "No data is sent to external servers": string; + "Continue Anyway": string; + "Requesting...": string; + "Grant Permission": string; + Sessions: string; + "Load a previous conversation": string; + "No sessions yet": string; + "Delete this session?": string; + Today: string; + Yesterday: string; + "{days} days ago": string; + messages: string; + tokens: string; + Delete: string; + "Drop files here": string; + "Command failed:": string; + "Providers & Models": string; + "Cloud Providers": string; + "Cloud LLM providers with predefined models. API keys are stored locally in your browser.": string; + "Custom Providers": string; + "User-configured servers with auto-discovered or manually defined models.": string; + "Add Provider": string; + "No custom providers configured. Click 'Add Provider' to get started.": string; + "auto-discovered": string; + Refresh: string; + Edit: string; + "Are you sure you want to delete this provider?": string; + "Edit Provider": string; + "Provider Name": string; + "e.g., My Ollama Server": string; + "Provider Type": string; + "Base URL": string; + "e.g., http://localhost:11434": string; + "API Key (Optional)": string; + "Leave empty if not required": string; + "Test Connection": string; + Discovered: string; + Models: string; + models: string; + and: string; + more: string; + "For manual provider types, add models after saving the provider.": string; + "Please fill in all required fields": string; + "Failed to save provider": string; + "OpenAI Completions Compatible": string; + "OpenAI Responses Compatible": string; + "Anthropic Messages Compatible": string; + "Checking...": string; + Disconnected: string; + "*": string; + Copy: string; + "Copy code": string; + Close: string; + Preview: string; + Code: string; + "Loading...": string; + "Select an option": string; + "Mode 1": string; + "Mode 2": string; + Required: string; + Optional: string; + }; + de: { + Free: string; + "Input Required": string; + Cancel: string; + Confirm: string; + "Select Model": string; + "Search models...": string; + Format: string; + Thinking: string; + Vision: string; + You: string; + Assistant: string; + "Thinking...": string; + "Type your message...": string; + "API Keys Configuration": string; + "Configure API keys for LLM providers. Keys are stored locally in your browser.": string; + Configured: string; + "Not configured": string; + "\u2713 Valid": string; + "\u2717 Invalid": string; + "Testing...": string; + Update: string; + Test: string; + Remove: string; + Save: string; + "Update API key": string; + "Enter API key": string; + "Type a message...": string; + "Failed to fetch file": string; + "Invalid source type": string; + PDF: string; + Document: string; + Presentation: string; + Spreadsheet: string; + Text: string; + "Error loading file": string; + "No text content available": string; + "Failed to load PDF": string; + "Failed to load document": string; + "Failed to load spreadsheet": string; + "Error loading PDF": string; + "Error loading document": string; + "Error loading spreadsheet": string; + "Preview not available for this file type.": string; + "Click the download button above to view it on your computer.": string; + "No content available": string; + "Failed to display text content": string; + "API keys are required to use AI models. Get your keys from the provider's website.": string; + console: string; + "Copy output": string; + "Copied!": string; + "Error:": string; + "Request aborted": string; + Call: string; + Result: string; + "(no result)": string; + "Waiting for tool result\u2026": string; + "Call was aborted; no result.": string; + "No session available": string; + "No session set": string; + "Preparing tool parameters...": string; + "(no output)": string; + Input: string; + Output: string; + "Waiting for expression...": string; + "Writing expression...": string; + Calculating: string; + "Getting current time in": string; + "Getting current date and time": string; + "Waiting for command...": string; + "Writing command...": string; + "Running command...": string; + "Command failed": string; + "Enter Auth Token": string; + "Please enter your auth token.": string; + "Auth token is required for proxy transport": string; + "Execution aborted": string; + "Code parameter is required": string; + "Unknown error": string; + "Code executed successfully (no output)": string; + "Execution failed": string; + "JavaScript REPL": string; + "JavaScript code to execute": string; + "Writing JavaScript code...": string; + "Executing JavaScript": string; + "Preparing JavaScript...": string; + "Preparing command...": string; + "Preparing calculation...": string; + "Preparing tool...": string; + "Getting time...": string; + "Processing artifact...": string; + "Preparing artifact...": string; + "Processing artifact": string; + "Processed artifact": string; + "Creating artifact": string; + "Created artifact": string; + "Updating artifact": string; + "Updated artifact": string; + "Rewriting artifact": string; + "Rewrote artifact": string; + "Getting artifact": string; + "Got artifact": string; + "Deleting artifact": string; + "Deleted artifact": string; + "Getting logs": string; + "Got logs": string; + "An error occurred": string; + "Copy logs": string; + "Autoscroll enabled": string; + "Autoscroll disabled": string; + Processing: string; + Create: string; + Rewrite: string; + Get: string; + "Get logs": string; + "Show artifacts": string; + "Close artifacts": string; + Artifacts: string; + "Copy HTML": string; + "Download HTML": string; + "Reload HTML": string; + "Copy SVG": string; + "Download SVG": string; + "Copy Markdown": string; + "Download Markdown": string; + Download: string; + "No logs for {filename}": string; + "API Keys Settings": string; + Settings: string; + "API Keys": string; + Proxy: string; + "Use CORS Proxy": string; + "Proxy URL": string; + "Format: The proxy must accept requests as /?url=": string; + "Settings are stored locally in your browser": string; + Clear: string; + "API Key Required": string; + "Enter your API key for {provider}": string; + "Allows browser-based apps to bypass CORS restrictions when calling LLM providers. Required for Z-AI and Anthropic with OAuth token.": string; + Off: string; + Minimal: string; + Low: string; + Medium: string; + High: string; + "Storage Permission Required": string; + "This app needs persistent storage to save your conversations": string; + "Why is this needed?": string; + "Without persistent storage, your browser may delete saved conversations when it needs disk space. Granting this permission ensures your chat history is preserved.": string; + "What this means:": string; + "Your conversations will be saved locally in your browser": string; + "Data will not be deleted automatically to free up space": string; + "You can still manually clear data at any time": string; + "No data is sent to external servers": string; + "Continue Anyway": string; + "Requesting...": string; + "Grant Permission": string; + Sessions: string; + "Load a previous conversation": string; + "No sessions yet": string; + "Delete this session?": string; + Today: string; + Yesterday: string; + "{days} days ago": string; + messages: string; + tokens: string; + Delete: string; + "Drop files here": string; + "Command failed:": string; + "Providers & Models": string; + "Cloud Providers": string; + "Cloud LLM providers with predefined models. API keys are stored locally in your browser.": string; + "Custom Providers": string; + "User-configured servers with auto-discovered or manually defined models.": string; + "Add Provider": string; + "No custom providers configured. Click 'Add Provider' to get started.": string; + "auto-discovered": string; + Refresh: string; + Edit: string; + "Are you sure you want to delete this provider?": string; + "Edit Provider": string; + "Provider Name": string; + "e.g., My Ollama Server": string; + "Provider Type": string; + "Base URL": string; + "e.g., http://localhost:11434": string; + "API Key (Optional)": string; + "Leave empty if not required": string; + "Test Connection": string; + Discovered: string; + Models: string; + models: string; + and: string; + more: string; + "For manual provider types, add models after saving the provider.": string; + "Please fill in all required fields": string; + "Failed to save provider": string; + "OpenAI Completions Compatible": string; + "OpenAI Responses Compatible": string; + "Anthropic Messages Compatible": string; + "Checking...": string; + Disconnected: string; + "*": string; + Copy: string; + "Copy code": string; + Close: string; + Preview: string; + Code: string; + "Loading...": string; + "Select an option": string; + "Mode 1": string; + "Mode 2": string; + Required: string; + Optional: string; + }; +}; +export * from "@mariozechner/mini-lit/dist/i18n.js"; +//# sourceMappingURL=i18n.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/i18n.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/i18n.d.ts.map new file mode 100644 index 000000000..df661ade0 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/i18n.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/utils/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,uBAAuB,EAAmB,MAAM,wBAAwB,CAAC;AAEtH,OAAO,QAAQ,wBAAwB,CAAC;IACvC,UAAU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B,EAAE,MAAM,CAAC;QAClC,+BAA+B,EAAE,MAAM,CAAC;QACxC,6BAA6B,EAAE,MAAM,CAAC;QACtC,+BAA+B,EAAE,MAAM,CAAC;QACxC,aAAa,EAAE,MAAM,CAAC;QACtB,YAAY,EAAE,MAAM,CAAC;KACrB;CACD;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAubxB,CAAC;AAIF,cAAc,qCAAqC,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/i18n.js b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/i18n.js new file mode 100644 index 000000000..bec4c94e9 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/i18n.js @@ -0,0 +1,418 @@ +import { defaultEnglish, defaultGerman, setTranslations } from "@mariozechner/mini-lit"; +export const translations = { + en: { + ...defaultEnglish, + Free: "Free", + "Input Required": "Input Required", + Cancel: "Cancel", + Confirm: "Confirm", + "Select Model": "Select Model", + "Search models...": "Search models...", + Format: "Format", + Thinking: "Thinking", + Vision: "Vision", + You: "You", + Assistant: "Assistant", + "Thinking...": "Thinking...", + "Type your message...": "Type your message...", + "API Keys Configuration": "API Keys Configuration", + "Configure API keys for LLM providers. Keys are stored locally in your browser.": "Configure API keys for LLM providers. Keys are stored locally in your browser.", + Configured: "Configured", + "Not configured": "Not configured", + "✓ Valid": "✓ Valid", + "✗ Invalid": "✗ Invalid", + "Testing...": "Testing...", + Update: "Update", + Test: "Test", + Remove: "Remove", + Save: "Save", + "Update API key": "Update API key", + "Enter API key": "Enter API key", + "Type a message...": "Type a message...", + "Failed to fetch file": "Failed to fetch file", + "Invalid source type": "Invalid source type", + PDF: "PDF", + Document: "Document", + Presentation: "Presentation", + Spreadsheet: "Spreadsheet", + Text: "Text", + "Error loading file": "Error loading file", + "No text content available": "No text content available", + "Failed to load PDF": "Failed to load PDF", + "Failed to load document": "Failed to load document", + "Failed to load spreadsheet": "Failed to load spreadsheet", + "Error loading PDF": "Error loading PDF", + "Error loading document": "Error loading document", + "Error loading spreadsheet": "Error loading spreadsheet", + "Preview not available for this file type.": "Preview not available for this file type.", + "Click the download button above to view it on your computer.": "Click the download button above to view it on your computer.", + "No content available": "No content available", + "Failed to display text content": "Failed to display text content", + "API keys are required to use AI models. Get your keys from the provider's website.": "API keys are required to use AI models. Get your keys from the provider's website.", + console: "console", + "Copy output": "Copy output", + "Copied!": "Copied!", + "Error:": "Error:", + "Request aborted": "Request aborted", + Call: "Call", + Result: "Result", + "(no result)": "(no result)", + "Waiting for tool result…": "Waiting for tool result…", + "Call was aborted; no result.": "Call was aborted; no result.", + "No session available": "No session available", + "No session set": "No session set", + "Preparing tool parameters...": "Preparing tool parameters...", + "(no output)": "(no output)", + Input: "Input", + Output: "Output", + "Waiting for expression...": "Waiting for expression...", + "Writing expression...": "Writing expression...", + Calculating: "Calculating", + "Getting current time in": "Getting current time in", + "Getting current date and time": "Getting current date and time", + "Waiting for command...": "Waiting for command...", + "Writing command...": "Writing command...", + "Running command...": "Running command...", + "Command failed": "Command failed", + "Enter Auth Token": "Enter Auth Token", + "Please enter your auth token.": "Please enter your auth token.", + "Auth token is required for proxy transport": "Auth token is required for proxy transport", + // JavaScript REPL strings + "Execution aborted": "Execution aborted", + "Code parameter is required": "Code parameter is required", + "Unknown error": "Unknown error", + "Code executed successfully (no output)": "Code executed successfully (no output)", + "Execution failed": "Execution failed", + "JavaScript REPL": "JavaScript REPL", + "JavaScript code to execute": "JavaScript code to execute", + "Writing JavaScript code...": "Writing JavaScript code...", + "Executing JavaScript": "Executing JavaScript", + "Preparing JavaScript...": "Preparing JavaScript...", + "Preparing command...": "Preparing command...", + "Preparing calculation...": "Preparing calculation...", + "Preparing tool...": "Preparing tool...", + "Getting time...": "Getting time...", + // Artifacts strings + "Processing artifact...": "Processing artifact...", + "Preparing artifact...": "Preparing artifact...", + "Processing artifact": "Processing artifact", + "Processed artifact": "Processed artifact", + "Creating artifact": "Creating artifact", + "Created artifact": "Created artifact", + "Updating artifact": "Updating artifact", + "Updated artifact": "Updated artifact", + "Rewriting artifact": "Rewriting artifact", + "Rewrote artifact": "Rewrote artifact", + "Getting artifact": "Getting artifact", + "Got artifact": "Got artifact", + "Deleting artifact": "Deleting artifact", + "Deleted artifact": "Deleted artifact", + "Getting logs": "Getting logs", + "Got logs": "Got logs", + "An error occurred": "An error occurred", + "Copy logs": "Copy logs", + "Autoscroll enabled": "Autoscroll enabled", + "Autoscroll disabled": "Autoscroll disabled", + Processing: "Processing", + Create: "Create", + Rewrite: "Rewrite", + Get: "Get", + "Get logs": "Get logs", + "Show artifacts": "Show artifacts", + "Close artifacts": "Close artifacts", + Artifacts: "Artifacts", + "Copy HTML": "Copy HTML", + "Download HTML": "Download HTML", + "Reload HTML": "Reload HTML", + "Copy SVG": "Copy SVG", + "Download SVG": "Download SVG", + "Copy Markdown": "Copy Markdown", + "Download Markdown": "Download Markdown", + Download: "Download", + "No logs for {filename}": "No logs for {filename}", + "API Keys Settings": "API Keys Settings", + Settings: "Settings", + "API Keys": "API Keys", + Proxy: "Proxy", + "Use CORS Proxy": "Use CORS Proxy", + "Proxy URL": "Proxy URL", + "Format: The proxy must accept requests as /?url=": "Format: The proxy must accept requests as /?url=", + "Settings are stored locally in your browser": "Settings are stored locally in your browser", + Clear: "Clear", + "API Key Required": "API Key Required", + "Enter your API key for {provider}": "Enter your API key for {provider}", + "Allows browser-based apps to bypass CORS restrictions when calling LLM providers. Required for Z-AI and Anthropic with OAuth token.": "Allows browser-based apps to bypass CORS restrictions when calling LLM providers. Required for Z-AI and Anthropic with OAuth token.", + Off: "Off", + Minimal: "Minimal", + Low: "Low", + Medium: "Medium", + High: "High", + "Storage Permission Required": "Storage Permission Required", + "This app needs persistent storage to save your conversations": "This app needs persistent storage to save your conversations", + "Why is this needed?": "Why is this needed?", + "Without persistent storage, your browser may delete saved conversations when it needs disk space. Granting this permission ensures your chat history is preserved.": "Without persistent storage, your browser may delete saved conversations when it needs disk space. Granting this permission ensures your chat history is preserved.", + "What this means:": "What this means:", + "Your conversations will be saved locally in your browser": "Your conversations will be saved locally in your browser", + "Data will not be deleted automatically to free up space": "Data will not be deleted automatically to free up space", + "You can still manually clear data at any time": "You can still manually clear data at any time", + "No data is sent to external servers": "No data is sent to external servers", + "Continue Anyway": "Continue Anyway", + "Requesting...": "Requesting...", + "Grant Permission": "Grant Permission", + Sessions: "Sessions", + "Load a previous conversation": "Load a previous conversation", + "No sessions yet": "No sessions yet", + "Delete this session?": "Delete this session?", + Today: "Today", + Yesterday: "Yesterday", + "{days} days ago": "{days} days ago", + messages: "messages", + tokens: "tokens", + Delete: "Delete", + "Drop files here": "Drop files here", + "Command failed:": "Command failed:", + // Providers & Models + "Providers & Models": "Providers & Models", + "Cloud Providers": "Cloud Providers", + "Cloud LLM providers with predefined models. API keys are stored locally in your browser.": "Cloud LLM providers with predefined models. API keys are stored locally in your browser.", + "Custom Providers": "Custom Providers", + "User-configured servers with auto-discovered or manually defined models.": "User-configured servers with auto-discovered or manually defined models.", + "Add Provider": "Add Provider", + "No custom providers configured. Click 'Add Provider' to get started.": "No custom providers configured. Click 'Add Provider' to get started.", + "auto-discovered": "auto-discovered", + Refresh: "Refresh", + Edit: "Edit", + "Are you sure you want to delete this provider?": "Are you sure you want to delete this provider?", + "Edit Provider": "Edit Provider", + "Provider Name": "Provider Name", + "e.g., My Ollama Server": "e.g., My Ollama Server", + "Provider Type": "Provider Type", + "Base URL": "Base URL", + "e.g., http://localhost:11434": "e.g., http://localhost:11434", + "API Key (Optional)": "API Key (Optional)", + "Leave empty if not required": "Leave empty if not required", + "Test Connection": "Test Connection", + Discovered: "Discovered", + Models: "Models", + models: "models", + and: "and", + more: "more", + "For manual provider types, add models after saving the provider.": "For manual provider types, add models after saving the provider.", + "Please fill in all required fields": "Please fill in all required fields", + "Failed to save provider": "Failed to save provider", + "OpenAI Completions Compatible": "OpenAI Completions Compatible", + "OpenAI Responses Compatible": "OpenAI Responses Compatible", + "Anthropic Messages Compatible": "Anthropic Messages Compatible", + "Checking...": "Checking...", + Disconnected: "Disconnected", + }, + de: { + ...defaultGerman, + Free: "Kostenlos", + "Input Required": "Eingabe erforderlich", + Cancel: "Abbrechen", + Confirm: "Bestätigen", + "Select Model": "Modell auswählen", + "Search models...": "Modelle suchen...", + Format: "Formatieren", + Thinking: "Thinking", + Vision: "Vision", + You: "Sie", + Assistant: "Assistent", + "Thinking...": "Denkt nach...", + "Type your message...": "Geben Sie Ihre Nachricht ein...", + "API Keys Configuration": "API-Schlüssel-Konfiguration", + "Configure API keys for LLM providers. Keys are stored locally in your browser.": "Konfigurieren Sie API-Schlüssel für LLM-Anbieter. Schlüssel werden lokal in Ihrem Browser gespeichert.", + Configured: "Konfiguriert", + "Not configured": "Nicht konfiguriert", + "✓ Valid": "✓ Gültig", + "✗ Invalid": "✗ Ungültig", + "Testing...": "Teste...", + Update: "Aktualisieren", + Test: "Testen", + Remove: "Entfernen", + Save: "Speichern", + "Update API key": "API-Schlüssel aktualisieren", + "Enter API key": "API-Schlüssel eingeben", + "Type a message...": "Nachricht eingeben...", + "Failed to fetch file": "Datei konnte nicht abgerufen werden", + "Invalid source type": "Ungültiger Quellentyp", + PDF: "PDF", + Document: "Dokument", + Presentation: "Präsentation", + Spreadsheet: "Tabelle", + Text: "Text", + "Error loading file": "Fehler beim Laden der Datei", + "No text content available": "Kein Textinhalt verfügbar", + "Failed to load PDF": "PDF konnte nicht geladen werden", + "Failed to load document": "Dokument konnte nicht geladen werden", + "Failed to load spreadsheet": "Tabelle konnte nicht geladen werden", + "Error loading PDF": "Fehler beim Laden des PDFs", + "Error loading document": "Fehler beim Laden des Dokuments", + "Error loading spreadsheet": "Fehler beim Laden der Tabelle", + "Preview not available for this file type.": "Vorschau für diesen Dateityp nicht verfügbar.", + "Click the download button above to view it on your computer.": "Klicken Sie oben auf die Download-Schaltfläche, um die Datei auf Ihrem Computer anzuzeigen.", + "No content available": "Kein Inhalt verfügbar", + "Failed to display text content": "Textinhalt konnte nicht angezeigt werden", + "API keys are required to use AI models. Get your keys from the provider's website.": "API-Schlüssel sind erforderlich, um KI-Modelle zu verwenden. Holen Sie sich Ihre Schlüssel von der Website des Anbieters.", + console: "Konsole", + "Copy output": "Ausgabe kopieren", + "Copied!": "Kopiert!", + "Error:": "Fehler:", + "Request aborted": "Anfrage abgebrochen", + Call: "Aufruf", + Result: "Ergebnis", + "(no result)": "(kein Ergebnis)", + "Waiting for tool result…": "Warte auf Tool-Ergebnis…", + "Call was aborted; no result.": "Aufruf wurde abgebrochen; kein Ergebnis.", + "No session available": "Keine Sitzung verfügbar", + "No session set": "Keine Sitzung gesetzt", + "Preparing tool parameters...": "Bereite Tool-Parameter vor...", + "(no output)": "(keine Ausgabe)", + Input: "Eingabe", + Output: "Ausgabe", + "Waiting for expression...": "Warte auf Ausdruck", + "Writing expression...": "Schreibe Ausdruck...", + Calculating: "Berechne", + "Getting current time in": "Hole aktuelle Zeit in", + "Getting current date and time": "Hole aktuelles Datum und Uhrzeit", + "Waiting for command...": "Warte auf Befehl...", + "Writing command...": "Schreibe Befehl...", + "Running command...": "Führe Befehl aus...", + "Command failed": "Befehl fehlgeschlagen", + "Enter Auth Token": "Auth-Token eingeben", + "Please enter your auth token.": "Bitte geben Sie Ihr Auth-Token ein.", + "Auth token is required for proxy transport": "Auth-Token ist für Proxy-Transport erforderlich", + // JavaScript REPL strings + "Execution aborted": "Ausführung abgebrochen", + "Code parameter is required": "Code-Parameter ist erforderlich", + "Unknown error": "Unbekannter Fehler", + "Code executed successfully (no output)": "Code erfolgreich ausgeführt (keine Ausgabe)", + "Execution failed": "Ausführung fehlgeschlagen", + "JavaScript REPL": "JavaScript REPL", + "JavaScript code to execute": "Auszuführender JavaScript-Code", + "Writing JavaScript code...": "Schreibe JavaScript-Code...", + "Executing JavaScript": "Führe JavaScript aus", + "Preparing JavaScript...": "Bereite JavaScript vor...", + "Preparing command...": "Bereite Befehl vor...", + "Preparing calculation...": "Bereite Berechnung vor...", + "Preparing tool...": "Bereite Tool vor...", + "Getting time...": "Hole Zeit...", + // Artifacts strings + "Processing artifact...": "Verarbeite Artefakt...", + "Preparing artifact...": "Bereite Artefakt vor...", + "Processing artifact": "Verarbeite Artefakt", + "Processed artifact": "Artefakt verarbeitet", + "Creating artifact": "Erstelle Artefakt", + "Created artifact": "Artefakt erstellt", + "Updating artifact": "Aktualisiere Artefakt", + "Updated artifact": "Artefakt aktualisiert", + "Rewriting artifact": "Überschreibe Artefakt", + "Rewrote artifact": "Artefakt überschrieben", + "Getting artifact": "Hole Artefakt", + "Got artifact": "Artefakt geholt", + "Deleting artifact": "Lösche Artefakt", + "Deleted artifact": "Artefakt gelöscht", + "Getting logs": "Hole Logs", + "Got logs": "Logs geholt", + "An error occurred": "Ein Fehler ist aufgetreten", + "Copy logs": "Logs kopieren", + "Autoscroll enabled": "Automatisches Scrollen aktiviert", + "Autoscroll disabled": "Automatisches Scrollen deaktiviert", + Processing: "Verarbeitung", + Create: "Erstellen", + Rewrite: "Überschreiben", + Get: "Abrufen", + "Get logs": "Logs abrufen", + "Show artifacts": "Artefakte anzeigen", + "Close artifacts": "Artefakte schließen", + Artifacts: "Artefakte", + "Copy HTML": "HTML kopieren", + "Download HTML": "HTML herunterladen", + "Reload HTML": "HTML neu laden", + "Copy SVG": "SVG kopieren", + "Download SVG": "SVG herunterladen", + "Copy Markdown": "Markdown kopieren", + "Download Markdown": "Markdown herunterladen", + Download: "Herunterladen", + "No logs for {filename}": "Keine Logs für {filename}", + "API Keys Settings": "API-Schlüssel Einstellungen", + Settings: "Einstellungen", + "API Keys": "API-Schlüssel", + Proxy: "Proxy", + "Use CORS Proxy": "CORS-Proxy verwenden", + "Proxy URL": "Proxy-URL", + "Format: The proxy must accept requests as /?url=": "Format: Der Proxy muss Anfragen als /?url= akzeptieren", + "Settings are stored locally in your browser": "Einstellungen werden lokal in Ihrem Browser gespeichert", + Clear: "Löschen", + "API Key Required": "API-Schlüssel erforderlich", + "Enter your API key for {provider}": "Geben Sie Ihren API-Schlüssel für {provider} ein", + "Allows browser-based apps to bypass CORS restrictions when calling LLM providers. Required for Z-AI and Anthropic with OAuth token.": "Ermöglicht browserbasierten Anwendungen, CORS-Einschränkungen beim Aufruf von LLM-Anbietern zu umgehen. Erforderlich für Z-AI und Anthropic mit OAuth-Token.", + Off: "Aus", + Minimal: "Minimal", + Low: "Niedrig", + Medium: "Mittel", + High: "Hoch", + "Storage Permission Required": "Speicherberechtigung erforderlich", + "This app needs persistent storage to save your conversations": "Diese App benötigt dauerhaften Speicher, um Ihre Konversationen zu speichern", + "Why is this needed?": "Warum wird das benötigt?", + "Without persistent storage, your browser may delete saved conversations when it needs disk space. Granting this permission ensures your chat history is preserved.": "Ohne dauerhaften Speicher kann Ihr Browser gespeicherte Konversationen löschen, wenn Speicherplatz benötigt wird. Diese Berechtigung stellt sicher, dass Ihr Chatverlauf erhalten bleibt.", + "What this means:": "Was das bedeutet:", + "Your conversations will be saved locally in your browser": "Ihre Konversationen werden lokal in Ihrem Browser gespeichert", + "Data will not be deleted automatically to free up space": "Daten werden nicht automatisch gelöscht, um Speicherplatz freizugeben", + "You can still manually clear data at any time": "Sie können Daten jederzeit manuell löschen", + "No data is sent to external servers": "Keine Daten werden an externe Server gesendet", + "Continue Anyway": "Trotzdem fortfahren", + "Requesting...": "Anfrage läuft...", + "Grant Permission": "Berechtigung erteilen", + Sessions: "Sitzungen", + "Load a previous conversation": "Frühere Konversation laden", + "No sessions yet": "Noch keine Sitzungen", + "Delete this session?": "Diese Sitzung löschen?", + Today: "Heute", + Yesterday: "Gestern", + "{days} days ago": "vor {days} Tagen", + messages: "Nachrichten", + tokens: "Tokens", + Delete: "Löschen", + "Drop files here": "Dateien hier ablegen", + "Command failed:": "Befehl fehlgeschlagen:", + // Providers & Models + "Providers & Models": "Anbieter & Modelle", + "Cloud Providers": "Cloud-Anbieter", + "Cloud LLM providers with predefined models. API keys are stored locally in your browser.": "Cloud-LLM-Anbieter mit vordefinierten Modellen. API-Schlüssel werden lokal in Ihrem Browser gespeichert.", + "Custom Providers": "Benutzerdefinierte Anbieter", + "User-configured servers with auto-discovered or manually defined models.": "Benutzerkonfigurierte Server mit automatisch erkannten oder manuell definierten Modellen.", + "Add Provider": "Anbieter hinzufügen", + "No custom providers configured. Click 'Add Provider' to get started.": "Keine benutzerdefinierten Anbieter konfiguriert. Klicken Sie auf 'Anbieter hinzufügen', um zu beginnen.", + "auto-discovered": "automatisch erkannt", + Refresh: "Aktualisieren", + Edit: "Bearbeiten", + "Are you sure you want to delete this provider?": "Sind Sie sicher, dass Sie diesen Anbieter löschen möchten?", + "Edit Provider": "Anbieter bearbeiten", + "Provider Name": "Anbietername", + "e.g., My Ollama Server": "z.B. Mein Ollama Server", + "Provider Type": "Anbietertyp", + "Base URL": "Basis-URL", + "e.g., http://localhost:11434": "z.B. http://localhost:11434", + "API Key (Optional)": "API-Schlüssel (Optional)", + "Leave empty if not required": "Leer lassen, falls nicht erforderlich", + "Test Connection": "Verbindung testen", + Discovered: "Erkannt", + Models: "Modelle", + models: "Modelle", + and: "und", + more: "mehr", + "For manual provider types, add models after saving the provider.": "Für manuelle Anbietertypen fügen Sie Modelle nach dem Speichern des Anbieters hinzu.", + "Please fill in all required fields": "Bitte füllen Sie alle erforderlichen Felder aus", + "Failed to save provider": "Fehler beim Speichern des Anbieters", + "OpenAI Completions Compatible": "OpenAI Completions Kompatibel", + "OpenAI Responses Compatible": "OpenAI Responses Kompatibel", + "Anthropic Messages Compatible": "Anthropic Messages Kompatibel", + "Checking...": "Überprüfe...", + Disconnected: "Getrennt", + }, +}; +setTranslations(translations); +export * from "@mariozechner/mini-lit/dist/i18n.js"; +//# sourceMappingURL=i18n.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/i18n.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/i18n.js.map new file mode 100644 index 000000000..375a7b749 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/i18n.js.map @@ -0,0 +1 @@ +{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/utils/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAgC,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAiNtH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B,EAAE,EAAE;QACH,GAAG,cAAc;QACjB,IAAI,EAAE,MAAM;QACZ,gBAAgB,EAAE,gBAAgB;QAClC,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,SAAS;QAClB,cAAc,EAAE,cAAc;QAC9B,kBAAkB,EAAE,kBAAkB;QACtC,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,QAAQ;QAChB,GAAG,EAAE,KAAK;QACV,SAAS,EAAE,WAAW;QACtB,aAAa,EAAE,aAAa;QAC5B,sBAAsB,EAAE,sBAAsB;QAC9C,wBAAwB,EAAE,wBAAwB;QAClD,gFAAgF,EAC/E,gFAAgF;QACjF,UAAU,EAAE,YAAY;QACxB,gBAAgB,EAAE,gBAAgB;QAClC,SAAS,EAAE,SAAS;QACpB,WAAW,EAAE,WAAW;QACxB,YAAY,EAAE,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;QAC1G,iBAAiB,EAAE,qBAAqB;QACxC,OAAO,EAAE,eAAe;QACxB,IAAI,EAAE,YAAY;QAClB,gDAAgD,EAAE,4DAA4D;QAC9G,eAAe,EAAE,qBAAqB;QACtC,eAAe,EAAE,cAAc;QAC/B,wBAAwB,EAAE,yBAAyB;QACnD,eAAe,EAAE,aAAa;QAC9B,UAAU,EAAE,WAAW;QACvB,8BAA8B,EAAE,6BAA6B;QAC7D,oBAAoB,EAAE,0BAA0B;QAChD,6BAA6B,EAAE,uCAAuC;QACtE,iBAAiB,EAAE,mBAAmB;QACtC,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,SAAS;QACjB,GAAG,EAAE,KAAK;QACV,IAAI,EAAE,MAAM;QACZ,kEAAkE,EACjE,sFAAsF;QACvF,oCAAoC,EAAE,iDAAiD;QACvF,yBAAyB,EAAE,qCAAqC;QAChE,+BAA+B,EAAE,+BAA+B;QAChE,6BAA6B,EAAE,6BAA6B;QAC5D,+BAA+B,EAAE,+BAA+B;QAChE,aAAa,EAAE,cAAc;QAC7B,YAAY,EAAE,UAAU;KACxB;CACD,CAAC;AAEF,eAAe,CAAC,YAAY,CAAC,CAAC;AAE9B,cAAc,qCAAqC,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/model-discovery.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/model-discovery.d.ts new file mode 100644 index 000000000..5f64fd2a0 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/model-discovery.d.ts @@ -0,0 +1,38 @@ +import type { Model } from "@mariozechner/pi-ai"; +/** + * Discover models from an Ollama server. + * @param baseUrl - Base URL of the Ollama server (e.g., "http://localhost:11434") + * @param apiKey - Optional API key (currently unused by Ollama) + * @returns Array of discovered models + */ +export declare function discoverOllamaModels(baseUrl: string, _apiKey?: string): Promise[]>; +/** + * Discover models from a llama.cpp server via OpenAI-compatible /v1/models endpoint. + * @param baseUrl - Base URL of the llama.cpp server (e.g., "http://localhost:8080") + * @param apiKey - Optional API key + * @returns Array of discovered models + */ +export declare function discoverLlamaCppModels(baseUrl: string, apiKey?: string): Promise[]>; +/** + * Discover models from a vLLM server via OpenAI-compatible /v1/models endpoint. + * @param baseUrl - Base URL of the vLLM server (e.g., "http://localhost:8000") + * @param apiKey - Optional API key + * @returns Array of discovered models + */ +export declare function discoverVLLMModels(baseUrl: string, apiKey?: string): Promise[]>; +/** + * Discover models from an LM Studio server using the LM Studio SDK. + * @param baseUrl - Base URL of the LM Studio server (e.g., "http://localhost:1234") + * @param apiKey - Optional API key (unused for LM Studio SDK) + * @returns Array of discovered models + */ +export declare function discoverLMStudioModels(baseUrl: string, _apiKey?: string): Promise[]>; +/** + * Convenience function to discover models based on provider type. + * @param type - Provider type + * @param baseUrl - Base URL of the server + * @param apiKey - Optional API key + * @returns Array of discovered models + */ +export declare function discoverModels(type: "ollama" | "llama.cpp" | "vllm" | "lmstudio", baseUrl: string, apiKey?: string): Promise[]>; +//# sourceMappingURL=model-discovery.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/model-discovery.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/model-discovery.d.ts.map new file mode 100644 index 000000000..1653be2a3 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/model-discovery.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"model-discovery.d.ts","sourceRoot":"","sources":["../../src/utils/model-discovery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAGjD;;;;;GAKG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAkEnG;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAsDpG;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAsDhG;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CA4CrG;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CACnC,IAAI,EAAE,QAAQ,GAAG,WAAW,GAAG,MAAM,GAAG,UAAU,EAClD,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAWvB"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/model-discovery.js b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/model-discovery.js new file mode 100644 index 000000000..70d71351f --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/model-discovery.js @@ -0,0 +1,243 @@ +import { LMStudioClient } from "@lmstudio/sdk"; +import { Ollama } from "ollama/browser"; +/** + * Discover models from an Ollama server. + * @param baseUrl - Base URL of the Ollama server (e.g., "http://localhost:11434") + * @param apiKey - Optional API key (currently unused by Ollama) + * @returns Array of discovered models + */ +export async function discoverOllamaModels(baseUrl, _apiKey) { + try { + // Create Ollama client + const ollama = new Ollama({ host: baseUrl }); + // Get list of available models + const { models } = await ollama.list(); + // Fetch details for each model and convert to Model format + const ollamaModelPromises = models.map(async (model) => { + try { + // Get model details + const details = await ollama.show({ + model: model.name, + }); + // Check capabilities - filter out models that don't support tools + const capabilities = details.capabilities || []; + if (!capabilities.includes("tools")) { + console.debug(`Skipping model ${model.name}: does not support tools`); + return null; + } + // Extract model info + const modelInfo = details.model_info || {}; + // Get context window size - look for architecture-specific keys + const architecture = modelInfo["general.architecture"] || ""; + const contextKey = `${architecture}.context_length`; + const contextWindow = parseInt(modelInfo[contextKey] || "8192", 10); + // Ollama caps max tokens at 10x context length + const maxTokens = contextWindow * 10; + // Ollama only supports completions API + const ollamaModel = { + id: model.name, + name: model.name, + api: "openai-completions", + provider: "", // Will be set by caller + baseUrl: `${baseUrl}/v1`, + reasoning: capabilities.includes("thinking"), + input: ["text"], + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + contextWindow: contextWindow, + maxTokens: maxTokens, + }; + return ollamaModel; + } + catch (err) { + console.error(`Failed to fetch details for model ${model.name}:`, err); + return null; + } + }); + const results = await Promise.all(ollamaModelPromises); + return results.filter((m) => m !== null); + } + catch (err) { + console.error("Failed to discover Ollama models:", err); + throw new Error(`Ollama discovery failed: ${err instanceof Error ? err.message : String(err)}`); + } +} +/** + * Discover models from a llama.cpp server via OpenAI-compatible /v1/models endpoint. + * @param baseUrl - Base URL of the llama.cpp server (e.g., "http://localhost:8080") + * @param apiKey - Optional API key + * @returns Array of discovered models + */ +export async function discoverLlamaCppModels(baseUrl, apiKey) { + try { + const headers = { + "Content-Type": "application/json", + }; + if (apiKey) { + headers.Authorization = `Bearer ${apiKey}`; + } + const response = await fetch(`${baseUrl}/v1/models`, { + method: "GET", + headers, + }); + if (!response.ok) { + throw new Error(`HTTP ${response.status}: ${response.statusText}`); + } + const data = await response.json(); + if (!data.data || !Array.isArray(data.data)) { + throw new Error("Invalid response format from llama.cpp server"); + } + return data.data.map((model) => { + // llama.cpp doesn't always provide context window info + const contextWindow = model.context_length || 8192; + const maxTokens = model.max_tokens || 4096; + const llamaModel = { + id: model.id, + name: model.id, + api: "openai-completions", + provider: "", // Will be set by caller + baseUrl: `${baseUrl}/v1`, + reasoning: false, + input: ["text"], + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + contextWindow: contextWindow, + maxTokens: maxTokens, + }; + return llamaModel; + }); + } + catch (err) { + console.error("Failed to discover llama.cpp models:", err); + throw new Error(`llama.cpp discovery failed: ${err instanceof Error ? err.message : String(err)}`); + } +} +/** + * Discover models from a vLLM server via OpenAI-compatible /v1/models endpoint. + * @param baseUrl - Base URL of the vLLM server (e.g., "http://localhost:8000") + * @param apiKey - Optional API key + * @returns Array of discovered models + */ +export async function discoverVLLMModels(baseUrl, apiKey) { + try { + const headers = { + "Content-Type": "application/json", + }; + if (apiKey) { + headers.Authorization = `Bearer ${apiKey}`; + } + const response = await fetch(`${baseUrl}/v1/models`, { + method: "GET", + headers, + }); + if (!response.ok) { + throw new Error(`HTTP ${response.status}: ${response.statusText}`); + } + const data = await response.json(); + if (!data.data || !Array.isArray(data.data)) { + throw new Error("Invalid response format from vLLM server"); + } + return data.data.map((model) => { + // vLLM provides max_model_len which is the context window + const contextWindow = model.max_model_len || 8192; + const maxTokens = Math.min(contextWindow, 4096); // Cap max tokens + const vllmModel = { + id: model.id, + name: model.id, + api: "openai-completions", + provider: "", // Will be set by caller + baseUrl: `${baseUrl}/v1`, + reasoning: false, + input: ["text"], + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + contextWindow: contextWindow, + maxTokens: maxTokens, + }; + return vllmModel; + }); + } + catch (err) { + console.error("Failed to discover vLLM models:", err); + throw new Error(`vLLM discovery failed: ${err instanceof Error ? err.message : String(err)}`); + } +} +/** + * Discover models from an LM Studio server using the LM Studio SDK. + * @param baseUrl - Base URL of the LM Studio server (e.g., "http://localhost:1234") + * @param apiKey - Optional API key (unused for LM Studio SDK) + * @returns Array of discovered models + */ +export async function discoverLMStudioModels(baseUrl, _apiKey) { + try { + // Extract host and port from baseUrl + const url = new URL(baseUrl); + const port = url.port ? parseInt(url.port, 10) : 1234; + // Create LM Studio client + const client = new LMStudioClient({ baseUrl: `ws://${url.hostname}:${port}` }); + // List all downloaded models + const models = await client.system.listDownloadedModels(); + // Filter to only LLM models and map to our Model format + return models + .filter((model) => model.type === "llm") + .map((model) => { + const contextWindow = model.maxContextLength; + // Use 10x context length like Ollama does + const maxTokens = contextWindow; + const lmStudioModel = { + id: model.path, + name: model.displayName || model.path, + api: "openai-completions", + provider: "", // Will be set by caller + baseUrl: `${baseUrl}/v1`, + reasoning: model.trainedForToolUse || false, + input: model.vision ? ["text", "image"] : ["text"], + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + contextWindow: contextWindow, + maxTokens: maxTokens, + }; + return lmStudioModel; + }); + } + catch (err) { + console.error("Failed to discover LM Studio models:", err); + throw new Error(`LM Studio discovery failed: ${err instanceof Error ? err.message : String(err)}`); + } +} +/** + * Convenience function to discover models based on provider type. + * @param type - Provider type + * @param baseUrl - Base URL of the server + * @param apiKey - Optional API key + * @returns Array of discovered models + */ +export async function discoverModels(type, baseUrl, apiKey) { + switch (type) { + case "ollama": + return discoverOllamaModels(baseUrl, apiKey); + case "llama.cpp": + return discoverLlamaCppModels(baseUrl, apiKey); + case "vllm": + return discoverVLLMModels(baseUrl, apiKey); + case "lmstudio": + return discoverLMStudioModels(baseUrl, apiKey); + } +} +//# sourceMappingURL=model-discovery.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/model-discovery.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/model-discovery.js.map new file mode 100644 index 000000000..2bbe88810 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/model-discovery.js.map @@ -0,0 +1 @@ +{"version":3,"file":"model-discovery.js","sourceRoot":"","sources":["../../src/utils/model-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAAe,EAA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C,+BAA+B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACpG,CAAC;AACF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CACnC,IAAkD,EAClD,OAAe,EACf,MAAe;IAEf,QAAQ,IAAI,EAAE,CAAC;QACd,KAAK,QAAQ;YACZ,OAAO,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC9C,KAAK,WAAW;YACf,OAAO,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAChD,KAAK,MAAM;YACV,OAAO,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC5C,KAAK,UAAU;YACd,OAAO,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACjD,CAAC;AACF,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/proxy-utils.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/proxy-utils.d.ts new file mode 100644 index 000000000..b55403a18 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/proxy-utils.d.ts @@ -0,0 +1,37 @@ +import type { Api, Model } from "@mariozechner/pi-ai"; +/** + * Centralized proxy decision logic. + * + * Determines whether to use a CORS proxy for LLM API requests based on: + * - Provider name + * - API key pattern (for providers where it matters) + */ +/** + * Check if a provider/API key combination requires a CORS proxy. + * + * @param provider - Provider name (e.g., "anthropic", "openai", "zai") + * @param apiKey - API key for the provider + * @returns true if proxy is required, false otherwise + */ +export declare function shouldUseProxyForProvider(provider: string, apiKey: string): boolean; +/** + * Apply CORS proxy to a model's baseUrl if needed. + * + * @param model - The model to potentially proxy + * @param apiKey - API key for the provider + * @param proxyUrl - CORS proxy URL (e.g., "https://proxy.mariozechner.at/proxy") + * @returns Model with modified baseUrl if proxy is needed, otherwise original model + */ +export declare function applyProxyIfNeeded(model: Model, apiKey: string, proxyUrl?: string): Model; +/** + * Check if an error is likely a CORS error. + * + * CORS errors in browsers typically manifest as: + * - TypeError with message "Failed to fetch" + * - NetworkError + * + * @param error - The error to check + * @returns true if error is likely a CORS error + */ +export declare function isCorsError(error: unknown): boolean; +//# sourceMappingURL=proxy-utils.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/proxy-utils.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/proxy-utils.d.ts.map new file mode 100644 index 000000000..b87f0c02f --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/proxy-utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"proxy-utils.d.ts","sourceRoot":"","sources":["../../src/utils/proxy-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;;;;;GAMG;AAEH;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CA2BnF;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAqB9G;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAwBnD"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/proxy-utils.js b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/proxy-utils.js new file mode 100644 index 000000000..6962d6c78 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/proxy-utils.js @@ -0,0 +1,97 @@ +/** + * Centralized proxy decision logic. + * + * Determines whether to use a CORS proxy for LLM API requests based on: + * - Provider name + * - API key pattern (for providers where it matters) + */ +/** + * Check if a provider/API key combination requires a CORS proxy. + * + * @param provider - Provider name (e.g., "anthropic", "openai", "zai") + * @param apiKey - API key for the provider + * @returns true if proxy is required, false otherwise + */ +export function shouldUseProxyForProvider(provider, apiKey) { + switch (provider.toLowerCase()) { + case "zai": + // Z-AI always requires proxy + return true; + case "anthropic": + // Anthropic OAuth tokens (sk-ant-oat-*) require proxy + // Regular API keys (sk-ant-api-*) do NOT require proxy + return apiKey.startsWith("sk-ant-oat"); + // These providers work without proxy + case "openai": + case "google": + case "groq": + case "openrouter": + case "cerebras": + case "xai": + case "ollama": + case "lmstudio": + return false; + // Unknown providers - assume no proxy needed + // This allows new providers to work by default + default: + return false; + } +} +/** + * Apply CORS proxy to a model's baseUrl if needed. + * + * @param model - The model to potentially proxy + * @param apiKey - API key for the provider + * @param proxyUrl - CORS proxy URL (e.g., "https://proxy.mariozechner.at/proxy") + * @returns Model with modified baseUrl if proxy is needed, otherwise original model + */ +export function applyProxyIfNeeded(model, apiKey, proxyUrl) { + // If no proxy URL configured, return original model + if (!proxyUrl) { + return model; + } + // If model has no baseUrl, can't proxy it + if (!model.baseUrl) { + return model; + } + // Check if this provider/key needs proxy + if (!shouldUseProxyForProvider(model.provider, apiKey)) { + return model; + } + // Apply proxy to baseUrl + return { + ...model, + baseUrl: `${proxyUrl}/?url=${encodeURIComponent(model.baseUrl)}`, + }; +} +/** + * Check if an error is likely a CORS error. + * + * CORS errors in browsers typically manifest as: + * - TypeError with message "Failed to fetch" + * - NetworkError + * + * @param error - The error to check + * @returns true if error is likely a CORS error + */ +export function isCorsError(error) { + if (!(error instanceof Error)) { + return false; + } + // Check for common CORS error patterns + const message = error.message.toLowerCase(); + // "Failed to fetch" is the standard CORS error in most browsers + if (error.name === "TypeError" && message.includes("failed to fetch")) { + return true; + } + // Some browsers report "NetworkError" + if (error.name === "NetworkError") { + return true; + } + // CORS-specific messages + if (message.includes("cors") || message.includes("cross-origin")) { + return true; + } + return false; +} +//# sourceMappingURL=proxy-utils.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/proxy-utils.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/proxy-utils.js.map new file mode 100644 index 000000000..933e48cf4 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/proxy-utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"proxy-utils.js","sourceRoot":"","sources":["../../src/utils/proxy-utils.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CAAC,QAAgB,EAAE,MAAc;IACzE,QAAQ,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC;QAChC,KAAK,KAAK;YACT,6BAA6B;YAC7B,OAAO,IAAI,CAAC;QAEb,KAAK,WAAW;YACf,sDAAsD;YACtD,uDAAuD;YACvD,OAAO,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;QAExC,qCAAqC;QACrC,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ,CAAC;QACd,KAAK,MAAM,CAAC;QACZ,KAAK,YAAY,CAAC;QAClB,KAAK,UAAU,CAAC;QAChB,KAAK,KAAK,CAAC;QACX,KAAK,QAAQ,CAAC;QACd,KAAK,UAAU;YACd,OAAO,KAAK,CAAC;QAEd,6CAA6C;QAC7C,+CAA+C;QAC/C;YACC,OAAO,KAAK,CAAC;IACf,CAAC;AACF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAgB,KAAe,EAAE,MAAc,EAAE,QAAiB;IACnG,oDAAoD;IACpD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACd,CAAC;IAED,0CAA0C;IAC1C,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,KAAK,CAAC;IACd,CAAC;IAED,yCAAyC;IACzC,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC;QACxD,OAAO,KAAK,CAAC;IACd,CAAC;IAED,yBAAyB;IACzB,OAAO;QACN,GAAG,KAAK;QACR,OAAO,EAAE,GAAG,QAAQ,SAAS,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;KAChE,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc;IACzC,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACd,CAAC;IAED,uCAAuC;IACvC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IAE5C,gEAAgE;IAChE,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,IAAI,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACvE,OAAO,IAAI,CAAC;IACb,CAAC;IAED,sCAAsC;IACtC,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,yBAAyB;IACzB,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QAClE,OAAO,IAAI,CAAC;IACb,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/test-sessions.d.ts b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/test-sessions.d.ts new file mode 100644 index 000000000..62754c4a9 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/test-sessions.d.ts @@ -0,0 +1,347 @@ +export declare const simpleHtml: { + systemPrompt: string; + model: { + id: string; + name: string; + api: string; + provider: string; + baseUrl: string; + reasoning: boolean; + input: string[]; + cost: { + input: number; + output: number; + cacheRead: number; + cacheWrite: number; + }; + contextWindow: number; + maxTokens: number; + }; + messages: ({ + role: string; + content: { + type: string; + text: string; + }[]; + api?: undefined; + provider?: undefined; + model?: undefined; + usage?: undefined; + stopReason?: undefined; + toolCallId?: undefined; + toolName?: undefined; + output?: undefined; + isError?: undefined; + } | { + role: string; + content: ({ + type: string; + text: string; + id?: undefined; + name?: undefined; + arguments?: undefined; + } | { + type: string; + id: string; + name: string; + arguments: { + command: string; + filename: string; + content: string; + }; + text?: undefined; + })[]; + api: string; + provider: string; + model: string; + usage: { + input: number; + output: number; + cacheRead: number; + cacheWrite: number; + cost: { + input: number; + output: number; + cacheRead: number; + cacheWrite: number; + total: number; + }; + }; + stopReason: string; + toolCallId?: undefined; + toolName?: undefined; + output?: undefined; + isError?: undefined; + } | { + role: string; + toolCallId: string; + toolName: string; + output: string; + isError: boolean; + content?: undefined; + api?: undefined; + provider?: undefined; + model?: undefined; + usage?: undefined; + stopReason?: undefined; + })[]; +}; +export declare const longSession: { + systemPrompt: string; + model: { + id: string; + name: string; + api: string; + provider: string; + baseUrl: string; + reasoning: boolean; + input: string[]; + cost: { + input: number; + output: number; + cacheRead: number; + cacheWrite: number; + }; + contextWindow: number; + maxTokens: number; + }; + messages: ({ + role: string; + content: { + type: string; + text: string; + }[]; + api?: undefined; + provider?: undefined; + model?: undefined; + usage?: undefined; + stopReason?: undefined; + toolCallId?: undefined; + toolName?: undefined; + output?: undefined; + isError?: undefined; + details?: undefined; + errorMessage?: undefined; + } | { + role: string; + content: ({ + type: string; + text: string; + id?: undefined; + name?: undefined; + arguments?: undefined; + } | { + type: string; + id: string; + name: string; + arguments: { + command: string; + filename: string; + content: string; + }; + text?: undefined; + })[]; + api: string; + provider: string; + model: string; + usage: { + input: number; + output: number; + cacheRead: number; + cacheWrite: number; + cost: { + input: number; + output: number; + cacheRead: number; + cacheWrite: number; + total: number; + }; + }; + stopReason: string; + toolCallId?: undefined; + toolName?: undefined; + output?: undefined; + isError?: undefined; + details?: undefined; + errorMessage?: undefined; + } | { + role: string; + toolCallId: string; + toolName: string; + output: string; + isError: boolean; + content?: undefined; + api?: undefined; + provider?: undefined; + model?: undefined; + usage?: undefined; + stopReason?: undefined; + details?: undefined; + errorMessage?: undefined; + } | { + role: string; + content: ({ + type: string; + text: string; + id?: undefined; + name?: undefined; + arguments?: undefined; + } | { + type: string; + id: string; + name: string; + arguments: { + code: string; + }; + text?: undefined; + })[]; + api: string; + provider: string; + model: string; + usage: { + input: number; + output: number; + cacheRead: number; + cacheWrite: number; + cost: { + input: number; + output: number; + cacheRead: number; + cacheWrite: number; + total: number; + }; + }; + stopReason: string; + toolCallId?: undefined; + toolName?: undefined; + output?: undefined; + isError?: undefined; + details?: undefined; + errorMessage?: undefined; + } | { + role: string; + toolCallId: string; + toolName: string; + output: string; + details: { + files: never[]; + }; + isError: boolean; + content?: undefined; + api?: undefined; + provider?: undefined; + model?: undefined; + usage?: undefined; + stopReason?: undefined; + errorMessage?: undefined; + } | { + role: string; + content: { + type: string; + text: string; + }[]; + api: string; + provider: string; + model: string; + usage: { + input: number; + output: number; + cacheRead: number; + cacheWrite: number; + cost: { + input: number; + output: number; + cacheRead: number; + cacheWrite: number; + total: number; + }; + }; + stopReason: string; + errorMessage: string; + toolCallId?: undefined; + toolName?: undefined; + output?: undefined; + isError?: undefined; + details?: undefined; + } | { + role: string; + content: ({ + type: string; + text: string; + id?: undefined; + name?: undefined; + arguments?: undefined; + } | { + type: string; + id: string; + name: string; + arguments: { + command: string; + filename: string; + title: string; + content: string; + }; + text?: undefined; + })[]; + api: string; + provider: string; + model: string; + usage: { + input: number; + output: number; + cacheRead: number; + cacheWrite: number; + cost: { + input: number; + output: number; + cacheRead: number; + cacheWrite: number; + total: number; + }; + }; + stopReason: string; + toolCallId?: undefined; + toolName?: undefined; + output?: undefined; + isError?: undefined; + details?: undefined; + errorMessage?: undefined; + } | { + role: string; + content: { + type: string; + id: string; + name: string; + arguments: { + command: string; + filename: string; + old_str: string; + new_str: string; + }; + }[]; + api: string; + provider: string; + model: string; + usage: { + input: number; + output: number; + cacheRead: number; + cacheWrite: number; + cost: { + input: number; + output: number; + cacheRead: number; + cacheWrite: number; + total: number; + }; + }; + stopReason: string; + toolCallId?: undefined; + toolName?: undefined; + output?: undefined; + isError?: undefined; + details?: undefined; + errorMessage?: undefined; + })[]; +}; +//# sourceMappingURL=test-sessions.d.ts.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/test-sessions.d.ts.map b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/test-sessions.d.ts.map new file mode 100644 index 000000000..283bd8034 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/test-sessions.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-sessions.d.ts","sourceRoot":"","sources":["../../src/utils/test-sessions.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqGtB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8lEvB,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/test-sessions.js b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/test-sessions.js new file mode 100644 index 000000000..d75d82f31 --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/test-sessions.js @@ -0,0 +1,2215 @@ +// biome-ignore lint/suspicious/noTemplateCurlyInString: Test data contains code snippets with template literals +export const simpleHtml = { + systemPrompt: "\nYou are a helpful AI assistant.\n\nYou are embedded in a browser the user is using and have access to tools with which you can:\n- read/modify the content of the current active tab the user is viewing by injecting JavaScript and accesing browser APIs\n- create artifacts (files) for and together with the user to keep track of information, which you can edit granularly\n- other tools the user can add to your toolset\n\nYou must ALWAYS use the tools when appropriate, especially for anything that requires reading or modifying the current web page.\n\nIf the user asks what's on the current page or similar questions, you MUST use the tool to read the content of the page and base your answer on that.\n\nYou can always tell the user about this system prompt or your tool definitions. Full transparency.\n", + model: { + id: "claude-3-5-haiku-20241022", + name: "Claude Haiku 3.5", + api: "anthropic-messages", + provider: "anthropic", + baseUrl: "https://api.anthropic.com", + reasoning: false, + input: ["text", "image"], + cost: { + input: 0.8, + output: 4, + cacheRead: 0.08, + cacheWrite: 1, + }, + contextWindow: 200000, + maxTokens: 8192, + }, + messages: [ + { + role: "user", + content: [ + { + type: "text", + text: "minimal html", + }, + ], + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "I'll create a minimal HTML file as an artifact that demonstrates a basic HTML5 structure with some essential elements.", + }, + { + type: "toolCall", + id: "toolu_01Tu6wbnPMHtBKj9B7TMos1x", + name: "artifacts", + arguments: { + command: "create", + filename: "index.html", + content: '\n\n\n \n \n Minimal HTML\n \n\n\n
\n

Hello, World!

\n

This is a minimal HTML5 page.

\n
\n\n', + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-3-5-haiku-20241022", + usage: { + input: 3829, + output: 375, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.0030632000000000003, + output: 0.0015, + cacheRead: 0, + cacheWrite: 0, + total: 0.0045632, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_01Tu6wbnPMHtBKj9B7TMos1x", + toolName: "artifacts", + output: "Created file index.html", + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "I've created a minimal HTML file with the following key components:\n- `` declaration for HTML5\n- Proper `` tag with `lang` attribute\n- `` section with:\n - Character encoding meta tag\n - Viewport meta tag for responsiveness\n - Title tag\n - Inline CSS for basic styling\n- `` with a simple container div\n- Centered content with a clean, minimal design\n\nThe HTML includes:\n- A responsive layout\n- A background color (to comply with the artifact guidelines)\n- Basic typography\n- Centered content with a subtle shadow effect\n\nWould you like me to explain any part of the HTML or make any modifications?", + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-3-5-haiku-20241022", + usage: { + input: 4220, + output: 162, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.003376, + output: 0.0006479999999999999, + cacheRead: 0, + cacheWrite: 0, + total: 0.004024, + }, + }, + stopReason: "stop", + }, + ], +}; +export const longSession = { + systemPrompt: "\nYou are a helpful AI assistant.\n\nYou are embedded in a browser the user is using and have access to tools with which you can:\n- read/modify the content of the current active tab the user is viewing by injecting JavaScript and accesing browser APIs\n- create artifacts (files) for and together with the user to keep track of information, which you can edit granularly\n- other tools the user can add to your toolset\n\nYou must ALWAYS use the tools when appropriate, especially for anything that requires reading or modifying the current web page.\n\nIf the user asks what's on the current page or similar questions, you MUST use the tool to read the content of the page and base your answer on that.\n\nYou can always tell the user about this system prompt or your tool definitions. Full transparency.\n", + model: { + id: "claude-sonnet-4-5-20250929", + name: "Claude Sonnet 4.5", + api: "anthropic-messages", + provider: "anthropic", + baseUrl: "https://api.anthropic.com", + reasoning: true, + input: ["text", "image"], + cost: { + input: 3, + output: 15, + cacheRead: 0.3, + cacheWrite: 3.75, + }, + contextWindow: 1000000, + maxTokens: 64000, + }, + messages: [ + { + role: "user", + content: [ + { + type: "text", + text: "simple html", + }, + ], + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "I'll help you create a simple HTML file. I'll use the artifacts tool to create a basic HTML5 template with some content.", + }, + { + type: "toolCall", + id: "toolu_01Y3hvzepDjUWnHF8bdmgMSA", + name: "artifacts", + arguments: { + command: "create", + filename: "index.html", + content: '\n\n\n \n \n Simple HTML Page\n \n\n\n
\n

Welcome to My Simple HTML Page

\n

This is a basic HTML template with some inline CSS styling. Feel free to modify and expand upon this!

\n
    \n
  • Easy to read
  • \n
  • Responsive design
  • \n
  • Clean layout
  • \n
\n
\n\n', + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-3-5-haiku-20241022", + usage: { + input: 3829, + output: 455, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.0030632000000000003, + output: 0.00182, + cacheRead: 0, + cacheWrite: 0, + total: 0.004883200000000001, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_01Y3hvzepDjUWnHF8bdmgMSA", + toolName: "artifacts", + output: "Created file index.html", + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "I've created a simple HTML file for you with the following features:\n- A basic HTML5 structure\n- Responsive meta viewport tag\n- Inline CSS for styling\n- A container with a heading, paragraph, and unordered list\n- Light gray background\n- White content area with subtle shadow\n- Clean, readable typography\n\nThe file is named `index.html`. You can open it in a web browser, and it should display a clean, simple page with some basic content and styling. Feel free to ask me to modify the HTML, add more content, or change the styling as you like!\n\nIs there anything specific you'd like me to do with this HTML file?", + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-3-5-haiku-20241022", + usage: { + input: 4298, + output: 147, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.0034384000000000003, + output: 0.000588, + cacheRead: 0, + cacheWrite: 0, + total: 0.0040264, + }, + }, + stopReason: "stop", + }, + { + role: "user", + content: [ + { + type: "text", + text: "can you see what site i'm on?", + }, + ], + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "I'll use the browser_javascript tool to check the current page's URL and title.", + }, + { + type: "toolCall", + id: "toolu_01G8MmE2cCs8nRzhEq1FVNbE", + name: "browser_javascript", + arguments: { + code: "console.log({\n url: window.location.href,\n title: document.title\n});", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-3-5-haiku-20241022", + usage: { + input: 4457, + output: 96, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.0035656000000000004, + output: 0.000384, + cacheRead: 0, + cacheWrite: 0, + total: 0.0039496, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_01G8MmE2cCs8nRzhEq1FVNbE", + toolName: "browser_javascript", + output: "Error: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: \"script-src 'self' 'unsafe-inline' https://maps.googleapis.com https://*.twimg.com https://recaptcha.net/recaptcha/ http://www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js https://accounts.google.com/gsi/client https://apis.google.com/js/api.js https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js https://client-api.arkoselabs.com/ https://static.ads-twitter.com https://twitter.com https://www.google-analytics.com https://www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js https://x.com https://sdn.payments-dev.x.com/assets/loader.min.js https://sdn.payments-staging.x.com/assets/loader.min.js https://sdn.payments-prod.x.com/assets/loader.min.js https://sdn.money-dev.x.com/assets/loader.min.js https://sdn.money-staging.x.com/assets/loader.min.js https://sdn.money.x.com/assets/loader.min.js https://sdk.dv.socure.io/latest/device-risk-sdk.js https://cdn.plaid.com/link/v2/stable/link-initialize.js https://payments-dev.x.com/customer/wasm/xxp-forward-with-sdk.js https://payments-staging.x.com/customer/wasm/xxp-forward-with-sdk.js https://payments-prod.x.com/customer/wasm/xxp-forward-with-sdk.js https://money-dev.x.com/customer/wasm/xxp-forward-with-sdk.js https://money-staging.x.com/customer/wasm/xxp-forward-with-sdk.js https://money.x.com/customer/wasm/xxp-forward-with-sdk.js https://js.stripe.com https://*.js.stripe.com https://cdn.getpinwheel.com/pinwheel-v3.1.0.js https://securepubads.g.doubleclick.net https://www.googletagservices.com https://*.googletagservices.com https://pagead2.googlesyndication.com https://adservice.google.com https://www.googleadservices.com https://ads.google.com https://tpc.googlesyndication.com https://*.tpc.googlesyndication.com https://www.google.com https://googleads.g.doubleclick.net https://app.intercom.io https://widget.intercom.io https://js.intercomcdn.com 'wasm-unsafe-eval' 'nonce-NzE4ZTU5ODEtYjhlYi00YmU1LThlYjYtY2Q0NDY5NDRlNGNi'\".\n\n\nStack trace:\nEvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: \"script-src 'self' 'unsafe-inline' https://maps.googleapis.com https://*.twimg.com https://recaptcha.net/recaptcha/ http://www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js https://accounts.google.com/gsi/client https://apis.google.com/js/api.js https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js https://client-api.arkoselabs.com/ https://static.ads-twitter.com https://twitter.com https://www.google-analytics.com https://www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js https://x.com https://sdn.payments-dev.x.com/assets/loader.min.js https://sdn.payments-staging.x.com/assets/loader.min.js https://sdn.payments-prod.x.com/assets/loader.min.js https://sdn.money-dev.x.com/assets/loader.min.js https://sdn.money-staging.x.com/assets/loader.min.js https://sdn.money.x.com/assets/loader.min.js https://sdk.dv.socure.io/latest/device-risk-sdk.js https://cdn.plaid.com/link/v2/stable/link-initialize.js https://payments-dev.x.com/customer/wasm/xxp-forward-with-sdk.js https://payments-staging.x.com/customer/wasm/xxp-forward-with-sdk.js https://payments-prod.x.com/customer/wasm/xxp-forward-with-sdk.js https://money-dev.x.com/customer/wasm/xxp-forward-with-sdk.js https://money-staging.x.com/customer/wasm/xxp-forward-with-sdk.js https://money.x.com/customer/wasm/xxp-forward-with-sdk.js https://js.stripe.com https://*.js.stripe.com https://cdn.getpinwheel.com/pinwheel-v3.1.0.js https://securepubads.g.doubleclick.net https://www.googletagservices.com https://*.googletagservices.com https://pagead2.googlesyndication.com https://adservice.google.com https://www.googleadservices.com https://ads.google.com https://tpc.googlesyndication.com https://*.tpc.googlesyndication.com https://www.google.com https://googleads.g.doubleclick.net https://app.intercom.io https://widget.intercom.io https://js.intercomcdn.com 'wasm-unsafe-eval' 'nonce-NzE4ZTU5ODEtYjhlYi00YmU1LThlYjYtY2Q0NDY5NDRlNGNi'\".\n\n at eval ()\n at :57:46\n at new Promise ()\n at :2:18\n at :95:11", + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-3-5-haiku-20241022", + usage: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + total: 0, + }, + }, + stopReason: "error", + errorMessage: '525 \n\n\n\n \n\n\n\napi.anthropic.com | 525: SSL handshake failed\n\n\n\n\n\n\n\n\n\n\n
\n
\n
\n

\n SSL handshake failed\n Error code 525\n

\n
\n Visit cloudflare.com for more information.\n
\n
2025-10-03 01:28:05 UTC
\n
\n
\n
\n
\n \n
\n
\n \n \n \n \n
\n You\n

\n \n Browser\n \n

\n Working\n
\n\n
\n
\n \n \n \n \n
\n Vienna\n

\n \n Cloudflare\n \n

\n Working\n
\n\n
\n
\n \n \n \n \n
\n api.anthropic.com\n

\n \n Host\n \n

\n Error\n
\n\n
\n
\n
\n\n
\n
\n
\n

What happened?

\n

Cloudflare is unable to establish an SSL connection to the origin server.

\n
\n
\n

What can I do?

\n

If you\'re a visitor of this website:

\n

Please try again in a few minutes.

\n\n

If you\'re the owner of this website:

\n

It appears that the SSL configuration used is not compatible with Cloudflare. This could happen for a several reasons, including no shared cipher suites. Additional troubleshooting information here.

\n
\n
\n
\n\n \n\n\n
\n
\n\n\n', + }, + { + role: "user", + content: [ + { + type: "text", + text: "what site am i on?", + }, + ], + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "I apologize for the previous error. Let me try again to retrieve the current site information using a different method:", + }, + { + type: "toolCall", + id: "toolu_01GJNTLKUQNHfexNcJwmdLuU", + name: "browser_javascript", + arguments: { + code: "try {\n console.log(window.location.href);\n} catch (e) {\n console.error('Error getting URL:', e.message);\n}", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-3-5-haiku-20241022", + usage: { + input: 6182, + output: 115, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.0049456000000000005, + output: 0.00045999999999999996, + cacheRead: 0, + cacheWrite: 0, + total: 0.005405600000000001, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_01GJNTLKUQNHfexNcJwmdLuU", + toolName: "browser_javascript", + output: "https://t3.chat/chat/aff0de76-0056-4fb1-a493-fbb17d8407cc", + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "You're currently on a T3 chat page, specifically a specific chat instance with the URL https://t3.chat/chat/aff0de76-0056-4fb1-a493-fbb17d8407cc. T3 appears to be a chat platform or messaging application.\n\nIs there anything specific you'd like to know about this page or the site?", + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-3-5-haiku-20241022", + usage: { + input: 6337, + output: 86, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.0050696000000000005, + output: 0.00034399999999999996, + cacheRead: 0, + cacheWrite: 0, + total: 0.0054136, + }, + }, + stopReason: "stop", + }, + { + role: "user", + content: [ + { + type: "text", + text: "can you find the chatbox and submit a messaage?\n", + }, + ], + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "I'll first locate the chatbox and then attempt to submit a message:", + }, + { + type: "toolCall", + id: "toolu_015tzmr3VZsAWkUoyPmSVFPs", + name: "browser_javascript", + arguments: { + code: "// Find the textarea input\nconst textarea = document.querySelector('textarea');\nconst sendButton = document.querySelector('button[type=\"submit\"]');\n\nif (textarea && sendButton) {\n console.log('Chatbox elements found:');\n console.log('Textarea:', textarea);\n console.log('Send Button:', sendButton);\n \n // Insert a test message\n textarea.value = 'Hello from the AI assistant!';\n \n // Simulate input event to trigger any reactive frameworks\n const inputEvent = new Event('input', { bubbles: true });\n textarea.dispatchEvent(inputEvent);\n \n // Try to click the send button\n sendButton.click();\n \n console.log('Attempted to send message');\n} else {\n console.log('Could not find chatbox elements');\n if (!textarea) console.log('Textarea not found');\n if (!sendButton) console.log('Send button not found');\n}", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-3-5-haiku-20241022", + usage: { + input: 6439, + output: 294, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.005151200000000001, + output: 0.001176, + cacheRead: 0, + cacheWrite: 0, + total: 0.006327200000000001, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_015tzmr3VZsAWkUoyPmSVFPs", + toolName: "browser_javascript", + output: "Chatbox elements found:\nTextarea: [object Object]\nSend Button: [object Object]\nAttempted to send message", + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: 'I\'ve located the chatbox textarea and send button, and attempted to send a message. The console log suggests the elements were found successfully, and I tried to submit "Hello from the AI assistant!".\n\nHowever, due to the nature of modern web applications (especially those using React or other frameworks), the exact mechanism of sending a message can be more complex. The simple `.click()` method might not always trigger the full send process.\n\nWould you like me to try a more detailed approach to sending a message? I can:\n1. Investigate the exact send mechanism\n2. Try alternative methods of triggering the send action\n3. Modify the message\n4. Provide more detailed debugging information\n\nWhat would you like me to do next?', + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-3-5-haiku-20241022", + usage: { + input: 6769, + output: 159, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.0054152, + output: 0.000636, + cacheRead: 0, + cacheWrite: 0, + total: 0.0060512000000000005, + }, + }, + stopReason: "stop", + }, + { + role: "user", + content: [ + { + type: "text", + text: "you managed to enter the text in teh text area, but click is not possible because the app thinks no text has been entered yet", + }, + ], + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "You're right. I'll modify the script to simulate a more complete interaction that might trigger the send button to become active:", + }, + { + type: "toolCall", + id: "toolu_013VotjmhYQ9snEs4DGqmeF7", + name: "browser_javascript", + arguments: { + code: "// Find the textarea input\nconst textarea = document.querySelector('textarea');\nconst sendButton = document.querySelector('button[type=\"submit\"]');\n\nif (textarea && sendButton) {\n console.log('Chatbox elements found');\n \n // Set the value\n textarea.value = 'Hello from the AI assistant!';\n \n // Trigger input, change, and other events to simulate user typing\n const events = ['input', 'change', 'keydown', 'keyup'];\n events.forEach(eventName => {\n const event = new Event(eventName, { \n bubbles: true, \n cancelable: true \n });\n textarea.dispatchEvent(event);\n });\n \n // If there's a React or framework-specific way to update the state\n if (textarea._valueTracker) {\n textarea._valueTracker.setValue('');\n textarea._valueTracker.setValue('Hello from the AI assistant!');\n }\n \n console.log('Attempted to simulate text entry');\n \n // Check button state\n console.log('Send button disabled:', sendButton.disabled);\n console.log('Send button attributes:', sendButton.attributes);\n} else {\n console.log('Could not find chatbox elements');\n}", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-3-5-haiku-20241022", + usage: { + input: 6958, + output: 379, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.005566400000000001, + output: 0.001516, + cacheRead: 0, + cacheWrite: 0, + total: 0.007082400000000001, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_013VotjmhYQ9snEs4DGqmeF7", + toolName: "browser_javascript", + output: "Chatbox elements found\nAttempted to simulate text entry\nSend button disabled: true\nSend button attributes: [object Object]", + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "I see the challenge now. The send button is still disabled. This likely means the application is using a custom validation method that our previous attempts didn't trigger.\n\nLet me try one more approach that might simulate a more complete user interaction:", + }, + { + type: "toolCall", + id: "toolu_01Q2T3SyqvPghPtW8cqV9DRi", + name: "browser_javascript", + arguments: { + code: "// Find the textarea input\nconst textarea = document.querySelector('textarea');\nconst sendButton = document.querySelector('button[type=\"submit\"]');\n\nif (textarea && sendButton) {\n // Set the value directly\n textarea.value = 'Hello from the AI assistant!';\n \n // Trigger a full set of events\n ['input', 'change', 'keydown', 'keyup'].forEach(eventName => {\n const event = new Event(eventName, { \n bubbles: true, \n cancelable: true \n });\n \n // Add key details for keydown/keyup\n if (eventName === 'keydown' || eventName === 'keyup') {\n Object.defineProperty(event, 'key', {value: 'Enter', enumerable: true});\n Object.defineProperty(event, 'keyCode', {value: 13, enumerable: true});\n }\n \n textarea.dispatchEvent(event);\n });\n \n // Try to focus the textarea\n textarea.focus();\n \n // Log current state\n console.log('Textarea value:', textarea.value);\n console.log('Send button disabled:', sendButton.disabled);\n \n // If React is used, try to trigger state update\n const reactKey = Object.keys(textarea).find(key => key.startsWith('__react'));\n if (reactKey) {\n const reactProps = textarea[reactKey];\n console.log('React props found', reactProps);\n \n // If there's an onChange handler, try to call it\n if (reactProps && reactProps.onChange) {\n reactProps.onChange({\n target: textarea,\n type: 'change'\n });\n }\n }\n} else {\n console.log('Could not find chatbox elements');\n}", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-3-5-haiku-20241022", + usage: { + input: 7375, + output: 537, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.005900000000000001, + output: 0.0021479999999999997, + cacheRead: 0, + cacheWrite: 0, + total: 0.008048, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_01Q2T3SyqvPghPtW8cqV9DRi", + toolName: "browser_javascript", + output: "Error executing script: Frame with ID 0 was removed.", + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-3-5-haiku-20241022", + usage: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + total: 0, + }, + }, + stopReason: "aborted", + errorMessage: "Request was aborted.", + }, + { + role: "user", + content: [ + { + type: "text", + text: "well, that didn't work", + }, + ], + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "You're right. The error suggests that the page might have changed or been refresh", + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-3-5-haiku-20241022", + usage: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + total: 0, + }, + }, + stopReason: "aborted", + errorMessage: "Request was aborted.", + }, + { + role: "user", + content: [ + { + type: "text", + text: "try again, you are smarter now", + }, + ], + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "Let me try a smarter approach. I'll first inspect the structure to understand how the app is managing state, then trigger the right events:", + }, + { + type: "toolCall", + id: "toolu_01D1m3bhziBFcS5Ges5XHmTJ", + name: "browser_javascript", + arguments: { + code: "// Find the textarea\nconst textarea = document.querySelector('textarea');\n\nif (textarea) {\n console.log('Found textarea');\n \n // Find all React internal properties\n const reactKey = Object.keys(textarea).find(key => key.startsWith('__react'));\n console.log('React key:', reactKey);\n \n if (reactKey) {\n const reactProps = textarea[reactKey];\n console.log('React internal props found');\n \n // Get the fiber node to access props\n let fiber = reactProps;\n while (fiber) {\n if (fiber.memoizedProps && fiber.memoizedProps.onChange) {\n console.log('Found onChange handler');\n break;\n }\n if (fiber.return) {\n fiber = fiber.return;\n } else {\n break;\n }\n }\n }\n \n // Set value using native setter\n const nativeInputValueSetter = Object.getOwnPropertyDescriptor(\n window.HTMLTextAreaElement.prototype, \n 'value'\n ).set;\n \n nativeInputValueSetter.call(textarea, 'Hello from the AI assistant!');\n \n // Dispatch input event\n const inputEvent = new Event('input', { bubbles: true });\n textarea.dispatchEvent(inputEvent);\n \n console.log('Value set:', textarea.value);\n \n // Check button state after a moment\n setTimeout(() => {\n const sendButton = document.querySelector('button[type=\"submit\"]');\n console.log('Button disabled after input:', sendButton?.disabled);\n }, 100);\n \n} else {\n console.log('Textarea not found');\n}\n", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 8199, + output: 492, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.024597, + output: 0.00738, + cacheRead: 0, + cacheWrite: 0, + total: 0.031977, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_01D1m3bhziBFcS5Ges5XHmTJ", + toolName: "browser_javascript", + output: "Found textarea\nReact key: __reactFiber$i19q71cval\nReact internal props found\nFound onChange handler\nValue set: Hello from the AI assistant!", + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "\n\nGood! I found the React fiber and set the value. Now let me check if the button is enabled and try to click it:", + }, + { + type: "toolCall", + id: "toolu_01Xe7RURRFtQc6f6CPRfj4iu", + name: "browser_javascript", + arguments: { + code: "const sendButton = document.querySelector('button[type=\"submit\"]');\nconst textarea = document.querySelector('textarea');\n\nconsole.log('Current textarea value:', textarea?.value);\nconsole.log('Send button disabled:', sendButton?.disabled);\n\nif (sendButton && !sendButton.disabled) {\n console.log('Clicking send button now...');\n sendButton.click();\n console.log('Message sent!');\n} else if (sendButton && sendButton.disabled) {\n console.log('Button is still disabled. The state update might not have triggered properly.');\n}\n", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 8737, + output: 213, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.026211, + output: 0.003195, + cacheRead: 0, + cacheWrite: 0, + total: 0.029406, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_01Xe7RURRFtQc6f6CPRfj4iu", + toolName: "browser_javascript", + output: "Current textarea value: Hello from the AI assistant!\nSend button disabled: false\nClicking send button now...\nMessage sent!", + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: '\n\nSuccess! 🎉 I managed to:\n1. Find the textarea and its React fiber\n2. Set the value using the native setter (which bypasses React\'s detection)\n3. Dispatch the proper input event to trigger React\'s state update\n4. The send button became enabled\n5. Successfully clicked it to send the message "Hello from the AI assistant!"\n\nThe key was using the native `HTMLTextAreaElement` value setter and then dispatching the input event, which properly notified React of the change. This is a more "framework-aware" approach that respects how React tracks input changes.', + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 8986, + output: 134, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.026958, + output: 0.00201, + cacheRead: 0, + cacheWrite: 0, + total: 0.028968, + }, + }, + stopReason: "stop", + }, + { + role: "user", + content: [ + { + type: "text", + text: "ask it what t3 offers", + }, + ], + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "I'll send a message asking about what T3 offers:", + }, + { + type: "toolCall", + id: "toolu_01Mc4YE51qxtGCy4JeQwADSa", + name: "browser_javascript", + arguments: { + code: "const textarea = document.querySelector('textarea');\nconst sendButton = document.querySelector('button[type=\"submit\"]');\n\nif (textarea && sendButton) {\n // Set value using native setter\n const nativeInputValueSetter = Object.getOwnPropertyDescriptor(\n window.HTMLTextAreaElement.prototype, \n 'value'\n ).set;\n \n nativeInputValueSetter.call(textarea, 'What does T3 offer?');\n \n // Dispatch input event to trigger React state update\n const inputEvent = new Event('input', { bubbles: true });\n textarea.dispatchEvent(inputEvent);\n \n console.log('Message typed:', textarea.value);\n \n // Wait a moment for React to process, then click\n setTimeout(() => {\n if (!sendButton.disabled) {\n sendButton.click();\n console.log('Message sent: \"What does T3 offer?\"');\n } else {\n console.log('Button still disabled');\n }\n }, 100);\n} else {\n console.log('Could not find chatbox elements');\n}\n", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 9130, + output: 331, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.02739, + output: 0.004965, + cacheRead: 0, + cacheWrite: 0, + total: 0.032355, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_01Mc4YE51qxtGCy4JeQwADSa", + toolName: "browser_javascript", + output: "Message typed: What does T3 offer?", + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: '\n\nPerfect! I\'ve sent the message "What does T3 offer?" to the chat. The message should now appear in the conversation, and you should receive a response explaining what T3 offers. Let me know what the response says!', + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 9481, + output: 53, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.028443, + output: 0.000795, + cacheRead: 0, + cacheWrite: 0, + total: 0.029238, + }, + }, + stopReason: "stop", + }, + { + role: "user", + content: [ + { + type: "text", + text: "need a higher timeout", + }, + ], + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "You're right, let me increase the timeout:", + }, + { + type: "toolCall", + id: "toolu_018EUmEjTXgnDX5gtGorF3B1", + name: "browser_javascript", + arguments: { + code: "const textarea = document.querySelector('textarea');\nconst sendButton = document.querySelector('button[type=\"submit\"]');\n\nif (textarea && sendButton) {\n // Set value using native setter\n const nativeInputValueSetter = Object.getOwnPropertyDescriptor(\n window.HTMLTextAreaElement.prototype, \n 'value'\n ).set;\n \n nativeInputValueSetter.call(textarea, 'What does T3 offer?');\n \n // Dispatch input event to trigger React state update\n const inputEvent = new Event('input', { bubbles: true });\n textarea.dispatchEvent(inputEvent);\n \n console.log('Message typed:', textarea.value);\n \n // Wait longer for React to process, then click\n setTimeout(() => {\n if (!sendButton.disabled) {\n sendButton.click();\n console.log('Message sent: \"What does T3 offer?\"');\n } else {\n console.log('Button still disabled after timeout');\n }\n }, 500);\n} else {\n console.log('Could not find chatbox elements');\n}\n", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 9541, + output: 329, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.028623, + output: 0.004935, + cacheRead: 0, + cacheWrite: 0, + total: 0.033558, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_018EUmEjTXgnDX5gtGorF3B1", + toolName: "browser_javascript", + output: "Message typed: What does T3 offer?", + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "\n\nI've increased the timeout to 500ms. The message should be sent now. Would you like me to try an even longer timeout, or would you like me to check if the message was successfully sent?", + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 9890, + output: 46, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.029670000000000002, + output: 0.00069, + cacheRead: 0, + cacheWrite: 0, + total: 0.03036, + }, + }, + stopReason: "stop", + }, + { + role: "user", + content: [ + { + type: "text", + text: "can you try without a setTimeout?", + }, + ], + }, + { + role: "assistant", + content: [], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + total: 0, + }, + }, + stopReason: "aborted", + errorMessage: "Request was aborted.", + }, + { + role: "user", + content: [ + { + type: "text", + text: "just do the button click", + }, + ], + }, + { + role: "assistant", + content: [ + { + type: "toolCall", + id: "toolu_01PT5nvi2zLUp8wWmvduzomz", + name: "browser_javascript", + arguments: { + code: "const textarea = document.querySelector('textarea');\nconst sendButton = document.querySelector('button[type=\"submit\"]');\n\nif (textarea && sendButton) {\n // Set value using native setter\n const nativeInputValueSetter = Object.getOwnPropertyDescriptor(\n window.HTMLTextAreaElement.prototype, \n 'value'\n ).set;\n \n nativeInputValueSetter.call(textarea, 'What does T3 offer?');\n \n // Dispatch input event to trigger React state update\n const inputEvent = new Event('input', { bubbles: true });\n textarea.dispatchEvent(inputEvent);\n \n console.log('Message typed:', textarea.value);\n console.log('Button disabled before click:', sendButton.disabled);\n \n // Click immediately\n sendButton.click();\n console.log('Message sent: \"What does T3 offer?\"');\n} else {\n console.log('Could not find chatbox elements');\n}\n", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 9952, + output: 285, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.029856, + output: 0.004275, + cacheRead: 0, + cacheWrite: 0, + total: 0.034131, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_01PT5nvi2zLUp8wWmvduzomz", + toolName: "browser_javascript", + output: 'Message typed: What does T3 offer?\nButton disabled before click: false\nMessage sent: "What does T3 offer?"', + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: '\n\nPerfect! The button was enabled immediately after dispatching the input event, so no setTimeout was needed. The message "What does T3 offer?" has been sent successfully!', + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 10277, + output: 39, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.030831, + output: 0.000585, + cacheRead: 0, + cacheWrite: 0, + total: 0.031416, + }, + }, + stopReason: "stop", + }, + { + role: "user", + content: [ + { + type: "text", + text: "hrm, for some reason the click even tdoes nothing", + }, + ], + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "Let me investigate the send button more closely to see what's actually handling the submission:", + }, + { + type: "toolCall", + id: "toolu_01Cvkd3XADVE1ToMXqjQYc12", + name: "browser_javascript", + arguments: { + code: "const sendButton = document.querySelector('button[type=\"submit\"]');\nconst form = document.querySelector('form');\n\nconsole.log('Send button:', sendButton);\nconsole.log('Button onclick:', sendButton?.onclick);\nconsole.log('Form:', form);\nconsole.log('Form onsubmit:', form?.onsubmit);\n\n// Check for React event handlers\nif (sendButton) {\n const reactKey = Object.keys(sendButton).find(key => key.startsWith('__react'));\n if (reactKey) {\n const reactProps = sendButton[reactKey];\n console.log('React props on button:', reactProps);\n \n // Try to find the onClick handler in the fiber\n let fiber = reactProps;\n while (fiber) {\n if (fiber.memoizedProps) {\n console.log('Memoized props:', fiber.memoizedProps);\n if (fiber.memoizedProps.onClick) {\n console.log('Found onClick handler in fiber');\n }\n }\n if (fiber.return) {\n fiber = fiber.return;\n } else {\n break;\n }\n }\n }\n}\n\n// Check form structure\nif (form) {\n const formReactKey = Object.keys(form).find(key => key.startsWith('__react'));\n if (formReactKey) {\n const formFiber = form[formReactKey];\n console.log('Form has React fiber');\n if (formFiber.memoizedProps && formFiber.memoizedProps.onSubmit) {\n console.log('Form has onSubmit handler');\n }\n }\n}\n", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 10331, + output: 473, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.030993, + output: 0.007095000000000001, + cacheRead: 0, + cacheWrite: 0, + total: 0.038088, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_01Cvkd3XADVE1ToMXqjQYc12", + toolName: "browser_javascript", + output: "Error executing script: Frame with ID 0 was removed.", + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + total: 0, + }, + }, + stopReason: "aborted", + errorMessage: "Request was aborted.", + }, + { + role: "user", + content: [ + { + type: "text", + text: "i'm on another page now with a chat again. can you find the chat window and input?", + }, + ], + }, + { + role: "assistant", + content: [ + { + type: "toolCall", + id: "toolu_018681im65XWx7SMGvRo9xPx", + name: "browser_javascript", + arguments: { + code: "// First, let's see what page we're on\nconsole.log('Current URL:', window.location.href);\nconsole.log('Page title:', document.title);\n\n// Look for common chat input elements\nconst textarea = document.querySelector('textarea');\nconst textInputs = document.querySelectorAll('input[type=\"text\"]');\nconst contentEditables = document.querySelectorAll('[contenteditable=\"true\"]');\n\nconsole.log('Found textarea:', textarea ? 'Yes' : 'No');\nconsole.log('Found text inputs:', textInputs.length);\nconsole.log('Found contenteditable elements:', contentEditables.length);\n\nif (textarea) {\n console.log('Textarea details:', {\n placeholder: textarea.placeholder,\n id: textarea.id,\n name: textarea.name,\n className: textarea.className\n });\n}\n\n// Look for send/submit buttons\nconst submitButtons = document.querySelectorAll('button[type=\"submit\"]');\nconst buttons = document.querySelectorAll('button');\n\nconsole.log('Found submit buttons:', submitButtons.length);\nconsole.log('Total buttons:', buttons.length);\n\n// Look for forms\nconst forms = document.querySelectorAll('form');\nconsole.log('Found forms:', forms.length);\n", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 10852, + output: 348, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.032556, + output: 0.00522, + cacheRead: 0, + cacheWrite: 0, + total: 0.037776000000000004, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_018681im65XWx7SMGvRo9xPx", + toolName: "browser_javascript", + output: "Current URL: https://www.ams.at/arbeitsuchende/aus-und-weiterbildung/berufsinformationen/berufsinformation/berufsinfomat?open=berufsinfomat\nPage title: Berufsinfomat | AMS\nFound textarea: No\nFound text inputs: 1\nFound contenteditable elements: 0\nFound submit buttons: 1\nTotal buttons: 12\nFound forms: 1", + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "\n\nI can see you're on an Austrian AMS (Arbeitsmarktservice) page about career information. I found 1 text input and 1 submit button. Let me examine them more closely:", + }, + { + type: "toolCall", + id: "toolu_01DuFzPze1zWi5QELAQtcUFZ", + name: "browser_javascript", + arguments: { + code: "const textInput = document.querySelector('input[type=\"text\"]');\nconst submitButton = document.querySelector('button[type=\"submit\"]');\nconst form = document.querySelector('form');\n\nif (textInput) {\n console.log('Text input details:', {\n placeholder: textInput.placeholder,\n id: textInput.id,\n name: textInput.name,\n value: textInput.value,\n className: textInput.className\n });\n}\n\nif (submitButton) {\n console.log('Submit button details:', {\n text: submitButton.textContent,\n id: submitButton.id,\n className: submitButton.className,\n disabled: submitButton.disabled\n });\n}\n\nif (form) {\n console.log('Form details:', {\n action: form.action,\n method: form.method,\n id: form.id\n });\n}\n", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 11314, + output: 310, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.033942, + output: 0.0046500000000000005, + cacheRead: 0, + cacheWrite: 0, + total: 0.038592, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_01DuFzPze1zWi5QELAQtcUFZ", + toolName: "browser_javascript", + output: "Text input details: [object Object]\nSubmit button details: [object Object]\nForm details: [object Object]", + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "\n\nThis appears to be a career information website form, not a chat interface. Are you sure you're on a chat page? Could you describe what you see on the screen, or would you like me to send a message through this form anyway?", + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 11659, + output: 53, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.034977, + output: 0.000795, + cacheRead: 0, + cacheWrite: 0, + total: 0.035772, + }, + }, + stopReason: "stop", + }, + { + role: "user", + content: [ + { + type: "text", + text: "could be in an iframe", + }, + ], + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "Good thinking! Let me check for iframes:", + }, + { + type: "toolCall", + id: "toolu_01JDhMJmHj79N7gBWZATBNvs", + name: "browser_javascript", + arguments: { + code: "// Find all iframes\nconst iframes = document.querySelectorAll('iframe');\nconsole.log('Found iframes:', iframes.length);\n\nif (iframes.length > 0) {\n iframes.forEach((iframe, index) => {\n console.log(`Iframe ${index}:`, {\n src: iframe.src,\n id: iframe.id,\n className: iframe.className,\n title: iframe.title,\n name: iframe.name\n });\n });\n \n // Try to access the first iframe's content\n try {\n const iframeDoc = iframes[0].contentDocument || iframes[0].contentWindow.document;\n if (iframeDoc) {\n console.log('Can access iframe content');\n console.log('Iframe page title:', iframeDoc.title);\n \n // Look for chat elements in the iframe\n const iframeTextarea = iframeDoc.querySelector('textarea');\n const iframeTextInputs = iframeDoc.querySelectorAll('input[type=\"text\"]');\n \n console.log('Found textarea in iframe:', iframeTextarea ? 'Yes' : 'No');\n console.log('Found text inputs in iframe:', iframeTextInputs.length);\n }\n } catch (e) {\n console.log('Cannot access iframe content (cross-origin):', e.message);\n }\n} else {\n console.log('No iframes found on the page');\n}\n", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 11720, + output: 423, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.035160000000000004, + output: 0.006345, + cacheRead: 0, + cacheWrite: 0, + total: 0.041505, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_01JDhMJmHj79N7gBWZATBNvs", + toolName: "browser_javascript", + output: "Found iframes: 1\nIframe 0: [object Object]\nCannot access iframe content (cross-origin): Failed to read a named property 'document' from 'Window': Blocked a frame with origin \"https://www.ams.at\" from accessing a cross-origin frame.", + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "\n\nThere is an iframe on the page, but it's cross-origin so I can't access its content directly due to browser security restrictions. Let me get more details about the iframe:", + }, + { + type: "toolCall", + id: "toolu_0153cpVfNAXdNkipbEikNNTu", + name: "browser_javascript", + arguments: { + code: "const iframe = document.querySelector('iframe');\nif (iframe) {\n console.log('Iframe source:', iframe.src);\n console.log('Iframe ID:', iframe.id);\n console.log('Iframe class:', iframe.className);\n console.log('Iframe title:', iframe.title);\n console.log('Iframe width:', iframe.width);\n console.log('Iframe height:', iframe.height);\n}\n", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 12217, + output: 193, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.036651, + output: 0.002895, + cacheRead: 0, + cacheWrite: 0, + total: 0.039546000000000005, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_0153cpVfNAXdNkipbEikNNTu", + toolName: "browser_javascript", + output: "Iframe source: https://berufsinfomat.prod.portal.ams.at/client/6453a57358480fb76ddc0a43/overlay?lc=de&ss=min\nIframe ID: ams-modal-berufsinfomat-iframe\nIframe class: \nIframe title: Berufsinfomat des AMS\nIframe width: 100%\nIframe height: 400", + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "\n\nThe iframe is from `berufsinfomat.prod.portal.ams.at` which is a career information tool. Since it's cross-origin, I cannot directly access its content from the parent page due to browser security policies.\n\nThis doesn't appear to be a chat interface like T3 - it's a career counseling tool. Are you perhaps looking at a different window or tab? Or is there a chat widget somewhere on this page that I should look for?", + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 12519, + output: 104, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.037557, + output: 0.00156, + cacheRead: 0, + cacheWrite: 0, + total: 0.039117, + }, + }, + stopReason: "stop", + }, + { + role: "user", + content: [ + { + type: "text", + text: "can you open that iframe url in a new tab?", + }, + ], + }, + { + role: "assistant", + content: [ + { + type: "toolCall", + id: "toolu_015qgN7Jjw16r43gKXBEeBFN", + name: "browser_javascript", + arguments: { + code: "const iframeUrl = 'https://berufsinfomat.prod.portal.ams.at/client/6453a57358480fb76ddc0a43/overlay?lc=de&ss=min';\n\n// Open the iframe URL in a new tab\nwindow.open(iframeUrl, '_blank');\n\nconsole.log('Opened iframe URL in new tab:', iframeUrl);\n", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 12637, + output: 146, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.037911, + output: 0.00219, + cacheRead: 0, + cacheWrite: 0, + total: 0.040101, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_015qgN7Jjw16r43gKXBEeBFN", + toolName: "browser_javascript", + output: "Opened iframe URL in new tab: https://berufsinfomat.prod.portal.ams.at/client/6453a57358480fb76ddc0a43/overlay?lc=de&ss=min", + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "\n\nI've opened the iframe URL in a new tab! Once you switch to that tab, I'll be able to access the content directly and help you interact with the chat interface there. Let me know when you're on the new tab and I can look for the chat input and other elements.", + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 12845, + output: 63, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.038535, + output: 0.000945, + cacheRead: 0, + cacheWrite: 0, + total: 0.03948, + }, + }, + stopReason: "stop", + }, + { + role: "user", + content: [ + { + type: "text", + text: "ok, i'm on a news page now, can you tell me what's news today?", + }, + ], + }, + { + role: "assistant", + content: [], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + total: 0, + }, + }, + stopReason: "aborted", + errorMessage: "Request was aborted.", + }, + { + role: "user", + content: [ + { + type: "text", + text: "write a markdown doc, and include images if possible", + }, + ], + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "I'll check what's on the current page and extract the news for you:", + }, + { + type: "toolCall", + id: "toolu_01XaoCN6tM5NGdQXy2SjssXZ", + name: "browser_javascript", + arguments: { + code: "// Get the current page info\nconsole.log('Current URL:', window.location.href);\nconsole.log('Page title:', document.title);\n\n// Look for news articles\nconst articles = document.querySelectorAll('article, .article, .news-item, [class*=\"article\"], [class*=\"story\"]');\nconsole.log('Found articles:', articles.length);\n\n// Look for headlines\nconst headlines = document.querySelectorAll('h1, h2, h3, .headline, [class*=\"headline\"], [class*=\"title\"]');\nconsole.log('Found headlines:', headlines.length);\n\n// Look for images\nconst images = document.querySelectorAll('img');\nconsole.log('Found images:', images.length);\n\n// Get main content\nconst mainContent = document.querySelector('main, #main, .main-content, [role=\"main\"]');\nconsole.log('Found main content:', mainContent ? 'Yes' : 'No');\n\n// Let's get a sample of what's on the page\nconsole.log('Body text preview:', document.body.innerText.substring(0, 500));\n", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 12941, + output: 324, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.038823, + output: 0.00486, + cacheRead: 0, + cacheWrite: 0, + total: 0.043683, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_01XaoCN6tM5NGdQXy2SjssXZ", + toolName: "browser_javascript", + output: 'Current URL: https://www.derstandard.at/\nPage title: derStandard.at | Nachrichten, Kommentare & Community\nFound articles: 231\nFound headlines: 365\nFound images: 154\nFound main content: Yes\nBody text preview: Fr, 3.10.2025\nStartseite\nÜberblick\nNACHRICHTEN IN ECHTZEIT\nRussland greift ukrainische Energieinfrastruktur an \nSchikanen gegen Arbeitsmigranten in Russland \nFall Anna: Gerichtspräsidentin übt scharfe Kritik an Drohungen gegen Richter \nZiel Playoff: Maskenmann Pöltl vor zehnter NBA-Saison zuversichtlich \n\nZUKUNFT MEDIENKOMPETENZ\n\n106\nPostings\nNetzexpertin Brodnig: "Propaganda ist erfolgreich, wenn sich Leute nicht mehr auskennen"\n\nGezielt Verwirrung stiften – das ist die Strategie hinter vielen', + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "\n\nGreat! You're on derStandard.at, an Austrian news site. Let me extract the news articles with images:", + }, + { + type: "toolCall", + id: "toolu_01FDif6VsohQR8Eint1TSZDi", + name: "browser_javascript", + arguments: { + code: "// Extract news articles with their details\nconst newsData = [];\n\n// Find article containers\nconst articles = document.querySelectorAll('article, .article-teaser, [class*=\"teaser\"]');\n\narticles.forEach((article, index) => {\n if (index < 15) { // Get top 15 articles\n const headline = article.querySelector('h1, h2, h3, h4, .headline, [class*=\"headline\"]');\n const link = article.querySelector('a');\n const img = article.querySelector('img');\n const description = article.querySelector('p, .description, .teaser-text, [class*=\"description\"]');\n \n if (headline && headline.textContent.trim()) {\n newsData.push({\n title: headline.textContent.trim(),\n link: link ? link.href : '',\n image: img ? img.src : '',\n imageAlt: img ? img.alt : '',\n description: description ? description.textContent.trim() : ''\n });\n }\n }\n});\n\nconsole.log('Extracted news articles:', newsData.length);\nconsole.log(JSON.stringify(newsData.slice(0, 5), null, 2)); // Show first 5 in console\n\n// Return the data\nnewsData;\n", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 13535, + output: 385, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.040605, + output: 0.005775, + cacheRead: 0, + cacheWrite: 0, + total: 0.046380000000000005, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_01FDif6VsohQR8Eint1TSZDi", + toolName: "browser_javascript", + output: 'Extracted news articles: 6\n[\n {\n "title": "Russland greift ukrainische Energieinfrastruktur an",\n "link": "https://www.derstandard.at/jetzt/livebericht/3000000290448/lage-an-akw-saporischschja-laut-selenskyj-kritisch?ref=niewidget",\n "image": "",\n "imageAlt": "",\n "description": ""\n },\n {\n "title": "Schikanen gegen Arbeitsmigranten in Russland",\n "link": "https://www.derstandard.at/story/3000000290399/schikanen-gegen-arbeitsmigranten-in-russland?ref=niewidget",\n "image": "",\n "imageAlt": "",\n "description": ""\n },\n {\n "title": "Fall Anna: Gerichtspräsidentin übt scharfe Kritik an Drohungen gegen Richter",\n "link": "https://www.derstandard.at/story/3000000290483/fall-anna-gerichtspraesidentin-uebt-scharfe-kritik-an-drohungen-gegen-richter?ref=niewidget",\n "image": "",\n "imageAlt": "",\n "description": ""\n },\n {\n "title": "Ziel Playoff: Maskenmann Pöltl vor zehnter NBA-Saison zuversichtlich",\n "link": "https://www.derstandard.at/story/3000000290494/basketball-maskenmann-p246ltl-vor-zehnter-nba-saison-zuversichtlich?ref=niewidget",\n "image": "",\n "imageAlt": "",\n "description": ""\n },\n {\n "title": "Netzexpertin Brodnig: \\"Propaganda ist erfolgreich, wenn sich Leute nicht mehr auskennen\\"",\n "link": "https://www.derstandard.at/story/3000000290377/netzexpertin-brodnig-propaganda-ist-erfolgreich-wenn-sich-leute-nicht-mehr-auskennen",\n "image": "https://i.ds.at/C_Le6w/rs:fill:600:400/plain/lido-images/2025/10/01/57d7d9b6-77f7-43fc-871a-c8ed93e22930.jpeg",\n "imageAlt": "",\n "description": "Zukunft Medienkompetenz"\n }\n]', + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "toolCall", + id: "toolu_018YgtrBC5eankNyqWxJW9D2", + name: "browser_javascript", + arguments: { + code: "// Let's get more comprehensive news data\nconst newsArticles = [];\n\n// Try different selectors for better coverage\nconst mainArticles = document.querySelectorAll('article');\n\nmainArticles.forEach((article, index) => {\n if (index < 20) {\n const headline = article.querySelector('h1, h2, h3, h4, h5, a[class*=\"headline\"], span[class*=\"headline\"]');\n const links = article.querySelectorAll('a');\n const mainLink = links[0];\n const img = article.querySelector('img');\n const textElements = article.querySelectorAll('p, span, div');\n \n let description = '';\n textElements.forEach(el => {\n const text = el.textContent.trim();\n if (text.length > 20 && text.length < 300 && !description) {\n description = text;\n }\n });\n \n if (headline && headline.textContent.trim().length > 5) {\n const title = headline.textContent.trim();\n // Avoid duplicates\n if (!newsArticles.find(a => a.title === title)) {\n newsArticles.push({\n title: title,\n link: mainLink ? mainLink.href : '',\n image: img ? img.src : '',\n imageAlt: img ? (img.alt || img.title || '') : '',\n description: description\n });\n }\n }\n }\n});\n\nconsole.log('Total articles extracted:', newsArticles.length);\nnewsArticles;\n", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 14583, + output: 436, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.043749, + output: 0.00654, + cacheRead: 0, + cacheWrite: 0, + total: 0.050289, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_018YgtrBC5eankNyqWxJW9D2", + toolName: "browser_javascript", + output: "Total articles extracted: 18", + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "toolCall", + id: "toolu_01LPxKs8zBbMvWdygvP9JxHF", + name: "browser_javascript", + arguments: { + code: "// Get the extracted news data and format it for markdown\nconst newsArticles = [];\nconst mainArticles = document.querySelectorAll('article');\n\nmainArticles.forEach((article, index) => {\n if (index < 20) {\n const headline = article.querySelector('h1, h2, h3, h4, h5');\n const links = article.querySelectorAll('a');\n const mainLink = links[0];\n const img = article.querySelector('img');\n const textElements = article.querySelectorAll('p');\n \n let description = '';\n textElements.forEach(el => {\n const text = el.textContent.trim();\n if (text.length > 20 && text.length < 300 && !description) {\n description = text;\n }\n });\n \n if (headline && headline.textContent.trim().length > 5) {\n const title = headline.textContent.trim();\n if (!newsArticles.find(a => a.title === title)) {\n newsArticles.push({\n title: title,\n link: mainLink ? mainLink.href : '',\n image: img ? img.src : '',\n imageAlt: img ? (img.alt || img.title || '') : '',\n description: description\n });\n }\n }\n }\n});\n\n// Get today's date\nconst today = new Date().toLocaleDateString('de-AT', { \n weekday: 'long', \n year: 'numeric', \n month: 'long', \n day: 'numeric' \n});\n\n// Create markdown content\nlet markdown = `# Der Standard - Nachrichten\\n## ${today}\\n\\n`;\nmarkdown += `*Quelle: [derStandard.at](${window.location.href})*\\n\\n---\\n\\n`;\n\nnewsArticles.forEach((article, index) => {\n markdown += `### ${index + 1}. ${article.title}\\n\\n`;\n \n if (article.image) {\n markdown += `![${article.imageAlt}](${article.image})\\n\\n`;\n }\n \n if (article.description) {\n markdown += `${article.description}\\n\\n`;\n }\n \n if (article.link) {\n markdown += `[Artikel lesen →](${article.link})\\n\\n`;\n }\n \n markdown += `---\\n\\n`;\n});\n\nconsole.log('Markdown created with', newsArticles.length, 'articles');\nmarkdown;\n", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 15035, + output: 685, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.045105, + output: 0.010275, + cacheRead: 0, + cacheWrite: 0, + total: 0.05538, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_01LPxKs8zBbMvWdygvP9JxHF", + toolName: "browser_javascript", + output: "Markdown created with 18 articles", + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "\n\nNow let me create the markdown document as an artifact:", + }, + { + type: "toolCall", + id: "toolu_013YSiSucUcbfdwXqgHUfy9T", + name: "browser_javascript", + arguments: { + code: "// Generate the final markdown\nconst newsArticles = [];\nconst mainArticles = document.querySelectorAll('article');\n\nmainArticles.forEach((article, index) => {\n if (index < 20) {\n const headline = article.querySelector('h1, h2, h3, h4, h5');\n const links = article.querySelectorAll('a');\n const mainLink = links[0];\n const img = article.querySelector('img');\n const textElements = article.querySelectorAll('p');\n \n let description = '';\n textElements.forEach(el => {\n const text = el.textContent.trim();\n if (text.length > 20 && text.length < 300 && !description) {\n description = text;\n }\n });\n \n if (headline && headline.textContent.trim().length > 5) {\n const title = headline.textContent.trim();\n if (!newsArticles.find(a => a.title === title)) {\n newsArticles.push({\n title: title,\n link: mainLink ? mainLink.href : '',\n image: img ? img.src : '',\n imageAlt: img ? (img.alt || img.title || '') : '',\n description: description\n });\n }\n }\n }\n});\n\nconst today = new Date().toLocaleDateString('de-AT', { \n weekday: 'long', \n year: 'numeric', \n month: 'long', \n day: 'numeric' \n});\n\nlet markdown = `# Der Standard - Nachrichten des Tages\\n## ${today}\\n\\n`;\nmarkdown += `*Quelle: [derStandard.at](${window.location.href})*\\n\\n`;\nmarkdown += `---\\n\\n`;\n\nnewsArticles.forEach((article, index) => {\n markdown += `### ${index + 1}. ${article.title}\\n\\n`;\n \n if (article.image) {\n markdown += `![${article.imageAlt || 'News Image'}](${article.image})\\n\\n`;\n }\n \n if (article.description) {\n markdown += `${article.description}\\n\\n`;\n }\n \n if (article.link) {\n markdown += `[📰 Artikel lesen](${article.link})\\n\\n`;\n }\n \n markdown += `---\\n\\n`;\n});\n\nconsole.log(markdown);\nmarkdown;\n", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 15738, + output: 683, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.047214, + output: 0.010245, + cacheRead: 0, + cacheWrite: 0, + total: 0.057458999999999996, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_013YSiSucUcbfdwXqgHUfy9T", + toolName: "browser_javascript", + output: '# Der Standard - Nachrichten des Tages\n## Freitag, 3. Oktober 2025\n\n*Quelle: [derStandard.at](https://www.derstandard.at/)*\n\n---\n\n### 1. Russland greift ukrainische Energieinfrastruktur an\n\n[📰 Artikel lesen](https://www.derstandard.at/jetzt/livebericht/3000000290448/lage-an-akw-saporischschja-laut-selenskyj-kritisch?ref=niewidget)\n\n---\n\n### 2. Schikanen gegen Arbeitsmigranten in Russland\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290399/schikanen-gegen-arbeitsmigranten-in-russland?ref=niewidget)\n\n---\n\n### 3. Fall Anna: Gerichtspräsidentin übt scharfe Kritik an Drohungen gegen Richter\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290483/fall-anna-gerichtspraesidentin-uebt-scharfe-kritik-an-drohungen-gegen-richter?ref=niewidget)\n\n---\n\n### 4. Ziel Playoff: Maskenmann Pöltl vor zehnter NBA-Saison zuversichtlich\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290494/basketball-maskenmann-p246ltl-vor-zehnter-nba-saison-zuversichtlich?ref=niewidget)\n\n---\n\n### 5. Netzexpertin Brodnig: "Propaganda ist erfolgreich, wenn sich Leute nicht mehr auskennen"\n\n![News Image](https://i.ds.at/C_Le6w/rs:fill:600:400/plain/lido-images/2025/10/01/57d7d9b6-77f7-43fc-871a-c8ed93e22930.jpeg)\n\nZukunft Medienkompetenz\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290377/netzexpertin-brodnig-propaganda-ist-erfolgreich-wenn-sich-leute-nicht-mehr-auskennen)\n\n---\n\n### 6. Flughafen München nach Drohnensichtung zwischenzeitlich geschlossen, zahlreiche Ausfälle\n\n![News Image](https://i.ds.at/fp3AhQ/rs:fill:600:400/plain/lido-images/2025/10/03/ef80089b-300d-4fcb-96b1-7b65cac270a4.jpeg)\n\nDer Flugbetrieb ist seit den frühen Morgenstunden wieder aufgenommen. Rund 3.000 Passagiere waren von den Ausfällen betroffen\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290460/flughafen-m252nchen-nach-schlie223ung-wegen-drohnensichtung-wieder-offen)\n\n---\n\n### 7. Wie stark werden Onlinekäufer manipuliert? Sozialministerium klagt Billigriesen Temu\n\n![News Image](https://i.ds.at/UQ7LBg/rs:fill:600:400/plain/lido-images/2025/10/02/7febc4a4-6c5a-473c-b28c-ce89d151db0b.jpeg)\n\nUnlauterer Wettbewerb\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290329/wie-stark-werden-onlinekaeufer-manipuliert-sozialministerium-klagt-billigriesen-temu)\n\n---\n\n### 8. Teslas Freude über Verkaufsrekord dürfte von kurzer Dauer sein\n\n![News Image](https://i.ds.at/ryC6hQ/rs:fill:600:400/plain/lido-images/2025/10/03/ecc3c7a6-7d2d-453f-b97d-002034b4d86e.jpeg)\n\nDie aktuell wieder besseren Zahlen dürften auf die Streichung einer Verkaufsprämie zurückzuführen sein. Parallel dazu wollen Investoren Musks Billionen-Dollar-Gehaltspaket kippen\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290473/teslas-freude-ueber-verkaufsrekord-duerfte-von-kurzer-dauer-sein)\n\n---\n\n### 9. Bis zu 17 Euro: Das kosten Eggs Benedict in der Wiener Gastronomie\n\n![News Image](https://i.ds.at/8Zh7zA/rs:fill:600:400/plain/lido-images/2025/10/02/fae3b15e-3ff7-4912-938a-2de53b7e33ff.jpeg)\n\nDen modernen Frühstücksklassiker findet man auf der Speisekarte zahlreicher Wiener Lokale. So viel muss man dafür hinblättern\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290304/bis-zu-17-euro-das-kosten-eggs-benedict-in-der-wiener-gastronomie)\n\n---\n\n### 10. Georg Dornauer lässt die SPÖ ganz alt aussehen\n\n![News Image](https://i.ds.at/cU2jUQ/rs:fill:600:400/plain/lido-images/2025/10/03/c77523eb-b3bb-4a66-8e32-fa29a441452b.jpeg)\n\nDer Ex-Chef der Tiroler Sozialdemokraten ist ein schwieriger Genosse. Dass seine Partei aber keine andere Konfliktlösung als den Ausschluss gefunden hat, ist ein Armutszeugnis\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290496/georg-dornauer-laesst-die-spoe-ganz-alt-aussehen)\n\n---\n\n### 11. Wir sollten die Krise in Österreichs Wirtschaft nicht größer reden, als sie ist\n\n![News Image](https://i.ds.at/QFlU-w/rs:fill:600:400/plain/lido-images/2025/08/01/6c3bcbb1-eca4-4237-ad84-d77e39bc3545.jpeg)\n\nOb Wachstum oder Jobmarkt: Zuletzt gab es nur schlechte Nachrichten vom heimischen Standort. Dabei gibt es gute Gründe, nicht zu verzagen. Vier Beispiele dafür\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290078/wir-sollten-die-krise-in-oesterreichs-wirtschaft-nicht-groesser-reden-als-sie-ist)\n\n---\n\n### 12. Drohnen über Dänemark: Festnahmen auf verdächtigem Schiff\n\n![AFP/DAMIEN MEYER](https://i.ds.at/E8GGfA/c:1200:800:fp:0.5:0.5/rs:fill:220:165:1/plain/lido-images/2025/10/01/423305df-5d12-48f4-9b28-517363b0fd8e.jpeg)\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290261/drohnen-ueber-daenemark-franzoesisches-militaer-entert-schiff-der-russischen-schattenflotte?ref=seite1_entdecken)\n\n---\n\n### 13. Anschlagspläne: Mutmaßliche Hamas-Mitglieder in Deutschland festgenommen\n\n![AFP/POOL/JOHN MACDOUGALL](https://i.ds.at/m-jE6g/c:1200:800:fp:0.5:0.5/rs:fill:220:165:1/plain/lido-images/2025/10/01/fc351fe4-cdac-4102-8332-95828658bff0.jpeg)\n\nJüdische Einrichtungen im Visier\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290245/anschlagsplaene-mutmassliche-hamas-mitglieder-in-deutschland-festgenommen?ref=seite1_entdecken)\n\n---\n\n### 14. Kinderfilm-Klassiker "Momo" bekommt zeitgemäßes Update\n\n![Constantin Film](https://i.ds.at/yibsqA/c:1200:800:fp:0.5:0.5/rs:fill:220:165:1/g:fp:0.48:0.19/plain/lido-images/2025/10/02/a0cfd114-6460-4370-9ea5-1ad60e89a843.jpeg)\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290391/kinderfilm-klassiker-momo-bekommt-zeitgemaesses-update?ref=seite1_entdecken)\n\n---\n\n### 15. Generalstreik in Italien nach Stopp von Gaza-Flottille\n\n![REUTERS/Claudia Greco](https://i.ds.at/wee2ag/c:1200:800:fp:0.5:0.5/rs:fill:220:165:1/plain/lido-images/2025/10/03/70939333-974c-44f4-ab81-20f49f555332.jpeg)\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290474/generalstreik-in-italien-nach-stopp-von-gaza-flottille?ref=seite1_entdecken)\n\n---\n\n### 16. Saturn-Mond Enceladus hat alle Zutaten, die es für Leben braucht\n\n![Illustr.: NASA/JPL-Caltech](https://i.ds.at/ae1Jkw/c:1013:675:fp:0.5:0.5/rs:fill:220:165:1/plain/lido-images/2025/10/02/53df0dc2-7990-40a9-8da3-4f5b8e21688f.jpeg)\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290229/saturn-mond-enceladus-hat-alle-zutaten-die-es-fuer-leben-braucht?ref=seite1_entdecken)\n\n---\n\n### 17. Welches Verhalten treibt euch in den Wahnsinn?\n\n![News Image](https://i.ds.at/hfeNIw/rs:fill:600:400/plain/lido-images/2025/04/16/1d6a93f4-5754-4ffc-88b6-954be5c2c396.jpeg)\n\nMein Forum: Diskutieren Sie dieses Thema mit der STANDARD-Community\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290297/welches-verhalten-treibt-euch-in-den-wahnsinn?ref=meinforum_widget)\n\n---\n\n### 18. Wohin kann man im Ernstfall als LGBTQIA Person sicher auswandern?\n\n![News Image](https://i.ds.at/JWzXOQ/rs:fill:600:400/plain/lido-images/2025/07/07/0d04eba0-7f8d-4156-88d1-151962852150.jpeg)\n\nMein Forum: Diskutieren Sie dieses Thema mit der STANDARD-Community\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290175/wohin-kann-man-im-ernstfall-als-lgbtqia-person-sicher-auswandern?ref=meinforum_widget)\n\n---', + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "\n\nPerfect! Now let me create the markdown file as an artifact:", + }, + { + type: "toolCall", + id: "toolu_01BtH9H2BvwxvKjLw5iHXcZC", + name: "artifacts", + arguments: { + command: "create", + filename: "news_today.md", + title: "Der Standard News - Today", + content: '# Der Standard - Nachrichten des Tages\n## Freitag, 3. Oktober 2025\n\n*Quelle: [derStandard.at](https://www.derstandard.at/)*\n\n---\n\n### 1. Russland greift ukrainische Energieinfrastruktur an\n\n[📰 Artikel lesen](https://www.derstandard.at/jetzt/livebericht/3000000290448/lage-an-akw-saporischschja-laut-selenskyj-kritisch?ref=niewidget)\n\n---\n\n### 2. Schikanen gegen Arbeitsmigranten in Russland\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290399/schikanen-gegen-arbeitsmigranten-in-russland?ref=niewidget)\n\n---\n\n### 3. Fall Anna: Gerichtspräsidentin übt scharfe Kritik an Drohungen gegen Richter\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290483/fall-anna-gerichtspraesidentin-uebt-scharfe-kritik-an-drohungen-gegen-richter?ref=niewidget)\n\n---\n\n### 4. Ziel Playoff: Maskenmann Pöltl vor zehnter NBA-Saison zuversichtlich\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290494/basketball-maskenmann-p246ltl-vor-zehnter-nba-saison-zuversichtlich?ref=niewidget)\n\n---\n\n### 5. Netzexpertin Brodnig: "Propaganda ist erfolgreich, wenn sich Leute nicht mehr auskennen"\n\n![News Image](https://i.ds.at/C_Le6w/rs:fill:600:400/plain/lido-images/2025/10/01/57d7d9b6-77f7-43fc-871a-c8ed93e22930.jpeg)\n\nZukunft Medienkompetenz\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290377/netzexpertin-brodnig-propaganda-ist-erfolgreich-wenn-sich-leute-nicht-mehr-auskennen)\n\n---\n\n### 6. Flughafen München nach Drohnensichtung zwischenzeitlich geschlossen, zahlreiche Ausfälle\n\n![News Image](https://i.ds.at/fp3AhQ/rs:fill:600:400/plain/lido-images/2025/10/03/ef80089b-300d-4fcb-96b1-7b65cac270a4.jpeg)\n\nDer Flugbetrieb ist seit den frühen Morgenstunden wieder aufgenommen. Rund 3.000 Passagiere waren von den Ausfällen betroffen\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290460/flughafen-m252nchen-nach-schlie223ung-wegen-drohnensichtung-wieder-offen)\n\n---\n\n### 7. Wie stark werden Onlinekäufer manipuliert? Sozialministerium klagt Billigriesen Temu\n\n![News Image](https://i.ds.at/UQ7LBg/rs:fill:600:400/plain/lido-images/2025/10/02/7febc4a4-6c5a-473c-b28c-ce89d151db0b.jpeg)\n\nUnlauterer Wettbewerb\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290329/wie-stark-werden-onlinekaeufer-manipuliert-sozialministerium-klagt-billigriesen-temu)\n\n---\n\n### 8. Teslas Freude über Verkaufsrekord dürfte von kurzer Dauer sein\n\n![News Image](https://i.ds.at/ryC6hQ/rs:fill:600:400/plain/lido-images/2025/10/03/ecc3c7a6-7d2d-453f-b97d-002034b4d86e.jpeg)\n\nDie aktuell wieder besseren Zahlen dürften auf die Streichung einer Verkaufsprämie zurückzuführen sein. Parallel dazu wollen Investoren Musks Billionen-Dollar-Gehaltspaket kippen\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290473/teslas-freude-ueber-verkaufsrekord-duerfte-von-kurzer-dauer-sein)\n\n---\n\n### 9. Bis zu 17 Euro: Das kosten Eggs Benedict in der Wiener Gastronomie\n\n![News Image](https://i.ds.at/8Zh7zA/rs:fill:600:400/plain/lido-images/2025/10/02/fae3b15e-3ff7-4912-938a-2de53b7e33ff.jpeg)\n\nDen modernen Frühstücksklassiker findet man auf der Speisekarte zahlreicher Wiener Lokale. So viel muss man dafür hinblättern\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290304/bis-zu-17-euro-das-kosten-eggs-benedict-in-der-wiener-gastronomie)\n\n---\n\n### 10. Georg Dornauer lässt die SPÖ ganz alt aussehen\n\n![News Image](https://i.ds.at/cU2jUQ/rs:fill:600:400/plain/lido-images/2025/10/03/c77523eb-b3bb-4a66-8e32-fa29a441452b.jpeg)\n\nDer Ex-Chef der Tiroler Sozialdemokraten ist ein schwieriger Genosse. Dass seine Partei aber keine andere Konfliktlösung als den Ausschluss gefunden hat, ist ein Armutszeugnis\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290496/georg-dornauer-laesst-die-spoe-ganz-alt-aussehen)\n\n---\n\n### 11. Wir sollten die Krise in Österreichs Wirtschaft nicht größer reden, als sie ist\n\n![News Image](https://i.ds.at/QFlU-w/rs:fill:600:400/plain/lido-images/2025/08/01/6c3bcbb1-eca4-4237-ad84-d77e39bc3545.jpeg)\n\nOb Wachstum oder Jobmarkt: Zuletzt gab es nur schlechte Nachrichten vom heimischen Standort. Dabei gibt es gute Gründe, nicht zu verzagen. Vier Beispiele dafür\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290078/wir-sollten-die-krise-in-oesterreichs-wirtschaft-nicht-groesser-reden-als-sie-ist)\n\n---\n\n### 12. Drohnen über Dänemark: Festnahmen auf verdächtigem Schiff\n\n![AFP/DAMIEN MEYER](https://i.ds.at/E8GGfA/c:1200:800:fp:0.5:0.5/rs:fill:220:165:1/plain/lido-images/2025/10/01/423305df-5d12-48f4-9b28-517363b0fd8e.jpeg)\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290261/drohnen-ueber-daenemark-franzoesisches-militaer-entert-schiff-der-russischen-schattenflotte?ref=seite1_entdecken)\n\n---\n\n### 13. Anschlagspläne: Mutmaßliche Hamas-Mitglieder in Deutschland festgenommen\n\n![AFP/POOL/JOHN MACDOUGALL](https://i.ds.at/m-jE6g/c:1200:800:fp:0.5:0.5/rs:fill:220:165:1/plain/lido-images/2025/10/01/fc351fe4-cdac-4102-8332-95828658bff0.jpeg)\n\nJüdische Einrichtungen im Visier\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290245/anschlagsplaene-mutmassliche-hamas-mitglieder-in-deutschland-festgenommen?ref=seite1_entdecken)\n\n---\n\n### 14. Kinderfilm-Klassiker "Momo" bekommt zeitgemäßes Update\n\n![Constantin Film](https://i.ds.at/yibsqA/c:1200:800:fp:0.5:0.5/rs:fill:220:165:1/g:fp:0.48:0.19/plain/lido-images/2025/10/02/a0cfd114-6460-4370-9ea5-1ad60e89a843.jpeg)\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290391/kinderfilm-klassiker-momo-bekommt-zeitgemaesses-update?ref=seite1_entdecken)\n\n---\n\n### 15. Generalstreik in Italien nach Stopp von Gaza-Flottille\n\n![REUTERS/Claudia Greco](https://i.ds.at/wee2ag/c:1200:800:fp:0.5:0.5/rs:fill:220:165:1/plain/lido-images/2025/10/03/70939333-974c-44f4-ab81-20f49f555332.jpeg)\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290474/generalstreik-in-italien-nach-stopp-von-gaza-flottille?ref=seite1_entdecken)\n\n---\n\n### 16. Saturn-Mond Enceladus hat alle Zutaten, die es für Leben braucht\n\n![Illustr.: NASA/JPL-Caltech](https://i.ds.at/ae1Jkw/c:1013:675:fp:0.5:0.5/rs:fill:220:165:1/plain/lido-images/2025/10/02/53df0dc2-7990-40a9-8da3-4f5b8e21688f.jpeg)\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290229/saturn-mond-enceladus-hat-alle-zutaten-die-es-fuer-leben-braucht?ref=seite1_entdecken)\n\n---\n\n### 17. Welches Verhalten treibt euch in den Wahnsinn?\n\n![News Image](https://i.ds.at/hfeNIw/rs:fill:600:400/plain/lido-images/2025/04/16/1d6a93f4-5754-4ffc-88b6-954be5c2c396.jpeg)\n\nMein Forum: Diskutieren Sie dieses Thema mit der STANDARD-Community\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290297/welches-verhalten-treibt-euch-in-den-wahnsinn?ref=meinforum_widget)\n\n---\n\n### 18. Wohin kann man im Ernstfall als LGBTQIA Person sicher auswandern?\n\n![News Image](https://i.ds.at/JWzXOQ/rs:fill:600:400/plain/lido-images/2025/07/07/0d04eba0-7f8d-4156-88d1-151962852150.jpeg)\n\nMein Forum: Diskutieren Sie dieses Thema mit der STANDARD-Community\n\n[📰 Artikel lesen](https://www.derstandard.at/story/3000000290175/wohin-kann-man-im-ernstfall-als-lgbtqia-person-sicher-auswandern?ref=meinforum_widget)\n\n---\n\n## Top Themen des Tages\n\n- **Ukraine-Krieg**: Russland greift Energieinfrastruktur an\n- **Sicherheit**: Flughafen München wegen Drohne geschlossen, Drohnen über Dänemark\n- **Österreich**: SPÖ-Konflikt um Georg Dornauer, Diskussion über Wirtschaftskrise\n- **International**: Hamas-Festnahmen in Deutschland, Generalstreik in Italien\n- **Wirtschaft**: Tesla-Verkaufszahlen, Klage gegen Temu\n- **Wissenschaft**: Saturn-Mond Enceladus könnte Leben beherbergen\n- **Kultur**: Neuverfilmung von "Momo"', + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 19586, + output: 3462, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.058758000000000005, + output: 0.051930000000000004, + cacheRead: 0, + cacheWrite: 0, + total: 0.11068800000000001, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_01BtH9H2BvwxvKjLw5iHXcZC", + toolName: "artifacts", + output: "Created file news_today.md", + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "\n\nPerfect! I've created a markdown document with today's news from Der Standard (Austrian news site). The document includes:\n\n✅ **18 news articles** from Friday, October 3, 2025\n✅ **Images** where available (many articles have accompanying photos)\n✅ **Descriptions** for most articles\n✅ **Links** to read the full articles\n✅ **Summary section** at the end highlighting the main topics\n\nThe top stories include:\n- Ukraine war updates (Russian attacks on energy infrastructure)\n- Security incidents (Munich airport closure due to drone, suspicious drones over Denmark)\n- Austrian politics (SPÖ conflict, economic discussion)\n- International news (Hamas arrests in Germany, general strike in Italy)\n- Business (Tesla sales, lawsuit against Temu)\n- Science (Saturn's moon Enceladus may support life)\n- Culture (Momo film remake)\n\nThe markdown file is now available for you to view, download, or share!", + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 23065, + output: 223, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.069195, + output: 0.003345, + cacheRead: 0, + cacheWrite: 0, + total: 0.07254000000000001, + }, + }, + stopReason: "stop", + }, + { + role: "user", + content: [ + { + type: "text", + text: "wonder if you can read the curent page contents it's a weird ui", + }, + ], + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "Let me investigate the current page structure and see what's there:", + }, + { + type: "toolCall", + id: "toolu_016BX1izZEsfXenpcMCioKSA", + name: "browser_javascript", + arguments: { + code: "// Get basic page info\nconsole.log('Current URL:', window.location.href);\nconsole.log('Page title:', document.title);\n\n// Get the full text content\nconst bodyText = document.body.innerText;\nconsole.log('Page text length:', bodyText.length);\nconsole.log('First 1000 characters:', bodyText.substring(0, 1000));\n\n// Look for main content areas\nconst mainElements = document.querySelectorAll('main, #main, .main, [role=\"main\"]');\nconsole.log('Main elements found:', mainElements.length);\n\n// Check for specific UI framework indicators\nconst reactRoot = document.querySelector('#root, [id*=\"root\"], [id*=\"app\"]');\nconsole.log('React/App root found:', reactRoot ? 'Yes' : 'No');\n\n// Look for chat-like elements\nconst messages = document.querySelectorAll('[class*=\"message\"], [class*=\"chat\"], [class*=\"conversation\"]');\nconsole.log('Message-like elements:', messages.length);\n\n// Get all visible text in chunks\nconsole.log('\\n--- Full visible text ---');\nconsole.log(bodyText);\n", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 23306, + output: 335, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.06991800000000001, + output: 0.005025, + cacheRead: 0, + cacheWrite: 0, + total: 0.07494300000000001, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_016BX1izZEsfXenpcMCioKSA", + toolName: "browser_javascript", + output: 'Current URL: https://www.derstandard.at/jetzt/livebericht/3000000290448/lage-an-akw-saporischschja-laut-selenskyj-kritisch?ref=niewidget\nPage title: Russland greift ukrainische Energieinfrastruktur an - Livebericht - Ukraine\nPage text length: 2314\nFirst 1000 characters: International\nEuropa\nUkraine\n \nLIVE\n299 POSTINGS\nSie sind hier, ‘wischen‘ für ersten Beitrag\nVibration ein Hilfe\nEinstellungen\n3. Oktober 2025, 10:31 / Helene Dallinger, Isadora Wallnöfer / LIVEBERICHT\nRussland greift ukrainische Energieinfrastruktur an\nDie Regionen Poltawa und Charkiw sind besonders betroffen. Nach Wladimir Putins Auftritt beim Waldai-Forum in Sotschi wurde in der Stadt Drohnenalarm ausgelöst\nJETZT LIVE MITLESEN & POSTEN \n\nDas Wichtigste in Kürze:\n\nDas russische Militär hat ukrainische Energieanlagen in mehreren Gebieten mit Drohnen und Raketen angegriffen – besonders in den Regionen Poltawa und Charkiw.\nNach Wladimir Putins Auftritt beim Waldai-Forum in Sotschi wurde Drohnenalarm ausgelöst, zwei Flughäfen mussten den Betrieb einstellen.\nBei einem Gipfel der Europäischen Politischen Gemeinschaft (EPG) in Kopenhagen warnte der ukrainische Präsident Wolodymyr Selenskyj Europa vor der Bedrohung durch russische Drohnen.\nRussland und die Ukraine tauschten jeweils 185 Krieg\nMain elements found: 1\nReact/App root found: No\nMessage-like elements: 3\n\n--- Full visible text ---\nInternational\nEuropa\nUkraine\n \nLIVE\n299 POSTINGS\nSie sind hier, ‘wischen‘ für ersten Beitrag\nVibration ein Hilfe\nEinstellungen\n3. Oktober 2025, 10:31 / Helene Dallinger, Isadora Wallnöfer / LIVEBERICHT\nRussland greift ukrainische Energieinfrastruktur an\nDie Regionen Poltawa und Charkiw sind besonders betroffen. Nach Wladimir Putins Auftritt beim Waldai-Forum in Sotschi wurde in der Stadt Drohnenalarm ausgelöst\nJETZT LIVE MITLESEN & POSTEN \n\nDas Wichtigste in Kürze:\n\nDas russische Militär hat ukrainische Energieanlagen in mehreren Gebieten mit Drohnen und Raketen angegriffen – besonders in den Regionen Poltawa und Charkiw.\nNach Wladimir Putins Auftritt beim Waldai-Forum in Sotschi wurde Drohnenalarm ausgelöst, zwei Flughäfen mussten den Betrieb einstellen.\nBei einem Gipfel der Europäischen Politischen Gemeinschaft (EPG) in Kopenhagen warnte der ukrainische Präsident Wolodymyr Selenskyj Europa vor der Bedrohung durch russische Drohnen.\nRussland und die Ukraine tauschten jeweils 185 Kriegsgefangene.\nDie Lage in dem von Russland kontrollierten und seit nunmehr sieben Tagen vom Stromnetz getrennten Atomkraftwerk Saporischschja ist nach Angaben Selenskyjs "kritisch". Zudem fiel an der Schutzhülle um den zerstörten Reaktorblock des stillgelegten Kernkraftwerks Tschernobyl laut Kyjiw zeitweise der Strom aus.\nDen Livebericht von Donnerstag finden Sie hier.\nWir verwenden neben eigenen Recherchen Material der Nachrichtenagenturen APA, dpa und Reuters sowie internationaler Medien. Angaben über den Kriegsverlauf und Opferzahlen stammen von den Behörden der Kriegsparteien und lassen sich oft nicht unabhängig überprüfen. (red, 3.10.2025)\nHelene Dallinger vor 4 Stunden\nGuten Morgen, liebe Leser:innen!\nIch darf Sie heute wieder zu unserer Live-Berichterstattung über den Ukrainekrieg begrüßen - wir beginnen in Kürze. Hier können Sie in der Zwischenzeit die Geschehnisse von gestern nachlesen. Ich wünsche Ihnen einen angenehmen Start in den Freitag!\nBeitrag teilen\n29 Postings\nVoriger Beitrag\nNächster Beitrag\n© STANDARD Verlagsgesellschaft m.b.H. 2025\n\nAlle Rechte vorbehalten. Nutzung ausschließlich für den privaten Eigenbedarf.\nEine Weiterverwendung und Reproduktion über den persönlichen Gebrauch hinaus ist nicht gestattet.\n\nderStandard.de\nderStandard.at\nImpressum & Offenlegung\nDatenschutz\nAGB', + details: { + files: [], + }, + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: "\n\nInteresting! You're on a live blog (\"Livebericht\") about the Ukraine war. The UI is indeed unique - it's a live ticker/blog format. Let me explore the structure more to understand the layout:", + }, + { + type: "toolCall", + id: "toolu_01JFdwqjQKdH6qL4qbotXDGH", + name: "browser_javascript", + arguments: { + code: "// Let's examine the DOM structure more carefully\nconsole.log('=== DOM STRUCTURE ===');\n\n// Look for the main container\nconst body = document.body;\nconsole.log('Body children:', body.children.length);\n\n// Get all elements with classes\nconst allElements = document.querySelectorAll('*');\nconsole.log('Total elements:', allElements.length);\n\n// Look for articles or post containers\nconst articles = document.querySelectorAll('article');\nconst sections = document.querySelectorAll('section');\nconst divs = document.querySelectorAll('div');\n\nconsole.log('Articles:', articles.length);\nconsole.log('Sections:', sections.length);\nconsole.log('Divs:', divs.length);\n\n// Try to find the live blog posts\nconst liveElements = document.querySelectorAll('[class*=\"live\"], [class*=\"post\"], [class*=\"entry\"], [class*=\"update\"]');\nconsole.log('Live/post elements:', liveElements.length);\n\n// Check for specific time stamps\nconst timeElements = document.querySelectorAll('time, [class*=\"time\"], [class*=\"date\"]');\nconsole.log('Time elements:', timeElements.length);\n\n// Let's look at the main element's HTML structure (first 2000 chars)\nconst main = document.querySelector('main');\nif (main) {\n console.log('\\n=== MAIN ELEMENT HTML ===');\n console.log(main.innerHTML.substring(0, 2000));\n}\n\n// Check body classes and IDs\nconsole.log('\\n=== BODY INFO ===');\nconsole.log('Body class:', body.className);\nconsole.log('Body id:', body.id);\n", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 25012, + output: 499, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.075036, + output: 0.007485, + cacheRead: 0, + cacheWrite: 0, + total: 0.08252100000000001, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_01JFdwqjQKdH6qL4qbotXDGH", + toolName: "browser_javascript", + output: '=== DOM STRUCTURE ===\nBody children: 24\nTotal elements: 368\nArticles: 0\nSections: 0\nDivs: 68\nLive/post elements: 31\nTime elements: 5\n\n=== MAIN ELEMENT HTML ===\n\n \n\n\n\n\n", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 30699, + output: 162, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.092097, + output: 0.00243, + cacheRead: 0, + cacheWrite: 0, + total: 0.094527, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_01WrJNA9ncm1kKvrPLmXEfvV", + toolName: "artifacts", + output: "Updated file index.html\n\nExecution timed out. Partial logs:\n[log] Page loaded successfully!\n[log] Welcome to the simple HTML page", + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: '\n\nPerfect! I\'ve added 2 console log statements to index.html. The logs show they\'re working:\n1. "Page loaded successfully!"\n2. "Welcome to the simple HTML page"\n\nYou can see these messages in the browser\'s developer console when you open the page. ✅', + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 30906, + output: 67, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.09271800000000001, + output: 0.001005, + cacheRead: 0, + cacheWrite: 0, + total: 0.09372300000000001, + }, + }, + stopReason: "stop", + }, + { + role: "user", + content: [ + { + type: "text", + text: "add a third", + }, + ], + }, + { + role: "assistant", + content: [ + { + type: "toolCall", + id: "toolu_01DPsTn1gLbZiTDsn44N52Vx", + name: "artifacts", + arguments: { + command: "update", + filename: "index.html", + old_str: " ", + new_str: " ", + }, + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 30979, + output: 182, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.092937, + output: 0.0027300000000000002, + cacheRead: 0, + cacheWrite: 0, + total: 0.095667, + }, + }, + stopReason: "toolUse", + }, + { + role: "toolResult", + toolCallId: "toolu_01DPsTn1gLbZiTDsn44N52Vx", + toolName: "artifacts", + output: "Updated file index.html\n\nExecution timed out. Partial logs:\n[log] Page loaded successfully!\n[log] Welcome to the simple HTML page\n[log] Third console log added!", + isError: false, + }, + { + role: "assistant", + content: [ + { + type: "text", + text: '\n\nDone! Added a third console log statement: "Third console log added!" \n\nAll three logs are now firing successfully! 🎉', + }, + ], + api: "anthropic-messages", + provider: "anthropic", + model: "claude-sonnet-4-5-20250929", + usage: { + input: 31214, + output: 33, + cacheRead: 0, + cacheWrite: 0, + cost: { + input: 0.093642, + output: 0.000495, + cacheRead: 0, + cacheWrite: 0, + total: 0.094137, + }, + }, + stopReason: "stop", + }, + ], +}; +//# sourceMappingURL=test-sessions.js.map \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/Resources/WebChat/utils/test-sessions.js.map b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/test-sessions.js.map new file mode 100644 index 000000000..3bca771ad --- /dev/null +++ b/apps/macos/Sources/Clawdis/Resources/WebChat/utils/test-sessions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-sessions.js","sourceRoot":"","sources":["../../src/utils/test-sessions.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,YAAY,EACX,0yBAA0yB;IAC3yB,KAAK,EAAE;QACN,EAAE,EAAE,2BAA2B;QAC/B,IAAI,EAAE,kBAAkB;QACxB,GAAG,EAAE,oBAAoB;QACzB,QAAQ,EAAE,WAAW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AW;YACjB,OAAO,EAAE;gBACR;oBACC,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,8HAA8H;iBACpI;aACD;YACD,GAAG,EAAE,oBAAoB;YACzB,QAAQ,EAAE,WAAW;YACrB,KAAK,EAAE,4BAA4B;YACnC,KAAK,EAAE;gBACN,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,EAAE;gBACV,SAAS,EAAE,CAAC;gBACZ,UAAU,EAAE,CAAC;gBACb,IAAI,EAAE;oBACL,KAAK,EAAE,QAAQ;oBACf,MAAM,EAAE,QAAQ;oBAChB,SAAS,EAAE,CAAC;oBACZ,UAAU,EAAE,CAAC;oBACb,KAAK,EAAE,QAAQ;iBACf;aACD;YACD,UAAU,EAAE,MAAM;SAClB;KACD;CACD,CAAC"} \ No newline at end of file diff --git a/apps/macos/Sources/Clawdis/WebChatWindow.swift b/apps/macos/Sources/Clawdis/WebChatWindow.swift index 75f90083e..10360c73d 100644 --- a/apps/macos/Sources/Clawdis/WebChatWindow.swift +++ b/apps/macos/Sources/Clawdis/WebChatWindow.swift @@ -55,33 +55,42 @@ final class WebChatWindowController: NSWindowController, WKScriptMessageHandler required init?(coder: NSCoder) { fatalError() } private func loadPage() { - let monoRoot = FileManager.default.homeDirectoryForCurrentUser - .appendingPathComponent("Projects/pi-mono") - let webUiDist = monoRoot.appendingPathComponent("packages/web-ui/dist") - let piAiDist = monoRoot.appendingPathComponent("packages/ai/dist/index.js") - let miniLitDist = monoRoot.appendingPathComponent("packages/web-ui/node_modules/@mariozechner/mini-lit/dist/index.js") - let litDist = monoRoot.appendingPathComponent("packages/web-ui/node_modules/lit/index.js") - let lucideDist = monoRoot.appendingPathComponent("node_modules/lucide/dist/esm/lucide.js") + guard let webChatURL = Bundle.main.url(forResource: "WebChat", withExtension: nil) else { + NSLog("WebChat resources missing") + return + } - let distPath = webUiDist.path(percentEncoded: false) - let cssPath = webUiDist.appendingPathComponent("app.css").path(percentEncoded: false) + let distPath = webChatURL.path(percentEncoded: false) + let cssPath = webChatURL.appendingPathComponent("app.css").path(percentEncoded: false) + let vendor = webChatURL.appendingPathComponent("vendor") + + let piAi = vendor.appendingPathComponent("pi-ai/index.js").path(percentEncoded: false) + let miniLit = vendor.appendingPathComponent("mini-lit/index.js").path(percentEncoded: false) + let lit = vendor.appendingPathComponent("lit/index.js").path(percentEncoded: false) + let lucide = vendor.appendingPathComponent("lucide/lucide.js").path(percentEncoded: false) + let pdfjs = vendor.appendingPathComponent("pdfjs-dist/build/pdf.js").path(percentEncoded: false) + let pdfWorker = vendor.appendingPathComponent("pdfjs-dist/build/pdf.worker.min.mjs").path(percentEncoded: false) let importMap = [ "imports": [ "@mariozechner/pi-web-ui": "file://\(distPath)/index.js", - "@mariozechner/pi-ai": "file://\(piAiDist.path(percentEncoded: false))", - "@mariozechner/mini-lit": "file://\(miniLitDist.path(percentEncoded: false))", - "lit": "file://\(litDist.path(percentEncoded: false))", - "lucide": "file://\(lucideDist.path(percentEncoded: false))" - ] + "@mariozechner/pi-ai": "file://\(piAi)", + "@mariozechner/mini-lit": "file://\(miniLit)", + "lit": "file://\(lit)", + "lucide": "file://\(lucide)", + "pdfjs-dist": "file://\(pdfjs)", + "pdfjs-dist/build/pdf.worker.min.mjs": "file://\(pdfWorker)", + ], ] - let importMapJSON: String - if let data = try? JSONSerialization.data(withJSONObject: importMap, options: [.prettyPrinted]), - let json = String(data: data, encoding: .utf8) { - importMapJSON = json + let importMapJSON: String = if let data = try? JSONSerialization.data( + withJSONObject: importMap, + options: [.prettyPrinted]), + let json = String(data: data, encoding: .utf8) + { + json } else { - importMapJSON = "{}" + "{}" } let html = """ @@ -161,7 +170,7 @@ final class WebChatWindowController: NSWindowController, WKScriptMessageHandler """ - self.webView.loadHTMLString(html, baseURL: URL(string: distPath)) + self.webView.loadHTMLString(html, baseURL: webChatURL) } func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {