@integrity-labs/agt-cli 0.28.358 → 0.28.359

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.
@@ -100,7 +100,7 @@ async function spawnPairSession(session) {
100
100
  return { ok: true };
101
101
  } catch {
102
102
  }
103
- const { resolveClaudeBinary } = await import("./persistent-session-LFCRKYPY.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-R7JOZNIC.js");
104
104
  const claudeBin = resolveClaudeBinary();
105
105
  const pairEnv = {
106
106
  ...process.env,
@@ -373,4 +373,4 @@ export {
373
373
  startClaudePair,
374
374
  submitClaudePairCode
375
375
  };
376
- //# sourceMappingURL=claude-pair-runtime-OLK7HT2U.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-ASRAOWWQ.js.map
@@ -10,6 +10,7 @@ import {
10
10
  api,
11
11
  atomicWriteFileSync,
12
12
  buildConnectivityProbeDeps,
13
+ buildOpencodeTranscript,
13
14
  buildProbeEnv,
14
15
  classifyEnvIntegrationsDiff,
15
16
  clearPresenceReaperState,
@@ -18,6 +19,7 @@ import {
18
19
  defaultFlagsCachePath,
19
20
  deriveMcpServerKey,
20
21
  diffEnvIntegrations,
22
+ emptyOpencodeTranscript,
21
23
  envOnlyRespawnVars,
22
24
  estimateActiveTasksTokens,
23
25
  exchangeApiKey,
@@ -48,7 +50,7 @@ import {
48
50
  safeWriteJsonAtomic,
49
51
  setConfigHash,
50
52
  toOpencodeModel
51
- } from "../chunk-OUHANHOH.js";
53
+ } from "../chunk-TVFNWNSP.js";
52
54
  import {
53
55
  getProjectDir as getProjectDir2,
54
56
  getReadyTasks,
@@ -139,7 +141,7 @@ import {
139
141
  takeZombieDetection,
140
142
  transcriptActivityAgeSeconds,
141
143
  writeEgressAllowlist
142
- } from "../chunk-HTBXOXPI.js";
144
+ } from "../chunk-FAGXXKWZ.js";
143
145
  import {
144
146
  reapOrphanChannelMcps
145
147
  } from "../chunk-XWVM4KPK.js";
@@ -148,7 +150,7 @@ import {
148
150
  import { createHash as createHash14 } from "crypto";
149
151
  import { readFileSync as readFileSync19, writeFileSync as writeFileSync12, mkdirSync as mkdirSync10, existsSync as existsSync13, rmSync as rmSync6, readdirSync as readdirSync5, statSync as statSync4, copyFileSync } from "fs";
150
152
  import { execFileSync as syncExecFile } from "child_process";
151
- import { join as join23, dirname as dirname6, delimiter as pathDelimiter } from "path";
153
+ import { join as join23, dirname as dirname7, delimiter as pathDelimiter } from "path";
152
154
  import { homedir as homedir12 } from "os";
153
155
  import { fileURLToPath } from "url";
154
156
 
@@ -5639,7 +5641,7 @@ import { createServer } from "net";
5639
5641
  import { randomBytes } from "crypto";
5640
5642
  import { existsSync as existsSync10, mkdirSync as mkdirSync7, readFileSync as readFileSync16, writeFileSync as writeFileSync9, rmSync as rmSync4, chmodSync as chmodSync2 } from "fs";
5641
5643
  import { homedir as homedir10, userInfo } from "os";
5642
- import { join as join20 } from "path";
5644
+ import { join as join20, dirname as dirname6 } from "path";
5643
5645
  var OPENCODE_BIN = process.env["AGT_OPENCODE_BIN"]?.trim() || "opencode";
5644
5646
  var sessions = /* @__PURE__ */ new Map();
5645
5647
  var bridges = /* @__PURE__ */ new Map();
@@ -5649,6 +5651,73 @@ function opencodeTmuxSession(codeName) {
5649
5651
  function opencodePaneLogPath(codeName) {
5650
5652
  return join20(homedir10(), ".augmented", codeName, "opencode-serve.log");
5651
5653
  }
5654
+ function opencodeTranscriptPath(codeName) {
5655
+ return join20(dirname6(opencodePaneLogPath(codeName)), "opencode-transcript.json");
5656
+ }
5657
+ var TRANSCRIPT_REFRESH_MS = 3e3;
5658
+ var TRANSCRIPT_MAX_MESSAGES = 100;
5659
+ var transcriptTimers = /* @__PURE__ */ new Map();
5660
+ function pickNewestSession(sessions2) {
5661
+ let newest = null;
5662
+ let newestT = Number.NEGATIVE_INFINITY;
5663
+ for (const s of sessions2) {
5664
+ const t = s.updated ?? s.created ?? 0;
5665
+ if (t >= newestT) {
5666
+ newestT = t;
5667
+ newest = s;
5668
+ }
5669
+ }
5670
+ return newest;
5671
+ }
5672
+ async function refreshOpencodeTranscript(codeName) {
5673
+ const session = sessions.get(codeName);
5674
+ if (!session || session.status !== "running" || !session.port || !session.password) return;
5675
+ const client2 = new HttpOpencodeClient({
5676
+ baseUrl: baseUrlFor(session.port),
5677
+ password: session.password,
5678
+ requestTimeoutMs: 8e3
5679
+ });
5680
+ let transcript;
5681
+ try {
5682
+ const newest = pickNewestSession(await client2.listSessions());
5683
+ transcript = newest ? buildOpencodeTranscript({
5684
+ sessionId: newest.id,
5685
+ sessionTitle: newest.title ?? null,
5686
+ messages: await client2.getStructuredMessages(newest.id),
5687
+ capturedAt: Date.now(),
5688
+ redact: redactForDiskLog,
5689
+ maxMessages: TRANSCRIPT_MAX_MESSAGES
5690
+ }) : emptyOpencodeTranscript(Date.now());
5691
+ } catch {
5692
+ return;
5693
+ }
5694
+ try {
5695
+ const target = opencodeTranscriptPath(codeName);
5696
+ mkdirSync7(dirname6(target), { recursive: true });
5697
+ writeFileSync9(target, JSON.stringify(transcript), { mode: 384 });
5698
+ try {
5699
+ chmodSync2(target, 384);
5700
+ } catch {
5701
+ }
5702
+ } catch {
5703
+ }
5704
+ }
5705
+ function startTranscriptRefresher(codeName) {
5706
+ if (transcriptTimers.has(codeName)) return;
5707
+ const timer = setInterval(() => {
5708
+ void refreshOpencodeTranscript(codeName);
5709
+ }, TRANSCRIPT_REFRESH_MS);
5710
+ timer.unref?.();
5711
+ transcriptTimers.set(codeName, timer);
5712
+ void refreshOpencodeTranscript(codeName);
5713
+ }
5714
+ function stopTranscriptRefresher(codeName) {
5715
+ const timer = transcriptTimers.get(codeName);
5716
+ if (timer) {
5717
+ clearInterval(timer);
5718
+ transcriptTimers.delete(codeName);
5719
+ }
5720
+ }
5652
5721
  function readProvisionedOpencodeModel(agentDir) {
5653
5722
  return readOpencodeModelString(join20(agentDir, "provision", "opencode.json"));
5654
5723
  }
@@ -5818,6 +5887,8 @@ async function spawnServe(config2, session) {
5818
5887
  session.status = "running";
5819
5888
  session.restartCount = 0;
5820
5889
  bridges.delete(codeName);
5890
+ stopTranscriptRefresher(codeName);
5891
+ startTranscriptRefresher(codeName);
5821
5892
  }
5822
5893
  function setupPaneLog(tmuxSession, codeName, log2) {
5823
5894
  const logPath = opencodePaneLogPath(codeName);
@@ -5873,6 +5944,7 @@ function stopOpencodeSession(codeName, log2) {
5873
5944
  log2(`[opencode-session] stopped '${tmuxSession}' for '${codeName}'`);
5874
5945
  } catch {
5875
5946
  }
5947
+ stopTranscriptRefresher(codeName);
5876
5948
  bridges.delete(codeName);
5877
5949
  const session = sessions.get(codeName);
5878
5950
  if (session) {
@@ -9460,7 +9532,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
9460
9532
  var lastVersionCheckAt = 0;
9461
9533
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
9462
9534
  var lastResponsivenessProbeAt = 0;
9463
- var agtCliVersion = true ? "0.28.358" : "dev";
9535
+ var agtCliVersion = true ? "0.28.359" : "dev";
9464
9536
  function resolveBrewPath(execFileSync2) {
9465
9537
  try {
9466
9538
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -9555,7 +9627,7 @@ async function ensureToolkitCli(toolkitSlug) {
9555
9627
  toolkitCliEnsured.add(toolkitSlug);
9556
9628
  return;
9557
9629
  }
9558
- brewBinDir = dirname6(brewPath);
9630
+ brewBinDir = dirname7(brewPath);
9559
9631
  const isRoot = typeof process.getuid === "function" && process.getuid() === 0;
9560
9632
  log(`[toolkit-install] ${toolkitSlug}: installing via brew (${pkg})\u2026`);
9561
9633
  if (isRoot) {
@@ -9655,7 +9727,7 @@ function ensureClaudeManagedSettings(path = claudeManagedSettingsPath()) {
9655
9727
  }
9656
9728
  if (settings.channelsEnabled === true) return "ok";
9657
9729
  settings.channelsEnabled = true;
9658
- mkdirSync10(dirname6(path), { recursive: true });
9730
+ mkdirSync10(dirname7(path), { recursive: true });
9659
9731
  writeFileSync12(path, `${JSON.stringify(settings, null, 2)}
9660
9732
  `);
9661
9733
  log(`[managed-settings] set channelsEnabled:true in ${path} (ENG-5786 \u2014 unblocks Claude Code channels)`);
@@ -9751,7 +9823,7 @@ async function ensureFrameworkBinary(frameworkId) {
9751
9823
  log(`Claude Code install failed: ${err.message}`);
9752
9824
  return;
9753
9825
  }
9754
- const brewBinDir = dirname6(brewPath);
9826
+ const brewBinDir = dirname7(brewPath);
9755
9827
  if (!process.env.PATH?.split(":").includes(brewBinDir)) {
9756
9828
  process.env.PATH = `${brewBinDir}:${process.env.PATH ?? ""}`;
9757
9829
  }
@@ -10479,7 +10551,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
10479
10551
  if (codeNames.length === 0) return;
10480
10552
  void (async () => {
10481
10553
  try {
10482
- const { collectDiagnostics } = await import("../persistent-session-LFCRKYPY.js");
10554
+ const { collectDiagnostics } = await import("../persistent-session-R7JOZNIC.js");
10483
10555
  await api.post("/host/heartbeat", {
10484
10556
  host_id: hostId,
10485
10557
  agent_diagnostics: collectDiagnostics(codeNames)
@@ -10578,7 +10650,7 @@ async function pollCycle() {
10578
10650
  }
10579
10651
  try {
10580
10652
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
10581
- const { collectDiagnostics } = await import("../persistent-session-LFCRKYPY.js");
10653
+ const { collectDiagnostics } = await import("../persistent-session-R7JOZNIC.js");
10582
10654
  const diagCodeNames = [...agentState.persistentSessionAgents];
10583
10655
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
10584
10656
  let tailscaleHostname;
@@ -10733,7 +10805,7 @@ async function pollCycle() {
10733
10805
  const {
10734
10806
  collectResponsivenessProbes,
10735
10807
  getResponsivenessIntervalMs
10736
- } = await import("../responsiveness-probe-DUO2RA6D.js");
10808
+ } = await import("../responsiveness-probe-7SUERVWL.js");
10737
10809
  const probeIntervalMs = getResponsivenessIntervalMs();
10738
10810
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
10739
10811
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -10765,7 +10837,7 @@ async function pollCycle() {
10765
10837
  collectResponsivenessProbes,
10766
10838
  livePendingInboundOldestAgeSeconds,
10767
10839
  parkPendingInbound
10768
- } = await import("../responsiveness-probe-DUO2RA6D.js");
10840
+ } = await import("../responsiveness-probe-7SUERVWL.js");
10769
10841
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-HYOOQV4A.js");
10770
10842
  const wedgeNow = /* @__PURE__ */ new Date();
10771
10843
  const liveAgents = agentState.persistentSessionAgents;
@@ -11635,7 +11707,7 @@ async function processAgent(agent, agentStates) {
11635
11707
  log(`${verb} '${agent.code_name}': ${fileNames}`);
11636
11708
  for (const file of changedFiles) {
11637
11709
  const filePath = join23(agentDir, file.relativePath);
11638
- mkdirSync10(dirname6(filePath), { recursive: true });
11710
+ mkdirSync10(dirname7(filePath), { recursive: true });
11639
11711
  if (file.relativePath === ".mcp.json") {
11640
11712
  safeWriteJsonAtomic(filePath, file.content, { mode: 384 });
11641
11713
  } else {
@@ -13920,7 +13992,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
13920
13992
  void api.post("/host/restart-ack", { host_id: hostId, agent_id: agentId, restart_requested_at: requestedAt }).catch((err) => log(`[restart-lane] ack failed for '${codeName}': ${err.message}`));
13921
13993
  void (async () => {
13922
13994
  try {
13923
- const { collectDiagnostics } = await import("../persistent-session-LFCRKYPY.js");
13995
+ const { collectDiagnostics } = await import("../persistent-session-R7JOZNIC.js");
13924
13996
  await api.post("/host/heartbeat", {
13925
13997
  host_id: hostId,
13926
13998
  agent_diagnostics: collectDiagnostics([codeName])
@@ -13970,7 +14042,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
13970
14042
  }
13971
14043
  try {
13972
14044
  const hostId = await getHostId();
13973
- const { collectDiagnostics } = await import("../persistent-session-LFCRKYPY.js");
14045
+ const { collectDiagnostics } = await import("../persistent-session-R7JOZNIC.js");
13974
14046
  await api.post("/host/heartbeat", {
13975
14047
  host_id: hostId,
13976
14048
  agent_diagnostics: collectDiagnostics([codeName])
@@ -14256,7 +14328,7 @@ async function processDirectChatMessage(agent, msg) {
14256
14328
  if (useDoorbell) {
14257
14329
  try {
14258
14330
  const doorbell = directChatDoorbellPath(agent.agentId, homedir12());
14259
- mkdirSync10(dirname6(doorbell), { recursive: true });
14331
+ mkdirSync10(dirname7(doorbell), { recursive: true });
14260
14332
  writeFileSync12(doorbell, String(Date.now()));
14261
14333
  log(`[direct-chat] Doorbell rung for '${agent.codeName}' (msg=${msg.id}) \u2014 in-session MCP will pull via the cursor`);
14262
14334
  return;
@@ -14366,7 +14438,7 @@ ${formatRunMarker(run_id)}` : KANBAN_CHECK_COMMAND;
14366
14438
  if (run_id) openInjectedRunByCode.set(codeName, run_id);
14367
14439
  try {
14368
14440
  const doorbell = directChatDoorbellPath(agentId, homedir12());
14369
- mkdirSync10(dirname6(doorbell), { recursive: true });
14441
+ mkdirSync10(dirname7(doorbell), { recursive: true });
14370
14442
  writeFileSync12(doorbell, String(Date.now()));
14371
14443
  } catch (err) {
14372
14444
  log(`[kanban] doorbell ring failed for '${codeName}': ${err.message} (notice still queued)`);
@@ -14468,7 +14540,7 @@ async function processClaudePairSessions(agents) {
14468
14540
  killPairSession,
14469
14541
  pairTmuxSession,
14470
14542
  finalizeClaudePairOnboarding
14471
- } = await import("../claude-pair-runtime-OLK7HT2U.js");
14543
+ } = await import("../claude-pair-runtime-ASRAOWWQ.js");
14472
14544
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
14473
14545
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
14474
14546
  const killed = await killPairSession(pairTmuxSession(pairId));
@@ -15218,7 +15290,7 @@ function restartRunningChannelMcps(basenames) {
15218
15290
  function deployMcpAssets() {
15219
15291
  const targetDir = join23(homedir12(), ".augmented", "_mcp");
15220
15292
  mkdirSync10(targetDir, { recursive: true });
15221
- const moduleDir = dirname6(fileURLToPath(import.meta.url));
15293
+ const moduleDir = dirname7(fileURLToPath(import.meta.url));
15222
15294
  let mcpSourceDir = "";
15223
15295
  let dir = moduleDir;
15224
15296
  for (let i = 0; i < 6; i++) {
@@ -15227,7 +15299,7 @@ function deployMcpAssets() {
15227
15299
  mcpSourceDir = candidate;
15228
15300
  break;
15229
15301
  }
15230
- const parent = dirname6(dir);
15302
+ const parent = dirname7(dir);
15231
15303
  if (parent === dir) break;
15232
15304
  dir = parent;
15233
15305
  }