@tea-agent/loop-agent 0.41.0-next.3 → 0.41.1-beta.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/CHANGELOG.md +264 -32
- 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 +945 -217
- package/dist/executors/shell-write-guard.js +7 -0
- 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 -7
- 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/pi-runtime.js +2 -3
- package/dist/worker/console/chat/routes.js +3 -12
- package/dist/worker/console/chat/semantic-activity.js +11 -12
- package/dist/worker/console/chat/session-stats.js +0 -96
- package/dist/worker/console/chat/turn-process.js +4 -28
- 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/operation-store.js +226 -6
- package/dist/worker/console/operator-actions.js +169 -7
- package/dist/worker/console/pi-plugins.js +1 -3
- package/dist/worker/console/server.js +3 -0
- package/dist/worker/console/static/assets/{abnfDiagram-N423BO3Z-DwVJxUxz.js → abnfDiagram-N423BO3Z-Bho4we4c.js} +1 -1
- package/dist/worker/console/static/assets/{arc-DqfCcXdu.js → arc-TBDkTeK0.js} +1 -1
- package/dist/worker/console/static/assets/{architectureDiagram-T3A2C74G-qMVtggRv.js → architectureDiagram-T3A2C74G-BF_fZrn2.js} +1 -1
- package/dist/worker/console/static/assets/{blockDiagram-VBNYF7ZC-ECrV38dh.js → blockDiagram-VBNYF7ZC-CCnPgUe2.js} +1 -1
- package/dist/worker/console/static/assets/{c4Diagram-5PPSVZJV-DBaaLqQv.js → c4Diagram-5PPSVZJV-BCYZJLAT.js} +1 -1
- package/dist/worker/console/static/assets/channel-bnXW0U3C.js +1 -0
- package/dist/worker/console/static/assets/{chunk-2GRJ4B5K-BvfNHkAz.js → chunk-2GRJ4B5K-D8K6adhU.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-2Q5K7J3B-C5StiIbc.js → chunk-2Q5K7J3B-DkT1Q78b.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5RXB4S5H-HabGiJkS.js → chunk-5RXB4S5H-DuhvpIr7.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5VM5RSS4-BiTg127i.js → chunk-5VM5RSS4-BnK6dC49.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-6Q2QTUOP-CZsXBPuR.js → chunk-6Q2QTUOP-DPz__z7r.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-GF5L2VYU-D-r1MxLK.js → chunk-GF5L2VYU-0kkppM2j.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-JWPE2WC7-DQxb9plr.js → chunk-JWPE2WC7-BB41iK5t.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-KBJHAD2P-DMndGvCT.js → chunk-KBJHAD2P-CiVrxKHU.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-RYQCIY6F-ByL4BgOJ.js → chunk-RYQCIY6F-C2h9Xje1.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-XXDRQBXY-BVe1b1gL.js → chunk-XXDRQBXY-3iOSHdbM.js} +1 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-rZpq_twR.js +1 -0
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-rZpq_twR.js +1 -0
- package/dist/worker/console/static/assets/{cose-bilkent-JH36ORCC-BAyGzN8j.js → cose-bilkent-JH36ORCC-BN3A7tkk.js} +1 -1
- package/dist/worker/console/static/assets/{cynefin-VYW2F7L2-C5yVYU7E.js → cynefin-VYW2F7L2-CTuBy0Or.js} +1 -1
- package/dist/worker/console/static/assets/{cynefinDiagram-MW4NZA55-x-MwsEm9.js → cynefinDiagram-MW4NZA55-wb6tUlMN.js} +1 -1
- package/dist/worker/console/static/assets/{dagre-VZM6K2ZE-CT5Tle5F.js → dagre-VZM6K2ZE-GP1Ivx8B.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-7IWD3JNH-BARERhlS.js → diagram-7IWD3JNH-ejrcK6L0.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-B4RE2ZJO-BwfUz0VM.js → diagram-B4RE2ZJO-YFkCCvUU.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-LBJQPF4R-Mk4r2WvJ.js → diagram-LBJQPF4R-B4rrvIaL.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-Q27KOJAE-KUrxuBs0.js → diagram-Q27KOJAE-C-YIZcUf.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-UB23O5K3-CjZOceZn.js → diagram-UB23O5K3-BPF5wcL1.js} +1 -1
- package/dist/worker/console/static/assets/{ebnfDiagram-BXEA7PRR-rnwUCiEI.js → ebnfDiagram-BXEA7PRR-CU5SzXjO.js} +1 -1
- package/dist/worker/console/static/assets/{erDiagram-JOGREHBK-DM4j23FM.js → erDiagram-JOGREHBK-CpL414DE.js} +1 -1
- package/dist/worker/console/static/assets/{flowDiagram-UKHOOZJN-DD5HdDEs.js → flowDiagram-UKHOOZJN-MrhLzNau.js} +1 -1
- package/dist/worker/console/static/assets/{ganttDiagram-PKOTCBZU-CIAGSF47.js → ganttDiagram-PKOTCBZU-Bg4qFuUo.js} +1 -1
- package/dist/worker/console/static/assets/{gitGraphDiagram-DS77QQ5N-DbwFbVEL.js → gitGraphDiagram-DS77QQ5N-ColxSXLR.js} +1 -1
- package/dist/worker/console/static/assets/index-D3CC4eUz.css +1 -0
- package/dist/worker/console/static/assets/index-DLt4ZFvD.js +437 -0
- package/dist/worker/console/static/assets/{infoDiagram-6WML65LV-B-Pb0T66.js → infoDiagram-6WML65LV-Czvtm6gc.js} +1 -1
- package/dist/worker/console/static/assets/{ishikawaDiagram-WSZJBQD7-B9Unk-YX.js → ishikawaDiagram-WSZJBQD7-B7Xp8HyJ.js} +1 -1
- package/dist/worker/console/static/assets/{journeyDiagram-NVQOT4AX-C2F3JkPt.js → journeyDiagram-NVQOT4AX-DWYZcvph.js} +1 -1
- package/dist/worker/console/static/assets/{kanban-definition-27J2QSJJ-Bl8-Xcoz.js → kanban-definition-27J2QSJJ-KTLZRUjx.js} +1 -1
- package/dist/worker/console/static/assets/{linear-yK4uZmC5.js → linear-_Exn7bfl.js} +1 -1
- package/dist/worker/console/static/assets/{mermaid.core-Bpa6PmuE.js → mermaid.core-Cxg8kX8V.js} +5 -5
- package/dist/worker/console/static/assets/{mindmap-definition-FAOFIHXS-BfGRoCSe.js → mindmap-definition-FAOFIHXS-oKrlo2Bt.js} +1 -1
- package/dist/worker/console/static/assets/{pegDiagram-VL7TDLO6-Bz6_HtST.js → pegDiagram-VL7TDLO6-XAeteiNd.js} +1 -1
- package/dist/worker/console/static/assets/{pieDiagram-7S7Q4E2Y-i0Umbsby.js → pieDiagram-7S7Q4E2Y-BTf1K-lp.js} +1 -1
- package/dist/worker/console/static/assets/{quadrantDiagram-CIZ2JOQS-DaVQBobe.js → quadrantDiagram-CIZ2JOQS-C0IlY0Jf.js} +1 -1
- package/dist/worker/console/static/assets/{railroadDiagram-AXF67PYL-DMTGnSq7.js → railroadDiagram-AXF67PYL-BVbKtZhW.js} +1 -1
- package/dist/worker/console/static/assets/{requirementDiagram-LRYGKXZP-2ao_DaSq.js → requirementDiagram-LRYGKXZP-C5e4JFcr.js} +1 -1
- package/dist/worker/console/static/assets/{sankeyDiagram-W5VNT64P-2SG1lTB9.js → sankeyDiagram-W5VNT64P-Cz30hc29.js} +1 -1
- package/dist/worker/console/static/assets/{sequenceDiagram-SI44F4Z6-BQYOLybR.js → sequenceDiagram-SI44F4Z6-DS33n6d0.js} +1 -1
- package/dist/worker/console/static/assets/{sizeCapture-X5ZJPWSS-C8g3yjuI.js → sizeCapture-X5ZJPWSS-46w7v-9T.js} +1 -1
- package/dist/worker/console/static/assets/{stateDiagram-OKZ733FA-q_F8nAQG.js → stateDiagram-OKZ733FA-pbcD5SsZ.js} +1 -1
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-zBMYiUyi.js +1 -0
- package/dist/worker/console/static/assets/{swimlanes-SLNWSIFB-8LrWpH2s.js → swimlanes-SLNWSIFB-DuivYBSj.js} +2 -2
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-d_rms-5i.js +8 -0
- package/dist/worker/console/static/assets/{timeline-definition-Z64GVDOM-BQoY3qzl.js → timeline-definition-Z64GVDOM-Cb9VZVIl.js} +1 -1
- package/dist/worker/console/static/assets/{vennDiagram-T6HMQDX7-BDu1UjSp.js → vennDiagram-T6HMQDX7-D2-mfOgR.js} +1 -1
- package/dist/worker/console/static/assets/{wardleyDiagram-T6FBY63Y-C48M7Y0a.js → wardleyDiagram-T6FBY63Y-DeS2aC76.js} +1 -1
- package/dist/worker/console/static/assets/{xychartDiagram-ELKLHX3M-YU6FTl_F.js → xychartDiagram-ELKLHX3M-WGsrFjxH.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/app/useRunProgress.js +2 -9
- package/dist/worker/console/static-src/operator-chat/useChatSessions.js +0 -2
- package/dist/worker/console/static-src/operator-chat/useChatThread.js +0 -6
- package/dist/worker/console/static-src/operator-chat/useRuntimeControls.js +3 -28
- package/dist/worker/console/static-src/pages/tasks/run-panel-progress.js +0 -106
- package/dist/worker/console/workspace-context.js +111 -1
- package/dist/worker/materialize/frontend-split-task-materializer.js +72 -0
- package/dist/worker/observability/read-model.js +0 -4
- package/dist/worker/observe/static/dag-node-purpose.js +5 -0
- package/dist/worker/observe/static/views/dag-inspector.js +7 -2
- package/dist/worker/observe/static/views/session-timeline.js +15 -46
- package/dist/workflows/dag/backend-test-result-contract.js +1 -1
- 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 +932 -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-read-budgets.js +12 -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 +409 -0
- package/dist/workflows/dag/frontend-shape.js +427 -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 +685 -494
- 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 +10 -2
- 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 +429 -122
- 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/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 +3 -3
- 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-CL1NRAmS.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-PBGzzjZA.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-PBGzzjZA.js +0 -1
- package/dist/worker/console/static/assets/index-BfleX-qj.css +0 -1
- package/dist/worker/console/static/assets/index-Bih9w9h9.js +0 -451
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-DrxGBDJu.js +0 -1
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-BhpDxzAf.js +0 -8
- package/dist/worker/console/static-src/operator-chat/dag-progress-link.js +0 -22
- 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
|
@@ -124,6 +124,13 @@ export function isEphemeralToolCachePath(filePath) {
|
|
|
124
124
|
if (normalized === ".coverage" || normalized.startsWith(".coverage.")) {
|
|
125
125
|
return true;
|
|
126
126
|
}
|
|
127
|
+
// vite/vitest runtime caches live under node_modules/.vite (e.g.
|
|
128
|
+
// node_modules/.vite/vitest/results.json). node_modules is the gitignored
|
|
129
|
+
// dependency tree — tool cache writes there are never a writer's product
|
|
130
|
+
// change and must not trip the write guard.
|
|
131
|
+
if (normalized.startsWith("node_modules/.vite/")) {
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
127
134
|
if (/(?:^|\/)__pycache__(?:\/|$)/.test(normalized))
|
|
128
135
|
return true;
|
|
129
136
|
if (/\.(?:pyc|pyo)$/.test(normalized))
|
|
@@ -47,10 +47,22 @@ const RAW_TO_NORMALIZED = {
|
|
|
47
47
|
"verify-failure": "validation",
|
|
48
48
|
"test-failure": "validation",
|
|
49
49
|
"verification-plan-stale": "validation",
|
|
50
|
+
"read-burst": "validation",
|
|
51
|
+
// Writer persisted real file changes but the final provider call hit a
|
|
52
|
+
// context overflow; verification never ran. Distinct from empty-output so
|
|
53
|
+
// the report shows partial success instead of a spec issue.
|
|
54
|
+
"partial-success-with-context-overflow": "validation",
|
|
55
|
+
// Writer burned an excessive token budget (unconverged read-edit-test loop)
|
|
56
|
+
// and still failed; distinct from empty-output for accurate reporting.
|
|
57
|
+
"writer-budget-exhausted": "validation",
|
|
50
58
|
network: "executor",
|
|
51
59
|
quota: "executor",
|
|
52
60
|
"rate-limit": "executor",
|
|
53
61
|
unavailable: "executor",
|
|
62
|
+
// Context window overflow (400 request-too-large): the session needs
|
|
63
|
+
// compaction / fresh context before retrying — an executor-side
|
|
64
|
+
// environment condition, not a plan-quality defect.
|
|
65
|
+
"context-overflow": "executor",
|
|
54
66
|
// Deterministic capability/policy refusal: missing verified launcher JS
|
|
55
67
|
// entry, capability allowlist rejection, or missing bounded write tool
|
|
56
68
|
// profile. These are environment/config defects the operator repairs
|
|
@@ -12,6 +12,19 @@ export const OPENSPEC_SPEC_DIRS = [
|
|
|
12
12
|
"openspec/project-specs",
|
|
13
13
|
"ai_workspace",
|
|
14
14
|
];
|
|
15
|
+
/** Default roots used when a frontend task does not declare specRoots. */
|
|
16
|
+
export const DEFAULT_FRONTEND_SPEC_ROOTS = OPENSPEC_SPEC_DIRS;
|
|
17
|
+
/** A task-owned spec root must be a normalized, repo-relative POSIX directory. */
|
|
18
|
+
export function isValidFrontendSpecRoot(value) {
|
|
19
|
+
return (Boolean(value) &&
|
|
20
|
+
!value.includes("\\") &&
|
|
21
|
+
!value.startsWith("/") &&
|
|
22
|
+
!value.includes("//") &&
|
|
23
|
+
!value.split("/").some((segment) => !segment ||
|
|
24
|
+
segment === "." ||
|
|
25
|
+
segment === ".." ||
|
|
26
|
+
/\s/.test(segment)));
|
|
27
|
+
}
|
|
15
28
|
/** Allowed spec file extensions (case-insensitive). */
|
|
16
29
|
export const OPENSPEC_SPEC_EXT_RE = /\.(md|mdx|json|yaml|yml)$/i;
|
|
17
30
|
/**
|
|
@@ -43,14 +56,17 @@ export function isGovernanceSubtreePath(filePath, governanceRoot) {
|
|
|
43
56
|
* directories. `filePath` must be a repo-relative POSIX path (backslashes are
|
|
44
57
|
* normalised internally). Directory names are case-sensitive.
|
|
45
58
|
*/
|
|
46
|
-
export function
|
|
59
|
+
export function isFrontendSpecPath(filePath, specRoots = DEFAULT_FRONTEND_SPEC_ROOTS) {
|
|
47
60
|
const normalized = filePath.replaceAll("\\", "/");
|
|
48
|
-
for (const dir of
|
|
61
|
+
for (const dir of specRoots) {
|
|
49
62
|
if (normalized === dir || normalized.startsWith(dir + "/"))
|
|
50
63
|
return true;
|
|
51
64
|
}
|
|
52
65
|
return false;
|
|
53
66
|
}
|
|
67
|
+
export function isOpenspecSpecPath(filePath) {
|
|
68
|
+
return isFrontendSpecPath(filePath);
|
|
69
|
+
}
|
|
54
70
|
/**
|
|
55
71
|
* Returns `true` when `filename` (the basename only, not a full path) has an
|
|
56
72
|
* allowed frontend specification extension.
|
|
@@ -59,10 +75,13 @@ export function isValidOpenspecExtension(filename) {
|
|
|
59
75
|
return OPENSPEC_SPEC_EXT_RE.test(filename);
|
|
60
76
|
}
|
|
61
77
|
/** Returns `true` for a supported file inside a canonical openspec spec dir. */
|
|
62
|
-
export function
|
|
63
|
-
return (
|
|
78
|
+
export function isFrontendSpecFilePath(filePath, specRoots = DEFAULT_FRONTEND_SPEC_ROOTS) {
|
|
79
|
+
return (isFrontendSpecPath(filePath, specRoots) &&
|
|
64
80
|
isValidOpenspecExtension(filePath.replaceAll("\\", "/")));
|
|
65
81
|
}
|
|
82
|
+
export function isOpenspecSpecFilePath(filePath) {
|
|
83
|
+
return isFrontendSpecFilePath(filePath);
|
|
84
|
+
}
|
|
66
85
|
/**
|
|
67
86
|
* Returns `true` when free-form search input references a canonical frontend
|
|
68
87
|
* specification directory with exact lowercase directory names.
|
|
@@ -123,3 +142,50 @@ export function extractTaskSourceOpenspecPaths(markdown, governanceRoot = DEFAUL
|
|
|
123
142
|
!isGovernanceSubtreePath(token, governanceRoot))
|
|
124
143
|
.sort();
|
|
125
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Extract explicit specification-file citations for a task's frozen spec roots.
|
|
147
|
+
* This is intentionally path-only: source preparation decides which roots are
|
|
148
|
+
* normative, while DAG execution only consumes that frozen configuration.
|
|
149
|
+
*/
|
|
150
|
+
export function extractTaskSourceFrontendSpecPaths(markdown, specRoots, governanceRoot = DEFAULT_OPENSPEC_GOVERNANCE_ROOT) {
|
|
151
|
+
if (!markdown)
|
|
152
|
+
return [];
|
|
153
|
+
const raw = new Set();
|
|
154
|
+
const collect = (token) => {
|
|
155
|
+
const normalized = normalizeCitationToken(token);
|
|
156
|
+
if (normalized)
|
|
157
|
+
raw.add(normalized);
|
|
158
|
+
};
|
|
159
|
+
for (const match of markdown.matchAll(/`([^`\n]+)`/g))
|
|
160
|
+
collect(match[1] ?? "");
|
|
161
|
+
for (const match of markdown.matchAll(/\[[^\]]*\]\(([^)\s]+)\)/g))
|
|
162
|
+
collect(match[1] ?? "");
|
|
163
|
+
for (const root of specRoots) {
|
|
164
|
+
const escaped = root.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
165
|
+
for (const match of markdown.matchAll(new RegExp(`(?:^|[\\s\"'([>])(${escaped}/[A-Za-z0-9._/-]+)`, "g"))) {
|
|
166
|
+
collect(match[1] ?? "");
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return [...raw]
|
|
170
|
+
.filter((token) => isFrontendSpecFilePath(token, specRoots) && !isGovernanceSubtreePath(token, governanceRoot))
|
|
171
|
+
.sort();
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Source-preparation helper for explicitly named normative directories. A root
|
|
175
|
+
* is inferred only on a line that declares a spec/规范/design-system intent;
|
|
176
|
+
* arbitrary Markdown links never silently broaden task configuration.
|
|
177
|
+
*/
|
|
178
|
+
export function extractDeclaredFrontendSpecRoots(markdown) {
|
|
179
|
+
const roots = new Set();
|
|
180
|
+
for (const line of markdown.split(/\r?\n/)) {
|
|
181
|
+
if (!/(?:规范|规约|标准|设计系统|\bspec(?:ification)?\b|\bdesign[ -]?system\b|\bguidelines?\b|\brules?\b)/i.test(line))
|
|
182
|
+
continue;
|
|
183
|
+
for (const match of line.matchAll(/`([^`]+)`|\[[^\]]+\]\(([^)\s]+)\)/g)) {
|
|
184
|
+
const raw = (match[1] ?? match[2] ?? "").replaceAll("\\", "/").replace(/\/+$/, "");
|
|
185
|
+
if (!raw || !isValidFrontendSpecRoot(raw))
|
|
186
|
+
continue;
|
|
187
|
+
roots.add(isValidOpenspecExtension(raw) ? raw.split("/").slice(0, -1).join("/") : raw);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return [...roots].filter(isValidFrontendSpecRoot).sort();
|
|
191
|
+
}
|
|
@@ -2240,6 +2240,13 @@ export const OPERATOR_COMMAND_COVERAGE = Object.freeze([
|
|
|
2240
2240
|
source: "loop-agent",
|
|
2241
2241
|
note: "server-side read-only run-facts check (ineligible plan / explicit rerun-task recommendation) replaces the browser Human Gate (2026-08-11).",
|
|
2242
2242
|
},
|
|
2243
|
+
{
|
|
2244
|
+
command: "loop-agent dag follow-up",
|
|
2245
|
+
coverage: "excluded",
|
|
2246
|
+
action: null,
|
|
2247
|
+
source: "loop-agent",
|
|
2248
|
+
exclusionReason: "Frontend review recovery helper is a direct advanced CLI composition (create/import task and optional advance), not an Operator action endpoint.",
|
|
2249
|
+
},
|
|
2243
2250
|
{
|
|
2244
2251
|
command: "loop-agent dag reconcile-tasks",
|
|
2245
2252
|
coverage: "human-gated-required",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { DEFAULT_FRONTEND_SPEC_ROOTS, isFrontendSpecFilePath, isValidFrontendSpecRoot, } from "../shared/openspec-spec.js";
|
|
3
3
|
export const taskFlowSchema = z.enum([
|
|
4
4
|
"auto",
|
|
5
5
|
"micro",
|
|
@@ -76,13 +76,27 @@ export const frontendOpenspecPolicySchema = z.enum(["cited", "scan-strict"]);
|
|
|
76
76
|
*/
|
|
77
77
|
export const frontendOpenspecConfigSchema = z.object({
|
|
78
78
|
policy: frontendOpenspecPolicySchema.optional().default("cited"),
|
|
79
|
+
/**
|
|
80
|
+
* Repo-relative directories containing frontend normative files. These are
|
|
81
|
+
* frozen in task.json during contract preparation, before DAG generation.
|
|
82
|
+
*/
|
|
83
|
+
specRoots: z
|
|
84
|
+
.array(z.string().refine((candidate) => isValidFrontendSpecRoot(candidate), "frontendOpenspec.specRoots entries must be normalized repo-relative directories"))
|
|
85
|
+
.optional(),
|
|
79
86
|
requiredReadPaths: z
|
|
80
|
-
.array(z
|
|
81
|
-
.string()
|
|
82
|
-
.refine((candidate) => !candidate.includes("\\") &&
|
|
83
|
-
isOpenspecSpecFilePath(candidate), "frontendOpenspec.requiredReadPaths entries must be repo-relative supported files under openspec/schemas/, openspec/project-specs/, or ai_workspace/"))
|
|
87
|
+
.array(z.string())
|
|
84
88
|
.optional()
|
|
85
89
|
.default([]),
|
|
90
|
+
}).superRefine((value, ctx) => {
|
|
91
|
+
const roots = value.specRoots ?? DEFAULT_FRONTEND_SPEC_ROOTS;
|
|
92
|
+
if (new Set(roots).size !== roots.length) {
|
|
93
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "frontendOpenspec.specRoots must not contain duplicates", path: ["specRoots"] });
|
|
94
|
+
}
|
|
95
|
+
for (const required of value.requiredReadPaths) {
|
|
96
|
+
if (!isFrontendSpecFilePath(required, roots)) {
|
|
97
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "frontendOpenspec.requiredReadPaths entries must be repo-relative supported files under frontendOpenspec.specRoots", path: ["requiredReadPaths"] });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
86
100
|
});
|
|
87
101
|
/** Batch limits and gate profile for the browser-driven frontend test DAG.
|
|
88
102
|
* Token fields are post-case stop thresholds, not model-provider hard caps. */
|
|
@@ -149,8 +163,6 @@ export const backendTestConfigSchema = z
|
|
|
149
163
|
executeScope: z.enum(["affected", "all"]).optional(),
|
|
150
164
|
/** Backend-test-only workspace mutation control; omitted means Git guard. */
|
|
151
165
|
workspaceControl: z.enum(["git", "filesystem-only"]).optional(),
|
|
152
|
-
/** Per-command timeout for the readiness-authorized pytest/HTML execution node. */
|
|
153
|
-
executeTimeoutMs: z.number().int().min(60_000).max(7_200_000).optional(),
|
|
154
166
|
})
|
|
155
167
|
.strict()
|
|
156
168
|
.optional();
|
|
@@ -209,6 +221,21 @@ const taskConfigObjectSchema = z.object({
|
|
|
209
221
|
maxFixLoops: z.number().int().min(0).optional().default(2),
|
|
210
222
|
/** Supervised DAG convergence is opt-in until runtime smoke evidence is stronger. */
|
|
211
223
|
convergence: convergenceConfigSchema.optional().default({ enabled: false }),
|
|
224
|
+
/** Frontend recovery continuation quota. Bounds how many times a failed
|
|
225
|
+
* frontend run may auto-recover via M6 recovery operations (1 = current
|
|
226
|
+
* default; raise to 2-3 for more tolerance of transient verify failures). */
|
|
227
|
+
frontendRecovery: z
|
|
228
|
+
.object({
|
|
229
|
+
maxContinuations: z
|
|
230
|
+
.number()
|
|
231
|
+
.int()
|
|
232
|
+
.min(1)
|
|
233
|
+
.max(5)
|
|
234
|
+
.optional()
|
|
235
|
+
.default(1),
|
|
236
|
+
})
|
|
237
|
+
.strict()
|
|
238
|
+
.optional(),
|
|
212
239
|
/** Outer loop auto mode never writes by default; DAG execute requires this policy plus path/writeSet gates. */
|
|
213
240
|
loopAutoExecutionPolicy: loopAutoExecutionPolicySchema
|
|
214
241
|
.optional()
|
|
@@ -90,6 +90,10 @@ export async function adoptTaskContract(input) {
|
|
|
90
90
|
requirementBytes: bytes.requirementBytes,
|
|
91
91
|
constraintsBytes: bytes.constraintsBytes,
|
|
92
92
|
referenceManifestBytes: bytes.referenceManifestBytes,
|
|
93
|
+
...(state.ref?.sourceHashes.requirementLedgerSha256 &&
|
|
94
|
+
bytes.requirementLedgerBytes !== null
|
|
95
|
+
? { requirementLedgerBytes: bytes.requirementLedgerBytes }
|
|
96
|
+
: {}),
|
|
93
97
|
});
|
|
94
98
|
const taskConfigSha256 = computeTaskConfigSha256(fullConfig);
|
|
95
99
|
const canonicalHash = computeCanonicalHash({
|
|
@@ -45,6 +45,10 @@ export async function refreshManagedContractAfterImport(input) {
|
|
|
45
45
|
requirementBytes: bytes.requirementBytes,
|
|
46
46
|
constraintsBytes: bytes.constraintsBytes,
|
|
47
47
|
referenceManifestBytes: bytes.referenceManifestBytes,
|
|
48
|
+
...(state2.ref.sourceHashes.requirementLedgerSha256 &&
|
|
49
|
+
bytes.requirementLedgerBytes !== null
|
|
50
|
+
? { requirementLedgerBytes: bytes.requirementLedgerBytes }
|
|
51
|
+
: {}),
|
|
48
52
|
});
|
|
49
53
|
const taskConfigSha256 = computeTaskConfigSha256(fullConfig);
|
|
50
54
|
const canonicalHash = computeCanonicalHash({
|
|
@@ -184,6 +184,9 @@ export function mergeManagedTaskConfigFields(existing, draft) {
|
|
|
184
184
|
command: cmd.command,
|
|
185
185
|
...(cmd.timeoutMs !== undefined ? { timeoutMs: cmd.timeoutMs } : {}),
|
|
186
186
|
})),
|
|
187
|
+
...(draft.frontendOpenspec !== undefined
|
|
188
|
+
? { frontendOpenspec: draft.frontendOpenspec }
|
|
189
|
+
: {}),
|
|
187
190
|
};
|
|
188
191
|
if (draft.featureId !== undefined) {
|
|
189
192
|
next.featureId = draft.featureId;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { backendTestConfigSchema, taskKindSchema, taskVerifyCommandSchema, } from "../config-types.js";
|
|
2
|
+
import { backendTestConfigSchema, frontendOpenspecConfigSchema, taskKindSchema, taskVerifyCommandSchema, } from "../config-types.js";
|
|
3
3
|
import { TASK_CONFIG_SCHEMA_VERSION, TASK_CONTRACT_CANONICALIZER_VERSION, TASK_CONTRACT_DRAFT_SCHEMA_VERSION, TASK_CONTRACT_PROJECTION_VERSION, TASK_CONTRACT_REF_SCHEMA_VERSION, } from "./constants.js";
|
|
4
4
|
const sha256Schema = z
|
|
5
5
|
.string()
|
|
@@ -74,6 +74,7 @@ export const taskContractDraftSchema = z
|
|
|
74
74
|
openQuestions: z.array(z.string()).optional(),
|
|
75
75
|
assumptions: z.array(z.string()).optional(),
|
|
76
76
|
hardConstraints: z.array(z.string()).optional(),
|
|
77
|
+
frontendOpenspec: frontendOpenspecConfigSchema.optional(),
|
|
77
78
|
interviewAssessmentRef: z
|
|
78
79
|
.object({
|
|
79
80
|
draftSha256: z.string().min(1),
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* Strong evidence only: package.json deps, config files, source imports.
|
|
4
4
|
* Lockfile-only or directory-name-only must NOT activate adapters.
|
|
5
5
|
*/
|
|
6
|
-
import { readFile, readdir, stat } from "node:fs/promises";
|
|
6
|
+
import { lstat, readFile, readdir, realpath, stat } from "node:fs/promises";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { z } from "zod";
|
|
9
|
-
import { DEFAULT_OPENSPEC_GOVERNANCE_ROOT, MAX_OPENSPEC_CANDIDATE_PATHS, OPENSPEC_SPEC_DIRS, OPENSPEC_SPEC_EXT_RE, isGovernanceSubtreePath,
|
|
9
|
+
import { DEFAULT_OPENSPEC_GOVERNANCE_ROOT, MAX_OPENSPEC_CANDIDATE_PATHS, OPENSPEC_SPEC_DIRS, OPENSPEC_SPEC_EXT_RE, isGovernanceSubtreePath, isValidFrontendSpecRoot, } from "../shared/openspec-spec.js";
|
|
10
10
|
const classifiedPathSchema = z
|
|
11
11
|
.string()
|
|
12
|
-
.refine((candidate) =>
|
|
12
|
+
.refine((candidate) => OPENSPEC_SPEC_EXT_RE.test(candidate), "classified path must be a repo-relative supported spec file");
|
|
13
13
|
/**
|
|
14
14
|
* Stable semantic partition of `designEvidence.normativePaths`. Keys are a
|
|
15
15
|
* generic directory convention (not project-specific file names); the same
|
|
@@ -81,6 +81,105 @@ async function exists(filePath) {
|
|
|
81
81
|
return false;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
+
export const FRONTEND_SPEC_REGISTRY_PATH = "ai_workspace/loop-agent/spec-registry.json";
|
|
85
|
+
const SPEC_SIGNAL_RE = /(?:规范|规约|标准|约定|guideline|standard|convention|design[- ]?system|rule|token|component|style|theme)/i;
|
|
86
|
+
const SPEC_EXCLUDE_RE = /(?:^|\/)(?:archive|history|changelog|changes|proposals?|release[-_ ]notes?)(?:\/|$)/i;
|
|
87
|
+
/** Stable, bounded heuristic used only for candidate ordering/classification. */
|
|
88
|
+
export function scoreFrontendSpecCandidate(filePath, contentPreview = "", options = {}) {
|
|
89
|
+
const normalized = filePath.replaceAll("\\", "/");
|
|
90
|
+
const lower = normalized.toLowerCase();
|
|
91
|
+
const reasons = [];
|
|
92
|
+
let score = 0;
|
|
93
|
+
if (options.registryMode === "normative") {
|
|
94
|
+
score += 100;
|
|
95
|
+
reasons.push("registry-normative");
|
|
96
|
+
}
|
|
97
|
+
else if (options.registryMode === "advisory") {
|
|
98
|
+
score += 30;
|
|
99
|
+
reasons.push("registry-advisory");
|
|
100
|
+
}
|
|
101
|
+
if (options.taskRelated) {
|
|
102
|
+
score += 25;
|
|
103
|
+
reasons.push("task-related");
|
|
104
|
+
}
|
|
105
|
+
if (/(?:design-system|guidelines?|standards?|conventions?|rules?|specs?)(?:\/|$)/i.test(lower)) {
|
|
106
|
+
score += 20;
|
|
107
|
+
reasons.push("spec-directory");
|
|
108
|
+
}
|
|
109
|
+
if (/(?:guidelines?|standards?|conventions?|rules?|tokens?|components?|theme|style)/i.test(path.basename(lower))) {
|
|
110
|
+
score += 15;
|
|
111
|
+
reasons.push("spec-filename");
|
|
112
|
+
}
|
|
113
|
+
if (SPEC_SIGNAL_RE.test(contentPreview)) {
|
|
114
|
+
score += 20;
|
|
115
|
+
reasons.push("spec-content");
|
|
116
|
+
}
|
|
117
|
+
if (/(?:^|\n)\s*(?:#{1,6}\s*)?(?:rules?|do|don't|必须|禁止|约定|规范)\b/im.test(contentPreview)) {
|
|
118
|
+
score += 15;
|
|
119
|
+
reasons.push("normative-structure");
|
|
120
|
+
}
|
|
121
|
+
if (SPEC_EXCLUDE_RE.test(lower)) {
|
|
122
|
+
score -= 80;
|
|
123
|
+
reasons.push("excluded-history-path");
|
|
124
|
+
}
|
|
125
|
+
const kind = options.registryMode === "normative" || score >= 80
|
|
126
|
+
? "normative"
|
|
127
|
+
: score >= 35
|
|
128
|
+
? "advisory"
|
|
129
|
+
: "unknown";
|
|
130
|
+
return { path: normalized, kind, score, reasons, source: options.registryMode ? "registry" : "auto-discovered" };
|
|
131
|
+
}
|
|
132
|
+
/** Read the optional project-level registry without making it mandatory. */
|
|
133
|
+
export async function readFrontendSpecRegistry(repoRoot) {
|
|
134
|
+
const raw = await readJson(path.join(repoRoot, FRONTEND_SPEC_REGISTRY_PATH));
|
|
135
|
+
if (!raw || typeof raw !== "object")
|
|
136
|
+
return null;
|
|
137
|
+
const value = raw;
|
|
138
|
+
if (value.version !== 1 || !Array.isArray(value.roots))
|
|
139
|
+
return null;
|
|
140
|
+
const roots = value.roots
|
|
141
|
+
.filter((item) => Boolean(item) && typeof item === "object")
|
|
142
|
+
.map((item) => ({
|
|
143
|
+
path: typeof item.path === "string" ? item.path.replaceAll("\\", "/").replace(/\/+$/, "") : "",
|
|
144
|
+
scope: Array.isArray(item.scope) ? item.scope.filter((v) => typeof v === "string") : undefined,
|
|
145
|
+
mode: (item.mode === "normative" || item.mode === "advisory" ? item.mode : undefined),
|
|
146
|
+
description: typeof item.description === "string" ? item.description : undefined,
|
|
147
|
+
}))
|
|
148
|
+
.filter((item) => isValidFrontendSpecRoot(item.path));
|
|
149
|
+
return {
|
|
150
|
+
version: 1,
|
|
151
|
+
roots,
|
|
152
|
+
discovery: value.discovery && typeof value.discovery === "object" ? value.discovery : undefined,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Resolve only unambiguous symlink-root aliases. The physical target is never
|
|
157
|
+
* emitted as a candidate path: it merely lets task-source wording such as
|
|
158
|
+
* `ai_doc/rules.md` resolve to the stable repo-local path `ai_workspace/rules.md`.
|
|
159
|
+
*/
|
|
160
|
+
export async function resolveFrontendSpecRootAliases(repoRoot, specRoots) {
|
|
161
|
+
const candidates = [];
|
|
162
|
+
for (const logicalRoot of specRoots) {
|
|
163
|
+
const full = path.join(repoRoot, logicalRoot);
|
|
164
|
+
try {
|
|
165
|
+
if (!(await lstat(full)).isSymbolicLink())
|
|
166
|
+
continue;
|
|
167
|
+
const alias = path.basename(await realpath(full));
|
|
168
|
+
if (alias && alias !== path.basename(logicalRoot)) {
|
|
169
|
+
candidates.push({ alias, logicalRoot });
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
// Missing/broken links are handled by normal candidate discovery drift.
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const counts = new Map();
|
|
177
|
+
for (const item of candidates)
|
|
178
|
+
counts.set(item.alias, (counts.get(item.alias) ?? 0) + 1);
|
|
179
|
+
return candidates
|
|
180
|
+
.filter((item) => counts.get(item.alias) === 1)
|
|
181
|
+
.sort((a, b) => a.alias.localeCompare(b.alias));
|
|
182
|
+
}
|
|
84
183
|
/**
|
|
85
184
|
* Resolve the governance subtree root from harness.json.governanceRoot.
|
|
86
185
|
* Falls back to DEFAULT_OPENSPEC_GOVERNANCE_ROOT when the manifest is missing,
|
|
@@ -105,28 +204,54 @@ export async function listOpenspecDiscovery(repoRoot, options = {}) {
|
|
|
105
204
|
.filter(Boolean);
|
|
106
205
|
const collected = [];
|
|
107
206
|
let excludedGovernanceCount = 0;
|
|
207
|
+
let scannedFiles = 0;
|
|
208
|
+
let maxFilesHit = false;
|
|
209
|
+
let scannedBytes = 0;
|
|
210
|
+
const warnings = [];
|
|
211
|
+
const maxDepth = options.maxDepth ?? 4;
|
|
212
|
+
const maxFiles = options.maxFiles ?? MAX_OPENSPEC_CANDIDATE_PATHS;
|
|
213
|
+
const maxBytes = options.maxBytes ?? 1024 * 1024;
|
|
214
|
+
const timeoutMs = options.timeoutMs ?? 2000;
|
|
215
|
+
const startedAt = Date.now();
|
|
216
|
+
// Metadata / bookkeeping directories that are not normative design specs:
|
|
217
|
+
// changelogs, ADR/history archives, proposals under review, and scratch
|
|
218
|
+
// state. Reading them inflates the candidate list (and the plan prompt)
|
|
219
|
+
// with files no component selection should cite. A task that genuinely
|
|
220
|
+
// needs one can still reference it explicitly — the prewrite gate
|
|
221
|
+
// candidates come from this discovery, but explicit task-source citations
|
|
222
|
+
// flow through openspecMandatoryPaths independently.
|
|
223
|
+
const DEFAULT_EXCLUDED_SPEC_PREFIXES = [
|
|
224
|
+
"openspec/changes",
|
|
225
|
+
"openspec/project-specs/changes",
|
|
226
|
+
"openspec/project-specs/changelog",
|
|
227
|
+
"openspec/project-specs/history",
|
|
228
|
+
"openspec/project-specs/archive",
|
|
229
|
+
"openspec/project-specs/decisions",
|
|
230
|
+
"openspec/project-specs/proposals",
|
|
231
|
+
];
|
|
108
232
|
const isExcluded = (rel) => {
|
|
109
233
|
if (isGovernanceSubtreePath(rel, governanceRoot))
|
|
110
234
|
return true;
|
|
235
|
+
if (DEFAULT_EXCLUDED_SPEC_PREFIXES.some((prefix) => rel === prefix || rel.startsWith(prefix + "/"))) {
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
111
238
|
return extraExcludedPrefixes.some((prefix) => rel === prefix || rel.startsWith(prefix + "/"));
|
|
112
239
|
};
|
|
113
|
-
for (const specDir of OPENSPEC_SPEC_DIRS) {
|
|
240
|
+
for (const specDir of options.specRoots ?? [...OPENSPEC_SPEC_DIRS]) {
|
|
114
241
|
const root = path.join(repoRoot, specDir);
|
|
115
242
|
if (!(await exists(root)))
|
|
116
243
|
continue;
|
|
117
244
|
await walk(root, 0);
|
|
118
245
|
}
|
|
119
|
-
//
|
|
120
|
-
//
|
|
246
|
+
// Keep the established default-root priority for deterministic compatibility;
|
|
247
|
+
// configured extra roots are appended in lexical order.
|
|
121
248
|
const unique = [...new Set(collected)];
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
.
|
|
125
|
-
const aiWorkspacePaths = unique
|
|
126
|
-
.filter((candidate) => candidate.startsWith("ai_workspace/"))
|
|
249
|
+
const defaultPaths = OPENSPEC_SPEC_DIRS.flatMap((root) => unique.filter((candidate) => candidate.startsWith(root + "/")).sort());
|
|
250
|
+
const customPaths = unique
|
|
251
|
+
.filter((candidate) => !defaultPaths.includes(candidate))
|
|
127
252
|
.sort();
|
|
128
|
-
const deduped = [...
|
|
129
|
-
const truncated = deduped.length > MAX_OPENSPEC_CANDIDATE_PATHS;
|
|
253
|
+
const deduped = [...defaultPaths, ...customPaths];
|
|
254
|
+
const truncated = maxFilesHit || deduped.length > MAX_OPENSPEC_CANDIDATE_PATHS;
|
|
130
255
|
const paths = truncated
|
|
131
256
|
? deduped.slice(0, MAX_OPENSPEC_CANDIDATE_PATHS)
|
|
132
257
|
: deduped;
|
|
@@ -136,10 +261,19 @@ export async function listOpenspecDiscovery(repoRoot, options = {}) {
|
|
|
136
261
|
excludedGovernanceCount,
|
|
137
262
|
truncated,
|
|
138
263
|
maxCandidates: MAX_OPENSPEC_CANDIDATE_PATHS,
|
|
264
|
+
warnings,
|
|
139
265
|
};
|
|
140
266
|
async function walk(dir, depth) {
|
|
141
|
-
if (
|
|
267
|
+
if (Date.now() - startedAt >= timeoutMs) {
|
|
268
|
+
if (!warnings.includes("timeout-exceeded"))
|
|
269
|
+
warnings.push("timeout-exceeded");
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
if (depth > maxDepth) {
|
|
273
|
+
if (!warnings.includes("max-depth-exceeded"))
|
|
274
|
+
warnings.push("max-depth-exceeded");
|
|
142
275
|
return;
|
|
276
|
+
}
|
|
143
277
|
let entries = [];
|
|
144
278
|
try {
|
|
145
279
|
entries = (await readdir(dir)).sort();
|
|
@@ -148,12 +282,31 @@ export async function listOpenspecDiscovery(repoRoot, options = {}) {
|
|
|
148
282
|
return;
|
|
149
283
|
}
|
|
150
284
|
for (const name of entries) {
|
|
285
|
+
if (Date.now() - startedAt >= timeoutMs) {
|
|
286
|
+
if (!warnings.includes("timeout-exceeded"))
|
|
287
|
+
warnings.push("timeout-exceeded");
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (scannedFiles >= maxFiles) {
|
|
291
|
+
if (!warnings.includes("max-files-exceeded"))
|
|
292
|
+
warnings.push("max-files-exceeded");
|
|
293
|
+
maxFilesHit = true;
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
151
296
|
const full = path.join(dir, name);
|
|
152
297
|
try {
|
|
153
298
|
const info = await stat(full);
|
|
154
299
|
if (info.isDirectory())
|
|
155
300
|
await walk(full, depth + 1);
|
|
156
301
|
else if (OPENSPEC_SPEC_EXT_RE.test(name)) {
|
|
302
|
+
const size = info.size;
|
|
303
|
+
if (scannedBytes + size > maxBytes) {
|
|
304
|
+
if (!warnings.includes("max-bytes-exceeded"))
|
|
305
|
+
warnings.push("max-bytes-exceeded");
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
scannedFiles++;
|
|
309
|
+
scannedBytes += size;
|
|
157
310
|
const rel = path.relative(repoRoot, full).replace(/\\/g, "/");
|
|
158
311
|
if (isExcluded(rel)) {
|
|
159
312
|
excludedGovernanceCount++;
|
|
@@ -241,6 +394,14 @@ function emptyClassified() {
|
|
|
241
394
|
* project-specific file names. Basename stems use word-boundary matching so
|
|
242
395
|
* e.g. `*api*` (case-insensitive) maps to `rule.api` without hardcoding names.
|
|
243
396
|
*/
|
|
397
|
+
/** True when any path segment (other than the file itself) carries a
|
|
398
|
+
* component/theme kind marker. Directory-organized libraries such as
|
|
399
|
+
* `ui/ucp-components-md/AdvancedSearch.md` rely on this; templates/ and
|
|
400
|
+
* rules/ are handled by their own branches before this fallback runs. */
|
|
401
|
+
function segmentMatchesComponentKind(segments) {
|
|
402
|
+
const dirSegments = segments.slice(0, -1);
|
|
403
|
+
return dirSegments.some((segment) => /\bcomponents?\b/.test(segment.toLowerCase()));
|
|
404
|
+
}
|
|
244
405
|
function classifyOpenspecPaths(paths) {
|
|
245
406
|
const classified = emptyClassified();
|
|
246
407
|
const ruleStem = (basename) => {
|
|
@@ -260,7 +421,7 @@ function classifyOpenspecPaths(paths) {
|
|
|
260
421
|
return "other";
|
|
261
422
|
};
|
|
262
423
|
for (const candidate of paths) {
|
|
263
|
-
if (!
|
|
424
|
+
if (!OPENSPEC_SPEC_EXT_RE.test(candidate))
|
|
264
425
|
continue;
|
|
265
426
|
const segments = candidate.split("/");
|
|
266
427
|
const basename = segments[segments.length - 1] ?? "";
|
|
@@ -279,8 +440,17 @@ function classifyOpenspecPaths(paths) {
|
|
|
279
440
|
classified.theme.push(candidate);
|
|
280
441
|
else if (/\bcomponents?\b/.test(lower))
|
|
281
442
|
classified.component.push(candidate);
|
|
282
|
-
else
|
|
443
|
+
else if (segmentMatchesComponentKind(segments)) {
|
|
444
|
+
// Directory-organized component libraries (e.g.
|
|
445
|
+
// ui/ucp-components-md/AdvancedSearch.md) carry the kind in the
|
|
446
|
+
// parent directory name, not the file name. The parent-dir rule
|
|
447
|
+
// is a fallback so such layouts still land in the component
|
|
448
|
+
// bucket instead of being dropped into uiOther.
|
|
449
|
+
classified.component.push(candidate);
|
|
450
|
+
}
|
|
451
|
+
else {
|
|
283
452
|
classified.uiOther.push(candidate);
|
|
453
|
+
}
|
|
284
454
|
}
|
|
285
455
|
else {
|
|
286
456
|
classified.advisoryOther.push(candidate);
|
|
@@ -325,6 +495,7 @@ function toOpenspecDiscovery(discovery, designEvidence) {
|
|
|
325
495
|
excludedGovernanceCount: discovery.excludedGovernanceCount,
|
|
326
496
|
truncated: discovery.truncated,
|
|
327
497
|
maxCandidates: discovery.maxCandidates,
|
|
498
|
+
warnings: discovery.warnings,
|
|
328
499
|
};
|
|
329
500
|
}
|
|
330
501
|
export function buildAdapterGuidance(capability) {
|
|
@@ -344,7 +515,7 @@ export function buildAdapterGuidance(capability) {
|
|
|
344
515
|
lines.push("Vue adapter: prefer Composition API if project already uses it; reuse Pinia/Vue Router/Vue Query only when evidenced; Vitest + Vue Test Utils when present.");
|
|
345
516
|
}
|
|
346
517
|
else {
|
|
347
|
-
lines.push("Unknown framework: use generic frontend
|
|
518
|
+
lines.push("Unknown framework: use only the node-scoped generic frontend guidance; do not assume React/Vue/Next APIs.");
|
|
348
519
|
}
|
|
349
520
|
if (capability.a11y.status === "present") {
|
|
350
521
|
lines.push(`A11y tools present: ${capability.a11y.tools.join(", ")}. Report static/component-level evidence only; Browser a11y remains not-run.`);
|
|
@@ -361,13 +532,25 @@ export function buildAdapterGuidance(capability) {
|
|
|
361
532
|
* Discover frontend project capability from repo root.
|
|
362
533
|
* Strong evidence: package.json direct deps + config/bootstrap files.
|
|
363
534
|
*/
|
|
364
|
-
export async function discoverFrontendProjectCapability(repoRoot) {
|
|
535
|
+
export async function discoverFrontendProjectCapability(repoRoot, options = {}) {
|
|
536
|
+
const registry = await readFrontendSpecRegistry(repoRoot);
|
|
537
|
+
const registryRoots = registry?.roots
|
|
538
|
+
.filter((root) => !root.scope || root.scope.includes("frontend"))
|
|
539
|
+
.map((root) => root.path) ?? [];
|
|
540
|
+
const discoveryOptions = {
|
|
541
|
+
...options,
|
|
542
|
+
specRoots: [...new Set([...OPENSPEC_SPEC_DIRS, ...(options.specRoots ?? []), ...registryRoots])],
|
|
543
|
+
maxDepth: registry?.discovery?.maxDepth ?? options.maxDepth,
|
|
544
|
+
maxFiles: registry?.discovery?.maxFiles ?? options.maxFiles,
|
|
545
|
+
maxBytes: registry?.discovery?.maxBytes ?? options.maxBytes,
|
|
546
|
+
timeoutMs: registry?.discovery?.timeoutMs ?? options.timeoutMs,
|
|
547
|
+
};
|
|
365
548
|
const evidencePaths = [];
|
|
366
549
|
const reasons = [];
|
|
367
550
|
const pkgPath = path.join(repoRoot, "package.json");
|
|
368
551
|
const pkgRaw = await readJson(pkgPath);
|
|
369
552
|
if (!pkgRaw || typeof pkgRaw !== "object") {
|
|
370
|
-
const discovery = await listOpenspecDiscovery(repoRoot);
|
|
553
|
+
const discovery = await listOpenspecDiscovery(repoRoot, discoveryOptions);
|
|
371
554
|
const designEvidence = buildDesignEvidence(discovery.paths);
|
|
372
555
|
const base = {
|
|
373
556
|
schemaVersion: 1,
|
|
@@ -540,7 +723,7 @@ export async function discoverFrontendProjectCapability(repoRoot) {
|
|
|
540
723
|
router = router ?? "next-router";
|
|
541
724
|
if (hasDep(deps, "vue-router"))
|
|
542
725
|
router = "vue-router";
|
|
543
|
-
const discovery = await listOpenspecDiscovery(repoRoot);
|
|
726
|
+
const discovery = await listOpenspecDiscovery(repoRoot, discoveryOptions);
|
|
544
727
|
const designEvidence = buildDesignEvidence(discovery.paths);
|
|
545
728
|
if (discovery.paths.length)
|
|
546
729
|
evidencePaths.push(...discovery.paths.slice(0, 5));
|
package/dist/task/runtime.js
CHANGED
|
@@ -72,7 +72,7 @@ export function getTaskPaths(repoRoot, taskId) {
|
|
|
72
72
|
dagDraftPath: path.join(taskDir, 'dag.json'),
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
-
export async function createTask(repoRoot, taskId, title) {
|
|
75
|
+
export async function createTask(repoRoot, taskId, title, options) {
|
|
76
76
|
const validation = validateNewTaskId(taskId);
|
|
77
77
|
for (const warning of validation.warnings) {
|
|
78
78
|
console.warn(`[new-task] warning: ${warning}`);
|
|
@@ -97,7 +97,10 @@ export async function createTask(repoRoot, taskId, title) {
|
|
|
97
97
|
taskId,
|
|
98
98
|
title: title ?? taskId,
|
|
99
99
|
sourceFiles: [],
|
|
100
|
-
taskKind: 'standard',
|
|
100
|
+
taskKind: options?.taskKind ?? 'standard',
|
|
101
|
+
...(options?.taskKindExplicit !== undefined
|
|
102
|
+
? { taskKindExplicit: options.taskKindExplicit }
|
|
103
|
+
: {}),
|
|
101
104
|
referenceRepos: [],
|
|
102
105
|
referenceDocs: [],
|
|
103
106
|
allowedPaths: [],
|
|
@@ -17,10 +17,10 @@ function resolveTaskKind(flags, baseDraft, existing) {
|
|
|
17
17
|
const parsed = taskKindSchema.safeParse(candidate);
|
|
18
18
|
return parsed.success ? parsed.data : String(candidate);
|
|
19
19
|
}
|
|
20
|
-
function resolveTaskKindExplicit(flags, baseDraft) {
|
|
20
|
+
function resolveTaskKindExplicit(flags, baseDraft, existing) {
|
|
21
21
|
if (flags.taskKindExplicit !== undefined)
|
|
22
22
|
return flags.taskKindExplicit;
|
|
23
|
-
return baseDraft?.taskKindExplicit ?? false;
|
|
23
|
+
return (baseDraft?.taskKindExplicit ?? existing?.taskKindExplicit ?? false);
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Resolve managed backend-test layout config.
|
|
@@ -122,7 +122,7 @@ export function buildPrepareDraft(input) {
|
|
|
122
122
|
const { taskId, existingTaskConfig, baseDraft, facts, flags, references } = input;
|
|
123
123
|
const title = resolveTitle(taskId, flags, facts, baseDraft, existingTaskConfig);
|
|
124
124
|
const taskKind = resolveTaskKind(flags, baseDraft, existingTaskConfig);
|
|
125
|
-
const taskKindExplicit = resolveTaskKindExplicit(flags, baseDraft);
|
|
125
|
+
const taskKindExplicit = resolveTaskKindExplicit(flags, baseDraft, existingTaskConfig);
|
|
126
126
|
const featureId = trimNonEmpty(flags.featureId) ??
|
|
127
127
|
trimNonEmpty(baseDraft?.featureId) ??
|
|
128
128
|
trimNonEmpty(existingTaskConfig?.featureId) ??
|