codex-multi-auth 2.19.0 → 2.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/.codex-plugin/plugin.json +9 -9
- package/LICENSE +21 -21
- package/README.md +149 -148
- package/assets/codex-multi-auth-icon.svg +39 -39
- package/assets/readme-hero.svg +31 -31
- package/config/README.md +31 -31
- package/config/codex-legacy.json +1021 -1021
- package/config/codex-modern.json +347 -347
- package/config/minimal-codex.json +15 -15
- package/dist/index.js +1 -1
- package/dist/lib/accounts/rate-limits.js +5 -0
- package/dist/lib/accounts.js +5 -4
- package/dist/lib/auth/account-access.js +2 -2
- package/dist/lib/codex-cli/version.d.ts +22 -0
- package/dist/lib/codex-cli/version.js +78 -0
- package/dist/lib/codex-manager/commands/limits.d.ts +2 -0
- package/dist/lib/codex-manager/commands/limits.js +31 -0
- package/dist/lib/codex-manager/commands/status.js +1 -1
- package/dist/lib/codex-manager/dashboard-settings-data.js +2 -0
- package/dist/lib/codex-manager/formatters/subscription-status.d.ts +2 -2
- package/dist/lib/codex-manager/formatters/text-style.js +4 -1
- package/dist/lib/codex-manager/settings-hub/dashboard.d.ts +1 -1
- package/dist/lib/codex-manager/settings-hub/dashboard.js +4 -0
- package/dist/lib/codex-manager/settings-panels.d.ts +1 -0
- package/dist/lib/codex-manager/settings-panels.js +1 -0
- package/dist/lib/codex-manager/theme-settings-panel.d.ts +2 -1
- package/dist/lib/codex-manager/theme-settings-panel.js +39 -0
- package/dist/lib/codex-manager.js +2 -0
- package/dist/lib/constants.d.ts +2 -0
- package/dist/lib/constants.js +2 -0
- package/dist/lib/context-budget/model-context-windows.d.ts +1 -1
- package/dist/lib/context-budget/model-context-windows.js +4 -0
- package/dist/lib/context-budget-response.js +8 -8
- package/dist/lib/context-overflow.js +10 -10
- package/dist/lib/dashboard-settings.d.ts +2 -0
- package/dist/lib/dashboard-settings.js +18 -0
- package/dist/lib/luna-reserve.d.ts +26 -0
- package/dist/lib/luna-reserve.js +68 -0
- package/dist/lib/model-route-policy.d.ts +5 -5
- package/dist/lib/oauth-success.html +125 -125
- package/dist/lib/policy/runtime-policy.js +14 -0
- package/dist/lib/prompts/codex-host-bridge.js +138 -138
- package/dist/lib/prompts/codex.js +79 -79
- package/dist/lib/quota-readiness.d.ts +2 -2
- package/dist/lib/request/helpers/model-map.d.ts +1 -1
- package/dist/lib/request/helpers/model-map.js +12 -0
- package/dist/lib/request/response-outcome.d.ts +1 -1
- package/dist/lib/request/response-outcome.js +4 -1
- package/dist/lib/request/url-rewriting.js +3 -1
- package/dist/lib/runtime/account-model-catalog.d.ts +5 -5
- package/dist/lib/runtime/account-reset-credits.d.ts +2 -2
- package/dist/lib/runtime/account-status.js +2 -1
- package/dist/lib/runtime/luna-reserve-usage.d.ts +9 -0
- package/dist/lib/runtime/luna-reserve-usage.js +68 -0
- package/dist/lib/runtime/model-discovery-status.d.ts +11 -7
- package/dist/lib/runtime/model-discovery-status.js +13 -5
- package/dist/lib/runtime/reset-credit-routing.js +4 -1
- package/dist/lib/runtime/reset-credits.d.ts +7 -7
- package/dist/lib/runtime/resume-picker.js +1 -1
- package/dist/lib/runtime/rotation-server-types.d.ts +2 -0
- package/dist/lib/runtime/runtime-observability.d.ts +2 -0
- package/dist/lib/runtime/runtime-observability.js +1 -0
- package/dist/lib/runtime/workspace-model-scopes.d.ts +3 -3
- package/dist/lib/runtime-rotation-proxy.js +200 -32
- package/dist/lib/schemas.d.ts +65 -65
- package/dist/lib/ui/index.d.ts +1 -1
- package/dist/lib/ui/index.js +1 -1
- package/dist/lib/ui/runtime.d.ts +3 -1
- package/dist/lib/ui/runtime.js +11 -1
- package/dist/lib/ui/theme.d.ts +20 -1
- package/dist/lib/ui/theme.js +154 -30
- package/dist/lib/ui/ui-copy.d.ts +3 -2
- package/dist/lib/ui/ui-copy.js +3 -2
- package/dist/lib/usage/pricing.d.ts +1 -1
- package/dist/lib/usage/pricing.js +4 -0
- package/dist/lib/usage/usage-extraction.d.ts +2 -0
- package/dist/lib/usage/usage-extraction.js +25 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.js +1 -1
- package/node_modules/@codex-ai/plugin/dist/index.d.ts +2 -2
- package/node_modules/@codex-ai/plugin/dist/index.js +2 -2
- package/node_modules/@codex-ai/plugin/dist/tool.d.ts +42 -42
- package/node_modules/@codex-ai/plugin/dist/tool.js +29 -29
- package/node_modules/@codex-ai/plugin/package.json +9 -9
- package/node_modules/@codex-ai/sdk/dist/index.d.ts +4 -4
- package/node_modules/@codex-ai/sdk/dist/index.js +2 -2
- package/node_modules/@codex-ai/sdk/package.json +8 -8
- package/package.json +207 -206
- package/scripts/codex-app-launcher.js +653 -653
- package/scripts/codex-app-router.js +374 -373
- package/scripts/codex-bin-resolver.js +332 -332
- package/scripts/codex-multi-auth.js +65 -65
- package/scripts/codex-routing.js +62 -62
- package/scripts/codex.js +7006 -7005
- package/scripts/install-codex-auth-utils.js +213 -213
- package/scripts/mcodex.js +367 -367
- package/scripts/postinstall.js +114 -114
- package/scripts/preuninstall.js +265 -265
- package/skills/codex-auth-setup/SKILL.md +73 -73
- package/vendor/codex-ai-plugin/dist/index.d.ts +2 -2
- package/vendor/codex-ai-plugin/dist/index.js +2 -2
- package/vendor/codex-ai-plugin/dist/tool.d.ts +42 -42
- package/vendor/codex-ai-plugin/dist/tool.js +29 -29
- package/vendor/codex-ai-plugin/package.json +9 -9
- package/vendor/codex-ai-sdk/dist/index.d.ts +4 -4
- package/vendor/codex-ai-sdk/dist/index.js +2 -2
- package/vendor/codex-ai-sdk/package.json +8 -8
|
@@ -7,142 +7,142 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Token Count: ~450 tokens (~90% reduction vs full host prompt)
|
|
9
9
|
*/
|
|
10
|
-
export const CODEX_HOST_BRIDGE = `# Codex Host Bridge
|
|
11
|
-
|
|
12
|
-
You are running Codex through a host terminal coding runtime. The host provides specific tools to help you work efficiently.
|
|
13
|
-
|
|
14
|
-
## CRITICAL: Tool Usage
|
|
15
|
-
|
|
16
|
-
<critical_rule priority="0">
|
|
17
|
-
apply_patch/applyPatch are Codex names, but host tool names vary by version.
|
|
18
|
-
- Inspect the actual tool list before editing.
|
|
19
|
-
- If \`edit\` exists: use \`edit\` for precise in-place string replacements and hashline edits.
|
|
20
|
-
- If \`edit\` is absent and \`apply_patch\` exists: use \`apply_patch\` for those precise/hashline edits in this plugin.
|
|
21
|
-
- For diff-style or multi-line structural edits: use \`patch\` if available, otherwise use \`apply_patch\`.
|
|
22
|
-
- In this plugin, \`edit\` / \`apply_patch\` also support hashline refs (\`lineRef\`, \`endLineRef\`, \`operation\`, \`content\`)
|
|
23
|
-
</critical_rule>
|
|
24
|
-
|
|
25
|
-
<critical_rule priority="0">
|
|
26
|
-
UPDATE_PLAN DOES NOT EXIST -> USE "todowrite" INSTEAD
|
|
27
|
-
- NEVER use: update_plan, updatePlan, read_plan, readPlan
|
|
28
|
-
- ALWAYS use: todowrite for task/plan updates, todoread to read plans
|
|
29
|
-
- Before plan operations: Verify you're using "todowrite", NOT "update_plan"
|
|
30
|
-
</critical_rule>
|
|
31
|
-
|
|
32
|
-
## Available Host Tools
|
|
33
|
-
|
|
34
|
-
**File Operations:**
|
|
35
|
-
- \`write\` - Create new files
|
|
36
|
-
- Overwriting existing files requires a prior Read in this session; default to ASCII unless the file already uses Unicode.
|
|
37
|
-
- \`edit\` - Modify existing files with string replacement (version-dependent)
|
|
38
|
-
- Requires a prior Read in this session; preserve exact indentation; ensure \`oldString\` uniquely matches or use \`replaceAll\`; edit fails if ambiguous or missing.
|
|
39
|
-
- Never pass unresolved template placeholders in \`oldString\` (e.g. \`\${TARGET_SNIPPET}\`); \`oldString\` must be literal text copied from the current file.
|
|
40
|
-
- For complex multi-line changes: break into multiple sequential edit calls, each with unique oldString context.
|
|
41
|
-
- \`apply_patch\` - May be the edit/patch tool name in newer host builds (version-dependent)
|
|
42
|
-
- In this plugin, \`apply_patch\` also accepts hashline edit args (\`path\`, \`lineRef\`, \`endLineRef\`, \`operation\`, \`content\`) when \`edit\` is not available.
|
|
43
|
-
- \`hashline_read\` - Read file with hashline refs (\`L<line>#<hash>\`) for deterministic edits
|
|
44
|
-
- \`patch\` - Apply diff-style patches for multi-line updates (version-dependent)
|
|
45
|
-
- \`read\` - Read file contents
|
|
46
|
-
|
|
47
|
-
Note: Tool naming is version-dependent. If \`edit\` is unavailable but \`apply_patch\` exists, use \`apply_patch\`.
|
|
48
|
-
|
|
49
|
-
When available, prefer hashline workflow for reliability:
|
|
50
|
-
1. Call \`hashline_read\` for target file and capture refs.
|
|
51
|
-
2. Call \`edit\` or \`apply_patch\` with \`lineRef\` (and optional \`endLineRef\`) plus \`operation\` and \`content\`.
|
|
52
|
-
3. Use legacy \`oldString\` / \`newString\` only when hashline refs are unavailable, and only with literal file text (no template placeholders).
|
|
53
|
-
|
|
54
|
-
**Search/Discovery:**
|
|
55
|
-
- \`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\`.
|
|
56
|
-
- \`glob\` - Find files by pattern; defaults to workspace cwd unless \`path\` is set.
|
|
57
|
-
- \`list\` - List directories (requires absolute paths)
|
|
58
|
-
|
|
59
|
-
**Execution:**
|
|
60
|
-
- \`bash\` - Run shell commands
|
|
61
|
-
- No workdir parameter; do not include it in tool calls.
|
|
62
|
-
- Always include a short description for the command.
|
|
63
|
-
- Do not use cd; use absolute paths in commands.
|
|
64
|
-
- Quote paths containing spaces with double quotes.
|
|
65
|
-
- Chain multiple commands with ';' or '&&'; avoid newlines.
|
|
66
|
-
- Use Grep/Glob tools for searches; only use bash with \`rg\` when you need counts or advanced features.
|
|
67
|
-
- Do not use \`ls\`/\`cat\` in bash; use \`list\`/\`read\` tools instead.
|
|
68
|
-
- For deletions (rm), verify by listing parent dir with \`list\`.
|
|
69
|
-
|
|
70
|
-
**Network:**
|
|
71
|
-
- \`webfetch\` - Fetch web content
|
|
72
|
-
- Use fully-formed URLs (http/https; http auto-upgrades to https).
|
|
73
|
-
- Always set \`format\` to one of: text | markdown | html; prefer markdown unless otherwise required.
|
|
74
|
-
- Read-only; short cache window.
|
|
75
|
-
|
|
76
|
-
**Task Management:**
|
|
77
|
-
- \`todowrite\` - Manage tasks/plans (REPLACES update_plan)
|
|
78
|
-
- \`todoread\` - Read current plan
|
|
79
|
-
|
|
80
|
-
## Substitution Rules
|
|
81
|
-
|
|
82
|
-
Base instruction says: You MUST use instead:
|
|
83
|
-
apply_patch -> patch (preferred if available), otherwise edit/apply_patch based on actual tool list
|
|
84
|
-
update_plan -> todowrite
|
|
85
|
-
read_plan -> todoread
|
|
86
|
-
|
|
87
|
-
**Path Usage:** Use per-tool conventions to avoid conflicts:
|
|
88
|
-
- Tool calls: \`read\`, \`edit\`, \`write\`, \`list\` require absolute paths.
|
|
89
|
-
- Searches: \`grep\`/\`glob\` default to the workspace cwd; prefer relative include patterns; set \`path\` only when a different root is needed.
|
|
90
|
-
- Presentation: In assistant messages, show workspace-relative paths; use absolute paths only inside tool calls.
|
|
91
|
-
- Tool schema overrides general path preferences-do not convert required absolute paths to relative.
|
|
92
|
-
|
|
93
|
-
## Verification Checklist
|
|
94
|
-
|
|
95
|
-
Before file/plan modifications:
|
|
96
|
-
1. Am I using the actual available edit tool name (\`edit\`, \`patch\`, or \`apply_patch\`)?
|
|
97
|
-
2. Am I using "todowrite" NOT "update_plan"?
|
|
98
|
-
3. Is this tool in the approved list above?
|
|
99
|
-
4. Am I following each tool's path requirements?
|
|
100
|
-
|
|
101
|
-
If ANY answer is NO -> STOP and correct before proceeding.
|
|
102
|
-
|
|
103
|
-
## Host Working Style
|
|
104
|
-
|
|
105
|
-
**Communication:**
|
|
106
|
-
- Send brief preambles (8-12 words) before tool calls, building on prior context
|
|
107
|
-
- Provide progress updates during longer tasks
|
|
108
|
-
|
|
109
|
-
**Execution:**
|
|
110
|
-
- Keep working autonomously until query is fully resolved before yielding
|
|
111
|
-
- Don't return to user with partial solutions
|
|
112
|
-
|
|
113
|
-
**Code Approach:**
|
|
114
|
-
- New projects: Be ambitious and creative
|
|
115
|
-
- Existing codebases: Surgical precision - modify only what's requested unless explicitly instructed to do otherwise
|
|
116
|
-
|
|
117
|
-
**Testing:**
|
|
118
|
-
- If tests exist: Start specific to your changes, then broader validation
|
|
119
|
-
|
|
120
|
-
## Advanced Tools
|
|
121
|
-
|
|
122
|
-
**Task Tool (Sub-Agents):**
|
|
123
|
-
- Use the Task tool (functions.task) to launch sub-agents
|
|
124
|
-
- Check the Task tool description for current agent types and their capabilities
|
|
125
|
-
- Useful for complex analysis, specialized workflows, or tasks requiring isolated context
|
|
126
|
-
- The agent list is dynamically generated - refer to tool schema for available agents
|
|
127
|
-
|
|
128
|
-
**Parallelization:**
|
|
129
|
-
- When multiple independent tool calls are needed, use multi_tool_use.parallel to run them concurrently.
|
|
130
|
-
- Reserve sequential calls for ordered or data-dependent steps.
|
|
131
|
-
|
|
132
|
-
**MCP Tools:**
|
|
133
|
-
- Model Context Protocol servers provide additional capabilities
|
|
134
|
-
- MCP tools are prefixed: \`mcp__<server-name>__<tool-name>\`
|
|
135
|
-
- Check your available tools for MCP integrations
|
|
136
|
-
- Use when the tool's functionality matches your task needs
|
|
137
|
-
|
|
138
|
-
## What Remains from Codex
|
|
139
|
-
|
|
140
|
-
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.
|
|
141
|
-
|
|
142
|
-
## Approvals & Safety
|
|
143
|
-
- Assume workspace-write filesystem, network enabled, approval on-failure unless explicitly stated otherwise.
|
|
144
|
-
- When a command fails due to sandboxing or permissions, retry with escalated permissions if allowed by policy, including a one-line justification.
|
|
145
|
-
- Treat destructive commands (e.g., \`rm\`, \`git reset --hard\`) as requiring explicit user request or approval.
|
|
146
|
-
- Never run \`git reset --hard\`, \`git checkout --\`, or force deletes unless the user explicitly asked for that exact action.
|
|
147
|
-
- \`request_user_input\` is Plan-mode only; do not call it in Default mode.
|
|
10
|
+
export const CODEX_HOST_BRIDGE = `# Codex Host Bridge
|
|
11
|
+
|
|
12
|
+
You are running Codex through a host terminal coding runtime. The host provides specific tools to help you work efficiently.
|
|
13
|
+
|
|
14
|
+
## CRITICAL: Tool Usage
|
|
15
|
+
|
|
16
|
+
<critical_rule priority="0">
|
|
17
|
+
apply_patch/applyPatch are Codex names, but host tool names vary by version.
|
|
18
|
+
- Inspect the actual tool list before editing.
|
|
19
|
+
- If \`edit\` exists: use \`edit\` for precise in-place string replacements and hashline edits.
|
|
20
|
+
- If \`edit\` is absent and \`apply_patch\` exists: use \`apply_patch\` for those precise/hashline edits in this plugin.
|
|
21
|
+
- For diff-style or multi-line structural edits: use \`patch\` if available, otherwise use \`apply_patch\`.
|
|
22
|
+
- In this plugin, \`edit\` / \`apply_patch\` also support hashline refs (\`lineRef\`, \`endLineRef\`, \`operation\`, \`content\`)
|
|
23
|
+
</critical_rule>
|
|
24
|
+
|
|
25
|
+
<critical_rule priority="0">
|
|
26
|
+
UPDATE_PLAN DOES NOT EXIST -> USE "todowrite" INSTEAD
|
|
27
|
+
- NEVER use: update_plan, updatePlan, read_plan, readPlan
|
|
28
|
+
- ALWAYS use: todowrite for task/plan updates, todoread to read plans
|
|
29
|
+
- Before plan operations: Verify you're using "todowrite", NOT "update_plan"
|
|
30
|
+
</critical_rule>
|
|
31
|
+
|
|
32
|
+
## Available Host Tools
|
|
33
|
+
|
|
34
|
+
**File Operations:**
|
|
35
|
+
- \`write\` - Create new files
|
|
36
|
+
- Overwriting existing files requires a prior Read in this session; default to ASCII unless the file already uses Unicode.
|
|
37
|
+
- \`edit\` - Modify existing files with string replacement (version-dependent)
|
|
38
|
+
- Requires a prior Read in this session; preserve exact indentation; ensure \`oldString\` uniquely matches or use \`replaceAll\`; edit fails if ambiguous or missing.
|
|
39
|
+
- Never pass unresolved template placeholders in \`oldString\` (e.g. \`\${TARGET_SNIPPET}\`); \`oldString\` must be literal text copied from the current file.
|
|
40
|
+
- For complex multi-line changes: break into multiple sequential edit calls, each with unique oldString context.
|
|
41
|
+
- \`apply_patch\` - May be the edit/patch tool name in newer host builds (version-dependent)
|
|
42
|
+
- In this plugin, \`apply_patch\` also accepts hashline edit args (\`path\`, \`lineRef\`, \`endLineRef\`, \`operation\`, \`content\`) when \`edit\` is not available.
|
|
43
|
+
- \`hashline_read\` - Read file with hashline refs (\`L<line>#<hash>\`) for deterministic edits
|
|
44
|
+
- \`patch\` - Apply diff-style patches for multi-line updates (version-dependent)
|
|
45
|
+
- \`read\` - Read file contents
|
|
46
|
+
|
|
47
|
+
Note: Tool naming is version-dependent. If \`edit\` is unavailable but \`apply_patch\` exists, use \`apply_patch\`.
|
|
48
|
+
|
|
49
|
+
When available, prefer hashline workflow for reliability:
|
|
50
|
+
1. Call \`hashline_read\` for target file and capture refs.
|
|
51
|
+
2. Call \`edit\` or \`apply_patch\` with \`lineRef\` (and optional \`endLineRef\`) plus \`operation\` and \`content\`.
|
|
52
|
+
3. Use legacy \`oldString\` / \`newString\` only when hashline refs are unavailable, and only with literal file text (no template placeholders).
|
|
53
|
+
|
|
54
|
+
**Search/Discovery:**
|
|
55
|
+
- \`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\`.
|
|
56
|
+
- \`glob\` - Find files by pattern; defaults to workspace cwd unless \`path\` is set.
|
|
57
|
+
- \`list\` - List directories (requires absolute paths)
|
|
58
|
+
|
|
59
|
+
**Execution:**
|
|
60
|
+
- \`bash\` - Run shell commands
|
|
61
|
+
- No workdir parameter; do not include it in tool calls.
|
|
62
|
+
- Always include a short description for the command.
|
|
63
|
+
- Do not use cd; use absolute paths in commands.
|
|
64
|
+
- Quote paths containing spaces with double quotes.
|
|
65
|
+
- Chain multiple commands with ';' or '&&'; avoid newlines.
|
|
66
|
+
- Use Grep/Glob tools for searches; only use bash with \`rg\` when you need counts or advanced features.
|
|
67
|
+
- Do not use \`ls\`/\`cat\` in bash; use \`list\`/\`read\` tools instead.
|
|
68
|
+
- For deletions (rm), verify by listing parent dir with \`list\`.
|
|
69
|
+
|
|
70
|
+
**Network:**
|
|
71
|
+
- \`webfetch\` - Fetch web content
|
|
72
|
+
- Use fully-formed URLs (http/https; http auto-upgrades to https).
|
|
73
|
+
- Always set \`format\` to one of: text | markdown | html; prefer markdown unless otherwise required.
|
|
74
|
+
- Read-only; short cache window.
|
|
75
|
+
|
|
76
|
+
**Task Management:**
|
|
77
|
+
- \`todowrite\` - Manage tasks/plans (REPLACES update_plan)
|
|
78
|
+
- \`todoread\` - Read current plan
|
|
79
|
+
|
|
80
|
+
## Substitution Rules
|
|
81
|
+
|
|
82
|
+
Base instruction says: You MUST use instead:
|
|
83
|
+
apply_patch -> patch (preferred if available), otherwise edit/apply_patch based on actual tool list
|
|
84
|
+
update_plan -> todowrite
|
|
85
|
+
read_plan -> todoread
|
|
86
|
+
|
|
87
|
+
**Path Usage:** Use per-tool conventions to avoid conflicts:
|
|
88
|
+
- Tool calls: \`read\`, \`edit\`, \`write\`, \`list\` require absolute paths.
|
|
89
|
+
- Searches: \`grep\`/\`glob\` default to the workspace cwd; prefer relative include patterns; set \`path\` only when a different root is needed.
|
|
90
|
+
- Presentation: In assistant messages, show workspace-relative paths; use absolute paths only inside tool calls.
|
|
91
|
+
- Tool schema overrides general path preferences-do not convert required absolute paths to relative.
|
|
92
|
+
|
|
93
|
+
## Verification Checklist
|
|
94
|
+
|
|
95
|
+
Before file/plan modifications:
|
|
96
|
+
1. Am I using the actual available edit tool name (\`edit\`, \`patch\`, or \`apply_patch\`)?
|
|
97
|
+
2. Am I using "todowrite" NOT "update_plan"?
|
|
98
|
+
3. Is this tool in the approved list above?
|
|
99
|
+
4. Am I following each tool's path requirements?
|
|
100
|
+
|
|
101
|
+
If ANY answer is NO -> STOP and correct before proceeding.
|
|
102
|
+
|
|
103
|
+
## Host Working Style
|
|
104
|
+
|
|
105
|
+
**Communication:**
|
|
106
|
+
- Send brief preambles (8-12 words) before tool calls, building on prior context
|
|
107
|
+
- Provide progress updates during longer tasks
|
|
108
|
+
|
|
109
|
+
**Execution:**
|
|
110
|
+
- Keep working autonomously until query is fully resolved before yielding
|
|
111
|
+
- Don't return to user with partial solutions
|
|
112
|
+
|
|
113
|
+
**Code Approach:**
|
|
114
|
+
- New projects: Be ambitious and creative
|
|
115
|
+
- Existing codebases: Surgical precision - modify only what's requested unless explicitly instructed to do otherwise
|
|
116
|
+
|
|
117
|
+
**Testing:**
|
|
118
|
+
- If tests exist: Start specific to your changes, then broader validation
|
|
119
|
+
|
|
120
|
+
## Advanced Tools
|
|
121
|
+
|
|
122
|
+
**Task Tool (Sub-Agents):**
|
|
123
|
+
- Use the Task tool (functions.task) to launch sub-agents
|
|
124
|
+
- Check the Task tool description for current agent types and their capabilities
|
|
125
|
+
- Useful for complex analysis, specialized workflows, or tasks requiring isolated context
|
|
126
|
+
- The agent list is dynamically generated - refer to tool schema for available agents
|
|
127
|
+
|
|
128
|
+
**Parallelization:**
|
|
129
|
+
- When multiple independent tool calls are needed, use multi_tool_use.parallel to run them concurrently.
|
|
130
|
+
- Reserve sequential calls for ordered or data-dependent steps.
|
|
131
|
+
|
|
132
|
+
**MCP Tools:**
|
|
133
|
+
- Model Context Protocol servers provide additional capabilities
|
|
134
|
+
- MCP tools are prefixed: \`mcp__<server-name>__<tool-name>\`
|
|
135
|
+
- Check your available tools for MCP integrations
|
|
136
|
+
- Use when the tool's functionality matches your task needs
|
|
137
|
+
|
|
138
|
+
## What Remains from Codex
|
|
139
|
+
|
|
140
|
+
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.
|
|
141
|
+
|
|
142
|
+
## Approvals & Safety
|
|
143
|
+
- Assume workspace-write filesystem, network enabled, approval on-failure unless explicitly stated otherwise.
|
|
144
|
+
- When a command fails due to sandboxing or permissions, retry with escalated permissions if allowed by policy, including a one-line justification.
|
|
145
|
+
- Treat destructive commands (e.g., \`rm\`, \`git reset --hard\`) as requiring explicit user request or approval.
|
|
146
|
+
- Never run \`git reset --hard\`, \`git checkout --\`, or force deletes unless the user explicitly asked for that exact action.
|
|
147
|
+
- \`request_user_input\` is Plan-mode only; do not call it in Default mode.
|
|
148
148
|
- When uncertain, prefer non-destructive verification first (e.g., confirm file existence with \`list\`, then delete with \`bash\`).`;
|
|
@@ -381,83 +381,83 @@ export function prewarmCodexInstructions(models = []) {
|
|
|
381
381
|
/**
|
|
382
382
|
* Tool remapping instructions for host runtime tools
|
|
383
383
|
*/
|
|
384
|
-
export const TOOL_REMAP_MESSAGE = `<user_instructions priority="0">
|
|
385
|
-
<environment_override priority="0">
|
|
386
|
-
YOU ARE IN A DIFFERENT ENVIRONMENT. These instructions override ALL previous tool references.
|
|
387
|
-
</environment_override>
|
|
388
|
-
|
|
389
|
-
<tool_replacements priority="0">
|
|
390
|
-
<critical_rule priority="0">
|
|
391
|
-
apply_patch/applyPatch are Codex names, but host tool names vary by version.
|
|
392
|
-
- Inspect the actual tool list before editing.
|
|
393
|
-
- If edit exists: use edit for precise in-place string replacements and hashline edits.
|
|
394
|
-
- If edit is absent and apply_patch exists: use apply_patch for those precise/hashline edits in this plugin.
|
|
395
|
-
- For diff-style or multi-line structural edits: use patch if available, otherwise use apply_patch.
|
|
396
|
-
- In this plugin, edit/apply_patch support hashline refs (lineRef, endLineRef, operation, content)
|
|
397
|
-
</critical_rule>
|
|
398
|
-
|
|
399
|
-
<critical_rule priority="0">
|
|
400
|
-
UPDATE_PLAN DOES NOT EXIST -> USE "todowrite" INSTEAD
|
|
401
|
-
- NEVER use: update_plan, updatePlan
|
|
402
|
-
- ALWAYS use: todowrite for ALL task/plan operations
|
|
403
|
-
- Use todoread to read current plan
|
|
404
|
-
- Before plan operations: Verify you're using "todowrite", NOT "update_plan"
|
|
405
|
-
</critical_rule>
|
|
406
|
-
</tool_replacements>
|
|
407
|
-
|
|
408
|
-
<available_tools priority="0">
|
|
409
|
-
File Operations:
|
|
410
|
-
- write - Create new files (if available)
|
|
411
|
-
- edit - Modify existing files with string replacement (version-dependent)
|
|
412
|
-
- oldString must be literal text from the current file; never pass unresolved placeholders like \${TARGET_SNIPPET}
|
|
413
|
-
- apply_patch - May be the edit/patch tool name in newer host builds (version-dependent)
|
|
414
|
-
- hashline_read - Read lines with hashline refs (L<line>#<hash>) for deterministic edits
|
|
415
|
-
- patch - Apply diff patches (version-dependent)
|
|
416
|
-
- read - Read file contents
|
|
417
|
-
|
|
418
|
-
Search/Discovery:
|
|
419
|
-
- grep - Search file contents
|
|
420
|
-
- glob - Find files by pattern
|
|
421
|
-
- list - List directories (if available)
|
|
422
|
-
|
|
423
|
-
Execution:
|
|
424
|
-
- bash - Run shell commands
|
|
425
|
-
|
|
426
|
-
Network:
|
|
427
|
-
- webfetch - Fetch web content
|
|
428
|
-
|
|
429
|
-
Task Management:
|
|
430
|
-
- todowrite - Manage tasks/plans (REPLACES update_plan)
|
|
431
|
-
- todoread - Read current plan
|
|
432
|
-
</available_tools>
|
|
433
|
-
|
|
434
|
-
<substitution_rules priority="0">
|
|
435
|
-
Base instruction says: You MUST use instead:
|
|
436
|
-
apply_patch -> patch (preferred if available), otherwise edit/apply_patch based on actual tool list
|
|
437
|
-
update_plan -> todowrite
|
|
438
|
-
read_plan -> todoread
|
|
439
|
-
absolute paths -> relative paths
|
|
440
|
-
</substitution_rules>
|
|
441
|
-
|
|
442
|
-
<verification_checklist priority="0">
|
|
443
|
-
Before file/plan modifications:
|
|
444
|
-
1. Am I using the actual available edit tool name (edit, patch, or apply_patch)?
|
|
445
|
-
2. Am I using "todowrite" NOT "update_plan"?
|
|
446
|
-
3. Is this tool in the approved list above?
|
|
447
|
-
4. Am I using relative paths?
|
|
448
|
-
|
|
449
|
-
If ANY answer is NO -> STOP and correct before proceeding.
|
|
450
|
-
</verification_checklist>
|
|
451
|
-
|
|
452
|
-
<hashline_workflow priority="0">
|
|
453
|
-
When hashline_read is available:
|
|
454
|
-
1. call hashline_read on the file
|
|
455
|
-
2. edit/apply_patch using lineRef/endLineRef + operation + content
|
|
456
|
-
3. use oldString/newString only as fallback, and only with literal file text (no template placeholders)
|
|
457
|
-
</hashline_workflow>
|
|
458
|
-
|
|
459
|
-
<safety_rules priority="0">
|
|
460
|
-
- Never run destructive git commands (\`git reset --hard\`, \`git checkout --\`) unless explicitly requested by the user.
|
|
461
|
-
- Never call \`request_user_input\` unless collaboration mode is explicitly Plan mode.
|
|
462
|
-
</safety_rules>
|
|
384
|
+
export const TOOL_REMAP_MESSAGE = `<user_instructions priority="0">
|
|
385
|
+
<environment_override priority="0">
|
|
386
|
+
YOU ARE IN A DIFFERENT ENVIRONMENT. These instructions override ALL previous tool references.
|
|
387
|
+
</environment_override>
|
|
388
|
+
|
|
389
|
+
<tool_replacements priority="0">
|
|
390
|
+
<critical_rule priority="0">
|
|
391
|
+
apply_patch/applyPatch are Codex names, but host tool names vary by version.
|
|
392
|
+
- Inspect the actual tool list before editing.
|
|
393
|
+
- If edit exists: use edit for precise in-place string replacements and hashline edits.
|
|
394
|
+
- If edit is absent and apply_patch exists: use apply_patch for those precise/hashline edits in this plugin.
|
|
395
|
+
- For diff-style or multi-line structural edits: use patch if available, otherwise use apply_patch.
|
|
396
|
+
- In this plugin, edit/apply_patch support hashline refs (lineRef, endLineRef, operation, content)
|
|
397
|
+
</critical_rule>
|
|
398
|
+
|
|
399
|
+
<critical_rule priority="0">
|
|
400
|
+
UPDATE_PLAN DOES NOT EXIST -> USE "todowrite" INSTEAD
|
|
401
|
+
- NEVER use: update_plan, updatePlan
|
|
402
|
+
- ALWAYS use: todowrite for ALL task/plan operations
|
|
403
|
+
- Use todoread to read current plan
|
|
404
|
+
- Before plan operations: Verify you're using "todowrite", NOT "update_plan"
|
|
405
|
+
</critical_rule>
|
|
406
|
+
</tool_replacements>
|
|
407
|
+
|
|
408
|
+
<available_tools priority="0">
|
|
409
|
+
File Operations:
|
|
410
|
+
- write - Create new files (if available)
|
|
411
|
+
- edit - Modify existing files with string replacement (version-dependent)
|
|
412
|
+
- oldString must be literal text from the current file; never pass unresolved placeholders like \${TARGET_SNIPPET}
|
|
413
|
+
- apply_patch - May be the edit/patch tool name in newer host builds (version-dependent)
|
|
414
|
+
- hashline_read - Read lines with hashline refs (L<line>#<hash>) for deterministic edits
|
|
415
|
+
- patch - Apply diff patches (version-dependent)
|
|
416
|
+
- read - Read file contents
|
|
417
|
+
|
|
418
|
+
Search/Discovery:
|
|
419
|
+
- grep - Search file contents
|
|
420
|
+
- glob - Find files by pattern
|
|
421
|
+
- list - List directories (if available)
|
|
422
|
+
|
|
423
|
+
Execution:
|
|
424
|
+
- bash - Run shell commands
|
|
425
|
+
|
|
426
|
+
Network:
|
|
427
|
+
- webfetch - Fetch web content
|
|
428
|
+
|
|
429
|
+
Task Management:
|
|
430
|
+
- todowrite - Manage tasks/plans (REPLACES update_plan)
|
|
431
|
+
- todoread - Read current plan
|
|
432
|
+
</available_tools>
|
|
433
|
+
|
|
434
|
+
<substitution_rules priority="0">
|
|
435
|
+
Base instruction says: You MUST use instead:
|
|
436
|
+
apply_patch -> patch (preferred if available), otherwise edit/apply_patch based on actual tool list
|
|
437
|
+
update_plan -> todowrite
|
|
438
|
+
read_plan -> todoread
|
|
439
|
+
absolute paths -> relative paths
|
|
440
|
+
</substitution_rules>
|
|
441
|
+
|
|
442
|
+
<verification_checklist priority="0">
|
|
443
|
+
Before file/plan modifications:
|
|
444
|
+
1. Am I using the actual available edit tool name (edit, patch, or apply_patch)?
|
|
445
|
+
2. Am I using "todowrite" NOT "update_plan"?
|
|
446
|
+
3. Is this tool in the approved list above?
|
|
447
|
+
4. Am I using relative paths?
|
|
448
|
+
|
|
449
|
+
If ANY answer is NO -> STOP and correct before proceeding.
|
|
450
|
+
</verification_checklist>
|
|
451
|
+
|
|
452
|
+
<hashline_workflow priority="0">
|
|
453
|
+
When hashline_read is available:
|
|
454
|
+
1. call hashline_read on the file
|
|
455
|
+
2. edit/apply_patch using lineRef/endLineRef + operation + content
|
|
456
|
+
3. use oldString/newString only as fallback, and only with literal file text (no template placeholders)
|
|
457
|
+
</hashline_workflow>
|
|
458
|
+
|
|
459
|
+
<safety_rules priority="0">
|
|
460
|
+
- Never run destructive git commands (\`git reset --hard\`, \`git checkout --\`) unless explicitly requested by the user.
|
|
461
|
+
- Never call \`request_user_input\` unless collaboration mode is explicitly Plan mode.
|
|
462
|
+
</safety_rules>
|
|
463
463
|
</user_instructions>`;
|
|
@@ -12,9 +12,9 @@ export declare function buildQuotaEmailFallbackState(accounts: readonly QuotaCac
|
|
|
12
12
|
export declare function hasSafeQuotaEmailFallback(emailFallbackState: ReadonlyMap<string, QuotaEmailFallbackState>, account: QuotaCacheAccountRef): boolean;
|
|
13
13
|
export declare function quotaLeftPercentFromUsed(usedPercent: number | undefined): number | undefined;
|
|
14
14
|
export declare function quotaUsedPercentIsExhausted(usedPercent: number | undefined): boolean;
|
|
15
|
-
export declare function isQuotaCacheEntryExhausted(entry: Pick<QuotaCacheEntry, "primary" | "secondary"> & {
|
|
15
|
+
export declare function isQuotaCacheEntryExhausted(entry: (Pick<QuotaCacheEntry, "primary" | "secondary"> & {
|
|
16
16
|
updatedAt?: number;
|
|
17
|
-
} | null | undefined, now?: number): boolean;
|
|
17
|
+
}) | null | undefined, now?: number): boolean;
|
|
18
18
|
/** Cache identity includes the credential record, so shared organization IDs cannot collide. */
|
|
19
19
|
export declare function quotaWorkspaceKey(account: QuotaCacheAccountRef, workspaceId: string): string | undefined;
|
|
20
20
|
/** Display the selected workspace; callers routing another scope must pass that exact workspace. */
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* tool-surface metadata so routing logic stays consistent across the request
|
|
7
7
|
* transformer, prompt selection, and CLI diagnostics.
|
|
8
8
|
*/
|
|
9
|
-
import type
|
|
9
|
+
import { type ModelReasoningEffort, type WireReasoningEffort } from "../../constants.js";
|
|
10
10
|
export type { ModelReasoningEffort, WireReasoningEffort };
|
|
11
11
|
export type PromptModelFamily = "gpt-5-codex" | "codex-max" | "codex" | "gpt-5.2" | "gpt-5.1";
|
|
12
12
|
/**
|
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
* tool-surface metadata so routing logic stays consistent across the request
|
|
7
7
|
* transformer, prompt selection, and CLI diagnostics.
|
|
8
8
|
*/
|
|
9
|
+
// The effort union lives in the leaf constants module so the base types layer
|
|
10
|
+
// (`lib/types.ts`) can depend on it without importing this file, which would
|
|
11
|
+
// close a cycle through `lib/schemas.ts`. Re-exported here for existing callers.
|
|
12
|
+
import { LUNA_RESERVE_MODEL, } from "../../constants.js";
|
|
9
13
|
/**
|
|
10
14
|
* All supported model families
|
|
11
15
|
* Used for per-family account rotation and rate limit tracking
|
|
@@ -301,6 +305,13 @@ export const MODEL_PROFILES = {
|
|
|
301
305
|
supportedReasoningEfforts: GPT_6_LUNA_EFFORTS,
|
|
302
306
|
capabilities: TOOL_CAPABILITIES.full,
|
|
303
307
|
},
|
|
308
|
+
[LUNA_RESERVE_MODEL]: {
|
|
309
|
+
normalizedModel: LUNA_RESERVE_MODEL,
|
|
310
|
+
promptFamily: "gpt-5.2",
|
|
311
|
+
defaultReasoningEffort: "medium",
|
|
312
|
+
supportedReasoningEfforts: GPT_6_LUNA_EFFORTS,
|
|
313
|
+
capabilities: TOOL_CAPABILITIES.full,
|
|
314
|
+
},
|
|
304
315
|
[DAYBREAK_BLUE_MODEL]: {
|
|
305
316
|
normalizedModel: DAYBREAK_BLUE_MODEL,
|
|
306
317
|
promptFamily: "gpt-5.2",
|
|
@@ -392,6 +403,7 @@ function addGpt6Aliases() {
|
|
|
392
403
|
// user's model generation without asking.
|
|
393
404
|
addEffortAliases(GPT_6_SOL_MODEL, GPT_6_SOL_MODEL, GPT_6_SOL_EFFORTS);
|
|
394
405
|
addEffortAliases(GPT_6_LUNA_MODEL, GPT_6_LUNA_MODEL, GPT_6_LUNA_EFFORTS);
|
|
406
|
+
addEffortAliases(LUNA_RESERVE_MODEL, LUNA_RESERVE_MODEL, GPT_6_LUNA_EFFORTS);
|
|
395
407
|
addEffortAliases(GPT_6_1_SOL_MODEL, GPT_6_1_SOL_MODEL, GPT_6_1_SOL_EFFORTS);
|
|
396
408
|
addEffortAliases(GPT_6_1_FLAGSHIP_ALIAS, GPT_6_1_SOL_MODEL, GPT_6_1_SOL_EFFORTS);
|
|
397
409
|
}
|
|
@@ -13,7 +13,7 @@ export declare class ResponseOutcome {
|
|
|
13
13
|
param?: string;
|
|
14
14
|
};
|
|
15
15
|
} | undefined;
|
|
16
|
-
constructor(requireTerminal: boolean);
|
|
16
|
+
constructor(requireTerminal: boolean | (() => boolean));
|
|
17
17
|
observe(value: unknown): void;
|
|
18
18
|
/**
|
|
19
19
|
* `response.incomplete` (e.g. max_output_tokens) is a delivered response, not an
|
|
@@ -38,7 +38,10 @@ export class ResponseOutcome {
|
|
|
38
38
|
* type survives only as the usage annotation in `errorCode`.
|
|
39
39
|
*/
|
|
40
40
|
finish() {
|
|
41
|
-
const
|
|
41
|
+
const requireTerminal = typeof this.requireTerminal === "function"
|
|
42
|
+
? this.requireTerminal()
|
|
43
|
+
: this.requireTerminal;
|
|
44
|
+
const missingTerminal = requireTerminal && !this.terminal;
|
|
42
45
|
const success = !missingTerminal && (!this.terminal || this.terminal === "completed" || this.terminal === "incomplete");
|
|
43
46
|
return {
|
|
44
47
|
success,
|
|
@@ -121,7 +121,9 @@ function getSharedProxyDispatcher(proxyUrl) {
|
|
|
121
121
|
if (existing) {
|
|
122
122
|
return existing;
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
// undici 8 enables H2 on TLS ALPN; keep HTTP/1.1 so upstream protocol
|
|
125
|
+
// behavior matches the 6.x line this pin replaces.
|
|
126
|
+
const dispatcher = new ProxyAgent({ uri: proxyUrl, allowH2: false });
|
|
125
127
|
sharedProxyDispatchers.set(proxyUrl, dispatcher);
|
|
126
128
|
return dispatcher;
|
|
127
129
|
}
|
|
@@ -46,17 +46,17 @@ export declare class AccountModelCatalog {
|
|
|
46
46
|
checkedAt: number;
|
|
47
47
|
models: string[];
|
|
48
48
|
entitlements: {
|
|
49
|
+
model: string;
|
|
50
|
+
checkedAt?: number | undefined;
|
|
51
|
+
probes?: {
|
|
52
|
+
[k: string]: "downgraded" | "unsupported" | "unverified" | "verified";
|
|
53
|
+
} | undefined;
|
|
49
54
|
serviceTiers: {
|
|
50
55
|
id: string;
|
|
51
56
|
name: string;
|
|
52
57
|
}[];
|
|
53
58
|
reasoningLevels: string[];
|
|
54
59
|
accessPrograms: string[];
|
|
55
|
-
probes?: {
|
|
56
|
-
[k: string]: "unsupported" | "verified" | "unverified" | "downgraded";
|
|
57
|
-
} | undefined;
|
|
58
|
-
checkedAt?: number | undefined;
|
|
59
|
-
model: string;
|
|
60
60
|
}[];
|
|
61
61
|
error: boolean;
|
|
62
62
|
};
|
|
@@ -6,7 +6,7 @@ export declare function isResetTargetEnabled(account: AccountMetadataV3, target:
|
|
|
6
6
|
export declare function createResetCreditService(manager?: AccountManager): ResetCreditService;
|
|
7
7
|
export declare function loadResetCreditState(): Promise<{
|
|
8
8
|
version: 1;
|
|
9
|
-
policy: "
|
|
9
|
+
policy: "last-resort" | "manual";
|
|
10
10
|
snapshots: Record<string, {
|
|
11
11
|
updatedAt: number;
|
|
12
12
|
availableCount: number | null;
|
|
@@ -32,7 +32,7 @@ export declare function loadResetCreditState(): Promise<{
|
|
|
32
32
|
lastRedemption?: {
|
|
33
33
|
key: string;
|
|
34
34
|
at: number;
|
|
35
|
-
outcome: "
|
|
35
|
+
outcome: "alreadyRedeemed" | "noCredit" | "nothingToReset" | "reset";
|
|
36
36
|
automatic: boolean;
|
|
37
37
|
} | undefined;
|
|
38
38
|
}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getQuotaKey } from "../accounts/rate-limits.js";
|
|
2
|
+
import { LUNA_RESERVE_MODEL } from "../constants.js";
|
|
2
3
|
export function resolveActiveIndex(storage, family = "codex") {
|
|
3
4
|
const total = storage.accounts.length;
|
|
4
5
|
if (total === 0)
|
|
@@ -58,7 +59,7 @@ function laterBound(a, b) {
|
|
|
58
59
|
export function getAccountRecoveryBoundsForFamily(account, now, family, model) {
|
|
59
60
|
const times = account.rateLimitResetTimes;
|
|
60
61
|
const rateLimitAtMs = times
|
|
61
|
-
? laterBound(activeBound(times[getQuotaKey(family)], now), model ? activeBound(times[getQuotaKey(family, model)], now) : null)
|
|
62
|
+
? laterBound(model === LUNA_RESERVE_MODEL ? null : activeBound(times[getQuotaKey(family)], now), model ? activeBound(times[getQuotaKey(family, model)], now) : null)
|
|
62
63
|
: null;
|
|
63
64
|
return {
|
|
64
65
|
rateLimitAtMs,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type LunaReserveSnapshot } from "../luna-reserve.js";
|
|
2
|
+
import type { AccountStorageV3 } from "../storage.js";
|
|
3
|
+
export type LunaReserveUsageByAccount = Record<number, LunaReserveSnapshot>;
|
|
4
|
+
/**
|
|
5
|
+
* Read Luna Reserve usage through the same isolated native app-server bridge
|
|
6
|
+
* used for reset credits. Failures are per-account: one stale/revoked account
|
|
7
|
+
* never prevents other rows from reporting their Reserve percentage.
|
|
8
|
+
*/
|
|
9
|
+
export declare function refreshLunaReserveUsage(storage: AccountStorageV3, now?: () => number): Promise<LunaReserveUsageByAccount>;
|