@integrity-labs/agt-cli 0.28.596 → 0.28.598

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.
Files changed (27) hide show
  1. package/dist/bin/agt.js +5 -5
  2. package/dist/{chunk-6NVRWZ5W.js → chunk-4E3L4U34.js} +2 -2
  3. package/dist/{chunk-3PNRUCHD.js → chunk-6EBAJFLZ.js} +7 -1
  4. package/dist/chunk-6EBAJFLZ.js.map +1 -0
  5. package/dist/{chunk-EAZQXZ4Q.js → chunk-TJUR7PJ5.js} +51 -8
  6. package/dist/chunk-TJUR7PJ5.js.map +1 -0
  7. package/dist/{claude-pair-runtime-5WB2FMIX.js → claude-pair-runtime-7CNOVI5H.js} +2 -2
  8. package/dist/lib/manager-worker.js +85 -14
  9. package/dist/lib/manager-worker.js.map +1 -1
  10. package/dist/mcp/augmented-admin.js +1 -1
  11. package/dist/mcp/augmented-help-kb.js +1 -1
  12. package/dist/mcp/augmented-support.js +1 -1
  13. package/dist/mcp/direct-chat-channel.js +6 -0
  14. package/dist/mcp/origami.js +6 -0
  15. package/dist/mcp/slack-channel.js +6 -0
  16. package/dist/mcp/telegram-channel.js +6 -0
  17. package/dist/{persistent-session-BGMQQYW2.js → persistent-session-5VAAQJQA.js} +3 -3
  18. package/dist/{responsiveness-probe-VAGPO5FZ.js → responsiveness-probe-AZKD6KEV.js} +3 -3
  19. package/dist/{session-auth-dead-CWFGB472.js → session-auth-dead-5VN6KL6H.js} +2 -2
  20. package/package.json +2 -2
  21. package/dist/chunk-3PNRUCHD.js.map +0 -1
  22. package/dist/chunk-EAZQXZ4Q.js.map +0 -1
  23. /package/dist/{chunk-6NVRWZ5W.js.map → chunk-4E3L4U34.js.map} +0 -0
  24. /package/dist/{claude-pair-runtime-5WB2FMIX.js.map → claude-pair-runtime-7CNOVI5H.js.map} +0 -0
  25. /package/dist/{persistent-session-BGMQQYW2.js.map → persistent-session-5VAAQJQA.js.map} +0 -0
  26. /package/dist/{responsiveness-probe-VAGPO5FZ.js.map → responsiveness-probe-AZKD6KEV.js.map} +0 -0
  27. /package/dist/{session-auth-dead-CWFGB472.js.map → session-auth-dead-5VN6KL6H.js.map} +0 -0
@@ -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-BGMQQYW2.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-5VAAQJQA.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-5WB2FMIX.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-7CNOVI5H.js.map
@@ -53,7 +53,7 @@ import {
53
53
  safeWriteJsonAtomic,
54
54
  setConfigHash,
55
55
  tripClass
56
- } from "../chunk-EAZQXZ4Q.js";
56
+ } from "../chunk-TJUR7PJ5.js";
57
57
  import {
58
58
  getProjectDir as getProjectDir2,
59
59
  getReadyTasks,
@@ -109,7 +109,7 @@ import {
109
109
  takeZombieDetection,
110
110
  toOpencodeModel,
111
111
  writeEgressAllowlist
112
- } from "../chunk-6NVRWZ5W.js";
112
+ } from "../chunk-4E3L4U34.js";
113
113
  import {
114
114
  ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
115
115
  AnchorSessionClient,
@@ -186,7 +186,7 @@ import {
186
186
  subagentActivityAgeSeconds,
187
187
  sumTranscriptUsageInWindow,
188
188
  transcriptActivityAgeSeconds
189
- } from "../chunk-3PNRUCHD.js";
189
+ } from "../chunk-6EBAJFLZ.js";
190
190
  import {
191
191
  reapOrphanChannelMcps
192
192
  } from "../chunk-XWVM4KPK.js";
@@ -10041,6 +10041,8 @@ var assignChannel = null;
10041
10041
  var configChannel = null;
10042
10042
  var kanbanChannel = null;
10043
10043
  var integrationContextChannel = null;
10044
+ var tokenRotationChannels = [];
10045
+ var tokenRotationEpoch = 0;
10044
10046
  var connected = false;
10045
10047
  var tearingDown = false;
