@wrongstack/core 0.296.4 → 0.298.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/dist/chronicle/index.js +126 -22
- package/dist/chronicle/project-server-client.d.ts +12 -0
- package/dist/chronicle/project-server-protocol.d.ts +22 -0
- package/dist/chronicle/project-server.js +1076 -283
- package/dist/coordination/agents/index.js +136 -1
- package/dist/coordination/agents/role-skills.d.ts +3 -2
- package/dist/coordination/brain-cache.d.ts +14 -0
- package/dist/coordination/brain-trace.d.ts +2 -1
- package/dist/coordination/director/director-task-registry.d.ts +12 -0
- package/dist/coordination/fleet-supervisor.d.ts +21 -0
- package/dist/coordination/index.d.ts +23 -21
- package/dist/coordination/index.js +16514 -15945
- package/dist/coordination/mail-tools.d.ts +3 -3
- package/dist/coordination/mailbox-credential-store.d.ts +22 -2
- package/dist/coordination/mailbox-credential-throttle.d.ts +63 -0
- package/dist/coordination/mailbox-http-router.d.ts +6 -0
- package/dist/coordination/mailbox-project-server-client.d.ts +16 -0
- package/dist/coordination/mailbox-project-server-protocol.d.ts +43 -5
- package/dist/coordination/mailbox-project-server.js +1270 -289
- package/dist/coordination/provider-status-tracker.d.ts +2 -0
- package/dist/coordination/remote-mailbox-credential-store.d.ts +5 -5
- package/dist/coordination/remote-mailbox.d.ts +30 -4
- package/dist/coordination/sqlite-mailbox-credentials.d.ts +11 -0
- package/dist/core/context.d.ts +5 -5
- package/dist/core/fallback-profile-manager.d.ts +14 -0
- package/dist/core/index.js +624 -168
- package/dist/core/instruction-bundle.d.ts +12 -0
- package/dist/core/system-prompt-builder.d.ts +14 -0
- package/dist/core/system-prompt-skill-bodies.d.ts +1 -1
- package/dist/core/system-prompt-skill-text.d.ts +1 -2
- package/dist/defaults/index.js +2393 -1302
- package/dist/design/index.js +47 -8
- package/dist/execution/design-materialize.d.ts +22 -0
- package/dist/execution/index.js +582 -285
- package/dist/execution/skill-loader.d.ts +10 -1
- package/dist/execution/tool-error-taxonomy.d.ts +31 -0
- package/dist/execution/tool-executor.d.ts +1 -0
- package/dist/goal/index.js +71 -17
- package/dist/goal/phase-store.d.ts +7 -0
- package/dist/hooks/index.js +5 -0
- package/dist/hq/auth-audit.d.ts +6 -0
- package/dist/hq/auth-store.d.ts +59 -3
- package/dist/hq/index.js +680 -163
- package/dist/hq/kanban-store.d.ts +3 -0
- package/dist/hq/persistence/event-log.d.ts +25 -0
- package/dist/hq/persistence.d.ts +1 -1
- package/dist/hq/protocol/browser.d.ts +2 -1
- package/dist/hq/protocol/client.d.ts +18 -1
- package/dist/hq/protocol/core.d.ts +5 -16
- package/dist/hq/protocol/envelope.d.ts +29 -0
- package/dist/hq/protocol/governance.d.ts +34 -0
- package/dist/hq/protocol/peer.d.ts +55 -0
- package/dist/hq/protocol/project.d.ts +3 -0
- package/dist/hq/protocol/resume.d.ts +56 -0
- package/dist/hq/protocol.d.ts +11 -8
- package/dist/hq/protocol.js +675 -0
- package/dist/hq/publisher.d.ts +31 -2
- package/dist/hq/session-bridge.d.ts +8 -0
- package/dist/index.js +7197 -4006
- package/dist/infrastructure/index.js +198 -101
- package/dist/kernel/events/session-events.d.ts +3 -0
- package/dist/kernel/events/tool-events.d.ts +3 -1
- package/dist/models/index.js +1 -1
- package/dist/observability/index.d.ts +1 -1
- package/dist/observability/index.js +103 -5
- package/dist/observability/metrics.d.ts +37 -0
- package/dist/observability/prometheus.d.ts +11 -0
- package/dist/plugin/index.d.ts +5 -1
- package/dist/plugin/index.js +965 -511
- package/dist/plugins/auto-review-plugin.d.ts +6 -0
- package/dist/plugins/review-store-maintenance.d.ts +26 -0
- package/dist/plugins/review-types.d.ts +6 -0
- package/dist/security/capabilities.d.ts +45 -1
- package/dist/security/error-sanitize.d.ts +49 -0
- package/dist/security/file-permissions.d.ts +41 -0
- package/dist/security/index.d.ts +9 -6
- package/dist/security/index.js +3007 -2032
- package/dist/security/permission-policy.d.ts +55 -3
- package/dist/security/secret-vault.d.ts +17 -0
- package/dist/security/totp.d.ts +86 -0
- package/dist/skills/frontmatter.d.ts +12 -1
- package/dist/skills/github-fetcher.d.ts +48 -0
- package/dist/skills/index.js +137 -26
- package/dist/skills/limits.d.ts +19 -0
- package/dist/skills/skill-installer.d.ts +13 -0
- package/dist/storage/file-session-writer.d.ts +23 -0
- package/dist/storage/index.js +1140 -905
- package/dist/storage/provider-config-watcher.d.ts +1 -0
- package/dist/storage/session-helpers.d.ts +1 -0
- package/dist/storage/session-reader.d.ts +0 -7
- package/dist/storage/session-store/types.d.ts +12 -1
- package/dist/storage/session-store.d.ts +11 -2
- package/dist/storage/session-workspace-checkpoints.d.ts +5 -0
- package/dist/tools/fallback-manage-tools.d.ts +6 -0
- package/dist/tools/index.js +305 -133
- package/dist/tools/mcp-use.d.ts +1 -1
- package/dist/types/blocks.d.ts +7 -0
- package/dist/types/config/autonomy.d.ts +12 -3
- package/dist/types/config/mcp-features.d.ts +15 -1
- package/dist/types/config/root.d.ts +10 -4
- package/dist/types/context-window.d.ts +15 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/observability.d.ts +13 -0
- package/dist/types/secret-vault.d.ts +8 -0
- package/dist/types/session.d.ts +42 -0
- package/dist/types/skill.d.ts +56 -0
- package/dist/types/tool-executor.d.ts +2 -0
- package/dist/utils/continuous-memory-profiler.d.ts +35 -0
- package/dist/utils/env-typed.d.ts +64 -0
- package/dist/utils/glob-match.d.ts +21 -1
- package/dist/utils/heap-watchdog-types.d.ts +62 -0
- package/dist/utils/heap-watchdog.d.ts +15 -34
- package/dist/utils/heap-watchdog.js +592 -18
- package/dist/utils/incoming-images.d.ts +19 -0
- package/dist/utils/index.d.ts +15 -11
- package/dist/utils/index.js +1425 -545
- package/dist/utils/memory-flight-recorder.d.ts +47 -0
- package/dist/utils/path-segment.d.ts +29 -0
- package/dist/utils/tool-name.d.ts +34 -0
- package/dist/utils/win32-cmd.d.ts +25 -0
- package/dist/worktree/index.js +5 -0
- package/package.json +11 -3
- package/skills/chimera/SKILL.md +16 -4
- package/skills/data-governance/SKILL.md +92 -0
- package/skills/wrongstack-kanban/SKILL.md +129 -0
- package/skills/wrongstack-kanban/agents/openai.yaml +4 -0
- package/skills/wrongstack-mailbox-mcp/SKILL.md +72 -0
- package/skills/wrongstack-mailbox-mcp/agents/openai.yaml +4 -0
- package/dist/agent-status-helpers.d.ts.map +0 -1
- package/dist/agent-status-tracker.d.ts.map +0 -1
- package/dist/boot.d.ts.map +0 -1
- package/dist/chronicle/context.d.ts.map +0 -1
- package/dist/chronicle/decision-adapter.d.ts.map +0 -1
- package/dist/chronicle/domain-adapter.d.ts.map +0 -1
- package/dist/chronicle/event-hash.d.ts.map +0 -1
- package/dist/chronicle/file-observer.d.ts.map +0 -1
- package/dist/chronicle/health-monitor.d.ts.map +0 -1
- package/dist/chronicle/identity.d.ts.map +0 -1
- package/dist/chronicle/index.d.ts.map +0 -1
- package/dist/chronicle/index.js.map +0 -7
- package/dist/chronicle/journal.d.ts.map +0 -1
- package/dist/chronicle/legacy-journal-import.d.ts.map +0 -1
- package/dist/chronicle/metrics-store.d.ts.map +0 -1
- package/dist/chronicle/partition-filename.d.ts.map +0 -1
- package/dist/chronicle/partition-range-cache.d.ts.map +0 -1
- package/dist/chronicle/process-adapter.d.ts.map +0 -1
- package/dist/chronicle/project-access.d.ts.map +0 -1
- package/dist/chronicle/project-server-client.d.ts.map +0 -1
- package/dist/chronicle/project-server-endpoint.d.ts.map +0 -1
- package/dist/chronicle/project-server-protocol.d.ts.map +0 -1
- package/dist/chronicle/project-server.d.ts.map +0 -1
- package/dist/chronicle/project-server.js.map +0 -7
- package/dist/chronicle/prompt-manifest.d.ts.map +0 -1
- package/dist/chronicle/provider-adapter.d.ts.map +0 -1
- package/dist/chronicle/query.d.ts.map +0 -1
- package/dist/chronicle/review-adapter.d.ts.map +0 -1
- package/dist/chronicle/rollup-adapter.d.ts.map +0 -1
- package/dist/chronicle/sink.d.ts.map +0 -1
- package/dist/chronicle/sqlite-journal.d.ts.map +0 -1
- package/dist/chronicle/sqlite-query.d.ts.map +0 -1
- package/dist/chronicle/stream-adapter.d.ts.map +0 -1
- package/dist/chronicle/tool-adapter.d.ts.map +0 -1
- package/dist/chronicle/types.d.ts.map +0 -1
- package/dist/coordination/adaptive-concurrency.d.ts.map +0 -1
- package/dist/coordination/agent-bridge.d.ts.map +0 -1
- package/dist/coordination/agent-monitor.d.ts.map +0 -1
- package/dist/coordination/agent-subagent-runner.d.ts.map +0 -1
- package/dist/coordination/agents/agent-prompts.d.ts.map +0 -1
- package/dist/coordination/agents/index.d.ts.map +0 -1
- package/dist/coordination/agents/index.js.map +0 -7
- package/dist/coordination/agents/phase1-discovery.d.ts.map +0 -1
- package/dist/coordination/agents/phase2-planning.d.ts.map +0 -1
- package/dist/coordination/agents/phase3-build.d.ts.map +0 -1
- package/dist/coordination/agents/phase3-techstack.d.ts.map +0 -1
- package/dist/coordination/agents/phase3-wave1-platform.d.ts.map +0 -1
- package/dist/coordination/agents/phase3-wave2-meta.d.ts.map +0 -1
- package/dist/coordination/agents/phase4-verify.d.ts.map +0 -1
- package/dist/coordination/agents/phase5-review.d.ts.map +0 -1
- package/dist/coordination/agents/phase6-domain.d.ts.map +0 -1
- package/dist/coordination/agents/phase7-knowledge.d.ts.map +0 -1
- package/dist/coordination/agents/phase8-delivery.d.ts.map +0 -1
- package/dist/coordination/agents/phase8-wave3-products.d.ts.map +0 -1
- package/dist/coordination/agents/phase9-meta.d.ts.map +0 -1
- package/dist/coordination/agents/phase9-wave4-platform-meta.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-config-validation.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-consolidation.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-files.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-identity-types.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-identity.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-knowledge-manifests.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-learning-entries.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-learning-normalize.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-learning-policy.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-learning-structured.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-paths.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-profile.d.ts.map +0 -1
- package/dist/coordination/agents/role-skills.d.ts.map +0 -1
- package/dist/coordination/agents/types.d.ts.map +0 -1
- package/dist/coordination/agents.d.ts.map +0 -1
- package/dist/coordination/auto-extend.d.ts.map +0 -1
- package/dist/coordination/autonomous-brain.d.ts.map +0 -1
- package/dist/coordination/autonomous-coordinator.d.ts.map +0 -1
- package/dist/coordination/brain-cache.d.ts.map +0 -1
- package/dist/coordination/brain-heuristics.d.ts.map +0 -1
- package/dist/coordination/brain-ledger.d.ts.map +0 -1
- package/dist/coordination/brain-monitor.d.ts.map +0 -1
- package/dist/coordination/brain-rules.d.ts.map +0 -1
- package/dist/coordination/brain-telemetry.d.ts.map +0 -1
- package/dist/coordination/brain-trace.d.ts.map +0 -1
- package/dist/coordination/brain.d.ts.map +0 -1
- package/dist/coordination/change-manager.d.ts.map +0 -1
- package/dist/coordination/checkpoint-wiring.d.ts.map +0 -1
- package/dist/coordination/collab-bus.d.ts.map +0 -1
- package/dist/coordination/collab-debug-types.d.ts.map +0 -1
- package/dist/coordination/collab-debug.d.ts.map +0 -1
- package/dist/coordination/collab-director-host.d.ts.map +0 -1
- package/dist/coordination/commit-safety.d.ts.map +0 -1
- package/dist/coordination/consensus-protocol.d.ts.map +0 -1
- package/dist/coordination/coordinator/error-classifier.d.ts.map +0 -1
- package/dist/coordination/delegate-tool.d.ts.map +0 -1
- package/dist/coordination/dep-watcher-bridge.d.ts.map +0 -1
- package/dist/coordination/dep-watcher.d.ts.map +0 -1
- package/dist/coordination/director/director-btw-notes.d.ts.map +0 -1
- package/dist/coordination/director/director-budget-policy.d.ts.map +0 -1
- package/dist/coordination/director/director-collab.d.ts.map +0 -1
- package/dist/coordination/director/director-errors.d.ts.map +0 -1
- package/dist/coordination/director/director-task-registry.d.ts.map +0 -1
- package/dist/coordination/director/director-toolset.d.ts.map +0 -1
- package/dist/coordination/director-basic-tools.d.ts.map +0 -1
- package/dist/coordination/director-collab-tools.d.ts.map +0 -1
- package/dist/coordination/director-host-contracts.d.ts.map +0 -1
- package/dist/coordination/director-input-helpers.d.ts.map +0 -1
- package/dist/coordination/director-kanban-queue-helpers.d.ts.map +0 -1
- package/dist/coordination/director-options.d.ts.map +0 -1
- package/dist/coordination/director-prompts.d.ts.map +0 -1
- package/dist/coordination/director-quality-gate-tool.d.ts.map +0 -1
- package/dist/coordination/director-session.d.ts.map +0 -1
- package/dist/coordination/director-spawn-model.d.ts.map +0 -1
- package/dist/coordination/director-tools.d.ts.map +0 -1
- package/dist/coordination/director.d.ts.map +0 -1
- package/dist/coordination/dispatcher.d.ts.map +0 -1
- package/dist/coordination/file-author-tracker.d.ts.map +0 -1
- package/dist/coordination/fleet-bus.d.ts.map +0 -1
- package/dist/coordination/fleet-event-validation.d.ts.map +0 -1
- package/dist/coordination/fleet-manager.d.ts.map +0 -1
- package/dist/coordination/fleet-spawn.d.ts.map +0 -1
- package/dist/coordination/fleet-status-tool.d.ts.map +0 -1
- package/dist/coordination/fleet-supervisor.d.ts.map +0 -1
- package/dist/coordination/fleet.d.ts.map +0 -1
- package/dist/coordination/global-mailbox-completion.d.ts.map +0 -1
- package/dist/coordination/global-mailbox-paths.d.ts.map +0 -1
- package/dist/coordination/icoordinator.d.ts.map +0 -1
- package/dist/coordination/ifleet-manager.d.ts.map +0 -1
- package/dist/coordination/in-memory-transport.d.ts.map +0 -1
- package/dist/coordination/index.d.ts.map +0 -1
- package/dist/coordination/index.js.map +0 -7
- package/dist/coordination/knowledge-graph.d.ts.map +0 -1
- package/dist/coordination/large-answer-store.d.ts.map +0 -1
- package/dist/coordination/mail-tools.d.ts.map +0 -1
- package/dist/coordination/mailbox-actions.d.ts.map +0 -1
- package/dist/coordination/mailbox-auth-types.d.ts.map +0 -1
- package/dist/coordination/mailbox-codecs.d.ts.map +0 -1
- package/dist/coordination/mailbox-constants.d.ts.map +0 -1
- package/dist/coordination/mailbox-credential-store.d.ts.map +0 -1
- package/dist/coordination/mailbox-events.d.ts.map +0 -1
- package/dist/coordination/mailbox-health.d.ts.map +0 -1
- package/dist/coordination/mailbox-hooks.d.ts.map +0 -1
- package/dist/coordination/mailbox-http-auth.d.ts.map +0 -1
- package/dist/coordination/mailbox-http-rate-limit.d.ts.map +0 -1
- package/dist/coordination/mailbox-http-router.d.ts.map +0 -1
- package/dist/coordination/mailbox-http-validation.d.ts.map +0 -1
- package/dist/coordination/mailbox-message-codec.d.ts.map +0 -1
- package/dist/coordination/mailbox-parse-state.d.ts.map +0 -1
- package/dist/coordination/mailbox-project-server-client.d.ts.map +0 -1
- package/dist/coordination/mailbox-project-server-endpoint.d.ts.map +0 -1
- package/dist/coordination/mailbox-project-server-protocol.d.ts.map +0 -1
- package/dist/coordination/mailbox-project-server.d.ts.map +0 -1
- package/dist/coordination/mailbox-project-server.js.map +0 -7
- package/dist/coordination/mailbox-receipt-folding.d.ts.map +0 -1
- package/dist/coordination/mailbox-registry-codec.d.ts.map +0 -1
- package/dist/coordination/mailbox-retention-state.d.ts.map +0 -1
- package/dist/coordination/mailbox-status-mappers.d.ts.map +0 -1
- package/dist/coordination/mailbox-tool.d.ts.map +0 -1
- package/dist/coordination/mailbox-type-properties.d.ts.map +0 -1
- package/dist/coordination/mailbox-types.d.ts.map +0 -1
- package/dist/coordination/model-matrix.d.ts.map +0 -1
- package/dist/coordination/multi-agent-coordinator.d.ts.map +0 -1
- package/dist/coordination/multi-agent-timeout.d.ts.map +0 -1
- package/dist/coordination/null-fleet-bus.d.ts.map +0 -1
- package/dist/coordination/package-author-tracker.d.ts.map +0 -1
- package/dist/coordination/package-outdated-watcher.d.ts.map +0 -1
- package/dist/coordination/provider-status-tracker.d.ts.map +0 -1
- package/dist/coordination/remote-mailbox-credential-store.d.ts.map +0 -1
- package/dist/coordination/remote-mailbox.d.ts.map +0 -1
- package/dist/coordination/single-instance-mailbox.d.ts.map +0 -1
- package/dist/coordination/spawn-budget.d.ts.map +0 -1
- package/dist/coordination/sqlite-mailbox-compaction.d.ts.map +0 -1
- package/dist/coordination/sqlite-mailbox-credentials.d.ts.map +0 -1
- package/dist/coordination/sqlite-mailbox-rows.d.ts.map +0 -1
- package/dist/coordination/sqlite-mailbox-schema.d.ts.map +0 -1
- package/dist/coordination/sqlite-mailbox.d.ts.map +0 -1
- package/dist/coordination/subagent-budget.d.ts.map +0 -1
- package/dist/coordination/subagent-nicknames.d.ts.map +0 -1
- package/dist/coordination/subagent-result-tool.d.ts.map +0 -1
- package/dist/coordination/task-auctioneer.d.ts.map +0 -1
- package/dist/coordination/task-dag.d.ts.map +0 -1
- package/dist/coordination/techstack-mailbox-consumer.d.ts.map +0 -1
- package/dist/coordination/transport.d.ts.map +0 -1
- package/dist/coordination/worktree-task-runner.d.ts.map +0 -1
- package/dist/core/agent-internals.d.ts.map +0 -1
- package/dist/core/agent-loop.d.ts.map +0 -1
- package/dist/core/agent-response.d.ts.map +0 -1
- package/dist/core/agent-tools.d.ts.map +0 -1
- package/dist/core/agent-types.d.ts.map +0 -1
- package/dist/core/agent.d.ts.map +0 -1
- package/dist/core/btw.d.ts.map +0 -1
- package/dist/core/context.d.ts.map +0 -1
- package/dist/core/continue-intent.d.ts.map +0 -1
- package/dist/core/continue-to-next-iteration.d.ts.map +0 -1
- package/dist/core/conversation-state.d.ts.map +0 -1
- package/dist/core/fallback-model.d.ts.map +0 -1
- package/dist/core/fallback-profile-manager.d.ts.map +0 -1
- package/dist/core/fleet-pulse.d.ts.map +0 -1
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js.map +0 -7
- package/dist/core/input-builder.d.ts.map +0 -1
- package/dist/core/instruction-bundle.d.ts.map +0 -1
- package/dist/core/iteration-limit.d.ts.map +0 -1
- package/dist/core/mailbox-loop.d.ts.map +0 -1
- package/dist/core/model-availability-calendar.d.ts.map +0 -1
- package/dist/core/model-ref.d.ts.map +0 -1
- package/dist/core/model-ref.js.map +0 -7
- package/dist/core/modes/brief.d.ts.map +0 -1
- package/dist/core/modes/default.d.ts.map +0 -1
- package/dist/core/modes/teach.d.ts.map +0 -1
- package/dist/core/provider-runner.d.ts.map +0 -1
- package/dist/core/queued-messages.d.ts.map +0 -1
- package/dist/core/request-provider-binding.d.ts.map +0 -1
- package/dist/core/run-env.d.ts.map +0 -1
- package/dist/core/streaming-response-builder.d.ts.map +0 -1
- package/dist/core/system-prompt-blocks.d.ts.map +0 -1
- package/dist/core/system-prompt-builder.d.ts.map +0 -1
- package/dist/core/system-prompt-environment-probes.d.ts.map +0 -1
- package/dist/core/system-prompt-environment.d.ts.map +0 -1
- package/dist/core/system-prompt-memory-skills.d.ts.map +0 -1
- package/dist/core/system-prompt-plan.d.ts.map +0 -1
- package/dist/core/system-prompt-shell.d.ts.map +0 -1
- package/dist/core/system-prompt-skill-bodies.d.ts.map +0 -1
- package/dist/core/system-prompt-skill-text.d.ts.map +0 -1
- package/dist/defaults/index.d.ts.map +0 -1
- package/dist/defaults/index.js.map +0 -7
- package/dist/design/index.d.ts.map +0 -1
- package/dist/design/index.js.map +0 -7
- package/dist/execution/auto-compaction-middleware.d.ts.map +0 -1
- package/dist/execution/autonomous-runner.d.ts.map +0 -1
- package/dist/execution/autonomy-brain.d.ts.map +0 -1
- package/dist/execution/autonomy-prompt-contributor.d.ts.map +0 -1
- package/dist/execution/brain-chain.d.ts.map +0 -1
- package/dist/execution/brain-circuit.d.ts.map +0 -1
- package/dist/execution/brain-evaluation.d.ts.map +0 -1
- package/dist/execution/brain-runtime-constants.d.ts.map +0 -1
- package/dist/execution/brain-runtime.d.ts.map +0 -1
- package/dist/execution/compaction-core.d.ts.map +0 -1
- package/dist/execution/compaction-scoring.d.ts.map +0 -1
- package/dist/execution/compaction-summary-cache.d.ts.map +0 -1
- package/dist/execution/compactor.d.ts.map +0 -1
- package/dist/execution/council-brain.d.ts.map +0 -1
- package/dist/execution/council-orchestrator.d.ts.map +0 -1
- package/dist/execution/council-personas.d.ts.map +0 -1
- package/dist/execution/council-profiles.d.ts.map +0 -1
- package/dist/execution/council-prompts.d.ts.map +0 -1
- package/dist/execution/council-resolution.d.ts.map +0 -1
- package/dist/execution/design-color.d.ts.map +0 -1
- package/dist/execution/design-detect.d.ts.map +0 -1
- package/dist/execution/design-kit-loader.d.ts.map +0 -1
- package/dist/execution/design-materialize.d.ts.map +0 -1
- package/dist/execution/design-project-store.d.ts.map +0 -1
- package/dist/execution/design-tune.d.ts.map +0 -1
- package/dist/execution/design-verify.d.ts.map +0 -1
- package/dist/execution/enhance-recovery.d.ts.map +0 -1
- package/dist/execution/error-handler.d.ts.map +0 -1
- package/dist/execution/eternal-autonomy-types.d.ts.map +0 -1
- package/dist/execution/eternal-autonomy.d.ts.map +0 -1
- package/dist/execution/goal-preamble.d.ts.map +0 -1
- package/dist/execution/index.d.ts.map +0 -1
- package/dist/execution/index.js.map +0 -7
- package/dist/execution/intelligent-compactor.d.ts.map +0 -1
- package/dist/execution/model-runtime.d.ts.map +0 -1
- package/dist/execution/one-shot-llm.d.ts.map +0 -1
- package/dist/execution/parallel-eternal-engine.d.ts.map +0 -1
- package/dist/execution/prompt-enhancer.d.ts.map +0 -1
- package/dist/execution/prompt-enhancer.js.map +0 -7
- package/dist/execution/prompt-loader.d.ts.map +0 -1
- package/dist/execution/provider-runner-impl.d.ts.map +0 -1
- package/dist/execution/regex-patterns.d.ts.map +0 -1
- package/dist/execution/retry-policy.d.ts.map +0 -1
- package/dist/execution/selective-compactor.d.ts.map +0 -1
- package/dist/execution/skill-loader.d.ts.map +0 -1
- package/dist/execution/strategy-compactor.d.ts.map +0 -1
- package/dist/execution/subagent-compaction.d.ts.map +0 -1
- package/dist/execution/tool-executor-logging.d.ts.map +0 -1
- package/dist/execution/tool-executor-results.d.ts.map +0 -1
- package/dist/execution/tool-executor-stream.d.ts.map +0 -1
- package/dist/execution/tool-executor-support.d.ts.map +0 -1
- package/dist/execution/tool-executor.d.ts.map +0 -1
- package/dist/extension/extension-points.d.ts.map +0 -1
- package/dist/extension/index.d.ts.map +0 -1
- package/dist/extension/index.js.map +0 -7
- package/dist/extension/registry.d.ts.map +0 -1
- package/dist/fleet-notifier.d.ts.map +0 -1
- package/dist/goal/checkpoint.d.ts.map +0 -1
- package/dist/goal/goal-assessor.d.ts.map +0 -1
- package/dist/goal/goal-planner.d.ts.map +0 -1
- package/dist/goal/goal-runner.d.ts.map +0 -1
- package/dist/goal/index.d.ts.map +0 -1
- package/dist/goal/index.js.map +0 -7
- package/dist/goal/phase-board-mutations.d.ts.map +0 -1
- package/dist/goal/phase-graph-builder.d.ts.map +0 -1
- package/dist/goal/phase-orchestrator-integration.d.ts.map +0 -1
- package/dist/goal/phase-orchestrator-queries.d.ts.map +0 -1
- package/dist/goal/phase-orchestrator-runtime.d.ts.map +0 -1
- package/dist/goal/phase-orchestrator-types.d.ts.map +0 -1
- package/dist/goal/phase-orchestrator.d.ts.map +0 -1
- package/dist/goal/phase-store.d.ts.map +0 -1
- package/dist/goal/types.d.ts.map +0 -1
- package/dist/hooks/http-executor.d.ts.map +0 -1
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js.map +0 -7
- package/dist/hooks/registry.d.ts.map +0 -1
- package/dist/hooks/runner.d.ts.map +0 -1
- package/dist/hooks/shell-executor.d.ts.map +0 -1
- package/dist/hooks/shell-hooks-equal.d.ts.map +0 -1
- package/dist/hq/alerts.d.ts.map +0 -1
- package/dist/hq/auth-audit.d.ts.map +0 -1
- package/dist/hq/auth-store.d.ts.map +0 -1
- package/dist/hq/bootstrap-store.d.ts.map +0 -1
- package/dist/hq/brain-bridge.d.ts.map +0 -1
- package/dist/hq/bridge-context.d.ts.map +0 -1
- package/dist/hq/commands.d.ts.map +0 -1
- package/dist/hq/cost-bridge.d.ts.map +0 -1
- package/dist/hq/exposure.d.ts.map +0 -1
- package/dist/hq/factory.d.ts.map +0 -1
- package/dist/hq/fleet-bridge.d.ts.map +0 -1
- package/dist/hq/index.d.ts.map +0 -1
- package/dist/hq/index.js.map +0 -7
- package/dist/hq/kanban-store.d.ts.map +0 -1
- package/dist/hq/mailbox-mapper.d.ts.map +0 -1
- package/dist/hq/persistence/event-log.d.ts.map +0 -1
- package/dist/hq/persistence/jsonl-io.d.ts.map +0 -1
- package/dist/hq/persistence/simple-log.d.ts.map +0 -1
- package/dist/hq/persistence/snapshot-store.d.ts.map +0 -1
- package/dist/hq/persistence/timeseries-store.d.ts.map +0 -1
- package/dist/hq/persistence.d.ts.map +0 -1
- package/dist/hq/protocol/brain.d.ts.map +0 -1
- package/dist/hq/protocol/browser.d.ts.map +0 -1
- package/dist/hq/protocol/client.d.ts.map +0 -1
- package/dist/hq/protocol/core.d.ts.map +0 -1
- package/dist/hq/protocol/fleet.d.ts.map +0 -1
- package/dist/hq/protocol/kanban.d.ts.map +0 -1
- package/dist/hq/protocol/mailbox.d.ts.map +0 -1
- package/dist/hq/protocol/mcp.d.ts.map +0 -1
- package/dist/hq/protocol/project.d.ts.map +0 -1
- package/dist/hq/protocol/session.d.ts.map +0 -1
- package/dist/hq/protocol/tool.d.ts.map +0 -1
- package/dist/hq/protocol.d.ts.map +0 -1
- package/dist/hq/publisher.d.ts.map +0 -1
- package/dist/hq/redaction.d.ts.map +0 -1
- package/dist/hq/session-bridge.d.ts.map +0 -1
- package/dist/hq/tool-bridge.d.ts.map +0 -1
- package/dist/hq/transcript-mapper.d.ts.map +0 -1
- package/dist/hq/worktree-bridge.d.ts.map +0 -1
- package/dist/hq/write-queues.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -7
- package/dist/infrastructure/context-manager.d.ts.map +0 -1
- package/dist/infrastructure/index.d.ts.map +0 -1
- package/dist/infrastructure/index.js.map +0 -7
- package/dist/infrastructure/logger.d.ts.map +0 -1
- package/dist/infrastructure/mcp-servers.d.ts.map +0 -1
- package/dist/infrastructure/path-resolver.d.ts.map +0 -1
- package/dist/infrastructure/provider-cache-ledger.d.ts.map +0 -1
- package/dist/infrastructure/token-counter.d.ts.map +0 -1
- package/dist/kernel/container.d.ts.map +0 -1
- package/dist/kernel/events/agent-events.d.ts.map +0 -1
- package/dist/kernel/events/brain-events.d.ts.map +0 -1
- package/dist/kernel/events/file-events.d.ts.map +0 -1
- package/dist/kernel/events/fleet-events.d.ts.map +0 -1
- package/dist/kernel/events/memory-events.d.ts.map +0 -1
- package/dist/kernel/events/network-events.d.ts.map +0 -1
- package/dist/kernel/events/process-events.d.ts.map +0 -1
- package/dist/kernel/events/provider-events.d.ts.map +0 -1
- package/dist/kernel/events/sdd-events.d.ts.map +0 -1
- package/dist/kernel/events/session-events.d.ts.map +0 -1
- package/dist/kernel/events/tool-events.d.ts.map +0 -1
- package/dist/kernel/events/worktree-events.d.ts.map +0 -1
- package/dist/kernel/events.d.ts.map +0 -1
- package/dist/kernel/index.d.ts.map +0 -1
- package/dist/kernel/index.js.map +0 -7
- package/dist/kernel/pipeline.d.ts.map +0 -1
- package/dist/kernel/run-controller.d.ts.map +0 -1
- package/dist/kernel/tokens.d.ts.map +0 -1
- package/dist/mailbox-attach.d.ts.map +0 -1
- package/dist/middleware/collab-pause.d.ts.map +0 -1
- package/dist/models/alibaba-token-plan-catalog.d.ts.map +0 -1
- package/dist/models/codex-catalog.d.ts.map +0 -1
- package/dist/models/index.d.ts.map +0 -1
- package/dist/models/index.js.map +0 -7
- package/dist/models/llm-selector.d.ts.map +0 -1
- package/dist/models/mode-store.d.ts.map +0 -1
- package/dist/models/model-intelligence.d.ts.map +0 -1
- package/dist/models/model-router.d.ts.map +0 -1
- package/dist/models/models-registry.d.ts.map +0 -1
- package/dist/models/provider-model-resolve.d.ts.map +0 -1
- package/dist/notifications/index.d.ts.map +0 -1
- package/dist/notifications/index.js.map +0 -7
- package/dist/notifications/notifier-impl.d.ts.map +0 -1
- package/dist/notifications/notifier.d.ts.map +0 -1
- package/dist/notifications/types.d.ts.map +0 -1
- package/dist/observability/event-bridge.d.ts.map +0 -1
- package/dist/observability/health.d.ts.map +0 -1
- package/dist/observability/index.d.ts.map +0 -1
- package/dist/observability/index.js.map +0 -7
- package/dist/observability/metrics.d.ts.map +0 -1
- package/dist/observability/network-telemetry.d.ts.map +0 -1
- package/dist/observability/otel-tracer.d.ts.map +0 -1
- package/dist/observability/otlp-metrics.d.ts.map +0 -1
- package/dist/observability/otlp-traces.d.ts.map +0 -1
- package/dist/observability/process-telemetry.d.ts.map +0 -1
- package/dist/observability/prometheus.d.ts.map +0 -1
- package/dist/observability/redact-command.d.ts.map +0 -1
- package/dist/observability/tracer.d.ts.map +0 -1
- package/dist/plugin/api.d.ts.map +0 -1
- package/dist/plugin/config.d.ts.map +0 -1
- package/dist/plugin/index.d.ts.map +0 -1
- package/dist/plugin/index.js.map +0 -7
- package/dist/plugin/loader.d.ts.map +0 -1
- package/dist/plugins/auto-review-plugin.d.ts.map +0 -1
- package/dist/plugins/chimera-plugin.d.ts.map +0 -1
- package/dist/plugins/prompts-plugin.d.ts.map +0 -1
- package/dist/plugins/review-claim-registry.d.ts.map +0 -1
- package/dist/plugins/review-context-builder.d.ts.map +0 -1
- package/dist/plugins/review-finding-commands.d.ts.map +0 -1
- package/dist/plugins/review-finding-integration.d.ts.map +0 -1
- package/dist/plugins/review-finding-parser.d.ts.map +0 -1
- package/dist/plugins/review-finding-store.d.ts.map +0 -1
- package/dist/plugins/review-finding-types.d.ts.map +0 -1
- package/dist/plugins/review-report-integration.d.ts.map +0 -1
- package/dist/plugins/review-report-store.d.ts.map +0 -1
- package/dist/plugins/review-report-types.d.ts.map +0 -1
- package/dist/plugins/review-types.d.ts.map +0 -1
- package/dist/plugins/skills-plugin.d.ts.map +0 -1
- package/dist/plugins/sync-plugin.d.ts.map +0 -1
- package/dist/prompts/index.d.ts.map +0 -1
- package/dist/prompts/prompt-installer.d.ts.map +0 -1
- package/dist/prompts/prompt-manifest-store.d.ts.map +0 -1
- package/dist/registry/index.d.ts.map +0 -1
- package/dist/registry/index.js.map +0 -7
- package/dist/registry/provider-registry.d.ts.map +0 -1
- package/dist/registry/slash-command-registry.d.ts.map +0 -1
- package/dist/registry/tool-registry.d.ts.map +0 -1
- package/dist/replay/hash.d.ts.map +0 -1
- package/dist/replay/index.d.ts.map +0 -1
- package/dist/replay/index.js.map +0 -7
- package/dist/replay/replay-provider-runner.d.ts.map +0 -1
- package/dist/security/capabilities.d.ts.map +0 -1
- package/dist/security/config-secrets.d.ts.map +0 -1
- package/dist/security/directory-permission-policy.d.ts.map +0 -1
- package/dist/security/directory-policy-schema.d.ts.map +0 -1
- package/dist/security/index.d.ts.map +0 -1
- package/dist/security/index.js.map +0 -7
- package/dist/security/kanban-boundary.d.ts.map +0 -1
- package/dist/security/permission-policy-schema.d.ts.map +0 -1
- package/dist/security/permission-policy.d.ts.map +0 -1
- package/dist/security/readonly-permission-policy.d.ts.map +0 -1
- package/dist/security/secret-scrubber.d.ts.map +0 -1
- package/dist/security/secret-vault.d.ts.map +0 -1
- package/dist/security/trust-boundary.d.ts.map +0 -1
- package/dist/security/yolo-risk.d.ts.map +0 -1
- package/dist/session-registry-atomic-file.d.ts.map +0 -1
- package/dist/session-registry-types.d.ts.map +0 -1
- package/dist/session-registry.d.ts.map +0 -1
- package/dist/skills/foreign-sources.d.ts.map +0 -1
- package/dist/skills/frontmatter.d.ts.map +0 -1
- package/dist/skills/github-fetcher.d.ts.map +0 -1
- package/dist/skills/index.d.ts.map +0 -1
- package/dist/skills/index.js.map +0 -7
- package/dist/skills/limits.d.ts.map +0 -1
- package/dist/skills/manifest-store.d.ts.map +0 -1
- package/dist/skills/registry/github-direct-adapter.d.ts.map +0 -1
- package/dist/skills/registry/registry-adapter.d.ts.map +0 -1
- package/dist/skills/registry/skills-sh-adapter.d.ts.map +0 -1
- package/dist/skills/skill-generator.d.ts.map +0 -1
- package/dist/skills/skill-installer.d.ts.map +0 -1
- package/dist/storage/annotations-store.d.ts.map +0 -1
- package/dist/storage/attachment-store.d.ts.map +0 -1
- package/dist/storage/cloud-sync.d.ts.map +0 -1
- package/dist/storage/completed-work-checkpoint.d.ts.map +0 -1
- package/dist/storage/config-loader/bootstrap.d.ts.map +0 -1
- package/dist/storage/config-loader/default-repair.d.ts.map +0 -1
- package/dist/storage/config-loader/defaults.d.ts.map +0 -1
- package/dist/storage/config-loader/diagnostics.d.ts.map +0 -1
- package/dist/storage/config-loader/env-overrides.d.ts.map +0 -1
- package/dist/storage/config-loader/in-project-policy.d.ts.map +0 -1
- package/dist/storage/config-loader/inline-provider-models.d.ts.map +0 -1
- package/dist/storage/config-loader/legacy-sage-migration.d.ts.map +0 -1
- package/dist/storage/config-loader/path-identity.d.ts.map +0 -1
- package/dist/storage/config-loader/types.d.ts.map +0 -1
- package/dist/storage/config-loader/validation.d.ts.map +0 -1
- package/dist/storage/config-loader.d.ts.map +0 -1
- package/dist/storage/config-migration.d.ts.map +0 -1
- package/dist/storage/config-store.d.ts.map +0 -1
- package/dist/storage/director-state.d.ts.map +0 -1
- package/dist/storage/file-session-writer.d.ts.map +0 -1
- package/dist/storage/goal-coordination.d.ts.map +0 -1
- package/dist/storage/goal-kanban.d.ts.map +0 -1
- package/dist/storage/goal-store.d.ts.map +0 -1
- package/dist/storage/index.d.ts.map +0 -1
- package/dist/storage/index.js.map +0 -7
- package/dist/storage/input-history-store.d.ts.map +0 -1
- package/dist/storage/memory-backend.d.ts.map +0 -1
- package/dist/storage/memory-consolidator.d.ts.map +0 -1
- package/dist/storage/memory-graph-backend.d.ts.map +0 -1
- package/dist/storage/plan-store.d.ts.map +0 -1
- package/dist/storage/plan-templates.d.ts.map +0 -1
- package/dist/storage/prompt-store.d.ts.map +0 -1
- package/dist/storage/prompt-usage-store.d.ts.map +0 -1
- package/dist/storage/provider-config-watcher.d.ts.map +0 -1
- package/dist/storage/queue-store.d.ts.map +0 -1
- package/dist/storage/recovery-lock.d.ts.map +0 -1
- package/dist/storage/replay-log-store.d.ts.map +0 -1
- package/dist/storage/session-analyzer.d.ts.map +0 -1
- package/dist/storage/session-checkpoint-cas.d.ts.map +0 -1
- package/dist/storage/session-event-bridge.d.ts.map +0 -1
- package/dist/storage/session-helpers.d.ts.map +0 -1
- package/dist/storage/session-id-resolver.d.ts.map +0 -1
- package/dist/storage/session-id.d.ts.map +0 -1
- package/dist/storage/session-read-scrubber.d.ts.map +0 -1
- package/dist/storage/session-reader.d.ts.map +0 -1
- package/dist/storage/session-recovery.d.ts.map +0 -1
- package/dist/storage/session-resume-validation.d.ts.map +0 -1
- package/dist/storage/session-rewind-apply.d.ts.map +0 -1
- package/dist/storage/session-rewinder.d.ts.map +0 -1
- package/dist/storage/session-store/delete-session-artifacts.d.ts.map +0 -1
- package/dist/storage/session-store/delete-session-guards.d.ts.map +0 -1
- package/dist/storage/session-store/directory-scan.d.ts.map +0 -1
- package/dist/storage/session-store/directory-session-files.d.ts.map +0 -1
- package/dist/storage/session-store/events.d.ts.map +0 -1
- package/dist/storage/session-store/fork-session.d.ts.map +0 -1
- package/dist/storage/session-store/index-reader.d.ts.map +0 -1
- package/dist/storage/session-store/load-cache.d.ts.map +0 -1
- package/dist/storage/session-store/load-session-data.d.ts.map +0 -1
- package/dist/storage/session-store/paths.d.ts.map +0 -1
- package/dist/storage/session-store/prune-helpers.d.ts.map +0 -1
- package/dist/storage/session-store/replay.d.ts.map +0 -1
- package/dist/storage/session-store/search-events.d.ts.map +0 -1
- package/dist/storage/session-store/shard-manifest.d.ts.map +0 -1
- package/dist/storage/session-store/summary-builder.d.ts.map +0 -1
- package/dist/storage/session-store/summary-header.d.ts.map +0 -1
- package/dist/storage/session-store/types.d.ts.map +0 -1
- package/dist/storage/session-store.d.ts.map +0 -1
- package/dist/storage/session-summary.d.ts.map +0 -1
- package/dist/storage/session-tool-call-ends.d.ts.map +0 -1
- package/dist/storage/session-writer-scrubber.d.ts.map +0 -1
- package/dist/storage/session-writer-truncate.d.ts.map +0 -1
- package/dist/storage/storage-concurrency.d.ts.map +0 -1
- package/dist/storage/task-store.d.ts.map +0 -1
- package/dist/storage/todos-checkpoint.d.ts.map +0 -1
- package/dist/storage/tool-audit-log.d.ts.map +0 -1
- package/dist/tasking/index.d.ts.map +0 -1
- package/dist/tasking/index.js.map +0 -7
- package/dist/tasking/task-store.d.ts.map +0 -1
- package/dist/tasking/task-tracker.d.ts.map +0 -1
- package/dist/tools/council-tool.d.ts.map +0 -1
- package/dist/tools/fallback-chain-manage-tool.d.ts.map +0 -1
- package/dist/tools/fallback-favorite-manage-tool.d.ts.map +0 -1
- package/dist/tools/fallback-manage-helpers.d.ts.map +0 -1
- package/dist/tools/fallback-manage-tool-options.d.ts.map +0 -1
- package/dist/tools/fallback-manage-tools.d.ts.map +0 -1
- package/dist/tools/fallback-model-ref-parse.d.ts.map +0 -1
- package/dist/tools/fallback-provider-key-store.d.ts.map +0 -1
- package/dist/tools/fallback-system-config-view-tool.d.ts.map +0 -1
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js.map +0 -7
- package/dist/tools/mcp-control.d.ts.map +0 -1
- package/dist/tools/mcp-use.d.ts.map +0 -1
- package/dist/tools/one-shot-llm-tool.d.ts.map +0 -1
- package/dist/tools/plugin-manager.d.ts.map +0 -1
- package/dist/types/agent-bridge.d.ts.map +0 -1
- package/dist/types/attachment.d.ts.map +0 -1
- package/dist/types/autonomy.d.ts.map +0 -1
- package/dist/types/blocks.d.ts.map +0 -1
- package/dist/types/compactor.d.ts.map +0 -1
- package/dist/types/config/autonomy.d.ts.map +0 -1
- package/dist/types/config/context.d.ts.map +0 -1
- package/dist/types/config/fleet-chat.d.ts.map +0 -1
- package/dist/types/config/mcp-features.d.ts.map +0 -1
- package/dist/types/config/providers.d.ts.map +0 -1
- package/dist/types/config/root.d.ts.map +0 -1
- package/dist/types/config/runtime.d.ts.map +0 -1
- package/dist/types/config/skills-fleet-brain.d.ts.map +0 -1
- package/dist/types/config/tools.d.ts.map +0 -1
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/context-evidence.d.ts.map +0 -1
- package/dist/types/context-window.d.ts.map +0 -1
- package/dist/types/council.d.ts.map +0 -1
- package/dist/types/default-config.d.ts.map +0 -1
- package/dist/types/design-kit.d.ts.map +0 -1
- package/dist/types/error-handler.d.ts.map +0 -1
- package/dist/types/errors.d.ts.map +0 -1
- package/dist/types/file-event-record.d.ts.map +0 -1
- package/dist/types/hooks.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -7
- package/dist/types/input-reader.d.ts.map +0 -1
- package/dist/types/logger.d.ts.map +0 -1
- package/dist/types/memory.d.ts.map +0 -1
- package/dist/types/messages.d.ts.map +0 -1
- package/dist/types/mode-prompts.d.ts.map +0 -1
- package/dist/types/mode.d.ts.map +0 -1
- package/dist/types/models-registry.d.ts.map +0 -1
- package/dist/types/multi-agent.d.ts.map +0 -1
- package/dist/types/observability.d.ts.map +0 -1
- package/dist/types/one-shot-llm.d.ts.map +0 -1
- package/dist/types/path-resolver.d.ts.map +0 -1
- package/dist/types/permission.d.ts.map +0 -1
- package/dist/types/plugin.d.ts.map +0 -1
- package/dist/types/prompt-registry.d.ts.map +0 -1
- package/dist/types/prompt.d.ts.map +0 -1
- package/dist/types/provider-runner.d.ts.map +0 -1
- package/dist/types/provider.d.ts.map +0 -1
- package/dist/types/quota-regex.d.ts.map +0 -1
- package/dist/types/renderer.d.ts.map +0 -1
- package/dist/types/retry-policy.d.ts.map +0 -1
- package/dist/types/secret-scrubber.d.ts.map +0 -1
- package/dist/types/secret-vault.d.ts.map +0 -1
- package/dist/types/selector.d.ts.map +0 -1
- package/dist/types/session-markers.d.ts.map +0 -1
- package/dist/types/session-markers.js.map +0 -7
- package/dist/types/session-reader.d.ts.map +0 -1
- package/dist/types/session-rewinder.d.ts.map +0 -1
- package/dist/types/session.d.ts.map +0 -1
- package/dist/types/side-effect.d.ts.map +0 -1
- package/dist/types/skill.d.ts.map +0 -1
- package/dist/types/slash-command.d.ts.map +0 -1
- package/dist/types/spec.d.ts.map +0 -1
- package/dist/types/system-prompt-contributor.d.ts.map +0 -1
- package/dist/types/system-prompt.d.ts.map +0 -1
- package/dist/types/task-graph.d.ts.map +0 -1
- package/dist/types/token-counter.d.ts.map +0 -1
- package/dist/types/tool-executor.d.ts.map +0 -1
- package/dist/types/tool-markers.d.ts.map +0 -1
- package/dist/types/tool.d.ts.map +0 -1
- package/dist/types/utility-types.d.ts.map +0 -1
- package/dist/utils/assert-never.d.ts.map +0 -1
- package/dist/utils/atomic-write.d.ts.map +0 -1
- package/dist/utils/cache-key.d.ts.map +0 -1
- package/dist/utils/child-env.d.ts.map +0 -1
- package/dist/utils/color.d.ts.map +0 -1
- package/dist/utils/compaction-preview.d.ts.map +0 -1
- package/dist/utils/config-backup.d.ts.map +0 -1
- package/dist/utils/config-json.d.ts.map +0 -1
- package/dist/utils/connectivity.d.ts.map +0 -1
- package/dist/utils/context-breakdown.d.ts.map +0 -1
- package/dist/utils/context-evidence.d.ts.map +0 -1
- package/dist/utils/crash-shield.d.ts.map +0 -1
- package/dist/utils/deep-merge.d.ts.map +0 -1
- package/dist/utils/diff.d.ts.map +0 -1
- package/dist/utils/error.d.ts.map +0 -1
- package/dist/utils/error.js.map +0 -7
- package/dist/utils/expect-defined.d.ts.map +0 -1
- package/dist/utils/expect-defined.js.map +0 -7
- package/dist/utils/glob-expand.d.ts.map +0 -1
- package/dist/utils/glob-match.d.ts.map +0 -1
- package/dist/utils/heap-watchdog.d.ts.map +0 -1
- package/dist/utils/heap-watchdog.js.map +0 -7
- package/dist/utils/incoming-images.d.ts.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js.map +0 -7
- package/dist/utils/instruction-file.d.ts.map +0 -1
- package/dist/utils/ip-guard.d.ts.map +0 -1
- package/dist/utils/json-repair.d.ts.map +0 -1
- package/dist/utils/json-schema-validate.d.ts.map +0 -1
- package/dist/utils/lru-cache.d.ts.map +0 -1
- package/dist/utils/merge-custom-models.d.ts.map +0 -1
- package/dist/utils/merge-models-payload.d.ts.map +0 -1
- package/dist/utils/message-invariants.d.ts.map +0 -1
- package/dist/utils/newline-normalize.d.ts.map +0 -1
- package/dist/utils/perf-profile.d.ts.map +0 -1
- package/dist/utils/pid.d.ts.map +0 -1
- package/dist/utils/project-identity.d.ts.map +0 -1
- package/dist/utils/project-watch.d.ts.map +0 -1
- package/dist/utils/regex-guard.d.ts.map +0 -1
- package/dist/utils/safe-json.d.ts.map +0 -1
- package/dist/utils/sage-output-block.d.ts.map +0 -1
- package/dist/utils/session-scoped-path.d.ts.map +0 -1
- package/dist/utils/sleep.d.ts.map +0 -1
- package/dist/utils/slug.d.ts.map +0 -1
- package/dist/utils/socket-path.d.ts.map +0 -1
- package/dist/utils/sqlite-warning.d.ts.map +0 -1
- package/dist/utils/string.d.ts.map +0 -1
- package/dist/utils/task-format.d.ts.map +0 -1
- package/dist/utils/term.d.ts.map +0 -1
- package/dist/utils/todos-format.d.ts.map +0 -1
- package/dist/utils/token-estimate.d.ts.map +0 -1
- package/dist/utils/tool-description-mode.d.ts.map +0 -1
- package/dist/utils/tool-output-serializer.d.ts.map +0 -1
- package/dist/utils/tool-result-render-mode.d.ts.map +0 -1
- package/dist/utils/tool-subject.d.ts.map +0 -1
- package/dist/utils/tool-wire-compact.d.ts.map +0 -1
- package/dist/utils/tree-kill.d.ts.map +0 -1
- package/dist/utils/tree-kill.js.map +0 -7
- package/dist/utils/ulid.d.ts.map +0 -1
- package/dist/utils/walk-ignore.d.ts.map +0 -1
- package/dist/utils/wstack-paths.d.ts.map +0 -1
- package/dist/worktree/index.d.ts.map +0 -1
- package/dist/worktree/index.js.map +0 -7
- package/dist/worktree/worktree-git.d.ts.map +0 -1
- package/dist/worktree/worktree-managed-ops.d.ts.map +0 -1
- package/dist/worktree/worktree-manager.d.ts.map +0 -1
- package/dist/worktree/worktree-types.d.ts.map +0 -1
package/dist/execution/index.js
CHANGED
|
@@ -514,7 +514,7 @@ var ConversationState = class {
|
|
|
514
514
|
message._estTokens = computeMessageTokens(message);
|
|
515
515
|
}
|
|
516
516
|
this.ctx.messages.splice(this.ctx.messages.length, 0, message);
|
|
517
|
-
const overflow = this.overflowCount();
|
|
517
|
+
const overflow = this.overflowCount(this.ctx.messages);
|
|
518
518
|
if (overflow > 0) {
|
|
519
519
|
this.ctx.messages.splice(0, overflow);
|
|
520
520
|
this.ctx.toolAdjacencyDirty = true;
|
|
@@ -534,8 +534,7 @@ var ConversationState = class {
|
|
|
534
534
|
* content blocks. It runs whenever the token cap is enabled; the count
|
|
535
535
|
* cap determines the starting index for the sum but does not gate it.
|
|
536
536
|
*/
|
|
537
|
-
overflowCount() {
|
|
538
|
-
const arr = this.ctx.messages;
|
|
537
|
+
overflowCount(arr) {
|
|
539
538
|
let drop = Context.MAX_MESSAGES > 0 ? Math.max(0, arr.length - Context.MAX_MESSAGES) : 0;
|
|
540
539
|
if (Context.MAX_MESSAGE_TOKENS <= 0) return drop;
|
|
541
540
|
let total = 0;
|
|
@@ -578,27 +577,30 @@ var ConversationState = class {
|
|
|
578
577
|
for (const m of messages) {
|
|
579
578
|
if (m._estTokens === void 0) {
|
|
580
579
|
m._estTokens = computeMessageTokens(m);
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
580
|
+
}
|
|
581
|
+
if (!hasToolBlock && Array.isArray(m.content)) {
|
|
582
|
+
for (const b of m.content) {
|
|
583
|
+
if (b.type === "tool_use" || b.type === "tool_result") {
|
|
584
|
+
hasToolBlock = true;
|
|
585
|
+
break;
|
|
587
586
|
}
|
|
588
587
|
}
|
|
589
588
|
}
|
|
590
589
|
}
|
|
590
|
+
const overflow = this.overflowCount(messages);
|
|
591
|
+
const retained = overflow > 0 ? messages.slice(overflow) : messages;
|
|
592
|
+
if (overflow > 0) this.ctx.toolAdjacencyDirty = true;
|
|
591
593
|
const arr = this.ctx.messages;
|
|
592
|
-
if (
|
|
593
|
-
arr.length =
|
|
594
|
+
if (retained.length < arr.length) {
|
|
595
|
+
arr.length = retained.length;
|
|
594
596
|
}
|
|
595
|
-
for (let i = 0; i <
|
|
596
|
-
arr[i] =
|
|
597
|
+
for (let i = 0; i < retained.length; i++) {
|
|
598
|
+
arr[i] = retained[i];
|
|
597
599
|
}
|
|
598
600
|
if (hasToolBlock) {
|
|
599
601
|
this.ctx.toolAdjacencyDirty = true;
|
|
600
602
|
}
|
|
601
|
-
this.emit({ kind: "messages_replaced", messages: [...
|
|
603
|
+
this.emit({ kind: "messages_replaced", messages: [...retained] });
|
|
602
604
|
}
|
|
603
605
|
replaceTodos(todos) {
|
|
604
606
|
const allDone = todos.length > 0 && todos.every((t) => t.status === "completed");
|
|
@@ -656,7 +658,7 @@ var Context = class _Context {
|
|
|
656
658
|
* (e.g., during a /rewind, provider error storm, or custom embedder).
|
|
657
659
|
* Set to 0 for unlimited (legacy/test behaviour).
|
|
658
660
|
*/
|
|
659
|
-
static MAX_MESSAGES =
|
|
661
|
+
static MAX_MESSAGES = 1e3;
|
|
660
662
|
/**
|
|
661
663
|
* Companion size cap on the same history, in estimated tokens.
|
|
662
664
|
*
|
|
@@ -666,12 +668,12 @@ var Context = class _Context {
|
|
|
666
668
|
* conversation, reached without ever tripping the count cap. Both caps guard
|
|
667
669
|
* the same failure — compaction not running — so both belong here.
|
|
668
670
|
*
|
|
669
|
-
*
|
|
670
|
-
* overhead. That is
|
|
671
|
-
*
|
|
671
|
+
* 1M tokens is roughly 4M characters, i.e. ~8 MB of UTF-16 text before JS
|
|
672
|
+
* object overhead. That is still 5x a full 200k-token context window, so normal
|
|
673
|
+
* compaction runs first; a broken compactor cannot retain tens of millions of characters.
|
|
672
674
|
* Set to 0 for unlimited (legacy/test behaviour).
|
|
673
675
|
*/
|
|
674
|
-
static MAX_MESSAGE_TOKENS =
|
|
676
|
+
static MAX_MESSAGE_TOKENS = 1e6;
|
|
675
677
|
/**
|
|
676
678
|
* Hard cap on distinct tracked-file paths retained in memory per session.
|
|
677
679
|
* Past this limit the oldest (least-recently-entered) path is dropped.
|
|
@@ -3103,7 +3105,7 @@ var DefaultLogger = class _DefaultLogger {
|
|
|
3103
3105
|
root.pendingFileWrites += 1;
|
|
3104
3106
|
root.pendingFileBytes += bytes;
|
|
3105
3107
|
this.enqueueRotate(this.file);
|
|
3106
|
-
this._tail = this._tail.then(() => fsp.appendFile(this.file, line)).catch(() => void 0).finally(() => {
|
|
3108
|
+
this._tail = this._tail.then(() => fsp.appendFile(this.file, line, { mode: 384 })).catch(() => void 0).finally(() => {
|
|
3107
3109
|
root.pendingFileWrites = Math.max(0, root.pendingFileWrites - 1);
|
|
3108
3110
|
root.pendingFileBytes = Math.max(0, root.pendingFileBytes - bytes);
|
|
3109
3111
|
});
|
|
@@ -4362,30 +4364,6 @@ function kindToCode(kind) {
|
|
|
4362
4364
|
return KIND_TO_CODE[kind];
|
|
4363
4365
|
}
|
|
4364
4366
|
|
|
4365
|
-
// src/core/model-ref.ts
|
|
4366
|
-
function parseModelRef(ref) {
|
|
4367
|
-
const trimmed = ref.trim();
|
|
4368
|
-
const slash = trimmed.indexOf("/");
|
|
4369
|
-
if (slash !== -1) {
|
|
4370
|
-
return {
|
|
4371
|
-
provider: trimmed.slice(0, slash) || void 0,
|
|
4372
|
-
model: trimmed.slice(slash + 1).trim()
|
|
4373
|
-
};
|
|
4374
|
-
}
|
|
4375
|
-
const parts = trimmed.split(/\s+/);
|
|
4376
|
-
if (parts.length >= 2) {
|
|
4377
|
-
return { provider: parts[0], model: parts.slice(1).join(" ") };
|
|
4378
|
-
}
|
|
4379
|
-
return { model: trimmed };
|
|
4380
|
-
}
|
|
4381
|
-
function formatModelRef(ref, defaultProvider) {
|
|
4382
|
-
const provider = ref.provider ?? defaultProvider;
|
|
4383
|
-
return provider ? `${provider}/${ref.model}` : ref.model;
|
|
4384
|
-
}
|
|
4385
|
-
function normalizeModelRef(ref, defaultProvider) {
|
|
4386
|
-
return formatModelRef(parseModelRef(ref), defaultProvider);
|
|
4387
|
-
}
|
|
4388
|
-
|
|
4389
4367
|
// src/core/model-availability-calendar.ts
|
|
4390
4368
|
function logicalCalendarTarget(providerId, model) {
|
|
4391
4369
|
if (providerId !== "omniroute") return { providerId, model };
|
|
@@ -4464,6 +4442,30 @@ function evaluateModelCalendar(rules, providerId, model, at = /* @__PURE__ */ ne
|
|
|
4464
4442
|
return { allowed: true };
|
|
4465
4443
|
}
|
|
4466
4444
|
|
|
4445
|
+
// src/core/model-ref.ts
|
|
4446
|
+
function parseModelRef(ref) {
|
|
4447
|
+
const trimmed = ref.trim();
|
|
4448
|
+
const slash = trimmed.indexOf("/");
|
|
4449
|
+
if (slash !== -1) {
|
|
4450
|
+
return {
|
|
4451
|
+
provider: trimmed.slice(0, slash) || void 0,
|
|
4452
|
+
model: trimmed.slice(slash + 1).trim()
|
|
4453
|
+
};
|
|
4454
|
+
}
|
|
4455
|
+
const parts = trimmed.split(/\s+/);
|
|
4456
|
+
if (parts.length >= 2) {
|
|
4457
|
+
return { provider: parts[0], model: parts.slice(1).join(" ") };
|
|
4458
|
+
}
|
|
4459
|
+
return { model: trimmed };
|
|
4460
|
+
}
|
|
4461
|
+
function formatModelRef(ref, defaultProvider) {
|
|
4462
|
+
const provider = ref.provider ?? defaultProvider;
|
|
4463
|
+
return provider ? `${provider}/${ref.model}` : ref.model;
|
|
4464
|
+
}
|
|
4465
|
+
function normalizeModelRef(ref, defaultProvider) {
|
|
4466
|
+
return formatModelRef(parseModelRef(ref), defaultProvider);
|
|
4467
|
+
}
|
|
4468
|
+
|
|
4467
4469
|
// src/core/fallback-profile-manager.ts
|
|
4468
4470
|
function hasText(value) {
|
|
4469
4471
|
return typeof value === "string" && value.trim().length > 0;
|
|
@@ -4564,18 +4566,42 @@ var FallbackProfileManager = class {
|
|
|
4564
4566
|
* Mirrors the previous `effectiveFallbackChain()` logic but centralized.
|
|
4565
4567
|
*/
|
|
4566
4568
|
resolveEffective(opts = {}) {
|
|
4569
|
+
const bridge = this.resolveBridge(opts.exclude);
|
|
4570
|
+
let selected = FREEZER_EMPTY;
|
|
4567
4571
|
if (opts.fallbackModels && opts.fallbackModels.length > 0) {
|
|
4568
4572
|
const resolved = this.resolveRefs(opts.fallbackModels, opts.exclude);
|
|
4569
|
-
if (resolved.length > 0)
|
|
4573
|
+
if (resolved.length > 0) selected = resolved;
|
|
4570
4574
|
}
|
|
4571
|
-
if (opts.fallbackProfile) {
|
|
4575
|
+
if (selected.length === 0 && opts.fallbackProfile) {
|
|
4572
4576
|
const resolved = this.resolve(opts.fallbackProfile, { exclude: opts.exclude });
|
|
4573
|
-
if (resolved.length > 0)
|
|
4577
|
+
if (resolved.length > 0) selected = resolved;
|
|
4574
4578
|
}
|
|
4575
|
-
if (opts.fallbackAuto !== false) {
|
|
4576
|
-
|
|
4579
|
+
if (selected.length === 0 && opts.fallbackAuto !== false) {
|
|
4580
|
+
selected = this.smartDefault(opts.exclude);
|
|
4577
4581
|
}
|
|
4578
|
-
return
|
|
4582
|
+
if (bridge.length === 0) return selected;
|
|
4583
|
+
if (selected.length === 0) return bridge;
|
|
4584
|
+
const seen = new Set(bridge.map((entry) => `${entry.providerId}/${entry.model}`));
|
|
4585
|
+
return Object.freeze([
|
|
4586
|
+
...bridge,
|
|
4587
|
+
...selected.filter((entry) => !seen.has(`${entry.providerId}/${entry.model}`))
|
|
4588
|
+
]);
|
|
4589
|
+
}
|
|
4590
|
+
/** Resolve the optional, fully-qualified emergency continuity route. */
|
|
4591
|
+
resolveBridge(exclude) {
|
|
4592
|
+
const ref = this.config.fallbackBridge?.trim();
|
|
4593
|
+
if (!ref) return FREEZER_EMPTY;
|
|
4594
|
+
const parsed = parseModelRef(ref);
|
|
4595
|
+
if (!parsed.provider || !parsed.model) return FREEZER_EMPTY;
|
|
4596
|
+
return this.resolveRefs([ref], exclude);
|
|
4597
|
+
}
|
|
4598
|
+
/**
|
|
4599
|
+
* Resolve every usable configured target as an uncapped last-resort chain.
|
|
4600
|
+
* Normal smart defaults stay bounded; callers append this only after the
|
|
4601
|
+
* preferred chain and only when automatic fallback is enabled.
|
|
4602
|
+
*/
|
|
4603
|
+
resolveAllConfigured(exclude) {
|
|
4604
|
+
return this.smartDefault(exclude, Number.POSITIVE_INFINITY);
|
|
4579
4605
|
}
|
|
4580
4606
|
// ── Provider availability (read-only) ──────────────────────────────────
|
|
4581
4607
|
checkProvider(providerId) {
|
|
@@ -4634,7 +4660,7 @@ var FallbackProfileManager = class {
|
|
|
4634
4660
|
* explicit is set. Same-provider alternatives first, then cross-provider.
|
|
4635
4661
|
* Limited to 4 entries to avoid burning through models on a transient blip.
|
|
4636
4662
|
*/
|
|
4637
|
-
smartDefault(exclude) {
|
|
4663
|
+
smartDefault(exclude, maxCandidates = 4) {
|
|
4638
4664
|
const leaderProvider = this.config.provider;
|
|
4639
4665
|
const leaderModel = this.config.model;
|
|
4640
4666
|
const providers = this.config.providers ?? {};
|
|
@@ -4675,8 +4701,18 @@ var FallbackProfileManager = class {
|
|
|
4675
4701
|
(id === leaderProvider ? sameProvider : crossProvider).push(ref);
|
|
4676
4702
|
}
|
|
4677
4703
|
}
|
|
4678
|
-
const
|
|
4679
|
-
const all =
|
|
4704
|
+
const ordered = [...favorites, ...sameProvider, ...crossProvider];
|
|
4705
|
+
const all = Number.isFinite(maxCandidates) ? ordered.slice(0, Math.max(0, maxCandidates)) : [...ordered];
|
|
4706
|
+
const firstCrossProvider = ordered.find((ref) => {
|
|
4707
|
+
const parsed = parseModelRef(ref);
|
|
4708
|
+
return (parsed.provider ?? leaderProvider) !== leaderProvider;
|
|
4709
|
+
});
|
|
4710
|
+
if (all.length > 0 && firstCrossProvider && !all.some((ref) => {
|
|
4711
|
+
const parsed = parseModelRef(ref);
|
|
4712
|
+
return (parsed.provider ?? leaderProvider) !== leaderProvider;
|
|
4713
|
+
})) {
|
|
4714
|
+
all[all.length - 1] = firstCrossProvider;
|
|
4715
|
+
}
|
|
4680
4716
|
return Object.freeze(
|
|
4681
4717
|
all.map((ref) => {
|
|
4682
4718
|
const p = parseModelRef(ref);
|
|
@@ -6389,6 +6425,11 @@ import { createReadStream } from "node:fs";
|
|
|
6389
6425
|
import { access, appendFile as appendFile2, mkdir as mkdir2, rename as rename2, stat as stat2 } from "node:fs/promises";
|
|
6390
6426
|
import { dirname as dirname3 } from "node:path";
|
|
6391
6427
|
import { createInterface } from "node:readline";
|
|
6428
|
+
|
|
6429
|
+
// src/security/file-permissions.ts
|
|
6430
|
+
var SECRET_FILE_MODE = 384;
|
|
6431
|
+
|
|
6432
|
+
// src/coordination/brain-ledger.ts
|
|
6392
6433
|
var QUESTION_MAX = 200;
|
|
6393
6434
|
var DETAIL_MAX = 240;
|
|
6394
6435
|
var truncate2 = (s, max) => s === void 0 ? void 0 : s.length > max ? `${s.slice(0, max - 1)}\u2026` : s;
|
|
@@ -6667,7 +6708,7 @@ var BrainDecisionLedger = class _BrainDecisionLedger {
|
|
|
6667
6708
|
this.dirReady = true;
|
|
6668
6709
|
}
|
|
6669
6710
|
await this.maybeRotate();
|
|
6670
|
-
await appendFile2(this.opts.filePath, line, "utf8");
|
|
6711
|
+
await appendFile2(this.opts.filePath, line, { encoding: "utf8", mode: SECRET_FILE_MODE });
|
|
6671
6712
|
}).catch(() => {
|
|
6672
6713
|
}).finally(() => {
|
|
6673
6714
|
this.pendingWriteCount = Math.max(0, this.pendingWriteCount - 1);
|
|
@@ -6741,7 +6782,7 @@ function brainCacheKey(request) {
|
|
|
6741
6782
|
].join("|");
|
|
6742
6783
|
}
|
|
6743
6784
|
var CACHEABLE_TIERS = /* @__PURE__ */ new Set(["council", "llm"]);
|
|
6744
|
-
var BrainDecisionCache = class {
|
|
6785
|
+
var BrainDecisionCache = class _BrainDecisionCache {
|
|
6745
6786
|
constructor(opts = {}) {
|
|
6746
6787
|
this.opts = opts;
|
|
6747
6788
|
this.enabled = opts.enabled === true;
|
|
@@ -6750,6 +6791,12 @@ var BrainDecisionCache = class {
|
|
|
6750
6791
|
this.now = opts.now ?? Date.now;
|
|
6751
6792
|
}
|
|
6752
6793
|
opts;
|
|
6794
|
+
/**
|
|
6795
|
+
* Max request ids retained per cached entry. Served (replayed) request ids
|
|
6796
|
+
* are kept only so a later `brain.outcome` failure can evict the verdict;
|
|
6797
|
+
* past this cap the oldest ids are dropped — the entry itself stays.
|
|
6798
|
+
*/
|
|
6799
|
+
static MAX_REQUEST_IDS_PER_ENTRY = 500;
|
|
6753
6800
|
entries = /* @__PURE__ */ new Map();
|
|
6754
6801
|
keyByRequestId = /* @__PURE__ */ new Map();
|
|
6755
6802
|
unsubscribers = [];
|
|
@@ -6758,6 +6805,22 @@ var BrainDecisionCache = class {
|
|
|
6758
6805
|
ttlMs;
|
|
6759
6806
|
maxEntries;
|
|
6760
6807
|
now;
|
|
6808
|
+
/**
|
|
6809
|
+
* Delete an entry and every request-id index mapping that points at it.
|
|
6810
|
+
* Every eviction path (TTL expiry, max-entry eviction, outcome failure,
|
|
6811
|
+
* same-key replacement) must go through this so `keyByRequestId` cannot
|
|
6812
|
+
* outlive its entry — otherwise the index grows one string per unique
|
|
6813
|
+
* request id for the process lifetime.
|
|
6814
|
+
*/
|
|
6815
|
+
removeEntry(key) {
|
|
6816
|
+
const entry = this.entries.get(key);
|
|
6817
|
+
if (!entry) return false;
|
|
6818
|
+
for (const requestId of entry.requestIds) {
|
|
6819
|
+
if (this.keyByRequestId.get(requestId) === key) this.keyByRequestId.delete(requestId);
|
|
6820
|
+
}
|
|
6821
|
+
this.entries.delete(key);
|
|
6822
|
+
return true;
|
|
6823
|
+
}
|
|
6761
6824
|
/** Subscribe to the outcome feed so failures evict their decision. */
|
|
6762
6825
|
start() {
|
|
6763
6826
|
if (!this.enabled || !this.opts.events) return;
|
|
@@ -6766,7 +6829,7 @@ var BrainDecisionCache = class {
|
|
|
6766
6829
|
if (e.outcome !== "failure") return;
|
|
6767
6830
|
const key = this.keyByRequestId.get(e.requestId);
|
|
6768
6831
|
if (key === void 0) return;
|
|
6769
|
-
if (this.
|
|
6832
|
+
if (this.removeEntry(key)) this.stats.evictions += 1;
|
|
6770
6833
|
})
|
|
6771
6834
|
);
|
|
6772
6835
|
}
|
|
@@ -6783,11 +6846,18 @@ var BrainDecisionCache = class {
|
|
|
6783
6846
|
return void 0;
|
|
6784
6847
|
}
|
|
6785
6848
|
if (this.now() - entry.storedAt > this.ttlMs) {
|
|
6786
|
-
this.
|
|
6849
|
+
this.removeEntry(key);
|
|
6787
6850
|
this.stats.evictions += 1;
|
|
6788
6851
|
this.stats.misses += 1;
|
|
6789
6852
|
return void 0;
|
|
6790
6853
|
}
|
|
6854
|
+
if (entry.requestIds.size >= _BrainDecisionCache.MAX_REQUEST_IDS_PER_ENTRY) {
|
|
6855
|
+
const oldest = entry.requestIds.values().next().value;
|
|
6856
|
+
if (oldest !== void 0) {
|
|
6857
|
+
entry.requestIds.delete(oldest);
|
|
6858
|
+
this.keyByRequestId.delete(oldest);
|
|
6859
|
+
}
|
|
6860
|
+
}
|
|
6791
6861
|
entry.requestIds.add(request.id);
|
|
6792
6862
|
this.keyByRequestId.set(request.id, key);
|
|
6793
6863
|
this.stats.hits += 1;
|
|
@@ -6803,7 +6873,7 @@ var BrainDecisionCache = class {
|
|
|
6803
6873
|
if (decision.type === "ask_human") return false;
|
|
6804
6874
|
if (tier === void 0 || !CACHEABLE_TIERS.has(tier)) return false;
|
|
6805
6875
|
const key = brainCacheKey(request);
|
|
6806
|
-
this.
|
|
6876
|
+
this.removeEntry(key);
|
|
6807
6877
|
this.entries.set(key, {
|
|
6808
6878
|
decision,
|
|
6809
6879
|
storedAt: this.now(),
|
|
@@ -6814,7 +6884,7 @@ var BrainDecisionCache = class {
|
|
|
6814
6884
|
while (this.entries.size > this.maxEntries) {
|
|
6815
6885
|
const oldest = this.entries.keys().next();
|
|
6816
6886
|
if (oldest.done) break;
|
|
6817
|
-
this.
|
|
6887
|
+
this.removeEntry(oldest.value);
|
|
6818
6888
|
this.stats.evictions += 1;
|
|
6819
6889
|
}
|
|
6820
6890
|
return true;
|
|
@@ -8061,17 +8131,98 @@ import { existsSync } from "node:fs";
|
|
|
8061
8131
|
import * as fs2 from "node:fs/promises";
|
|
8062
8132
|
import * as path5 from "node:path";
|
|
8063
8133
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
var
|
|
8134
|
+
|
|
8135
|
+
// src/skills/frontmatter.ts
|
|
8136
|
+
var SCALAR_KEYS = /* @__PURE__ */ new Set(["name", "description", "trigger", "version", "license", "compatibility"]);
|
|
8137
|
+
function parseSkillFrontmatter(raw) {
|
|
8138
|
+
const text = normalizeLineEndings(raw);
|
|
8139
|
+
if (!text.startsWith("---")) return {};
|
|
8140
|
+
const end = text.indexOf("\n---", 4);
|
|
8141
|
+
if (end === -1) return {};
|
|
8142
|
+
return parseFrontmatterBlock(text.slice(4, end));
|
|
8143
|
+
}
|
|
8067
8144
|
function stripFrontmatter(raw) {
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8145
|
+
const text = normalizeLineEndings(raw);
|
|
8146
|
+
if (!text.startsWith("---")) return text;
|
|
8147
|
+
const end = text.indexOf("\n---", 4);
|
|
8148
|
+
if (end === -1) return text;
|
|
8149
|
+
let body = text.slice(end + 4);
|
|
8072
8150
|
if (body.startsWith("\n")) body = body.slice(1);
|
|
8073
8151
|
return body;
|
|
8074
8152
|
}
|
|
8153
|
+
function normalizeLineEndings(s) {
|
|
8154
|
+
return s.replace(/\r\n?/g, "\n");
|
|
8155
|
+
}
|
|
8156
|
+
function parseFrontmatterBlock(block) {
|
|
8157
|
+
const out = {};
|
|
8158
|
+
const lines = block.split("\n");
|
|
8159
|
+
let i = 0;
|
|
8160
|
+
while (i < lines.length) {
|
|
8161
|
+
const line = lines[i] ?? "";
|
|
8162
|
+
const m = /^([a-zA-Z][a-zA-Z0-9_-]*):\s*(.*)$/.exec(line);
|
|
8163
|
+
if (!m) {
|
|
8164
|
+
i++;
|
|
8165
|
+
continue;
|
|
8166
|
+
}
|
|
8167
|
+
const key = m[1] ?? "";
|
|
8168
|
+
const rest = (m[2] ?? "").trim();
|
|
8169
|
+
if (key === "metadata") {
|
|
8170
|
+
const map = {};
|
|
8171
|
+
i++;
|
|
8172
|
+
while (i < lines.length) {
|
|
8173
|
+
const sub = lines[i] ?? "";
|
|
8174
|
+
const sm = /^\s+([a-zA-Z0-9_.-]+):\s*(.*)$/.exec(sub);
|
|
8175
|
+
if (!sm) break;
|
|
8176
|
+
map[sm[1] ?? ""] = unquote((sm[2] ?? "").trim());
|
|
8177
|
+
i++;
|
|
8178
|
+
}
|
|
8179
|
+
if (Object.keys(map).length > 0) out.metadata = map;
|
|
8180
|
+
continue;
|
|
8181
|
+
}
|
|
8182
|
+
if (rest === "|" || rest === ">") {
|
|
8183
|
+
const collected = [];
|
|
8184
|
+
i++;
|
|
8185
|
+
while (i < lines.length) {
|
|
8186
|
+
const sub = lines[i] ?? "";
|
|
8187
|
+
if (sub === "" || sub.startsWith(" ") || sub.startsWith(" ")) {
|
|
8188
|
+
collected.push(sub.replace(/^\s+/, ""));
|
|
8189
|
+
i++;
|
|
8190
|
+
} else break;
|
|
8191
|
+
}
|
|
8192
|
+
out[normalizeKey(key)] = collected.join("\n").trim();
|
|
8193
|
+
continue;
|
|
8194
|
+
}
|
|
8195
|
+
if (key === "allowed-tools" || key === "allowedTools") {
|
|
8196
|
+
out.allowedTools = rest.split(/[\s,]+/).filter(Boolean);
|
|
8197
|
+
i++;
|
|
8198
|
+
continue;
|
|
8199
|
+
}
|
|
8200
|
+
if (SCALAR_KEYS.has(key)) {
|
|
8201
|
+
out[key] = unquote(rest);
|
|
8202
|
+
i++;
|
|
8203
|
+
continue;
|
|
8204
|
+
}
|
|
8205
|
+
i++;
|
|
8206
|
+
}
|
|
8207
|
+
return out;
|
|
8208
|
+
}
|
|
8209
|
+
function normalizeKey(key) {
|
|
8210
|
+
return key === "allowed-tools" ? "allowedTools" : key;
|
|
8211
|
+
}
|
|
8212
|
+
function unquote(s) {
|
|
8213
|
+
if (s.length >= 2 && (s.startsWith('"') && s.endsWith('"') || s.startsWith("'") && s.endsWith("'"))) {
|
|
8214
|
+
return s.slice(1, -1);
|
|
8215
|
+
}
|
|
8216
|
+
return s;
|
|
8217
|
+
}
|
|
8218
|
+
function isValidSkillNameFormat(name) {
|
|
8219
|
+
return name.length >= 1 && name.length <= 64 && /^[a-z0-9]+(-[a-z0-9]+)*$/.test(name);
|
|
8220
|
+
}
|
|
8221
|
+
|
|
8222
|
+
// src/execution/design-kit-loader.ts
|
|
8223
|
+
var KIT_FILE = "KIT.md";
|
|
8224
|
+
var TOKENS_FILE = "tokens.json";
|
|
8225
|
+
var FOUNDATIONS_ID = "_foundations";
|
|
8075
8226
|
function parseList(value) {
|
|
8076
8227
|
const trimmed = value.trim();
|
|
8077
8228
|
const inner = trimmed.startsWith("[") && trimmed.endsWith("]") ? trimmed.slice(1, -1) : trimmed;
|
|
@@ -8893,15 +9044,18 @@ function buildRecoveryStrategies(opts) {
|
|
|
8893
9044
|
resolve8();
|
|
8894
9045
|
return;
|
|
8895
9046
|
}
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
|
|
8904
|
-
|
|
9047
|
+
let settled = false;
|
|
9048
|
+
let timer;
|
|
9049
|
+
const onAbort = () => finish();
|
|
9050
|
+
const finish = () => {
|
|
9051
|
+
if (settled) return;
|
|
9052
|
+
settled = true;
|
|
9053
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
9054
|
+
ctx.signal.removeEventListener("abort", onAbort);
|
|
9055
|
+
resolve8();
|
|
9056
|
+
};
|
|
9057
|
+
timer = setTimeout(finish, delay);
|
|
9058
|
+
ctx.signal.addEventListener("abort", onAbort, { once: true });
|
|
8905
9059
|
});
|
|
8906
9060
|
} else {
|
|
8907
9061
|
await new Promise((r) => setTimeout(r, delay));
|
|
@@ -9129,6 +9283,11 @@ function applyGoalDeliverableCompletions(goal, completed) {
|
|
|
9129
9283
|
(item, index) => completedIndices.has(index) && !isGoalDeliverableComplete(item) ? `\u2705 ${item}` : item
|
|
9130
9284
|
)
|
|
9131
9285
|
};
|
|
9286
|
+
next = appendGoalDeliverableJournals(next, completed);
|
|
9287
|
+
return recomputeGoalProgress(next);
|
|
9288
|
+
}
|
|
9289
|
+
function appendGoalDeliverableJournals(goal, completed) {
|
|
9290
|
+
let next = goal;
|
|
9132
9291
|
for (const item of completed) {
|
|
9133
9292
|
next = appendJournal(next, {
|
|
9134
9293
|
source: "deliverable",
|
|
@@ -9137,7 +9296,7 @@ function applyGoalDeliverableCompletions(goal, completed) {
|
|
|
9137
9296
|
note: `[DONE: ${item.index + 1}]`
|
|
9138
9297
|
});
|
|
9139
9298
|
}
|
|
9140
|
-
return
|
|
9299
|
+
return next;
|
|
9141
9300
|
}
|
|
9142
9301
|
function recomputeGoalProgress(goal) {
|
|
9143
9302
|
const deliverables = goal.deliverables ?? [];
|
|
@@ -9150,10 +9309,19 @@ async function coordinateGoalIteration(options) {
|
|
|
9150
9309
|
const current = await loadGoal(options.goalPath, options.events);
|
|
9151
9310
|
if (!current) return null;
|
|
9152
9311
|
const completed = parseCompletedGoalDeliverables(options.finalText, current.deliverables ?? []);
|
|
9153
|
-
|
|
9154
|
-
|
|
9155
|
-
|
|
9156
|
-
|
|
9312
|
+
const board = await resolveGoalBoard(options.projectRoot, current);
|
|
9313
|
+
let kanbanUpdatedTaskIds = [];
|
|
9314
|
+
let goal;
|
|
9315
|
+
if (board) {
|
|
9316
|
+
kanbanUpdatedTaskIds = await refreshGoalKanban(options.projectRoot, current, completed, board);
|
|
9317
|
+
goal = await recomputeGoalProgressFromKanban(options.projectRoot, current);
|
|
9318
|
+
const confirmed = completed.filter(
|
|
9319
|
+
(item) => !isGoalDeliverableComplete(current.deliverables?.[item.index] ?? "") && isGoalDeliverableComplete(goal.deliverables?.[item.index] ?? "")
|
|
9320
|
+
);
|
|
9321
|
+
goal = appendGoalDeliverableJournals(goal, confirmed);
|
|
9322
|
+
} else {
|
|
9323
|
+
goal = applyGoalDeliverableCompletions(current, completed);
|
|
9324
|
+
}
|
|
9157
9325
|
let reached = false;
|
|
9158
9326
|
const allComplete = (goal.deliverables?.length ?? 0) > 0 && goal.deliverables?.every(isGoalDeliverableComplete) === true;
|
|
9159
9327
|
if (allComplete && options.brain) {
|
|
@@ -9218,9 +9386,9 @@ async function resolveGoalBoard(projectRoot, goal) {
|
|
|
9218
9386
|
}
|
|
9219
9387
|
return findGoalBoardByTag(projectRoot, goal);
|
|
9220
9388
|
}
|
|
9221
|
-
async function refreshGoalKanban(projectRoot, goal, completed) {
|
|
9389
|
+
async function refreshGoalKanban(projectRoot, goal, completed, resolvedBoard) {
|
|
9222
9390
|
if (completed.length === 0) return [];
|
|
9223
|
-
const board = await resolveGoalBoard(projectRoot, goal);
|
|
9391
|
+
const board = resolvedBoard ?? await resolveGoalBoard(projectRoot, goal);
|
|
9224
9392
|
if (!board) return [];
|
|
9225
9393
|
const doneColumn = board.columns.find((column) => column.title.toLowerCase() === "done");
|
|
9226
9394
|
if (!doneColumn) return [];
|
|
@@ -9229,7 +9397,7 @@ async function refreshGoalKanban(projectRoot, goal, completed) {
|
|
|
9229
9397
|
const updated = [];
|
|
9230
9398
|
for (const task of board.tasks) {
|
|
9231
9399
|
const originMatch = task.origin?.system === "goal" && task.origin?.taskId ? originKeys.has(task.origin.taskId) : false;
|
|
9232
|
-
const titleMatch = completedTitles.has(normalizeTitle(task.title));
|
|
9400
|
+
const titleMatch = !task.origin?.taskId && completedTitles.has(normalizeTitle(task.title));
|
|
9233
9401
|
if (!originMatch && !titleMatch) continue;
|
|
9234
9402
|
const result = await updateTask(
|
|
9235
9403
|
projectRoot,
|
|
@@ -9248,12 +9416,17 @@ async function refreshGoalKanban(projectRoot, goal, completed) {
|
|
|
9248
9416
|
async function recomputeGoalProgressFromKanban(projectRoot, goal) {
|
|
9249
9417
|
const board = await resolveGoalBoard(projectRoot, goal);
|
|
9250
9418
|
if (!board || !goal.deliverables?.length) return recomputeGoalProgress(goal);
|
|
9251
|
-
const
|
|
9252
|
-
board.tasks.filter((task) => task.
|
|
9419
|
+
const tasksByOrigin = new Map(
|
|
9420
|
+
board.tasks.filter((task) => task.origin?.system === "goal" && task.origin.taskId).map((task) => [task.origin.taskId, task])
|
|
9253
9421
|
);
|
|
9254
|
-
const
|
|
9255
|
-
|
|
9256
|
-
|
|
9422
|
+
const completedLegacyTitles = new Set(
|
|
9423
|
+
board.tasks.filter((task) => !task.origin?.taskId && task.status === "completed").map((task) => normalizeTitle(task.title))
|
|
9424
|
+
);
|
|
9425
|
+
const deliverables = goal.deliverables.map((item, index) => {
|
|
9426
|
+
const text = stripGoalDeliverableMarker(item);
|
|
9427
|
+
const originTask = tasksByOrigin.get(`deliverable:${index}`);
|
|
9428
|
+
const complete = originTask ? originTask.status === "completed" : completedLegacyTitles.has(normalizeTitle(text)) || isGoalDeliverableComplete(item);
|
|
9429
|
+
return complete ? `\u2705 ${text}` : text;
|
|
9257
9430
|
});
|
|
9258
9431
|
return recomputeGoalProgress({ ...goal, deliverables });
|
|
9259
9432
|
}
|
|
@@ -10941,7 +11114,26 @@ var SubagentBudget = class _SubagentBudget {
|
|
|
10941
11114
|
var ToolCapabilities = {
|
|
10942
11115
|
/** Can execute arbitrary commands in the user's shell (the `bash` tool). */
|
|
10943
11116
|
SHELL_ARBITRARY: "shell.arbitrary",
|
|
10944
|
-
/**
|
|
11117
|
+
/**
|
|
11118
|
+
* Can execute the `exec` tool's allowlisted commands.
|
|
11119
|
+
*
|
|
11120
|
+
* "Restricted" describes the command NAME check, not the resulting power.
|
|
11121
|
+
* Treat this as equivalent to {@link SHELL_ARBITRARY} when deciding what to
|
|
11122
|
+
* grant: the allowlist includes general-purpose interpreters (`node`,
|
|
11123
|
+
* `python`, `perl`, `ruby`) and, on Windows, the platform shells (`cmd`,
|
|
11124
|
+
* `powershell`, `pwsh`) — deliberately, since without them `exec` cannot run
|
|
11125
|
+
* `dir`/`type`/any cmdlet. `node -e …` or `cmd /c …` therefore reaches
|
|
11126
|
+
* arbitrary execution, and per-argument denylisting cannot close that while
|
|
11127
|
+
* the shells remain (blocking `node -e` still leaves `cmd /c node -e`).
|
|
11128
|
+
*
|
|
11129
|
+
* What actually bounds this is downstream, not the name check: the permission
|
|
11130
|
+
* policy reconstructs the full command line and runs it through the
|
|
11131
|
+
* destructive classifier, so destructive calls still require confirmation.
|
|
11132
|
+
*
|
|
11133
|
+
* Granting `shell.restricted` while withholding `shell.arbitrary` therefore
|
|
11134
|
+
* buys no meaningful reduction in blast radius. Documented rather than
|
|
11135
|
+
* silently implied, because the two read as a narrow/wide pair (WS-083).
|
|
11136
|
+
*/
|
|
10945
11137
|
SHELL_RESTRICTED: "shell.restricted",
|
|
10946
11138
|
/** Can run a restricted project formatter/linter-style command. */
|
|
10947
11139
|
SHELL_EXEC: "shell.exec",
|
|
@@ -17041,84 +17233,6 @@ function resolveForeignToolIdsWithWarnings(opt) {
|
|
|
17041
17233
|
return { ids: FOREIGN_SKILL_TOOLS.map((t) => t.id), unknownIds: [] };
|
|
17042
17234
|
}
|
|
17043
17235
|
|
|
17044
|
-
// src/skills/frontmatter.ts
|
|
17045
|
-
var SCALAR_KEYS = /* @__PURE__ */ new Set(["name", "description", "version", "license", "compatibility"]);
|
|
17046
|
-
function parseSkillFrontmatter(raw) {
|
|
17047
|
-
const text = normalizeLineEndings(raw);
|
|
17048
|
-
if (!text.startsWith("---")) return {};
|
|
17049
|
-
const end = text.indexOf("\n---", 4);
|
|
17050
|
-
if (end === -1) return {};
|
|
17051
|
-
return parseFrontmatterBlock(text.slice(4, end));
|
|
17052
|
-
}
|
|
17053
|
-
function normalizeLineEndings(s) {
|
|
17054
|
-
return s.replace(/\r\n?/g, "\n");
|
|
17055
|
-
}
|
|
17056
|
-
function parseFrontmatterBlock(block) {
|
|
17057
|
-
const out = {};
|
|
17058
|
-
const lines = block.split("\n");
|
|
17059
|
-
let i = 0;
|
|
17060
|
-
while (i < lines.length) {
|
|
17061
|
-
const line = lines[i] ?? "";
|
|
17062
|
-
const m = /^([a-zA-Z][a-zA-Z0-9_-]*):\s*(.*)$/.exec(line);
|
|
17063
|
-
if (!m) {
|
|
17064
|
-
i++;
|
|
17065
|
-
continue;
|
|
17066
|
-
}
|
|
17067
|
-
const key = m[1] ?? "";
|
|
17068
|
-
const rest = (m[2] ?? "").trim();
|
|
17069
|
-
if (key === "metadata") {
|
|
17070
|
-
const map = {};
|
|
17071
|
-
i++;
|
|
17072
|
-
while (i < lines.length) {
|
|
17073
|
-
const sub = lines[i] ?? "";
|
|
17074
|
-
const sm = /^\s+([a-zA-Z0-9_.-]+):\s*(.*)$/.exec(sub);
|
|
17075
|
-
if (!sm) break;
|
|
17076
|
-
map[sm[1] ?? ""] = unquote((sm[2] ?? "").trim());
|
|
17077
|
-
i++;
|
|
17078
|
-
}
|
|
17079
|
-
if (Object.keys(map).length > 0) out.metadata = map;
|
|
17080
|
-
continue;
|
|
17081
|
-
}
|
|
17082
|
-
if (rest === "|" || rest === ">") {
|
|
17083
|
-
const collected = [];
|
|
17084
|
-
i++;
|
|
17085
|
-
while (i < lines.length) {
|
|
17086
|
-
const sub = lines[i] ?? "";
|
|
17087
|
-
if (sub === "" || sub.startsWith(" ") || sub.startsWith(" ")) {
|
|
17088
|
-
collected.push(sub.replace(/^\s+/, ""));
|
|
17089
|
-
i++;
|
|
17090
|
-
} else break;
|
|
17091
|
-
}
|
|
17092
|
-
out[normalizeKey(key)] = collected.join("\n").trim();
|
|
17093
|
-
continue;
|
|
17094
|
-
}
|
|
17095
|
-
if (key === "allowed-tools" || key === "allowedTools") {
|
|
17096
|
-
out.allowedTools = rest.split(/[\s,]+/).filter(Boolean);
|
|
17097
|
-
i++;
|
|
17098
|
-
continue;
|
|
17099
|
-
}
|
|
17100
|
-
if (SCALAR_KEYS.has(key)) {
|
|
17101
|
-
out[key] = unquote(rest);
|
|
17102
|
-
i++;
|
|
17103
|
-
continue;
|
|
17104
|
-
}
|
|
17105
|
-
i++;
|
|
17106
|
-
}
|
|
17107
|
-
return out;
|
|
17108
|
-
}
|
|
17109
|
-
function normalizeKey(key) {
|
|
17110
|
-
return key === "allowed-tools" ? "allowedTools" : key;
|
|
17111
|
-
}
|
|
17112
|
-
function unquote(s) {
|
|
17113
|
-
if (s.length >= 2 && (s.startsWith('"') && s.endsWith('"') || s.startsWith("'") && s.endsWith("'"))) {
|
|
17114
|
-
return s.slice(1, -1);
|
|
17115
|
-
}
|
|
17116
|
-
return s;
|
|
17117
|
-
}
|
|
17118
|
-
function isValidSkillNameFormat(name) {
|
|
17119
|
-
return name.length >= 1 && name.length <= 64 && /^[a-z0-9]+(-[a-z0-9]+)*$/.test(name);
|
|
17120
|
-
}
|
|
17121
|
-
|
|
17122
17236
|
// src/skills/limits.ts
|
|
17123
17237
|
var SKILL_LIMITS = {
|
|
17124
17238
|
/**
|
|
@@ -17160,6 +17274,14 @@ var SKILL_LIMITS = {
|
|
|
17160
17274
|
* Consumer: `downloadGitHubTarball`.
|
|
17161
17275
|
*/
|
|
17162
17276
|
MAX_TARBALL_SIZE: 50 * 1024 * 1024,
|
|
17277
|
+
/**
|
|
17278
|
+
* Maximum size of a GitHub skill tarball after gzip decompression. The
|
|
17279
|
+
* compressed download limit alone does not protect against highly
|
|
17280
|
+
* compressible archives expanding until the process runs out of memory.
|
|
17281
|
+
*
|
|
17282
|
+
* Consumer: `downloadGitHubTarball`.
|
|
17283
|
+
*/
|
|
17284
|
+
MAX_UNCOMPRESSED_TARBALL_SIZE: 64 * 1024 * 1024,
|
|
17163
17285
|
/**
|
|
17164
17286
|
* Default total char budget for skill bodies injected in eager mode when
|
|
17165
17287
|
* `config.skills.eagerMaxChars` is unset. ~6k tokens. Skills are injected
|
|
@@ -17171,6 +17293,17 @@ var SKILL_LIMITS = {
|
|
|
17171
17293
|
* `skillEagerMaxChars`).
|
|
17172
17294
|
*/
|
|
17173
17295
|
EAGER_DEFAULT_MAX_CHARS: 24e3,
|
|
17296
|
+
/**
|
|
17297
|
+
* Default total char budget for compact (token-saving) skill bodies injected
|
|
17298
|
+
* by `buildCompactSkillBodiesText`. Mirrors the eager ceiling so compact mode
|
|
17299
|
+
* can never inject more total skill text than eager mode. Before this bound
|
|
17300
|
+
* existed, compact mode injected EVERY skill's compact body with no cap, so
|
|
17301
|
+
* the section grew linearly with the number of installed skills. Skills past
|
|
17302
|
+
* the budget overflow to a name list the agent loads via the `skill` tool.
|
|
17303
|
+
*
|
|
17304
|
+
* Consumer: `buildCompactSkillBodiesText` (default for its `budget` param).
|
|
17305
|
+
*/
|
|
17306
|
+
COMPACT_DEFAULT_MAX_CHARS: 24e3,
|
|
17174
17307
|
/**
|
|
17175
17308
|
* Auto-compact body limits (the token-saving fallback used when a skill has
|
|
17176
17309
|
* no hand-crafted `SKILL.save.md`). The Overview and Rules sections are
|
|
@@ -17200,14 +17333,6 @@ var SKILL_LIMITS = {
|
|
|
17200
17333
|
};
|
|
17201
17334
|
|
|
17202
17335
|
// src/execution/skill-loader.ts
|
|
17203
|
-
function stripFrontmatter2(raw) {
|
|
17204
|
-
if (!raw.startsWith("---")) return raw;
|
|
17205
|
-
const end = raw.indexOf("\n---", 4);
|
|
17206
|
-
if (end === -1) return raw;
|
|
17207
|
-
let body = raw.slice(end + 4);
|
|
17208
|
-
if (body.startsWith("\n")) body = body.slice(1);
|
|
17209
|
-
return body;
|
|
17210
|
-
}
|
|
17211
17336
|
function compactSkillBody(body) {
|
|
17212
17337
|
const sections = [];
|
|
17213
17338
|
const overviewMatch = body.match(/##\s*Overview\s*\n([\s\S]*?)(?=\n##|\n$|$)/i);
|
|
@@ -17246,6 +17371,9 @@ var DefaultSkillLoader = class {
|
|
|
17246
17371
|
cache;
|
|
17247
17372
|
entriesCache;
|
|
17248
17373
|
bodyCache = /* @__PURE__ */ new Map();
|
|
17374
|
+
/** Load-time diagnostics from the most recent full `list()` scan. */
|
|
17375
|
+
skipped = [];
|
|
17376
|
+
shadowed = [];
|
|
17249
17377
|
constructor(opts) {
|
|
17250
17378
|
const readClaude = opts.readClaudeSkills !== false;
|
|
17251
17379
|
const foreignIds = resolveForeignToolIds(opts.foreignSources);
|
|
@@ -17275,6 +17403,9 @@ var DefaultSkillLoader = class {
|
|
|
17275
17403
|
if (this.cache) return this.cache;
|
|
17276
17404
|
const found = [];
|
|
17277
17405
|
const seen = /* @__PURE__ */ new Set();
|
|
17406
|
+
const claimedBy = /* @__PURE__ */ new Map();
|
|
17407
|
+
this.skipped = [];
|
|
17408
|
+
this.shadowed = [];
|
|
17278
17409
|
for (const { dir, source, originTool } of this.dirs) {
|
|
17279
17410
|
try {
|
|
17280
17411
|
const entries = (await fs4.readdir(dir, { withFileTypes: true })).sort(
|
|
@@ -17283,27 +17414,61 @@ var DefaultSkillLoader = class {
|
|
|
17283
17414
|
for (const e of entries) {
|
|
17284
17415
|
if (!await entryIsDirectory(dir, e)) continue;
|
|
17285
17416
|
const skillFile = path11.join(dir, e.name, "SKILL.md");
|
|
17417
|
+
let raw;
|
|
17286
17418
|
try {
|
|
17287
|
-
|
|
17288
|
-
|
|
17289
|
-
|
|
17290
|
-
|
|
17291
|
-
|
|
17292
|
-
|
|
17293
|
-
|
|
17419
|
+
raw = await fs4.readFile(skillFile, "utf8");
|
|
17420
|
+
} catch {
|
|
17421
|
+
continue;
|
|
17422
|
+
}
|
|
17423
|
+
const fm = parseSkillFrontmatter(raw);
|
|
17424
|
+
if (!fm.name) {
|
|
17425
|
+
this.skipped.push({ dir, entry: e.name, reason: "missing-name" });
|
|
17426
|
+
continue;
|
|
17427
|
+
}
|
|
17428
|
+
if (!fm.description) {
|
|
17429
|
+
this.skipped.push({
|
|
17430
|
+
dir,
|
|
17431
|
+
entry: e.name,
|
|
17432
|
+
reason: "missing-description",
|
|
17433
|
+
name: fm.name
|
|
17434
|
+
});
|
|
17435
|
+
continue;
|
|
17436
|
+
}
|
|
17437
|
+
if (!isValidSkillNameFormat(fm.name)) {
|
|
17438
|
+
this.skipped.push({
|
|
17439
|
+
dir,
|
|
17440
|
+
entry: e.name,
|
|
17441
|
+
reason: "invalid-name-format",
|
|
17442
|
+
name: fm.name
|
|
17443
|
+
});
|
|
17444
|
+
continue;
|
|
17445
|
+
}
|
|
17446
|
+
if (seen.has(fm.name)) {
|
|
17447
|
+
const claimant = claimedBy.get(fm.name);
|
|
17448
|
+
this.shadowed.push({
|
|
17294
17449
|
name: fm.name,
|
|
17295
|
-
description: fm.description,
|
|
17296
|
-
version: fm.version,
|
|
17297
|
-
license: fm.license,
|
|
17298
|
-
compatibility: fm.compatibility,
|
|
17299
|
-
metadata: fm.metadata,
|
|
17300
|
-
allowedTools: fm.allowedTools,
|
|
17301
|
-
path: skillFile,
|
|
17302
17450
|
source,
|
|
17303
|
-
|
|
17451
|
+
path: skillFile,
|
|
17452
|
+
shadowedBy: claimant?.source ?? "unknown",
|
|
17453
|
+
shadowedByPath: claimant?.path
|
|
17304
17454
|
});
|
|
17305
|
-
|
|
17455
|
+
continue;
|
|
17306
17456
|
}
|
|
17457
|
+
seen.add(fm.name);
|
|
17458
|
+
claimedBy.set(fm.name, { source, path: skillFile });
|
|
17459
|
+
found.push({
|
|
17460
|
+
name: fm.name,
|
|
17461
|
+
description: fm.description,
|
|
17462
|
+
trigger: fm.trigger,
|
|
17463
|
+
version: fm.version,
|
|
17464
|
+
license: fm.license,
|
|
17465
|
+
compatibility: fm.compatibility,
|
|
17466
|
+
metadata: fm.metadata,
|
|
17467
|
+
allowedTools: fm.allowedTools,
|
|
17468
|
+
path: skillFile,
|
|
17469
|
+
source,
|
|
17470
|
+
originTool
|
|
17471
|
+
});
|
|
17307
17472
|
}
|
|
17308
17473
|
} catch {
|
|
17309
17474
|
}
|
|
@@ -17332,11 +17497,12 @@ var DefaultSkillLoader = class {
|
|
|
17332
17497
|
const skills = await this.list();
|
|
17333
17498
|
const entries = [];
|
|
17334
17499
|
for (const s of skills) {
|
|
17335
|
-
const
|
|
17500
|
+
const parsed = parseDescriptionFromText(s.description ?? "");
|
|
17501
|
+
const trigger = s.trigger?.trim() || parsed.trigger;
|
|
17336
17502
|
entries.push({
|
|
17337
17503
|
name: s.name,
|
|
17338
17504
|
trigger,
|
|
17339
|
-
scope,
|
|
17505
|
+
scope: parsed.scope,
|
|
17340
17506
|
source: s.source,
|
|
17341
17507
|
originTool: s.originTool,
|
|
17342
17508
|
path: s.path
|
|
@@ -17349,6 +17515,16 @@ var DefaultSkillLoader = class {
|
|
|
17349
17515
|
this.cache = void 0;
|
|
17350
17516
|
this.entriesCache = void 0;
|
|
17351
17517
|
this.bodyCache.clear();
|
|
17518
|
+
this.skipped = [];
|
|
17519
|
+
this.shadowed = [];
|
|
17520
|
+
}
|
|
17521
|
+
/**
|
|
17522
|
+
* Load-time diagnostics from the most recent full `list()` scan: skills
|
|
17523
|
+
* skipped as malformed and skills shadowed by a higher-priority layer.
|
|
17524
|
+
* Returns copies so callers cannot mutate internal state.
|
|
17525
|
+
*/
|
|
17526
|
+
diagnostics() {
|
|
17527
|
+
return { skipped: [...this.skipped], shadowed: [...this.shadowed] };
|
|
17352
17528
|
}
|
|
17353
17529
|
async readBody(name) {
|
|
17354
17530
|
const key = name.toLowerCase();
|
|
@@ -17372,7 +17548,7 @@ var DefaultSkillLoader = class {
|
|
|
17372
17548
|
result = await fs4.readFile(savePath, "utf8");
|
|
17373
17549
|
} catch {
|
|
17374
17550
|
const full = await fs4.readFile(m.path, "utf8");
|
|
17375
|
-
const body =
|
|
17551
|
+
const body = stripFrontmatter(full);
|
|
17376
17552
|
const compact = compactSkillBody(body);
|
|
17377
17553
|
if (compact) {
|
|
17378
17554
|
result = `## Overview
|
|
@@ -18069,12 +18245,38 @@ function createToolOutputSerializer(opts = {}) {
|
|
|
18069
18245
|
return { text: "[truncated: iteration output cap exceeded]", newBudget: 0 };
|
|
18070
18246
|
}
|
|
18071
18247
|
const half = Math.floor(available / 2);
|
|
18072
|
-
const first = text
|
|
18073
|
-
const second =
|
|
18248
|
+
const first = utf8Prefix(text, half);
|
|
18249
|
+
const second = utf8Suffix(text, available - Buffer.byteLength(first, "utf8"));
|
|
18074
18250
|
return { text: `${first}${marker}${second}`, newBudget: 0 };
|
|
18075
18251
|
}
|
|
18076
18252
|
return { serialize, enforceCap, capBytes };
|
|
18077
18253
|
}
|
|
18254
|
+
function utf8Prefix(text, maxBytes) {
|
|
18255
|
+
if (maxBytes <= 0) return "";
|
|
18256
|
+
let low = 0;
|
|
18257
|
+
let high = text.length;
|
|
18258
|
+
while (low < high) {
|
|
18259
|
+
const mid = Math.ceil((low + high) / 2);
|
|
18260
|
+
if (Buffer.byteLength(text.slice(0, mid), "utf8") <= maxBytes) low = mid;
|
|
18261
|
+
else high = mid - 1;
|
|
18262
|
+
}
|
|
18263
|
+
let end = low;
|
|
18264
|
+
if (end > 0 && /[\uD800-\uDBFF]/.test(text[end - 1])) end--;
|
|
18265
|
+
return text.slice(0, end);
|
|
18266
|
+
}
|
|
18267
|
+
function utf8Suffix(text, maxBytes) {
|
|
18268
|
+
if (maxBytes <= 0) return "";
|
|
18269
|
+
let low = 0;
|
|
18270
|
+
let high = text.length;
|
|
18271
|
+
while (low < high) {
|
|
18272
|
+
const chars = Math.ceil((low + high) / 2);
|
|
18273
|
+
if (Buffer.byteLength(text.slice(text.length - chars), "utf8") <= maxBytes) low = chars;
|
|
18274
|
+
else high = chars - 1;
|
|
18275
|
+
}
|
|
18276
|
+
let start = text.length - low;
|
|
18277
|
+
if (start < text.length && /[\uDC00-\uDFFF]/.test(text[start])) start++;
|
|
18278
|
+
return text.slice(start);
|
|
18279
|
+
}
|
|
18078
18280
|
function renderToolObject(toolName, obj, input) {
|
|
18079
18281
|
if (toolName === "read" && typeof obj["text"] === "string") {
|
|
18080
18282
|
return joinSections([
|
|
@@ -18699,13 +18901,43 @@ function normalizePathSubject(value) {
|
|
|
18699
18901
|
function isPathSubjectKey(subjectKey) {
|
|
18700
18902
|
return subjectKey === "path" || subjectKey === "file" || subjectKey === "files";
|
|
18701
18903
|
}
|
|
18904
|
+
function renderCommandLine(command, args) {
|
|
18905
|
+
if (!Array.isArray(args) || args.length === 0) return command;
|
|
18906
|
+
const rendered = args.map((arg) => {
|
|
18907
|
+
const str = String(arg);
|
|
18908
|
+
return /\s/.test(str) ? `"${str.replace(/"/g, '\\"')}"` : str;
|
|
18909
|
+
});
|
|
18910
|
+
return [command, ...rendered].join(" ");
|
|
18911
|
+
}
|
|
18702
18912
|
function subjectForToolInput(toolName, input, subjectKey) {
|
|
18703
18913
|
if (!input || typeof input !== "object") return void 0;
|
|
18704
18914
|
const obj = input;
|
|
18705
18915
|
if (subjectKey) {
|
|
18706
18916
|
const value = obj[subjectKey];
|
|
18707
18917
|
if (typeof value === "string") {
|
|
18708
|
-
|
|
18918
|
+
if (isPathSubjectKey(subjectKey)) {
|
|
18919
|
+
const normalized = normalizePathSubject(value);
|
|
18920
|
+
if (subjectKey === "files" && obj["check"] === true) return `${normalized}:check`;
|
|
18921
|
+
if (subjectKey === "files" && obj["dry_run"] === true) return `${normalized}:dry-run`;
|
|
18922
|
+
return normalized;
|
|
18923
|
+
}
|
|
18924
|
+
if (subjectKey === "command") {
|
|
18925
|
+
const rendered = renderCommandLine(value, obj["args"]);
|
|
18926
|
+
if (value === "commit" && obj["dry_run"] === true) {
|
|
18927
|
+
return `${escapeGlobSubject(rendered)}:dry-run`;
|
|
18928
|
+
}
|
|
18929
|
+
return escapeGlobSubject(rendered);
|
|
18930
|
+
}
|
|
18931
|
+
if (subjectKey === "directory" && obj["dry_run"] === true) {
|
|
18932
|
+
return `${escapeGlobSubject(value)}:dry-run`;
|
|
18933
|
+
}
|
|
18934
|
+
if (subjectKey === "packages" && obj["dry_run"] === true) {
|
|
18935
|
+
return `${escapeGlobSubject(value)}:dry-run`;
|
|
18936
|
+
}
|
|
18937
|
+
if (subjectKey === "name" && obj["dry_run"] === true) {
|
|
18938
|
+
return `${escapeGlobSubject(value)}:dry-run`;
|
|
18939
|
+
}
|
|
18940
|
+
return escapeGlobSubject(value);
|
|
18709
18941
|
}
|
|
18710
18942
|
}
|
|
18711
18943
|
if (toolName === "bash" && typeof obj.command === "string") {
|
|
@@ -18838,26 +19070,24 @@ function readPolicy(ctx) {
|
|
|
18838
19070
|
|
|
18839
19071
|
// src/execution/tool-executor.ts
|
|
18840
19072
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
19073
|
+
import * as fs8 from "node:fs/promises";
|
|
19074
|
+
import * as path16 from "node:path";
|
|
19075
|
+
import { isDeepStrictEqual } from "node:util";
|
|
18841
19076
|
|
|
18842
|
-
// src/observability/
|
|
19077
|
+
// src/observability/network-telemetry.ts
|
|
18843
19078
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
18844
19079
|
var storage = new AsyncLocalStorage();
|
|
18845
|
-
function
|
|
19080
|
+
function runWithNetworkTelemetry(context, run) {
|
|
18846
19081
|
return storage.run(context, run);
|
|
18847
19082
|
}
|
|
18848
19083
|
|
|
18849
|
-
// src/observability/
|
|
19084
|
+
// src/observability/process-telemetry.ts
|
|
18850
19085
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
18851
19086
|
var storage2 = new AsyncLocalStorage2();
|
|
18852
|
-
function
|
|
19087
|
+
function runWithProcessTelemetry(context, run) {
|
|
18853
19088
|
return storage2.run(context, run);
|
|
18854
19089
|
}
|
|
18855
19090
|
|
|
18856
|
-
// src/execution/tool-executor.ts
|
|
18857
|
-
import { isDeepStrictEqual } from "node:util";
|
|
18858
|
-
import * as fs8 from "node:fs/promises";
|
|
18859
|
-
import * as path16 from "node:path";
|
|
18860
|
-
|
|
18861
19091
|
// src/security/kanban-boundary.ts
|
|
18862
19092
|
import { realpath } from "node:fs/promises";
|
|
18863
19093
|
import * as path14 from "node:path";
|
|
@@ -19225,47 +19455,6 @@ function sliceUtf8Suffix(text, maxBytes) {
|
|
|
19225
19455
|
return text.slice(start);
|
|
19226
19456
|
}
|
|
19227
19457
|
|
|
19228
|
-
// src/execution/tool-executor-results.ts
|
|
19229
|
-
function unknownToolResult(use, listFns) {
|
|
19230
|
-
return {
|
|
19231
|
-
type: "tool_result",
|
|
19232
|
-
tool_use_id: use.id,
|
|
19233
|
-
content: `Tool "${use.name}" is not registered. Available tools: ${listFns().join(", ")}`,
|
|
19234
|
-
is_error: true
|
|
19235
|
-
};
|
|
19236
|
-
}
|
|
19237
|
-
function malformedInputResult(use, raw) {
|
|
19238
|
-
let content = `Tool "${use.name}" received arguments that were not a valid JSON object, so they could not be parsed. Re-issue the call with the arguments encoded as a single well-formed JSON object matching the tool's input schema.`;
|
|
19239
|
-
if (raw) {
|
|
19240
|
-
const max = 800;
|
|
19241
|
-
const excerpt = raw.length > max ? `${raw.slice(0, max)}\u2026 (truncated, ${raw.length} chars total)` : raw;
|
|
19242
|
-
content += ` Common cause: a string field (e.g. code in old_string/new_string) contains literal newlines, quotes, or backslashes that must be JSON-escaped, or the payload was cut off mid-stream. The raw arguments received were:
|
|
19243
|
-
${excerpt}`;
|
|
19244
|
-
}
|
|
19245
|
-
return {
|
|
19246
|
-
type: "tool_result",
|
|
19247
|
-
tool_use_id: use.id,
|
|
19248
|
-
content,
|
|
19249
|
-
is_error: true
|
|
19250
|
-
};
|
|
19251
|
-
}
|
|
19252
|
-
function deniedResult(use, reason) {
|
|
19253
|
-
return {
|
|
19254
|
-
type: "tool_result",
|
|
19255
|
-
tool_use_id: use.id,
|
|
19256
|
-
content: `Tool "${use.name}" denied: ${reason ?? "policy"}`,
|
|
19257
|
-
is_error: true
|
|
19258
|
-
};
|
|
19259
|
-
}
|
|
19260
|
-
function blockedByHookResult(use, reason) {
|
|
19261
|
-
return {
|
|
19262
|
-
type: "tool_result",
|
|
19263
|
-
tool_use_id: use.id,
|
|
19264
|
-
content: `Tool "${use.name}" was blocked by a PreToolUse hook: ${reason ?? "no reason given"}`,
|
|
19265
|
-
is_error: true
|
|
19266
|
-
};
|
|
19267
|
-
}
|
|
19268
|
-
|
|
19269
19458
|
// src/execution/tool-executor-logging.ts
|
|
19270
19459
|
function toolLogBase(ctx, use, toolName, durationMs) {
|
|
19271
19460
|
return {
|
|
@@ -19330,6 +19519,82 @@ function logToolFailure(opts, ctx, use, toolName, durationMs, err) {
|
|
|
19330
19519
|
});
|
|
19331
19520
|
}
|
|
19332
19521
|
|
|
19522
|
+
// src/execution/tool-executor-results.ts
|
|
19523
|
+
function unknownToolResult(use, listFns) {
|
|
19524
|
+
return {
|
|
19525
|
+
type: "tool_result",
|
|
19526
|
+
tool_use_id: use.id,
|
|
19527
|
+
content: `Tool "${use.name}" is not registered. Available tools: ${listFns().join(", ")}`,
|
|
19528
|
+
is_error: true
|
|
19529
|
+
};
|
|
19530
|
+
}
|
|
19531
|
+
function malformedInputResult(use, raw) {
|
|
19532
|
+
let content = `Tool "${use.name}" received arguments that were not a valid JSON object, so they could not be parsed. Re-issue the call with the arguments encoded as a single well-formed JSON object matching the tool's input schema.`;
|
|
19533
|
+
if (raw) {
|
|
19534
|
+
const max = 800;
|
|
19535
|
+
const excerpt = raw.length > max ? `${raw.slice(0, max)}\u2026 (truncated, ${raw.length} chars total)` : raw;
|
|
19536
|
+
content += ` Common cause: a string field (e.g. code in old_string/new_string) contains literal newlines, quotes, or backslashes that must be JSON-escaped, or the payload was cut off mid-stream. The raw arguments received were:
|
|
19537
|
+
${excerpt}`;
|
|
19538
|
+
}
|
|
19539
|
+
return {
|
|
19540
|
+
type: "tool_result",
|
|
19541
|
+
tool_use_id: use.id,
|
|
19542
|
+
content,
|
|
19543
|
+
is_error: true
|
|
19544
|
+
};
|
|
19545
|
+
}
|
|
19546
|
+
function deniedResult(use, reason) {
|
|
19547
|
+
return {
|
|
19548
|
+
type: "tool_result",
|
|
19549
|
+
tool_use_id: use.id,
|
|
19550
|
+
content: `Tool "${use.name}" denied: ${reason ?? "policy"}`,
|
|
19551
|
+
is_error: true
|
|
19552
|
+
};
|
|
19553
|
+
}
|
|
19554
|
+
function blockedByHookResult(use, reason) {
|
|
19555
|
+
return {
|
|
19556
|
+
type: "tool_result",
|
|
19557
|
+
tool_use_id: use.id,
|
|
19558
|
+
content: `Tool "${use.name}" was blocked by a PreToolUse hook: ${reason ?? "no reason given"}`,
|
|
19559
|
+
is_error: true
|
|
19560
|
+
};
|
|
19561
|
+
}
|
|
19562
|
+
|
|
19563
|
+
// src/execution/tool-error-taxonomy.ts
|
|
19564
|
+
function toolErrorResult(use, err, opts = {}) {
|
|
19565
|
+
const { category, retryable, detail } = classifyToolError(err);
|
|
19566
|
+
const rawMessage = err instanceof Error ? err.message : typeof err === "string" ? err : "Unknown error";
|
|
19567
|
+
const userMessage = opts.scrubber ? opts.scrubber(rawMessage) : rawMessage;
|
|
19568
|
+
const info = {
|
|
19569
|
+
category,
|
|
19570
|
+
retryable,
|
|
19571
|
+
userMessage,
|
|
19572
|
+
...detail !== void 0 ? { detail } : {}
|
|
19573
|
+
};
|
|
19574
|
+
const prefix = formatErrorPrefix(category, retryable);
|
|
19575
|
+
const detailSuffix = detail ? ` [${detail}]` : "";
|
|
19576
|
+
return {
|
|
19577
|
+
type: "tool_result",
|
|
19578
|
+
tool_use_id: use.id,
|
|
19579
|
+
content: `${prefix}: ${userMessage}${detailSuffix}`,
|
|
19580
|
+
is_error: true,
|
|
19581
|
+
// Attach structured info for programmatic consumers (retry logic,
|
|
19582
|
+
// audit log, observability).
|
|
19583
|
+
_toolErrorInfo: info
|
|
19584
|
+
};
|
|
19585
|
+
}
|
|
19586
|
+
function formatErrorPrefix(category, retryable) {
|
|
19587
|
+
const label = CATEGORY_LABELS[category] ?? "Error";
|
|
19588
|
+
return retryable ? `${label} (retryable)` : label;
|
|
19589
|
+
}
|
|
19590
|
+
var CATEGORY_LABELS = {
|
|
19591
|
+
["transient" /* TRANSIENT */]: "Transient error",
|
|
19592
|
+
["not_found" /* NOT_FOUND */]: "Not found",
|
|
19593
|
+
["permission" /* PERMISSION */]: "Permission denied",
|
|
19594
|
+
["validation" /* VALIDATION */]: "Validation error",
|
|
19595
|
+
["fatal" /* FATAL */]: "Error"
|
|
19596
|
+
};
|
|
19597
|
+
|
|
19333
19598
|
// src/execution/tool-executor-stream.ts
|
|
19334
19599
|
async function executeStreamedTool({
|
|
19335
19600
|
tool,
|
|
@@ -19430,12 +19695,27 @@ ${progressTail}` : progressTail;
|
|
|
19430
19695
|
}
|
|
19431
19696
|
|
|
19432
19697
|
// src/execution/tool-executor.ts
|
|
19698
|
+
async function mapWithConcurrency(items, limit, run) {
|
|
19699
|
+
if (items.length === 0) return [];
|
|
19700
|
+
const results = new Array(items.length);
|
|
19701
|
+
let nextIndex = 0;
|
|
19702
|
+
const worker = async () => {
|
|
19703
|
+
while (nextIndex < items.length) {
|
|
19704
|
+
const index = nextIndex++;
|
|
19705
|
+
results[index] = await run(items[index]);
|
|
19706
|
+
}
|
|
19707
|
+
};
|
|
19708
|
+
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()));
|
|
19709
|
+
return results;
|
|
19710
|
+
}
|
|
19433
19711
|
var ToolExecutor = class _ToolExecutor {
|
|
19434
19712
|
constructor(registry, opts) {
|
|
19435
19713
|
this.registry = registry;
|
|
19436
19714
|
this.opts = opts;
|
|
19437
19715
|
this.iterationTimeoutMs = opts.iterationTimeoutMs ?? 3e5;
|
|
19438
19716
|
this.maxToolTimeoutMs = opts.maxToolTimeoutMs ?? 3e5;
|
|
19717
|
+
const requestedParallelism = opts.maxParallelTools ?? 4;
|
|
19718
|
+
this.maxParallelTools = Number.isFinite(requestedParallelism) ? Math.max(1, Math.min(16, Math.floor(requestedParallelism))) : 4;
|
|
19439
19719
|
this.serializer = createToolOutputSerializer({
|
|
19440
19720
|
perIterationOutputCapBytes: opts.perIterationOutputCapBytes ?? 1e5
|
|
19441
19721
|
});
|
|
@@ -19451,6 +19731,7 @@ var ToolExecutor = class _ToolExecutor {
|
|
|
19451
19731
|
serializer;
|
|
19452
19732
|
iterationTimeoutMs;
|
|
19453
19733
|
maxToolTimeoutMs;
|
|
19734
|
+
maxParallelTools;
|
|
19454
19735
|
/**
|
|
19455
19736
|
* Clear the interactive confirm awaiter so the executor returns
|
|
19456
19737
|
* `ToolConfirmPendingResult` instead of blocking on stdin. Used by
|
|
@@ -19778,12 +20059,9 @@ ${post.additionalContext}`;
|
|
|
19778
20059
|
const { category, retryable, detail } = classifyToolError(err);
|
|
19779
20060
|
this.hintRenderMode(tool.name);
|
|
19780
20061
|
this.opts.renderer?.writeToolResult(tool.name, scrubbed, true);
|
|
19781
|
-
const result = {
|
|
19782
|
-
|
|
19783
|
-
|
|
19784
|
-
content: `Tool "${tool.name}" threw: ${scrubbed}`,
|
|
19785
|
-
is_error: true
|
|
19786
|
-
};
|
|
20062
|
+
const result = toolErrorResult(use, err, {
|
|
20063
|
+
scrubber: (s) => this.opts.secretScrubber.scrub(s)
|
|
20064
|
+
});
|
|
19787
20065
|
budget = this.budgetForString(result.content, budget);
|
|
19788
20066
|
if (err instanceof Error) span?.recordError(err);
|
|
19789
20067
|
span?.setAttribute("tool.is_error", true);
|
|
@@ -19803,21 +20081,17 @@ ${post.additionalContext}`;
|
|
|
19803
20081
|
const isStructured = isWrongStackError(err);
|
|
19804
20082
|
const msg = isStructured ? err.describe() : toErrorMessage(err);
|
|
19805
20083
|
const scrubbed = this.opts.secretScrubber.scrub(msg);
|
|
19806
|
-
const { category, retryable, detail } = classifyToolError(err);
|
|
19807
20084
|
const tool = this.registry.get(use.name);
|
|
19808
20085
|
const toolName = tool?.name ?? use.name;
|
|
19809
20086
|
this.hintRenderMode(toolName);
|
|
19810
20087
|
this.opts.renderer?.writeToolResult(toolName, scrubbed, true);
|
|
19811
|
-
const result = {
|
|
19812
|
-
|
|
19813
|
-
|
|
19814
|
-
|
|
19815
|
-
|
|
19816
|
-
}
|
|
20088
|
+
const result = toolErrorResult(use, err, {
|
|
20089
|
+
scrubber: (s) => this.opts.secretScrubber.scrub(s)
|
|
20090
|
+
});
|
|
20091
|
+
if (isStructured) {
|
|
20092
|
+
result.content = scrubbed;
|
|
20093
|
+
}
|
|
19817
20094
|
budget = this.budgetForString(result.content, budget);
|
|
19818
|
-
void category;
|
|
19819
|
-
void retryable;
|
|
19820
|
-
void detail;
|
|
19821
20095
|
return { result, tool, durationMs: 0 };
|
|
19822
20096
|
}
|
|
19823
20097
|
};
|
|
@@ -19829,7 +20103,7 @@ ${post.additionalContext}`;
|
|
|
19829
20103
|
return { outputs, remainingBudget: budget };
|
|
19830
20104
|
}
|
|
19831
20105
|
if (strategy === "parallel") {
|
|
19832
|
-
const outputs = await
|
|
20106
|
+
const outputs = await mapWithConcurrency(toolUses, this.maxParallelTools, safeRun);
|
|
19833
20107
|
return { outputs, remainingBudget: budget };
|
|
19834
20108
|
}
|
|
19835
20109
|
const nonMutating = [];
|
|
@@ -19840,7 +20114,7 @@ ${post.additionalContext}`;
|
|
|
19840
20114
|
if (tool?.mutating) mutating.push(use);
|
|
19841
20115
|
else nonMutating.push(use);
|
|
19842
20116
|
}
|
|
19843
|
-
const firstPass = await
|
|
20117
|
+
const firstPass = await mapWithConcurrency(nonMutating, this.maxParallelTools, safeRun);
|
|
19844
20118
|
const secondPass = [];
|
|
19845
20119
|
for (const use of mutating) {
|
|
19846
20120
|
secondPass.push(await safeRun(use));
|
|
@@ -19975,25 +20249,28 @@ ${post.additionalContext}`;
|
|
|
19975
20249
|
let output;
|
|
19976
20250
|
const execute = () => typeof tool.executeStream === "function" ? this.runStreamedTool(tool, input, ctx, combined, toolUseId) : (async () => tool.execute(input, ctx, { signal: combined }))();
|
|
19977
20251
|
const telemetryToolCallId = toolUseId ?? `nested-${randomUUID4()}`;
|
|
19978
|
-
const toolPromise = this.opts.events ? runWithNetworkTelemetry(
|
|
19979
|
-
events: this.opts.events,
|
|
19980
|
-
sessionId: resolveEventSessionId(ctx),
|
|
19981
|
-
...ctx.traceId ? { traceId: ctx.traceId } : {},
|
|
19982
|
-
...ctx.agentId ? { agentId: ctx.agentId } : {},
|
|
19983
|
-
toolCallId: telemetryToolCallId,
|
|
19984
|
-
initiator: "tool",
|
|
19985
|
-
operationName: tool.name
|
|
19986
|
-
}, () => runWithProcessTelemetry(
|
|
20252
|
+
const toolPromise = this.opts.events ? runWithNetworkTelemetry(
|
|
19987
20253
|
{
|
|
19988
20254
|
events: this.opts.events,
|
|
19989
20255
|
sessionId: resolveEventSessionId(ctx),
|
|
19990
20256
|
...ctx.traceId ? { traceId: ctx.traceId } : {},
|
|
19991
20257
|
...ctx.agentId ? { agentId: ctx.agentId } : {},
|
|
19992
20258
|
toolCallId: telemetryToolCallId,
|
|
19993
|
-
|
|
20259
|
+
initiator: "tool",
|
|
20260
|
+
operationName: tool.name
|
|
19994
20261
|
},
|
|
19995
|
-
|
|
19996
|
-
|
|
20262
|
+
() => runWithProcessTelemetry(
|
|
20263
|
+
{
|
|
20264
|
+
events: this.opts.events,
|
|
20265
|
+
sessionId: resolveEventSessionId(ctx),
|
|
20266
|
+
...ctx.traceId ? { traceId: ctx.traceId } : {},
|
|
20267
|
+
...ctx.agentId ? { agentId: ctx.agentId } : {},
|
|
20268
|
+
toolCallId: telemetryToolCallId,
|
|
20269
|
+
toolName: tool.name
|
|
20270
|
+
},
|
|
20271
|
+
execute
|
|
20272
|
+
)
|
|
20273
|
+
) : execute();
|
|
19997
20274
|
toolPromise.catch(() => {
|
|
19998
20275
|
});
|
|
19999
20276
|
try {
|
|
@@ -20245,19 +20522,39 @@ var OneShotOrchestrator = class {
|
|
|
20245
20522
|
*/
|
|
20246
20523
|
resolveFallbackChain(input, config, target) {
|
|
20247
20524
|
const mgr = this.opts.fallbackProfileManager;
|
|
20525
|
+
let selected = mgr.resolveEffective({
|
|
20526
|
+
fallbackAuto: false,
|
|
20527
|
+
exclude: target
|
|
20528
|
+
});
|
|
20248
20529
|
if (input.fallbackModels && input.fallbackModels.length > 0) {
|
|
20249
|
-
|
|
20250
|
-
|
|
20251
|
-
|
|
20252
|
-
|
|
20253
|
-
|
|
20254
|
-
if (config.
|
|
20255
|
-
|
|
20530
|
+
selected = mgr.resolveEffective({
|
|
20531
|
+
fallbackModels: input.fallbackModels,
|
|
20532
|
+
fallbackAuto: false,
|
|
20533
|
+
exclude: target
|
|
20534
|
+
});
|
|
20535
|
+
} else if (config.fallbackModels && config.fallbackModels.length > 0) {
|
|
20536
|
+
selected = mgr.resolveEffective({
|
|
20537
|
+
fallbackModels: config.fallbackModels,
|
|
20538
|
+
fallbackAuto: false,
|
|
20539
|
+
exclude: target
|
|
20540
|
+
});
|
|
20541
|
+
} else if (config.fallbackAuto !== false) {
|
|
20542
|
+
selected = mgr.resolveEffective({
|
|
20256
20543
|
fallbackAuto: true,
|
|
20257
20544
|
exclude: target
|
|
20258
20545
|
});
|
|
20259
20546
|
}
|
|
20260
|
-
|
|
20547
|
+
if (config.fallbackAuto === false) return selected;
|
|
20548
|
+
const combined = [...selected, ...mgr.resolveAllConfigured(target)];
|
|
20549
|
+
const seen = /* @__PURE__ */ new Set();
|
|
20550
|
+
return Object.freeze(
|
|
20551
|
+
combined.filter((entry) => {
|
|
20552
|
+
const key = `${entry.providerId}/${entry.model}`;
|
|
20553
|
+
if (seen.has(key)) return false;
|
|
20554
|
+
seen.add(key);
|
|
20555
|
+
return true;
|
|
20556
|
+
})
|
|
20557
|
+
);
|
|
20261
20558
|
}
|
|
20262
20559
|
/** Attempt a provider call while preserving the actual failure for callers. */
|
|
20263
20560
|
async tryCall(provider, request, signal, providerId, model) {
|