orkestrator 2.36.3-beta → 2.36.4-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/README.md +18 -0
- package/dist/client.js +528 -183
- package/dist/main.js +212361 -204331
- package/package.json +3 -3
- package/resources/acp-bridge/dist/index.js +375 -173
- package/resources/claude-bridge/dist/index.js +532 -74
- package/resources/codex-bridge/dist/index.js +467 -200
- package/resources/cursor-bridge/dist/index.js +29810 -29495
- package/resources/cursor-bridge/runtime/install.json +1 -1
- package/resources/pi-bridge/dist/index.js +29641 -29314
- package/resources/pi-bridge/runtime/install.json +1 -1
- package/resources/release-runtime/bun.lock +305 -0
- package/resources/release-runtime/package.json +9 -0
package/dist/client.js
CHANGED
|
@@ -145,6 +145,7 @@ async function readStreamBounded(stream, maxBytes, onOverflow, signal) {
|
|
|
145
145
|
// ../protocol/src/node/standalone-service.ts
|
|
146
146
|
var exports_standalone_service = {};
|
|
147
147
|
__export(exports_standalone_service, {
|
|
148
|
+
RELEASE_RUNTIME_PATH: () => RELEASE_RUNTIME_PATH,
|
|
148
149
|
STANDALONE_DIRECTORY: () => STANDALONE_DIRECTORY,
|
|
149
150
|
STANDALONE_MAX_BOOT_ATTEMPTS: () => STANDALONE_MAX_BOOT_ATTEMPTS,
|
|
150
151
|
STANDALONE_PACKAGE: () => STANDALONE_PACKAGE,
|
|
@@ -170,23 +171,23 @@ __export(exports_standalone_service, {
|
|
|
170
171
|
standaloneLayout: () => standaloneLayout,
|
|
171
172
|
writeServiceConfig: () => writeServiceConfig
|
|
172
173
|
});
|
|
173
|
-
import { execFile } from "child_process";
|
|
174
|
+
import { execFile as execFile2 } from "child_process";
|
|
174
175
|
import { existsSync as existsSync5, readFileSync as readFileSync3, readlinkSync } from "fs";
|
|
175
|
-
import { copyFile, mkdir, readFile, rename, rm, symlink, writeFile } from "fs/promises";
|
|
176
|
-
import
|
|
176
|
+
import { copyFile, mkdir, readFile as readFile2, rename, rm, symlink, writeFile as writeFile2 } from "fs/promises";
|
|
177
|
+
import path16 from "path";
|
|
177
178
|
import { promisify } from "util";
|
|
178
179
|
function standaloneLayout(dataDir) {
|
|
179
|
-
const root =
|
|
180
|
+
const root = path16.join(dataDir, STANDALONE_DIRECTORY);
|
|
180
181
|
return {
|
|
181
182
|
root,
|
|
182
|
-
releases:
|
|
183
|
-
current:
|
|
184
|
-
previous:
|
|
185
|
-
serviceFile:
|
|
186
|
-
stateFile:
|
|
187
|
-
restartMarker:
|
|
188
|
-
launcher:
|
|
189
|
-
logs:
|
|
183
|
+
releases: path16.join(root, "releases"),
|
|
184
|
+
current: path16.join(root, "current"),
|
|
185
|
+
previous: path16.join(root, "previous"),
|
|
186
|
+
serviceFile: path16.join(root, "service.json"),
|
|
187
|
+
stateFile: path16.join(root, "launcher-state.json"),
|
|
188
|
+
restartMarker: path16.join(root, "restart-requested"),
|
|
189
|
+
launcher: path16.join(root, "launcher.js"),
|
|
190
|
+
logs: path16.join(root, "logs")
|
|
190
191
|
};
|
|
191
192
|
}
|
|
192
193
|
function readJson(file) {
|
|
@@ -266,30 +267,30 @@ function readStartupFailure(layout, version, sinceMs, installGeneration) {
|
|
|
266
267
|
}
|
|
267
268
|
async function writeAtomically(file, contents) {
|
|
268
269
|
const temporary = `${file}.${process.pid}.${Date.now()}.tmp`;
|
|
269
|
-
await
|
|
270
|
+
await writeFile2(temporary, contents, { mode: 384 });
|
|
270
271
|
await rename(temporary, file);
|
|
271
272
|
}
|
|
272
273
|
function linkedVersion(link) {
|
|
273
274
|
try {
|
|
274
|
-
return
|
|
275
|
+
return path16.basename(readlinkSync(link));
|
|
275
276
|
} catch {
|
|
276
277
|
return null;
|
|
277
278
|
}
|
|
278
279
|
}
|
|
279
280
|
function releaseDirectory(layout, version) {
|
|
280
|
-
return
|
|
281
|
+
return path16.join(layout.releases, version);
|
|
281
282
|
}
|
|
282
283
|
function releasePackageRoot(releaseDir) {
|
|
283
|
-
return
|
|
284
|
+
return path16.join(releaseDir, "node_modules", STANDALONE_PACKAGE);
|
|
284
285
|
}
|
|
285
286
|
function releaseEntry(releaseDir) {
|
|
286
|
-
return
|
|
287
|
+
return path16.join(releasePackageRoot(releaseDir), "bin", "orkestrator.js");
|
|
287
288
|
}
|
|
288
289
|
function releaseLauncher(releaseDir) {
|
|
289
|
-
return
|
|
290
|
+
return path16.join(releasePackageRoot(releaseDir), "bin", "orkestrator-launcher.js");
|
|
290
291
|
}
|
|
291
292
|
function readReleaseManifest(releaseDir) {
|
|
292
|
-
const manifest = readJson(
|
|
293
|
+
const manifest = readJson(path16.join(releasePackageRoot(releaseDir), "package.json"));
|
|
293
294
|
if (!manifest || typeof manifest.version !== "string")
|
|
294
295
|
return null;
|
|
295
296
|
if (!existsSync5(releaseEntry(releaseDir)))
|
|
@@ -299,28 +300,58 @@ function readReleaseManifest(releaseDir) {
|
|
|
299
300
|
...typeof manifest.engines?.bun === "string" ? { engines: { bun: manifest.engines.bun } } : {}
|
|
300
301
|
};
|
|
301
302
|
}
|
|
303
|
+
function installArguments(registry, ...flags) {
|
|
304
|
+
return ["install", ...flags, "--no-progress", ...registry ? ["--registry", registry] : []];
|
|
305
|
+
}
|
|
306
|
+
async function writeReleaseManifest(directory, version) {
|
|
307
|
+
await writeFile2(path16.join(directory, "package.json"), `${JSON.stringify({
|
|
308
|
+
name: "orkestrator-release",
|
|
309
|
+
private: true,
|
|
310
|
+
dependencies: { [STANDALONE_PACKAGE]: version }
|
|
311
|
+
}, null, 2)}
|
|
312
|
+
`);
|
|
313
|
+
}
|
|
302
314
|
async function installRelease(layout, version, options2) {
|
|
303
315
|
const target = releaseDirectory(layout, version);
|
|
304
316
|
if (readReleaseManifest(target)?.version === version)
|
|
305
317
|
return target;
|
|
306
318
|
const run = options2.run ?? runFile;
|
|
319
|
+
const timeoutMs = 20 * 60 * 1000;
|
|
307
320
|
await mkdir(layout.releases, { recursive: true });
|
|
308
|
-
const staging =
|
|
321
|
+
const staging = path16.join(layout.releases, `.staging-${version}-${process.pid}`);
|
|
322
|
+
const fetching = `${staging}-fetch`;
|
|
309
323
|
await rm(staging, { recursive: true, force: true });
|
|
324
|
+
await rm(fetching, { recursive: true, force: true });
|
|
310
325
|
await mkdir(staging, { recursive: true });
|
|
326
|
+
await mkdir(fetching, { recursive: true });
|
|
311
327
|
try {
|
|
312
|
-
await
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
"
|
|
322
|
-
|
|
323
|
-
|
|
328
|
+
await writeReleaseManifest(fetching, version);
|
|
329
|
+
await run(options2.bun, installArguments(options2.registry, "--production", "--linker=hoisted", "--ignore-scripts", "--cache-dir", path16.join(fetching, ".cache")), {
|
|
330
|
+
cwd: fetching,
|
|
331
|
+
timeoutMs,
|
|
332
|
+
env: { ...process.env, BUN_INSTALL_CACHE_DIR: path16.join(fetching, ".cache") }
|
|
333
|
+
});
|
|
334
|
+
const fetched = path16.join(fetching, "node_modules", STANDALONE_PACKAGE);
|
|
335
|
+
const runtime = path16.join(fetched, RELEASE_RUNTIME_PATH);
|
|
336
|
+
if (existsSync5(runtime)) {
|
|
337
|
+
await copyFile(path16.join(runtime, "package.json"), path16.join(staging, "package.json"));
|
|
338
|
+
await copyFile(path16.join(runtime, "bun.lock"), path16.join(staging, "bun.lock"));
|
|
339
|
+
await run(options2.bun, installArguments(options2.registry, "--frozen-lockfile", "--cache-dir", path16.join(staging, ".cache"), "--production", "--linker=hoisted", "--ignore-scripts"), {
|
|
340
|
+
cwd: staging,
|
|
341
|
+
timeoutMs,
|
|
342
|
+
env: { ...process.env, BUN_INSTALL_CACHE_DIR: path16.join(staging, ".cache") }
|
|
343
|
+
});
|
|
344
|
+
await rm(path16.join(fetched, "node_modules"), { recursive: true, force: true });
|
|
345
|
+
await mkdir(path16.join(staging, "node_modules"), { recursive: true });
|
|
346
|
+
await rename(fetched, path16.join(staging, "node_modules", STANDALONE_PACKAGE));
|
|
347
|
+
} else {
|
|
348
|
+
await writeReleaseManifest(staging, version);
|
|
349
|
+
await run(options2.bun, installArguments(options2.registry, "--production"), {
|
|
350
|
+
cwd: staging,
|
|
351
|
+
timeoutMs
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
await rm(path16.join(staging, ".cache"), { recursive: true, force: true });
|
|
324
355
|
const manifest = readReleaseManifest(staging);
|
|
325
356
|
if (manifest?.version !== version) {
|
|
326
357
|
throw new Error(`Installing ${STANDALONE_PACKAGE}@${version} produced no usable release`);
|
|
@@ -329,6 +360,7 @@ async function installRelease(layout, version, options2) {
|
|
|
329
360
|
await rename(staging, target);
|
|
330
361
|
} finally {
|
|
331
362
|
await rm(staging, { recursive: true, force: true });
|
|
363
|
+
await rm(fetching, { recursive: true, force: true });
|
|
332
364
|
}
|
|
333
365
|
return target;
|
|
334
366
|
}
|
|
@@ -353,7 +385,7 @@ async function installLauncher(layout, releaseDir) {
|
|
|
353
385
|
await rename(temporary, layout.launcher);
|
|
354
386
|
}
|
|
355
387
|
async function requestRestart(layout) {
|
|
356
|
-
await
|
|
388
|
+
await writeFile2(layout.restartMarker, `${new Date().toISOString()}
|
|
357
389
|
`);
|
|
358
390
|
}
|
|
359
391
|
function satisfiesBunRange(range, version) {
|
|
@@ -397,9 +429,9 @@ function isNewerVersion(a, b) {
|
|
|
397
429
|
return left.pre.localeCompare(right.pre, undefined, { numeric: true }) > 0;
|
|
398
430
|
}
|
|
399
431
|
async function readText(file) {
|
|
400
|
-
return
|
|
432
|
+
return readFile2(file, "utf8").catch(() => null);
|
|
401
433
|
}
|
|
402
|
-
var execFileAsync, STANDALONE_DIRECTORY = "backend", STANDALONE_PACKAGE = "orkestrator", STANDALONE_MAX_BOOT_ATTEMPTS = 2, runFile = async (file, args, options2) => {
|
|
434
|
+
var execFileAsync, STANDALONE_DIRECTORY = "backend", STANDALONE_PACKAGE = "orkestrator", RELEASE_RUNTIME_PATH = "resources/release-runtime", STANDALONE_MAX_BOOT_ATTEMPTS = 2, runFile = async (file, args, options2) => {
|
|
403
435
|
const { stdout, stderr } = await execFileAsync(file, args, {
|
|
404
436
|
cwd: options2.cwd,
|
|
405
437
|
timeout: options2.timeoutMs,
|
|
@@ -409,7 +441,7 @@ var execFileAsync, STANDALONE_DIRECTORY = "backend", STANDALONE_PACKAGE = "orkes
|
|
|
409
441
|
return { stdout: String(stdout), stderr: String(stderr) };
|
|
410
442
|
};
|
|
411
443
|
var init_standalone_service = __esm(() => {
|
|
412
|
-
execFileAsync = promisify(
|
|
444
|
+
execFileAsync = promisify(execFile2);
|
|
413
445
|
});
|
|
414
446
|
|
|
415
447
|
// ../../node_modules/.bun/fast-fifo@1.3.2/node_modules/fast-fifo/fixed-size.js
|
|
@@ -4936,10 +4968,10 @@ var init_manifest = __esm(() => {
|
|
|
4936
4968
|
});
|
|
4937
4969
|
|
|
4938
4970
|
// ../toolchain/src/download.ts
|
|
4939
|
-
import { createHash as
|
|
4971
|
+
import { createHash as createHash5 } from "crypto";
|
|
4940
4972
|
import { constants, createReadStream } from "fs";
|
|
4941
4973
|
import { copyFile as copyFile2, lstat, mkdir as mkdir3, open as open3, readdir as readdir3, rename as rename2, rm as rm3 } from "fs/promises";
|
|
4942
|
-
import
|
|
4974
|
+
import path18 from "path";
|
|
4943
4975
|
function failure2(message, kind) {
|
|
4944
4976
|
const error = new Error(message);
|
|
4945
4977
|
if (kind === "untrusted")
|
|
@@ -4952,10 +4984,10 @@ function delay(milliseconds) {
|
|
|
4952
4984
|
return new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
4953
4985
|
}
|
|
4954
4986
|
function partialDownloadDirectory(rootDir) {
|
|
4955
|
-
return
|
|
4987
|
+
return path18.join(rootDir, PARTIAL_DOWNLOAD_DIRECTORY);
|
|
4956
4988
|
}
|
|
4957
4989
|
function partialDownloadPath(rootDir, archive) {
|
|
4958
|
-
return
|
|
4990
|
+
return path18.join(partialDownloadDirectory(rootDir), `${archive.sha256}${PARTIAL_SUFFIX}`);
|
|
4959
4991
|
}
|
|
4960
4992
|
function assertDownloadLocation(label, archive, response, allowInsecureDownloadsForTests) {
|
|
4961
4993
|
const requested = new URL(archive.url);
|
|
@@ -4993,7 +5025,7 @@ function parseContentRange(header) {
|
|
|
4993
5025
|
async function downloadAttempt(options2, partialPath) {
|
|
4994
5026
|
const { label, archive, fetchImpl, onBytes, timings } = options2;
|
|
4995
5027
|
let offset = await existingPartialSize(partialPath, archive);
|
|
4996
|
-
let hash =
|
|
5028
|
+
let hash = createHash5("sha256");
|
|
4997
5029
|
if (offset > 0) {
|
|
4998
5030
|
for await (const chunk of createReadStream(partialPath, { start: 0, end: offset - 1 })) {
|
|
4999
5031
|
hash.update(chunk);
|
|
@@ -5046,7 +5078,7 @@ async function downloadAttempt(options2, partialPath) {
|
|
|
5046
5078
|
} else {
|
|
5047
5079
|
if (offset > 0) {
|
|
5048
5080
|
offset = 0;
|
|
5049
|
-
hash =
|
|
5081
|
+
hash = createHash5("sha256");
|
|
5050
5082
|
onBytes(0);
|
|
5051
5083
|
}
|
|
5052
5084
|
flags |= constants.O_TRUNC;
|
|
@@ -5103,7 +5135,7 @@ async function downloadAttempt(options2, partialPath) {
|
|
|
5103
5135
|
}
|
|
5104
5136
|
async function downloadArchive(options2) {
|
|
5105
5137
|
const partialPath = partialDownloadPath(options2.rootDir, options2.archive);
|
|
5106
|
-
await mkdir3(
|
|
5138
|
+
await mkdir3(path18.dirname(partialPath), { recursive: true, mode: 448 });
|
|
5107
5139
|
const attempts = Math.max(1, options2.timings.attempts);
|
|
5108
5140
|
for (let attempt = 1;; attempt += 1) {
|
|
5109
5141
|
const startSize = await existingPartialSize(partialPath, options2.archive);
|
|
@@ -5135,7 +5167,7 @@ async function prunePartialDownloads(rootDir, archives, now = Date.now()) {
|
|
|
5135
5167
|
const keep = new Set(archives.map((archive) => `${archive.sha256}${PARTIAL_SUFFIX}`));
|
|
5136
5168
|
const entries = await readdir3(directory).catch(() => []);
|
|
5137
5169
|
await Promise.all(entries.filter((name) => !keep.has(name)).map(async (name) => {
|
|
5138
|
-
const entryPath =
|
|
5170
|
+
const entryPath = path18.join(directory, name);
|
|
5139
5171
|
const info = await lstat(entryPath).catch(() => null);
|
|
5140
5172
|
if (!info)
|
|
5141
5173
|
return;
|
|
@@ -5247,12 +5279,12 @@ async function repairInvalidMacSignature(executablePath, artifact, timeoutMs, sp
|
|
|
5247
5279
|
}
|
|
5248
5280
|
|
|
5249
5281
|
// ../toolchain/src/file-stamps.ts
|
|
5250
|
-
import { createHash as
|
|
5282
|
+
import { createHash as createHash6, randomUUID as randomUUID5 } from "crypto";
|
|
5251
5283
|
import { createReadStream as createReadStream2 } from "fs";
|
|
5252
|
-
import { lstat as lstat2, open as open4, readFile as
|
|
5253
|
-
import
|
|
5284
|
+
import { lstat as lstat2, open as open4, readFile as readFile3, rename as rename3, rm as rm4 } from "fs/promises";
|
|
5285
|
+
import path19 from "path";
|
|
5254
5286
|
async function sha256File(filePath) {
|
|
5255
|
-
const hash =
|
|
5287
|
+
const hash = createHash6("sha256");
|
|
5256
5288
|
for await (const chunk of createReadStream2(filePath))
|
|
5257
5289
|
hash.update(chunk);
|
|
5258
5290
|
return hash.digest("hex");
|
|
@@ -5277,7 +5309,7 @@ async function readStampFile(filePath) {
|
|
|
5277
5309
|
const info = await lstat2(filePath);
|
|
5278
5310
|
if (!info.isFile() || info.size > MAX_STAMP_FILE_BYTES)
|
|
5279
5311
|
return null;
|
|
5280
|
-
const parsed = JSON.parse(await
|
|
5312
|
+
const parsed = JSON.parse(await readFile3(filePath, "utf8"));
|
|
5281
5313
|
if (parsed.version !== STAMP_FORMAT_VERSION || typeof parsed.fullCheckAt !== "number" || !Number.isFinite(parsed.fullCheckAt) || !parsed.files || typeof parsed.files !== "object" || !parsed.derived || typeof parsed.derived !== "object") {
|
|
5282
5314
|
return null;
|
|
5283
5315
|
}
|
|
@@ -5297,14 +5329,14 @@ async function readStampFile(filePath) {
|
|
|
5297
5329
|
}
|
|
5298
5330
|
}
|
|
5299
5331
|
function isUnder(filePath, directories) {
|
|
5300
|
-
return directories.some((directory) => filePath.startsWith(directory +
|
|
5332
|
+
return directories.some((directory) => filePath.startsWith(directory + path19.sep));
|
|
5301
5333
|
}
|
|
5302
5334
|
async function openFileStampStore(rootDir, options2 = {}) {
|
|
5303
5335
|
const now = options2.now ?? Date.now;
|
|
5304
5336
|
const hashFile = options2.hashFileForTests ?? sha256File;
|
|
5305
5337
|
const fullCheckIntervalMs = options2.fullCheckIntervalMs ?? FULL_CHECK_INTERVAL_MS;
|
|
5306
5338
|
const racyWindowNs = BigInt(Math.trunc(options2.racyWindowMs ?? RACY_STAMP_WINDOW_MS)) * 1000000n;
|
|
5307
|
-
const stampPath =
|
|
5339
|
+
const stampPath = path19.join(rootDir, STAMP_FILE);
|
|
5308
5340
|
const persisted = await readStampFile(stampPath);
|
|
5309
5341
|
const startedAt = now();
|
|
5310
5342
|
const fullCheck = options2.forceFullCheck === true || persisted === null || startedAt - persisted.fullCheckAt >= fullCheckIntervalMs || persisted.fullCheckAt > startedAt;
|
|
@@ -5412,7 +5444,7 @@ async function openFileStampStore(rootDir, options2 = {}) {
|
|
|
5412
5444
|
files,
|
|
5413
5445
|
derived
|
|
5414
5446
|
};
|
|
5415
|
-
const temporaryPath =
|
|
5447
|
+
const temporaryPath = path19.join(rootDir, `.${STAMP_FILE}-${randomUUID5()}.tmp`);
|
|
5416
5448
|
try {
|
|
5417
5449
|
const handle = await open4(temporaryPath, "wx", 384);
|
|
5418
5450
|
try {
|
|
@@ -5439,7 +5471,7 @@ var init_file_stamps = __esm(() => {
|
|
|
5439
5471
|
|
|
5440
5472
|
// ../toolchain/src/manager.ts
|
|
5441
5473
|
import { spawn } from "child_process";
|
|
5442
|
-
import { createHash as
|
|
5474
|
+
import { createHash as createHash7, randomUUID as randomUUID6 } from "crypto";
|
|
5443
5475
|
import { createReadStream as createReadStream3, createWriteStream } from "fs";
|
|
5444
5476
|
import {
|
|
5445
5477
|
chmod,
|
|
@@ -5448,7 +5480,7 @@ import {
|
|
|
5448
5480
|
mkdir as mkdir4,
|
|
5449
5481
|
mkdtemp as mkdtemp2,
|
|
5450
5482
|
open as open5,
|
|
5451
|
-
readFile as
|
|
5483
|
+
readFile as readFile4,
|
|
5452
5484
|
readdir as readdir4,
|
|
5453
5485
|
readlink,
|
|
5454
5486
|
rename as rename4,
|
|
@@ -5457,7 +5489,7 @@ import {
|
|
|
5457
5489
|
symlink as symlink2,
|
|
5458
5490
|
utimes
|
|
5459
5491
|
} from "fs/promises";
|
|
5460
|
-
import
|
|
5492
|
+
import path20 from "path";
|
|
5461
5493
|
import { pipeline } from "stream/promises";
|
|
5462
5494
|
import { createGunzip } from "zlib";
|
|
5463
5495
|
function downloadTimings(timings) {
|
|
@@ -5471,19 +5503,19 @@ function delay2(milliseconds) {
|
|
|
5471
5503
|
return new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
5472
5504
|
}
|
|
5473
5505
|
function artifactDirectory(rootDir, artifact) {
|
|
5474
|
-
return
|
|
5506
|
+
return path20.join(rootDir, artifact.name, artifact.version, `${artifact.platform}-${artifact.architecture}`);
|
|
5475
5507
|
}
|
|
5476
5508
|
function artifactExecutablePath(rootDir, artifact) {
|
|
5477
|
-
return
|
|
5509
|
+
return path20.join(artifactDirectory(rootDir, artifact), artifact.executable.fileName);
|
|
5478
5510
|
}
|
|
5479
5511
|
function upstreamExecutablePath(rootDir, artifact) {
|
|
5480
|
-
return
|
|
5512
|
+
return path20.join(artifactDirectory(rootDir, artifact), `.upstream-${artifact.executable.fileName}`);
|
|
5481
5513
|
}
|
|
5482
5514
|
function artifactCompanions(artifact) {
|
|
5483
5515
|
return artifact.companions ?? [];
|
|
5484
5516
|
}
|
|
5485
5517
|
function companionPath(rootDir, artifact, companion) {
|
|
5486
|
-
return
|
|
5518
|
+
return path20.join(artifactDirectory(rootDir, artifact), companion.fileName);
|
|
5487
5519
|
}
|
|
5488
5520
|
function artifactArchiveBytes(artifact) {
|
|
5489
5521
|
return artifactCompanions(artifact).reduce((total, companion) => total + companion.archive.size, artifact.archive.size);
|
|
@@ -5501,7 +5533,7 @@ function assertValidArtifactMetadata(artifact) {
|
|
|
5501
5533
|
}
|
|
5502
5534
|
const paths = new Set;
|
|
5503
5535
|
for (const file of artifact.archive.bundleFiles) {
|
|
5504
|
-
const normalized =
|
|
5536
|
+
const normalized = path20.posix.normalize(file.path);
|
|
5505
5537
|
if (normalized !== file.path || normalized.startsWith("../") || normalized.startsWith("/") || normalized.includes("\\") || paths.has(normalized) || !Number.isSafeInteger(file.size) || file.size < 1 || !/^[a-f0-9]{64}$/.test(file.sha256)) {
|
|
5506
5538
|
throw new Error(`${artifact.name} manifest has an unsafe bundle file`);
|
|
5507
5539
|
}
|
|
@@ -5527,7 +5559,7 @@ function assertValidArtifactMetadata(artifact) {
|
|
|
5527
5559
|
}
|
|
5528
5560
|
const activationNames = new Set([artifact.name, artifact.executable.fileName]);
|
|
5529
5561
|
for (const alias of artifact.activationAliases ?? []) {
|
|
5530
|
-
if (!alias || alias.startsWith(".") || alias.includes("/") || alias.includes("\\") || alias !==
|
|
5562
|
+
if (!alias || alias.startsWith(".") || alias.includes("/") || alias.includes("\\") || alias !== path20.basename(alias) || activationNames.has(alias)) {
|
|
5531
5563
|
throw new Error(`${artifact.name} manifest has an unsafe or duplicate activation alias`);
|
|
5532
5564
|
}
|
|
5533
5565
|
activationNames.add(alias);
|
|
@@ -5537,7 +5569,7 @@ function assertValidArtifactMetadata(artifact) {
|
|
|
5537
5569
|
if (companion.archive.format !== "zip" && companion.archive.format !== "tar.gz") {
|
|
5538
5570
|
throw new Error(`${artifact.name} companion has an unsupported archive format`);
|
|
5539
5571
|
}
|
|
5540
|
-
if (!companion.fileName || companion.fileName.startsWith(".") || companion.fileName.includes("/") || companion.fileName.includes("\\") || companion.fileName !==
|
|
5572
|
+
if (!companion.fileName || companion.fileName.startsWith(".") || companion.fileName.includes("/") || companion.fileName.includes("\\") || companion.fileName !== path20.basename(companion.fileName)) {
|
|
5541
5573
|
throw new Error(`${artifact.name} companion has an unsafe file name`);
|
|
5542
5574
|
}
|
|
5543
5575
|
if (companionNames.has(companion.fileName)) {
|
|
@@ -5600,7 +5632,7 @@ async function isValidExecutable(rootDir, artifact, digests) {
|
|
|
5600
5632
|
if (!await isValidUpstreamExecutable(rootDir, artifact, digests))
|
|
5601
5633
|
return false;
|
|
5602
5634
|
for (const bundled of artifact.archive.bundleFiles ?? []) {
|
|
5603
|
-
if (!await isValidFile(
|
|
5635
|
+
if (!await isValidFile(path20.join(artifactDirectory(rootDir, artifact), ...bundled.path.split("/")), bundled, digests)) {
|
|
5604
5636
|
return false;
|
|
5605
5637
|
}
|
|
5606
5638
|
}
|
|
@@ -5617,7 +5649,7 @@ async function isValidExecutable(rootDir, artifact, digests) {
|
|
|
5617
5649
|
if ((file.mode & 511) !== 320)
|
|
5618
5650
|
await chmod(executablePath, 320);
|
|
5619
5651
|
for (const bundled of artifact.archive.bundleFiles ?? []) {
|
|
5620
|
-
if (!await isValidFile(
|
|
5652
|
+
if (!await isValidFile(path20.join(artifactDirectory(rootDir, artifact), ...bundled.path.split("/")), bundled, digests)) {
|
|
5621
5653
|
return false;
|
|
5622
5654
|
}
|
|
5623
5655
|
}
|
|
@@ -5638,7 +5670,7 @@ async function bundleTreeEntries(directory, artifact, digests) {
|
|
|
5638
5670
|
const visit = async (currentDirectory, prefix = "") => {
|
|
5639
5671
|
for (const entry of await readdir4(currentDirectory, { withFileTypes: true })) {
|
|
5640
5672
|
const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
5641
|
-
const filePath =
|
|
5673
|
+
const filePath = path20.join(currentDirectory, entry.name);
|
|
5642
5674
|
if (entry.isDirectory()) {
|
|
5643
5675
|
await visit(filePath, relativePath);
|
|
5644
5676
|
} else if (entry.isFile() && !entry.isSymbolicLink()) {
|
|
@@ -5660,7 +5692,7 @@ async function bundleTreeEntries(directory, artifact, digests) {
|
|
|
5660
5692
|
return entries.sort((left, right) => left.path.localeCompare(right.path));
|
|
5661
5693
|
}
|
|
5662
5694
|
function bundleTreeDigest(entries) {
|
|
5663
|
-
const hash =
|
|
5695
|
+
const hash = createHash7("sha256");
|
|
5664
5696
|
let totalSize = 0;
|
|
5665
5697
|
for (const entry of entries) {
|
|
5666
5698
|
totalSize += entry.size;
|
|
@@ -5714,7 +5746,7 @@ async function isValidInstallation(rootDir, artifact, digests) {
|
|
|
5714
5746
|
}
|
|
5715
5747
|
async function readInstallLockOwner(lockPath) {
|
|
5716
5748
|
try {
|
|
5717
|
-
const parsed = JSON.parse(await
|
|
5749
|
+
const parsed = JSON.parse(await readFile4(lockPath, "utf8"));
|
|
5718
5750
|
if (typeof parsed.token !== "string" || typeof parsed.pid !== "number" || typeof parsed.createdAt !== "string") {
|
|
5719
5751
|
return null;
|
|
5720
5752
|
}
|
|
@@ -5753,7 +5785,7 @@ async function initializeInstallLock(lockPath, owner, openLockFile) {
|
|
|
5753
5785
|
}
|
|
5754
5786
|
}
|
|
5755
5787
|
async function acquireInstallLock(rootDir, onProgress, timings, openLockFile, ownerProcessExists) {
|
|
5756
|
-
const lockPath =
|
|
5788
|
+
const lockPath = path20.join(rootDir, INSTALL_LOCK);
|
|
5757
5789
|
const startedAt = Date.now();
|
|
5758
5790
|
let announcedWait = false;
|
|
5759
5791
|
while (Date.now() - startedAt < timings.lockWaitTimeoutMs) {
|
|
@@ -5872,8 +5904,8 @@ async function extractTarGzipBundle(archivePath, destinationDirectory, label, ar
|
|
|
5872
5904
|
stream.resume();
|
|
5873
5905
|
return;
|
|
5874
5906
|
}
|
|
5875
|
-
const normalized =
|
|
5876
|
-
if (normalized.startsWith("../") || normalized.startsWith("/") || normalized.includes("\\") ||
|
|
5907
|
+
const normalized = path20.posix.normalize(relative);
|
|
5908
|
+
if (normalized.startsWith("../") || normalized.startsWith("/") || normalized.includes("\\") || path20.isAbsolute(normalized)) {
|
|
5877
5909
|
extract2.destroy(new Error(`Unsafe path in ${label} bundle`));
|
|
5878
5910
|
stream.resume();
|
|
5879
5911
|
return;
|
|
@@ -5885,7 +5917,7 @@ async function extractTarGzipBundle(archivePath, destinationDirectory, label, ar
|
|
|
5885
5917
|
stream.resume();
|
|
5886
5918
|
return;
|
|
5887
5919
|
}
|
|
5888
|
-
const destination =
|
|
5920
|
+
const destination = path20.join(destinationDirectory, ...normalized.split("/"));
|
|
5889
5921
|
if (header.type === "directory") {
|
|
5890
5922
|
stream.once("end", next);
|
|
5891
5923
|
stream.resume();
|
|
@@ -5903,7 +5935,7 @@ async function extractTarGzipBundle(archivePath, destinationDirectory, label, ar
|
|
|
5903
5935
|
}
|
|
5904
5936
|
if (header.name === archive.entryPath)
|
|
5905
5937
|
foundExecutable = true;
|
|
5906
|
-
mkdir4(
|
|
5938
|
+
mkdir4(path20.dirname(destination), { recursive: true, mode: 448 }).then(() => pipeline(stream, createWriteStream(destination, {
|
|
5907
5939
|
flags: "wx",
|
|
5908
5940
|
mode: (header.mode ?? 0) & 73 ? 320 : 256
|
|
5909
5941
|
}))).then(() => next(), (error) => extract2.destroy(error instanceof Error ? error : new Error(String(error))));
|
|
@@ -5977,7 +6009,7 @@ async function extractZipEntry(archivePath, destinationPath, label, archive, exe
|
|
|
5977
6009
|
});
|
|
5978
6010
|
}
|
|
5979
6011
|
async function prepareRepairableExecutable(sourcePath, executablePath, artifact, skipExecutableProbeForTests, processTimeoutMs, spawnProcess) {
|
|
5980
|
-
const temporaryPath =
|
|
6012
|
+
const temporaryPath = path20.join(path20.dirname(executablePath), `.repair-${artifact.executable.fileName}-${randomUUID6()}.tmp`);
|
|
5981
6013
|
try {
|
|
5982
6014
|
await copyFile3(sourcePath, temporaryPath);
|
|
5983
6015
|
await chmod(temporaryPath, 448);
|
|
@@ -6018,15 +6050,15 @@ async function refreshRepairableArtifact(rootDir, artifact, digests, skipExecuta
|
|
|
6018
6050
|
async function stageCompanions(stagingDirectory, artifact, companions, fetchImpl, onBytes, startBytes, allowInsecureDownloadsForTests, skipExecutableProbeForTests, timings, spawnProcess) {
|
|
6019
6051
|
let downloadedBytes = startBytes;
|
|
6020
6052
|
for (const companion of companions) {
|
|
6021
|
-
const companionArchivePath =
|
|
6022
|
-
const companionFilePath =
|
|
6053
|
+
const companionArchivePath = path20.join(stagingDirectory, `.archive-${companion.fileName}.${archiveExtension(companion.archive)}`);
|
|
6054
|
+
const companionFilePath = path20.join(stagingDirectory, companion.fileName);
|
|
6023
6055
|
const precedingBytes = downloadedBytes;
|
|
6024
6056
|
await downloadArchive({
|
|
6025
6057
|
retainComplete: true,
|
|
6026
6058
|
label: companion.fileName,
|
|
6027
6059
|
archive: companion.archive,
|
|
6028
6060
|
archivePath: companionArchivePath,
|
|
6029
|
-
rootDir:
|
|
6061
|
+
rootDir: path20.dirname(stagingDirectory),
|
|
6030
6062
|
fetchImpl,
|
|
6031
6063
|
onBytes: (received) => onBytes(precedingBytes + received),
|
|
6032
6064
|
allowInsecureDownloadsForTests,
|
|
@@ -6054,13 +6086,13 @@ async function stageCompanions(stagingDirectory, artifact, companions, fetchImpl
|
|
|
6054
6086
|
}
|
|
6055
6087
|
}
|
|
6056
6088
|
async function repairArtifactCompanions(rootDir, artifact, companions, fetchImpl, onBytes, onVerify, allowInsecureDownloadsForTests, skipExecutableProbeForTests, timings, spawnProcess) {
|
|
6057
|
-
const stagingDirectory = await mkdtemp2(
|
|
6089
|
+
const stagingDirectory = await mkdtemp2(path20.join(rootDir, `.staging-${artifact.name}-`));
|
|
6058
6090
|
try {
|
|
6059
6091
|
await stageCompanions(stagingDirectory, artifact, companions, fetchImpl, onBytes, 0, allowInsecureDownloadsForTests, skipExecutableProbeForTests, timings, spawnProcess);
|
|
6060
6092
|
onVerify();
|
|
6061
6093
|
const destinationDirectory = artifactDirectory(rootDir, artifact);
|
|
6062
6094
|
for (const companion of companions) {
|
|
6063
|
-
await rename4(
|
|
6095
|
+
await rename4(path20.join(stagingDirectory, companion.fileName), path20.join(destinationDirectory, companion.fileName));
|
|
6064
6096
|
}
|
|
6065
6097
|
await Promise.all(artifactCompanions(artifact).map((companion) => rm5(partialDownloadPath(rootDir, companion.archive), { force: true }).catch(() => {
|
|
6066
6098
|
return;
|
|
@@ -6070,10 +6102,10 @@ async function repairArtifactCompanions(rootDir, artifact, companions, fetchImpl
|
|
|
6070
6102
|
}
|
|
6071
6103
|
}
|
|
6072
6104
|
async function installArtifact(rootDir, artifact, fetchImpl, onBytes, onVerify, allowInsecureDownloadsForTests, skipExecutableProbeForTests, timings, spawnProcess) {
|
|
6073
|
-
const stagingDirectory = await mkdtemp2(
|
|
6074
|
-
const archivePath =
|
|
6075
|
-
const executablePath =
|
|
6076
|
-
const extractedPath = artifact.executable.repairInvalidMacSignature ?
|
|
6105
|
+
const stagingDirectory = await mkdtemp2(path20.join(rootDir, `.staging-${artifact.name}-`));
|
|
6106
|
+
const archivePath = path20.join(stagingDirectory, `archive.${archiveExtension(artifact.archive)}`);
|
|
6107
|
+
const executablePath = path20.join(stagingDirectory, artifact.executable.fileName);
|
|
6108
|
+
const extractedPath = artifact.executable.repairInvalidMacSignature ? path20.join(stagingDirectory, `.upstream-${artifact.executable.fileName}`) : executablePath;
|
|
6077
6109
|
try {
|
|
6078
6110
|
await downloadArchive({
|
|
6079
6111
|
retainComplete: artifactCompanions(artifact).length > 0,
|
|
@@ -6088,7 +6120,7 @@ async function installArtifact(rootDir, artifact, fetchImpl, onBytes, onVerify,
|
|
|
6088
6120
|
});
|
|
6089
6121
|
if (artifact.archive.bundleRoot) {
|
|
6090
6122
|
await extractTarGzipBundle(archivePath, stagingDirectory, artifact.name, artifact.archive);
|
|
6091
|
-
const bundledExecutable =
|
|
6123
|
+
const bundledExecutable = path20.join(stagingDirectory, ...artifact.archive.entryPath.slice(artifact.archive.bundleRoot.length).split("/"));
|
|
6092
6124
|
if (bundledExecutable !== extractedPath) {
|
|
6093
6125
|
await rename4(bundledExecutable, extractedPath);
|
|
6094
6126
|
}
|
|
@@ -6139,7 +6171,7 @@ async function installArtifact(rootDir, artifact, fetchImpl, onBytes, onVerify,
|
|
|
6139
6171
|
await stageCompanions(stagingDirectory, artifact, artifactCompanions(artifact), fetchImpl, onBytes, artifact.archive.size, allowInsecureDownloadsForTests, skipExecutableProbeForTests, timings, spawnProcess);
|
|
6140
6172
|
onVerify();
|
|
6141
6173
|
const destinationDirectory = artifactDirectory(rootDir, artifact);
|
|
6142
|
-
await mkdir4(
|
|
6174
|
+
await mkdir4(path20.dirname(destinationDirectory), { recursive: true, mode: 448 });
|
|
6143
6175
|
await rm5(destinationDirectory, { recursive: true, force: true });
|
|
6144
6176
|
await rename4(stagingDirectory, destinationDirectory);
|
|
6145
6177
|
await chmod(destinationDirectory, 448);
|
|
@@ -6154,16 +6186,16 @@ async function installArtifact(rootDir, artifact, fetchImpl, onBytes, onVerify,
|
|
|
6154
6186
|
}
|
|
6155
6187
|
async function cleanStagingDirectories(rootDir) {
|
|
6156
6188
|
const entries = await readdir4(rootDir, { withFileTypes: true });
|
|
6157
|
-
await Promise.all(entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(".staging-")).map((entry) => rm5(
|
|
6189
|
+
await Promise.all(entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(".staging-")).map((entry) => rm5(path20.join(rootDir, entry.name), { recursive: true, force: true })));
|
|
6158
6190
|
}
|
|
6159
6191
|
async function touchArtifactDirectory(rootDir, artifact) {
|
|
6160
6192
|
const now = new Date;
|
|
6161
|
-
await utimes(
|
|
6193
|
+
await utimes(path20.dirname(artifactDirectory(rootDir, artifact)), now, now).catch(() => {
|
|
6162
6194
|
return;
|
|
6163
6195
|
});
|
|
6164
6196
|
}
|
|
6165
6197
|
function versionLeaseDirectory(rootDir, name, version) {
|
|
6166
|
-
return
|
|
6198
|
+
return path20.join(rootDir, LEASE_DIRECTORY, name, version);
|
|
6167
6199
|
}
|
|
6168
6200
|
async function acquireVersionLease(rootDir, artifact, openLeaseFile) {
|
|
6169
6201
|
const leaseKey = `${rootDir}\x00${artifact.name}\x00${artifact.version}`;
|
|
@@ -6178,7 +6210,7 @@ async function acquireVersionLease(rootDir, artifact, openLeaseFile) {
|
|
|
6178
6210
|
};
|
|
6179
6211
|
const directory = versionLeaseDirectory(rootDir, artifact.name, artifact.version);
|
|
6180
6212
|
await mkdir4(directory, { recursive: true, mode: 448 });
|
|
6181
|
-
const leasePath =
|
|
6213
|
+
const leasePath = path20.join(directory, `${owner.pid}-${owner.token}.json`);
|
|
6182
6214
|
const handle = await openLeaseFile(leasePath, "wx", 384);
|
|
6183
6215
|
try {
|
|
6184
6216
|
await handle.writeFile(JSON.stringify(owner), "utf8");
|
|
@@ -6199,9 +6231,9 @@ async function versionHasLiveLease(rootDir, name, version, ownerProcessExists) {
|
|
|
6199
6231
|
const entries = await readdir4(directory, { withFileTypes: true }).catch(() => []);
|
|
6200
6232
|
let live = false;
|
|
6201
6233
|
await Promise.all(entries.filter((entry) => entry.isFile()).map(async (entry) => {
|
|
6202
|
-
const leasePath =
|
|
6234
|
+
const leasePath = path20.join(directory, entry.name);
|
|
6203
6235
|
try {
|
|
6204
|
-
const parsed = JSON.parse(await
|
|
6236
|
+
const parsed = JSON.parse(await readFile4(leasePath, "utf8"));
|
|
6205
6237
|
if (typeof parsed.token === "string" && typeof parsed.pid === "number" && typeof parsed.createdAt === "string" && ownerProcessExists(parsed.pid)) {
|
|
6206
6238
|
live = true;
|
|
6207
6239
|
return;
|
|
@@ -6222,11 +6254,11 @@ async function pruneSupersededVersions(rootDir, artifacts, retainSupersededMs, o
|
|
|
6222
6254
|
}
|
|
6223
6255
|
const staleBefore = Date.now() - retainSupersededMs;
|
|
6224
6256
|
await Promise.all(Array.from(keepByName, async ([name, keep]) => {
|
|
6225
|
-
const toolDir =
|
|
6257
|
+
const toolDir = path20.join(rootDir, name);
|
|
6226
6258
|
try {
|
|
6227
6259
|
const entries = await readdir4(toolDir, { withFileTypes: true });
|
|
6228
6260
|
await Promise.all(entries.filter((entry) => entry.isDirectory() && !keep.has(entry.name)).map(async (entry) => {
|
|
6229
|
-
const versionDir =
|
|
6261
|
+
const versionDir = path20.join(toolDir, entry.name);
|
|
6230
6262
|
try {
|
|
6231
6263
|
if ((await stat3(versionDir)).mtimeMs > staleBefore)
|
|
6232
6264
|
return;
|
|
@@ -6264,11 +6296,11 @@ function activationSetId(artifacts) {
|
|
|
6264
6296
|
const rightKey = `${right.name}\x00${right.platform}\x00${right.architecture}`;
|
|
6265
6297
|
return leftKey < rightKey ? -1 : leftKey > rightKey ? 1 : 0;
|
|
6266
6298
|
});
|
|
6267
|
-
return
|
|
6299
|
+
return createHash7("sha256").update(JSON.stringify(identity)).digest("hex");
|
|
6268
6300
|
}
|
|
6269
6301
|
async function activateExecutables(rootDir, artifacts) {
|
|
6270
|
-
const binRoot =
|
|
6271
|
-
const binDir =
|
|
6302
|
+
const binRoot = path20.join(rootDir, "bin");
|
|
6303
|
+
const binDir = path20.join(binRoot, activationSetId(artifacts));
|
|
6272
6304
|
await mkdir4(binRoot, { recursive: true, mode: 448 });
|
|
6273
6305
|
const binRootEntry = await lstat3(binRoot);
|
|
6274
6306
|
if (!binRootEntry.isDirectory() || binRootEntry.isSymbolicLink()) {
|
|
@@ -6283,8 +6315,8 @@ async function activateExecutables(rootDir, artifacts) {
|
|
|
6283
6315
|
await chmod(binDir, 448);
|
|
6284
6316
|
const executables = {};
|
|
6285
6317
|
const activate = async (linkName, target) => {
|
|
6286
|
-
const activePath =
|
|
6287
|
-
const temporaryLink =
|
|
6318
|
+
const activePath = path20.join(binDir, linkName);
|
|
6319
|
+
const temporaryLink = path20.join(binDir, `.${linkName}-${randomUUID6()}.tmp`);
|
|
6288
6320
|
const existingTarget = await readlink(activePath).catch(() => null);
|
|
6289
6321
|
if (existingTarget !== target) {
|
|
6290
6322
|
await symlink2(target, temporaryLink, "file");
|
|
@@ -6332,7 +6364,7 @@ async function ensurePinnedToolchains(options2) {
|
|
|
6332
6364
|
const timings = { ...DEFAULT_TIMINGS, ...options2.timingsForTests };
|
|
6333
6365
|
const spawnProcess = options2.spawnForTests ?? spawn;
|
|
6334
6366
|
const ownerProcessExists = options2.processExistsForTests ?? ((pid) => processExists(pid, options2.processKillForTests));
|
|
6335
|
-
const rootDir =
|
|
6367
|
+
const rootDir = path20.join(options2.dataDir, TOOLCHAIN_DIRECTORY);
|
|
6336
6368
|
const totalTools = artifacts.length;
|
|
6337
6369
|
const toolFractions = new Map(artifacts.map((artifact) => [artifact.name, 0]));
|
|
6338
6370
|
const progress = (value) => {
|
|
@@ -6477,7 +6509,7 @@ var init_manager = __esm(() => {
|
|
|
6477
6509
|
|
|
6478
6510
|
// ../toolchain/src/platform-selection.ts
|
|
6479
6511
|
import { promises as fs7 } from "fs";
|
|
6480
|
-
import
|
|
6512
|
+
import path21 from "path";
|
|
6481
6513
|
async function readJsonFile(filePath) {
|
|
6482
6514
|
try {
|
|
6483
6515
|
return JSON.parse(await fs7.readFile(filePath, "utf8"));
|
|
@@ -6486,7 +6518,7 @@ async function readJsonFile(filePath) {
|
|
|
6486
6518
|
}
|
|
6487
6519
|
}
|
|
6488
6520
|
async function loadAgentPlatformSelection(dataDir) {
|
|
6489
|
-
const config = await readJsonFile(
|
|
6521
|
+
const config = await readJsonFile(path21.join(dataDir, AGENT_CONFIG_FILE));
|
|
6490
6522
|
if (config && typeof config === "object" && !Array.isArray(config)) {
|
|
6491
6523
|
const global2 = config.global;
|
|
6492
6524
|
if (global2 && typeof global2 === "object" && !Array.isArray(global2)) {
|
|
@@ -6502,7 +6534,7 @@ async function loadAgentPlatformSelection(dataDir) {
|
|
|
6502
6534
|
needsFirstRunChoice: false
|
|
6503
6535
|
};
|
|
6504
6536
|
}
|
|
6505
|
-
const sidecar = await readJsonFile(
|
|
6537
|
+
const sidecar = await readJsonFile(path21.join(dataDir, AGENT_PLATFORM_SELECTION_FILE));
|
|
6506
6538
|
if (sidecar && typeof sidecar === "object" && !Array.isArray(sidecar)) {
|
|
6507
6539
|
const enabled = normalizeAgentPlatforms(sidecar.enabled, []);
|
|
6508
6540
|
if (enabled.length > 0)
|
|
@@ -6518,7 +6550,7 @@ var init_platform_selection = __esm(() => {
|
|
|
6518
6550
|
// ../toolchain/src/install.ts
|
|
6519
6551
|
import { randomUUID as randomUUID7 } from "crypto";
|
|
6520
6552
|
import { lstat as lstat4, mkdir as mkdir5, readdir as readdir5, readlink as readlink2, rename as rename5, rm as rm6, symlink as symlink3 } from "fs/promises";
|
|
6521
|
-
import
|
|
6553
|
+
import path22 from "path";
|
|
6522
6554
|
async function resolveToolchainSelection(options2) {
|
|
6523
6555
|
const known = Object.keys(PINNED_TOOL_VERSIONS);
|
|
6524
6556
|
const withSupportTools = (chosen) => known.filter((name) => chosen.has(name) || isSupportToolName(name));
|
|
@@ -6578,16 +6610,16 @@ async function installPinnedToolchains(options2) {
|
|
|
6578
6610
|
};
|
|
6579
6611
|
}
|
|
6580
6612
|
async function toolsInCurrent(rootDir) {
|
|
6581
|
-
const entries = await readdir5(
|
|
6613
|
+
const entries = await readdir5(path22.join(rootDir, "bin", CURRENT_TOOLCHAIN_LINK)).catch(() => []);
|
|
6582
6614
|
return Object.keys(PINNED_TOOL_VERSIONS).filter((tool) => entries.includes(tool));
|
|
6583
6615
|
}
|
|
6584
6616
|
async function pointCurrentAt(rootDir, binDir) {
|
|
6585
|
-
const binRoot =
|
|
6586
|
-
if (
|
|
6617
|
+
const binRoot = path22.join(rootDir, "bin");
|
|
6618
|
+
if (path22.dirname(binDir) !== binRoot) {
|
|
6587
6619
|
throw new Error(`Activation directory ${binDir} is not directly inside ${binRoot}`);
|
|
6588
6620
|
}
|
|
6589
|
-
const link =
|
|
6590
|
-
const target =
|
|
6621
|
+
const link = path22.join(binRoot, CURRENT_TOOLCHAIN_LINK);
|
|
6622
|
+
const target = path22.basename(binDir);
|
|
6591
6623
|
await mkdir5(binRoot, { recursive: true, mode: 448 });
|
|
6592
6624
|
const existing = await lstat4(link).catch(() => null);
|
|
6593
6625
|
if (existing && !existing.isSymbolicLink()) {
|
|
@@ -6595,7 +6627,7 @@ async function pointCurrentAt(rootDir, binDir) {
|
|
|
6595
6627
|
}
|
|
6596
6628
|
if (existing && await readlink2(link) === target)
|
|
6597
6629
|
return link;
|
|
6598
|
-
const temporary =
|
|
6630
|
+
const temporary = path22.join(binRoot, `.${CURRENT_TOOLCHAIN_LINK}-${randomUUID7()}.tmp`);
|
|
6599
6631
|
await symlink3(target, temporary, "dir");
|
|
6600
6632
|
try {
|
|
6601
6633
|
await rename5(temporary, link);
|
|
@@ -7578,6 +7610,22 @@ var PUBLIC_ACTIONS = {
|
|
|
7578
7610
|
milestone: "D",
|
|
7579
7611
|
summary: "Read a bounded stdout/stderr window of an exec operation."
|
|
7580
7612
|
},
|
|
7613
|
+
"diagnostics.plan": {
|
|
7614
|
+
version: 1,
|
|
7615
|
+
mutation: false,
|
|
7616
|
+
effects: [],
|
|
7617
|
+
observation: "immediate",
|
|
7618
|
+
milestone: "D",
|
|
7619
|
+
summary: "Build a local diagnostics bundle in the backend's memory and read its manifest: exactly what the bundle holds, and what it leaves out."
|
|
7620
|
+
},
|
|
7621
|
+
"diagnostics.read": {
|
|
7622
|
+
version: 1,
|
|
7623
|
+
mutation: false,
|
|
7624
|
+
effects: [],
|
|
7625
|
+
observation: "immediate",
|
|
7626
|
+
milestone: "D",
|
|
7627
|
+
summary: "Read one piece of a planned diagnostics bundle. Nothing is uploaded."
|
|
7628
|
+
},
|
|
7581
7629
|
"host.status": {
|
|
7582
7630
|
version: 1,
|
|
7583
7631
|
mutation: false,
|
|
@@ -8259,13 +8307,11 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
|
8259
8307
|
"launch_graph",
|
|
8260
8308
|
"launch_job",
|
|
8261
8309
|
"launch_multi_review",
|
|
8262
|
-
"launch_node_environment",
|
|
8263
8310
|
"launch_terminal",
|
|
8264
8311
|
"list_agents",
|
|
8265
8312
|
"list_environments",
|
|
8266
8313
|
"list_graph_templates",
|
|
8267
8314
|
"list_mailboxes",
|
|
8268
|
-
"list_node_environments",
|
|
8269
8315
|
"list_nodes",
|
|
8270
8316
|
"list_projects",
|
|
8271
8317
|
"list_provider_accounts",
|
|
@@ -8294,16 +8340,11 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
|
8294
8340
|
"resume_schedule",
|
|
8295
8341
|
"run_worker_command",
|
|
8296
8342
|
"send_message",
|
|
8297
|
-
"send_node_message",
|
|
8298
|
-
"send_prompt_to_node_tab",
|
|
8299
8343
|
"send_prompt_to_tab",
|
|
8300
8344
|
"set_worker_goal",
|
|
8301
8345
|
"start_build_pipeline",
|
|
8302
8346
|
"start_environment",
|
|
8303
|
-
"start_multi_review",
|
|
8304
|
-
"start_node_environment",
|
|
8305
8347
|
"stop_environment",
|
|
8306
|
-
"stop_node_environment",
|
|
8307
8348
|
"stop_worker_turn",
|
|
8308
8349
|
"switch_provider_account",
|
|
8309
8350
|
"set_account_auto_switch",
|
|
@@ -8361,7 +8402,8 @@ function bugReportDiagnosticsSection(connectionLine) {
|
|
|
8361
8402
|
"Gather evidence yourself instead of asking me to copy it. Before each command, say in one sentence what it checks. Stay read-only: do not edit, delete, move, restart, reinstall or update anything, and do not change Orkestrator's data directory or settings. If something needs changing, explain it and let me do it.",
|
|
8362
8403
|
"Useful sources:",
|
|
8363
8404
|
"- Log files: `orkestrator-ai-YYYY-MM-DD.log` is the desktop app (it includes its backend's output), `orkestrator-backend-YYYY-MM-DD.log` a standalone backend; JSON mode uses `.jsonl` instead of `.log`. A busy day continues in `.1.log`, `.2.log` (or `.1.jsonl`, `.2.jsonl`), and so on. Search around the time of the problem (errors, warnings, stack traces, the environment or session name) rather than reading whole files.",
|
|
8364
|
-
"-
|
|
8405
|
+
"- The essential event log: `logs/essential/essential.jsonl` under the data directory, plus up to three older files beside it (`essential.1.jsonl` is the newest of those). It is always written, even with Save Logs to Disk off, and holds errors and key lifecycle events as event names and numbers, with no messages. Read it first: it often shows when the problem began, and whether a process crashed (an `essential.started` with no `essential.stopped` before it).",
|
|
8406
|
+
"- If debug logging is off or the logs predate the problem and the essential log does not explain it, ask me to turn on Settings \u2192 Debug \u2192 Save Logs to Disk, reproduce the problem, and tell you when I have.",
|
|
8365
8407
|
connectionLine,
|
|
8366
8408
|
"- Docker environments: `docker version`, `docker ps -a`, and `docker logs --tail 200 <container>` for the affected container.",
|
|
8367
8409
|
"- Versions: `<agent> --version` for the agents involved, `git --version`, `gh --version`; on macOS, `defaults read /Applications/OrkestratorV2.app/Contents/Info.plist CFBundleShortVersionString` for the desktop app.",
|
|
@@ -8531,6 +8573,12 @@ var BACKEND_LOG_AREAS = defineLogAreas({
|
|
|
8531
8573
|
"startup.looped-review-pending": "Cleanup of the retired Looped Review stays pending.",
|
|
8532
8574
|
"notice.failed": "A background notice after a turn or prompt failed; `step` says which.",
|
|
8533
8575
|
"artifacts.live-unavailable": "Live interactive artifacts are unavailable.",
|
|
8576
|
+
"previous-run": {
|
|
8577
|
+
description: "This start read how the previous run ended: `outcome` is `clean` when it reached the end of shutdown and `crashed` when it did not, `ranForMs` its length and `lastSeenAgoMs` the time since its last health row.",
|
|
8578
|
+
essential: true,
|
|
8579
|
+
fields: { outcome: "label", ranForMs: "number", lastSeenAgoMs: "number" }
|
|
8580
|
+
},
|
|
8581
|
+
"health.write-failed": "A health summary row could not be written or read; the next sample retries.",
|
|
8534
8582
|
"shutdown.step-failed": "One part of shutdown failed and the rest went on; `step` says which.",
|
|
8535
8583
|
"shutdown.signal-received": {
|
|
8536
8584
|
description: "A signal started shutdown, which tells a clean quit from the backend being killed.",
|
|
@@ -8574,7 +8622,8 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
8574
8622
|
description: "What every long-lived bridge does the same way: its sweep and its shutdown.",
|
|
8575
8623
|
events: {
|
|
8576
8624
|
"idle-sweep.failed": "An idle sweep threw; the next tick retries.",
|
|
8577
|
-
"shutdown.failed": "Releasing the bridge failed during shutdown; it still exits."
|
|
8625
|
+
"shutdown.failed": "Releasing the bridge failed during shutdown; it still exits.",
|
|
8626
|
+
"credential.not-hardened": "The bridge could not mark itself non-dumpable, so a same-uid process can read its memory; `reason` says why."
|
|
8578
8627
|
}
|
|
8579
8628
|
},
|
|
8580
8629
|
"bridge.acp": {
|
|
@@ -8708,7 +8757,6 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
8708
8757
|
"parent.gone": "The backend that launched this bridge has gone; stopping turns and shutting down.",
|
|
8709
8758
|
"queue.overflow": "The notification queue passed a bound and dropped its backlog.",
|
|
8710
8759
|
"queue.task-failed": "A task on a per-thread queue failed.",
|
|
8711
|
-
"raw-log.write-failed": "Appending to the raw Codex log failed.",
|
|
8712
8760
|
"recorder.notice": "The notification recorder needs attention: it is on, or was asked for without its confirmation.",
|
|
8713
8761
|
"recorder.threw": "The notification recorder threw.",
|
|
8714
8762
|
"recorder.write-failed": "Writing a notification recording failed; its lines were dropped.",
|
|
@@ -8914,6 +8962,7 @@ var ENVIRONMENT_LOG_AREAS = defineLogAreas({
|
|
|
8914
8962
|
environment: {
|
|
8915
8963
|
description: "Environment naming, setup, status, moves, deletion and cleanup afterwards.",
|
|
8916
8964
|
events: {
|
|
8965
|
+
"cleanup.sessions-failed": "Session metadata cleanup failed during environment deletion; deletion continues.",
|
|
8917
8966
|
"cleanup.branch-kept": "A deleted environment's local branch was kept, as it may hold unmerged work.",
|
|
8918
8967
|
"rename.failed": "Naming an environment from its pending prompt failed for the first time.",
|
|
8919
8968
|
"rename.still-failing": "That rename is still failing; written at the 2nd, 4th, 8th... failure.",
|
|
@@ -8987,6 +9036,7 @@ var GATEWAY_LOG_AREAS = defineLogAreas({
|
|
|
8987
9036
|
"websocket.upgrade-failed": "A WebSocket upgrade failed.",
|
|
8988
9037
|
"events.client-dropped": "An event-stream client buffered too much and was dropped; it reconnects and refetches.",
|
|
8989
9038
|
"proxy.client-disconnected": "A proxy client went away, so its upstream request was aborted.",
|
|
9039
|
+
"traffic.burst": "Connections or requests spiked. Counts by source address, route class, client family, listener and registered invoke command; never request content.",
|
|
8990
9040
|
"throttle.suppressed": "Repeats of the throttled `site` were counted over a window, not written.",
|
|
8991
9041
|
"throttle.recovered": "The throttled `site` succeeded again, so its fault has cleared.",
|
|
8992
9042
|
"throttle.evicted": "The tracked-key limit dropped the `site`, so no recovered line follows unless it fails again."
|
|
@@ -9120,6 +9170,7 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
9120
9170
|
"native-agent": {
|
|
9121
9171
|
description: "Native agent sessions and what the backend reads from their bridges.",
|
|
9122
9172
|
events: {
|
|
9173
|
+
"session.bridge-replaced-for-policy": "An idle bridge was stopped so a resume could apply the user's wider execution policy.",
|
|
9123
9174
|
"catalogue.outdated-bridge": "A bridge predates the command catalogue, so its commands stay unavailable.",
|
|
9124
9175
|
"compact.instructions-ignored": "A bridge compacted without confirming the instructions sent with /compact: it predates them.",
|
|
9125
9176
|
"handoff.summary-read-failed": "Change summaries could not be read for a handoff, so the carrier says they are unmeasured.",
|
|
@@ -9185,7 +9236,8 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
9185
9236
|
"coordinator-servers.unavailable": "OpenCode coordinator research servers are unavailable.",
|
|
9186
9237
|
"monitor.reconnecting": "The request monitor lost its stream and is reconnecting. Error class only.",
|
|
9187
9238
|
"worker-limit.reached": "The bounded request workers are full, so the stream restarts and a snapshot reconciles.",
|
|
9188
|
-
"request.failed": "Handling a request event failed, so the stream restarts. Error class only."
|
|
9239
|
+
"request.failed": "Handling a request event failed, so the stream restarts. Error class only.",
|
|
9240
|
+
"credential-plugin.skipped": "A host OpenCode server started without the credential plugin, so its tools inherit its password; `reason` says why."
|
|
9189
9241
|
}
|
|
9190
9242
|
}
|
|
9191
9243
|
});
|
|
@@ -9213,6 +9265,7 @@ var PREVIEW_LOG_AREAS = defineLogAreas({
|
|
|
9213
9265
|
"publication.start-failed": "Private preview publication did not start.",
|
|
9214
9266
|
"publication.reconfigure-failed": "Preview publication could not be reconfigured.",
|
|
9215
9267
|
"publication.listening": "Private preview origins are listening.",
|
|
9268
|
+
"publication.same-site": "The preview domain is the same site as the application; publication runs with a warning.",
|
|
9216
9269
|
"certificate.reloaded": "The preview certificate was reloaded.",
|
|
9217
9270
|
"access.revoked-close-failed": "A revoked preview resource could not be closed. Error class only.",
|
|
9218
9271
|
"registry.invalid-definition": "An invalid stored preview service definition was ignored.",
|
|
@@ -9521,10 +9574,19 @@ var STORAGE_LOG_AREAS = defineLogAreas({
|
|
|
9521
9574
|
"retired.turn-cleanup-pending": "Cleanup of a retired Looped Review turn did not finish and stays pending.",
|
|
9522
9575
|
"handoffs.prune-failed": "Pruning agent handoffs that nothing references failed; a later prune retries.",
|
|
9523
9576
|
"desktop-connections.malformed": "Stored desktop connection settings were malformed, so the local connection is used.",
|
|
9577
|
+
"config.restrict-mode-failed": "A config file holding provider secrets could not be set to owner-only; the backend carries on.",
|
|
9524
9578
|
"legacy-json.moved": "JSON store files written after the SQLite migration were archived, not imported.",
|
|
9525
9579
|
"legacy-json.archive-failed": "Imported JSON store files could not be archived.",
|
|
9580
|
+
"lease.timed-out": "A waiter gave up on a lease; `lease` and `family` name it, `holderAgeMs` is the time since its holder's last heartbeat (null when the holder had just gone), `waitedMs` how long the waiter waited.",
|
|
9526
9581
|
"lease.heartbeat-failed": "A held lease's heartbeat failed, which shortens the lease; the next one retries.",
|
|
9527
|
-
"scrub.
|
|
9582
|
+
"scrub.vacuum-failed": "Deleted-content page reclamation failed; the checkpoint is attempted independently.",
|
|
9583
|
+
"scrub.checkpoint-failed": "Deleted content could not be scrubbed from the WAL yet because the truncating checkpoint failed or a reader held an older snapshot; it is retried without waiting until it succeeds.",
|
|
9584
|
+
"upkeep.vacuum-failed": "Periodic page reclamation failed; the next upkeep pass retries.",
|
|
9585
|
+
"optimize.failed": "Refreshing the query planner's statistics failed; queries still run and the next check retries.",
|
|
9586
|
+
"ledger.moved": "The change-tracking ledger was moved out of the main database into its own file; `rows` and `durationMs` say how much and how long.",
|
|
9587
|
+
"snapshot.top-tables-failed": "The sampled table sizes from a finished snapshot could not be saved; the snapshot stands and the next one retries.",
|
|
9588
|
+
"snapshot.ledger-skipped": "The daily change-tracking ledger snapshot was skipped because the disk or the snapshot budget lacks room; `retryAt` says when it tries again.",
|
|
9589
|
+
"snapshot.ledger-failed": "The daily change-tracking ledger snapshot failed; `retryAt` says when it tries again, if known.",
|
|
9528
9590
|
...THROTTLE_LOG_EVENTS
|
|
9529
9591
|
}
|
|
9530
9592
|
}
|
|
@@ -9541,6 +9603,7 @@ var BUILD_PIPELINE_LOG_AREAS = defineLogAreas({
|
|
|
9541
9603
|
"consolidation.consume-deferred": "Consuming a review consolidation result failed; it stays pending and is retried.",
|
|
9542
9604
|
"dispatch.prepare-failed": "Attaching the agent before dispatch failed; the prompt request does the same work and answers authoritatively.",
|
|
9543
9605
|
"interaction.resolved": "A human interaction on a pipeline stage resolved. Metadata only.",
|
|
9606
|
+
"user-message.background-send-refused": "The bridge refused a queued user message during a background wait; it stays queued and is retried.",
|
|
9544
9607
|
"transcripts.migrated": "A transcript migration pass moved stage transcripts; counts only.",
|
|
9545
9608
|
"transcripts.maintenance-failed": "Migrating or sweeping stage transcripts failed; the next start retries.",
|
|
9546
9609
|
"restore.skipped": "A pipeline could not be restored at startup and was skipped.",
|
|
@@ -9578,6 +9641,8 @@ var CHANGE_TRACKING_LOG_AREAS = defineLogAreas({
|
|
|
9578
9641
|
description: "Change tracking: turn capture, evidence pulls and measurements.",
|
|
9579
9642
|
events: {
|
|
9580
9643
|
"journal-import.failed": "Importing surviving OpenCode command journals as legacy summaries failed.",
|
|
9644
|
+
"measurement-drain.failed": "Draining an owner's superseded measurements failed; the retention pass retries.",
|
|
9645
|
+
"retention.failed": "A retention pass failed partway; what it deleted stands and the next pass goes on.",
|
|
9581
9646
|
"projection.failed": "Projecting a change event onto its environment failed.",
|
|
9582
9647
|
"startup.reconcile-failed": "Reconciling change tracking at startup failed.",
|
|
9583
9648
|
"turn-start.capture-failed": "Capturing a turn's start failed, so the turn is untracked.",
|
|
@@ -9608,7 +9673,16 @@ var COORDINATOR_LOG_AREAS = defineLogAreas({
|
|
|
9608
9673
|
coordinator: {
|
|
9609
9674
|
description: "Coordinators: delegations, status wakes and their store.",
|
|
9610
9675
|
events: {
|
|
9676
|
+
...THROTTLE_LOG_EVENTS,
|
|
9611
9677
|
"delegation.open-failed": "A delegation could not be opened; `source` says for what.",
|
|
9678
|
+
"delegation.reconcile-failed": "One delegation could not be settled; the rest of the pass still ran and the next one retries.",
|
|
9679
|
+
"delegation.wake-failed": "One delegation's wake could not be delivered; the rest of the pass still ran and the next one retries.",
|
|
9680
|
+
"delegation.wake-held": "A wake is waiting on a state the user can change (messaging off, conversation limit), and is not counted as a failure.",
|
|
9681
|
+
"delegation.wake-pass-failed": "A delegation wake pass could not run; the next sweep retries.",
|
|
9682
|
+
"delegation.wake-retire-failed": "A wake that keeps failing could not be given up on; the next pass retries.",
|
|
9683
|
+
"delegation.wake-retire-notice-failed": "The one notice for a wake being retired could not be sent; the wake stays owed and the next pass retries.",
|
|
9684
|
+
"delegation.wake-retired": "A wake kept failing and was given up on; `kind` is the last failure.",
|
|
9685
|
+
"mail.reconcile-failed": "One coordinator's mail could not be reconciled; the sweep carried on with the others.",
|
|
9612
9686
|
"deliver-now.drain-failed": "The mail delivery pass after deliverNow failed; the next sweep delivers.",
|
|
9613
9687
|
"mail.move-failed": "Mail could not move to the new main coordinator.",
|
|
9614
9688
|
"work.move-failed": "Work could not move to the main coordinator.",
|
|
@@ -9733,6 +9807,8 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
9733
9807
|
"portable-inputs.relay-missing": "Docker is rootless and the image predates the staged-input relay, so the container cannot read them until rebuilt.",
|
|
9734
9808
|
"git-mirror.mount-unavailable": "A new container gets no project Git mirror, so its clone goes to the remote.",
|
|
9735
9809
|
"git-mirror.refreshed": "A project's Git mirror was built or updated.",
|
|
9810
|
+
"git-mirror.seeded": "A project's Git mirror was built from its host checkout and only what the remote added to it.",
|
|
9811
|
+
"git-mirror.seed-skipped": "A project's host checkout could not seed its Git mirror, so the build downloads everything.",
|
|
9736
9812
|
"git-mirror.refresh-failed": "A project's Git mirror could not be updated. New clones still work, from the mirror as it was or from the remote.",
|
|
9737
9813
|
"git-mirror.low-disk": "A project's Git mirror was not updated: the disk is nearly full.",
|
|
9738
9814
|
"git-mirror.oversized": "A project's repository is too large for a Git mirror, so its environments keep the blobless clone.",
|
|
@@ -9744,6 +9820,7 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
9744
9820
|
"git-mirror.clone-fallback": "A new environment could not clone from its project's Git mirror and cloned from the remote.",
|
|
9745
9821
|
"project-seed.refused": "A project .env, .env.local or opencode.json was not copied into a new container: a link, not a regular file, outside the project, too large or unreadable.",
|
|
9746
9822
|
"opencode.warm-incomplete": "OpenCode did not finish loading /workspace in a container.",
|
|
9823
|
+
"log-driver.unbounded": "The Docker daemon offers neither the local nor the json-file log driver, so new containers keep its default driver, whose log may be uncapped. Written once per backend.",
|
|
9747
9824
|
"lifecycle-event.reconcile-failed": "Reconciling an environment after a container start or stop event failed; the next status read retries.",
|
|
9748
9825
|
"login-keeper.pass-failed": "A Claude login keeper pass failed; the next interval retries.",
|
|
9749
9826
|
"login-keeper.refresh-failed": "Refreshing the host Claude login failed. Fixed text: CLI output can hold credentials.",
|
|
@@ -9767,6 +9844,7 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
9767
9844
|
essential: true,
|
|
9768
9845
|
fields: { staleForMs: "number" }
|
|
9769
9846
|
},
|
|
9847
|
+
"writer-lease.listener-failed": "The callback told about a lost registry writer lease threw, so the schedules settings learn of the loss only at their next read.",
|
|
9770
9848
|
"writer-lease.not-acquired": {
|
|
9771
9849
|
description: "This backend started without the registry writer lease, for the fixed `reason` given. A second backend on one data directory is normal: it serves reads, runs no schedules and refuses container changes.",
|
|
9772
9850
|
essential: true,
|
|
@@ -10421,6 +10499,7 @@ var WEB_SYNC_LOG_AREAS = defineLogAreas({
|
|
|
10421
10499
|
events: {
|
|
10422
10500
|
"events.disconnected": "The main event stream dropped; it reconnects and replays.",
|
|
10423
10501
|
"terminal-stream.disconnected": "A terminal event stream dropped; it reconnects.",
|
|
10502
|
+
"relayed-stream.disconnected": "The relayed node event stream dropped; it reconnects.",
|
|
10424
10503
|
"connection-listener.failed": "A main stream connection state listener threw.",
|
|
10425
10504
|
"event-listener.failed": "A listener for a gateway event threw.",
|
|
10426
10505
|
"stream-listener.failed": "A listener for the stream-connected notice threw."
|
|
@@ -11005,7 +11084,7 @@ import path5 from "path";
|
|
|
11005
11084
|
// ../../apps/backend/package.json
|
|
11006
11085
|
var package_default = {
|
|
11007
11086
|
name: "@orkestrator/backend",
|
|
11008
|
-
version: "2.36.
|
|
11087
|
+
version: "2.36.4-beta",
|
|
11009
11088
|
private: true,
|
|
11010
11089
|
type: "module",
|
|
11011
11090
|
exports: {
|
|
@@ -11844,7 +11923,8 @@ var OPTIONAL_PROJECTION_FIELD_SET = new Set([
|
|
|
11844
11923
|
// ../protocol/src/notification-sounds.ts
|
|
11845
11924
|
var DEFAULT_NOTIFICATION_SOUND_SETTINGS = Object.freeze({
|
|
11846
11925
|
agentStopped: true,
|
|
11847
|
-
prMerged: true
|
|
11926
|
+
prMerged: true,
|
|
11927
|
+
coordinatorReport: true
|
|
11848
11928
|
});
|
|
11849
11929
|
|
|
11850
11930
|
// ../protocol/src/agent-settings.ts
|
|
@@ -12446,6 +12526,8 @@ function buildFixPrompt(facts) {
|
|
|
12446
12526
|
"",
|
|
12447
12527
|
...bugReportDiagnosticsSection(facts.diagnosticConnection ? `- Run \`${facts.cliCommand} host status --connection ${facts.diagnosticConnection}\` and \`${facts.cliCommand} connection check --connection ${facts.diagnosticConnection}\` for this installation; add \`--json\` for detail. They never start or change anything.` : "- No saved CLI connection was verified for this data directory. Use the local evidence above; do not run backend status commands against the saved default or change CLI configuration."),
|
|
12448
12528
|
"",
|
|
12529
|
+
"If the evidence is not enough, tell me I can make a diagnostics bundle to attach: Settings \u2192 Debug \u2192 Export diagnostics, or `orkestrator diagnostics export` in my own terminal. It saves a local `.tar.gz` of metrics, health figures and redacted logs, and shows what it holds first. This is my decision: never run it yourself, and do not read a bundle unless I give you one. Its redaction is not a proof, so remind me to read it before attaching it, because an issue is public.",
|
|
12530
|
+
"",
|
|
12449
12531
|
"## 3. Draft the issue",
|
|
12450
12532
|
...BUG_REPORT_REDACTION_RULES,
|
|
12451
12533
|
"",
|
|
@@ -13529,8 +13611,8 @@ var AGENT_ACTIVITY_MAX_FUTURE_SKEW_MS = 5 * 60000;
|
|
|
13529
13611
|
var ACTIVITY_SORT_ORDERS = ["priority", "newest", "oldest"];
|
|
13530
13612
|
var ACTIVITY_ATTENTION_RANK = {
|
|
13531
13613
|
waiting: 0,
|
|
13532
|
-
|
|
13533
|
-
|
|
13614
|
+
idle: 1,
|
|
13615
|
+
working: 2
|
|
13534
13616
|
};
|
|
13535
13617
|
function parseTimestamp(value) {
|
|
13536
13618
|
if (!value)
|
|
@@ -13550,7 +13632,13 @@ function compareActivityTimestampsDesc(left, right) {
|
|
|
13550
13632
|
return 1;
|
|
13551
13633
|
return 0;
|
|
13552
13634
|
}
|
|
13635
|
+
function activityGroup({ activity, prState }) {
|
|
13636
|
+
return (prState === "merged" ? 2 : 0) + (activity === "working" ? 1 : 0);
|
|
13637
|
+
}
|
|
13553
13638
|
function compareEnvironmentsByActivity(left, right, order = "priority") {
|
|
13639
|
+
const group = activityGroup(left) - activityGroup(right);
|
|
13640
|
+
if (group !== 0)
|
|
13641
|
+
return group;
|
|
13554
13642
|
if (order === "priority") {
|
|
13555
13643
|
const unread = Number(right.hasUnreadWork === true) - Number(left.hasUnreadWork === true);
|
|
13556
13644
|
if (unread !== 0)
|
|
@@ -13628,7 +13716,8 @@ function sortEnvironmentsByActivity(environments, order) {
|
|
|
13628
13716
|
const fields = (environment) => ({
|
|
13629
13717
|
activity: AGENT_ACTIVITY_STATES.includes(environment.activity.state) ? environment.activity.state : null,
|
|
13630
13718
|
hasUnreadWork: environment.activity.hasUnreadWork,
|
|
13631
|
-
lastActivityAt: environment.lastActivityAt
|
|
13719
|
+
lastActivityAt: environment.lastActivityAt,
|
|
13720
|
+
prState: environment.pr.state
|
|
13632
13721
|
});
|
|
13633
13722
|
return environments.map((environment, index) => ({ environment, index, fields: fields(environment) })).sort((left, right) => compareEnvironmentsByActivity(left.fields, right.fields, order) || left.index - right.index).map(({ environment }) => environment);
|
|
13634
13723
|
}
|
|
@@ -17993,6 +18082,9 @@ function changesViewLines(view) {
|
|
|
17993
18082
|
if (files.nextCursor) {
|
|
17994
18083
|
lines.push("", `${files.rows.length} of ${files.totalRows ?? "?"} files shown; next page: --cursor ${files.nextCursor}`);
|
|
17995
18084
|
}
|
|
18085
|
+
if (files.omittedRows) {
|
|
18086
|
+
lines.push("", `${files.omittedRows} more changed files are not listed; the totals count them.`);
|
|
18087
|
+
}
|
|
17996
18088
|
return lines;
|
|
17997
18089
|
}
|
|
17998
18090
|
function changesHistoryLines(history) {
|
|
@@ -18099,6 +18191,133 @@ var changesCommands = [
|
|
|
18099
18191
|
}
|
|
18100
18192
|
];
|
|
18101
18193
|
|
|
18194
|
+
// src/client/commands/diagnostics.ts
|
|
18195
|
+
import { createHash } from "crypto";
|
|
18196
|
+
import { writeFile } from "fs/promises";
|
|
18197
|
+
import path9 from "path";
|
|
18198
|
+
function formatBytes(bytes) {
|
|
18199
|
+
if (bytes < 1024)
|
|
18200
|
+
return `${bytes} B`;
|
|
18201
|
+
if (bytes < 1024 * 1024)
|
|
18202
|
+
return `${(bytes / 1024).toFixed(1)} KiB`;
|
|
18203
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MiB`;
|
|
18204
|
+
}
|
|
18205
|
+
function manifestLines(manifest) {
|
|
18206
|
+
return [
|
|
18207
|
+
...table(["FILE", "SIZE", "REDACTED", "HOLDS"], manifest.entries.map((entry) => [
|
|
18208
|
+
entry.path,
|
|
18209
|
+
formatBytes(entry.bytes),
|
|
18210
|
+
String(entry.redactions),
|
|
18211
|
+
entry.description
|
|
18212
|
+
])),
|
|
18213
|
+
...manifest.absent.length > 0 ? [
|
|
18214
|
+
"",
|
|
18215
|
+
"Not in the bundle:",
|
|
18216
|
+
...manifest.absent.map((item) => ` ${item.name}: ${item.reason}`)
|
|
18217
|
+
] : [],
|
|
18218
|
+
"",
|
|
18219
|
+
manifest.notice
|
|
18220
|
+
];
|
|
18221
|
+
}
|
|
18222
|
+
var diagnosticsCommands = [
|
|
18223
|
+
{
|
|
18224
|
+
path: ["diagnostics", "plan"],
|
|
18225
|
+
action: "diagnostics.plan",
|
|
18226
|
+
summary: "Show exactly what a diagnostics bundle would hold, without saving it.",
|
|
18227
|
+
description: "The backend builds the bundle in memory and answers with its manifest. Pass the printed plan ID to `diagnostics export --plan` to save that same bundle. A plan lasts 15 minutes.",
|
|
18228
|
+
positionals: [],
|
|
18229
|
+
options: [],
|
|
18230
|
+
idOutput: "the plan ID",
|
|
18231
|
+
async run(context) {
|
|
18232
|
+
const session = await context.session();
|
|
18233
|
+
const plan = await session.read("diagnostics.plan", {});
|
|
18234
|
+
return {
|
|
18235
|
+
action: "diagnostics.plan",
|
|
18236
|
+
result: plan,
|
|
18237
|
+
connection: session.identity,
|
|
18238
|
+
ids: [plan.planId],
|
|
18239
|
+
human: [
|
|
18240
|
+
`Plan ${plan.planId}, ${formatBytes(plan.archive.bytes)}, until ${plan.expiresAt}`,
|
|
18241
|
+
"",
|
|
18242
|
+
...manifestLines(plan.manifest)
|
|
18243
|
+
]
|
|
18244
|
+
};
|
|
18245
|
+
}
|
|
18246
|
+
},
|
|
18247
|
+
{
|
|
18248
|
+
path: ["diagnostics", "export"],
|
|
18249
|
+
action: "diagnostics.read",
|
|
18250
|
+
inputFields: { plan: "planId", file: null },
|
|
18251
|
+
summary: "Save a diagnostics bundle (.tar.gz) on this machine. Nothing is uploaded.",
|
|
18252
|
+
idOutput: "the saved file's path",
|
|
18253
|
+
description: "Metrics, health figures, database figures and logs, with credentials and home directories redacted by pattern. Redaction is not a proof, so read the files before sharing them. The bundle is written with owner-only permissions, and an existing file is never overwritten.",
|
|
18254
|
+
positionals: [],
|
|
18255
|
+
options: [
|
|
18256
|
+
{
|
|
18257
|
+
name: "file",
|
|
18258
|
+
kind: "string",
|
|
18259
|
+
valueName: "PATH",
|
|
18260
|
+
description: "File to write on this machine (default: a dated name in this directory)."
|
|
18261
|
+
},
|
|
18262
|
+
{
|
|
18263
|
+
name: "plan",
|
|
18264
|
+
kind: "string",
|
|
18265
|
+
valueName: "PLAN_ID",
|
|
18266
|
+
description: "Save a bundle you reviewed with `diagnostics plan` (default: plan one now)."
|
|
18267
|
+
}
|
|
18268
|
+
],
|
|
18269
|
+
examples: [
|
|
18270
|
+
"orkestrator diagnostics export",
|
|
18271
|
+
"orkestrator diagnostics plan",
|
|
18272
|
+
"orkestrator diagnostics export --plan PLAN_ID --file report.tar.gz"
|
|
18273
|
+
],
|
|
18274
|
+
async run(context, parsed) {
|
|
18275
|
+
const session = await context.session();
|
|
18276
|
+
const reviewedPlan = stringOption(parsed.options, "plan");
|
|
18277
|
+
const plan = reviewedPlan ? null : await session.read("diagnostics.plan", {});
|
|
18278
|
+
const planId = reviewedPlan ?? plan.planId;
|
|
18279
|
+
const pieces = [];
|
|
18280
|
+
let offset = 0;
|
|
18281
|
+
let last = null;
|
|
18282
|
+
while (offset !== null) {
|
|
18283
|
+
last = await session.read("diagnostics.read", { planId, offset });
|
|
18284
|
+
pieces.push(Buffer.from(last.data, "base64"));
|
|
18285
|
+
offset = last.nextOffset;
|
|
18286
|
+
}
|
|
18287
|
+
const bytes = Buffer.concat(pieces);
|
|
18288
|
+
const expected = last.archive;
|
|
18289
|
+
if (bytes.byteLength !== expected.bytes || createHash("sha256").update(bytes).digest("hex") !== expected.sha256) {
|
|
18290
|
+
throw new CliError("operation-failed", "The bundle did not arrive intact; nothing was saved.", {
|
|
18291
|
+
retryable: true
|
|
18292
|
+
});
|
|
18293
|
+
}
|
|
18294
|
+
const target = path9.resolve(context.io.cwd, stringOption(parsed.options, "file") ?? last.fileName);
|
|
18295
|
+
try {
|
|
18296
|
+
await writeFile(target, bytes, { flag: "wx", mode: 384 });
|
|
18297
|
+
} catch (error) {
|
|
18298
|
+
if (error.code === "EEXIST") {
|
|
18299
|
+
throw new CliError("invalid-input", "That file already exists; choose another --file.");
|
|
18300
|
+
}
|
|
18301
|
+
throw new CliError("operation-failed", "The bundle could not be written to that path.");
|
|
18302
|
+
}
|
|
18303
|
+
return {
|
|
18304
|
+
action: "diagnostics.read",
|
|
18305
|
+
result: {
|
|
18306
|
+
path: target,
|
|
18307
|
+
archive: expected,
|
|
18308
|
+
...plan ? { manifest: plan.manifest } : {}
|
|
18309
|
+
},
|
|
18310
|
+
connection: session.identity,
|
|
18311
|
+
ids: [target],
|
|
18312
|
+
human: [
|
|
18313
|
+
`Saved ${target} (${formatBytes(bytes.byteLength)}). Nothing was uploaded.`,
|
|
18314
|
+
...plan ? ["", ...manifestLines(plan.manifest)] : []
|
|
18315
|
+
]
|
|
18316
|
+
};
|
|
18317
|
+
}
|
|
18318
|
+
}
|
|
18319
|
+
];
|
|
18320
|
+
|
|
18102
18321
|
// src/client/commands/completion.ts
|
|
18103
18322
|
var SHELLS2 = ["bash", "zsh", "fish"];
|
|
18104
18323
|
function flagsOf(options2) {
|
|
@@ -18295,7 +18514,7 @@ function completionCommands(commands) {
|
|
|
18295
18514
|
}
|
|
18296
18515
|
|
|
18297
18516
|
// src/client/commands/connection.ts
|
|
18298
|
-
import
|
|
18517
|
+
import path13 from "path";
|
|
18299
18518
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
18300
18519
|
import { promises as fs5 } from "fs";
|
|
18301
18520
|
|
|
@@ -18375,6 +18594,7 @@ function parseBackendInstanceDescriptor(value) {
|
|
|
18375
18594
|
generation: text("generation", 200),
|
|
18376
18595
|
pid: value.pid,
|
|
18377
18596
|
startedAt: text("startedAt", 64),
|
|
18597
|
+
...value.processIdentity !== undefined ? { processIdentity: text("processIdentity", 128) } : {},
|
|
18378
18598
|
url: value.url,
|
|
18379
18599
|
...value.browserUrl !== undefined ? { browserUrl: value.browserUrl } : {},
|
|
18380
18600
|
...endpoints !== undefined ? { endpoints } : {},
|
|
@@ -18385,21 +18605,31 @@ function parseBackendInstanceDescriptor(value) {
|
|
|
18385
18605
|
publicApiSchemaVersion: value.publicApiSchemaVersion
|
|
18386
18606
|
};
|
|
18387
18607
|
}
|
|
18608
|
+
function linuxProcessIdentity(bootId, stat) {
|
|
18609
|
+
const boot = bootId.trim();
|
|
18610
|
+
const close = stat.lastIndexOf(")");
|
|
18611
|
+
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(boot) || close < 0)
|
|
18612
|
+
return null;
|
|
18613
|
+
const ticks = stat.slice(close + 2).split(" ").at(19);
|
|
18614
|
+
if (!ticks || !/^\d+$/.test(ticks) || !Number.isSafeInteger(Number(ticks)))
|
|
18615
|
+
return null;
|
|
18616
|
+
return `${boot}:${ticks}`;
|
|
18617
|
+
}
|
|
18388
18618
|
|
|
18389
18619
|
// src/client/receipts.ts
|
|
18390
|
-
import { createHash } from "crypto";
|
|
18620
|
+
import { createHash as createHash2 } from "crypto";
|
|
18391
18621
|
import { promises as fs3 } from "fs";
|
|
18392
|
-
import
|
|
18622
|
+
import path10 from "path";
|
|
18393
18623
|
var MAX_LOCAL_RECEIPTS_PER_INSTALLATION = 1000;
|
|
18394
18624
|
var MAX_RECEIPT_BYTES = 8 * 1024;
|
|
18395
18625
|
function receiptKey(action, requestId, node) {
|
|
18396
|
-
const hash =
|
|
18626
|
+
const hash = createHash2("sha256").update(action).update("\x00").update(requestId);
|
|
18397
18627
|
if (node)
|
|
18398
18628
|
hash.update("\x00node:").update(node);
|
|
18399
18629
|
return hash.digest("hex");
|
|
18400
18630
|
}
|
|
18401
18631
|
function safeSegment(value) {
|
|
18402
|
-
return /^[A-Za-z0-9._-]{1,200}$/.test(value) ? value :
|
|
18632
|
+
return /^[A-Za-z0-9._-]{1,200}$/.test(value) ? value : createHash2("sha256").update(value).digest("hex");
|
|
18403
18633
|
}
|
|
18404
18634
|
|
|
18405
18635
|
class LocalReceiptStore {
|
|
@@ -18408,10 +18638,10 @@ class LocalReceiptStore {
|
|
|
18408
18638
|
this.root = root;
|
|
18409
18639
|
}
|
|
18410
18640
|
directory(installationId) {
|
|
18411
|
-
return
|
|
18641
|
+
return path10.join(this.root, safeSegment(installationId));
|
|
18412
18642
|
}
|
|
18413
18643
|
file(installationId, action, requestId, node) {
|
|
18414
|
-
return
|
|
18644
|
+
return path10.join(this.directory(installationId), `${receiptKey(action, requestId, node)}.json`);
|
|
18415
18645
|
}
|
|
18416
18646
|
async find(installationId, action, requestId, node) {
|
|
18417
18647
|
return this.readFile(this.file(installationId, action, requestId, node));
|
|
@@ -18435,14 +18665,14 @@ class LocalReceiptStore {
|
|
|
18435
18665
|
});
|
|
18436
18666
|
}
|
|
18437
18667
|
async list(installationId, limit = 50) {
|
|
18438
|
-
const directories = installationId ? [this.directory(installationId)] : (await fs3.readdir(this.root).catch(() => [])).map((name) =>
|
|
18668
|
+
const directories = installationId ? [this.directory(installationId)] : (await fs3.readdir(this.root).catch(() => [])).map((name) => path10.join(this.root, name));
|
|
18439
18669
|
const receipts = [];
|
|
18440
18670
|
for (const directory of directories) {
|
|
18441
18671
|
const names = await fs3.readdir(directory).catch(() => []);
|
|
18442
18672
|
for (const name of names) {
|
|
18443
18673
|
if (!name.endsWith(".json"))
|
|
18444
18674
|
continue;
|
|
18445
|
-
const receipt = await this.readFile(
|
|
18675
|
+
const receipt = await this.readFile(path10.join(directory, name));
|
|
18446
18676
|
if (receipt)
|
|
18447
18677
|
receipts.push(receipt);
|
|
18448
18678
|
}
|
|
@@ -18470,7 +18700,7 @@ class LocalReceiptStore {
|
|
|
18470
18700
|
if (names.length <= MAX_LOCAL_RECEIPTS_PER_INSTALLATION)
|
|
18471
18701
|
return;
|
|
18472
18702
|
const entries = await Promise.all(names.map(async (name) => {
|
|
18473
|
-
const file =
|
|
18703
|
+
const file = path10.join(directory, name);
|
|
18474
18704
|
const stat = await fs3.stat(file).catch(() => null);
|
|
18475
18705
|
return { file, mtime: stat?.mtimeMs ?? 0 };
|
|
18476
18706
|
}));
|
|
@@ -18484,7 +18714,7 @@ class LocalReceiptStore {
|
|
|
18484
18714
|
}
|
|
18485
18715
|
|
|
18486
18716
|
// src/client/session.ts
|
|
18487
|
-
import { createHash as
|
|
18717
|
+
import { createHash as createHash3, randomUUID as randomUUID2 } from "crypto";
|
|
18488
18718
|
|
|
18489
18719
|
// src/client/transport.ts
|
|
18490
18720
|
var DEFAULT_REQUEST_TIMEOUT_MS = 60000;
|
|
@@ -18712,7 +18942,7 @@ class ClientSession {
|
|
|
18712
18942
|
}
|
|
18713
18943
|
const installationId = capabilities.backend.installationId;
|
|
18714
18944
|
const key = requestId ?? `cli-${randomUUID2()}`;
|
|
18715
|
-
const intentDigest =
|
|
18945
|
+
const intentDigest = createHash3("sha256").update(canonicalJson({ action, input })).digest("hex");
|
|
18716
18946
|
const existing = await this.receipts.find(installationId, action, key, this.options.node);
|
|
18717
18947
|
if (existing && existing.intentDigest !== intentDigest) {
|
|
18718
18948
|
throw new CliError("request-conflict", "This saved request ID was used for a different intent", {
|
|
@@ -18838,12 +19068,12 @@ function quoteArgument(value) {
|
|
|
18838
19068
|
|
|
18839
19069
|
// src/client/targets.ts
|
|
18840
19070
|
import { constants as fsConstants, promises as fs4 } from "fs";
|
|
18841
|
-
import
|
|
19071
|
+
import path12 from "path";
|
|
18842
19072
|
import { isIPv4 } from "net";
|
|
18843
19073
|
|
|
18844
19074
|
// ../protocol/src/node/runtime-profile-status.ts
|
|
18845
19075
|
import os5 from "os";
|
|
18846
|
-
import
|
|
19076
|
+
import path11 from "path";
|
|
18847
19077
|
var RUNTIME_APP_SLUG = "orkestrator-v2";
|
|
18848
19078
|
var RUNTIME_STATUS_KEYS = new Set([
|
|
18849
19079
|
"version",
|
|
@@ -18887,27 +19117,107 @@ function normalizeRuntimeProfileId(value) {
|
|
|
18887
19117
|
}
|
|
18888
19118
|
function defaultRuntimeProfileRoots(platform = process.platform, env = process.env, homeDir = os5.homedir()) {
|
|
18889
19119
|
if (platform === "darwin") {
|
|
18890
|
-
const appSupport =
|
|
19120
|
+
const appSupport = path11.join(homeDir, "Library", "Application Support");
|
|
18891
19121
|
return {
|
|
18892
|
-
developmentRoot:
|
|
18893
|
-
productionDataDir:
|
|
19122
|
+
developmentRoot: path11.join(appSupport, `${RUNTIME_APP_SLUG}-dev`),
|
|
19123
|
+
productionDataDir: path11.join(appSupport, RUNTIME_APP_SLUG),
|
|
18894
19124
|
homeDir
|
|
18895
19125
|
};
|
|
18896
19126
|
}
|
|
18897
19127
|
if (platform === "win32") {
|
|
18898
19128
|
throw new Error("Orkestrator development profiles support macOS and Linux only");
|
|
18899
19129
|
}
|
|
18900
|
-
const configRoot = env.XDG_CONFIG_HOME ??
|
|
19130
|
+
const configRoot = env.XDG_CONFIG_HOME ?? path11.join(homeDir, ".config");
|
|
18901
19131
|
return {
|
|
18902
|
-
developmentRoot:
|
|
18903
|
-
productionDataDir:
|
|
19132
|
+
developmentRoot: path11.join(configRoot, `${RUNTIME_APP_SLUG}-dev`),
|
|
19133
|
+
productionDataDir: path11.join(configRoot, RUNTIME_APP_SLUG),
|
|
18904
19134
|
homeDir
|
|
18905
19135
|
};
|
|
18906
19136
|
}
|
|
18907
19137
|
function runtimeProfileStatusPath(developmentRoot, profileName) {
|
|
18908
19138
|
const id = normalizeRuntimeProfileId(profileName);
|
|
18909
|
-
const profileRoot =
|
|
18910
|
-
return { id, profileRoot, statusPath:
|
|
19139
|
+
const profileRoot = path11.resolve(developmentRoot, "profiles", id);
|
|
19140
|
+
return { id, profileRoot, statusPath: path11.join(profileRoot, "runtime", "status.json") };
|
|
19141
|
+
}
|
|
19142
|
+
|
|
19143
|
+
// src/client/process-start.ts
|
|
19144
|
+
import { execFile } from "child_process";
|
|
19145
|
+
import { readFile } from "fs/promises";
|
|
19146
|
+
var LINUX_USER_HZ = 100;
|
|
19147
|
+
var PS_TIMEOUT_MS = 2000;
|
|
19148
|
+
var PS_PATH = "/bin/ps";
|
|
19149
|
+
var defaultSources = {
|
|
19150
|
+
platform: process.platform,
|
|
19151
|
+
readText: (file) => readFile(file, "utf8"),
|
|
19152
|
+
runPs: (args) => new Promise((resolve, reject) => {
|
|
19153
|
+
execFile(PS_PATH, args, {
|
|
19154
|
+
encoding: "utf8",
|
|
19155
|
+
timeout: PS_TIMEOUT_MS,
|
|
19156
|
+
maxBuffer: 4096,
|
|
19157
|
+
env: { ...process.env, LC_ALL: "C", TZ: "UTC0" }
|
|
19158
|
+
}, (error, stdout) => error ? reject(error) : resolve(stdout));
|
|
19159
|
+
})
|
|
19160
|
+
};
|
|
19161
|
+
function createProcessStartReader(sources = defaultSources) {
|
|
19162
|
+
return async (pid) => {
|
|
19163
|
+
if (!Number.isSafeInteger(pid) || pid <= 0)
|
|
19164
|
+
return null;
|
|
19165
|
+
try {
|
|
19166
|
+
if (sources.platform === "linux")
|
|
19167
|
+
return await linuxStartTime(pid, sources);
|
|
19168
|
+
if (sources.platform === "darwin") {
|
|
19169
|
+
return parsePsLstart(await sources.runPs(["-o", "lstart=", "-p", String(pid)]));
|
|
19170
|
+
}
|
|
19171
|
+
} catch {}
|
|
19172
|
+
return null;
|
|
19173
|
+
};
|
|
19174
|
+
}
|
|
19175
|
+
var readProcessStartTime = createProcessStartReader();
|
|
19176
|
+
async function linuxStartTime(pid, sources) {
|
|
19177
|
+
const ticks = parseProcStatStartTicks(await sources.readText(`/proc/${pid}/stat`));
|
|
19178
|
+
const bootSeconds = parseProcStatBootTime(await sources.readText("/proc/stat"));
|
|
19179
|
+
if (ticks === null || bootSeconds === null)
|
|
19180
|
+
return null;
|
|
19181
|
+
return bootSeconds * 1000 + Math.round(ticks * 1000 / LINUX_USER_HZ);
|
|
19182
|
+
}
|
|
19183
|
+
function parseProcStatStartTicks(stat) {
|
|
19184
|
+
const close = stat.lastIndexOf(")");
|
|
19185
|
+
if (close < 0)
|
|
19186
|
+
return null;
|
|
19187
|
+
const value = stat.slice(close + 2).split(" ").at(19);
|
|
19188
|
+
if (!value || !/^\d+$/.test(value))
|
|
19189
|
+
return null;
|
|
19190
|
+
const ticks = Number(value);
|
|
19191
|
+
return Number.isSafeInteger(ticks) ? ticks : null;
|
|
19192
|
+
}
|
|
19193
|
+
function parseProcStatBootTime(stat) {
|
|
19194
|
+
const match = /^btime (\d+)$/m.exec(stat);
|
|
19195
|
+
if (!match)
|
|
19196
|
+
return null;
|
|
19197
|
+
const seconds = Number(match[1]);
|
|
19198
|
+
return Number.isSafeInteger(seconds) && seconds > 0 ? seconds : null;
|
|
19199
|
+
}
|
|
19200
|
+
var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
19201
|
+
function parsePsLstart(output) {
|
|
19202
|
+
const match = /^[A-Z][a-z]{2} +([A-Z][a-z]{2}) +(\d{1,2}) (\d{2}):(\d{2}):(\d{2}) (\d{4})$/.exec(output.trim());
|
|
19203
|
+
if (!match)
|
|
19204
|
+
return null;
|
|
19205
|
+
const month = MONTHS.indexOf(match[1]);
|
|
19206
|
+
if (month < 0)
|
|
19207
|
+
return null;
|
|
19208
|
+
const [day, hours, minutes, seconds, year] = match.slice(2).map(Number);
|
|
19209
|
+
const time = Date.UTC(year, month, day, hours, minutes, seconds);
|
|
19210
|
+
return Number.isFinite(time) ? time : null;
|
|
19211
|
+
}
|
|
19212
|
+
async function readLinuxProcessIdentity(pid, readText = defaultSources.readText) {
|
|
19213
|
+
if (!Number.isSafeInteger(pid) || pid <= 0)
|
|
19214
|
+
return null;
|
|
19215
|
+
try {
|
|
19216
|
+
const boot = await readText("/proc/sys/kernel/random/boot_id");
|
|
19217
|
+
return linuxProcessIdentity(boot, await readText(`/proc/${pid}/stat`));
|
|
19218
|
+
} catch {
|
|
19219
|
+
return null;
|
|
19220
|
+
}
|
|
18911
19221
|
}
|
|
18912
19222
|
|
|
18913
19223
|
// src/client/targets.ts
|
|
@@ -19005,7 +19315,7 @@ async function readDescriptor(file, currentUid = process.getuid?.()) {
|
|
|
19005
19315
|
if (code !== "ENOENT") {
|
|
19006
19316
|
throw refuseDescriptor(file, `it could not be opened (${code ?? "unknown error"})`);
|
|
19007
19317
|
}
|
|
19008
|
-
throw new CliError("connection-failed", `No running backend published ${
|
|
19318
|
+
throw new CliError("connection-failed", `No running backend published ${path12.basename(file)} at the selected location`, { details: { descriptor: "missing" } });
|
|
19009
19319
|
}
|
|
19010
19320
|
let text;
|
|
19011
19321
|
try {
|
|
@@ -19040,9 +19350,37 @@ function processIsAlive(pid) {
|
|
|
19040
19350
|
return false;
|
|
19041
19351
|
}
|
|
19042
19352
|
}
|
|
19043
|
-
|
|
19044
|
-
|
|
19045
|
-
|
|
19353
|
+
var DESCRIPTOR_START_BEFORE_TOLERANCE_MS = 60 * 60 * 1000;
|
|
19354
|
+
var DESCRIPTOR_START_AFTER_TOLERANCE_MS = 30 * 1000;
|
|
19355
|
+
async function descriptorProcessRefusal(descriptor, readStart = readProcessStartTime, alive = processIsAlive) {
|
|
19356
|
+
if (!alive(descriptor.pid))
|
|
19357
|
+
return "is not running as your user (its descriptor is stale)";
|
|
19358
|
+
if (process.platform === "linux" && readStart === readProcessStartTime) {
|
|
19359
|
+
if (!descriptor.processIdentity) {
|
|
19360
|
+
return "cannot be confirmed: restart an upgraded backend to publish its Linux process identity";
|
|
19361
|
+
}
|
|
19362
|
+
const identity = await readLinuxProcessIdentity(descriptor.pid);
|
|
19363
|
+
if (identity === null)
|
|
19364
|
+
return "cannot be confirmed: its Linux process identity could not be read";
|
|
19365
|
+
return identity === descriptor.processIdentity ? null : "is not running: its process identity changed (its descriptor is stale)";
|
|
19366
|
+
}
|
|
19367
|
+
const startedAt = Date.parse(descriptor.startedAt);
|
|
19368
|
+
if (!Number.isFinite(startedAt)) {
|
|
19369
|
+
return "cannot be confirmed: its descriptor has no valid start time";
|
|
19370
|
+
}
|
|
19371
|
+
const actual = await readStart(descriptor.pid);
|
|
19372
|
+
if (actual === null) {
|
|
19373
|
+
return `cannot be confirmed: the start time of process ${descriptor.pid} could not be read`;
|
|
19374
|
+
}
|
|
19375
|
+
if (actual > startedAt + DESCRIPTOR_START_AFTER_TOLERANCE_MS || actual < startedAt - DESCRIPTOR_START_BEFORE_TOLERANCE_MS) {
|
|
19376
|
+
return `is not running: pid ${descriptor.pid} belongs to a process started at ${new Date(actual).toISOString()}, but the backend started at ${new Date(startedAt).toISOString()} (its descriptor is stale)`;
|
|
19377
|
+
}
|
|
19378
|
+
return null;
|
|
19379
|
+
}
|
|
19380
|
+
async function descriptorTarget(name, kind, descriptor, expectedInstallationId, refresh, readStart) {
|
|
19381
|
+
const refusal = await descriptorProcessRefusal(descriptor, readStart);
|
|
19382
|
+
if (refusal) {
|
|
19383
|
+
throw new CliError("connection-failed", `The backend for ${kind} '${name}' ${refusal}`);
|
|
19046
19384
|
}
|
|
19047
19385
|
if (expectedInstallationId && descriptor.installationId !== expectedInstallationId) {
|
|
19048
19386
|
throw new CliError("identity-mismatch", `The backend at ${kind} '${name}' is a different installation than the one saved`, { details: { expected: expectedInstallationId, actual: descriptor.installationId } });
|
|
@@ -19057,7 +19395,12 @@ function descriptorTarget(name, kind, descriptor, expectedInstallationId, refres
|
|
|
19057
19395
|
generation: descriptor.generation
|
|
19058
19396
|
},
|
|
19059
19397
|
baseUrl,
|
|
19060
|
-
readToken: () =>
|
|
19398
|
+
readToken: async () => {
|
|
19399
|
+
const refusal = await descriptorProcessRefusal(descriptor, readStart);
|
|
19400
|
+
if (refusal)
|
|
19401
|
+
throw new CliError("connection-failed", `The backend for ${kind} '${name}' ${refusal}`);
|
|
19402
|
+
return readTokenFile(descriptor.authFile, true);
|
|
19403
|
+
},
|
|
19061
19404
|
expectedInstallationId: descriptor.installationId,
|
|
19062
19405
|
descriptorGeneration: descriptor.generation,
|
|
19063
19406
|
refresh
|
|
@@ -19077,10 +19420,10 @@ async function resolveTarget(selection, store, env) {
|
|
|
19077
19420
|
}
|
|
19078
19421
|
return resolveSavedConnection(name, saved);
|
|
19079
19422
|
}
|
|
19080
|
-
async function resolveSavedConnection(name, saved) {
|
|
19423
|
+
async function resolveSavedConnection(name, saved, readStart = readProcessStartTime) {
|
|
19081
19424
|
if (saved.kind === "descriptor") {
|
|
19082
19425
|
const descriptor = await readDescriptor(saved.descriptorPath);
|
|
19083
|
-
return descriptorTarget(name, "connection", descriptor, saved.installationId, () => resolveSavedConnection(name, saved));
|
|
19426
|
+
return descriptorTarget(name, "connection", descriptor, saved.installationId, () => resolveSavedConnection(name, saved, readStart), readStart);
|
|
19084
19427
|
}
|
|
19085
19428
|
const baseUrl = normalizeBaseUrl(saved.url);
|
|
19086
19429
|
return {
|
|
@@ -19095,7 +19438,7 @@ async function resolveSavedConnection(name, saved) {
|
|
|
19095
19438
|
...saved.installationId ? { expectedInstallationId: saved.installationId } : {}
|
|
19096
19439
|
};
|
|
19097
19440
|
}
|
|
19098
|
-
async function resolveProfile(profileName, env) {
|
|
19441
|
+
async function resolveProfile(profileName, env, readStart = readProcessStartTime) {
|
|
19099
19442
|
let located;
|
|
19100
19443
|
try {
|
|
19101
19444
|
const developmentRoot = env.ORKESTRATOR_DEV_ROOT ?? defaultRuntimeProfileRoots(process.platform, env).developmentRoot;
|
|
@@ -19119,9 +19462,9 @@ async function resolveProfile(profileName, env) {
|
|
|
19119
19462
|
if (!backendPid || !processIsAlive(backendPid)) {
|
|
19120
19463
|
throw new CliError("profile-unavailable", `Profile '${located.id}' reports ready but its backend is not running (stale status)`);
|
|
19121
19464
|
}
|
|
19122
|
-
const refresh = () => resolveProfile(profileName, env);
|
|
19465
|
+
const refresh = () => resolveProfile(profileName, env, readStart);
|
|
19123
19466
|
if (manifest.dataDir) {
|
|
19124
|
-
const descriptorFile =
|
|
19467
|
+
const descriptorFile = path12.join(manifest.dataDir, BACKEND_INSTANCE_DESCRIPTOR_FILE);
|
|
19125
19468
|
const descriptor = await readDescriptor(descriptorFile).catch((error) => {
|
|
19126
19469
|
if (error instanceof CliError && error.details?.descriptor === "missing")
|
|
19127
19470
|
return null;
|
|
@@ -19131,7 +19474,7 @@ async function resolveProfile(profileName, env) {
|
|
|
19131
19474
|
if (descriptor.pid !== backendPid) {
|
|
19132
19475
|
throw new CliError("profile-unavailable", `Profile '${located.id}' has a descriptor from a different backend process`);
|
|
19133
19476
|
}
|
|
19134
|
-
return descriptorTarget(located.id, "profile", descriptor, undefined, refresh);
|
|
19477
|
+
return descriptorTarget(located.id, "profile", descriptor, undefined, refresh, readStart);
|
|
19135
19478
|
}
|
|
19136
19479
|
}
|
|
19137
19480
|
if (!manifest.browserUrl || !manifest.authFile) {
|
|
@@ -19154,7 +19497,7 @@ function store(context) {
|
|
|
19154
19497
|
async function removeManagedCredential(configStore, name, saved) {
|
|
19155
19498
|
if (saved?.kind !== "endpoint")
|
|
19156
19499
|
return;
|
|
19157
|
-
const legacyFile =
|
|
19500
|
+
const legacyFile = path13.join(configStore.credentialsDirectory, `${name}.json`);
|
|
19158
19501
|
if (saved.managedCredential !== true && saved.credentialFile !== legacyFile)
|
|
19159
19502
|
return;
|
|
19160
19503
|
await configStore.removeOwnedCredential(saved.credentialFile).catch(() => {
|
|
@@ -19314,7 +19657,7 @@ var connectionCommands = [
|
|
|
19314
19657
|
const normalizedUrl = normalizeBaseUrl(url);
|
|
19315
19658
|
let file;
|
|
19316
19659
|
if (credentialFile) {
|
|
19317
|
-
file =
|
|
19660
|
+
file = path13.resolve(context.io.cwd, credentialFile);
|
|
19318
19661
|
await readTokenFile(file, true);
|
|
19319
19662
|
} else {
|
|
19320
19663
|
const bytes = await context.io.readStdin(16 * 1024);
|
|
@@ -19333,7 +19676,7 @@ var connectionCommands = [
|
|
|
19333
19676
|
addedAt: now
|
|
19334
19677
|
};
|
|
19335
19678
|
} else {
|
|
19336
|
-
const descriptorPath =
|
|
19679
|
+
const descriptorPath = path13.resolve(context.io.cwd, descriptorOption ?? path13.join(dataDir, BACKEND_INSTANCE_DESCRIPTOR_FILE));
|
|
19337
19680
|
saved = { kind: "descriptor", descriptorPath, addedAt: now };
|
|
19338
19681
|
}
|
|
19339
19682
|
let checked = null;
|
|
@@ -21100,9 +21443,9 @@ var mailCommands = [
|
|
|
21100
21443
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
21101
21444
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
21102
21445
|
import { existsSync as existsSync6 } from "fs";
|
|
21103
|
-
import { mkdir as mkdir2, rm as rm2, stat as stat2, writeFile as
|
|
21446
|
+
import { mkdir as mkdir2, rm as rm2, stat as stat2, writeFile as writeFile3 } from "fs/promises";
|
|
21104
21447
|
import { createServer } from "net";
|
|
21105
|
-
import
|
|
21448
|
+
import path17 from "path";
|
|
21106
21449
|
|
|
21107
21450
|
// ../../apps/backend/src/fixed-ports.ts
|
|
21108
21451
|
var DEFAULT_GATEWAY_PORT = 34121;
|
|
@@ -21110,10 +21453,10 @@ var DEFAULT_CONTROL_MCP_PORT = 34122;
|
|
|
21110
21453
|
|
|
21111
21454
|
// src/client/service-connection.ts
|
|
21112
21455
|
import { open } from "fs/promises";
|
|
21113
|
-
import
|
|
21456
|
+
import path14 from "path";
|
|
21114
21457
|
async function currentDescriptorGeneration(dataDir) {
|
|
21115
21458
|
try {
|
|
21116
|
-
return (await readDescriptor(
|
|
21459
|
+
return (await readDescriptor(path14.join(dataDir, BACKEND_INSTANCE_DESCRIPTOR_FILE))).generation;
|
|
21117
21460
|
} catch (error) {
|
|
21118
21461
|
if (isDescriptorRefusal(error))
|
|
21119
21462
|
throw error;
|
|
@@ -21148,12 +21491,12 @@ async function startupLogExcerpt(logFile, offset, version) {
|
|
|
21148
21491
|
return lines.slice(0, end).filter((line) => line.trim() !== "").slice(-LOG_EXCERPT_LINES).map((line) => line.slice(0, LOG_EXCERPT_MAX_LINE));
|
|
21149
21492
|
}
|
|
21150
21493
|
async function awaitServiceConnection(dataDir, previousGeneration, options2) {
|
|
21151
|
-
const file =
|
|
21494
|
+
const file = path14.join(dataDir, BACKEND_INSTANCE_DESCRIPTOR_FILE);
|
|
21152
21495
|
try {
|
|
21153
21496
|
const descriptor = await observe(async () => {
|
|
21154
21497
|
try {
|
|
21155
21498
|
const value = await readDescriptor(file);
|
|
21156
|
-
const fresh = value.generation !== previousGeneration &&
|
|
21499
|
+
const fresh = value.generation !== previousGeneration && path14.resolve(value.dataDir) === path14.resolve(dataDir) && (options2.expectedVersion === undefined || value.appVersion === options2.expectedVersion) && await descriptorProcessRefusal(value, options2.readStart ?? readProcessStartTime) === null;
|
|
21157
21500
|
if (fresh)
|
|
21158
21501
|
return { done: true, value };
|
|
21159
21502
|
} catch (error) {
|
|
@@ -21378,13 +21721,13 @@ Equivalent command, for scripts:
|
|
|
21378
21721
|
}
|
|
21379
21722
|
|
|
21380
21723
|
// src/client/service-units.ts
|
|
21381
|
-
import { createHash as
|
|
21724
|
+
import { createHash as createHash4 } from "crypto";
|
|
21382
21725
|
import os7 from "os";
|
|
21383
|
-
import
|
|
21726
|
+
import path15 from "path";
|
|
21384
21727
|
function suffix(dataDir, defaultDataDir) {
|
|
21385
|
-
if (
|
|
21728
|
+
if (path15.resolve(dataDir) === path15.resolve(defaultDataDir))
|
|
21386
21729
|
return "";
|
|
21387
|
-
return `-${
|
|
21730
|
+
return `-${createHash4("sha256").update(path15.resolve(dataDir)).digest("hex").slice(0, 8)}`;
|
|
21388
21731
|
}
|
|
21389
21732
|
function xml(text) {
|
|
21390
21733
|
return text.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
@@ -21403,7 +21746,7 @@ function serviceUnit(options2) {
|
|
|
21403
21746
|
return {
|
|
21404
21747
|
manager: "launchd",
|
|
21405
21748
|
name,
|
|
21406
|
-
file:
|
|
21749
|
+
file: path15.join(home, "Library", "LaunchAgents", `${name}.plist`),
|
|
21407
21750
|
contents: `<?xml version="1.0" encoding="UTF-8"?>
|
|
21408
21751
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
21409
21752
|
<plist version="1.0">
|
|
@@ -21437,13 +21780,13 @@ ${args}
|
|
|
21437
21780
|
};
|
|
21438
21781
|
}
|
|
21439
21782
|
const name = `orkestrator-backend${tag}.service`;
|
|
21440
|
-
const configHome = options2.env.XDG_CONFIG_HOME ??
|
|
21783
|
+
const configHome = options2.env.XDG_CONFIG_HOME ?? path15.join(home, ".config");
|
|
21441
21784
|
const xdgEnvironment = options2.env.XDG_CONFIG_HOME === undefined ? "" : `Environment=${systemdWord(`XDG_CONFIG_HOME=${options2.env.XDG_CONFIG_HOME}`)}
|
|
21442
21785
|
`;
|
|
21443
21786
|
return {
|
|
21444
21787
|
manager: "systemd",
|
|
21445
21788
|
name,
|
|
21446
|
-
file:
|
|
21789
|
+
file: path15.join(configHome, "systemd", "user", name),
|
|
21447
21790
|
contents: `[Unit]
|
|
21448
21791
|
Description=Orkestrator backend (${options2.dataDir})
|
|
21449
21792
|
After=network-online.target
|
|
@@ -21499,7 +21842,7 @@ var DATA_DIR_OPTION = {
|
|
|
21499
21842
|
var DEFAULT_READY_WAIT_MS = 3 * 60 * 1000;
|
|
21500
21843
|
var RESERVED_SERVE_FLAGS = new Set(["--data-dir", "--standalone-updater", "--desktop-updater"]);
|
|
21501
21844
|
function dataDirectory(context, parsed) {
|
|
21502
|
-
return
|
|
21845
|
+
return path17.resolve(stringOption(parsed.options, "data-dir") ?? context.io.env.ORKESTRATOR_DATA_DIR ?? defaultDataDir(process.platform, context.io.env));
|
|
21503
21846
|
}
|
|
21504
21847
|
function installCommandLine(parsed) {
|
|
21505
21848
|
const line = ["bunx", "orkestrator", "service", "install"];
|
|
@@ -21532,7 +21875,7 @@ function unitFor(context, dataDir, bun) {
|
|
|
21532
21875
|
defaultDataDir: defaultDataDir(process.platform, context.io.env),
|
|
21533
21876
|
bun,
|
|
21534
21877
|
launcher: layout.launcher,
|
|
21535
|
-
logFile:
|
|
21878
|
+
logFile: path17.join(layout.logs, "service.log"),
|
|
21536
21879
|
env: context.io.env
|
|
21537
21880
|
})
|
|
21538
21881
|
};
|
|
@@ -21740,10 +22083,10 @@ var serviceCommands = [
|
|
|
21740
22083
|
installedAt: new Date().toISOString()
|
|
21741
22084
|
});
|
|
21742
22085
|
await mkdir2(layout.logs, { recursive: true });
|
|
21743
|
-
await mkdir2(
|
|
21744
|
-
await
|
|
22086
|
+
await mkdir2(path17.dirname(unit.file), { recursive: true });
|
|
22087
|
+
await writeFile3(unit.file, unit.contents);
|
|
21745
22088
|
const started = parsed.options["skip-start"] !== true;
|
|
21746
|
-
const logFile =
|
|
22089
|
+
const logFile = path17.join(layout.logs, "service.log");
|
|
21747
22090
|
let connection = null;
|
|
21748
22091
|
if (started) {
|
|
21749
22092
|
const previousGeneration = await currentDescriptorGeneration(dataDir);
|
|
@@ -23056,9 +23399,9 @@ var ticketCommands = [
|
|
|
23056
23399
|
];
|
|
23057
23400
|
|
|
23058
23401
|
// src/client/commands/toolchain.ts
|
|
23059
|
-
import
|
|
23402
|
+
import path23 from "path";
|
|
23060
23403
|
function dataDirectory2(context, parsed) {
|
|
23061
|
-
return
|
|
23404
|
+
return path23.resolve(stringOption(parsed.options, "data-dir") ?? context.io.env.ORKESTRATOR_DATA_DIR ?? defaultDataDir(process.platform, context.io.env));
|
|
23062
23405
|
}
|
|
23063
23406
|
function requestedTools(parsed) {
|
|
23064
23407
|
const raw = parsed.options.tool;
|
|
@@ -23161,7 +23504,7 @@ var toolchainCommands = [
|
|
|
23161
23504
|
const rows = installed.tools.map((tool) => ({
|
|
23162
23505
|
tool,
|
|
23163
23506
|
version: installed.versions[tool] ?? "",
|
|
23164
|
-
executable:
|
|
23507
|
+
executable: path23.join(installed.currentBinDir, path23.basename(installed.executables[tool]))
|
|
23165
23508
|
}));
|
|
23166
23509
|
return {
|
|
23167
23510
|
action: "toolchain.install",
|
|
@@ -23935,7 +24278,8 @@ var GROUP_SUMMARIES = {
|
|
|
23935
24278
|
agent: "Discover agents, models and controls.",
|
|
23936
24279
|
session: "Start, prompt, control and inspect native-agent conversations.",
|
|
23937
24280
|
changes: "Read the file and line changes the backend measures (read-only).",
|
|
23938
|
-
run: "Inspect, wait for and recover individual operations."
|
|
24281
|
+
run: "Inspect, wait for and recover individual operations.",
|
|
24282
|
+
diagnostics: "Save a local bundle of diagnostics to attach to a report (nothing is uploaded)."
|
|
23939
24283
|
};
|
|
23940
24284
|
function optionLine(option) {
|
|
23941
24285
|
const flag = `--${option.name}${option.kind === "boolean" ? "" : ` ${option.valueName ?? "VALUE"}`}`;
|
|
@@ -24302,6 +24646,7 @@ var CLIENT_COMMANDS = [
|
|
|
24302
24646
|
...runCommands,
|
|
24303
24647
|
...toolchainCommands,
|
|
24304
24648
|
...hostCommands,
|
|
24649
|
+
...diagnosticsCommands,
|
|
24305
24650
|
...serviceCommands,
|
|
24306
24651
|
...completionCommands(() => CLIENT_COMMANDS)
|
|
24307
24652
|
];
|