@integrity-labs/agt-cli 0.28.365 → 0.28.367

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin/agt.js CHANGED
@@ -40,7 +40,7 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-7HNQ5ECS.js";
43
+ } from "../chunk-3FUABX65.js";
44
44
  import {
45
45
  AnchorSessionClient,
46
46
  CHANNEL_REGISTRY,
@@ -70,7 +70,7 @@ import {
70
70
  renderTemplate,
71
71
  resolveChannels,
72
72
  serializeManifestForSlackCli
73
- } from "../chunk-N7Z6UOKY.js";
73
+ } from "../chunk-COOBM6RF.js";
74
74
  import "../chunk-XWVM4KPK.js";
75
75
 
76
76
  // src/bin/agt.ts
@@ -4829,7 +4829,7 @@ import { execFileSync, execSync } from "child_process";
4829
4829
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4830
4830
  import chalk18 from "chalk";
4831
4831
  import ora16 from "ora";
4832
- var cliVersion = true ? "0.28.365" : "dev";
4832
+ var cliVersion = true ? "0.28.367" : "dev";
4833
4833
  async function fetchLatestVersion() {
4834
4834
  const host2 = getHost();
4835
4835
  if (!host2) return null;
@@ -6001,7 +6001,7 @@ function handleError(err) {
6001
6001
  }
6002
6002
 
6003
6003
  // src/bin/agt.ts
6004
- var cliVersion2 = true ? "0.28.365" : "dev";
6004
+ var cliVersion2 = true ? "0.28.367" : "dev";
6005
6005
  var program = new Command();
6006
6006
  program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
6007
6007
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -20,7 +20,7 @@ import {
20
20
  resolveConnectivityProbe,
21
21
  worseConnectivityOutcome,
22
22
  wrapScheduledTaskPrompt
23
- } from "./chunk-N7Z6UOKY.js";
23
+ } from "./chunk-COOBM6RF.js";
24
24
  import {
25
25
  parsePsRows
26
26
  } from "./chunk-XWVM4KPK.js";
@@ -6348,7 +6348,7 @@ function requireHost() {
6348
6348
  }
6349
6349
 
6350
6350
  // src/lib/api-client.ts
6351
- var agtCliVersion = true ? "0.28.365" : "dev";
6351
+ var agtCliVersion = true ? "0.28.367" : "dev";
6352
6352
  var lastConfigHash = null;
6353
6353
  function setConfigHash(hash) {
6354
6354
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -8794,4 +8794,4 @@ export {
8794
8794
  managerInstallSystemUnitCommand,
8795
8795
  managerUninstallSystemUnitCommand
8796
8796
  };
8797
- //# sourceMappingURL=chunk-7HNQ5ECS.js.map
8797
+ //# sourceMappingURL=chunk-3FUABX65.js.map
@@ -5198,6 +5198,25 @@ var INTEGRATION_REGISTRY = [
5198
5198
  { event_type: "proxy_mb", unit: "MB", label: "Proxy data" },
5199
5199
  { event_type: "session_minute", unit: "minute", label: "Session time" }
5200
5200
  ]
5201
+ },
5202
+ // ENG-7961: the broker returns a session `connect_url`; the AGENT drives the
5203
+ // session with the `browse` CDP CLI over Bash (`browse open <url> --cdp
5204
+ // <connect_url>`). So the host needs the `browse` binary. The manager's
5205
+ // ensureToolkitCli installs it (npm) when a browserbase integration is
5206
+ // present for the agent - and it is ALSO baked into the agt-runtime image
5207
+ // (Docker-isolated agents don't get host installs mounted in), exactly like
5208
+ // the `gh` precedent (ENG-7662).
5209
+ //
5210
+ // browse needs NO host credential: the agent drives the broker-provisioned
5211
+ // session over `connect_url`, and the Browserbase account key stays
5212
+ // server-side (never materialized to the agent). `env_key` is a required
5213
+ // field but INERT here - auth_type 'none' means no token is ever published
5214
+ // under it (the claudecode provisioner guards on `env_key && token`).
5215
+ cli_tool: {
5216
+ package: "browse",
5217
+ binary: "browse",
5218
+ env_key: "BROWSERBASE_UNUSED",
5219
+ installer: "npm"
5201
5220
  }
