wicked-crew 0.16.13 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/api/audit-view.d.ts +24 -0
- package/dist/api/audit-view.d.ts.map +1 -0
- package/dist/api/audit-view.js +70 -0
- package/dist/api/audit-view.js.map +1 -0
- package/dist/api/auth.d.ts +42 -2
- package/dist/api/auth.d.ts.map +1 -1
- package/dist/api/auth.js +157 -18
- package/dist/api/auth.js.map +1 -1
- package/dist/api/capture.d.ts +12 -59
- package/dist/api/capture.d.ts.map +1 -1
- package/dist/api/capture.js +9 -17
- package/dist/api/capture.js.map +1 -1
- package/dist/api/chat-context.d.ts +6 -62
- package/dist/api/chat-context.d.ts.map +1 -1
- package/dist/api/chat-context.js +6 -12
- package/dist/api/chat-context.js.map +1 -1
- package/dist/api/chat-mcp.d.ts +37 -0
- package/dist/api/chat-mcp.d.ts.map +1 -1
- package/dist/api/chat-mcp.js +118 -2
- package/dist/api/chat-mcp.js.map +1 -1
- package/dist/api/chat-proposals.d.ts +21 -149
- package/dist/api/chat-proposals.d.ts.map +1 -1
- package/dist/api/chat-proposals.js +2 -4
- package/dist/api/chat-proposals.js.map +1 -1
- package/dist/api/delivery-assurance.d.ts +3 -1
- package/dist/api/delivery-assurance.d.ts.map +1 -1
- package/dist/api/delivery-assurance.js +17 -0
- package/dist/api/delivery-assurance.js.map +1 -1
- package/dist/api/delivery-freeze.d.ts +2 -8
- package/dist/api/delivery-freeze.d.ts.map +1 -1
- package/dist/api/delivery-freeze.js +2 -4
- package/dist/api/delivery-freeze.js.map +1 -1
- package/dist/api/eval-sample.d.ts +18 -114
- package/dist/api/eval-sample.d.ts.map +1 -1
- package/dist/api/eval-sample.js +7 -13
- package/dist/api/eval-sample.js.map +1 -1
- package/dist/api/governance-steering.d.ts +27 -71
- package/dist/api/governance-steering.d.ts.map +1 -1
- package/dist/api/governance-steering.js +11 -19
- package/dist/api/governance-steering.js.map +1 -1
- package/dist/api/mcp.d.ts +159 -199
- package/dist/api/mcp.d.ts.map +1 -1
- package/dist/api/mcp.js +433 -68
- package/dist/api/mcp.js.map +1 -1
- package/dist/api/needs.d.ts +10 -0
- package/dist/api/needs.d.ts.map +1 -1
- package/dist/api/needs.js +77 -0
- package/dist/api/needs.js.map +1 -1
- package/dist/api/open-path.d.ts +10 -0
- package/dist/api/open-path.d.ts.map +1 -1
- package/dist/api/open-path.js +58 -1
- package/dist/api/open-path.js.map +1 -1
- package/dist/api/plan-schema.d.ts +8 -51
- package/dist/api/plan-schema.d.ts.map +1 -1
- package/dist/api/plan-schema.js +6 -6
- package/dist/api/plan-schema.js.map +1 -1
- package/dist/api/product.d.ts +3 -22
- package/dist/api/product.d.ts.map +1 -1
- package/dist/api/product.js +4 -6
- package/dist/api/product.js.map +1 -1
- package/dist/api/project-aggregates.d.ts +12 -20
- package/dist/api/project-aggregates.d.ts.map +1 -1
- package/dist/api/project-aggregates.js +3 -3
- package/dist/api/project-aggregates.js.map +1 -1
- package/dist/api/recording.d.ts +10 -37
- package/dist/api/recording.d.ts.map +1 -1
- package/dist/api/recording.js +9 -11
- package/dist/api/recording.js.map +1 -1
- package/dist/api/routes.d.ts +159 -1505
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +541 -130
- package/dist/api/routes.js.map +1 -1
- package/dist/api/seat-images.d.ts +10 -0
- package/dist/api/seat-images.d.ts.map +1 -1
- package/dist/api/seat-images.js +16 -3
- package/dist/api/seat-images.js.map +1 -1
- package/dist/api/server-error-body.d.ts +44 -0
- package/dist/api/server-error-body.d.ts.map +1 -0
- package/dist/api/server-error-body.js +206 -0
- package/dist/api/server-error-body.js.map +1 -0
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +176 -3
- package/dist/api/server.js.map +1 -1
- package/dist/api/skills.d.ts +12 -36
- package/dist/api/skills.d.ts.map +1 -1
- package/dist/api/skills.js +12 -15
- package/dist/api/skills.js.map +1 -1
- package/dist/api/system-snapshot.d.ts +1 -5
- package/dist/api/system-snapshot.d.ts.map +1 -1
- package/dist/api/system-snapshot.js +7 -15
- package/dist/api/system-snapshot.js.map +1 -1
- package/dist/api/testing.d.ts +29 -50
- package/dist/api/testing.d.ts.map +1 -1
- package/dist/api/testing.js +7 -13
- package/dist/api/testing.js.map +1 -1
- package/dist/apps/actions/api-action.d.ts +47 -0
- package/dist/apps/actions/api-action.d.ts.map +1 -0
- package/dist/apps/actions/api-action.js +135 -0
- package/dist/apps/actions/api-action.js.map +1 -0
- package/dist/apps/actions/pg-fit.d.ts +27 -0
- package/dist/apps/actions/pg-fit.d.ts.map +1 -0
- package/dist/apps/actions/pg-fit.js +35 -0
- package/dist/apps/actions/pg-fit.js.map +1 -0
- package/dist/apps/actions/pg-write.d.ts +84 -0
- package/dist/apps/actions/pg-write.d.ts.map +1 -0
- package/dist/apps/actions/pg-write.js +161 -0
- package/dist/apps/actions/pg-write.js.map +1 -0
- package/dist/apps/actions/store.d.ts +109 -0
- package/dist/apps/actions/store.d.ts.map +1 -0
- package/dist/apps/actions/store.js +182 -0
- package/dist/apps/actions/store.js.map +1 -0
- package/dist/apps/actions/values.d.ts +59 -0
- package/dist/apps/actions/values.d.ts.map +1 -0
- package/dist/apps/actions/values.js +315 -0
- package/dist/apps/actions/values.js.map +1 -0
- package/dist/apps/actions/write-path.d.ts +103 -0
- package/dist/apps/actions/write-path.d.ts.map +1 -0
- package/dist/apps/actions/write-path.js +576 -0
- package/dist/apps/actions/write-path.js.map +1 -0
- package/dist/apps/check.d.ts +112 -0
- package/dist/apps/check.d.ts.map +1 -0
- package/dist/apps/check.js +358 -0
- package/dist/apps/check.js.map +1 -0
- package/dist/apps/exec/arg-types.d.ts +56 -0
- package/dist/apps/exec/arg-types.d.ts.map +1 -0
- package/dist/apps/exec/arg-types.js +234 -0
- package/dist/apps/exec/arg-types.js.map +1 -0
- package/dist/apps/exec/cache.d.ts +46 -0
- package/dist/apps/exec/cache.d.ts.map +1 -0
- package/dist/apps/exec/cache.js +93 -0
- package/dist/apps/exec/cache.js.map +1 -0
- package/dist/apps/exec/contract.d.ts +83 -0
- package/dist/apps/exec/contract.d.ts.map +1 -0
- package/dist/apps/exec/contract.js +220 -0
- package/dist/apps/exec/contract.js.map +1 -0
- package/dist/apps/exec/executor.d.ts +122 -0
- package/dist/apps/exec/executor.d.ts.map +1 -0
- package/dist/apps/exec/executor.js +455 -0
- package/dist/apps/exec/executor.js.map +1 -0
- package/dist/apps/exec/limits.d.ts +25 -0
- package/dist/apps/exec/limits.d.ts.map +1 -0
- package/dist/apps/exec/limits.js +71 -0
- package/dist/apps/exec/limits.js.map +1 -0
- package/dist/apps/exec/params.d.ts +34 -0
- package/dist/apps/exec/params.d.ts.map +1 -0
- package/dist/apps/exec/params.js +97 -0
- package/dist/apps/exec/params.js.map +1 -0
- package/dist/apps/exec/project.d.ts +67 -0
- package/dist/apps/exec/project.d.ts.map +1 -0
- package/dist/apps/exec/project.js +299 -0
- package/dist/apps/exec/project.js.map +1 -0
- package/dist/apps/exec/recall.d.ts +88 -0
- package/dist/apps/exec/recall.d.ts.map +1 -0
- package/dist/apps/exec/recall.js +301 -0
- package/dist/apps/exec/recall.js.map +1 -0
- package/dist/apps/exec/source-stage.d.ts +61 -0
- package/dist/apps/exec/source-stage.d.ts.map +1 -0
- package/dist/apps/exec/source-stage.js +540 -0
- package/dist/apps/exec/source-stage.js.map +1 -0
- package/dist/apps/exec/sources.d.ts +65 -0
- package/dist/apps/exec/sources.d.ts.map +1 -0
- package/dist/apps/exec/sources.js +77 -0
- package/dist/apps/exec/sources.js.map +1 -0
- package/dist/apps/exec/texts.d.ts +140 -0
- package/dist/apps/exec/texts.d.ts.map +1 -0
- package/dist/apps/exec/texts.js +76 -0
- package/dist/apps/exec/texts.js.map +1 -0
- package/dist/apps/exec/viewer.d.ts +11 -0
- package/dist/apps/exec/viewer.d.ts.map +1 -0
- package/dist/apps/exec/viewer.js +26 -0
- package/dist/apps/exec/viewer.js.map +1 -0
- package/dist/apps/git.d.ts +109 -0
- package/dist/apps/git.d.ts.map +1 -0
- package/dist/apps/git.js +361 -0
- package/dist/apps/git.js.map +1 -0
- package/dist/apps/publish/image.d.ts +25 -0
- package/dist/apps/publish/image.d.ts.map +1 -0
- package/dist/apps/publish/image.js +86 -0
- package/dist/apps/publish/image.js.map +1 -0
- package/dist/apps/publish/layout.d.ts +41 -0
- package/dist/apps/publish/layout.d.ts.map +1 -0
- package/dist/apps/publish/layout.js +31 -0
- package/dist/apps/publish/layout.js.map +1 -0
- package/dist/apps/publish/manifest.d.ts +64 -0
- package/dist/apps/publish/manifest.d.ts.map +1 -0
- package/dist/apps/publish/manifest.js +282 -0
- package/dist/apps/publish/manifest.js.map +1 -0
- package/dist/apps/publish/pack.d.ts +40 -0
- package/dist/apps/publish/pack.d.ts.map +1 -0
- package/dist/apps/publish/pack.js +78 -0
- package/dist/apps/publish/pack.js.map +1 -0
- package/dist/apps/routes.d.ts +103 -0
- package/dist/apps/routes.d.ts.map +1 -0
- package/dist/apps/routes.js +440 -0
- package/dist/apps/routes.js.map +1 -0
- package/dist/apps/spec.d.ts +322 -2640
- package/dist/apps/spec.d.ts.map +1 -1
- package/dist/apps/spec.js +89 -120
- package/dist/apps/spec.js.map +1 -1
- package/dist/apps/store.d.ts +341 -0
- package/dist/apps/store.d.ts.map +1 -0
- package/dist/apps/store.js +905 -0
- package/dist/apps/store.js.map +1 -0
- package/dist/apps/turns.d.ts +169 -0
- package/dist/apps/turns.d.ts.map +1 -0
- package/dist/apps/turns.js +556 -0
- package/dist/apps/turns.js.map +1 -0
- package/dist/apps/views.d.ts +44 -0
- package/dist/apps/views.d.ts.map +1 -0
- package/dist/apps/views.js +53 -0
- package/dist/apps/views.js.map +1 -0
- package/dist/campaigns/routes.d.ts +22 -94
- package/dist/campaigns/routes.d.ts.map +1 -1
- package/dist/campaigns/routes.js +8 -14
- package/dist/campaigns/routes.js.map +1 -1
- package/dist/cli/apps-check.d.ts +43 -0
- package/dist/cli/apps-check.d.ts.map +1 -0
- package/dist/cli/apps-check.js +166 -0
- package/dist/cli/apps-check.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +6 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/mcp.js +2 -2
- package/dist/cli/mcp.js.map +1 -1
- package/dist/core/adapter.d.ts +23 -0
- package/dist/core/adapter.d.ts.map +1 -1
- package/dist/core/adapter.js +49 -1
- package/dist/core/adapter.js.map +1 -1
- package/dist/core/deliver-text.d.ts +25 -0
- package/dist/core/deliver-text.d.ts.map +1 -1
- package/dist/core/deliver-text.js +50 -5
- package/dist/core/deliver-text.js.map +1 -1
- package/dist/core/deliver.d.ts.map +1 -1
- package/dist/core/deliver.js +6 -0
- package/dist/core/deliver.js.map +1 -1
- package/dist/core/estate-mcp-client.d.ts +9 -0
- package/dist/core/estate-mcp-client.d.ts.map +1 -1
- package/dist/core/estate-mcp-client.js +31 -3
- package/dist/core/estate-mcp-client.js.map +1 -1
- package/dist/core/linked-issues.d.ts +51 -3
- package/dist/core/linked-issues.d.ts.map +1 -1
- package/dist/core/linked-issues.js +59 -14
- package/dist/core/linked-issues.js.map +1 -1
- package/dist/decisions/chat-recorder.js +1 -1
- package/dist/decisions/chat-recorder.js.map +1 -1
- package/dist/decisions/routes.d.ts.map +1 -1
- package/dist/decisions/routes.js +5 -9
- package/dist/decisions/routes.js.map +1 -1
- package/dist/decisions/rules-brief.d.ts +76 -0
- package/dist/decisions/rules-brief.d.ts.map +1 -0
- package/dist/decisions/rules-brief.js +179 -0
- package/dist/decisions/rules-brief.js.map +1 -0
- package/dist/editors/registry.d.ts +97 -258
- package/dist/editors/registry.d.ts.map +1 -1
- package/dist/editors/registry.js +11 -11
- package/dist/editors/registry.js.map +1 -1
- package/dist/editors/routes.js +3 -3
- package/dist/editors/routes.js.map +1 -1
- package/dist/evals/routes.d.ts.map +1 -1
- package/dist/evals/routes.js +3 -5
- package/dist/evals/routes.js.map +1 -1
- package/dist/insights/routes.js +2 -2
- package/dist/insights/routes.js.map +1 -1
- package/dist/interactive/proxy-routes.d.ts.map +1 -1
- package/dist/interactive/proxy-routes.js +76 -7
- package/dist/interactive/proxy-routes.js.map +1 -1
- package/dist/interactive/ws-relay.d.ts +3 -9
- package/dist/interactive/ws-relay.d.ts.map +1 -1
- package/dist/interactive/ws-relay.js +4 -6
- package/dist/interactive/ws-relay.js.map +1 -1
- package/dist/knowledge/adapters/native.d.ts +44 -0
- package/dist/knowledge/adapters/native.d.ts.map +1 -0
- package/dist/knowledge/adapters/native.js +60 -0
- package/dist/knowledge/adapters/native.js.map +1 -0
- package/dist/knowledge/adapters/toolbox/binary.d.ts +48 -0
- package/dist/knowledge/adapters/toolbox/binary.d.ts.map +1 -0
- package/dist/knowledge/adapters/toolbox/binary.js +145 -0
- package/dist/knowledge/adapters/toolbox/binary.js.map +1 -0
- package/dist/knowledge/adapters/toolbox/catalog.d.ts +22 -0
- package/dist/knowledge/adapters/toolbox/catalog.d.ts.map +1 -0
- package/dist/knowledge/adapters/toolbox/catalog.js +87 -0
- package/dist/knowledge/adapters/toolbox/catalog.js.map +1 -0
- package/dist/knowledge/adapters/toolbox/document.d.ts +71 -0
- package/dist/knowledge/adapters/toolbox/document.d.ts.map +1 -0
- package/dist/knowledge/adapters/toolbox/document.js +165 -0
- package/dist/knowledge/adapters/toolbox/document.js.map +1 -0
- package/dist/knowledge/adapters/toolbox/supervisor.d.ts +142 -0
- package/dist/knowledge/adapters/toolbox/supervisor.d.ts.map +1 -0
- package/dist/knowledge/adapters/toolbox/supervisor.js +438 -0
- package/dist/knowledge/adapters/toolbox/supervisor.js.map +1 -0
- package/dist/knowledge/gate/access.d.ts +36 -0
- package/dist/knowledge/gate/access.d.ts.map +1 -0
- package/dist/knowledge/gate/access.js +46 -0
- package/dist/knowledge/gate/access.js.map +1 -0
- package/dist/knowledge/gate/envelope.d.ts +67 -0
- package/dist/knowledge/gate/envelope.d.ts.map +1 -0
- package/dist/knowledge/gate/envelope.js +96 -0
- package/dist/knowledge/gate/envelope.js.map +1 -0
- package/dist/knowledge/gate/gate.d.ts +238 -0
- package/dist/knowledge/gate/gate.d.ts.map +1 -0
- package/dist/knowledge/gate/gate.js +782 -0
- package/dist/knowledge/gate/gate.js.map +1 -0
- package/dist/knowledge/gate/pg.d.ts +57 -0
- package/dist/knowledge/gate/pg.d.ts.map +1 -0
- package/dist/knowledge/gate/pg.js +94 -0
- package/dist/knowledge/gate/pg.js.map +1 -0
- package/dist/knowledge/gate/record.d.ts +77 -0
- package/dist/knowledge/gate/record.d.ts.map +1 -0
- package/dist/knowledge/gate/record.js +205 -0
- package/dist/knowledge/gate/record.js.map +1 -0
- package/dist/knowledge/gate/routes.d.ts +38 -0
- package/dist/knowledge/gate/routes.d.ts.map +1 -0
- package/dist/knowledge/gate/routes.js +102 -0
- package/dist/knowledge/gate/routes.js.map +1 -0
- package/dist/knowledge/gate/scheduler.d.ts +90 -0
- package/dist/knowledge/gate/scheduler.d.ts.map +1 -0
- package/dist/knowledge/gate/scheduler.js +224 -0
- package/dist/knowledge/gate/scheduler.js.map +1 -0
- package/dist/knowledge/gate/sources.d.ts +69 -0
- package/dist/knowledge/gate/sources.d.ts.map +1 -0
- package/dist/knowledge/gate/sources.js +135 -0
- package/dist/knowledge/gate/sources.js.map +1 -0
- package/dist/knowledge/package.d.ts +136 -0
- package/dist/knowledge/package.d.ts.map +1 -0
- package/dist/knowledge/package.js +148 -0
- package/dist/knowledge/package.js.map +1 -0
- package/dist/knowledge/projector.d.ts +144 -0
- package/dist/knowledge/projector.d.ts.map +1 -0
- package/dist/knowledge/projector.js +287 -0
- package/dist/knowledge/projector.js.map +1 -0
- package/dist/knowledge/registry/entry.d.ts +177 -0
- package/dist/knowledge/registry/entry.d.ts.map +1 -0
- package/dist/knowledge/registry/entry.js +126 -0
- package/dist/knowledge/registry/entry.js.map +1 -0
- package/dist/knowledge/registry/policy.d.ts +79 -0
- package/dist/knowledge/registry/policy.d.ts.map +1 -0
- package/dist/knowledge/registry/policy.js +139 -0
- package/dist/knowledge/registry/policy.js.map +1 -0
- package/dist/knowledge/shapes/code-search.d.ts +55 -0
- package/dist/knowledge/shapes/code-search.d.ts.map +1 -0
- package/dist/knowledge/shapes/code-search.js +88 -0
- package/dist/knowledge/shapes/code-search.js.map +1 -0
- package/dist/knowledge/shapes/map.d.ts +25 -0
- package/dist/knowledge/shapes/map.d.ts.map +1 -0
- package/dist/knowledge/shapes/map.js +187 -0
- package/dist/knowledge/shapes/map.js.map +1 -0
- package/dist/knowledge/shapes/profile.d.ts +117 -0
- package/dist/knowledge/shapes/profile.d.ts.map +1 -0
- package/dist/knowledge/shapes/profile.js +264 -0
- package/dist/knowledge/shapes/profile.js.map +1 -0
- package/dist/knowledge/shapes/routes.d.ts +69 -0
- package/dist/knowledge/shapes/routes.d.ts.map +1 -0
- package/dist/knowledge/shapes/routes.js +270 -0
- package/dist/knowledge/shapes/routes.js.map +1 -0
- package/dist/knowledge/shapes/shapes.d.ts +144 -0
- package/dist/knowledge/shapes/shapes.d.ts.map +1 -0
- package/dist/knowledge/shapes/shapes.js +280 -0
- package/dist/knowledge/shapes/shapes.js.map +1 -0
- package/dist/knowledge/shapes/verified.d.ts +36 -0
- package/dist/knowledge/shapes/verified.d.ts.map +1 -0
- package/dist/knowledge/shapes/verified.js +73 -0
- package/dist/knowledge/shapes/verified.js.map +1 -0
- package/dist/knowledge/summary.d.ts +45 -0
- package/dist/knowledge/summary.d.ts.map +1 -0
- package/dist/knowledge/summary.js +119 -0
- package/dist/knowledge/summary.js.map +1 -0
- package/dist/knowledge/trackers/actions.d.ts +55 -0
- package/dist/knowledge/trackers/actions.d.ts.map +1 -0
- package/dist/knowledge/trackers/actions.js +327 -0
- package/dist/knowledge/trackers/actions.js.map +1 -0
- package/dist/knowledge/trackers/addresses.d.ts +45 -0
- package/dist/knowledge/trackers/addresses.d.ts.map +1 -0
- package/dist/knowledge/trackers/addresses.js +59 -0
- package/dist/knowledge/trackers/addresses.js.map +1 -0
- package/dist/knowledge/trackers/bindings.d.ts +190 -0
- package/dist/knowledge/trackers/bindings.d.ts.map +1 -0
- package/dist/knowledge/trackers/bindings.js +970 -0
- package/dist/knowledge/trackers/bindings.js.map +1 -0
- package/dist/knowledge/trackers/gate-pm.d.ts +160 -0
- package/dist/knowledge/trackers/gate-pm.d.ts.map +1 -0
- package/dist/knowledge/trackers/gate-pm.js +427 -0
- package/dist/knowledge/trackers/gate-pm.js.map +1 -0
- package/dist/knowledge/trackers/issues.d.ts +69 -0
- package/dist/knowledge/trackers/issues.d.ts.map +1 -0
- package/dist/knowledge/trackers/issues.js +193 -0
- package/dist/knowledge/trackers/issues.js.map +1 -0
- package/dist/knowledge/trackers/map.d.ts +23 -0
- package/dist/knowledge/trackers/map.d.ts.map +1 -0
- package/dist/knowledge/trackers/map.js +130 -0
- package/dist/knowledge/trackers/map.js.map +1 -0
- package/dist/knowledge/trackers/projector.d.ts +113 -0
- package/dist/knowledge/trackers/projector.d.ts.map +1 -0
- package/dist/knowledge/trackers/projector.js +274 -0
- package/dist/knowledge/trackers/projector.js.map +1 -0
- package/dist/knowledge/trackers/routes.d.ts +107 -0
- package/dist/knowledge/trackers/routes.d.ts.map +1 -0
- package/dist/knowledge/trackers/routes.js +563 -0
- package/dist/knowledge/trackers/routes.js.map +1 -0
- package/dist/knowledge/trackers/set.d.ts +61 -0
- package/dist/knowledge/trackers/set.d.ts.map +1 -0
- package/dist/knowledge/trackers/set.js +77 -0
- package/dist/knowledge/trackers/set.js.map +1 -0
- package/dist/knowledge/trackers/view.d.ts +22 -0
- package/dist/knowledge/trackers/view.d.ts.map +1 -0
- package/dist/knowledge/trackers/view.js +31 -0
- package/dist/knowledge/trackers/view.js.map +1 -0
- package/dist/knowledge/trackers/visible.d.ts +9 -0
- package/dist/knowledge/trackers/visible.d.ts.map +1 -0
- package/dist/knowledge/trackers/visible.js +10 -0
- package/dist/knowledge/trackers/visible.js.map +1 -0
- package/dist/learn/routes.d.ts +3 -17
- package/dist/learn/routes.d.ts.map +1 -1
- package/dist/learn/routes.js +4 -6
- package/dist/learn/routes.js.map +1 -1
- package/dist/mcp/ask-server.d.ts +6 -0
- package/dist/mcp/ask-server.d.ts.map +1 -1
- package/dist/mcp/ask-server.js +15 -9
- package/dist/mcp/ask-server.js.map +1 -1
- package/dist/mcp/broker.d.ts +16 -0
- package/dist/mcp/broker.d.ts.map +1 -1
- package/dist/mcp/broker.js +137 -3
- package/dist/mcp/broker.js.map +1 -1
- package/dist/mcp/estate-relay.d.ts +50 -2
- package/dist/mcp/estate-relay.d.ts.map +1 -1
- package/dist/mcp/estate-relay.js +126 -4
- package/dist/mcp/estate-relay.js.map +1 -1
- package/dist/mcp/invoke.d.ts +12 -1
- package/dist/mcp/invoke.d.ts.map +1 -1
- package/dist/mcp/invoke.js +5 -2
- package/dist/mcp/invoke.js.map +1 -1
- package/dist/mcp/probe.d.ts +34 -2
- package/dist/mcp/probe.d.ts.map +1 -1
- package/dist/mcp/probe.js +51 -9
- package/dist/mcp/probe.js.map +1 -1
- package/dist/mcp/registry-store.d.ts +91 -0
- package/dist/mcp/registry-store.d.ts.map +1 -1
- package/dist/mcp/registry-store.js +116 -9
- package/dist/mcp/registry-store.js.map +1 -1
- package/dist/mcp/registry.d.ts +249 -6
- package/dist/mcp/registry.d.ts.map +1 -1
- package/dist/mcp/registry.js +735 -35
- package/dist/mcp/registry.js.map +1 -1
- package/dist/mcp/rest.d.ts +36 -10
- package/dist/mcp/rest.d.ts.map +1 -1
- package/dist/mcp/rest.js +71 -73
- package/dist/mcp/rest.js.map +1 -1
- package/dist/mcp/tool-list.d.ts +7 -0
- package/dist/mcp/tool-list.d.ts.map +1 -1
- package/dist/mcp/tool-list.js +32 -4
- package/dist/mcp/tool-list.js.map +1 -1
- package/dist/mcp-inspect/routes.d.ts +3 -0
- package/dist/mcp-inspect/routes.d.ts.map +1 -1
- package/dist/mcp-inspect/routes.js +31 -18
- package/dist/mcp-inspect/routes.js.map +1 -1
- package/dist/persona/routes.d.ts +14 -69
- package/dist/persona/routes.d.ts.map +1 -1
- package/dist/persona/routes.js +2 -2
- package/dist/persona/routes.js.map +1 -1
- package/dist/persona/store.d.ts +13 -40
- package/dist/persona/store.d.ts.map +1 -1
- package/dist/persona/store.js +9 -11
- package/dist/persona/store.js.map +1 -1
- package/dist/presets/routes.d.ts +3 -21
- package/dist/presets/routes.d.ts.map +1 -1
- package/dist/presets/routes.js +5 -7
- package/dist/presets/routes.js.map +1 -1
- package/dist/projects/repo-guard.d.ts +32 -0
- package/dist/projects/repo-guard.d.ts.map +1 -0
- package/dist/projects/repo-guard.js +46 -0
- package/dist/projects/repo-guard.js.map +1 -0
- package/dist/projects/routes.d.ts +16 -44
- package/dist/projects/routes.d.ts.map +1 -1
- package/dist/projects/routes.js +15 -18
- package/dist/projects/routes.js.map +1 -1
- package/dist/schedules/routes.d.ts +4 -18
- package/dist/schedules/routes.d.ts.map +1 -1
- package/dist/schedules/routes.js +4 -6
- package/dist/schedules/routes.js.map +1 -1
- package/dist/skills/plugin-source.d.ts +6 -5
- package/dist/skills/plugin-source.d.ts.map +1 -1
- package/dist/skills/plugin-source.js +6 -5
- package/dist/skills/plugin-source.js.map +1 -1
- package/dist/sources/ask.d.ts +108 -0
- package/dist/sources/ask.d.ts.map +1 -0
- package/dist/sources/ask.js +251 -0
- package/dist/sources/ask.js.map +1 -0
- package/dist/sources/catalog/mysql.d.ts +9 -0
- package/dist/sources/catalog/mysql.d.ts.map +1 -0
- package/dist/sources/catalog/mysql.js +77 -0
- package/dist/sources/catalog/mysql.js.map +1 -0
- package/dist/sources/catalog/postgres.d.ts +68 -0
- package/dist/sources/catalog/postgres.d.ts.map +1 -0
- package/dist/sources/catalog/postgres.js +164 -0
- package/dist/sources/catalog/postgres.js.map +1 -0
- package/dist/sources/catalog/types.d.ts +53 -0
- package/dist/sources/catalog/types.d.ts.map +1 -0
- package/dist/sources/catalog/types.js +30 -0
- package/dist/sources/catalog/types.js.map +1 -0
- package/dist/sources/connection-test.d.ts +37 -0
- package/dist/sources/connection-test.d.ts.map +1 -0
- package/dist/sources/connection-test.js +101 -0
- package/dist/sources/connection-test.js.map +1 -0
- package/dist/sources/crew-source.d.ts +31 -0
- package/dist/sources/crew-source.d.ts.map +1 -0
- package/dist/sources/crew-source.js +48 -0
- package/dist/sources/crew-source.js.map +1 -0
- package/dist/sources/dialer.d.ts +169 -0
- package/dist/sources/dialer.d.ts.map +1 -0
- package/dist/sources/dialer.js +761 -0
- package/dist/sources/dialer.js.map +1 -0
- package/dist/sources/drivers/mysql.d.ts +52 -0
- package/dist/sources/drivers/mysql.d.ts.map +1 -0
- package/dist/sources/drivers/mysql.js +348 -0
- package/dist/sources/drivers/mysql.js.map +1 -0
- package/dist/sources/drivers/postgres.d.ts +84 -0
- package/dist/sources/drivers/postgres.d.ts.map +1 -0
- package/dist/sources/drivers/postgres.js +381 -0
- package/dist/sources/drivers/postgres.js.map +1 -0
- package/dist/sources/drivers/sqlite.d.ts +47 -0
- package/dist/sources/drivers/sqlite.d.ts.map +1 -0
- package/dist/sources/drivers/sqlite.js +156 -0
- package/dist/sources/drivers/sqlite.js.map +1 -0
- package/dist/sources/drivers/types.d.ts +79 -0
- package/dist/sources/drivers/types.d.ts.map +1 -0
- package/dist/sources/drivers/types.js +31 -0
- package/dist/sources/drivers/types.js.map +1 -0
- package/dist/sources/graphql.d.ts +85 -0
- package/dist/sources/graphql.d.ts.map +1 -0
- package/dist/sources/graphql.js +155 -0
- package/dist/sources/graphql.js.map +1 -0
- package/dist/sources/kinds.d.ts +79 -0
- package/dist/sources/kinds.d.ts.map +1 -0
- package/dist/sources/kinds.js +145 -0
- package/dist/sources/kinds.js.map +1 -0
- package/dist/sources/policy/allowlists.d.ts +30 -0
- package/dist/sources/policy/allowlists.d.ts.map +1 -0
- package/dist/sources/policy/allowlists.js +104 -0
- package/dist/sources/policy/allowlists.js.map +1 -0
- package/dist/sources/policy/index.d.ts +20 -0
- package/dist/sources/policy/index.d.ts.map +1 -0
- package/dist/sources/policy/index.js +34 -0
- package/dist/sources/policy/index.js.map +1 -0
- package/dist/sources/policy/mysql.d.ts +21 -0
- package/dist/sources/policy/mysql.d.ts.map +1 -0
- package/dist/sources/policy/mysql.js +834 -0
- package/dist/sources/policy/mysql.js.map +1 -0
- package/dist/sources/policy/pg.d.ts +37 -0
- package/dist/sources/policy/pg.d.ts.map +1 -0
- package/dist/sources/policy/pg.js +572 -0
- package/dist/sources/policy/pg.js.map +1 -0
- package/dist/sources/policy/sqlite.d.ts +37 -0
- package/dist/sources/policy/sqlite.d.ts.map +1 -0
- package/dist/sources/policy/sqlite.js +94 -0
- package/dist/sources/policy/sqlite.js.map +1 -0
- package/dist/sources/policy/types.d.ts +46 -0
- package/dist/sources/policy/types.d.ts.map +1 -0
- package/dist/sources/policy/types.js +13 -0
- package/dist/sources/policy/types.js.map +1 -0
- package/dist/sources/routes.d.ts +154 -0
- package/dist/sources/routes.d.ts.map +1 -0
- package/dist/sources/routes.js +745 -0
- package/dist/sources/routes.js.map +1 -0
- package/dist/sources/safety/postgres.d.ts +87 -0
- package/dist/sources/safety/postgres.d.ts.map +1 -0
- package/dist/sources/safety/postgres.js +349 -0
- package/dist/sources/safety/postgres.js.map +1 -0
- package/dist/sources/sql.d.ts +51 -0
- package/dist/sources/sql.d.ts.map +1 -0
- package/dist/sources/sql.js +89 -0
- package/dist/sources/sql.js.map +1 -0
- package/dist/sources/store.d.ts +25 -0
- package/dist/sources/store.d.ts.map +1 -0
- package/dist/sources/store.js +59 -0
- package/dist/sources/store.js.map +1 -0
- package/dist/sources/uploads.d.ts +70 -0
- package/dist/sources/uploads.d.ts.map +1 -0
- package/dist/sources/uploads.js +636 -0
- package/dist/sources/uploads.js.map +1 -0
- package/dist/standing-orders/parse.d.ts +38 -0
- package/dist/standing-orders/parse.d.ts.map +1 -1
- package/dist/standing-orders/parse.js +104 -43
- package/dist/standing-orders/parse.js.map +1 -1
- package/dist/standing-orders/routes.d.ts +25 -126
- package/dist/standing-orders/routes.d.ts.map +1 -1
- package/dist/standing-orders/routes.js +4 -6
- package/dist/standing-orders/routes.js.map +1 -1
- package/dist/standing-orders/store.d.ts +22 -73
- package/dist/standing-orders/store.d.ts.map +1 -1
- package/dist/standing-orders/store.js +8 -12
- package/dist/standing-orders/store.js.map +1 -1
- package/dist/studio/assets/KnowledgeGraph-Cpm46tEp.js +1 -0
- package/dist/studio/assets/WickedSansA-Regular-CGPJLyb8.woff2 +0 -0
- package/dist/studio/assets/WickedSansA-SemiBold-Bk9KXUaV.woff2 +0 -0
- package/dist/studio/assets/favicon-BJA6hF2f.svg +1 -0
- package/dist/studio/assets/index-BRBwWQMH.css +32 -0
- package/dist/studio/assets/index-CVrWDGRP.js +1097 -0
- package/dist/studio/assets/wicked-studio-lettering-small-CBwSGqop.svg +2 -0
- package/dist/studio/assets/wicked-studio-wordmark-small-gF5xn6IC.svg +2 -0
- package/dist/studio/editors/wicked-apps/editor.json +45 -0
- package/dist/studio/editors/wicked-apps/icon.svg +1 -0
- package/dist/studio/editors/wicked-apps/index.html +151 -0
- package/dist/studio/editors/wicked-deck/editor.json +1 -1
- package/dist/studio/editors/wicked-deck/index.html +12 -8
- package/dist/studio/editors/wicked-doc/editor.json +1 -1
- package/dist/studio/editors/wicked-doc/index.html +12 -8
- package/dist/studio/editors/wicked-insights/editor.json +1 -1
- package/dist/studio/editors/wicked-insights/index.html +1 -1
- package/dist/studio/editors/wicked-page/editor.json +1 -1
- package/dist/studio/editors/wicked-page/index.html +12 -8
- package/dist/studio/editors/wicked-video/editor.json +1 -1
- package/dist/studio/editors/wicked-video/index.html +1 -1
- package/dist/studio/fonts/LICENSE-WickedSans.txt +97 -0
- package/dist/studio/index.html +3 -2
- package/dist/studio/testid-inventory.json +10850 -6700
- package/dist/team/routes.d.ts +21 -172
- package/dist/team/routes.d.ts.map +1 -1
- package/dist/team/routes.js +4 -8
- package/dist/team/routes.js.map +1 -1
- package/dist/voice/dashboard.d.ts +35 -313
- package/dist/voice/dashboard.d.ts.map +1 -1
- package/dist/voice/dashboard.js +10 -10
- package/dist/voice/dashboard.js.map +1 -1
- package/dist/voice/routes.d.ts +2 -6
- package/dist/voice/routes.d.ts.map +1 -1
- package/dist/voice/routes.js +2 -2
- package/dist/voice/routes.js.map +1 -1
- package/dist/watch/checks/check-failed.d.ts +4 -10
- package/dist/watch/checks/check-failed.d.ts.map +1 -1
- package/dist/watch/checks/check-failed.js +6 -8
- package/dist/watch/checks/check-failed.js.map +1 -1
- package/dist/watch/checks/claim-vs-evidence.js +3 -3
- package/dist/watch/checks/claim-vs-evidence.js.map +1 -1
- package/dist/watch/checks/deliver-audit.js +3 -3
- package/dist/watch/checks/deliver-audit.js.map +1 -1
- package/dist/watch/checks/discovery.d.ts.map +1 -1
- package/dist/watch/checks/discovery.js +5 -7
- package/dist/watch/checks/discovery.js.map +1 -1
- package/dist/watch/checks/lag.d.ts +4 -10
- package/dist/watch/checks/lag.d.ts.map +1 -1
- package/dist/watch/checks/lag.js +6 -8
- package/dist/watch/checks/lag.js.map +1 -1
- package/dist/watch/checks/quiet-after-claim.js +3 -3
- package/dist/watch/checks/quiet-after-claim.js.map +1 -1
- package/dist/watch/checks/scope-drift.js +3 -3
- package/dist/watch/checks/scope-drift.js.map +1 -1
- package/dist/watch/checks/team-path.js +2 -2
- package/dist/watch/checks/team-path.js.map +1 -1
- package/dist/watch/checks/ungated.js +3 -3
- package/dist/watch/checks/ungated.js.map +1 -1
- package/dist/watch/checks/warned-rule.js +3 -3
- package/dist/watch/checks/warned-rule.js.map +1 -1
- package/dist/watch/loader.d.ts.map +1 -1
- package/dist/watch/loader.js +12 -16
- package/dist/watch/loader.js.map +1 -1
- package/dist/workflow-catalog/build.d.ts +2 -0
- package/dist/workflow-catalog/build.d.ts.map +1 -1
- package/dist/workflow-catalog/build.js +8 -4
- package/dist/workflow-catalog/build.js.map +1 -1
- package/dist/workflow-catalog/catalog-data.d.ts +7 -1
- package/dist/workflow-catalog/catalog-data.d.ts.map +1 -1
- package/dist/workflow-catalog/catalog-data.js +36 -7
- package/dist/workflow-catalog/catalog-data.js.map +1 -1
- package/dist/working-doc/service.d.ts.map +1 -1
- package/dist/working-doc/service.js +2 -1
- package/dist/working-doc/service.js.map +1 -1
- package/dist/zod.d.ts +39 -0
- package/dist/zod.d.ts.map +1 -0
- package/dist/zod.js +197 -0
- package/dist/zod.js.map +1 -0
- package/endpoint-manifest.json +617 -7
- package/package.json +10 -5
- package/runners/sqlite-runner.mjs +110 -0
- package/dist/studio/assets/WickedSans-Regular-fb698rcD.woff2 +0 -0
- package/dist/studio/assets/WickedSans-SemiBold-CD53n1AC.woff2 +0 -0
- package/dist/studio/assets/index-BUZ_-Syk.css +0 -32
- package/dist/studio/assets/index-u4O_7N-b.js +0 -986
package/dist/api/mcp.js
CHANGED
|
@@ -11,11 +11,18 @@
|
|
|
11
11
|
* is registered DISABLED; `enabledWrites` names the ones the operator
|
|
12
12
|
* grants (human operator only → else 403), each audited
|
|
13
13
|
* `mcp.tool.write_granted`.
|
|
14
|
-
* (G2) a `rest` base URL that matches none of the spec's `servers
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* (G2) a `rest` base URL that matches none of the spec's `servers` needs
|
|
15
|
+
* `allowOrigin` = exactly that origin (409 `egress_unconfirmed`; human
|
|
16
|
+
* operator only → else 403), audited `mcp.server.egress_confirmed`. A REST
|
|
17
|
+
* tool's hash covers the target, so a changed target re-registers its tools
|
|
18
|
+
* and withdraws their approvals.
|
|
19
|
+
* (DES-APPS-001 §5.2) every connection to an `mcp-http`/`rest` server goes
|
|
20
|
+
* through the one dialer: a loopback/private host needs `address.allow` on
|
|
21
|
+
* the PREVIEW (which dials) and the save, human operator only (403
|
|
22
|
+
* `address_confirm_human_only`), audited `mcp.server.address_confirmed`
|
|
23
|
+
* (crew#1316) a preview whose `auth.ref` names a secret it does not stage (an
|
|
24
|
+
* `env:` reference, a keychain entry crew already holds) probes with that
|
|
25
|
+
* secret: human operator only (403 `stored_secret_human_only`)
|
|
19
26
|
* PATCH /mcp/servers/:name `{enabled}`
|
|
20
27
|
* DELETE /mcp/servers/:name remove the server and the keychain secret it owns
|
|
21
28
|
* POST /mcp/servers/:name/test probe again: health plus the tool diff
|
|
@@ -50,52 +57,107 @@
|
|
|
50
57
|
* `POST /mcp/servers/preview` also answers the matrix (`policies`); a save that changes a saved
|
|
51
58
|
* tool's schema, and a removal, withdraw the approvals that named it, BEFORE the registry changes.
|
|
52
59
|
*
|
|
60
|
+
* DES-KNOWLEDGE-DATA-001 §5 (the one registry, B1):
|
|
61
|
+
*
|
|
62
|
+
* GET /mcp/servers?view=agent the agent-safe projection (crew#1310): every NON-HUMAN actor gets it
|
|
63
|
+
* whatever it asks; a human gets it on request. The answers of a save,
|
|
64
|
+
* `PATCH /mcp/servers/:name` and a test are projected the same way
|
|
65
|
+
* POST /mcp/servers/preview also `kind: "toolbox-source"` (Toolbox's own source document, checked
|
|
66
|
+
* against the deployment policy: 400 with the policy's code); a `sql`
|
|
67
|
+
* Postgres body is saved as the same document (descriptor version 2)
|
|
68
|
+
* POST /mcp/servers also `disclosures` (each tool's disclosure class): human operator only
|
|
69
|
+
* PATCH /mcp/tools/:subject also `disclosure`: setting one is human operator only
|
|
70
|
+
* GET /mcp/registry/generations the kept generations (human operator only)
|
|
71
|
+
* POST /mcp/registry/restore `{generation}`: restore one, failing closed (human operator only)
|
|
72
|
+
*
|
|
53
73
|
* The secret value is in no response, log, audit entry or file (D-2); tests/mcp-registry.test.ts
|
|
54
74
|
* scans all of them, a malformed secret body included.
|
|
55
75
|
*/
|
|
56
|
-
import { z } from 'zod';
|
|
57
|
-
import { MCP_SERVER_NAME_RE } from '../mcp/classify.js';
|
|
76
|
+
import { record, z } from '../zod.js';
|
|
77
|
+
import { canonicalJson, MCP_SERVER_NAME_RE } from '../mcp/classify.js';
|
|
58
78
|
import { MCP_PREVIEW_ROLES, MCP_RUN_MODES, McpLedgerEditError } from '../mcp/policies.js';
|
|
59
|
-
import { isWriteGrant, McpRegistryError } from '../mcp/registry.js';
|
|
79
|
+
import { agentServerView, configOf, isWriteGrant, McpRegistryError } from '../mcp/registry.js';
|
|
80
|
+
import { restTarget } from '../mcp/rest.js';
|
|
60
81
|
import { listUnitTools } from '../mcp/tool-list.js';
|
|
61
82
|
import { McpRegistryCorruptError } from '../mcp/registry-store.js';
|
|
62
83
|
import { parseSecretRef, SecretStoreError } from '../mcp/secrets.js';
|
|
63
84
|
import { foldMcpUsage, MCP_USAGE_DECISIONS, MCP_USAGE_DEFAULT_DAYS, MCP_USAGE_MAX_DAYS } from '../mcp/usage.js';
|
|
64
85
|
import { parseBaseUrl, REST_SPEC_MAX_BYTES } from '../mcp/rest.js';
|
|
86
|
+
import { NO_CONFIRMATION, validateAllowRanges } from '../sources/dialer.js';
|
|
65
87
|
import { API_PREFIX } from './api-prefix.js';
|
|
66
|
-
import { trustAtLeast } from './auth.js';
|
|
88
|
+
import { trustAtLeast, viewOf } from './auth.js';
|
|
67
89
|
const V = API_PREFIX;
|
|
68
90
|
const serverName = z.string().regex(MCP_SERVER_NAME_RE, 'a server name is 1-63 of a-z 0-9 _ -, starting with a letter or digit');
|
|
69
91
|
const toolClass = z.enum(['read', 'write', 'destructive']);
|
|
92
|
+
/** (DES-KNOWLEDGE-DATA-001 §7.1) What a tool's answer discloses. */
|
|
93
|
+
const disclosureClass = z.enum(['none', 'structure', 'rows']);
|
|
70
94
|
/** A pasted secret VALUE. Shared by the staged-secret preview field and `PUT …/secret` (crew#719). */
|
|
71
95
|
const secretValue = z
|
|
72
96
|
.string()
|
|
73
97
|
.min(8, 'a secret is at least 8 characters')
|
|
74
98
|
.max(8192)
|
|
75
|
-
.refine((v) => !/[\r\n\0]/.test(v), {
|
|
76
|
-
const AuthSchema = z
|
|
77
|
-
.
|
|
78
|
-
ref: z.string().refine((r) => parseSecretRef(r) !== null, { message: 'ref must be keychain:wicked-mcp/<name> or env:<NAME>' }),
|
|
99
|
+
.refine((v) => !/[\r\n\0]/.test(v), { error: 'a secret is one line' });
|
|
100
|
+
const AuthSchema = z.strictObject({
|
|
101
|
+
ref: z.string().refine((r) => parseSecretRef(r) !== null, { error: 'ref must be keychain:wicked-mcp/<name> or env:<NAME>' }),
|
|
79
102
|
env: z.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,127}$/).optional(),
|
|
80
103
|
header: z.string().regex(/^[A-Za-z0-9-]{1,64}$/).optional(),
|
|
81
104
|
prefix: z.string().max(32).optional(),
|
|
105
|
+
});
|
|
106
|
+
/** (DES-APPS-001 §5.2) A source's address confirmation: CIDRs inside loopback/private ranges only. */
|
|
107
|
+
export const AddressSchema = z.strictObject({
|
|
108
|
+
allow: z.array(z.string().min(1).max(64)).max(16),
|
|
109
|
+
plaintext: z.boolean().optional(),
|
|
82
110
|
})
|
|
83
|
-
.
|
|
111
|
+
.superRefine((a, ctx) => {
|
|
112
|
+
const problem = validateAllowRanges(a.allow);
|
|
113
|
+
if (problem !== null)
|
|
114
|
+
ctx.addIssue({ code: 'custom', path: ['allow'], message: problem });
|
|
115
|
+
});
|
|
116
|
+
/** (DES-APPS-001 §5.1) A network SQL source's settings; the password is `auth.ref`'s secret. */
|
|
117
|
+
export const SqlSourceSchema = z.strictObject({
|
|
118
|
+
driver: z.enum(['postgres', 'mysql']),
|
|
119
|
+
host: z.string().min(1).max(253).regex(/^[^\s/@?#]+$/, 'a host name or IP address'),
|
|
120
|
+
port: z.int().min(1).max(65_535).optional(),
|
|
121
|
+
database: z.string().min(1).max(128),
|
|
122
|
+
user: z.string().min(1).max(128),
|
|
123
|
+
tls: z.enum(['verify-full', 'disable']).optional(),
|
|
124
|
+
ca: z.string().min(1).max(65_536).optional(),
|
|
125
|
+
});
|
|
126
|
+
/**
|
|
127
|
+
* (DES-KNOWLEDGE-DATA-001 §5.1) Toolbox's source document, as sent: an object of at most 32 fields, each judged
|
|
128
|
+
* by the deployment policy (`knowledge/registry/policy.ts`) at the preview, not here.
|
|
129
|
+
*/
|
|
130
|
+
const ToolboxDocumentSchema = record(z.string().max(64), z.union([z.string().max(4096), z.number(), z.boolean(), z.null(), record(z.string(), z.unknown()), z.array(z.unknown())]))
|
|
131
|
+
.refine((d) => Object.keys(d).length <= 32, { error: 'a Toolbox source document has at most 32 fields' });
|
|
84
132
|
// Exported so tests/wire-contract.test.ts can pin the published bodies against them.
|
|
85
|
-
export const McpServerConfigSchema = z
|
|
86
|
-
.object({
|
|
133
|
+
export const McpServerConfigSchema = z.strictObject({
|
|
87
134
|
name: serverName,
|
|
88
|
-
kind: z.enum(['mcp-stdio', 'mcp-http', 'rest']),
|
|
135
|
+
kind: z.enum(['mcp-stdio', 'mcp-http', 'rest', 'sql', 'graphql', 'toolbox-source']),
|
|
89
136
|
command: z.string().min(1).max(4096).optional(),
|
|
90
137
|
args: z.array(z.string().max(4096)).max(64).optional(),
|
|
91
138
|
url: z.string().max(4096).optional(),
|
|
92
139
|
auth: AuthSchema.nullable().optional(),
|
|
93
140
|
openapiUrl: z.string().max(4096).optional(),
|
|
94
|
-
openapi: z
|
|
95
|
-
.
|
|
96
|
-
.refine((d) => Buffer.byteLength(JSON.stringify(d), 'utf8') <= REST_SPEC_MAX_BYTES, { message: `the OpenAPI document is at most ${REST_SPEC_MAX_BYTES} bytes` })
|
|
141
|
+
openapi: record(z.string(), z.unknown())
|
|
142
|
+
.refine((d) => Buffer.byteLength(JSON.stringify(d), 'utf8') <= REST_SPEC_MAX_BYTES, { error: `the OpenAPI document is at most ${REST_SPEC_MAX_BYTES} bytes` })
|
|
97
143
|
.optional(),
|
|
98
144
|
operations: z.array(z.string().min(1).max(256)).min(1).max(512).optional(),
|
|
145
|
+
/**
|
|
146
|
+
* (DES-APPS-001 §5.2) The loopback/private ranges the person confirms for this server's
|
|
147
|
+
* connections, and whether plaintext is accepted on a confirmed private range. Human operator
|
|
148
|
+
* only (403 `address_confirm_human_only`), on the preview (which dials) and the save; audited
|
|
149
|
+
* `mcp.server.address_confirmed`. `mcp-http` and `rest` only: an `mcp-stdio` server is a local
|
|
150
|
+
* program, outside the dialer.
|
|
151
|
+
*/
|
|
152
|
+
address: AddressSchema.optional(),
|
|
153
|
+
/** (DES-APPS-001 §5.1) `sql` only: a network SQL source's settings (sqlite sources come from uploads). */
|
|
154
|
+
sql: SqlSourceSchema.optional(),
|
|
155
|
+
/** `sql` only: the views a read may name (`schema.view`). */
|
|
156
|
+
viewsAllowed: z.array(z.string().min(3).max(256).regex(/^[^.\s]+\.[^.\s]+$/, 'a view is named schema.view')).max(256).optional(),
|
|
157
|
+
/** (DES-KNOWLEDGE-DATA-001 §5.1) `toolbox-source` only: Toolbox's own source document, its runtime and TLS choice. */
|
|
158
|
+
toolbox: ToolboxDocumentSchema.optional(),
|
|
159
|
+
runtime: z.enum(['native', 'toolbox']).optional(),
|
|
160
|
+
tls: z.strictObject({ mode: z.enum(['verify-full', 'disable']), ca: z.string().min(1).max(65_536).optional() }).optional(),
|
|
99
161
|
/**
|
|
100
162
|
* (crew#719) The secret VALUE this server's keychain entry will hold. The preview is probed
|
|
101
163
|
* with it and it is held with the preview; `POST /mcp/servers` writes it to the OS store as
|
|
@@ -103,10 +165,14 @@ export const McpServerConfigSchema = z
|
|
|
103
165
|
* `auth.ref` = `keychain:wicked-mcp/<name>`. It is in no response, log, audit entry or file.
|
|
104
166
|
*/
|
|
105
167
|
secret: secretValue.optional(),
|
|
168
|
+
/**
|
|
169
|
+
* (DES-PM-001 §3) `mcp-http` / `mcp-stdio` only: this server is a project-management system's own MCP server. A
|
|
170
|
+
* human operator's only (403 `pm_source_human_only`). `gitlab` and `ado` are wave PM-2.
|
|
171
|
+
*/
|
|
172
|
+
pm: z.strictObject({ system: z.enum(['github', 'jira']) }).optional(),
|
|
106
173
|
})
|
|
107
|
-
.strict()
|
|
108
174
|
.superRefine((c, ctx) => {
|
|
109
|
-
const issue = (path, message) => ctx.addIssue({ code:
|
|
175
|
+
const issue = (path, message) => ctx.addIssue({ code: 'custom', path: [path], message });
|
|
110
176
|
const httpUrl = (raw) => {
|
|
111
177
|
try {
|
|
112
178
|
const u = new URL(raw ?? '');
|
|
@@ -119,6 +185,43 @@ export const McpServerConfigSchema = z
|
|
|
119
185
|
if (c.kind !== 'rest' && (c.openapiUrl !== undefined || c.openapi !== undefined || c.operations !== undefined)) {
|
|
120
186
|
issue('openapi', 'openapiUrl, openapi and operations are for a rest server');
|
|
121
187
|
}
|
|
188
|
+
if (c.kind !== 'sql' && c.sql !== undefined)
|
|
189
|
+
issue('sql', 'sql is for a sql source');
|
|
190
|
+
if (c.pm !== undefined && c.kind !== 'mcp-http' && c.kind !== 'mcp-stdio')
|
|
191
|
+
issue('pm', 'pm marks a project-management system\'s own MCP server: kind mcp-http or mcp-stdio');
|
|
192
|
+
if (c.kind !== 'sql' && c.kind !== 'toolbox-source' && c.viewsAllowed !== undefined)
|
|
193
|
+
issue('viewsAllowed', 'viewsAllowed is for a sql or toolbox-source source');
|
|
194
|
+
if (c.kind !== 'toolbox-source' && (c.toolbox !== undefined || c.runtime !== undefined || c.tls !== undefined))
|
|
195
|
+
issue('toolbox', 'toolbox, runtime and tls are for a toolbox-source');
|
|
196
|
+
if (c.kind === 'toolbox-source') {
|
|
197
|
+
if (c.toolbox === undefined)
|
|
198
|
+
issue('toolbox', "a toolbox-source needs toolbox: Toolbox's own source document ({kind: 'source', type: 'postgres', host, port, database, user, password: '${WICKED_SRC_1}'})");
|
|
199
|
+
if (c.command !== undefined || c.args !== undefined || c.url !== undefined)
|
|
200
|
+
issue('url', 'a toolbox-source takes its Toolbox document, not a command or url');
|
|
201
|
+
if (c.auth != null && (c.auth.env !== undefined || c.auth.header !== undefined || c.auth.prefix !== undefined))
|
|
202
|
+
issue('auth', 'a toolbox-source takes its secret as auth.ref only');
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (c.kind === 'sql') {
|
|
206
|
+
if (c.sql === undefined)
|
|
207
|
+
issue('sql', 'a sql source needs sql: {driver, host, database, user} (a sqlite source comes from POST /apps/uploads)');
|
|
208
|
+
if (c.command !== undefined || c.args !== undefined || c.url !== undefined)
|
|
209
|
+
issue('url', 'a sql source takes sql settings, not a command or url');
|
|
210
|
+
if (c.auth != null && (c.auth.env !== undefined || c.auth.header !== undefined || c.auth.prefix !== undefined))
|
|
211
|
+
issue('auth', 'a sql source takes its password as auth.ref only');
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
if (c.kind === 'graphql') {
|
|
215
|
+
if (c.command !== undefined || c.args !== undefined)
|
|
216
|
+
issue('command', 'a graphql source takes a url, not a command');
|
|
217
|
+
if (!httpUrl(c.url))
|
|
218
|
+
issue('url', 'a graphql source needs an http(s) endpoint url');
|
|
219
|
+
else if (new URL(c.url ?? '').username + new URL(c.url ?? '').password !== '')
|
|
220
|
+
issue('url', 'the url must not carry credentials; reference the secret with auth.ref');
|
|
221
|
+
if (c.auth != null && (c.auth.header === undefined || c.auth.env !== undefined))
|
|
222
|
+
issue('auth', 'a graphql source injects its secret into one header: auth.header, no auth.env');
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
122
225
|
if (c.kind === 'rest') {
|
|
123
226
|
if (c.command !== undefined || c.args !== undefined)
|
|
124
227
|
issue('command', 'a rest server takes a base url, not a command');
|
|
@@ -136,6 +239,8 @@ export const McpServerConfigSchema = z
|
|
|
136
239
|
issue('auth', 'a rest server injects its secret into one header: auth.header, no auth.env');
|
|
137
240
|
}
|
|
138
241
|
else if (c.kind === 'mcp-stdio') {
|
|
242
|
+
if (c.address !== undefined)
|
|
243
|
+
issue('address', 'an mcp-stdio server is a local program, outside the dialer: it takes no address confirmation');
|
|
139
244
|
if (c.command === undefined)
|
|
140
245
|
issue('command', 'an mcp-stdio server needs a command');
|
|
141
246
|
if (c.url !== undefined)
|
|
@@ -160,31 +265,29 @@ export const McpServerConfigSchema = z
|
|
|
160
265
|
issue('auth', 'an mcp-http server injects its secret into one header: auth.header, no auth.env');
|
|
161
266
|
}
|
|
162
267
|
});
|
|
163
|
-
export const SaveMcpServerSchema = z
|
|
164
|
-
.object({
|
|
268
|
+
export const SaveMcpServerSchema = z.strictObject({
|
|
165
269
|
previewHash: z.string().min(1).max(128).optional(),
|
|
166
270
|
/** (G1) The write/destructive tools of the preview the operator grants: registered enabled. */
|
|
167
271
|
enabledWrites: z.array(z.string().min(1).max(256)).max(512).optional(),
|
|
168
272
|
/** (G2) The exact origin a `rest` server's calls go to, confirmed by a human operator. */
|
|
169
273
|
allowOrigin: z.string().min(1).max(4096).optional(),
|
|
170
|
-
|
|
171
|
-
.
|
|
172
|
-
|
|
173
|
-
export const
|
|
174
|
-
|
|
175
|
-
.
|
|
176
|
-
|
|
177
|
-
export const
|
|
178
|
-
export const
|
|
179
|
-
|
|
274
|
+
/** (DES-KNOWLEDGE-DATA-001 §5.1) Each tool's disclosure class, reviewed by a human operator. */
|
|
275
|
+
disclosures: record(z.string().min(1).max(256), disclosureClass).refine((d) => Object.keys(d).length <= 512, { error: 'at most 512 tools' }).optional(),
|
|
276
|
+
});
|
|
277
|
+
export const PatchMcpServerSchema = z.strictObject({ enabled: z.boolean() });
|
|
278
|
+
export const PatchMcpToolSchema = z.strictObject({ enabled: z.boolean().optional(), classOverride: toolClass.nullable().optional(), disclosure: disclosureClass.nullable().optional() })
|
|
279
|
+
.refine((p) => p.enabled !== undefined || p.classOverride !== undefined || p.disclosure !== undefined, { error: 'set enabled, classOverride, disclosure or a combination' });
|
|
280
|
+
/** Unknown query parameters (a cache-buster) are ignored, as they always were. */
|
|
281
|
+
export const McpServersQuerySchema = z.object({ view: z.enum(['full', 'agent']).optional() });
|
|
282
|
+
export const McpRegistryRestoreSchema = z.strictObject({ generation: z.int().min(1).max(Number.MAX_SAFE_INTEGER) });
|
|
283
|
+
export const PutMcpSecretSchema = z.strictObject({ value: secretValue });
|
|
284
|
+
export const McpCallSchema = z.strictObject({
|
|
180
285
|
token: z.string().min(1).max(256),
|
|
181
286
|
subject: z.string().min(1).max(512),
|
|
182
|
-
args:
|
|
183
|
-
})
|
|
184
|
-
|
|
185
|
-
export const
|
|
186
|
-
export const McpPolicyPreviewSchema = z
|
|
187
|
-
.object({
|
|
287
|
+
args: record(z.string(), z.unknown()).optional(),
|
|
288
|
+
});
|
|
289
|
+
export const McpToolsSchema = z.strictObject({ token: z.string().min(1).max(256) });
|
|
290
|
+
export const McpPolicyPreviewSchema = z.strictObject({
|
|
188
291
|
subject: z.string().min(1).max(256).optional(),
|
|
189
292
|
server: serverName.optional(),
|
|
190
293
|
phaseRole: z.enum(MCP_PREVIEW_ROLES).optional(),
|
|
@@ -192,17 +295,14 @@ export const McpPolicyPreviewSchema = z
|
|
|
192
295
|
mode: z.enum(MCP_RUN_MODES).optional(),
|
|
193
296
|
phaseId: z.string().regex(/^[A-Za-z0-9_.-]{1,128}$/).optional(),
|
|
194
297
|
})
|
|
195
|
-
.
|
|
196
|
-
|
|
197
|
-
export const
|
|
198
|
-
export const McpUsageQuerySchema = z
|
|
199
|
-
.object({
|
|
298
|
+
.refine((b) => b.subject === undefined || b.server === undefined, { error: 'give subject or server, not both' });
|
|
299
|
+
export const McpApprovalSchema = z.strictObject({ subject: z.string().min(5).max(256) });
|
|
300
|
+
export const McpUsageQuerySchema = z.strictObject({
|
|
200
301
|
days: z.coerce.number().int().min(1).max(MCP_USAGE_MAX_DAYS).optional(),
|
|
201
302
|
subject: z.string().min(1).max(512).optional(),
|
|
202
303
|
seat: z.string().regex(/^[A-Za-z0-9_.-]{1,64}$/).optional(),
|
|
203
304
|
decision: z.enum(MCP_USAGE_DECISIONS).optional(),
|
|
204
|
-
})
|
|
205
|
-
.strict();
|
|
305
|
+
});
|
|
206
306
|
function invalidBody(reply, err) {
|
|
207
307
|
return reply.code(400).send({ error: err.issues.map((i) => `${i.path.join('.') || 'body'}: ${i.message}`).join('; ') });
|
|
208
308
|
}
|
|
@@ -214,9 +314,12 @@ function auditPartial(deps, req, err, subjects) {
|
|
|
214
314
|
for (const id of err.changed)
|
|
215
315
|
deps.audit.record('governance.rule.upserted', deps.actorOf(req), { detail: { id, source: 'mcp-approval', partial: true } });
|
|
216
316
|
}
|
|
217
|
-
function fail(reply, err) {
|
|
218
|
-
if (err instanceof McpRegistryError)
|
|
219
|
-
|
|
317
|
+
function fail(reply, err, actor) {
|
|
318
|
+
if (err instanceof McpRegistryError) {
|
|
319
|
+
// A source's own words go to a human only (DES-APPS-001 §5.2); an agent gets crew's sentence.
|
|
320
|
+
const words = actor?.kind === 'human' && err.humanMessage !== undefined ? err.humanMessage : err.message;
|
|
321
|
+
return reply.code(err.status).send({ error: words, code: err.code });
|
|
322
|
+
}
|
|
220
323
|
if (err instanceof McpRegistryCorruptError)
|
|
221
324
|
return reply.code(503).send({ error: err.message, code: 'registry_corrupt' });
|
|
222
325
|
if (err instanceof SecretStoreError)
|
|
@@ -231,12 +334,46 @@ function fail(reply, err) {
|
|
|
231
334
|
function mayGrantWrite(actor) {
|
|
232
335
|
return actor.kind === 'human' && trustAtLeast(actor, 'operator');
|
|
233
336
|
}
|
|
337
|
+
/** (DES-KNOWLEDGE-DATA-001 §5.2) The full view is a human actor's; every other actor gets the agent-safe one. */
|
|
338
|
+
const sees = viewOf;
|
|
339
|
+
/** A server answer as `actor` may see it. */
|
|
340
|
+
function serverFor(actor, server) {
|
|
341
|
+
return sees(actor) === 'full' ? server : agentServerView(server);
|
|
342
|
+
}
|
|
343
|
+
function humanOperatorOnly(reply, actor, what, code) {
|
|
344
|
+
return reply.code(403).send({ error: `only a human operator can ${what}; you are ${actor.kind}/${actor.trust}`, code });
|
|
345
|
+
}
|
|
234
346
|
function writeGrantRefused(reply, actor) {
|
|
235
347
|
return reply.code(403).send({
|
|
236
348
|
error: `only a human operator can enable a write tool (a write grant); you are ${actor.kind}/${actor.trust}`,
|
|
237
349
|
code: 'write_grant_human_only',
|
|
238
350
|
});
|
|
239
351
|
}
|
|
352
|
+
/** Whether a confirmation actually confirms something (a range, or plaintext). */
|
|
353
|
+
function confirmsAddress(address) {
|
|
354
|
+
return address != null && (address.allow.length > 0 || address.plaintext === true);
|
|
355
|
+
}
|
|
356
|
+
function addressConfirmRefused(reply, actor) {
|
|
357
|
+
return reply.code(403).send({
|
|
358
|
+
error: `only a human operator can confirm a loopback or private range (or plaintext) for a server's connections; you are ${actor.kind}/${actor.trust}`,
|
|
359
|
+
code: 'address_confirm_human_only',
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* (crew#1316) Whether a preview names a secret the caller did not stage with it: an `env:` variable of the daemon,
|
|
364
|
+
* or a keychain entry crew already holds (another server's, or this name's own saved one). The preview probes with
|
|
365
|
+
* that secret, so it would go to a host the caller chose. A staged secret is the caller's own value, and the
|
|
366
|
+
* registry pins it to this server's own keychain reference (`secret_not_staged_here`), so it is not one.
|
|
367
|
+
*/
|
|
368
|
+
function namesStoredSecret(body) {
|
|
369
|
+
return body.auth != null && body.secret === undefined;
|
|
370
|
+
}
|
|
371
|
+
function storedSecretRefused(reply, actor) {
|
|
372
|
+
return reply.code(403).send({
|
|
373
|
+
error: `only a human operator can preview a server with a secret crew already holds (an env: reference, or a keychain entry this preview did not stage); you are ${actor.kind}/${actor.trust}`,
|
|
374
|
+
code: 'stored_secret_human_only',
|
|
375
|
+
});
|
|
376
|
+
}
|
|
240
377
|
function egressConfirmRefused(reply, actor) {
|
|
241
378
|
return reply.code(403).send({
|
|
242
379
|
error: `only a human operator can confirm where a rest server's calls go (allowOrigin); you are ${actor.kind}/${actor.trust}`,
|
|
@@ -250,9 +387,42 @@ function toConfig(body) {
|
|
|
250
387
|
command: body.command ?? null,
|
|
251
388
|
args: body.args ?? [],
|
|
252
389
|
url: body.url ?? null,
|
|
390
|
+
...(body.pm !== undefined ? { pm: { system: body.pm.system } } : {}),
|
|
253
391
|
...(body.kind === 'rest'
|
|
254
392
|
? { openapiUrl: body.openapiUrl ?? null, openapi: body.openapi ?? null, operations: body.operations ?? null }
|
|
255
393
|
: {}),
|
|
394
|
+
...(body.kind === 'sql' && body.sql !== undefined
|
|
395
|
+
? {
|
|
396
|
+
sql: {
|
|
397
|
+
driver: body.sql.driver,
|
|
398
|
+
host: body.sql.host,
|
|
399
|
+
port: body.sql.port ?? (body.sql.driver === 'postgres' ? 5432 : 3306),
|
|
400
|
+
database: body.sql.database,
|
|
401
|
+
user: body.sql.user,
|
|
402
|
+
tls: body.sql.tls ?? 'verify-full',
|
|
403
|
+
...(body.sql.ca !== undefined ? { ca: body.sql.ca } : {}),
|
|
404
|
+
},
|
|
405
|
+
viewsAllowed: body.viewsAllowed ?? [],
|
|
406
|
+
}
|
|
407
|
+
: {}),
|
|
408
|
+
// (DES-KNOWLEDGE-DATA-001 §5.1) The document as sent: the registry checks it against the deployment policy.
|
|
409
|
+
...(body.kind === 'toolbox-source' && body.toolbox !== undefined
|
|
410
|
+
? {
|
|
411
|
+
entry: {
|
|
412
|
+
toolbox: body.toolbox,
|
|
413
|
+
runtime: body.runtime ?? 'native',
|
|
414
|
+
tls: { mode: body.tls?.mode ?? 'verify-full', ca: body.tls?.ca ?? null },
|
|
415
|
+
descriptorVersion: 2,
|
|
416
|
+
policyVersion: '',
|
|
417
|
+
},
|
|
418
|
+
viewsAllowed: body.viewsAllowed ?? [],
|
|
419
|
+
}
|
|
420
|
+
: {}),
|
|
421
|
+
// A dialled server always carries its confirmation (none = global unicast over TLS only), so a
|
|
422
|
+
// save stores it and a legacy record is the only one ever derived (registry.ts legacyAddress).
|
|
423
|
+
...(body.kind !== 'mcp-stdio'
|
|
424
|
+
? { address: body.address === undefined ? { ...NO_CONFIRMATION, allow: [] } : { allow: [...body.address.allow], plaintext: body.address.plaintext ?? false } }
|
|
425
|
+
: {}),
|
|
256
426
|
auth: body.auth == null
|
|
257
427
|
? null
|
|
258
428
|
: {
|
|
@@ -263,6 +433,47 @@ function toConfig(body) {
|
|
|
263
433
|
},
|
|
264
434
|
};
|
|
265
435
|
}
|
|
436
|
+
/**
|
|
437
|
+
* (DES-KNOWLEDGE-DATA-001 §5.5) The approval tokens a restore withdraws: an approval covers a tool's SAVED schema,
|
|
438
|
+
* not its name. Every held token of a tool whose restored record is absent, was never saved (`schemaHash` null) or
|
|
439
|
+
* was saved under another schema is withdrawn, with its server's own token (a server-wide approval cannot leave one
|
|
440
|
+
* tool out); every token of a server the generation does not hold, or of a `rest` server whose target differs; and
|
|
441
|
+
* every token naming a server the generation brings back that is not registered now (an orphan).
|
|
442
|
+
*/
|
|
443
|
+
export async function restoreWithdrawals(p, current, restored) {
|
|
444
|
+
const out = new Set();
|
|
445
|
+
for (const now of current) {
|
|
446
|
+
const held = await p.tokensOf(now.name);
|
|
447
|
+
if (held.length === 0)
|
|
448
|
+
continue;
|
|
449
|
+
const then = restored.find((x) => x.name === now.name);
|
|
450
|
+
const targetChanged = then !== undefined && (now.kind === 'rest' || then.kind === 'rest') && canonicalJson(now.kind === 'rest' ? restTarget(now) : null) !== canonicalJson(then.kind === 'rest' ? restTarget(configOf(then)) : null);
|
|
451
|
+
if (then === undefined || targetChanged) {
|
|
452
|
+
for (const t of held)
|
|
453
|
+
out.add(t);
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
const changed = now.tools
|
|
457
|
+
.filter((t) => {
|
|
458
|
+
const was = then.tools.find((x) => x.name === t.name);
|
|
459
|
+
return was === undefined || was.schemaHash === null || was.schemaHash !== t.schemaHash;
|
|
460
|
+
})
|
|
461
|
+
.map((t) => t.subject);
|
|
462
|
+
const drop = new Set([...changed, ...(changed.length > 0 ? [`mcp:${now.name}`] : [])]);
|
|
463
|
+
for (const t of held)
|
|
464
|
+
if (drop.has(t))
|
|
465
|
+
out.add(t);
|
|
466
|
+
}
|
|
467
|
+
// codex r3: an approval naming a server that is not registered now covers nothing anyone reviewed; a restore that
|
|
468
|
+
// brings the name back must not hand it to that registration.
|
|
469
|
+
for (const then of restored) {
|
|
470
|
+
if (current.some((c) => c.name === then.name))
|
|
471
|
+
continue;
|
|
472
|
+
for (const t of await p.tokensOf(then.name))
|
|
473
|
+
out.add(t);
|
|
474
|
+
}
|
|
475
|
+
return [...out].sort();
|
|
476
|
+
}
|
|
266
477
|
export function registerMcpRoutes(app, deps) {
|
|
267
478
|
// The MCP ask tool (streamable HTTP, stateless): worker-facing, the unit token in Authorization.
|
|
268
479
|
app.post(`${V}/mcp/ask`, { config: { manifest: { statusCodes: [200, 401, 503] } } }, async (req, reply) => {
|
|
@@ -285,26 +496,49 @@ export function registerMcpRoutes(app, deps) {
|
|
|
285
496
|
void reply.code(503).send({ error: 'the MCP registry is not configured on this daemon', code: 'mcp_unavailable' });
|
|
286
497
|
return null;
|
|
287
498
|
};
|
|
288
|
-
app.get(`${V}/mcp/servers`, { config: { manifest: { responseType: 'McpServersResponse', statusCodes: [200, 503] } } }, async (
|
|
499
|
+
app.get(`${V}/mcp/servers`, { config: { manifest: { responseType: 'McpServersResponse | McpServersAgentResponse', statusCodes: [200, 400, 503] } } }, async (req, reply) => {
|
|
289
500
|
const r = registry(reply);
|
|
290
501
|
if (r === null)
|
|
291
502
|
return reply;
|
|
503
|
+
const q = McpServersQuerySchema.safeParse(req.query ?? {});
|
|
504
|
+
if (!q.success)
|
|
505
|
+
return invalidBody(reply, q.error);
|
|
292
506
|
try {
|
|
507
|
+
// (DES-KNOWLEDGE-DATA-001 §5.2, crew#1310) Connection fields are a human operator's: any other actor gets
|
|
508
|
+
// the projection whatever it asks for.
|
|
509
|
+
if (q.data.view === 'agent' || sees(deps.actorOf(req)) === 'agent')
|
|
510
|
+
return { view: 'agent', ...(await r.listForAgents()) };
|
|
293
511
|
return await r.list();
|
|
294
512
|
}
|
|
295
513
|
catch (err) {
|
|
296
514
|
return fail(reply, err);
|
|
297
515
|
}
|
|
298
516
|
});
|
|
299
|
-
app.post(`${V}/mcp/servers/preview`, { config: { manifest: { requestType: 'McpServerConfigBody', responseType: 'McpPreviewResponse', statusCodes: [200, 400, 409, 501, 502, 503] } } }, async (req, reply) => {
|
|
517
|
+
app.post(`${V}/mcp/servers/preview`, { config: { manifest: { requestType: 'McpServerConfigBody', responseType: 'McpPreviewResponse', statusCodes: [200, 400, 403, 409, 501, 502, 503] } } }, async (req, reply) => {
|
|
300
518
|
const r = registry(reply);
|
|
301
519
|
if (r === null)
|
|
302
520
|
return reply;
|
|
303
521
|
const parsed = McpServerConfigSchema.safeParse(req.body);
|
|
304
522
|
if (!parsed.success)
|
|
305
523
|
return invalidBody(reply, parsed.error);
|
|
524
|
+
const actor = deps.actorOf(req);
|
|
525
|
+
// (DES-APPS-001 §5.2) The preview DIALS: a confirmed private range is used now, so only a
|
|
526
|
+
// human operator may name one, here as at the save.
|
|
527
|
+
if (confirmsAddress(parsed.data.address) && !mayGrantWrite(actor))
|
|
528
|
+
return addressConfirmRefused(reply, actor);
|
|
529
|
+
// (crew#1316) It also PROBES with the secret `auth.ref` names: a secret crew already holds is a human operator's to send.
|
|
530
|
+
if (namesStoredSecret(parsed.data) && !mayGrantWrite(actor))
|
|
531
|
+
return storedSecretRefused(reply, actor);
|
|
532
|
+
// (DES-PM-001 §3) A PM source gains tracker links and the gate's bindings: only a person registers one, or
|
|
533
|
+
// previews a save over one.
|
|
534
|
+
const over = await r.get(parsed.data.name).catch(() => null);
|
|
535
|
+
if ((parsed.data.pm !== undefined || over?.pm !== undefined) && !mayGrantWrite(actor))
|
|
536
|
+
return humanOperatorOnly(reply, actor, 'register a project-management source', 'pm_source_human_only');
|
|
306
537
|
try {
|
|
307
|
-
const
|
|
538
|
+
const full = await r.preview(toConfig(parsed.data), parsed.data.secret ?? null);
|
|
539
|
+
// (DES-KNOWLEDGE-DATA-001 §5.2) A source's structure reaches an agent only through estate and the gate.
|
|
540
|
+
const { source: described, ...rest } = full;
|
|
541
|
+
const preview = sees(actor) === 'full' && described !== undefined ? { ...rest, source: described } : rest;
|
|
308
542
|
if (deps.policies === undefined)
|
|
309
543
|
return preview;
|
|
310
544
|
let policies = null;
|
|
@@ -317,10 +551,10 @@ export function registerMcpRoutes(app, deps) {
|
|
|
317
551
|
return { ...preview, policies };
|
|
318
552
|
}
|
|
319
553
|
catch (err) {
|
|
320
|
-
return fail(reply, err);
|
|
554
|
+
return fail(reply, err, actor);
|
|
321
555
|
}
|
|
322
556
|
});
|
|
323
|
-
app.post(`${V}/mcp/servers`, { config: { manifest: { requestType: 'SaveMcpServerBody', responseType: 'McpServer', statusCodes: [201, 400, 403, 409, 500, 502, 503] } } }, async (req, reply) => {
|
|
557
|
+
app.post(`${V}/mcp/servers`, { config: { manifest: { requestType: 'SaveMcpServerBody', responseType: 'McpServer | McpServerAgentView', statusCodes: [201, 400, 403, 409, 500, 502, 503] } } }, async (req, reply) => {
|
|
324
558
|
const r = registry(reply);
|
|
325
559
|
if (r === null)
|
|
326
560
|
return reply;
|
|
@@ -335,6 +569,10 @@ export function registerMcpRoutes(app, deps) {
|
|
|
335
569
|
const allowOrigin = parsed.data.allowOrigin ?? null;
|
|
336
570
|
if (allowOrigin !== null && !mayGrantWrite(deps.actorOf(req)))
|
|
337
571
|
return egressConfirmRefused(reply, deps.actorOf(req));
|
|
572
|
+
// (DES-KNOWLEDGE-DATA-001 §5.1) So is a review of what a tool discloses.
|
|
573
|
+
const disclosures = parsed.data.disclosures ?? {};
|
|
574
|
+
if (Object.keys(disclosures).length > 0 && !mayGrantWrite(deps.actorOf(req)))
|
|
575
|
+
return humanOperatorOnly(reply, deps.actorOf(req), 'review what a tool discloses', 'disclosure_review_human_only');
|
|
338
576
|
try {
|
|
339
577
|
// A saved tool whose schema changed loses its approvals BEFORE the save lands, so a failed
|
|
340
578
|
// withdrawal refuses the save rather than leaving an approval over a schema nobody approved.
|
|
@@ -343,8 +581,14 @@ export function registerMcpRoutes(app, deps) {
|
|
|
343
581
|
await r.checkWriteGrants(parsed.data.previewHash, enabledWrites);
|
|
344
582
|
// (G2) An unconfirmed egress is refused before any approval is withdrawn, too.
|
|
345
583
|
await r.checkEgress(parsed.data.previewHash, allowOrigin);
|
|
584
|
+
r.checkDisclosures(parsed.data.previewHash, disclosures);
|
|
346
585
|
}
|
|
347
586
|
const held = parsed.data.previewHash === undefined ? null : r.peekPreview(parsed.data.previewHash);
|
|
587
|
+
// The confirmation rides in the previewed config; saving it is the human operator's, too.
|
|
588
|
+
if (held !== null && confirmsAddress(held.address) && !mayGrantWrite(deps.actorOf(req)))
|
|
589
|
+
return addressConfirmRefused(reply, deps.actorOf(req));
|
|
590
|
+
if (held !== null && held.pm != null && !mayGrantWrite(deps.actorOf(req)))
|
|
591
|
+
return humanOperatorOnly(reply, deps.actorOf(req), 'register a project-management source', 'pm_source_human_only');
|
|
348
592
|
const commit = async () => {
|
|
349
593
|
if (held !== null && deps.policies !== undefined) {
|
|
350
594
|
const tokens = await deps.policies.withdrawnBySave(held);
|
|
@@ -355,7 +599,7 @@ export function registerMcpRoutes(app, deps) {
|
|
|
355
599
|
deps.audit.record('governance.rule.upserted', deps.actorOf(req), { detail: { id, source: 'mcp-approval' } });
|
|
356
600
|
}
|
|
357
601
|
}
|
|
358
|
-
return r.save(parsed.data.previewHash, enabledWrites, allowOrigin);
|
|
602
|
+
return r.save(parsed.data.previewHash, enabledWrites, allowOrigin, disclosures);
|
|
359
603
|
};
|
|
360
604
|
// (crew#993) The withdrawal and the save are one step for the server: an approval for it
|
|
361
605
|
// waits until the save commits, then is judged against the new registration. With no held
|
|
@@ -371,6 +615,9 @@ export function registerMcpRoutes(app, deps) {
|
|
|
371
615
|
disabledWrites: server.tools.filter((t) => t.status !== 'gone' && !t.enabled && isWriteGrant(t.annotations, t.classOverride)).map((t) => t.subject),
|
|
372
616
|
},
|
|
373
617
|
});
|
|
618
|
+
if (held !== null && confirmsAddress(held.address)) {
|
|
619
|
+
deps.audit.record('mcp.server.address_confirmed', deps.actorOf(req), { detail: { name: server.name, kind: server.kind, allow: held.address?.allow ?? [], plaintext: held.address?.plaintext ?? false } });
|
|
620
|
+
}
|
|
374
621
|
// Audited whenever the operator named the origin: the save accepted it, so it is the origin.
|
|
375
622
|
if (allowOrigin !== null && held?.egress != null) {
|
|
376
623
|
const e = held.egress;
|
|
@@ -382,13 +629,18 @@ export function registerMcpRoutes(app, deps) {
|
|
|
382
629
|
continue;
|
|
383
630
|
deps.audit.record('mcp.tool.write_granted', deps.actorOf(req), { detail: { subject: tool.subject, class: tool.class, via: 'save' } });
|
|
384
631
|
}
|
|
385
|
-
|
|
632
|
+
for (const [name, disclosure] of Object.entries(disclosures)) {
|
|
633
|
+
const tool = server.tools.find((t) => t.name === name);
|
|
634
|
+
if (tool !== undefined)
|
|
635
|
+
deps.audit.record('mcp.tool.disclosure_reviewed', deps.actorOf(req), { detail: { subject: tool.subject, disclosure, via: 'save' } });
|
|
636
|
+
}
|
|
637
|
+
return reply.code(201).send(serverFor(deps.actorOf(req), server));
|
|
386
638
|
}
|
|
387
639
|
catch (err) {
|
|
388
640
|
return fail(reply, err);
|
|
389
641
|
}
|
|
390
642
|
});
|
|
391
|
-
app.patch(`${V}/mcp/servers/:name`, { config: { manifest: { requestType: 'PatchMcpServerBody', responseType: 'McpServer', statusCodes: [200, 400, 404, 503] } } }, async (req, reply) => {
|
|
643
|
+
app.patch(`${V}/mcp/servers/:name`, { config: { manifest: { requestType: 'PatchMcpServerBody', responseType: 'McpServer | McpServerAgentView', statusCodes: [200, 400, 403, 404, 503] } } }, async (req, reply) => {
|
|
392
644
|
const r = registry(reply);
|
|
393
645
|
if (r === null)
|
|
394
646
|
return reply;
|
|
@@ -396,23 +648,38 @@ export function registerMcpRoutes(app, deps) {
|
|
|
396
648
|
if (!parsed.success)
|
|
397
649
|
return invalidBody(reply, parsed.error);
|
|
398
650
|
try {
|
|
399
|
-
|
|
651
|
+
// (DES-PM-001 §3) Switching a PM source on or off changes what its links reach: a person's only. Judged and
|
|
652
|
+
// done inside the server's lock, so a save that makes the name a PM source cannot slip between.
|
|
653
|
+
const actor = deps.actorOf(req);
|
|
654
|
+
const server = await exclusive(req.params.name, async () => {
|
|
655
|
+
if ((await r.get(req.params.name)).pm !== undefined && !mayGrantWrite(actor))
|
|
656
|
+
return null;
|
|
657
|
+
return r.setServerEnabled(req.params.name, parsed.data.enabled);
|
|
658
|
+
});
|
|
659
|
+
if (server === null)
|
|
660
|
+
return humanOperatorOnly(reply, actor, 'switch a project-management source on or off', 'pm_source_human_only');
|
|
400
661
|
deps.audit.record(parsed.data.enabled ? 'mcp.server.enabled' : 'mcp.server.disabled', deps.actorOf(req), { detail: { name: server.name } });
|
|
401
|
-
return server;
|
|
662
|
+
return serverFor(deps.actorOf(req), server);
|
|
402
663
|
}
|
|
403
664
|
catch (err) {
|
|
404
665
|
return fail(reply, err);
|
|
405
666
|
}
|
|
406
667
|
});
|
|
407
|
-
app.delete(`${V}/mcp/servers/:name`, { config: { manifest: { responseType: '{ removed: string }', statusCodes: [200, 404, 500, 502, 503] } } }, async (req, reply) => {
|
|
668
|
+
app.delete(`${V}/mcp/servers/:name`, { config: { manifest: { responseType: '{ removed: string }', statusCodes: [200, 403, 404, 500, 502, 503] } } }, async (req, reply) => {
|
|
408
669
|
const r = registry(reply);
|
|
409
670
|
if (r === null)
|
|
410
671
|
return reply;
|
|
411
672
|
try {
|
|
412
673
|
// (crew#993) One step for the server, like the save: no approval lands between the
|
|
413
674
|
// withdrawal and the removal.
|
|
675
|
+
let refused = false;
|
|
414
676
|
await exclusive(req.params.name, async () => {
|
|
415
|
-
|
|
677
|
+
// (DES-PM-001 §3.2, Q-PM5) Removing a PM source drops its links, and the last GitHub one would hand `#N` back
|
|
678
|
+
// to the daemon's own `gh`: a person's only. Judged on the record being removed, inside the server's lock.
|
|
679
|
+
if ((await r.get(req.params.name)).pm !== undefined && !mayGrantWrite(deps.actorOf(req))) {
|
|
680
|
+
refused = true;
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
416
683
|
if (deps.policies !== undefined) {
|
|
417
684
|
const tokens = await deps.policies.tokensOf(req.params.name);
|
|
418
685
|
if (tokens.length > 0) {
|
|
@@ -424,6 +691,8 @@ export function registerMcpRoutes(app, deps) {
|
|
|
424
691
|
}
|
|
425
692
|
await r.remove(req.params.name);
|
|
426
693
|
});
|
|
694
|
+
if (refused)
|
|
695
|
+
return humanOperatorOnly(reply, deps.actorOf(req), 'remove a project-management source', 'pm_source_human_only');
|
|
427
696
|
deps.audit.record('mcp.server.removed', deps.actorOf(req), { detail: { name: req.params.name } });
|
|
428
697
|
return { removed: req.params.name };
|
|
429
698
|
}
|
|
@@ -431,12 +700,17 @@ export function registerMcpRoutes(app, deps) {
|
|
|
431
700
|
return fail(reply, err);
|
|
432
701
|
}
|
|
433
702
|
});
|
|
434
|
-
app.post(`${V}/mcp/servers/:name/test`, { config: { manifest: { responseType: 'McpServerTestResponse', statusCodes: [200, 404, 409, 503] } } }, async (req, reply) => {
|
|
703
|
+
app.post(`${V}/mcp/servers/:name/test`, { config: { manifest: { responseType: 'McpServerTestResponse | McpServerTestAgentResponse', statusCodes: [200, 404, 409, 503] } } }, async (req, reply) => {
|
|
435
704
|
const r = registry(reply);
|
|
436
705
|
if (r === null)
|
|
437
706
|
return reply;
|
|
438
707
|
try {
|
|
439
|
-
|
|
708
|
+
const t = await r.test(req.params.name);
|
|
709
|
+
if (sees(deps.actorOf(req)) === 'full')
|
|
710
|
+
return t;
|
|
711
|
+
// A probe's error can name the host it could not reach: an agent gets that it failed.
|
|
712
|
+
const agentAnswer = { ok: t.ok, error: t.error === null ? null : 'the probe failed', diff: t.diff, server: agentServerView(t.server) };
|
|
713
|
+
return agentAnswer;
|
|
440
714
|
}
|
|
441
715
|
catch (err) {
|
|
442
716
|
return fail(reply, err);
|
|
@@ -451,11 +725,13 @@ export function registerMcpRoutes(app, deps) {
|
|
|
451
725
|
return invalidBody(reply, parsed.error);
|
|
452
726
|
try {
|
|
453
727
|
const actor = deps.actorOf(req);
|
|
454
|
-
const { tool, grantedWrite } = await r.patchTool(req.params.subject, parsed.data, { mayGrantWrite: mayGrantWrite(actor) });
|
|
728
|
+
const { tool, grantedWrite } = await r.patchTool(req.params.subject, parsed.data, { mayGrantWrite: mayGrantWrite(actor), mayReviewDisclosure: mayGrantWrite(actor) });
|
|
455
729
|
deps.audit.record('mcp.tool.updated', actor, { detail: { subject: tool.subject, ...parsed.data } });
|
|
456
730
|
if (grantedWrite) {
|
|
457
731
|
deps.audit.record('mcp.tool.write_granted', actor, { detail: { subject: tool.subject, class: tool.class, via: 'toggle' } });
|
|
458
732
|
}
|
|
733
|
+
if (parsed.data.disclosure !== undefined)
|
|
734
|
+
deps.audit.record('mcp.tool.disclosure_reviewed', actor, { detail: { subject: tool.subject, disclosure: parsed.data.disclosure, via: 'patch' } });
|
|
459
735
|
return tool;
|
|
460
736
|
}
|
|
461
737
|
catch (err) {
|
|
@@ -495,14 +771,14 @@ export function registerMcpRoutes(app, deps) {
|
|
|
495
771
|
if (!parsed.success) {
|
|
496
772
|
return reply.code(400).send({ error: `body: ${parsed.error.issues.map((i) => `${i.path.join('.') || 'body'} ${i.code}`).join('; ')}`, code: 'bad_request' });
|
|
497
773
|
}
|
|
498
|
-
const answer = await listUnitTools({ registry, lister: toolLister }, parsed.data.token);
|
|
774
|
+
const answer = await listUnitTools({ registry, lister: toolLister, ...(deps.gate !== undefined ? { gate: deps.gate } : {}) }, parsed.data.token);
|
|
499
775
|
return reply.code(answer.status).send(answer.body);
|
|
500
776
|
});
|
|
501
777
|
// (crew#719) RE-KEY only: the server must already be registered and already reference this
|
|
502
778
|
// keychain entry. A NEW server's secret is staged with its preview (`secret` on the preview
|
|
503
779
|
// body) and committed by the save, so the two can no longer half-land.
|
|
504
780
|
app.put(`${V}/mcp/servers/:name/secret`, {
|
|
505
|
-
config: { manifest: { requestType: 'PutMcpSecretBody', responseType: 'McpSecretResponse', statusCodes: [200, 400, 404, 501, 502, 503] } },
|
|
781
|
+
config: { manifest: { requestType: 'PutMcpSecretBody', responseType: 'McpSecretResponse', statusCodes: [200, 400, 403, 404, 501, 502, 503] } },
|
|
506
782
|
}, async (req, reply) => {
|
|
507
783
|
const r = registry(reply);
|
|
508
784
|
if (r === null)
|
|
@@ -514,7 +790,17 @@ export function registerMcpRoutes(app, deps) {
|
|
|
514
790
|
if (!parsed.success)
|
|
515
791
|
return invalidBody(reply, parsed.error);
|
|
516
792
|
try {
|
|
517
|
-
|
|
793
|
+
// (DES-PM-001 §5) A PM source's credential is the identity its approved actions post as: a person re-keys it.
|
|
794
|
+
// Judged and written inside the server's lock, so a save that makes the name a PM source cannot slip between.
|
|
795
|
+
const actor = deps.actorOf(req);
|
|
796
|
+
const ref = await exclusive(name.data, async () => {
|
|
797
|
+
// An unknown name is setSecret's to answer (its own refusals come first, as before).
|
|
798
|
+
if ((await r.get(name.data).catch(() => null))?.pm !== undefined && !mayGrantWrite(actor))
|
|
799
|
+
return null;
|
|
800
|
+
return r.setSecret(name.data, parsed.data.value);
|
|
801
|
+
});
|
|
802
|
+
if (ref === null)
|
|
803
|
+
return humanOperatorOnly(reply, actor, "re-key a project-management source's credential", 'pm_source_human_only');
|
|
518
804
|
deps.audit.record('mcp.secret.set', deps.actorOf(req), { detail: { name: name.data, ref } });
|
|
519
805
|
return { ref, set: true };
|
|
520
806
|
}
|
|
@@ -522,6 +808,85 @@ export function registerMcpRoutes(app, deps) {
|
|
|
522
808
|
return fail(reply, err);
|
|
523
809
|
}
|
|
524
810
|
});
|
|
811
|
+
// ── DES-KNOWLEDGE-DATA-001 §5.5: generations and a fail-closed restore ───────────────────────
|
|
812
|
+
app.get(`${V}/mcp/registry/generations`, { config: { manifest: { responseType: 'McpRegistryGenerationsResponse', statusCodes: [200, 403, 503] } } }, async (req, reply) => {
|
|
813
|
+
const actor = deps.actorOf(req);
|
|
814
|
+
if (!mayGrantWrite(actor))
|
|
815
|
+
return humanOperatorOnly(reply, actor, "read the registry's generations", 'human_only');
|
|
816
|
+
const r = registry(reply);
|
|
817
|
+
if (r === null)
|
|
818
|
+
return reply;
|
|
819
|
+
try {
|
|
820
|
+
return await r.generations();
|
|
821
|
+
}
|
|
822
|
+
catch (err) {
|
|
823
|
+
return fail(reply, err, actor);
|
|
824
|
+
}
|
|
825
|
+
});
|
|
826
|
+
app.post(`${V}/mcp/registry/restore`, { config: { manifest: { requestType: 'McpRegistryRestoreBody', responseType: 'McpRegistryRestoreResponse', statusCodes: [200, 400, 403, 404, 409, 500, 503] } } }, async (req, reply) => {
|
|
827
|
+
const actor = deps.actorOf(req);
|
|
828
|
+
if (!mayGrantWrite(actor))
|
|
829
|
+
return humanOperatorOnly(reply, actor, 'restore the registry', 'restore_human_only');
|
|
830
|
+
const r = registry(reply);
|
|
831
|
+
if (r === null)
|
|
832
|
+
return reply;
|
|
833
|
+
const parsed = McpRegistryRestoreSchema.safeParse(req.body);
|
|
834
|
+
if (!parsed.success)
|
|
835
|
+
return invalidBody(reply, parsed.error);
|
|
836
|
+
const generation = parsed.data.generation;
|
|
837
|
+
try {
|
|
838
|
+
// ONE snapshot, read and validated before anything changes: a restore that is refused (unknown, unreadable,
|
|
839
|
+
// a document the policy refuses) withdraws nothing, and a generation pruned meanwhile cannot fail it half-way.
|
|
840
|
+
const plan = await r.planRestore(generation);
|
|
841
|
+
const p = deps.policies;
|
|
842
|
+
const planned = plan.servers.map((s) => s.name);
|
|
843
|
+
// (crew#993) The withdrawal and the commit are one step for EVERY server they touch: each server's lock, in
|
|
844
|
+
// name order (every other holder takes one lock, so the order cannot deadlock), so no approval, save or
|
|
845
|
+
// removal of those servers lands between them. A server registered while the locks were being taken is not
|
|
846
|
+
// covered: then nothing is done, and the locks are taken again over the larger set (codex r2).
|
|
847
|
+
const locked = (names, fn) => (p === undefined ? fn() : names.reduceRight((inner, name) => () => p.exclusive(name, inner), fn)());
|
|
848
|
+
let names = [...new Set([...(await r.list()).servers.map((s) => s.name), ...planned])].sort();
|
|
849
|
+
let done = null;
|
|
850
|
+
for (let attempt = 0; attempt < 3 && done === null; attempt++) {
|
|
851
|
+
const held = names;
|
|
852
|
+
done = await locked(held, async () => {
|
|
853
|
+
const now = (await r.list()).servers;
|
|
854
|
+
const wider = now.map((s) => s.name).filter((n) => !held.includes(n));
|
|
855
|
+
if (wider.length > 0) {
|
|
856
|
+
names = [...new Set([...held, ...wider])].sort();
|
|
857
|
+
return null;
|
|
858
|
+
}
|
|
859
|
+
let withdrawn = [];
|
|
860
|
+
if (p !== undefined) {
|
|
861
|
+
withdrawn = await restoreWithdrawals(p, now, plan.servers);
|
|
862
|
+
if (withdrawn.length > 0) {
|
|
863
|
+
let rules;
|
|
864
|
+
try {
|
|
865
|
+
rules = await p.withdraw(withdrawn);
|
|
866
|
+
}
|
|
867
|
+
catch (err) {
|
|
868
|
+
auditPartial(deps, req, err, withdrawn);
|
|
869
|
+
throw new McpRegistryError(500, 'withdraw_failed', `the registry was not restored: approvals that generation ${generation} does not cover could not be withdrawn (${err instanceof Error ? err.message : String(err)})`);
|
|
870
|
+
}
|
|
871
|
+
deps.audit.record('mcp.approval.withdrawn', actor, { detail: { subjects: withdrawn, rules, why: 'registry_restored' } });
|
|
872
|
+
for (const id of rules)
|
|
873
|
+
deps.audit.record('governance.rule.upserted', actor, { detail: { id, source: 'mcp-approval' } });
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
return { out: await r.restore(plan, held), withdrawn };
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
if (done === null)
|
|
880
|
+
throw new McpRegistryError(409, 'registry_busy', 'servers kept being registered while the restore was taking their locks; nothing was restored: try again');
|
|
881
|
+
const { out, withdrawn } = done;
|
|
882
|
+
const body = { ...out, withdrawnApprovals: withdrawn };
|
|
883
|
+
deps.audit.record('mcp.registry.restored', actor, { detail: { restored: generation, generation: out.generation, servers: out.servers, disabled: out.disabled, queryReset: out.queryReset, writesReset: out.writesReset, withdrawnApprovals: withdrawn } });
|
|
884
|
+
return body;
|
|
885
|
+
}
|
|
886
|
+
catch (err) {
|
|
887
|
+
return fail(reply, err, actor);
|
|
888
|
+
}
|
|
889
|
+
});
|
|
525
890
|
// ── S6: the policy preview and the approvals ────────────────────────────────────────────────
|
|
526
891
|
const policies = (reply) => {
|
|
527
892
|
if (deps.registry !== undefined && deps.policies !== undefined)
|