@integrity-labs/agt-cli 0.28.725 → 0.28.726

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-CEC5KESY.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-LP7JOGZ5.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-XWPOUQMP.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-42GBPDC7.js.map
@@ -57,7 +57,7 @@ import {
57
57
  safeWriteJsonAtomic,
58
58
  setConfigHash,
59
59
  tripClass
60
- } from "../chunk-MHB3SEYC.js";
60
+ } from "../chunk-Z3N7J2MG.js";
61
61
  import {
62
62
  getProjectDir as getProjectDir2,
63
63
  getReadyTasks,
@@ -90,8 +90,11 @@ import {
90
90
  isolationMode,
91
91
  log,
92
92
  mergeOpencodeConfigArtifact,
93
+ modelPolicyAuthComponent,
94
+ modelPolicyEgressDomains,
93
95
  paneLogPath,
94
96
  parseEnvIntegrations,
97
+ parseModelPolicy,
95
98
  prepareForRespawn,
96
99
  readChannelServerEnv,
97
100
  readDirectChatSessionState,
@@ -115,7 +118,7 @@ import {
115
118
  takeZombieDetection,
116
119
  toOpencodeModel,
117
120
  writeEgressAllowlist
118
- } from "../chunk-ATJU3SDV.js";
121
+ } from "../chunk-ZCTFF4PA.js";
119
122
  import {
120
123
  ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
121
124
  AnchorSessionClient,
@@ -2880,21 +2883,29 @@ var COMPONENT_ORDER = [
2880
2883
  "auth_mode",
2881
2884
  "anthropic_api_key_fingerprint",
2882
2885
  "claude_account_fingerprint",
2883
- "openrouter_fingerprint"
2886
+ "openrouter_fingerprint",
2887
+ // ENG-9483 slice 2: `<policyId>@<revision>` from modelPolicyAuthComponent.
2888
+ // Non-secret: a uuid the operator chose plus an integer they can see in the UI.
2889
+ "model_policy"
2884
2890
  ];
2891
+ var POLICY_TUPLE_SEPARATOR = "|policy=";
2885
2892
  function parseAuthTuple(tuple) {
2886
- const raw = typeof tuple === "string" ? tuple : "";
2893
+ const full = typeof tuple === "string" ? tuple : "";
2894
+ const sepAt = full.lastIndexOf(POLICY_TUPLE_SEPARATOR);
2895
+ const raw = sepAt === -1 ? full : full.slice(0, sepAt);
2896
+ const policy = sepAt === -1 ? null : full.slice(sepAt + POLICY_TUPLE_SEPARATOR.length) || ABSENT2;
2897
+ const withPolicy = (r) => policy === null ? r : { ...r, model_policy: policy };
2887
2898
  if (raw.startsWith("openrouter:")) {
2888
- return {
2899
+ return withPolicy({
2889
2900
  auth_mode: "openrouter",
2890
2901
  openrouter_fingerprint: raw.slice("openrouter:".length) || ABSENT2
2891
- };
2902
+ });
2892
2903
  }
2893
2904
  const parts = raw.split(":");
2894
2905
  if (parts.length < 2) {
2895
- return { auth_mode: raw || ABSENT2 };
2906
+ return withPolicy({ auth_mode: raw || ABSENT2 });
2896
2907
  }
2897
- return {
2908
+ return withPolicy({
2898
2909
  auth_mode: parts[0] || ABSENT2,
2899
2910
  anthropic_api_key_fingerprint: parts[1] || ABSENT2,
2900
2911
  // Omitted from the string when there is no signed-in account fingerprint
@@ -2902,7 +2913,19 @@ function parseAuthTuple(tuple) {
2902
2913
  // Recorded as the ABSENT sentinel so "account appeared" / "account
2903
2914
  // disappeared" is itself visible as a change.
2904
2915
  claude_account_fingerprint: parts[2] || ABSENT2
2905
- };
2916
+ });
2917
+ }
2918
+ function buildAuthTuple(input) {
2919
+ const {
2920
+ openRouterCredential,
2921
+ claudeAuthMode,
2922
+ anthropicApiKeyFingerprint,
2923
+ claudeAccountFingerprint,
2924
+ modelPolicyComponent
2925
+ } = input;
2926
+ const suffix = modelPolicyComponent ? `${POLICY_TUPLE_SEPARATOR}${modelPolicyComponent}` : "";
2927
+ if (openRouterCredential) return `openrouter:${openRouterCredential}${suffix}`;
2928
+ return `${claudeAuthMode}:${anthropicApiKeyFingerprint ?? ABSENT2}${claudeAccountFingerprint ? `:${claudeAccountFingerprint}` : ""}${suffix}`;
2906
2929
  }
2907
2930
  function diffAuthTuples(recorded, current) {
2908
2931
  const before = parseAuthTuple(recorded);
@@ -12243,7 +12266,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
12243
12266
  var dayRolloverInboundHold = /* @__PURE__ */ new Map();
12244
12267
  var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
12245
12268
  async function channelInboundActivityAgeSecondsFor(codeName) {
12246
- const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-J3VB4U4W.js");
12269
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-TTHNHBBS.js");
12247
12270
  const newest = newestPendingInboundActivityMtimeMs(dirname10(paneLogPath(codeName)));
12248
12271
  if (newest === null) return null;
12249
12272
  return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
@@ -12891,7 +12914,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
12891
12914
  var lastVersionCheckAt = 0;
12892
12915
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
12893
12916
  var lastResponsivenessProbeAt = 0;
12894
- var agtCliVersion = true ? "0.28.725" : "dev";
12917
+ var agtCliVersion = true ? "0.28.726" : "dev";
12895
12918
  function resolveBrewPath(execFileSync3) {
12896
12919
  try {
12897
12920
  const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -14418,7 +14441,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
14418
14441
  if (codeNames.length === 0) return;
14419
14442
  void (async () => {
14420
14443
  try {
14421
- const { collectDiagnostics } = await import("../persistent-session-CEC5KESY.js");
14444
+ const { collectDiagnostics } = await import("../persistent-session-LP7JOGZ5.js");
14422
14445
  await api.post("/host/heartbeat", {
14423
14446
  host_id: hostId,
14424
14447
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
@@ -14536,7 +14559,7 @@ async function pollCycleInner() {
14536
14559
  }
14537
14560
  try {
14538
14561
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
14539
- const { collectDiagnostics } = await import("../persistent-session-CEC5KESY.js");
14562
+ const { collectDiagnostics } = await import("../persistent-session-LP7JOGZ5.js");
14540
14563
  const diagCodeNames = [...agentState.persistentSessionAgents];
14541
14564
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor) : void 0;
14542
14565
  let tailscaleHostname;
@@ -14705,7 +14728,7 @@ async function pollCycleInner() {
14705
14728
  collectPanelessActivityProbes,
14706
14729
  getResponsivenessIntervalMs,
14707
14730
  occupancyQualificationClassifications
14708
- } = await import("../responsiveness-probe-J3VB4U4W.js");
14731
+ } = await import("../responsiveness-probe-TTHNHBBS.js");
14709
14732
  const probeIntervalMs = getResponsivenessIntervalMs();
14710
14733
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
14711
14734
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -14815,7 +14838,7 @@ async function pollCycleInner() {
14815
14838
  collectResponsivenessProbes,
14816
14839
  livePendingInboundOldestAgeSeconds,
14817
14840
  parkPendingInbound
14818
- } = await import("../responsiveness-probe-J3VB4U4W.js");
14841
+ } = await import("../responsiveness-probe-TTHNHBBS.js");
14819
14842
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-NDP36U7O.js");
14820
14843
  const wedgeNow = /* @__PURE__ */ new Date();
14821
14844
  const liveAgents = agentState.persistentSessionAgents;
@@ -18000,9 +18023,10 @@ var persistentSessionStuckTracker = new PersistentSessionStuckTracker();
18000
18023
  var claudeAuthTupleBySession = /* @__PURE__ */ new Map();
18001
18024
  var opencodeCredentialFingerprintBySession = /* @__PURE__ */ new Map();
18002
18025
  var egressAllowlistBySession = /* @__PURE__ */ new Map();
18003
- function deriveEgressAllowlist(toolsRaw) {
18026
+ function deriveEgressAllowlist(toolsRaw, policy) {
18004
18027
  return buildEgressAllowlist(
18005
- toolsRaw ? extractFrontmatter(toolsRaw).frontmatter : null
18028
+ toolsRaw ? extractFrontmatter(toolsRaw).frontmatter : null,
18029
+ modelPolicyEgressDomains(policy)
18006
18030
  );
18007
18031
  }
18008
18032
  var egressAllowlistEqual = (a, b) => a.length === b.length && a.every((d, i) => d === b[i]);
@@ -18145,6 +18169,9 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
18145
18169
  smallFastModel: openRouterRaw.small_fast_model ?? null,
18146
18170
  fingerprint: openRouterRaw.fingerprint ?? null
18147
18171
  } : null;
18172
+ const modelPolicy = parseModelPolicy(
18173
+ refreshData.model_policy
18174
+ );
18148
18175
  let claudeAuthMode;
18149
18176
  let anthropicApiKey;
18150
18177
  let anthropicApiKeyFingerprint;
@@ -18246,7 +18273,13 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
18246
18273
  let dayRolloverForced = false;
18247
18274
  const claudeAccountFingerprint = !openRouterForAgent && claudeAuthMode === "subscription" ? await getClaudeAccountFingerprint() : null;
18248
18275
  noteClaudeAccountChange(codeName, claudeAccountFingerprint, log);
18249
- const currentAuthTuple = openRouterForAgent ? `openrouter:${openRouterForAgent.fingerprint ?? openRouterForAgent.model}` : `${claudeAuthMode}:${anthropicApiKeyFingerprint ?? "none"}${claudeAccountFingerprint ? `:${claudeAccountFingerprint}` : ""}`;
18276
+ const currentAuthTuple = buildAuthTuple({
18277
+ openRouterCredential: openRouterForAgent ? openRouterForAgent.fingerprint ?? openRouterForAgent.model : null,
18278
+ claudeAuthMode,
18279
+ anthropicApiKeyFingerprint,
18280
+ claudeAccountFingerprint,
18281
+ modelPolicyComponent: modelPolicyAuthComponent(modelPolicy)
18282
+ });
18250
18283
  const recordedAuthTuple = claudeAuthTupleBySession.get(codeName);
18251
18284
  if (recordedAuthTuple && recordedAuthTuple !== currentAuthTuple && isSessionHealthy(codeName)) {
18252
18285
  const authTupleDiff = diffAuthTuples(recordedAuthTuple, currentAuthTuple);
@@ -18413,7 +18446,8 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash19("sha256")
18413
18446
  trackSessionRun(codeName, sessionRunResult.run_id);
18414
18447
  const spawnPrimaryModel = resolveModelChain(refreshData).primary ?? refreshData.agent?.["primary_model"] ?? null;
18415
18448
  const egressAllowlist = deriveEgressAllowlist(
18416
- refreshData.tools?.raw_content
18449
+ refreshData.tools?.raw_content,
18450
+ modelPolicy
18417
18451
  );
18418
18452
  egressAllowlistBySession.set(codeName, egressAllowlist);
18419
18453
  let perAgentApiKey = null;
@@ -18466,6 +18500,17 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash19("sha256")
18466
18500
  model: openRouterForAgent.model,
18467
18501
  smallFastModel: openRouterForAgent.smallFastModel
18468
18502
  } : null,
18503
+ // ENG-9483 slice 2 (ADR-0074). The SHAPE reaches the launcher; the
18504
+ // credential does not. `modelPolicyGatewayToken` is deliberately absent
18505
+ // (⇒ null) rather than wired to some plausible existing secret: slice 1's
18506
+ // resolver never selects `model_policy_bindings.credential`, and ENG-9481's
18507
+ // stored-key-vs-pass-through answer decides whether the credential is a
18508
+ // `gateway_token` (needing ANTHROPIC_CUSTOM_HEADERS, an at-rest secret this
18509
+ // tree does not have) or a plain `api_key` (which does not). Until then a
18510
+ // gateway binding resolves to `blocked` and the agent keeps its existing
18511
+ // auth — see resolveBindingCredential, the one function that changes when
18512
+ // that question is answered.
18513
+ modelPolicy,
18469
18514
  runId: sessionRunResult.run_id,
18470
18515
  agentTimezone,
18471
18516
  // ENG-6476: materialize the host-side reply-routing flags into the agent
@@ -18520,7 +18565,8 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash19("sha256")
18520
18565
  resetRestartCount(codeName);
18521
18566
  if (egressMode(codeName) === "allowlist") {
18522
18567
  const allowlist = deriveEgressAllowlist(
18523
- refreshData.tools?.raw_content
18568
+ refreshData.tools?.raw_content,
18569
+ modelPolicy
18524
18570
  );
18525
18571
  const prev = egressAllowlistBySession.get(codeName);
18526
18572
  if (!prev || !egressAllowlistEqual(prev, allowlist)) {
@@ -18863,7 +18909,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
18863
18909
  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}`));
18864
18910
  void (async () => {
18865
18911
  try {
18866
- const { collectDiagnostics } = await import("../persistent-session-CEC5KESY.js");
18912
+ const { collectDiagnostics } = await import("../persistent-session-LP7JOGZ5.js");
18867
18913
  await api.post("/host/heartbeat", {
18868
18914
  host_id: hostId,
18869
18915
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
@@ -18914,7 +18960,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
18914
18960
  }
18915
18961
  try {
18916
18962
  const hostId = await getHostId();
18917
- const { collectDiagnostics } = await import("../persistent-session-CEC5KESY.js");
18963
+ const { collectDiagnostics } = await import("../persistent-session-LP7JOGZ5.js");
18918
18964
  await api.post("/host/heartbeat", {
18919
18965
  host_id: hostId,
18920
18966
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
@@ -19546,7 +19592,7 @@ async function processClaudePairSessions(agents) {
19546
19592
  killPairSession,
19547
19593
  pairTmuxSession,
19548
19594
  finalizeClaudePairOnboarding
19549
- } = await import("../claude-pair-runtime-XWPOUQMP.js");
19595
+ } = await import("../claude-pair-runtime-42GBPDC7.js");
19550
19596
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
19551
19597
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
19552
19598
  const killed = await killPairSession(pairTmuxSession(pairId));