wicked-crew 0.17.1 → 0.18.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 +49 -14
- package/adapters/web-source.lock +1314 -0
- package/dist/api/audit.d.ts +5 -0
- package/dist/api/audit.d.ts.map +1 -1
- package/dist/api/audit.js +20 -0
- package/dist/api/audit.js.map +1 -1
- package/dist/api/auth.d.ts.map +1 -1
- package/dist/api/auth.js +3 -0
- package/dist/api/auth.js.map +1 -1
- package/dist/api/chat-context.js +1 -1
- package/dist/api/chat-history.d.ts +3 -0
- package/dist/api/chat-history.d.ts.map +1 -1
- package/dist/api/chat-history.js +6 -1
- package/dist/api/chat-history.js.map +1 -1
- package/dist/api/chat-jobs.d.ts +30 -1
- package/dist/api/chat-jobs.d.ts.map +1 -1
- package/dist/api/chat-jobs.js +172 -10
- package/dist/api/chat-jobs.js.map +1 -1
- package/dist/api/chat-proposals.d.ts +178 -8
- package/dist/api/chat-proposals.d.ts.map +1 -1
- package/dist/api/chat-proposals.js +775 -54
- package/dist/api/chat-proposals.js.map +1 -1
- package/dist/api/chat-requirements.d.ts +54 -0
- package/dist/api/chat-requirements.d.ts.map +1 -0
- package/dist/api/chat-requirements.js +282 -0
- package/dist/api/chat-requirements.js.map +1 -0
- package/dist/api/chat-scope.d.ts +56 -0
- package/dist/api/chat-scope.d.ts.map +1 -1
- package/dist/api/chat-scope.js +175 -5
- package/dist/api/chat-scope.js.map +1 -1
- package/dist/api/chat-transcripts.d.ts +7 -0
- package/dist/api/chat-transcripts.d.ts.map +1 -1
- package/dist/api/chat-transcripts.js +17 -1
- package/dist/api/chat-transcripts.js.map +1 -1
- package/dist/api/delivery-index.d.ts +109 -5
- package/dist/api/delivery-index.d.ts.map +1 -1
- package/dist/api/delivery-index.js +199 -7
- package/dist/api/delivery-index.js.map +1 -1
- package/dist/api/mcp.d.ts +7 -2
- package/dist/api/mcp.d.ts.map +1 -1
- package/dist/api/mcp.js +1 -1
- package/dist/api/mcp.js.map +1 -1
- package/dist/api/needs.d.ts.map +1 -1
- package/dist/api/needs.js +19 -1
- package/dist/api/needs.js.map +1 -1
- package/dist/api/product.d.ts +9 -2
- package/dist/api/product.d.ts.map +1 -1
- package/dist/api/product.js +10 -2
- package/dist/api/product.js.map +1 -1
- package/dist/api/proposal-theme.d.ts +23 -0
- package/dist/api/proposal-theme.d.ts.map +1 -0
- package/dist/api/proposal-theme.js +30 -0
- package/dist/api/proposal-theme.js.map +1 -0
- package/dist/api/recording.d.ts +70 -10
- package/dist/api/recording.d.ts.map +1 -1
- package/dist/api/recording.js +278 -39
- package/dist/api/recording.js.map +1 -1
- package/dist/api/repo-input.d.ts +55 -0
- package/dist/api/repo-input.d.ts.map +1 -0
- package/dist/api/repo-input.js +113 -0
- package/dist/api/repo-input.js.map +1 -0
- package/dist/api/requirements.d.ts +75 -0
- package/dist/api/requirements.d.ts.map +1 -1
- package/dist/api/requirements.js +97 -9
- package/dist/api/requirements.js.map +1 -1
- package/dist/api/review-change.d.ts +64 -0
- package/dist/api/review-change.d.ts.map +1 -0
- package/dist/api/review-change.js +214 -0
- package/dist/api/review-change.js.map +1 -0
- package/dist/api/roster-standing.d.ts +4 -0
- package/dist/api/roster-standing.d.ts.map +1 -1
- package/dist/api/roster-standing.js +43 -10
- package/dist/api/roster-standing.js.map +1 -1
- package/dist/api/routes.d.ts +63 -6
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +818 -269
- package/dist/api/routes.js.map +1 -1
- package/dist/api/run-documents.d.ts +97 -0
- package/dist/api/run-documents.d.ts.map +1 -0
- package/dist/api/run-documents.js +458 -0
- package/dist/api/run-documents.js.map +1 -0
- package/dist/api/run-sources.d.ts +51 -0
- package/dist/api/run-sources.d.ts.map +1 -0
- package/dist/api/run-sources.js +133 -0
- package/dist/api/run-sources.js.map +1 -0
- package/dist/api/runtime-state.d.ts +41 -0
- package/dist/api/runtime-state.d.ts.map +1 -0
- package/dist/api/runtime-state.js +75 -0
- package/dist/api/runtime-state.js.map +1 -0
- package/dist/api/seat-container-login.d.ts +51 -0
- package/dist/api/seat-container-login.d.ts.map +1 -1
- package/dist/api/seat-container-login.js +317 -1
- package/dist/api/seat-container-login.js.map +1 -1
- package/dist/api/seat-images.d.ts.map +1 -1
- package/dist/api/seat-images.js +7 -0
- package/dist/api/seat-images.js.map +1 -1
- package/dist/api/server.d.ts +7 -0
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +206 -25
- package/dist/api/server.js.map +1 -1
- package/dist/api/skills.d.ts +8 -0
- package/dist/api/skills.d.ts.map +1 -1
- package/dist/api/skills.js +21 -0
- package/dist/api/skills.js.map +1 -1
- package/dist/api/system-snapshot.d.ts +7 -2
- package/dist/api/system-snapshot.d.ts.map +1 -1
- package/dist/api/system-snapshot.js +31 -7
- package/dist/api/system-snapshot.js.map +1 -1
- package/dist/api/testing.d.ts +3 -3
- package/dist/api/ui-text.d.ts +45 -0
- package/dist/api/ui-text.d.ts.map +1 -0
- package/dist/api/ui-text.js +188 -0
- package/dist/api/ui-text.js.map +1 -0
- package/dist/apps/actions/card.d.ts +62 -0
- package/dist/apps/actions/card.d.ts.map +1 -0
- package/dist/apps/actions/card.js +111 -0
- package/dist/apps/actions/card.js.map +1 -0
- package/dist/apps/actions/write-path.d.ts.map +1 -1
- package/dist/apps/actions/write-path.js +26 -77
- package/dist/apps/actions/write-path.js.map +1 -1
- package/dist/apps/exec/sources.d.ts.map +1 -1
- package/dist/apps/exec/sources.js +3 -0
- package/dist/apps/exec/sources.js.map +1 -1
- package/dist/apps/publish/artifacts.d.ts +18 -0
- package/dist/apps/publish/artifacts.d.ts.map +1 -0
- package/dist/apps/publish/artifacts.js +87 -0
- package/dist/apps/publish/artifacts.js.map +1 -0
- package/dist/apps/publish/check.d.ts +103 -0
- package/dist/apps/publish/check.d.ts.map +1 -0
- package/dist/apps/publish/check.js +235 -0
- package/dist/apps/publish/check.js.map +1 -0
- package/dist/apps/publish/image.d.ts +2 -0
- package/dist/apps/publish/image.d.ts.map +1 -1
- package/dist/apps/publish/image.js +2 -1
- package/dist/apps/publish/image.js.map +1 -1
- package/dist/apps/publish/render.d.ts +71 -0
- package/dist/apps/publish/render.d.ts.map +1 -0
- package/dist/apps/publish/render.js +122 -0
- package/dist/apps/publish/render.js.map +1 -0
- package/dist/apps/publish/run.d.ts +35 -0
- package/dist/apps/publish/run.d.ts.map +1 -0
- package/dist/apps/publish/run.js +127 -0
- package/dist/apps/publish/run.js.map +1 -0
- package/dist/apps/routes.d.ts +54 -2
- package/dist/apps/routes.d.ts.map +1 -1
- package/dist/apps/routes.js +124 -7
- package/dist/apps/routes.js.map +1 -1
- package/dist/apps/spec.d.ts +8 -8
- package/dist/apps/store.d.ts +84 -5
- package/dist/apps/store.d.ts.map +1 -1
- package/dist/apps/store.js +191 -4
- package/dist/apps/store.js.map +1 -1
- package/dist/apps/turns.d.ts +19 -1
- package/dist/apps/turns.d.ts.map +1 -1
- package/dist/apps/turns.js +60 -2
- package/dist/apps/turns.js.map +1 -1
- package/dist/apps/views.d.ts +5 -1
- package/dist/apps/views.d.ts.map +1 -1
- package/dist/apps/views.js +18 -7
- package/dist/apps/views.js.map +1 -1
- package/dist/apps-server/Dockerfile +25 -0
- package/dist/apps-server/runners/sqlite-runner.mjs +110 -0
- package/dist/apps-server/server/lib/bundle/server.mjs +92523 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/LICENSE +22 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/README.md +106 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/enums.d.ts +76 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/enums.js +2 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/esm/enums.js +1 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/esm/index.js +2 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/esm/types.js +1 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/index.d.ts +2 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/index.js +18 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/package.json +36 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/types.d.ts +2488 -0
- package/dist/apps-server/server/node_modules/@pgsql/types/types.js +2 -0
- package/dist/apps-server/server/node_modules/libpg-query/LICENSE +22 -0
- package/dist/apps-server/server/node_modules/libpg-query/README.md +275 -0
- package/dist/apps-server/server/node_modules/libpg-query/package.json +58 -0
- package/dist/apps-server/server/node_modules/libpg-query/wasm/index.cjs +369 -0
- package/dist/apps-server/server/node_modules/libpg-query/wasm/index.d.ts +48 -0
- package/dist/apps-server/server/node_modules/libpg-query/wasm/index.js +344 -0
- package/dist/apps-server/server/node_modules/libpg-query/wasm/libpg-query.js +2 -0
- package/dist/apps-server/server/node_modules/libpg-query/wasm/libpg-query.wasm +0 -0
- package/dist/apps-server/server/shim/host.css +22 -0
- package/dist/apps-server/server/shim/host.js +1 -0
- package/dist/cli/apps-check.d.ts +18 -0
- package/dist/cli/apps-check.d.ts.map +1 -1
- package/dist/cli/apps-check.js +179 -5
- package/dist/cli/apps-check.js.map +1 -1
- package/dist/cli/apps-produce.d.ts +9 -0
- package/dist/cli/apps-produce.d.ts.map +1 -0
- package/dist/cli/apps-produce.js +27 -0
- package/dist/cli/apps-produce.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +15 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/insights-facts.d.ts +17 -0
- package/dist/cli/insights-facts.d.ts.map +1 -0
- package/dist/cli/insights-facts.js +56 -0
- package/dist/cli/insights-facts.js.map +1 -0
- package/dist/core/adapter.d.ts +74 -15
- package/dist/core/adapter.d.ts.map +1 -1
- package/dist/core/adapter.js +245 -53
- package/dist/core/adapter.js.map +1 -1
- package/dist/core/engine-roster.d.ts.map +1 -1
- package/dist/core/engine-roster.js +1 -0
- package/dist/core/engine-roster.js.map +1 -1
- package/dist/core/estate-mcp-client.d.ts +3 -2
- package/dist/core/estate-mcp-client.d.ts.map +1 -1
- package/dist/core/estate-mcp-client.js +3 -2
- package/dist/core/estate-mcp-client.js.map +1 -1
- package/dist/core/run-identity.d.ts.map +1 -1
- package/dist/core/run-identity.js +3 -0
- package/dist/core/run-identity.js.map +1 -1
- package/dist/core/types.d.ts +5 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/editors/conformance-runtime.d.ts +107 -0
- package/dist/editors/conformance-runtime.d.ts.map +1 -1
- package/dist/editors/conformance-runtime.js +268 -13
- package/dist/editors/conformance-runtime.js.map +1 -1
- package/dist/editors/csp.d.ts +2 -2
- package/dist/editors/csp.d.ts.map +1 -1
- package/dist/editors/csp.js +4 -2
- package/dist/editors/csp.js.map +1 -1
- package/dist/editors/pack-install.d.ts +28 -13
- package/dist/editors/pack-install.d.ts.map +1 -1
- package/dist/editors/pack-install.js +96 -48
- package/dist/editors/pack-install.js.map +1 -1
- package/dist/editors/registry.d.ts +111 -8
- package/dist/editors/registry.d.ts.map +1 -1
- package/dist/editors/registry.js +183 -7
- package/dist/editors/registry.js.map +1 -1
- package/dist/editors/routes.d.ts +66 -13
- package/dist/editors/routes.d.ts.map +1 -1
- package/dist/editors/routes.js +277 -44
- package/dist/editors/routes.js.map +1 -1
- package/dist/evals/replay.d.ts +6 -0
- package/dist/evals/replay.d.ts.map +1 -1
- package/dist/evals/replay.js +24 -1
- package/dist/evals/replay.js.map +1 -1
- package/dist/evals/routes.d.ts.map +1 -1
- package/dist/evals/routes.js +17 -2
- package/dist/evals/routes.js.map +1 -1
- package/dist/evals/runner.d.ts.map +1 -1
- package/dist/evals/runner.js +5 -0
- package/dist/evals/runner.js.map +1 -1
- package/dist/evals/shape-corrections.d.ts +146 -0
- package/dist/evals/shape-corrections.d.ts.map +1 -0
- package/dist/evals/shape-corrections.js +394 -0
- package/dist/evals/shape-corrections.js.map +1 -0
- package/dist/evals/shape.d.ts +145 -0
- package/dist/evals/shape.d.ts.map +1 -0
- package/dist/evals/shape.js +376 -0
- package/dist/evals/shape.js.map +1 -0
- package/dist/evals/types.d.ts +2 -2
- package/dist/evals/types.d.ts.map +1 -1
- package/dist/evals/types.js +2 -1
- package/dist/evals/types.js.map +1 -1
- package/dist/insights/analyze.d.ts +14 -1
- package/dist/insights/analyze.d.ts.map +1 -1
- package/dist/insights/analyze.js +35 -8
- package/dist/insights/analyze.js.map +1 -1
- package/dist/insights/cost.d.ts +123 -0
- package/dist/insights/cost.d.ts.map +1 -0
- package/dist/insights/cost.js +221 -0
- package/dist/insights/cost.js.map +1 -0
- package/dist/insights/review-service.d.ts +20 -1
- package/dist/insights/review-service.d.ts.map +1 -1
- package/dist/insights/review-service.js +50 -25
- package/dist/insights/review-service.js.map +1 -1
- package/dist/insights/routes.d.ts +29 -0
- package/dist/insights/routes.d.ts.map +1 -1
- package/dist/insights/routes.js +62 -0
- package/dist/insights/routes.js.map +1 -1
- package/dist/insights/run-facts.d.ts +16 -0
- package/dist/insights/run-facts.d.ts.map +1 -1
- package/dist/insights/run-facts.js +26 -3
- package/dist/insights/run-facts.js.map +1 -1
- package/dist/interactive/bridge-pool.d.ts +11 -2
- package/dist/interactive/bridge-pool.d.ts.map +1 -1
- package/dist/interactive/bridge-pool.js +10 -1
- package/dist/interactive/bridge-pool.js.map +1 -1
- package/dist/interactive/chat-events.d.ts +74 -1
- package/dist/interactive/chat-events.d.ts.map +1 -1
- package/dist/interactive/chat-events.js +338 -6
- package/dist/interactive/chat-events.js.map +1 -1
- package/dist/interactive/doc-binding.d.ts +15 -0
- package/dist/interactive/doc-binding.d.ts.map +1 -1
- package/dist/interactive/doc-binding.js +4 -0
- package/dist/interactive/doc-binding.js.map +1 -1
- package/dist/interactive/doc-checks-routes.d.ts +34 -1
- package/dist/interactive/doc-checks-routes.d.ts.map +1 -1
- package/dist/interactive/doc-checks-routes.js +84 -0
- package/dist/interactive/doc-checks-routes.js.map +1 -1
- package/dist/interactive/draft-events.d.ts +7 -0
- package/dist/interactive/draft-events.d.ts.map +1 -1
- package/dist/interactive/draft-events.js +38 -6
- package/dist/interactive/draft-events.js.map +1 -1
- package/dist/interactive/draft-skill.d.ts +76 -6
- package/dist/interactive/draft-skill.d.ts.map +1 -1
- package/dist/interactive/draft-skill.js +219 -17
- package/dist/interactive/draft-skill.js.map +1 -1
- package/dist/interactive/edit-events.d.ts.map +1 -1
- package/dist/interactive/edit-events.js +4 -2
- package/dist/interactive/edit-events.js.map +1 -1
- package/dist/interactive/landing-guard.d.ts +47 -0
- package/dist/interactive/landing-guard.d.ts.map +1 -0
- package/dist/interactive/landing-guard.js +43 -0
- package/dist/interactive/landing-guard.js.map +1 -0
- package/dist/interactive/landing-record.d.ts +68 -0
- package/dist/interactive/landing-record.d.ts.map +1 -0
- package/dist/interactive/landing-record.js +154 -0
- package/dist/interactive/landing-record.js.map +1 -0
- package/dist/interactive/proposal-create.d.ts +3 -1
- package/dist/interactive/proposal-create.d.ts.map +1 -1
- package/dist/interactive/proposal-create.js +14 -2
- package/dist/interactive/proposal-create.js.map +1 -1
- package/dist/interactive/proposal-refine.d.ts +48 -0
- package/dist/interactive/proposal-refine.d.ts.map +1 -0
- package/dist/interactive/proposal-refine.js +99 -0
- package/dist/interactive/proposal-refine.js.map +1 -0
- package/dist/interactive/protected-edits.d.ts +67 -0
- package/dist/interactive/protected-edits.d.ts.map +1 -0
- package/dist/interactive/protected-edits.js +160 -0
- package/dist/interactive/protected-edits.js.map +1 -0
- package/dist/interactive/proxy-routes.js +2 -2
- package/dist/interactive/review-events.js +1 -1
- package/dist/interactive/run-units.d.ts +1 -1
- package/dist/interactive/run-units.d.ts.map +1 -1
- package/dist/interactive/run-units.js +8 -2
- package/dist/interactive/run-units.js.map +1 -1
- package/dist/interactive/source-packet.d.ts +66 -1
- package/dist/interactive/source-packet.d.ts.map +1 -1
- package/dist/interactive/source-packet.js +309 -60
- package/dist/interactive/source-packet.js.map +1 -1
- package/dist/interactive/theme-events.js +1 -1
- package/dist/knowledge/adapters/web/egress.d.ts +99 -0
- package/dist/knowledge/adapters/web/egress.d.ts.map +1 -0
- package/dist/knowledge/adapters/web/egress.js +330 -0
- package/dist/knowledge/adapters/web/egress.js.map +1 -0
- package/dist/knowledge/adapters/web/engine.d.ts +54 -0
- package/dist/knowledge/adapters/web/engine.d.ts.map +1 -0
- package/dist/knowledge/adapters/web/engine.js +101 -0
- package/dist/knowledge/adapters/web/engine.js.map +1 -0
- package/dist/knowledge/adapters/web/fetch.d.ts +131 -0
- package/dist/knowledge/adapters/web/fetch.d.ts.map +1 -0
- package/dist/knowledge/adapters/web/fetch.js +325 -0
- package/dist/knowledge/adapters/web/fetch.js.map +1 -0
- package/dist/knowledge/adapters/web/gate-web.d.ts +182 -0
- package/dist/knowledge/adapters/web/gate-web.d.ts.map +1 -0
- package/dist/knowledge/adapters/web/gate-web.js +496 -0
- package/dist/knowledge/adapters/web/gate-web.js.map +1 -0
- package/dist/knowledge/adapters/web/routes.d.ts +36 -0
- package/dist/knowledge/adapters/web/routes.d.ts.map +1 -0
- package/dist/knowledge/adapters/web/routes.js +99 -0
- package/dist/knowledge/adapters/web/routes.js.map +1 -0
- package/dist/knowledge/adapters/web/searxng.d.ts +89 -0
- package/dist/knowledge/adapters/web/searxng.d.ts.map +1 -0
- package/dist/knowledge/adapters/web/searxng.js +274 -0
- package/dist/knowledge/adapters/web/searxng.js.map +1 -0
- package/dist/knowledge/adapters/web/source.d.ts +65 -0
- package/dist/knowledge/adapters/web/source.d.ts.map +1 -0
- package/dist/knowledge/adapters/web/source.js +192 -0
- package/dist/knowledge/adapters/web/source.js.map +1 -0
- package/dist/knowledge/gate/gate.d.ts +22 -0
- package/dist/knowledge/gate/gate.d.ts.map +1 -1
- package/dist/knowledge/gate/gate.js +62 -1
- package/dist/knowledge/gate/gate.js.map +1 -1
- package/dist/knowledge/gate/sources.d.ts +2 -0
- package/dist/knowledge/gate/sources.d.ts.map +1 -1
- package/dist/knowledge/gate/sources.js +5 -2
- package/dist/knowledge/gate/sources.js.map +1 -1
- package/dist/knowledge/package.d.ts +7 -0
- package/dist/knowledge/package.d.ts.map +1 -1
- package/dist/knowledge/package.js +15 -1
- package/dist/knowledge/package.js.map +1 -1
- package/dist/knowledge/trackers/actions.js +1 -1
- package/dist/knowledge/trackers/actions.js.map +1 -1
- package/dist/knowledge/trackers/bindings.d.ts +3 -3
- package/dist/knowledge/trackers/bindings.d.ts.map +1 -1
- package/dist/knowledge/trackers/bindings.js +36 -23
- package/dist/knowledge/trackers/bindings.js.map +1 -1
- package/dist/knowledge/trackers/routes.js +1 -1
- package/dist/knowledge/trackers/routes.js.map +1 -1
- package/dist/learnings/service.d.ts.map +1 -1
- package/dist/learnings/service.js +2 -0
- package/dist/learnings/service.js.map +1 -1
- package/dist/mcp/broker.d.ts +8 -0
- package/dist/mcp/broker.d.ts.map +1 -1
- package/dist/mcp/broker.js +48 -3
- package/dist/mcp/broker.js.map +1 -1
- package/dist/mcp/estate-relay.d.ts +43 -1
- package/dist/mcp/estate-relay.d.ts.map +1 -1
- package/dist/mcp/estate-relay.js +38 -2
- package/dist/mcp/estate-relay.js.map +1 -1
- package/dist/mcp/registry.d.ts +6 -0
- package/dist/mcp/registry.d.ts.map +1 -1
- package/dist/mcp/registry.js +42 -3
- package/dist/mcp/registry.js.map +1 -1
- package/dist/mcp/run-fence.d.ts +57 -0
- package/dist/mcp/run-fence.d.ts.map +1 -0
- package/dist/mcp/run-fence.js +86 -0
- package/dist/mcp/run-fence.js.map +1 -0
- package/dist/mcp/tool-list.d.ts +5 -0
- package/dist/mcp/tool-list.d.ts.map +1 -1
- package/dist/mcp/tool-list.js +7 -3
- package/dist/mcp/tool-list.js.map +1 -1
- package/dist/presets/routes.d.ts.map +1 -1
- package/dist/presets/routes.js +6 -0
- package/dist/presets/routes.js.map +1 -1
- package/dist/projects/routes.d.ts +1 -1
- package/dist/projects/state-home-preflight.d.ts.map +1 -1
- package/dist/projects/state-home-preflight.js +2 -0
- package/dist/projects/state-home-preflight.js.map +1 -1
- package/dist/setup/tool-path.d.ts +16 -0
- package/dist/setup/tool-path.d.ts.map +1 -0
- package/dist/setup/tool-path.js +66 -0
- package/dist/setup/tool-path.js.map +1 -0
- package/dist/skills/plugin-source.d.ts +46 -88
- package/dist/skills/plugin-source.d.ts.map +1 -1
- package/dist/skills/plugin-source.js +144 -100
- package/dist/skills/plugin-source.js.map +1 -1
- package/dist/skills/runtime.d.ts +47 -0
- package/dist/skills/runtime.d.ts.map +1 -1
- package/dist/skills/runtime.js +110 -14
- package/dist/skills/runtime.js.map +1 -1
- package/dist/skills/store.d.ts +2 -0
- package/dist/skills/store.d.ts.map +1 -1
- package/dist/skills/store.js +29 -14
- package/dist/skills/store.js.map +1 -1
- package/dist/skills/usage.d.ts +238 -0
- package/dist/skills/usage.d.ts.map +1 -0
- package/dist/skills/usage.js +789 -0
- package/dist/skills/usage.js.map +1 -0
- package/dist/skills/venv.d.ts +18 -2
- package/dist/skills/venv.d.ts.map +1 -1
- package/dist/skills/venv.js +2 -2
- package/dist/skills/venv.js.map +1 -1
- package/dist/sources/routes.d.ts +3 -1
- package/dist/sources/routes.d.ts.map +1 -1
- package/dist/sources/routes.js +11 -0
- package/dist/sources/routes.js.map +1 -1
- package/dist/standing-orders/parse.d.ts +19 -0
- package/dist/standing-orders/parse.d.ts.map +1 -1
- package/dist/standing-orders/parse.js +61 -18
- package/dist/standing-orders/parse.js.map +1 -1
- package/dist/studio/apps-standalone/fixture.html +12 -0
- package/dist/studio/apps-standalone/fixture.js +10 -0
- package/dist/studio/apps-standalone/runtime.css +139 -0
- package/dist/studio/apps-standalone/runtime.js +1 -0
- package/dist/studio/assets/{KnowledgeGraph-Cpm46tEp.js → KnowledgeGraph-BT5Y-B8b.js} +1 -1
- package/dist/studio/assets/index-B_JwrHVF.css +32 -0
- package/dist/studio/assets/index-Bl9m8ldl.js +1104 -0
- package/dist/studio/editors/wicked-apps/editor.json +1 -1
- package/dist/studio/editors/wicked-apps/index.html +2 -2
- package/dist/studio/editors/wicked-deck/editor.json +1 -1
- package/dist/studio/editors/wicked-deck/index.html +14 -1
- package/dist/studio/editors/wicked-doc/editor.json +1 -1
- package/dist/studio/editors/wicked-doc/index.html +1 -1
- 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 +10 -1
- package/dist/studio/editors/wicked-page/index.html +2 -2
- package/dist/studio/editors/wicked-video/editor.json +7 -2
- package/dist/studio/editors/wicked-video/index.html +14 -11
- package/dist/studio/index.html +2 -2
- package/dist/studio/testid-inventory.json +2073 -240
- package/dist/team/routes.d.ts +1 -1
- package/dist/workflow-catalog/build-v2.d.ts +6 -2
- package/dist/workflow-catalog/build-v2.d.ts.map +1 -1
- package/dist/workflow-catalog/build-v2.js +37 -13
- package/dist/workflow-catalog/build-v2.js.map +1 -1
- package/dist/workflow-catalog/catalog-data-v2.d.ts.map +1 -1
- package/dist/workflow-catalog/catalog-data-v2.js +310 -105
- package/dist/workflow-catalog/catalog-data-v2.js.map +1 -1
- package/dist/workflow-catalog/catalog-data.d.ts.map +1 -1
- package/dist/workflow-catalog/catalog-data.js +2 -20
- package/dist/workflow-catalog/catalog-data.js.map +1 -1
- package/dist/workflow-catalog/detect-service.d.ts +95 -0
- package/dist/workflow-catalog/detect-service.d.ts.map +1 -0
- package/dist/workflow-catalog/detect-service.js +239 -0
- package/dist/workflow-catalog/detect-service.js.map +1 -0
- package/dist/workflow-catalog/detect.d.ts +213 -0
- package/dist/workflow-catalog/detect.d.ts.map +1 -0
- package/dist/workflow-catalog/detect.js +653 -0
- package/dist/workflow-catalog/detect.js.map +1 -0
- package/dist/workflow-catalog/shape.d.ts +3 -1
- package/dist/workflow-catalog/shape.d.ts.map +1 -1
- package/dist/workflow-catalog/shape.js +7 -1
- package/dist/workflow-catalog/shape.js.map +1 -1
- package/dist/working-doc/bridge-backend.js +2 -2
- package/dist/working-doc/event-lines.d.ts +67 -2
- package/dist/working-doc/event-lines.d.ts.map +1 -1
- package/dist/working-doc/event-lines.js +155 -8
- package/dist/working-doc/event-lines.js.map +1 -1
- package/dist/working-doc/notes-index.d.ts +35 -0
- package/dist/working-doc/notes-index.d.ts.map +1 -0
- package/dist/working-doc/notes-index.js +82 -0
- package/dist/working-doc/notes-index.js.map +1 -0
- package/dist/working-doc/routes.js +4 -4
- package/dist/working-doc/sections.js +2 -2
- package/dist/working-doc/service.d.ts +260 -21
- package/dist/working-doc/service.d.ts.map +1 -1
- package/dist/working-doc/service.js +791 -90
- package/dist/working-doc/service.js.map +1 -1
- package/dist/working-doc/store.d.ts +50 -1
- package/dist/working-doc/store.d.ts.map +1 -1
- package/dist/working-doc/store.js +4 -1
- package/dist/working-doc/store.js.map +1 -1
- package/endpoint-manifest.json +187 -3
- package/evals/corpora/shape-corrections-v1.json +594 -0
- package/evals/corpora/shape-corrections-v1.seat-fixture.json +186 -0
- package/evals/corpora/shape-v1.json +2113 -0
- package/evals/corpora/shape-v1.seat-fixture.json +1800 -0
- package/package.json +11 -7
- package/scripts/apps-render.py +226 -0
- package/workflows/detect-shape.json +29 -0
- package/dist/studio/assets/index-BRBwWQMH.css +0 -32
- package/dist/studio/assets/index-CVrWDGRP.js +0 -1097
package/dist/editors/routes.d.ts
CHANGED
|
@@ -1,18 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `/api/v1/editors` (DES-artifact-editor-plugins §6, §8.2, §9.1; EP-C1).
|
|
3
3
|
*
|
|
4
|
-
* - `GET /editors` (operator+): the registry, as Settings → Editors renders it.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* - `GET /editors` (operator+): the registry, as Settings → Editors renders it. A run plugin (CS7) lists as an
|
|
5
|
+
* `EditorView` row too, its `granted_topics` filled from the engine's observe decisions (`[]` when it cannot
|
|
6
|
+
* decide them: fail closed).
|
|
7
|
+
* - `POST /editors {packRoot, enabled?}` (HUMAN-only): install or update a pack's editors and/or run plugins —
|
|
8
|
+
* garden's fail-closed gate, then crew's own conformance run, then the registry (`pack-install.ts`). 200 with
|
|
7
9
|
* the installed editors; 422 with the verdict or the conformance report; 501 with the approval list
|
|
8
|
-
* for a pack that also ships skills or blocks; 409 for an id another pack or a first-party editor holds.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* for a pack that also ships skills or blocks; 409 for an id another pack or a first-party editor holds. The
|
|
11
|
+
* install consent writes each installed plugin's `observe:<topic>` tokens (CS7 C3), beside the editors'
|
|
12
|
+
* `mcp.session` tokens, in one ledger edit.
|
|
13
|
+
* - `DELETE /editors/:id` (HUMAN-only): an installed pack editor or run plugin is removed from the registry (the
|
|
14
|
+
* installer deletes its files); every `editor:<id>@` and `plugin:<id>@` grant of it is withdrawn. A first-party
|
|
15
|
+
* editor ships with studio and cannot be removed (409; disable it instead).
|
|
12
16
|
* - `POST /editors/:id/enabled {enabled}` (HUMAN-only): the operator's switch.
|
|
13
17
|
* - `GET /editors/:id/grants?project=` (operator+): the engine's decided set
|
|
14
18
|
* (`evaluate_editor_grants`: EDITOR-GRANTS ledger + EDITOR-BUILTIN posture, deny dominates), with
|
|
15
19
|
* the token an "allow" would add. The host fetches it before `host.hello` and enforces it.
|
|
20
|
+
* - `GET /editors/:id/grants` for a run plugin answers the engine's observe decisions (CS7 C3): one grant per
|
|
21
|
+
* declared topic, deny dominating.
|
|
22
|
+
* - `POST /editors/:id/grants` for a run plugin is 409 `install_only` (CS7 C3): its topics are granted by the
|
|
23
|
+
* install consent alone; Remove withdraws them.
|
|
24
|
+
* - `POST /editors/:id/grants {permission, allow, version, sha256, project?}` (HUMAN-only, §6.4; F37):
|
|
25
|
+
* the person's allow or revoke of one permission the editor declares, for the build they were shown
|
|
26
|
+
* (`version` + `sha256` must still be the installed build, else 409 `build_changed`). Allow writes
|
|
27
|
+
* that build's token (built from crew's own record) into the EDITOR-GRANTS ledger, for every project;
|
|
28
|
+
* revoke drops every token of that editor and permission. `mcp.session` is the install consent's
|
|
29
|
+
* alone (409 `install_only`). Under `auth=off` a request carrying a governed unit's token is refused
|
|
30
|
+
* (403 `seat_token`; 503 when the engine cannot tell; under `auth=required` such a token is no identity
|
|
31
|
+
* at all: 401). An install, update or removal drops every grant of the editor. `project` only
|
|
32
|
+
* scopes the answer: the decided set after the write, so a project deny that dominates shows as deny.
|
|
16
33
|
* - `GET /editors/:id/:version/entry`: the bundle, with exactly the §8.2 headers. The file path comes
|
|
17
34
|
* from the registry record — never from the URL — and the bytes are re-hashed on every serve: a
|
|
18
35
|
* changed file answers 409 `bundle_hash_mismatch`, never the changed bundle. The pinned bytes are
|
|
@@ -27,7 +44,7 @@
|
|
|
27
44
|
import type { FastifyInstance, FastifyReply } from 'fastify';
|
|
28
45
|
import type { ConformanceRule, EditorGrantsResponse } from '../core/types.js';
|
|
29
46
|
import { type ConformanceRunner, type PackCheckRunner } from './pack-install.js';
|
|
30
|
-
import { EditorRegistry, type
|
|
47
|
+
import { EditorRegistry, type RegisteredRecord } from './registry.js';
|
|
31
48
|
/** The slice of the adapter the grants route needs; every method optional so a stub never throws. */
|
|
32
49
|
export interface EditorGrantsAdapter {
|
|
33
50
|
editorGrantsSupported?(): boolean;
|
|
@@ -38,8 +55,13 @@ export interface EditorGrantsAdapter {
|
|
|
38
55
|
permissions: string[];
|
|
39
56
|
project?: string;
|
|
40
57
|
firstParty: boolean;
|
|
58
|
+
/** CS7: `plugin` evaluates a run plugin's observe topics (C3); absent / `editor` the artifact-editor permissions. */
|
|
59
|
+
subject?: 'editor' | 'plugin';
|
|
60
|
+
/** CS7: a run plugin's declared topic patterns, for `subject:'plugin'`. */
|
|
61
|
+
observe?: string[];
|
|
41
62
|
}): Promise<EditorGrantsResponse>;
|
|
42
|
-
/** The rule store, for the install consent's `mcp.session` grant (DES-MCP-INSPECTOR-001 §6)
|
|
63
|
+
/** The rule store, for the install consent's `mcp.session` grant (DES-MCP-INSPECTOR-001 §6) and the
|
|
64
|
+
* person's allow / revoke (`POST /editors/:id/grants`). */
|
|
43
65
|
listConformanceRules?(): Promise<ConformanceRule[]>;
|
|
44
66
|
upsertConformanceRule?(rule: ConformanceRule): Promise<void>;
|
|
45
67
|
}
|
|
@@ -48,25 +70,56 @@ export declare const EDITOR_GRANTS_LEDGER = "EDITOR-GRANTS";
|
|
|
48
70
|
/** The permission only an install consent grants: no posture or allow rule can (core LEDGER_ONLY_PERMISSIONS). */
|
|
49
71
|
export declare const INSTALL_GRANTED = "mcp.session";
|
|
50
72
|
export declare function grantToken(id: string, version: string, sha256: string, permission: string): string;
|
|
73
|
+
/** A run plugin's observe-topic grant token (CS7 C3): `plugin:<id>@<version>#<sha256>/observe:<topic>`. */
|
|
74
|
+
export declare function pluginToken(id: string, version: string, sha256: string, topic: string): string;
|
|
51
75
|
/**
|
|
52
|
-
* Rewrite the ledger's
|
|
53
|
-
*
|
|
76
|
+
* Rewrite the ledger's tokens for the editors `builds` just installed: EVERY token of those editors is
|
|
77
|
+
* dropped (F37: an install or update asks again for what the person allowed, the same build included,
|
|
78
|
+
* and nothing piles up), and `add` (this install's `mcp.session` consent tokens, for the builds that
|
|
79
|
+
* declare it) is written. One read-modify-write;
|
|
54
80
|
* nothing is written when the list is unchanged. With nothing to add, an engine with no ledger has
|
|
55
81
|
* no grant to withdraw, so that is no change; with something to add it is an error (it would ask).
|
|
56
82
|
*
|
|
57
83
|
* The edit is serialized against the other editor routes only. A governance write landing between
|
|
58
84
|
* the read and the upsert is not covered, the same limit as the MCP approvals ledger (`mcp/policies.ts`).
|
|
59
85
|
*/
|
|
60
|
-
export declare function editInstallGrants(adapter: EditorGrantsAdapter,
|
|
86
|
+
export declare function editInstallGrants(adapter: EditorGrantsAdapter, builds: ReadonlyArray<{
|
|
87
|
+
id: string;
|
|
88
|
+
version: string;
|
|
89
|
+
sha256: string;
|
|
90
|
+
}>, add: readonly string[]): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* The person's allow or revoke of one permission (F37). One read-modify-write of the ledger: `add` (the
|
|
93
|
+
* build's token, or null to revoke) replaces every token of `id` + `permission`; or, with `permission`
|
|
94
|
+
* undefined and `add` null, every token of `id` goes (a removal). Throws when the ledger cannot be
|
|
95
|
+
* written for an allow; nothing is written when the list is unchanged. Serialized against the other
|
|
96
|
+
* editor routes only: a governance rule write landing between the read and the upsert is not covered,
|
|
97
|
+
* the same stated limit as {@link editInstallGrants} and the MCP approvals ledger.
|
|
98
|
+
*/
|
|
99
|
+
export declare function editGrant(adapter: EditorGrantsAdapter, id: string, permission: string | undefined, add: string | null): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* A governed unit's token → true (the engine's `resolveEstateScope` names its unit), anything else → false.
|
|
102
|
+
* The §6.4 tripwire for the grant write: under `auth=off` every caller is the local human, so a worker
|
|
103
|
+
* that SENDS its token is caught here; one that omits it is the stated honest limit.
|
|
104
|
+
*/
|
|
105
|
+
export type UnitTokenVerdict = 'unit' | 'not_unit' | 'unknown';
|
|
106
|
+
/**
|
|
107
|
+
* The engine's word on a bearer: `unit` (it names the unit), `not_unit` (it refused the token as
|
|
108
|
+
* `invalid_token:`), or `unknown` (any other failure, or an answer without a unit): the tripwire then
|
|
109
|
+
* fails CLOSED, so a resolver fault never waves a worker's token through (codex r1).
|
|
110
|
+
*/
|
|
111
|
+
export declare function unitTokenProbe(resolve: ((requestJson: string) => Promise<string>) | null): ((token: string) => Promise<UnitTokenVerdict>) | undefined;
|
|
61
112
|
export interface EditorRoutesDeps {
|
|
62
113
|
registry: EditorRegistry;
|
|
63
114
|
adapter: EditorGrantsAdapter;
|
|
64
115
|
packCheck: PackCheckRunner;
|
|
65
116
|
/** The install-time conformance run (garden's runner against this daemon's conformance host page). */
|
|
66
117
|
conformance: ConformanceRunner;
|
|
118
|
+
/** The §6.4 tripwire: is this bearer a governed unit's token? Absent = no engine to ask (nothing refused on it). */
|
|
119
|
+
isUnitToken?: (token: string) => Promise<UnitTokenVerdict>;
|
|
67
120
|
log?: (msg: string) => void;
|
|
68
121
|
}
|
|
69
122
|
export declare function registerEditorRoutes(app: FastifyInstance, deps: EditorRoutesDeps): void;
|
|
70
123
|
/** Re-hash on every serve: a bundle that changed on disk is refused, never served. */
|
|
71
|
-
export declare function serveBundle(record:
|
|
124
|
+
export declare function serveBundle(record: RegisteredRecord, reply: FastifyReply, log?: (msg: string) => void): FastifyReply;
|
|
72
125
|
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/editors/routes.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/editors/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAkB,MAAM,SAAS,CAAC;AAI7E,OAAO,KAAK,EAAS,eAAe,EAAE,oBAAoB,EAAmC,MAAM,kBAAkB,CAAC;AAEtH,OAAO,EAAiC,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAChH,OAAO,EAA6B,cAAc,EAAyF,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAKxL,qGAAqG;AACrG,MAAM,WAAW,mBAAmB;IAClC,qBAAqB,CAAC,IAAI,OAAO,CAAC;IAClC,oBAAoB,CAAC,CAAC,OAAO,EAAE;QAC7B,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,OAAO,CAAC;QACpB,qHAAqH;QACrH,OAAO,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;QAC9B,2EAA2E;QAC3E,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;KACpB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAClC;gEAC4D;IAC5D,oBAAoB,CAAC,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IACpD,qBAAqB,CAAC,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9D;AAED,mFAAmF;AACnF,eAAO,MAAM,oBAAoB,kBAAkB,CAAC;AACpD,kHAAkH;AAClH,eAAO,MAAM,eAAe,gBAAgB,CAAC;AAE7C,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAElG;AAED,2GAA2G;AAC3G,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE9F;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,mBAAmB,EAC5B,MAAM,EAAE,aAAa,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,EACtE,GAAG,EAAE,SAAS,MAAM,EAAE,GACrB,OAAO,CAAC,IAAI,CAAC,CAkBf;AAYD;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,mBAAmB,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB3I;AAUD;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC,GAAG,SAAS,CAgBrJ;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,SAAS,EAAE,eAAe,CAAC;IAC3B,sGAAsG;IACtG,WAAW,EAAE,iBAAiB,CAAC;IAC/B,oHAAoH;IACpH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC3D,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAwSvF;AAeD,sFAAsF;AACtF,wBAAgB,WAAW,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,YAAY,CAmCpH"}
|
package/dist/editors/routes.js
CHANGED
|
@@ -1,18 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `/api/v1/editors` (DES-artifact-editor-plugins §6, §8.2, §9.1; EP-C1).
|
|
3
3
|
*
|
|
4
|
-
* - `GET /editors` (operator+): the registry, as Settings → Editors renders it.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* - `GET /editors` (operator+): the registry, as Settings → Editors renders it. A run plugin (CS7) lists as an
|
|
5
|
+
* `EditorView` row too, its `granted_topics` filled from the engine's observe decisions (`[]` when it cannot
|
|
6
|
+
* decide them: fail closed).
|
|
7
|
+
* - `POST /editors {packRoot, enabled?}` (HUMAN-only): install or update a pack's editors and/or run plugins —
|
|
8
|
+
* garden's fail-closed gate, then crew's own conformance run, then the registry (`pack-install.ts`). 200 with
|
|
7
9
|
* the installed editors; 422 with the verdict or the conformance report; 501 with the approval list
|
|
8
|
-
* for a pack that also ships skills or blocks; 409 for an id another pack or a first-party editor holds.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* for a pack that also ships skills or blocks; 409 for an id another pack or a first-party editor holds. The
|
|
11
|
+
* install consent writes each installed plugin's `observe:<topic>` tokens (CS7 C3), beside the editors'
|
|
12
|
+
* `mcp.session` tokens, in one ledger edit.
|
|
13
|
+
* - `DELETE /editors/:id` (HUMAN-only): an installed pack editor or run plugin is removed from the registry (the
|
|
14
|
+
* installer deletes its files); every `editor:<id>@` and `plugin:<id>@` grant of it is withdrawn. A first-party
|
|
15
|
+
* editor ships with studio and cannot be removed (409; disable it instead).
|
|
12
16
|
* - `POST /editors/:id/enabled {enabled}` (HUMAN-only): the operator's switch.
|
|
13
17
|
* - `GET /editors/:id/grants?project=` (operator+): the engine's decided set
|
|
14
18
|
* (`evaluate_editor_grants`: EDITOR-GRANTS ledger + EDITOR-BUILTIN posture, deny dominates), with
|
|
15
19
|
* the token an "allow" would add. The host fetches it before `host.hello` and enforces it.
|
|
20
|
+
* - `GET /editors/:id/grants` for a run plugin answers the engine's observe decisions (CS7 C3): one grant per
|
|
21
|
+
* declared topic, deny dominating.
|
|
22
|
+
* - `POST /editors/:id/grants` for a run plugin is 409 `install_only` (CS7 C3): its topics are granted by the
|
|
23
|
+
* install consent alone; Remove withdraws them.
|
|
24
|
+
* - `POST /editors/:id/grants {permission, allow, version, sha256, project?}` (HUMAN-only, §6.4; F37):
|
|
25
|
+
* the person's allow or revoke of one permission the editor declares, for the build they were shown
|
|
26
|
+
* (`version` + `sha256` must still be the installed build, else 409 `build_changed`). Allow writes
|
|
27
|
+
* that build's token (built from crew's own record) into the EDITOR-GRANTS ledger, for every project;
|
|
28
|
+
* revoke drops every token of that editor and permission. `mcp.session` is the install consent's
|
|
29
|
+
* alone (409 `install_only`). Under `auth=off` a request carrying a governed unit's token is refused
|
|
30
|
+
* (403 `seat_token`; 503 when the engine cannot tell; under `auth=required` such a token is no identity
|
|
31
|
+
* at all: 401). An install, update or removal drops every grant of the editor. `project` only
|
|
32
|
+
* scopes the answer: the decided set after the write, so a project deny that dominates shows as deny.
|
|
16
33
|
* - `GET /editors/:id/:version/entry`: the bundle, with exactly the §8.2 headers. The file path comes
|
|
17
34
|
* from the registry record — never from the URL — and the bytes are re-hashed on every serve: a
|
|
18
35
|
* changed file answers 409 `bundle_hash_mismatch`, never the changed bundle. The pinned bytes are
|
|
@@ -39,16 +56,22 @@ export const INSTALL_GRANTED = 'mcp.session';
|
|
|
39
56
|
export function grantToken(id, version, sha256, permission) {
|
|
40
57
|
return `editor:${id}@${version}#${sha256}/${permission}`;
|
|
41
58
|
}
|
|
59
|
+
/** A run plugin's observe-topic grant token (CS7 C3): `plugin:<id>@<version>#<sha256>/observe:<topic>`. */
|
|
60
|
+
export function pluginToken(id, version, sha256, topic) {
|
|
61
|
+
return `plugin:${id}@${version}#${sha256}/observe:${topic}`;
|
|
62
|
+
}
|
|
42
63
|
/**
|
|
43
|
-
* Rewrite the ledger's
|
|
44
|
-
*
|
|
64
|
+
* Rewrite the ledger's tokens for the editors `builds` just installed: EVERY token of those editors is
|
|
65
|
+
* dropped (F37: an install or update asks again for what the person allowed, the same build included,
|
|
66
|
+
* and nothing piles up), and `add` (this install's `mcp.session` consent tokens, for the builds that
|
|
67
|
+
* declare it) is written. One read-modify-write;
|
|
45
68
|
* nothing is written when the list is unchanged. With nothing to add, an engine with no ledger has
|
|
46
69
|
* no grant to withdraw, so that is no change; with something to add it is an error (it would ask).
|
|
47
70
|
*
|
|
48
71
|
* The edit is serialized against the other editor routes only. A governance write landing between
|
|
49
72
|
* the read and the upsert is not covered, the same limit as the MCP approvals ledger (`mcp/policies.ts`).
|
|
50
73
|
*/
|
|
51
|
-
export async function editInstallGrants(adapter,
|
|
74
|
+
export async function editInstallGrants(adapter, builds, add) {
|
|
52
75
|
const unavailable = (why) => {
|
|
53
76
|
if (add.length > 0)
|
|
54
77
|
throw new Error(why);
|
|
@@ -60,13 +83,87 @@ export async function editInstallGrants(adapter, ids, add) {
|
|
|
60
83
|
const ledger = rules.find((r) => r.id === EDITOR_GRANTS_LEDGER);
|
|
61
84
|
if (ledger === undefined)
|
|
62
85
|
return unavailable(`the ${EDITOR_GRANTS_LEDGER} ledger is not in the policy store; restart the daemon to seed it`);
|
|
63
|
-
|
|
86
|
+
// Every earlier grant of an installed editor OR run plugin goes (codex r2: a same-build "keep" let a failed
|
|
87
|
+
// cleanup resurrect an old build's allow on its reinstall); only this install's consent tokens (the editors'
|
|
88
|
+
// mcp.session and the plugins' observe topics, CS7 C3) are written back.
|
|
89
|
+
const owned = (t) => builds.some((b) => t.startsWith(`editor:${b.id}@`) || t.startsWith(`plugin:${b.id}@`));
|
|
64
90
|
const before = ledger.excludes ?? [];
|
|
65
91
|
const dedup = [...new Set([...before.filter((t) => !owned(t)), ...add])];
|
|
66
92
|
if (dedup.length === before.length && dedup.every((t, i) => t === before[i]))
|
|
67
93
|
return;
|
|
68
94
|
await adapter.upsertConformanceRule({ ...ledger, excludes: dedup });
|
|
69
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Every ledger token of `id` (any build). With a `permission`, only that editor permission's tokens. Without one
|
|
98
|
+
* (a removal), both the editor family AND the run-plugin family `plugin:<id>@` (CS7 C3: `DELETE` withdraws a
|
|
99
|
+
* plugin's topic grants too).
|
|
100
|
+
*/
|
|
101
|
+
function tokenOf(id, permission) {
|
|
102
|
+
if (permission === undefined)
|
|
103
|
+
return (t) => t.startsWith(`editor:${id}@`) || t.startsWith(`plugin:${id}@`);
|
|
104
|
+
return (t) => t.startsWith(`editor:${id}@`) && t.endsWith(`/${permission}`);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The person's allow or revoke of one permission (F37). One read-modify-write of the ledger: `add` (the
|
|
108
|
+
* build's token, or null to revoke) replaces every token of `id` + `permission`; or, with `permission`
|
|
109
|
+
* undefined and `add` null, every token of `id` goes (a removal). Throws when the ledger cannot be
|
|
110
|
+
* written for an allow; nothing is written when the list is unchanged. Serialized against the other
|
|
111
|
+
* editor routes only: a governance rule write landing between the read and the upsert is not covered,
|
|
112
|
+
* the same stated limit as {@link editInstallGrants} and the MCP approvals ledger.
|
|
113
|
+
*/
|
|
114
|
+
export async function editGrant(adapter, id, permission, add) {
|
|
115
|
+
// With nothing to add, an engine with no ledger has no grant to withdraw: that is no change.
|
|
116
|
+
const unavailable = (why) => {
|
|
117
|
+
if (add !== null)
|
|
118
|
+
throw new Error(why);
|
|
119
|
+
};
|
|
120
|
+
if (typeof adapter.listConformanceRules !== 'function' || typeof adapter.upsertConformanceRule !== 'function') {
|
|
121
|
+
return unavailable('this engine cannot write editor grants');
|
|
122
|
+
}
|
|
123
|
+
const rules = await adapter.listConformanceRules();
|
|
124
|
+
const ledger = rules.find((r) => r.id === EDITOR_GRANTS_LEDGER);
|
|
125
|
+
if (ledger === undefined)
|
|
126
|
+
return unavailable(`the ${EDITOR_GRANTS_LEDGER} ledger is not in the policy store; restart the daemon to seed it`);
|
|
127
|
+
const before = ledger.excludes ?? [];
|
|
128
|
+
const owned = tokenOf(id, permission);
|
|
129
|
+
const next = [...new Set([...before.filter((t) => !owned(t)), ...(add !== null ? [add] : [])])];
|
|
130
|
+
if (next.length === before.length && next.every((t, i) => t === before[i]))
|
|
131
|
+
return;
|
|
132
|
+
await adapter.upsertConformanceRule({ ...ledger, excludes: next });
|
|
133
|
+
}
|
|
134
|
+
/** The bearer a request carries, if any (`Authorization: Bearer <token>`). */
|
|
135
|
+
function bearerOf(req) {
|
|
136
|
+
const h = req.headers.authorization;
|
|
137
|
+
if (typeof h !== 'string')
|
|
138
|
+
return null;
|
|
139
|
+
const m = /^Bearer\s+(\S+)\s*$/iu.exec(h);
|
|
140
|
+
return m === null ? null : m[1];
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The engine's word on a bearer: `unit` (it names the unit), `not_unit` (it refused the token as
|
|
144
|
+
* `invalid_token:`), or `unknown` (any other failure, or an answer without a unit): the tripwire then
|
|
145
|
+
* fails CLOSED, so a resolver fault never waves a worker's token through (codex r1).
|
|
146
|
+
*/
|
|
147
|
+
export function unitTokenProbe(resolve) {
|
|
148
|
+
if (resolve === null)
|
|
149
|
+
return undefined;
|
|
150
|
+
return async (token) => {
|
|
151
|
+
let raw;
|
|
152
|
+
try {
|
|
153
|
+
raw = await resolve(JSON.stringify({ token }));
|
|
154
|
+
}
|
|
155
|
+
catch (err) {
|
|
156
|
+
return /^invalid_token\b/u.test(err instanceof Error ? err.message : String(err)) ? 'not_unit' : 'unknown';
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
const unit = JSON.parse(raw).unit;
|
|
160
|
+
return typeof unit?.runId === 'string' ? 'unit' : 'unknown';
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return 'unknown';
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
}
|
|
70
167
|
export function registerEditorRoutes(app, deps) {
|
|
71
168
|
const { registry } = deps;
|
|
72
169
|
// An install or a removal is ONE serialized step with its ledger edit (codex r2): the ledger edit is
|
|
@@ -92,14 +189,46 @@ export function registerEditorRoutes(app, deps) {
|
|
|
92
189
|
return true;
|
|
93
190
|
void reply
|
|
94
191
|
.code(403)
|
|
95
|
-
.send({ error: `only a human operator can install, remove, enable or disable an editor (you are ${actor.kind}/${actor.trust})` });
|
|
192
|
+
.send({ error: `only a human operator can install, remove, enable or disable an editor, or allow what it asks for (you are ${actor.kind}/${actor.trust})` });
|
|
96
193
|
return false;
|
|
97
194
|
};
|
|
98
195
|
const idOf = (req) => req.params.id;
|
|
196
|
+
// CS7 C3/C4: a run plugin's granted topics are the ones the engine decides `allow` (deny dominates). The
|
|
197
|
+
// registry does not know them — the route asks the engine with `subject:'plugin'` and the plugin's declared
|
|
198
|
+
// topics. Any failure, or an engine with no plugin-grants support, means it hears nothing: `[]`, with a log line.
|
|
199
|
+
const grantedTopicsFor = async (view) => {
|
|
200
|
+
const { adapter } = deps;
|
|
201
|
+
if (typeof adapter.editorGrantsSupported !== 'function' || !adapter.editorGrantsSupported() || typeof adapter.evaluateEditorGrants !== 'function') {
|
|
202
|
+
deps.log?.(`[editors] ${view.id}: this engine cannot decide a run plugin's topics; it hears nothing`);
|
|
203
|
+
return [];
|
|
204
|
+
}
|
|
205
|
+
try {
|
|
206
|
+
const res = await adapter.evaluateEditorGrants({
|
|
207
|
+
subject: 'plugin',
|
|
208
|
+
editorId: view.id,
|
|
209
|
+
version: view.version,
|
|
210
|
+
sha256: view.sha256,
|
|
211
|
+
permissions: [],
|
|
212
|
+
observe: (view.observe ?? []).map((o) => o.topic),
|
|
213
|
+
firstParty: false,
|
|
214
|
+
});
|
|
215
|
+
return res.grants.filter((g) => g.decision === 'allow' && g.permission.startsWith('observe:')).map((g) => g.permission.slice('observe:'.length));
|
|
216
|
+
}
|
|
217
|
+
catch (err) {
|
|
218
|
+
deps.log?.(`[editors] ${view.id}: a run plugin's topics could not be decided (${err instanceof Error ? err.message : String(err)}); it hears nothing`);
|
|
219
|
+
return [];
|
|
220
|
+
}
|
|
221
|
+
};
|
|
99
222
|
app.get(`${V}/editors`, { config: { manifest: { responseType: 'ListEditorsResponse', statusCodes: [200, 403] } } }, async (req, reply) => {
|
|
100
223
|
if (!operatorOnly(req, reply))
|
|
101
224
|
return reply;
|
|
102
|
-
const
|
|
225
|
+
const editors = registry.list().map((r) => EditorRegistry.view(r));
|
|
226
|
+
// Only run plugins carry `granted_topics`; editor rows are left unchanged (CS7 C4).
|
|
227
|
+
for (const view of editors) {
|
|
228
|
+
if (view.inline === 'run-thread')
|
|
229
|
+
view.granted_topics = await grantedTopicsFor(view);
|
|
230
|
+
}
|
|
231
|
+
const body = { editors, installs: 'conformance_required' };
|
|
103
232
|
return body;
|
|
104
233
|
});
|
|
105
234
|
const InstallSchema = z.strictObject({ packRoot: z.string().min(1), enabled: z.boolean().optional() });
|
|
@@ -113,24 +242,33 @@ export function registerEditorRoutes(app, deps) {
|
|
|
113
242
|
return await serial(async () => {
|
|
114
243
|
const installed = await installPack(parsed.data.packRoot, parsed.data.enabled, { check: deps.packCheck, conformance: deps.conformance, registry });
|
|
115
244
|
deps.log?.(`[editors] installed ${installed.editors.map((e) => `${e.id}@${e.version}`).join(', ')}${installed.updated ? ' (update)' : ''}`);
|
|
116
|
-
// The install consent IS the
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
|
|
121
|
-
const
|
|
245
|
+
// The install consent IS the grant (DES-MCP-INSPECTOR-001 §6; CS7 C3): this human-only call, after
|
|
246
|
+
// the operator approved the install, writes each declaring editor's per-build `mcp.session` token AND
|
|
247
|
+
// one `observe:<topic>` token per declared topic of each installed run plugin. Every installed
|
|
248
|
+
// editor's / plugin's earlier tokens are dropped first (codex r1: an update that no longer declares it
|
|
249
|
+
// keeps none), in the same read-modify-write as today's mcp.session edit.
|
|
250
|
+
const declaring = installed.editors.filter((e) => e.inline !== 'run-thread' && e.permissions.some((p) => p.id === INSTALL_GRANTED));
|
|
251
|
+
const editorTokens = declaring.map((e) => grantToken(e.id, e.version, e.sha256, INSTALL_GRANTED));
|
|
252
|
+
const plugins = installed.editors.filter((e) => e.inline === 'run-thread');
|
|
253
|
+
const pluginTokens = plugins.flatMap((p) => (p.observe ?? []).map((o) => pluginToken(p.id, p.version, p.sha256, o.topic)));
|
|
254
|
+
const tokens = [...editorTokens, ...pluginTokens];
|
|
122
255
|
try {
|
|
123
|
-
await editInstallGrants(deps.adapter, installed.editors
|
|
124
|
-
if (
|
|
256
|
+
await editInstallGrants(deps.adapter, installed.editors, tokens);
|
|
257
|
+
if (tokens.length === 0)
|
|
125
258
|
return installed;
|
|
126
|
-
|
|
259
|
+
if (declaring.length > 0)
|
|
260
|
+
deps.log?.(`[editors] install consent granted ${INSTALL_GRANTED} to ${declaring.map((e) => `${e.id}@${e.version}`).join(', ')}`);
|
|
261
|
+
if (plugins.length > 0)
|
|
262
|
+
deps.log?.(`[editors] install consent granted ${pluginTokens.length} observe topic(s) to ${plugins.map((e) => `${e.id}@${e.version}`).join(', ')}`);
|
|
127
263
|
return { ...installed, granted: tokens };
|
|
128
264
|
}
|
|
129
265
|
catch (err) {
|
|
130
266
|
const msg = err instanceof Error ? err.message : String(err);
|
|
131
|
-
deps.log?.(`[editors] installed, but the
|
|
267
|
+
deps.log?.(`[editors] installed, but the grants were not written: ${msg}`);
|
|
132
268
|
// Said either way (codex r2): with nothing to grant, an earlier build's token was not withdrawn.
|
|
133
|
-
const what =
|
|
269
|
+
const what = tokens.length > 0
|
|
270
|
+
? `the install consent's grants were not written (it asks), and its earlier grants were not withdrawn`
|
|
271
|
+
: `its earlier grants (any permission you allowed) were not withdrawn`;
|
|
134
272
|
return { ...installed, grantError: `installed, but ${what}: ${msg}` };
|
|
135
273
|
}
|
|
136
274
|
});
|
|
@@ -155,13 +293,14 @@ export function registerEditorRoutes(app, deps) {
|
|
|
155
293
|
// Installed = served or skipped at boot (codex r2: a skipped one has no live record but is removable).
|
|
156
294
|
if (!registry.isInstalled(id))
|
|
157
295
|
return reply.code(404).send({ error: `no editor '${id}' is installed` });
|
|
158
|
-
// Its
|
|
159
|
-
//
|
|
296
|
+
// Its grants go first (codex r1): a failed withdrawal keeps the editor installed, so a retry of
|
|
297
|
+
// this DELETE can still reach it, and never leaves a grant behind a removed editor. Every grant,
|
|
298
|
+
// not only the install's (F37): a reinstall of the same build asks again for what the person allowed.
|
|
160
299
|
try {
|
|
161
|
-
await
|
|
300
|
+
await editGrant(deps.adapter, id, undefined, null);
|
|
162
301
|
}
|
|
163
302
|
catch (err) {
|
|
164
|
-
return reply.code(503).send({ error: `${id} was not removed: its
|
|
303
|
+
return reply.code(503).send({ error: `${id} was not removed: its grants could not be withdrawn (${err instanceof Error ? err.message : String(err)}); try again` });
|
|
165
304
|
}
|
|
166
305
|
if (!registry.removeInstalled(id))
|
|
167
306
|
return reply.code(404).send({ error: `no editor '${id}' is installed` });
|
|
@@ -181,24 +320,15 @@ export function registerEditorRoutes(app, deps) {
|
|
|
181
320
|
return reply.code(404).send({ error: `no editor '${id}' is installed` });
|
|
182
321
|
return EditorRegistry.view(next);
|
|
183
322
|
});
|
|
184
|
-
|
|
185
|
-
if (!operatorOnly(req, reply))
|
|
186
|
-
return reply;
|
|
187
|
-
const id = idOf(req);
|
|
188
|
-
const record = EDITOR_ID.test(id) ? registry.get(id) : null;
|
|
189
|
-
if (record === null)
|
|
190
|
-
return reply.code(404).send({ error: `no editor '${id}' is installed` });
|
|
191
|
-
const q = req.query;
|
|
192
|
-
const projectRaw = Array.isArray(q.project) ? q.project[0] : q.project;
|
|
193
|
-
const project = typeof projectRaw === 'string' && projectRaw.trim() !== '' ? projectRaw.trim() : undefined;
|
|
323
|
+
const grantsSupported = () => {
|
|
194
324
|
const { adapter } = deps;
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
325
|
+
return typeof adapter.editorGrantsSupported === 'function' && adapter.editorGrantsSupported() && typeof adapter.evaluateEditorGrants === 'function';
|
|
326
|
+
};
|
|
327
|
+
const NO_GRANTS = 'the installed wicked-core-ts has no editor grants (needs wicked-core-ts >= 0.7.35 with the editor-defaults pack)';
|
|
328
|
+
/** The engine's decided set for this record (its pinned version + hash), or the reply that says why not. */
|
|
329
|
+
const decide = async (record, project, reply) => {
|
|
200
330
|
try {
|
|
201
|
-
return await adapter.evaluateEditorGrants({
|
|
331
|
+
return await deps.adapter.evaluateEditorGrants({
|
|
202
332
|
editorId: record.manifest.id,
|
|
203
333
|
version: record.manifest.version,
|
|
204
334
|
sha256: record.sha256,
|
|
@@ -211,6 +341,109 @@ export function registerEditorRoutes(app, deps) {
|
|
|
211
341
|
const msg = err instanceof Error ? err.message : String(err);
|
|
212
342
|
return reply.code(/bad_request/u.test(msg) ? 400 : 502).send({ error: msg });
|
|
213
343
|
}
|
|
344
|
+
};
|
|
345
|
+
/** A run plugin's decided observe set (CS7 C3): one grant per declared topic, deny dominating. */
|
|
346
|
+
const decidePlugin = async (record, project, reply) => {
|
|
347
|
+
try {
|
|
348
|
+
return await deps.adapter.evaluateEditorGrants({
|
|
349
|
+
subject: 'plugin',
|
|
350
|
+
editorId: record.manifest.id,
|
|
351
|
+
version: record.manifest.version,
|
|
352
|
+
sha256: record.sha256,
|
|
353
|
+
permissions: [],
|
|
354
|
+
observe: record.manifest.observe.map((o) => o.topic),
|
|
355
|
+
...(project !== undefined ? { project } : {}),
|
|
356
|
+
firstParty: false,
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
catch (err) {
|
|
360
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
361
|
+
return reply.code(/bad_request/u.test(msg) ? 400 : 502).send({ error: msg });
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
const projectOf = (raw) => {
|
|
365
|
+
const v = Array.isArray(raw) ? raw[0] : raw;
|
|
366
|
+
return typeof v === 'string' && v.trim() !== '' ? v.trim() : undefined;
|
|
367
|
+
};
|
|
368
|
+
app.get(`${V}/editors/:id/grants`, { config: { manifest: { responseType: 'EditorGrantsResponse', statusCodes: [200, 400, 403, 404, 501, 502] } } }, async (req, reply) => {
|
|
369
|
+
if (!operatorOnly(req, reply))
|
|
370
|
+
return reply;
|
|
371
|
+
const id = idOf(req);
|
|
372
|
+
const record = EDITOR_ID.test(id) ? registry.get(id) : null;
|
|
373
|
+
if (record === null)
|
|
374
|
+
return reply.code(404).send({ error: `no editor '${id}' is installed` });
|
|
375
|
+
if (!grantsSupported())
|
|
376
|
+
return reply.code(501).send({ error: NO_GRANTS });
|
|
377
|
+
const project = projectOf(req.query.project);
|
|
378
|
+
// CS7 C3/C4: a run plugin answers its observe decisions; an editor its permission decisions.
|
|
379
|
+
return record.kind === 'plugin' ? decidePlugin(record, project, reply) : decide(record, project, reply);
|
|
380
|
+
});
|
|
381
|
+
// F37: the person's allow / revoke of one permission (§6.2 ledger, §6.4 human-only).
|
|
382
|
+
const GrantSchema = z.strictObject({
|
|
383
|
+
permission: z.string().min(1),
|
|
384
|
+
allow: z.boolean(),
|
|
385
|
+
version: z.string().min(1),
|
|
386
|
+
sha256: z.string().regex(/^[0-9a-f]{64}$/u),
|
|
387
|
+
project: z.string().optional(),
|
|
388
|
+
});
|
|
389
|
+
app.post(`${V}/editors/:id/grants`, { config: { manifest: { requestType: 'SetEditorGrantBody', responseType: 'EditorGrantsResponse', statusCodes: [200, 400, 403, 404, 409, 501, 502, 503] } } }, async (req, reply) => {
|
|
390
|
+
if (!humanOnly(req, reply))
|
|
391
|
+
return reply;
|
|
392
|
+
// The tripwire (§6.4): a request that carries a governed unit's token is a worker's, whatever the auth mode says.
|
|
393
|
+
// Under auth=required the bearer already proved a human operator (a unit token is no identity there: 401), so
|
|
394
|
+
// only the local actor of auth=off is checked; with no engine to ask, a bearer cannot be cleared (codex r2).
|
|
395
|
+
const bearer = actorOf(req) === LOCAL_ACTOR ? bearerOf(req) : null;
|
|
396
|
+
const verdict = bearer === null ? 'not_unit' : deps.isUnitToken !== undefined ? await deps.isUnitToken(bearer) : 'unknown';
|
|
397
|
+
if (verdict === 'unit') {
|
|
398
|
+
deps.log?.(`[editors] refused a grant write carrying a governed unit's token (${idOf(req)})`);
|
|
399
|
+
return reply.code(403).send({ code: 'seat_token', error: 'a governed worker cannot allow or revoke an editor permission; only the person can, in studio' });
|
|
400
|
+
}
|
|
401
|
+
if (verdict === 'unknown') {
|
|
402
|
+
return reply.code(503).send({ error: 'could not tell whether this request carries a governed worker\'s token, so nothing was changed; try again' });
|
|
403
|
+
}
|
|
404
|
+
const parsed = GrantSchema.safeParse(req.body);
|
|
405
|
+
if (!parsed.success)
|
|
406
|
+
return reply.code(400).send({ error: 'body must be { permission: <permission id>, allow: boolean, version: <the version shown>, sha256: <the hash shown>, project?: <project id> }' });
|
|
407
|
+
const { permission, allow } = parsed.data;
|
|
408
|
+
const id = idOf(req);
|
|
409
|
+
if (!EDITOR_ID.test(id) || registry.get(id) === null)
|
|
410
|
+
return reply.code(404).send({ error: `no editor '${id}' is installed` });
|
|
411
|
+
// CS7 C3: a run plugin's topics are the install consent's alone, whatever the engine supports (codex r1).
|
|
412
|
+
if (registry.get(id)?.kind === 'plugin') {
|
|
413
|
+
return reply.code(409).send({ code: 'install_only', error: `${id} is a run plugin; its topics are granted by its install consent, not here — reinstall it to grant them, remove it to withdraw them` });
|
|
414
|
+
}
|
|
415
|
+
if (!grantsSupported())
|
|
416
|
+
return reply.code(501).send({ error: NO_GRANTS });
|
|
417
|
+
return serial(async () => {
|
|
418
|
+
// Read the record INSIDE the chain: a removal or an update queued before this press has landed.
|
|
419
|
+
const record = registry.get(id);
|
|
420
|
+
if (record === null)
|
|
421
|
+
return reply.code(404).send({ error: `no editor '${id}' is installed` });
|
|
422
|
+
// The press is for the build the person was shown (codex r1): an update in between asks again.
|
|
423
|
+
if (record.manifest.version !== parsed.data.version || record.sha256 !== parsed.data.sha256) {
|
|
424
|
+
return reply.code(409).send({ code: 'build_changed', error: `${id} changed to version ${record.manifest.version} since this was shown; nothing was changed: look again and decide for the new version` });
|
|
425
|
+
}
|
|
426
|
+
// CS7 C3: a run plugin's topics are granted by the install consent only; Remove withdraws them.
|
|
427
|
+
if (record.kind === 'plugin') {
|
|
428
|
+
return reply.code(409).send({ code: 'install_only', error: `${id} is a run plugin; its topics are granted by its install consent, not here — reinstall it to grant them, remove it to withdraw them` });
|
|
429
|
+
}
|
|
430
|
+
if (!record.manifest.permissions.some((p) => p.id === permission)) {
|
|
431
|
+
return reply.code(400).send({ error: `${id} does not ask for '${permission}'` });
|
|
432
|
+
}
|
|
433
|
+
if (permission === INSTALL_GRANTED) {
|
|
434
|
+
return reply.code(409).send({ code: 'install_only', error: `${INSTALL_GRANTED} is granted only by the editor's install consent; reinstall it to grant it, remove it to withdraw it` });
|
|
435
|
+
}
|
|
436
|
+
// The token is crew's own measurement of this build, never the caller's.
|
|
437
|
+
const token = grantToken(record.manifest.id, record.manifest.version, record.sha256, permission);
|
|
438
|
+
try {
|
|
439
|
+
await editGrant(deps.adapter, id, permission, allow ? token : null);
|
|
440
|
+
}
|
|
441
|
+
catch (err) {
|
|
442
|
+
return reply.code(503).send({ error: `not ${allow ? 'allowed' : 'revoked'}: ${err instanceof Error ? err.message : String(err)}` });
|
|
443
|
+
}
|
|
444
|
+
deps.log?.(`[editors] ${allow ? 'allowed' : 'revoked'} ${permission} for ${id}@${record.manifest.version}`);
|
|
445
|
+
return decide(record, projectOf(parsed.data.project), reply);
|
|
446
|
+
});
|
|
214
447
|
});
|
|
215
448
|
app.get(`${V}/editors/:id/:version/entry`, { config: { manifest: { statusCodes: [200, 404, 409] } } }, async (req, reply) => {
|
|
216
449
|
const { id, version } = req.params;
|