clay-server 5.2.0-beta.1 → 5.2.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -4
- package/lib/account-auth-socket.js +1 -0
- package/lib/builtin-mates.js +19 -16
- package/lib/bundled-skills/clay-agent-browser/SKILL.md +6 -2
- package/lib/canonical-clay-record-authority.js +15 -0
- package/lib/canonical-clay-scheduling-authority.js +19 -0
- package/lib/claude-hook-installer.js +1 -239
- package/lib/claude-jsonl-watcher.js +1 -204
- package/lib/clay-control-presentation-binding.js +96 -0
- package/lib/clay-control-presentation.js +128 -0
- package/lib/clay-control-target-projection.js +26 -0
- package/lib/clay-mate-chat-receipts.js +26 -0
- package/lib/clay-mate-chat.js +88 -0
- package/lib/clay-mate-knowledge-input.js +26 -0
- package/lib/clay-mate-knowledge.js +95 -0
- package/lib/clay-mate-lifecycle.js +95 -0
- package/lib/clay-product-control-input.js +33 -0
- package/lib/clay-product-control-tools.js +52 -0
- package/lib/clay-product-control.js +250 -0
- package/lib/clay-project-lifecycle.js +154 -0
- package/lib/clay-project-record-input.js +44 -0
- package/lib/clay-project-records.js +84 -0
- package/lib/clay-scheduling-input.js +21 -0
- package/lib/clay-scheduling-receipts.js +26 -0
- package/lib/clay-scheduling.js +119 -0
- package/lib/clay-screen-controls.js +104 -0
- package/lib/clay-skill-install.js +1 -33
- package/lib/clay-vendor-usage.js +44 -0
- package/lib/clay-workspace-controls.js +84 -0
- package/lib/clay-workspace-input.js +17 -0
- package/lib/clay-workspace-receipts.js +26 -0
- package/lib/cli-sessions.js +1 -300
- package/lib/codex-defaults.js +1 -28
- package/lib/context-usage.js +3 -2
- package/lib/contextual-screen-snapshot.js +38 -0
- package/lib/daemon-project-access.js +11 -0
- package/lib/daemon-project-lifecycle-callbacks.js +15 -0
- package/lib/daemon-project-lifecycle.js +262 -0
- package/lib/daemon-projects.js +1 -1
- package/lib/daemon.js +78 -276
- package/lib/default-ai-runtime.js +4 -8
- package/lib/dm-digest-cursor.js +120 -0
- package/lib/email-mcp-server.js +1 -1
- package/lib/github-star-count.js +147 -0
- package/lib/issues-service.js +29 -15
- package/lib/kiro-defaults.js +1 -22
- package/lib/knowledge-db-import-validation.js +46 -0
- package/lib/knowledge-db-import.js +99 -0
- package/lib/knowledge-db-service.js +24 -33
- package/lib/knowledge-db-storage-nedb-maintenance.js +99 -0
- package/lib/knowledge-db-storage-nedb.js +66 -0
- package/lib/knowledge-db-storage.js +72 -0
- package/lib/knowledge-db-validation.js +0 -0
- package/lib/knowledge-document-index.js +2 -1
- package/lib/knowledge-file-store.js +7 -1
- package/lib/knowledge-product-operations.js +46 -0
- package/lib/mate-avatar-catalog.js +12 -0
- package/lib/mate-avatar-migration.js +41 -0
- package/lib/mate-context-service.js +138 -0
- package/lib/mate-context-tools.js +21 -0
- package/lib/mate-creation-mcp-server.js +2 -0
- package/lib/mate-knowledge-canonical-access.js +10 -0
- package/lib/mate-knowledge-mate-bound.js +53 -0
- package/lib/mate-knowledge-mcp-server.js +55 -8
- package/lib/mate-knowledge-service.js +16 -34
- package/lib/mate-knowledge-text-tools.js +106 -0
- package/lib/mate-lifecycle-service.js +94 -0
- package/lib/mate-message-delivery.js +43 -0
- package/lib/mate-ready-creation.js +9 -1
- package/lib/mate-schedule-input.js +29 -0
- package/lib/mate-schedule-lifecycle.js +151 -0
- package/lib/mate-scheduling.js +103 -0
- package/lib/mates.js +18 -6
- package/lib/mcp-agent-tools.js +117 -0
- package/lib/mcp-connection-store.js +119 -15
- package/lib/mcp-import-credentials.js +31 -0
- package/lib/mcp-local-transport.js +13 -0
- package/lib/mcp-oauth.js +8 -6
- package/lib/mcp-proxy.js +2 -32
- package/lib/mcp-query-bridge.js +30 -0
- package/lib/mcp-remote-connections.js +74 -20
- package/lib/mcp-source-adapters.js +1 -0
- package/lib/mcp-source-context.js +1 -0
- package/lib/mcp-source-discovery.js +1 -0
- package/lib/mcp-source-plugins.js +1 -0
- package/lib/mcp-source-restrictions.js +1 -0
- package/lib/mcp-tool-policy.js +9 -0
- package/lib/notes-checklist.js +92 -0
- package/lib/notes.js +51 -4
- package/lib/os-user-diagnostics.js +2 -4
- package/lib/os-users.js +24 -70
- package/lib/pane-pending-interactions.js +20 -0
- package/lib/pane-session-activation.js +114 -0
- package/lib/pane-session-transport.js +26 -0
- package/lib/project-admin-overview.js +51 -0
- package/lib/project-ask-user.js +8 -4
- package/lib/project-connection.js +14 -10
- package/lib/project-control-git-view.js +12 -0
- package/lib/project-debate.js +1 -0
- package/lib/project-delegated-follow-up.js +2 -1
- package/lib/project-directory-claim.js +65 -0
- package/lib/project-file-operations.js +61 -0
- package/lib/project-filesystem.js +15 -85
- package/lib/project-full-access.js +23 -2
- package/lib/project-http.js +7 -4
- package/lib/project-knowledge.js +32 -18
- package/lib/project-lifecycle-operations.js +98 -0
- package/lib/project-lifecycle-process-witness.js +32 -0
- package/lib/project-lifecycle-runtime.js +50 -0
- package/lib/project-linux-access.js +22 -0
- package/lib/project-logs-canonical-clay.js +27 -0
- package/lib/project-logs-clay-query.js +16 -0
- package/lib/project-logs-schema.js +4 -2
- package/lib/project-logs-service.js +8 -7
- package/lib/project-logs.js +1 -0
- package/lib/project-loop.js +1 -0
- package/lib/project-mate-chat-control.js +55 -0
- package/lib/project-mate-creation-proposal.js +18 -3
- package/lib/project-mate-interaction.js +40 -62
- package/lib/project-mcp.js +54 -16
- package/lib/project-models.js +14 -31
- package/lib/project-notifications.js +76 -17
- package/lib/project-ownership.js +77 -0
- package/lib/project-pair-result-delivery.js +14 -3
- package/lib/project-pair-usage.js +12 -13
- package/lib/project-pending-message-queue.js +4 -1
- package/lib/project-product-control.js +89 -0
- package/lib/project-product-session-queue.js +46 -0
- package/lib/project-push-access.js +28 -0
- package/lib/project-scheduled-message-queue.js +30 -0
- package/lib/project-scheduled-messages.js +67 -68
- package/lib/project-scheduled-task-control.js +83 -0
- package/lib/project-scheduled-tasks.js +13 -2
- package/lib/project-scheduling-access.js +10 -0
- package/lib/project-session-actions.js +65 -0
- package/lib/project-session-delete.js +8 -1
- package/lib/project-session-document.js +27 -7
- package/lib/project-session-github.js +63 -19
- package/lib/project-session-history-actions.js +167 -0
- package/lib/project-session-linear.js +14 -6
- package/lib/project-session-notes.js +40 -11
- package/lib/project-session-pair.js +1 -1
- package/lib/project-session-runtime-actions.js +64 -0
- package/lib/project-session-spawn.js +2 -3
- package/lib/project-session-vendor.js +55 -0
- package/lib/project-sessions.js +160 -290
- package/lib/project-shared-browser.js +78 -17
- package/lib/project-start-protocol.js +29 -0
- package/lib/project-studio-presentation.js +58 -0
- package/lib/project-user-message.js +67 -1
- package/lib/project-vendor-login.js +8 -36
- package/lib/project-workspace-operations.js +126 -0
- package/lib/project-workspace-query.js +19 -2
- package/lib/project.js +181 -45
- package/lib/public/app.js +71 -17
- package/lib/public/appearance-bootstrap.js +16 -0
- package/lib/public/css/clay-tool-activity.css +51 -0
- package/lib/public/css/clay-workspace.css +29 -0
- package/lib/public/css/command-palette.css +12 -33
- package/lib/public/css/contextual-clay.css +240 -0
- package/lib/public/css/filebrowser.css +1 -1
- package/lib/public/css/home-debate-planning.css +2 -0
- package/lib/public/css/home-mate-creation.css +5 -0
- package/lib/public/css/input.css +6 -0
- package/lib/public/css/mate-avatar-gallery.css +12 -0
- package/lib/public/css/mate-conversation.css +10 -5
- package/lib/public/css/mate-loading-scene.css +21 -0
- package/lib/public/css/messages.css +6 -2
- package/lib/public/css/overlays.css +68 -258
- package/lib/public/css/project-admin-overview.css +13 -0
- package/lib/public/css/project-mate-creation.css +5 -6
- package/lib/public/css/project-start.css +108 -0
- package/lib/public/css/projects-hub.css +53 -14
- package/lib/public/css/session-folders.css +11 -0
- package/lib/public/css/session-github.css +46 -1
- package/lib/public/css/settings-shell.css +103 -0
- package/lib/public/css/shared-browser.css +35 -1
- package/lib/public/css/sidebar.css +7 -0
- package/lib/public/css/sticky-notes.css +87 -1
- package/lib/public/css/title-bar.css +79 -0
- package/lib/public/index.html +61 -68
- package/lib/public/mate-avatars/B01.png +0 -0
- package/lib/public/mate-avatars/B02.png +0 -0
- package/lib/public/mate-avatars/B03.png +0 -0
- package/lib/public/mate-avatars/B04.png +0 -0
- package/lib/public/mate-avatars/B05.png +0 -0
- package/lib/public/mate-avatars/B06.png +0 -0
- package/lib/public/mate-avatars/B07.png +0 -0
- package/lib/public/mate-avatars/B08.png +0 -0
- package/lib/public/mate-avatars/B09.png +0 -0
- package/lib/public/mate-avatars/B10.png +0 -0
- package/lib/public/mate-avatars/B11.png +0 -0
- package/lib/public/mate-avatars/B12.png +0 -0
- package/lib/public/mate-avatars/B13.png +0 -0
- package/lib/public/mate-avatars/B14.png +0 -0
- package/lib/public/mate-avatars/B15.png +0 -0
- package/lib/public/mate-avatars/B16.png +0 -0
- package/lib/public/mate-avatars/B17.png +0 -0
- package/lib/public/mate-avatars/B18.png +0 -0
- package/lib/public/mate-avatars/B19.png +0 -0
- package/lib/public/mate-avatars/B20.png +0 -0
- package/lib/public/mate-avatars/B21.png +0 -0
- package/lib/public/mate-avatars/B22.png +0 -0
- package/lib/public/mate-avatars/B23.png +0 -0
- package/lib/public/mate-avatars/B24.png +0 -0
- package/lib/public/mate-avatars/B25.png +0 -0
- package/lib/public/mate-avatars/B26.png +0 -0
- package/lib/public/mate-avatars/B27.png +0 -0
- package/lib/public/mate-avatars/B28.png +0 -0
- package/lib/public/mate-avatars/B29.png +0 -0
- package/lib/public/mate-avatars/B30.png +0 -0
- package/lib/public/mate-avatars/B31.png +0 -0
- package/lib/public/mate-avatars/B32.png +0 -0
- package/lib/public/mate-avatars/B33.png +0 -0
- package/lib/public/mate-avatars/B34.png +0 -0
- package/lib/public/mate-avatars/B35.png +0 -0
- package/lib/public/mate-avatars/B36.png +0 -0
- package/lib/public/mate-avatars/B37.png +0 -0
- package/lib/public/mate-avatars/B38.png +0 -0
- package/lib/public/mate-avatars/B39.png +0 -0
- package/lib/public/mate-avatars/B40.png +0 -0
- package/lib/public/mate-avatars/B41.png +0 -0
- package/lib/public/mate-avatars/B42.png +0 -0
- package/lib/public/mate-avatars/B43.png +0 -0
- package/lib/public/mate-avatars/B44.png +0 -0
- package/lib/public/mate-avatars/B45.png +0 -0
- package/lib/public/mate-avatars/B46.png +0 -0
- package/lib/public/mate-avatars/B47.png +0 -0
- package/lib/public/mate-avatars/B48.png +0 -0
- package/lib/public/mate-avatars/C01.png +0 -0
- package/lib/public/mate-avatars/C02.png +0 -0
- package/lib/public/mate-avatars/C03.png +0 -0
- package/lib/public/mate-avatars/C04.png +0 -0
- package/lib/public/mate-avatars/C05.png +0 -0
- package/lib/public/mate-avatars/C06.png +0 -0
- package/lib/public/mate-avatars/C07.png +0 -0
- package/lib/public/mate-avatars/C08.png +0 -0
- package/lib/public/mate-avatars/C09.png +0 -0
- package/lib/public/mate-avatars/C10.png +0 -0
- package/lib/public/mate-avatars/C11.png +0 -0
- package/lib/public/mate-avatars/C12.png +0 -0
- package/lib/public/mate-avatars/C13.png +0 -0
- package/lib/public/mate-avatars/C14.png +0 -0
- package/lib/public/mate-avatars/C15.png +0 -0
- package/lib/public/mate-avatars/C16.png +0 -0
- package/lib/public/mate-avatars/C17.png +0 -0
- package/lib/public/mate-avatars/C18.png +0 -0
- package/lib/public/mate-avatars/C19.png +0 -0
- package/lib/public/mate-avatars/C20.png +0 -0
- package/lib/public/mate-avatars/C21.png +0 -0
- package/lib/public/mate-avatars/C22.png +0 -0
- package/lib/public/mate-avatars/C23.png +0 -0
- package/lib/public/mate-avatars/C24.png +0 -0
- package/lib/public/mate-avatars/C25.png +0 -0
- package/lib/public/mate-avatars/C26.png +0 -0
- package/lib/public/mate-avatars/C27.png +0 -0
- package/lib/public/mate-avatars/C28.png +0 -0
- package/lib/public/mate-avatars/C29.png +0 -0
- package/lib/public/mate-avatars/C30.png +0 -0
- package/lib/public/mate-avatars/C31.png +0 -0
- package/lib/public/mate-avatars/C32.png +0 -0
- package/lib/public/mate-avatars/C33.png +0 -0
- package/lib/public/mate-avatars/C34.png +0 -0
- package/lib/public/mate-avatars/C35.png +0 -0
- package/lib/public/mate-avatars/C36.png +0 -0
- package/lib/public/mate-avatars/C37.png +0 -0
- package/lib/public/mate-avatars/C38.png +0 -0
- package/lib/public/mate-avatars/C39.png +0 -0
- package/lib/public/mate-avatars/C40.png +0 -0
- package/lib/public/mate-avatars/C41.png +0 -0
- package/lib/public/mate-avatars/C42.png +0 -0
- package/lib/public/mate-avatars/C43.png +0 -0
- package/lib/public/mate-avatars/C44.png +0 -0
- package/lib/public/mate-avatars/C45.png +0 -0
- package/lib/public/mate-avatars/C46.png +0 -0
- package/lib/public/mate-avatars/C47.png +0 -0
- package/lib/public/mate-avatars/C48.png +0 -0
- package/lib/public/mate-avatars/catalog.json +482 -0
- package/lib/public/mate-avatars/lead-clay.png +0 -0
- package/lib/public/modules/admin-settings-invitations.js +2 -2
- package/lib/public/modules/admin-settings-projects.js +8 -4
- package/lib/public/modules/admin-settings-ui.js +20 -4
- package/lib/public/modules/admin-settings-users.js +4 -4
- package/lib/public/modules/app-connection.js +11 -1
- package/lib/public/modules/app-favicon.js +18 -9
- package/lib/public/modules/app-header.js +7 -4
- package/lib/public/modules/app-home-hub.js +2 -1
- package/lib/public/modules/app-loop-ui.js +2 -0
- package/lib/public/modules/app-message-router.js +22 -1
- package/lib/public/modules/app-messages.js +125 -19
- package/lib/public/modules/app-misc.js +3 -1
- package/lib/public/modules/app-notifications.js +11 -5
- package/lib/public/modules/app-panels.js +61 -123
- package/lib/public/modules/app-projects.js +14 -407
- package/lib/public/modules/app-rate-limit.js +19 -28
- package/lib/public/modules/app-rendering.js +4 -3
- package/lib/public/modules/avatar.js +15 -41
- package/lib/public/modules/chat-render-runtime.js +20 -0
- package/lib/public/modules/clay-browser-links.js +47 -0
- package/lib/public/modules/clay-control-activity.js +214 -0
- package/lib/public/modules/clay-control-copy.js +36 -0
- package/lib/public/modules/clay-control-detail-targets.js +44 -0
- package/lib/public/modules/clay-control-object-targets.js +52 -0
- package/lib/public/modules/clay-control-target-visibility.js +12 -0
- package/lib/public/modules/clay-control-targets.js +44 -0
- package/lib/public/modules/clay-log-links.js +23 -0
- package/lib/public/modules/clay-navigation-render.js +52 -0
- package/lib/public/modules/clay-owner-navigation.js +33 -0
- package/lib/public/modules/clay-session-links.js +31 -0
- package/lib/public/modules/clay-studio-bridge.js +20 -0
- package/lib/public/modules/clay-studio-document.js +67 -0
- package/lib/public/modules/clay-studio-render.js +146 -0
- package/lib/public/modules/clay-tool-activity.js +140 -0
- package/lib/public/modules/clay-tool-presentation.js +343 -0
- package/lib/public/modules/command-palette.js +162 -40
- package/lib/public/modules/contextual-ask-session.js +26 -0
- package/lib/public/modules/contextual-clay-geometry.js +155 -0
- package/lib/public/modules/contextual-clay-session.js +130 -0
- package/lib/public/modules/contextual-clay-workspace.js +169 -0
- package/lib/public/modules/contextual-clay.js +252 -0
- package/lib/public/modules/contextual-composer.js +91 -0
- package/lib/public/modules/contextual-mate-context.js +117 -0
- package/lib/public/modules/contextual-mate-hint.js +40 -0
- package/lib/public/modules/contextual-mate-identity.js +23 -0
- package/lib/public/modules/contextual-mate-sessions.js +134 -0
- package/lib/public/modules/contextual-search.js +137 -0
- package/lib/public/modules/contextual-session-citations.js +58 -0
- package/lib/public/modules/debate.js +1 -0
- package/lib/public/modules/default-ai.js +11 -3
- package/lib/public/modules/elicitation-form.js +5 -0
- package/lib/public/modules/filebrowser.js +20 -1
- package/lib/public/modules/generation-stop.js +8 -5
- package/lib/public/modules/git-panel.js +3 -1
- package/lib/public/modules/github-star.js +66 -0
- package/lib/public/modules/history-replay-batch.js +13 -1
- package/lib/public/modules/home-debate-live.js +2 -0
- package/lib/public/modules/home-debate-planning.js +7 -7
- package/lib/public/modules/home-mate-avatar-editor.js +127 -208
- package/lib/public/modules/home-mate-chat.js +8 -6
- package/lib/public/modules/home-mate-creation.js +73 -1
- package/lib/public/modules/home-mate-settings.js +19 -12
- package/lib/public/modules/icon-strip-tooltip.js +2 -1
- package/lib/public/modules/input.js +88 -10
- package/lib/public/modules/issues-render.js +3 -2
- package/lib/public/modules/knowledge-db-workbench.js +4 -4
- package/lib/public/modules/markdown.js +6 -34
- package/lib/public/modules/mate-avatar-catalog.js +97 -0
- package/lib/public/modules/mate-knowledge-workbench.js +1 -1
- package/lib/public/modules/mate-loading-scene.js +17 -0
- package/lib/public/modules/mate-management.js +40 -7
- package/lib/public/modules/mcp-connection-view.js +31 -13
- package/lib/public/modules/mcp-discovery-view.js +31 -0
- package/lib/public/modules/mcp-ui.js +23 -4
- package/lib/public/modules/mention.js +3 -0
- package/lib/public/modules/message-delivery.js +20 -2
- package/lib/public/modules/model-picker.js +2 -0
- package/lib/public/modules/pane-activation.js +214 -0
- package/lib/public/modules/pane-binding.js +82 -0
- package/lib/public/modules/pane-bridge.js +7 -4
- package/lib/public/modules/pane-browser-bridge.js +22 -0
- package/lib/public/modules/pane-file-bridge.js +4 -0
- package/lib/public/modules/pane-issue-bridge.js +4 -1
- package/lib/public/modules/pending-message-queue.js +1 -0
- package/lib/public/modules/permission-control.js +5 -4
- package/lib/public/modules/personal-settings-dialog.js +7 -1
- package/lib/public/modules/product-review.js +26 -0
- package/lib/public/modules/profile.js +12 -241
- package/lib/public/modules/project-access-recovery.js +17 -0
- package/lib/public/modules/project-admin-overview.js +21 -0
- package/lib/public/modules/project-chat-identity.js +13 -4
- package/lib/public/modules/project-logs-render.js +3 -0
- package/lib/public/modules/project-mate-creation-workspace.js +13 -4
- package/lib/public/modules/project-mate-navigation.js +144 -22
- package/lib/public/modules/project-session-visibility-settings.js +19 -16
- package/lib/public/modules/project-settings.js +119 -129
- package/lib/public/modules/project-start-dialog.js +130 -0
- package/lib/public/modules/project-start-folder-state.js +78 -0
- package/lib/public/modules/project-start-folder-view.js +190 -0
- package/lib/public/modules/project-start-forms.js +66 -0
- package/lib/public/modules/project-start-path.js +60 -0
- package/lib/public/modules/project-start-state.js +54 -0
- package/lib/public/modules/project-start-submit.js +67 -0
- package/lib/public/modules/projects-hub-view.js +33 -14
- package/lib/public/modules/projects-hub.js +10 -6
- package/lib/public/modules/rewind.js +5 -0
- package/lib/public/modules/scheduled-tasks.js +2 -0
- package/lib/public/modules/scheduler.js +2 -0
- package/lib/public/modules/search-clay-chat.js +5 -440
- package/lib/public/modules/server-settings.js +36 -91
- package/lib/public/modules/session-actions.js +5 -2
- package/lib/public/modules/session-context-menu.js +5 -0
- package/lib/public/modules/session-create-form.js +10 -10
- package/lib/public/modules/session-folder-layout.js +1 -1
- package/lib/public/modules/session-folder-view-menu.js +9 -0
- package/lib/public/modules/session-github.js +85 -14
- package/lib/public/modules/session-rich-drafts.js +21 -0
- package/lib/public/modules/session-switch-defer.js +67 -0
- package/lib/public/modules/session-work-primary.js +51 -0
- package/lib/public/modules/settings-defaults.js +27 -28
- package/lib/public/modules/settings-project-target.js +56 -0
- package/lib/public/modules/settings-select.js +1 -1
- package/lib/public/modules/settings-shell-registry.js +88 -0
- package/lib/public/modules/settings-shell-view.js +104 -0
- package/lib/public/modules/settings-shell.js +342 -0
- package/lib/public/modules/shared-browser-settings.js +112 -0
- package/lib/public/modules/shared-browser-tabs.js +13 -3
- package/lib/public/modules/shared-browser.js +29 -6
- package/lib/public/modules/sidebar-mobile.js +12 -33
- package/lib/public/modules/sidebar-projects.js +3 -1
- package/lib/public/modules/sidebar-session-folders-ui.js +1 -1
- package/lib/public/modules/sidebar-sessions.js +1 -0
- package/lib/public/modules/split-group-restore.js +68 -0
- package/lib/public/modules/split-pair-ui.js +1 -0
- package/lib/public/modules/split-pane-reconciler.js +15 -0
- package/lib/public/modules/split-pane-renderer.js +87 -6
- package/lib/public/modules/split-session-boundary.js +1 -1
- package/lib/public/modules/split-view.js +60 -68
- package/lib/public/modules/sticky-note-markdown.js +72 -6
- package/lib/public/modules/sticky-notes-actions.js +30 -0
- package/lib/public/modules/sticky-notes-browser.js +9 -2
- package/lib/public/modules/sticky-notes-card.js +23 -7
- package/lib/public/modules/sticky-notes-checklist.js +116 -0
- package/lib/public/modules/sticky-notes-editor.js +108 -44
- package/lib/public/modules/sticky-notes-shared.js +50 -2
- package/lib/public/modules/sticky-notes-state.js +66 -0
- package/lib/public/modules/sticky-notes.js +34 -51
- package/lib/public/modules/stt-controller.js +4 -1
- package/lib/public/modules/stt-recording.js +1 -1
- package/lib/public/modules/stt.js +7 -2
- package/lib/public/modules/terminal.js +9 -0
- package/lib/public/modules/theme.js +18 -3
- package/lib/public/modules/thinking-lifecycle.js +33 -3
- package/lib/public/modules/thinking-view.js +23 -1
- package/lib/public/modules/tools.js +60 -11
- package/lib/public/modules/tui-grab.js +1 -2
- package/lib/public/modules/user-settings-appearance.js +10 -3
- package/lib/public/modules/user-settings-editors.js +1 -1
- package/lib/public/modules/user-settings-layout.js +14 -30
- package/lib/public/modules/user-settings-preferences.js +6 -2
- package/lib/public/modules/user-settings-profile.js +13 -3
- package/lib/public/modules/user-settings.js +18 -84
- package/lib/public/modules/vendor-login-browser.js +5 -3
- package/lib/public/modules/vendor-login.js +2 -2
- package/lib/public/modules/vendor-priority.js +15 -1
- package/lib/public/modules/vendor-usage-format.js +93 -0
- package/lib/public/modules/vendor-usage-list.js +45 -0
- package/lib/public/modules/vendor-usage-model.js +215 -0
- package/lib/public/modules/vendor-usage-overview.js +312 -0
- package/lib/public/modules/wireframe-workbench.js +5 -2
- package/lib/public/muse-avatar.svg +4 -0
- package/lib/public/style.css +14 -6
- package/lib/public/sw.js +3 -1
- package/lib/public/welcome-art/conversation-desk.png +0 -0
- package/lib/public/welcome-art/mate-clay.png +0 -0
- package/lib/public/welcome-art/project-clay.png +0 -0
- package/lib/safe-bash-commands.js +3 -45
- package/lib/scheduled-task-records.js +3 -1
- package/lib/scheduler.js +2 -0
- package/lib/sdk-bridge.js +348 -402
- package/lib/sdk-foreground-admission.js +16 -0
- package/lib/sdk-mcp-descriptors.js +2 -37
- package/lib/sdk-message-processor.js +61 -18
- package/lib/sdk-quota-snapshot.js +21 -3
- package/lib/sdk-response-recovery.js +1 -0
- package/lib/sdk-worker.js +2 -677
- package/lib/server-admin.js +63 -16
- package/lib/server-appearance-settings.js +13 -1
- package/lib/server-contextual-clay-settings.js +40 -0
- package/lib/server-contextual-mate-sessions.js +70 -0
- package/lib/server-dm.js +2 -1
- package/lib/server-github-stars.js +39 -0
- package/lib/server-global-ws.js +26 -32
- package/lib/server-home-chat-events.js +18 -4
- package/lib/server-home-chat.js +22 -20
- package/lib/server-home-clay-entry.js +23 -4
- package/lib/server-home-clay-session-links.js +29 -9
- package/lib/server-home-mate-creation.js +1 -0
- package/lib/server-home-mcp-consent.js +14 -0
- package/lib/server-mates.js +25 -62
- package/lib/server-owner-ui.js +118 -0
- package/lib/server-path-access.js +38 -0
- package/lib/server-project-removal.js +22 -0
- package/lib/server-settings.js +6 -1
- package/lib/server.js +167 -43
- package/lib/session-config-transition.js +45 -0
- package/lib/session-folders.js +7 -2
- package/lib/session-fork-history.js +21 -0
- package/lib/session-github.js +9 -2
- package/lib/session-hygiene.js +3 -35
- package/lib/session-notes-mcp-server.js +26 -4
- package/lib/session-notes-writes.js +88 -0
- package/lib/session-permission-mode.js +4 -3
- package/lib/session-skill-scope.js +11 -0
- package/lib/session-visibility.js +25 -10
- package/lib/session-work-primary.js +50 -0
- package/lib/sessions.js +66 -99
- package/lib/shared-browser-cookie-sync.js +32 -0
- package/lib/shared-browser-cookies.js +79 -0
- package/lib/shared-browser-runtime.js +25 -9
- package/lib/shared-browser-storage-sync.js +43 -0
- package/lib/shared-browser-storage.js +101 -0
- package/lib/shared-browser-tools.js +2 -1
- package/lib/shared-browser-worker.js +46 -10
- package/lib/terminal-manager.js +65 -6
- package/lib/tool-llm.js +1 -1
- package/lib/tui-transcript-index.js +1 -132
- package/lib/users-contextual-clay-preferences.js +31 -0
- package/lib/users-permissions.js +2 -8
- package/lib/users.js +7 -0
- package/lib/vendor-login-browser.js +1 -11
- package/lib/vendor-usage-acp-readers.js +97 -0
- package/lib/vendor-usage-capabilities.js +88 -0
- package/lib/vendor-usage-http-readers.js +214 -0
- package/lib/vendor-usage-metrics.js +47 -0
- package/lib/vendor-usage-native-readers.js +106 -0
- package/lib/vendor-usage-overview.js +406 -0
- package/lib/vendor-usage-service.js +281 -0
- package/lib/workspace-assignment-service.js +25 -0
- package/lib/workspace-query-access.js +4 -1
- package/lib/workspace-query-mcp-server.js +1 -1
- package/lib/workspace-query-service.js +13 -2
- package/lib/ws-request.js +1 -0
- package/lib/ws-schema.js +22 -4
- package/lib/yoke/acp-agent-profiles.js +7 -5
- package/lib/yoke/adapters/antigravity.js +3 -14
- package/lib/yoke/adapters/claude-query-contract.js +9 -0
- package/lib/yoke/adapters/claude.js +66 -50
- package/lib/yoke/adapters/codex-query-contract.js +25 -0
- package/lib/yoke/adapters/codex.js +98 -123
- package/lib/yoke/adapters/kiro.js +3 -1
- package/lib/yoke/adapters/muse-query-contract.js +7 -0
- package/lib/yoke/adapters/muse.js +122 -0
- package/lib/yoke/auth-events.js +17 -0
- package/lib/yoke/claude-hook-installer.js +272 -0
- package/lib/yoke/claude-jsonl-watcher.js +204 -0
- package/lib/yoke/claude-maintenance.js +55 -0
- package/lib/yoke/claude-permission-patterns.js +53 -0
- package/lib/yoke/claude-response-recovery.js +155 -0
- package/lib/yoke/claude-transcript-hygiene.js +34 -0
- package/lib/yoke/claude-worker-startup.js +28 -0
- package/lib/yoke/clay-skill-install.js +33 -0
- package/lib/yoke/cli-sessions.js +300 -0
- package/lib/yoke/codex-app-server.js +7 -12
- package/lib/yoke/codex-dynamic-tool-names.js +80 -0
- package/lib/yoke/codex-idle-recovery.js +81 -1
- package/lib/yoke/codex-model-catalog.js +37 -3
- package/lib/yoke/codex-recovery-admission.js +164 -0
- package/lib/yoke/configuration.js +13 -0
- package/lib/yoke/discovery.js +70 -0
- package/lib/yoke/errors.js +8 -0
- package/lib/yoke/host-environment.js +7 -0
- package/lib/yoke/index.js +9 -51
- package/lib/yoke/interface.js +116 -0
- package/lib/yoke/kiro-acp-server.js +5 -5
- package/lib/yoke/legacy-sessions.js +89 -0
- package/lib/yoke/login-protocol.js +25 -0
- package/lib/yoke/maintenance.js +12 -0
- package/lib/yoke/mcp-proxy.js +32 -0
- package/lib/yoke/mcp-source-adapters.js +91 -0
- package/lib/yoke/mcp-source-context.js +42 -0
- package/lib/yoke/mcp-source-discovery.js +169 -0
- package/lib/yoke/mcp-source-plugins.js +68 -0
- package/lib/yoke/mcp-source-restrictions.js +47 -0
- package/lib/yoke/mcp-tool-policy-normalize.js +28 -0
- package/lib/yoke/model-preferences.js +6 -0
- package/lib/yoke/muse-artifacts.js +36 -0
- package/lib/yoke/muse-controls.js +50 -0
- package/lib/yoke/muse-input.js +64 -0
- package/lib/yoke/muse-items.js +157 -0
- package/lib/yoke/muse-policy.js +52 -0
- package/lib/yoke/muse-query.js +428 -0
- package/lib/yoke/muse-runtime.js +211 -0
- package/lib/yoke/muse-services.js +92 -0
- package/lib/yoke/muse-skills.js +79 -0
- package/lib/yoke/muse-turns.js +71 -0
- package/lib/yoke/options/acp.js +2 -0
- package/lib/yoke/options/antigravity.js +2 -0
- package/lib/yoke/options/claude.js +21 -0
- package/lib/yoke/options/codex-defaults.js +29 -0
- package/lib/yoke/options/codex-settings.js +21 -0
- package/lib/yoke/options/codex.js +6 -0
- package/lib/yoke/options/kiro-defaults.js +22 -0
- package/lib/yoke/options/kiro.js +5 -0
- package/lib/yoke/options/muse.js +5 -0
- package/lib/yoke/provider-contract.js +5 -0
- package/lib/yoke/providers/antigravity-executable.js +8 -0
- package/lib/yoke/providers/claude-executable.js +40 -0
- package/lib/yoke/providers/claude-model-descriptions.js +34 -0
- package/lib/yoke/providers/claude-process.js +97 -0
- package/lib/yoke/providers/claude-provision.js +75 -0
- package/lib/yoke/providers/codex-errors.js +8 -0
- package/lib/yoke/providers/muse-executable.js +17 -0
- package/lib/yoke/provisioning.js +6 -0
- package/lib/yoke/query-options.js +10 -0
- package/lib/yoke/response-recovery.js +41 -0
- package/lib/yoke/sdk-mcp-descriptors.js +37 -0
- package/lib/yoke/sdk-server-factory.js +7 -0
- package/lib/yoke/session-history.js +8 -0
- package/lib/yoke/session-tool-transport.js +34 -13
- package/lib/yoke/settings.js +23 -0
- package/lib/yoke/source-locations.js +4 -0
- package/lib/yoke/title-query.js +18 -7
- package/lib/yoke/tui-transcript-index.js +132 -0
- package/lib/yoke/usage.js +48 -0
- package/lib/yoke/user-input.js +13 -0
- package/lib/yoke/vendor-registry.js +87 -3
- package/package.json +11 -4
- package/lib/public/modules/server-settings-navigation.js +0 -39
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { observeNavigationRendering } from './clay-navigation-render.js';
|
|
2
|
+
import { showClayNavigationActivity, clearClayControlActivity } from './clay-control-activity.js';
|
|
3
|
+
import { store } from './store.js';
|
|
4
|
+
import { getWs } from './ws-ref.js';
|
|
5
|
+
import { navigateToSession } from './command-palette.js';
|
|
6
|
+
function context() {
|
|
7
|
+
return JSON.stringify([store.get('currentSlug'), store.get('activeSessionId'), store.get('dmMode'), store.get('homeShellVisible'), store.get('homeChatMateId'), store.get('homeChatSessionId'), store.get('homeSubSurface'), (store.get('contextualClay') || {}).mode]);
|
|
8
|
+
}
|
|
9
|
+
export function handleOwnerNavigation(msg) {
|
|
10
|
+
if (msg.type !== 'clay_navigation_offer' && msg.type !== 'clay_navigation_apply') return false;
|
|
11
|
+
var ws = getWs();
|
|
12
|
+
if (!ws || ws.readyState !== 1) return true;
|
|
13
|
+
if (msg.type === 'clay_navigation_offer') {
|
|
14
|
+
if (document.hidden || store.get('paneMode')) return true;
|
|
15
|
+
store.set({ clayNavigationOffer: { id: msg.deliveryId, context: context(), socket: ws } });
|
|
16
|
+
ws.send(JSON.stringify({ type: 'clay_navigation_claim', deliveryId: msg.deliveryId }));
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
var offer = store.get('clayNavigationOffer');
|
|
20
|
+
store.set({ clayNavigationOffer: null });
|
|
21
|
+
var accepted = offer && offer.id === msg.deliveryId && offer.socket === ws && offer.context === context() && !document.hidden && !store.get('paneMode');
|
|
22
|
+
var status = 'refused';
|
|
23
|
+
if (accepted && msg.target && typeof msg.target.projectSlug === 'string' && Number.isSafeInteger(msg.target.sessionId)) {
|
|
24
|
+
try {
|
|
25
|
+
showClayNavigationActivity(msg.target, false); navigateToSession(msg.target, null, msg.target.entryIndex); status = 'accepted';
|
|
26
|
+
} catch (error) { showClayNavigationActivity(msg.target, true); status = 'failed'; }
|
|
27
|
+
}
|
|
28
|
+
if (status === 'refused') clearClayControlActivity();
|
|
29
|
+
// This acknowledges navigator invocation only. Rendering may finish after reconnect.
|
|
30
|
+
if (ws.readyState === 1) ws.send(JSON.stringify({ type: 'clay_navigation_ack', deliveryId: msg.deliveryId, status: status }));
|
|
31
|
+
if (status === 'accepted') observeNavigationRendering(msg, ws);
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { parseClaySessionReference, renderClaySessionLink } from './clay-log-links.js';
|
|
2
|
+
|
|
3
|
+
// The prefix is a display compatibility label, never a navigation target.
|
|
4
|
+
var citationPattern = /\[([A-Za-z0-9][A-Za-z0-9_-]{0,79})\/(session:[A-Za-z0-9_-]{24}(?:#entry-[0-9]+)?)(?:\s+[\u2014-]\s+([^\]\n]{1,80}))?\]/g;
|
|
5
|
+
function matches(text) {
|
|
6
|
+
var pattern = new RegExp(citationPattern.source, 'g'), results = [], match;
|
|
7
|
+
while ((match = pattern.exec(text))) if (parseClaySessionReference(match[2])) results.push({ start: match.index, end: pattern.lastIndex, prefix: match[1], ref: match[2], label: match[3] || '' });
|
|
8
|
+
return results;
|
|
9
|
+
}
|
|
10
|
+
function button(match) {
|
|
11
|
+
var template = document.createElement('template');
|
|
12
|
+
template.innerHTML = renderClaySessionLink(match.ref, match.label);
|
|
13
|
+
return template.content.firstElementChild;
|
|
14
|
+
}
|
|
15
|
+
export function enhanceSessionCitations(root) {
|
|
16
|
+
// Historical assistants sometimes wrapped a whole project-labelled citation
|
|
17
|
+
// in inline code. Only that complete legacy token is a compatibility citation.
|
|
18
|
+
// Canonical code samples, mixed inline code and all fenced code stay literal.
|
|
19
|
+
if (root.closest('.msg-assistant')) root.querySelectorAll('code').forEach(function (code) {
|
|
20
|
+
if (code.closest('pre, a, button')) return;
|
|
21
|
+
var text = code.textContent || '', found = matches(text);
|
|
22
|
+
if (found.length === 1 && found[0].prefix !== 'clayos' && found[0].start === 0 && found[0].end === text.length) code.replaceWith(button(found[0]));
|
|
23
|
+
});
|
|
24
|
+
var walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT), nodes = [], node;
|
|
25
|
+
while ((node = walker.nextNode())) if (node.parentElement && !node.parentElement.closest('code, pre, a, button') && matches(node.nodeValue || '').length) nodes.push(node);
|
|
26
|
+
nodes.forEach(function (node) {
|
|
27
|
+
var text = node.nodeValue || '', fragment = document.createDocumentFragment(), offset = 0;
|
|
28
|
+
matches(text).forEach(function (match) { fragment.appendChild(document.createTextNode(text.slice(offset, match.start))); fragment.appendChild(button(match)); offset = match.end; });
|
|
29
|
+
fragment.appendChild(document.createTextNode(text.slice(offset))); node.replaceWith(fragment);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { adoptDocumentSource, presentedDocument, initDocumentSource } from './clay-studio-document.js';
|
|
2
|
+
import { acceptStudioForward, trustedStudioFrame, initStudioReceipts } from './clay-studio-render.js';
|
|
3
|
+
import { presentMarkdownEdit, handleFileChanged } from './filebrowser.js';
|
|
4
|
+
import { openWireframe } from './wireframe-workbench.js';
|
|
5
|
+
|
|
6
|
+
export function initStudioBridge() {
|
|
7
|
+
initStudioReceipts(); initDocumentSource();
|
|
8
|
+
window.addEventListener('message', function (event) {
|
|
9
|
+
var data = event.data;
|
|
10
|
+
if (event.origin === location.origin && data && data.type === 'clay-studio-document-update' && data.message) {
|
|
11
|
+
var view = presentedDocument(data.message.path);
|
|
12
|
+
if (view && view.source === event.source && view.descriptor.token === data.token) handleFileChanged(data.message, view);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (!data || ['clay-pane-present-markdown', 'clay-pane-present-wireframe'].indexOf(data.type) < 0 || !data.message || !data.message.controlPresentation) return;
|
|
16
|
+
if (!trustedStudioFrame(event, data) || !acceptStudioForward(event, data)) return;
|
|
17
|
+
if (data.type === 'clay-pane-present-markdown') { adoptDocumentSource(event, data, trustedStudioFrame(event, data)); presentMarkdownEdit(data.message); }
|
|
18
|
+
else openWireframe(data.message);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { showToast } from './utils.js';
|
|
2
|
+
import { store } from './store.js';
|
|
3
|
+
import { getWs } from './ws-ref.js';
|
|
4
|
+
|
|
5
|
+
function live(view) { var state = store.snap(); return view && state.connected && view.socket === getWs() && view.ownerId === (state.myUserId || null) && view.slug === state.currentSlug && view.sessionId === state.activeSessionId && view.origin === state.sessionOriginId && view.runtime === state.controlRuntimeId; }
|
|
6
|
+
export function forwardDocumentSource(message) {
|
|
7
|
+
var old = store.get('studioDocumentSource');
|
|
8
|
+
if (old) clearTimeout(old.timer);
|
|
9
|
+
if (old && live(old)) old.socket.send(JSON.stringify({ type: 'fs_unwatch' }));
|
|
10
|
+
var state = store.snap(), view = { token: crypto.randomUUID(), socket: getWs(), ownerId: state.myUserId || null, slug: state.currentSlug, sessionId: state.activeSessionId, origin: state.sessionOriginId, runtime: state.controlRuntimeId, path: message.path, expires: Date.now() + 300000 };
|
|
11
|
+
view.timer = setTimeout(function () { if (store.get('studioDocumentSource') === view) { if (live(view)) view.socket.send(JSON.stringify({ type: 'fs_unwatch' })); store.set({ studioDocumentSource: null }); } }, 300000);
|
|
12
|
+
store.set({ studioDocumentSource: view });
|
|
13
|
+
if (live(view)) view.socket.send(JSON.stringify({ type: 'fs_watch', path: view.path }));
|
|
14
|
+
return Object.assign({}, message, { studioDocument: { token: view.token, sourceSlug: view.slug, sourceSessionId: view.sessionId, sourceOrigin: view.origin, runtimeId: view.runtime, expires: view.expires, path: view.path } });
|
|
15
|
+
}
|
|
16
|
+
export function adoptDocumentSource(event, data, frame) {
|
|
17
|
+
var document = data.message && data.message.studioDocument;
|
|
18
|
+
if (!frame || !document || document.path !== data.message.path || document.sourceSlug !== data.studioSource.slug || document.sourceSessionId !== data.studioSource.sessionId || document.sourceOrigin !== data.studioSource.origin || document.runtimeId !== data.studioSource.runtime) return;
|
|
19
|
+
closePresentedDocument();
|
|
20
|
+
var socket = getWs(); if (socket && socket.readyState === 1) socket.send(JSON.stringify({ type: 'fs_unwatch' }));
|
|
21
|
+
store.set({ fileReadRequest: null, pendingFileNavigation: null });
|
|
22
|
+
var view = { descriptor: document, frame: frame, document: frame.contentDocument, source: event.source, owner: store.get('myUserId'), context: store.get('currentSlug') };
|
|
23
|
+
view.timer = setTimeout(function () { if (store.get('studioDocumentView') === view) store.set({ studioDocumentView: { descriptor: view.descriptor, invalidated: true } }); }, Math.max(0, document.expires - Date.now()));
|
|
24
|
+
store.set({ studioDocumentView: view });
|
|
25
|
+
}
|
|
26
|
+
export function presentedDocument(path) {
|
|
27
|
+
var view = store.get('studioDocumentView');
|
|
28
|
+
if (!view || view.invalidated || !view.frame || Date.now() > view.descriptor.expires || view.descriptor.path !== path) return null;
|
|
29
|
+
var bridge = view.frame.clayStudioSource, identity = bridge && bridge.document === view.frame.contentDocument && bridge.window === view.source && bridge.identity();
|
|
30
|
+
return identity && identity.connected && identity.ownerId === view.owner && identity.slug === view.descriptor.sourceSlug && identity.sessionId === view.descriptor.sourceSessionId && identity.origin === view.descriptor.sourceOrigin && identity.runtime === view.descriptor.runtimeId && view.document === view.frame.contentDocument && view.source === view.frame.contentWindow && view.owner === store.get('myUserId') && view.context === store.get('currentSlug') ? view : null;
|
|
31
|
+
}
|
|
32
|
+
export function refreshPresentedDocument(path) {
|
|
33
|
+
var stored = store.get('studioDocumentView');
|
|
34
|
+
if (!stored || stored.descriptor.path !== path) return false;
|
|
35
|
+
var view = presentedDocument(path);
|
|
36
|
+
if (!view) { showToast('The source connection changed. Reopen this document from its conversation.'); return true; }
|
|
37
|
+
view.source.postMessage({ type: 'clay-studio-document-refresh', token: view.descriptor.token }, location.origin);
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
export function closePresentedDocument() {
|
|
41
|
+
var view = store.get('studioDocumentView');
|
|
42
|
+
if (view) clearTimeout(view.timer);
|
|
43
|
+
if (view && view.frame && view.source === view.frame.contentWindow && view.document === view.frame.contentDocument) view.source.postMessage({ type: 'clay-studio-document-close', token: view.descriptor.token }, location.origin);
|
|
44
|
+
store.set({ studioDocumentView: null });
|
|
45
|
+
}
|
|
46
|
+
export function handleStudioDocumentMessage(message) {
|
|
47
|
+
var view = store.get('studioDocumentSource');
|
|
48
|
+
if (!live(view) || Date.now() > view.expires || message.path !== view.path) return false;
|
|
49
|
+
if (message.type !== 'fs_file_changed' && !(message.type === 'fs_read_result' && message.requestId === view.requestId)) return false;
|
|
50
|
+
window.parent.postMessage({ type: 'clay-studio-document-update', token: view.token, message: message }, location.origin);
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
export function initDocumentSource() {
|
|
54
|
+
window.addEventListener('message', function (event) {
|
|
55
|
+
var data = event.data, view = store.get('studioDocumentSource');
|
|
56
|
+
if (event.origin !== location.origin || event.source !== window.parent || !data || !view || data.token !== view.token || !live(view)) return;
|
|
57
|
+
if (data.type === 'clay-studio-document-close') { clearTimeout(view.timer); view.socket.send(JSON.stringify({ type: 'fs_unwatch' })); store.set({ studioDocumentSource: null }); }
|
|
58
|
+
if (data.type === 'clay-studio-document-refresh' && Date.now() <= view.expires) {
|
|
59
|
+
view.requestId = 'studio-document-' + crypto.randomUUID();
|
|
60
|
+
view.socket.send(JSON.stringify({ type: 'fs_read', path: view.path, requestId: view.requestId, projectSlug: view.slug, sessionId: String(view.sessionId), accountId: view.ownerId }));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
function stop() { var view = store.get('studioDocumentSource'); if (view) clearTimeout(view.timer); if (live(view)) view.socket.send(JSON.stringify({ type: 'fs_unwatch' })); store.set({ studioDocumentSource: null }); var presented = store.get('studioDocumentView'); closePresentedDocument(); if (presented) store.set({ studioDocumentView: { descriptor: presented.descriptor, invalidated: true } }); }
|
|
64
|
+
store.subscribe(function (state, old) { if (!state.connected && old.connected || state.currentSlug !== old.currentSlug || state.activeSessionId !== old.activeSessionId || state.myUserId !== old.myUserId) stop(); });
|
|
65
|
+
document.addEventListener('contextual-ask-stopped', stop, true);
|
|
66
|
+
document.addEventListener('click', function (event) { if (event.target.closest('#generation-stop, #autonomous-run-stop, #send-btn.stop')) stop(); }, true);
|
|
67
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { forwardDocumentSource } from './clay-studio-document.js';
|
|
2
|
+
import { store } from './store.js';
|
|
3
|
+
import { paneMessageBinding, livePaneBinding } from './pane-binding.js';
|
|
4
|
+
import { getWs } from './ws-ref.js';
|
|
5
|
+
import { contextualMateStamp } from './contextual-mate-identity.js';
|
|
6
|
+
import { visibleTarget } from './clay-control-target-visibility.js';
|
|
7
|
+
|
|
8
|
+
function validEvidence(evidence) {
|
|
9
|
+
var uuid = /^[a-f0-9-]{36}$/;
|
|
10
|
+
return evidence && evidence.version === 1 && uuid.test(evidence.id) && uuid.test(evidence.token) && /^activity:[a-f0-9-]{36}$/.test(evidence.activityId) && Number.isSafeInteger(evidence.deadline) &&
|
|
11
|
+
evidence.target && ['document', 'sketch', 'browser'].indexOf(evidence.target.surface) >= 0 && typeof evidence.target.key === 'string' && evidence.target.key.length <= 400 && /^[a-f0-9]{64}$/.test(evidence.target.revision);
|
|
12
|
+
}
|
|
13
|
+
function source(evidence, state) {
|
|
14
|
+
return validEvidence(evidence) && evidence.mateId === state.activeProjectMateId && evidence.sourceSlug === 'mate-' + evidence.mateId && evidence.ownerId === (state.myUserId || null) && evidence.runtimeId === state.controlRuntimeId && evidence.sourceSlug === state.currentSlug && evidence.sourceSessionId === state.activeSessionId && evidence.sourceSessionOriginId === state.sessionOriginId &&
|
|
15
|
+
(state.cachedMatesList || []).some(function (mate) { return mate.id === evidence.mateId && mate.builtinKey === 'clay' && !mate.archived && !mate.lifecycleDeletion && contextualMateStamp(mate) === evidence.sourceMateStamp; });
|
|
16
|
+
}
|
|
17
|
+
function currentActivity(evidence) {
|
|
18
|
+
var activity = store.get('clayControlActivity'), forwarded = store.get('clayControlForwarded');
|
|
19
|
+
var message = store.get('paneMode') ? forwarded : activity && activity.message;
|
|
20
|
+
return message && message.id === evidence.activityId && message.mateId === evidence.mateId && message.sourceSlug === evidence.sourceSlug && message.sourceSessionId === evidence.sourceSessionId && message.sourceSessionOriginId === evidence.sourceSessionOriginId && message.sourceMateStamp === evidence.sourceMateStamp && message.sourceQueryGeneration === evidence.sourceQueryGeneration && message.phase !== 'clear' && !(store.get('clayControlReceipts') || []).some(function (receipt) { return receipt.id === evidence.activityId && receipt.stopped; });
|
|
21
|
+
}
|
|
22
|
+
function binding() {
|
|
23
|
+
return { window: window, document: document, identity: function () { var s = store.snap(); return { ownerId: s.myUserId || null, slug: s.currentSlug, sessionId: s.activeSessionId, origin: s.sessionOriginId, connected: s.connected, runtime: s.controlRuntimeId, mateId: s.activeProjectMateId }; } };
|
|
24
|
+
}
|
|
25
|
+
export function forwardStudioPresentation(message, type) {
|
|
26
|
+
if (!store.get('paneMode') || window.parent === window) return false;
|
|
27
|
+
var frame = window.frameElement;
|
|
28
|
+
if (!frame) return false;
|
|
29
|
+
frame.clayStudioSource = binding();
|
|
30
|
+
var evidence = message.controlPresentation;
|
|
31
|
+
if (evidence && (!source(evidence, store.snap()) || !currentActivity(evidence))) return true;
|
|
32
|
+
if (type === 'clay-pane-present-markdown') message = forwardDocumentSource(message);
|
|
33
|
+
var receipts = Object.assign({}, store.get('clayStudioRelays') || {});
|
|
34
|
+
Object.keys(receipts).forEach(function (id) { if (Date.now() > receipts[id].evidence.deadline) delete receipts[id]; });
|
|
35
|
+
if (Object.keys(receipts).length >= 100) return true;
|
|
36
|
+
if (evidence) receipts[evidence.id] = { evidence: evidence, socket: getWs() };
|
|
37
|
+
store.set({ clayStudioRelays: receipts });
|
|
38
|
+
window.parent.postMessage({ type: type, message: message, paneBinding: paneMessageBinding(), studioSource: frame.clayStudioSource.identity() }, location.origin);
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
export function trustedStudioFrame(event, data) {
|
|
42
|
+
if (event.origin !== location.origin || !data || !data.studioSource) return null;
|
|
43
|
+
var frame = Array.from(document.querySelectorAll('#contextual-clay iframe, .split-pane-frame')).find(function (item) { return item.contentWindow === event.source; });
|
|
44
|
+
var bridge = frame && frame.clayStudioSource, live = bridge && bridge.window === frame.contentWindow && bridge.document === frame.contentDocument && bridge.identity();
|
|
45
|
+
var expected = data.studioSource;
|
|
46
|
+
if (!live || !live.connected || live.ownerId !== (store.get('myUserId') || null) || live.ownerId !== expected.ownerId || live.slug !== expected.slug || live.sessionId !== expected.sessionId || live.origin !== expected.origin || live.runtime !== expected.runtime) return null;
|
|
47
|
+
if (new URL(frame.src, location.href).pathname !== '/p/' + encodeURIComponent(live.slug) + '/') return null;
|
|
48
|
+
if (frame.classList.contains('split-pane-frame')) {
|
|
49
|
+
if (frame.clayPane && !livePaneBinding(frame, data)) return null;
|
|
50
|
+
var split = store.get('splitPanes');
|
|
51
|
+
if (!split || !split.panes.some(function (pane) { return pane.slug === live.slug && String(pane.sessionId) === String(live.sessionId); })) return null;
|
|
52
|
+
} else {
|
|
53
|
+
var conversation = frame.conversation, identity = conversation && conversation.document === frame.contentDocument && conversation.source === frame.contentWindow && conversation.identity();
|
|
54
|
+
if (!identity || !identity.connected || !identity.available || identity.ownerId !== live.ownerId || identity.sessionId !== live.sessionId || identity.sessionOriginId !== live.origin) return null;
|
|
55
|
+
}
|
|
56
|
+
var evidence = data.message && data.message.controlPresentation;
|
|
57
|
+
if (evidence && (!validEvidence(evidence) || evidence.sourceSlug !== 'mate-' + evidence.mateId || evidence.mateId !== live.mateId || !(store.get('cachedMatesList') || []).some(function (mate) { return mate.id === evidence.mateId && mate.builtinKey === 'clay' && !mate.archived && !mate.lifecycleDeletion && contextualMateStamp(mate) === evidence.sourceMateStamp; }) || evidence.sourceSlug !== live.slug || evidence.sourceSessionId !== live.sessionId || evidence.sourceSessionOriginId !== live.origin || evidence.ownerId !== live.ownerId || evidence.runtimeId !== live.runtime)) return null;
|
|
58
|
+
return frame;
|
|
59
|
+
}
|
|
60
|
+
export function acceptStudioForward(event, data) {
|
|
61
|
+
var frame = trustedStudioFrame(event, data), evidence = data.message && data.message.controlPresentation;
|
|
62
|
+
if (!frame || !evidence || !currentActivity(evidence) || Date.now() > evidence.deadline) return false;
|
|
63
|
+
var entries = Object.assign({}, store.get('clayStudioForwarded') || {});
|
|
64
|
+
Object.keys(entries).forEach(function (id) { if (Date.now() > entries[id].evidence.deadline) delete entries[id]; });
|
|
65
|
+
if (Object.keys(entries).length >= 100) return false;
|
|
66
|
+
entries[evidence.id] = { frame: frame, document: frame.contentDocument, window: event.source, data: data, evidence: evidence };
|
|
67
|
+
store.set({ clayStudioForwarded: entries });
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
function delivery(evidence) {
|
|
71
|
+
var socket = getWs(), owner = store.get('myUserId'), slug = store.get('currentSlug');
|
|
72
|
+
var relay = (store.get('clayStudioForwarded') || {})[evidence.id];
|
|
73
|
+
return {
|
|
74
|
+
valid: function () {
|
|
75
|
+
if (Date.now() > evidence.deadline || !currentActivity(evidence) || !store.get('connected') || owner !== store.get('myUserId') || slug !== store.get('currentSlug') || getWs() !== socket) return false;
|
|
76
|
+
return relay ? relay.document === relay.frame.contentDocument && relay.window === relay.frame.contentWindow && !!trustedStudioFrame({ origin: location.origin, source: relay.window }, relay.data) : source(evidence, store.snap());
|
|
77
|
+
},
|
|
78
|
+
send: function (visible) {
|
|
79
|
+
var message = { type: 'clay_studio_rendered', id: evidence.id, token: evidence.token, sessionOriginId: evidence.sourceSessionOriginId, revision: evidence.target.revision, visible: visible };
|
|
80
|
+
if (relay) { if (relay.document === relay.frame.contentDocument) relay.window.postMessage({ type: 'clay-studio-receipt', message: message }, location.origin); }
|
|
81
|
+
else if (getWs() === socket && socket && socket.readyState === 1) socket.send(JSON.stringify(message));
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
async function digest(value) {
|
|
86
|
+
var hash = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(JSON.stringify(value)));
|
|
87
|
+
return Array.from(new Uint8Array(hash)).map(function (byte) { return byte.toString(16).padStart(2, '0'); }).join('');
|
|
88
|
+
}
|
|
89
|
+
// Called only by the actual renderer after content has reached its real product surface.
|
|
90
|
+
export function registerStudioPaint(message, element, ready, contentElement) {
|
|
91
|
+
if (!element) return;
|
|
92
|
+
delete element.dataset.controlSurface;
|
|
93
|
+
var evidence = message.controlPresentation;
|
|
94
|
+
if (!validEvidence(evidence)) return;
|
|
95
|
+
var receipt = delivery(evidence), settled = false, frame, timer, stable = 0;
|
|
96
|
+
var entry = { painted: false, evidence: evidence, target: evidence.target, element: element, valid: receipt.valid };
|
|
97
|
+
element.dataset.controlSurface = evidence.id;
|
|
98
|
+
var surfaces = Object.assign({}, store.get('clayStudioSurfaces') || {});
|
|
99
|
+
Object.keys(surfaces).forEach(function (id) { if (!surfaces[id].element.isConnected || surfaces[id].element === element || Date.now() > surfaces[id].evidence.deadline + 6000) delete surfaces[id]; });
|
|
100
|
+
surfaces[evidence.id] = entry; store.set({ clayStudioSurfaces: surfaces });
|
|
101
|
+
function finish(visible) { if (settled) return; settled = true; clearTimeout(timer); cancelAnimationFrame(frame); document.removeEventListener('visibilitychange', hidden); receipt.send(visible); }
|
|
102
|
+
entry.cancel = function () { finish(false); };
|
|
103
|
+
function hidden() { if (document.hidden) finish(false); }
|
|
104
|
+
document.addEventListener('visibilitychange', hidden);
|
|
105
|
+
timer = setTimeout(function () { finish(false); }, Math.max(0, evidence.deadline - Date.now()));
|
|
106
|
+
var content = evidence.target.surface === 'document' ? { content: message.content, exists: message.exists, size: message.size } : evidence.target.surface === 'sketch' ? message.source : message.data;
|
|
107
|
+
Promise.all([Promise.resolve(ready), digest(content)]).then(function (values) {
|
|
108
|
+
if (values[1] !== evidence.target.revision) { finish(false); return; }
|
|
109
|
+
function inspect() {
|
|
110
|
+
if (settled) return;
|
|
111
|
+
if (!receipt.valid() || document.hidden || element.dataset.controlSurface !== evidence.id) { finish(false); return; }
|
|
112
|
+
stable = painted(contentElement || element) ? stable + 1 : 0;
|
|
113
|
+
if (stable >= 2) { entry.painted = true; finish(true); } else frame = requestAnimationFrame(inspect);
|
|
114
|
+
}
|
|
115
|
+
frame = requestAnimationFrame(inspect);
|
|
116
|
+
}).catch(function () { finish(false); });
|
|
117
|
+
}
|
|
118
|
+
function painted(element) {
|
|
119
|
+
if (!element || !element.isConnected || element.closest('[hidden], [inert], [aria-hidden="true"]')) return false;
|
|
120
|
+
var rect = element.getBoundingClientRect(), style = getComputedStyle(element);
|
|
121
|
+
if (style.visibility !== 'visible' || Number(style.opacity) === 0) return false;
|
|
122
|
+
for (var parent = element.parentElement; parent; parent = parent.parentElement) {
|
|
123
|
+
var ancestorStyle = getComputedStyle(parent);
|
|
124
|
+
if (ancestorStyle.visibility !== 'visible' || Number(ancestorStyle.opacity) === 0) return false;
|
|
125
|
+
}
|
|
126
|
+
var left = Math.max(0, rect.left), right = Math.min(innerWidth, rect.right), top = Math.max(0, rect.top), bottom = Math.min(innerHeight, rect.bottom);
|
|
127
|
+
if (right <= left || bottom <= top) return false;
|
|
128
|
+
return [0.2, 0.5, 0.8].some(function (x) { return [0.2, 0.5, 0.8].some(function (y) { var hit = document.elementFromPoint(left + (right - left) * x, top + (bottom - top) * y); return hit && element.contains(hit); }); });
|
|
129
|
+
}
|
|
130
|
+
export function studioControlTarget(target) {
|
|
131
|
+
var entries = store.get('clayStudioSurfaces') || {};
|
|
132
|
+
var entry = Object.values(entries).find(function (item) { return item.painted && item.target.surface === target.surface && item.target.key === target.key && item.target.revision === target.revision && item.target.runtimeId === target.runtimeId && item.target.sourceSessionOriginId === target.sourceSessionOriginId && item.target.sourceSessionId === target.sourceSessionId && item.target.sourceSlug === target.sourceSlug && item.element.dataset.controlSurface === item.evidence.id && item.valid(); });
|
|
133
|
+
return entry && entry.element;
|
|
134
|
+
}
|
|
135
|
+
export function initStudioReceipts() {
|
|
136
|
+
window.addEventListener('message', function (event) {
|
|
137
|
+
if (event.origin !== location.origin || event.source !== window.parent || !event.data || event.data.type !== 'clay-studio-receipt') return;
|
|
138
|
+
var message = event.data.message, entries = Object.assign({}, store.get('clayStudioRelays') || {}), entry = message && entries[message.id];
|
|
139
|
+
if (!entry || entry.evidence.token !== message.token || !source(entry.evidence, store.snap()) || getWs() !== entry.socket || entry.socket.readyState !== 1 || Date.now() > entry.evidence.deadline) return;
|
|
140
|
+
delete entries[message.id]; store.set({ clayStudioRelays: entries }); entry.socket.send(JSON.stringify(message));
|
|
141
|
+
});
|
|
142
|
+
function stop() { Object.values(store.get('clayStudioSurfaces') || {}).forEach(function (entry) { delete entry.element.dataset.controlSurface; if (entry.cancel) entry.cancel(); }); store.set({ clayStudioRelays: {}, clayStudioForwarded: {}, clayStudioSurfaces: {} }); }
|
|
143
|
+
document.addEventListener('contextual-ask-stopped', stop, true);
|
|
144
|
+
document.addEventListener('click', function (event) { if (event.target.closest('#generation-stop, #autonomous-run-stop, #send-btn.stop')) stop(); }, true);
|
|
145
|
+
store.subscribe(function (state, prior) { if (!state.connected && prior.connected || state.currentSlug !== prior.currentSlug || state.activeSessionId !== prior.activeSessionId || state.myUserId !== prior.myUserId) stop(); });
|
|
146
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { clayToolPresentation, clayToolOutcome } from './clay-tool-presentation.js';
|
|
2
|
+
import { store } from './store.js';
|
|
3
|
+
import { iconHtml, refreshIcons } from './icons.js';
|
|
4
|
+
|
|
5
|
+
function bindDisclosure(header, toggle) {
|
|
6
|
+
header.setAttribute('role', 'button');
|
|
7
|
+
header.tabIndex = 0;
|
|
8
|
+
header.addEventListener('click', toggle);
|
|
9
|
+
header.addEventListener('keydown', function (event) {
|
|
10
|
+
if (event.key !== 'Enter' && event.key !== ' ') return;
|
|
11
|
+
event.preventDefault();
|
|
12
|
+
toggle();
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function syncToolGroupDisclosure(el) {
|
|
17
|
+
var expanded = !el.classList.contains('collapsed');
|
|
18
|
+
el.querySelector('.tool-group-header').setAttribute('aria-expanded', String(expanded));
|
|
19
|
+
var items = el.querySelector('.tool-group-items');
|
|
20
|
+
items.inert = !expanded;
|
|
21
|
+
items.setAttribute('aria-hidden', String(!expanded));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function bindToolGroupDisclosure(el, onToggle) {
|
|
25
|
+
// History links may expand a group directly; keep disclosure semantics in sync.
|
|
26
|
+
if (typeof MutationObserver !== 'undefined') {
|
|
27
|
+
var observer = new MutationObserver(function () { syncToolGroupDisclosure(el); });
|
|
28
|
+
observer.observe(el, { attributes: true, attributeFilter: ['class'] });
|
|
29
|
+
}
|
|
30
|
+
bindDisclosure(el.querySelector('.tool-group-header'), function () {
|
|
31
|
+
el.classList.toggle('collapsed');
|
|
32
|
+
onToggle();
|
|
33
|
+
syncToolGroupDisclosure(el);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function detailsFor(tool) {
|
|
38
|
+
var block = tool.el.querySelector('.clay-tool-evidence');
|
|
39
|
+
if (!block) {
|
|
40
|
+
block = document.createElement('div');
|
|
41
|
+
block.className = 'tool-result-block clay-tool-evidence collapsed';
|
|
42
|
+
tool.el.appendChild(block);
|
|
43
|
+
}
|
|
44
|
+
return block;
|
|
45
|
+
}
|
|
46
|
+
function renderEvidence(tool, block) {
|
|
47
|
+
block.replaceChildren();
|
|
48
|
+
var name = document.createElement('div');
|
|
49
|
+
name.className = 'clay-tool-technical-name';
|
|
50
|
+
name.textContent = tool.name;
|
|
51
|
+
block.appendChild(name);
|
|
52
|
+
[['Input', tool.input], ['Output', tool.clayRawResult]].forEach(function (entry) {
|
|
53
|
+
if (entry[1] === undefined || entry[1] === null) return;
|
|
54
|
+
var heading = document.createElement('div');
|
|
55
|
+
heading.className = 'clay-tool-evidence-label';
|
|
56
|
+
heading.textContent = entry[0];
|
|
57
|
+
var pre = document.createElement('pre');
|
|
58
|
+
pre.textContent = typeof entry[1] === 'string' ? entry[1] : JSON.stringify(entry[1], null, 2);
|
|
59
|
+
block.appendChild(heading);
|
|
60
|
+
block.appendChild(pre);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function statusIcon(el, selector, phase) {
|
|
64
|
+
var icon = el.querySelector(selector);
|
|
65
|
+
var name = phase === 'error' || phase === 'cancelled' ? 'alert-triangle' : phase === 'pending' ? 'clock' : phase === 'running' ? 'loader' : phase === 'returned' ? 'circle-help' : 'check';
|
|
66
|
+
var cls = phase === 'running' ? 'icon-spin' : phase === 'error' || phase === 'cancelled' ? 'err-icon' : 'check';
|
|
67
|
+
icon.innerHTML = iconHtml(name, cls);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function applyClayToolItem(tool) {
|
|
71
|
+
if (!tool || !tool.el) return false;
|
|
72
|
+
var presentation = clayToolPresentation(tool.name, tool.input, tool.clayOutcome);
|
|
73
|
+
if (!presentation) return false;
|
|
74
|
+
tool.clayActivity = presentation;
|
|
75
|
+
var el = tool.el;
|
|
76
|
+
var header = el.querySelector('.tool-header');
|
|
77
|
+
el.classList.add('clay-tool-activity');
|
|
78
|
+
el.dataset.activityPhase = presentation.phase;
|
|
79
|
+
el.classList.toggle('error', presentation.phase === 'error' || presentation.phase === 'cancelled');
|
|
80
|
+
el.querySelector('.tool-name').textContent = presentation.label;
|
|
81
|
+
el.querySelector('.tool-desc').textContent = presentation.subject;
|
|
82
|
+
el.querySelector('.tool-subtitle').hidden = true;
|
|
83
|
+
header.setAttribute('aria-label', presentation.label + (presentation.subject ? ' · ' + presentation.subject : '') + '. Show technical details');
|
|
84
|
+
if (!tool.clayDisclosureBound) {
|
|
85
|
+
tool.clayDisclosureBound = true;
|
|
86
|
+
bindDisclosure(header, function () {
|
|
87
|
+
var expanded = el.classList.toggle('expanded');
|
|
88
|
+
var block = detailsFor(tool);
|
|
89
|
+
if (expanded) renderEvidence(tool, block);
|
|
90
|
+
block.classList.toggle('collapsed', !expanded);
|
|
91
|
+
header.setAttribute('aria-expanded', String(expanded));
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
header.setAttribute('aria-expanded', String(el.classList.contains('expanded')));
|
|
95
|
+
if (el.classList.contains('expanded')) renderEvidence(tool, detailsFor(tool));
|
|
96
|
+
statusIcon(el, '.tool-status-icon', presentation.phase);
|
|
97
|
+
refreshIcons();
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function finishClayToolItem(tool, group) {
|
|
102
|
+
if (!tool || !clayToolPresentation(tool.name, tool.input)) return false;
|
|
103
|
+
if (!tool.clayOutcome) {
|
|
104
|
+
tool.clayOutcome = { phase: 'returned', status: 'result_unavailable' };
|
|
105
|
+
tool.clayEndedGroup = group;
|
|
106
|
+
var cache = store.get('clayEndedToolRecords');
|
|
107
|
+
if (!cache) { cache = new WeakMap(); store.set({ clayEndedToolRecords: cache }); }
|
|
108
|
+
cache.set(tool.el, tool);
|
|
109
|
+
}
|
|
110
|
+
return applyClayToolItem(tool);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Done clears the live registry; only rows still in this transcript can receive late results.
|
|
114
|
+
export function findEndedClayTool(root, id) {
|
|
115
|
+
var cache = store.get('clayEndedToolRecords');
|
|
116
|
+
if (!cache || !root) return null;
|
|
117
|
+
var rows = root.querySelectorAll('.clay-tool-activity[data-tool-id]');
|
|
118
|
+
for (var i = rows.length - 1; i >= 0; i--) {
|
|
119
|
+
if (rows[i].dataset.toolId === id && cache.has(rows[i])) return cache.get(rows[i]);
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function clayToolResultGroup(tool, liveGroup) {
|
|
125
|
+
return liveGroup && liveGroup.el.contains(tool.el) ? liveGroup : tool.clayEndedGroup;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function applyClayToolResult(tool, content, isError) {
|
|
129
|
+
if (!clayToolPresentation(tool.name, tool.input)) return false;
|
|
130
|
+
tool.clayRawResult = content;
|
|
131
|
+
tool.clayOutcome = clayToolOutcome(content, isError);
|
|
132
|
+
return applyClayToolItem(tool);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function syncClayToolGroup(group) {
|
|
136
|
+
if (!group.clayActivityPhase) { delete group.el.dataset.activityPhase; return; }
|
|
137
|
+
group.el.dataset.activityPhase = group.clayActivityPhase;
|
|
138
|
+
statusIcon(group.el, '.tool-group-status-icon', group.clayActivityPhase);
|
|
139
|
+
refreshIcons();
|
|
140
|
+
}
|