@integrity-labs/agt-cli 0.28.1052 → 0.28.1054

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 (23) hide show
  1. package/dist/bin/agt.js +5 -5
  2. package/dist/{chunk-MQ4COFCI.js → chunk-2SGXGNDW.js} +11 -1
  3. package/dist/{chunk-MQ4COFCI.js.map → chunk-2SGXGNDW.js.map} +1 -1
  4. package/dist/{chunk-4ZH75WMF.js → chunk-AT7E625H.js} +2 -2
  5. package/dist/{chunk-3E63PEXT.js → chunk-M4ADTK6F.js} +8 -4
  6. package/dist/{chunk-3E63PEXT.js.map → chunk-M4ADTK6F.js.map} +1 -1
  7. package/dist/{claude-pair-runtime-KMPRE2ZJ.js → claude-pair-runtime-GO3C7KT6.js} +2 -2
  8. package/dist/lib/manager-worker.js +78 -14
  9. package/dist/lib/manager-worker.js.map +1 -1
  10. package/dist/mcp/direct-chat-channel.js +10 -0
  11. package/dist/mcp/index.js +39 -0
  12. package/dist/mcp/origami.js +10 -0
  13. package/dist/mcp/slack-channel.js +159 -22
  14. package/dist/mcp/telegram-channel.js +10 -0
  15. package/dist/{persistent-session-5RX4P7GP.js → persistent-session-3WRSJIDM.js} +3 -3
  16. package/dist/{responsiveness-probe-C75AUK6I.js → responsiveness-probe-2DF6VH7Q.js} +3 -3
  17. package/dist/{session-auth-dead-VFRUHVTF.js → session-auth-dead-GRTHA2Z5.js} +2 -2
  18. package/package.json +1 -1
  19. /package/dist/{chunk-4ZH75WMF.js.map → chunk-AT7E625H.js.map} +0 -0
  20. /package/dist/{claude-pair-runtime-KMPRE2ZJ.js.map → claude-pair-runtime-GO3C7KT6.js.map} +0 -0
  21. /package/dist/{persistent-session-5RX4P7GP.js.map → persistent-session-3WRSJIDM.js.map} +0 -0
  22. /package/dist/{responsiveness-probe-C75AUK6I.js.map → responsiveness-probe-2DF6VH7Q.js.map} +0 -0
  23. /package/dist/{session-auth-dead-VFRUHVTF.js.map → session-auth-dead-GRTHA2Z5.js.map} +0 -0
@@ -266,7 +266,7 @@ async function spawnPairSession(session) {
266
266
  return { ok: true };
267
267
  } catch {
268
268
  }
269
- const { resolveClaudeBinary } = await import("./persistent-session-5RX4P7GP.js");
269
+ const { resolveClaudeBinary } = await import("./persistent-session-3WRSJIDM.js");
270
270
  const claudeBin = resolveClaudeBinary();
