@vascend/talos 0.1.0
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 +202 -0
- package/dist/backend/asset-events.d.ts +31 -0
- package/dist/backend/asset-events.js +149 -0
- package/dist/backend/assets.d.ts +31 -0
- package/dist/backend/assets.js +210 -0
- package/dist/backend/auth.d.ts +18 -0
- package/dist/backend/auth.js +59 -0
- package/dist/backend/config.d.ts +14 -0
- package/dist/backend/config.js +41 -0
- package/dist/backend/conversations.d.ts +21 -0
- package/dist/backend/conversations.js +141 -0
- package/dist/backend/crypto.d.ts +9 -0
- package/dist/backend/crypto.js +68 -0
- package/dist/backend/engine.d.ts +13 -0
- package/dist/backend/engine.js +78 -0
- package/dist/backend/http.d.ts +25 -0
- package/dist/backend/http.js +112 -0
- package/dist/backend/index.d.ts +1 -0
- package/dist/backend/index.js +24 -0
- package/dist/backend/routes.d.ts +14 -0
- package/dist/backend/routes.js +169 -0
- package/dist/backend/sdk.d.ts +12 -0
- package/dist/backend/sdk.js +11 -0
- package/dist/backend/server.d.ts +12 -0
- package/dist/backend/server.js +91 -0
- package/dist/backend/temp-image-store.d.ts +46 -0
- package/dist/backend/temp-image-store.js +197 -0
- package/dist/backend/types.d.ts +103 -0
- package/dist/backend/types.js +29 -0
- package/dist/backend/users.d.ts +13 -0
- package/dist/backend/users.js +76 -0
- package/dist/backend/ws-handler.d.ts +14 -0
- package/dist/backend/ws-handler.js +72 -0
- package/dist/backend/ws.d.ts +19 -0
- package/dist/backend/ws.js +146 -0
- package/dist/core/agent.d.ts +56 -0
- package/dist/core/agent.js +1783 -0
- package/dist/core/background.d.ts +45 -0
- package/dist/core/background.js +140 -0
- package/dist/core/bootstrap.d.ts +45 -0
- package/dist/core/bootstrap.js +294 -0
- package/dist/core/cli-args.d.ts +41 -0
- package/dist/core/cli-args.js +282 -0
- package/dist/core/collapsible-output.d.ts +38 -0
- package/dist/core/collapsible-output.js +143 -0
- package/dist/core/compaction-checkpoint.d.ts +9 -0
- package/dist/core/compaction-checkpoint.js +58 -0
- package/dist/core/compaction.d.ts +42 -0
- package/dist/core/compaction.js +270 -0
- package/dist/core/config.d.ts +49 -0
- package/dist/core/config.js +417 -0
- package/dist/core/context-ledger.d.ts +99 -0
- package/dist/core/context-ledger.js +222 -0
- package/dist/core/context-policy.d.ts +17 -0
- package/dist/core/context-policy.js +81 -0
- package/dist/core/continuation-review.d.ts +23 -0
- package/dist/core/continuation-review.js +64 -0
- package/dist/core/crash-report.d.ts +3 -0
- package/dist/core/crash-report.js +27 -0
- package/dist/core/credentials.d.ts +11 -0
- package/dist/core/credentials.js +183 -0
- package/dist/core/doctor.d.ts +24 -0
- package/dist/core/doctor.js +125 -0
- package/dist/core/effort.d.ts +5 -0
- package/dist/core/effort.js +42 -0
- package/dist/core/env-paths.d.ts +3 -0
- package/dist/core/env-paths.js +38 -0
- package/dist/core/execution-guidance.d.ts +9 -0
- package/dist/core/execution-guidance.js +73 -0
- package/dist/core/execution-target.d.ts +41 -0
- package/dist/core/execution-target.js +69 -0
- package/dist/core/file-coordination.d.ts +66 -0
- package/dist/core/file-coordination.js +176 -0
- package/dist/core/file-lease-store.d.ts +14 -0
- package/dist/core/file-lease-store.js +89 -0
- package/dist/core/image-limits.d.ts +26 -0
- package/dist/core/image-limits.js +205 -0
- package/dist/core/interruptible-completion.d.ts +3 -0
- package/dist/core/interruptible-completion.js +42 -0
- package/dist/core/kingdoms-mode-state.d.ts +24 -0
- package/dist/core/kingdoms-mode-state.js +139 -0
- package/dist/core/licenza.d.ts +38 -0
- package/dist/core/licenza.js +125 -0
- package/dist/core/model-limits.d.ts +2 -0
- package/dist/core/model-limits.js +36 -0
- package/dist/core/output-lifecycle.d.ts +44 -0
- package/dist/core/output-lifecycle.js +190 -0
- package/dist/core/package-update.d.ts +15 -0
- package/dist/core/package-update.js +121 -0
- package/dist/core/permission-queue.d.ts +2 -0
- package/dist/core/permission-queue.js +20 -0
- package/dist/core/prompt-attachment.d.ts +21 -0
- package/dist/core/prompt-attachment.js +123 -0
- package/dist/core/request-plan.d.ts +16 -0
- package/dist/core/request-plan.js +36 -0
- package/dist/core/run-timing.d.ts +17 -0
- package/dist/core/run-timing.js +123 -0
- package/dist/core/self-update.d.ts +17 -0
- package/dist/core/self-update.js +54 -0
- package/dist/core/session-refs.d.ts +27 -0
- package/dist/core/session-refs.js +126 -0
- package/dist/core/session-storage.d.ts +4 -0
- package/dist/core/session-storage.js +48 -0
- package/dist/core/session-title.d.ts +1 -0
- package/dist/core/session-title.js +21 -0
- package/dist/core/session-usage.d.ts +17 -0
- package/dist/core/session-usage.js +74 -0
- package/dist/core/session.d.ts +58 -0
- package/dist/core/session.js +296 -0
- package/dist/core/settings.d.ts +17 -0
- package/dist/core/settings.js +107 -0
- package/dist/core/storage-retention.d.ts +21 -0
- package/dist/core/storage-retention.js +227 -0
- package/dist/core/text-sanitize.d.ts +1 -0
- package/dist/core/text-sanitize.js +35 -0
- package/dist/core/tool-artifacts.d.ts +6 -0
- package/dist/core/tool-artifacts.js +51 -0
- package/dist/core/tool-compress.d.ts +8 -0
- package/dist/core/tool-compress.js +111 -0
- package/dist/core/tool-executor.d.ts +16 -0
- package/dist/core/tool-executor.js +97 -0
- package/dist/core/tool-result-index.d.ts +52 -0
- package/dist/core/tool-result-index.js +327 -0
- package/dist/core/tool-result-store.d.ts +38 -0
- package/dist/core/tool-result-store.js +190 -0
- package/dist/core/tool-scheduler.d.ts +16 -0
- package/dist/core/tool-scheduler.js +35 -0
- package/dist/core/trust.d.ts +21 -0
- package/dist/core/trust.js +95 -0
- package/dist/core/types.d.ts +402 -0
- package/dist/core/types.js +1 -0
- package/dist/core/update-check.d.ts +26 -0
- package/dist/core/update-check.js +89 -0
- package/dist/core/update-process.d.ts +10 -0
- package/dist/core/update-process.js +31 -0
- package/dist/core/user-inbox.d.ts +23 -0
- package/dist/core/user-inbox.js +56 -0
- package/dist/core/user-input.d.ts +10 -0
- package/dist/core/user-input.js +35 -0
- package/dist/core/version.d.ts +1 -0
- package/dist/core/version.js +10 -0
- package/dist/core/vibe-modes.d.ts +38 -0
- package/dist/core/vibe-modes.js +383 -0
- package/dist/core/workspace-roots.d.ts +13 -0
- package/dist/core/workspace-roots.js +91 -0
- package/dist/core/workspace-sessions.d.ts +51 -0
- package/dist/core/workspace-sessions.js +243 -0
- package/dist/cowork/client.d.ts +29 -0
- package/dist/cowork/client.js +49 -0
- package/dist/cowork/engine-bridge.d.ts +22 -0
- package/dist/cowork/engine-bridge.js +98 -0
- package/dist/cowork/index.d.ts +11 -0
- package/dist/cowork/index.js +16 -0
- package/dist/cowork/ipc.d.ts +97 -0
- package/dist/cowork/ipc.js +96 -0
- package/dist/cowork/manager.d.ts +66 -0
- package/dist/cowork/manager.js +325 -0
- package/dist/cowork/store.d.ts +23 -0
- package/dist/cowork/store.js +182 -0
- package/dist/cowork/sync.d.ts +20 -0
- package/dist/cowork/sync.js +164 -0
- package/dist/cowork/types.d.ts +78 -0
- package/dist/cowork/types.js +21 -0
- package/dist/extensions/ext-tools.d.ts +3 -0
- package/dist/extensions/ext-tools.js +73 -0
- package/dist/extensions/loader.d.ts +91 -0
- package/dist/extensions/loader.js +474 -0
- package/dist/extensions/settings.d.ts +20 -0
- package/dist/extensions/settings.js +86 -0
- package/dist/extensions/types.d.ts +219 -0
- package/dist/extensions/types.js +1 -0
- package/dist/horizon/async-queue.d.ts +9 -0
- package/dist/horizon/async-queue.js +46 -0
- package/dist/horizon/engine.d.ts +85 -0
- package/dist/horizon/engine.js +603 -0
- package/dist/horizon/index.d.ts +4 -0
- package/dist/horizon/index.js +2 -0
- package/dist/horizon/main-team.d.ts +163 -0
- package/dist/horizon/main-team.js +774 -0
- package/dist/horizon/types.d.ts +233 -0
- package/dist/horizon/types.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +233 -0
- package/dist/mcp/protocol.d.ts +81 -0
- package/dist/mcp/protocol.js +122 -0
- package/dist/package.json +1 -0
- package/dist/packages/packages.d.ts +12 -0
- package/dist/packages/packages.js +323 -0
- package/dist/prompts/templates.d.ts +13 -0
- package/dist/prompts/templates.js +139 -0
- package/dist/providers/anthropic-oauth.d.ts +13 -0
- package/dist/providers/anthropic-oauth.js +124 -0
- package/dist/providers/anthropic.d.ts +27 -0
- package/dist/providers/anthropic.js +526 -0
- package/dist/providers/catalog.d.ts +15 -0
- package/dist/providers/catalog.js +166 -0
- package/dist/providers/effort.d.ts +12 -0
- package/dist/providers/effort.js +102 -0
- package/dist/providers/model-catalog.d.ts +43 -0
- package/dist/providers/model-catalog.js +70 -0
- package/dist/providers/model-effort.d.ts +5 -0
- package/dist/providers/model-effort.js +43 -0
- package/dist/providers/model-registry.d.ts +39 -0
- package/dist/providers/model-registry.js +142 -0
- package/dist/providers/models-dev.d.ts +9 -0
- package/dist/providers/models-dev.js +97 -0
- package/dist/providers/oauth-callback-server.d.ts +28 -0
- package/dist/providers/oauth-callback-server.js +184 -0
- package/dist/providers/oauth-orchestrator.d.ts +58 -0
- package/dist/providers/oauth-orchestrator.js +159 -0
- package/dist/providers/oauth-store.d.ts +12 -0
- package/dist/providers/oauth-store.js +139 -0
- package/dist/providers/open-browser.d.ts +20 -0
- package/dist/providers/open-browser.js +92 -0
- package/dist/providers/openai-compat.d.ts +14 -0
- package/dist/providers/openai-compat.js +523 -0
- package/dist/providers/openai-oauth.d.ts +15 -0
- package/dist/providers/openai-oauth.js +382 -0
- package/dist/providers/openrouter-auth.d.ts +73 -0
- package/dist/providers/openrouter-auth.js +321 -0
- package/dist/providers/openrouter-manual-fallback.d.ts +25 -0
- package/dist/providers/openrouter-manual-fallback.js +161 -0
- package/dist/providers/openrouter.d.ts +15 -0
- package/dist/providers/openrouter.js +107 -0
- package/dist/providers/plan-limits.d.ts +6 -0
- package/dist/providers/plan-limits.js +175 -0
- package/dist/providers/provider-reset.d.ts +4 -0
- package/dist/providers/provider-reset.js +83 -0
- package/dist/providers/quota-limits.d.ts +4 -0
- package/dist/providers/quota-limits.js +33 -0
- package/dist/providers/registry.d.ts +33 -0
- package/dist/providers/registry.js +213 -0
- package/dist/providers/retry.d.ts +37 -0
- package/dist/providers/retry.js +347 -0
- package/dist/rpc/server.d.ts +23 -0
- package/dist/rpc/server.js +222 -0
- package/dist/sdk.d.ts +67 -0
- package/dist/sdk.js +64 -0
- package/dist/skills/skills.d.ts +17 -0
- package/dist/skills/skills.js +155 -0
- package/dist/text-sanitize.js +28 -0
- package/dist/tools/ask-user.d.ts +2 -0
- package/dist/tools/ask-user.js +60 -0
- package/dist/tools/builtin.d.ts +48 -0
- package/dist/tools/builtin.js +2494 -0
- package/dist/tools/capabilities.d.ts +5 -0
- package/dist/tools/capabilities.js +55 -0
- package/dist/tools/computer-capture.d.ts +2 -0
- package/dist/tools/computer-capture.js +91 -0
- package/dist/tools/computer-posix.d.ts +5 -0
- package/dist/tools/computer-posix.js +136 -0
- package/dist/tools/computer-use.d.ts +14 -0
- package/dist/tools/computer-use.js +108 -0
- package/dist/tools/discovery.d.ts +12 -0
- package/dist/tools/discovery.js +205 -0
- package/dist/tools/execute.d.ts +2 -0
- package/dist/tools/execute.js +73 -0
- package/dist/tools/normalize-input.d.ts +17 -0
- package/dist/tools/normalize-input.js +174 -0
- package/dist/tools/output-artifact.d.ts +3 -0
- package/dist/tools/output-artifact.js +80 -0
- package/dist/tools/pagination.d.ts +15 -0
- package/dist/tools/pagination.js +93 -0
- package/dist/tools/plan-status.d.ts +2 -0
- package/dist/tools/plan-status.js +109 -0
- package/dist/tools/program-input.d.ts +3 -0
- package/dist/tools/program-input.js +19 -0
- package/dist/tools/program.d.ts +3 -0
- package/dist/tools/program.js +567 -0
- package/dist/tools/protocol-catalog.d.ts +12 -0
- package/dist/tools/protocol-catalog.js +46 -0
- package/dist/tools/ramification-tools.d.ts +12 -0
- package/dist/tools/ramification-tools.js +528 -0
- package/dist/tools/regex-compat.d.ts +9 -0
- package/dist/tools/regex-compat.js +96 -0
- package/dist/tools/registry.d.ts +51 -0
- package/dist/tools/registry.js +185 -0
- package/dist/tools/resolve.d.ts +2 -0
- package/dist/tools/resolve.js +107 -0
- package/dist/tools/shell-env.d.ts +2 -0
- package/dist/tools/shell-env.js +7 -0
- package/dist/tools/team-input.d.ts +3 -0
- package/dist/tools/team-input.js +129 -0
- package/dist/tools/team-tools.d.ts +7 -0
- package/dist/tools/team-tools.js +348 -0
- package/dist/tools/workspace-sessions.d.ts +2 -0
- package/dist/tools/workspace-sessions.js +35 -0
- package/dist/tui/account-entry.d.ts +1 -0
- package/dist/tui/account-entry.js +93 -0
- package/dist/tui/attachment-highlight.d.ts +1 -0
- package/dist/tui/attachment-highlight.js +24 -0
- package/dist/tui/attachment-refs.d.ts +2 -0
- package/dist/tui/attachment-refs.js +3 -0
- package/dist/tui/bottom-input.d.ts +219 -0
- package/dist/tui/bottom-input.js +1958 -0
- package/dist/tui/branding.d.ts +107 -0
- package/dist/tui/branding.js +750 -0
- package/dist/tui/clipboard-image.d.ts +10 -0
- package/dist/tui/clipboard-image.js +163 -0
- package/dist/tui/clipboard-text.d.ts +9 -0
- package/dist/tui/clipboard-text.js +51 -0
- package/dist/tui/clipboard-windows.d.ts +8 -0
- package/dist/tui/clipboard-windows.js +84 -0
- package/dist/tui/collapsible-command.d.ts +15 -0
- package/dist/tui/collapsible-command.js +48 -0
- package/dist/tui/command-feedback.d.ts +10 -0
- package/dist/tui/command-feedback.js +46 -0
- package/dist/tui/command-output-registry.d.ts +28 -0
- package/dist/tui/command-output-registry.js +103 -0
- package/dist/tui/command-transcript.d.ts +12 -0
- package/dist/tui/command-transcript.js +90 -0
- package/dist/tui/commands.d.ts +20 -0
- package/dist/tui/commands.js +131 -0
- package/dist/tui/context-bar.d.ts +4 -0
- package/dist/tui/context-bar.js +74 -0
- package/dist/tui/context-meter.d.ts +25 -0
- package/dist/tui/context-meter.js +81 -0
- package/dist/tui/cost-binding.d.ts +8 -0
- package/dist/tui/cost-binding.js +43 -0
- package/dist/tui/cost-tracker.d.ts +49 -0
- package/dist/tui/cost-tracker.js +122 -0
- package/dist/tui/diff.d.ts +9 -0
- package/dist/tui/diff.js +119 -0
- package/dist/tui/i18n-catalog.d.ts +5 -0
- package/dist/tui/i18n-catalog.js +184 -0
- package/dist/tui/i18n.d.ts +6 -0
- package/dist/tui/i18n.js +10 -0
- package/dist/tui/image-attachments.d.ts +46 -0
- package/dist/tui/image-attachments.js +167 -0
- package/dist/tui/images.d.ts +12 -0
- package/dist/tui/images.js +87 -0
- package/dist/tui/intro.d.ts +13 -0
- package/dist/tui/intro.js +109 -0
- package/dist/tui/language-preference.d.ts +6 -0
- package/dist/tui/language-preference.js +24 -0
- package/dist/tui/live-output.d.ts +2 -0
- package/dist/tui/live-output.js +18 -0
- package/dist/tui/locales.d.ts +19 -0
- package/dist/tui/locales.js +22 -0
- package/dist/tui/login-menu.d.ts +17 -0
- package/dist/tui/login-menu.js +58 -0
- package/dist/tui/logo.d.ts +8 -0
- package/dist/tui/logo.js +305 -0
- package/dist/tui/markdown-inline.d.ts +3 -0
- package/dist/tui/markdown-inline.js +99 -0
- package/dist/tui/markdown-table.d.ts +4 -0
- package/dist/tui/markdown-table.js +63 -0
- package/dist/tui/markdown.d.ts +11 -0
- package/dist/tui/markdown.js +257 -0
- package/dist/tui/mcp-transcript.d.ts +7 -0
- package/dist/tui/mcp-transcript.js +40 -0
- package/dist/tui/model-details.d.ts +2 -0
- package/dist/tui/model-details.js +21 -0
- package/dist/tui/model-selection.d.ts +7 -0
- package/dist/tui/model-selection.js +41 -0
- package/dist/tui/native-scrollback.d.ts +27 -0
- package/dist/tui/native-scrollback.js +134 -0
- package/dist/tui/onboarding.d.ts +72 -0
- package/dist/tui/onboarding.js +207 -0
- package/dist/tui/paste-collapse.d.ts +39 -0
- package/dist/tui/paste-collapse.js +117 -0
- package/dist/tui/perm-mode.d.ts +8 -0
- package/dist/tui/perm-mode.js +41 -0
- package/dist/tui/prompt-queue-store.d.ts +26 -0
- package/dist/tui/prompt-queue-store.js +87 -0
- package/dist/tui/prompt-queue.d.ts +47 -0
- package/dist/tui/prompt-queue.js +187 -0
- package/dist/tui/provider-menu.d.ts +33 -0
- package/dist/tui/provider-menu.js +175 -0
- package/dist/tui/question.d.ts +24 -0
- package/dist/tui/question.js +32 -0
- package/dist/tui/queue-screen.d.ts +25 -0
- package/dist/tui/queue-screen.js +152 -0
- package/dist/tui/queue-team.d.ts +3 -0
- package/dist/tui/queue-team.js +28 -0
- package/dist/tui/queued-questions.d.ts +20 -0
- package/dist/tui/queued-questions.js +163 -0
- package/dist/tui/quick-help.d.ts +1 -0
- package/dist/tui/quick-help.js +53 -0
- package/dist/tui/repl.d.ts +78 -0
- package/dist/tui/repl.js +4130 -0
- package/dist/tui/restore-queued-input.d.ts +3 -0
- package/dist/tui/restore-queued-input.js +20 -0
- package/dist/tui/review-detail.d.ts +6 -0
- package/dist/tui/review-detail.js +56 -0
- package/dist/tui/review-files.d.ts +3 -0
- package/dist/tui/review-files.js +22 -0
- package/dist/tui/review-render.d.ts +22 -0
- package/dist/tui/review-render.js +98 -0
- package/dist/tui/review-screen.d.ts +38 -0
- package/dist/tui/review-screen.js +358 -0
- package/dist/tui/review-store.d.ts +60 -0
- package/dist/tui/review-store.js +270 -0
- package/dist/tui/review-team.d.ts +2 -0
- package/dist/tui/review-team.js +27 -0
- package/dist/tui/selector-mouse.d.ts +26 -0
- package/dist/tui/selector-mouse.js +65 -0
- package/dist/tui/selector.d.ts +51 -0
- package/dist/tui/selector.js +299 -0
- package/dist/tui/session-replay.d.ts +10 -0
- package/dist/tui/session-replay.js +78 -0
- package/dist/tui/session-usage.d.ts +22 -0
- package/dist/tui/session-usage.js +55 -0
- package/dist/tui/skill-transcript.d.ts +5 -0
- package/dist/tui/skill-transcript.js +31 -0
- package/dist/tui/startup.d.ts +5 -0
- package/dist/tui/startup.js +61 -0
- package/dist/tui/status-line-loader.d.ts +8 -0
- package/dist/tui/status-line-loader.js +33 -0
- package/dist/tui/status-line.d.ts +38 -0
- package/dist/tui/status-line.js +213 -0
- package/dist/tui/system-language.d.ts +8 -0
- package/dist/tui/system-language.js +41 -0
- package/dist/tui/task-labels.d.ts +2 -0
- package/dist/tui/task-labels.js +7 -0
- package/dist/tui/term-bg.d.ts +4 -0
- package/dist/tui/term-bg.js +67 -0
- package/dist/tui/terminal-screen.d.ts +12 -0
- package/dist/tui/terminal-screen.js +1 -0
- package/dist/tui/terminal-text.d.ts +7 -0
- package/dist/tui/terminal-text.js +123 -0
- package/dist/tui/theme.d.ts +25 -0
- package/dist/tui/theme.js +383 -0
- package/dist/tui/tool-style.d.ts +7 -0
- package/dist/tui/tool-style.js +119 -0
- package/dist/tui/update-prompt.d.ts +14 -0
- package/dist/tui/update-prompt.js +104 -0
- package/dist/tui/usage-footer.d.ts +9 -0
- package/dist/tui/usage-footer.js +123 -0
- package/dist/tui/vascend-login.d.ts +68 -0
- package/dist/tui/vascend-login.js +355 -0
- package/dist/tui/web-login.d.ts +28 -0
- package/dist/tui/web-login.js +115 -0
- package/dist/vascend/activity-status.d.ts +12 -0
- package/dist/vascend/activity-status.js +68 -0
- package/dist/vascend/architecture-map.d.ts +73 -0
- package/dist/vascend/architecture-map.js +424 -0
- package/dist/vascend/attention-layout.d.ts +19 -0
- package/dist/vascend/attention-layout.js +141 -0
- package/dist/vascend/budget-allocator.d.ts +31 -0
- package/dist/vascend/budget-allocator.js +79 -0
- package/dist/vascend/candidate-collector.d.ts +20 -0
- package/dist/vascend/candidate-collector.js +220 -0
- package/dist/vascend/code-events.d.ts +24 -0
- package/dist/vascend/code-events.js +304 -0
- package/dist/vascend/code-graph-memory.d.ts +38 -0
- package/dist/vascend/code-graph-memory.js +334 -0
- package/dist/vascend/code-graph-runtime.d.ts +19 -0
- package/dist/vascend/code-graph-runtime.js +190 -0
- package/dist/vascend/code-graph-types.d.ts +58 -0
- package/dist/vascend/code-graph-types.js +50 -0
- package/dist/vascend/code-parser.d.ts +4 -0
- package/dist/vascend/code-parser.js +257 -0
- package/dist/vascend/competitor-knowledge.d.ts +53 -0
- package/dist/vascend/competitor-knowledge.js +262 -0
- package/dist/vascend/completeness.d.ts +16 -0
- package/dist/vascend/completeness.js +90 -0
- package/dist/vascend/context-autotuner.d.ts +45 -0
- package/dist/vascend/context-autotuner.js +231 -0
- package/dist/vascend/context-candidate.d.ts +45 -0
- package/dist/vascend/context-candidate.js +150 -0
- package/dist/vascend/context-capsule.d.ts +51 -0
- package/dist/vascend/context-capsule.js +133 -0
- package/dist/vascend/context-fabric.d.ts +108 -0
- package/dist/vascend/context-fabric.js +480 -0
- package/dist/vascend/context-feedback-loop.d.ts +56 -0
- package/dist/vascend/context-feedback-loop.js +204 -0
- package/dist/vascend/context-learning-identity.d.ts +4 -0
- package/dist/vascend/context-learning-identity.js +8 -0
- package/dist/vascend/context-links.d.ts +14 -0
- package/dist/vascend/context-links.js +83 -0
- package/dist/vascend/context-lint.d.ts +22 -0
- package/dist/vascend/context-lint.js +91 -0
- package/dist/vascend/context-market-selection.d.ts +17 -0
- package/dist/vascend/context-market-selection.js +50 -0
- package/dist/vascend/context-metrics.d.ts +25 -0
- package/dist/vascend/context-metrics.js +57 -0
- package/dist/vascend/context-pack-render.d.ts +16 -0
- package/dist/vascend/context-pack-render.js +52 -0
- package/dist/vascend/context-pareto.d.ts +33 -0
- package/dist/vascend/context-pareto.js +165 -0
- package/dist/vascend/context-pattern-explorer.d.ts +41 -0
- package/dist/vascend/context-pattern-explorer.js +276 -0
- package/dist/vascend/context-regret.d.ts +32 -0
- package/dist/vascend/context-regret.js +93 -0
- package/dist/vascend/context-retriever.d.ts +22 -0
- package/dist/vascend/context-retriever.js +243 -0
- package/dist/vascend/context-scope-index.d.ts +5 -0
- package/dist/vascend/context-scope-index.js +96 -0
- package/dist/vascend/context-scorer.d.ts +35 -0
- package/dist/vascend/context-scorer.js +162 -0
- package/dist/vascend/context-search-index.d.ts +12 -0
- package/dist/vascend/context-search-index.js +25 -0
- package/dist/vascend/context-snapshot.d.ts +22 -0
- package/dist/vascend/context-snapshot.js +135 -0
- package/dist/vascend/context-window-compiler.d.ts +42 -0
- package/dist/vascend/context-window-compiler.js +237 -0
- package/dist/vascend/contract-memory.d.ts +61 -0
- package/dist/vascend/contract-memory.js +435 -0
- package/dist/vascend/council.d.ts +58 -0
- package/dist/vascend/council.js +337 -0
- package/dist/vascend/decision-promotion.d.ts +48 -0
- package/dist/vascend/decision-promotion.js +410 -0
- package/dist/vascend/delta-context.d.ts +12 -0
- package/dist/vascend/delta-context.js +36 -0
- package/dist/vascend/dev-context-compiler.d.ts +27 -0
- package/dist/vascend/dev-context-compiler.js +133 -0
- package/dist/vascend/dev-context-layout.d.ts +30 -0
- package/dist/vascend/dev-context-layout.js +262 -0
- package/dist/vascend/evidence-slots.d.ts +14 -0
- package/dist/vascend/evidence-slots.js +55 -0
- package/dist/vascend/expansion-levels.d.ts +15 -0
- package/dist/vascend/expansion-levels.js +178 -0
- package/dist/vascend/file-lock.d.ts +7 -0
- package/dist/vascend/file-lock.js +95 -0
- package/dist/vascend/granular-kingdom.d.ts +25 -0
- package/dist/vascend/granular-kingdom.js +259 -0
- package/dist/vascend/granular-launcher.d.ts +48 -0
- package/dist/vascend/granular-launcher.js +202 -0
- package/dist/vascend/kingdom-bus.d.ts +25 -0
- package/dist/vascend/kingdom-bus.js +54 -0
- package/dist/vascend/kingdom-channel.d.ts +22 -0
- package/dist/vascend/kingdom-channel.js +180 -0
- package/dist/vascend/kingdom-kpi.d.ts +48 -0
- package/dist/vascend/kingdom-kpi.js +172 -0
- package/dist/vascend/kingdom-live.d.ts +28 -0
- package/dist/vascend/kingdom-live.js +61 -0
- package/dist/vascend/kingdom-run.d.ts +18 -0
- package/dist/vascend/kingdom-run.js +506 -0
- package/dist/vascend/kingdom-scribe.d.ts +20 -0
- package/dist/vascend/kingdom-scribe.js +52 -0
- package/dist/vascend/kingdom.d.ts +79 -0
- package/dist/vascend/kingdom.js +870 -0
- package/dist/vascend/lexical-index.d.ts +10 -0
- package/dist/vascend/lexical-index.js +99 -0
- package/dist/vascend/lexical-search.d.ts +29 -0
- package/dist/vascend/lexical-search.js +262 -0
- package/dist/vascend/long-term-context.d.ts +51 -0
- package/dist/vascend/long-term-context.js +194 -0
- package/dist/vascend/mandate.d.ts +33 -0
- package/dist/vascend/mandate.js +107 -0
- package/dist/vascend/memory-packet.d.ts +13 -0
- package/dist/vascend/memory-packet.js +155 -0
- package/dist/vascend/memory-status.d.ts +22 -0
- package/dist/vascend/memory-status.js +73 -0
- package/dist/vascend/memory-store.d.ts +62 -0
- package/dist/vascend/memory-store.js +273 -0
- package/dist/vascend/objective-revision.d.ts +69 -0
- package/dist/vascend/objective-revision.js +319 -0
- package/dist/vascend/patch-plan-store.d.ts +33 -0
- package/dist/vascend/patch-plan-store.js +240 -0
- package/dist/vascend/patch-plan.d.ts +97 -0
- package/dist/vascend/patch-plan.js +345 -0
- package/dist/vascend/plan-progress.d.ts +11 -0
- package/dist/vascend/plan-progress.js +68 -0
- package/dist/vascend/plan-store.d.ts +64 -0
- package/dist/vascend/plan-store.js +460 -0
- package/dist/vascend/proof-chains.d.ts +19 -0
- package/dist/vascend/proof-chains.js +120 -0
- package/dist/vascend/ramification-store.d.ts +25 -0
- package/dist/vascend/ramification-store.js +94 -0
- package/dist/vascend/ramification.d.ts +193 -0
- package/dist/vascend/ramification.js +583 -0
- package/dist/vascend/recall-planner.d.ts +17 -0
- package/dist/vascend/recall-planner.js +109 -0
- package/dist/vascend/requirements.d.ts +31 -0
- package/dist/vascend/requirements.js +151 -0
- package/dist/vascend/reviewer.d.ts +9 -0
- package/dist/vascend/reviewer.js +93 -0
- package/dist/vascend/room-graph.d.ts +29 -0
- package/dist/vascend/room-graph.js +242 -0
- package/dist/vascend/room-memory.d.ts +57 -0
- package/dist/vascend/room-memory.js +631 -0
- package/dist/vascend/runtime.d.ts +84 -0
- package/dist/vascend/runtime.js +286 -0
- package/dist/vascend/self-improve.d.ts +104 -0
- package/dist/vascend/self-improve.js +396 -0
- package/dist/vascend/session-search.d.ts +52 -0
- package/dist/vascend/session-search.js +349 -0
- package/dist/vascend/supersession-graph.d.ts +14 -0
- package/dist/vascend/supersession-graph.js +70 -0
- package/dist/vascend/team-areas.d.ts +9 -0
- package/dist/vascend/team-areas.js +28 -0
- package/dist/vascend/team-handoff.d.ts +24 -0
- package/dist/vascend/team-handoff.js +37 -0
- package/dist/vascend/team-scheduler.d.ts +13 -0
- package/dist/vascend/team-scheduler.js +74 -0
- package/dist/vascend/team-session.d.ts +42 -0
- package/dist/vascend/team-session.js +142 -0
- package/dist/vascend/test-failure-memory.d.ts +76 -0
- package/dist/vascend/test-failure-memory.js +354 -0
- package/dist/vascend/token-market.d.ts +42 -0
- package/dist/vascend/token-market.js +144 -0
- package/dist/vascend/tuner-baseline-store.d.ts +52 -0
- package/dist/vascend/tuner-baseline-store.js +446 -0
- package/dist/vascend/user-profile.d.ts +44 -0
- package/dist/vascend/user-profile.js +131 -0
- package/dist/vascend/vision.d.ts +94 -0
- package/dist/vascend/vision.js +375 -0
- package/dist/vascend/work-agent.d.ts +12 -0
- package/dist/vascend/work-agent.js +83 -0
- package/dist/vascend/work-queue.d.ts +62 -0
- package/dist/vascend/work-queue.js +255 -0
- package/dist/vascend/work-runner.d.ts +64 -0
- package/dist/vascend/work-runner.js +137 -0
- package/dist/vascend/worktree.d.ts +38 -0
- package/dist/vascend/worktree.js +206 -0
- package/dist/vendor/computer-use/README.md +7 -0
- package/dist/vendor/computer-use/computer-desktop.js +211 -0
- package/dist/vendor/computer-use/computer-observe.js +315 -0
- package/dist/vendor/computer-use/computer-scripts.js +1230 -0
- package/dist/vendor/computer-use/computer-tools.js +2136 -0
- package/dist/vendor/computer-use/package.json +1 -0
- package/dist/vendor/computer-use/rac/atomic-input.js +91 -0
- package/dist/vendor/computer-use/rac/grammatica.js +101 -0
- package/dist/vendor/computer-use/rac/parser.js +185 -0
- package/dist/vendor/computer-use/rac/protocol.js +136 -0
- package/install.ps1 +30 -0
- package/install.sh +50 -0
- package/package.json +56 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Bridge IPC di Cowork: contratto host-agnostico tra il processo main (dove
|
|
2
|
+
// vive il CoworkManager e l'engine) e il renderer della UI desktop.
|
|
3
|
+
//
|
|
4
|
+
// Non assume Electron/Tauri/WebView specifici: definisce un canale astratto
|
|
5
|
+
// request/response + uno stream di eventi push. La shell desktop
|
|
6
|
+
// (desktop-app-shell) lo collega al suo trasporto reale (ipcMain/ipcRenderer,
|
|
7
|
+
// __TAURI__.invoke, postMessage, ecc.) con poche righe di adattatore.
|
|
8
|
+
//
|
|
9
|
+
// Pattern: il renderer chiama `request(method, params)`; il main esegue il
|
|
10
|
+
// metodo sul CoworkManager e risponde. Per gli stream (eventi agente, sync,
|
|
11
|
+
// presence) il main invia `push(channel, payload)` che il renderer ascolta.
|
|
12
|
+
import { CoworkManager } from "./manager.js";
|
|
13
|
+
// Canale di un evento agente per una sessione.
|
|
14
|
+
export function agentChannel(workspaceId, sessionId) {
|
|
15
|
+
return `agent:${workspaceId}/${sessionId}`;
|
|
16
|
+
}
|
|
17
|
+
// Canale degli eventi sync di un workspace.
|
|
18
|
+
export function syncChannel(workspaceId) {
|
|
19
|
+
return `sync:${workspaceId}`;
|
|
20
|
+
}
|
|
21
|
+
// Crea l'handler IPC lato main: una funzione `handle(method, params)` che la
|
|
22
|
+
// shell collega al suo canale request/response, più `push` per gli stream.
|
|
23
|
+
export function createCoworkIpc(manager, push) {
|
|
24
|
+
// Run attivi: runId -> abort.
|
|
25
|
+
const runs = new Map();
|
|
26
|
+
// Sottoscrizioni sync aperte: workspaceId -> unsubscribe.
|
|
27
|
+
const subscriptions = new Map();
|
|
28
|
+
let runCounter = 0;
|
|
29
|
+
const handlers = {
|
|
30
|
+
"workspace.list": (p) => manager.listWorkspaces(p.includeArchived),
|
|
31
|
+
"workspace.get": (p) => manager.getWorkspace(p.id),
|
|
32
|
+
"workspace.create": (p) => manager.createWorkspace(p),
|
|
33
|
+
"workspace.update": (p) => manager.updateWorkspace(p.id, p.patch),
|
|
34
|
+
"workspace.join": (p) => manager.joinWorkspace(p.id, p.role),
|
|
35
|
+
"workspace.leave": (p) => manager.leaveWorkspace(p.id, p.memberId),
|
|
36
|
+
"session.list": (p) => manager.listSessions(p.workspaceId, p.includeArchived),
|
|
37
|
+
"session.get": (p) => manager.getSession(p.workspaceId, p.sessionId),
|
|
38
|
+
"session.create": (p) => manager.createSession(p.workspaceId, { title: p.title, model: p.model }),
|
|
39
|
+
"session.update": (p) => manager.updateSession(p.workspaceId, p.sessionId, p.patch),
|
|
40
|
+
"session.messages": (p) => manager.listMessages(p.workspaceId, p.sessionId),
|
|
41
|
+
"session.prompt": (p) => {
|
|
42
|
+
runCounter += 1;
|
|
43
|
+
const runId = `run-${Date.now().toString(36)}-${runCounter}`;
|
|
44
|
+
const ch = agentChannel(p.workspaceId, p.sessionId);
|
|
45
|
+
const { done, abort } = manager.promptSession(p.workspaceId, p.sessionId, p.text, (event) => {
|
|
46
|
+
push(ch, { runId, event });
|
|
47
|
+
});
|
|
48
|
+
runs.set(runId, abort);
|
|
49
|
+
void done.finally(() => runs.delete(runId));
|
|
50
|
+
return { runId };
|
|
51
|
+
},
|
|
52
|
+
"session.abort": (p) => {
|
|
53
|
+
const abort = runs.get(p.runId);
|
|
54
|
+
if (abort)
|
|
55
|
+
abort();
|
|
56
|
+
return { ok: Boolean(abort) };
|
|
57
|
+
},
|
|
58
|
+
"presence.announce": (p) => manager.announcePresence(p.workspaceId, p.activeSessionId, p.status),
|
|
59
|
+
"presence.list": (p) => manager.listPresence(p.workspaceId),
|
|
60
|
+
"sync.open": (p) => {
|
|
61
|
+
if (!subscriptions.has(p.workspaceId)) {
|
|
62
|
+
const ch = syncChannel(p.workspaceId);
|
|
63
|
+
const unsub = manager.subscribe(p.workspaceId, (event) => push(ch, event));
|
|
64
|
+
subscriptions.set(p.workspaceId, unsub);
|
|
65
|
+
}
|
|
66
|
+
return { ok: true };
|
|
67
|
+
},
|
|
68
|
+
"sync.close": (p) => {
|
|
69
|
+
const unsub = subscriptions.get(p.workspaceId);
|
|
70
|
+
if (unsub) {
|
|
71
|
+
unsub();
|
|
72
|
+
subscriptions.delete(p.workspaceId);
|
|
73
|
+
}
|
|
74
|
+
return { ok: Boolean(unsub) };
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
return {
|
|
78
|
+
// Esegue un metodo IPC. La shell la chiama dal suo handler request/response.
|
|
79
|
+
async handle(method, params) {
|
|
80
|
+
const fn = handlers[method];
|
|
81
|
+
if (typeof fn !== "function") {
|
|
82
|
+
throw new Error(`metodo IPC Cowork sconosciuto: ${String(method)}`);
|
|
83
|
+
}
|
|
84
|
+
return fn(params);
|
|
85
|
+
},
|
|
86
|
+
// Rilascia risorse (sottoscrizioni sync, run attivi) alla chiusura.
|
|
87
|
+
dispose() {
|
|
88
|
+
for (const abort of runs.values())
|
|
89
|
+
abort();
|
|
90
|
+
runs.clear();
|
|
91
|
+
for (const unsub of subscriptions.values())
|
|
92
|
+
unsub();
|
|
93
|
+
subscriptions.clear();
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { AgentEvent } from "../core/types.js";
|
|
2
|
+
import { type ConfirmFn } from "./engine-bridge.js";
|
|
3
|
+
import { type CoworkMember, type CoworkMessage, type CoworkPresence, type CoworkRole, type CoworkSession, type CoworkSyncEvent, type CoworkWorkspace, type CoworkWorkspacePatch } from "./types.js";
|
|
4
|
+
export interface CoworkIdentity {
|
|
5
|
+
readonly memberId: string;
|
|
6
|
+
readonly displayName: string;
|
|
7
|
+
readonly userId?: string;
|
|
8
|
+
readonly clientId: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function localIdentity(overrides?: Partial<CoworkIdentity>): CoworkIdentity;
|
|
11
|
+
export interface ManagerOptions {
|
|
12
|
+
readonly baseDir?: string;
|
|
13
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
14
|
+
readonly confirm?: ConfirmFn;
|
|
15
|
+
readonly defaultModel?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class CoworkManager {
|
|
18
|
+
readonly identity: CoworkIdentity;
|
|
19
|
+
private readonly store;
|
|
20
|
+
private readonly env;
|
|
21
|
+
private readonly confirm;
|
|
22
|
+
private readonly defaultModel;
|
|
23
|
+
private readonly channels;
|
|
24
|
+
private readonly engines;
|
|
25
|
+
private readonly presence;
|
|
26
|
+
constructor(identity: CoworkIdentity, opts?: ManagerOptions);
|
|
27
|
+
listWorkspaces(includeArchived?: boolean): CoworkWorkspace[];
|
|
28
|
+
getWorkspace(id: string): CoworkWorkspace | null;
|
|
29
|
+
createWorkspace(input: {
|
|
30
|
+
name: string;
|
|
31
|
+
root: string;
|
|
32
|
+
model?: string;
|
|
33
|
+
}): CoworkWorkspace;
|
|
34
|
+
updateWorkspace(id: string, patch: CoworkWorkspacePatch): CoworkWorkspace;
|
|
35
|
+
joinWorkspace(id: string, role?: CoworkRole, member?: Partial<CoworkMember>): CoworkWorkspace;
|
|
36
|
+
leaveWorkspace(id: string, memberId?: string): CoworkWorkspace;
|
|
37
|
+
listSessions(workspaceId: string, includeArchived?: boolean): CoworkSession[];
|
|
38
|
+
getSession(workspaceId: string, sessionId: string): CoworkSession | null;
|
|
39
|
+
createSession(workspaceId: string, input?: {
|
|
40
|
+
title?: string;
|
|
41
|
+
model?: string;
|
|
42
|
+
}): CoworkSession;
|
|
43
|
+
updateSession(workspaceId: string, sessionId: string, patch: {
|
|
44
|
+
title?: string;
|
|
45
|
+
model?: string;
|
|
46
|
+
archived?: boolean;
|
|
47
|
+
}): CoworkSession;
|
|
48
|
+
listMessages(workspaceId: string, sessionId: string): CoworkMessage[];
|
|
49
|
+
promptSession(workspaceId: string, sessionId: string, text: string, onEvent?: (event: AgentEvent) => void): {
|
|
50
|
+
done: Promise<void>;
|
|
51
|
+
abort: () => void;
|
|
52
|
+
};
|
|
53
|
+
private engineFor;
|
|
54
|
+
private touchContributor;
|
|
55
|
+
announcePresence(workspaceId: string, activeSessionId: string | null, status?: CoworkPresence["status"]): CoworkPresence;
|
|
56
|
+
listPresence(workspaceId: string): CoworkPresence[];
|
|
57
|
+
private recordPresence;
|
|
58
|
+
private channel;
|
|
59
|
+
subscribe(workspaceId: string, listener: (event: CoworkSyncEvent) => void): () => void;
|
|
60
|
+
private onRemoteEvent;
|
|
61
|
+
private publishMessage;
|
|
62
|
+
private publishAgentEvent;
|
|
63
|
+
private assertRole;
|
|
64
|
+
abortAll(): void;
|
|
65
|
+
dispose(): void;
|
|
66
|
+
}
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
// CoworkManager: orchestratore del modulo Cowork desktop.
|
|
2
|
+
//
|
|
3
|
+
// Unisce i tre strati:
|
|
4
|
+
// - CoworkStore -> persistenza (workspace, sessioni, messaggi);
|
|
5
|
+
// - CoworkSyncChannel -> propagazione locale tra finestre;
|
|
6
|
+
// - CoworkEngine -> esecuzione dei prompt sul motore Vascend Talos.
|
|
7
|
+
//
|
|
8
|
+
// È il punto unico che il layer desktop (IPC/preload) espone al renderer.
|
|
9
|
+
// API immutabile: ritorna sempre nuovi oggetti, non muta gli input.
|
|
10
|
+
import { randomUUID } from "node:crypto";
|
|
11
|
+
import { hostname, userInfo } from "node:os";
|
|
12
|
+
import { CoworkStore } from "./store.js";
|
|
13
|
+
import { CoworkSyncChannel } from "./sync.js";
|
|
14
|
+
import { CoworkEngine } from "./engine-bridge.js";
|
|
15
|
+
import { CoworkError, } from "./types.js";
|
|
16
|
+
// Costruisce un'identità locale di default dall'utente di sistema.
|
|
17
|
+
export function localIdentity(overrides = {}) {
|
|
18
|
+
let name = "utente";
|
|
19
|
+
try {
|
|
20
|
+
name = userInfo().username || name;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
/* ambienti senza userInfo */
|
|
24
|
+
}
|
|
25
|
+
const memberId = overrides.memberId ?? `m-${name}@${safeHost()}`;
|
|
26
|
+
return {
|
|
27
|
+
memberId,
|
|
28
|
+
displayName: overrides.displayName ?? name,
|
|
29
|
+
userId: overrides.userId,
|
|
30
|
+
clientId: overrides.clientId ?? `c-${process.pid}-${randomUUID().slice(0, 8)}`,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function safeHost() {
|
|
34
|
+
try {
|
|
35
|
+
return hostname();
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return "local";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export class CoworkManager {
|
|
42
|
+
identity;
|
|
43
|
+
store;
|
|
44
|
+
env;
|
|
45
|
+
confirm;
|
|
46
|
+
defaultModel;
|
|
47
|
+
// Un canale di sync per workspace aperto.
|
|
48
|
+
channels = new Map();
|
|
49
|
+
// Un engine per sessione attiva: "<workspaceId>/<sessionId>".
|
|
50
|
+
engines = new Map();
|
|
51
|
+
// Presenza live per workspace: memberId+clientId -> presence.
|
|
52
|
+
presence = new Map();
|
|
53
|
+
constructor(identity, opts = {}) {
|
|
54
|
+
this.identity = identity;
|
|
55
|
+
this.env = opts.env ?? process.env;
|
|
56
|
+
this.store = new CoworkStore(opts.baseDir, this.env);
|
|
57
|
+
this.confirm = opts.confirm ?? (async () => false);
|
|
58
|
+
this.defaultModel = opts.defaultModel ?? this.env["TALOS_MODEL"] ?? "anthropic/claude-sonnet-4-6";
|
|
59
|
+
}
|
|
60
|
+
// ---- Workspace -----------------------------------------------------------
|
|
61
|
+
listWorkspaces(includeArchived = false) {
|
|
62
|
+
return this.store.listWorkspaces(includeArchived);
|
|
63
|
+
}
|
|
64
|
+
getWorkspace(id) {
|
|
65
|
+
return this.store.getWorkspace(id);
|
|
66
|
+
}
|
|
67
|
+
createWorkspace(input) {
|
|
68
|
+
const now = Date.now();
|
|
69
|
+
const owner = {
|
|
70
|
+
id: this.identity.memberId,
|
|
71
|
+
displayName: this.identity.displayName,
|
|
72
|
+
userId: this.identity.userId,
|
|
73
|
+
role: "owner",
|
|
74
|
+
joinedAt: now,
|
|
75
|
+
};
|
|
76
|
+
const ws = {
|
|
77
|
+
id: `ws-${now.toString(36)}-${randomUUID().slice(0, 6)}`,
|
|
78
|
+
name: input.name,
|
|
79
|
+
root: input.root,
|
|
80
|
+
model: input.model ?? this.defaultModel,
|
|
81
|
+
members: [owner],
|
|
82
|
+
createdBy: this.identity.memberId,
|
|
83
|
+
createdAt: now,
|
|
84
|
+
updatedAt: now,
|
|
85
|
+
archived: false,
|
|
86
|
+
};
|
|
87
|
+
this.store.putWorkspace(ws);
|
|
88
|
+
this.channel(ws.id).publish("workspace_created", ws);
|
|
89
|
+
return ws;
|
|
90
|
+
}
|
|
91
|
+
updateWorkspace(id, patch) {
|
|
92
|
+
const cur = this.store.requireWorkspace(id);
|
|
93
|
+
this.assertRole(cur, ["owner", "editor"]);
|
|
94
|
+
const next = {
|
|
95
|
+
...cur,
|
|
96
|
+
name: patch.name ?? cur.name,
|
|
97
|
+
model: patch.model ?? cur.model,
|
|
98
|
+
archived: patch.archived ?? cur.archived,
|
|
99
|
+
updatedAt: Date.now(),
|
|
100
|
+
};
|
|
101
|
+
this.store.putWorkspace(next);
|
|
102
|
+
this.channel(id).publish(patch.archived ? "workspace_archived" : "workspace_updated", next);
|
|
103
|
+
return next;
|
|
104
|
+
}
|
|
105
|
+
// Aggiunge un membro (join). Idempotente per memberId.
|
|
106
|
+
joinWorkspace(id, role = "editor", member) {
|
|
107
|
+
const cur = this.store.requireWorkspace(id);
|
|
108
|
+
const m = {
|
|
109
|
+
id: member?.id ?? this.identity.memberId,
|
|
110
|
+
displayName: member?.displayName ?? this.identity.displayName,
|
|
111
|
+
userId: member?.userId ?? this.identity.userId,
|
|
112
|
+
role: member?.role ?? role,
|
|
113
|
+
joinedAt: Date.now(),
|
|
114
|
+
};
|
|
115
|
+
const exists = cur.members.some((x) => x.id === m.id);
|
|
116
|
+
const members = exists ? cur.members.map((x) => (x.id === m.id ? m : x)) : [...cur.members, m];
|
|
117
|
+
const next = { ...cur, members, updatedAt: Date.now() };
|
|
118
|
+
this.store.putWorkspace(next);
|
|
119
|
+
this.channel(id).publish("member_joined", next);
|
|
120
|
+
return next;
|
|
121
|
+
}
|
|
122
|
+
leaveWorkspace(id, memberId = this.identity.memberId) {
|
|
123
|
+
const cur = this.store.requireWorkspace(id);
|
|
124
|
+
const next = {
|
|
125
|
+
...cur,
|
|
126
|
+
members: cur.members.filter((m) => m.id !== memberId),
|
|
127
|
+
updatedAt: Date.now(),
|
|
128
|
+
};
|
|
129
|
+
this.store.putWorkspace(next);
|
|
130
|
+
this.channel(id).publish("member_left", next);
|
|
131
|
+
return next;
|
|
132
|
+
}
|
|
133
|
+
// ---- Sessioni ------------------------------------------------------------
|
|
134
|
+
listSessions(workspaceId, includeArchived = false) {
|
|
135
|
+
return this.store.listSessions(workspaceId, includeArchived);
|
|
136
|
+
}
|
|
137
|
+
getSession(workspaceId, sessionId) {
|
|
138
|
+
return this.store.getSession(workspaceId, sessionId);
|
|
139
|
+
}
|
|
140
|
+
createSession(workspaceId, input = {}) {
|
|
141
|
+
const ws = this.store.requireWorkspace(workspaceId);
|
|
142
|
+
this.assertRole(ws, ["owner", "editor"]);
|
|
143
|
+
const now = Date.now();
|
|
144
|
+
const session = {
|
|
145
|
+
id: `s-${now.toString(36)}`,
|
|
146
|
+
workspaceId,
|
|
147
|
+
title: input.title ?? "Nuova sessione",
|
|
148
|
+
model: input.model ?? ws.model,
|
|
149
|
+
createdBy: this.identity.memberId,
|
|
150
|
+
createdAt: now,
|
|
151
|
+
updatedAt: now,
|
|
152
|
+
contributors: [this.identity.memberId],
|
|
153
|
+
archived: false,
|
|
154
|
+
};
|
|
155
|
+
this.store.putSession(session);
|
|
156
|
+
this.channel(workspaceId).publish("session_created", session);
|
|
157
|
+
return session;
|
|
158
|
+
}
|
|
159
|
+
updateSession(workspaceId, sessionId, patch) {
|
|
160
|
+
const cur = this.store.requireSession(workspaceId, sessionId);
|
|
161
|
+
const next = {
|
|
162
|
+
...cur,
|
|
163
|
+
title: patch.title ?? cur.title,
|
|
164
|
+
model: patch.model ?? cur.model,
|
|
165
|
+
archived: patch.archived ?? cur.archived,
|
|
166
|
+
updatedAt: Date.now(),
|
|
167
|
+
};
|
|
168
|
+
this.store.putSession(next);
|
|
169
|
+
this.channel(workspaceId).publish(patch.archived ? "session_archived" : "session_updated", next);
|
|
170
|
+
return next;
|
|
171
|
+
}
|
|
172
|
+
listMessages(workspaceId, sessionId) {
|
|
173
|
+
return this.store.listMessages(workspaceId, sessionId);
|
|
174
|
+
}
|
|
175
|
+
// ---- Esecuzione prompt (engine + persistenza + sync) ---------------------
|
|
176
|
+
// Invia un prompt a una sessione: registra il messaggio utente, esegue il
|
|
177
|
+
// turno engine e per ogni AgentEvent persiste/propaga. `onEvent` riceve gli
|
|
178
|
+
// eventi locali in tempo reale (per la UI della finestra che ha promptato).
|
|
179
|
+
promptSession(workspaceId, sessionId, text, onEvent) {
|
|
180
|
+
const ws = this.store.requireWorkspace(workspaceId);
|
|
181
|
+
this.assertRole(ws, ["owner", "editor"]);
|
|
182
|
+
const session = this.store.requireSession(workspaceId, sessionId);
|
|
183
|
+
// Messaggio utente: persistito + propagato subito (così le altre finestre
|
|
184
|
+
// lo vedono prima ancora della risposta).
|
|
185
|
+
const userMsg = {
|
|
186
|
+
role: "user",
|
|
187
|
+
text,
|
|
188
|
+
authorId: this.identity.memberId,
|
|
189
|
+
ts: Date.now(),
|
|
190
|
+
};
|
|
191
|
+
this.store.appendMessage(workspaceId, sessionId, userMsg);
|
|
192
|
+
this.publishMessage(workspaceId, sessionId, userMsg);
|
|
193
|
+
this.touchContributor(session);
|
|
194
|
+
const engine = this.engineFor(ws, session);
|
|
195
|
+
// Accumula il testo assistant in streaming per persistere un solo
|
|
196
|
+
// messaggio a fine giro.
|
|
197
|
+
let assistantText = "";
|
|
198
|
+
const handle = engine.prompt(text, (event) => {
|
|
199
|
+
if (event.type === "text")
|
|
200
|
+
assistantText += event.delta;
|
|
201
|
+
// Propaga l'AgentEvent grezzo alle altre finestre (live view).
|
|
202
|
+
this.publishAgentEvent(workspaceId, sessionId, event);
|
|
203
|
+
onEvent?.(event);
|
|
204
|
+
if (event.type === "done" || event.type === "error") {
|
|
205
|
+
const finalText = assistantText.trim();
|
|
206
|
+
if (finalText) {
|
|
207
|
+
const assistantMsg = { role: "assistant", text: finalText, ts: Date.now() };
|
|
208
|
+
this.store.appendMessage(workspaceId, sessionId, assistantMsg);
|
|
209
|
+
this.publishMessage(workspaceId, sessionId, assistantMsg);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
return { done: handle.done, abort: () => handle.abort() };
|
|
214
|
+
}
|
|
215
|
+
// Engine vivo per la coppia workspace/sessione (riuso tra prompt).
|
|
216
|
+
engineFor(ws, session) {
|
|
217
|
+
const key = `${ws.id}/${session.id}`;
|
|
218
|
+
let engine = this.engines.get(key);
|
|
219
|
+
if (!engine) {
|
|
220
|
+
engine = CoworkEngine.for(ws, session, this.confirm, this.env);
|
|
221
|
+
this.engines.set(key, engine);
|
|
222
|
+
}
|
|
223
|
+
return engine;
|
|
224
|
+
}
|
|
225
|
+
touchContributor(session) {
|
|
226
|
+
if (session.contributors.includes(this.identity.memberId))
|
|
227
|
+
return;
|
|
228
|
+
const next = {
|
|
229
|
+
...session,
|
|
230
|
+
contributors: [...session.contributors, this.identity.memberId],
|
|
231
|
+
updatedAt: Date.now(),
|
|
232
|
+
};
|
|
233
|
+
this.store.putSession(next);
|
|
234
|
+
}
|
|
235
|
+
// ---- Presence ------------------------------------------------------------
|
|
236
|
+
// Annuncia/aggiorna la propria presenza in un workspace.
|
|
237
|
+
announcePresence(workspaceId, activeSessionId, status = "online") {
|
|
238
|
+
const presence = {
|
|
239
|
+
memberId: this.identity.memberId,
|
|
240
|
+
displayName: this.identity.displayName,
|
|
241
|
+
clientId: this.identity.clientId,
|
|
242
|
+
activeSessionId,
|
|
243
|
+
status,
|
|
244
|
+
lastSeen: Date.now(),
|
|
245
|
+
};
|
|
246
|
+
this.recordPresence(workspaceId, presence);
|
|
247
|
+
this.channel(workspaceId).publish("presence", { presence });
|
|
248
|
+
return presence;
|
|
249
|
+
}
|
|
250
|
+
// Presenze live conosciute di un workspace (esclude offline e stantii > 60s).
|
|
251
|
+
listPresence(workspaceId) {
|
|
252
|
+
const map = this.presence.get(workspaceId);
|
|
253
|
+
if (!map)
|
|
254
|
+
return [];
|
|
255
|
+
const cutoff = Date.now() - 60_000;
|
|
256
|
+
return [...map.values()].filter((p) => p.status !== "offline" && p.lastSeen >= cutoff);
|
|
257
|
+
}
|
|
258
|
+
recordPresence(workspaceId, presence) {
|
|
259
|
+
let map = this.presence.get(workspaceId);
|
|
260
|
+
if (!map) {
|
|
261
|
+
map = new Map();
|
|
262
|
+
this.presence.set(workspaceId, map);
|
|
263
|
+
}
|
|
264
|
+
const key = `${presence.memberId}@${presence.clientId}`;
|
|
265
|
+
if (presence.status === "offline")
|
|
266
|
+
map.delete(key);
|
|
267
|
+
else
|
|
268
|
+
map.set(key, presence);
|
|
269
|
+
}
|
|
270
|
+
// ---- Sync wiring ---------------------------------------------------------
|
|
271
|
+
// Canale di sync per un workspace (lazy). Registra il handler interno che
|
|
272
|
+
// tiene aggiornata la presenza dagli eventi remoti.
|
|
273
|
+
channel(workspaceId) {
|
|
274
|
+
let ch = this.channels.get(workspaceId);
|
|
275
|
+
if (!ch) {
|
|
276
|
+
ch = new CoworkSyncChannel(workspaceId, this.store.syncFile(workspaceId), this.identity.clientId);
|
|
277
|
+
ch.subscribe((ev) => this.onRemoteEvent(ev));
|
|
278
|
+
this.channels.set(workspaceId, ch);
|
|
279
|
+
}
|
|
280
|
+
return ch;
|
|
281
|
+
}
|
|
282
|
+
// Sottoscrizione esterna agli eventi remoti di un workspace (per la UI).
|
|
283
|
+
// Apre il canale se non già attivo. Ritorna la funzione di unsubscribe.
|
|
284
|
+
subscribe(workspaceId, listener) {
|
|
285
|
+
return this.channel(workspaceId).subscribe(listener);
|
|
286
|
+
}
|
|
287
|
+
onRemoteEvent(ev) {
|
|
288
|
+
if (ev.type === "presence") {
|
|
289
|
+
this.recordPresence(ev.workspaceId, ev.payload.presence);
|
|
290
|
+
}
|
|
291
|
+
// Gli altri eventi (workspace/session/message) modificano file già
|
|
292
|
+
// persistiti dall'origine: la UI li rilegge dallo store su notifica.
|
|
293
|
+
}
|
|
294
|
+
publishMessage(workspaceId, sessionId, message) {
|
|
295
|
+
this.channel(workspaceId).publish("message_appended", { sessionId, message });
|
|
296
|
+
}
|
|
297
|
+
publishAgentEvent(workspaceId, sessionId, event) {
|
|
298
|
+
this.channel(workspaceId).publish("agent_event", { sessionId, event });
|
|
299
|
+
}
|
|
300
|
+
// ---- Permessi ------------------------------------------------------------
|
|
301
|
+
assertRole(ws, allowed) {
|
|
302
|
+
const me = ws.members.find((m) => m.id === this.identity.memberId);
|
|
303
|
+
// Non-membro: trattato come viewer (sola lettura). Owner del workspace
|
|
304
|
+
// implicito se nessun membro registrato (workspace appena migrato).
|
|
305
|
+
const role = me?.role ?? (ws.members.length === 0 ? "owner" : "viewer");
|
|
306
|
+
if (!allowed.includes(role)) {
|
|
307
|
+
throw new CoworkError(`operazione non consentita per il ruolo "${role}"`, "permission_denied");
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
// ---- Ciclo di vita -------------------------------------------------------
|
|
311
|
+
// Interrompe ogni giro engine in corso.
|
|
312
|
+
abortAll() {
|
|
313
|
+
for (const e of this.engines.values())
|
|
314
|
+
e.abort();
|
|
315
|
+
}
|
|
316
|
+
// Chiude canali sync e libera le risorse (da chiamare alla chiusura finestra).
|
|
317
|
+
dispose() {
|
|
318
|
+
this.abortAll();
|
|
319
|
+
for (const ch of this.channels.values())
|
|
320
|
+
ch.close();
|
|
321
|
+
this.channels.clear();
|
|
322
|
+
this.engines.clear();
|
|
323
|
+
this.presence.clear();
|
|
324
|
+
}
|
|
325
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CoworkMessage, CoworkSession, CoworkWorkspace } from "./types.js";
|
|
2
|
+
export declare function defaultCoworkDir(env?: NodeJS.ProcessEnv): string;
|
|
3
|
+
export declare function withLock<T>(lockFile: string, fn: () => T, timeoutMs?: number, staleMs?: number): T;
|
|
4
|
+
export declare class CoworkStore {
|
|
5
|
+
readonly baseDir: string;
|
|
6
|
+
constructor(baseDir?: string, env?: NodeJS.ProcessEnv);
|
|
7
|
+
private get workspacesFile();
|
|
8
|
+
private workspaceDir;
|
|
9
|
+
private sessionsFile;
|
|
10
|
+
private messagesFile;
|
|
11
|
+
syncFile(workspaceId: string): string;
|
|
12
|
+
listWorkspaces(includeArchived?: boolean): CoworkWorkspace[];
|
|
13
|
+
getWorkspace(id: string): CoworkWorkspace | null;
|
|
14
|
+
requireWorkspace(id: string): CoworkWorkspace;
|
|
15
|
+
putWorkspace(ws: CoworkWorkspace): CoworkWorkspace;
|
|
16
|
+
listSessions(workspaceId: string, includeArchived?: boolean): CoworkSession[];
|
|
17
|
+
getSession(workspaceId: string, sessionId: string): CoworkSession | null;
|
|
18
|
+
requireSession(workspaceId: string, sessionId: string): CoworkSession;
|
|
19
|
+
putSession(session: CoworkSession): CoworkSession;
|
|
20
|
+
listMessages(workspaceId: string, sessionId: string): CoworkMessage[];
|
|
21
|
+
appendMessage(workspaceId: string, sessionId: string, msg: CoworkMessage): CoworkMessage;
|
|
22
|
+
diskWorkspaceIds(): string[];
|
|
23
|
+
}
|