@integrity-labs/agt-cli 0.28.152 → 0.28.154

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
@@ -37,7 +37,7 @@ import {
37
37
  success,
38
38
  table,
39
39
  warn
40
- } from "../chunk-2K6DIZXU.js";
40
+ } from "../chunk-Z3Y747JM.js";
41
41
  import {
42
42
  CHANNEL_REGISTRY,
43
43
  DEPLOYMENT_TEMPLATES,
@@ -4777,7 +4777,7 @@ import { execFileSync, execSync } from "child_process";
4777
4777
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4778
4778
  import chalk18 from "chalk";
4779
4779
  import ora16 from "ora";
4780
- var cliVersion = true ? "0.28.152" : "dev";
4780
+ var cliVersion = true ? "0.28.154" : "dev";
4781
4781
  async function fetchLatestVersion() {
4782
4782
  const host2 = getHost();
4783
4783
  if (!host2) return null;
@@ -5791,7 +5791,7 @@ function handleError(err) {
5791
5791
  }
5792
5792
 
5793
5793
  // src/bin/agt.ts
5794
- var cliVersion2 = true ? "0.28.152" : "dev";
5794
+ var cliVersion2 = true ? "0.28.154" : "dev";
5795
5795
  var program = new Command();
5796
5796
  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");
5797
5797
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -1543,7 +1543,6 @@ function getProjectDir(codeName) {
1543
1543
  }
1544
1544
 
1545
1545
  export {
1546
- buildAllowedTools,
1547
1546
  sessionTranscriptDir,
1548
1547
  transcriptActivityAgeSeconds,
1549
1548
  subagentActivityAgeSeconds,
@@ -1589,4 +1588,4 @@ export {
1589
1588
  stopAllSessionsAndWait,
1590
1589
  getProjectDir
1591
1590
  };
1592
- //# sourceMappingURL=chunk-HYW5ZAGY.js.map
1591
+ //# sourceMappingURL=chunk-AYN7K3DY.js.map
@@ -7850,7 +7850,7 @@ function requireHost() {
7850
7850
  }
7851
7851
 
7852
7852
  // src/lib/api-client.ts
7853
- var agtCliVersion = true ? "0.28.152" : "dev";
7853
+ var agtCliVersion = true ? "0.28.154" : "dev";
7854
7854
  var lastConfigHash = null;
7855
7855
  function setConfigHash(hash) {
7856
7856
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -9155,4 +9155,4 @@ export {
9155
9155
  managerInstallSystemUnitCommand,
9156
9156
  managerUninstallSystemUnitCommand
9157
9157
  };
9158
- //# sourceMappingURL=chunk-2K6DIZXU.js.map
9158
+ //# sourceMappingURL=chunk-Z3Y747JM.js.map
@@ -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-S2674LBO.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-42JGH4TP.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-ZSBUAMO3.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-YEJA2OWZ.js.map
@@ -28,7 +28,7 @@ import {
28
28
  requireHost,
29
29
  safeWriteJsonAtomic,
30
30
  setConfigHash
31
- } from "../chunk-2K6DIZXU.js";
31
+ } from "../chunk-Z3Y747JM.js";
32
32
  import {
33
33
  getProjectDir as getProjectDir2,
34
34
  getReadyTasks,
@@ -37,7 +37,6 @@ import {
37
37
  syncTasksToScheduler
38
38
  } from "../chunk-I3YS5WFV.js";
39
39
  import {
40
- buildAllowedTools,
41
40
  buildEgressAllowlist,
42
41
  checkChannelInputs,
43
42
  creditWatchdogGiveUpCount,
@@ -71,7 +70,7 @@ import {
71
70
  takeZombieDetection,
72
71
  transcriptActivityAgeSeconds,
73
72
  writeEgressAllowlist
74
- } from "../chunk-HYW5ZAGY.js";
73
+ } from "../chunk-AYN7K3DY.js";
75
74
  import {
76
75
  FLAGS_SCHEMA_VERSION,
77
76
  FLAG_REGISTRY,
@@ -88,7 +87,6 @@ import {
88
87
  describeOnboardingChannel,
89
88
  extractFrontmatter,
90
89
  formatActorId,
91
- formatMissingVar,
92
90
  formatRunMarker,
93
91
  getFramework,
94
92
  isEmptyTotals,
@@ -104,7 +102,6 @@ import {
104
102
  parseEnvIntegrations,
105
103
  parseTranscriptUsage,
106
104
  parseUsageBanner,
107
- probeMcpEnvSubstitution,
108
105
  resolveAgentTimezone,
109
106
  resolveAvatarEnvUrl,
110
107
  resolveChannels,
@@ -1785,15 +1782,9 @@ function formatReaperBootLine(opts) {
1785
1782
  return `[drain] step=boot-reaper total=${opts.totalRecorded} killed=${opts.killed} already_dead=${opts.alreadyDead} pid_reused_skipped=${opts.pidReusedSkipped} kanban_reset=${opts.kanbanReset}`;
1786
1783
  }
1787
1784
 
1788
- // src/lib/direct-chat-spawn-gate.ts
1785
+ // src/lib/direct-chat-delivery.ts
1789
1786
  import { join as join3 } from "path";
1790
- var DEFAULT_DIRECT_CHAT_HOST_CONCURRENCY = 2;
1791
- var DEFAULT_DIRECT_CHAT_PER_AGENT_CONCURRENCY = 1;
1792
1787
  var DEFAULT_DIRECT_CHAT_MAX_AGE_MS = 30 * 6e4;
1793
- function directChatHostConcurrency() {
1794
- const raw = parseInt(process.env["AGT_DIRECT_CHAT_MAX_CONCURRENCY"] ?? "", 10);
1795
- return Number.isFinite(raw) && raw > 0 ? raw : DEFAULT_DIRECT_CHAT_HOST_CONCURRENCY;
1796
- }
1797
1788
  function directChatMaxAgeMs() {
1798
1789
  const raw = parseInt(process.env["AGT_DIRECT_CHAT_MAX_AGE_MS"] ?? "", 10);
1799
1790
  return Number.isFinite(raw) && raw >= 0 ? raw : DEFAULT_DIRECT_CHAT_MAX_AGE_MS;
@@ -1808,72 +1799,6 @@ function isDirectChatMessageExpired(createdAt, nowMs, maxAgeMs) {
1808
1799
  if (!Number.isFinite(created)) return false;
1809
1800
  return nowMs - created > maxAgeMs;
1810
1801
  }
1811
- var DirectChatSpawnGate = class {
1812
- hostMax;
1813
- perAgentMax;
1814
- host = 0;
1815
- perAgent = /* @__PURE__ */ new Map();
1816
- queue = [];
1817
- constructor(config2) {
1818
- this.hostMax = Math.max(1, config2?.hostMaxConcurrency ?? DEFAULT_DIRECT_CHAT_HOST_CONCURRENCY);
1819
- this.perAgentMax = Math.max(
1820
- 1,
1821
- config2?.perAgentMaxConcurrency ?? DEFAULT_DIRECT_CHAT_PER_AGENT_CONCURRENCY
1822
- );
1823
- }
1824
- /** Live host-wide spawn count. */
1825
- get hostInFlight() {
1826
- return this.host;
1827
- }
1828
- /** Live spawn count for a single agent. */
1829
- agentInFlight(codeName) {
1830
- return this.perAgent.get(codeName) ?? 0;
1831
- }
1832
- /** Number of acquirers currently waiting for a slot. */
1833
- get queuedCount() {
1834
- return this.queue.length;
1835
- }
1836
- canGrant(codeName) {
1837
- return this.host < this.hostMax && this.agentInFlight(codeName) < this.perAgentMax;
1838
- }
1839
- grant(codeName) {
1840
- this.host += 1;
1841
- this.perAgent.set(codeName, this.agentInFlight(codeName) + 1);
1842
- let released = false;
1843
- return () => {
1844
- if (released) return;
1845
- released = true;
1846
- this.host -= 1;
1847
- const remaining = this.agentInFlight(codeName) - 1;
1848
- if (remaining <= 0) this.perAgent.delete(codeName);
1849
- else this.perAgent.set(codeName, remaining);
1850
- this.drain();
1851
- };
1852
- }
1853
- /** Acquire a spawn slot for `codeName`. Resolves with a single-use release. */
1854
- acquire(codeName) {
1855
- if (this.canGrant(codeName)) {
1856
- return Promise.resolve(this.grant(codeName));
1857
- }
1858
- return new Promise((resolve) => {
1859
- this.queue.push({ codeName, resolve });
1860
- });
1861
- }
1862
- /** Grant as many queued waiters as free slots allow, in FIFO order. */
1863
- drain() {
1864
- let i = 0;
1865
- while (i < this.queue.length && this.host < this.hostMax) {
1866
- const waiter = this.queue[i];
1867
- if (!waiter) break;
1868
- if (this.canGrant(waiter.codeName)) {
1869
- this.queue.splice(i, 1);
1870
- waiter.resolve(this.grant(waiter.codeName));
1871
- } else {
1872
- i += 1;
1873
- }
1874
- }
1875
- }
1876
- };
1877
1802
 
1878
1803
  // ../../packages/core/dist/host-config/capture.js
1879
1804
  import { createHash as createHash3 } from "crypto";
@@ -6949,7 +6874,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
6949
6874
  var lastVersionCheckAt = 0;
6950
6875
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
6951
6876
  var lastResponsivenessProbeAt = 0;
6952
- var agtCliVersion = true ? "0.28.152" : "dev";
6877
+ var agtCliVersion = true ? "0.28.154" : "dev";
6953
6878
  function resolveBrewPath(execFileSync4) {
6954
6879
  try {
6955
6880
  const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -8082,7 +8007,7 @@ async function pollCycle() {
8082
8007
  }
8083
8008
  try {
8084
8009
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
8085
- const { collectDiagnostics } = await import("../persistent-session-S2674LBO.js");
8010
+ const { collectDiagnostics } = await import("../persistent-session-42JGH4TP.js");
8086
8011
  const diagCodeNames = [...agentState.persistentSessionAgents];
8087
8012
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
8088
8013
  let tailscaleHostname;
@@ -8230,7 +8155,7 @@ async function pollCycle() {
8230
8155
  const {
8231
8156
  collectResponsivenessProbes,
8232
8157
  getResponsivenessIntervalMs
8233
- } = await import("../responsiveness-probe-NHQYDMHJ.js");
8158
+ } = await import("../responsiveness-probe-P3H7BWPZ.js");
8234
8159
  const probeIntervalMs = getResponsivenessIntervalMs();
8235
8160
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
8236
8161
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -8262,7 +8187,7 @@ async function pollCycle() {
8262
8187
  collectResponsivenessProbes,
8263
8188
  livePendingInboundOldestAgeSeconds,
8264
8189
  parkPendingInbound
8265
- } = await import("../responsiveness-probe-NHQYDMHJ.js");
8190
+ } = await import("../responsiveness-probe-P3H7BWPZ.js");
8266
8191
  const { getProjectDir: wedgeProjectDir } = await import("../claude-scheduler-FATCLHDM.js");
8267
8192
  const wedgeNow = /* @__PURE__ */ new Date();
8268
8193
  const liveAgents = agentState.persistentSessionAgents;
@@ -11331,9 +11256,6 @@ function triggerEarlyPoll(reason) {
11331
11256
  }, 0);
11332
11257
  }
11333
11258
  var directChatInFlight = /* @__PURE__ */ new Set();
11334
- var directChatSpawnGate = new DirectChatSpawnGate({
11335
- hostMaxConcurrency: directChatHostConcurrency()
11336
- });
11337
11259
  async function pollDirectChatMessages(agentStates) {
11338
11260
  for (const agent of agentStates) {
11339
11261
  if (agent.status !== "active") continue;
@@ -11401,110 +11323,33 @@ ${escapeXml(msg.content)}
11401
11323
  log(`[direct-chat] Injected into persistent session for '${agent.codeName}' (msg=${msg.id}); agent will reply via direct_chat.reply tool`);
11402
11324
  return;
11403
11325
  }
11404
- log(`[direct-chat] Inject reported unverified for '${agent.codeName}' (msg=${msg.id}) \u2014 falling back to one-shot direct-chat handling`);
11326
+ log(`[direct-chat] Inject reported unverified for '${agent.codeName}' (msg=${msg.id}) \u2014 leaving pending for durable replay`);
11327
+ }
11328
+ if (fw === "claude-code") {
11329
+ log(`[direct-chat] No in-session delivery for '${agent.codeName}' (msg=${msg.id}) \u2014 leaving pending for ENG-5927 durable replay`);
11330
+ return;
11405
11331
  }
11406
- let releaseSpawnSlot;
11407
11332
  try {
11333
+ const { stdout } = await execFilePromiseLong("openclaw", [
11334
+ "--profile",
11335
+ agent.codeName,
11336
+ "agent",
11337
+ "--local",
11338
+ "--agent",
11339
+ agent.codeName,
11340
+ "--message",
11341
+ msg.content,
11342
+ "--session-id",
11343
+ msg.session_id,
11344
+ "--json"
11345
+ ]);
11408
11346
  let reply;
11409
- if (fw === "claude-code") {
11410
- releaseSpawnSlot = await directChatSpawnGate.acquire(agent.codeName);
11411
- if (isDirectChatMessageExpired(msg.created_at, Date.now(), directChatMaxAgeMs())) {
11412
- log(`[direct-chat] Message for '${agent.codeName}' expired while queued behind the spawn gate (msg=${msg.id}) \u2014 draining without a spawn`);
11413
- try {
11414
- await api.post("/host/direct-chat/reply", {
11415
- agent_id: agent.agentId,
11416
- session_id: msg.session_id,
11417
- content: "[Expired] This message timed out before it could be processed. Please resend it."
11418
- });
11419
- } catch {
11420
- }
11421
- return;
11422
- }
11423
- log(`[direct-chat] One-shot spawn for '${agent.codeName}' (msg=${msg.id}; host in-flight=${directChatSpawnGate.hostInFlight}, queued=${directChatSpawnGate.queuedCount})`);
11424
- const { getProjectDir: ccProjectDir } = await import("../claude-scheduler-FATCLHDM.js");
11425
- const projDir = ccProjectDir(agent.codeName);
11426
- const mcpConfigPath = join16(projDir, ".mcp.json");
11427
- const serverNames = [];
11428
- if (existsSync8(mcpConfigPath)) {
11429
- try {
11430
- const d = JSON.parse(readFileSync14(mcpConfigPath, "utf-8"));
11431
- if (d.mcpServers) serverNames.push(...Object.keys(d.mcpServers));
11432
- } catch {
11433
- }
11434
- }
11435
- const allowedTools = buildAllowedTools(serverNames);
11436
- const chatArgs = [
11437
- "-p",
11438
- msg.content,
11439
- "--output-format",
11440
- "text",
11441
- "--mcp-config",
11442
- mcpConfigPath,
11443
- "--strict-mcp-config",
11444
- "--permission-mode",
11445
- "auto",
11446
- "--allowedTools",
11447
- allowedTools
11448
- ];
11449
- const chatClaudeMd = join16(projDir, "CLAUDE.md");
11450
- if (existsSync8(chatClaudeMd)) {
11451
- chatArgs.push("--system-prompt-file", chatClaudeMd);
11452
- }
11453
- const envIntPath = join16(projDir, ".env.integrations");
11454
- const childEnv = { ...process.env };
11455
- if (existsSync8(envIntPath)) {
11456
- try {
11457
- Object.assign(childEnv, parseEnvIntegrations(readFileSync14(envIntPath, "utf-8")));
11458
- } catch {
11459
- }
11460
- }
11461
- try {
11462
- await applyClaudeAuthToEnv(childEnv, "direct-chat");
11463
- } catch (err) {
11464
- throw new Error(`Auth resolve failed for '${agent.codeName}': ${err.message}`);
11465
- }
11466
- for (const f of probeMcpEnvSubstitution({
11467
- mcpConfigPath,
11468
- envIntegrationsPath: envIntPath,
11469
- baseEnv: childEnv
11470
- })) {
11471
- log(`[direct-chat] ${formatMissingVar(f)} agent=${agent.codeName}`);
11472
- }
11473
- const { stdout } = await execFilePromiseLong(resolveClaudeBinary(), chatArgs, {
11474
- cwd: projDir,
11475
- stdin: "ignore",
11476
- env: childEnv,
11477
- onSpawn: (pid) => registerClaudeSpawn({
11478
- pid,
11479
- started_at: Date.now(),
11480
- kind: "direct-chat",
11481
- agent_id: agent.agentId,
11482
- agent_code_name: agent.codeName
11483
- }),
11484
- onExit: (pid) => unregisterClaudeSpawn(pid)
11485
- });
11347
+ try {
11348
+ const parsed = JSON.parse(stdout);
11349
+ const payloads = parsed?.payloads ?? parsed?.result?.payloads;
11350
+ reply = payloads?.[0]?.text ?? parsed?.reply ?? parsed?.text ?? parsed?.message ?? stdout;
11351
+ } catch {
11486
11352
  reply = stdout.trim() || "[No response from agent]";
11487
- } else {
11488
- const { stdout } = await execFilePromiseLong("openclaw", [
11489
- "--profile",
11490
- agent.codeName,
11491
- "agent",
11492
- "--local",
11493
- "--agent",
11494
- agent.codeName,
11495
- "--message",
11496
- msg.content,
11497
- "--session-id",
11498
- msg.session_id,
11499
- "--json"
11500
- ]);
11501
- try {
11502
- const parsed = JSON.parse(stdout);
11503
- const payloads = parsed?.payloads ?? parsed?.result?.payloads;
11504
- reply = payloads?.[0]?.text ?? parsed?.reply ?? parsed?.text ?? parsed?.message ?? stdout;
11505
- } catch {
11506
- reply = stdout.trim() || "[No response from agent]";
11507
- }
11508
11353
  }
11509
11354
  await api.post("/host/direct-chat/reply", {
11510
11355
  agent_id: agent.agentId,
@@ -11524,8 +11369,6 @@ ${escapeXml(msg.content)}
11524
11369
  });
11525
11370
  } catch {
11526
11371
  }
11527
- } finally {
11528
- releaseSpawnSlot?.();
11529
11372
  }
11530
11373
  }
11531
11374
  var lastKanbanInjectAt = /* @__PURE__ */ new Map();
@@ -11845,7 +11688,7 @@ async function processClaudePairSessions(agents) {
11845
11688
  killPairSession,
11846
11689
  pairTmuxSession,
11847
11690
  finalizeClaudePairOnboarding
11848
- } = await import("../claude-pair-runtime-ZSBUAMO3.js");
11691
+ } = await import("../claude-pair-runtime-YEJA2OWZ.js");
11849
11692
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
11850
11693
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
11851
11694
  const killed = await killPairSession(pairTmuxSession(pairId));