@integrity-labs/agt-cli 0.28.854 → 0.28.856

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 (26) hide show
  1. package/dist/bin/agt.js +5 -5
  2. package/dist/{chunk-2E2NKILK.js → chunk-6CLS6G7Y.js} +2 -2
  3. package/dist/{chunk-FHOLG6VL.js → chunk-6I5IMMWR.js} +356 -194
  4. package/dist/chunk-6I5IMMWR.js.map +1 -0
  5. package/dist/{chunk-4Z4GFQAD.js → chunk-M6E42Z4Z.js} +111 -1
  6. package/dist/chunk-M6E42Z4Z.js.map +1 -0
  7. package/dist/{claude-pair-runtime-63TA3LT5.js → claude-pair-runtime-QQSSCLXU.js} +2 -2
  8. package/dist/lib/manager-worker.js +37 -21
  9. package/dist/lib/manager-worker.js.map +1 -1
  10. package/dist/mcp/computer-use-proxy.js +98 -1
  11. package/dist/mcp/direct-chat-channel.js +110 -0
  12. package/dist/mcp/index.js +110 -0
  13. package/dist/mcp/origami.js +110 -0
  14. package/dist/mcp/slack-channel.js +110 -0
  15. package/dist/mcp/telegram-channel.js +110 -0
  16. package/dist/{persistent-session-N4DJ4VXZ.js → persistent-session-GZLPDUMN.js} +3 -3
  17. package/dist/{responsiveness-probe-GYE5MIVB.js → responsiveness-probe-GSCW4NBC.js} +3 -3
  18. package/dist/{session-auth-dead-K6B6D3WR.js → session-auth-dead-NWLDIYTW.js} +2 -2
  19. package/package.json +1 -1
  20. package/dist/chunk-4Z4GFQAD.js.map +0 -1
  21. package/dist/chunk-FHOLG6VL.js.map +0 -1
  22. /package/dist/{chunk-2E2NKILK.js.map → chunk-6CLS6G7Y.js.map} +0 -0
  23. /package/dist/{claude-pair-runtime-63TA3LT5.js.map → claude-pair-runtime-QQSSCLXU.js.map} +0 -0
  24. /package/dist/{persistent-session-N4DJ4VXZ.js.map → persistent-session-GZLPDUMN.js.map} +0 -0
  25. /package/dist/{responsiveness-probe-GYE5MIVB.js.map → responsiveness-probe-GSCW4NBC.js.map} +0 -0
  26. /package/dist/{session-auth-dead-K6B6D3WR.js.map → session-auth-dead-NWLDIYTW.js.map} +0 -0
@@ -16,7 +16,7 @@ import {
16
16
  parseEnvIntegrations,
17
17
  shellQuote,
18
18
  summarizeUnanswerablePane
19
- } from "./chunk-2E2NKILK.js";
19
+ } from "./chunk-6CLS6G7Y.js";
20
20
  import {
21
21
  BIND_FAILURE_QUARANTINE_THRESHOLD,
22
22
  INTEGRATIONS_SECTION_END,
@@ -76,7 +76,7 @@ import {
76
76
  sessionTranscriptDir,
77
77
  worseConnectivityOutcome,
78
78
  wrapScheduledTaskPrompt
79
- } from "./chunk-4Z4GFQAD.js";
79
+ } from "./chunk-M6E42Z4Z.js";
80
80
  import {
81
81
  parsePsRows
82
82
  } from "./chunk-XWVM4KPK.js";
@@ -450,7 +450,7 @@ function orderTitlesForDescription(entries) {
450
450
 
451
451
  // ../../packages/core/dist/provisioning/frameworks/claudecode/index.js
452
452
  import { readFileSync as readFileSync4, writeFileSync as writeFileSync4, mkdirSync as mkdirSync3, existsSync as existsSync4, chmodSync as chmodSync4, readdirSync, rmSync as rmSync2, copyFileSync, lstatSync, realpathSync, symlinkSync, readlinkSync, renameSync as renameSync4, opendirSync } from "fs";
453
- import { join as join3, relative, dirname as dirname3 } from "path";
453
+ import { join as join4, relative, dirname as dirname3 } from "path";
454
454
  import { homedir as homedir3, tmpdir } from "os";
455
455
  import { execFile } from "child_process";
456
456
 
@@ -1245,6 +1245,125 @@ function decryptIntegrationCredentials(credentials, row) {
1245
1245
  return out;
1246
1246
  }
1247
1247
 
1248
+ // ../../packages/core/dist/provisioning/computer-use-mcp.js
1249
+ import { join as join3 } from "path";
1250
+ var COMPUTER_USE_DEFINITION_ID = "open-computer-use";
1251
+ var COMPUTER_USE_MCP_KEY = "open-computer-use";
1252
+ var COMPUTER_USE_SSH_KEY_ENV = `${remoteMcpEnvPrefix(COMPUTER_USE_DEFINITION_ID, null)}_API_KEY`;
1253
+ var DEFAULT_SSH_HOST = "127.0.0.1";
1254
+ var DEFAULT_SSH_PORT = 2222;
1255
+ var DEFAULT_REMOTE_COMMAND = "open-computer-use mcp";
1256
+ var SAFE_SSH_USER = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
1257
+ var ALLOWED_SSH_HOSTS = Object.freeze([
1258
+ "127.0.0.1",
1259
+ "::1",
1260
+ "localhost"
1261
+ ]);
1262
+ var SHELL_METACHARACTERS = /[;|&`$()<>\n\r*?\[\]{}!#~'"\\]/;
1263
+ function readString(config, key) {
1264
+ const v = config?.[key];
1265
+ return typeof v === "string" && v.trim().length > 0 ? v.trim() : null;
1266
+ }
1267
+ function readPort(config) {
1268
+ const v = config?.["ssh_port"];
1269
+ if (v === void 0 || v === null || v === "")
1270
+ return DEFAULT_SSH_PORT;
1271
+ const n = typeof v === "number" ? v : Number(v);
1272
+ if (!Number.isInteger(n) || n < 1 || n > 65535)
1273
+ return null;
1274
+ return n;
1275
+ }
1276
+ function buildComputerUseMcpEntry(input) {
1277
+ const user = readString(input.config, "ssh_user");
1278
+ if (user === null) {
1279
+ return {
1280
+ entry: null,
1281
+ problem: `${COMPUTER_USE_DEFINITION_ID}: config.ssh_user is required (the macOS account the tunnel authenticates as) \u2014 no MCP entry was written`
1282
+ };
1283
+ }
1284
+ const port = readPort(input.config);
1285
+ if (port === null) {
1286
+ return {
1287
+ entry: null,
1288
+ problem: `${COMPUTER_USE_DEFINITION_ID}: config.ssh_port must be an integer 1-65535 \u2014 no MCP entry was written`
1289
+ };
1290
+ }
1291
+ if (!SAFE_SSH_USER.test(user)) {
1292
+ return {
1293
+ entry: null,
1294
+ problem: `${COMPUTER_USE_DEFINITION_ID}: config.ssh_user must start with a letter or digit and contain only letters, digits, '.', '_' and '-' \u2014 no MCP entry was written`
1295
+ };
1296
+ }
1297
+ const host = readString(input.config, "ssh_host") ?? DEFAULT_SSH_HOST;
1298
+ if (!ALLOWED_SSH_HOSTS.includes(host)) {
1299
+ return {
1300
+ entry: null,
1301
+ problem: `${COMPUTER_USE_DEFINITION_ID}: config.ssh_host must be one of ${ALLOWED_SSH_HOSTS.join(", ")} \u2014 the Mac opens a REVERSE tunnel, so the agent host connects to its own loopback. A different host would send this agent's key somewhere else. No MCP entry was written`
1302
+ };
1303
+ }
1304
+ const remoteCommand = readString(input.config, "remote_command") ?? DEFAULT_REMOTE_COMMAND;
1305
+ if (SHELL_METACHARACTERS.test(remoteCommand)) {
1306
+ return {
1307
+ entry: null,
1308
+ problem: `${COMPUTER_USE_DEFINITION_ID}: config.remote_command must name a binary and its arguments and may not contain shell metacharacters (; | & \` $ ( ) < > newline) \u2014 no MCP entry was written`
1309
+ };
1310
+ }
1311
+ const knownHosts = join3(input.agentDir, ".computer-use-known-hosts");
1312
+ return {
1313
+ problem: null,
1314
+ entry: {
1315
+ command: "node",
1316
+ args: [
1317
+ input.proxyPath,
1318
+ "--",
1319
+ "ssh",
1320
+ // -T: no pty. The upstream speaks JSON-RPC over stdio; a pty would
1321
+ // inject terminal control sequences into the stream.
1322
+ "-T",
1323
+ // Never prompt. Without this a missing or rejected key makes ssh sit
1324
+ // waiting for a passphrase on a stdin that is carrying JSON-RPC, and
1325
+ // the server appears to hang rather than to fail.
1326
+ "-o",
1327
+ "BatchMode=yes",
1328
+ "-o",
1329
+ "StrictHostKeyChecking=accept-new",
1330
+ "-o",
1331
+ `UserKnownHostsFile=${knownHosts}`,
1332
+ "-o",
1333
+ "ConnectTimeout=10",
1334
+ // Keepalives so a dropped tunnel surfaces as a closed stdio pipe
1335
+ // rather than a silently wedged child. ENG-10134 owns detecting that
1336
+ // and respawning; this just makes the event happen.
1337
+ "-o",
1338
+ "ServerAliveInterval=15",
1339
+ "-o",
1340
+ "ServerAliveCountMax=3",
1341
+ "-p",
1342
+ String(port),
1343
+ `${user}@${host}`,
1344
+ remoteCommand
1345
+ ],
1346
+ env: {
1347
+ // The three the approval gate reads (ENG-10132). Deliberately the vars
1348
+ // the agent's environment already carries rather than new ones: the
1349
+ // gate refuses every call when any is missing, so adding a bespoke var
1350
+ // here would mean a new way for the proxy to be silently disarmed.
1351
+ AGT_HOST: "${AGT_HOST}",
1352
+ AGT_API_KEY: "${AGT_API_KEY}",
1353
+ AGT_AGENT_ID: input.agentId,
1354
+ // The credential. `${...}` is Claude Code's spawn-time substitution
1355
+ // from the agent's environment, which the manager populates from
1356
+ // `.env.integrations` — the same path every other integration
1357
+ // credential travels.
1358
+ [COMPUTER_USE_SSH_KEY_ENV]: `\${${COMPUTER_USE_SSH_KEY_ENV}}`,
1359
+ // ssh must be resolvable, and it is not a node builtin.
1360
+ PATH: process.env["PATH"] ?? "",
1361
+ HOME: process.env["HOME"] ?? ""
1362
+ }
1363
+ }
1364
+ };
1365
+ }
1366
+
1248
1367
  // ../../packages/core/dist/provisioning/github-broker-credentials.js
1249
1368
  var GITHUB_BROKER_BIN_DIR = ".claude/agt-bin";
1250
1369
  var GIT_CREDENTIAL_HELPER_BASENAME = "git-credential-agt-github";
@@ -1554,7 +1673,7 @@ var VALID_CODE_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
1554
1673
  var SECRET_FILE_MODE = 384;
