clay-server 5.2.0-beta.1 → 5.2.0-beta.10
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/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 +51 -0
- package/lib/clay-product-control.js +247 -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-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/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 +50 -0
- package/lib/notes.js +49 -3
- 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 +7 -3
- 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 +103 -272
- package/lib/project-shared-browser.js +78 -17
- package/lib/project-studio-presentation.js +58 -0
- package/lib/project-user-message.js +67 -1
- package/lib/project-vendor-login.js +6 -36
- package/lib/project-workspace-operations.js +126 -0
- package/lib/project-workspace-query.js +19 -2
- package/lib/project.js +178 -45
- package/lib/public/app.js +46 -0
- 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/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/messages.css +6 -2
- package/lib/public/css/overlays.css +4 -2
- package/lib/public/css/project-admin-overview.css +13 -0
- package/lib/public/css/session-folders.css +11 -0
- package/lib/public/css/session-github.css +46 -1
- package/lib/public/css/shared-browser.css +35 -1
- package/lib/public/css/sticky-notes.css +87 -1
- package/lib/public/index.html +11 -5
- 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-projects.js +6 -2
- 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-loop-ui.js +2 -0
- package/lib/public/modules/app-message-router.js +22 -1
- package/lib/public/modules/app-messages.js +115 -17
- 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 +13 -0
- package/lib/public/modules/app-rate-limit.js +7 -27
- 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 +342 -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 +250 -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/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-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 +1 -238
- 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-navigation.js +144 -22
- 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/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/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 +4 -3
- package/lib/public/modules/sidebar-projects.js +1 -0
- 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 +8 -1
- 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 +11 -2
- package/lib/public/modules/user-settings-preferences.js +6 -2
- package/lib/public/modules/user-settings-profile.js +12 -2
- package/lib/public/modules/user-settings.js +3 -2
- 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/wireframe-workbench.js +5 -2
- package/lib/public/muse-avatar.svg +4 -0
- package/lib/public/style.css +5 -0
- package/lib/public/sw.js +3 -1
- 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 +342 -401
- package/lib/sdk-foreground-admission.js +16 -0
- package/lib/sdk-mcp-descriptors.js +2 -37
- package/lib/sdk-message-processor.js +52 -17
- package/lib/sdk-quota-snapshot.js +1 -1
- 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-global-ws.js +10 -20
- 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 +163 -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-permission-mode.js +4 -3
- package/lib/session-skill-scope.js +11 -0
- package/lib/session-visibility.js +5 -2
- package/lib/session-work-primary.js +50 -0
- package/lib/sessions.js +64 -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/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 +18 -2
- 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 +54 -50
- package/lib/yoke/adapters/codex-query-contract.js +24 -0
- package/lib/yoke/adapters/codex.js +53 -111
- 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 +271 -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-idle-recovery.js +81 -1
- 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 +79 -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 +14 -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 +81 -1
- package/package.json +10 -4
|
@@ -1343,6 +1343,8 @@ function createCodexQueryHandle(appServer, queryOpts) {
|
|
|
1343
1343
|
return { threadId: state.threadId, revision: inputRevision };
|
|
1344
1344
|
},
|
|
1345
1345
|
|
|
1346
|
+
getRecoveryThreadId: function() { return state.threadId || queryOpts.resumeSessionId || null; },
|
|
1347
|
+
|
|
1346
1348
|
retireIdleForRecovery: function() {
|
|
1347
1349
|
handle.endInput();
|
|
1348
1350
|
return loopFinished;
|
|
@@ -1461,11 +1463,23 @@ function createCodexAdapter(opts) {
|
|
|
1461
1463
|
var _refCount = 0;
|
|
1462
1464
|
var _lastActiveAt = Date.now();
|
|
1463
1465
|
var _shuttingDown = false;
|
|
1466
|
+
var _recoveryIdleShutdown = null;
|
|
1464
1467
|
var _activeQueries = [];
|
|
1465
|
-
var
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1468
|
+
var recoveryAdmission = require("../codex-recovery-admission").attachRecoveryAdmission({
|
|
1469
|
+
state: function() { return { epoch: _shutdownEpoch, shuttingDown: _shuttingDown, retiring: _recoveryIdleShutdown === _shutdownEpoch,
|
|
1470
|
+
initializing: _initializing, refCount: _refCount, server: _appServer, entries: _activeQueries.slice() }; },
|
|
1471
|
+
shutdownError: createShutdownError,
|
|
1472
|
+
stopIdle: async function() {
|
|
1473
|
+
_recoveryIdleShutdown = _shutdownEpoch;
|
|
1474
|
+
try { return await adapter.shutdownIfIdle(0); }
|
|
1475
|
+
finally { _recoveryIdleShutdown = null; }
|
|
1476
|
+
},
|
|
1477
|
+
createRuntime: function(queryOpts) {
|
|
1478
|
+
return createCodexAdapter(Object.assign({}, _defaultInitOpts, {
|
|
1479
|
+
recoveryRuntime: true, recoverySessionMcpServer: queryOpts.sessionMcpServer,
|
|
1480
|
+
}));
|
|
1481
|
+
},
|
|
1482
|
+
});
|
|
1469
1483
|
|
|
1470
1484
|
function scopedSkillOptions(env) {
|
|
1471
1485
|
if (!_runtimeLinuxUser) return { env: env };
|
|
@@ -1541,102 +1555,6 @@ function createCodexAdapter(opts) {
|
|
|
1541
1555
|
updateLastActiveAt();
|
|
1542
1556
|
}
|
|
1543
1557
|
|
|
1544
|
-
function retainRecoveryRuntime(runtime) {
|
|
1545
|
-
_recoveryRuntimes.push(runtime);
|
|
1546
|
-
}
|
|
1547
|
-
|
|
1548
|
-
function removeRecoveryRuntime(runtime) {
|
|
1549
|
-
var next = [];
|
|
1550
|
-
for (var i = 0; i < _recoveryRuntimes.length; i++) {
|
|
1551
|
-
if (_recoveryRuntimes[i] !== runtime) next.push(_recoveryRuntimes[i]);
|
|
1552
|
-
}
|
|
1553
|
-
_recoveryRuntimes = next;
|
|
1554
|
-
}
|
|
1555
|
-
|
|
1556
|
-
function cleanupRecoveryRuntime(runtime) {
|
|
1557
|
-
for (var i = 0; i < _recoveryCleanupTasks.length; i++) {
|
|
1558
|
-
if (_recoveryCleanupTasks[i].runtime === runtime) return _recoveryCleanupTasks[i].promise;
|
|
1559
|
-
}
|
|
1560
|
-
var task = { runtime: runtime, promise: null };
|
|
1561
|
-
_recoveryCleanupTasks.push(task);
|
|
1562
|
-
var priorCleanup = _recoveryCleanup;
|
|
1563
|
-
task.promise = Promise.resolve(priorCleanup).catch(function() {
|
|
1564
|
-
return null;
|
|
1565
|
-
}).then(function() {
|
|
1566
|
-
return runtime.shutdown();
|
|
1567
|
-
}).catch(function(error) {
|
|
1568
|
-
console.error("[yoke/codex] Isolated recovery runtime shutdown failed:", error.message || error);
|
|
1569
|
-
}).then(function() {
|
|
1570
|
-
removeRecoveryRuntime(runtime);
|
|
1571
|
-
var remainingTasks = [];
|
|
1572
|
-
for (var ti = 0; ti < _recoveryCleanupTasks.length; ti++) {
|
|
1573
|
-
if (_recoveryCleanupTasks[ti] !== task) remainingTasks.push(_recoveryCleanupTasks[ti]);
|
|
1574
|
-
}
|
|
1575
|
-
_recoveryCleanupTasks = remainingTasks;
|
|
1576
|
-
});
|
|
1577
|
-
_recoveryCleanup = task.promise;
|
|
1578
|
-
return task.promise;
|
|
1579
|
-
}
|
|
1580
|
-
|
|
1581
|
-
function shutdownRecoveryRuntimes() {
|
|
1582
|
-
var runtimes = _recoveryRuntimes.slice();
|
|
1583
|
-
if (!runtimes.length) return _recoveryCleanup;
|
|
1584
|
-
return Promise.all(runtimes.map(function(runtime) {
|
|
1585
|
-
return cleanupRecoveryRuntime(runtime);
|
|
1586
|
-
})).then(function() {
|
|
1587
|
-
_recoveryRuntimes = [];
|
|
1588
|
-
});
|
|
1589
|
-
}
|
|
1590
|
-
|
|
1591
|
-
async function createIsolatedRecoveryQuery(queryOpts) {
|
|
1592
|
-
var shutdownEpoch = _shutdownEpoch;
|
|
1593
|
-
function checkCurrent() {
|
|
1594
|
-
idleRecovery.checkAbort(queryOpts);
|
|
1595
|
-
if (_shuttingDown || shutdownEpoch !== _shutdownEpoch) throw createShutdownError();
|
|
1596
|
-
}
|
|
1597
|
-
var releaseHandoff;
|
|
1598
|
-
var priorHandoff = _recoveryHandoff;
|
|
1599
|
-
var myHandoff = new Promise(function(resolve) { releaseHandoff = resolve; });
|
|
1600
|
-
_recoveryHandoff = myHandoff;
|
|
1601
|
-
await (priorHandoff || Promise.resolve());
|
|
1602
|
-
try {
|
|
1603
|
-
await _recoveryCleanup;
|
|
1604
|
-
checkCurrent();
|
|
1605
|
-
if (!_initializing && _refCount > 0) {
|
|
1606
|
-
await idleRecovery.retireIdleQueries(_activeQueries.slice(), _appServer, checkCurrent);
|
|
1607
|
-
}
|
|
1608
|
-
checkCurrent();
|
|
1609
|
-
if (_refCount > 0 || _initializing) {
|
|
1610
|
-
throw new Error("Codex resumed-tool recovery is waiting for an active shared runtime; retry after its current queries finish.");
|
|
1611
|
-
}
|
|
1612
|
-
if (_appServer) {
|
|
1613
|
-
var stopped = await adapter.shutdownIfIdle(0);
|
|
1614
|
-
if (!stopped) throw new Error("Codex resumed-tool recovery could not safely release the shared runtime; retry after its current queries finish.");
|
|
1615
|
-
}
|
|
1616
|
-
checkCurrent();
|
|
1617
|
-
var recoveryRuntime = createCodexAdapter(Object.assign({}, _defaultInitOpts, {
|
|
1618
|
-
recoveryRuntime: true,
|
|
1619
|
-
recoverySessionMcpServer: queryOpts.sessionMcpServer,
|
|
1620
|
-
}));
|
|
1621
|
-
retainRecoveryRuntime(recoveryRuntime);
|
|
1622
|
-
var recoveryOpts = Object.assign({}, queryOpts, {
|
|
1623
|
-
isolatedRecovery: true,
|
|
1624
|
-
onRuntimeFinished: function() {
|
|
1625
|
-
return cleanupRecoveryRuntime(recoveryRuntime);
|
|
1626
|
-
},
|
|
1627
|
-
});
|
|
1628
|
-
try {
|
|
1629
|
-
return await recoveryRuntime.createQuery(recoveryOpts);
|
|
1630
|
-
} catch (error) {
|
|
1631
|
-
await cleanupRecoveryRuntime(recoveryRuntime);
|
|
1632
|
-
throw error;
|
|
1633
|
-
}
|
|
1634
|
-
} finally {
|
|
1635
|
-
releaseHandoff();
|
|
1636
|
-
if (_recoveryHandoff === myHandoff) _recoveryHandoff = null;
|
|
1637
|
-
}
|
|
1638
|
-
}
|
|
1639
|
-
|
|
1640
1558
|
function buildReadyResponse(skillNames) {
|
|
1641
1559
|
return {
|
|
1642
1560
|
models: _cachedModels,
|
|
@@ -1764,6 +1682,7 @@ function createCodexAdapter(opts) {
|
|
|
1764
1682
|
var adapter = {
|
|
1765
1683
|
vendor: "codex",
|
|
1766
1684
|
queryBoundToolCapability: CODEX_QUERY_BOUND_TOOL_CAPABILITY,
|
|
1685
|
+
queryContract: require("./codex-query-contract"),
|
|
1767
1686
|
userInputCapability: { mode: "native", native: true, transport: "item/tool/requestUserInput" },
|
|
1768
1687
|
|
|
1769
1688
|
init: function(initOpts) {
|
|
@@ -1777,12 +1696,14 @@ function createCodexAdapter(opts) {
|
|
|
1777
1696
|
if (_runtimeLinuxUser && requestedLinuxUser && requestedLinuxUser !== _runtimeLinuxUser) {
|
|
1778
1697
|
return Promise.reject(new Error("Codex runtime user mismatch"));
|
|
1779
1698
|
}
|
|
1780
|
-
if (_shuttingDown) {
|
|
1699
|
+
if (_shuttingDown && _recoveryIdleShutdown !== _shutdownEpoch) {
|
|
1781
1700
|
return Promise.reject(createShutdownError());
|
|
1782
1701
|
}
|
|
1783
|
-
|
|
1702
|
+
try { recoveryAdmission.checkSharedExit(); }
|
|
1703
|
+
catch (error) { return Promise.reject(error); }
|
|
1704
|
+
if (recoveryAdmission.pending()) {
|
|
1784
1705
|
var initEpoch = _shutdownEpoch;
|
|
1785
|
-
return
|
|
1706
|
+
return recoveryAdmission.pending().then(function() {
|
|
1786
1707
|
if (initEpoch !== _shutdownEpoch) throw createShutdownError();
|
|
1787
1708
|
return adapter.init(initOpts);
|
|
1788
1709
|
});
|
|
@@ -1963,6 +1884,10 @@ function createCodexAdapter(opts) {
|
|
|
1963
1884
|
return null;
|
|
1964
1885
|
},
|
|
1965
1886
|
|
|
1887
|
+
retireIdleForRecovery: function(checkCurrent) {
|
|
1888
|
+
return idleRecovery.retireIdleQueries(_activeQueries.slice(), _appServer, checkCurrent);
|
|
1889
|
+
},
|
|
1890
|
+
|
|
1966
1891
|
createQuery: async function(queryOpts) {
|
|
1967
1892
|
var requestedLinuxUser = queryOpts && queryOpts.linuxUser;
|
|
1968
1893
|
if (!_runtimeLinuxUser && requestedLinuxUser) {
|
|
@@ -1974,28 +1899,37 @@ function createCodexAdapter(opts) {
|
|
|
1974
1899
|
if (_runtimeLinuxUser && requestedLinuxUser && requestedLinuxUser !== _runtimeLinuxUser) {
|
|
1975
1900
|
throw new Error("Codex runtime user mismatch");
|
|
1976
1901
|
}
|
|
1977
|
-
if (_shuttingDown) {
|
|
1902
|
+
if (_shuttingDown && _recoveryIdleShutdown !== _shutdownEpoch) {
|
|
1978
1903
|
throw createShutdownError();
|
|
1979
1904
|
}
|
|
1980
1905
|
if (queryOpts && queryOpts.sessionMcpServer && queryOpts.resumeSessionId && !queryOpts.isolatedRecovery) {
|
|
1981
|
-
return
|
|
1906
|
+
return recoveryAdmission.createQuery(queryOpts);
|
|
1982
1907
|
}
|
|
1983
1908
|
var queryEpoch = _shutdownEpoch;
|
|
1909
|
+
function checkAdmission() {
|
|
1910
|
+
idleRecovery.checkAbort(queryOpts || {});
|
|
1911
|
+
if ((_shuttingDown && _recoveryIdleShutdown !== _shutdownEpoch) || queryEpoch !== _shutdownEpoch) throw createShutdownError();
|
|
1912
|
+
}
|
|
1984
1913
|
// Recheck after every await: recovery may replace the runtime while an
|
|
1985
1914
|
// ordinary start is waiting for initialization or an earlier handoff.
|
|
1986
1915
|
while (true) {
|
|
1987
1916
|
idleRecovery.checkAbort(queryOpts || {});
|
|
1988
|
-
if (_shuttingDown || queryEpoch !== _shutdownEpoch) throw createShutdownError();
|
|
1989
|
-
|
|
1990
|
-
|
|
1917
|
+
if ((_shuttingDown && _recoveryIdleShutdown !== _shutdownEpoch) || queryEpoch !== _shutdownEpoch) throw createShutdownError();
|
|
1918
|
+
recoveryAdmission.checkSharedExit();
|
|
1919
|
+
if (recoveryAdmission.pending()) {
|
|
1920
|
+
await idleRecovery.wait(recoveryAdmission.pending(), checkAdmission);
|
|
1921
|
+
continue;
|
|
1922
|
+
}
|
|
1923
|
+
if (queryOpts.resumeSessionId && recoveryAdmission.hasTarget(queryOpts.resumeSessionId)) {
|
|
1924
|
+
await recoveryAdmission.waitForTarget(queryOpts);
|
|
1991
1925
|
continue;
|
|
1992
1926
|
}
|
|
1993
1927
|
if (_initializing && _initPromise) {
|
|
1994
|
-
await _initPromise;
|
|
1928
|
+
await idleRecovery.wait(_initPromise, checkAdmission);
|
|
1995
1929
|
continue;
|
|
1996
1930
|
}
|
|
1997
1931
|
if (!_appServer || !_appServer.started) {
|
|
1998
|
-
await adapter.init(queryOpts || {});
|
|
1932
|
+
await idleRecovery.wait(adapter.init(queryOpts || {}), checkAdmission);
|
|
1999
1933
|
continue;
|
|
2000
1934
|
}
|
|
2001
1935
|
break;
|
|
@@ -2174,12 +2108,20 @@ function createCodexAdapter(opts) {
|
|
|
2174
2108
|
},
|
|
2175
2109
|
|
|
2176
2110
|
// Shutdown the app-server process
|
|
2111
|
+
shutdownForRecovery: async function() {
|
|
2112
|
+
var proc = _appServer && _appServer.proc;
|
|
2113
|
+
await adapter.shutdown();
|
|
2114
|
+
if (proc && proc.exitCode === null && proc.signalCode === null) {
|
|
2115
|
+
throw new Error('Codex recovery runtime exit could not be confirmed; its thread remains reserved.');
|
|
2116
|
+
}
|
|
2117
|
+
},
|
|
2118
|
+
|
|
2177
2119
|
shutdown: function() {
|
|
2178
2120
|
_shutdownEpoch++;
|
|
2179
2121
|
return Promise.all([
|
|
2180
2122
|
beginShutdown(true),
|
|
2181
2123
|
shutdownUserRuntimes("shutdown"),
|
|
2182
|
-
|
|
2124
|
+
recoveryAdmission.shutdown(),
|
|
2183
2125
|
]).then(function() { return true; });
|
|
2184
2126
|
},
|
|
2185
2127
|
|
|
@@ -279,7 +279,7 @@ function flattenUpdate(update, state) {
|
|
|
279
279
|
|
|
280
280
|
// Token usage
|
|
281
281
|
if (type === "usage_update") {
|
|
282
|
-
if (typeof update.used === "number") state.lastInputTokens = update.used;
|
|
282
|
+
if (typeof update.used === "number") { state.lastInputTokens = update.used; state.contextMeasurement = "observed"; }
|
|
283
283
|
if (typeof update.size === "number") state.contextWindow = update.size;
|
|
284
284
|
return events;
|
|
285
285
|
}
|
|
@@ -294,6 +294,7 @@ function flattenUpdate(update, state) {
|
|
|
294
294
|
if (typeof percentage !== "number") percentage = kiroMeta.usagePercentage;
|
|
295
295
|
if (typeof percentage === "number" && state.contextWindow) {
|
|
296
296
|
state.lastInputTokens = Math.round(state.contextWindow * percentage / 100);
|
|
297
|
+
state.contextMeasurement = "estimated";
|
|
297
298
|
}
|
|
298
299
|
}
|
|
299
300
|
return events;
|
|
@@ -782,6 +783,7 @@ function createKiroQueryHandle(acp, queryOpts) {
|
|
|
782
783
|
getContextUsage: function() {
|
|
783
784
|
return Promise.resolve(state.lastInputTokens != null ? {
|
|
784
785
|
input_tokens: state.lastInputTokens,
|
|
786
|
+
measurement: state.contextMeasurement || "observed",
|
|
785
787
|
contextWindow: state.contextWindow || null,
|
|
786
788
|
} : null);
|
|
787
789
|
},
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
var museQuery = require("../muse-query");
|
|
2
|
+
var runtimeTools = require("../muse-runtime");
|
|
3
|
+
var findMusePath = require("../providers/muse-executable").resolve;
|
|
4
|
+
|
|
5
|
+
function createMuseAdapter(opts) {
|
|
6
|
+
opts = opts || {};
|
|
7
|
+
var adapter = {
|
|
8
|
+
vendor: "muse",
|
|
9
|
+
userInputCapability: { mode: "native", native: true },
|
|
10
|
+
providerContract: require("../vendor-registry").getVendorInfo("muse"),
|
|
11
|
+
queryContract: require("./muse-query-contract"),
|
|
12
|
+
cwd: opts.cwd || process.cwd(),
|
|
13
|
+
binaryPath: opts._binaryPath || null,
|
|
14
|
+
sdkPromise: null,
|
|
15
|
+
catalog: [],
|
|
16
|
+
clients: new Set(),
|
|
17
|
+
handles: new Set(),
|
|
18
|
+
shuttingDown: false,
|
|
19
|
+
requestTimeoutMs: opts._requestTimeoutMs || 9e4,
|
|
20
|
+
titleTimeoutMs: opts._titleTimeoutMs || 15e3,
|
|
21
|
+
shutdownTimeoutMs: opts._shutdownTimeoutMs == null ? 1e3 : opts._shutdownTimeoutMs
|
|
22
|
+
};
|
|
23
|
+
adapter.loadSdk = function() {
|
|
24
|
+
if (opts._sdk) return Promise.resolve(opts._sdk);
|
|
25
|
+
if (!adapter.sdkPromise) adapter.sdkPromise = import("@muse-code/sdk");
|
|
26
|
+
return adapter.sdkPromise;
|
|
27
|
+
};
|
|
28
|
+
adapter.init = async function(initOpts) {
|
|
29
|
+
if (opts.osUsers || opts.linuxUser || initOpts && (initOpts.linuxUser || initOpts.osUsers)) throw new Error("Muse Code does not support OS-owner isolation");
|
|
30
|
+
if (!adapter.binaryPath) adapter.binaryPath = findMusePath();
|
|
31
|
+
if (!adapter.binaryPath) throw new Error("Muse Code binary not found: muse. Install Muse Code or set MUSE_CODE_PATH.");
|
|
32
|
+
await adapter.loadSdk();
|
|
33
|
+
return {
|
|
34
|
+
models: [],
|
|
35
|
+
defaultModel: null,
|
|
36
|
+
skills: [],
|
|
37
|
+
slashCommands: [],
|
|
38
|
+
fastModeState: null,
|
|
39
|
+
capabilities: {
|
|
40
|
+
effort: true,
|
|
41
|
+
midSessionModelSwitch: true,
|
|
42
|
+
fork: true,
|
|
43
|
+
rollback: false,
|
|
44
|
+
sessionListing: true,
|
|
45
|
+
sessionRename: true,
|
|
46
|
+
thinking: true,
|
|
47
|
+
betas: false,
|
|
48
|
+
rewind: false,
|
|
49
|
+
sessionResume: true,
|
|
50
|
+
promptSuggestions: false,
|
|
51
|
+
elicitation: false,
|
|
52
|
+
fileCheckpointing: false,
|
|
53
|
+
contextCompacting: true,
|
|
54
|
+
queryBoundTools: {
|
|
55
|
+
mode: "stdio-mcp",
|
|
56
|
+
source: "@muse-code/sdk SessionConfig.mcpServers"
|
|
57
|
+
},
|
|
58
|
+
skillSharing: true,
|
|
59
|
+
toolPolicy: [ "ask", "allow-all" ]
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
adapter.supportedModels = async function() {
|
|
64
|
+
if (adapter.shuttingDown) throw new Error("Muse Code adapter is shutting down");
|
|
65
|
+
if (!adapter.binaryPath) await adapter.init();
|
|
66
|
+
var sdk = await adapter.loadSdk();
|
|
67
|
+
if (adapter.shuttingDown) throw new Error("Muse Code adapter is shutting down");
|
|
68
|
+
var runtime = runtimeTools.createRuntime(adapter, sdk, {
|
|
69
|
+
command: adapter.binaryPath,
|
|
70
|
+
args: [ "serve" ],
|
|
71
|
+
cwd: adapter.cwd,
|
|
72
|
+
env: Object.assign({}, process.env)
|
|
73
|
+
});
|
|
74
|
+
runtime.fail = function(error) {
|
|
75
|
+
runtime.close().catch(function(closeError) {
|
|
76
|
+
adapter.lastCloseError = closeError;
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
try {
|
|
80
|
+
var spawned = await runtime.initialize();
|
|
81
|
+
adapter.catalog = runtimeTools.normalizeCatalog(await runtime.waitRequest(spawned.connection.request("model/list", {})));
|
|
82
|
+
return adapter.catalog.slice();
|
|
83
|
+
} finally {
|
|
84
|
+
await runtime.close();
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
adapter.createToolServer = function() {
|
|
88
|
+
return null;
|
|
89
|
+
};
|
|
90
|
+
adapter.createQuery = async function(queryOpts) {
|
|
91
|
+
if (opts.osUsers || opts.linuxUser || queryOpts && queryOpts.linuxUser) throw new Error("Muse Code does not support OS-owner isolation");
|
|
92
|
+
if (!adapter.binaryPath) await adapter.init(queryOpts || {});
|
|
93
|
+
if (adapter.shuttingDown) throw new Error("Muse Code adapter is shutting down");
|
|
94
|
+
return museQuery.createMuseQueryHandle(adapter, queryOpts || {});
|
|
95
|
+
};
|
|
96
|
+
adapter.generateTitle = function(messages, titleOpts) {
|
|
97
|
+
return require("../title-query").generateTitle(adapter, messages, Object.assign({}, titleOpts, { timeoutMs: adapter.titleTimeoutMs }),
|
|
98
|
+
{ skipProjectInstructions: true, skipSkills: true, adapterOptions: { MUSE: { readOnly: true, mcpServers: [] } } });
|
|
99
|
+
};
|
|
100
|
+
adapter.shutdown = async function() {
|
|
101
|
+
adapter.shuttingDown = true;
|
|
102
|
+
var results = await Promise.allSettled(Array.from(adapter.handles).map(function(handle) {
|
|
103
|
+
return handle.close();
|
|
104
|
+
}).concat(Array.from(adapter.clients).map(function(runtime) {
|
|
105
|
+
return runtime.close();
|
|
106
|
+
})));
|
|
107
|
+
var failed = results.find(function(result) {
|
|
108
|
+
return result.status === "rejected";
|
|
109
|
+
});
|
|
110
|
+
if (failed) throw failed.reason;
|
|
111
|
+
return true;
|
|
112
|
+
};
|
|
113
|
+
require("../muse-services").attach(adapter);
|
|
114
|
+
return adapter;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
module.exports = {
|
|
118
|
+
createMuseAdapter: createMuseAdapter,
|
|
119
|
+
findMusePath: findMusePath,
|
|
120
|
+
isAuthError: runtimeTools.isAuthError,
|
|
121
|
+
chooseApprovalDecision: require("../muse-policy").chooseApprovalDecision
|
|
122
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function loginPrompt(event, preview, provider) {
|
|
2
|
+
if (event.cost && event.cost !== 0 || String(preview || '').length >= 100) return false;
|
|
3
|
+
var text = String(preview || '').trim();
|
|
4
|
+
if (/not logged in/i.test(text) && /\/login/i.test(text)) return true;
|
|
5
|
+
var policy = require('./provider-contract').resolve(provider);
|
|
6
|
+
return typeof policy.authenticationReply === 'function' && policy.authenticationReply(text);
|
|
7
|
+
}
|
|
8
|
+
function authenticationReply(text) { return /^Failed to authenticate: OAuth session expired and could not be refreshed\.?$/i.test(text); }
|
|
9
|
+
function isAuthenticationError(detail) {
|
|
10
|
+
var text = String(detail || '').toLowerCase();
|
|
11
|
+
return /not logged in|unauthenticated|authentication|sign in|log in|please login/.test(text);
|
|
12
|
+
}
|
|
13
|
+
function normalize(event, preview, provider) {
|
|
14
|
+
if (!event || event.yokeType !== "result") return event;
|
|
15
|
+
return Object.assign({}, event, { authenticationRequired: event.authenticationRequired === true || loginPrompt(event, preview, provider) });
|
|
16
|
+
}
|
|
17
|
+
module.exports = { normalize: normalize, loginPrompt: loginPrompt, authenticationReply: authenticationReply, isAuthenticationError: isAuthenticationError };
|