@integrity-labs/agt-cli 0.28.577 → 0.28.579

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-FOMHYTFV.js";
43
+ } from "../chunk-Y3ILQRLM.js";
44
44
  import {
45
45
  AnchorSessionClient,
46
46
  CHANNEL_REGISTRY,
@@ -71,7 +71,7 @@ import {
71
71
  requiredMcpWildcard,
72
72
  resolveChannels,
73
73
  serializeManifestForSlackCli
74
- } from "../chunk-E3KBX3UW.js";
74
+ } from "../chunk-RC5YRTZU.js";
75
75
  import "../chunk-XWVM4KPK.js";
76
76
 
77
77
  // src/bin/agt.ts
@@ -4853,7 +4853,7 @@ import { execFileSync, execSync } from "child_process";
4853
4853
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4854
4854
  import chalk18 from "chalk";
4855
4855
  import ora16 from "ora";
4856
- var cliVersion = true ? "0.28.577" : "dev";
4856
+ var cliVersion = true ? "0.28.579" : "dev";
4857
4857
  async function fetchLatestVersion() {
4858
4858
  const host2 = getHost();
4859
4859
  if (!host2) return null;
@@ -6031,7 +6031,7 @@ function handleError(err) {
6031
6031
  }
6032
6032
 
6033
6033
  // src/bin/agt.ts
6034
- var cliVersion2 = true ? "0.28.577" : "dev";
6034
+ var cliVersion2 = true ? "0.28.579" : "dev";
6035
6035
  var program = new Command();
6036
6036
  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");
6037
6037
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -5687,12 +5687,14 @@ function resolveConnectivityProbe(input) {
5687
5687
  const remoteMcpUrl = getOAuthProvider(definitionId)?.mcpUrl ?? input.remoteMcpUrl ?? null;
5688
5688
  if (remoteMcpUrl) {
5689
5689
  const fromRegistry = Boolean(getOAuthProvider(definitionId)?.mcpUrl);
5690
+ const override = mcpOverrideFrom(input.connectivityTest);
5690
5691
  return {
5691
5692
  kind: "mcp_tools_list",
5692
5693
  sourceType: sourceType ?? "mcp_server",
5693
5694
  readOnly: true,
5694
- label: `${definitionId}: MCP tools/list`,
5695
- centralReachable: fromRegistry
5695
+ label: `${definitionId}: MCP tools/list${override.probeTool ? ` + ${override.probeTool}` : ""}`,
5696
+ centralReachable: fromRegistry,
5697
+ ...override
5696
5698
  };
5697
5699
  }
5698
5700
  switch (sourceType) {
@@ -14736,6 +14738,7 @@ function collectMcpServerNames(mcpConfigPath) {
14736
14738
  return [];
14737
14739
  }
14738
14740
  }
14741
+ var PANE_AGENT_ID_PROBE_TIMEOUT_MS = 2e3;
14739
14742
  var REQUIRED_SPAWN_ENV = ["AGT_AGENT_ID", "AGT_HOST", "AGT_API_KEY"];
14740
14743
  function buildSpawnEnv(args) {
14741
14744
  const { base, agentId, runId } = args;
@@ -14751,6 +14754,22 @@ function buildSpawnEnv(args) {
14751
14754
  function findMissingSpawnEnv(env2) {
14752
14755
  return REQUIRED_SPAWN_ENV.filter((k) => !env2[k]?.trim());
14753
14756
  }
14757
+ function describePaneAgentIdMismatch(args) {
14758
+ const out = args.showEnvOutput.trim();
14759
+ if (!out) return null;
14760
+ if (/unknown variable/i.test(out)) {
14761
+ return `no session-scoped AGT_AGENT_ID \u2014 the pane will inherit the tmux SERVER's global value, which on a shared host belongs to whichever agent started the server (ENG-8800)`;
14762
+ }
14763
+ if (/^-AGT_AGENT_ID$/m.test(out)) {
14764
+ return "AGT_AGENT_ID is explicitly unset at session scope (ENG-8800)";
14765
+ }
14766
+ const match = /^AGT_AGENT_ID=(.*)$/m.exec(out);
14767
+ if (!match) return null;
14768
+ const actual = (match[1] ?? "").trim();
14769
+ if (!actual) return "AGT_AGENT_ID is empty at session scope (ENG-8800)";
14770
+ if (actual === args.expectedAgentId) return null;
14771
+ return `pane has AGT_AGENT_ID=${actual} but this session is agent ${args.expectedAgentId} \u2014 broker lookups keyed on the agent id will resolve to the WRONG agent (ENG-8800)`;
14772
+ }
14754
14773
  function findForeignAgentIdsInMcpConfig(args) {
14755
14774
  const { mcpConfigText, agentId } = args;
14756
14775
  const expected = agentId.trim();
@@ -15031,6 +15050,7 @@ function spawnSession(config, session) {
15031
15050
  claudeArgsJoined
15032
15051
  });
15033
15052
  const tmuxSessionEnvArgs = [];
15053
+ tmuxSessionEnvArgs.push("-e", `AGT_AGENT_ID=${config.agentId}`);
15034
15054
  if (openRouterMode) {
15035
15055
  const or = config.openRouter;
15036
15056
  tmuxSessionEnvArgs.push("-e", `ANTHROPIC_BASE_URL=${OPENROUTER_ANTHROPIC_BASE_URL}`);
@@ -15167,6 +15187,65 @@ function spawnSession(config, session) {
15167
15187
  return;
15168
15188
  }
15169
15189
  log2(`[persistent-session] tmux session '${tmuxSession}' created for '${codeName}'`);
15190
+ try {
15191
+ const probe = spawn2("tmux", ["show-environment", "-t", tmuxSession, "AGT_AGENT_ID"], {
15192
+ stdio: ["ignore", "pipe", "pipe"]
15193
+ });
15194
+ let out = "";
15195
+ let done = false;
15196
+ const settle = (output) => {
15197
+ if (done) return;
15198
+ done = true;
15199
+ clearTimeout(deadline);
15200
+ if (output === null) return;
15201
+ const mismatch = describePaneAgentIdMismatch({
15202
+ showEnvOutput: output,
15203
+ expectedAgentId: config.agentId
15204
+ });
15205
+ if (mismatch) {
15206
+ log2(
15207
+ `[persistent-session] PANE AGENT ID MISMATCH agent=${codeName} isolation=${isolationMode(codeName)} \u2014 ${mismatch}`
15208
+ );
15209
+ session.status = "crashed";
15210
+ session.startedAt = Date.now();
15211
+ try {
15212
+ const killer = spawn2("tmux", ["kill-session", "-t", tmuxSession], {
15213
+ stdio: "ignore"
15214
+ });
15215
+ const killDeadline = setTimeout(() => {
15216
+ try {
15217
+ killer.kill("SIGKILL");
15218
+ } catch {
15219
+ }
15220
+ }, PANE_AGENT_ID_PROBE_TIMEOUT_MS);
15221
+ killDeadline.unref?.();
15222
+ killer.on("error", () => clearTimeout(killDeadline));
15223
+ killer.on("close", () => clearTimeout(killDeadline));
15224
+ } catch {
15225
+ }
15226
+ log2(
15227
+ `[persistent-session] killed session '${tmuxSession}' for '${codeName}' \u2014 refusing to run an agent under another agent's identity (ENG-8800)`
15228
+ );
15229
+ }
15230
+ };
15231
+ const deadline = setTimeout(() => {
15232
+ settle(null);
15233
+ try {
15234
+ probe.kill("SIGKILL");
15235
+ } catch {
15236
+ }
15237
+ }, PANE_AGENT_ID_PROBE_TIMEOUT_MS);
15238
+ deadline.unref?.();
15239
+ probe.stdout?.on("data", (d) => {
15240
+ out += d.toString();
15241
+ });
15242
+ probe.stderr?.on("data", (d) => {
15243
+ out += d.toString();
15244
+ });
15245
+ probe.on("error", () => settle(null));
15246
+ probe.on("close", () => settle(out));
15247
+ } catch {
15248
+ }
15170
15249
  setupPaneLog2(tmuxSession, codeName, log2);
15171
15250
  session.currentSessionId = sessionId;
15172
15251
  acceptDialogs(tmuxSession, codeName, log2, config.primaryModel ?? null, sessionId).catch(() => {
@@ -15901,9 +15980,11 @@ export {
15901
15980
  restartEgressSidecar,
15902
15981
  buildDockerRunCommand,
15903
15982
  writePersistentClaudeWrapper,
15983
+ PANE_AGENT_ID_PROBE_TIMEOUT_MS,
15904
15984
  REQUIRED_SPAWN_ENV,
15905
15985
  buildSpawnEnv,
15906
15986
  findMissingSpawnEnv,
15987
+ describePaneAgentIdMismatch,
15907
15988
  findForeignAgentIdsInMcpConfig,
15908
15989
  paneLogPath,
15909
15990
  rotatePaneLogForDayRollover,
@@ -15932,4 +16013,4 @@ export {
15932
16013
  stopAllSessionsAndWait,
15933
16014
  getProjectDir
15934
16015
  };
15935
- //# sourceMappingURL=chunk-E3KBX3UW.js.map
16016
+ //# sourceMappingURL=chunk-RC5YRTZU.js.map