copilot-relay 0.2.3 → 0.2.4

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 CHANGED
@@ -69,7 +69,6 @@ the top-level `model` field in `~/.claude/settings.json`. Exact
69
69
  Config lives at `~/.copilot-relay/config.yaml` and is hot-reloaded:
70
70
 
71
71
  ```yaml
72
- configVersion: 2
73
72
  host: 127.0.0.1
74
73
  port: 4142
75
74
  copilotBaseUrl: https://api.githubcopilot.com
@@ -81,9 +80,10 @@ upstreamTimeoutSeconds: 180
81
80
  webSearchBackend:
82
81
  ```
83
82
 
84
- `configVersion` is managed by copilot-relay. It gates one-time migrations that
85
- update a shipped default on installs which already persisted the previous value;
86
- do not edit it.
83
+ copilot-relay writes the resolved config back to this file, so every key is
84
+ present after the first start. Shipped defaults therefore apply to fresh
85
+ installs only — once a value is in your `config.yaml` it is never rewritten by
86
+ an upgrade. To pick up a changed default, edit the key yourself.
87
87
 
88
88
  `logLevel` controls verbosity:
89
89
 
@@ -4,10 +4,10 @@
4
4
  # Edit the user config file, not this template, for local changes.
5
5
  # Most values hot-reload while the service is running. host and port still
6
6
  # require restart because the listening socket is already bound.
7
-
8
- # Config schema version. Managed by copilot-relay; do not edit.
9
- # Used to apply one-time migrations when a shipped default changes.
10
- configVersion: 2
7
+ #
8
+ # Values here apply to a fresh install only. copilot-relay writes the resolved
9
+ # config back to disk, so once a key exists in your config.yaml it is yours:
10
+ # changing a shipped default never rewrites it.
11
11
 
12
12
  # Local host for the Claude Code-compatible HTTP server.
13
13
  host: 127.0.0.1
package/dist/main.js CHANGED
@@ -436,24 +436,15 @@ const logLevels = [
436
436
  "debug"
437
437
  ];
438
438
  /**
439
- * Schema version of ~/.copilot-relay/config.yaml.
439
+ * Values used when a key is absent from the user's config.
440
440
  *
441
- * Bumped whenever a shipped default changes in a way that must reach installs
442
- * that already persisted the previous value. See supersededOpusModels.
441
+ * readAppConfig() writes the resolved config back to disk, so an existing
442
+ * install has every key materialized and never consults these again. Changing
443
+ * one therefore affects fresh installs only, by design: copilot-relay does not
444
+ * rewrite a value the user's config already holds.
443
445
  */
444
- const currentConfigVersion = 2;
445
- /**
446
- * Opus defaults shipped by earlier releases.
447
- *
448
- * readAppConfig() writes the resolved config back to disk, so every install
449
- * that ever ran an older build has the superseded default sitting in its
450
- * config.yaml. Without this set, bumping defaultConfig.opusModel would only
451
- * ever reach fresh installs.
452
- */
453
- const supersededOpusModels = new Set(["claude-opus-4.8"]);
454
446
  const defaultConfig = {
455
447
  claudeSetup: true,
456
- configVersion: currentConfigVersion,
457
448
  copilotBaseUrl: "https://api.githubcopilot.com",
458
449
  gptModel: "gpt-5.6-sol",
459
450
  host: "127.0.0.1",
@@ -543,10 +534,6 @@ const parseConfigYaml = (content) => {
543
534
  case "claude_setup":
544
535
  config.claudeSetup = unquoteYamlScalar(value);
545
536
  break;
546
- case "configVersion":
547
- case "config_version":
548
- config.configVersion = unquoteYamlScalar(value);
549
- break;
550
537
  case "copilotBaseUrl":
551
538
  case "copilot_base_url":
552
539
  config.copilotBaseUrl = unquoteYamlScalar(value);
@@ -601,9 +588,6 @@ const serializeConfig = (config) => [
601
588
  "#",
602
589
  "# This file is hot-reloaded while copilot-relay is running.",
603
590
  "",
604
- "# Config schema version. Managed by copilot-relay; do not edit.",
605
- `configVersion: ${config.configVersion}`,
606
- "",
607
591
  "# Local host for the Claude Code-compatible HTTP server.",
608
592
  `host: ${config.host}`,
609
593
  "",
@@ -645,17 +629,6 @@ const serializeConfig = (config) => [
645
629
  `opusModel: ${config.opusModel}`,
646
630
  ""
647
631
  ].join("\n");
648
- /**
649
- * Resolve opusModel, applying the one-time superseded-default migration.
650
- *
651
- * Gated on configVersion so it runs exactly once. Without that gate the rewrite
652
- * would re-run on every start, which would make a superseded model impossible
653
- * to pin deliberately - the user's edit would be reverted underneath them.
654
- */
655
- const resolveOpusModel = (rawOpusModel, configVersion) => {
656
- if (rawOpusModel === void 0) return defaultConfig.opusModel;
657
- return configVersion < currentConfigVersion && supersededOpusModels.has(rawOpusModel) ? defaultConfig.opusModel : rawOpusModel;
658
- };
659
632
  async function readAppConfig() {
660
633
  const raw = await readRawConfig();
661
634
  const claudeSetup = normalizeBoolean(raw.claudeSetup);
@@ -665,16 +638,14 @@ async function readAppConfig() {
665
638
  const port = normalizePort(raw.port);
666
639
  const thinkEffort = normalizeThinkEffort(raw.thinkEffort);
667
640
  const upstreamTimeoutSeconds = normalizeUpstreamTimeoutSeconds(raw.upstreamTimeoutSeconds);
668
- const configVersion = normalizePositiveInteger(raw.configVersion) ?? 1;
669
641
  const config = {
670
642
  claudeSetup: claudeSetup ?? defaultConfig.claudeSetup,
671
- configVersion: currentConfigVersion,
672
643
  copilotBaseUrl: normalizeString(raw.copilotBaseUrl) ?? defaultConfig.copilotBaseUrl,
673
644
  gptModel: normalizeString(raw.gptModel) ?? defaultConfig.gptModel,
674
645
  host: host ?? defaultConfig.host,
675
646
  logLevel: logLevel ?? defaultConfig.logLevel,
676
647
  logRetentionDays: logRetentionDays$1 ?? defaultConfig.logRetentionDays,
677
- opusModel: resolveOpusModel(normalizeString(raw.opusModel), configVersion),
648
+ opusModel: normalizeString(raw.opusModel) ?? defaultConfig.opusModel,
678
649
  port: port ?? defaultConfig.port,
679
650
  thinkEffort: thinkEffort ?? defaultConfig.thinkEffort,
680
651
  upstreamTimeoutSeconds: upstreamTimeoutSeconds ?? defaultConfig.upstreamTimeoutSeconds,