@flyingrobots/graft 0.7.0 → 0.8.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/CHANGELOG.md +153 -0
- package/README.md +33 -17
- package/bin/graft.js +26 -26
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +2 -0
- package/dist/api/index.js.map +1 -1
- package/dist/cli/cli-error.d.ts.map +1 -1
- package/dist/cli/cli-error.js +22 -3
- package/dist/cli/cli-error.js.map +1 -1
- package/dist/cli/command-parser.d.ts.map +1 -1
- package/dist/cli/command-parser.js +62 -6
- package/dist/cli/command-parser.js.map +1 -1
- package/dist/cli/dead-symbols-render.d.ts +2 -0
- package/dist/cli/dead-symbols-render.d.ts.map +1 -0
- package/dist/cli/dead-symbols-render.js +23 -0
- package/dist/cli/dead-symbols-render.js.map +1 -0
- package/dist/cli/doctor-render.d.ts +2 -0
- package/dist/cli/doctor-render.d.ts.map +1 -0
- package/dist/cli/doctor-render.js +80 -0
- package/dist/cli/doctor-render.js.map +1 -0
- package/dist/cli/entrypoint.d.ts +1 -0
- package/dist/cli/entrypoint.d.ts.map +1 -1
- package/dist/cli/entrypoint.js +1 -0
- package/dist/cli/entrypoint.js.map +1 -1
- package/dist/cli/git-graft-enhance-model.d.ts +33 -3
- package/dist/cli/git-graft-enhance-model.d.ts.map +1 -1
- package/dist/cli/git-graft-enhance-model.js +38 -0
- package/dist/cli/git-graft-enhance-model.js.map +1 -1
- package/dist/cli/git-graft-enhance-render.d.ts.map +1 -1
- package/dist/cli/git-graft-enhance-render.js +13 -0
- package/dist/cli/git-graft-enhance-render.js.map +1 -1
- package/dist/cli/git-graft-enhance.d.ts.map +1 -1
- package/dist/cli/git-graft-enhance.js +44 -1
- package/dist/cli/git-graft-enhance.js.map +1 -1
- package/dist/cli/index-cmd.d.ts +1 -0
- package/dist/cli/index-cmd.d.ts.map +1 -1
- package/dist/cli/index-cmd.js +3 -0
- package/dist/cli/index-cmd.js.map +1 -1
- package/dist/cli/init-client-config.d.ts.map +1 -1
- package/dist/cli/init-client-config.js +40 -4
- package/dist/cli/init-client-config.js.map +1 -1
- package/dist/cli/init-model.js +2 -2
- package/dist/cli/init-model.js.map +1 -1
- package/dist/cli/json-document.d.ts +1 -0
- package/dist/cli/json-document.d.ts.map +1 -1
- package/dist/cli/json-document.js +3 -0
- package/dist/cli/json-document.js.map +1 -1
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +24 -2
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/peer-command.d.ts.map +1 -1
- package/dist/cli/peer-command.js +25 -0
- package/dist/cli/peer-command.js.map +1 -1
- package/dist/cli/review-cooldown.d.ts +15 -0
- package/dist/cli/review-cooldown.d.ts.map +1 -0
- package/dist/cli/review-cooldown.js +136 -0
- package/dist/cli/review-cooldown.js.map +1 -0
- package/dist/cli/structural-blame-render.d.ts +2 -0
- package/dist/cli/structural-blame-render.d.ts.map +1 -0
- package/dist/cli/structural-blame-render.js +39 -0
- package/dist/cli/structural-blame-render.js.map +1 -0
- package/dist/cli/structural-review-render.d.ts +2 -0
- package/dist/cli/structural-review-render.d.ts.map +1 -0
- package/dist/cli/structural-review-render.js +56 -0
- package/dist/cli/structural-review-render.js.map +1 -0
- package/dist/cli/structural-test-coverage-render.d.ts +2 -0
- package/dist/cli/structural-test-coverage-render.d.ts.map +1 -0
- package/dist/cli/structural-test-coverage-render.js +46 -0
- package/dist/cli/structural-test-coverage-render.js.map +1 -0
- package/dist/contracts/capabilities.d.ts +9 -6
- package/dist/contracts/capabilities.d.ts.map +1 -1
- package/dist/contracts/capabilities.js +40 -1
- package/dist/contracts/capabilities.js.map +1 -1
- package/dist/contracts/causal-ontology.d.ts +17 -17
- package/dist/contracts/output-schema-cli.d.ts +103 -41
- package/dist/contracts/output-schema-cli.d.ts.map +1 -1
- package/dist/contracts/output-schema-cli.js +29 -0
- package/dist/contracts/output-schema-cli.js.map +1 -1
- package/dist/contracts/output-schema-fragments.d.ts +76 -76
- package/dist/contracts/output-schema-mcp.d.ts +87 -62
- package/dist/contracts/output-schema-mcp.d.ts.map +1 -1
- package/dist/contracts/output-schema-mcp.js +43 -21
- package/dist/contracts/output-schema-mcp.js.map +1 -1
- package/dist/contracts/output-schema-meta.d.ts +2 -2
- package/dist/contracts/output-schema-meta.d.ts.map +1 -1
- package/dist/contracts/output-schemas.d.ts +7 -7
- package/dist/contracts/output-schemas.d.ts.map +1 -1
- package/dist/contracts/output-schemas.js +69 -1
- package/dist/contracts/output-schemas.js.map +1 -1
- package/dist/git/version-guard.d.ts +17 -0
- package/dist/git/version-guard.d.ts.map +1 -0
- package/dist/git/version-guard.js +51 -0
- package/dist/git/version-guard.js.map +1 -0
- package/dist/hooks/posttooluse-read.js +3 -3
- package/dist/hooks/posttooluse-read.js.map +1 -1
- package/dist/hooks/pretooluse-read.js +1 -1
- package/dist/hooks/pretooluse-read.js.map +1 -1
- package/dist/mcp/burden.d.ts.map +1 -1
- package/dist/mcp/burden.js +2 -0
- package/dist/mcp/burden.js.map +1 -1
- package/dist/mcp/daemon-server.d.ts.map +1 -1
- package/dist/mcp/daemon-server.js +2 -0
- package/dist/mcp/daemon-server.js.map +1 -1
- package/dist/mcp/daemon-worker-child-pool.d.ts +2 -0
- package/dist/mcp/daemon-worker-child-pool.d.ts.map +1 -1
- package/dist/mcp/daemon-worker-child-pool.js +10 -3
- package/dist/mcp/daemon-worker-child-pool.js.map +1 -1
- package/dist/mcp/daemon-worker-pool.d.ts +1 -1
- package/dist/mcp/daemon-worker-pool.d.ts.map +1 -1
- package/dist/mcp/daemon-worker-pool.js +1 -1
- package/dist/mcp/daemon-worker-pool.js.map +1 -1
- package/dist/mcp/persisted-local-history-graph.d.ts.map +1 -1
- package/dist/mcp/persisted-local-history-graph.js +2 -1
- package/dist/mcp/persisted-local-history-graph.js.map +1 -1
- package/dist/mcp/persisted-local-history.d.ts +5 -5
- package/dist/mcp/repo-tool-job.d.ts.map +1 -1
- package/dist/mcp/repo-tool-job.js +2 -0
- package/dist/mcp/repo-tool-job.js.map +1 -1
- package/dist/mcp/server-invocation.d.ts.map +1 -1
- package/dist/mcp/server-invocation.js +206 -147
- package/dist/mcp/server-invocation.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +184 -116
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/stdio-server.d.ts.map +1 -1
- package/dist/mcp/stdio-server.js +2 -0
- package/dist/mcp/stdio-server.js.map +1 -1
- package/dist/mcp/tool-registry.d.ts.map +1 -1
- package/dist/mcp/tool-registry.js +4 -0
- package/dist/mcp/tool-registry.js.map +1 -1
- package/dist/mcp/tools/changed-since.d.ts.map +1 -1
- package/dist/mcp/tools/changed-since.js +10 -3
- package/dist/mcp/tools/changed-since.js.map +1 -1
- package/dist/mcp/tools/dead-symbols.d.ts +3 -0
- package/dist/mcp/tools/dead-symbols.d.ts.map +1 -0
- package/dist/mcp/tools/dead-symbols.js +33 -0
- package/dist/mcp/tools/dead-symbols.js.map +1 -0
- package/dist/mcp/tools/map.d.ts.map +1 -1
- package/dist/mcp/tools/map.js +2 -0
- package/dist/mcp/tools/map.js.map +1 -1
- package/dist/mcp/tools/precision-warp.d.ts.map +1 -1
- package/dist/mcp/tools/precision-warp.js +2 -6
- package/dist/mcp/tools/precision-warp.js.map +1 -1
- package/dist/mcp/tools/refactor-difficulty.d.ts.map +1 -1
- package/dist/mcp/tools/refactor-difficulty.js +2 -0
- package/dist/mcp/tools/refactor-difficulty.js.map +1 -1
- package/dist/mcp/tools/safe-read.d.ts.map +1 -1
- package/dist/mcp/tools/safe-read.js +10 -105
- package/dist/mcp/tools/safe-read.js.map +1 -1
- package/dist/mcp/tools/structural-test-coverage.d.ts +3 -0
- package/dist/mcp/tools/structural-test-coverage.d.ts.map +1 -0
- package/dist/mcp/tools/structural-test-coverage.js +35 -0
- package/dist/mcp/tools/structural-test-coverage.js.map +1 -0
- package/dist/operations/cached-file.d.ts +6 -2
- package/dist/operations/cached-file.d.ts.map +1 -1
- package/dist/operations/cached-file.js +30 -6
- package/dist/operations/cached-file.js.map +1 -1
- package/dist/operations/export-surface-diff.d.ts.map +1 -1
- package/dist/operations/export-surface-diff.js +2 -0
- package/dist/operations/export-surface-diff.js.map +1 -1
- package/dist/operations/file-outline.js +2 -2
- package/dist/operations/file-outline.js.map +1 -1
- package/dist/operations/graft-diff.d.ts.map +1 -1
- package/dist/operations/graft-diff.js +2 -0
- package/dist/operations/graft-diff.js.map +1 -1
- package/dist/operations/projection-safety.d.ts.map +1 -1
- package/dist/operations/projection-safety.js +2 -0
- package/dist/operations/projection-safety.js.map +1 -1
- package/dist/operations/repo-workspace.d.ts.map +1 -1
- package/dist/operations/repo-workspace.js +26 -8
- package/dist/operations/repo-workspace.js.map +1 -1
- package/dist/operations/review-cooldown-status.d.ts +27 -0
- package/dist/operations/review-cooldown-status.d.ts.map +1 -0
- package/dist/operations/review-cooldown-status.js +115 -0
- package/dist/operations/review-cooldown-status.js.map +1 -0
- package/dist/operations/safe-read.js +2 -2
- package/dist/operations/safe-read.js.map +1 -1
- package/dist/operations/sludge-detector.d.ts.map +1 -1
- package/dist/operations/sludge-detector.js +2 -1
- package/dist/operations/sludge-detector.js.map +1 -1
- package/dist/operations/structural-review.js +8 -8
- package/dist/operations/structural-review.js.map +1 -1
- package/dist/operations/structural-test-coverage-map.d.ts +44 -0
- package/dist/operations/structural-test-coverage-map.d.ts.map +1 -0
- package/dist/operations/structural-test-coverage-map.js +331 -0
- package/dist/operations/structural-test-coverage-map.js.map +1 -0
- package/dist/operations/structured-buffer-compare.d.ts.map +1 -1
- package/dist/operations/structured-buffer-compare.js +4 -1
- package/dist/operations/structured-buffer-compare.js.map +1 -1
- package/dist/operations/structured-buffer-model.d.ts +15 -13
- package/dist/operations/structured-buffer-model.d.ts.map +1 -1
- package/dist/operations/structured-buffer-model.js +24 -5
- package/dist/operations/structured-buffer-model.js.map +1 -1
- package/dist/operations/structured-buffer-query.d.ts.map +1 -1
- package/dist/operations/structured-buffer-query.js +21 -12
- package/dist/operations/structured-buffer-query.js.map +1 -1
- package/dist/parser/extractors/common.d.ts +16 -0
- package/dist/parser/extractors/common.d.ts.map +1 -0
- package/dist/parser/extractors/common.js +23 -0
- package/dist/parser/extractors/common.js.map +1 -0
- package/dist/parser/extractors/go.d.ts +18 -0
- package/dist/parser/extractors/go.d.ts.map +1 -0
- package/dist/parser/extractors/go.js +200 -0
- package/dist/parser/extractors/go.js.map +1 -0
- package/dist/parser/extractors/graphql.d.ts +26 -0
- package/dist/parser/extractors/graphql.d.ts.map +1 -0
- package/dist/parser/extractors/graphql.js +239 -0
- package/dist/parser/extractors/graphql.js.map +1 -0
- package/dist/parser/extractors/index.d.ts +4 -0
- package/dist/parser/extractors/index.d.ts.map +1 -0
- package/dist/parser/extractors/index.js +26 -0
- package/dist/parser/extractors/index.js.map +1 -0
- package/dist/parser/extractors/json.d.ts +10 -0
- package/dist/parser/extractors/json.d.ts.map +1 -0
- package/dist/parser/extractors/json.js +75 -0
- package/dist/parser/extractors/json.js.map +1 -0
- package/dist/parser/extractors/python.d.ts +16 -0
- package/dist/parser/extractors/python.d.ts.map +1 -0
- package/dist/parser/extractors/python.js +145 -0
- package/dist/parser/extractors/python.js.map +1 -0
- package/dist/parser/extractors/rust.d.ts +12 -0
- package/dist/parser/extractors/rust.d.ts.map +1 -0
- package/dist/parser/extractors/rust.js +122 -0
- package/dist/parser/extractors/rust.js.map +1 -0
- package/dist/parser/extractors/toml.d.ts +10 -0
- package/dist/parser/extractors/toml.d.ts.map +1 -0
- package/dist/parser/extractors/toml.js +74 -0
- package/dist/parser/extractors/toml.js.map +1 -0
- package/dist/parser/extractors/typescript.d.ts +13 -0
- package/dist/parser/extractors/typescript.d.ts.map +1 -0
- package/dist/parser/extractors/typescript.js +179 -0
- package/dist/parser/extractors/typescript.js.map +1 -0
- package/dist/parser/extractors/yaml.d.ts +13 -0
- package/dist/parser/extractors/yaml.d.ts.map +1 -0
- package/dist/parser/extractors/yaml.js +93 -0
- package/dist/parser/extractors/yaml.js.map +1 -0
- package/dist/parser/lang.d.ts +2 -2
- package/dist/parser/lang.d.ts.map +1 -1
- package/dist/parser/lang.js +19 -1
- package/dist/parser/lang.js.map +1 -1
- package/dist/parser/outline.d.ts +4 -0
- package/dist/parser/outline.d.ts.map +1 -1
- package/dist/parser/outline.js +32 -221
- package/dist/parser/outline.js.map +1 -1
- package/dist/parser/runtime.d.ts +7 -0
- package/dist/parser/runtime.d.ts.map +1 -1
- package/dist/parser/runtime.js +99 -10
- package/dist/parser/runtime.js.map +1 -1
- package/dist/parser/types.d.ts +1 -1
- package/dist/parser/types.d.ts.map +1 -1
- package/dist/parser/types.js.map +1 -1
- package/dist/ports/provenance-timeline.d.ts +10 -0
- package/dist/ports/provenance-timeline.d.ts.map +1 -0
- package/dist/ports/provenance-timeline.js +17 -0
- package/dist/ports/provenance-timeline.js.map +1 -0
- package/dist/ports/semantic-enrichment.d.ts +47 -0
- package/dist/ports/semantic-enrichment.d.ts.map +1 -0
- package/dist/ports/semantic-enrichment.js +2 -0
- package/dist/ports/semantic-enrichment.js.map +1 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +3 -1
- package/dist/version.js.map +1 -1
- package/dist/warp/ast-import-resolver.d.ts.map +1 -1
- package/dist/warp/ast-import-resolver.js +2 -1
- package/dist/warp/ast-import-resolver.js.map +1 -1
- package/dist/warp/dead-symbols.d.ts.map +1 -1
- package/dist/warp/dead-symbols.js +4 -7
- package/dist/warp/dead-symbols.js.map +1 -1
- package/dist/warp/index-head.d.ts +4 -0
- package/dist/warp/index-head.d.ts.map +1 -1
- package/dist/warp/index-head.js +255 -22
- package/dist/warp/index-head.js.map +1 -1
- package/dist/warp/observers.d.ts.map +1 -1
- package/dist/warp/observers.js +3 -2
- package/dist/warp/observers.js.map +1 -1
- package/dist/warp/refactor-difficulty.d.ts.map +1 -1
- package/dist/warp/refactor-difficulty.js +4 -9
- package/dist/warp/refactor-difficulty.js.map +1 -1
- package/dist/warp/references.d.ts.map +1 -1
- package/dist/warp/references.js +2 -1
- package/dist/warp/references.js.map +1 -1
- package/dist/warp/semantic-enrichment.d.ts +14 -0
- package/dist/warp/semantic-enrichment.d.ts.map +1 -0
- package/dist/warp/semantic-enrichment.js +55 -0
- package/dist/warp/semantic-enrichment.js.map +1 -0
- package/dist/warp/structural-queries.d.ts.map +1 -1
- package/dist/warp/structural-queries.js +7 -14
- package/dist/warp/structural-queries.js.map +1 -1
- package/dist/warp/sym-id-codec.d.ts +14 -0
- package/dist/warp/sym-id-codec.d.ts.map +1 -0
- package/dist/warp/sym-id-codec.js +47 -0
- package/dist/warp/sym-id-codec.js.map +1 -0
- package/dist/warp/symbol-timeline.d.ts.map +1 -1
- package/dist/warp/symbol-timeline.js +6 -14
- package/dist/warp/symbol-timeline.js.map +1 -1
- package/dist/warp/warp-structural-churn.d.ts.map +1 -1
- package/dist/warp/warp-structural-churn.js +6 -10
- package/dist/warp/warp-structural-churn.js.map +1 -1
- package/dist/warp/warp-structural-log.d.ts.map +1 -1
- package/dist/warp/warp-structural-log.js +8 -10
- package/dist/warp/warp-structural-log.js.map +1 -1
- package/docs/CLI.md +63 -5
- package/docs/MCP.md +2 -1
- package/docs/SETUP.md +11 -7
- package/package.json +12 -4
- package/src/adapters/canonical-json.ts +0 -56
- package/src/adapters/json-text-decoder.ts +0 -11
- package/src/adapters/node-fs.ts +0 -43
- package/src/adapters/node-git.ts +0 -47
- package/src/adapters/node-paths.ts +0 -35
- package/src/adapters/node-process-runner.ts +0 -27
- package/src/adapters/repo-paths.ts +0 -63
- package/src/adapters/rotating-ndjson-log.ts +0 -66
- package/src/api/index.ts +0 -107
- package/src/api/repo-local-graft.ts +0 -21
- package/src/api/repo-workspace.ts +0 -34
- package/src/api/tool-bridge.ts +0 -22
- package/src/cli/activity-render.ts +0 -112
- package/src/cli/cli-error.ts +0 -192
- package/src/cli/command-parser.ts +0 -484
- package/src/cli/daemon-status-model.ts +0 -238
- package/src/cli/daemon-status-render.ts +0 -102
- package/src/cli/daemon-status.ts +0 -100
- package/src/cli/entrypoint.ts +0 -18
- package/src/cli/git-graft-enhance-model.ts +0 -131
- package/src/cli/git-graft-enhance-render.ts +0 -33
- package/src/cli/git-graft-enhance.ts +0 -54
- package/src/cli/index-cmd.ts +0 -90
- package/src/cli/index-model.ts +0 -75
- package/src/cli/init-bootstrap.ts +0 -47
- package/src/cli/init-client-config.ts +0 -428
- package/src/cli/init-model.ts +0 -284
- package/src/cli/init-render.ts +0 -54
- package/src/cli/init-target-hooks.ts +0 -93
- package/src/cli/init.ts +0 -124
- package/src/cli/json-document.ts +0 -155
- package/src/cli/local-history-dag-model.ts +0 -437
- package/src/cli/local-history-dag-render.ts +0 -133
- package/src/cli/local-history-dag.ts +0 -103
- package/src/cli/main.ts +0 -197
- package/src/cli/migrate-local-history.ts +0 -119
- package/src/cli/peer-command.ts +0 -60
- package/src/contracts/capabilities.ts +0 -540
- package/src/contracts/causal-ontology.ts +0 -627
- package/src/contracts/causal-surface-next-action.ts +0 -18
- package/src/contracts/json-object.ts +0 -18
- package/src/contracts/mcp-runtime.ts +0 -16
- package/src/contracts/output-schema-cli.ts +0 -103
- package/src/contracts/output-schema-fragments.ts +0 -881
- package/src/contracts/output-schema-mcp.ts +0 -501
- package/src/contracts/output-schema-meta.ts +0 -119
- package/src/contracts/output-schemas.ts +0 -1524
- package/src/git/diff.ts +0 -161
- package/src/git/target-git-hook-bootstrap.ts +0 -56
- package/src/guards/stream-boundary.ts +0 -110
- package/src/hooks/posttooluse-read.ts +0 -54
- package/src/hooks/pretooluse-read.ts +0 -52
- package/src/hooks/read-governor.ts +0 -95
- package/src/hooks/read-messages.ts +0 -53
- package/src/hooks/shared.ts +0 -168
- package/src/index.ts +0 -1
- package/src/mcp/burden.ts +0 -132
- package/src/mcp/cache.ts +0 -7
- package/src/mcp/cached-file.ts +0 -1
- package/src/mcp/context.ts +0 -150
- package/src/mcp/control-plane/authz-storage.ts +0 -129
- package/src/mcp/control-plane/session-registry.ts +0 -115
- package/src/mcp/control-plane/status-projection.ts +0 -76
- package/src/mcp/control-plane/types.ts +0 -144
- package/src/mcp/daemon-bootstrap.ts +0 -100
- package/src/mcp/daemon-control-plane.ts +0 -310
- package/src/mcp/daemon-job-scheduler.ts +0 -279
- package/src/mcp/daemon-repos.ts +0 -99
- package/src/mcp/daemon-server.ts +0 -172
- package/src/mcp/daemon-session-host.ts +0 -234
- package/src/mcp/daemon-stdio-bridge.ts +0 -262
- package/src/mcp/daemon-worker-child-pool.ts +0 -213
- package/src/mcp/daemon-worker-inline-pool.ts +0 -46
- package/src/mcp/daemon-worker-pool.ts +0 -7
- package/src/mcp/daemon-worker-process.ts +0 -52
- package/src/mcp/daemon-worker-types.ts +0 -66
- package/src/mcp/metrics.ts +0 -176
- package/src/mcp/monitor-health.ts +0 -83
- package/src/mcp/monitor-persistence.ts +0 -54
- package/src/mcp/monitor-tick-job.ts +0 -153
- package/src/mcp/monitor-types.ts +0 -103
- package/src/mcp/persisted-local-history-graph.ts +0 -592
- package/src/mcp/persisted-local-history-policy.ts +0 -501
- package/src/mcp/persisted-local-history-views.ts +0 -250
- package/src/mcp/persisted-local-history.ts +0 -1621
- package/src/mcp/persistent-monitor-runtime.ts +0 -482
- package/src/mcp/policy.ts +0 -75
- package/src/mcp/receipt.ts +0 -201
- package/src/mcp/repo-concurrency.ts +0 -392
- package/src/mcp/repo-overview/filter.ts +0 -44
- package/src/mcp/repo-overview/types.ts +0 -63
- package/src/mcp/repo-overview/view-projection.ts +0 -90
- package/src/mcp/repo-state-git.ts +0 -247
- package/src/mcp/repo-state-observation.ts +0 -203
- package/src/mcp/repo-state-transition.ts +0 -151
- package/src/mcp/repo-state-types.ts +0 -107
- package/src/mcp/repo-state.ts +0 -146
- package/src/mcp/repo-tool-job.ts +0 -102
- package/src/mcp/repo-tool-worker-context.ts +0 -215
- package/src/mcp/repo-workspace.ts +0 -21
- package/src/mcp/run-capture-config.ts +0 -33
- package/src/mcp/runtime-causal-context.ts +0 -72
- package/src/mcp/runtime-observability.ts +0 -217
- package/src/mcp/runtime-staged-target.ts +0 -161
- package/src/mcp/runtime-workspace-overlay.ts +0 -255
- package/src/mcp/secret-scrub.ts +0 -89
- package/src/mcp/semantic-transition-guidance.ts +0 -60
- package/src/mcp/semantic-transition-summary.ts +0 -130
- package/src/mcp/server-context.ts +0 -236
- package/src/mcp/server-invocation.ts +0 -388
- package/src/mcp/server-tool-access.ts +0 -148
- package/src/mcp/server.ts +0 -270
- package/src/mcp/stdio-server.ts +0 -26
- package/src/mcp/stdio.ts +0 -3
- package/src/mcp/tool-registry.ts +0 -98
- package/src/mcp/tools/activity-view.ts +0 -325
- package/src/mcp/tools/budget.ts +0 -23
- package/src/mcp/tools/causal-attach.ts +0 -67
- package/src/mcp/tools/causal-status.ts +0 -58
- package/src/mcp/tools/changed-since.ts +0 -71
- package/src/mcp/tools/code-find.ts +0 -192
- package/src/mcp/tools/code-refs.ts +0 -470
- package/src/mcp/tools/code-show.ts +0 -289
- package/src/mcp/tools/daemon-monitors.ts +0 -14
- package/src/mcp/tools/daemon-repos.ts +0 -22
- package/src/mcp/tools/daemon-sessions.ts +0 -14
- package/src/mcp/tools/daemon-status.ts +0 -12
- package/src/mcp/tools/diagnostic-models.ts +0 -97
- package/src/mcp/tools/doctor.ts +0 -83
- package/src/mcp/tools/explain.ts +0 -84
- package/src/mcp/tools/export-surface-diff.ts +0 -26
- package/src/mcp/tools/file-outline.ts +0 -67
- package/src/mcp/tools/git-files.ts +0 -73
- package/src/mcp/tools/graft-diff.ts +0 -35
- package/src/mcp/tools/graft-edit.ts +0 -276
- package/src/mcp/tools/knowledge-map.ts +0 -34
- package/src/mcp/tools/map-collector.ts +0 -338
- package/src/mcp/tools/map.ts +0 -185
- package/src/mcp/tools/monitor-nudge.ts +0 -19
- package/src/mcp/tools/monitor-pause.ts +0 -18
- package/src/mcp/tools/monitor-resume.ts +0 -18
- package/src/mcp/tools/monitor-start.ts +0 -20
- package/src/mcp/tools/monitor-stop.ts +0 -18
- package/src/mcp/tools/precision-live.ts +0 -158
- package/src/mcp/tools/precision-match.ts +0 -54
- package/src/mcp/tools/precision-paths.ts +0 -59
- package/src/mcp/tools/precision-query.ts +0 -127
- package/src/mcp/tools/precision-show.ts +0 -86
- package/src/mcp/tools/precision-visibility.ts +0 -44
- package/src/mcp/tools/precision-warp.ts +0 -101
- package/src/mcp/tools/precision.ts +0 -21
- package/src/mcp/tools/read-range.ts +0 -28
- package/src/mcp/tools/refactor-difficulty.ts +0 -42
- package/src/mcp/tools/run-capture.ts +0 -149
- package/src/mcp/tools/safe-read.ts +0 -148
- package/src/mcp/tools/since.ts +0 -53
- package/src/mcp/tools/state.ts +0 -39
- package/src/mcp/tools/stats.ts +0 -24
- package/src/mcp/tools/structural-blame.ts +0 -55
- package/src/mcp/tools/structural-churn.ts +0 -28
- package/src/mcp/tools/structural-log.ts +0 -41
- package/src/mcp/tools/structural-review.ts +0 -63
- package/src/mcp/tools/workspace-authorizations.ts +0 -14
- package/src/mcp/tools/workspace-authorize.ts +0 -20
- package/src/mcp/tools/workspace-bind.ts +0 -25
- package/src/mcp/tools/workspace-rebind.ts +0 -25
- package/src/mcp/tools/workspace-revoke.ts +0 -18
- package/src/mcp/tools/workspace-status.ts +0 -12
- package/src/mcp/warp-pool.ts +0 -36
- package/src/mcp/workspace-read-observation-model.ts +0 -48
- package/src/mcp/workspace-read-observation.ts +0 -103
- package/src/mcp/workspace-router-capability.ts +0 -32
- package/src/mcp/workspace-router-history.ts +0 -233
- package/src/mcp/workspace-router-model.ts +0 -131
- package/src/mcp/workspace-router-resolution.ts +0 -71
- package/src/mcp/workspace-router-runtime.ts +0 -246
- package/src/mcp/workspace-router.ts +0 -688
- package/src/metrics/logger.ts +0 -40
- package/src/metrics/types.ts +0 -40
- package/src/operations/adaptive-projection.ts +0 -54
- package/src/operations/agent-handoff.ts +0 -59
- package/src/operations/cached-file.ts +0 -40
- package/src/operations/capture-range.ts +0 -64
- package/src/operations/conversation-primer.ts +0 -82
- package/src/operations/cross-session-resume.ts +0 -104
- package/src/operations/deterministic-replay.ts +0 -143
- package/src/operations/diff-identity.ts +0 -127
- package/src/operations/export-surface-diff.ts +0 -355
- package/src/operations/file-outline.ts +0 -48
- package/src/operations/footprint-parallelism.ts +0 -98
- package/src/operations/graft-diff.ts +0 -169
- package/src/operations/horizon-of-readability.ts +0 -60
- package/src/operations/import-reference-impact.ts +0 -143
- package/src/operations/knowledge-map.ts +0 -96
- package/src/operations/observation-cache.ts +0 -165
- package/src/operations/projection-safety.ts +0 -111
- package/src/operations/read-range.ts +0 -64
- package/src/operations/repo-workspace.ts +0 -339
- package/src/operations/result-dto.ts +0 -23
- package/src/operations/safe-read.ts +0 -118
- package/src/operations/semantic-drift.ts +0 -70
- package/src/operations/session-filtration.ts +0 -76
- package/src/operations/session-replay.ts +0 -73
- package/src/operations/sludge-detector.ts +0 -356
- package/src/operations/state.ts +0 -66
- package/src/operations/structural-blame.ts +0 -197
- package/src/operations/structural-review.ts +0 -317
- package/src/operations/structured-buffer-compare.ts +0 -429
- package/src/operations/structured-buffer-model.ts +0 -456
- package/src/operations/structured-buffer-query.ts +0 -794
- package/src/operations/structured-buffer.ts +0 -181
- package/src/operations/teaching-hints.ts +0 -52
- package/src/parser/diff.ts +0 -320
- package/src/parser/lang.ts +0 -71
- package/src/parser/markdown.ts +0 -197
- package/src/parser/outline.ts +0 -316
- package/src/parser/runtime.ts +0 -71
- package/src/parser/types.ts +0 -75
- package/src/policy/evaluate.ts +0 -178
- package/src/policy/graftignore.ts +0 -6
- package/src/policy/types.ts +0 -87
- package/src/ports/codec.ts +0 -13
- package/src/ports/filesystem.ts +0 -18
- package/src/ports/git.ts +0 -16
- package/src/ports/guards.ts +0 -68
- package/src/ports/paths.ts +0 -22
- package/src/ports/process-runner.ts +0 -22
- package/src/release/security-gate.ts +0 -102
- package/src/session/tracker.ts +0 -145
- package/src/session/types.ts +0 -23
- package/src/version.ts +0 -3
- package/src/warp/ast-emitter.ts +0 -133
- package/src/warp/ast-import-resolver.ts +0 -333
- package/src/warp/commit-meta.ts +0 -19
- package/src/warp/context.ts +0 -48
- package/src/warp/dead-symbols.ts +0 -174
- package/src/warp/drift-sentinel.ts +0 -101
- package/src/warp/index-head.ts +0 -348
- package/src/warp/observers.ts +0 -101
- package/src/warp/open.ts +0 -67
- package/src/warp/outline-diff-trailer.ts +0 -100
- package/src/warp/plumbing.d.ts +0 -24
- package/src/warp/refactor-difficulty.ts +0 -257
- package/src/warp/references.ts +0 -77
- package/src/warp/stale-docs.ts +0 -210
- package/src/warp/structural-drift-detection.ts +0 -97
- package/src/warp/structural-queries.ts +0 -258
- package/src/warp/symbol-timeline.ts +0 -209
- package/src/warp/traverse-hydrate.ts +0 -61
- package/src/warp/warp-reference-count.ts +0 -47
- package/src/warp/warp-structural-blame.ts +0 -65
- package/src/warp/warp-structural-churn.ts +0 -309
- package/src/warp/warp-structural-log.ts +0 -149
- package/src/warp/writer-id.ts +0 -30
|
@@ -1,1524 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import {
|
|
3
|
-
CLI_COMMAND_NAMES,
|
|
4
|
-
type CliCommandName,
|
|
5
|
-
CLI_COMMAND_TO_MCP_TOOL,
|
|
6
|
-
MCP_TOOL_NAMES,
|
|
7
|
-
type McpToolName,
|
|
8
|
-
} from "./capabilities.js";
|
|
9
|
-
import {
|
|
10
|
-
attributionSummarySchema,
|
|
11
|
-
attributionConfidenceSchema,
|
|
12
|
-
evidenceSchema,
|
|
13
|
-
readEventSchema,
|
|
14
|
-
localHistoryContinuityOperationSchema,
|
|
15
|
-
repoConcurrencyAuthoritySchema,
|
|
16
|
-
repoConcurrencyPostureSchema,
|
|
17
|
-
stageEventSchema,
|
|
18
|
-
transitionEventSchema,
|
|
19
|
-
stagedTargetSchema,
|
|
20
|
-
} from "./causal-ontology.js";
|
|
21
|
-
import { causalSurfaceNextActionSchema } from "./causal-surface-next-action.js";
|
|
22
|
-
|
|
23
|
-
export { CLI_COMMAND_NAMES, MCP_TOOL_NAMES };
|
|
24
|
-
export type { CliCommandName, McpToolName } from "./capabilities.js";
|
|
25
|
-
|
|
26
|
-
export const OUTPUT_SCHEMA_VERSION = "1.0.0" as const;
|
|
27
|
-
|
|
28
|
-
export interface OutputSchemaMeta {
|
|
29
|
-
readonly id: string;
|
|
30
|
-
readonly version: typeof OUTPUT_SCHEMA_VERSION;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const mcpOutputSchemaMeta = Object.freeze(Object.fromEntries(
|
|
34
|
-
MCP_TOOL_NAMES.map((tool) => [tool, Object.freeze({
|
|
35
|
-
id: `graft.mcp.${tool}`,
|
|
36
|
-
version: OUTPUT_SCHEMA_VERSION,
|
|
37
|
-
})]),
|
|
38
|
-
) as Record<McpToolName, OutputSchemaMeta>);
|
|
39
|
-
|
|
40
|
-
const cliOutputSchemaMeta = Object.freeze(Object.fromEntries(
|
|
41
|
-
CLI_COMMAND_NAMES.map((command) => [command, Object.freeze({
|
|
42
|
-
id: `graft.cli.${command}`,
|
|
43
|
-
version: OUTPUT_SCHEMA_VERSION,
|
|
44
|
-
})]),
|
|
45
|
-
) as Record<CliCommandName, OutputSchemaMeta>);
|
|
46
|
-
|
|
47
|
-
function schemaMetaLiteral(meta: OutputSchemaMeta) {
|
|
48
|
-
return z.object({
|
|
49
|
-
id: z.literal(meta.id),
|
|
50
|
-
version: z.literal(meta.version),
|
|
51
|
-
}).strict();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const sessionDepthSchema = z.enum(["early", "mid", "late", "unknown"]);
|
|
55
|
-
const worldlineLayerSchema = z.enum(["commit_worldline", "ref_view", "workspace_overlay"]);
|
|
56
|
-
const repoTransitionKindSchema = z.enum(["checkout", "reset", "merge", "rebase"]);
|
|
57
|
-
|
|
58
|
-
const actualSchema = z.object({
|
|
59
|
-
lines: z.number().int().nonnegative(),
|
|
60
|
-
bytes: z.number().int().nonnegative(),
|
|
61
|
-
}).strict();
|
|
62
|
-
|
|
63
|
-
const thresholdsSchema = z.object({
|
|
64
|
-
lines: z.number().int().nonnegative(),
|
|
65
|
-
bytes: z.number().int().nonnegative(),
|
|
66
|
-
}).strict();
|
|
67
|
-
|
|
68
|
-
const budgetSchema = z.object({
|
|
69
|
-
total: z.number().int().positive(),
|
|
70
|
-
consumed: z.number().int().nonnegative(),
|
|
71
|
-
remaining: z.number().int().nonnegative(),
|
|
72
|
-
fraction: z.number(),
|
|
73
|
-
}).strict();
|
|
74
|
-
|
|
75
|
-
const tripwireSchema = z.object({
|
|
76
|
-
_brand: z.literal("Tripwire").optional(),
|
|
77
|
-
signal: z.string(),
|
|
78
|
-
recommendation: z.string(),
|
|
79
|
-
}).strict();
|
|
80
|
-
|
|
81
|
-
const graftEditReasonSchema = z.enum([
|
|
82
|
-
"NOT_FOUND",
|
|
83
|
-
"OLD_STRING_NOT_FOUND",
|
|
84
|
-
"OLD_STRING_AMBIGUOUS",
|
|
85
|
-
"BINARY",
|
|
86
|
-
"LOCKFILE",
|
|
87
|
-
"MINIFIED",
|
|
88
|
-
"BUILD_OUTPUT",
|
|
89
|
-
"SECRET",
|
|
90
|
-
"GRAFTIGNORE",
|
|
91
|
-
]);
|
|
92
|
-
|
|
93
|
-
const graftEditDriftWarningSchema = z.object({
|
|
94
|
-
kind: z.literal("structural_pattern_reintroduced"),
|
|
95
|
-
severity: z.literal("advisory"),
|
|
96
|
-
pattern: z.literal("jsdoc_typedef"),
|
|
97
|
-
basis: z.literal("session_local_graft_edit"),
|
|
98
|
-
message: z.string(),
|
|
99
|
-
current: z.object({
|
|
100
|
-
path: z.string(),
|
|
101
|
-
direction: z.literal("added"),
|
|
102
|
-
}).strict(),
|
|
103
|
-
previous: z.object({
|
|
104
|
-
path: z.string(),
|
|
105
|
-
direction: z.literal("removed"),
|
|
106
|
-
}).strict(),
|
|
107
|
-
}).strict();
|
|
108
|
-
|
|
109
|
-
const outlineEntrySchema: z.ZodType = z.lazy(() => z.object({
|
|
110
|
-
_brand: z.literal("OutlineEntry").optional(),
|
|
111
|
-
kind: z.string(),
|
|
112
|
-
name: z.string(),
|
|
113
|
-
signature: z.string().optional(),
|
|
114
|
-
exported: z.boolean(),
|
|
115
|
-
children: z.array(outlineEntrySchema).optional(),
|
|
116
|
-
}).strict());
|
|
117
|
-
|
|
118
|
-
const jumpEntrySchema = z.object({
|
|
119
|
-
_brand: z.literal("JumpEntry").optional(),
|
|
120
|
-
symbol: z.string(),
|
|
121
|
-
kind: z.string(),
|
|
122
|
-
start: z.number().int().positive(),
|
|
123
|
-
end: z.number().int().positive(),
|
|
124
|
-
}).strict();
|
|
125
|
-
|
|
126
|
-
const diffContinuitySchema = z.object({
|
|
127
|
-
_brand: z.literal("DiffContinuity").optional(),
|
|
128
|
-
kind: z.enum(["rename"]),
|
|
129
|
-
confidence: z.enum(["likely"]),
|
|
130
|
-
basis: z.enum(["matching_signature_shape", "matching_child_structure"]),
|
|
131
|
-
symbolKind: z.string(),
|
|
132
|
-
oldName: z.string(),
|
|
133
|
-
newName: z.string(),
|
|
134
|
-
oldSignature: z.string().optional(),
|
|
135
|
-
newSignature: z.string().optional(),
|
|
136
|
-
}).strict();
|
|
137
|
-
|
|
138
|
-
const outlineDiffSchema: z.ZodType = z.lazy(() => z.object({
|
|
139
|
-
_brand: z.literal("OutlineDiff").optional(),
|
|
140
|
-
added: z.array(diffEntrySchema),
|
|
141
|
-
removed: z.array(diffEntrySchema),
|
|
142
|
-
changed: z.array(diffEntrySchema),
|
|
143
|
-
continuity: z.array(diffContinuitySchema),
|
|
144
|
-
unchangedCount: z.number().int().nonnegative(),
|
|
145
|
-
}).strict());
|
|
146
|
-
|
|
147
|
-
const diffEntrySchema: z.ZodType = z.lazy(() => z.object({
|
|
148
|
-
_brand: z.literal("DiffEntry").optional(),
|
|
149
|
-
name: z.string(),
|
|
150
|
-
kind: z.string(),
|
|
151
|
-
exported: z.boolean().optional(),
|
|
152
|
-
signature: z.string().optional(),
|
|
153
|
-
oldSignature: z.string().optional(),
|
|
154
|
-
childDiff: outlineDiffSchema.optional(),
|
|
155
|
-
identityId: z.string().optional(),
|
|
156
|
-
}).strict());
|
|
157
|
-
|
|
158
|
-
const burdenKindSchema = z.enum(["read", "search", "shell", "state", "diagnostic"]);
|
|
159
|
-
|
|
160
|
-
const burdenBucketSchema = z.object({
|
|
161
|
-
calls: z.number().int().nonnegative(),
|
|
162
|
-
bytesReturned: z.number().int().nonnegative(),
|
|
163
|
-
}).strict();
|
|
164
|
-
|
|
165
|
-
const burdenByKindSchema = z.object({
|
|
166
|
-
read: burdenBucketSchema,
|
|
167
|
-
search: burdenBucketSchema,
|
|
168
|
-
shell: burdenBucketSchema,
|
|
169
|
-
state: burdenBucketSchema,
|
|
170
|
-
diagnostic: burdenBucketSchema,
|
|
171
|
-
}).strict();
|
|
172
|
-
|
|
173
|
-
const sludgeSignalSchema = z.object({
|
|
174
|
-
kind: z.enum([
|
|
175
|
-
"phantom_shape",
|
|
176
|
-
"cast_density",
|
|
177
|
-
"homeless_constructor",
|
|
178
|
-
"free_function_data_behavior",
|
|
179
|
-
"god_file",
|
|
180
|
-
]),
|
|
181
|
-
severity: z.enum(["low", "medium", "high"]),
|
|
182
|
-
message: z.string(),
|
|
183
|
-
line: z.number().int().positive().optional(),
|
|
184
|
-
symbol: z.string().optional(),
|
|
185
|
-
evidence: z.string(),
|
|
186
|
-
}).strict();
|
|
187
|
-
|
|
188
|
-
const sludgeFileReportSchema = z.object({
|
|
189
|
-
path: z.string(),
|
|
190
|
-
score: z.number().int().nonnegative(),
|
|
191
|
-
metrics: z.object({
|
|
192
|
-
typedefCount: z.number().int().nonnegative(),
|
|
193
|
-
typeCastCount: z.number().int().nonnegative(),
|
|
194
|
-
classCount: z.number().int().nonnegative(),
|
|
195
|
-
functionCount: z.number().int().nonnegative(),
|
|
196
|
-
symbolCount: z.number().int().nonnegative(),
|
|
197
|
-
homelessConstructorCount: z.number().int().nonnegative(),
|
|
198
|
-
freeFunctionDataBehaviorCount: z.number().int().nonnegative(),
|
|
199
|
-
}).strict(),
|
|
200
|
-
signals: z.array(sludgeSignalSchema),
|
|
201
|
-
}).strict();
|
|
202
|
-
|
|
203
|
-
const sludgeReportSchema = z.object({
|
|
204
|
-
scannedFiles: z.number().int().nonnegative(),
|
|
205
|
-
filesWithSignals: z.number().int().nonnegative(),
|
|
206
|
-
totalSignals: z.number().int().nonnegative(),
|
|
207
|
-
score: z.number().int().nonnegative(),
|
|
208
|
-
files: z.array(sludgeFileReportSchema),
|
|
209
|
-
summary: z.string(),
|
|
210
|
-
}).strict();
|
|
211
|
-
|
|
212
|
-
const receiptSchema = z.object({
|
|
213
|
-
sessionId: z.string(),
|
|
214
|
-
traceId: z.string(),
|
|
215
|
-
seq: z.number().int().positive(),
|
|
216
|
-
ts: z.string(),
|
|
217
|
-
tool: z.string(),
|
|
218
|
-
projection: z.string(),
|
|
219
|
-
reason: z.string(),
|
|
220
|
-
latencyMs: z.number().int().nonnegative(),
|
|
221
|
-
fileBytes: z.number().int().nonnegative().nullable(),
|
|
222
|
-
returnedBytes: z.number().int().nonnegative(),
|
|
223
|
-
burden: z.object({
|
|
224
|
-
kind: burdenKindSchema,
|
|
225
|
-
nonRead: z.boolean(),
|
|
226
|
-
}).strict(),
|
|
227
|
-
cumulative: z.object({
|
|
228
|
-
reads: z.number().int().nonnegative(),
|
|
229
|
-
outlines: z.number().int().nonnegative(),
|
|
230
|
-
refusals: z.number().int().nonnegative(),
|
|
231
|
-
cacheHits: z.number().int().nonnegative(),
|
|
232
|
-
bytesReturned: z.number().int().nonnegative(),
|
|
233
|
-
bytesAvoided: z.number().int().nonnegative(),
|
|
234
|
-
nonReadBytesReturned: z.number().int().nonnegative(),
|
|
235
|
-
burdenByKind: burdenByKindSchema,
|
|
236
|
-
}).strict(),
|
|
237
|
-
budget: budgetSchema.optional(),
|
|
238
|
-
compressionRatio: z.number().nullable().optional(),
|
|
239
|
-
}).strict();
|
|
240
|
-
|
|
241
|
-
const runtimeObservabilitySchema = z.object({
|
|
242
|
-
enabled: z.boolean(),
|
|
243
|
-
logPath: z.string(),
|
|
244
|
-
maxBytes: z.number().int().positive(),
|
|
245
|
-
logPolicy: z.literal("metadata_only"),
|
|
246
|
-
}).strict();
|
|
247
|
-
|
|
248
|
-
const runtimeCausalContextSchema = z.object({
|
|
249
|
-
transportSessionId: z.string(),
|
|
250
|
-
workspaceSliceId: z.string(),
|
|
251
|
-
causalSessionId: z.string(),
|
|
252
|
-
strandId: z.string(),
|
|
253
|
-
checkoutEpochId: z.string(),
|
|
254
|
-
warpWriterId: z.string(),
|
|
255
|
-
stability: z.literal("runtime_local"),
|
|
256
|
-
provenanceLevel: z.literal("artifact_history"),
|
|
257
|
-
}).strict();
|
|
258
|
-
|
|
259
|
-
const runtimeLocalProvenanceSchema = z.object({
|
|
260
|
-
stability: z.literal("runtime_local"),
|
|
261
|
-
provenanceLevel: z.literal("artifact_history"),
|
|
262
|
-
}).strict();
|
|
263
|
-
|
|
264
|
-
const gitGraftEnhanceBodySchema = z.object({
|
|
265
|
-
range: z.object({
|
|
266
|
-
since: z.string(),
|
|
267
|
-
head: z.string(),
|
|
268
|
-
}).strict(),
|
|
269
|
-
structural: z.object({
|
|
270
|
-
changedFiles: z.number().int().nonnegative(),
|
|
271
|
-
addedSymbols: z.number().int().nonnegative(),
|
|
272
|
-
removedSymbols: z.number().int().nonnegative(),
|
|
273
|
-
changedSymbols: z.number().int().nonnegative(),
|
|
274
|
-
topFilesByChangeCount: z.array(z.object({
|
|
275
|
-
path: z.string(),
|
|
276
|
-
status: z.string(),
|
|
277
|
-
changeCount: z.number().int().nonnegative(),
|
|
278
|
-
summary: z.string(),
|
|
279
|
-
}).strict()),
|
|
280
|
-
}).strict(),
|
|
281
|
-
exports: z.object({
|
|
282
|
-
changed: z.boolean(),
|
|
283
|
-
semverImpact: z.enum(["major", "minor", "patch", "none"]),
|
|
284
|
-
addedExports: z.number().int().nonnegative(),
|
|
285
|
-
removedExports: z.number().int().nonnegative(),
|
|
286
|
-
changedExports: z.number().int().nonnegative(),
|
|
287
|
-
}).strict(),
|
|
288
|
-
warnings: z.array(z.string()),
|
|
289
|
-
}).strict();
|
|
290
|
-
|
|
291
|
-
const runtimeStagedTargetSchema = z.discriminatedUnion("availability", [
|
|
292
|
-
runtimeLocalProvenanceSchema.extend({
|
|
293
|
-
availability: z.literal("none"),
|
|
294
|
-
}).strict(),
|
|
295
|
-
runtimeLocalProvenanceSchema.extend({
|
|
296
|
-
availability: z.literal("full_file"),
|
|
297
|
-
attribution: attributionSummarySchema,
|
|
298
|
-
target: stagedTargetSchema.safeExtend({
|
|
299
|
-
selectionKind: z.literal("full_file"),
|
|
300
|
-
}),
|
|
301
|
-
}).strict(),
|
|
302
|
-
runtimeLocalProvenanceSchema.extend({
|
|
303
|
-
availability: z.literal("ambiguous"),
|
|
304
|
-
attribution: attributionSummarySchema,
|
|
305
|
-
reason: z.enum([
|
|
306
|
-
"missing_head_commit",
|
|
307
|
-
"missing_workspace_overlay",
|
|
308
|
-
"modified_path_selection_requires_deeper_evidence",
|
|
309
|
-
]),
|
|
310
|
-
observedStagedPaths: z.number().int().positive(),
|
|
311
|
-
ambiguousPaths: z.array(z.string()).min(1),
|
|
312
|
-
}).strict(),
|
|
313
|
-
]);
|
|
314
|
-
|
|
315
|
-
const activityViewAnchorSchema = z.discriminatedUnion("posture", [
|
|
316
|
-
z.object({
|
|
317
|
-
posture: z.literal("head_commit"),
|
|
318
|
-
headRef: z.string().nullable(),
|
|
319
|
-
headSha: z.string(),
|
|
320
|
-
}).strict(),
|
|
321
|
-
z.object({
|
|
322
|
-
posture: z.literal("unknown"),
|
|
323
|
-
headRef: z.string().nullable(),
|
|
324
|
-
headSha: z.string().nullable(),
|
|
325
|
-
reason: z.enum(["workspace_unbound", "missing_head_commit"]),
|
|
326
|
-
}).strict(),
|
|
327
|
-
]);
|
|
328
|
-
|
|
329
|
-
const activityViewContinuityItemSchema = z.object({
|
|
330
|
-
itemKind: z.literal("continuity"),
|
|
331
|
-
recordId: z.string(),
|
|
332
|
-
operation: localHistoryContinuityOperationSchema,
|
|
333
|
-
occurredAt: z.string(),
|
|
334
|
-
causalSessionId: z.string(),
|
|
335
|
-
strandId: z.string(),
|
|
336
|
-
attribution: attributionSummarySchema,
|
|
337
|
-
continuedFromCausalSessionId: z.string().nullable(),
|
|
338
|
-
continuedFromStrandId: z.string().nullable(),
|
|
339
|
-
}).strict();
|
|
340
|
-
|
|
341
|
-
const activityViewItemSchema = z.union([
|
|
342
|
-
activityViewContinuityItemSchema,
|
|
343
|
-
readEventSchema,
|
|
344
|
-
stageEventSchema,
|
|
345
|
-
transitionEventSchema,
|
|
346
|
-
]);
|
|
347
|
-
|
|
348
|
-
const activityViewGroupSchema = z.object({
|
|
349
|
-
groupKind: z.enum(["transition", "stage", "continuity", "read"]),
|
|
350
|
-
label: z.string(),
|
|
351
|
-
summary: z.string(),
|
|
352
|
-
count: z.number().int().positive(),
|
|
353
|
-
items: z.array(activityViewItemSchema),
|
|
354
|
-
}).strict();
|
|
355
|
-
|
|
356
|
-
const activityViewSummarySchema = z.object({
|
|
357
|
-
headline: z.string(),
|
|
358
|
-
anchor: z.string(),
|
|
359
|
-
workspace: z.string(),
|
|
360
|
-
groups: z.array(z.string()),
|
|
361
|
-
}).strict();
|
|
362
|
-
|
|
363
|
-
const persistedLocalHistorySummarySchema = z.discriminatedUnion("availability", [
|
|
364
|
-
z.object({
|
|
365
|
-
availability: z.literal("none"),
|
|
366
|
-
persistence: z.literal("persisted_local_history"),
|
|
367
|
-
historyPath: z.string().nullable(),
|
|
368
|
-
totalContinuityRecords: z.literal(0),
|
|
369
|
-
active: z.literal(false),
|
|
370
|
-
lastOperation: z.null(),
|
|
371
|
-
lastObservedAt: z.null(),
|
|
372
|
-
continuityKey: z.null(),
|
|
373
|
-
causalSessionId: z.null(),
|
|
374
|
-
strandId: z.null(),
|
|
375
|
-
checkoutEpochId: z.null(),
|
|
376
|
-
continuedFromCausalSessionId: z.null(),
|
|
377
|
-
continuityConfidence: attributionConfidenceSchema,
|
|
378
|
-
continuityEvidence: z.array(evidenceSchema),
|
|
379
|
-
attribution: attributionSummarySchema,
|
|
380
|
-
latestReadEvent: z.null(),
|
|
381
|
-
latestStageEvent: z.null(),
|
|
382
|
-
latestTransitionEvent: z.null(),
|
|
383
|
-
preserves: z.array(z.string()),
|
|
384
|
-
excludes: z.array(z.string()),
|
|
385
|
-
nextAction: z.literal("bind_workspace_to_begin_local_history"),
|
|
386
|
-
}).strict(),
|
|
387
|
-
z.object({
|
|
388
|
-
availability: z.literal("present"),
|
|
389
|
-
persistence: z.literal("persisted_local_history"),
|
|
390
|
-
historyPath: z.string().nullable(),
|
|
391
|
-
totalContinuityRecords: z.number().int().positive(),
|
|
392
|
-
active: z.boolean(),
|
|
393
|
-
lastOperation: localHistoryContinuityOperationSchema,
|
|
394
|
-
lastObservedAt: z.string(),
|
|
395
|
-
continuityKey: z.string(),
|
|
396
|
-
causalSessionId: z.string(),
|
|
397
|
-
strandId: z.string(),
|
|
398
|
-
checkoutEpochId: z.string(),
|
|
399
|
-
continuedFromCausalSessionId: z.string().nullable(),
|
|
400
|
-
continuityConfidence: attributionConfidenceSchema,
|
|
401
|
-
continuityEvidence: z.array(evidenceSchema),
|
|
402
|
-
attribution: attributionSummarySchema,
|
|
403
|
-
latestReadEvent: readEventSchema.nullable(),
|
|
404
|
-
latestStageEvent: stageEventSchema.nullable(),
|
|
405
|
-
latestTransitionEvent: transitionEventSchema.nullable(),
|
|
406
|
-
preserves: z.array(z.string()),
|
|
407
|
-
excludes: z.array(z.string()),
|
|
408
|
-
nextAction: z.enum([
|
|
409
|
-
"continue_active_causal_workspace",
|
|
410
|
-
"review_transition_boundary_before_continuing",
|
|
411
|
-
"inspect_or_resume_local_history",
|
|
412
|
-
]),
|
|
413
|
-
}).strict(),
|
|
414
|
-
]);
|
|
415
|
-
|
|
416
|
-
const repoConcurrencySummarySchema = z.object({
|
|
417
|
-
posture: repoConcurrencyPostureSchema,
|
|
418
|
-
authority: repoConcurrencyAuthoritySchema,
|
|
419
|
-
observedWorktreeCount: z.number().int().positive(),
|
|
420
|
-
observedCausalSessionCount: z.number().int().nonnegative(),
|
|
421
|
-
observedActorCount: z.number().int().nonnegative(),
|
|
422
|
-
overlappingPathCount: z.number().int().nonnegative(),
|
|
423
|
-
summary: z.string().min(1),
|
|
424
|
-
daemonSessionLiveness: z.object({
|
|
425
|
-
idleTimeoutMs: z.number().int().positive(),
|
|
426
|
-
liveSessionCount: z.number().int().nonnegative(),
|
|
427
|
-
staleSessionCount: z.number().int().nonnegative(),
|
|
428
|
-
}).strict().optional(),
|
|
429
|
-
}).strict();
|
|
430
|
-
|
|
431
|
-
const precisionSymbolMatchSchema = z.object({
|
|
432
|
-
name: z.string(),
|
|
433
|
-
kind: z.string(),
|
|
434
|
-
path: z.string(),
|
|
435
|
-
signature: z.string().optional(),
|
|
436
|
-
exported: z.boolean(),
|
|
437
|
-
startLine: z.number().int().positive().optional(),
|
|
438
|
-
endLine: z.number().int().positive().optional(),
|
|
439
|
-
}).strict();
|
|
440
|
-
|
|
441
|
-
const codeRefsMatchSchema = z.object({
|
|
442
|
-
path: z.string(),
|
|
443
|
-
line: z.number().int().positive(),
|
|
444
|
-
column: z.number().int().positive().optional(),
|
|
445
|
-
preview: z.string(),
|
|
446
|
-
}).strict();
|
|
447
|
-
|
|
448
|
-
const codeRefsProvenanceSchema = z.object({
|
|
449
|
-
engine: z.enum(["ripgrep", "grep"]),
|
|
450
|
-
pattern: z.string(),
|
|
451
|
-
approximate: z.literal(true),
|
|
452
|
-
filesSearched: z.number().int().nonnegative(),
|
|
453
|
-
}).strict();
|
|
454
|
-
|
|
455
|
-
const structuralRefusalSchema = z.object({
|
|
456
|
-
path: z.string(),
|
|
457
|
-
reason: z.string(),
|
|
458
|
-
reasonDetail: z.string(),
|
|
459
|
-
next: z.array(z.string()),
|
|
460
|
-
actual: actualSchema,
|
|
461
|
-
}).strict();
|
|
462
|
-
|
|
463
|
-
const mapFileSchema = z.object({
|
|
464
|
-
path: z.string(),
|
|
465
|
-
lang: z.string(),
|
|
466
|
-
symbols: z.array(z.object({
|
|
467
|
-
name: z.string(),
|
|
468
|
-
kind: z.string(),
|
|
469
|
-
signature: z.string().optional(),
|
|
470
|
-
exported: z.boolean(),
|
|
471
|
-
startLine: z.number().int().positive().optional(),
|
|
472
|
-
endLine: z.number().int().positive().optional(),
|
|
473
|
-
}).strict()),
|
|
474
|
-
}).strict();
|
|
475
|
-
|
|
476
|
-
const fileDiffSchema = z.object({
|
|
477
|
-
path: z.string(),
|
|
478
|
-
status: z.enum(["modified", "added", "deleted"]),
|
|
479
|
-
summary: z.string(),
|
|
480
|
-
diff: outlineDiffSchema,
|
|
481
|
-
}).strict();
|
|
482
|
-
|
|
483
|
-
const repoTransitionSchema = z.object({
|
|
484
|
-
kind: repoTransitionKindSchema,
|
|
485
|
-
fromRef: z.string().nullable(),
|
|
486
|
-
toRef: z.string().nullable(),
|
|
487
|
-
fromCommit: z.string().nullable(),
|
|
488
|
-
toCommit: z.string().nullable(),
|
|
489
|
-
evidence: z.object({
|
|
490
|
-
reflogSubject: z.string().nullable(),
|
|
491
|
-
}).strict(),
|
|
492
|
-
}).strict();
|
|
493
|
-
|
|
494
|
-
const repoSemanticTransitionSchema = z.object({
|
|
495
|
-
kind: z.enum([
|
|
496
|
-
"index_update",
|
|
497
|
-
"conflict_resolution",
|
|
498
|
-
"merge_phase",
|
|
499
|
-
"rebase_phase",
|
|
500
|
-
"bulk_transition",
|
|
501
|
-
"unknown",
|
|
502
|
-
]),
|
|
503
|
-
authority: z.enum([
|
|
504
|
-
"authoritative_git_state",
|
|
505
|
-
"repo_snapshot",
|
|
506
|
-
]),
|
|
507
|
-
phase: z.enum([
|
|
508
|
-
"started",
|
|
509
|
-
"conflicted",
|
|
510
|
-
"resolved_waiting_commit",
|
|
511
|
-
"continued",
|
|
512
|
-
"completed_or_cleared",
|
|
513
|
-
]).nullable(),
|
|
514
|
-
summary: z.string(),
|
|
515
|
-
evidence: z.object({
|
|
516
|
-
totalPaths: z.number().int().nonnegative(),
|
|
517
|
-
stagedPaths: z.number().int().nonnegative(),
|
|
518
|
-
changedPaths: z.number().int().nonnegative(),
|
|
519
|
-
untrackedPaths: z.number().int().nonnegative(),
|
|
520
|
-
unmergedPaths: z.number().int().nonnegative(),
|
|
521
|
-
mergeInProgress: z.boolean(),
|
|
522
|
-
rebaseInProgress: z.boolean(),
|
|
523
|
-
rebaseStep: z.number().int().positive().nullable(),
|
|
524
|
-
rebaseTotalSteps: z.number().int().positive().nullable(),
|
|
525
|
-
lastTransitionKind: repoTransitionKindSchema.nullable(),
|
|
526
|
-
reflogSubject: z.string().nullable(),
|
|
527
|
-
}).strict(),
|
|
528
|
-
}).strict();
|
|
529
|
-
|
|
530
|
-
const workspaceOverlaySummarySchema = z.object({
|
|
531
|
-
dirty: z.literal(true),
|
|
532
|
-
totalPaths: z.number().int().nonnegative(),
|
|
533
|
-
stagedPaths: z.number().int().nonnegative(),
|
|
534
|
-
changedPaths: z.number().int().nonnegative(),
|
|
535
|
-
untrackedPaths: z.number().int().nonnegative(),
|
|
536
|
-
actorGuess: z.literal("unknown"),
|
|
537
|
-
confidence: z.literal("low"),
|
|
538
|
-
evidence: z.object({
|
|
539
|
-
source: z.literal("git status --porcelain"),
|
|
540
|
-
reflogSubject: z.string().nullable(),
|
|
541
|
-
sample: z.array(z.string()),
|
|
542
|
-
}).strict(),
|
|
543
|
-
}).strict();
|
|
544
|
-
|
|
545
|
-
const gitHookBootstrapStatusSchema = z.object({
|
|
546
|
-
posture: z.enum(["absent", "external_unknown", "installed"]),
|
|
547
|
-
configuredCoreHooksPath: z.string().nullable(),
|
|
548
|
-
resolvedHooksPath: z.string(),
|
|
549
|
-
requiredHooks: z.array(z.string()),
|
|
550
|
-
presentHooks: z.array(z.string()),
|
|
551
|
-
missingHooks: z.array(z.string()),
|
|
552
|
-
supportsCheckoutBoundaries: z.boolean(),
|
|
553
|
-
}).strict();
|
|
554
|
-
|
|
555
|
-
const gitTransitionHookEventSchema = z.object({
|
|
556
|
-
hookName: z.enum(["post-checkout", "post-merge", "post-rewrite"]),
|
|
557
|
-
hookArgs: z.array(z.string()),
|
|
558
|
-
worktreeRoot: z.string(),
|
|
559
|
-
observedAt: z.string(),
|
|
560
|
-
}).strict();
|
|
561
|
-
|
|
562
|
-
const workspaceOverlayFootingSchema = z.object({
|
|
563
|
-
observationMode: z.enum([
|
|
564
|
-
"inferred_between_tool_calls",
|
|
565
|
-
"hook_observed_checkout_boundaries",
|
|
566
|
-
]),
|
|
567
|
-
lineagePosture: z.enum([
|
|
568
|
-
"stable",
|
|
569
|
-
"forked_after_transition",
|
|
570
|
-
]),
|
|
571
|
-
boundaryAuthority: z.enum([
|
|
572
|
-
"none",
|
|
573
|
-
"repo_snapshot",
|
|
574
|
-
"hook_observed",
|
|
575
|
-
]),
|
|
576
|
-
degraded: z.literal(true),
|
|
577
|
-
degradedReason: z.enum([
|
|
578
|
-
"target_repo_hooks_absent",
|
|
579
|
-
"target_repo_hooks_unrecognized",
|
|
580
|
-
"local_edit_watchers_absent",
|
|
581
|
-
]),
|
|
582
|
-
checkoutEpoch: z.number().int().nonnegative(),
|
|
583
|
-
lastTransition: repoTransitionSchema.nullable(),
|
|
584
|
-
workspaceOverlayId: z.string().nullable(),
|
|
585
|
-
workspaceOverlay: workspaceOverlaySummarySchema.nullable(),
|
|
586
|
-
hookBootstrap: gitHookBootstrapStatusSchema,
|
|
587
|
-
latestHookEvent: gitTransitionHookEventSchema.nullable(),
|
|
588
|
-
}).strict();
|
|
589
|
-
|
|
590
|
-
const policyBoundarySchema = z.object({
|
|
591
|
-
kind: z.literal("shell_escape_hatch"),
|
|
592
|
-
boundedReadContract: z.literal(false),
|
|
593
|
-
policyEnforced: z.literal(false),
|
|
594
|
-
}).strict();
|
|
595
|
-
|
|
596
|
-
const burdenSummarySchema = z.object({
|
|
597
|
-
totalBytesReturned: z.number().int().nonnegative(),
|
|
598
|
-
totalNonReadBytesReturned: z.number().int().nonnegative(),
|
|
599
|
-
topKind: burdenKindSchema.nullable(),
|
|
600
|
-
topBytesReturned: z.number().int().nonnegative(),
|
|
601
|
-
topCalls: z.number().int().nonnegative(),
|
|
602
|
-
}).strict();
|
|
603
|
-
|
|
604
|
-
const workspaceCapabilityProfileSchema = z.object({
|
|
605
|
-
boundedReads: z.boolean(),
|
|
606
|
-
structuralTools: z.boolean(),
|
|
607
|
-
precisionTools: z.boolean(),
|
|
608
|
-
stateBookmarks: z.boolean(),
|
|
609
|
-
runtimeLogs: z.literal("session_local_only"),
|
|
610
|
-
runCapture: z.boolean(),
|
|
611
|
-
}).strict();
|
|
612
|
-
|
|
613
|
-
const workspaceStatusSchema = z.object({
|
|
614
|
-
sessionMode: z.enum(["repo_local", "daemon"]),
|
|
615
|
-
bindState: z.enum(["bound", "unbound"]),
|
|
616
|
-
repoId: z.string().nullable(),
|
|
617
|
-
worktreeId: z.string().nullable(),
|
|
618
|
-
worktreeRoot: z.string().nullable(),
|
|
619
|
-
gitCommonDir: z.string().nullable(),
|
|
620
|
-
graftDir: z.string().nullable(),
|
|
621
|
-
capabilityProfile: workspaceCapabilityProfileSchema.nullable(),
|
|
622
|
-
}).strict();
|
|
623
|
-
|
|
624
|
-
const workspaceActionSchema = workspaceStatusSchema.extend({
|
|
625
|
-
ok: z.boolean(),
|
|
626
|
-
action: z.enum(["bind", "rebind"]),
|
|
627
|
-
freshSessionSlice: z.boolean(),
|
|
628
|
-
errorCode: z.string().optional(),
|
|
629
|
-
error: z.string().optional(),
|
|
630
|
-
}).strict();
|
|
631
|
-
|
|
632
|
-
const activeCausalWorkspaceSchema = z.object({
|
|
633
|
-
causalContext: runtimeCausalContextSchema,
|
|
634
|
-
attribution: attributionSummarySchema,
|
|
635
|
-
latestReadEvent: readEventSchema.nullable(),
|
|
636
|
-
latestStageEvent: stageEventSchema.nullable(),
|
|
637
|
-
latestTransitionEvent: transitionEventSchema.nullable(),
|
|
638
|
-
repoConcurrency: repoConcurrencySummarySchema.nullable(),
|
|
639
|
-
checkoutEpoch: z.number().int().nonnegative(),
|
|
640
|
-
lastTransition: repoTransitionSchema.nullable(),
|
|
641
|
-
semanticTransition: repoSemanticTransitionSchema.nullable(),
|
|
642
|
-
workspaceOverlayId: z.string().nullable(),
|
|
643
|
-
workspaceOverlay: workspaceOverlaySummarySchema.nullable(),
|
|
644
|
-
workspaceOverlayFooting: workspaceOverlayFootingSchema,
|
|
645
|
-
stagedTarget: runtimeStagedTargetSchema,
|
|
646
|
-
}).strict();
|
|
647
|
-
|
|
648
|
-
const causalStatusSchema = workspaceStatusSchema.extend({
|
|
649
|
-
activeCausalWorkspace: activeCausalWorkspaceSchema.nullable(),
|
|
650
|
-
persistedLocalHistory: persistedLocalHistorySummarySchema,
|
|
651
|
-
nextAction: causalSurfaceNextActionSchema,
|
|
652
|
-
}).strict();
|
|
653
|
-
|
|
654
|
-
const causalAttachSchema = workspaceStatusSchema.extend({
|
|
655
|
-
ok: z.boolean(),
|
|
656
|
-
action: z.literal("attach"),
|
|
657
|
-
activeCausalWorkspace: activeCausalWorkspaceSchema.nullable(),
|
|
658
|
-
persistedLocalHistory: persistedLocalHistorySummarySchema,
|
|
659
|
-
nextAction: causalSurfaceNextActionSchema,
|
|
660
|
-
errorCode: z.string().optional(),
|
|
661
|
-
error: z.string().optional(),
|
|
662
|
-
}).strict();
|
|
663
|
-
|
|
664
|
-
const activityViewSchema = workspaceStatusSchema.extend({
|
|
665
|
-
truthClass: z.literal("artifact_history"),
|
|
666
|
-
anchor: activityViewAnchorSchema,
|
|
667
|
-
summary: activityViewSummarySchema,
|
|
668
|
-
activeCausalWorkspace: z.object({
|
|
669
|
-
causalContext: runtimeCausalContextSchema,
|
|
670
|
-
attribution: attributionSummarySchema,
|
|
671
|
-
repoConcurrency: repoConcurrencySummarySchema.nullable(),
|
|
672
|
-
checkoutEpoch: z.number().int().nonnegative(),
|
|
673
|
-
lastTransition: repoTransitionSchema.nullable(),
|
|
674
|
-
semanticTransition: repoSemanticTransitionSchema.nullable(),
|
|
675
|
-
workspaceOverlayId: z.string().nullable(),
|
|
676
|
-
workspaceOverlay: workspaceOverlaySummarySchema.nullable(),
|
|
677
|
-
workspaceOverlayFooting: workspaceOverlayFootingSchema.nullable(),
|
|
678
|
-
stagedTarget: runtimeStagedTargetSchema,
|
|
679
|
-
}).nullable(),
|
|
680
|
-
activityWindow: z.object({
|
|
681
|
-
historyPath: z.string().nullable(),
|
|
682
|
-
limit: z.number().int().positive(),
|
|
683
|
-
returned: z.number().int().nonnegative(),
|
|
684
|
-
totalMatchingItems: z.number().int().nonnegative(),
|
|
685
|
-
truncated: z.boolean(),
|
|
686
|
-
missingSignalKinds: z.array(z.string()),
|
|
687
|
-
groups: z.array(activityViewGroupSchema),
|
|
688
|
-
}).strict(),
|
|
689
|
-
degradedReasons: z.array(z.string()),
|
|
690
|
-
nextAction: z.union([
|
|
691
|
-
causalSurfaceNextActionSchema,
|
|
692
|
-
z.literal("bind_workspace_to_begin_local_history"),
|
|
693
|
-
]),
|
|
694
|
-
}).strict();
|
|
695
|
-
|
|
696
|
-
const authorizedWorkspaceSchema = z.object({
|
|
697
|
-
repoId: z.string(),
|
|
698
|
-
worktreeId: z.string(),
|
|
699
|
-
worktreeRoot: z.string(),
|
|
700
|
-
gitCommonDir: z.string(),
|
|
701
|
-
capabilityProfile: workspaceCapabilityProfileSchema,
|
|
702
|
-
authorizedAt: z.string(),
|
|
703
|
-
lastBoundAt: z.string().nullable(),
|
|
704
|
-
activeSessions: z.number().int().nonnegative(),
|
|
705
|
-
}).strict();
|
|
706
|
-
|
|
707
|
-
const workspaceAuthorizeSchema = z.object({
|
|
708
|
-
ok: z.boolean(),
|
|
709
|
-
changed: z.boolean(),
|
|
710
|
-
authorization: authorizedWorkspaceSchema.optional(),
|
|
711
|
-
errorCode: z.string().optional(),
|
|
712
|
-
error: z.string().optional(),
|
|
713
|
-
}).strict();
|
|
714
|
-
|
|
715
|
-
const workspaceRevokeSchema = z.object({
|
|
716
|
-
ok: z.boolean(),
|
|
717
|
-
revoked: z.boolean(),
|
|
718
|
-
repoId: z.string().nullable().optional(),
|
|
719
|
-
worktreeId: z.string().nullable().optional(),
|
|
720
|
-
worktreeRoot: z.string().nullable().optional(),
|
|
721
|
-
activeSessions: z.number().int().nonnegative().optional(),
|
|
722
|
-
errorCode: z.string().optional(),
|
|
723
|
-
error: z.string().optional(),
|
|
724
|
-
}).strict();
|
|
725
|
-
|
|
726
|
-
const daemonSessionSchema = z.object({
|
|
727
|
-
sessionId: z.string(),
|
|
728
|
-
sessionMode: z.literal("daemon"),
|
|
729
|
-
bindState: z.enum(["bound", "unbound"]),
|
|
730
|
-
repoId: z.string().nullable(),
|
|
731
|
-
worktreeId: z.string().nullable(),
|
|
732
|
-
worktreeRoot: z.string().nullable(),
|
|
733
|
-
causalSessionId: z.string().nullable(),
|
|
734
|
-
checkoutEpochId: z.string().nullable(),
|
|
735
|
-
capabilityProfile: workspaceCapabilityProfileSchema.nullable(),
|
|
736
|
-
startedAt: z.string(),
|
|
737
|
-
lastActivityAt: z.string(),
|
|
738
|
-
}).strict();
|
|
739
|
-
|
|
740
|
-
const daemonRepoWorktreeSchema = z.object({
|
|
741
|
-
worktreeId: z.string(),
|
|
742
|
-
worktreeRoot: z.string(),
|
|
743
|
-
activeSessions: z.number().int().nonnegative(),
|
|
744
|
-
lastBoundAt: z.string().nullable(),
|
|
745
|
-
}).strict();
|
|
746
|
-
|
|
747
|
-
const daemonRepoMonitorSchema = z.object({
|
|
748
|
-
workerKind: z.literal("git_poll_indexer"),
|
|
749
|
-
lifecycleState: z.enum(["running", "paused", "stopped"]),
|
|
750
|
-
health: z.enum(["ok", "lagging", "error", "unauthorized", "paused", "stopped"]),
|
|
751
|
-
lastTickAt: z.string().nullable(),
|
|
752
|
-
lastSuccessAt: z.string().nullable(),
|
|
753
|
-
lastError: z.string().nullable(),
|
|
754
|
-
}).strict();
|
|
755
|
-
|
|
756
|
-
const daemonRepoSchema = z.object({
|
|
757
|
-
repoId: z.string(),
|
|
758
|
-
gitCommonDir: z.string(),
|
|
759
|
-
authorizedWorkspaces: z.number().int().nonnegative(),
|
|
760
|
-
boundSessions: z.number().int().nonnegative(),
|
|
761
|
-
activeWorktrees: z.number().int().nonnegative(),
|
|
762
|
-
backlogCommits: z.number().int().nonnegative(),
|
|
763
|
-
lastBoundAt: z.string().nullable(),
|
|
764
|
-
lastActivityAt: z.string().nullable(),
|
|
765
|
-
monitor: daemonRepoMonitorSchema.nullable(),
|
|
766
|
-
worktrees: z.array(daemonRepoWorktreeSchema),
|
|
767
|
-
}).strict();
|
|
768
|
-
|
|
769
|
-
const monitorStatusSchema = z.object({
|
|
770
|
-
repoId: z.string(),
|
|
771
|
-
gitCommonDir: z.string(),
|
|
772
|
-
anchorWorktreeRoot: z.string(),
|
|
773
|
-
authorizedWorkspaces: z.number().int().nonnegative(),
|
|
774
|
-
workerKind: z.literal("git_poll_indexer"),
|
|
775
|
-
lifecycleState: z.enum(["running", "paused", "stopped"]),
|
|
776
|
-
health: z.enum(["ok", "lagging", "error", "unauthorized", "paused", "stopped"]),
|
|
777
|
-
pollIntervalMs: z.number().int().positive(),
|
|
778
|
-
lastStartedAt: z.string().nullable(),
|
|
779
|
-
lastTickAt: z.string().nullable(),
|
|
780
|
-
lastSuccessAt: z.string().nullable(),
|
|
781
|
-
lastError: z.string().nullable(),
|
|
782
|
-
lastIndexedCommit: z.string().nullable(),
|
|
783
|
-
lastHeadCommit: z.string().nullable(),
|
|
784
|
-
backlogCommits: z.number().int().nonnegative(),
|
|
785
|
-
lastRunCommitsIndexed: z.number().int().nonnegative(),
|
|
786
|
-
lastRunPatchesWritten: z.number().int().nonnegative(),
|
|
787
|
-
}).strict();
|
|
788
|
-
|
|
789
|
-
const monitorActionSchema = z.object({
|
|
790
|
-
ok: z.boolean(),
|
|
791
|
-
action: z.enum(["start", "pause", "resume", "stop", "nudge"]),
|
|
792
|
-
created: z.boolean(),
|
|
793
|
-
changed: z.boolean(),
|
|
794
|
-
status: monitorStatusSchema.optional(),
|
|
795
|
-
errorCode: z.string().optional(),
|
|
796
|
-
error: z.string().optional(),
|
|
797
|
-
}).strict();
|
|
798
|
-
|
|
799
|
-
const daemonSchedulerSchema = z.object({
|
|
800
|
-
maxConcurrentJobs: z.number().int().positive(),
|
|
801
|
-
activeJobs: z.number().int().nonnegative(),
|
|
802
|
-
queuedJobs: z.number().int().nonnegative(),
|
|
803
|
-
interactiveQueuedJobs: z.number().int().nonnegative(),
|
|
804
|
-
backgroundQueuedJobs: z.number().int().nonnegative(),
|
|
805
|
-
activeWriterLanes: z.number().int().nonnegative(),
|
|
806
|
-
queuedWriterLanes: z.number().int().nonnegative(),
|
|
807
|
-
completedJobs: z.number().int().nonnegative(),
|
|
808
|
-
failedJobs: z.number().int().nonnegative(),
|
|
809
|
-
longestQueuedWaitMs: z.number().int().nonnegative(),
|
|
810
|
-
}).strict();
|
|
811
|
-
|
|
812
|
-
const daemonWorkersSchema = z.object({
|
|
813
|
-
mode: z.enum(["inline", "child_processes"]),
|
|
814
|
-
totalWorkers: z.number().int().nonnegative(),
|
|
815
|
-
busyWorkers: z.number().int().nonnegative(),
|
|
816
|
-
idleWorkers: z.number().int().nonnegative(),
|
|
817
|
-
queuedTasks: z.number().int().nonnegative(),
|
|
818
|
-
completedTasks: z.number().int().nonnegative(),
|
|
819
|
-
failedTasks: z.number().int().nonnegative(),
|
|
820
|
-
}).strict();
|
|
821
|
-
|
|
822
|
-
const daemonStatusSchema = z.object({
|
|
823
|
-
ok: z.literal(true),
|
|
824
|
-
sessionMode: z.literal("daemon"),
|
|
825
|
-
transport: z.enum(["unix_socket", "named_pipe"]),
|
|
826
|
-
sameUserOnly: z.literal(true),
|
|
827
|
-
socketPath: z.string(),
|
|
828
|
-
mcpPath: z.string(),
|
|
829
|
-
healthPath: z.string(),
|
|
830
|
-
activeSessions: z.number().int().nonnegative(),
|
|
831
|
-
boundSessions: z.number().int().nonnegative(),
|
|
832
|
-
unboundSessions: z.number().int().nonnegative(),
|
|
833
|
-
activeWarpRepos: z.number().int().nonnegative(),
|
|
834
|
-
authorizedWorkspaces: z.number().int().nonnegative(),
|
|
835
|
-
authorizedRepos: z.number().int().nonnegative(),
|
|
836
|
-
workspaceBindRequiresAuthorization: z.literal(true),
|
|
837
|
-
defaultCapabilityProfile: workspaceCapabilityProfileSchema,
|
|
838
|
-
totalMonitors: z.number().int().nonnegative(),
|
|
839
|
-
runningMonitors: z.number().int().nonnegative(),
|
|
840
|
-
pausedMonitors: z.number().int().nonnegative(),
|
|
841
|
-
stoppedMonitors: z.number().int().nonnegative(),
|
|
842
|
-
failingMonitors: z.number().int().nonnegative(),
|
|
843
|
-
backlogMonitors: z.number().int().nonnegative(),
|
|
844
|
-
scheduler: daemonSchedulerSchema,
|
|
845
|
-
workers: daemonWorkersSchema,
|
|
846
|
-
startedAt: z.string(),
|
|
847
|
-
}).strict();
|
|
848
|
-
|
|
849
|
-
function extendWithCommonFields(
|
|
850
|
-
schema: z.ZodType,
|
|
851
|
-
common: z.ZodRawShape,
|
|
852
|
-
): z.ZodType {
|
|
853
|
-
if (schema instanceof z.ZodObject) {
|
|
854
|
-
return schema.extend(common).strict();
|
|
855
|
-
}
|
|
856
|
-
if (schema instanceof z.ZodUnion) {
|
|
857
|
-
return z.union(schema.options.map((option) => {
|
|
858
|
-
if (!(option instanceof z.ZodObject)) {
|
|
859
|
-
throw new Error("Output schema unions must be composed of objects");
|
|
860
|
-
}
|
|
861
|
-
return option.extend(common).strict();
|
|
862
|
-
}) as [z.ZodObject, z.ZodObject, ...z.ZodObject[]]);
|
|
863
|
-
}
|
|
864
|
-
throw new Error("Output schemas must be objects or unions of objects");
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
function withMcpCommon(
|
|
868
|
-
tool: McpToolName,
|
|
869
|
-
schema: z.ZodType,
|
|
870
|
-
): z.ZodType {
|
|
871
|
-
return extendWithCommonFields(schema, {
|
|
872
|
-
_schema: schemaMetaLiteral(mcpOutputSchemaMeta[tool]),
|
|
873
|
-
_receipt: receiptSchema,
|
|
874
|
-
tripwire: z.array(tripwireSchema).optional(),
|
|
875
|
-
});
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
function withCliCommon(
|
|
879
|
-
command: CliCommandName,
|
|
880
|
-
schema: z.ZodType,
|
|
881
|
-
): z.ZodType {
|
|
882
|
-
return extendWithCommonFields(schema, {
|
|
883
|
-
_schema: schemaMetaLiteral(cliOutputSchemaMeta[command]),
|
|
884
|
-
});
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
function withCliPeerCommon(
|
|
888
|
-
command: CliCommandName,
|
|
889
|
-
schema: z.ZodType,
|
|
890
|
-
): z.ZodType {
|
|
891
|
-
return extendWithCommonFields(schema, {
|
|
892
|
-
_schema: schemaMetaLiteral(cliOutputSchemaMeta[command]),
|
|
893
|
-
_receipt: receiptSchema,
|
|
894
|
-
tripwire: z.array(tripwireSchema).optional(),
|
|
895
|
-
});
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
const mcpOutputBodySchemas: Record<McpToolName, z.ZodType> = {
|
|
899
|
-
safe_read: z.object({
|
|
900
|
-
path: z.string(),
|
|
901
|
-
projection: z.enum(["content", "outline", "refused", "error", "cache_hit", "diff"]),
|
|
902
|
-
reason: z.string(),
|
|
903
|
-
actual: actualSchema.optional(),
|
|
904
|
-
thresholds: thresholdsSchema.optional(),
|
|
905
|
-
sessionDepth: sessionDepthSchema.optional(),
|
|
906
|
-
content: z.string().optional(),
|
|
907
|
-
outline: z.array(outlineEntrySchema).optional(),
|
|
908
|
-
jumpTable: z.array(jumpEntrySchema).optional(),
|
|
909
|
-
estimatedBytesAvoided: z.number().int().nonnegative().optional(),
|
|
910
|
-
next: z.array(z.string()).optional(),
|
|
911
|
-
reasonDetail: z.string().optional(),
|
|
912
|
-
readCount: z.number().int().nonnegative().optional(),
|
|
913
|
-
lastReadAt: z.string().optional(),
|
|
914
|
-
diff: outlineDiffSchema.optional(),
|
|
915
|
-
}).strict(),
|
|
916
|
-
graft_edit: z.object({
|
|
917
|
-
path: z.string(),
|
|
918
|
-
operation: z.literal("replace"),
|
|
919
|
-
projection: z.enum(["edited", "refused"]),
|
|
920
|
-
status: z.enum(["edited", "refused"]),
|
|
921
|
-
changed: z.boolean(),
|
|
922
|
-
matches: z.number().int().nonnegative(),
|
|
923
|
-
replacements: z.number().int().nonnegative(),
|
|
924
|
-
reason: graftEditReasonSchema.optional(),
|
|
925
|
-
reasonDetail: z.string().optional(),
|
|
926
|
-
next: z.array(z.string()).optional(),
|
|
927
|
-
actual: actualSchema.optional(),
|
|
928
|
-
driftWarnings: z.array(graftEditDriftWarningSchema).optional(),
|
|
929
|
-
}).strict(),
|
|
930
|
-
file_outline: z.union([
|
|
931
|
-
z.object({
|
|
932
|
-
path: z.string(),
|
|
933
|
-
outline: z.array(outlineEntrySchema),
|
|
934
|
-
jumpTable: z.array(jumpEntrySchema),
|
|
935
|
-
partial: z.boolean().optional(),
|
|
936
|
-
reason: z.string().optional(),
|
|
937
|
-
error: z.string().optional(),
|
|
938
|
-
cacheHit: z.boolean().optional(),
|
|
939
|
-
}).strict(),
|
|
940
|
-
z.object({
|
|
941
|
-
path: z.string(),
|
|
942
|
-
projection: z.literal("refused"),
|
|
943
|
-
reason: z.string(),
|
|
944
|
-
reasonDetail: z.string().optional(),
|
|
945
|
-
next: z.array(z.string()).optional(),
|
|
946
|
-
actual: actualSchema.optional(),
|
|
947
|
-
}).strict(),
|
|
948
|
-
]),
|
|
949
|
-
read_range: z.object({
|
|
950
|
-
path: z.string(),
|
|
951
|
-
content: z.string().optional(),
|
|
952
|
-
startLine: z.number().int().positive().optional(),
|
|
953
|
-
endLine: z.number().int().positive().optional(),
|
|
954
|
-
reason: z.string().optional(),
|
|
955
|
-
truncated: z.boolean().optional(),
|
|
956
|
-
clipped: z.boolean().optional(),
|
|
957
|
-
projection: z.literal("refused").optional(),
|
|
958
|
-
reasonDetail: z.string().optional(),
|
|
959
|
-
next: z.array(z.string()).optional(),
|
|
960
|
-
actual: actualSchema.optional(),
|
|
961
|
-
}).strict(),
|
|
962
|
-
changed_since: z.object({
|
|
963
|
-
status: z.enum(["file_not_found", "refused", "unsupported", "unchanged", "no_previous_observation"]).optional(),
|
|
964
|
-
reason: z.string().optional(),
|
|
965
|
-
diff: outlineDiffSchema.optional(),
|
|
966
|
-
consumed: z.boolean().optional(),
|
|
967
|
-
}).strict(),
|
|
968
|
-
graft_diff: z.object({
|
|
969
|
-
base: z.string(),
|
|
970
|
-
head: z.string(),
|
|
971
|
-
files: z.array(fileDiffSchema),
|
|
972
|
-
refused: z.array(structuralRefusalSchema).optional(),
|
|
973
|
-
layer: worldlineLayerSchema,
|
|
974
|
-
}).strict(),
|
|
975
|
-
graft_since: z.object({
|
|
976
|
-
base: z.string(),
|
|
977
|
-
head: z.string(),
|
|
978
|
-
files: z.array(fileDiffSchema),
|
|
979
|
-
refused: z.array(structuralRefusalSchema).optional(),
|
|
980
|
-
summary: z.string(),
|
|
981
|
-
layer: z.literal("ref_view"),
|
|
982
|
-
}).strict(),
|
|
983
|
-
graft_map: z.object({
|
|
984
|
-
directory: z.string(),
|
|
985
|
-
files: z.array(mapFileSchema),
|
|
986
|
-
refused: z.array(structuralRefusalSchema).optional(),
|
|
987
|
-
summary: z.string(),
|
|
988
|
-
truncated: z.boolean().optional(),
|
|
989
|
-
truncatedReason: z.enum(["OUTPUT_LIMIT", "BUDGET_EXHAUSTED"]).optional(),
|
|
990
|
-
next: z.array(z.string()).optional(),
|
|
991
|
-
}).strict(),
|
|
992
|
-
code_show: z.object({
|
|
993
|
-
symbol: z.string().optional(),
|
|
994
|
-
kind: z.string().optional(),
|
|
995
|
-
signature: z.string().optional(),
|
|
996
|
-
path: z.string().optional(),
|
|
997
|
-
exported: z.boolean().optional(),
|
|
998
|
-
startLine: z.number().int().positive().optional(),
|
|
999
|
-
endLine: z.number().int().positive().optional(),
|
|
1000
|
-
content: z.string().optional(),
|
|
1001
|
-
truncated: z.boolean().optional(),
|
|
1002
|
-
clipped: z.boolean().optional(),
|
|
1003
|
-
source: z.enum(["warp", "live"]),
|
|
1004
|
-
layer: worldlineLayerSchema,
|
|
1005
|
-
ambiguous: z.boolean().optional(),
|
|
1006
|
-
matches: z.array(precisionSymbolMatchSchema).optional(),
|
|
1007
|
-
error: z.string().optional(),
|
|
1008
|
-
projection: z.literal("refused").optional(),
|
|
1009
|
-
reason: z.string().optional(),
|
|
1010
|
-
reasonDetail: z.string().optional(),
|
|
1011
|
-
next: z.array(z.string()).optional(),
|
|
1012
|
-
actual: actualSchema.optional(),
|
|
1013
|
-
}).strict(),
|
|
1014
|
-
code_find: z.object({
|
|
1015
|
-
query: z.string(),
|
|
1016
|
-
kind: z.string().nullable(),
|
|
1017
|
-
matches: z.array(precisionSymbolMatchSchema).optional(),
|
|
1018
|
-
total: z.number().int().nonnegative().optional(),
|
|
1019
|
-
path: z.string().optional(),
|
|
1020
|
-
projection: z.literal("refused").optional(),
|
|
1021
|
-
reason: z.string().optional(),
|
|
1022
|
-
reasonDetail: z.string().optional(),
|
|
1023
|
-
next: z.array(z.string()).optional(),
|
|
1024
|
-
actual: actualSchema.optional(),
|
|
1025
|
-
source: z.enum(["warp", "live"]),
|
|
1026
|
-
layer: worldlineLayerSchema,
|
|
1027
|
-
}).strict(),
|
|
1028
|
-
code_refs: z.object({
|
|
1029
|
-
query: z.string(),
|
|
1030
|
-
mode: z.enum(["text", "import", "call", "property"]),
|
|
1031
|
-
scope: z.string(),
|
|
1032
|
-
matches: z.array(codeRefsMatchSchema).optional(),
|
|
1033
|
-
total: z.number().int().nonnegative().optional(),
|
|
1034
|
-
path: z.string().optional(),
|
|
1035
|
-
projection: z.literal("refused").optional(),
|
|
1036
|
-
reason: z.string().optional(),
|
|
1037
|
-
reasonDetail: z.string().optional(),
|
|
1038
|
-
next: z.array(z.string()).optional(),
|
|
1039
|
-
actual: actualSchema.optional(),
|
|
1040
|
-
source: z.literal("text_fallback"),
|
|
1041
|
-
provenance: codeRefsProvenanceSchema,
|
|
1042
|
-
layer: worldlineLayerSchema,
|
|
1043
|
-
}).strict(),
|
|
1044
|
-
daemon_repos: z.object({
|
|
1045
|
-
repos: z.array(daemonRepoSchema),
|
|
1046
|
-
filter: z.object({
|
|
1047
|
-
repoId: z.string().optional(),
|
|
1048
|
-
cwd: z.string().optional(),
|
|
1049
|
-
}).strict().optional(),
|
|
1050
|
-
}).strict(),
|
|
1051
|
-
daemon_status: daemonStatusSchema,
|
|
1052
|
-
daemon_sessions: z.object({
|
|
1053
|
-
sessions: z.array(daemonSessionSchema),
|
|
1054
|
-
}).strict(),
|
|
1055
|
-
daemon_monitors: z.object({
|
|
1056
|
-
monitors: z.array(monitorStatusSchema),
|
|
1057
|
-
}).strict(),
|
|
1058
|
-
monitor_start: monitorActionSchema,
|
|
1059
|
-
monitor_pause: monitorActionSchema,
|
|
1060
|
-
monitor_resume: monitorActionSchema,
|
|
1061
|
-
monitor_nudge: monitorActionSchema,
|
|
1062
|
-
monitor_stop: monitorActionSchema,
|
|
1063
|
-
workspace_authorize: workspaceAuthorizeSchema,
|
|
1064
|
-
workspace_authorizations: z.object({
|
|
1065
|
-
workspaces: z.array(authorizedWorkspaceSchema),
|
|
1066
|
-
}).strict(),
|
|
1067
|
-
workspace_revoke: workspaceRevokeSchema,
|
|
1068
|
-
workspace_bind: workspaceActionSchema.extend({
|
|
1069
|
-
action: z.literal("bind"),
|
|
1070
|
-
}).strict(),
|
|
1071
|
-
workspace_status: workspaceStatusSchema,
|
|
1072
|
-
activity_view: activityViewSchema,
|
|
1073
|
-
causal_status: causalStatusSchema,
|
|
1074
|
-
causal_attach: causalAttachSchema,
|
|
1075
|
-
workspace_rebind: workspaceActionSchema.extend({
|
|
1076
|
-
action: z.literal("rebind"),
|
|
1077
|
-
}).strict(),
|
|
1078
|
-
run_capture: z.object({
|
|
1079
|
-
output: z.string(),
|
|
1080
|
-
totalLines: z.number().int().nonnegative(),
|
|
1081
|
-
tailedLines: z.number().int().nonnegative(),
|
|
1082
|
-
logPath: z.string().nullable().optional(),
|
|
1083
|
-
logRedactions: z.number().int().nonnegative().optional(),
|
|
1084
|
-
logPersistenceEnabled: z.boolean().optional(),
|
|
1085
|
-
truncated: z.boolean(),
|
|
1086
|
-
disabled: z.boolean().optional(),
|
|
1087
|
-
error: z.string().optional(),
|
|
1088
|
-
stderr: z.string().optional(),
|
|
1089
|
-
policyBoundary: policyBoundarySchema,
|
|
1090
|
-
}).strict(),
|
|
1091
|
-
state_save: z.object({
|
|
1092
|
-
ok: z.boolean(),
|
|
1093
|
-
reason: z.string().optional(),
|
|
1094
|
-
}).strict(),
|
|
1095
|
-
state_load: z.object({
|
|
1096
|
-
content: z.string().nullable(),
|
|
1097
|
-
}).strict(),
|
|
1098
|
-
set_budget: z.object({
|
|
1099
|
-
budget: budgetSchema.nullable(),
|
|
1100
|
-
}).strict(),
|
|
1101
|
-
explain: z.object({
|
|
1102
|
-
code: z.string(),
|
|
1103
|
-
meaning: z.string().optional(),
|
|
1104
|
-
action: z.string().optional(),
|
|
1105
|
-
error: z.string().optional(),
|
|
1106
|
-
knownCodes: z.string().optional(),
|
|
1107
|
-
}).strict(),
|
|
1108
|
-
doctor: z.object({
|
|
1109
|
-
projectRoot: z.string(),
|
|
1110
|
-
parserHealthy: z.boolean(),
|
|
1111
|
-
thresholds: thresholdsSchema,
|
|
1112
|
-
sessionDepth: z.enum(["early", "mid", "late"]),
|
|
1113
|
-
totalMessages: z.number().int().nonnegative(),
|
|
1114
|
-
burdenSummary: burdenSummarySchema,
|
|
1115
|
-
runtimeObservability: runtimeObservabilitySchema,
|
|
1116
|
-
causalContext: runtimeCausalContextSchema,
|
|
1117
|
-
latestReadEvent: readEventSchema.nullable(),
|
|
1118
|
-
latestStageEvent: stageEventSchema.nullable(),
|
|
1119
|
-
latestTransitionEvent: transitionEventSchema.nullable(),
|
|
1120
|
-
repoConcurrency: repoConcurrencySummarySchema.nullable(),
|
|
1121
|
-
checkoutEpoch: z.number().int().nonnegative(),
|
|
1122
|
-
lastTransition: repoTransitionSchema.nullable(),
|
|
1123
|
-
semanticTransition: repoSemanticTransitionSchema.nullable(),
|
|
1124
|
-
workspaceOverlayId: z.string().nullable(),
|
|
1125
|
-
workspaceOverlay: workspaceOverlaySummarySchema.nullable(),
|
|
1126
|
-
workspaceOverlayFooting: workspaceOverlayFootingSchema,
|
|
1127
|
-
stagedTarget: runtimeStagedTargetSchema,
|
|
1128
|
-
attribution: attributionSummarySchema,
|
|
1129
|
-
persistedLocalHistory: persistedLocalHistorySummarySchema,
|
|
1130
|
-
recommendedNextAction: causalSurfaceNextActionSchema,
|
|
1131
|
-
sludge: sludgeReportSchema.optional(),
|
|
1132
|
-
}).strict(),
|
|
1133
|
-
stats: z.object({
|
|
1134
|
-
totalReads: z.number().int().nonnegative(),
|
|
1135
|
-
totalOutlines: z.number().int().nonnegative(),
|
|
1136
|
-
totalRefusals: z.number().int().nonnegative(),
|
|
1137
|
-
totalCacheHits: z.number().int().nonnegative(),
|
|
1138
|
-
totalBytesReturned: z.number().int().nonnegative(),
|
|
1139
|
-
totalBytesAvoidedByCache: z.number().int().nonnegative(),
|
|
1140
|
-
totalNonReadBytesReturned: z.number().int().nonnegative(),
|
|
1141
|
-
burdenByKind: burdenByKindSchema,
|
|
1142
|
-
}).strict(),
|
|
1143
|
-
graft_churn: z.object({
|
|
1144
|
-
entries: z.array(z.object({
|
|
1145
|
-
symbol: z.string(),
|
|
1146
|
-
filePath: z.string(),
|
|
1147
|
-
kind: z.string(),
|
|
1148
|
-
changeCount: z.number().int().positive(),
|
|
1149
|
-
lastChangedSha: z.string(),
|
|
1150
|
-
lastChangedDate: z.string(),
|
|
1151
|
-
}).strict()),
|
|
1152
|
-
totalSymbols: z.number().int().nonnegative(),
|
|
1153
|
-
totalCommitsAnalyzed: z.number().int().nonnegative(),
|
|
1154
|
-
summary: z.string(),
|
|
1155
|
-
}).strict(),
|
|
1156
|
-
graft_exports: z.object({
|
|
1157
|
-
base: z.string(),
|
|
1158
|
-
head: z.string(),
|
|
1159
|
-
added: z.array(z.object({
|
|
1160
|
-
symbol: z.string(),
|
|
1161
|
-
filePath: z.string(),
|
|
1162
|
-
kind: z.string(),
|
|
1163
|
-
changeType: z.literal("added"),
|
|
1164
|
-
signature: z.string().optional(),
|
|
1165
|
-
}).strict()),
|
|
1166
|
-
removed: z.array(z.object({
|
|
1167
|
-
symbol: z.string(),
|
|
1168
|
-
filePath: z.string(),
|
|
1169
|
-
kind: z.string(),
|
|
1170
|
-
changeType: z.literal("removed"),
|
|
1171
|
-
signature: z.string().optional(),
|
|
1172
|
-
}).strict()),
|
|
1173
|
-
changed: z.array(z.object({
|
|
1174
|
-
symbol: z.string(),
|
|
1175
|
-
filePath: z.string(),
|
|
1176
|
-
kind: z.string(),
|
|
1177
|
-
changeType: z.literal("signature_changed"),
|
|
1178
|
-
signature: z.string().optional(),
|
|
1179
|
-
previousSignature: z.string().optional(),
|
|
1180
|
-
}).strict()),
|
|
1181
|
-
semverImpact: z.enum(["major", "minor", "patch", "none"]),
|
|
1182
|
-
summary: z.string(),
|
|
1183
|
-
}).strict(),
|
|
1184
|
-
graft_log: z.object({
|
|
1185
|
-
entries: z.array(z.object({
|
|
1186
|
-
sha: z.string(),
|
|
1187
|
-
message: z.string(),
|
|
1188
|
-
author: z.string(),
|
|
1189
|
-
date: z.string(),
|
|
1190
|
-
symbols: z.object({
|
|
1191
|
-
added: z.array(z.object({
|
|
1192
|
-
name: z.string(),
|
|
1193
|
-
kind: z.string(),
|
|
1194
|
-
signature: z.string().optional(),
|
|
1195
|
-
exported: z.boolean(),
|
|
1196
|
-
filePath: z.string(),
|
|
1197
|
-
}).strict()),
|
|
1198
|
-
removed: z.array(z.object({
|
|
1199
|
-
name: z.string(),
|
|
1200
|
-
kind: z.string(),
|
|
1201
|
-
signature: z.string().optional(),
|
|
1202
|
-
exported: z.boolean(),
|
|
1203
|
-
filePath: z.string(),
|
|
1204
|
-
}).strict()),
|
|
1205
|
-
changed: z.array(z.object({
|
|
1206
|
-
name: z.string(),
|
|
1207
|
-
kind: z.string(),
|
|
1208
|
-
signature: z.string().optional(),
|
|
1209
|
-
exported: z.boolean(),
|
|
1210
|
-
filePath: z.string(),
|
|
1211
|
-
}).strict()),
|
|
1212
|
-
}).strict(),
|
|
1213
|
-
summary: z.string(),
|
|
1214
|
-
}).strict()),
|
|
1215
|
-
count: z.number().int().nonnegative(),
|
|
1216
|
-
layer: z.literal("commit_worldline"),
|
|
1217
|
-
}).strict(),
|
|
1218
|
-
graft_blame: z.object({
|
|
1219
|
-
symbol: z.string(),
|
|
1220
|
-
filePath: z.string(),
|
|
1221
|
-
changeCount: z.number().int().nonnegative(),
|
|
1222
|
-
createdInCommit: z.string().nullable(),
|
|
1223
|
-
lastSignatureChange: z.string().nullable(),
|
|
1224
|
-
referenceCount: z.number().int().nonnegative(),
|
|
1225
|
-
history: z.array(z.object({
|
|
1226
|
-
sha: z.string(),
|
|
1227
|
-
tick: z.number(),
|
|
1228
|
-
changeKind: z.string(),
|
|
1229
|
-
present: z.boolean(),
|
|
1230
|
-
signature: z.string().nullable(),
|
|
1231
|
-
}).strict()),
|
|
1232
|
-
}).strict(),
|
|
1233
|
-
graft_difficulty: z.object({
|
|
1234
|
-
symbol: z.string(),
|
|
1235
|
-
path: z.string().optional(),
|
|
1236
|
-
entries: z.array(z.object({
|
|
1237
|
-
symbol: z.string(),
|
|
1238
|
-
filePath: z.string(),
|
|
1239
|
-
kind: z.string(),
|
|
1240
|
-
score: z.number().nonnegative(),
|
|
1241
|
-
risk: z.enum(["low", "medium", "high"]),
|
|
1242
|
-
recommendation: z.enum(["refactor_freely", "refactor_with_tests", "plan_before_refactor"]),
|
|
1243
|
-
curvature: z.object({
|
|
1244
|
-
changeCount: z.number().int().nonnegative(),
|
|
1245
|
-
signatureChangeCount: z.number().int().nonnegative(),
|
|
1246
|
-
score: z.number().nonnegative(),
|
|
1247
|
-
}).strict(),
|
|
1248
|
-
friction: z.object({
|
|
1249
|
-
referenceCount: z.number().int().nonnegative(),
|
|
1250
|
-
referencingFiles: z.array(z.string()),
|
|
1251
|
-
score: z.number().nonnegative(),
|
|
1252
|
-
}).strict(),
|
|
1253
|
-
}).strict()),
|
|
1254
|
-
total: z.number().int().nonnegative(),
|
|
1255
|
-
summary: z.string(),
|
|
1256
|
-
}).strict(),
|
|
1257
|
-
graft_review: z.object({
|
|
1258
|
-
base: z.string(),
|
|
1259
|
-
head: z.string(),
|
|
1260
|
-
totalFiles: z.number().int().nonnegative(),
|
|
1261
|
-
categories: z.object({
|
|
1262
|
-
structural: z.number().int().nonnegative(),
|
|
1263
|
-
formatting: z.number().int().nonnegative(),
|
|
1264
|
-
test: z.number().int().nonnegative(),
|
|
1265
|
-
docs: z.number().int().nonnegative(),
|
|
1266
|
-
config: z.number().int().nonnegative(),
|
|
1267
|
-
}).strict(),
|
|
1268
|
-
files: z.array(z.object({
|
|
1269
|
-
path: z.string(),
|
|
1270
|
-
category: z.enum(["structural", "formatting", "test", "docs", "config"]),
|
|
1271
|
-
structuralChanges: z.object({
|
|
1272
|
-
added: z.number().int().nonnegative(),
|
|
1273
|
-
removed: z.number().int().nonnegative(),
|
|
1274
|
-
changed: z.number().int().nonnegative(),
|
|
1275
|
-
}).strict().optional(),
|
|
1276
|
-
}).strict()),
|
|
1277
|
-
breakingChanges: z.array(z.object({
|
|
1278
|
-
symbol: z.string(),
|
|
1279
|
-
kind: z.string(),
|
|
1280
|
-
filePath: z.string(),
|
|
1281
|
-
changeType: z.enum(["removed_export", "signature_changed", "type_changed"]),
|
|
1282
|
-
previousSignature: z.string().optional(),
|
|
1283
|
-
newSignature: z.string().optional(),
|
|
1284
|
-
impactedFiles: z.number().int().nonnegative(),
|
|
1285
|
-
impactedFilePaths: z.array(z.string()),
|
|
1286
|
-
}).strict()),
|
|
1287
|
-
summary: z.string(),
|
|
1288
|
-
}).strict(),
|
|
1289
|
-
knowledge_map: z.object({
|
|
1290
|
-
totalFiles: z.number().int().nonnegative(),
|
|
1291
|
-
totalSymbols: z.number().int().nonnegative(),
|
|
1292
|
-
files: z.array(z.object({
|
|
1293
|
-
path: z.string(),
|
|
1294
|
-
symbols: z.array(z.string()),
|
|
1295
|
-
readCount: z.number().int().positive(),
|
|
1296
|
-
lastReadAt: z.string(),
|
|
1297
|
-
stale: z.boolean(),
|
|
1298
|
-
}).strict()),
|
|
1299
|
-
staleFiles: z.array(z.string()),
|
|
1300
|
-
directoryCoverage: z.record(z.string(), z.number().int().nonnegative()),
|
|
1301
|
-
}).strict(),
|
|
1302
|
-
};
|
|
1303
|
-
|
|
1304
|
-
export const MCP_OUTPUT_SCHEMAS: Record<McpToolName, z.ZodType> = {
|
|
1305
|
-
safe_read: withMcpCommon("safe_read", mcpOutputBodySchemas.safe_read),
|
|
1306
|
-
graft_edit: withMcpCommon("graft_edit", mcpOutputBodySchemas.graft_edit),
|
|
1307
|
-
file_outline: withMcpCommon("file_outline", mcpOutputBodySchemas.file_outline),
|
|
1308
|
-
read_range: withMcpCommon("read_range", mcpOutputBodySchemas.read_range),
|
|
1309
|
-
changed_since: withMcpCommon("changed_since", mcpOutputBodySchemas.changed_since),
|
|
1310
|
-
graft_diff: withMcpCommon("graft_diff", mcpOutputBodySchemas.graft_diff),
|
|
1311
|
-
graft_since: withMcpCommon("graft_since", mcpOutputBodySchemas.graft_since),
|
|
1312
|
-
graft_map: withMcpCommon("graft_map", mcpOutputBodySchemas.graft_map),
|
|
1313
|
-
code_show: withMcpCommon("code_show", mcpOutputBodySchemas.code_show),
|
|
1314
|
-
code_find: withMcpCommon("code_find", mcpOutputBodySchemas.code_find),
|
|
1315
|
-
code_refs: withMcpCommon("code_refs", mcpOutputBodySchemas.code_refs),
|
|
1316
|
-
daemon_repos: withMcpCommon("daemon_repos", mcpOutputBodySchemas.daemon_repos),
|
|
1317
|
-
daemon_status: withMcpCommon("daemon_status", mcpOutputBodySchemas.daemon_status),
|
|
1318
|
-
daemon_sessions: withMcpCommon("daemon_sessions", mcpOutputBodySchemas.daemon_sessions),
|
|
1319
|
-
daemon_monitors: withMcpCommon("daemon_monitors", mcpOutputBodySchemas.daemon_monitors),
|
|
1320
|
-
monitor_start: withMcpCommon("monitor_start", mcpOutputBodySchemas.monitor_start),
|
|
1321
|
-
monitor_pause: withMcpCommon("monitor_pause", mcpOutputBodySchemas.monitor_pause),
|
|
1322
|
-
monitor_resume: withMcpCommon("monitor_resume", mcpOutputBodySchemas.monitor_resume),
|
|
1323
|
-
monitor_nudge: withMcpCommon("monitor_nudge", mcpOutputBodySchemas.monitor_nudge),
|
|
1324
|
-
monitor_stop: withMcpCommon("monitor_stop", mcpOutputBodySchemas.monitor_stop),
|
|
1325
|
-
workspace_authorize: withMcpCommon("workspace_authorize", mcpOutputBodySchemas.workspace_authorize),
|
|
1326
|
-
workspace_authorizations: withMcpCommon(
|
|
1327
|
-
"workspace_authorizations",
|
|
1328
|
-
mcpOutputBodySchemas.workspace_authorizations,
|
|
1329
|
-
),
|
|
1330
|
-
workspace_revoke: withMcpCommon("workspace_revoke", mcpOutputBodySchemas.workspace_revoke),
|
|
1331
|
-
workspace_bind: withMcpCommon("workspace_bind", mcpOutputBodySchemas.workspace_bind),
|
|
1332
|
-
workspace_status: withMcpCommon("workspace_status", mcpOutputBodySchemas.workspace_status),
|
|
1333
|
-
activity_view: withMcpCommon("activity_view", mcpOutputBodySchemas.activity_view),
|
|
1334
|
-
causal_status: withMcpCommon("causal_status", mcpOutputBodySchemas.causal_status),
|
|
1335
|
-
causal_attach: withMcpCommon("causal_attach", mcpOutputBodySchemas.causal_attach),
|
|
1336
|
-
workspace_rebind: withMcpCommon("workspace_rebind", mcpOutputBodySchemas.workspace_rebind),
|
|
1337
|
-
run_capture: withMcpCommon("run_capture", mcpOutputBodySchemas.run_capture),
|
|
1338
|
-
state_save: withMcpCommon("state_save", mcpOutputBodySchemas.state_save),
|
|
1339
|
-
state_load: withMcpCommon("state_load", mcpOutputBodySchemas.state_load),
|
|
1340
|
-
set_budget: withMcpCommon("set_budget", mcpOutputBodySchemas.set_budget),
|
|
1341
|
-
explain: withMcpCommon("explain", mcpOutputBodySchemas.explain),
|
|
1342
|
-
doctor: withMcpCommon("doctor", mcpOutputBodySchemas.doctor),
|
|
1343
|
-
stats: withMcpCommon("stats", mcpOutputBodySchemas.stats),
|
|
1344
|
-
graft_churn: withMcpCommon("graft_churn", mcpOutputBodySchemas.graft_churn),
|
|
1345
|
-
graft_exports: withMcpCommon("graft_exports", mcpOutputBodySchemas.graft_exports),
|
|
1346
|
-
graft_log: withMcpCommon("graft_log", mcpOutputBodySchemas.graft_log),
|
|
1347
|
-
graft_blame: withMcpCommon("graft_blame", mcpOutputBodySchemas.graft_blame),
|
|
1348
|
-
graft_difficulty: withMcpCommon("graft_difficulty", mcpOutputBodySchemas.graft_difficulty),
|
|
1349
|
-
graft_review: withMcpCommon("graft_review", mcpOutputBodySchemas.graft_review),
|
|
1350
|
-
knowledge_map: withMcpCommon("knowledge_map", mcpOutputBodySchemas.knowledge_map),
|
|
1351
|
-
};
|
|
1352
|
-
|
|
1353
|
-
const initActionSchema = z.object({
|
|
1354
|
-
action: z.enum(["exists", "create", "append"]),
|
|
1355
|
-
label: z.string(),
|
|
1356
|
-
detail: z.string().optional(),
|
|
1357
|
-
}).strict();
|
|
1358
|
-
|
|
1359
|
-
const hooksConfigSchema = z.object({
|
|
1360
|
-
hooks: z.object({
|
|
1361
|
-
PreToolUse: z.array(z.object({
|
|
1362
|
-
matcher: z.literal("Read"),
|
|
1363
|
-
hooks: z.array(z.object({
|
|
1364
|
-
type: z.literal("command"),
|
|
1365
|
-
command: z.string(),
|
|
1366
|
-
}).strict()),
|
|
1367
|
-
}).strict()),
|
|
1368
|
-
PostToolUse: z.array(z.object({
|
|
1369
|
-
matcher: z.literal("Read"),
|
|
1370
|
-
hooks: z.array(z.object({
|
|
1371
|
-
type: z.literal("command"),
|
|
1372
|
-
command: z.string(),
|
|
1373
|
-
}).strict()),
|
|
1374
|
-
}).strict()),
|
|
1375
|
-
}).strict(),
|
|
1376
|
-
}).strict();
|
|
1377
|
-
|
|
1378
|
-
const suggestedMcpServerSchema = z.object({
|
|
1379
|
-
mcpServers: z.object({
|
|
1380
|
-
graft: z.object({
|
|
1381
|
-
command: z.literal("npx"),
|
|
1382
|
-
args: z.union([
|
|
1383
|
-
z.tuple([z.literal("-y"), z.literal("@flyingrobots/graft"), z.literal("serve")]),
|
|
1384
|
-
z.tuple([
|
|
1385
|
-
z.literal("-y"),
|
|
1386
|
-
z.literal("@flyingrobots/graft"),
|
|
1387
|
-
z.literal("serve"),
|
|
1388
|
-
z.literal("--runtime"),
|
|
1389
|
-
z.literal("daemon"),
|
|
1390
|
-
]),
|
|
1391
|
-
]),
|
|
1392
|
-
}).strict(),
|
|
1393
|
-
}).strict(),
|
|
1394
|
-
}).strict();
|
|
1395
|
-
|
|
1396
|
-
export const CLI_OUTPUT_SCHEMAS: Record<CliCommandName, z.ZodType> = {
|
|
1397
|
-
init: withCliCommon("init", z.object({
|
|
1398
|
-
ok: z.boolean(),
|
|
1399
|
-
cwd: z.string(),
|
|
1400
|
-
actions: z.array(initActionSchema).optional(),
|
|
1401
|
-
hooksConfig: hooksConfigSchema.optional(),
|
|
1402
|
-
suggestedMcpServer: suggestedMcpServerSchema.optional(),
|
|
1403
|
-
error: z.string().optional(),
|
|
1404
|
-
}).strict()),
|
|
1405
|
-
index: withCliCommon("index", z.object({
|
|
1406
|
-
ok: z.boolean(),
|
|
1407
|
-
cwd: z.string(),
|
|
1408
|
-
filesIndexed: z.number().int().nonnegative().optional(),
|
|
1409
|
-
nodesEmitted: z.number().int().nonnegative().optional(),
|
|
1410
|
-
error: z.string().optional(),
|
|
1411
|
-
}).strict()),
|
|
1412
|
-
read_safe: withCliPeerCommon("read_safe", mcpOutputBodySchemas.safe_read),
|
|
1413
|
-
read_outline: withCliPeerCommon("read_outline", mcpOutputBodySchemas.file_outline),
|
|
1414
|
-
read_range: withCliPeerCommon("read_range", mcpOutputBodySchemas.read_range),
|
|
1415
|
-
read_changed: withCliPeerCommon("read_changed", mcpOutputBodySchemas.changed_since),
|
|
1416
|
-
struct_diff: withCliPeerCommon("struct_diff", mcpOutputBodySchemas.graft_diff),
|
|
1417
|
-
struct_since: withCliPeerCommon("struct_since", mcpOutputBodySchemas.graft_since),
|
|
1418
|
-
struct_map: withCliPeerCommon("struct_map", mcpOutputBodySchemas.graft_map),
|
|
1419
|
-
symbol_show: withCliPeerCommon("symbol_show", mcpOutputBodySchemas.code_show),
|
|
1420
|
-
symbol_find: withCliPeerCommon("symbol_find", mcpOutputBodySchemas.code_find),
|
|
1421
|
-
struct_churn: withCliPeerCommon("struct_churn", mcpOutputBodySchemas.graft_churn),
|
|
1422
|
-
struct_exports: withCliPeerCommon("struct_exports", mcpOutputBodySchemas.graft_exports),
|
|
1423
|
-
struct_log: withCliPeerCommon("struct_log", mcpOutputBodySchemas.graft_log),
|
|
1424
|
-
symbol_blame: withCliPeerCommon("symbol_blame", mcpOutputBodySchemas.graft_blame),
|
|
1425
|
-
symbol_difficulty: withCliPeerCommon("symbol_difficulty", mcpOutputBodySchemas.graft_difficulty),
|
|
1426
|
-
struct_review: withCliPeerCommon("struct_review", mcpOutputBodySchemas.graft_review),
|
|
1427
|
-
diag_doctor: withCliPeerCommon("diag_doctor", mcpOutputBodySchemas.doctor),
|
|
1428
|
-
diag_activity: withCliPeerCommon("diag_activity", mcpOutputBodySchemas.activity_view),
|
|
1429
|
-
diag_explain: withCliPeerCommon("diag_explain", mcpOutputBodySchemas.explain),
|
|
1430
|
-
diag_stats: withCliPeerCommon("diag_stats", mcpOutputBodySchemas.stats),
|
|
1431
|
-
diag_capture: withCliPeerCommon("diag_capture", mcpOutputBodySchemas.run_capture),
|
|
1432
|
-
migrate_local_history: withCliCommon("migrate_local_history", z.object({
|
|
1433
|
-
cwd: z.string(),
|
|
1434
|
-
graftDir: z.string(),
|
|
1435
|
-
discoveredArtifacts: z.number().int().nonnegative(),
|
|
1436
|
-
migratedArtifacts: z.number().int().nonnegative(),
|
|
1437
|
-
malformedArtifacts: z.number().int().nonnegative(),
|
|
1438
|
-
importedContinuityRecords: z.number().int().nonnegative(),
|
|
1439
|
-
importedReadEvents: z.number().int().nonnegative(),
|
|
1440
|
-
importedStageEvents: z.number().int().nonnegative(),
|
|
1441
|
-
importedTransitionEvents: z.number().int().nonnegative(),
|
|
1442
|
-
skippedContinuityRecords: z.number().int().nonnegative(),
|
|
1443
|
-
skippedReadEvents: z.number().int().nonnegative(),
|
|
1444
|
-
skippedStageEvents: z.number().int().nonnegative(),
|
|
1445
|
-
skippedTransitionEvents: z.number().int().nonnegative(),
|
|
1446
|
-
error: z.string().optional(),
|
|
1447
|
-
}).strict()),
|
|
1448
|
-
diag_local_history_dag: withCliCommon("diag_local_history_dag", z.object({
|
|
1449
|
-
cwd: z.string(),
|
|
1450
|
-
repoId: z.string(),
|
|
1451
|
-
worktreeId: z.string(),
|
|
1452
|
-
requestedEventLimit: z.number().int().positive(),
|
|
1453
|
-
totalEventCount: z.number().int().nonnegative(),
|
|
1454
|
-
shownEventCount: z.number().int().nonnegative(),
|
|
1455
|
-
nodeCount: z.number().int().nonnegative(),
|
|
1456
|
-
edgeCount: z.number().int().nonnegative(),
|
|
1457
|
-
truncated: z.boolean(),
|
|
1458
|
-
rendered: z.string(),
|
|
1459
|
-
nodes: z.array(z.record(z.string(), z.unknown())),
|
|
1460
|
-
edges: z.array(z.record(z.string(), z.unknown())),
|
|
1461
|
-
error: z.string().optional(),
|
|
1462
|
-
}).strict()),
|
|
1463
|
-
git_graft_enhance: withCliCommon("git_graft_enhance", gitGraftEnhanceBodySchema),
|
|
1464
|
-
};
|
|
1465
|
-
|
|
1466
|
-
export function getMcpOutputSchemaMeta(tool: McpToolName): OutputSchemaMeta {
|
|
1467
|
-
return mcpOutputSchemaMeta[tool];
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
|
-
export function getCliOutputSchemaMeta(command: CliCommandName): OutputSchemaMeta {
|
|
1471
|
-
return cliOutputSchemaMeta[command];
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
|
-
export function getMcpOutputSchema(tool: McpToolName): z.ZodType {
|
|
1475
|
-
return MCP_OUTPUT_SCHEMAS[tool];
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1478
|
-
export function getCliOutputSchema(command: CliCommandName): z.ZodType {
|
|
1479
|
-
return CLI_OUTPUT_SCHEMAS[command];
|
|
1480
|
-
}
|
|
1481
|
-
|
|
1482
|
-
export function attachMcpSchemaMeta<T extends object>(
|
|
1483
|
-
tool: McpToolName,
|
|
1484
|
-
data: T,
|
|
1485
|
-
): T & { _schema: OutputSchemaMeta } {
|
|
1486
|
-
return { ...data, _schema: getMcpOutputSchemaMeta(tool) };
|
|
1487
|
-
}
|
|
1488
|
-
|
|
1489
|
-
export function attachCliSchemaMeta<T extends object>(
|
|
1490
|
-
command: CliCommandName,
|
|
1491
|
-
data: T,
|
|
1492
|
-
): T & { _schema: OutputSchemaMeta } {
|
|
1493
|
-
return { ...data, _schema: getCliOutputSchemaMeta(command) };
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
|
-
export function validateCliOutput(
|
|
1497
|
-
command: CliCommandName,
|
|
1498
|
-
data: unknown,
|
|
1499
|
-
): Record<string, unknown> {
|
|
1500
|
-
return CLI_OUTPUT_SCHEMAS[command].parse(data) as Record<string, unknown>;
|
|
1501
|
-
}
|
|
1502
|
-
|
|
1503
|
-
export function cliCommandMcpTool(command: CliCommandName): McpToolName | null {
|
|
1504
|
-
return CLI_COMMAND_TO_MCP_TOOL[command] ?? null;
|
|
1505
|
-
}
|
|
1506
|
-
|
|
1507
|
-
export function getMcpOutputJsonSchema(tool: McpToolName): unknown {
|
|
1508
|
-
return z.toJSONSchema(MCP_OUTPUT_SCHEMAS[tool]);
|
|
1509
|
-
}
|
|
1510
|
-
|
|
1511
|
-
export function getCliOutputJsonSchema(command: CliCommandName): unknown {
|
|
1512
|
-
return z.toJSONSchema(CLI_OUTPUT_SCHEMAS[command]);
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
/** Inferred output type for a given MCP tool name. */
|
|
1516
|
-
export type McpOutputFor<K extends McpToolName> = z.output<(typeof MCP_OUTPUT_SCHEMAS)[K]>;
|
|
1517
|
-
|
|
1518
|
-
/** Inferred output type for a given CLI command name. */
|
|
1519
|
-
export type CliOutputFor<K extends CliCommandName> = z.output<(typeof CLI_OUTPUT_SCHEMAS)[K]>;
|
|
1520
|
-
|
|
1521
|
-
export const DIAG_ACTIVITY_CLI_SCHEMA = activityViewSchema.extend({ _schema: z.unknown().optional(), _receipt: z.unknown().optional(), tripwire: z.unknown().optional() }).strict();
|
|
1522
|
-
|
|
1523
|
-
export const RECEIPT_SCHEMA = receiptSchema;
|
|
1524
|
-
export const RECEIPT_JSON_SCHEMA = z.toJSONSchema(receiptSchema);
|