proxitor 0.9.0-beta.8 → 0.9.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.mjs CHANGED
@@ -19924,12 +19924,12 @@ function displayModelInfo(model, options) {
19924
19924
  log.info(` ${desc}`);
19925
19925
  }
19926
19926
  log.info(` Context: ${formatContextLength(model.context_length)} tokens`);
19927
- if (model.top_provider?.max_completion_tokens) log.info(` Max output: ${formatContextLength(model.top_provider.max_completion_tokens)} tokens`);
19927
+ if (model.top_provider.max_completion_tokens) log.info(` Max output: ${formatContextLength(model.top_provider.max_completion_tokens)} tokens`);
19928
19928
  log.info(` Pricing: ${formatPricing(model.pricing.prompt, model.pricing.completion)}`);
19929
19929
  logNonZeroPrice("Cache read", model.pricing.input_cache_read);
19930
19930
  logNonZeroPrice("Cache write", model.pricing.input_cache_write);
19931
- if (model.architecture?.modality) log.info(` Modality: ${model.architecture.modality}`);
19932
- if (showParameters && model.supported_parameters?.length) log.info(` Parameters: ${model.supported_parameters.join(", ")}`);
19931
+ if (model.architecture.modality) log.info(` Modality: ${model.architecture.modality}`);
19932
+ if (showParameters && model.supported_parameters.length) log.info(` Parameters: ${model.supported_parameters.join(", ")}`);
19933
19933
  }
19934
19934
  function formatPricing(prompt, completion) {
19935
19935
  return `${formatPrice(prompt)} / ${formatPrice(completion)}`;
@@ -20042,6 +20042,10 @@ async function selectRoutingMode(message) {
20042
20042
  });
20043
20043
  }
