opencode-openai-codex-auth-multi 4.3.0-multiaccount.1 → 4.5.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/LICENSE +37 -37
- package/README.md +463 -80
- package/assets/opencode-logo-ornate-dark.svg +18 -18
- package/assets/readme-hero.svg +31 -31
- package/config/README.md +98 -98
- package/config/minimal-opencode.json +11 -11
- package/config/opencode-legacy.json +568 -568
- package/config/opencode-modern.json +236 -236
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +391 -135
- package/dist/index.js.map +1 -1
- package/dist/lib/accounts.d.ts +85 -11
- package/dist/lib/accounts.d.ts.map +1 -1
- package/dist/lib/accounts.js +352 -62
- package/dist/lib/accounts.js.map +1 -1
- package/dist/lib/auth/auth.d.ts +9 -1
- package/dist/lib/auth/auth.d.ts.map +1 -1
- package/dist/lib/auth/auth.js +26 -13
- package/dist/lib/auth/auth.js.map +1 -1
- package/dist/lib/auth/browser.d.ts.map +1 -1
- package/dist/lib/auth/browser.js +9 -2
- package/dist/lib/auth/browser.js.map +1 -1
- package/dist/lib/auth/server.d.ts.map +1 -1
- package/dist/lib/auth/server.js +11 -4
- package/dist/lib/auth/server.js.map +1 -1
- package/dist/lib/auto-update-checker.d.ts +10 -0
- package/dist/lib/auto-update-checker.d.ts.map +1 -0
- package/dist/lib/auto-update-checker.js +129 -0
- package/dist/lib/auto-update-checker.js.map +1 -0
- package/dist/lib/cli.d.ts +1 -0
- package/dist/lib/cli.d.ts.map +1 -1
- package/dist/lib/cli.js +11 -6
- package/dist/lib/cli.js.map +1 -1
- package/dist/lib/config.d.ts +5 -7
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +49 -6
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/constants.d.ts +7 -0
- package/dist/lib/constants.d.ts.map +1 -1
- package/dist/lib/constants.js +7 -0
- package/dist/lib/constants.js.map +1 -1
- package/dist/lib/index.d.ts +13 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +13 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/logger.d.ts +13 -17
- package/dist/lib/logger.d.ts.map +1 -1
- package/dist/lib/logger.js +89 -24
- package/dist/lib/logger.js.map +1 -1
- package/dist/lib/oauth-success.html +712 -712
- package/dist/lib/prompts/codex-opencode-bridge.js +121 -121
- package/dist/lib/prompts/codex.d.ts +5 -0
- package/dist/lib/prompts/codex.d.ts.map +1 -1
- package/dist/lib/prompts/codex.js +114 -93
- package/dist/lib/prompts/codex.js.map +1 -1
- package/dist/lib/refresh-queue.d.ts +100 -0
- package/dist/lib/refresh-queue.d.ts.map +1 -0
- package/dist/lib/refresh-queue.js +196 -0
- package/dist/lib/refresh-queue.js.map +1 -0
- package/dist/lib/request/fetch-helpers.d.ts +2 -3
- package/dist/lib/request/fetch-helpers.d.ts.map +1 -1
- package/dist/lib/request/fetch-helpers.js +26 -29
- package/dist/lib/request/fetch-helpers.js.map +1 -1
- package/dist/lib/request/rate-limit-backoff.d.ts +17 -0
- package/dist/lib/request/rate-limit-backoff.d.ts.map +1 -0
- package/dist/lib/request/rate-limit-backoff.js +74 -0
- package/dist/lib/request/rate-limit-backoff.js.map +1 -0
- package/dist/lib/request/request-transformer.d.ts.map +1 -1
- package/dist/lib/request/request-transformer.js +3 -2
- package/dist/lib/request/request-transformer.js.map +1 -1
- package/dist/lib/request/response-handler.js +1 -1
- package/dist/lib/request/response-handler.js.map +1 -1
- package/dist/lib/rotation.d.ts +121 -0
- package/dist/lib/rotation.d.ts.map +1 -0
- package/dist/lib/rotation.js +248 -0
- package/dist/lib/rotation.js.map +1 -0
- package/dist/lib/storage.d.ts +72 -4
- package/dist/lib/storage.d.ts.map +1 -1
- package/dist/lib/storage.js +189 -19
- package/dist/lib/storage.js.map +1 -1
- package/dist/lib/types.d.ts +37 -1
- package/dist/lib/types.d.ts.map +1 -1
- package/package.json +85 -71
- package/scripts/install-opencode-codex-auth.js +191 -191
- package/scripts/test-all-models.sh +258 -258
- package/scripts/validate-model-map.sh +97 -97
|
@@ -7,127 +7,127 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Token Count: ~450 tokens (~90% reduction vs full OpenCode prompt)
|
|
9
9
|
*/
|
|
10
|
-
export const CODEX_OPENCODE_BRIDGE = `# Codex Running in OpenCode
|
|
11
|
-
|
|
12
|
-
You are running Codex through OpenCode, an open-source terminal coding assistant. OpenCode provides different tools but follows Codex operating principles.
|
|
13
|
-
|
|
14
|
-
## CRITICAL: Tool Replacements
|
|
15
|
-
|
|
16
|
-
<critical_rule priority="0">
|
|
17
|
-
❌ APPLY_PATCH DOES NOT EXIST → ✅ USE "edit" INSTEAD
|
|
18
|
-
- NEVER use: apply_patch, applyPatch
|
|
19
|
-
- ALWAYS use: edit tool for ALL file modifications
|
|
20
|
-
- Before modifying files: Verify you're using "edit", NOT "apply_patch"
|
|
21
|
-
</critical_rule>
|
|
22
|
-
|
|
23
|
-
<critical_rule priority="0">
|
|
24
|
-
❌ UPDATE_PLAN DOES NOT EXIST → ✅ USE "todowrite" INSTEAD
|
|
25
|
-
- NEVER use: update_plan, updatePlan, read_plan, readPlan
|
|
26
|
-
- ALWAYS use: todowrite for task/plan updates, todoread to read plans
|
|
27
|
-
- Before plan operations: Verify you're using "todowrite", NOT "update_plan"
|
|
28
|
-
</critical_rule>
|
|
29
|
-
|
|
30
|
-
## Available OpenCode Tools
|
|
31
|
-
|
|
32
|
-
**File Operations:**
|
|
33
|
-
- \`write\` - Create new files
|
|
34
|
-
- Overwriting existing files requires a prior Read in this session; default to ASCII unless the file already uses Unicode.
|
|
35
|
-
- \`edit\` - Modify existing files (REPLACES apply_patch)
|
|
36
|
-
- Requires a prior Read in this session; preserve exact indentation; ensure \`oldString\` uniquely matches or use \`replaceAll\`; edit fails if ambiguous or missing.
|
|
37
|
-
- \`read\` - Read file contents
|
|
38
|
-
|
|
39
|
-
**Search/Discovery:**
|
|
40
|
-
- \`grep\` - Search file contents (tool, not bash grep); use \`include\` to filter patterns; set \`path\` only when not searching workspace root; for cross-file match counts use bash with \`rg\`.
|
|
41
|
-
- \`glob\` - Find files by pattern; defaults to workspace cwd unless \`path\` is set.
|
|
42
|
-
- \`list\` - List directories (requires absolute paths)
|
|
43
|
-
|
|
44
|
-
**Execution:**
|
|
45
|
-
- \`bash\` - Run shell commands
|
|
46
|
-
- No workdir parameter; do not include it in tool calls.
|
|
47
|
-
- Always include a short description for the command.
|
|
48
|
-
- Do not use cd; use absolute paths in commands.
|
|
49
|
-
- Quote paths containing spaces with double quotes.
|
|
50
|
-
- Chain multiple commands with ';' or '&&'; avoid newlines.
|
|
51
|
-
- Use Grep/Glob tools for searches; only use bash with \`rg\` when you need counts or advanced features.
|
|
52
|
-
- Do not use \`ls\`/\`cat\` in bash; use \`list\`/\`read\` tools instead.
|
|
53
|
-
- For deletions (rm), verify by listing parent dir with \`list\`.
|
|
54
|
-
|
|
55
|
-
**Network:**
|
|
56
|
-
- \`webfetch\` - Fetch web content
|
|
57
|
-
- Use fully-formed URLs (http/https; http auto-upgrades to https).
|
|
58
|
-
- Always set \`format\` to one of: text | markdown | html; prefer markdown unless otherwise required.
|
|
59
|
-
- Read-only; short cache window.
|
|
60
|
-
|
|
61
|
-
**Task Management:**
|
|
62
|
-
- \`todowrite\` - Manage tasks/plans (REPLACES update_plan)
|
|
63
|
-
- \`todoread\` - Read current plan
|
|
64
|
-
|
|
65
|
-
## Substitution Rules
|
|
66
|
-
|
|
67
|
-
Base instruction says: You MUST use instead:
|
|
68
|
-
apply_patch → edit
|
|
69
|
-
update_plan → todowrite
|
|
70
|
-
read_plan → todoread
|
|
71
|
-
|
|
72
|
-
**Path Usage:** Use per-tool conventions to avoid conflicts:
|
|
73
|
-
- Tool calls: \`read\`, \`edit\`, \`write\`, \`list\` require absolute paths.
|
|
74
|
-
- Searches: \`grep\`/\`glob\` default to the workspace cwd; prefer relative include patterns; set \`path\` only when a different root is needed.
|
|
75
|
-
- Presentation: In assistant messages, show workspace-relative paths; use absolute paths only inside tool calls.
|
|
76
|
-
- Tool schema overrides general path preferences—do not convert required absolute paths to relative.
|
|
77
|
-
|
|
78
|
-
## Verification Checklist
|
|
79
|
-
|
|
80
|
-
Before file/plan modifications:
|
|
81
|
-
1. Am I using "edit" NOT "apply_patch"?
|
|
82
|
-
2. Am I using "todowrite" NOT "update_plan"?
|
|
83
|
-
3. Is this tool in the approved list above?
|
|
84
|
-
4. Am I following each tool's path requirements?
|
|
85
|
-
|
|
86
|
-
If ANY answer is NO → STOP and correct before proceeding.
|
|
87
|
-
|
|
88
|
-
## OpenCode Working Style
|
|
89
|
-
|
|
90
|
-
**Communication:**
|
|
91
|
-
- Send brief preambles (8-12 words) before tool calls, building on prior context
|
|
92
|
-
- Provide progress updates during longer tasks
|
|
93
|
-
|
|
94
|
-
**Execution:**
|
|
95
|
-
- Keep working autonomously until query is fully resolved before yielding
|
|
96
|
-
- Don't return to user with partial solutions
|
|
97
|
-
|
|
98
|
-
**Code Approach:**
|
|
99
|
-
- New projects: Be ambitious and creative
|
|
100
|
-
- Existing codebases: Surgical precision - modify only what's requested unless explicitly instructed to do otherwise
|
|
101
|
-
|
|
102
|
-
**Testing:**
|
|
103
|
-
- If tests exist: Start specific to your changes, then broader validation
|
|
104
|
-
|
|
105
|
-
## Advanced Tools
|
|
106
|
-
|
|
107
|
-
**Task Tool (Sub-Agents):**
|
|
108
|
-
- Use the Task tool (functions.task) to launch sub-agents
|
|
109
|
-
- Check the Task tool description for current agent types and their capabilities
|
|
110
|
-
- Useful for complex analysis, specialized workflows, or tasks requiring isolated context
|
|
111
|
-
- The agent list is dynamically generated - refer to tool schema for available agents
|
|
112
|
-
|
|
113
|
-
**Parallelization:**
|
|
114
|
-
- When multiple independent tool calls are needed, use multi_tool_use.parallel to run them concurrently.
|
|
115
|
-
- Reserve sequential calls for ordered or data-dependent steps.
|
|
116
|
-
|
|
117
|
-
**MCP Tools:**
|
|
118
|
-
- Model Context Protocol servers provide additional capabilities
|
|
119
|
-
- MCP tools are prefixed: \`mcp__<server-name>__<tool-name>\`
|
|
120
|
-
- Check your available tools for MCP integrations
|
|
121
|
-
- Use when the tool's functionality matches your task needs
|
|
122
|
-
|
|
123
|
-
## What Remains from Codex
|
|
124
|
-
|
|
125
|
-
Sandbox policies, approval mechanisms, final answer formatting, git commit protocols, and file reference formats all follow Codex instructions. In approval policy "never", never request escalations.
|
|
126
|
-
|
|
127
|
-
## Approvals & Safety
|
|
128
|
-
- Assume workspace-write filesystem, network enabled, approval on-failure unless explicitly stated otherwise.
|
|
129
|
-
- When a command fails due to sandboxing or permissions, retry with escalated permissions if allowed by policy, including a one-line justification.
|
|
130
|
-
- Treat destructive commands (e.g., \`rm\`, \`git reset --hard\`) as requiring explicit user request or approval.
|
|
10
|
+
export const CODEX_OPENCODE_BRIDGE = `# Codex Running in OpenCode
|
|
11
|
+
|
|
12
|
+
You are running Codex through OpenCode, an open-source terminal coding assistant. OpenCode provides different tools but follows Codex operating principles.
|
|
13
|
+
|
|
14
|
+
## CRITICAL: Tool Replacements
|
|
15
|
+
|
|
16
|
+
<critical_rule priority="0">
|
|
17
|
+
❌ APPLY_PATCH DOES NOT EXIST → ✅ USE "edit" INSTEAD
|
|
18
|
+
- NEVER use: apply_patch, applyPatch
|
|
19
|
+
- ALWAYS use: edit tool for ALL file modifications
|
|
20
|
+
- Before modifying files: Verify you're using "edit", NOT "apply_patch"
|
|
21
|
+
</critical_rule>
|
|
22
|
+
|
|
23
|
+
<critical_rule priority="0">
|
|
24
|
+
❌ UPDATE_PLAN DOES NOT EXIST → ✅ USE "todowrite" INSTEAD
|
|
25
|
+
- NEVER use: update_plan, updatePlan, read_plan, readPlan
|
|
26
|
+
- ALWAYS use: todowrite for task/plan updates, todoread to read plans
|
|
27
|
+
- Before plan operations: Verify you're using "todowrite", NOT "update_plan"
|
|
28
|
+
</critical_rule>
|
|
29
|
+
|
|
30
|
+
## Available OpenCode Tools
|
|
31
|
+
|
|
32
|
+
**File Operations:**
|
|
33
|
+
- \`write\` - Create new files
|
|
34
|
+
- Overwriting existing files requires a prior Read in this session; default to ASCII unless the file already uses Unicode.
|
|
35
|
+
- \`edit\` - Modify existing files (REPLACES apply_patch)
|
|
36
|
+
- Requires a prior Read in this session; preserve exact indentation; ensure \`oldString\` uniquely matches or use \`replaceAll\`; edit fails if ambiguous or missing.
|
|
37
|
+
- \`read\` - Read file contents
|
|
38
|
+
|
|
39
|
+
**Search/Discovery:**
|
|
40
|
+
- \`grep\` - Search file contents (tool, not bash grep); use \`include\` to filter patterns; set \`path\` only when not searching workspace root; for cross-file match counts use bash with \`rg\`.
|
|
41
|
+
- \`glob\` - Find files by pattern; defaults to workspace cwd unless \`path\` is set.
|
|
42
|
+
- \`list\` - List directories (requires absolute paths)
|
|
43
|
+
|
|
44
|
+
**Execution:**
|
|
45
|
+
- \`bash\` - Run shell commands
|
|
46
|
+
- No workdir parameter; do not include it in tool calls.
|
|
47
|
+
- Always include a short description for the command.
|
|
48
|
+
- Do not use cd; use absolute paths in commands.
|
|
49
|
+
- Quote paths containing spaces with double quotes.
|
|
50
|
+
- Chain multiple commands with ';' or '&&'; avoid newlines.
|
|
51
|
+
- Use Grep/Glob tools for searches; only use bash with \`rg\` when you need counts or advanced features.
|
|
52
|
+
- Do not use \`ls\`/\`cat\` in bash; use \`list\`/\`read\` tools instead.
|
|
53
|
+
- For deletions (rm), verify by listing parent dir with \`list\`.
|
|
54
|
+
|
|
55
|
+
**Network:**
|
|
56
|
+
- \`webfetch\` - Fetch web content
|
|
57
|
+
- Use fully-formed URLs (http/https; http auto-upgrades to https).
|
|
58
|
+
- Always set \`format\` to one of: text | markdown | html; prefer markdown unless otherwise required.
|
|
59
|
+
- Read-only; short cache window.
|
|
60
|
+
|
|
61
|
+
**Task Management:**
|
|
62
|
+
- \`todowrite\` - Manage tasks/plans (REPLACES update_plan)
|
|
63
|
+
- \`todoread\` - Read current plan
|
|
64
|
+
|
|
65
|
+
## Substitution Rules
|
|
66
|
+
|
|
67
|
+
Base instruction says: You MUST use instead:
|
|
68
|
+
apply_patch → edit
|
|
69
|
+
update_plan → todowrite
|
|
70
|
+
read_plan → todoread
|
|
71
|
+
|
|
72
|
+
**Path Usage:** Use per-tool conventions to avoid conflicts:
|
|
73
|
+
- Tool calls: \`read\`, \`edit\`, \`write\`, \`list\` require absolute paths.
|
|
74
|
+
- Searches: \`grep\`/\`glob\` default to the workspace cwd; prefer relative include patterns; set \`path\` only when a different root is needed.
|
|
75
|
+
- Presentation: In assistant messages, show workspace-relative paths; use absolute paths only inside tool calls.
|
|
76
|
+
- Tool schema overrides general path preferences—do not convert required absolute paths to relative.
|
|
77
|
+
|
|
78
|
+
## Verification Checklist
|
|
79
|
+
|
|
80
|
+
Before file/plan modifications:
|
|
81
|
+
1. Am I using "edit" NOT "apply_patch"?
|
|
82
|
+
2. Am I using "todowrite" NOT "update_plan"?
|
|
83
|
+
3. Is this tool in the approved list above?
|
|
84
|
+
4. Am I following each tool's path requirements?
|
|
85
|
+
|
|
86
|
+
If ANY answer is NO → STOP and correct before proceeding.
|
|
87
|
+
|
|
88
|
+
## OpenCode Working Style
|
|
89
|
+
|
|
90
|
+
**Communication:**
|
|
91
|
+
- Send brief preambles (8-12 words) before tool calls, building on prior context
|
|
92
|
+
- Provide progress updates during longer tasks
|
|
93
|
+
|
|
94
|
+
**Execution:**
|
|
95
|
+
- Keep working autonomously until query is fully resolved before yielding
|
|
96
|
+
- Don't return to user with partial solutions
|
|
97
|
+
|
|
98
|
+
**Code Approach:**
|
|
99
|
+
- New projects: Be ambitious and creative
|
|
100
|
+
- Existing codebases: Surgical precision - modify only what's requested unless explicitly instructed to do otherwise
|
|
101
|
+
|
|
102
|
+
**Testing:**
|
|
103
|
+
- If tests exist: Start specific to your changes, then broader validation
|
|
104
|
+
|
|
105
|
+
## Advanced Tools
|
|
106
|
+
|
|
107
|
+
**Task Tool (Sub-Agents):**
|
|
108
|
+
- Use the Task tool (functions.task) to launch sub-agents
|
|
109
|
+
- Check the Task tool description for current agent types and their capabilities
|
|
110
|
+
- Useful for complex analysis, specialized workflows, or tasks requiring isolated context
|
|
111
|
+
- The agent list is dynamically generated - refer to tool schema for available agents
|
|
112
|
+
|
|
113
|
+
**Parallelization:**
|
|
114
|
+
- When multiple independent tool calls are needed, use multi_tool_use.parallel to run them concurrently.
|
|
115
|
+
- Reserve sequential calls for ordered or data-dependent steps.
|
|
116
|
+
|
|
117
|
+
**MCP Tools:**
|
|
118
|
+
- Model Context Protocol servers provide additional capabilities
|
|
119
|
+
- MCP tools are prefixed: \`mcp__<server-name>__<tool-name>\`
|
|
120
|
+
- Check your available tools for MCP integrations
|
|
121
|
+
- Use when the tool's functionality matches your task needs
|
|
122
|
+
|
|
123
|
+
## What Remains from Codex
|
|
124
|
+
|
|
125
|
+
Sandbox policies, approval mechanisms, final answer formatting, git commit protocols, and file reference formats all follow Codex instructions. In approval policy "never", never request escalations.
|
|
126
|
+
|
|
127
|
+
## Approvals & Safety
|
|
128
|
+
- Assume workspace-write filesystem, network enabled, approval on-failure unless explicitly stated otherwise.
|
|
129
|
+
- When a command fails due to sandboxing or permissions, retry with escalated permissions if allowed by policy, including a one-line justification.
|
|
130
|
+
- Treat destructive commands (e.g., \`rm\`, \`git reset --hard\`) as requiring explicit user request or approval.
|
|
131
131
|
- When uncertain, prefer non-destructive verification first (e.g., confirm file existence with \`list\`, then delete with \`bash\`).`;
|
|
132
132
|
export const CODEX_OPENCODE_BRIDGE_META = {
|
|
133
133
|
estimatedTokens: 550,
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
* Maps to different system prompts in the Codex CLI
|
|
4
4
|
*/
|
|
5
5
|
export type ModelFamily = "gpt-5.2-codex" | "codex-max" | "codex" | "gpt-5.2" | "gpt-5.1";
|
|
6
|
+
/**
|
|
7
|
+
* All supported model families
|
|
8
|
+
* Used for per-family account rotation and rate limit tracking
|
|
9
|
+
*/
|
|
10
|
+
export declare const MODEL_FAMILIES: readonly ModelFamily[];
|
|
6
11
|
/**
|
|
7
12
|
* Determine the model family based on the normalized model name
|
|
8
13
|
* @param normalizedModel - The normalized model name (e.g., "gpt-5.2-codex", "gpt-5.1-codex-max", "gpt-5.1-codex", "gpt-5.1")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../lib/prompts/codex.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../lib/prompts/codex.ts"],"names":[],"mappings":"AAkBA;;;GAGG;AACH,MAAM,MAAM,WAAW,GACpB,eAAe,GACf,WAAW,GACX,OAAO,GACP,SAAS,GACT,SAAS,CAAC;AAEb;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,WAAW,EAMvC,CAAC;AAyBX;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,eAAe,EAAE,MAAM,GAAG,WAAW,CAoBnE;AAoDD;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CACzC,eAAe,SAAkB,GAC/B,OAAO,CAAC,MAAM,CAAC,CA0GjB;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,+mEA8DV,CAAC"}
|
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
const GITHUB_API_RELEASES = "https://api.github.com/repos/openai/codex/releases/latest";
|
|
6
6
|
const GITHUB_HTML_RELEASES = "https://github.com/openai/codex/releases/latest";
|
|
7
7
|
const CACHE_DIR = join(homedir(), ".opencode", "cache");
|
|
8
|
+
const CACHE_TTL_MS = 15 * 60 * 1000;
|
|
8
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
9
10
|
const __dirname = dirname(__filename);
|
|
11
|
+
const memoryCache = new Map();
|
|
12
|
+
/**
|
|
13
|
+
* All supported model families
|
|
14
|
+
* Used for per-family account rotation and rate limit tracking
|
|
15
|
+
*/
|
|
16
|
+
export const MODEL_FAMILIES = [
|
|
17
|
+
"gpt-5.2-codex",
|
|
18
|
+
"codex-max",
|
|
19
|
+
"codex",
|
|
20
|
+
"gpt-5.2",
|
|
21
|
+
"gpt-5.1",
|
|
22
|
+
];
|
|
10
23
|
/**
|
|
11
24
|
* Prompt file mapping for each model family
|
|
12
25
|
* Based on codex-rs/core/src/model_family.rs logic
|
|
@@ -34,7 +47,6 @@ const CACHE_FILES = {
|
|
|
34
47
|
* @returns The model family for prompt selection
|
|
35
48
|
*/
|
|
36
49
|
export function getModelFamily(normalizedModel) {
|
|
37
|
-
// Order matters - check more specific patterns first
|
|
38
50
|
if (normalizedModel.includes("gpt-5.2-codex") ||
|
|
39
51
|
normalizedModel.includes("gpt 5.2 codex")) {
|
|
40
52
|
return "gpt-5.2-codex";
|
|
@@ -51,6 +63,14 @@ export function getModelFamily(normalizedModel) {
|
|
|
51
63
|
}
|
|
52
64
|
return "gpt-5.1";
|
|
53
65
|
}
|
|
66
|
+
async function readFileOrNull(path) {
|
|
67
|
+
try {
|
|
68
|
+
return await fs.readFile(path, "utf8");
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
54
74
|
/**
|
|
55
75
|
* Get the latest release tag from GitHub
|
|
56
76
|
* @returns Release tag name (e.g., "rust-v0.43.0")
|
|
@@ -66,6 +86,7 @@ async function getLatestReleaseTag() {
|
|
|
66
86
|
}
|
|
67
87
|
}
|
|
68
88
|
catch {
|
|
89
|
+
// Fall through to HTML fallback
|
|
69
90
|
}
|
|
70
91
|
const htmlResponse = await fetch(GITHUB_HTML_RELEASES);
|
|
71
92
|
if (!htmlResponse.ok) {
|
|
@@ -98,63 +119,61 @@ async function getLatestReleaseTag() {
|
|
|
98
119
|
*/
|
|
99
120
|
export async function getCodexInstructions(normalizedModel = "gpt-5.1-codex") {
|
|
100
121
|
const modelFamily = getModelFamily(normalizedModel);
|
|
122
|
+
const cached = memoryCache.get(modelFamily);
|
|
123
|
+
if (cached && Date.now() - cached.timestamp < CACHE_TTL_MS) {
|
|
124
|
+
return cached.content;
|
|
125
|
+
}
|
|
101
126
|
const promptFile = PROMPT_FILES[modelFamily];
|
|
102
127
|
const cacheFile = join(CACHE_DIR, CACHE_FILES[modelFamily]);
|
|
103
128
|
const cacheMetaFile = join(CACHE_DIR, `${CACHE_FILES[modelFamily].replace(".md", "-meta.json")}`);
|
|
104
129
|
try {
|
|
105
|
-
// Load cached metadata (includes ETag, tag, and lastChecked timestamp)
|
|
106
130
|
let cachedETag = null;
|
|
107
131
|
let cachedTag = null;
|
|
108
132
|
let cachedTimestamp = null;
|
|
109
|
-
|
|
110
|
-
|
|
133
|
+
const metaContent = await readFileOrNull(cacheMetaFile);
|
|
134
|
+
if (metaContent) {
|
|
135
|
+
const metadata = JSON.parse(metaContent);
|
|
111
136
|
cachedETag = metadata.etag;
|
|
112
137
|
cachedTag = metadata.tag;
|
|
113
138
|
cachedTimestamp = metadata.lastChecked;
|
|
114
139
|
}
|
|
115
|
-
// Rate limit protection: If cache is less than 15 minutes old, use it
|
|
116
|
-
const CACHE_TTL_MS = 15 * 60 * 1000; // 15 minutes
|
|
117
140
|
if (cachedTimestamp &&
|
|
118
|
-
Date.now() - cachedTimestamp < CACHE_TTL_MS
|
|
119
|
-
|
|
120
|
-
|
|
141
|
+
Date.now() - cachedTimestamp < CACHE_TTL_MS) {
|
|
142
|
+
const diskContent = await readFileOrNull(cacheFile);
|
|
143
|
+
if (diskContent) {
|
|
144
|
+
memoryCache.set(modelFamily, { content: diskContent, timestamp: Date.now() });
|
|
145
|
+
return diskContent;
|
|
146
|
+
}
|
|
121
147
|
}
|
|
122
|
-
// Get the latest release tag (only if cache is stale or missing)
|
|
123
148
|
const latestTag = await getLatestReleaseTag();
|
|
124
149
|
const CODEX_INSTRUCTIONS_URL = `https://raw.githubusercontent.com/openai/codex/${latestTag}/codex-rs/core/${promptFile}`;
|
|
125
|
-
// If tag changed, we need to fetch new instructions
|
|
126
150
|
if (cachedTag !== latestTag) {
|
|
127
|
-
cachedETag = null;
|
|
151
|
+
cachedETag = null;
|
|
128
152
|
}
|
|
129
|
-
// Make conditional request with If-None-Match header
|
|
130
153
|
const headers = {};
|
|
131
154
|
if (cachedETag) {
|
|
132
155
|
headers["If-None-Match"] = cachedETag;
|
|
133
156
|
}
|
|
134
157
|
const response = await fetch(CODEX_INSTRUCTIONS_URL, { headers });
|
|
135
|
-
// 304 Not Modified - our cached version is still current
|
|
136
158
|
if (response.status === 304) {
|
|
137
|
-
|
|
138
|
-
|
|
159
|
+
const diskContent = await readFileOrNull(cacheFile);
|
|
160
|
+
if (diskContent) {
|
|
161
|
+
memoryCache.set(modelFamily, { content: diskContent, timestamp: Date.now() });
|
|
162
|
+
return diskContent;
|
|
139
163
|
}
|
|
140
|
-
// Cache file missing but GitHub says not modified - fall through to re-fetch
|
|
141
164
|
}
|
|
142
|
-
// 200 OK - new content or first fetch
|
|
143
165
|
if (response.ok) {
|
|
144
166
|
const instructions = await response.text();
|
|
145
167
|
const newETag = response.headers.get("etag");
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
// Cache the instructions with ETag and tag (verbatim from GitHub)
|
|
151
|
-
writeFileSync(cacheFile, instructions, "utf8");
|
|
152
|
-
writeFileSync(cacheMetaFile, JSON.stringify({
|
|
168
|
+
await fs.mkdir(CACHE_DIR, { recursive: true });
|
|
169
|
+
await fs.writeFile(cacheFile, instructions, "utf8");
|
|
170
|
+
await fs.writeFile(cacheMetaFile, JSON.stringify({
|
|
153
171
|
etag: newETag,
|
|
154
172
|
tag: latestTag,
|
|
155
173
|
lastChecked: Date.now(),
|
|
156
174
|
url: CODEX_INSTRUCTIONS_URL,
|
|
157
175
|
}), "utf8");
|
|
176
|
+
memoryCache.set(modelFamily, { content: instructions, timestamp: Date.now() });
|
|
158
177
|
return instructions;
|
|
159
178
|
}
|
|
160
179
|
throw new Error(`HTTP ${response.status}`);
|
|
@@ -162,80 +181,82 @@ export async function getCodexInstructions(normalizedModel = "gpt-5.1-codex") {
|
|
|
162
181
|
catch (error) {
|
|
163
182
|
const err = error;
|
|
164
183
|
console.error(`[openai-codex-plugin] Failed to fetch ${modelFamily} instructions from GitHub:`, err.message);
|
|
165
|
-
|
|
166
|
-
if (
|
|
184
|
+
const diskContent = await readFileOrNull(cacheFile);
|
|
185
|
+
if (diskContent) {
|
|
167
186
|
console.error(`[openai-codex-plugin] Using cached ${modelFamily} instructions`);
|
|
168
|
-
|
|
187
|
+
memoryCache.set(modelFamily, { content: diskContent, timestamp: Date.now() });
|
|
188
|
+
return diskContent;
|
|
169
189
|
}
|
|
170
|
-
// Fall back to bundled version (use codex-instructions.md as default)
|
|
171
190
|
console.error(`[openai-codex-plugin] Falling back to bundled instructions for ${modelFamily}`);
|
|
172
|
-
|
|
191
|
+
const bundled = await fs.readFile(join(__dirname, "codex-instructions.md"), "utf8");
|
|
192
|
+
memoryCache.set(modelFamily, { content: bundled, timestamp: Date.now() });
|
|
193
|
+
return bundled;
|
|
173
194
|
}
|
|
174
195
|
}
|
|
175
196
|
/**
|
|
176
197
|
* Tool remapping instructions for opencode tools
|
|
177
198
|
*/
|
|
178
|
-
export const TOOL_REMAP_MESSAGE = `<user_instructions priority="0">
|
|
179
|
-
<environment_override priority="0">
|
|
180
|
-
YOU ARE IN A DIFFERENT ENVIRONMENT. These instructions override ALL previous tool references.
|
|
181
|
-
</environment_override>
|
|
182
|
-
|
|
183
|
-
<tool_replacements priority="0">
|
|
184
|
-
<critical_rule priority="0">
|
|
185
|
-
❌ APPLY_PATCH DOES NOT EXIST → ✅ USE "edit" INSTEAD
|
|
186
|
-
- NEVER use: apply_patch, applyPatch
|
|
187
|
-
- ALWAYS use: edit tool for ALL file modifications
|
|
188
|
-
- Before modifying files: Verify you're using "edit", NOT "apply_patch"
|
|
189
|
-
</critical_rule>
|
|
190
|
-
|
|
191
|
-
<critical_rule priority="0">
|
|
192
|
-
❌ UPDATE_PLAN DOES NOT EXIST → ✅ USE "todowrite" INSTEAD
|
|
193
|
-
- NEVER use: update_plan, updatePlan
|
|
194
|
-
- ALWAYS use: todowrite for ALL task/plan operations
|
|
195
|
-
- Use todoread to read current plan
|
|
196
|
-
- Before plan operations: Verify you're using "todowrite", NOT "update_plan"
|
|
197
|
-
</critical_rule>
|
|
198
|
-
</tool_replacements>
|
|
199
|
-
|
|
200
|
-
<available_tools priority="0">
|
|
201
|
-
File Operations:
|
|
202
|
-
• write - Create new files
|
|
203
|
-
• edit - Modify existing files (REPLACES apply_patch)
|
|
204
|
-
• patch - Apply diff patches
|
|
205
|
-
• read - Read file contents
|
|
206
|
-
|
|
207
|
-
Search/Discovery:
|
|
208
|
-
• grep - Search file contents
|
|
209
|
-
• glob - Find files by pattern
|
|
210
|
-
• list - List directories (use relative paths)
|
|
211
|
-
|
|
212
|
-
Execution:
|
|
213
|
-
• bash - Run shell commands
|
|
214
|
-
|
|
215
|
-
Network:
|
|
216
|
-
• webfetch - Fetch web content
|
|
217
|
-
|
|
218
|
-
Task Management:
|
|
219
|
-
• todowrite - Manage tasks/plans (REPLACES update_plan)
|
|
220
|
-
• todoread - Read current plan
|
|
221
|
-
</available_tools>
|
|
222
|
-
|
|
223
|
-
<substitution_rules priority="0">
|
|
224
|
-
Base instruction says: You MUST use instead:
|
|
225
|
-
apply_patch → edit
|
|
226
|
-
update_plan → todowrite
|
|
227
|
-
read_plan → todoread
|
|
228
|
-
absolute paths → relative paths
|
|
229
|
-
</substitution_rules>
|
|
230
|
-
|
|
231
|
-
<verification_checklist priority="0">
|
|
232
|
-
Before file/plan modifications:
|
|
233
|
-
1. Am I using "edit" NOT "apply_patch"?
|
|
234
|
-
2. Am I using "todowrite" NOT "update_plan"?
|
|
235
|
-
3. Is this tool in the approved list above?
|
|
236
|
-
4. Am I using relative paths?
|
|
237
|
-
|
|
238
|
-
If ANY answer is NO → STOP and correct before proceeding.
|
|
239
|
-
</verification_checklist>
|
|
199
|
+
export const TOOL_REMAP_MESSAGE = `<user_instructions priority="0">
|
|
200
|
+
<environment_override priority="0">
|
|
201
|
+
YOU ARE IN A DIFFERENT ENVIRONMENT. These instructions override ALL previous tool references.
|
|
202
|
+
</environment_override>
|
|
203
|
+
|
|
204
|
+
<tool_replacements priority="0">
|
|
205
|
+
<critical_rule priority="0">
|
|
206
|
+
❌ APPLY_PATCH DOES NOT EXIST → ✅ USE "edit" INSTEAD
|
|
207
|
+
- NEVER use: apply_patch, applyPatch
|
|
208
|
+
- ALWAYS use: edit tool for ALL file modifications
|
|
209
|
+
- Before modifying files: Verify you're using "edit", NOT "apply_patch"
|
|
210
|
+
</critical_rule>
|
|
211
|
+
|
|
212
|
+
<critical_rule priority="0">
|
|
213
|
+
❌ UPDATE_PLAN DOES NOT EXIST → ✅ USE "todowrite" INSTEAD
|
|
214
|
+
- NEVER use: update_plan, updatePlan
|
|
215
|
+
- ALWAYS use: todowrite for ALL task/plan operations
|
|
216
|
+
- Use todoread to read current plan
|
|
217
|
+
- Before plan operations: Verify you're using "todowrite", NOT "update_plan"
|
|
218
|
+
</critical_rule>
|
|
219
|
+
</tool_replacements>
|
|
220
|
+
|
|
221
|
+
<available_tools priority="0">
|
|
222
|
+
File Operations:
|
|
223
|
+
• write - Create new files
|
|
224
|
+
• edit - Modify existing files (REPLACES apply_patch)
|
|
225
|
+
• patch - Apply diff patches
|
|
226
|
+
• read - Read file contents
|
|
227
|
+
|
|
228
|
+
Search/Discovery:
|
|
229
|
+
• grep - Search file contents
|
|
230
|
+
• glob - Find files by pattern
|
|
231
|
+
• list - List directories (use relative paths)
|
|
232
|
+
|
|
233
|
+
Execution:
|
|
234
|
+
• bash - Run shell commands
|
|
235
|
+
|
|
236
|
+
Network:
|
|
237
|
+
• webfetch - Fetch web content
|
|
238
|
+
|
|
239
|
+
Task Management:
|
|
240
|
+
• todowrite - Manage tasks/plans (REPLACES update_plan)
|
|
241
|
+
• todoread - Read current plan
|
|
242
|
+
</available_tools>
|
|
243
|
+
|
|
244
|
+
<substitution_rules priority="0">
|
|
245
|
+
Base instruction says: You MUST use instead:
|
|
246
|
+
apply_patch → edit
|
|
247
|
+
update_plan → todowrite
|
|
248
|
+
read_plan → todoread
|
|
249
|
+
absolute paths → relative paths
|
|
250
|
+
</substitution_rules>
|
|
251
|
+
|
|
252
|
+
<verification_checklist priority="0">
|
|
253
|
+
Before file/plan modifications:
|
|
254
|
+
1. Am I using "edit" NOT "apply_patch"?
|
|
255
|
+
2. Am I using "todowrite" NOT "update_plan"?
|
|
256
|
+
3. Is this tool in the approved list above?
|
|
257
|
+
4. Am I using relative paths?
|
|
258
|
+
|
|
259
|
+
If ANY answer is NO → STOP and correct before proceeding.
|
|
260
|
+
</verification_checklist>
|
|
240
261
|
</user_instructions>`;
|
|
241
262
|
//# sourceMappingURL=codex.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../../lib/prompts/codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../../lib/prompts/codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,MAAM,mBAAmB,GACxB,2DAA2D,CAAC;AAC7D,MAAM,oBAAoB,GACzB,iDAAiD,CAAC;AACnD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;AACxD,MAAM,YAAY,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEpC,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