@cleocode/contracts 2026.10.27 → 2026.11.1-canary.11
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 +533 -0
- package/dist/orca-execution.d.ts.map +1 -0
- package/dist/orca-execution.js +385 -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 +528 -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
|
@@ -193,12 +193,14 @@ describe('CommandGate schema', () => {
|
|
|
193
193
|
it('round-trips a minimal command gate', () => {
|
|
194
194
|
const input = {
|
|
195
195
|
kind: 'command' as const,
|
|
196
|
-
cmd: 'cleo
|
|
196
|
+
cmd: 'cleo',
|
|
197
|
+
args: ['doctor'],
|
|
197
198
|
description: 'cleo doctor must exit 0',
|
|
198
199
|
};
|
|
199
200
|
const result = commandGateSchema.parse(input);
|
|
200
201
|
expect(result.kind).toBe('command');
|
|
201
|
-
expect(result.cmd).toBe('cleo
|
|
202
|
+
expect(result.cmd).toBe('cleo');
|
|
203
|
+
expect(result.args).toEqual(['doctor']);
|
|
202
204
|
// exitCode defaults to undefined (not set in schema default)
|
|
203
205
|
expect(result.exitCode).toBeUndefined();
|
|
204
206
|
});
|
|
@@ -370,12 +372,23 @@ describe('acceptanceGateSchema (discriminated union)', () => {
|
|
|
370
372
|
it('routes command gate by kind', () => {
|
|
371
373
|
const result = acceptanceGateSchema.parse({
|
|
372
374
|
kind: 'command',
|
|
373
|
-
cmd: 'pnpm
|
|
375
|
+
cmd: 'pnpm',
|
|
376
|
+
args: ['doctor'],
|
|
374
377
|
description: 'doctor must succeed',
|
|
375
378
|
});
|
|
376
379
|
expect(result.kind).toBe('command');
|
|
377
380
|
});
|
|
378
381
|
|
|
382
|
+
it('parse still accepts a legacy stored command gate whose cmd carries arguments (T14155)', () => {
|
|
383
|
+
// Writes refuse this shape (cleo req add / replace); reading a stored one never does.
|
|
384
|
+
const result = acceptanceGateSchema.parse({
|
|
385
|
+
kind: 'command',
|
|
386
|
+
cmd: 'pnpm doctor',
|
|
387
|
+
description: 'doctor must succeed',
|
|
388
|
+
});
|
|
389
|
+
expect(result.kind === 'command' && result.cmd).toBe('pnpm doctor');
|
|
390
|
+
});
|
|
391
|
+
|
|
379
392
|
it('routes lint gate by kind', () => {
|
|
380
393
|
const result = acceptanceGateSchema.parse({
|
|
381
394
|
kind: 'lint',
|
|
@@ -32,7 +32,7 @@ describe('EvidenceAtomSchema (T10337)', () => {
|
|
|
32
32
|
// Verify the shared constant is in sync with the zod discriminated union.
|
|
33
33
|
// The discriminated union keys are 'commit','files','test-run','qa-run',
|
|
34
34
|
// 'tool','url','note','decision','pr','ci','loc-drop','callsite-coverage',
|
|
35
|
-
// 'satisfies' ('qa-run': T13427).
|
|
35
|
+
// 'satisfies' ('qa-run': T13427), 'deploy' (T14083), 'ci-run' (T14149).
|
|
36
36
|
const expected = [
|
|
37
37
|
'commit',
|
|
38
38
|
'files',
|
|
@@ -44,6 +44,8 @@ describe('EvidenceAtomSchema (T10337)', () => {
|
|
|
44
44
|
'decision',
|
|
45
45
|
'pr',
|
|
46
46
|
'ci',
|
|
47
|
+
'ci-run',
|
|
48
|
+
'deploy',
|
|
47
49
|
'loc-drop',
|
|
48
50
|
'callsite-coverage',
|
|
49
51
|
'satisfies',
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import { describe, expect, it } from 'vitest';
|
|
21
|
-
import type { LlmConfig, LlmDefaultConfig, LlmRoleConfig, RoleName } from '../config.js';
|
|
21
|
+
import type { LlmConfig, LlmDefaultConfig, LlmRoleConfig, RoleName } from '../config/types.js';
|
|
22
22
|
|
|
23
23
|
describe('LlmConfig — Phase 4 schema cleanup (T9306)', () => {
|
|
24
24
|
it('accepts a fully-populated config with default and roles', () => {
|
|
@@ -60,7 +60,7 @@ type AssertEquals1<T extends 1> = T;
|
|
|
60
60
|
type _BrainCompactHitShape = {
|
|
61
61
|
matchedHistoricalIds?: string[];
|
|
62
62
|
id: string;
|
|
63
|
-
type: 'decision' | 'pattern' | 'learning' | 'observation';
|
|
63
|
+
type: 'decision' | 'pattern' | 'learning' | 'observation' | 'doc';
|
|
64
64
|
title: string;
|
|
65
65
|
date: string;
|
|
66
66
|
relevance?: number;
|
|
@@ -68,6 +68,8 @@ type _BrainCompactHitShape = {
|
|
|
68
68
|
bm25Score?: number;
|
|
69
69
|
_next?: Record<string, string>;
|
|
70
70
|
scope?: 'project' | 'global';
|
|
71
|
+
docs?: string[];
|
|
72
|
+
replaces?: string;
|
|
71
73
|
};
|
|
72
74
|
|
|
73
75
|
type _AssertBrainCompactHitPinned = AssertEquals1<Equals<BrainCompactHit, _BrainCompactHitShape>>;
|
|
@@ -99,6 +101,7 @@ type _SearchBrainCompactResultShape = {
|
|
|
99
101
|
results: BrainCompactHit[];
|
|
100
102
|
total: number;
|
|
101
103
|
tokensEstimated: number;
|
|
104
|
+
taskDocs?: Array<{ taskId: string; docs: string[] }>;
|
|
102
105
|
};
|
|
103
106
|
|
|
104
107
|
type _AssertSearchResultPinned = AssertEquals1<
|
|
@@ -108,14 +108,15 @@ describe('dispatch/operation-def contracts', () => {
|
|
|
108
108
|
// T11939 — +1 for the new 'service' domain (universal service-vault OAuth flow).
|
|
109
109
|
// T11700 — +4 for the 5-entity provider experience: 'account', 'provider',
|
|
110
110
|
// 'model', 'profile' (North-Star §2 addressable provider surface).
|
|
111
|
-
|
|
111
|
+
// T13955 — -1: the 'conduit' domain was removed (messaging moved to AgentMBX).
|
|
112
|
+
expect(CANONICAL_DOMAINS.length).toBe(28);
|
|
112
113
|
});
|
|
113
114
|
|
|
114
115
|
it('CANONICAL_DOMAINS contains the four sentinel newly-promoted domains', () => {
|
|
115
|
-
// Spot-check the canonical surface:
|
|
116
|
+
// Spot-check the canonical surface: T1726 sentient/release,
|
|
116
117
|
// T9528 provenance, T9536 upgrade. Catches the most common drift where
|
|
117
118
|
// someone deletes one and breaks SDK consumers downstream.
|
|
118
|
-
expect(CANONICAL_DOMAINS).toContain('conduit');
|
|
119
|
+
expect(CANONICAL_DOMAINS).not.toContain('conduit');
|
|
119
120
|
expect(CANONICAL_DOMAINS).toContain('sentient');
|
|
120
121
|
expect(CANONICAL_DOMAINS).toContain('release');
|
|
121
122
|
expect(CANONICAL_DOMAINS).toContain('provenance');
|
|
@@ -34,6 +34,11 @@ export const gateBaseSchema = z.object({
|
|
|
34
34
|
advisory: z.boolean().optional(),
|
|
35
35
|
/** Per-gate timeout override in milliseconds. */
|
|
36
36
|
timeoutMs: z.number().int().positive().optional(),
|
|
37
|
+
/** Declared evidence repository the gate runs in (T14078). */
|
|
38
|
+
repo: z
|
|
39
|
+
.string()
|
|
40
|
+
.regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/)
|
|
41
|
+
.optional(),
|
|
37
42
|
});
|
|
38
43
|
|
|
39
44
|
// ─── File assertion schemas ───────────────────────────────────────────────────
|
package/src/acceptance-gate.ts
CHANGED
|
@@ -122,6 +122,15 @@ export interface GateBase {
|
|
|
122
122
|
* covers only the surrounding bookkeeping, never a gate (T12621).
|
|
123
123
|
*/
|
|
124
124
|
timeoutMs?: number;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Name of an evidence repository the project declares in
|
|
128
|
+
* `.cleo/project-context.json` (`evidence.repositories`, T14078): the gate
|
|
129
|
+
* runs in that checkout, its inputs are captured there and it is
|
|
130
|
+
* revalidated there. A name the project does not declare is refused.
|
|
131
|
+
* Absent, the gate runs in the task's evidence tree.
|
|
132
|
+
*/
|
|
133
|
+
repo?: string;
|
|
125
134
|
}
|
|
126
135
|
|
|
127
136
|
// ─── Variants ────────────────────────────────────────────────────────────────
|
package/src/brain-graph.ts
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* @task T969 — `@cleocode/brain` package extraction
|
|
25
25
|
* @see packages/brain/src/types.ts (re-exports from here for backwards compat)
|
|
26
26
|
* @see packages/contracts/src/operations/brain.ts (wire-format / ops contracts)
|
|
27
|
-
* @see docs/
|
|
27
|
+
* @see docs/research/brain-synaptic-visualization.md §5.2
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
// ---------------------------------------------------------------------------
|
package/src/caamp-markers.ts
CHANGED
|
@@ -233,6 +233,17 @@ export interface GlobalInstructionFileStatus {
|
|
|
233
233
|
* copy. Reported only; user content is never removed automatically.
|
|
234
234
|
*/
|
|
235
235
|
duplicateLines: number;
|
|
236
|
+
/**
|
|
237
|
+
* sha256 of the managed block's body as it is on disk, or null when the file
|
|
238
|
+
* has no block (T14304).
|
|
239
|
+
*/
|
|
240
|
+
blockSha256: string | null;
|
|
241
|
+
/**
|
|
242
|
+
* sha256 of the body a sync would write now, or null when the hub does not
|
|
243
|
+
* resolve. A block whose hash differs is `stale` even when its source stamps
|
|
244
|
+
* still match (an edited or hand-copied block, T14304).
|
|
245
|
+
*/
|
|
246
|
+
expectedSha256: string | null;
|
|
236
247
|
}
|
|
237
248
|
|
|
238
249
|
/**
|
package/src/config/manifest.ts
CHANGED
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
import { type ZodTypeAny, z } from 'zod';
|
|
24
|
+
import { orchestrateOrcaConfigSchema } from '../orca-execution.js';
|
|
25
|
+
import { projectWorkerPolicySchema } from './worker-policy.js';
|
|
24
26
|
|
|
25
27
|
// ───────────────────────────────────────────────────────────────────────────
|
|
26
28
|
// Scope + drift unions
|
|
@@ -158,6 +160,17 @@ export const CLEO_CONFIG_MANIFEST: ConfigManifestEntry = {
|
|
|
158
160
|
path: '.cleo/config.json',
|
|
159
161
|
mergePrecedence: 20,
|
|
160
162
|
driftDetection: 'schema-validate',
|
|
163
|
+
schema: z
|
|
164
|
+
.object({
|
|
165
|
+
orchestrate: z
|
|
166
|
+
.object({
|
|
167
|
+
workerPolicy: projectWorkerPolicySchema.optional(),
|
|
168
|
+
orca: orchestrateOrcaConfigSchema.optional(),
|
|
169
|
+
})
|
|
170
|
+
.passthrough()
|
|
171
|
+
.optional(),
|
|
172
|
+
})
|
|
173
|
+
.passthrough(),
|
|
161
174
|
};
|
|
162
175
|
|
|
163
176
|
/**
|
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
* @task T5710
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import type { HeavyCommandHookMode } from '
|
|
13
|
-
import type { LeanConfig } from '
|
|
14
|
-
import type { ModelTransport } from '
|
|
12
|
+
import type { HeavyCommandHookMode } from '../heavy-command-hook.js';
|
|
13
|
+
import type { LeanConfig } from '../lean.js';
|
|
14
|
+
import type { ModelTransport } from '../operations/llm.js';
|
|
15
|
+
import type { OrchestrateOrcaConfig } from '../orca-execution.js';
|
|
16
|
+
import type { ProjectWorkerPolicy } from './worker-policy.js';
|
|
15
17
|
|
|
16
18
|
/** Output format options. */
|
|
17
19
|
export type OutputFormat = 'json' | 'text' | 'jsonl' | 'markdown' | 'table';
|
|
@@ -41,6 +43,12 @@ export interface BackupConfig {
|
|
|
41
43
|
maxSafetyBackups: number;
|
|
42
44
|
/** Whether to compress backup files to reduce disk usage. */
|
|
43
45
|
compressionEnabled: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Byte cap on `.cleo/backups/sqlite` (T14278). After every snapshot the
|
|
48
|
+
* oldest provably redundant sets are removed until the directory fits;
|
|
49
|
+
* unset or 0: five times the live store's size.
|
|
50
|
+
*/
|
|
51
|
+
maxBytes?: number;
|
|
44
52
|
}
|
|
45
53
|
|
|
46
54
|
/** Hierarchy enforcement profile preset. */
|
|
@@ -781,6 +789,85 @@ export interface LeadRollupConfig {
|
|
|
781
789
|
mode?: LeadRollupMode;
|
|
782
790
|
}
|
|
783
791
|
|
|
792
|
+
/**
|
|
793
|
+
* Lead/worker split settings (`orchestrate.leadWorker.*`).
|
|
794
|
+
*
|
|
795
|
+
* @task T14356
|
|
796
|
+
* @epic T14351
|
|
797
|
+
*/
|
|
798
|
+
export interface OrchestrateLeadWorkerConfig {
|
|
799
|
+
/**
|
|
800
|
+
* Version 1 of the lead/worker split: leads spawn with their write and
|
|
801
|
+
* network tools stripped (`LeadToolPolicy`) and workers return a
|
|
802
|
+
* `WorkerReport` with proof. Off by default.
|
|
803
|
+
*
|
|
804
|
+
* @defaultValue false
|
|
805
|
+
*/
|
|
806
|
+
v1?: boolean;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* Orchestration settings (`orchestrate.*`).
|
|
811
|
+
*
|
|
812
|
+
* @task T14356
|
|
813
|
+
*/
|
|
814
|
+
export interface OrchestrateConfig {
|
|
815
|
+
/** Ordered Orca harness rotation, used only inside a verified Orca context. */
|
|
816
|
+
orca?: OrchestrateOrcaConfig;
|
|
817
|
+
/** Project worker instructions and verification placement; absent preserves legacy prompts. */
|
|
818
|
+
workerPolicy?: ProjectWorkerPolicy;
|
|
819
|
+
/**
|
|
820
|
+
* Lead/worker split settings.
|
|
821
|
+
*
|
|
822
|
+
* @defaultValue { v1: false }
|
|
823
|
+
*/
|
|
824
|
+
leadWorker?: OrchestrateLeadWorkerConfig;
|
|
825
|
+
/**
|
|
826
|
+
* Context-window usage thresholds (percent) for orchestrator wrap-up and
|
|
827
|
+
* stop. Formerly `orchestrator.contextThresholds`; configs with the old key
|
|
828
|
+
* are migrated on read and by `cleo upgrade` (T14375).
|
|
829
|
+
*
|
|
830
|
+
* @defaultValue { warning: 70, critical: 80 }
|
|
831
|
+
*/
|
|
832
|
+
contextThresholds?: OrchestrateContextThresholds;
|
|
833
|
+
/**
|
|
834
|
+
* The project's lead AgentMBX mailbox, recorded by `cleo init` with
|
|
835
|
+
* `leadWorker.v1` on and `agentmbx` installed. Spawn and fanout name it in
|
|
836
|
+
* worker prompts when `--lead-mbx` is not given (only with `leadWorker.v1`).
|
|
837
|
+
*
|
|
838
|
+
* @defaultValue undefined (no lead mailbox recorded)
|
|
839
|
+
* @task T14379
|
|
840
|
+
*/
|
|
841
|
+
leadMailbox?: LeadMailbox;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* Context-window usage thresholds (`orchestrate.contextThresholds.*`).
|
|
846
|
+
*
|
|
847
|
+
* @task T14375
|
|
848
|
+
*/
|
|
849
|
+
export interface OrchestrateContextThresholds {
|
|
850
|
+
/** Percent at which the orchestrator plans to wrap up. @defaultValue 70 */
|
|
851
|
+
warning?: number;
|
|
852
|
+
/** Percent at which the orchestrator stops and hands off. @defaultValue 80 */
|
|
853
|
+
critical?: number;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* A per-project lead mailbox identity on AgentMBX (`orchestrate.leadMailbox`).
|
|
858
|
+
*
|
|
859
|
+
* @task T14379
|
|
860
|
+
* @epic T14351
|
|
861
|
+
*/
|
|
862
|
+
export interface LeadMailbox {
|
|
863
|
+
/** Mailbox name, `<project>-<project-id hash>-lead` by default. */
|
|
864
|
+
name: string;
|
|
865
|
+
/** Portable project id the mailbox belongs to. */
|
|
866
|
+
projectId: string;
|
|
867
|
+
/** AgentMBX provider CLI the lead claims it from (`--cli`), e.g. `claude`. */
|
|
868
|
+
cli: string;
|
|
869
|
+
}
|
|
870
|
+
|
|
784
871
|
/**
|
|
785
872
|
* Inline refresh policy for code-graph queries (T12316).
|
|
786
873
|
*
|
|
@@ -933,6 +1020,33 @@ export interface ResourcesPsiConfig {
|
|
|
933
1020
|
backoffFullAvg10?: number;
|
|
934
1021
|
}
|
|
935
1022
|
|
|
1023
|
+
/**
|
|
1024
|
+
* The spawned agent-session budget (`resources.agentSession.*`, T14227).
|
|
1025
|
+
*
|
|
1026
|
+
* @task T14227
|
|
1027
|
+
*/
|
|
1028
|
+
export interface ResourcesAgentSessionConfig {
|
|
1029
|
+
/**
|
|
1030
|
+
* How many spawned agent sessions hold a lease at once, machine-wide
|
|
1031
|
+
* (T14283: a lease count; only critical memory stops a spawn).
|
|
1032
|
+
*
|
|
1033
|
+
* @defaultValue undefined (`max(1, cpus - 2)`)
|
|
1034
|
+
*/
|
|
1035
|
+
maxSessions?: number;
|
|
1036
|
+
/**
|
|
1037
|
+
* Ignored since T14283: the budget is a lease count, not memory.
|
|
1038
|
+
*
|
|
1039
|
+
* @deprecated Accepted with a deprecation note for one release; set `maxSessions`.
|
|
1040
|
+
*/
|
|
1041
|
+
estRamMb?: number;
|
|
1042
|
+
/**
|
|
1043
|
+
* Ignored since T14283: the budget is a lease count, not memory.
|
|
1044
|
+
*
|
|
1045
|
+
* @deprecated Accepted with a deprecation note for one release; set `maxSessions`.
|
|
1046
|
+
*/
|
|
1047
|
+
headroomMb?: number;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
936
1050
|
/**
|
|
937
1051
|
* Resource monitor configuration.
|
|
938
1052
|
*
|
|
@@ -951,11 +1065,18 @@ export interface ResourcesConfig {
|
|
|
951
1065
|
/**
|
|
952
1066
|
* Minimum free memory headroom in MiB.
|
|
953
1067
|
*
|
|
954
|
-
* Used in degraded mode (PSI absent) as the sole availability signal.
|
|
1068
|
+
* Used in degraded mode (PSI absent) as the sole availability signal. The
|
|
1069
|
+
* agent-session budget has its own `agentSession.headroomMb` (T14227).
|
|
955
1070
|
*
|
|
956
1071
|
* @defaultValue 256
|
|
957
1072
|
*/
|
|
958
1073
|
headroomMb?: number;
|
|
1074
|
+
/**
|
|
1075
|
+
* The spawned agent-session budget (T14227).
|
|
1076
|
+
*
|
|
1077
|
+
* @defaultValue undefined (built-in budget)
|
|
1078
|
+
*/
|
|
1079
|
+
agentSession?: ResourcesAgentSessionConfig;
|
|
959
1080
|
/**
|
|
960
1081
|
* The heavy-command provider hook: `rewrite` wraps heavy shell commands in
|
|
961
1082
|
* `cleo run` (in harness sessions that run in `bypassPermissions` or `auto`
|
|
@@ -1063,6 +1184,14 @@ export interface CleoConfig {
|
|
|
1063
1184
|
* @saga T10377
|
|
1064
1185
|
*/
|
|
1065
1186
|
leadRollup?: LeadRollupConfig;
|
|
1187
|
+
/**
|
|
1188
|
+
* Orchestration settings. `orchestrate.leadWorker.v1` gates the lead/worker
|
|
1189
|
+
* split and defaults to `false`.
|
|
1190
|
+
*
|
|
1191
|
+
* @defaultValue { leadWorker: { v1: false } }
|
|
1192
|
+
* @task T14356
|
|
1193
|
+
*/
|
|
1194
|
+
orchestrate?: OrchestrateConfig;
|
|
1066
1195
|
/**
|
|
1067
1196
|
* Code-graph behaviour — inline refresh bounds for stale-index queries.
|
|
1068
1197
|
*
|
|
@@ -1128,7 +1257,7 @@ export interface AuthConfig {
|
|
|
1128
1257
|
* (a) the Claude Code file already existing on disk, or
|
|
1129
1258
|
* (b) `claudeCodeConsentGiven` being `true`.
|
|
1130
1259
|
*
|
|
1131
|
-
* This mirrors the OQ-1 decision in `docs
|
|
1260
|
+
* This mirrors the OQ-1 decision in `cleo docs fetch e-config-auth-unify`:
|
|
1132
1261
|
* cooperative write-back is enabled by default so two CLIs sharing one
|
|
1133
1262
|
* machine stay token-coherent, but CLEO never creates Claude Code's file
|
|
1134
1263
|
* unless the operator has explicitly opted in.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Project worker rules; command declarations remain in project-context.json.
|
|
5
|
+
*
|
|
6
|
+
* @remarks At most 16 single-line instructions, each at most 512 characters;
|
|
7
|
+
* control characters and leading headings are rejected, never rendered.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const policy = projectWorkerPolicySchema.parse({
|
|
11
|
+
* verification: { full: 'ci', local: 'single-file' },
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export const projectWorkerPolicySchema = z
|
|
17
|
+
.object({
|
|
18
|
+
verification: z
|
|
19
|
+
.object({
|
|
20
|
+
full: z.enum(['local', 'ci']),
|
|
21
|
+
local: z.enum(['single-file', 'affected']),
|
|
22
|
+
})
|
|
23
|
+
.strict()
|
|
24
|
+
.optional(),
|
|
25
|
+
instructions: z
|
|
26
|
+
.array(
|
|
27
|
+
z
|
|
28
|
+
.string()
|
|
29
|
+
.min(1)
|
|
30
|
+
.max(512)
|
|
31
|
+
.regex(/\S/)
|
|
32
|
+
.regex(
|
|
33
|
+
/^(?!\s*#)[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,
|
|
34
|
+
'Instructions must be single-line text without control characters or a leading #',
|
|
35
|
+
),
|
|
36
|
+
)
|
|
37
|
+
.max(16)
|
|
38
|
+
.optional(),
|
|
39
|
+
})
|
|
40
|
+
.strict();
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Project-specific spawn rules, subordinate to explicit owner instructions.
|
|
44
|
+
* `verification.full` places build, full tests, lint and typecheck locally or
|
|
45
|
+
* in required CI; `verification.local` scopes checks during iteration.
|
|
46
|
+
* Placement never waives evidence or independent review.
|
|
47
|
+
*
|
|
48
|
+
* @remarks An absent policy preserves existing spawn behavior.
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const policy: ProjectWorkerPolicy = { instructions: ['Follow AGENTS.md'] };
|
|
52
|
+
* ```
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
export type ProjectWorkerPolicy = z.infer<typeof projectWorkerPolicySchema>;
|
package/src/data-accessor.ts
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
import type { ArchivedTask } from './archive.js';
|
|
17
17
|
import type { Session } from './session.js';
|
|
18
|
+
import type { CancellationKind } from './status-registry.js';
|
|
18
19
|
import type {
|
|
19
20
|
Task,
|
|
20
21
|
TaskClaim,
|
|
@@ -144,6 +145,8 @@ export interface TaskFieldUpdates {
|
|
|
144
145
|
completedAt?: string | null;
|
|
145
146
|
cancelledAt?: string | null;
|
|
146
147
|
cancellationReason?: string | null;
|
|
148
|
+
cancellationKind?: CancellationKind | null;
|
|
149
|
+
replacedBy?: string | null;
|
|
147
150
|
verificationJson?: string | null;
|
|
148
151
|
createdBy?: string | null;
|
|
149
152
|
modifiedBy?: string | null;
|
|
@@ -368,6 +371,11 @@ export interface TaskClaimGuard {
|
|
|
368
371
|
now: string;
|
|
369
372
|
/** A session whose live lease `acquire` may take over (spawn hand-off). */
|
|
370
373
|
handoffFrom?: string | null;
|
|
374
|
+
/**
|
|
375
|
+
* The caller's agent (T14269): within one session, a lease recorded for a
|
|
376
|
+
* different named agent is not the caller's own.
|
|
377
|
+
*/
|
|
378
|
+
agentId?: string | null;
|
|
371
379
|
}
|
|
372
380
|
|
|
373
381
|
/**
|
|
@@ -743,6 +751,14 @@ export interface DataAccessor {
|
|
|
743
751
|
*/
|
|
744
752
|
getAcRows(taskId: string): Promise<AcRow[]>;
|
|
745
753
|
|
|
754
|
+
/**
|
|
755
|
+
* Read the AC rows of many tasks in bulk (ordered by task, then ordinal),
|
|
756
|
+
* for whole-store scans such as `cleo doctor --coherence` (T12883). Optional:
|
|
757
|
+
* callers fall back to {@link getAcRows} per task when it is absent.
|
|
758
|
+
* @task T12883
|
|
759
|
+
*/
|
|
760
|
+
getAcRowsForTasks?(taskIds: readonly string[]): Promise<AcRow[]>;
|
|
761
|
+
|
|
746
762
|
/**
|
|
747
763
|
* Read `evidence_ac_bindings` rows whose `ac_id` ∈ the given set.
|
|
748
764
|
* Powers the AC-coverage gate (T10509). Returns the empty array when
|
package/src/dependency.ts
CHANGED
|
@@ -71,6 +71,8 @@ export interface DependencyCheckResult {
|
|
|
71
71
|
error?: string;
|
|
72
72
|
/** Actionable fix suggestion to show the user when `healthy` is `false`. */
|
|
73
73
|
suggestedFix?: string;
|
|
74
|
+
/** A caveat on a healthy result, e.g. a version that could not be checked (T14166). */
|
|
75
|
+
note?: string;
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
/**
|
|
@@ -227,12 +227,6 @@ describe('operation envelope registry snapshots (T10615)', () => {
|
|
|
227
227
|
"required": false,
|
|
228
228
|
"type": "boolean",
|
|
229
229
|
},
|
|
230
|
-
{
|
|
231
|
-
"cli": undefined,
|
|
232
|
-
"name": "ivtr-history",
|
|
233
|
-
"required": false,
|
|
234
|
-
"type": "boolean",
|
|
235
|
-
},
|
|
236
230
|
{
|
|
237
231
|
"cli": undefined,
|
|
238
232
|
"name": "relations",
|
package/src/dispatch/identity.ts
CHANGED
|
@@ -52,13 +52,8 @@ export type Tier = 0 | 1 | 2;
|
|
|
52
52
|
/**
|
|
53
53
|
* The closed set of dispatch canonical-domain names.
|
|
54
54
|
*
|
|
55
|
-
* T964
|
|
56
|
-
*
|
|
57
|
-
* ORCHESTRATE (wave planning + spawn-prompt generation). The original
|
|
58
|
-
* "exactly 10 canonical domains" invariant that justified folding CONDUIT
|
|
59
|
-
* under ORCHESTRATE has been broken multiple times (intelligence, diagnostics,
|
|
60
|
-
* docs, playbook); promoting CONDUIT aligns registry with wire-format, CLI,
|
|
61
|
-
* and core module structure at zero behavior cost.
|
|
55
|
+
* T964 promoted `conduit` to a domain; T13955 removed it (messaging moved to
|
|
56
|
+
* AgentMBX).
|
|
62
57
|
*
|
|
63
58
|
* T1726: `sentient` and `release` promoted to first-class domains. Both were
|
|
64
59
|
* reachable via the CLI and had registered DomainHandlers but were absent from
|
|
@@ -83,7 +78,6 @@ export const CANONICAL_DOMAINS = [
|
|
|
83
78
|
'diagnostics',
|
|
84
79
|
'docs',
|
|
85
80
|
'playbook',
|
|
86
|
-
'conduit',
|
|
87
81
|
'sentient',
|
|
88
82
|
'release',
|
|
89
83
|
'llm',
|