@attalabs/vinaya 0.31.0 → 0.33.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 +2 -3
- package/aeg-root/contracts/principal-operator.md +18 -5
- package/aeg-root/roles/developer/reference.md +3 -3
- package/aeg-root/roles/operator.md +69 -16
- package/aeg-root/roles/planner/reference.md +1 -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/pr-report-template.md +7 -2
- package/dist/checks/bin/check-body-bare-digits.js +340 -101
- package/dist/checks/bin/check-branch-topology.js +184 -105
- package/dist/checks/bin/check-brief-shape.js +333 -94
- package/dist/checks/bin/check-changeset-coverage.js +1028 -248
- package/dist/checks/bin/check-ci-shard-coverage.js +82 -0
- package/dist/checks/bin/check-closes-n.js +184 -105
- package/dist/checks/bin/check-coherence.js +345 -145
- package/dist/checks/bin/check-dead-branch-push.js +179 -59
- package/dist/checks/bin/check-dispatch-readiness.js +350 -150
- package/dist/checks/bin/check-doc-coverage-push.js +1011 -231
- package/dist/checks/bin/check-doc-coverage.js +1015 -235
- package/dist/checks/bin/check-doctrine-no-procedures.js +333 -94
- package/dist/checks/bin/check-doctrine-portability.js +1013 -233
- package/dist/checks/bin/check-evidence-fresh.js +1010 -222
- package/dist/checks/bin/check-exec-bits.js +1009 -229
- package/dist/checks/bin/check-first-push-dispatch.js +343 -145
- package/dist/checks/bin/check-issue-assignment.js +186 -107
- package/dist/checks/bin/check-issue-milestone-attach.js +176 -56
- package/dist/checks/bin/check-issue-objectives-numbering.js +176 -56
- package/dist/checks/bin/check-issue-parts-coverage.js +176 -56
- package/dist/checks/bin/check-issue-surface-globs.js +363 -143
- package/dist/checks/bin/check-issue-title-grammar.js +176 -56
- package/dist/checks/bin/check-issue-tranche-label.js +176 -56
- package/dist/checks/bin/check-main-branch-refusal.js +176 -56
- package/dist/checks/bin/check-no-disk-state.js +176 -56
- package/dist/checks/bin/check-pr-premise-reassert.js +333 -92
- package/dist/checks/bin/check-pr-report-density.js +176 -56
- package/dist/checks/bin/check-principal-test-plan-wait.js +176 -54
- package/dist/checks/bin/check-quoted-command.js +999 -217
- package/dist/checks/bin/check-reader-resolvable-prose.js +1011 -229
- package/dist/checks/bin/check-registry-gates.js +186 -56
- package/dist/checks/bin/check-retired-vocabulary.js +997 -215
- package/dist/checks/bin/check-review-gate.js +403 -203
- package/dist/checks/bin/check-single-plan-pr.js +176 -56
- package/dist/checks/bin/check-surface-scope.js +184 -105
- package/dist/checks/bin/check-test-plan.js +176 -54
- package/dist/checks/bin/check-token-collection-wired.js +182 -57
- package/dist/checks/bin/check-token-report.js +178 -58
- package/dist/checks/bin/check-workspace-escape.js +1011 -229
- package/dist/index.js +5971 -3489
- package/dist/lib/pre-push-cache-test-run.js +4431 -0
- package/dist/lib/pre-push-select-tests.js +799 -110
- package/package.json +3 -2
- 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 +212 -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 +27 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +123 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +27 -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 +379 -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 +239 -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 +184 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +65 -18
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +76 -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-tools.ts +488 -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 +314 -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]__0ls23oh._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0r7e54g._.js → [root-of-the-server]__18paley._.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/{1dc2_-c_gavj1.js → 1ce2dj27_cgbj.js} +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3xg6-flovrcx-.js → 22s44f5k3ecmj.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/34hhdtbp20krb.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/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/aeg-core}/bin/verify-coherence.ts +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_ssgManifest.js +0 -0
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
4
2
|
|
|
5
3
|
// src/checks/bin/check-reader-resolvable-prose.ts
|
|
6
|
-
import { existsSync as
|
|
7
|
-
import { extname, join as
|
|
4
|
+
import { existsSync as existsSync8, readdirSync as readdirSync3, readFileSync as readFileSync7, statSync as statSync2 } from "node:fs";
|
|
5
|
+
import { extname, join as join10 } from "node:path";
|
|
8
6
|
// ../../packages/aeg-core/src/gate-audience.ts
|
|
9
7
|
var GATE_AUDIENCE = {
|
|
10
8
|
"check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
|
|
@@ -1038,7 +1036,7 @@ function withDefaults(oldDefaults, newDefaults) {
|
|
|
1038
1036
|
var endpoint = withDefaults(null, DEFAULTS);
|
|
1039
1037
|
|
|
1040
1038
|
// ../../node_modules/fast-content-type-parse/index.js
|
|
1041
|
-
var NullObject = function
|
|
1039
|
+
var NullObject = function NullObject() {};
|
|
1042
1040
|
NullObject.prototype = Object.create(null);
|
|
1043
1041
|
var paramRE = /; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu;
|
|
1044
1042
|
var quotedPairRE = /\\([\v\u0020-\u00ff])/gu;
|
|
@@ -1132,8 +1130,8 @@ function isPlainObject2(value) {
|
|
|
1132
1130
|
return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
|
|
1133
1131
|
}
|
|
1134
1132
|
async function fetchWrapper(requestOptions) {
|
|
1135
|
-
const
|
|
1136
|
-
if (!
|
|
1133
|
+
const fetch2 = requestOptions.request?.fetch || globalThis.fetch;
|
|
1134
|
+
if (!fetch2) {
|
|
1137
1135
|
throw new Error("fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing");
|
|
1138
1136
|
}
|
|
1139
1137
|
const log = requestOptions.request?.log || console;
|
|
@@ -1145,7 +1143,7 @@ async function fetchWrapper(requestOptions) {
|
|
|
1145
1143
|
]));
|
|
1146
1144
|
let fetchResponse;
|
|
1147
1145
|
try {
|
|
1148
|
-
fetchResponse = await
|
|
1146
|
+
fetchResponse = await fetch2(requestOptions.url, {
|
|
1149
1147
|
method: requestOptions.method,
|
|
1150
1148
|
body,
|
|
1151
1149
|
redirect: requestOptions.request?.redirect,
|
|
@@ -1782,27 +1780,27 @@ function splitTableRow(row) {
|
|
|
1782
1780
|
return parts.map((p) => p.split(PLACEHOLDER).join("|"));
|
|
1783
1781
|
}
|
|
1784
1782
|
// ../../packages/aeg-core/src/blast-radius-domains.ts
|
|
1785
|
-
function resolveWorkspaceEntry(
|
|
1786
|
-
if (
|
|
1787
|
-
const baseDir =
|
|
1783
|
+
function resolveWorkspaceEntry(entry, listDirs) {
|
|
1784
|
+
if (entry.endsWith("/*")) {
|
|
1785
|
+
const baseDir = entry.slice(0, -2);
|
|
1788
1786
|
return listDirs(baseDir).map((name) => `${baseDir}/${name}`);
|
|
1789
1787
|
}
|
|
1790
|
-
if (
|
|
1788
|
+
if (entry.includes("*"))
|
|
1791
1789
|
return [];
|
|
1792
|
-
return [
|
|
1790
|
+
return [entry];
|
|
1793
1791
|
}
|
|
1794
1792
|
// ../../packages/aeg-core/src/consumer-enumeration.ts
|
|
1795
1793
|
function deriveWorkspaceMemberDirs(workspaces, listDirs) {
|
|
1796
|
-
const positive = workspaces.filter((
|
|
1797
|
-
const negative = workspaces.filter((
|
|
1794
|
+
const positive = workspaces.filter((entry) => !entry.startsWith("!"));
|
|
1795
|
+
const negative = workspaces.filter((entry) => entry.startsWith("!")).map((entry) => entry.slice(1));
|
|
1798
1796
|
const excluded = new Set;
|
|
1799
|
-
for (const
|
|
1800
|
-
for (const member of resolveWorkspaceEntry(
|
|
1797
|
+
for (const entry of negative) {
|
|
1798
|
+
for (const member of resolveWorkspaceEntry(entry, listDirs))
|
|
1801
1799
|
excluded.add(member);
|
|
1802
1800
|
}
|
|
1803
1801
|
const members = new Set;
|
|
1804
|
-
for (const
|
|
1805
|
-
for (const member of resolveWorkspaceEntry(
|
|
1802
|
+
for (const entry of positive) {
|
|
1803
|
+
for (const member of resolveWorkspaceEntry(entry, listDirs)) {
|
|
1806
1804
|
if (!excluded.has(member))
|
|
1807
1805
|
members.add(member);
|
|
1808
1806
|
}
|
|
@@ -2048,12 +2046,24 @@ function extractBaseSha(comment) {
|
|
|
2048
2046
|
const m = firstThirteenLines(comment).match(BASE_SHA_PATTERN);
|
|
2049
2047
|
return m ? m[1].toLowerCase() : null;
|
|
2050
2048
|
}
|
|
2051
|
-
var
|
|
2049
|
+
var FINDING_DESCRIPTION_STATE = /^F(\d+)(?:\s+\S+)?(?:\s+(open|fix-claimed|reproduced|resolved))?:/;
|
|
2050
|
+
function parseFindingState(description) {
|
|
2051
|
+
const m = FINDING_DESCRIPTION_STATE.exec(description.trim());
|
|
2052
|
+
if (!m)
|
|
2053
|
+
return { id: null, state: null };
|
|
2054
|
+
return { id: `F${m[1]}`, state: m[2] ?? null };
|
|
2055
|
+
}
|
|
2056
|
+
var FINDING_SEVERITY_LINE = /^\d+\.\s+\[([A-Z][A-Z]*)\]\s+(.+?)\s+—(?:\s+(.*))?$/gm;
|
|
2052
2057
|
function extractFindingSeverities(comment) {
|
|
2053
|
-
return [...comment.matchAll(FINDING_SEVERITY_LINE)].map((m) =>
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2058
|
+
return [...comment.matchAll(FINDING_SEVERITY_LINE)].map((m) => {
|
|
2059
|
+
const { id, state } = parseFindingState(m[3] ?? "");
|
|
2060
|
+
return {
|
|
2061
|
+
severity: m[1],
|
|
2062
|
+
location: m[2],
|
|
2063
|
+
id,
|
|
2064
|
+
state
|
|
2065
|
+
};
|
|
2066
|
+
});
|
|
2057
2067
|
}
|
|
2058
2068
|
function extractVerdict(comments, valuePattern, missingLabel) {
|
|
2059
2069
|
const candidates = comments.filter((c) => valuePattern.test(c));
|
|
@@ -2126,15 +2136,15 @@ function summarizeTranscript(jsonl) {
|
|
|
2126
2136
|
const line = rawLine.trim();
|
|
2127
2137
|
if (!line)
|
|
2128
2138
|
continue;
|
|
2129
|
-
let
|
|
2139
|
+
let entry;
|
|
2130
2140
|
try {
|
|
2131
|
-
|
|
2141
|
+
entry = JSON.parse(line);
|
|
2132
2142
|
} catch {
|
|
2133
2143
|
continue;
|
|
2134
2144
|
}
|
|
2135
|
-
if (!
|
|
2145
|
+
if (!entry || typeof entry !== "object")
|
|
2136
2146
|
continue;
|
|
2137
|
-
const obj =
|
|
2147
|
+
const obj = entry;
|
|
2138
2148
|
if (obj.type !== "assistant")
|
|
2139
2149
|
continue;
|
|
2140
2150
|
const message = obj.message;
|
|
@@ -2467,6 +2477,12 @@ function evaluateReviewFindings(findings, scale, threshold) {
|
|
|
2467
2477
|
});
|
|
2468
2478
|
return { outcome: blockingFindings.length > 0 ? "blocked" : "clean", blockingFindings };
|
|
2469
2479
|
}
|
|
2480
|
+
function isConsequentialFinding(finding) {
|
|
2481
|
+
return finding.state !== "resolved";
|
|
2482
|
+
}
|
|
2483
|
+
function consequentialFindings(findings) {
|
|
2484
|
+
return findings.filter((f) => isConsequentialFinding(f));
|
|
2485
|
+
}
|
|
2470
2486
|
function evaluateCodeReview(findings, policy) {
|
|
2471
2487
|
return evaluateReviewFindings(findings, CODE_REVIEW_SEVERITY_ORDER, policy.codeReviewThreshold);
|
|
2472
2488
|
}
|
|
@@ -2982,7 +2998,7 @@ function isStep0Block(content) {
|
|
|
2982
2998
|
}
|
|
2983
2999
|
function checkCommandsCarryOutput(prBody) {
|
|
2984
3000
|
const errors = [];
|
|
2985
|
-
for (const [
|
|
3001
|
+
for (const [label, num] of [
|
|
2986
3002
|
["5", 5],
|
|
2987
3003
|
["6", 6]
|
|
2988
3004
|
]) {
|
|
@@ -2996,7 +3012,7 @@ function checkCommandsCarryOutput(prBody) {
|
|
|
2996
3012
|
continue;
|
|
2997
3013
|
const next = blocks[i + 1];
|
|
2998
3014
|
if (!next || isCommandBlock(next.content)) {
|
|
2999
|
-
errors.push(`brief-validation commands carry output: §${
|
|
3015
|
+
errors.push(`brief-validation commands carry output: §${label} has a command block ("${firstNonBlankLine(block.content)}") not immediately followed by a non-command output block — the very next fenced block must hold that command's actual output, not another command.`);
|
|
3000
3016
|
}
|
|
3001
3017
|
}
|
|
3002
3018
|
}
|
|
@@ -3433,8 +3449,8 @@ function stripPartBackticks(text) {
|
|
|
3433
3449
|
function partWordCount(text) {
|
|
3434
3450
|
return text.split(/\s+/).filter((w) => /[a-z]/i.test(w)).length;
|
|
3435
3451
|
}
|
|
3436
|
-
function looksLikeFilePath(
|
|
3437
|
-
const stripped =
|
|
3452
|
+
function looksLikeFilePath(entry) {
|
|
3453
|
+
const stripped = entry.replace(/\/\*\*?$/, "");
|
|
3438
3454
|
const lastSegment = stripped.split("/").pop() ?? stripped;
|
|
3439
3455
|
const extMatch = /\.[A-Za-z0-9]{1,6}$/.exec(lastSegment);
|
|
3440
3456
|
return extMatch !== null && extMatch.index > 0;
|
|
@@ -3920,14 +3936,14 @@ function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
|
|
|
3920
3936
|
const referenced = extractClosesReferences(prBody);
|
|
3921
3937
|
if (taskIssueRefs) {
|
|
3922
3938
|
for (const n of referenced) {
|
|
3923
|
-
const
|
|
3924
|
-
if (!
|
|
3939
|
+
const ref = taskIssueRefs.get(n);
|
|
3940
|
+
if (!ref)
|
|
3925
3941
|
continue;
|
|
3926
|
-
const expectedBranch = `task/${
|
|
3942
|
+
const expectedBranch = `task/${ref.trancheSlug}/${ref.taskId}`;
|
|
3927
3943
|
if (branch !== expectedBranch) {
|
|
3928
3944
|
return {
|
|
3929
3945
|
ok: false,
|
|
3930
|
-
message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${
|
|
3946
|
+
message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${ref.taskId} of tranche "${ref.trancheSlug}") but is not named "${expectedBranch}" — rename the branch and re-push, or if this work is intentionally outside AEG's dispatch flow, remove the Closes reference.`
|
|
3931
3947
|
};
|
|
3932
3948
|
}
|
|
3933
3949
|
}
|
|
@@ -3936,15 +3952,15 @@ function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
|
|
|
3936
3952
|
if (!ref)
|
|
3937
3953
|
return { ok: true };
|
|
3938
3954
|
if (ref.kind === "issue") {
|
|
3939
|
-
const
|
|
3940
|
-
if (!referenced.has(
|
|
3955
|
+
const expectedIssue = ref.issueNumber;
|
|
3956
|
+
if (!referenced.has(expectedIssue)) {
|
|
3941
3957
|
return {
|
|
3942
3958
|
ok: false,
|
|
3943
|
-
expectedIssue
|
|
3944
|
-
message: `closes-n: PR body does not contain \`Closes #${
|
|
3959
|
+
expectedIssue,
|
|
3960
|
+
message: `closes-n: PR body does not contain \`Closes #${expectedIssue}\` (required for branch "${branch}"). Add it to the PR body Summary section.`
|
|
3945
3961
|
};
|
|
3946
3962
|
}
|
|
3947
|
-
return { ok: true, expectedIssue
|
|
3963
|
+
return { ok: true, expectedIssue };
|
|
3948
3964
|
}
|
|
3949
3965
|
const trancheSlug = ref.tranche;
|
|
3950
3966
|
const taskId = ref.taskId;
|
|
@@ -3990,8 +4006,8 @@ function extractIssue(body) {
|
|
|
3990
4006
|
const anchorNums = closesRefs(anchored);
|
|
3991
4007
|
if (anchorNums.length === 0)
|
|
3992
4008
|
return { issue: null, extraIssues: bodyNums, outsideHeader: false };
|
|
3993
|
-
const
|
|
3994
|
-
return { issue
|
|
4009
|
+
const issue = anchorNums[0];
|
|
4010
|
+
return { issue, extraIssues: bodyNums.filter((n) => n !== issue), outsideHeader: false };
|
|
3995
4011
|
}
|
|
3996
4012
|
const headerNums = closesRefs(headerRegion(stripped));
|
|
3997
4013
|
if (bodyNums.length === 0)
|
|
@@ -4060,15 +4076,15 @@ function compareManifest(echoed, current, patchIdOf) {
|
|
|
4060
4076
|
const bothFullShas = echoedShaLen >= 40 && currentShaLen >= 40;
|
|
4061
4077
|
const base = patchHead || exactHead && bothFullShas ? true : isBoundToBase(echoed, current.baseSha);
|
|
4062
4078
|
const briefHashBound = isBoundToBriefHash(echoed, current.briefHash);
|
|
4063
|
-
const
|
|
4079
|
+
const objectivesVersion = isBoundToObjectives(echoed, current.objectivesVersion);
|
|
4064
4080
|
const rulingOrdinal = isBoundToRulings(echoed, current.rulingOrdinal);
|
|
4065
4081
|
const policyDigestBound = isBoundToPolicy(echoed, current.policyDigest);
|
|
4066
4082
|
return {
|
|
4067
|
-
bound: head && base && briefHashBound &&
|
|
4083
|
+
bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && policyDigestBound,
|
|
4068
4084
|
head,
|
|
4069
4085
|
base,
|
|
4070
4086
|
briefHash: briefHashBound,
|
|
4071
|
-
objectivesVersion
|
|
4087
|
+
objectivesVersion,
|
|
4072
4088
|
rulingOrdinal,
|
|
4073
4089
|
policyDigest: policyDigestBound
|
|
4074
4090
|
};
|
|
@@ -4099,8 +4115,8 @@ function checkReviewGate(input) {
|
|
|
4099
4115
|
let codeReviewPolicyEvaluation;
|
|
4100
4116
|
let securityPolicyEvaluation;
|
|
4101
4117
|
try {
|
|
4102
|
-
codeReviewPolicyEvaluation = evaluateCodeReview(codeReview.findingSeverities, policy);
|
|
4103
|
-
securityPolicyEvaluation = evaluateSecurityReview(security.findingSeverities, policy);
|
|
4118
|
+
codeReviewPolicyEvaluation = evaluateCodeReview(consequentialFindings(codeReview.findingSeverities), policy);
|
|
4119
|
+
securityPolicyEvaluation = evaluateSecurityReview(consequentialFindings(security.findingSeverities), policy);
|
|
4104
4120
|
} catch (err) {
|
|
4105
4121
|
return {
|
|
4106
4122
|
verdict: "fail",
|
|
@@ -5181,11 +5197,27 @@ var ObservedSchema = z.object({
|
|
|
5181
5197
|
var TaskStatusInputSchema = z.object({
|
|
5182
5198
|
task: TaskToolRefSchema.optional()
|
|
5183
5199
|
}).merge(PageRequestSchema).strict();
|
|
5200
|
+
var TaskConfidenceSchema = z.object({
|
|
5201
|
+
round: z.number().int().positive(),
|
|
5202
|
+
percent: z.number().int().min(0).max(100).nullable(),
|
|
5203
|
+
source: z.enum(["stated", "published-summary"])
|
|
5204
|
+
}).strict();
|
|
5205
|
+
var TaskPhaseHistorySchema = z.object({
|
|
5206
|
+
typicalPhaseMinutes: z.number().nonnegative(),
|
|
5207
|
+
typicalPhaseSamples: z.number().int().positive()
|
|
5208
|
+
}).strict();
|
|
5184
5209
|
var TaskStatusItemSchema = z.object({
|
|
5185
5210
|
task: TaskToolRefSchema,
|
|
5186
5211
|
issue: z.number().int().positive(),
|
|
5187
5212
|
pr: z.number().int().positive().nullable(),
|
|
5188
|
-
state: z.string()
|
|
5213
|
+
state: z.string(),
|
|
5214
|
+
round: z.number().int().positive().nullable().optional(),
|
|
5215
|
+
phase: z.string().min(1).nullable().optional(),
|
|
5216
|
+
minutesInPhase: z.number().nonnegative().nullable().optional(),
|
|
5217
|
+
phaseIsCurrent: z.boolean().nullable().optional(),
|
|
5218
|
+
lastConfidence: TaskConfidenceSchema.nullable().optional(),
|
|
5219
|
+
lastConfidenceUnread: z.boolean().optional(),
|
|
5220
|
+
phaseHistory: TaskPhaseHistorySchema.nullable().optional()
|
|
5189
5221
|
}).merge(ObservedSchema);
|
|
5190
5222
|
var TaskStatusResultSchema = z.object({
|
|
5191
5223
|
items: z.array(TaskStatusItemSchema),
|
|
@@ -5197,7 +5229,7 @@ var EscalationInputsSchema = z.object({
|
|
|
5197
5229
|
round: z.number().int().nonnegative(),
|
|
5198
5230
|
head: z.string(),
|
|
5199
5231
|
branch: z.string(),
|
|
5200
|
-
prNumber: z.number().int().positive()
|
|
5232
|
+
prNumber: z.number().int().positive().nullable()
|
|
5201
5233
|
});
|
|
5202
5234
|
var EscalationEvidenceSchema = z.object({
|
|
5203
5235
|
round: z.number().int().nonnegative(),
|
|
@@ -5233,13 +5265,45 @@ var TaskEscalationReadResultSchema = z.object({
|
|
|
5233
5265
|
items: z.array(TaskEscalationPacketSchema),
|
|
5234
5266
|
nextCursor: z.string().nullable()
|
|
5235
5267
|
}).merge(ObservedSchema);
|
|
5236
|
-
var
|
|
5237
|
-
|
|
5238
|
-
|
|
5268
|
+
var TaskPrCheckSchema = z.object({
|
|
5269
|
+
name: z.string(),
|
|
5270
|
+
required: z.boolean(),
|
|
5271
|
+
status: z.string(),
|
|
5272
|
+
conclusion: z.string().nullable(),
|
|
5273
|
+
detailsUrl: z.string().nullable(),
|
|
5274
|
+
failureSummary: z.string().nullable()
|
|
5275
|
+
});
|
|
5276
|
+
var TaskPrVerdictSchema = z.object({
|
|
5277
|
+
role: z.enum(["code-review", "security"]),
|
|
5278
|
+
value: z.string(),
|
|
5279
|
+
judgedHead: z.string().nullable(),
|
|
5280
|
+
objectivesVersion: z.string().nullable()
|
|
5281
|
+
});
|
|
5282
|
+
var TaskPrPauseSchema = z.object({
|
|
5283
|
+
reason: z.string(),
|
|
5284
|
+
body: z.string()
|
|
5285
|
+
});
|
|
5286
|
+
var TaskPrReviewRecordSchema = z.object({
|
|
5287
|
+
verdicts: z.array(TaskPrVerdictSchema),
|
|
5288
|
+
roundMarkers: z.array(z.number().int().nonnegative()),
|
|
5289
|
+
summaryTable: z.string().nullable(),
|
|
5290
|
+
pause: TaskPrPauseSchema.nullable()
|
|
5291
|
+
});
|
|
5292
|
+
var TaskPrReadInputSchema = z.object({
|
|
5293
|
+
task: TaskToolRefSchema,
|
|
5294
|
+
pr: z.number().int().positive().optional()
|
|
5239
5295
|
}).strict();
|
|
5296
|
+
var TaskPrReadResultSchema = z.object({
|
|
5297
|
+
task: TaskToolRefSchema,
|
|
5298
|
+
issue: z.number().int().positive(),
|
|
5299
|
+
pr: z.number().int().positive(),
|
|
5300
|
+
head: z.string().nullable(),
|
|
5301
|
+
checks: z.array(TaskPrCheckSchema),
|
|
5302
|
+
review: TaskPrReviewRecordSchema
|
|
5303
|
+
}).merge(ObservedSchema);
|
|
5240
5304
|
var TaskStartResultSchema = z.object({
|
|
5241
5305
|
requestId: z.string().min(1),
|
|
5242
|
-
run:
|
|
5306
|
+
run: TaskToolRefSchema,
|
|
5243
5307
|
started: z.boolean(),
|
|
5244
5308
|
startedAt: z.string(),
|
|
5245
5309
|
mode: z.literal("attended")
|
|
@@ -5253,7 +5317,7 @@ var TaskCancelInputSchema = z.object({
|
|
|
5253
5317
|
}).strict();
|
|
5254
5318
|
var TaskResumeResultSchema = z.object({
|
|
5255
5319
|
task: z.number().int().positive(),
|
|
5256
|
-
pr: z.number().int().positive(),
|
|
5320
|
+
pr: z.number().int().positive().nullable(),
|
|
5257
5321
|
escalationId: z.string().min(1),
|
|
5258
5322
|
outcome: z.enum(["started", "already_resumed"]),
|
|
5259
5323
|
authenticatedBy: z.string().min(1),
|
|
@@ -5262,7 +5326,7 @@ var TaskResumeResultSchema = z.object({
|
|
|
5262
5326
|
var TaskCancelOutcomeSchema = z.enum(["confirmed", "pending", "uncertain"]);
|
|
5263
5327
|
var TaskCancelResultSchema = z.object({
|
|
5264
5328
|
task: z.number().int().positive(),
|
|
5265
|
-
pr: z.number().int().positive(),
|
|
5329
|
+
pr: z.number().int().positive().nullable(),
|
|
5266
5330
|
escalationId: z.string().min(1),
|
|
5267
5331
|
outcome: TaskCancelOutcomeSchema,
|
|
5268
5332
|
authenticatedBy: z.string().min(1),
|
|
@@ -5273,6 +5337,7 @@ var TASK_TOOL_NAMES = [
|
|
|
5273
5337
|
"task_start",
|
|
5274
5338
|
"task_status",
|
|
5275
5339
|
"task_escalation_read",
|
|
5340
|
+
"task_pr_read",
|
|
5276
5341
|
"task_resume",
|
|
5277
5342
|
"task_cancel"
|
|
5278
5343
|
];
|
|
@@ -5500,6 +5565,10 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
|
|
|
5500
5565
|
}
|
|
5501
5566
|
return findings;
|
|
5502
5567
|
}
|
|
5568
|
+
// ../../packages/aeg-core/src/dev-review-loop/types.ts
|
|
5569
|
+
var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
|
|
5570
|
+
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
5571
|
+
var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
|
|
5503
5572
|
// ../../packages/aeg-core/src/log/envelope.ts
|
|
5504
5573
|
import { createHash as createHash5 } from "node:crypto";
|
|
5505
5574
|
|
|
@@ -6038,6 +6107,7 @@ function redact(value, home) {
|
|
|
6038
6107
|
return value;
|
|
6039
6108
|
}
|
|
6040
6109
|
// ../../packages/aeg-core/src/log/store.ts
|
|
6110
|
+
var KNOWN_SCHEMA_VERSIONS = [1, 2];
|
|
6041
6111
|
function metaOf(obj) {
|
|
6042
6112
|
if (obj === null || typeof obj !== "object")
|
|
6043
6113
|
return null;
|
|
@@ -6060,11 +6130,61 @@ function recordIdentity(obj) {
|
|
|
6060
6130
|
}
|
|
6061
6131
|
return null;
|
|
6062
6132
|
}
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6133
|
+
function schemaVersionOf(obj) {
|
|
6134
|
+
const meta = metaOf(obj);
|
|
6135
|
+
const schema = meta?.schema;
|
|
6136
|
+
return typeof schema === "number" ? schema : null;
|
|
6137
|
+
}
|
|
6138
|
+
function isKnownSchema(version) {
|
|
6139
|
+
return version !== null && KNOWN_SCHEMA_VERSIONS.includes(version);
|
|
6140
|
+
}
|
|
6141
|
+
function classifyStoredLine(raw, home) {
|
|
6142
|
+
let obj;
|
|
6143
|
+
try {
|
|
6144
|
+
obj = JSON.parse(raw);
|
|
6145
|
+
} catch {
|
|
6146
|
+
return { status: "invalid", identity: null, raw, reason: "not valid JSON" };
|
|
6147
|
+
}
|
|
6148
|
+
const version = schemaVersionOf(obj);
|
|
6149
|
+
if (version === null) {
|
|
6150
|
+
return { status: "invalid", identity: recordIdentity(obj), raw, reason: "no readable meta.schema" };
|
|
6151
|
+
}
|
|
6152
|
+
if (!isKnownSchema(version)) {
|
|
6153
|
+
return {
|
|
6154
|
+
status: "unknown_version",
|
|
6155
|
+
identity: recordIdentity(obj),
|
|
6156
|
+
schema: version,
|
|
6157
|
+
raw,
|
|
6158
|
+
reason: `schema version ${version} is not one this build validates (${KNOWN_SCHEMA_VERSIONS.join(", ")}) — kept for diagnosis`
|
|
6159
|
+
};
|
|
6160
|
+
}
|
|
6161
|
+
const result = LogEventSchema.safeParse(obj);
|
|
6162
|
+
if (!result.success) {
|
|
6163
|
+
return {
|
|
6164
|
+
status: "invalid",
|
|
6165
|
+
identity: recordIdentity(obj),
|
|
6166
|
+
raw,
|
|
6167
|
+
reason: result.error.issues[0]?.message ?? "schema violation"
|
|
6168
|
+
};
|
|
6169
|
+
}
|
|
6170
|
+
const event = result.data;
|
|
6171
|
+
const identity = recordIdentity(event);
|
|
6172
|
+
if (identity === null) {
|
|
6173
|
+
return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
|
|
6174
|
+
}
|
|
6175
|
+
const redacted = redact(event, home);
|
|
6176
|
+
const provenance = version === 2 ? event.meta.provenance ?? null : null;
|
|
6177
|
+
return {
|
|
6178
|
+
status: "ok",
|
|
6179
|
+
identity,
|
|
6180
|
+
runId: event.meta.run_id,
|
|
6181
|
+
seq: event.meta.seq,
|
|
6182
|
+
schema: version,
|
|
6183
|
+
provenance,
|
|
6184
|
+
event,
|
|
6185
|
+
postLine: JSON.stringify(redacted)
|
|
6186
|
+
};
|
|
6187
|
+
}
|
|
6068
6188
|
// ../../packages/aeg-core/src/control-store/records.ts
|
|
6069
6189
|
import { z as z3 } from "zod";
|
|
6070
6190
|
var isoTimestamp = z3.string().min(1);
|
|
@@ -6248,7 +6368,8 @@ function hasDoctrineEntry(root) {
|
|
|
6248
6368
|
}
|
|
6249
6369
|
|
|
6250
6370
|
// src/lib/config.ts
|
|
6251
|
-
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
6371
|
+
import { execFile as execFile4, execFileSync as execFileSync3 } from "node:child_process";
|
|
6372
|
+
import { promisify as promisify4 } from "node:util";
|
|
6252
6373
|
import { existsSync as existsSync3, mkdirSync, readFileSync as readFileSync3, realpathSync, writeFileSync } from "node:fs";
|
|
6253
6374
|
import { homedir } from "node:os";
|
|
6254
6375
|
import { dirname as dirname3, isAbsolute, join as join3, resolve } from "node:path";
|
|
@@ -6275,10 +6396,10 @@ var CheckEntrySchema = z4.object({
|
|
|
6275
6396
|
ownWorkflow: z4.boolean().optional(),
|
|
6276
6397
|
principalOwed: z4.literal(true).optional(),
|
|
6277
6398
|
validates: z4.enum(["body", "issue"]).optional()
|
|
6278
|
-
}).superRefine((
|
|
6279
|
-
if (!
|
|
6399
|
+
}).superRefine((entry, ctx) => {
|
|
6400
|
+
if (!entry.env)
|
|
6280
6401
|
return;
|
|
6281
|
-
for (const [key, value] of Object.entries(
|
|
6402
|
+
for (const [key, value] of Object.entries(entry.env)) {
|
|
6282
6403
|
if (typeof value !== "object" || value === null || !("anyOf" in value))
|
|
6283
6404
|
continue;
|
|
6284
6405
|
const members = value.anyOf;
|
|
@@ -6435,18 +6556,19 @@ var VinayaConfigSchema = z4.object({
|
|
|
6435
6556
|
});
|
|
6436
6557
|
}
|
|
6437
6558
|
}).optional(),
|
|
6438
|
-
logPublish: z4.
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
}).refine((v) => v.
|
|
6447
|
-
message: "
|
|
6448
|
-
}).
|
|
6449
|
-
|
|
6559
|
+
logPublish: z4.unknown().refine((v) => v === undefined, {
|
|
6560
|
+
message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
|
|
6561
|
+
}),
|
|
6562
|
+
runtimeDir: z4.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
|
|
6563
|
+
logs: z4.object({
|
|
6564
|
+
folder: z4.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
|
|
6565
|
+
url: z4.string().url().optional(),
|
|
6566
|
+
headers: z4.record(z4.string()).optional()
|
|
6567
|
+
}).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
|
|
6568
|
+
message: "logs: set at most one of folder/url"
|
|
6569
|
+
}).refine((v) => v.headers === undefined || v.url !== undefined, {
|
|
6570
|
+
message: "logs: headers requires url"
|
|
6571
|
+
}).optional()
|
|
6450
6572
|
});
|
|
6451
6573
|
var GLOBAL_VINAYA_HOME = join3(homedir(), ".vinaya");
|
|
6452
6574
|
var GLOBAL_CONFIG_PATH = join3(GLOBAL_VINAYA_HOME, "config.json");
|
|
@@ -6491,32 +6613,39 @@ function globalTokensCollectIgnoredWarning(path) {
|
|
|
6491
6613
|
function globalRuntimeDirIgnoredWarning(path) {
|
|
6492
6614
|
return `${path}: "runtimeDir" in the global config is ignored — it carries no repository segment, so a machine-wide value would collapse every repository's task folders into one tree. Declare it from a repo-local vinaya.config.json.`;
|
|
6493
6615
|
}
|
|
6616
|
+
var emittedGlobalKeyWarnings = new Set;
|
|
6617
|
+
function warnGlobalKeyIgnoredOnce(message) {
|
|
6618
|
+
if (emittedGlobalKeyWarnings.has(message))
|
|
6619
|
+
return;
|
|
6620
|
+
emittedGlobalKeyWarnings.add(message);
|
|
6621
|
+
console.error(`⚠ ${message}`);
|
|
6622
|
+
}
|
|
6494
6623
|
function stripGlobalOnlyKeys(config, path) {
|
|
6495
6624
|
if (path !== GLOBAL_CONFIG_PATH)
|
|
6496
6625
|
return config;
|
|
6497
6626
|
let result = config;
|
|
6498
6627
|
if (result.checks && Object.keys(result.checks).length > 0) {
|
|
6499
|
-
|
|
6628
|
+
warnGlobalKeyIgnoredOnce(globalChecksIgnoredWarning(path));
|
|
6500
6629
|
result = { ...result, checks: undefined };
|
|
6501
6630
|
}
|
|
6502
6631
|
if (result.roles && Object.keys(result.roles).length > 0) {
|
|
6503
|
-
|
|
6632
|
+
warnGlobalKeyIgnoredOnce(globalRolesIgnoredWarning(path));
|
|
6504
6633
|
result = { ...result, roles: undefined };
|
|
6505
6634
|
}
|
|
6506
6635
|
if (result.principals && result.principals.length > 0) {
|
|
6507
|
-
|
|
6636
|
+
warnGlobalKeyIgnoredOnce(globalPrincipalsIgnoredWarning(path));
|
|
6508
6637
|
result = { ...result, principals: undefined };
|
|
6509
6638
|
}
|
|
6510
6639
|
if (result.releaseActor) {
|
|
6511
|
-
|
|
6640
|
+
warnGlobalKeyIgnoredOnce(globalReleaseActorIgnoredWarning(path));
|
|
6512
6641
|
result = { ...result, releaseActor: undefined };
|
|
6513
6642
|
}
|
|
6514
6643
|
if (result.tokens) {
|
|
6515
|
-
|
|
6644
|
+
warnGlobalKeyIgnoredOnce(globalTokensCollectIgnoredWarning(path));
|
|
6516
6645
|
result = { ...result, tokens: undefined };
|
|
6517
6646
|
}
|
|
6518
6647
|
if (result.runtimeDir) {
|
|
6519
|
-
|
|
6648
|
+
warnGlobalKeyIgnoredOnce(globalRuntimeDirIgnoredWarning(path));
|
|
6520
6649
|
result = { ...result, runtimeDir: undefined };
|
|
6521
6650
|
}
|
|
6522
6651
|
return result;
|
|
@@ -6549,26 +6678,102 @@ function resolveReviewPolicy(config) {
|
|
|
6549
6678
|
maxRounds
|
|
6550
6679
|
};
|
|
6551
6680
|
}
|
|
6552
|
-
function
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6681
|
+
function resolveRuntimeDirSetting(config) {
|
|
6682
|
+
return config?.runtimeDir ?? null;
|
|
6683
|
+
}
|
|
6684
|
+
function resolveTrustAnchorRuntimeDir(localRuntimeDir, trustAnchorConfig) {
|
|
6685
|
+
const anchored = resolveRuntimeDirSetting(trustAnchorConfig);
|
|
6686
|
+
return anchored !== null && anchored === localRuntimeDir ? anchored : null;
|
|
6687
|
+
}
|
|
6688
|
+
function resolveLogsSetting(config) {
|
|
6689
|
+
const raw = config?.logs;
|
|
6690
|
+
if (!raw)
|
|
6691
|
+
return null;
|
|
6692
|
+
if (raw.url !== undefined)
|
|
6693
|
+
return { url: raw.url, headers: raw.headers };
|
|
6694
|
+
if (raw.folder !== undefined)
|
|
6695
|
+
return { folder: raw.folder };
|
|
6696
|
+
return null;
|
|
6697
|
+
}
|
|
6698
|
+
function resolveTrustAnchorLogsDestination(local, trustAnchorConfig) {
|
|
6699
|
+
const anchored = resolveLogsSetting(trustAnchorConfig);
|
|
6700
|
+
if (!anchored)
|
|
6701
|
+
return null;
|
|
6702
|
+
if ("url" in local)
|
|
6703
|
+
return "url" in anchored && anchored.url === local.url ? anchored : null;
|
|
6704
|
+
return "folder" in anchored && anchored.folder === local.folder ? anchored : null;
|
|
6705
|
+
}
|
|
6706
|
+
function resolveLogsHeaderValues(headers, env) {
|
|
6707
|
+
if (!headers)
|
|
6708
|
+
return;
|
|
6709
|
+
const resolved = {};
|
|
6710
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
6711
|
+
resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) => env[name] ?? "");
|
|
6559
6712
|
}
|
|
6713
|
+
return resolved;
|
|
6714
|
+
}
|
|
6715
|
+
function trustAnchorRepo() {
|
|
6716
|
+
const fromRunner = trustAnchorRepoFromRunner();
|
|
6717
|
+
if (fromRunner)
|
|
6718
|
+
return fromRunner;
|
|
6560
6719
|
try {
|
|
6561
6720
|
const url = execFileSync3("git", ["remote", "get-url", "origin"], {
|
|
6562
6721
|
encoding: "utf-8",
|
|
6563
6722
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6564
|
-
})
|
|
6565
|
-
|
|
6566
|
-
return m?.[1] && m[2] ? wellFormed(`${m[1]}/${m[2]}`) : null;
|
|
6723
|
+
});
|
|
6724
|
+
return trustAnchorRepoFromRemoteUrl(url);
|
|
6567
6725
|
} catch {
|
|
6568
6726
|
return null;
|
|
6569
6727
|
}
|
|
6570
6728
|
}
|
|
6729
|
+
async function trustAnchorRepoAsync() {
|
|
6730
|
+
const fromRunner = trustAnchorRepoFromRunner();
|
|
6731
|
+
if (fromRunner)
|
|
6732
|
+
return fromRunner;
|
|
6733
|
+
try {
|
|
6734
|
+
const { stdout } = await execFileAsync4("git", ["remote", "get-url", "origin"], {
|
|
6735
|
+
encoding: "utf-8",
|
|
6736
|
+
timeout: 1e4
|
|
6737
|
+
});
|
|
6738
|
+
return trustAnchorRepoFromRemoteUrl(stdout);
|
|
6739
|
+
} catch {
|
|
6740
|
+
return null;
|
|
6741
|
+
}
|
|
6742
|
+
}
|
|
6743
|
+
function wellFormedRepoSlug(slug) {
|
|
6744
|
+
return /^[^/\s]+\/[^/\s]+$/.test(slug) ? slug : null;
|
|
6745
|
+
}
|
|
6746
|
+
function trustAnchorRepoFromRunner() {
|
|
6747
|
+
const fromRunner = process.env.GITHUB_REPOSITORY?.trim();
|
|
6748
|
+
return fromRunner ? wellFormedRepoSlug(fromRunner) : null;
|
|
6749
|
+
}
|
|
6750
|
+
function trustAnchorRepoFromRemoteUrl(url) {
|
|
6751
|
+
const m = url.trim().match(/github\.com[:/]([^/]+)\/(.+?)(?:\.git)?\/?$/);
|
|
6752
|
+
return m?.[1] && m[2] ? wellFormedRepoSlug(`${m[1]}/${m[2]}`) : null;
|
|
6753
|
+
}
|
|
6754
|
+
var execFileAsync4 = promisify4(execFile4);
|
|
6755
|
+
function resolveCiTrustAnchorProbeRef(env = process.env) {
|
|
6756
|
+
const ref = env.VINAYA_CI_CONFIG_PROBE_REF?.trim();
|
|
6757
|
+
if (!ref)
|
|
6758
|
+
return null;
|
|
6759
|
+
if (env.GITHUB_ACTIONS !== "true")
|
|
6760
|
+
return null;
|
|
6761
|
+
if ((env.GH_TOKEN ?? "").length > 0 || (env.GITHUB_TOKEN ?? "").length > 0)
|
|
6762
|
+
return null;
|
|
6763
|
+
return ref;
|
|
6764
|
+
}
|
|
6765
|
+
function readTrustAnchorConfigAtRef(ref) {
|
|
6766
|
+
const raw = execFileSync3("git", ["show", `${ref}:${LOCAL_CONFIG_FILENAME}`], {
|
|
6767
|
+
encoding: "utf-8",
|
|
6768
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
6769
|
+
timeout: 1e4
|
|
6770
|
+
});
|
|
6771
|
+
return Buffer.from(raw, "utf-8").toString("base64");
|
|
6772
|
+
}
|
|
6571
6773
|
function ghFetchTrustAnchorConfig() {
|
|
6774
|
+
const probeRef = resolveCiTrustAnchorProbeRef();
|
|
6775
|
+
if (probeRef)
|
|
6776
|
+
return readTrustAnchorConfigAtRef(probeRef);
|
|
6572
6777
|
const repo = trustAnchorRepo();
|
|
6573
6778
|
if (!repo)
|
|
6574
6779
|
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
@@ -6577,6 +6782,21 @@ function ghFetchTrustAnchorConfig() {
|
|
|
6577
6782
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6578
6783
|
});
|
|
6579
6784
|
}
|
|
6785
|
+
async function ghFetchTrustAnchorConfigAsync() {
|
|
6786
|
+
const probeRef = resolveCiTrustAnchorProbeRef();
|
|
6787
|
+
if (probeRef) {
|
|
6788
|
+
const { stdout } = await execFileAsync4("git", ["show", `${probeRef}:${LOCAL_CONFIG_FILENAME}`], {
|
|
6789
|
+
encoding: "utf-8",
|
|
6790
|
+
timeout: 1e4
|
|
6791
|
+
});
|
|
6792
|
+
return Buffer.from(stdout, "utf-8").toString("base64");
|
|
6793
|
+
}
|
|
6794
|
+
const repo = await trustAnchorRepoAsync();
|
|
6795
|
+
if (!repo)
|
|
6796
|
+
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
6797
|
+
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4 });
|
|
6798
|
+
return stdout;
|
|
6799
|
+
}
|
|
6580
6800
|
function firstLine(err) {
|
|
6581
6801
|
return err?.message?.split(`
|
|
6582
6802
|
`)[0] ?? "unknown error";
|
|
@@ -6591,16 +6811,35 @@ function isMissingFileError(err) {
|
|
|
6591
6811
|
return /\b404\b|not found/i.test(haystack);
|
|
6592
6812
|
}
|
|
6593
6813
|
function loadTrustAnchorConfig(fetcher = ghFetchTrustAnchorConfig) {
|
|
6594
|
-
const warn = (why) => process.stdout.write(`⚠ could not read the trust-anchor config (\`principals\`/\`releaseActor\`) from the default branch (${why}) — falling back to vinaya's built-in defaults.
|
|
6595
|
-
`);
|
|
6596
6814
|
let base64;
|
|
6597
6815
|
try {
|
|
6598
|
-
base64 = fetcher()
|
|
6816
|
+
base64 = fetcher();
|
|
6599
6817
|
} catch (err) {
|
|
6600
|
-
|
|
6601
|
-
warn(firstLine(err));
|
|
6602
|
-
return null;
|
|
6818
|
+
return trustAnchorFetchFailed(err);
|
|
6603
6819
|
}
|
|
6820
|
+
return parseTrustAnchorContent(base64);
|
|
6821
|
+
}
|
|
6822
|
+
async function loadTrustAnchorConfigAsync(fetcher = ghFetchTrustAnchorConfigAsync, options = {}) {
|
|
6823
|
+
const warn = options.quiet ? () => {} : warnTrustAnchorFallback;
|
|
6824
|
+
let base64;
|
|
6825
|
+
try {
|
|
6826
|
+
base64 = await fetcher();
|
|
6827
|
+
} catch (err) {
|
|
6828
|
+
return trustAnchorFetchFailed(err, warn);
|
|
6829
|
+
}
|
|
6830
|
+
return parseTrustAnchorContent(base64, warn);
|
|
6831
|
+
}
|
|
6832
|
+
function warnTrustAnchorFallback(why) {
|
|
6833
|
+
process.stdout.write(`⚠ could not read the trust-anchor config (\`principals\`/\`releaseActor\`) from the default branch (${why}) — falling back to vinaya's built-in defaults.
|
|
6834
|
+
`);
|
|
6835
|
+
}
|
|
6836
|
+
function trustAnchorFetchFailed(err, warn = warnTrustAnchorFallback) {
|
|
6837
|
+
if (!isMissingFileError(err))
|
|
6838
|
+
warn(firstLine(err));
|
|
6839
|
+
return null;
|
|
6840
|
+
}
|
|
6841
|
+
function parseTrustAnchorContent(content, warn = warnTrustAnchorFallback) {
|
|
6842
|
+
const base64 = content.trim();
|
|
6604
6843
|
if (!base64)
|
|
6605
6844
|
return null;
|
|
6606
6845
|
try {
|
|
@@ -6636,11 +6875,13 @@ function emitCheckError(error) {
|
|
|
6636
6875
|
}
|
|
6637
6876
|
|
|
6638
6877
|
// src/lib/diff-evidence.ts
|
|
6639
|
-
import { execFileSync as
|
|
6640
|
-
import { join as
|
|
6878
|
+
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
6879
|
+
import { join as join9, relative, resolve as resolve2 } from "node:path";
|
|
6641
6880
|
|
|
6642
6881
|
// src/lib/brief-assembly.ts
|
|
6643
6882
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
6883
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4, readdirSync as readdirSync2 } from "node:fs";
|
|
6884
|
+
import { join as join4 } from "node:path";
|
|
6644
6885
|
|
|
6645
6886
|
// ../../packages/sources/src/commands.ts
|
|
6646
6887
|
var COMMANDS = [
|
|
@@ -6793,10 +7034,10 @@ var COMMANDS = [
|
|
|
6793
7034
|
}
|
|
6794
7035
|
],
|
|
6795
7036
|
details: [
|
|
6796
|
-
"Composes `task brief`'s own preparation (`prepareTask`) with `dev-review-loop`
|
|
7037
|
+
"Composes `task brief`'s own preparation (`prepareTask`) with the watching driver (`runDriverLoop`, `dev-review-loop.ts`) — nothing else. Preparation starts no agent; the loop's own round 1 reads the frozen brief off the Issue and is the only place a developer is ever dispatched from a fresh task, so exactly one developer is started by construction.",
|
|
6797
7038
|
"A brief already frozen on the Issue is reused, never re-posted — the second `task dispatch`/`task brief` call this composes around does not fail the whole run, it just skips straight to running the loop. A task whose Issue refuses preparation (a missing brief section, an unmet dispatch gate) is refused before any agent starts, with nothing posted.",
|
|
6798
|
-
"Refuses when the frozen brief's developer branch already has an open pull request —
|
|
6799
|
-
"Exit and printed summary distinguish a published
|
|
7039
|
+
"Refuses when the frozen brief's developer branch already has an open pull request AND a driver is still live for it — a driver that crashed or was killed leaves its PR behind, and this command is the one that revives it, in any state, pause held or not.",
|
|
7040
|
+
"issue-711 O4: a pause never ends this process — it keeps running and watches the pull request, continuing on its own once a newer Principal ruling appears (or, for an `'infrastructure'`/`'stale_driver'` pause, after a bounded backoff), with no `--resume` command needed for the ordinary case. Exit and printed summary distinguish a published pull request OR a watched pause's own genuine end — merged, closed, or an operator's own `--cancel` (exit `0` either way, the PR URL) — from the one pause this process can never watch (no pull request exists yet — exit `1`, with the exact `vinaya task run <tranche> <n>` command to continue by hand), a usage/argv error (exit `2`), and any other failure (exit `3`)."
|
|
6800
7041
|
],
|
|
6801
7042
|
status: "shipped"
|
|
6802
7043
|
},
|
|
@@ -6835,7 +7076,7 @@ var COMMANDS = [
|
|
|
6835
7076
|
details: [
|
|
6836
7077
|
"Exposes the task-operator tool catalog (`packages/aeg-core/src/task-tools.ts`) to an agent runtime as one MCP server speaking newline-delimited JSON-RPC 2.0 (`initialize`/`tools/list`/`tools/call`). Claude registers it through the generated `.mcp.json`; Codex through its documented `~/.codex/config.toml` `[mcp_servers]` table — both point at this same command.",
|
|
6837
7078
|
"stdout carries JSON-RPC and nothing else: any stray write from the CLI (a forge-read warning) is redirected to stderr, so the protocol stream is never corrupted.",
|
|
6838
|
-
"`task_status`/`task_escalation_read` read; `task_start` starts a run in attended mode only, requiring an authenticated caller from the invocation context (`VINAYA_MCP_CALLER`) and refusing without one — MCP is a transport, not authorization. `task_resume`/`task_cancel` require the same authenticated caller, plus a current Principal ruling read fresh from the run's own PR — never a caller-supplied approval; `task_resume` triggers the existing `dev-review-loop --resume` continuation exactly once per escalation, and `task_cancel` reports a truthful `confirmed`/`pending`/`uncertain` outcome, idempotently, across repeated calls. No unattended start until the worker-isolation boundary and a capability flag land."
|
|
7079
|
+
"`task_status`/`task_escalation_read`/`task_pr_read` read; `task_pr_read` returns the selected task's OWN pull request — every required and reported check with its state, conclusion and failure summary, plus the principal-authored review record (newest verdicts and their judged head, round markers, published summary table, pause comment) — and refuses any other pull request; `task_start` starts a run in attended mode only, requiring an authenticated caller from the invocation context (`VINAYA_MCP_CALLER`) and refusing without one — MCP is a transport, not authorization. `task_resume`/`task_cancel` require the same authenticated caller, plus a current Principal ruling read fresh from the run's own PR — never a caller-supplied approval; `task_resume` triggers the existing `dev-review-loop --resume` continuation exactly once per escalation, and `task_cancel` reports a truthful `confirmed`/`pending`/`uncertain` outcome, idempotently, across repeated calls. No unattended start until the worker-isolation boundary and a capability flag land."
|
|
6839
7080
|
],
|
|
6840
7081
|
status: "shipped"
|
|
6841
7082
|
},
|
|
@@ -6965,48 +7206,6 @@ var COMMANDS = [
|
|
|
6965
7206
|
],
|
|
6966
7207
|
status: "shipped"
|
|
6967
7208
|
},
|
|
6968
|
-
{
|
|
6969
|
-
name: "log flush",
|
|
6970
|
-
description: "Post a target Issue or PR's outbox as one or more marked comments, then truncate what the forge confirmed",
|
|
6971
|
-
flags: [
|
|
6972
|
-
{ flag: "--issue", description: "Flush this Issue's outbox (`~/.vinaya/outbox/<owner>-<repo>/<n>.ndjson`)" },
|
|
6973
|
-
{
|
|
6974
|
-
flag: "--pr",
|
|
6975
|
-
description: "Flush the Issue named by this PR's `Closes #N` line, posting the comments on the PR"
|
|
6976
|
-
},
|
|
6977
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
6978
|
-
],
|
|
6979
|
-
details: [
|
|
6980
|
-
"Exactly one of `--issue`/`--pr` is required. `--pr` resolves the Issue from the PR body's `Closes #N` line — the same anchor every gate reads — and refuses with a check error naming the missing line when the body carries none.",
|
|
6981
|
-
"Splits the outbox first at `run_id` boundaries (a maximal run of consecutive lines sharing one `run_id`, never a global group-by, so an interleaved outbox never produces a range spanning a gap), then at `FORGE_COMMENT_MAX_CHARS` (65536) within each run. Each comment opens with `<!-- aeg:log:<run_id>:<seq_from>-<seq_to> -->` on its own line, then one fenced `ndjson` block, one outbox line per line, verbatim. A single line too large to fit alone is refused by name, never split across two comments.",
|
|
6982
|
-
"Logs its own `forge_write` line — `validated` before posting, `written` (with every returned comment id) after the last post succeeds, or `refused` (with gh's error) on any failure — through the same `log()` every other family uses, into the same outbox, before truncating. The outbox is truncated only to the lines confirmed posted; a failed chunk's lines, and anything appended to the outbox during the flush (including the flush's own `validated`/`written`/`refused` line), always survive to ride the next flush."
|
|
6983
|
-
],
|
|
6984
|
-
status: "shipped"
|
|
6985
|
-
},
|
|
6986
|
-
{
|
|
6987
|
-
name: "log export-artifact",
|
|
6988
|
-
description: "Copy this run's own local outbox into a file, for the generated task-path workflow's own upload step",
|
|
6989
|
-
flags: [],
|
|
6990
|
-
details: [
|
|
6991
|
-
"Concatenates every `*.ndjson` file under `~/.vinaya/outbox/` into `<dest>`, verbatim — no filtering, no second redaction pass (lines are already redacted at `log()`'s own write boundary). Writes nothing when the outbox is empty, and exits 0 either way: no gate events this run is a legitimate outcome, never a failure.",
|
|
6992
|
-
"Runs inside the generated `vinaya-checks.yml` job, which holds no forge-write credential — this command never calls the forge. Both this step and the `actions/upload-artifact` step after it run `if: always()`, so a cancelled or failed job still exports whatever partial outbox it has."
|
|
6993
|
-
],
|
|
6994
|
-
status: "shipped"
|
|
6995
|
-
},
|
|
6996
|
-
{
|
|
6997
|
-
name: "log collect-artifact",
|
|
6998
|
-
description: "Validate a downloaded task-log artifact and publish the valid records through the existing flush path",
|
|
6999
|
-
flags: [
|
|
7000
|
-
{ flag: "--pr", description: "The pull request this artifact belongs to" },
|
|
7001
|
-
{ flag: "--repo", description: "Expected `owner/repo` — a provenance cross-check against each record" }
|
|
7002
|
-
],
|
|
7003
|
-
details: [
|
|
7004
|
-
"Runs inside the generated `vinaya-task-log-collector.yml` workflow — a `workflow_run`-triggered job on the default branch, holding the write credential the task-path job that produced the artifact never gets. `<path>` is already downloaded by that workflow, scoped to a specific, API-verified run id — a provenance guarantee this command never re-derives from the artifact bytes.",
|
|
7005
|
-
"Never executes, imports, or evaluates the artifact's content: every line is read as text and validated (schema, an 8 MiB whole-artifact size cap, redaction, and a repo cross-check) before anything is trusted. A rejected line becomes a named gap — printed, never a silent drop — and the artifact is never partially trusted past that check into executing anything.",
|
|
7006
|
-
"The valid, re-redacted survivors are appended into the same local outbox `vinaya log flush` would read for that PR's Issue, then published through the existing `flushOutbox` unmodified — reusing its chunking, its `<!-- aeg:log:… -->` marker, and its idempotent-retry read, rather than a second publisher. A retried collector run (a fresh runner, the same forge state) therefore dedupes for free: the marker already on the forge is acknowledged, never re-posted."
|
|
7007
|
-
],
|
|
7008
|
-
status: "shipped"
|
|
7009
|
-
},
|
|
7010
7209
|
{
|
|
7011
7210
|
name: "milestone create",
|
|
7012
7211
|
description: "Create a GitHub Milestone from a validated body",
|
|
@@ -7336,7 +7535,7 @@ var COMMANDS = [
|
|
|
7336
7535
|
{ flag: "--task", description: "This dispatch's task Issue number — mutually exclusive with `--pr`" },
|
|
7337
7536
|
{
|
|
7338
7537
|
flag: "--pr",
|
|
7339
|
-
description: "
|
|
7538
|
+
description: "This dispatch's pull request number, for attribution — mutually exclusive with `--task`"
|
|
7340
7539
|
},
|
|
7341
7540
|
{ flag: "--round", description: "Round number, for a dispatch inside a review loop" },
|
|
7342
7541
|
{
|
|
@@ -7348,7 +7547,7 @@ var COMMANDS = [
|
|
|
7348
7547
|
details: [
|
|
7349
7548
|
"Sets `VINAYA_RUN_ID`/`VINAYA_ROLE`/`VINAYA_TASK`/`VINAYA_ROUND` on the child only — never on this process's own environment — and refuses by name, before any spawn attempt, when the named vendor binary is absent from `PATH` or present but not executable.",
|
|
7350
7549
|
"Records `dispatched` (with the prompt's sha256), `outcome_received` (duration, the vendor's own usage when its stdout prints a recognizable shape), or `dispatch_failed` (`timeout`, `crash`, or `refused`) through the Vinaya Log's one `dispatch` family writer, `dispatchRole`. A wall-time ceiling (`dispatch.timeoutMs` in config, default one hour) sends `SIGTERM` then, after a grace window, `SIGKILL`.",
|
|
7351
|
-
"
|
|
7550
|
+
"Runs no flush of its own after the dispatch returns: every log line `dispatchRole` emits reaches its configured `logs` destination live, as it is emitted, so there is nothing left to ship in a trailing step. `--task`/`--pr` are attribution only, and remain mutually exclusive.",
|
|
7352
7551
|
"A successful dispatch's `DispatchHandle` carries `resumeId` — the vendor's own session/thread identifier (claude/gemini: `session_id`; codex: `thread_id`), parsed from its stdout, `null` on any failure. Passing that value as `--resume <id>` on a later call swaps in that vendor's own resume invocation (`claude -p -r <id> ...`; `codex exec resume <id> ...`; `gemini ... --resume <id> ...`) in place of its first-dispatch args."
|
|
7353
7552
|
],
|
|
7354
7553
|
status: "shipped"
|
|
@@ -7368,7 +7567,8 @@ var COMMANDS = [
|
|
|
7368
7567
|
"Dispatches the developer through `dispatchRole` with the brief read from the Issue, waits for the PR it opens, then runs `assessRound` (`@attalabs/aeg-core`) — the entire policy — against observations this command reads from the forge: the head via `git ls-remote` only (never `gh pr view headRefOid`, which can lag a push), CI conclusion via the check-runs API (never run locally), and ruling comments matching `<!-- aeg:principal:ruling:<pr>-<k> -->`.",
|
|
7369
7568
|
"Nothing is posted to the PR before the policy decides `publish`: each round's reviewer and security verdicts are dispatched fresh (never a resumed session) through `dispatchRole`, rendered through `review post`'s own render functions, and written to a local file under the outbox — never `gh pr comment`/`gh pr review`. Posting the held verdicts is a separate, later task.",
|
|
7370
7569
|
"The developer's session is resumed every round via `dispatchRole`'s `resumeId` — never a fresh session — for every vendor; a round whose resume fails for a vendor that resumed successfully the round before stops the loop rather than silently falling back to a fresh developer session.",
|
|
7371
|
-
"Every dispatch and round transition is a log line through the Vinaya Log,
|
|
7570
|
+
"Every dispatch and round transition is a log line through the Vinaya Log, delivered live to its configured `logs` destination as it is emitted — never a tracker comment.",
|
|
7571
|
+
"issue-711 O4: this command — `--task <n>`, `--resume <pr>`, `--cancel <pr>` alike — stays `task run`'s own one-shot debug/direct entry; the watching driver that survives a pause and continues on its own is `task run`'s (see that command's own entry)."
|
|
7372
7572
|
],
|
|
7373
7573
|
status: "shipped"
|
|
7374
7574
|
}
|
|
@@ -7506,6 +7706,9 @@ async function resolveEdge(id, taskById, factsByTaskId, repo, resolveSibling = d
|
|
|
7506
7706
|
}
|
|
7507
7707
|
|
|
7508
7708
|
// src/lib/brief-assembly.ts
|
|
7709
|
+
var PACKAGE_ROOT = packageRoot(import.meta.url);
|
|
7710
|
+
var PACKAGED_TEMPLATE_PATH = join4(PACKAGE_ROOT, "aeg-root", "templates", "brief-template.md");
|
|
7711
|
+
var TEMPLATE_PATH = existsSync4(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join4(PACKAGE_ROOT, "..", "..", "aeg-root", "templates", "brief-template.md");
|
|
7509
7712
|
function git(args) {
|
|
7510
7713
|
try {
|
|
7511
7714
|
return execFileSync5("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
@@ -7521,14 +7724,14 @@ function expandGlob(glob) {
|
|
|
7521
7724
|
var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
|
|
7522
7725
|
|
|
7523
7726
|
// src/checks/registry.ts
|
|
7524
|
-
import { existsSync as
|
|
7525
|
-
import { join as
|
|
7526
|
-
var DIST_BIN_DIR =
|
|
7527
|
-
var SRC_BIN_DIR =
|
|
7528
|
-
var BIN_DIR =
|
|
7727
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
7728
|
+
import { join as join5 } from "node:path";
|
|
7729
|
+
var DIST_BIN_DIR = join5(packageRoot(import.meta.url), "dist", "checks", "bin");
|
|
7730
|
+
var SRC_BIN_DIR = join5(packageRoot(import.meta.url), "src", "checks", "bin");
|
|
7731
|
+
var BIN_DIR = existsSync5(DIST_BIN_DIR) ? DIST_BIN_DIR : SRC_BIN_DIR;
|
|
7529
7732
|
var BIN_EXT = BIN_DIR === DIST_BIN_DIR ? ".js" : ".ts";
|
|
7530
7733
|
function bin(name) {
|
|
7531
|
-
return
|
|
7734
|
+
return join5(BIN_DIR, `${name}${BIN_EXT}`);
|
|
7532
7735
|
}
|
|
7533
7736
|
var REGISTRY = [
|
|
7534
7737
|
[
|
|
@@ -7940,6 +8143,16 @@ var REGISTRY = [
|
|
|
7940
8143
|
},
|
|
7941
8144
|
0
|
|
7942
8145
|
],
|
|
8146
|
+
[
|
|
8147
|
+
{
|
|
8148
|
+
name: "ci-shard-coverage",
|
|
8149
|
+
run: bin("check-ci-shard-coverage"),
|
|
8150
|
+
scope: "diff",
|
|
8151
|
+
timeoutMs: 15000,
|
|
8152
|
+
env: {}
|
|
8153
|
+
},
|
|
8154
|
+
0
|
|
8155
|
+
],
|
|
7943
8156
|
[
|
|
7944
8157
|
{
|
|
7945
8158
|
name: "workspace-escape",
|
|
@@ -8077,42 +8290,541 @@ function coreCheckRegistry() {
|
|
|
8077
8290
|
var CORE_CHECK_RING = Object.fromEntries(REGISTRY.map(([spec, ring]) => [spec.name, ring]));
|
|
8078
8291
|
|
|
8079
8292
|
// src/lib/log-sink.ts
|
|
8080
|
-
import {
|
|
8081
|
-
import { randomUUID } from "node:crypto";
|
|
8293
|
+
import { execFile as execFile5 } from "node:child_process";
|
|
8294
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
8295
|
+
import {
|
|
8296
|
+
closeSync as closeSync3,
|
|
8297
|
+
constants as fsConstants3,
|
|
8298
|
+
existsSync as existsSync7,
|
|
8299
|
+
fstatSync as fstatSync2,
|
|
8300
|
+
mkdirSync as mkdirSync3,
|
|
8301
|
+
openSync as openSync3,
|
|
8302
|
+
readFileSync as readFileSync6,
|
|
8303
|
+
renameSync as renameSync2,
|
|
8304
|
+
writeSync as writeSync2
|
|
8305
|
+
} from "node:fs";
|
|
8306
|
+
import { hostname as osHostname, homedir as homedir3 } from "node:os";
|
|
8307
|
+
import { dirname as dirname6, join as join8 } from "node:path";
|
|
8308
|
+
import { promisify as promisify5 } from "node:util";
|
|
8309
|
+
|
|
8310
|
+
// src/lib/run-paths.ts
|
|
8311
|
+
import { chmodSync, existsSync as existsSync6, realpathSync as realpathSync2 } from "node:fs";
|
|
8312
|
+
import { dirname as dirname4, join as join6, resolve as resolvePath } from "node:path";
|
|
8313
|
+
var SAFE_PATH_SEGMENT = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
8314
|
+
function isSafeRepoSegment(segment) {
|
|
8315
|
+
return SAFE_PATH_SEGMENT.test(segment) && !segment.includes("..");
|
|
8316
|
+
}
|
|
8317
|
+
function repoSegment(repo) {
|
|
8318
|
+
if (!repo || !isSafeRepoSegment(repo.owner) || !isSafeRepoSegment(repo.repo))
|
|
8319
|
+
return "unresolved";
|
|
8320
|
+
return `${repo.owner}-${repo.repo}`;
|
|
8321
|
+
}
|
|
8322
|
+
function defaultRuntimeDir(repo, home = GLOBAL_VINAYA_HOME) {
|
|
8323
|
+
return join6(home, "runtime", repoSegment(repo));
|
|
8324
|
+
}
|
|
8325
|
+
function resolveRuntimeDir(input) {
|
|
8326
|
+
const local = resolveRuntimeDirSetting(input.localConfig);
|
|
8327
|
+
if (local === null)
|
|
8328
|
+
return defaultRuntimeDir(input.repo, input.home);
|
|
8329
|
+
if (isInsideRepo(local, input.repoRoot))
|
|
8330
|
+
return defaultRuntimeDir(input.repo, input.home);
|
|
8331
|
+
if (!input.unattended)
|
|
8332
|
+
return local;
|
|
8333
|
+
const anchored = resolveTrustAnchorRuntimeDir(local, input.trustAnchorConfig ?? null);
|
|
8334
|
+
return anchored ?? defaultRuntimeDir(input.repo, input.home);
|
|
8335
|
+
}
|
|
8336
|
+
function isInsideRepo(candidate, repoRoot) {
|
|
8337
|
+
if (!repoRoot)
|
|
8338
|
+
return false;
|
|
8339
|
+
const root = resolvePath(repoRoot);
|
|
8340
|
+
const target = resolvePath(candidate);
|
|
8341
|
+
return target === root || target.startsWith(`${root}/`);
|
|
8342
|
+
}
|
|
8343
|
+
var UNATTENDED_ENV_KEY = "VINAYA_UNATTENDED";
|
|
8344
|
+
var RUNTIME_DIR_ENV_KEY = "VINAYA_RUNTIME_DIR";
|
|
8345
|
+
function isUnattendedProcess(env = process.env) {
|
|
8346
|
+
return env[UNATTENDED_ENV_KEY] === "1" || (env.VINAYA_ROLE ?? "") !== "";
|
|
8347
|
+
}
|
|
8348
|
+
var memoized = null;
|
|
8349
|
+
async function runtimeDirForRepoAsync(repo) {
|
|
8350
|
+
const key = repoSegment(repo);
|
|
8351
|
+
if (memoized?.key === key)
|
|
8352
|
+
return memoized.value;
|
|
8353
|
+
const inputs = runtimeDirInputs();
|
|
8354
|
+
if (typeof inputs === "string")
|
|
8355
|
+
return inputs;
|
|
8356
|
+
const value = resolveRuntimeDir({
|
|
8357
|
+
repo,
|
|
8358
|
+
...inputs.base,
|
|
8359
|
+
trustAnchorConfig: inputs.needsAnchor ? await loadTrustAnchorConfigAsync() : null
|
|
8360
|
+
});
|
|
8361
|
+
memoized = { key, value };
|
|
8362
|
+
return value;
|
|
8363
|
+
}
|
|
8364
|
+
function runtimeDirInputs() {
|
|
8365
|
+
const handedDown = process.env[RUNTIME_DIR_ENV_KEY];
|
|
8366
|
+
if (handedDown)
|
|
8367
|
+
return handedDown;
|
|
8368
|
+
const localConfig = loadConfig();
|
|
8369
|
+
const unattended = isUnattendedProcess();
|
|
8370
|
+
return {
|
|
8371
|
+
base: { localConfig, unattended, repoRoot: repoRootSync() },
|
|
8372
|
+
needsAnchor: unattended && resolveRuntimeDirSetting(localConfig) !== null
|
|
8373
|
+
};
|
|
8374
|
+
}
|
|
8375
|
+
function repoRootSync(start = process.cwd()) {
|
|
8376
|
+
let dir;
|
|
8377
|
+
try {
|
|
8378
|
+
dir = realpathSync2(start);
|
|
8379
|
+
} catch {
|
|
8380
|
+
return null;
|
|
8381
|
+
}
|
|
8382
|
+
for (;; ) {
|
|
8383
|
+
if (existsSync6(join6(dir, ".git")))
|
|
8384
|
+
return dir;
|
|
8385
|
+
const parent = dirname4(dir);
|
|
8386
|
+
if (parent === dir)
|
|
8387
|
+
return null;
|
|
8388
|
+
dir = parent;
|
|
8389
|
+
}
|
|
8390
|
+
}
|
|
8391
|
+
|
|
8392
|
+
// src/lib/log-webhook-drain.ts
|
|
8082
8393
|
import {
|
|
8083
8394
|
closeSync as closeSync2,
|
|
8084
8395
|
constants as fsConstants2,
|
|
8085
|
-
|
|
8086
|
-
fstatSync as fstatSync2,
|
|
8396
|
+
lstatSync,
|
|
8087
8397
|
mkdirSync as mkdirSync2,
|
|
8088
8398
|
openSync as openSync2,
|
|
8089
|
-
|
|
8399
|
+
linkSync,
|
|
8400
|
+
readFileSync as readFileSync5,
|
|
8090
8401
|
renameSync,
|
|
8402
|
+
statSync,
|
|
8403
|
+
unlinkSync,
|
|
8404
|
+
utimesSync,
|
|
8405
|
+
writeFileSync as writeFileSync2,
|
|
8091
8406
|
writeSync
|
|
8092
8407
|
} from "node:fs";
|
|
8093
|
-
import {
|
|
8094
|
-
import {
|
|
8095
|
-
|
|
8408
|
+
import { randomUUID } from "node:crypto";
|
|
8409
|
+
import { homedir as homedir2 } from "node:os";
|
|
8410
|
+
import { dirname as dirname5, join as join7 } from "node:path";
|
|
8411
|
+
var MAX_WEBHOOK_BODY_BYTES = 5 * 1024 * 1024;
|
|
8412
|
+
var WEBHOOK_FETCH_TIMEOUT_MS = 30000;
|
|
8413
|
+
var SAFE_PATH_SEGMENT2 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
8414
|
+
function isSafeRepoSegment2(segment) {
|
|
8415
|
+
return SAFE_PATH_SEGMENT2.test(segment) && !segment.includes("..");
|
|
8416
|
+
}
|
|
8417
|
+
function isErrnoCode(err, code) {
|
|
8418
|
+
return typeof err === "object" && err !== null && err.code === code;
|
|
8419
|
+
}
|
|
8096
8420
|
function isEnoent(err) {
|
|
8421
|
+
return isErrnoCode(err, "ENOENT");
|
|
8422
|
+
}
|
|
8423
|
+
var WEBHOOK_DRAIN_LOCK_STALE_MS = 4 * WEBHOOK_FETCH_TIMEOUT_MS;
|
|
8424
|
+
function tryCreateLock(lockPath, token) {
|
|
8425
|
+
try {
|
|
8426
|
+
mkdirSync2(dirname5(lockPath), { recursive: true, mode: 448 });
|
|
8427
|
+
const fd = openSync2(lockPath, fsConstants2.O_WRONLY | fsConstants2.O_CREAT | fsConstants2.O_EXCL, 384);
|
|
8428
|
+
try {
|
|
8429
|
+
writeSync(fd, `${token}
|
|
8430
|
+
`);
|
|
8431
|
+
} finally {
|
|
8432
|
+
closeSync2(fd);
|
|
8433
|
+
}
|
|
8434
|
+
return true;
|
|
8435
|
+
} catch (err) {
|
|
8436
|
+
if (isErrnoCode(err, "EEXIST"))
|
|
8437
|
+
return false;
|
|
8438
|
+
throw err;
|
|
8439
|
+
}
|
|
8440
|
+
}
|
|
8441
|
+
function acquireDrainLock(lockPath) {
|
|
8442
|
+
const token = `${process.pid}:${randomUUID()}`;
|
|
8443
|
+
if (tryCreateLock(lockPath, token))
|
|
8444
|
+
return token;
|
|
8445
|
+
let observedMtimeMs;
|
|
8446
|
+
try {
|
|
8447
|
+
observedMtimeMs = statSync(lockPath).mtimeMs;
|
|
8448
|
+
} catch (err) {
|
|
8449
|
+
if (!isEnoent(err))
|
|
8450
|
+
throw err;
|
|
8451
|
+
return tryCreateLock(lockPath, token) ? token : null;
|
|
8452
|
+
}
|
|
8453
|
+
if (Date.now() - observedMtimeMs <= WEBHOOK_DRAIN_LOCK_STALE_MS)
|
|
8454
|
+
return null;
|
|
8455
|
+
const claimed = `${lockPath}.claimed-${randomUUID()}`;
|
|
8456
|
+
try {
|
|
8457
|
+
renameSync(lockPath, claimed);
|
|
8458
|
+
} catch (err) {
|
|
8459
|
+
if (isEnoent(err))
|
|
8460
|
+
return null;
|
|
8461
|
+
throw err;
|
|
8462
|
+
}
|
|
8463
|
+
let claimedMtimeMs = null;
|
|
8464
|
+
try {
|
|
8465
|
+
claimedMtimeMs = statSync(claimed).mtimeMs;
|
|
8466
|
+
} catch (err) {
|
|
8467
|
+
if (!isEnoent(err))
|
|
8468
|
+
throw err;
|
|
8469
|
+
}
|
|
8470
|
+
if (claimedMtimeMs !== observedMtimeMs) {
|
|
8471
|
+
try {
|
|
8472
|
+
linkSync(claimed, lockPath);
|
|
8473
|
+
} catch (err) {
|
|
8474
|
+
if (!isErrnoCode(err, "EEXIST"))
|
|
8475
|
+
throw err;
|
|
8476
|
+
}
|
|
8477
|
+
try {
|
|
8478
|
+
unlinkSync(claimed);
|
|
8479
|
+
} catch (err) {
|
|
8480
|
+
if (!isEnoent(err))
|
|
8481
|
+
throw err;
|
|
8482
|
+
}
|
|
8483
|
+
return null;
|
|
8484
|
+
}
|
|
8485
|
+
unlinkSync(claimed);
|
|
8486
|
+
return tryCreateLock(lockPath, token) ? token : null;
|
|
8487
|
+
}
|
|
8488
|
+
function renewDrainLock(lockPath, token) {
|
|
8489
|
+
let holder;
|
|
8490
|
+
try {
|
|
8491
|
+
holder = readFileSync5(lockPath, "utf8").trim();
|
|
8492
|
+
} catch (err) {
|
|
8493
|
+
if (!isEnoent(err))
|
|
8494
|
+
throw err;
|
|
8495
|
+
return false;
|
|
8496
|
+
}
|
|
8497
|
+
if (holder !== token)
|
|
8498
|
+
return false;
|
|
8499
|
+
const now = new Date;
|
|
8500
|
+
try {
|
|
8501
|
+
utimesSync(lockPath, now, now);
|
|
8502
|
+
} catch (err) {
|
|
8503
|
+
if (!isEnoent(err))
|
|
8504
|
+
throw err;
|
|
8505
|
+
return false;
|
|
8506
|
+
}
|
|
8507
|
+
return true;
|
|
8508
|
+
}
|
|
8509
|
+
function releaseDrainLock(lockPath, token) {
|
|
8510
|
+
try {
|
|
8511
|
+
const holder = readFileSync5(lockPath, "utf8").trim();
|
|
8512
|
+
if (holder !== token)
|
|
8513
|
+
return;
|
|
8514
|
+
unlinkSync(lockPath);
|
|
8515
|
+
} catch (err) {
|
|
8516
|
+
if (!isEnoent(err))
|
|
8517
|
+
throw err;
|
|
8518
|
+
}
|
|
8519
|
+
}
|
|
8520
|
+
|
|
8521
|
+
class WebhookDrainError extends Error {
|
|
8522
|
+
code;
|
|
8523
|
+
constructor(code, message) {
|
|
8524
|
+
super(message);
|
|
8525
|
+
this.code = code;
|
|
8526
|
+
}
|
|
8527
|
+
}
|
|
8528
|
+
function backupPathFor(queuePath) {
|
|
8529
|
+
return queuePath.replace(/\.ndjson$/, ".1.ndjson");
|
|
8530
|
+
}
|
|
8531
|
+
function drainingPathFor(queuePath) {
|
|
8532
|
+
return queuePath.replace(/\.ndjson$/, ".draining.ndjson");
|
|
8533
|
+
}
|
|
8534
|
+
function rejectedPathFor(queuePath) {
|
|
8535
|
+
return queuePath.replace(/\.ndjson$/, ".rejected.ndjson");
|
|
8536
|
+
}
|
|
8537
|
+
var rejectionWarnedThisProcess = false;
|
|
8538
|
+
function warnRejectionOnce(message) {
|
|
8539
|
+
if (rejectionWarnedThisProcess)
|
|
8540
|
+
return;
|
|
8541
|
+
rejectionWarnedThisProcess = true;
|
|
8542
|
+
try {
|
|
8543
|
+
process.stderr.write(message);
|
|
8544
|
+
} catch {}
|
|
8545
|
+
}
|
|
8546
|
+
function queueLines(buf) {
|
|
8547
|
+
const lines = [];
|
|
8548
|
+
let start = 0;
|
|
8549
|
+
for (let i = 0;i < buf.byteLength; i++) {
|
|
8550
|
+
if (buf[i] !== 10)
|
|
8551
|
+
continue;
|
|
8552
|
+
if (i > start)
|
|
8553
|
+
lines.push({ raw: buf.toString("utf8", start, i), end: i + 1 });
|
|
8554
|
+
start = i + 1;
|
|
8555
|
+
}
|
|
8556
|
+
if (start < buf.byteLength)
|
|
8557
|
+
lines.push({ raw: buf.toString("utf8", start), end: buf.byteLength });
|
|
8558
|
+
return lines;
|
|
8559
|
+
}
|
|
8560
|
+
function removeQueueHead(path, cut) {
|
|
8561
|
+
const remaining = readFileSync5(path);
|
|
8562
|
+
writeFileSync2(path, remaining.subarray(Math.min(cut, remaining.byteLength)));
|
|
8563
|
+
}
|
|
8564
|
+
function queueBucketSize(path) {
|
|
8565
|
+
let lstat;
|
|
8566
|
+
try {
|
|
8567
|
+
lstat = lstatSync(path);
|
|
8568
|
+
} catch (err) {
|
|
8569
|
+
if (!isEnoent(err))
|
|
8570
|
+
throw err;
|
|
8571
|
+
}
|
|
8572
|
+
if (lstat === undefined)
|
|
8573
|
+
return null;
|
|
8574
|
+
if (!lstat.isFile()) {
|
|
8575
|
+
throw new WebhookDrainError("log-webhook-drain-symlink", `log webhook drain: outbox target is not a regular file (symlink, FIFO, or similar) — refusing to read: ${path}`);
|
|
8576
|
+
}
|
|
8577
|
+
return Number(lstat.size);
|
|
8578
|
+
}
|
|
8579
|
+
function readQueueFile(path) {
|
|
8580
|
+
if (queueBucketSize(path) === null)
|
|
8581
|
+
return null;
|
|
8582
|
+
return readFileSync5(path);
|
|
8583
|
+
}
|
|
8584
|
+
function rejectLine(rejectedPath, reason, status, identity, raw) {
|
|
8585
|
+
const record = JSON.stringify({
|
|
8586
|
+
rejected_at: new Date().toISOString(),
|
|
8587
|
+
status,
|
|
8588
|
+
reason,
|
|
8589
|
+
identity,
|
|
8590
|
+
bytes: Buffer.byteLength(raw, "utf8"),
|
|
8591
|
+
raw
|
|
8592
|
+
});
|
|
8593
|
+
const failure = appendHardenedLine(rejectedPath, `${record}
|
|
8594
|
+
`);
|
|
8595
|
+
if (failure !== null) {
|
|
8596
|
+
throw new WebhookDrainError("log-webhook-drain-rejected-write", `log webhook drain: a queued line failed re-validation (${reason}) and could not be set aside in ${rejectedPath} — ${failure}; the line stays queued`);
|
|
8597
|
+
}
|
|
8598
|
+
warnRejectionOnce(`vinaya: log delivery set a queued line aside in ${rejectedPath} — ${reason}; later lines keep delivering
|
|
8599
|
+
`);
|
|
8600
|
+
}
|
|
8601
|
+
async function postChunk(webhookUrl, headers, body, fetchTimeoutMs, chunksAlreadyDelivered) {
|
|
8602
|
+
const delivered = chunksAlreadyDelivered > 0 ? ` after delivering ${chunksAlreadyDelivered} chunk(s)` : "";
|
|
8603
|
+
let response;
|
|
8604
|
+
try {
|
|
8605
|
+
response = await fetch(webhookUrl, {
|
|
8606
|
+
method: "POST",
|
|
8607
|
+
headers: { "content-type": "application/x-ndjson", ...headers },
|
|
8608
|
+
body,
|
|
8609
|
+
signal: AbortSignal.timeout(fetchTimeoutMs)
|
|
8610
|
+
});
|
|
8611
|
+
} catch (err) {
|
|
8612
|
+
const reason = err instanceof Error && err.name === "TimeoutError" ? `timed out after ${fetchTimeoutMs}ms` : err instanceof Error ? err.message : String(err);
|
|
8613
|
+
throw new WebhookDrainError("log-webhook-drain-failed", `log webhook drain: POST to ${webhookUrl} failed${delivered}: ${reason}`);
|
|
8614
|
+
}
|
|
8615
|
+
if (!response.ok) {
|
|
8616
|
+
throw new WebhookDrainError("log-webhook-drain-failed", `log webhook drain: POST to ${webhookUrl} returned ${response.status} ${response.statusText}${delivered}`);
|
|
8617
|
+
}
|
|
8618
|
+
}
|
|
8619
|
+
async function drainQueueFile(args) {
|
|
8620
|
+
const { path, rejectedPath, webhookUrl, headers, fetchTimeoutMs, totals } = args;
|
|
8621
|
+
const buf = readQueueFile(path);
|
|
8622
|
+
if (buf === null || buf.byteLength === 0)
|
|
8623
|
+
return;
|
|
8624
|
+
const lines = queueLines(buf);
|
|
8625
|
+
if (lines.length === 0) {
|
|
8626
|
+
removeQueueHead(path, buf.byteLength);
|
|
8627
|
+
return;
|
|
8628
|
+
}
|
|
8629
|
+
let removed = 0;
|
|
8630
|
+
let pendingEnd = 0;
|
|
8631
|
+
let chunk = [];
|
|
8632
|
+
let chunkBytes = 0;
|
|
8633
|
+
const deliverChunk = async () => {
|
|
8634
|
+
const body = `${chunk.join(`
|
|
8635
|
+
`)}
|
|
8636
|
+
`;
|
|
8637
|
+
args.keepLock();
|
|
8638
|
+
await postChunk(webhookUrl, headers, body, fetchTimeoutMs, totals.chunks);
|
|
8639
|
+
totals.chunks += 1;
|
|
8640
|
+
totals.lineCount += chunk.length;
|
|
8641
|
+
totals.bytes += Buffer.byteLength(body, "utf8");
|
|
8642
|
+
removeQueueHead(path, pendingEnd - removed);
|
|
8643
|
+
removed = pendingEnd;
|
|
8644
|
+
chunk = [];
|
|
8645
|
+
chunkBytes = 0;
|
|
8646
|
+
};
|
|
8647
|
+
const setAside = async (reason, status, identity, line) => {
|
|
8648
|
+
if (chunk.length > 0)
|
|
8649
|
+
await deliverChunk();
|
|
8650
|
+
rejectLine(rejectedPath, reason, status, identity, line.raw);
|
|
8651
|
+
totals.rejected += 1;
|
|
8652
|
+
pendingEnd = line.end;
|
|
8653
|
+
removeQueueHead(path, pendingEnd - removed);
|
|
8654
|
+
removed = pendingEnd;
|
|
8655
|
+
};
|
|
8656
|
+
for (const line of lines) {
|
|
8657
|
+
const record = classifyStoredLine(line.raw, homedir2());
|
|
8658
|
+
if (record.status !== "ok") {
|
|
8659
|
+
await setAside(record.reason, record.status, record.identity, line);
|
|
8660
|
+
continue;
|
|
8661
|
+
}
|
|
8662
|
+
const lineBytes = Buffer.byteLength(record.postLine, "utf8") + 1;
|
|
8663
|
+
if (lineBytes > MAX_WEBHOOK_BODY_BYTES) {
|
|
8664
|
+
await setAside(`one line is ${lineBytes} byte(s), over the ${MAX_WEBHOOK_BODY_BYTES}-byte per-POST cap — no chunking can carry it`, "too_large", record.identity, line);
|
|
8665
|
+
continue;
|
|
8666
|
+
}
|
|
8667
|
+
if (chunk.length > 0 && chunkBytes + lineBytes > MAX_WEBHOOK_BODY_BYTES)
|
|
8668
|
+
await deliverChunk();
|
|
8669
|
+
chunk.push(record.postLine);
|
|
8670
|
+
chunkBytes += lineBytes;
|
|
8671
|
+
pendingEnd = line.end;
|
|
8672
|
+
}
|
|
8673
|
+
pendingEnd = buf.byteLength;
|
|
8674
|
+
if (chunk.length > 0) {
|
|
8675
|
+
await deliverChunk();
|
|
8676
|
+
return;
|
|
8677
|
+
}
|
|
8678
|
+
if (pendingEnd > removed)
|
|
8679
|
+
removeQueueHead(path, pendingEnd - removed);
|
|
8680
|
+
}
|
|
8681
|
+
async function drainRenamedAside(args, livePath, source) {
|
|
8682
|
+
args.keepLock();
|
|
8683
|
+
const draining = drainingPathFor(livePath);
|
|
8684
|
+
try {
|
|
8685
|
+
renameSync(source, draining);
|
|
8686
|
+
} catch (err) {
|
|
8687
|
+
if (isEnoent(err))
|
|
8688
|
+
return;
|
|
8689
|
+
throw err;
|
|
8690
|
+
}
|
|
8691
|
+
await drainQueueFile({ ...args, path: draining });
|
|
8692
|
+
unlinkSync(draining);
|
|
8693
|
+
}
|
|
8694
|
+
async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeoutMs = WEBHOOK_FETCH_TIMEOUT_MS) {
|
|
8695
|
+
const resolved = await resolveRepo();
|
|
8696
|
+
const repo = resolved && isSafeRepoSegment2(resolved.owner) && isSafeRepoSegment2(resolved.repo) ? resolved : null;
|
|
8697
|
+
const outboxRoot = () => join7(GLOBAL_VINAYA_HOME, "outbox");
|
|
8698
|
+
const path = outboxPathFor({ outboxRoot }, repo, outboxTask);
|
|
8699
|
+
const lockPath = `${path}.flush-lock`;
|
|
8700
|
+
const lockToken = acquireDrainLock(lockPath);
|
|
8701
|
+
const totals = { lineCount: 0, bytes: 0, chunks: 0, rejected: 0 };
|
|
8702
|
+
if (lockToken === null)
|
|
8703
|
+
return { flushed: false, ...totals };
|
|
8704
|
+
try {
|
|
8705
|
+
const keepLock = () => {
|
|
8706
|
+
if (renewDrainLock(lockPath, lockToken))
|
|
8707
|
+
return;
|
|
8708
|
+
throw new WebhookDrainError("log-webhook-drain-lock-lost", `log webhook drain: this drain's lock on ${lockPath} was taken over by another process — stopping here; that process delivers the rest`);
|
|
8709
|
+
};
|
|
8710
|
+
const shared = {
|
|
8711
|
+
rejectedPath: rejectedPathFor(path),
|
|
8712
|
+
webhookUrl,
|
|
8713
|
+
headers,
|
|
8714
|
+
fetchTimeoutMs,
|
|
8715
|
+
totals,
|
|
8716
|
+
keepLock
|
|
8717
|
+
};
|
|
8718
|
+
const draining = drainingPathFor(path);
|
|
8719
|
+
if (queueBucketSize(draining) !== null) {
|
|
8720
|
+
keepLock();
|
|
8721
|
+
await drainQueueFile({ ...shared, path: draining });
|
|
8722
|
+
unlinkSync(draining);
|
|
8723
|
+
}
|
|
8724
|
+
await drainRenamedAside(shared, path, backupPathFor(path));
|
|
8725
|
+
await drainRenamedAside(shared, path, path);
|
|
8726
|
+
return { flushed: totals.chunks > 0 || totals.rejected > 0, ...totals };
|
|
8727
|
+
} finally {
|
|
8728
|
+
releaseDrainLock(lockPath, lockToken);
|
|
8729
|
+
}
|
|
8730
|
+
}
|
|
8731
|
+
|
|
8732
|
+
// src/lib/log-sink.ts
|
|
8733
|
+
var OUTBOX_MAX_BYTES = 8 * 1024 * 1024;
|
|
8734
|
+
var LOG_CONTEXT_LOOKUP_DEADLINE_MS = 3000;
|
|
8735
|
+
function withDeadline(work, ms, fallback) {
|
|
8736
|
+
return new Promise((resolve) => {
|
|
8737
|
+
const timer = setTimeout(() => resolve(fallback), ms);
|
|
8738
|
+
timer.unref?.();
|
|
8739
|
+
work.then((value) => {
|
|
8740
|
+
clearTimeout(timer);
|
|
8741
|
+
resolve(value);
|
|
8742
|
+
}, () => {
|
|
8743
|
+
clearTimeout(timer);
|
|
8744
|
+
resolve(fallback);
|
|
8745
|
+
});
|
|
8746
|
+
});
|
|
8747
|
+
}
|
|
8748
|
+
async function safeLoadTrustAnchorConfig() {
|
|
8749
|
+
return withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
8750
|
+
}
|
|
8751
|
+
function logsCredentialMissing(headers, env) {
|
|
8752
|
+
if (!headers)
|
|
8753
|
+
return false;
|
|
8754
|
+
const varPattern = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
|
|
8755
|
+
for (const value of Object.values(headers)) {
|
|
8756
|
+
for (const match of value.matchAll(varPattern)) {
|
|
8757
|
+
if (!env[match[1]])
|
|
8758
|
+
return true;
|
|
8759
|
+
}
|
|
8760
|
+
}
|
|
8761
|
+
return false;
|
|
8762
|
+
}
|
|
8763
|
+
function resolveLogDestinationFrom(input) {
|
|
8764
|
+
const local = resolveLogsSetting(input.localConfig);
|
|
8765
|
+
let effective = null;
|
|
8766
|
+
if (input.unattended) {
|
|
8767
|
+
effective = local ? resolveTrustAnchorLogsDestination(local, input.trustAnchorConfig) : resolveLogsSetting(input.trustAnchorConfig);
|
|
8768
|
+
} else {
|
|
8769
|
+
effective = local;
|
|
8770
|
+
}
|
|
8771
|
+
if (hostFromEnv(input.env) === "ci") {
|
|
8772
|
+
if (effective && "url" in effective) {
|
|
8773
|
+
if (logsCredentialMissing(effective.headers, input.env)) {
|
|
8774
|
+
return {
|
|
8775
|
+
kind: "none",
|
|
8776
|
+
reason: "a logs.url server destination is configured, but this job holds no delivery credential (a fork pull request, or a missing repository secret)"
|
|
8777
|
+
};
|
|
8778
|
+
}
|
|
8779
|
+
return { kind: "server", url: effective.url, headers: resolveLogsHeaderValues(effective.headers, input.env) };
|
|
8780
|
+
}
|
|
8781
|
+
return {
|
|
8782
|
+
kind: "none",
|
|
8783
|
+
reason: "no server destination is configured for CI delivery (vinaya.config.json logs.url)"
|
|
8784
|
+
};
|
|
8785
|
+
}
|
|
8786
|
+
if (effective && "url" in effective) {
|
|
8787
|
+
return { kind: "server", url: effective.url, headers: resolveLogsHeaderValues(effective.headers, input.env) };
|
|
8788
|
+
}
|
|
8789
|
+
if (effective && "folder" in effective && isInsideRepo(effective.folder, input.repoRoot)) {
|
|
8790
|
+
effective = null;
|
|
8791
|
+
}
|
|
8792
|
+
const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
|
|
8793
|
+
return { kind: "folder", folder };
|
|
8794
|
+
}
|
|
8795
|
+
var processTrustAnchorOnce;
|
|
8796
|
+
function processTrustAnchor() {
|
|
8797
|
+
if (processTrustAnchorOnce === undefined)
|
|
8798
|
+
processTrustAnchorOnce = safeLoadTrustAnchorConfig();
|
|
8799
|
+
return processTrustAnchorOnce;
|
|
8800
|
+
}
|
|
8801
|
+
async function defaultResolveLogDestination(repo, env) {
|
|
8802
|
+
const localConfig = loadConfig();
|
|
8803
|
+
const unattended = isUnattendedProcess(process.env);
|
|
8804
|
+
return resolveLogDestinationFrom({
|
|
8805
|
+
localConfig,
|
|
8806
|
+
trustAnchorConfig: unattended ? await processTrustAnchor() : null,
|
|
8807
|
+
unattended,
|
|
8808
|
+
env,
|
|
8809
|
+
defaultFolder: join8(await runtimeDirForRepoAsync(repo), "logs"),
|
|
8810
|
+
repoRoot: repoRootSync()
|
|
8811
|
+
});
|
|
8812
|
+
}
|
|
8813
|
+
function isEnoent2(err) {
|
|
8097
8814
|
return typeof err === "object" && err !== null && err.code === "ENOENT";
|
|
8098
8815
|
}
|
|
8099
|
-
|
|
8816
|
+
var execFileAsync5 = promisify5(execFile5);
|
|
8817
|
+
async function resolveDoctrine(cwd, vinayaVersion) {
|
|
8100
8818
|
let toplevel;
|
|
8101
8819
|
try {
|
|
8102
|
-
toplevel =
|
|
8103
|
-
encoding: "utf8",
|
|
8104
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
8105
|
-
}).trim();
|
|
8820
|
+
toplevel = (await execFileAsync5("git", ["-C", cwd, "rev-parse", "--show-toplevel"], { encoding: "utf8" })).stdout.trim();
|
|
8106
8821
|
} catch (err) {
|
|
8107
|
-
return
|
|
8822
|
+
return isEnoent2(err) ? "unknown" : vinayaVersion;
|
|
8108
8823
|
}
|
|
8109
|
-
if (!
|
|
8824
|
+
if (!existsSync7(join8(toplevel, "aeg-root", "roles")))
|
|
8110
8825
|
return vinayaVersion;
|
|
8111
8826
|
try {
|
|
8112
|
-
const sha =
|
|
8113
|
-
encoding: "utf8",
|
|
8114
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
8115
|
-
}).trim();
|
|
8827
|
+
const sha = (await execFileAsync5("git", ["-C", toplevel, "rev-parse", "HEAD:aeg-root"], { encoding: "utf8" })).stdout.trim();
|
|
8116
8828
|
return `aeg-root@${sha}`;
|
|
8117
8829
|
} catch {
|
|
8118
8830
|
return vinayaVersion;
|
|
@@ -8120,20 +8832,20 @@ function resolveDoctrine(cwd, vinayaVersion) {
|
|
|
8120
8832
|
}
|
|
8121
8833
|
function readVinayaVersion() {
|
|
8122
8834
|
try {
|
|
8123
|
-
const pkg = JSON.parse(
|
|
8835
|
+
const pkg = JSON.parse(readFileSync6(join8(packageRoot(import.meta.url), "package.json"), "utf8"));
|
|
8124
8836
|
return pkg.version ?? "unknown";
|
|
8125
8837
|
} catch {
|
|
8126
8838
|
return "unknown";
|
|
8127
8839
|
}
|
|
8128
8840
|
}
|
|
8129
|
-
var
|
|
8130
|
-
function
|
|
8131
|
-
return
|
|
8841
|
+
var SAFE_PATH_SEGMENT3 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
8842
|
+
function isSafeRepoSegment3(segment) {
|
|
8843
|
+
return SAFE_PATH_SEGMENT3.test(segment) && !segment.includes("..");
|
|
8132
8844
|
}
|
|
8133
8845
|
function outboxPathFor(deps, repo, issue) {
|
|
8134
8846
|
const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
8135
8847
|
const fileName = `${issue ?? "none"}.ndjson`;
|
|
8136
|
-
return
|
|
8848
|
+
return join8(deps.outboxRoot(), dirName, fileName);
|
|
8137
8849
|
}
|
|
8138
8850
|
function hostFromEnv(env) {
|
|
8139
8851
|
if (env.GITHUB_ACTIONS)
|
|
@@ -8144,36 +8856,60 @@ function hostFromEnv(env) {
|
|
|
8144
8856
|
return "loop";
|
|
8145
8857
|
return "cli";
|
|
8146
8858
|
}
|
|
8859
|
+
var warnedThisProcess = false;
|
|
8860
|
+
function defaultStderr(message) {
|
|
8861
|
+
if (warnedThisProcess)
|
|
8862
|
+
return;
|
|
8863
|
+
warnedThisProcess = true;
|
|
8864
|
+
process.stderr.write(message);
|
|
8865
|
+
}
|
|
8147
8866
|
function defaultDeps() {
|
|
8148
8867
|
return {
|
|
8149
|
-
outboxRoot: () =>
|
|
8150
|
-
home: () =>
|
|
8868
|
+
outboxRoot: () => join8(GLOBAL_VINAYA_HOME, "outbox"),
|
|
8869
|
+
home: () => homedir3(),
|
|
8151
8870
|
hostname: () => osHostname(),
|
|
8152
8871
|
cwd: () => process.cwd(),
|
|
8153
8872
|
now: () => new Date,
|
|
8154
8873
|
env: () => process.env,
|
|
8155
8874
|
resolveRepo: () => resolveRepo(),
|
|
8156
8875
|
vinayaVersion: () => readVinayaVersion(),
|
|
8157
|
-
stderr:
|
|
8158
|
-
process.stderr.write(message);
|
|
8159
|
-
},
|
|
8876
|
+
stderr: defaultStderr,
|
|
8160
8877
|
inputVersions: () => {
|
|
8161
8878
|
return;
|
|
8162
|
-
}
|
|
8879
|
+
},
|
|
8880
|
+
resolveLogDestination: defaultResolveLogDestination
|
|
8163
8881
|
};
|
|
8164
8882
|
}
|
|
8165
|
-
var APPEND_OPEN_FLAGS =
|
|
8883
|
+
var APPEND_OPEN_FLAGS = fsConstants3.O_WRONLY | fsConstants3.O_APPEND | fsConstants3.O_CREAT | fsConstants3.O_NOFOLLOW | fsConstants3.O_NONBLOCK;
|
|
8166
8884
|
function guardedAppendOpen(path) {
|
|
8167
8885
|
try {
|
|
8168
|
-
return
|
|
8886
|
+
return openSync3(path, APPEND_OPEN_FLAGS, 384);
|
|
8169
8887
|
} catch {
|
|
8170
8888
|
return;
|
|
8171
8889
|
}
|
|
8172
8890
|
}
|
|
8891
|
+
function appendHardenedLine(path, line) {
|
|
8892
|
+
try {
|
|
8893
|
+
mkdirSync3(dirname6(path), { recursive: true, mode: 448 });
|
|
8894
|
+
const fd = guardedAppendOpen(path);
|
|
8895
|
+
if (fd === undefined)
|
|
8896
|
+
return `target could not be opened (symlink, FIFO, or unwritable): ${path}`;
|
|
8897
|
+
try {
|
|
8898
|
+
if (!fstatSync2(fd).isFile())
|
|
8899
|
+
return `target is not a regular file: ${path}`;
|
|
8900
|
+
writeSync2(fd, line);
|
|
8901
|
+
} finally {
|
|
8902
|
+
closeSync3(fd);
|
|
8903
|
+
}
|
|
8904
|
+
return null;
|
|
8905
|
+
} catch (err) {
|
|
8906
|
+
return err instanceof Error ? err.message : String(err);
|
|
8907
|
+
}
|
|
8908
|
+
}
|
|
8173
8909
|
function reportRotationOverflow(backupPath, warn) {
|
|
8174
8910
|
let raw;
|
|
8175
8911
|
try {
|
|
8176
|
-
raw =
|
|
8912
|
+
raw = readFileSync6(backupPath, "utf8");
|
|
8177
8913
|
} catch {
|
|
8178
8914
|
return;
|
|
8179
8915
|
}
|
|
@@ -8196,7 +8932,7 @@ function reportRotationOverflow(backupPath, warn) {
|
|
|
8196
8932
|
}
|
|
8197
8933
|
function appendLine(path, line, warn) {
|
|
8198
8934
|
try {
|
|
8199
|
-
|
|
8935
|
+
mkdirSync3(dirname6(path), { recursive: true, mode: 448 });
|
|
8200
8936
|
let fd = guardedAppendOpen(path);
|
|
8201
8937
|
if (fd === undefined) {
|
|
8202
8938
|
warn(`vinaya: log outbox target could not be opened (symlink, FIFO, or unwritable) — refusing: ${path}
|
|
@@ -8212,11 +8948,11 @@ function appendLine(path, line, warn) {
|
|
|
8212
8948
|
return;
|
|
8213
8949
|
}
|
|
8214
8950
|
if (stat.size > OUTBOX_MAX_BYTES) {
|
|
8215
|
-
|
|
8951
|
+
closeSync3(fd);
|
|
8216
8952
|
closed = true;
|
|
8217
8953
|
const backupPath = path.replace(/\.ndjson$/, ".1.ndjson");
|
|
8218
8954
|
reportRotationOverflow(backupPath, warn);
|
|
8219
|
-
|
|
8955
|
+
renameSync2(path, backupPath);
|
|
8220
8956
|
const rotated = guardedAppendOpen(path);
|
|
8221
8957
|
if (rotated === undefined) {
|
|
8222
8958
|
warn(`vinaya: log outbox target could not be reopened after rotation — refusing: ${path}
|
|
@@ -8226,10 +8962,10 @@ function appendLine(path, line, warn) {
|
|
|
8226
8962
|
fd = rotated;
|
|
8227
8963
|
closed = false;
|
|
8228
8964
|
}
|
|
8229
|
-
|
|
8965
|
+
writeSync2(fd, line);
|
|
8230
8966
|
} finally {
|
|
8231
8967
|
if (!closed)
|
|
8232
|
-
|
|
8968
|
+
closeSync3(fd);
|
|
8233
8969
|
}
|
|
8234
8970
|
} catch (err) {
|
|
8235
8971
|
warn(`vinaya: log outbox write failed — ${err instanceof Error ? err.message : String(err)}
|
|
@@ -8238,8 +8974,8 @@ function appendLine(path, line, warn) {
|
|
|
8238
8974
|
}
|
|
8239
8975
|
function createLogSink(overrides = {}) {
|
|
8240
8976
|
const deps = { ...defaultDeps(), ...overrides };
|
|
8241
|
-
const runId = deps.env().VINAYA_RUN_ID ||
|
|
8242
|
-
const processId =
|
|
8977
|
+
const runId = deps.env().VINAYA_RUN_ID || randomUUID2();
|
|
8978
|
+
const processId = randomUUID2();
|
|
8243
8979
|
let seq = 0;
|
|
8244
8980
|
let warned = false;
|
|
8245
8981
|
const warnOnce = (message) => {
|
|
@@ -8252,8 +8988,9 @@ function createLogSink(overrides = {}) {
|
|
|
8252
8988
|
};
|
|
8253
8989
|
let doctrineCache;
|
|
8254
8990
|
const doctrine = () => {
|
|
8255
|
-
if (doctrineCache === undefined)
|
|
8256
|
-
doctrineCache = resolveDoctrine(deps.cwd(), deps.vinayaVersion());
|
|
8991
|
+
if (doctrineCache === undefined) {
|
|
8992
|
+
doctrineCache = withDeadline(resolveDoctrine(deps.cwd(), deps.vinayaVersion()), LOG_CONTEXT_LOOKUP_DEADLINE_MS, deps.vinayaVersion());
|
|
8993
|
+
}
|
|
8257
8994
|
return doctrineCache;
|
|
8258
8995
|
};
|
|
8259
8996
|
let resolveRepoCache;
|
|
@@ -8262,6 +8999,30 @@ function createLogSink(overrides = {}) {
|
|
|
8262
8999
|
resolveRepoCache = deps.resolveRepo();
|
|
8263
9000
|
return resolveRepoCache;
|
|
8264
9001
|
};
|
|
9002
|
+
let contextCache;
|
|
9003
|
+
const context = () => {
|
|
9004
|
+
if (contextCache === undefined) {
|
|
9005
|
+
const env = deps.env();
|
|
9006
|
+
contextCache = Promise.all([
|
|
9007
|
+
withDeadline(resolveRepoOnce(), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null),
|
|
9008
|
+
doctrine()
|
|
9009
|
+
]).then(async ([resolved, doctrineValue]) => {
|
|
9010
|
+
const repo = resolved && isSafeRepoSegment3(resolved.owner) && isSafeRepoSegment3(resolved.repo) ? resolved : null;
|
|
9011
|
+
return { repo, doctrine: doctrineValue, destination: await deps.resolveLogDestination(repo, env) };
|
|
9012
|
+
});
|
|
9013
|
+
}
|
|
9014
|
+
return contextCache;
|
|
9015
|
+
};
|
|
9016
|
+
let drainChain = Promise.resolve();
|
|
9017
|
+
const pendingWrites = new Set;
|
|
9018
|
+
const scheduleWebhookDrain = (issue, url, headers) => {
|
|
9019
|
+
drainChain = drainChain.then(() => drainOutboxToWebhook(issue, url, headers)).then(() => {
|
|
9020
|
+
return;
|
|
9021
|
+
}).catch((err) => {
|
|
9022
|
+
warnOnce(`vinaya: log delivery to ${url} failed — queued in the local outbox, retried on the next event: ${err instanceof Error ? err.message : String(err)}
|
|
9023
|
+
`);
|
|
9024
|
+
});
|
|
9025
|
+
};
|
|
8265
9026
|
function log(e) {
|
|
8266
9027
|
try {
|
|
8267
9028
|
const env = deps.env();
|
|
@@ -8276,22 +9037,26 @@ function createLogSink(overrides = {}) {
|
|
|
8276
9037
|
attempt: env.VINAYA_ATTEMPT,
|
|
8277
9038
|
parent: env.VINAYA_PARENT_EVENT
|
|
8278
9039
|
};
|
|
8279
|
-
|
|
8280
|
-
const repo = resolved && isSafeRepoSegment(resolved.owner) && isSafeRepoSegment(resolved.repo) ? resolved : null;
|
|
9040
|
+
const written = context().then(({ repo, doctrine: doctrineValue, destination: resolvedDestination }) => {
|
|
8281
9041
|
const header = buildHeader({
|
|
8282
9042
|
now,
|
|
8283
9043
|
runId,
|
|
8284
9044
|
seq: mySeq,
|
|
8285
9045
|
repo: repo ? `${repo.owner}/${repo.repo}` : null,
|
|
8286
9046
|
vinaya: deps.vinayaVersion(),
|
|
8287
|
-
doctrine:
|
|
9047
|
+
doctrine: doctrineValue,
|
|
8288
9048
|
host,
|
|
8289
9049
|
hostname: deps.hostname(),
|
|
8290
9050
|
env: envFields,
|
|
8291
|
-
eventId:
|
|
9051
|
+
eventId: randomUUID2(),
|
|
8292
9052
|
processId,
|
|
8293
9053
|
inputVersions: deps.inputVersions()
|
|
8294
9054
|
});
|
|
9055
|
+
if (resolvedDestination.kind === "none") {
|
|
9056
|
+
warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
|
|
9057
|
+
`);
|
|
9058
|
+
return;
|
|
9059
|
+
}
|
|
8295
9060
|
const full = { ...e, ...header };
|
|
8296
9061
|
const parsed = LogEventSchema.safeParse(full);
|
|
8297
9062
|
if (!parsed.success) {
|
|
@@ -8301,25 +9066,42 @@ function createLogSink(overrides = {}) {
|
|
|
8301
9066
|
}
|
|
8302
9067
|
const line = `${JSON.stringify(redact(parsed.data, deps.home()))}
|
|
8303
9068
|
`;
|
|
8304
|
-
|
|
9069
|
+
const destination = resolvedDestination;
|
|
9070
|
+
if (destination.kind === "server") {
|
|
9071
|
+
appendLine(outboxPathFor(deps, repo, header.subject.issue), line, warnOnce);
|
|
9072
|
+
scheduleWebhookDrain(header.subject.issue, destination.url, destination.headers);
|
|
9073
|
+
} else {
|
|
9074
|
+
appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
|
|
9075
|
+
}
|
|
8305
9076
|
}).catch((err) => {
|
|
8306
9077
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
8307
9078
|
`);
|
|
8308
9079
|
});
|
|
9080
|
+
pendingWrites.add(written);
|
|
9081
|
+
written.finally(() => pendingWrites.delete(written));
|
|
8309
9082
|
} catch (err) {
|
|
8310
9083
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
8311
9084
|
`);
|
|
8312
9085
|
}
|
|
8313
9086
|
}
|
|
8314
9087
|
const warmup = () => {
|
|
8315
|
-
doctrine();
|
|
8316
9088
|
const originalWarn = console.warn;
|
|
8317
9089
|
console.warn = () => {};
|
|
8318
9090
|
resolveRepoOnce().finally(() => {
|
|
8319
9091
|
console.warn = originalWarn;
|
|
8320
9092
|
});
|
|
9093
|
+
context().catch(() => {
|
|
9094
|
+
return;
|
|
9095
|
+
});
|
|
9096
|
+
};
|
|
9097
|
+
const drain = async () => {
|
|
9098
|
+
if (pendingWrites.size > 0)
|
|
9099
|
+
await Promise.allSettled(Array.from(pendingWrites));
|
|
9100
|
+
await drainChain.catch(() => {
|
|
9101
|
+
return;
|
|
9102
|
+
});
|
|
8321
9103
|
};
|
|
8322
|
-
return { log, runId, warmup };
|
|
9104
|
+
return { log, runId, warmup, drain };
|
|
8323
9105
|
}
|
|
8324
9106
|
var defaultSink = createLogSink();
|
|
8325
9107
|
|
|
@@ -8363,7 +9145,7 @@ function parseChangedLineRanges(diffOutput) {
|
|
|
8363
9145
|
function fileDiffAgainst(ref, path) {
|
|
8364
9146
|
let out;
|
|
8365
9147
|
try {
|
|
8366
|
-
out =
|
|
9148
|
+
out = execFileSync6("git", ["diff", `${ref}...HEAD`, "--", path], {
|
|
8367
9149
|
encoding: "utf8",
|
|
8368
9150
|
stdio: ["ignore", "pipe", "pipe"]
|
|
8369
9151
|
}).trim();
|
|
@@ -8374,7 +9156,7 @@ function fileDiffAgainst(ref, path) {
|
|
|
8374
9156
|
}
|
|
8375
9157
|
function revParse(ref) {
|
|
8376
9158
|
try {
|
|
8377
|
-
return
|
|
9159
|
+
return execFileSync6("git", ["rev-parse", "--verify", ref], {
|
|
8378
9160
|
encoding: "utf8",
|
|
8379
9161
|
stdio: ["ignore", "pipe", "pipe"]
|
|
8380
9162
|
}).trim();
|
|
@@ -8384,7 +9166,7 @@ function revParse(ref) {
|
|
|
8384
9166
|
}
|
|
8385
9167
|
function repoRoot() {
|
|
8386
9168
|
try {
|
|
8387
|
-
return
|
|
9169
|
+
return execFileSync6("git", ["rev-parse", "--show-toplevel"], {
|
|
8388
9170
|
encoding: "utf8",
|
|
8389
9171
|
stdio: ["ignore", "pipe", "pipe"]
|
|
8390
9172
|
}).trim();
|
|
@@ -8395,7 +9177,7 @@ function repoRoot() {
|
|
|
8395
9177
|
function changedFiles(base) {
|
|
8396
9178
|
let out;
|
|
8397
9179
|
try {
|
|
8398
|
-
out =
|
|
9180
|
+
out = execFileSync6("git", ["diff", "--name-only", `${base}...HEAD`], {
|
|
8399
9181
|
encoding: "utf8",
|
|
8400
9182
|
stdio: ["ignore", "pipe", "pipe"]
|
|
8401
9183
|
}).trim();
|
|
@@ -8420,7 +9202,7 @@ function resolveDiff(base = process.env.BASE_SHA || "origin/main") {
|
|
|
8420
9202
|
const relPaths = changedFiles(ref);
|
|
8421
9203
|
if (relPaths === null)
|
|
8422
9204
|
continue;
|
|
8423
|
-
return { base: ref, root, files: relPaths.map((p) =>
|
|
9205
|
+
return { base: ref, root, files: relPaths.map((p) => join9(root, p)) };
|
|
8424
9206
|
}
|
|
8425
9207
|
return null;
|
|
8426
9208
|
}
|
|
@@ -8459,7 +9241,7 @@ function resolveCheckDoctrineRoot() {
|
|
|
8459
9241
|
return proseGates.doctrineRoot;
|
|
8460
9242
|
const root = repoRoot();
|
|
8461
9243
|
if (root !== null) {
|
|
8462
|
-
const candidate =
|
|
9244
|
+
const candidate = join10(root, "aeg-root");
|
|
8463
9245
|
if (hasDoctrineEntry(candidate))
|
|
8464
9246
|
return candidate;
|
|
8465
9247
|
}
|
|
@@ -8477,15 +9259,15 @@ var SPEC_GRANDFATHER = proseGates?.specGrandfather ?? [];
|
|
|
8477
9259
|
function collect(dir, out = []) {
|
|
8478
9260
|
let entries;
|
|
8479
9261
|
try {
|
|
8480
|
-
entries =
|
|
9262
|
+
entries = readdirSync3(dir);
|
|
8481
9263
|
} catch {
|
|
8482
9264
|
return out;
|
|
8483
9265
|
}
|
|
8484
9266
|
for (const name of entries) {
|
|
8485
|
-
const full =
|
|
9267
|
+
const full = join10(dir, name);
|
|
8486
9268
|
let isDir;
|
|
8487
9269
|
try {
|
|
8488
|
-
isDir =
|
|
9270
|
+
isDir = statSync2(full).isDirectory();
|
|
8489
9271
|
} catch {
|
|
8490
9272
|
continue;
|
|
8491
9273
|
}
|
|
@@ -8500,16 +9282,16 @@ function collect(dir, out = []) {
|
|
|
8500
9282
|
return out;
|
|
8501
9283
|
}
|
|
8502
9284
|
function readAll(paths) {
|
|
8503
|
-
return paths.map((p) => ({ path: p, content:
|
|
9285
|
+
return paths.map((p) => ({ path: p, content: readFileSync7(p, "utf8") }));
|
|
8504
9286
|
}
|
|
8505
9287
|
var PRODUCT_SCOPE_EXTENSIONS = new Set([".ts", ".tsx", ".yml", ".md"]);
|
|
8506
9288
|
function collectProductScopeFiles(root) {
|
|
8507
9289
|
const out = [];
|
|
8508
9290
|
for (const prefix of PRODUCT_SLUG_SCOPE) {
|
|
8509
|
-
const abs =
|
|
9291
|
+
const abs = join10(root, prefix);
|
|
8510
9292
|
let isDir;
|
|
8511
9293
|
try {
|
|
8512
|
-
isDir =
|
|
9294
|
+
isDir = statSync2(abs).isDirectory();
|
|
8513
9295
|
} catch {
|
|
8514
9296
|
continue;
|
|
8515
9297
|
}
|
|
@@ -8526,16 +9308,16 @@ function collectProductScopeFiles(root) {
|
|
|
8526
9308
|
return out;
|
|
8527
9309
|
}
|
|
8528
9310
|
function readProductFiles(root, relPaths) {
|
|
8529
|
-
return relPaths.map((rel) => ({ path: rel, content:
|
|
9311
|
+
return relPaths.map((rel) => ({ path: rel, content: readFileSync7(join10(root, rel), "utf8") }));
|
|
8530
9312
|
}
|
|
8531
9313
|
function collectSpecFiles(root) {
|
|
8532
9314
|
const out = [];
|
|
8533
|
-
const appsDir =
|
|
9315
|
+
const appsDir = join10(root, "apps");
|
|
8534
9316
|
let appNames;
|
|
8535
9317
|
try {
|
|
8536
|
-
appNames =
|
|
9318
|
+
appNames = readdirSync3(appsDir).filter((name) => {
|
|
8537
9319
|
try {
|
|
8538
|
-
return
|
|
9320
|
+
return statSync2(join10(appsDir, name)).isDirectory();
|
|
8539
9321
|
} catch {
|
|
8540
9322
|
return false;
|
|
8541
9323
|
}
|
|
@@ -8544,10 +9326,10 @@ function collectSpecFiles(root) {
|
|
|
8544
9326
|
return out;
|
|
8545
9327
|
}
|
|
8546
9328
|
for (const app of appNames) {
|
|
8547
|
-
const specsDir =
|
|
9329
|
+
const specsDir = join10(appsDir, app, "specs");
|
|
8548
9330
|
let isDir;
|
|
8549
9331
|
try {
|
|
8550
|
-
isDir =
|
|
9332
|
+
isDir = statSync2(specsDir).isDirectory();
|
|
8551
9333
|
} catch {
|
|
8552
9334
|
continue;
|
|
8553
9335
|
}
|
|
@@ -8564,10 +9346,10 @@ function collectSpecFiles(root) {
|
|
|
8564
9346
|
function collectSourceCommentFiles(root, globs) {
|
|
8565
9347
|
const out = [];
|
|
8566
9348
|
for (const prefix of globs) {
|
|
8567
|
-
const abs =
|
|
9349
|
+
const abs = join10(root, prefix);
|
|
8568
9350
|
let isDir;
|
|
8569
9351
|
try {
|
|
8570
|
-
isDir =
|
|
9352
|
+
isDir = statSync2(abs).isDirectory();
|
|
8571
9353
|
} catch {
|
|
8572
9354
|
continue;
|
|
8573
9355
|
}
|
|
@@ -8584,10 +9366,10 @@ function collectSourceCommentFiles(root, globs) {
|
|
|
8584
9366
|
return out;
|
|
8585
9367
|
}
|
|
8586
9368
|
function legacySlugs(legacySlugDir) {
|
|
8587
|
-
if (!
|
|
9369
|
+
if (!existsSync8(legacySlugDir))
|
|
8588
9370
|
return { slugs: [], dormant: true };
|
|
8589
9371
|
try {
|
|
8590
|
-
const slugs =
|
|
9372
|
+
const slugs = readdirSync3(legacySlugDir).filter((f) => f.endsWith(".md") && !f.endsWith(".tokens.md")).map((f) => f.slice(0, -3)).filter((slug) => !/-v[0-9]+$/.test(slug));
|
|
8591
9373
|
return { slugs, dormant: false };
|
|
8592
9374
|
} catch (err) {
|
|
8593
9375
|
console.log(`${CHECK_NAME}: could not read ${legacySlugDir} (${err instanceof Error ? err.message : String(err)}) — legacy-slug class treated as dormant.`);
|
|
@@ -8617,8 +9399,8 @@ function main() {
|
|
|
8617
9399
|
const specRelPaths = collectSpecFiles(productRoot);
|
|
8618
9400
|
const specFiles = readProductFiles(productRoot, specRelPaths);
|
|
8619
9401
|
const files = [...readAll([...shipsPaths, ...readerFacingPaths]), ...productFiles, ...specFiles];
|
|
8620
|
-
const glossaryPath =
|
|
8621
|
-
const glossaryTerms =
|
|
9402
|
+
const glossaryPath = join10(DOCTRINE_ROOT, "glossary.md");
|
|
9403
|
+
const glossaryTerms = existsSync8(glossaryPath) ? parseGlossaryTerms(readFileSync7(glossaryPath, "utf8")) : [];
|
|
8622
9404
|
const legacySlugDir = LEGACY_SLUG_DIR ?? `${DOCTRINE_ROOT}/tranches/completed`;
|
|
8623
9405
|
const { slugs, dormant: legacySlugsDormant } = legacySlugs(legacySlugDir);
|
|
8624
9406
|
const readerFacingPrefix = READER_FACING_ACTIVE && READER_FACING_PREFIX !== null ? `${READER_FACING_PREFIX}/` : "/no-reader-facing-surface";
|