@integrity-labs/agt-cli 0.28.1319 → 0.28.1321

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.
@@ -2,7 +2,7 @@ import {
2
2
  exchangeApiKey,
3
3
  getApiKey,
4
4
  getHost
5
- } from "./chunk-R7ZAJKMK.js";
5
+ } from "./chunk-XK3GPDIC.js";
6
6
  import {
7
7
  LATE_BOUND_VARS,
8
8
  PLATFORM_DENY_PERMISSIONS,
@@ -26,7 +26,7 @@ import {
26
26
  warnIgnoredIsolationAllowlist,
27
27
  withheldRemoteMcpMessage,
28
28
  withheldRemoteMcpReasonFor
29
- } from "./chunk-RR3LB5VH.js";
29
+ } from "./chunk-2F4EHNRQ.js";
30
30
  import {
31
31
  readDailySessionPin,
32
32
  sessionTranscriptDir
@@ -13882,4 +13882,4 @@ export {
13882
13882
  managerInstallSystemUnitCommand,
13883
13883
  managerUninstallSystemUnitCommand
13884
13884
  };
13885
- //# sourceMappingURL=chunk-4D2JQ2HP.js.map
13885
+ //# sourceMappingURL=chunk-7KHPD3XH.js.map
@@ -103,7 +103,7 @@ function exchangeFailureKind(err) {
103
103
  }
104
104
 
105
105
  // src/lib/api-client.ts
106
- var agtCliVersion = true ? "0.28.1319" : "dev";
106
+ var agtCliVersion = true ? "0.28.1321" : "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-R7ZAJKMK.js.map
471
+ //# sourceMappingURL=chunk-XK3GPDIC.js.map
@@ -323,7 +323,7 @@ async function spawnPairSession(session) {
323
323
  return { ok: true };
324
324
  } catch {
325
325
  }
326
- const { resolveClaudeBinary } = await import("./persistent-session-4AGRIK5W.js");
326
+ const { resolveClaudeBinary } = await import("./persistent-session-XFZ43IDB.js");
327
327
  const claudeBin = resolveClaudeBinary();
328
328
  const pairEnv = {
329
329
  ...process.env,
@@ -838,4 +838,4 @@ export {
838
838
  startClaudePair,
839
839
  submitClaudePairCode
840
840
  };
841
- //# sourceMappingURL=claude-pair-runtime-DGLYU2HX.js.map
841
+ //# sourceMappingURL=claude-pair-runtime-5EGI66ET.js.map
@@ -70,7 +70,7 @@ import {
70
70
  tripClass,
71
71
  writeEtcEnvironment,
72
72
  writeProfileDScript
73
- } from "../chunk-4D2JQ2HP.js";
73
+ } from "../chunk-7KHPD3XH.js";
74
74
  import {
75
75
  ApiError,
76
76
  adoptHostKeyInProcess,
@@ -88,7 +88,7 @@ import {
88
88
  probeHostKey,
89
89
  requireHost,
90
90
  setConfigHash
91
- } from "../chunk-R7ZAJKMK.js";
91
+ } from "../chunk-XK3GPDIC.js";
92
92
  import {
93
93
  BLOCKED_ON_PROMPT_DECISION,
94
94
  CHANNEL_SECRET_ENV_KEYS,
@@ -185,7 +185,7 @@ import {
185
185
  webFetchBaselineValue,
186
186
  webFetchRestartNeeded,
187
187
  writeEgressAllowlist
188
- } from "../chunk-RR3LB5VH.js";
188
+ } from "../chunk-2F4EHNRQ.js";
189
189
  import {
190
190
  isAgentIdle,
191
191
  isStaleForToday,
@@ -5829,6 +5829,23 @@ function staleGrantReason(currentGrantId) {
5829
5829
  function singleStartLaunchAllowed(hold, grantId) {
5830
5830
  return !(hold.wasHeld() && !hold.grantIsCurrent(grantId));
5831
5831
  }
5832
+ var WINDOW_OPENED_DURING_BOOTSTRAP_REASON = "held: the host Claude login refresh window opened during the bootstrap, before the launch (ENG-12379)";
5833
+ function deferredLaunchFence(opts) {
5834
+ const { hold, grantId } = opts;
5835
+ if (opts.grantedSingleStart) {
5836
+ return {
5837
+ launchStillAllowed: () => singleStartLaunchAllowed(hold, grantId),
5838
+ fencedReason: () => staleGrantReason(hold.currentGrantId())
5839
+ };
5840
+ }
5841
+ if (opts.subscriptionBacked === true) {
5842
+ return {
5843
+ launchStillAllowed: () => !hold.wasInWindow(),
5844
+ fencedReason: () => WINDOW_OPENED_DURING_BOOTSTRAP_REASON
5845
+ };
5846
+ }
5847
+ return {};
5848
+ }
5832
5849
 
5833
5850
  // src/lib/manager/host-auth-refresh-hold.ts
5834
5851
  async function readHostExpiresAtMs() {
@@ -10192,6 +10209,14 @@ function forceGates(gates, agentId) {
10192
10209
  }
10193
10210
  }
10194
10211
 
10212
+ // src/lib/default-schedules-refetch.ts
10213
+ function mustRefetchAfterEnsureDefaultSchedules(response) {
10214
+ if (typeof response !== "object" || response === null) return true;
10215
+ const { created, updated } = response;
10216
+ if (typeof created !== "number" || typeof updated !== "number") return true;
10217
+ return created !== 0 || updated !== 0;
10218
+ }
10219
+
10195
10220
  // src/lib/conditional-fetch.ts
10196
10221
  function stillHeld(quoted, live) {
10197
10222
  if (!quoted || !live) return void 0;
@@ -16297,7 +16322,7 @@ function createFileMigrationReportIO(codeName, log2) {
16297
16322
  };
16298
16323
  }
16299
16324
  var managerHostPost = async (path, body) => {
16300
- const { api: api2, ApiError: ApiError3 } = await import("../api-client-RRGOSC4A.js");
16325
+ const { api: api2, ApiError: ApiError3 } = await import("../api-client-ALOZB62N.js");
16301
16326
  try {
16302
16327
  const json = await api2.post(path, body);
16303
16328
  return { status: 200, json };
@@ -18467,7 +18492,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
18467
18492
  var dayRolloverInboundHold = /* @__PURE__ */ new Map();
18468
18493
  var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
18469
18494
  async function channelInboundActivityAgeSecondsFor(codeName) {
18470
- const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-SDVMWEM3.js");
18495
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-EJJNNPNB.js");
18471
18496
  const newest = newestPendingInboundActivityMtimeMs(dirname11(paneLogPath(codeName)));
18472
18497
  if (newest === null) return null;
18473
18498
  return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
@@ -19379,7 +19404,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
19379
19404
  var lastVersionCheckAt = 0;
19380
19405
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
19381
19406
  var lastResponsivenessProbeAt = 0;
19382
- var agtCliVersion = true ? "0.28.1319" : "dev";
19407
+ var agtCliVersion = true ? "0.28.1321" : "dev";
19383
19408
  function resolveBrewPath(execFileSync5) {
19384
19409
  try {
19385
19410
  const out = execFileSync5("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -21515,7 +21540,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
21515
21540
  if (codeNames.length === 0) return;
21516
21541
  void (async () => {
21517
21542
  try {
21518
- const { collectDiagnostics } = await import("../persistent-session-4AGRIK5W.js");
21543
+ const { collectDiagnostics } = await import("../persistent-session-XFZ43IDB.js");
21519
21544
  await api.post("/host/heartbeat", {
21520
21545
  host_id: hostId,
21521
21546
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor, agentDiskFor)
@@ -21662,7 +21687,7 @@ async function pollCycleInner() {
21662
21687
  }
21663
21688
  try {
21664
21689
  const { detectHostSecurity } = await import("../host-security-KQYYZZVW.js");
21665
- const { collectDiagnostics } = await import("../persistent-session-4AGRIK5W.js");
21690
+ const { collectDiagnostics } = await import("../persistent-session-XFZ43IDB.js");
21666
21691
  const recordedSinceHeartbeat = new Set(spawnOutcomesSinceHeartbeat.drain());
21667
21692
  const diagCodeNames = heartbeatDiagnosticsCodeNames(agentState.persistentSessionAgents, recordedSinceHeartbeat);
21668
21693
  const heartbeatSpawnOutcomeFor = spawnOutcomeIfRecorded(spawnOutcomeForDiagnostics, recordedSinceHeartbeat);
@@ -21998,7 +22023,7 @@ async function pollCycleInner() {
21998
22023
  collectPanelessActivityProbes,
21999
22024
  getResponsivenessIntervalMs,
22000
22025
  occupancyQualificationClassifications
22001
- } = await import("../responsiveness-probe-SDVMWEM3.js");
22026
+ } = await import("../responsiveness-probe-EJJNNPNB.js");
22002
22027
  const probeIntervalMs = getResponsivenessIntervalMs();
22003
22028
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
22004
22029
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -22115,7 +22140,7 @@ async function pollCycleInner() {
22115
22140
  collectResponsivenessProbes,
22116
22141
  livePendingInboundOldestAgeSeconds,
22117
22142
  parkPendingInbound
22118
- } = await import("../responsiveness-probe-SDVMWEM3.js");
22143
+ } = await import("../responsiveness-probe-EJJNNPNB.js");
22119
22144
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-5PCBGRNY.js");
22120
22145
  const wedgeNow = /* @__PURE__ */ new Date();
22121
22146
  const liveAgents = agentState.persistentSessionAgents;
@@ -22404,7 +22429,7 @@ async function pollCycleInner() {
22404
22429
  }
22405
22430
  );
22406
22431
  if (!paneFatalTornDown) continue;
22407
- const { parkPendingInbound } = await import("../responsiveness-probe-SDVMWEM3.js");
22432
+ const { parkPendingInbound } = await import("../responsiveness-probe-EJJNNPNB.js");
22408
22433
  const { parked, deadLettered } = parkPendingInbound(codeName, new Date(fatalNowMs));
22409
22434
  paneFatalStreak.delete(codeName);
22410
22435
  paneFatalRestarts.set(codeName, [...history, fatalNowMs]);
@@ -22435,7 +22460,7 @@ async function pollCycleInner() {
22435
22460
  TRANSCRIPT_MOUNT_ESCALATION_REFRESH_MS,
22436
22461
  bindSourceEscalations
22437
22462
  } = await import("../transcript-mount-health-OHE6IVJV.js");
22438
- const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-4AGRIK5W.js");
22463
+ const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-XFZ43IDB.js");
22439
22464
  const mountConfig = resolveTranscriptMountConfig();
22440
22465
  const liveAgents = agentState.persistentSessionAgents;
22441
22466
  for (const tracked of [
@@ -25411,7 +25436,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
25411
25436
  (s) => !existingTemplateIds.has(s.template_id)
25412
25437
  );
25413
25438
  if (allSchedules.length > 0) {
25414
- await api.post("/host/ensure-default-schedules", {
25439
+ const ensured = await api.post("/host/ensure-default-schedules", {
25415
25440
  agent_id: agent.agent_id,
25416
25441
  team_id: defaultsData.team_id,
25417
25442
  timezone: defaultsData.timezone,
@@ -25420,14 +25445,16 @@ async function processAgent(agent, agentStates, managedToolkits) {
25420
25445
  if (missing.length > 0) {
25421
25446
  log(`Auto-provisioned ${missing.length} default schedule(s) for '${agent.code_name}': ${missing.map((s) => s.template_id).join(", ")}`);
25422
25447
  }
25423
- const freshData = await api.post("/host/refresh", {
25424
- agent_id: agent.agent_id,
25425
- // Only `scheduled_tasks` is read here, so ask for the manifest shape on
25426
- // every lane — nothing in this branch consumes a skill body, and the
25427
- // skill lanes are the largest part of the payload being discarded.
25428
- ...REFRESH_MANIFEST_FLAGS
25429
- });
25430
- tasks = freshData.scheduled_tasks ?? tasks;
25448
+ if (mustRefetchAfterEnsureDefaultSchedules(ensured)) {
25449
+ const freshData = await api.post("/host/refresh", {
25450
+ agent_id: agent.agent_id,
25451
+ // Only `scheduled_tasks` is read here, so ask for the manifest shape on
25452
+ // every lane — nothing in this branch consumes a skill body, and the
25453
+ // skill lanes are the largest part of the payload being discarded.
25454
+ ...REFRESH_MANIFEST_FLAGS
25455
+ });
25456
+ tasks = freshData.scheduled_tasks ?? tasks;
25457
+ }
25431
25458
  }
25432
25459
  defaultSchedulesFetchGate.markFetched(agent.agent_id, defaultSchedulesToken);
25433
25460
  } catch (err) {
@@ -27317,13 +27344,18 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash21("sha256")
27317
27344
  });
27318
27345
  if (!spawnCopyFailedNow) spawnCopyFailures.noteSuccess(codeName);
27319
27346
  const grantForLaunch = singleStartGrantId;
27320
- const launchStillAllowed = grantedSingleStart ? () => singleStartLaunchAllowed(hostAuthRefreshHold, grantForLaunch) : void 0;
27347
+ const launchFence = deferredLaunchFence({
27348
+ grantedSingleStart,
27349
+ subscriptionBacked,
27350
+ grantId: grantForLaunch,
27351
+ hold: hostAuthRefreshHold
27352
+ });
27321
27353
  const lateRefusal = startWithIsolationBackstop(() => startPersistentSession({
27322
27354
  codeName,
27323
27355
  agentId: agent.agent_id,
27324
27356
  isolationReadiness: startReadiness,
27325
- launchStillAllowed,
27326
- onLaunchFenced: grantedSingleStart ? () => closeSessionRunForCode(codeName, "cancelled", staleGrantReason(hostAuthRefreshHold.currentGrantId())) : void 0,
27357
+ launchStillAllowed: launchFence.launchStillAllowed,
27358
+ onLaunchFenced: launchFence.fencedReason ? () => closeSessionRunForCode(codeName, "cancelled", launchFence.fencedReason()) : void 0,
27327
27359
  projectDir,
27328
27360
  mcpConfigPath: spawnMcpConfigPath,
27329
27361
  claudeMdPath,
@@ -27835,7 +27867,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
27835
27867
  if (!refreshData) return;
27836
27868
  const framework = refreshData.agent?.framework ?? agentFrameworkCache.get(codeName) ?? DEFAULT_FRAMEWORK;
27837
27869
  const hostId = await getHostId();
27838
- const parkForRestart = await import("../responsiveness-probe-SDVMWEM3.js").then(
27870
+ const parkForRestart = await import("../responsiveness-probe-EJJNNPNB.js").then(
27839
27871
  (m) => m.parkPendingInbound,
27840
27872
  (err) => err
27841
27873
  );
@@ -27916,7 +27948,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
27916
27948
  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}`));
27917
27949
  void (async () => {
27918
27950
  try {
27919
- const { collectDiagnostics } = await import("../persistent-session-4AGRIK5W.js");
27951
+ const { collectDiagnostics } = await import("../persistent-session-XFZ43IDB.js");
27920
27952
  await api.post("/host/heartbeat", {
27921
27953
  host_id: hostId,
27922
27954
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor, agentDiskFor)
@@ -27969,7 +28001,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
27969
28001
  }
27970
28002
  try {
27971
28003
  const hostId = await getHostId();
27972
- const { collectDiagnostics } = await import("../persistent-session-4AGRIK5W.js");
28004
+ const { collectDiagnostics } = await import("../persistent-session-XFZ43IDB.js");
27973
28005
  await api.post("/host/heartbeat", {
27974
28006
  host_id: hostId,
27975
28007
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor, agentDiskFor)
@@ -28845,7 +28877,7 @@ async function processClaudePairSessions(agents) {
28845
28877
  snapshotPairConfig,
28846
28878
  // ENG-11659: result -> report body + the manager.log line that records it.
28847
28879
  planPairStartReport
28848
- } = await import("../claude-pair-runtime-DGLYU2HX.js");
28880
+ } = await import("../claude-pair-runtime-5EGI66ET.js");
28849
28881
  const { resetClaudeSignin, describeSigninResetForLog, describeSigninResetFailure } = await import("../claude-signin-reset-6IJMMVYG.js");
28850
28882
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
28851
28883
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);