@integrity-labs/agt-cli 0.28.1067 → 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.
Files changed (28) hide show
  1. package/dist/bin/agt.js +5 -5
  2. package/dist/{chunk-PN7B4DLS.js → chunk-CFJONCHN.js} +11 -1
  3. package/dist/{chunk-PN7B4DLS.js.map → chunk-CFJONCHN.js.map} +1 -1
  4. package/dist/{chunk-NZF55T6D.js → chunk-CO2ODT4I.js} +11 -5
  5. package/dist/{chunk-NZF55T6D.js.map → chunk-CO2ODT4I.js.map} +1 -1
  6. package/dist/{chunk-OW6XCSOU.js → chunk-FHUYRSCF.js} +101 -11
  7. package/dist/chunk-FHUYRSCF.js.map +1 -0
  8. package/dist/{claude-pair-runtime-NCDM5KHM.js → claude-pair-runtime-Z7SMBMUG.js} +2 -2
  9. package/dist/lib/manager-worker.js +361 -36
  10. package/dist/lib/manager-worker.js.map +1 -1
  11. package/dist/mcp/direct-chat-channel.js +10 -0
  12. package/dist/mcp/index.js +10 -0
  13. package/dist/mcp/origami.js +10 -0
  14. package/dist/mcp/slack-channel.js +10 -0
  15. package/dist/mcp/telegram-channel.js +10 -0
  16. package/dist/pane-fatal-error-EL336LRO.js +127 -0
  17. package/dist/pane-fatal-error-EL336LRO.js.map +1 -0
  18. package/dist/{persistent-session-ELDC5JFR.js → persistent-session-52A2G7D7.js} +9 -3
  19. package/dist/{responsiveness-probe-HUUU2MFX.js → responsiveness-probe-SJCP4V4X.js} +3 -3
  20. package/dist/{session-auth-dead-BRMWKA3Y.js → session-auth-dead-JJPNV3YQ.js} +2 -2
  21. package/dist/transcript-mount-health-OHE6IVJV.js +79 -0
  22. package/dist/transcript-mount-health-OHE6IVJV.js.map +1 -0
  23. package/package.json +1 -1
  24. package/dist/chunk-OW6XCSOU.js.map +0 -1
  25. /package/dist/{claude-pair-runtime-NCDM5KHM.js.map → claude-pair-runtime-Z7SMBMUG.js.map} +0 -0
  26. /package/dist/{persistent-session-ELDC5JFR.js.map → persistent-session-52A2G7D7.js.map} +0 -0
  27. /package/dist/{responsiveness-probe-HUUU2MFX.js.map → responsiveness-probe-SJCP4V4X.js.map} +0 -0
  28. /package/dist/{session-auth-dead-BRMWKA3Y.js.map → session-auth-dead-JJPNV3YQ.js.map} +0 -0
@@ -24,7 +24,7 @@ import {
24
24
  rotateDailySession,
25
25
  sessionFileExists,
26
26
  todayLocalIso
27
- } from "./chunk-PN7B4DLS.js";
27
+ } from "./chunk-CFJONCHN.js";
28
28
  import {
29
29
  classifyUnanswerablePane,
30
30
  findUsageLimitResetHint,
@@ -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
- mkdirSync6(join7(projects, `${TRANSCRIPT_MASK_DIR_PREFIX}${args.agentId}`), { recursive: true });
4193
- mkdirSync6(join7(projects, encodeClaudeProjectPath(args.projectDir)), { recursive: true });
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 claudeProjects = join7(claudeHome, "projects");
4221
- const transcriptMask = join7(claudeProjects, `${TRANSCRIPT_MASK_DIR_PREFIX}${agentId}`);
4222
- const ownTranscripts = join7(claudeProjects, encodeClaudeProjectPath(projectDir));
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-OW6XCSOU.js.map
6116
+ //# sourceMappingURL=chunk-FHUYRSCF.js.map