1555
1674
  function writeEnvIntegrationsForAgent(codeName, args) {
1556
1675
  const agentDir = getAgentDir(codeName);
1557
- const envPath = join3(agentDir, ".env.integrations");
1676
+ const envPath = join4(agentDir, ".env.integrations");
1558
1677
  let existing = null;
1559
1678
  try {
1560
1679
  existing = readFileSync4(envPath, "utf-8");
@@ -1571,7 +1690,7 @@ function writeEnvIntegrationsForAgent(codeName, args) {
1571
1690
  try {
1572
1691
  const projectDir = getProjectDir2(codeName);
1573
1692
  mkdirSync3(projectDir, { recursive: true });
1574
- const dest = join3(projectDir, ".env.integrations");
1693
+ const dest = join4(projectDir, ".env.integrations");
1575
1694
  writeFileSync4(dest, content, { mode: SECRET_FILE_MODE });
1576
1695
  try {
1577
1696
  chmodSync4(dest, SECRET_FILE_MODE);
@@ -1592,7 +1711,7 @@ var MIGRATABLE_FIELD_TO_ENV_VAR = {
1592
1711
  AGT_API_KEY: "AGT_API_KEY"
1593
1712
  };
1594
1713
  function migrateExistingLiteralSecrets(codeName) {
1595
- const mcpJsonPath = join3(getAgentDir(codeName), "provision", ".mcp.json");
1714
+ const mcpJsonPath = join4(getAgentDir(codeName), "provision", ".mcp.json");
1596
1715
  let config;
1597
1716
  try {
1598
1717
  config = JSON.parse(readFileSync4(mcpJsonPath, "utf-8"));
@@ -1601,7 +1720,7 @@ function migrateExistingLiteralSecrets(codeName) {
1601
1720
  }
1602
1721
  let existingEnvKeys = /* @__PURE__ */ new Set();
1603
1722
  try {
1604
- existingEnvKeys = new Set(parseEnvFileEntries(readFileSync4(join3(getAgentDir(codeName), ".env.integrations"), "utf-8")).keys());
1723
+ existingEnvKeys = new Set(parseEnvFileEntries(readFileSync4(join4(getAgentDir(codeName), ".env.integrations"), "utf-8")).keys());
1605
1724
  } catch {
1606
1725
  }
1607
1726
  const updates = {};
@@ -1675,8 +1794,8 @@ function ensureIdKeyedLayout(codeName, agentId) {
1675
1794
  assertValidCodeName(codeName);
1676
1795
  assertValidAgentId(agentId);
1677
1796
  const home = getHomeDir();
1678
- const codeNamePath = join3(home, ".augmented", codeName);
1679
- const idPath = join3(home, ".augmented", agentId);
1797
+ const codeNamePath = join4(home, ".augmented", codeName);
1798
+ const idPath = join4(home, ".augmented", agentId);
1680
1799
  let state;
1681
1800
  try {
1682
1801
  state = lstatSync(codeNamePath).isSymbolicLink() ? "symlink" : "realdir";
@@ -1699,7 +1818,7 @@ function ensureIdKeyedLayout(codeName, agentId) {
1699
1818
  return idPath;
1700
1819
  }
1701
1820
  function stagedMigrationLinkPath(home, codeName) {
1702
- return join3(home, ".augmented", `.${codeName}.migrating`);
1821
+ return join4(home, ".augmented", `.${codeName}.migrating`);
1703
1822
  }
1704
1823
  function cleanupStaleStagedLink(staged) {
1705
1824
  try {
@@ -1719,8 +1838,8 @@ function migrateAgentDirToIdKeyed(codeName, agentId, opts = {}) {
1719
1838
  assertValidCodeName(codeName);
1720
1839
  assertValidAgentId(agentId);
1721
1840
  const home = opts.home ?? getHomeDir();
1722
- const codeNamePath = join3(home, ".augmented", codeName);
1723
- const idPath = join3(home, ".augmented", agentId);
1841
+ const codeNamePath = join4(home, ".augmented", codeName);
1842
+ const idPath = join4(home, ".augmented", agentId);
1724
1843
  const staged = stagedMigrationLinkPath(home, codeName);
1725
1844
  let codeNameKind;
1726
1845
  try {
@@ -1758,14 +1877,14 @@ function migrateAgentDirToIdKeyed(codeName, agentId, opts = {}) {
1758
1877
  }
1759
1878
  function getAgentDir(codeName) {
1760
1879
  assertValidCodeName(codeName);
1761
- return resolveRealAgentPath(join3(getHomeDir(), ".augmented", codeName));
1880
+ return resolveRealAgentPath(join4(getHomeDir(), ".augmented", codeName));
1762
1881
  }
1763
1882
  var migratedCodeNames = /* @__PURE__ */ new Set();
1764
1883
  function migrateLegacyClaudecodeDir(codeName, log2) {
1765
1884
  assertValidCodeName(codeName);
1766
1885
  if (migratedCodeNames.has(codeName))
1767
1886
  return;
1768
- const legacyRoot = join3(getHomeDir(), ".augmented", codeName, "claudecode");
1887
+ const legacyRoot = join4(getHomeDir(), ".augmented", codeName, "claudecode");
1769
1888
  if (!existsSync4(legacyRoot)) {
1770
1889
  migratedCodeNames.add(codeName);
1771
1890
  return;
@@ -1778,8 +1897,8 @@ function migrateLegacyClaudecodeDir(codeName, log2) {
1778
1897
  const walkAndMigrate = (srcDir, destDir) => {
1779
1898
  mkdirSync3(destDir, { recursive: true });
1780
1899
  for (const entry of readdirSync(srcDir, { withFileTypes: true })) {
1781
- const src = join3(srcDir, entry.name);
1782
- const dest = join3(destDir, entry.name);
1900
+ const src = join4(srcDir, entry.name);
1901
+ const dest = join4(destDir, entry.name);
1783
1902
  if (entry.isDirectory()) {
1784
1903
  walkAndMigrate(src, dest);
1785
1904
  continue;
@@ -1819,13 +1938,13 @@ function migrateLegacyClaudecodeDir(codeName, log2) {
1819
1938
  }
1820
1939
  }
1821
1940
  function syncGitHubBrokerCredentialTooling(projectDir, enabled) {
1822
- const binDir = join3(projectDir, GITHUB_BROKER_BIN_DIR);
1941
+ const binDir = join4(projectDir, GITHUB_BROKER_BIN_DIR);
1823
1942
  if (!enabled) {
1824
1943
  rmSync2(binDir, { recursive: true, force: true });
1825
1944
  return {};
1826
1945
  }
1827
- const helperPath = join3(binDir, GIT_CREDENTIAL_HELPER_BASENAME);
1828
- const shimPath = join3(binDir, GH_SHIM_BASENAME);
1946
+ const helperPath = join4(binDir, GIT_CREDENTIAL_HELPER_BASENAME);
1947
+ const shimPath = join4(binDir, GH_SHIM_BASENAME);
1829
1948
  mkdirSync3(binDir, { recursive: true });
1830
1949
  writeFileSync4(helperPath, renderGitCredentialHelper(), { mode: BROKER_SCRIPT_MODE });
1831
1950
  chmodSync4(helperPath, BROKER_SCRIPT_MODE);
@@ -1834,10 +1953,10 @@ function syncGitHubBrokerCredentialTooling(projectDir, enabled) {
1834
1953
  return buildGitCredentialEnv(helperPath);
1835
1954
  }
1836
1955
  function getProjectDir2(codeName) {
1837
- return join3(getAgentDir(codeName), "project");
1956
+ return join4(getAgentDir(codeName), "project");
1838
1957
  }
1839
1958
  function getScratchDir(codeName) {
1840
- return join3(getAgentDir(codeName), "scratch");
1959
+ return join4(getAgentDir(codeName), "scratch");
1841
1960
  }
1842
1961
  function getAgentTmpDir(codeName) {
1843
1962
  return agentTmpDirFor(getAgentDir(codeName));
@@ -1853,7 +1972,7 @@ function sweepScratchDir(codeName, now = Date.now()) {
1853
1972
  }
1854
1973
  const cutoff = now - SCRATCH_RETENTION_DAYS * 24 * 60 * 60 * 1e3;
1855
1974
  for (const entry of entries) {
1856
- const full = join3(scratchDir, entry);
1975
+ const full = join4(scratchDir, entry);
1857
1976
  try {
1858
1977
  if (isFreshWithin(full, cutoff))
1859
1978
  continue;
@@ -1881,7 +2000,7 @@ function sweepStrandedArtefactTmpDirs(now = Date.now()) {
1881
2000
  for (const entry of entries) {
1882
2001
  if (!STRANDED_ARTEFACT_TMP_PREFIXES.some((prefix) => entry.startsWith(prefix)))
1883
2002
  continue;
1884
- const full = join3(root, entry);
2003
+ const full = join4(root, entry);
1885
2004
  try {
1886
2005
  if (isFreshWithin(full, cutoff))
1887
2006
  continue;
@@ -1921,7 +2040,7 @@ function isFreshWithin(path, cutoff) {
1921
2040
  const child = dir.readSync();
1922
2041
  if (child === null)
1923
2042
  break;
1924
- queue.push(join3(current, child.name));
2043
+ queue.push(join4(current, child.name));
1925
2044
  budget -= 1;
1926
2045
  }
1927
2046
  } catch {
@@ -1938,8 +2057,8 @@ function isFreshWithin(path, cutoff) {
1938
2057
  function syncMcpToProject(codeName) {
1939
2058
  const agentDir = getAgentDir(codeName);
1940
2059
  const projectDir = getProjectDir2(codeName);
1941
- const provisionMcpPath = join3(agentDir, "provision", ".mcp.json");
1942
- const projectMcpPath = join3(projectDir, ".mcp.json");
2060
+ const provisionMcpPath = join4(agentDir, "provision", ".mcp.json");
2061
+ const projectMcpPath = join4(projectDir, ".mcp.json");
1943
2062
  try {
1944
2063
  const content = readFileSync4(provisionMcpPath, "utf-8");
1945
2064
  mkdirSync3(projectDir, { recursive: true });
@@ -1963,7 +2082,7 @@ function syncMcpToProject(codeName) {
1963
2082
  }
1964
2083
  var INTEGRATIONS_SUMMARY_FILE = "integrations-summary.json";
1965
2084
  function integrationsSummaryPath(codeName) {
1966
- return join3(getAgentDir(codeName), "provision", INTEGRATIONS_SUMMARY_FILE);
2085
+ return join4(getAgentDir(codeName), "provision", INTEGRATIONS_SUMMARY_FILE);
1967
2086
  }
1968
2087
  function writeIntegrationsSummaryForAgent(codeName, summaries) {
1969
2088
  const target = integrationsSummaryPath(codeName);
@@ -1985,7 +2104,7 @@ function readIntegrationsSummaryForAgent(codeName) {
1985
2104
  function renderChannelMessageHandlerForAgent(codeName) {
1986
2105
  const agentDir = getAgentDir(codeName);
1987
2106
  const projectDir = getProjectDir2(codeName);
1988
- const provisionMcpPath = join3(agentDir, "provision", ".mcp.json");
2107
+ const provisionMcpPath = join4(agentDir, "provision", ".mcp.json");
1989
2108
  let mcpServerKeys;
1990
2109
  try {
1991
2110
  const config = JSON.parse(readFileSync4(provisionMcpPath, "utf-8"));
@@ -1996,7 +2115,7 @@ function renderChannelMessageHandlerForAgent(codeName) {
1996
2115
  const integrations = readIntegrationsSummaryForAgent(codeName);
1997
2116
  const content = buildChannelMessageHandlerAgent({ mcpServerKeys, integrations });
1998
2117
  for (const baseDir of [agentDir, projectDir]) {
1999
- const target = join3(baseDir, ".claude", "agents", "channel-message-handler.md");
2118
+ const target = join4(baseDir, ".claude", "agents", "channel-message-handler.md");
2000
2119
  try {
2001
2120
  mkdirSync3(dirname3(target), { recursive: true });
2002
2121
  writeFileSync4(target, content);
@@ -2014,7 +2133,7 @@ function writeMcpJsonGuarded(codeName, path, config) {
2014
2133
  return true;
2015
2134
  }
2016
2135
  function readExistingMcpEnvVar(codeName, serverId, envKey) {
2017
- const mcpJsonPath = join3(getAgentDir(codeName), "provision", ".mcp.json");
2136
+ const mcpJsonPath = join4(getAgentDir(codeName), "provision", ".mcp.json");
2018
2137
  try {
2019
2138
  const raw = readFileSync4(mcpJsonPath, "utf-8");
2020
2139
  const config = JSON.parse(raw);
@@ -2044,7 +2163,7 @@ function resolveBrokerAgentId(codeName, fallback) {
2044
2163
  return void 0;
2045
2164
  }
2046
2165
  function ensureWorkspaceTrusted(projectDir) {
2047
- const configPath = join3(homedir3(), ".claude.json");
2166
+ const configPath = join4(homedir3(), ".claude.json");
2048
2167
  try {
2049
2168
  let config = {};
2050
2169
  if (existsSync4(configPath)) {
@@ -2088,8 +2207,8 @@ function deployArtifactsToProject(codeName, provisionDir) {
2088
2207
  const SKILLS_START = "<!-- AGT:SKILLS_INDEX_START -->";
2089
2208
  const SKILLS_END = "<!-- AGT:SKILLS_INDEX_END -->";
2090
2209
  for (const file of artifactFiles) {
2091
- const src = join3(provisionDir, file);
2092
- const dest = join3(projectDir, file);
2210
+ const src = join4(provisionDir, file);
2211
+ const dest = join4(projectDir, file);
2093
2212
  try {
2094
2213
  const srcContent = readFileSync4(src, "utf-8");
2095
2214
  if (file === "CLAUDE.md" && existsSync4(dest)) {
@@ -2115,15 +2234,15 @@ function deployArtifactsToProject(codeName, provisionDir) {
2115
2234
  } catch {
2116
2235
  }
2117
2236
  }
2118
- const skillsDir = join3(provisionDir, ".claude", "skills");
2119
- const destSkillsDir = join3(projectDir, ".claude", "skills");
2237
+ const skillsDir = join4(provisionDir, ".claude", "skills");
2238
+ const destSkillsDir = join4(projectDir, ".claude", "skills");
2120
2239
  try {
2121
2240
  if (existsSync4(destSkillsDir)) {
2122
2241
  const srcFolders = existsSync4(skillsDir) ? new Set(readdirSync(skillsDir)) : /* @__PURE__ */ new Set();
2123
2242
  for (const folder of readdirSync(destSkillsDir)) {
2124
2243
  if (folder.startsWith("knowledge-") || folder === "core-knowledge" && !srcFolders.has(folder)) {
2125
2244
  try {
2126
- rmSync2(join3(destSkillsDir, folder), { recursive: true });
2245
+ rmSync2(join4(destSkillsDir, folder), { recursive: true });
2127
2246
  } catch {
2128
2247
  }
2129
2248
  }
@@ -2131,11 +2250,11 @@ function deployArtifactsToProject(codeName, provisionDir) {
2131
2250
  }
2132
2251
  if (existsSync4(skillsDir)) {
2133
2252
  for (const skillFolder of readdirSync(skillsDir)) {
2134
- const srcSkillFile = join3(skillsDir, skillFolder, "SKILL.md");
2253
+ const srcSkillFile = join4(skillsDir, skillFolder, "SKILL.md");
2135
2254
  if (!existsSync4(srcSkillFile))
2136
2255
  continue;
2137
- const destFolder = join3(destSkillsDir, skillFolder);
2138
- const destFile = join3(destFolder, "SKILL.md");
2256
+ const destFolder = join4(destSkillsDir, skillFolder);
2257
+ const destFile = join4(destFolder, "SKILL.md");
2139
2258
  const srcContent = readFileSync4(srcSkillFile, "utf-8");
2140
2259
  try {
2141
2260
  if (existsSync4(destFile) && readFileSync4(destFile, "utf-8") === srcContent)
@@ -2148,8 +2267,8 @@ function deployArtifactsToProject(codeName, provisionDir) {
2148
2267
  }
2149
2268
  } catch {
2150
2269
  }
2151
- const agentsDir = join3(provisionDir, ".claude", "agents");
2152
- const destAgentsDir = join3(projectDir, ".claude", "agents");
2270
+ const agentsDir = join4(provisionDir, ".claude", "agents");
2271
+ const destAgentsDir = join4(projectDir, ".claude", "agents");
2153
2272
  try {
2154
2273
  if (existsSync4(agentsDir)) {
2155
2274
  const sourceAgentFiles = new Set(readdirSync(agentsDir).filter((f) => f.endsWith(".md")));
@@ -2160,14 +2279,14 @@ function deployArtifactsToProject(codeName, provisionDir) {
2160
2279
  if (sourceAgentFiles.has(destFile))
2161
2280
  continue;
2162
2281
  try {
2163
- rmSync2(join3(destAgentsDir, destFile));
2282
+ rmSync2(join4(destAgentsDir, destFile));
2164
2283
  } catch {
2165
2284
  }
2166
2285
  }
2167
2286
  }
2168
2287
  for (const agentFile of sourceAgentFiles) {
2169
- const srcPath = join3(agentsDir, agentFile);
2170
- const destPath = join3(destAgentsDir, agentFile);
2288
+ const srcPath = join4(agentsDir, agentFile);
2289
+ const destPath = join4(destAgentsDir, agentFile);
2171
2290
  const srcContent = readFileSync4(srcPath, "utf-8");
2172
2291
  try {
2173
2292
  if (existsSync4(destPath) && readFileSync4(destPath, "utf-8") === srcContent)
@@ -2180,8 +2299,8 @@ function deployArtifactsToProject(codeName, provisionDir) {
2180
2299
  }
2181
2300
  } catch {
2182
2301
  }
2183
- const workflowsDir = join3(provisionDir, ".claude", "workflows");
2184
- const destWorkflowsDir = join3(projectDir, ".claude", "workflows");
2302
+ const workflowsDir = join4(provisionDir, ".claude", "workflows");
2303
+ const destWorkflowsDir = join4(projectDir, ".claude", "workflows");
2185
2304
  try {
2186
2305
  const sourceWorkflowFiles = existsSync4(workflowsDir) ? new Set(readdirSync(workflowsDir).filter((f) => f.endsWith(".js"))) : /* @__PURE__ */ new Set();
2187
2306
  if (existsSync4(destWorkflowsDir)) {
@@ -2191,14 +2310,14 @@ function deployArtifactsToProject(codeName, provisionDir) {
2191
2310
  if (sourceWorkflowFiles.has(destFile))
2192
2311
  continue;
2193
2312
  try {
2194
- rmSync2(join3(destWorkflowsDir, destFile));
2313
+ rmSync2(join4(destWorkflowsDir, destFile));
2195
2314
  } catch {
2196
2315
  }
2197
2316
  }
2198
2317
  }
2199
2318
  for (const workflowFile of sourceWorkflowFiles) {
2200
- const srcPath = join3(workflowsDir, workflowFile);
2201
- const destPath = join3(destWorkflowsDir, workflowFile);
2319
+ const srcPath = join4(workflowsDir, workflowFile);
2320
+ const destPath = join4(destWorkflowsDir, workflowFile);
2202
2321
  const srcContent = readFileSync4(srcPath, "utf-8");
2203
2322
  try {
2204
2323
  if (existsSync4(destPath) && readFileSync4(destPath, "utf-8") === srcContent)
@@ -2210,8 +2329,8 @@ function deployArtifactsToProject(codeName, provisionDir) {
2210
2329
  }
2211
2330
  } catch {
2212
2331
  }
2213
- const agentMcpPath = join3(getAgentDir(codeName), "provision", ".mcp.json");
2214
- const projectMcpPath = join3(projectDir, ".mcp.json");
2332
+ const agentMcpPath = join4(getAgentDir(codeName), "provision", ".mcp.json");
2333
+ const projectMcpPath = join4(projectDir, ".mcp.json");
2215
2334
  try {
2216
2335
  const agentMcp = JSON.parse(readFileSync4(agentMcpPath, "utf-8"));
2217
2336
  let projectMcp;
@@ -2237,8 +2356,8 @@ function deployArtifactsToProject(codeName, provisionDir) {
2237
2356
  const agentDir = getAgentDir(codeName);
2238
2357
  for (const envFile of [".env", ".env.integrations"]) {
2239
2358
  try {
2240
- const content = readFileSync4(join3(agentDir, envFile), "utf-8");
2241
- const envDest = join3(projectDir, envFile);
2359
+ const content = readFileSync4(join4(agentDir, envFile), "utf-8");
2360
+ const envDest = join4(projectDir, envFile);
2242
2361
  writeFileSync4(envDest, content, { mode: SECRET_FILE_MODE });
2243
2362
  try {
2244
2363
  chmodSync4(envDest, SECRET_FILE_MODE);
@@ -2248,12 +2367,12 @@ function deployArtifactsToProject(codeName, provisionDir) {
2248
2367
  }
2249
2368
  }
2250
2369
  try {
2251
- const gitDir = join3(projectDir, ".git");
2252
- const hookSrc = join3(provisionDir, ".git-hooks", "pre-commit");
2370
+ const gitDir = join4(projectDir, ".git");
2371
+ const hookSrc = join4(provisionDir, ".git-hooks", "pre-commit");
2253
2372
  if (existsSync4(gitDir) && existsSync4(hookSrc)) {
2254
- const hooksDir = join3(gitDir, "hooks");
2373
+ const hooksDir = join4(gitDir, "hooks");
2255
2374
  mkdirSync3(hooksDir, { recursive: true });
2256
- const hookDest = join3(hooksDir, "pre-commit");
2375
+ const hookDest = join4(hooksDir, "pre-commit");
2257
2376
  const srcContent = readFileSync4(hookSrc, "utf-8");
2258
2377
  const upToDate = existsSync4(hookDest) && readFileSync4(hookDest, "utf-8") === srcContent;
2259
2378
  if (!upToDate)
@@ -2265,9 +2384,9 @@ function deployArtifactsToProject(codeName, provisionDir) {
2265
2384
  }
2266
2385
  function provisionStopHook(codeName) {
2267
2386
  const projectDir = getProjectDir2(codeName);
2268
- const claudeDir = join3(projectDir, ".claude");
2387
+ const claudeDir = join4(projectDir, ".claude");
2269
2388
  mkdirSync3(claudeDir, { recursive: true });
2270
- const hookScriptPath = join3(claudeDir, "agt-stop-hook.sh");
2389
+ const hookScriptPath = join4(claudeDir, "agt-stop-hook.sh");
2271
2390
  const hookScript = [
2272
2391
  "#!/bin/bash",
2273
2392
  "# Auto-generated by Augmented \u2014 captures persistent session task results.",
@@ -2299,7 +2418,7 @@ function provisionStopHook(codeName) {
2299
2418
  "exit 0"
2300
2419
  ].join("\n") + "\n";
2301
2420
  writeFileSync4(hookScriptPath, hookScript, { mode: 493 });
2302
- const ghostHookPath = join3(claudeDir, "agt-ghost-reply-hook.sh");
2421
+ const ghostHookPath = join4(claudeDir, "agt-ghost-reply-hook.sh");
2303
2422
  const jqNormalizeContent = '(.message.content // .content // []) | if type == "string" then [{type: "text", text: .}] elif type == "array" then . else [] end';
2304
2423
  const ghostHookScript = [
2305
2424
  "#!/bin/bash",
@@ -3188,7 +3307,7 @@ function provisionStopHook(codeName) {
3188
3307
  ].join("\n") + "\n";
3189
3308
  writeFileSync4(ghostHookPath, ghostHookScript, { mode: 493 });
3190
3309
  const backlogHookPath = provisionBacklogPullHook(codeName);
3191
- const settingsPath = join3(claudeDir, "settings.local.json");
3310
+ const settingsPath = join4(claudeDir, "settings.local.json");
3192
3311
  let settings = {};
3193
3312
  try {
3194
3313
  settings = JSON.parse(readFileSync4(settingsPath, "utf-8"));
@@ -3209,17 +3328,17 @@ function provisionStopHook(codeName) {
3209
3328
  }
3210
3329
  function provisionIsolationHook(codeName, agentId) {
3211
3330
  const projectDir = getProjectDir2(codeName);
3212
- const claudeDir = join3(projectDir, ".claude");
3331
+ const claudeDir = join4(projectDir, ".claude");
3213
3332
  mkdirSync3(claudeDir, { recursive: true });
3214
3333
  const hasAgentId = agentId !== void 0;
3215
3334
  if (hasAgentId)
3216
3335
  assertValidAgentId(agentId);
3217
3336
  const homeDir = getHomeDir();
3218
- const augmentedBase = join3(homeDir, ".augmented");
3337
+ const augmentedBase = join4(homeDir, ".augmented");
3219
3338
  const ownAgentDir = getAgentDir(codeName);
3220
- const logFile = join3(ownAgentDir, "isolation.log");
3339
+ const logFile = join4(ownAgentDir, "isolation.log");
3221
3340
  const idAllowClause = hasAgentId ? ` && [ "$AGENT_DIR" != "${agentId}" ]` : "";
3222
- const hookScriptPath = join3(claudeDir, "agt-isolation-hook.sh");
3341
+ const hookScriptPath = join4(claudeDir, "agt-isolation-hook.sh");
3223
3342
  const hookScript = [
3224
3343
  "#!/bin/bash",
3225
3344
  "# Auto-generated by Augmented \u2014 prevents cross-agent file access.",
@@ -3273,7 +3392,7 @@ function provisionIsolationHook(codeName, agentId) {
3273
3392
  "exit 0"
3274
3393
  ].join("\n") + "\n";
3275
3394
  writeFileSync4(hookScriptPath, hookScript, { mode: 493 });
3276
- const settingsPath = join3(claudeDir, "settings.local.json");
3395
+ const settingsPath = join4(claudeDir, "settings.local.json");
3277
3396
  let settings = {};
3278
3397
  try {
3279
3398
  settings = JSON.parse(readFileSync4(settingsPath, "utf-8"));
@@ -3295,9 +3414,9 @@ function provisionIsolationHook(codeName, agentId) {
3295
3414
  }
3296
3415
  function provisionBacklogPullHook(codeName) {
3297
3416
  const projectDir = getProjectDir2(codeName);
3298
- const claudeDir = join3(projectDir, ".claude");
3417
+ const claudeDir = join4(projectDir, ".claude");
3299
3418
  mkdirSync3(claudeDir, { recursive: true });
3300
- const hookScriptPath = join3(claudeDir, "agt-backlog-pull-hook.sh");
3419
+ const hookScriptPath = join4(claudeDir, "agt-backlog-pull-hook.sh");
3301
3420
  const hookScript = `#!/usr/bin/env bash
3302
3421
  # Auto-generated by Augmented (CS-1549) \u2014 Stop hook: don't end a turn idle
3303
3422
  # beside a non-empty backlog. Fail-open on every path; blocks at most once per
@@ -3464,9 +3583,9 @@ exit 0
3464
3583
  }
3465
3584
  function provisionAutoKanbanProgressHook(codeName) {
3466
3585
  const projectDir = getProjectDir2(codeName);
3467
- const claudeDir = join3(projectDir, ".claude");
3586
+ const claudeDir = join4(projectDir, ".claude");
3468
3587
  mkdirSync3(claudeDir, { recursive: true });
3469
- const hookScriptPath = join3(claudeDir, "agt-auto-kanban-progress-hook.sh");
3588
+ const hookScriptPath = join4(claudeDir, "agt-auto-kanban-progress-hook.sh");
3470
3589
  const hookScript = `#!/usr/bin/env bash
3471
3590
  # Auto-generated by Augmented (ENG-6179 / ENG-6241) \u2014 PostToolUse auto-progress.
3472
3591
  # Maps the agent's latest tool action onto its active in-thread kanban progress
@@ -3575,7 +3694,7 @@ BODY="$(jq -nc --arg a "$AGENT_ID" --arg s "$STEP" '{agent_id:$a, step:$s}' 2>/d
3575
3694
  exit 0
3576
3695
  `;
3577
3696
  writeFileSync4(hookScriptPath, hookScript, { mode: 493 });
3578
- const settingsPath = join3(claudeDir, "settings.local.json");
3697
+ const settingsPath = join4(claudeDir, "settings.local.json");
3579
3698
  let settings = {};
3580
3699
  try {
3581
3700
  settings = JSON.parse(readFileSync4(settingsPath, "utf-8"));
@@ -3594,9 +3713,9 @@ exit 0
3594
3713
  }
3595
3714
  function provisionChannelProgressHook(codeName) {
3596
3715
  const projectDir = getProjectDir2(codeName);
3597
- const claudeDir = join3(projectDir, ".claude");
3716
+ const claudeDir = join4(projectDir, ".claude");
3598
3717
  mkdirSync3(claudeDir, { recursive: true });
3599
- const hookScriptPath = join3(claudeDir, "agt-channel-progress-hook.sh");
3718
+ const hookScriptPath = join4(claudeDir, "agt-channel-progress-hook.sh");
3600
3719
  const hookScript = `#!/usr/bin/env bash
3601
3720
  # Auto-generated by Augmented (ENG-6567 Phase 2) \u2014 PostToolUse channel-progress
3602
3721
  # heartbeat. Writes a throttled local {step, updated_at_ms} the channel MCP reads
@@ -3664,7 +3783,7 @@ fi
3664
3783
  exit 0
3665
3784
  `;
3666
3785
  writeFileSync4(hookScriptPath, hookScript, { mode: 493 });
3667
- const settingsPath = join3(claudeDir, "settings.local.json");
3786
+ const settingsPath = join4(claudeDir, "settings.local.json");
3668
3787
  let settings = {};
3669
3788
  try {
3670
3789
  settings = JSON.parse(readFileSync4(settingsPath, "utf-8"));
@@ -3687,11 +3806,11 @@ exit 0
3687
3806
  }
3688
3807
  function provisionOrientHook(codeName) {
3689
3808
  const projectDir = getProjectDir2(codeName);
3690
- const claudeDir = join3(projectDir, ".claude");
3809
+ const claudeDir = join4(projectDir, ".claude");
3691
3810
  mkdirSync3(claudeDir, { recursive: true });
3692
3811
  const agentDir = getAgentDir(codeName);
3693
- const codeRoots = [join3(getHomeDir(), "code"), join3(agentDir, "code")];
3694
- const hookScriptPath = join3(claudeDir, "agt-orient-hook.sh");
3812
+ const codeRoots = [join4(getHomeDir(), "code"), join4(agentDir, "code")];
3813
+ const hookScriptPath = join4(claudeDir, "agt-orient-hook.sh");
3695
3814
  const hookScript = [
3696
3815
  "#!/bin/bash",
3697
3816
  "# Auto-generated by Augmented (ENG-5397) \u2014 SessionStart orientation hook.",
@@ -3964,7 +4083,7 @@ function provisionOrientHook(codeName) {
3964
4083
  "exit 0"
3965
4084
  ].join("\n") + "\n";
3966
4085
  writeFileSync4(hookScriptPath, hookScript, { mode: 493 });
3967
- const settingsPath = join3(claudeDir, "settings.local.json");
4086
+ const settingsPath = join4(claudeDir, "settings.local.json");
3968
4087
  let settings = {};
3969
4088
  try {
3970
4089
  settings = JSON.parse(readFileSync4(settingsPath, "utf-8"));
@@ -3991,11 +4110,11 @@ function provisionOrientHook(codeName) {
3991
4110
  }
3992
4111
  function provisionPreCompactHook(codeName) {
3993
4112
  const projectDir = getProjectDir2(codeName);
3994
- const claudeDir = join3(projectDir, ".claude");
4113
+ const claudeDir = join4(projectDir, ".claude");
3995
4114
  mkdirSync3(claudeDir, { recursive: true });
3996
4115
  const agentDir = getAgentDir(codeName);
3997
4116
  const jqNormalizeContent = '(.message.content // .content // []) | if type == "string" then [{type: "text", text: .}] elif type == "array" then . else [] end';
3998
- const hookScriptPath = join3(claudeDir, "agt-pre-compact-hook.sh");
4117
+ const hookScriptPath = join4(claudeDir, "agt-pre-compact-hook.sh");
3999
4118
  const hookScript = [
4000
4119
  "#!/bin/bash",
4001
4120
  "# Auto-generated by Augmented (ENG-7339) - PreCompact courtesy notice.",
@@ -4101,7 +4220,7 @@ function provisionPreCompactHook(codeName) {
4101
4220
  ].join("\n") + "\n";
4102
4221
  writeFileSync4(hookScriptPath, hookScript, { mode: 493 });
4103
4222
  chmodSync4(hookScriptPath, 493);
4104
- const settingsPath = join3(claudeDir, "settings.local.json");
4223
+ const settingsPath = join4(claudeDir, "settings.local.json");
4105
4224
  let settings = {};
4106
4225
  try {
4107
4226
  settings = JSON.parse(readFileSync4(settingsPath, "utf-8"));
@@ -4128,10 +4247,10 @@ function provisionPreCompactHook(codeName) {
4128
4247
  }
4129
4248
  function provisionSessionStateHook(codeName) {
4130
4249
  const projectDir = getProjectDir2(codeName);
4131
- const claudeDir = join3(projectDir, ".claude");
4250
+ const claudeDir = join4(projectDir, ".claude");
4132
4251
  mkdirSync3(claudeDir, { recursive: true });
4133
4252
  const agentDir = getAgentDir(codeName);
4134
- const hookScriptPath = join3(claudeDir, "agt-session-state-hook.sh");
4253
+ const hookScriptPath = join4(claudeDir, "agt-session-state-hook.sh");
4135
4254
  const hookScript = `#!/usr/bin/env bash
4136
4255
  # Auto-generated by Augmented (ENG-6233 / ENG-6268) \u2014 SessionStart session-state
4137
4256
  # recorder. Writes the model + session origin (which only the agent's own
@@ -4209,7 +4328,7 @@ fi
4209
4328
  exit 0
4210
4329
  `;
4211
4330
  writeFileSync4(hookScriptPath, hookScript, { mode: 493 });
4212
- const settingsPath = join3(claudeDir, "settings.local.json");
4331
+ const settingsPath = join4(claudeDir, "settings.local.json");
4213
4332
  let settings = {};
4214
4333
  try {
4215
4334
  settings = JSON.parse(readFileSync4(settingsPath, "utf-8"));
@@ -4343,7 +4462,7 @@ function buildSettingsJson(input) {
4343
4462
  const projectDir = getProjectDir2(agent.code_name);
4344
4463
  const agentDir = getAgentDir(agent.code_name);
4345
4464
  const homeDir = getHomeDir();
4346
- const codenameAliasDir = join3(homeDir, ".augmented", agent.code_name);
4465
+ const codenameAliasDir = join4(homeDir, ".augmented", agent.code_name);
4347
4466
  settings["allowedDirectories"] = [
4348
4467
  .../* @__PURE__ */ new Set([
4349
4468
  projectDir,
@@ -4352,7 +4471,7 @@ function buildSettingsJson(input) {
4352
4471
  // Agent's config dir (.env, schedules, registration)
4353
4472
  codenameAliasDir,
4354
4473
  // Codename symlink alias (== agentDir for legacy agents)
4355
- join3(homeDir, ".augmented", "_mcp"),
4474
+ join4(homeDir, ".augmented", "_mcp"),
4356
4475
  // Shared MCP binaries
4357
4476
  "/tmp"
4358
4477
  // Temp files
@@ -4470,7 +4589,7 @@ ${integrationsBlock}`;
4470
4589
  function renderAugmentedWorkerForAgent(codeName) {
4471
4590
  const agentDir = getAgentDir(codeName);
4472
4591
  const projectDir = getProjectDir2(codeName);
4473
- const provisionMcpPath = join3(agentDir, "provision", ".mcp.json");
4592
+ const provisionMcpPath = join4(agentDir, "provision", ".mcp.json");
4474
4593
  let mcpServerKeys;
4475
4594
  try {
4476
4595
  const config = JSON.parse(readFileSync4(provisionMcpPath, "utf-8"));
@@ -4481,7 +4600,7 @@ function renderAugmentedWorkerForAgent(codeName) {
4481
4600
  const integrations = readIntegrationsSummaryForAgent(codeName);
4482
4601
  const content = buildAugmentedWorkerAgent({ mcpServerKeys, integrations });
4483
4602
  for (const baseDir of [agentDir, projectDir]) {
4484
- const target = join3(baseDir, ".claude", "agents", "augmented-worker.md");
4603
+ const target = join4(baseDir, ".claude", "agents", "augmented-worker.md");
4485
4604
  try {
4486
4605
  mkdirSync3(dirname3(target), { recursive: true });
4487
4606
  writeFileSync4(target, content);
@@ -4510,8 +4629,8 @@ function buildPostizMcpEntry(integration) {
4510
4629
  }
4511
4630
  function buildMcpJson(input) {
4512
4631
  const mcpServers = {};
4513
- const turnInitiatorFile = join3(getAgentDir(input.agent.code_name), ".current-turn-initiator.json");
4514
- const localMcpPath = join3(getHomeDir(), ".augmented", "_mcp", "index.js");
4632
+ const turnInitiatorFile = join4(getAgentDir(input.agent.code_name), ".current-turn-initiator.json");
4633
+ const localMcpPath = join4(getHomeDir(), ".augmented", "_mcp", "index.js");
4515
4634
  mcpServers["augmented"] = {
4516
4635
  command: "node",
4517
4636
  args: [localMcpPath],
@@ -4563,7 +4682,7 @@ function buildMcpJson(input) {
4563
4682
  const xeroIntegration = input.integrations?.find((i) => i.definition_id === "xero");
4564
4683
  if (xeroIntegration) {
4565
4684
  const brokerMode = Boolean(xeroIntegration.id);
4566
- const localXeroMcpPath = join3(getHomeDir(), ".augmented", "_mcp", "xero.js");
4685
+ const localXeroMcpPath = join4(getHomeDir(), ".augmented", "_mcp", "xero.js");
4567
4686
  mcpServers["xero"] = {
4568
4687
  command: "node",
4569
4688
  args: [localXeroMcpPath],
@@ -4603,7 +4722,7 @@ function buildMcpJson(input) {
4603
4722
  // getProjectDir (the ADR-0049 seam), not the MCP child's inherited
4604
4723
  // cwd, so the path stays correct if Claude Code ever spawns the
4605
4724
  // server from somewhere else.
4606
- XERO_EXPORT_DIR: join3(getProjectDir2(input.agent.code_name), "xero-exports"),
4725
+ XERO_EXPORT_DIR: join4(getProjectDir2(input.agent.code_name), "xero-exports"),
4607
4726
  PATH: process.env["PATH"] ?? "",
4608
4727
  HOME: process.env["HOME"] ?? ""
4609
4728
  }
@@ -4614,8 +4733,8 @@ function buildMcpJson(input) {
4614
4733
  mcpServers["postiz"] = buildPostizMcpEntry(postizIntegration);
4615
4734
  }
4616
4735
  const remoteOAuthProxyPaths = {
4617
- proxyPath: join3(getHomeDir(), ".augmented", "_mcp", "remote-oauth-proxy.js"),
4618
- tokenFile: join3(getProjectDir2(input.agent.code_name), ".env.integrations")
4736
+ proxyPath: join4(getHomeDir(), ".augmented", "_mcp", "remote-oauth-proxy.js"),
4737
+ tokenFile: join4(getProjectDir2(input.agent.code_name), ".env.integrations")
4619
4738
  };
4620
4739
  for (const integration of input.integrations ?? []) {
4621
4740
  const connectionKey = integration.connection_key;
@@ -4681,7 +4800,7 @@ function buildMcpJson(input) {
4681
4800
  }
4682
4801
  const hasAdminDebug = input.integrations?.some((i) => i.definition_id === "augmented-admin") ?? false;
4683
4802
  if (hasAdminDebug) {
4684
- const localAdminMcpPath = join3(getHomeDir(), ".augmented", "_mcp", "augmented-admin.js");
4803
+ const localAdminMcpPath = join4(getHomeDir(), ".augmented", "_mcp", "augmented-admin.js");
4685
4804
  mcpServers["augmented-admin"] = {
4686
4805
  command: "node",
4687
4806
  args: [localAdminMcpPath],
@@ -4695,7 +4814,7 @@ function buildMcpJson(input) {
4695
4814
  }
4696
4815
  const hasSupport = input.integrations?.some((i) => i.definition_id === "augmented-support") ?? false;
4697
4816
  if (hasSupport) {
4698
- const localSupportMcpPath = join3(getHomeDir(), ".augmented", "_mcp", "augmented-support.js");
4817
+ const localSupportMcpPath = join4(getHomeDir(), ".augmented", "_mcp", "augmented-support.js");
4699
4818
  mcpServers["augmented-support"] = {
4700
4819
  command: "node",
4701
4820
  args: [localSupportMcpPath],
@@ -4709,7 +4828,7 @@ function buildMcpJson(input) {
4709
4828
  }
4710
4829
  const hasHelpKb = input.integrations?.some((i) => i.definition_id === "augmented-help-kb") ?? false;
4711
4830
  if (hasHelpKb) {
4712
- const localHelpKbMcpPath = join3(getHomeDir(), ".augmented", "_mcp", "augmented-help-kb.js");
4831
+ const localHelpKbMcpPath = join4(getHomeDir(), ".augmented", "_mcp", "augmented-help-kb.js");
4713
4832
  mcpServers["augmented-help-kb"] = {
4714
4833
  command: "node",
4715
4834
  args: [localHelpKbMcpPath],
@@ -4723,7 +4842,7 @@ function buildMcpJson(input) {
4723
4842
  }
4724
4843
  const origamiIntegration = input.integrations?.find((i) => i.definition_id === "origami");
4725
4844
  if (origamiIntegration?.stdioMcp === true && origamiIntegration.id) {
4726
- const localOrigamiMcpPath = join3(getHomeDir(), ".augmented", "_mcp", "origami.js");
4845
+ const localOrigamiMcpPath = join4(getHomeDir(), ".augmented", "_mcp", "origami.js");
4727
4846
  mcpServers["origami"] = {
4728
4847
  command: "node",
4729
4848
  args: [localOrigamiMcpPath],
@@ -4736,6 +4855,21 @@ function buildMcpJson(input) {
4736
4855
  }
4737
4856
  };
4738
4857
  }
4858
+ const computerUseIntegration = input.integrations?.find((i) => i.definition_id === COMPUTER_USE_DEFINITION_ID);
4859
+ if (computerUseIntegration) {
4860
+ const rendered = buildComputerUseMcpEntry({
4861
+ agentId: input.agent.agent_id,
4862
+ agentCodeName: input.agent.code_name,
4863
+ config: computerUseIntegration.config,
4864
+ proxyPath: join4(getHomeDir(), ".augmented", "_mcp", "computer-use-proxy.js"),
4865
+ agentDir: getAgentDir(input.agent.code_name)
4866
+ });
4867
+ if (rendered.entry) {
4868
+ mcpServers[COMPUTER_USE_MCP_KEY] = rendered.entry;
4869
+ } else {
4870
+ console.warn(`[claudecode] ${rendered.problem}`);
4871
+ }
4872
+ }
4739
4873
  return { mcpServers };
4740
4874
  }
4741
4875
  function reconstructQuarantinedMcpServerEntry(agent, integration) {
@@ -4972,14 +5106,14 @@ ${sections}`
4972
5106
  },
4973
5107
  async getRegisteredAgents(_profile) {
4974
5108
  const homeDir = getHomeDir();
4975
- const augDir = join3(homeDir, ".augmented");
5109
+ const augDir = join4(homeDir, ".augmented");
4976
5110
  const agents = /* @__PURE__ */ new Set();
4977
5111
  try {
4978
5112
  const entries = readdirSync(augDir);
4979
5113
  for (const entry of entries) {
4980
5114
  if (entry.startsWith("_") || entry.startsWith("."))
4981
5115
  continue;
4982
- const agentRoot = join3(augDir, entry);
5116
+ const agentRoot = join4(augDir, entry);
4983
5117
  let st;
4984
5118
  try {
4985
5119
  st = lstatSync(agentRoot);
@@ -4988,11 +5122,11 @@ ${sections}`
4988
5122
  }
4989
5123
  if (st.isSymbolicLink() || !st.isDirectory())
4990
5124
  continue;
4991
- if (!existsSync4(join3(agentRoot, "registration.json")))
5125
+ if (!existsSync4(join4(agentRoot, "registration.json")))
4992
5126
  continue;
4993
5127
  let codeName = entry;
4994
5128
  try {
4995
- const reg = JSON.parse(readFileSync4(join3(agentRoot, "registration.json"), "utf8"));
5129
+ const reg = JSON.parse(readFileSync4(join4(agentRoot, "registration.json"), "utf8"));
4996
5130
  if (reg && typeof reg.code_name === "string" && reg.code_name) {
4997
5131
  codeName = reg.code_name;
4998
5132
  }
@@ -5013,7 +5147,7 @@ ${sections}`
5013
5147
  const projectDir = getProjectDir2(codeName);
5014
5148
  mkdirSync3(agentDir, { recursive: true });
5015
5149
  mkdirSync3(projectDir, { recursive: true });
5016
- writeFileSync4(join3(agentDir, "registration.json"), JSON.stringify({
5150
+ writeFileSync4(join4(agentDir, "registration.json"), JSON.stringify({
5017
5151
  code_name: codeName,
5018
5152
  agent_id: agentId ?? null,
5019
5153
  team_dir: teamDir,
@@ -5032,7 +5166,7 @@ ${sections}`
5032
5166
  async deregisterAgent(codeName) {
5033
5167
  try {
5034
5168
  const agentDir = getAgentDir(codeName);
5035
- const regFile = join3(agentDir, "registration.json");
5169
+ const regFile = join4(agentDir, "registration.json");
5036
5170
  if (existsSync4(regFile)) {
5037
5171
  const { unlinkSync: unlinkSync5 } = await import("fs");
5038
5172
  unlinkSync5(regFile);
@@ -5058,7 +5192,7 @@ ${sections}`
5058
5192
  }
5059
5193
  }
5060
5194
  if (envLines.length > 1) {
5061
- const envPath = join3(agentDir, ".env");
5195
+ const envPath = join4(agentDir, ".env");
5062
5196
  writeFileSync4(envPath, envLines.join("\n") + "\n");
5063
5197
  chmodSync4(envPath, SECRET_FILE_MODE);
5064
5198
  }
@@ -5120,7 +5254,7 @@ ${sections}`
5120
5254
  if (!botToken)
5121
5255
  return missingCredentialField("bot_token");
5122
5256
  const allowedChats = config["allowed_chats"];
5123
- const localTelegramChannel = join3(getHomeDir(), ".augmented", "_mcp", "telegram-channel.js");
5257
+ const localTelegramChannel = join4(getHomeDir(), ".augmented", "_mcp", "telegram-channel.js");
5124
5258
  const resolvedAgtHostForTelegram = process.env["AGT_HOST"]?.trim() || "https://api.augmented.team";
5125
5259
  const resolvedAgtApiKeyForTelegram = process.env["AGT_API_KEY"]?.trim();
5126
5260
  writeEnvIntegrationsForAgent(codeName, {
@@ -5135,7 +5269,7 @@ ${sections}`
5135
5269
  ...options?.agentId ? { AGT_AGENT_ID: options.agentId } : {},
5136
5270
  ...tzEnv,
5137
5271
  // ENG-6582 (D16): stamp the verified turn initiator for broker MCPs.
5138
- AGT_TURN_INITIATOR_FILE: join3(getAgentDir(codeName), ".current-turn-initiator.json")
5272
+ AGT_TURN_INITIATOR_FILE: join4(getAgentDir(codeName), ".current-turn-initiator.json")
5139
5273
  };
5140
5274
  if (allowedChats && allowedChats.length > 0) {
5141
5275
  telegramEnv.TELEGRAM_ALLOWED_CHATS = allowedChats.join(",");
@@ -5198,7 +5332,7 @@ ${sections}`
5198
5332
  args: [localTelegramChannel],
5199
5333
  env: telegramEnv
5200
5334
  };
5201
- const provisionMcpPath = join3(agentDir, "provision", ".mcp.json");
5335
+ const provisionMcpPath = join4(agentDir, "provision", ".mcp.json");
5202
5336
  mkdirSync3(dirname3(provisionMcpPath), { recursive: true });
5203
5337
  let mcpConfig2 = { mcpServers: {} };
5204
5338
  try {
@@ -5216,13 +5350,13 @@ ${sections}`
5216
5350
  }
5217
5351
  if (isPersistent && (channelId === "discord" || channelId === "slack")) {
5218
5352
  let wrotePersistentCredential = false;
5219
- const channelDir = join3(getHomeDir(), ".claude", "channels", channelId);
5353
+ const channelDir = join4(getHomeDir(), ".claude", "channels", channelId);
5220
5354
  if (channelId === "discord")
5221
5355
  mkdirSync3(channelDir, { recursive: true });
5222
5356
  if (channelId === "discord") {
5223
5357
  const botToken = config["bot_token"];
5224
5358
  if (botToken) {
5225
- writeFileSync4(join3(channelDir, ".env"), `DISCORD_BOT_TOKEN=${botToken}
5359
+ writeFileSync4(join4(channelDir, ".env"), `DISCORD_BOT_TOKEN=${botToken}
5226
5360
  `);
5227
5361
  wrotePersistentCredential = true;
5228
5362
  }
@@ -5286,7 +5420,7 @@ ${sections}`
5286
5420
  ...appToken ? { SLACK_APP_TOKEN: appToken } : {}
5287
5421
  }, ["SLACK_BOT_TOKEN", "SLACK_APP_TOKEN"])
5288
5422
  });
5289
- const localSlackChannel = join3(getHomeDir(), ".augmented", "_mcp", "slack-channel.js");
5423
+ const localSlackChannel = join4(getHomeDir(), ".augmented", "_mcp", "slack-channel.js");
5290
5424
  const slackAvatarEnvUrl = resolveAvatarEnvUrl(options?.agentAvatarUrl).url;
5291
5425
  const slackEntry = {
5292
5426
  command: existsSync4(localSlackChannel) ? "node" : "npx",
@@ -5372,10 +5506,10 @@ ${sections}`
5372
5506
  ...pingAllowedUsers.length > 0 ? { SLACK_PING_ALLOWED_USERS: pingAllowedUsers.join(",") } : {},
5373
5507
  // ENG-6563 (D16): stamp the verified turn initiator so broker MCPs
5374
5508
  // can forward it when the agent files an approval mid-turn.
5375
- AGT_TURN_INITIATOR_FILE: join3(agentDir, ".current-turn-initiator.json")
5509
+ AGT_TURN_INITIATOR_FILE: join4(agentDir, ".current-turn-initiator.json")
5376
5510
  }
5377
5511
  };
5378
- const provisionMcpPath = join3(agentDir, "provision", ".mcp.json");
5512
+ const provisionMcpPath = join4(agentDir, "provision", ".mcp.json");
5379
5513
  mkdirSync3(dirname3(provisionMcpPath), { recursive: true });
5380
5514
  let mcpConfig2 = { mcpServers: {} };
5381
5515
  try {
@@ -5390,7 +5524,7 @@ ${sections}`
5390
5524
  }
5391
5525
  syncMcpToProject(codeName);
5392
5526
  wrotePersistentCredential = true;
5393
- const staleChannelsPath = join3(getProjectDir2(codeName), ".mcp-channels.json");
5527
+ const staleChannelsPath = join4(getProjectDir2(codeName), ".mcp-channels.json");
5394
5528
  if (existsSync4(staleChannelsPath)) {
5395
5529
  try {
5396
5530
  rmSync2(staleChannelsPath, { force: true });
@@ -5404,7 +5538,7 @@ ${sections}`
5404
5538
  }
5405
5539
  return CHANNEL_WRITE_OK;
5406
5540
  }
5407
- const mcpJsonPath = join3(agentDir, "provision", ".mcp.json");
5541
+ const mcpJsonPath = join4(agentDir, "provision", ".mcp.json");
5408
5542
  mkdirSync3(dirname3(mcpJsonPath), { recursive: true });
5409
5543
  let mcpConfig;
5410
5544
  try {
@@ -5427,7 +5561,7 @@ ${sections}`
5427
5561
  const appToken = config["app_token"];
5428
5562
  if (!botToken)
5429
5563
  return missingCredentialField("bot_token");
5430
- const localSlackChannel = join3(getHomeDir(), ".augmented", "_mcp", "slack-channel.js");
5564
+ const localSlackChannel = join4(getHomeDir(), ".augmented", "_mcp", "slack-channel.js");
5431
5565
  const slackThreadAutoFollow = config["thread_auto_follow"];
5432
5566
  const slackAutoFollowEnv = slackThreadAutoFollow && slackThreadAutoFollow !== "off" ? { SLACK_THREAD_AUTO_FOLLOW: slackThreadAutoFollow } : {};
5433
5567
  const slackChannelResponseMode = config["channel_response_mode"];
@@ -5516,7 +5650,7 @@ ${sections}`
5516
5650
  ...slackAgtAuthEnv,
5517
5651
  ...tzEnv,
5518
5652
  // ENG-6563 (D16): stamp the verified turn initiator for broker MCPs.
5519
- AGT_TURN_INITIATOR_FILE: join3(getAgentDir(codeName), ".current-turn-initiator.json"),
5653
+ AGT_TURN_INITIATOR_FILE: join4(getAgentDir(codeName), ".current-turn-initiator.json"),
5520
5654
  // ENG-6155: avatar URL → bot Slack profile photo (see persistent
5521
5655
  // branch above). Mirrored here so oneshot-mode agents get it too.
5522
5656
  // ENG-6245: slackAvatarEnvUrl is null for data-URI / oversized values.
@@ -5541,7 +5675,7 @@ ${sections}`
5541
5675
  ...slackAgtAuthEnv,
5542
5676
  ...tzEnv,
5543
5677
  // ENG-6563 (D16): stamp the verified turn initiator for broker MCPs.
5544
- AGT_TURN_INITIATOR_FILE: join3(getAgentDir(codeName), ".current-turn-initiator.json"),
5678
+ AGT_TURN_INITIATOR_FILE: join4(getAgentDir(codeName), ".current-turn-initiator.json"),
5545
5679
  // ENG-6155: avatar URL → bot Slack profile photo (see persistent
5546
5680
  // branch above). Mirrored here so oneshot-mode agents get it too.
5547
5681
  // ENG-6245: slackAvatarEnvUrl is null for data-URI / oversized values.
@@ -5555,12 +5689,12 @@ ${sections}`
5555
5689
  if (!appId || !clientSecret) {
5556
5690
  return missingCredentialField(!appId ? "app_id" : "client_secret");
5557
5691
  }
5558
- const localTeamsChannel = join3(getHomeDir(), ".augmented", "_mcp", "teams-channel.js");
5692
+ const localTeamsChannel = join4(getHomeDir(), ".augmented", "_mcp", "teams-channel.js");
5559
5693
  const agentDirMs = getAgentDir(codeName);
5560
5694
  try {
5561
- mkdirSync3(join3(agentDirMs, "msteams-pending-inbound", ".markers"), { recursive: true });
5562
- mkdirSync3(join3(agentDirMs, "msteams-pending-interactions"), { recursive: true });
5563
- mkdirSync3(join3(agentDirMs, "msteams-recovery-outbox"), { recursive: true });
5695
+ mkdirSync3(join4(agentDirMs, "msteams-pending-inbound", ".markers"), { recursive: true });
5696
+ mkdirSync3(join4(agentDirMs, "msteams-pending-interactions"), { recursive: true });
5697
+ mkdirSync3(join4(agentDirMs, "msteams-recovery-outbox"), { recursive: true });
5564
5698
  } catch {
5565
5699
  }
5566
5700
  const tenantId = config["tenant_id"] ?? "common";
@@ -5638,7 +5772,7 @@ ${sections}`
5638
5772
  }
5639
5773
  if (channelId === "whatsapp") {
5640
5774
  const provider = config["provider"] ?? "kapso";
5641
- const localWhatsappChannel = join3(getHomeDir(), ".augmented", "_mcp", "whatsapp-channel.js");
5775
+ const localWhatsappChannel = join4(getHomeDir(), ".augmented", "_mcp", "whatsapp-channel.js");
5642
5776
  if (provider === "baileys") {
5643
5777
  mcpServers["whatsapp"] = {
5644
5778
  command: "node",
@@ -5658,7 +5792,7 @@ ${sections}`
5658
5792
  const phoneNumberId = config["phone_number_id"];
5659
5793
  if (projectApiKey && phoneNumberId) {
5660
5794
  try {
5661
- mkdirSync3(join3(getAgentDir(codeName), "whatsapp-pending-inbound"), { recursive: true });
5795
+ mkdirSync3(join4(getAgentDir(codeName), "whatsapp-pending-inbound"), { recursive: true });
5662
5796
  } catch {
5663
5797
  }
5664
5798
  writeEnvIntegrationsForAgent(codeName, {
@@ -5690,7 +5824,7 @@ ${sections}`
5690
5824
  return CHANNEL_WRITE_OK;
5691
5825
  },
5692
5826
  hasChannelCredentials(codeName, channelId) {
5693
- const provisionMcpPath = join3(getAgentDir(codeName), "provision", ".mcp.json");
5827
+ const provisionMcpPath = join4(getAgentDir(codeName), "provision", ".mcp.json");
5694
5828
  if (!existsSync4(provisionMcpPath))
5695
5829
  return false;
5696
5830
  try {
@@ -5702,7 +5836,7 @@ ${sections}`
5702
5836
  },
5703
5837
  removeChannelCredentials(codeName, channelId) {
5704
5838
  const agentDir = getAgentDir(codeName);
5705
- const mcpJsonPath = join3(agentDir, "provision", ".mcp.json");
5839
+ const mcpJsonPath = join4(agentDir, "provision", ".mcp.json");
5706
5840
  modifyJsonConfig(mcpJsonPath, (config) => {
5707
5841
  const mcpServers = config["mcpServers"];
5708
5842
  if (!mcpServers || !(channelId in mcpServers))
@@ -5714,7 +5848,7 @@ ${sections}`
5714
5848
  },
5715
5849
  async updateAgentModel(codeName, model) {
5716
5850
  const agentDir = getAgentDir(codeName);
5717
- const settingsPath = join3(agentDir, "provision", "settings.json");
5851
+ const settingsPath = join4(agentDir, "provision", "settings.json");
5718
5852
  let changed = false;
5719
5853
  modifyJsonConfig(settingsPath, (config) => {
5720
5854
  config["model"] = model;
@@ -5732,12 +5866,12 @@ ${sections}`
5732
5866
  seedProfileConfig(codeName) {
5733
5867
  const agentDir = getAgentDir(codeName);
5734
5868
  const projectDir = getProjectDir2(codeName);
5735
- mkdirSync3(join3(agentDir, "provision"), { recursive: true });
5869
+ mkdirSync3(join4(agentDir, "provision"), { recursive: true });
5736
5870
  mkdirSync3(projectDir, { recursive: true });
5737
5871
  },
5738
5872
  syncScheduledTasks(codeName, tasks) {
5739
5873
  const agentDir = getAgentDir(codeName);
5740
- const schedulesPath = join3(agentDir, "schedules.json");
5874
+ const schedulesPath = join4(agentDir, "schedules.json");
5741
5875
  const mapped = mapScheduledTasks(tasks);
5742
5876
  mkdirSync3(agentDir, { recursive: true });
5743
5877
  writeFileSync4(schedulesPath, JSON.stringify({ schedules: mapped }, null, 2));
@@ -5862,7 +5996,7 @@ ${sections}`
5862
5996
  xeroEnv.AGT_AGENT_ID = agentId;
5863
5997
  xeroEnv.AGT_INTEGRATION_ID = xeroIntegration.id;
5864
5998
  }
5865
- const localXeroMcpPath = join3(getHomeDir(), ".augmented", "_mcp", "xero.js");
5999
+ const localXeroMcpPath = join4(getHomeDir(), ".augmented", "_mcp", "xero.js");
5866
6000
  this.writeMcpServer(codeName, "xero", {
5867
6001
  command: "node",
5868
6002
  args: [localXeroMcpPath],
@@ -5874,8 +6008,8 @@ ${sections}`
5874
6008
  this.writeMcpServer(codeName, "postiz", buildPostizMcpEntry(postizIntegration));
5875
6009
  }
5876
6010
  const remoteOAuthProxyPaths = {
5877
- proxyPath: join3(getHomeDir(), ".augmented", "_mcp", "remote-oauth-proxy.js"),
5878
- tokenFile: join3(getProjectDir2(codeName), ".env.integrations")
6011
+ proxyPath: join4(getHomeDir(), ".augmented", "_mcp", "remote-oauth-proxy.js"),
6012
+ tokenFile: join4(getProjectDir2(codeName), ".env.integrations")
5879
6013
  };
5880
6014
  for (const integration of integrations) {
5881
6015
  const connectionKey = integration.connection_key;
@@ -5916,7 +6050,7 @@ ${sections}`
5916
6050
  // ENG-6586 (D16): keep incremental cloud-broker wiring in sync with
5917
6051
  // buildMcpJson so agents that add cloud-broker post-provision still
5918
6052
  // forward the per-turn initiator.
5919
- AGT_TURN_INITIATOR_FILE: join3(getAgentDir(codeName), ".current-turn-initiator.json"),
6053
+ AGT_TURN_INITIATOR_FILE: join4(getAgentDir(codeName), ".current-turn-initiator.json"),
5920
6054
  PATH: process.env["PATH"] ?? "",
5921
6055
  HOME: process.env["HOME"] ?? ""
5922
6056
  }
@@ -5940,7 +6074,7 @@ ${sections}`
5940
6074
  // ENG-6563 (D16): keep incremental xero-broker wiring in sync with
5941
6075
  // buildMcpJson so agents that add xero-broker post-provision still
5942
6076
  // forward the per-turn initiator.
5943
- AGT_TURN_INITIATOR_FILE: join3(getAgentDir(codeName), ".current-turn-initiator.json"),
6077
+ AGT_TURN_INITIATOR_FILE: join4(getAgentDir(codeName), ".current-turn-initiator.json"),
5944
6078
  PATH: process.env["PATH"] ?? "",
5945
6079
  HOME: process.env["HOME"] ?? ""
5946
6080
  }
@@ -5949,7 +6083,7 @@ ${sections}`
5949
6083
  }
5950
6084
  const hasAdminDebug = integrations.some((i) => i.definition_id === "augmented-admin");
5951
6085
  if (hasAdminDebug) {
5952
- const localAdminMcpPath = join3(getHomeDir(), ".augmented", "_mcp", "augmented-admin.js");
6086
+ const localAdminMcpPath = join4(getHomeDir(), ".augmented", "_mcp", "augmented-admin.js");
5953
6087
  this.writeMcpServer(codeName, "augmented-admin", {
5954
6088
  command: "node",
5955
6089
  args: [localAdminMcpPath],
@@ -5963,7 +6097,7 @@ ${sections}`
5963
6097
  }
5964
6098
  const hasSupport = integrations.some((i) => i.definition_id === "augmented-support");
5965
6099
  if (hasSupport) {
5966
- const localSupportMcpPath = join3(getHomeDir(), ".augmented", "_mcp", "augmented-support.js");
6100
+ const localSupportMcpPath = join4(getHomeDir(), ".augmented", "_mcp", "augmented-support.js");
5967
6101
  this.writeMcpServer(codeName, "augmented-support", {
5968
6102
  command: "node",
5969
6103
  args: [localSupportMcpPath],
@@ -5977,7 +6111,7 @@ ${sections}`
5977
6111
  }
5978
6112
  const hasHelpKb = integrations.some((i) => i.definition_id === "augmented-help-kb");
5979
6113
  if (hasHelpKb) {
5980
- const localHelpKbMcpPath = join3(getHomeDir(), ".augmented", "_mcp", "augmented-help-kb.js");
6114
+ const localHelpKbMcpPath = join4(getHomeDir(), ".augmented", "_mcp", "augmented-help-kb.js");
5981
6115
  this.writeMcpServer(codeName, "augmented-help-kb", {
5982
6116
  command: "node",
5983
6117
  args: [localHelpKbMcpPath],
@@ -5993,7 +6127,7 @@ ${sections}`
5993
6127
  const origamiStdioAgentId = resolveBrokerAgentId(codeName) ?? agentId;
5994
6128
  const origamiStdioExpected = Boolean(origamiStdio?.stdioMcp === true && origamiStdio.id);
5995
6129
  if (origamiStdioExpected && origamiStdioAgentId) {
5996
- const localOrigamiMcpPath = join3(getHomeDir(), ".augmented", "_mcp", "origami.js");
6130
+ const localOrigamiMcpPath = join4(getHomeDir(), ".augmented", "_mcp", "origami.js");
5997
6131
  this.writeMcpServer(codeName, "origami", {
5998
6132
  command: "node",
5999
6133
  args: [localOrigamiMcpPath],
@@ -6006,6 +6140,23 @@ ${sections}`
6006
6140
  }
6007
6141
  });
6008
6142
  }
6143
+ const computerUseRow = integrations.find((i) => i.definition_id === COMPUTER_USE_DEFINITION_ID);
6144
+ const computerUseAgentId = resolveBrokerAgentId(codeName) ?? agentId;
6145
+ const computerUseExpected = Boolean(computerUseRow);
6146
+ if (computerUseRow && computerUseAgentId) {
6147
+ const rendered = buildComputerUseMcpEntry({
6148
+ agentId: computerUseAgentId,
6149
+ agentCodeName: codeName,
6150
+ config: computerUseRow.config,
6151
+ proxyPath: join4(getHomeDir(), ".augmented", "_mcp", "computer-use-proxy.js"),
6152
+ agentDir: getAgentDir(codeName)
6153
+ });
6154
+ if (rendered.entry) {
6155
+ this.writeMcpServer(codeName, COMPUTER_USE_MCP_KEY, rendered.entry);
6156
+ } else {
6157
+ console.warn(`[claudecode] ${rendered.problem}`);
6158
+ }
6159
+ }
6009
6160
  if (this.removeMcpServer) {
6010
6161
  const nativeMcpKeys = INTEGRATION_REGISTRY.filter((d) => d.nativeMcp !== void 0).map((d) => d.nativeMcp.key ?? d.id);
6011
6162
  const registryRemoteMcpKeys = INTEGRATION_REGISTRY.filter((d) => d.remoteMcp !== void 0).map((d) => d.id);
@@ -6025,6 +6176,15 @@ ${sections}`
6025
6176
  // that removing the integration OR flipping the catalog stdio_mcp
6026
6177
  // flag back (rollback) prunes the entry symmetrically.
6027
6178
  "origami",
6179
+ // ENG-10133: the computer-use proxy. In the universe for BOTH of the
6180
+ // ways this entry must disappear, which here are the same event seen
6181
+ // twice: the operator revokes the integration, or the
6182
+ // `open-computer-use` flag is turned off and the API stops forwarding
6183
+ // the row. Either way the row leaves `integrations` and this prune is
6184
+ // what takes the server off disk. Missing from this set, an agent would
6185
+ // keep a live path to someone's desktop after the grant was withdrawn —
6186
+ // the ENG-8332 shape, on the one integration where it matters most.
6187
+ COMPUTER_USE_MCP_KEY,
6028
6188
  // ENG-8421 retirement tombstone. Vercel moved from a remote MCP
6029
6189
  // (`https://mcp.vercel.com`) to an api_key Direct HTTP integration, so
6030
6190
  // its registry entry no longer carries `remoteMcp` — which means it no
@@ -6088,6 +6248,8 @@ ${sections}`
6088
6248
  expectedKeys.add("augmented-help-kb");
6089
6249
  if (origamiStdioExpected)
6090
6250
  expectedKeys.add("origami");
6251
+ if (computerUseExpected)
6252
+ expectedKeys.add(COMPUTER_USE_MCP_KEY);
6091
6253
  for (const integration of integrations) {
6092
6254
  const def = INTEGRATION_REGISTRY.find((d) => d.id === integration.definition_id);
6093
6255
  if (def?.nativeMcp) {
@@ -6110,7 +6272,7 @@ ${sections}`
6110
6272
  }
6111
6273
  }
6112
6274
  const projectDir = getProjectDir2(codeName);
6113
- const claudeMdPath = join3(projectDir, "CLAUDE.md");
6275
+ const claudeMdPath = join4(projectDir, "CLAUDE.md");
6114
6276
  try {
6115
6277
  const existing = readFileSync4(claudeMdPath, "utf-8");
6116
6278
  const renderSection = options?.renderClaudeMdSection === true;
@@ -6131,10 +6293,10 @@ ${sections}`
6131
6293
  if (updated !== existing)
6132
6294
  writeFileSync4(claudeMdPath, updated);
6133
6295
  const agentDir2 = getAgentDir(codeName);
6134
- const envSrc = join3(agentDir2, ".env.integrations");
6296
+ const envSrc = join4(agentDir2, ".env.integrations");
6135
6297
  try {
6136
6298
  const envContent = readFileSync4(envSrc, "utf-8");
6137
- const envDest = join3(projectDir, ".env.integrations");
6299
+ const envDest = join4(projectDir, ".env.integrations");
6138
6300
  writeFileSync4(envDest, envContent, { mode: SECRET_FILE_MODE });
6139
6301
  try {
6140
6302
  chmodSync4(envDest, SECRET_FILE_MODE);
@@ -6149,8 +6311,8 @@ ${sections}`
6149
6311
  },
6150
6312
  writeMcpServer(codeName, serverId, config) {
6151
6313
  const agentDir = getAgentDir(codeName);
6152
- const mcpJsonPath = join3(agentDir, "provision", ".mcp.json");
6153
- mkdirSync3(join3(agentDir, "provision"), { recursive: true });
6314
+ const mcpJsonPath = join4(agentDir, "provision", ".mcp.json");
6315
+ mkdirSync3(join4(agentDir, "provision"), { recursive: true });
6154
6316
  let mcpConfig;
6155
6317
  try {
6156
6318
  mcpConfig = JSON.parse(readFileSync4(mcpJsonPath, "utf-8"));
@@ -6197,7 +6359,7 @@ ${sections}`
6197
6359
  }
6198
6360
  },
6199
6361
  getMcpPath(codeName) {
6200
- return join3(getAgentDir(codeName), "provision", ".mcp.json");
6362
+ return join4(getAgentDir(codeName), "provision", ".mcp.json");
6201
6363
  },
6202
6364
  /**
6203
6365
  * ENG-7994: the declared servers from `provision/.mcp.json`. Mirrors what the
@@ -6208,7 +6370,7 @@ ${sections}`
6208
6370
  readMcpServers(codeName) {
6209
6371
  let parsed;
6210
6372
  try {
6211
- parsed = JSON.parse(readFileSync4(join3(getAgentDir(codeName), "provision", ".mcp.json"), "utf-8"));
6373
+ parsed = JSON.parse(readFileSync4(join4(getAgentDir(codeName), "provision", ".mcp.json"), "utf-8"));
6212
6374
  } catch {
6213
6375
  return {};
6214
6376
  }
@@ -6221,7 +6383,7 @@ ${sections}`
6221
6383
  },
6222
6384
  removeMcpServer(codeName, serverId) {
6223
6385
  const agentDir = getAgentDir(codeName);
6224
- const mcpJsonPath = join3(agentDir, "provision", ".mcp.json");
6386
+ const mcpJsonPath = join4(agentDir, "provision", ".mcp.json");
6225
6387
  let mcpConfig;
6226
6388
  try {
6227
6389
  mcpConfig = JSON.parse(readFileSync4(mcpJsonPath, "utf-8"));
@@ -6243,17 +6405,17 @@ ${sections}`
6243
6405
  const READ_WRITE_MODE = 420;
6244
6406
  const agentDir = getAgentDir(codeName);
6245
6407
  const projectDir = getProjectDir2(codeName);
6246
- for (const baseDir of [join3(agentDir, "skills"), join3(projectDir, ".claude", "skills")]) {
6247
- const skillDir = join3(baseDir, skillId);
6408
+ for (const baseDir of [join4(agentDir, "skills"), join4(projectDir, ".claude", "skills")]) {
6409
+ const skillDir = join4(baseDir, skillId);
6248
6410
  mkdirSync3(skillDir, { recursive: true });
6249
6411
  for (const file of files) {
6250
6412
  assertSafeRelativePath(file.relativePath);
6251
- const filePath = join3(skillDir, file.relativePath);
6413
+ const filePath = join4(skillDir, file.relativePath);
6252
6414
  const rel = relative(skillDir, filePath);
6253
6415
  if (rel.startsWith("..") || rel === "") {
6254
6416
  throw new Error(`Path traversal detected: ${file.relativePath} resolves outside ${skillDir}`);
6255
6417
  }
6256
- mkdirSync3(join3(filePath, ".."), { recursive: true });
6418
+ mkdirSync3(join4(filePath, ".."), { recursive: true });
6257
6419
  if (isPluginManaged && existsSync4(filePath)) {
6258
6420
  try {
6259
6421
  chmodSync4(filePath, READ_WRITE_MODE);
@@ -6272,7 +6434,7 @@ ${sections}`
6272
6434
  },
6273
6435
  installPlugin(codeName, pluginId, pluginPath, pluginConfig) {
6274
6436
  const agentDir = getAgentDir(codeName);
6275
- const pluginsJsonPath = join3(agentDir, "plugins.json");
6437
+ const pluginsJsonPath = join4(agentDir, "plugins.json");
6276
6438
  mkdirSync3(agentDir, { recursive: true });
6277
6439
  let pluginsConfig;
6278
6440
  try {
@@ -6305,11 +6467,11 @@ ${sections}`
6305
6467
  assertValidCodeName(codeName);
6306
6468
  assertValidCodeName(plugin.slug);
6307
6469
  const projectDir = getProjectDir2(codeName);
6308
- const claudeDir = join3(projectDir, ".claude");
6470
+ const claudeDir = join4(projectDir, ".claude");
6309
6471
  mkdirSync3(claudeDir, { recursive: true });
6310
6472
  const sourceSpec = options?.scriptSource ?? `augmented-plugin:${plugin.slug}`;
6311
6473
  this.installPlugin(codeName, plugin.slug, sourceSpec, contextValues);
6312
- const installedDir = join3(projectDir, ".claude", "plugins", plugin.slug);
6474
+ const installedDir = join4(projectDir, ".claude", "plugins", plugin.slug);
6313
6475
  for (const skill of plugin.skills) {
6314
6476
  const skillId = skill.id;
6315
6477
  assertValidCodeName(skillId);
@@ -6321,7 +6483,7 @@ ${sections}`
6321
6483
  }
6322
6484
  const scriptsConfig = plugin.scripts;
6323
6485
  if (scriptsConfig?.hooks) {
6324
- const settingsPath = join3(claudeDir, "settings.local.json");
6486
+ const settingsPath = join4(claudeDir, "settings.local.json");
6325
6487
  let settings = {};
6326
6488
  try {
6327
6489
  settings = JSON.parse(readFileSync4(settingsPath, "utf-8"));
@@ -6361,7 +6523,7 @@ ${sections}`
6361
6523
  writeFileSync4(settingsPath, JSON.stringify(settings, null, 2));
6362
6524
  }
6363
6525
  if (plugin.allowed_tools.length > 0) {
6364
- const settingsPath = join3(claudeDir, "settings.local.json");
6526
+ const settingsPath = join4(claudeDir, "settings.local.json");
6365
6527
  let settings = {};
6366
6528
  try {
6367
6529
  settings = JSON.parse(readFileSync4(settingsPath, "utf-8"));
@@ -6379,14 +6541,14 @@ ${sections}`
6379
6541
  writeFileSync4(settingsPath, JSON.stringify(settings, null, 2));
6380
6542
  }
6381
6543
  if (contextValues && Object.keys(contextValues).length > 0) {
6382
- const configDir = join3(projectDir, `.${plugin.slug}`);
6544
+ const configDir = join4(projectDir, `.${plugin.slug}`);
6383
6545
  mkdirSync3(configDir, { recursive: true });
6384
- writeFileSync4(join3(configDir, "config.json"), JSON.stringify(contextValues, null, 2));
6546
+ writeFileSync4(join4(configDir, "config.json"), JSON.stringify(contextValues, null, 2));
6385
6547
  }
6386
6548
  },
6387
6549
  executePluginHook(ctx) {
6388
6550
  assertValidCodeName(ctx.codeName);
6389
- const agentRootDir = join3(getHomeDir(), ".augmented", ctx.codeName);
6551
+ const agentRootDir = join4(getHomeDir(), ".augmented", ctx.codeName);
6390
6552
  const projectDir = getProjectDir2(ctx.codeName);
6391
6553
  mkdirSync3(agentRootDir, { recursive: true });
6392
6554
  mkdirSync3(projectDir, { recursive: true });
@@ -6442,7 +6604,7 @@ ${sections}`
6442
6604
  }
6443
6605
  if (Object.keys(tokens).length === 0)
6444
6606
  return;
6445
- const tokenPath = join3(agentDir, ".tokens.json");
6607
+ const tokenPath = join4(agentDir, ".tokens.json");
6446
6608
  writeFileSync4(tokenPath, JSON.stringify(tokens, null, 2));
6447
6609
  chmodSync4(tokenPath, SECRET_FILE_MODE);
6448
6610
  }
@@ -6467,10 +6629,10 @@ function jsonOutput(data) {
6467
6629
 
6468
6630
  // src/lib/config.ts
6469
6631
  import { readFileSync as readFileSync5, writeFileSync as writeFileSync5, mkdirSync as mkdirSync4, existsSync as existsSync5 } from "fs";
6470
- import { join as join4 } from "path";
6632
+ import { join as join5 } from "path";
6471
6633
  import { homedir as homedir4 } from "os";
6472
- var AUGMENTED_DIR = join4(homedir4(), ".augmented");
6473
- var CONFIG_PATH = join4(AUGMENTED_DIR, "config.json");
6634
+ var AUGMENTED_DIR = join5(homedir4(), ".augmented");
6635
+ var CONFIG_PATH = join5(AUGMENTED_DIR, "config.json");
6474
6636
  function ensureAugmentedDir() {
6475
6637
  if (!existsSync5(AUGMENTED_DIR)) {
6476
6638
  mkdirSync4(AUGMENTED_DIR, { recursive: true });
@@ -6483,7 +6645,7 @@ function loadFromShellProfile(force = false) {
6483
6645
  if (!force && process.env["AGT_HOST"] && process.env["AGT_API_KEY"]) return;
6484
6646
  const shell = process.env["SHELL"] ?? "";
6485
6647
  const home = homedir4();
6486
- const candidates = shell.includes("zsh") ? [join4(home, ".zshrc"), join4(home, ".zprofile")] : shell.includes("fish") ? [join4(home, ".config", "fish", "config.fish")] : [join4(home, ".bashrc"), join4(home, ".bash_profile")];
6648
+ const candidates = shell.includes("zsh") ? [join5(home, ".zshrc"), join5(home, ".zprofile")] : shell.includes("fish") ? [join5(home, ".config", "fish", "config.fish")] : [join5(home, ".bashrc"), join5(home, ".bash_profile")];
6487
6649
  for (const profile of candidates) {
6488
6650
  try {
6489
6651
  const content = readFileSync5(profile, "utf-8");
@@ -6566,7 +6728,7 @@ function exchangeFailureKind(err) {
6566
6728
  }
6567
6729
 
6568
6730
  // src/lib/api-client.ts
6569
- var agtCliVersion = true ? "0.28.854" : "dev";
6731
+ var agtCliVersion = true ? "0.28.856" : "dev";
6570
6732
  var lastConfigHash = null;
6571
6733
  function setConfigHash(hash) {
6572
6734
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -6864,9 +7026,9 @@ function atomicWriteFileSync(path, data) {
6864
7026
 
6865
7027
  // src/lib/feature-flags-host.ts
6866
7028
  import { existsSync as existsSync6, readFileSync as readFileSync6, statSync as statSync2 } from "fs";
6867
- import { join as join5 } from "path";
7029
+ import { join as join6 } from "path";
6868
7030
  function defaultFlagsCachePath(configDir) {
6869
- return join5(configDir, "flags-cache.json");
7031
+ return join6(configDir, "flags-cache.json");
6870
7032
  }
6871
7033
  function readFlagsCache(path) {
6872
7034
  try {
@@ -8661,7 +8823,7 @@ function verdictForUnavailableMcpConfig(cause, ctx) {
8661
8823
  }
8662
8824
 
8663
8825
  // src/lib/connectivity-probe-context.ts
8664
- import { delimiter as pathDelimiter, join as join6 } from "path";
8826
+ import { delimiter as pathDelimiter, join as join7 } from "path";
8665
8827
  import { existsSync as existsSync7, readFileSync as readFileSync7 } from "fs";
8666
8828
  import { homedir as homedir5 } from "os";
8667
8829
 
@@ -9295,7 +9457,7 @@ function resolveHttpServerEntry(entry, env) {
9295
9457
  function readMcpHttpServerConfig(projectDir, serverKey, env) {
9296
9458
  let servers;
9297
9459
  try {
9298
- const raw = readFileSync7(join6(projectDir, ".mcp.json"), "utf-8");
9460
+ const raw = readFileSync7(join7(projectDir, ".mcp.json"), "utf-8");
9299
9461
  servers = JSON.parse(raw).mcpServers ?? {};
9300
9462
  } catch {
9301
9463
  return { ok: false, cause: "file-unreadable" };
@@ -9307,7 +9469,7 @@ function readMcpHttpServerConfig(projectDir, serverKey, env) {
9307
9469
  }
9308
9470
  function resolveDeclaredServerKey(projectDir, definitionId, derivedKey) {
9309
9471
  try {
9310
- const raw = readFileSync7(join6(projectDir, ".mcp.json"), "utf-8");
9472
+ const raw = readFileSync7(join7(projectDir, ".mcp.json"), "utf-8");
9311
9473
  const servers = JSON.parse(raw).mcpServers ?? {};
9312
9474
  const declared = Object.keys(servers);
9313
9475
  if (derivedKey !== definitionId && derivedKey !== sanitizeServerKey(definitionId)) {
@@ -9349,7 +9511,7 @@ function resolveStdioServerEntry(entry, env) {
9349
9511
  function readMcpStdioServerConfig(projectDir, serverKey, env) {
9350
9512
  let servers;
9351
9513
  try {
9352
- const raw = readFileSync7(join6(projectDir, ".mcp.json"), "utf-8");
9514
+ const raw = readFileSync7(join7(projectDir, ".mcp.json"), "utf-8");
9353
9515
  servers = JSON.parse(raw).mcpServers ?? {};
9354
9516
  } catch {
9355
9517
  return { ok: false, cause: "file-unreadable" };
@@ -9377,13 +9539,13 @@ function toolkitPathDirs() {
9377
9539
  const home = process.env.HOME?.trim() || homedir5();
9378
9540
  return [
9379
9541
  ...PROBE_TOOLKIT_PATH_DIRS,
9380
- ...PROBE_HOME_RELATIVE_PATH_SEGMENTS.map((seg) => join6(home, seg))
9542
+ ...PROBE_HOME_RELATIVE_PATH_SEGMENTS.map((seg) => join7(home, seg))
9381
9543
  ];
9382
9544
  }
9383
9545
  function buildProbeEnv(projectDir, agentId) {
9384
9546
  const probeEnv = { ...process.env };
9385
9547
  try {
9386
- const envIntPath = join6(projectDir, ".env.integrations");
9548
+ const envIntPath = join7(projectDir, ".env.integrations");
9387
9549
  if (existsSync7(envIntPath)) {
9388
9550
  Object.assign(probeEnv, parseEnvIntegrations(readFileSync7(envIntPath, "utf-8")));
9389
9551
  }
@@ -9393,7 +9555,7 @@ function buildProbeEnv(projectDir, agentId) {
9393
9555
  probeEnv.AGT_AGENT_ID = agentId.trim();
9394
9556
  }
9395
9557
  try {
9396
- const agentBinDir = join6(projectDir, ".claude", "agt-bin");
9558
+ const agentBinDir = join7(projectDir, ".claude", "agt-bin");
9397
9559
  if (existsSync7(agentBinDir)) {
9398
9560
  const parts = probeEnv.PATH ? probeEnv.PATH.split(pathDelimiter) : [];
9399
9561
  parts.unshift(agentBinDir);
@@ -9547,7 +9709,7 @@ function buildConnectivityProbeDeps(projectDir, probeEnv) {
9547
9709
  // src/lib/session-tool-bind-probe-host.ts
9548
9710
  import { execFileSync as syncExecFile } from "child_process";
9549
9711
  import { readFileSync as readFileSync8 } from "fs";
9550
- import { join as join7 } from "path";
9712
+ import { join as join8 } from "path";
9551
9713
  import { dirname as dirname5 } from "path";
9552
9714
  function deliveryFields(i) {
9553
9715
  const keys = ["source_type", "provider", "mcp_command", "mcp_url", "cli_binary", "cli_package"];
@@ -9561,7 +9723,7 @@ async function gatherSessionToolBindProbe(agent, integrations, projectDir, opts)
9561
9723
  if (integrations.length === 0) return null;
9562
9724
  let mcpRaw = null;
9563
9725
  try {
9564
- mcpRaw = readFileSync8(join7(projectDir, ".mcp.json"), "utf-8");
9726
+ mcpRaw = readFileSync8(join8(projectDir, ".mcp.json"), "utf-8");
9565
9727
  } catch {
9566
9728
  mcpRaw = null;
9567
9729
  }
@@ -9654,7 +9816,7 @@ var SLACK_MCP_SERVER_KEY = "slack";
9654
9816
  function readSlackTransportDownKeys(projectDir) {
9655
9817
  const none = /* @__PURE__ */ new Set();
9656
9818
  try {
9657
- const raw = readFileSync8(join7(dirname5(projectDir), SLACK_SOCKET_STATE_FILENAME), "utf-8");
9819
+ const raw = readFileSync8(join8(dirname5(projectDir), SLACK_SOCKET_STATE_FILENAME), "utf-8");
9658
9820
  const state = parseSlackSocketState(raw, Date.now());
9659
9821
  return isSlackInboundTransportDown(state, SLACK_TRANSPORT_DOWN_AFTER_MS) ? /* @__PURE__ */ new Set([SLACK_MCP_SERVER_KEY]) : none;
9660
9822
  } catch {
@@ -9741,7 +9903,7 @@ function describeWorkerModuleFailure(err) {
9741
9903
  // src/lib/drain-transcript-flush.ts
9742
9904
  import { existsSync as existsSync8, readdirSync as readdirSync2 } from "fs";
9743
9905
  import { homedir as homedir6 } from "os";
9744
- import { dirname as dirname6, join as join8, relative as relative2, sep } from "path";
9906
+ import { dirname as dirname6, join as join9, relative as relative2, sep } from "path";
9745
9907
  import { spawn as spawn2 } from "child_process";
9746
9908
 
9747
9909
  // src/lib/host-archive-address.ts
@@ -9785,7 +9947,7 @@ function readHostArchiveAddress(path) {
9785
9947
 
9786
9948
  // src/lib/drain-transcript-flush.ts
9787
9949
  function sessionsBaseDir() {
9788
- return join8(homedir6(), ".claude", "projects");
9950
+ return join9(homedir6(), ".claude", "projects");
9789
9951
  }
9790
9952
  var PER_FILE_UPLOAD_TIMEOUT_MS = 3e4;
9791
9953
  var UPLOAD_CONCURRENCY = 4;
@@ -9796,7 +9958,7 @@ function listJsonlFiles(dir) {
9796
9958
  const out = [];
9797
9959
  const walk = (d) => {
9798
9960
  for (const entry of readdirSync2(d, { withFileTypes: true })) {
9799
- const full = join8(d, entry.name);
9961
+ const full = join9(d, entry.name);
9800
9962
  if (entry.isDirectory()) walk(full);
9801
9963
  else if (entry.isFile() && entry.name.endsWith(".jsonl")) out.push(full);
9802
9964
  }
@@ -9813,7 +9975,7 @@ function transcriptObjectKey(keyPrefix, baseDir, file) {
9813
9975
  return `${keyPrefix.replace(/\/+$/, "")}/${rel}`;
9814
9976
  }
9815
9977
  function drainManifestObjectKey(keyPrefix, baseDir, transcriptDir) {
9816
- return transcriptObjectKey(keyPrefix, baseDir, join8(transcriptDir, DRAIN_MANIFEST_FILENAME));
9978
+ return transcriptObjectKey(keyPrefix, baseDir, join9(transcriptDir, DRAIN_MANIFEST_FILENAME));
9817
9979
  }
9818
9980
  async function flushAgentTranscriptsOnDrain(codeName, deps) {
9819
9981
  const dir = deps.resolveTranscriptDir(codeName);
@@ -9965,7 +10127,7 @@ function drainTranscriptFlushDeps(log2) {
9965
10127
  // tree — the thing host-archive-address.ts's header warns about.
9966
10128
  readSourceLayout: (codeName) => {
9967
10129
  const agentDir = dirname6(getProjectDir(codeName));
9968
- const codeNameDir = join8(homedir6(), ".augmented", codeName);
10130
+ const codeNameDir = join9(homedir6(), ".augmented", codeName);
9969
10131
  return { layout: agentDir === codeNameDir ? "codename-keyed" : "id-keyed", agentDir };
9970
10132
  },
9971
10133
  readSessionPin: (codeName) => readDailySessionPin(codeName),
@@ -10053,20 +10215,20 @@ function decidePin(opts) {
10053
10215
  // src/commands/manager.ts
10054
10216
  import chalk3 from "chalk";
10055
10217
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
10056
- import { join as join10 } from "path";
10218
+ import { join as join11 } from "path";
10057
10219
  import { homedir as homedir7, userInfo } from "os";
10058
10220
  import { spawn as spawn4 } from "child_process";
10059
10221
 
10060
10222
  // src/lib/watchdog.ts
10061
10223
  import { readFileSync as readFileSync10, writeFileSync as writeFileSync6, unlinkSync as unlinkSync4, existsSync as existsSync9, mkdirSync as mkdirSync6, openSync as openSync2, closeSync as closeSync2, chmodSync as chmodSync5 } from "fs";
10062
- import { join as join9 } from "path";
10224
+ import { join as join10 } from "path";
10063
10225
  import { spawn as spawn3, execFileSync as execFileSync3 } from "child_process";
10064
- var DEFAULT_CONFIG_DIR = join9(process.env["HOME"] ?? "/tmp", ".augmented");
10226
+ var DEFAULT_CONFIG_DIR = join10(process.env["HOME"] ?? "/tmp", ".augmented");
10065
10227
  function getManagerPaths(configDir) {
10066
10228
  return {
10067
- pidFile: join9(configDir, "manager.pid"),
10068
- stateFile: join9(configDir, "manager-state.json"),
10069
- logFile: join9(configDir, "manager.log")
10229
+ pidFile: join10(configDir, "manager.pid"),
10230
+ stateFile: join10(configDir, "manager-state.json"),
10231
+ logFile: join10(configDir, "manager.log")
10070
10232
  };
10071
10233
  }
10072
10234
  function ensureDir(configDir) {
@@ -10322,7 +10484,7 @@ function managerStartCommand(opts) {
10322
10484
  process.exitCode = 1;
10323
10485
  return;
10324
10486
  }
10325
- const configDir = opts.configDir ?? join10(homedir7(), ".augmented");
10487
+ const configDir = opts.configDir ?? join11(homedir7(), ".augmented");
10326
10488
  if (opts.supervise) {
10327
10489
  if (json) {
10328
10490
  jsonOutput({ ok: false, error: "--supervise is not supported with --json" });
@@ -10418,7 +10580,7 @@ function runSupervisorLoop(intervalSec, configDir) {
10418
10580
  }
10419
10581
  async function managerStopCommand(opts = {}) {
10420
10582
  const json = isJsonMode();
10421
- const configDir = opts.configDir ?? join10(homedir7(), ".augmented");
10583
+ const configDir = opts.configDir ?? join11(homedir7(), ".augmented");
10422
10584
  try {
10423
10585
  const result = await stopWatchdog(configDir);
10424
10586
  if (!result.stopped && !result.pid) {
@@ -10446,7 +10608,7 @@ async function managerStopCommand(opts = {}) {
10446
10608
  }
10447
10609
  function managerStatusCommand(opts = {}) {
10448
10610
  const json = isJsonMode();
10449
- const configDir = opts.configDir ?? join10(homedir7(), ".augmented");
10611
+ const configDir = opts.configDir ?? join11(homedir7(), ".augmented");
10450
10612
  const status = getManagerStatus(configDir);
10451
10613
  if (!status) {
10452
10614
  if (json) {
@@ -10538,7 +10700,7 @@ async function managerInstallCommand(opts = {}) {
10538
10700
  process.exitCode = 1;
10539
10701
  return;
10540
10702
  }
10541
- const configDir = opts.configDir ?? join10(homedir7(), ".augmented");
10703
+ const configDir = opts.configDir ?? join11(homedir7(), ".augmented");
10542
10704
  const rawAgtBin = process.argv[1];
10543
10705
  if (!rawAgtBin) {
10544
10706
  const msg = "Could not resolve the agt binary path from argv. Re-run via the installed `agt` command.";
@@ -10551,7 +10713,7 @@ async function managerInstallCommand(opts = {}) {
10551
10713
  if (process.platform === "darwin") {
10552
10714
  const home = homedir7();
10553
10715
  const protectedRoots = ["Documents", "Downloads", "Desktop", "Movies", "Music", "Pictures"];
10554
- const offending = protectedRoots.map((r) => join10(home, r)).find((p) => agtBin === p || agtBin.startsWith(`${p}/`));
10716
+ const offending = protectedRoots.map((r) => join11(home, r)).find((p) => agtBin === p || agtBin.startsWith(`${p}/`));
10555
10717
  if (offending) {
10556
10718
  const msg = `agt binary at ${agtBin} sits inside a macOS TCC-protected folder (${offending}). launchd-spawned processes cannot read files there and the manager would EPERM on startup. Either install agt globally (\`npm install -g @integrity-labs/agt-cli\`) or copy the dist outside protected folders before running this command.`;
10557
10719
  if (json) jsonOutput({ ok: false, error: msg });
@@ -10620,7 +10782,7 @@ async function managerInstallSystemUnitCommand(opts = {}) {
10620
10782
  return;
10621
10783
  }
10622
10784
  const user = opts.user ?? "root";
10623
- const configDir = opts.configDir ?? (user === "root" ? "/root/.augmented" : join10("/home", user, ".augmented"));
10785
+ const configDir = opts.configDir ?? (user === "root" ? "/root/.augmented" : join11("/home", user, ".augmented"));
10624
10786
  const rawAgtBin = process.argv[1];
10625
10787
  if (!rawAgtBin) {
10626
10788
  const msg = "Could not resolve the agt binary path from argv. Re-run via the installed `agt` command.";
@@ -10924,4 +11086,4 @@ export {
10924
11086
  managerInstallSystemUnitCommand,
10925
11087
  managerUninstallSystemUnitCommand
10926
11088
  };
10927
- //# sourceMappingURL=chunk-FHOLG6VL.js.map
11089
+ //# sourceMappingURL=chunk-6I5IMMWR.js.map