stitchkit 0.103.8 → 0.103.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/agent-runtime/sandbox-process.d.ts +2 -2
- package/dist/agent-runtime/sandbox-process.d.ts.map +1 -1
- package/dist/agent-runtime/store-conformance-lifecycle.d.ts +10 -10
- package/dist/durability/contract.d.ts +3 -2
- package/dist/durability/contract.d.ts.map +1 -1
- package/dist/durability/effect.d.ts.map +1 -1
- package/dist/durability/engine.d.ts.map +1 -1
- package/dist/durability/json.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/harness.js +2 -2
- package/dist/entrypoints/agent-runtime/sandbox.js +29 -81
- package/dist/entrypoints/agent-runtime.js +2 -2
- package/dist/entrypoints/application/diagnostic-journal.js +2 -1
- package/dist/entrypoints/cli.js +1 -1
- package/dist/entrypoints/files.d.ts +2 -0
- package/dist/entrypoints/files.d.ts.map +1 -1
- package/dist/entrypoints/files.js +14 -6
- package/dist/entrypoints/primitives.js +77 -57
- package/dist/entrypoints/process.d.ts +5 -0
- package/dist/entrypoints/process.d.ts.map +1 -0
- package/dist/entrypoints/process.js +20 -0
- package/dist/entrypoints/tools.js +12 -3
- package/dist/files/boundary.d.ts +19 -1
- package/dist/files/boundary.d.ts.map +1 -1
- package/dist/files/file-io.d.ts +5 -1
- package/dist/files/file-io.d.ts.map +1 -1
- package/dist/files/read.d.ts +13 -0
- package/dist/files/read.d.ts.map +1 -0
- package/dist/index-12m2v2a9.js +98 -0
- package/dist/index-6m6a9ty4.js +285 -0
- package/dist/index-8a9ksm91.js +95 -0
- package/dist/{index-90ppdx3q.js → index-9jb61j5a.js} +1 -1
- package/dist/{index-5vyd0fkb.js → index-ary5s7k0.js} +40 -61
- package/dist/index-c1jmtxa0.js +74 -0
- package/dist/index-ga597cvy.js +184 -0
- package/dist/index-mbnnw3f2.js +25 -0
- package/dist/index-nybn2err.js +213 -0
- package/dist/{index-v4a2fjtk.js → index-sybedc8b.js} +124 -55
- package/dist/internal/abort-race.d.ts +3 -0
- package/dist/internal/abort-race.d.ts.map +1 -0
- package/dist/internal/atomic-file.d.ts +20 -2
- package/dist/internal/atomic-file.d.ts.map +1 -1
- package/dist/internal/atomic-publication.d.ts +19 -0
- package/dist/internal/atomic-publication.d.ts.map +1 -0
- package/dist/internal/exclusive-lock.d.ts +2 -1
- package/dist/internal/exclusive-lock.d.ts.map +1 -1
- package/dist/internal/json-data.d.ts +8 -0
- package/dist/internal/json-data.d.ts.map +1 -0
- package/dist/internal/process-instance.d.ts +46 -9
- package/dist/internal/process-instance.d.ts.map +1 -1
- package/dist/internal/with-exclusive-lock.d.ts +4 -3
- package/dist/internal/with-exclusive-lock.d.ts.map +1 -1
- package/dist/primitives/canonical-json.d.ts +11 -0
- package/dist/primitives/canonical-json.d.ts.map +1 -0
- package/dist/primitives/index.d.ts +1 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/process/command-owner.d.ts +13 -0
- package/dist/process/command-owner.d.ts.map +1 -0
- package/dist/process/command.d.ts +3 -0
- package/dist/process/command.d.ts.map +1 -0
- package/dist/process/contract.d.ts +45 -0
- package/dist/process/contract.d.ts.map +1 -0
- package/dist/process/group.d.ts +6 -0
- package/dist/process/group.d.ts.map +1 -0
- package/dist/process/leader-settlement.d.ts +4 -0
- package/dist/process/leader-settlement.d.ts.map +1 -0
- package/dist/tools/transfer/managed-file-error.d.ts.map +1 -1
- package/llms/files.txt +9 -1
- package/llms/primitives.txt +31 -1
- package/llms/process.txt +242 -0
- package/llms/stitchkit.txt +1 -0
- package/llms/tools.txt +18 -0
- package/llms-full.txt +292 -2
- package/llms.txt +6 -4
- package/native/darwin-arm64.node +0 -0
- package/native/darwin-x64.node +0 -0
- package/package.json +5 -1
- package/dist/index-7kxw1awn.js +0 -328
- package/dist/index-aan6hqb9.js +0 -65
|
@@ -2,15 +2,19 @@ import {
|
|
|
2
2
|
ManagedFilePathSchema2,
|
|
3
3
|
ManagedFileRefSchema2
|
|
4
4
|
} from "./index-xqhede6x.js";
|
|
5
|
+
import {
|
|
6
|
+
AtomicFilePublicationError2,
|
|
7
|
+
publishAtomicFile
|
|
8
|
+
} from "./index-8a9ksm91.js";
|
|
5
9
|
import {
|
|
6
10
|
isWithinDir2
|
|
7
11
|
} from "./index-5cc6r990.js";
|
|
8
12
|
|
|
9
13
|
// src/files/boundary.ts
|
|
10
14
|
import { randomUUID } from "node:crypto";
|
|
11
|
-
import { constants } from "node:fs";
|
|
12
|
-
import {
|
|
13
|
-
import { basename, dirname, resolve } from "node:path";
|
|
15
|
+
import { constants as constants2 } from "node:fs";
|
|
16
|
+
import { mkdir, open as open2, realpath, stat, unlink } from "node:fs/promises";
|
|
17
|
+
import { basename as basename2, dirname, resolve } from "node:path";
|
|
14
18
|
|
|
15
19
|
// src/files/file-io.ts
|
|
16
20
|
var ManagedFileInspectionSchema = ManagedFileRefSchema2.pick({
|
|
@@ -70,22 +74,29 @@ function inspectedRef(path, size, inspection, fallback = {}) {
|
|
|
70
74
|
async function readHandle(handle, maxBytes, signal) {
|
|
71
75
|
const chunks = [];
|
|
72
76
|
let total = 0;
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
let ended = false;
|
|
78
|
+
while (!ended) {
|
|
75
79
|
const capacity = Math.min(64 * 1024, maxBytes + 1 - total);
|
|
76
|
-
if (capacity <= 0)
|
|
80
|
+
if (capacity <= 0)
|
|
77
81
|
throw new ManagedFileError2("FILE_TOO_LARGE", `file exceeds the ${maxBytes}-byte cap`);
|
|
78
|
-
}
|
|
79
82
|
const chunk = new Uint8Array(capacity);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
let filled = 0;
|
|
84
|
+
while (filled < capacity) {
|
|
85
|
+
signal?.throwIfAborted();
|
|
86
|
+
const { bytesRead } = await handle.read(chunk, filled, capacity - filled);
|
|
87
|
+
if (bytesRead === 0) {
|
|
88
|
+
ended = true;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
filled += bytesRead;
|
|
92
|
+
total += bytesRead;
|
|
93
|
+
if (total > maxBytes)
|
|
94
|
+
throw new ManagedFileError2("FILE_TOO_LARGE", `file exceeds the ${maxBytes}-byte cap`);
|
|
86
95
|
}
|
|
87
|
-
|
|
96
|
+
if (filled > 0)
|
|
97
|
+
chunks.push(chunk.subarray(0, filled));
|
|
88
98
|
}
|
|
99
|
+
signal?.throwIfAborted();
|
|
89
100
|
const bytes = new Uint8Array(total);
|
|
90
101
|
let offset = 0;
|
|
91
102
|
for (const chunk of chunks) {
|
|
@@ -149,13 +160,77 @@ async function writeSource(handle, source, maxBytes, inspectionBytes, signal) {
|
|
|
149
160
|
return { size, prefix };
|
|
150
161
|
}
|
|
151
162
|
|
|
163
|
+
// src/files/read.ts
|
|
164
|
+
import { constants } from "node:fs";
|
|
165
|
+
import { open } from "node:fs/promises";
|
|
166
|
+
import { basename } from "node:path";
|
|
167
|
+
async function readManagedDescriptor(target, path, maxBytes, options, inspection, openDescriptor = open) {
|
|
168
|
+
if (options.rejectSymlinks && !constants.O_NOFOLLOW)
|
|
169
|
+
throw new ManagedFileError2("FILE_UNSUPPORTED", "strict leaf nofollow is unavailable");
|
|
170
|
+
const flags = constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0);
|
|
171
|
+
const handle = await openDescriptor(target, flags);
|
|
172
|
+
let failed = false;
|
|
173
|
+
let failure;
|
|
174
|
+
let source;
|
|
175
|
+
try {
|
|
176
|
+
options.signal?.throwIfAborted();
|
|
177
|
+
const before = await handle.stat();
|
|
178
|
+
if (!before.isFile())
|
|
179
|
+
throw new ManagedFileError2("FILE_NOT_REGULAR", "managed path is not a regular file");
|
|
180
|
+
if (options.singleLink && before.nlink !== 1)
|
|
181
|
+
throw new ManagedFileError2("FILE_UNSAFE_LINK", "managed file has multiple links");
|
|
182
|
+
if (before.size > maxBytes)
|
|
183
|
+
throw new ManagedFileError2("FILE_TOO_LARGE", `file exceeds the ${maxBytes}-byte cap`);
|
|
184
|
+
const bytes = await readHandle(handle, maxBytes, options.signal);
|
|
185
|
+
const after = options.stable || options.observe ? await handle.stat() : before;
|
|
186
|
+
if (options.stable && (before.dev !== after.dev || before.ino !== after.ino || before.size !== after.size || before.mtimeMs !== after.mtimeMs || before.ctimeMs !== after.ctimeMs || before.nlink !== after.nlink || bytes.length !== after.size))
|
|
187
|
+
throw new ManagedFileError2("FILE_CHANGED", "managed file changed during read");
|
|
188
|
+
options.signal?.throwIfAborted();
|
|
189
|
+
const inspected = await inspectFile(inspection.inspect, {
|
|
190
|
+
prefix: bytes.slice(0, inspection.bytes),
|
|
191
|
+
name: basename(path)
|
|
192
|
+
}, inspection.timeoutMs, options.signal);
|
|
193
|
+
source = {
|
|
194
|
+
ref: inspectedRef(path, bytes.byteLength, inspected),
|
|
195
|
+
bytes,
|
|
196
|
+
...options.observe ? {
|
|
197
|
+
observation: {
|
|
198
|
+
dev: after.dev,
|
|
199
|
+
ino: after.ino,
|
|
200
|
+
size: after.size,
|
|
201
|
+
nlink: after.nlink,
|
|
202
|
+
mtimeMs: after.mtimeMs,
|
|
203
|
+
ctimeMs: after.ctimeMs
|
|
204
|
+
}
|
|
205
|
+
} : {}
|
|
206
|
+
};
|
|
207
|
+
} catch (error) {
|
|
208
|
+
failed = true;
|
|
209
|
+
failure = error;
|
|
210
|
+
} finally {
|
|
211
|
+
try {
|
|
212
|
+
await handle.close();
|
|
213
|
+
} catch (error) {
|
|
214
|
+
if (!failed) {
|
|
215
|
+
failed = true;
|
|
216
|
+
failure = error;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if (failed)
|
|
221
|
+
throw failure;
|
|
222
|
+
if (source === undefined)
|
|
223
|
+
throw new Error("Read completed without a result");
|
|
224
|
+
return source;
|
|
225
|
+
}
|
|
226
|
+
|
|
152
227
|
// src/files/boundary.ts
|
|
153
228
|
var DEFAULT_MAX_BYTES = 100 * 1024 * 1024;
|
|
154
229
|
var DEFAULT_INSPECTION_BYTES = 64 * 1024;
|
|
155
230
|
var DEFAULT_INSPECTION_TIMEOUT_MS = 15000;
|
|
156
231
|
var nofollowFlag;
|
|
157
232
|
var noFollow = () => {
|
|
158
|
-
nofollowFlag ??=
|
|
233
|
+
nofollowFlag ??= constants2.O_NOFOLLOW ?? 0;
|
|
159
234
|
return nofollowFlag;
|
|
160
235
|
};
|
|
161
236
|
|
|
@@ -271,41 +346,35 @@ async function createManagedFileBoundary2(config) {
|
|
|
271
346
|
async read(path, options = {}) {
|
|
272
347
|
const resolved = targetFor(path);
|
|
273
348
|
options.signal?.throwIfAborted();
|
|
274
|
-
|
|
275
|
-
if (
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
349
|
+
let readTarget;
|
|
350
|
+
if (options.rejectSymlinks) {
|
|
351
|
+
const parent = await existingParent(root, resolved.target);
|
|
352
|
+
readTarget = resolve(parent, basename2(resolved.target));
|
|
353
|
+
} else {
|
|
354
|
+
const realTarget = await realpathOrNull(resolved.target, "failed to resolve managed file");
|
|
355
|
+
if (realTarget === null)
|
|
356
|
+
throw new ManagedFileError2("FILE_NOT_FOUND", "managed file not found");
|
|
357
|
+
if (!isWithinDir2(root, realTarget))
|
|
358
|
+
throw new ManagedFileError2("FILE_OUTSIDE_ROOT", "managed-file path escapes its boundary");
|
|
359
|
+
readTarget = realTarget;
|
|
280
360
|
}
|
|
281
361
|
const maxBytes = positiveLimit(options.maxBytes, maxReadBytes, "maxBytes");
|
|
282
|
-
let handle;
|
|
283
362
|
try {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
}
|
|
289
|
-
const bytes = await readHandle(handle, maxBytes, options.signal);
|
|
290
|
-
const inspection = await inspectFile(config.inspect, {
|
|
291
|
-
prefix: bytes.slice(0, inspectionBytes),
|
|
292
|
-
name: basename(resolved.path)
|
|
293
|
-
}, inspectionTimeoutMs, options.signal);
|
|
294
|
-
return {
|
|
295
|
-
ref: inspectedRef(resolved.path, bytes.byteLength, inspection),
|
|
296
|
-
bytes
|
|
297
|
-
};
|
|
363
|
+
return await readManagedDescriptor(readTarget, resolved.path, maxBytes, options, {
|
|
364
|
+
inspect: config.inspect,
|
|
365
|
+
bytes: inspectionBytes,
|
|
366
|
+
timeoutMs: inspectionTimeoutMs
|
|
367
|
+
});
|
|
298
368
|
} catch (error) {
|
|
299
|
-
if (options.signal?.aborted
|
|
300
|
-
throw
|
|
301
|
-
if (errorCode(error) === "
|
|
369
|
+
if (options.signal?.aborted)
|
|
370
|
+
throw options.signal.reason;
|
|
371
|
+
if (errorCode(error) === "ELOOP")
|
|
372
|
+
throw new ManagedFileError2("FILE_UNSAFE_LINK", "managed file leaf is a symlink", {
|
|
373
|
+
cause: error
|
|
374
|
+
});
|
|
375
|
+
if (errorCode(error) === "ENOENT")
|
|
302
376
|
throw new ManagedFileError2("FILE_NOT_FOUND", "managed file not found");
|
|
303
|
-
}
|
|
304
377
|
throw ioError("failed to read managed file", error);
|
|
305
|
-
} finally {
|
|
306
|
-
await handle?.close().catch(() => {
|
|
307
|
-
return;
|
|
308
|
-
});
|
|
309
378
|
}
|
|
310
379
|
},
|
|
311
380
|
async write(path, source, options = {}) {
|
|
@@ -318,7 +387,7 @@ async function createManagedFileBoundary2(config) {
|
|
|
318
387
|
let committed = false;
|
|
319
388
|
let size = 0;
|
|
320
389
|
try {
|
|
321
|
-
handle = await
|
|
390
|
+
handle = await open2(temporary, constants2.O_CREAT | constants2.O_EXCL | constants2.O_WRONLY | noFollow(), 384);
|
|
322
391
|
const written = await writeSource(handle, source, maxBytes, inspectionBytes, options.signal);
|
|
323
392
|
size = written.size;
|
|
324
393
|
if (options.durable)
|
|
@@ -328,28 +397,28 @@ async function createManagedFileBoundary2(config) {
|
|
|
328
397
|
const inspection = await inspectFile(config.inspect, {
|
|
329
398
|
prefix: written.prefix,
|
|
330
399
|
...options.mediaType ? { declaredMediaType: options.mediaType } : {},
|
|
331
|
-
name: options.name ??
|
|
400
|
+
name: options.name ?? basename2(resolved.path)
|
|
332
401
|
}, inspectionTimeoutMs, options.signal);
|
|
333
402
|
options.signal?.throwIfAborted();
|
|
334
|
-
|
|
335
|
-
await
|
|
403
|
+
try {
|
|
404
|
+
await publishAtomicFile(temporary, resolved.target, options.replace ?? false, options.durable ?? false);
|
|
336
405
|
committed = true;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
await link(temporary, resolved.target);
|
|
406
|
+
} catch (error) {
|
|
407
|
+
if (error instanceof AtomicFilePublicationError2) {
|
|
340
408
|
committed = true;
|
|
341
|
-
} catch (error) {
|
|
342
|
-
if (errorCode(error) === "EEXIST") {
|
|
343
|
-
throw new ManagedFileError2("FILE_EXISTS", "managed file already exists");
|
|
344
|
-
}
|
|
345
409
|
throw error;
|
|
346
410
|
}
|
|
411
|
+
if (errorCode(error) === "EEXIST")
|
|
412
|
+
throw new ManagedFileError2("FILE_EXISTS", "managed file already exists");
|
|
413
|
+
throw error;
|
|
347
414
|
}
|
|
348
415
|
return inspectedRef(resolved.path, size, inspection, {
|
|
349
416
|
mediaType: options.mediaType,
|
|
350
417
|
name: options.name
|
|
351
418
|
});
|
|
352
419
|
} catch (error) {
|
|
420
|
+
if (error instanceof AtomicFilePublicationError2)
|
|
421
|
+
throw error;
|
|
353
422
|
if (options.signal?.aborted && error === options.signal.reason)
|
|
354
423
|
throw error;
|
|
355
424
|
throw ioError("failed to write managed file", error);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort-race.d.ts","sourceRoot":"","sources":["../../src/internal/abort-race.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,wBAAgB,SAAS,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAsBnF"}
|
|
@@ -29,14 +29,32 @@ export interface WriteFileAtomicOptions {
|
|
|
29
29
|
* caller states, never one a default makes for them.
|
|
30
30
|
*/
|
|
31
31
|
mode?: number;
|
|
32
|
+
/** Replace by default; false atomically refuses any existing file or link. */
|
|
33
|
+
replace?: boolean;
|
|
34
|
+
/** Default file: fsync bytes. directory also syncs the parent after publication. */
|
|
35
|
+
durability?: 'none' | 'file' | 'directory';
|
|
32
36
|
}
|
|
33
37
|
/**
|
|
34
38
|
* Write `data` to `target` atomically: a reader sees the old contents or the
|
|
35
39
|
* new ones, never part of either, and the new file has `mode` from its first
|
|
36
|
-
* visible moment. A
|
|
37
|
-
*
|
|
40
|
+
* visible moment. A failure before publication leaves the target untouched. Directory-sync or
|
|
41
|
+
* staging-link cleanup failure after publication throws AtomicFilePublicationError
|
|
42
|
+
* with published=true; do not blindly repeat an external action.
|
|
38
43
|
*/
|
|
39
44
|
export declare function writeFileAtomic(target: string, data: Uint8Array | string, options?: WriteFileAtomicOptions): Promise<void>;
|
|
45
|
+
interface AtomicFileWriteIO {
|
|
46
|
+
open(path: string, flags: 'wx', mode: number): Promise<{
|
|
47
|
+
writeFile(bytes: Uint8Array): Promise<void>;
|
|
48
|
+
chmod(mode: number): Promise<void>;
|
|
49
|
+
sync(): Promise<void>;
|
|
50
|
+
close(): Promise<void>;
|
|
51
|
+
}>;
|
|
52
|
+
unlink(path: string): Promise<void>;
|
|
53
|
+
publish(staged: string, target: string, replace: boolean, directorySync: boolean): Promise<void>;
|
|
54
|
+
}
|
|
55
|
+
/** Internal syscall seam for publication-order and precommit fault controls. */
|
|
56
|
+
export declare function writeAtomicFileData(target: string, data: Uint8Array | string, options: WriteFileAtomicOptions, io?: AtomicFileWriteIO): Promise<void>;
|
|
40
57
|
/** The synchronous form of {@link writeFileAtomic}, with the same guarantees in the same order. */
|
|
41
58
|
export declare function writeFileAtomicSync(target: string, data: Uint8Array | string, options?: WriteFileAtomicOptions): void;
|
|
59
|
+
export {};
|
|
42
60
|
//# sourceMappingURL=atomic-file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atomic-file.d.ts","sourceRoot":"","sources":["../../src/internal/atomic-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;
|
|
1
|
+
{"version":3,"file":"atomic-file.d.ts","sourceRoot":"","sources":["../../src/internal/atomic-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAQH,0EAA0E;AAC1E,MAAM,WAAW,sBAAsB;IACrC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oFAAoF;IACpF,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC;CAC5C;AAYD;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,UAAU,GAAG,MAAM,EACzB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,UAAU,iBAAiB;IACzB,IAAI,CACF,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,IAAI,EACX,IAAI,EAAE,MAAM,GACX,OAAO,CAAC;QACT,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAC5C,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;QACtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;KACxB,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,OAAO,CACL,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,OAAO,GACrB,OAAO,CAAC,IAAI,CAAC,CAAC;CAClB;AAED,gFAAgF;AAChF,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,UAAU,GAAG,MAAM,EACzB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,GAAE,iBAAgE,GACnE,OAAO,CAAC,IAAI,CAAC,CAqCf;AAED,mGAAmG;AACnG,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,UAAU,GAAG,MAAM,EACzB,OAAO,GAAE,sBAA2B,GACnC,IAAI,CAiDN"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** The new target is visible; failure is not evidence that publication did not occur. */
|
|
2
|
+
export declare class AtomicFilePublicationError extends Error {
|
|
3
|
+
readonly phase: 'cleanup' | 'directory-sync' | 'directory-close';
|
|
4
|
+
readonly published = true;
|
|
5
|
+
constructor(phase: 'cleanup' | 'directory-sync' | 'directory-close', cause: unknown);
|
|
6
|
+
}
|
|
7
|
+
/** Native publication syscalls; injectable only at this internal IO boundary for fault controls. */
|
|
8
|
+
export interface PublicationIO {
|
|
9
|
+
rename(from: string, to: string): Promise<void>;
|
|
10
|
+
link(from: string, to: string): Promise<void>;
|
|
11
|
+
unlink(path: string): Promise<void>;
|
|
12
|
+
open(path: string, flags: 'r'): Promise<{
|
|
13
|
+
sync(): Promise<void>;
|
|
14
|
+
close(): Promise<void>;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
export declare function publishAtomicFile(staged: string, target: string, replace: boolean, directorySync: boolean, io?: PublicationIO): Promise<void>;
|
|
18
|
+
export declare function publishAtomicFileSync(staged: string, target: string, replace: boolean, directorySync: boolean): void;
|
|
19
|
+
//# sourceMappingURL=atomic-publication.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atomic-publication.d.ts","sourceRoot":"","sources":["../../src/internal/atomic-publication.ts"],"names":[],"mappings":"AAIA,yFAAyF;AACzF,qBAAa,0BAA2B,SAAQ,KAAK;aAGjC,KAAK,EAAE,SAAS,GAAG,gBAAgB,GAAG,iBAAiB;IAFzE,QAAQ,CAAC,SAAS,QAAQ;IAC1B,YACkB,KAAK,EAAE,SAAS,GAAG,gBAAgB,GAAG,iBAAiB,EACvE,KAAK,EAAE,OAAO,EAIf;CACF;AAED,oGAAoG;AACpG,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC;QAAE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;QAAC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,CAAC,CAAC;CAC5F;AAGD,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,OAAO,EACtB,EAAE,GAAE,aAAsB,GACzB,OAAO,CAAC,IAAI,CAAC,CAqCf;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,OAAO,GACrB,IAAI,CAmCN"}
|
|
@@ -23,6 +23,7 @@ export interface ExclusiveLockDiagnosis {
|
|
|
23
23
|
readonly liveness: 'alive' | 'gone' | 'not-probed';
|
|
24
24
|
readonly identity?: ProcessOwnerEvidence['identity'];
|
|
25
25
|
readonly owner: ExclusiveLockOwner | null;
|
|
26
|
+
readonly cause?: unknown;
|
|
26
27
|
}
|
|
27
28
|
/** A lock this process holds. */
|
|
28
29
|
export interface HeldExclusiveLock {
|
|
@@ -42,7 +43,7 @@ export interface ExclusiveLockAttemptOptions {
|
|
|
42
43
|
* How old a lock with no readable owner must be before it is taken. Absent,
|
|
43
44
|
* an ownerless lock is never taken — it may predate owner records.
|
|
44
45
|
*/
|
|
45
|
-
readonly ownerlessGraceMs?: number;
|
|
46
|
+
readonly ownerlessGraceMs?: number | null;
|
|
46
47
|
}
|
|
47
48
|
export type ExclusiveLockAttempt = {
|
|
48
49
|
readonly held: HeldExclusiveLock;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exclusive-lock.d.ts","sourceRoot":"","sources":["../../src/internal/exclusive-lock.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAEL,KAAK,oBAAoB,EAG1B,MAAM,oBAAoB,CAAC;AAK5B,gDAAgD;AAChD,QAAA,MAAM,wBAAwB;;;;;;;;;;;;;;iBAO5B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,wCAAwC;AACxC,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,WAAW,EAAE,cAAc,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;IAC5E,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,YAAY,CAAC;IACnD,QAAQ,CAAC,QAAQ,CAAC,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAC;IACrD,QAAQ,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"exclusive-lock.d.ts","sourceRoot":"","sources":["../../src/internal/exclusive-lock.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAEL,KAAK,oBAAoB,EAG1B,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,QAAQ,CAAC,SAAS,CAAC,EAAE,sBAAsB,CAAC;CAC7C,CAAC;AAmLN;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,oBAAoB,CAAC,CAqB/B;AAED,gFAAgF;AAChF,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAEpC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Validation shared by durable JSON and canonical JSON; serialization has one separate owner. */
|
|
2
|
+
export declare function isJsonData(value: unknown, limits: {
|
|
3
|
+
maxDepth: number;
|
|
4
|
+
maxNodes: number;
|
|
5
|
+
maxBytes: number;
|
|
6
|
+
omitObjectUndefined: boolean;
|
|
7
|
+
}): boolean;
|
|
8
|
+
//# sourceMappingURL=json-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-data.d.ts","sourceRoot":"","sources":["../../src/internal/json-data.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,wBAAgB,UAAU,CACxB,KAAK,EAAE,OAAO,EACd,MAAM,EAAE;IACN,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB,EAAE,OAAO,CAAC;CAC9B,GACA,OAAO,CA0DT"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { probeLiveness } from './process-identity.js';
|
|
3
2
|
export declare const ProcessInstanceSchema: z.ZodObject<{
|
|
4
3
|
platform: z.ZodEnum<{
|
|
5
4
|
darwin: "darwin";
|
|
@@ -10,17 +9,55 @@ export declare const ProcessInstanceSchema: z.ZodObject<{
|
|
|
10
9
|
startId: z.ZodString;
|
|
11
10
|
}, z.core.$strict>;
|
|
12
11
|
export type ProcessInstance = z.infer<typeof ProcessInstanceSchema>;
|
|
12
|
+
/** An unavailable observation preserves its native or validation cause; it never proves death. */
|
|
13
|
+
declare const ProcessInstanceObservationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
14
|
+
state: z.ZodLiteral<"observed">;
|
|
15
|
+
instance: z.ZodObject<{
|
|
16
|
+
platform: z.ZodEnum<{
|
|
17
|
+
darwin: "darwin";
|
|
18
|
+
linux: "linux";
|
|
19
|
+
}>;
|
|
20
|
+
bootId: z.ZodString;
|
|
21
|
+
namespace: z.ZodString;
|
|
22
|
+
startId: z.ZodString;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
25
|
+
state: z.ZodLiteral<"unavailable">;
|
|
26
|
+
cause: z.ZodUnknown;
|
|
27
|
+
}, z.core.$strip>], "state">;
|
|
28
|
+
export type ProcessInstanceObservation = z.infer<typeof ProcessInstanceObservationSchema>;
|
|
29
|
+
export declare function observeProcessInstance(pid: number): Promise<ProcessInstanceObservation>;
|
|
13
30
|
/** /proc stat field 22 follows a command name that may itself contain spaces and parentheses. */
|
|
14
31
|
export declare function linuxProcessStart(stat: string, pid: number): string | null;
|
|
15
32
|
/** @internal procRoot permits kernel-format fixtures without changing a real process or boot. */
|
|
16
33
|
export declare function readProcessInstance(pid: number, procRoot?: string): Promise<ProcessInstance | null>;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
34
|
+
/** @internal The fixture root is never a public owner option. */
|
|
35
|
+
export declare function observeProcessInstanceAt(pid: number, procRoot: string): Promise<ProcessInstanceObservation>;
|
|
36
|
+
declare const ProcessOwnerEvidenceSchema: z.ZodObject<{
|
|
37
|
+
liveness: z.ZodEnum<{
|
|
38
|
+
alive: "alive";
|
|
39
|
+
gone: "gone";
|
|
40
|
+
"not-probed": "not-probed";
|
|
41
|
+
}>;
|
|
42
|
+
identity: z.ZodEnum<{
|
|
43
|
+
"different-boot": "different-boot";
|
|
44
|
+
legacy: "legacy";
|
|
45
|
+
matched: "matched";
|
|
46
|
+
"pid-gone": "pid-gone";
|
|
47
|
+
"reused-pid": "reused-pid";
|
|
48
|
+
unavailable: "unavailable";
|
|
49
|
+
}>;
|
|
50
|
+
cause: z.ZodOptional<z.ZodUnknown>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export type ProcessOwnerEvidence = z.infer<typeof ProcessOwnerEvidenceSchema>;
|
|
21
53
|
/** Compare identities only inside one machine (the caller establishes that boundary). */
|
|
22
|
-
export declare function probeProcessOwner(pid: number, recorded: ProcessInstance | null | undefined
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
54
|
+
export declare function probeProcessOwner(pid: number, recorded: ProcessInstance | null | undefined): Promise<ProcessOwnerEvidence>;
|
|
55
|
+
interface ProcessOwnerProbes {
|
|
56
|
+
read(pid: number): Promise<ProcessInstance | null>;
|
|
57
|
+
liveness(pid: number): Promise<'alive' | 'gone'>;
|
|
58
|
+
observe?(pid: number): Promise<ProcessInstanceObservation>;
|
|
59
|
+
}
|
|
60
|
+
/** @internal Injection is for kernel-format controls, not a public ownership assertion. */
|
|
61
|
+
export declare function probeProcessOwnerWith(pid: number, recorded: ProcessInstance | null | undefined, probes?: ProcessOwnerProbes): Promise<ProcessOwnerEvidence>;
|
|
62
|
+
export {};
|
|
26
63
|
//# sourceMappingURL=process-instance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-instance.d.ts","sourceRoot":"","sources":["../../src/internal/process-instance.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"process-instance.d.ts","sourceRoot":"","sources":["../../src/internal/process-instance.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,qBAAqB;;;;;;;;kBAOvB,CAAC;AACZ,MAAM,MAAM,eAAe,GAAG,C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,2FAA2F;AAC3F,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,EAC5C,MAAM,GAAE,kBAA2E,GAClF,OAAO,CAAC,oBAAoB,CAAC,CA2C/B"}
|
|
@@ -18,7 +18,7 @@ export interface ExclusiveLockOptions {
|
|
|
18
18
|
timeoutMs?: number;
|
|
19
19
|
/** Stops the wait; an abort while waiting rejects at once with its reason as the cause. */
|
|
20
20
|
signal?: AbortSignal;
|
|
21
|
-
/**
|
|
21
|
+
/** Exact permission bits, independent of umask. Default `0o600`. Shared readers need a common group and traversable parents. */
|
|
22
22
|
mode?: number;
|
|
23
23
|
/**
|
|
24
24
|
* This machine's identity, for a platform that offers none (`/etc/machine-id`
|
|
@@ -29,9 +29,10 @@ export interface ExclusiveLockOptions {
|
|
|
29
29
|
/**
|
|
30
30
|
* How old a lock with no readable owner must be before it is taken — the one
|
|
31
31
|
* case where time decides, left by a process that died between creating the
|
|
32
|
-
* file and recording itself. Default 5 000
|
|
32
|
+
* file and recording itself. Default 5 000; `null` disables age-based reclaim,
|
|
33
|
+
* including abandoned ownerless reclaim guards.
|
|
33
34
|
*/
|
|
34
|
-
ownerlessGraceMs?: number;
|
|
35
|
+
ownerlessGraceMs?: number | null;
|
|
35
36
|
}
|
|
36
37
|
/** The lock `run` executes under. */
|
|
37
38
|
export interface ExclusiveLock {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-exclusive-lock.d.ts","sourceRoot":"","sources":["../../src/internal/with-exclusive-lock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,4CAA4C;AAC5C,MAAM,WAAW,oBAAoB;IACnC,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gG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EAC1C,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAG9B;CACF;AAyCD;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EACvC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAC5C,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,CAAC,CAAC,CA4DZ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const CanonicalJsonOptionsSchema: z.ZodObject<{
|
|
3
|
+
maxDepth: z.ZodDefault<z.ZodNumber>;
|
|
4
|
+
maxNodes: z.ZodDefault<z.ZodNumber>;
|
|
5
|
+
maxBytes: z.ZodDefault<z.ZodNumber>;
|
|
6
|
+
}, z.core.$strict>;
|
|
7
|
+
export type CanonicalJsonOptions = z.input<typeof CanonicalJsonOptionsSchema>;
|
|
8
|
+
/** Bounded plain JSON, UTF-16 sorted keys; undefined object members are omitted. */
|
|
9
|
+
export declare function canonicalJson(value: unknown, options?: CanonicalJsonOptions): string;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=canonical-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-json.d.ts","sourceRoot":"","sources":["../../src/primitives/canonical-json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,QAAA,MAAM,0BAA0B;;;;kBAQ9B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,oFAAoF;AACpF,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAE,oBAAyB,GAAG,MAAM,CAOxF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { type AuditOmitPolicy, type AuditPolicy, type AuditRecord, type AuditRecordPolicy, AuditRecordSchema, assertAuditDeclared, audit, type CreateAuditRecordInput, createAuditRecord, } from './audit.js';
|
|
2
|
+
export { type CanonicalJsonOptions, canonicalJson } from './canonical-json.js';
|
|
2
3
|
export { type DeadlineResult, DeadlineResultSchema, defineDeadlinePolicy, } from './deadline.js';
|
|
3
4
|
export { type DomainEventDeliveryClaim, DomainEventDeliveryClaimSchema, type DomainEventDeliveryOutcome, DomainEventDeliveryOutcomeSchema, type DomainEventDeliveryPlan, type DomainEventDestination, DomainEventDestinationSchema, type DomainEventDispatchResult, type DomainEventOutbox, type DomainEventRoute, type DomainEventTransport, defineDomainEventDelivery, } from './delivery.js';
|
|
4
5
|
export { createDomainEventSchema, type DomainEvent, type DomainEventActor, DomainEventActorSchema, DomainEventSchema, type DomainEventSubject, DomainEventSubjectSchema, } from './event.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/primitives/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,EACL,KAAK,sBAAsB,EAC3B,iBAAiB,GAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,KAAK,cAAc,EACnB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,wBAAwB,EAC7B,8BAA8B,EAC9B,KAAK,0BAA0B,EAC/B,gCAAgC,EAChC,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,4BAA4B,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,uBAAuB,EACvB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,KAAK,kBAAkB,EACvB,wBAAwB,GACzB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAC7B,8BAA8B,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,GAChC,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,UAAU,EACf,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,UAAU,EACf,aAAa,EACb,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,gBAAgB,EAChB,KAAK,UAAU,EACf,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,sBAAsB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,wBAAwB,EACxB,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/primitives/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,iBAAiB,EACjB,mBAA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,EAChB,KAAK,UAAU,EACf,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,sBAAsB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,wBAAwB,EACxB,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ChildProcessWithoutNullStreams } from 'node:child_process';
|
|
2
|
+
import { type NativeCommandOptions } from './contract.js';
|
|
3
|
+
/** One-shot native execution; sandbox policy/admission is composed above this owner. */
|
|
4
|
+
export declare function startNativeCommand(input: NativeCommandOptions, onSpawn?: (child: ChildProcessWithoutNullStreams) => void): {
|
|
5
|
+
result: Promise<{
|
|
6
|
+
exitCode: number | null;
|
|
7
|
+
signal: string | null;
|
|
8
|
+
stdout: Uint8Array<ArrayBuffer>;
|
|
9
|
+
stderr: Uint8Array<ArrayBuffer>;
|
|
10
|
+
}>;
|
|
11
|
+
stop(): Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=command-owner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-owner.d.ts","sourceRoot":"","sources":["../../src/process/command-owner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,8BAA8B,EAAS,MAAM,oBAAoB,CAAC;AAGhF,OAAO,EAEL,KAAK,oBAAoB,EAI1B,MAAM,YAAY,CAAC;AAIpB,wFAAwF;AACxF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,oBAAoB,EAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,8BAA8B,KAAK,IAAI;;;;;;;;EA+J1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/process/command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAE5E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAE1F"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const NativeCommandSettlementSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3
|
+
kind: z.ZodLiteral<"exit">;
|
|
4
|
+
exitCode: z.ZodNullable<z.ZodNumber>;
|
|
5
|
+
signal: z.ZodNullable<z.ZodString>;
|
|
6
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
7
|
+
kind: z.ZodLiteral<"error">;
|
|
8
|
+
cause: z.ZodUnknown;
|
|
9
|
+
}, z.core.$strip>], "kind">;
|
|
10
|
+
export type NativeCommandSettlement = z.infer<typeof NativeCommandSettlementSchema>;
|
|
11
|
+
export declare const NativeCommandOptionsSchema: z.ZodObject<{
|
|
12
|
+
executable: z.ZodString;
|
|
13
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
14
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
15
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
16
|
+
envPolicy: z.ZodDefault<z.ZodEnum<{
|
|
17
|
+
ambient: "ambient";
|
|
18
|
+
"declared-only": "declared-only";
|
|
19
|
+
}>>;
|
|
20
|
+
signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
|
|
21
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
maxOutputBytes: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
capture: z.ZodDefault<z.ZodBoolean>;
|
|
24
|
+
stdin: z.ZodOptional<z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
25
|
+
maxStdinBytes: z.ZodDefault<z.ZodNumber>;
|
|
26
|
+
onOutput: z.ZodOptional<z.ZodCustom<(bytes: Uint8Array, channel: 'stdout' | 'stderr', signal: AbortSignal) => void | Promise<void>, (bytes: Uint8Array, channel: 'stdout' | 'stderr', signal: AbortSignal) => void | Promise<void>>>;
|
|
27
|
+
onLeaderSettled: z.ZodOptional<z.ZodCustom<(event: NativeCommandSettlement, signal: AbortSignal) => void | Promise<void>, (event: NativeCommandSettlement, signal: AbortSignal) => void | Promise<void>>>;
|
|
28
|
+
killGraceMs: z.ZodDefault<z.ZodNumber>;
|
|
29
|
+
cleanupTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
export type NativeCommandOptions = z.input<typeof NativeCommandOptionsSchema>;
|
|
32
|
+
export type ParsedNativeCommandOptions = z.output<typeof NativeCommandOptionsSchema>;
|
|
33
|
+
declare const NativeCommandResultSchema: z.ZodObject<{
|
|
34
|
+
exitCode: z.ZodNullable<z.ZodNumber>;
|
|
35
|
+
signal: z.ZodNullable<z.ZodString>;
|
|
36
|
+
stdout: z.ZodInstanceOf<Uint8Array<ArrayBuffer>>;
|
|
37
|
+
stderr: z.ZodInstanceOf<Uint8Array<ArrayBuffer>>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
export type NativeCommandResult = z.infer<typeof NativeCommandResultSchema>;
|
|
40
|
+
export declare class NativeCommandError extends Error {
|
|
41
|
+
readonly code: 'COMMAND_LIMIT' | 'COMMAND_UNAVAILABLE' | 'COMMAND_CLEANUP';
|
|
42
|
+
constructor(code: 'COMMAND_LIMIT' | 'COMMAND_UNAVAILABLE' | 'COMMAND_CLEANUP', message: string, options?: ErrorOptions);
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/process/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,6BAA6B;;;;;;;2BAOjC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;gDAoBtB,UAAU,WACR,QAAQ,GAAG,QAAQ,UACpB,WAAW,KAChB,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;uDAKX,uBAAuB,UAAU,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;;;kBAiBvF,CAAC;AACL,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAC;AACrF,QAAA,MAAM,yBAAyB;;;;;iBAK7B,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,qBAAa,kBAAmB,SAAQ,KAAK;aAEzB,IAAI,EAAE,eAAe,GAAG,qBAAqB,GAAG,iBAAiB;IADnF,YACkB,IAAI,EAAE,eAAe,GAAG,qBAAqB,GAAG,iBAAiB,EACjF,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,YAAY,EAIvB;CACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NativeCommandError } from './contract.js';
|
|
2
|
+
export declare function signalGroup(pid: number | undefined, signal: NodeJS.Signals): void;
|
|
3
|
+
export declare function stopCommandGroup(pid: number | undefined, graceMs: number, cleanupTimeoutMs?: number): Promise<void>;
|
|
4
|
+
export declare function commandCleanupError(cause: unknown): NativeCommandError;
|
|
5
|
+
export declare function waitForCommandClose<T>(closed: Promise<T>, timeoutMs: number): Promise<T>;
|
|
6
|
+
//# sourceMappingURL=group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../src/process/group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAWhD,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAOjF;AAiCD,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,OAAO,EAAE,MAAM,EACf,gBAAgB,SAAO,GACtB,OAAO,CAAC,IAAI,CAAC,CASf;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,CAItE;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAExF"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NativeCommandSettlement, ParsedNativeCommandOptions } from './contract.js';
|
|
2
|
+
/** One bounded external resource settlement, shared by observed exit and terminal failure. */
|
|
3
|
+
export declare function createLeaderSettlement(options: ParsedNativeCommandOptions, signal: AbortSignal): (event: NativeCommandSettlement) => Promise<void>;
|
|
4
|
+
//# sourceMappingURL=leader-settlement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leader-settlement.d.ts","sourceRoot":"","sources":["../../src/process/leader-settlement.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAGtF,8FAA8F;AAC9F,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,0BAA0B,EACnC,MAAM,EAAE,WAAW,WAGJ,uBAAuB,KAAG,OAAO,CAAC,IAAI,CAAC,CA+BvD"}
|