@cleocode/contracts 2026.10.27 → 2026.11.1-canary.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/.source-stamp.json +4 -0
- package/dist/__tests__/acceptance-gate.test.js +15 -3
- package/dist/__tests__/acceptance-gate.test.js.map +1 -1
- package/dist/__tests__/completion-operation-contracts.test.js +1 -1
- package/dist/__tests__/completion-operation-contracts.test.js.map +1 -1
- package/dist/__tests__/evidence-atom-schema.test.js +3 -1
- package/dist/__tests__/evidence-atom-schema.test.js.map +1 -1
- package/dist/__tests__/gateway-contract.test.js +1 -1
- package/dist/__tests__/gateway-contract.test.js.map +1 -1
- package/dist/__tests__/memory-wire-shapes.test.js.map +1 -1
- package/dist/__tests__/operation-def.test.js +4 -3
- package/dist/__tests__/operation-def.test.js.map +1 -1
- package/dist/acceptance-gate-schema.d.ts +25 -0
- package/dist/acceptance-gate-schema.d.ts.map +1 -1
- package/dist/acceptance-gate-schema.js +5 -0
- package/dist/acceptance-gate-schema.js.map +1 -1
- package/dist/acceptance-gate.d.ts +8 -0
- package/dist/acceptance-gate.d.ts.map +1 -1
- package/dist/brain-graph.d.ts +1 -1
- package/dist/brain-graph.js +1 -1
- package/dist/caamp-markers.d.ts +11 -0
- package/dist/caamp-markers.d.ts.map +1 -1
- package/dist/config/manifest.d.ts.map +1 -1
- package/dist/config/manifest.js +13 -0
- package/dist/config/manifest.js.map +1 -1
- package/dist/{config.d.ts → config/types.d.ts} +130 -6
- package/dist/config/types.d.ts.map +1 -0
- package/dist/{config.js → config/types.js} +1 -1
- package/dist/config/types.js.map +1 -0
- package/dist/config/worker-policy.d.ts +42 -0
- package/dist/config/worker-policy.d.ts.map +1 -0
- package/dist/config/worker-policy.js +35 -0
- package/dist/config/worker-policy.js.map +1 -0
- package/dist/data-accessor.d.ts +15 -0
- package/dist/data-accessor.d.ts.map +1 -1
- package/dist/data-accessor.js.map +1 -1
- package/dist/dependency.d.ts +2 -0
- package/dist/dependency.d.ts.map +1 -1
- package/dist/dispatch/__tests__/operation-envelope-snapshots.test.js +0 -6
- package/dist/dispatch/__tests__/operation-envelope-snapshots.test.js.map +1 -1
- package/dist/dispatch/identity.d.ts +3 -8
- package/dist/dispatch/identity.d.ts.map +1 -1
- package/dist/dispatch/identity.js +2 -8
- package/dist/dispatch/identity.js.map +1 -1
- package/dist/dispatch/operations-registry.d.ts.map +1 -1
- package/dist/dispatch/operations-registry.js +360 -513
- package/dist/dispatch/operations-registry.js.map +1 -1
- package/dist/docs/modernize.d.ts +468 -0
- package/dist/docs/modernize.d.ts.map +1 -0
- package/dist/docs/modernize.js +145 -0
- package/dist/docs/modernize.js.map +1 -0
- package/dist/docs/provenance.d.ts +6 -6
- package/dist/docs-taxonomy.d.ts +6 -0
- package/dist/docs-taxonomy.d.ts.map +1 -1
- package/dist/docs-taxonomy.js +38 -1
- package/dist/docs-taxonomy.js.map +1 -1
- package/dist/done-plan.d.ts +34 -3
- package/dist/done-plan.d.ts.map +1 -1
- package/dist/evidence-atom-schema.d.ts +78 -4
- package/dist/evidence-atom-schema.d.ts.map +1 -1
- package/dist/evidence-atom-schema.js +136 -11
- package/dist/evidence-atom-schema.js.map +1 -1
- package/dist/evidence-record-schema.d.ts +2 -2
- package/dist/exit-codes.d.ts +93 -0
- package/dist/exit-codes.d.ts.map +1 -1
- package/dist/exit-codes.js +93 -0
- package/dist/exit-codes.js.map +1 -1
- package/dist/{gateway.d.ts → gateway/index.d.ts} +4 -4
- package/dist/gateway/index.d.ts.map +1 -0
- package/dist/{gateway.js → gateway/index.js} +2 -2
- package/dist/gateway/index.js.map +1 -0
- package/dist/gateway/rpc/messages.d.ts +4 -4
- package/dist/gateway/rpc/messages.js +1 -1
- package/dist/gateway/rpc/messages.js.map +1 -1
- package/dist/git-hooks.d.ts +29 -3
- package/dist/git-hooks.d.ts.map +1 -1
- package/dist/git-hooks.js +34 -3
- package/dist/git-hooks.js.map +1 -1
- package/dist/heavy-command-hook.d.ts +5 -0
- package/dist/heavy-command-hook.d.ts.map +1 -1
- package/dist/index.d.ts +23 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/invariants/sync-write-invariants.d.ts.map +1 -1
- package/dist/invariants/sync-write-invariants.js +29 -1
- package/dist/invariants/sync-write-invariants.js.map +1 -1
- package/dist/jobs.d.ts +5 -0
- package/dist/jobs.d.ts.map +1 -1
- package/dist/lease-ipc/messages.d.ts +5 -5
- package/dist/llm/onboarding.d.ts +1 -1
- package/dist/llm/system-of-use.d.ts +1 -1
- package/dist/llm/system-of-use.d.ts.map +1 -1
- package/dist/llm/system-resolver.d.ts +1 -1
- package/dist/llm/system-resolver.d.ts.map +1 -1
- package/dist/{memory.d.ts → memory/index.d.ts} +1 -1
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/{memory.js → memory/index.js} +1 -1
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/search.d.ts +20 -2
- package/dist/memory/search.d.ts.map +1 -1
- package/dist/merge-close.d.ts +277 -0
- package/dist/merge-close.d.ts.map +1 -0
- package/dist/merge-close.js +16 -0
- package/dist/merge-close.js.map +1 -0
- package/dist/nexus-cloud.d.ts +1 -1
- package/dist/operations/admin.d.ts +6 -0
- package/dist/operations/admin.d.ts.map +1 -1
- package/dist/operations/docs.d.ts +233 -9
- package/dist/operations/docs.d.ts.map +1 -1
- package/dist/operations/docs.js.map +1 -1
- package/dist/operations/index.d.ts +0 -1
- package/dist/operations/index.d.ts.map +1 -1
- package/dist/operations/index.js +0 -1
- package/dist/operations/index.js.map +1 -1
- package/dist/operations/memory.d.ts +7 -4
- package/dist/operations/memory.d.ts.map +1 -1
- package/dist/operations/nexus-scope-map.d.ts +0 -8
- package/dist/operations/nexus-scope-map.d.ts.map +1 -1
- package/dist/operations/nexus-scope-map.js +0 -8
- package/dist/operations/nexus-scope-map.js.map +1 -1
- package/dist/operations/nexus.d.ts +2 -10
- package/dist/operations/nexus.d.ts.map +1 -1
- package/dist/operations/nexus.js.map +1 -1
- package/dist/operations/orchestrate.d.ts +219 -6
- package/dist/operations/orchestrate.d.ts.map +1 -1
- package/dist/operations/orchestrate.js +329 -1
- package/dist/operations/orchestrate.js.map +1 -1
- package/dist/operations/output-contracts-data.js +1 -1
- package/dist/operations/output-contracts-data.js.map +1 -1
- package/dist/operations/release.d.ts +0 -79
- package/dist/operations/release.d.ts.map +1 -1
- package/dist/operations/session.d.ts +1 -1
- package/dist/operations/session.d.ts.map +1 -1
- package/dist/operations/tasks.d.ts +18 -6
- package/dist/operations/tasks.d.ts.map +1 -1
- package/dist/operations/tasks.js.map +1 -1
- package/dist/operations/validate.d.ts +6 -0
- package/dist/operations/validate.d.ts.map +1 -1
- package/dist/operations/worktree.d.ts +209 -19
- package/dist/operations/worktree.d.ts.map +1 -1
- package/dist/orca-execution.d.ts +489 -0
- package/dist/orca-execution.d.ts.map +1 -0
- package/dist/orca-execution.js +362 -0
- package/dist/orca-execution.js.map +1 -0
- package/dist/project-context.d.ts +31 -0
- package/dist/project-context.d.ts.map +1 -1
- package/dist/project-hooks.d.ts +8 -8
- package/dist/release/authorization.d.ts +46 -0
- package/dist/release/authorization.d.ts.map +1 -0
- package/dist/release/authorization.js +10 -0
- package/dist/release/authorization.js.map +1 -0
- package/dist/release/hook-pilot.d.ts +1 -1
- package/dist/resource-governor.d.ts +44 -0
- package/dist/resource-governor.d.ts.map +1 -1
- package/dist/resource-governor.js +10 -0
- package/dist/resource-governor.js.map +1 -1
- package/dist/review-verdict.d.ts +253 -0
- package/dist/review-verdict.d.ts.map +1 -0
- package/dist/review-verdict.js +20 -0
- package/dist/review-verdict.js.map +1 -0
- package/dist/row-identity.d.ts +11 -0
- package/dist/row-identity.d.ts.map +1 -1
- package/dist/session-journal.d.ts.map +1 -1
- package/dist/session-journal.js +7 -1
- package/dist/session-journal.js.map +1 -1
- package/dist/session.d.ts +11 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js.map +1 -1
- package/dist/skills/migrate.d.ts +1 -1
- package/dist/skills/migrate.js +1 -1
- package/dist/skills/stats.d.ts +1 -1
- package/dist/skills/stats.js +1 -1
- package/dist/spawn-types.d.ts +57 -0
- package/dist/spawn-types.d.ts.map +1 -1
- package/dist/spawn.d.ts +43 -0
- package/dist/spawn.d.ts.map +1 -1
- package/dist/spawn.js +1 -0
- package/dist/spawn.js.map +1 -1
- package/dist/status-registry.d.ts +27 -0
- package/dist/status-registry.d.ts.map +1 -1
- package/dist/status-registry.js +28 -0
- package/dist/status-registry.js.map +1 -1
- package/dist/table-classification.d.ts +22 -0
- package/dist/table-classification.d.ts.map +1 -1
- package/dist/task-id.d.ts +8 -10
- package/dist/task-id.d.ts.map +1 -1
- package/dist/task-id.js +9 -48
- package/dist/task-id.js.map +1 -1
- package/dist/task-record.d.ts +10 -1
- package/dist/task-record.d.ts.map +1 -1
- package/dist/task.d.ts +177 -4
- package/dist/task.d.ts.map +1 -1
- package/dist/task.js.map +1 -1
- package/dist/{tasks.d.ts → tasks/index.d.ts} +3 -3
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/{tasks.js → tasks/index.js} +2 -2
- package/dist/tasks/index.js.map +1 -0
- package/dist/templates/manifest.d.ts +1 -1
- package/dist/tools/build-task-tree.d.ts +1 -1
- package/dist/tools/build-task-tree.d.ts.map +1 -1
- package/dist/workgraph.d.ts +56 -56
- package/package.json +22 -6
- package/schemas/acceptance-gate.schema.json +24 -0
- package/schemas/task.schema.json +24 -0
- package/src/__tests__/__snapshots__/operations-registry.test.ts.snap +1 -1
- package/src/__tests__/acceptance-gate.test.ts +16 -3
- package/src/__tests__/completion-operation-contracts.test.ts +1 -1
- package/src/__tests__/evidence-atom-schema.test.ts +3 -1
- package/src/__tests__/gateway-contract.test.ts +1 -1
- package/src/__tests__/llm-config-schema.test.ts +1 -1
- package/src/__tests__/memory-wire-shapes.test.ts +4 -1
- package/src/__tests__/operation-def.test.ts +4 -3
- package/src/acceptance-gate-schema.ts +5 -0
- package/src/acceptance-gate.ts +9 -0
- package/src/brain-graph.ts +1 -1
- package/src/caamp-markers.ts +11 -0
- package/src/config/manifest.ts +13 -0
- package/src/{config.ts → config/types.ts} +134 -5
- package/src/config/worker-policy.ts +55 -0
- package/src/data-accessor.ts +16 -0
- package/src/dependency.ts +2 -0
- package/src/dispatch/__tests__/operation-envelope-snapshots.test.ts +0 -6
- package/src/dispatch/identity.ts +2 -8
- package/src/dispatch/operations-registry.ts +377 -525
- package/src/docs/modernize.ts +442 -0
- package/src/docs-taxonomy.ts +44 -1
- package/src/done-plan.ts +33 -2
- package/src/evidence-atom-schema.ts +167 -14
- package/src/exit-codes.ts +95 -0
- package/src/{gateway.ts → gateway/index.ts} +3 -3
- package/src/gateway/rpc/messages.ts +1 -1
- package/src/git-hooks.ts +43 -3
- package/src/heavy-command-hook.ts +5 -0
- package/src/index.ts +132 -48
- package/src/invariants/sync-write-invariants.ts +30 -0
- package/src/jobs.ts +5 -0
- package/src/llm/onboarding.ts +1 -1
- package/src/llm/system-of-use.ts +1 -1
- package/src/llm/system-resolver.ts +1 -1
- package/src/memory/search.ts +17 -2
- package/src/merge-close.ts +291 -0
- package/src/operations/admin.ts +6 -0
- package/src/operations/docs.ts +242 -10
- package/src/operations/index.ts +0 -1
- package/src/operations/memory.ts +7 -4
- package/src/operations/nexus-scope-map.ts +0 -8
- package/src/operations/nexus.ts +2 -11
- package/src/operations/orchestrate.ts +490 -6
- package/src/operations/output-contracts-data.ts +1 -1
- package/src/operations/release.ts +0 -87
- package/src/operations/session.ts +1 -1
- package/src/operations/tasks.ts +20 -7
- package/src/operations/validate.ts +6 -0
- package/src/operations/worktree.ts +216 -19
- package/src/orca-execution.ts +493 -0
- package/src/project-context.ts +33 -0
- package/src/release/authorization.ts +48 -0
- package/src/resource-governor.ts +47 -0
- package/src/review-verdict.ts +265 -0
- package/src/row-identity.ts +11 -0
- package/src/session-journal.ts +7 -1
- package/src/session.ts +11 -0
- package/src/skills/migrate.ts +1 -1
- package/src/skills/stats.ts +1 -1
- package/src/spawn-types.ts +75 -0
- package/src/spawn.ts +48 -0
- package/src/status-registry.ts +37 -0
- package/src/table-classification.ts +23 -0
- package/src/task-id.ts +9 -47
- package/src/task-record.ts +10 -1
- package/src/task.ts +171 -4
- package/src/{tasks.ts → tasks/index.ts} +3 -3
- package/src/tools/build-task-tree.ts +1 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/gateway.d.ts.map +0 -1
- package/dist/gateway.js.map +0 -1
- package/dist/memory.d.ts.map +0 -1
- package/dist/memory.js.map +0 -1
- package/dist/operations/conduit.d.ts +0 -285
- package/dist/operations/conduit.d.ts.map +0 -1
- package/dist/operations/conduit.js +0 -39
- package/dist/operations/conduit.js.map +0 -1
- package/dist/tasks.d.ts.map +0 -1
- package/dist/tasks.js.map +0 -1
- package/src/operations/conduit.ts +0 -348
- /package/src/{memory.ts → memory/index.ts} +0 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Independent per-AC review of a PR (T14122, council run
|
|
3
|
+
* 20261028T155822Z-293ed9f0, blocking amendment 2 of D11211).
|
|
4
|
+
*
|
|
5
|
+
* A reviewer other than the task's author judges each acceptance criterion
|
|
6
|
+
* from the PR diff and the criterion text alone, and records a verdict under
|
|
7
|
+
* its own CLEO session, bound to the PR head it reviewed. The merge sweep
|
|
8
|
+
* (T14101) records `satisfies:` only from a `met` verdict on the merged head;
|
|
9
|
+
* PR text can neither create nor waive one.
|
|
10
|
+
*
|
|
11
|
+
* @task T14122
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** One acceptance criterion as a reviewer sees it: its alias and its text. */
|
|
15
|
+
export interface ReviewPacketCriterion {
|
|
16
|
+
/** `AC1`, `AC2`, … */
|
|
17
|
+
alias: string;
|
|
18
|
+
/** The criterion text. */
|
|
19
|
+
text: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* What a reviewer is given for one PR and task: the diff at the PR head and
|
|
24
|
+
* the task's criteria. The PR title, body, comments and commit messages are
|
|
25
|
+
* never included, so the author's `Closes:` / `Refs:` lines and summary cannot
|
|
26
|
+
* reach the reviewer.
|
|
27
|
+
*/
|
|
28
|
+
export interface ReviewPacket {
|
|
29
|
+
/** The PR. */
|
|
30
|
+
prNumber: number;
|
|
31
|
+
/** The PR head the diff was taken at (`headRefOid`). */
|
|
32
|
+
headSha: string;
|
|
33
|
+
/** The task under review. */
|
|
34
|
+
taskId: string;
|
|
35
|
+
/** The task's criteria, in ordinal order. */
|
|
36
|
+
acs: ReviewPacketCriterion[];
|
|
37
|
+
/** The PR diff at `headSha`, without the paths in `withheldPaths`. */
|
|
38
|
+
diff: string;
|
|
39
|
+
/** Changed paths left out of `diff` because they carry the author's own account (changesets). */
|
|
40
|
+
withheldPaths: string[];
|
|
41
|
+
/** sha256 of the head, the criteria and the diff: a verdict names it to prove what was reviewed. */
|
|
42
|
+
packetSha256: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** The identities that authored a task: its claim holders and the session that created it. */
|
|
46
|
+
export interface ReviewAuthors {
|
|
47
|
+
/** CLEO session ids. */
|
|
48
|
+
sessionIds: string[];
|
|
49
|
+
/** Agent ids (`CLEO_AGENT_ID`, spawn handles). */
|
|
50
|
+
agentIds: string[];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** One reviewer's verdict on one criterion of one task, for one PR head. */
|
|
54
|
+
export interface ReviewVerdict {
|
|
55
|
+
/** Verdict id (uuid). */
|
|
56
|
+
id: string;
|
|
57
|
+
/** The task. */
|
|
58
|
+
taskId: string;
|
|
59
|
+
/** The criterion alias (`AC2`). */
|
|
60
|
+
ac: string;
|
|
61
|
+
/** The criterion's stable id (`task_acceptance_criteria.id`). */
|
|
62
|
+
acId: string;
|
|
63
|
+
/**
|
|
64
|
+
* sha256 of the criterion's normalised text as the packet showed it
|
|
65
|
+
* (T14259). An edit after the verdict invalidates it; a verdict recorded
|
|
66
|
+
* before this field existed has none.
|
|
67
|
+
*/
|
|
68
|
+
acTextSha256?: string;
|
|
69
|
+
/** The PR. */
|
|
70
|
+
prNumber: number;
|
|
71
|
+
/** The PR head the reviewer judged (`headRefOid`), never the merge sha. */
|
|
72
|
+
headSha: string;
|
|
73
|
+
/** Whether the diff implements the criterion. */
|
|
74
|
+
verdict: 'met' | 'unmet';
|
|
75
|
+
/** Why, in the reviewer's words. */
|
|
76
|
+
reason: string;
|
|
77
|
+
/** Who reviewed: never one of `authors`. */
|
|
78
|
+
reviewer: { sessionId: string; agentId: string | null };
|
|
79
|
+
/** The task's authors when the verdict was recorded, so a reader can re-check independence. */
|
|
80
|
+
authors: ReviewAuthors;
|
|
81
|
+
/** The {@link ReviewPacket.packetSha256} the reviewer was given. */
|
|
82
|
+
packetSha256: string;
|
|
83
|
+
/**
|
|
84
|
+
* The id of an earlier non-author `unmet` verdict on the same head that
|
|
85
|
+
* this `met` answers (T14128). Without it, a later `met` cannot clear that
|
|
86
|
+
* `unmet`, so shopping for a friendlier reviewer stays visible.
|
|
87
|
+
*/
|
|
88
|
+
answers?: string;
|
|
89
|
+
/**
|
|
90
|
+
* A shadow verdict (T14372): recorded with every independence check, under
|
|
91
|
+
* `review.shadow-verdict`, and never counted toward a merge.
|
|
92
|
+
*/
|
|
93
|
+
shadow?: true;
|
|
94
|
+
/** ISO-8601 time it was recorded. */
|
|
95
|
+
createdAt: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Why one criterion has no usable verdict on a head. */
|
|
99
|
+
export interface ReviewGap {
|
|
100
|
+
/** The criterion alias. */
|
|
101
|
+
ac: string;
|
|
102
|
+
/**
|
|
103
|
+
* `missing`: none recorded; `unmet`: the latest says unmet; `stale`: only
|
|
104
|
+
* older heads have one; `author`: the latest on the head came from one of
|
|
105
|
+
* the task's own authors (a re-check of the record-time refusal); `edited`:
|
|
106
|
+
* the criterion's text changed after the latest verdict on the head (T14259).
|
|
107
|
+
*/
|
|
108
|
+
kind: 'missing' | 'unmet' | 'stale' | 'author' | 'edited';
|
|
109
|
+
/** A one-line reason, e.g. `AC2: no verdict on head abc1234 (latest is for 9f00e12)`. */
|
|
110
|
+
reason: string;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* An `unmet` verdict a later `met` answered on the same head (T14137), so an
|
|
115
|
+
* owner can see who cleared whose finding.
|
|
116
|
+
*/
|
|
117
|
+
export interface ReviewAnswer {
|
|
118
|
+
/** The criterion. */
|
|
119
|
+
ac: string;
|
|
120
|
+
/** The answered `unmet` verdict and its reviewer. */
|
|
121
|
+
unmet: { id: string; reviewer: ReviewVerdict['reviewer'] };
|
|
122
|
+
/** The `met` verdict that answered it and its reviewer. */
|
|
123
|
+
met: { id: string; reviewer: ReviewVerdict['reviewer'] };
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** The criteria a set of verdicts proves met on a head, and the gaps. */
|
|
127
|
+
export interface ReviewJudgement {
|
|
128
|
+
/** The head judged against. */
|
|
129
|
+
headSha: string;
|
|
130
|
+
/** Criteria whose latest verdict on `headSha` is `met`. */
|
|
131
|
+
met: string[];
|
|
132
|
+
/** Criteria without a `met` verdict on `headSha`, each with why. */
|
|
133
|
+
gaps: ReviewGap[];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Who reviews a PR (T14372, owner decision 2026-11-10): `routine` PRs go to a
|
|
138
|
+
* dispatched reviewer worker; `lead` PRs (migrations, store or sync code,
|
|
139
|
+
* gates, deletions, evidence and review-integrity code, or a file list that
|
|
140
|
+
* cannot be read exactly) stay with the lead.
|
|
141
|
+
*/
|
|
142
|
+
export type ReviewRoute = 'routine' | 'lead';
|
|
143
|
+
|
|
144
|
+
/** Why a PR is lead-reserved: the kind of path and the path itself. */
|
|
145
|
+
export interface ReviewRouteReason {
|
|
146
|
+
/**
|
|
147
|
+
* `migration`, `store-sync`, `gate`, `deletion`, `evidence`,
|
|
148
|
+
* `review-integrity` (review, session, claim and instruction code), or
|
|
149
|
+
* `unrecognised` (a file entry or list that could not be read exactly).
|
|
150
|
+
*/
|
|
151
|
+
kind:
|
|
152
|
+
| 'migration'
|
|
153
|
+
| 'store-sync'
|
|
154
|
+
| 'gate'
|
|
155
|
+
| 'deletion'
|
|
156
|
+
| 'evidence'
|
|
157
|
+
| 'review-integrity'
|
|
158
|
+
| 'unrecognised';
|
|
159
|
+
/** The changed path that reserved it (for a rename, either path), or what could not be read. */
|
|
160
|
+
path: string;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** A PR's route and every path that reserved it for the lead. */
|
|
164
|
+
export interface ReviewRouting {
|
|
165
|
+
/** The route. */
|
|
166
|
+
route: ReviewRoute;
|
|
167
|
+
/** Empty for `routine`. */
|
|
168
|
+
reasons: ReviewRouteReason[];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** One reviewer dispatch, recorded per task as a `review.dispatch` audit row. */
|
|
172
|
+
export interface ReviewDispatch {
|
|
173
|
+
/** The PR. */
|
|
174
|
+
prNumber: number;
|
|
175
|
+
/** The PR head the reviewer is sent to judge. */
|
|
176
|
+
headSha: string;
|
|
177
|
+
/** The task under review. */
|
|
178
|
+
taskId: string;
|
|
179
|
+
/** The criteria to judge. */
|
|
180
|
+
acs: string[];
|
|
181
|
+
/** `shadow`: the reviewer records shadow verdicts, which never count; `counted`: real verdicts. */
|
|
182
|
+
mode: 'shadow' | 'counted';
|
|
183
|
+
/** The agent id the reviewer runs under (`reviewer-<mode>-pr<n>-<sha7>`): never one of the task's authors. */
|
|
184
|
+
reviewerAgentId: string;
|
|
185
|
+
/**
|
|
186
|
+
* The session created for the reviewer at dispatch; a verdict under
|
|
187
|
+
* `reviewerAgentId` is accepted only from it. Empty on a dry run.
|
|
188
|
+
*/
|
|
189
|
+
reviewerSessionId: string;
|
|
190
|
+
/**
|
|
191
|
+
* SHA-256 (hex) of the per-dispatch secret (T14403). The secret itself is
|
|
192
|
+
* never stored in a row: it is written to a 0600 file
|
|
193
|
+
* ({@link ReviewDispatchDecision.reviewerSecretFile}) and a verdict under
|
|
194
|
+
* this dispatch is accepted only with it. Empty on a dry run.
|
|
195
|
+
*/
|
|
196
|
+
reviewerSecretSha256: string;
|
|
197
|
+
/** The session that dispatched: never the reviewer's, never an author's. */
|
|
198
|
+
dispatcherSessionId: string | null;
|
|
199
|
+
/** ISO-8601 time it was recorded. */
|
|
200
|
+
dispatchedAt: string;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** What a dispatch run did, or would do, with one open PR. */
|
|
204
|
+
export interface ReviewDispatchDecision {
|
|
205
|
+
/** The PR. */
|
|
206
|
+
prNumber: number;
|
|
207
|
+
/** The head judged. */
|
|
208
|
+
headSha: string;
|
|
209
|
+
/**
|
|
210
|
+
* `dispatch`: a reviewer is sent (dry run: would be). `dispatched-already`:
|
|
211
|
+
* this head already has one in this mode. `lead`: lead-reserved, never
|
|
212
|
+
* dispatched. `skip`: nothing to review; `reason` says why.
|
|
213
|
+
*/
|
|
214
|
+
action: 'dispatch' | 'dispatched-already' | 'lead' | 'skip';
|
|
215
|
+
/** Why. */
|
|
216
|
+
reason: string;
|
|
217
|
+
/** The route, once the diff was read. */
|
|
218
|
+
routing?: ReviewRouting;
|
|
219
|
+
/** The dispatches recorded (or, on a dry run, that would be), one per task. */
|
|
220
|
+
dispatches?: ReviewDispatch[];
|
|
221
|
+
/** The brief to hand the reviewer agent, for `dispatch`. */
|
|
222
|
+
brief?: string;
|
|
223
|
+
/**
|
|
224
|
+
* Where the per-dispatch secret was written (T14403), on an executed
|
|
225
|
+
* `dispatch`: a 0600 file under `.cleo/review-secrets/`. Only the path is
|
|
226
|
+
* returned, never the secret, so it stays out of the dispatcher's
|
|
227
|
+
* transcript; the dispatcher hands the reviewer the path as
|
|
228
|
+
* `CLEO_REVIEW_SECRET_FILE`.
|
|
229
|
+
*/
|
|
230
|
+
reviewerSecretFile?: string;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** One criterion's shadow verdict next to the counted one on the same head (T14372). */
|
|
234
|
+
export interface ReviewShadowComparison {
|
|
235
|
+
/** The criterion. */
|
|
236
|
+
ac: string;
|
|
237
|
+
/** The latest counted verdict on the head from a non-worker session, or null. */
|
|
238
|
+
lead: 'met' | 'unmet' | null;
|
|
239
|
+
/** The latest shadow verdict on the head, or null. */
|
|
240
|
+
shadow: 'met' | 'unmet' | null;
|
|
241
|
+
/** Both present and equal. */
|
|
242
|
+
agree: boolean;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/** Result of a reviewer dispatch run (`cleo review dispatch`, T14372). */
|
|
246
|
+
export interface ReviewDispatchResult {
|
|
247
|
+
/** Nothing was recorded. */
|
|
248
|
+
dryRun: boolean;
|
|
249
|
+
/** The verdict kind the reviewers are sent to record. */
|
|
250
|
+
mode: 'shadow' | 'counted';
|
|
251
|
+
/** False when no PR was judged; `skippedReason` says why. */
|
|
252
|
+
ran: boolean;
|
|
253
|
+
/** Why it did not run. */
|
|
254
|
+
skippedReason?: string;
|
|
255
|
+
/** One decision per open PR, in PR-number order. */
|
|
256
|
+
decisions: ReviewDispatchDecision[];
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* The owner-only key that lets `cleo review dispatch --counted` send reviewer
|
|
261
|
+
* workers whose verdicts count (T14403). The owner seals it with
|
|
262
|
+
* `cleo config set review.workers.counted true`; it is never stored in
|
|
263
|
+
* config.json, and a plain config write of it is refused.
|
|
264
|
+
*/
|
|
265
|
+
export const REVIEW_WORKERS_COUNTED_KEY = 'review.workers.counted';
|
package/src/row-identity.ts
CHANGED
|
@@ -101,6 +101,17 @@ export interface RowIdentitySpec {
|
|
|
101
101
|
readonly content?: readonly string[];
|
|
102
102
|
/** `natural`: key columns that reference rows; their target uid is hashed. */
|
|
103
103
|
readonly keyRefs?: readonly RowIdentityRef[];
|
|
104
|
+
/**
|
|
105
|
+
* `minted` only: non-key columns that hold a referenced row's UID itself,
|
|
106
|
+
* not its local key (T14335). They are captured, sealed and applied
|
|
107
|
+
* verbatim, as before; what the declaration adds is that a re-key of the
|
|
108
|
+
* target is followed: an op written by the target's origin before its K is
|
|
109
|
+
* re-pointed at the new uid (`followUidAliases`), as a `refs` column is.
|
|
110
|
+
* Never on a `natural` table: its uid is a hash of its key, so a key column
|
|
111
|
+
* holding the target's uid cannot be re-pointed under the same uid; the
|
|
112
|
+
* writer that re-keys the target deletes and re-inserts those rows.
|
|
113
|
+
*/
|
|
114
|
+
readonly uidRefs?: readonly RowIdentityRef[];
|
|
104
115
|
/**
|
|
105
116
|
* `minted`: facts of the row's creation hashed into its birth fingerprint
|
|
106
117
|
* (`birth_fp`), besides the canonical birth. Each entry is a column name,
|
package/src/session-journal.ts
CHANGED
|
@@ -112,7 +112,13 @@ export const sessionJournalEntrySchema = z.object({
|
|
|
112
112
|
tasksCompleted: z.array(z.string()).optional(),
|
|
113
113
|
|
|
114
114
|
// Doctor summary (T1262 absorbed)
|
|
115
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* Compact result of `scanBrainNoise` run at session-end.
|
|
117
|
+
*
|
|
118
|
+
* @deprecated T14120: no longer written. Session end stopped running the
|
|
119
|
+
* brain scan (it held `cleo session end` for ~120 s on a large store); kept
|
|
120
|
+
* so older journal entries still parse. Use `cleo memory doctor`.
|
|
121
|
+
*/
|
|
116
122
|
doctorSummary: sessionJournalDoctorSummarySchema.optional(),
|
|
117
123
|
|
|
118
124
|
// Debrief summary
|
package/src/session.ts
CHANGED
|
@@ -196,6 +196,17 @@ export interface Session {
|
|
|
196
196
|
* @defaultValue undefined
|
|
197
197
|
*/
|
|
198
198
|
lastActivity?: string | null;
|
|
199
|
+
/**
|
|
200
|
+
* CLEO-INJECTION protocol version this session acknowledged (T14327).
|
|
201
|
+
*
|
|
202
|
+
* Recorded when the session runs `cleo briefing`: the `Version:` of the
|
|
203
|
+
* installed global `CLEO-INJECTION.md` template. NULL until then, so a
|
|
204
|
+
* session that never read the briefing shows none. Written only by
|
|
205
|
+
* `setSessionInjectionVersion`; a whole-session upsert never touches it.
|
|
206
|
+
*
|
|
207
|
+
* @defaultValue undefined
|
|
208
|
+
*/
|
|
209
|
+
injectionVersion?: string | null;
|
|
199
210
|
}
|
|
200
211
|
|
|
201
212
|
/**
|
package/src/skills/migrate.ts
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* @task T9742
|
|
22
22
|
* @epic T9740
|
|
23
23
|
* @saga T9560
|
|
24
|
-
* @architecture docs/
|
|
24
|
+
* @architecture docs/concept/skills-architecture.md §1
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
// ---------------------------------------------------------------------------
|
package/src/skills/stats.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @task T9690
|
|
11
11
|
* @epic T9561
|
|
12
12
|
* @saga T9560
|
|
13
|
-
* @architecture docs/
|
|
13
|
+
* @architecture docs/concept/skills-architecture.md §5
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
// ---------------------------------------------------------------------------
|
package/src/spawn-types.ts
CHANGED
|
@@ -9,11 +9,48 @@
|
|
|
9
9
|
* @phase 1B
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
import type { AgentSpawnCapability } from './agent-registry-v3.js';
|
|
13
|
+
import type { LeadDeniedTool, LeadMcpReport } from './operations/orchestrate.js';
|
|
14
|
+
import type { AgentSuiteOwnership } from './spawn.js';
|
|
15
|
+
import type { TaskPipelineStageSource } from './task.js';
|
|
16
|
+
|
|
12
17
|
/**
|
|
13
18
|
* Provider identifier for spawn operations.
|
|
14
19
|
*/
|
|
15
20
|
export type Provider = string;
|
|
16
21
|
|
|
22
|
+
/** Allocated worker identity carried unchanged from the task claim to launch. */
|
|
23
|
+
export interface SpawnWorkerSession {
|
|
24
|
+
/** The worker's allocated CLEO_SESSION_ID, never the coordinator's. */
|
|
25
|
+
readonly sessionId: string;
|
|
26
|
+
/** The worker's claim identity, exported as CLEO_AGENT_ID. */
|
|
27
|
+
readonly agentId: string;
|
|
28
|
+
/** Actual execution role assigned by dispatch, never a classifier's persona. */
|
|
29
|
+
readonly role?: AgentSpawnCapability;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Protocol selection source; task-stage priority requires explicit provenance. */
|
|
33
|
+
export type SpawnProtocolSource =
|
|
34
|
+
| 'explicit'
|
|
35
|
+
| 'pipelineStage'
|
|
36
|
+
| 'kind'
|
|
37
|
+
| 'label'
|
|
38
|
+
| 'type'
|
|
39
|
+
| 'keyword'
|
|
40
|
+
| 'fallback';
|
|
41
|
+
|
|
42
|
+
/** Selected protocol and disclosed disagreements; no model grants authority. */
|
|
43
|
+
export interface SpawnProtocolResolution {
|
|
44
|
+
/** Protocol rendered into the assignment. */
|
|
45
|
+
readonly protocol: string;
|
|
46
|
+
/** Highest-precedence source that selected the protocol. */
|
|
47
|
+
readonly source: SpawnProtocolSource;
|
|
48
|
+
/** Origin of the stored stage; an inherited/default/unknown stage is not explicit intent. */
|
|
49
|
+
readonly pipelineStageSource?: TaskPipelineStageSource;
|
|
50
|
+
/** Lower-precedence signals that disagree with the selection. */
|
|
51
|
+
readonly conflicts: readonly string[];
|
|
52
|
+
}
|
|
53
|
+
|
|
17
54
|
/**
|
|
18
55
|
* CAAMP-compatible spawn options (inlined for zero-dep contracts).
|
|
19
56
|
*/
|
|
@@ -51,6 +88,15 @@ export interface CLEOSpawnContext {
|
|
|
51
88
|
/** Protocol to use for the spawned task */
|
|
52
89
|
protocol: string;
|
|
53
90
|
|
|
91
|
+
/** Authority and conflicting task signals for the selected protocol. */
|
|
92
|
+
protocolResolution?: SpawnProtocolResolution;
|
|
93
|
+
|
|
94
|
+
/** Allocated worker session and claim identity for the execution backend. */
|
|
95
|
+
workerSession?: SpawnWorkerSession;
|
|
96
|
+
|
|
97
|
+
/** Coordinator session for correlation only; never a worker binding. */
|
|
98
|
+
coordinatorSessionId?: string | null;
|
|
99
|
+
|
|
54
100
|
/** Fully-resolved prompt to send to subagent */
|
|
55
101
|
prompt: string;
|
|
56
102
|
|
|
@@ -65,6 +111,22 @@ export interface CLEOSpawnContext {
|
|
|
65
111
|
|
|
66
112
|
/** Token resolution information for the prompt */
|
|
67
113
|
tokenResolution?: TokenResolution;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Tools to remove from the spawned agent; set only for a lead spawn under
|
|
117
|
+
* the lead/worker split. The spawn bridge forwards it as
|
|
118
|
+
* `SpawnContext.leadDeniedTools` and refuses the spawn with
|
|
119
|
+
* `E_LEAD_TOOLS_UNSTRIPPED` when the provider does not declare
|
|
120
|
+
* `leadToolStrip: 'enforced'`. Absent or empty for a worker spawn.
|
|
121
|
+
*
|
|
122
|
+
* @task T14357
|
|
123
|
+
*/
|
|
124
|
+
leadDeniedTools?: readonly LeadDeniedTool[];
|
|
125
|
+
/**
|
|
126
|
+
* Called with the lead process's pid as soon as the provider starts it, so
|
|
127
|
+
* the lead record can name it (T14363). Lead spawns only.
|
|
128
|
+
*/
|
|
129
|
+
onLeadStarted?: (pid: number) => void;
|
|
68
130
|
}
|
|
69
131
|
|
|
70
132
|
/**
|
|
@@ -99,6 +161,19 @@ export interface CLEOSpawnResult extends CAAMPSpawnResult {
|
|
|
99
161
|
*/
|
|
100
162
|
status?: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
101
163
|
|
|
164
|
+
/**
|
|
165
|
+
* Containment handle (pid/pgid/scope) of a worker left running, passed on
|
|
166
|
+
* from the provider's `SpawnResult` so the worker record can store it.
|
|
167
|
+
* @task T14359
|
|
168
|
+
*/
|
|
169
|
+
ownership?: AgentSuiteOwnership;
|
|
170
|
+
|
|
171
|
+
/** MCP servers a lead spawn loaded, passed on from `SpawnResult` (T14423). */
|
|
172
|
+
leadMcp?: LeadMcpReport;
|
|
173
|
+
|
|
174
|
+
/** A detached lead's private temp directory, from `SpawnResult` (T14363). */
|
|
175
|
+
leadTempDir?: string;
|
|
176
|
+
|
|
102
177
|
/** Reference to manifest entry if output was captured */
|
|
103
178
|
manifestEntryId?: string;
|
|
104
179
|
}
|
package/src/spawn.ts
CHANGED
|
@@ -5,8 +5,16 @@
|
|
|
5
5
|
* @task T9214 — orchestrator-defer waiver field (W4 UX hardening)
|
|
6
6
|
* @task T9215 — DelegateTaskEnvelope discriminated-union type (W1 wiring)
|
|
7
7
|
* @task T11998 — per-session suite containment (AgentSuiteOwnership)
|
|
8
|
+
* @task T14357 — lead tool strip (leadToolStrip / leadDeniedTools)
|
|
8
9
|
*/
|
|
9
10
|
|
|
11
|
+
import type {
|
|
12
|
+
LeadDeniedTool,
|
|
13
|
+
LeadMcpReport,
|
|
14
|
+
LeadToolStripSupport,
|
|
15
|
+
} from './operations/orchestrate.js';
|
|
16
|
+
import type { SpawnProtocolResolution, SpawnWorkerSession } from './spawn-types.js';
|
|
17
|
+
|
|
10
18
|
// =============================================================================
|
|
11
19
|
// Agent suite ownership handle (T11998 — suite containment)
|
|
12
20
|
// =============================================================================
|
|
@@ -78,6 +86,14 @@ export interface AgentSuiteOwnership {
|
|
|
78
86
|
}
|
|
79
87
|
|
|
80
88
|
export interface AdapterSpawnProvider {
|
|
89
|
+
/**
|
|
90
|
+
* Whether this provider removes {@link SpawnContext.leadDeniedTools} from a
|
|
91
|
+
* spawned lead. Absent means `'unsupported'`: a lead spawn is refused with
|
|
92
|
+
* `E_LEAD_TOOLS_UNSTRIPPED` (lead/worker split, epic T14351).
|
|
93
|
+
*
|
|
94
|
+
* @task T14357
|
|
95
|
+
*/
|
|
96
|
+
readonly leadToolStrip?: LeadToolStripSupport;
|
|
81
97
|
canSpawn(): Promise<boolean>;
|
|
82
98
|
spawn(context: SpawnContext): Promise<SpawnResult>;
|
|
83
99
|
listRunning(): Promise<SpawnResult[]>;
|
|
@@ -87,6 +103,12 @@ export interface AdapterSpawnProvider {
|
|
|
87
103
|
export interface SpawnContext {
|
|
88
104
|
taskId: string;
|
|
89
105
|
prompt: string;
|
|
106
|
+
/** Allocated worker identity; execution backends must preserve both values. */
|
|
107
|
+
workerSession?: SpawnWorkerSession;
|
|
108
|
+
/** Coordinator session for correlation only. */
|
|
109
|
+
coordinatorSessionId?: string | null;
|
|
110
|
+
/** Protocol authority and disagreements, independent of persona classification. */
|
|
111
|
+
protocolResolution?: SpawnProtocolResolution;
|
|
90
112
|
workingDirectory?: string;
|
|
91
113
|
options?: Record<string, unknown>;
|
|
92
114
|
/**
|
|
@@ -104,6 +126,22 @@ export interface SpawnContext {
|
|
|
104
126
|
* @task T9214
|
|
105
127
|
*/
|
|
106
128
|
scope?: 'orchestrator-defer';
|
|
129
|
+
/**
|
|
130
|
+
* Tools to remove from the spawned agent. Set only for a lead spawn under
|
|
131
|
+
* the lead/worker split (`orchestrate.leadWorker.v1`), normally to
|
|
132
|
+
* `LEAD_DENIED_TOOLS`. Absent or empty for a worker spawn, whose tool set is
|
|
133
|
+
* unchanged. A provider whose {@link AdapterSpawnProvider.leadToolStrip} is
|
|
134
|
+
* not `'enforced'` refuses such a spawn with `E_LEAD_TOOLS_UNSTRIPPED`.
|
|
135
|
+
*
|
|
136
|
+
* @task T14357
|
|
137
|
+
* @epic T14351
|
|
138
|
+
*/
|
|
139
|
+
leadDeniedTools?: readonly LeadDeniedTool[];
|
|
140
|
+
/**
|
|
141
|
+
* Called with the lead process's pid as soon as the provider starts it, so
|
|
142
|
+
* the lead record can name it (T14363). Lead spawns only.
|
|
143
|
+
*/
|
|
144
|
+
onLeadStarted?: (pid: number) => void;
|
|
107
145
|
}
|
|
108
146
|
|
|
109
147
|
export interface SpawnResult {
|
|
@@ -127,6 +165,16 @@ export interface SpawnResult {
|
|
|
127
165
|
* Absent for legacy spawns that used detached+unref without containment.
|
|
128
166
|
*/
|
|
129
167
|
ownership?: AgentSuiteOwnership;
|
|
168
|
+
/**
|
|
169
|
+
* MCP servers a lead spawn loaded; absent for a worker spawn (T14423).
|
|
170
|
+
*/
|
|
171
|
+
leadMcp?: LeadMcpReport;
|
|
172
|
+
/**
|
|
173
|
+
* Private temp directory of a detached lead's run (it may hold the mbx
|
|
174
|
+
* env), so a reaper can remove it when the lead died without its hooks
|
|
175
|
+
* (T14363). Absent for every other spawn.
|
|
176
|
+
*/
|
|
177
|
+
leadTempDir?: string;
|
|
130
178
|
}
|
|
131
179
|
|
|
132
180
|
// =============================================================================
|
package/src/status-registry.ts
CHANGED
|
@@ -73,6 +73,43 @@ export const TERMINAL_TASK_STATUSES: ReadonlySet<TaskStatus> = new Set([
|
|
|
73
73
|
'archived',
|
|
74
74
|
]);
|
|
75
75
|
|
|
76
|
+
/** A child status that needs no more work: `done`, `cancelled` or `archived`. */
|
|
77
|
+
export type SettledTaskStatus = 'done' | 'cancelled' | 'archived';
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Whether a child task is settled: it needs no more work (`done`, `cancelled`
|
|
81
|
+
* or `archived`, the {@link TERMINAL_TASK_STATUSES}). The one predicate every
|
|
82
|
+
* parent-terminal path uses (T14266): cancel and its cascade, archive and
|
|
83
|
+
* update to cancelled (via `countActiveChildren`, which filters on the same
|
|
84
|
+
* set in SQL), complete's premature-close guard and rollups, and the `done`
|
|
85
|
+
* epic plan. A settled `cancelled` child still needs a waiver before a parent
|
|
86
|
+
* can roll up over it; settled only means no work remains.
|
|
87
|
+
*
|
|
88
|
+
* @param status - The child's status.
|
|
89
|
+
* @returns True when the child needs no more work.
|
|
90
|
+
*/
|
|
91
|
+
export function isSettledChild(status: TaskStatus): status is SettledTaskStatus {
|
|
92
|
+
return TERMINAL_TASK_STATUSES.has(status);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Why a task was cancelled (T14267, owner decision D11229). `superseded` and
|
|
97
|
+
* `duplicate` name a replacement (`replacedBy`); once it is done the cancelled
|
|
98
|
+
* child counts as covered in a parent rollup with no waiver. `abandoned` and
|
|
99
|
+
* `obsolete` work was not delivered, so a parent still needs the audited
|
|
100
|
+
* `--waive-cancelled-children` waiver.
|
|
101
|
+
*/
|
|
102
|
+
export const CANCELLATION_KINDS = ['abandoned', 'superseded', 'duplicate', 'obsolete'] as const;
|
|
103
|
+
|
|
104
|
+
/** One of {@link CANCELLATION_KINDS}. */
|
|
105
|
+
export type CancellationKind = (typeof CANCELLATION_KINDS)[number];
|
|
106
|
+
|
|
107
|
+
/** The cancellation kinds a done replacement covers (T14267, D11229). */
|
|
108
|
+
export const REPLACED_CANCELLATION_KINDS: ReadonlySet<CancellationKind> = new Set([
|
|
109
|
+
'superseded',
|
|
110
|
+
'duplicate',
|
|
111
|
+
]);
|
|
112
|
+
|
|
76
113
|
export const TERMINAL_PIPELINE_STATUSES: ReadonlySet<PipelineStatus> = new Set([
|
|
77
114
|
'completed',
|
|
78
115
|
'failed',
|
|
@@ -178,6 +178,29 @@ export interface PendingTableClassification {
|
|
|
178
178
|
readonly source: string;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
+
/**
|
|
182
|
+
* A column a schema migration dropped from a syncing table.
|
|
183
|
+
*
|
|
184
|
+
* A peer still on an older build can send an op whose image names the
|
|
185
|
+
* column. A receiver whose table no longer has it drops the column from the
|
|
186
|
+
* op's images and applies the rest, instead of refusing the op as schema
|
|
187
|
+
* skew: a store that dropped a column never gains it back, so a refusal
|
|
188
|
+
* would hold the stream forever. Any other column the receiver lacks is
|
|
189
|
+
* still refused (`E_SCHEMA_AHEAD`).
|
|
190
|
+
*
|
|
191
|
+
* @task T14311
|
|
192
|
+
*/
|
|
193
|
+
export interface RetiredSyncColumn {
|
|
194
|
+
/** Physical table name. */
|
|
195
|
+
readonly table: string;
|
|
196
|
+
/** Physical column name the migration dropped. */
|
|
197
|
+
readonly column: string;
|
|
198
|
+
/** The task whose migration dropped the column. */
|
|
199
|
+
readonly retiredBy: string;
|
|
200
|
+
/** Why the column was dropped. */
|
|
201
|
+
readonly reason: string;
|
|
202
|
+
}
|
|
203
|
+
|
|
181
204
|
/**
|
|
182
205
|
* The full classification of one scope.
|
|
183
206
|
*
|
package/src/task-id.ts
CHANGED
|
@@ -67,61 +67,23 @@ export function isTaskId(value: unknown): value is TaskId {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
70
|
+
* Whether `value` is storable as a task identifier: the task grammar
|
|
71
|
+
* ({@link TASK_ID_REGEX}), the check every write chokepoint uses.
|
|
71
72
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* NOT what the store actually contains, and enforcing it at the write path
|
|
76
|
-
* would break working features. Measured against a live store of 3,198 tasks:
|
|
77
|
-
*
|
|
78
|
-
* | id | origin |
|
|
79
|
-
* |---|---|
|
|
80
|
-
* | `T-RECONCILE-FOLLOWUP-v2026.5.63-6` | generated ON PURPOSE by `archive-reason-invariant.ts` |
|
|
81
|
-
* | `T932EP` | unknown, pre-existing |
|
|
82
|
-
* | `/mnt/projects/cleocode` | the corruption this guard exists to stop |
|
|
83
|
-
*
|
|
84
|
-
* So CLEO deliberately mints structured ids that its own canonical pattern
|
|
85
|
-
* rejects — and, separately, that `cleo show` rejects too, which makes those
|
|
86
|
-
* release follow-up tasks as unreachable as the corrupt row. That is a real
|
|
87
|
-
* defect, but it is a **design** question about the id space, and settling it
|
|
88
|
-
* inside a guard that stops path-shaped garbage would be scope creep with a
|
|
89
|
-
* broken `cleo release reconcile` as the cost.
|
|
90
|
-
*
|
|
91
|
-
* This predicate therefore rejects only what cannot be an identifier under any
|
|
92
|
-
* shape: empty, whitespace, path separators, control characters, or absurd
|
|
93
|
-
* length. It catches the actual harm without taking a position on digits.
|
|
94
|
-
*/
|
|
95
|
-
const FORBIDDEN_IN_TASK_ID = /[\s/\\\x00-\x1f\x7f]/;
|
|
96
|
-
|
|
97
|
-
/** Longest plausible identifier; anything beyond this is not an id. */
|
|
98
|
-
const MAX_TASK_ID_LENGTH = 64;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Whether `value` is storable as a task identifier.
|
|
102
|
-
*
|
|
103
|
-
* Deliberately broader than {@link isTaskId}: it admits every id shape CLEO
|
|
104
|
-
* actually mints (including the structured `T-RECONCILE-FOLLOWUP-…` ids the
|
|
105
|
-
* release reconciler creates) while rejecting values that are not identifiers
|
|
106
|
-
* at all. Use this at write chokepoints; use {@link isTaskId} when you
|
|
107
|
-
* genuinely need the canonical generated shape.
|
|
73
|
+
* It was once broader, to admit the `T-RECONCILE-FOLLOWUP-…` ids the release
|
|
74
|
+
* reconciler minted; those are now allocated `T####` ids (T14271), and the
|
|
75
|
+
* stored ones are re-keyed by `cleo doctor malformed-ids --fix` (T14324).
|
|
108
76
|
*
|
|
109
77
|
* @param value - candidate identifier.
|
|
110
78
|
* @returns `true` when `value` can be stored as an id.
|
|
111
79
|
*
|
|
112
80
|
* @example
|
|
113
81
|
* ```ts
|
|
114
|
-
* isStorableTaskId('T12128');
|
|
115
|
-
* isStorableTaskId('T-RECONCILE-FOLLOWUP-v2026.5.63-6'); //
|
|
116
|
-
* isStorableTaskId('/mnt/projects/cleocode');
|
|
117
|
-
* isStorableTaskId('see T1234 for details'); // false — whitespace
|
|
82
|
+
* isStorableTaskId('T12128'); // true
|
|
83
|
+
* isStorableTaskId('T-RECONCILE-FOLLOWUP-v2026.5.63-6'); // false — re-keyed by doctor
|
|
84
|
+
* isStorableTaskId('/mnt/projects/cleocode'); // false — a path
|
|
118
85
|
* ```
|
|
119
86
|
*/
|
|
120
87
|
export function isStorableTaskId(value: unknown): value is TaskId {
|
|
121
|
-
|
|
122
|
-
if (value.length === 0 || value.length > MAX_TASK_ID_LENGTH) return false;
|
|
123
|
-
if (FORBIDDEN_IN_TASK_ID.test(value)) return false;
|
|
124
|
-
// An identifier must start with a letter — this rejects paths beginning
|
|
125
|
-
// `./`, `~`, or a digit-only value that is really a count.
|
|
126
|
-
return /^[A-Za-z]/.test(value);
|
|
88
|
+
return isTaskId(value);
|
|
127
89
|
}
|