@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,79 @@
|
|
|
1
|
+
// Budget Allocator (metodo Danilov, Memory OS).
|
|
2
|
+
//
|
|
3
|
+
// Regola d'oro del documento talos-context:
|
|
4
|
+
// "Mai riempire la finestra perche' c'e' spazio. Riempila solo se il prossimo
|
|
5
|
+
// token aumenta la probabilita' di risposta corretta."
|
|
6
|
+
//
|
|
7
|
+
// Ogni ZONA del prompt ha un budget di token (slot fissi + dinamici), con una
|
|
8
|
+
// RISERVA per il recall mirato. Questo modulo calcola l'allocazione e taglia i
|
|
9
|
+
// contenuti che eccedono, in modo deterministico.
|
|
10
|
+
//
|
|
11
|
+
// Modulo PURO: nessun side-effect, stima token ~4 char/token.
|
|
12
|
+
export const DEFAULT_POLICY = {
|
|
13
|
+
system: 0.08,
|
|
14
|
+
mission: 0.07,
|
|
15
|
+
vision: 0.12,
|
|
16
|
+
memory: 0.15,
|
|
17
|
+
evidence: 0.3,
|
|
18
|
+
recall: 0.12,
|
|
19
|
+
tool: 0.13,
|
|
20
|
+
tail: 0.03,
|
|
21
|
+
};
|
|
22
|
+
// Calcola l'allocazione per zona. La zona "user" riceve esattamente userTokens
|
|
23
|
+
// (garantita); il resto e' distribuito per percentuale sul budget rimanente.
|
|
24
|
+
export function allocateBudget(input) {
|
|
25
|
+
const policy = input.policy ?? DEFAULT_POLICY;
|
|
26
|
+
const nonNegative = (value) => Number.isFinite(value) ? Math.max(0, value) : 0;
|
|
27
|
+
const total = Math.floor(nonNegative(input.totalTokens));
|
|
28
|
+
const userTokens = Math.floor(nonNegative(input.userTokens ?? 0));
|
|
29
|
+
const remaining = Math.max(0, total - userTokens);
|
|
30
|
+
const sumPct = Object.values(policy).reduce((sum, value) => sum + nonNegative(value), 0);
|
|
31
|
+
const norm = sumPct > 0 ? sumPct : 1;
|
|
32
|
+
const share = (pct) => Math.floor((remaining * nonNegative(pct)) / norm);
|
|
33
|
+
return {
|
|
34
|
+
system: share(policy.system),
|
|
35
|
+
mission: share(policy.mission),
|
|
36
|
+
vision: share(policy.vision),
|
|
37
|
+
memory: share(policy.memory),
|
|
38
|
+
evidence: share(policy.evidence),
|
|
39
|
+
recall: share(policy.recall),
|
|
40
|
+
tool: share(policy.tool),
|
|
41
|
+
tail: share(policy.tail),
|
|
42
|
+
user: userTokens,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
// Stima deterministica dei token di un testo (~4 char/token).
|
|
46
|
+
export function estimateTokens(text) {
|
|
47
|
+
return Math.max(0, Math.ceil(text.length / 4));
|
|
48
|
+
}
|
|
49
|
+
// Taglia un testo al budget di token indicato (best effort, su confine di
|
|
50
|
+
// carattere). Aggiunge un marcatore se troncato.
|
|
51
|
+
export function clampToBudget(text, maxTokens) {
|
|
52
|
+
const maxChars = Math.max(0, maxTokens) * 4;
|
|
53
|
+
if (text.length <= maxChars)
|
|
54
|
+
return text;
|
|
55
|
+
if (maxChars <= 0)
|
|
56
|
+
return "";
|
|
57
|
+
const marker = " …[troncato-budget]";
|
|
58
|
+
if (maxChars <= marker.length)
|
|
59
|
+
return text.slice(0, maxChars);
|
|
60
|
+
return text.slice(0, maxChars - marker.length).trimEnd() + marker;
|
|
61
|
+
}
|
|
62
|
+
// Packing greedy: include gli item (ordinati per priorita' desc) finche' il
|
|
63
|
+
// budget regge. Deterministico. Ritorna inclusi ed esclusi.
|
|
64
|
+
export function packToBudget(items, maxTokens) {
|
|
65
|
+
const sorted = [...items].sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
66
|
+
const included = [];
|
|
67
|
+
const excluded = [];
|
|
68
|
+
let used = 0;
|
|
69
|
+
for (const item of sorted) {
|
|
70
|
+
if (used + item.tokens <= maxTokens) {
|
|
71
|
+
included.push(item.ref);
|
|
72
|
+
used += item.tokens;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
excluded.push(item.ref);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return { included, excluded, usedTokens: used };
|
|
79
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ContextCandidate } from "./context-candidate.js";
|
|
2
|
+
import { type RoomRecord } from "./room-memory.js";
|
|
3
|
+
import { type CastlePlan } from "./plan-store.js";
|
|
4
|
+
import { type Vision } from "./vision.js";
|
|
5
|
+
import { type DecisionEvent } from "./decision-promotion.js";
|
|
6
|
+
export interface CollectInput {
|
|
7
|
+
readonly sessionDir: string;
|
|
8
|
+
readonly scopeId: string;
|
|
9
|
+
readonly planScopeId?: string;
|
|
10
|
+
readonly limit?: number;
|
|
11
|
+
readonly projectScopeLimit?: number;
|
|
12
|
+
readonly projectKey?: string;
|
|
13
|
+
/** Preselected dependencies supplied by a coherent snapshot. */
|
|
14
|
+
readonly projectScopes?: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
export declare function collectCandidates(input: CollectInput): readonly ContextCandidate[];
|
|
17
|
+
export declare function candidateFromRoom(r: RoomRecord, scopeId: string): ContextCandidate;
|
|
18
|
+
export declare function candidatesFromCastle(castle: CastlePlan, scopeId: string): readonly ContextCandidate[];
|
|
19
|
+
export declare function candidateFromVision(v: Vision, scopeId: string): ContextCandidate;
|
|
20
|
+
export declare function candidateFromDecision(event: DecisionEvent, scopeId: string): ContextCandidate;
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
// Candidate Collector (metodo Danilov, Memory OS).
|
|
2
|
+
//
|
|
3
|
+
// Raccoglie i CANDIDATI di contesto dalle viste materializzate del Memory OS
|
|
4
|
+
// (MemoryStore append-only, RoomMemory, PlanStore, VisionStore) e li normalizza
|
|
5
|
+
// in ContextCandidate, pronti per scoring e retrieval. NON decide cosa entra
|
|
6
|
+
// nel prompt: produce solo il pool grezzo (de-duplicato per id).
|
|
7
|
+
//
|
|
8
|
+
// Modulo di SOLA LETTURA: apre gli store e legge; nessuna scrittura. Robusto
|
|
9
|
+
// agli store mancanti (safe()).
|
|
10
|
+
import { candidateFromEvent, normalizeCandidate, } from "./context-candidate.js";
|
|
11
|
+
import { MemoryStore, listMemoryScopes } from "./memory-store.js";
|
|
12
|
+
import { RoomMemory } from "./room-memory.js";
|
|
13
|
+
import { VascendPlanStore } from "./plan-store.js";
|
|
14
|
+
import { VascendVisionStore } from "./vision.js";
|
|
15
|
+
import { DecisionStore } from "./decision-promotion.js";
|
|
16
|
+
import { listContextMemoryScopes } from "./context-fabric.js";
|
|
17
|
+
// Retrieval limits apply after ranking; explicit collector limits remain supported.
|
|
18
|
+
const DEFAULT_CANDIDATE_LIMIT = Number.POSITIVE_INFINITY;
|
|
19
|
+
// Raccoglie e de-duplica i candidati dal Memory OS. Deterministico a parita'
|
|
20
|
+
// di store su disco.
|
|
21
|
+
export function collectCandidates(input) {
|
|
22
|
+
const limit = input.limit && input.limit > 0 ? input.limit : DEFAULT_CANDIDATE_LIMIT;
|
|
23
|
+
const out = new Map();
|
|
24
|
+
const add = (c) => {
|
|
25
|
+
if (!out.has(c.id))
|
|
26
|
+
out.set(c.id, c);
|
|
27
|
+
};
|
|
28
|
+
// 1) Eventi del Memory OS della sessione corrente (fonte canonica).
|
|
29
|
+
for (const e of safe(() => MemoryStore.open(input.sessionDir, input.scopeId).all(), [])) {
|
|
30
|
+
add(candidateFromEvent(e, { scopeId: input.scopeId }));
|
|
31
|
+
}
|
|
32
|
+
// Le decisioni canoniche vivono in uno store dedicato. Indicizzarle solo
|
|
33
|
+
// come RoomRecord le degradava a kind=room e rendeva inattivi anchor,
|
|
34
|
+
// supersession e proof chain orientati alle decisioni.
|
|
35
|
+
for (const decision of safe(() => DecisionStore.open(input.sessionDir, input.scopeId).all(), [])) {
|
|
36
|
+
add(candidateFromDecision(decision, input.scopeId));
|
|
37
|
+
}
|
|
38
|
+
// 2) Frontiera delle stanze (RoomRecord): indice vivo del castello.
|
|
39
|
+
for (const r of safe(() => RoomMemory.open(input.sessionDir, input.scopeId).frontier(), [])) {
|
|
40
|
+
add(candidateFromRoom(r, input.scopeId));
|
|
41
|
+
}
|
|
42
|
+
// 3) Castelli/task del piano: i task aperti sono spesso prerequisiti.
|
|
43
|
+
for (const c of safe(() => VascendPlanStore.open(input.sessionDir, input.planScopeId ?? input.scopeId).castles(), [])) {
|
|
44
|
+
for (const cand of candidatesFromCastle(c, input.planScopeId ?? input.scopeId))
|
|
45
|
+
add(cand);
|
|
46
|
+
}
|
|
47
|
+
// 4) Vision: stella polare, sempre dependency=true.
|
|
48
|
+
for (const v of safe(() => VascendVisionStore.open(input.sessionDir, input.scopeId).all(), [])) {
|
|
49
|
+
add(candidateFromVision(v, input.scopeId));
|
|
50
|
+
}
|
|
51
|
+
// 5) Working set da sessioni recenti (cross-scope), peso ridotto: solo eventi.
|
|
52
|
+
const projectScopeLimit = input.projectScopeLimit && input.projectScopeLimit > 0 ? input.projectScopeLimit : 6;
|
|
53
|
+
const allowedScopes = !input.projectScopes && input.projectKey
|
|
54
|
+
? new Set(listContextMemoryScopes(input.sessionDir, input.projectKey))
|
|
55
|
+
: null;
|
|
56
|
+
const projectScopes = input.projectScopes ?? listMemoryScopes(input.sessionDir, {
|
|
57
|
+
excludeScope: input.scopeId,
|
|
58
|
+
// Il filtro per progetto va applicato prima del cap: scope recenti di altri
|
|
59
|
+
// repo non devono espellere una sessione valida ma meno recente.
|
|
60
|
+
limit: allowedScopes ? 10_000 : projectScopeLimit,
|
|
61
|
+
}).filter((scope) => !allowedScopes || allowedScopes.has(scope)).slice(0, projectScopeLimit);
|
|
62
|
+
for (const scope of projectScopes) {
|
|
63
|
+
for (const e of safe(() => MemoryStore.open(input.sessionDir, scope).all(), []).slice(input.projectScopes ? 0 : -12)) {
|
|
64
|
+
add(qualifyCrossScope(candidateFromEvent(e, { scopeId: scope }), scope));
|
|
65
|
+
}
|
|
66
|
+
for (const decision of safe(() => DecisionStore.open(input.sessionDir, scope).all(), []).slice(input.projectScopes ? 0 : -6)) {
|
|
67
|
+
add(qualifyCrossScope(candidateFromDecision(decision, scope), scope));
|
|
68
|
+
}
|
|
69
|
+
if (input.projectScopes) {
|
|
70
|
+
for (const room of safe(() => RoomMemory.open(input.sessionDir, scope).frontier(), [])) {
|
|
71
|
+
add(qualifyCrossScope(candidateFromRoom(room, scope), scope));
|
|
72
|
+
}
|
|
73
|
+
if (scope !== input.planScopeId)
|
|
74
|
+
for (const castle of safe(() => VascendPlanStore.open(input.sessionDir, scope).castles(), [])) {
|
|
75
|
+
for (const candidate of candidatesFromCastle(castle, scope))
|
|
76
|
+
add(qualifyCrossScope(candidate, scope));
|
|
77
|
+
}
|
|
78
|
+
for (const vision of safe(() => VascendVisionStore.open(input.sessionDir, scope).all(), [])) {
|
|
79
|
+
add(qualifyCrossScope(candidateFromVision(vision, scope), scope));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return capCandidates([...out.values()], limit);
|
|
84
|
+
}
|
|
85
|
+
// --- conversioni per vista --------------------------------------------------
|
|
86
|
+
export function candidateFromRoom(r, scopeId) {
|
|
87
|
+
// Le stanze di livello alto (castello/regno) sono indici: dependency utile.
|
|
88
|
+
return normalizeCandidate({
|
|
89
|
+
id: r.room,
|
|
90
|
+
kind: "room",
|
|
91
|
+
domain: "rooms",
|
|
92
|
+
subject: r.title,
|
|
93
|
+
summary: r.title,
|
|
94
|
+
body: r.body,
|
|
95
|
+
terms: r.terms,
|
|
96
|
+
createdAt: r.createdAt,
|
|
97
|
+
trust: r.level > 0 ? "high" : "medium",
|
|
98
|
+
dependency: r.level > 0,
|
|
99
|
+
scopeId,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
export function candidatesFromCastle(castle, scopeId) {
|
|
103
|
+
return castle.tasks.map((t) => normalizeCandidate({
|
|
104
|
+
id: `${castle.slug}/${t.id}`,
|
|
105
|
+
kind: "task",
|
|
106
|
+
domain: "plan",
|
|
107
|
+
subject: `${castle.title} :: ${t.title}`,
|
|
108
|
+
summary: `[${t.status}] ${t.title}`,
|
|
109
|
+
body: [t.title, ...(t.evidence ?? [])].join(" | "),
|
|
110
|
+
terms: tokensOf(`${castle.title} ${t.title} ${t.status} ${(t.evidence ?? []).join(" ")}`),
|
|
111
|
+
trust: "high",
|
|
112
|
+
// I task non completati sono prerequisiti per capire lo stato corrente.
|
|
113
|
+
dependency: t.status !== "completed",
|
|
114
|
+
// I task completati hanno freshness piena ma sono "fatti": status active.
|
|
115
|
+
scopeId,
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
export function candidateFromVision(v, scopeId) {
|
|
119
|
+
const features = Array.isArray(v.features) ? v.features.map((f) => featureLabel(f)).filter(Boolean) : [];
|
|
120
|
+
return normalizeCandidate({
|
|
121
|
+
id: `vision/${v.taskId}`,
|
|
122
|
+
kind: "note",
|
|
123
|
+
domain: "vision",
|
|
124
|
+
subject: `vision: ${v.goal ?? ""}`.trim(),
|
|
125
|
+
summary: v.goal ?? "",
|
|
126
|
+
body: [v.goal ?? "", ...features].filter(Boolean).join(" | "),
|
|
127
|
+
terms: tokensOf(`${v.goal ?? ""} ${features.join(" ")}`),
|
|
128
|
+
trust: "high",
|
|
129
|
+
dependency: true,
|
|
130
|
+
scopeId,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
export function candidateFromDecision(event, scopeId) {
|
|
134
|
+
return normalizeCandidate({
|
|
135
|
+
id: event.id,
|
|
136
|
+
kind: "decision",
|
|
137
|
+
domain: "decisions",
|
|
138
|
+
subject: event.subject || event.decision,
|
|
139
|
+
summary: event.summary || event.decision,
|
|
140
|
+
body: [event.decision, event.reason, event.context].filter(Boolean).join(" | "),
|
|
141
|
+
terms: tokensOf(`${event.decision} ${event.reason} ${event.context} ${event.task ?? ""}`),
|
|
142
|
+
links: event.task ? [event.task] : [],
|
|
143
|
+
createdAt: event.createdAt,
|
|
144
|
+
trust: event.source === "user" ? "high" : "medium",
|
|
145
|
+
dependency: true,
|
|
146
|
+
scopeId,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
// --- helper -----------------------------------------------------------------
|
|
150
|
+
function featureLabel(f) {
|
|
151
|
+
if (typeof f === "string")
|
|
152
|
+
return f;
|
|
153
|
+
if (f && typeof f === "object") {
|
|
154
|
+
const o = f;
|
|
155
|
+
return typeof o["title"] === "string" ? o["title"] : typeof o["text"] === "string" ? o["text"] : "";
|
|
156
|
+
}
|
|
157
|
+
return "";
|
|
158
|
+
}
|
|
159
|
+
function tokensOf(s) {
|
|
160
|
+
return (s.toLowerCase().match(/[a-z0-9_./-]{2,}/g) ?? []).slice(0, 12);
|
|
161
|
+
}
|
|
162
|
+
// Gli id MemoryStore sono locali allo scope (ogni sessione parte da E1).
|
|
163
|
+
// Manteniamo invariati gli id dello scope corrente per retrocompatibilita', ma
|
|
164
|
+
// qualifichiamo quelli del working set esterno per evitare collisioni E1/E1.
|
|
165
|
+
function qualifyCrossScope(candidate, scopeId) {
|
|
166
|
+
const prefix = `${scopeId}::`;
|
|
167
|
+
return {
|
|
168
|
+
...candidate,
|
|
169
|
+
// `::` distingue il namespace di sessione dal `/` semantico dei task
|
|
170
|
+
// castello (master/T01). Usare `/` qui rendeva ogni E<n> dello stesso
|
|
171
|
+
// scope un falso vicino di grafo tramite sameCastle().
|
|
172
|
+
id: `${prefix}${candidate.id}`,
|
|
173
|
+
supersededBy: candidate.supersededBy ? `${prefix}${candidate.supersededBy}` : null,
|
|
174
|
+
links: candidate.links.map((target) => target.startsWith(prefix) ? target : `${prefix}${target}`),
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
// Se il pool supera il cap, le dipendenze attive e i nodi raggiungibili tramite
|
|
178
|
+
// link strutturati devono arrivare al retriever anche quando sono vecchi. Il cap
|
|
179
|
+
// resta rigido: la priorita' sostituisce candidati recenti, non aggiunge slot.
|
|
180
|
+
// A parita' vale la recenza precedente e l'output conserva l'ordine originario.
|
|
181
|
+
function capCandidates(candidates, limit) {
|
|
182
|
+
if (candidates.length <= limit)
|
|
183
|
+
return candidates;
|
|
184
|
+
const activeById = new Set(candidates
|
|
185
|
+
.filter((candidate) => candidate.status === "active" && !candidate.supersededBy)
|
|
186
|
+
.map((candidate) => candidate.id));
|
|
187
|
+
const linked = new Set();
|
|
188
|
+
for (const candidate of candidates) {
|
|
189
|
+
if (!activeById.has(candidate.id))
|
|
190
|
+
continue;
|
|
191
|
+
for (const target of candidate.links) {
|
|
192
|
+
if (!activeById.has(target))
|
|
193
|
+
continue;
|
|
194
|
+
linked.add(candidate.id);
|
|
195
|
+
linked.add(target);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
const ranked = candidates
|
|
199
|
+
.map((candidate, index) => ({
|
|
200
|
+
candidate,
|
|
201
|
+
index,
|
|
202
|
+
priority: activeById.has(candidate.id)
|
|
203
|
+
? candidate.dependency ? 2 : linked.has(candidate.id) ? 1 : 0
|
|
204
|
+
: 0,
|
|
205
|
+
}))
|
|
206
|
+
.sort((a, b) => b.priority - a.priority ||
|
|
207
|
+
b.candidate.createdAt - a.candidate.createdAt ||
|
|
208
|
+
a.index - b.index)
|
|
209
|
+
.slice(0, limit);
|
|
210
|
+
const keep = new Set(ranked.map(({ candidate }) => candidate.id));
|
|
211
|
+
return candidates.filter((candidate) => keep.has(candidate.id));
|
|
212
|
+
}
|
|
213
|
+
function safe(fn, fallback) {
|
|
214
|
+
try {
|
|
215
|
+
return fn();
|
|
216
|
+
}
|
|
217
|
+
catch {
|
|
218
|
+
return fallback;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type CodeEvent, type CodeEventType } from "./code-graph-types.js";
|
|
2
|
+
import { type MemoryEventInput } from "./memory-store.js";
|
|
3
|
+
export interface CodeEventSink {
|
|
4
|
+
emit(event: CodeEvent): void;
|
|
5
|
+
}
|
|
6
|
+
export declare function codeEventToMemoryInput(event: CodeEvent): MemoryEventInput;
|
|
7
|
+
export declare class InMemoryCodeEventSink implements CodeEventSink {
|
|
8
|
+
private readonly events;
|
|
9
|
+
emit(event: CodeEvent): void;
|
|
10
|
+
all(): readonly CodeEvent[];
|
|
11
|
+
ofType(type: CodeEventType): readonly CodeEvent[];
|
|
12
|
+
}
|
|
13
|
+
export declare class MemoryStoreCodeEventSink implements CodeEventSink {
|
|
14
|
+
private readonly sessionDir;
|
|
15
|
+
private readonly storeId;
|
|
16
|
+
private constructor();
|
|
17
|
+
static open(sessionDir: string, storeId: string): MemoryStoreCodeEventSink;
|
|
18
|
+
emit(event: CodeEvent): void;
|
|
19
|
+
}
|
|
20
|
+
export declare class FanoutCodeEventSink implements CodeEventSink {
|
|
21
|
+
private readonly sinks;
|
|
22
|
+
constructor(sinks: readonly CodeEventSink[]);
|
|
23
|
+
emit(event: CodeEvent): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
// Sink degli EVENTI CODE GRAPH (metodo Danilov, Memory OS).
|
|
2
|
+
//
|
|
3
|
+
// CodeGraphMemory non sa COME rendere durevoli/visibili i suoi eventi: delega a
|
|
4
|
+
// un CodeEventSink iniettabile. Tre implementazioni:
|
|
5
|
+
// - InMemoryCodeEventSink: tiene gli eventi in RAM (test, uso programmatico)
|
|
6
|
+
// - MemoryStoreCodeEventSink: indicizza ogni evento nel MemoryStore append-only
|
|
7
|
+
// (dominio "code"), cosi' diventano ContextCandidate per il Context Window
|
|
8
|
+
// Compiler (via candidateFromEvent / candidate-collector).
|
|
9
|
+
// - FanoutCodeEventSink: inoltra a piu' sink.
|
|
10
|
+
//
|
|
11
|
+
// I sink NON devono mai lanciare: un fallimento d'indicizzazione non deve
|
|
12
|
+
// rompere l'indicizzazione del codice (best effort). Zero dipendenze a runtime.
|
|
13
|
+
import { codeActionLabel, } from "./code-graph-types.js";
|
|
14
|
+
import { MemoryStore, } from "./memory-store.js";
|
|
15
|
+
// --- helper di formattazione ------------------------------------------------
|
|
16
|
+
function escapeValue(value) {
|
|
17
|
+
return value.replace(/\s+/g, " ").trim().replace(/"/g, "'");
|
|
18
|
+
}
|
|
19
|
+
// Tokenizza valori in termini d'indice: token interi + sotto-parole separate da
|
|
20
|
+
// -._/# cosi' un simbolo "parseSource" o un path "src/vascend/foo.ts" e'
|
|
21
|
+
// richiamabile per ogni sua parola.
|
|
22
|
+
function terms(...values) {
|
|
23
|
+
const out = new Set();
|
|
24
|
+
const add = (raw) => {
|
|
25
|
+
const t = raw.replace(/^[^a-z0-9]+|[^a-z0-9]+$/g, "");
|
|
26
|
+
if (t.length >= 2)
|
|
27
|
+
out.add(t);
|
|
28
|
+
};
|
|
29
|
+
for (const v of values) {
|
|
30
|
+
if (!v)
|
|
31
|
+
continue;
|
|
32
|
+
for (const whole of v.toLowerCase().match(/[a-z0-9_./#-]{2,}/g) ?? []) {
|
|
33
|
+
add(whole);
|
|
34
|
+
for (const part of whole.split(/[-._/#]+/))
|
|
35
|
+
add(part);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return [...out].filter((t) => t.length >= 2);
|
|
39
|
+
}
|
|
40
|
+
// Termini riconoscibili per il Dev Context Layout (convenzione concordata coi
|
|
41
|
+
// vassalli): dominio "code"/"graph" + parole chiave test/error per i fallimenti.
|
|
42
|
+
function layoutTerms(type) {
|
|
43
|
+
const base = ["code", "graph"];
|
|
44
|
+
if (type === "code.test.failed")
|
|
45
|
+
return [...base, "test", "fail", "error"];
|
|
46
|
+
if (type === "code.test.passed")
|
|
47
|
+
return [...base, "test", "passed"];
|
|
48
|
+
if (type === "code.api.changed" || type === "code.contract.changed")
|
|
49
|
+
return [...base, "api", "contract"];
|
|
50
|
+
return base;
|
|
51
|
+
}
|
|
52
|
+
// Soggetto sintetico dell'evento (per subject/summary).
|
|
53
|
+
function subjectOf(event) {
|
|
54
|
+
if (event.symbol)
|
|
55
|
+
return event.symbol.id;
|
|
56
|
+
if (event.testFile)
|
|
57
|
+
return event.testFile;
|
|
58
|
+
if (event.import)
|
|
59
|
+
return `${event.file} -> ${event.import.module}`;
|
|
60
|
+
return event.file;
|
|
61
|
+
}
|
|
62
|
+
function summaryOf(event) {
|
|
63
|
+
const action = codeActionLabel(event.type);
|
|
64
|
+
switch (event.type) {
|
|
65
|
+
case "code.symbol.changed":
|
|
66
|
+
return `${event.change ?? "modified"} ${event.symbol?.kind ?? "symbol"} ${event.symbol?.name ?? ""}`.trim();
|
|
67
|
+
case "code.contract.changed":
|
|
68
|
+
return `contratto ${event.symbol?.name ?? ""}: ${event.symbol?.signature ?? ""}`.trim();
|
|
69
|
+
case "code.api.changed": {
|
|
70
|
+
const add = event.apiAdded?.length ? `+${event.apiAdded.join(",")}` : "";
|
|
71
|
+
const rem = event.apiRemoved?.length ? `-${event.apiRemoved.join(",")}` : "";
|
|
72
|
+
return `api ${event.file}: ${[add, rem].filter(Boolean).join(" ")}`.trim();
|
|
73
|
+
}
|
|
74
|
+
case "code.import.added":
|
|
75
|
+
return `import ${event.import?.module ?? ""} in ${event.file}`;
|
|
76
|
+
case "code.test.failed":
|
|
77
|
+
return `test fallito ${event.testFile ?? event.file}: ${event.message ?? ""}`.trim();
|
|
78
|
+
case "code.test.passed":
|
|
79
|
+
return `test passato ${event.testFile ?? event.file}`;
|
|
80
|
+
case "code.file.touched":
|
|
81
|
+
return `${action} ${event.file}`;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// Costruisce l'input MemoryEvent (blocco Danilov) per un evento code.
|
|
85
|
+
export function codeEventToMemoryInput(event) {
|
|
86
|
+
const action = codeActionLabel(event.type);
|
|
87
|
+
const subject = subjectOf(event);
|
|
88
|
+
const summary = summaryOf(event);
|
|
89
|
+
const indexTerms = [
|
|
90
|
+
...terms(event.file, event.symbol?.name, event.symbol?.kind),
|
|
91
|
+
...terms(event.import?.module, event.testFile, event.area),
|
|
92
|
+
...terms(event.apiAdded?.join(" "), event.apiRemoved?.join(" ")),
|
|
93
|
+
...terms(event.type.replace("code.", "")),
|
|
94
|
+
...layoutTerms(event.type),
|
|
95
|
+
action,
|
|
96
|
+
];
|
|
97
|
+
const uniqTerms = [...new Set(indexTerms)].filter(Boolean).slice(0, 28);
|
|
98
|
+
const def = [
|
|
99
|
+
`@evento[${event.type}]: file=${event.file}, action=${action}, at=${event.at}`,
|
|
100
|
+
];
|
|
101
|
+
if (event.symbol) {
|
|
102
|
+
def.push(`@simbolo[${event.symbol.id}]: kind=${event.symbol.kind}, exported=${event.symbol.exported}, line=${event.symbol.line}`);
|
|
103
|
+
if (event.symbol.signature)
|
|
104
|
+
def.push(`@firma[${event.symbol.name}]: "${escapeValue(event.symbol.signature)}"`);
|
|
105
|
+
}
|
|
106
|
+
if (event.change)
|
|
107
|
+
def.push(`@cambiamento[${event.file}]: ${event.change}`);
|
|
108
|
+
if (event.previousSignature)
|
|
109
|
+
def.push(`@firma_precedente: "${escapeValue(event.previousSignature)}"`);
|
|
110
|
+
if (event.import) {
|
|
111
|
+
def.push(`@import[${event.file}]: module=${event.import.module}, external=${event.import.external}, names=[${event.import.names.join(",")}]`);
|
|
112
|
+
}
|
|
113
|
+
if (event.apiAdded?.length)
|
|
114
|
+
def.push(`@api_aggiunta: [${event.apiAdded.join(",")}]`);
|
|
115
|
+
if (event.apiRemoved?.length)
|
|
116
|
+
def.push(`@api_rimossa: [${event.apiRemoved.join(",")}]`);
|
|
117
|
+
if (event.testFile)
|
|
118
|
+
def.push(`@test[${event.testFile}]: covers=[${(event.covers ?? []).join(",")}]`);
|
|
119
|
+
if (event.message)
|
|
120
|
+
def.push(`@messaggio: "${escapeValue(event.message).slice(0, 600)}"`);
|
|
121
|
+
if (event.area)
|
|
122
|
+
def.push(`@area[${event.area}]: feature_area`);
|
|
123
|
+
if (event.note)
|
|
124
|
+
def.push(`@nota: "${escapeValue(event.note).slice(0, 400)}"`);
|
|
125
|
+
const links = [];
|
|
126
|
+
if (event.import && !event.import.external) {
|
|
127
|
+
links.push({ rel: "imports", target: event.import.module, domain: "code" });
|
|
128
|
+
}
|
|
129
|
+
if (event.symbol) {
|
|
130
|
+
links.push({ rel: "defines", target: event.symbol.id, domain: "code" });
|
|
131
|
+
}
|
|
132
|
+
for (const c of event.covers ?? []) {
|
|
133
|
+
links.push({ rel: "covers", target: c, domain: "code" });
|
|
134
|
+
}
|
|
135
|
+
const rel = `@R: ${event.file} -> ${event.type} -> ${subject} [ ${action} ]`;
|
|
136
|
+
const body = `INDICE
|
|
137
|
+
${uniqTerms.map((t, i) => `${i + 1} = ${t}`).join("\n")}
|
|
138
|
+
|
|
139
|
+
DEFINIZIONI
|
|
140
|
+
${def.join("\n")}
|
|
141
|
+
|
|
142
|
+
RELAZIONI
|
|
143
|
+
${rel}
|
|
144
|
+
|
|
145
|
+
OUTPUT: ${summary}; richiamabile via recall.`;
|
|
146
|
+
// I test falliti e i contratti cambiati sono prerequisiti caldi: confidence
|
|
147
|
+
// alta cosi' lo scorer del Context Window Compiler li privilegia.
|
|
148
|
+
const confidence = event.type === "code.test.failed" || event.type === "code.contract.changed" || event.type === "code.api.changed"
|
|
149
|
+
? "high"
|
|
150
|
+
: "medium";
|
|
151
|
+
return {
|
|
152
|
+
type: event.type,
|
|
153
|
+
domain: "code",
|
|
154
|
+
subject: escapeValue(subject).slice(0, 160),
|
|
155
|
+
summary: escapeValue(summary).slice(0, 200),
|
|
156
|
+
body,
|
|
157
|
+
terms: uniqTerms,
|
|
158
|
+
links,
|
|
159
|
+
payload: {
|
|
160
|
+
confidence,
|
|
161
|
+
area: event.area ?? "",
|
|
162
|
+
change: event.change ?? "",
|
|
163
|
+
file: event.file,
|
|
164
|
+
...(event.symbol ? { symbol: event.symbol.id, signature: event.symbol.signature } : {}),
|
|
165
|
+
...(event.import ? { import: event.import.module } : {}),
|
|
166
|
+
...(event.testFile ? { testFile: event.testFile } : {}),
|
|
167
|
+
},
|
|
168
|
+
createdAt: event.at,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
// --- implementazioni --------------------------------------------------------
|
|
172
|
+
// Sink in-memory: tiene gli eventi e li espone (test/uso programmatico).
|
|
173
|
+
export class InMemoryCodeEventSink {
|
|
174
|
+
events = [];
|
|
175
|
+
emit(event) {
|
|
176
|
+
this.events.push(event);
|
|
177
|
+
}
|
|
178
|
+
all() {
|
|
179
|
+
return this.events;
|
|
180
|
+
}
|
|
181
|
+
ofType(type) {
|
|
182
|
+
return this.events.filter((e) => e.type === type);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// Sink su MemoryStore: indicizza ogni evento code nel log append-only (dominio
|
|
186
|
+
// "code"). Best effort: non lancia mai. Apre lo store a ogni emit per restare
|
|
187
|
+
// coerente col modello degli altri sink (asset) senza tenere stato.
|
|
188
|
+
export class MemoryStoreCodeEventSink {
|
|
189
|
+
sessionDir;
|
|
190
|
+
storeId;
|
|
191
|
+
constructor(sessionDir, storeId) {
|
|
192
|
+
this.sessionDir = sessionDir;
|
|
193
|
+
this.storeId = storeId;
|
|
194
|
+
}
|
|
195
|
+
static open(sessionDir, storeId) {
|
|
196
|
+
return new MemoryStoreCodeEventSink(sessionDir, storeId);
|
|
197
|
+
}
|
|
198
|
+
emit(event) {
|
|
199
|
+
try {
|
|
200
|
+
const store = MemoryStore.open(this.sessionDir, this.storeId);
|
|
201
|
+
const input = codeEventToMemoryInput(event);
|
|
202
|
+
// Gli archi semantici originali (file/simbolo/path) sono utili come
|
|
203
|
+
// provenance, ma il retriever opera su id di ContextCandidate. Collega
|
|
204
|
+
// quindi anche gli eventi gia' persistiti che rappresentano lo stesso
|
|
205
|
+
// file/simbolo o una dipendenza import/coverage. Il cap evita hub enormi.
|
|
206
|
+
const eventLinks = relatedEventLinks(event, store.query({ domain: "code" }));
|
|
207
|
+
store.append({ ...input, links: dedupeLinks([...(input.links ?? []), ...eventLinks]) });
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
// best effort: l'indicizzazione non deve rompere l'analisi del codice.
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function relatedEventLinks(event, previous) {
|
|
215
|
+
const related = [];
|
|
216
|
+
const wantedCovers = new Set((event.covers ?? []).map(normalizePath));
|
|
217
|
+
const importedStem = event.import && !event.import.external
|
|
218
|
+
? importStem(event.file, event.import.module)
|
|
219
|
+
: "";
|
|
220
|
+
for (const candidate of previous) {
|
|
221
|
+
const file = payloadString(candidate, "file");
|
|
222
|
+
const symbol = payloadString(candidate, "symbol");
|
|
223
|
+
let rel = null;
|
|
224
|
+
let score = 0;
|
|
225
|
+
if (event.symbol?.id && symbol === event.symbol.id) {
|
|
226
|
+
rel = "same-symbol";
|
|
227
|
+
score = 4;
|
|
228
|
+
}
|
|
229
|
+
else if (file && wantedCovers.has(normalizePath(file))) {
|
|
230
|
+
rel = "covers";
|
|
231
|
+
score = 3;
|
|
232
|
+
}
|
|
233
|
+
else if (file && importedStem && fileStem(file) === importedStem) {
|
|
234
|
+
rel = "imports";
|
|
235
|
+
score = 3;
|
|
236
|
+
}
|
|
237
|
+
else if (file && normalizePath(file) === normalizePath(event.file)) {
|
|
238
|
+
rel = "same-file";
|
|
239
|
+
score = 2;
|
|
240
|
+
}
|
|
241
|
+
if (rel)
|
|
242
|
+
related.push({ event: candidate, rel, score });
|
|
243
|
+
}
|
|
244
|
+
return related
|
|
245
|
+
.sort((a, b) => b.score - a.score ||
|
|
246
|
+
b.event.createdAt - a.event.createdAt ||
|
|
247
|
+
b.event.id.localeCompare(a.event.id))
|
|
248
|
+
.slice(0, 8)
|
|
249
|
+
.map((item) => ({ rel: item.rel, target: item.event.id, domain: "code" }));
|
|
250
|
+
}
|
|
251
|
+
function dedupeLinks(links) {
|
|
252
|
+
const seen = new Set();
|
|
253
|
+
const out = [];
|
|
254
|
+
for (const link of links) {
|
|
255
|
+
const key = `${link.rel}\u0000${link.target}\u0000${link.domain ?? ""}`;
|
|
256
|
+
if (!link.target || seen.has(key))
|
|
257
|
+
continue;
|
|
258
|
+
seen.add(key);
|
|
259
|
+
out.push(link);
|
|
260
|
+
}
|
|
261
|
+
return out;
|
|
262
|
+
}
|
|
263
|
+
function payloadString(event, key) {
|
|
264
|
+
const value = event.payload[key];
|
|
265
|
+
return typeof value === "string" ? value : "";
|
|
266
|
+
}
|
|
267
|
+
function normalizePath(value) {
|
|
268
|
+
return value.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
269
|
+
}
|
|
270
|
+
function fileStem(value) {
|
|
271
|
+
return normalizePath(value)
|
|
272
|
+
.replace(/\/[Ii][Nn][Dd][Ee][Xx]\.[cm]?[jt]sx?$/, "")
|
|
273
|
+
.replace(/\.[cm]?[jt]sx?$/i, "");
|
|
274
|
+
}
|
|
275
|
+
function importStem(fromFile, module) {
|
|
276
|
+
const base = normalizePath(fromFile).split("/").slice(0, -1);
|
|
277
|
+
for (const segment of normalizePath(module).split("/")) {
|
|
278
|
+
if (!segment || segment === ".")
|
|
279
|
+
continue;
|
|
280
|
+
if (segment === "..")
|
|
281
|
+
base.pop();
|
|
282
|
+
else
|
|
283
|
+
base.push(segment);
|
|
284
|
+
}
|
|
285
|
+
return fileStem(base.join("/"));
|
|
286
|
+
}
|
|
287
|
+
// Sink che inoltra a piu' sink (es. in-memory + MemoryStore). Inghiotte errori
|
|
288
|
+
// dei singoli sink per non interrompere gli altri.
|
|
289
|
+
export class FanoutCodeEventSink {
|
|
290
|
+
sinks;
|
|
291
|
+
constructor(sinks) {
|
|
292
|
+
this.sinks = sinks;
|
|
293
|
+
}
|
|
294
|
+
emit(event) {
|
|
295
|
+
for (const sink of this.sinks) {
|
|
296
|
+
try {
|
|
297
|
+
sink.emit(event);
|
|
298
|
+
}
|
|
299
|
+
catch {
|
|
300
|
+
// best effort
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|