@flyingrobots/graft 0.5.0 → 0.6.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/ARCHITECTURE.md +130 -377
- package/CHANGELOG.md +94 -13
- package/README.md +107 -269
- package/bin/graft.js +5 -3
- package/dist/adapters/canonical-json.d.ts +6 -0
- package/dist/adapters/canonical-json.d.ts.map +1 -0
- package/dist/adapters/canonical-json.js +52 -0
- package/dist/adapters/canonical-json.js.map +1 -0
- package/dist/adapters/node-fs.d.ts +3 -0
- package/dist/adapters/node-fs.d.ts.map +1 -0
- package/dist/adapters/node-fs.js +33 -0
- package/dist/adapters/node-fs.js.map +1 -0
- package/dist/adapters/node-git.d.ts +3 -0
- package/dist/adapters/node-git.d.ts.map +1 -0
- package/dist/adapters/node-git.js +44 -0
- package/dist/adapters/node-git.js.map +1 -0
- package/dist/adapters/node-process-runner.d.ts +3 -0
- package/dist/adapters/node-process-runner.d.ts.map +1 -0
- package/dist/adapters/node-process-runner.js +23 -0
- package/dist/adapters/node-process-runner.js.map +1 -0
- package/dist/adapters/repo-paths.d.ts +3 -0
- package/dist/adapters/repo-paths.d.ts.map +1 -0
- package/dist/adapters/repo-paths.js +22 -0
- package/dist/adapters/repo-paths.js.map +1 -0
- package/dist/adapters/rotating-ndjson-log.d.ts +18 -0
- package/dist/adapters/rotating-ndjson-log.d.ts.map +1 -0
- package/dist/adapters/rotating-ndjson-log.js +48 -0
- package/dist/adapters/rotating-ndjson-log.js.map +1 -0
- package/dist/api/index.d.ts +27 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +25 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/repo-local-graft.d.ts +7 -0
- package/dist/api/repo-local-graft.d.ts.map +1 -0
- package/dist/api/repo-local-graft.js +12 -0
- package/dist/api/repo-local-graft.js.map +1 -0
- package/dist/api/repo-workspace.d.ts +15 -0
- package/dist/api/repo-workspace.d.ts.map +1 -0
- package/dist/api/repo-workspace.js +23 -0
- package/dist/api/repo-workspace.js.map +1 -0
- package/dist/api/tool-bridge.d.ts +7 -0
- package/dist/api/tool-bridge.d.ts.map +1 -0
- package/dist/api/tool-bridge.js +14 -0
- package/dist/api/tool-bridge.js.map +1 -0
- package/dist/cli/activity-render.d.ts +2 -0
- package/dist/cli/activity-render.d.ts.map +1 -0
- package/dist/cli/activity-render.js +90 -0
- package/dist/cli/activity-render.js.map +1 -0
- package/dist/cli/cli-error.d.ts +10 -0
- package/dist/cli/cli-error.d.ts.map +1 -0
- package/dist/cli/cli-error.js +130 -0
- package/dist/cli/cli-error.js.map +1 -0
- package/dist/cli/command-parser.d.ts +17 -0
- package/dist/cli/command-parser.d.ts.map +1 -0
- package/dist/cli/command-parser.js +255 -0
- package/dist/cli/command-parser.js.map +1 -0
- package/dist/cli/entrypoint.d.ts +7 -0
- package/dist/cli/entrypoint.d.ts.map +1 -0
- package/dist/cli/entrypoint.js +8 -0
- package/dist/cli/entrypoint.js.map +1 -0
- package/dist/cli/index-cmd.d.ts +12 -0
- package/dist/cli/index-cmd.d.ts.map +1 -0
- package/dist/cli/index-cmd.js +73 -0
- package/dist/cli/index-cmd.js.map +1 -0
- package/dist/cli/index-model.d.ts +33 -0
- package/dist/cli/index-model.d.ts.map +1 -0
- package/dist/cli/index-model.js +55 -0
- package/dist/cli/index-model.js.map +1 -0
- package/dist/cli/init-bootstrap.d.ts +6 -0
- package/dist/cli/init-bootstrap.d.ts.map +1 -0
- package/dist/cli/init-bootstrap.js +27 -0
- package/dist/cli/init-bootstrap.js.map +1 -0
- package/dist/cli/init-client-config.d.ts +13 -0
- package/dist/cli/init-client-config.d.ts.map +1 -0
- package/dist/cli/init-client-config.js +215 -0
- package/dist/cli/init-client-config.js.map +1 -0
- package/dist/cli/init-model.d.ts +80 -0
- package/dist/cli/init-model.d.ts.map +1 -0
- package/dist/cli/init-model.js +202 -0
- package/dist/cli/init-model.js.map +1 -0
- package/dist/cli/init-render.d.ts +8 -0
- package/dist/cli/init-render.d.ts.map +1 -0
- package/dist/cli/init-render.js +43 -0
- package/dist/cli/init-render.js.map +1 -0
- package/dist/cli/init-target-hooks.d.ts +3 -0
- package/dist/cli/init-target-hooks.d.ts.map +1 -0
- package/dist/cli/init-target-hooks.js +75 -0
- package/dist/cli/init-target-hooks.js.map +1 -0
- package/dist/cli/init.d.ts +12 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +96 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/json-document.d.ts +35 -0
- package/dist/cli/json-document.d.ts.map +1 -0
- package/dist/cli/json-document.js +107 -0
- package/dist/cli/json-document.js.map +1 -0
- package/dist/cli/local-history-dag-model.d.ts +43 -0
- package/dist/cli/local-history-dag-model.d.ts.map +1 -0
- package/dist/cli/local-history-dag-model.js +344 -0
- package/dist/cli/local-history-dag-model.js.map +1 -0
- package/dist/cli/local-history-dag-render.d.ts +3 -0
- package/dist/cli/local-history-dag-render.d.ts.map +1 -0
- package/dist/cli/local-history-dag-render.js +126 -0
- package/dist/cli/local-history-dag-render.js.map +1 -0
- package/dist/cli/local-history-dag.d.ts +13 -0
- package/dist/cli/local-history-dag.d.ts.map +1 -0
- package/dist/cli/local-history-dag.js +60 -0
- package/dist/cli/local-history-dag.js.map +1 -0
- package/dist/cli/main.d.ts +15 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +126 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/migrate-local-history.d.ts +12 -0
- package/dist/cli/migrate-local-history.d.ts.map +1 -0
- package/dist/cli/migrate-local-history.js +82 -0
- package/dist/cli/migrate-local-history.js.map +1 -0
- package/dist/cli/peer-command.d.ts +9 -0
- package/dist/cli/peer-command.d.ts.map +1 -0
- package/dist/cli/peer-command.js +38 -0
- package/dist/cli/peer-command.js.map +1 -0
- package/dist/contracts/capabilities.d.ts +44 -0
- package/dist/contracts/capabilities.d.ts.map +1 -0
- package/dist/contracts/capabilities.js +382 -0
- package/dist/contracts/capabilities.js.map +1 -0
- package/dist/contracts/causal-ontology.d.ts +1937 -0
- package/dist/contracts/causal-ontology.d.ts.map +1 -0
- package/dist/contracts/causal-ontology.js +506 -0
- package/dist/contracts/causal-ontology.js.map +1 -0
- package/dist/contracts/causal-surface-next-action.d.ts +17 -0
- package/dist/contracts/causal-surface-next-action.d.ts.map +1 -0
- package/dist/contracts/causal-surface-next-action.js +16 -0
- package/dist/contracts/causal-surface-next-action.js.map +1 -0
- package/dist/contracts/json-object.d.ts +7 -0
- package/dist/contracts/json-object.d.ts.map +1 -0
- package/dist/contracts/json-object.js +24 -0
- package/dist/contracts/json-object.js.map +1 -0
- package/dist/contracts/mcp-runtime.d.ts +4 -0
- package/dist/contracts/mcp-runtime.d.ts.map +1 -0
- package/dist/contracts/mcp-runtime.js +11 -0
- package/dist/contracts/mcp-runtime.js.map +1 -0
- package/dist/contracts/output-schema-cli.d.ts +2716 -0
- package/dist/contracts/output-schema-cli.d.ts.map +1 -0
- package/dist/contracts/output-schema-cli.js +68 -0
- package/dist/contracts/output-schema-cli.js.map +1 -0
- package/dist/contracts/output-schema-fragments.d.ts +10819 -0
- package/dist/contracts/output-schema-fragments.d.ts.map +1 -0
- package/dist/contracts/output-schema-fragments.js +753 -0
- package/dist/contracts/output-schema-fragments.js.map +1 -0
- package/dist/contracts/output-schema-mcp.d.ts +5926 -0
- package/dist/contracts/output-schema-mcp.d.ts.map +1 -0
- package/dist/contracts/output-schema-mcp.js +231 -0
- package/dist/contracts/output-schema-mcp.js.map +1 -0
- package/dist/contracts/output-schema-meta.d.ts +30 -0
- package/dist/contracts/output-schema-meta.d.ts.map +1 -0
- package/dist/contracts/output-schema-meta.js +51 -0
- package/dist/contracts/output-schema-meta.js.map +1 -0
- package/dist/contracts/output-schemas.d.ts +1072 -0
- package/dist/contracts/output-schemas.d.ts.map +1 -0
- package/dist/contracts/output-schemas.js +1089 -0
- package/dist/contracts/output-schemas.js.map +1 -0
- package/dist/git/diff.d.ts +32 -0
- package/dist/git/diff.d.ts.map +1 -0
- package/dist/git/diff.js +82 -0
- package/dist/git/diff.js.map +1 -0
- package/dist/git/target-git-hook-bootstrap.d.ts +7 -0
- package/dist/git/target-git-hook-bootstrap.d.ts.map +1 -0
- package/dist/git/target-git-hook-bootstrap.js +40 -0
- package/dist/git/target-git-hook-bootstrap.js.map +1 -0
- package/dist/guards/stream-boundary.d.ts +41 -0
- package/dist/guards/stream-boundary.d.ts.map +1 -0
- package/dist/guards/stream-boundary.js +97 -0
- package/dist/guards/stream-boundary.js.map +1 -0
- package/dist/hooks/posttooluse-read.d.ts +4 -0
- package/dist/hooks/posttooluse-read.d.ts.map +1 -0
- package/dist/hooks/posttooluse-read.js +41 -0
- package/dist/hooks/posttooluse-read.js.map +1 -0
- package/dist/hooks/pretooluse-read.d.ts +4 -0
- package/dist/hooks/pretooluse-read.d.ts.map +1 -0
- package/dist/hooks/pretooluse-read.js +41 -0
- package/dist/hooks/pretooluse-read.js.map +1 -0
- package/dist/hooks/read-governor.d.ts +24 -0
- package/dist/hooks/read-governor.d.ts.map +1 -0
- package/dist/hooks/read-governor.js +76 -0
- package/dist/hooks/read-governor.js.map +1 -0
- package/dist/hooks/read-messages.d.ts +6 -0
- package/dist/hooks/read-messages.d.ts.map +1 -0
- package/dist/hooks/read-messages.js +45 -0
- package/dist/hooks/read-messages.js.map +1 -0
- package/dist/hooks/shared.d.ts +52 -0
- package/dist/hooks/shared.d.ts.map +1 -0
- package/dist/hooks/shared.js +137 -0
- package/dist/hooks/shared.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/burden.d.ts +21 -0
- package/dist/mcp/burden.d.ts.map +1 -0
- package/dist/mcp/burden.js +96 -0
- package/dist/mcp/burden.js.map +1 -0
- package/dist/mcp/cache.d.ts +2 -0
- package/dist/mcp/cache.d.ts.map +1 -0
- package/dist/mcp/cache.js +2 -0
- package/dist/mcp/cache.js.map +1 -0
- package/dist/mcp/cached-file.d.ts +2 -0
- package/dist/mcp/cached-file.d.ts.map +1 -0
- package/dist/mcp/cached-file.js +2 -0
- package/dist/mcp/cached-file.js.map +1 -0
- package/dist/mcp/context.d.ts +84 -0
- package/dist/mcp/context.d.ts.map +1 -0
- package/dist/mcp/context.js +79 -0
- package/dist/mcp/context.js.map +1 -0
- package/dist/mcp/control-plane/authz-storage.d.ts +35 -0
- package/dist/mcp/control-plane/authz-storage.d.ts.map +1 -0
- package/dist/mcp/control-plane/authz-storage.js +85 -0
- package/dist/mcp/control-plane/authz-storage.js.map +1 -0
- package/dist/mcp/control-plane/session-registry.d.ts +12 -0
- package/dist/mcp/control-plane/session-registry.d.ts.map +1 -0
- package/dist/mcp/control-plane/session-registry.js +88 -0
- package/dist/mcp/control-plane/session-registry.js.map +1 -0
- package/dist/mcp/control-plane/status-projection.d.ts +8 -0
- package/dist/mcp/control-plane/status-projection.d.ts.map +1 -0
- package/dist/mcp/control-plane/status-projection.js +49 -0
- package/dist/mcp/control-plane/status-projection.js.map +1 -0
- package/dist/mcp/control-plane/types.d.ts +107 -0
- package/dist/mcp/control-plane/types.d.ts.map +1 -0
- package/dist/mcp/control-plane/types.js +2 -0
- package/dist/mcp/control-plane/types.js.map +1 -0
- package/dist/mcp/daemon-bootstrap.d.ts +9 -0
- package/dist/mcp/daemon-bootstrap.d.ts.map +1 -0
- package/dist/mcp/daemon-bootstrap.js +96 -0
- package/dist/mcp/daemon-bootstrap.js.map +1 -0
- package/dist/mcp/daemon-control-plane.d.ts +37 -0
- package/dist/mcp/daemon-control-plane.d.ts.map +1 -0
- package/dist/mcp/daemon-control-plane.js +200 -0
- package/dist/mcp/daemon-control-plane.js.map +1 -0
- package/dist/mcp/daemon-job-scheduler.d.ts +60 -0
- package/dist/mcp/daemon-job-scheduler.d.ts.map +1 -0
- package/dist/mcp/daemon-job-scheduler.js +203 -0
- package/dist/mcp/daemon-job-scheduler.js.map +1 -0
- package/dist/mcp/daemon-repos.d.ts +9 -0
- package/dist/mcp/daemon-repos.d.ts.map +1 -0
- package/dist/mcp/daemon-repos.js +73 -0
- package/dist/mcp/daemon-repos.js.map +1 -0
- package/dist/mcp/daemon-server.d.ts +23 -0
- package/dist/mcp/daemon-server.d.ts.map +1 -0
- package/dist/mcp/daemon-server.js +128 -0
- package/dist/mcp/daemon-server.js.map +1 -0
- package/dist/mcp/daemon-session-host.d.ts +31 -0
- package/dist/mcp/daemon-session-host.d.ts.map +1 -0
- package/dist/mcp/daemon-session-host.js +173 -0
- package/dist/mcp/daemon-session-host.js.map +1 -0
- package/dist/mcp/daemon-stdio-bridge.d.ts +17 -0
- package/dist/mcp/daemon-stdio-bridge.d.ts.map +1 -0
- package/dist/mcp/daemon-stdio-bridge.js +207 -0
- package/dist/mcp/daemon-stdio-bridge.js.map +1 -0
- package/dist/mcp/daemon-worker-child-pool.d.ts +22 -0
- package/dist/mcp/daemon-worker-child-pool.d.ts.map +1 -0
- package/dist/mcp/daemon-worker-child-pool.js +193 -0
- package/dist/mcp/daemon-worker-child-pool.js.map +1 -0
- package/dist/mcp/daemon-worker-inline-pool.d.ts +12 -0
- package/dist/mcp/daemon-worker-inline-pool.d.ts.map +1 -0
- package/dist/mcp/daemon-worker-inline-pool.js +43 -0
- package/dist/mcp/daemon-worker-inline-pool.js.map +1 -0
- package/dist/mcp/daemon-worker-pool.d.ts +4 -0
- package/dist/mcp/daemon-worker-pool.d.ts.map +1 -0
- package/dist/mcp/daemon-worker-pool.js +3 -0
- package/dist/mcp/daemon-worker-pool.js.map +1 -0
- package/dist/mcp/daemon-worker-process.d.ts +2 -0
- package/dist/mcp/daemon-worker-process.d.ts.map +1 -0
- package/dist/mcp/daemon-worker-process.js +26 -0
- package/dist/mcp/daemon-worker-process.js.map +1 -0
- package/dist/mcp/daemon-worker-types.d.ts +56 -0
- package/dist/mcp/daemon-worker-types.d.ts.map +1 -0
- package/dist/mcp/daemon-worker-types.js +2 -0
- package/dist/mcp/daemon-worker-types.js.map +1 -0
- package/dist/mcp/metrics.d.ts +57 -0
- package/dist/mcp/metrics.d.ts.map +1 -0
- package/dist/mcp/metrics.js +133 -0
- package/dist/mcp/metrics.js.map +1 -0
- package/dist/mcp/monitor-health.d.ts +29 -0
- package/dist/mcp/monitor-health.d.ts.map +1 -0
- package/dist/mcp/monitor-health.js +70 -0
- package/dist/mcp/monitor-health.js.map +1 -0
- package/dist/mcp/monitor-persistence.d.ts +17 -0
- package/dist/mcp/monitor-persistence.d.ts.map +1 -0
- package/dist/mcp/monitor-persistence.js +38 -0
- package/dist/mcp/monitor-persistence.js.map +1 -0
- package/dist/mcp/monitor-tick-job.d.ts +22 -0
- package/dist/mcp/monitor-tick-job.d.ts.map +1 -0
- package/dist/mcp/monitor-tick-job.js +65 -0
- package/dist/mcp/monitor-tick-job.js.map +1 -0
- package/dist/mcp/monitor-types.d.ts +123 -0
- package/dist/mcp/monitor-types.d.ts.map +1 -0
- package/dist/mcp/monitor-types.js +29 -0
- package/dist/mcp/monitor-types.js.map +1 -0
- package/dist/mcp/persisted-local-history-graph.d.ts +40 -0
- package/dist/mcp/persisted-local-history-graph.d.ts.map +1 -0
- package/dist/mcp/persisted-local-history-graph.js +388 -0
- package/dist/mcp/persisted-local-history-graph.js.map +1 -0
- package/dist/mcp/persisted-local-history-policy.d.ts +43 -0
- package/dist/mcp/persisted-local-history-policy.d.ts.map +1 -0
- package/dist/mcp/persisted-local-history-policy.js +372 -0
- package/dist/mcp/persisted-local-history-policy.js.map +1 -0
- package/dist/mcp/persisted-local-history-views.d.ts +24 -0
- package/dist/mcp/persisted-local-history-views.d.ts.map +1 -0
- package/dist/mcp/persisted-local-history-views.js +201 -0
- package/dist/mcp/persisted-local-history-views.js.map +1 -0
- package/dist/mcp/persisted-local-history.d.ts +795 -0
- package/dist/mcp/persisted-local-history.d.ts.map +1 -0
- package/dist/mcp/persisted-local-history.js +1076 -0
- package/dist/mcp/persisted-local-history.js.map +1 -0
- package/dist/mcp/persistent-monitor-runtime.d.ts +33 -0
- package/dist/mcp/persistent-monitor-runtime.d.ts.map +1 -0
- package/dist/mcp/persistent-monitor-runtime.js +356 -0
- package/dist/mcp/persistent-monitor-runtime.js.map +1 -0
- package/dist/mcp/policy.d.ts +29 -0
- package/dist/mcp/policy.d.ts.map +1 -0
- package/dist/mcp/policy.js +40 -0
- package/dist/mcp/policy.js.map +1 -0
- package/dist/mcp/receipt.d.ts +64 -0
- package/dist/mcp/receipt.d.ts.map +1 -0
- package/dist/mcp/receipt.js +99 -0
- package/dist/mcp/receipt.js.map +1 -0
- package/dist/mcp/repo-concurrency.d.ts +62 -0
- package/dist/mcp/repo-concurrency.d.ts.map +1 -0
- package/dist/mcp/repo-concurrency.js +195 -0
- package/dist/mcp/repo-concurrency.js.map +1 -0
- package/dist/mcp/repo-overview/filter.d.ts +6 -0
- package/dist/mcp/repo-overview/filter.d.ts.map +1 -0
- package/dist/mcp/repo-overview/filter.js +32 -0
- package/dist/mcp/repo-overview/filter.js.map +1 -0
- package/dist/mcp/repo-overview/types.d.ts +41 -0
- package/dist/mcp/repo-overview/types.d.ts.map +1 -0
- package/dist/mcp/repo-overview/types.js +2 -0
- package/dist/mcp/repo-overview/types.js.map +1 -0
- package/dist/mcp/repo-overview/view-projection.d.ts +8 -0
- package/dist/mcp/repo-overview/view-projection.d.ts.map +1 -0
- package/dist/mcp/repo-overview/view-projection.js +73 -0
- package/dist/mcp/repo-overview/view-projection.js.map +1 -0
- package/dist/mcp/repo-state-git.d.ts +8 -0
- package/dist/mcp/repo-state-git.d.ts.map +1 -0
- package/dist/mcp/repo-state-git.js +203 -0
- package/dist/mcp/repo-state-git.js.map +1 -0
- package/dist/mcp/repo-state-observation.d.ts +4 -0
- package/dist/mcp/repo-state-observation.d.ts.map +1 -0
- package/dist/mcp/repo-state-observation.js +171 -0
- package/dist/mcp/repo-state-observation.js.map +1 -0
- package/dist/mcp/repo-state-transition.d.ts +4 -0
- package/dist/mcp/repo-state-transition.d.ts.map +1 -0
- package/dist/mcp/repo-state-transition.js +124 -0
- package/dist/mcp/repo-state-transition.js.map +1 -0
- package/dist/mcp/repo-state-types.d.ts +88 -0
- package/dist/mcp/repo-state-types.d.ts.map +1 -0
- package/dist/mcp/repo-state-types.js +2 -0
- package/dist/mcp/repo-state-types.js.map +1 -0
- package/dist/mcp/repo-state.d.ts +37 -0
- package/dist/mcp/repo-state.d.ts.map +1 -0
- package/dist/mcp/repo-state.js +101 -0
- package/dist/mcp/repo-state.js.map +1 -0
- package/dist/mcp/repo-tool-job.d.ts +55 -0
- package/dist/mcp/repo-tool-job.d.ts.map +1 -0
- package/dist/mcp/repo-tool-job.js +50 -0
- package/dist/mcp/repo-tool-job.js.map +1 -0
- package/dist/mcp/repo-tool-worker-context.d.ts +8 -0
- package/dist/mcp/repo-tool-worker-context.d.ts.map +1 -0
- package/dist/mcp/repo-tool-worker-context.js +199 -0
- package/dist/mcp/repo-tool-worker-context.js.map +1 -0
- package/dist/mcp/repo-workspace.d.ts +4 -0
- package/dist/mcp/repo-workspace.d.ts.map +1 -0
- package/dist/mcp/repo-workspace.js +15 -0
- package/dist/mcp/repo-workspace.js.map +1 -0
- package/dist/mcp/run-capture-config.d.ts +11 -0
- package/dist/mcp/run-capture-config.d.ts.map +1 -0
- package/dist/mcp/run-capture-config.js +23 -0
- package/dist/mcp/run-capture-config.js.map +1 -0
- package/dist/mcp/runtime-causal-context.d.ts +22 -0
- package/dist/mcp/runtime-causal-context.d.ts.map +1 -0
- package/dist/mcp/runtime-causal-context.js +28 -0
- package/dist/mcp/runtime-causal-context.js.map +1 -0
- package/dist/mcp/runtime-observability.d.ts +102 -0
- package/dist/mcp/runtime-observability.d.ts.map +1 -0
- package/dist/mcp/runtime-observability.js +95 -0
- package/dist/mcp/runtime-observability.js.map +1 -0
- package/dist/mcp/runtime-staged-target.d.ts +28 -0
- package/dist/mcp/runtime-staged-target.d.ts.map +1 -0
- package/dist/mcp/runtime-staged-target.js +101 -0
- package/dist/mcp/runtime-staged-target.js.map +1 -0
- package/dist/mcp/runtime-workspace-overlay.d.ts +45 -0
- package/dist/mcp/runtime-workspace-overlay.d.ts.map +1 -0
- package/dist/mcp/runtime-workspace-overlay.js +153 -0
- package/dist/mcp/runtime-workspace-overlay.js.map +1 -0
- package/dist/mcp/secret-scrub.d.ts +17 -0
- package/dist/mcp/secret-scrub.d.ts.map +1 -0
- package/dist/mcp/secret-scrub.js +82 -0
- package/dist/mcp/secret-scrub.js.map +1 -0
- package/dist/mcp/semantic-transition-guidance.d.ts +6 -0
- package/dist/mcp/semantic-transition-guidance.d.ts.map +1 -0
- package/dist/mcp/semantic-transition-guidance.js +47 -0
- package/dist/mcp/semantic-transition-guidance.js.map +1 -0
- package/dist/mcp/semantic-transition-summary.d.ts +23 -0
- package/dist/mcp/semantic-transition-summary.d.ts.map +1 -0
- package/dist/mcp/semantic-transition-summary.js +82 -0
- package/dist/mcp/semantic-transition-summary.js.map +1 -0
- package/dist/mcp/server-context.d.ts +46 -0
- package/dist/mcp/server-context.d.ts.map +1 -0
- package/dist/mcp/server-context.js +163 -0
- package/dist/mcp/server-context.js.map +1 -0
- package/dist/mcp/server-invocation.d.ts +73 -0
- package/dist/mcp/server-invocation.d.ts.map +1 -0
- package/dist/mcp/server-invocation.js +265 -0
- package/dist/mcp/server-invocation.js.map +1 -0
- package/dist/mcp/server-tool-access.d.ts +18 -0
- package/dist/mcp/server-tool-access.d.ts.map +1 -0
- package/dist/mcp/server-tool-access.js +123 -0
- package/dist/mcp/server-tool-access.js.map +1 -0
- package/dist/mcp/server.d.ts +41 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +215 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/stdio-server.d.ts +6 -0
- package/dist/mcp/stdio-server.d.ts.map +1 -0
- package/dist/mcp/stdio-server.js +20 -0
- package/dist/mcp/stdio-server.js.map +1 -0
- package/dist/mcp/stdio.d.ts +2 -0
- package/dist/mcp/stdio.d.ts.map +1 -0
- package/dist/mcp/stdio.js +3 -0
- package/dist/mcp/stdio.js.map +1 -0
- package/dist/mcp/tool-registry.d.ts +5 -0
- package/dist/mcp/tool-registry.d.ts.map +1 -0
- package/dist/mcp/tool-registry.js +76 -0
- package/dist/mcp/tool-registry.js.map +1 -0
- package/dist/mcp/tools/activity-view.d.ts +3 -0
- package/dist/mcp/tools/activity-view.d.ts.map +1 -0
- package/dist/mcp/tools/activity-view.js +259 -0
- package/dist/mcp/tools/activity-view.js.map +1 -0
- package/dist/mcp/tools/budget.d.ts +3 -0
- package/dist/mcp/tools/budget.d.ts.map +1 -0
- package/dist/mcp/tools/budget.js +20 -0
- package/dist/mcp/tools/budget.js.map +1 -0
- package/dist/mcp/tools/causal-attach.d.ts +3 -0
- package/dist/mcp/tools/causal-attach.d.ts.map +1 -0
- package/dist/mcp/tools/causal-attach.js +53 -0
- package/dist/mcp/tools/causal-attach.js.map +1 -0
- package/dist/mcp/tools/causal-status.d.ts +3 -0
- package/dist/mcp/tools/causal-status.d.ts.map +1 -0
- package/dist/mcp/tools/causal-status.js +46 -0
- package/dist/mcp/tools/causal-status.js.map +1 -0
- package/dist/mcp/tools/changed-since.d.ts +3 -0
- package/dist/mcp/tools/changed-since.d.ts.map +1 -0
- package/dist/mcp/tools/changed-since.js +57 -0
- package/dist/mcp/tools/changed-since.js.map +1 -0
- package/dist/mcp/tools/code-find.d.ts +104 -0
- package/dist/mcp/tools/code-find.d.ts.map +1 -0
- package/dist/mcp/tools/code-find.js +125 -0
- package/dist/mcp/tools/code-find.js.map +1 -0
- package/dist/mcp/tools/code-refs.d.ts +3 -0
- package/dist/mcp/tools/code-refs.d.ts.map +1 -0
- package/dist/mcp/tools/code-refs.js +370 -0
- package/dist/mcp/tools/code-refs.js.map +1 -0
- package/dist/mcp/tools/code-show.d.ts +104 -0
- package/dist/mcp/tools/code-show.d.ts.map +1 -0
- package/dist/mcp/tools/code-show.js +202 -0
- package/dist/mcp/tools/code-show.js.map +1 -0
- package/dist/mcp/tools/daemon-monitors.d.ts +3 -0
- package/dist/mcp/tools/daemon-monitors.d.ts.map +1 -0
- package/dist/mcp/tools/daemon-monitors.js +12 -0
- package/dist/mcp/tools/daemon-monitors.js.map +1 -0
- package/dist/mcp/tools/daemon-repos.d.ts +3 -0
- package/dist/mcp/tools/daemon-repos.d.ts.map +1 -0
- package/dist/mcp/tools/daemon-repos.js +20 -0
- package/dist/mcp/tools/daemon-repos.js.map +1 -0
- package/dist/mcp/tools/daemon-sessions.d.ts +3 -0
- package/dist/mcp/tools/daemon-sessions.d.ts.map +1 -0
- package/dist/mcp/tools/daemon-sessions.js +12 -0
- package/dist/mcp/tools/daemon-sessions.js.map +1 -0
- package/dist/mcp/tools/daemon-status.d.ts +3 -0
- package/dist/mcp/tools/daemon-status.d.ts.map +1 -0
- package/dist/mcp/tools/daemon-status.js +10 -0
- package/dist/mcp/tools/daemon-status.js.map +1 -0
- package/dist/mcp/tools/diagnostic-models.d.ts +85 -0
- package/dist/mcp/tools/diagnostic-models.d.ts.map +1 -0
- package/dist/mcp/tools/diagnostic-models.js +5 -0
- package/dist/mcp/tools/diagnostic-models.js.map +1 -0
- package/dist/mcp/tools/doctor.d.ts +3 -0
- package/dist/mcp/tools/doctor.d.ts.map +1 -0
- package/dist/mcp/tools/doctor.js +54 -0
- package/dist/mcp/tools/doctor.js.map +1 -0
- package/dist/mcp/tools/explain.d.ts +3 -0
- package/dist/mcp/tools/explain.d.ts.map +1 -0
- package/dist/mcp/tools/explain.js +81 -0
- package/dist/mcp/tools/explain.js.map +1 -0
- package/dist/mcp/tools/file-outline.d.ts +3 -0
- package/dist/mcp/tools/file-outline.d.ts.map +1 -0
- package/dist/mcp/tools/file-outline.js +54 -0
- package/dist/mcp/tools/file-outline.js.map +1 -0
- package/dist/mcp/tools/git-files.d.ts +24 -0
- package/dist/mcp/tools/git-files.d.ts.map +1 -0
- package/dist/mcp/tools/git-files.js +57 -0
- package/dist/mcp/tools/git-files.js.map +1 -0
- package/dist/mcp/tools/graft-diff.d.ts +3 -0
- package/dist/mcp/tools/graft-diff.d.ts.map +1 -0
- package/dist/mcp/tools/graft-diff.js +33 -0
- package/dist/mcp/tools/graft-diff.js.map +1 -0
- package/dist/mcp/tools/map-collector.d.ts +85 -0
- package/dist/mcp/tools/map-collector.d.ts.map +1 -0
- package/dist/mcp/tools/map-collector.js +249 -0
- package/dist/mcp/tools/map-collector.js.map +1 -0
- package/dist/mcp/tools/map.d.ts +7 -0
- package/dist/mcp/tools/map.d.ts.map +1 -0
- package/dist/mcp/tools/map.js +154 -0
- package/dist/mcp/tools/map.js.map +1 -0
- package/dist/mcp/tools/monitor-pause.d.ts +3 -0
- package/dist/mcp/tools/monitor-pause.d.ts.map +1 -0
- package/dist/mcp/tools/monitor-pause.js +16 -0
- package/dist/mcp/tools/monitor-pause.js.map +1 -0
- package/dist/mcp/tools/monitor-resume.d.ts +3 -0
- package/dist/mcp/tools/monitor-resume.d.ts.map +1 -0
- package/dist/mcp/tools/monitor-resume.js +16 -0
- package/dist/mcp/tools/monitor-resume.js.map +1 -0
- package/dist/mcp/tools/monitor-start.d.ts +3 -0
- package/dist/mcp/tools/monitor-start.d.ts.map +1 -0
- package/dist/mcp/tools/monitor-start.js +18 -0
- package/dist/mcp/tools/monitor-start.js.map +1 -0
- package/dist/mcp/tools/monitor-stop.d.ts +3 -0
- package/dist/mcp/tools/monitor-stop.d.ts.map +1 -0
- package/dist/mcp/tools/monitor-stop.js +16 -0
- package/dist/mcp/tools/monitor-stop.js.map +1 -0
- package/dist/mcp/tools/precision-live.d.ts +20 -0
- package/dist/mcp/tools/precision-live.d.ts.map +1 -0
- package/dist/mcp/tools/precision-live.js +105 -0
- package/dist/mcp/tools/precision-live.js.map +1 -0
- package/dist/mcp/tools/precision-match.d.ts +21 -0
- package/dist/mcp/tools/precision-match.d.ts.map +1 -0
- package/dist/mcp/tools/precision-match.js +46 -0
- package/dist/mcp/tools/precision-match.js.map +1 -0
- package/dist/mcp/tools/precision-paths.d.ts +7 -0
- package/dist/mcp/tools/precision-paths.d.ts.map +1 -0
- package/dist/mcp/tools/precision-paths.js +53 -0
- package/dist/mcp/tools/precision-paths.js.map +1 -0
- package/dist/mcp/tools/precision-query.d.ts +38 -0
- package/dist/mcp/tools/precision-query.d.ts.map +1 -0
- package/dist/mcp/tools/precision-query.js +116 -0
- package/dist/mcp/tools/precision-query.js.map +1 -0
- package/dist/mcp/tools/precision-show.d.ts +15 -0
- package/dist/mcp/tools/precision-show.d.ts.map +1 -0
- package/dist/mcp/tools/precision-show.js +46 -0
- package/dist/mcp/tools/precision-show.js.map +1 -0
- package/dist/mcp/tools/precision-visibility.d.ts +10 -0
- package/dist/mcp/tools/precision-visibility.d.ts.map +1 -0
- package/dist/mcp/tools/precision-visibility.js +24 -0
- package/dist/mcp/tools/precision-visibility.js.map +1 -0
- package/dist/mcp/tools/precision-warp.d.ts +6 -0
- package/dist/mcp/tools/precision-warp.d.ts.map +1 -0
- package/dist/mcp/tools/precision-warp.js +76 -0
- package/dist/mcp/tools/precision-warp.js.map +1 -0
- package/dist/mcp/tools/precision.d.ts +7 -0
- package/dist/mcp/tools/precision.d.ts.map +1 -0
- package/dist/mcp/tools/precision.js +6 -0
- package/dist/mcp/tools/precision.js.map +1 -0
- package/dist/mcp/tools/read-range.d.ts +3 -0
- package/dist/mcp/tools/read-range.d.ts.map +1 -0
- package/dist/mcp/tools/read-range.js +26 -0
- package/dist/mcp/tools/read-range.js.map +1 -0
- package/dist/mcp/tools/run-capture.d.ts +3 -0
- package/dist/mcp/tools/run-capture.d.ts.map +1 -0
- package/dist/mcp/tools/run-capture.js +125 -0
- package/dist/mcp/tools/run-capture.js.map +1 -0
- package/dist/mcp/tools/safe-read.d.ts +3 -0
- package/dist/mcp/tools/safe-read.d.ts.map +1 -0
- package/dist/mcp/tools/safe-read.js +133 -0
- package/dist/mcp/tools/safe-read.js.map +1 -0
- package/dist/mcp/tools/since.d.ts +3 -0
- package/dist/mcp/tools/since.d.ts.map +1 -0
- package/dist/mcp/tools/since.js +46 -0
- package/dist/mcp/tools/since.js.map +1 -0
- package/dist/mcp/tools/state.d.ts +4 -0
- package/dist/mcp/tools/state.d.ts.map +1 -0
- package/dist/mcp/tools/state.js +35 -0
- package/dist/mcp/tools/state.js.map +1 -0
- package/dist/mcp/tools/stats.d.ts +3 -0
- package/dist/mcp/tools/stats.d.ts.map +1 -0
- package/dist/mcp/tools/stats.js +22 -0
- package/dist/mcp/tools/stats.js.map +1 -0
- package/dist/mcp/tools/workspace-authorizations.d.ts +3 -0
- package/dist/mcp/tools/workspace-authorizations.d.ts.map +1 -0
- package/dist/mcp/tools/workspace-authorizations.js +12 -0
- package/dist/mcp/tools/workspace-authorizations.js.map +1 -0
- package/dist/mcp/tools/workspace-authorize.d.ts +3 -0
- package/dist/mcp/tools/workspace-authorize.d.ts.map +1 -0
- package/dist/mcp/tools/workspace-authorize.js +18 -0
- package/dist/mcp/tools/workspace-authorize.js.map +1 -0
- package/dist/mcp/tools/workspace-bind.d.ts +3 -0
- package/dist/mcp/tools/workspace-bind.d.ts.map +1 -0
- package/dist/mcp/tools/workspace-bind.js +23 -0
- package/dist/mcp/tools/workspace-bind.js.map +1 -0
- package/dist/mcp/tools/workspace-rebind.d.ts +3 -0
- package/dist/mcp/tools/workspace-rebind.d.ts.map +1 -0
- package/dist/mcp/tools/workspace-rebind.js +23 -0
- package/dist/mcp/tools/workspace-rebind.js.map +1 -0
- package/dist/mcp/tools/workspace-revoke.d.ts +3 -0
- package/dist/mcp/tools/workspace-revoke.d.ts.map +1 -0
- package/dist/mcp/tools/workspace-revoke.js +16 -0
- package/dist/mcp/tools/workspace-revoke.js.map +1 -0
- package/dist/mcp/tools/workspace-status.d.ts +3 -0
- package/dist/mcp/tools/workspace-status.d.ts.map +1 -0
- package/dist/mcp/tools/workspace-status.js +10 -0
- package/dist/mcp/tools/workspace-status.js.map +1 -0
- package/dist/mcp/warp-pool.d.ts +13 -0
- package/dist/mcp/warp-pool.d.ts.map +1 -0
- package/dist/mcp/warp-pool.js +30 -0
- package/dist/mcp/warp-pool.js.map +1 -0
- package/dist/mcp/workspace-read-observation-model.d.ts +34 -0
- package/dist/mcp/workspace-read-observation-model.d.ts.map +1 -0
- package/dist/mcp/workspace-read-observation-model.js +35 -0
- package/dist/mcp/workspace-read-observation-model.js.map +1 -0
- package/dist/mcp/workspace-read-observation.d.ts +19 -0
- package/dist/mcp/workspace-read-observation.d.ts.map +1 -0
- package/dist/mcp/workspace-read-observation.js +71 -0
- package/dist/mcp/workspace-read-observation.js.map +1 -0
- package/dist/mcp/workspace-router-capability.d.ts +14 -0
- package/dist/mcp/workspace-router-capability.d.ts.map +1 -0
- package/dist/mcp/workspace-router-capability.js +22 -0
- package/dist/mcp/workspace-router-capability.js.map +1 -0
- package/dist/mcp/workspace-router-history.d.ts +65 -0
- package/dist/mcp/workspace-router-history.d.ts.map +1 -0
- package/dist/mcp/workspace-router-history.js +142 -0
- package/dist/mcp/workspace-router-history.js.map +1 -0
- package/dist/mcp/workspace-router-model.d.ts +96 -0
- package/dist/mcp/workspace-router-model.d.ts.map +1 -0
- package/dist/mcp/workspace-router-model.js +31 -0
- package/dist/mcp/workspace-router-model.js.map +1 -0
- package/dist/mcp/workspace-router-resolution.d.ts +10 -0
- package/dist/mcp/workspace-router-resolution.d.ts.map +1 -0
- package/dist/mcp/workspace-router-resolution.js +56 -0
- package/dist/mcp/workspace-router-resolution.js.map +1 -0
- package/dist/mcp/workspace-router-runtime.d.ts +79 -0
- package/dist/mcp/workspace-router-runtime.d.ts.map +1 -0
- package/dist/mcp/workspace-router-runtime.js +126 -0
- package/dist/mcp/workspace-router-runtime.js.map +1 -0
- package/dist/mcp/workspace-router.d.ts +72 -0
- package/dist/mcp/workspace-router.d.ts.map +1 -0
- package/dist/mcp/workspace-router.js +494 -0
- package/dist/mcp/workspace-router.js.map +1 -0
- package/dist/metrics/logger.d.ts +14 -0
- package/dist/metrics/logger.d.ts.map +1 -0
- package/dist/metrics/logger.js +30 -0
- package/dist/metrics/logger.js.map +1 -0
- package/dist/metrics/types.d.ts +25 -0
- package/dist/metrics/types.d.ts.map +1 -0
- package/dist/metrics/types.js +28 -0
- package/dist/metrics/types.js.map +1 -0
- package/dist/operations/cached-file.d.ts +24 -0
- package/dist/operations/cached-file.d.ts.map +1 -0
- package/dist/operations/cached-file.js +37 -0
- package/dist/operations/cached-file.js.map +1 -0
- package/dist/operations/diff-identity.d.ts +32 -0
- package/dist/operations/diff-identity.d.ts.map +1 -0
- package/dist/operations/diff-identity.js +93 -0
- package/dist/operations/diff-identity.js.map +1 -0
- package/dist/operations/file-outline.d.ts +15 -0
- package/dist/operations/file-outline.d.ts.map +1 -0
- package/dist/operations/file-outline.js +32 -0
- package/dist/operations/file-outline.js.map +1 -0
- package/dist/operations/graft-diff.d.ts +43 -0
- package/dist/operations/graft-diff.d.ts.map +1 -0
- package/dist/operations/graft-diff.js +115 -0
- package/dist/operations/graft-diff.js.map +1 -0
- package/dist/operations/observation-cache.d.ts +64 -0
- package/dist/operations/observation-cache.d.ts.map +1 -0
- package/dist/operations/observation-cache.js +104 -0
- package/dist/operations/observation-cache.js.map +1 -0
- package/dist/operations/read-range.d.ts +14 -0
- package/dist/operations/read-range.d.ts.map +1 -0
- package/dist/operations/read-range.js +41 -0
- package/dist/operations/read-range.js.map +1 -0
- package/dist/operations/repo-workspace.d.ts +114 -0
- package/dist/operations/repo-workspace.d.ts.map +1 -0
- package/dist/operations/repo-workspace.js +228 -0
- package/dist/operations/repo-workspace.js.map +1 -0
- package/dist/operations/result-dto.d.ts +10 -0
- package/dist/operations/result-dto.d.ts.map +1 -0
- package/dist/operations/result-dto.js +21 -0
- package/dist/operations/result-dto.js.map +1 -0
- package/dist/operations/safe-read.d.ts +35 -0
- package/dist/operations/safe-read.d.ts.map +1 -0
- package/dist/operations/safe-read.js +75 -0
- package/dist/operations/safe-read.js.map +1 -0
- package/dist/operations/state.d.ts +25 -0
- package/dist/operations/state.d.ts.map +1 -0
- package/dist/operations/state.js +47 -0
- package/dist/operations/state.js.map +1 -0
- package/dist/operations/structured-buffer-compare.d.ts +5 -0
- package/dist/operations/structured-buffer-compare.d.ts.map +1 -0
- package/dist/operations/structured-buffer-compare.js +392 -0
- package/dist/operations/structured-buffer-compare.js.map +1 -0
- package/dist/operations/structured-buffer-model.d.ts +232 -0
- package/dist/operations/structured-buffer-model.d.ts.map +1 -0
- package/dist/operations/structured-buffer-model.js +175 -0
- package/dist/operations/structured-buffer-model.js.map +1 -0
- package/dist/operations/structured-buffer-query.d.ts +24 -0
- package/dist/operations/structured-buffer-query.d.ts.map +1 -0
- package/dist/operations/structured-buffer-query.js +690 -0
- package/dist/operations/structured-buffer-query.js.map +1 -0
- package/dist/operations/structured-buffer.d.ts +43 -0
- package/dist/operations/structured-buffer.d.ts.map +1 -0
- package/dist/operations/structured-buffer.js +96 -0
- package/dist/operations/structured-buffer.js.map +1 -0
- package/dist/parser/diff.d.ts +63 -0
- package/dist/parser/diff.d.ts.map +1 -0
- package/dist/parser/diff.js +259 -0
- package/dist/parser/diff.js.map +1 -0
- package/dist/parser/lang.d.ts +17 -0
- package/dist/parser/lang.d.ts.map +1 -0
- package/dist/parser/lang.js +51 -0
- package/dist/parser/lang.js.map +1 -0
- package/dist/parser/markdown.d.ts +3 -0
- package/dist/parser/markdown.d.ts.map +1 -0
- package/dist/parser/markdown.js +168 -0
- package/dist/parser/markdown.js.map +1 -0
- package/dist/parser/outline.d.ts +12 -0
- package/dist/parser/outline.d.ts.map +1 -0
- package/dist/parser/outline.js +251 -0
- package/dist/parser/outline.js.map +1 -0
- package/dist/parser/runtime.d.ts +13 -0
- package/dist/parser/runtime.d.ts.map +1 -0
- package/dist/parser/runtime.js +43 -0
- package/dist/parser/runtime.js.map +1 -0
- package/dist/parser/types.d.ts +41 -0
- package/dist/parser/types.d.ts.map +1 -0
- package/dist/parser/types.js +46 -0
- package/dist/parser/types.js.map +1 -0
- package/dist/policy/evaluate.d.ts +8 -0
- package/dist/policy/evaluate.d.ts.map +1 -0
- package/dist/policy/evaluate.js +153 -0
- package/dist/policy/evaluate.js.map +1 -0
- package/dist/policy/graftignore.d.ts +2 -0
- package/dist/policy/graftignore.d.ts.map +1 -0
- package/dist/policy/graftignore.js +7 -0
- package/dist/policy/graftignore.js.map +1 -0
- package/dist/policy/types.d.ts +104 -0
- package/dist/policy/types.d.ts.map +1 -0
- package/dist/policy/types.js +49 -0
- package/dist/policy/types.js.map +1 -0
- package/dist/ports/codec.d.ts +10 -0
- package/dist/ports/codec.d.ts.map +1 -0
- package/dist/ports/codec.js +5 -0
- package/dist/ports/codec.js.map +1 -0
- package/dist/ports/filesystem.d.ts +19 -0
- package/dist/ports/filesystem.d.ts.map +1 -0
- package/dist/ports/filesystem.js +5 -0
- package/dist/ports/filesystem.js.map +1 -0
- package/dist/ports/git.d.ts +11 -0
- package/dist/ports/git.d.ts.map +1 -0
- package/dist/ports/git.js +5 -0
- package/dist/ports/git.js.map +1 -0
- package/dist/ports/guards.d.ts +15 -0
- package/dist/ports/guards.d.ts.map +1 -0
- package/dist/ports/guards.js +43 -0
- package/dist/ports/guards.js.map +1 -0
- package/dist/ports/process-runner.d.ts +17 -0
- package/dist/ports/process-runner.d.ts.map +1 -0
- package/dist/ports/process-runner.js +5 -0
- package/dist/ports/process-runner.js.map +1 -0
- package/dist/ports/warp.d.ts +45 -0
- package/dist/ports/warp.d.ts.map +1 -0
- package/dist/ports/warp.js +5 -0
- package/dist/ports/warp.js.map +1 -0
- package/dist/release/security-gate.d.ts +24 -0
- package/dist/release/security-gate.d.ts.map +1 -0
- package/dist/release/security-gate.js +69 -0
- package/dist/release/security-gate.js.map +1 -0
- package/dist/session/tracker.d.ts +36 -0
- package/dist/session/tracker.d.ts.map +1 -0
- package/dist/session/tracker.js +113 -0
- package/dist/session/tracker.js.map +1 -0
- package/dist/session/types.d.ts +14 -0
- package/dist/session/types.d.ts.map +1 -0
- package/dist/session/types.js +18 -0
- package/dist/session/types.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/dist/warp/identity-resolver.d.ts +14 -0
- package/dist/warp/identity-resolver.d.ts.map +1 -0
- package/dist/warp/identity-resolver.js +31 -0
- package/dist/warp/identity-resolver.js.map +1 -0
- package/dist/warp/indexer-git.d.ts +22 -0
- package/dist/warp/indexer-git.d.ts.map +1 -0
- package/dist/warp/indexer-git.js +148 -0
- package/dist/warp/indexer-git.js.map +1 -0
- package/dist/warp/indexer-graph.d.ts +17 -0
- package/dist/warp/indexer-graph.d.ts.map +1 -0
- package/dist/warp/indexer-graph.js +179 -0
- package/dist/warp/indexer-graph.js.map +1 -0
- package/dist/warp/indexer-model.d.ts +51 -0
- package/dist/warp/indexer-model.d.ts.map +1 -0
- package/dist/warp/indexer-model.js +21 -0
- package/dist/warp/indexer-model.js.map +1 -0
- package/dist/warp/indexer.d.ts +9 -0
- package/dist/warp/indexer.d.ts.map +1 -0
- package/dist/warp/indexer.js +112 -0
- package/dist/warp/indexer.js.map +1 -0
- package/dist/warp/observers.d.ts +54 -0
- package/dist/warp/observers.d.ts.map +1 -0
- package/dist/warp/observers.js +88 -0
- package/dist/warp/observers.js.map +1 -0
- package/dist/warp/open.d.ts +15 -0
- package/dist/warp/open.d.ts.map +1 -0
- package/dist/warp/open.js +67 -0
- package/dist/warp/open.js.map +1 -0
- package/dist/warp/symbol-identity.d.ts +11 -0
- package/dist/warp/symbol-identity.d.ts.map +1 -0
- package/dist/warp/symbol-identity.js +67 -0
- package/dist/warp/symbol-identity.js.map +1 -0
- package/dist/warp/writer-id.d.ts +5 -0
- package/dist/warp/writer-id.d.ts.map +1 -0
- package/dist/warp/writer-id.js +25 -0
- package/dist/warp/writer-id.js.map +1 -0
- package/docs/CLI.md +37 -15
- package/docs/MCP.md +44 -25
- package/package.json +19 -3
- package/src/adapters/repo-paths.ts +22 -0
- package/src/adapters/rotating-ndjson-log.ts +66 -0
- package/src/api/index.ts +107 -0
- package/src/api/repo-local-graft.ts +21 -0
- package/src/api/repo-workspace.ts +34 -0
- package/src/api/tool-bridge.ts +21 -0
- package/src/cli/activity-render.ts +112 -0
- package/src/cli/cli-error.ts +153 -0
- package/src/cli/command-parser.ts +302 -0
- package/src/cli/entrypoint.ts +18 -0
- package/src/cli/index-cmd.ts +31 -23
- package/src/cli/index-model.ts +76 -0
- package/src/cli/init-bootstrap.ts +47 -0
- package/src/cli/init-client-config.ts +299 -0
- package/src/cli/init-model.ts +229 -0
- package/src/cli/init-render.ts +54 -0
- package/src/cli/init-target-hooks.ts +93 -0
- package/src/cli/init.ts +16 -757
- package/src/cli/json-document.ts +144 -0
- package/src/cli/local-history-dag-model.ts +437 -0
- package/src/cli/local-history-dag-render.ts +133 -0
- package/src/cli/local-history-dag.ts +103 -0
- package/src/cli/main.ts +46 -333
- package/src/cli/migrate-local-history.ts +118 -0
- package/src/cli/peer-command.ts +59 -0
- package/src/contracts/capabilities.ts +218 -109
- package/src/contracts/causal-ontology.ts +5 -0
- package/src/contracts/json-object.ts +28 -0
- package/src/contracts/mcp-runtime.ts +16 -0
- package/src/contracts/output-schema-cli.ts +70 -0
- package/src/contracts/output-schema-fragments.ts +831 -0
- package/src/contracts/output-schema-mcp.ts +282 -0
- package/src/contracts/output-schema-meta.ts +119 -0
- package/src/contracts/output-schemas.ts +62 -1
- package/src/index.ts +1 -0
- package/src/mcp/cache.ts +7 -145
- package/src/mcp/cached-file.ts +1 -40
- package/src/mcp/context.ts +83 -13
- package/src/mcp/control-plane/authz-storage.ts +129 -0
- package/src/mcp/control-plane/session-registry.ts +115 -0
- package/src/mcp/control-plane/status-projection.ts +76 -0
- package/src/mcp/control-plane/types.ts +144 -0
- package/src/mcp/daemon-bootstrap.ts +100 -0
- package/src/mcp/daemon-control-plane.ts +93 -337
- package/src/mcp/daemon-repos.ts +27 -144
- package/src/mcp/daemon-server.ts +31 -262
- package/src/mcp/daemon-session-host.ts +230 -0
- package/src/mcp/daemon-stdio-bridge.ts +260 -0
- package/src/mcp/daemon-worker-child-pool.ts +213 -0
- package/src/mcp/daemon-worker-inline-pool.ts +46 -0
- package/src/mcp/daemon-worker-pool.ts +7 -310
- package/src/mcp/daemon-worker-types.ts +66 -0
- package/src/mcp/metrics.ts +68 -52
- package/src/mcp/monitor-health.ts +83 -0
- package/src/mcp/monitor-persistence.ts +54 -0
- package/src/mcp/monitor-tick-job.ts +3 -0
- package/src/mcp/monitor-types.ts +103 -0
- package/src/mcp/persisted-local-history-graph.ts +591 -0
- package/src/mcp/persisted-local-history-policy.ts +501 -0
- package/src/mcp/persisted-local-history-views.ts +250 -0
- package/src/mcp/persisted-local-history.ts +1137 -762
- package/src/mcp/persistent-monitor-runtime.ts +71 -175
- package/src/mcp/policy.ts +11 -20
- package/src/mcp/receipt.ts +67 -19
- package/src/mcp/repo-concurrency.ts +81 -7
- package/src/mcp/repo-overview/filter.ts +44 -0
- package/src/mcp/repo-overview/types.ts +63 -0
- package/src/mcp/repo-overview/view-projection.ts +90 -0
- package/src/mcp/repo-state-git.ts +247 -0
- package/src/mcp/repo-state-observation.ts +203 -0
- package/src/mcp/repo-state-transition.ts +151 -0
- package/src/mcp/repo-state-types.ts +107 -0
- package/src/mcp/repo-state.ts +90 -721
- package/src/mcp/repo-tool-job.ts +16 -216
- package/src/mcp/repo-tool-worker-context.ts +212 -0
- package/src/mcp/repo-workspace.ts +21 -0
- package/src/mcp/runtime-observability.ts +41 -43
- package/src/mcp/secret-scrub.ts +89 -0
- package/src/mcp/server-context.ts +223 -0
- package/src/mcp/server-invocation.ts +388 -0
- package/src/mcp/server-tool-access.ts +145 -0
- package/src/mcp/server.ts +46 -606
- package/src/mcp/stdio-server.ts +16 -2
- package/src/mcp/tool-registry.ts +80 -0
- package/src/mcp/tools/activity-view.ts +3 -3
- package/src/mcp/tools/budget.ts +10 -7
- package/src/mcp/tools/causal-attach.ts +3 -3
- package/src/mcp/tools/causal-status.ts +3 -3
- package/src/mcp/tools/changed-since.ts +4 -3
- package/src/mcp/tools/code-find.ts +7 -2
- package/src/mcp/tools/code-refs.ts +7 -3
- package/src/mcp/tools/code-show.ts +12 -2
- package/src/mcp/tools/daemon-monitors.ts +3 -3
- package/src/mcp/tools/daemon-repos.ts +3 -3
- package/src/mcp/tools/daemon-sessions.ts +3 -3
- package/src/mcp/tools/daemon-status.ts +3 -3
- package/src/mcp/tools/diagnostic-models.ts +95 -0
- package/src/mcp/tools/doctor.ts +10 -7
- package/src/mcp/tools/explain.ts +3 -3
- package/src/mcp/tools/file-outline.ts +10 -4
- package/src/mcp/tools/graft-diff.ts +6 -3
- package/src/mcp/tools/map-collector.ts +338 -0
- package/src/mcp/tools/map.ts +52 -3
- package/src/mcp/tools/monitor-pause.ts +3 -3
- package/src/mcp/tools/monitor-resume.ts +3 -3
- package/src/mcp/tools/monitor-start.ts +3 -3
- package/src/mcp/tools/monitor-stop.ts +3 -3
- package/src/mcp/tools/precision-live.ts +158 -0
- package/src/mcp/tools/precision-match.ts +3 -0
- package/src/mcp/tools/precision-paths.ts +59 -0
- package/src/mcp/tools/precision-show.ts +86 -0
- package/src/mcp/tools/precision-visibility.ts +44 -0
- package/src/mcp/tools/precision-warp.ts +90 -0
- package/src/mcp/tools/precision.ts +19 -310
- package/src/mcp/tools/read-range.ts +12 -5
- package/src/mcp/tools/run-capture.ts +2 -2
- package/src/mcp/tools/safe-read.ts +21 -10
- package/src/mcp/tools/since.ts +7 -3
- package/src/mcp/tools/state.ts +8 -7
- package/src/mcp/tools/stats.ts +3 -3
- package/src/mcp/tools/workspace-authorizations.ts +3 -3
- package/src/mcp/tools/workspace-authorize.ts +3 -3
- package/src/mcp/tools/workspace-bind.ts +3 -3
- package/src/mcp/tools/workspace-rebind.ts +3 -3
- package/src/mcp/tools/workspace-revoke.ts +3 -3
- package/src/mcp/tools/workspace-status.ts +3 -3
- package/src/mcp/warp-pool.ts +6 -6
- package/src/mcp/workspace-read-observation-model.ts +48 -0
- package/src/mcp/workspace-read-observation.ts +103 -0
- package/src/mcp/workspace-router-capability.ts +32 -0
- package/src/mcp/workspace-router-history.ts +233 -0
- package/src/mcp/workspace-router-model.ts +131 -0
- package/src/mcp/workspace-router-resolution.ts +71 -0
- package/src/mcp/workspace-router-runtime.ts +243 -0
- package/src/mcp/workspace-router.ts +151 -454
- package/src/metrics/logger.ts +22 -51
- package/src/metrics/types.ts +32 -4
- package/src/operations/cached-file.ts +40 -0
- package/src/operations/diff-identity.ts +127 -0
- package/src/operations/file-outline.ts +1 -1
- package/src/operations/graft-diff.ts +0 -1
- package/src/operations/observation-cache.ts +149 -0
- package/src/operations/read-range.ts +0 -1
- package/src/operations/repo-workspace.ts +339 -0
- package/src/operations/result-dto.ts +23 -0
- package/src/operations/safe-read.ts +3 -4
- package/src/operations/state.ts +42 -6
- package/src/operations/structured-buffer-compare.ts +429 -0
- package/src/operations/structured-buffer-model.ts +456 -0
- package/src/operations/structured-buffer-query.ts +794 -0
- package/src/operations/structured-buffer.ts +181 -0
- package/src/parser/diff.ts +172 -1
- package/src/parser/lang.ts +58 -15
- package/src/parser/markdown.ts +197 -0
- package/src/parser/outline.ts +8 -208
- package/src/parser/runtime.ts +71 -0
- package/src/policy/evaluate.ts +2 -2
- package/src/policy/types.ts +9 -9
- package/src/ports/guards.ts +68 -0
- package/src/ports/warp.ts +55 -0
- package/src/session/tracker.ts +7 -7
- package/src/session/types.ts +4 -1
- package/src/warp/identity-resolver.ts +35 -0
- package/src/warp/indexer-git.ts +182 -0
- package/src/warp/indexer-graph.ts +276 -0
- package/src/warp/indexer-model.ts +69 -0
- package/src/warp/indexer.ts +122 -449
- package/src/warp/observers.ts +7 -12
- package/src/warp/open.ts +66 -4
- package/src/warp/symbol-identity.ts +100 -0
- package/docs/ADVANCED_GUIDE.md +0 -49
- package/docs/GUIDE.md +0 -677
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import * as crypto from "node:crypto";
|
|
2
|
+
import * as fs from "node:fs/promises";
|
|
3
|
+
import * as http from "node:http";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
6
|
+
import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
7
|
+
import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
|
|
8
|
+
import { createGraftServer, type GraftServer } from "./server.js";
|
|
9
|
+
import type { DaemonControlPlane, DaemonStatusView } from "./daemon-control-plane.js";
|
|
10
|
+
import type { DaemonJobScheduler } from "./daemon-job-scheduler.js";
|
|
11
|
+
import type { ChildProcessDaemonWorkerPool } from "./daemon-worker-pool.js";
|
|
12
|
+
import type { PersistentMonitorRuntime } from "./persistent-monitor-runtime.js";
|
|
13
|
+
import type { RunCaptureConfig } from "./run-capture-config.js";
|
|
14
|
+
import type { RuntimeObservabilityState } from "./runtime-observability.js";
|
|
15
|
+
import type { WarpPool } from "./warp-pool.js";
|
|
16
|
+
import { ensurePrivateDirectory } from "./daemon-bootstrap.js";
|
|
17
|
+
|
|
18
|
+
const MAX_BODY_BYTES = 1024 * 1024;
|
|
19
|
+
|
|
20
|
+
interface DaemonSession {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly graftDir: string;
|
|
23
|
+
readonly transport: StreamableHTTPServerTransport;
|
|
24
|
+
readonly server: GraftServer;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface CreateDaemonSessionHostOptions {
|
|
28
|
+
readonly graftDir: string;
|
|
29
|
+
readonly socketPath: string;
|
|
30
|
+
readonly transportKind: "unix_socket" | "named_pipe";
|
|
31
|
+
readonly healthPath: string;
|
|
32
|
+
readonly mcpPath: string;
|
|
33
|
+
readonly startedAt: string;
|
|
34
|
+
readonly warpPool: WarpPool;
|
|
35
|
+
readonly controlPlane: DaemonControlPlane;
|
|
36
|
+
readonly daemonScheduler: DaemonJobScheduler;
|
|
37
|
+
readonly daemonWorkerPool: ChildProcessDaemonWorkerPool;
|
|
38
|
+
readonly monitorRuntime: PersistentMonitorRuntime;
|
|
39
|
+
readonly getHealthStatus: () => DaemonStatusView;
|
|
40
|
+
readonly env?: Readonly<Record<string, string | undefined>> | undefined;
|
|
41
|
+
readonly runCapture?: Partial<RunCaptureConfig> | undefined;
|
|
42
|
+
readonly runtimeObservability?: Partial<RuntimeObservabilityState> | undefined;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface DaemonSessionHost {
|
|
46
|
+
handleRequest(req: http.IncomingMessage, res: http.ServerResponse): Promise<void>;
|
|
47
|
+
close(): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function getHeader(req: http.IncomingMessage, name: string): string | undefined {
|
|
51
|
+
const value = req.headers[name];
|
|
52
|
+
return Array.isArray(value) ? value[0] : value;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async function readJsonBody(req: http.IncomingMessage): Promise<unknown> {
|
|
56
|
+
const chunks: Buffer[] = [];
|
|
57
|
+
let total = 0;
|
|
58
|
+
for await (const chunk of req as AsyncIterable<Buffer | string>) {
|
|
59
|
+
const buffer = typeof chunk === "string" ? Buffer.from(chunk, "utf-8") : chunk;
|
|
60
|
+
total += buffer.length;
|
|
61
|
+
if (total > MAX_BODY_BYTES) {
|
|
62
|
+
throw new Error(`Request body exceeds ${String(MAX_BODY_BYTES)} bytes`);
|
|
63
|
+
}
|
|
64
|
+
chunks.push(buffer);
|
|
65
|
+
}
|
|
66
|
+
if (chunks.length === 0) return undefined;
|
|
67
|
+
return JSON.parse(Buffer.concat(chunks).toString("utf-8")) as unknown;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function sendJson(res: http.ServerResponse, statusCode: number, body: Record<string, unknown>): void {
|
|
71
|
+
if (res.headersSent) return;
|
|
72
|
+
res.writeHead(statusCode, { "content-type": "application/json" });
|
|
73
|
+
res.end(JSON.stringify(body));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function sendJsonRpcError(res: http.ServerResponse, code: number, message: string): void {
|
|
77
|
+
sendJson(res, code === -32700 ? 400 : 500, {
|
|
78
|
+
jsonrpc: "2.0",
|
|
79
|
+
error: { code, message },
|
|
80
|
+
id: null,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function removeSessionDirectory(sessionGraftDir: string): Promise<void> {
|
|
85
|
+
try {
|
|
86
|
+
await fs.rm(sessionGraftDir, { recursive: true, force: true });
|
|
87
|
+
} catch (error: unknown) {
|
|
88
|
+
const code = error instanceof Error && "code" in error ? (error as NodeJS.ErrnoException).code : undefined;
|
|
89
|
+
if (code !== "ENOENT") {
|
|
90
|
+
console.error(`[graft] failed to remove session directory ${sessionGraftDir}: ${String(error)}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async function createDaemonSession(
|
|
96
|
+
newSessionId: string,
|
|
97
|
+
options: CreateDaemonSessionHostOptions,
|
|
98
|
+
sessions: Map<string, DaemonSession>,
|
|
99
|
+
): Promise<DaemonSession> {
|
|
100
|
+
const sessionGraftDir = path.join(options.graftDir, "sessions", newSessionId);
|
|
101
|
+
await ensurePrivateDirectory(sessionGraftDir);
|
|
102
|
+
const transport = new StreamableHTTPServerTransport({
|
|
103
|
+
sessionIdGenerator: () => newSessionId,
|
|
104
|
+
});
|
|
105
|
+
const server = createGraftServer({
|
|
106
|
+
mode: "daemon",
|
|
107
|
+
sessionId: newSessionId,
|
|
108
|
+
graftDir: sessionGraftDir,
|
|
109
|
+
warpPool: options.warpPool,
|
|
110
|
+
daemonControlPlane: options.controlPlane,
|
|
111
|
+
daemonScheduler: options.daemonScheduler,
|
|
112
|
+
daemonWorkerPool: options.daemonWorkerPool,
|
|
113
|
+
daemonRuntime: () => ({
|
|
114
|
+
transport: options.transportKind,
|
|
115
|
+
sameUserOnly: true,
|
|
116
|
+
socketPath: options.socketPath,
|
|
117
|
+
mcpPath: options.mcpPath,
|
|
118
|
+
healthPath: options.healthPath,
|
|
119
|
+
activeWarpRepos: options.warpPool.size(),
|
|
120
|
+
startedAt: options.startedAt,
|
|
121
|
+
}),
|
|
122
|
+
monitorRuntime: options.monitorRuntime,
|
|
123
|
+
...(options.env !== undefined ? { env: options.env } : {}),
|
|
124
|
+
...(options.runCapture !== undefined ? { runCapture: options.runCapture } : {}),
|
|
125
|
+
...(options.runtimeObservability !== undefined
|
|
126
|
+
? { runtimeObservability: options.runtimeObservability }
|
|
127
|
+
: {}),
|
|
128
|
+
});
|
|
129
|
+
const session: DaemonSession = {
|
|
130
|
+
id: newSessionId,
|
|
131
|
+
graftDir: sessionGraftDir,
|
|
132
|
+
transport,
|
|
133
|
+
server,
|
|
134
|
+
};
|
|
135
|
+
transport.onclose = () => {
|
|
136
|
+
sessions.delete(newSessionId);
|
|
137
|
+
options.controlPlane.unregisterTransport(newSessionId);
|
|
138
|
+
void removeSessionDirectory(sessionGraftDir);
|
|
139
|
+
};
|
|
140
|
+
transport.onerror = () => {
|
|
141
|
+
sessions.delete(newSessionId);
|
|
142
|
+
options.controlPlane.unregisterTransport(newSessionId);
|
|
143
|
+
void removeSessionDirectory(sessionGraftDir);
|
|
144
|
+
};
|
|
145
|
+
sessions.set(newSessionId, session);
|
|
146
|
+
options.controlPlane.registerTransport(
|
|
147
|
+
newSessionId,
|
|
148
|
+
() => server.getWorkspaceStatus(),
|
|
149
|
+
() => server.getRuntimeCausalContext(),
|
|
150
|
+
);
|
|
151
|
+
await server.getMcpServer().connect(transport as Transport);
|
|
152
|
+
return session;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function createDaemonSessionHost(options: CreateDaemonSessionHostOptions): DaemonSessionHost {
|
|
156
|
+
const sessions = new Map<string, DaemonSession>();
|
|
157
|
+
|
|
158
|
+
return {
|
|
159
|
+
async handleRequest(req, res): Promise<void> {
|
|
160
|
+
try {
|
|
161
|
+
const url = new URL(req.url ?? "/", "http://localhost");
|
|
162
|
+
if (req.method === "GET" && url.pathname === options.healthPath) {
|
|
163
|
+
sendJson(res, 200, { ...options.getHealthStatus() });
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (url.pathname !== options.mcpPath) {
|
|
168
|
+
sendJson(res, 404, { error: "Not found" });
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const sessionId = getHeader(req, "mcp-session-id");
|
|
173
|
+
|
|
174
|
+
if (req.method === "POST") {
|
|
175
|
+
const parsedBody = await readJsonBody(req);
|
|
176
|
+
let session = sessionId !== undefined ? sessions.get(sessionId) : undefined;
|
|
177
|
+
if (session === undefined) {
|
|
178
|
+
if (sessionId !== undefined) {
|
|
179
|
+
sendJsonRpcError(res, -32000, `Unknown MCP session: ${sessionId}`);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
if (!isInitializeRequest(parsedBody)) {
|
|
183
|
+
sendJsonRpcError(res, -32000, "Initialization requests must start a daemon session");
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
session = await createDaemonSession(crypto.randomUUID(), options, sessions);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
options.controlPlane.touchTransport(session.id);
|
|
190
|
+
await session.transport.handleRequest(req, res, parsedBody);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (req.method === "GET" || req.method === "DELETE") {
|
|
195
|
+
if (sessionId === undefined) {
|
|
196
|
+
sendJson(res, 400, { error: "Missing MCP session header" });
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const session = sessions.get(sessionId);
|
|
200
|
+
if (session === undefined) {
|
|
201
|
+
sendJson(res, 404, { error: `Unknown MCP session: ${sessionId}` });
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
options.controlPlane.touchTransport(session.id);
|
|
205
|
+
await session.transport.handleRequest(req, res);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
sendJson(res, 405, { error: "Method not allowed" });
|
|
210
|
+
} catch (error) {
|
|
211
|
+
if (error instanceof SyntaxError) {
|
|
212
|
+
sendJsonRpcError(res, -32700, "Invalid JSON");
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
sendJsonRpcError(res, -32603, error instanceof Error ? error.message : String(error));
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
async close(): Promise<void> {
|
|
220
|
+
for (const session of [...sessions.values()]) {
|
|
221
|
+
options.controlPlane.unregisterTransport(session.id);
|
|
222
|
+
await session.transport.close().catch(() => {
|
|
223
|
+
return undefined;
|
|
224
|
+
});
|
|
225
|
+
await removeSessionDirectory(session.graftDir);
|
|
226
|
+
}
|
|
227
|
+
sessions.clear();
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import * as http from "node:http";
|
|
2
|
+
import { spawn, type ChildProcess } from "node:child_process";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { dirname, resolve } from "node:path";
|
|
5
|
+
import { Readable } from "node:stream";
|
|
6
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
7
|
+
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
8
|
+
import {
|
|
9
|
+
isInitializeRequest,
|
|
10
|
+
isJSONRPCRequest,
|
|
11
|
+
type JSONRPCMessage,
|
|
12
|
+
type JSONRPCRequest,
|
|
13
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
14
|
+
import { defaultDaemonRoot, resolveSocketPath } from "./daemon-bootstrap.js";
|
|
15
|
+
|
|
16
|
+
const DEFAULT_READY_TIMEOUT_MS = 5_000;
|
|
17
|
+
const DEFAULT_POLL_INTERVAL_MS = 100;
|
|
18
|
+
const MCP_PATH = "/mcp";
|
|
19
|
+
const HEALTH_PATH = "/healthz";
|
|
20
|
+
|
|
21
|
+
function toNodeHeaders(headers: Headers): http.OutgoingHttpHeaders {
|
|
22
|
+
const outgoing: http.OutgoingHttpHeaders = {};
|
|
23
|
+
for (const [name, value] of headers.entries()) {
|
|
24
|
+
outgoing[name] = value;
|
|
25
|
+
}
|
|
26
|
+
return outgoing;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function toResponseHeaders(headers: http.IncomingHttpHeaders): Headers {
|
|
30
|
+
const responseHeaders = new Headers();
|
|
31
|
+
for (const [name, value] of Object.entries(headers)) {
|
|
32
|
+
if (value === undefined) continue;
|
|
33
|
+
if (Array.isArray(value)) {
|
|
34
|
+
for (const item of value) {
|
|
35
|
+
responseHeaders.append(name, item);
|
|
36
|
+
}
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
responseHeaders.append(name, value);
|
|
40
|
+
}
|
|
41
|
+
return responseHeaders;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function createLocalSocketFetch(socketPath: string): typeof fetch {
|
|
45
|
+
return async (input: string | URL | Request, init?: RequestInit): Promise<Response> => {
|
|
46
|
+
const request = input instanceof Request ? input : new Request(input, init);
|
|
47
|
+
const url = new URL(request.url);
|
|
48
|
+
const body = request.body === null ? undefined : Buffer.from(await request.arrayBuffer());
|
|
49
|
+
|
|
50
|
+
return await new Promise<Response>((resolvePromise, reject) => {
|
|
51
|
+
const req = http.request({
|
|
52
|
+
socketPath,
|
|
53
|
+
path: `${url.pathname}${url.search}`,
|
|
54
|
+
method: request.method,
|
|
55
|
+
headers: toNodeHeaders(request.headers),
|
|
56
|
+
signal: request.signal,
|
|
57
|
+
}, (res) => {
|
|
58
|
+
const bodyStream = Readable.toWeb(res) as ReadableStream<Uint8Array>;
|
|
59
|
+
resolvePromise(new Response(bodyStream, {
|
|
60
|
+
status: res.statusCode ?? 0,
|
|
61
|
+
statusText: res.statusMessage ?? "",
|
|
62
|
+
headers: toResponseHeaders(res.headers),
|
|
63
|
+
}));
|
|
64
|
+
});
|
|
65
|
+
req.once("error", reject);
|
|
66
|
+
if (body !== undefined && body.byteLength > 0) {
|
|
67
|
+
req.write(body);
|
|
68
|
+
}
|
|
69
|
+
req.end();
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function isDaemonHealthy(socketPath: string): Promise<boolean> {
|
|
75
|
+
try {
|
|
76
|
+
const response = await createLocalSocketFetch(socketPath)(
|
|
77
|
+
new URL(`http://graft${HEALTH_PATH}`),
|
|
78
|
+
{
|
|
79
|
+
method: "GET",
|
|
80
|
+
headers: {
|
|
81
|
+
accept: "application/json",
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
);
|
|
85
|
+
await response.arrayBuffer();
|
|
86
|
+
return response.ok;
|
|
87
|
+
} catch {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function resolveGraftBinPath(): string {
|
|
93
|
+
return resolve(dirname(fileURLToPath(import.meta.url)), "../../bin/graft.js");
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function spawnDaemonProcess(socketPath: string): ChildProcess {
|
|
97
|
+
const child = spawn(
|
|
98
|
+
process.execPath,
|
|
99
|
+
[resolveGraftBinPath(), "daemon", "--socket", socketPath],
|
|
100
|
+
{
|
|
101
|
+
detached: true,
|
|
102
|
+
stdio: ["ignore", "ignore", "ignore"],
|
|
103
|
+
windowsHide: true,
|
|
104
|
+
env: { ...process.env },
|
|
105
|
+
},
|
|
106
|
+
);
|
|
107
|
+
child.unref();
|
|
108
|
+
return child;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function delay(ms: number): Promise<void> {
|
|
112
|
+
return new Promise((resolvePromise) => {
|
|
113
|
+
setTimeout(resolvePromise, ms);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface EnsureDaemonReadyOptions {
|
|
118
|
+
socketPath?: string;
|
|
119
|
+
timeoutMs?: number;
|
|
120
|
+
pollIntervalMs?: number;
|
|
121
|
+
spawnIfMissing?: boolean;
|
|
122
|
+
spawnDaemon?: ((socketPath: string) => ChildProcess | undefined) | undefined;
|
|
123
|
+
healthCheck?: ((socketPath: string) => Promise<boolean>) | undefined;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export async function ensureDaemonReady(options: EnsureDaemonReadyOptions = {}): Promise<string> {
|
|
127
|
+
const socketPath = resolveSocketPath(options.socketPath, defaultDaemonRoot());
|
|
128
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_READY_TIMEOUT_MS;
|
|
129
|
+
const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
130
|
+
const healthCheck = options.healthCheck ?? isDaemonHealthy;
|
|
131
|
+
|
|
132
|
+
if (await healthCheck(socketPath)) {
|
|
133
|
+
return socketPath;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (options.spawnIfMissing === false) {
|
|
137
|
+
throw new Error(
|
|
138
|
+
`No graft daemon is listening on ${socketPath}. Start it with \`graft daemon --socket ${socketPath}\` or use repo-local \`graft serve\`.`,
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
let spawnError: unknown;
|
|
143
|
+
try {
|
|
144
|
+
(options.spawnDaemon ?? spawnDaemonProcess)(socketPath);
|
|
145
|
+
} catch (error) {
|
|
146
|
+
spawnError = error;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const deadline = Date.now() + timeoutMs;
|
|
150
|
+
while (Date.now() <= deadline) {
|
|
151
|
+
if (await healthCheck(socketPath)) {
|
|
152
|
+
return socketPath;
|
|
153
|
+
}
|
|
154
|
+
await delay(pollIntervalMs);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const suffix = spawnError instanceof Error
|
|
158
|
+
? ` Auto-start failed: ${spawnError.message}`
|
|
159
|
+
: "";
|
|
160
|
+
throw new Error(`Timed out waiting for graft daemon readiness on ${socketPath}.${suffix}`);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function internalErrorResponse(
|
|
164
|
+
message: JSONRPCRequest,
|
|
165
|
+
error: unknown,
|
|
166
|
+
): JSONRPCMessage {
|
|
167
|
+
return {
|
|
168
|
+
jsonrpc: "2.0",
|
|
169
|
+
id: message.id,
|
|
170
|
+
error: {
|
|
171
|
+
code: -32603,
|
|
172
|
+
message: error instanceof Error ? error.message : String(error),
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface StartDaemonBackedStdioBridgeOptions {
|
|
178
|
+
socketPath?: string;
|
|
179
|
+
ensureReady?: ((options?: EnsureDaemonReadyOptions) => Promise<string>) | undefined;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export async function startDaemonBackedStdioBridge(
|
|
183
|
+
options: StartDaemonBackedStdioBridgeOptions = {},
|
|
184
|
+
): Promise<void> {
|
|
185
|
+
const socketPath = await (options.ensureReady ?? ensureDaemonReady)({
|
|
186
|
+
...(options.socketPath !== undefined ? { socketPath: options.socketPath } : {}),
|
|
187
|
+
});
|
|
188
|
+
const stdioTransport = new StdioServerTransport();
|
|
189
|
+
const daemonTransport = new StreamableHTTPClientTransport(
|
|
190
|
+
new URL(`http://graft${MCP_PATH}`),
|
|
191
|
+
{ fetch: createLocalSocketFetch(socketPath) },
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
let closed = false;
|
|
195
|
+
const close = async (): Promise<void> => {
|
|
196
|
+
if (closed) return;
|
|
197
|
+
closed = true;
|
|
198
|
+
process.stdin.off("end", onStdinEnd);
|
|
199
|
+
process.stdin.off("close", onStdinEnd);
|
|
200
|
+
process.off("SIGINT", onSignal);
|
|
201
|
+
process.off("SIGTERM", onSignal);
|
|
202
|
+
await daemonTransport.terminateSession().catch(() => {
|
|
203
|
+
return undefined;
|
|
204
|
+
});
|
|
205
|
+
await daemonTransport.close().catch(() => {
|
|
206
|
+
return undefined;
|
|
207
|
+
});
|
|
208
|
+
await stdioTransport.close().catch(() => {
|
|
209
|
+
return undefined;
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const onSignal = (): void => {
|
|
214
|
+
void close().finally(() => {
|
|
215
|
+
process.exitCode = process.exitCode ?? 0;
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
const onStdinEnd = (): void => {
|
|
219
|
+
void close();
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
stdioTransport.onmessage = (message): void => {
|
|
223
|
+
if (isInitializeRequest(message)) {
|
|
224
|
+
daemonTransport.setProtocolVersion(message.params.protocolVersion);
|
|
225
|
+
}
|
|
226
|
+
void daemonTransport.send(message).catch(async (error: unknown) => {
|
|
227
|
+
if (!isJSONRPCRequest(message)) {
|
|
228
|
+
console.error(error);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
await stdioTransport.send(internalErrorResponse(message, error)).catch(() => {
|
|
232
|
+
return undefined;
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
};
|
|
236
|
+
stdioTransport.onerror = (error): void => {
|
|
237
|
+
console.error(error);
|
|
238
|
+
void close();
|
|
239
|
+
};
|
|
240
|
+
daemonTransport.onmessage = (message): void => {
|
|
241
|
+
void stdioTransport.send(message).catch((error: unknown) => {
|
|
242
|
+
console.error(error);
|
|
243
|
+
void close();
|
|
244
|
+
});
|
|
245
|
+
};
|
|
246
|
+
daemonTransport.onerror = (error): void => {
|
|
247
|
+
console.error(error);
|
|
248
|
+
};
|
|
249
|
+
daemonTransport.onclose = (): void => {
|
|
250
|
+
void close();
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
process.stdin.on("end", onStdinEnd);
|
|
254
|
+
process.stdin.on("close", onStdinEnd);
|
|
255
|
+
process.once("SIGINT", onSignal);
|
|
256
|
+
process.once("SIGTERM", onSignal);
|
|
257
|
+
|
|
258
|
+
await daemonTransport.start();
|
|
259
|
+
await stdioTransport.start();
|
|
260
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import * as crypto from "node:crypto";
|
|
2
|
+
import { fork, type ChildProcess } from "node:child_process";
|
|
3
|
+
import * as os from "node:os";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import type { MonitorTickWorkerJob, MonitorTickWorkerResult } from "./monitor-tick-job.js";
|
|
6
|
+
import type { RepoToolWorkerJob, RepoToolWorkerResult } from "./repo-tool-job.js";
|
|
7
|
+
import type {
|
|
8
|
+
ActiveWorkerTask,
|
|
9
|
+
ChildProcessDaemonWorkerPoolOptions,
|
|
10
|
+
DaemonWorkerCounts,
|
|
11
|
+
DaemonWorkerPool,
|
|
12
|
+
QueuedWorkerTask,
|
|
13
|
+
WorkerMessage,
|
|
14
|
+
WorkerState,
|
|
15
|
+
} from "./daemon-worker-types.js";
|
|
16
|
+
|
|
17
|
+
function defaultProcessPoolSize(): number {
|
|
18
|
+
const parallelism = os.availableParallelism();
|
|
19
|
+
return Math.max(1, Math.min(4, parallelism > 1 ? parallelism - 1 : 1));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function normalizeProcessPoolSize(value: number | undefined): number {
|
|
23
|
+
if (value === undefined) return defaultProcessPoolSize();
|
|
24
|
+
const normalized = Math.trunc(value);
|
|
25
|
+
if (!Number.isFinite(normalized) || normalized <= 0) {
|
|
26
|
+
throw new Error("worker pool size must be a positive integer");
|
|
27
|
+
}
|
|
28
|
+
return normalized;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function daemonWorkerProcessPath(): string {
|
|
32
|
+
return fileURLToPath(new URL("./daemon-worker-process.ts", import.meta.url));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function stopChild(child: ChildProcess): Promise<void> {
|
|
36
|
+
if (child.exitCode !== null || child.signalCode !== null) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
child.kill();
|
|
40
|
+
await new Promise<void>((resolve) => {
|
|
41
|
+
child.once("exit", () => {
|
|
42
|
+
resolve();
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export class ChildProcessDaemonWorkerPool implements DaemonWorkerPool {
|
|
48
|
+
private readonly size: number;
|
|
49
|
+
private readonly workers = new Map<string, WorkerState>();
|
|
50
|
+
private readonly queue: QueuedWorkerTask[] = [];
|
|
51
|
+
private completedTasks = 0;
|
|
52
|
+
private failedTasks = 0;
|
|
53
|
+
private closing = false;
|
|
54
|
+
|
|
55
|
+
constructor(options: ChildProcessDaemonWorkerPoolOptions = {}) {
|
|
56
|
+
this.size = normalizeProcessPoolSize(options.size);
|
|
57
|
+
for (let index = 0; index < this.size; index++) {
|
|
58
|
+
this.spawnWorker();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
getCounts(): DaemonWorkerCounts {
|
|
63
|
+
const busyWorkers = [...this.workers.values()].filter((workerState) => workerState.task !== null).length;
|
|
64
|
+
return {
|
|
65
|
+
mode: "child_processes",
|
|
66
|
+
totalWorkers: this.workers.size,
|
|
67
|
+
busyWorkers,
|
|
68
|
+
idleWorkers: this.workers.size - busyWorkers,
|
|
69
|
+
queuedTasks: this.queue.length,
|
|
70
|
+
completedTasks: this.completedTasks,
|
|
71
|
+
failedTasks: this.failedTasks,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
runMonitorTick(job: MonitorTickWorkerJob): Promise<MonitorTickWorkerResult> {
|
|
76
|
+
if (this.closing) {
|
|
77
|
+
return Promise.reject(new Error("daemon worker pool is closing"));
|
|
78
|
+
}
|
|
79
|
+
return new Promise<MonitorTickWorkerResult>((resolve, reject) => {
|
|
80
|
+
this.queue.push({
|
|
81
|
+
requestId: crypto.randomUUID(),
|
|
82
|
+
kind: "monitor_tick",
|
|
83
|
+
job,
|
|
84
|
+
resolve,
|
|
85
|
+
reject,
|
|
86
|
+
});
|
|
87
|
+
this.dispatch();
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
runRepoTool(job: RepoToolWorkerJob): Promise<RepoToolWorkerResult> {
|
|
92
|
+
if (this.closing) {
|
|
93
|
+
return Promise.reject(new Error("daemon worker pool is closing"));
|
|
94
|
+
}
|
|
95
|
+
return new Promise<RepoToolWorkerResult>((resolve, reject) => {
|
|
96
|
+
this.queue.push({
|
|
97
|
+
requestId: crypto.randomUUID(),
|
|
98
|
+
kind: "repo_tool",
|
|
99
|
+
job,
|
|
100
|
+
resolve,
|
|
101
|
+
reject,
|
|
102
|
+
});
|
|
103
|
+
this.dispatch();
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async close(): Promise<void> {
|
|
108
|
+
if (this.closing) return;
|
|
109
|
+
this.closing = true;
|
|
110
|
+
const pending = [...this.queue];
|
|
111
|
+
this.queue.length = 0;
|
|
112
|
+
for (const task of pending) {
|
|
113
|
+
task.reject(new Error("daemon worker pool closed before task execution"));
|
|
114
|
+
}
|
|
115
|
+
const active = [...this.workers.values()].flatMap((workerState) => {
|
|
116
|
+
return workerState.task === null ? [] : [workerState.task];
|
|
117
|
+
});
|
|
118
|
+
for (const task of active) {
|
|
119
|
+
task.reject(new Error("daemon worker pool closed during task execution"));
|
|
120
|
+
}
|
|
121
|
+
await Promise.all([...this.workers.values()].map(async (workerState) => {
|
|
122
|
+
await stopChild(workerState.child);
|
|
123
|
+
}));
|
|
124
|
+
this.workers.clear();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
private spawnWorker(): void {
|
|
128
|
+
const workerId = crypto.randomUUID();
|
|
129
|
+
const child = fork(daemonWorkerProcessPath(), [], {
|
|
130
|
+
cwd: process.cwd(),
|
|
131
|
+
execArgv: ["--import", "tsx"],
|
|
132
|
+
stdio: ["ignore", "ignore", "ignore", "ipc"],
|
|
133
|
+
});
|
|
134
|
+
const workerState: WorkerState = {
|
|
135
|
+
workerId,
|
|
136
|
+
child,
|
|
137
|
+
task: null,
|
|
138
|
+
};
|
|
139
|
+
child.on("message", (message: WorkerMessage) => {
|
|
140
|
+
this.handleWorkerMessage(workerState, message);
|
|
141
|
+
});
|
|
142
|
+
child.on("error", (error: Error) => {
|
|
143
|
+
this.handleWorkerFailure(workerState, error);
|
|
144
|
+
});
|
|
145
|
+
child.on("exit", (code) => {
|
|
146
|
+
this.handleWorkerExit(workerState, code ?? 0);
|
|
147
|
+
});
|
|
148
|
+
this.workers.set(workerId, workerState);
|
|
149
|
+
this.dispatch();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
private dispatch(): void {
|
|
153
|
+
for (const workerState of this.workers.values()) {
|
|
154
|
+
if (workerState.task !== null) continue;
|
|
155
|
+
const next = this.queue.shift();
|
|
156
|
+
if (next === undefined) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const activeTask: ActiveWorkerTask = {
|
|
160
|
+
...next,
|
|
161
|
+
workerId: workerState.workerId,
|
|
162
|
+
};
|
|
163
|
+
workerState.task = activeTask;
|
|
164
|
+
workerState.child.send({
|
|
165
|
+
requestId: activeTask.requestId,
|
|
166
|
+
kind: activeTask.kind,
|
|
167
|
+
job: activeTask.job,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
private handleWorkerMessage(workerState: WorkerState, message: WorkerMessage): void {
|
|
173
|
+
const task = workerState.task;
|
|
174
|
+
if (task?.requestId !== message.requestId) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
workerState.task = null;
|
|
178
|
+
if (message.ok) {
|
|
179
|
+
this.completedTasks++;
|
|
180
|
+
if (task.kind === "monitor_tick") {
|
|
181
|
+
task.resolve(message.result as MonitorTickWorkerResult);
|
|
182
|
+
} else {
|
|
183
|
+
task.resolve(message.result as RepoToolWorkerResult);
|
|
184
|
+
}
|
|
185
|
+
} else {
|
|
186
|
+
this.failedTasks++;
|
|
187
|
+
task.reject(new Error(message.error));
|
|
188
|
+
}
|
|
189
|
+
this.dispatch();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
private handleWorkerFailure(workerState: WorkerState, error: Error): void {
|
|
193
|
+
const task = workerState.task;
|
|
194
|
+
workerState.task = null;
|
|
195
|
+
if (task !== null) {
|
|
196
|
+
this.failedTasks++;
|
|
197
|
+
task.reject(error);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
private handleWorkerExit(workerState: WorkerState, code: number): void {
|
|
202
|
+
const task = workerState.task;
|
|
203
|
+
workerState.task = null;
|
|
204
|
+
this.workers.delete(workerState.workerId);
|
|
205
|
+
if (task !== null) {
|
|
206
|
+
this.failedTasks++;
|
|
207
|
+
task.reject(new Error(`daemon worker exited with code ${String(code)}`));
|
|
208
|
+
}
|
|
209
|
+
if (!this.closing) {
|
|
210
|
+
this.spawnWorker();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|