proxitor 0.10.0 → 0.10.1

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
@@ -6,7 +6,7 @@ import * as tty$1 from "node:tty";
6
6
  import tty, { ReadStream } from "node:tty";
7
7
  import { formatWithOptions, styleText } from "node:util";
8
8
  import * as l$1 from "node:readline";
9
- import f from "node:readline";
9
+ import l__default from "node:readline";
10
10
  import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
11
11
  import { dirname, join, resolve, sep } from "node:path";
12
12
  import { createServer } from "node:net";
@@ -4603,7 +4603,7 @@ var V = class {
4603
4603
  this.state = "cancel", this.close();
4604
4604
  }, { once: true });
4605
4605
  }
4606
- this.rl = f.createInterface({
4606
+ this.rl = l__default.createInterface({
4607
4607
  input: this.input,
4608
4608
  tabSize: 2,
4609
4609
  prompt: "",
@@ -17220,7 +17220,7 @@ const r = Object.create(null), i = (e) => globalThis.process?.env || import.meta
17220
17220
  const e = i(true);
17221
17221
  return Object.keys(e);
17222
17222
  }
17223
- }), t = typeof process < "u" && process.env && process.env.NODE_ENV || "", f$1 = [
17223
+ }), t = typeof process < "u" && process.env && process.env.NODE_ENV || "", f = [
17224
17224
  ["APPVEYOR"],
17225
17225
  [
17226
17226
  "AWS_AMPLIFY",
@@ -17312,7 +17312,7 @@ const r = Object.create(null), i = (e) => globalThis.process?.env || import.meta
17312
17312
  ]
17313
17313
  ];
