stitchkit 0.136.4 → 0.136.5
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 +7 -0
- package/dist/entrypoints/agent-executor/acp.js +5 -5
- package/dist/entrypoints/agent-executor/claude-sdk.js +7 -7
- package/dist/entrypoints/agent-executor/claude.js +7 -7
- package/dist/entrypoints/agent-executor/codex.js +9 -9
- package/dist/entrypoints/agent-executor/testing.js +9 -9
- package/dist/entrypoints/agent-executor.js +5 -5
- package/dist/entrypoints/agent-runtime/coding-tools.js +2 -2
- package/dist/entrypoints/agent-runtime/postgres.js +4 -4
- package/dist/entrypoints/agent-runtime/sandbox.js +7 -7
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +5 -5
- package/dist/entrypoints/agent-runtime/sqlite/node.js +5 -5
- package/dist/entrypoints/agent-runtime/testing.js +4 -4
- package/dist/entrypoints/agent-runtime.js +4 -4
- package/dist/entrypoints/application/diagnostic-journal.js +3 -3
- package/dist/entrypoints/application/directory-inbox.js +7 -7
- package/dist/entrypoints/cli/publish.d.ts +14 -6
- package/dist/entrypoints/cli/publish.d.ts.map +1 -1
- package/dist/entrypoints/cli/publish.js +685 -30
- package/dist/entrypoints/cli.js +7 -124
- package/dist/entrypoints/files/packaging.js +2 -2
- package/dist/entrypoints/files.d.ts +1 -0
- package/dist/entrypoints/files.d.ts.map +1 -1
- package/dist/entrypoints/files.js +9 -9
- package/dist/entrypoints/node.js +3 -3
- package/dist/entrypoints/observability.js +1 -1
- package/dist/entrypoints/process.js +3 -3
- package/dist/entrypoints/server.js +6 -6
- package/dist/entrypoints/service-host/macos.js +7 -7
- package/dist/entrypoints/service-host/work.js +6 -6
- package/dist/entrypoints/service-host.js +9 -9
- package/dist/entrypoints/spend.js +1 -1
- package/dist/entrypoints/telegram.js +3 -3
- package/dist/entrypoints/tools.js +1 -1
- package/dist/{index-05b65gj4.js → index-0s75mjh7.js} +1 -1
- package/dist/{index-s2e3h616.js → index-150b1qyw.js} +10 -1
- package/dist/{index-tcv71frn.js → index-1fhbe4e4.js} +1 -1
- package/dist/{index-8cek82ar.js → index-1h0dtfz3.js} +1 -1
- package/dist/{index-jwtmw39p.js → index-2qnqvq11.js} +1 -1
- package/dist/index-2rs7ze0q.js +376 -0
- package/dist/{index-2wm9b9vs.js → index-3cwq5byx.js} +2 -2
- package/dist/{index-mtpcax6d.js → index-5md04mwc.js} +3 -3
- package/dist/{index-b0mh2t9x.js → index-67mzzkdv.js} +3 -3
- package/dist/{index-d5mhgx72.js → index-8tn10tp6.js} +1 -1
- package/dist/{index-0sxj3y45.js → index-afaq0nc4.js} +1 -1
- package/dist/{index-nfm15ej7.js → index-bbpygynk.js} +1 -1
- package/dist/{index-g04hszcm.js → index-chapre0y.js} +1 -1
- package/dist/{index-vh4291qh.js → index-ctaxjpa4.js} +1 -1
- package/dist/{index-x1r7kxzd.js → index-e4zt2x70.js} +3 -3
- package/dist/{index-s0n0nnz5.js → index-f103md2v.js} +122 -3
- package/dist/{index-2c5w2d1d.js → index-gyfsh29t.js} +1 -1
- package/dist/{index-kgkevngs.js → index-kadgaw1s.js} +4 -4
- package/dist/{index-ca1v40d3.js → index-kd48gk7d.js} +1 -1
- package/dist/{index-ke6jtxkd.js → index-mr3njw67.js} +1 -1
- package/dist/{index-cmqvf0dz.js → index-ppy23bd2.js} +1 -1
- package/dist/{index-43k180c2.js → index-rnhp7je8.js} +2 -2
- package/dist/{index-2tgmggcm.js → index-smvmnz5y.js} +1 -1
- package/dist/{index-9m1m92rg.js → index-tjhhsnjv.js} +1 -1
- package/dist/{index-64t6pheq.js → index-w161azza.js} +1 -1
- package/dist/{index-mttkdm5a.js → index-xqppqn97.js} +1 -1
- package/dist/{index-sjq4akrx.js → index-xsrma0jd.js} +2 -2
- package/dist/{index-zqc64g69.js → index-ypm85xwe.js} +1 -1
- package/dist/{index-zagc12j1.js → index-zcq3dby3.js} +1 -1
- package/dist/{index-29v1p1f4.js → index-zhngww7q.js} +1 -1
- package/dist/internal/atomic-file-owner.d.ts +91 -0
- package/dist/internal/atomic-file-owner.d.ts.map +1 -0
- package/dist/internal/atomic-file.d.ts +29 -7
- package/dist/internal/atomic-file.d.ts.map +1 -1
- package/dist/internal/bounded-file-read.d.ts +6 -2
- package/dist/internal/bounded-file-read.d.ts.map +1 -1
- package/dist/tools/cli/distribution-config.d.ts +56 -0
- package/dist/tools/cli/distribution-config.d.ts.map +1 -0
- package/dist/tools/cli/distribution-routes.d.ts +20 -0
- package/dist/tools/cli/distribution-routes.d.ts.map +1 -0
- package/dist/tools/cli/publication-source.d.ts +77 -0
- package/dist/tools/cli/publication-source.d.ts.map +1 -0
- package/llms/cli-publish.txt +15 -3
- package/llms/cli.2.txt +84 -63
- package/llms/cli.3.txt +67 -1
- package/llms/cli.txt +1 -1
- package/llms/files.txt +1 -1
- package/llms/process.txt +24 -4
- package/llms/stitchkit.txt +1 -1
- package/llms-full.txt +124 -9
- package/llms.txt +5 -5
- package/package.json +1 -1
- package/dist/index-pp97q86a.js +0 -221
- package/dist/{index-5c4m8zdf.js → index-tjakdpf2.js} +45 -45
package/dist/index-pp97q86a.js
DELETED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AtomicFilePublicationError2,
|
|
3
|
-
assertDirectoryDurability,
|
|
4
|
-
syncDirectory,
|
|
5
|
-
publishAtomicFile,
|
|
6
|
-
publishAtomicFileSync
|
|
7
|
-
} from "./index-2c5w2d1d.js";
|
|
8
|
-
import {
|
|
9
|
-
closeAfter,
|
|
10
|
-
closeAfterSync,
|
|
11
|
-
readBoundedFile,
|
|
12
|
-
readBoundedFileSync
|
|
13
|
-
} from "./index-s2e3h616.js";
|
|
14
|
-
import {
|
|
15
|
-
stagingPath
|
|
16
|
-
} from "./index-psye60qn.js";
|
|
17
|
-
import {
|
|
18
|
-
errnoOf
|
|
19
|
-
} from "./index-jj9228tt.js";
|
|
20
|
-
|
|
21
|
-
// src/internal/atomic-file.ts
|
|
22
|
-
import { closeSync, fchmodSync, fsyncSync, openSync, unlinkSync, writeSync } from "node:fs";
|
|
23
|
-
import { open, unlink } from "node:fs/promises";
|
|
24
|
-
import { dirname } from "node:path";
|
|
25
|
-
var DEFAULT_MODE = 384;
|
|
26
|
-
function bytesOf(data) {
|
|
27
|
-
return typeof data === "string" ? new TextEncoder().encode(data) : data;
|
|
28
|
-
}
|
|
29
|
-
function assertWriteOptions(options) {
|
|
30
|
-
if (options.idempotent === true && options.replace !== false) {
|
|
31
|
-
throw new TypeError('writeFileAtomic option "idempotent: true" requires "replace: false"');
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function bytesEqual(left, right) {
|
|
35
|
-
if (left.byteLength !== right.byteLength)
|
|
36
|
-
return false;
|
|
37
|
-
for (let index = 0;index < left.byteLength; index += 1) {
|
|
38
|
-
if (left[index] !== right[index])
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
function modeMatches(actualMode, expectedMode) {
|
|
44
|
-
if (process.platform === "win32")
|
|
45
|
-
return true;
|
|
46
|
-
return actualMode !== undefined && (actualMode & 4095) === (expectedMode & 4095);
|
|
47
|
-
}
|
|
48
|
-
function syncDirectorySync(dir) {
|
|
49
|
-
assertDirectoryDurability();
|
|
50
|
-
const descriptor = openSync(dir, "r");
|
|
51
|
-
closeAfterSync(() => closeSync(descriptor), () => fsyncSync(descriptor));
|
|
52
|
-
}
|
|
53
|
-
async function writeAllBytes(file, bytes) {
|
|
54
|
-
for (let offset = 0;offset < bytes.byteLength; ) {
|
|
55
|
-
const { bytesWritten } = await file.write(bytes, offset, bytes.byteLength - offset);
|
|
56
|
-
if (bytesWritten === 0)
|
|
57
|
-
throw new Error("zero-byte atomic-file write");
|
|
58
|
-
offset += bytesWritten;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
async function writeFileAtomic2(target, data, options = {}) {
|
|
62
|
-
return writeAtomicFileData(target, data, options);
|
|
63
|
-
}
|
|
64
|
-
function isMissing(error) {
|
|
65
|
-
return errnoOf(error) === "ENOENT";
|
|
66
|
-
}
|
|
67
|
-
async function publishMaybeIdempotent(staged, target, mode, options, expectedBytes, io) {
|
|
68
|
-
const publishOptions = {
|
|
69
|
-
replace: options.replace ?? true,
|
|
70
|
-
durability: options.durability ?? "file"
|
|
71
|
-
};
|
|
72
|
-
try {
|
|
73
|
-
await io.publish(staged, target, publishOptions);
|
|
74
|
-
return;
|
|
75
|
-
} catch (error) {
|
|
76
|
-
if (options.idempotent !== true || errnoOf(error) !== "EEXIST" || expectedBytes === undefined) {
|
|
77
|
-
throw error;
|
|
78
|
-
}
|
|
79
|
-
const readExisting = io.readExisting ?? ((path, maxBytes) => readBoundedFile(path, maxBytes, { rejectSymlinks: true }));
|
|
80
|
-
let existing;
|
|
81
|
-
try {
|
|
82
|
-
existing = await readExisting(target, expectedBytes.byteLength);
|
|
83
|
-
} catch (readError) {
|
|
84
|
-
if (isMissing(readError)) {
|
|
85
|
-
await io.publish(staged, target, publishOptions);
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
throw error;
|
|
89
|
-
}
|
|
90
|
-
if (!modeMatches(existing.mode, mode) || !bytesEqual(existing.bytes, expectedBytes)) {
|
|
91
|
-
throw error;
|
|
92
|
-
}
|
|
93
|
-
try {
|
|
94
|
-
await io.unlink(staged);
|
|
95
|
-
} catch (cleanup) {
|
|
96
|
-
if (!isMissing(cleanup))
|
|
97
|
-
throw new AtomicFilePublicationError2("cleanup", cleanup);
|
|
98
|
-
}
|
|
99
|
-
if (publishOptions.durability === "directory") {
|
|
100
|
-
try {
|
|
101
|
-
const syncDir = io.syncDir ?? syncDirectory;
|
|
102
|
-
await syncDir(dirname(target));
|
|
103
|
-
} catch (syncError) {
|
|
104
|
-
throw new AtomicFilePublicationError2("directory-sync", syncError);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
async function writeAtomicFileStaged(target, stage, options, io = { open, unlink, publish: publishAtomicFile }) {
|
|
110
|
-
assertWriteOptions(options);
|
|
111
|
-
const mode = options.mode ?? DEFAULT_MODE;
|
|
112
|
-
const staged = stagingPath(target);
|
|
113
|
-
const file = await io.open(staged, "wx", mode);
|
|
114
|
-
try {
|
|
115
|
-
const value = await closeAfter(file, async () => {
|
|
116
|
-
const filled = await stage.fill(file);
|
|
117
|
-
await file.chmod(mode);
|
|
118
|
-
if (options.durability !== "none")
|
|
119
|
-
await file.sync();
|
|
120
|
-
return filled;
|
|
121
|
-
});
|
|
122
|
-
await publishMaybeIdempotent(staged, target, mode, options, stage.expectedBytes, io);
|
|
123
|
-
return value;
|
|
124
|
-
} catch (error) {
|
|
125
|
-
await io.unlink(staged).catch((cleanup) => {
|
|
126
|
-
if (!isMissing(cleanup))
|
|
127
|
-
stage.onCleanupError?.(cleanup);
|
|
128
|
-
});
|
|
129
|
-
throw error;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
async function writeAtomicFileData(target, data, options, io) {
|
|
133
|
-
const bytes = bytesOf(data);
|
|
134
|
-
await writeAtomicFileStaged(target, { fill: (file) => writeAllBytes(file, bytes), expectedBytes: bytes }, options, io);
|
|
135
|
-
}
|
|
136
|
-
var nativeSync = {
|
|
137
|
-
open(path, flags, mode) {
|
|
138
|
-
const descriptor = openSync(path, flags, mode);
|
|
139
|
-
return {
|
|
140
|
-
write: (bytes, offset, length) => writeSync(descriptor, bytes, offset, length),
|
|
141
|
-
chmod: (bits) => fchmodSync(descriptor, bits),
|
|
142
|
-
sync: () => fsyncSync(descriptor),
|
|
143
|
-
close: () => closeSync(descriptor)
|
|
144
|
-
};
|
|
145
|
-
},
|
|
146
|
-
unlink: unlinkSync,
|
|
147
|
-
publish: publishAtomicFileSync
|
|
148
|
-
};
|
|
149
|
-
function publishMaybeIdempotentSync(staged, target, mode, options, expectedBytes, io) {
|
|
150
|
-
const publishOptions = {
|
|
151
|
-
replace: options.replace ?? true,
|
|
152
|
-
durability: options.durability ?? "file"
|
|
153
|
-
};
|
|
154
|
-
try {
|
|
155
|
-
io.publish(staged, target, publishOptions);
|
|
156
|
-
return;
|
|
157
|
-
} catch (error) {
|
|
158
|
-
if (options.idempotent !== true || errnoOf(error) !== "EEXIST") {
|
|
159
|
-
throw error;
|
|
160
|
-
}
|
|
161
|
-
const readExisting = io.readExisting ?? ((path, maxBytes) => readBoundedFileSync(path, maxBytes, { rejectSymlinks: true }));
|
|
162
|
-
let existing;
|
|
163
|
-
try {
|
|
164
|
-
existing = readExisting(target, expectedBytes.byteLength);
|
|
165
|
-
} catch (readError) {
|
|
166
|
-
if (isMissing(readError)) {
|
|
167
|
-
io.publish(staged, target, publishOptions);
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
throw error;
|
|
171
|
-
}
|
|
172
|
-
if (!modeMatches(existing.mode, mode) || !bytesEqual(existing.bytes, expectedBytes)) {
|
|
173
|
-
throw error;
|
|
174
|
-
}
|
|
175
|
-
try {
|
|
176
|
-
io.unlink(staged);
|
|
177
|
-
} catch (cleanup) {
|
|
178
|
-
if (!isMissing(cleanup))
|
|
179
|
-
throw new AtomicFilePublicationError2("cleanup", cleanup);
|
|
180
|
-
}
|
|
181
|
-
if (publishOptions.durability === "directory") {
|
|
182
|
-
try {
|
|
183
|
-
const syncDir = io.syncDir ?? syncDirectorySync;
|
|
184
|
-
syncDir(dirname(target));
|
|
185
|
-
} catch (syncError) {
|
|
186
|
-
throw new AtomicFilePublicationError2("directory-sync", syncError);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
function writeAtomicFileDataSync(target, data, options, io = nativeSync) {
|
|
192
|
-
assertWriteOptions(options);
|
|
193
|
-
const mode = options.mode ?? DEFAULT_MODE;
|
|
194
|
-
const bytes = bytesOf(data);
|
|
195
|
-
const staged = stagingPath(target);
|
|
196
|
-
const file = io.open(staged, "wx", mode);
|
|
197
|
-
try {
|
|
198
|
-
closeAfterSync(() => file.close(), () => {
|
|
199
|
-
for (let offset = 0;offset < bytes.byteLength; ) {
|
|
200
|
-
const written = file.write(bytes, offset, bytes.byteLength - offset);
|
|
201
|
-
if (written === 0)
|
|
202
|
-
throw new Error("zero-byte atomic-file write");
|
|
203
|
-
offset += written;
|
|
204
|
-
}
|
|
205
|
-
file.chmod(mode);
|
|
206
|
-
if (options.durability !== "none")
|
|
207
|
-
file.sync();
|
|
208
|
-
});
|
|
209
|
-
publishMaybeIdempotentSync(staged, target, mode, options, bytes, io);
|
|
210
|
-
} catch (error) {
|
|
211
|
-
try {
|
|
212
|
-
io.unlink(staged);
|
|
213
|
-
} catch {}
|
|
214
|
-
throw error;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
function writeFileAtomicSync2(target, data, options = {}) {
|
|
218
|
-
writeAtomicFileDataSync(target, data, options);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
export { writeAllBytes, writeFileAtomic2, writeAtomicFileStaged, writeAtomicFileData, writeFileAtomicSync2 };
|
|
@@ -337,6 +337,51 @@ function waitForCommandClose(closed, timeoutMs) {
|
|
|
337
337
|
return raceAbort(closed, deadline.signal).finally(() => deadline.cancel());
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
+
// src/process/cleanup.ts
|
|
341
|
+
async function cleanupNativeCommand(input) {
|
|
342
|
+
const signalled = Promise.resolve().then(input.signal);
|
|
343
|
+
const teardown = () => input.transport?.destroy();
|
|
344
|
+
const destroyed = signalled.then(teardown, teardown);
|
|
345
|
+
const awaitRelease = async () => {
|
|
346
|
+
if (!input.transport)
|
|
347
|
+
return;
|
|
348
|
+
try {
|
|
349
|
+
await waitForCommandClose(input.transport.released, input.timeoutMs);
|
|
350
|
+
} catch (cause) {
|
|
351
|
+
throw new Error(`Command handles remained open: ${[...input.transport.pendingHandles].join(", ")}`, { cause });
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
const released = signalled.then(awaitRelease, () => {
|
|
355
|
+
return;
|
|
356
|
+
});
|
|
357
|
+
const stopped = async () => {
|
|
358
|
+
const failed = { kind: "error", cause: input.error };
|
|
359
|
+
if (!input.transport)
|
|
360
|
+
return failed;
|
|
361
|
+
await signalled.catch(() => {
|
|
362
|
+
return;
|
|
363
|
+
});
|
|
364
|
+
const leader = await waitForCommandClose(input.transport.leader, input.timeoutMs).catch(() => {
|
|
365
|
+
return;
|
|
366
|
+
});
|
|
367
|
+
return leader?.kind === "exit" ? {
|
|
368
|
+
kind: "stopped",
|
|
369
|
+
cause: input.error,
|
|
370
|
+
exitCode: leader.exitCode,
|
|
371
|
+
signal: leader.signal
|
|
372
|
+
} : failed;
|
|
373
|
+
};
|
|
374
|
+
const cleanup = await Promise.allSettled([
|
|
375
|
+
input.event ? input.settle(input.event) : stopped().then(input.settle),
|
|
376
|
+
destroyed,
|
|
377
|
+
signalled,
|
|
378
|
+
released
|
|
379
|
+
]);
|
|
380
|
+
const failures = cleanup.flatMap((item) => item.status === "rejected" && item.reason !== input.error ? [item.reason] : []);
|
|
381
|
+
if (failures.length)
|
|
382
|
+
throw commandCleanupError(new AggregateError([input.error, ...failures], "Command failed and cleanup failed"));
|
|
383
|
+
}
|
|
384
|
+
|
|
340
385
|
// src/process/command-lifetime.ts
|
|
341
386
|
class CommandStopped extends DOMException {
|
|
342
387
|
constructor() {
|
|
@@ -384,51 +429,6 @@ function createCommandLifetime(input) {
|
|
|
384
429
|
};
|
|
385
430
|
}
|
|
386
431
|
|
|
387
|
-
// src/process/cleanup.ts
|
|
388
|
-
async function cleanupNativeCommand(input) {
|
|
389
|
-
const signalled = Promise.resolve().then(input.signal);
|
|
390
|
-
const teardown = () => input.transport?.destroy();
|
|
391
|
-
const destroyed = signalled.then(teardown, teardown);
|
|
392
|
-
const awaitRelease = async () => {
|
|
393
|
-
if (!input.transport)
|
|
394
|
-
return;
|
|
395
|
-
try {
|
|
396
|
-
await waitForCommandClose(input.transport.released, input.timeoutMs);
|
|
397
|
-
} catch (cause) {
|
|
398
|
-
throw new Error(`Command handles remained open: ${[...input.transport.pendingHandles].join(", ")}`, { cause });
|
|
399
|
-
}
|
|
400
|
-
};
|
|
401
|
-
const released = signalled.then(awaitRelease, () => {
|
|
402
|
-
return;
|
|
403
|
-
});
|
|
404
|
-
const stopped = async () => {
|
|
405
|
-
const failed = { kind: "error", cause: input.error };
|
|
406
|
-
if (!input.transport)
|
|
407
|
-
return failed;
|
|
408
|
-
await signalled.catch(() => {
|
|
409
|
-
return;
|
|
410
|
-
});
|
|
411
|
-
const leader = await waitForCommandClose(input.transport.leader, input.timeoutMs).catch(() => {
|
|
412
|
-
return;
|
|
413
|
-
});
|
|
414
|
-
return leader?.kind === "exit" ? {
|
|
415
|
-
kind: "stopped",
|
|
416
|
-
cause: input.error,
|
|
417
|
-
exitCode: leader.exitCode,
|
|
418
|
-
signal: leader.signal
|
|
419
|
-
} : failed;
|
|
420
|
-
};
|
|
421
|
-
const cleanup = await Promise.allSettled([
|
|
422
|
-
input.event ? input.settle(input.event) : stopped().then(input.settle),
|
|
423
|
-
destroyed,
|
|
424
|
-
signalled,
|
|
425
|
-
released
|
|
426
|
-
]);
|
|
427
|
-
const failures = cleanup.flatMap((item) => item.status === "rejected" && item.reason !== input.error ? [item.reason] : []);
|
|
428
|
-
if (failures.length)
|
|
429
|
-
throw commandCleanupError(new AggregateError([input.error, ...failures], "Command failed and cleanup failed"));
|
|
430
|
-
}
|
|
431
|
-
|
|
432
432
|
// src/process/launch.ts
|
|
433
433
|
import { Readable as Readable2 } from "node:stream";
|
|
434
434
|
|