@integrity-labs/agt-cli 0.28.800 → 0.28.801

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.
package/dist/bin/agt.js CHANGED
@@ -40,12 +40,12 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-BHF5IROA.js";
43
+ } from "../chunk-ZI2MCNK2.js";
44
44
  import {
45
45
  getProjectDir,
46
46
  isSessionResumeDisabled,
47
47
  readDirectChatSessionState
48
- } from "../chunk-6DSTKWCZ.js";
48
+ } from "../chunk-H37X4QPC.js";
49
49
  import {
50
50
  AnchorSessionClient,
51
51
  CHANNEL_REGISTRY,
@@ -5467,7 +5467,7 @@ import { execFileSync, execSync } from "child_process";
5467
5467
  import { existsSync as existsSync11, realpathSync as realpathSync2 } from "fs";
5468
5468
  import chalk18 from "chalk";
5469
5469
  import ora16 from "ora";
5470
- var cliVersion = true ? "0.28.800" : "dev";
5470
+ var cliVersion = true ? "0.28.801" : "dev";
5471
5471
  async function fetchLatestVersion() {
5472
5472
  const host2 = getHost();
5473
5473
  if (!host2) return null;
@@ -6658,7 +6658,7 @@ function handleError(err) {
6658
6658
  }
6659
6659
 
6660
6660
  // src/bin/agt.ts
6661
- var cliVersion2 = true ? "0.28.800" : "dev";
6661
+ var cliVersion2 = true ? "0.28.801" : "dev";
6662
6662
  var program = new Command();
6663
6663
  program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
6664
6664
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -3342,18 +3342,27 @@ function parseModelPolicy(raw) {
3342
3342
  if (!parsed) return null;
3343
3343
  bindings.push(parsed);
3344
3344
  }
3345
+ const activeRoleRaw = raw["active_role"];
3346
+ let activeRole = "primary";
3347
+ if (activeRoleRaw !== void 0 && activeRoleRaw !== null) {
3348
+ if (typeof activeRoleRaw !== "string" || !ROLES.includes(activeRoleRaw)) return null;
3349
+ activeRole = activeRoleRaw;
3350
+ }
3351
+ if (!bindings.some((b) => b.role === activeRole)) return null;
3345
3352
  return {
3346
3353
  policyId,
3347
3354
  name,
3348
3355
  revision,
3349
3356
  resolvedFrom,
3357
+ activeRole,
3350
3358
  bindings,
3351
3359
  models: parseModelPolicyModels(raw["models"])
3352
3360
  };
3353
3361
  }
3354
3362
  function modelPolicyAuthComponent(policy) {
3355
3363
  if (!policy) return null;
3356
- return `${policy.policyId}@${policy.revision}`;
3364
+ const base = `${policy.policyId}@${policy.revision}`;
3365
+ return policy.activeRole === "primary" ? base : `${base}/${policy.activeRole}`;
3357
3366
  }
3358
3367
  function modelPolicyEgressDomains(policy) {
3359
3368
  if (!policy) return [];
@@ -3383,9 +3392,9 @@ function resolveBindingCredential(binding, availableGatewayToken) {
3383
3392
  }
3384
3393
  }
3385
3394
  }