5202
5221
  },
5203
5222
  {
@@ -8792,6 +8811,46 @@ function buildOpencodeConfig(input, opts) {
8792
8811
  }
8793
8812
  };
8794
8813
  }
8814
+ function mergeOpencodeConfigArtifact(generatorContent, existingContent) {
8815
+ const asRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v) ? v : {};
8816
+ const parse = (raw) => {
8817
+ try {
8818
+ return asRecord(JSON.parse(raw));
8819
+ } catch {
8820
+ return {};
8821
+ }
8822
+ };
8823
+ const generatorCfg = parse(generatorContent);
8824
+ const existingCfg = existingContent ? parse(existingContent) : {};
8825
+ const generatorMcp = asRecord(generatorCfg["mcp"]);
8826
+ const existingMcp = asRecord(existingCfg["mcp"]);
8827
+ const merged = { ...generatorCfg, mcp: { ...existingMcp, ...generatorMcp } };
8828
+ const sliceKeys = (cfg) => [
8829
+ ...Object.keys(generatorCfg),
8830
+ ...Object.keys(cfg).filter((k) => !(k in generatorCfg)).sort()
8831
+ ];
8832
+ const slice = (cfg) => {
8833
+ const out = {};
8834
+ for (const k of sliceKeys(cfg)) {
8835
+ if (k === "mcp") {
8836
+ const srcMcp = asRecord(cfg["mcp"]);
8837
+ const mcpSlice = {};
8838
+ for (const s of Object.keys(generatorMcp))
8839
+ if (s in srcMcp)
8840
+ mcpSlice[s] = srcMcp[s];
8841
+ out["mcp"] = mcpSlice;
8842
+ } else if (k in cfg) {
8843
+ out[k] = cfg[k];
8844
+ }
8845
+ }
8846
+ return JSON.stringify(out);
8847
+ };
8848
+ return {
8849
+ content: JSON.stringify(merged, null, 2),
8850
+ generatorSlice: slice(generatorCfg),
8851
+ existingSlice: existingContent ? slice(existingCfg) : null
8852
+ };
8853
+ }
8795
8854
 
8796
8855
  // ../../packages/core/dist/provisioning/platform-storage.js
8797
8856
  var PLATFORM_STORAGE_RULE = "Store durable, reusable work you build (repeatable procedures, recurring responsibilities, scheduled automation, orchestration scripts) through the Augmented Team platform tools, never as loose local files, unless the user explicitly requests a different destination. Platform artifacts are versioned, reviewable, and survive re-provisioning; loose local files are wiped on the next provision rebuild, reach no one else, and bypass review. Ephemeral scratch files for the task at hand are fine on disk.";
@@ -9187,14 +9246,14 @@ function agentDir(codeName) {
9187
9246
  assertValidCodeName(codeName);
9188
9247
  return join(getHomeDir(), ".augmented", codeName);
9189
9248
  }