17314
17314
  function b() {
17315
- if (globalThis.process?.env) for (const e of f$1) {
17315
+ if (globalThis.process?.env) for (const e of f) {
17316
17316
  const s = e[1] || e[0];
17317
17317
  if (globalThis.process?.env[s]) return {
17318
17318
  name: e[0].toLowerCase(),
@@ -17917,6 +17917,31 @@ const CACHE_HINTS = {
17917
17917
  always: "All models",
17918
17918
  skip: "Passthrough — leave client cache_control headers as-is"
17919
17919
  };
17920
+ const NORMALIZE_HINTS = {
17921
+ on: "Rewrite cch → stable prefix cache",
17922
+ off: "Passthrough — rewrite nothing"
17923
+ };
17924
+ async function askNormalizeVolatileSystem(message, current, opts) {
17925
+ const options = [{
17926
+ value: true,
17927
+ label: "On",
17928
+ hint: NORMALIZE_HINTS.on
17929
+ }, {
17930
+ value: false,
17931
+ label: "Off",
17932
+ hint: NORMALIZE_HINTS.off
17933
+ }];
17934
+ if (opts?.removable) options.push({
17935
+ value: "reset",
17936
+ label: "Reset / inherit",
17937
+ hint: opts.resetHint ?? "Remove override"
17938
+ });
17939
+ return await select({
17940
+ message,
17941
+ initialValue: current ?? false,
17942
+ options
17943
+ });
17944
+ }
17920
17945
  async function askTriState(message, current, hints, opts) {
17921
17946
  const options = [
17922
17947
  {
@@ -18017,6 +18042,12 @@ async function collectCacheTriState(currentCc, currentTtl, globalTtl) {
18017
18042
  cacheControlTtl: { value: ttl }
18018
18043
  };
18019
18044
  }
18045
+ async function collectNormalizeVolatileSystem(currentNvs) {
18046
+ const nvs = await askNormalizeVolatileSystem("Normalize volatile system (cch hash)", currentNvs, { removable: true });
18047
+ if (typeof nvs === "symbol") return null;
18048
+ if (nvs === "reset") return { normalizeVolatileSystem: { remove: true } };
18049
+ return { normalizeVolatileSystem: { value: nvs } };
18050
+ }
18020
18051
  //#endregion
18021
18052
  //#region src/commands/config/add.ts
18022
18053
  const CUSTOM_PATTERN_VALUE = "__proxitor_custom_pattern__";
@@ -18119,13 +18150,24 @@ async function configureProviderAndSave(configPath, client, modelKey, isPattern)
18119
18150
  const providerResult = await selectProvidersByMode(mode, providerOptions);
18120
18151
  if (!providerResult) return;
18121
18152
  override = providerResult;
18122
- override = await collectSessionAndCache(override);
18153
+ override = await collectOptionalOverrides(override);
18123
18154
  if (!await confirmAndSave(configPath, modelKey, override, client)) return;
18124
18155
  outro("✓ Model override saved");
18125
18156
  }
18126
- async function collectSessionAndCache(override) {
18157
+ async function collectOptionalOverrides(override) {
18127
18158
  override = await collectSession(override);
18128
18159
  override = await collectCache(override);
18160
+ override = await collectNormalize(override);
18161
+ return override;
18162
+ }
18163
+ async function collectNormalize(override) {
18164
+ const want = await confirm({
18165
+ message: "Configure normalizeVolatileSystem for this model?",
18166
+ initialValue: false
18167
+ });
18168
+ if (isCancel(want) || !want) return override;
18169
+ const result = await collectNormalizeVolatileSystem(override.normalizeVolatileSystem);
18170
+ if (result && !("remove" in result.normalizeVolatileSystem)) override.normalizeVolatileSystem = result.normalizeVolatileSystem.value;
18129
18171
  return override;
18130
18172
  }
18131
18173
  async function collectSession(override) {
@@ -18201,6 +18243,7 @@ function formatOverrideYaml(override) {
18201
18243
  if (override.sessionId) parts.push(`sessionId: ${override.sessionId}`);
18202
18244
  if (override.cacheControl) parts.push(`cacheControl: ${override.cacheControl}`);
18203
18245
  if (override.cacheControlTtl) parts.push(`cacheControlTtl: ${override.cacheControlTtl}`);
18246
+ if (override.normalizeVolatileSystem !== void 0) parts.push(`normalizeVolatileSystem: ${override.normalizeVolatileSystem}`);
18204
18247
  return parts.join("\n ") || "(empty)";
18205
18248
  }
18206
18249
  //#endregion
@@ -18276,6 +18319,10 @@ async function browseModelsCommand(client) {
18276
18319
  }
18277
18320
  //#endregion
18278
18321
  //#region src/commands/config/edit.ts
18322
+ function nvsHint(value) {
18323
+ if (value === void 0) return "(inherit)";
18324
+ return value ? "on" : "off";
18325
+ }
18279
18326
  function formatOverrideHint(override) {
18280
18327
  if (!override) return "(empty)";
18281
18328
  const parts = [];
@@ -18285,6 +18332,7 @@ function formatOverrideHint(override) {
18285
18332
  }
18286
18333
  if (override.sessionId) parts.push(`session: ${override.sessionId}`);
18287
18334
  if (override.cacheControl) parts.push(`cache: ${override.cacheControl}`);
18335
+ if (override.normalizeVolatileSystem !== void 0) parts.push(`normalize: ${nvsHint(override.normalizeVolatileSystem)}`);
18288
18336
  if (override.headers) parts.push(`${Object.keys(override.headers).length} header(s)`);
18289
18337
  return parts.join(", ") || "(empty)";
18290
18338
  }
@@ -18308,6 +18356,7 @@ function showCurrentConfig(modelKey, current) {
18308
18356
  if (current.sessionId) log.info(` sessionId: ${current.sessionId}`);
18309
18357
  if (current.cacheControl) log.info(` cacheControl: ${current.cacheControl}`);
18310
18358
  if (current.cacheControlTtl) log.info(` cacheControlTtl: ${current.cacheControlTtl}`);
18359
+ if (current.normalizeVolatileSystem !== void 0) log.info(` normalizeVolatileSystem: ${current.normalizeVolatileSystem}`);
18311
18360
  if (current.headers) for (const [name, value] of Object.entries(current.headers)) log.info(` headers.${name}: ${value}`);
18312
18361
  }
18313
18362
  async function editProvider(modelKey, current, client) {
@@ -18344,6 +18393,23 @@ async function editCacheControl(current, configPath) {
18344
18393
  applyField(next, "cacheControlTtl", result.cacheControlTtl);
18345
18394
  return next;
18346
18395
  }
18396
+ /** @internal */
18397
+ async function editNormalizeVolatileSystem(current) {
18398
+ const result = await collectNormalizeVolatileSystem(current.normalizeVolatileSystem);
18399
+ if (result === null) return current;
18400
+ const next = { ...current };
18401
+ applyField(next, "normalizeVolatileSystem", result.normalizeVolatileSystem);
18402
+ return next;
18403
+ }
18404
+ async function applyFieldEdit(field, modelKey, current, client, configPath) {
18405
+ switch (field) {
18406
+ case "provider": return editProvider(modelKey, current, client);
18407
+ case "sessionId": return editSessionId(current);
18408
+ case "cacheControl": return editCacheControl(current, configPath);
18409
+ case "normalizeVolatileSystem": return editNormalizeVolatileSystem(current);
18410
+ default: return current;
18411
+ }
18412
+ }
18347
18413
  /** Run the interactive "Edit model override" flow. */
18348
18414
  async function editOverrideCommand(client, configPath) {
18349
18415
  intro("Edit Model Override");
@@ -18386,6 +18452,11 @@ async function editOverrideCommand(client, configPath) {
18386
18452
  label: "Cache control",
18387
18453
  hint: formatCacheHint(current.cacheControl, current.cacheControlTtl)
18388
18454
  },
18455
+ {
18456
+ value: "normalizeVolatileSystem",
18457
+ label: "Normalize volatile system",
18458
+ hint: nvsHint(current.normalizeVolatileSystem)
18459
+ },
18389
18460
  {
18390
18461
  value: "done",
18391
18462
  label: "✓ Done"
@@ -18393,17 +18464,7 @@ async function editOverrideCommand(client, configPath) {
18393
18464
  ]
18394
18465
  });
18395
18466
  if (isCancel(field) || field === "done") break;
18396
- switch (field) {
18397
- case "provider":
18398
- current = await editProvider(modelKey, current, client);
18399
- break;
18400
- case "sessionId":
18401
- current = await editSessionId(current);
18402
- break;
18403
- case "cacheControl":
18404
- current = await editCacheControl(current, resolvedConfigPath);
18405
- break;
18406
- }
18467
+ current = await applyFieldEdit(field, modelKey, current, client, resolvedConfigPath);
18407
18468
  }
18408
18469
  const save = await confirm({ message: "Save changes?" });
18409
18470
  if (isCancel(save) || !save) {
@@ -19040,26 +19101,9 @@ async function normalizeVolatileSystemCommand(opts) {
19040
19101
  const configPath = requireConfigPath(opts?.configPath);
19041
19102
  const current = readConfigFile(configPath).normalizeVolatileSystem ?? DEFAULTS.normalizeVolatileSystem;
19042
19103
  log.info(`Current: normalizeVolatileSystem = ${current}`);
19043
- const choice = await select({
19044
- message: "Normalize Claude Code's volatile cch hash in the system prompt? Stabilizes the prefix cache for non-Anthropic providers (qwen/glm/etc.).",
19045
- options: [
19046
- {
19047
- value: true,
19048
- label: "On",
19049
- hint: "rewrite cch → stable prefix"
19050
- },
19051
- {
19052
- value: false,
19053
- label: "Off",
19054
- hint: "passthrough"
19055
- },
19056
- {
19057
- value: "reset",
19058
- label: "Reset",
19059
- hint: `remove (default: ${DEFAULTS.normalizeVolatileSystem})`
19060
- }
19061
- ],
19062
- initialValue: current
19104
+ const choice = await askNormalizeVolatileSystem("Normalize Claude Code's volatile cch hash in the system prompt? Stabilizes the prefix cache for non-Anthropic providers (qwen/glm/etc.).", current, {
19105
+ removable: true,
19106
+ resetHint: `remove (default: ${DEFAULTS.normalizeVolatileSystem})`
19063
19107
  });
19064
19108
  if (typeof choice === "symbol") return;
19065
19109
  const fields = {};
@@ -19200,7 +19244,7 @@ async function runConfigMenu(client) {
19200
19244
  }
19201
19245
  //#endregion
19202
19246
  //#region src/version.ts
19203
- const version = "0.10.0";
19247
+ const version = "0.10.1";
19204
19248
  //#endregion
19205
19249
  //#region src/commands/doctor.ts
19206
19250
  const DEFAULT_TIMEOUT_MS = 3e3;