claude-use 11.38.0 → 11.40.0

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/cli.cjs CHANGED
@@ -33898,6 +33898,7 @@ function buildLayoutPaths(root) {
33898
33898
  usageJobsFile: import_node_path20.default.join(root, "usage", "jobs.json"),
33899
33899
  jobLogsDir: import_node_path20.default.join(root, "logs", "jobs"),
33900
33900
  superviseDir: import_node_path20.default.join(root, "supervise"),
33901
+ modelMovesDir: import_node_path20.default.join(root, "model-moves"),
33901
33902
  mcpPermissionsFile: import_node_path20.default.join(root, "mcp", "permissions.json")
33902
33903
  };
33903
33904
  }
@@ -34635,7 +34636,7 @@ var init_package = __esm({
34635
34636
  "package.json"() {
34636
34637
  package_default = {
34637
34638
  name: "claude-use",
34638
- version: "11.38.0",
34639
+ version: "11.40.0",
34639
34640
  description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
34640
34641
  license: "MIT",
34641
34642
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -35947,6 +35948,7 @@ function createUsageStore(deps) {
35947
35948
  }
35948
35949
  fs26.appendFilePrivate(import_node_path26.default.join(paths.usageLogDir, segmentName(day, deps.pid)), `${JSON.stringify(record2)}
35949
35950
  `);
35951
+ deps.onRecord?.(record2);
35950
35952
  if (record2.identity !== void 0) {
35951
35953
  rewriteSnapshot(record2.identity, (current) => ({ ...current?.providers, [record2.provider]: foldProviderState(current?.providers[record2.provider], record2) }));
35952
35954
  }
@@ -62892,7 +62894,7 @@ var init_selfIdentity = __esm({
62892
62894
  // src/frontdoor/trust.ts
62893
62895
  function resolveTrustBundle(params) {
62894
62896
  const { caCertFile, bundlesDir, variable, inherited, fs: fs26 } = params;
62895
- if (inherited === void 0 || inherited === "" || import_node_path36.default.resolve(inherited) === import_node_path36.default.resolve(caCertFile)) {
62897
+ if (inherited === void 0 || inherited === "" || import_node_path37.default.resolve(inherited) === import_node_path37.default.resolve(caCertFile)) {
62896
62898
  return { path: caCertFile };
62897
62899
  }
62898
62900
  const caPem = fs26.readFileUtf8(caCertFile);
@@ -62910,19 +62912,19 @@ function resolveTrustBundle(params) {
62910
62912
  }
62911
62913
  const combined = `${inheritedPem.trimEnd()}
62912
62914
  ${caPem}`;
62913
- const bundle = import_node_path36.default.join(bundlesDir, `${(0, import_node_crypto12.createHash)("sha256").update(combined).digest("hex").slice(0, BUNDLE_NAME_HEX_DIGITS)}.pem`);
62915
+ const bundle = import_node_path37.default.join(bundlesDir, `${(0, import_node_crypto12.createHash)("sha256").update(combined).digest("hex").slice(0, BUNDLE_NAME_HEX_DIGITS)}.pem`);
62914
62916
  if (!fs26.exists(bundle)) {
62915
62917
  fs26.mkdirp(bundlesDir);
62916
62918
  fs26.writeFileAtomic(bundle, combined);
62917
62919
  }
62918
62920
  return { path: bundle };
62919
62921
  }
62920
- var import_node_crypto12, import_node_path36, BUNDLE_NAME_HEX_DIGITS;
62922
+ var import_node_crypto12, import_node_path37, BUNDLE_NAME_HEX_DIGITS;
62921
62923
  var init_trust = __esm({
62922
62924
  "src/frontdoor/trust.ts"() {
62923
62925
  "use strict";
62924
62926
  import_node_crypto12 = require("node:crypto");
62925
- import_node_path36 = __toESM(require("node:path"), 1);
62927
+ import_node_path37 = __toESM(require("node:path"), 1);
62926
62928
  BUNDLE_NAME_HEX_DIGITS = 16;
62927
62929
  }
62928
62930
  });
@@ -63114,10 +63116,10 @@ async function downloadAndInstall(ports, asset, target) {
63114
63116
  const tempDir = ports.fs.mkdtemp();
63115
63117
  try {
63116
63118
  const assetUrl = `${DOWNLOAD_BASE_URL}/${asset}`;
63117
- ports.fs.writeFileBytes(import_node_path37.default.join(tempDir, asset), await mustDownload(ports.http, assetUrl));
63118
- ports.fs.writeFileUtf8(import_node_path37.default.join(tempDir, `${asset}.sha256`), Buffer.from(await mustDownload(ports.http, `${assetUrl}.sha256`)).toString("utf8"));
63119
- const downloaded = ports.fs.readFileBytes(import_node_path37.default.join(tempDir, asset));
63120
- const sidecar = ports.fs.readFileUtf8(import_node_path37.default.join(tempDir, `${asset}.sha256`));
63119
+ ports.fs.writeFileBytes(import_node_path38.default.join(tempDir, asset), await mustDownload(ports.http, assetUrl));
63120
+ ports.fs.writeFileUtf8(import_node_path38.default.join(tempDir, `${asset}.sha256`), Buffer.from(await mustDownload(ports.http, `${assetUrl}.sha256`)).toString("utf8"));
63121
+ const downloaded = ports.fs.readFileBytes(import_node_path38.default.join(tempDir, asset));
63122
+ const sidecar = ports.fs.readFileUtf8(import_node_path38.default.join(tempDir, `${asset}.sha256`));
63121
63123
  if (downloaded === void 0 || sidecar === void 0) {
63122
63124
  throw new UpdateDownloadError(`the downloaded files for ${asset} are missing from ${tempDir}`);
63123
63125
  }
@@ -63126,7 +63128,7 @@ async function downloadAndInstall(ports, asset, target) {
63126
63128
  if (expected === void 0 || expected !== actual) {
63127
63129
  throw new UpdateDownloadError(`checksum mismatch for ${asset} (expected ${expected ?? "(none)"}, got ${actual})`);
63128
63130
  }
63129
- const tempBinary = import_node_path37.default.join(import_node_path37.default.dirname(target), `.${import_node_path37.default.basename(target)}.${String(process.pid)}.${(0, import_node_crypto13.randomUUID)()}.tmp`);
63131
+ const tempBinary = import_node_path38.default.join(import_node_path38.default.dirname(target), `.${import_node_path38.default.basename(target)}.${String(process.pid)}.${(0, import_node_crypto13.randomUUID)()}.tmp`);
63130
63132
  ports.fs.writeFileBytes(tempBinary, downloaded);
63131
63133
  try {
63132
63134
  ports.fs.chmod(tempBinary, EXECUTABLE_MODE);
@@ -63173,12 +63175,12 @@ async function runSelfUpdate(ports, options) {
63173
63175
  }
63174
63176
  return { current: options.currentVersion, latest, action: "updated" };
63175
63177
  }
63176
- var import_node_crypto13, import_node_path37, LATEST_RELEASE_URL, DOWNLOAD_BASE_URL, MACOS_X64_NOTE, BREW_PREFIXES, EXECUTABLE_MODE, UpdateChannelError, UpdateConflictError, UpdateDownloadError;
63178
+ var import_node_crypto13, import_node_path38, LATEST_RELEASE_URL, DOWNLOAD_BASE_URL, MACOS_X64_NOTE, BREW_PREFIXES, EXECUTABLE_MODE, UpdateChannelError, UpdateConflictError, UpdateDownloadError;
63177
63179
  var init_update = __esm({
63178
63180
  "src/update/update.ts"() {
63179
63181
  "use strict";
63180
63182
  import_node_crypto13 = require("node:crypto");
63181
- import_node_path37 = __toESM(require("node:path"), 1);
63183
+ import_node_path38 = __toESM(require("node:path"), 1);
63182
63184
  init_cliError();
63183
63185
  LATEST_RELEASE_URL = "https://github.com/ExaDev/agent-shim/releases/latest";
63184
63186
  DOWNLOAD_BASE_URL = "https://github.com/ExaDev/agent-shim/releases/latest/download";
@@ -63349,13 +63351,13 @@ function agentShimCliPath(distDir = typeof __AGENT_SHIM_DIST_DIR__ === "string"
63349
63351
  if (distDir === void 0) {
63350
63352
  throw new OwnCliPathUnknownError();
63351
63353
  }
63352
- return import_node_path39.default.join(distDir, OWN_CLI_FILE_NAME);
63354
+ return import_node_path40.default.join(distDir, OWN_CLI_FILE_NAME);
63353
63355
  }
63354
- var import_node_path39, OWN_CLI_FILE_NAME, OwnCliPathUnknownError;
63356
+ var import_node_path40, OWN_CLI_FILE_NAME, OwnCliPathUnknownError;
63355
63357
  var init_ownCli = __esm({
63356
63358
  "src/ownCli.ts"() {
63357
63359
  "use strict";
63358
- import_node_path39 = __toESM(require("node:path"), 1);
63360
+ import_node_path40 = __toESM(require("node:path"), 1);
63359
63361
  init_cliError();
63360
63362
  OWN_CLI_FILE_NAME = "cli.cjs";
63361
63363
  OwnCliPathUnknownError = class extends CliError {
@@ -63743,7 +63745,7 @@ function buildEnv(params) {
63743
63745
  const parentCustomHeaders = params.baseEnv.ANTHROPIC_CUSTOM_HEADERS;
63744
63746
  let providerCustomHeaders;
63745
63747
  if (!params.configDirEscapeHatch && params.resolvedIdentityName !== void 0) {
63746
- env.CLAUDE_CONFIG_DIR = import_node_path40.default.join(params.identitiesDir, params.resolvedIdentityName);
63748
+ env.CLAUDE_CONFIG_DIR = import_node_path41.default.join(params.identitiesDir, params.resolvedIdentityName);
63747
63749
  }
63748
63750
  if (params.provider !== void 0) {
63749
63751
  const providerEnv = params.provider.definition.kind !== void 0 && params.provider.definition.kind !== "http" ? {} : params.provider.definition.env ?? {};
@@ -63788,11 +63790,11 @@ function buildEnv(params) {
63788
63790
  }
63789
63791
  return env;
63790
63792
  }
63791
- var import_node_path40, LOOPBACK_HOSTS, PROVIDER_SESSION_PLACEHOLDER;
63793
+ var import_node_path41, LOOPBACK_HOSTS, PROVIDER_SESSION_PLACEHOLDER;
63792
63794
  var init_flags = __esm({
63793
63795
  "src/launcher/flags.ts"() {
63794
63796
  "use strict";
63795
- import_node_path40 = __toESM(require("node:path"), 1);
63797
+ import_node_path41 = __toESM(require("node:path"), 1);
63796
63798
  init_envBool();
63797
63799
  init_cliError();
63798
63800
  init_conditions();
@@ -63880,7 +63882,7 @@ function newestTranscript(fs26, projectDir) {
63880
63882
  if (!name.endsWith(".jsonl")) {
63881
63883
  continue;
63882
63884
  }
63883
- const candidate = import_node_path41.default.join(projectDir, name);
63885
+ const candidate = import_node_path42.default.join(projectDir, name);
63884
63886
  const stat = fs26.lstat(candidate);
63885
63887
  if (stat?.kind === "file" && stat.mtimeMs > newestMs) {
63886
63888
  newestMs = stat.mtimeMs;
@@ -63890,24 +63892,24 @@ function newestTranscript(fs26, projectDir) {
63890
63892
  return newest;
63891
63893
  }
63892
63894
  function latestConversationId(fs26, params) {
63893
- const file2 = newestTranscript(fs26, import_node_path41.default.join(params.claudeHome, "projects", projectDirNameOf(params.cwd)));
63894
- return file2 === void 0 ? void 0 : import_node_path41.default.basename(file2, ".jsonl");
63895
+ const file2 = newestTranscript(fs26, import_node_path42.default.join(params.claudeHome, "projects", projectDirNameOf(params.cwd)));
63896
+ return file2 === void 0 ? void 0 : import_node_path42.default.basename(file2, ".jsonl");
63895
63897
  }
63896
63898
  function resumedContextTokens(fs26, params) {
63897
63899
  const target = resumeTargetOf(params.passthrough);
63898
63900
  if (target === void 0) {
63899
63901
  return void 0;
63900
63902
  }
63901
- const projectDir = import_node_path41.default.join(params.claudeHome, "projects", projectDirNameOf(params.cwd));
63902
- const file2 = target.kind === "id" ? import_node_path41.default.join(projectDir, `${target.id}.jsonl`) : newestTranscript(fs26, projectDir);
63903
+ const projectDir = import_node_path42.default.join(params.claudeHome, "projects", projectDirNameOf(params.cwd));
63904
+ const file2 = target.kind === "id" ? import_node_path42.default.join(projectDir, `${target.id}.jsonl`) : newestTranscript(fs26, projectDir);
63903
63905
  const text2 = file2 === void 0 ? void 0 : fs26.readFileUtf8(file2);
63904
63906
  return text2 === void 0 ? void 0 : contextTokensOfTranscript(text2);
63905
63907
  }
63906
- var import_node_path41;
63908
+ var import_node_path42;
63907
63909
  var init_resumeContext = __esm({
63908
63910
  "src/usage/resumeContext.ts"() {
63909
63911
  "use strict";
63910
- import_node_path41 = __toESM(require("node:path"), 1);
63912
+ import_node_path42 = __toESM(require("node:path"), 1);
63911
63913
  }
63912
63914
  });
63913
63915
 
@@ -63940,7 +63942,28 @@ function hasSettingsArgument(passthrough) {
63940
63942
  return (end === -1 ? passthrough : passthrough.slice(0, end)).some((token) => token === "--settings" || token.startsWith("--settings="));
63941
63943
  }
63942
63944
  function withSupervision(passthrough, supervised) {
63943
- return supervised.conversation === "as-given" ? passthrough : withConversation(passthrough, supervised.conversation, supervised.sessionId);
63945
+ if (supervised.conversation === "as-given") {
63946
+ return passthrough;
63947
+ }
63948
+ const conversed = withConversation(passthrough, supervised.conversation, supervised.sessionId);
63949
+ if (supervised.model === void 0) {
63950
+ return conversed;
63951
+ }
63952
+ const end = conversed.indexOf(TERMINATOR2);
63953
+ const head = end === -1 ? conversed : conversed.slice(0, end);
63954
+ const tail = end === -1 ? [] : conversed.slice(end);
63955
+ const kept = [];
63956
+ for (let index = 0; index < head.length; index += 1) {
63957
+ const token = head[index];
63958
+ if (token === "--model") {
63959
+ index += 1;
63960
+ continue;
63961
+ }
63962
+ if (token !== void 0 && !token.startsWith("--model=")) {
63963
+ kept.push(token);
63964
+ }
63965
+ }
63966
+ return [...kept, "--model", supervised.model, ...tail];
63944
63967
  }
63945
63968
  function withLauncherSettings(passthrough, settings2) {
63946
63969
  if (settings2 === void 0) {
@@ -65269,7 +65292,7 @@ var init_translate2 = __esm({
65269
65292
 
65270
65293
  // src/providerCatalogue.ts
65271
65294
  function catalogueCachePath(paths, name) {
65272
- return import_node_path42.default.join(paths.catalogueDir, `${name}.json`);
65295
+ return import_node_path43.default.join(paths.catalogueDir, `${name}.json`);
65273
65296
  }
65274
65297
  function parseCatalogueCache(text2) {
65275
65298
  if (text2 === void 0) {
@@ -65345,11 +65368,11 @@ async function fetchCatalogue(params) {
65345
65368
  }
65346
65369
  throw new CatalogueFetchError(`no catalogue from ${outcomes.join("; ")}`);
65347
65370
  }
65348
- var import_node_path42, import_picomatch3, DEFAULT_CANDIDATE_URLS, MS_PER_SECOND8, SECONDS_PER_HOUR3, HOURS_PER_DAY4, MS_PER_HOUR3, HOURS_BETWEEN_RETRIES, HTTP_OK, HTTP_MULTIPLE_CHOICES, CATALOGUE_MAX_AGE_MS, CATALOGUE_RETRY_MS, CATALOGUE_REQUEST_SECONDS, CATALOGUE_REQUEST_TIMEOUT_MS, CATALOGUE_REFRESH_TIMEOUT_MS, CatalogueModelSchema, CatalogueCacheSchema, CatalogueFetchError;
65371
+ var import_node_path43, import_picomatch3, DEFAULT_CANDIDATE_URLS, MS_PER_SECOND8, SECONDS_PER_HOUR3, HOURS_PER_DAY4, MS_PER_HOUR3, HOURS_BETWEEN_RETRIES, HTTP_OK, HTTP_MULTIPLE_CHOICES, CATALOGUE_MAX_AGE_MS, CATALOGUE_RETRY_MS, CATALOGUE_REQUEST_SECONDS, CATALOGUE_REQUEST_TIMEOUT_MS, CATALOGUE_REFRESH_TIMEOUT_MS, CatalogueModelSchema, CatalogueCacheSchema, CatalogueFetchError;
65349
65372
  var init_providerCatalogue = __esm({
65350
65373
  "src/providerCatalogue.ts"() {
65351
65374
  "use strict";
65352
- import_node_path42 = __toESM(require("node:path"), 1);
65375
+ import_node_path43 = __toESM(require("node:path"), 1);
65353
65376
  import_picomatch3 = __toESM(require_picomatch2(), 1);
65354
65377
  init_zod();
65355
65378
  DEFAULT_CANDIDATE_URLS = 2;
@@ -65941,7 +65964,7 @@ function decideLaunch(params, readOnly) {
65941
65964
  identityDefaultConfigProfile: loadedIdentity?.config.defaultConfigProfile,
65942
65965
  globalDefaultConfigProfile: params.globalDefaultConfigProfile
65943
65966
  });
65944
- if (configProfileDecision.name !== void 0 && params.allowMissingConfigProfile !== true && fs26.readConfigFile(import_node_path43.default.join(paths.configProfilesDir, `${configProfileDecision.name}.json`)) === void 0) {
65967
+ if (configProfileDecision.name !== void 0 && params.allowMissingConfigProfile !== true && fs26.readConfigFile(import_node_path44.default.join(paths.configProfilesDir, `${configProfileDecision.name}.json`)) === void 0) {
65945
65968
  log.error(
65946
65969
  `agent-shim: no configuration profile named "${configProfileDecision.name}" (selected via ${configProfileDecision.source}). Run \`agent-shim profile add ${configProfileDecision.name}\` first.`
65947
65970
  );
@@ -66059,7 +66082,7 @@ function decideLaunch(params, readOnly) {
66059
66082
  extraFlags: splitExtraFlags(env.CLAUDE_EXTRA_FLAGS),
66060
66083
  passthrough: withLauncherSettings(params.supervised === void 0 ? parsedArgv.rest : withSupervision(parsedArgv.rest, params.supervised), launcherSettings)
66061
66084
  });
66062
- const configDir = configDirEscapeHatchApplies || identityDecision.name === void 0 ? env.CLAUDE_CONFIG_DIR : import_node_path43.default.join(paths.identitiesDir, identityDecision.name);
66085
+ const configDir = configDirEscapeHatchApplies || identityDecision.name === void 0 ? env.CLAUDE_CONFIG_DIR : import_node_path44.default.join(paths.identitiesDir, identityDecision.name);
66063
66086
  const decision = {
66064
66087
  identitySource: identityDecision.source,
66065
66088
  configDirEscapeHatch: identityDecision.configDirEscapeHatch,
@@ -66110,7 +66133,7 @@ function prepareLaunch(params) {
66110
66133
  let warnings = [];
66111
66134
  const updateCheck = runLaunchUpdateCheck({
66112
66135
  mode: params.updateMode ?? "off",
66113
- checkPath: import_node_path43.default.join(paths.root, "update.check"),
66136
+ checkPath: import_node_path44.default.join(paths.root, "update.check"),
66114
66137
  currentVersion: package_default.version,
66115
66138
  port: params.update
66116
66139
  });
@@ -66252,12 +66275,12 @@ function runLaunchPlan(plan, spawn8) {
66252
66275
  function runLauncher(params) {
66253
66276
  params.proc.exit(runLaunchPlan(prepareLaunch(params), params.spawn));
66254
66277
  }
66255
- var import_node_crypto18, import_node_path43;
66278
+ var import_node_crypto18, import_node_path44;
66256
66279
  var init_launcher = __esm({
66257
66280
  "src/launcher.ts"() {
66258
66281
  "use strict";
66259
66282
  import_node_crypto18 = require("node:crypto");
66260
- import_node_path43 = __toESM(require("node:path"), 1);
66283
+ import_node_path44 = __toESM(require("node:path"), 1);
66261
66284
  init_package();
66262
66285
  init_envBool();
66263
66286
  init_argv();
@@ -66348,7 +66371,7 @@ function realPrepareLaunchParams(paths, options) {
66348
66371
  frontdoor: realFrontDoorPort(paths, options.spawnDaemon),
66349
66372
  credentials: { ...realCredentialPort, cache: realCredentialCacheEnv(paths) },
66350
66373
  hold: realHoldPort,
66351
- hasStoredLogin: (identity) => identitySignIn(realFarmFs, { platform: process.platform, run: realRunPort }, { farmRoot: import_node_path44.default.join(paths.identitiesDir, identity), hasCredentialBlock: false }).state !== "signed-out",
66374
+ hasStoredLogin: (identity) => identitySignIn(realFarmFs, { platform: process.platform, run: realRunPort }, { farmRoot: import_node_path45.default.join(paths.identitiesDir, identity), hasCredentialBlock: false }).state !== "signed-out",
66352
66375
  ...farm.directoryIdentity === void 0 ? {} : { directoryPinnedIdentity: farm.directoryIdentity },
66353
66376
  ...farm.directoryConfigProfile === void 0 ? {} : { directoryRuleConfigProfile: farm.directoryConfigProfile },
66354
66377
  ...farm.globalDefaultConfigProfile === void 0 ? {} : { globalDefaultConfigProfile: farm.globalDefaultConfigProfile },
@@ -66386,12 +66409,12 @@ function resolveClaudeLaunch(options) {
66386
66409
  };
66387
66410
  return { resolution: resolveLaunch(realPrepareLaunchParams(paths, { proc, log, spawnDaemon, farm: buildFarmRuntime(paths, options.cwd) })), warnings };
66388
66411
  }
66389
- var import_node_os9, import_node_path44, import_node_crypto19, LaunchRefusedError;
66412
+ var import_node_os9, import_node_path45, import_node_crypto19, LaunchRefusedError;
66390
66413
  var init_launchWiring = __esm({
66391
66414
  "src/launchWiring.ts"() {
66392
66415
  "use strict";
66393
66416
  import_node_os9 = __toESM(require("node:os"), 1);
66394
- import_node_path44 = __toESM(require("node:path"), 1);
66417
+ import_node_path45 = __toESM(require("node:path"), 1);
66395
66418
  import_node_crypto19 = require("node:crypto");
66396
66419
  init_cliError();
66397
66420
  init_claudeShim();
@@ -81043,7 +81066,7 @@ async function jGe(e14, t10, n10, r10) {
81043
81066
  if (d.length === 0) return [];
81044
81067
  return iv(Buffer.from(gZ(d)), { limit: r10.limit, offset: r10.offset }, l, c10);
81045
81068
  }
81046
- var import_node_module, import_crypto, import_crypto2, import_path, import_node_fs15, import_node_process4, import_fs, import_os, import_path2, yy, import_fs2, import_promises, import_path3, import_readline, import_promises2, import_path4, import_os2, import_path5, Se, import_promises3, xe, import_promises4, import_fs3, import_promises5, import_os3, import_path6, import_promises6, import_os4, import_node_path45, import_node_os10, import_node_process5, import_path7, import_events, import_fs4, import_promises7, import_path8, import_child_process, import_util9, import_child_process2, import_fs5, import_path9, import_path10, import_crypto3, import_fs6, import_path11, import_promises8, import_path12, import_path13, import_promises9, import_path14, import_path15, import_fs7, import_promises10, import_path16, import_crypto4, import_path17, import_async_hooks, import_fs8, import_promises11, import_crypto5, import_fs9, import_promises12, import_path18, import_promises13, import_path19, import_crypto6, import_path20, import_path21, import_path22, import_path23, import_promises14, import_fs10, import_promises15, import_path24, import_util10, import_path25, import_os5, import_path26, import_path27, import_path28, import_path29, import_path30, import_net, import_os6, import_child_process3, import_fs11, import_child_process4, import_crypto7, import_promises16, import_module, import_os7, import_path31, import_url, import_events2, import_child_process5, import_fs12, import_readline2, import_string_decoder, import_fs13, import_promises17, import_os8, import_path32, import_crypto8, import_os9, import_fs14, import_path33, import_crypto9, import_fs15, import_promises18, import_path34, IZ, DZ, v_, LZ, OT, NZ, UZ, kT, X, FZ, dr, HZ, jZ, BZ, ot, st, ed, Kv, Te, Me, Oo, nd, hF, Xv, Qv, rd, LF, or, WF, ZF, sA, XF, od, sd, hg, id, Sg, Oz, fA, $z, Wz, Zz, s$, a$, d$, f$, g$, _$, E$, v$, T$, O$, I$, L$, wg, z$, j$, G$, V$, yA, SA, rH, lH, uH, _H, EH, EA, RH, TH, kH, DH, NH, zH, jH, GH, VH, ZH, JH, ej, nj, ij, cj, uj, CA, bj, Aj, wj, PT, KZ, GZ, VGe, VZ, MT, wr, jo, JZ, XZ, NT, UT, FT, zT, Bo, $T, HT, jT, BT, a4, sp, l4, c4, vt, u4, Nt, KT, d4, p4, uc, GT, m4, g4, WT, _4, y4, VT, Dn, Et, b4, C4, v4, A4, ra, x4, ip, qT, ZT, w4, O4, ro, P4, I4, D4, L4, M4, N4, U4, YT, JT, Sn, H4, Ko, j4, oo, XT, QT, G4, W4, V4, ew, Z4, Y4, tw, X4, nw, R_, rw, ow, Go, sw, iw, aw, lw, ei, aY, cw, Or, cY, uw, dw, lp, pw, cp, mY, gY, up, _Y, aa, fw, la, EY, bY, CY, vY, AY, RY, xY, TY, wY, OY, kY, PY, IY, mw, x_, gw, ca, MY, et, dp, hw, pp, zY, $Y, _w, HY, ua, yw, wt, KY, T_, Sw, WY, VY, qY, so, mp, Ew, vw, bw, YY, Cw, JY, XY, kr, QY, e9, Wo, n9, da, o9, s9, i9, a9, l9, c9, u9, d9, p9, f9, m9, g9, h9, _9, y9, S9, E9, b9, C9, v9, A9, R9, x9, T9, Qe, Aw, pa, hp, Rw, dc, k9, w_, P9, Pr, xw, I9, fa, D9, L9, _p, N9, ma, yp, z9, Tw, $9, H9, ww, Vo, Ir, pc, W9, V9, q9, Ow, Y9, Sp, J9, Ep, X9, qo, Q9, bp, kw, eJ, Pw, Iw, Dw, Lw, tJ, nJ, rJ, oJ, sJ, ti, io, iJ, Mw, Nw, Cp, aJ, Uw, Fw, ga, pr, uJ, Fe, $w, O_, k_, I_, ha, Bw, D_, qw, Vw, N_, U_, yJ, _a3, Yo, Zw, bJ, Rp, Yw, vJ, AJ, Jw, xp, Xw, Tp, Qw, kJ, ya, IJ, DJ, Sa, MJ, fc, NJ, eO, FJ, zJ, $J, tO, Ea, jJ, nO, rO, sO, iO, Vn, GJ, Ln, Jo, aO, lO, cO, wp, XJ, QJ, uO, ba, dO, pO, fO, Dr, ao, mO, Ca, gO, z_, $_, H_, j_, B_, K_, G_, W_, V_, q_, Z_, _O, Y_, J_, yO, X_, c3, Q_, ey, ty, ny, ry, oy, sy, iy, ay, ly, cy, we, SO, en, d3, Pp, vO, g3, gy, wO, S3, BO, KO, Ip, Dp, v3, GO, WO, F9e, IO, A3, hy, x3, NO, I3, Ay, Ry, D3, xy, L3, bc, xa, Ty, wy, Oy, ky, XO, Py, Iy, Dy, Ly, My, Ny, Uy, Fy, zy, nk, rk, d3e, p3e, f3e, m3e, g3e, U3, jp, jy, ik, By, Ky, lk, $3, uk, ck, G3, W3, V3, it, Y3, J3, hk, tXe, Q3, kt, We, gX, Ta, SX, mr, Yp, Jp, eS, nS, yXe, IX, DX, rS, ka, oS, Ok, kk, HX, jX, ef, bXe, Uk, Mr, wc, Fk, Pa, OXe, kXe, iS, PXe, IXe, DXe, GX, YX, JX, XX, QX, e6, t6, Yk, n6, r6, o6, s6, i6, a6, l6, c6, Vk, uS, lf, dS, Qk, eP, uf, os10, qXe, ZXe, h6, tP, df, _6, y6, S6, E6, b6, Jn, gr, nP, rP, Dc, pS, oP, gS, lP, C6, mS, lS, sP, w6, O6, dP, k6, YXe, JXe, P6, I6, pf, L6, fP, XXe, QXe, M6, SS, z6, $6, j6, bP, CP, G6, Lc, si, Z6, ES, bS, X6, Q6, e5, t5, n5, u5, r5, o5, s5, i5, a5, l5, c5, u52, d5, p5, f5, m5, g5, h5, _5, y5, S5, E5, b5, C5, v5, A5, R5, x5, T5, w5, O5, k5, P5, I5, D5, L5, M5, N5, U5, F5, z5, $5, H5, j5, B5, K5, G5, W5, V5, q5, Z5, Y5, J5, X5, Q5, e8, t8, n8, r8, o8, s8, i8, a8, l8, c8, u8, d8, CS, p8, f8, m8, g8, h8, _8, y8, S8, E8, b8, C8, v8, A8, R8, x8, T8, w8, O8, k8, P8, I8, D8, L8, M8, N8, U8, F8, z8, $8, H8, j8, B8, K8, G8, W8, V8, q8, Z8, Y8, J8, X8, Q8, e7, t7, n7, r7, o7, s7, i7, a7, l7, c7, u7, d7, p7, f7, m7, g7, h7, _7, y7, S7, E7, b7, C7, TP, v7, L6e, RP, A7, x7, kP, ff, U6e, F6e, Ua, z6e, $6e, H6e, j6e, PP, IP, vS, DP, w7, LP, O7, k7, P7, AS, RS, xS, I7, MP, NP, D7, G6e, L7, W6e, M7, N7, UP, V6e, U7, F7, z7, $7, H7, j7, B7, q6e, is, wS, Fa, K7, G7, W7, i5e, X7, Q7, HP, $P, BP, tQ, WP, VP, JP, _Q, QP, eI, xQ, Uc, DS, $a, wQ, OQ, kQ, PQ, IQ, DQ, LQ, MQ, NQ, UQ, FQ, zQ, $Q, HQ, jQ, BQ, KQ, GQ, WQ, VQ, qQ, ZQ, YQ, JQ, XQ, QQ, eee, tee, nee, ree, oee, see, iee, aee, lee, cee, uee, dee, pee, fee, mee, gee, hee, _ee, yee, See, Eee, bee, Cee, vee, Aee, Ree, xee, Tee, wee, Oee, kee, Pee, Iee, Dee, Lee, Mee, Nee, Uee, Fee, zee, $ee, Hee, jee, Bee, Kee, Gee, Wee, Vee, qee, Zee, Yee, Jee, Xee, Qee, ete, tte, nte, rte, ote, ste, ite, ate, lte, cte, ute, dte, pte, fte, mte, gte, hte, _te, yte, Ste, Ete, bte, Cte, vte, Ate, Rte, xte, Tte, wte, Ote, kte, Pte, Ite, Dte, Lte, Mte, Nte, Ute, Fte, zte, $te, Hte, jte, Bte, Kte, Gte, Wte, Vte, qte, Zte, Yte, Jte, Xte, Qte, ene, tne, nne, rne, one, sne, ine, ane, lne, cne, une, dne, pne, fne, mne, gne, hne, _ne, yne, Sne, Ene, bne, Cne, vne, Ane, Rne, xne, Tne, wne, One, kne, Pne, Ine, Dne, Lne, Mne, Nne, Une, Fne, zne, $ne, Hne, jne, Bne, Kne, Gne, Wne, Vne, qne, Zne, Yne, Jne, Xne, Qne, ere, tre, nre, rre, ore, sre, ire, are, lre, cre, ure, dre, pre, fre, mre, gre, hre, _re, yre, Sre, Ere, bre, Cre, vre, Are, Rre, xre, Tre, wre, Ore, kre, Pre, Ire, Dre, Lre, Mre, Nre, Ure, Fre, zre, $re, Hre, jre, Bre, Kre, Gre, Wre, Vre, qre, Zre, Yre, Jre, Xre, Qre, eoe, toe, noe, roe, ooe, soe, ioe, aoe, loe, coe, uoe, doe, poe, foe, moe, goe, hoe, _oe, yoe, Soe, Eoe, boe, Coe, voe, Aoe, Roe, xoe, Toe, woe, Ooe, koe, Poe, Ioe, Doe, Loe, Moe, Noe, Uoe, Foe, zoe, $oe, Hoe, joe, Boe, Koe, Goe, Woe, Voe, qoe, Zoe, Yoe, Joe, Xoe, Qoe, ese, tse, nse, rse, ose, sse, ise, ase, lse, cse, use, dse, pse, fse, mse, gse, hse, _se, yse, Sse, Ese, LS, bse, Cse, vse, Ase, Rse, xse, Tse, wse, Ose, kse, Pse, Ise, Dse, Lse, Mse, Nse, Use, Fse, zse, $se, Hse, jse, Bse, Kse, Gse, Wse, Vse, qse, Zse, Yse, Jse, Xse, Qse, eie, tie, nie, rie, oie, sie, iie, aie, lie, cie, uie, die, pie, fie, mie, gie, hie, _ie, yie, Sie, Eie, bie, Cie, vie, Aie, Rie, xie, Tie, wie, Oie, kie, Pie, Iie, Die, Lie, Mie, Nie, Uie, Fie, zie, $ie, Hie, jie, Bie, Kie, Gie, Wie, Vie, qie, Zie, Yie, Jie, Xie, Qie, eae, tae, nae, rae, oae, sae, iae, aae, lae, cae, uae, dae, pae, fae, mae, gae, hae, _ae, yae, Sae, Eae, bae, Cae, vae, Aae, Rae, xae, Tae, wae, Oae, kae, Pae, Iae, Dae, Lae, Mae, Nae, Uae, Fae, zae, $ae, Hae, jae, Bae, Kae, Gae, Wae, Vae, qae, Zae, Yae, Jae, Xae, Qae, ele, tle, nle, rle, ole, sle, ile, ale, lle, cle, ule, dle, ple, fle, mle, gle, hle, _le, yle, Sle, Ele, ble, Cle, vle, Ale, Rle, xle, Tle, wle, Ole, kle, Ple, Ile, Dle, Lle, Mle, Nle, Ule, Fle, zle, $le, Hle, jle, Ble, Kle, Gle, Wle, Vle, qle, Zle, Yle, Jle, MS, Xle, Qle, ece, tce, nce, rce, oce, sce, ice, ace, lce, cce, uce, dce, pce, fce, mce, gce, hce, _ce, yce, Sce, Ece, bce, Cce, vce, Ace, Rce, xce, Tce, wce, Oce, kce, Pce, Ice, Dce, Lce, Mce, Nce, Uce, Fce, zce, $ce, Hce, jce, Bce, Kce, Gce, Wce, Vce, qce, Zce, Yce, Jce, Xce, Qce, eue, tue, nue, rue, oue, sue, iue, aue, lue, cue, uue, due, pue, fue, mue, gue, hue, _ue, yue, Sue, Eue, bue, Cue, vue, Aue, Rue, xue, Tue, wue, Oue, kue, Pue, Iue, Due, Lue, Mue, Nue, Uue, Fue, zue, $ue, Hue, jue, Bue, Kue, Gue, Wue, Vue, que, Zue, Yue, Jue, Xue, Que, ede, tde, nde, rde, ode, sde, ide, ade, lde, cde, ude, dde, pde, fde, mde, gde, hde, _de, yde, Sde, Ede, bde, Cde, vde, Ade, Rde, xde, Tde, wde, Ode, kde, Pde, Ide, Dde, Lde, Mde, Nde, Ude, Fde, zde, $de, Hde, jde, Bde, Kde, Gde, Wde, Vde, qde, Zde, Yde, Jde, Xde, Qde, epe, tpe, npe, rpe, ope, spe, ipe, ape, lpe, cpe, upe, dpe, ppe, fpe, mpe, gpe, hpe, _pe, ype, Spe, Epe, bpe, Cpe, vpe, Ape, Rpe, xpe, Tpe, wpe, Ope, kpe, Ppe, Ipe, Dpe, Lpe, Mpe, Npe, Upe, Fpe, zpe, $pe, Hpe, jpe, Bpe, Kpe, Gpe, Wpe, Vpe, qpe, Zpe, Ype, Jpe, Xpe, Qpe, efe, tfe, nfe, rfe, ofe, sfe, ife, afe, lfe, cfe, ufe, dfe, pfe, ffe, mfe, gfe, hfe, _fe, yfe, Sfe, Efe, bfe, Cfe, vfe, Afe, Rfe, xfe, Tfe, wfe, Ofe, kfe, Pfe, Ife, Dfe, Lfe, Mfe, Nfe, Ufe, Ffe, zfe, $fe, Hfe, jfe, Bfe, Kfe, Gfe, Wfe, Vfe, qfe, Zfe, Yfe, Jfe, Xfe, Qfe, eme, tme, nme, rme, ome, sme, ime, ame, lme, cme, ume, dme, pme, fme, mme, gme, hme, _me, yme, Sme, Eme, bme, Cme, vme, Ame, Rme, xme, Tme, wme, Ome, kme, Pme, Ime, Dme, Lme, Mme, Nme, Ume, Fme, zme, $me, Hme, jme, Bme, Kme, Gme, Wme, Vme, qme, Zme, Yme, Jme, NS, Xme, Qme, ege, tge, nge, rge, oge, sge, ige, age, lge, cge, uge, dge, pge, fge, mge, gge, hge, _ge, yge, Sge, Ege, bge, Cge, vge, Age, Rge, xge, Tge, wge, Oge, kge, Pge, Ige, Dge, Lge, Mge, Nge, Uge, Fge, zge, $ge, Hge, US, jge, Bge, Kge, Gge, Wge, Vge, qge, Zge, Yge, Jge, Xge, Qge, ehe, the, nhe, rhe, ohe, she, ihe, ahe, lhe, che, uhe, dhe, phe, fhe, mhe, ghe, hhe, _he, yhe, She, Ehe, bhe, Che, vhe, Ahe, Rhe, xhe, The, whe, Ohe, khe, Phe, Ihe, Dhe, Lhe, Mhe, Nhe, FS, rI, oI, Uhe, Fhe, zhe, $he, Hhe, jhe, Bhe, Khe, Ghe, Whe, Vhe, qhe, Zhe, Yhe, Jhe, Xhe, Qhe, e_e, t_e, n_e, r_e, o_e, s_e, i_e, a_e, l_e, c_e, u_e, d_e, p_e, f_e, m_e, g_e, h_e, __e, y_e, S_e, E_e, b_e, C_e, v_e, A_e, R_e, x_e, T_e, w_e, O_e, k_e, P_e, I_e, D_e, L_e, M_e, N_e, U_e, F_e, z_e, $_e, H_e, j_e, B_e, K_e, G_e, W_e, V_e, q_e, Z_e, Y_e, J_e, Q_e, Xn, eye, F8e, tye, z8e, nye, iI, rye, oye, lI, cye, uye, dye, _ye, on, vye, Aye, dI, C7e, v7e, ho, kI, PI, Dye, Sf, Lye, jc, Mye, Nye, LI, NI, Fye, VS, zye, $ye, x7e, zI, YS, KI, GI, VI, Hye, qS, ls, Kye, Gye, oD, nE, sD, So, Yc, vn, Zye, oE, sE, iD, aD, wf, Jc, Xc, kf, Qc, Pf, eu, fi, tu, mi, lD, cD, uD, dD, pD, fD, mD, gD, hD, _D, yD, SD, ED, bD, vD, AD, cE, RD, Xye, TD, wD, OD, kD, PD, uE, ID, DD, LD, MD, FD, If, nu, zD, $D, HD, jD, BD, zt, dE, Df, pE, fE, KD, GD, WD, VD, qD, ru, ZD, YD, JD, XD, QD, eL, tL, mE, yr, He, rL, ou, Je, yE, SE, EE, fL, mL, tSe, bE, CE, vE, AE, RE, xE, TE, wE, gL, hL, _L, yL, OE, sSe, kE, PE, IE, DE, LE, ME, NE, Nf, UE, FE, zE, $E, HE, jE, BE, cSe, gE, KE, vL, Uf, GE, WE, VE, qE, ZE, YE, Ff, JE, XE, QE, eb, tb, nb, zf, AL, rb, ob, sb, TL, ab, RL, xL, $f, Hf, dSe, fSe, OL, kL, Sr, FL, ML, zL, lu, hSe, iC, aC, lC, HL, jL, cC, uC, BL, dC, KL, pC, GL, fC, mC, WL, VL, qL, ZL, gC, YL, hC, JL, XL, _C, yC, SC, EC, QL, sC, bC, CC, vC, AC, RC, xC, TC, wC, OC, tM, qf, kC, $L, rM, ASe, Fn, oM, sM, iM, aM, lM, cM, uM, dM, pM, fM, mM, gM, Be, SM, LC, ct, MC, EM, bM, CM, pEe, fEe, Yf, mEe, gEe, hEe, _Ee, yEe, SEe, EEe, bEe, CEe, vEe, AEe, REe, xEe, TEe, wEe, OEe, NC, kEe, vM, PEe, IEe, DEe, LEe, MEe, fu, AM, NEe, UEe, IC, DC, FEe, zEe, qa, TM, HEe, jEe, KEe, wM, em, mu, qEe, ZEe, JEe, OM, Qn, kM, LM, nbe, rbe, abe, lbe, cbe, rm, pbe, At, hbe, BC, BM, Zet, WM, VM, qM, ZM, Cbe, vbe, YM, Abe, Rbe, JM, xbe, Tbe, QM, Ibe, eN, Lbe, nN, Mbe, Nbe, sm, rN, iN, Fbe, aN, $be, jbe, Kbe, Gbe, yu, lN, uN, dN, Xbe, KM, Qbe, eCe, tCe, oCe, iCe, _N, yN, wN, Ytt, ON, OCe, DCe, LN, $Ce, HCe, Cu, BCe, MN, VCe, QCe, ive, uve, VN, pve, fve, _rt, gve, Sve, nv, tv, GN, tU, Fve, Hve, iU, tAe, sAe, iAe, aAe, cAe, Ie, bU, Q, vo, F, zn, fAe, ms, mAe, _m, nn, he, Xa, an, lv, cv, Si, wu, se, br, CU, Oe, gAe, hAe, _Ae, yAe, SAe, EAe, bAe, CAe, vAe, uv, AAe, RAe, xAe, TAe, wAe, OAe, vU, kAe, Ro, el, tl, ym, ku, Sm, Pu, Iu, Em, Ei, xo, bm, Fr, ft, Du, Ao, pv, Lu, To, Cm, vm, nl, Ou, Mu, Nu, bi, Uu, rl, $r, zr, gs, Fu, zu, Am, fv, Rm, $u, wot, H, Oot, kot, Pot, Iot, Dot, Lot, Mot, Not, Uot, Fot, zot, $ot, Hot, jot, xU, Bot, Kot, Got, Wot, Vot, qot, Zot, Yot, Jot, Xot, Qot, est, tst, nst, rst, ost, sst, ist, ast, FAe, zAe, gv, OU, Ss, km, Mt, kU, PU, kst, HAe, jAe, hv, $n, Hu, IU, Yt, tr, nr, Jt, Pm, DU, _v, LU, MU, yv, ju, le, Sv, NU, Pst, Ist, Im, BAe, Dm, KAe, Bu, ol, UU, GAe, WAe, VAe, qAe, ZAe, YAe, Ev, JAe, XAe, bv, Lm, QAe, eRe, Mm, tRe, Ku, Gu, nRe, Wu, sl, rRe, Vu, Nm, Um, Fm, Dst, zm, $m, Hm, FU, zU, $U, Cv, HU, qu, il, jU, oRe, jm, sRe, Bm, iRe, vv, aRe, Km, lRe, cRe, uRe, dRe, pRe, fRe, mRe, gRe, hRe, _Re, Gm, yRe, SRe, Wm, Av, Rv, xv, ERe, bRe, CRe, Tv, vRe, ARe, RRe, xRe, TRe, BU, Vm, wRe, qm, Lst, ORe, al, kRe, Mst, Zu, PRe, wv, IRe, DRe, LRe, MRe, NRe, URe, FRe, Om, zRe, $Re, HRe, Yu, Ov, jRe, BRe, KRe, GRe, WRe, VRe, qRe, ZRe, YRe, JRe, XRe, QRe, exe, txe, nxe, rxe, oxe, sxe, ll, ixe, axe, lxe, Zm, cxe, uxe, dxe, kv, pxe, Nst, Ust, Fst, zst, $st, Hst, ae, WU, qU, VU, ZU, YU, Ym, e0, fxe, mxe, Dv, Cr, gxe, Ju, d0, h0, _0, v0, A0, Sxe, Exe, Mv, Cxe, Fv, Oj, kj, PA, IA, DA, Lj, Dj, aLe, NA, FA, uLe, dd, fLe, Po, SLe, ELe, zA, bLe, xLe, TLe, wLe, OLe, kLe, $j, qj, ILe, DLe, LLe, MLe, Ce, NLe, Wg, Oi, VA, Do, Jj, Xj, Qj, eB, tB, nB, qA, ZA, jA, Bj, jLe, BLe, GLe, rB, BA, Gg, GA, WA, VLe, qLe, Kj, Hs, sB, QLe, YA, iB, uB, eMe, dB, pB, fB, mB, tMe, XA, aB, QA, gB, hB, _B, yB, jn, lMe, SB, dMe, bB, mMe, fd, RB, hMe, Rr, TB, SMe, EMe, Pl, wB, Vg, AMe, Il, RMe, xMe, qg, OB, wMe, OMe, kB, eo, Dl, Zg, DB, NMe, FB, WMe, VMe, $B, HB, jB, BB, Ml, GB, nR, WB, Jg, KB, eNe, Bs, VB, gd, Nl, Xg, tNe, YB, qB, Pi, rK, iK, pNe, hd, _d, to, yd, nh, uK, aK, _Ne, lK, cK, Sd, Ul, rh, oh, dK, CNe, pK, sh, fK, RNe, xNe, TNe, mK, wNe, ONe, ih, Ed, lr, gK, hK, yK, SK, EK, ah, bK, FNe, CK, zNe, $Ne, HNe, vK, BNe, lh, AK, RK, xK, VNe, dn, TK, wK, OK, kK, PK, QNe, eUe, IK, DK, rUe, LK, MK, NK, UK, iUe, aUe, lUe, cUe, uUe, dUe, pUe, fUe, mUe, gUe, hUe, _Ue, yUe, SUe, EUe, bUe, CUe, vUe, AUe, FK, xUe, zK, $K, wUe, HK, OUe, jK, BK, PUe, KK, IUe, DUe, LUe, GK, MUe, NUe, UUe, FUe, WK, zUe, $Ue, HUe, VK, jUe, BUe, KUe, GUe, WUe, VUe, qUe, ZUe, YUe, JUe, XUe, QUe, e0e, t0e, n0e, r0e, Xe, qK, ZK, YK, JK, a0e, l0e, uh, XK, QK, e1, n1, r1, dh, m0e, g0e, h0e, _0e, bd, o1, S0e, Fl, s1, b0e, i1, Di, a1, l1, c1, u1, d1, p1, f1, P0e, I0e, m1, D0e, g1, h1, _1, vyt, U0e, y1, Ayt, iR, F0e, z0e, $0e, Gs, zl, fh, E1, b1, H0e, j0e, B0e, K0e, mh, $l, gh, Ws, aR, hh, _h, G0e, W0e, lR, R1, x1, V0e, uR, k1, P1, I1, D1, L1, Y0e, dR, J0e, Fyt, pR, X0e, fR, mR, Q0e, zyt, eFe, gR, hR, _R, $yt, M1, yR, N1, U1, tFe, nFe, rFe, oFe, iFe, Mi, cFe, $1, Wyt, Vyt, H1, j1, B1, K1, uFe, G1, W1, V1, q1, dFe, pFe, SR, fFe, eSt, tSt, mFe, jl, Vs, gFe, Y1, hFe, _Fe, X1, Q1, eG, yFe, SFe, tG, EFe, bFe, CFe, vFe, bR, CR, RFe, xFe, vR, TFe, Eh, nSt, Cd, wFe, OFe, aSt, rG, PFe, IFe, _St, oG, sG, bSt, CSt, HFe, jFe, $St, BFe, KFe, HSt, JSt, XSt, lG, OR, VFe, YFe, uG, eze, nze, gG, vd, vh, kR, zi, sze, yG, ize, yEt, Ad, $i, bG, Kn, AEt, REt, xEt, aze, AG, wG, $R, dze, $G, pze, fze, mze, gze, hze, BR, HG, jG, fbt, yze, Sze, Eze, Gn, ji, kG, PG, NR, UR, KR, GG, Cze, vze, Rze, GR, xze, Tze, xh, WR, Oze, kze, mbt, Pze, Ize, Dze, Lze, Mze, Nze, qG, Uze, Fze, zze, $ze, ZG, Hze, IG, jze, Bze, YG, Kze, Gze, DG, Wze, Vze, JG, qze, Zze, Yze, Jze, QG, Xze, Qze, e$e, t$e, r$e, o$e, s$e, i$e, a$e, eW, nW, c$e, m$e, xd, VR, gbt, hbt, _bt, h$e, qR, Th, MR, aW, _$e, S$e, lW, E$e, b$e, C$e, v$e, A$e, x$e, w$e, O$e, k$e, P$e, I$e, N$e, ybt, FR, Sbt, U$e, MG, Td, Ebt, bbt, uW, z$e, $$e, H$e, Cbt, j$e, B$e, vbt, Abt, K$e, Rbt, Oh, kh, G$e, YR, Ph, W$e, Ih, Mbt, Nbt, Ubt, Dh, V$e, Z$e, tx, EW, Id, Fh, X$e, xCt, Q$e, eHe, ix, ax, lx, cx, zh, $h, MW, tHe, nHe, aHe, uHe, dHe, Zs, pHe, CW, vW, AW, Nh, UW, fHe, mHe, gHe, hHe, _He, yHe, SHe, EHe, pn, dx, nx, Mh, Bi, AHe, TCt, xHe, Pd, RW, THe, xW, wHe, OHe, Hh, kHe, TW, fx, Bh, Ki, KW, Gl, PHe, Kh, kW, Wl, NHe, Ld, UHe, tV, rV, jHe, XHe, cvt, tje, fV, mV, sje, aje, _V, yV, pje, zvt, $vt, gje, yje, Sje, Kvt, Gvt, eAt, RV, Eje, bje, mAt, Cje, gAt, xV, wV, OV, Js, Lje, FV, Yh, Jh, Md, Tx, zV, $V, HV, Xh, jV, cr, KV, Mo, Fje, zje, yRt, jje, Gje, Vje, sBe, YV, e22, o_, gBe, t2, s_, kx, o2, LBe, UBe, $x, Vi, R2, KBe, GBe, Dx, ZBe, k2, n_, l2, sKe, lKe, z2, bKe, RKe, ec, W2, H2, xKe, wKe, PKe, IKe, $Ke, X2, HKe, jKe, BKe, KKe, VKe, eTt, qKe, tTt, nTt, ZKe, rTt, YKe, oTt, JKe, Wx, XKe, iTt, eq, tq, QKe, nq, rq, e1e, t1e, oq, sq, n1e, r1e, aTt, lTt, c1e, Zx, cq, u1e, uq, a_, d1e, Xx, nc, S1e, c_, mq, gq, Qx, hq, _q, E1e, Sq, u_, rc, d_, b1e, bq, Uo, Cq, vq, A1e, Yd, Jd, R1e, x1e, Aq, gn, T1e, w1e, O1e, Xs, k1e, P1e, xq, Pwt, I1e, Oq, kq, Pq, D1e, L1e, Iq, M1e, N1e, nT, U1e, p_, rT, Dq, oT, iT, F1e, Uq, aT, jq, K1e, Gq, yOt, sGe, cGe, uGe, yGe;
81069
+ var import_node_module, import_crypto, import_crypto2, import_path, import_node_fs15, import_node_process4, import_fs, import_os, import_path2, yy, import_fs2, import_promises, import_path3, import_readline, import_promises2, import_path4, import_os2, import_path5, Se, import_promises3, xe, import_promises4, import_fs3, import_promises5, import_os3, import_path6, import_promises6, import_os4, import_node_path46, import_node_os10, import_node_process5, import_path7, import_events, import_fs4, import_promises7, import_path8, import_child_process, import_util9, import_child_process2, import_fs5, import_path9, import_path10, import_crypto3, import_fs6, import_path11, import_promises8, import_path12, import_path13, import_promises9, import_path14, import_path15, import_fs7, import_promises10, import_path16, import_crypto4, import_path17, import_async_hooks, import_fs8, import_promises11, import_crypto5, import_fs9, import_promises12, import_path18, import_promises13, import_path19, import_crypto6, import_path20, import_path21, import_path22, import_path23, import_promises14, import_fs10, import_promises15, import_path24, import_util10, import_path25, import_os5, import_path26, import_path27, import_path28, import_path29, import_path30, import_net, import_os6, import_child_process3, import_fs11, import_child_process4, import_crypto7, import_promises16, import_module, import_os7, import_path31, import_url, import_events2, import_child_process5, import_fs12, import_readline2, import_string_decoder, import_fs13, import_promises17, import_os8, import_path32, import_crypto8, import_os9, import_fs14, import_path33, import_crypto9, import_fs15, import_promises18, import_path34, IZ, DZ, v_, LZ, OT, NZ, UZ, kT, X, FZ, dr, HZ, jZ, BZ, ot, st, ed, Kv, Te, Me, Oo, nd, hF, Xv, Qv, rd, LF, or, WF, ZF, sA, XF, od, sd, hg, id, Sg, Oz, fA, $z, Wz, Zz, s$, a$, d$, f$, g$, _$, E$, v$, T$, O$, I$, L$, wg, z$, j$, G$, V$, yA, SA, rH, lH, uH, _H, EH, EA, RH, TH, kH, DH, NH, zH, jH, GH, VH, ZH, JH, ej, nj, ij, cj, uj, CA, bj, Aj, wj, PT, KZ, GZ, VGe, VZ, MT, wr, jo, JZ, XZ, NT, UT, FT, zT, Bo, $T, HT, jT, BT, a4, sp, l4, c4, vt, u4, Nt, KT, d4, p4, uc, GT, m4, g4, WT, _4, y4, VT, Dn, Et, b4, C4, v4, A4, ra, x4, ip, qT, ZT, w4, O4, ro, P4, I4, D4, L4, M4, N4, U4, YT, JT, Sn, H4, Ko, j4, oo, XT, QT, G4, W4, V4, ew, Z4, Y4, tw, X4, nw, R_, rw, ow, Go, sw, iw, aw, lw, ei, aY, cw, Or, cY, uw, dw, lp, pw, cp, mY, gY, up, _Y, aa, fw, la, EY, bY, CY, vY, AY, RY, xY, TY, wY, OY, kY, PY, IY, mw, x_, gw, ca, MY, et, dp, hw, pp, zY, $Y, _w, HY, ua, yw, wt, KY, T_, Sw, WY, VY, qY, so, mp, Ew, vw, bw, YY, Cw, JY, XY, kr, QY, e9, Wo, n9, da, o9, s9, i9, a9, l9, c9, u9, d9, p9, f9, m9, g9, h9, _9, y9, S9, E9, b9, C9, v9, A9, R9, x9, T9, Qe, Aw, pa, hp, Rw, dc, k9, w_, P9, Pr, xw, I9, fa, D9, L9, _p, N9, ma, yp, z9, Tw, $9, H9, ww, Vo, Ir, pc, W9, V9, q9, Ow, Y9, Sp, J9, Ep, X9, qo, Q9, bp, kw, eJ, Pw, Iw, Dw, Lw, tJ, nJ, rJ, oJ, sJ, ti, io, iJ, Mw, Nw, Cp, aJ, Uw, Fw, ga, pr, uJ, Fe, $w, O_, k_, I_, ha, Bw, D_, qw, Vw, N_, U_, yJ, _a3, Yo, Zw, bJ, Rp, Yw, vJ, AJ, Jw, xp, Xw, Tp, Qw, kJ, ya, IJ, DJ, Sa, MJ, fc, NJ, eO, FJ, zJ, $J, tO, Ea, jJ, nO, rO, sO, iO, Vn, GJ, Ln, Jo, aO, lO, cO, wp, XJ, QJ, uO, ba, dO, pO, fO, Dr, ao, mO, Ca, gO, z_, $_, H_, j_, B_, K_, G_, W_, V_, q_, Z_, _O, Y_, J_, yO, X_, c3, Q_, ey, ty, ny, ry, oy, sy, iy, ay, ly, cy, we, SO, en, d3, Pp, vO, g3, gy, wO, S3, BO, KO, Ip, Dp, v3, GO, WO, F9e, IO, A3, hy, x3, NO, I3, Ay, Ry, D3, xy, L3, bc, xa, Ty, wy, Oy, ky, XO, Py, Iy, Dy, Ly, My, Ny, Uy, Fy, zy, nk, rk, d3e, p3e, f3e, m3e, g3e, U3, jp, jy, ik, By, Ky, lk, $3, uk, ck, G3, W3, V3, it, Y3, J3, hk, tXe, Q3, kt, We, gX, Ta, SX, mr, Yp, Jp, eS, nS, yXe, IX, DX, rS, ka, oS, Ok, kk, HX, jX, ef, bXe, Uk, Mr, wc, Fk, Pa, OXe, kXe, iS, PXe, IXe, DXe, GX, YX, JX, XX, QX, e6, t6, Yk, n6, r6, o6, s6, i6, a6, l6, c6, Vk, uS, lf, dS, Qk, eP, uf, os10, qXe, ZXe, h6, tP, df, _6, y6, S6, E6, b6, Jn, gr, nP, rP, Dc, pS, oP, gS, lP, C6, mS, lS, sP, w6, O6, dP, k6, YXe, JXe, P6, I6, pf, L6, fP, XXe, QXe, M6, SS, z6, $6, j6, bP, CP, G6, Lc, si, Z6, ES, bS, X6, Q6, e5, t5, n5, u5, r5, o5, s5, i5, a5, l5, c5, u52, d5, p5, f5, m5, g5, h5, _5, y5, S5, E5, b5, C5, v5, A5, R5, x5, T5, w5, O5, k5, P5, I5, D5, L5, M5, N5, U5, F5, z5, $5, H5, j5, B5, K5, G5, W5, V5, q5, Z5, Y5, J5, X5, Q5, e8, t8, n8, r8, o8, s8, i8, a8, l8, c8, u8, d8, CS, p8, f8, m8, g8, h8, _8, y8, S8, E8, b8, C8, v8, A8, R8, x8, T8, w8, O8, k8, P8, I8, D8, L8, M8, N8, U8, F8, z8, $8, H8, j8, B8, K8, G8, W8, V8, q8, Z8, Y8, J8, X8, Q8, e7, t7, n7, r7, o7, s7, i7, a7, l7, c7, u7, d7, p7, f7, m7, g7, h7, _7, y7, S7, E7, b7, C7, TP, v7, L6e, RP, A7, x7, kP, ff, U6e, F6e, Ua, z6e, $6e, H6e, j6e, PP, IP, vS, DP, w7, LP, O7, k7, P7, AS, RS, xS, I7, MP, NP, D7, G6e, L7, W6e, M7, N7, UP, V6e, U7, F7, z7, $7, H7, j7, B7, q6e, is, wS, Fa, K7, G7, W7, i5e, X7, Q7, HP, $P, BP, tQ, WP, VP, JP, _Q, QP, eI, xQ, Uc, DS, $a, wQ, OQ, kQ, PQ, IQ, DQ, LQ, MQ, NQ, UQ, FQ, zQ, $Q, HQ, jQ, BQ, KQ, GQ, WQ, VQ, qQ, ZQ, YQ, JQ, XQ, QQ, eee, tee, nee, ree, oee, see, iee, aee, lee, cee, uee, dee, pee, fee, mee, gee, hee, _ee, yee, See, Eee, bee, Cee, vee, Aee, Ree, xee, Tee, wee, Oee, kee, Pee, Iee, Dee, Lee, Mee, Nee, Uee, Fee, zee, $ee, Hee, jee, Bee, Kee, Gee, Wee, Vee, qee, Zee, Yee, Jee, Xee, Qee, ete, tte, nte, rte, ote, ste, ite, ate, lte, cte, ute, dte, pte, fte, mte, gte, hte, _te, yte, Ste, Ete, bte, Cte, vte, Ate, Rte, xte, Tte, wte, Ote, kte, Pte, Ite, Dte, Lte, Mte, Nte, Ute, Fte, zte, $te, Hte, jte, Bte, Kte, Gte, Wte, Vte, qte, Zte, Yte, Jte, Xte, Qte, ene, tne, nne, rne, one, sne, ine, ane, lne, cne, une, dne, pne, fne, mne, gne, hne, _ne, yne, Sne, Ene, bne, Cne, vne, Ane, Rne, xne, Tne, wne, One, kne, Pne, Ine, Dne, Lne, Mne, Nne, Une, Fne, zne, $ne, Hne, jne, Bne, Kne, Gne, Wne, Vne, qne, Zne, Yne, Jne, Xne, Qne, ere, tre, nre, rre, ore, sre, ire, are, lre, cre, ure, dre, pre, fre, mre, gre, hre, _re, yre, Sre, Ere, bre, Cre, vre, Are, Rre, xre, Tre, wre, Ore, kre, Pre, Ire, Dre, Lre, Mre, Nre, Ure, Fre, zre, $re, Hre, jre, Bre, Kre, Gre, Wre, Vre, qre, Zre, Yre, Jre, Xre, Qre, eoe, toe, noe, roe, ooe, soe, ioe, aoe, loe, coe, uoe, doe, poe, foe, moe, goe, hoe, _oe, yoe, Soe, Eoe, boe, Coe, voe, Aoe, Roe, xoe, Toe, woe, Ooe, koe, Poe, Ioe, Doe, Loe, Moe, Noe, Uoe, Foe, zoe, $oe, Hoe, joe, Boe, Koe, Goe, Woe, Voe, qoe, Zoe, Yoe, Joe, Xoe, Qoe, ese, tse, nse, rse, ose, sse, ise, ase, lse, cse, use, dse, pse, fse, mse, gse, hse, _se, yse, Sse, Ese, LS, bse, Cse, vse, Ase, Rse, xse, Tse, wse, Ose, kse, Pse, Ise, Dse, Lse, Mse, Nse, Use, Fse, zse, $se, Hse, jse, Bse, Kse, Gse, Wse, Vse, qse, Zse, Yse, Jse, Xse, Qse, eie, tie, nie, rie, oie, sie, iie, aie, lie, cie, uie, die, pie, fie, mie, gie, hie, _ie, yie, Sie, Eie, bie, Cie, vie, Aie, Rie, xie, Tie, wie, Oie, kie, Pie, Iie, Die, Lie, Mie, Nie, Uie, Fie, zie, $ie, Hie, jie, Bie, Kie, Gie, Wie, Vie, qie, Zie, Yie, Jie, Xie, Qie, eae, tae, nae, rae, oae, sae, iae, aae, lae, cae, uae, dae, pae, fae, mae, gae, hae, _ae, yae, Sae, Eae, bae, Cae, vae, Aae, Rae, xae, Tae, wae, Oae, kae, Pae, Iae, Dae, Lae, Mae, Nae, Uae, Fae, zae, $ae, Hae, jae, Bae, Kae, Gae, Wae, Vae, qae, Zae, Yae, Jae, Xae, Qae, ele, tle, nle, rle, ole, sle, ile, ale, lle, cle, ule, dle, ple, fle, mle, gle, hle, _le, yle, Sle, Ele, ble, Cle, vle, Ale, Rle, xle, Tle, wle, Ole, kle, Ple, Ile, Dle, Lle, Mle, Nle, Ule, Fle, zle, $le, Hle, jle, Ble, Kle, Gle, Wle, Vle, qle, Zle, Yle, Jle, MS, Xle, Qle, ece, tce, nce, rce, oce, sce, ice, ace, lce, cce, uce, dce, pce, fce, mce, gce, hce, _ce, yce, Sce, Ece, bce, Cce, vce, Ace, Rce, xce, Tce, wce, Oce, kce, Pce, Ice, Dce, Lce, Mce, Nce, Uce, Fce, zce, $ce, Hce, jce, Bce, Kce, Gce, Wce, Vce, qce, Zce, Yce, Jce, Xce, Qce, eue, tue, nue, rue, oue, sue, iue, aue, lue, cue, uue, due, pue, fue, mue, gue, hue, _ue, yue, Sue, Eue, bue, Cue, vue, Aue, Rue, xue, Tue, wue, Oue, kue, Pue, Iue, Due, Lue, Mue, Nue, Uue, Fue, zue, $ue, Hue, jue, Bue, Kue, Gue, Wue, Vue, que, Zue, Yue, Jue, Xue, Que, ede, tde, nde, rde, ode, sde, ide, ade, lde, cde, ude, dde, pde, fde, mde, gde, hde, _de, yde, Sde, Ede, bde, Cde, vde, Ade, Rde, xde, Tde, wde, Ode, kde, Pde, Ide, Dde, Lde, Mde, Nde, Ude, Fde, zde, $de, Hde, jde, Bde, Kde, Gde, Wde, Vde, qde, Zde, Yde, Jde, Xde, Qde, epe, tpe, npe, rpe, ope, spe, ipe, ape, lpe, cpe, upe, dpe, ppe, fpe, mpe, gpe, hpe, _pe, ype, Spe, Epe, bpe, Cpe, vpe, Ape, Rpe, xpe, Tpe, wpe, Ope, kpe, Ppe, Ipe, Dpe, Lpe, Mpe, Npe, Upe, Fpe, zpe, $pe, Hpe, jpe, Bpe, Kpe, Gpe, Wpe, Vpe, qpe, Zpe, Ype, Jpe, Xpe, Qpe, efe, tfe, nfe, rfe, ofe, sfe, ife, afe, lfe, cfe, ufe, dfe, pfe, ffe, mfe, gfe, hfe, _fe, yfe, Sfe, Efe, bfe, Cfe, vfe, Afe, Rfe, xfe, Tfe, wfe, Ofe, kfe, Pfe, Ife, Dfe, Lfe, Mfe, Nfe, Ufe, Ffe, zfe, $fe, Hfe, jfe, Bfe, Kfe, Gfe, Wfe, Vfe, qfe, Zfe, Yfe, Jfe, Xfe, Qfe, eme, tme, nme, rme, ome, sme, ime, ame, lme, cme, ume, dme, pme, fme, mme, gme, hme, _me, yme, Sme, Eme, bme, Cme, vme, Ame, Rme, xme, Tme, wme, Ome, kme, Pme, Ime, Dme, Lme, Mme, Nme, Ume, Fme, zme, $me, Hme, jme, Bme, Kme, Gme, Wme, Vme, qme, Zme, Yme, Jme, NS, Xme, Qme, ege, tge, nge, rge, oge, sge, ige, age, lge, cge, uge, dge, pge, fge, mge, gge, hge, _ge, yge, Sge, Ege, bge, Cge, vge, Age, Rge, xge, Tge, wge, Oge, kge, Pge, Ige, Dge, Lge, Mge, Nge, Uge, Fge, zge, $ge, Hge, US, jge, Bge, Kge, Gge, Wge, Vge, qge, Zge, Yge, Jge, Xge, Qge, ehe, the, nhe, rhe, ohe, she, ihe, ahe, lhe, che, uhe, dhe, phe, fhe, mhe, ghe, hhe, _he, yhe, She, Ehe, bhe, Che, vhe, Ahe, Rhe, xhe, The, whe, Ohe, khe, Phe, Ihe, Dhe, Lhe, Mhe, Nhe, FS, rI, oI, Uhe, Fhe, zhe, $he, Hhe, jhe, Bhe, Khe, Ghe, Whe, Vhe, qhe, Zhe, Yhe, Jhe, Xhe, Qhe, e_e, t_e, n_e, r_e, o_e, s_e, i_e, a_e, l_e, c_e, u_e, d_e, p_e, f_e, m_e, g_e, h_e, __e, y_e, S_e, E_e, b_e, C_e, v_e, A_e, R_e, x_e, T_e, w_e, O_e, k_e, P_e, I_e, D_e, L_e, M_e, N_e, U_e, F_e, z_e, $_e, H_e, j_e, B_e, K_e, G_e, W_e, V_e, q_e, Z_e, Y_e, J_e, Q_e, Xn, eye, F8e, tye, z8e, nye, iI, rye, oye, lI, cye, uye, dye, _ye, on, vye, Aye, dI, C7e, v7e, ho, kI, PI, Dye, Sf, Lye, jc, Mye, Nye, LI, NI, Fye, VS, zye, $ye, x7e, zI, YS, KI, GI, VI, Hye, qS, ls, Kye, Gye, oD, nE, sD, So, Yc, vn, Zye, oE, sE, iD, aD, wf, Jc, Xc, kf, Qc, Pf, eu, fi, tu, mi, lD, cD, uD, dD, pD, fD, mD, gD, hD, _D, yD, SD, ED, bD, vD, AD, cE, RD, Xye, TD, wD, OD, kD, PD, uE, ID, DD, LD, MD, FD, If, nu, zD, $D, HD, jD, BD, zt, dE, Df, pE, fE, KD, GD, WD, VD, qD, ru, ZD, YD, JD, XD, QD, eL, tL, mE, yr, He, rL, ou, Je, yE, SE, EE, fL, mL, tSe, bE, CE, vE, AE, RE, xE, TE, wE, gL, hL, _L, yL, OE, sSe, kE, PE, IE, DE, LE, ME, NE, Nf, UE, FE, zE, $E, HE, jE, BE, cSe, gE, KE, vL, Uf, GE, WE, VE, qE, ZE, YE, Ff, JE, XE, QE, eb, tb, nb, zf, AL, rb, ob, sb, TL, ab, RL, xL, $f, Hf, dSe, fSe, OL, kL, Sr, FL, ML, zL, lu, hSe, iC, aC, lC, HL, jL, cC, uC, BL, dC, KL, pC, GL, fC, mC, WL, VL, qL, ZL, gC, YL, hC, JL, XL, _C, yC, SC, EC, QL, sC, bC, CC, vC, AC, RC, xC, TC, wC, OC, tM, qf, kC, $L, rM, ASe, Fn, oM, sM, iM, aM, lM, cM, uM, dM, pM, fM, mM, gM, Be, SM, LC, ct, MC, EM, bM, CM, pEe, fEe, Yf, mEe, gEe, hEe, _Ee, yEe, SEe, EEe, bEe, CEe, vEe, AEe, REe, xEe, TEe, wEe, OEe, NC, kEe, vM, PEe, IEe, DEe, LEe, MEe, fu, AM, NEe, UEe, IC, DC, FEe, zEe, qa, TM, HEe, jEe, KEe, wM, em, mu, qEe, ZEe, JEe, OM, Qn, kM, LM, nbe, rbe, abe, lbe, cbe, rm, pbe, At, hbe, BC, BM, Zet, WM, VM, qM, ZM, Cbe, vbe, YM, Abe, Rbe, JM, xbe, Tbe, QM, Ibe, eN, Lbe, nN, Mbe, Nbe, sm, rN, iN, Fbe, aN, $be, jbe, Kbe, Gbe, yu, lN, uN, dN, Xbe, KM, Qbe, eCe, tCe, oCe, iCe, _N, yN, wN, Ytt, ON, OCe, DCe, LN, $Ce, HCe, Cu, BCe, MN, VCe, QCe, ive, uve, VN, pve, fve, _rt, gve, Sve, nv, tv, GN, tU, Fve, Hve, iU, tAe, sAe, iAe, aAe, cAe, Ie, bU, Q, vo, F, zn, fAe, ms, mAe, _m, nn, he, Xa, an, lv, cv, Si, wu, se, br, CU, Oe, gAe, hAe, _Ae, yAe, SAe, EAe, bAe, CAe, vAe, uv, AAe, RAe, xAe, TAe, wAe, OAe, vU, kAe, Ro, el, tl, ym, ku, Sm, Pu, Iu, Em, Ei, xo, bm, Fr, ft, Du, Ao, pv, Lu, To, Cm, vm, nl, Ou, Mu, Nu, bi, Uu, rl, $r, zr, gs, Fu, zu, Am, fv, Rm, $u, wot, H, Oot, kot, Pot, Iot, Dot, Lot, Mot, Not, Uot, Fot, zot, $ot, Hot, jot, xU, Bot, Kot, Got, Wot, Vot, qot, Zot, Yot, Jot, Xot, Qot, est, tst, nst, rst, ost, sst, ist, ast, FAe, zAe, gv, OU, Ss, km, Mt, kU, PU, kst, HAe, jAe, hv, $n, Hu, IU, Yt, tr, nr, Jt, Pm, DU, _v, LU, MU, yv, ju, le, Sv, NU, Pst, Ist, Im, BAe, Dm, KAe, Bu, ol, UU, GAe, WAe, VAe, qAe, ZAe, YAe, Ev, JAe, XAe, bv, Lm, QAe, eRe, Mm, tRe, Ku, Gu, nRe, Wu, sl, rRe, Vu, Nm, Um, Fm, Dst, zm, $m, Hm, FU, zU, $U, Cv, HU, qu, il, jU, oRe, jm, sRe, Bm, iRe, vv, aRe, Km, lRe, cRe, uRe, dRe, pRe, fRe, mRe, gRe, hRe, _Re, Gm, yRe, SRe, Wm, Av, Rv, xv, ERe, bRe, CRe, Tv, vRe, ARe, RRe, xRe, TRe, BU, Vm, wRe, qm, Lst, ORe, al, kRe, Mst, Zu, PRe, wv, IRe, DRe, LRe, MRe, NRe, URe, FRe, Om, zRe, $Re, HRe, Yu, Ov, jRe, BRe, KRe, GRe, WRe, VRe, qRe, ZRe, YRe, JRe, XRe, QRe, exe, txe, nxe, rxe, oxe, sxe, ll, ixe, axe, lxe, Zm, cxe, uxe, dxe, kv, pxe, Nst, Ust, Fst, zst, $st, Hst, ae, WU, qU, VU, ZU, YU, Ym, e0, fxe, mxe, Dv, Cr, gxe, Ju, d0, h0, _0, v0, A0, Sxe, Exe, Mv, Cxe, Fv, Oj, kj, PA, IA, DA, Lj, Dj, aLe, NA, FA, uLe, dd, fLe, Po, SLe, ELe, zA, bLe, xLe, TLe, wLe, OLe, kLe, $j, qj, ILe, DLe, LLe, MLe, Ce, NLe, Wg, Oi, VA, Do, Jj, Xj, Qj, eB, tB, nB, qA, ZA, jA, Bj, jLe, BLe, GLe, rB, BA, Gg, GA, WA, VLe, qLe, Kj, Hs, sB, QLe, YA, iB, uB, eMe, dB, pB, fB, mB, tMe, XA, aB, QA, gB, hB, _B, yB, jn, lMe, SB, dMe, bB, mMe, fd, RB, hMe, Rr, TB, SMe, EMe, Pl, wB, Vg, AMe, Il, RMe, xMe, qg, OB, wMe, OMe, kB, eo, Dl, Zg, DB, NMe, FB, WMe, VMe, $B, HB, jB, BB, Ml, GB, nR, WB, Jg, KB, eNe, Bs, VB, gd, Nl, Xg, tNe, YB, qB, Pi, rK, iK, pNe, hd, _d, to, yd, nh, uK, aK, _Ne, lK, cK, Sd, Ul, rh, oh, dK, CNe, pK, sh, fK, RNe, xNe, TNe, mK, wNe, ONe, ih, Ed, lr, gK, hK, yK, SK, EK, ah, bK, FNe, CK, zNe, $Ne, HNe, vK, BNe, lh, AK, RK, xK, VNe, dn, TK, wK, OK, kK, PK, QNe, eUe, IK, DK, rUe, LK, MK, NK, UK, iUe, aUe, lUe, cUe, uUe, dUe, pUe, fUe, mUe, gUe, hUe, _Ue, yUe, SUe, EUe, bUe, CUe, vUe, AUe, FK, xUe, zK, $K, wUe, HK, OUe, jK, BK, PUe, KK, IUe, DUe, LUe, GK, MUe, NUe, UUe, FUe, WK, zUe, $Ue, HUe, VK, jUe, BUe, KUe, GUe, WUe, VUe, qUe, ZUe, YUe, JUe, XUe, QUe, e0e, t0e, n0e, r0e, Xe, qK, ZK, YK, JK, a0e, l0e, uh, XK, QK, e1, n1, r1, dh, m0e, g0e, h0e, _0e, bd, o1, S0e, Fl, s1, b0e, i1, Di, a1, l1, c1, u1, d1, p1, f1, P0e, I0e, m1, D0e, g1, h1, _1, vyt, U0e, y1, Ayt, iR, F0e, z0e, $0e, Gs, zl, fh, E1, b1, H0e, j0e, B0e, K0e, mh, $l, gh, Ws, aR, hh, _h, G0e, W0e, lR, R1, x1, V0e, uR, k1, P1, I1, D1, L1, Y0e, dR, J0e, Fyt, pR, X0e, fR, mR, Q0e, zyt, eFe, gR, hR, _R, $yt, M1, yR, N1, U1, tFe, nFe, rFe, oFe, iFe, Mi, cFe, $1, Wyt, Vyt, H1, j1, B1, K1, uFe, G1, W1, V1, q1, dFe, pFe, SR, fFe, eSt, tSt, mFe, jl, Vs, gFe, Y1, hFe, _Fe, X1, Q1, eG, yFe, SFe, tG, EFe, bFe, CFe, vFe, bR, CR, RFe, xFe, vR, TFe, Eh, nSt, Cd, wFe, OFe, aSt, rG, PFe, IFe, _St, oG, sG, bSt, CSt, HFe, jFe, $St, BFe, KFe, HSt, JSt, XSt, lG, OR, VFe, YFe, uG, eze, nze, gG, vd, vh, kR, zi, sze, yG, ize, yEt, Ad, $i, bG, Kn, AEt, REt, xEt, aze, AG, wG, $R, dze, $G, pze, fze, mze, gze, hze, BR, HG, jG, fbt, yze, Sze, Eze, Gn, ji, kG, PG, NR, UR, KR, GG, Cze, vze, Rze, GR, xze, Tze, xh, WR, Oze, kze, mbt, Pze, Ize, Dze, Lze, Mze, Nze, qG, Uze, Fze, zze, $ze, ZG, Hze, IG, jze, Bze, YG, Kze, Gze, DG, Wze, Vze, JG, qze, Zze, Yze, Jze, QG, Xze, Qze, e$e, t$e, r$e, o$e, s$e, i$e, a$e, eW, nW, c$e, m$e, xd, VR, gbt, hbt, _bt, h$e, qR, Th, MR, aW, _$e, S$e, lW, E$e, b$e, C$e, v$e, A$e, x$e, w$e, O$e, k$e, P$e, I$e, N$e, ybt, FR, Sbt, U$e, MG, Td, Ebt, bbt, uW, z$e, $$e, H$e, Cbt, j$e, B$e, vbt, Abt, K$e, Rbt, Oh, kh, G$e, YR, Ph, W$e, Ih, Mbt, Nbt, Ubt, Dh, V$e, Z$e, tx, EW, Id, Fh, X$e, xCt, Q$e, eHe, ix, ax, lx, cx, zh, $h, MW, tHe, nHe, aHe, uHe, dHe, Zs, pHe, CW, vW, AW, Nh, UW, fHe, mHe, gHe, hHe, _He, yHe, SHe, EHe, pn, dx, nx, Mh, Bi, AHe, TCt, xHe, Pd, RW, THe, xW, wHe, OHe, Hh, kHe, TW, fx, Bh, Ki, KW, Gl, PHe, Kh, kW, Wl, NHe, Ld, UHe, tV, rV, jHe, XHe, cvt, tje, fV, mV, sje, aje, _V, yV, pje, zvt, $vt, gje, yje, Sje, Kvt, Gvt, eAt, RV, Eje, bje, mAt, Cje, gAt, xV, wV, OV, Js, Lje, FV, Yh, Jh, Md, Tx, zV, $V, HV, Xh, jV, cr, KV, Mo, Fje, zje, yRt, jje, Gje, Vje, sBe, YV, e22, o_, gBe, t2, s_, kx, o2, LBe, UBe, $x, Vi, R2, KBe, GBe, Dx, ZBe, k2, n_, l2, sKe, lKe, z2, bKe, RKe, ec, W2, H2, xKe, wKe, PKe, IKe, $Ke, X2, HKe, jKe, BKe, KKe, VKe, eTt, qKe, tTt, nTt, ZKe, rTt, YKe, oTt, JKe, Wx, XKe, iTt, eq, tq, QKe, nq, rq, e1e, t1e, oq, sq, n1e, r1e, aTt, lTt, c1e, Zx, cq, u1e, uq, a_, d1e, Xx, nc, S1e, c_, mq, gq, Qx, hq, _q, E1e, Sq, u_, rc, d_, b1e, bq, Uo, Cq, vq, A1e, Yd, Jd, R1e, x1e, Aq, gn, T1e, w1e, O1e, Xs, k1e, P1e, xq, Pwt, I1e, Oq, kq, Pq, D1e, L1e, Iq, M1e, N1e, nT, U1e, p_, rT, Dq, oT, iT, F1e, Uq, aT, jq, K1e, Gq, yOt, sGe, cGe, uGe, yGe;
81047
81070
  var init_sdk = __esm({
81048
81071
  "node_modules/.pnpm/@anthropic-ai+claude-agent-sdk@0.3.292_@anthropic-ai+sdk@0.131.0_zod@4.6.5__@modelconte_9caa915130557974815a7ac66b010e49/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs"() {
81049
81072
  import_node_module = require("node:module");
@@ -81074,7 +81097,7 @@ var init_sdk = __esm({
81074
81097
  import_path6 = require("path");
81075
81098
  import_promises6 = require("fs/promises");
81076
81099
  import_os4 = require("os");
81077
- import_node_path45 = __toESM(require("node:path"), 1);
81100
+ import_node_path46 = __toESM(require("node:path"), 1);
81078
81101
  import_node_os10 = __toESM(require("node:os"), 1);
81079
81102
  import_node_process5 = __toESM(require("node:process"), 1);
81080
81103
  import_path7 = require("path");
@@ -89525,16 +89548,16 @@ var init_sdk = __esm({
89525
89548
  wS = import_node_os10.default.tmpdir();
89526
89549
  ({ env: Fa } = import_node_process5.default);
89527
89550
  K7 = (e14) => {
89528
- let t10 = import_node_path45.default.join(is, "Library");
89529
- return { data: import_node_path45.default.join(t10, "Application Support", e14), config: import_node_path45.default.join(t10, "Preferences", e14), cache: import_node_path45.default.join(t10, "Caches", e14), log: import_node_path45.default.join(t10, "Logs", e14), temp: import_node_path45.default.join(wS, e14) };
89551
+ let t10 = import_node_path46.default.join(is, "Library");
89552
+ return { data: import_node_path46.default.join(t10, "Application Support", e14), config: import_node_path46.default.join(t10, "Preferences", e14), cache: import_node_path46.default.join(t10, "Caches", e14), log: import_node_path46.default.join(t10, "Logs", e14), temp: import_node_path46.default.join(wS, e14) };
89530
89553
  };
89531
89554
  G7 = (e14) => {
89532
- let t10 = Fa.APPDATA || import_node_path45.default.join(is, "AppData", "Roaming"), n10 = Fa.LOCALAPPDATA || import_node_path45.default.join(is, "AppData", "Local");
89533
- return { data: import_node_path45.default.join(n10, e14, "Data"), config: import_node_path45.default.join(t10, e14, "Config"), cache: import_node_path45.default.join(n10, e14, "Cache"), log: import_node_path45.default.join(n10, e14, "Log"), temp: import_node_path45.default.join(wS, e14) };
89555
+ let t10 = Fa.APPDATA || import_node_path46.default.join(is, "AppData", "Roaming"), n10 = Fa.LOCALAPPDATA || import_node_path46.default.join(is, "AppData", "Local");
89556
+ return { data: import_node_path46.default.join(n10, e14, "Data"), config: import_node_path46.default.join(t10, e14, "Config"), cache: import_node_path46.default.join(n10, e14, "Cache"), log: import_node_path46.default.join(n10, e14, "Log"), temp: import_node_path46.default.join(wS, e14) };
89534
89557
  };
89535
89558
  W7 = (e14) => {
89536
- let t10 = import_node_path45.default.basename(is);
89537
- return { data: import_node_path45.default.join(Fa.XDG_DATA_HOME || import_node_path45.default.join(is, ".local", "share"), e14), config: import_node_path45.default.join(Fa.XDG_CONFIG_HOME || import_node_path45.default.join(is, ".config"), e14), cache: import_node_path45.default.join(Fa.XDG_CACHE_HOME || import_node_path45.default.join(is, ".cache"), e14), log: import_node_path45.default.join(Fa.XDG_STATE_HOME || import_node_path45.default.join(is, ".local", "state"), e14), temp: import_node_path45.default.join(wS, t10, e14) };
89559
+ let t10 = import_node_path46.default.basename(is);
89560
+ return { data: import_node_path46.default.join(Fa.XDG_DATA_HOME || import_node_path46.default.join(is, ".local", "share"), e14), config: import_node_path46.default.join(Fa.XDG_CONFIG_HOME || import_node_path46.default.join(is, ".config"), e14), cache: import_node_path46.default.join(Fa.XDG_CACHE_HOME || import_node_path46.default.join(is, ".cache"), e14), log: import_node_path46.default.join(Fa.XDG_STATE_HOME || import_node_path46.default.join(is, ".local", "state"), e14), temp: import_node_path46.default.join(wS, t10, e14) };
89538
89561
  };
89539
89562
  i5e = OS("claude-cli");
89540
89563
  X7 = 100;
@@ -115106,7 +115129,7 @@ function registerCodexCommand(program2, deps) {
115106
115129
 
115107
115130
  // src/frontdoor/commands.ts
115108
115131
  var import_node_crypto25 = require("node:crypto");
115109
- var import_node_path53 = __toESM(require("node:path"), 1);
115132
+ var import_node_path54 = __toESM(require("node:path"), 1);
115110
115133
  var import_node_fs19 = __toESM(require("node:fs"), 1);
115111
115134
  init_commandDeps();
115112
115135
  init_configProfilesStore();
@@ -115599,10 +115622,219 @@ function showSession(fs26, identitiesDir, identities, query, onlyIdentity) {
115599
115622
  // src/frontdoor/commands.ts
115600
115623
  init_realPorts();
115601
115624
 
115625
+ // src/supervise/registry.ts
115626
+ var import_node_path36 = __toESM(require("node:path"), 1);
115627
+ init_zod();
115628
+ var SupervisedSessionSchema = external_exports.strictObject({
115629
+ /** The launcher's process id, which is what tells a live entry from one a crashed launcher left behind. */
115630
+ pid: external_exports.number().int().positive(),
115631
+ sessionId: external_exports.string().min(1),
115632
+ pool: external_exports.string().min(1),
115633
+ /** The identity the session is running as now. */
115634
+ identity: external_exports.string().min(1),
115635
+ cwd: external_exports.string().min(1),
115636
+ /** When the session began running as `identity`: its launch, or the move that brought it there. */
115637
+ since: external_exports.iso.datetime(),
115638
+ /** The size in tokens of the context the session carried onto `identity` when it moved there; absent for a launch, which carries none. */
115639
+ carriedTokens: external_exports.number().int().nonnegative().optional()
115640
+ });
115641
+ var SessionStateSchema = external_exports.strictObject({
115642
+ /** `busy` from the moment a prompt is submitted until the turn ends, `idle` from then until the next prompt: the only times the child can be stopped without losing a turn. */
115643
+ mark: external_exports.enum(["busy", "idle"]),
115644
+ /** The size in tokens of the context as of the last turn that ended; absent until one has. */
115645
+ contextTokens: external_exports.number().int().nonnegative().optional(),
115646
+ /** Whether the session was compacted during its stay on the member it runs on now. Set by the supervisor, kept by later marks, and cleared when the session moves. */
115647
+ compacted: external_exports.boolean().optional(),
115648
+ at: external_exports.iso.datetime()
115649
+ });
115650
+ function superviseDirOf(paths, pool) {
115651
+ return import_node_path36.default.join(paths.superviseDir, pool);
115652
+ }
115653
+ function sessionsDirOf(paths, pool) {
115654
+ return import_node_path36.default.join(superviseDirOf(paths, pool), "sessions");
115655
+ }
115656
+ function sessionFileOf(paths, pool, sessionId) {
115657
+ return import_node_path36.default.join(sessionsDirOf(paths, pool), `${sessionId}.json`);
115658
+ }
115659
+ function stateDirOf(paths, pool) {
115660
+ return import_node_path36.default.join(superviseDirOf(paths, pool), "state");
115661
+ }
115662
+ function sessionStatePath(paths, pool, sessionId) {
115663
+ return import_node_path36.default.join(stateDirOf(paths, pool), `${sessionId}.json`);
115664
+ }
115665
+ function writeSessionState(fs26, paths, pool, sessionId, state) {
115666
+ fs26.mkdirPrivate(stateDirOf(paths, pool));
115667
+ fs26.writeFilePrivate(sessionStatePath(paths, pool, sessionId), `${JSON.stringify(SessionStateSchema.parse(state))}
115668
+ `);
115669
+ }
115670
+ function readSessionState(fs26, paths, pool, sessionId) {
115671
+ const raw = fs26.readFileUtf8(sessionStatePath(paths, pool, sessionId));
115672
+ if (raw === void 0) {
115673
+ return void 0;
115674
+ }
115675
+ try {
115676
+ const parsed = SessionStateSchema.safeParse(JSON.parse(raw));
115677
+ return parsed.success ? parsed.data : void 0;
115678
+ } catch {
115679
+ return void 0;
115680
+ }
115681
+ }
115682
+ function registerSupervised(fs26, paths, session) {
115683
+ fs26.mkdirPrivate(sessionsDirOf(paths, session.pool));
115684
+ fs26.writeFilePrivate(sessionFileOf(paths, session.pool, session.sessionId), `${JSON.stringify(SupervisedSessionSchema.parse(session))}
115685
+ `);
115686
+ }
115687
+ function unregisterSupervised(fs26, paths, pool, sessionId) {
115688
+ fs26.removeRecursive(sessionFileOf(paths, pool, sessionId));
115689
+ fs26.removeRecursive(sessionStatePath(paths, pool, sessionId));
115690
+ }
115691
+ function liveSupervised(fs26, paths, pool, isRunning) {
115692
+ const live = [];
115693
+ for (const name of fs26.readdir(sessionsDirOf(paths, pool))) {
115694
+ const file2 = import_node_path36.default.join(sessionsDirOf(paths, pool), name);
115695
+ const raw = fs26.readFileUtf8(file2);
115696
+ if (raw === void 0) {
115697
+ continue;
115698
+ }
115699
+ let parsed;
115700
+ try {
115701
+ parsed = SupervisedSessionSchema.safeParse(JSON.parse(raw));
115702
+ } catch {
115703
+ fs26.removeRecursive(file2);
115704
+ continue;
115705
+ }
115706
+ if (parsed.success && isRunning(parsed.data.pid)) {
115707
+ live.push(parsed.data);
115708
+ } else {
115709
+ fs26.removeRecursive(file2);
115710
+ }
115711
+ }
115712
+ return live;
115713
+ }
115714
+ function committedContextTokens(sessions, records) {
115715
+ const committed = {};
115716
+ for (const session of sessions) {
115717
+ if (session.carriedTokens === void 0) {
115718
+ continue;
115719
+ }
115720
+ const sinceMs = Date.parse(session.since);
115721
+ const written = records.some((record2) => record2.sessionId === session.sessionId && record2.identity === session.identity && Date.parse(record2.at) >= sinceMs);
115722
+ if (!written) {
115723
+ committed[session.identity] = (committed[session.identity] ?? 0) + session.carriedTokens;
115724
+ }
115725
+ }
115726
+ return committed;
115727
+ }
115728
+ var ModelMoveRequestSchema = external_exports.strictObject({
115729
+ /** The session the request is for: the id its supervisor registered it under. */
115730
+ sessionId: external_exports.string().min(1),
115731
+ /** The identity the model runs under, as the `acct:` member names it. */
115732
+ to: external_exports.string().min(1),
115733
+ /** The model to resume with, the part after the identity in the `acct:` member. */
115734
+ model: external_exports.string().min(1),
115735
+ /** When the door wrote the request, so a supervisor can tell a fresh request from one left behind. */
115736
+ at: external_exports.iso.datetime()
115737
+ });
115738
+ function writeModelMove(fs26, paths, request7) {
115739
+ fs26.mkdirPrivate(paths.modelMovesDir);
115740
+ fs26.writeFilePrivate(import_node_path36.default.join(paths.modelMovesDir, `${request7.sessionId}.json`), `${JSON.stringify(ModelMoveRequestSchema.parse(request7))}
115741
+ `);
115742
+ }
115743
+ function readModelMove(fs26, paths, sessionId) {
115744
+ const raw = fs26.readFileUtf8(import_node_path36.default.join(paths.modelMovesDir, `${sessionId}.json`));
115745
+ if (raw === void 0) {
115746
+ return void 0;
115747
+ }
115748
+ try {
115749
+ return ModelMoveRequestSchema.parse(JSON.parse(raw));
115750
+ } catch {
115751
+ return void 0;
115752
+ }
115753
+ }
115754
+ function removeModelMove(fs26, paths, sessionId) {
115755
+ fs26.removeRecursive(import_node_path36.default.join(paths.modelMovesDir, `${sessionId}.json`));
115756
+ }
115757
+ function supervisedSessionOf(fs26, paths, sessionId, isRunning) {
115758
+ for (const pool of fs26.readdir(paths.superviseDir)) {
115759
+ const sessions = liveSupervised(fs26, paths, pool, isRunning);
115760
+ const found = sessions.find((session) => session.sessionId === sessionId);
115761
+ if (found !== void 0) {
115762
+ return found;
115763
+ }
115764
+ }
115765
+ return void 0;
115766
+ }
115767
+
115768
+ // src/selection/targetStore.ts
115769
+ init_read();
115770
+
115771
+ // src/selection/signals.ts
115772
+ function targetOf(record2) {
115773
+ return record2.model === void 0 ? void 0 : `${record2.provider}/${record2.model}`;
115774
+ }
115775
+ function median(values) {
115776
+ if (values.length === 0) {
115777
+ return void 0;
115778
+ }
115779
+ const sorted = [...values].sort((left, right) => left - right);
115780
+ const middle = Math.floor(sorted.length / 2);
115781
+ const above = sorted[middle];
115782
+ const below = sorted[middle - 1];
115783
+ return sorted.length % 2 === 0 && above !== void 0 && below !== void 0 ? (above + below) / 2 : sorted[middle];
115784
+ }
115785
+ var OBSERVATION_WINDOW = 20;
115786
+ function observeRecord(observations, record2) {
115787
+ const target = targetOf(record2);
115788
+ if (target === void 0) {
115789
+ return new Map(observations);
115790
+ }
115791
+ const kept = [...observations.get(target) ?? [], record2].slice(-OBSERVATION_WINDOW);
115792
+ return new Map(observations).set(target, kept);
115793
+ }
115794
+ function observationOf(records) {
115795
+ const completed = records.filter((record2) => record2.outcome === "completed");
115796
+ const latencies = completed.map((record2) => record2.latencyMs);
115797
+ const usage = records.flatMap((record2) => record2.usage === void 0 ? [] : [record2.usage]);
115798
+ const input2 = usage.reduce((sum, entry) => sum + (entry.inputTokens ?? 0), 0);
115799
+ const output2 = usage.reduce((sum, entry) => sum + (entry.outputTokens ?? 0), 0);
115800
+ const cacheRead = usage.reduce((sum, entry) => sum + (entry.cacheReadInputTokens ?? 0), 0);
115801
+ return {
115802
+ latencyMs: median(latencies),
115803
+ successRate: records.length === 0 ? void 0 : completed.length / records.length,
115804
+ tokenMix: input2 + output2 + cacheRead === 0 ? void 0 : { input: input2, output: output2, cacheRead }
115805
+ };
115806
+ }
115807
+ function blendedPricePerMTok(prices, mix) {
115808
+ const total = mix.input + mix.output + mix.cacheRead;
115809
+ if (total === 0) {
115810
+ return void 0;
115811
+ }
115812
+ return (prices.input * mix.input + prices.output * mix.output) / total;
115813
+ }
115814
+
115815
+ // src/selection/targetStore.ts
115816
+ var SEED_LOOKBACK_RECORDS = 500;
115817
+ function createTargetObservationStore(fs26, paths) {
115818
+ let observations = /* @__PURE__ */ new Map();
115819
+ const seeded = readUsageLog(fs26, paths.usageLogDir, {}).records.slice(-SEED_LOOKBACK_RECORDS);
115820
+ for (const record2 of seeded) {
115821
+ observations = observeRecord(observations, record2);
115822
+ }
115823
+ return {
115824
+ observe: (record2) => {
115825
+ observations = observeRecord(observations, record2);
115826
+ },
115827
+ observation: (target) => {
115828
+ const records = observations.get(target);
115829
+ return records === void 0 ? void 0 : observationOf(records);
115830
+ }
115831
+ };
115832
+ }
115833
+
115602
115834
  // src/update/commands.ts
115603
115835
  var import_node_fs14 = __toESM(require("node:fs"), 1);
115604
115836
  var import_node_os7 = __toESM(require("node:os"), 1);
115605
- var import_node_path38 = __toESM(require("node:path"), 1);
115837
+ var import_node_path39 = __toESM(require("node:path"), 1);
115606
115838
  init_package();
115607
115839
  init_commandDeps();
115608
115840
  init_configProfilesStore();
@@ -115706,7 +115938,7 @@ var realUpdatePorts = {
115706
115938
  chmod: (filePath, mode) => {
115707
115939
  import_node_fs14.default.chmodSync(filePath, mode);
115708
115940
  },
115709
- mkdtemp: () => import_node_fs14.default.mkdtempSync(import_node_path38.default.join(import_node_os7.default.tmpdir(), "agent-shim-update-")),
115941
+ mkdtemp: () => import_node_fs14.default.mkdtempSync(import_node_path39.default.join(import_node_os7.default.tmpdir(), "agent-shim-update-")),
115710
115942
  rmRecursive: (targetPath) => {
115711
115943
  import_node_fs14.default.rmSync(targetPath, { recursive: true, force: true });
115712
115944
  }
@@ -115727,7 +115959,7 @@ function selfUpdateOptions(paths, checkOnly) {
115727
115959
  platform: process.platform,
115728
115960
  arch: process.arch,
115729
115961
  executablePath: realOwnExecutablePath(),
115730
- lockPath: import_node_path38.default.join(paths.root, "update.lock"),
115962
+ lockPath: import_node_path39.default.join(paths.root, "update.lock"),
115731
115963
  checkOnly,
115732
115964
  pid: process.pid
115733
115965
  };
@@ -115996,7 +116228,7 @@ function createRealWindowOpener(params) {
115996
116228
  init_conditions();
115997
116229
 
115998
116230
  // src/usage/handledStamps.ts
115999
- var import_node_path46 = __toESM(require("node:path"), 1);
116231
+ var import_node_path47 = __toESM(require("node:path"), 1);
116000
116232
  init_zod();
116001
116233
  var STAMPS_SCHEMA_VERSION = 1;
116002
116234
  var StampsFileSchema = external_exports.strictObject({
@@ -116019,7 +116251,7 @@ function readHandled(fs26, file2) {
116019
116251
  }
116020
116252
  function writeHandled(fs26, file2, handled) {
116021
116253
  const next = { schemaVersion: STAMPS_SCHEMA_VERSION, handled: Object.fromEntries(Object.entries(handled).map(([key, at2]) => [key, new Date(at2).toISOString()])) };
116022
- fs26.mkdirPrivate(import_node_path46.default.dirname(file2));
116254
+ fs26.mkdirPrivate(import_node_path47.default.dirname(file2));
116023
116255
  fs26.writeFilePrivate(file2, `${JSON.stringify(next, null, 2)}
116024
116256
  `);
116025
116257
  }
@@ -116759,14 +116991,14 @@ init_state();
116759
116991
 
116760
116992
  // src/frontdoor/supervisor.ts
116761
116993
  init_processRole();
116762
- var import_node_path47 = __toESM(require("node:path"), 1);
116994
+ var import_node_path48 = __toESM(require("node:path"), 1);
116763
116995
  init_state();
116764
116996
  function watchedInstallEntry(resolvedOwnExecutablePath, siblingExists) {
116765
- const parsed = import_node_path47.default.parse(resolvedOwnExecutablePath);
116997
+ const parsed = import_node_path48.default.parse(resolvedOwnExecutablePath);
116766
116998
  if (parsed.name === "agent-shim") {
116767
116999
  return resolvedOwnExecutablePath;
116768
117000
  }
116769
- const sibling = import_node_path47.default.join(parsed.dir, `agent-shim${parsed.ext}`);
117001
+ const sibling = import_node_path48.default.join(parsed.dir, `agent-shim${parsed.ext}`);
116770
117002
  return siblingExists(sibling) ? sibling : resolvedOwnExecutablePath;
116771
117003
  }
116772
117004
  var AWAIT_PID_POLL_MS = 50;
@@ -119369,7 +119601,7 @@ init_claudeShim();
119369
119601
  init_store();
119370
119602
  init_realPorts();
119371
119603
  var import_node_fs18 = __toESM(require("node:fs"), 1);
119372
- var import_node_path48 = __toESM(require("node:path"), 1);
119604
+ var import_node_path49 = __toESM(require("node:path"), 1);
119373
119605
  init_signIn();
119374
119606
  init_load();
119375
119607
  init_unrecognisedKeys();
@@ -119660,7 +119892,7 @@ function tcpPortEraRecord(raw) {
119660
119892
  return (has("port") || has("lastPort")) && !has("socketPath");
119661
119893
  }
119662
119894
  function pushPathResolution(push, resolution) {
119663
- const ownDir = import_node_path48.default.dirname(resolution.ownExecutablePath);
119895
+ const ownDir = import_node_path49.default.dirname(resolution.ownExecutablePath);
119664
119896
  switch (resolution.agentShim.status) {
119665
119897
  case "ok":
119666
119898
  push("path-resolution", "pass", `\`agent-shim\` on PATH resolves to this running executable, ${resolution.ownExecutablePath}.`, "agent-shim");
@@ -119764,14 +119996,14 @@ function pushProvider(push, entry, cacheEnv, signIn) {
119764
119996
  }
119765
119997
  function pushLegacyName(push, params) {
119766
119998
  const legacyVariables = Object.keys(params.env).filter((name) => name.startsWith(LEGACY_ENV_PREFIX) && params.env[name] !== void 0).sort();
119767
- if (legacyVariables.length === 0 && import_node_path48.default.basename(params.rootPath) !== LEGACY_HOME_DIRNAME) {
119999
+ if (legacyVariables.length === 0 && import_node_path49.default.basename(params.rootPath) !== LEGACY_HOME_DIRNAME) {
119768
120000
  push("legacy-name", "pass", "Nothing here still uses the former `claude-use` name.");
119769
120001
  return;
119770
120002
  }
119771
120003
  for (const name of legacyVariables) {
119772
120004
  push("legacy-name", "warn", `${name} is the former name of ${name.replace(LEGACY_ENV_PREFIX, ENV_PREFIX)}. Rename it; the old name still works but is only a fallback.`, name);
119773
120005
  }
119774
- if (import_node_path48.default.basename(params.rootPath) === LEGACY_HOME_DIRNAME) {
120006
+ if (import_node_path49.default.basename(params.rootPath) === LEGACY_HOME_DIRNAME) {
119775
120007
  push(
119776
120008
  "legacy-name",
119777
120009
  "warn",
@@ -120170,18 +120402,18 @@ function collectDoctorReport(params) {
120170
120402
  const { paths } = params;
120171
120403
  const identityNames = import_node_fs18.default.existsSync(paths.identitiesDir) ? import_node_fs18.default.readdirSync(paths.identitiesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory() && isIdentityDirectoryName(entry.name)).map((entry) => entry.name).sort() : [];
120172
120404
  const identities = identityNames.map((name) => {
120173
- const farmRoot = import_node_path48.default.join(paths.identitiesDir, name);
120174
- const identityPath = import_node_path48.default.join(farmRoot, "identity.json");
120405
+ const farmRoot = import_node_path49.default.join(paths.identitiesDir, name);
120406
+ const identityPath = import_node_path49.default.join(farmRoot, "identity.json");
120175
120407
  return { name, path: identityPath, raw: realFsPort.readFileUtf8(identityPath), farmRoot, credentialsFilePresent: import_node_fs18.default.existsSync(credentialsFilePath(farmRoot)) };
120176
120408
  });
120177
120409
  const profileNames = import_node_fs18.default.existsSync(paths.configProfilesDir) ? import_node_fs18.default.readdirSync(paths.configProfilesDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort() : [];
120178
120410
  const configProfiles = profileNames.map((name) => {
120179
- const profilePath = import_node_path48.default.join(paths.configProfilesDir, `${name}.json`);
120411
+ const profilePath = import_node_path49.default.join(paths.configProfilesDir, `${name}.json`);
120180
120412
  return { name, path: profilePath, raw: realFsPort.readFileUtf8(profilePath) };
120181
120413
  });
120182
120414
  const providerNames = import_node_fs18.default.existsSync(paths.providersDir) ? import_node_fs18.default.readdirSync(paths.providersDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort() : [];
120183
120415
  const providers = providerNames.map((name) => {
120184
- const providerPath = import_node_path48.default.join(paths.providersDir, `${name}.json`);
120416
+ const providerPath = import_node_path49.default.join(paths.providersDir, `${name}.json`);
120185
120417
  return { name, path: providerPath, raw: realFsPort.readFileUtf8(providerPath) };
120186
120418
  });
120187
120419
  const ownExecutablePath = realOwnExecutablePath();
@@ -120193,12 +120425,12 @@ function collectDoctorReport(params) {
120193
120425
  binaryDiscovery = { ok: false, message: error63 instanceof Error ? error63.message : String(error63) };
120194
120426
  }
120195
120427
  const shimState = readJson(paths.claudeShimFile, ClaudeShimStateSchema);
120196
- const pathDirs = (params.env.PATH ?? "").split(import_node_path48.default.delimiter).filter((dir) => dir !== "");
120428
+ const pathDirs = (params.env.PATH ?? "").split(import_node_path49.default.delimiter).filter((dir) => dir !== "");
120197
120429
  const claudeShimShadow = shimState === void 0 ? void 0 : refinePathShadow(
120198
120430
  findPathShadow({
120199
120431
  pathDirs,
120200
- targetDir: import_node_path48.default.dirname(shimState.targetPath),
120201
- targetFilename: import_node_path48.default.basename(shimState.targetPath),
120432
+ targetDir: import_node_path49.default.dirname(shimState.targetPath),
120433
+ targetFilename: import_node_path49.default.basename(shimState.targetPath),
120202
120434
  findExecutableInDir
120203
120435
  }),
120204
120436
  shimState.targetPath,
@@ -120232,7 +120464,7 @@ function collectDoctorReport(params) {
120232
120464
  agentShim: refinePathShadow(
120233
120465
  findPathShadow({
120234
120466
  pathDirs,
120235
- targetDir: import_node_path48.default.dirname(ownExecutablePath),
120467
+ targetDir: import_node_path49.default.dirname(ownExecutablePath),
120236
120468
  targetFilename: commandFilename(ownExecutablePath, "agent-shim"),
120237
120469
  findExecutableInDir
120238
120470
  }),
@@ -125768,7 +126000,7 @@ var ResetRowSchema = external_exports.strictObject({
125768
126000
  var ResetScheduleSchema = external_exports.strictObject({ resets: external_exports.readonly(external_exports.array(ResetRowSchema)) });
125769
126001
 
125770
126002
  // src/frontdoor/controlSchemas.ts
125771
- var import_node_path49 = __toESM(require("node:path"), 1);
126003
+ var import_node_path50 = __toESM(require("node:path"), 1);
125772
126004
  init_zod();
125773
126005
  init_schema2();
125774
126006
 
@@ -125980,11 +126212,11 @@ var FrontDoorSessionsOutputSchema = external_exports.strictObject({ sessions: ex
125980
126212
  var CheckRunInputSchema = external_exports.strictObject({
125981
126213
  path: external_exports.string().min(1),
125982
126214
  identity: external_exports.string().min(1).optional()
125983
- }).refine((input2) => import_node_path49.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
126215
+ }).refine((input2) => import_node_path50.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
125984
126216
  var PoolPickInputSchema = external_exports.strictObject({
125985
126217
  pool: external_exports.string().min(1),
125986
126218
  path: external_exports.string().min(1)
125987
- }).refine((input2) => import_node_path49.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
126219
+ }).refine((input2) => import_node_path50.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
125988
126220
  var DoctorFindingSchema = external_exports.strictObject({
125989
126221
  section: external_exports.enum(DOCTOR_SECTIONS),
125990
126222
  subject: external_exports.string().optional(),
@@ -128826,7 +129058,7 @@ function createLifecycleApiRouter(deps) {
128826
129058
  init_cliError();
128827
129059
 
128828
129060
  // src/frontdoor/launchSchemas.ts
128829
- var import_node_path50 = __toESM(require("node:path"), 1);
129061
+ var import_node_path51 = __toESM(require("node:path"), 1);
128830
129062
  init_zod();
128831
129063
  init_claudeVersion();
128832
129064
  init_identity();
@@ -128836,7 +129068,7 @@ var LaunchResolveInputSchema = external_exports.strictObject({
128836
129068
  argv: external_exports.readonly(external_exports.array(external_exports.string())).optional(),
128837
129069
  /** The launch's inherited environment. Absent means an empty one: the door's own environment is never a substitute for the caller's, so a caller that wants `AGENT_SHIM_*` switches or a `CLAUDE_CONFIG_DIR` considered names them here. Values are read, never reported. */
128838
129070
  env: external_exports.record(external_exports.string(), external_exports.string()).optional()
128839
- }).refine((input2) => import_node_path50.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
129071
+ }).refine((input2) => import_node_path51.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
128840
129072
  var LaunchPoolDecisionSchema = external_exports.strictObject({
128841
129073
  name: external_exports.string(),
128842
129074
  reasons: external_exports.readonly(external_exports.array(external_exports.string())),
@@ -131158,6 +131390,39 @@ function createPassthroughRoute(name, target) {
131158
131390
  // src/frontdoor/providerRoute.ts
131159
131391
  init_conditions();
131160
131392
  init_quotaFacts();
131393
+ init_modelsStore();
131394
+
131395
+ // src/selection/candidates.ts
131396
+ var WINDOW_PERIOD_HOURS = { fiveHour: 5, sevenDay: 168, extraUsage: 168 };
131397
+ function candidateOf(ref, order, facts, isCurrent) {
131398
+ const present = Object.entries(facts.quota ?? {}).map(([name, window]) => ({ name, ...window }));
131399
+ const available = present.every((window) => window.remaining > 0);
131400
+ const remainingAllowance = present.length === 0 ? void 0 : Math.min(...present.map((window) => window.remaining));
131401
+ const hoursToReset = present.length === 0 ? void 0 : Math.min(...present.map((window) => window.hoursUntilReset));
131402
+ const pressure = present.length === 0 ? void 0 : Math.max(
131403
+ ...present.map((window) => {
131404
+ const period = WINDOW_PERIOD_HOURS[window.name] ?? Number.NaN;
131405
+ return period > 0 && window.hoursUntilReset > 0 ? window.remaining / (window.hoursUntilReset / period) : Number.NaN;
131406
+ })
131407
+ );
131408
+ return {
131409
+ ref,
131410
+ order,
131411
+ available,
131412
+ ...remainingAllowance === void 0 ? {} : { remainingAllowance },
131413
+ ...hoursToReset === void 0 ? {} : { hoursToReset },
131414
+ ...pressure === void 0 || Number.isNaN(pressure) ? {} : { pressure },
131415
+ // Feasibility at the observed burn needs a burn rate no signal yet carries, so an available candidate counts as feasible and the run-dry projection waits on one.
131416
+ feasible: available,
131417
+ ...facts.observation?.latencyMs === void 0 ? {} : { latencyMs: facts.observation.latencyMs },
131418
+ ...facts.observation?.successRate === void 0 ? {} : { successRate: facts.observation.successRate },
131419
+ ...facts.price === void 0 || facts.observation?.tokenMix === void 0 ? {} : { pricePerMTok: blendedPricePerMTok(facts.price, facts.observation.tokenMix) },
131420
+ isCurrent
131421
+ };
131422
+ }
131423
+
131424
+ // src/frontdoor/providerRoute.ts
131425
+ init_engine();
131161
131426
  init_route();
131162
131427
  var import_node_stream3 = require("node:stream");
131163
131428
 
@@ -131247,27 +131512,61 @@ function scopeSessionProviderPath(request7) {
131247
131512
  }
131248
131513
  return { ...request7, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(request7.session.provider)}${request7.url}` };
131249
131514
  }
131250
- function resolveModelTarget(model, models, includeUnqualified) {
131251
- if (models === void 0) {
131252
- return model.includes("/") && !model.startsWith("acct:") ? model.split("/")[0] : void 0;
131515
+ function resolveRoutedModel(model, providerName, session, includeUnqualified, deps, memory, rotations) {
131516
+ const models = deps.models?.();
131517
+ const qualified = model.includes("/") && !model.startsWith("acct:") ? model : void 0;
131518
+ if (qualified !== void 0) {
131519
+ const [provider2, ...rest2] = qualified.split("/");
131520
+ const named = rest2.join("/");
131521
+ return provider2 === void 0 || named === "" ? void 0 : { provider: provider2, model: named, ref: qualified };
131253
131522
  }
131254
- if (model.includes("/") && !model.startsWith("acct:")) {
131255
- return model.split("/")[0];
131523
+ const virtual = models?.virtual?.[model];
131524
+ if (virtual === void 0 || !includeUnqualified) {
131525
+ return void 0;
131256
131526
  }
131257
- if (!includeUnqualified) {
131527
+ const members2 = expandMembers(model, models).filter((member) => !member.startsWith("acct:") && !member.startsWith("family:"));
131528
+ if (members2.length === 0) {
131258
131529
  return void 0;
131259
131530
  }
131260
- const virtual = models.virtual?.[model];
131261
- const first = virtual?.members.find((member) => !member.startsWith("acct:") && !member.startsWith("family:"));
131262
- if (first === void 0) {
131531
+ const snapshot = deps.usageSnapshotOf?.(session.identity);
131532
+ const current = memory.get(session.sessionId ?? "");
131533
+ const candidates = members2.map((ref, order) => {
131534
+ const [provider2] = ref.split("/");
131535
+ const facts = quotaFactsOf(snapshot?.providers[provider2 ?? ""]?.rateLimit?.unified, Date.now());
131536
+ return candidateOf(ref, order, {
131537
+ quota: facts,
131538
+ ...deps.observations?.(ref) === void 0 ? {} : { observation: deps.observations(ref) },
131539
+ ...models?.prices?.[ref] === void 0 ? {} : { price: models.prices[ref] }
131540
+ }, ref === current);
131541
+ });
131542
+ const evaluated = candidates.map((candidate) => ({ candidate, capabilities: { vision: true, tools: true, thinking: true } }));
131543
+ const rotation = rotations.get(model) ?? 0;
131544
+ rotations.set(model, rotation + 1);
131545
+ const selection = selectMember(virtual.mode, evaluated, { rotation });
131546
+ if (selection.ref === void 0) {
131263
131547
  return void 0;
131264
131548
  }
131265
- return first.includes("/") ? first.split("/")[0] : resolveModelTarget(first, models, true);
131549
+ const [provider, ...rest] = selection.ref.split("/");
131550
+ const chosen = rest.join("/");
131551
+ return provider === void 0 || chosen === "" ? void 0 : { provider, model: chosen, ref: selection.ref };
131552
+ }
131553
+ function resolveAccountTarget(model, models) {
131554
+ if (model.startsWith("acct:")) {
131555
+ const ref = model.slice("acct:".length);
131556
+ const [identity, ...rest] = ref.split("/");
131557
+ const named = rest.join("/");
131558
+ return identity === void 0 || named === "" ? void 0 : { identity, model: named };
131559
+ }
131560
+ const virtual = models?.virtual?.[model];
131561
+ const first = virtual?.members.find((member) => member.startsWith("acct:"));
131562
+ return first === void 0 ? void 0 : resolveAccountTarget(first, void 0);
131266
131563
  }
131267
131564
  function createProviderRouteResolver(deps) {
131268
131565
  const oauthRoute = createPassthroughRoute("anthropic", { baseUrl: `https://${CONNECT_INTERCEPT_HOST}:${String(HTTPS_PORT)}`, stripPrefix: void 0, headroomUpstream: void 0 });
131269
131566
  const antigravityQuotaSources = /* @__PURE__ */ new Map();
131270
131567
  const antigravityRoutingMemory = /* @__PURE__ */ new Map();
131568
+ const routingMemory = /* @__PURE__ */ new Map();
131569
+ const rotations = /* @__PURE__ */ new Map();
131271
131570
  const memoryFor = (provider) => {
131272
131571
  const existing = antigravityRoutingMemory.get(provider);
131273
131572
  if (existing !== void 0) {
@@ -131429,22 +131728,45 @@ function createProviderRouteResolver(deps) {
131429
131728
  }
131430
131729
  const routesByName = (isRouter || current.session.routeByName) && !isRcSelfHostPath(path65);
131431
131730
  if (routesByName) {
131432
- const scan2 = await scanRequestHead(current, false);
131433
- if (scan2.replayed !== void 0) {
131434
- replay = scan2.replayed;
131435
- }
131436
- const target = scan2.model === void 0 ? void 0 : resolveModelTarget(scan2.model, deps.models?.(), isRouter || current.session.routeByName && providerName !== void 0);
131437
- if (target === providerName) {
131731
+ const scan2 = await scanRequestHead(current, true);
131732
+ if (scan2.replayed === void 0) {
131438
131733
  const resolution = resolve2(current);
131439
131734
  return resolution.ok && replay !== void 0 ? { ok: true, route: servingRewritten(resolution.route, { ...replay, url: current.url }), request: { ...replay, url: current.url } } : resolution.ok ? serveScoped(resolution) : resolution;
131440
131735
  }
131441
- if (target !== void 0) {
131442
- const scopedPrefix = providerName === void 0 ? void 0 : `${PROVIDER_PATH_PREFIX}${encodeURIComponent(providerName)}`;
131443
- const rest2 = scopedPrefix !== void 0 && path65.startsWith(scopedPrefix) ? path65.slice(scopedPrefix.length) : path65;
131444
- const query2 = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
131445
- const carried = scan2.replayed ?? current;
131446
- current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(target)}${rest2}${query2}`, body: carried.body, headers: carried.headers };
131447
- continue;
131736
+ replay = scan2.replayed;
131737
+ const account = scan2.model === void 0 ? void 0 : resolveAccountTarget(scan2.model, deps.models?.());
131738
+ if (account !== void 0) {
131739
+ const sessionId = current.session.sessionId ?? "";
131740
+ const moved = sessionId !== "" && (deps.accountMoves?.(sessionId, account.identity, account.model) ?? false);
131741
+ return {
131742
+ ok: false,
131743
+ status: HTTP_STATUS.badRequest,
131744
+ message: moved ? `model "${account.model}" runs under identity "${account.identity}"; this session is being moved there and will resume with it` : `model "${account.model}" runs under identity "${account.identity}", which needs a relaunch this session cannot make; start it there with: claude @${account.identity} --resume`
131745
+ };
131746
+ }
131747
+ const routed = scan2.model === void 0 ? void 0 : resolveRoutedModel(scan2.model, providerName, current.session, isRouter || providerName !== void 0, deps, routingMemory, rotations);
131748
+ const requested = scan2.model;
131749
+ if (routed !== void 0) {
131750
+ routingMemory.set(current.session.sessionId ?? "", routed.ref);
131751
+ if (requested !== void 0 && routed.provider === providerName && routed.model === requested) {
131752
+ const resolution2 = resolve2(current);
131753
+ return resolution2.ok ? { ok: true, route: servingRewritten(resolution2.route, { ...replay, url: current.url }), request: { ...replay, url: current.url } } : resolution2;
131754
+ }
131755
+ if (requested !== void 0 && routed.model !== requested) {
131756
+ const rewritten = (scan2.text ?? "").replace(new RegExp('"model":\\s*"' + requested.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + '"'), '"model":"' + routed.model + '"');
131757
+ const headers = Object.fromEntries(Object.entries(replay.headers).filter(([name]) => name.toLowerCase() !== "content-length"));
131758
+ replay = { ...replay, headers, body: import_node_stream3.Readable.from([Buffer.from(rewritten, "utf8")]) };
131759
+ }
131760
+ if (routed.provider !== providerName) {
131761
+ const scopedPrefix = providerName === void 0 ? void 0 : `${PROVIDER_PATH_PREFIX}${encodeURIComponent(providerName)}`;
131762
+ const rest2 = scopedPrefix !== void 0 && path65.startsWith(scopedPrefix) ? path65.slice(scopedPrefix.length) : path65;
131763
+ const query2 = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
131764
+ const carried = replay;
131765
+ current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(routed.provider)}${rest2}${query2}`, body: carried.body, headers: carried.headers };
131766
+ continue;
131767
+ }
131768
+ const resolution = resolve2(current);
131769
+ return resolution.ok ? { ok: true, route: servingRewritten(resolution.route, { ...replay, url: current.url }), request: { ...replay, url: current.url } } : resolution;
131448
131770
  }
131449
131771
  }
131450
131772
  if (routes === void 0 || routes.length === 0) {
@@ -131598,7 +131920,7 @@ function createRcLiveUsage(deps) {
131598
131920
  }
131599
131921
 
131600
131922
  // src/frontdoor/rcSelfHostMint.ts
131601
- var import_node_path51 = __toESM(require("node:path"), 1);
131923
+ var import_node_path52 = __toESM(require("node:path"), 1);
131602
131924
  init_account();
131603
131925
 
131604
131926
  // src/frontdoor/rcSelfHostLocal.ts
@@ -131728,7 +132050,7 @@ function readJsonObject(fs26, file2) {
131728
132050
  return isRecord16(parsed) ? parsed : void 0;
131729
132051
  }
131730
132052
  function readRcSelfHostRecord(fs26, frontdoorDir) {
131731
- const parsed = readJsonObject(fs26, import_node_path51.default.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
132053
+ const parsed = readJsonObject(fs26, import_node_path52.default.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
131732
132054
  if (parsed === void 0) {
131733
132055
  return void 0;
131734
132056
  }
@@ -131742,11 +132064,11 @@ function mintRcSelfHostCredential(deps) {
131742
132064
  if (!isIdentityName(deps.identity)) {
131743
132065
  throw new Error(`"${deps.identity}" is not a valid identity name.`);
131744
132066
  }
131745
- const identityDir = import_node_path51.default.join(deps.identitiesDir, deps.identity);
131746
- const credentialsFile = import_node_path51.default.join(identityDir, CREDENTIALS_FILE2);
131747
- const claudeJsonFile = import_node_path51.default.join(identityDir, CLAUDE_JSON2);
131748
- const recordDir = import_node_path51.default.join(deps.frontdoorDir, RC_SELF_HOST_RECORD_DIR);
131749
- const recordFile = import_node_path51.default.join(recordDir, RC_SELF_HOST_RECORD_FILE);
132067
+ const identityDir = import_node_path52.default.join(deps.identitiesDir, deps.identity);
132068
+ const credentialsFile = import_node_path52.default.join(identityDir, CREDENTIALS_FILE2);
132069
+ const claudeJsonFile = import_node_path52.default.join(identityDir, CLAUDE_JSON2);
132070
+ const recordDir = import_node_path52.default.join(deps.frontdoorDir, RC_SELF_HOST_RECORD_DIR);
132071
+ const recordFile = import_node_path52.default.join(recordDir, RC_SELF_HOST_RECORD_FILE);
131750
132072
  const previousRecord = readRcSelfHostRecord(deps.fs, deps.frontdoorDir);
131751
132073
  const existingCredentials = readJsonObject(deps.fs, credentialsFile);
131752
132074
  const existingOauth = isRecord16(existingCredentials?.claudeAiOauth) ? existingCredentials.claudeAiOauth : void 0;
@@ -131762,7 +132084,7 @@ function mintRcSelfHostCredential(deps) {
131762
132084
  const organizationUuid = deps.newUuid();
131763
132085
  const accountUuid = deps.newUuid();
131764
132086
  const mintedAt = new Date(deps.now()).toISOString();
131765
- deps.fs.mkdirPrivate(import_node_path51.default.dirname(credentialsFile));
132087
+ deps.fs.mkdirPrivate(import_node_path52.default.dirname(credentialsFile));
131766
132088
  deps.fs.writeFilePrivate(credentialsFile, `${JSON.stringify({ ...existingCredentials, claudeAiOauth: { accessToken, refreshToken, expiresAt: null, scopes: [...RC_SELF_HOST_SCOPE_LIST], subscriptionType: SELF_HOST_SUBSCRIPTION_TYPE, rateLimitTier: null } }, null, 2)}
131767
132089
  `);
131768
132090
  const claudeJson = readJsonObject(deps.fs, claudeJsonFile) ?? {};
@@ -132149,7 +132471,7 @@ function registerRcCommand(frontdoor, paths) {
132149
132471
  }
132150
132472
 
132151
132473
  // src/frontdoor/rcCredentialStore.ts
132152
- var import_node_path52 = __toESM(require("node:path"), 1);
132474
+ var import_node_path53 = __toESM(require("node:path"), 1);
132153
132475
  function isSafeSessionId(sessionId) {
132154
132476
  return /^[A-Za-z0-9_-]+$/.test(sessionId);
132155
132477
  }
@@ -132175,7 +132497,7 @@ function sequenceNumOfJson(value2) {
132175
132497
  }
132176
132498
  function createRcCredentialStore(fs26, dir) {
132177
132499
  fs26.mkdirPrivate(dir);
132178
- const fileFor = (sessionId) => import_node_path52.default.join(dir, `${sessionId}.json`);
132500
+ const fileFor = (sessionId) => import_node_path53.default.join(dir, `${sessionId}.json`);
132179
132501
  const readParsed = (sessionId) => {
132180
132502
  const raw = fs26.readFileUtf8(fileFor(sessionId));
132181
132503
  if (raw === void 0) {
@@ -134515,67 +134837,6 @@ function createRealQuotaRefresher(params) {
134515
134837
 
134516
134838
  // src/frontdoor/commands.ts
134517
134839
  init_store2();
134518
-
134519
- // src/selection/targetStore.ts
134520
- init_read();
134521
-
134522
- // src/selection/signals.ts
134523
- function targetOf(record2) {
134524
- return record2.model === void 0 ? void 0 : `${record2.provider}/${record2.model}`;
134525
- }
134526
- function median(values) {
134527
- if (values.length === 0) {
134528
- return void 0;
134529
- }
134530
- const sorted = [...values].sort((left, right) => left - right);
134531
- const middle = Math.floor(sorted.length / 2);
134532
- const above = sorted[middle];
134533
- const below = sorted[middle - 1];
134534
- return sorted.length % 2 === 0 && above !== void 0 && below !== void 0 ? (above + below) / 2 : sorted[middle];
134535
- }
134536
- var OBSERVATION_WINDOW = 20;
134537
- function observeRecord(observations, record2) {
134538
- const target = targetOf(record2);
134539
- if (target === void 0) {
134540
- return new Map(observations);
134541
- }
134542
- const kept = [...observations.get(target) ?? [], record2].slice(-OBSERVATION_WINDOW);
134543
- return new Map(observations).set(target, kept);
134544
- }
134545
- function observationOf(records) {
134546
- const completed = records.filter((record2) => record2.outcome === "completed");
134547
- const latencies = completed.map((record2) => record2.latencyMs);
134548
- const usage = records.flatMap((record2) => record2.usage === void 0 ? [] : [record2.usage]);
134549
- const input2 = usage.reduce((sum, entry) => sum + (entry.inputTokens ?? 0), 0);
134550
- const output2 = usage.reduce((sum, entry) => sum + (entry.outputTokens ?? 0), 0);
134551
- const cacheRead = usage.reduce((sum, entry) => sum + (entry.cacheReadInputTokens ?? 0), 0);
134552
- return {
134553
- latencyMs: median(latencies),
134554
- successRate: records.length === 0 ? void 0 : completed.length / records.length,
134555
- tokenMix: input2 + output2 + cacheRead === 0 ? void 0 : { input: input2, output: output2, cacheRead }
134556
- };
134557
- }
134558
-
134559
- // src/selection/targetStore.ts
134560
- var SEED_LOOKBACK_RECORDS = 500;
134561
- function createTargetObservationStore(fs26, paths) {
134562
- let observations = /* @__PURE__ */ new Map();
134563
- const seeded = readUsageLog(fs26, paths.usageLogDir, {}).records.slice(-SEED_LOOKBACK_RECORDS);
134564
- for (const record2 of seeded) {
134565
- observations = observeRecord(observations, record2);
134566
- }
134567
- return {
134568
- observe: (record2) => {
134569
- observations = observeRecord(observations, record2);
134570
- },
134571
- observation: (target) => {
134572
- const records = observations.get(target);
134573
- return records === void 0 ? void 0 : observationOf(records);
134574
- }
134575
- };
134576
- }
134577
-
134578
- // src/frontdoor/commands.ts
134579
134840
  function respawnInvocation(paths) {
134580
134841
  const env = {};
134581
134842
  for (const [name, value2] of Object.entries({ ...process.env, AGENT_SHIM_HOME: paths.root })) {
@@ -134660,6 +134921,7 @@ function realFrontDoorSupervisorPorts(paths) {
134660
134921
  appendLog(paths, `frontdoor ${String(process.pid)}: ${line}`);
134661
134922
  }
134662
134923
  });
134924
+ const observations = createTargetObservationStore(realFarmFs, paths);
134663
134925
  const routingSnapshots = /* @__PURE__ */ new Map();
134664
134926
  const rcControlToken = (0, import_node_crypto25.randomUUID)();
134665
134927
  const resolveRoute = rcObservingResolver(
@@ -134674,6 +134936,15 @@ function realFrontDoorSupervisorPorts(paths) {
134674
134936
  env: process.env,
134675
134937
  credentials: { ...realCredentialPort, cache: realCredentialCacheEnv(paths) },
134676
134938
  usageSnapshotOf: (identity) => identity === void 0 ? void 0 : routingSnapshots.get(identity) ?? readUsageSnapshot(realFarmFs, paths.usageSnapshotsDir, identity),
134939
+ // An `acct:` model member is served by relaunch: the door leaves a move request for the session's supervisor (found across every pool's registry, since the door does not know which pool launched the session) and answers the request with what is happening. A session nothing supervises gets the message naming the command to run instead.
134940
+ observations: (target) => observations.observation(target),
134941
+ accountMoves: (sessionId, to2, model) => {
134942
+ if (supervisedSessionOf(realFarmFs, paths, sessionId, realIsProcessRunning) === void 0) {
134943
+ return false;
134944
+ }
134945
+ writeModelMove(realFarmFs, paths, { sessionId, to: to2, model, at: (/* @__PURE__ */ new Date()).toISOString() });
134946
+ return true;
134947
+ },
134677
134948
  ...rcSelfHostSurface === void 0 ? {} : { rcSelfHostRoute: rcSelfHostSurface.route }
134678
134949
  }),
134679
134950
  rcTracker,
@@ -134690,6 +134961,9 @@ function realFrontDoorSupervisorPorts(paths) {
134690
134961
  publish: (snapshot) => {
134691
134962
  routingSnapshots.set(snapshot.identity, snapshot);
134692
134963
  usagePublisher.publish(snapshot);
134964
+ },
134965
+ onRecord: (record2) => {
134966
+ observations.observe(record2);
134693
134967
  }
134694
134968
  });
134695
134969
  const quotaRefresher = createRealQuotaRefresher({ paths, store: usageStore, log });
@@ -134929,7 +135203,7 @@ function realFrontDoorSupervisorPorts(paths) {
134929
135203
  const leafFor = createLeafCache(loadCa(), () => /* @__PURE__ */ new Date());
134930
135204
  const capture = captureFromEnv(process.env, paths.logsDir);
134931
135205
  if (capture !== void 0) {
134932
- log(`capture enabled, recording CONNECT targets and piped exchanges to ${import_node_path53.default.join(paths.logsDir, "frontdoor-capture.jsonl")}`);
135206
+ log(`capture enabled, recording CONNECT targets and piped exchanges to ${import_node_path54.default.join(paths.logsDir, "frontdoor-capture.jsonl")}`);
134933
135207
  }
134934
135208
  if (rcSelfHostSurface !== void 0) {
134935
135209
  log("self-hosted Remote Control surface on: the door serves the CCR session family itself, and its own client-half dials its own transparent surface");
@@ -135075,7 +135349,7 @@ function registerFrontDoorCommand(program2, deps) {
135075
135349
  // src/statusline/commands.ts
135076
135350
  var import_node_child_process7 = require("node:child_process");
135077
135351
  var import_node_os12 = __toESM(require("node:os"), 1);
135078
- var import_node_path55 = __toESM(require("node:path"), 1);
135352
+ var import_node_path56 = __toESM(require("node:path"), 1);
135079
135353
  init_commandDeps();
135080
135354
  init_providersStore();
135081
135355
  init_realPorts();
@@ -135083,13 +135357,13 @@ init_account();
135083
135357
  init_read();
135084
135358
 
135085
135359
  // src/statusline/client.ts
135086
- var import_node_path54 = __toESM(require("node:path"), 1);
135360
+ var import_node_path55 = __toESM(require("node:path"), 1);
135087
135361
  function isAntigravityPayload(payload) {
135088
135362
  return typeof payload === "object" && payload !== null && "product" in payload && payload.product === "antigravity";
135089
135363
  }
135090
135364
  var ANTIGRAVITY_SETTINGS_SEGMENTS = [".gemini", "antigravity-cli", "settings.json"];
135091
135365
  function antigravityStacksWithDefault(fs26, homeDir) {
135092
- const raw = fs26.readFileUtf8(import_node_path54.default.join(homeDir, ...ANTIGRAVITY_SETTINGS_SEGMENTS));
135366
+ const raw = fs26.readFileUtf8(import_node_path55.default.join(homeDir, ...ANTIGRAVITY_SETTINGS_SEGMENTS));
135093
135367
  if (raw === void 0) {
135094
135368
  return false;
135095
135369
  }
@@ -135307,7 +135581,8 @@ function enrichStatuslinePayload(params) {
135307
135581
  sevenDayResetAt: void 0,
135308
135582
  providerQuotaWindows: [],
135309
135583
  quotaFamilies: [],
135310
- headroom: params.headroom
135584
+ headroom: params.headroom,
135585
+ routedTarget: params.routedTarget
135311
135586
  };
135312
135587
  if (params.snapshot !== void 0) {
135313
135588
  const scopedName = providerScopedState(params.snapshot, params.providerName, params.env.AGENT_SHIM_PROVIDER);
@@ -135381,6 +135656,9 @@ function providerScopedState(snapshot, providerName, providerDisplayName) {
135381
135656
  return void 0;
135382
135657
  }
135383
135658
 
135659
+ // src/statusline/commands.ts
135660
+ init_read();
135661
+
135384
135662
  // src/statusline/ansi.ts
135385
135663
  var ESCAPE_CHAR_CODE = 27;
135386
135664
  var ESCAPE = String.fromCharCode(ESCAPE_CHAR_CODE);
@@ -135672,6 +135950,9 @@ function renderStatuslineBlock(summary, view, terminalWidth, nowMs) {
135672
135950
  const account = [summary.providerAccountEmail, summary.providerPlan].filter((part) => part !== void 0);
135673
135951
  header.push(account.length > 0 ? `${summary.provider} \xB7 ${account.join(" \xB7 ")}` : summary.provider);
135674
135952
  }
135953
+ if (summary.routedTarget !== void 0) {
135954
+ header.push(`via ${summary.routedTarget}`);
135955
+ }
135675
135956
  const loginPlan = summary.provider === void 0 ? summary.loginPlan ?? accountPlanLabel(summary) : void 0;
135676
135957
  const loginOrgName = summary.loginOrganizationType === "claude_team" || summary.loginOrganizationType === "claude_enterprise" ? summary.loginOrganizationName : void 0;
135677
135958
  const loginParts = [summary.loginAccountEmail, loginOrgName, loginPlan].filter((part) => part !== void 0);
@@ -135775,6 +136056,7 @@ async function readAllStdin() {
135775
136056
  process.stdin.resume();
135776
136057
  });
135777
136058
  }
136059
+ var ROUTED_TARGET_LOOKBACK_MS = 36e5;
135778
136060
  function registerStatuslineCommand(program2, deps) {
135779
136061
  withExamples(
135780
136062
  program2.command("statusline").description("Serve as a statusline entrypoint: read the client's stdin payload, add the identity's live provider, account and usage windows under an agent_shim key, then run the renderer named in AGENT_SHIM_STATUSLINE_CMD or print the built-in line.").action(async () => {
@@ -135802,7 +136084,7 @@ function registerStatuslineCommand(program2, deps) {
135802
136084
  } else {
135803
136085
  const configDir = process.env.CLAUDE_CONFIG_DIR;
135804
136086
  try {
135805
- account = readAccountMetadataFile(realFarmFs, configDir === void 0 || configDir === "" ? import_node_path55.default.join(import_node_os12.default.homedir(), ".claude.json") : import_node_path55.default.join(configDir, ".claude.json"));
136087
+ account = readAccountMetadataFile(realFarmFs, configDir === void 0 || configDir === "" ? import_node_path56.default.join(import_node_os12.default.homedir(), ".claude.json") : import_node_path56.default.join(configDir, ".claude.json"));
135806
136088
  } catch {
135807
136089
  account = void 0;
135808
136090
  }
@@ -135821,7 +136103,19 @@ function registerStatuslineCommand(program2, deps) {
135821
136103
  const target = headroomTargetOf(process.env, socketTarget === void 0 || socketTarget.refused !== void 0 ? void 0 : socketTarget.socketPath);
135822
136104
  const sessionId = headroomSessionIdOf(payload, process.env);
135823
136105
  const headroom = target === void 0 || sessionId === void 0 ? void 0 : await fetchHeadroomSessionStats(realHeadroomGet, target, sessionId);
135824
- const { payload: enriched, summary } = enrichStatuslinePayload({ payload, env: process.env, snapshot, account, providerName, nowMs, headroom });
136106
+ const sessionHeader = /x-agent-shim-session:\s*([A-Za-z0-9@._-]+)/i.exec(process.env.ANTHROPIC_CUSTOM_HEADERS ?? "")?.[1];
136107
+ let routedTarget;
136108
+ if (sessionHeader !== void 0) {
136109
+ try {
136110
+ const last = readUsageLog(realFarmFs, deps.paths.usageLogDir, { sinceMs: nowMs - ROUTED_TARGET_LOOKBACK_MS }).records.filter((record2) => record2.sessionId === sessionHeader).at(-1);
136111
+ if (last?.model !== void 0 && last.provider !== providerName) {
136112
+ routedTarget = `${last.provider}/${last.model}`;
136113
+ }
136114
+ } catch {
136115
+ routedTarget = void 0;
136116
+ }
136117
+ }
136118
+ const { payload: enriched, summary } = enrichStatuslinePayload({ payload, env: process.env, snapshot, account, providerName, nowMs, headroom, routedTarget });
135825
136119
  const renderer = process.env.AGENT_SHIM_STATUSLINE_CMD;
135826
136120
  if (renderer !== void 0 && renderer !== "") {
135827
136121
  const child = (0, import_node_child_process7.spawn)("/bin/sh", ["-c", renderer], { stdio: ["pipe", "inherit", "inherit"] });
@@ -145595,7 +145889,7 @@ async function serveMcp(mcp, transport, options = {}) {
145595
145889
 
145596
145890
  // src/mcp/permissions.ts
145597
145891
  var import_node_fs20 = __toESM(require("node:fs"), 1);
145598
- var import_node_path56 = __toESM(require("node:path"), 1);
145892
+ var import_node_path57 = __toESM(require("node:path"), 1);
145599
145893
  init_zod();
145600
145894
  init_store();
145601
145895
  var StoredMcpPermissionsSchema = external_exports.strictObject({
@@ -145617,10 +145911,10 @@ function effectiveMcpPermissions(flags, stored) {
145617
145911
  return { writes: flags.writes || stored.writes, remoteControl: flags.remoteControl || stored.remoteControl, history: flags.history || stored.history };
145618
145912
  }
145619
145913
  function watchMcpPermissions(paths, onChange) {
145620
- const directory = import_node_path56.default.dirname(paths.mcpPermissionsFile);
145914
+ const directory = import_node_path57.default.dirname(paths.mcpPermissionsFile);
145621
145915
  import_node_fs20.default.mkdirSync(directory, { recursive: true });
145622
145916
  const watcher = import_node_fs20.default.watch(directory, (_event, filename) => {
145623
- if (filename === null || filename === import_node_path56.default.basename(paths.mcpPermissionsFile)) {
145917
+ if (filename === null || filename === import_node_path57.default.basename(paths.mcpPermissionsFile)) {
145624
145918
  onChange();
145625
145919
  }
145626
145920
  });
@@ -145934,16 +146228,16 @@ init_credentialCache();
145934
146228
 
145935
146229
  // src/identityToken.ts
145936
146230
  var import_node_fs21 = __toESM(require("node:fs"), 1);
145937
- var import_node_path57 = __toESM(require("node:path"), 1);
146231
+ var import_node_path58 = __toESM(require("node:path"), 1);
145938
146232
  init_cliError();
145939
146233
  var TOKEN_FILE_MODE = 384;
145940
146234
  var TOKEN_DIR_MODE = 448;
145941
146235
  var OAUTH_TOKEN_RE = /^sk-ant-oat\d+-[A-Za-z0-9_-]+$/;
145942
146236
  function identityTokenDir(paths) {
145943
- return import_node_path57.default.join(paths.root, "credentials");
146237
+ return import_node_path58.default.join(paths.root, "credentials");
145944
146238
  }
145945
146239
  function identityTokenPath(paths, identityName) {
145946
- return import_node_path57.default.join(identityTokenDir(paths), `${identityName}.token`);
146240
+ return import_node_path58.default.join(identityTokenDir(paths), `${identityName}.token`);
145947
146241
  }
145948
146242
  function storeIdentityToken(paths, identityName, raw) {
145949
146243
  const token = raw.trim();
@@ -145954,7 +146248,7 @@ function storeIdentityToken(paths, identityName, raw) {
145954
146248
  import_node_fs21.default.mkdirSync(dir, { recursive: true, mode: TOKEN_DIR_MODE });
145955
146249
  import_node_fs21.default.chmodSync(dir, TOKEN_DIR_MODE);
145956
146250
  const target = identityTokenPath(paths, identityName);
145957
- const temp = import_node_path57.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
146251
+ const temp = import_node_path58.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
145958
146252
  import_node_fs21.default.writeFileSync(temp, `${token}
145959
146253
  `, { mode: TOKEN_FILE_MODE });
145960
146254
  import_node_fs21.default.renameSync(temp, target);
@@ -146125,7 +146419,7 @@ function registerDoctorCommand(program2, deps) {
146125
146419
  // src/headroom/commands.ts
146126
146420
  var import_node_fs22 = __toESM(require("node:fs"), 1);
146127
146421
  var import_node_http5 = __toESM(require("node:http"), 1);
146128
- var import_node_path58 = __toESM(require("node:path"), 1);
146422
+ var import_node_path59 = __toESM(require("node:path"), 1);
146129
146423
  var import_node_child_process9 = require("node:child_process");
146130
146424
  init_commandDeps();
146131
146425
  init_configProfilesStore();
@@ -146315,12 +146609,12 @@ function readInstalledHeadroomCommit() {
146315
146609
  if (toolDir.status !== 0) {
146316
146610
  return void 0;
146317
146611
  }
146318
- const libDir = import_node_path58.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
146612
+ const libDir = import_node_path59.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
146319
146613
  for (const python of realFarmFs.readdir(libDir)) {
146320
- const sitePackages = import_node_path58.default.join(libDir, python, "site-packages");
146614
+ const sitePackages = import_node_path59.default.join(libDir, python, "site-packages");
146321
146615
  for (const entry of realFarmFs.readdir(sitePackages)) {
146322
146616
  if (entry.startsWith("headroom_ai-") && entry.endsWith(".dist-info")) {
146323
- const directUrl = realFarmFs.readFileUtf8(import_node_path58.default.join(sitePackages, entry, "direct_url.json"));
146617
+ const directUrl = realFarmFs.readFileUtf8(import_node_path59.default.join(sitePackages, entry, "direct_url.json"));
146324
146618
  return directUrl === void 0 ? void 0 : parseInstalledCommit(directUrl);
146325
146619
  }
146326
146620
  }
@@ -146470,112 +146764,6 @@ init_realPorts();
146470
146764
 
146471
146765
  // src/supervise/marks.ts
146472
146766
  init_resumeContext();
146473
-
146474
- // src/supervise/registry.ts
146475
- var import_node_path59 = __toESM(require("node:path"), 1);
146476
- init_zod();
146477
- var SupervisedSessionSchema = external_exports.strictObject({
146478
- /** The launcher's process id, which is what tells a live entry from one a crashed launcher left behind. */
146479
- pid: external_exports.number().int().positive(),
146480
- sessionId: external_exports.string().min(1),
146481
- pool: external_exports.string().min(1),
146482
- /** The identity the session is running as now. */
146483
- identity: external_exports.string().min(1),
146484
- cwd: external_exports.string().min(1),
146485
- /** When the session began running as `identity`: its launch, or the move that brought it there. */
146486
- since: external_exports.iso.datetime(),
146487
- /** The size in tokens of the context the session carried onto `identity` when it moved there; absent for a launch, which carries none. */
146488
- carriedTokens: external_exports.number().int().nonnegative().optional()
146489
- });
146490
- var SessionStateSchema = external_exports.strictObject({
146491
- /** `busy` from the moment a prompt is submitted until the turn ends, `idle` from then until the next prompt: the only times the child can be stopped without losing a turn. */
146492
- mark: external_exports.enum(["busy", "idle"]),
146493
- /** The size in tokens of the context as of the last turn that ended; absent until one has. */
146494
- contextTokens: external_exports.number().int().nonnegative().optional(),
146495
- /** Whether the session was compacted during its stay on the member it runs on now. Set by the supervisor, kept by later marks, and cleared when the session moves. */
146496
- compacted: external_exports.boolean().optional(),
146497
- at: external_exports.iso.datetime()
146498
- });
146499
- function superviseDirOf(paths, pool) {
146500
- return import_node_path59.default.join(paths.superviseDir, pool);
146501
- }
146502
- function sessionsDirOf(paths, pool) {
146503
- return import_node_path59.default.join(superviseDirOf(paths, pool), "sessions");
146504
- }
146505
- function sessionFileOf(paths, pool, sessionId) {
146506
- return import_node_path59.default.join(sessionsDirOf(paths, pool), `${sessionId}.json`);
146507
- }
146508
- function stateDirOf(paths, pool) {
146509
- return import_node_path59.default.join(superviseDirOf(paths, pool), "state");
146510
- }
146511
- function sessionStatePath(paths, pool, sessionId) {
146512
- return import_node_path59.default.join(stateDirOf(paths, pool), `${sessionId}.json`);
146513
- }
146514
- function writeSessionState(fs26, paths, pool, sessionId, state) {
146515
- fs26.mkdirPrivate(stateDirOf(paths, pool));
146516
- fs26.writeFilePrivate(sessionStatePath(paths, pool, sessionId), `${JSON.stringify(SessionStateSchema.parse(state))}
146517
- `);
146518
- }
146519
- function readSessionState(fs26, paths, pool, sessionId) {
146520
- const raw = fs26.readFileUtf8(sessionStatePath(paths, pool, sessionId));
146521
- if (raw === void 0) {
146522
- return void 0;
146523
- }
146524
- try {
146525
- const parsed = SessionStateSchema.safeParse(JSON.parse(raw));
146526
- return parsed.success ? parsed.data : void 0;
146527
- } catch {
146528
- return void 0;
146529
- }
146530
- }
146531
- function registerSupervised(fs26, paths, session) {
146532
- fs26.mkdirPrivate(sessionsDirOf(paths, session.pool));
146533
- fs26.writeFilePrivate(sessionFileOf(paths, session.pool, session.sessionId), `${JSON.stringify(SupervisedSessionSchema.parse(session))}
146534
- `);
146535
- }
146536
- function unregisterSupervised(fs26, paths, pool, sessionId) {
146537
- fs26.removeRecursive(sessionFileOf(paths, pool, sessionId));
146538
- fs26.removeRecursive(sessionStatePath(paths, pool, sessionId));
146539
- }
146540
- function liveSupervised(fs26, paths, pool, isRunning) {
146541
- const live = [];
146542
- for (const name of fs26.readdir(sessionsDirOf(paths, pool))) {
146543
- const file2 = import_node_path59.default.join(sessionsDirOf(paths, pool), name);
146544
- const raw = fs26.readFileUtf8(file2);
146545
- if (raw === void 0) {
146546
- continue;
146547
- }
146548
- let parsed;
146549
- try {
146550
- parsed = SupervisedSessionSchema.safeParse(JSON.parse(raw));
146551
- } catch {
146552
- fs26.removeRecursive(file2);
146553
- continue;
146554
- }
146555
- if (parsed.success && isRunning(parsed.data.pid)) {
146556
- live.push(parsed.data);
146557
- } else {
146558
- fs26.removeRecursive(file2);
146559
- }
146560
- }
146561
- return live;
146562
- }
146563
- function committedContextTokens(sessions, records) {
146564
- const committed = {};
146565
- for (const session of sessions) {
146566
- if (session.carriedTokens === void 0) {
146567
- continue;
146568
- }
146569
- const sinceMs = Date.parse(session.since);
146570
- const written = records.some((record2) => record2.sessionId === session.sessionId && record2.identity === session.identity && Date.parse(record2.at) >= sinceMs);
146571
- if (!written) {
146572
- committed[session.identity] = (committed[session.identity] ?? 0) + session.carriedTokens;
146573
- }
146574
- }
146575
- return committed;
146576
- }
146577
-
146578
- // src/supervise/marks.ts
146579
146767
  var MARK_HOOK_TIMEOUT_SECONDS = 10;
146580
146768
  var SUPERVISE_MARK_COMMAND = "__supervise-mark";
146581
146769
  function shellQuote(value2) {
@@ -147451,6 +147639,52 @@ function sameFamilyOtherVersion(a10, b) {
147451
147639
 
147452
147640
  // src/models.ts
147453
147641
  init_modelsStore();
147642
+ init_realPorts();
147643
+ init_read();
147644
+ init_quotaFacts();
147645
+ init_engine();
147646
+ function providerQuotaOf(paths) {
147647
+ const newest = /* @__PURE__ */ new Map();
147648
+ for (const name of realFarmFs.readdir(paths.usageSnapshotsDir)) {
147649
+ if (!name.endsWith(".json")) {
147650
+ continue;
147651
+ }
147652
+ const identity = name.slice(0, -".json".length);
147653
+ const snapshot = readUsageSnapshot(realFarmFs, paths.usageSnapshotsDir, identity);
147654
+ if (snapshot === void 0) {
147655
+ continue;
147656
+ }
147657
+ for (const provider of Object.keys(snapshot.providers)) {
147658
+ const known = newest.get(provider);
147659
+ if (known === void 0 || snapshot.updatedAt.localeCompare(known.updatedAt) > 0) {
147660
+ newest.set(provider, snapshot);
147661
+ }
147662
+ }
147663
+ }
147664
+ return (provider) => {
147665
+ const snapshot = newest.get(provider);
147666
+ return snapshot === void 0 ? {} : quotaFactsOf(snapshot.providers[provider]?.rateLimit?.unified, Date.now());
147667
+ };
147668
+ }
147669
+ function explainVirtualModel(paths, name) {
147670
+ const models = readModels(paths);
147671
+ const definition = models?.virtual?.[name];
147672
+ if (definition === void 0) {
147673
+ throw new UsageError(`No virtual model named "${name}".`);
147674
+ }
147675
+ const quotaOf = providerQuotaOf(paths);
147676
+ const observations = createTargetObservationStore(realFarmFs, paths);
147677
+ const candidates = expandMembers(name, models).filter((member) => !member.startsWith("acct:") && !member.startsWith("family:")).map((ref, order) => {
147678
+ const [provider] = ref.split("/");
147679
+ return candidateOf(ref, order, { quota: quotaOf(provider ?? ""), ...observations.observation(ref) === void 0 ? {} : { observation: observations.observation(ref) }, ...models?.prices?.[ref] === void 0 ? {} : { price: models.prices[ref] } }, false);
147680
+ });
147681
+ const evaluated = candidates.map((candidate) => ({ candidate, capabilities: { vision: true, tools: true, thinking: true } }));
147682
+ const selection = selectMember(definition.mode, evaluated, {});
147683
+ console.log(`${name} (${definition.mode}) chooses ${selection.ref ?? "nothing"}:`);
147684
+ for (const line of selection.reasons) {
147685
+ console.log(` ${line}`);
147686
+ }
147687
+ }
147454
147688
  function providerModels(paths) {
147455
147689
  return listProviders(paths).flatMap((entry) => {
147456
147690
  const catalogue = parseCatalogueCache(realFsPort.readFileUtf8(catalogueCachePath(paths, entry.name)));
@@ -147485,6 +147719,12 @@ function matchModels(models) {
147485
147719
  function registerModelsCommand(program2, deps) {
147486
147720
  const { paths } = deps;
147487
147721
  const modelsCommand = program2.command("model").description("Define and inspect the models the providers offer and the virtual models chosen among them.");
147722
+ withExamples(
147723
+ modelsCommand.command("explain <name>").description("Show which member a virtual model's mode picks over the live signals, and why each candidate stands where it does.").action((name) => {
147724
+ explainVirtualModel(paths, name);
147725
+ }),
147726
+ ["agent-shim model explain fast"]
147727
+ );
147488
147728
  withExamples(modelsCommand, ["agent-shim model match", "agent-shim model add fast --mode soonest-reset --member z/glm-5.3 --member m/MiniMax-M3"]);
147489
147729
  withExamples(
147490
147730
  modelsCommand.command("match").description("List every model every provider offers, grouped into the ones that are the same model across providers, with the pairs that are merely similar named beside them.").option("--json", "Print the match as JSON."),
@@ -148410,6 +148650,45 @@ function createMover(deps) {
148410
148650
  }
148411
148651
  };
148412
148652
  }
148653
+ function createIdentityMover(deps) {
148654
+ const { paths, farmFs, pool } = deps;
148655
+ return (request7) => {
148656
+ let lock;
148657
+ try {
148658
+ lock = acquireIdentityLock({ identity: "move", dir: superviseDirOf(paths, pool), fs: farmFs, nowMs: deps.now, pid: deps.pid, isRunning: deps.isRunning, sleep: deps.sleep });
148659
+ } catch (error63) {
148660
+ if (error63 instanceof IdentityLockBusyError) {
148661
+ return { kind: "stay", reason: error63.message };
148662
+ }
148663
+ throw error63;
148664
+ }
148665
+ try {
148666
+ if (farmFs.readFileUtf8(import_node_path63.default.join(paths.identitiesDir, request7.to, "identity.json")) === void 0) {
148667
+ return { kind: "stay", reason: `no identity "${request7.to}"` };
148668
+ }
148669
+ if (request7.to === request7.from) {
148670
+ return { kind: "stay", reason: `the model already runs under this session's identity` };
148671
+ }
148672
+ const transcript = import_node_path63.default.join(paths.identitiesDir, request7.to, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
148673
+ if (farmFs.lstat(transcript)?.kind !== "file") {
148674
+ return { kind: "stay", reason: `${request7.to} does not share this conversation's history, so it could not resume it` };
148675
+ }
148676
+ const nowMs = deps.now();
148677
+ registerSupervised(farmFs, paths, {
148678
+ pid: deps.pid,
148679
+ sessionId: request7.sessionId,
148680
+ pool,
148681
+ identity: request7.to,
148682
+ cwd: deps.cwd,
148683
+ since: new Date(nowMs).toISOString(),
148684
+ ...request7.contextTokens === void 0 ? {} : { carriedTokens: request7.contextTokens }
148685
+ });
148686
+ return { kind: "move", to: request7.to, explanation: `the picked model runs under ${request7.to}` };
148687
+ } finally {
148688
+ lock.release();
148689
+ }
148690
+ };
148691
+ }
148413
148692
 
148414
148693
  // src/supervise/realPorts.ts
148415
148694
  var import_node_child_process10 = require("node:child_process");
@@ -148560,6 +148839,17 @@ async function runChild2(deps, plan, identity, canCompact) {
148560
148839
  if (isLeaving()) {
148561
148840
  break;
148562
148841
  }
148842
+ const move = deps.claimModelMove(plan.sessionId);
148843
+ if (move !== void 0) {
148844
+ const outcome = deps.decideRemodel({ sessionId: plan.sessionId, from: identity, to: move.to });
148845
+ if (outcome.kind === "move") {
148846
+ state.leaving = true;
148847
+ depart({ kind: "remodel", to: outcome.to, model: move.model });
148848
+ } else {
148849
+ deps.log.warn(`agent-shim: session ${plan.sessionId} picked a model under ${move.to}, but stays on ${identity}: ${outcome.reason}`);
148850
+ }
148851
+ continue;
148852
+ }
148563
148853
  const hit = deps.quotaHit(identity, plan.sessionId, startedMs);
148564
148854
  if (hit !== void 0) {
148565
148855
  if (!state.declined) {
@@ -148585,14 +148875,18 @@ async function runChild2(deps, plan, identity, canCompact) {
148585
148875
  const stopWatching = deps.watchChanges(identity, () => {
148586
148876
  void check2();
148587
148877
  });
148878
+ const stopWatchingMoves = deps.watchModelMoves?.(() => {
148879
+ void check2();
148880
+ });
148588
148881
  try {
148589
148882
  const first = await Promise.race([child.exit.then((result2) => ({ kind: "exited", result: result2 })), departing]);
148590
148883
  stopWatching();
148884
+ stopWatchingMoves?.();
148591
148885
  if (first.kind === "exited") {
148592
148886
  return first;
148593
148887
  }
148594
148888
  deps.log.info(
148595
- first.kind === "move" ? `agent-shim: ${identity} is out of quota; resuming session ${plan.sessionId} under ${first.to} (${first.explanation})` : `agent-shim: ${first.reason}; compacting the ${String(first.contextTokens)}-token context of session ${plan.sessionId} on ${identity}`
148889
+ first.kind === "move" ? `agent-shim: ${identity} is out of quota; resuming session ${plan.sessionId} under ${first.to} (${first.explanation})` : first.kind === "remodel" ? `agent-shim: resuming session ${plan.sessionId} under ${first.to} with ${first.model}, which only runs there` : `agent-shim: ${first.reason}; compacting the ${String(first.contextTokens)}-token context of session ${plan.sessionId} on ${identity}`
148596
148890
  );
148597
148891
  const result = await stopChild(deps, child);
148598
148892
  if (state.terminating) {
@@ -148604,6 +148898,7 @@ async function runChild2(deps, plan, identity, canCompact) {
148604
148898
  return first;
148605
148899
  } finally {
148606
148900
  stopWatching();
148901
+ stopWatchingMoves?.();
148607
148902
  for (const stop of stopHandlers) {
148608
148903
  stop();
148609
148904
  }
@@ -148683,7 +148978,7 @@ async function supervise(deps, first) {
148683
148978
  launch = { ...base, conversation: "resume", member: identity };
148684
148979
  continue;
148685
148980
  }
148686
- launch = { ...base, conversation: "resume", member: outcome.to };
148981
+ launch = { ...base, conversation: "resume", member: outcome.to, ...outcome.kind === "remodel" ? { model: outcome.model } : {} };
148687
148982
  const compactedOnOld = compactedHere;
148688
148983
  compactedHere = false;
148689
148984
  if (compaction !== void 0) {
@@ -148753,6 +149048,20 @@ async function runSupervised(params) {
148753
149048
  pickMember: resolvePoolLaunch,
148754
149049
  log
148755
149050
  });
149051
+ const identityMover = createIdentityMover({
149052
+ paths,
149053
+ fs: realFsPort,
149054
+ farmFs: realFarmFs,
149055
+ pool,
149056
+ pools: params.pools,
149057
+ cwd: farm.cwd,
149058
+ pid: farm.lock.pid,
149059
+ now: farm.now,
149060
+ isRunning: farm.lock.isRunning,
149061
+ sleep: farm.lock.sleep,
149062
+ pickMember: resolvePoolLaunch,
149063
+ log
149064
+ });
148756
149065
  return await supervise(
148757
149066
  {
148758
149067
  pool,
@@ -148778,6 +149087,16 @@ async function runSupervised(params) {
148778
149087
  return mover(request7);
148779
149088
  },
148780
149089
  contextTokens: (sessionId) => resumedContextTokens(farm.fs, { claudeHome: farm.claudeHome, cwd: farm.cwd, passthrough: ["--resume", sessionId] }),
149090
+ claimModelMove: (sessionId) => {
149091
+ const request7 = readModelMove(realFarmFs, paths, sessionId);
149092
+ if (request7 === void 0) {
149093
+ return void 0;
149094
+ }
149095
+ removeModelMove(realFarmFs, paths, sessionId);
149096
+ return { to: request7.to, model: request7.model };
149097
+ },
149098
+ decideRemodel: (request7) => identityMover({ sessionId: request7.sessionId, from: request7.from, to: request7.to, contextTokens: void 0 }),
149099
+ watchModelMoves: (onChange) => realWatchDirectory(paths.modelMovesDir, () => true, "the model-move requests", log)(onChange),
148781
149100
  ...compaction === void 0 ? {} : { compaction },
148782
149101
  register: (session) => {
148783
149102
  registerSupervised(realFarmFs, paths, session);