9190
- function projectDir(codeName) {
9191
- return join(agentDir(codeName), "project");
9249
+ function provisionConfigDir(codeName) {
9250
+ return join(agentDir(codeName), "provision");
9192
9251
  }
9193
9252
  function mcpBundlePath() {
9194
9253
  return join(getHomeDir(), ".augmented", "_mcp", MCP_BUNDLE_BASENAME);
9195
9254
  }
9196
9255
  function configPath(codeName) {
9197
- return join(projectDir(codeName), CONFIG_FILE);
9256
+ return join(provisionConfigDir(codeName), CONFIG_FILE);
9198
9257
  }
9199
9258
  function readConfig(codeName) {
9200
9259
  const p2 = configPath(codeName);
@@ -9208,7 +9267,7 @@ function readConfig(codeName) {
9208
9267
  }
9209
9268
  function writeConfig(codeName, config) {
9210
9269
  const p2 = configPath(codeName);
9211
- mkdirSync(projectDir(codeName), { recursive: true });
9270
+ mkdirSync(provisionConfigDir(codeName), { recursive: true });
9212
9271
  writeFileSync2(p2, JSON.stringify(config, null, 2));
9213
9272
  }
9214
9273
  function upsertEnvIntegrations(codeName, updates) {
@@ -9676,12 +9735,12 @@ function writeConfigFile600(target, content, codeName, log2) {
9676
9735
  return false;
9677
9736
  }
9678
9737
  }
9679
- function writeMaterializedOpencodeConfig(codeName, projectDir2, serveEnv, log2) {
9680
- const projectTarget = join3(projectDir2, MATERIALIZED_CONFIG_BASENAME);
9738
+ function writeMaterializedOpencodeConfig(codeName, projectDir, serveEnv, log2) {
9739
+ const projectTarget = join3(projectDir, MATERIALIZED_CONFIG_BASENAME);
9681
9740
  const globalTarget = opencodeGlobalConfigPath(serveEnv);
9682
9741
  let raw;
9683
9742
  try {
9684
- raw = readFileSync5(join3(projectDir2, "opencode.json"), "utf-8");
9743
+ raw = readFileSync5(join3(projectDir, "opencode.json"), "utf-8");
9685
9744
  } catch {
9686
9745
  for (const t of [projectTarget, globalTarget]) {
9687
9746
  try {
@@ -9774,9 +9833,9 @@ async function startOpencodeSession(config) {
9774
9833
  return session;
9775
9834
  }
9776
9835
  async function spawnServe(config, session) {
9777
- const { codeName, projectDir: projectDir2, log: log2 } = config;
9778
- if (!existsSync4(join3(projectDir2, "opencode.json"))) {
9779
- log2(`[opencode-session] warning: no opencode.json in ${projectDir2} for '${codeName}' (provisioning may not have run)`);
9836
+ const { codeName, projectDir, log: log2 } = config;
9837
+ if (!existsSync4(join3(projectDir, "opencode.json"))) {
9838
+ log2(`[opencode-session] warning: no opencode.json in ${projectDir} for '${codeName}' (provisioning may not have run)`);
9780
9839
  }
9781
9840
  const tmuxSession = opencodeTmuxSession(codeName);
9782
9841
  const port = await findFreePort();
@@ -9796,15 +9855,15 @@ async function spawnServe(config, session) {
9796
9855
  };
9797
9856
  if (config.runId) serveEnv["AGT_RUN_ID"] = config.runId;
9798
9857
  if (config.agentTimezone) serveEnv["TZ"] = config.agentTimezone;
9799
- if (!writeMaterializedOpencodeConfig(codeName, projectDir2, serveEnv, log2)) {
9858
+ if (!writeMaterializedOpencodeConfig(codeName, projectDir, serveEnv, log2)) {
9800
9859
  throw new Error("failed to write materialized opencode.jsonc (serve would 401 on the {env:\u2026} template)");
9801
9860
  }
9802
9861
  const serveCmd = `${OPENCODE_BIN} serve --hostname 127.0.0.1 --port ${port} --print-logs`;
9803
9862
  log2(`[opencode-session] starting '${tmuxSession}' for '${codeName}' on 127.0.0.1:${port}`);
9804
9863
  const child = spawn(
9805
9864
  "tmux",
9806
- ["new-session", "-d", "-s", tmuxSession, "-c", projectDir2, serveCmd],
9807
- { cwd: projectDir2, stdio: ["ignore", "pipe", "pipe"], env: serveEnv }
9865
+ ["new-session", "-d", "-s", tmuxSession, "-c", projectDir, serveCmd],
9866
+ { cwd: projectDir, stdio: ["ignore", "pipe", "pipe"], env: serveEnv }
9808
9867
  );
9809
9868
  child.on("close", (code) => {
9810
9869
  if (code !== 0) {
@@ -10041,37 +10100,37 @@ function rotateDailySession(codeName, now = /* @__PURE__ */ new Date(), timezone
10041
10100
  writeFile(codeName, { current: next, history });
10042
10101
  return next.sessionId;
10043
10102
  }
10044
- function encodeProjectPath(projectDir2) {
10045
- return "-" + projectDir2.replace(/^\//, "").replace(/[/.]/g, "-");
10103
+ function encodeProjectPath(projectDir) {
10104
+ return "-" + projectDir.replace(/^\//, "").replace(/[/.]/g, "-");
10046
10105
  }
10047
- function sessionFileExists(projectDir2, sessionId) {
10106
+ function sessionFileExists(projectDir, sessionId) {
10048
10107
  const path = join4(
10049
10108
  homedir4(),
10050
10109
  ".claude",
10051
10110
  "projects",
10052
- encodeProjectPath(projectDir2),
10111
+ encodeProjectPath(projectDir),
10053
10112
  `${sessionId}.jsonl`
10054
10113
  );
10055
10114
  return existsSync5(path);
10056
10115
  }
10057
- function sessionTranscriptDir(projectDir2) {
10058
- return join4(homedir4(), ".claude", "projects", encodeProjectPath(projectDir2));
10116
+ function sessionTranscriptDir(projectDir) {
10117
+ return join4(homedir4(), ".claude", "projects", encodeProjectPath(projectDir));
10059
10118
  }
10060
- function sessionFilePath(projectDir2, sessionId) {
10061
- return join4(sessionTranscriptDir(projectDir2), `${sessionId}.jsonl`);
10119
+ function sessionFilePath(projectDir, sessionId) {
10120
+ return join4(sessionTranscriptDir(projectDir), `${sessionId}.jsonl`);
10062
10121
  }
10063
- function transcriptActivityAgeSeconds(projectDir2, sessionId, now = /* @__PURE__ */ new Date()) {
10122
+ function transcriptActivityAgeSeconds(projectDir, sessionId, now = /* @__PURE__ */ new Date()) {
10064
10123
  if (!sessionId) return null;
10065
10124
  try {
10066
- const mtimeMs = statSync(sessionFilePath(projectDir2, sessionId)).mtimeMs;
10125
+ const mtimeMs = statSync(sessionFilePath(projectDir, sessionId)).mtimeMs;
10067
10126
  return Math.max(0, Math.floor((now.getTime() - mtimeMs) / 1e3));
10068
10127
  } catch {
10069
10128
  return null;
10070
10129
  }
10071
10130
  }
10072
- function subagentActivityAgeSeconds(projectDir2, sessionId, now = /* @__PURE__ */ new Date()) {
10131
+ function subagentActivityAgeSeconds(projectDir, sessionId, now = /* @__PURE__ */ new Date()) {
10073
10132
  if (!sessionId) return null;
10074
- const dir = join4(sessionTranscriptDir(projectDir2), sessionId, "subagents");
10133
+ const dir = join4(sessionTranscriptDir(projectDir), sessionId, "subagents");
10075
10134
  try {
10076
10135
  let freshestMtimeMs = null;
10077
10136
  for (const name of readdirSync2(dir)) {
@@ -10088,8 +10147,8 @@ function subagentActivityAgeSeconds(projectDir2, sessionId, now = /* @__PURE__ *
10088
10147
  return null;
10089
10148
  }
10090
10149
  }
10091
- function isAgentIdle(projectDir2, sessionId, idleSeconds = 60, now = /* @__PURE__ */ new Date()) {
10092
- const path = sessionFilePath(projectDir2, sessionId);
10150
+ function isAgentIdle(projectDir, sessionId, idleSeconds = 60, now = /* @__PURE__ */ new Date()) {
10151
+ const path = sessionFilePath(projectDir, sessionId);
10093
10152
  if (!existsSync5(path)) return true;
10094
10153
  try {
10095
10154
  const mtimeMs = statSync(path).mtimeMs;
@@ -10545,7 +10604,7 @@ function restartEgressSidecar(codeName) {
10545
10604
  }
10546
10605
  }
10547
10606
  function buildDockerRunCommand(args) {
10548
- const { codeName, agentId, wrapperPath, projectDir: projectDir2, homeDir, runId, passApiKey, passOpenRouter, egress, forwardSlackReplyBinding, forwardBlockTurnEndAllMarkers, forwardKanbanWaiting, forwardNotifyDispatch } = args;
10607
+ const { codeName, agentId, wrapperPath, projectDir, homeDir, runId, passApiKey, passOpenRouter, egress, forwardSlackReplyBinding, forwardBlockTurnEndAllMarkers, forwardKanbanWaiting, forwardNotifyDispatch } = args;
10549
10608
  const q = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
10550
10609
  const agentDir2 = join5(homeDir, ".augmented", codeName);
10551
10610
  const agentIdDir = join5(homeDir, ".augmented", agentId);
@@ -10622,7 +10681,7 @@ function buildDockerRunCommand(args) {
10622
10681
  "--security-opt no-new-privileges",
10623
10682
  ...networkArgs,
10624
10683
  ...mounts,
10625
- `-w ${q(projectDir2)}`,
10684
+ `-w ${q(projectDir)}`,
10626
10685
  ...envArgs,
10627
10686
  q(image),
10628
10687
  q(wrapperPath)
@@ -10630,9 +10689,9 @@ function buildDockerRunCommand(args) {
10630
10689
  return egress ? `${egressSetup} && ${runCmd}` : `docker rm -f agt-${codeName} >/dev/null 2>&1; ${runCmd}`;
10631
10690
  }
10632
10691
  function writePersistentClaudeWrapper(args) {
10633
- const { projectDir: projectDir2, claudeBin, initPrompt, claudeArgsJoined } = args;
10634
- const envIntegrationsPath = join5(projectDir2, ".env.integrations");
10635
- const wrapperPath = join5(projectDir2, ".claude", "persistent-claude.sh");
10692
+ const { projectDir, claudeBin, initPrompt, claudeArgsJoined } = args;
10693
+ const envIntegrationsPath = join5(projectDir, ".env.integrations");
10694
+ const wrapperPath = join5(projectDir, ".claude", "persistent-claude.sh");
10636
10695
  const wrapperLines = [
10637
10696
  "#!/usr/bin/env bash",
10638
10697
  "set -e",
@@ -10651,7 +10710,7 @@ function writePersistentClaudeWrapper(args) {
10651
10710
  wrapperLines.push(
10652
10711
  `exec ${JSON.stringify(claudeBin)} ${initPromptArg}${claudeArgsJoined}`
10653
10712
  );
10654
- mkdirSync5(join5(projectDir2, ".claude"), { recursive: true });
10713
+ mkdirSync5(join5(projectDir, ".claude"), { recursive: true });
10655
10714
  writeFileSync5(wrapperPath, wrapperLines.join("\n") + "\n", { mode: 448 });
10656
10715
  chmodSync3(wrapperPath, 448);
10657
10716
  return wrapperPath;
@@ -10745,7 +10804,7 @@ function getLastFailureContext(codeName) {
10745
10804
  };
10746
10805
  }
10747
10806
  function resolveSessionSpawnDecision(args) {
10748
- const { codeName, projectDir: projectDir2, agentTimezone } = args;
10807
+ const { codeName, projectDir, agentTimezone } = args;
10749
10808
  const now = args.now ?? /* @__PURE__ */ new Date();
10750
10809
  const disableFlag = process.env["AGT_DISABLE_SESSION_RESUME"];
10751
10810
  const resumeDisabled = disableFlag === "1" || disableFlag?.toLowerCase() === "true";
@@ -10753,7 +10812,7 @@ function resolveSessionSpawnDecision(args) {
10753
10812
  return { flag: "--session-id", sessionId: randomUUID2(), reason: "resume-disabled" };
10754
10813
  }
10755
10814
  const daily = getOrCreateDailySession(codeName, now, agentTimezone);
10756
- if (!daily.isNew && sessionFileExists(projectDir2, daily.sessionId)) {
10815
+ if (!daily.isNew && sessionFileExists(projectDir, daily.sessionId)) {
10757
10816
  return { flag: "--resume", sessionId: daily.sessionId, reason: "resume-today" };
10758
10817
  }
10759
10818
  if (daily.isNew) {
@@ -10812,7 +10871,7 @@ function startPersistentSession(config) {
10812
10871
  return session;
10813
10872
  }
10814
10873
  function spawnSession(config, session) {
10815
- const { codeName, projectDir: projectDir2, mcpConfigPath, claudeMdPath, channels, devChannels, apiHost, log: log2 } = config;
10874
+ const { codeName, projectDir, mcpConfigPath, claudeMdPath, channels, devChannels, apiHost, log: log2 } = config;
10816
10875
  const claudeAuthMode = config.claudeAuthMode ?? "subscription";
10817
10876
  const openRouterMode = !!config.openRouter;
10818
10877
  const tmuxSession = `agt-${codeName}`;
@@ -10856,7 +10915,7 @@ function spawnSession(config, session) {
10856
10915
  const args = [];
10857
10916
  const decision = resolveSessionSpawnDecision({
10858
10917
  codeName,
10859
- projectDir: projectDir2,
10918
+ projectDir,
10860
10919
  agentTimezone: config.agentTimezone ?? void 0
10861
10920
  });
10862
10921
  const sessionId = decision.sessionId;
@@ -10906,7 +10965,7 @@ function spawnSession(config, session) {
10906
10965
  const claudeBin = resolveClaudeBinary();
10907
10966
  const claudeArgsJoined = args.map((a) => a.includes(" ") || a.includes("*") ? JSON.stringify(a) : a).join(" ");
10908
10967
  const wrapperPath = writePersistentClaudeWrapper({
10909
- projectDir: projectDir2,
10968
+ projectDir,
10910
10969
  claudeBin,
10911
10970
  initPrompt,
10912
10971
  claudeArgsJoined
@@ -10947,7 +11006,7 @@ function spawnSession(config, session) {
10947
11006
  codeName,
10948
11007
  agentId: config.agentId,
10949
11008
  wrapperPath,
10950
- projectDir: projectDir2,
11009
+ projectDir,
10951
11010
  homeDir: sessionHomeDir,
10952
11011
  runId: config.runId ?? void 0,
10953
11012
  passApiKey: !openRouterMode && claudeAuthMode === "api_key" && !!config.anthropicApiKey,
@@ -10998,7 +11057,7 @@ function spawnSession(config, session) {
10998
11057
  } : { ...tmuxEnv, ...apiKeyEnv, ...openRouterEnv };
10999
11058
  for (const f of probeMcpEnvSubstitution({
11000
11059
  mcpConfigPath,
11001
- envIntegrationsPath: join5(projectDir2, ".env.integrations"),
11060
+ envIntegrationsPath: join5(projectDir, ".env.integrations"),
11002
11061
  baseEnv: probeBaseEnv
11003
11062
  })) {
11004
11063
  log2(`[persistent-session] ${formatMissingVar(f)} agent=${codeName}`);
@@ -11009,11 +11068,11 @@ function spawnSession(config, session) {
11009
11068
  "-s",
11010
11069
  tmuxSession,
11011
11070
  "-c",
11012
- projectDir2,
11071
+ projectDir,
11013
11072
  ...tmuxSessionEnvArgs,
11014
11073
  claudeCmd
11015
11074
  ], {
11016
- cwd: projectDir2,
11075
+ cwd: projectDir,
11017
11076
  stdio: ["ignore", "pipe", "pipe"],
11018
11077
  env: tmuxEnv
11019
11078
  });
@@ -11556,6 +11615,7 @@ export {
11556
11615
  getIntegration,
11557
11616
  OAUTH_PROVIDERS,
11558
11617
  toOpencodeModel,
11618
+ mergeOpencodeConfigArtifact,
11559
11619
  readChannelServerEnv,
11560
11620
  formatActorId,
11561
11621
  isSelfCompletion,
@@ -11687,4 +11747,4 @@ export {
11687
11747
  stopAllSessionsAndWait,
11688
11748
  getProjectDir
11689
11749
  };
11690
- //# sourceMappingURL=chunk-N7Z6UOKY.js.map
11750
+ //# sourceMappingURL=chunk-COOBM6RF.js.map