20044
20044
  async function selectProvidersByMode(mode, providerOptions) {
20045
+ if (providerOptions.length === 0) {
20046
+ log.warn("No providers available for this model — cannot configure provider routing.");
20047
+ return null;
20048
+ }
20045
20049
  if (mode === "only") return selectOnlyProviders(providerOptions);
20046
20050
  if (mode === "order") return selectOrderedProviders(providerOptions);
20047
20051
  if (mode === "ignore") return selectIgnoreProviders(providerOptions);
@@ -20164,19 +20168,20 @@ async function askBaseUrl(current) {
20164
20168
  if (isCancel(url)) return null;
20165
20169
  return url.trim() || DEFAULTS.openrouterBaseUrl;
20166
20170
  }
20171
+ const AUTH_OPTIONS = [{
20172
+ value: "bearer",
20173
+ label: "Bearer token",
20174
+ hint: "Standard OpenRouter"
20175
+ }, {
20176
+ value: "oauth",
20177
+ label: "OAuth token",
20178
+ hint: "Custom proxy providers"
20179
+ }];
20167
20180
  async function askAuthType(current) {
20168
20181
  const authType = await select({
20169
20182
  message: "Authentication type",
20170
20183
  initialValue: current,
20171
- options: [{
20172
- value: "bearer",
20173
- label: "Bearer token",
20174
- hint: "Standard OpenRouter"
20175
- }, {
20176
- value: "oauth",
20177
- label: "OAuth token",
20178
- hint: "Custom proxy providers"
20179
- }]
20184
+ options: AUTH_OPTIONS
20180
20185
  });
20181
20186
  if (isCancel(authType)) return null;
20182
20187
  return authType;
@@ -20473,7 +20478,7 @@ async function collectCache(override) {
20473
20478
  * Returns true if the override was saved.
20474
20479
  */
20475
20480
  async function confirmAndSave(configPath, modelKey, override, _client) {
20476
- while (true) {
20481
+ for (;;) {
20477
20482
  log.info(`Proposed override:\n ${modelKey}:\n ${formatOverrideYaml(override)}`);
20478
20483
  const action = await select({
20479
20484
  message: "What next?",
@@ -20684,7 +20689,7 @@ async function editOverrideCommand(client, configPath) {
20684
20689
  const modelKey = selected;
20685
20690
  let current = overrides[modelKey] ?? {};
20686
20691
  showCurrentConfig(modelKey, current);
20687
- while (true) {
20692
+ for (;;) {
20688
20693
  const field = await select({
20689
20694
  message: "Edit which field?",
20690
20695
  options: [
@@ -21136,6 +21141,10 @@ function buildYaml(apiKey, port, host, baseUrl, authType, existingRaw) {
21136
21141
  if (authType !== DEFAULTS.authType) config.authType = authType;
21137
21142
  return (0, import_dist.stringify)(config);
21138
21143
  }
21144
+ /** Preview header — URL and auth are shown even when `buildYaml` omits defaults. */
21145
+ function formatPreviewHeader(baseUrl, authType) {
21146
+ return `Base URL: ${baseUrl}\nAuth: ${AUTH_OPTIONS.find((o) => o.value === authType)?.label ?? authType}`;
21147
+ }
21139
21148
  async function askSaveLocation(existingPath) {
21140
21149
  const options = getSaveLocationOptions(existingPath);
21141
21150
  const location = await select({
@@ -21227,7 +21236,7 @@ async function runWizard(opts = {}) {
21227
21236
  log.step(`Step ${TOTAL_STEPS}/${TOTAL_STEPS}: Save location`);
21228
21237
  const location = expectValue(await askSaveLocation(existingPath ?? opts.configPath));
21229
21238
  const yaml = buildYaml(answers.apiKey, answers.port, answers.host, answers.baseUrl, answers.authType, existingRaw);
21230
- note(yaml, "Preview");
21239
+ note(`${formatPreviewHeader(answers.baseUrl, answers.authType)}\n${yaml}`, "Preview");
21231
21240
  const save = await confirm({
21232
21241
  message: "Save this configuration?",
21233
21242
  initialValue: true
@@ -21367,7 +21376,7 @@ async function sessionRoutingCommand(opts) {
21367
21376
  //#region src/commands/config.ts
21368
21377
  async function runConfigMenu(client) {
21369
21378
  intro("Proxitor Config Manager");
21370
- while (true) {
21379
+ for (;;) {
21371
21380
  const action = await select({
21372
21381
  message: "What would you like to do?",
21373
21382
  options: [
@@ -21472,7 +21481,7 @@ async function runConfigMenu(client) {
21472
21481
  }
21473
21482
  //#endregion
21474
21483
  //#region src/version.ts
21475
- const version = "0.9.0-beta.8";
21484
+ const version = "0.9.0";
21476
21485
  //#endregion
21477
21486
  //#region src/commands/doctor.ts
21478
21487
  const DEFAULT_TIMEOUT_MS = 3e3;
@@ -21638,7 +21647,7 @@ function checkVersion() {
21638
21647
  return {
21639
21648
  name: "version",
21640
21649
  status: "ok",
21641
- current: version
21650
+ value: version
21642
21651
  };
21643
21652
  }
21644
21653
  const STATUS_GLYPHS = {
@@ -21710,7 +21719,7 @@ async function doctorCommand(opts = {}) {
21710
21719
  return exitCode;
21711
21720
  }
21712
21721
  //#endregion
21713
- //#region node_modules/.pnpm/@hono+node-server@2.0.4_hono@4.12.23/node_modules/@hono/node-server/dist/index.mjs
21722
+ //#region node_modules/.pnpm/@hono+node-server@2.0.4_hono@4.12.25/node_modules/@hono/node-server/dist/index.mjs
21714
21723
  var RequestError = class extends Error {
21715
21724
  constructor(message, options) {
21716
21725
  super(message, options);
@@ -22633,7 +22642,7 @@ const serve = (options, listeningListener) => {
22633
22642
  return server;
22634
22643
  };
22635
22644
  //#endregion
22636
- //#region node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/compose.js
22645
+ //#region node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/compose.js
22637
22646
  var compose = (middleware, onError, onNotFound) => {
22638
22647
  return (context, next) => {
22639
22648
  let index = -1;
@@ -22664,10 +22673,10 @@ var compose = (middleware, onError, onNotFound) => {
22664
22673
  };
22665
22674
  };
22666
22675
  //#endregion
22667
- //#region node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/request/constants.js
22676
+ //#region node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/request/constants.js
22668
22677
  var GET_MATCH_RESULT = /* @__PURE__ */ Symbol();
22669
22678
  //#endregion
22670
- //#region node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/utils/body.js
22679
+ //#region node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/utils/body.js
22671
22680
  var parseBody$1 = async (request, options = /* @__PURE__ */ Object.create(null)) => {
22672
22681
  const { all = false, dot = false } = options;
22673
22682
  const contentType = (request instanceof HonoRequest ? request.raw.headers : request.headers).get("Content-Type");
@@ -22715,7 +22724,7 @@ var handleParsingNestedValues = (form, key, value) => {
22715
22724
  });
22716
22725
  };
22717
22726
  //#endregion
22718
- //#region node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/utils/url.js
22727
+ //#region node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/utils/url.js
22719
22728
  var splitPath = (path) => {
22720
22729
  const paths = path.split("/");
22721
22730
  if (paths[0] === "") paths.shift();
@@ -22879,7 +22888,7 @@ var getQueryParams = (url, key) => {
22879
22888
  };
22880
22889
  var decodeURIComponent_ = decodeURIComponent;
22881
22890
  //#endregion
22882
- //#region node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/request.js
22891
+ //#region node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/request.js
22883
22892
  var tryDecodeURIComponent = (str) => tryDecode(str, decodeURIComponent_);
22884
22893
  var HonoRequest = class {
22885
22894
  /**
@@ -23151,7 +23160,7 @@ var HonoRequest = class {
23151
23160
  }
23152
23161
  };
23153
23162
  //#endregion
23154
- //#region node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/utils/html.js
23163
+ //#region node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/utils/html.js
23155
23164
  var HtmlEscapedCallbackPhase = {
23156
23165
  Stringify: 1,
23157
23166
  BeforeStream: 2,
@@ -23181,7 +23190,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
23181
23190
  else return resStr;
23182
23191
  };
23183
23192
  //#endregion
23184
- //#region node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/context.js
23193
+ //#region node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/context.js
23185
23194
  var TEXT_PLAIN = "text/plain; charset=UTF-8";
23186
23195
  var setDefaultContentType = (contentType, headers) => {
23187
23196
  return {
@@ -23542,7 +23551,7 @@ var Context = class {
23542
23551
  };
23543
23552
  };
23544
23553
  //#endregion
23545
- //#region node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/router.js
23554
+ //#region node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/router.js
23546
23555
  var METHODS = [
23547
23556
  "get",
23548
23557
  "post",
@@ -23554,10 +23563,10 @@ var METHODS = [
23554
23563
  var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is already built.";
23555
23564
  var UnsupportedPathError = class extends Error {};
23556
23565
  //#endregion
23557
- //#region node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/utils/constants.js
23566
+ //#region node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/utils/constants.js
23558
23567
  var COMPOSED_HANDLER = "__COMPOSED_HANDLER";
23559
23568
  //#endregion
23560
- //#region node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/hono-base.js
23569
+ //#region node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/hono-base.js
23561
23570
  var notFoundHandler = (c) => {
23562
23571
  return c.text("404 Not Found", 404);
23563
23572
  };
@@ -23891,7 +23900,7 @@ var Hono$1 = class _Hono {
23891
23900
  };
23892
23901
  };
23893
23902
  //#endregion
23894
- //#region node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/router/reg-exp-router/matcher.js
23903
+ //#region node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/router/reg-exp-router/matcher.js
23895
23904
  var emptyParam = [];
23896
23905
  function match(method, path) {
23897
23906
  const matchers = this.buildAllMatchers();
@@ -23908,7 +23917,7 @@ function match(method, path) {
23908
23917
  return match2(method, path);
23909
23918
  }
23910
23919
  //#endregion
23911
- //#region node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/router/reg-exp-router/node.js
23920
+ //#region node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/router/reg-exp-router/node.js
23912
23921
  var LABEL_REG_EXP_STR = "[^/]+";
23913
23922
  var ONLY_WILDCARD_REG_EXP_STR = ".*";
23914
23923
  var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
@@ -23987,7 +23996,7 @@ var Node$1 = class _Node {
23987
23996
  }
23988
23997
  };
23989
23998
  //#endregion
23990
- //#region node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/router/reg-exp-router/trie.js
23999
+ //#region node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/router/reg-exp-router/trie.js
23991
24000
  var Trie = class {
23992
24001
  #context = { varIndex: 0 };
23993
24002
  #root = new Node$1();
@@ -24045,7 +24054,7 @@ var Trie = class {
24045
24054
  }
24046
24055
  };
24047
24056
  //#endregion
24048
- //#region node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/router/reg-exp-router/router.js
24057
+ //#region node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/router/reg-exp-router/router.js
24049
24058
  var nullMatcher = [
24050
24059
  /^$/,
24051
24060
  [],
@@ -24176,7 +24185,7 @@ var RegExpRouter = class {
24176
24185
  }
24177
24186
  };
24178
24187
  //#endregion
24179
- //#region node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/router/smart-router/router.js
24188
+ //#region node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/router/smart-router/router.js
24180
24189
  var SmartRouter = class {
24181
24190
  name = "SmartRouter";
24182
24191
  #routers = [];
@@ -24223,7 +24232,7 @@ var SmartRouter = class {
24223
24232
  }
24224
24233
  };
24225
24234
  //#endregion
24226
- //#region node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/router/trie-router/node.js
24235
+ //#region node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/router/trie-router/node.js
24227
24236
  var emptyParams = /* @__PURE__ */ Object.create(null);
24228
24237
  var hasChildren = (children) => {
24229
24238
  for (const _ in children) return true;
@@ -24376,7 +24385,7 @@ var Node = class _Node {
24376
24385
  }
24377
24386
  };
24378
24387
  //#endregion
24379
- //#region node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/router/trie-router/router.js
24388
+ //#region node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/router/trie-router/router.js
24380
24389
  var TrieRouter = class {
24381
24390
  name = "TrieRouter";
24382
24391
  #node;
@@ -24396,7 +24405,7 @@ var TrieRouter = class {
24396
24405
  }
24397
24406
  };
24398
24407
  //#endregion
24399
- //#region node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/hono.js
24408
+ //#region node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/hono.js
24400
24409
  var Hono = class extends Hono$1 {
24401
24410
  /**
24402
24411
  * Creates an instance of the Hono class.
@@ -24409,7 +24418,7 @@ var Hono = class extends Hono$1 {
24409
24418
  }
24410
24419
  };
24411
24420
  //#endregion
24412
- //#region node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/helper/factory/index.js
24421
+ //#region node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/helper/factory/index.js
24413
24422
  var createMiddleware = (middleware) => middleware;
24414
24423
  //#endregion
24415
24424
  //#region src/proxy/headers.ts
@@ -24885,16 +24894,15 @@ const parseBody = createMiddleware(async (c, next) => {
24885
24894
  });
24886
24895
  //#endregion
24887
24896
  //#region src/proxy/middleware/read-body.ts
24897
+ const BODY_LIMIT_MULTIPLIERS = {
24898
+ kb: 1024,
24899
+ mb: 1024 ** 2,
24900
+ gb: 1024 ** 3
24901
+ };
24888
24902
  function parseBodyLimit(limit) {
24889
24903
  const match = limit.match(/^(\d+)\s*(kb|mb|gb)$/i);
24890
24904
  if (!match) return Number.MAX_SAFE_INTEGER;
24891
- const n = parseInt(match[1], 10);
24892
- switch (match[2].toLowerCase()) {
24893
- case "kb": return n * 1024;
24894
- case "mb": return n * 1024 * 1024;
24895
- case "gb": return n * 1024 * 1024 * 1024;
24896
- default: return Number.MAX_SAFE_INTEGER;
24897
- }
24905
+ return parseInt(match[1], 10) * BODY_LIMIT_MULTIPLIERS[match[2].toLowerCase()];
24898
24906
  }
24899
24907
  const readBody = createMiddleware(async (c, next) => {
24900
24908
  const method = c.var.method;
@@ -25269,7 +25277,7 @@ const doctorCli = (0, import_cjs.command)({
25269
25277
  timeout: (0, import_cjs.option)({
25270
25278
  long: "timeout",
25271
25279
  short: "t",
25272
- type: import_cjs.string,
25280
+ type: (0, import_cjs.optional)(import_cjs.string),
25273
25281
  description: "Network check timeout in milliseconds"
25274
25282
  })
25275
25283
  },