wicked-crew 0.16.13 → 0.17.1
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 +27 -9
- 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-jobs.d.ts +163 -0
- package/dist/api/chat-jobs.d.ts.map +1 -0
- package/dist/api/chat-jobs.js +767 -0
- package/dist/api/chat-jobs.js.map +1 -0
- 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 +170 -152
- package/dist/api/chat-proposals.d.ts.map +1 -1
- package/dist/api/chat-proposals.js +833 -15
- 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 +20 -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 +81 -23
- package/dist/api/product.d.ts.map +1 -1
- package/dist/api/product.js +149 -72
- 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 +69 -39
- package/dist/api/recording.d.ts.map +1 -1
- package/dist/api/recording.js +60 -49
- package/dist/api/recording.js.map +1 -1
- package/dist/api/routes.d.ts +229 -1506
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +1226 -169
- package/dist/api/routes.js.map +1 -1
- package/dist/api/run-timing-index.d.ts +12 -1
- package/dist/api/run-timing-index.d.ts.map +1 -1
- package/dist/api/run-timing-index.js +35 -0
- package/dist/api/run-timing-index.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 +179 -4
- 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 +34 -1
- package/dist/core/adapter.d.ts.map +1 -1
- package/dist/core/adapter.js +78 -2
- package/dist/core/adapter.js.map +1 -1
- package/dist/core/builtin-catalog.d.ts.map +1 -1
- package/dist/core/builtin-catalog.js +2 -0
- package/dist/core/builtin-catalog.js.map +1 -1
- package/dist/core/deliver-text.d.ts +62 -1
- package/dist/core/deliver-text.d.ts.map +1 -1
- package/dist/core/deliver-text.js +244 -22
- package/dist/core/deliver-text.js.map +1 -1
- package/dist/core/deliver.d.ts.map +1 -1
- package/dist/core/deliver.js +30 -3
- 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/core/qe-acceptance-setting.d.ts.map +1 -1
- package/dist/core/qe-acceptance-setting.js +6 -0
- package/dist/core/qe-acceptance-setting.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 +31 -172
- package/dist/team/routes.d.ts.map +1 -1
- package/dist/team/routes.js +31 -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-v2.d.ts +90 -0
- package/dist/workflow-catalog/build-v2.d.ts.map +1 -0
- package/dist/workflow-catalog/build-v2.js +527 -0
- package/dist/workflow-catalog/build-v2.js.map +1 -0
- 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-v2.d.ts +12 -0
- package/dist/workflow-catalog/catalog-data-v2.d.ts.map +1 -0
- package/dist/workflow-catalog/catalog-data-v2.js +2582 -0
- package/dist/workflow-catalog/catalog-data-v2.js.map +1 -0
- 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/workflow-catalog/seeds-v2.d.ts +91 -0
- package/dist/workflow-catalog/seeds-v2.d.ts.map +1 -0
- package/dist/workflow-catalog/seeds-v2.js +2 -0
- package/dist/workflow-catalog/seeds-v2.js.map +1 -0
- package/dist/workflow-catalog/shape.d.ts +97 -0
- package/dist/workflow-catalog/shape.d.ts.map +1 -0
- package/dist/workflow-catalog/shape.js +97 -0
- package/dist/workflow-catalog/shape.js.map +1 -0
- 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 +651 -11
- package/package.json +31 -7
- 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/mcp/registry.js
CHANGED
|
@@ -14,9 +14,28 @@
|
|
|
14
14
|
* failed probes.
|
|
15
15
|
* - **Secrets.** Only a reference is stored. A value is resolved just for the probe and scrubbed
|
|
16
16
|
* from its result (`probe.ts`).
|
|
17
|
+
*
|
|
18
|
+
* (DES-KNOWLEDGE-DATA-001 §5, the ONE registry) Every entry has an immutable `id`. A Postgres source
|
|
19
|
+
* is stored as Toolbox's own source document (`kind: 'toolbox-source'`), and {@link configOf} is the
|
|
20
|
+
* read-path projection that gives every consumer the K1 `kind: 'sql'` config it always read. A K1
|
|
21
|
+
* record is mapped on read, as descriptor version 1, only when the mapping keeps its descriptor hash;
|
|
22
|
+
* a save writes version 2. Each tool carries a reviewed disclosure class. Answers have a full view
|
|
23
|
+
* (human operators) and an agent-safe projection ({@link agentServerView}). Every write keeps the
|
|
24
|
+
* generation it replaces; {@link McpRegistry.restore} brings one back and fails closed.
|
|
17
25
|
*/
|
|
18
|
-
import {
|
|
26
|
+
import { randomUUID } from 'node:crypto';
|
|
27
|
+
import { isIP } from 'node:net';
|
|
28
|
+
import { join } from 'node:path';
|
|
29
|
+
import { agentAccessOf, effectiveDisclosure, hasPmMarker, legacyEntryId, pmOf, proposedDisclosure, trackersOf } from '../knowledge/registry/entry.js';
|
|
30
|
+
import { bindingFor, bindingInForce, bindingOnSave } from '../knowledge/trackers/bindings.js';
|
|
31
|
+
import { PROJECTION_UNKNOWN, trackerLinkViews } from '../knowledge/trackers/view.js';
|
|
32
|
+
import { checkSourceDocument, DeploymentPolicyError, policyVersionOf } from '../knowledge/registry/policy.js';
|
|
33
|
+
import { canonicalJson, deriveToolClass, effectiveToolClass, ESTATE_SERVER, MCP_SERVER_NAME_RE, mcpSubject, parseMcpSubject, sha256Hex, toolSchemaHash } from './classify.js';
|
|
34
|
+
import { GENERATIONS_KEPT } from './registry-store.js';
|
|
19
35
|
import { restTarget } from './rest.js';
|
|
36
|
+
import { classifyAddress, exactRangesFor, NO_CONFIRMATION } from '../sources/dialer.js';
|
|
37
|
+
import { CREW_SOURCE, sourceDescriptorHash, sqlFromToolboxEntry, toolboxEntryFromSql } from '../sources/kinds.js';
|
|
38
|
+
import { SourceCatalogStore } from '../sources/store.js';
|
|
20
39
|
import { KEYCHAIN_SERVICE, keychainRef, parseSecretRef, resolveSecret, secretIsSet } from './secrets.js';
|
|
21
40
|
/** How long a preview can be saved. */
|
|
22
41
|
export const PREVIEW_TTL_MS = 15 * 60 * 1000;
|
|
@@ -28,13 +47,17 @@ export const HEALTH_FAILING_AFTER = 3;
|
|
|
28
47
|
export class McpRegistryError extends Error {
|
|
29
48
|
status;
|
|
30
49
|
code;
|
|
50
|
+
humanMessage;
|
|
31
51
|
constructor(
|
|
32
52
|
// 500: the registry and the OS secret store disagree and crew could not reconcile them
|
|
33
53
|
// (crew#719, `secret_orphaned`) — the message names what was left behind.
|
|
34
|
-
status, code, message
|
|
54
|
+
status, code, message,
|
|
55
|
+
/** (DES-APPS-001 §5.2) Fuller words that hold a source's own text: answered to a HUMAN only. */
|
|
56
|
+
humanMessage) {
|
|
35
57
|
super(message);
|
|
36
58
|
this.status = status;
|
|
37
59
|
this.code = code;
|
|
60
|
+
this.humanMessage = humanMessage;
|
|
38
61
|
}
|
|
39
62
|
}
|
|
40
63
|
export class McpRegistry {
|
|
@@ -42,22 +65,52 @@ export class McpRegistry {
|
|
|
42
65
|
previews = new Map();
|
|
43
66
|
now;
|
|
44
67
|
env;
|
|
68
|
+
catalogs;
|
|
69
|
+
/**
|
|
70
|
+
* (crew#1328 item 3) A restored registry generation changes a source's projection key (its descriptor and allowed
|
|
71
|
+
* views) with no catalog written, so `catalogs.onWritten` does not fire. Every source a restore commits is named
|
|
72
|
+
* here once it has landed, and the daemon queues a re-projection of its structure into estate, so a source whose
|
|
73
|
+
* stored catalog matches the restored descriptor does not wait for the next describe or boot (one whose catalog
|
|
74
|
+
* belongs to a later descriptor still needs a describe). A listener's failure never fails the restore.
|
|
75
|
+
*/
|
|
76
|
+
onSourceChanged = null;
|
|
77
|
+
/** (DES-PM-001 §3.4) Whether estate holds each tracker's links yet; the daemon points it at the tracker projector. */
|
|
78
|
+
trackerProjection = PROJECTION_UNKNOWN;
|
|
79
|
+
/** (DES-PM-001 §3.4) Called once a restore has landed (the daemon points it at the tracker projector). */
|
|
80
|
+
onRestored;
|
|
45
81
|
constructor(deps) {
|
|
46
82
|
this.deps = deps;
|
|
47
83
|
this.now = deps.now ?? Date.now;
|
|
48
84
|
this.env = deps.env ?? process.env;
|
|
85
|
+
// Beside the registry file; a store without a directory (a test double) gets the default place.
|
|
86
|
+
const dir = deps.store.directory;
|
|
87
|
+
this.catalogs = deps.catalogs ?? new SourceCatalogStore(typeof dir === 'string' ? join(dir, 'catalogs') : undefined);
|
|
49
88
|
}
|
|
50
89
|
get secretStoreAvailable() {
|
|
51
90
|
return this.deps.secrets.available;
|
|
52
91
|
}
|
|
53
92
|
async list() {
|
|
54
|
-
const file = await this.
|
|
93
|
+
const file = await this.readFile();
|
|
55
94
|
const servers = await Promise.all(file.servers.map((s) => this.view(s)));
|
|
56
95
|
const discovered = this.deps.discover(new Set(file.servers.map((s) => s.name)));
|
|
57
96
|
return { servers, discovered };
|
|
58
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* (DES-KNOWLEDGE-DATA-001 §5.2, crew#1310) The agent-safe view: name, kind, switch, health state, the tools with
|
|
100
|
+
* their classes, and a source's see/query switches. No host, port, database, login, url, command, path, address,
|
|
101
|
+
* secret reference or descriptor.
|
|
102
|
+
*/
|
|
103
|
+
async listForAgents() {
|
|
104
|
+
const file = await this.readFile();
|
|
105
|
+
return { servers: (await Promise.all(file.servers.map((s) => this.view(s)))).map(agentServerView) };
|
|
106
|
+
}
|
|
107
|
+
/** The kept generations of the registry, newest first (DES-KNOWLEDGE-DATA-001 §5.5). */
|
|
108
|
+
async generations() {
|
|
109
|
+
const file = await this.readFile();
|
|
110
|
+
return { current: file.generation ?? 0, generations: await this.deps.store.generations() };
|
|
111
|
+
}
|
|
59
112
|
async get(name) {
|
|
60
|
-
const file = await this.
|
|
113
|
+
const file = await this.readFile();
|
|
61
114
|
return this.view(this.find(file.servers, name));
|
|
62
115
|
}
|
|
63
116
|
/**
|
|
@@ -69,6 +122,12 @@ export class McpRegistry {
|
|
|
69
122
|
if (config.name === ESTATE_SERVER) {
|
|
70
123
|
throw new McpRegistryError(400, 'reserved_name', `"${ESTATE_SERVER}" is reserved: mcp:${ESTATE_SERVER}/<tool> is the broker's estate relay (the seat's own estate), never a registered server; choose another name`);
|
|
71
124
|
}
|
|
125
|
+
if ((config.kind === 'sql' || config.kind === 'graphql' || config.kind === 'toolbox-source') && config.name === CREW_SOURCE) {
|
|
126
|
+
throw new McpRegistryError(400, 'reserved_name', `"${CREW_SOURCE}" is the built-in crew source; choose another name`);
|
|
127
|
+
}
|
|
128
|
+
// (DES-KNOWLEDGE-DATA-001 §5.1) A database source is saved as its Toolbox document, checked against the
|
|
129
|
+
// deployment policy here (the preview) and again when the write lands.
|
|
130
|
+
config = this.forSave(config);
|
|
72
131
|
if (stagedSecret !== null) {
|
|
73
132
|
if (!this.deps.secrets.available) {
|
|
74
133
|
throw new McpRegistryError(501, 'secret_store_unavailable', 'this platform has no OS secret store; reference a daemon env variable instead (auth.ref "env:<NAME>")');
|
|
@@ -86,24 +145,34 @@ export class McpRegistry {
|
|
|
86
145
|
throw new McpRegistryError(409, 'secret_missing', result.error);
|
|
87
146
|
if (!result.ok) {
|
|
88
147
|
const what = config.kind === 'rest' ? 'the OpenAPI document could not be imported' : 'the server did not answer tools/list';
|
|
89
|
-
|
|
148
|
+
// (DES-APPS-001 §5.2) The dialer refused the connection: a 409 naming why (an unconfirmed range
|
|
149
|
+
// to confirm, an always-refused address, plaintext), not an upstream failure.
|
|
150
|
+
const human = result.sourceDetail !== undefined ? `${what}: ${result.sourceDetail}` : undefined;
|
|
151
|
+
if (result.refusal !== undefined)
|
|
152
|
+
throw new McpRegistryError(409, result.refusal, `${what}: ${result.error}`, human);
|
|
153
|
+
throw new McpRegistryError(502, 'probe_failed', `${what}: ${result.error}`, human);
|
|
90
154
|
}
|
|
91
155
|
const tools = result.tools.map((t) => ({ ...t, schemaHash: hashOf(config, t) }));
|
|
92
156
|
const previewHash = sha256Hex(canonicalJson({ config, tools: tools.map((t) => [t.name, t.schemaHash]) }));
|
|
93
157
|
const expiresAt = this.now() + PREVIEW_TTL_MS;
|
|
94
|
-
const existing = (await this.
|
|
158
|
+
const existing = (await this.readFile()).servers.find((s) => s.name === config.name);
|
|
95
159
|
// (G2) A mismatch with the spec's `servers`, or a private address, needs the operator to name
|
|
96
160
|
// the origin at save, unless an earlier save of this server already confirmed that origin.
|
|
97
161
|
const egress = config.kind !== 'rest' || result.egress === undefined ? null : { ...result.egress, confirmRequired: egressRefusal(result.egress, null, existing) !== null };
|
|
98
162
|
if (config.kind === 'rest' && egress === null)
|
|
99
163
|
throw new McpRegistryError(502, 'probe_failed', 'the rest probe did not report where its calls go');
|
|
100
|
-
|
|
164
|
+
const source = result.source ?? null;
|
|
165
|
+
if ((config.kind === 'sql' || config.kind === 'graphql') && source === null)
|
|
166
|
+
throw new McpRegistryError(502, 'probe_failed', 'the source probe did not describe the source');
|
|
167
|
+
this.hold(previewHash, { config, tools, expiresAt, secret: stagedSecret, egress, source });
|
|
101
168
|
const was = (name) => existing?.tools.find((p) => p.name === name);
|
|
102
169
|
// The override a save keeps: only while the tool's schema is unchanged (as `save` decides).
|
|
103
170
|
const survivingOverride = (t) => {
|
|
104
171
|
const w = was(t.name);
|
|
105
172
|
return w !== undefined && w.schemaHash === t.schemaHash ? w.classOverride : null;
|
|
106
173
|
};
|
|
174
|
+
// (DES-KNOWLEDGE-DATA-001 §5.1) The disclosure class a save gives each tool when the body names none.
|
|
175
|
+
const reviewed = (t) => disclosureOnSave(t, was(t.name), undefined, config.kind, config.pm?.system ?? null)?.class ?? null;
|
|
107
176
|
return {
|
|
108
177
|
previewHash,
|
|
109
178
|
expiresAt: new Date(expiresAt).toISOString(),
|
|
@@ -119,11 +188,14 @@ export class McpRegistry {
|
|
|
119
188
|
classOverride: survivingOverride(t),
|
|
120
189
|
schemaHash: t.schemaHash,
|
|
121
190
|
enabledOnSave: enabledOnSave(was(t.name), t),
|
|
191
|
+
disclosure: reviewed(t),
|
|
192
|
+
...(config.pm != null ? { binding: bindingOnSave(config.pm.system, t) === null ? null : { policy: bindingOnSave(config.pm.system, t).policy } } : {}),
|
|
122
193
|
...(config.kind === 'rest' ? { rest: t.rest ?? null } : {}),
|
|
123
194
|
})),
|
|
124
195
|
diff: existing === undefined ? null : diffTools(existing.tools, tools),
|
|
125
196
|
...(result.skipped !== undefined && result.skipped.length > 0 ? { skipped: result.skipped } : {}),
|
|
126
197
|
...(egress !== null ? { egress } : {}),
|
|
198
|
+
...(source !== null ? { source: { catalog: source.catalog, ...(source.privileges !== undefined ? { privileges: source.privileges } : {}) } } : {}),
|
|
127
199
|
};
|
|
128
200
|
}
|
|
129
201
|
/**
|
|
@@ -141,8 +213,12 @@ export class McpRegistry {
|
|
|
141
213
|
* (G2) `allowOrigin` is the operator naming the exact origin a `rest` server's calls go to. It is
|
|
142
214
|
* required when the preview's `egress.confirmRequired` (see {@link checkEgress}) and remembered
|
|
143
215
|
* on the record, so a re-save over the same origin does not ask again.
|
|
216
|
+
*
|
|
217
|
+
* (DES-KNOWLEDGE-DATA-001 §5.1) `disclosures` is the operator's review of each tool's disclosure class (human
|
|
218
|
+
* operator only, like a write grant). A tool it does not name keeps its class while its schema is unchanged;
|
|
219
|
+
* a tool of crew's own Toolbox configuration gets crew's class; any other tool has none until reviewed.
|
|
144
220
|
*/
|
|
145
|
-
async save(previewHash, enabledWrites = [], allowOrigin = null) {
|
|
221
|
+
async save(previewHash, enabledWrites = [], allowOrigin = null, disclosures = {}) {
|
|
146
222
|
if (previewHash === undefined) {
|
|
147
223
|
throw new McpRegistryError(409, 'preview_required', 'saving a server needs the previewHash of a preview of it: POST /mcp/servers/preview first');
|
|
148
224
|
}
|
|
@@ -154,6 +230,7 @@ export class McpRegistry {
|
|
|
154
230
|
// A wrong grant is refused before the preview is spent, so the operator can correct it and save again.
|
|
155
231
|
await this.checkWriteGrants(previewHash, enabledWrites);
|
|
156
232
|
await this.checkEgress(previewHash, allowOrigin);
|
|
233
|
+
this.checkDisclosures(previewHash, disclosures);
|
|
157
234
|
const granted = new Set(enabledWrites);
|
|
158
235
|
this.previews.delete(previewHash);
|
|
159
236
|
const stamp = new Date(this.now()).toISOString();
|
|
@@ -168,11 +245,24 @@ export class McpRegistry {
|
|
|
168
245
|
// whose registry write then failed used to leave the NEW secret behind under an unchanged row:
|
|
169
246
|
// the credential its running calls use had silently changed, which is a worse outcome than the
|
|
170
247
|
// orphan this was written to prevent. `null` = no prior value, and then the rollback deletes.
|
|
248
|
+
// (DES-PM-001 §3) A save that would drop or change a PM source's marker is refused BEFORE any credential is
|
|
249
|
+
// written (the mutation refuses it again, under the store's chain, for a marker set meanwhile).
|
|
250
|
+
const existing = (await this.readFile()).servers.find((s) => s.name === held.config.name);
|
|
251
|
+
const existingPm = existing === undefined ? null : pmOf(existing);
|
|
252
|
+
if (existingPm !== null && (held.config.pm == null || held.config.pm.system !== existingPm.system)) {
|
|
253
|
+
throw new McpRegistryError(409, 'pm_marker_fixed', `${held.config.name} is registered as a ${existingPm.system} project-management source; save it with pm.system "${existingPm.system}", or remove it and register it again`);
|
|
254
|
+
}
|
|
171
255
|
const prior = held.secret === null ? null : await this.deps.secrets.get(held.config.name);
|
|
172
256
|
if (held.secret !== null)
|
|
173
257
|
await this.deps.secrets.set(held.config.name, held.secret);
|
|
174
|
-
const saved = await this.restoreSecretOnFailure(held.config.name, held.secret !== null, prior, () => this.
|
|
258
|
+
const saved = await this.restoreSecretOnFailure(held.config.name, held.secret !== null, prior, () => this.mutate(async (file) => {
|
|
175
259
|
const prior = file.servers.find((s) => s.name === held.config.name);
|
|
260
|
+
// (DES-PM-001 §3) A PM entry stays the PM system it was registered as: a re-save that drops the marker, or
|
|
261
|
+
// names another system, would hand its tools to the plain path (or its links to another vendor).
|
|
262
|
+
const priorPm = prior === undefined ? null : pmOf(prior);
|
|
263
|
+
if (priorPm !== null && (held.config.pm == null || held.config.pm.system !== priorPm.system)) {
|
|
264
|
+
throw new McpRegistryError(409, 'pm_marker_fixed', `${held.config.name} is registered as a ${priorPm.system} project-management source; save it with pm.system "${priorPm.system}", or remove it and register it again`);
|
|
265
|
+
}
|
|
176
266
|
// (G2) Re-judged against the record as it is NOW, inside the write: a confirmation the
|
|
177
267
|
// preview inherited from a server since removed or re-pointed does not carry over.
|
|
178
268
|
if (held.egress !== null) {
|
|
@@ -194,6 +284,9 @@ export class McpRegistry {
|
|
|
194
284
|
observedSchemaHash: t.schemaHash,
|
|
195
285
|
present: true,
|
|
196
286
|
...(t.rest != null ? { rest: t.rest } : {}),
|
|
287
|
+
disclosure: disclosureOnSave(t, was, disclosures[t.name], held.config.kind, held.config.pm?.system ?? null),
|
|
288
|
+
// (DES-PM-001 §3) A PM tool's binding: crew's current policy, bound to the schema this save registers.
|
|
289
|
+
...(held.config.pm != null ? { binding: bindingOnSave(held.config.pm.system, t) } : {}),
|
|
197
290
|
};
|
|
198
291
|
});
|
|
199
292
|
for (const old of prior?.tools ?? []) {
|
|
@@ -203,8 +296,22 @@ export class McpRegistry {
|
|
|
203
296
|
const origin = held.egress?.origin ?? null;
|
|
204
297
|
// The confirmed origin is kept while the server still goes there: named now, or by an earlier save.
|
|
205
298
|
const allowedOrigin = origin !== null && (allowOrigin === origin || prior?.allowedOrigin === origin) ? origin : null;
|
|
299
|
+
const { address, sql, viewsAllowed, entry, id: _unsavedId, pm: heldPm, ...config } = held.config;
|
|
300
|
+
void _unsavedId;
|
|
301
|
+
// (DES-KNOWLEDGE-DATA-001 §5.1) A database source is stored as its Toolbox document (no `sql`): the read
|
|
302
|
+
// path projects it. A re-save keeps the entry's id; a new name gets a new one.
|
|
303
|
+
const stored = entry != null
|
|
304
|
+
? { kind: 'toolbox-source', toolbox: entry.toolbox, runtime: entry.runtime, tls: entry.tls, descriptorVersion: entry.descriptorVersion, policyVersion: entry.policyVersion }
|
|
305
|
+
: sql != null
|
|
306
|
+
? { sql }
|
|
307
|
+
: {};
|
|
206
308
|
const record = {
|
|
207
|
-
|
|
309
|
+
id: prior?.id ?? randomUUID(),
|
|
310
|
+
...config,
|
|
311
|
+
...stored,
|
|
312
|
+
...(address != null ? { address } : {}),
|
|
313
|
+
...(heldPm != null ? { pm: { system: heldPm.system } } : {}),
|
|
314
|
+
...(viewsAllowed != null ? { viewsAllowed } : {}),
|
|
208
315
|
...(allowedOrigin !== null ? { allowedOrigin } : {}),
|
|
209
316
|
enabled: prior?.enabled ?? true,
|
|
210
317
|
health: { state: 'ok', consecutiveFailures: 0, checkedAt: stamp, lastError: null },
|
|
@@ -212,11 +319,46 @@ export class McpRegistry {
|
|
|
212
319
|
updatedAt: stamp,
|
|
213
320
|
tools,
|
|
214
321
|
};
|
|
322
|
+
// (DES-APPS-001 §7.4, DES-KNOWLEDGE-DATA-001 §5.4) Allow writes is off on every new Postgres source, and
|
|
323
|
+
// "query" on every new source. A re-save keeps each only while the descriptor is unchanged, and a K1
|
|
324
|
+
// entry's first save writes descriptor version 2, which is a change (grants bind to the descriptor anyway).
|
|
325
|
+
const sameDescriptor = prior !== undefined && isSourceRecord(prior) && isSourceRecord(record) && sourceDescriptorHash(configOf(prior)) === sourceDescriptorHash(configOf(record));
|
|
326
|
+
if (isPostgresRecord(record))
|
|
327
|
+
record.allowWrites = prior !== undefined && prior.allowWrites === true && isPostgresRecord(prior) && sameDescriptor;
|
|
328
|
+
if (prior !== undefined && prior.agents !== undefined && isSourceRecord(prior) && isSourceRecord(record)) {
|
|
329
|
+
const was = agentAccessOf(prior);
|
|
330
|
+
record.agents = { ...was, query: was.query && sameDescriptor };
|
|
331
|
+
}
|
|
332
|
+
// (DES-PM-001 §3) A PM entry under the source safeguards: a re-save keeps its switches and its links, and turns
|
|
333
|
+
// "query" off when its execution descriptor changed (no issue is read until a person turns it on again).
|
|
334
|
+
if (prior !== undefined && priorPm !== null) {
|
|
335
|
+
const samePm = pmDescriptorHash(configOf(prior)) === pmDescriptorHash(configOf(record));
|
|
336
|
+
if (prior.agents !== undefined) {
|
|
337
|
+
const was = agentAccessOf(prior);
|
|
338
|
+
record.agents = { ...was, query: was.query && samePm };
|
|
339
|
+
}
|
|
340
|
+
if (prior.trackers !== undefined)
|
|
341
|
+
record.trackers = structuredClone(prior.trackers);
|
|
342
|
+
if (prior.retired !== undefined)
|
|
343
|
+
record.retired = structuredClone(prior.retired);
|
|
344
|
+
}
|
|
215
345
|
file.servers = [...file.servers.filter((s) => s.name !== record.name), record];
|
|
346
|
+
// The description lands INSIDE the record's own write (the store serializes mutations), so a
|
|
347
|
+
// record and its description can never be paired with another save's.
|
|
348
|
+
if (held.source !== null)
|
|
349
|
+
await this.catalogs.write(record.name, { ...held.source, descriptorHash: sourceDescriptorHash(configOf(record)) });
|
|
216
350
|
return record;
|
|
217
351
|
}));
|
|
218
352
|
return this.view(saved);
|
|
219
353
|
}
|
|
354
|
+
sourceChanged(name) {
|
|
355
|
+
try {
|
|
356
|
+
this.onSourceChanged?.(name);
|
|
357
|
+
}
|
|
358
|
+
catch {
|
|
359
|
+
// a listener's failure is its own (the projector logs); the registry write has landed
|
|
360
|
+
}
|
|
361
|
+
}
|
|
220
362
|
/**
|
|
221
363
|
* Run `commit`; if it throws and this save had written the OS secret store, put the entry back
|
|
222
364
|
* exactly as it was — deleted when there was no `prior` value, restored to `prior` when there
|
|
@@ -263,7 +405,7 @@ export class McpRegistry {
|
|
|
263
405
|
const held = this.previews.get(previewHash);
|
|
264
406
|
if (held === undefined || held.expiresAt <= this.now())
|
|
265
407
|
return;
|
|
266
|
-
const prior = (await this.
|
|
408
|
+
const prior = (await this.readFile()).servers.find((s) => s.name === held.config.name);
|
|
267
409
|
for (const name of enabledWrites) {
|
|
268
410
|
const t = held.tools.find((x) => x.name === name);
|
|
269
411
|
if (t === undefined)
|
|
@@ -277,8 +419,8 @@ export class McpRegistry {
|
|
|
277
419
|
}
|
|
278
420
|
/**
|
|
279
421
|
* (G2, DES-data-connectors §3) Refuse a save whose egress the operator has not confirmed: when
|
|
280
|
-
* the held preview's `egress.confirmRequired` (the base URL matches none of the spec's `servers
|
|
281
|
-
*
|
|
422
|
+
* the held preview's `egress.confirmRequired` (the base URL matches none of the spec's `servers`;
|
|
423
|
+
* a loopback/private host is the dialer's, confirmed as `address.allow`), `allowOrigin` must be exactly `egress.origin`
|
|
282
424
|
* (409 `egress_unconfirmed`). An `allowOrigin` that names another origin is refused the same way
|
|
283
425
|
* even when no confirmation is needed, and one for a server that is not `rest` is a 400
|
|
284
426
|
* `egress_not_rest`. Like {@link checkWriteGrants} it changes nothing, so the route calls it
|
|
@@ -294,11 +436,24 @@ export class McpRegistry {
|
|
|
294
436
|
throw new McpRegistryError(400, 'egress_not_rest', 'allowOrigin is for a rest server');
|
|
295
437
|
return;
|
|
296
438
|
}
|
|
297
|
-
const prior = (await this.
|
|
439
|
+
const prior = (await this.readFile()).servers.find((s) => s.name === held.config.name);
|
|
298
440
|
const refusal = egressRefusal(held.egress, allowOrigin, prior);
|
|
299
441
|
if (refusal !== null)
|
|
300
442
|
throw refusal;
|
|
301
443
|
}
|
|
444
|
+
/**
|
|
445
|
+
* (DES-KNOWLEDGE-DATA-001 §5.1) Refuse a `disclosures` review that does not fit the held preview: a tool it
|
|
446
|
+
* does not list (400 `unknown_tool`). Changes nothing. An unknown or expired preview is left for `save`.
|
|
447
|
+
*/
|
|
448
|
+
checkDisclosures(previewHash, disclosures) {
|
|
449
|
+
const held = this.previews.get(previewHash);
|
|
450
|
+
if (held === undefined || held.expiresAt <= this.now())
|
|
451
|
+
return;
|
|
452
|
+
for (const name of Object.keys(disclosures)) {
|
|
453
|
+
if (!held.tools.some((t) => t.name === name))
|
|
454
|
+
throw new McpRegistryError(400, 'unknown_tool', `disclosures names ${name}, which this preview does not list`);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
302
457
|
/**
|
|
303
458
|
* (G2) Whether every saved tool of the `rest` server `name` has a hash that covers the server's
|
|
304
459
|
* target. `false` for a registration saved before G2 (or whose url or auth header changed outside
|
|
@@ -306,7 +461,7 @@ export class McpRegistry {
|
|
|
306
461
|
* unknown server and for an MCP server.
|
|
307
462
|
*/
|
|
308
463
|
async targetBound(name) {
|
|
309
|
-
const s = (await this.
|
|
464
|
+
const s = (await this.readFile()).servers.find((x) => x.name === name);
|
|
310
465
|
return s === undefined || s.tools.every((t) => targetBound(s, t));
|
|
311
466
|
}
|
|
312
467
|
/** What a held preview would register: its server name and each tool's schema hash (S6). */
|
|
@@ -315,6 +470,8 @@ export class McpRegistry {
|
|
|
315
470
|
if (held === undefined || held.expiresAt <= this.now())
|
|
316
471
|
return null;
|
|
317
472
|
return {
|
|
473
|
+
pm: held.config.pm ?? null,
|
|
474
|
+
address: held.config.address ?? null,
|
|
318
475
|
name: held.config.name,
|
|
319
476
|
tools: held.tools.map((t) => ({ name: t.name, schemaHash: t.schemaHash })),
|
|
320
477
|
egress: held.egress,
|
|
@@ -322,7 +479,7 @@ export class McpRegistry {
|
|
|
322
479
|
};
|
|
323
480
|
}
|
|
324
481
|
async setServerEnabled(name, enabled) {
|
|
325
|
-
const rec = await this.
|
|
482
|
+
const rec = await this.mutate((file) => {
|
|
326
483
|
const s = this.find(file.servers, name);
|
|
327
484
|
s.enabled = enabled;
|
|
328
485
|
s.updatedAt = new Date(this.now()).toISOString();
|
|
@@ -332,9 +489,13 @@ export class McpRegistry {
|
|
|
332
489
|
}
|
|
333
490
|
/** Remove a server, and the keychain secret it owns (`keychain:wicked-mcp/<name>`). */
|
|
334
491
|
async remove(name) {
|
|
335
|
-
const removed = await this.
|
|
492
|
+
const removed = await this.mutate(async (file) => {
|
|
336
493
|
const s = this.find(file.servers, name);
|
|
337
494
|
file.servers = file.servers.filter((x) => x.name !== name);
|
|
495
|
+
// Inside the mutation, serialized with every save and upload: a source saved under this name
|
|
496
|
+
// next writes its catalog after this deletion, never before it.
|
|
497
|
+
if (isSourceRecord(s))
|
|
498
|
+
await this.catalogs.remove(name);
|
|
338
499
|
return s;
|
|
339
500
|
});
|
|
340
501
|
if (removed.auth?.ref === keychainRef(name) && this.deps.secrets.available) {
|
|
@@ -362,11 +523,19 @@ export class McpRegistry {
|
|
|
362
523
|
if (parts === null)
|
|
363
524
|
throw new McpRegistryError(404, 'unknown_tool', `no tool ${subject}`);
|
|
364
525
|
const stamp = new Date(this.now()).toISOString();
|
|
365
|
-
const { server, tool, grant } = await this.
|
|
526
|
+
const { server, tool, grant } = await this.mutate((file) => {
|
|
366
527
|
const s = this.find(file.servers, parts.server);
|
|
367
528
|
const t = s.tools.find((x) => x.name === parts.tool);
|
|
368
529
|
if (t === undefined)
|
|
369
530
|
throw new McpRegistryError(404, 'unknown_tool', `no tool ${subject}`);
|
|
531
|
+
// (DES-KNOWLEDGE-DATA-001 §5.1) A disclosure class is reviewed by a human operator, against the schema the
|
|
532
|
+
// operator saved; clearing one (the tool is offered to no agent) needs no review.
|
|
533
|
+
if (patch.disclosure != null) {
|
|
534
|
+
if (opts.mayReviewDisclosure !== true)
|
|
535
|
+
throw new McpRegistryError(403, 'disclosure_review_human_only', `only a human operator reviews what ${subject} discloses`);
|
|
536
|
+
if (t.schemaHash === null || t.schemaHash !== t.observedSchemaHash)
|
|
537
|
+
throw new McpRegistryError(409, 'not_registered', `${subject}'s schema is not the saved one: preview and save the server again, then review it`);
|
|
538
|
+
}
|
|
370
539
|
const before = t.enabled && isWriteGrant(t.annotations, t.classOverride);
|
|
371
540
|
const enabled = patch.enabled ?? t.enabled;
|
|
372
541
|
const override = patch.classOverride !== undefined ? patch.classOverride : t.classOverride;
|
|
@@ -376,6 +545,8 @@ export class McpRegistry {
|
|
|
376
545
|
}
|
|
377
546
|
t.enabled = enabled;
|
|
378
547
|
t.classOverride = override;
|
|
548
|
+
if (patch.disclosure !== undefined)
|
|
549
|
+
t.disclosure = patch.disclosure === null || t.schemaHash === null ? null : { class: patch.disclosure, schemaHash: t.schemaHash };
|
|
379
550
|
s.updatedAt = stamp;
|
|
380
551
|
return { server: s, tool: t, grant };
|
|
381
552
|
});
|
|
@@ -383,12 +554,12 @@ export class McpRegistry {
|
|
|
383
554
|
}
|
|
384
555
|
/** Probe a registered server again: record its health and its tool diff. */
|
|
385
556
|
async test(name) {
|
|
386
|
-
const current = this.find((await this.
|
|
557
|
+
const current = this.find((await this.readFile()).servers, name);
|
|
387
558
|
const config = configOf(current);
|
|
388
559
|
const result = await this.probe(config);
|
|
389
560
|
const stamp = new Date(this.now()).toISOString();
|
|
390
561
|
let diff = null;
|
|
391
|
-
const rec = await this.
|
|
562
|
+
const rec = await this.mutate((file) => {
|
|
392
563
|
const s = this.find(file.servers, name);
|
|
393
564
|
// A save with a different config landed while the probe ran: the result describes a server
|
|
394
565
|
// that is no longer registered, so it is not applied to the new one.
|
|
@@ -447,9 +618,10 @@ export class McpRegistry {
|
|
|
447
618
|
// orphan nothing can find again — a keychain service's entries cannot be enumerated — and it
|
|
448
619
|
// was the first half of the non-atomic add: secret, then save, with a window between them.
|
|
449
620
|
// A NEW server's secret is staged with its preview and committed by `save`.
|
|
450
|
-
const server = this.find((await this.
|
|
621
|
+
const server = this.find((await this.readFile()).servers, name);
|
|
451
622
|
if (server.auth?.ref !== ref) {
|
|
452
|
-
|
|
623
|
+
// The stored reference is a connection field: it is not echoed (an agent-kind caller reads errors too).
|
|
624
|
+
throw new McpRegistryError(400, 'secret_not_referenced', `${name} does not reference ${ref}, so a secret stored there would be unreachable; stage it with the preview instead`);
|
|
453
625
|
}
|
|
454
626
|
await this.deps.secrets.set(name, value);
|
|
455
627
|
return ref;
|
|
@@ -460,7 +632,7 @@ export class McpRegistry {
|
|
|
460
632
|
* was saved reads `registered: false`, which the engine denies (D-5).
|
|
461
633
|
*/
|
|
462
634
|
async resolveCall(server, tool) {
|
|
463
|
-
const s = (await this.
|
|
635
|
+
const s = (await this.readFile()).servers.find((x) => x.name === server);
|
|
464
636
|
if (s === undefined)
|
|
465
637
|
return null;
|
|
466
638
|
const t = s.tools.find((x) => x.name === tool);
|
|
@@ -469,8 +641,12 @@ export class McpRegistry {
|
|
|
469
641
|
rest: t?.rest ?? null,
|
|
470
642
|
annotations: t?.annotations ?? null,
|
|
471
643
|
classOverride: t?.classOverride ?? null,
|
|
644
|
+
schemaHash: t?.schemaHash ?? null,
|
|
645
|
+
disclosure: t === undefined ? null : effectiveDisclosure(t),
|
|
646
|
+
id: entryId(s),
|
|
472
647
|
registered: s.enabled && t !== undefined && t.enabled && statusOf(s, t) === 'registered',
|
|
473
648
|
resaveRequired: t !== undefined && !targetBound(s, t),
|
|
649
|
+
...(hasPmMarker(s) ? { pm: true } : {}),
|
|
474
650
|
};
|
|
475
651
|
}
|
|
476
652
|
/**
|
|
@@ -480,16 +656,19 @@ export class McpRegistry {
|
|
|
480
656
|
*/
|
|
481
657
|
async callableTools() {
|
|
482
658
|
const out = [];
|
|
483
|
-
for (const s of (await this.
|
|
484
|
-
|
|
659
|
+
for (const s of (await this.readFile()).servers) {
|
|
660
|
+
// (DES-PM-001 §3.1) A PM entry's tools are the gate's to list, bound to the unit's tracker set; never raw.
|
|
661
|
+
if (!s.enabled || hasPmMarker(s))
|
|
485
662
|
continue;
|
|
486
663
|
for (const t of s.tools) {
|
|
487
664
|
if (!t.enabled || statusOf(s, t) !== 'registered')
|
|
488
665
|
continue;
|
|
489
666
|
out.push({
|
|
490
667
|
server: s.name,
|
|
668
|
+
id: entryId(s),
|
|
491
669
|
tool: t.name,
|
|
492
|
-
kind: s.kind,
|
|
670
|
+
kind: configOf(s).kind,
|
|
671
|
+
disclosure: effectiveDisclosure(t),
|
|
493
672
|
annotations: t.annotations,
|
|
494
673
|
classOverride: t.classOverride,
|
|
495
674
|
description: t.description,
|
|
@@ -504,7 +683,7 @@ export class McpRegistry {
|
|
|
504
683
|
* enabled or not (an operator debugs a server it switched off), or `null` for no such name.
|
|
505
684
|
*/
|
|
506
685
|
async inspectTarget(name) {
|
|
507
|
-
const s = (await this.
|
|
686
|
+
const s = (await this.readFile()).servers.find((x) => x.name === name);
|
|
508
687
|
return s === undefined ? null : configOf(s);
|
|
509
688
|
}
|
|
510
689
|
/**
|
|
@@ -518,7 +697,287 @@ export class McpRegistry {
|
|
|
518
697
|
const secret = await resolveSecret(config.auth.ref, this.deps.secrets, this.env);
|
|
519
698
|
return { secret, missing: secret === null };
|
|
520
699
|
}
|
|
700
|
+
// ── Apps data sources (DES-APPS-001 §5, §7.4) ─────────────────────────────────────────────
|
|
701
|
+
/**
|
|
702
|
+
* A `sql` or `graphql` source as the sources routes need it: its config, its Allow writes switch
|
|
703
|
+
* and its stored description (`null` until described). 404 for no such source, 400 for a server
|
|
704
|
+
* that is not one.
|
|
705
|
+
*/
|
|
706
|
+
async source(name) {
|
|
707
|
+
const s = this.find((await this.readFile()).servers, name);
|
|
708
|
+
const config = configOf(s);
|
|
709
|
+
if (config.kind !== 'sql' && config.kind !== 'graphql')
|
|
710
|
+
throw new McpRegistryError(400, 'not_a_source', `${name} is an ${config.kind} server, not a data source`);
|
|
711
|
+
const descriptorHash = sourceDescriptorHash(config);
|
|
712
|
+
const stored = await this.catalogs.read(name);
|
|
713
|
+
// A description taken under another descriptor (a re-save since) is not this source's: not described.
|
|
714
|
+
return { config, allowWrites: s.allowWrites === true, description: stored !== null && stored.descriptorHash === descriptorHash ? stored : null, descriptorHash, enabled: s.enabled };
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* (DES-APPS-001 §9.4) A REST or MCP server's tool as an Apps query or API action uses it: the server's
|
|
718
|
+
* config and descriptor hash, and the tool's record, with whether the person's saved schema still is the
|
|
719
|
+
* one the server shows (`bound`). The per-tool switch (G1) governs agent runs only, so a tool's `enabled`
|
|
720
|
+
* is not consulted here; a server switched off is. `null` = no such server or tool.
|
|
721
|
+
*/
|
|
722
|
+
async appTool(server, tool) {
|
|
723
|
+
const s = (await this.readFile()).servers.find((x) => x.name === server);
|
|
724
|
+
if (s === undefined || (s.kind !== 'rest' && s.kind !== 'mcp-http' && s.kind !== 'mcp-stdio'))
|
|
725
|
+
return null;
|
|
726
|
+
// (DES-PM-001) PM-1 gives Apps no PM entry: its tools are read only through the gate's bindings.
|
|
727
|
+
if (hasPmMarker(s))
|
|
728
|
+
return null;
|
|
729
|
+
const t = s.tools.find((x) => x.name === tool);
|
|
730
|
+
if (t === undefined)
|
|
731
|
+
return null;
|
|
732
|
+
return { config: configOf(s), tool: structuredClone(t), bound: s.enabled && statusOf(s, t) === 'registered' };
|
|
733
|
+
}
|
|
734
|
+
/** (K2b) A server's config and whether it is switched on, from ONE read of the store (no presentation work). */
|
|
735
|
+
async snapshot(name) {
|
|
736
|
+
const s = (await this.readFile()).servers.find((x) => x.name === name);
|
|
737
|
+
return s === undefined ? null : { config: configOf(s), enabled: s.enabled };
|
|
738
|
+
}
|
|
739
|
+
/** Store a fresh description of a source (a re-describe), bound to the descriptor it was taken under. */
|
|
740
|
+
async saveDescription(name, description, descriptorHash) {
|
|
741
|
+
// Checked and written inside one registry mutation (serialized with every save), so a save that
|
|
742
|
+
// lands while the source was being described always wins.
|
|
743
|
+
await this.mutate(async (file) => {
|
|
744
|
+
const s = this.find(file.servers, name);
|
|
745
|
+
if (sourceDescriptorHash(configOf(s)) !== descriptorHash)
|
|
746
|
+
throw new McpRegistryError(409, 'server_changed', `${name} was saved again while it was being described; describe it again`);
|
|
747
|
+
await this.catalogs.write(name, { ...description, descriptorHash });
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* (DES-APPS-001 §7.4) Turn a Postgres source's Allow writes switch on or off. The route allows a
|
|
752
|
+
* human operator only and audits it; turning it off withdraws the source's row-write grants (the
|
|
753
|
+
* caller's hook). Answers whether it changed.
|
|
754
|
+
*/
|
|
755
|
+
async setAllowWrites(name, allowed) {
|
|
756
|
+
const { before, rec } = await this.mutate((file) => {
|
|
757
|
+
const s = this.find(file.servers, name);
|
|
758
|
+
if (!isPostgresRecord(s))
|
|
759
|
+
throw new McpRegistryError(400, 'writes_not_supported', `${name} is not a Postgres source: v1 row writes are Postgres only`);
|
|
760
|
+
const was = s.allowWrites === true;
|
|
761
|
+
s.allowWrites = allowed;
|
|
762
|
+
s.updatedAt = new Date(this.now()).toISOString();
|
|
763
|
+
return { before: was, rec: s };
|
|
764
|
+
});
|
|
765
|
+
return { before, after: allowed, server: await this.view(rec) };
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Register (or replace) an uploaded snapshot as a `sql`/`sqlite` source (DES-APPS-001 §5.1). The
|
|
769
|
+
* upload IS the person's act, so there is no preview; a name held by any other kind is refused.
|
|
770
|
+
*/
|
|
771
|
+
async registerSnapshotSource(name, digest, description) {
|
|
772
|
+
if (name === CREW_SOURCE || name === ESTATE_SERVER)
|
|
773
|
+
throw new McpRegistryError(400, 'reserved_name', `"${name}" is reserved; choose another name`);
|
|
774
|
+
const stamp = new Date(this.now()).toISOString();
|
|
775
|
+
const rec = await this.mutate(async (file) => {
|
|
776
|
+
const prior = file.servers.find((s) => s.name === name);
|
|
777
|
+
if (prior !== undefined && !(prior.kind === 'sql' && prior.sql?.driver === 'sqlite')) {
|
|
778
|
+
throw new McpRegistryError(409, 'name_taken', `${name} is already a registered ${prior.kind} server; choose another name`);
|
|
779
|
+
}
|
|
780
|
+
const record = {
|
|
781
|
+
id: prior?.id ?? randomUUID(),
|
|
782
|
+
name,
|
|
783
|
+
kind: 'sql',
|
|
784
|
+
command: null,
|
|
785
|
+
args: [],
|
|
786
|
+
url: null,
|
|
787
|
+
auth: null,
|
|
788
|
+
sql: { driver: 'sqlite', snapshot: digest },
|
|
789
|
+
viewsAllowed: [],
|
|
790
|
+
enabled: true,
|
|
791
|
+
health: { state: 'ok', consecutiveFailures: 0, checkedAt: stamp, lastError: null },
|
|
792
|
+
registeredAt: prior?.registeredAt ?? stamp,
|
|
793
|
+
updatedAt: stamp,
|
|
794
|
+
tools: [],
|
|
795
|
+
// (DES-KNOWLEDGE-DATA-001 §7.1) A new upload of the same name keeps the person's agent switches; "query"
|
|
796
|
+
// only when it is the same snapshot (a new digest is a new descriptor).
|
|
797
|
+
...(prior?.agents !== undefined ? { agents: { ...agentAccessOf(prior), query: agentAccessOf(prior).query && prior.sql?.snapshot === digest } } : {}),
|
|
798
|
+
};
|
|
799
|
+
file.servers = [...file.servers.filter((s) => s.name !== name), record];
|
|
800
|
+
await this.catalogs.write(name, { ...description, descriptorHash: sourceDescriptorHash(configOf(record)) });
|
|
801
|
+
return record;
|
|
802
|
+
});
|
|
803
|
+
return this.view(rec);
|
|
804
|
+
}
|
|
805
|
+
// ── Generations (DES-KNOWLEDGE-DATA-001 §5.5) ──────────────────────────────────────────────
|
|
806
|
+
/**
|
|
807
|
+
* Read, normalize, VALIDATE and RECONCILE a kept generation, with no side effect on the registry (§5.5): the one
|
|
808
|
+
* snapshot a restore plans its approval withdrawals against and then commits as it is, so a restore refused for
|
|
809
|
+
* any reason withdraws nothing, and a generation pruned meanwhile cannot fail it half-way. 404
|
|
810
|
+
* `unknown_generation` when it is not kept; 409 `generation_unreadable` when it cannot be read, does not parse, or
|
|
811
|
+
* holds a record crew could not have written; 400 with the policy's code when a database source fails the
|
|
812
|
+
* deployment policy (a hand edit).
|
|
813
|
+
*
|
|
814
|
+
* The reconciliation fails closed: "query" and Allow writes come back OFF on every source (a person turns them on
|
|
815
|
+
* again); a missing secret disables its server at the commit ({@link restore}); grants stay bound to their
|
|
816
|
+
* descriptors and are judged where they are used. The secret check reads the value only to compare it with
|
|
817
|
+
* nothing, and drops it at once.
|
|
818
|
+
*/
|
|
819
|
+
async planRestore(generation) {
|
|
820
|
+
let kept;
|
|
821
|
+
try {
|
|
822
|
+
kept = await this.deps.store.readGeneration(generation);
|
|
823
|
+
}
|
|
824
|
+
catch (err) {
|
|
825
|
+
const why = err instanceof Error ? err.message : String(err);
|
|
826
|
+
throw new McpRegistryError(409, 'generation_unreadable', `generation ${generation} cannot be read, so it cannot be restored: ${why}`);
|
|
827
|
+
}
|
|
828
|
+
if (kept === null)
|
|
829
|
+
throw new McpRegistryError(404, 'unknown_generation', `generation ${generation} is not kept (the registry keeps the last ${GENERATIONS_KEPT})`);
|
|
830
|
+
let servers;
|
|
831
|
+
try {
|
|
832
|
+
for (const raw of kept.servers) {
|
|
833
|
+
const problem = recordShapeProblem(raw);
|
|
834
|
+
if (problem !== null)
|
|
835
|
+
throw new Error(`${String(raw.name)}: ${problem}`);
|
|
836
|
+
}
|
|
837
|
+
servers = structuredClone(normalizeRegistryFile(kept).servers);
|
|
838
|
+
}
|
|
839
|
+
catch (err) {
|
|
840
|
+
const why = err instanceof Error ? err.message : String(err);
|
|
841
|
+
throw new McpRegistryError(409, 'generation_unreadable', `generation ${generation} is not a registry crew can read: ${why}`);
|
|
842
|
+
}
|
|
843
|
+
for (const s of servers) {
|
|
844
|
+
if (s.kind !== 'toolbox-source')
|
|
845
|
+
continue;
|
|
846
|
+
try {
|
|
847
|
+
checkSourceDocument(s.toolbox, { runtime: s.runtime ?? 'native' });
|
|
848
|
+
}
|
|
849
|
+
catch (err) {
|
|
850
|
+
throw policyRefusal(err);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
const queryReset = [];
|
|
854
|
+
const writesReset = [];
|
|
855
|
+
for (const s of servers) {
|
|
856
|
+
if (!isGovernedRecord(s))
|
|
857
|
+
continue;
|
|
858
|
+
const a = agentAccessOf(s);
|
|
859
|
+
if (a.query)
|
|
860
|
+
queryReset.push(s.name);
|
|
861
|
+
if (s.agents !== undefined || a.query)
|
|
862
|
+
s.agents = { ...a, query: false };
|
|
863
|
+
if (s.allowWrites === true)
|
|
864
|
+
writesReset.push(s.name);
|
|
865
|
+
if (isPostgresRecord(s))
|
|
866
|
+
s.allowWrites = false;
|
|
867
|
+
}
|
|
868
|
+
return Object.freeze({ generation, servers: Object.freeze(servers), queryReset: Object.freeze(queryReset), writesReset: Object.freeze(writesReset) });
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* Commit a planned restore (§5.5). The route calls it under every affected server's lock, after its approval
|
|
872
|
+
* withdrawals, so the secrets are judged HERE, after any removal of those servers has finished (codex r3): a server
|
|
873
|
+
* whose secret reference does not RESOLVE to a value now comes back DISABLED, `secret_missing`. Nothing here can
|
|
874
|
+
* throw on a planned record, so after the withdrawals only a failing write refuses a restore (the registry is then
|
|
875
|
+
* unchanged and the approvals withdrawn: the safe direction).
|
|
876
|
+
*
|
|
877
|
+
* `expected` is the set of servers the route locked and judged. A server registered after that (it holds no lock of
|
|
878
|
+
* the restore's) is not overwritten: the restore is refused, 409 `registry_busy`, and nothing is written.
|
|
879
|
+
*/
|
|
880
|
+
async restore(plan, expected) {
|
|
881
|
+
const servers = structuredClone(plan.servers);
|
|
882
|
+
const disabled = [];
|
|
883
|
+
const stamp = new Date(this.now()).toISOString();
|
|
884
|
+
for (const s of servers) {
|
|
885
|
+
if (s.auth === null || (await this.secretResolves(s.auth)))
|
|
886
|
+
continue;
|
|
887
|
+
if (s.enabled)
|
|
888
|
+
disabled.push({ name: s.name, code: 'secret_missing' });
|
|
889
|
+
s.enabled = false;
|
|
890
|
+
s.health = { ...s.health, checkedAt: stamp, lastError: `secret_missing: ${s.auth.ref} resolves to no secret; set it, then switch ${s.name} on` };
|
|
891
|
+
s.updatedAt = stamp;
|
|
892
|
+
}
|
|
893
|
+
const current = await this.mutate((file) => {
|
|
894
|
+
if (expected !== undefined) {
|
|
895
|
+
const late = file.servers.map((s) => s.name).filter((n) => !expected.includes(n));
|
|
896
|
+
if (late.length > 0)
|
|
897
|
+
throw new McpRegistryError(409, 'registry_busy', `${late.join(', ')} was registered while the restore ran; nothing was restored: try again`);
|
|
898
|
+
}
|
|
899
|
+
file.servers = servers;
|
|
900
|
+
return file.generation ?? 0;
|
|
901
|
+
});
|
|
902
|
+
for (const s of servers)
|
|
903
|
+
if (isSourceRecord(s))
|
|
904
|
+
this.sourceChanged(s.name);
|
|
905
|
+
// (DES-PM-001 §3.4) A restored generation brings its tracker links back: the projection reconciles to them.
|
|
906
|
+
this.onRestored?.();
|
|
907
|
+
return { restored: plan.generation, generation: current + 1, servers: servers.length, disabled, queryReset: [...plan.queryReset], writesReset: [...plan.writesReset] };
|
|
908
|
+
}
|
|
909
|
+
/** Whether a secret reference resolves to a non-empty value now; any error reading it counts as no (fail closed). */
|
|
910
|
+
async secretResolves(auth) {
|
|
911
|
+
try {
|
|
912
|
+
const value = await resolveSecret(auth.ref, this.deps.secrets, this.env);
|
|
913
|
+
return value !== null && value !== '';
|
|
914
|
+
}
|
|
915
|
+
catch {
|
|
916
|
+
return false;
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* A config as a save will store it (DES-KNOWLEDGE-DATA-001 §5.1): a network Postgres source, sent in K1's form
|
|
921
|
+
* or as a Toolbox document, becomes a Toolbox-form entry (descriptor version 2), checked against the deployment
|
|
922
|
+
* policy; a native-runtime entry carries its K1 projection, which is what the probe describes.
|
|
923
|
+
*/
|
|
924
|
+
forSave(config) {
|
|
925
|
+
try {
|
|
926
|
+
if (config.kind === 'sql' && config.sql?.driver === 'postgres') {
|
|
927
|
+
const entry = toolboxEntryFromSql(config, 2);
|
|
928
|
+
return entry === null ? config : { ...config, entry };
|
|
929
|
+
}
|
|
930
|
+
if (config.kind !== 'toolbox-source')
|
|
931
|
+
return config;
|
|
932
|
+
const raw = config.entry ?? null;
|
|
933
|
+
if (raw === null)
|
|
934
|
+
throw new McpRegistryError(400, 'bad_toolbox', 'a toolbox-source carries its Toolbox source document');
|
|
935
|
+
const toolbox = checkSourceDocument(raw.toolbox, { runtime: raw.runtime });
|
|
936
|
+
const entry = { toolbox, runtime: raw.runtime, tls: { mode: raw.tls.mode, ca: raw.tls.ca ?? null }, descriptorVersion: 2, policyVersion: policyVersionOf(toolbox.type) };
|
|
937
|
+
if (raw.runtime === 'native') {
|
|
938
|
+
return { ...config, kind: 'sql', sql: sqlFromToolboxEntry(entry), viewsAllowed: config.viewsAllowed ?? [], address: config.address ?? { ...NO_CONFIRMATION, allow: [] }, entry };
|
|
939
|
+
}
|
|
940
|
+
if (this.deps.toolboxProbe === undefined) {
|
|
941
|
+
throw new McpRegistryError(501, 'runtime_unavailable', 'this daemon has no Toolbox runtime yet: save the source with runtime "native" (Postgres)');
|
|
942
|
+
}
|
|
943
|
+
return { ...config, entry };
|
|
944
|
+
}
|
|
945
|
+
catch (err) {
|
|
946
|
+
throw policyRefusal(err);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
521
949
|
// ── internals ──────────────────────────────────────────────────────────────────────────────
|
|
950
|
+
/** The registry as every reader sees it: ids present, K1 Postgres records mapped (DES-KNOWLEDGE-DATA-001 §5.4). */
|
|
951
|
+
async readFile() {
|
|
952
|
+
return normalizeRegistryFile(await this.deps.store.read());
|
|
953
|
+
}
|
|
954
|
+
/**
|
|
955
|
+
* One mutation of the normalized registry. The write persists the normalized form (ids, mapped entries). Every
|
|
956
|
+
* Toolbox document that is new or changed by the mutation is checked against its deployment policy before the
|
|
957
|
+
* write lands, so no path saves one the policy refuses.
|
|
958
|
+
*/
|
|
959
|
+
mutate(fn) {
|
|
960
|
+
return this.deps.store.mutate(async (file) => {
|
|
961
|
+
normalizeRegistryFile(file);
|
|
962
|
+
// What the policy judges: the document AND the runtime it is judged for.
|
|
963
|
+
const judged = (s) => canonicalJson({ toolbox: s.toolbox ?? null, runtime: s.runtime ?? null, kind: s.kind });
|
|
964
|
+
const before = new Map(file.servers.map((s) => [s.name, judged(s)]));
|
|
965
|
+
const result = await fn(file);
|
|
966
|
+
for (const s of file.servers) {
|
|
967
|
+
if (s.kind !== 'toolbox-source')
|
|
968
|
+
continue;
|
|
969
|
+
if (before.get(s.name) === judged(s))
|
|
970
|
+
continue;
|
|
971
|
+
try {
|
|
972
|
+
checkSourceDocument(s.toolbox, { runtime: s.runtime ?? 'native' });
|
|
973
|
+
}
|
|
974
|
+
catch (err) {
|
|
975
|
+
throw policyRefusal(err);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
return result;
|
|
979
|
+
});
|
|
980
|
+
}
|
|
522
981
|
find(servers, name) {
|
|
523
982
|
const s = servers.find((x) => x.name === name);
|
|
524
983
|
if (s === undefined)
|
|
@@ -541,15 +1000,19 @@ export class McpRegistry {
|
|
|
541
1000
|
* without connecting.
|
|
542
1001
|
*/
|
|
543
1002
|
async probe(config, staged = null) {
|
|
1003
|
+
// (DES-KNOWLEDGE-DATA-001 §6.3) A Toolbox-runtime source is probed by the Toolbox runtime, never as a server.
|
|
1004
|
+
const prober = config.kind === 'toolbox-source' ? this.deps.toolboxProbe : this.deps.probe;
|
|
1005
|
+
if (prober === undefined)
|
|
1006
|
+
return { ok: false, error: 'this daemon has no Toolbox runtime' };
|
|
544
1007
|
if (config.auth === null)
|
|
545
|
-
return
|
|
1008
|
+
return prober(config, null);
|
|
546
1009
|
// (crew#719) A staged secret is probed with instead of being written first. The caller has
|
|
547
1010
|
// already checked it belongs to THIS server's keychain reference.
|
|
548
1011
|
const secret = staged ?? (await resolveSecret(config.auth.ref, this.deps.secrets, this.env));
|
|
549
1012
|
if (secret === null) {
|
|
550
1013
|
return { ok: false, error: `auth.ref ${config.auth.ref} resolves to no secret: set it, then try again`, missingSecret: true };
|
|
551
1014
|
}
|
|
552
|
-
return
|
|
1015
|
+
return prober(config, secret);
|
|
553
1016
|
}
|
|
554
1017
|
async authState(auth) {
|
|
555
1018
|
if (auth === null)
|
|
@@ -558,11 +1021,22 @@ export class McpRegistry {
|
|
|
558
1021
|
return 'missing';
|
|
559
1022
|
return (await secretIsSet(auth.ref, this.deps.secrets, this.env)) ? 'set' : 'missing';
|
|
560
1023
|
}
|
|
1024
|
+
/** A PM entry's links as the sheet shows them (read-only there; written only through the tracker-links routes). */
|
|
1025
|
+
trackerLinksOf(s) {
|
|
1026
|
+
const pm = pmOf(s);
|
|
1027
|
+
return pm === null ? [] : trackerLinkViews({ id: entryId(s), name: s.name, system: pm.system }, trackersOf(s), this.trackerProjection);
|
|
1028
|
+
}
|
|
561
1029
|
async view(s) {
|
|
562
1030
|
const tools = s.tools.map((t) => toolView(s, t));
|
|
563
1031
|
const live = tools.filter((t) => t.status !== 'gone');
|
|
1032
|
+
const isSource = isSourceRecord(s);
|
|
1033
|
+
const pm = pmOf(s);
|
|
564
1034
|
return {
|
|
1035
|
+
id: entryId(s),
|
|
565
1036
|
...configView(configOf(s)),
|
|
1037
|
+
...(isPostgresRecord(s) ? { allowWrites: s.allowWrites === true } : {}),
|
|
1038
|
+
...(isSource ? { descriptorHash: sourceDescriptorHash(configOf(s)), agents: agentAccessOf(s) } : {}),
|
|
1039
|
+
...(pm !== null ? { agents: agentAccessOf(s), trackers: this.trackerLinksOf(s) } : {}),
|
|
566
1040
|
authState: await this.authState(s.auth),
|
|
567
1041
|
enabled: s.enabled,
|
|
568
1042
|
health: s.health,
|
|
@@ -580,19 +1054,81 @@ export class McpRegistry {
|
|
|
580
1054
|
};
|
|
581
1055
|
}
|
|
582
1056
|
}
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
1057
|
+
/**
|
|
1058
|
+
* A record as every consumer reads it: the READ-PATH PROJECTION (DES-KNOWLEDGE-DATA-001 §5.4). A native-runtime
|
|
1059
|
+
* `toolbox-source` entry answers K1's `kind: 'sql'` config, with `config.sql` synthesised from its Toolbox document,
|
|
1060
|
+
* so no consumer sees the new form until it moves onto the gate (M3b); `config.entry` carries the stored form. A
|
|
1061
|
+
* `runtime: 'toolbox'` entry keeps `kind: 'toolbox-source'` and has no `sql`: Apps cannot read it in v1 (§6.3).
|
|
1062
|
+
*/
|
|
1063
|
+
export function configOf(s) {
|
|
1064
|
+
const pm = pmOf(s);
|
|
1065
|
+
const base = { name: s.name, kind: s.kind, command: s.command, args: s.args, url: s.url, auth: s.auth, ...(s.id !== undefined ? { id: s.id } : {}), ...(pm !== null ? { pm } : {}) };
|
|
1066
|
+
if (s.kind === 'toolbox-source') {
|
|
1067
|
+
const entry = entryOf(s);
|
|
1068
|
+
const address = s.address ?? { ...NO_CONFIRMATION, allow: [] };
|
|
1069
|
+
if (entry === null)
|
|
1070
|
+
return { ...base, address };
|
|
1071
|
+
if (entry.runtime === 'native')
|
|
1072
|
+
return { ...base, kind: 'sql', sql: sqlFromToolboxEntry(entry), viewsAllowed: s.viewsAllowed ?? [], address, entry };
|
|
1073
|
+
return { ...base, address, viewsAllowed: s.viewsAllowed ?? [], entry };
|
|
1074
|
+
}
|
|
1075
|
+
if (s.kind === 'mcp-stdio')
|
|
586
1076
|
return base;
|
|
587
|
-
|
|
1077
|
+
if (s.kind === 'sql') {
|
|
1078
|
+
const sqlite = s.sql?.driver === 'sqlite';
|
|
1079
|
+
return { ...base, sql: s.sql ?? null, viewsAllowed: s.viewsAllowed ?? [], ...(sqlite ? {} : { address: s.address ?? { ...NO_CONFIRMATION, allow: [] } }) };
|
|
1080
|
+
}
|
|
1081
|
+
if (s.kind === 'graphql')
|
|
1082
|
+
return { ...base, address: s.address ?? { ...NO_CONFIRMATION, allow: [] } };
|
|
1083
|
+
const address = s.address ?? legacyAddress(s);
|
|
1084
|
+
if (s.kind !== 'rest')
|
|
1085
|
+
return { ...base, address };
|
|
1086
|
+
return { ...base, openapiUrl: s.openapiUrl ?? null, openapi: s.openapi ?? null, operations: s.operations ?? null, address };
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* (DES-APPS-001 §5.2) The confirmation of a record saved before the dialer, which has none. Only
|
|
1090
|
+
* what is safe to re-derive: the IP literal, or `localhost`, it was explicitly registered at — an
|
|
1091
|
+
* `mcp-http` server's url, or the origin a `rest` server's operator confirmed with G2's
|
|
1092
|
+
* `allowOrigin` (before the dialer, the only way a rest server reached a loopback or private host).
|
|
1093
|
+
* An IP literal is the exact address (no name to re-resolve); `localhost` is loopback by definition
|
|
1094
|
+
* (RFC 6761). A private NAME is not re-derived: its calls are refused, naming the range to confirm,
|
|
1095
|
+
* until the server is saved again with one.
|
|
1096
|
+
*/
|
|
1097
|
+
export function legacyAddress(s) {
|
|
1098
|
+
const raw = s.kind === 'mcp-http' ? s.url : s.kind === 'rest' ? (s.allowedOrigin ?? null) : null;
|
|
1099
|
+
const allow = exactRangesFor(raw);
|
|
1100
|
+
if (allow.length === 0)
|
|
1101
|
+
return { ...NO_CONFIRMATION, allow: [] };
|
|
1102
|
+
// A private IP literal registered over http was registered as plaintext; loopback never needs it.
|
|
1103
|
+
const host = new URL(raw).hostname.replace(/^\[|\]$/g, '');
|
|
1104
|
+
const plaintext = new URL(raw).protocol === 'http:' && isIP(host) !== 0 && classifyAddress(host).cls === 'private';
|
|
1105
|
+
return { allow, plaintext };
|
|
588
1106
|
}
|
|
589
1107
|
/** What a response shows of a config. A pasted OpenAPI document is not echoed back. */
|
|
590
1108
|
function configView(c) {
|
|
591
1109
|
const view = { name: c.name, kind: c.kind, command: c.command, args: c.args, url: c.url, auth: c.auth };
|
|
1110
|
+
if (c.pm != null)
|
|
1111
|
+
view.pm = { system: c.pm.system };
|
|
592
1112
|
if (c.kind === 'rest') {
|
|
593
1113
|
view.openapiUrl = c.openapiUrl ?? null;
|
|
594
1114
|
view.operations = c.operations ?? null;
|
|
595
1115
|
}
|
|
1116
|
+
if (c.kind !== 'mcp-stdio' && !(c.kind === 'sql' && c.sql?.driver === 'sqlite'))
|
|
1117
|
+
view.address = c.address ?? { ...NO_CONFIRMATION, allow: [] };
|
|
1118
|
+
if (c.kind === 'sql' && c.sql != null) {
|
|
1119
|
+
view.sql = { driver: c.sql.driver, host: c.sql.host ?? null, port: c.sql.port ?? null, database: c.sql.database ?? null, user: c.sql.user ?? null, tls: c.sql.tls ?? 'verify-full', ca: c.sql.ca != null, snapshot: c.sql.snapshot ?? null };
|
|
1120
|
+
view.viewsAllowed = c.viewsAllowed ?? [];
|
|
1121
|
+
}
|
|
1122
|
+
// (DES-KNOWLEDGE-DATA-001 §5.1) The stored form of a database source: its Toolbox document (the password is a
|
|
1123
|
+
// placeholder, never a value), runtime and versions. A human operator's view only.
|
|
1124
|
+
if (c.entry != null) {
|
|
1125
|
+
view.runtime = c.entry.runtime;
|
|
1126
|
+
view.toolbox = c.entry.toolbox;
|
|
1127
|
+
view.descriptorVersion = c.entry.descriptorVersion;
|
|
1128
|
+
view.policyVersion = c.entry.policyVersion;
|
|
1129
|
+
if (c.kind === 'toolbox-source')
|
|
1130
|
+
view.viewsAllowed = c.viewsAllowed ?? [];
|
|
1131
|
+
}
|
|
596
1132
|
return view;
|
|
597
1133
|
}
|
|
598
1134
|
/**
|
|
@@ -631,10 +1167,11 @@ function egressRefusal(egress, allowOrigin, prior) {
|
|
|
631
1167
|
}
|
|
632
1168
|
if (allowOrigin !== null || prior?.allowedOrigin === egress.origin)
|
|
633
1169
|
return null;
|
|
1170
|
+
// (DES-APPS-001 §5.2) A loopback, private or unresolvable host is the dialer's to judge, at every
|
|
1171
|
+
// connection under the server's confirmed ranges; a preview could not have reached here with an
|
|
1172
|
+
// unconfirmed one. `allowOrigin` is only the operator accepting a base URL the spec does not list.
|
|
634
1173
|
const why = [
|
|
635
1174
|
...(egress.matches ? [] : [egress.servers.length === 0 ? 'the OpenAPI document names no server crew can check it against' : `it matches none of the OpenAPI document's servers (${egress.servers.join(', ')})`]),
|
|
636
|
-
...(egress.privateAddress ? ['it is a loopback or private address'] : []),
|
|
637
|
-
...(egress.resolved ? [] : ['its host did not resolve, so crew could not check that it is not a private address']),
|
|
638
1175
|
];
|
|
639
1176
|
if (why.length === 0)
|
|
640
1177
|
return null;
|
|
@@ -663,6 +1200,7 @@ function statusOf(s, t) {
|
|
|
663
1200
|
}
|
|
664
1201
|
function toolView(s, t) {
|
|
665
1202
|
const derivedClass = deriveToolClass(t.annotations);
|
|
1203
|
+
const pm = pmOf(s);
|
|
666
1204
|
return {
|
|
667
1205
|
name: t.name,
|
|
668
1206
|
...(t.rest != null ? { rest: t.rest } : {}),
|
|
@@ -677,6 +1215,8 @@ function toolView(s, t) {
|
|
|
677
1215
|
status: statusOf(s, t),
|
|
678
1216
|
schemaHash: t.schemaHash,
|
|
679
1217
|
observedSchemaHash: t.observedSchemaHash,
|
|
1218
|
+
disclosure: effectiveDisclosure(t),
|
|
1219
|
+
...(pm !== null ? { binding: t.binding == null ? null : { policy: t.binding.policy, schemaHash: t.binding.schemaHash, inForce: bindingInForce(pm.system, t) !== null } } : {}),
|
|
680
1220
|
};
|
|
681
1221
|
}
|
|
682
1222
|
/** The difference between the registered tools and a probe's (by name, then schema hash). */
|
|
@@ -698,4 +1238,164 @@ export function diffTools(registered, probed) {
|
|
|
698
1238
|
diff.removed.push(t.name);
|
|
699
1239
|
return diff;
|
|
700
1240
|
}
|
|
1241
|
+
// ── The one registry's entry (DES-KNOWLEDGE-DATA-001 §5) ─────────────────────────────────────────
|
|
1242
|
+
/** A data source of any form: K1 `sql`/`graphql`, or a Toolbox-form database source. */
|
|
1243
|
+
export function isSourceRecord(s) {
|
|
1244
|
+
return s.kind === 'sql' || s.kind === 'graphql' || s.kind === 'toolbox-source';
|
|
1245
|
+
}
|
|
1246
|
+
/** (DES-PM-001 §3) A record under the source safeguards: a data source, or a PM entry (Agents switches, restore resets). */
|
|
1247
|
+
export function isGovernedRecord(s) {
|
|
1248
|
+
return isSourceRecord(s) || pmOf(s) !== null;
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* (DES-PM-001 §3) A PM entry's execution descriptor: the MCP descriptor Apps already uses (command, arguments, URL),
|
|
1252
|
+
* the secret reference's identity and where it is injected, the confirmed ranges and the PM system. A change turns
|
|
1253
|
+
* "query" off, as a source's descriptor change does. Never a secret value.
|
|
1254
|
+
*/
|
|
1255
|
+
export function pmDescriptorHash(c) {
|
|
1256
|
+
return sha256Hex(canonicalJson({ v: 1, kind: c.kind, command: c.command, args: c.args, url: c.url, auth: c.auth, address: c.address ?? null, pm: c.pm?.system ?? null }));
|
|
1257
|
+
}
|
|
1258
|
+
/** A network Postgres source, in either form (the one kind with row writes in v1). */
|
|
1259
|
+
export function isPostgresRecord(s) {
|
|
1260
|
+
if (s.kind === 'toolbox-source')
|
|
1261
|
+
return s.toolbox?.type === 'postgres';
|
|
1262
|
+
return s.kind === 'sql' && s.sql?.driver === 'postgres';
|
|
1263
|
+
}
|
|
1264
|
+
/** A record's id; one read through {@link normalizeRegistryFile} always has it. */
|
|
1265
|
+
export function entryId(s) {
|
|
1266
|
+
return s.id ?? legacyEntryId(s.name, s.registeredAt);
|
|
1267
|
+
}
|
|
1268
|
+
/** The stored database-source part of a `toolbox-source` record; `null` when it is incomplete (a hand edit). */
|
|
1269
|
+
function entryOf(s) {
|
|
1270
|
+
if (s.toolbox === undefined || (s.runtime !== 'native' && s.runtime !== 'toolbox') || s.tls === undefined)
|
|
1271
|
+
return null;
|
|
1272
|
+
return { toolbox: s.toolbox, runtime: s.runtime, tls: { mode: s.tls.mode, ca: s.tls.ca ?? null }, descriptorVersion: s.descriptorVersion === 2 ? 2 : 1, policyVersion: s.policyVersion ?? policyVersionOf(s.toolbox.type) };
|
|
1273
|
+
}
|
|
1274
|
+
/**
|
|
1275
|
+
* The registry as every reader sees it, normalized IN PLACE (and answered):
|
|
1276
|
+
*
|
|
1277
|
+
* - every record has an `id` (a record from before ids gets {@link legacyEntryId}, the same on every read);
|
|
1278
|
+
* - a K1 network Postgres `sql` record is mapped to the Toolbox form as descriptor version 1, ONLY when the
|
|
1279
|
+
* projection of the mapped record hashes exactly as the K1 record did (so every lock, grant, Allow writes switch
|
|
1280
|
+
* and stored description bound to it stays valid) and its document passes the deployment policy. Anything
|
|
1281
|
+
* else (a host the policy refuses, a field the projection would not give back) stays in K1's form.
|
|
1282
|
+
*
|
|
1283
|
+
* Pure and idempotent: the first write after an upgrade persists the mapped form.
|
|
1284
|
+
*/
|
|
1285
|
+
export function normalizeRegistryFile(file) {
|
|
1286
|
+
for (const [i, s] of file.servers.entries()) {
|
|
1287
|
+
if (s.id === undefined)
|
|
1288
|
+
s.id = legacyEntryId(s.name, s.registeredAt);
|
|
1289
|
+
if (s.kind !== 'sql' || s.sql?.driver !== 'postgres')
|
|
1290
|
+
continue;
|
|
1291
|
+
const legacy = configOf(s);
|
|
1292
|
+
let entry;
|
|
1293
|
+
try {
|
|
1294
|
+
entry = toolboxEntryFromSql(legacy, 1);
|
|
1295
|
+
}
|
|
1296
|
+
catch {
|
|
1297
|
+
continue; // the policy refuses the mapped document: the record stays as K1 saved it
|
|
1298
|
+
}
|
|
1299
|
+
if (entry === null)
|
|
1300
|
+
continue;
|
|
1301
|
+
const { sql: _sql, ...rest } = s;
|
|
1302
|
+
void _sql;
|
|
1303
|
+
const mapped = { ...rest, kind: 'toolbox-source', toolbox: entry.toolbox, runtime: 'native', tls: entry.tls, descriptorVersion: 1, policyVersion: entry.policyVersion };
|
|
1304
|
+
if (sourceDescriptorHash(configOf(mapped)) !== sourceDescriptorHash(legacy))
|
|
1305
|
+
continue;
|
|
1306
|
+
file.servers[i] = mapped;
|
|
1307
|
+
}
|
|
1308
|
+
return file;
|
|
1309
|
+
}
|
|
1310
|
+
/** A deployment-policy refusal as the routes answer it (400 with the policy's code). */
|
|
1311
|
+
function policyRefusal(err) {
|
|
1312
|
+
if (err instanceof DeploymentPolicyError)
|
|
1313
|
+
return new McpRegistryError(400, err.code, `the Toolbox source document is refused: ${err.message}`);
|
|
1314
|
+
return err;
|
|
1315
|
+
}
|
|
1316
|
+
/**
|
|
1317
|
+
* The disclosure class a save gives a tool (DES-KNOWLEDGE-DATA-001 §5.1): the operator's review when the body
|
|
1318
|
+
* gives one; else the class the tool kept while its schema is the one it was reviewed against; else crew's own
|
|
1319
|
+
* class for a tool of crew's Toolbox configuration; else none.
|
|
1320
|
+
*/
|
|
1321
|
+
export function disclosureOnSave(t, was, reviewed, kind, pm = null) {
|
|
1322
|
+
if (reviewed !== undefined)
|
|
1323
|
+
return { class: reviewed, schemaHash: t.schemaHash };
|
|
1324
|
+
const prior = was?.disclosure ?? null;
|
|
1325
|
+
if (prior !== null && prior.schemaHash === t.schemaHash)
|
|
1326
|
+
return prior;
|
|
1327
|
+
// (DES-PM-001 §3.1) A PM entry's bound read tools are `rows` (issue content); its other tools get no class.
|
|
1328
|
+
const bound = pm === null ? null : bindingFor(pm, t.name);
|
|
1329
|
+
const proposed = bound !== null ? bound.disclosure : proposedDisclosure(kind, t.name);
|
|
1330
|
+
return proposed === null ? null : { class: proposed, schemaHash: t.schemaHash };
|
|
1331
|
+
}
|
|
1332
|
+
/**
|
|
1333
|
+
* The agent-safe projection of a server (DES-KNOWLEDGE-DATA-001 §5.2, crew#1310): what an agent-kind bearer and
|
|
1334
|
+
* the relay may know. Built from the full view, field by field (an allowlist), so a field added to the full view
|
|
1335
|
+
* never reaches an agent by default.
|
|
1336
|
+
*/
|
|
1337
|
+
export function agentServerView(s) {
|
|
1338
|
+
return {
|
|
1339
|
+
id: s.id,
|
|
1340
|
+
name: s.name,
|
|
1341
|
+
kind: s.kind,
|
|
1342
|
+
enabled: s.enabled,
|
|
1343
|
+
health: { state: s.health.state },
|
|
1344
|
+
// (DES-PM-001 §3.1) A PM source's tools reach an agent only through the gate's scope-aware list: none here.
|
|
1345
|
+
tools: s.pm !== undefined ? [] : s.tools.filter((t) => t.status !== 'gone').map((t) => ({ name: t.name, subject: t.subject, class: t.class, disclosure: t.disclosure, enabled: t.enabled, status: t.status })),
|
|
1346
|
+
...(s.agents !== undefined ? { agents: { see: s.agents.see, query: s.agents.query } } : {}),
|
|
1347
|
+
...(s.pm !== undefined ? { pm: { system: s.pm.system } } : {}),
|
|
1348
|
+
};
|
|
1349
|
+
}
|
|
1350
|
+
const RECORD_KINDS = new Set(['mcp-stdio', 'mcp-http', 'rest', 'sql', 'graphql', 'toolbox-source']);
|
|
1351
|
+
/**
|
|
1352
|
+
* Why a stored record is not one crew could have written (`null`: it is): the fields every reader and a restore
|
|
1353
|
+
* use. A restore refuses a generation holding one (409) before anything changes (codex r2).
|
|
1354
|
+
*/
|
|
1355
|
+
export function recordShapeProblem(raw) {
|
|
1356
|
+
if (typeof raw !== 'object' || raw === null || Array.isArray(raw))
|
|
1357
|
+
return 'not an object';
|
|
1358
|
+
const s = raw;
|
|
1359
|
+
const str = (v) => typeof v === 'string';
|
|
1360
|
+
const strOrNull = (v) => v === null || typeof v === 'string';
|
|
1361
|
+
if (!str(s['name']) || !MCP_SERVER_NAME_RE.test(s['name']))
|
|
1362
|
+
return 'no valid name';
|
|
1363
|
+
if (!str(s['kind']) || !RECORD_KINDS.has(s['kind']))
|
|
1364
|
+
return 'an unknown kind';
|
|
1365
|
+
if (!strOrNull(s['command']) || !Array.isArray(s['args']) || !strOrNull(s['url']))
|
|
1366
|
+
return 'no command, args or url';
|
|
1367
|
+
const auth = s['auth'];
|
|
1368
|
+
if (auth !== null && (typeof auth !== 'object' || !str(auth['ref'])))
|
|
1369
|
+
return 'auth is neither null nor a reference';
|
|
1370
|
+
if (typeof s['enabled'] !== 'boolean' || typeof s['health'] !== 'object' || s['health'] === null)
|
|
1371
|
+
return 'no enabled switch or health';
|
|
1372
|
+
if (!str(s['registeredAt']) || !str(s['updatedAt']))
|
|
1373
|
+
return 'no registeredAt or updatedAt';
|
|
1374
|
+
if (s['id'] !== undefined && !str(s['id']))
|
|
1375
|
+
return 'an id that is not a string';
|
|
1376
|
+
if (!Array.isArray(s['tools']))
|
|
1377
|
+
return 'no tools';
|
|
1378
|
+
for (const t of s['tools']) {
|
|
1379
|
+
if (typeof t !== 'object' || t === null)
|
|
1380
|
+
return 'a tool that is not an object';
|
|
1381
|
+
const r = t;
|
|
1382
|
+
if (!str(r['name']) || !strOrNull(r['schemaHash']) || !str(r['observedSchemaHash']) || typeof r['present'] !== 'boolean' || typeof r['enabled'] !== 'boolean')
|
|
1383
|
+
return `tool ${String(r['name'])} is malformed`;
|
|
1384
|
+
}
|
|
1385
|
+
if (s['kind'] === 'toolbox-source') {
|
|
1386
|
+
const tls = s['tls'];
|
|
1387
|
+
if (typeof s['toolbox'] !== 'object' || s['toolbox'] === null || (s['runtime'] !== 'native' && s['runtime'] !== 'toolbox') || typeof tls !== 'object' || tls === null || (tls['mode'] !== 'verify-full' && tls['mode'] !== 'disable'))
|
|
1388
|
+
return 'a database source without its document, runtime or TLS choice';
|
|
1389
|
+
}
|
|
1390
|
+
if (s['agents'] !== undefined && (typeof s['agents'] !== 'object' || s['agents'] === null))
|
|
1391
|
+
return 'agents is not an object';
|
|
1392
|
+
if (s['pm'] !== undefined && (typeof s['pm'] !== 'object' || s['pm'] === null || (s['kind'] !== 'mcp-http' && s['kind'] !== 'mcp-stdio')))
|
|
1393
|
+
return 'a pm marker on a server that is not an MCP server';
|
|
1394
|
+
// A marker this release cannot read would leave the entry ungoverned: refused as a record crew could not have written.
|
|
1395
|
+
if (s['pm'] !== undefined && !['github', 'jira'].includes(String(s['pm']['system'])))
|
|
1396
|
+
return 'a pm marker naming a system this release does not govern';
|
|
1397
|
+
if (s['trackers'] !== undefined && !Array.isArray(s['trackers']))
|
|
1398
|
+
return 'trackers is not a list';
|
|
1399
|
+
return null;
|
|
1400
|
+
}
|
|
701
1401
|
//# sourceMappingURL=registry.js.map
|