proxitor 0.19.1 → 0.20.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/README.md +19 -0
- package/dist/cli.mjs +145 -90
- package/dist/cli.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -141,6 +141,25 @@ Prefer to edit a file? The full **[configuration reference](./docs/configuration
|
|
|
141
141
|
|
|
142
142
|
**Environment variables** — `OPENROUTER_API_KEY` is used when the config key is empty; `XDG_CONFIG_HOME` overrides the user-config directory on Linux/macOS. CLI flags take precedence over both.
|
|
143
143
|
|
|
144
|
+
### Recommended preset
|
|
145
|
+
|
|
146
|
+
By default proxitor is a **pure passthrough** — it does not modify request bodies. Set `recommended: true` to enable a curated set of caching + fixes:
|
|
147
|
+
|
|
148
|
+
| Setting | Value under `recommended: true` |
|
|
149
|
+
| --- | --- |
|
|
150
|
+
| `cacheControl` | `auto` |
|
|
151
|
+
| `sessionId` | `auto` |
|
|
152
|
+
| `normalizeResponses` | `true` |
|
|
153
|
+
| `normalizeVolatileSystem` | `true` |
|
|
154
|
+
|
|
155
|
+
`rewriteBlockTtl` and `normalizeMessages` stay off under the preset. Any single flag you set explicitly overrides the preset, e.g. `recommended: true` + `normalizeVolatileSystem: false`.
|
|
156
|
+
|
|
157
|
+
```yaml
|
|
158
|
+
recommended: true
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Or via CLI: `proxitor --recommended` (and `proxitor --no-recommended` to force it off).
|
|
162
|
+
|
|
144
163
|
## Diagnostics
|
|
145
164
|
|
|
146
165
|
```sh
|
package/dist/cli.mjs
CHANGED
|
@@ -16310,13 +16310,14 @@ const proxyConfigSchema = object({
|
|
|
16310
16310
|
attributionReferer: string$1().min(1).default("https://github.com/neiromaster/proxitor"),
|
|
16311
16311
|
attributionTitle: string$1().min(1).default("proxitor"),
|
|
16312
16312
|
headers: record(string$1(), string$1()).optional(),
|
|
16313
|
-
|
|
16313
|
+
recommended: boolean().default(false),
|
|
16314
|
+
cacheControl: triStateSchema.optional(),
|
|
16314
16315
|
cacheControlTtl: ttlSchema.optional(),
|
|
16315
|
-
rewriteBlockTtl: triStateSchema.
|
|
16316
|
-
sessionId: triStateSchema.
|
|
16317
|
-
normalizeResponses: boolean().
|
|
16318
|
-
normalizeMessages: boolean().
|
|
16319
|
-
normalizeVolatileSystem: boolean().
|
|
16316
|
+
rewriteBlockTtl: triStateSchema.optional(),
|
|
16317
|
+
sessionId: triStateSchema.optional(),
|
|
16318
|
+
normalizeResponses: boolean().optional(),
|
|
16319
|
+
normalizeMessages: boolean().optional(),
|
|
16320
|
+
normalizeVolatileSystem: boolean().optional(),
|
|
16320
16321
|
observability: observabilityConfigSchema,
|
|
16321
16322
|
modelOverrides: record(string$1().min(1), modelOverrideSchema).optional()
|
|
16322
16323
|
}).strict();
|
|
@@ -16372,6 +16373,39 @@ function toArray(value) {
|
|
|
16372
16373
|
}
|
|
16373
16374
|
//#endregion
|
|
16374
16375
|
//#region src/config.ts
|
|
16376
|
+
/** Effective value of each fix field when unset and `recommended` is false (pure passthrough). */
|
|
16377
|
+
const FIX_OFF = {
|
|
16378
|
+
cacheControl: "skip",
|
|
16379
|
+
rewriteBlockTtl: "skip",
|
|
16380
|
+
sessionId: "skip",
|
|
16381
|
+
normalizeResponses: false,
|
|
16382
|
+
normalizeMessages: false,
|
|
16383
|
+
normalizeVolatileSystem: false
|
|
16384
|
+
};
|
|
16385
|
+
/** The curated preset enabled by `recommended: true`. Four fields differ from FIX_OFF. */
|
|
16386
|
+
const RECOMMENDED_PRESET = {
|
|
16387
|
+
...FIX_OFF,
|
|
16388
|
+
cacheControl: "auto",
|
|
16389
|
+
sessionId: "auto",
|
|
16390
|
+
normalizeResponses: true,
|
|
16391
|
+
normalizeVolatileSystem: true
|
|
16392
|
+
};
|
|
16393
|
+
/**
|
|
16394
|
+
* Effective value for an unset fix field given `recommended`.
|
|
16395
|
+
* Accepts `undefined` (absent ⇒ OFF) so callers can pass `cfg.recommended` directly.
|
|
16396
|
+
*/
|
|
16397
|
+
function fixBaseline(recommended) {
|
|
16398
|
+
return recommended ? RECOMMENDED_PRESET : FIX_OFF;
|
|
16399
|
+
}
|
|
16400
|
+
/**
|
|
16401
|
+
* Map the two CLI flags to a `recommended` option. Returns `undefined` when
|
|
16402
|
+
* neither is set so a config file's `recommended` inherits (cmd-ts `flag()`
|
|
16403
|
+
* is `false` when absent, which would otherwise override the file).
|
|
16404
|
+
*/
|
|
16405
|
+
function resolveRecommendedOption(recommended, noRecommended) {
|
|
16406
|
+
if (noRecommended) return false;
|
|
16407
|
+
if (recommended) return true;
|
|
16408
|
+
}
|
|
16375
16409
|
const ARRAY_FIELDS = [
|
|
16376
16410
|
{
|
|
16377
16411
|
key: "only",
|
|
@@ -16485,16 +16519,17 @@ function formatSlugCollisionWarning(c) {
|
|
|
16485
16519
|
return `Overrides ${c.keys.map((k) => `"${k}"`).join(" and ")} share model slug "${c.slug}"; a bare name resolves to "${c.winner}". Use the vendor-prefixed name to pick a specific one.`;
|
|
16486
16520
|
}
|
|
16487
16521
|
function resolveModelConfig(config, modelName) {
|
|
16522
|
+
const base = fixBaseline(config.recommended);
|
|
16488
16523
|
const result = {
|
|
16489
16524
|
provider: config.provider,
|
|
16490
16525
|
headers: config.headers ? { ...config.headers } : void 0,
|
|
16491
|
-
cacheControl: config.cacheControl,
|
|
16526
|
+
cacheControl: config.cacheControl ?? base.cacheControl,
|
|
16492
16527
|
cacheControlTtl: config.cacheControlTtl,
|
|
16493
|
-
rewriteBlockTtl: config.rewriteBlockTtl,
|
|
16494
|
-
sessionId: config.sessionId,
|
|
16495
|
-
normalizeResponses: config.normalizeResponses,
|
|
16496
|
-
normalizeMessages: config.normalizeMessages,
|
|
16497
|
-
normalizeVolatileSystem: config.normalizeVolatileSystem
|
|
16528
|
+
rewriteBlockTtl: config.rewriteBlockTtl ?? base.rewriteBlockTtl,
|
|
16529
|
+
sessionId: config.sessionId ?? base.sessionId,
|
|
16530
|
+
normalizeResponses: config.normalizeResponses ?? base.normalizeResponses,
|
|
16531
|
+
normalizeMessages: config.normalizeMessages ?? base.normalizeMessages,
|
|
16532
|
+
normalizeVolatileSystem: config.normalizeVolatileSystem ?? base.normalizeVolatileSystem
|
|
16498
16533
|
};
|
|
16499
16534
|
if (!modelName || !config.modelOverrides) return result;
|
|
16500
16535
|
const bestPattern = findBestMatch(Object.keys(config.modelOverrides), modelName);
|
|
@@ -16548,6 +16583,7 @@ async function loadConfig(options) {
|
|
|
16548
16583
|
...options.host !== void 0 ? { host: options.host } : {},
|
|
16549
16584
|
...options.port !== void 0 ? { port: options.port } : {},
|
|
16550
16585
|
...options.verbose !== void 0 ? { verbose: options.verbose } : {},
|
|
16586
|
+
...options.recommended !== void 0 ? { recommended: options.recommended } : {},
|
|
16551
16587
|
openrouterKey: options.openrouterKey || fileConfig.openrouterKey || process.env.OPENROUTER_API_KEY || ""
|
|
16552
16588
|
};
|
|
16553
16589
|
const result = proxyConfigSchema.safeParse(merged);
|
|
@@ -18623,8 +18659,9 @@ async function cacheControlCommand(opts) {
|
|
|
18623
18659
|
const rawCc = cfg.cacheControl;
|
|
18624
18660
|
const rawTtl = cfg.cacheControlTtl;
|
|
18625
18661
|
const rawRewrite = cfg.rewriteBlockTtl;
|
|
18626
|
-
const
|
|
18627
|
-
const
|
|
18662
|
+
const base = fixBaseline(cfg.recommended);
|
|
18663
|
+
const effectiveCc = rawCc ?? base.cacheControl;
|
|
18664
|
+
const effectiveRewrite = rawRewrite ?? base.rewriteBlockTtl;
|
|
18628
18665
|
log.info(`Current: cacheControl = ${rawCc === void 0 ? `(default -> ${effectiveCc})` : effectiveCc}`);
|
|
18629
18666
|
if (rawTtl) log.info(`Current: cacheControlTtl = ${rawTtl}`);
|
|
18630
18667
|
log.info(`Current: rewriteBlockTtl = ${rawRewrite === void 0 ? `(default -> ${effectiveRewrite})` : rawRewrite}`);
|
|
@@ -18647,8 +18684,8 @@ function describeTtl(value) {
|
|
|
18647
18684
|
return value;
|
|
18648
18685
|
}
|
|
18649
18686
|
/** Global NVS: distinguish absent (default-origin) from an explicit on/off. */
|
|
18650
|
-
function globalNvsLabel(value) {
|
|
18651
|
-
if (value === void 0) return `(default -> ${
|
|
18687
|
+
function globalNvsLabel(value, fallback) {
|
|
18688
|
+
if (value === void 0) return `(default -> ${fallback ? "on" : "off"})`;
|
|
18652
18689
|
return value ? "on" : "off";
|
|
18653
18690
|
}
|
|
18654
18691
|
/** Global tri-state: distinguish absent (default-origin) from an explicit mode. */
|
|
@@ -18665,10 +18702,11 @@ function perModelTtl(current, globalCfg) {
|
|
|
18665
18702
|
return "(inherit)";
|
|
18666
18703
|
}
|
|
18667
18704
|
function formatGlobalCachingSummary(cfg) {
|
|
18668
|
-
const
|
|
18669
|
-
const
|
|
18670
|
-
const
|
|
18671
|
-
const
|
|
18705
|
+
const base = fixBaseline(cfg.recommended);
|
|
18706
|
+
const cc = globalTriStateLabel(cfg.cacheControl, base.cacheControl);
|
|
18707
|
+
const rewrite = globalTriStateLabel(cfg.rewriteBlockTtl, base.rewriteBlockTtl);
|
|
18708
|
+
const sid = globalTriStateLabel(cfg.sessionId, base.sessionId);
|
|
18709
|
+
const nvs = globalNvsLabel(cfg.normalizeVolatileSystem, base.normalizeVolatileSystem);
|
|
18672
18710
|
return [
|
|
18673
18711
|
"Three settings shape the request so cache survives.",
|
|
18674
18712
|
"",
|
|
@@ -18682,10 +18720,11 @@ function formatGlobalCachingSummary(cfg) {
|
|
|
18682
18720
|
].join("\n");
|
|
18683
18721
|
}
|
|
18684
18722
|
function formatPerModelCachingSummary(modelKey, current, globalCfg) {
|
|
18685
|
-
const
|
|
18686
|
-
const
|
|
18687
|
-
const
|
|
18688
|
-
const
|
|
18723
|
+
const base = fixBaseline(globalCfg.recommended);
|
|
18724
|
+
const gCc = globalCfg.cacheControl ?? base.cacheControl;
|
|
18725
|
+
const gRewrite = globalCfg.rewriteBlockTtl ?? base.rewriteBlockTtl;
|
|
18726
|
+
const gSid = globalCfg.sessionId ?? base.sessionId;
|
|
18727
|
+
const gNvs = globalCfg.normalizeVolatileSystem ?? base.normalizeVolatileSystem;
|
|
18689
18728
|
const cc = current.cacheControl ?? `(inherit -> ${gCc})`;
|
|
18690
18729
|
const ttl = perModelTtl(current, globalCfg);
|
|
18691
18730
|
const rewrite = current.rewriteBlockTtl ?? `(inherit -> ${gRewrite})`;
|
|
@@ -18708,22 +18747,37 @@ function overridesEqual(a, b) {
|
|
|
18708
18747
|
return isDeepStrictEqual(a, b);
|
|
18709
18748
|
}
|
|
18710
18749
|
//#endregion
|
|
18711
|
-
//#region src/commands/config/
|
|
18712
|
-
|
|
18713
|
-
|
|
18714
|
-
|
|
18715
|
-
const
|
|
18716
|
-
|
|
18717
|
-
const
|
|
18750
|
+
//#region src/commands/config/boolean-fix.ts
|
|
18751
|
+
const onOff = (value) => value ? "on" : "off";
|
|
18752
|
+
/** Shared body for the on/off fix toggles. `reset` removes the key so it inherits the preset. */
|
|
18753
|
+
async function runBooleanFixCommand(params) {
|
|
18754
|
+
const { configPath, field, message, ask } = params;
|
|
18755
|
+
const path = requireConfigPath(configPath);
|
|
18756
|
+
const cfg = readConfigFileRaw(path);
|
|
18757
|
+
const raw = cfg[field];
|
|
18758
|
+
const presetDefault = fixBaseline(cfg.recommended)[field];
|
|
18759
|
+
const effective = raw ?? presetDefault;
|
|
18760
|
+
log.info(`Current: ${field} = ${raw === void 0 ? `(default -> ${onOff(effective)})` : effective}`);
|
|
18761
|
+
const choice = await ask(message, raw, {
|
|
18718
18762
|
removable: true,
|
|
18719
|
-
resetHint: `remove (default: ${
|
|
18763
|
+
resetHint: `remove (default: ${onOff(presetDefault)})`
|
|
18720
18764
|
});
|
|
18721
18765
|
if (typeof choice === "symbol") return;
|
|
18722
18766
|
const fields = {};
|
|
18723
|
-
fields
|
|
18724
|
-
setGlobalConfigFields(
|
|
18725
|
-
const label = choice === "reset" ? `(default: ${
|
|
18726
|
-
log.success(
|
|
18767
|
+
fields[field] = choice === "reset" ? void 0 : choice;
|
|
18768
|
+
setGlobalConfigFields(path, fields);
|
|
18769
|
+
const label = choice === "reset" ? `(default: ${onOff(presetDefault)})` : choice;
|
|
18770
|
+
log.success(`${field} set to ${label}`);
|
|
18771
|
+
}
|
|
18772
|
+
//#endregion
|
|
18773
|
+
//#region src/commands/config/normalize-system.ts
|
|
18774
|
+
async function normalizeVolatileSystemCommand(opts) {
|
|
18775
|
+
return runBooleanFixCommand({
|
|
18776
|
+
configPath: opts?.configPath,
|
|
18777
|
+
field: "normalizeVolatileSystem",
|
|
18778
|
+
message: "Normalize Claude Code's volatile cch and cc_version hashes in the system prompt? Stabilizes the prefix cache for non-Anthropic providers (qwen/glm/etc.).",
|
|
18779
|
+
ask: askNormalizeVolatileSystem
|
|
18780
|
+
});
|
|
18727
18781
|
}
|
|
18728
18782
|
//#endregion
|
|
18729
18783
|
//#region src/commands/config/override-levers.ts
|
|
@@ -18777,14 +18831,16 @@ async function editNormalizeVolatileSystem(current) {
|
|
|
18777
18831
|
//#region src/commands/config/session-routing.ts
|
|
18778
18832
|
async function sessionRoutingCommand(opts) {
|
|
18779
18833
|
const configPath = requireConfigPath(opts?.configPath);
|
|
18780
|
-
const
|
|
18781
|
-
const
|
|
18834
|
+
const cfg = readConfigFileRaw(configPath);
|
|
18835
|
+
const raw = cfg.sessionId;
|
|
18836
|
+
const base = fixBaseline(cfg.recommended);
|
|
18837
|
+
const effective = raw ?? base.sessionId;
|
|
18782
18838
|
log.info(`Current: sessionId = ${raw === void 0 ? `(default -> ${effective})` : effective}`);
|
|
18783
18839
|
const result = await askTriState("Session routing mode", raw, SESSION_HINTS, { removable: true });
|
|
18784
18840
|
if (typeof result === "symbol") return;
|
|
18785
18841
|
if (result === "reset") {
|
|
18786
18842
|
setGlobalConfigField(configPath, "sessionId", void 0);
|
|
18787
|
-
log.success(
|
|
18843
|
+
log.success(`sessionId reset to default (${base.sessionId})`);
|
|
18788
18844
|
return;
|
|
18789
18845
|
}
|
|
18790
18846
|
setGlobalConfigField(configPath, "sessionId", result);
|
|
@@ -18865,38 +18921,22 @@ async function cachingCommand(opts) {
|
|
|
18865
18921
|
//#endregion
|
|
18866
18922
|
//#region src/commands/config/normalize-messages.ts
|
|
18867
18923
|
async function normalizeMessagesCommand(opts) {
|
|
18868
|
-
|
|
18869
|
-
|
|
18870
|
-
|
|
18871
|
-
|
|
18872
|
-
|
|
18873
|
-
removable: true,
|
|
18874
|
-
resetHint: `remove (default: ${DEFAULTS.normalizeMessages ? "on" : "off"})`
|
|
18924
|
+
return runBooleanFixCommand({
|
|
18925
|
+
configPath: opts?.configPath,
|
|
18926
|
+
field: "normalizeMessages",
|
|
18927
|
+
message: "Lift stray role:\"system\" out of /v1/messages into top-level system? Fixes 400 rejections from strict Anthropic-format providers (OpenRouter → GLM et al.). Acts on /v1/messages only.",
|
|
18928
|
+
ask: askNormalizeMessages
|
|
18875
18929
|
});
|
|
18876
|
-
if (typeof choice === "symbol") return;
|
|
18877
|
-
const fields = {};
|
|
18878
|
-
fields.normalizeMessages = choice === "reset" ? void 0 : choice;
|
|
18879
|
-
setGlobalConfigFields(configPath, fields);
|
|
18880
|
-
const label = choice === "reset" ? `(default: ${DEFAULTS.normalizeMessages})` : choice;
|
|
18881
|
-
log.success(`normalizeMessages set to ${label}`);
|
|
18882
18930
|
}
|
|
18883
18931
|
//#endregion
|
|
18884
18932
|
//#region src/commands/config/normalize-responses.ts
|
|
18885
18933
|
async function normalizeResponsesCommand(opts) {
|
|
18886
|
-
|
|
18887
|
-
|
|
18888
|
-
|
|
18889
|
-
|
|
18890
|
-
|
|
18891
|
-
removable: true,
|
|
18892
|
-
resetHint: `remove (default: ${DEFAULTS.normalizeResponses ? "on" : "off"})`
|
|
18934
|
+
return runBooleanFixCommand({
|
|
18935
|
+
configPath: opts?.configPath,
|
|
18936
|
+
field: "normalizeResponses",
|
|
18937
|
+
message: "Repair /v1/responses request bodies for OpenRouter (tag input types, lift role:\"system\" into instructions, synthesize assistant id/status)? Acts on /v1/responses only.",
|
|
18938
|
+
ask: askNormalizeResponses
|
|
18893
18939
|
});
|
|
18894
|
-
if (typeof choice === "symbol") return;
|
|
18895
|
-
const fields = {};
|
|
18896
|
-
fields.normalizeResponses = choice === "reset" ? void 0 : choice;
|
|
18897
|
-
setGlobalConfigFields(configPath, fields);
|
|
18898
|
-
const label = choice === "reset" ? `(default: ${DEFAULTS.normalizeResponses})` : choice;
|
|
18899
|
-
log.success(`normalizeResponses set to ${label}`);
|
|
18900
18940
|
}
|
|
18901
18941
|
//#endregion
|
|
18902
18942
|
//#region src/commands/config/fixes-menu.ts
|
|
@@ -18937,7 +18977,8 @@ async function globalFixesMenu(opts) {
|
|
|
18937
18977
|
backLabel: "← Back",
|
|
18938
18978
|
renderNote: () => {
|
|
18939
18979
|
const raw = readConfigFileRaw(configPath);
|
|
18940
|
-
|
|
18980
|
+
const base = fixBaseline(raw.recommended);
|
|
18981
|
+
return [`normalizeResponses: ${raw.normalizeResponses ?? `(default → ${base.normalizeResponses ? "on" : "off"})`}`, `normalizeMessages: ${raw.normalizeMessages ?? `(default → ${base.normalizeMessages ? "on" : "off"})`}`].join("\n");
|
|
18941
18982
|
},
|
|
18942
18983
|
onLever: (lever) => lever.global(configPath)
|
|
18943
18984
|
});
|
|
@@ -19782,7 +19823,7 @@ async function runConfigMenu(client) {
|
|
|
19782
19823
|
}
|
|
19783
19824
|
//#endregion
|
|
19784
19825
|
//#region src/version.ts
|
|
19785
|
-
const version = "0.
|
|
19826
|
+
const version = "0.20.0";
|
|
19786
19827
|
//#endregion
|
|
19787
19828
|
//#region src/commands/doctor.ts
|
|
19788
19829
|
const DEFAULT_TIMEOUT_MS = 3e3;
|
|
@@ -20066,6 +20107,10 @@ const CACHE_LEVER_KEYS = [
|
|
|
20066
20107
|
];
|
|
20067
20108
|
const SCALAR_KEYS = [
|
|
20068
20109
|
...CACHE_LEVER_KEYS,
|
|
20110
|
+
"rewriteBlockTtl",
|
|
20111
|
+
"normalizeResponses",
|
|
20112
|
+
"normalizeMessages",
|
|
20113
|
+
"recommended",
|
|
20069
20114
|
"authType",
|
|
20070
20115
|
"verbose",
|
|
20071
20116
|
"bodyLimit",
|
|
@@ -20234,7 +20279,7 @@ var FileWatchingConfigSource = class {
|
|
|
20234
20279
|
}
|
|
20235
20280
|
};
|
|
20236
20281
|
//#endregion
|
|
20237
|
-
//#region node_modules/.pnpm/@hono+node-server@2.0.
|
|
20282
|
+
//#region node_modules/.pnpm/@hono+node-server@2.0.6_hono@4.12.27/node_modules/@hono/node-server/dist/index.mjs
|
|
20238
20283
|
var RequestError = class extends Error {
|
|
20239
20284
|
constructor(message, options) {
|
|
20240
20285
|
super(message, options);
|
|
@@ -20623,7 +20668,8 @@ var Response$1 = class Response$1 {
|
|
|
20623
20668
|
const liveHeaders = cache && cache[2] instanceof Headers ? cache[2] : void 0;
|
|
20624
20669
|
delete this[cacheKey];
|
|
20625
20670
|
return this[responseCache] ||= new GlobalResponse(this.#body, liveHeaders ? {
|
|
20626
|
-
|
|
20671
|
+
status: this.#init?.status,
|
|
20672
|
+
statusText: this.#init?.statusText,
|
|
20627
20673
|
headers: liveHeaders
|
|
20628
20674
|
} : this.#init);
|
|
20629
20675
|
}
|
|
@@ -21157,7 +21203,7 @@ const serve = (options, listeningListener) => {
|
|
|
21157
21203
|
return server;
|
|
21158
21204
|
};
|
|
21159
21205
|
//#endregion
|
|
21160
|
-
//#region node_modules/.pnpm/hono@4.12.
|
|
21206
|
+
//#region node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/compose.js
|
|
21161
21207
|
var compose = (middleware, onError, onNotFound) => {
|
|
21162
21208
|
return (context, next) => {
|
|
21163
21209
|
let index = -1;
|
|
@@ -21188,10 +21234,10 @@ var compose = (middleware, onError, onNotFound) => {
|
|
|
21188
21234
|
};
|
|
21189
21235
|
};
|
|
21190
21236
|
//#endregion
|
|
21191
|
-
//#region node_modules/.pnpm/hono@4.12.
|
|
21237
|
+
//#region node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/request/constants.js
|
|
21192
21238
|
var GET_MATCH_RESULT = /* @__PURE__ */ Symbol();
|
|
21193
21239
|
//#endregion
|
|
21194
|
-
//#region node_modules/.pnpm/hono@4.12.
|
|
21240
|
+
//#region node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/utils/body.js
|
|
21195
21241
|
var parseBody$1 = async (request, options = /* @__PURE__ */ Object.create(null)) => {
|
|
21196
21242
|
const { all = false, dot = false } = options;
|
|
21197
21243
|
const contentType = (request instanceof HonoRequest ? request.raw.headers : request.headers).get("Content-Type");
|
|
@@ -21239,7 +21285,7 @@ var handleParsingNestedValues = (form, key, value) => {
|
|
|
21239
21285
|
});
|
|
21240
21286
|
};
|
|
21241
21287
|
//#endregion
|
|
21242
|
-
//#region node_modules/.pnpm/hono@4.12.
|
|
21288
|
+
//#region node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/utils/url.js
|
|
21243
21289
|
var splitPath = (path) => {
|
|
21244
21290
|
const paths = path.split("/");
|
|
21245
21291
|
if (paths[0] === "") paths.shift();
|
|
@@ -21403,7 +21449,7 @@ var getQueryParams = (url, key) => {
|
|
|
21403
21449
|
};
|
|
21404
21450
|
var decodeURIComponent_ = decodeURIComponent;
|
|
21405
21451
|
//#endregion
|
|
21406
|
-
//#region node_modules/.pnpm/hono@4.12.
|
|
21452
|
+
//#region node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/request.js
|
|
21407
21453
|
var tryDecodeURIComponent = (str) => tryDecode(str, decodeURIComponent_);
|
|
21408
21454
|
var HonoRequest = class {
|
|
21409
21455
|
/**
|
|
@@ -21675,7 +21721,7 @@ var HonoRequest = class {
|
|
|
21675
21721
|
}
|
|
21676
21722
|
};
|
|
21677
21723
|
//#endregion
|
|
21678
|
-
//#region node_modules/.pnpm/hono@4.12.
|
|
21724
|
+
//#region node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/utils/html.js
|
|
21679
21725
|
var HtmlEscapedCallbackPhase = {
|
|
21680
21726
|
Stringify: 1,
|
|
21681
21727
|
BeforeStream: 2,
|
|
@@ -21705,7 +21751,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
|
|
|
21705
21751
|
else return resStr;
|
|
21706
21752
|
};
|
|
21707
21753
|
//#endregion
|
|
21708
|
-
//#region node_modules/.pnpm/hono@4.12.
|
|
21754
|
+
//#region node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/context.js
|
|
21709
21755
|
var TEXT_PLAIN = "text/plain; charset=UTF-8";
|
|
21710
21756
|
var setDefaultContentType = (contentType, headers) => {
|
|
21711
21757
|
return {
|
|
@@ -22066,7 +22112,7 @@ var Context = class {
|
|
|
22066
22112
|
};
|
|
22067
22113
|
};
|
|
22068
22114
|
//#endregion
|
|
22069
|
-
//#region node_modules/.pnpm/hono@4.12.
|
|
22115
|
+
//#region node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/router.js
|
|
22070
22116
|
var METHODS = [
|
|
22071
22117
|
"get",
|
|
22072
22118
|
"post",
|
|
@@ -22078,10 +22124,10 @@ var METHODS = [
|
|
|
22078
22124
|
var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is already built.";
|
|
22079
22125
|
var UnsupportedPathError = class extends Error {};
|
|
22080
22126
|
//#endregion
|
|
22081
|
-
//#region node_modules/.pnpm/hono@4.12.
|
|
22127
|
+
//#region node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/utils/constants.js
|
|
22082
22128
|
var COMPOSED_HANDLER = "__COMPOSED_HANDLER";
|
|
22083
22129
|
//#endregion
|
|
22084
|
-
//#region node_modules/.pnpm/hono@4.12.
|
|
22130
|
+
//#region node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/hono-base.js
|
|
22085
22131
|
var notFoundHandler = (c) => {
|
|
22086
22132
|
return c.text("404 Not Found", 404);
|
|
22087
22133
|
};
|
|
@@ -22415,7 +22461,7 @@ var Hono$1 = class _Hono {
|
|
|
22415
22461
|
};
|
|
22416
22462
|
};
|
|
22417
22463
|
//#endregion
|
|
22418
|
-
//#region node_modules/.pnpm/hono@4.12.
|
|
22464
|
+
//#region node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/router/reg-exp-router/matcher.js
|
|
22419
22465
|
var emptyParam = [];
|
|
22420
22466
|
function match(method, path) {
|
|
22421
22467
|
const matchers = this.buildAllMatchers();
|
|
@@ -22432,7 +22478,7 @@ function match(method, path) {
|
|
|
22432
22478
|
return match2(method, path);
|
|
22433
22479
|
}
|
|
22434
22480
|
//#endregion
|
|
22435
|
-
//#region node_modules/.pnpm/hono@4.12.
|
|
22481
|
+
//#region node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/router/reg-exp-router/node.js
|
|
22436
22482
|
var LABEL_REG_EXP_STR = "[^/]+";
|
|
22437
22483
|
var ONLY_WILDCARD_REG_EXP_STR = ".*";
|
|
22438
22484
|
var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
|
|
@@ -22511,7 +22557,7 @@ var Node$1 = class _Node {
|
|
|
22511
22557
|
}
|
|
22512
22558
|
};
|
|
22513
22559
|
//#endregion
|
|
22514
|
-
//#region node_modules/.pnpm/hono@4.12.
|
|
22560
|
+
//#region node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/router/reg-exp-router/trie.js
|
|
22515
22561
|
var Trie = class {
|
|
22516
22562
|
#context = { varIndex: 0 };
|
|
22517
22563
|
#root = new Node$1();
|
|
@@ -22569,7 +22615,7 @@ var Trie = class {
|
|
|
22569
22615
|
}
|
|
22570
22616
|
};
|
|
22571
22617
|
//#endregion
|
|
22572
|
-
//#region node_modules/.pnpm/hono@4.12.
|
|
22618
|
+
//#region node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/router/reg-exp-router/router.js
|
|
22573
22619
|
var nullMatcher = [
|
|
22574
22620
|
/^$/,
|
|
22575
22621
|
[],
|
|
@@ -22700,7 +22746,7 @@ var RegExpRouter = class {
|
|
|
22700
22746
|
}
|
|
22701
22747
|
};
|
|
22702
22748
|
//#endregion
|
|
22703
|
-
//#region node_modules/.pnpm/hono@4.12.
|
|
22749
|
+
//#region node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/router/smart-router/router.js
|
|
22704
22750
|
var SmartRouter = class {
|
|
22705
22751
|
name = "SmartRouter";
|
|
22706
22752
|
#routers = [];
|
|
@@ -22747,7 +22793,7 @@ var SmartRouter = class {
|
|
|
22747
22793
|
}
|
|
22748
22794
|
};
|
|
22749
22795
|
//#endregion
|
|
22750
|
-
//#region node_modules/.pnpm/hono@4.12.
|
|
22796
|
+
//#region node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/router/trie-router/node.js
|
|
22751
22797
|
var emptyParams = /* @__PURE__ */ Object.create(null);
|
|
22752
22798
|
var hasChildren = (children) => {
|
|
22753
22799
|
for (const _ in children) return true;
|
|
@@ -22900,7 +22946,7 @@ var Node = class _Node {
|
|
|
22900
22946
|
}
|
|
22901
22947
|
};
|
|
22902
22948
|
//#endregion
|
|
22903
|
-
//#region node_modules/.pnpm/hono@4.12.
|
|
22949
|
+
//#region node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/router/trie-router/router.js
|
|
22904
22950
|
var TrieRouter = class {
|
|
22905
22951
|
name = "TrieRouter";
|
|
22906
22952
|
#node;
|
|
@@ -22920,7 +22966,7 @@ var TrieRouter = class {
|
|
|
22920
22966
|
}
|
|
22921
22967
|
};
|
|
22922
22968
|
//#endregion
|
|
22923
|
-
//#region node_modules/.pnpm/hono@4.12.
|
|
22969
|
+
//#region node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/hono.js
|
|
22924
22970
|
var Hono = class extends Hono$1 {
|
|
22925
22971
|
/**
|
|
22926
22972
|
* Creates an instance of the Hono class.
|
|
@@ -22933,7 +22979,7 @@ var Hono = class extends Hono$1 {
|
|
|
22933
22979
|
}
|
|
22934
22980
|
};
|
|
22935
22981
|
//#endregion
|
|
22936
|
-
//#region node_modules/.pnpm/hono@4.12.
|
|
22982
|
+
//#region node_modules/.pnpm/hono@4.12.27/node_modules/hono/dist/helper/factory/index.js
|
|
22937
22983
|
var createMiddleware = (middleware) => middleware;
|
|
22938
22984
|
//#endregion
|
|
22939
22985
|
//#region src/proxy/headers.ts
|
|
@@ -24405,9 +24451,17 @@ const startCommand = (0, import_cjs.command)({
|
|
|
24405
24451
|
verbose: (0, import_cjs.flag)({
|
|
24406
24452
|
long: "verbose",
|
|
24407
24453
|
description: "Enable verbose logging"
|
|
24454
|
+
}),
|
|
24455
|
+
recommended: (0, import_cjs.flag)({
|
|
24456
|
+
long: "recommended",
|
|
24457
|
+
description: "Enable the recommended set of caching + fixes"
|
|
24458
|
+
}),
|
|
24459
|
+
noRecommended: (0, import_cjs.flag)({
|
|
24460
|
+
long: "no-recommended",
|
|
24461
|
+
description: "Disable the recommended preset (overrides config file)"
|
|
24408
24462
|
})
|
|
24409
24463
|
},
|
|
24410
|
-
handler: async ({ configPath, port, host, noConfig, openrouterKey, verbose }) => {
|
|
24464
|
+
handler: async ({ configPath, port, host, noConfig, openrouterKey, verbose, recommended, noRecommended }) => {
|
|
24411
24465
|
try {
|
|
24412
24466
|
const loadOptions = {
|
|
24413
24467
|
configPath,
|
|
@@ -24415,7 +24469,8 @@ const startCommand = (0, import_cjs.command)({
|
|
|
24415
24469
|
port,
|
|
24416
24470
|
host,
|
|
24417
24471
|
openrouterKey,
|
|
24418
|
-
verbose
|
|
24472
|
+
verbose,
|
|
24473
|
+
recommended: resolveRecommendedOption(recommended, noRecommended)
|
|
24419
24474
|
};
|
|
24420
24475
|
const cfg = await loadConfig(loadOptions);
|
|
24421
24476
|
const source = createConfigSource({
|