@integrity-labs/agt-cli 0.28.617 → 0.28.618

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.
@@ -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-GM3EH2ZU.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-AGPLISL3.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-QCL2TB6N.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-3356FFTC.js.map
@@ -34,6 +34,7 @@ import {
34
34
  liveProxyTokenVars,
35
35
  markQuarantinedForProbe,
36
36
  migrateAgentDirToIdKeyed,
37
+ mintAgentKey,
37
38
  pinAllowsUrgent,
38
39
  provision,
39
40
  provisionAutoKanbanProgressHook,
@@ -53,7 +54,7 @@ import {
53
54
  safeWriteJsonAtomic,
54
55
  setConfigHash,
55
56
  tripClass
56
- } from "../chunk-NJHZL7CZ.js";
57
+ } from "../chunk-CKCXOIN3.js";
57
58
  import {
58
59
  getProjectDir as getProjectDir2,
59
60
  getReadyTasks,
@@ -109,7 +110,7 @@ import {
109
110
  takeZombieDetection,
110
111
  toOpencodeModel,
111
112
  writeEgressAllowlist
112
- } from "../chunk-6SJJM4FT.js";
113
+ } from "../chunk-RXC3MTSN.js";
113
114
  import {
114
115
  ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
115
116
  AnchorSessionClient,
@@ -186,7 +187,7 @@ import {
186
187
  subagentActivityAgeSeconds,
187
188
  sumTranscriptUsageInWindow,
188
189
  transcriptActivityAgeSeconds
189
- } from "../chunk-TYVQNCBU.js";
190
+ } from "../chunk-P6KFZVKA.js";
190
191
  import {
191
192
  reapOrphanChannelMcps
192
193
  } from "../chunk-XWVM4KPK.js";
@@ -4696,6 +4697,13 @@ function classifyPollError(message) {
4696
4697
  return "other";
4697
4698
  }
4698
4699
 
4700
+ // src/lib/per-agent-key.ts
4701
+ async function resolvePerAgentApiKey(opts) {
4702
+ const isPool = opts.hostKind === "pool";
4703
+ if (!isPool && !opts.dedicatedEnabled) return null;
4704
+ return await opts.mint(opts.rawHostKey, opts.agentId);
4705
+ }
4706
+
4699
4707
  // src/lib/integration-context-render.ts