10046
10048
  function ensureClient(config2) {
@@ -10086,6 +10088,7 @@ function startRealtimeChat(config2) {
10086
10088
  configChannel = null;
10087
10089
  kanbanChannel = null;
10088
10090
  integrationContextChannel = null;
10091
+ tokenRotationChannels = [];
10089
10092
  if (client) {
10090
10093
  try {
10091
10094
  client.removeAllChannels();
@@ -10334,6 +10337,49 @@ function stopRealtimeIntegrationContext() {
10334
10337
  }
10335
10338
  integrationContextChannel = null;
10336
10339
  }
10340
+ function startRealtimeTokenRotation(config2) {
10341
+ const { agentIds, onTokenRotated, onSubscriptionLost, log: log2 } = config2;
10342
+ if (agentIds.length === 0) return;
10343
+ stopRealtimeTokenRotation();
10344
+ const epoch = ++tokenRotationEpoch;
10345
+ const sb = ensureClient(config2);
10346
+ for (const agentId of agentIds) {
10347
+ const topic = `token-rotated-agent:${agentId}`;
10348
+ const channel = sb.channel(topic, { config: { private: true } }).on("broadcast", { event: "token.rotated" }, (message) => {
10349
+ const payload = message.payload;
10350
+ if (!payload || typeof payload.integration_id !== "string" || payload.integration_id.length === 0) {
10351
+ log2(`[realtime] token.rotated for agent ${agentId} ignored \u2014 no integration_id in payload`);
10352
+ return;
10353
+ }
10354
+ log2(
10355
+ `[realtime] token.rotated for agent ${agentId} (integration ${payload.integration_id}, ${payload.definition_id ?? "unknown provider"})`
10356
+ );
10357
+ onTokenRotated(agentId, {
10358
+ integration_id: payload.integration_id,
10359
+ definition_id: typeof payload.definition_id === "string" ? payload.definition_id : "unknown",
10360
+ rotated_at: typeof payload.rotated_at === "string" ? payload.rotated_at : (/* @__PURE__ */ new Date()).toISOString()
10361
+ });
10362
+ }).subscribe((status) => {
10363
+ if (epoch !== tokenRotationEpoch) return;
10364
+ if (status === "CLOSED" || status === "CHANNEL_ERROR" || status === "TIMED_OUT") {
10365
+ log2(`[realtime] Token rotation channel for agent ${agentId}: ${status}`);
10366
+ onSubscriptionLost?.(agentId, status);
10367
+ }
10368
+ });
10369
+ tokenRotationChannels.push(channel);
10370
+ }
10371
+ log2(`[realtime] Subscribing to token.rotated for ${agentIds.length} agent(s)`);
10372
+ }
10373
+ function stopRealtimeTokenRotation() {
10374
+ tokenRotationEpoch += 1;
10375
+ for (const channel of tokenRotationChannels) {
10376
+ try {
10377
+ channel.unsubscribe();
10378
+ } catch {
10379
+ }
10380
+ }
10381
+ tokenRotationChannels = [];
10382
+ }
10337
10383
  function isRealtimeConnected() {
10338
10384
  return connected;
10339
10385
  }
@@ -10393,6 +10439,13 @@ function stopRealtimeChat() {
10393
10439
  }
10394
10440
  integrationContextChannel = null;
10395
10441
  }
10442
+ for (const ch of tokenRotationChannels) {
10443
+ try {
10444
+ ch.unsubscribe();
10445
+ } catch {
10446
+ }
10447
+ }
10448
+ tokenRotationChannels = [];
10396
10449
  if (client) {
10397
10450
  try {
10398
10451
  client.removeAllChannels();
@@ -11827,7 +11880,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
11827
11880
  var lastVersionCheckAt = 0;
11828
11881
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
11829
11882
  var lastResponsivenessProbeAt = 0;
11830
- var agtCliVersion = true ? "0.28.596" : "dev";
11883
+ var agtCliVersion = true ? "0.28.598" : "dev";
11831
11884
  function resolveBrewPath(execFileSync3) {
11832
11885
  try {
11833
11886
  const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -13134,7 +13187,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
13134
13187
  if (codeNames.length === 0) return;
13135
13188
  void (async () => {
13136
13189
  try {
13137
- const { collectDiagnostics } = await import("../persistent-session-BGMQQYW2.js");
13190
+ const { collectDiagnostics } = await import("../persistent-session-5VAAQJQA.js");
13138
13191
  await api.post("/host/heartbeat", {
13139
13192
  host_id: hostId,
13140
13193
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor)
@@ -13242,7 +13295,7 @@ async function pollCycle() {
13242
13295
  }
13243
13296
  try {
13244
13297
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
13245
- const { collectDiagnostics } = await import("../persistent-session-BGMQQYW2.js");
13298
+ const { collectDiagnostics } = await import("../persistent-session-5VAAQJQA.js");
13246
13299
  const diagCodeNames = [...agentState.persistentSessionAgents];
13247
13300
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor) : void 0;
13248
13301
  let tailscaleHostname;
@@ -13365,7 +13418,7 @@ async function pollCycle() {
13365
13418
  collectPanelessActivityProbes,
13366
13419
  getResponsivenessIntervalMs,
13367
13420
  occupancyQualificationClassifications
13368
- } = await import("../responsiveness-probe-VAGPO5FZ.js");
13421
+ } = await import("../responsiveness-probe-AZKD6KEV.js");
13369
13422
  const probeIntervalMs = getResponsivenessIntervalMs();
13370
13423
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
13371
13424
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -13456,7 +13509,7 @@ async function pollCycle() {
13456
13509
  collectResponsivenessProbes,
13457
13510
  livePendingInboundOldestAgeSeconds,
13458
13511
  parkPendingInbound
13459
- } = await import("../responsiveness-probe-VAGPO5FZ.js");
13512
+ } = await import("../responsiveness-probe-AZKD6KEV.js");
13460
13513
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-NDP36U7O.js");
13461
13514
  const wedgeNow = /* @__PURE__ */ new Date();
13462
13515
  const liveAgents = agentState.persistentSessionAgents;
@@ -13612,7 +13665,7 @@ async function pollCycle() {
13612
13665
  }
13613
13666
  try {
13614
13667
  const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-JA437JIB.js");
13615
- const { probeSessionAuth } = await import("../session-auth-dead-CWFGB472.js");
13668
+ const { probeSessionAuth } = await import("../session-auth-dead-5VN6KL6H.js");
13616
13669
  const observations = [];
13617
13670
  const pendingCacheCommits = [];
13618
13671
  const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
@@ -17040,7 +17093,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
17040
17093
  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}`));
17041
17094
  void (async () => {
17042
17095
  try {
17043
- const { collectDiagnostics } = await import("../persistent-session-BGMQQYW2.js");
17096
+ const { collectDiagnostics } = await import("../persistent-session-5VAAQJQA.js");
17044
17097
  await api.post("/host/heartbeat", {
17045
17098
  host_id: hostId,
17046
17099
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor)
@@ -17091,7 +17144,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
17091
17144
  }
17092
17145
  try {
17093
17146
  const hostId = await getHostId();
17094
- const { collectDiagnostics } = await import("../persistent-session-BGMQQYW2.js");
17147
+ const { collectDiagnostics } = await import("../persistent-session-5VAAQJQA.js");
17095
17148
  await api.post("/host/heartbeat", {
17096
17149
  host_id: hostId,
17097
17150
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor)
@@ -17239,8 +17292,9 @@ function ensureRealtimeIntegrationContextStarted(agentStates) {
17239
17292
  if (activeAgentIds.length === 0) {
17240
17293
  if (subscribedIntegrationContextAgentIds.size > 0) {
17241
17294
  stopRealtimeIntegrationContext();
17295
+ stopRealtimeTokenRotation();
17242
17296
  subscribedIntegrationContextAgentIds = /* @__PURE__ */ new Set();
17243
- log("[realtime] Integration context subscription torn down (no active agents)");
17297
+ log("[realtime] Integration context + token rotation subscriptions torn down (no active agents)");
17244
17298
  }
17245
17299
  return;
17246
17300
  }
@@ -17250,6 +17304,7 @@ function ensureRealtimeIntegrationContextStarted(agentStates) {
17250
17304
  const isResubscribe = subscribedIntegrationContextAgentIds.size > 0;
17251
17305
  if (isResubscribe) {
17252
17306
  stopRealtimeIntegrationContext();
17307
+ stopRealtimeTokenRotation();
17253
17308
  }
17254
17309
  const targetSet = new Set(activeAgentIds);
17255
17310
  subscribedIntegrationContextAgentIds = targetSet;
@@ -17277,8 +17332,24 @@ function ensureRealtimeIntegrationContextStarted(agentStates) {
17277
17332
  },
17278
17333
  log
17279
17334
  });
17335
+ startRealtimeTokenRotation({
17336
+ supabaseUrl: exchange.supabaseUrl,
17337
+ supabaseAnonKey: exchange.supabaseAnonKey,
17338
+ token: exchange.token,
17339
+ agentIds: [...targetSet],
17340
+ onTokenRotated: (agentId, event) => {
17341
+ triggerEarlyPoll(
17342
+ `integration token rotated for agent ${agentId} (integration ${event.integration_id}, ${event.definition_id})`
17343
+ );
17344
+ },
17345
+ onSubscriptionLost: (agentId, status) => {
17346
+ log(`[realtime] Token rotation subscription lost for agent ${agentId} (${status}) \u2014 will rebind next tick`);
17347
+ subscribedIntegrationContextAgentIds = /* @__PURE__ */ new Set();
17348
+ },
17349
+ log
17350
+ });
17280
17351
  log(
17281
- `[realtime] Integration context subscription ${isResubscribe ? "re-bound" : "started"} for ${targetSet.size} agent(s)`
17352
+ `[realtime] Integration context + token rotation subscriptions ${isResubscribe ? "re-bound" : "started"} for ${targetSet.size} agent(s)`
17282
17353
  );
17283
17354
  }).catch((err) => {
17284
17355
  if (subscribedIntegrationContextAgentIds === targetSet) {
@@ -17669,7 +17740,7 @@ async function processClaudePairSessions(agents) {
17669
17740
  killPairSession,
17670
17741
  pairTmuxSession,
17671
17742
  finalizeClaudePairOnboarding
17672
- } = await import("../claude-pair-runtime-5WB2FMIX.js");
17743
+ } = await import("../claude-pair-runtime-7CNOVI5H.js");
17673
17744
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
17674
17745
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
17675
17746
  const killed = await killPairSession(pairTmuxSession(pairId));