orkestrator 2.36.4-beta → 2.36.5-beta
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/client.js +11962 -10260
- package/dist/main.js +5058 -2903
- package/package.json +3 -3
- package/resources/acp-bridge/dist/index.js +884 -48
- package/resources/claude-bridge/dist/index.js +1177 -183
- package/resources/codex-bridge/dist/index.js +999 -161
- package/resources/cursor-bridge/dist/index.js +876 -40
- package/resources/cursor-bridge/runtime/install.json +1 -1
- package/resources/pi-bridge/dist/index.js +890 -52
- package/resources/pi-bridge/runtime/install.json +1 -1
|
@@ -825,6 +825,8 @@ var LOGGING_LOG_AREAS = defineLogAreas({
|
|
|
825
825
|
},
|
|
826
826
|
"essential.write-failed": "Writing the essential log failed. Its entries are counted, and a marker reports them at the next write that works.",
|
|
827
827
|
"policy.changed": "The logging settings changed: saving, retention and levels, with no content.",
|
|
828
|
+
"policy.detail-expired": "Raised log detail reached its expiry, so the backend set its raised levels back to info. Saving is unchanged.",
|
|
829
|
+
"policy.expiry-failed": "Checking or applying the log detail expiry failed; the next check, a minute later, tries again.",
|
|
828
830
|
"policy.bridge-predates-route": "A running bridge has no logging settings route; it applies them at its next start.",
|
|
829
831
|
"policy.push-failed": "A running bridge did not take the logging settings after retries; its next start resends them.",
|
|
830
832
|
"prune.failed": "Removing expired log files failed; the next sweep retries.",
|
|
@@ -832,6 +834,23 @@ var LOGGING_LOG_AREAS = defineLogAreas({
|
|
|
832
834
|
"unknown-area": "Code outside the type checker asked for an area that is not listed.",
|
|
833
835
|
...THROTTLE_LOG_EVENTS
|
|
834
836
|
}
|
|
837
|
+
},
|
|
838
|
+
"renderer-errors": {
|
|
839
|
+
description: "Renderer failures a desktop window reported from its error ring: class, boundary, surface, count and fingerprint, never a message or stack.",
|
|
840
|
+
events: {
|
|
841
|
+
"error.recorded": {
|
|
842
|
+
description: "A renderer reported `count` new occurrences of one failure since its last report.",
|
|
843
|
+
essential: true,
|
|
844
|
+
fields: {
|
|
845
|
+
errorClass: "label",
|
|
846
|
+
boundary: "label",
|
|
847
|
+
route: "label",
|
|
848
|
+
fingerprint: "label",
|
|
849
|
+
count: "number"
|
|
850
|
+
}
|
|
851
|
+
},
|
|
852
|
+
"report.rate-limited": "Renderer error entries arrived faster than the backend records them, so `dropped` were counted and not written."
|
|
853
|
+
}
|
|
835
854
|
}
|
|
836
855
|
});
|
|
837
856
|
|
|
@@ -889,6 +908,8 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
889
908
|
"usage-limit.notice-failed": "A usage-limit stop's outcome could not be read for its notice.",
|
|
890
909
|
"usage-limit.resend-failed": "Resending after a usage limit failed. An unknown send stays in the journal.",
|
|
891
910
|
"title.strategy-failed": "A session title strategy failed, so the next is tried. Content-free: the error can quote the prompt.",
|
|
911
|
+
"steer.qualification-failed": "A bridge's steer qualification failed or answered non-OK, so steering is not offered. Agent and status code or error class only.",
|
|
912
|
+
"steer.capability-cleared": "A projection cleared `actions.steer` because its bridge did not qualify. Identifiers and turn status only.",
|
|
892
913
|
...THROTTLE_LOG_EVENTS
|
|
893
914
|
}
|
|
894
915
|
},
|
|
@@ -989,6 +1010,9 @@ var RUNTIME_LOG_AREAS = defineLogAreas({
|
|
|
989
1010
|
essential: true,
|
|
990
1011
|
fields: { origin: "label", ...ESSENTIAL_ERROR_FIELDS }
|
|
991
1012
|
},
|
|
1013
|
+
"child.reaped": "A macOS child whose exit Bun lost was reaped after its command settled, so it no longer waits as a zombie.",
|
|
1014
|
+
"child.reap-abandoned": "A child whose exit Bun lost was left unreaped: `reason` says whether it was never seen as a zombie (`not-a-zombie`), too many were pending (`capacity`), or `waitpid` failed.",
|
|
1015
|
+
"child.reap-unavailable": "waitpid could not be loaded, so children whose exit Bun lost stay zombies until this process exits.",
|
|
992
1016
|
...THROTTLE_LOG_EVENTS
|
|
993
1017
|
}
|
|
994
1018
|
}
|
|
@@ -1395,6 +1419,13 @@ var COORDINATOR_LOG_AREAS = defineLogAreas({
|
|
|
1395
1419
|
"store.workflows-cleared": "The workflow store was full, so a batch of its oldest finished records was removed.",
|
|
1396
1420
|
"store.workflows-in-use": "The workflow store was full and every record was still in use, so new work was refused.",
|
|
1397
1421
|
"remote-worker.settle-failed": "A remote worker could not be settled.",
|
|
1422
|
+
"node-release.failed": "Work on a node that was forgotten or handed over could not be closed; the sweep's registry check retries.",
|
|
1423
|
+
"node-release.reconcile-failed": "The sweep could not check records against the node registry; the next sweep retries.",
|
|
1424
|
+
"node-release.unregistered": "Records named a node the registry no longer holds, so their work was closed here.",
|
|
1425
|
+
"node-release.notice-failed": "The notice for work closed on a released node could not be sent; it stays owed and the sweep retries.",
|
|
1426
|
+
"node-release.no-coordinator": "Work closed on a released node belonged to a coordinator that no longer exists, so nobody was told.",
|
|
1427
|
+
"node-offline.notice-failed": "The notice that a node has been unreachable for a day could not be sent; the next failed read retries.",
|
|
1428
|
+
"node-offline.check-failed": "Whether a long-unreachable node's coordinators were told could not be checked; the next read retries.",
|
|
1398
1429
|
"checkout.merge-followed": "After an environment's PR merged, the project checkout was fast-forwarded, or `outcome` says why not.",
|
|
1399
1430
|
"checkout.merge-follow-failed": "Fast-forwarding the project checkout failed, after an environment's PR merged or before mail woke the main coordinator.",
|
|
1400
1431
|
"checkout.mail-follow": "Before mail woke the main coordinator, the project checkout was fast-forwarded (`fast-forwarded-fetched` when the fetch was slow or failed and the upstream commit already fetched was merged), or `outcome` says why not (`timed-out`, `failed`).",
|
|
@@ -1491,6 +1522,7 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
1491
1522
|
events: {
|
|
1492
1523
|
"portable-inputs.relay-missing": "Docker is rootless and the image predates the staged-input relay, so the container cannot read them until rebuilt.",
|
|
1493
1524
|
"git-mirror.mount-unavailable": "A new container gets no project Git mirror, so its clone goes to the remote.",
|
|
1525
|
+
"git-mirror.mount-withheld": "A new restricted container gets no project Git mirror because its firewall would not let it reach the project's remote, so it cannot read what the remote serves through the mirror either.",
|
|
1494
1526
|
"git-mirror.refreshed": "A project's Git mirror was built or updated.",
|
|
1495
1527
|
"git-mirror.seeded": "A project's Git mirror was built from its host checkout and only what the remote added to it.",
|
|
1496
1528
|
"git-mirror.seed-skipped": "A project's host checkout could not seed its Git mirror, so the build downloads everything.",
|
|
@@ -1667,6 +1699,7 @@ var NODES_LOG_AREAS = defineLogAreas({
|
|
|
1667
1699
|
"verification.record-failed": "A node verification could not be recorded.",
|
|
1668
1700
|
"profile.record-failed": "A node profile could not be recorded.",
|
|
1669
1701
|
"detach.unconfirmed": "A forgotten node has not confirmed the detach yet.",
|
|
1702
|
+
"grant.revocation-listener-failed": "A connection could not be told its client grant was removed; the grant is still gone.",
|
|
1670
1703
|
"handover.recovery-pending": "Command handover recovery is still pending.",
|
|
1671
1704
|
"ticket-sync.work-record-failed": "A remote build started but its ticket work location could not be saved.",
|
|
1672
1705
|
"ticket-sync.failed": "A Kanban sync with a node failed; it is retried.",
|
|
@@ -1719,7 +1752,9 @@ var HOST_LOG_AREAS = defineLogAreas({
|
|
|
1719
1752
|
"tool.missing": "A host tool was not found.",
|
|
1720
1753
|
"maintenance.listener-failed": "A host maintenance listener threw; the others still run.",
|
|
1721
1754
|
"suspend.reconcile-failed": "Reconciling due work after a host suspension failed.",
|
|
1722
|
-
"load.sample-failed": "Sampling machine load failed; the next sample retries."
|
|
1755
|
+
"load.sample-failed": "Sampling machine load failed; the next sample retries.",
|
|
1756
|
+
"usage.source-stalled": "A usage source (scope: disk or gpu-sysfs) did not answer in time; its figure is missing from the sample until it does.",
|
|
1757
|
+
...THROTTLE_LOG_EVENTS
|
|
1723
1758
|
}
|
|
1724
1759
|
}
|
|
1725
1760
|
});
|
|
@@ -19247,12 +19282,823 @@ import { createHash as createHash7 } from "node:crypto";
|
|
|
19247
19282
|
import { resolve as resolve6 } from "node:path";
|
|
19248
19283
|
|
|
19249
19284
|
// ../protocol/src/node/workspace-change-probe.ts
|
|
19250
|
-
import {
|
|
19251
|
-
import { randomUUID } from "node:crypto";
|
|
19285
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
19252
19286
|
import { rmSync as rmSync2 } from "node:fs";
|
|
19253
19287
|
import { copyFile, lstat as lstat2, mkdtemp, rm as rm2 } from "node:fs/promises";
|
|
19254
19288
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
19255
19289
|
import { delimiter, isAbsolute as isAbsolute3, join as join6, resolve as resolve4 } from "node:path";
|
|
19290
|
+
|
|
19291
|
+
// ../protocol/src/node/command-capture.ts
|
|
19292
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
19293
|
+
import { randomUUID } from "node:crypto";
|
|
19294
|
+
import { constants as fsConstants } from "node:fs";
|
|
19295
|
+
import * as captureFs from "node:fs";
|
|
19296
|
+
import os from "node:os";
|
|
19297
|
+
import path2 from "node:path";
|
|
19298
|
+
import { inspect } from "node:util";
|
|
19299
|
+
|
|
19300
|
+
// ../protocol/src/node/command-failure-reason.ts
|
|
19301
|
+
var MAX_MATCHED_CHARS = 16 * 1024;
|
|
19302
|
+
var SIGNAL_PATTERN = /^SIG[A-Z0-9]{1,16}$/;
|
|
19303
|
+
var TOOL_RULES = {
|
|
19304
|
+
git: [
|
|
19305
|
+
["branch-exists", /a branch named .* already exists/i],
|
|
19306
|
+
["ref-conflict", /exists; cannot create|cannot lock ref .* is at .* but expected/i],
|
|
19307
|
+
["lock-held", /could not lock config file [^\n]*: File exists/i],
|
|
19308
|
+
["lock-held", /(?:unable to create '[^\n]*\.lock'|cannot lock ref)[^\n]*: File exists/i],
|
|
19309
|
+
["lock-held", /another git process/i],
|
|
19310
|
+
["worktree-conflict", /already (?:checked out|used by worktree)|used by worktree at/i],
|
|
19311
|
+
["invalid-ref", /not a valid (?:branch name|object name)|bad (?:revision|object)/i],
|
|
19312
|
+
["invalid-ref", /unknown revision|ambiguous argument|invalid reference/i],
|
|
19313
|
+
["branch-not-found", /no branch named|refname .* not found|branch '.*' not found/i],
|
|
19314
|
+
["branch-not-found", /did not match any file\(s\) known to git/i],
|
|
19315
|
+
["dubious-ownership", /detected dubious ownership/i],
|
|
19316
|
+
["no-remote", /does not appear to be a git repository|no such remote/i],
|
|
19317
|
+
["no-remote", /repository (?:.* )?not found/i],
|
|
19318
|
+
["not-a-repository", /not a git repository/i],
|
|
19319
|
+
["remote-ref-missing", /could(?:n't| not) find remote ref|not our ref/i],
|
|
19320
|
+
["merge-conflict", /\bCONFLICT \(|merge conflict|could not apply|unmerged files/i],
|
|
19321
|
+
["dirty-worktree", /local changes .* would be overwritten|commit your changes or stash/i],
|
|
19322
|
+
["nothing-to-commit", /nothing to commit|no changes added to commit/i],
|
|
19323
|
+
["push-rejected", /\[(?:remote )?rejected\]|non-fast-forward/i],
|
|
19324
|
+
["identity-unknown", /please tell me who you are|unable to auto-detect email/i],
|
|
19325
|
+
[
|
|
19326
|
+
"worktree-has-changes",
|
|
19327
|
+
/^fatal: [^\n]*['"] contains modified or untracked files(?:, use --force to delete it)?\.?\s*$/im
|
|
19328
|
+
],
|
|
19329
|
+
["not-a-worktree", /^fatal: [^\n]*['"] is not a working tree\.?\s*$/im],
|
|
19330
|
+
["branch-not-merged", /^(?:error|fatal): [^\n]*['"] is not fully merged\.?\s*$/im]
|
|
19331
|
+
],
|
|
19332
|
+
gh: [
|
|
19333
|
+
["pull-request-exists", /a pull request for branch .* already exists/i],
|
|
19334
|
+
["no-pull-request", /no (?:pull requests? (?:found|match)|open pull requests?\b)/i],
|
|
19335
|
+
["rate-limited", /rate limit|http 429/i],
|
|
19336
|
+
["forbidden", /http 403|resource not accessible/i],
|
|
19337
|
+
["resource-not-found", /http 404|could not resolve to a/i],
|
|
19338
|
+
["server-error", /http 5\d\d/i]
|
|
19339
|
+
],
|
|
19340
|
+
docker: [
|
|
19341
|
+
["daemon-unavailable", /cannot connect to the docker daemon|error during connect/i],
|
|
19342
|
+
[
|
|
19343
|
+
"daemon-unavailable",
|
|
19344
|
+
/is the docker daemon running|docker desktop is (?:not running|unable)/i
|
|
19345
|
+
],
|
|
19346
|
+
["container-not-found", /no such container/i],
|
|
19347
|
+
["container-not-running", /container .* is (?:not running|paused|restarting)/i],
|
|
19348
|
+
["container-name-conflict", /name .* is already in use/i],
|
|
19349
|
+
["image-not-found", /no such image|pull access denied|manifest .* not found/i],
|
|
19350
|
+
["image-not-found", /manifest unknown|repository does not exist/i],
|
|
19351
|
+
["removal-in-progress", /removal of container .* is already in progress/i],
|
|
19352
|
+
[
|
|
19353
|
+
"image-in-use",
|
|
19354
|
+
/image is (?:being used|referenced)|unable to (?:remove|delete) .*must be forced/i
|
|
19355
|
+
],
|
|
19356
|
+
["volume-in-use", /volume is in use/i],
|
|
19357
|
+
["volume-not-found", /no such volume/i],
|
|
19358
|
+
["network-in-use", /has active endpoints/i],
|
|
19359
|
+
["network-not-found", /network .* not found/i]
|
|
19360
|
+
],
|
|
19361
|
+
tmux: [
|
|
19362
|
+
["session-exists", /duplicate session/i],
|
|
19363
|
+
[
|
|
19364
|
+
"server-not-running",
|
|
19365
|
+
/no server running|failed to connect to server|no sessions|server exited|lost server/i
|
|
19366
|
+
],
|
|
19367
|
+
[
|
|
19368
|
+
"server-not-running",
|
|
19369
|
+
/error connecting to \/[^\n]* \((?:No such file or directory|Connection refused)\)/i
|
|
19370
|
+
],
|
|
19371
|
+
["session-not-found", /can't find (?:session|window|pane)|session not found/i]
|
|
19372
|
+
]
|
|
19373
|
+
};
|
|
19374
|
+
var ALL_TOOLS = Object.keys(TOOL_RULES);
|
|
19375
|
+
var SHARED_RULES = [
|
|
19376
|
+
["disk-full", /no space left|enospc|disk quota exceeded/i],
|
|
19377
|
+
["auth-failed", /authentication (?:failed|required)|could not read (?:username|password)/i],
|
|
19378
|
+
["auth-failed", /terminal prompts disabled|invalid username or password|bad credentials/i],
|
|
19379
|
+
["auth-failed", /permission denied \(|permission to \S+ denied|host key verification failed/i],
|
|
19380
|
+
["auth-failed", /gh auth login|not logged in|unauthorized|http 401|returned error: 40[13]/i],
|
|
19381
|
+
["network-failed", /could not resolve host|connection (?:timed out|refused|reset)/i],
|
|
19382
|
+
["network-failed", /network is unreachable|no route to host|temporary failure in name/i],
|
|
19383
|
+
["network-failed", /early eof|failed to connect|remote end hung up/i],
|
|
19384
|
+
["network-failed", /unable to access ['"]?https?:\/\//i],
|
|
19385
|
+
["network-failed", /tls handshake|i\/o timeout/i],
|
|
19386
|
+
[
|
|
19387
|
+
"network-failed",
|
|
19388
|
+
/error connecting to (?:https?:\/\/)?[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?(?::\d+)?(?:[\s/:]|$)/i
|
|
19389
|
+
],
|
|
19390
|
+
["port-in-use", /port is already allocated|address already in use/i],
|
|
19391
|
+
["permission-denied", /permission denied|operation not permitted|read-only file system/i],
|
|
19392
|
+
["command-not-found", /command not found/i],
|
|
19393
|
+
["path-not-found", /no such file or directory/i],
|
|
19394
|
+
["invalid-usage", /^usage: |unknown (?:option|flag|command|shorthand flag)|invalid option/im]
|
|
19395
|
+
];
|
|
19396
|
+
var TOOL_EXIT_CODES = {
|
|
19397
|
+
git: { 129: "invalid-usage" },
|
|
19398
|
+
gh: { 2: "aborted", 4: "auth-failed" },
|
|
19399
|
+
docker: { 125: "daemon-error" },
|
|
19400
|
+
tmux: {}
|
|
19401
|
+
};
|
|
19402
|
+
var SHARED_EXIT_CODES = {
|
|
19403
|
+
124: "timed-out",
|
|
19404
|
+
126: "not-executable",
|
|
19405
|
+
127: "command-not-found",
|
|
19406
|
+
137: "killed",
|
|
19407
|
+
143: "killed"
|
|
19408
|
+
};
|
|
19409
|
+
function read2(target, key) {
|
|
19410
|
+
return target[key];
|
|
19411
|
+
}
|
|
19412
|
+
function boundedForMatching(text) {
|
|
19413
|
+
if (text.length <= MAX_MATCHED_CHARS)
|
|
19414
|
+
return text;
|
|
19415
|
+
const half = MAX_MATCHED_CHARS / 2;
|
|
19416
|
+
return `${text.slice(0, half)}
|
|
19417
|
+
${text.slice(-half)}`;
|
|
19418
|
+
}
|
|
19419
|
+
function failureText(error) {
|
|
19420
|
+
const stderr = read2(error, "stderr");
|
|
19421
|
+
if (Buffer.isBuffer(stderr) && stderr.length > 0) {
|
|
19422
|
+
return boundedForMatching(stderr.subarray(-MAX_MATCHED_CHARS).toString());
|
|
19423
|
+
}
|
|
19424
|
+
if (typeof stderr === "string" && stderr.length > 0)
|
|
19425
|
+
return boundedForMatching(stderr);
|
|
19426
|
+
const message = read2(error, "message");
|
|
19427
|
+
if (typeof message !== "string")
|
|
19428
|
+
return "";
|
|
19429
|
+
return message.startsWith("Command failed") ? "" : boundedForMatching(message);
|
|
19430
|
+
}
|
|
19431
|
+
function isRawSpawnEnoent(error) {
|
|
19432
|
+
const syscall = read2(error, "syscall");
|
|
19433
|
+
return read2(error, "code") === "ENOENT" && typeof syscall === "string" && /^(?:spawn(?:Sync)?(?:\s|$)|posix_spawnp?$)/.test(syscall);
|
|
19434
|
+
}
|
|
19435
|
+
function classifiedReason(error, exitCode, signal, options) {
|
|
19436
|
+
if (read2(error, "aborted") === true)
|
|
19437
|
+
return "aborted";
|
|
19438
|
+
if (read2(error, "outputLimitExceeded") === true)
|
|
19439
|
+
return "output-too-large";
|
|
19440
|
+
if (read2(error, "timedOut") === true)
|
|
19441
|
+
return "timed-out";
|
|
19442
|
+
if (read2(error, "executableMissing") === true || isRawSpawnEnoent(error)) {
|
|
19443
|
+
return "executable-missing";
|
|
19444
|
+
}
|
|
19445
|
+
const named = exitCode === null ? undefined : options.exitCodes?.[exitCode];
|
|
19446
|
+
if (named)
|
|
19447
|
+
return named;
|
|
19448
|
+
if (signal)
|
|
19449
|
+
return "killed";
|
|
19450
|
+
const text = failureText(error);
|
|
19451
|
+
for (const tool of options.tools ?? ALL_TOOLS) {
|
|
19452
|
+
for (const [reason, pattern] of TOOL_RULES[tool]) {
|
|
19453
|
+
if (pattern.test(text))
|
|
19454
|
+
return reason;
|
|
19455
|
+
}
|
|
19456
|
+
}
|
|
19457
|
+
for (const [reason, pattern] of SHARED_RULES) {
|
|
19458
|
+
if (pattern.test(text))
|
|
19459
|
+
return reason;
|
|
19460
|
+
}
|
|
19461
|
+
if (exitCode !== null) {
|
|
19462
|
+
for (const tool of options.tools ?? []) {
|
|
19463
|
+
const reason = TOOL_EXIT_CODES[tool][exitCode];
|
|
19464
|
+
if (reason)
|
|
19465
|
+
return reason;
|
|
19466
|
+
}
|
|
19467
|
+
const reason = SHARED_EXIT_CODES[exitCode];
|
|
19468
|
+
if (reason)
|
|
19469
|
+
return reason;
|
|
19470
|
+
}
|
|
19471
|
+
return "unclassified";
|
|
19472
|
+
}
|
|
19473
|
+
function numericExitCode(error) {
|
|
19474
|
+
for (const key of ["exitCode", "code"]) {
|
|
19475
|
+
const value = read2(error, key);
|
|
19476
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
19477
|
+
return value;
|
|
19478
|
+
}
|
|
19479
|
+
return null;
|
|
19480
|
+
}
|
|
19481
|
+
function classifyCommandFailure(error, options = {}) {
|
|
19482
|
+
if (typeof error !== "object" || error === null) {
|
|
19483
|
+
return { reason: "unclassified", exitCode: null, signal: null };
|
|
19484
|
+
}
|
|
19485
|
+
try {
|
|
19486
|
+
const exitCode = numericExitCode(error);
|
|
19487
|
+
const rawSignal = read2(error, "signal");
|
|
19488
|
+
const signal = typeof rawSignal === "string" && SIGNAL_PATTERN.test(rawSignal) ? rawSignal : null;
|
|
19489
|
+
return { reason: classifiedReason(error, exitCode, signal, options), exitCode, signal };
|
|
19490
|
+
} catch {
|
|
19491
|
+
return { reason: "unclassified", exitCode: null, signal: null };
|
|
19492
|
+
}
|
|
19493
|
+
}
|
|
19494
|
+
|
|
19495
|
+
// ../protocol/src/node/lost-exit-reaper.ts
|
|
19496
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
19497
|
+
|
|
19498
|
+
// ../protocol/src/node/shell-process-state.ts
|
|
19499
|
+
import { readdirSync, readFileSync as readFileSync2 } from "node:fs";
|
|
19500
|
+
import { constants as osConstants } from "node:os";
|
|
19501
|
+
var PROCESS_INSPECTION_OPTIONS = {
|
|
19502
|
+
timeout: 100,
|
|
19503
|
+
killSignal: "SIGKILL",
|
|
19504
|
+
maxBuffer: 1024 * 1024
|
|
19505
|
+
};
|
|
19506
|
+
function bunRuntime() {
|
|
19507
|
+
return globalThis.Bun;
|
|
19508
|
+
}
|
|
19509
|
+
function decodeWaitStatus(status) {
|
|
19510
|
+
const signalNumber = status & 127;
|
|
19511
|
+
if (signalNumber === 0)
|
|
19512
|
+
return { code: status >> 8 & 255, signal: null };
|
|
19513
|
+
const name = Object.entries(osConstants.signals).find(([, value]) => value === signalNumber)?.[0];
|
|
19514
|
+
return { code: null, signal: name ?? "SIGKILL" };
|
|
19515
|
+
}
|
|
19516
|
+
function readZombieExit(pid) {
|
|
19517
|
+
try {
|
|
19518
|
+
const result = bunRuntime()?.spawnSync(["/bin/ps", "-o", "stat=,xstat=", "-p", String(pid)], PROCESS_INSPECTION_OPTIONS);
|
|
19519
|
+
if (!result?.success)
|
|
19520
|
+
return;
|
|
19521
|
+
const { stdout } = result;
|
|
19522
|
+
const match = /^Z\S*\s+([0-9a-f]+)\s*$/i.exec(stdout.toString().trim());
|
|
19523
|
+
return match ? decodeWaitStatus(Number.parseInt(match[1], 16)) : undefined;
|
|
19524
|
+
} catch {
|
|
19525
|
+
return;
|
|
19526
|
+
}
|
|
19527
|
+
}
|
|
19528
|
+
var EXIT_WATCH_MS = 1000;
|
|
19529
|
+
var EXIT_WATCH_MAX_MS = 16000;
|
|
19530
|
+
function watchForLostExit(pid, onExit) {
|
|
19531
|
+
if (process.platform !== "darwin" || pid === undefined || !bunRuntime())
|
|
19532
|
+
return () => {
|
|
19533
|
+
return;
|
|
19534
|
+
};
|
|
19535
|
+
let timer;
|
|
19536
|
+
const watch = (delayMs) => {
|
|
19537
|
+
timer = setTimeout(() => {
|
|
19538
|
+
const exit = readZombieExit(pid);
|
|
19539
|
+
if (exit)
|
|
19540
|
+
onExit(exit);
|
|
19541
|
+
else
|
|
19542
|
+
watch(Math.min(delayMs * 2, EXIT_WATCH_MAX_MS));
|
|
19543
|
+
}, delayMs);
|
|
19544
|
+
};
|
|
19545
|
+
watch(EXIT_WATCH_MS);
|
|
19546
|
+
return () => clearTimeout(timer);
|
|
19547
|
+
}
|
|
19548
|
+
function isLiveMember(state, groupId, pgid) {
|
|
19549
|
+
return Number(groupId) === pgid && state !== undefined && !/^[ZX]/.test(state);
|
|
19550
|
+
}
|
|
19551
|
+
function linuxGroupHasLiveMember(pgid) {
|
|
19552
|
+
for (const entry of readdirSync("/proc")) {
|
|
19553
|
+
if (!/^\d+$/.test(entry))
|
|
19554
|
+
continue;
|
|
19555
|
+
let stat;
|
|
19556
|
+
try {
|
|
19557
|
+
stat = readFileSync2(`/proc/${entry}/stat`, "latin1");
|
|
19558
|
+
} catch {
|
|
19559
|
+
continue;
|
|
19560
|
+
}
|
|
19561
|
+
const [state, , groupId] = stat.slice(stat.lastIndexOf(")") + 2).split(" ");
|
|
19562
|
+
if (isLiveMember(state, groupId, pgid))
|
|
19563
|
+
return true;
|
|
19564
|
+
}
|
|
19565
|
+
return false;
|
|
19566
|
+
}
|
|
19567
|
+
function psGroupHasLiveMember(pgid) {
|
|
19568
|
+
const result = bunRuntime()?.spawnSync(["/bin/ps", "-A", "-o", "pgid=,stat="], PROCESS_INSPECTION_OPTIONS);
|
|
19569
|
+
if (!result?.success)
|
|
19570
|
+
return true;
|
|
19571
|
+
return result.stdout.toString().split(`
|
|
19572
|
+
`).some((line) => {
|
|
19573
|
+
const [groupId, state] = line.trim().split(/\s+/);
|
|
19574
|
+
return isLiveMember(state, groupId, pgid);
|
|
19575
|
+
});
|
|
19576
|
+
}
|
|
19577
|
+
function groupHasLiveMember(pgid) {
|
|
19578
|
+
try {
|
|
19579
|
+
return process.platform === "linux" ? linuxGroupHasLiveMember(pgid) : psGroupHasLiveMember(pgid);
|
|
19580
|
+
} catch {
|
|
19581
|
+
return true;
|
|
19582
|
+
}
|
|
19583
|
+
}
|
|
19584
|
+
|
|
19585
|
+
// ../protocol/src/node/lost-exit-reaper.ts
|
|
19586
|
+
var log7 = createLogger("process");
|
|
19587
|
+
var REAP_GRACE_MS = 2000;
|
|
19588
|
+
var REAP_MAX_CHECK_MS = 30000;
|
|
19589
|
+
var REAP_MAX_CHECKS = 12;
|
|
19590
|
+
var REAP_MAX_PENDING = 256;
|
|
19591
|
+
function createLostExitReaper(options) {
|
|
19592
|
+
const { system } = options;
|
|
19593
|
+
const graceMs = options.graceMs ?? REAP_GRACE_MS;
|
|
19594
|
+
const maxCheckMs = options.maxCheckMs ?? REAP_MAX_CHECK_MS;
|
|
19595
|
+
const maxChecks = options.maxChecks ?? REAP_MAX_CHECKS;
|
|
19596
|
+
const maxPending = options.maxPending ?? REAP_MAX_PENDING;
|
|
19597
|
+
const pending = new Map;
|
|
19598
|
+
let reaped = 0;
|
|
19599
|
+
let abandoned = 0;
|
|
19600
|
+
const abandon = (pid, reason) => {
|
|
19601
|
+
abandoned += 1;
|
|
19602
|
+
log7.warn("child.reap-abandoned", { pid, reason });
|
|
19603
|
+
};
|
|
19604
|
+
const check = (pid, reported, startedAt) => {
|
|
19605
|
+
if (reported())
|
|
19606
|
+
return false;
|
|
19607
|
+
const found = system.inspect(pid);
|
|
19608
|
+
if (found === undefined)
|
|
19609
|
+
return true;
|
|
19610
|
+
if (found === "gone" || found.ppid !== system.selfPid)
|
|
19611
|
+
return false;
|
|
19612
|
+
if (!found.state.startsWith("Z"))
|
|
19613
|
+
return true;
|
|
19614
|
+
const result = system.waitNoHang(pid);
|
|
19615
|
+
if (result === pid) {
|
|
19616
|
+
reaped += 1;
|
|
19617
|
+
log7.info("child.reaped", { pid, waitedMs: Date.now() - startedAt });
|
|
19618
|
+
return false;
|
|
19619
|
+
}
|
|
19620
|
+
if (result === 0)
|
|
19621
|
+
return true;
|
|
19622
|
+
abandon(pid, "waitpid-failed");
|
|
19623
|
+
return false;
|
|
19624
|
+
};
|
|
19625
|
+
const schedule = (pid, reported, startedAt, delayMs, checks) => {
|
|
19626
|
+
const timer = setTimeout(() => {
|
|
19627
|
+
pending.delete(pid);
|
|
19628
|
+
let again;
|
|
19629
|
+
try {
|
|
19630
|
+
again = check(pid, reported, startedAt);
|
|
19631
|
+
} catch {
|
|
19632
|
+
again = true;
|
|
19633
|
+
}
|
|
19634
|
+
if (!again)
|
|
19635
|
+
return;
|
|
19636
|
+
if (checks + 1 >= maxChecks) {
|
|
19637
|
+
abandon(pid, "not-a-zombie");
|
|
19638
|
+
return;
|
|
19639
|
+
}
|
|
19640
|
+
schedule(pid, reported, startedAt, Math.min(delayMs * 2, maxCheckMs), checks + 1);
|
|
19641
|
+
}, delayMs);
|
|
19642
|
+
timer.unref?.();
|
|
19643
|
+
pending.set(pid, timer);
|
|
19644
|
+
};
|
|
19645
|
+
return {
|
|
19646
|
+
reap(pid, reported) {
|
|
19647
|
+
if (!Number.isSafeInteger(pid) || pid <= 1 || pid === system.selfPid)
|
|
19648
|
+
return;
|
|
19649
|
+
if (pending.has(pid) || reported())
|
|
19650
|
+
return;
|
|
19651
|
+
if (pending.size >= maxPending) {
|
|
19652
|
+
abandon(pid, "capacity");
|
|
19653
|
+
return;
|
|
19654
|
+
}
|
|
19655
|
+
schedule(pid, reported, Date.now(), graceMs, 0);
|
|
19656
|
+
},
|
|
19657
|
+
stats: () => ({ pending: pending.size, reaped, abandoned }),
|
|
19658
|
+
stop() {
|
|
19659
|
+
for (const timer of pending.values())
|
|
19660
|
+
clearTimeout(timer);
|
|
19661
|
+
pending.clear();
|
|
19662
|
+
}
|
|
19663
|
+
};
|
|
19664
|
+
}
|
|
19665
|
+
var WNOHANG = 1;
|
|
19666
|
+
function loadDarwinWaitpid(loadFfi = () => createRequire2(import.meta.url)("bun:ffi")) {
|
|
19667
|
+
try {
|
|
19668
|
+
const { dlopen, FFIType } = loadFfi();
|
|
19669
|
+
const libSystem = dlopen("/usr/lib/libSystem.B.dylib", {
|
|
19670
|
+
waitpid: { args: [FFIType.i32, FFIType.ptr, FFIType.i32], returns: FFIType.i32 }
|
|
19671
|
+
});
|
|
19672
|
+
const status = new Int32Array(1);
|
|
19673
|
+
return (pid) => libSystem.symbols.waitpid(pid, status, WNOHANG);
|
|
19674
|
+
} catch {
|
|
19675
|
+
return;
|
|
19676
|
+
}
|
|
19677
|
+
}
|
|
19678
|
+
function darwinReaperSystem(loadFfi) {
|
|
19679
|
+
const waitNoHang = loadDarwinWaitpid(loadFfi);
|
|
19680
|
+
if (!waitNoHang)
|
|
19681
|
+
return;
|
|
19682
|
+
return {
|
|
19683
|
+
selfPid: process.pid,
|
|
19684
|
+
inspect(pid) {
|
|
19685
|
+
const result = bunRuntime()?.spawnSync(["/bin/ps", "-o", "ppid=,stat=", "-p", String(pid)], PROCESS_INSPECTION_OPTIONS);
|
|
19686
|
+
if (!result)
|
|
19687
|
+
return;
|
|
19688
|
+
const output = result.stdout.toString().trim();
|
|
19689
|
+
if (!result.success)
|
|
19690
|
+
return result.exitCode === 1 && output === "" ? "gone" : undefined;
|
|
19691
|
+
const match = /^(\d+)\s+(\S+)$/.exec(output);
|
|
19692
|
+
return match ? { ppid: Number(match[1]), state: match[2] } : undefined;
|
|
19693
|
+
},
|
|
19694
|
+
waitNoHang
|
|
19695
|
+
};
|
|
19696
|
+
}
|
|
19697
|
+
var defaultReaper;
|
|
19698
|
+
function createDarwinLostExitReaper(loadFfi) {
|
|
19699
|
+
const system = darwinReaperSystem(loadFfi);
|
|
19700
|
+
if (!system)
|
|
19701
|
+
log7.warn("child.reap-unavailable");
|
|
19702
|
+
return system ? createLostExitReaper({ system }) : null;
|
|
19703
|
+
}
|
|
19704
|
+
function sharedReaper() {
|
|
19705
|
+
if (defaultReaper === undefined) {
|
|
19706
|
+
defaultReaper = createDarwinLostExitReaper();
|
|
19707
|
+
}
|
|
19708
|
+
return defaultReaper ?? undefined;
|
|
19709
|
+
}
|
|
19710
|
+
function reapAfterLostExit(pid, reported) {
|
|
19711
|
+
if (process.platform !== "darwin" || pid === undefined || !bunRuntime())
|
|
19712
|
+
return;
|
|
19713
|
+
sharedReaper()?.reap(pid, reported);
|
|
19714
|
+
}
|
|
19715
|
+
|
|
19716
|
+
// ../protocol/src/node/command-capture.ts
|
|
19717
|
+
class CommandFailedError extends Error {
|
|
19718
|
+
stdout;
|
|
19719
|
+
stdoutBytes;
|
|
19720
|
+
stderr;
|
|
19721
|
+
timedOut;
|
|
19722
|
+
outputCloseTimedOut;
|
|
19723
|
+
executableMissing;
|
|
19724
|
+
aborted;
|
|
19725
|
+
outputLimitExceeded;
|
|
19726
|
+
exitCode;
|
|
19727
|
+
signal;
|
|
19728
|
+
constructor(message, details = {}) {
|
|
19729
|
+
super(message);
|
|
19730
|
+
this.name = "CommandFailedError";
|
|
19731
|
+
this.stdout = details.stdout ?? "";
|
|
19732
|
+
this.stdoutBytes = details.stdoutBytes ?? Buffer.alloc(0);
|
|
19733
|
+
this.stderr = details.stderr ?? "";
|
|
19734
|
+
this.timedOut = details.timedOut ?? false;
|
|
19735
|
+
this.outputCloseTimedOut = details.outputCloseTimedOut ?? false;
|
|
19736
|
+
this.executableMissing = details.executableMissing ?? false;
|
|
19737
|
+
this.aborted = details.aborted ?? false;
|
|
19738
|
+
this.outputLimitExceeded = details.outputLimitExceeded ?? false;
|
|
19739
|
+
this.exitCode = details.exitCode ?? null;
|
|
19740
|
+
this.signal = details.signal ?? null;
|
|
19741
|
+
}
|
|
19742
|
+
toJSON() {
|
|
19743
|
+
return { ...formatLogError(this), ...classifyCommandFailure(this) };
|
|
19744
|
+
}
|
|
19745
|
+
[inspect.custom]() {
|
|
19746
|
+
const { name, reason, exitCode, signal, stack } = this.toJSON();
|
|
19747
|
+
const frames = stack?.length ? ` | ${stack.join(" | ")}` : "";
|
|
19748
|
+
return `${name} reason=${reason} exitCode=${exitCode} signal=${signal} outputOmitted=true${frames}`;
|
|
19749
|
+
}
|
|
19750
|
+
}
|
|
19751
|
+
function redactCommandValues(value, redactValues) {
|
|
19752
|
+
const secrets = Array.from(new Set((redactValues ?? []).filter((secret) => typeof secret === "string" && secret.length > 0))).sort((left, right) => right.length - left.length);
|
|
19753
|
+
return secrets.reduce((redacted, secret) => redacted.split(secret).join("[REDACTED]"), value);
|
|
19754
|
+
}
|
|
19755
|
+
var COMMAND_ABORTED_MESSAGE = "Command aborted";
|
|
19756
|
+
var OUTPUT_LIMIT_MESSAGE = "maxBuffer length exceeded";
|
|
19757
|
+
function commandFailureOutcome(error) {
|
|
19758
|
+
const details = error ?? {};
|
|
19759
|
+
const message = typeof details.message === "string" ? details.message : "";
|
|
19760
|
+
return {
|
|
19761
|
+
timedOut: details.killed === true,
|
|
19762
|
+
executableMissing: details.code === "ENOENT",
|
|
19763
|
+
aborted: message === COMMAND_ABORTED_MESSAGE,
|
|
19764
|
+
outputLimitExceeded: details.outputLimitExceeded === true,
|
|
19765
|
+
exitCode: typeof details.code === "number" ? details.code : null,
|
|
19766
|
+
signal: details.signal ?? null
|
|
19767
|
+
};
|
|
19768
|
+
}
|
|
19769
|
+
var commandInvocations = new Map;
|
|
19770
|
+
var commandCaptureMetrics;
|
|
19771
|
+
var commandObservers = new Map;
|
|
19772
|
+
function nonInteractiveGitEnv(env) {
|
|
19773
|
+
const merged = { ...env ?? process.env };
|
|
19774
|
+
merged.GIT_TERMINAL_PROMPT ??= "0";
|
|
19775
|
+
if (process.platform !== "win32") {
|
|
19776
|
+
merged.SSH_ASKPASS ??= "/usr/bin/false";
|
|
19777
|
+
merged.SSH_ASKPASS_REQUIRE ??= "force";
|
|
19778
|
+
}
|
|
19779
|
+
return merged;
|
|
19780
|
+
}
|
|
19781
|
+
var MAX_COMMAND_OUTPUT_BYTES = 50 * 1024 * 1024;
|
|
19782
|
+
var COMMAND_KILL_GRACE_MS = 100;
|
|
19783
|
+
var COMMAND_OUTPUT_CHECK_MS = 100;
|
|
19784
|
+
var COMMAND_GROUP_POLL_MS = 5;
|
|
19785
|
+
var COMMAND_GROUP_POLL_MAX_MS = 200;
|
|
19786
|
+
function openCaptureFile() {
|
|
19787
|
+
const filePath = path2.join(os.tmpdir(), `orkestrator-capture-${randomUUID()}`);
|
|
19788
|
+
const fd = captureFs.openSync(filePath, fsConstants.O_CREAT | fsConstants.O_EXCL | fsConstants.O_RDWR | fsConstants.O_APPEND, 384);
|
|
19789
|
+
try {
|
|
19790
|
+
captureFs.unlinkSync(filePath);
|
|
19791
|
+
return fd;
|
|
19792
|
+
} catch (error) {
|
|
19793
|
+
captureFs.closeSync(fd);
|
|
19794
|
+
throw error;
|
|
19795
|
+
}
|
|
19796
|
+
}
|
|
19797
|
+
function readCaptureFile(fd, limit) {
|
|
19798
|
+
const size = Math.min(captureFs.fstatSync(fd).size, limit);
|
|
19799
|
+
const buffer = Buffer.allocUnsafe(size);
|
|
19800
|
+
let offset = 0;
|
|
19801
|
+
while (offset < size) {
|
|
19802
|
+
const bytesRead = captureFs.readSync(fd, buffer, offset, size - offset, offset);
|
|
19803
|
+
if (bytesRead === 0)
|
|
19804
|
+
break;
|
|
19805
|
+
offset += bytesRead;
|
|
19806
|
+
}
|
|
19807
|
+
return buffer.subarray(0, offset);
|
|
19808
|
+
}
|
|
19809
|
+
function spawnCaptured(command, args, options, stdoutFd, stderrFd) {
|
|
19810
|
+
const payload = options.stdin?.length ? Buffer.from(options.stdin) : undefined;
|
|
19811
|
+
const env = command === "git" ? nonInteractiveGitEnv(options.env) : options.env ?? process.env;
|
|
19812
|
+
const detached = process.platform !== "win32";
|
|
19813
|
+
const bun = bunRuntime();
|
|
19814
|
+
if (bun) {
|
|
19815
|
+
const child = bun.spawn([command, ...args], {
|
|
19816
|
+
cwd: options.cwd,
|
|
19817
|
+
env,
|
|
19818
|
+
detached,
|
|
19819
|
+
windowsHide: true,
|
|
19820
|
+
stdin: payload ?? "pipe",
|
|
19821
|
+
stdout: stdoutFd,
|
|
19822
|
+
stderr: stderrFd
|
|
19823
|
+
});
|
|
19824
|
+
if (!payload)
|
|
19825
|
+
closeStdin(child.stdin);
|
|
19826
|
+
const current = () => ({ code: child.exitCode, signal: child.signalCode });
|
|
19827
|
+
return {
|
|
19828
|
+
pid: child.pid,
|
|
19829
|
+
exited: child.exited.then(current),
|
|
19830
|
+
current,
|
|
19831
|
+
kill: (signal) => child.kill(signal)
|
|
19832
|
+
};
|
|
19833
|
+
}
|
|
19834
|
+
const child = spawn3(command, args, {
|
|
19835
|
+
cwd: options.cwd,
|
|
19836
|
+
env,
|
|
19837
|
+
detached,
|
|
19838
|
+
windowsHide: true,
|
|
19839
|
+
stdio: [payload ? "pipe" : "ignore", stdoutFd, stderrFd]
|
|
19840
|
+
});
|
|
19841
|
+
if (payload) {
|
|
19842
|
+
child.stdin?.on("error", () => {
|
|
19843
|
+
return;
|
|
19844
|
+
});
|
|
19845
|
+
child.stdin?.end(payload);
|
|
19846
|
+
}
|
|
19847
|
+
return {
|
|
19848
|
+
pid: child.pid,
|
|
19849
|
+
exited: new Promise((resolve, reject) => {
|
|
19850
|
+
child.once("exit", (code, signal) => resolve({ code, signal }));
|
|
19851
|
+
child.once("error", reject);
|
|
19852
|
+
}),
|
|
19853
|
+
current: () => ({ code: child.exitCode, signal: child.signalCode }),
|
|
19854
|
+
kill: (signal) => {
|
|
19855
|
+
child.kill(signal);
|
|
19856
|
+
}
|
|
19857
|
+
};
|
|
19858
|
+
}
|
|
19859
|
+
function closeStdin(stdin) {
|
|
19860
|
+
try {
|
|
19861
|
+
Promise.resolve(stdin.end()).catch(() => {
|
|
19862
|
+
return;
|
|
19863
|
+
});
|
|
19864
|
+
} catch {}
|
|
19865
|
+
}
|
|
19866
|
+
function exitReported(child) {
|
|
19867
|
+
const { code, signal } = child.current();
|
|
19868
|
+
return code !== null || signal !== null;
|
|
19869
|
+
}
|
|
19870
|
+
function signalCommand(child, signal) {
|
|
19871
|
+
if (child.pid === undefined)
|
|
19872
|
+
return;
|
|
19873
|
+
try {
|
|
19874
|
+
if (process.platform !== "win32") {
|
|
19875
|
+
process.kill(-child.pid, signal);
|
|
19876
|
+
} else {
|
|
19877
|
+
child.kill(signal);
|
|
19878
|
+
}
|
|
19879
|
+
} catch {}
|
|
19880
|
+
}
|
|
19881
|
+
function commandGroupAlive(child) {
|
|
19882
|
+
if (process.platform === "win32" || child.pid === undefined)
|
|
19883
|
+
return false;
|
|
19884
|
+
try {
|
|
19885
|
+
process.kill(-child.pid, 0);
|
|
19886
|
+
} catch (error) {
|
|
19887
|
+
if (error.code === "ESRCH")
|
|
19888
|
+
return false;
|
|
19889
|
+
}
|
|
19890
|
+
return groupHasLiveMember(child.pid);
|
|
19891
|
+
}
|
|
19892
|
+
function executeCommandBytes(command, args, options, timeoutMs, outputLimit, stderrLimit) {
|
|
19893
|
+
return new Promise((resolve, reject) => {
|
|
19894
|
+
if (options.signal?.aborted) {
|
|
19895
|
+
reject(Object.assign(new Error(COMMAND_ABORTED_MESSAGE), { killed: true }));
|
|
19896
|
+
return;
|
|
19897
|
+
}
|
|
19898
|
+
const captureFds = [];
|
|
19899
|
+
const releaseCaptureFds = () => {
|
|
19900
|
+
for (const fd of captureFds.splice(0)) {
|
|
19901
|
+
try {
|
|
19902
|
+
captureFs.closeSync(fd);
|
|
19903
|
+
} catch {}
|
|
19904
|
+
}
|
|
19905
|
+
};
|
|
19906
|
+
try {
|
|
19907
|
+
captureFds.push(openCaptureFile());
|
|
19908
|
+
captureFds.push(openCaptureFile());
|
|
19909
|
+
} catch (error) {
|
|
19910
|
+
releaseCaptureFds();
|
|
19911
|
+
const code = error.code ?? "unknown";
|
|
19912
|
+
reject(new Error(`Could not open a command output file in the temporary directory: ${code}`));
|
|
19913
|
+
return;
|
|
19914
|
+
}
|
|
19915
|
+
const [stdoutFd, stderrFd] = captureFds;
|
|
19916
|
+
let child;
|
|
19917
|
+
try {
|
|
19918
|
+
child = spawnCaptured(command, args, options, stdoutFd, stderrFd);
|
|
19919
|
+
} catch (error) {
|
|
19920
|
+
releaseCaptureFds();
|
|
19921
|
+
reject(error);
|
|
19922
|
+
return;
|
|
19923
|
+
}
|
|
19924
|
+
let settled = false;
|
|
19925
|
+
let timedOut = false;
|
|
19926
|
+
let timeoutTimer;
|
|
19927
|
+
let groupTimer;
|
|
19928
|
+
let limitTimer;
|
|
19929
|
+
let stopExitWatch = () => {};
|
|
19930
|
+
let commandExit;
|
|
19931
|
+
const finishCapture = () => {
|
|
19932
|
+
settled = true;
|
|
19933
|
+
clearTimeout(timeoutTimer);
|
|
19934
|
+
clearTimeout(groupTimer);
|
|
19935
|
+
clearInterval(limitTimer);
|
|
19936
|
+
stopExitWatch();
|
|
19937
|
+
options.signal?.removeEventListener("abort", abort);
|
|
19938
|
+
if (!exitReported(child))
|
|
19939
|
+
reapAfterLostExit(child.pid, () => exitReported(child));
|
|
19940
|
+
try {
|
|
19941
|
+
return {
|
|
19942
|
+
stdout: readCaptureFile(stdoutFd, outputLimit),
|
|
19943
|
+
stderr: readCaptureFile(stderrFd, stderrLimit)
|
|
19944
|
+
};
|
|
19945
|
+
} catch (error) {
|
|
19946
|
+
reject(error);
|
|
19947
|
+
return;
|
|
19948
|
+
} finally {
|
|
19949
|
+
releaseCaptureFds();
|
|
19950
|
+
}
|
|
19951
|
+
};
|
|
19952
|
+
const fail = (error) => {
|
|
19953
|
+
if (settled)
|
|
19954
|
+
return;
|
|
19955
|
+
const output = finishCapture();
|
|
19956
|
+
if (output)
|
|
19957
|
+
reject(Object.assign(error, { ...output, killed: timedOut }));
|
|
19958
|
+
};
|
|
19959
|
+
const abort = () => {
|
|
19960
|
+
timedOut = true;
|
|
19961
|
+
signalCommand(child, "SIGKILL");
|
|
19962
|
+
fail(new Error(COMMAND_ABORTED_MESSAGE));
|
|
19963
|
+
};
|
|
19964
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
19965
|
+
const checkOutputLimit = () => {
|
|
19966
|
+
const stream = captureFs.fstatSync(stdoutFd).size > outputLimit ? "stdout" : captureFs.fstatSync(stderrFd).size > stderrLimit ? "stderr" : undefined;
|
|
19967
|
+
if (stream === undefined)
|
|
19968
|
+
return false;
|
|
19969
|
+
signalCommand(child, "SIGKILL");
|
|
19970
|
+
fail(Object.assign(new Error(`${stream} ${OUTPUT_LIMIT_MESSAGE}`), {
|
|
19971
|
+
outputLimitExceeded: true
|
|
19972
|
+
}));
|
|
19973
|
+
return true;
|
|
19974
|
+
};
|
|
19975
|
+
const failIfOverLimit = () => {
|
|
19976
|
+
try {
|
|
19977
|
+
return checkOutputLimit();
|
|
19978
|
+
} catch (error) {
|
|
19979
|
+
signalCommand(child, "SIGKILL");
|
|
19980
|
+
fail(error instanceof Error ? error : new Error(String(error)));
|
|
19981
|
+
return true;
|
|
19982
|
+
}
|
|
19983
|
+
};
|
|
19984
|
+
limitTimer = setInterval(() => {
|
|
19985
|
+
if (!settled && !timedOut)
|
|
19986
|
+
failIfOverLimit();
|
|
19987
|
+
}, COMMAND_OUTPUT_CHECK_MS);
|
|
19988
|
+
const settleOnExit = () => {
|
|
19989
|
+
if (settled || timedOut || failIfOverLimit())
|
|
19990
|
+
return;
|
|
19991
|
+
if (commandExit?.code !== 0 || commandExit.signal !== null) {
|
|
19992
|
+
fail(Object.assign(new Error(`Command failed: ${[command, ...args].join(" ")}`), {
|
|
19993
|
+
code: commandExit?.code,
|
|
19994
|
+
signal: commandExit?.signal
|
|
19995
|
+
}));
|
|
19996
|
+
return;
|
|
19997
|
+
}
|
|
19998
|
+
const output = finishCapture();
|
|
19999
|
+
if (output)
|
|
20000
|
+
resolve(output);
|
|
20001
|
+
};
|
|
20002
|
+
const awaitGroupExit = (delayMs) => {
|
|
20003
|
+
if (settled || timedOut)
|
|
20004
|
+
return;
|
|
20005
|
+
if (commandGroupAlive(child)) {
|
|
20006
|
+
groupTimer = setTimeout(awaitGroupExit, delayMs, Math.min(delayMs * 2, COMMAND_GROUP_POLL_MAX_MS));
|
|
20007
|
+
return;
|
|
20008
|
+
}
|
|
20009
|
+
settleOnExit();
|
|
20010
|
+
};
|
|
20011
|
+
const onCommandExit = (exit) => {
|
|
20012
|
+
if (commandExit)
|
|
20013
|
+
return;
|
|
20014
|
+
commandExit = exit;
|
|
20015
|
+
stopExitWatch();
|
|
20016
|
+
if (options.waitForDescendants)
|
|
20017
|
+
awaitGroupExit(COMMAND_GROUP_POLL_MS);
|
|
20018
|
+
else
|
|
20019
|
+
settleOnExit();
|
|
20020
|
+
};
|
|
20021
|
+
child.exited.then(onCommandExit, (error) => fail(error instanceof Error ? error : new Error(String(error))));
|
|
20022
|
+
stopExitWatch = watchForLostExit(child.pid, (exit) => {
|
|
20023
|
+
if (!settled && !timedOut)
|
|
20024
|
+
onCommandExit(exit);
|
|
20025
|
+
});
|
|
20026
|
+
if (timeoutMs > 0) {
|
|
20027
|
+
timeoutTimer = setTimeout(() => {
|
|
20028
|
+
timedOut = true;
|
|
20029
|
+
signalCommand(child, "SIGTERM");
|
|
20030
|
+
timeoutTimer = setTimeout(() => {
|
|
20031
|
+
signalCommand(child, "SIGKILL");
|
|
20032
|
+
fail(Object.assign(new Error(`Command timed out after ${timeoutMs} ms`), {
|
|
20033
|
+
code: child.current().code,
|
|
20034
|
+
signal: child.current().signal
|
|
20035
|
+
}));
|
|
20036
|
+
}, COMMAND_KILL_GRACE_MS);
|
|
20037
|
+
}, timeoutMs);
|
|
20038
|
+
}
|
|
20039
|
+
});
|
|
20040
|
+
}
|
|
20041
|
+
async function runCommandBytes(command, args = [], options = {}) {
|
|
20042
|
+
const timeoutMs = options.timeoutMs ?? 60000;
|
|
20043
|
+
if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 0 || timeoutMs > 2147483647) {
|
|
20044
|
+
throw new RangeError("timeoutMs must be an integer between 0 and 2147483647");
|
|
20045
|
+
}
|
|
20046
|
+
const outputLimit = options.maxOutputBytes ?? MAX_COMMAND_OUTPUT_BYTES;
|
|
20047
|
+
if (!Number.isSafeInteger(outputLimit) || outputLimit <= 0) {
|
|
20048
|
+
throw new RangeError("maxOutputBytes must be a positive integer");
|
|
20049
|
+
}
|
|
20050
|
+
const stderrLimit = options.maxStderrBytes ?? outputLimit;
|
|
20051
|
+
if (!Number.isSafeInteger(stderrLimit) || stderrLimit <= 0) {
|
|
20052
|
+
throw new RangeError("maxStderrBytes must be a positive integer");
|
|
20053
|
+
}
|
|
20054
|
+
if (commandInvocations.size < 64 || commandInvocations.has(command)) {
|
|
20055
|
+
commandInvocations.set(command, (commandInvocations.get(command) ?? 0) + 1);
|
|
20056
|
+
}
|
|
20057
|
+
for (const observer of commandObservers.get(command) ?? [])
|
|
20058
|
+
observer(args);
|
|
20059
|
+
commandCaptureMetrics?.started(command, args);
|
|
20060
|
+
try {
|
|
20061
|
+
const { stdout, stderr } = await executeCommandBytes(command, args, options, timeoutMs, outputLimit, stderrLimit);
|
|
20062
|
+
commandCaptureMetrics?.capturedBytes(stdout.length);
|
|
20063
|
+
return {
|
|
20064
|
+
stdout: Buffer.isBuffer(stdout) ? stdout : Buffer.from(stdout),
|
|
20065
|
+
stderr: Buffer.isBuffer(stderr) ? stderr : Buffer.from(stderr)
|
|
20066
|
+
};
|
|
20067
|
+
} catch (error) {
|
|
20068
|
+
const outcome = commandFailureOutcome(error);
|
|
20069
|
+
const redacting = options.redactValues?.some((value) => typeof value === "string" && value.length > 0);
|
|
20070
|
+
if (error && typeof error === "object" && "stdout" in error && "stderr" in error) {
|
|
20071
|
+
const withOutput = error;
|
|
20072
|
+
const stderr = withOutput.stderr?.toString() ?? "";
|
|
20073
|
+
const stdout = withOutput.stdout?.toString() ?? "";
|
|
20074
|
+
const message = (stderr || stdout || withOutput.message || "Command failed").trim();
|
|
20075
|
+
throw new CommandFailedError(redactCommandValues(message, options.redactValues), {
|
|
20076
|
+
...outcome,
|
|
20077
|
+
stdout: redactCommandValues(stdout, options.redactValues),
|
|
20078
|
+
stderr: redactCommandValues(stderr, options.redactValues),
|
|
20079
|
+
...!redacting && Buffer.isBuffer(withOutput.stdout) ? { stdoutBytes: withOutput.stdout } : {}
|
|
20080
|
+
});
|
|
20081
|
+
}
|
|
20082
|
+
if (redacting) {
|
|
20083
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
20084
|
+
throw new CommandFailedError(redactCommandValues(message || "Command failed", options.redactValues), outcome);
|
|
20085
|
+
}
|
|
20086
|
+
if (outcome.timedOut || outcome.executableMissing) {
|
|
20087
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
20088
|
+
throw new CommandFailedError(message || "Command failed", outcome);
|
|
20089
|
+
}
|
|
20090
|
+
throw error;
|
|
20091
|
+
}
|
|
20092
|
+
}
|
|
20093
|
+
async function runCommand(command, args = [], options = {}) {
|
|
20094
|
+
const { stdout, stderr } = await runCommandBytes(command, args, options);
|
|
20095
|
+
return {
|
|
20096
|
+
stdout: redactCommandValues(stdout.toString(), options.redactValues),
|
|
20097
|
+
stderr: redactCommandValues(stderr.toString(), options.redactValues)
|
|
20098
|
+
};
|
|
20099
|
+
}
|
|
20100
|
+
|
|
20101
|
+
// ../protocol/src/node/workspace-change-probe.ts
|
|
19256
20102
|
var DEFAULT_MAX_UNTRACKED_FILE_BYTES = 2 * 1024 * 1024;
|
|
19257
20103
|
var DEFAULT_MAX_UNTRACKED_FILES = 5000;
|
|
19258
20104
|
var DEFAULT_SLOW_SNAPSHOT_MS = 500;
|
|
@@ -19270,27 +20116,16 @@ process.once("exit", () => {
|
|
|
19270
20116
|
} catch {}
|
|
19271
20117
|
}
|
|
19272
20118
|
});
|
|
19273
|
-
var runGit = (args, options) =>
|
|
19274
|
-
const
|
|
19275
|
-
|
|
19276
|
-
|
|
19277
|
-
|
|
19278
|
-
|
|
19279
|
-
|
|
19280
|
-
let stdout = "";
|
|
19281
|
-
let stdoutBytes = 0;
|
|
19282
|
-
child.stdout.setEncoding("utf8");
|
|
19283
|
-
child.stdout.on("data", (chunk) => {
|
|
19284
|
-
stdoutBytes += chunk.length;
|
|
19285
|
-
if (stdoutBytes <= GIT_MAX_BUFFER)
|
|
19286
|
-
stdout += chunk;
|
|
20119
|
+
var runGit = async (args, options) => {
|
|
20120
|
+
const { stdout } = await runCommand("git", args, {
|
|
20121
|
+
cwd: options.cwd,
|
|
20122
|
+
env: { ...process.env, ...options.env, GIT_OPTIONAL_LOCKS: "0" },
|
|
20123
|
+
timeoutMs: GIT_TIMEOUT_MS,
|
|
20124
|
+
maxOutputBytes: GIT_MAX_BUFFER,
|
|
20125
|
+
...options.stdin === undefined ? {} : { stdin: options.stdin }
|
|
19287
20126
|
});
|
|
19288
|
-
|
|
19289
|
-
|
|
19290
|
-
child.on("close", (code) => code === 0 ? resolvePromise({ stdout }) : reject(new Error(`git exited with ${code}`)));
|
|
19291
|
-
child.stdin.on("error", () => {});
|
|
19292
|
-
child.stdin.end(options.stdin);
|
|
19293
|
-
});
|
|
20127
|
+
return { stdout };
|
|
20128
|
+
};
|
|
19294
20129
|
|
|
19295
20130
|
class WorkspaceChangeProbe {
|
|
19296
20131
|
git;
|
|
@@ -19578,7 +20413,7 @@ class WorkspaceChangeProbe {
|
|
|
19578
20413
|
return;
|
|
19579
20414
|
const { root, indexPath } = repo.location;
|
|
19580
20415
|
const started = this.now();
|
|
19581
|
-
const tempIndex = join6(this.tempDir, `orkestrator-probe-${
|
|
20416
|
+
const tempIndex = join6(this.tempDir, `orkestrator-probe-${randomUUID2()}.index`);
|
|
19582
20417
|
const objectDirectory = await mkdtemp(join6(this.tempDir, "orkestrator-probe-objects-"));
|
|
19583
20418
|
temporaryObjectDirectories.add(objectDirectory);
|
|
19584
20419
|
let retained = false;
|
|
@@ -19841,7 +20676,7 @@ function acpToolKind(source, runtime) {
|
|
|
19841
20676
|
}
|
|
19842
20677
|
|
|
19843
20678
|
// ../../bridges/acp-bridge/src/change-evidence.ts
|
|
19844
|
-
import { randomUUID as
|
|
20679
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
19845
20680
|
import { resolve as resolve5 } from "node:path";
|
|
19846
20681
|
|
|
19847
20682
|
// ../protocol/src/field-validation.ts
|
|
@@ -20245,8 +21080,8 @@ function workspaceObservationReportIssues(value) {
|
|
|
20245
21080
|
}
|
|
20246
21081
|
|
|
20247
21082
|
// ../protocol/src/node/change-tracking/evidence-spool.ts
|
|
20248
|
-
import { createHash as createHash6, randomUUID as
|
|
20249
|
-
import { readdirSync, readFileSync as
|
|
21083
|
+
import { createHash as createHash6, randomUUID as randomUUID3 } from "node:crypto";
|
|
21084
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync3 } from "node:fs";
|
|
20250
21085
|
import { appendFile as appendFile2, mkdir as mkdir2, rename as rename2, rm as rm3, writeFile as writeFile2 } from "node:fs/promises";
|
|
20251
21086
|
import { join as join7 } from "node:path";
|
|
20252
21087
|
var DEFAULT_EVIDENCE_SPOOL_LIMITS = {
|
|
@@ -20291,7 +21126,7 @@ class ChangeEvidenceSpool {
|
|
|
20291
21126
|
restoring = false;
|
|
20292
21127
|
constructor(options = {}) {
|
|
20293
21128
|
this.limits = { ...DEFAULT_EVIDENCE_SPOOL_LIMITS, ...options.limits };
|
|
20294
|
-
this.runtimeEpoch = options.runtimeEpoch ??
|
|
21129
|
+
this.runtimeEpoch = options.runtimeEpoch ?? randomUUID3();
|
|
20295
21130
|
this.directory = options.directory;
|
|
20296
21131
|
if (this.directory) {
|
|
20297
21132
|
this.restoring = true;
|
|
@@ -20394,7 +21229,7 @@ class ChangeEvidenceSpool {
|
|
|
20394
21229
|
return;
|
|
20395
21230
|
if (this.entries.length >= this.limits.maxEntries - 1)
|
|
20396
21231
|
return;
|
|
20397
|
-
const gapId =
|
|
21232
|
+
const gapId = randomUUID3();
|
|
20398
21233
|
const coverage = this.droppedUnknown ? {
|
|
20399
21234
|
kind: "unknown-range",
|
|
20400
21235
|
bindingId: this.gapBindingId || "unknown",
|
|
@@ -20556,8 +21391,8 @@ class ChangeEvidenceSpool {
|
|
|
20556
21391
|
restore(directory) {
|
|
20557
21392
|
const bodyDirectory = join7(directory, BODY_DIRECTORY);
|
|
20558
21393
|
try {
|
|
20559
|
-
for (const name of
|
|
20560
|
-
const bytes = new Uint8Array(
|
|
21394
|
+
for (const name of readdirSync2(bodyDirectory)) {
|
|
21395
|
+
const bytes = new Uint8Array(readFileSync3(join7(bodyDirectory, name)));
|
|
20561
21396
|
const id = evidenceBodyId(bytes);
|
|
20562
21397
|
if (bodyFileName(id) !== name)
|
|
20563
21398
|
continue;
|
|
@@ -20569,7 +21404,7 @@ class ChangeEvidenceSpool {
|
|
|
20569
21404
|
} catch {}
|
|
20570
21405
|
let text = "";
|
|
20571
21406
|
try {
|
|
20572
|
-
text =
|
|
21407
|
+
text = readFileSync3(join7(directory, ENTRIES_FILE), "utf8");
|
|
20573
21408
|
} catch {
|
|
20574
21409
|
return;
|
|
20575
21410
|
}
|
|
@@ -20907,7 +21742,7 @@ function canonicalEvidence(evidence) {
|
|
|
20907
21742
|
}
|
|
20908
21743
|
|
|
20909
21744
|
// ../../bridges/acp-bridge/src/change-evidence.ts
|
|
20910
|
-
var
|
|
21745
|
+
var log8 = createLogger("bridge.acp");
|
|
20911
21746
|
var MAX_DIFF_BLOCKS_PER_CALL = 100;
|
|
20912
21747
|
var MAX_HELD_DIFF_BYTES = 32 * 1024 * 1024;
|
|
20913
21748
|
var MAX_SEEN_CALL_IDS = 8192;
|
|
@@ -21031,7 +21866,7 @@ function recordFor(state, part) {
|
|
|
21031
21866
|
evidence.pendingApprovals.delete(part.toolUseId);
|
|
21032
21867
|
record = {
|
|
21033
21868
|
callId: part.toolUseId,
|
|
21034
|
-
...isReusedCallId(state, evidence, part) ? { attemptId: `reuse:${turnId ??
|
|
21869
|
+
...isReusedCallId(state, evidence, part) ? { attemptId: `reuse:${turnId ?? randomUUID4()}` } : {},
|
|
21035
21870
|
...turnId ? { turnId } : {},
|
|
21036
21871
|
awaitingApproval: approval === "awaiting",
|
|
21037
21872
|
approved: false,
|
|
@@ -21206,7 +22041,7 @@ function recordAcpToolEvidence(state, part, update) {
|
|
|
21206
22041
|
if (isTerminal(phase))
|
|
21207
22042
|
settleRecord(state, part, record);
|
|
21208
22043
|
} catch (error) {
|
|
21209
|
-
|
|
22044
|
+
log8.warn("evidence.record-failed", {
|
|
21210
22045
|
errorClass: error instanceof Error ? error.name : "unknown"
|
|
21211
22046
|
});
|
|
21212
22047
|
}
|
|
@@ -21250,13 +22085,13 @@ function recordAcpShellObservation(state, toolUseId, observation) {
|
|
|
21250
22085
|
...observation.unavailableReason ? { unavailableReason: observation.unavailableReason } : {}
|
|
21251
22086
|
});
|
|
21252
22087
|
} catch (error) {
|
|
21253
|
-
|
|
22088
|
+
log8.warn("evidence.shell-record-failed", {
|
|
21254
22089
|
errorClass: error instanceof Error ? error.name : "unknown"
|
|
21255
22090
|
});
|
|
21256
22091
|
}
|
|
21257
22092
|
}
|
|
21258
22093
|
function beginAcpTurnEvidence(state, requestId) {
|
|
21259
|
-
const turnId = requestId || `turn:${
|
|
22094
|
+
const turnId = requestId || `turn:${randomUUID4()}`;
|
|
21260
22095
|
evidenceFor(state).turn = { turnId, backgroundLaunched: false };
|
|
21261
22096
|
changeEvidenceRecorder().turn({ conversationId: state.id, turnId }, "running", "may-write");
|
|
21262
22097
|
}
|
|
@@ -21282,14 +22117,14 @@ function endAcpTurnEvidence(state, outcome) {
|
|
|
21282
22117
|
const writers = state.activeSubagentToolIds.size > 0 || turn.backgroundLaunched ? "may-write" : "quiescent";
|
|
21283
22118
|
changeEvidenceRecorder().turn({ conversationId: state.id, turnId: turn.turnId }, outcome, writers);
|
|
21284
22119
|
} catch (error) {
|
|
21285
|
-
|
|
22120
|
+
log8.warn("evidence.turn-record-failed", {
|
|
21286
22121
|
errorClass: error instanceof Error ? error.name : "unknown"
|
|
21287
22122
|
});
|
|
21288
22123
|
}
|
|
21289
22124
|
}
|
|
21290
22125
|
|
|
21291
22126
|
// ../../bridges/acp-bridge/src/acp-command-changes.ts
|
|
21292
|
-
var
|
|
22127
|
+
var log9 = createLogger("bridge.acp");
|
|
21293
22128
|
var MAX_WINDOWS_PER_SESSION = 256;
|
|
21294
22129
|
var MAX_CACHED_JOURNALS = MAX_RESUMABLE_SESSIONS;
|
|
21295
22130
|
var probe;
|
|
@@ -21403,7 +22238,7 @@ function closeWindow(active, state, toolUseId, role) {
|
|
|
21403
22238
|
recordAcpShellObservation(state, toolUseId, observation);
|
|
21404
22239
|
recordCommandChange(state, toolUseId, legacyCommandChange(observation));
|
|
21405
22240
|
}).catch((error) => {
|
|
21406
|
-
|
|
22241
|
+
log9.warn("command-change.record-failed", {
|
|
21407
22242
|
errorClass: error instanceof Error ? error.name : "unknown"
|
|
21408
22243
|
});
|
|
21409
22244
|
});
|
|
@@ -23450,6 +24285,7 @@ function effectiveLogLevel(detail, area) {
|
|
|
23450
24285
|
return detail.level;
|
|
23451
24286
|
}
|
|
23452
24287
|
}
|
|
24288
|
+
var LOG_DETAIL_EXPIRY_MS = 24 * 60 * 60 * 1000;
|
|
23453
24289
|
function logDetailEnablesBridgeDiagnostics(detail) {
|
|
23454
24290
|
return LEVEL_DETAIL[effectiveLogLevel(detail, BRIDGE_DIAGNOSTICS_LOG_AREA)] >= LEVEL_DETAIL.debug;
|
|
23455
24291
|
}
|
|
@@ -25044,7 +25880,7 @@ function holdParkedRequest(state, family, id, held) {
|
|
|
25044
25880
|
|
|
25045
25881
|
// ../../bridges/acp-bridge/src/acp-http.ts
|
|
25046
25882
|
var TRANSCRIPT_GENERATION = randomBytes10(16).toString("hex");
|
|
25047
|
-
var
|
|
25883
|
+
var log10 = createLogger("bridge.acp");
|
|
25048
25884
|
|
|
25049
25885
|
class CommandUnavailableError extends Error {
|
|
25050
25886
|
}
|
|
@@ -25098,7 +25934,7 @@ async function route(request, response, clientSignal) {
|
|
|
25098
25934
|
} catch (error) {
|
|
25099
25935
|
if (error instanceof HttpError || error instanceof CredentialError)
|
|
25100
25936
|
throw error;
|
|
25101
|
-
|
|
25937
|
+
log10.warn("http.route-failed", {
|
|
25102
25938
|
method: request.method,
|
|
25103
25939
|
error: formatLogError(error, { message: false })
|
|
25104
25940
|
});
|
|
@@ -25988,9 +26824,9 @@ function installFatalRejectionGuard(options) {
|
|
|
25988
26824
|
}
|
|
25989
26825
|
|
|
25990
26826
|
// ../protocol/src/node/process-failure-log.ts
|
|
25991
|
-
var
|
|
26827
|
+
var log11 = createLogger("process");
|
|
25992
26828
|
function logUnhandledRejection(reason) {
|
|
25993
|
-
|
|
26829
|
+
log11.throttled("error", "rejection.unhandled", {
|
|
25994
26830
|
error: reason,
|
|
25995
26831
|
fields: () => ({ error: formatLogError(reason, { message: false }) })
|
|
25996
26832
|
});
|
|
@@ -26023,7 +26859,7 @@ function watchClientDisconnect(request, response, onDisconnect) {
|
|
|
26023
26859
|
}
|
|
26024
26860
|
|
|
26025
26861
|
// ../../bridges/acp-bridge/src/acp-server.ts
|
|
26026
|
-
var
|
|
26862
|
+
var log12 = createLogger("bridge.acp");
|
|
26027
26863
|
configureBridgeLogger();
|
|
26028
26864
|
await restorePersistedState();
|
|
26029
26865
|
var server = createServer((request, response) => {
|
|
@@ -26038,13 +26874,13 @@ var server = createServer((request, response) => {
|
|
|
26038
26874
|
return;
|
|
26039
26875
|
}
|
|
26040
26876
|
if (error instanceof PolicyWideningRefusedError) {
|
|
26041
|
-
|
|
26877
|
+
log12.warn("session.policy-widening-refused", { widened: error.widened.join(",") });
|
|
26042
26878
|
json(response, 403, error.refusal());
|
|
26043
26879
|
return;
|
|
26044
26880
|
}
|
|
26045
26881
|
const status = error instanceof HttpError ? error.status : 500;
|
|
26046
26882
|
if (status === 500 && !controller.signal.aborted) {
|
|
26047
|
-
|
|
26883
|
+
log12.warn("http.route-failed", {
|
|
26048
26884
|
method: request.method,
|
|
26049
26885
|
error: formatLogError(error, { message: false })
|
|
26050
26886
|
});
|
|
@@ -26052,7 +26888,7 @@ var server = createServer((request, response) => {
|
|
|
26052
26888
|
json(response, status, { error: error instanceof Error ? error.message : String(error) });
|
|
26053
26889
|
}).finally(stopWatchingClient);
|
|
26054
26890
|
});
|
|
26055
|
-
server.listen(port, hostname, () =>
|
|
26891
|
+
server.listen(port, hostname, () => log12.info("server.listening", { provider, hostname, port }));
|
|
26056
26892
|
var shutdownPromise = null;
|
|
26057
26893
|
function shutdown() {
|
|
26058
26894
|
if (shutdownPromise)
|