orkestrator 2.36.2-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 +641 -228
- package/dist/main.js +216455 -203389
- package/package.json +3 -3
- package/resources/acp-bridge/dist/index.js +435 -177
- package/resources/claude-bridge/dist/index.js +625 -79
- package/resources/codex-bridge/dist/index.js +529 -204
- package/resources/cursor-bridge/dist/index.js +29729 -29377
- package/resources/cursor-bridge/runtime/install.json +1 -1
- package/resources/pi-bridge/dist/index.js +29622 -29239
- 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);
|
|
@@ -7080,7 +7112,7 @@ var PUBLIC_ACTIONS = {
|
|
|
7080
7112
|
effects: ["metadata", "provider-session"],
|
|
7081
7113
|
observation: "receipt",
|
|
7082
7114
|
milestone: "D",
|
|
7083
|
-
summary: "Start an environment's Multi Review, as the Multi Review button does: reviewers, consolidation, then optional
|
|
7115
|
+
summary: "Start an environment's Multi Review, as the Multi Review button does: reviewers, consolidation, then optional Address Findings and PR, with saved defaults for what is omitted; an active review is reused."
|
|
7084
7116
|
},
|
|
7085
7117
|
"review.list": {
|
|
7086
7118
|
version: 1,
|
|
@@ -7096,7 +7128,7 @@ var PUBLIC_ACTIONS = {
|
|
|
7096
7128
|
effects: [],
|
|
7097
7129
|
observation: "immediate",
|
|
7098
7130
|
milestone: "D",
|
|
7099
|
-
summary: "Read one Multi Review: phase, reviewers, consolidation,
|
|
7131
|
+
summary: "Read one Multi Review: phase, reviewers, consolidation, Address Findings and PR steps."
|
|
7100
7132
|
},
|
|
7101
7133
|
"review.open": {
|
|
7102
7134
|
version: 1,
|
|
@@ -7104,7 +7136,7 @@ var PUBLIC_ACTIONS = {
|
|
|
7104
7136
|
effects: ["metadata"],
|
|
7105
7137
|
observation: "receipt",
|
|
7106
7138
|
milestone: "D",
|
|
7107
|
-
summary: "Open or focus a Multi Review's root tab or its
|
|
7139
|
+
summary: "Open or focus a Multi Review's root tab or its Address Findings tab; starts no work."
|
|
7108
7140
|
},
|
|
7109
7141
|
"review.address": {
|
|
7110
7142
|
version: 1,
|
|
@@ -7112,7 +7144,7 @@ var PUBLIC_ACTIONS = {
|
|
|
7112
7144
|
effects: ["provider-session"],
|
|
7113
7145
|
observation: "receipt",
|
|
7114
7146
|
milestone: "D",
|
|
7115
|
-
summary: "Address a Multi Review's findings: hand them to its
|
|
7147
|
+
summary: "Address a Multi Review's findings: hand them to its Address Findings session (the Address findings button)."
|
|
7116
7148
|
},
|
|
7117
7149
|
"review.cancel": {
|
|
7118
7150
|
version: 1,
|
|
@@ -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,
|
|
@@ -8226,6 +8274,7 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
|
8226
8274
|
"address_multi_review",
|
|
8227
8275
|
"adopt_workflow",
|
|
8228
8276
|
"answer_worker_question",
|
|
8277
|
+
"ask_agents",
|
|
8229
8278
|
"cancel_build_pipeline",
|
|
8230
8279
|
"cancel_graph_run",
|
|
8231
8280
|
"cancel_multi_review",
|
|
@@ -8258,13 +8307,11 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
|
8258
8307
|
"launch_graph",
|
|
8259
8308
|
"launch_job",
|
|
8260
8309
|
"launch_multi_review",
|
|
8261
|
-
"launch_node_environment",
|
|
8262
8310
|
"launch_terminal",
|
|
8263
8311
|
"list_agents",
|
|
8264
8312
|
"list_environments",
|
|
8265
8313
|
"list_graph_templates",
|
|
8266
8314
|
"list_mailboxes",
|
|
8267
|
-
"list_node_environments",
|
|
8268
8315
|
"list_nodes",
|
|
8269
8316
|
"list_projects",
|
|
8270
8317
|
"list_provider_accounts",
|
|
@@ -8293,16 +8340,11 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
|
8293
8340
|
"resume_schedule",
|
|
8294
8341
|
"run_worker_command",
|
|
8295
8342
|
"send_message",
|
|
8296
|
-
"send_node_message",
|
|
8297
|
-
"send_prompt_to_node_tab",
|
|
8298
8343
|
"send_prompt_to_tab",
|
|
8299
8344
|
"set_worker_goal",
|
|
8300
8345
|
"start_build_pipeline",
|
|
8301
8346
|
"start_environment",
|
|
8302
|
-
"start_multi_review",
|
|
8303
|
-
"start_node_environment",
|
|
8304
8347
|
"stop_environment",
|
|
8305
|
-
"stop_node_environment",
|
|
8306
8348
|
"stop_worker_turn",
|
|
8307
8349
|
"switch_provider_account",
|
|
8308
8350
|
"set_account_auto_switch",
|
|
@@ -8360,7 +8402,8 @@ function bugReportDiagnosticsSection(connectionLine) {
|
|
|
8360
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.",
|
|
8361
8403
|
"Useful sources:",
|
|
8362
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.",
|
|
8363
|
-
"-
|
|
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.",
|
|
8364
8407
|
connectionLine,
|
|
8365
8408
|
"- Docker environments: `docker version`, `docker ps -a`, and `docker logs --tail 200 <container>` for the affected container.",
|
|
8366
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.",
|
|
@@ -8530,6 +8573,12 @@ var BACKEND_LOG_AREAS = defineLogAreas({
|
|
|
8530
8573
|
"startup.looped-review-pending": "Cleanup of the retired Looped Review stays pending.",
|
|
8531
8574
|
"notice.failed": "A background notice after a turn or prompt failed; `step` says which.",
|
|
8532
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.",
|
|
8533
8582
|
"shutdown.step-failed": "One part of shutdown failed and the rest went on; `step` says which.",
|
|
8534
8583
|
"shutdown.signal-received": {
|
|
8535
8584
|
description: "A signal started shutdown, which tells a clean quit from the backend being killed.",
|
|
@@ -8573,7 +8622,8 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
8573
8622
|
description: "What every long-lived bridge does the same way: its sweep and its shutdown.",
|
|
8574
8623
|
events: {
|
|
8575
8624
|
"idle-sweep.failed": "An idle sweep threw; the next tick retries.",
|
|
8576
|
-
"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."
|
|
8577
8627
|
}
|
|
8578
8628
|
},
|
|
8579
8629
|
"bridge.acp": {
|
|
@@ -8707,7 +8757,6 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
8707
8757
|
"parent.gone": "The backend that launched this bridge has gone; stopping turns and shutting down.",
|
|
8708
8758
|
"queue.overflow": "The notification queue passed a bound and dropped its backlog.",
|
|
8709
8759
|
"queue.task-failed": "A task on a per-thread queue failed.",
|
|
8710
|
-
"raw-log.write-failed": "Appending to the raw Codex log failed.",
|
|
8711
8760
|
"recorder.notice": "The notification recorder needs attention: it is on, or was asked for without its confirmation.",
|
|
8712
8761
|
"recorder.threw": "The notification recorder threw.",
|
|
8713
8762
|
"recorder.write-failed": "Writing a notification recording failed; its lines were dropped.",
|
|
@@ -8913,6 +8962,7 @@ var ENVIRONMENT_LOG_AREAS = defineLogAreas({
|
|
|
8913
8962
|
environment: {
|
|
8914
8963
|
description: "Environment naming, setup, status, moves, deletion and cleanup afterwards.",
|
|
8915
8964
|
events: {
|
|
8965
|
+
"cleanup.sessions-failed": "Session metadata cleanup failed during environment deletion; deletion continues.",
|
|
8916
8966
|
"cleanup.branch-kept": "A deleted environment's local branch was kept, as it may hold unmerged work.",
|
|
8917
8967
|
"rename.failed": "Naming an environment from its pending prompt failed for the first time.",
|
|
8918
8968
|
"rename.still-failing": "That rename is still failing; written at the 2nd, 4th, 8th... failure.",
|
|
@@ -8941,6 +8991,7 @@ var ENVIRONMENT_LOG_AREAS = defineLogAreas({
|
|
|
8941
8991
|
"status.docker-error": "A transient Docker error stopped a status read, so the stored status is kept.",
|
|
8942
8992
|
"setup.clear-launch-failed": "A pending agent launch could not be cleared after setup failed.",
|
|
8943
8993
|
"setup.record-failure-failed": "A setup failure before its first attempt could not be recorded.",
|
|
8994
|
+
"setup.tab-publish-failed": "The setup terminal's tab could not be published.",
|
|
8944
8995
|
"lifecycle.failed": "Starting, rebuilding or recreating an environment failed; `operation` says which.",
|
|
8945
8996
|
"tab-teardown.pending": "A tab's teardown failed and stays pending; the reconcile sweep retries.",
|
|
8946
8997
|
"tab-reconcile.skipped": "Orphaned tab reconciliation was skipped because pane layouts are unreadable.",
|
|
@@ -8985,6 +9036,7 @@ var GATEWAY_LOG_AREAS = defineLogAreas({
|
|
|
8985
9036
|
"websocket.upgrade-failed": "A WebSocket upgrade failed.",
|
|
8986
9037
|
"events.client-dropped": "An event-stream client buffered too much and was dropped; it reconnects and refetches.",
|
|
8987
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.",
|
|
8988
9040
|
"throttle.suppressed": "Repeats of the throttled `site` were counted over a window, not written.",
|
|
8989
9041
|
"throttle.recovered": "The throttled `site` succeeded again, so its fault has cleared.",
|
|
8990
9042
|
"throttle.evicted": "The tracked-key limit dropped the `site`, so no recovered line follows unless it fails again."
|
|
@@ -9118,6 +9170,7 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
9118
9170
|
"native-agent": {
|
|
9119
9171
|
description: "Native agent sessions and what the backend reads from their bridges.",
|
|
9120
9172
|
events: {
|
|
9173
|
+
"session.bridge-replaced-for-policy": "An idle bridge was stopped so a resume could apply the user's wider execution policy.",
|
|
9121
9174
|
"catalogue.outdated-bridge": "A bridge predates the command catalogue, so its commands stay unavailable.",
|
|
9122
9175
|
"compact.instructions-ignored": "A bridge compacted without confirming the instructions sent with /compact: it predates them.",
|
|
9123
9176
|
"handoff.summary-read-failed": "Change summaries could not be read for a handoff, so the carrier says they are unmeasured.",
|
|
@@ -9148,6 +9201,7 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
9148
9201
|
"turn-recovery.failed": "Recovering an incomplete turn failed.",
|
|
9149
9202
|
"turn-recovery.exhausted": "A turn failed again after automatic recovery and is left for the user.",
|
|
9150
9203
|
"turn-recovery.retrying": "An incomplete or provider-failed turn is being retried automatically.",
|
|
9204
|
+
"usage-limit.notice-failed": "A usage-limit stop's outcome could not be read for its notice.",
|
|
9151
9205
|
"usage-limit.resend-failed": "Resending after a usage limit failed. An unknown send stays in the journal.",
|
|
9152
9206
|
"title.strategy-failed": "A session title strategy failed, so the next is tried. Content-free: the error can quote the prompt.",
|
|
9153
9207
|
...THROTTLE_LOG_EVENTS
|
|
@@ -9164,6 +9218,15 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
9164
9218
|
"recover.failed": "Goals could not be recovered at startup."
|
|
9165
9219
|
}
|
|
9166
9220
|
},
|
|
9221
|
+
"native-agent.subork": {
|
|
9222
|
+
description: "Suborks: the ask_agents calls a native agent makes. Content-free.",
|
|
9223
|
+
events: {
|
|
9224
|
+
"pass.failed": "A pass over a call failed, so a later pass retries. Counts only.",
|
|
9225
|
+
"delivery.failed": "A call's answers could not be placed in the caller's mailbox yet. Error class only.",
|
|
9226
|
+
"retention.failed": "An old call could not be removed.",
|
|
9227
|
+
"sweep.failed": "A running call's caller could not be checked; the next sweep looks again."
|
|
9228
|
+
}
|
|
9229
|
+
},
|
|
9167
9230
|
"native-agent.opencode": {
|
|
9168
9231
|
description: "The OpenCode provider: its request monitor, retries and agent tools.",
|
|
9169
9232
|
events: {
|
|
@@ -9173,7 +9236,8 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
9173
9236
|
"coordinator-servers.unavailable": "OpenCode coordinator research servers are unavailable.",
|
|
9174
9237
|
"monitor.reconnecting": "The request monitor lost its stream and is reconnecting. Error class only.",
|
|
9175
9238
|
"worker-limit.reached": "The bounded request workers are full, so the stream restarts and a snapshot reconciles.",
|
|
9176
|
-
"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."
|
|
9177
9241
|
}
|
|
9178
9242
|
}
|
|
9179
9243
|
});
|
|
@@ -9201,6 +9265,7 @@ var PREVIEW_LOG_AREAS = defineLogAreas({
|
|
|
9201
9265
|
"publication.start-failed": "Private preview publication did not start.",
|
|
9202
9266
|
"publication.reconfigure-failed": "Preview publication could not be reconfigured.",
|
|
9203
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.",
|
|
9204
9269
|
"certificate.reloaded": "The preview certificate was reloaded.",
|
|
9205
9270
|
"access.revoked-close-failed": "A revoked preview resource could not be closed. Error class only.",
|
|
9206
9271
|
"registry.invalid-definition": "An invalid stored preview service definition was ignored.",
|
|
@@ -9509,10 +9574,19 @@ var STORAGE_LOG_AREAS = defineLogAreas({
|
|
|
9509
9574
|
"retired.turn-cleanup-pending": "Cleanup of a retired Looped Review turn did not finish and stays pending.",
|
|
9510
9575
|
"handoffs.prune-failed": "Pruning agent handoffs that nothing references failed; a later prune retries.",
|
|
9511
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.",
|
|
9512
9578
|
"legacy-json.moved": "JSON store files written after the SQLite migration were archived, not imported.",
|
|
9513
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.",
|
|
9514
9581
|
"lease.heartbeat-failed": "A held lease's heartbeat failed, which shortens the lease; the next one retries.",
|
|
9515
|
-
"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.",
|
|
9516
9590
|
...THROTTLE_LOG_EVENTS
|
|
9517
9591
|
}
|
|
9518
9592
|
}
|
|
@@ -9529,6 +9603,7 @@ var BUILD_PIPELINE_LOG_AREAS = defineLogAreas({
|
|
|
9529
9603
|
"consolidation.consume-deferred": "Consuming a review consolidation result failed; it stays pending and is retried.",
|
|
9530
9604
|
"dispatch.prepare-failed": "Attaching the agent before dispatch failed; the prompt request does the same work and answers authoritatively.",
|
|
9531
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.",
|
|
9532
9607
|
"transcripts.migrated": "A transcript migration pass moved stage transcripts; counts only.",
|
|
9533
9608
|
"transcripts.maintenance-failed": "Migrating or sweeping stage transcripts failed; the next start retries.",
|
|
9534
9609
|
"restore.skipped": "A pipeline could not be restored at startup and was skipped.",
|
|
@@ -9566,6 +9641,8 @@ var CHANGE_TRACKING_LOG_AREAS = defineLogAreas({
|
|
|
9566
9641
|
description: "Change tracking: turn capture, evidence pulls and measurements.",
|
|
9567
9642
|
events: {
|
|
9568
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.",
|
|
9569
9646
|
"projection.failed": "Projecting a change event onto its environment failed.",
|
|
9570
9647
|
"startup.reconcile-failed": "Reconciling change tracking at startup failed.",
|
|
9571
9648
|
"turn-start.capture-failed": "Capturing a turn's start failed, so the turn is untracked.",
|
|
@@ -9596,7 +9673,16 @@ var COORDINATOR_LOG_AREAS = defineLogAreas({
|
|
|
9596
9673
|
coordinator: {
|
|
9597
9674
|
description: "Coordinators: delegations, status wakes and their store.",
|
|
9598
9675
|
events: {
|
|
9676
|
+
...THROTTLE_LOG_EVENTS,
|
|
9599
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.",
|
|
9600
9686
|
"deliver-now.drain-failed": "The mail delivery pass after deliverNow failed; the next sweep delivers.",
|
|
9601
9687
|
"mail.move-failed": "Mail could not move to the new main coordinator.",
|
|
9602
9688
|
"work.move-failed": "Work could not move to the main coordinator.",
|
|
@@ -9604,6 +9690,11 @@ var COORDINATOR_LOG_AREAS = defineLogAreas({
|
|
|
9604
9690
|
"wake.observe-pull-request-failed": "A pull request could not be observed for status wakes.",
|
|
9605
9691
|
"wake.observe-feature-plan-failed": "A feature plan could not be observed for status wakes.",
|
|
9606
9692
|
"wake.observe-workflow-failed": "A workflow could not be observed for status wakes.",
|
|
9693
|
+
"notice.outbox-refused": "A leaf's outbox refused a coordinator notice, so its own coordinator takes it.",
|
|
9694
|
+
"notice.start-main-failed": "A coordinator notice could not start a main coordinator; it waits for one to open.",
|
|
9695
|
+
"notice.take-back-unread": "A notice handed back from a command node found no open coordinator here.",
|
|
9696
|
+
"limit-stop.own": "A coordinator's own usage-limit stop attempted to move it off the account.",
|
|
9697
|
+
"limit-stop.notice-failed": "A usage-limit notice could not be sent; it stays in the ledger for the next attempt.",
|
|
9607
9698
|
"wake.deliver-failed": "A workflow status wake could not be delivered; the next pass retries.",
|
|
9608
9699
|
"wake.waiting-check-failed": "A waiting worker could not be checked; the next pass retries.",
|
|
9609
9700
|
"wake.resolve-report-failed": "A finished Resolve tab could not be reported.",
|
|
@@ -9634,15 +9725,15 @@ var REVIEW_LOG_AREAS = defineLogAreas({
|
|
|
9634
9725
|
review: {
|
|
9635
9726
|
description: "Multi Review workflows: scheduling, graph runs and interactive fix sessions.",
|
|
9636
9727
|
events: {
|
|
9637
|
-
"fix-tab.publish-failed": "A
|
|
9728
|
+
"fix-tab.publish-failed": "A Address Findings request was delivered but its tab could not be opened; the user is told.",
|
|
9638
9729
|
"graph-run.not-started": "A workflow's graph run did not start.",
|
|
9639
9730
|
"reconcile.scan-failed": "A reconciliation scan failed; the next scan retries.",
|
|
9640
9731
|
"graph-engine.unavailable": "The graph engine is selected but unavailable, so the bespoke engine runs.",
|
|
9641
9732
|
"graph-run.cancel-failed": "Cancelling a graph run failed; the next pass projects how it ended.",
|
|
9642
9733
|
"delete.cleanup-failed": "A cleanup step after deleting a workflow failed; stale tabs reconcile away on hydration.",
|
|
9643
|
-
"fix-session.read-failed": "Reading an interactive
|
|
9734
|
+
"fix-session.read-failed": "Reading an interactive Address Findings session's state failed.",
|
|
9644
9735
|
"fix-outcome.read-failed": "Reading an interactive fix's outcome failed; it stays pending.",
|
|
9645
|
-
"fix-usage.read-failed": "Reading
|
|
9736
|
+
"fix-usage.read-failed": "Reading an Address Findings session's token usage failed.",
|
|
9646
9737
|
"result.consume-deferred": "Consuming a workflow result failed; it stays staged and is retried.",
|
|
9647
9738
|
"failure-triage.failed": "Classifying a review package's failing tests failed; the package is sealed without the triage and says so."
|
|
9648
9739
|
}
|
|
@@ -9695,6 +9786,7 @@ var AGENT_ACCOUNTS_LOG_AREAS = defineLogAreas({
|
|
|
9695
9786
|
"agent-accounts": {
|
|
9696
9787
|
description: "Agent accounts: automatic switching, staged logins and plan usage.",
|
|
9697
9788
|
events: {
|
|
9789
|
+
"limit-stop-notice.failed": "A session's usage-limit stop could not be reported.",
|
|
9698
9790
|
"switch-notice.failed": "A notice about an automatic account switch failed; the switch stands. `audience` says whose.",
|
|
9699
9791
|
"auto-switch.check-failed": "An automatic account check failed; the next nudge retries.",
|
|
9700
9792
|
"container-sync.failed": "Handing a login or account to a container failed; `step` says which part.",
|
|
@@ -9713,8 +9805,22 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
9713
9805
|
description: "Docker containers: lifecycle, starts, staged inputs and the login files they hold.",
|
|
9714
9806
|
events: {
|
|
9715
9807
|
"portable-inputs.relay-missing": "Docker is rootless and the image predates the staged-input relay, so the container cannot read them until rebuilt.",
|
|
9808
|
+
"git-mirror.mount-unavailable": "A new container gets no project Git mirror, so its clone goes to the remote.",
|
|
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.",
|
|
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.",
|
|
9813
|
+
"git-mirror.low-disk": "A project's Git mirror was not updated: the disk is nearly full.",
|
|
9814
|
+
"git-mirror.oversized": "A project's repository is too large for a Git mirror, so its environments keep the blobless clone.",
|
|
9815
|
+
"git-mirror.compact-failed": "A project's Git mirror could not be compacted.",
|
|
9816
|
+
"git-mirror.state-write-failed": "A project's Git mirror could not be marked for checking.",
|
|
9817
|
+
"git-mirror.remove-failed": "A project's Git mirror could not be removed; a sweep retries.",
|
|
9818
|
+
"git-mirror.orphans-removed": "Git mirrors of removed projects were removed.",
|
|
9819
|
+
"git-mirror.clone-used": "A new environment cloned from its project's Git mirror.",
|
|
9820
|
+
"git-mirror.clone-fallback": "A new environment could not clone from its project's Git mirror and cloned from the remote.",
|
|
9716
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.",
|
|
9717
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.",
|
|
9718
9824
|
"lifecycle-event.reconcile-failed": "Reconciling an environment after a container start or stop event failed; the next status read retries.",
|
|
9719
9825
|
"login-keeper.pass-failed": "A Claude login keeper pass failed; the next interval retries.",
|
|
9720
9826
|
"login-keeper.refresh-failed": "Refreshing the host Claude login failed. Fixed text: CLI output can hold credentials.",
|
|
@@ -9738,6 +9844,7 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
9738
9844
|
essential: true,
|
|
9739
9845
|
fields: { staleForMs: "number" }
|
|
9740
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.",
|
|
9741
9848
|
"writer-lease.not-acquired": {
|
|
9742
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.",
|
|
9743
9850
|
essential: true,
|
|
@@ -9861,8 +9968,12 @@ var NODES_LOG_AREAS = defineLogAreas({
|
|
|
9861
9968
|
nodes: {
|
|
9862
9969
|
description: "Command nodes: links, handovers, leaf mail, ticket sync and project copies.",
|
|
9863
9970
|
events: {
|
|
9971
|
+
...THROTTLE_LOG_EVENTS,
|
|
9864
9972
|
"actions.resume-failed": "Approved actions could not be resumed; a later pass retries.",
|
|
9865
9973
|
"project-copy.notify-failed": "The coordinator could not be told a project copy finished.",
|
|
9974
|
+
"mail.return-deferred": "The leaf refused returned mail; it remains queued for retry.",
|
|
9975
|
+
"notices.take-back-failed": "A notice for this node's coordinator stayed in the outbox.",
|
|
9976
|
+
"notice.collected-retired": "A detached controller owned a notice with ambiguous delivery; retired without redelivery.",
|
|
9866
9977
|
"mail.delivery-deferred": "Leaf mail could not reach a coordinator yet.",
|
|
9867
9978
|
"command.post-step-failed": "A step after a routed command failed.",
|
|
9868
9979
|
"seed-files.incomplete": "Seed files for a leaf environment were not all copied.",
|
|
@@ -10378,6 +10489,7 @@ var WEB_SYNC_LOG_AREAS = defineLogAreas({
|
|
|
10378
10489
|
"web.read-coordinator": {
|
|
10379
10490
|
description: "The renderer's coalesced, bounded backend reads.",
|
|
10380
10491
|
events: {
|
|
10492
|
+
"poll.read-failed": "A coordinated poll's read failed; it stays on its interval.",
|
|
10381
10493
|
"listener.threw": "A read state listener threw.",
|
|
10382
10494
|
"read.settle-failed": "Applying a finished read's result threw."
|
|
10383
10495
|
}
|
|
@@ -10387,6 +10499,7 @@ var WEB_SYNC_LOG_AREAS = defineLogAreas({
|
|
|
10387
10499
|
events: {
|
|
10388
10500
|
"events.disconnected": "The main event stream dropped; it reconnects and replays.",
|
|
10389
10501
|
"terminal-stream.disconnected": "A terminal event stream dropped; it reconnects.",
|
|
10502
|
+
"relayed-stream.disconnected": "The relayed node event stream dropped; it reconnects.",
|
|
10390
10503
|
"connection-listener.failed": "A main stream connection state listener threw.",
|
|
10391
10504
|
"event-listener.failed": "A listener for a gateway event threw.",
|
|
10392
10505
|
"stream-listener.failed": "A listener for the stream-connected notice threw."
|
|
@@ -10971,7 +11084,7 @@ import path5 from "path";
|
|
|
10971
11084
|
// ../../apps/backend/package.json
|
|
10972
11085
|
var package_default = {
|
|
10973
11086
|
name: "@orkestrator/backend",
|
|
10974
|
-
version: "2.36.
|
|
11087
|
+
version: "2.36.4-beta",
|
|
10975
11088
|
private: true,
|
|
10976
11089
|
type: "module",
|
|
10977
11090
|
exports: {
|
|
@@ -11766,6 +11879,7 @@ var PROJECTION_FIELD_SET = new Set([
|
|
|
11766
11879
|
"asyncQuestionResponses",
|
|
11767
11880
|
"contextUsage",
|
|
11768
11881
|
"goal",
|
|
11882
|
+
"suborks",
|
|
11769
11883
|
"rateLimits",
|
|
11770
11884
|
"runtime",
|
|
11771
11885
|
"runtimeHealthAuthoritative",
|
|
@@ -11791,6 +11905,7 @@ var OPTIONAL_PROJECTION_FIELD_SET = new Set([
|
|
|
11791
11905
|
"asyncQuestionResponses",
|
|
11792
11906
|
"contextUsage",
|
|
11793
11907
|
"goal",
|
|
11908
|
+
"suborks",
|
|
11794
11909
|
"rateLimits",
|
|
11795
11910
|
"runtime",
|
|
11796
11911
|
"runtimeHealthAuthoritative",
|
|
@@ -11808,7 +11923,8 @@ var OPTIONAL_PROJECTION_FIELD_SET = new Set([
|
|
|
11808
11923
|
// ../protocol/src/notification-sounds.ts
|
|
11809
11924
|
var DEFAULT_NOTIFICATION_SOUND_SETTINGS = Object.freeze({
|
|
11810
11925
|
agentStopped: true,
|
|
11811
|
-
prMerged: true
|
|
11926
|
+
prMerged: true,
|
|
11927
|
+
coordinatorReport: true
|
|
11812
11928
|
});
|
|
11813
11929
|
|
|
11814
11930
|
// ../protocol/src/agent-settings.ts
|
|
@@ -12123,6 +12239,7 @@ var WORKFLOW_RESULT_KINDS = [
|
|
|
12123
12239
|
"fix-result",
|
|
12124
12240
|
"verification-result",
|
|
12125
12241
|
"pr-result",
|
|
12242
|
+
"subork-answer",
|
|
12126
12243
|
"graph-output",
|
|
12127
12244
|
"graph-template"
|
|
12128
12245
|
];
|
|
@@ -12138,7 +12255,8 @@ var WORKFLOW_RESULT_TOOL_NAMES = {
|
|
|
12138
12255
|
"verification-result": "submit_verification_result",
|
|
12139
12256
|
"pr-result": "submit_pr_result",
|
|
12140
12257
|
"graph-output": "submit_graph_output",
|
|
12141
|
-
"graph-template": "submit_graph_template"
|
|
12258
|
+
"graph-template": "submit_graph_template",
|
|
12259
|
+
"subork-answer": "submit_subork_answer"
|
|
12142
12260
|
};
|
|
12143
12261
|
var WORKFLOW_RESULT_VALIDATION_TOOL_NAME = "validate_workflow_result";
|
|
12144
12262
|
var GRAPH_PORT_SUBMIT_PREFIX = "submit_";
|
|
@@ -12408,6 +12526,8 @@ function buildFixPrompt(facts) {
|
|
|
12408
12526
|
"",
|
|
12409
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."),
|
|
12410
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
|
+
"",
|
|
12411
12531
|
"## 3. Draft the issue",
|
|
12412
12532
|
...BUG_REPORT_REDACTION_RULES,
|
|
12413
12533
|
"",
|
|
@@ -13158,8 +13278,8 @@ for (const definition of TICKET_SECTION_DEFINITIONS) {
|
|
|
13158
13278
|
KEY_BY_HEADING.set(normalizedHeading(alias), definition.key);
|
|
13159
13279
|
}
|
|
13160
13280
|
|
|
13161
|
-
// ../protocol/src/build-pipeline-address-report.ts
|
|
13162
|
-
var
|
|
13281
|
+
// ../protocol/src/build-pipeline-address-findings-report.ts
|
|
13282
|
+
var PIPELINE_ADDRESS_FINDINGS_RESULT_LIMITS = Object.freeze({
|
|
13163
13283
|
summaryLength: 4000,
|
|
13164
13284
|
filesChanged: 48,
|
|
13165
13285
|
pathLength: 300,
|
|
@@ -13419,7 +13539,7 @@ var BUILD_ACTION_INPUTS = Object.freeze({
|
|
|
13419
13539
|
type: "integer",
|
|
13420
13540
|
minimum: 1,
|
|
13421
13541
|
maximum: MAX_BUILD_PIPELINE_ITERATIONS,
|
|
13422
|
-
description: `Review,
|
|
13542
|
+
description: `Review, address findings, verify and rework rounds before the pipeline gives up, from 1 to ${MAX_BUILD_PIPELINE_ITERATIONS}. Omitted: 3.`
|
|
13423
13543
|
}
|
|
13424
13544
|
}, ["projectId", "ticketId"]),
|
|
13425
13545
|
examples: [
|
|
@@ -13491,8 +13611,8 @@ var AGENT_ACTIVITY_MAX_FUTURE_SKEW_MS = 5 * 60000;
|
|
|
13491
13611
|
var ACTIVITY_SORT_ORDERS = ["priority", "newest", "oldest"];
|
|
13492
13612
|
var ACTIVITY_ATTENTION_RANK = {
|
|
13493
13613
|
waiting: 0,
|
|
13494
|
-
|
|
13495
|
-
|
|
13614
|
+
idle: 1,
|
|
13615
|
+
working: 2
|
|
13496
13616
|
};
|
|
13497
13617
|
function parseTimestamp(value) {
|
|
13498
13618
|
if (!value)
|
|
@@ -13512,7 +13632,13 @@ function compareActivityTimestampsDesc(left, right) {
|
|
|
13512
13632
|
return 1;
|
|
13513
13633
|
return 0;
|
|
13514
13634
|
}
|
|
13635
|
+
function activityGroup({ activity, prState }) {
|
|
13636
|
+
return (prState === "merged" ? 2 : 0) + (activity === "working" ? 1 : 0);
|
|
13637
|
+
}
|
|
13515
13638
|
function compareEnvironmentsByActivity(left, right, order = "priority") {
|
|
13639
|
+
const group = activityGroup(left) - activityGroup(right);
|
|
13640
|
+
if (group !== 0)
|
|
13641
|
+
return group;
|
|
13516
13642
|
if (order === "priority") {
|
|
13517
13643
|
const unread = Number(right.hasUnreadWork === true) - Number(left.hasUnreadWork === true);
|
|
13518
13644
|
if (unread !== 0)
|
|
@@ -13590,7 +13716,8 @@ function sortEnvironmentsByActivity(environments, order) {
|
|
|
13590
13716
|
const fields = (environment) => ({
|
|
13591
13717
|
activity: AGENT_ACTIVITY_STATES.includes(environment.activity.state) ? environment.activity.state : null,
|
|
13592
13718
|
hasUnreadWork: environment.activity.hasUnreadWork,
|
|
13593
|
-
lastActivityAt: environment.lastActivityAt
|
|
13719
|
+
lastActivityAt: environment.lastActivityAt,
|
|
13720
|
+
prState: environment.pr.state
|
|
13594
13721
|
});
|
|
13595
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);
|
|
13596
13723
|
}
|
|
@@ -15071,23 +15198,35 @@ var workflowCommands = [
|
|
|
15071
15198
|
valueName: "SELECTION",
|
|
15072
15199
|
description: `Preparation and consolidation model: ${SELECTION_HELP}`
|
|
15073
15200
|
},
|
|
15201
|
+
{
|
|
15202
|
+
name: "address-findings-model",
|
|
15203
|
+
kind: "string",
|
|
15204
|
+
valueName: "SELECTION",
|
|
15205
|
+
description: `Address Findings model: ${SELECTION_HELP}`
|
|
15206
|
+
},
|
|
15074
15207
|
{
|
|
15075
15208
|
name: "fix-model",
|
|
15076
15209
|
kind: "string",
|
|
15077
15210
|
valueName: "SELECTION",
|
|
15078
|
-
description:
|
|
15211
|
+
description: "Former name of --address-findings-model."
|
|
15212
|
+
},
|
|
15213
|
+
{
|
|
15214
|
+
name: "auto-address-findings",
|
|
15215
|
+
kind: "boolean",
|
|
15216
|
+
negatable: true,
|
|
15217
|
+
description: "Start Address Findings when consolidation reports findings."
|
|
15079
15218
|
},
|
|
15080
15219
|
{
|
|
15081
15220
|
name: "auto-fix",
|
|
15082
15221
|
kind: "boolean",
|
|
15083
15222
|
negatable: true,
|
|
15084
|
-
description: "
|
|
15223
|
+
description: "Former name of --auto-address-findings."
|
|
15085
15224
|
},
|
|
15086
15225
|
{
|
|
15087
15226
|
name: "auto-pr",
|
|
15088
15227
|
kind: "boolean",
|
|
15089
15228
|
negatable: true,
|
|
15090
|
-
description: "Open the pull request after
|
|
15229
|
+
description: "Open the pull request after Address Findings (never merges)."
|
|
15091
15230
|
},
|
|
15092
15231
|
{
|
|
15093
15232
|
name: "target-branch",
|
|
@@ -15105,6 +15244,10 @@ var workflowCommands = [
|
|
|
15105
15244
|
],
|
|
15106
15245
|
inputFields: {
|
|
15107
15246
|
reviewer: "reviewers",
|
|
15247
|
+
"address-findings-model": "fixModel",
|
|
15248
|
+
"fix-model": "fixModel",
|
|
15249
|
+
"auto-address-findings": "autoFix",
|
|
15250
|
+
"auto-fix": "autoFix",
|
|
15108
15251
|
focus: "reviewers",
|
|
15109
15252
|
"focus-file": "reviewers",
|
|
15110
15253
|
"instruction-file": "reviewInstruction"
|
|
@@ -15119,8 +15262,9 @@ var workflowCommands = [
|
|
|
15119
15262
|
return lens ? { ...row, lens } : row;
|
|
15120
15263
|
});
|
|
15121
15264
|
const reviewModel = stringOption(options2, "review-model");
|
|
15122
|
-
const
|
|
15123
|
-
const
|
|
15265
|
+
const addressFindingsFlag = stringOption(options2, "address-findings-model") ? "--address-findings-model" : "--fix-model";
|
|
15266
|
+
const fixModel = stringOption(options2, "address-findings-model") ?? stringOption(options2, "fix-model");
|
|
15267
|
+
const autoFix = optionalBoolean(options2, "auto-address-findings") ?? optionalBoolean(options2, "auto-fix");
|
|
15124
15268
|
const autoPr = optionalBoolean(options2, "auto-pr");
|
|
15125
15269
|
const instructionFile = stringOption(options2, "instruction-file");
|
|
15126
15270
|
const reviewInstruction = instructionFile !== undefined ? await readTextSource(context.io, {
|
|
@@ -15134,7 +15278,7 @@ var workflowCommands = [
|
|
|
15134
15278
|
environmentId: parsed.positionals.environment,
|
|
15135
15279
|
...reviewers.length ? { reviewers } : {},
|
|
15136
15280
|
...reviewModel ? { reviewModel: parseSelection(reviewModel, "--review-model") } : {},
|
|
15137
|
-
...fixModel ? { fixModel: parseSelection(fixModel,
|
|
15281
|
+
...fixModel ? { fixModel: parseSelection(fixModel, addressFindingsFlag) } : {},
|
|
15138
15282
|
...autoFix !== undefined ? { autoFix } : {},
|
|
15139
15283
|
...autoPr !== undefined ? { autoPr } : {},
|
|
15140
15284
|
...options2["target-branch"] !== undefined ? { targetBranch: options2["target-branch"] } : {},
|
|
@@ -15204,17 +15348,25 @@ var workflowCommands = [
|
|
|
15204
15348
|
{
|
|
15205
15349
|
path: ["review", "open"],
|
|
15206
15350
|
action: "review.open",
|
|
15207
|
-
summary: "Open or focus a Multi Review's tab (--
|
|
15351
|
+
summary: "Open or focus a Multi Review's tab (--address-findings: its Address Findings tab); starts no work.",
|
|
15208
15352
|
positionals: [{ name: "workflow", required: true, description: "Multi Review ID." }],
|
|
15209
15353
|
options: [
|
|
15210
|
-
{
|
|
15354
|
+
{
|
|
15355
|
+
name: "address-findings",
|
|
15356
|
+
kind: "boolean",
|
|
15357
|
+
description: "Open the Address Findings session tab instead."
|
|
15358
|
+
},
|
|
15359
|
+
{ name: "fix", kind: "boolean", description: "Former name of --address-findings." },
|
|
15211
15360
|
REQUEST_ID_OPTION
|
|
15212
15361
|
],
|
|
15213
|
-
inputFields: { workflow: "workflowId", fix: "surface" },
|
|
15362
|
+
inputFields: { workflow: "workflowId", fix: "surface", "address-findings": "surface" },
|
|
15214
15363
|
idOutput: "workflow ID",
|
|
15215
15364
|
async run(context, parsed) {
|
|
15216
15365
|
const workflowId = parsed.positionals.workflow;
|
|
15217
|
-
const { session, result, receipt, warnings } = await submit(context, "review.open", {
|
|
15366
|
+
const { session, result, receipt, warnings } = await submit(context, "review.open", {
|
|
15367
|
+
workflowId,
|
|
15368
|
+
...parsed.options.fix === true || parsed.options["address-findings"] === true ? { surface: "fix" } : {}
|
|
15369
|
+
}, parsed.options);
|
|
15218
15370
|
return {
|
|
15219
15371
|
action: "review.open",
|
|
15220
15372
|
result,
|
|
@@ -15226,7 +15378,7 @@ var workflowCommands = [
|
|
|
15226
15378
|
};
|
|
15227
15379
|
}
|
|
15228
15380
|
},
|
|
15229
|
-
reviewMutation("address", "review.address", "Address a Multi Review's findings: hand them to its
|
|
15381
|
+
reviewMutation("address", "review.address", "Address a Multi Review's findings: hand them to its Address Findings session."),
|
|
15230
15382
|
reviewMutation("cancel", "review.cancel", "Cancel a running Multi Review; its record is kept."),
|
|
15231
15383
|
agentButtonCommand("review.start"),
|
|
15232
15384
|
agentButtonCommand("pr.create"),
|
|
@@ -15407,7 +15559,7 @@ var buildCommands = [
|
|
|
15407
15559
|
path: ["build", "launch"],
|
|
15408
15560
|
action: "build.launch",
|
|
15409
15561
|
summary: "Start a ticket's Build Pipeline, as the Build button does (its active build is reused).",
|
|
15410
|
-
description: "Builds the Kanban ticket in a new environment (--type) or an existing one (--environment): build, review, address, verify and PR. Omitted steps, reviewers and preparation use the saved Build defaults; a step named only by --instructions keeps its saved model. The pipeline continues in the backend; follow it with `build get`.",
|
|
15562
|
+
description: "Builds the Kanban ticket in a new environment (--type) or an existing one (--environment): build, review, address findings, verify and PR. Omitted steps, reviewers and preparation use the saved Build defaults; a step named only by --instructions keeps its saved model. The pipeline continues in the backend; follow it with `build get`.",
|
|
15411
15563
|
positionals: [
|
|
15412
15564
|
{ name: "ticket", required: true, description: "Kanban ticket ID (ticket list)." }
|
|
15413
15565
|
],
|
|
@@ -15453,7 +15605,7 @@ var buildCommands = [
|
|
|
15453
15605
|
name: "instructions",
|
|
15454
15606
|
kind: "list",
|
|
15455
15607
|
valueName: "STAGE=TEXT",
|
|
15456
|
-
description: `Your instructions for a step (repeatable), at most ${MAX_BUILD_STEP_INSTRUCTIONS_BYTES} bytes; N=TEXT for --reviewer row N.
|
|
15608
|
+
description: `Your instructions for a step (repeatable), at most ${MAX_BUILD_STEP_INSTRUCTIONS_BYTES} bytes; N=TEXT for --reviewer row N. Rework uses build's.`
|
|
15457
15609
|
},
|
|
15458
15610
|
{
|
|
15459
15611
|
name: "instructions-file",
|
|
@@ -15483,7 +15635,7 @@ var buildCommands = [
|
|
|
15483
15635
|
name: "max-iterations",
|
|
15484
15636
|
kind: "integer",
|
|
15485
15637
|
valueName: "N",
|
|
15486
|
-
description: `Review,
|
|
15638
|
+
description: `Review, address findings, verify and rework rounds, 1 to ${MAX_BUILD_PIPELINE_ITERATIONS} (default 3).`
|
|
15487
15639
|
},
|
|
15488
15640
|
REQUEST_ID_OPTION
|
|
15489
15641
|
],
|
|
@@ -15809,7 +15961,7 @@ function buildPipelineBuiltInTemplate() {
|
|
|
15809
15961
|
{
|
|
15810
15962
|
key: "builder",
|
|
15811
15963
|
label: "Build",
|
|
15812
|
-
description: "The pipeline's build agent.
|
|
15964
|
+
description: "The pipeline's build agent. Rework runs under Build's step and instructions.",
|
|
15813
15965
|
multiplicity: "one"
|
|
15814
15966
|
},
|
|
15815
15967
|
{
|
|
@@ -15827,7 +15979,12 @@ function buildPipelineBuiltInTemplate() {
|
|
|
15827
15979
|
maxPanel: MAX_BUILD_PIPELINE_REVIEWERS,
|
|
15828
15980
|
defaultsFrom: ["review", "review2", "additionalReviewers"]
|
|
15829
15981
|
},
|
|
15830
|
-
{
|
|
15982
|
+
{
|
|
15983
|
+
key: "fixer",
|
|
15984
|
+
label: "Address Findings",
|
|
15985
|
+
multiplicity: "one",
|
|
15986
|
+
defaultsFrom: ["fixReviewIssues"]
|
|
15987
|
+
},
|
|
15831
15988
|
{
|
|
15832
15989
|
key: "verifier",
|
|
15833
15990
|
label: "Verify",
|
|
@@ -15895,8 +16052,8 @@ function buildPipelineBuiltInTemplate() {
|
|
|
15895
16052
|
{
|
|
15896
16053
|
id: "fix",
|
|
15897
16054
|
kind: "agent",
|
|
15898
|
-
label: "
|
|
15899
|
-
description: "From round 2: fixes what Verify found unmet. Today a
|
|
16055
|
+
label: "Rework",
|
|
16056
|
+
description: "From round 2: fixes what Verify found unmet. Today a Rework that leaves the worktree unchanged pauses the pipeline for a person.",
|
|
15900
16057
|
role: "builder",
|
|
15901
16058
|
when: { path: "run.iteration", op: "gt", value: 1 },
|
|
15902
16059
|
capabilities: { profile: "builder" },
|
|
@@ -15982,7 +16139,7 @@ function buildPipelineBuiltInTemplate() {
|
|
|
15982
16139
|
id: "has-issues",
|
|
15983
16140
|
kind: "gate",
|
|
15984
16141
|
label: "Issues?",
|
|
15985
|
-
description: "Address only when the report has issues or test coverage gaps (D21).",
|
|
16142
|
+
description: "Address Findings only when the report has issues or test coverage gaps (D21).",
|
|
15986
16143
|
inputs: [
|
|
15987
16144
|
{ name: "report", type: "review-report@1" },
|
|
15988
16145
|
{ name: "code", type: "workspace@1" }
|
|
@@ -15995,7 +16152,7 @@ function buildPipelineBuiltInTemplate() {
|
|
|
15995
16152
|
{
|
|
15996
16153
|
id: "address",
|
|
15997
16154
|
kind: "agent",
|
|
15998
|
-
label: "Address",
|
|
16155
|
+
label: "Address Findings",
|
|
15999
16156
|
description: "Fixes the review's findings, validates the fix and submits a typed fix result for Verify. Today it also receives the end of the review session's transcript.",
|
|
16000
16157
|
role: "fixer",
|
|
16001
16158
|
capabilities: { profile: "builder" },
|
|
@@ -16393,7 +16550,7 @@ function roundNodes(round, allowance) {
|
|
|
16393
16550
|
{
|
|
16394
16551
|
id: ids.fix,
|
|
16395
16552
|
kind: "agent",
|
|
16396
|
-
label: `Round ${round} \xB7
|
|
16553
|
+
label: `Round ${round} \xB7 Address Findings`,
|
|
16397
16554
|
description: "Fixes the whole pool in a fresh session and commits.",
|
|
16398
16555
|
role: "model",
|
|
16399
16556
|
capabilities: { profile: "builder" },
|
|
@@ -16411,8 +16568,8 @@ function roundNodes(round, allowance) {
|
|
|
16411
16568
|
{
|
|
16412
16569
|
id: ids.fixed,
|
|
16413
16570
|
kind: "gate",
|
|
16414
|
-
label: `Round ${round} \xB7
|
|
16415
|
-
description: "An incomplete
|
|
16571
|
+
label: `Round ${round} \xB7 Address Findings complete?`,
|
|
16572
|
+
description: "An incomplete Address Findings failed the review; nothing runs after it.",
|
|
16416
16573
|
inputs: [
|
|
16417
16574
|
{ name: "result", type: "fix-result@1" },
|
|
16418
16575
|
{ name: "code", type: "workspace@1" }
|
|
@@ -16553,11 +16710,11 @@ function loopedReviewBuiltInTemplate() {
|
|
|
16553
16710
|
var MULTI_REVIEW_MAX_REVIEWERS = REVIEW_FANOUT_MAX_REVIEWERS;
|
|
16554
16711
|
var MULTI_REVIEW_PLAN_TOOL_PROHIBITION = "Do not invoke CreatePlan, create_plan, EnterPlanMode, or any equivalent planning or mode-switch tool, even if the provider offers one.";
|
|
16555
16712
|
var MULTI_REVIEW_IMPLEMENTATION_MODE_INSTRUCTION = `This is an implementation turn, not a planning turn. You are already in build mode: remain in build mode and begin editing the files now. Do not enter, propose, switch to, or imitate plan mode. ${MULTI_REVIEW_PLAN_TOOL_PROHIBITION} A plan, plan-review card, or approval request is not a valid response to this prompt. Do not ask the user to approve a plan or switch modes, and do not pause before implementation. Use the file-editing and command tools directly, complete the necessary edits, and run relevant validation in this turn.`;
|
|
16556
|
-
var MULTI_REVIEW_INTERACTIVE_RESPONSE_INSTRUCTION = "This is now a manual interactive
|
|
16713
|
+
var MULTI_REVIEW_INTERACTIVE_RESPONSE_INSTRUCTION = "This is now a manual interactive Address Findings conversation, not an automated pipeline stage. " + "Any JSON-only or structured-output contract from earlier turns has ended and does not apply to this turn or later replies. " + "Earlier review-stage instructions not to edit files, run commands, or fix findings have also ended and no longer apply. " + "Implement the requested fixes, run relevant validation, and commit every relevant change. " + `When you finish, respond in ordinary Markdown prose with a concise summary and validation results. Do not return JSON unless the user explicitly asks for JSON.
|
|
16557
16714
|
|
|
16558
16715
|
` + MULTI_REVIEW_IMPLEMENTATION_MODE_INSTRUCTION;
|
|
16559
16716
|
var MULTI_REVIEW_ADDRESS_USER_INSTRUCTION = "Please address all the issues and coverage gaps.";
|
|
16560
|
-
var
|
|
16717
|
+
var MULTI_REVIEW_ADDRESS_FINDINGS_PROMPT = `${MULTI_REVIEW_ADDRESS_USER_INSTRUCTION}
|
|
16561
16718
|
|
|
16562
16719
|
${wrapSystemInstructions(MULTI_REVIEW_INTERACTIVE_RESPONSE_INSTRUCTION)}`;
|
|
16563
16720
|
var MULTI_REVIEW_HISTORY_PAGE_MAX_TARGET_BYTES = 1024 * 1024;
|
|
@@ -16606,15 +16763,15 @@ function multiReviewBuiltInTemplate() {
|
|
|
16606
16763
|
parameters: [
|
|
16607
16764
|
{
|
|
16608
16765
|
key: "autoFix",
|
|
16609
|
-
label: "
|
|
16610
|
-
description: "Open
|
|
16766
|
+
label: "Address Findings automatically",
|
|
16767
|
+
description: "Open Address Findings once consolidation reports issues or test coverage gaps. Saved default: off.",
|
|
16611
16768
|
type: "boolean",
|
|
16612
16769
|
default: false
|
|
16613
16770
|
},
|
|
16614
16771
|
{
|
|
16615
16772
|
key: "autoPr",
|
|
16616
16773
|
label: "Open a pull request automatically",
|
|
16617
|
-
description: "Open the pull request after
|
|
16774
|
+
description: "Open the pull request after an Address Findings run that completes, or straight after a consolidated report with nothing to fix. Saved default: off.",
|
|
16618
16775
|
type: "boolean",
|
|
16619
16776
|
default: false
|
|
16620
16777
|
}
|
|
@@ -16643,7 +16800,7 @@ function multiReviewBuiltInTemplate() {
|
|
|
16643
16800
|
},
|
|
16644
16801
|
{
|
|
16645
16802
|
key: "fixer",
|
|
16646
|
-
label: "
|
|
16803
|
+
label: "Address Findings",
|
|
16647
16804
|
multiplicity: "one",
|
|
16648
16805
|
defaultsFrom: ["fixReviewIssues", "review"]
|
|
16649
16806
|
},
|
|
@@ -16683,7 +16840,7 @@ function multiReviewBuiltInTemplate() {
|
|
|
16683
16840
|
name: "fixed",
|
|
16684
16841
|
type: "workspace@1",
|
|
16685
16842
|
label: "Fixed branch",
|
|
16686
|
-
description: "
|
|
16843
|
+
description: "Address Findings's commit, when an Address Findings run ran and completed.",
|
|
16687
16844
|
required: false,
|
|
16688
16845
|
from: port("fix-complete", "code", "complete")
|
|
16689
16846
|
}
|
|
@@ -16766,8 +16923,8 @@ function multiReviewBuiltInTemplate() {
|
|
|
16766
16923
|
{
|
|
16767
16924
|
id: "fix",
|
|
16768
16925
|
kind: "agent",
|
|
16769
|
-
label: "
|
|
16770
|
-
description: "Today an ordinary interactive
|
|
16926
|
+
label: "Address Findings",
|
|
16927
|
+
description: "Today an ordinary interactive Address Findings tab that the user can talk to; it ends when its handoff turn finishes on its own. Here it submits a fix result.",
|
|
16771
16928
|
role: "fixer",
|
|
16772
16929
|
when: paramIsTrue("autoFix"),
|
|
16773
16930
|
capabilities: { profile: "builder" },
|
|
@@ -16786,8 +16943,8 @@ function multiReviewBuiltInTemplate() {
|
|
|
16786
16943
|
{
|
|
16787
16944
|
id: "fix-complete",
|
|
16788
16945
|
kind: "gate",
|
|
16789
|
-
label: "
|
|
16790
|
-
description: "Only proof that
|
|
16946
|
+
label: "Address Findings complete?",
|
|
16947
|
+
description: "Only proof that Address Findings completed queues the pull request.",
|
|
16791
16948
|
inputs: [
|
|
16792
16949
|
{ name: "result", type: "fix-result@1" },
|
|
16793
16950
|
{ name: "code", type: "workspace@1" }
|
|
@@ -17925,6 +18082,9 @@ function changesViewLines(view) {
|
|
|
17925
18082
|
if (files.nextCursor) {
|
|
17926
18083
|
lines.push("", `${files.rows.length} of ${files.totalRows ?? "?"} files shown; next page: --cursor ${files.nextCursor}`);
|
|
17927
18084
|
}
|
|
18085
|
+
if (files.omittedRows) {
|
|
18086
|
+
lines.push("", `${files.omittedRows} more changed files are not listed; the totals count them.`);
|
|
18087
|
+
}
|
|
17928
18088
|
return lines;
|
|
17929
18089
|
}
|
|
17930
18090
|
function changesHistoryLines(history) {
|
|
@@ -18031,6 +18191,133 @@ var changesCommands = [
|
|
|
18031
18191
|
}
|
|
18032
18192
|
];
|
|
18033
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
|
+
|
|
18034
18321
|
// src/client/commands/completion.ts
|
|
18035
18322
|
var SHELLS2 = ["bash", "zsh", "fish"];
|
|
18036
18323
|
function flagsOf(options2) {
|
|
@@ -18227,7 +18514,7 @@ function completionCommands(commands) {
|
|
|
18227
18514
|
}
|
|
18228
18515
|
|
|
18229
18516
|
// src/client/commands/connection.ts
|
|
18230
|
-
import
|
|
18517
|
+
import path13 from "path";
|
|
18231
18518
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
18232
18519
|
import { promises as fs5 } from "fs";
|
|
18233
18520
|
|
|
@@ -18307,6 +18594,7 @@ function parseBackendInstanceDescriptor(value) {
|
|
|
18307
18594
|
generation: text("generation", 200),
|
|
18308
18595
|
pid: value.pid,
|
|
18309
18596
|
startedAt: text("startedAt", 64),
|
|
18597
|
+
...value.processIdentity !== undefined ? { processIdentity: text("processIdentity", 128) } : {},
|
|
18310
18598
|
url: value.url,
|
|
18311
18599
|
...value.browserUrl !== undefined ? { browserUrl: value.browserUrl } : {},
|
|
18312
18600
|
...endpoints !== undefined ? { endpoints } : {},
|
|
@@ -18317,21 +18605,31 @@ function parseBackendInstanceDescriptor(value) {
|
|
|
18317
18605
|
publicApiSchemaVersion: value.publicApiSchemaVersion
|
|
18318
18606
|
};
|
|
18319
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
|
+
}
|
|
18320
18618
|
|
|
18321
18619
|
// src/client/receipts.ts
|
|
18322
|
-
import { createHash } from "crypto";
|
|
18620
|
+
import { createHash as createHash2 } from "crypto";
|
|
18323
18621
|
import { promises as fs3 } from "fs";
|
|
18324
|
-
import
|
|
18622
|
+
import path10 from "path";
|
|
18325
18623
|
var MAX_LOCAL_RECEIPTS_PER_INSTALLATION = 1000;
|
|
18326
18624
|
var MAX_RECEIPT_BYTES = 8 * 1024;
|
|
18327
18625
|
function receiptKey(action, requestId, node) {
|
|
18328
|
-
const hash =
|
|
18626
|
+
const hash = createHash2("sha256").update(action).update("\x00").update(requestId);
|
|
18329
18627
|
if (node)
|
|
18330
18628
|
hash.update("\x00node:").update(node);
|
|
18331
18629
|
return hash.digest("hex");
|
|
18332
18630
|
}
|
|
18333
18631
|
function safeSegment(value) {
|
|
18334
|
-
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");
|
|
18335
18633
|
}
|
|
18336
18634
|
|
|
18337
18635
|
class LocalReceiptStore {
|
|
@@ -18340,10 +18638,10 @@ class LocalReceiptStore {
|
|
|
18340
18638
|
this.root = root;
|
|
18341
18639
|
}
|
|
18342
18640
|
directory(installationId) {
|
|
18343
|
-
return
|
|
18641
|
+
return path10.join(this.root, safeSegment(installationId));
|
|
18344
18642
|
}
|
|
18345
18643
|
file(installationId, action, requestId, node) {
|
|
18346
|
-
return
|
|
18644
|
+
return path10.join(this.directory(installationId), `${receiptKey(action, requestId, node)}.json`);
|
|
18347
18645
|
}
|
|
18348
18646
|
async find(installationId, action, requestId, node) {
|
|
18349
18647
|
return this.readFile(this.file(installationId, action, requestId, node));
|
|
@@ -18367,14 +18665,14 @@ class LocalReceiptStore {
|
|
|
18367
18665
|
});
|
|
18368
18666
|
}
|
|
18369
18667
|
async list(installationId, limit = 50) {
|
|
18370
|
-
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));
|
|
18371
18669
|
const receipts = [];
|
|
18372
18670
|
for (const directory of directories) {
|
|
18373
18671
|
const names = await fs3.readdir(directory).catch(() => []);
|
|
18374
18672
|
for (const name of names) {
|
|
18375
18673
|
if (!name.endsWith(".json"))
|
|
18376
18674
|
continue;
|
|
18377
|
-
const receipt = await this.readFile(
|
|
18675
|
+
const receipt = await this.readFile(path10.join(directory, name));
|
|
18378
18676
|
if (receipt)
|
|
18379
18677
|
receipts.push(receipt);
|
|
18380
18678
|
}
|
|
@@ -18402,7 +18700,7 @@ class LocalReceiptStore {
|
|
|
18402
18700
|
if (names.length <= MAX_LOCAL_RECEIPTS_PER_INSTALLATION)
|
|
18403
18701
|
return;
|
|
18404
18702
|
const entries = await Promise.all(names.map(async (name) => {
|
|
18405
|
-
const file =
|
|
18703
|
+
const file = path10.join(directory, name);
|
|
18406
18704
|
const stat = await fs3.stat(file).catch(() => null);
|
|
18407
18705
|
return { file, mtime: stat?.mtimeMs ?? 0 };
|
|
18408
18706
|
}));
|
|
@@ -18416,7 +18714,7 @@ class LocalReceiptStore {
|
|
|
18416
18714
|
}
|
|
18417
18715
|
|
|
18418
18716
|
// src/client/session.ts
|
|
18419
|
-
import { createHash as
|
|
18717
|
+
import { createHash as createHash3, randomUUID as randomUUID2 } from "crypto";
|
|
18420
18718
|
|
|
18421
18719
|
// src/client/transport.ts
|
|
18422
18720
|
var DEFAULT_REQUEST_TIMEOUT_MS = 60000;
|
|
@@ -18644,7 +18942,7 @@ class ClientSession {
|
|
|
18644
18942
|
}
|
|
18645
18943
|
const installationId = capabilities.backend.installationId;
|
|
18646
18944
|
const key = requestId ?? `cli-${randomUUID2()}`;
|
|
18647
|
-
const intentDigest =
|
|
18945
|
+
const intentDigest = createHash3("sha256").update(canonicalJson({ action, input })).digest("hex");
|
|
18648
18946
|
const existing = await this.receipts.find(installationId, action, key, this.options.node);
|
|
18649
18947
|
if (existing && existing.intentDigest !== intentDigest) {
|
|
18650
18948
|
throw new CliError("request-conflict", "This saved request ID was used for a different intent", {
|
|
@@ -18770,12 +19068,12 @@ function quoteArgument(value) {
|
|
|
18770
19068
|
|
|
18771
19069
|
// src/client/targets.ts
|
|
18772
19070
|
import { constants as fsConstants, promises as fs4 } from "fs";
|
|
18773
|
-
import
|
|
19071
|
+
import path12 from "path";
|
|
18774
19072
|
import { isIPv4 } from "net";
|
|
18775
19073
|
|
|
18776
19074
|
// ../protocol/src/node/runtime-profile-status.ts
|
|
18777
19075
|
import os5 from "os";
|
|
18778
|
-
import
|
|
19076
|
+
import path11 from "path";
|
|
18779
19077
|
var RUNTIME_APP_SLUG = "orkestrator-v2";
|
|
18780
19078
|
var RUNTIME_STATUS_KEYS = new Set([
|
|
18781
19079
|
"version",
|
|
@@ -18819,27 +19117,107 @@ function normalizeRuntimeProfileId(value) {
|
|
|
18819
19117
|
}
|
|
18820
19118
|
function defaultRuntimeProfileRoots(platform = process.platform, env = process.env, homeDir = os5.homedir()) {
|
|
18821
19119
|
if (platform === "darwin") {
|
|
18822
|
-
const appSupport =
|
|
19120
|
+
const appSupport = path11.join(homeDir, "Library", "Application Support");
|
|
18823
19121
|
return {
|
|
18824
|
-
developmentRoot:
|
|
18825
|
-
productionDataDir:
|
|
19122
|
+
developmentRoot: path11.join(appSupport, `${RUNTIME_APP_SLUG}-dev`),
|
|
19123
|
+
productionDataDir: path11.join(appSupport, RUNTIME_APP_SLUG),
|
|
18826
19124
|
homeDir
|
|
18827
19125
|
};
|
|
18828
19126
|
}
|
|
18829
19127
|
if (platform === "win32") {
|
|
18830
19128
|
throw new Error("Orkestrator development profiles support macOS and Linux only");
|
|
18831
19129
|
}
|
|
18832
|
-
const configRoot = env.XDG_CONFIG_HOME ??
|
|
19130
|
+
const configRoot = env.XDG_CONFIG_HOME ?? path11.join(homeDir, ".config");
|
|
18833
19131
|
return {
|
|
18834
|
-
developmentRoot:
|
|
18835
|
-
productionDataDir:
|
|
19132
|
+
developmentRoot: path11.join(configRoot, `${RUNTIME_APP_SLUG}-dev`),
|
|
19133
|
+
productionDataDir: path11.join(configRoot, RUNTIME_APP_SLUG),
|
|
18836
19134
|
homeDir
|
|
18837
19135
|
};
|
|
18838
19136
|
}
|
|
18839
19137
|
function runtimeProfileStatusPath(developmentRoot, profileName) {
|
|
18840
19138
|
const id = normalizeRuntimeProfileId(profileName);
|
|
18841
|
-
const profileRoot =
|
|
18842
|
-
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
|
+
}
|
|
18843
19221
|
}
|
|
18844
19222
|
|
|
18845
19223
|
// src/client/targets.ts
|
|
@@ -18937,7 +19315,7 @@ async function readDescriptor(file, currentUid = process.getuid?.()) {
|
|
|
18937
19315
|
if (code !== "ENOENT") {
|
|
18938
19316
|
throw refuseDescriptor(file, `it could not be opened (${code ?? "unknown error"})`);
|
|
18939
19317
|
}
|
|
18940
|
-
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" } });
|
|
18941
19319
|
}
|
|
18942
19320
|
let text;
|
|
18943
19321
|
try {
|
|
@@ -18972,9 +19350,37 @@ function processIsAlive(pid) {
|
|
|
18972
19350
|
return false;
|
|
18973
19351
|
}
|
|
18974
19352
|
}
|
|
18975
|
-
|
|
18976
|
-
|
|
18977
|
-
|
|
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}`);
|
|
18978
19384
|
}
|
|
18979
19385
|
if (expectedInstallationId && descriptor.installationId !== expectedInstallationId) {
|
|
18980
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 } });
|
|
@@ -18989,7 +19395,12 @@ function descriptorTarget(name, kind, descriptor, expectedInstallationId, refres
|
|
|
18989
19395
|
generation: descriptor.generation
|
|
18990
19396
|
},
|
|
18991
19397
|
baseUrl,
|
|
18992
|
-
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
|
+
},
|
|
18993
19404
|
expectedInstallationId: descriptor.installationId,
|
|
18994
19405
|
descriptorGeneration: descriptor.generation,
|
|
18995
19406
|
refresh
|
|
@@ -19009,10 +19420,10 @@ async function resolveTarget(selection, store, env) {
|
|
|
19009
19420
|
}
|
|
19010
19421
|
return resolveSavedConnection(name, saved);
|
|
19011
19422
|
}
|
|
19012
|
-
async function resolveSavedConnection(name, saved) {
|
|
19423
|
+
async function resolveSavedConnection(name, saved, readStart = readProcessStartTime) {
|
|
19013
19424
|
if (saved.kind === "descriptor") {
|
|
19014
19425
|
const descriptor = await readDescriptor(saved.descriptorPath);
|
|
19015
|
-
return descriptorTarget(name, "connection", descriptor, saved.installationId, () => resolveSavedConnection(name, saved));
|
|
19426
|
+
return descriptorTarget(name, "connection", descriptor, saved.installationId, () => resolveSavedConnection(name, saved, readStart), readStart);
|
|
19016
19427
|
}
|
|
19017
19428
|
const baseUrl = normalizeBaseUrl(saved.url);
|
|
19018
19429
|
return {
|
|
@@ -19027,7 +19438,7 @@ async function resolveSavedConnection(name, saved) {
|
|
|
19027
19438
|
...saved.installationId ? { expectedInstallationId: saved.installationId } : {}
|
|
19028
19439
|
};
|
|
19029
19440
|
}
|
|
19030
|
-
async function resolveProfile(profileName, env) {
|
|
19441
|
+
async function resolveProfile(profileName, env, readStart = readProcessStartTime) {
|
|
19031
19442
|
let located;
|
|
19032
19443
|
try {
|
|
19033
19444
|
const developmentRoot = env.ORKESTRATOR_DEV_ROOT ?? defaultRuntimeProfileRoots(process.platform, env).developmentRoot;
|
|
@@ -19051,9 +19462,9 @@ async function resolveProfile(profileName, env) {
|
|
|
19051
19462
|
if (!backendPid || !processIsAlive(backendPid)) {
|
|
19052
19463
|
throw new CliError("profile-unavailable", `Profile '${located.id}' reports ready but its backend is not running (stale status)`);
|
|
19053
19464
|
}
|
|
19054
|
-
const refresh = () => resolveProfile(profileName, env);
|
|
19465
|
+
const refresh = () => resolveProfile(profileName, env, readStart);
|
|
19055
19466
|
if (manifest.dataDir) {
|
|
19056
|
-
const descriptorFile =
|
|
19467
|
+
const descriptorFile = path12.join(manifest.dataDir, BACKEND_INSTANCE_DESCRIPTOR_FILE);
|
|
19057
19468
|
const descriptor = await readDescriptor(descriptorFile).catch((error) => {
|
|
19058
19469
|
if (error instanceof CliError && error.details?.descriptor === "missing")
|
|
19059
19470
|
return null;
|
|
@@ -19063,7 +19474,7 @@ async function resolveProfile(profileName, env) {
|
|
|
19063
19474
|
if (descriptor.pid !== backendPid) {
|
|
19064
19475
|
throw new CliError("profile-unavailable", `Profile '${located.id}' has a descriptor from a different backend process`);
|
|
19065
19476
|
}
|
|
19066
|
-
return descriptorTarget(located.id, "profile", descriptor, undefined, refresh);
|
|
19477
|
+
return descriptorTarget(located.id, "profile", descriptor, undefined, refresh, readStart);
|
|
19067
19478
|
}
|
|
19068
19479
|
}
|
|
19069
19480
|
if (!manifest.browserUrl || !manifest.authFile) {
|
|
@@ -19086,7 +19497,7 @@ function store(context) {
|
|
|
19086
19497
|
async function removeManagedCredential(configStore, name, saved) {
|
|
19087
19498
|
if (saved?.kind !== "endpoint")
|
|
19088
19499
|
return;
|
|
19089
|
-
const legacyFile =
|
|
19500
|
+
const legacyFile = path13.join(configStore.credentialsDirectory, `${name}.json`);
|
|
19090
19501
|
if (saved.managedCredential !== true && saved.credentialFile !== legacyFile)
|
|
19091
19502
|
return;
|
|
19092
19503
|
await configStore.removeOwnedCredential(saved.credentialFile).catch(() => {
|
|
@@ -19246,7 +19657,7 @@ var connectionCommands = [
|
|
|
19246
19657
|
const normalizedUrl = normalizeBaseUrl(url);
|
|
19247
19658
|
let file;
|
|
19248
19659
|
if (credentialFile) {
|
|
19249
|
-
file =
|
|
19660
|
+
file = path13.resolve(context.io.cwd, credentialFile);
|
|
19250
19661
|
await readTokenFile(file, true);
|
|
19251
19662
|
} else {
|
|
19252
19663
|
const bytes = await context.io.readStdin(16 * 1024);
|
|
@@ -19265,7 +19676,7 @@ var connectionCommands = [
|
|
|
19265
19676
|
addedAt: now
|
|
19266
19677
|
};
|
|
19267
19678
|
} else {
|
|
19268
|
-
const descriptorPath =
|
|
19679
|
+
const descriptorPath = path13.resolve(context.io.cwd, descriptorOption ?? path13.join(dataDir, BACKEND_INSTANCE_DESCRIPTOR_FILE));
|
|
19269
19680
|
saved = { kind: "descriptor", descriptorPath, addedAt: now };
|
|
19270
19681
|
}
|
|
19271
19682
|
let checked = null;
|
|
@@ -21032,9 +21443,9 @@ var mailCommands = [
|
|
|
21032
21443
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
21033
21444
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
21034
21445
|
import { existsSync as existsSync6 } from "fs";
|
|
21035
|
-
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";
|
|
21036
21447
|
import { createServer } from "net";
|
|
21037
|
-
import
|
|
21448
|
+
import path17 from "path";
|
|
21038
21449
|
|
|
21039
21450
|
// ../../apps/backend/src/fixed-ports.ts
|
|
21040
21451
|
var DEFAULT_GATEWAY_PORT = 34121;
|
|
@@ -21042,10 +21453,10 @@ var DEFAULT_CONTROL_MCP_PORT = 34122;
|
|
|
21042
21453
|
|
|
21043
21454
|
// src/client/service-connection.ts
|
|
21044
21455
|
import { open } from "fs/promises";
|
|
21045
|
-
import
|
|
21456
|
+
import path14 from "path";
|
|
21046
21457
|
async function currentDescriptorGeneration(dataDir) {
|
|
21047
21458
|
try {
|
|
21048
|
-
return (await readDescriptor(
|
|
21459
|
+
return (await readDescriptor(path14.join(dataDir, BACKEND_INSTANCE_DESCRIPTOR_FILE))).generation;
|
|
21049
21460
|
} catch (error) {
|
|
21050
21461
|
if (isDescriptorRefusal(error))
|
|
21051
21462
|
throw error;
|
|
@@ -21080,12 +21491,12 @@ async function startupLogExcerpt(logFile, offset, version) {
|
|
|
21080
21491
|
return lines.slice(0, end).filter((line) => line.trim() !== "").slice(-LOG_EXCERPT_LINES).map((line) => line.slice(0, LOG_EXCERPT_MAX_LINE));
|
|
21081
21492
|
}
|
|
21082
21493
|
async function awaitServiceConnection(dataDir, previousGeneration, options2) {
|
|
21083
|
-
const file =
|
|
21494
|
+
const file = path14.join(dataDir, BACKEND_INSTANCE_DESCRIPTOR_FILE);
|
|
21084
21495
|
try {
|
|
21085
21496
|
const descriptor = await observe(async () => {
|
|
21086
21497
|
try {
|
|
21087
21498
|
const value = await readDescriptor(file);
|
|
21088
|
-
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;
|
|
21089
21500
|
if (fresh)
|
|
21090
21501
|
return { done: true, value };
|
|
21091
21502
|
} catch (error) {
|
|
@@ -21310,13 +21721,13 @@ Equivalent command, for scripts:
|
|
|
21310
21721
|
}
|
|
21311
21722
|
|
|
21312
21723
|
// src/client/service-units.ts
|
|
21313
|
-
import { createHash as
|
|
21724
|
+
import { createHash as createHash4 } from "crypto";
|
|
21314
21725
|
import os7 from "os";
|
|
21315
|
-
import
|
|
21726
|
+
import path15 from "path";
|
|
21316
21727
|
function suffix(dataDir, defaultDataDir) {
|
|
21317
|
-
if (
|
|
21728
|
+
if (path15.resolve(dataDir) === path15.resolve(defaultDataDir))
|
|
21318
21729
|
return "";
|
|
21319
|
-
return `-${
|
|
21730
|
+
return `-${createHash4("sha256").update(path15.resolve(dataDir)).digest("hex").slice(0, 8)}`;
|
|
21320
21731
|
}
|
|
21321
21732
|
function xml(text) {
|
|
21322
21733
|
return text.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
@@ -21335,7 +21746,7 @@ function serviceUnit(options2) {
|
|
|
21335
21746
|
return {
|
|
21336
21747
|
manager: "launchd",
|
|
21337
21748
|
name,
|
|
21338
|
-
file:
|
|
21749
|
+
file: path15.join(home, "Library", "LaunchAgents", `${name}.plist`),
|
|
21339
21750
|
contents: `<?xml version="1.0" encoding="UTF-8"?>
|
|
21340
21751
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
21341
21752
|
<plist version="1.0">
|
|
@@ -21369,13 +21780,13 @@ ${args}
|
|
|
21369
21780
|
};
|
|
21370
21781
|
}
|
|
21371
21782
|
const name = `orkestrator-backend${tag}.service`;
|
|
21372
|
-
const configHome = options2.env.XDG_CONFIG_HOME ??
|
|
21783
|
+
const configHome = options2.env.XDG_CONFIG_HOME ?? path15.join(home, ".config");
|
|
21373
21784
|
const xdgEnvironment = options2.env.XDG_CONFIG_HOME === undefined ? "" : `Environment=${systemdWord(`XDG_CONFIG_HOME=${options2.env.XDG_CONFIG_HOME}`)}
|
|
21374
21785
|
`;
|
|
21375
21786
|
return {
|
|
21376
21787
|
manager: "systemd",
|
|
21377
21788
|
name,
|
|
21378
|
-
file:
|
|
21789
|
+
file: path15.join(configHome, "systemd", "user", name),
|
|
21379
21790
|
contents: `[Unit]
|
|
21380
21791
|
Description=Orkestrator backend (${options2.dataDir})
|
|
21381
21792
|
After=network-online.target
|
|
@@ -21431,7 +21842,7 @@ var DATA_DIR_OPTION = {
|
|
|
21431
21842
|
var DEFAULT_READY_WAIT_MS = 3 * 60 * 1000;
|
|
21432
21843
|
var RESERVED_SERVE_FLAGS = new Set(["--data-dir", "--standalone-updater", "--desktop-updater"]);
|
|
21433
21844
|
function dataDirectory(context, parsed) {
|
|
21434
|
-
return
|
|
21845
|
+
return path17.resolve(stringOption(parsed.options, "data-dir") ?? context.io.env.ORKESTRATOR_DATA_DIR ?? defaultDataDir(process.platform, context.io.env));
|
|
21435
21846
|
}
|
|
21436
21847
|
function installCommandLine(parsed) {
|
|
21437
21848
|
const line = ["bunx", "orkestrator", "service", "install"];
|
|
@@ -21464,7 +21875,7 @@ function unitFor(context, dataDir, bun) {
|
|
|
21464
21875
|
defaultDataDir: defaultDataDir(process.platform, context.io.env),
|
|
21465
21876
|
bun,
|
|
21466
21877
|
launcher: layout.launcher,
|
|
21467
|
-
logFile:
|
|
21878
|
+
logFile: path17.join(layout.logs, "service.log"),
|
|
21468
21879
|
env: context.io.env
|
|
21469
21880
|
})
|
|
21470
21881
|
};
|
|
@@ -21672,10 +22083,10 @@ var serviceCommands = [
|
|
|
21672
22083
|
installedAt: new Date().toISOString()
|
|
21673
22084
|
});
|
|
21674
22085
|
await mkdir2(layout.logs, { recursive: true });
|
|
21675
|
-
await mkdir2(
|
|
21676
|
-
await
|
|
22086
|
+
await mkdir2(path17.dirname(unit.file), { recursive: true });
|
|
22087
|
+
await writeFile3(unit.file, unit.contents);
|
|
21677
22088
|
const started = parsed.options["skip-start"] !== true;
|
|
21678
|
-
const logFile =
|
|
22089
|
+
const logFile = path17.join(layout.logs, "service.log");
|
|
21679
22090
|
let connection = null;
|
|
21680
22091
|
if (started) {
|
|
21681
22092
|
const previousGeneration = await currentDescriptorGeneration(dataDir);
|
|
@@ -22988,9 +23399,9 @@ var ticketCommands = [
|
|
|
22988
23399
|
];
|
|
22989
23400
|
|
|
22990
23401
|
// src/client/commands/toolchain.ts
|
|
22991
|
-
import
|
|
23402
|
+
import path23 from "path";
|
|
22992
23403
|
function dataDirectory2(context, parsed) {
|
|
22993
|
-
return
|
|
23404
|
+
return path23.resolve(stringOption(parsed.options, "data-dir") ?? context.io.env.ORKESTRATOR_DATA_DIR ?? defaultDataDir(process.platform, context.io.env));
|
|
22994
23405
|
}
|
|
22995
23406
|
function requestedTools(parsed) {
|
|
22996
23407
|
const raw = parsed.options.tool;
|
|
@@ -23093,7 +23504,7 @@ var toolchainCommands = [
|
|
|
23093
23504
|
const rows = installed.tools.map((tool) => ({
|
|
23094
23505
|
tool,
|
|
23095
23506
|
version: installed.versions[tool] ?? "",
|
|
23096
|
-
executable:
|
|
23507
|
+
executable: path23.join(installed.currentBinDir, path23.basename(installed.executables[tool]))
|
|
23097
23508
|
}));
|
|
23098
23509
|
return {
|
|
23099
23510
|
action: "toolchain.install",
|
|
@@ -23867,7 +24278,8 @@ var GROUP_SUMMARIES = {
|
|
|
23867
24278
|
agent: "Discover agents, models and controls.",
|
|
23868
24279
|
session: "Start, prompt, control and inspect native-agent conversations.",
|
|
23869
24280
|
changes: "Read the file and line changes the backend measures (read-only).",
|
|
23870
|
-
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)."
|
|
23871
24283
|
};
|
|
23872
24284
|
function optionLine(option) {
|
|
23873
24285
|
const flag = `--${option.name}${option.kind === "boolean" ? "" : ` ${option.valueName ?? "VALUE"}`}`;
|
|
@@ -24234,6 +24646,7 @@ var CLIENT_COMMANDS = [
|
|
|
24234
24646
|
...runCommands,
|
|
24235
24647
|
...toolchainCommands,
|
|
24236
24648
|
...hostCommands,
|
|
24649
|
+
...diagnosticsCommands,
|
|
24237
24650
|
...serviceCommands,
|
|
24238
24651
|
...completionCommands(() => CLIENT_COMMANDS)
|
|
24239
24652
|
];
|