@attalabs/vinaya 0.32.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 +1 -1
- package/aeg-root/contracts/principal-operator.md +18 -5
- 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/dist/checks/bin/check-body-bare-digits.js +111 -15
- package/dist/checks/bin/check-branch-topology.js +83 -16
- package/dist/checks/bin/check-brief-shape.js +111 -15
- package/dist/checks/bin/check-changeset-coverage.js +342 -69
- package/dist/checks/bin/check-closes-n.js +83 -16
- package/dist/checks/bin/check-coherence.js +112 -16
- package/dist/checks/bin/check-dead-branch-push.js +82 -15
- package/dist/checks/bin/check-dispatch-readiness.js +112 -16
- package/dist/checks/bin/check-doc-coverage-push.js +342 -69
- package/dist/checks/bin/check-doc-coverage.js +342 -69
- package/dist/checks/bin/check-doctrine-no-procedures.js +111 -15
- package/dist/checks/bin/check-doctrine-portability.js +342 -69
- package/dist/checks/bin/check-evidence-fresh.js +343 -69
- package/dist/checks/bin/check-exec-bits.js +342 -69
- package/dist/checks/bin/check-first-push-dispatch.js +112 -16
- package/dist/checks/bin/check-issue-assignment.js +83 -16
- package/dist/checks/bin/check-issue-milestone-attach.js +82 -15
- package/dist/checks/bin/check-issue-objectives-numbering.js +82 -15
- package/dist/checks/bin/check-issue-parts-coverage.js +82 -15
- package/dist/checks/bin/check-issue-surface-globs.js +112 -16
- package/dist/checks/bin/check-issue-title-grammar.js +82 -15
- package/dist/checks/bin/check-issue-tranche-label.js +82 -15
- package/dist/checks/bin/check-main-branch-refusal.js +82 -15
- package/dist/checks/bin/check-no-disk-state.js +82 -15
- package/dist/checks/bin/check-pr-premise-reassert.js +111 -15
- package/dist/checks/bin/check-pr-report-density.js +82 -15
- package/dist/checks/bin/check-principal-test-plan-wait.js +82 -15
- package/dist/checks/bin/check-quoted-command.js +342 -69
- package/dist/checks/bin/check-reader-resolvable-prose.js +342 -69
- package/dist/checks/bin/check-registry-gates.js +82 -15
- package/dist/checks/bin/check-retired-vocabulary.js +342 -69
- package/dist/checks/bin/check-review-gate.js +179 -124
- package/dist/checks/bin/check-single-plan-pr.js +82 -15
- package/dist/checks/bin/check-surface-scope.js +83 -16
- package/dist/checks/bin/check-test-plan.js +82 -15
- package/dist/checks/bin/check-token-collection-wired.js +82 -15
- package/dist/checks/bin/check-token-report.js +82 -15
- package/dist/checks/bin/check-workspace-escape.js +342 -69
- package/dist/index.js +2495 -590
- package/dist/lib/pre-push-cache-test-run.js +317 -61
- package/dist/lib/pre-push-select-tests.js +91 -10
- package/package.json +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/actions.ts +10 -12
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +5 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/archive-task.ts +42 -17
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/baseline-capture.ts +1 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/branch-topology-gate.ts +3 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +554 -95
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +264 -44
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/claude-code-transcript.ts +9 -9
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +211 -30
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/consumer-enumeration.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/index.ts +75 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +961 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/migration.ts +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
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The task-tool catalog — the one place a task-operator tool's name, input
|
|
3
|
+
* shape, result shape, error shape and purpose are written. Five tools:
|
|
4
|
+
* `task_status` and `task_escalation_read` are bound to a real read
|
|
5
|
+
* interface (`apps/cli/src/lib/task-tools/read.ts` and `handlers.ts` —
|
|
6
|
+
* `apps/cli` reads the outbox and the forge, `aeg-core` stays pure); `task_start`,
|
|
7
|
+
* `task_resume` and `task_cancel` are declared here but refuse with
|
|
8
|
+
* `capability_unavailable` until a control store exists to act on (Traps to
|
|
9
|
+
* avoid: an internal helper is not automatically an agent tool, and this
|
|
10
|
+
* catalog exposes no raw shell or forge access — every field below is
|
|
11
|
+
* either a schema or prose, never a live handle to a process or a write).
|
|
12
|
+
*
|
|
13
|
+
* `handlerBinding` names where each tool's behaviour actually lives; it is
|
|
14
|
+
* data (a module/export pointer), not an import — `aeg-core` has no
|
|
15
|
+
* dependency on `apps/cli`, so the binding is documentation the CLI-side
|
|
16
|
+
* registry is expected to satisfy, not a call this file can make itself.
|
|
17
|
+
*
|
|
18
|
+
* A caller-supplied `role` field is never part of any input schema below —
|
|
19
|
+
* an agent's own claim about who it is authenticates nothing (Traps to
|
|
20
|
+
* avoid); authority is a property of the transport that invokes a tool, not
|
|
21
|
+
* a value that transport lets the caller set.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { createHash } from 'node:crypto'
|
|
25
|
+
import { z } from 'zod'
|
|
26
|
+
|
|
27
|
+
// --- error taxonomy ---------------------------------------------------------
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Eight kinds, each naming a distinct reason a tool call did not produce its
|
|
31
|
+
* result: `validation` (the input itself is malformed), `authority` (the
|
|
32
|
+
* caller may not do this), `precondition` (the input is well-formed but the
|
|
33
|
+
* task is not in a state this call accepts — e.g. resuming a task with no
|
|
34
|
+
* paused run), `capability` (the tool exists in the catalog but its handler
|
|
35
|
+
* is not yet implemented — the fixed refusal `task_start`/`task_resume`/
|
|
36
|
+
* `task_cancel` return today), `infrastructure` (a read or write the tool
|
|
37
|
+
* depends on failed for reasons outside the caller's input — a file the
|
|
38
|
+
* outbox should carry could not be read), `cancellation` (a cancel request
|
|
39
|
+
* could not be honored, e.g. nothing running to cancel), `timeout` (a read
|
|
40
|
+
* exceeded its own bound), and `uncertain_effect` (a mutation was attempted
|
|
41
|
+
* and its outcome could not be confirmed — reserved for `task_start`/
|
|
42
|
+
* `task_resume`/`task_cancel` once they have a real effect to be uncertain
|
|
43
|
+
* about; no handler below returns it yet).
|
|
44
|
+
*/
|
|
45
|
+
export const TASK_TOOL_ERROR_KINDS = [
|
|
46
|
+
'validation',
|
|
47
|
+
'authority',
|
|
48
|
+
'precondition',
|
|
49
|
+
'capability',
|
|
50
|
+
'infrastructure',
|
|
51
|
+
'cancellation',
|
|
52
|
+
'timeout',
|
|
53
|
+
'uncertain_effect'
|
|
54
|
+
] as const
|
|
55
|
+
|
|
56
|
+
export type TaskToolErrorKind = (typeof TASK_TOOL_ERROR_KINDS)[number]
|
|
57
|
+
|
|
58
|
+
export const TaskToolErrorSchema = z.object({
|
|
59
|
+
kind: z.enum(TASK_TOOL_ERROR_KINDS),
|
|
60
|
+
message: z.string().min(1),
|
|
61
|
+
detail: z.string().optional()
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
export type TaskToolError = z.infer<typeof TaskToolErrorSchema>
|
|
65
|
+
|
|
66
|
+
export function taskToolError(kind: TaskToolErrorKind, message: string, detail?: string): TaskToolError {
|
|
67
|
+
return detail === undefined ? { kind, message } : { kind, message, detail }
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** The one error every not-yet-landed mutating tool returns — same kind, same message shape, so a caller routing on `kind` never has to special-case which of the three it called. */
|
|
71
|
+
export function capabilityUnavailable(tool: TaskToolName, becauseOf: string): TaskToolError {
|
|
72
|
+
return taskToolError('capability', `${tool} is not available yet — ${becauseOf}.`)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// --- shared primitives -------------------------------------------------------
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The two identity shapes every task-referencing tool accepts — a
|
|
79
|
+
* tranche-labeled task (`{ tranche, id }`, matching `task/<tranche>/<n>`) or
|
|
80
|
+
* a backlog task (`{ issue }`, matching `task/issue-<n>`) — the same two
|
|
81
|
+
* shapes `apps/cli/src/lib/task-status.ts`'s own `TaskRef` already
|
|
82
|
+
* distinguishes, mirrored here as the catalog's public vocabulary rather
|
|
83
|
+
* than importing that CLI-internal type (`aeg-core` takes no dependency on
|
|
84
|
+
* `apps/cli`).
|
|
85
|
+
*/
|
|
86
|
+
export const TaskToolRefSchema = z.union([
|
|
87
|
+
z.object({ tranche: z.string().min(1), id: z.string().min(1) }).strict(),
|
|
88
|
+
z.object({ issue: z.number().int().positive() }).strict()
|
|
89
|
+
])
|
|
90
|
+
|
|
91
|
+
export type TaskToolRef = z.infer<typeof TaskToolRefSchema>
|
|
92
|
+
|
|
93
|
+
/** Bounded pagination — every list-shaped result caps at `limit` (default and ceiling both declared here, so no caller and no handler picks its own). */
|
|
94
|
+
export const DEFAULT_PAGE_LIMIT = 20
|
|
95
|
+
export const MAX_PAGE_LIMIT = 100
|
|
96
|
+
|
|
97
|
+
export const PageRequestSchema = z.object({
|
|
98
|
+
cursor: z.string().optional(),
|
|
99
|
+
limit: z.number().int().positive().max(MAX_PAGE_LIMIT).optional()
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
export type PageRequest = z.infer<typeof PageRequestSchema>
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* `fresh`: the record was read and is current as of the run's last known
|
|
106
|
+
* transition. `stale`: the record was read but predates that transition
|
|
107
|
+
* (e.g. a pause record for a round the loop has since published past).
|
|
108
|
+
* `unknown`: no record exists to read at all, or it could not be parsed.
|
|
109
|
+
* Every observation the read interface (O2) returns carries one of these
|
|
110
|
+
* alongside its own `observedAt` timestamp — never a bare value with no way
|
|
111
|
+
* to tell a fresh read from a guess.
|
|
112
|
+
*/
|
|
113
|
+
export const FreshnessSchema = z.enum(['fresh', 'stale', 'unknown'])
|
|
114
|
+
export type Freshness = z.infer<typeof FreshnessSchema>
|
|
115
|
+
|
|
116
|
+
export const ObservedSchema = z.object({
|
|
117
|
+
observedAt: z.string(),
|
|
118
|
+
freshness: FreshnessSchema
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
// --- task_status -------------------------------------------------------------
|
|
122
|
+
|
|
123
|
+
export const TaskStatusInputSchema = z
|
|
124
|
+
.object({
|
|
125
|
+
task: TaskToolRefSchema.optional()
|
|
126
|
+
})
|
|
127
|
+
.merge(PageRequestSchema)
|
|
128
|
+
.strict()
|
|
129
|
+
|
|
130
|
+
export type TaskStatusInput = z.infer<typeof TaskStatusInputSchema>
|
|
131
|
+
|
|
132
|
+
export const TaskStatusItemSchema = z
|
|
133
|
+
.object({
|
|
134
|
+
task: TaskToolRefSchema,
|
|
135
|
+
issue: z.number().int().positive(),
|
|
136
|
+
pr: z.number().int().positive().nullable(),
|
|
137
|
+
state: z.string()
|
|
138
|
+
})
|
|
139
|
+
.merge(ObservedSchema)
|
|
140
|
+
|
|
141
|
+
export const TaskStatusResultSchema = z.object({
|
|
142
|
+
items: z.array(TaskStatusItemSchema),
|
|
143
|
+
nextCursor: z.string().nullable()
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
export type TaskStatusResult = z.infer<typeof TaskStatusResultSchema>
|
|
147
|
+
|
|
148
|
+
// --- task_escalation_read ------------------------------------------------
|
|
149
|
+
|
|
150
|
+
/** Who this pause reason is addressed to — the same routing the loop's own doctrine already gives each `PauseReason`, named here so the tool's result carries it as data rather than requiring the caller to know the doctrine. */
|
|
151
|
+
export const RequestedAuthoritySchema = z.enum(['planner', 'principal', 'operator', 'self'])
|
|
152
|
+
export type RequestedAuthority = z.infer<typeof RequestedAuthoritySchema>
|
|
153
|
+
|
|
154
|
+
export const EscalationInputsSchema = z.object({
|
|
155
|
+
task: z.number().int().positive(),
|
|
156
|
+
round: z.number().int().nonnegative(),
|
|
157
|
+
head: z.string(),
|
|
158
|
+
branch: z.string(),
|
|
159
|
+
prNumber: z.number().int().positive()
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
export const EscalationEvidenceSchema = z.object({
|
|
163
|
+
round: z.number().int().nonnegative(),
|
|
164
|
+
reviewer: z.string().nullable(),
|
|
165
|
+
security: z.string().nullable()
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
/** The escalation's run identity — `null` when no durable `EscalationRecord` exists yet for this pause (a `PauseState` written before that control-store adoption, or a best-effort write that itself failed). */
|
|
169
|
+
export const EscalationRunIdentitySchema = z.object({
|
|
170
|
+
runId: z.string(),
|
|
171
|
+
pid: z.number().int().positive(),
|
|
172
|
+
host: z.string()
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
/** The input versions the pause's round was judged against — `null` under the identical condition `EscalationRunIdentitySchema` is. */
|
|
176
|
+
export const EscalationInputVersionsSchema = z.object({
|
|
177
|
+
briefHash: z.string().nullable(),
|
|
178
|
+
objectivesVersion: z.string().nullable(),
|
|
179
|
+
rulingOrdinal: z.number().int().nonnegative(),
|
|
180
|
+
policyDigest: z.string()
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
export const TaskEscalationReadInputSchema = z
|
|
184
|
+
.object({
|
|
185
|
+
task: TaskToolRefSchema
|
|
186
|
+
})
|
|
187
|
+
.merge(PageRequestSchema)
|
|
188
|
+
.strict()
|
|
189
|
+
|
|
190
|
+
export type TaskEscalationReadInput = z.infer<typeof TaskEscalationReadInputSchema>
|
|
191
|
+
|
|
192
|
+
export const TaskEscalationPacketSchema = z
|
|
193
|
+
.object({
|
|
194
|
+
reason: z.string(),
|
|
195
|
+
detail: z.string().nullable(),
|
|
196
|
+
inputs: EscalationInputsSchema.nullable(),
|
|
197
|
+
evidence: EscalationEvidenceSchema.nullable(),
|
|
198
|
+
attemptedRecovery: z.string(),
|
|
199
|
+
requestedAuthority: RequestedAuthoritySchema,
|
|
200
|
+
permittedNextActions: z.array(z.string()),
|
|
201
|
+
/** From the durable `EscalationRecord` — `null` when none exists for this pause (see the field's own schema doc). */
|
|
202
|
+
runIdentity: EscalationRunIdentitySchema.nullable(),
|
|
203
|
+
/** From the durable `EscalationRecord` — `null` under the identical condition. */
|
|
204
|
+
inputVersions: EscalationInputVersionsSchema.nullable()
|
|
205
|
+
})
|
|
206
|
+
.merge(ObservedSchema)
|
|
207
|
+
|
|
208
|
+
export type TaskEscalationPacket = z.infer<typeof TaskEscalationPacketSchema>
|
|
209
|
+
|
|
210
|
+
export const TaskEscalationReadResultSchema = z
|
|
211
|
+
.object({
|
|
212
|
+
items: z.array(TaskEscalationPacketSchema),
|
|
213
|
+
nextCursor: z.string().nullable()
|
|
214
|
+
})
|
|
215
|
+
.merge(ObservedSchema)
|
|
216
|
+
|
|
217
|
+
export type TaskEscalationReadResult = z.infer<typeof TaskEscalationReadResultSchema>
|
|
218
|
+
|
|
219
|
+
// --- task_start / task_resume / task_cancel (stubs — O3) ------------------
|
|
220
|
+
|
|
221
|
+
export const TaskStartInputSchema = z
|
|
222
|
+
.object({
|
|
223
|
+
tranche: z.string().min(1),
|
|
224
|
+
id: z.string().min(1)
|
|
225
|
+
})
|
|
226
|
+
.strict()
|
|
227
|
+
export type TaskStartInput = z.infer<typeof TaskStartInputSchema>
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* `task_start`'s durable result (O2): the request identity this start was
|
|
231
|
+
* scoped to, the durable run identity a caller can address it by (the task's
|
|
232
|
+
* tranche/id — its `task/<tranche>/<n>` branch is the addressing scheme every
|
|
233
|
+
* other tool and role already resolves through), whether THIS call started the
|
|
234
|
+
* run or replayed an already-started one (`started`), when it was first
|
|
235
|
+
* started, and the mode it ran in. `mode` is a literal `'attended'`: there is
|
|
236
|
+
* no unattended start until the worker-isolation boundary and a capability flag
|
|
237
|
+
* exist, so the field never carries any other value today.
|
|
238
|
+
*/
|
|
239
|
+
export const TaskStartResultSchema = z.object({
|
|
240
|
+
requestId: z.string().min(1),
|
|
241
|
+
run: z.object({ tranche: z.string().min(1), id: z.string().min(1) }),
|
|
242
|
+
started: z.boolean(),
|
|
243
|
+
startedAt: z.string(),
|
|
244
|
+
mode: z.literal('attended')
|
|
245
|
+
})
|
|
246
|
+
export type TaskStartResult = z.infer<typeof TaskStartResultSchema>
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* The stable request identity a `task_start` call is idempotent on (O2) —
|
|
250
|
+
* scoped to the caller, the repo, the target task, and a digest of the call's
|
|
251
|
+
* own payload, so the same caller asking to start the same task twice collapses
|
|
252
|
+
* to one run, while a different caller, repo, target, or payload is a distinct
|
|
253
|
+
* request. Pure and deterministic: the same input always yields the same id,
|
|
254
|
+
* across processes and machines, which is what lets a durable store recognise a
|
|
255
|
+
* duplicate start after a disconnect. It authenticates nothing on its own — the
|
|
256
|
+
* `caller` value must come from the transport's invocation context, never a
|
|
257
|
+
* tool argument (this module's own header).
|
|
258
|
+
*/
|
|
259
|
+
export type TaskStartRequestInput = {
|
|
260
|
+
caller: string
|
|
261
|
+
repo: string | null
|
|
262
|
+
tranche: string
|
|
263
|
+
id: string
|
|
264
|
+
payloadDigest: string
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export function taskStartRequestIdentity(input: TaskStartRequestInput): string {
|
|
268
|
+
const canonical = JSON.stringify({
|
|
269
|
+
caller: input.caller,
|
|
270
|
+
repo: input.repo,
|
|
271
|
+
tranche: input.tranche,
|
|
272
|
+
id: input.id,
|
|
273
|
+
payloadDigest: input.payloadDigest
|
|
274
|
+
})
|
|
275
|
+
return `req_${createHash('sha256').update(canonical).digest('hex').slice(0, 32)}`
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export const TaskResumeInputSchema = z
|
|
279
|
+
.object({
|
|
280
|
+
task: TaskToolRefSchema
|
|
281
|
+
})
|
|
282
|
+
.strict()
|
|
283
|
+
export type TaskResumeInput = z.infer<typeof TaskResumeInputSchema>
|
|
284
|
+
|
|
285
|
+
export const TaskCancelInputSchema = z
|
|
286
|
+
.object({
|
|
287
|
+
task: TaskToolRefSchema,
|
|
288
|
+
reason: z.string().min(1)
|
|
289
|
+
})
|
|
290
|
+
.strict()
|
|
291
|
+
export type TaskCancelInput = z.infer<typeof TaskCancelInputSchema>
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* `task_resume`'s durable result: the run this call
|
|
295
|
+
* addressed (`task`/`pr`), the escalation it resolved (`escalationId`), and
|
|
296
|
+
* the authenticated decision reference it consumed — `authenticatedBy`/
|
|
297
|
+
* `authenticatedFrom` mirror `ResolutionRecord`'s own fields exactly, never a
|
|
298
|
+
* caller-supplied claim (Traps to avoid: no free-text approved boolean).
|
|
299
|
+
* `outcome: 'started'` — this call is the one that triggered the existing
|
|
300
|
+
* `dev-review-loop --resume` continuation. `outcome: 'already_resumed'` — a
|
|
301
|
+
* prior call (or a race this call lost) already did, and this call is a
|
|
302
|
+
* truthful idempotent replay: nothing new was started.
|
|
303
|
+
*/
|
|
304
|
+
export const TaskResumeResultSchema = z.object({
|
|
305
|
+
task: z.number().int().positive(),
|
|
306
|
+
pr: z.number().int().positive(),
|
|
307
|
+
escalationId: z.string().min(1),
|
|
308
|
+
outcome: z.enum(['started', 'already_resumed']),
|
|
309
|
+
authenticatedBy: z.string().min(1),
|
|
310
|
+
authenticatedFrom: z.string().min(1)
|
|
311
|
+
})
|
|
312
|
+
export type TaskResumeResult = z.infer<typeof TaskResumeResultSchema>
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* `task_cancel`'s three truthful outcomes:
|
|
316
|
+
* `'confirmed'` — the cancellation is durably resolved and, where a local
|
|
317
|
+
* in-flight process existed, it was signaled on this host. `'pending'` — the
|
|
318
|
+
* cancellation is durably resolved, but the run's own driver was dispatched
|
|
319
|
+
* on a DIFFERENT host, so this call cannot itself confirm the process
|
|
320
|
+
* stopped (the driver's own next control-store write is fenced regardless —
|
|
321
|
+
* see `fencedEffectKeys`). `'uncertain'` — one or more in-flight external
|
|
322
|
+
* effects could not be confirmed complete and were fenced instead; a late
|
|
323
|
+
* result cannot land under the superseded epoch, but whether it had already
|
|
324
|
+
* landed before the fence is not knowable from here.
|
|
325
|
+
*/
|
|
326
|
+
export const TaskCancelOutcomeSchema = z.enum(['confirmed', 'pending', 'uncertain'])
|
|
327
|
+
export type TaskCancelOutcome = z.infer<typeof TaskCancelOutcomeSchema>
|
|
328
|
+
|
|
329
|
+
export const TaskCancelResultSchema = z.object({
|
|
330
|
+
task: z.number().int().positive(),
|
|
331
|
+
pr: z.number().int().positive(),
|
|
332
|
+
escalationId: z.string().min(1),
|
|
333
|
+
outcome: TaskCancelOutcomeSchema,
|
|
334
|
+
authenticatedBy: z.string().min(1),
|
|
335
|
+
authenticatedFrom: z.string().min(1),
|
|
336
|
+
/** Effect keys fenced from `'started'` to `'uncertain'` by this cancel — empty on an idempotent replay, which fences nothing new. */
|
|
337
|
+
fencedEffectKeys: z.array(z.string())
|
|
338
|
+
})
|
|
339
|
+
export type TaskCancelResult = z.infer<typeof TaskCancelResultSchema>
|
|
340
|
+
|
|
341
|
+
// --- catalog -----------------------------------------------------------------
|
|
342
|
+
|
|
343
|
+
export const TASK_TOOL_NAMES = [
|
|
344
|
+
'task_start',
|
|
345
|
+
'task_status',
|
|
346
|
+
'task_escalation_read',
|
|
347
|
+
'task_resume',
|
|
348
|
+
'task_cancel'
|
|
349
|
+
] as const
|
|
350
|
+
|
|
351
|
+
export type TaskToolName = (typeof TASK_TOOL_NAMES)[number]
|
|
352
|
+
|
|
353
|
+
export function isTaskToolName(value: string): value is TaskToolName {
|
|
354
|
+
return (TASK_TOOL_NAMES as readonly string[]).includes(value)
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/** Where a tool's behaviour is actually implemented — a pointer for a CLI-side registry to satisfy, never a call this module makes. */
|
|
358
|
+
export type TaskToolHandlerBinding =
|
|
359
|
+
| { kind: 'bound'; module: string; export: string }
|
|
360
|
+
| { kind: 'stub'; module: string; export: string }
|
|
361
|
+
|
|
362
|
+
export type TaskToolDefinition<Input = unknown, Result = unknown> = {
|
|
363
|
+
name: TaskToolName
|
|
364
|
+
/** One sentence: what an Operator calls this tool to accomplish. */
|
|
365
|
+
purpose: string
|
|
366
|
+
/** What this tool is not — the neighbour it is easiest to confuse it with, and why the boundary sits where it does. */
|
|
367
|
+
boundaries: string
|
|
368
|
+
inputSchema: z.ZodType<Input>
|
|
369
|
+
resultSchema: z.ZodType<Result>
|
|
370
|
+
errorSchema: typeof TaskToolErrorSchema
|
|
371
|
+
/** At least one schema-valid input, so a catalog consumer can typecheck and smoke-test a call without inventing its own fixture. */
|
|
372
|
+
examples: readonly Input[]
|
|
373
|
+
handlerBinding: TaskToolHandlerBinding
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export const TASK_STATUS_TOOL: TaskToolDefinition<TaskStatusInput, TaskStatusResult> = {
|
|
377
|
+
name: 'task_status',
|
|
378
|
+
purpose:
|
|
379
|
+
"Read a task's current loop state (running, paused, published, exited, or no driver) and its Issue/PR identity, without shelling to `ps` or re-parsing posted verdict comments.",
|
|
380
|
+
boundaries:
|
|
381
|
+
'Terse and always-answerable: one state per task, from records that either exist or explicitly do not. It never explains WHY a paused task is paused beyond naming the reason — that full packet is `task_escalation_read`. Omitting `task` lists every open task, paginated; it never starts, resumes or cancels anything.',
|
|
382
|
+
inputSchema: TaskStatusInputSchema,
|
|
383
|
+
resultSchema: TaskStatusResultSchema,
|
|
384
|
+
errorSchema: TaskToolErrorSchema,
|
|
385
|
+
examples: [{ task: { tranche: 'task-operator-v1', id: '1' } }, { limit: 10 }, {}],
|
|
386
|
+
handlerBinding: { kind: 'bound', module: 'apps/cli/src/lib/task-tools/handlers.ts', export: 'taskStatusHandler' }
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
export const TASK_ESCALATION_READ_TOOL: TaskToolDefinition<TaskEscalationReadInput, TaskEscalationReadResult> = {
|
|
390
|
+
name: 'task_escalation_read',
|
|
391
|
+
purpose:
|
|
392
|
+
"Read the full escalation packet for a paused task — the reason, the round's inputs, the held verdict evidence, what recovery the driver already attempted, who the pause is addressed to, and the actions permitted next.",
|
|
393
|
+
boundaries:
|
|
394
|
+
'Only meaningful once `task_status` reports `paused` (or a prior pause the run has since moved past, returned as `stale`); calling it on a task with no pause record ever written answers with an empty, `unknown`-freshness page rather than an error — a caller unsure whether a task ever paused can call this directly. It never resumes or cancels; those stay `task_resume`/`task_cancel`.',
|
|
395
|
+
inputSchema: TaskEscalationReadInputSchema,
|
|
396
|
+
resultSchema: TaskEscalationReadResultSchema,
|
|
397
|
+
errorSchema: TaskToolErrorSchema,
|
|
398
|
+
examples: [{ task: { tranche: 'task-operator-v1', id: '1' } }, { task: { issue: 558 }, limit: 5 }],
|
|
399
|
+
handlerBinding: {
|
|
400
|
+
kind: 'bound',
|
|
401
|
+
module: 'apps/cli/src/lib/task-tools/handlers.ts',
|
|
402
|
+
export: 'taskEscalationReadHandler'
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
export const TASK_START_TOOL: TaskToolDefinition<TaskStartInput, TaskStartResult> = {
|
|
407
|
+
name: 'task_start',
|
|
408
|
+
purpose:
|
|
409
|
+
'Start the dev-review-loop for an explicitly selected, already-frozen task, in attended mode, under the caller’s own credentials — wrapping the existing `runTask` composition and returning the durable run identity.',
|
|
410
|
+
boundaries:
|
|
411
|
+
'Distinct from `task_resume`: this tool starts a run, it does not continue a paused one. It refuses (`authority`) unless the invocation context carries an authenticated caller — MCP is a transport, not authorization, so the caller is never taken from an argument. It is idempotent per request identity (caller + repo + target + payload digest): asking twice returns the same run and starts nothing twice. ATTENDED MODE ONLY — the run it starts inherits the caller’s own environment and credentials; there is no unattended start and no attended bypass. An unattended start waits on the worker-isolation boundary and a capability flag a later tranche adds.',
|
|
412
|
+
inputSchema: TaskStartInputSchema,
|
|
413
|
+
resultSchema: TaskStartResultSchema,
|
|
414
|
+
errorSchema: TaskToolErrorSchema,
|
|
415
|
+
examples: [{ tranche: 'task-operator-v1', id: '1' }],
|
|
416
|
+
handlerBinding: { kind: 'bound', module: 'apps/cli/src/lib/task-tools/start.ts', export: 'defaultTaskStartHandler' }
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export const TASK_RESUME_TOOL: TaskToolDefinition<TaskResumeInput, TaskResumeResult> = {
|
|
420
|
+
name: 'task_resume',
|
|
421
|
+
purpose: 'Continue a paused dev-review-loop run from where it left off, once a Principal ruling authenticates it.',
|
|
422
|
+
boundaries:
|
|
423
|
+
"Distinct from `task_start`: this tool only ever applies to a task that already has a paused run, never a fresh one. It never accepts a caller-supplied approval — the only decision reference it consumes is a Principal ruling comment already posted on the run's own PR, read fresh from the forge every call, never taken from a tool argument. It never resolves a decision itself: it triggers the SAME `dev-review-loop --resume` continuation the CLI has always used, guarded so the same paused escalation is never resumed by two calls.",
|
|
424
|
+
inputSchema: TaskResumeInputSchema,
|
|
425
|
+
resultSchema: TaskResumeResultSchema,
|
|
426
|
+
errorSchema: TaskToolErrorSchema,
|
|
427
|
+
examples: [{ task: { tranche: 'task-operator-v1', id: '1' } }],
|
|
428
|
+
handlerBinding: { kind: 'bound', module: 'apps/cli/src/lib/task-tools/resume.ts', export: 'defaultTaskResumeHandler' }
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
export const TASK_CANCEL_TOOL: TaskToolDefinition<TaskCancelInput, TaskCancelResult> = {
|
|
432
|
+
name: 'task_cancel',
|
|
433
|
+
purpose: 'Stop a paused dev-review-loop run, fencing any in-flight effect it can no longer safely complete.',
|
|
434
|
+
boundaries:
|
|
435
|
+
'The only tool in this catalog whose job is to end a run rather than read or continue one. Like `task_resume`, it consumes a Principal ruling read fresh from the forge, never a caller-supplied approval. A repeated call against an already-cancelled escalation reports the same outcome again rather than erroring — cancelling twice is never a retry of a failed cancel.',
|
|
436
|
+
inputSchema: TaskCancelInputSchema,
|
|
437
|
+
resultSchema: TaskCancelResultSchema,
|
|
438
|
+
errorSchema: TaskToolErrorSchema,
|
|
439
|
+
examples: [{ task: { issue: 558 }, reason: 'superseded by a re-plan' }],
|
|
440
|
+
handlerBinding: { kind: 'bound', module: 'apps/cli/src/lib/task-tools/cancel.ts', export: 'defaultTaskCancelHandler' }
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/** The one place every tool's name and shape can be found — in this fixed order, matching `TASK_TOOL_NAMES`. */
|
|
444
|
+
export const TASK_TOOL_CATALOG: readonly [
|
|
445
|
+
typeof TASK_START_TOOL,
|
|
446
|
+
typeof TASK_STATUS_TOOL,
|
|
447
|
+
typeof TASK_ESCALATION_READ_TOOL,
|
|
448
|
+
typeof TASK_RESUME_TOOL,
|
|
449
|
+
typeof TASK_CANCEL_TOOL
|
|
450
|
+
] = [TASK_START_TOOL, TASK_STATUS_TOOL, TASK_ESCALATION_READ_TOOL, TASK_RESUME_TOOL, TASK_CANCEL_TOOL]
|
|
451
|
+
|
|
452
|
+
export function taskToolByName(name: TaskToolName): TaskToolDefinition {
|
|
453
|
+
const found = TASK_TOOL_CATALOG.find((tool) => tool.name === name)
|
|
454
|
+
if (!found) throw new Error(`no catalog entry for task tool "${name}"`)
|
|
455
|
+
return found as TaskToolDefinition
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// --- the Operator's tool grant, the boundary the router enforces -----------
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* The one grant the task Operator holds beyond the five catalog tools: the
|
|
462
|
+
* append-only `task status --follow` read (`apps/cli/src/lib/task-status.ts`'s
|
|
463
|
+
* own `--follow` narration). Named as a grant token rather than a catalog
|
|
464
|
+
* tool because it is a bounded status stream the Operator follows, not one of
|
|
465
|
+
* the five typed task tools — but it is still part of what the router must
|
|
466
|
+
* recognize as granted, so it lives here beside the catalog rather than as a
|
|
467
|
+
* bare string a caller reinvents.
|
|
468
|
+
*/
|
|
469
|
+
export const OPERATOR_STATUS_FOLLOW = 'task_status_follow' as const
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* The complete, closed set of tools the task Operator is granted — the
|
|
473
|
+
* five catalog tools plus the status-follow read, and nothing else. This is
|
|
474
|
+
* the machine-readable twin of `aeg-root/roles/operator.md`'s `allowed-tools`
|
|
475
|
+
* frontmatter and of the generated skill's `allowed-tools`; a test binds all
|
|
476
|
+
* three so no representation drifts from another. The router refuses every
|
|
477
|
+
* tool outside this set: a registered tool is a capability, but the grant is
|
|
478
|
+
* what says the Operator may call it — a shell, a forge write, an Issue edit,
|
|
479
|
+
* a review publish or a merge is never in it.
|
|
480
|
+
*/
|
|
481
|
+
export const OPERATOR_TOOL_GRANT = [...TASK_TOOL_NAMES, OPERATOR_STATUS_FOLLOW] as const
|
|
482
|
+
|
|
483
|
+
export type OperatorGrantedTool = (typeof OPERATOR_TOOL_GRANT)[number]
|
|
484
|
+
|
|
485
|
+
/** True only for a tool inside the Operator's grant — the membership test the router's refusal is built on. Any name not in `OPERATOR_TOOL_GRANT` (a shell, a forge write, an Issue edit, `merge`, a review publish) is outside the grant and refused. */
|
|
486
|
+
export function isOperatorGranted(tool: string): tool is OperatorGrantedTool {
|
|
487
|
+
return (OPERATOR_TOOL_GRANT as readonly string[]).includes(tool)
|
|
488
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Test Plan checkbox-state gate evaluator (
|
|
3
|
-
*
|
|
4
|
-
* the `[agent]` half stopped being a checkbox at all: it is a fenced command
|
|
2
|
+
* Test Plan checkbox-state gate evaluator (later narrowed to `[principal]`
|
|
3
|
+
* boxes only — the `[agent]` half stopped being a checkbox at all: it is a fenced command
|
|
5
4
|
* list `vinaya pr report` executes and writes into the `AEG:EVIDENCE` block,
|
|
6
5
|
* which IS the evidence, so there is nothing left for this gate to grade on
|
|
7
6
|
* that half). Pure — no `fs`, no `gh`/`git`. The CLI shim
|
|
@@ -13,17 +12,18 @@
|
|
|
13
12
|
* This module owns the checkbox tick-state decision built on top of it:
|
|
14
13
|
*
|
|
15
14
|
* - No section found, task branch → `fail` (a task PR without a
|
|
16
|
-
* Test Plan is malformed, not exempt —
|
|
15
|
+
* Test Plan is malformed, not exempt — a real live-fire gap).
|
|
17
16
|
* - No section found, non-task branch (or no BRANCH) → `pass` (advisory).
|
|
18
17
|
* - `Test Plan: unit-tests-only` sentinel → `pass`.
|
|
19
18
|
* - Any unticked `- [ ]` `[principal]` checkbox → `fail`, naming every
|
|
20
|
-
* unticked line. A `[agent]`-tagged checkbox (
|
|
19
|
+
* unticked line. A `[agent]`-tagged checkbox (an older body, still
|
|
21
20
|
* grandfathered by `brief-shape`'s own rollout) is never graded here —
|
|
22
21
|
* see the module doc comment above.
|
|
23
22
|
* - All `[principal]` boxes ticked (or none exist at all) → `pass`.
|
|
24
23
|
*/
|
|
25
24
|
|
|
26
25
|
import { locateTestPlanSection } from './test-plan-section'
|
|
26
|
+
import { parseTaskBranchIdentity } from './task-branch-identity'
|
|
27
27
|
|
|
28
28
|
export type TestPlanGateVerdict = 'pass' | 'fail'
|
|
29
29
|
export type TestPlanGateResult = {
|
|
@@ -31,8 +31,6 @@ export type TestPlanGateResult = {
|
|
|
31
31
|
messages: string[]
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const TASK_BRANCH_PATTERN = /^task\/[^/]+\/[^/]+$/
|
|
35
|
-
|
|
36
34
|
export function evaluateTestPlanGate(body: string, branch: string): TestPlanGateResult {
|
|
37
35
|
if (!body) {
|
|
38
36
|
return {
|
|
@@ -47,7 +45,7 @@ export function evaluateTestPlanGate(body: string, branch: string): TestPlanGate
|
|
|
47
45
|
const located = locateTestPlanSection(body)
|
|
48
46
|
|
|
49
47
|
if (!located.found) {
|
|
50
|
-
if (
|
|
48
|
+
if (parseTaskBranchIdentity(branch) !== null) {
|
|
51
49
|
return {
|
|
52
50
|
verdict: 'fail',
|
|
53
51
|
messages: [
|
|
@@ -77,7 +75,7 @@ export function evaluateTestPlanGate(body: string, branch: string): TestPlanGate
|
|
|
77
75
|
}
|
|
78
76
|
|
|
79
77
|
// `[agent]` checkboxes are never graded here — see the module doc comment.
|
|
80
|
-
//
|
|
78
|
+
// An older body may still carry them (grandfathered by `brief-shape`'s
|
|
81
79
|
// own rollout); this gate simply does not look at that tag at all any
|
|
82
80
|
// more, ticked or not.
|
|
83
81
|
const checkboxLines = section
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Test Plan section locator
|
|
2
|
+
* Test Plan section locator. Pure —
|
|
3
3
|
* no `fs`, no `gh`/`git`. Extracted from `bin/verify-test-plan.ts`'s original
|
|
4
|
-
* inline-only regex to fix
|
|
4
|
+
* inline-only regex to fix a live-fire gap a real PR exposed: its body used
|
|
5
5
|
* the `## 9. Test Plan` heading form, which the old inline-only regex never
|
|
6
6
|
* matched, so `verify-test-plan` reported "no section" and advisory-PASSED a
|
|
7
7
|
* PR that actually had an unticked `**[principal]**` box.
|
|
@@ -43,9 +43,9 @@ const NEXT_SECTION_RE = /\n(?:#{1,3}[ \t]|\*\*[A-Z][^*\n]*:\*\*)/
|
|
|
43
43
|
* task 30), the pair IS the section: its whole content is returned verbatim,
|
|
44
44
|
* with no heading/inline marker required inside it — requiring a second,
|
|
45
45
|
* redundant in-region marker would reintroduce the unrecognized-heading
|
|
46
|
-
* failure class
|
|
47
|
-
* Plan text elsewhere in the body (a pasted reference brief's own §9
|
|
48
|
-
*
|
|
46
|
+
* failure class the anchors exist to close. Identical-looking Test
|
|
47
|
+
* Plan text elsewhere in the body (a pasted reference brief's own §9)
|
|
48
|
+
* is ignored. Bodies without the pair parse exactly as before.
|
|
49
49
|
*/
|
|
50
50
|
export function locateTestPlanSection(body: string): TestPlanSection {
|
|
51
51
|
const region = anchoredRegion(body, 'TEST-PLAN')
|
|
@@ -30,8 +30,8 @@ export type Registry = Project[]
|
|
|
30
30
|
// ---------- Tranche file (tranches/<name>.md) ----------
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* `Lifecycle`/`Task`/`Tranche` live in `@attalabs/aeg-types`
|
|
34
|
-
*
|
|
33
|
+
* `Lifecycle`/`Task`/`Tranche` live in `@attalabs/aeg-types` —
|
|
34
|
+
* re-exported here since every existing call site
|
|
35
35
|
* across the repo imports them from `@attalabs/aeg-core`. Moved out so
|
|
36
36
|
* `@attalabs/aeg-forge-state` can depend on these shapes without creating a
|
|
37
37
|
* package cycle with `aeg-core` (which in turn depends on
|
|
@@ -42,7 +42,7 @@ export type { Lifecycle, Task, Tranche }
|
|
|
42
42
|
// ---------- Forge facts ----------
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
* `ForgeFacts` lives in `@attalabs/aeg-types` (aeg-core-purity fix
|
|
45
|
+
* `ForgeFacts` lives in `@attalabs/aeg-types` (an aeg-core-purity fix) —
|
|
46
46
|
* re-exported here for the same reason as `Lifecycle`/`Task`/`Tranche`:
|
|
47
47
|
* every existing call site imports it from `@attalabs/aeg-core`, and it moved
|
|
48
48
|
* out so the I/O-performing fetchers that produce it (now in
|
|
@@ -131,7 +131,7 @@ export type DerivedTranche = {
|
|
|
131
131
|
* The tranche total is `sum(rows)`, derived at read time — never stored.
|
|
132
132
|
*
|
|
133
133
|
* The two capture sources surface here as `null` cells: a row written by a
|
|
134
|
-
* claude.ai role (Planner /
|
|
134
|
+
* claude.ai role (Planner / Reviewer / Security) before the
|
|
135
135
|
* Principal has filled in its usage figure has `tokensIn`/`tokensOut`/`cost`
|
|
136
136
|
* as `null`; a terminal-role row (Developer / Archivist with `/cost`) has
|
|
137
137
|
* exact numbers.
|