wicked-crew 0.18.19 → 0.18.20
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 +9 -6
- package/dist/api/ask-paths.d.ts +2 -0
- package/dist/api/ask-paths.d.ts.map +1 -1
- package/dist/api/ask-paths.js +6 -0
- package/dist/api/ask-paths.js.map +1 -1
- package/dist/api/auth.d.ts +7 -5
- package/dist/api/auth.d.ts.map +1 -1
- package/dist/api/auth.js +23 -9
- package/dist/api/auth.js.map +1 -1
- package/dist/api/chat-attachments.d.ts.map +1 -1
- package/dist/api/chat-attachments.js +69 -19
- package/dist/api/chat-attachments.js.map +1 -1
- package/dist/api/chat-citations.d.ts.map +1 -1
- package/dist/api/chat-citations.js +22 -0
- package/dist/api/chat-citations.js.map +1 -1
- package/dist/api/chat-context.d.ts +4 -1
- package/dist/api/chat-context.d.ts.map +1 -1
- package/dist/api/chat-context.js +15 -9
- package/dist/api/chat-context.js.map +1 -1
- package/dist/api/chat-history.d.ts +13 -0
- package/dist/api/chat-history.d.ts.map +1 -1
- package/dist/api/chat-history.js +25 -0
- package/dist/api/chat-history.js.map +1 -1
- package/dist/api/chat-jobs.d.ts +13 -6
- package/dist/api/chat-jobs.d.ts.map +1 -1
- package/dist/api/chat-jobs.js +48 -19
- package/dist/api/chat-jobs.js.map +1 -1
- package/dist/api/chat-proposals.d.ts +30 -0
- package/dist/api/chat-proposals.d.ts.map +1 -1
- package/dist/api/chat-proposals.js +157 -21
- package/dist/api/chat-proposals.js.map +1 -1
- package/dist/api/chat-scope.d.ts +9 -9
- package/dist/api/chat-scope.d.ts.map +1 -1
- package/dist/api/chat-scope.js +29 -19
- package/dist/api/chat-scope.js.map +1 -1
- package/dist/api/cluster-status.js +1 -1
- package/dist/api/cluster-status.js.map +1 -1
- package/dist/api/codebase-archive.d.ts +4 -3
- package/dist/api/codebase-archive.d.ts.map +1 -1
- package/dist/api/codebase-archive.js +4 -3
- package/dist/api/codebase-archive.js.map +1 -1
- package/dist/api/gate-cache.d.ts +1 -0
- package/dist/api/gate-cache.d.ts.map +1 -1
- package/dist/api/gate-cache.js +19 -6
- package/dist/api/gate-cache.js.map +1 -1
- package/dist/api/governance-steering.d.ts +4 -4
- package/dist/api/mcp.d.ts +10 -2
- package/dist/api/mcp.d.ts.map +1 -1
- package/dist/api/mcp.js +53 -12
- package/dist/api/mcp.js.map +1 -1
- package/dist/api/product.d.ts +1 -1
- package/dist/api/proposal-onboard.d.ts +9 -1
- package/dist/api/proposal-onboard.d.ts.map +1 -1
- package/dist/api/proposal-onboard.js +41 -3
- package/dist/api/proposal-onboard.js.map +1 -1
- package/dist/api/recording.d.ts +1 -1
- package/dist/api/requirements.d.ts +2 -16
- package/dist/api/requirements.d.ts.map +1 -1
- package/dist/api/requirements.js.map +1 -1
- package/dist/api/retry-index.d.ts +2 -0
- package/dist/api/retry-index.d.ts.map +1 -1
- package/dist/api/retry-index.js +16 -8
- package/dist/api/retry-index.js.map +1 -1
- package/dist/api/roster-standing.d.ts +2 -0
- package/dist/api/roster-standing.d.ts.map +1 -1
- package/dist/api/roster-standing.js +8 -1
- package/dist/api/roster-standing.js.map +1 -1
- package/dist/api/routes.d.ts +23 -9
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +501 -153
- package/dist/api/routes.js.map +1 -1
- package/dist/api/run-documents.d.ts +9 -1
- package/dist/api/run-documents.d.ts.map +1 -1
- package/dist/api/run-documents.js +63 -5
- package/dist/api/run-documents.js.map +1 -1
- package/dist/api/run-timing-index.d.ts +2 -0
- package/dist/api/run-timing-index.d.ts.map +1 -1
- package/dist/api/run-timing-index.js +62 -86
- package/dist/api/run-timing-index.js.map +1 -1
- package/dist/api/seat-container-login.js +2 -2
- package/dist/api/seat-container-login.js.map +1 -1
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +79 -20
- package/dist/api/server.js.map +1 -1
- package/dist/api/stall-watchdog.d.ts +6 -0
- package/dist/api/stall-watchdog.d.ts.map +1 -1
- package/dist/api/stall-watchdog.js +28 -0
- package/dist/api/stall-watchdog.js.map +1 -1
- package/dist/api/system-snapshot.d.ts +5 -0
- package/dist/api/system-snapshot.d.ts.map +1 -1
- package/dist/api/system-snapshot.js +17 -7
- package/dist/api/system-snapshot.js.map +1 -1
- package/dist/api/testing.d.ts +2 -2
- package/dist/api/ui-text.js +2 -2
- package/dist/api/ui-text.js.map +1 -1
- package/dist/apps/actions/api-action.js +5 -2
- package/dist/apps/actions/api-action.js.map +1 -1
- package/dist/apps/actions/write-path.d.ts +9 -0
- package/dist/apps/actions/write-path.d.ts.map +1 -1
- package/dist/apps/actions/write-path.js +17 -9
- package/dist/apps/actions/write-path.js.map +1 -1
- package/dist/apps/exec/executor.d.ts +8 -15
- package/dist/apps/exec/executor.d.ts.map +1 -1
- package/dist/apps/exec/executor.js +10 -3
- package/dist/apps/exec/executor.js.map +1 -1
- package/dist/apps/exec/redescribe.d.ts +37 -0
- package/dist/apps/exec/redescribe.d.ts.map +1 -0
- package/dist/apps/exec/redescribe.js +86 -0
- package/dist/apps/exec/redescribe.js.map +1 -0
- package/dist/apps/exec/source-stage.d.ts +3 -1
- package/dist/apps/exec/source-stage.d.ts.map +1 -1
- package/dist/apps/exec/source-stage.js +13 -3
- package/dist/apps/exec/source-stage.js.map +1 -1
- package/dist/apps/exec/sources.d.ts +6 -0
- package/dist/apps/exec/sources.d.ts.map +1 -1
- package/dist/apps/exec/sources.js +8 -0
- package/dist/apps/exec/sources.js.map +1 -1
- package/dist/apps/publish/manifest.d.ts +6 -1
- package/dist/apps/publish/manifest.d.ts.map +1 -1
- package/dist/apps/publish/manifest.js +6 -0
- package/dist/apps/publish/manifest.js.map +1 -1
- package/dist/apps/publish/run.d.ts +4 -1
- package/dist/apps/publish/run.d.ts.map +1 -1
- package/dist/apps/publish/run.js +4 -1
- package/dist/apps/publish/run.js.map +1 -1
- package/dist/apps/routes.d.ts +1 -0
- package/dist/apps/routes.d.ts.map +1 -1
- package/dist/apps/routes.js +13 -0
- package/dist/apps/routes.js.map +1 -1
- package/dist/apps-server/Dockerfile +2 -2
- package/dist/apps-server/runners/sqlite-runner.mjs +28 -11
- package/dist/apps-server/server/lib/bundle/server.mjs +243 -149
- package/dist/cli/governance.d.ts +5 -2
- package/dist/cli/governance.d.ts.map +1 -1
- package/dist/cli/governance.js +8 -5
- package/dist/cli/governance.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +6 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/service.d.ts +10 -6
- package/dist/cli/service.d.ts.map +1 -1
- package/dist/cli/service.js +39 -23
- package/dist/cli/service.js.map +1 -1
- package/dist/core/adapter.d.ts +38 -21
- package/dist/core/adapter.d.ts.map +1 -1
- package/dist/core/adapter.js +155 -57
- package/dist/core/adapter.js.map +1 -1
- package/dist/core/assurance.d.ts +37 -44
- package/dist/core/assurance.d.ts.map +1 -1
- package/dist/core/assurance.js +53 -69
- package/dist/core/assurance.js.map +1 -1
- package/dist/core/deliver-text.d.ts +12 -0
- package/dist/core/deliver-text.d.ts.map +1 -1
- package/dist/core/deliver-text.js +40 -2
- package/dist/core/deliver-text.js.map +1 -1
- package/dist/core/deliver.d.ts +23 -0
- package/dist/core/deliver.d.ts.map +1 -1
- package/dist/core/deliver.js +52 -7
- package/dist/core/deliver.js.map +1 -1
- package/dist/core/engine-roster.d.ts +2 -0
- package/dist/core/engine-roster.d.ts.map +1 -1
- package/dist/core/engine-roster.js +13 -0
- package/dist/core/engine-roster.js.map +1 -1
- package/dist/core/estate-mcp-client.d.ts +13 -14
- package/dist/core/estate-mcp-client.d.ts.map +1 -1
- package/dist/core/estate-mcp-client.js +47 -62
- package/dist/core/estate-mcp-client.js.map +1 -1
- package/dist/core/pr-checks-helper.d.ts +8 -4
- package/dist/core/pr-checks-helper.d.ts.map +1 -1
- package/dist/core/pr-checks-helper.js +39 -17
- package/dist/core/pr-checks-helper.js.map +1 -1
- package/dist/core/repoPaths.d.ts +2 -4
- package/dist/core/repoPaths.d.ts.map +1 -1
- package/dist/core/repoPaths.js +4 -6
- package/dist/core/repoPaths.js.map +1 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -1
- package/dist/decisions/rules-brief.d.ts +2 -0
- package/dist/decisions/rules-brief.d.ts.map +1 -1
- package/dist/decisions/rules-brief.js.map +1 -1
- package/dist/editors/csp.d.ts +6 -0
- package/dist/editors/csp.d.ts.map +1 -1
- package/dist/editors/csp.js +10 -0
- package/dist/editors/csp.js.map +1 -1
- package/dist/editors/pack-install.d.ts.map +1 -1
- package/dist/editors/pack-install.js +1 -0
- package/dist/editors/pack-install.js.map +1 -1
- package/dist/editors/registry.d.ts +5 -1
- package/dist/editors/registry.d.ts.map +1 -1
- package/dist/editors/registry.js +16 -3
- package/dist/editors/registry.js.map +1 -1
- package/dist/editors/routes.d.ts +4 -2
- package/dist/editors/routes.d.ts.map +1 -1
- package/dist/editors/routes.js +23 -6
- package/dist/editors/routes.js.map +1 -1
- package/dist/evals/shape-corrections.js +1 -1
- package/dist/evals/shape-corrections.js.map +1 -1
- package/dist/evals/workflow.d.ts.map +1 -1
- package/dist/evals/workflow.js +1 -0
- package/dist/evals/workflow.js.map +1 -1
- package/dist/governance/rule-revision.d.ts +7 -0
- package/dist/governance/rule-revision.d.ts.map +1 -0
- package/dist/governance/rule-revision.js +23 -0
- package/dist/governance/rule-revision.js.map +1 -0
- package/dist/insights/review-service.d.ts +2 -0
- package/dist/insights/review-service.d.ts.map +1 -1
- package/dist/insights/review-service.js +27 -0
- package/dist/insights/review-service.js.map +1 -1
- package/dist/interactive/bridge-pool.d.ts +2 -0
- package/dist/interactive/bridge-pool.d.ts.map +1 -1
- package/dist/interactive/bridge-pool.js +12 -4
- package/dist/interactive/bridge-pool.js.map +1 -1
- package/dist/interactive/chat-events.d.ts +3 -0
- package/dist/interactive/chat-events.d.ts.map +1 -1
- package/dist/interactive/chat-events.js +13 -4
- package/dist/interactive/chat-events.js.map +1 -1
- package/dist/interactive/doc-delete-routes.d.ts +1 -0
- package/dist/interactive/doc-delete-routes.d.ts.map +1 -1
- package/dist/interactive/doc-delete-routes.js +126 -123
- package/dist/interactive/doc-delete-routes.js.map +1 -1
- package/dist/interactive/draft-events.d.ts +8 -7
- package/dist/interactive/draft-events.d.ts.map +1 -1
- package/dist/interactive/draft-events.js +24 -14
- package/dist/interactive/draft-events.js.map +1 -1
- package/dist/interactive/proposal-create.d.ts +9 -11
- package/dist/interactive/proposal-create.d.ts.map +1 -1
- package/dist/interactive/proposal-create.js +27 -21
- package/dist/interactive/proposal-create.js.map +1 -1
- package/dist/interactive/proposal-refine.d.ts +4 -4
- package/dist/interactive/proposal-refine.d.ts.map +1 -1
- package/dist/interactive/proposal-refine.js +25 -7
- package/dist/interactive/proposal-refine.js.map +1 -1
- package/dist/interactive/proxy-routes.d.ts +10 -5
- package/dist/interactive/proxy-routes.d.ts.map +1 -1
- package/dist/interactive/proxy-routes.js +108 -11
- package/dist/interactive/proxy-routes.js.map +1 -1
- package/dist/interactive/source-packet.d.ts +5 -1
- package/dist/interactive/source-packet.d.ts.map +1 -1
- package/dist/interactive/source-packet.js +62 -29
- package/dist/interactive/source-packet.js.map +1 -1
- package/dist/knowledge/adapters/toolbox/memory.d.ts +2 -0
- package/dist/knowledge/adapters/toolbox/memory.d.ts.map +1 -0
- package/dist/knowledge/adapters/toolbox/memory.js +43 -0
- package/dist/knowledge/adapters/toolbox/memory.js.map +1 -0
- package/dist/knowledge/adapters/toolbox/supervisor.d.ts +9 -3
- package/dist/knowledge/adapters/toolbox/supervisor.d.ts.map +1 -1
- package/dist/knowledge/adapters/toolbox/supervisor.js +40 -6
- package/dist/knowledge/adapters/toolbox/supervisor.js.map +1 -1
- package/dist/knowledge/gate/gate.d.ts.map +1 -1
- package/dist/knowledge/gate/gate.js +4 -1
- package/dist/knowledge/gate/gate.js.map +1 -1
- package/dist/knowledge/gate/record.d.ts +15 -2
- package/dist/knowledge/gate/record.d.ts.map +1 -1
- package/dist/knowledge/gate/record.js +108 -29
- package/dist/knowledge/gate/record.js.map +1 -1
- package/dist/knowledge/registry/entry.d.ts +7 -0
- package/dist/knowledge/registry/entry.d.ts.map +1 -1
- package/dist/knowledge/registry/entry.js +4 -0
- package/dist/knowledge/registry/entry.js.map +1 -1
- package/dist/learn/scheduler.d.ts.map +1 -1
- package/dist/learn/scheduler.js +2 -1
- package/dist/learn/scheduler.js.map +1 -1
- package/dist/learnings/estate.d.ts.map +1 -1
- package/dist/learnings/estate.js +3 -14
- package/dist/learnings/estate.js.map +1 -1
- package/dist/mcp/broker.js +1 -1
- package/dist/mcp/broker.js.map +1 -1
- package/dist/mcp/env.d.ts +12 -4
- package/dist/mcp/env.d.ts.map +1 -1
- package/dist/mcp/env.js +24 -4
- package/dist/mcp/env.js.map +1 -1
- package/dist/mcp/estate-relay.d.ts.map +1 -1
- package/dist/mcp/estate-relay.js +2 -4
- package/dist/mcp/estate-relay.js.map +1 -1
- package/dist/mcp/invoke.d.ts.map +1 -1
- package/dist/mcp/invoke.js +4 -3
- package/dist/mcp/invoke.js.map +1 -1
- package/dist/mcp/probe.d.ts +14 -1
- package/dist/mcp/probe.d.ts.map +1 -1
- package/dist/mcp/probe.js +55 -10
- package/dist/mcp/probe.js.map +1 -1
- package/dist/mcp/registry-store.d.ts +12 -0
- package/dist/mcp/registry-store.d.ts.map +1 -1
- package/dist/mcp/registry-store.js +10 -0
- package/dist/mcp/registry-store.js.map +1 -1
- package/dist/mcp/registry.d.ts +13 -5
- package/dist/mcp/registry.d.ts.map +1 -1
- package/dist/mcp/registry.js +61 -9
- package/dist/mcp/registry.js.map +1 -1
- package/dist/mcp/rest.js +1 -1
- package/dist/mcp/rest.js.map +1 -1
- package/dist/mcp/secrets.d.ts +1 -1
- package/dist/mcp/secrets.d.ts.map +1 -1
- package/dist/mcp/secrets.js +10 -11
- package/dist/mcp/secrets.js.map +1 -1
- package/dist/mcp/upstream-error.d.ts +1 -1
- package/dist/mcp/upstream-error.d.ts.map +1 -1
- package/dist/projects/graph.d.ts +10 -2
- package/dist/projects/graph.d.ts.map +1 -1
- package/dist/projects/graph.js +190 -10
- package/dist/projects/graph.js.map +1 -1
- package/dist/projects/repo-watch.d.ts +2 -2
- package/dist/projects/repo-watch.d.ts.map +1 -1
- package/dist/projects/repo-watch.js +26 -9
- package/dist/projects/repo-watch.js.map +1 -1
- package/dist/projects/routes.d.ts +2 -0
- package/dist/projects/routes.d.ts.map +1 -1
- package/dist/projects/routes.js +50 -1
- package/dist/projects/routes.js.map +1 -1
- package/dist/projects/state-home-registry.d.ts.map +1 -1
- package/dist/projects/state-home-registry.js +3 -0
- package/dist/projects/state-home-registry.js.map +1 -1
- package/dist/projects/state-home.d.ts +7 -0
- package/dist/projects/state-home.d.ts.map +1 -1
- package/dist/projects/state-home.js +11 -0
- package/dist/projects/state-home.js.map +1 -1
- package/dist/qe/author-workflow.d.ts +4 -0
- package/dist/qe/author-workflow.d.ts.map +1 -1
- package/dist/qe/author-workflow.js +4 -0
- package/dist/qe/author-workflow.js.map +1 -1
- package/dist/qe/test-sets.d.ts +4 -5
- package/dist/qe/test-sets.d.ts.map +1 -1
- package/dist/qe/test-sets.js +2 -1
- package/dist/qe/test-sets.js.map +1 -1
- package/dist/sources/ask.d.ts.map +1 -1
- package/dist/sources/ask.js +12 -12
- package/dist/sources/ask.js.map +1 -1
- package/dist/sources/dialer.d.ts +6 -1
- package/dist/sources/dialer.d.ts.map +1 -1
- package/dist/sources/dialer.js +53 -31
- package/dist/sources/dialer.js.map +1 -1
- package/dist/sources/drivers/mysql.d.ts +2 -0
- package/dist/sources/drivers/mysql.d.ts.map +1 -1
- package/dist/sources/drivers/mysql.js +18 -2
- package/dist/sources/drivers/mysql.js.map +1 -1
- package/dist/sources/drivers/postgres.d.ts +2 -0
- package/dist/sources/drivers/postgres.d.ts.map +1 -1
- package/dist/sources/drivers/postgres.js +10 -3
- package/dist/sources/drivers/postgres.js.map +1 -1
- package/dist/sources/drivers/sqlite.d.ts +22 -5
- package/dist/sources/drivers/sqlite.d.ts.map +1 -1
- package/dist/sources/drivers/sqlite.js +10 -9
- package/dist/sources/drivers/sqlite.js.map +1 -1
- package/dist/sources/drivers/types.d.ts +3 -1
- package/dist/sources/drivers/types.d.ts.map +1 -1
- package/dist/sources/drivers/types.js +3 -1
- package/dist/sources/drivers/types.js.map +1 -1
- package/dist/sources/uploads.d.ts +2 -15
- package/dist/sources/uploads.d.ts.map +1 -1
- package/dist/sources/uploads.js +30 -440
- package/dist/sources/uploads.js.map +1 -1
- package/dist/standing-orders/history.d.ts +5 -3
- package/dist/standing-orders/history.d.ts.map +1 -1
- package/dist/standing-orders/history.js +6 -2
- package/dist/standing-orders/history.js.map +1 -1
- package/dist/studio/apps-standalone/fixture.js +3 -3
- package/dist/studio/apps-standalone/runtime.js +1 -1
- package/dist/studio/assets/{KnowledgeGraph-DWw0I8RJ.js → KnowledgeGraph-dfq7Flyj.js} +1 -1
- package/dist/studio/assets/index-Bame65hj.js +1108 -0
- package/dist/studio/assets/index-CtB1BJRI.css +32 -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 +2 -2
- 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 +1 -1
- package/dist/studio/editors/wicked-page/index.html +1 -1
- package/dist/studio/editors/wicked-video/editor.json +1 -1
- package/dist/studio/editors/wicked-video/index.html +1 -1
- package/dist/studio/index.html +2 -2
- package/dist/studio/testid-inventory.json +402 -11
- package/dist/team/routes.d.ts +11 -1
- package/dist/team/routes.d.ts.map +1 -1
- package/dist/team/routes.js +6 -3
- package/dist/team/routes.js.map +1 -1
- package/dist/workflow-catalog/catalog-data-v2.d.ts +6 -2
- package/dist/workflow-catalog/catalog-data-v2.d.ts.map +1 -1
- package/dist/workflow-catalog/catalog-data-v2.js.map +1 -1
- package/dist/workflow-catalog/shape.d.ts +1 -1
- package/dist/working-doc/event-lines.d.ts +7 -0
- package/dist/working-doc/event-lines.d.ts.map +1 -1
- package/dist/working-doc/event-lines.js +24 -3
- package/dist/working-doc/event-lines.js.map +1 -1
- package/endpoint-manifest.json +89 -6
- package/evals/corpora/shape-v1.json +1 -1
- package/package.json +4 -4
- package/runners/sqlite-runner.mjs +28 -11
- package/runners/upload-parse.d.mts +13 -0
- package/runners/upload-parse.mjs +364 -0
- package/dist/studio/assets/index-C4Xj-zxa.css +0 -32
- package/dist/studio/assets/index-CrNY3d06.js +0 -1109
package/dist/core/adapter.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RuleChangedError, ruleRevision } from '../governance/rule-revision.js';
|
|
1
2
|
import { builtinDefs as deriveBuiltinDefs, engineDefOf } from './builtin-catalog.js';
|
|
2
3
|
import { createRequire } from 'node:module';
|
|
3
4
|
import { attachEngineBus, detachEngineBus } from './bus.js';
|
|
@@ -5,7 +6,8 @@ import { mkdir, access, readFile, writeFile, chmod, rm, link, rename, realpath,
|
|
|
5
6
|
import { existsSync, readFileSync } from 'node:fs';
|
|
6
7
|
import { join, dirname, resolve, isAbsolute, relative, sep } from 'node:path';
|
|
7
8
|
import { isPlainRunId, WALKTHROUGH_AUTHOR_SUBDIR, walkthroughRootDir } from './walkthrough-root.js';
|
|
8
|
-
import {
|
|
9
|
+
import { mcpStateDir } from '../mcp/registry-store.js';
|
|
10
|
+
import { crewStateHome, isDefaultStateHome, wickedWorkRoot } from '../projects/state-home.js';
|
|
9
11
|
import { fileURLToPath } from 'node:url';
|
|
10
12
|
import { homedir } from 'node:os';
|
|
11
13
|
import { randomUUID } from 'node:crypto';
|
|
@@ -13,12 +15,14 @@ import { AskError, AskUnsupportedError } from './types.js';
|
|
|
13
15
|
import { DEFAULT_SETTINGS } from './types.js';
|
|
14
16
|
import { BASE_SKILL_REF_SHAPE } from '../skills/base-skill.js';
|
|
15
17
|
import { execCapped } from './exec.js';
|
|
18
|
+
import { gitCommitIdents, usableGitIdent } from '../setup/known.js';
|
|
16
19
|
import { composeDeliverWorkflow, DELIVER_PHASE_ID, deliverPresetStep, deliverIdentityFor, deliverRepoFor, isGitHubLogin, pushIdentityOf, readDeliverOriginUrl } from './deliver.js';
|
|
17
20
|
import { engineCampaignDef, engineRosterJson } from './engine-roster.js';
|
|
18
21
|
import { composeDeliverableFloor } from './deliverable-floor.js';
|
|
19
22
|
import { deliverCredentialsProbe } from './deliver-credentials.js';
|
|
20
23
|
import { isSyntheticWorkflowId, resolveRunIdentity, verifiedEvidenceCatalog, wireIdentity, withPresetSystemFlag, withSystemFlag, } from './run-identity.js';
|
|
21
|
-
const TERMINAL_RUN_STATUSES = new Set(['completed', 'cancelled', 'failed']);
|
|
24
|
+
export const TERMINAL_RUN_STATUSES = new Set(['completed', 'cancelled', 'failed']);
|
|
25
|
+
const ACTIVE_RUN_STATUSES = new Set(['planning', 'distributing', 'executing']);
|
|
22
26
|
import { resolveProjectGraphBinding } from '../projects/graph.js';
|
|
23
27
|
import { applyGovernanceStoreEnv, isStoreSpec } from './governance-store.js';
|
|
24
28
|
import { isCouncilSize, isCouncilStaggerMs } from './council-settings.js';
|
|
@@ -27,11 +31,6 @@ import { QE_OFF_REASON, launchRequiresQe, qeAcceptanceMode, qeSettingSkipReason
|
|
|
27
31
|
import { applyVaultBinEnv, BOOT_VAULT_BIN, resolveShippedVaultBin } from './vault-bin.js';
|
|
28
32
|
import { withFolderFindings } from './repoPaths.js';
|
|
29
33
|
import { NEW_WORK_SEATS_FIX, NewWorkSeatsRefusal, isSeatKeyList } from './job-seats.js';
|
|
30
|
-
/** Resolved path under the user's home directory. */
|
|
31
|
-
export function wickedDir(...parts) {
|
|
32
|
-
const home = process.env.HOME ?? process.env.USERPROFILE ?? '/tmp';
|
|
33
|
-
return join(home, '.wicked', ...parts);
|
|
34
|
-
}
|
|
35
34
|
/**
|
|
36
35
|
* Parse a JSON string a napi binding returned. The bindings type their return loosely (`unknown`
|
|
37
36
|
* until a `ts_return_type` regen), so guard BOTH a non-string return and invalid JSON with an error
|
|
@@ -113,6 +112,8 @@ export async function readNewWorkSeats() {
|
|
|
113
112
|
// Absent only when no entry is there at all: a settings link whose target is gone is a file that can't be read.
|
|
114
113
|
if (err.code === 'ENOENT' && !(await lstat(path).then(() => true, () => false)))
|
|
115
114
|
return null;
|
|
115
|
+
if (err instanceof NewWorkSeatsRefusal)
|
|
116
|
+
throw err;
|
|
116
117
|
const why = err.code ?? (err instanceof Error ? err.message : String(err));
|
|
117
118
|
throw new NewWorkSeatsRefusal('settings_unavailable', `crew can't read its settings file (${why}), so it can't tell which seats new work may use (newWorkSeats); it won't start new work on every seat instead. Fix ${path}, or ${NEW_WORK_SEATS_FIX}`);
|
|
118
119
|
}
|
|
@@ -140,25 +141,31 @@ export async function readNewWorkSeats() {
|
|
|
140
141
|
* crew#756 migration, once: a non-default state home with no settings file of its own starts from a
|
|
141
142
|
* COPY of the shared file, so a daemon upgraded onto this rule keeps its configuration while every
|
|
142
143
|
* later write stays in its own state home. Exclusive copy (never overwrites); a missing shared file
|
|
143
|
-
*
|
|
144
|
+
* seeds an empty object. An unreadable or invalid shared file leaves the home unseeded for a retry.
|
|
145
|
+
* A daemon with an explicit `WICKED_CREW_SYSTEM_SETTINGS` or on the default home skips it.
|
|
144
146
|
*/
|
|
145
147
|
async function seedStateHomeSettings(path) {
|
|
146
148
|
const override = process.env['WICKED_CREW_SYSTEM_SETTINGS'];
|
|
147
149
|
if ((override !== undefined && override !== '') || isDefaultStateHome() || existsSync(path))
|
|
148
150
|
return;
|
|
149
|
-
//
|
|
150
|
-
|
|
151
|
-
// never retried (Copilot on #760). Published with `link`, which is atomic and never replaces an
|
|
152
|
-
// existing file: a racing first read either publishes or finds a complete file.
|
|
151
|
+
// Published with `link`, so a racing first read either publishes or finds a complete file.
|
|
152
|
+
const shared = sharedSettingsFilePath();
|
|
153
153
|
let body = '{}';
|
|
154
154
|
try {
|
|
155
|
-
|
|
156
|
-
const parsed = JSON.parse(raw);
|
|
157
|
-
if (parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed))
|
|
158
|
-
body = raw;
|
|
155
|
+
body = await readFile(shared, 'utf8');
|
|
159
156
|
}
|
|
160
|
-
catch {
|
|
161
|
-
|
|
157
|
+
catch (err) {
|
|
158
|
+
if (err.code !== 'ENOENT') {
|
|
159
|
+
throw new NewWorkSeatsRefusal('settings_unavailable', `Cannot read ${shared}: ${err instanceof Error ? err.message : String(err)}. Fix this file to start new work.`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
try {
|
|
163
|
+
const parsed = JSON.parse(body);
|
|
164
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed))
|
|
165
|
+
throw new Error('expected a JSON object');
|
|
166
|
+
}
|
|
167
|
+
catch (err) {
|
|
168
|
+
throw new NewWorkSeatsRefusal('settings_unavailable', `Cannot use ${shared}: ${err instanceof Error ? err.message : String(err)}. Fix this file to start new work.`);
|
|
162
169
|
}
|
|
163
170
|
await publishSettingsFile(path, body, false);
|
|
164
171
|
}
|
|
@@ -566,6 +573,22 @@ function addonAtLeast(maj, min, pat) {
|
|
|
566
573
|
// ── Built-in workflows (X-MIG M11) ───────────────────────────────────────────
|
|
567
574
|
// No mirrors: the built-ins are the engine's built-in presets, read once at boot and laid over the
|
|
568
575
|
// phase catalog (`core/builtin-catalog.ts`, `loadBuiltinCatalog`). One source; nothing to drift.
|
|
576
|
+
/** Refusing new work while this daemon drains; restarting clears the in-memory state. */
|
|
577
|
+
export class MaintenanceDrainError extends Error {
|
|
578
|
+
code = 'maintenance_drain';
|
|
579
|
+
hint = 'Wait for maintenance to finish, or POST /api/v1/maintenance with {"drain":false} to admit work again.';
|
|
580
|
+
constructor() {
|
|
581
|
+
super('This daemon is draining for maintenance and is refusing new work.');
|
|
582
|
+
this.name = 'MaintenanceDrainError';
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
/** The linked engine predates repository removal (wicked-core `unregisterRepo`). */
|
|
586
|
+
export class RepoUnregisterUnsupportedError extends Error {
|
|
587
|
+
constructor() {
|
|
588
|
+
super('Removing a repository requires an engine with unregisterRepo; upgrade wicked-core-ts.');
|
|
589
|
+
this.name = 'RepoUnregisterUnsupportedError';
|
|
590
|
+
}
|
|
591
|
+
}
|
|
569
592
|
/**
|
|
570
593
|
* Chat is not available in this deployment at all — a capability gap, never a bad request.
|
|
571
594
|
*
|
|
@@ -774,6 +797,7 @@ export class CoreAdapter {
|
|
|
774
797
|
/** crew#1145: what each engine launch awaits first (`setLaunchGate`); `null` = nothing. */
|
|
775
798
|
launchGate = null;
|
|
776
799
|
closed = false;
|
|
800
|
+
drainSince = null;
|
|
777
801
|
/**
|
|
778
802
|
* The estate db the Core actor was spawned over (`CoreAdapterOptions.dbPath` — the `--db`
|
|
779
803
|
* flag / `~/.wicked-crew/core.db` default). Kept because some engine bindings take the db
|
|
@@ -1175,6 +1199,17 @@ export class CoreAdapter {
|
|
|
1175
1199
|
if (failure !== null)
|
|
1176
1200
|
throw failure.err instanceof Error ? failure.err : new Error(String(failure.err));
|
|
1177
1201
|
}
|
|
1202
|
+
/** Toggle admission without persisting a setting; repeated enable keeps the original time. */
|
|
1203
|
+
setDraining(drain) {
|
|
1204
|
+
this.drainSince = drain ? (this.drainSince ?? Date.now()) : null;
|
|
1205
|
+
}
|
|
1206
|
+
/** Parked and human-held runs are idle for maintenance, but still hold their repository. */
|
|
1207
|
+
async maintenanceState() {
|
|
1208
|
+
const active = (await this.sessionsDetail())
|
|
1209
|
+
.filter((v) => ACTIVE_RUN_STATUSES.has(v.session.status))
|
|
1210
|
+
.map((v) => ({ runId: v.session.id, status: v.session.status }));
|
|
1211
|
+
return { draining: this.drainSince !== null, since: this.drainSince, idle: active.length === 0, active };
|
|
1212
|
+
}
|
|
1178
1213
|
/**
|
|
1179
1214
|
* Hand a launch to the engine with its notices: `handed` BEFORE the call (the pin is open before
|
|
1180
1215
|
* any spawn can read the env), `rejected` when the call throws (nothing will spawn — the pin is
|
|
@@ -1186,10 +1221,12 @@ export class CoreAdapter {
|
|
|
1186
1221
|
* never swallowed (codex round 6). A listener failing on `rejected` cannot un-launch anything;
|
|
1187
1222
|
* the primary error keeps precedence and the secondary one is logged, not lost.
|
|
1188
1223
|
*/
|
|
1189
|
-
async handedToEngine(kind, id, call, workflow) {
|
|
1224
|
+
async handedToEngine(kind, id, call, workflow, resumesWork = true) {
|
|
1190
1225
|
// No gate, no extra turn: a launch without one is handed exactly as before.
|
|
1191
1226
|
if (this.launchGate !== null)
|
|
1192
1227
|
await this.launchGate();
|
|
1228
|
+
if (resumesWork && this.drainSince !== null)
|
|
1229
|
+
throw new MaintenanceDrainError();
|
|
1193
1230
|
try {
|
|
1194
1231
|
this.notifyLaunch({ kind, id, status: 'handed', ...(workflow !== undefined ? { workflow } : {}) });
|
|
1195
1232
|
}
|
|
@@ -1243,6 +1280,10 @@ export class CoreAdapter {
|
|
|
1243
1280
|
static roster() {
|
|
1244
1281
|
return JSON.parse(Core.registryRoster());
|
|
1245
1282
|
}
|
|
1283
|
+
/** The engine's judge coverage, absent on an addon that predates the static. */
|
|
1284
|
+
static judgeCoverage(clisJson, bound) {
|
|
1285
|
+
return typeof Core.judgeCoverage === 'function' ? Core.judgeCoverage(clisJson, bound) : null;
|
|
1286
|
+
}
|
|
1246
1287
|
/**
|
|
1247
1288
|
* core#920: the seats the engine benches on a run bound to one repository, keyed by seat with the
|
|
1248
1289
|
* engine's reason — or `null` when the linked addon predates the predicate. `seats` must be
|
|
@@ -1324,16 +1365,19 @@ export class CoreAdapter {
|
|
|
1324
1365
|
*/
|
|
1325
1366
|
async resolveDeliverIdentity(repoRef) {
|
|
1326
1367
|
let login = '';
|
|
1368
|
+
let authorNoreply = false;
|
|
1327
1369
|
let source = 'setting';
|
|
1328
1370
|
try {
|
|
1329
|
-
|
|
1371
|
+
const settings = await this.getSettings();
|
|
1372
|
+
({ login, source } = deliverIdentityFor(settings, repoRef));
|
|
1373
|
+
authorNoreply = settings.deliverAuthorNoreply === true;
|
|
1330
1374
|
}
|
|
1331
1375
|
catch {
|
|
1332
1376
|
// A settings file that cannot be read leaves the identity unconfigured rather than
|
|
1333
1377
|
// failing the launch — the deliver script still cross-checks gh against git's credential.
|
|
1334
1378
|
login = '';
|
|
1335
1379
|
}
|
|
1336
|
-
return { login, source };
|
|
1380
|
+
return { login, source, authorNoreply };
|
|
1337
1381
|
}
|
|
1338
1382
|
/**
|
|
1339
1383
|
* The origin the deliver push will actually go to (F2) so the deliver GATE CARD says what will
|
|
@@ -1369,6 +1413,24 @@ export class CoreAdapter {
|
|
|
1369
1413
|
return null;
|
|
1370
1414
|
}
|
|
1371
1415
|
}
|
|
1416
|
+
/** (crew#1667) Read once at compose from the registered root, as for the F2 origin read.
|
|
1417
|
+
* The future run worktree shares this config. No repo means no author sentence. */
|
|
1418
|
+
async resolveDeliverCommitIdents(repoRef) {
|
|
1419
|
+
if (repoRef === null || repoRef === undefined || repoRef === '')
|
|
1420
|
+
return undefined;
|
|
1421
|
+
try {
|
|
1422
|
+
const hit = deliverRepoFor(await this.listRepos(), repoRef);
|
|
1423
|
+
if (hit === undefined || hit.root_path === '')
|
|
1424
|
+
return undefined;
|
|
1425
|
+
const idents = await gitCommitIdents({ cwd: hit.root_path });
|
|
1426
|
+
return idents !== null && usableGitIdent(idents.author) && usableGitIdent(idents.committer)
|
|
1427
|
+
? { author: idents.author, committer: idents.committer }
|
|
1428
|
+
: null;
|
|
1429
|
+
}
|
|
1430
|
+
catch {
|
|
1431
|
+
return null;
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1372
1434
|
/** The launcher's `deliver` step for a plan (`name` null) or a preset launch (DES-TEAMING-002
|
|
1373
1435
|
* §8.5): the engine appends it to the plan and puts it in the floor. */
|
|
1374
1436
|
deliverStep(name, phases, input,
|
|
@@ -1377,7 +1439,7 @@ export class CoreAdapter {
|
|
|
1377
1439
|
/** (crew#737) The identity this launch resolved — launch-local, never adapter state. */
|
|
1378
1440
|
identity,
|
|
1379
1441
|
/** (crew#720) The provider credential preflight this launch read. */
|
|
1380
|
-
credentials) {
|
|
1442
|
+
credentials, commitIdents) {
|
|
1381
1443
|
return deliverPresetStep(name, phases, input.sessionId, input.problem, {
|
|
1382
1444
|
repoRef: input.repoRef ?? null,
|
|
1383
1445
|
apiOrigin: this.deliverApiOrigin?.() ?? null,
|
|
@@ -1386,8 +1448,10 @@ export class CoreAdapter {
|
|
|
1386
1448
|
ghTokenPinned: typeof process.env['GH_TOKEN'] === 'string' && process.env['GH_TOKEN'] !== '',
|
|
1387
1449
|
originUrl,
|
|
1388
1450
|
deliverIdentity: identity.login,
|
|
1451
|
+
deliverAuthorNoreply: identity.authorNoreply,
|
|
1389
1452
|
deliverIdentitySource: identity.source,
|
|
1390
1453
|
credentials,
|
|
1454
|
+
...(commitIdents !== undefined ? { commitIdents } : {}),
|
|
1391
1455
|
});
|
|
1392
1456
|
}
|
|
1393
1457
|
/** Launch an interactive, resumable run → the run id. */
|
|
@@ -1398,6 +1462,7 @@ export class CoreAdapter {
|
|
|
1398
1462
|
// (F2) And the origin the push would go to — read once, for the gate card's target sentence.
|
|
1399
1463
|
// Only a delivering launch composes a deliver phase, so only a delivering launch pays for it.
|
|
1400
1464
|
const deliverOriginUrl = input.deliver === 'pr' ? await this.resolveDeliverOrigin(input.repoRef) : null;
|
|
1465
|
+
const deliverCommitIdents = input.deliver === 'pr' ? await this.resolveDeliverCommitIdents(input.repoRef) : undefined;
|
|
1401
1466
|
// (crew#720) And whether the provider credential is there — presence only, read once.
|
|
1402
1467
|
const deliverCredentials = input.deliver === 'pr' ? await deliverCredentialsProbe(deliverOriginUrl, process.env, undefined, pushIdentityOf(deliverIdentity.login)) : null;
|
|
1403
1468
|
const opts = {
|
|
@@ -1577,7 +1642,7 @@ export class CoreAdapter {
|
|
|
1577
1642
|
this.passLaunchDeliverables(opts, input.requireDeliverables ?? [], 'a plan');
|
|
1578
1643
|
// T8: a delivering plan hands the engine its deliver step, exactly as a preset launch does.
|
|
1579
1644
|
if (input.deliver === 'pr') {
|
|
1580
|
-
opts.deliverStepJson = JSON.stringify(this.deliverStep(null, [], input, deliverOriginUrl, deliverIdentity, deliverCredentials));
|
|
1645
|
+
opts.deliverStepJson = JSON.stringify(this.deliverStep(null, [], input, deliverOriginUrl, deliverIdentity, deliverCredentials, deliverCommitIdents));
|
|
1581
1646
|
}
|
|
1582
1647
|
}
|
|
1583
1648
|
// DES-TEAMING-002 T3: a workflow that names a PRESET is a plan the engine floor-fills and gates.
|
|
@@ -1598,7 +1663,7 @@ export class CoreAdapter {
|
|
|
1598
1663
|
// Only a DELIVERING preset gets the deliver step: a preset launched for its deliverables alone
|
|
1599
1664
|
// pushes nothing (codex r1 on #930).
|
|
1600
1665
|
if (input.deliver === 'pr') {
|
|
1601
|
-
const step = this.deliverStep(input.workflow, this.getWorkflow(input.workflow)?.phases ?? [], input, deliverOriginUrl, deliverIdentity, deliverCredentials);
|
|
1666
|
+
const step = this.deliverStep(input.workflow, this.getWorkflow(input.workflow)?.phases ?? [], input, deliverOriginUrl, deliverIdentity, deliverCredentials, deliverCommitIdents);
|
|
1602
1667
|
opts.deliverStepJson = JSON.stringify(step);
|
|
1603
1668
|
}
|
|
1604
1669
|
opts.workflow = input.workflow;
|
|
@@ -1668,10 +1733,12 @@ export class CoreAdapter {
|
|
|
1668
1733
|
// F2 — the origin the push will actually go to, so the gate card cannot promise a
|
|
1669
1734
|
// pull request on a remote that can never carry one.
|
|
1670
1735
|
originUrl: deliverOriginUrl,
|
|
1736
|
+
...(deliverCommitIdents !== undefined ? { commitIdents: deliverCommitIdents } : {}),
|
|
1671
1737
|
// crew#549 — the configured deliver identity, baked into the script so the refusal
|
|
1672
1738
|
// holds on a daemon started without GH_ACCOUNT exported; crew#737 — the repository's
|
|
1673
1739
|
// own pin wins, and the card says when it is not signed in here.
|
|
1674
1740
|
deliverIdentity: deliverIdentity.login,
|
|
1741
|
+
deliverAuthorNoreply: deliverIdentity.authorNoreply,
|
|
1675
1742
|
deliverIdentitySource: deliverIdentity.source,
|
|
1676
1743
|
// crew#720 — the provider credential preflight, said on the card before approval.
|
|
1677
1744
|
credentials: deliverCredentials,
|
|
@@ -1780,6 +1847,7 @@ export class CoreAdapter {
|
|
|
1780
1847
|
// (operator ruling 2026-10-11) WHO answered — recorded by the gate route just before this call
|
|
1781
1848
|
// (`recordGateActor`), consumed once. The engine records it when the answer is an operator
|
|
1782
1849
|
// judgment ("judged by operator", core-ts ≥ 0.9.7); an older addon ignores the trailing argument.
|
|
1850
|
+
const resumesWork = plan !== undefined || approve || (action !== undefined && action !== 'reject');
|
|
1783
1851
|
const actorLabel = this.gateActors.get(runId);
|
|
1784
1852
|
this.gateActors.delete(runId);
|
|
1785
1853
|
if (expect !== undefined) {
|
|
@@ -1798,7 +1866,7 @@ export class CoreAdapter {
|
|
|
1798
1866
|
return plan !== undefined
|
|
1799
1867
|
? core.confirmGate(runId, true, note ?? null, 'edit_plan', null, JSON.stringify(plan), actorLabel ?? null, expect.ord ?? null, expect.planRev ?? null)
|
|
1800
1868
|
: core.confirmGate(runId, approve, amend ?? null, action ?? null, amendScope ?? null, null, actorLabel ?? null, expect.ord ?? null, expect.planRev ?? null);
|
|
1801
|
-
});
|
|
1869
|
+
}, undefined, resumesWork);
|
|
1802
1870
|
}
|
|
1803
1871
|
return this.handedToEngine('run', runId, () => {
|
|
1804
1872
|
if (actorLabel !== undefined && plan === undefined) {
|
|
@@ -1836,7 +1904,7 @@ export class CoreAdapter {
|
|
|
1836
1904
|
// The 0.7.27 binding takes the two trailing optionals; typed here until the pin moves.
|
|
1837
1905
|
const core = this.core;
|
|
1838
1906
|
return core.confirmGate(runId, approve, amend, action, amendScope);
|
|
1839
|
-
});
|
|
1907
|
+
}, undefined, resumesWork);
|
|
1840
1908
|
}
|
|
1841
1909
|
/** Cancel a run → the status token. */
|
|
1842
1910
|
cancelRun(runId) {
|
|
@@ -1995,6 +2063,8 @@ export class CoreAdapter {
|
|
|
1995
2063
|
}
|
|
1996
2064
|
/** (program DES-POWER-MODE) Answer a power run's checkpoint pause; resolves to its `PowerState`. */
|
|
1997
2065
|
async answerPowerPause(runId, decision, note, actor) {
|
|
2066
|
+
if (decision !== 'stop' && this.drainSince !== null)
|
|
2067
|
+
throw new MaintenanceDrainError();
|
|
1998
2068
|
if (typeof this.core.answerPowerPause !== 'function')
|
|
1999
2069
|
throw new Error('refused: this wicked-core build has no power mode');
|
|
2000
2070
|
return JSON.parse(await this.core.answerPowerPause(runId, decision, note, actor));
|
|
@@ -2330,6 +2400,7 @@ export class CoreAdapter {
|
|
|
2330
2400
|
// (F2) The preview shows the deliver step's gate-card text, so it reads the same origin the
|
|
2331
2401
|
// launch would. Local to this call, like the launch's.
|
|
2332
2402
|
const previewOriginUrl = opts.deliver === true ? await this.resolveDeliverOrigin(opts.repoRef) : null;
|
|
2403
|
+
const previewCommitIdents = opts.deliver === true ? await this.resolveDeliverCommitIdents(opts.repoRef) : undefined;
|
|
2333
2404
|
const previewIdentity = await this.resolveDeliverIdentity(opts.repoRef);
|
|
2334
2405
|
const previewCredentials = opts.deliver === true ? await deliverCredentialsProbe(previewOriginUrl, process.env, undefined, pushIdentityOf(previewIdentity.login)) : null;
|
|
2335
2406
|
const deliverStep = opts.deliver === true
|
|
@@ -2341,7 +2412,7 @@ export class CoreAdapter {
|
|
|
2341
2412
|
problem: '',
|
|
2342
2413
|
clisJson: '[]',
|
|
2343
2414
|
...(opts.repoRef !== undefined ? { repoRef: opts.repoRef } : {}),
|
|
2344
|
-
}, previewOriginUrl, previewIdentity, previewCredentials))
|
|
2415
|
+
}, previewOriginUrl, previewIdentity, previewCredentials, previewCommitIdents))
|
|
2345
2416
|
: null;
|
|
2346
2417
|
return JSON.parse(await fn.call(this.core, JSON.stringify(plan), opts.projectId ?? null, opts.humanConfirm ?? null, opts.repoRef ?? null, deliverStep));
|
|
2347
2418
|
}
|
|
@@ -2572,12 +2643,18 @@ export class CoreAdapter {
|
|
|
2572
2643
|
const real = await realpath(rootPath).catch(() => rootPath);
|
|
2573
2644
|
return JSON.parse(await this.core.registerRepo(name, real));
|
|
2574
2645
|
}
|
|
2646
|
+
/** Remove only the engine registration; the checkout and graph stay on disk. */
|
|
2647
|
+
async unregisterRepo(id) {
|
|
2648
|
+
if (typeof this.core.unregisterRepo !== 'function')
|
|
2649
|
+
throw new RepoUnregisterUnsupportedError();
|
|
2650
|
+
return parseEngineJson(await this.core.unregisterRepo(id), 'unregisterRepo');
|
|
2651
|
+
}
|
|
2575
2652
|
/**
|
|
2576
2653
|
* Clone a remote git URL and return the persisted `RepoEntry` from registration.
|
|
2577
|
-
* `checkoutPath` overrides the
|
|
2654
|
+
* `checkoutPath` overrides the state-home-derived repos destination.
|
|
2578
2655
|
*/
|
|
2579
2656
|
async cloneAndRegister(name, gitUrl, checkoutPath, opts = {}) {
|
|
2580
|
-
const reposRoot =
|
|
2657
|
+
const reposRoot = wickedWorkRoot('repos');
|
|
2581
2658
|
let cloneDir;
|
|
2582
2659
|
if (checkoutPath) {
|
|
2583
2660
|
// Expand leading ~/ so callers can use home-relative paths.
|
|
@@ -2842,9 +2919,30 @@ export class CoreAdapter {
|
|
|
2842
2919
|
async upsertPolicy(policy) {
|
|
2843
2920
|
await this.core.upsertPolicy(JSON.stringify(policy));
|
|
2844
2921
|
}
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2922
|
+
ruleWriteTails = new Map();
|
|
2923
|
+
ruleExclusively(id, write) {
|
|
2924
|
+
const result = (this.ruleWriteTails.get(id) ?? Promise.resolve()).then(write);
|
|
2925
|
+
const tail = result.catch(() => undefined);
|
|
2926
|
+
this.ruleWriteTails.set(id, tail);
|
|
2927
|
+
void tail.then(() => {
|
|
2928
|
+
if (this.ruleWriteTails.get(id) === tail)
|
|
2929
|
+
this.ruleWriteTails.delete(id);
|
|
2930
|
+
});
|
|
2931
|
+
return result;
|
|
2932
|
+
}
|
|
2933
|
+
/** Compare and write under the same lock as every crew writer of this rule. */
|
|
2934
|
+
async upsertConformanceRule(rule, expectedRevision) {
|
|
2935
|
+
return this.ruleExclusively(rule.id, async () => {
|
|
2936
|
+
if (expectedRevision !== undefined) {
|
|
2937
|
+
const current = (await this.listConformanceRules()).find((r) => r.id === rule.id);
|
|
2938
|
+
const revision = current === undefined ? null : ruleRevision(current);
|
|
2939
|
+
if (revision !== expectedRevision)
|
|
2940
|
+
throw new RuleChangedError(revision);
|
|
2941
|
+
}
|
|
2942
|
+
const stored = { ...rule };
|
|
2943
|
+
delete stored.revision;
|
|
2944
|
+
await this.core.upsertConformanceRule(JSON.stringify(stored));
|
|
2945
|
+
});
|
|
2848
2946
|
}
|
|
2849
2947
|
/**
|
|
2850
2948
|
* Withdraw a policy from enforcement. Resolves `true` if a policy with that id existed.
|
|
@@ -2862,11 +2960,13 @@ export class CoreAdapter {
|
|
|
2862
2960
|
}
|
|
2863
2961
|
/** Withdraw a conformance rule from recall. Same contract as {@link retirePolicy}. */
|
|
2864
2962
|
async retireConformanceRule(id) {
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2963
|
+
return this.ruleExclusively(id, async () => {
|
|
2964
|
+
const retire = this.core.retireConformanceRule;
|
|
2965
|
+
if (typeof retire !== 'function') {
|
|
2966
|
+
throw new Error('Retiring a conformance rule is not yet supported by this wicked-core build');
|
|
2967
|
+
}
|
|
2968
|
+
return JSON.parse(await retire.call(this.core, id));
|
|
2969
|
+
});
|
|
2870
2970
|
}
|
|
2871
2971
|
/** Recall conformance rules matching a facet query (read-only, does not block actor). */
|
|
2872
2972
|
async recallRulesPreview(query) {
|
|
@@ -3019,19 +3119,16 @@ export class CoreAdapter {
|
|
|
3019
3119
|
return typeof this.core.governanceEvals === 'function';
|
|
3020
3120
|
}
|
|
3021
3121
|
/**
|
|
3022
|
-
*
|
|
3023
|
-
*
|
|
3024
|
-
*
|
|
3025
|
-
*
|
|
3026
|
-
* derived), NOT a dbPath-derived sidecar. That home default is exactly why the test harness
|
|
3027
|
-
* arms this seam (tests/setup/hermetic-home.ts): an un-armed corpus-import test writes
|
|
3028
|
-
* `evals:` junk into the OPERATOR's real estate knowledge store — the store the mem/search
|
|
3029
|
-
* domains answer from (crew#396). Read at call time, not construction time, so a test may
|
|
3030
|
-
* re-aim it per fixture.
|
|
3122
|
+
* Explicit WICKED_CREW_KNOWLEDGE_DB wins; isolated homes use <state home>/mcp/evals-knowledge.db,
|
|
3123
|
+
* a file of its own because the engine's vendored store must not share the estate binary's knowledge.db.
|
|
3124
|
+
* The default home omits it so the engine keeps its HOME-derived ~/.wicked-estate/knowledge.db
|
|
3125
|
+
* (evals.rs default_knowledge_db); this is why tests/setup/hermetic-home.ts arms the env seam (crew#396).
|
|
3031
3126
|
*/
|
|
3032
|
-
static
|
|
3127
|
+
static governanceKnowledgeDb() {
|
|
3033
3128
|
const override = process.env['WICKED_CREW_KNOWLEDGE_DB'];
|
|
3034
|
-
|
|
3129
|
+
if (override !== undefined && override !== '')
|
|
3130
|
+
return override;
|
|
3131
|
+
return isDefaultStateHome() ? undefined : join(mcpStateDir(), 'evals-knowledge.db');
|
|
3035
3132
|
}
|
|
3036
3133
|
/**
|
|
3037
3134
|
* Run the governance evals: every sample of the corpus (`corpus` = an `evals:<name>` estate
|
|
@@ -3042,8 +3139,8 @@ export class CoreAdapter {
|
|
|
3042
3139
|
*
|
|
3043
3140
|
* `dbPath` rides the args because the eval run opens its own read-only connection to the
|
|
3044
3141
|
* steering store — the SAME store this adapter's actor writes (`this.dbPath`, the one spelling
|
|
3045
|
-
* of where it lives).
|
|
3046
|
-
* (`~/.wicked-estate/knowledge.db`)
|
|
3142
|
+
* of where it lives). {@link governanceKnowledgeDb} pins isolated homes; the default home keeps
|
|
3143
|
+
* the engine default (`~/.wicked-estate/knowledge.db`) unless explicitly overridden.
|
|
3047
3144
|
*
|
|
3048
3145
|
* Presence-gated (the campaigns doctrine): throws {@link GovernanceEvalsUnsupportedError} on
|
|
3049
3146
|
* an addon that predates the binding, which the route maps to 501 ("upgrade the engine").
|
|
@@ -3053,7 +3150,7 @@ export class CoreAdapter {
|
|
|
3053
3150
|
if (typeof fn !== 'function') {
|
|
3054
3151
|
throw new GovernanceEvalsUnsupportedError('Running governance evals');
|
|
3055
3152
|
}
|
|
3056
|
-
const knowledgeDb = CoreAdapter.
|
|
3153
|
+
const knowledgeDb = CoreAdapter.governanceKnowledgeDb();
|
|
3057
3154
|
const payload = {
|
|
3058
3155
|
...(args.type !== undefined ? { type: args.type } : {}),
|
|
3059
3156
|
...(args.corpus !== undefined ? { corpus: args.corpus } : {}),
|
|
@@ -3065,8 +3162,7 @@ export class CoreAdapter {
|
|
|
3065
3162
|
/**
|
|
3066
3163
|
* Import a named eval corpus into the knowledge store under the `evals:<name>` scope (the
|
|
3067
3164
|
* string a later {@link runGovernanceEvals} names as `corpus`). `knowledgeDb` resolves the
|
|
3068
|
-
* same way as in {@link runGovernanceEvals}
|
|
3069
|
-
* `~/.wicked-estate/knowledge.db`), {@link knowledgeDbOverride} wins when set.
|
|
3165
|
+
* same way as in {@link runGovernanceEvals}, through {@link governanceKnowledgeDb}.
|
|
3070
3166
|
*
|
|
3071
3167
|
* Gated on the `governanceEvals` sentinel as well as the binding itself: the two ship
|
|
3072
3168
|
* together, and importing a corpus no engine on this host can ever run would be a trap, not
|
|
@@ -3077,7 +3173,7 @@ export class CoreAdapter {
|
|
|
3077
3173
|
if (typeof this.core.governanceEvals !== 'function' || typeof importFn !== 'function') {
|
|
3078
3174
|
throw new GovernanceEvalsUnsupportedError('Importing an eval corpus');
|
|
3079
3175
|
}
|
|
3080
|
-
const knowledgeDb = CoreAdapter.
|
|
3176
|
+
const knowledgeDb = CoreAdapter.governanceKnowledgeDb();
|
|
3081
3177
|
return parseEngineJson(await importFn.call(this.core, JSON.stringify({ name, samples, ...(knowledgeDb !== undefined ? { knowledgeDb } : {}) })), 'governanceCorpusImport');
|
|
3082
3178
|
}
|
|
3083
3179
|
// ── Workflow viewer + builder (crew#44) ────────────────────────────────────
|
|
@@ -3195,12 +3291,12 @@ export class CoreAdapter {
|
|
|
3195
3291
|
return def.id;
|
|
3196
3292
|
}
|
|
3197
3293
|
/**
|
|
3198
|
-
* Save an inline script
|
|
3294
|
+
* Save an inline script under the state-home-derived scripts root, make it executable,
|
|
3199
3295
|
* and return the absolute path. Tool-executor phases use this path as their command.
|
|
3200
3296
|
*/
|
|
3201
3297
|
async saveScript(name, content, lang) {
|
|
3202
3298
|
const ext = lang === 'python' ? 'py' : 'sh';
|
|
3203
|
-
const dir =
|
|
3299
|
+
const dir = wickedWorkRoot('scripts');
|
|
3204
3300
|
await mkdir(dir, { recursive: true });
|
|
3205
3301
|
const filename = `${name.replace(/[^a-z0-9_-]/gi, '_')}.${ext}`;
|
|
3206
3302
|
const path = join(dir, filename);
|
|
@@ -3282,8 +3378,8 @@ export class CoreAdapter {
|
|
|
3282
3378
|
/** The settings as read, and whether the read succeeded: a file that could not be read, parsed or
|
|
3283
3379
|
* validated serves the defaults (`ok: false`), which the engine's QE mirror reads as a failure. */
|
|
3284
3380
|
async readSettings() {
|
|
3285
|
-
await seedStateHomeSettings(settingsFilePath());
|
|
3286
3381
|
try {
|
|
3382
|
+
await seedStateHomeSettings(settingsFilePath());
|
|
3287
3383
|
const raw = await readFile(settingsFilePath(), 'utf8');
|
|
3288
3384
|
const parsed = JSON.parse(raw);
|
|
3289
3385
|
// Validate numeric fields; drop anything out-of-range rather than propagate bad values.
|
|
@@ -3292,6 +3388,8 @@ export class CoreAdapter {
|
|
|
3292
3388
|
if (typeof v !== 'number' || !Number.isInteger(v) || v < 1 || v > 10000)
|
|
3293
3389
|
delete parsed.graphNodeLimit;
|
|
3294
3390
|
}
|
|
3391
|
+
if ('deliverAuthorNoreply' in parsed && typeof parsed.deliverAuthorNoreply !== 'boolean')
|
|
3392
|
+
delete parsed.deliverAuthorNoreply;
|
|
3295
3393
|
// deliverIdentityLogin (crew#549): a LOGIN, and the same charset PUT /settings enforces —
|
|
3296
3394
|
// a hand-edited settings.json must not enable a value the API rejects (and must never be
|
|
3297
3395
|
// able to put anything but a login into the deliver script's shell literal). Anything else
|