3386
- function primaryBinding(policy) {
3395
+ function activeBinding(policy) {
3387
3396
  if (!policy) return null;
3388
- return policy.bindings.find((b) => b.role === "primary") ?? null;
3397
+ return policy.bindings.find((b) => b.role === policy.activeRole) ?? null;
3389
3398
  }
3390
3399
  function sourceSetsAnthropicApiKey(source) {
3391
3400
  switch (source) {
@@ -3420,8 +3429,9 @@ function modelEnvForRole(policy, role) {
3420
3429
  }
3421
3430
  function resolveModelPolicySpawnEnv(input) {
3422
3431
  const { policy, openRouterMode, gatewayToken, codeName } = input;
3423
- const primary = primaryBinding(policy);
3424
- if (!policy || !primary) return { env: {}, modelEnv: {}, notice: null };
3432
+ const active = activeBinding(policy);
3433
+ if (!policy || !active) return { env: {}, modelEnv: {}, notice: null };
3434
+ const roleNote = policy.activeRole === "primary" ? "" : ` role=${policy.activeRole} (FAILOVER)`;
3425
3435
  if (openRouterMode) {
3426
3436
  return {
3427
3437
  env: {},
@@ -3433,9 +3443,9 @@ function resolveModelPolicySpawnEnv(input) {
3433
3443
  notice: `[model-policy] '${codeName}' has policy '${policy.name}' but is in OpenRouter mode \u2014 OpenRouter wins, policy not applied (ENG-9483: unifying the two actuators is a separate migration)`
3434
3444
  };
3435
3445
  }
3436
- const modelEnv = modelEnvForRole(policy, primary.role);
3446
+ const modelEnv = modelEnvForRole(policy, active.role);
3437
3447
  const modelNote = Object.keys(modelEnv).length > 0 ? ` models=${Object.entries(modelEnv).map(([k, v]) => `${k}=${v}`).join(" ")}` : "";
3438
- const resolution = resolveBindingCredential(primary, gatewayToken);
3448
+ const resolution = resolveBindingCredential(active, gatewayToken);
3439
3449
  switch (resolution.kind) {
3440
3450
  case "gateway":
3441
3451
  return {
@@ -3444,7 +3454,7 @@ function resolveModelPolicySpawnEnv(input) {
3444
3454
  ANTHROPIC_AUTH_TOKEN: resolution.authToken
3445
3455
  },
3446
3456
  modelEnv,
3447
- notice: `[model-policy] '${codeName}' inference via gateway ${resolution.baseUrl} (policy '${policy.name}' rev ${policy.revision}, from ${policy.resolvedFrom})${modelNote}`
3457
+ notice: `[model-policy] '${codeName}' inference via gateway ${resolution.baseUrl} (policy '${policy.name}' rev ${policy.revision}, from ${policy.resolvedFrom})${roleNote}${modelNote}`
3448
3458
  };
3449
3459
  case "blocked":
3450
3460
  return {
@@ -3455,16 +3465,33 @@ function resolveModelPolicySpawnEnv(input) {
3455
3465
  // somewhere else — a policy half-applied, which is the one outcome this
3456
3466
  // file has no branch for.
3457
3467
  modelEnv: {},
3458
- notice: `[model-policy] '${codeName}' policy '${policy.name}' NOT applied \u2014 reason=${resolution.reason}; keeping existing auth (transport=${primary.transport}, credential_source=${primary.credentialSource})`
3468
+ notice: `[model-policy] '${codeName}' policy '${policy.name}' NOT applied \u2014 reason=${resolution.reason}; keeping existing auth (transport=${active.transport}, credential_source=${active.credentialSource})${roleNote}`
3459
3469
  };
3460
3470
  case "host-default":
3461
3471
  return {
3462
3472
  env: {},
3463
3473
  modelEnv,
3464
- notice: modelNote ? `[model-policy] '${codeName}' model from policy '${policy.name}' rev ${policy.revision} (from ${policy.resolvedFrom});${modelNote}` : null
3474
+ notice: modelNote || roleNote ? `[model-policy] '${codeName}' model from policy '${policy.name}' rev ${policy.revision} (from ${policy.resolvedFrom})${roleNote};${modelNote || " no slot maps to an env var"}` : null
3465
3475
  };
3466
3476
  }
3467
3477
  }
3478
+ function failoverRestartNotice(input) {
3479
+ const entry = input.components.find((c) => c.component === "model_policy");
3480
+ if (!entry) return null;
3481
+ const fromRole = roleFromAuthComponent(entry.from);
3482
+ const toRole = roleFromAuthComponent(entry.to);
3483
+ if (fromRole === toRole) return null;
3484
+ const model = input.policy ? modelEnvForRole(input.policy, toRole).ANTHROPIC_MODEL : void 0;
3485
+ const onto = model ? `${toRole} model provider (${model})` : `${toRole} model provider`;
3486
+ const direction = toRole === "primary" ? `Your manager is switching you back to your ${onto}.` : `Your manager is switching you to your ${onto} \u2014 this policy has failed over.`;
3487
+ return `${direction} Claude Code applies the provider and model at launch, so your session will restart shortly to make the switch.`;
3488
+ }
3489
+ function roleFromAuthComponent(value) {
3490
+ const at = value.lastIndexOf("/");
3491
+ if (at === -1) return "primary";
3492
+ const role = value.slice(at + 1);
3493
+ return ROLES.includes(role) ? role : "primary";
3494
+ }
3468
3495
 
3469
3496
  // src/lib/persistent-session.ts
3470
3497
  var OPENROUTER_ANTHROPIC_BASE_URL = "https://openrouter.ai/api";
@@ -5115,6 +5142,7 @@ export {
5115
5142
  parseModelPolicy,
5116
5143
  modelPolicyAuthComponent,
5117
5144
  modelPolicyEgressDomains,
5145
+ failoverRestartNotice,
5118
5146
  resolveOAuthCredAction,
5119
5147
  resolveClaudeBinary,
5120
5148
  isolationMode,
@@ -5166,4 +5194,4 @@ export {
5166
5194
  stopAllSessionsAndWait,
5167
5195
  getProjectDir
5168
5196
  };
5169
- //# sourceMappingURL=chunk-6DSTKWCZ.js.map
5197
+ //# sourceMappingURL=chunk-H37X4QPC.js.map