@cleocode/core 2026.10.18 → 2026.10.19
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/dist/build-provenance.json +2 -2
- package/dist/check/pr-gate.js +1 -1
- package/dist/check/pr-gate.js.map +1 -1
- package/dist/cloud/nexus-vault.d.ts +4 -3
- package/dist/cloud/nexus-vault.d.ts.map +1 -1
- package/dist/cloud/nexus-vault.js +62 -22
- package/dist/cloud/nexus-vault.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +11 -0
- package/dist/config.js.map +1 -1
- package/dist/docs/conduit-history-backfill.d.ts +210 -0
- package/dist/docs/conduit-history-backfill.d.ts.map +1 -0
- package/dist/docs/conduit-history-backfill.js +451 -0
- package/dist/docs/conduit-history-backfill.js.map +1 -0
- package/dist/docs/docs-ops.d.ts +33 -0
- package/dist/docs/docs-ops.d.ts.map +1 -1
- package/dist/docs/docs-ops.js +72 -0
- package/dist/docs/docs-ops.js.map +1 -1
- package/dist/docs/docs-update.d.ts.map +1 -1
- package/dist/docs/docs-update.js +71 -0
- package/dist/docs/docs-update.js.map +1 -1
- package/dist/docs/doctor.d.ts +18 -4
- package/dist/docs/doctor.d.ts.map +1 -1
- package/dist/docs/doctor.js +124 -3
- package/dist/docs/doctor.js.map +1 -1
- package/dist/docs/section-merge.d.ts +70 -9
- package/dist/docs/section-merge.d.ts.map +1 -1
- package/dist/docs/section-merge.js +167 -10
- package/dist/docs/section-merge.js.map +1 -1
- package/dist/docs/section-write-path.d.ts.map +1 -1
- package/dist/docs/section-write-path.js +23 -8
- package/dist/docs/section-write-path.js.map +1 -1
- package/dist/gateway-client/generated/types.gen.d.ts +4 -0
- package/dist/gateway-client/generated/types.gen.d.ts.map +1 -1
- package/dist/go/driver.d.ts +29 -145
- package/dist/go/driver.d.ts.map +1 -1
- package/dist/go/driver.js +75 -168
- package/dist/go/driver.js.map +1 -1
- package/dist/go/index.d.ts +1 -1
- package/dist/go/index.d.ts.map +1 -1
- package/dist/go/index.js +1 -1
- package/dist/go/index.js.map +1 -1
- package/dist/goal/close.d.ts +1 -1
- package/dist/goal/close.js +2 -2
- package/dist/goal/close.js.map +1 -1
- package/dist/goal/draft.d.ts +10 -3
- package/dist/goal/draft.d.ts.map +1 -1
- package/dist/goal/draft.js +14 -9
- package/dist/goal/draft.js.map +1 -1
- package/dist/goal/index.d.ts +9 -12
- package/dist/goal/index.d.ts.map +1 -1
- package/dist/goal/index.js +9 -12
- package/dist/goal/index.js.map +1 -1
- package/dist/goal/runtime.d.ts +126 -0
- package/dist/goal/runtime.d.ts.map +1 -0
- package/dist/goal/runtime.js +289 -0
- package/dist/goal/runtime.js.map +1 -0
- package/dist/goal/status.d.ts +39 -0
- package/dist/goal/status.d.ts.map +1 -0
- package/dist/goal/status.js +101 -0
- package/dist/goal/status.js.map +1 -0
- package/dist/hooks/project-runner.d.ts +8 -3
- package/dist/hooks/project-runner.d.ts.map +1 -1
- package/dist/hooks/project-runner.js +104 -14
- package/dist/hooks/project-runner.js.map +1 -1
- package/dist/hooks/project-state.js +1 -1
- package/dist/hooks/project-state.js.map +1 -1
- package/dist/internal.d.ts +7 -3
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +5 -3
- package/dist/internal.js.map +1 -1
- package/dist/lifecycle/engine-ops.d.ts.map +1 -1
- package/dist/lifecycle/engine-ops.js +9 -6
- package/dist/lifecycle/engine-ops.js.map +1 -1
- package/dist/memory/retrieval/observe.d.ts.map +1 -1
- package/dist/memory/retrieval/observe.js +4 -8
- package/dist/memory/retrieval/observe.js.map +1 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +4 -1
- package/dist/paths.js.map +1 -1
- package/dist/playbooks/cantbook-profile.d.ts +3 -3
- package/dist/playbooks/cantbook-profile.js +3 -3
- package/dist/playbooks/pi-runner-wiring.d.ts +3 -3
- package/dist/playbooks/pi-runner-wiring.js +3 -3
- package/dist/release/ci-evidence.d.ts +28 -0
- package/dist/release/ci-evidence.d.ts.map +1 -1
- package/dist/release/ci-evidence.js +76 -20
- package/dist/release/ci-evidence.js.map +1 -1
- package/dist/release/open.d.ts +11 -0
- package/dist/release/open.d.ts.map +1 -1
- package/dist/release/open.js +49 -10
- package/dist/release/open.js.map +1 -1
- package/dist/release/preflight-skip.d.ts +50 -0
- package/dist/release/preflight-skip.d.ts.map +1 -1
- package/dist/release/preflight-skip.js +151 -34
- package/dist/release/preflight-skip.js.map +1 -1
- package/dist/release/reconcile.d.ts.map +1 -1
- package/dist/release/reconcile.js +6 -3
- package/dist/release/reconcile.js.map +1 -1
- package/dist/scaffold/ensure-config.d.ts +1 -1
- package/dist/scaffold/ensure-config.d.ts.map +1 -1
- package/dist/scaffold/ensure-config.js +2 -0
- package/dist/scaffold/ensure-config.js.map +1 -1
- package/dist/security/index.d.ts +1 -1
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +1 -1
- package/dist/security/index.js.map +1 -1
- package/dist/security/override-cap-setting.d.ts +180 -0
- package/dist/security/override-cap-setting.d.ts.map +1 -0
- package/dist/security/override-cap-setting.js +657 -0
- package/dist/security/override-cap-setting.js.map +1 -0
- package/dist/security/override-cap.d.ts +20 -29
- package/dist/security/override-cap.d.ts.map +1 -1
- package/dist/security/override-cap.js +47 -71
- package/dist/security/override-cap.js.map +1 -1
- package/dist/security/owner-override-auth.d.ts +58 -0
- package/dist/security/owner-override-auth.d.ts.map +1 -1
- package/dist/security/owner-override-auth.js +82 -1
- package/dist/security/owner-override-auth.js.map +1 -1
- package/dist/security/owner-override-authority.d.ts +67 -0
- package/dist/security/owner-override-authority.d.ts.map +1 -0
- package/dist/security/owner-override-authority.js +100 -0
- package/dist/security/owner-override-authority.js.map +1 -0
- package/dist/sessions/handoff.d.ts.map +1 -1
- package/dist/sessions/handoff.js +4 -5
- package/dist/sessions/handoff.js.map +1 -1
- package/dist/sessions/index.d.ts.map +1 -1
- package/dist/sessions/index.js +22 -25
- package/dist/sessions/index.js.map +1 -1
- package/dist/store/conduit-doc-history.d.ts +39 -7
- package/dist/store/conduit-doc-history.d.ts.map +1 -1
- package/dist/store/conduit-doc-history.js +62 -12
- package/dist/store/conduit-doc-history.js.map +1 -1
- package/dist/store/data-safety-central.d.ts.map +1 -1
- package/dist/store/data-safety-central.js +3 -2
- package/dist/store/data-safety-central.js.map +1 -1
- package/dist/store/json.d.ts.map +1 -1
- package/dist/store/json.js +7 -7
- package/dist/store/json.js.map +1 -1
- package/dist/store/portable-bundle-scan.d.ts +23 -1
- package/dist/store/portable-bundle-scan.d.ts.map +1 -1
- package/dist/store/portable-bundle-scan.js +85 -3
- package/dist/store/portable-bundle-scan.js.map +1 -1
- package/dist/store/portable-bundle.d.ts.map +1 -1
- package/dist/store/portable-bundle.js +6 -1
- package/dist/store/portable-bundle.js.map +1 -1
- package/dist/store/row-identity-registry.d.ts +5 -3
- package/dist/store/row-identity-registry.d.ts.map +1 -1
- package/dist/store/row-identity-registry.js +54 -38
- package/dist/store/row-identity-registry.js.map +1 -1
- package/dist/store/schema/cleo-project/conduit.d.ts.map +1 -1
- package/dist/store/schema/cleo-project/conduit.js +4 -3
- package/dist/store/schema/cleo-project/conduit.js.map +1 -1
- package/dist/store/schema/cleo-project/runtime.d.ts +32 -0
- package/dist/store/schema/cleo-project/runtime.d.ts.map +1 -1
- package/dist/store/schema/cleo-project/runtime.js +7 -3
- package/dist/store/schema/cleo-project/runtime.js.map +1 -1
- package/dist/store/session-store.d.ts +45 -0
- package/dist/store/session-store.d.ts.map +1 -1
- package/dist/store/session-store.js +96 -1
- package/dist/store/session-store.js.map +1 -1
- package/dist/store/sqlite.d.ts +2 -0
- package/dist/store/sqlite.d.ts.map +1 -1
- package/dist/store/sqlite.js +12 -0
- package/dist/store/sqlite.js.map +1 -1
- package/dist/store/sync/merge/rules.d.ts.map +1 -1
- package/dist/store/sync/merge/rules.js +0 -16
- package/dist/store/sync/merge/rules.js.map +1 -1
- package/dist/store/sync/sealer.d.ts.map +1 -1
- package/dist/store/sync/sealer.js +27 -1
- package/dist/store/sync/sealer.js.map +1 -1
- package/dist/store/sync/sequencing.d.ts +3 -1
- package/dist/store/sync/sequencing.d.ts.map +1 -1
- package/dist/store/sync/sequencing.js +5 -3
- package/dist/store/sync/sequencing.js.map +1 -1
- package/dist/store/sync/timestamp-canon.d.ts.map +1 -1
- package/dist/store/sync/timestamp-canon.js +4 -0
- package/dist/store/sync/timestamp-canon.js.map +1 -1
- package/dist/store/table-classification.d.ts.map +1 -1
- package/dist/store/table-classification.js +12 -8
- package/dist/store/table-classification.js.map +1 -1
- package/dist/store/twin-collapse.d.ts +21 -0
- package/dist/store/twin-collapse.d.ts.map +1 -1
- package/dist/store/twin-collapse.js +235 -18
- package/dist/store/twin-collapse.js.map +1 -1
- package/dist/system/health.d.ts +17 -0
- package/dist/system/health.d.ts.map +1 -1
- package/dist/system/health.js +96 -0
- package/dist/system/health.js.map +1 -1
- package/dist/tasks/affected-packages.d.ts +67 -2
- package/dist/tasks/affected-packages.d.ts.map +1 -1
- package/dist/tasks/affected-packages.js +149 -21
- package/dist/tasks/affected-packages.js.map +1 -1
- package/dist/tasks/affected-scope.d.ts.map +1 -1
- package/dist/tasks/affected-scope.js +91 -5
- package/dist/tasks/affected-scope.js.map +1 -1
- package/dist/tasks/changeset-plan.d.ts +33 -0
- package/dist/tasks/changeset-plan.d.ts.map +1 -0
- package/dist/tasks/changeset-plan.js +152 -0
- package/dist/tasks/changeset-plan.js.map +1 -0
- package/dist/tasks/complete.d.ts.map +1 -1
- package/dist/tasks/complete.js +9 -1
- package/dist/tasks/complete.js.map +1 -1
- package/dist/tasks/done-plan.d.ts.map +1 -1
- package/dist/tasks/done-plan.js +28 -14
- package/dist/tasks/done-plan.js.map +1 -1
- package/dist/tasks/done-record.d.ts.map +1 -1
- package/dist/tasks/done-record.js +5 -1
- package/dist/tasks/done-record.js.map +1 -1
- package/dist/tasks/evidence.d.ts.map +1 -1
- package/dist/tasks/evidence.js +149 -18
- package/dist/tasks/evidence.js.map +1 -1
- package/dist/tasks/gate-runner.d.ts.map +1 -1
- package/dist/tasks/gate-runner.js +76 -4
- package/dist/tasks/gate-runner.js.map +1 -1
- package/dist/tasks/qa-run-binding.d.ts +18 -0
- package/dist/tasks/qa-run-binding.d.ts.map +1 -1
- package/dist/tasks/qa-run-binding.js +41 -1
- package/dist/tasks/qa-run-binding.js.map +1 -1
- package/dist/tasks/test-run-binding.d.ts +62 -0
- package/dist/tasks/test-run-binding.d.ts.map +1 -1
- package/dist/tasks/test-run-binding.js +126 -21
- package/dist/tasks/test-run-binding.js.map +1 -1
- package/dist/tasks/tool-resolver.d.ts +7 -0
- package/dist/tasks/tool-resolver.d.ts.map +1 -1
- package/dist/tasks/tool-resolver.js +3 -1
- package/dist/tasks/tool-resolver.js.map +1 -1
- package/dist/validation/engine-ops.d.ts.map +1 -1
- package/dist/validation/engine-ops.js +24 -29
- package/dist/validation/engine-ops.js.map +1 -1
- package/migrations/drizzle-cleo-project/20261016120000_t12535-playbook-row-uids/migration.sql +24 -0
- package/package.json +13 -13
- package/schemas/project-context.schema.json +5 -0
- package/templates/CLEO-INJECTION.md +1 -1
- package/templates/CLEO-REFERENCE.md +42 -1
- package/templates/cleo-gitignore +3 -0
- package/templates/git-hooks/legacy-hashes.json +1 -0
- package/templates/git-hooks/pre-push +35 -7
- package/templates/workflows/release-prepare.yml.tmpl +82 -4
- package/dist/goal/advance-with-persist.d.ts +0 -80
- package/dist/goal/advance-with-persist.d.ts.map +0 -1
- package/dist/goal/advance-with-persist.js +0 -105
- package/dist/goal/advance-with-persist.js.map +0 -1
- package/dist/goal/arm.d.ts +0 -61
- package/dist/goal/arm.d.ts.map +0 -1
- package/dist/goal/arm.js +0 -65
- package/dist/goal/arm.js.map +0 -1
- package/dist/goal/continuation.d.ts +0 -66
- package/dist/goal/continuation.d.ts.map +0 -1
- package/dist/goal/continuation.js +0 -111
- package/dist/goal/continuation.js.map +0 -1
- package/dist/goal/judge.d.ts +0 -113
- package/dist/goal/judge.d.ts.map +0 -1
- package/dist/goal/judge.js +0 -193
- package/dist/goal/judge.js.map +0 -1
- package/dist/goal/loop.d.ts +0 -75
- package/dist/goal/loop.d.ts.map +0 -1
- package/dist/goal/loop.js +0 -132
- package/dist/goal/loop.js.map +0 -1
package/dist/go/driver.d.ts
CHANGED
|
@@ -5,11 +5,10 @@
|
|
|
5
5
|
* It is PURE GLUE: it sequences existing core engines without adding new
|
|
6
6
|
* orchestration math.
|
|
7
7
|
*
|
|
8
|
-
* ## Pipeline
|
|
8
|
+
* ## Pipeline
|
|
9
9
|
*
|
|
10
10
|
* ```
|
|
11
|
-
*
|
|
12
|
-
* → sagaNext() — pick highest-priority non-terminal saga
|
|
11
|
+
* sagaNext() — pick highest-priority non-terminal saga
|
|
13
12
|
* → orchestrateReady(sagaId) — fetch readyFrontier
|
|
14
13
|
* → branch on pipelineStage of the active epic:
|
|
15
14
|
* AC-only (no children, research stage)
|
|
@@ -17,36 +16,20 @@
|
|
|
17
16
|
* research | specification | decomposition
|
|
18
17
|
* → { action: 'lifecycleHop', sagaId, epicId, currentStage }
|
|
19
18
|
* implementation | validation | testing | release | contribution
|
|
20
|
-
* →
|
|
21
|
-
*
|
|
19
|
+
* → draft a goal/v1 contract for the ready wave and hand it to the
|
|
20
|
+
* goal runtime (CLEO Goal) in the current harness
|
|
21
|
+
* → { action: 'goalHandoff', sagaId, epicId, tasks, goal, runtime }
|
|
22
22
|
* → return ONE LAFS-compatible EngineResult envelope
|
|
23
23
|
* ```
|
|
24
24
|
*
|
|
25
|
-
* ##
|
|
25
|
+
* ## Goal handoff (T13821 · owner decision 2026-10-16 · ADR-097)
|
|
26
26
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* `startIvtr`) for a single release if a cantbook-path regression surfaces.
|
|
34
|
-
*
|
|
35
|
-
* - **Flag ON (default)** — fan out an injected {@link IvtrRunner} — supplied
|
|
36
|
-
* by the CLI `cleo go` handler — that drives each task through
|
|
37
|
-
* `executePlaybook(ivtr.cantbook)` (the cantbook runtime, the survivor state
|
|
38
|
-
* machine) AND mirrors the run's terminal status back into `ivtr_state`
|
|
39
|
-
* (`finalizeIvtrFromPlaybook`) so the strict `E_IVTR_INCOMPLETE` completion
|
|
40
|
-
* gate reflects the cantbook run. The runtime's
|
|
41
|
-
* `on_failure.inject_into: implement` edge reproduces the IVTR loop-back walk.
|
|
42
|
-
* - **Flag OFF (opt-out kill-switch)** OR **no runner injected** — seed each
|
|
43
|
-
* ready task's `ivtr_state` via `seedIvtrForPlaybook` (byte-identical to the
|
|
44
|
-
* retired `startIvtr` seed); the seam is a no-op. This fallback is retained
|
|
45
|
-
* for one release so a cantbook-path regression can never strand autopilot.
|
|
46
|
-
*
|
|
47
|
-
* The driver stays in `@cleocode/core` and must NOT import `@cleocode/playbooks`
|
|
48
|
-
* (that would invert the package dependency), so the runtime call is injected
|
|
49
|
-
* as a callback rather than referenced directly.
|
|
27
|
+
* CLEO owns the goal protocol; CLEO Goal is the goal runtime. `cleo go`
|
|
28
|
+
* no longer drives an IVTR loop itself: for implementation-stage work it runs
|
|
29
|
+
* `cleo goal draft` over the ready wave (reusing a draft that already exists,
|
|
30
|
+
* never overwriting it) and returns the exact next step: `/goal start <slug>`
|
|
31
|
+
* when the CLEO Goal bin (`cleo-goal`, then `ocg`) resolves, otherwise the
|
|
32
|
+
* commands that install it (project-scoped; never user-global harness config).
|
|
50
33
|
*
|
|
51
34
|
* ## Design constraints
|
|
52
35
|
*
|
|
@@ -61,81 +44,8 @@
|
|
|
61
44
|
* @task T11494 — E2-CLEO-GO
|
|
62
45
|
* @saga T11492 — SG-AUTOPILOT
|
|
63
46
|
*/
|
|
64
|
-
import type { TaskViewPipelineStage } from '@cleocode/contracts';
|
|
47
|
+
import type { GoalRuntimeHandoff, TaskViewPipelineStage } from '@cleocode/contracts';
|
|
65
48
|
import { type EngineResult } from '../engine-result.js';
|
|
66
|
-
/**
|
|
67
|
-
* Feature-flag env var gating the cantbook IVTR seam (T11805 · T11896 ·
|
|
68
|
-
* collapse-plan Risk Register §7 row #1).
|
|
69
|
-
*
|
|
70
|
-
* As of T11896 the cantbook runtime is the **shipped default** — the flag now
|
|
71
|
-
* defaults **ON** and is retained for one deprecation cycle purely as an
|
|
72
|
-
* opt-OUT kill-switch. When unset (or any truthy value) the implementation-stage
|
|
73
|
-
* branch drives the injected {@link IvtrRunner}
|
|
74
|
-
* (`executePlaybook(ivtr.cantbook)`). Set `CLEO_GO_VIA_PLAYBOOK=0` (or
|
|
75
|
-
* `false`/`no`/`off`) to restore the legacy `seedIvtrForPlaybook` seed
|
|
76
|
-
* (byte-identical to the retired `startIvtr`) for a single release if a
|
|
77
|
-
* cantbook-path regression surfaces. The kill-switch is removed in a follow-up
|
|
78
|
-
* once the cantbook path has baked.
|
|
79
|
-
*/
|
|
80
|
-
export declare const CLEO_GO_VIA_PLAYBOOK_ENV: "CLEO_GO_VIA_PLAYBOOK";
|
|
81
|
-
/**
|
|
82
|
-
* Outcome of a single IVTR playbook run started by the seam (T11805).
|
|
83
|
-
*
|
|
84
|
-
* Returned by {@link IvtrRunner} so the driver can both report the started
|
|
85
|
-
* task and surface the `playbook_runs.run_id` for resume-on-next-turn.
|
|
86
|
-
*
|
|
87
|
-
* @task T11805 — E-ORCH-STATE-MACHINE-COLLAPSE / T11764
|
|
88
|
-
*/
|
|
89
|
-
export interface IvtrRunResult {
|
|
90
|
-
/** The task whose `ivtr.cantbook` run was started. */
|
|
91
|
-
taskId: string;
|
|
92
|
-
/**
|
|
93
|
-
* The `playbook_runs.run_id` of the started run, when the runtime created
|
|
94
|
-
* one. Absent only when the runner cannot reach a run id (e.g. a pre-flight
|
|
95
|
-
* failure before the run row is written).
|
|
96
|
-
*/
|
|
97
|
-
runId?: string;
|
|
98
|
-
/**
|
|
99
|
-
* Terminal status reported by the cantbook runtime for this turn, when the
|
|
100
|
-
* run reached a terminal node (`completed | failed | pending_approval |
|
|
101
|
-
* exceeded_iteration_cap`). Absent when the runner only seeded the run.
|
|
102
|
-
*/
|
|
103
|
-
terminalStatus?: string;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Options handed to an {@link IvtrRunner} for a single task.
|
|
107
|
-
*
|
|
108
|
-
* @task T11805
|
|
109
|
-
*/
|
|
110
|
-
export interface IvtrRunnerOptions {
|
|
111
|
-
/** Resolved project root for playbook resolution + audit writes. */
|
|
112
|
-
projectRoot: string;
|
|
113
|
-
/**
|
|
114
|
-
* Session id persisted onto `playbook_runs.session_id` (evidence/provenance
|
|
115
|
-
* gate parameter). Absent when no session is active.
|
|
116
|
-
*/
|
|
117
|
-
sessionId?: string;
|
|
118
|
-
/** Parent epic id persisted onto `playbook_runs.epic_id` for dashboards. */
|
|
119
|
-
epicId?: string;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Injected callback that drives one task's IVTR loop through the cantbook
|
|
123
|
-
* runtime (`executePlaybook(ivtr.cantbook)`).
|
|
124
|
-
*
|
|
125
|
-
* The driver lives in `@cleocode/core`, which must not depend on
|
|
126
|
-
* `@cleocode/playbooks`; the runtime call is therefore injected by the CLI
|
|
127
|
-
* `cleo go` handler (which already imports `@cleocode/playbooks`). The runner
|
|
128
|
-
* is responsible for:
|
|
129
|
-
* - resolving + parsing `ivtr.cantbook`,
|
|
130
|
-
* - seeding `initialContext = { taskId }`,
|
|
131
|
-
* - calling `executePlaybook` with `taskId` (via context) + `sessionId` +
|
|
132
|
-
* the evidence-gate parameters the cantbook encodes,
|
|
133
|
-
* - keeping `tasks.ivtr_state` populated so the strict `E_IVTR_INCOMPLETE`
|
|
134
|
-
* completion gate stays load-bearing (collapse-plan §3 item 4).
|
|
135
|
-
*
|
|
136
|
-
* @task T11805
|
|
137
|
-
*/
|
|
138
|
-
export type IvtrRunner = (taskId: string, options: IvtrRunnerOptions) => Promise<IvtrRunResult>;
|
|
139
49
|
/**
|
|
140
50
|
* Input parameters for {@link cleoGo}.
|
|
141
51
|
*
|
|
@@ -154,30 +64,16 @@ export interface CleoGoParams {
|
|
|
154
64
|
headless?: boolean;
|
|
155
65
|
/** Override project root (useful in tests). */
|
|
156
66
|
projectRoot?: string;
|
|
157
|
-
/**
|
|
158
|
-
* Drives each ready task through `executePlaybook(ivtr.cantbook)` — the
|
|
159
|
-
* shipped default path (T11896) gated by {@link CLEO_GO_VIA_PLAYBOOK_ENV}.
|
|
160
|
-
* Injected by the CLI handler so the core driver never imports the playbooks
|
|
161
|
-
* runtime. When the kill-switch is set (`CLEO_GO_VIA_PLAYBOOK=0`) or this is
|
|
162
|
-
* omitted, the driver falls back to the legacy `seedIvtrForPlaybook` seed for
|
|
163
|
-
* the implementation+ branch (no behaviour is silently skipped).
|
|
164
|
-
*/
|
|
165
|
-
ivtrRunner?: IvtrRunner;
|
|
166
|
-
/**
|
|
167
|
-
* Session id forwarded to {@link IvtrRunner} for `playbook_runs.session_id`
|
|
168
|
-
* provenance. Best-effort; absent when no session is active.
|
|
169
|
-
*/
|
|
170
|
-
sessionId?: string;
|
|
171
67
|
}
|
|
172
68
|
/**
|
|
173
|
-
* Discriminated union of the
|
|
69
|
+
* Discriminated union of the action outcomes `cleoGo` can produce.
|
|
174
70
|
*
|
|
175
71
|
* Consumers pattern-match on `action` to route further processing.
|
|
176
72
|
*
|
|
177
73
|
* @task T11494
|
|
178
74
|
*/
|
|
179
75
|
export type CleoGoAction = {
|
|
180
|
-
/** No children + research stage — the epic needs decomposition
|
|
76
|
+
/** No children + research stage — the epic needs decomposition first. */
|
|
181
77
|
action: 'needsDecomposition';
|
|
182
78
|
sagaId: string;
|
|
183
79
|
/** The AC-only epic that needs task children added. */
|
|
@@ -194,24 +90,23 @@ export type CleoGoAction = {
|
|
|
194
90
|
readyFrontier: string[];
|
|
195
91
|
} | {
|
|
196
92
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
* `startIvtr`).
|
|
93
|
+
* Implementation-stage work handed to the goal runtime: a goal/v1
|
|
94
|
+
* contract drafted for the ready wave (T13821).
|
|
200
95
|
*/
|
|
201
|
-
action: '
|
|
96
|
+
action: 'goalHandoff';
|
|
202
97
|
sagaId: string;
|
|
203
98
|
epicId: string;
|
|
204
99
|
currentStage: TaskViewPipelineStage;
|
|
205
|
-
/**
|
|
100
|
+
/** The ready wave the goal serves. */
|
|
206
101
|
tasks: string[];
|
|
207
|
-
/**
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
102
|
+
/** The drafted (or already drafted) goal, or null when none could be drafted. */
|
|
103
|
+
goal: {
|
|
104
|
+
slug: string;
|
|
105
|
+
path: string;
|
|
106
|
+
reused: boolean;
|
|
107
|
+
} | null;
|
|
108
|
+
/** The goal runtime and the exact next step in the current harness. */
|
|
109
|
+
runtime: GoalRuntimeHandoff;
|
|
215
110
|
} | {
|
|
216
111
|
/** No non-terminal sagas remain — the workgraph is complete. */
|
|
217
112
|
action: 'complete';
|
|
@@ -220,7 +115,6 @@ export type CleoGoAction = {
|
|
|
220
115
|
* Result payload for {@link cleoGo}.
|
|
221
116
|
*
|
|
222
117
|
* @task T11494
|
|
223
|
-
* @task T11496 E4-GOAL-LOOP
|
|
224
118
|
*/
|
|
225
119
|
export interface CleoGoResult {
|
|
226
120
|
/** The action taken by the driver in this turn. */
|
|
@@ -229,23 +123,13 @@ export interface CleoGoResult {
|
|
|
229
123
|
* Structured diagnostics for display / logging. Always present; may be empty.
|
|
230
124
|
*/
|
|
231
125
|
diagnostics: string[];
|
|
232
|
-
/**
|
|
233
|
-
* The id of the goal that was armed (or reused) for the Stop-hook loop.
|
|
234
|
-
*
|
|
235
|
-
* `null` when no saga was selected (workgraph `complete` action) — there is
|
|
236
|
-
* nothing to arm when the workgraph is already done.
|
|
237
|
-
*
|
|
238
|
-
* @task T11496
|
|
239
|
-
*/
|
|
240
|
-
armedGoalId: string | null;
|
|
241
126
|
}
|
|
242
127
|
/**
|
|
243
128
|
* Run one turn of the `cleo go` autopilot pipeline.
|
|
244
129
|
*
|
|
245
130
|
* Returns a single LAFS-compatible {@link EngineResult} wrapping a
|
|
246
|
-
* {@link CleoGoResult}.
|
|
247
|
-
*
|
|
248
|
-
* inside the called engines); the driver itself carries no mutable state.
|
|
131
|
+
* {@link CleoGoResult}. Its only side effect is drafting a goal/v1 contract for
|
|
132
|
+
* the ready wave (never overwriting one); the driver carries no mutable state.
|
|
249
133
|
*
|
|
250
134
|
* @param params - Input parameters controlling the saga scope and mode.
|
|
251
135
|
* @returns EngineResult with {@link CleoGoResult}.
|
package/dist/go/driver.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../src/go/driver.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../src/go/driver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAIH,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,KAAK,YAAY,EAA8B,MAAM,qBAAqB,CAAC;AAMpF;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GACpB;IACE,yEAAyE;IACzE,MAAM,EAAE,oBAAoB,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,YAAY,EAAE,qBAAqB,CAAC;CACrC,GACD;IACE,0EAA0E;IAC1E,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,qBAAqB,CAAC;IACpC,uEAAuE;IACvE,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,GACD;IACE;;;OAGG;IACH,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,qBAAqB,CAAC;IACpC,sCAAsC;IACtC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,iFAAiF;IACjF,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC7D,uEAAuE;IACvE,OAAO,EAAE,kBAAkB,CAAC;CAC7B,GACD;IACE,gEAAgE;IAChE,MAAM,EAAE,UAAU,CAAC;CACpB,CAAC;AAEN;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,OAAO,EAAE,YAAY,CAAC;IACtB;;OAEG;IACH,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAuBD;;;;;;;;;;;;GAYG;AACH,wBAAsB,MAAM,CAAC,MAAM,GAAE,YAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CA0H3F"}
|
package/dist/go/driver.js
CHANGED
|
@@ -5,11 +5,10 @@
|
|
|
5
5
|
* It is PURE GLUE: it sequences existing core engines without adding new
|
|
6
6
|
* orchestration math.
|
|
7
7
|
*
|
|
8
|
-
* ## Pipeline
|
|
8
|
+
* ## Pipeline
|
|
9
9
|
*
|
|
10
10
|
* ```
|
|
11
|
-
*
|
|
12
|
-
* → sagaNext() — pick highest-priority non-terminal saga
|
|
11
|
+
* sagaNext() — pick highest-priority non-terminal saga
|
|
13
12
|
* → orchestrateReady(sagaId) — fetch readyFrontier
|
|
14
13
|
* → branch on pipelineStage of the active epic:
|
|
15
14
|
* AC-only (no children, research stage)
|
|
@@ -17,36 +16,20 @@
|
|
|
17
16
|
* research | specification | decomposition
|
|
18
17
|
* → { action: 'lifecycleHop', sagaId, epicId, currentStage }
|
|
19
18
|
* implementation | validation | testing | release | contribution
|
|
20
|
-
* →
|
|
21
|
-
*
|
|
19
|
+
* → draft a goal/v1 contract for the ready wave and hand it to the
|
|
20
|
+
* goal runtime (CLEO Goal) in the current harness
|
|
21
|
+
* → { action: 'goalHandoff', sagaId, epicId, tasks, goal, runtime }
|
|
22
22
|
* → return ONE LAFS-compatible EngineResult envelope
|
|
23
23
|
* ```
|
|
24
24
|
*
|
|
25
|
-
* ##
|
|
25
|
+
* ## Goal handoff (T13821 · owner decision 2026-10-16 · ADR-097)
|
|
26
26
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* `startIvtr`) for a single release if a cantbook-path regression surfaces.
|
|
34
|
-
*
|
|
35
|
-
* - **Flag ON (default)** — fan out an injected {@link IvtrRunner} — supplied
|
|
36
|
-
* by the CLI `cleo go` handler — that drives each task through
|
|
37
|
-
* `executePlaybook(ivtr.cantbook)` (the cantbook runtime, the survivor state
|
|
38
|
-
* machine) AND mirrors the run's terminal status back into `ivtr_state`
|
|
39
|
-
* (`finalizeIvtrFromPlaybook`) so the strict `E_IVTR_INCOMPLETE` completion
|
|
40
|
-
* gate reflects the cantbook run. The runtime's
|
|
41
|
-
* `on_failure.inject_into: implement` edge reproduces the IVTR loop-back walk.
|
|
42
|
-
* - **Flag OFF (opt-out kill-switch)** OR **no runner injected** — seed each
|
|
43
|
-
* ready task's `ivtr_state` via `seedIvtrForPlaybook` (byte-identical to the
|
|
44
|
-
* retired `startIvtr` seed); the seam is a no-op. This fallback is retained
|
|
45
|
-
* for one release so a cantbook-path regression can never strand autopilot.
|
|
46
|
-
*
|
|
47
|
-
* The driver stays in `@cleocode/core` and must NOT import `@cleocode/playbooks`
|
|
48
|
-
* (that would invert the package dependency), so the runtime call is injected
|
|
49
|
-
* as a callback rather than referenced directly.
|
|
27
|
+
* CLEO owns the goal protocol; CLEO Goal is the goal runtime. `cleo go`
|
|
28
|
+
* no longer drives an IVTR loop itself: for implementation-stage work it runs
|
|
29
|
+
* `cleo goal draft` over the ready wave (reusing a draft that already exists,
|
|
30
|
+
* never overwriting it) and returns the exact next step: `/goal start <slug>`
|
|
31
|
+
* when the CLEO Goal bin (`cleo-goal`, then `ocg`) resolves, otherwise the
|
|
32
|
+
* commands that install it (project-scoped; never user-global harness config).
|
|
50
33
|
*
|
|
51
34
|
* ## Design constraints
|
|
52
35
|
*
|
|
@@ -61,54 +44,22 @@
|
|
|
61
44
|
* @task T11494 — E2-CLEO-GO
|
|
62
45
|
* @saga T11492 — SG-AUTOPILOT
|
|
63
46
|
*/
|
|
47
|
+
import { existsSync } from 'node:fs';
|
|
48
|
+
import { join } from 'node:path';
|
|
64
49
|
import { engineError, engineSuccess } from '../engine-result.js';
|
|
65
|
-
import {
|
|
66
|
-
import { seedIvtrForPlaybook } from '../lifecycle/ivtr-loop.js';
|
|
50
|
+
import { GOAL_INSTALL_COMMAND, resolveGoalBin } from '../goal/runtime.js';
|
|
67
51
|
import { orchestrateReady } from '../orchestrate/query-ops.js';
|
|
68
52
|
import { getProjectRoot } from '../paths.js';
|
|
69
53
|
import { sagaNext } from '../sagas/next.js';
|
|
70
|
-
/**
|
|
71
|
-
* Feature-flag env var gating the cantbook IVTR seam (T11805 · T11896 ·
|
|
72
|
-
* collapse-plan Risk Register §7 row #1).
|
|
73
|
-
*
|
|
74
|
-
* As of T11896 the cantbook runtime is the **shipped default** — the flag now
|
|
75
|
-
* defaults **ON** and is retained for one deprecation cycle purely as an
|
|
76
|
-
* opt-OUT kill-switch. When unset (or any truthy value) the implementation-stage
|
|
77
|
-
* branch drives the injected {@link IvtrRunner}
|
|
78
|
-
* (`executePlaybook(ivtr.cantbook)`). Set `CLEO_GO_VIA_PLAYBOOK=0` (or
|
|
79
|
-
* `false`/`no`/`off`) to restore the legacy `seedIvtrForPlaybook` seed
|
|
80
|
-
* (byte-identical to the retired `startIvtr`) for a single release if a
|
|
81
|
-
* cantbook-path regression surfaces. The kill-switch is removed in a follow-up
|
|
82
|
-
* once the cantbook path has baked.
|
|
83
|
-
*/
|
|
84
|
-
export const CLEO_GO_VIA_PLAYBOOK_ENV = 'CLEO_GO_VIA_PLAYBOOK';
|
|
85
|
-
/**
|
|
86
|
-
* Resolve whether the cantbook IVTR seam is enabled for this `cleo go` turn.
|
|
87
|
-
*
|
|
88
|
-
* Defaults **ON** (T11896): the seam is disabled only by an explicit opt-OUT
|
|
89
|
-
* kill-switch value of {@link CLEO_GO_VIA_PLAYBOOK_ENV} (`'0'` | `'false'` |
|
|
90
|
-
* `'no'` | `'off'`, case-insensitive). Unset — and every other value — keeps
|
|
91
|
-
* the cantbook runtime engaged.
|
|
92
|
-
*
|
|
93
|
-
* @returns `false` only when the env var is an explicit falsy kill-switch
|
|
94
|
-
* value; `true` otherwise (including when unset).
|
|
95
|
-
*/
|
|
96
|
-
function isPlaybookSeamEnabled() {
|
|
97
|
-
const raw = process.env[CLEO_GO_VIA_PLAYBOOK_ENV];
|
|
98
|
-
if (raw === undefined)
|
|
99
|
-
return true;
|
|
100
|
-
const v = raw.trim().toLowerCase();
|
|
101
|
-
return !(v === '0' || v === 'false' || v === 'no' || v === 'off');
|
|
102
|
-
}
|
|
103
54
|
// ---------------------------------------------------------------------------
|
|
104
55
|
// Pre-implementation stage set
|
|
105
56
|
// ---------------------------------------------------------------------------
|
|
106
57
|
/**
|
|
107
|
-
* Pipeline stages that require a lifecycle hop before
|
|
58
|
+
* Pipeline stages that require a lifecycle hop before implementation.
|
|
108
59
|
*
|
|
109
60
|
* Tasks whose parent epic is still in one of these stages are not yet
|
|
110
|
-
* implementation-ready; the driver signals `lifecycleHop` instead of
|
|
111
|
-
*
|
|
61
|
+
* implementation-ready; the driver signals `lifecycleHop` instead of handing
|
|
62
|
+
* a goal to the runtime.
|
|
112
63
|
*/
|
|
113
64
|
const PRE_IMPLEMENTATION_STAGES = new Set([
|
|
114
65
|
'research',
|
|
@@ -122,9 +73,8 @@ const PRE_IMPLEMENTATION_STAGES = new Set([
|
|
|
122
73
|
* Run one turn of the `cleo go` autopilot pipeline.
|
|
123
74
|
*
|
|
124
75
|
* Returns a single LAFS-compatible {@link EngineResult} wrapping a
|
|
125
|
-
* {@link CleoGoResult}.
|
|
126
|
-
*
|
|
127
|
-
* inside the called engines); the driver itself carries no mutable state.
|
|
76
|
+
* {@link CleoGoResult}. Its only side effect is drafting a goal/v1 contract for
|
|
77
|
+
* the ready wave (never overwriting one); the driver carries no mutable state.
|
|
128
78
|
*
|
|
129
79
|
* @param params - Input parameters controlling the saga scope and mode.
|
|
130
80
|
* @returns EngineResult with {@link CleoGoResult}.
|
|
@@ -146,27 +96,10 @@ export async function cleoGo(params = {}) {
|
|
|
146
96
|
return engineSuccess({
|
|
147
97
|
outcome: { action: 'complete' },
|
|
148
98
|
diagnostics: ['No non-terminal sagas remain — workgraph is complete.'],
|
|
149
|
-
armedGoalId: null,
|
|
150
99
|
});
|
|
151
100
|
}
|
|
152
101
|
const sagaId = next.sagaId;
|
|
153
102
|
diagnostics.push(`active saga: ${sagaId}${next.sagaTitle ? ` (${next.sagaTitle})` : ''} — ${next.completionPct ?? 0}% complete`);
|
|
154
|
-
// 2b. Arm the goal loop (AC3 of T11496): create/reuse a per-saga goal that
|
|
155
|
-
// the Stop-hook advances each turn to self-renudge until satisfied.
|
|
156
|
-
// Best-effort: failure is non-fatal (diagnostics only).
|
|
157
|
-
let armedGoalId = null;
|
|
158
|
-
try {
|
|
159
|
-
const armedGoal = await armGoalLoop({
|
|
160
|
-
sagaId,
|
|
161
|
-
sagaTitle: next.sagaTitle,
|
|
162
|
-
cwd: root,
|
|
163
|
-
});
|
|
164
|
-
armedGoalId = armedGoal.id;
|
|
165
|
-
diagnostics.push(`goal loop armed: ${armedGoalId}`);
|
|
166
|
-
}
|
|
167
|
-
catch (err) {
|
|
168
|
-
diagnostics.push(`goal loop arm failed (non-fatal): ${err.message}`);
|
|
169
|
-
}
|
|
170
103
|
// 3. orchestrateReady — get the ready frontier for the saga.
|
|
171
104
|
const readyResult = await orchestrateReady(sagaId, root);
|
|
172
105
|
if (!readyResult.success) {
|
|
@@ -199,12 +132,11 @@ export async function cleoGo(params = {}) {
|
|
|
199
132
|
currentStage,
|
|
200
133
|
},
|
|
201
134
|
diagnostics,
|
|
202
|
-
armedGoalId,
|
|
203
135
|
});
|
|
204
136
|
}
|
|
205
137
|
// 6. Pre-implementation stage check → lifecycle hop signal.
|
|
206
138
|
if (PRE_IMPLEMENTATION_STAGES.has(currentStage)) {
|
|
207
|
-
diagnostics.push(`epic ${epicId} is at stage '${currentStage}' — lifecycle hop required before
|
|
139
|
+
diagnostics.push(`epic ${epicId} is at stage '${currentStage}' — lifecycle hop required before implementation`);
|
|
208
140
|
return engineSuccess({
|
|
209
141
|
outcome: {
|
|
210
142
|
action: 'lifecycleHop',
|
|
@@ -214,103 +146,78 @@ export async function cleoGo(params = {}) {
|
|
|
214
146
|
readyFrontier,
|
|
215
147
|
},
|
|
216
148
|
diagnostics,
|
|
217
|
-
armedGoalId,
|
|
218
149
|
});
|
|
219
150
|
}
|
|
220
|
-
// 7. Implementation+ →
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
// cycle as an opt-OUT kill-switch):
|
|
225
|
-
//
|
|
226
|
-
// - Flag ON (default) AND a runner injected → drive each ready task through
|
|
227
|
-
// `executePlaybook(ivtr.cantbook)` via the injected runner, which also
|
|
228
|
-
// mirrors the terminal status back into `ivtr_state`. The runner is
|
|
229
|
-
// injected by the CLI handler so the core driver never imports
|
|
230
|
-
// `@cleocode/playbooks`. This is the shipped autopilot hot path.
|
|
231
|
-
// - Flag OFF (kill-switch `CLEO_GO_VIA_PLAYBOOK=0`) OR no runner injected →
|
|
232
|
-
// seed each ready task's `ivtr_state` via `seedIvtrForPlaybook`
|
|
233
|
-
// (byte-identical to the retired `startIvtr` seed), retained one release.
|
|
234
|
-
const ivtrStarted = [];
|
|
235
|
-
const ivtrRunIds = [];
|
|
236
|
-
const seamEnabled = isPlaybookSeamEnabled();
|
|
237
|
-
if (!seamEnabled || !params.ivtrRunner) {
|
|
238
|
-
// Fallback path: legacy `ivtr_state` seed (kill-switch set or no runner).
|
|
239
|
-
if (params.ivtrRunner && !seamEnabled) {
|
|
240
|
-
diagnostics.push(`IVTR cantbook seam disabled (${CLEO_GO_VIA_PLAYBOOK_ENV}=0 kill-switch) — using legacy fallback seed`);
|
|
241
|
-
}
|
|
242
|
-
else if (!params.ivtrRunner) {
|
|
243
|
-
diagnostics.push('IVTR runner not provided — using legacy fallback seed');
|
|
244
|
-
}
|
|
245
|
-
for (const taskId of readyFrontier) {
|
|
246
|
-
try {
|
|
247
|
-
// The legacy seed is now `seedIvtrForPlaybook` — byte-identical to the
|
|
248
|
-
// retired `startIvtr` (both share `buildInitialIvtrState`), so the
|
|
249
|
-
// kill-switch fallback produces the same `ivtr_state` row while the
|
|
250
|
-
// hand-rolled `startIvtr` walk function is deleted (T11896 AC3).
|
|
251
|
-
await seedIvtrForPlaybook(taskId, { cwd: root });
|
|
252
|
-
ivtrStarted.push(taskId);
|
|
253
|
-
diagnostics.push(`IVTR seeded for ${taskId} (legacy fallback seed)`);
|
|
254
|
-
}
|
|
255
|
-
catch (err) {
|
|
256
|
-
diagnostics.push(`IVTR seed failed for ${taskId}: ${err.message}`);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
if (ivtrStarted.length === 0 && readyFrontier.length > 0) {
|
|
260
|
-
diagnostics.push(`All ${readyFrontier.length} IVTR starts failed — see diagnostics`);
|
|
261
|
-
}
|
|
262
|
-
else {
|
|
263
|
-
diagnostics.push(`IVTR started for ${ivtrStarted.length} task(s): ${ivtrStarted.join(', ')}`);
|
|
264
|
-
}
|
|
151
|
+
// 7. Implementation+ → draft a goal for the ready wave and hand it to the runtime.
|
|
152
|
+
const runtime = goalRuntimeHandoff(null);
|
|
153
|
+
if (readyFrontier.length === 0) {
|
|
154
|
+
diagnostics.push(`epic ${epicId} has no ready tasks — nothing to hand to the goal runtime`);
|
|
265
155
|
return engineSuccess({
|
|
266
156
|
outcome: {
|
|
267
|
-
action: '
|
|
157
|
+
action: 'goalHandoff',
|
|
268
158
|
sagaId,
|
|
269
159
|
epicId,
|
|
270
160
|
currentStage,
|
|
271
|
-
tasks:
|
|
272
|
-
|
|
161
|
+
tasks: [],
|
|
162
|
+
goal: null,
|
|
163
|
+
runtime,
|
|
273
164
|
},
|
|
274
165
|
diagnostics,
|
|
275
|
-
armedGoalId,
|
|
276
166
|
});
|
|
277
167
|
}
|
|
278
|
-
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
runnerOptions.sessionId = params.sessionId;
|
|
282
|
-
for (const taskId of readyFrontier) {
|
|
283
|
-
try {
|
|
284
|
-
const runResult = await params.ivtrRunner(taskId, runnerOptions);
|
|
285
|
-
ivtrStarted.push(runResult.taskId);
|
|
286
|
-
if (runResult.runId !== undefined)
|
|
287
|
-
ivtrRunIds.push(runResult.runId);
|
|
288
|
-
diagnostics.push(`IVTR cantbook started for ${runResult.taskId}` +
|
|
289
|
-
`${runResult.runId ? ` (run ${runResult.runId})` : ''}` +
|
|
290
|
-
`${runResult.terminalStatus ? ` → ${runResult.terminalStatus}` : ''}`);
|
|
291
|
-
}
|
|
292
|
-
catch (err) {
|
|
293
|
-
diagnostics.push(`IVTR start failed for ${taskId}: ${err.message}`);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
if (ivtrStarted.length === 0 && readyFrontier.length > 0) {
|
|
297
|
-
// All IVTR starts failed — surface the errors but return gracefully.
|
|
298
|
-
diagnostics.push(`All ${readyFrontier.length} IVTR starts failed — see diagnostics`);
|
|
299
|
-
}
|
|
300
|
-
else {
|
|
301
|
-
diagnostics.push(`IVTR cantbook started for ${ivtrStarted.length} task(s): ${ivtrStarted.join(', ')}`);
|
|
302
|
-
}
|
|
168
|
+
const goal = await draftForWave(readyFrontier, root, diagnostics);
|
|
169
|
+
const handoff = goal ? goalRuntimeHandoff(goal.slug) : runtime;
|
|
170
|
+
diagnostics.push(handoff.next);
|
|
303
171
|
return engineSuccess({
|
|
304
172
|
outcome: {
|
|
305
|
-
action: '
|
|
173
|
+
action: 'goalHandoff',
|
|
306
174
|
sagaId,
|
|
307
175
|
epicId,
|
|
308
176
|
currentStage,
|
|
309
|
-
tasks:
|
|
310
|
-
|
|
177
|
+
tasks: readyFrontier,
|
|
178
|
+
goal,
|
|
179
|
+
runtime: handoff,
|
|
311
180
|
},
|
|
312
181
|
diagnostics,
|
|
313
|
-
armedGoalId,
|
|
314
182
|
});
|
|
315
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* The CLEO Goal runtime and the next step: `/goal start <slug>` when its bin
|
|
186
|
+
* resolves, else the install commands (`cleo goal install` writes only the
|
|
187
|
+
* project's harness config).
|
|
188
|
+
*/
|
|
189
|
+
function goalRuntimeHandoff(slug) {
|
|
190
|
+
const bin = resolveGoalBin();
|
|
191
|
+
const start = slug ? `/goal start ${slug}` : null;
|
|
192
|
+
if (bin !== null) {
|
|
193
|
+
return {
|
|
194
|
+
installed: true,
|
|
195
|
+
bin,
|
|
196
|
+
next: start ? `In your harness, run: ${start}` : 'CLEO Goal is installed.',
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
const install = [GOAL_INSTALL_COMMAND, 'cleo goal install --harness opencode'];
|
|
200
|
+
return {
|
|
201
|
+
installed: false,
|
|
202
|
+
install,
|
|
203
|
+
next: `CLEO Goal is not installed: run ${install.join(', then ')}${start ? `; then in your harness run: ${start}` : ''}`,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
/** Draft the wave's goal, or reuse the draft already there (a draft never overwrites). */
|
|
207
|
+
async function draftForWave(tasks, root, diagnostics) {
|
|
208
|
+
const { draftGoal, goalSlug } = await import('../goal/draft.js');
|
|
209
|
+
const slug = goalSlug(tasks);
|
|
210
|
+
const path = join(root, '.opencode', 'goals', slug, 'goal.yaml');
|
|
211
|
+
if (existsSync(path)) {
|
|
212
|
+
diagnostics.push(`goal ${slug} is already drafted at ${path}`);
|
|
213
|
+
return { slug, path, reused: true };
|
|
214
|
+
}
|
|
215
|
+
const drafted = await draftGoal(tasks, { projectRoot: root });
|
|
216
|
+
if (!drafted.success) {
|
|
217
|
+
diagnostics.push(`goal draft failed for ${tasks.join(', ')}: ${drafted.error.message}`);
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
diagnostics.push(`goal ${drafted.data.slug} drafted at ${drafted.data.path}`);
|
|
221
|
+
return { slug: drafted.data.slug, path: drafted.data.path, reused: false };
|
|
222
|
+
}
|
|
316
223
|
//# sourceMappingURL=driver.js.map
|
package/dist/go/driver.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.js","sourceRoot":"","sources":["../../src/go/driver.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"driver.js","sourceRoot":"","sources":["../../src/go/driver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAqB,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAmF5C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QAC/D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACtC,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9D,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACrB,WAAW,CAAC,IAAI,CAAC,yBAAyB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACxF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,WAAW,CAAC,IAAI,CAAC,QAAQ,OAAO,CAAC,IAAI,CAAC,IAAI,eAAe,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9E,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC7E,CAAC"}
|
package/dist/go/index.d.ts
CHANGED
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
* @task T11494 — E2-CLEO-GO
|
|
10
10
|
* @saga T11492 — SG-AUTOPILOT
|
|
11
11
|
*/
|
|
12
|
-
export {
|
|
12
|
+
export { type CleoGoAction, type CleoGoParams, type CleoGoResult, cleoGo } from './driver.js';
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/go/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/go/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/go/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
|