@tea-agent/loop-agent 0.42.0-next.2 → 0.42.0-next.3
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/CHANGELOG.md +242 -1
- package/dist/application/dag/generate-task-dag.js +75 -19
- package/dist/application/task-lifecycle/advance.js +24 -5
- package/dist/application/task-lifecycle/observe.js +171 -17
- package/dist/application/task-lifecycle/plan-transitions.js +42 -7
- package/dist/application/task-lifecycle/recommendations.js +13 -2
- package/dist/build-stamp.json +3 -3
- package/dist/cli/command-definitions.js +7 -0
- package/dist/cli/program.js +5 -0
- package/dist/commands/client-recovery.js +3 -0
- package/dist/commands/dag-follow-up.js +138 -0
- package/dist/commands/init.js +27 -1
- package/dist/commands/task-advance.js +19 -0
- package/dist/executors/dag-pi-executor.js +3784 -231
- package/dist/executors/pi-executor.js +15 -4
- package/dist/executors/pi-read-budget-policy.js +239 -0
- package/dist/executors/shell-executor.js +942 -187
- package/dist/executors/shell-write-guard.js +7 -0
- package/dist/infrastructure/console/operation-store.js +226 -6
- package/dist/shared/dag-failure-category.js +12 -0
- package/dist/shared/openspec-spec.js +70 -4
- package/dist/shared/operator/capabilities.js +7 -0
- package/dist/task/config-types.js +34 -5
- package/dist/task/contract/adopt.js +4 -0
- package/dist/task/contract/import-revision.js +4 -0
- package/dist/task/contract/project.js +3 -0
- package/dist/task/contract/schema.js +2 -1
- package/dist/task/frontend-project-capability.js +203 -20
- package/dist/task/runtime.js +5 -2
- package/dist/task/source-prepare/build-draft.js +3 -3
- package/dist/task/source-prepare/fragment-inventory.js +15 -9
- package/dist/task/source-prepare/prepare.js +89 -1
- package/dist/task/source-prepare/semantic-intake.js +6 -2
- package/dist/task/source-references.js +22 -1
- package/dist/worker/console/chat/chat-ui-policy.js +4 -2
- package/dist/worker/console/chat/pi-runtime.js +173 -7
- package/dist/worker/console/chat/repo-browser.js +10 -3
- package/dist/worker/console/chat/routes.js +30 -19
- package/dist/worker/console/chat/session-store.js +117 -70
- package/dist/worker/console/chat/shortcuts.js +1 -1
- package/dist/worker/console/chat/turn-process.js +111 -56
- package/dist/worker/console/frontend-human-decision-adapter.js +19 -0
- package/dist/worker/console/frontend-split-operation-adapter.js +20 -0
- package/dist/worker/console/index.js +3 -0
- package/dist/worker/console/operator-actions.js +169 -7
- package/dist/worker/console/server.js +3 -0
- package/dist/worker/console/static/assets/{abnfDiagram-N423BO3Z-DZZ8m3PO.js → abnfDiagram-N423BO3Z-CeznJ4Iw.js} +1 -1
- package/dist/worker/console/static/assets/{arc-D6PvaVd-.js → arc-B4u9u7SX.js} +1 -1
- package/dist/worker/console/static/assets/{architectureDiagram-T3A2C74G-B_OTOiI8.js → architectureDiagram-T3A2C74G-oghpT81p.js} +1 -1
- package/dist/worker/console/static/assets/{blockDiagram-VBNYF7ZC-Bv6rqHBg.js → blockDiagram-VBNYF7ZC-BPJ5Kvcj.js} +1 -1
- package/dist/worker/console/static/assets/{c4Diagram-5PPSVZJV-B8eHr0oz.js → c4Diagram-5PPSVZJV-CoIu69pd.js} +1 -1
- package/dist/worker/console/static/assets/channel-DmIXqJ6B.js +1 -0
- package/dist/worker/console/static/assets/{chunk-2GRJ4B5K-DYwR0im2.js → chunk-2GRJ4B5K-DtgiAsSc.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-2Q5K7J3B-D2WPGqXt.js → chunk-2Q5K7J3B-YSu_EVSD.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5RXB4S5H-CQISJ_I7.js → chunk-5RXB4S5H-DaRO-NB6.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5VM5RSS4-C0o2Du1e.js → chunk-5VM5RSS4-Dh0ZKiGA.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-6Q2QTUOP-4f8kr-U7.js → chunk-6Q2QTUOP-DOrvbR-H.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-GF5L2VYU-D_OWvXzX.js → chunk-GF5L2VYU-C3b22LN2.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-JWPE2WC7-CasdPz5X.js → chunk-JWPE2WC7-CXlqO8l6.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-KBJHAD2P-Cj8lRrla.js → chunk-KBJHAD2P-BblTBrDu.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-RYQCIY6F-CUvD1FSd.js → chunk-RYQCIY6F-DswqPALe.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-XXDRQBXY-CqLw_eqB.js → chunk-XXDRQBXY-CfTwVOlc.js} +1 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-MFV5Qxb5.js +1 -0
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-MFV5Qxb5.js +1 -0
- package/dist/worker/console/static/assets/{cose-bilkent-JH36ORCC-ku-WqJPx.js → cose-bilkent-JH36ORCC-bLD8jVFo.js} +1 -1
- package/dist/worker/console/static/assets/{cynefin-VYW2F7L2-Bq_PYDhl.js → cynefin-VYW2F7L2-BvoG1fh5.js} +1 -1
- package/dist/worker/console/static/assets/{cynefinDiagram-MW4NZA55-BiGZV641.js → cynefinDiagram-MW4NZA55-DEPAdJu3.js} +1 -1
- package/dist/worker/console/static/assets/{dagre-VZM6K2ZE-C4JRlglF.js → dagre-VZM6K2ZE-DmrNvBLy.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-7IWD3JNH-B0dNeWYG.js → diagram-7IWD3JNH-CdwzIwvs.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-B4RE2ZJO-Cj35YvYM.js → diagram-B4RE2ZJO-CJ3hj-md.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-LBJQPF4R-uzQoJ2-8.js → diagram-LBJQPF4R-C6YJT2a4.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-Q27KOJAE-D1a-Buoz.js → diagram-Q27KOJAE-C_LPfjhX.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-UB23O5K3-XjRrLRSs.js → diagram-UB23O5K3-xvsSb5Ie.js} +1 -1
- package/dist/worker/console/static/assets/{ebnfDiagram-BXEA7PRR-Da_O24cW.js → ebnfDiagram-BXEA7PRR-Rxp2tKcD.js} +1 -1
- package/dist/worker/console/static/assets/{erDiagram-JOGREHBK-BLJ8jrYU.js → erDiagram-JOGREHBK-DRyLYmZh.js} +1 -1
- package/dist/worker/console/static/assets/{flowDiagram-UKHOOZJN-B9GrLjM0.js → flowDiagram-UKHOOZJN-TLSU_D2B.js} +1 -1
- package/dist/worker/console/static/assets/{ganttDiagram-PKOTCBZU-CeJ0TqiK.js → ganttDiagram-PKOTCBZU-DGqeTvHC.js} +1 -1
- package/dist/worker/console/static/assets/{gitGraphDiagram-DS77QQ5N-Bm2eNNFX.js → gitGraphDiagram-DS77QQ5N-BZxyH2wh.js} +1 -1
- package/dist/worker/console/static/assets/index-C8V8K9b4.js +451 -0
- package/dist/worker/console/static/assets/index-Cnf_KxTQ.css +1 -0
- package/dist/worker/console/static/assets/{infoDiagram-6WML65LV-DB26i3d8.js → infoDiagram-6WML65LV-BsYtzx01.js} +1 -1
- package/dist/worker/console/static/assets/{ishikawaDiagram-WSZJBQD7-BOGRyeZT.js → ishikawaDiagram-WSZJBQD7-Qr-ezGv-.js} +1 -1
- package/dist/worker/console/static/assets/{journeyDiagram-NVQOT4AX-CZRoBO_6.js → journeyDiagram-NVQOT4AX-DYbB3ibo.js} +1 -1
- package/dist/worker/console/static/assets/{kanban-definition-27J2QSJJ-qlWhJyoB.js → kanban-definition-27J2QSJJ-BHJHewZO.js} +1 -1
- package/dist/worker/console/static/assets/{linear-CfUiDDB3.js → linear-CmPIPmCG.js} +1 -1
- package/dist/worker/console/static/assets/{mermaid.core-BQe6fpqj.js → mermaid.core-F--C1uV0.js} +5 -5
- package/dist/worker/console/static/assets/{mindmap-definition-FAOFIHXS-zFzWHw64.js → mindmap-definition-FAOFIHXS-YTXfL1st.js} +1 -1
- package/dist/worker/console/static/assets/{pegDiagram-VL7TDLO6-DFGUqjZO.js → pegDiagram-VL7TDLO6-DdDMYXP9.js} +1 -1
- package/dist/worker/console/static/assets/{pieDiagram-7S7Q4E2Y-BB5i0l8Z.js → pieDiagram-7S7Q4E2Y-C3nH4KVd.js} +1 -1
- package/dist/worker/console/static/assets/{quadrantDiagram-CIZ2JOQS-obbVZ_X5.js → quadrantDiagram-CIZ2JOQS-kXyxjG7Y.js} +1 -1
- package/dist/worker/console/static/assets/{railroadDiagram-AXF67PYL-BwdaNzc1.js → railroadDiagram-AXF67PYL-KNzbl-7w.js} +1 -1
- package/dist/worker/console/static/assets/{requirementDiagram-LRYGKXZP-CkTJaugh.js → requirementDiagram-LRYGKXZP-CSwI6dG0.js} +1 -1
- package/dist/worker/console/static/assets/{sankeyDiagram-W5VNT64P-BwJ-hIgq.js → sankeyDiagram-W5VNT64P-Bl1AyuXy.js} +1 -1
- package/dist/worker/console/static/assets/{sequenceDiagram-SI44F4Z6-BzSgmm7w.js → sequenceDiagram-SI44F4Z6-2y4EmXQa.js} +1 -1
- package/dist/worker/console/static/assets/{sizeCapture-X5ZJPWSS-Bn3oj5Q1.js → sizeCapture-X5ZJPWSS-E8v8YrMg.js} +1 -1
- package/dist/worker/console/static/assets/{stateDiagram-OKZ733FA-dxhGtL8K.js → stateDiagram-OKZ733FA-eGGlR856.js} +1 -1
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-B8e4J3at.js +1 -0
- package/dist/worker/console/static/assets/{swimlanes-SLNWSIFB-BLpEInya.js → swimlanes-SLNWSIFB-B7g7xc07.js} +2 -2
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-Do88I1Nb.js +8 -0
- package/dist/worker/console/static/assets/{timeline-definition-Z64GVDOM-ChJGYcXy.js → timeline-definition-Z64GVDOM-DR3VCHBG.js} +1 -1
- package/dist/worker/console/static/assets/{vennDiagram-T6HMQDX7-DK-qjRer.js → vennDiagram-T6HMQDX7-LUvapZIy.js} +1 -1
- package/dist/worker/console/static/assets/{wardleyDiagram-T6FBY63Y-3qeaWAg-.js → wardleyDiagram-T6FBY63Y-C7GDcaXq.js} +1 -1
- package/dist/worker/console/static/assets/{xychartDiagram-ELKLHX3M-CootlyP9.js → xychartDiagram-ELKLHX3M-CbNAqoGK.js} +1 -1
- package/dist/worker/console/static/index.html +2 -2
- package/dist/worker/console/static-src/active-run-badge.js +17 -0
- package/dist/worker/console/static-src/operator-chat/chat-sse-events.js +19 -8
- package/dist/worker/console/static-src/operator-chat/open-preview-in-browser.js +15 -7
- package/dist/worker/console/workspace-context.js +111 -1
- package/dist/worker/materialize/frontend-split-task-materializer.js +72 -0
- package/dist/worker/observe/static/dag-node-purpose.js +5 -0
- package/dist/workflows/dag/contract-validator-registrations.js +1 -2
- package/dist/workflows/dag/dag-retry-schema.js +138 -0
- package/dist/workflows/dag/frontend-closeout.js +221 -0
- package/dist/workflows/dag/frontend-design-policy.js +400 -0
- package/dist/workflows/dag/frontend-human-decision.js +182 -0
- package/dist/workflows/dag/frontend-implementation-contract.js +907 -162
- package/dist/workflows/dag/frontend-plan-render.js +2 -1
- package/dist/workflows/dag/frontend-prewrite-gate.js +255 -349
- package/dist/workflows/dag/frontend-provider-capability-matrix.js +159 -0
- package/dist/workflows/dag/frontend-recovery-capsule.js +455 -0
- package/dist/workflows/dag/frontend-recovery-controller.js +202 -0
- package/dist/workflows/dag/frontend-recovery-lineage.js +178 -0
- package/dist/workflows/dag/frontend-recovery-plan.js +17 -10
- package/dist/workflows/dag/frontend-recovery-run.js +33 -20
- package/dist/workflows/dag/frontend-repair.js +1 -432
- package/dist/workflows/dag/frontend-review-context.js +261 -15
- package/dist/workflows/dag/frontend-review-findings.js +270 -0
- package/dist/workflows/dag/frontend-shadow-dual-write.js +914 -0
- package/dist/workflows/dag/frontend-shape-capsule-store.js +191 -0
- package/dist/workflows/dag/frontend-shape-facts.js +419 -0
- package/dist/workflows/dag/frontend-shape.js +435 -0
- package/dist/workflows/dag/frontend-source-fidelity-ledger.js +108 -0
- package/dist/workflows/dag/frontend-split-application-service.js +203 -0
- package/dist/workflows/dag/frontend-split-orchestrator.js +899 -0
- package/dist/workflows/dag/frontend-typed-event-store.js +452 -0
- package/dist/workflows/dag/frontend-typed-event-transaction.js +180 -0
- package/dist/workflows/dag/frontend-verification-trace.js +249 -24
- package/dist/workflows/dag/frontend-worktree-diff.js +250 -17
- package/dist/workflows/dag/frontend-writer-admission.js +285 -0
- package/dist/workflows/dag/frontend-writer-status.js +256 -0
- package/dist/workflows/dag/init-hybrid.js +677 -492
- package/dist/workflows/dag/interrupt-request.js +7 -0
- package/dist/workflows/dag/node-execution.js +732 -4
- package/dist/workflows/dag/prompt.js +34 -1
- package/dist/workflows/dag/recovery-lease.js +80 -0
- package/dist/workflows/dag/report.js +37 -1
- package/dist/workflows/dag/rerun-feedback.js +256 -1
- package/dist/workflows/dag/rerun-plan.js +17 -6
- package/dist/workflows/dag/rerun-run.js +23 -0
- package/dist/workflows/dag/rerun-task.js +29 -0
- package/dist/workflows/dag/retry-policy.js +214 -104
- package/dist/workflows/dag/runner.js +433 -126
- package/dist/workflows/dag/scheduler.js +114 -16
- package/dist/workflows/dag/types.js +239 -12
- package/dist/workflows/dag/validate.js +28 -12
- package/docs/examples/README.md +5 -0
- package/docs/init-surface.manifest.json +30 -12
- package/docs/skills/vetted-skill-registry.md +4 -2
- package/docs/templates/README.md +2 -0
- package/docs/templates/agent-dag-report.schema.json +8 -2
- package/docs/templates/agent-dag.schema.json +1 -1
- package/docs/templates/frontend-implementation-contract.schema.json +4 -1
- package/docs/templates/frontend-implementation-dag.json +89 -0
- package/docs/templates/spec-registry.schema.json +45 -0
- package/harness.json +1 -1
- package/package.json +1 -1
- package/skills/frontend-bounded-implement/SKILL.md +15 -14
- package/skills/frontend-bounded-implement/references/code-standards.md +19 -0
- package/skills/frontend-contract/SKILL.md +23 -0
- package/skills/frontend-contract/references/contract-protocol.md +34 -0
- package/skills/frontend-design-review/SKILL.md +22 -41
- package/skills/frontend-plan/SKILL.md +26 -0
- package/skills/frontend-plan/references/decision-contract.md +37 -0
- package/skills/frontend-plan/references/design-decisions.md +17 -0
- package/skills/frontend-review/SKILL.md +20 -15
- package/skills/frontend-review/references/review-findings.md +6 -7
- package/skills/frontend-scout/SKILL.md +25 -0
- package/skills/frontend-scout/references/design-evidence.md +16 -0
- package/skills/frontend-scout/references/scout-evidence.md +23 -0
- package/skills/frontend-verification/SKILL.md +1 -1
- package/skills/loop-agent/references/command-reference.md +1 -0
- package/skills/loop-agent/references/hybrid-dag.md +2 -2
- package/dist/worker/console/static/assets/channel-BU5gOilw.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-DIzKJGHr.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-DIzKJGHr.js +0 -1
- package/dist/worker/console/static/assets/index-H9rFJiGL.css +0 -1
- package/dist/worker/console/static/assets/index-xwu9GxEc.js +0 -451
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-Cld2qK9v.js +0 -1
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-TIHpiT7w.js +0 -8
- package/skills/frontend-implementation/SKILL.md +0 -52
- package/skills/frontend-implementation/references/code-standards.md +0 -33
- package/skills/frontend-implementation/references/design-spec.md +0 -56
- package/skills/frontend-implementation/references/node-contracts.md +0 -31
|
@@ -3,7 +3,8 @@ import path from "node:path";
|
|
|
3
3
|
import { isPauseOnHumanDecisionGate } from "./decision-envelope.js";
|
|
4
4
|
import { evaluateConditionExpression } from "./dynamic-runtime/condition.js";
|
|
5
5
|
import { sha256Hex } from "./frontend-implementation-contract.js";
|
|
6
|
-
import {
|
|
6
|
+
import { boundaryForTargetNode, computeFrontendShapeNodeDigest, evaluateFrontendShapeBoundary, } from "./frontend-shape-facts.js";
|
|
7
|
+
import { FRONTEND_WRITER_ADMISSION_RESULT_ARTIFACT, frontendWriterAdmissionResultV1Schema, } from "./frontend-writer-admission.js";
|
|
7
8
|
import { FRONTEND_RECOVERY_IMPORT_MANIFEST_REL_PATH, FRONTEND_RECOVERY_INTENT_REL_DIR, } from "./frontend-recovery-plan.js";
|
|
8
9
|
export function isConditionSkippedReason(reason) {
|
|
9
10
|
return Boolean(reason?.startsWith("condition "));
|
|
@@ -111,16 +112,25 @@ async function mapConcurrent(items, limit, fn) {
|
|
|
111
112
|
}
|
|
112
113
|
export const FRONTEND_WRITER_NODE_IDS = [
|
|
113
114
|
"frontend-implement-pi",
|
|
114
|
-
"frontend-repair-pi",
|
|
115
115
|
];
|
|
116
|
-
/** Run-relative artifact location written by the prewrite gate generator. */
|
|
117
|
-
export const FRONTEND_PREWRITE_RESULT_SOURCE_ARTIFACT = path.posix.join("contracts", FRONTEND_PREWRITE_RESULT_ARTIFACT_NAME);
|
|
118
116
|
/**
|
|
119
|
-
*
|
|
120
|
-
*
|
|
117
|
+
* Run-relative artifact location read by the frontend writer admission gate.
|
|
118
|
+
* M8 re-pointed the legacy prewrite-result source at the new
|
|
119
|
+
* frontend-writer-admission-result.json artifact (written by the
|
|
120
|
+
* frontend-writer-admission-shell); the exported name is retained because
|
|
121
|
+
* runner.ts / node-execution.ts reference it as the admission evidence source.
|
|
122
|
+
*/
|
|
123
|
+
export const FRONTEND_PREWRITE_RESULT_SOURCE_ARTIFACT = FRONTEND_WRITER_ADMISSION_RESULT_ARTIFACT;
|
|
124
|
+
export { FRONTEND_WRITER_ADMISSION_RESULT_ARTIFACT };
|
|
125
|
+
/**
|
|
126
|
+
* Read and validate the writer admission result artifact.
|
|
127
|
+
* Fail-closed: a missing file or invalid payload returns ok:false and never
|
|
128
|
+
* throws. This is the M8 write authorization source (replaces the legacy
|
|
129
|
+
* frontend-prewrite-result-v1 for dispatch; the legacy artifact remains
|
|
130
|
+
* produced only by the shadow `runFrontendPrewriteGate` library export).
|
|
121
131
|
*/
|
|
122
132
|
export async function readFrontendPrewriteResult(runDir) {
|
|
123
|
-
const artifactPath = path.join(runDir,
|
|
133
|
+
const artifactPath = path.join(runDir, FRONTEND_WRITER_ADMISSION_RESULT_ARTIFACT);
|
|
124
134
|
let raw;
|
|
125
135
|
try {
|
|
126
136
|
raw = await readFile(artifactPath, "utf8");
|
|
@@ -129,7 +139,7 @@ export async function readFrontendPrewriteResult(runDir) {
|
|
|
129
139
|
if (error.code === "ENOENT") {
|
|
130
140
|
return {
|
|
131
141
|
ok: false,
|
|
132
|
-
reason: `frontend
|
|
142
|
+
reason: `frontend writer admission artifact missing: ${artifactPath}`,
|
|
133
143
|
};
|
|
134
144
|
}
|
|
135
145
|
throw error;
|
|
@@ -142,22 +152,30 @@ export async function readFrontendPrewriteResult(runDir) {
|
|
|
142
152
|
catch (error) {
|
|
143
153
|
return {
|
|
144
154
|
ok: false,
|
|
145
|
-
reason: `frontend
|
|
155
|
+
reason: `frontend writer admission artifact is not valid JSON: ${error instanceof Error ? error.message : String(error)}`,
|
|
146
156
|
};
|
|
147
157
|
}
|
|
148
|
-
const result =
|
|
158
|
+
const result = frontendWriterAdmissionResultV1Schema.safeParse(parsed);
|
|
149
159
|
if (!result.success) {
|
|
150
160
|
return {
|
|
151
161
|
ok: false,
|
|
152
|
-
reason: "frontend
|
|
162
|
+
reason: "frontend writer admission artifact failed schema validation",
|
|
153
163
|
};
|
|
154
164
|
}
|
|
155
165
|
return { ok: true, result: result.data, artifactHash };
|
|
156
166
|
}
|
|
157
|
-
/**
|
|
167
|
+
/**
|
|
168
|
+
* M8 alias: read the writer admission result artifact under the explicit name.
|
|
169
|
+
* Same fail-closed semantics as `readFrontendPrewriteResult`.
|
|
170
|
+
*/
|
|
171
|
+
export async function readFrontendWriterAdmissionResult(runDir) {
|
|
172
|
+
return readFrontendPrewriteResult(runDir);
|
|
173
|
+
}
|
|
174
|
+
/** Authorize only the `accepted` classification (four-state admission).
|
|
175
|
+
* `requires-human-approval`, `blocked`, and `stale` are all denied. */
|
|
158
176
|
export function isFrontendWriterAuthorized(result) {
|
|
159
177
|
return result.classification === "accepted" ||
|
|
160
|
-
result.classification === "
|
|
178
|
+
result.classification === "admitted"
|
|
161
179
|
? "authorized"
|
|
162
180
|
: "denied";
|
|
163
181
|
}
|
|
@@ -422,6 +440,86 @@ export async function executeDagRanksOnce(input) {
|
|
|
422
440
|
}
|
|
423
441
|
const frontendAdmissionSkippedSet = new Set(frontendAdmissionSettled);
|
|
424
442
|
const runnableAfterAdmission = actuallyRunnable.filter((id) => !frontendAdmissionSkippedSet.has(id));
|
|
443
|
+
// Shape boundaries are rank gates: evaluate every protected candidate
|
|
444
|
+
// before creating an executor or starting any sibling in the rank.
|
|
445
|
+
const shapeBlocked = new Set();
|
|
446
|
+
const checkedBoundaries = new Set();
|
|
447
|
+
let shapeTerminalCommitted = false;
|
|
448
|
+
for (const id of runnableAfterAdmission) {
|
|
449
|
+
const mapping = boundaryForTargetNode(id);
|
|
450
|
+
if (!mapping || checkedBoundaries.has(mapping.boundary))
|
|
451
|
+
continue;
|
|
452
|
+
checkedBoundaries.add(mapping.boundary);
|
|
453
|
+
const sourceNode = input.state.nodes[mapping.sourceNodeId];
|
|
454
|
+
const fact = input.state.frontendShapeState?.committedFacts[mapping.boundary];
|
|
455
|
+
const outcome = evaluateFrontendShapeBoundary({
|
|
456
|
+
boundary: mapping.boundary,
|
|
457
|
+
sourceNode: sourceNode
|
|
458
|
+
? { status: sourceNode.status, digest: computeFrontendShapeNodeDigest(sourceNode) }
|
|
459
|
+
: undefined,
|
|
460
|
+
fact,
|
|
461
|
+
});
|
|
462
|
+
if (outcome.kind === "continue") {
|
|
463
|
+
if (input.state.frontendShapeState) {
|
|
464
|
+
input.state.frontendShapeState.lastBoundary = mapping.boundary;
|
|
465
|
+
input.state.frontendShapeState.lastOutcome = outcome.kind;
|
|
466
|
+
await input.persistState();
|
|
467
|
+
}
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
if (outcome.kind === "blocked") {
|
|
471
|
+
if (input.state.frontendShapeState) {
|
|
472
|
+
input.state.frontendShapeState.lastBoundary = mapping.boundary;
|
|
473
|
+
input.state.frontendShapeState.lastOutcome = outcome.kind;
|
|
474
|
+
}
|
|
475
|
+
const finishedAt = new Date().toISOString();
|
|
476
|
+
for (const targetId of mapping.targetNodeIds) {
|
|
477
|
+
if (!runnableAfterAdmission.includes(targetId))
|
|
478
|
+
continue;
|
|
479
|
+
const node = input.state.nodes[targetId];
|
|
480
|
+
if (!node || node.status !== "PENDING")
|
|
481
|
+
continue;
|
|
482
|
+
node.status = "SKIPPED";
|
|
483
|
+
node.skippedReason = outcome.reason;
|
|
484
|
+
node.finishedAt = finishedAt;
|
|
485
|
+
shapeBlocked.add(targetId);
|
|
486
|
+
}
|
|
487
|
+
await input.persistState();
|
|
488
|
+
continue;
|
|
489
|
+
}
|
|
490
|
+
if (!fact || !input.commitFrontendShapeTransition) {
|
|
491
|
+
const finishedAt = new Date().toISOString();
|
|
492
|
+
for (const targetId of mapping.targetNodeIds) {
|
|
493
|
+
const node = input.state.nodes[targetId];
|
|
494
|
+
if (!node || node.status !== "PENDING")
|
|
495
|
+
continue;
|
|
496
|
+
node.status = "SKIPPED";
|
|
497
|
+
node.skippedReason = "frontend-shape-transition-cas-unavailable";
|
|
498
|
+
node.finishedAt = finishedAt;
|
|
499
|
+
shapeBlocked.add(targetId);
|
|
500
|
+
}
|
|
501
|
+
await input.persistState();
|
|
502
|
+
continue;
|
|
503
|
+
}
|
|
504
|
+
const committed = await input.commitFrontendShapeTransition({
|
|
505
|
+
boundary: mapping.boundary,
|
|
506
|
+
outcome: outcome.kind,
|
|
507
|
+
reason: outcome.reason,
|
|
508
|
+
expectedRevision: input.state.frontendShapeState?.revision ?? 0,
|
|
509
|
+
fact,
|
|
510
|
+
});
|
|
511
|
+
if (committed.ok) {
|
|
512
|
+
shapeTerminalCommitted = true;
|
|
513
|
+
break;
|
|
514
|
+
}
|
|
515
|
+
// A failed transition CAS must remain zero-write. Stop the controller
|
|
516
|
+
// before any executor starts; never compensate with a capsule-less
|
|
517
|
+
// terminal state or mutate pending descendants.
|
|
518
|
+
throw new Error(`frontend shape transition CAS failed at ${mapping.boundary}: ${committed.reason}`);
|
|
519
|
+
}
|
|
520
|
+
if (shapeTerminalCommitted)
|
|
521
|
+
break;
|
|
522
|
+
const runnableAfterShape = runnableAfterAdmission.filter((id) => !shapeBlocked.has(id));
|
|
425
523
|
const blocked = pending.filter((id) => {
|
|
426
524
|
const task = input.tasksById.get(id);
|
|
427
525
|
return (dependencyReadiness(task, input.state.nodes, input.tasksById) === "skip");
|
|
@@ -436,12 +534,12 @@ export async function executeDagRanksOnce(input) {
|
|
|
436
534
|
if (blocked.length > 0) {
|
|
437
535
|
await input.persistState();
|
|
438
536
|
}
|
|
439
|
-
const pauseGateRunnable =
|
|
537
|
+
const pauseGateRunnable = runnableAfterShape.filter((id) => {
|
|
440
538
|
const task = input.tasksById.get(id);
|
|
441
539
|
return isPauseOnHumanDecisionGate(task);
|
|
442
540
|
});
|
|
443
|
-
const regularRunnable =
|
|
444
|
-
const rankWriterNodeIds =
|
|
541
|
+
const regularRunnable = runnableAfterShape.filter((id) => !pauseGateRunnable.includes(id));
|
|
542
|
+
const rankWriterNodeIds = runnableAfterShape.filter((id) => {
|
|
445
543
|
const task = input.tasksById.get(id);
|
|
446
544
|
return (task?.executor === "pi" &&
|
|
447
545
|
task.toolProfile === "write" &&
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { DEFAULT_FRONTEND_SPEC_ROOTS, isFrontendSpecFilePath, isValidFrontendSpecRoot, OPENSPEC_SPEC_EXT_RE, } from "../../shared/openspec-spec.js";
|
|
3
3
|
import { campaignBudgetSchema, } from "../../application/evaluation/budget.js";
|
|
4
4
|
import { assertDagPromptSourceRule } from "./prompt-source.js";
|
|
5
|
-
import
|
|
5
|
+
// Leaf-module import: dagRetryPolicySchema must be defined by a module that
|
|
6
|
+
// never transitively reaches types.ts during init (retry-policy does, via
|
|
7
|
+
// frontend-recovery-capsule → frontend-recovery-lineage →
|
|
8
|
+
// frontend-implementation-contract), or a run whose entry module initializes
|
|
9
|
+
// retry-policy first reads an undefined schema here.
|
|
10
|
+
import { dagRetryPolicySchema, TARGET_TEMPLATE_TRANSIENT_RETRY_PROFILE, } from "./dag-retry-schema.js";
|
|
6
11
|
import { dagLivenessPolicySchema, } from "./liveness-policy.js";
|
|
7
12
|
import { dagOutputProtocolSchema } from "./output-protocol.js";
|
|
8
13
|
export const dagComplexitySchema = z.enum(["HIGH", "MED", "LOW"]);
|
|
@@ -188,7 +193,16 @@ const dagFrontendNodeIdSchema = z
|
|
|
188
193
|
.regex(/^[a-z][a-z0-9-]*$/, "frontend node id must be kebab-case");
|
|
189
194
|
const openspecCandidatePathSchema = z
|
|
190
195
|
.string()
|
|
191
|
-
.refine((candidate) => !candidate.includes("\\") &&
|
|
196
|
+
.refine((candidate) => !candidate.includes("\\") &&
|
|
197
|
+
!candidate.startsWith("/") &&
|
|
198
|
+
!candidate.split("/").includes("..") &&
|
|
199
|
+
OPENSPEC_SPEC_EXT_RE.test(candidate), "openspec candidate must be a repo-relative supported specification file");
|
|
200
|
+
const openspecCandidateSnapshotSchema = z
|
|
201
|
+
.object({
|
|
202
|
+
path: openspecCandidatePathSchema,
|
|
203
|
+
sha256: z.string().regex(/^[a-f0-9]{64}$/),
|
|
204
|
+
})
|
|
205
|
+
.strict();
|
|
192
206
|
export const dagFrontendPrewriteGateSchema = z.object({
|
|
193
207
|
schemaVersion: z.literal(1),
|
|
194
208
|
planFromNodeId: dagFrontendNodeIdSchema,
|
|
@@ -207,7 +221,24 @@ export const dagFrontendPrewriteGateSchema = z.object({
|
|
|
207
221
|
outputDir: z.string().regex(/^[a-z0-9][a-z0-9._-]*$/),
|
|
208
222
|
requireSourceFreshness: z.literal(true),
|
|
209
223
|
implementationWriteSet: z.array(z.string().min(1)).min(1).optional(),
|
|
224
|
+
/**
|
|
225
|
+
* Generation-frozen roots that bound custom normative directories. Omitted
|
|
226
|
+
* legacy DAGs retain the canonical OpenSpec + ai_workspace roots.
|
|
227
|
+
*/
|
|
228
|
+
openspecSpecRoots: z
|
|
229
|
+
.array(z.string().refine((root) => isValidFrontendSpecRoot(root), "openspec spec root must be a normalized repo-relative directory"))
|
|
230
|
+
.optional(),
|
|
210
231
|
openspecCandidatePaths: z.array(openspecCandidatePathSchema).default([]),
|
|
232
|
+
/** Read-only selector output; omitted for scan-strict and legacy DAGs. */
|
|
233
|
+
openspecSelectionNodeId: dagFrontendNodeIdSchema.optional(),
|
|
234
|
+
/** Contract-declared and source-explicit paths that cannot be downgraded. */
|
|
235
|
+
openspecMandatoryPaths: z.array(openspecCandidatePathSchema).optional(),
|
|
236
|
+
/**
|
|
237
|
+
* Content fingerprints frozen with the generation-time OpenSpec scope. New
|
|
238
|
+
* DAGs use these to reject a plan whose cited specification changed after it
|
|
239
|
+
* was read; legacy DAGs without the field retain existence-only drift checks.
|
|
240
|
+
*/
|
|
241
|
+
openspecCandidateSnapshots: z.array(openspecCandidateSnapshotSchema).optional(),
|
|
211
242
|
/**
|
|
212
243
|
* Generation-frozen component/theme specification bucket. Derived from
|
|
213
244
|
* `designEvidence.classified.component ∪ theme ∪ rule.components` at DAG
|
|
@@ -252,14 +283,28 @@ export const dagFrontendPrewriteGateSchema = z.object({
|
|
|
252
283
|
scanStrict: z.array(openspecCandidatePathSchema).default([]),
|
|
253
284
|
})
|
|
254
285
|
.optional(),
|
|
286
|
+
}).superRefine((gate, context) => {
|
|
287
|
+
const roots = gate.openspecSpecRoots ?? DEFAULT_FRONTEND_SPEC_ROOTS;
|
|
288
|
+
const candidateGroups = [
|
|
289
|
+
["openspecCandidatePaths", gate.openspecCandidatePaths],
|
|
290
|
+
["openspecMandatoryPaths", gate.openspecMandatoryPaths],
|
|
291
|
+
["componentSpecCandidatePaths", gate.componentSpecCandidatePaths],
|
|
292
|
+
["openspecCandidateSources.declared", gate.openspecCandidateSources?.declared],
|
|
293
|
+
["openspecCandidateSources.taskSourceCited", gate.openspecCandidateSources?.taskSourceCited],
|
|
294
|
+
["openspecCandidateSources.scanStrict", gate.openspecCandidateSources?.scanStrict],
|
|
295
|
+
];
|
|
296
|
+
for (const [field, paths] of candidateGroups) {
|
|
297
|
+
for (const [index, candidate] of (paths ?? []).entries()) {
|
|
298
|
+
if (!isFrontendSpecFilePath(candidate, roots)) {
|
|
299
|
+
context.addIssue({
|
|
300
|
+
code: z.ZodIssueCode.custom,
|
|
301
|
+
path: [...field.split("."), index],
|
|
302
|
+
message: "openspec candidate must be a supported file under the generation-frozen openspec spec roots",
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
255
307
|
});
|
|
256
|
-
export const dagFrontendLintBaselineSchema = z
|
|
257
|
-
.object({
|
|
258
|
-
schemaVersion: z.literal(1),
|
|
259
|
-
lintCommands: z.array(z.string().min(1)).min(1),
|
|
260
|
-
lintEvidence: dagShellVerifyEvidenceSchema,
|
|
261
|
-
})
|
|
262
|
-
.strict();
|
|
263
308
|
export const dagFrontendVerificationBundleSchema = z
|
|
264
309
|
.object({
|
|
265
310
|
schemaVersion: z.literal(1),
|
|
@@ -273,6 +318,10 @@ export const dagFrontendVerificationBundleSchema = z
|
|
|
273
318
|
behaviorEvidence: dagShellVerifyEvidenceSchema,
|
|
274
319
|
lintBaselineNodeId: dagFrontendNodeIdSchema.optional(),
|
|
275
320
|
writerNodeIds: z.array(dagFrontendNodeIdSchema).optional(),
|
|
321
|
+
/** "initial" = first-pass assess bundle; "repair" = the convergence
|
|
322
|
+
* loop's post-repair reverify, which re-runs the same frozen commands
|
|
323
|
+
* and fails on any failure (still no same-run repair branch inside the
|
|
324
|
+
* node itself). */
|
|
276
325
|
mode: z.enum(["initial", "repair"]),
|
|
277
326
|
})
|
|
278
327
|
.superRefine((bundle, context) => {
|
|
@@ -348,6 +397,135 @@ export const dagFrontendReviewContextSchema = z.object({
|
|
|
348
397
|
schemaVersion: z.literal(1),
|
|
349
398
|
requireBaseline: z.literal(true),
|
|
350
399
|
});
|
|
400
|
+
/**
|
|
401
|
+
* Deterministic frontend contract-import shell (micro topology). Re-validates
|
|
402
|
+
* the generation-frozen managed Contract's source/binding/schema freshness and
|
|
403
|
+
* emits a digest. It never invokes a model and never rewrites requirements —
|
|
404
|
+
* micro requires a pre-validated managed Contract, not natural-language intake.
|
|
405
|
+
*/
|
|
406
|
+
export const dagFrontendContractImportSchema = z.object({
|
|
407
|
+
schemaVersion: z.literal(1),
|
|
408
|
+
artifactName: z.string().regex(/^[a-z0-9][a-z0-9._-]*\.json$/),
|
|
409
|
+
outputDir: z.string().regex(/^[a-z0-9][a-z0-9._-]*$/),
|
|
410
|
+
requireSourceFreshness: z.literal(true),
|
|
411
|
+
});
|
|
412
|
+
/**
|
|
413
|
+
* Deterministic frontend design-policy shell (M8). Materializes the canonical
|
|
414
|
+
* implementation contract from the plan node and evaluates the design policy
|
|
415
|
+
* (Mock strategy, source freshness, component spec candidates, writeSet
|
|
416
|
+
* patterns, allowed dependencies). Runs BEFORE frontend-design-review-pi, so it
|
|
417
|
+
* never consumes a design verdict; the verdict is enforced by the writer
|
|
418
|
+
* admission shell instead. Replaces the prewrite-gate authorization path.
|
|
419
|
+
*/
|
|
420
|
+
export const dagFrontendDesignPolicySchema = z
|
|
421
|
+
.object({
|
|
422
|
+
schemaVersion: z.literal(1),
|
|
423
|
+
planFromNodeId: dagFrontendNodeIdSchema,
|
|
424
|
+
requiredRequirementIds: z
|
|
425
|
+
.array(z.string().regex(/^(?:REQ|BR|AC)-[A-Z0-9]+(?:-[A-Z0-9]+)*$/))
|
|
426
|
+
.default([]),
|
|
427
|
+
allowedMockStrategies: z
|
|
428
|
+
.array(z.enum(["native", "browser-intercept", "request-adapter", "not-needed"]))
|
|
429
|
+
.min(1),
|
|
430
|
+
/** Frozen Mock verification command labels the DAG will actually execute. */
|
|
431
|
+
mockCommandLabels: z.array(z.string()).default([]),
|
|
432
|
+
artifactName: z.string().regex(/^[a-z0-9][a-z0-9._-]*\.json$/),
|
|
433
|
+
outputDir: z.string().regex(/^[a-z0-9][a-z0-9._-]*$/),
|
|
434
|
+
requireSourceFreshness: z.literal(true),
|
|
435
|
+
implementationWriteSet: z.array(z.string().min(1)).min(1).optional(),
|
|
436
|
+
/** Generation-frozen roots that bound custom normative directories. */
|
|
437
|
+
openspecSpecRoots: z
|
|
438
|
+
.array(z.string().refine((root) => isValidFrontendSpecRoot(root), "openspec spec root must be a normalized repo-relative directory"))
|
|
439
|
+
.optional(),
|
|
440
|
+
openspecCandidatePaths: z.array(openspecCandidatePathSchema).default([]),
|
|
441
|
+
/** Read-only selector output; omitted for scan-strict and legacy DAGs. */
|
|
442
|
+
openspecSelectionNodeId: dagFrontendNodeIdSchema.optional(),
|
|
443
|
+
/** Contract-declared and source-explicit paths that cannot be downgraded. */
|
|
444
|
+
openspecMandatoryPaths: z.array(openspecCandidatePathSchema).optional(),
|
|
445
|
+
openspecCandidateSnapshots: z
|
|
446
|
+
.array(openspecCandidateSnapshotSchema)
|
|
447
|
+
.optional(),
|
|
448
|
+
/**
|
|
449
|
+
* Generation-frozen component/theme specification bucket. Derived from
|
|
450
|
+
* `designEvidence.classified.component ∪ theme ∪ rule.components` at DAG
|
|
451
|
+
* generation. When non-empty and the canonical contract has UI-visible
|
|
452
|
+
* work, the design policy requires a non-empty `uiComponentChoices` and
|
|
453
|
+
* cross-checks each `specReference.path` against this set + the effective
|
|
454
|
+
* plan openspec-citations block.
|
|
455
|
+
*/
|
|
456
|
+
componentSpecCandidatePaths: z.array(openspecCandidatePathSchema).optional(),
|
|
457
|
+
/** OpenSpec gate policy (cited | scan-strict); generation always writes it. */
|
|
458
|
+
openspecPolicy: z.enum(["cited", "scan-strict"]).optional(),
|
|
459
|
+
/** Generation-frozen candidate source metadata (diagnostic). */
|
|
460
|
+
openspecCandidateSources: z
|
|
461
|
+
.object({
|
|
462
|
+
declared: z.array(openspecCandidatePathSchema).default([]),
|
|
463
|
+
taskSourceCited: z.array(openspecCandidatePathSchema).default([]),
|
|
464
|
+
scanStrict: z.array(openspecCandidatePathSchema).default([]),
|
|
465
|
+
})
|
|
466
|
+
.optional(),
|
|
467
|
+
/** Dependency identifiers authorized at generation time (empty = none). */
|
|
468
|
+
allowedDependencies: z.array(z.string()).default([]),
|
|
469
|
+
})
|
|
470
|
+
.superRefine((gate, context) => {
|
|
471
|
+
const roots = gate.openspecSpecRoots ?? DEFAULT_FRONTEND_SPEC_ROOTS;
|
|
472
|
+
const candidateGroups = [
|
|
473
|
+
["openspecCandidatePaths", gate.openspecCandidatePaths],
|
|
474
|
+
["openspecMandatoryPaths", gate.openspecMandatoryPaths],
|
|
475
|
+
["componentSpecCandidatePaths", gate.componentSpecCandidatePaths],
|
|
476
|
+
["openspecCandidateSources.declared", gate.openspecCandidateSources?.declared],
|
|
477
|
+
["openspecCandidateSources.taskSourceCited", gate.openspecCandidateSources?.taskSourceCited],
|
|
478
|
+
["openspecCandidateSources.scanStrict", gate.openspecCandidateSources?.scanStrict],
|
|
479
|
+
];
|
|
480
|
+
for (const [field, paths] of candidateGroups) {
|
|
481
|
+
for (const [index, candidate] of (paths ?? []).entries()) {
|
|
482
|
+
if (!isFrontendSpecFilePath(candidate, roots)) {
|
|
483
|
+
context.addIssue({
|
|
484
|
+
code: z.ZodIssueCode.custom,
|
|
485
|
+
path: [...field.split("."), index],
|
|
486
|
+
message: "openspec candidate must be a supported file under the generation-frozen openspec spec roots",
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
/**
|
|
493
|
+
* Deterministic frontend writer-admission shell (M8). Runs after
|
|
494
|
+
* frontend-design-review-pi: freezes the writer baseline, derives the concrete
|
|
495
|
+
* writeSet, folds the design-policy result + design verdict into admission,
|
|
496
|
+
* and writes contracts/frontend-writer-admission-result.json
|
|
497
|
+
* (schemaId frontend-writer-admission-shell-v1).
|
|
498
|
+
*/
|
|
499
|
+
export const dagFrontendWriterAdmissionShellSchema = z
|
|
500
|
+
.object({
|
|
501
|
+
schemaVersion: z.literal(1),
|
|
502
|
+
/** Design verdict source (frontend-design-review-pi); pass is enforced.
|
|
503
|
+
* Omitted in small topology, which has no design review node. */
|
|
504
|
+
designReviewFromNodeId: dagFrontendNodeIdSchema.optional(),
|
|
505
|
+
/** Frozen command labels the verification bundle will execute. */
|
|
506
|
+
frozenCommandLabels: z.array(z.string()).default([]),
|
|
507
|
+
allowedMockStrategies: z
|
|
508
|
+
.array(z.enum(["native", "browser-intercept", "request-adapter", "not-needed"]))
|
|
509
|
+
.min(1),
|
|
510
|
+
/** Writer-preceding lint commands; baseline is materialized here (R5). */
|
|
511
|
+
lintCommands: z.array(z.string().min(1)).optional(),
|
|
512
|
+
lintEvidence: dagShellVerifyEvidenceSchema.optional(),
|
|
513
|
+
})
|
|
514
|
+
.superRefine((admission, context) => {
|
|
515
|
+
if ((admission.lintCommands?.length ?? 0) > 0 && !admission.lintEvidence) {
|
|
516
|
+
context.addIssue({
|
|
517
|
+
code: z.ZodIssueCode.custom,
|
|
518
|
+
path: ["lintEvidence"],
|
|
519
|
+
message: "lintEvidence is required when lintCommands are present",
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
/** Deterministic frontend closeout shell (M8). Renders the closeout from
|
|
524
|
+
* committed facts only (review context + typed review terminal + trace). */
|
|
525
|
+
export const dagFrontendCloseoutSchema = z.object({
|
|
526
|
+
schemaVersion: z.literal(1),
|
|
527
|
+
reviewFromNodeId: dagFrontendNodeIdSchema,
|
|
528
|
+
});
|
|
351
529
|
export const ENV_VAR_NAME_PATTERN = /^[A-Z_][A-Z0-9_]*$/;
|
|
352
530
|
export const dagVersionSchema = z
|
|
353
531
|
.union([z.literal(1), z.literal(2), z.literal(3), z.literal(4)])
|
|
@@ -395,7 +573,14 @@ export const dagWriteGuardPolicySchema = z.enum(["full", "tools-only", "filesyst
|
|
|
395
573
|
*/
|
|
396
574
|
export const dagWriterOutcomePolicySchema = z
|
|
397
575
|
.object({
|
|
398
|
-
|
|
576
|
+
/**
|
|
577
|
+
* Protocol face: `implementation-outcome-v1` keeps the legacy
|
|
578
|
+
* IMPLEMENTATION_OUTCOME first-line protocol (backend/README/module
|
|
579
|
+
* writers + frontend-repair-pi); `frontend-facts-v1` derives the status
|
|
580
|
+
* from mechanical facts (write-tool events / run delta / write guard /
|
|
581
|
+
* requirement coverage / focused-check) and never reads the first line.
|
|
582
|
+
*/
|
|
583
|
+
type: z.enum(["implementation-outcome-v1", "frontend-facts-v1"]),
|
|
399
584
|
/** Generation writers may forbid already-satisfied/no-diff completion. */
|
|
400
585
|
requireChangedFiles: z.boolean().optional(),
|
|
401
586
|
})
|
|
@@ -528,10 +713,13 @@ export const dagShellConfigSchema = z.object({
|
|
|
528
713
|
.optional(),
|
|
529
714
|
requirementCoverageGate: dagRequirementCoverageGateSchema.optional(),
|
|
530
715
|
jsonArtifactGate: dagJsonArtifactGateSchema.optional(),
|
|
716
|
+
frontendDesignPolicy: dagFrontendDesignPolicySchema.optional(),
|
|
717
|
+
frontendWriterAdmission: dagFrontendWriterAdmissionShellSchema.optional(),
|
|
531
718
|
frontendPrewriteGate: dagFrontendPrewriteGateSchema.optional(),
|
|
532
|
-
frontendLintBaseline: dagFrontendLintBaselineSchema.optional(),
|
|
533
719
|
frontendVerificationBundle: dagFrontendVerificationBundleSchema.optional(),
|
|
534
720
|
frontendReviewContext: dagFrontendReviewContextSchema.optional(),
|
|
721
|
+
frontendContractImport: dagFrontendContractImportSchema.optional(),
|
|
722
|
+
frontendCloseout: dagFrontendCloseoutSchema.optional(),
|
|
535
723
|
frontendTestCaseChecklist: dagFrontendTestCaseChecklistSchema.optional(),
|
|
536
724
|
frontendBrowserToolPreflight: dagFrontendBrowserToolPreflightSchema.optional(),
|
|
537
725
|
frontendTestStandardScenarios: dagFrontendTestStandardScenariosSchema.optional(),
|
|
@@ -821,6 +1009,19 @@ export const dagTaskSchema = z.object({
|
|
|
821
1009
|
role: dagRoleSchema.optional(),
|
|
822
1010
|
skills: z.array(z.string()).optional(),
|
|
823
1011
|
toolProfile: dagToolProfileSchema.optional(),
|
|
1012
|
+
/** Bounded read-only discovery budget for nodes that inspect a repository. */
|
|
1013
|
+
readBudget: z
|
|
1014
|
+
.object({
|
|
1015
|
+
maxFiles: z.number().int().positive(),
|
|
1016
|
+
maxBytes: z.number().int().positive(),
|
|
1017
|
+
maxMs: z.number().int().positive().optional(),
|
|
1018
|
+
/** Maximum read/grep/find/ls calls. */
|
|
1019
|
+
maxOperations: z.number().int().positive().optional(),
|
|
1020
|
+
/** On any read budget exhaustion, return concise completion guidance instead of failing the node. */
|
|
1021
|
+
onExhaustion: z.enum(["return-guidance"]).optional(),
|
|
1022
|
+
})
|
|
1023
|
+
.strict()
|
|
1024
|
+
.optional(),
|
|
824
1025
|
/**
|
|
825
1026
|
* Explicit Pi extension allowlist (backend implementation DAGs only):
|
|
826
1027
|
* frozen short ids resolved at run time against the Pi settings package
|
|
@@ -1189,6 +1390,22 @@ export const dagSpecSchema = z
|
|
|
1189
1390
|
taskContractBinding: dagTaskContractBindingSchema.optional(),
|
|
1190
1391
|
/** Optional unresolved parent-run feedback for a full task rerun. */
|
|
1191
1392
|
rerunFeedback: dagRerunFeedbackSchema.optional(),
|
|
1393
|
+
/** Frontend recovery continuation quota (frozen at generation time from
|
|
1394
|
+
* task.json frontendRecovery.maxContinuations). Bounds how many times a
|
|
1395
|
+
* failed frontend run may auto-recover via M6 recovery operations before
|
|
1396
|
+
* the run stays failed and needs human intervention. */
|
|
1397
|
+
frontendRecovery: z
|
|
1398
|
+
.object({
|
|
1399
|
+
maxContinuations: z
|
|
1400
|
+
.number()
|
|
1401
|
+
.int()
|
|
1402
|
+
.min(1)
|
|
1403
|
+
.max(5)
|
|
1404
|
+
.optional()
|
|
1405
|
+
.default(1),
|
|
1406
|
+
})
|
|
1407
|
+
.strict()
|
|
1408
|
+
.optional(),
|
|
1192
1409
|
/** Backend-test-only workspace mutation control; absent means Git. */
|
|
1193
1410
|
backendTestWorkspaceControl: z.enum(["git", "filesystem-only"]).optional(),
|
|
1194
1411
|
/** Frozen backend-test artifact layout (plan A); absent = historical default testcase/ layout. */
|
|
@@ -1315,6 +1532,9 @@ export const FRONTEND_RECOVERY_RESULT_SCHEMA_VERSION = 1;
|
|
|
1315
1532
|
* Phase 3a parents converge first, so `rollback-pending` is not produced and
|
|
1316
1533
|
* was removed by AC-1; the phase starts at `child-staging` and ends at
|
|
1317
1534
|
* `settled`.
|
|
1535
|
+
*
|
|
1536
|
+
* @deprecated Read-only compatibility only; the M6 operation controller no
|
|
1537
|
+
* longer uses this phase as the authoritative recovery entry point.
|
|
1318
1538
|
*/
|
|
1319
1539
|
export const frontendRecoveryPhaseSchema = z.enum([
|
|
1320
1540
|
"child-staging",
|
|
@@ -1334,6 +1554,9 @@ export const frontendRecoveryPhaseSchema = z.enum([
|
|
|
1334
1554
|
* runner's `(existing?.revision ?? 0) + 1` CAS write (the schema only bounds it
|
|
1335
1555
|
* non-negative). `childRunId` may be absent through `child-activating` and must
|
|
1336
1556
|
* be non-empty from `child-running` onward.
|
|
1557
|
+
*
|
|
1558
|
+
* @deprecated Read-only compatibility only; the runner no longer writes this
|
|
1559
|
+
* intent (the M6 operation controller supervises recovery instead).
|
|
1337
1560
|
*/
|
|
1338
1561
|
export const frontendRecoveryStateSchema = z
|
|
1339
1562
|
.object({
|
|
@@ -1405,6 +1628,10 @@ export const frontendRecoveryEvidenceRefSchema = z
|
|
|
1405
1628
|
* stays permissive (failureClass optional, evidenceRefs may be empty) so it
|
|
1406
1629
|
* accepts the runner's actual phase-3a products, which do not always carry a
|
|
1407
1630
|
* failure class or evidence reference.
|
|
1631
|
+
*
|
|
1632
|
+
* @deprecated Read-only compatibility only; the M6 operation controller writes
|
|
1633
|
+
* `recovered`/`auto-recovery-blocked` results directly and never uses this
|
|
1634
|
+
* schema as the authoritative recovery settlement.
|
|
1408
1635
|
*/
|
|
1409
1636
|
export const frontendRecoveryResultSchema = z
|
|
1410
1637
|
.object({
|
|
@@ -3,7 +3,7 @@ import { resolveShellCommands } from "../../executors/shell-executor.js";
|
|
|
3
3
|
import { pathMatchesPattern } from "../../shared/git-progress.js";
|
|
4
4
|
import { resolveRepairTaskForGate } from "./repair-artifact.js";
|
|
5
5
|
import { topoSortToRanks } from "./topo.js";
|
|
6
|
-
import { isSafeReadOnlyPiRetryCandidate, isWriterEmptyDiffRetryCandidate, isWriterTransportRetryCandidate, INCOMPLETE_WRITE_SET_RETRY_CATEGORY, WRITER_CLEAN_TIMEOUT_RETRY_CATEGORY, WRITER_EMPTY_DIFF_RETRY_CATEGORY, } from "./retry-policy.js";
|
|
6
|
+
import { isSafeReadOnlyPiRetryCandidate, isWriterEmptyDiffRetryCandidate, isWriterTransportRetryCandidate, INCOMPLETE_WRITE_SET_RETRY_CATEGORY, WRITER_CLEAN_TIMEOUT_RETRY_CATEGORY, WRITER_EMPTY_DIFF_RETRY_CATEGORY, CONTEXT_OVERFLOW_RETRY_CATEGORY, } from "./retry-policy.js";
|
|
7
7
|
import { isBackendTestCompletenessRetryCandidate } from "./backend-test-writer-completeness.js";
|
|
8
8
|
import { defaultFrontendTestLayout, frontendTestLayoutFromSpec, } from "./frontend-test-layout.js";
|
|
9
9
|
const GOVERNANCE_WARNING_TYPES = new Set([
|
|
@@ -464,7 +464,9 @@ function validateShellTaskConfig(task, spec, issues) {
|
|
|
464
464
|
if (commands.length === 0 &&
|
|
465
465
|
!shell.jsonArtifactGate &&
|
|
466
466
|
!shell.backendTestPipeline &&
|
|
467
|
-
!shell.
|
|
467
|
+
!shell.frontendDesignPolicy &&
|
|
468
|
+
!shell.frontendWriterAdmission &&
|
|
469
|
+
!shell.frontendCloseout &&
|
|
468
470
|
!shell.frontendBrowserToolPreflight &&
|
|
469
471
|
!shell.frontendTestStandardScenarios &&
|
|
470
472
|
!shell.frontendTestEnvironmentProbe &&
|
|
@@ -537,18 +539,26 @@ function validateShellTaskConfig(task, spec, issues) {
|
|
|
537
539
|
}
|
|
538
540
|
}
|
|
539
541
|
}
|
|
540
|
-
if (shell.
|
|
541
|
-
const sourceNodeIds = [
|
|
542
|
-
shell.frontendPrewriteGate.planFromNodeId,
|
|
543
|
-
...shell.frontendPrewriteGate.planFallbackFromNodeIds,
|
|
544
|
-
shell.frontendPrewriteGate.reviewFromNodeId,
|
|
545
|
-
...shell.frontendPrewriteGate.reviewFallbackFromNodeIds,
|
|
546
|
-
];
|
|
542
|
+
if (shell.frontendDesignPolicy) {
|
|
543
|
+
const sourceNodeIds = [shell.frontendDesignPolicy.planFromNodeId];
|
|
547
544
|
for (const sourceNodeId of new Set(sourceNodeIds)) {
|
|
548
545
|
if (!task.depends_on.includes(sourceNodeId)) {
|
|
549
546
|
issues.push({
|
|
550
547
|
type: "missing-dependency",
|
|
551
|
-
message: `shell task ${task.id}
|
|
548
|
+
message: `shell task ${task.id} frontendDesignPolicy source ${sourceNodeId} must be a direct dependency`,
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
if (shell.frontendWriterAdmission) {
|
|
554
|
+
const sourceNodeIds = shell.frontendWriterAdmission.designReviewFromNodeId
|
|
555
|
+
? [shell.frontendWriterAdmission.designReviewFromNodeId]
|
|
556
|
+
: [];
|
|
557
|
+
for (const sourceNodeId of new Set(sourceNodeIds)) {
|
|
558
|
+
if (!task.depends_on.includes(sourceNodeId)) {
|
|
559
|
+
issues.push({
|
|
560
|
+
type: "missing-dependency",
|
|
561
|
+
message: `shell task ${task.id} frontendWriterAdmission source ${sourceNodeId} must be a direct dependency`,
|
|
552
562
|
});
|
|
553
563
|
}
|
|
554
564
|
}
|
|
@@ -646,12 +656,18 @@ function validateRetryPolicyTaskConfig(task, issues) {
|
|
|
646
656
|
}
|
|
647
657
|
if (isWriterTransportCandidate) {
|
|
648
658
|
const categories = new Set(task.retryPolicy.retryCategories);
|
|
659
|
+
const allowedWriterTransportCategories = new Set([
|
|
660
|
+
WRITER_CLEAN_TIMEOUT_RETRY_CATEGORY,
|
|
661
|
+
CONTEXT_OVERFLOW_RETRY_CATEGORY,
|
|
662
|
+
]);
|
|
663
|
+
const allAllowed = [...categories].every((category) => allowedWriterTransportCategories.has(category));
|
|
649
664
|
if (task.retryPolicy.maxAttempts !== 2 ||
|
|
650
|
-
categories.size
|
|
665
|
+
categories.size === 0 ||
|
|
666
|
+
!allAllowed ||
|
|
651
667
|
!categories.has(WRITER_CLEAN_TIMEOUT_RETRY_CATEGORY)) {
|
|
652
668
|
issues.push({
|
|
653
669
|
type: "invalid-retry-policy",
|
|
654
|
-
message: `task ${task.id} writer transport retryPolicy must use exactly two total attempts and only
|
|
670
|
+
message: `task ${task.id} writer transport retryPolicy must use exactly two total attempts and only writer-clean-timeout (plus optional context-overflow)`,
|
|
655
671
|
});
|
|
656
672
|
}
|
|
657
673
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# 示例输入
|
|
2
|
+
|
|
3
|
+
本目录存放可直接复用的示例任务输入(PRD / 需求文档),用于 dogfood、冒烟与演示;不是治理契约真源。
|
|
4
|
+
|
|
5
|
+
- [`frontend-smoke-requirement.md`](frontend-smoke-requirement.md) — `frontend-implementation` taskKind 的**最小真实 DAG 冒烟 PRD**(单页物品列表:loading / empty / error / success / disabled 五态 + 刷新交互)。配合 `执行约束.md` 作为 `task advance --prd` 的 source 输入,走 `contract → scout → plan → design-policy → design-review → writer-admission → implement → verify → review → closeout` 全链;2026-08-31 frontend-node → main 合并日冒烟即以它为输入(见 [`../reports/merge/2026-08-31-frontend-node-into-main-192a196c.md`](../reports/merge/2026-08-31-frontend-node-into-main-192a196c.md))。
|