@integrity-labs/agt-cli 0.28.1263 → 0.28.1264

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.
@@ -15,7 +15,7 @@ import {
15
15
  mintRotatedHostKey,
16
16
  probeHostKey,
17
17
  setConfigHash
18
- } from "./chunk-I4ZCWVZZ.js";
18
+ } from "./chunk-C3PSUSJ2.js";
19
19
  import "./chunk-KJ5OCCSJ.js";
20
20
  import "./chunk-DGUM43GV.js";
21
21
  export {
@@ -36,4 +36,4 @@ export {
36
36
  probeHostKey,
37
37
  setConfigHash
38
38
  };
39
- //# sourceMappingURL=api-client-SJR7V5JU.js.map
39
+ //# sourceMappingURL=api-client-Q2FXLBH5.js.map
package/dist/bin/agt.js CHANGED
@@ -31,7 +31,7 @@ import {
31
31
  success,
32
32
  table,
33
33
  warn
34
- } from "../chunk-M6EWNC4M.js";
34
+ } from "../chunk-GSMGU2QA.js";
35
35
  import {
36
36
  ApiError,
37
37
  PROD_AGT_HOST,
@@ -42,12 +42,12 @@ import {
42
42
  getHost,
43
43
  getHostId,
44
44
  setActiveTeam
45
- } from "../chunk-I4ZCWVZZ.js";
45
+ } from "../chunk-C3PSUSJ2.js";
46
46
  import {
47
47
  getProjectDir,
48
48
  isSessionResumeDisabled,
49
49
  readDirectChatSessionState
50
- } from "../chunk-CEJNJ6NF.js";
50
+ } from "../chunk-GZMUGH6X.js";
51
51
  import {
52
52
  markDailySessionSpawn,
53
53
  sessionFileExists,
@@ -5207,7 +5207,7 @@ import { execFileSync, execSync } from "child_process";
5207
5207
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
5208
5208
  import chalk17 from "chalk";
5209
5209
  import ora15 from "ora";
5210
- var cliVersion = true ? "0.28.1263" : "dev";
5210
+ var cliVersion = true ? "0.28.1264" : "dev";
5211
5211
  async function fetchLatestVersion() {
5212
5212
  const host2 = getHost();
5213
5213
  if (!host2) return null;
@@ -6467,7 +6467,7 @@ function handleError(err) {
6467
6467
  }
6468
6468
 
6469
6469
  // src/bin/agt.ts
6470
- var cliVersion2 = true ? "0.28.1263" : "dev";
6470
+ var cliVersion2 = true ? "0.28.1264" : "dev";
6471
6471
  var program = new Command();
6472
6472
  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");
6473
6473
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -103,7 +103,7 @@ function exchangeFailureKind(err) {
103
103
  }
104
104
 
105
105
  // src/lib/api-client.ts
106
- var agtCliVersion = true ? "0.28.1263" : "dev";
106
+ var agtCliVersion = true ? "0.28.1264" : "dev";
107
107
  var lastConfigHash = null;
108
108
  function setConfigHash(hash) {
109
109
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -468,4 +468,4 @@ export {
468
468
  api,
469
469
  getHostId
470
470
  };
471
- //# sourceMappingURL=chunk-I4ZCWVZZ.js.map
471
+ //# sourceMappingURL=chunk-C3PSUSJ2.js.map
@@ -2,7 +2,7 @@ import {
2
2
  exchangeApiKey,
3
3
  getApiKey,
4
4
  getHost
5
- } from "./chunk-I4ZCWVZZ.js";
5
+ } from "./chunk-C3PSUSJ2.js";
6
6
  import {
7
7
  LATE_BOUND_VARS,
8
8
  PLATFORM_DENY_PERMISSIONS,
@@ -25,7 +25,7 @@ import {
25
25
  shellQuote,
26
26
  withheldRemoteMcpMessage,
27
27
  withheldRemoteMcpReasonFor
28
- } from "./chunk-CEJNJ6NF.js";
28
+ } from "./chunk-GZMUGH6X.js";
29
29
  import {
30
30
  readDailySessionPin,
31
31
  sessionTranscriptDir
@@ -13808,4 +13808,4 @@ export {
13808
13808
  managerInstallSystemUnitCommand,
13809
13809
  managerUninstallSystemUnitCommand
13810
13810
  };
13811
- //# sourceMappingURL=chunk-M6EWNC4M.js.map
13811
+ //# sourceMappingURL=chunk-GSMGU2QA.js.map
@@ -4784,6 +4784,33 @@ function findForeignAgentIdsInMcpConfig(args) {
4784
4784
  return out;
4785
4785
  }
4786
4786
  var sessions2 = /* @__PURE__ */ new Map();
4787
+ var SPAWN_SUPERSEDED = "superseded";
4788
+ var spawnGenerationCounter = 0;
4789
+ function beginSpawnPending(record) {
4790
+ record.spawnPending = true;
4791
+ return () => {
4792
+ record.spawnPending = false;
4793
+ };
4794
+ }
4795
+ function nextSpawnGeneration(record) {
4796
+ const generation = ++spawnGenerationCounter;
4797
+ record.spawnGeneration = generation;
4798
+ return generation;
4799
+ }
4800
+ function spawnStillCurrent(current, record, generation) {
4801
+ return current === record && record.spawnGeneration === generation;
4802
+ }
4803
+ function supersedePendingSpawn(codeName, log2) {
4804
+ const record = sessions2.get(codeName);
4805
+ if (!record || record.spawnPending !== true) return false;
4806
+ const was = record.spawnGeneration;
4807
+ const now = nextSpawnGeneration(record);
4808
+ record.spawnPending = false;
4809
+ log2(
4810
+ `[persistent-session] spawn for '${codeName}' superseded at the landing cap (generation ${was ?? "none"} -> ${now}): if it settles late it will not start [ENG-12126]`
4811
+ );
4812
+ return true;
4813
+ }
4787
4814
  var PANE_LOG_DIR = join7(homedir5(), ".augmented");
4788
4815
  var PANE_TAIL_LINES = 20;
4789
4816
  function paneLogPath(codeName) {
@@ -5058,6 +5085,11 @@ function runTmuxSpawnPlan(opts) {
5058
5085
  if (settled) return;
5059
5086
  settled = true;
5060
5087
  if (deadline) clearTimeout(deadline);
5088
+ if (failure === null && opts.stillCurrent && !opts.stillCurrent()) {
5089
+ runCleanup();
5090
+ opts.onSpawnFailed(SPAWN_SUPERSEDED);
5091
+ return;
5092
+ }
5061
5093
  if (failure === null) spawnRealSession();
5062
5094
  else opts.onSpawnFailed(failure);
5063
5095
  };
@@ -5550,27 +5582,44 @@ function spawnSession(config, session) {
5550
5582
  session.restartCount++;
5551
5583
  };
5552
5584
  let spawnFailed = false;
5553
- runTmuxSpawnPlan({
5554
- plan: spawnPlan,
5555
- spawnOptions: {
5556
- cwd: projectDir,
5557
- stdio: ["ignore", "pipe", "pipe"],
5558
- env: tmuxEnv
5559
- },
5560
- onSessionSpawned: (child) => {
5561
- child.on("close", onTmuxSessionClose);
5562
- child.on("error", onTmuxSessionError);
5563
- },
5564
- onSpawnFailed: (reason) => {
5565
- spawnFailed = true;
5566
- log2(
5567
- `[persistent-session] tmux bootstrap failed for '${codeName}': ${reason} \u2014 refusing to spawn rather than put this session's -e secrets on the tmux server argv for its lifetime (ENG-10092)`
5568
- );
5569
- session.status = "crashed";
5570
- session.startedAt = Date.now();
5571
- session.restartCount++;
5572
- }
5573
- });
5585
+ const spawnSettledNow = beginSpawnPending(session);
5586
+ const generation = nextSpawnGeneration(session);
5587
+ try {
5588
+ runTmuxSpawnPlan({
5589
+ plan: spawnPlan,
5590
+ spawnOptions: {
5591
+ cwd: projectDir,
5592
+ stdio: ["ignore", "pipe", "pipe"],
5593
+ env: tmuxEnv
5594
+ },
5595
+ stillCurrent: () => spawnStillCurrent(sessions2.get(codeName), session, generation),
5596
+ onSessionSpawned: (child) => {
5597
+ child.on("close", onTmuxSessionClose);
5598
+ child.on("error", onTmuxSessionError);
5599
+ child.on("close", spawnSettledNow);
5600
+ child.on("error", spawnSettledNow);
5601
+ },
5602
+ onSpawnFailed: (reason) => {
5603
+ spawnFailed = true;
5604
+ spawnSettledNow();
5605
+ if (reason === SPAWN_SUPERSEDED) {
5606
+ log2(
5607
+ `[persistent-session] spawn for '${codeName}' superseded (generation ${generation}, current ${sessions2.get(codeName)?.spawnGeneration ?? "none"}): not starting it; its key was never handed to a process [ENG-12126]`
5608
+ );
5609
+ return;
5610
+ }
5611
+ log2(
5612
+ `[persistent-session] tmux bootstrap failed for '${codeName}': ${reason} \u2014 refusing to spawn rather than put this session's -e secrets on the tmux server argv for its lifetime (ENG-10092)`
5613
+ );
5614
+ session.status = "crashed";
5615
+ session.startedAt = Date.now();
5616
+ session.restartCount++;
5617
+ }
5618
+ });
5619
+ } catch (err) {
5620
+ spawnSettledNow();
5621
+ throw err;
5622
+ }
5574
5623
  if (!spawnFailed) {
5575
5624
  session.startedAt = Date.now();
5576
5625
  session.status = "running";
@@ -6308,6 +6357,11 @@ export {
6308
6357
  findMissingSpawnEnv,
6309
6358
  describePaneAgentIdMismatch,
6310
6359
  findForeignAgentIdsInMcpConfig,
6360
+ SPAWN_SUPERSEDED,
6361
+ beginSpawnPending,
6362
+ nextSpawnGeneration,
6363
+ spawnStillCurrent,
6364
+ supersedePendingSpawn,
6311
6365
  paneLogPath,
6312
6366
  rotatePaneLogForDayRollover,
6313
6367
  readPaneLogTail,
@@ -6343,4 +6397,4 @@ export {
6343
6397
  stopAllSessionsAndWait,
6344
6398
  getProjectDir
6345
6399
  };
6346
- //# sourceMappingURL=chunk-CEJNJ6NF.js.map
6400
+ //# sourceMappingURL=chunk-GZMUGH6X.js.map