@cleocode/contracts 2026.5.129 → 2026.5.131
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/__tests__/atomic-tools-contract.test.d.ts +14 -0
- package/dist/__tests__/atomic-tools-contract.test.d.ts.map +1 -0
- package/dist/__tests__/atomic-tools-contract.test.js +55 -0
- package/dist/__tests__/atomic-tools-contract.test.js.map +1 -0
- package/dist/__tests__/gateway-contract.test.d.ts +18 -0
- package/dist/__tests__/gateway-contract.test.d.ts.map +1 -0
- package/dist/__tests__/gateway-contract.test.js +187 -0
- package/dist/__tests__/gateway-contract.test.js.map +1 -0
- package/dist/__tests__/mvi.test.d.ts +17 -0
- package/dist/__tests__/mvi.test.d.ts.map +1 -0
- package/dist/__tests__/mvi.test.js +147 -0
- package/dist/__tests__/mvi.test.js.map +1 -0
- package/dist/__tests__/operation-def.test.js +1 -1
- package/dist/__tests__/operation-def.test.js.map +1 -1
- package/dist/boundary.d.ts +26 -0
- package/dist/boundary.d.ts.map +1 -1
- package/dist/boundary.js +42 -4
- package/dist/boundary.js.map +1 -1
- package/dist/branch-lock.d.ts +35 -1
- package/dist/branch-lock.d.ts.map +1 -1
- package/dist/branch-lock.js +23 -2
- package/dist/branch-lock.js.map +1 -1
- package/dist/daemon/__tests__/health-roundtrip.test.d.ts +13 -0
- package/dist/daemon/__tests__/health-roundtrip.test.d.ts.map +1 -0
- package/dist/daemon/__tests__/health-roundtrip.test.js +69 -0
- package/dist/daemon/__tests__/health-roundtrip.test.js.map +1 -0
- package/dist/daemon/health.d.ts +108 -0
- package/dist/daemon/health.d.ts.map +1 -0
- package/dist/daemon/health.js +95 -0
- package/dist/daemon/health.js.map +1 -0
- package/dist/daemon/index.d.ts +24 -0
- package/dist/daemon/index.d.ts.map +1 -0
- package/dist/daemon/index.js +22 -0
- package/dist/daemon/index.js.map +1 -0
- package/dist/daemon/subsystem.d.ts +121 -0
- package/dist/daemon/subsystem.d.ts.map +1 -0
- package/dist/daemon/subsystem.js +28 -0
- package/dist/daemon/subsystem.js.map +1 -0
- package/dist/daemon-ipc/__tests__/daemon-ipc-freeze.test.d.ts +15 -0
- package/dist/daemon-ipc/__tests__/daemon-ipc-freeze.test.d.ts.map +1 -0
- package/dist/daemon-ipc/__tests__/daemon-ipc-freeze.test.js +40 -0
- package/dist/daemon-ipc/__tests__/daemon-ipc-freeze.test.js.map +1 -0
- package/dist/daemon-ipc/index.d.ts +44 -0
- package/dist/daemon-ipc/index.d.ts.map +1 -0
- package/dist/daemon-ipc/index.js +43 -0
- package/dist/daemon-ipc/index.js.map +1 -0
- package/dist/db-inventory.json +8 -8
- package/dist/dispatch/identity.d.ts +1 -1
- package/dist/dispatch/identity.d.ts.map +1 -1
- package/dist/dispatch/identity.js +3 -0
- package/dist/dispatch/identity.js.map +1 -1
- package/dist/dispatch/operation-def.d.ts +16 -0
- package/dist/dispatch/operation-def.d.ts.map +1 -1
- package/dist/dispatch/operations-registry.d.ts.map +1 -1
- package/dist/dispatch/operations-registry.js +133 -0
- package/dist/dispatch/operations-registry.js.map +1 -1
- package/dist/exit-codes.d.ts +1 -1
- package/dist/exit-codes.js +1 -1
- package/dist/gateway/rpc/__tests__/freeze.test.d.ts +20 -0
- package/dist/gateway/rpc/__tests__/freeze.test.d.ts.map +1 -0
- package/dist/gateway/rpc/__tests__/freeze.test.js +122 -0
- package/dist/gateway/rpc/__tests__/freeze.test.js.map +1 -0
- package/dist/gateway/rpc/index.d.ts +23 -0
- package/dist/gateway/rpc/index.d.ts.map +1 -0
- package/dist/gateway/rpc/index.js +22 -0
- package/dist/gateway/rpc/index.js.map +1 -0
- package/dist/gateway/rpc/messages.d.ts +263 -0
- package/dist/gateway/rpc/messages.d.ts.map +1 -0
- package/dist/gateway/rpc/messages.js +152 -0
- package/dist/gateway/rpc/messages.js.map +1 -0
- package/dist/gateway/rpc/version.d.ts +39 -0
- package/dist/gateway/rpc/version.d.ts.map +1 -0
- package/dist/gateway/rpc/version.js +39 -0
- package/dist/gateway/rpc/version.js.map +1 -0
- package/dist/gateway.d.ts +239 -0
- package/dist/gateway.d.ts.map +1 -0
- package/dist/gateway.js +171 -0
- package/dist/gateway.js.map +1 -0
- package/dist/goal.d.ts +314 -0
- package/dist/goal.d.ts.map +1 -0
- package/dist/goal.js +118 -0
- package/dist/goal.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/mvi.d.ts +209 -0
- package/dist/mvi.d.ts.map +1 -0
- package/dist/mvi.js +99 -0
- package/dist/mvi.js.map +1 -0
- package/dist/operations/attention.d.ts +114 -0
- package/dist/operations/attention.d.ts.map +1 -0
- package/dist/operations/attention.js +22 -0
- package/dist/operations/attention.js.map +1 -0
- package/dist/operations/docs.d.ts +7 -1
- package/dist/operations/docs.d.ts.map +1 -1
- package/dist/operations/docs.js.map +1 -1
- package/dist/operations/focus.d.ts +25 -0
- package/dist/operations/focus.d.ts.map +1 -1
- package/dist/operations/index.d.ts +1 -0
- package/dist/operations/index.d.ts.map +1 -1
- package/dist/operations/index.js +1 -0
- package/dist/operations/index.js.map +1 -1
- package/dist/operations/session.d.ts +11 -0
- package/dist/operations/session.d.ts.map +1 -1
- package/dist/sdk-tool.d.ts +1 -1
- package/dist/sdk-tool.js +1 -1
- package/dist/supervisor-ipc/__tests__/freeze.test.d.ts +15 -0
- package/dist/supervisor-ipc/__tests__/freeze.test.d.ts.map +1 -0
- package/dist/supervisor-ipc/__tests__/freeze.test.js +159 -0
- package/dist/supervisor-ipc/__tests__/freeze.test.js.map +1 -0
- package/dist/supervisor-ipc/index.d.ts +15 -0
- package/dist/supervisor-ipc/index.d.ts.map +1 -0
- package/dist/supervisor-ipc/index.js +14 -0
- package/dist/supervisor-ipc/index.js.map +1 -0
- package/dist/supervisor-ipc/messages.d.ts +457 -0
- package/dist/supervisor-ipc/messages.d.ts.map +1 -0
- package/dist/supervisor-ipc/messages.js +312 -0
- package/dist/supervisor-ipc/messages.js.map +1 -0
- package/dist/supervisor-ipc/version.d.ts +29 -0
- package/dist/supervisor-ipc/version.d.ts.map +1 -0
- package/dist/supervisor-ipc/version.js +29 -0
- package/dist/supervisor-ipc/version.js.map +1 -0
- package/dist/tools/__tests__/composite.test.d.ts +14 -0
- package/dist/tools/__tests__/composite.test.d.ts.map +1 -0
- package/dist/tools/__tests__/composite.test.js +75 -0
- package/dist/tools/__tests__/composite.test.js.map +1 -0
- package/dist/tools/atomic.d.ts +195 -0
- package/dist/tools/atomic.d.ts.map +1 -0
- package/dist/tools/atomic.js +82 -0
- package/dist/tools/atomic.js.map +1 -0
- package/dist/tools/composite.d.ts +128 -0
- package/dist/tools/composite.d.ts.map +1 -0
- package/dist/tools/composite.js +88 -0
- package/dist/tools/composite.js.map +1 -0
- package/package.json +35 -3
- package/src/__tests__/__snapshots__/operations-registry.test.ts.snap +1 -1
- package/src/__tests__/atomic-tools-contract.test.ts +67 -0
- package/src/__tests__/gateway-contract.test.ts +219 -0
- package/src/__tests__/mvi.test.ts +175 -0
- package/src/__tests__/operation-def.test.ts +2 -1
- package/src/boundary.ts +74 -4
- package/src/branch-lock.ts +49 -2
- package/src/daemon/__tests__/health-roundtrip.test.ts +84 -0
- package/src/daemon/health.ts +121 -0
- package/src/daemon/index.ts +35 -0
- package/src/daemon/subsystem.ts +126 -0
- package/src/daemon-ipc/__tests__/daemon-ipc-freeze.test.ts +53 -0
- package/src/daemon-ipc/index.ts +90 -0
- package/src/db-inventory.json +8 -8
- package/src/dispatch/identity.ts +3 -0
- package/src/dispatch/operation-def.ts +16 -0
- package/src/dispatch/operations-registry.ts +140 -0
- package/src/exit-codes.ts +1 -1
- package/src/gateway/rpc/__tests__/freeze.test.ts +139 -0
- package/src/gateway/rpc/index.ts +43 -0
- package/src/gateway/rpc/messages.ts +187 -0
- package/src/gateway/rpc/version.ts +40 -0
- package/src/gateway.ts +252 -0
- package/src/goal.ts +348 -0
- package/src/index.ts +109 -0
- package/src/mvi.ts +236 -0
- package/src/operations/attention.ts +117 -0
- package/src/operations/docs.ts +7 -1
- package/src/operations/focus.ts +26 -0
- package/src/operations/index.ts +1 -0
- package/src/operations/session.ts +11 -0
- package/src/sdk-tool.ts +1 -1
- package/src/supervisor-ipc/__tests__/freeze.test.ts +180 -0
- package/src/supervisor-ipc/index.ts +62 -0
- package/src/supervisor-ipc/messages.ts +396 -0
- package/src/supervisor-ipc/version.ts +30 -0
- package/src/tools/__tests__/composite.test.ts +88 -0
- package/src/tools/atomic.ts +274 -0
- package/src/tools/composite.ts +173 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract tests for the atomic-tool primitive contracts
|
|
3
|
+
* (`@cleocode/contracts/tools/atomic`, E3 · T11403).
|
|
4
|
+
*
|
|
5
|
+
* Pins the canonical tool taxonomy + primitive registry so the CORE SDK
|
|
6
|
+
* implementations (T11405-T11407) and the MCP catalog (T11411) bind to a stable
|
|
7
|
+
* shape.
|
|
8
|
+
*
|
|
9
|
+
* @epic T11390
|
|
10
|
+
* @task T11403
|
|
11
|
+
* @saga T11387
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=atomic-tools-contract.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atomic-tools-contract.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/atomic-tools-contract.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract tests for the atomic-tool primitive contracts
|
|
3
|
+
* (`@cleocode/contracts/tools/atomic`, E3 · T11403).
|
|
4
|
+
*
|
|
5
|
+
* Pins the canonical tool taxonomy + primitive registry so the CORE SDK
|
|
6
|
+
* implementations (T11405-T11407) and the MCP catalog (T11411) bind to a stable
|
|
7
|
+
* shape.
|
|
8
|
+
*
|
|
9
|
+
* @epic T11390
|
|
10
|
+
* @task T11403
|
|
11
|
+
* @saga T11387
|
|
12
|
+
*/
|
|
13
|
+
import { describe, expect, it } from 'vitest';
|
|
14
|
+
import { ATOMIC_TOOL_PRIMITIVES, TOOL_CLASSES, } from '../tools/atomic.js';
|
|
15
|
+
describe('atomic-tool taxonomy', () => {
|
|
16
|
+
it('declares exactly the five canonical tool classes', () => {
|
|
17
|
+
expect([...TOOL_CLASSES]).toEqual(['fs', 'shell', 'search', 'net', 'notebook']);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
describe('atomic-tool primitive registry', () => {
|
|
21
|
+
it('every primitive has a class in the taxonomy and is stateless', () => {
|
|
22
|
+
const classes = new Set(TOOL_CLASSES);
|
|
23
|
+
for (const p of ATOMIC_TOOL_PRIMITIVES) {
|
|
24
|
+
expect(classes.has(p.class)).toBe(true);
|
|
25
|
+
expect(p.stateless).toBe(true);
|
|
26
|
+
expect(p.name.length).toBeGreaterThan(0);
|
|
27
|
+
expect(p.responsibility.length).toBeGreaterThan(0);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
it('primitive names are unique', () => {
|
|
31
|
+
const names = ATOMIC_TOOL_PRIMITIVES.map((p) => p.name);
|
|
32
|
+
expect(new Set(names).size).toBe(names.length);
|
|
33
|
+
});
|
|
34
|
+
it('covers each class with at least one primitive', () => {
|
|
35
|
+
const covered = new Set(ATOMIC_TOOL_PRIMITIVES.map((p) => p.class));
|
|
36
|
+
for (const c of TOOL_CLASSES) {
|
|
37
|
+
expect(covered.has(c)).toBe(true);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
it('includes the canonical fs + shell primitives', () => {
|
|
41
|
+
const names = new Set(ATOMIC_TOOL_PRIMITIVES.map((p) => p.name));
|
|
42
|
+
for (const n of ['readFileText', 'writeFileAtomic', 'executeShell', 'runGit']) {
|
|
43
|
+
expect(names.has(n)).toBe(true);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
describe('atomic-tool I/O contracts (type-level)', () => {
|
|
48
|
+
it('a ReadFile round-trip is well-typed', () => {
|
|
49
|
+
const input = { path: '/abs/file.ts' };
|
|
50
|
+
const result = { path: input.path, content: 'hello' };
|
|
51
|
+
expect(result.path).toBe('/abs/file.ts');
|
|
52
|
+
expect(result.content).toBe('hello');
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=atomic-tools-contract.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atomic-tools-contract.test.js","sourceRoot":"","sources":["../../src/__tests__/atomic-tools-contract.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,sBAAsB,EAGtB,YAAY,GAEb,MAAM,oBAAoB,CAAC;AAE5B,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAC1D,MAAM,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;IAClF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,gCAAgC,EAAE,GAAG,EAAE;IAC9C,EAAE,CAAC,8DAA8D,EAAE,GAAG,EAAE;QACtE,MAAM,OAAO,GAAG,IAAI,GAAG,CAAY,YAAY,CAAC,CAAC;QACjD,KAAK,MAAM,CAAC,IAAI,sBAAsB,EAAE,CAAC;YACvC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACxC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CA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CAAC,IAAI,CAAC,CAAC;QAClC,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,wCAAwC,EAAE,GAAG,EAAE;IACtD,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC7C,MAAM,KAAK,GAAkB,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;QACtD,MAAM,MAAM,GAAmB,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;QACtE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACzC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract snapshot + validation tests for the promoted gateway contract
|
|
3
|
+
* (`@cleocode/contracts/gateway`).
|
|
4
|
+
*
|
|
5
|
+
* The gateway contract is the transport-agnostic CQRS dispatch shape that every
|
|
6
|
+
* adapter (CLI, MCP, RPC, HTTP) shares. These tests pin:
|
|
7
|
+
* - the frozen contract version + the four canonical transport sources,
|
|
8
|
+
* - the zod schemas' accepted/rejected inputs at the (untrusted) transport
|
|
9
|
+
* boundary (AC8 — the reason the contract is zod-typed),
|
|
10
|
+
* - the public field shape of each schema as a snapshot, so an accidental
|
|
11
|
+
* add/remove/rename of a request/response field fails loudly.
|
|
12
|
+
*
|
|
13
|
+
* @epic T4820
|
|
14
|
+
* @task T11446
|
|
15
|
+
* @saga T11243
|
|
16
|
+
*/
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=gateway-contract.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateway-contract.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/gateway-contract.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract snapshot + validation tests for the promoted gateway contract
|
|
3
|
+
* (`@cleocode/contracts/gateway`).
|
|
4
|
+
*
|
|
5
|
+
* The gateway contract is the transport-agnostic CQRS dispatch shape that every
|
|
6
|
+
* adapter (CLI, MCP, RPC, HTTP) shares. These tests pin:
|
|
7
|
+
* - the frozen contract version + the four canonical transport sources,
|
|
8
|
+
* - the zod schemas' accepted/rejected inputs at the (untrusted) transport
|
|
9
|
+
* boundary (AC8 — the reason the contract is zod-typed),
|
|
10
|
+
* - the public field shape of each schema as a snapshot, so an accidental
|
|
11
|
+
* add/remove/rename of a request/response field fails loudly.
|
|
12
|
+
*
|
|
13
|
+
* @epic T4820
|
|
14
|
+
* @task T11446
|
|
15
|
+
* @saga T11243
|
|
16
|
+
*/
|
|
17
|
+
import { describe, expect, it } from 'vitest';
|
|
18
|
+
import { dispatchErrorSchema, dispatchRequestSchema, dispatchResponseMetaSchema, dispatchResponseSchema, GATEWAY_CONTRACT_VERSION, GATEWAY_SOURCES, gatewaySourceSchema, gatewayStreamEventSchema, } from '../gateway.js';
|
|
19
|
+
describe('gateway contract — version + sources', () => {
|
|
20
|
+
it('pins the frozen contract version', () => {
|
|
21
|
+
expect(GATEWAY_CONTRACT_VERSION).toBe('1.0.0');
|
|
22
|
+
});
|
|
23
|
+
it('declares exactly the four canonical transports', () => {
|
|
24
|
+
expect([...GATEWAY_SOURCES]).toEqual(['cli', 'mcp', 'rpc', 'http']);
|
|
25
|
+
});
|
|
26
|
+
it('accepts every canonical transport and rejects unknown ones', () => {
|
|
27
|
+
for (const s of GATEWAY_SOURCES) {
|
|
28
|
+
expect(gatewaySourceSchema.safeParse(s).success).toBe(true);
|
|
29
|
+
}
|
|
30
|
+
expect(gatewaySourceSchema.safeParse('telepathy').success).toBe(false);
|
|
31
|
+
expect(gatewaySourceSchema.safeParse('dispatch').success).toBe(false);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
describe('gateway contract — request validation (transport boundary)', () => {
|
|
35
|
+
const minimal = {
|
|
36
|
+
gateway: 'query',
|
|
37
|
+
domain: 'tasks',
|
|
38
|
+
operation: 'list',
|
|
39
|
+
source: 'mcp',
|
|
40
|
+
requestId: 'req_1',
|
|
41
|
+
};
|
|
42
|
+
it('validates a minimal well-formed request', () => {
|
|
43
|
+
expect(dispatchRequestSchema.safeParse(minimal).success).toBe(true);
|
|
44
|
+
});
|
|
45
|
+
it('validates a fully-populated request', () => {
|
|
46
|
+
const full = {
|
|
47
|
+
...minimal,
|
|
48
|
+
params: { parent: 'T1' },
|
|
49
|
+
sessionId: 'ses_1',
|
|
50
|
+
originSessionId: 'ses_0',
|
|
51
|
+
executionSessionId: 'exe_1',
|
|
52
|
+
_fields: ['/data/id'],
|
|
53
|
+
_mvi: 'standard',
|
|
54
|
+
};
|
|
55
|
+
expect(dispatchRequestSchema.safeParse(full).success).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
it('rejects a request missing required fields', () => {
|
|
58
|
+
expect(dispatchRequestSchema.safeParse({ domain: 'tasks' }).success).toBe(false);
|
|
59
|
+
});
|
|
60
|
+
it('rejects an out-of-range _mvi level', () => {
|
|
61
|
+
expect(dispatchRequestSchema.safeParse({ ...minimal, _mvi: 'verbose' }).success).toBe(false);
|
|
62
|
+
});
|
|
63
|
+
it('rejects an unknown transport source', () => {
|
|
64
|
+
expect(dispatchRequestSchema.safeParse({ ...minimal, source: 'ftp' }).success).toBe(false);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
describe('gateway contract — response + error + stream shapes', () => {
|
|
68
|
+
it('validates a success response (meta passthrough preserved)', () => {
|
|
69
|
+
const res = {
|
|
70
|
+
meta: {
|
|
71
|
+
gateway: 'query',
|
|
72
|
+
domain: 'tasks',
|
|
73
|
+
operation: 'list',
|
|
74
|
+
timestamp: '2026-05-30T00:00:00.000Z',
|
|
75
|
+
duration_ms: 1,
|
|
76
|
+
source: 'cli',
|
|
77
|
+
requestId: 'req_1',
|
|
78
|
+
// extensible metadata via catchall:
|
|
79
|
+
gateInfo: { passed: true },
|
|
80
|
+
},
|
|
81
|
+
success: true,
|
|
82
|
+
data: { tasks: [] },
|
|
83
|
+
};
|
|
84
|
+
expect(dispatchResponseSchema.safeParse(res).success).toBe(true);
|
|
85
|
+
});
|
|
86
|
+
it('validates a structured error', () => {
|
|
87
|
+
const err = {
|
|
88
|
+
code: 'E_NOT_FOUND',
|
|
89
|
+
message: 'no such task',
|
|
90
|
+
exitCode: 4,
|
|
91
|
+
alternatives: [{ action: 'search', command: 'cleo find' }],
|
|
92
|
+
};
|
|
93
|
+
expect(dispatchErrorSchema.safeParse(err).success).toBe(true);
|
|
94
|
+
});
|
|
95
|
+
it('validates a stream event', () => {
|
|
96
|
+
expect(gatewayStreamEventSchema.safeParse({ kind: 'data', seq: 0, data: {}, requestId: 'req_1' })
|
|
97
|
+
.success).toBe(true);
|
|
98
|
+
expect(gatewayStreamEventSchema.safeParse({ kind: 'flush', seq: 0, requestId: 'r' }).success).toBe(false);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
describe('gateway contract — field-shape snapshot (drift guard)', () => {
|
|
102
|
+
it('request fields are stable', () => {
|
|
103
|
+
expect(Object.keys(dispatchRequestSchema.shape).sort()).toMatchInlineSnapshot(`
|
|
104
|
+
[
|
|
105
|
+
"_fields",
|
|
106
|
+
"_mvi",
|
|
107
|
+
"domain",
|
|
108
|
+
"executionSessionId",
|
|
109
|
+
"gateway",
|
|
110
|
+
"operation",
|
|
111
|
+
"originSessionId",
|
|
112
|
+
"params",
|
|
113
|
+
"requestId",
|
|
114
|
+
"sessionId",
|
|
115
|
+
"source",
|
|
116
|
+
]
|
|
117
|
+
`);
|
|
118
|
+
});
|
|
119
|
+
it('response fields are stable', () => {
|
|
120
|
+
expect(Object.keys(dispatchResponseSchema.shape).sort()).toMatchInlineSnapshot(`
|
|
121
|
+
[
|
|
122
|
+
"data",
|
|
123
|
+
"error",
|
|
124
|
+
"meta",
|
|
125
|
+
"page",
|
|
126
|
+
"partial",
|
|
127
|
+
"success",
|
|
128
|
+
]
|
|
129
|
+
`);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
// ─── gateway-contract v1.0 FREEZE (R3-T8 · T11452) ──────────────────────────
|
|
133
|
+
// Locks the COMPLETE v1.0 contract surface (version + 4 transports + every
|
|
134
|
+
// frozen shape's field set). Any change here is a breaking contract change and
|
|
135
|
+
// REQUIRES a GATEWAY_CONTRACT_VERSION bump — mirrors the supervisor-ipc v1.0
|
|
136
|
+
// freeze. The spec doc (slug `gateway-contract-v1`) is the human-readable SoT.
|
|
137
|
+
describe('gateway-contract v1.0 FREEZE', () => {
|
|
138
|
+
it('version is pinned at 1.0.0', () => {
|
|
139
|
+
expect(GATEWAY_CONTRACT_VERSION).toBe('1.0.0');
|
|
140
|
+
});
|
|
141
|
+
it('the four transports are frozen', () => {
|
|
142
|
+
expect([...GATEWAY_SOURCES]).toEqual(['cli', 'mcp', 'rpc', 'http']);
|
|
143
|
+
});
|
|
144
|
+
it('error fields are frozen', () => {
|
|
145
|
+
expect(Object.keys(dispatchErrorSchema.shape).sort()).toMatchInlineSnapshot(`
|
|
146
|
+
[
|
|
147
|
+
"alternatives",
|
|
148
|
+
"code",
|
|
149
|
+
"details",
|
|
150
|
+
"exitCode",
|
|
151
|
+
"fix",
|
|
152
|
+
"message",
|
|
153
|
+
"problemDetails",
|
|
154
|
+
]
|
|
155
|
+
`);
|
|
156
|
+
});
|
|
157
|
+
it('response meta fields are frozen (catchall preserves extensibility)', () => {
|
|
158
|
+
expect(Object.keys(dispatchResponseMetaSchema.shape).sort()).toMatchInlineSnapshot(`
|
|
159
|
+
[
|
|
160
|
+
"domain",
|
|
161
|
+
"duration_ms",
|
|
162
|
+
"executionSessionId",
|
|
163
|
+
"gateway",
|
|
164
|
+
"operation",
|
|
165
|
+
"originSessionId",
|
|
166
|
+
"rateLimit",
|
|
167
|
+
"requestId",
|
|
168
|
+
"sessionId",
|
|
169
|
+
"source",
|
|
170
|
+
"timestamp",
|
|
171
|
+
"version",
|
|
172
|
+
]
|
|
173
|
+
`);
|
|
174
|
+
});
|
|
175
|
+
it('stream-event fields are frozen', () => {
|
|
176
|
+
expect(Object.keys(gatewayStreamEventSchema.shape).sort()).toMatchInlineSnapshot(`
|
|
177
|
+
[
|
|
178
|
+
"data",
|
|
179
|
+
"error",
|
|
180
|
+
"kind",
|
|
181
|
+
"requestId",
|
|
182
|
+
"seq",
|
|
183
|
+
]
|
|
184
|
+
`);
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
//# sourceMappingURL=gateway-contract.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateway-contract.test.js","sourceRoot":"","sources":["../../src/__tests__/gateway-contract.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,eAAe,EACf,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,eAAe,CAAC;AAEvB,QAAQ,CAAC,sCAAsC,EAAE,GAAG,EAAE;IACpD,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,CAAC,wBAAwB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACxD,MAAM,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,EA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C;;;;;;;;KAQhF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-shape + runtime contract test for the MVI progressive-disclosure
|
|
3
|
+
* primitive {@link MviDigest} (T11349 · Epic T11285 · Saga T11283).
|
|
4
|
+
*
|
|
5
|
+
* Asserts that the single `MviDigest<T>` shape unifies CLEO's three historical
|
|
6
|
+
* expansion-hint conventions (`_next`, `meta.suggestedNext`,
|
|
7
|
+
* `_nexus.suggestedNext`) and that each legacy producer can emit — and any
|
|
8
|
+
* consumer can read — a digest *without any `any` casts*. The `expectTypeOf`
|
|
9
|
+
* assertions are the tsd-style proof: if the discriminated union ever widens
|
|
10
|
+
* to `any`/`unknown` or loses a variant, these fail at type-check time.
|
|
11
|
+
*
|
|
12
|
+
* @epic T11285
|
|
13
|
+
* @task T11349
|
|
14
|
+
* @saga T11283
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=mvi.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mvi.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/mvi.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-shape + runtime contract test for the MVI progressive-disclosure
|
|
3
|
+
* primitive {@link MviDigest} (T11349 · Epic T11285 · Saga T11283).
|
|
4
|
+
*
|
|
5
|
+
* Asserts that the single `MviDigest<T>` shape unifies CLEO's three historical
|
|
6
|
+
* expansion-hint conventions (`_next`, `meta.suggestedNext`,
|
|
7
|
+
* `_nexus.suggestedNext`) and that each legacy producer can emit — and any
|
|
8
|
+
* consumer can read — a digest *without any `any` casts*. The `expectTypeOf`
|
|
9
|
+
* assertions are the tsd-style proof: if the discriminated union ever widens
|
|
10
|
+
* to `any`/`unknown` or loses a variant, these fail at type-check time.
|
|
11
|
+
*
|
|
12
|
+
* @epic T11285
|
|
13
|
+
* @task T11349
|
|
14
|
+
* @saga T11283
|
|
15
|
+
*/
|
|
16
|
+
import { describe, expect, expectTypeOf, it } from 'vitest';
|
|
17
|
+
import { expansionFromNextDirectives, expansionFromStructuredOps, expansionFromSuggestedCommands, isNextDirectivesHint, isStructuredOpsHint, isSuggestedCommandsHint, } from '../mvi.js';
|
|
18
|
+
describe('MviDigest<T> shape (T11349)', () => {
|
|
19
|
+
it('has the canonical {summary, count, preview?, expand} fields', () => {
|
|
20
|
+
const digest = {
|
|
21
|
+
summary: '12 child tasks (3 done, 9 pending)',
|
|
22
|
+
count: 12,
|
|
23
|
+
preview: [{ id: 'T1' }, { id: 'T2' }],
|
|
24
|
+
expand: { kind: 'next-directives', directives: { all: 'cleo list --parent T0' } },
|
|
25
|
+
};
|
|
26
|
+
expect(digest.count).toBe(12);
|
|
27
|
+
expect(digest.preview).toHaveLength(2);
|
|
28
|
+
expect(digest.summary).toContain('child tasks');
|
|
29
|
+
});
|
|
30
|
+
it('preview is optional — a digest can describe an unsampled collection', () => {
|
|
31
|
+
const digest = {
|
|
32
|
+
summary: '40 memory entries',
|
|
33
|
+
count: 40,
|
|
34
|
+
expand: { kind: 'suggested-commands', commands: ['cleo memory find "x"'] },
|
|
35
|
+
};
|
|
36
|
+
expect(digest.preview).toBeUndefined();
|
|
37
|
+
});
|
|
38
|
+
it('summary/count/expand are required; preview is the only optional field', () => {
|
|
39
|
+
expectTypeOf().toHaveProperty('summary');
|
|
40
|
+
expectTypeOf().toHaveProperty('count');
|
|
41
|
+
expectTypeOf().toHaveProperty('expand');
|
|
42
|
+
expectTypeOf().toEqualTypeOf();
|
|
43
|
+
expectTypeOf().toEqualTypeOf();
|
|
44
|
+
expectTypeOf().toEqualTypeOf();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
describe('ExpansionHint unifies the 3 legacy conventions (T11349)', () => {
|
|
48
|
+
it('reconciles `_next` (NextDirectives — Record<string,string>) without a cast', () => {
|
|
49
|
+
// The exact shape produced by core/src/mvi-helpers.ts taskShowNext().
|
|
50
|
+
const legacyNext = {
|
|
51
|
+
full: 'cleo show T042 --mvi full',
|
|
52
|
+
children: 'cleo find --parent T042',
|
|
53
|
+
deps: 'cleo deps T042',
|
|
54
|
+
};
|
|
55
|
+
const hint = expansionFromNextDirectives(legacyNext);
|
|
56
|
+
expectTypeOf(hint).toEqualTypeOf();
|
|
57
|
+
expect(hint.kind).toBe('next-directives');
|
|
58
|
+
expect(hint.directives.full).toBe('cleo show T042 --mvi full');
|
|
59
|
+
});
|
|
60
|
+
it('reconciles `meta.suggestedNext` (ReadonlyArray<string>) without a cast', () => {
|
|
61
|
+
// The exact shape produced by core/src/dispatch/suggested-next.ts builders.
|
|
62
|
+
const legacySuggested = ['cleo show T1', 'cleo focus T1'];
|
|
63
|
+
const hint = expansionFromSuggestedCommands(legacySuggested);
|
|
64
|
+
expectTypeOf(hint).toEqualTypeOf();
|
|
65
|
+
expect(hint.kind).toBe('suggested-commands');
|
|
66
|
+
expect(hint.commands).toEqual(['cleo show T1', 'cleo focus T1']);
|
|
67
|
+
});
|
|
68
|
+
it('reconciles `_nexus.suggestedNext` (ReadonlyArray<SuggestedNextOp>) without a cast', () => {
|
|
69
|
+
// The exact shape from contracts/operations/nexus-scope.ts NexusScopeMeta.
|
|
70
|
+
const legacyNexus = [
|
|
71
|
+
{
|
|
72
|
+
op: 'nexus.context',
|
|
73
|
+
args: { name: 'validateUser' },
|
|
74
|
+
scope: 'project',
|
|
75
|
+
effect: 'read',
|
|
76
|
+
requiresConfirmation: false,
|
|
77
|
+
reason: 'inspect callers before editing',
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
const hint = expansionFromStructuredOps(legacyNexus);
|
|
81
|
+
expectTypeOf(hint).toEqualTypeOf();
|
|
82
|
+
expect(hint.kind).toBe('structured-ops');
|
|
83
|
+
expect(hint.ops[0]?.op).toBe('nexus.context');
|
|
84
|
+
});
|
|
85
|
+
it('is a discriminated union — `kind` narrows to each variant', () => {
|
|
86
|
+
const hints = [
|
|
87
|
+
expansionFromNextDirectives({ all: 'cleo list' }),
|
|
88
|
+
expansionFromSuggestedCommands(['cleo next']),
|
|
89
|
+
expansionFromStructuredOps([]),
|
|
90
|
+
];
|
|
91
|
+
for (const hint of hints) {
|
|
92
|
+
if (isNextDirectivesHint(hint)) {
|
|
93
|
+
expectTypeOf(hint).toEqualTypeOf();
|
|
94
|
+
expect(typeof hint.directives).toBe('object');
|
|
95
|
+
}
|
|
96
|
+
else if (isSuggestedCommandsHint(hint)) {
|
|
97
|
+
expectTypeOf(hint).toEqualTypeOf();
|
|
98
|
+
expect(Array.isArray(hint.commands)).toBe(true);
|
|
99
|
+
}
|
|
100
|
+
else if (isStructuredOpsHint(hint)) {
|
|
101
|
+
expectTypeOf(hint).toEqualTypeOf();
|
|
102
|
+
expect(Array.isArray(hint.ops)).toBe(true);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
it('the union has exactly three variants and never widens to `any`', () => {
|
|
107
|
+
expectTypeOf().toEqualTypeOf();
|
|
108
|
+
expectTypeOf().toEqualTypeOf();
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
describe('MviDigest carries any legacy hint as its expand field (T11349)', () => {
|
|
112
|
+
it('a tasks-list digest expands via NextDirectives', () => {
|
|
113
|
+
const digest = {
|
|
114
|
+
summary: '3 ready tasks',
|
|
115
|
+
count: 3,
|
|
116
|
+
preview: [{ id: 'T1' }],
|
|
117
|
+
expand: expansionFromNextDirectives({ all: 'cleo orchestrate ready --epic T0' }),
|
|
118
|
+
};
|
|
119
|
+
expect(isNextDirectivesHint(digest.expand)).toBe(true);
|
|
120
|
+
});
|
|
121
|
+
it('a mutate-op digest expands via suggested commands', () => {
|
|
122
|
+
const digest = {
|
|
123
|
+
summary: 'task created',
|
|
124
|
+
count: 1,
|
|
125
|
+
expand: expansionFromSuggestedCommands(['cleo show T9', 'cleo focus T9']),
|
|
126
|
+
};
|
|
127
|
+
expect(isSuggestedCommandsHint(digest.expand)).toBe(true);
|
|
128
|
+
});
|
|
129
|
+
it('a nexus digest expands via structured ops', () => {
|
|
130
|
+
const digest = {
|
|
131
|
+
summary: '5 affected symbols',
|
|
132
|
+
count: 5,
|
|
133
|
+
expand: expansionFromStructuredOps([
|
|
134
|
+
{
|
|
135
|
+
op: 'nexus.impact',
|
|
136
|
+
args: { target: 'x' },
|
|
137
|
+
scope: 'project',
|
|
138
|
+
effect: 'read',
|
|
139
|
+
requiresConfirmation: false,
|
|
140
|
+
reason: 'assess blast radius',
|
|
141
|
+
},
|
|
142
|
+
]),
|
|
143
|
+
};
|
|
144
|
+
expect(isStructuredOpsHint(digest.expand)).toBe(true);
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
//# sourceMappingURL=mvi.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mvi.test.js","sourceRoot":"","sources":["../../src/__tests__/mvi.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAEL,2BAA2B,EAC3B,0BAA0B,EAC1B,8BAA8B,EAC9B,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,GAKxB,MAAM,WAAW,CAAC;AAGnB,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,EAAE,CAAC,6DAA6D,EAAE,GAAG,EAAE;QACrE,MAAM,MAAM,GAA8B;YACxC,OAAO,EAAE,oCAAoC;YAC7C,KAAK,EAAE,EAAE;YACT,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;YACrC,MAAM,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE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,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -32,7 +32,7 @@ describe('dispatch/operation-def contracts', () => {
|
|
|
32
32
|
expect(CANONICAL_DOMAINS.length).toBeGreaterThan(0);
|
|
33
33
|
// T9954 — snapshot the current count so accidental additions/removals
|
|
34
34
|
// trip this test and force an explicit human review.
|
|
35
|
-
expect(CANONICAL_DOMAINS.length).toBe(
|
|
35
|
+
expect(CANONICAL_DOMAINS.length).toBe(23);
|
|
36
36
|
});
|
|
37
37
|
it('CANONICAL_DOMAINS contains the four sentinel newly-promoted domains', () => {
|
|
38
38
|
// Spot-check the canonical surface: T964 conduit, T1726 sentient/release,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-def.test.js","sourceRoot":"","sources":["../../src/__tests__/operation-def.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"operation-def.test.js","sourceRoot":"","sources":["../../src/__tests__/operation-def.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AA6D5D,uEAAuE;AAEvE,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;IAChD,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC9D,MAAM,MAAM,GAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC9C,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;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EAAE,QAAQ;YACnB,GAAG;SACJ,CAAC;QACF,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACjC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,mEAAmE;IACnE,mEAAmE;IACnE,kCAAkC;IAClC,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACxD,MAAM,MAAM,GAMR,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACpB,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/boundary.d.ts
CHANGED
|
@@ -163,4 +163,30 @@ export interface BoundaryEntry {
|
|
|
163
163
|
* @see ADR-078 — Boundary Registry as SSoT for Rust/TS layering
|
|
164
164
|
*/
|
|
165
165
|
export declare const BOUNDARY_REGISTRY: readonly BoundaryEntry[];
|
|
166
|
+
/**
|
|
167
|
+
* The canonical home-and-consumption boundary for the CORE-SDK tool layer.
|
|
168
|
+
*
|
|
169
|
+
* Atomic **tool primitives** (the smallest stateless side-effect units — see
|
|
170
|
+
* `@cleocode/contracts/tools/atomic` + `core/src/tools/*`) and their contracts
|
|
171
|
+
* have exactly the two homes in {@link AtomicToolBoundary.primitiveHomes}.
|
|
172
|
+
* **Composite skills** (multi-step capabilities that COMPOSE primitives) live
|
|
173
|
+
* in {@link AtomicToolBoundary.skillsHome}. The harness/provider packages in
|
|
174
|
+
* {@link AtomicToolBoundary.consumersNoRedefine} CONSUME the primitives via
|
|
175
|
+
* import and MUST NOT redefine them.
|
|
176
|
+
*
|
|
177
|
+
* Enforced (baseline mode) by `scripts/lint-tools-vs-skills-boundary.mjs`.
|
|
178
|
+
*
|
|
179
|
+
* @see ADR-078 — Boundary Registry
|
|
180
|
+
* @task T11409
|
|
181
|
+
*/
|
|
182
|
+
export interface AtomicToolBoundary {
|
|
183
|
+
/** The only packages that may DEFINE atomic-tool primitives + contracts. */
|
|
184
|
+
readonly primitiveHomes: readonly string[];
|
|
185
|
+
/** Composite, multi-step capabilities (compose primitives) live here. */
|
|
186
|
+
readonly skillsHome: string;
|
|
187
|
+
/** Consume primitives via import — MUST NOT redefine them. */
|
|
188
|
+
readonly consumersNoRedefine: readonly string[];
|
|
189
|
+
}
|
|
190
|
+
/** {@inheritDoc AtomicToolBoundary} */
|
|
191
|
+
export declare const ATOMIC_TOOL_BOUNDARY: AtomicToolBoundary;
|
|
166
192
|
//# sourceMappingURL=boundary.d.ts.map
|
package/dist/boundary.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundary.d.ts","sourceRoot":"","sources":["../src/boundary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,cAAc,GACtB,WAAW,GACX,iBAAiB,GACjB,aAAa,GACb,oBAAoB,GACpB,eAAe,GACf,iBAAiB,GACjB,UAAU,GACV,2BAA2B,GAC3B,mBAAmB,GACnB,cAAc,CAAC;AAMnB;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,sFAAsF;IACtF,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU;IACzB,sEAAsE;IACtE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oEAAoE;IACpE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yDAAyD;IACzD,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,oDAAoD;IACpD,aAAa,CAAC,EAAE,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AA6D;IAC7D,MAAM,EAAE,cAAc,CAAC;IACvB,gFAAgF;IAChF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mFAAmF;IACnF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wFAAwF;IACxF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sEAAsE;IACtE,aAAa,EAAE,aAAa,CAAC;IAC7B,6DAA6D;IAC7D,UAAU,EAAE,UAAU,CAAC;IACvB,0DAA0D;IAC1D,YAAY,EAAE,YAAY,CAAC;IAC3B,gHAAgH;IAChH,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,kGAAkG;IAClG,SAAS,EAAE,MAAM,CAAC;IAClB,wGAAwG;IACxG,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAMD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,aAAa,EA4rB5C,CAAC;AAMX;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,kBAAkB;IACjC,4EAA4E;IAC5E,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,yEAAyE;IACzE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,8DAA8D;IAC9D,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;CACjD;AAED,uCAAuC;AACvC,eAAO,MAAM,oBAAoB,EAAE,kBAIlC,CAAC"}
|
package/dist/boundary.js
CHANGED
|
@@ -154,6 +154,23 @@ export const BOUNDARY_REGISTRY = [
|
|
|
154
154
|
amendments: [],
|
|
155
155
|
rationale: 'Conduit serde-types crate (681 LOC) — renamed from conduit-core to cleo-conduit-core (T10185, saga T10180) because conduit-core is squatted on crates.io. Stable contract surface consumed by cant-core, signaldock-protocol, signaldock-core, integration-tests, AND external /mnt/projects/signaldock-core + /mnt/projects/signaldock/backend via git deps. Mirrors @cleocode/contracts/conduit.ts. Forced KEEP+publish=true: deleting breaks production, and signaldock-protocol publish requires it.',
|
|
156
156
|
},
|
|
157
|
+
{
|
|
158
|
+
module: 'cleo-supervisor',
|
|
159
|
+
intent: 'scaffold-pending-consumer',
|
|
160
|
+
rustCore: 'crates/cleo-supervisor',
|
|
161
|
+
canonicalHome: 'cleocode',
|
|
162
|
+
plannedConsumerEta: '2026-06-30',
|
|
163
|
+
perfBudget: {
|
|
164
|
+
startup_max_ms: 200,
|
|
165
|
+
memory_max_mb: 15,
|
|
166
|
+
},
|
|
167
|
+
safetyBudget: {
|
|
168
|
+
panic_unwind: 'forbidden',
|
|
169
|
+
root_escape: 'forbidden',
|
|
170
|
+
},
|
|
171
|
+
amendments: ['adr-078-boundary-registry'],
|
|
172
|
+
rationale: 'Process supervisor bin+lib crate (R1 / T11252, SG-RUNTIME-UNIFICATION T11243): pidfile + tokio::process child spawn/monitor + SIGTERM-grace/SIGCHLD reaping (Unix) / Job Object (Windows) + exponential restart-backoff (30s cap) + tracing-appender log rotation. publish=false; distributed via napi-style Pattern P2 (GitHub Release + checked-in sha256 manifest) + Pattern P1 linux-x64-gnu fallback bundled in @cleocode/core — zero binary OIDC (D14prime). Consumes the frozen supervisor-ipc v1.0 contract (packages/contracts/src/supervisor-ipc); first consumer is R2 @cleocode/runtime/daemon (T11253). Idle-RSS budget 15MB.',
|
|
173
|
+
},
|
|
157
174
|
{
|
|
158
175
|
module: 'integration-tests',
|
|
159
176
|
intent: 'cpu-bound',
|
|
@@ -304,7 +321,7 @@ export const BOUNDARY_REGISTRY = [
|
|
|
304
321
|
root_escape: 'forbidden',
|
|
305
322
|
},
|
|
306
323
|
amendments: ['adr-087-worktree-ffi-topology'],
|
|
307
|
-
rationale: 'napi binding shim (515 LOC) for worktrunk-core, used by packages/core spawn-pipeline tests
|
|
324
|
+
rationale: 'napi binding shim (515 LOC) for worktrunk-core, used by packages/core spawn-pipeline tests and packages/core/src/scaffold/ensure-config.ts. The native .node binaries are bundled into @cleocode/worktree/native (Pattern P1) and fetched from the GitHub Release (Pattern P2); the per-platform packages/worktree-napi-* manifest packages were removed and are NOT published (D14prime / ADR-087, T11398). Internal-only.',
|
|
308
325
|
},
|
|
309
326
|
{
|
|
310
327
|
module: 'worktrunk-core',
|
|
@@ -543,7 +560,7 @@ export const BOUNDARY_REGISTRY = [
|
|
|
543
560
|
network_egress: 'allowed',
|
|
544
561
|
},
|
|
545
562
|
amendments: [],
|
|
546
|
-
rationale: 'External MCP bridge (379 LOC) — 0 in-repo consumers (binary only). MCP SDK is JS-native; TS-only fit.',
|
|
563
|
+
rationale: 'External MCP bridge (379 LOC) — 0 in-repo consumers (binary only); talks to `cleo` via runtime subprocess, not an npm/workspace dep. MCP SDK is JS-native; TS-only fit. REMOVED from the npm publish surface (T11399 / E1 · SG-PACKAGE-ARCH): no published @cleocode/* package depends on it. To be routed through the R3 gateway as a transport adapter rather than published standalone.',
|
|
547
564
|
},
|
|
548
565
|
{
|
|
549
566
|
module: 'nexus',
|
|
@@ -576,6 +593,21 @@ export const BOUNDARY_REGISTRY = [
|
|
|
576
593
|
amendments: ['adr-067-project-root-resolution'],
|
|
577
594
|
rationale: 'XDG paths SSoT (588 LOC) consumed by 9 packages. Upgraded from data-manifest to orchestration-glue (T10295, T11026): the ID-aware resolver surface — resolveProjectByCwd + resolveCanonicalCleoDir — introduces projectId↔path lookup logic with cross-mount canonicalization and strict-mode enforcement. Still TS-only; no Rust port warranted.',
|
|
578
595
|
},
|
|
596
|
+
{
|
|
597
|
+
module: 'utils',
|
|
598
|
+
intent: 'orchestration-glue',
|
|
599
|
+
tsWrapper: 'packages/utils',
|
|
600
|
+
canonicalHome: 'cleocode',
|
|
601
|
+
perfBudget: {
|
|
602
|
+
latency_p50_ms: 5,
|
|
603
|
+
},
|
|
604
|
+
safetyBudget: {
|
|
605
|
+
panic_unwind: 'forbidden',
|
|
606
|
+
root_escape: 'forbidden',
|
|
607
|
+
},
|
|
608
|
+
amendments: [],
|
|
609
|
+
rationale: 'Pure zero-dependency helper leaf (formatBytes, ...) collapsed from duplicated inline copies. Zero cleocode deps; bundled into @cleocode/cleo, never published (E5 / T11392).',
|
|
610
|
+
},
|
|
579
611
|
{
|
|
580
612
|
module: 'playbooks',
|
|
581
613
|
intent: 'orchestration-glue',
|
|
@@ -639,7 +671,7 @@ export const BOUNDARY_REGISTRY = [
|
|
|
639
671
|
network_egress: 'allowed',
|
|
640
672
|
},
|
|
641
673
|
amendments: [],
|
|
642
|
-
rationale: 'SvelteKit frontend (16,636 LOC, d3/three/sigma) — 0 in-repo consumers. SvelteKit + browser code; TS always.',
|
|
674
|
+
rationale: 'SvelteKit frontend (16,636 LOC, d3/three/sigma) — 0 in-repo consumers; it is an application, not a consumed library. SvelteKit + browser code; TS always. REMOVED from the npm publish surface (T11399 / E1 · SG-PACKAGE-ARCH), reversing the 2026-05-05 Issue #102 / PR #103 addition: apps are deployed, not published.',
|
|
643
675
|
},
|
|
644
676
|
{
|
|
645
677
|
module: 'worktree',
|
|
@@ -657,7 +689,13 @@ export const BOUNDARY_REGISTRY = [
|
|
|
657
689
|
fs_writes_outside_root: 'audited',
|
|
658
690
|
},
|
|
659
691
|
amendments: ['adr-087-worktree-ffi-topology', 'adr-078-boundary-registry'],
|
|
660
|
-
rationale: 'Worktree SSoT primitive layer (1,972 LOC) — canonical create/destroy/list/prune/include/copy-on-write bound by @cleocode/paths. Post-PR-#487 the responsibilities are distinct from packages/core/src/worktree/ (SDK-level enrichment). Consumes worktrunk-core via worktree-napi.',
|
|
692
|
+
rationale: 'Worktree SSoT primitive layer (1,972 LOC) — canonical create/destroy/list/prune/include/copy-on-write bound by @cleocode/paths. Post-PR-#487 the responsibilities are distinct from packages/core/src/worktree/ (SDK-level enrichment). Consumes worktrunk-core via the worktree-napi binding, whose native .node binaries are bundled into native/ (Pattern P1) / fetched from the GitHub Release (Pattern P2) — no separate per-platform npm package is published (D14prime / ADR-087, T11398).',
|
|
661
693
|
},
|
|
662
694
|
];
|
|
695
|
+
/** {@inheritDoc AtomicToolBoundary} */
|
|
696
|
+
export const ATOMIC_TOOL_BOUNDARY = {
|
|
697
|
+
primitiveHomes: ['packages/core/src/tools', 'packages/contracts/src/tools'],
|
|
698
|
+
skillsHome: 'packages/skills',
|
|
699
|
+
consumersNoRedefine: ['packages/mcp-adapter', 'packages/caamp', 'packages/cleo-os'],
|
|
700
|
+
};
|
|
663
701
|
//# sourceMappingURL=boundary.js.map
|