271
271
  const pairEnv = {
272
272
  ...process.env,
@@ -734,4 +734,4 @@ export {
734
734
  startClaudePair,
735
735
  submitClaudePairCode
736
736
  };
737
- //# sourceMappingURL=claude-pair-runtime-KMPRE2ZJ.js.map
737
+ //# sourceMappingURL=claude-pair-runtime-GO3C7KT6.js.map
@@ -34,6 +34,7 @@ import {
34
34
  gatherSessionToolBindProbe,
35
35
  getApiKey,
36
36
  getCachedClaudeAuthMode,
37
+ getCachedClaudeAuthModeRaw,
37
38
  getHostId,
38
39
  givenUpMcpServerKeys,
39
40
  isIntegrationBucketedReason,
@@ -66,7 +67,7 @@ import {
66
67
  safeWriteJsonAtomic,
67
68
  setConfigHash,
68
69
  tripClass
69
- } from "../chunk-3E63PEXT.js";
70
+ } from "../chunk-M4ADTK6F.js";
70
71
  import {
71
72
  getProjectDir as getProjectDir2,
72
73
  getReadyTasks,
@@ -153,7 +154,7 @@ import {
153
154
  webFetchBaselineValue,
154
155
  webFetchRestartNeeded,
155
156
  writeEgressAllowlist
156
- } from "../chunk-4ZH75WMF.js";
157
+ } from "../chunk-AT7E625H.js";
157
158
  import {
158
159
  ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
159
160
  AnchorSessionClient,
@@ -262,7 +263,7 @@ import {
262
263
  subagentActivityAgeSeconds,
263
264
  sumTranscriptUsageInWindow,
264
265
  transcriptActivityAgeSeconds
265
- } from "../chunk-MQ4COFCI.js";
266
+ } from "../chunk-2SGXGNDW.js";
266
267
  import {
267
268
  classifyUnanswerablePane,
268
269
  paneRemedy
@@ -2789,6 +2790,15 @@ function maybeMigrateAgentToIdKeyedLayout(agent, deps) {
2789
2790
  }
2790
2791
  }
2791
2792
 
2793
+ // src/lib/heartbeat-account-email.ts
2794
+ function mayReportAccountEmail(rawMode) {
2795
+ return rawMode === "subscription";
2796
+ }
2797
+ function heartbeatAccountEmailField(rawMode, detected) {
2798
+ if (!mayReportAccountEmail(rawMode)) return void 0;
2799
+ return detected ?? void 0;
2800
+ }
2801
+
2792
2802
  // src/lib/manager/auth-resolve-decision.ts
2793
2803
  function decideAuthResolveFailureAction(args) {
2794
2804
  const transient = isTransientAuthFailure(args.error);
@@ -3443,7 +3453,42 @@ async function detectClaudeAccountFingerprint(paths) {
3443
3453
  }
3444
3454
  var lastKnownFingerprint = null;
3445
3455
  var lastDetectAtMs = 0;
3456
+ var lastEmailResult = null;
3457
+ var lastEmailDetectAtMs = 0;
3446
3458
  var DETECT_TTL_MS = 6e4;
3459
+ async function detectClaudeAccountEmail(paths) {
3460
+ const candidates = paths ?? await claudeConfigCandidatePaths();
3461
+ for (const path of candidates) {
3462
+ let parsed;
3463
+ try {
3464
+ parsed = JSON.parse(await readFile3(path, "utf-8"));
3465
+ } catch {
3466
+ continue;
3467
+ }
3468
+ if (typeof parsed !== "object" || parsed === null) continue;
3469
+ const account = parsed.oauthAccount;
3470
+ if (typeof account !== "object" || account === null) continue;
3471
+ const accountUuid = account.accountUuid;
3472
+ if (typeof accountUuid !== "string" || accountUuid.trim().length === 0) continue;
3473
+ const email = account.emailAddress;
3474
+ if (typeof email !== "string") return null;
3475
+ const trimmed = email.trim().toLowerCase();
3476
+ if (trimmed.length === 0) return null;
3477
+ return trimmed;
3478
+ }
3479
+ return null;
3480
+ }
3481
+ async function getClaudeAccountEmail(paths, nowMs = Date.now()) {
3482
+ if (!paths && nowMs - lastEmailDetectAtMs < DETECT_TTL_MS) {
3483
+ return lastEmailResult;
3484
+ }
3485
+ const detected = await detectClaudeAccountEmail(paths);
3486
+ if (!paths) {
3487
+ lastEmailDetectAtMs = nowMs;
3488
+ lastEmailResult = detected;
3489
+ }
3490
+ return detected;
3491
+ }
3447
3492
  async function getClaudeAccountFingerprint(paths, nowMs = Date.now()) {
3448
3493
  if (!paths && lastKnownFingerprint !== null && nowMs - lastDetectAtMs < DETECT_TTL_MS) {
3449
3494
  return lastKnownFingerprint;
@@ -14053,7 +14098,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
14053
14098
  var dayRolloverInboundHold = /* @__PURE__ */ new Map();
14054
14099
  var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
14055
14100
  async function channelInboundActivityAgeSecondsFor(codeName) {
14056
- const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-C75AUK6I.js");
14101
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-2DF6VH7Q.js");
14057
14102
  const newest = newestPendingInboundActivityMtimeMs(dirname11(paneLogPath(codeName)));
14058
14103
  if (newest === null) return null;
14059
14104
  return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
@@ -14799,7 +14844,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
14799
14844
  var lastVersionCheckAt = 0;
14800
14845
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
14801
14846
  var lastResponsivenessProbeAt = 0;
14802
- var agtCliVersion = true ? "0.28.1052" : "dev";
14847
+ var agtCliVersion = true ? "0.28.1054" : "dev";
14803
14848
  function resolveBrewPath(execFileSync3) {
14804
14849
  try {
14805
14850
  const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -16434,7 +16479,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
16434
16479
  if (codeNames.length === 0) return;
16435
16480
  void (async () => {
16436
16481
  try {
16437
- const { collectDiagnostics } = await import("../persistent-session-5RX4P7GP.js");
16482
+ const { collectDiagnostics } = await import("../persistent-session-3WRSJIDM.js");
16438
16483
  await api.post("/host/heartbeat", {
16439
16484
  host_id: hostId,
16440
16485
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor)
@@ -16576,7 +16621,7 @@ async function pollCycleInner() {
16576
16621
  }
16577
16622
  try {
16578
16623
  const { detectHostSecurity } = await import("../host-security-KQYYZZVW.js");
16579
- const { collectDiagnostics } = await import("../persistent-session-5RX4P7GP.js");
16624
+ const { collectDiagnostics } = await import("../persistent-session-3WRSJIDM.js");
16580
16625
  const diagCodeNames = [...agentState.persistentSessionAgents];
16581
16626
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor) : void 0;
16582
16627
  let tailscaleHostname;
@@ -16609,6 +16654,15 @@ async function pollCycleInner() {
16609
16654
  const errId = createHash20("sha256").update(errText).digest("hex").slice(0, 12);
16610
16655
  log(`Claude auth detection failed (error_id=${errId})`);
16611
16656
  }
16657
+ let claudeAccountEmail = null;
16658
+ const claudeAuthModeRaw = getCachedClaudeAuthModeRaw();
16659
+ if (mayReportAccountEmail(claudeAuthModeRaw)) {
16660
+ try {
16661
+ claudeAccountEmail = await getClaudeAccountEmail();
16662
+ } catch {
16663
+ claudeAccountEmail = null;
16664
+ }
16665
+ }
16612
16666
  const hostHasClaudeCode = state9.agents.some(
16613
16667
  (a) => agentFrameworkCache.get(a.codeName) === "claude-code"
16614
16668
  );
@@ -16634,6 +16688,16 @@ async function pollCycleInner() {
16634
16688
  hostname: tailscaleHostname,
16635
16689
  os_username: osUsername,
16636
16690
  claude_auth: claudeAuth ?? void 0,
16691
+ // OMITTED rather than sent as null when it cannot be read. The API
16692
+ // treats absence as "no observation" and leaves the stored label
16693
+ // alone; sending null would let a transient unreadable config WIPE a
16694
+ // good address, which is worse than the staleness this fixes. Same
16695
+ // sticky reasoning as the account fingerprint.
16696
+ // Built by the pure helper so the OMIT-rather-than-null shape is tested
16697
+ // rather than asserted. `undefined` is dropped by JSON.stringify, and the
16698
+ // route reads an omitted field as no observation and leaves the stored
16699
+ // label alone; a null would be a value it had to interpret.
16700
+ claude_account_email: heartbeatAccountEmailField(claudeAuthModeRaw, claudeAccountEmail),
16637
16701
  // ENG-5614: inbound-loop liveness. The actual phoenix socket state
16638
16702
  // behind the direct-chat Realtime subscription. When this is false
16639
16703
  // but the manager keeps heartbeating, inbound is being served by the
@@ -16761,7 +16825,7 @@ async function pollCycleInner() {
16761
16825
  collectPanelessActivityProbes,
16762
16826
  getResponsivenessIntervalMs,
16763
16827
  occupancyQualificationClassifications
16764
- } = await import("../responsiveness-probe-C75AUK6I.js");
16828
+ } = await import("../responsiveness-probe-2DF6VH7Q.js");
16765
16829
  const probeIntervalMs = getResponsivenessIntervalMs();
16766
16830
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
16767
16831
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -16878,7 +16942,7 @@ async function pollCycleInner() {
16878
16942
  collectResponsivenessProbes,
16879
16943
  livePendingInboundOldestAgeSeconds,
16880
16944
  parkPendingInbound
16881
- } = await import("../responsiveness-probe-C75AUK6I.js");
16945
+ } = await import("../responsiveness-probe-2DF6VH7Q.js");
16882
16946
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-M6AFZWNU.js");
16883
16947
  const wedgeNow = /* @__PURE__ */ new Date();
16884
16948
  const liveAgents = agentState.persistentSessionAgents;
@@ -17034,7 +17098,7 @@ async function pollCycleInner() {
17034
17098
  }
17035
17099
  try {
17036
17100
  const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-VR5QGP3J.js");
17037
- const { probeSessionAuth } = await import("../session-auth-dead-VFRUHVTF.js");
17101
+ const { probeSessionAuth } = await import("../session-auth-dead-GRTHA2Z5.js");
17038
17102
  const observations = [];
17039
17103
  const pendingCacheCommits = [];
17040
17104
  const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
@@ -21599,7 +21663,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
21599
21663
  try {
21600
21664
  const freshId = rotateSessionForWedge(codeName);
21601
21665
  consecutiveWedgeCycles.delete(codeName);
21602
- const { parkPendingInbound: parkForRestart } = await import("../responsiveness-probe-C75AUK6I.js");
21666
+ const { parkPendingInbound: parkForRestart } = await import("../responsiveness-probe-2DF6VH7Q.js");
21603
21667
  const { parked, deadLettered } = parkForRestart(codeName, /* @__PURE__ */ new Date());
21604
21668
  const parkNote = parked > 0 ? `, ${parked} inbound parked` : "";
21605
21669
  const deadNote = deadLettered > 0 ? `, ${deadLettered} undeliverable dead-lettered` : "";
@@ -21642,7 +21706,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
21642
21706
  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}`));
21643
21707
  void (async () => {
21644
21708
  try {
21645
- const { collectDiagnostics } = await import("../persistent-session-5RX4P7GP.js");
21709
+ const { collectDiagnostics } = await import("../persistent-session-3WRSJIDM.js");
21646
21710
  await api.post("/host/heartbeat", {
21647
21711
  host_id: hostId,
21648
21712
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor)
@@ -21693,7 +21757,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
21693
21757
  }
21694
21758
  try {
21695
21759
  const hostId = await getHostId();
21696
- const { collectDiagnostics } = await import("../persistent-session-5RX4P7GP.js");
21760
+ const { collectDiagnostics } = await import("../persistent-session-3WRSJIDM.js");
21697
21761
  await api.post("/host/heartbeat", {
21698
21762
  host_id: hostId,
21699
21763
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor)
@@ -22365,7 +22429,7 @@ async function processClaudePairSessions(agents) {
22365
22429
  // cannot take it for itself — by the time it runs, the write it is looking
22366
22430
  // for may already have happened.
22367
22431
  snapshotPairConfig
22368
- } = await import("../claude-pair-runtime-KMPRE2ZJ.js");
22432
+ } = await import("../claude-pair-runtime-GO3C7KT6.js");
22369
22433
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
22370
22434
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
22371
22435
  const killed = await killPairSession(pairTmuxSession(pairId));