4700
4708
  var PLUGIN_CONTEXT_PLACEHOLDER_RE = /\{\{\s*context\.([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}/g;
4701
4709
  var TEAM_OVERRIDES_HEADER = "## Team Overrides\n\n> **The following overrides anything you've read above.** If any rule here conflicts with earlier instructions in this skill, follow what is written here. These are user-supplied directives that take precedence over the plugin's default guidance.\n";
@@ -11330,7 +11338,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
11330
11338
  var dayRolloverInboundHold = /* @__PURE__ */ new Map();
11331
11339
  var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
11332
11340
  async function channelInboundActivityAgeSecondsFor(codeName) {
11333
- const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-VSSJC3MN.js");
11341
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-ITYPPSHM.js");
11334
11342
  const newest = newestPendingInboundActivityMtimeMs(dirname9(paneLogPath(codeName)));
11335
11343
  if (newest === null) return null;
11336
11344
  return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
@@ -11969,7 +11977,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
11969
11977
  var lastVersionCheckAt = 0;
11970
11978
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
11971
11979
  var lastResponsivenessProbeAt = 0;
11972
- var agtCliVersion = true ? "0.28.617" : "dev";
11980
+ var agtCliVersion = true ? "0.28.618" : "dev";
11973
11981
  function resolveBrewPath(execFileSync3) {
11974
11982
  try {
11975
11983
  const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -13276,7 +13284,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
13276
13284
  if (codeNames.length === 0) return;
13277
13285
  void (async () => {
13278
13286
  try {
13279
- const { collectDiagnostics } = await import("../persistent-session-GM3EH2ZU.js");
13287
+ const { collectDiagnostics } = await import("../persistent-session-AGPLISL3.js");
13280
13288
  await api.post("/host/heartbeat", {
13281
13289
  host_id: hostId,
13282
13290
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor)
@@ -13392,7 +13400,7 @@ async function pollCycleInner() {
13392
13400
  }
13393
13401
  try {
13394
13402
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
13395
- const { collectDiagnostics } = await import("../persistent-session-GM3EH2ZU.js");
13403
+ const { collectDiagnostics } = await import("../persistent-session-AGPLISL3.js");
13396
13404
  const diagCodeNames = [...agentState.persistentSessionAgents];
13397
13405
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor) : void 0;
13398
13406
  let tailscaleHostname;
@@ -13515,7 +13523,7 @@ async function pollCycleInner() {
13515
13523
  collectPanelessActivityProbes,
13516
13524
  getResponsivenessIntervalMs,
13517
13525
  occupancyQualificationClassifications
13518
- } = await import("../responsiveness-probe-VSSJC3MN.js");
13526
+ } = await import("../responsiveness-probe-ITYPPSHM.js");
13519
13527
  const probeIntervalMs = getResponsivenessIntervalMs();
13520
13528
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
13521
13529
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -13621,7 +13629,7 @@ async function pollCycleInner() {
13621
13629
  collectResponsivenessProbes,
13622
13630
  livePendingInboundOldestAgeSeconds,
13623
13631
  parkPendingInbound
13624
- } = await import("../responsiveness-probe-VSSJC3MN.js");
13632
+ } = await import("../responsiveness-probe-ITYPPSHM.js");
13625
13633
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-NDP36U7O.js");
13626
13634
  const wedgeNow = /* @__PURE__ */ new Date();
13627
13635
  const liveAgents = agentState.persistentSessionAgents;
@@ -13777,7 +13785,7 @@ async function pollCycleInner() {
13777
13785
  }
13778
13786
  try {
13779
13787
  const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-JA437JIB.js");
13780
- const { probeSessionAuth } = await import("../session-auth-dead-KOKVXPPQ.js");
13788
+ const { probeSessionAuth } = await import("../session-auth-dead-Y6ABNWNM.js");
13781
13789
  const observations = [];
13782
13790
  const pendingCacheCommits = [];
13783
13791
  const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
@@ -16659,6 +16667,8 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
16659
16667
  let claudeAuthMode;
16660
16668
  let anthropicApiKey;
16661
16669
  let anthropicApiKeyFingerprint;
16670
+ let hostKind = null;
16671
+ let rawHostKey = null;
16662
16672
  try {
16663
16673
  const apiKey = getApiKey();
16664
16674
  if (!apiKey) {
@@ -16673,6 +16683,8 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
16673
16683
  claudeAuthMode = exchange.claudeAuthMode;
16674
16684
  anthropicApiKey = exchange.anthropicApiKey;
16675
16685
  anthropicApiKeyFingerprint = exchange.anthropicApiKeyFingerprint;
16686
+ hostKind = exchange.hostKind;
16687
+ rawHostKey = apiKey;
16676
16688
  } catch (err) {
16677
16689
  const msg = err.message;
16678
16690
  const healthyBefore = isSessionHealthy(codeName);
@@ -16923,6 +16935,37 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash17("sha256")
16923
16935
  refreshData.tools?.raw_content
16924
16936
  );
16925
16937
  egressAllowlistBySession.set(codeName, egressAllowlist);
16938
+ let perAgentApiKey = null;
16939
+ try {
16940
+ perAgentApiKey = await resolvePerAgentApiKey({
16941
+ hostKind,
16942
+ // Non-null on every path that reaches here: the auth block above returns
16943
+ // 'skipped-no-api-key' when getApiKey() is empty. `?? ''` keeps the types
16944
+ // honest without inventing a fallback credential — an empty key cannot
16945
+ // authenticate the mint, so it fails closed like any other bad key.
16946
+ rawHostKey: rawHostKey ?? "",
16947
+ agentId: agent.agent_id,
16948
+ dedicatedEnabled: hostFlagStore().getBoolean("per-agent-host-credentials"),
16949
+ mint: mintAgentKey
16950
+ });
16951
+ } catch (err) {
16952
+ const msg = err instanceof Error ? err.message : String(err);
16953
+ log(
16954
+ `[persistent-session] '${codeName}' (host_kind=${hostKind ?? "dedicated"}): per-agent key mint FAILED (${msg}) \u2014 refusing to spawn rather than fall back to the shared host key`
16955
+ );
16956
+ closeSessionRunForCode(codeName, "failed", "per-agent key mint failed");
16957
+ return {
16958
+ decision: "skipped-per-agent-key-mint-failed",
16959
+ spawnAttempted: false,
16960
+ sessionHealthyAfter: isSessionHealthy(codeName),
16961
+ detail: msg
16962
+ };
16963
+ }
16964
+ if (perAgentApiKey) {
16965
+ log(
16966
+ `[persistent-session] '${codeName}' (host_kind=${hostKind ?? "dedicated"}): injecting per-agent org-scoped key (ADR-0042 pt3b)`
16967
+ );
16968
+ }
16926
16969
  startPersistentSession({
16927
16970
  codeName,
16928
16971
  agentId: agent.agent_id,
@@ -16971,6 +17014,9 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash17("sha256")
16971
17014
  // this the flip reaches nothing running under Docker isolation.
16972
17015
  turnFailureNoticeEnabled: hostFlagStore().getBoolean("wedge-transient-notice"),
16973
17016
  egressAllowlist,
17017
+ // ADR-0042 pt3b (ENG-7607 / ENG-8992): this agent's own org-scoped key
17018
+ // (null when unarmed). The spawn env carries it as this agent's AGT_API_KEY.
17019
+ perAgentApiKey,
16974
17020
  log
16975
17021
  });
16976
17022
  agentState.persistentSessionAgents.add(codeName);
@@ -17266,7 +17312,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
17266
17312
  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}`));
17267
17313
  void (async () => {
17268
17314
  try {
17269
- const { collectDiagnostics } = await import("../persistent-session-GM3EH2ZU.js");
17315
+ const { collectDiagnostics } = await import("../persistent-session-AGPLISL3.js");
17270
17316
  await api.post("/host/heartbeat", {
17271
17317
  host_id: hostId,
17272
17318
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor)
@@ -17317,7 +17363,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
17317
17363
  }
17318
17364
  try {
17319
17365
  const hostId = await getHostId();
17320
- const { collectDiagnostics } = await import("../persistent-session-GM3EH2ZU.js");
17366
+ const { collectDiagnostics } = await import("../persistent-session-AGPLISL3.js");
17321
17367
  await api.post("/host/heartbeat", {
17322
17368
  host_id: hostId,
17323
17369
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor)
@@ -17913,7 +17959,7 @@ async function processClaudePairSessions(agents) {
17913
17959
  killPairSession,
17914
17960
  pairTmuxSession,
17915
17961
  finalizeClaudePairOnboarding
17916
- } = await import("../claude-pair-runtime-QCL2TB6N.js");
17962
+ } = await import("../claude-pair-runtime-3356FFTC.js");
17917
17963
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
17918
17964
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
17919
17965
  const killed = await killPairSession(pairTmuxSession(pairId));