stitchkit 0.103.10 → 0.103.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox-process-owner.d.ts.map +1 -1
- package/dist/agent-runtime/store-conformance-lifecycle.d.ts +10 -10
- package/dist/entrypoints/agent-runtime/coding-tools.js +2 -1
- package/dist/entrypoints/agent-runtime/sandbox.js +28 -14
- package/dist/entrypoints/application/diagnostic-journal.js +2 -2
- package/dist/entrypoints/files.js +8 -2
- package/dist/entrypoints/process.js +1 -1
- package/dist/index-32jkwkdm.js +565 -0
- package/dist/{index-a4ajxwmb.js → index-g4jxe7ve.js} +113 -131
- package/dist/{index-ga597cvy.js → index-ttf0y7b8.js} +85 -23
- package/dist/internal/exclusive-lock-read.d.ts +20 -0
- package/dist/internal/exclusive-lock-read.d.ts.map +1 -0
- package/dist/internal/exclusive-lock.d.ts +1 -0
- package/dist/internal/exclusive-lock.d.ts.map +1 -1
- package/dist/internal/with-exclusive-lock.d.ts.map +1 -1
- package/dist/process/command-owner.d.ts +7 -2
- package/dist/process/command-owner.d.ts.map +1 -1
- package/dist/process/contract.d.ts +12 -1
- package/dist/process/contract.d.ts.map +1 -1
- package/dist/process/group.d.ts +6 -1
- package/dist/process/group.d.ts.map +1 -1
- package/dist/process/launch.d.ts +65 -0
- package/dist/process/launch.d.ts.map +1 -0
- package/dist/process/leader-settlement.d.ts +2 -0
- package/dist/process/leader-settlement.d.ts.map +1 -1
- package/dist/process/start-failure.d.ts +7 -0
- package/dist/process/start-failure.d.ts.map +1 -0
- package/llms/agent-runtime.txt +7 -1
- package/llms/process.txt +42 -4
- package/llms-full.txt +49 -5
- package/llms.txt +2 -2
- package/package.json +2 -2
- package/dist/index-6m6a9ty4.js +0 -285
|
@@ -2,6 +2,11 @@ import {
|
|
|
2
2
|
forbidden2,
|
|
3
3
|
conflict2
|
|
4
4
|
} from "./index-n53mswt3.js";
|
|
5
|
+
import {
|
|
6
|
+
NativeCommandError2,
|
|
7
|
+
stopCommandGroup,
|
|
8
|
+
startNativeCommand
|
|
9
|
+
} from "./index-32jkwkdm.js";
|
|
5
10
|
import {
|
|
6
11
|
probeAgentProcessSandbox2,
|
|
7
12
|
missingSandboxRestrictions2,
|
|
@@ -981,7 +986,6 @@ function createSearchAndPatchCodingTools(config, limits) {
|
|
|
981
986
|
import { realpath as realpath5, stat } from "node:fs/promises";
|
|
982
987
|
|
|
983
988
|
// src/agent-runtime/coding-shell-process.ts
|
|
984
|
-
import { spawn } from "node:child_process";
|
|
985
989
|
function preview(data, budget) {
|
|
986
990
|
if (data.byteLength <= budget) {
|
|
987
991
|
return { data, headBytes: data.byteLength, tailBytes: 0, omittedBytes: 0 };
|
|
@@ -1024,140 +1028,118 @@ async function runCodingShell(input) {
|
|
|
1024
1028
|
outcome: "cancelled"
|
|
1025
1029
|
});
|
|
1026
1030
|
}
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
if (settled)
|
|
1053
|
-
return;
|
|
1054
|
-
settled = true;
|
|
1055
|
-
cleanup();
|
|
1056
|
-
try {
|
|
1057
|
-
const hasArtifact = input.artifacts && artifactBytes > input.maxOutputBytes;
|
|
1058
|
-
const completeStdout = Buffer.concat(artifactStdout);
|
|
1059
|
-
const completeStderr = Buffer.concat(artifactStderr);
|
|
1060
|
-
const artifactData = hasArtifact ? Buffer.concat([stdoutHeader, completeStdout, stderrHeader, completeStderr]) : undefined;
|
|
1061
|
-
const stdoutBudget = completeStderr.byteLength === 0 ? input.maxOutputBytes : Math.ceil(input.maxOutputBytes / 2);
|
|
1062
|
-
const stderrBudget = completeStdout.byteLength === 0 ? input.maxOutputBytes : Math.floor(input.maxOutputBytes / 2);
|
|
1063
|
-
const stdoutPreview = hasArtifact ? preview(completeStdout, stdoutBudget) : retainedPreview(Buffer.concat(stdout));
|
|
1064
|
-
const stderrPreview = hasArtifact ? preview(completeStderr, stderrBudget) : retainedPreview(Buffer.concat(stderr));
|
|
1065
|
-
const persisted = hasArtifact ? await input.artifacts?.write({
|
|
1066
|
-
mediaType: "text/plain; charset=utf-8",
|
|
1067
|
-
data: artifactData ?? new Uint8Array,
|
|
1068
|
-
...input.authorization && { authorization: input.authorization }
|
|
1069
|
-
}) : undefined;
|
|
1070
|
-
resolve(ShellOutputSchema.parse({
|
|
1071
|
-
executable: input.executableName,
|
|
1072
|
-
exitCode,
|
|
1073
|
-
signal,
|
|
1074
|
-
stdout: stdoutPreview.data.toString("utf8"),
|
|
1075
|
-
stderr: stderrPreview.data.toString("utf8"),
|
|
1076
|
-
outcome,
|
|
1077
|
-
...persisted && {
|
|
1078
|
-
artifact: {
|
|
1079
|
-
reference: persisted.reference,
|
|
1080
|
-
bytes: artifactData?.byteLength ?? 0,
|
|
1081
|
-
truncated: outcome === "output-limit",
|
|
1082
|
-
headBytes: stdoutPreview.headBytes + stderrPreview.headBytes,
|
|
1083
|
-
tailBytes: stdoutPreview.tailBytes + stderrPreview.tailBytes,
|
|
1084
|
-
omittedBytes: stdoutPreview.omittedBytes + stderrPreview.omittedBytes
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
}));
|
|
1088
|
-
} catch (error) {
|
|
1089
|
-
reject(error);
|
|
1090
|
-
}
|
|
1091
|
-
};
|
|
1092
|
-
const killOwnedProcessGroup = () => {
|
|
1093
|
-
if (!ownsProcessGroup || child.pid === undefined)
|
|
1094
|
-
return false;
|
|
1095
|
-
try {
|
|
1096
|
-
process.kill(-child.pid, "SIGKILL");
|
|
1097
|
-
return true;
|
|
1098
|
-
} catch {
|
|
1099
|
-
return false;
|
|
1031
|
+
const stdout = [];
|
|
1032
|
+
const stderr = [];
|
|
1033
|
+
const artifactStdout = [];
|
|
1034
|
+
const artifactStderr = [];
|
|
1035
|
+
let retained = 0;
|
|
1036
|
+
let artifactBytes = 0;
|
|
1037
|
+
let outcome = "exited";
|
|
1038
|
+
let child;
|
|
1039
|
+
let exitCode = null;
|
|
1040
|
+
let signal = null;
|
|
1041
|
+
const outputLimit = new Error("Coding command output retention budget exceeded");
|
|
1042
|
+
const launch = input.spawn;
|
|
1043
|
+
const retain = (target, artifactTarget, chunk) => {
|
|
1044
|
+
const remaining = Math.max(0, input.maxOutputBytes - retained);
|
|
1045
|
+
if (remaining > 0) {
|
|
1046
|
+
const kept = Buffer.from(chunk.subarray(0, remaining));
|
|
1047
|
+
target.push(kept);
|
|
1048
|
+
retained += kept.byteLength;
|
|
1049
|
+
}
|
|
1050
|
+
if (input.artifacts) {
|
|
1051
|
+
const artifactRemaining = Math.max(0, artifactPayloadLimit - artifactBytes);
|
|
1052
|
+
if (artifactRemaining > 0) {
|
|
1053
|
+
const kept = Buffer.from(chunk.subarray(0, artifactRemaining));
|
|
1054
|
+
artifactTarget.push(kept);
|
|
1055
|
+
artifactBytes += kept.byteLength;
|
|
1100
1056
|
}
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
|
|
1057
|
+
if (chunk.byteLength > artifactRemaining)
|
|
1058
|
+
throw outputLimit;
|
|
1059
|
+
} else if (chunk.byteLength > remaining)
|
|
1060
|
+
throw outputLimit;
|
|
1061
|
+
};
|
|
1062
|
+
const command = startNativeCommand({
|
|
1063
|
+
executable: input.executable,
|
|
1064
|
+
args: [...input.args],
|
|
1065
|
+
cwd: input.cwd,
|
|
1066
|
+
env: { ...input.environment },
|
|
1067
|
+
envPolicy: "declared-only",
|
|
1068
|
+
signal: input.signal ?? new AbortController().signal,
|
|
1069
|
+
killGraceMs: 0,
|
|
1070
|
+
onOutput: (bytes, channel) => retain(channel === "stdout" ? stdout : stderr, channel === "stdout" ? artifactStdout : artifactStderr, bytes),
|
|
1071
|
+
onLeaderSettled: async (event) => {
|
|
1072
|
+
if (event.kind !== "exit")
|
|
1113
1073
|
return;
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1074
|
+
exitCode = event.exitCode;
|
|
1075
|
+
signal = event.signal;
|
|
1076
|
+
if (process.platform !== "win32")
|
|
1077
|
+
await stopCommandGroup(child?.pid, 0, input.terminationGraceMs, true);
|
|
1078
|
+
}
|
|
1079
|
+
}, (started) => {
|
|
1080
|
+
child = started;
|
|
1081
|
+
}, {
|
|
1082
|
+
group: process.platform !== "win32",
|
|
1083
|
+
force: true,
|
|
1084
|
+
timeoutMs: input.timeoutMs,
|
|
1085
|
+
cleanupTimeoutMs: input.terminationGraceMs,
|
|
1086
|
+
closeTimeoutMs: input.terminationGraceMs,
|
|
1087
|
+
...launch ? {
|
|
1088
|
+
launch: () => {
|
|
1089
|
+
child = launch();
|
|
1090
|
+
return child;
|
|
1127
1091
|
}
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1092
|
+
} : {},
|
|
1093
|
+
maxBufferedBytes: Math.max(64 * 1024, input.maxOutputBytes, input.artifacts ? artifactPayloadLimit : 0)
|
|
1094
|
+
});
|
|
1095
|
+
try {
|
|
1096
|
+
const result = await command.result;
|
|
1097
|
+
exitCode = result.exitCode;
|
|
1098
|
+
signal = result.signal;
|
|
1099
|
+
} catch (error) {
|
|
1100
|
+
if (error === outputLimit)
|
|
1101
|
+
outcome = "output-limit";
|
|
1102
|
+
else if (input.signal?.aborted && error === input.signal.reason)
|
|
1103
|
+
outcome = "cancelled";
|
|
1104
|
+
else if (error instanceof NativeCommandError2 && error.code === "COMMAND_LIMIT" && (error.reason === "deadline" || error.reason === "output-budget"))
|
|
1105
|
+
outcome = error.reason === "deadline" ? "timeout" : "output-limit";
|
|
1106
|
+
else if (error instanceof DOMException && error.name === "AbortError" && error.message === "Command stopped")
|
|
1107
|
+
outcome = "cancelled";
|
|
1108
|
+
else
|
|
1109
|
+
throw error;
|
|
1110
|
+
exitCode = child?.exitCode ?? exitCode;
|
|
1111
|
+
signal = child?.signalCode ?? signal;
|
|
1112
|
+
}
|
|
1113
|
+
const hasArtifact = input.artifacts && artifactBytes > input.maxOutputBytes;
|
|
1114
|
+
const completeStdout = Buffer.concat(artifactStdout);
|
|
1115
|
+
const completeStderr = Buffer.concat(artifactStderr);
|
|
1116
|
+
const artifactData = hasArtifact ? Buffer.concat([stdoutHeader, completeStdout, stderrHeader, completeStderr]) : undefined;
|
|
1117
|
+
const stdoutBudget = completeStderr.byteLength === 0 ? input.maxOutputBytes : Math.ceil(input.maxOutputBytes / 2);
|
|
1118
|
+
const stderrBudget = completeStdout.byteLength === 0 ? input.maxOutputBytes : Math.floor(input.maxOutputBytes / 2);
|
|
1119
|
+
const stdoutPreview = hasArtifact ? preview(completeStdout, stdoutBudget) : retainedPreview(Buffer.concat(stdout));
|
|
1120
|
+
const stderrPreview = hasArtifact ? preview(completeStderr, stderrBudget) : retainedPreview(Buffer.concat(stderr));
|
|
1121
|
+
const persisted = hasArtifact ? await input.artifacts?.write({
|
|
1122
|
+
mediaType: "text/plain; charset=utf-8",
|
|
1123
|
+
data: artifactData ?? new Uint8Array,
|
|
1124
|
+
...input.authorization && { authorization: input.authorization }
|
|
1125
|
+
}) : undefined;
|
|
1126
|
+
return ShellOutputSchema.parse({
|
|
1127
|
+
executable: input.executableName,
|
|
1128
|
+
exitCode,
|
|
1129
|
+
signal,
|
|
1130
|
+
stdout: stdoutPreview.data.toString("utf8"),
|
|
1131
|
+
stderr: stderrPreview.data.toString("utf8"),
|
|
1132
|
+
outcome,
|
|
1133
|
+
...persisted && {
|
|
1134
|
+
artifact: {
|
|
1135
|
+
reference: persisted.reference,
|
|
1136
|
+
bytes: artifactData?.byteLength ?? 0,
|
|
1137
|
+
truncated: outcome === "output-limit",
|
|
1138
|
+
headBytes: stdoutPreview.headBytes + stderrPreview.headBytes,
|
|
1139
|
+
tailBytes: stdoutPreview.tailBytes + stderrPreview.tailBytes,
|
|
1140
|
+
omittedBytes: stdoutPreview.omittedBytes + stderrPreview.omittedBytes
|
|
1155
1141
|
}
|
|
1156
|
-
}
|
|
1157
|
-
child.on("close", (exitCode, signal) => void persistAndResolve(exitCode, signal));
|
|
1158
|
-
input.signal?.addEventListener("abort", cancel, { once: true });
|
|
1159
|
-
if (input.signal?.aborted)
|
|
1160
|
-
cancel();
|
|
1142
|
+
}
|
|
1161
1143
|
});
|
|
1162
1144
|
}
|
|
1163
1145
|
|
|
@@ -9,10 +9,63 @@ import {
|
|
|
9
9
|
} from "./index-9jfdm5tg.js";
|
|
10
10
|
|
|
11
11
|
// src/internal/exclusive-lock.ts
|
|
12
|
-
import {
|
|
13
|
-
import { lstat, open, unlink } from "node:fs/promises";
|
|
12
|
+
import { lstat, open as open2, unlink } from "node:fs/promises";
|
|
14
13
|
import { hostname } from "node:os";
|
|
15
14
|
import { z } from "zod";
|
|
15
|
+
|
|
16
|
+
// src/internal/exclusive-lock-read.ts
|
|
17
|
+
import { constants } from "node:fs";
|
|
18
|
+
import { open } from "node:fs/promises";
|
|
19
|
+
var OWNER_RECORD_BYTES = 16 * 1024;
|
|
20
|
+
|
|
21
|
+
class LockRecordError extends Error {
|
|
22
|
+
code;
|
|
23
|
+
name = "LockRecordError";
|
|
24
|
+
constructor(code, message) {
|
|
25
|
+
super(message);
|
|
26
|
+
this.code = code;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async function readLockRecord(path, openDescriptor = open, signal) {
|
|
30
|
+
signal?.throwIfAborted();
|
|
31
|
+
if (!constants.O_NOFOLLOW || !constants.O_NONBLOCK) {
|
|
32
|
+
throw new LockRecordError("LOCK_UNSAFE_RECORD", "Safe lock descriptor flags are unavailable");
|
|
33
|
+
}
|
|
34
|
+
const handle = await openDescriptor(path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
|
|
35
|
+
try {
|
|
36
|
+
signal?.throwIfAborted();
|
|
37
|
+
const before = await handle.stat();
|
|
38
|
+
signal?.throwIfAborted();
|
|
39
|
+
if (!before.isFile() || before.nlink !== 1) {
|
|
40
|
+
throw new LockRecordError("LOCK_UNSAFE_RECORD", "Lock record must be a regular file with one link");
|
|
41
|
+
}
|
|
42
|
+
if (before.size > OWNER_RECORD_BYTES) {
|
|
43
|
+
throw new LockRecordError("LOCK_RECORD_TOO_LARGE", "Lock owner record exceeds its byte cap");
|
|
44
|
+
}
|
|
45
|
+
const bytes = Buffer.alloc(OWNER_RECORD_BYTES + 1);
|
|
46
|
+
let length = 0;
|
|
47
|
+
while (length < bytes.length) {
|
|
48
|
+
signal?.throwIfAborted();
|
|
49
|
+
const read = await handle.read(bytes, length, bytes.length - length, length);
|
|
50
|
+
if (read.bytesRead === 0)
|
|
51
|
+
break;
|
|
52
|
+
length += read.bytesRead;
|
|
53
|
+
}
|
|
54
|
+
if (length > OWNER_RECORD_BYTES) {
|
|
55
|
+
throw new LockRecordError("LOCK_RECORD_TOO_LARGE", "Lock owner record grew beyond its byte cap");
|
|
56
|
+
}
|
|
57
|
+
const after = await handle.stat();
|
|
58
|
+
signal?.throwIfAborted();
|
|
59
|
+
if (before.dev !== after.dev || before.ino !== after.ino || before.size !== after.size || before.mtimeMs !== after.mtimeMs || before.ctimeMs !== after.ctimeMs || before.nlink !== after.nlink || length !== after.size) {
|
|
60
|
+
throw new LockRecordError("LOCK_RECORD_CHANGED", "Lock owner record changed during its read");
|
|
61
|
+
}
|
|
62
|
+
return { text: bytes.subarray(0, length).toString("utf8"), info: after };
|
|
63
|
+
} finally {
|
|
64
|
+
await handle.close();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// src/internal/exclusive-lock.ts
|
|
16
69
|
var ExclusiveLockOwnerSchema = z.object({
|
|
17
70
|
pid: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
18
71
|
host: z.string().min(1),
|
|
@@ -47,29 +100,25 @@ async function diagnose(owner, declaredIdentity) {
|
|
|
47
100
|
return { attribution, liveness: "not-probed", owner };
|
|
48
101
|
return { attribution, ...await probeProcessOwner2(owner.pid, owner.process), owner };
|
|
49
102
|
}
|
|
50
|
-
async function readLockFile(path, onFailure) {
|
|
51
|
-
let handle;
|
|
103
|
+
async function readLockFile(path, onFailure, signal) {
|
|
52
104
|
try {
|
|
53
|
-
|
|
54
|
-
const info = await handle.stat();
|
|
105
|
+
const record = await readLockRecord(path, undefined, signal);
|
|
55
106
|
return {
|
|
56
|
-
owner: readOwner(
|
|
57
|
-
ino: info.ino,
|
|
58
|
-
|
|
107
|
+
owner: readOwner(record.text),
|
|
108
|
+
ino: record.info.ino,
|
|
109
|
+
dev: record.info.dev,
|
|
110
|
+
mtimeMs: record.info.mtimeMs
|
|
59
111
|
};
|
|
60
112
|
} catch (cause) {
|
|
61
113
|
if (!isCode(cause, "ENOENT"))
|
|
62
114
|
onFailure?.(cause);
|
|
63
115
|
return;
|
|
64
|
-
} finally {
|
|
65
|
-
await handle?.close().catch(() => {
|
|
66
|
-
return;
|
|
67
|
-
});
|
|
68
116
|
}
|
|
69
117
|
}
|
|
70
|
-
async function unlinkIfSame(path, ino) {
|
|
118
|
+
async function unlinkIfSame(path, ino, dev) {
|
|
71
119
|
try {
|
|
72
|
-
|
|
120
|
+
const current = await lstat(path);
|
|
121
|
+
if (current.ino !== ino || current.dev !== dev || !current.isFile() || current.nlink !== 1)
|
|
73
122
|
return;
|
|
74
123
|
await unlink(path);
|
|
75
124
|
} catch (error) {
|
|
@@ -80,7 +129,7 @@ async function unlinkIfSame(path, ino) {
|
|
|
80
129
|
async function createOwned(path, options, reclaimed) {
|
|
81
130
|
const identity = await machineIdentity(options.machineIdentity);
|
|
82
131
|
const instance = await readProcessInstance(process.pid);
|
|
83
|
-
const handle = await
|
|
132
|
+
const handle = await open2(path, "wx", options.mode);
|
|
84
133
|
const owner = {
|
|
85
134
|
pid: process.pid,
|
|
86
135
|
process: instance,
|
|
@@ -89,8 +138,11 @@ async function createOwned(path, options, reclaimed) {
|
|
|
89
138
|
...identity !== null && { machine: identity }
|
|
90
139
|
};
|
|
91
140
|
let ino;
|
|
141
|
+
let dev;
|
|
92
142
|
try {
|
|
93
|
-
|
|
143
|
+
const info = await handle.stat();
|
|
144
|
+
ino = info.ino;
|
|
145
|
+
dev = info.dev;
|
|
94
146
|
await handle.chmod(options.mode);
|
|
95
147
|
await handle.writeFile(`${JSON.stringify(owner)}
|
|
96
148
|
`, "utf8");
|
|
@@ -98,13 +150,14 @@ async function createOwned(path, options, reclaimed) {
|
|
|
98
150
|
await handle.close().catch(() => {
|
|
99
151
|
return;
|
|
100
152
|
});
|
|
101
|
-
if (ino !== undefined)
|
|
102
|
-
await unlinkIfSame(path, ino).catch(() => {
|
|
153
|
+
if (ino !== undefined && dev !== undefined)
|
|
154
|
+
await unlinkIfSame(path, ino, dev).catch(() => {
|
|
103
155
|
return;
|
|
104
156
|
});
|
|
105
157
|
throw error;
|
|
106
158
|
}
|
|
107
159
|
const ownedInode = ino;
|
|
160
|
+
const ownedDevice = dev;
|
|
108
161
|
let released = false;
|
|
109
162
|
return {
|
|
110
163
|
path,
|
|
@@ -117,7 +170,7 @@ async function createOwned(path, options, reclaimed) {
|
|
|
117
170
|
try {
|
|
118
171
|
await handle.close();
|
|
119
172
|
} finally {
|
|
120
|
-
await unlinkIfSame(path, ownedInode);
|
|
173
|
+
await unlinkIfSame(path, ownedInode, ownedDevice);
|
|
121
174
|
}
|
|
122
175
|
}
|
|
123
176
|
};
|
|
@@ -137,12 +190,19 @@ async function reclaimUnderGuard(path, options) {
|
|
|
137
190
|
return;
|
|
138
191
|
const guard = acquired.held;
|
|
139
192
|
try {
|
|
140
|
-
|
|
193
|
+
let unsafe = false;
|
|
194
|
+
const state = await readLockFile(path, () => {
|
|
195
|
+
unsafe = true;
|
|
196
|
+
}, options.signal);
|
|
197
|
+
if (unsafe)
|
|
198
|
+
return "refused";
|
|
141
199
|
if (state) {
|
|
142
200
|
const diagnosis = await diagnose(state.owner, options.machineIdentity);
|
|
201
|
+
if (options.signal?.aborted)
|
|
202
|
+
return "refused";
|
|
143
203
|
if (!reclaimable(state, diagnosis, options.ownerlessGraceMs))
|
|
144
204
|
return "refused";
|
|
145
|
-
await unlinkIfSame(path, state.ino);
|
|
205
|
+
await unlinkIfSame(path, state.ino, state.dev);
|
|
146
206
|
}
|
|
147
207
|
return await createOwned(path, options, state !== undefined).catch((error) => {
|
|
148
208
|
if (isCode(error, "EEXIST"))
|
|
@@ -166,11 +226,13 @@ async function attemptExclusiveLock(path, options) {
|
|
|
166
226
|
let readFailure;
|
|
167
227
|
const state = await readLockFile(path, (cause) => {
|
|
168
228
|
readFailure = cause;
|
|
169
|
-
});
|
|
229
|
+
}, options.signal);
|
|
170
230
|
const diagnosis = {
|
|
171
231
|
...await diagnose(state?.owner, options.machineIdentity),
|
|
172
232
|
...readFailure !== undefined && { cause: readFailure }
|
|
173
233
|
};
|
|
234
|
+
if (options.signal?.aborted)
|
|
235
|
+
return { error, diagnosis };
|
|
174
236
|
if (!state || !reclaimable(state, diagnosis, options.ownerlessGraceMs)) {
|
|
175
237
|
return { error, diagnosis };
|
|
176
238
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Stats } from 'node:fs';
|
|
2
|
+
interface LockRecordDescriptor {
|
|
3
|
+
stat(): Promise<Stats>;
|
|
4
|
+
read(buffer: Buffer, offset: number, length: number, position: number): Promise<{
|
|
5
|
+
bytesRead: number;
|
|
6
|
+
}>;
|
|
7
|
+
close(): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare class LockRecordError extends Error {
|
|
10
|
+
readonly code: 'LOCK_UNSAFE_RECORD' | 'LOCK_RECORD_CHANGED' | 'LOCK_RECORD_TOO_LARGE';
|
|
11
|
+
name: string;
|
|
12
|
+
constructor(code: 'LOCK_UNSAFE_RECORD' | 'LOCK_RECORD_CHANGED' | 'LOCK_RECORD_TOO_LARGE', message: string);
|
|
13
|
+
}
|
|
14
|
+
/** A descriptor-bound observation, never a pathname stat followed by an unbounded read. */
|
|
15
|
+
export declare function readLockRecord(path: string, openDescriptor?: (path: string, flags: number) => Promise<LockRecordDescriptor>, signal?: AbortSignal): Promise<{
|
|
16
|
+
text: string;
|
|
17
|
+
info: Stats;
|
|
18
|
+
}>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=exclusive-lock-read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exclusive-lock-read.d.ts","sourceRoot":"","sources":["../../src/internal/exclusive-lock-read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC;AAMhD,UAAU,oBAAoB;IAC5B,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;IACvB,IAAI,CACF,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,qBAAa,eAAgB,SAAQ,KAAK;IAGtC,QAAQ,CAAC,IAAI,EAAE,oBAAoB,GAAG,qBAAqB,GAAG,uBAAuB;IAF9E,IAAI,SAAqB;IAClC,YACW,IAAI,EAAE,oBAAoB,GAAG,qBAAqB,GAAG,uBAAuB,EACrF,OAAO,EAAE,MAAM,EAGhB;CACF;AAED,2FAA2F;AAC3F,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,cAAc,GAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,oBAAoB,CAAQ,EACrF,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC,CA8DxC"}
|
|
@@ -35,6 +35,7 @@ export interface HeldExclusiveLock {
|
|
|
35
35
|
release(): Promise<void>;
|
|
36
36
|
}
|
|
37
37
|
export interface ExclusiveLockAttemptOptions {
|
|
38
|
+
readonly signal?: AbortSignal;
|
|
38
39
|
readonly mode: number;
|
|
39
40
|
/** Take a lock whose owner is provably gone. `false` refuses every present lock. */
|
|
40
41
|
readonly reclaim: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exclusive-lock.d.ts","sourceRoot":"","sources":["../../src/internal/exclusive-lock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exclusive-lock.d.ts","sourceRoot":"","sources":["../../src/internal/exclusive-lock.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAEL,KAAK,oBAAo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WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC;IACnC,iFAAiF;IACjF,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED,qEAAqE;AACrE,qBAAa,kBAAmB,SAAQ,KAAK;IAGzC,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,cAAc;IAC9C,QAAQ,CAAC,KAAK,EAAE,MAAM;IACtB,wFAAwF;IACxF,QAAQ,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI;IALnC,IAAI,SAAwB;IACrC,YACW,IAAI,EAAE,cAAc,GAAG,cAAc,EACrC,KAAK,EAAE,MAAM;IACtB,wFAAwF;IAC/E,MAAM,EAAE,kBAAkB,GAAG,IAAI,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,CAuEZ"}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ChildProcessWithoutNullStreams } from 'node:child_process';
|
|
2
2
|
import { type NativeCommandOptions } from './contract.js';
|
|
3
|
+
import { type NativeCommandLaunchDriver } from './launch.js';
|
|
3
4
|
/** One-shot native execution; sandbox policy/admission is composed above this owner. */
|
|
4
|
-
export declare function startNativeCommand(input: NativeCommandOptions, onSpawn?: (child: ChildProcessWithoutNullStreams) => void): {
|
|
5
|
+
export declare function startNativeCommand(input: NativeCommandOptions, onSpawn?: (child: ChildProcessWithoutNullStreams) => void, driver?: NativeCommandLaunchDriver): {
|
|
6
|
+
result: Promise<never>;
|
|
7
|
+
stop(): Promise<void>;
|
|
8
|
+
} | {
|
|
5
9
|
result: Promise<{
|
|
6
10
|
exitCode: number | null;
|
|
7
11
|
signal: string | null;
|
|
8
12
|
stdout: Uint8Array<ArrayBuffer>;
|
|
9
13
|
stderr: Uint8Array<ArrayBuffer>;
|
|
10
14
|
}>;
|
|
15
|
+
terminate(): Promise<void>;
|
|
11
16
|
stop(): Promise<void>;
|
|
12
17
|
};
|
|
13
18
|
//# sourceMappingURL=command-owner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-owner.d.ts","sourceRoot":"","sources":["../../src/process/command-owner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"command-owner.d.ts","sourceRoot":"","sources":["../../src/process/command-owner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAEzE,OAAO,EAEL,KAAK,oBAAoB,EAG1B,MAAM,YAAY,CAAC;AAOpB,OAAO,EAEL,KAAK,yBAAyB,EAG/B,MAAM,UAAU,CAAC;AAIlB,wFAAwF;AACxF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,oBAAoB,EAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,8BAA8B,KAAK,IAAI,EACzD,MAAM,CAAC,EAAE,yBAAyB;;;;;;;;;;;;EA+LnC"}
|
|
@@ -37,9 +37,20 @@ declare const NativeCommandResultSchema: z.ZodObject<{
|
|
|
37
37
|
stderr: z.ZodInstanceOf<Uint8Array<ArrayBuffer>>;
|
|
38
38
|
}, z.core.$strip>;
|
|
39
39
|
export type NativeCommandResult = z.infer<typeof NativeCommandResultSchema>;
|
|
40
|
+
declare const NativeCommandLimitReasonSchema: z.ZodEnum<{
|
|
41
|
+
deadline: "deadline";
|
|
42
|
+
"output-budget": "output-budget";
|
|
43
|
+
}>;
|
|
40
44
|
export declare class NativeCommandError extends Error {
|
|
41
45
|
readonly code: 'COMMAND_LIMIT' | 'COMMAND_UNAVAILABLE' | 'COMMAND_CLEANUP';
|
|
42
|
-
|
|
46
|
+
/** Observed owner limit; absent on non-limit and caller-constructed errors without evidence. */
|
|
47
|
+
readonly reason: z.infer<typeof NativeCommandLimitReasonSchema> | undefined;
|
|
48
|
+
constructor(code: 'COMMAND_LIMIT', message: string, options?: ErrorOptions & {
|
|
49
|
+
reason?: z.infer<typeof NativeCommandLimitReasonSchema>;
|
|
50
|
+
});
|
|
51
|
+
constructor(code: 'COMMAND_LIMIT' | 'COMMAND_UNAVAILABLE' | 'COMMAND_CLEANUP', message: string, options?: ErrorOptions & {
|
|
52
|
+
reason?: never;
|
|
53
|
+
});
|
|
43
54
|
}
|
|
44
55
|
export {};
|
|
45
56
|
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -1 +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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AY,GAAG;QAAE,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAA;KAAE,EACpF;IACF,YACE,IAAI,EAAE,eAAe,GAAG,qBAAqB,GAAG,iBAAiB,EACjE,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,YAAY,GAAG;QAAE,MAAM,CAAC,EAAE,KAAK,CAAA;KAAE,EAC3C;CAeH"}
|
package/dist/process/group.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { NativeCommandError } from './contract.js';
|
|
2
|
+
/** Chain native-sized timers; internal callers retain their declared safe-integer deadline. */
|
|
3
|
+
export declare function createCommandDeadline(timeoutMs: number, reason: unknown): {
|
|
4
|
+
signal: AbortSignal;
|
|
5
|
+
cancel(): void;
|
|
6
|
+
};
|
|
2
7
|
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>;
|
|
8
|
+
export declare function stopCommandGroup(pid: number | undefined, graceMs: number, cleanupTimeoutMs?: number, force?: boolean): Promise<void>;
|
|
4
9
|
export declare function commandCleanupError(cause: unknown): NativeCommandError;
|
|
5
10
|
export declare function waitForCommandClose<T>(closed: Promise<T>, timeoutMs: number): Promise<T>;
|
|
6
11
|
//# sourceMappingURL=group.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../src/process/group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../src/process/group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,+FAA+F;AAC/F,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO;IAapE,MAAM;IACN,MAAM;EAIT;AAWD,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,EACvB,KAAK,UAAQ,GACZ,OAAO,CAAC,IAAI,CAAC,CAaf;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,CAMxF"}
|