@cleocode/contracts 2026.5.130 → 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/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 +34 -2
- 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/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,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Atomic-tool primitive contracts — the canonical I/O shapes for the CORE SDK
|
|
3
|
+
* tool layer (E3 · T11403 · SG-PACKAGE-ARCH).
|
|
4
|
+
*
|
|
5
|
+
* A **tool primitive** is the smallest stateless unit of side-effecting work an
|
|
6
|
+
* agent can perform — read a file, write a file, run a shell command, search,
|
|
7
|
+
* fetch a URL, edit a notebook cell. Each primitive is a PURE function of its
|
|
8
|
+
* typed input (no session/loop/global coupling); composing primitives into
|
|
9
|
+
* multi-step capabilities is the job of the SKILLS layer (`packages/skills`),
|
|
10
|
+
* not the tool layer. The implementations live in `packages/core/src/tools/*`
|
|
11
|
+
* (T11405-T11407) behind a single deny-first guardrail chokepoint; this module
|
|
12
|
+
* is their shared contract so `core`, `mcp-adapter`, `caamp`, and `cleo-os`
|
|
13
|
+
* agree on one shape and never redefine it.
|
|
14
|
+
*
|
|
15
|
+
* This is a NEW submodule (`@cleocode/contracts/tools/atomic`) kept separate
|
|
16
|
+
* from the squatted `contracts/src/tools/index.ts` (query/derivation helpers —
|
|
17
|
+
* see the E3 inventory note `e3-tools-inventory`). Types-only — no runtime
|
|
18
|
+
* logic (Gate 10 `contracts-purity`).
|
|
19
|
+
*
|
|
20
|
+
* @epic T11390
|
|
21
|
+
* @task T11403
|
|
22
|
+
* @saga T11387
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* The atomic tool classes. Each class groups primitives that share a side-effect
|
|
26
|
+
* surface and therefore a guardrail policy (fs → path allowlist, shell → command
|
|
27
|
+
* denylist, net → egress policy, …).
|
|
28
|
+
*/
|
|
29
|
+
export declare const TOOL_CLASSES: readonly ["fs", "shell", "search", "net", "notebook"];
|
|
30
|
+
/** One of the canonical {@link TOOL_CLASSES}. */
|
|
31
|
+
export type ToolClass = (typeof TOOL_CLASSES)[number];
|
|
32
|
+
/**
|
|
33
|
+
* Descriptor for a single registered tool primitive. The registry of these is
|
|
34
|
+
* the SoT for "what atomic tools exist", consumed by the guardrail chokepoint
|
|
35
|
+
* and (optionally) by the MCP adapter's tool catalog (T11411).
|
|
36
|
+
*/
|
|
37
|
+
export interface ToolPrimitiveDescriptor {
|
|
38
|
+
/** Stable primitive name (e.g. `readFileText`, `executeShell`). */
|
|
39
|
+
readonly name: string;
|
|
40
|
+
/** The side-effect class this primitive belongs to. */
|
|
41
|
+
readonly class: ToolClass;
|
|
42
|
+
/** One-line statement of the single responsibility this primitive owns. */
|
|
43
|
+
readonly responsibility: string;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the primitive is a pure function of its input with no
|
|
46
|
+
* session/loop/global state coupling. Atomic primitives MUST be `true`;
|
|
47
|
+
* the flag exists so the guardrail + lints can reject stateful drift.
|
|
48
|
+
*/
|
|
49
|
+
readonly stateless: boolean;
|
|
50
|
+
}
|
|
51
|
+
/** Input for reading a file's text content. */
|
|
52
|
+
export interface ReadFileInput {
|
|
53
|
+
/** Absolute path to read. */
|
|
54
|
+
readonly path: string;
|
|
55
|
+
/** Text encoding. Defaults to `utf8` in the implementation. */
|
|
56
|
+
readonly encoding?: 'utf8' | 'utf-8' | 'ascii' | 'latin1';
|
|
57
|
+
}
|
|
58
|
+
/** Result of a text read. */
|
|
59
|
+
export interface ReadFileResult {
|
|
60
|
+
/** Absolute path that was read. */
|
|
61
|
+
readonly path: string;
|
|
62
|
+
/** File contents as text. */
|
|
63
|
+
readonly content: string;
|
|
64
|
+
}
|
|
65
|
+
/** Input for an atomic (tmp-then-rename) file write. */
|
|
66
|
+
export interface WriteFileInput {
|
|
67
|
+
/** Absolute path to write. */
|
|
68
|
+
readonly path: string;
|
|
69
|
+
/** Content to write. */
|
|
70
|
+
readonly content: string;
|
|
71
|
+
/** Create parent directories if missing. Defaults to `true`. */
|
|
72
|
+
readonly createDirs?: boolean;
|
|
73
|
+
}
|
|
74
|
+
/** Result of a file write. */
|
|
75
|
+
export interface WriteFileResult {
|
|
76
|
+
/** Absolute path that was written. */
|
|
77
|
+
readonly path: string;
|
|
78
|
+
/** Number of bytes written. */
|
|
79
|
+
readonly bytesWritten: number;
|
|
80
|
+
}
|
|
81
|
+
/** Input for an existence check. */
|
|
82
|
+
export interface PathExistsInput {
|
|
83
|
+
/** Absolute path to test. */
|
|
84
|
+
readonly path: string;
|
|
85
|
+
}
|
|
86
|
+
/** Result of an existence check. */
|
|
87
|
+
export interface PathExistsResult {
|
|
88
|
+
/** Whether the path exists. */
|
|
89
|
+
readonly exists: boolean;
|
|
90
|
+
/** What kind of entry it is, when it exists. */
|
|
91
|
+
readonly kind?: 'file' | 'directory' | 'other';
|
|
92
|
+
}
|
|
93
|
+
/** Input for a shell-command execution. */
|
|
94
|
+
export interface ExecuteShellInput {
|
|
95
|
+
/** Executable to run (NOT a shell string — args are passed separately). */
|
|
96
|
+
readonly command: string;
|
|
97
|
+
/** Arguments passed to {@link ExecuteShellInput.command}. */
|
|
98
|
+
readonly args?: readonly string[];
|
|
99
|
+
/** Working directory. Defaults to `process.cwd()` in the implementation. */
|
|
100
|
+
readonly cwd?: string;
|
|
101
|
+
/** Extra environment variables merged over the inherited environment. */
|
|
102
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
103
|
+
/** Hard timeout in milliseconds; the process is killed when exceeded. */
|
|
104
|
+
readonly timeoutMs?: number;
|
|
105
|
+
}
|
|
106
|
+
/** Result of a shell-command execution. */
|
|
107
|
+
export interface ExecuteShellResult {
|
|
108
|
+
/** Captured standard output. */
|
|
109
|
+
readonly stdout: string;
|
|
110
|
+
/** Captured standard error. */
|
|
111
|
+
readonly stderr: string;
|
|
112
|
+
/** Process exit code (0 = success). `null` when killed by signal/timeout. */
|
|
113
|
+
readonly code: number | null;
|
|
114
|
+
}
|
|
115
|
+
/** Input for a `git` invocation (a constrained {@link ExecuteShellInput}). */
|
|
116
|
+
export interface RunGitInput {
|
|
117
|
+
/** Git arguments (e.g. `['status', '--porcelain']`). */
|
|
118
|
+
readonly args: readonly string[];
|
|
119
|
+
/** Repository working directory. */
|
|
120
|
+
readonly cwd?: string;
|
|
121
|
+
/** Hard timeout in milliseconds. */
|
|
122
|
+
readonly timeoutMs?: number;
|
|
123
|
+
}
|
|
124
|
+
/** Input for a content/path search primitive. */
|
|
125
|
+
export interface SearchInput {
|
|
126
|
+
/** Pattern to search for (literal or regex per {@link SearchInput.isRegex}). */
|
|
127
|
+
readonly pattern: string;
|
|
128
|
+
/** Root directory to search under. */
|
|
129
|
+
readonly root: string;
|
|
130
|
+
/** Treat {@link SearchInput.pattern} as a regular expression. */
|
|
131
|
+
readonly isRegex?: boolean;
|
|
132
|
+
/** Cap on returned matches. */
|
|
133
|
+
readonly maxResults?: number;
|
|
134
|
+
}
|
|
135
|
+
/** A single search match. */
|
|
136
|
+
export interface SearchMatch {
|
|
137
|
+
/** Absolute path of the matching file. */
|
|
138
|
+
readonly path: string;
|
|
139
|
+
/** 1-based line number of the match. */
|
|
140
|
+
readonly line: number;
|
|
141
|
+
/** The matching line's text. */
|
|
142
|
+
readonly text: string;
|
|
143
|
+
}
|
|
144
|
+
/** Result of a search. */
|
|
145
|
+
export interface SearchResult {
|
|
146
|
+
/** Matches in deterministic (path, line) order. */
|
|
147
|
+
readonly matches: readonly SearchMatch[];
|
|
148
|
+
/** Whether {@link SearchInput.maxResults} truncated the results. */
|
|
149
|
+
readonly truncated: boolean;
|
|
150
|
+
}
|
|
151
|
+
/** Input for an outbound HTTP fetch primitive. */
|
|
152
|
+
export interface FetchInput {
|
|
153
|
+
/** Absolute URL to fetch. */
|
|
154
|
+
readonly url: string;
|
|
155
|
+
/** HTTP method. Defaults to `GET`. */
|
|
156
|
+
readonly method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD';
|
|
157
|
+
/** Request headers. */
|
|
158
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
159
|
+
/** Request body (already serialized). */
|
|
160
|
+
readonly body?: string;
|
|
161
|
+
/** Hard timeout in milliseconds. */
|
|
162
|
+
readonly timeoutMs?: number;
|
|
163
|
+
}
|
|
164
|
+
/** Result of an HTTP fetch. */
|
|
165
|
+
export interface FetchResult {
|
|
166
|
+
/** HTTP status code. */
|
|
167
|
+
readonly status: number;
|
|
168
|
+
/** Response headers. */
|
|
169
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
170
|
+
/** Response body as text. */
|
|
171
|
+
readonly body: string;
|
|
172
|
+
}
|
|
173
|
+
/** Input for a notebook-cell edit primitive. */
|
|
174
|
+
export interface NotebookEditInput {
|
|
175
|
+
/** Absolute path to the `.ipynb` file. */
|
|
176
|
+
readonly path: string;
|
|
177
|
+
/** 0-based index of the cell to edit. */
|
|
178
|
+
readonly cellIndex: number;
|
|
179
|
+
/** New source for the cell. */
|
|
180
|
+
readonly source: string;
|
|
181
|
+
}
|
|
182
|
+
/** Result of a notebook-cell edit. */
|
|
183
|
+
export interface NotebookEditResult {
|
|
184
|
+
/** Absolute path that was edited. */
|
|
185
|
+
readonly path: string;
|
|
186
|
+
/** The cell index that changed. */
|
|
187
|
+
readonly cellIndex: number;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* The canonical atomic-tool primitives. Implementations in
|
|
191
|
+
* `packages/core/src/tools/*` register against these names; the MCP adapter
|
|
192
|
+
* (T11411) may derive its catalog from this list rather than hand-listing.
|
|
193
|
+
*/
|
|
194
|
+
export declare const ATOMIC_TOOL_PRIMITIVES: readonly ToolPrimitiveDescriptor[];
|
|
195
|
+
//# sourceMappingURL=atomic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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,wBAAwB;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,wBAAwB;IACxB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,6BAA6B;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,gDAAgD;AAChD,MAAM,WAAW,iBAAiB;IAChC,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,+BAA+B;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,sCAAsC;AACtC,MAAM,WAAW,kBAAkB;IACjC,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mCAAmC;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAMD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,uBAAuB,EAwC3D,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Atomic-tool primitive contracts — the canonical I/O shapes for the CORE SDK
|
|
3
|
+
* tool layer (E3 · T11403 · SG-PACKAGE-ARCH).
|
|
4
|
+
*
|
|
5
|
+
* A **tool primitive** is the smallest stateless unit of side-effecting work an
|
|
6
|
+
* agent can perform — read a file, write a file, run a shell command, search,
|
|
7
|
+
* fetch a URL, edit a notebook cell. Each primitive is a PURE function of its
|
|
8
|
+
* typed input (no session/loop/global coupling); composing primitives into
|
|
9
|
+
* multi-step capabilities is the job of the SKILLS layer (`packages/skills`),
|
|
10
|
+
* not the tool layer. The implementations live in `packages/core/src/tools/*`
|
|
11
|
+
* (T11405-T11407) behind a single deny-first guardrail chokepoint; this module
|
|
12
|
+
* is their shared contract so `core`, `mcp-adapter`, `caamp`, and `cleo-os`
|
|
13
|
+
* agree on one shape and never redefine it.
|
|
14
|
+
*
|
|
15
|
+
* This is a NEW submodule (`@cleocode/contracts/tools/atomic`) kept separate
|
|
16
|
+
* from the squatted `contracts/src/tools/index.ts` (query/derivation helpers —
|
|
17
|
+
* see the E3 inventory note `e3-tools-inventory`). Types-only — no runtime
|
|
18
|
+
* logic (Gate 10 `contracts-purity`).
|
|
19
|
+
*
|
|
20
|
+
* @epic T11390
|
|
21
|
+
* @task T11403
|
|
22
|
+
* @saga T11387
|
|
23
|
+
*/
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
// Taxonomy
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
/**
|
|
28
|
+
* The atomic tool classes. Each class groups primitives that share a side-effect
|
|
29
|
+
* surface and therefore a guardrail policy (fs → path allowlist, shell → command
|
|
30
|
+
* denylist, net → egress policy, …).
|
|
31
|
+
*/
|
|
32
|
+
export const TOOL_CLASSES = ['fs', 'shell', 'search', 'net', 'notebook'];
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// Canonical primitive registry (the SoT for "what atomic tools exist")
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
/**
|
|
37
|
+
* The canonical atomic-tool primitives. Implementations in
|
|
38
|
+
* `packages/core/src/tools/*` register against these names; the MCP adapter
|
|
39
|
+
* (T11411) may derive its catalog from this list rather than hand-listing.
|
|
40
|
+
*/
|
|
41
|
+
export const ATOMIC_TOOL_PRIMITIVES = [
|
|
42
|
+
{ name: 'readFileText', class: 'fs', responsibility: 'Read a file as text', stateless: true },
|
|
43
|
+
{ name: 'readJson', class: 'fs', responsibility: 'Read + parse a JSON file', stateless: true },
|
|
44
|
+
{
|
|
45
|
+
name: 'writeFileAtomic',
|
|
46
|
+
class: 'fs',
|
|
47
|
+
responsibility: 'Atomically write a file (tmp-then-rename)',
|
|
48
|
+
stateless: true,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'pathExists',
|
|
52
|
+
class: 'fs',
|
|
53
|
+
responsibility: 'Test path existence + kind',
|
|
54
|
+
stateless: true,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'executeShell',
|
|
58
|
+
class: 'shell',
|
|
59
|
+
responsibility: 'Run a command with explicit cwd/env/timeout',
|
|
60
|
+
stateless: true,
|
|
61
|
+
},
|
|
62
|
+
{ name: 'runGit', class: 'shell', responsibility: 'Run a git subcommand', stateless: true },
|
|
63
|
+
{
|
|
64
|
+
name: 'search',
|
|
65
|
+
class: 'search',
|
|
66
|
+
responsibility: 'Search content/paths under a root',
|
|
67
|
+
stateless: true,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'fetch',
|
|
71
|
+
class: 'net',
|
|
72
|
+
responsibility: 'Perform an outbound HTTP request',
|
|
73
|
+
stateless: true,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'notebookEdit',
|
|
77
|
+
class: 'notebook',
|
|
78
|
+
responsibility: 'Replace a notebook cell source',
|
|
79
|
+
stateless: true,
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
//# sourceMappingURL=atomic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atomic.js","sourceRoot":"","sources":["../../src/tools/atomic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,8EAA8E;AAC9E,WAAW;AACX,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAU,CAAC;AA+LlF,8EAA8E;AAC9E,uEAAuE;AACvE,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAuC;IACxE,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,qBAAqB,EAAE,SAAS,EAAE,IAAI,EAAE;IAC7F,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,0BAA0B,EAAE,SAAS,EAAE,IAAI,EAAE;IAC9F;QACE,IAAI,EAAE,iBAAiB;QACvB,KAAK,EAAE,IAAI;QACX,cAAc,EAAE,2CAA2C;QAC3D,SAAS,EAAE,IAAI;KAChB;IACD;QACE,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,IAAI;QACX,cAAc,EAAE,4BAA4B;QAC5C,SAAS,EAAE,IAAI;KAChB;IACD;QACE,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,OAAO;QACd,cAAc,EAAE,6CAA6C;QAC7D,SAAS,EAAE,IAAI;KAChB;IACD,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,SAAS,EAAE,IAAI,EAAE;IAC3F;QACE,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,QAAQ;QACf,cAAc,EAAE,mCAAmC;QACnD,SAAS,EAAE,IAAI;KAChB;IACD;QACE,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,KAAK;QACZ,cAAc,EAAE,kCAAkC;QAClD,SAAS,EAAE,IAAI;KAChB;IACD;QACE,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,UAAU;QACjB,cAAc,EAAE,gCAAgC;QAChD,SAAS,EAAE,IAAI;KAChB;CACO,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composite meta-tool contracts — typed I/O shapes for repo-structure
|
|
3
|
+
* velocity-multiplier tools (T11484 · DHQ-027/032 · E-CORE-SELF-TOOLING).
|
|
4
|
+
*
|
|
5
|
+
* A **composite tool** COMPOSES atomic primitives (`@cleocode/contracts/tools/
|
|
6
|
+
* atomic` — fs/shell/search) plus repo-structure knowledge into one guarded,
|
|
7
|
+
* deterministic, multi-step operation that runs WITHOUT an LLM and returns a
|
|
8
|
+
* typed result. Per the TOOL-vs-SKILL discriminator (T11456 epic), that makes
|
|
9
|
+
* these TOOLs (typed return, no agent reasoning), NOT skills (`packages/skills`
|
|
10
|
+
* markdown capabilities).
|
|
11
|
+
*
|
|
12
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
13
|
+
* PLACEMENT STATUS (read before implementing the runtime)
|
|
14
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
15
|
+
* These are the CONTRACTS ONLY. The runtime implementations are intentionally
|
|
16
|
+
* DEFERRED to epic **T11456** (TOOLS canonical structure), because a composite
|
|
17
|
+
* tool cannot be CORRECTLY placed/named/registered until T11456 lands:
|
|
18
|
+
*
|
|
19
|
+
* - The atomic-tool boundary (`ATOMIC_TOOL_BOUNDARY` in `boundary.ts`, CI
|
|
20
|
+
* Gate 11) restricts `packages/core/src/tools/` to ATOMIC, STATELESS
|
|
21
|
+
* primitives (the 5 `TOOL_CLASSES`: fs/shell/search/net/notebook). These
|
|
22
|
+
* composites are multi-step and repo-structure-aware — NOT atomic primitives
|
|
23
|
+
* — so that home is wrong for them.
|
|
24
|
+
* - `packages/skills/` (the boundary's `skillsHome`) holds agent-facing
|
|
25
|
+
* SKILL.md markdown, not executable TS — also wrong.
|
|
26
|
+
* - T11456 defines the missing structure these tools NEED: a closed
|
|
27
|
+
* `ToolCategory` enum (it reserves `vcs`/`workflow`/`agent` — the categories
|
|
28
|
+
* these compose), strict `<scope>_<category>_<operation>` naming, a
|
|
29
|
+
* `ToolDescriptor` zod schema, and a `ToolRegistry` with project>global>core
|
|
30
|
+
* precedence. Authoring the runtime + a category BEFORE that epic would
|
|
31
|
+
* force a placement T11456 must then rework.
|
|
32
|
+
*
|
|
33
|
+
* Shipping the contracts now is the sound, additive, non-blocked unit: it pins
|
|
34
|
+
* the I/O shape (and enumerates every breakage/wiring class each tool owns) so
|
|
35
|
+
* the T11456 registry has a stable surface to register against. Types-only — no
|
|
36
|
+
* runtime logic (CI Gate 10 `contracts-purity`).
|
|
37
|
+
*
|
|
38
|
+
* @epic T11480
|
|
39
|
+
* @task T11484
|
|
40
|
+
* @see T11456 — TOOLS canonical structure (runtime home + registry + naming)
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* The seven breakage classes a module relocation MUST repair atomically. A
|
|
44
|
+
* naive `git mv` fixes none of these; leaving any one unrepaired is a red build.
|
|
45
|
+
* The runtime asserts each class is handled and reports per-class edit counts.
|
|
46
|
+
*/
|
|
47
|
+
export declare const MODULE_RELOCATION_BREAKAGE_CLASSES: readonly ["relative-import-depth", "barrels", "js-form-and-dynamic-import", "mirror-test-dirs", "deprecations-yml", "doc-comments", "cross-package-importers"];
|
|
48
|
+
/** One of the {@link MODULE_RELOCATION_BREAKAGE_CLASSES}. */
|
|
49
|
+
export type ModuleRelocationBreakageClass = (typeof MODULE_RELOCATION_BREAKAGE_CLASSES)[number];
|
|
50
|
+
/** Input for the `module-relocation` composite tool. */
|
|
51
|
+
export interface ModuleRelocationInput {
|
|
52
|
+
/** Absolute (or repo-root-relative) path of the module to move. */
|
|
53
|
+
readonly fromPath: string;
|
|
54
|
+
/** Destination path for the module. */
|
|
55
|
+
readonly toPath: string;
|
|
56
|
+
/** Repository root the operation is scoped to. */
|
|
57
|
+
readonly repoRoot: string;
|
|
58
|
+
/**
|
|
59
|
+
* Leave a re-export shim at {@link ModuleRelocationInput.fromPath} that
|
|
60
|
+
* re-exports from the new location (for a deprecation cycle) instead of
|
|
61
|
+
* rewriting every importer. Defaults to `false` (rewrite importers).
|
|
62
|
+
*/
|
|
63
|
+
readonly leaveShim?: boolean;
|
|
64
|
+
/** Preview the edit plan without writing. Defaults to `false`. */
|
|
65
|
+
readonly dryRun?: boolean;
|
|
66
|
+
}
|
|
67
|
+
/** Per-class summary of the edits a relocation made (or would make). */
|
|
68
|
+
export interface ModuleRelocationClassReport {
|
|
69
|
+
/** Which breakage class this entry summarises. */
|
|
70
|
+
readonly class: ModuleRelocationBreakageClass;
|
|
71
|
+
/** Repo-relative files edited for this class. */
|
|
72
|
+
readonly files: readonly string[];
|
|
73
|
+
/** Total number of edits applied across {@link ModuleRelocationClassReport.files}. */
|
|
74
|
+
readonly edits: number;
|
|
75
|
+
}
|
|
76
|
+
/** Result of a `module-relocation` run. */
|
|
77
|
+
export interface ModuleRelocationResult {
|
|
78
|
+
/** The module's new path. */
|
|
79
|
+
readonly toPath: string;
|
|
80
|
+
/** Whether a re-export shim was left at the old path. */
|
|
81
|
+
readonly shimLeft: boolean;
|
|
82
|
+
/** Whether this was a dry-run (no writes performed). */
|
|
83
|
+
readonly dryRun: boolean;
|
|
84
|
+
/** Per-breakage-class edit report (one entry per class, even when empty). */
|
|
85
|
+
readonly classes: readonly ModuleRelocationClassReport[];
|
|
86
|
+
/** Total repo-relative files touched across every class. */
|
|
87
|
+
readonly filesTouched: readonly string[];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The six wiring points a new workspace leaf MUST be threaded through. Missing
|
|
91
|
+
* any one yields a package that does not build, is not type-resolved, or is
|
|
92
|
+
* accidentally published. The runtime wires all six and reports each.
|
|
93
|
+
*/
|
|
94
|
+
export declare const ADD_WORKSPACE_PACKAGE_WIRING_POINTS: readonly ["deps", "tsconfig-refs", "build-mjs-buildpkg", "inline-maps", "boundary-entry", "private-no-readme"];
|
|
95
|
+
/** One of the {@link ADD_WORKSPACE_PACKAGE_WIRING_POINTS}. */
|
|
96
|
+
export type AddWorkspacePackageWiringPoint = (typeof ADD_WORKSPACE_PACKAGE_WIRING_POINTS)[number];
|
|
97
|
+
/** Input for the `add-workspace-package` composite tool. */
|
|
98
|
+
export interface AddWorkspacePackageInput {
|
|
99
|
+
/** Scoped package name, e.g. `@cleocode/foo`. */
|
|
100
|
+
readonly packageName: string;
|
|
101
|
+
/** Directory under `packages/` to create (defaults to the unscoped name). */
|
|
102
|
+
readonly dirName?: string;
|
|
103
|
+
/** Repository root the operation is scoped to. */
|
|
104
|
+
readonly repoRoot: string;
|
|
105
|
+
/** Packages that should depend on the new leaf (wires the `deps` point). */
|
|
106
|
+
readonly consumers?: readonly string[];
|
|
107
|
+
/** Preview the wiring plan without writing. Defaults to `false`. */
|
|
108
|
+
readonly dryRun?: boolean;
|
|
109
|
+
}
|
|
110
|
+
/** Per-point summary of how a wiring point was satisfied. */
|
|
111
|
+
export interface AddWorkspacePackageWiringReport {
|
|
112
|
+
/** Which wiring point this entry summarises. */
|
|
113
|
+
readonly point: AddWorkspacePackageWiringPoint;
|
|
114
|
+
/** Repo-relative files created or edited for this point. */
|
|
115
|
+
readonly files: readonly string[];
|
|
116
|
+
}
|
|
117
|
+
/** Result of an `add-workspace-package` run. */
|
|
118
|
+
export interface AddWorkspacePackageResult {
|
|
119
|
+
/** The created package's name. */
|
|
120
|
+
readonly packageName: string;
|
|
121
|
+
/** Repo-relative directory of the new leaf. */
|
|
122
|
+
readonly packageDir: string;
|
|
123
|
+
/** Whether this was a dry-run (no writes performed). */
|
|
124
|
+
readonly dryRun: boolean;
|
|
125
|
+
/** Per-wiring-point report (one entry per point, even when empty). */
|
|
126
|
+
readonly points: readonly AddWorkspacePackageWiringReport[];
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=composite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composite.d.ts","sourceRoot":"","sources":["../../src/tools/composite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAMH;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,gKAerC,CAAC;AAEX,6DAA6D;AAC7D,MAAM,MAAM,6BAA6B,GAAG,CAAC,OAAO,kCAAkC,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhG,wDAAwD;AACxD,MAAM,WAAW,qBAAqB;IACpC,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,uCAAuC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kDAAkD;IAClD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,CAAC;IACvC,oEAAoE;IACpE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,6DAA6D;AAC7D,MAAM,WAAW,+BAA+B;IAC9C,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,8BAA8B,CAAC;IAC/C,4DAA4D;IAC5D,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED,gDAAgD;AAChD,MAAM,WAAW,yBAAyB;IACxC,kCAAkC;IAClC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,+CAA+C;IAC/C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,wDAAwD;IACxD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,SAAS,+BAA+B,EAAE,CAAC;CAC7D"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composite meta-tool contracts — typed I/O shapes for repo-structure
|
|
3
|
+
* velocity-multiplier tools (T11484 · DHQ-027/032 · E-CORE-SELF-TOOLING).
|
|
4
|
+
*
|
|
5
|
+
* A **composite tool** COMPOSES atomic primitives (`@cleocode/contracts/tools/
|
|
6
|
+
* atomic` — fs/shell/search) plus repo-structure knowledge into one guarded,
|
|
7
|
+
* deterministic, multi-step operation that runs WITHOUT an LLM and returns a
|
|
8
|
+
* typed result. Per the TOOL-vs-SKILL discriminator (T11456 epic), that makes
|
|
9
|
+
* these TOOLs (typed return, no agent reasoning), NOT skills (`packages/skills`
|
|
10
|
+
* markdown capabilities).
|
|
11
|
+
*
|
|
12
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
13
|
+
* PLACEMENT STATUS (read before implementing the runtime)
|
|
14
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
15
|
+
* These are the CONTRACTS ONLY. The runtime implementations are intentionally
|
|
16
|
+
* DEFERRED to epic **T11456** (TOOLS canonical structure), because a composite
|
|
17
|
+
* tool cannot be CORRECTLY placed/named/registered until T11456 lands:
|
|
18
|
+
*
|
|
19
|
+
* - The atomic-tool boundary (`ATOMIC_TOOL_BOUNDARY` in `boundary.ts`, CI
|
|
20
|
+
* Gate 11) restricts `packages/core/src/tools/` to ATOMIC, STATELESS
|
|
21
|
+
* primitives (the 5 `TOOL_CLASSES`: fs/shell/search/net/notebook). These
|
|
22
|
+
* composites are multi-step and repo-structure-aware — NOT atomic primitives
|
|
23
|
+
* — so that home is wrong for them.
|
|
24
|
+
* - `packages/skills/` (the boundary's `skillsHome`) holds agent-facing
|
|
25
|
+
* SKILL.md markdown, not executable TS — also wrong.
|
|
26
|
+
* - T11456 defines the missing structure these tools NEED: a closed
|
|
27
|
+
* `ToolCategory` enum (it reserves `vcs`/`workflow`/`agent` — the categories
|
|
28
|
+
* these compose), strict `<scope>_<category>_<operation>` naming, a
|
|
29
|
+
* `ToolDescriptor` zod schema, and a `ToolRegistry` with project>global>core
|
|
30
|
+
* precedence. Authoring the runtime + a category BEFORE that epic would
|
|
31
|
+
* force a placement T11456 must then rework.
|
|
32
|
+
*
|
|
33
|
+
* Shipping the contracts now is the sound, additive, non-blocked unit: it pins
|
|
34
|
+
* the I/O shape (and enumerates every breakage/wiring class each tool owns) so
|
|
35
|
+
* the T11456 registry has a stable surface to register against. Types-only — no
|
|
36
|
+
* runtime logic (CI Gate 10 `contracts-purity`).
|
|
37
|
+
*
|
|
38
|
+
* @epic T11480
|
|
39
|
+
* @task T11484
|
|
40
|
+
* @see T11456 — TOOLS canonical structure (runtime home + registry + naming)
|
|
41
|
+
*/
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
// module-relocation (DHQ-032)
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
/**
|
|
46
|
+
* The seven breakage classes a module relocation MUST repair atomically. A
|
|
47
|
+
* naive `git mv` fixes none of these; leaving any one unrepaired is a red build.
|
|
48
|
+
* The runtime asserts each class is handled and reports per-class edit counts.
|
|
49
|
+
*/
|
|
50
|
+
export const MODULE_RELOCATION_BREAKAGE_CLASSES = [
|
|
51
|
+
/** Relative-import depth (`../` vs `../../`) of the moved file's own imports. */
|
|
52
|
+
'relative-import-depth',
|
|
53
|
+
/** Barrel (`index.ts`) re-exports that referenced the old path. */
|
|
54
|
+
'barrels',
|
|
55
|
+
/** `.js`-suffixed specifiers AND dynamic `import()` specifiers. */
|
|
56
|
+
'js-form-and-dynamic-import',
|
|
57
|
+
/** The mirrored `__tests__/` directory for the moved module. */
|
|
58
|
+
'mirror-test-dirs',
|
|
59
|
+
/** `deprecations.yml` entries that pointed at the old path. */
|
|
60
|
+
'deprecations-yml',
|
|
61
|
+
/** Doc comments / `@see` / `@module` references to the old path. */
|
|
62
|
+
'doc-comments',
|
|
63
|
+
/** Cross-package importers that consumed the module via its package path. */
|
|
64
|
+
'cross-package-importers',
|
|
65
|
+
];
|
|
66
|
+
// ---------------------------------------------------------------------------
|
|
67
|
+
// add-workspace-package (DHQ-027)
|
|
68
|
+
// ---------------------------------------------------------------------------
|
|
69
|
+
/**
|
|
70
|
+
* The six wiring points a new workspace leaf MUST be threaded through. Missing
|
|
71
|
+
* any one yields a package that does not build, is not type-resolved, or is
|
|
72
|
+
* accidentally published. The runtime wires all six and reports each.
|
|
73
|
+
*/
|
|
74
|
+
export const ADD_WORKSPACE_PACKAGE_WIRING_POINTS = [
|
|
75
|
+
/** `dependencies` / `devDependencies` of consuming packages. */
|
|
76
|
+
'deps',
|
|
77
|
+
/** The three `tsconfig` references: root refs, build tsconfig, path mapping. */
|
|
78
|
+
'tsconfig-refs',
|
|
79
|
+
/** The `buildPkg(...)` entry in the root `build.mjs` topological wave plan. */
|
|
80
|
+
'build-mjs-buildpkg',
|
|
81
|
+
/** esbuild/tsc inline source-map wiring for the new leaf. */
|
|
82
|
+
'inline-maps',
|
|
83
|
+
/** The `BOUNDARY_REGISTRY` entry in `packages/contracts/src/boundary.ts`. */
|
|
84
|
+
'boundary-entry',
|
|
85
|
+
/** `private: true` + no published README (internal-leaf publish hygiene). */
|
|
86
|
+
'private-no-readme',
|
|
87
|
+
];
|
|
88
|
+
//# sourceMappingURL=composite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composite.js","sourceRoot":"","sources":["../../src/tools/composite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,8EAA8E;AAC9E,8BAA8B;AAC9B,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAChD,iFAAiF;IACjF,uBAAuB;IACvB,mEAAmE;IACnE,SAAS;IACT,mEAAmE;IACnE,4BAA4B;IAC5B,gEAAgE;IAChE,kBAAkB;IAClB,+DAA+D;IAC/D,kBAAkB;IAClB,oEAAoE;IACpE,cAAc;IACd,6EAA6E;IAC7E,yBAAyB;CACjB,CAAC;AA+CX,8EAA8E;AAC9E,kCAAkC;AAClC,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG;IACjD,gEAAgE;IAChE,MAAM;IACN,gFAAgF;IAChF,eAAe;IACf,+EAA+E;IAC/E,oBAAoB;IACpB,6DAA6D;IAC7D,aAAa;IACb,6EAA6E;IAC7E,gBAAgB;IAChB,6EAA6E;IAC7E,mBAAmB;CACX,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleocode/contracts",
|
|
3
|
-
"version": "2026.5.
|
|
3
|
+
"version": "2026.5.131",
|
|
4
4
|
"description": "Domain types, interfaces, and contracts for the CLEO ecosystem",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -10,6 +10,26 @@
|
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"import": "./dist/index.js"
|
|
12
12
|
},
|
|
13
|
+
"./gateway": {
|
|
14
|
+
"types": "./dist/gateway.d.ts",
|
|
15
|
+
"import": "./dist/gateway.js"
|
|
16
|
+
},
|
|
17
|
+
"./gateway/rpc": {
|
|
18
|
+
"types": "./dist/gateway/rpc/index.d.ts",
|
|
19
|
+
"import": "./dist/gateway/rpc/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./tools/atomic": {
|
|
22
|
+
"types": "./dist/tools/atomic.d.ts",
|
|
23
|
+
"import": "./dist/tools/atomic.js"
|
|
24
|
+
},
|
|
25
|
+
"./tools/composite": {
|
|
26
|
+
"types": "./dist/tools/composite.d.ts",
|
|
27
|
+
"import": "./dist/tools/composite.js"
|
|
28
|
+
},
|
|
29
|
+
"./gateway.js": {
|
|
30
|
+
"types": "./dist/gateway.d.ts",
|
|
31
|
+
"import": "./dist/gateway.js"
|
|
32
|
+
},
|
|
13
33
|
"./provenance": {
|
|
14
34
|
"types": "./dist/provenance.d.ts",
|
|
15
35
|
"import": "./dist/provenance.js"
|
|
@@ -82,6 +102,18 @@
|
|
|
82
102
|
"types": "./dist/nexus-tasks-bridge-ops.d.ts",
|
|
83
103
|
"import": "./dist/nexus-tasks-bridge-ops.js"
|
|
84
104
|
},
|
|
105
|
+
"./daemon": {
|
|
106
|
+
"types": "./dist/daemon/index.d.ts",
|
|
107
|
+
"import": "./dist/daemon/index.js"
|
|
108
|
+
},
|
|
109
|
+
"./daemon-ipc": {
|
|
110
|
+
"types": "./dist/daemon-ipc/index.d.ts",
|
|
111
|
+
"import": "./dist/daemon-ipc/index.js"
|
|
112
|
+
},
|
|
113
|
+
"./supervisor-ipc": {
|
|
114
|
+
"types": "./dist/supervisor-ipc/index.d.ts",
|
|
115
|
+
"import": "./dist/supervisor-ipc/index.js"
|
|
116
|
+
},
|
|
85
117
|
"./dispatch/*": {
|
|
86
118
|
"types": "./dist/dispatch/*.d.ts",
|
|
87
119
|
"import": "./dist/dispatch/*.js"
|
|
@@ -146,7 +178,7 @@
|
|
|
146
178
|
"dependencies": {
|
|
147
179
|
"zod": "^4.3.6",
|
|
148
180
|
"zod-to-json-schema": "^3.25.2",
|
|
149
|
-
"@cleocode/lafs": "2026.5.
|
|
181
|
+
"@cleocode/lafs": "2026.5.131"
|
|
150
182
|
},
|
|
151
183
|
"scripts": {
|
|
152
184
|
"build": "tsc -b --force && node scripts/copy-assets.mjs && node scripts/emit-schemas.mjs",
|