@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,227 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmdirSync, unlinkSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
4
|
+
import { talosConfigDir } from "./env-paths.js";
|
|
5
|
+
import { withLockSync } from "../vascend/file-lock.js";
|
|
6
|
+
const DAY = 86_400_000;
|
|
7
|
+
const PROJECT = /^[a-zA-Z0-9._-]+-[a-f0-9]{24}$/;
|
|
8
|
+
const INTERVAL = 3_600_000;
|
|
9
|
+
function value(raw, fallback) {
|
|
10
|
+
const n = raw?.trim() ? Number(raw) : NaN;
|
|
11
|
+
return Number.isFinite(n) && n >= 0 ? n : fallback;
|
|
12
|
+
}
|
|
13
|
+
export function storageRetentionPolicy(env) {
|
|
14
|
+
return { days: value(env.TALOS_RETENTION_DAYS, 90),
|
|
15
|
+
maxBytes: value(env.TALOS_STORAGE_MAX_MB, 2_048) * 1_048_576 };
|
|
16
|
+
}
|
|
17
|
+
function paths(env, cwd = process.cwd()) {
|
|
18
|
+
const base = resolve(cwd, talosConfigDir(env));
|
|
19
|
+
return { projects: join(base, "projects"), leases: join(base, "storage-leases"), state: join(base, "storage-retention.json") };
|
|
20
|
+
}
|
|
21
|
+
function contained(root, path) {
|
|
22
|
+
const rel = relative(root, path);
|
|
23
|
+
return Boolean(rel) && rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);
|
|
24
|
+
}
|
|
25
|
+
function regularDirectory(path) {
|
|
26
|
+
try {
|
|
27
|
+
const stat = lstatSync(path);
|
|
28
|
+
return stat.isDirectory() && !stat.isSymbolicLink();
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function managedStore(store, projects) {
|
|
35
|
+
const rel = relative(projects, resolve(store)).split(sep);
|
|
36
|
+
return rel.length === 2 && PROJECT.test(rel[0]) && rel[1] === "sessions"
|
|
37
|
+
&& regularDirectory(projects) && regularDirectory(dirname(store)) && regularDirectory(store);
|
|
38
|
+
}
|
|
39
|
+
// Dots in custom session IDs deliberately coalesce retention groups. Keeping
|
|
40
|
+
// related data longer is preferable to evicting only part of a conversation.
|
|
41
|
+
function ownerOf(name) { return name.split(".")[0] || name; }
|
|
42
|
+
function scan(projects) {
|
|
43
|
+
const groups = new Map();
|
|
44
|
+
if (!regularDirectory(projects))
|
|
45
|
+
return [];
|
|
46
|
+
for (const project of readdirSync(projects)) {
|
|
47
|
+
const store = join(projects, project, "sessions");
|
|
48
|
+
if (!managedStore(store, projects))
|
|
49
|
+
continue;
|
|
50
|
+
const walk = (dir, owner) => {
|
|
51
|
+
for (const name of readdirSync(dir)) {
|
|
52
|
+
if (name.startsWith(".") || name.endsWith(".lock") || (dir === store && name === "user-profile.json"))
|
|
53
|
+
continue;
|
|
54
|
+
const path = join(dir, name);
|
|
55
|
+
const stat = lstatSync(path);
|
|
56
|
+
if (stat.isSymbolicLink())
|
|
57
|
+
continue;
|
|
58
|
+
// One level contains artifact categories (usage, tool-outputs, ...),
|
|
59
|
+
// the next identifies the session/scope owning all nested payloads.
|
|
60
|
+
const groupOwner = owner ?? (dir === store && stat.isDirectory() ? undefined : ownerOf(name));
|
|
61
|
+
if (stat.isDirectory()) {
|
|
62
|
+
walk(path, groupOwner);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (!stat.isFile() || !groupOwner)
|
|
66
|
+
continue;
|
|
67
|
+
const key = `${store}\n${groupOwner}`;
|
|
68
|
+
const group = groups.get(key) ?? { store, owner: groupOwner, files: [], bytes: 0, updated: 0 };
|
|
69
|
+
group.files.push({ path, size: stat.size, mtimeMs: stat.mtimeMs });
|
|
70
|
+
group.bytes += stat.size;
|
|
71
|
+
group.updated = Math.max(group.updated, stat.mtimeMs);
|
|
72
|
+
groups.set(key, group);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
walk(store);
|
|
76
|
+
}
|
|
77
|
+
return [...groups.values()];
|
|
78
|
+
}
|
|
79
|
+
function readLeases(directory, dryRun = false) {
|
|
80
|
+
if (!regularDirectory(directory))
|
|
81
|
+
return [];
|
|
82
|
+
const leases = [];
|
|
83
|
+
for (const name of readdirSync(directory)) {
|
|
84
|
+
if (!/^[a-f0-9-]{36}\.json$/.test(name))
|
|
85
|
+
continue;
|
|
86
|
+
const path = join(directory, name);
|
|
87
|
+
try {
|
|
88
|
+
const stat = lstatSync(path);
|
|
89
|
+
if (!stat.isFile() || stat.isSymbolicLink() || stat.size > 16_384)
|
|
90
|
+
continue;
|
|
91
|
+
const row = JSON.parse(readFileSync(path, "utf8"));
|
|
92
|
+
if (!Number.isInteger(row.pid) || row.pid <= 0 || typeof row.store !== "string"
|
|
93
|
+
|| !Array.isArray(row.owners) || row.owners.some(owner => typeof owner !== "string"))
|
|
94
|
+
continue;
|
|
95
|
+
try {
|
|
96
|
+
process.kill(row.pid, 0);
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
if (error.code !== "ESRCH") {
|
|
100
|
+
leases.push(row);
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
if (!dryRun)
|
|
104
|
+
unlinkSync(path);
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
leases.push(row);
|
|
108
|
+
}
|
|
109
|
+
catch { /* A corrupt lease must not make maintenance fail. */ }
|
|
110
|
+
}
|
|
111
|
+
return leases;
|
|
112
|
+
}
|
|
113
|
+
function isProtected(group, leases) {
|
|
114
|
+
const key = (path) => {
|
|
115
|
+
let canonical = resolve(path);
|
|
116
|
+
try {
|
|
117
|
+
canonical = realpathSync.native(canonical);
|
|
118
|
+
}
|
|
119
|
+
catch { /* Missing store cannot be active. */ }
|
|
120
|
+
return process.platform === "win32" ? canonical.toLowerCase() : canonical;
|
|
121
|
+
};
|
|
122
|
+
return leases.some(lease => key(lease.store) === key(group.store) && lease.owners.some(id => group.owner === ownerOf(id) || group.owner.startsWith(`kw-${ownerOf(id)}`)));
|
|
123
|
+
}
|
|
124
|
+
function removeGroup(group, projects) {
|
|
125
|
+
// Recheck every path before deleting anything. Never follow symlinks or
|
|
126
|
+
// delete a group that changed since the inventory was taken.
|
|
127
|
+
for (const file of group.files) {
|
|
128
|
+
const stat = lstatSync(file.path);
|
|
129
|
+
if (!contained(projects, file.path) || !contained(realpathSync(group.store), realpathSync(file.path))
|
|
130
|
+
|| stat.isSymbolicLink() || !stat.isFile() || stat.size !== file.size || stat.mtimeMs !== file.mtimeMs)
|
|
131
|
+
return { bytes: 0, files: 0 };
|
|
132
|
+
}
|
|
133
|
+
let bytes = 0, files = 0;
|
|
134
|
+
for (const file of group.files) {
|
|
135
|
+
try {
|
|
136
|
+
unlinkSync(file.path);
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
bytes += file.size;
|
|
142
|
+
files++;
|
|
143
|
+
for (let dir = dirname(file.path); contained(group.store, dir); dir = dirname(dir)) {
|
|
144
|
+
try {
|
|
145
|
+
rmdirSync(dir);
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
break;
|
|
149
|
+
} // Only empty artifact directories.
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return { bytes, files };
|
|
153
|
+
}
|
|
154
|
+
export function cleanSessionStorage(env, options = {}) {
|
|
155
|
+
if (env.TALOS_STORAGE_CLEANUP === "0")
|
|
156
|
+
return null;
|
|
157
|
+
const path = paths(env, options.cwd);
|
|
158
|
+
if (!regularDirectory(path.projects))
|
|
159
|
+
return null;
|
|
160
|
+
const now = options.now ?? Date.now();
|
|
161
|
+
const policy = storageRetentionPolicy(env);
|
|
162
|
+
return withLockSync(path.state, () => {
|
|
163
|
+
if (existsSync(path.state) && lstatSync(path.state).isSymbolicLink())
|
|
164
|
+
return null;
|
|
165
|
+
if (!options.force && !options.dryRun && existsSync(path.state)) {
|
|
166
|
+
try {
|
|
167
|
+
if (now - JSON.parse(readFileSync(path.state, "utf8")).at < INTERVAL)
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
catch { /* Retry invalid metadata. */ }
|
|
171
|
+
}
|
|
172
|
+
const groups = scan(path.projects).sort((a, b) => a.updated - b.updated);
|
|
173
|
+
const leases = readLeases(path.leases, options.dryRun);
|
|
174
|
+
const beforeBytes = groups.reduce((sum, group) => sum + group.bytes, 0);
|
|
175
|
+
let afterBytes = beforeBytes, removedGroups = 0, removedFiles = 0, protectedBytes = 0;
|
|
176
|
+
for (const group of groups) {
|
|
177
|
+
// The recent-write grace period also protects older runtime versions
|
|
178
|
+
// that do not yet register leases, and just-created conversations.
|
|
179
|
+
if (isProtected(group, leases) || now - group.updated < DAY) {
|
|
180
|
+
protectedBytes += group.bytes;
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
const expired = policy.days > 0 && now - group.updated >= policy.days * DAY;
|
|
184
|
+
if (!expired && !(policy.maxBytes > 0 && afterBytes > policy.maxBytes))
|
|
185
|
+
continue;
|
|
186
|
+
try {
|
|
187
|
+
const removed = options.dryRun ? { bytes: group.bytes, files: group.files.length } : removeGroup(group, path.projects);
|
|
188
|
+
afterBytes -= removed.bytes;
|
|
189
|
+
removedFiles += removed.files;
|
|
190
|
+
if (removed.files === group.files.length)
|
|
191
|
+
removedGroups++;
|
|
192
|
+
}
|
|
193
|
+
catch { /* Locked/changing files are retained for the next pass. */ }
|
|
194
|
+
}
|
|
195
|
+
const report = { beforeBytes, afterBytes, removedGroups, removedFiles, protectedBytes,
|
|
196
|
+
overBudget: policy.maxBytes > 0 && afterBytes > policy.maxBytes };
|
|
197
|
+
if (!options.dryRun)
|
|
198
|
+
writeFileSync(path.state, JSON.stringify({ at: now, ...report }), { mode: 0o600 });
|
|
199
|
+
return report;
|
|
200
|
+
}, { timeoutMs: 5_000, staleMs: 300_000 });
|
|
201
|
+
}
|
|
202
|
+
// Leases are independent of the optional workspace messaging bus. Cleanup and
|
|
203
|
+
// lease registration share the lock, so a resumed session cannot be evicted.
|
|
204
|
+
export function protectSessionStorage(store, owners, env, cwd) {
|
|
205
|
+
const path = paths(env, cwd);
|
|
206
|
+
if (!managedStore(store, path.projects))
|
|
207
|
+
return () => { };
|
|
208
|
+
const file = join(path.leases, `${randomUUID()}.json`);
|
|
209
|
+
withLockSync(path.state, () => {
|
|
210
|
+
if (existsSync(path.leases) && !regularDirectory(path.leases))
|
|
211
|
+
throw new Error("Directory lease sessioni non valida");
|
|
212
|
+
mkdirSync(path.leases, { recursive: true, mode: 0o700 });
|
|
213
|
+
writeFileSync(file, JSON.stringify({ pid: process.pid, store: resolve(store), owners }), { flag: "wx", mode: 0o600 });
|
|
214
|
+
});
|
|
215
|
+
return () => { try {
|
|
216
|
+
unlinkSync(file);
|
|
217
|
+
}
|
|
218
|
+
catch { /* Already released. */ } };
|
|
219
|
+
}
|
|
220
|
+
export function maintainSessionStorage(env, cwd) {
|
|
221
|
+
try {
|
|
222
|
+
const report = cleanSessionStorage(env, { cwd });
|
|
223
|
+
if (report?.overBudget)
|
|
224
|
+
process.stderr.write("[talos] quota storico superata: sessioni attive/recenti protette; pulizia rinviata.\n");
|
|
225
|
+
}
|
|
226
|
+
catch { /* Maintenance must never prevent a conversation from opening. */ }
|
|
227
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sanitizeText(value: string): string;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Sanitizzazione del testo che entra in MEMORIA/CONTEXT (metodo Danilov).
|
|
2
|
+
//
|
|
3
|
+
// Output di tool (bash, web_fetch, ...), incolla da terminale e contenuti
|
|
4
|
+
// esterni possono trascinare sequenze di escape ANSI (es. \x1b[31m), OSC
|
|
5
|
+
// (hyperlink), e byte di controllo non-stampabili. Se finiscono nei title/
|
|
6
|
+
// terms/body delle stanze o nei summary degli eventi, vengono iniettati TALI
|
|
7
|
+
// E QUALI nel memory packet -> system prompt: sono i "caratteri strani" che
|
|
8
|
+
// si leggono nel context e che lo sporcano (e gonfiano inutilmente i token).
|
|
9
|
+
//
|
|
10
|
+
// Questa funzione e' PURA e DETERMINISTICA: strip ANSI/OSC + caratteri di
|
|
11
|
+
// controllo, preservando solo \n e \t (la collassatura degli spazi resta agli
|
|
12
|
+
// helper oneLine/escapeValue gia' esistenti).
|
|
13
|
+
// OSC (Operating System Command): ESC ] ... terminato da BEL (\x07) o ST
|
|
14
|
+
// (ESC \). Es. hyperlink: ESC ]8;;URL BEL testo ESC ]8;; BEL. Va tolto INTERO,
|
|
15
|
+
// URL incluso. Il corpo non contiene mai ESC ne' BEL, quindi terminiamo al
|
|
16
|
+
// primo di essi: con ST il backslash residuo viene rimosso dal pass CSI/ESC
|
|
17
|
+
// (ESC + un byte). Deve venire PRIMA del pattern CSI nel replace.
|
|
18
|
+
// eslint-disable-next-line no-control-regex
|
|
19
|
+
const OSC_RE = /[\u001b\u009d]\][^\u0007\u001b]*(?:\u0007|\u001b\\?)/g;
|
|
20
|
+
// CSI: ESC [ ... lettera finale. Piu' singoli ESC + intro a 1/2 byte
|
|
21
|
+
// (es. ESC ( B, ESC =). Non include ] (gestito da OSC_RE).
|
|
22
|
+
const ANSI_RE =
|
|
23
|
+
// eslint-disable-next-line no-control-regex
|
|
24
|
+
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PR-TZcf-ntqry=><~]|\u001b[@-Z\\-_]/g;
|
|
25
|
+
// Caratteri di controllo C0/C1 non-stampabili, ESCLUSI \t (0x09) e \n (0x0a).
|
|
26
|
+
// Anche \r (0x0d) viene rimosso: lo normalizziamo via newline a monte.
|
|
27
|
+
// eslint-disable-next-line no-control-regex
|
|
28
|
+
const CONTROL_RE = /[\u0000-\u0008\u000b-\u001f\u007f-\u009f]/g;
|
|
29
|
+
// Rimuove escape ANSI/OSC e byte di controllo non-stampabili dal testo.
|
|
30
|
+
// Mantiene \n e \t. Non collassa gli spazi (lo fanno oneLine/escapeValue).
|
|
31
|
+
export function sanitizeText(value) {
|
|
32
|
+
if (!value)
|
|
33
|
+
return "";
|
|
34
|
+
return value.replace(OSC_RE, "").replace(ANSI_RE, "").replace(CONTROL_RE, "");
|
|
35
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Message, ToolResultPart } from "./types.js";
|
|
2
|
+
import { ToolOutputStore } from "./tool-result-store.js";
|
|
3
|
+
import { type ToolCompressOptions } from "./tool-compress.js";
|
|
4
|
+
export declare function projectToolResult(result: ToolResultPart, producer: string, store: ToolOutputStore | null, minTokens: number, compression: ToolCompressOptions, retrievedId?: string): ToolResultPart;
|
|
5
|
+
/** Only suppress repeats when the requested page is still visible in this request. */
|
|
6
|
+
export declare function visibleOutputPages(messages: readonly Message[]): ReadonlySet<string>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ToolOutputStore } from "./tool-result-store.js";
|
|
2
|
+
import { compressToolOutput } from "./tool-compress.js";
|
|
3
|
+
import { estimateTokens } from "./compaction.js";
|
|
4
|
+
import { createHash } from "node:crypto";
|
|
5
|
+
import { effectiveToolName } from "./effort.js";
|
|
6
|
+
export function projectToolResult(result, producer, store, minTokens, compression, retrievedId = "") {
|
|
7
|
+
if (result.isError || !store)
|
|
8
|
+
return result;
|
|
9
|
+
const compressed = compressToolOutput(result.output, producer, compression);
|
|
10
|
+
const pages = [...new Set([...result.output.matchAll(/output_page id="(tr\d+)"/g)].map((match) => match[1]))];
|
|
11
|
+
const inherited = result._meta?.["talosArtifact"];
|
|
12
|
+
const inheritedEntry = inherited?.id ? store.entry(inherited.id) : null;
|
|
13
|
+
const sameContent = inheritedEntry?.sha256 === createHash("sha256").update(result.output).digest("hex");
|
|
14
|
+
const alias = retrievedId || (pages.length === 1 ? pages[0] : "") || (sameContent ? inheritedEntry.id : "");
|
|
15
|
+
const entry = alias ? store.alias(result.callId, alias)
|
|
16
|
+
: compressed !== result.output || estimateTokens(result.output) >= minTokens
|
|
17
|
+
? store.put(result.callId, producer, result.output, result) : null;
|
|
18
|
+
if (!entry)
|
|
19
|
+
return result;
|
|
20
|
+
return {
|
|
21
|
+
...result,
|
|
22
|
+
output: compressed === result.output ? result.output
|
|
23
|
+
: compressed + '\n[output integrale: output_page id="' + entry.id + '"]',
|
|
24
|
+
_meta: { ...result._meta, talosArtifact: { id: entry.id, scope: store.scope, name: entry.name, sha256: entry.sha256 ?? "", chars: entry.chars } },
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/** Only suppress repeats when the requested page is still visible in this request. */
|
|
28
|
+
export function visibleOutputPages(messages) {
|
|
29
|
+
const calls = new Map();
|
|
30
|
+
const visible = new Set();
|
|
31
|
+
for (const message of messages)
|
|
32
|
+
for (const part of message.content) {
|
|
33
|
+
if (part.type === "tool_call" && effectiveToolName(part.name, part.input) === "output_page") {
|
|
34
|
+
const args = part.name === "execute" || part.name === "tool_invoke" ? part.input["args"] : part.input;
|
|
35
|
+
if (args && typeof args === "object" && !Array.isArray(args)) {
|
|
36
|
+
const input = args;
|
|
37
|
+
if (typeof input["id"] === "string") {
|
|
38
|
+
const id = input["id"];
|
|
39
|
+
calls.set(part.id, { id, page: Number(input["page"]) || (id.startsWith("tr") ? 1 : 2) });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (part.type !== "tool_result" || part.isError)
|
|
44
|
+
continue;
|
|
45
|
+
const call = calls.get(part.callId);
|
|
46
|
+
if (call && /pagina\s+\d+\/\d+/.test(part.output) && !/\[TOOL_RESULT_REF/.test(part.output)) {
|
|
47
|
+
visible.add(call.id + ":" + call.page);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return visible;
|
|
51
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface ToolCompressOptions {
|
|
2
|
+
readonly enabled: boolean;
|
|
3
|
+
readonly minChars: number;
|
|
4
|
+
readonly targetChars: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function toolCompressOptions(env: NodeJS.ProcessEnv): ToolCompressOptions;
|
|
7
|
+
export declare const NO_COMPRESS_TOOLS: ReadonlySet<string>;
|
|
8
|
+
export declare function compressToolOutput(output: string, toolName?: string, opts?: ToolCompressOptions): string;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// Compressione content-aware degli output dei tool PRIMA che entrino nel
|
|
2
|
+
// contesto del modello (ispirato a headroom, ma nativo e senza dipendenze).
|
|
3
|
+
// Obiettivo: tagliare i token su output voluminosi (bash, read_file, web_fetch,
|
|
4
|
+
// list_dir) preservando struttura e informazione utile, invece del semplice
|
|
5
|
+
// troncamento a coda. Modulo PURO e testabile.
|
|
6
|
+
export function toolCompressOptions(env) {
|
|
7
|
+
const flag = (env["TALOS_TOOLOUT_COMPRESS"] ?? "").trim().toLowerCase();
|
|
8
|
+
const enabled = !(flag === "0" || flag === "off" || flag === "false" || flag === "no");
|
|
9
|
+
const min = Number(env["TALOS_TOOLOUT_COMPRESS_MIN"]);
|
|
10
|
+
const target = Number(env["TALOS_TOOLOUT_COMPRESS_TARGET"]);
|
|
11
|
+
return {
|
|
12
|
+
enabled,
|
|
13
|
+
minChars: Number.isFinite(min) && min > 0 ? min : 2000,
|
|
14
|
+
targetChars: Number.isFinite(target) && target > 0 ? target : 6000,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
// Tool il cui output NON va compresso: o e' gia' breve, o e' un recupero
|
|
18
|
+
// esplicito che l'agente vuole integrale (recall, bash_output, ask_user), o e'
|
|
19
|
+
// metadato del regno che altri parser leggono testualmente.
|
|
20
|
+
export const NO_COMPRESS_TOOLS = new Set([
|
|
21
|
+
// Tool di CONTENUTO: il modello ne vuole il testo verbatim; la dimensione e'
|
|
22
|
+
// gestita dalla paginazione (output_page), non dalla compressione lossy.
|
|
23
|
+
"read_file",
|
|
24
|
+
"web_fetch",
|
|
25
|
+
"grep",
|
|
26
|
+
"glob",
|
|
27
|
+
"recall",
|
|
28
|
+
"bash_output",
|
|
29
|
+
"output_page",
|
|
30
|
+
"ask_user",
|
|
31
|
+
"image_generate",
|
|
32
|
+
"vascend_plan",
|
|
33
|
+
"vascend_mark",
|
|
34
|
+
"vascend_note",
|
|
35
|
+
"vascend_skill",
|
|
36
|
+
"vascend_addtasks",
|
|
37
|
+
]);
|
|
38
|
+
function tryCompressJson(output) {
|
|
39
|
+
const trimmed = output.trim();
|
|
40
|
+
if (!(trimmed.startsWith("{") || trimmed.startsWith("[")))
|
|
41
|
+
return null;
|
|
42
|
+
try {
|
|
43
|
+
// JSON is a data contract: removing rows or changing strings corrupts it.
|
|
44
|
+
// Whitespace is the only generic reduction that preserves values/cursors.
|
|
45
|
+
return JSON.stringify(JSON.parse(trimmed));
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Compressione testo/log: collassa righe vuote multiple, deduplica righe
|
|
52
|
+
// consecutive identiche (×N), e se ancora troppo lungo tiene testa+coda.
|
|
53
|
+
function compressText(output, target) {
|
|
54
|
+
const rawLines = output.split("\n");
|
|
55
|
+
const lines = [];
|
|
56
|
+
let blank = 0;
|
|
57
|
+
for (const line of rawLines) {
|
|
58
|
+
if (line.trim() === "") {
|
|
59
|
+
blank += 1;
|
|
60
|
+
if (blank > 1)
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
blank = 0;
|
|
65
|
+
}
|
|
66
|
+
const prev = lines[lines.length - 1];
|
|
67
|
+
if (prev !== undefined) {
|
|
68
|
+
const m = /^(.*?)(?: ×(\d+))?$/.exec(prev);
|
|
69
|
+
const prevText = m?.[1] ?? prev;
|
|
70
|
+
if (prevText === line) {
|
|
71
|
+
const n = m?.[2] ? Number(m[2]) + 1 : 2;
|
|
72
|
+
lines[lines.length - 1] = `${line} ×${n}`;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
lines.push(line);
|
|
77
|
+
}
|
|
78
|
+
let text = lines.join("\n");
|
|
79
|
+
if (text.length <= target)
|
|
80
|
+
return text;
|
|
81
|
+
// Testa + coda con elisione del centro.
|
|
82
|
+
const headChars = Math.floor(target * 0.6);
|
|
83
|
+
const tailChars = target - headChars;
|
|
84
|
+
const head = text.slice(0, headChars);
|
|
85
|
+
const tail = text.slice(-tailChars);
|
|
86
|
+
const omitted = text.length - headChars - tailChars;
|
|
87
|
+
return `${head}\n…(${omitted} caratteri omessi nel mezzo)…\n${tail}`;
|
|
88
|
+
}
|
|
89
|
+
// Comprime l'output di un tool se conviene. Ritorna l'originale se sotto soglia,
|
|
90
|
+
// nella denylist, disabilitato, o se la compressione non riduce abbastanza.
|
|
91
|
+
export function compressToolOutput(output, toolName, opts) {
|
|
92
|
+
const o = opts ?? toolCompressOptions(process.env);
|
|
93
|
+
if (!o.enabled)
|
|
94
|
+
return output;
|
|
95
|
+
if (toolName && NO_COMPRESS_TOOLS.has(toolName))
|
|
96
|
+
return output;
|
|
97
|
+
// Gia' paginato: non ricomprimere (il modello pagina con output_page).
|
|
98
|
+
if (/output_page id="(?:pg|tr)\d+"/.test(output))
|
|
99
|
+
return output;
|
|
100
|
+
if (output.length <= o.minChars)
|
|
101
|
+
return output;
|
|
102
|
+
const json = tryCompressJson(output);
|
|
103
|
+
const compressed = json ?? compressText(output, o.targetChars);
|
|
104
|
+
// Solo se riduce in modo sensibile (almeno 10%).
|
|
105
|
+
if (compressed.length >= output.length * 0.9)
|
|
106
|
+
return output;
|
|
107
|
+
if (json !== null)
|
|
108
|
+
return json;
|
|
109
|
+
const marker = `\n[output compresso: ${output.length}→${compressed.length} char]`;
|
|
110
|
+
return compressed + marker;
|
|
111
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ToolCallPart, ToolContext, ToolResultPart } from "./types.js";
|
|
2
|
+
export interface ToolExecutionHooks {
|
|
3
|
+
readonly before?: (call: ToolCallPart) => Promise<{
|
|
4
|
+
readonly block?: boolean;
|
|
5
|
+
readonly reason?: string;
|
|
6
|
+
} | void>;
|
|
7
|
+
readonly after?: (call: ToolCallPart, result: ToolResultPart) => Promise<ToolResultPart>;
|
|
8
|
+
readonly finalize?: (call: ToolCallPart, result: ToolResultPart) => ToolResultPart;
|
|
9
|
+
readonly onCall?: (call: ToolCallPart, parentId?: string) => void;
|
|
10
|
+
readonly onResult?: (call: ToolCallPart, result: ToolResultPart, parentId?: string) => void;
|
|
11
|
+
}
|
|
12
|
+
export type ToolExecutor = (call: ToolCallPart) => Promise<ToolResultPart>;
|
|
13
|
+
/** One execution contract for direct calls, compatibility wrappers and programs. */
|
|
14
|
+
export declare function createToolExecutor(ctx: ToolContext, hooks?: ToolExecutionHooks): ToolExecutor;
|
|
15
|
+
/** Standalone hosts can use the same normalization without installing an agent. */
|
|
16
|
+
export declare function invokeToolCall(call: ToolCallPart, ctx: ToolContext): Promise<ToolResultPart>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { normalizeMcpToolResult, textFromMcpToolResult } from "../mcp/protocol.js";
|
|
2
|
+
import { normalizeToolInput } from "../tools/normalize-input.js";
|
|
3
|
+
/** One execution contract for direct calls, compatibility wrappers and programs. */
|
|
4
|
+
export function createToolExecutor(ctx, hooks = {}) {
|
|
5
|
+
const execute = async (call, parentId, depth = 0, signal = ctx.signal, guards = ctx.guardToolCall ? [ctx.guardToolCall] : []) => {
|
|
6
|
+
hooks.onCall?.(call, parentId);
|
|
7
|
+
let result;
|
|
8
|
+
try {
|
|
9
|
+
if (signal.aborted)
|
|
10
|
+
throw new Error("chiamata annullata prima dell'esecuzione");
|
|
11
|
+
if (depth > 16)
|
|
12
|
+
throw new Error("limite di annidamento dei tool raggiunto");
|
|
13
|
+
const gate = await hooks.before?.(call);
|
|
14
|
+
if (gate?.block)
|
|
15
|
+
throw new Error("bloccato dall'estensione" + (gate.reason ? ": " + gate.reason : ""));
|
|
16
|
+
if (call.inputTruncatedChars)
|
|
17
|
+
throw new Error("argomenti troncati: " + call.inputTruncatedChars + " caratteri di JSON incompleto. "
|
|
18
|
+
+ "Rifai la chiamata con un payload piu' piccolo (write_file con append=true oppure edit_file).");
|
|
19
|
+
const tool = ctx.tools?.get(call.name);
|
|
20
|
+
if (!tool)
|
|
21
|
+
throw new Error("strumento sconosciuto: " + call.name);
|
|
22
|
+
for (const guard of guards)
|
|
23
|
+
guard(call);
|
|
24
|
+
signal.throwIfAborted();
|
|
25
|
+
const handled = await tool.handler(normalizeToolInput(call.input, tool.inputSchema), {
|
|
26
|
+
...ctx, signal, guardToolCall: undefined,
|
|
27
|
+
invokeTool: (nested, nestedSignal, guard) => execute(nested, call.id, depth + 1, nestedSignal && nestedSignal !== signal ? AbortSignal.any([signal, nestedSignal]) : signal, guard && !guards.includes(guard) ? [...guards, guard] : guards),
|
|
28
|
+
emitToolEvent: (event) => {
|
|
29
|
+
if (event.type === "tool_call")
|
|
30
|
+
hooks.onCall?.(event.call, call.id);
|
|
31
|
+
else
|
|
32
|
+
hooks.onResult?.(event.call, event.result, call.id);
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
const mcp = normalizeMcpToolResult(handled);
|
|
36
|
+
const legacyMedia = typeof handled === "object" && handled !== null && "media" in handled
|
|
37
|
+
? handled.media : undefined;
|
|
38
|
+
const media = normalizedToolMedia(legacyMedia ?? mcp.content);
|
|
39
|
+
result = {
|
|
40
|
+
type: "tool_result", callId: call.id,
|
|
41
|
+
output: textFromMcpToolResult(mcp), content: mcp.content, isError: mcp.isError === true,
|
|
42
|
+
...(mcp.structuredContent ? { structuredContent: mcp.structuredContent } : {}),
|
|
43
|
+
...(mcp._meta ? { _meta: mcp._meta } : {}),
|
|
44
|
+
...(media ? { media } : {}),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
const output = "eccezione: " + (error instanceof Error ? error.message : String(error));
|
|
49
|
+
result = { type: "tool_result", callId: call.id, output, isError: true, content: [{ type: "text", text: output }] };
|
|
50
|
+
}
|
|
51
|
+
// Result hooks run for errors too.
|
|
52
|
+
try {
|
|
53
|
+
if (hooks.after)
|
|
54
|
+
result = await hooks.after(call, result);
|
|
55
|
+
result = hooks.finalize?.(call, result) ?? result;
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
// The action already ran: preserve evidence and never encourage an automatic replay.
|
|
59
|
+
const note = "Post-elaborazione del risultato fallita: " + (error instanceof Error ? error.message : String(error))
|
|
60
|
+
+ ". L'azione potrebbe essere gia' completata: verificane l'esito prima di ripeterla.";
|
|
61
|
+
result = { ...result, isError: true, output: result.output + "\n" + note,
|
|
62
|
+
content: [...(result.content ?? [{ type: "text", text: result.output }]), { type: "text", text: note }],
|
|
63
|
+
_meta: { ...result._meta, talosPostprocessingError: true } };
|
|
64
|
+
}
|
|
65
|
+
hooks.onResult?.(call, result, parentId);
|
|
66
|
+
return result;
|
|
67
|
+
};
|
|
68
|
+
return (call) => execute(call);
|
|
69
|
+
}
|
|
70
|
+
/** Standalone hosts can use the same normalization without installing an agent. */
|
|
71
|
+
export async function invokeToolCall(call, ctx) {
|
|
72
|
+
if (ctx.invokeTool) {
|
|
73
|
+
return ctx.invokeTool(call, ctx.signal, ctx.guardToolCall);
|
|
74
|
+
}
|
|
75
|
+
return createToolExecutor(ctx, {
|
|
76
|
+
onCall: (nested) => ctx.emitToolEvent?.({ type: "tool_call", call: nested }),
|
|
77
|
+
onResult: (nested, result) => ctx.emitToolEvent?.({ type: "tool_result", call: nested, result }),
|
|
78
|
+
})(call);
|
|
79
|
+
}
|
|
80
|
+
function normalizedToolMedia(value) {
|
|
81
|
+
if (!Array.isArray(value))
|
|
82
|
+
return undefined;
|
|
83
|
+
const media = value.filter((item) => item && typeof item === "object").flatMap((item) => {
|
|
84
|
+
const row = item;
|
|
85
|
+
const mime = String(row["mimeType"] ?? row["mime"] ?? "").toLowerCase();
|
|
86
|
+
const data = String(row["data"] ?? "").replace(/\s+/g, "");
|
|
87
|
+
if (!/^image\/(?:png|jpeg|jpg|webp|gif)$/.test(mime) || !data || !/^[A-Za-z0-9+/=]+$/.test(data))
|
|
88
|
+
return [];
|
|
89
|
+
if (data.length * 0.75 > 5 * 1024 * 1024)
|
|
90
|
+
return [];
|
|
91
|
+
return [{
|
|
92
|
+
type: "image", mime: mime === "image/jpg" ? "image/jpeg" : mime, data,
|
|
93
|
+
...(row["source"] ? { source: String(row["source"]).slice(0, 160) } : {}),
|
|
94
|
+
}];
|
|
95
|
+
}).slice(0, 4);
|
|
96
|
+
return media.length ? media : undefined;
|
|
97
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Message, ToolResultPart } from "./types.js";
|
|
2
|
+
export interface ToolIndexPolicy {
|
|
3
|
+
readonly enabled: boolean;
|
|
4
|
+
readonly triggerTokens: number;
|
|
5
|
+
readonly keepTokens: number;
|
|
6
|
+
readonly keepRecent: number;
|
|
7
|
+
readonly minTokens: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const DEFAULT_TOOL_INDEX: ToolIndexPolicy;
|
|
10
|
+
export declare function toolIndexPolicy(env: NodeJS.ProcessEnv, contextWindow?: number): ToolIndexPolicy;
|
|
11
|
+
export interface DemotedRef {
|
|
12
|
+
readonly callId: string;
|
|
13
|
+
readonly storedId: string;
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly tokens: number;
|
|
16
|
+
readonly images: number;
|
|
17
|
+
}
|
|
18
|
+
export interface ToolIndexPlan {
|
|
19
|
+
readonly refs: readonly DemotedRef[];
|
|
20
|
+
readonly freedTokens: number;
|
|
21
|
+
readonly verbatimTokens: number;
|
|
22
|
+
}
|
|
23
|
+
export declare const EMPTY_PLAN: ToolIndexPlan;
|
|
24
|
+
export interface ToolIndexInput {
|
|
25
|
+
readonly messages: readonly Message[];
|
|
26
|
+
readonly policy: ToolIndexPolicy;
|
|
27
|
+
readonly archivedId: (callId: string) => string | null;
|
|
28
|
+
}
|
|
29
|
+
export declare function planToolResultDemotion(input: ToolIndexInput): ToolIndexPlan;
|
|
30
|
+
export declare function applyToolResultDemotion(messages: readonly Message[], plan: ToolIndexPlan): readonly Message[];
|
|
31
|
+
export declare function isDemoted(output: string): boolean;
|
|
32
|
+
export declare function demotedText(ref: DemotedRef, output: string): string;
|
|
33
|
+
export declare function slimToolResultForSession(part: ToolResultPart): ToolResultPart;
|
|
34
|
+
export declare function slimMessageForSession(message: Message): Message;
|
|
35
|
+
export interface MediaBudgetPolicy {
|
|
36
|
+
readonly enabled: boolean;
|
|
37
|
+
readonly keepImages: number;
|
|
38
|
+
}
|
|
39
|
+
export declare const DEFAULT_MEDIA_BUDGET: MediaBudgetPolicy;
|
|
40
|
+
export declare function mediaBudgetPolicy(env: NodeJS.ProcessEnv): MediaBudgetPolicy;
|
|
41
|
+
export interface MediaEvictionPlan {
|
|
42
|
+
readonly callIds: readonly string[];
|
|
43
|
+
readonly images: number;
|
|
44
|
+
readonly bytes: number;
|
|
45
|
+
readonly totalImages: number;
|
|
46
|
+
}
|
|
47
|
+
export declare const EMPTY_MEDIA_PLAN: MediaEvictionPlan;
|
|
48
|
+
export declare function planMediaEviction(input: {
|
|
49
|
+
readonly messages: readonly Message[];
|
|
50
|
+
readonly policy: MediaBudgetPolicy;
|
|
51
|
+
}): MediaEvictionPlan;
|
|
52
|
+
export declare function applyMediaEviction(messages: readonly Message[], plan: MediaEvictionPlan): readonly Message[];
|