@integrity-labs/agt-cli 0.28.708 → 0.28.710
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/agt.js +5 -5
- package/dist/{chunk-7ZW4P5EU.js → chunk-FDI4N2HO.js} +4 -4
- package/dist/{chunk-NOGQSRQM.js → chunk-FM63TWR3.js} +28 -2
- package/dist/{chunk-NOGQSRQM.js.map → chunk-FM63TWR3.js.map} +1 -1
- package/dist/{chunk-VYG4CTEQ.js → chunk-SR2HUGEA.js} +58 -9
- package/dist/{chunk-VYG4CTEQ.js.map → chunk-SR2HUGEA.js.map} +1 -1
- package/dist/{claude-pair-runtime-CNS5OLQE.js → claude-pair-runtime-DWM6RNTP.js} +2 -2
- package/dist/lib/manager-worker.js +194 -73
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/{persistent-session-GIRGRUMF.js → persistent-session-IMWW6DLZ.js} +3 -3
- package/dist/{responsiveness-probe-PIRS3LTX.js → responsiveness-probe-34KFMMAC.js} +3 -3
- package/dist/{session-auth-dead-PYWTMI43.js → session-auth-dead-OAOR7OS4.js} +2 -2
- package/package.json +1 -1
- /package/dist/{chunk-7ZW4P5EU.js.map → chunk-FDI4N2HO.js.map} +0 -0
- /package/dist/{claude-pair-runtime-CNS5OLQE.js.map → claude-pair-runtime-DWM6RNTP.js.map} +0 -0
- /package/dist/{persistent-session-GIRGRUMF.js.map → persistent-session-IMWW6DLZ.js.map} +0 -0
- /package/dist/{responsiveness-probe-PIRS3LTX.js.map → responsiveness-probe-34KFMMAC.js.map} +0 -0
- /package/dist/{session-auth-dead-PYWTMI43.js.map → session-auth-dead-OAOR7OS4.js.map} +0 -0
|
@@ -100,7 +100,7 @@ async function spawnPairSession(session) {
|
|
|
100
100
|
return { ok: true };
|
|
101
101
|
} catch {
|
|
102
102
|
}
|
|
103
|
-
const { resolveClaudeBinary } = await import("./persistent-session-
|
|
103
|
+
const { resolveClaudeBinary } = await import("./persistent-session-IMWW6DLZ.js");
|
|
104
104
|
const claudeBin = resolveClaudeBinary();
|
|
105
105
|
const pairEnv = {
|
|
106
106
|
...process.env,
|
|
@@ -373,4 +373,4 @@ export {
|
|
|
373
373
|
startClaudePair,
|
|
374
374
|
submitClaudePairCode
|
|
375
375
|
};
|
|
376
|
-
//# sourceMappingURL=claude-pair-runtime-
|
|
376
|
+
//# sourceMappingURL=claude-pair-runtime-DWM6RNTP.js.map
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
safeWriteJsonAtomic,
|
|
55
55
|
setConfigHash,
|
|
56
56
|
tripClass
|
|
57
|
-
} from "../chunk-
|
|
57
|
+
} from "../chunk-FDI4N2HO.js";
|
|
58
58
|
import {
|
|
59
59
|
getProjectDir as getProjectDir2,
|
|
60
60
|
getReadyTasks,
|
|
@@ -112,7 +112,7 @@ import {
|
|
|
112
112
|
takeZombieDetection,
|
|
113
113
|
toOpencodeModel,
|
|
114
114
|
writeEgressAllowlist
|
|
115
|
-
} from "../chunk-
|
|
115
|
+
} from "../chunk-SR2HUGEA.js";
|
|
116
116
|
import {
|
|
117
117
|
ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
|
|
118
118
|
AnchorSessionClient,
|
|
@@ -186,6 +186,7 @@ import {
|
|
|
186
186
|
parseUsageReport,
|
|
187
187
|
peekCurrentSession,
|
|
188
188
|
pickNewerClassification,
|
|
189
|
+
readDailySessionPin,
|
|
189
190
|
remoteMcpServerKey,
|
|
190
191
|
resolveAgentTimezone,
|
|
191
192
|
resolveAvatarEnvUrl,
|
|
@@ -197,7 +198,7 @@ import {
|
|
|
197
198
|
subagentActivityAgeSeconds,
|
|
198
199
|
sumTranscriptUsageInWindow,
|
|
199
200
|
transcriptActivityAgeSeconds
|
|
200
|
-
} from "../chunk-
|
|
201
|
+
} from "../chunk-FM63TWR3.js";
|
|
201
202
|
import {
|
|
202
203
|
reapOrphanChannelMcps
|
|
203
204
|
} from "../chunk-XWVM4KPK.js";
|
|
@@ -230,7 +231,7 @@ function defaultUnique() {
|
|
|
230
231
|
|
|
231
232
|
// src/lib/manager-worker.ts
|
|
232
233
|
import { execFileSync as syncExecFile } from "child_process";
|
|
233
|
-
import { join as join39, dirname as
|
|
234
|
+
import { join as join39, dirname as dirname11, delimiter as pathDelimiter } from "path";
|
|
234
235
|
import { homedir as homedir18 } from "os";
|
|
235
236
|
import { fileURLToPath } from "url";
|
|
236
237
|
|
|
@@ -301,7 +302,7 @@ function claudeCodeUpgradeThrottled() {
|
|
|
301
302
|
// src/lib/drain-transcript-flush.ts
|
|
302
303
|
import { existsSync, readdirSync } from "fs";
|
|
303
304
|
import { homedir as homedir2 } from "os";
|
|
304
|
-
import { join as join3, relative, sep } from "path";
|
|
305
|
+
import { dirname as dirname3, join as join3, relative, sep } from "path";
|
|
305
306
|
import { spawn } from "child_process";
|
|
306
307
|
|
|
307
308
|
// src/lib/host-archive-address.ts
|
|
@@ -349,6 +350,8 @@ function sessionsBaseDir() {
|
|
|
349
350
|
}
|
|
350
351
|
var PER_FILE_UPLOAD_TIMEOUT_MS = 3e4;
|
|
351
352
|
var UPLOAD_CONCURRENCY = 4;
|
|
353
|
+
var DRAIN_MANIFEST_VERSION = 1;
|
|
354
|
+
var DRAIN_MANIFEST_FILENAME = "_augmented-drain-manifest.json";
|
|
352
355
|
function listJsonlFiles(dir) {
|
|
353
356
|
if (!existsSync(dir)) return [];
|
|
354
357
|
const out = [];
|
|
@@ -370,22 +373,41 @@ function transcriptObjectKey(keyPrefix, baseDir, file) {
|
|
|
370
373
|
if (!rel || rel.startsWith("../") || rel === "..") return null;
|
|
371
374
|
return `${keyPrefix.replace(/\/+$/, "")}/${rel}`;
|
|
372
375
|
}
|
|
376
|
+
function drainManifestObjectKey(keyPrefix, baseDir, transcriptDir) {
|
|
377
|
+
return transcriptObjectKey(keyPrefix, baseDir, join3(transcriptDir, DRAIN_MANIFEST_FILENAME));
|
|
378
|
+
}
|
|
373
379
|
async function flushAgentTranscriptsOnDrain(codeName, deps) {
|
|
374
380
|
const dir = deps.resolveTranscriptDir(codeName);
|
|
375
381
|
const files = deps.listTranscripts(dir);
|
|
376
382
|
if (files.length === 0) {
|
|
377
|
-
return {
|
|
383
|
+
return {
|
|
384
|
+
status: "no-transcripts",
|
|
385
|
+
uploaded: 0,
|
|
386
|
+
failed: 0,
|
|
387
|
+
total: 0,
|
|
388
|
+
manifest: "skipped",
|
|
389
|
+
manifestKey: null
|
|
390
|
+
};
|
|
378
391
|
}
|
|
379
392
|
const address = deps.readAddress();
|
|
380
393
|
if (!address || !address.bucket || !address.keyPrefix) {
|
|
381
394
|
deps.log(
|
|
382
395
|
`[drain-flush] NO S3 ADDRESS for '${codeName}' \u2014 ${files.length} transcript file(s) will NOT be shipped before teardown; this session may be lost (ENG-9491). The host archive address is unresolved (agt-session-archiver has published none).`
|
|
383
396
|
);
|
|
384
|
-
return {
|
|
397
|
+
return {
|
|
398
|
+
status: "no-address",
|
|
399
|
+
uploaded: 0,
|
|
400
|
+
failed: files.length,
|
|
401
|
+
total: files.length,
|
|
402
|
+
manifest: "skipped",
|
|
403
|
+
manifestKey: null
|
|
404
|
+
};
|
|
385
405
|
}
|
|
386
406
|
const { bucket, keyPrefix, region } = address;
|
|
387
407
|
let uploaded = 0;
|
|
388
408
|
let failed = 0;
|
|
409
|
+
const keys = [];
|
|
410
|
+
const missing = [];
|
|
389
411
|
let cursor = 0;
|
|
390
412
|
const worker = async () => {
|
|
391
413
|
for (; ; ) {
|
|
@@ -396,6 +418,7 @@ async function flushAgentTranscriptsOnDrain(codeName, deps) {
|
|
|
396
418
|
const key = transcriptObjectKey(keyPrefix, deps.baseDir, file);
|
|
397
419
|
if (!key) {
|
|
398
420
|
failed += 1;
|
|
421
|
+
missing.push(file);
|
|
399
422
|
deps.log(
|
|
400
423
|
`[drain-flush] SKIP '${file}' for '${codeName}' \u2014 outside sessions base dir '${deps.baseDir}', cannot key it (ENG-9491)`
|
|
401
424
|
);
|
|
@@ -404,8 +427,10 @@ async function flushAgentTranscriptsOnDrain(codeName, deps) {
|
|
|
404
427
|
const res = await deps.uploadFile({ file, bucket, key, region });
|
|
405
428
|
if (res.ok) {
|
|
406
429
|
uploaded += 1;
|
|
430
|
+
keys.push(key);
|
|
407
431
|
} else {
|
|
408
432
|
failed += 1;
|
|
433
|
+
missing.push(file);
|
|
409
434
|
deps.log(
|
|
410
435
|
`[drain-flush] UPLOAD FAILED for '${codeName}' '${file}' \u2192 s3://${bucket}/${key}: ${res.detail} (ENG-9491)`
|
|
411
436
|
);
|
|
@@ -415,13 +440,77 @@ async function flushAgentTranscriptsOnDrain(codeName, deps) {
|
|
|
415
440
|
await Promise.all(
|
|
416
441
|
Array.from({ length: Math.min(UPLOAD_CONCURRENCY, files.length) }, () => worker())
|
|
417
442
|
);
|
|
418
|
-
const
|
|
419
|
-
if (
|
|
443
|
+
const uploadStatus = failed === 0 ? "flushed" : uploaded === 0 ? "failed" : "partial";
|
|
444
|
+
if (uploadStatus !== "flushed") {
|
|
420
445
|
deps.log(
|
|
421
446
|
`[drain-flush] INCOMPLETE for '${codeName}': ${uploaded}/${files.length} transcript file(s) shipped, ${failed} FAILED before teardown \u2014 session data may be lost (ENG-9491).`
|
|
422
447
|
);
|
|
423
448
|
}
|
|
424
|
-
|
|
449
|
+
const { manifest, manifestKey } = await writeDrainManifest(codeName, deps, {
|
|
450
|
+
bucket,
|
|
451
|
+
keyPrefix,
|
|
452
|
+
region,
|
|
453
|
+
transcriptDir: dir,
|
|
454
|
+
keys,
|
|
455
|
+
missing,
|
|
456
|
+
complete: failed === 0
|
|
457
|
+
});
|
|
458
|
+
const status = uploadStatus === "flushed" && manifest !== "written" ? "no-manifest" : uploadStatus;
|
|
459
|
+
return { status, uploaded, failed, total: files.length, manifest, manifestKey };
|
|
460
|
+
}
|
|
461
|
+
async function writeDrainManifest(codeName, deps, ctx) {
|
|
462
|
+
const manifestKey = drainManifestObjectKey(ctx.keyPrefix, deps.baseDir, ctx.transcriptDir);
|
|
463
|
+
if (!manifestKey) {
|
|
464
|
+
deps.log(
|
|
465
|
+
`[drain-flush] NO MANIFEST for '${codeName}' \u2014 transcript dir '${ctx.transcriptDir}' is outside sessions base dir '${deps.baseDir}', so no manifest key could be computed. Any shipped object is UNRESTORABLE: nothing records the session pin or the source layout (ENG-9566).`
|
|
466
|
+
);
|
|
467
|
+
return { manifest: "unkeyable", manifestKey: null };
|
|
468
|
+
}
|
|
469
|
+
let layout = null;
|
|
470
|
+
try {
|
|
471
|
+
layout = deps.readSourceLayout(codeName);
|
|
472
|
+
} catch (err) {
|
|
473
|
+
deps.log(
|
|
474
|
+
`[drain-flush] could not resolve source layout for '${codeName}': ${err.message} \u2014 manifest will record it as unknown (ENG-9566)`
|
|
475
|
+
);
|
|
476
|
+
}
|
|
477
|
+
let sessionPin = null;
|
|
478
|
+
try {
|
|
479
|
+
sessionPin = deps.readSessionPin(codeName);
|
|
480
|
+
} catch (err) {
|
|
481
|
+
deps.log(
|
|
482
|
+
`[drain-flush] could not read the session pin for '${codeName}': ${err.message} \u2014 a restore will not be able to identify the live conversation (ENG-9566)`
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
const manifestBody = {
|
|
486
|
+
version: DRAIN_MANIFEST_VERSION,
|
|
487
|
+
codeName,
|
|
488
|
+
writtenAt: deps.now().toISOString(),
|
|
489
|
+
sourceLayout: layout?.layout ?? null,
|
|
490
|
+
sourceAgentDir: layout?.agentDir ?? null,
|
|
491
|
+
sourceTranscriptDir: ctx.transcriptDir,
|
|
492
|
+
sourceBaseDir: deps.baseDir,
|
|
493
|
+
bucket: ctx.bucket,
|
|
494
|
+
keyPrefix: ctx.keyPrefix,
|
|
495
|
+
keys: ctx.keys,
|
|
496
|
+
missing: ctx.missing,
|
|
497
|
+
complete: ctx.complete,
|
|
498
|
+
sessionPin
|
|
499
|
+
};
|
|
500
|
+
const res = await deps.uploadManifest({
|
|
501
|
+
body: `${JSON.stringify(manifestBody, null, 2)}
|
|
502
|
+
`,
|
|
503
|
+
bucket: ctx.bucket,
|
|
504
|
+
key: manifestKey,
|
|
505
|
+
region: ctx.region
|
|
506
|
+
});
|
|
507
|
+
if (!res.ok) {
|
|
508
|
+
deps.log(
|
|
509
|
+
`[drain-flush] MANIFEST UPLOAD FAILED for '${codeName}' \u2192 s3://${ctx.bucket}/${manifestKey}: ${res.detail}. ${ctx.keys.length} shipped object(s) are UNRESTORABLE without it (ENG-9566).`
|
|
510
|
+
);
|
|
511
|
+
return { manifest: "failed", manifestKey: null };
|
|
512
|
+
}
|
|
513
|
+
return { manifest: "written", manifestKey };
|
|
425
514
|
}
|
|
426
515
|
function drainTranscriptFlushDeps(log2) {
|
|
427
516
|
return {
|
|
@@ -429,36 +518,68 @@ function drainTranscriptFlushDeps(log2) {
|
|
|
429
518
|
readAddress: () => readHostArchiveAddress(),
|
|
430
519
|
listTranscripts: listJsonlFiles,
|
|
431
520
|
baseDir: sessionsBaseDir(),
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
child.on(
|
|
453
|
-
"close",
|
|
454
|
-
(code) => finish(
|
|
455
|
-
code === 0 ? { ok: true, detail: "" } : { ok: false, detail: stderr.trim().slice(0, 500) || `aws exited with code ${code ?? "null"}` }
|
|
456
|
-
)
|
|
457
|
-
);
|
|
458
|
-
}),
|
|
521
|
+
now: () => /* @__PURE__ */ new Date(),
|
|
522
|
+
// ENG-9566: derive the layout from the seam's OUTPUT rather than re-running
|
|
523
|
+
// its lstat. getProjectDir already resolved the codename symlink (or didn't);
|
|
524
|
+
// if what came back is not under the codename dir, this host is id-keyed.
|
|
525
|
+
// Observing the resolver keeps a second copy of ADR-0049's rule out of the
|
|
526
|
+
// tree — the thing host-archive-address.ts's header warns about.
|
|
527
|
+
readSourceLayout: (codeName) => {
|
|
528
|
+
const agentDir = dirname3(getProjectDir(codeName));
|
|
529
|
+
const codeNameDir = join3(homedir2(), ".augmented", codeName);
|
|
530
|
+
return { layout: agentDir === codeNameDir ? "codename-keyed" : "id-keyed", agentDir };
|
|
531
|
+
},
|
|
532
|
+
readSessionPin: (codeName) => readDailySessionPin(codeName),
|
|
533
|
+
uploadFile: ({ file, bucket, key, region }) => runAwsCp(awsCpArgs(file, bucket, key, region), null),
|
|
534
|
+
uploadManifest: ({ body, bucket, key, region }) => (
|
|
535
|
+
// `-` is `aws s3 cp`'s stdin source, so the manifest never touches disk.
|
|
536
|
+
runAwsCp(
|
|
537
|
+
[...awsCpArgs("-", bucket, key, region), "--content-type", "application/json"],
|
|
538
|
+
body
|
|
539
|
+
)
|
|
540
|
+
),
|
|
459
541
|
log: log2
|
|
460
542
|
};
|
|
461
543
|
}
|
|
544
|
+
function awsCpArgs(source, bucket, key, region) {
|
|
545
|
+
const args = ["s3", "cp", source, `s3://${bucket}/${key}`, "--only-show-errors"];
|
|
546
|
+
if (region) args.push("--region", region);
|
|
547
|
+
return args;
|
|
548
|
+
}
|
|
549
|
+
function runAwsCp(args, body) {
|
|
550
|
+
return new Promise((resolve2) => {
|
|
551
|
+
const child = spawn("aws", args, {
|
|
552
|
+
stdio: [body === null ? "ignore" : "pipe", "ignore", "pipe"]
|
|
553
|
+
});
|
|
554
|
+
let stderr = "";
|
|
555
|
+
let settled = false;
|
|
556
|
+
const finish = (r) => {
|
|
557
|
+
if (settled) return;
|
|
558
|
+
settled = true;
|
|
559
|
+
clearTimeout(timer3);
|
|
560
|
+
resolve2(r);
|
|
561
|
+
};
|
|
562
|
+
const timer3 = setTimeout(() => {
|
|
563
|
+
child.kill("SIGKILL");
|
|
564
|
+
finish({ ok: false, detail: `aws s3 cp timed out after ${PER_FILE_UPLOAD_TIMEOUT_MS}ms` });
|
|
565
|
+
}, PER_FILE_UPLOAD_TIMEOUT_MS);
|
|
566
|
+
child.stderr?.on("data", (d) => {
|
|
567
|
+
stderr += String(d);
|
|
568
|
+
});
|
|
569
|
+
child.on("error", (err) => finish({ ok: false, detail: err.message }));
|
|
570
|
+
child.on(
|
|
571
|
+
"close",
|
|
572
|
+
(code) => finish(
|
|
573
|
+
code === 0 ? { ok: true, detail: "" } : { ok: false, detail: stderr.trim().slice(0, 500) || `aws exited with code ${code ?? "null"}` }
|
|
574
|
+
)
|
|
575
|
+
);
|
|
576
|
+
if (body !== null) {
|
|
577
|
+
child.stdin?.on("error", () => {
|
|
578
|
+
});
|
|
579
|
+
child.stdin?.end(body);
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
}
|
|
462
583
|
|
|
463
584
|
// src/lib/mcp-config-drift.ts
|
|
464
585
|
import { createHash } from "crypto";
|
|
@@ -887,7 +1008,7 @@ function isSlackBehaviourRestrictive(subset) {
|
|
|
887
1008
|
|
|
888
1009
|
// src/lib/onboarding-drive.ts
|
|
889
1010
|
import { mkdirSync as mkdirSync2, readFileSync as readFileSync3, rmSync, writeFileSync as writeFileSync2 } from "fs";
|
|
890
|
-
import { dirname as
|
|
1011
|
+
import { dirname as dirname4 } from "path";
|
|
891
1012
|
var ONBOARDING_REINJECT_INTERVAL_MS = 45 * 6e4;
|
|
892
1013
|
var ONBOARDING_MAX_NUDGES = 3;
|
|
893
1014
|
var ONBOARDING_MIN_STANDDOWN_AGE_MS = 60 * 6e4;
|
|
@@ -1038,7 +1159,7 @@ function readOnboardingDriveMarker(path) {
|
|
|
1038
1159
|
return null;
|
|
1039
1160
|
}
|
|
1040
1161
|
function writeOnboardingDriveMarker(path, marker) {
|
|
1041
|
-
mkdirSync2(
|
|
1162
|
+
mkdirSync2(dirname4(path), { recursive: true });
|
|
1042
1163
|
writeFileSync2(path, JSON.stringify(marker) + "\n", "utf8");
|
|
1043
1164
|
}
|
|
1044
1165
|
function clearOnboardingDriveMarker(path) {
|
|
@@ -1894,7 +2015,7 @@ function formatMissingMcpBundles(missing) {
|
|
|
1894
2015
|
|
|
1895
2016
|
// src/lib/self-update-coalesce.ts
|
|
1896
2017
|
import { readFileSync as readFileSync7, writeFileSync as writeFileSync4, mkdirSync as mkdirSync3 } from "fs";
|
|
1897
|
-
import { dirname as
|
|
2018
|
+
import { dirname as dirname5 } from "path";
|
|
1898
2019
|
var DEFAULT_SELF_UPDATE_COALESCE_MS = 30 * 60 * 1e3;
|
|
1899
2020
|
function resolveCoalesceWindowMs(env = process.env) {
|
|
1900
2021
|
const raw = env.AGT_SELF_UPDATE_COALESCE_MS;
|
|
@@ -1916,7 +2037,7 @@ function readLastSelfUpdateAppliedMs(markerPath, now = Date.now(), read = (p) =>
|
|
|
1916
2037
|
return v;
|
|
1917
2038
|
}
|
|
1918
2039
|
function stampLastSelfUpdateApplied(markerPath, now = Date.now(), write = (p, v) => {
|
|
1919
|
-
mkdirSync3(
|
|
2040
|
+
mkdirSync3(dirname5(p), { recursive: true });
|
|
1920
2041
|
writeFileSync4(p, v);
|
|
1921
2042
|
}) {
|
|
1922
2043
|
try {
|
|
@@ -2850,7 +2971,7 @@ async function maybePollHostUsage(deps) {
|
|
|
2850
2971
|
import { createHash as createHash6 } from "crypto";
|
|
2851
2972
|
import { readFile as readFile3, readdir as readdir3 } from "fs/promises";
|
|
2852
2973
|
import { homedir as homedir7, platform as platform2 } from "os";
|
|
2853
|
-
import { dirname as
|
|
2974
|
+
import { dirname as dirname6, join as join13 } from "path";
|
|
2854
2975
|
|
|
2855
2976
|
// src/lib/claude-auth-detect.ts
|
|
2856
2977
|
import { readFile as readFile2, readdir as readdir2 } from "fs/promises";
|
|
@@ -2974,7 +3095,7 @@ async function homeOfActiveCredentials() {
|
|
|
2974
3095
|
for (const path of await findClaudeCredentialsPaths()) {
|
|
2975
3096
|
try {
|
|
2976
3097
|
await readFile3(path, "utf-8");
|
|
2977
|
-
return
|
|
3098
|
+
return dirname6(dirname6(path));
|
|
2978
3099
|
} catch {
|
|
2979
3100
|
}
|
|
2980
3101
|
}
|
|
@@ -4178,7 +4299,7 @@ function loggingModeWithholdsTargets(reading) {
|
|
|
4178
4299
|
import { randomBytes } from "crypto";
|
|
4179
4300
|
import { existsSync as existsSync4, mkdirSync as mkdirSync5, readFileSync as readFileSync14, renameSync as renameSync4, unlinkSync as unlinkSync2, writeFileSync as writeFileSync7 } from "fs";
|
|
4180
4301
|
import { homedir as homedir10 } from "os";
|
|
4181
|
-
import { dirname as
|
|
4302
|
+
import { dirname as dirname7, join as join19 } from "path";
|
|
4182
4303
|
var SALT_BYTES = 32;
|
|
4183
4304
|
var SALT_RE = /^[0-9a-f]{64}$/;
|
|
4184
4305
|
function pathSaltPath(codeName, homeDir) {
|
|
@@ -4203,7 +4324,7 @@ function readToolCallPathSalt(codeName, homeDir) {
|
|
|
4203
4324
|
const salt = randomBytes(SALT_BYTES).toString("hex");
|
|
4204
4325
|
const tmp = `${file}.tmp.${process.pid}`;
|
|
4205
4326
|
try {
|
|
4206
|
-
mkdirSync5(
|
|
4327
|
+
mkdirSync5(dirname7(file), { recursive: true, mode: 448 });
|
|
4207
4328
|
writeFileSync7(tmp, `${salt}
|
|
4208
4329
|
`, { encoding: "utf-8", mode: 384 });
|
|
4209
4330
|
renameSync4(tmp, file);
|
|
@@ -6044,7 +6165,7 @@ function removeIntegrationSkillFolder(opts) {
|
|
|
6044
6165
|
|
|
6045
6166
|
// src/lib/manager/managed-skill-manifest.ts
|
|
6046
6167
|
import { existsSync as existsSync10, mkdirSync as mkdirSync6, readFileSync as readFileSync21, writeFileSync as writeFileSync9 } from "fs";
|
|
6047
|
-
import { dirname as
|
|
6168
|
+
import { dirname as dirname8, join as join28 } from "path";
|
|
6048
6169
|
var MANIFEST_VERSION = 1;
|
|
6049
6170
|
function managedSkillManifestPath(agentRootDir) {
|
|
6050
6171
|
return join28(agentRootDir, "managed-skills.json");
|
|
@@ -6061,7 +6182,7 @@ function readManagedSkillManifest(path) {
|
|
|
6061
6182
|
}
|
|
6062
6183
|
function writeManagedSkillManifest(path, ids) {
|
|
6063
6184
|
try {
|
|
6064
|
-
mkdirSync6(
|
|
6185
|
+
mkdirSync6(dirname8(path), { recursive: true });
|
|
6065
6186
|
const body = {
|
|
6066
6187
|
version: MANIFEST_VERSION,
|
|
6067
6188
|
globalSkillIds: [...ids].sort()
|
|
@@ -7207,7 +7328,7 @@ function closeSessionRunForCode(codeName, outcome, reason) {
|
|
|
7207
7328
|
import { createHash as createHash12 } from "crypto";
|
|
7208
7329
|
import { writeFileSync as writeFileSync11, renameSync as renameSync5, mkdirSync as mkdirSync7, readFileSync as readFileSync24, unlinkSync as unlinkSync3 } from "fs";
|
|
7209
7330
|
import { homedir as homedir15 } from "os";
|
|
7210
|
-
import { join as join32, dirname as
|
|
7331
|
+
import { join as join32, dirname as dirname9 } from "path";
|
|
7211
7332
|
|
|
7212
7333
|
// src/lib/manager/scheduler/notify.ts
|
|
7213
7334
|
import { createHash as createHash11 } from "crypto";
|
|
@@ -7639,7 +7760,7 @@ async function routeScheduledTaskViaKanban(codeName, agentId, task, prompt, dura
|
|
|
7639
7760
|
}
|
|
7640
7761
|
try {
|
|
7641
7762
|
const doorbell = directChatDoorbellPath(agentId, homedir15());
|
|
7642
|
-
mkdirSync7(
|
|
7763
|
+
mkdirSync7(dirname9(doorbell), { recursive: true });
|
|
7643
7764
|
writeFileSync11(doorbell, String(Date.now()));
|
|
7644
7765
|
} catch (err) {
|
|
7645
7766
|
log(`[scheduled-kanban] doorbell ring failed for '${codeName}': ${err.message} (notice still queued)`);
|
|
@@ -10569,7 +10690,7 @@ async function sendError(flag, opts, text) {
|
|
|
10569
10690
|
|
|
10570
10691
|
// src/lib/restart-context.ts
|
|
10571
10692
|
import { readdirSync as readdirSync9, readFileSync as readFileSync29, writeFileSync as writeFileSync14, mkdirSync as mkdirSync10, unlinkSync as unlinkSync5 } from "fs";
|
|
10572
|
-
import { dirname as
|
|
10693
|
+
import { dirname as dirname10, join as join38 } from "path";
|
|
10573
10694
|
var SLACK_PENDING_INBOUND_DIRNAME = "slack-pending-inbound";
|
|
10574
10695
|
var SLACK_RESTART_CONTEXT_DIRNAME = "slack-restart-context";
|
|
10575
10696
|
var MAX_TOPIC_CHARS = 140;
|
|
@@ -10578,7 +10699,7 @@ var RECONSTRUCT_WINDOW_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
|
10578
10699
|
var WINDOW_PAD_MS3 = 5 * 6e4;
|
|
10579
10700
|
var DEFAULT_MAX_MARKERS_PER_AGENT = 25;
|
|
10580
10701
|
function augmentedAgentDir(codeName) {
|
|
10581
|
-
return
|
|
10702
|
+
return dirname10(getProjectDir(codeName));
|
|
10582
10703
|
}
|
|
10583
10704
|
function slackPendingInboundDir(codeName) {
|
|
10584
10705
|
return join38(augmentedAgentDir(codeName), SLACK_PENDING_INBOUND_DIRNAME);
|
|
@@ -12057,8 +12178,8 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
|
|
|
12057
12178
|
var dayRolloverInboundHold = /* @__PURE__ */ new Map();
|
|
12058
12179
|
var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
|
|
12059
12180
|
async function channelInboundActivityAgeSecondsFor(codeName) {
|
|
12060
|
-
const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-
|
|
12061
|
-
const newest = newestPendingInboundActivityMtimeMs(
|
|
12181
|
+
const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-34KFMMAC.js");
|
|
12182
|
+
const newest = newestPendingInboundActivityMtimeMs(dirname11(paneLogPath(codeName)));
|
|
12062
12183
|
if (newest === null) return null;
|
|
12063
12184
|
return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
|
|
12064
12185
|
}
|
|
@@ -12705,7 +12826,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
|
|
|
12705
12826
|
var lastVersionCheckAt = 0;
|
|
12706
12827
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
12707
12828
|
var lastResponsivenessProbeAt = 0;
|
|
12708
|
-
var agtCliVersion = true ? "0.28.
|
|
12829
|
+
var agtCliVersion = true ? "0.28.710" : "dev";
|
|
12709
12830
|
function resolveBrewPath(execFileSync3) {
|
|
12710
12831
|
try {
|
|
12711
12832
|
const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -12800,7 +12921,7 @@ async function ensureToolkitCli(toolkitSlug) {
|
|
|
12800
12921
|
toolkitCliEnsured.add(toolkitSlug);
|
|
12801
12922
|
return;
|
|
12802
12923
|
}
|
|
12803
|
-
brewBinDir =
|
|
12924
|
+
brewBinDir = dirname11(brewPath);
|
|
12804
12925
|
const isRoot = typeof process.getuid === "function" && process.getuid() === 0;
|
|
12805
12926
|
log(`[toolkit-install] ${toolkitSlug}: installing via brew (${pkg})\u2026`);
|
|
12806
12927
|
if (isRoot) {
|
|
@@ -13056,7 +13177,7 @@ function ensureClaudeManagedSettings(path = claudeManagedSettingsPath()) {
|
|
|
13056
13177
|
const missing = MANAGED_SETTINGS_KEYS.filter((key) => settings[key] !== true);
|
|
13057
13178
|
if (missing.length === 0) return "ok";
|
|
13058
13179
|
for (const key of missing) settings[key] = true;
|
|
13059
|
-
mkdirSync11(
|
|
13180
|
+
mkdirSync11(dirname11(path), { recursive: true });
|
|
13060
13181
|
writeFileSync15(path, `${JSON.stringify(settings, null, 2)}
|
|
13061
13182
|
`);
|
|
13062
13183
|
log(`[managed-settings] set ${missing.map((k) => `${k}:true`).join(", ")} in ${path} (ENG-5786 unblocks Claude Code channels; ENG-9223 pre-approves project MCP servers so a headless session never freezes on the trust prompt)`);
|
|
@@ -13152,7 +13273,7 @@ async function ensureFrameworkBinary(frameworkId) {
|
|
|
13152
13273
|
log(`Claude Code install failed: ${err.message}`);
|
|
13153
13274
|
return;
|
|
13154
13275
|
}
|
|
13155
|
-
const brewBinDir =
|
|
13276
|
+
const brewBinDir = dirname11(brewPath);
|
|
13156
13277
|
if (!process.env.PATH?.split(":").includes(brewBinDir)) {
|
|
13157
13278
|
process.env.PATH = `${brewBinDir}:${process.env.PATH ?? ""}`;
|
|
13158
13279
|
}
|
|
@@ -14232,7 +14353,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
|
|
|
14232
14353
|
if (codeNames.length === 0) return;
|
|
14233
14354
|
void (async () => {
|
|
14234
14355
|
try {
|
|
14235
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
14356
|
+
const { collectDiagnostics } = await import("../persistent-session-IMWW6DLZ.js");
|
|
14236
14357
|
await api.post("/host/heartbeat", {
|
|
14237
14358
|
host_id: hostId,
|
|
14238
14359
|
agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
|
|
@@ -14350,7 +14471,7 @@ async function pollCycleInner() {
|
|
|
14350
14471
|
}
|
|
14351
14472
|
try {
|
|
14352
14473
|
const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
|
|
14353
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
14474
|
+
const { collectDiagnostics } = await import("../persistent-session-IMWW6DLZ.js");
|
|
14354
14475
|
const diagCodeNames = [...agentState.persistentSessionAgents];
|
|
14355
14476
|
const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor) : void 0;
|
|
14356
14477
|
let tailscaleHostname;
|
|
@@ -14519,7 +14640,7 @@ async function pollCycleInner() {
|
|
|
14519
14640
|
collectPanelessActivityProbes,
|
|
14520
14641
|
getResponsivenessIntervalMs,
|
|
14521
14642
|
occupancyQualificationClassifications
|
|
14522
|
-
} = await import("../responsiveness-probe-
|
|
14643
|
+
} = await import("../responsiveness-probe-34KFMMAC.js");
|
|
14523
14644
|
const probeIntervalMs = getResponsivenessIntervalMs();
|
|
14524
14645
|
if (now - lastResponsivenessProbeAt > probeIntervalMs) {
|
|
14525
14646
|
const probeCodeNames = [...agentState.persistentSessionAgents];
|
|
@@ -14629,7 +14750,7 @@ async function pollCycleInner() {
|
|
|
14629
14750
|
collectResponsivenessProbes,
|
|
14630
14751
|
livePendingInboundOldestAgeSeconds,
|
|
14631
14752
|
parkPendingInbound
|
|
14632
|
-
} = await import("../responsiveness-probe-
|
|
14753
|
+
} = await import("../responsiveness-probe-34KFMMAC.js");
|
|
14633
14754
|
const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-NDP36U7O.js");
|
|
14634
14755
|
const wedgeNow = /* @__PURE__ */ new Date();
|
|
14635
14756
|
const liveAgents = agentState.persistentSessionAgents;
|
|
@@ -14785,7 +14906,7 @@ async function pollCycleInner() {
|
|
|
14785
14906
|
}
|
|
14786
14907
|
try {
|
|
14787
14908
|
const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-JA437JIB.js");
|
|
14788
|
-
const { probeSessionAuth } = await import("../session-auth-dead-
|
|
14909
|
+
const { probeSessionAuth } = await import("../session-auth-dead-OAOR7OS4.js");
|
|
14789
14910
|
const observations = [];
|
|
14790
14911
|
const pendingCacheCommits = [];
|
|
14791
14912
|
const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
|
|
@@ -15028,7 +15149,7 @@ async function pollCycleInner() {
|
|
|
15028
15149
|
);
|
|
15029
15150
|
if (flush.status === "flushed") {
|
|
15030
15151
|
log(
|
|
15031
|
-
`[drain-flush] shipped ${flush.uploaded} transcript file(s) for '${prev.codeName}' before teardown (ENG-9491)`
|
|
15152
|
+
`[drain-flush] shipped ${flush.uploaded} transcript file(s) for '${prev.codeName}' before teardown, manifest at '${flush.manifestKey}' (ENG-9491/ENG-9566)`
|
|
15032
15153
|
);
|
|
15033
15154
|
} else if (flush.status === "no-transcripts") {
|
|
15034
15155
|
log(
|
|
@@ -15722,7 +15843,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
15722
15843
|
log(`${verb} '${agent.code_name}': ${fileNames}`);
|
|
15723
15844
|
for (const file of changedFiles) {
|
|
15724
15845
|
const filePath = join39(agentDir, file.relativePath);
|
|
15725
|
-
mkdirSync11(
|
|
15846
|
+
mkdirSync11(dirname11(filePath), { recursive: true });
|
|
15726
15847
|
if (file.relativePath === ".mcp.json") {
|
|
15727
15848
|
safeWriteJsonAtomic(filePath, file.content, { mode: 384 });
|
|
15728
15849
|
} else {
|
|
@@ -18587,7 +18708,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
|
|
|
18587
18708
|
void api.post("/host/restart-ack", { host_id: hostId, agent_id: agentId, restart_requested_at: requestedAt }).catch((err) => log(`[restart-lane] ack failed for '${codeName}': ${err.message}`));
|
|
18588
18709
|
void (async () => {
|
|
18589
18710
|
try {
|
|
18590
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
18711
|
+
const { collectDiagnostics } = await import("../persistent-session-IMWW6DLZ.js");
|
|
18591
18712
|
await api.post("/host/heartbeat", {
|
|
18592
18713
|
host_id: hostId,
|
|
18593
18714
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
|
|
@@ -18638,7 +18759,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
|
|
|
18638
18759
|
}
|
|
18639
18760
|
try {
|
|
18640
18761
|
const hostId = await getHostId();
|
|
18641
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
18762
|
+
const { collectDiagnostics } = await import("../persistent-session-IMWW6DLZ.js");
|
|
18642
18763
|
await api.post("/host/heartbeat", {
|
|
18643
18764
|
host_id: hostId,
|
|
18644
18765
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
|
|
@@ -18954,7 +19075,7 @@ async function processDirectChatMessageOpencode(agent, msg) {
|
|
|
18954
19075
|
body
|
|
18955
19076
|
});
|
|
18956
19077
|
recordCursorAdvanceOutcome(
|
|
18957
|
-
|
|
19078
|
+
dirname11(paneLogPath(agent.codeName)),
|
|
18958
19079
|
"direct-chat-manager",
|
|
18959
19080
|
"reply",
|
|
18960
19081
|
verdict
|
|
@@ -18984,7 +19105,7 @@ async function processDirectChatMessageOpencode(agent, msg) {
|
|
|
18984
19105
|
} catch (err) {
|
|
18985
19106
|
if (!recorded) {
|
|
18986
19107
|
recordCursorAdvanceOutcome(
|
|
18987
|
-
|
|
19108
|
+
dirname11(paneLogPath(agent.codeName)),
|
|
18988
19109
|
"direct-chat-manager",
|
|
18989
19110
|
"reply",
|
|
18990
19111
|
{ outcome: "failed", error: err.message, expected: 1 }
|
|
@@ -19036,7 +19157,7 @@ async function processDirectChatMessage(agent, msg) {
|
|
|
19036
19157
|
if (useDoorbell) {
|
|
19037
19158
|
try {
|
|
19038
19159
|
const doorbell = directChatDoorbellPath(agent.agentId, homedir18());
|
|
19039
|
-
mkdirSync11(
|
|
19160
|
+
mkdirSync11(dirname11(doorbell), { recursive: true });
|
|
19040
19161
|
writeFileSync15(doorbell, String(Date.now()));
|
|
19041
19162
|
log(`[direct-chat] Doorbell rung for '${agent.codeName}' (msg=${msg.id}) \u2014 in-session MCP will pull via the cursor`);
|
|
19042
19163
|
return;
|
|
@@ -19165,7 +19286,7 @@ ${formatRunMarker(run_id)}` : KANBAN_CHECK_COMMAND;
|
|
|
19165
19286
|
if (run_id) openInjectedRunByCode.set(codeName, run_id);
|
|
19166
19287
|
try {
|
|
19167
19288
|
const doorbell = directChatDoorbellPath(agentId, homedir18());
|
|
19168
|
-
mkdirSync11(
|
|
19289
|
+
mkdirSync11(dirname11(doorbell), { recursive: true });
|
|
19169
19290
|
writeFileSync15(doorbell, String(Date.now()));
|
|
19170
19291
|
} catch (err) {
|
|
19171
19292
|
log(`[kanban] doorbell ring failed for '${codeName}': ${err.message} (notice still queued)`);
|
|
@@ -19270,7 +19391,7 @@ async function processClaudePairSessions(agents) {
|
|
|
19270
19391
|
killPairSession,
|
|
19271
19392
|
pairTmuxSession,
|
|
19272
19393
|
finalizeClaudePairOnboarding
|
|
19273
|
-
} = await import("../claude-pair-runtime-
|
|
19394
|
+
} = await import("../claude-pair-runtime-DWM6RNTP.js");
|
|
19274
19395
|
for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
|
|
19275
19396
|
log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
|
|
19276
19397
|
const killed = await killPairSession(pairTmuxSession(pairId));
|
|
@@ -20270,7 +20391,7 @@ function restartRunningChannelMcps(basenames) {
|
|
|
20270
20391
|
function deployMcpAssets() {
|
|
20271
20392
|
const targetDir = join39(homedir18(), ".augmented", "_mcp");
|
|
20272
20393
|
mkdirSync11(targetDir, { recursive: true });
|
|
20273
|
-
const moduleDir =
|
|
20394
|
+
const moduleDir = dirname11(fileURLToPath(import.meta.url));
|
|
20274
20395
|
let mcpSourceDir = "";
|
|
20275
20396
|
let dir = moduleDir;
|
|
20276
20397
|
for (let i = 0; i < 6; i++) {
|
|
@@ -20279,7 +20400,7 @@ function deployMcpAssets() {
|
|
|
20279
20400
|
mcpSourceDir = candidate;
|
|
20280
20401
|
break;
|
|
20281
20402
|
}
|
|
20282
|
-
const parent =
|
|
20403
|
+
const parent = dirname11(dir);
|
|
20283
20404
|
if (parent === dir) break;
|
|
20284
20405
|
dir = parent;
|
|
20285
20406
|
}
|