@attalabs/vinaya 0.32.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/aeg-root/contracts/principal-operator.md +18 -5
- package/aeg-root/enforcement.md +1 -1
- package/aeg-root/glossary.md +4 -0
- package/aeg-root/roles/developer.md +3 -0
- package/aeg-root/roles/operator.md +89 -16
- package/aeg-root/roles/planner/reference.md +3 -2
- package/aeg-root/roles/planner.md +3 -1
- package/aeg-root/roles/tranche-archivist.md +1 -0
- package/aeg-root/skills/aeg-context-packets/SKILL.md +1 -1
- package/aeg-root/skills/aeg-context-packets/examples/operator-start.md +1 -1
- package/aeg-root/templates/brief-template.md +9 -7
- package/aeg-root/templates/pr-report-template.md +3 -1
- package/dist/checks/bin/check-body-bare-digits.js +213 -41
- package/dist/checks/bin/check-branch-topology.js +164 -41
- package/dist/checks/bin/check-brief-shape.js +219 -46
- package/dist/checks/bin/check-changeset-coverage.js +669 -152
- package/dist/checks/bin/check-closes-n.js +164 -41
- package/dist/checks/bin/check-coherence.js +220 -43
- package/dist/checks/bin/check-dead-branch-push.js +159 -40
- package/dist/checks/bin/check-dispatch-readiness.js +218 -42
- package/dist/checks/bin/check-doc-coverage-push.js +665 -148
- package/dist/checks/bin/check-doc-coverage.js +667 -150
- package/dist/checks/bin/check-doctrine-no-procedures.js +213 -41
- package/dist/checks/bin/check-doctrine-portability.js +666 -149
- package/dist/checks/bin/check-evidence-fresh.js +643 -125
- package/dist/checks/bin/check-exec-bits.js +663 -146
- package/dist/checks/bin/check-first-push-dispatch.js +218 -42
- package/dist/checks/bin/check-issue-assignment.js +164 -41
- package/dist/checks/bin/check-issue-milestone-attach.js +159 -40
- package/dist/checks/bin/check-issue-objectives-numbering.js +685 -41
- package/dist/checks/bin/check-issue-parts-coverage.js +159 -40
- package/dist/checks/bin/check-issue-surface-globs.js +258 -48
- package/dist/checks/bin/check-issue-title-grammar.js +159 -40
- package/dist/checks/bin/check-issue-tranche-label.js +159 -40
- package/dist/checks/bin/check-main-branch-refusal.js +159 -40
- package/dist/checks/bin/check-no-disk-state.js +159 -40
- package/dist/checks/bin/check-pr-premise-reassert.js +213 -41
- package/dist/checks/bin/check-pr-report-density.js +159 -40
- package/dist/checks/bin/check-principal-test-plan-wait.js +159 -40
- package/dist/checks/bin/check-quoted-command.js +586 -103
- package/dist/checks/bin/check-reader-resolvable-prose.js +637 -111
- package/dist/checks/bin/check-registry-gates.js +159 -40
- package/dist/checks/bin/check-retired-vocabulary.js +586 -103
- package/dist/checks/bin/check-review-gate.js +284 -152
- package/dist/checks/bin/check-single-plan-pr.js +159 -40
- package/dist/checks/bin/check-surface-scope.js +164 -41
- package/dist/checks/bin/check-test-plan.js +159 -40
- package/dist/checks/bin/check-token-collection-wired.js +159 -40
- package/dist/checks/bin/check-token-report.js +159 -40
- package/dist/checks/bin/check-workspace-escape.js +664 -147
- package/dist/index.js +3932 -1118
- package/dist/lib/pre-push-cache-test-run.js +507 -72
- package/dist/lib/pre-push-select-tests.js +136 -13
- package/package.json +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/actions.ts +10 -12
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +5 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/archive-task.ts +42 -17
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/baseline-capture.ts +1 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/branch-topology-gate.ts +3 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +554 -95
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +264 -44
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/claude-code-transcript.ts +9 -9
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +211 -30
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/consumer-enumeration.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/index.ts +75 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +961 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/migration.ts +222 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/outcomes.ts +135 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +394 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-audit.ts +1 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-guard.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/derive-section7.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +514 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +110 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +30 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +219 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +97 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +240 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/diagram-model.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/direct-main-push.ts +1 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +65 -22
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +238 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-owners.ts +14 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/docs-coherence.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/legacy-anchors.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/node-route.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/surfaced-manifest.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-no-procedures.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +5 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ensure-label.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/first-push-dispatch-gate.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +14 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +425 -11
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-assignment.ts +3 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +1450 -33
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/leftover-detection.ts +1 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/local-anchor-coverage.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +119 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +75 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/redact.ts +87 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +801 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/store.ts +373 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/main-branch-refusal.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/metering-io-guard.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/milestone-validation.ts +2 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/no-disk-state.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/objectives.ts +288 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-token-report.ts +3 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-tranche.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-report-density.ts +30 -16
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-tier.ts +17 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/premise-check.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/quoted-command.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +267 -19
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +91 -24
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-scaffold.ts +6 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/report-tokens.ts +4 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +254 -110
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +384 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +208 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +80 -28
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +92 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/single-plan-pr.ts +4 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/state-machine-model.ts +40 -27
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/symbol-collisions.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-branch-identity.ts +38 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-phase-history.ts +194 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +712 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-gate.ts +7 -9
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-section.ts +5 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/types.ts +4 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +368 -56
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/waiver-label.ts +2 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/workspace-escape.ts +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/{[externals]__1agj1ww._.js → [externals]__0cki-x_._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +6 -6
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/1q96_modules_@clerk_nextjs_dist_esm_app-router_client_keyless-creator-reader_0lom2js.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0r7e54g._.js → [root-of-the-server]__07uhu5z._.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1r47dr7._.js → _08onyya._.js} +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_15gdg48._.js +5 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_@clerk_nextjs_dist_esm_app-router_server-actions_1x7vfhn.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1dc2_-c_gavj1.js → 0q9p7c6vn-x2w.js} +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3xg6-flovrcx-.js → 2174nz5he_oc4.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3xnma0-359j17.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0hstap0._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bm4nrrzwc7zi.css +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2t_rfsztmwu6y.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3ua4rm5f-a9k6.js +0 -1
- /package/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/{aeg-core → vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/aeg-core}/bin/verify-coherence.ts +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → HmoeqXdX1E4drt7GReFOO}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → HmoeqXdX1E4drt7GReFOO}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → HmoeqXdX1E4drt7GReFOO}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One-time migration from the dev-review-loop's pre-control-store side
|
|
3
|
+
* files (`apps/cli/src/lib/dev-review-loop/pause-resume.ts`'s
|
|
4
|
+
* `driver.pid.json`/`pause-state.json`, `publication.ts`'s
|
|
5
|
+
* `effect-<key>.json`) into a task's first control-store epoch.
|
|
6
|
+
*
|
|
7
|
+
* This module reads the legacy layout directly rather than importing
|
|
8
|
+
* `apps/cli` — the dependency runs the other way (the CLI depends on
|
|
9
|
+
* `@attalabs/aeg-core`, never the reverse) — so the three legacy shapes
|
|
10
|
+
* below are a deliberate, narrow re-statement of what those two files
|
|
11
|
+
* already write, not a shared implementation.
|
|
12
|
+
*
|
|
13
|
+
* Refuses rather than guesses whenever ownership would be ambiguous:
|
|
14
|
+
* a legacy driver whose pid still answers a liveness probe is still
|
|
15
|
+
* mutating those side files, so migrating underneath it would race it;
|
|
16
|
+
* a task that already holds a control-store epoch has already moved on
|
|
17
|
+
* from the legacy layout, so re-migrating it would silently overwrite
|
|
18
|
+
* real history. Both refuse rather than pick a side.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { existsSync, readdirSync, readFileSync } from 'node:fs'
|
|
22
|
+
import { join } from 'node:path'
|
|
23
|
+
import {
|
|
24
|
+
acquireOwnership,
|
|
25
|
+
appendTransition,
|
|
26
|
+
type ControlStoreDeps,
|
|
27
|
+
readCurrentOwnership,
|
|
28
|
+
writeInput,
|
|
29
|
+
writeRun
|
|
30
|
+
} from './local'
|
|
31
|
+
|
|
32
|
+
type LegacyRead<T> = { status: 'ok'; value: T } | { status: 'absent' } | { status: 'corrupt'; reason: string }
|
|
33
|
+
|
|
34
|
+
function readLegacyJson<T>(path: string, isShape: (json: unknown) => json is T): LegacyRead<T> {
|
|
35
|
+
let raw: string
|
|
36
|
+
try {
|
|
37
|
+
raw = readFileSync(path, 'utf8')
|
|
38
|
+
} catch (err) {
|
|
39
|
+
if (typeof err === 'object' && err !== null && (err as NodeJS.ErrnoException).code === 'ENOENT') {
|
|
40
|
+
return { status: 'absent' }
|
|
41
|
+
}
|
|
42
|
+
return { status: 'corrupt', reason: err instanceof Error ? err.message : String(err) }
|
|
43
|
+
}
|
|
44
|
+
let json: unknown
|
|
45
|
+
try {
|
|
46
|
+
json = JSON.parse(raw)
|
|
47
|
+
} catch (err) {
|
|
48
|
+
return { status: 'corrupt', reason: `invalid JSON: ${err instanceof Error ? err.message : String(err)}` }
|
|
49
|
+
}
|
|
50
|
+
if (!isShape(json)) return { status: 'corrupt', reason: 'does not match the expected legacy shape' }
|
|
51
|
+
return { status: 'ok', value: json }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
type LegacyDriverLock = { pid: number; startedAt: string }
|
|
55
|
+
function isLegacyDriverLock(json: unknown): json is LegacyDriverLock {
|
|
56
|
+
return (
|
|
57
|
+
typeof json === 'object' &&
|
|
58
|
+
json !== null &&
|
|
59
|
+
typeof (json as Record<string, unknown>).pid === 'number' &&
|
|
60
|
+
typeof (json as Record<string, unknown>).startedAt === 'string'
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
type LegacyPauseState = {
|
|
65
|
+
round: number
|
|
66
|
+
reason: string
|
|
67
|
+
detail?: string
|
|
68
|
+
/** `null` for a pause recorded before any pull request existed — the same shape the live pause record now writes. */
|
|
69
|
+
prNumber: number | null
|
|
70
|
+
pausedAt: string
|
|
71
|
+
}
|
|
72
|
+
function isLegacyPauseState(json: unknown): json is LegacyPauseState {
|
|
73
|
+
const rec = json as Record<string, unknown>
|
|
74
|
+
return (
|
|
75
|
+
typeof json === 'object' &&
|
|
76
|
+
json !== null &&
|
|
77
|
+
typeof rec.round === 'number' &&
|
|
78
|
+
typeof rec.reason === 'string' &&
|
|
79
|
+
// A `null` here is a real pause with no pull request, not a malformed
|
|
80
|
+
// record. Requiring a number made exactly that pause fail this guard, so
|
|
81
|
+
// the migration recorded it as `source: 'fresh'` at round `0` and appended
|
|
82
|
+
// no `paused` transition — silently losing the one pause shape that is
|
|
83
|
+
// hardest to recover by hand.
|
|
84
|
+
(typeof rec.prNumber === 'number' || rec.prNumber === null) &&
|
|
85
|
+
typeof rec.pausedAt === 'string' &&
|
|
86
|
+
(rec.detail === undefined || typeof rec.detail === 'string')
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
type LegacyEffectRecord = { effectId: string; status: 'started' | 'posted'; url?: string }
|
|
91
|
+
function isLegacyEffectRecord(json: unknown): json is LegacyEffectRecord {
|
|
92
|
+
const rec = json as Record<string, unknown>
|
|
93
|
+
return (
|
|
94
|
+
typeof json === 'object' &&
|
|
95
|
+
json !== null &&
|
|
96
|
+
typeof rec.effectId === 'string' &&
|
|
97
|
+
(rec.status === 'started' || rec.status === 'posted') &&
|
|
98
|
+
(rec.url === undefined || typeof rec.url === 'string')
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function legacyTaskDir(legacyOutboxRoot: string, task: number): string {
|
|
103
|
+
return join(legacyOutboxRoot, 'dev-review-loop', String(task))
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** The same signal-0 liveness idiom `pause-resume.ts`'s `isDriverPidAlive` uses — restated here so this module never imports across the CLI/engine boundary. Used only as a one-time migration-timing safety gate, never as this store's own ownership model (that model is the epoch fence in `local.ts`). */
|
|
107
|
+
export function defaultIsPidAlive(pid: number): boolean {
|
|
108
|
+
try {
|
|
109
|
+
process.kill(pid, 0)
|
|
110
|
+
return true
|
|
111
|
+
} catch {
|
|
112
|
+
return false
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export type MigrationResult =
|
|
117
|
+
| { status: 'migrated'; task: number; epoch: number; transitionsWritten: number }
|
|
118
|
+
| { status: 'nothing-to-migrate'; task: number }
|
|
119
|
+
| { status: 'refused'; reason: string }
|
|
120
|
+
|
|
121
|
+
export function migrateLegacyTask(
|
|
122
|
+
deps: ControlStoreDeps,
|
|
123
|
+
legacyOutboxRoot: string,
|
|
124
|
+
task: number,
|
|
125
|
+
ownerId: string,
|
|
126
|
+
isPidAlive: (pid: number) => boolean = defaultIsPidAlive
|
|
127
|
+
): MigrationResult {
|
|
128
|
+
const dir = legacyTaskDir(legacyOutboxRoot, task)
|
|
129
|
+
if (!existsSync(dir)) return { status: 'nothing-to-migrate', task }
|
|
130
|
+
|
|
131
|
+
const driverLock = readLegacyJson(join(dir, 'driver.pid.json'), isLegacyDriverLock)
|
|
132
|
+
if (driverLock.status === 'corrupt') {
|
|
133
|
+
return { status: 'refused', reason: `legacy driver.pid.json for task ${task} is corrupt: ${driverLock.reason}` }
|
|
134
|
+
}
|
|
135
|
+
if (driverLock.status === 'ok' && isPidAlive(driverLock.value.pid)) {
|
|
136
|
+
return {
|
|
137
|
+
status: 'refused',
|
|
138
|
+
reason: `legacy driver pid ${driverLock.value.pid} is still live for task ${task} — migrate only after it exits`
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const pauseState = readLegacyJson(join(dir, 'pause-state.json'), isLegacyPauseState)
|
|
143
|
+
if (pauseState.status === 'corrupt') {
|
|
144
|
+
return { status: 'refused', reason: `legacy pause-state.json for task ${task} is corrupt: ${pauseState.reason}` }
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const effectFiles = readdirSync(dir)
|
|
148
|
+
.filter((name) => /^effect-.+\.json$/.test(name))
|
|
149
|
+
.sort()
|
|
150
|
+
const effects: { key: string; record: LegacyEffectRecord }[] = []
|
|
151
|
+
for (const name of effectFiles) {
|
|
152
|
+
const parsed = readLegacyJson(join(dir, name), isLegacyEffectRecord)
|
|
153
|
+
if (parsed.status === 'corrupt') {
|
|
154
|
+
return { status: 'refused', reason: `legacy ${name} for task ${task} is corrupt: ${parsed.reason}` }
|
|
155
|
+
}
|
|
156
|
+
if (parsed.status === 'ok') {
|
|
157
|
+
effects.push({ key: name.replace(/^effect-/, '').replace(/\.json$/, ''), record: parsed.value })
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (driverLock.status === 'absent' && pauseState.status === 'absent' && effects.length === 0) {
|
|
162
|
+
return { status: 'nothing-to-migrate', task }
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const priorEpoch = readCurrentOwnership(deps, task)
|
|
166
|
+
if (priorEpoch.epoch > 0) {
|
|
167
|
+
return {
|
|
168
|
+
status: 'refused',
|
|
169
|
+
reason: `task ${task} already has a control-store epoch ${priorEpoch.epoch} — migration only runs against a task with no existing epoch`
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const acquired = acquireOwnership(deps, task, ownerId)
|
|
174
|
+
if (!acquired.acquired) {
|
|
175
|
+
return {
|
|
176
|
+
status: 'refused',
|
|
177
|
+
reason: `task ${task} already has a control-store epoch ${acquired.currentEpoch} — migration only runs against a task with no existing epoch`
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const epoch = acquired.epoch
|
|
181
|
+
|
|
182
|
+
const now = deps.now().toISOString()
|
|
183
|
+
writeRun(deps, task, epoch, {
|
|
184
|
+
runId: ownerId,
|
|
185
|
+
pid: driverLock.status === 'ok' ? driverLock.value.pid : deps.pid(),
|
|
186
|
+
host: deps.hostname(),
|
|
187
|
+
startedAt: driverLock.status === 'ok' ? driverLock.value.startedAt : now
|
|
188
|
+
})
|
|
189
|
+
writeInput(deps, task, epoch, {
|
|
190
|
+
runId: ownerId,
|
|
191
|
+
source: pauseState.status === 'ok' ? 'resume' : 'fresh',
|
|
192
|
+
// A non-positive legacy sentinel (`-1`, written before the record could
|
|
193
|
+
// say "no pull request") is normalized here the same way the live reader
|
|
194
|
+
// normalizes it, so no migrated input carries a number the forge would
|
|
195
|
+
// reject.
|
|
196
|
+
pr: pauseState.status === 'ok' && (pauseState.value.prNumber ?? 0) > 0 ? pauseState.value.prNumber : null,
|
|
197
|
+
round: pauseState.status === 'ok' ? pauseState.value.round : 0,
|
|
198
|
+
recordedAt: now
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
let transitionsWritten = 0
|
|
202
|
+
if (pauseState.status === 'ok') {
|
|
203
|
+
appendTransition(deps, task, epoch, {
|
|
204
|
+
from: 'active',
|
|
205
|
+
to: `paused:${pauseState.value.reason}`,
|
|
206
|
+
detail: pauseState.value.detail,
|
|
207
|
+
at: pauseState.value.pausedAt
|
|
208
|
+
})
|
|
209
|
+
transitionsWritten++
|
|
210
|
+
}
|
|
211
|
+
for (const { key, record } of effects) {
|
|
212
|
+
appendTransition(deps, task, epoch, {
|
|
213
|
+
from: 'pending',
|
|
214
|
+
to: `effect:${key}:${record.status}`,
|
|
215
|
+
detail: record.url,
|
|
216
|
+
at: now
|
|
217
|
+
})
|
|
218
|
+
transitionsWritten++
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return { status: 'migrated', task, epoch, transitionsWritten }
|
|
222
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The parent-validated outcome normalizer (O2). One pure function that turns
|
|
3
|
+
* the raw signals a launch leaves behind — did it time out, was it cancelled,
|
|
4
|
+
* did the capability refuse, did the infrastructure fail, are the required
|
|
5
|
+
* artifacts on disk, do the declared postconditions hold, and what exit code
|
|
6
|
+
* it returned — into ONE truthful outcome, drawn from a closed vocabulary:
|
|
7
|
+
*
|
|
8
|
+
* - `completed` — the work is genuinely done: the required
|
|
9
|
+
* artifacts exist and every declared
|
|
10
|
+
* postcondition holds.
|
|
11
|
+
* - `incomplete` — the attempt ended without the work being done:
|
|
12
|
+
* a required artifact is missing, or a
|
|
13
|
+
* postcondition is unmet. **This is the case a
|
|
14
|
+
* bare exit code hides:** a process that exits 0
|
|
15
|
+
* having produced nothing is `incomplete`, never
|
|
16
|
+
* `completed` — the whole point of this
|
|
17
|
+
* normalizer is that exit zero is never equated
|
|
18
|
+
* with task success.
|
|
19
|
+
* - `infrastructure-failed`— the launch itself failed (a crash, a spawn
|
|
20
|
+
* fault) before it could fairly attempt the work
|
|
21
|
+
* — not the task's own doing.
|
|
22
|
+
* - `timed-out` — the ceiling fired and the launch was killed.
|
|
23
|
+
* - `cancelled` — an operator or a supervisor stopped it.
|
|
24
|
+
* - `capability-refused` — the capability declined the work up front (a
|
|
25
|
+
* missing/rejected binary, a refused model) —
|
|
26
|
+
* distinct from an infrastructure fault mid-run.
|
|
27
|
+
*
|
|
28
|
+
* **Exit code is an INPUT, never the decider.** It is carried into the
|
|
29
|
+
* outcome's `reason` for the record, but the `completed`/`incomplete` split is
|
|
30
|
+
* decided ENTIRELY by `artifactsPresent`/`postconditionsMet` — a non-zero
|
|
31
|
+
* exit with the artifacts genuinely present and the postconditions met still
|
|
32
|
+
* reads `completed` (the artifacts are the truth), and a zero exit with a
|
|
33
|
+
* missing artifact still reads `incomplete`. The manner-of-death signals
|
|
34
|
+
* (`refused`/`cancelled`/`timedOut`/`infrastructure`) take precedence over
|
|
35
|
+
* the artifact read, because an attempt the ceiling killed, the operator
|
|
36
|
+
* stopped, or the infrastructure broke never got a fair chance to leave its
|
|
37
|
+
* artifacts, and misreporting it as a plain `incomplete` would blame the task
|
|
38
|
+
* for the environment's failure.
|
|
39
|
+
*
|
|
40
|
+
* Pure — no `fs`, no clock, no process access. The caller (a parent
|
|
41
|
+
* validating a launch — `apps/cli/src/lib/dispatch.ts`'s launcher, the
|
|
42
|
+
* dev-review-loop's recovery) supplies every signal; this only classifies.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/** The closed outcome vocabulary a parent-validated launch resolves to (O2). */
|
|
46
|
+
export type TaskOutcomeStatus =
|
|
47
|
+
| 'completed'
|
|
48
|
+
| 'incomplete'
|
|
49
|
+
| 'infrastructure-failed'
|
|
50
|
+
| 'timed-out'
|
|
51
|
+
| 'cancelled'
|
|
52
|
+
| 'capability-refused'
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The raw signals a launch leaves behind, as observed by the parent that
|
|
56
|
+
* validates it. `exitCode` is carried for the record only — it never decides
|
|
57
|
+
* the `completed`/`incomplete` split (see this module's own doc). The four
|
|
58
|
+
* manner-of-death booleans are mutually exhaustive with "ran to a natural
|
|
59
|
+
* end"; when more than one is somehow set, the precedence in `normalizeOutcome`
|
|
60
|
+
* decides which one names the outcome.
|
|
61
|
+
*/
|
|
62
|
+
export type OutcomeSignals = {
|
|
63
|
+
/** The process exit code, or `null` when the launch never produced one (a pre-spawn refusal, a signal death). Input only — never the decider. */
|
|
64
|
+
exitCode: number | null
|
|
65
|
+
/** The ceiling fired and the launch was killed. */
|
|
66
|
+
timedOut: boolean
|
|
67
|
+
/** An operator or supervisor stopped the launch. */
|
|
68
|
+
cancelled: boolean
|
|
69
|
+
/** The capability declined the work up front — a missing or rejected binary, a refused model — before it ever ran. */
|
|
70
|
+
refused: boolean
|
|
71
|
+
/** The launch itself failed (a crash, a spawn fault) — an environment failure, not the task's own doing. */
|
|
72
|
+
infrastructure: boolean
|
|
73
|
+
/** The required work artifacts exist — the parent's own check, never inferred from the exit code. */
|
|
74
|
+
artifactsPresent: boolean
|
|
75
|
+
/** Every declared postcondition holds — likewise the parent's own check. */
|
|
76
|
+
postconditionsMet: boolean
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export type NormalizedOutcome = {
|
|
80
|
+
status: TaskOutcomeStatus
|
|
81
|
+
/** A human-readable justification carrying the deciding facts — including the exit code, so a reader sees it was considered as input without it having decided anything. */
|
|
82
|
+
reason: string
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function exitCodeNote(exitCode: number | null): string {
|
|
86
|
+
return exitCode === null ? 'no exit code' : `exit code ${exitCode}`
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Classify one launch's raw signals into a single truthful outcome (O2). See
|
|
91
|
+
* this module's own doc for the vocabulary, the exit-code-is-input-only rule,
|
|
92
|
+
* and why the manner-of-death signals take precedence over the artifact read.
|
|
93
|
+
*/
|
|
94
|
+
export function normalizeOutcome(signals: OutcomeSignals): NormalizedOutcome {
|
|
95
|
+
const { exitCode, timedOut, cancelled, refused, infrastructure, artifactsPresent, postconditionsMet } = signals
|
|
96
|
+
|
|
97
|
+
// Manner-of-death first: an attempt that was refused, cancelled, timed out,
|
|
98
|
+
// or broke on infrastructure never got a fair chance to leave its
|
|
99
|
+
// artifacts, so its outcome is named by HOW it ended, never by an artifact
|
|
100
|
+
// read that was never going to succeed. Order among them is deliberate:
|
|
101
|
+
// a refusal happens before anything runs; a cancellation and a timeout are
|
|
102
|
+
// both external stops (cancellation is the operator's intent, checked first
|
|
103
|
+
// so a cancel that also tripped the ceiling still reads as the deliberate
|
|
104
|
+
// stop); an infrastructure fault is the catch-all launch failure.
|
|
105
|
+
if (refused) {
|
|
106
|
+
return { status: 'capability-refused', reason: `the capability refused the launch (${exitCodeNote(exitCode)})` }
|
|
107
|
+
}
|
|
108
|
+
if (cancelled) {
|
|
109
|
+
return { status: 'cancelled', reason: `the launch was cancelled (${exitCodeNote(exitCode)})` }
|
|
110
|
+
}
|
|
111
|
+
if (timedOut) {
|
|
112
|
+
return { status: 'timed-out', reason: `the launch exceeded its ceiling and was killed (${exitCodeNote(exitCode)})` }
|
|
113
|
+
}
|
|
114
|
+
if (infrastructure) {
|
|
115
|
+
return {
|
|
116
|
+
status: 'infrastructure-failed',
|
|
117
|
+
reason: `the launch failed on infrastructure, not the task itself (${exitCodeNote(exitCode)})`
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Ran to a natural end. The artifacts and postconditions are the truth —
|
|
122
|
+
// NOT the exit code, which is only reported here, never consulted for the
|
|
123
|
+
// decision. This is where exit-zero-with-no-artifact becomes `incomplete`.
|
|
124
|
+
if (artifactsPresent && postconditionsMet) {
|
|
125
|
+
return {
|
|
126
|
+
status: 'completed',
|
|
127
|
+
reason: `required artifacts present and postconditions met (${exitCodeNote(exitCode)} treated as input only)`
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const missing = !artifactsPresent ? 'a required artifact is missing' : 'a declared postcondition is unmet'
|
|
131
|
+
return {
|
|
132
|
+
status: 'incomplete',
|
|
133
|
+
reason: `${missing} — ${exitCodeNote(exitCode)} does not by itself prove the work is done`
|
|
134
|
+
}
|
|
135
|
+
}
|