@darkjd/opencode-openai-codex-auth 4.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.
Files changed (90) hide show
  1. package/LICENSE +37 -0
  2. package/README.md +137 -0
  3. package/assets/opencode-logo-ornate-dark.svg +18 -0
  4. package/assets/readme-hero.svg +31 -0
  5. package/dist/index.d.ts +42 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +226 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/lib/auth/auth.d.ts +43 -0
  10. package/dist/lib/auth/auth.d.ts.map +1 -0
  11. package/dist/lib/auth/auth.js +163 -0
  12. package/dist/lib/auth/auth.js.map +1 -0
  13. package/dist/lib/auth/browser.d.ts +17 -0
  14. package/dist/lib/auth/browser.d.ts.map +1 -0
  15. package/dist/lib/auth/browser.js +76 -0
  16. package/dist/lib/auth/browser.js.map +1 -0
  17. package/dist/lib/auth/server.d.ts +10 -0
  18. package/dist/lib/auth/server.d.ts.map +1 -0
  19. package/dist/lib/auth/server.js +78 -0
  20. package/dist/lib/auth/server.js.map +1 -0
  21. package/dist/lib/auth/v2-storage.d.ts +35 -0
  22. package/dist/lib/auth/v2-storage.d.ts.map +1 -0
  23. package/dist/lib/auth/v2-storage.js +79 -0
  24. package/dist/lib/auth/v2-storage.js.map +1 -0
  25. package/dist/lib/config.d.ts +17 -0
  26. package/dist/lib/config.d.ts.map +1 -0
  27. package/dist/lib/config.js +51 -0
  28. package/dist/lib/config.js.map +1 -0
  29. package/dist/lib/constants.d.ts +69 -0
  30. package/dist/lib/constants.d.ts.map +1 -0
  31. package/dist/lib/constants.js +69 -0
  32. package/dist/lib/constants.js.map +1 -0
  33. package/dist/lib/logger.d.ts +21 -0
  34. package/dist/lib/logger.d.ts.map +1 -0
  35. package/dist/lib/logger.js +77 -0
  36. package/dist/lib/logger.js.map +1 -0
  37. package/dist/lib/oauth-success.html +712 -0
  38. package/dist/lib/prompts/codex-opencode-bridge.d.ts +19 -0
  39. package/dist/lib/prompts/codex-opencode-bridge.d.ts.map +1 -0
  40. package/dist/lib/prompts/codex-opencode-bridge.js +157 -0
  41. package/dist/lib/prompts/codex-opencode-bridge.js.map +1 -0
  42. package/dist/lib/prompts/codex.d.ts +27 -0
  43. package/dist/lib/prompts/codex.d.ts.map +1 -0
  44. package/dist/lib/prompts/codex.js +256 -0
  45. package/dist/lib/prompts/codex.js.map +1 -0
  46. package/dist/lib/prompts/opencode-codex.d.ts +21 -0
  47. package/dist/lib/prompts/opencode-codex.d.ts.map +1 -0
  48. package/dist/lib/prompts/opencode-codex.js +91 -0
  49. package/dist/lib/prompts/opencode-codex.js.map +1 -0
  50. package/dist/lib/request/fetch-helpers.d.ts +73 -0
  51. package/dist/lib/request/fetch-helpers.d.ts.map +1 -0
  52. package/dist/lib/request/fetch-helpers.js +231 -0
  53. package/dist/lib/request/fetch-helpers.js.map +1 -0
  54. package/dist/lib/request/helpers/input-utils.d.ts +6 -0
  55. package/dist/lib/request/helpers/input-utils.d.ts.map +1 -0
  56. package/dist/lib/request/helpers/input-utils.js +174 -0
  57. package/dist/lib/request/helpers/input-utils.js.map +1 -0
  58. package/dist/lib/request/helpers/model-map.d.ts +28 -0
  59. package/dist/lib/request/helpers/model-map.d.ts.map +1 -0
  60. package/dist/lib/request/helpers/model-map.js +134 -0
  61. package/dist/lib/request/helpers/model-map.js.map +1 -0
  62. package/dist/lib/request/helpers/model-registry-data.d.ts +86 -0
  63. package/dist/lib/request/helpers/model-registry-data.d.ts.map +1 -0
  64. package/dist/lib/request/helpers/model-registry-data.js +293 -0
  65. package/dist/lib/request/helpers/model-registry-data.js.map +1 -0
  66. package/dist/lib/request/helpers/model-registry.d.ts +45 -0
  67. package/dist/lib/request/helpers/model-registry.d.ts.map +1 -0
  68. package/dist/lib/request/helpers/model-registry.js +208 -0
  69. package/dist/lib/request/helpers/model-registry.js.map +1 -0
  70. package/dist/lib/request/helpers/skill-catalog.d.ts +59 -0
  71. package/dist/lib/request/helpers/skill-catalog.d.ts.map +1 -0
  72. package/dist/lib/request/helpers/skill-catalog.js +81 -0
  73. package/dist/lib/request/helpers/skill-catalog.js.map +1 -0
  74. package/dist/lib/request/request-transformer.d.ts +81 -0
  75. package/dist/lib/request/request-transformer.d.ts.map +1 -0
  76. package/dist/lib/request/request-transformer.js +477 -0
  77. package/dist/lib/request/request-transformer.js.map +1 -0
  78. package/dist/lib/request/response-handler.d.ts +14 -0
  79. package/dist/lib/request/response-handler.d.ts.map +1 -0
  80. package/dist/lib/request/response-handler.js +88 -0
  81. package/dist/lib/request/response-handler.js.map +1 -0
  82. package/dist/lib/types.d.ts +178 -0
  83. package/dist/lib/types.d.ts.map +1 -0
  84. package/dist/lib/types.js +2 -0
  85. package/dist/lib/types.js.map +1 -0
  86. package/dist/v2.d.ts +34 -0
  87. package/dist/v2.d.ts.map +1 -0
  88. package/dist/v2.js +259 -0
  89. package/dist/v2.js.map +1 -0
  90. package/package.json +87 -0
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Model Configuration Map
3
+ *
4
+ * Maps model config IDs to their normalized API model names.
5
+ * Only includes exact config IDs that OpenCode will pass to the plugin.
6
+ */
7
+ /**
8
+ * Map of config model IDs to normalized API model names
9
+ *
10
+ * Key: The model ID as specified in opencode.json config
11
+ * Value: The normalized model name to send to the API
12
+ */
13
+ export const MODEL_MAP = {
14
+ // ============================================================================
15
+ // GPT-5.6 Models (none/low/medium/high/xhigh/max)
16
+ // ============================================================================
17
+ "gpt-5.6": "gpt-5.6-sol",
18
+ "gpt-5.6-sol": "gpt-5.6-sol",
19
+ "gpt-5.6-sol-none": "gpt-5.6-sol",
20
+ "gpt-5.6-sol-low": "gpt-5.6-sol",
21
+ "gpt-5.6-sol-medium": "gpt-5.6-sol",
22
+ "gpt-5.6-sol-high": "gpt-5.6-sol",
23
+ "gpt-5.6-sol-xhigh": "gpt-5.6-sol",
24
+ "gpt-5.6-sol-max": "gpt-5.6-sol",
25
+ "gpt-5.6-terra": "gpt-5.6-terra",
26
+ "gpt-5.6-terra-none": "gpt-5.6-terra",
27
+ "gpt-5.6-terra-low": "gpt-5.6-terra",
28
+ "gpt-5.6-terra-medium": "gpt-5.6-terra",
29
+ "gpt-5.6-terra-high": "gpt-5.6-terra",
30
+ "gpt-5.6-terra-xhigh": "gpt-5.6-terra",
31
+ "gpt-5.6-terra-max": "gpt-5.6-terra",
32
+ "gpt-5.6-luna": "gpt-5.6-luna",
33
+ "gpt-5.6-luna-none": "gpt-5.6-luna",
34
+ "gpt-5.6-luna-low": "gpt-5.6-luna",
35
+ "gpt-5.6-luna-medium": "gpt-5.6-luna",
36
+ "gpt-5.6-luna-high": "gpt-5.6-luna",
37
+ "gpt-5.6-luna-xhigh": "gpt-5.6-luna",
38
+ "gpt-5.6-luna-max": "gpt-5.6-luna",
39
+ // ============================================================================
40
+ // GPT-5.1 Codex Models
41
+ // ============================================================================
42
+ "gpt-5.1-codex": "gpt-5.1-codex",
43
+ "gpt-5.1-codex-low": "gpt-5.1-codex",
44
+ "gpt-5.1-codex-medium": "gpt-5.1-codex",
45
+ "gpt-5.1-codex-high": "gpt-5.1-codex",
46
+ // ============================================================================
47
+ // GPT-5.1 Codex Max Models
48
+ // ============================================================================
49
+ "gpt-5.1-codex-max": "gpt-5.1-codex-max",
50
+ "gpt-5.1-codex-max-low": "gpt-5.1-codex-max",
51
+ "gpt-5.1-codex-max-medium": "gpt-5.1-codex-max",
52
+ "gpt-5.1-codex-max-high": "gpt-5.1-codex-max",
53
+ "gpt-5.1-codex-max-xhigh": "gpt-5.1-codex-max",
54
+ // ============================================================================
55
+ // GPT-5.2 Models (supports none/low/medium/high/xhigh per OpenAI API docs)
56
+ // ============================================================================
57
+ "gpt-5.2": "gpt-5.2",
58
+ "gpt-5.2-none": "gpt-5.2",
59
+ "gpt-5.2-low": "gpt-5.2",
60
+ "gpt-5.2-medium": "gpt-5.2",
61
+ "gpt-5.2-high": "gpt-5.2",
62
+ "gpt-5.2-xhigh": "gpt-5.2",
63
+ // ============================================================================
64
+ // GPT-5.2 Codex Models (low/medium/high/xhigh)
65
+ // ============================================================================
66
+ "gpt-5.2-codex": "gpt-5.2-codex",
67
+ "gpt-5.2-codex-low": "gpt-5.2-codex",
68
+ "gpt-5.2-codex-medium": "gpt-5.2-codex",
69
+ "gpt-5.2-codex-high": "gpt-5.2-codex",
70
+ "gpt-5.2-codex-xhigh": "gpt-5.2-codex",
71
+ // ============================================================================
72
+ // GPT-5.1 Codex Mini Models
73
+ // ============================================================================
74
+ "gpt-5.1-codex-mini": "gpt-5.1-codex-mini",
75
+ "gpt-5.1-codex-mini-medium": "gpt-5.1-codex-mini",
76
+ "gpt-5.1-codex-mini-high": "gpt-5.1-codex-mini",
77
+ // ============================================================================
78
+ // GPT-5.1 General Purpose Models (supports none/low/medium/high per OpenAI API docs)
79
+ // ============================================================================
80
+ "gpt-5.1": "gpt-5.1",
81
+ "gpt-5.1-none": "gpt-5.1",
82
+ "gpt-5.1-low": "gpt-5.1",
83
+ "gpt-5.1-medium": "gpt-5.1",
84
+ "gpt-5.1-high": "gpt-5.1",
85
+ "gpt-5.1-chat-latest": "gpt-5.1",
86
+ // ============================================================================
87
+ // GPT-5 Codex Models (LEGACY - maps to gpt-5.1-codex as gpt-5 is being phased out)
88
+ // ============================================================================
89
+ "gpt-5-codex": "gpt-5.1-codex",
90
+ // ============================================================================
91
+ // GPT-5 Codex Mini Models (LEGACY - maps to gpt-5.1-codex-mini)
92
+ // ============================================================================
93
+ "codex-mini-latest": "gpt-5.1-codex-mini",
94
+ "gpt-5-codex-mini": "gpt-5.1-codex-mini",
95
+ "gpt-5-codex-mini-medium": "gpt-5.1-codex-mini",
96
+ "gpt-5-codex-mini-high": "gpt-5.1-codex-mini",
97
+ // ============================================================================
98
+ // GPT-5 General Purpose Models (LEGACY - maps to gpt-5.1 as gpt-5 is being phased out)
99
+ // ============================================================================
100
+ "gpt-5": "gpt-5.1",
101
+ "gpt-5-mini": "gpt-5.1",
102
+ "gpt-5-nano": "gpt-5.1",
103
+ };
104
+ /**
105
+ * Get normalized model name from config ID
106
+ *
107
+ * @param modelId - Model ID from config (e.g., "gpt-5.1-codex-low")
108
+ * @returns Normalized model name (e.g., "gpt-5.1-codex") or undefined if not found
109
+ */
110
+ export function getNormalizedModel(modelId) {
111
+ try {
112
+ // Try direct lookup first
113
+ if (MODEL_MAP[modelId]) {
114
+ return MODEL_MAP[modelId];
115
+ }
116
+ // Try case-insensitive lookup
117
+ const lowerModelId = modelId.toLowerCase();
118
+ const match = Object.keys(MODEL_MAP).find((key) => key.toLowerCase() === lowerModelId);
119
+ return match ? MODEL_MAP[match] : undefined;
120
+ }
121
+ catch {
122
+ return undefined;
123
+ }
124
+ }
125
+ /**
126
+ * Check if a model ID is in the model map
127
+ *
128
+ * @param modelId - Model ID to check
129
+ * @returns True if model is in the map
130
+ */
131
+ export function isKnownModel(modelId) {
132
+ return getNormalizedModel(modelId) !== undefined;
133
+ }
134
+ //# sourceMappingURL=model-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-map.js","sourceRoot":"","sources":["../../../../lib/request/helpers/model-map.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAA2B;IAChD,+EAA+E;IAC/E,kDAAkD;IAClD,+EAA+E;IAC/E,SAAS,EAAE,aAAa;IACxB,aAAa,EAAE,aAAa;IAC5B,kBAAkB,EAAE,aAAa;IACjC,iBAAiB,EAAE,aAAa;IAChC,oBAAoB,EAAE,aAAa;IACnC,kBAAkB,EAAE,aAAa;IACjC,mBAAmB,EAAE,aAAa;IAClC,iBAAiB,EAAE,aAAa;IAChC,eAAe,EAAE,eAAe;IAChC,oBAAoB,EAAE,eAAe;IACrC,mBAAmB,EAAE,eAAe;IACpC,sBAAsB,EAAE,eAAe;IACvC,oBAAoB,EAAE,eAAe;IACrC,qBAAqB,EAAE,eAAe;IACtC,mBAAmB,EAAE,eAAe;IACpC,cAAc,EA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AA+E;IAC/E,mFAAmF;IACnF,+EAA+E;IAC/E,aAAa,EAAE,eAAe;IAE9B,+EAA+E;IAC/E,gEAAgE;IAChE,+EAA+E;IAC/E,mBAAmB,EAAE,oBAAoB;IACzC,kBAAkB,EAAE,oBAAoB;IACxC,yBAAyB,EAAE,oBAAoB;IAC/C,uBAAuB,EAAE,oBAAoB;IAE7C,+EAA+E;IAC/E,uFAAuF;IACvF,+EAA+E;IAC/E,OAAO,EAAE,SAAS;IAClB,YAAY,EAAE,SAAS;IACvB,YAAY,EAAE,SAAS;CACvB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe;IACjD,IAAI,CAAC;QACJ,0BAA0B;QAC1B,IAAI,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YACxB,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;QAED,8BAA8B;QAC9B,MAAM,YAAY,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;QAC3C,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CACxC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,YAAY,CAC3C,CAAC;QAEF,OAAO,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe;IAC3C,OAAO,kBAAkB,CAAC,OAAO,CAAC,KAAK,SAAS,CAAC;AAClD,CAAC"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Model Registry — bundled defaults
3
+ *
4
+ * Single source of truth for "what models does this plugin know about".
5
+ *
6
+ * WHY THIS FILE EXISTS
7
+ * ---------------------
8
+ * Historically, adding support for a brand-new model (e.g. GPT-5.6) required
9
+ * touching every one of these places by hand:
10
+ * - lib/request/helpers/model-map.ts (exact preset id -> API model id)
11
+ * - lib/request/request-transformer.ts (reasoning capability booleans)
12
+ * - lib/prompts/codex.ts (prompt-family + cache-file maps)
13
+ * - config/opencode-legacy.json + config/opencode-modern.json (presets)
14
+ * - README.md + config/README.md
15
+ * - several test files
16
+ *
17
+ * That is a lot of surface area for a maintainer to keep in sync, especially
18
+ * for a solo/volunteer-maintained plugin. This registry collapses the *model
19
+ * knowledge* part (normalization, reasoning capabilities, prompt family) into
20
+ * ONE array of plain data objects. Adding a new model family now means
21
+ * appending one `ModelRegistryEntry` here — normalizeModel(), getReasoningConfig(),
22
+ * and getModelFamily() all consult this data automatically (see model-registry.ts).
23
+ *
24
+ * Config presets (config/opencode-*.json) and README tables still need their
25
+ * own entries, because they carry human-facing metadata (display names,
26
+ * context limits) this registry intentionally does not duplicate. But the
27
+ * *behavioral* wiring — which API model id to send, which reasoning efforts
28
+ * are legal, and which Codex CLI prompt to use — is now data-driven.
29
+ *
30
+ * REMOTE OVERLAY
31
+ * ---------------
32
+ * lib/request/helpers/model-registry.ts can optionally merge this bundled
33
+ * list with a remotely-hosted JSON overlay (ETag-cached, same pattern as
34
+ * lib/prompts/codex.ts's instruction fetching). That lets an active
35
+ * maintainer ship recognition for a new model instantly (by updating a JSON
36
+ * file on GitHub) without waiting for users to upgrade the npm package. It
37
+ * is entirely opt-in (no default URL is configured) — see README.md.
38
+ */
39
+ import type { ModelFamily } from "../../prompts/codex.js";
40
+ /** Reasoning effort values accepted anywhere in this plugin. */
41
+ export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
42
+ /**
43
+ * Which non-universal reasoning effort tiers a model family accepts.
44
+ * "low"/"medium"/"high" are assumed universal and are not tracked here.
45
+ */
46
+ export interface ModelCapabilities {
47
+ /** Accepts reasoning.effort = "none" (general-purpose GPT-5.x/5.6 models). */
48
+ none?: boolean;
49
+ /** Accepts reasoning.effort = "xhigh" (flagship + Codex Max/5.2-codex/5.6). */
50
+ xhigh?: boolean;
51
+ /** Accepts reasoning.effort = "max" (currently GPT-5.6 only). */
52
+ max?: boolean;
53
+ }
54
+ /**
55
+ * One model family known to the plugin.
56
+ *
57
+ * `id` is what gets sent to the Codex API. `aliases` are every exact preset
58
+ * id (config key / model string) that should resolve to this entry,
59
+ * matched case-insensitively. Always include `id` itself in `aliases`.
60
+ */
61
+ export interface ModelRegistryEntry {
62
+ /** Canonical model id sent to the Codex API, e.g. "gpt-5.2-codex". */
63
+ id: string;
64
+ /** Exact preset/config ids that resolve to this entry (case-insensitive). */
65
+ aliases: string[];
66
+ /** Codex CLI prompt/instructions family used to pick the system prompt. */
67
+ family: ModelFamily;
68
+ /** Reasoning effort tiers this model accepts beyond low/medium/high. */
69
+ capabilities?: ModelCapabilities;
70
+ /** Effort used when the user hasn't configured one explicitly. */
71
+ defaultEffort: ReasoningEffort;
72
+ /** Codex Mini has a narrow effort range (medium/high only) with its own clamp rules. */
73
+ isCodexMini?: boolean;
74
+ /** Legacy nano/mini presets default to a lower effort before being clamped to "low". */
75
+ isLightweight?: boolean;
76
+ /** Optional human-readable note for maintainers browsing this file. */
77
+ note?: string;
78
+ }
79
+ /**
80
+ * Bundled model registry, shipped with every release of this package.
81
+ *
82
+ * ORDER DOES NOT MATTER — lookups are by exact alias, not by scanning order —
83
+ * but keep newest models near the top for readability.
84
+ */
85
+ export declare const BUNDLED_MODEL_REGISTRY: ModelRegistryEntry[];
86
+ //# sourceMappingURL=model-registry-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-registry-data.d.ts","sourceRoot":"","sources":["../../../../lib/request/helpers/model-registry-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,gEAAgE;AAChE,MAAM,MAAM,eAAe,GACxB,MAAM,GACN,SAAS,GACT,KAAK,GACL,QAAQ,GACR,MAAM,GACN,OAAO,GACP,KAAK,CAAC;AAET;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC,8EAA8E;IAC9E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,+EAA+E;IAC/E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,iEAAiE;IACjE,GAAG,CAAC,EAAE,OAAO,CAAC;CACd;AAED;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IAClC,sEAAsE;IACtE,EAAE,EAAE,MAAM,CAAC;IACX,6EAA6E;IAC7E,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,2EAA2E;IAC3E,MAAM,EAAE,WAAW,CAAC;IACpB,wEAAwE;IACxE,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,kEAAkE;IAClE,aAAa,EAAE,eAAe,CAAC;IAC/B,wFAAwF;IACxF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,wFAAwF;IACxF,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,kBAAkB,EAmQtD,CAAC"}
@@ -0,0 +1,293 @@
1
+ /**
2
+ * Model Registry — bundled defaults
3
+ *
4
+ * Single source of truth for "what models does this plugin know about".
5
+ *
6
+ * WHY THIS FILE EXISTS
7
+ * ---------------------
8
+ * Historically, adding support for a brand-new model (e.g. GPT-5.6) required
9
+ * touching every one of these places by hand:
10
+ * - lib/request/helpers/model-map.ts (exact preset id -> API model id)
11
+ * - lib/request/request-transformer.ts (reasoning capability booleans)
12
+ * - lib/prompts/codex.ts (prompt-family + cache-file maps)
13
+ * - config/opencode-legacy.json + config/opencode-modern.json (presets)
14
+ * - README.md + config/README.md
15
+ * - several test files
16
+ *
17
+ * That is a lot of surface area for a maintainer to keep in sync, especially
18
+ * for a solo/volunteer-maintained plugin. This registry collapses the *model
19
+ * knowledge* part (normalization, reasoning capabilities, prompt family) into
20
+ * ONE array of plain data objects. Adding a new model family now means
21
+ * appending one `ModelRegistryEntry` here — normalizeModel(), getReasoningConfig(),
22
+ * and getModelFamily() all consult this data automatically (see model-registry.ts).
23
+ *
24
+ * Config presets (config/opencode-*.json) and README tables still need their
25
+ * own entries, because they carry human-facing metadata (display names,
26
+ * context limits) this registry intentionally does not duplicate. But the
27
+ * *behavioral* wiring — which API model id to send, which reasoning efforts
28
+ * are legal, and which Codex CLI prompt to use — is now data-driven.
29
+ *
30
+ * REMOTE OVERLAY
31
+ * ---------------
32
+ * lib/request/helpers/model-registry.ts can optionally merge this bundled
33
+ * list with a remotely-hosted JSON overlay (ETag-cached, same pattern as
34
+ * lib/prompts/codex.ts's instruction fetching). That lets an active
35
+ * maintainer ship recognition for a new model instantly (by updating a JSON
36
+ * file on GitHub) without waiting for users to upgrade the npm package. It
37
+ * is entirely opt-in (no default URL is configured) — see README.md.
38
+ */
39
+ /**
40
+ * Bundled model registry, shipped with every release of this package.
41
+ *
42
+ * ORDER DOES NOT MATTER — lookups are by exact alias, not by scanning order —
43
+ * but keep newest models near the top for readability.
44
+ */
45
+ export const BUNDLED_MODEL_REGISTRY = [
46
+ // ============================================================================
47
+ // GPT-6 Astra (low/medium/high/xhigh/max — no "none")
48
+ // ============================================================================
49
+ {
50
+ id: "gpt-6-astra",
51
+ aliases: [
52
+ "gpt-6-astra",
53
+ "gpt-6",
54
+ "gpt-6-astra-low",
55
+ "gpt-6-astra-medium",
56
+ "gpt-6-astra-high",
57
+ "gpt-6-astra-xhigh",
58
+ "gpt-6-astra-max",
59
+ ],
60
+ // openai/codex has not published a dedicated gpt-6 prompt file yet
61
+ // (checked release rust-v0.153.4: codex-rs/core has no gpt-6* prompt).
62
+ // Reuses the gpt-5.2 general-purpose prompt family until one exists.
63
+ family: "gpt-5.2",
64
+ capabilities: { xhigh: true, max: true },
65
+ defaultEffort: "high",
66
+ note: "Verified live against the ChatGPT Codex backend (2026-09-06): " +
67
+ "'gpt-6-astra' is the real API model id — bare 'gpt-6' is REJECTED " +
68
+ "by the API ({\"detail\":\"The 'gpt-6' model is not supported...\"}) " +
69
+ "but is kept here as a convenience alias, same as 'gpt-5.6' -> sol. " +
70
+ "Supported reasoning efforts confirmed via the API's own error " +
71
+ "message when 'none' was rejected: \"Supported values are: 'low', " +
72
+ "'medium', 'high', 'xhigh', and 'max'.\" Context/output limits in " +
73
+ "the config presets are provisional (borrowed from gpt-5.2) — " +
74
+ "OpenAI hasn't published official numbers for this model yet.",
75
+ },
76
+ // ============================================================================
77
+ // GPT-6 Sol / Luna (none/low/medium/high/xhigh/max) — reuses the gpt-5.6
78
+ // prompt family, same behavior/effort tiers as gpt-5.6-sol/terra/luna.
79
+ // ============================================================================
80
+ {
81
+ id: "gpt-6-sol",
82
+ aliases: [
83
+ "gpt-6-sol",
84
+ "gpt-6-sol-none",
85
+ "gpt-6-sol-low",
86
+ "gpt-6-sol-medium",
87
+ "gpt-6-sol-high",
88
+ "gpt-6-sol-xhigh",
89
+ "gpt-6-sol-max",
90
+ ],
91
+ family: "gpt-5.6",
92
+ capabilities: { none: true, xhigh: true, max: true },
93
+ defaultEffort: "medium",
94
+ note: "Verified live against the ChatGPT Codex backend (2026-09-22): " +
95
+ "'gpt-6-sol' is a real API model id (HTTP 200 for a bare probe, plus " +
96
+ "HTTP 200 for reasoning.effort = none/minimal/low/medium/high/xhigh/max, " +
97
+ "confirmed via the same methodology as gpt-6-astra). openai/codex has " +
98
+ "not published a dedicated gpt-6 prompt file yet (checked release " +
99
+ "rust-v0.156.0: codex-rs/core still only has 5.1/5.1-codex-max/5.2/" +
100
+ "5.2-codex prompt files) — reuses the gpt-5.6 prompt family. Context " +
101
+ "window (1,050,000 / 922,000 input / 128,000 output) confirmed via " +
102
+ "models.dev's public catalog, not guessed.",
103
+ },
104
+ {
105
+ id: "gpt-6-luna",
106
+ aliases: [
107
+ "gpt-6-luna",
108
+ "gpt-6-luna-none",
109
+ "gpt-6-luna-low",
110
+ "gpt-6-luna-medium",
111
+ "gpt-6-luna-high",
112
+ "gpt-6-luna-xhigh",
113
+ "gpt-6-luna-max",
114
+ ],
115
+ family: "gpt-5.6",
116
+ capabilities: { none: true, xhigh: true, max: true },
117
+ defaultEffort: "medium",
118
+ note: "Verified live against the ChatGPT Codex backend (2026-09-22), same " +
119
+ "methodology and same result as gpt-6-sol (see its note): real API " +
120
+ "model id, full none/minimal/low/medium/high/xhigh/max reasoning " +
121
+ "range, reuses the gpt-5.6 prompt family, 1,050,000 context window " +
122
+ "confirmed via models.dev.",
123
+ },
124
+ // ============================================================================
125
+ // GPT-5.6 (none/low/medium/high/xhigh/max)
126
+ // ============================================================================
127
+ {
128
+ id: "gpt-5.6-sol",
129
+ aliases: [
130
+ "gpt-5.6",
131
+ "gpt-5.6-sol",
132
+ "gpt-5.6-sol-none",
133
+ "gpt-5.6-sol-low",
134
+ "gpt-5.6-sol-medium",
135
+ "gpt-5.6-sol-high",
136
+ "gpt-5.6-sol-xhigh",
137
+ "gpt-5.6-sol-max",
138
+ ],
139
+ family: "gpt-5.6",
140
+ capabilities: { none: true, xhigh: true, max: true },
141
+ defaultEffort: "medium",
142
+ },
143
+ {
144
+ id: "gpt-5.6-terra",
145
+ aliases: [
146
+ "gpt-5.6-terra",
147
+ "gpt-5.6-terra-none",
148
+ "gpt-5.6-terra-low",
149
+ "gpt-5.6-terra-medium",
150
+ "gpt-5.6-terra-high",
151
+ "gpt-5.6-terra-xhigh",
152
+ "gpt-5.6-terra-max",
153
+ ],
154
+ family: "gpt-5.6",
155
+ capabilities: { none: true, xhigh: true, max: true },
156
+ defaultEffort: "medium",
157
+ },
158
+ {
159
+ id: "gpt-5.6-luna",
160
+ aliases: [
161
+ "gpt-5.6-luna",
162
+ "gpt-5.6-luna-none",
163
+ "gpt-5.6-luna-low",
164
+ "gpt-5.6-luna-medium",
165
+ "gpt-5.6-luna-high",
166
+ "gpt-5.6-luna-xhigh",
167
+ "gpt-5.6-luna-max",
168
+ ],
169
+ family: "gpt-5.6",
170
+ capabilities: { none: true, xhigh: true, max: true },
171
+ defaultEffort: "medium",
172
+ },
173
+ // ============================================================================
174
+ // GPT-5.2 Codex (low/medium/high/xhigh)
175
+ // ============================================================================
176
+ {
177
+ id: "gpt-5.2-codex",
178
+ aliases: [
179
+ "gpt-5.2-codex",
180
+ "gpt-5.2-codex-low",
181
+ "gpt-5.2-codex-medium",
182
+ "gpt-5.2-codex-high",
183
+ "gpt-5.2-codex-xhigh",
184
+ ],
185
+ family: "gpt-5.2-codex",
186
+ capabilities: { xhigh: true },
187
+ defaultEffort: "high",
188
+ },
189
+ // ============================================================================
190
+ // GPT-5.2 general purpose (none/low/medium/high/xhigh)
191
+ // ============================================================================
192
+ {
193
+ id: "gpt-5.2",
194
+ aliases: [
195
+ "gpt-5.2",
196
+ "gpt-5.2-none",
197
+ "gpt-5.2-low",
198
+ "gpt-5.2-medium",
199
+ "gpt-5.2-high",
200
+ "gpt-5.2-xhigh",
201
+ ],
202
+ family: "gpt-5.2",
203
+ capabilities: { none: true, xhigh: true },
204
+ defaultEffort: "high",
205
+ },
206
+ // ============================================================================
207
+ // GPT-5.1 Codex Max (low/medium/high/xhigh)
208
+ // ============================================================================
209
+ {
210
+ id: "gpt-5.1-codex-max",
211
+ aliases: [
212
+ "gpt-5.1-codex-max",
213
+ "gpt-5.1-codex-max-low",
214
+ "gpt-5.1-codex-max-medium",
215
+ "gpt-5.1-codex-max-high",
216
+ "gpt-5.1-codex-max-xhigh",
217
+ ],
218
+ family: "codex-max",
219
+ capabilities: { xhigh: true },
220
+ defaultEffort: "high",
221
+ },
222
+ // ============================================================================
223
+ // GPT-5.1 Codex Mini (medium/high only, own clamp rules)
224
+ // ============================================================================
225
+ {
226
+ id: "gpt-5.1-codex-mini",
227
+ aliases: [
228
+ "gpt-5.1-codex-mini",
229
+ "gpt-5.1-codex-mini-medium",
230
+ "gpt-5.1-codex-mini-high",
231
+ // Legacy GPT-5.0 codex-mini names (being phased out) share the same behavior
232
+ "codex-mini-latest",
233
+ "gpt-5-codex-mini",
234
+ "gpt-5-codex-mini-medium",
235
+ "gpt-5-codex-mini-high",
236
+ ],
237
+ family: "codex",
238
+ defaultEffort: "medium",
239
+ isCodexMini: true,
240
+ },
241
+ // ============================================================================
242
+ // GPT-5.1 Codex (low/medium/high)
243
+ // ============================================================================
244
+ {
245
+ id: "gpt-5.1-codex",
246
+ aliases: [
247
+ "gpt-5.1-codex",
248
+ "gpt-5.1-codex-low",
249
+ "gpt-5.1-codex-medium",
250
+ "gpt-5.1-codex-high",
251
+ // Legacy GPT-5.0 codex name (being phased out) shares the same behavior
252
+ "gpt-5-codex",
253
+ ],
254
+ family: "codex",
255
+ defaultEffort: "medium",
256
+ },
257
+ // ============================================================================
258
+ // GPT-5.1 general purpose (none/low/medium/high)
259
+ // ============================================================================
260
+ {
261
+ id: "gpt-5.1",
262
+ aliases: [
263
+ "gpt-5.1",
264
+ "gpt-5.1-none",
265
+ "gpt-5.1-low",
266
+ "gpt-5.1-medium",
267
+ "gpt-5.1-high",
268
+ "gpt-5.1-chat-latest",
269
+ // Legacy GPT-5.0 names (being phased out) normalize to gpt-5.1
270
+ "gpt-5",
271
+ ],
272
+ family: "gpt-5.1",
273
+ capabilities: { none: true },
274
+ defaultEffort: "medium",
275
+ },
276
+ // ============================================================================
277
+ // Legacy GPT-5.0 lightweight presets (being phased out; normalize to gpt-5.1)
278
+ // Kept as distinct aliases (not merged into the "gpt-5.1" entry above) so
279
+ // getReasoningConfig() still recognizes them as lightweight when called with
280
+ // the raw preset id, before normalizeModel() has stripped the "nano"/"mini"
281
+ // signal from the model string.
282
+ // ============================================================================
283
+ {
284
+ id: "gpt-5.1",
285
+ aliases: ["gpt-5-mini", "gpt-5-nano"],
286
+ family: "gpt-5.1",
287
+ capabilities: { none: true },
288
+ defaultEffort: "minimal",
289
+ isLightweight: true,
290
+ note: "Legacy gpt-5-mini/gpt-5-nano presets. gpt-5 is being phased out in favor of gpt-5.1.",
291
+ },
292
+ ];
293
+ //# sourceMappingURL=model-registry-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-registry-data.js","sourceRoot":"","sources":["../../../../lib/request/helpers/model-registry-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAqDH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAyB;IAC3D,+EAA+E;IAC/E,sDAAsD;IACtD,+EAA+E;IAC/E;QACC,EAAE,EAAE,aAAa;QACjB,OAAO,EAAE;YACR,aAAa;YACb,OAAO;YACP,iBAAiB;YACjB,oBAAoB;YACpB,kBAAkB;YAClB,mBAAmB;YACnB,iBAAiB;SACjB;QACD,mEAAmE;QACnE,uEAAuE;QACvE,qEAAqE;QACrE,MAAM,EAAE,SAAS;QACjB,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE;QACxC,aAAa,EAAE,MAAM;QACrB,IAAI,EACH,gEAAgE;YAChE,oEAAoE;YACpE,sEAAsE;YACtE,qEAAqE;YACrE,gEAAgE;YAChE,mEAAmE;YACnE,mEAAmE;YACnE,+DAA+D;YAC/D,8DAA8D;KAC/D;IAED,+EAA+E;IAC/E,yEAAyE;IACzE,uEAAuE;IACvE,+EAA+E;IAC/E;QACC,EAAE,EAAE,WAAW;QACf,OAAO,EAAE;YACR,WAAW;YACX,gBAAgB;YAChB,eAAe;YACf,kBAAkB;YAClB,gBAAgB;YAChB,iBAAiB;YACjB,eAAe;SACf;QACD,MAAM,EAAE,SAAS;QACjB,YAAY,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE;QACpD,aAAa,EAAE,QAAQ;QACvB,IAAI,EACH,gEAAgE;YAChE,sEAAsE;YACtE,0EAA0E;YAC1E,uEAAuE;YACvE,mEAAmE;YACnE,oEAAoE;YACpE,sEAAsE;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Q;QACvB,WAAW,EAAE,IAAI;KACjB;IAED,+EAA+E;IAC/E,kCAAkC;IAClC,+EAA+E;IAC/E;QACC,EAAE,EAAE,eAAe;QACnB,OAAO,EAAE;YACR,eAAe;YACf,mBAAmB;YACnB,sBAAsB;YACtB,oBAAoB;YACpB,wEAAwE;YACxE,aAAa;SACb;QACD,MAAM,EAAE,OAAO;QACf,aAAa,EAAE,QAAQ;KACvB;IAED,+EAA+E;IAC/E,iDAAiD;IACjD,+EAA+E;IAC/E;QACC,EAAE,EAAE,SAAS;QACb,OAAO,EAAE;YACR,SAAS;YACT,cAAc;YACd,aAAa;YACb,gBAAgB;YAChB,cAAc;YACd,qBAAqB;YACrB,+DAA+D;YAC/D,OAAO;SACP;QACD,MAAM,EAAE,SAAS;QACjB,YAAY,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;QAC5B,aAAa,EAAE,QAAQ;KACvB;IAED,+EAA+E;IAC/E,8EAA8E;IAC9E,0EAA0E;IAC1E,6EAA6E;IAC7E,4EAA4E;IAC5E,gCAAgC;IAChC,+EAA+E;IAC/E;QACC,EAAE,EAAE,SAAS;QACb,OAAO,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC;QACrC,MAAM,EAAE,SAAS;QACjB,YAAY,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;QAC5B,aAAa,EAAE,SAAS;QACxB,aAAa,EAAE,IAAI;QACnB,IAAI,EAAE,sFAAsF;KAC5F;CACD,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Model Registry — lookup, merging, and optional remote overlay
3
+ *
4
+ * Consumers (normalizeModel, getReasoningConfig, getModelFamily) call
5
+ * `lookupModelRegistryEntry()` synchronously. The registry itself is always
6
+ * available synchronously (bundled defaults + last-persisted remote overlay,
7
+ * both loaded once at module init); a remote refresh — when configured — runs
8
+ * in the background and updates the in-memory copy for *future* lookups. This
9
+ * means a request is never delayed or blocked by a network call.
10
+ *
11
+ * The remote overlay is entirely OPT-IN: unless a maintainer or user
12
+ * explicitly configures `modelRegistryUrl` (plugin config) or the
13
+ * `OPENCODE_CODEX_MODEL_REGISTRY_URL` env var, no network request is ever
14
+ * made. This keeps the default (and every existing test) fully offline.
15
+ */
16
+ import { type ModelRegistryEntry } from "./model-registry-data.js";
17
+ /**
18
+ * Configure the remote overlay source. Called once by index.ts from the
19
+ * loaded plugin config. Pass `undefined`/empty to disable.
20
+ */
21
+ export declare function configureModelRegistrySource(url: string | undefined): void;
22
+ /**
23
+ * Test-only: deterministically run (and await) a refresh attempt against the
24
+ * currently configured URL, bypassing the fire-and-forget wrapper. No-op
25
+ * (resolves immediately) if no URL is configured.
26
+ */
27
+ export declare function __triggerModelRegistryRefreshForTests(): Promise<void>;
28
+ /**
29
+ * Get the current model registry (bundled defaults + any merged overlay).
30
+ * Synchronous — safe to call from hot request-handling paths.
31
+ */
32
+ export declare function getModelRegistry(): ModelRegistryEntry[];
33
+ /**
34
+ * Look up a model id or preset name in the registry, case-insensitively.
35
+ * Returns undefined if nothing matches (callers should fall back to their
36
+ * own generic pattern matching for completely unrecognized names).
37
+ */
38
+ export declare function lookupModelRegistryEntry(modelId: string | undefined): ModelRegistryEntry | undefined;
39
+ /**
40
+ * Test-only: reset in-memory state and force a specific configured URL.
41
+ * Not exported from the package's public surface.
42
+ */
43
+ export declare function __resetModelRegistryForTests(): void;
44
+ export type { ModelRegistryEntry } from "./model-registry-data.js";
45
+ //# sourceMappingURL=model-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-registry.d.ts","sourceRoot":"","sources":["../../../../lib/request/helpers/model-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,EAEN,KAAK,kBAAkB,EACvB,MAAM,0BAA0B,CAAC;AA+FlC;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAE1E;AAqFD;;;;GAIG;AACH,wBAAsB,qCAAqC,IAAI,OAAO,CAAC,IAAI,CAAC,CAI3E;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,kBAAkB,EAAE,CAGvD;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACvC,OAAO,EAAE,MAAM,GAAG,SAAS,GACzB,kBAAkB,GAAG,SAAS,CAIhC;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,IAAI,IAAI,CAKnD;AAED,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC"}