@integrity-labs/agt-cli 0.28.1162 → 0.28.1163

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-JMA2UNUS.js";
43
+ } from "../chunk-DPMVTSFO.js";
44
44
  import {
45
45
  getProjectDir,
46
46
  isSessionResumeDisabled,
@@ -5513,7 +5513,7 @@ import { execFileSync, execSync } from "child_process";
5513
5513
  import { existsSync as existsSync11, realpathSync as realpathSync2 } from "fs";
5514
5514
  import chalk18 from "chalk";
5515
5515
  import ora16 from "ora";
5516
- var cliVersion = true ? "0.28.1162" : "dev";
5516
+ var cliVersion = true ? "0.28.1163" : "dev";
5517
5517
  async function fetchLatestVersion() {
5518
5518
  const host2 = getHost();
5519
5519
  if (!host2) return null;
@@ -6773,7 +6773,7 @@ function handleError(err) {
6773
6773
  }
6774
6774
 
6775
6775
  // src/bin/agt.ts
6776
- var cliVersion2 = true ? "0.28.1162" : "dev";
6776
+ var cliVersion2 = true ? "0.28.1163" : "dev";
6777
6777
  var program = new Command();
6778
6778
  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");
6779
6779
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -8078,7 +8078,7 @@ function exchangeFailureKind(err) {
8078
8078
  }
8079
8079
 
8080
8080
  // src/lib/api-client.ts
8081
- var agtCliVersion = true ? "0.28.1162" : "dev";
8081
+ var agtCliVersion = true ? "0.28.1163" : "dev";
8082
8082
  var lastConfigHash = null;
8083
8083
  function setConfigHash(hash) {
8084
8084
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -13235,4 +13235,4 @@ export {
13235
13235
  managerInstallSystemUnitCommand,
13236
13236
  managerUninstallSystemUnitCommand
13237
13237
  };
13238
- //# sourceMappingURL=chunk-JMA2UNUS.js.map
13238
+ //# sourceMappingURL=chunk-DPMVTSFO.js.map
@@ -77,7 +77,7 @@ import {
77
77
  setConfigHash,
78
78
  shellGuard,
79
79
  tripClass
80
- } from "../chunk-JMA2UNUS.js";
80
+ } from "../chunk-DPMVTSFO.js";
81
81
  import {
82
82
  CLAUDE_CODE_SECURITY_FLOOR,
83
83
  SELF_UPDATE_TIMEOUTS,
@@ -15874,7 +15874,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
15874
15874
  var lastVersionCheckAt = 0;
15875
15875
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
15876
15876
  var lastResponsivenessProbeAt = 0;
15877
- var agtCliVersion = true ? "0.28.1162" : "dev";
15877
+ var agtCliVersion = true ? "0.28.1163" : "dev";
15878
15878
  function resolveBrewPath(execFileSync3) {
15879
15879
  try {
15880
15880
  const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -19448,10 +19448,10 @@ var require_readdirp = __commonJS({
19448
19448
  }
19449
19449
  async _formatEntry(dirent, path) {
19450
19450
  let entry;
19451
- const basename2 = this._isDirent ? dirent.name : dirent;
19451
+ const basename3 = this._isDirent ? dirent.name : dirent;
19452
19452
  try {
19453
- const fullPath = (0, node_path_1.resolve)((0, node_path_1.join)(path, basename2));
19454
- entry = { path: (0, node_path_1.relative)(this._root, fullPath), fullPath, basename: basename2 };
19453
+ const fullPath = (0, node_path_1.resolve)((0, node_path_1.join)(path, basename3));
19454
+ entry = { path: (0, node_path_1.relative)(this._root, fullPath), fullPath, basename: basename3 };
19455
19455
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
19456
19456
  } catch (err) {
19457
19457
  this._onError(err);
@@ -20008,9 +20008,9 @@ var require_handler = __commonJS({
20008
20008
  _watchWithNodeFs(path, listener) {
20009
20009
  const opts = this.fsw.options;
20010
20010
  const directory = sysPath.dirname(path);
20011
- const basename2 = sysPath.basename(path);
20011
+ const basename3 = sysPath.basename(path);
20012
20012
  const parent = this.fsw._getWatchedDir(directory);
20013
- parent.add(basename2);
20013
+ parent.add(basename3);
20014
20014
  const absolutePath = sysPath.resolve(path);
20015
20015
  const options = {
20016
20016
  persistent: opts.persistent
@@ -20020,7 +20020,7 @@ var require_handler = __commonJS({
20020
20020
  let closer;
20021
20021
  if (opts.usePolling) {
20022
20022
  const enableBin = opts.interval !== opts.binaryInterval;
20023
- options.interval = enableBin && isBinaryPath(basename2) ? opts.binaryInterval : opts.interval;
20023
+ options.interval = enableBin && isBinaryPath(basename3) ? opts.binaryInterval : opts.interval;
20024
20024
  closer = setFsWatchFileListener(path, absolutePath, options, {
20025
20025
  listener,
20026
20026
  rawEmitter: this.fsw._emitRaw
@@ -20043,10 +20043,10 @@ var require_handler = __commonJS({
20043
20043
  return;
20044
20044
  }
20045
20045
  const dirname4 = sysPath.dirname(file);
20046
- const basename2 = sysPath.basename(file);
20046
+ const basename3 = sysPath.basename(file);
20047
20047
  const parent = this.fsw._getWatchedDir(dirname4);
20048
20048
  let prevStats = stats;
20049
- if (parent.has(basename2))
20049
+ if (parent.has(basename3))
20050
20050
  return;
20051
20051
  const listener = async (path, newStats) => {
20052
20052
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
@@ -20071,9 +20071,9 @@ var require_handler = __commonJS({
20071
20071
  prevStats = newStats2;
20072
20072
  }
20073
20073
  } catch (error2) {
20074
- this.fsw._remove(dirname4, basename2);
20074
+ this.fsw._remove(dirname4, basename3);
20075
20075
  }
20076
- } else if (parent.has(basename2)) {
20076
+ } else if (parent.has(basename3)) {
20077
20077
  const at = newStats.atimeMs;
20078
20078
  const mt = newStats.mtimeMs;
20079
20079
  if (!at || at <= mt || mt !== prevStats.mtimeMs) {
@@ -47584,6 +47584,16 @@ function probeAgentSessionCached(codeName, ttlMs = SESSION_PROBE_TTL_MS, now = D
47584
47584
  }
47585
47585
 
47586
47586
  // src/direct-chat-poll-guard.ts
47587
+ var SAFETY_NET_POLL_MS = 12e4;
47588
+ var DOORBELL_UNWATCHED_POLL_MS = 3e4;
47589
+ function safetyNetIntervalMs(doorbellWatchAttached) {
47590
+ return doorbellWatchAttached ? SAFETY_NET_POLL_MS : DOORBELL_UNWATCHED_POLL_MS;
47591
+ }
47592
+ function doorbellWatchLost(attachedId, currentId) {
47593
+ if (attachedId === null) return false;
47594
+ return currentId !== attachedId;
47595
+ }
47596
+ var POLL_STUCK_MS = 9e4;
47587
47597
  function evaluatePollGuard(state, nowMs, stuckMs) {
47588
47598
  if (!state.inFlight) return { run: true, stuck: false };
47589
47599
  if (state.leaseUntilMs != null && nowMs < state.leaseUntilMs) return { run: false, stuck: false };
@@ -47640,7 +47650,7 @@ function defaultIsPidAlive(pid) {
47640
47650
  }
47641
47651
  }
47642
47652
  function acquireMcpSpawnLock(args) {
47643
- const { agentDir, basename: basename2, options = {} } = args;
47653
+ const { agentDir, basename: basename3, options = {} } = args;
47644
47654
  if (!agentDir) return { kind: "no-agent-dir" };
47645
47655
  const isPidAlive = options.isPidAlive ?? defaultIsPidAlive;
47646
47656
  const selfPid = options.selfPid ?? process.pid;
@@ -47648,7 +47658,7 @@ function acquireMcpSpawnLock(args) {
47648
47658
  const nowMs = options.nowMs ?? (() => Date.now());
47649
47659
  const lockMtimeMs = options.lockMtimeMs ?? defaultLockMtimeMs;
47650
47660
  const staleMs = options.staleMs ?? STALE_LOCK_MS;
47651
- const path = join13(agentDir, basename2);
47661
+ const path = join13(agentDir, basename3);
47652
47662
  const existing = readLockHolder(path);
47653
47663
  if (existing) {
47654
47664
  if (existing.pid === selfPid) {
@@ -47728,7 +47738,7 @@ function readLockHolder(path) {
47728
47738
 
47729
47739
  // src/direct-chat-channel.ts
47730
47740
  import { homedir as homedir5 } from "os";
47731
- import { join as join17 } from "path";
47741
+ import { basename as basename2, join as join17 } from "path";
47732
47742
  import { randomUUID } from "crypto";
47733
47743
  import {
47734
47744
  watch,
@@ -55169,8 +55179,6 @@ var DOORBELL_ENABLED = resolveHostBooleanFlag({
55169
55179
  defaultValue: false
55170
55180
  });
55171
55181
  var DOORBELL_FILE = "direct-chat-doorbell";
55172
- var SAFETY_NET_POLL_MS = 3e4;
55173
- var POLL_STUCK_MS = 9e4;
55174
55182
  var pollGuard = { inFlight: false, inFlightSinceMs: null, leaseUntilMs: null };
55175
55183
  async function pollOnce(sinceMs) {
55176
55184
  const decision = evaluatePollGuard(pollGuard, Date.now(), POLL_STUCK_MS);
@@ -55193,8 +55201,40 @@ async function pollOnce(sinceMs) {
55193
55201
  }
55194
55202
  }
55195
55203
  var doorbellWatcher = null;
55204
+ function dirInode(path) {
55205
+ if (!path) return null;
55206
+ try {
55207
+ const st = statSync4(path);
55208
+ return `${st.dev}:${st.ino}`;
55209
+ } catch {
55210
+ return null;
55211
+ }
55212
+ }
55196
55213
  var safetyNetTimer = null;
55197
55214
  if (DOORBELL_ENABLED && DIRECT_CHAT_AGENT_DIR) {
55215
+ let safetyNetTick = function() {
55216
+ if (doorbellWatchAttached && doorbellWatchLost(watchedDirIno, dirInode(DIRECT_CHAT_AGENT_DIR))) {
55217
+ degradeDoorbell("the watched directory was removed or replaced");
55218
+ }
55219
+ void pollOnce(sinceMs);
55220
+ }, degradeDoorbell = function(reason) {
55221
+ if (!doorbellWatchAttached) return;
55222
+ doorbellWatchAttached = false;
55223
+ try {
55224
+ doorbellWatcher?.close();
55225
+ } catch {
55226
+ }
55227
+ doorbellWatcher = null;
55228
+ const fallbackMs = safetyNetIntervalMs(false);
55229
+ process.stderr.write(
55230
+ `direct-chat-channel: doorbell watch lost (${reason}) \u2014 falling back to safety-net poll every ${fallbackMs}ms
55231
+ `
55232
+ );
55233
+ if (safetyNetTimer) clearInterval(safetyNetTimer);
55234
+ safetyNetTimer = setInterval(safetyNetTick, fallbackMs);
55235
+ safetyNetTimer.unref?.();
55236
+ };
55237
+ safetyNetTick2 = safetyNetTick, degradeDoorbell2 = degradeDoorbell;
55198
55238
  try {
55199
55239
  mkdirSync7(DIRECT_CHAT_AGENT_DIR, { recursive: true });
55200
55240
  } catch {
@@ -55216,23 +55256,35 @@ if (DOORBELL_ENABLED && DIRECT_CHAT_AGENT_DIR) {
55216
55256
  resetDirectChatClaims(DIRECT_CHAT_CLAIMS_PATH);
55217
55257
  }
55218
55258
  let debounce = null;
55259
+ let doorbellWatchAttached = false;
55219
55260
  try {
55220
- doorbellWatcher = watch(DIRECT_CHAT_AGENT_DIR, (_event, filename) => {
55261
+ const watchedDirName = basename2(DIRECT_CHAT_AGENT_DIR);
55262
+ doorbellWatcher = watch(DIRECT_CHAT_AGENT_DIR, (event, filename) => {
55263
+ if (event === "rename" && filename === watchedDirName) {
55264
+ degradeDoorbell("the watched directory was removed");
55265
+ return;
55266
+ }
55221
55267
  if (filename !== DOORBELL_FILE) return;
55222
55268
  if (debounce) clearTimeout(debounce);
55223
55269
  debounce = setTimeout(() => {
55224
55270
  void pollOnce(sinceMs);
55225
55271
  }, 50);
55226
55272
  });
55273
+ doorbellWatchAttached = true;
55274
+ doorbellWatcher.on("error", (err) => {
55275
+ degradeDoorbell(`watcher error: ${err.message}`);
55276
+ });
55227
55277
  } catch (err) {
55228
55278
  process.stderr.write(
55229
- `direct-chat-channel: doorbell watch failed (${err.message}) \u2014 relying on safety-net poll
55279
+ `direct-chat-channel: doorbell watch failed (${err.message}) \u2014 relying on safety-net poll every ${safetyNetIntervalMs(false)}ms
55230
55280
  `
55231
55281
  );
55232
55282
  }
55283
+ const safetyNetMs = safetyNetIntervalMs(doorbellWatchAttached);
55284
+ const watchedDirIno = doorbellWatchAttached ? dirInode(DIRECT_CHAT_AGENT_DIR) : null;
55233
55285
  safetyNetTimer = setInterval(() => {
55234
- void pollOnce(sinceMs);
55235
- }, SAFETY_NET_POLL_MS);
55286
+ safetyNetTick();
55287
+ }, safetyNetMs);
55236
55288
  safetyNetTimer.unref?.();
55237
55289
  if (sessionState.fresh) {
55238
55290
  void runBacklogDrain({
@@ -55246,7 +55298,7 @@ if (DOORBELL_ENABLED && DIRECT_CHAT_AGENT_DIR) {
55246
55298
  });
55247
55299
  }
55248
55300
  process.stderr.write(
55249
- `direct-chat-channel: Started (agent=${AGT_AGENT_ID}, delivery=doorbell+pull, session=${sessionState.fresh ? "fresh\u2192backlog-drain (unscoped, retried)" : "resumed\u2192new-only"}, new_message_watermark_since=${sinceMs} \u2014 watching ${DOORBELL_FILE}, safety-net ${SAFETY_NET_POLL_MS}ms)
55301
+ `direct-chat-channel: Started (agent=${AGT_AGENT_ID}, delivery=doorbell+pull, session=${sessionState.fresh ? "fresh\u2192backlog-drain (unscoped, retried)" : "resumed\u2192new-only"}, new_message_watermark_since=${sinceMs} \u2014 watching ${DOORBELL_FILE}, safety-net ${safetyNetMs}ms)
55250
55302
  `
55251
55303
  );
55252
55304
  } else {
@@ -55255,6 +55307,8 @@ if (DOORBELL_ENABLED && DIRECT_CHAT_AGENT_DIR) {
55255
55307
  `
55256
55308
  );
55257
55309
  }
55310
+ var safetyNetTick2;
55311
+ var degradeDoorbell2;
55258
55312
  var progressTickTimer = null;
55259
55313
  if (PROGRESS_HEARTBEAT_PATH) {
55260
55314
  progressTickTimer = setInterval(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.1162",
3
+ "version": "0.28.1163",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {