@integrity-labs/agt-cli 0.28.366 → 0.28.368

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-YUQIJ2KO.js";
43
+ } from "../chunk-3QBV4ZA3.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-EFIXTBUQ.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.366" : "dev";
4832
+ var cliVersion = true ? "0.28.368" : "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.366" : "dev";
6004
+ var cliVersion2 = true ? "0.28.368" : "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-EFIXTBUQ.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.366" : "dev";
6351
+ var agtCliVersion = true ? "0.28.368" : "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-YUQIJ2KO.js.map
8797
+ //# sourceMappingURL=chunk-3QBV4ZA3.js.map
@@ -8811,6 +8811,46 @@ function buildOpencodeConfig(input, opts) {
8811
8811
  }
8812
8812
  };
8813
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
+ }
8814
8854
 
8815
8855
  // ../../packages/core/dist/provisioning/platform-storage.js
8816
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.";
@@ -9206,14 +9246,14 @@ function agentDir(codeName) {
9206
9246
  assertValidCodeName(codeName);
9207
9247
  return join(getHomeDir(), ".augmented", codeName);
9208
9248
  }
9209
- function projectDir(codeName) {
9210
- return join(agentDir(codeName), "project");
9249
+ function provisionConfigDir(codeName) {
9250
+ return join(agentDir(codeName), "provision");
9211
9251
  }
9212
9252
  function mcpBundlePath() {
9213
9253
  return join(getHomeDir(), ".augmented", "_mcp", MCP_BUNDLE_BASENAME);
9214
9254
  }
9215
9255
  function configPath(codeName) {
9216
- return join(projectDir(codeName), CONFIG_FILE);
9256
+ return join(provisionConfigDir(codeName), CONFIG_FILE);
9217
9257
  }
9218
9258
  function readConfig(codeName) {
9219
9259
  const p2 = configPath(codeName);
@@ -9227,7 +9267,7 @@ function readConfig(codeName) {
9227
9267
  }
9228
9268
  function writeConfig(codeName, config) {
9229
9269
  const p2 = configPath(codeName);
9230
- mkdirSync(projectDir(codeName), { recursive: true });
9270
+ mkdirSync(provisionConfigDir(codeName), { recursive: true });
9231
9271
  writeFileSync2(p2, JSON.stringify(config, null, 2));
9232
9272
  }
9233
9273
  function upsertEnvIntegrations(codeName, updates) {
@@ -9695,12 +9735,12 @@ function writeConfigFile600(target, content, codeName, log2) {
9695
9735
  return false;
9696
9736
  }
9697
9737
  }
9698
- function writeMaterializedOpencodeConfig(codeName, projectDir2, serveEnv, log2) {
9699
- const projectTarget = join3(projectDir2, MATERIALIZED_CONFIG_BASENAME);
9738
+ function writeMaterializedOpencodeConfig(codeName, projectDir, serveEnv, log2) {
9739
+ const projectTarget = join3(projectDir, MATERIALIZED_CONFIG_BASENAME);
9700
9740
  const globalTarget = opencodeGlobalConfigPath(serveEnv);
9701
9741
  let raw;
9702
9742
  try {
9703
- raw = readFileSync5(join3(projectDir2, "opencode.json"), "utf-8");
9743
+ raw = readFileSync5(join3(projectDir, "opencode.json"), "utf-8");
9704
9744
  } catch {
9705
9745
  for (const t of [projectTarget, globalTarget]) {
9706
9746
  try {
@@ -9793,9 +9833,9 @@ async function startOpencodeSession(config) {
9793
9833
  return session;
9794
9834
  }
9795
9835
  async function spawnServe(config, session) {
9796
- const { codeName, projectDir: projectDir2, log: log2 } = config;
9797
- if (!existsSync4(join3(projectDir2, "opencode.json"))) {
9798
- 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)`);
9799
9839
  }
9800
9840
  const tmuxSession = opencodeTmuxSession(codeName);
9801
9841
  const port = await findFreePort();
@@ -9815,15 +9855,15 @@ async function spawnServe(config, session) {
9815
9855
  };
9816
9856
  if (config.runId) serveEnv["AGT_RUN_ID"] = config.runId;
9817
9857
  if (config.agentTimezone) serveEnv["TZ"] = config.agentTimezone;
9818
- if (!writeMaterializedOpencodeConfig(codeName, projectDir2, serveEnv, log2)) {
9858
+ if (!writeMaterializedOpencodeConfig(codeName, projectDir, serveEnv, log2)) {
9819
9859
  throw new Error("failed to write materialized opencode.jsonc (serve would 401 on the {env:\u2026} template)");
9820
9860
  }
9821
9861
  const serveCmd = `${OPENCODE_BIN} serve --hostname 127.0.0.1 --port ${port} --print-logs`;
9822
9862
  log2(`[opencode-session] starting '${tmuxSession}' for '${codeName}' on 127.0.0.1:${port}`);
9823
9863
  const child = spawn(
9824
9864
  "tmux",
9825
- ["new-session", "-d", "-s", tmuxSession, "-c", projectDir2, serveCmd],
9826
- { 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 }
9827
9867
  );
9828
9868
  child.on("close", (code) => {
9829
9869
  if (code !== 0) {
@@ -10060,37 +10100,37 @@ function rotateDailySession(codeName, now = /* @__PURE__ */ new Date(), timezone
10060
10100
  writeFile(codeName, { current: next, history });
10061
10101
  return next.sessionId;
10062
10102
  }
10063
- function encodeProjectPath(projectDir2) {
10064
- return "-" + projectDir2.replace(/^\//, "").replace(/[/.]/g, "-");
10103
+ function encodeProjectPath(projectDir) {
10104
+ return "-" + projectDir.replace(/^\//, "").replace(/[/.]/g, "-");
10065
10105
  }
10066
- function sessionFileExists(projectDir2, sessionId) {
10106
+ function sessionFileExists(projectDir, sessionId) {
10067
10107
  const path = join4(
10068
10108
  homedir4(),
10069
10109
  ".claude",
10070
10110
  "projects",
10071
- encodeProjectPath(projectDir2),
10111
+ encodeProjectPath(projectDir),
10072
10112
  `${sessionId}.jsonl`
10073
10113
  );
10074
10114
  return existsSync5(path);
10075
10115
  }
10076
- function sessionTranscriptDir(projectDir2) {
10077
- return join4(homedir4(), ".claude", "projects", encodeProjectPath(projectDir2));
10116
+ function sessionTranscriptDir(projectDir) {
10117
+ return join4(homedir4(), ".claude", "projects", encodeProjectPath(projectDir));
10078
10118
  }
10079
- function sessionFilePath(projectDir2, sessionId) {
10080
- return join4(sessionTranscriptDir(projectDir2), `${sessionId}.jsonl`);
10119
+ function sessionFilePath(projectDir, sessionId) {
10120
+ return join4(sessionTranscriptDir(projectDir), `${sessionId}.jsonl`);
10081
10121
  }
10082
- function transcriptActivityAgeSeconds(projectDir2, sessionId, now = /* @__PURE__ */ new Date()) {
10122
+ function transcriptActivityAgeSeconds(projectDir, sessionId, now = /* @__PURE__ */ new Date()) {
10083
10123
  if (!sessionId) return null;
10084
10124
  try {
10085
- const mtimeMs = statSync(sessionFilePath(projectDir2, sessionId)).mtimeMs;
10125
+ const mtimeMs = statSync(sessionFilePath(projectDir, sessionId)).mtimeMs;
10086
10126
  return Math.max(0, Math.floor((now.getTime() - mtimeMs) / 1e3));
10087
10127
  } catch {
10088
10128
  return null;
10089
10129
  }
10090
10130
  }
10091
- function subagentActivityAgeSeconds(projectDir2, sessionId, now = /* @__PURE__ */ new Date()) {
10131
+ function subagentActivityAgeSeconds(projectDir, sessionId, now = /* @__PURE__ */ new Date()) {
10092
10132
  if (!sessionId) return null;
10093
- const dir = join4(sessionTranscriptDir(projectDir2), sessionId, "subagents");
10133
+ const dir = join4(sessionTranscriptDir(projectDir), sessionId, "subagents");
10094
10134
  try {
10095
10135
  let freshestMtimeMs = null;
10096
10136
  for (const name of readdirSync2(dir)) {
@@ -10107,8 +10147,8 @@ function subagentActivityAgeSeconds(projectDir2, sessionId, now = /* @__PURE__ *
10107
10147
  return null;
10108
10148
  }
10109
10149
  }
10110
- function isAgentIdle(projectDir2, sessionId, idleSeconds = 60, now = /* @__PURE__ */ new Date()) {
10111
- const path = sessionFilePath(projectDir2, sessionId);
10150
+ function isAgentIdle(projectDir, sessionId, idleSeconds = 60, now = /* @__PURE__ */ new Date()) {
10151
+ const path = sessionFilePath(projectDir, sessionId);
10112
10152
  if (!existsSync5(path)) return true;
10113
10153
  try {
10114
10154
  const mtimeMs = statSync(path).mtimeMs;
@@ -10564,7 +10604,7 @@ function restartEgressSidecar(codeName) {
10564
10604
  }
10565
10605
  }
10566
10606
  function buildDockerRunCommand(args) {
10567
- 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;
10568
10608
  const q = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
10569
10609
  const agentDir2 = join5(homeDir, ".augmented", codeName);
10570
10610
  const agentIdDir = join5(homeDir, ".augmented", agentId);
@@ -10641,7 +10681,7 @@ function buildDockerRunCommand(args) {
10641
10681
  "--security-opt no-new-privileges",
10642
10682
  ...networkArgs,
10643
10683
  ...mounts,
10644
- `-w ${q(projectDir2)}`,
10684
+ `-w ${q(projectDir)}`,
10645
10685
  ...envArgs,
10646
10686
  q(image),
10647
10687
  q(wrapperPath)
@@ -10649,9 +10689,9 @@ function buildDockerRunCommand(args) {
10649
10689
  return egress ? `${egressSetup} && ${runCmd}` : `docker rm -f agt-${codeName} >/dev/null 2>&1; ${runCmd}`;
10650
10690
  }
10651
10691
  function writePersistentClaudeWrapper(args) {
10652
- const { projectDir: projectDir2, claudeBin, initPrompt, claudeArgsJoined } = args;
10653
- const envIntegrationsPath = join5(projectDir2, ".env.integrations");
10654
- 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");
10655
10695
  const wrapperLines = [
10656
10696
  "#!/usr/bin/env bash",
10657
10697
  "set -e",
@@ -10670,7 +10710,7 @@ function writePersistentClaudeWrapper(args) {
10670
10710
  wrapperLines.push(
10671
10711
  `exec ${JSON.stringify(claudeBin)} ${initPromptArg}${claudeArgsJoined}`
10672
10712
  );
10673
- mkdirSync5(join5(projectDir2, ".claude"), { recursive: true });
10713
+ mkdirSync5(join5(projectDir, ".claude"), { recursive: true });
10674
10714
  writeFileSync5(wrapperPath, wrapperLines.join("\n") + "\n", { mode: 448 });
10675
10715
  chmodSync3(wrapperPath, 448);
10676
10716
  return wrapperPath;
@@ -10764,7 +10804,7 @@ function getLastFailureContext(codeName) {
10764
10804
  };
10765
10805
  }
10766
10806
  function resolveSessionSpawnDecision(args) {
10767
- const { codeName, projectDir: projectDir2, agentTimezone } = args;
10807
+ const { codeName, projectDir, agentTimezone } = args;
10768
10808
  const now = args.now ?? /* @__PURE__ */ new Date();
10769
10809
  const disableFlag = process.env["AGT_DISABLE_SESSION_RESUME"];
10770
10810
  const resumeDisabled = disableFlag === "1" || disableFlag?.toLowerCase() === "true";
@@ -10772,7 +10812,7 @@ function resolveSessionSpawnDecision(args) {
10772
10812
  return { flag: "--session-id", sessionId: randomUUID2(), reason: "resume-disabled" };
10773
10813
  }
10774
10814
  const daily = getOrCreateDailySession(codeName, now, agentTimezone);
10775
- if (!daily.isNew && sessionFileExists(projectDir2, daily.sessionId)) {
10815
+ if (!daily.isNew && sessionFileExists(projectDir, daily.sessionId)) {
10776
10816
  return { flag: "--resume", sessionId: daily.sessionId, reason: "resume-today" };
10777
10817
  }
10778
10818
  if (daily.isNew) {
@@ -10831,7 +10871,7 @@ function startPersistentSession(config) {
10831
10871
  return session;
10832
10872
  }
10833
10873
  function spawnSession(config, session) {
10834
- const { codeName, projectDir: projectDir2, mcpConfigPath, claudeMdPath, channels, devChannels, apiHost, log: log2 } = config;
10874
+ const { codeName, projectDir, mcpConfigPath, claudeMdPath, channels, devChannels, apiHost, log: log2 } = config;
10835
10875
  const claudeAuthMode = config.claudeAuthMode ?? "subscription";
10836
10876
  const openRouterMode = !!config.openRouter;
10837
10877
  const tmuxSession = `agt-${codeName}`;
@@ -10875,7 +10915,7 @@ function spawnSession(config, session) {
10875
10915
  const args = [];
10876
10916
  const decision = resolveSessionSpawnDecision({
10877
10917
  codeName,
10878
- projectDir: projectDir2,
10918
+ projectDir,
10879
10919
  agentTimezone: config.agentTimezone ?? void 0
10880
10920
  });
10881
10921
  const sessionId = decision.sessionId;
@@ -10925,7 +10965,7 @@ function spawnSession(config, session) {
10925
10965
  const claudeBin = resolveClaudeBinary();
10926
10966
  const claudeArgsJoined = args.map((a) => a.includes(" ") || a.includes("*") ? JSON.stringify(a) : a).join(" ");
10927
10967
  const wrapperPath = writePersistentClaudeWrapper({
10928
- projectDir: projectDir2,
10968
+ projectDir,
10929
10969
  claudeBin,
10930
10970
  initPrompt,
10931
10971
  claudeArgsJoined
@@ -10966,7 +11006,7 @@ function spawnSession(config, session) {
10966
11006
  codeName,
10967
11007
  agentId: config.agentId,
10968
11008
  wrapperPath,
10969
- projectDir: projectDir2,
11009
+ projectDir,
10970
11010
  homeDir: sessionHomeDir,
10971
11011
  runId: config.runId ?? void 0,
10972
11012
  passApiKey: !openRouterMode && claudeAuthMode === "api_key" && !!config.anthropicApiKey,
@@ -11017,7 +11057,7 @@ function spawnSession(config, session) {
11017
11057
  } : { ...tmuxEnv, ...apiKeyEnv, ...openRouterEnv };
11018
11058
  for (const f of probeMcpEnvSubstitution({
11019
11059
  mcpConfigPath,
11020
- envIntegrationsPath: join5(projectDir2, ".env.integrations"),
11060
+ envIntegrationsPath: join5(projectDir, ".env.integrations"),
11021
11061
  baseEnv: probeBaseEnv
11022
11062
  })) {
11023
11063
  log2(`[persistent-session] ${formatMissingVar(f)} agent=${codeName}`);
@@ -11028,11 +11068,11 @@ function spawnSession(config, session) {
11028
11068
  "-s",
11029
11069
  tmuxSession,
11030
11070
  "-c",
11031
- projectDir2,
11071
+ projectDir,
11032
11072
  ...tmuxSessionEnvArgs,
11033
11073
  claudeCmd
11034
11074
  ], {
11035
- cwd: projectDir2,
11075
+ cwd: projectDir,
11036
11076
  stdio: ["ignore", "pipe", "pipe"],
11037
11077
  env: tmuxEnv
11038
11078
  });
@@ -11575,6 +11615,7 @@ export {
11575
11615
  getIntegration,
11576
11616
  OAUTH_PROVIDERS,
11577
11617
  toOpencodeModel,
11618
+ mergeOpencodeConfigArtifact,
11578
11619
  readChannelServerEnv,
11579
11620
  formatActorId,
11580
11621
  isSelfCompletion,
@@ -11706,4 +11747,4 @@ export {
11706
11747
  stopAllSessionsAndWait,
11707
11748
  getProjectDir
11708
11749
  };
11709
- //# sourceMappingURL=chunk-EFIXTBUQ.js.map
11750
+ //# sourceMappingURL=chunk-COOBM6RF.js.map