@integrity-labs/agt-cli 0.28.1068 → 0.28.1069
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 +4 -4
- package/dist/{chunk-WLB2E3PO.js → chunk-CO2ODT4I.js} +7 -4
- package/dist/{chunk-WLB2E3PO.js.map → chunk-CO2ODT4I.js.map} +1 -1
- package/dist/{chunk-65F44JJJ.js → chunk-FHUYRSCF.js} +100 -10
- package/dist/chunk-FHUYRSCF.js.map +1 -0
- package/dist/{claude-pair-runtime-4BISLPPZ.js → claude-pair-runtime-Z7SMBMUG.js} +2 -2
- package/dist/lib/manager-worker.js +211 -35
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/{persistent-session-VRAVB743.js → persistent-session-52A2G7D7.js} +8 -2
- package/dist/{responsiveness-probe-QTYKXBH7.js → responsiveness-probe-SJCP4V4X.js} +2 -2
- package/dist/transcript-mount-health-OHE6IVJV.js +79 -0
- package/dist/transcript-mount-health-OHE6IVJV.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-65F44JJJ.js.map +0 -1
- /package/dist/{claude-pair-runtime-4BISLPPZ.js.map → claude-pair-runtime-Z7SMBMUG.js.map} +0 -0
- /package/dist/{persistent-session-VRAVB743.js.map → persistent-session-52A2G7D7.js.map} +0 -0
- /package/dist/{responsiveness-probe-QTYKXBH7.js.map → responsiveness-probe-SJCP4V4X.js.map} +0 -0
|
@@ -287,9 +287,9 @@ function formatBytes(bytes) {
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
// src/lib/persistent-session.ts
|
|
290
|
-
import { join as join7, dirname as dirname5 } from "path";
|
|
290
|
+
import { join as join7, dirname as dirname5, basename as basename2 } from "path";
|
|
291
291
|
import { homedir as homedir5, platform, userInfo as userInfo2 } from "os";
|
|
292
|
-
import { existsSync as existsSync6, readFileSync as readFileSync7, readdirSync as readdirSync2, writeFileSync as writeFileSync5, appendFileSync as appendFileSync2, mkdirSync as mkdirSync6, chmodSync as chmodSync3, copyFileSync, rmSync as rmSync3, lstatSync as lstatSync3, realpathSync as realpathSync2, renameSync as renameSync3, statSync } from "fs";
|
|
292
|
+
import { existsSync as existsSync6, readFileSync as readFileSync7, readdirSync as readdirSync2, writeFileSync as writeFileSync5, appendFileSync as appendFileSync2, mkdirSync as mkdirSync6, chmodSync as chmodSync3, copyFileSync, rmSync as rmSync3, lstatSync as lstatSync3, realpathSync as realpathSync2, renameSync as renameSync3, statSync, openSync as openSync2, closeSync as closeSync2, fstatSync, futimesSync, constants as fsConstants } from "fs";
|
|
293
293
|
|
|
294
294
|
// src/lib/mcp-sanitize.ts
|
|
295
295
|
import { readFileSync, writeFileSync } from "fs";
|
|
@@ -4185,12 +4185,97 @@ var CLAUDE_HOST_WIDE = [
|
|
|
4185
4185
|
function claudeStateDirFor(homeDir, agentId) {
|
|
4186
4186
|
return join7(homeDir, ".augmented", agentId, ".claude-state");
|
|
4187
4187
|
}
|
|
4188
|
-
function ensureClaudeStateLayout(args) {
|
|
4188
|
+
function ensureClaudeStateLayout(args, log2) {
|
|
4189
4189
|
const stateDir = claudeStateDirFor(args.homeDir, args.agentId);
|
|
4190
4190
|
for (const dir of CLAUDE_PER_AGENT_DIRS) mkdirSync6(join7(stateDir, dir), { recursive: true });
|
|
4191
|
+
const result = ensureTranscriptBindSources(args);
|
|
4192
|
+
for (const r of result.refused) {
|
|
4193
|
+
(log2 ?? ((m) => console.warn(m)))(
|
|
4194
|
+
`[transcript-mount] REFUSED ${r.path}: ${r.reason}${r.detail ? ` (${r.detail})` : ""} - sentinel not written; a transcript bind source the agent can write must not be followed (ENG-11277)`
|
|
4195
|
+
);
|
|
4196
|
+
}
|
|
4197
|
+
return result;
|
|
4198
|
+
}
|
|
4199
|
+
function ensureTranscriptBindSources(args) {
|
|
4200
|
+
const { projects, mask, own } = transcriptBindSourcesFor(args);
|
|
4201
|
+
const refused = [];
|
|
4202
|
+
try {
|
|
4203
|
+
mkdirSync6(projects, { recursive: true });
|
|
4204
|
+
} catch (err) {
|
|
4205
|
+
return { refused: [{ path: projects, reason: "error", detail: err.code ?? "mkdir failed" }] };
|
|
4206
|
+
}
|
|
4207
|
+
const maskName = basename2(mask);
|
|
4208
|
+
const slug = basename2(own);
|
|
4209
|
+
for (const chain of [[maskName], [maskName, slug], [slug]]) {
|
|
4210
|
+
const dir = ensureDirChainNoFollow(projects, chain);
|
|
4211
|
+
if ("reason" in dir) {
|
|
4212
|
+
if (!refused.some((r) => r.path === dir.path)) refused.push(dir);
|
|
4213
|
+
continue;
|
|
4214
|
+
}
|
|
4215
|
+
const sentinel = touchSentinel(join7(dir.path, TRANSCRIPT_BIND_SENTINEL));
|
|
4216
|
+
if (sentinel) refused.push(sentinel);
|
|
4217
|
+
}
|
|
4218
|
+
return { refused };
|
|
4219
|
+
}
|
|
4220
|
+
function ensureDirChainNoFollow(root, components) {
|
|
4221
|
+
let path = root;
|
|
4222
|
+
for (const component of components) {
|
|
4223
|
+
path = join7(path, component);
|
|
4224
|
+
let st = lstatOrNull(path);
|
|
4225
|
+
if (st === null) {
|
|
4226
|
+
try {
|
|
4227
|
+
mkdirSync6(path);
|
|
4228
|
+
} catch (err) {
|
|
4229
|
+
if (err.code !== "EEXIST") {
|
|
4230
|
+
return { path, reason: "error", detail: err.code ?? "mkdir failed" };
|
|
4231
|
+
}
|
|
4232
|
+
}
|
|
4233
|
+
st = lstatOrNull(path);
|
|
4234
|
+
if (st === null) return { path, reason: "error", detail: "vanished after mkdir" };
|
|
4235
|
+
}
|
|
4236
|
+
if (st.isSymbolicLink()) return { path, reason: "symlink" };
|
|
4237
|
+
if (!st.isDirectory()) return { path, reason: "not-a-directory" };
|
|
4238
|
+
}
|
|
4239
|
+
return { path };
|
|
4240
|
+
}
|
|
4241
|
+
function lstatOrNull(path) {
|
|
4242
|
+
try {
|
|
4243
|
+
return lstatSync3(path);
|
|
4244
|
+
} catch {
|
|
4245
|
+
return null;
|
|
4246
|
+
}
|
|
4247
|
+
}
|
|
4248
|
+
var TRANSCRIPT_BIND_SENTINEL = ".agt-bind-source";
|
|
4249
|
+
function transcriptBindSourcesFor(args) {
|
|
4191
4250
|
const projects = join7(args.homeDir, ".claude", "projects");
|
|
4192
|
-
|
|
4193
|
-
|
|
4251
|
+
const slug = encodeClaudeProjectPath(args.projectDir);
|
|
4252
|
+
const mask = join7(projects, `${TRANSCRIPT_MASK_DIR_PREFIX}${args.agentId}`);
|
|
4253
|
+
return { projects, mask, mountpoint: join7(mask, slug), own: join7(projects, slug) };
|
|
4254
|
+
}
|
|
4255
|
+
function touchSentinel(path) {
|
|
4256
|
+
let fd;
|
|
4257
|
+
try {
|
|
4258
|
+
fd = openSync2(
|
|
4259
|
+
path,
|
|
4260
|
+
fsConstants.O_WRONLY | fsConstants.O_CREAT | fsConstants.O_NOFOLLOW | fsConstants.O_NONBLOCK,
|
|
4261
|
+
420
|
|
4262
|
+
);
|
|
4263
|
+
} catch (err) {
|
|
4264
|
+
const code = err.code;
|
|
4265
|
+
if (code === "ELOOP") return { path, reason: "symlink" };
|
|
4266
|
+
if (code === "EISDIR" || code === "ENXIO") return { path, reason: "not-a-regular-file", detail: code };
|
|
4267
|
+
return { path, reason: "error", detail: code ?? "open failed" };
|
|
4268
|
+
}
|
|
4269
|
+
try {
|
|
4270
|
+
if (!fstatSync(fd).isFile()) return { path, reason: "not-a-regular-file" };
|
|
4271
|
+
const now = /* @__PURE__ */ new Date();
|
|
4272
|
+
futimesSync(fd, now, now);
|
|
4273
|
+
return null;
|
|
4274
|
+
} catch (err) {
|
|
4275
|
+
return { path, reason: "error", detail: err.code ?? "futimes failed" };
|
|
4276
|
+
} finally {
|
|
4277
|
+
closeSync2(fd);
|
|
4278
|
+
}
|
|
4194
4279
|
}
|
|
4195
4280
|
function legacyClaudeJsonIsFile(path) {
|
|
4196
4281
|
try {
|
|
@@ -4217,9 +4302,11 @@ function buildDockerRunCommand(args) {
|
|
|
4217
4302
|
const configDirIsolationSafe = configDirIsIsolationSafe(homeDir);
|
|
4218
4303
|
const useConfigDir = (args.claudeConfigDirReady ?? claudeConfigDirIsReady(homeDir)) && configDirIsolationSafe;
|
|
4219
4304
|
const legacyExists = args.legacyClaudeJsonExists ?? legacyClaudeJsonIsFile(legacyClaudeJson);
|
|
4220
|
-
const
|
|
4221
|
-
|
|
4222
|
-
|
|
4305
|
+
const {
|
|
4306
|
+
projects: claudeProjects,
|
|
4307
|
+
mask: transcriptMask,
|
|
4308
|
+
own: ownTranscripts
|
|
4309
|
+
} = transcriptBindSourcesFor({ homeDir, agentId, projectDir });
|
|
4223
4310
|
const managedSettingsDir = CLAUDE_MANAGED_SETTINGS_DIR;
|
|
4224
4311
|
const mounts = [
|
|
4225
4312
|
`-v ${q(`${agentDir2}:${agentDir2}`)}`,
|
|
@@ -5020,7 +5107,7 @@ function spawnSession(config, session) {
|
|
|
5020
5107
|
log2(`[persistent-session] egress allowlist for '${codeName}': ${allowlist.length} domains (deny-by-default)`);
|
|
5021
5108
|
}
|
|
5022
5109
|
if (effectiveMode === "docker") {
|
|
5023
|
-
ensureClaudeStateLayout({ homeDir: sessionHomeDir, agentId: config.agentId, projectDir });
|
|
5110
|
+
ensureClaudeStateLayout({ homeDir: sessionHomeDir, agentId: config.agentId, projectDir }, log2);
|
|
5024
5111
|
}
|
|
5025
5112
|
const claudeCmd = effectiveMode === "docker" ? buildDockerRunCommand({
|
|
5026
5113
|
// ENG-10869: seed-then-decide, in that order and in one place. A
|
|
@@ -5977,6 +6064,9 @@ export {
|
|
|
5977
6064
|
CLAUDE_HOST_WIDE,
|
|
5978
6065
|
claudeStateDirFor,
|
|
5979
6066
|
ensureClaudeStateLayout,
|
|
6067
|
+
ensureTranscriptBindSources,
|
|
6068
|
+
TRANSCRIPT_BIND_SENTINEL,
|
|
6069
|
+
transcriptBindSourcesFor,
|
|
5980
6070
|
configDirIsIsolationSafe,
|
|
5981
6071
|
buildDockerRunCommand,
|
|
5982
6072
|
writePersistentClaudeWrapper,
|
|
@@ -6023,4 +6113,4 @@ export {
|
|
|
6023
6113
|
stopAllSessionsAndWait,
|
|
6024
6114
|
getProjectDir
|
|
6025
6115
|
};
|
|
6026
|
-
//# sourceMappingURL=chunk-
|
|
6116
|
+
//# sourceMappingURL=chunk-FHUYRSCF.js.map
|