@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/goal/judge.js
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Evidence-gate-aware goal judge (Layer 4 of SG-COGNITIVE-SUBSTRATE).
|
|
3
|
-
*
|
|
4
|
-
* This is CLEO's core differentiator over Claude-Code (transcript judge) and
|
|
5
|
-
* Hermes (post-turn loop, still transcript-judged for fuzzy intent). For a
|
|
6
|
-
* `task-completion` goal, the judge NEVER reads the transcript: it resolves the
|
|
7
|
-
* target task's REAL status and re-uses the shipped ADR-051 evidence
|
|
8
|
-
* infrastructure ({@link validateEvidenceForGate} +
|
|
9
|
-
* {@link GATE_EVIDENCE_REQUIREMENTS} via `tasks/evidence.ts`). A goal is
|
|
10
|
-
* satisfied ONLY when the task is `status === 'done'` AND every required gate
|
|
11
|
-
* ({@link CRITICAL_GATES}) is backed by evidence atoms of the kinds ADR-051
|
|
12
|
-
* mandates. Transcript text can never satisfy a task-completion goal.
|
|
13
|
-
*
|
|
14
|
-
* `fuzzy` goals — those with no machine-checkable artifact — delegate to an
|
|
15
|
-
* INJECTABLE LLM judge ({@link GoalJudge}). The judge interface, not a concrete
|
|
16
|
-
* model client, is the dependency, so vitest passes a deterministic mock and
|
|
17
|
-
* stays fully offline/hermetic. The fuzzy path NEVER touches the evidence
|
|
18
|
-
* infrastructure.
|
|
19
|
-
*
|
|
20
|
-
* @module @cleocode/core/goal/judge
|
|
21
|
-
*
|
|
22
|
-
* @epic T11290 EP-CLEO-GOAL-SYSTEM
|
|
23
|
-
* @task T11378
|
|
24
|
-
* @saga T11283 SG-COGNITIVE-SUBSTRATE
|
|
25
|
-
* @adr ADR-051
|
|
26
|
-
*/
|
|
27
|
-
// Re-use the EXISTING ADR-051 evidence path — do NOT re-implement atom parsing.
|
|
28
|
-
// `validateEvidenceForGate` + `GATE_EVIDENCE_REQUIREMENTS` are the shipped SSoT
|
|
29
|
-
// in @cleocode/contracts; `core/src/tasks/evidence.ts` is the matching core
|
|
30
|
-
// surface (it imports the SAME two symbols and is the gate machinery's home).
|
|
31
|
-
import { GATE_EVIDENCE_REQUIREMENTS } from '@cleocode/contracts/evidence-atom-schema.js';
|
|
32
|
-
import { isTaskCompletionGoal } from '@cleocode/contracts/goal.js';
|
|
33
|
-
import { getTaskAccessor } from '../store/data-accessor.js';
|
|
34
|
-
// Sourced from tasks/evidence.ts so the judge sits on the canonical core
|
|
35
|
-
// evidence module rather than re-deriving validation (AC: no re-implementation).
|
|
36
|
-
import { checkGateEvidenceMinimum } from '../tasks/evidence.js';
|
|
37
|
-
/**
|
|
38
|
-
* The gates a task-completion goal demands be evidence-backed before it is
|
|
39
|
-
* judged satisfied. These are the ADR-051 critical gates that reject
|
|
40
|
-
* override-only evidence (`implemented` + `testsPassed`) — the same two gates
|
|
41
|
-
* `cleo complete` enforces hardest. A goal that says "complete T123" therefore
|
|
42
|
-
* means exactly what CLEO means by complete: code landed (commit+files) AND
|
|
43
|
-
* tests proven (test-run/tool/pr), with real, validated atoms.
|
|
44
|
-
*
|
|
45
|
-
* @task T11378
|
|
46
|
-
* @adr ADR-051
|
|
47
|
-
*/
|
|
48
|
-
export const CRITICAL_GATES = Object.freeze([
|
|
49
|
-
'implemented',
|
|
50
|
-
'testsPassed',
|
|
51
|
-
]);
|
|
52
|
-
/**
|
|
53
|
-
* Judge a goal and return a uniform {@link GoalJudgeVerdict}.
|
|
54
|
-
*
|
|
55
|
-
* Routing:
|
|
56
|
-
* - `task-completion` → {@link judgeTaskCompletion} (evidence path, no LLM).
|
|
57
|
-
* - `fuzzy` → the injected {@link GoalJudge} (LLM fallback).
|
|
58
|
-
*
|
|
59
|
-
* The `llmJudge` is REQUIRED only for fuzzy goals; a task-completion goal never
|
|
60
|
-
* calls it. Passing the judge by parameter (dependency injection) is what keeps
|
|
61
|
-
* vitest hermetic.
|
|
62
|
-
*
|
|
63
|
-
* @param goal - The goal under evaluation.
|
|
64
|
-
* @param llmJudge - The injectable LLM judge used for fuzzy goals.
|
|
65
|
-
* @param cwd - Project root override for task lookup.
|
|
66
|
-
* @returns The verdict (same shape for both paths).
|
|
67
|
-
* @task T11378
|
|
68
|
-
*/
|
|
69
|
-
export async function judgeGoal(goal, llmJudge, cwd) {
|
|
70
|
-
if (isTaskCompletionGoal(goal.goalKind)) {
|
|
71
|
-
return judgeTaskCompletion(goal.goalKind.targetTaskId, cwd);
|
|
72
|
-
}
|
|
73
|
-
// Fuzzy goal — delegate to the injected LLM judge. No evidence path touched.
|
|
74
|
-
return llmJudge.judge(goal);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Evidence-gate-aware judgement for a single task-completion goal.
|
|
78
|
-
*
|
|
79
|
-
* Decision table (first match wins):
|
|
80
|
-
* 1. Task not found → `impossible` (the goal references a task that no longer
|
|
81
|
-
* exists).
|
|
82
|
-
* 2. Task `cancelled` / `archived` → `impossible` (terminal non-done state —
|
|
83
|
-
* it can never become `done`).
|
|
84
|
-
* 3. Task not `done` → `ok: false` (still in flight; reason carries the real
|
|
85
|
-
* status so the continuation tells the agent what remains).
|
|
86
|
-
* 4. Task `done` but a critical gate lacks the ADR-051-required evidence atoms
|
|
87
|
-
* → `ok: false` (done-without-proof is NOT satisfied — the whole point).
|
|
88
|
-
* 5. Task `done` AND every critical gate is evidence-backed → `ok: true`.
|
|
89
|
-
*
|
|
90
|
-
* @param targetTaskId - The task the goal wants completed.
|
|
91
|
-
* @param cwd - Project root override.
|
|
92
|
-
* @returns The verdict, with `evidence[]` listing the atom kinds inspected.
|
|
93
|
-
* @task T11378
|
|
94
|
-
* @adr ADR-051
|
|
95
|
-
*/
|
|
96
|
-
export async function judgeTaskCompletion(targetTaskId, cwd) {
|
|
97
|
-
const accessor = await getTaskAccessor(cwd);
|
|
98
|
-
const task = await accessor.loadSingleTask(targetTaskId);
|
|
99
|
-
if (!task) {
|
|
100
|
-
return {
|
|
101
|
-
ok: false,
|
|
102
|
-
impossible: true,
|
|
103
|
-
reason: `Goal target ${targetTaskId} does not exist — it cannot be completed.`,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
if (task.status === 'cancelled' || task.status === 'archived') {
|
|
107
|
-
return {
|
|
108
|
-
ok: false,
|
|
109
|
-
impossible: true,
|
|
110
|
-
reason: `Goal target ${targetTaskId} is ${task.status} — a terminal non-done state; it can never be completed.`,
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
if (task.status !== 'done') {
|
|
114
|
-
return {
|
|
115
|
-
ok: false,
|
|
116
|
-
impossible: false,
|
|
117
|
-
reason: `Goal target ${targetTaskId} is ${task.status}, not done. Continue working until it reaches done with evidence-backed gates.`,
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
// Task IS done — but "done" alone is not enough. Re-use the ADR-051 evidence
|
|
121
|
-
// path via the core-side `checkGateEvidenceMinimum`, which filters `override`
|
|
122
|
-
// atoms and delegates to `validateEvidenceForGate` (the contracts SSoT). Every
|
|
123
|
-
// critical gate MUST be backed by atoms of the required kinds.
|
|
124
|
-
const verification = task.verification;
|
|
125
|
-
const evidenceByGate = verification?.evidence ?? {};
|
|
126
|
-
const inspectedAtomKinds = [];
|
|
127
|
-
const unbacked = [];
|
|
128
|
-
for (const gate of CRITICAL_GATES) {
|
|
129
|
-
const gateEvidence = evidenceByGate[gate];
|
|
130
|
-
const atoms = gateEvidence?.atoms ?? [];
|
|
131
|
-
for (const atom of atoms)
|
|
132
|
-
inspectedAtomKinds.push(`${gate}:${atom.kind}`);
|
|
133
|
-
const failure = checkGateEvidenceMinimum(gate, atoms);
|
|
134
|
-
if (failure !== null) {
|
|
135
|
-
unbacked.push(`${gate} (${failure})`);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
if (unbacked.length > 0) {
|
|
139
|
-
return {
|
|
140
|
-
ok: false,
|
|
141
|
-
impossible: false,
|
|
142
|
-
reason: `Goal target ${targetTaskId} is done but its evidence gates are not satisfied: ` +
|
|
143
|
-
`${unbacked.join('; ')}. A goal is satisfied only when the task is done AND its ` +
|
|
144
|
-
`critical gates (${CRITICAL_GATES.join(', ')}) carry valid ADR-051 evidence atoms.`,
|
|
145
|
-
evidence: inspectedAtomKinds,
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
return {
|
|
149
|
-
ok: true,
|
|
150
|
-
impossible: false,
|
|
151
|
-
reason: `Goal target ${targetTaskId} is done and its critical gates (${CRITICAL_GATES.join(', ')}) are evidence-backed.`,
|
|
152
|
-
evidence: inspectedAtomKinds,
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* A deterministic, offline {@link GoalJudge} that always returns a fixed
|
|
157
|
-
* verdict. Wired in tests (and as a safe default in non-LLM contexts) so the
|
|
158
|
-
* fuzzy path is fully exercised without a live model call.
|
|
159
|
-
*
|
|
160
|
-
* Production wires a real LLM-backed implementation of {@link GoalJudge}; this
|
|
161
|
-
* stub exists so the goal loop has a hermetic fallback and so the gate
|
|
162
|
-
* `GATE_EVIDENCE_REQUIREMENTS` import stays referenced for downstream tooling.
|
|
163
|
-
*
|
|
164
|
-
* @task T11378
|
|
165
|
-
*/
|
|
166
|
-
export class StaticGoalJudge {
|
|
167
|
-
verdict;
|
|
168
|
-
/**
|
|
169
|
-
* @param verdict - The verdict every {@link judge} call returns.
|
|
170
|
-
*/
|
|
171
|
-
constructor(verdict) {
|
|
172
|
-
this.verdict = verdict;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Return the configured verdict, ignoring the goal entirely (deterministic).
|
|
176
|
-
*
|
|
177
|
-
* @param _goal - The goal under evaluation (unused — deterministic stub).
|
|
178
|
-
* @returns The fixed verdict.
|
|
179
|
-
*/
|
|
180
|
-
async judge(_goal) {
|
|
181
|
-
return this.verdict;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* The number of distinct critical gates the evidence judge inspects. Exposed so
|
|
186
|
-
* callers/tests can assert the judge consulted the full {@link CRITICAL_GATES}
|
|
187
|
-
* set without hard-coding the count, and to keep {@link GATE_EVIDENCE_REQUIREMENTS}
|
|
188
|
-
* referenced as the SSoT the judge validates against.
|
|
189
|
-
*
|
|
190
|
-
* @task T11378
|
|
191
|
-
*/
|
|
192
|
-
export const CRITICAL_GATE_COUNT = CRITICAL_GATES.filter((gate) => GATE_EVIDENCE_REQUIREMENTS[gate] !== undefined).length;
|
|
193
|
-
//# sourceMappingURL=judge.js.map
|
package/dist/goal/judge.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"judge.js","sourceRoot":"","sources":["../../src/goal/judge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAQH,gFAAgF;AAChF,gFAAgF;AAChF,4EAA4E;AAC5E,8EAA8E;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,yEAAyE;AACzE,iFAAiF;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,cAAc,GAAgC,MAAM,CAAC,MAAM,CAAC;IACvE,aAAa;IACb,aAAa;CACd,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,IAAgB,EAChB,QAAmB,EACnB,GAAY;IAEZ,IAAI,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxC,OAAO,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,GA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,MAAM,mBAAmB,GAAW,cAAc,CAAC,MAAM,CAC9D,CAAC,IAAI,EAAE,EAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC,KAAK,SAAS,CACzD,CAAC,MAAM,CAAC"}
|
package/dist/goal/loop.d.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Turn-budgeted goal loop (Layer 4 of SG-COGNITIVE-SUBSTRATE).
|
|
3
|
-
*
|
|
4
|
-
* The loop is the Hermes-style post-turn driver, hardened: it consumes one turn
|
|
5
|
-
* per advance, enforces a hard {@link GoalRecord.turnBudget}, surfaces
|
|
6
|
-
* `impossible` verdicts as a terminal state (no further turns), and — the Hermes
|
|
7
|
-
* pattern that prevents silent crashes — AUTO-PAUSES on a judge/parse failure
|
|
8
|
-
* rather than aborting.
|
|
9
|
-
*
|
|
10
|
-
* `advanceGoal` is PURE and DETERMINISTIC over `(goal, judgeFn)`: it performs no
|
|
11
|
-
* I/O itself (the judge is injected; persistence is the caller's job via the
|
|
12
|
-
* store's `updateGoal`). This makes every transition trivially unit-testable
|
|
13
|
-
* offline and keeps the budget/impossible/pause logic in one auditable place.
|
|
14
|
-
*
|
|
15
|
-
* Transition table (the four AC-mandated outcomes):
|
|
16
|
-
* - `verdict.ok` → `satisfied` (terminal).
|
|
17
|
-
* - `verdict.impossible` → `impossible` (terminal; consumes NO turn).
|
|
18
|
-
* - judge/parse failure → `paused` (auto-pause, `pausedReason` set).
|
|
19
|
-
* - turn budget reached → `abandoned` (terminal).
|
|
20
|
-
* - otherwise → `active` (one turn consumed; keep going).
|
|
21
|
-
*
|
|
22
|
-
* @module @cleocode/core/goal/loop
|
|
23
|
-
*
|
|
24
|
-
* @epic T11290 EP-CLEO-GOAL-SYSTEM
|
|
25
|
-
* @task T11379
|
|
26
|
-
* @saga T11283 SG-COGNITIVE-SUBSTRATE
|
|
27
|
-
*/
|
|
28
|
-
import type { GoalAdvanceResult, GoalJudgeVerdict, GoalRecord } from '@cleocode/contracts';
|
|
29
|
-
/**
|
|
30
|
-
* A judge function the loop invokes once per advance. Injected so the loop is
|
|
31
|
-
* pure over `(goal, judgeFn)` — production passes a closure over `judgeGoal`,
|
|
32
|
-
* tests pass a deterministic stub.
|
|
33
|
-
*
|
|
34
|
-
* @param goal - The goal being advanced.
|
|
35
|
-
* @returns The verdict for this turn.
|
|
36
|
-
* @task T11379
|
|
37
|
-
*/
|
|
38
|
-
export type GoalJudgeFn = (goal: GoalRecord) => Promise<GoalJudgeVerdict>;
|
|
39
|
-
/**
|
|
40
|
-
* A minimal, well-formed {@link GoalJudgeVerdict}-shaped object check.
|
|
41
|
-
*
|
|
42
|
-
* A judge that returns a malformed value (missing `ok`/`impossible`, wrong
|
|
43
|
-
* types) is treated as a PARSE FAILURE — the goal auto-pauses rather than
|
|
44
|
-
* trusting a garbage verdict. This is the structural half of the Hermes
|
|
45
|
-
* parse-failure pattern (the thrown-error half is handled by the try/catch in
|
|
46
|
-
* {@link advanceGoal}).
|
|
47
|
-
*
|
|
48
|
-
* @param value - The judge's return value.
|
|
49
|
-
* @returns `true` when `value` is a structurally-valid verdict.
|
|
50
|
-
* @task T11379
|
|
51
|
-
*/
|
|
52
|
-
export declare function isWellFormedVerdict(value: unknown): value is GoalJudgeVerdict;
|
|
53
|
-
/**
|
|
54
|
-
* Advance a goal one turn through the budgeted loop.
|
|
55
|
-
*
|
|
56
|
-
* Pure and deterministic over `(goal, judgeFn)` — NO persistence here; the
|
|
57
|
-
* caller persists the returned `nextStatus` / `turnsRemaining` via the goal
|
|
58
|
-
* store's `updateGoal`. Already-terminal goals are returned unchanged (no turn
|
|
59
|
-
* is consumed, no judge is called) so the loop is idempotent at its boundaries.
|
|
60
|
-
*
|
|
61
|
-
* Ordering rationale:
|
|
62
|
-
* - The judge runs FIRST so a goal that became satisfiable/impossible since the
|
|
63
|
-
* last turn is detected before a turn is "spent".
|
|
64
|
-
* - `impossible` consumes NO turn (the verdict is final regardless of budget).
|
|
65
|
-
* - `ok` consumes NO turn (work is done).
|
|
66
|
-
* - Only the "keep going" path consumes a turn, and the budget check fires AFTER
|
|
67
|
-
* incrementing so `turnsRemaining` never goes negative.
|
|
68
|
-
*
|
|
69
|
-
* @param goal - The current goal record.
|
|
70
|
-
* @param judgeFn - The injected judge (see {@link GoalJudgeFn}).
|
|
71
|
-
* @returns The verdict, the next status, and the remaining turns.
|
|
72
|
-
* @task T11379
|
|
73
|
-
*/
|
|
74
|
-
export declare function advanceGoal(goal: GoalRecord, judgeFn: GoalJudgeFn): Promise<GoalAdvanceResult>;
|
|
75
|
-
//# sourceMappingURL=loop.d.ts.map
|
package/dist/goal/loop.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loop.d.ts","sourceRoot":"","sources":["../../src/goal/loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EAEX,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE1E;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAM7E;AAaD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,iBAAiB,CAAC,CA2D5B"}
|
package/dist/goal/loop.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Turn-budgeted goal loop (Layer 4 of SG-COGNITIVE-SUBSTRATE).
|
|
3
|
-
*
|
|
4
|
-
* The loop is the Hermes-style post-turn driver, hardened: it consumes one turn
|
|
5
|
-
* per advance, enforces a hard {@link GoalRecord.turnBudget}, surfaces
|
|
6
|
-
* `impossible` verdicts as a terminal state (no further turns), and — the Hermes
|
|
7
|
-
* pattern that prevents silent crashes — AUTO-PAUSES on a judge/parse failure
|
|
8
|
-
* rather than aborting.
|
|
9
|
-
*
|
|
10
|
-
* `advanceGoal` is PURE and DETERMINISTIC over `(goal, judgeFn)`: it performs no
|
|
11
|
-
* I/O itself (the judge is injected; persistence is the caller's job via the
|
|
12
|
-
* store's `updateGoal`). This makes every transition trivially unit-testable
|
|
13
|
-
* offline and keeps the budget/impossible/pause logic in one auditable place.
|
|
14
|
-
*
|
|
15
|
-
* Transition table (the four AC-mandated outcomes):
|
|
16
|
-
* - `verdict.ok` → `satisfied` (terminal).
|
|
17
|
-
* - `verdict.impossible` → `impossible` (terminal; consumes NO turn).
|
|
18
|
-
* - judge/parse failure → `paused` (auto-pause, `pausedReason` set).
|
|
19
|
-
* - turn budget reached → `abandoned` (terminal).
|
|
20
|
-
* - otherwise → `active` (one turn consumed; keep going).
|
|
21
|
-
*
|
|
22
|
-
* @module @cleocode/core/goal/loop
|
|
23
|
-
*
|
|
24
|
-
* @epic T11290 EP-CLEO-GOAL-SYSTEM
|
|
25
|
-
* @task T11379
|
|
26
|
-
* @saga T11283 SG-COGNITIVE-SUBSTRATE
|
|
27
|
-
*/
|
|
28
|
-
/**
|
|
29
|
-
* A minimal, well-formed {@link GoalJudgeVerdict}-shaped object check.
|
|
30
|
-
*
|
|
31
|
-
* A judge that returns a malformed value (missing `ok`/`impossible`, wrong
|
|
32
|
-
* types) is treated as a PARSE FAILURE — the goal auto-pauses rather than
|
|
33
|
-
* trusting a garbage verdict. This is the structural half of the Hermes
|
|
34
|
-
* parse-failure pattern (the thrown-error half is handled by the try/catch in
|
|
35
|
-
* {@link advanceGoal}).
|
|
36
|
-
*
|
|
37
|
-
* @param value - The judge's return value.
|
|
38
|
-
* @returns `true` when `value` is a structurally-valid verdict.
|
|
39
|
-
* @task T11379
|
|
40
|
-
*/
|
|
41
|
-
export function isWellFormedVerdict(value) {
|
|
42
|
-
if (value === null || typeof value !== 'object')
|
|
43
|
-
return false;
|
|
44
|
-
const v = value;
|
|
45
|
-
return (typeof v.ok === 'boolean' && typeof v.impossible === 'boolean' && typeof v.reason === 'string');
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* The malformed-verdict sentinel used as the verdict in an auto-pause result
|
|
49
|
-
* when the judge returned an unparseable value (vs. threw). Carries
|
|
50
|
-
* `impossible: false` so a resumed goal is not mistaken for terminal.
|
|
51
|
-
*
|
|
52
|
-
* @internal
|
|
53
|
-
*/
|
|
54
|
-
function pauseVerdict(reason) {
|
|
55
|
-
return { ok: false, impossible: false, reason };
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Advance a goal one turn through the budgeted loop.
|
|
59
|
-
*
|
|
60
|
-
* Pure and deterministic over `(goal, judgeFn)` — NO persistence here; the
|
|
61
|
-
* caller persists the returned `nextStatus` / `turnsRemaining` via the goal
|
|
62
|
-
* store's `updateGoal`. Already-terminal goals are returned unchanged (no turn
|
|
63
|
-
* is consumed, no judge is called) so the loop is idempotent at its boundaries.
|
|
64
|
-
*
|
|
65
|
-
* Ordering rationale:
|
|
66
|
-
* - The judge runs FIRST so a goal that became satisfiable/impossible since the
|
|
67
|
-
* last turn is detected before a turn is "spent".
|
|
68
|
-
* - `impossible` consumes NO turn (the verdict is final regardless of budget).
|
|
69
|
-
* - `ok` consumes NO turn (work is done).
|
|
70
|
-
* - Only the "keep going" path consumes a turn, and the budget check fires AFTER
|
|
71
|
-
* incrementing so `turnsRemaining` never goes negative.
|
|
72
|
-
*
|
|
73
|
-
* @param goal - The current goal record.
|
|
74
|
-
* @param judgeFn - The injected judge (see {@link GoalJudgeFn}).
|
|
75
|
-
* @returns The verdict, the next status, and the remaining turns.
|
|
76
|
-
* @task T11379
|
|
77
|
-
*/
|
|
78
|
-
export async function advanceGoal(goal, judgeFn) {
|
|
79
|
-
const remainingBefore = Math.max(0, goal.turnBudget - goal.turnsUsed);
|
|
80
|
-
// Already-terminal goals are inert — return them unchanged.
|
|
81
|
-
if (goal.status === 'satisfied' || goal.status === 'abandoned' || goal.status === 'impossible') {
|
|
82
|
-
return {
|
|
83
|
-
verdict: goal.lastVerdict ?? pauseVerdict(`Goal already ${goal.status}; no further turns.`),
|
|
84
|
-
nextStatus: goal.status,
|
|
85
|
-
turnsRemaining: remainingBefore,
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
// Hermes auto-pause: a judge that THROWS (network blip, parse crash) must
|
|
89
|
-
// never abort the loop — pause the goal with the cause and let it resume.
|
|
90
|
-
let verdict;
|
|
91
|
-
try {
|
|
92
|
-
const raw = await judgeFn(goal);
|
|
93
|
-
if (!isWellFormedVerdict(raw)) {
|
|
94
|
-
return {
|
|
95
|
-
verdict: pauseVerdict('Judge returned a malformed verdict (auto-paused).'),
|
|
96
|
-
nextStatus: 'paused',
|
|
97
|
-
turnsRemaining: remainingBefore,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
verdict = raw;
|
|
101
|
-
}
|
|
102
|
-
catch (err) {
|
|
103
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
104
|
-
return {
|
|
105
|
-
verdict: pauseVerdict(`Judge failed: ${message} (auto-paused).`),
|
|
106
|
-
nextStatus: 'paused',
|
|
107
|
-
turnsRemaining: remainingBefore,
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
// Satisfied — terminal, no turn consumed.
|
|
111
|
-
if (verdict.ok) {
|
|
112
|
-
return { verdict, nextStatus: 'satisfied', turnsRemaining: remainingBefore };
|
|
113
|
-
}
|
|
114
|
-
// Impossible — terminal, no turn consumed (the verdict is final).
|
|
115
|
-
if (verdict.impossible) {
|
|
116
|
-
return { verdict, nextStatus: 'impossible', turnsRemaining: remainingBefore };
|
|
117
|
-
}
|
|
118
|
-
// Keep going: consume one turn. Budget is checked AFTER the increment so the
|
|
119
|
-
// turn that exhausts the budget is the one that triggers abandonment, and
|
|
120
|
-
// turnsRemaining floors at 0.
|
|
121
|
-
const turnsRemaining = Math.max(0, remainingBefore - 1);
|
|
122
|
-
const nextStatus = turnsRemaining === 0 ? 'abandoned' : 'active';
|
|
123
|
-
const finalVerdict = nextStatus === 'abandoned'
|
|
124
|
-
? {
|
|
125
|
-
ok: false,
|
|
126
|
-
impossible: false,
|
|
127
|
-
reason: `Turn budget exhausted (${goal.turnBudget} turns) before satisfaction. Last judge reason: ${verdict.reason}`,
|
|
128
|
-
}
|
|
129
|
-
: verdict;
|
|
130
|
-
return { verdict: finalVerdict, nextStatus, turnsRemaining };
|
|
131
|
-
}
|
|
132
|
-
//# sourceMappingURL=loop.js.map
|
package/dist/goal/loop.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loop.js","sourceRoot":"","sources":["../../src/goal/loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAoBH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,CAAC,GAAG,KAAgC,CAAC;IAC3C,OAAO,CACL,OAAO,CAAC,CAAC,EAAE,KAAK,SAAS,IAAI,OAAO,CAAC,CAAC,UAAU,KAAK,SAAS,IAAI,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,CAC/F,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAS,YAAY,CAAC,MAAc;IAClC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAClD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,IAAgB,EAChB,OAAoB;IAEpB,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC,C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