codex-multi-auth 2.16.0 → 2.17.2
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 +487 -463
- 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 +1221 -1221
- package/config/codex-modern.json +423 -423
- package/config/minimal-codex.json +15 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -3
- package/dist/lib/account-policy.d.ts +4 -0
- package/dist/lib/account-policy.d.ts.map +1 -1
- package/dist/lib/account-policy.js +8 -0
- package/dist/lib/accounts/rate-limits.d.ts.map +1 -1
- package/dist/lib/accounts/rate-limits.js +2 -0
- package/dist/lib/accounts.d.ts +15 -3
- package/dist/lib/accounts.d.ts.map +1 -1
- package/dist/lib/accounts.js +231 -30
- package/dist/lib/api-route-store.d.ts +24 -0
- package/dist/lib/api-route-store.d.ts.map +1 -0
- package/dist/lib/api-route-store.js +145 -0
- package/dist/lib/auth/account-access.d.ts +115 -0
- package/dist/lib/auth/account-access.d.ts.map +1 -0
- package/dist/lib/auth/account-access.js +214 -0
- package/dist/lib/auth/token-utils.d.ts +54 -1
- package/dist/lib/auth/token-utils.d.ts.map +1 -1
- package/dist/lib/auth/token-utils.js +92 -7
- package/dist/lib/cli.d.ts +1 -1
- package/dist/lib/cli.d.ts.map +1 -1
- package/dist/lib/cli.js +4 -0
- package/dist/lib/codex-cli/state.d.ts +7 -0
- package/dist/lib/codex-cli/state.d.ts.map +1 -1
- package/dist/lib/codex-cli/state.js +18 -0
- package/dist/lib/codex-cli/writer.d.ts.map +1 -1
- package/dist/lib/codex-cli/writer.js +60 -8
- package/dist/lib/codex-manager/account-manager-commands.d.ts.map +1 -1
- package/dist/lib/codex-manager/account-manager-commands.js +1 -0
- package/dist/lib/codex-manager/account-pool-write.d.ts +3 -1
- package/dist/lib/codex-manager/account-pool-write.d.ts.map +1 -1
- package/dist/lib/codex-manager/account-pool-write.js +4 -0
- package/dist/lib/codex-manager/api-login-menu.d.ts +14 -0
- package/dist/lib/codex-manager/api-login-menu.d.ts.map +1 -0
- package/dist/lib/codex-manager/api-login-menu.js +224 -0
- package/dist/lib/codex-manager/commands/account.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/account.js +27 -0
- package/dist/lib/codex-manager/commands/best.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/best.js +6 -2
- package/dist/lib/codex-manager/commands/check.d.ts +7 -1
- package/dist/lib/codex-manager/commands/check.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/check.js +24 -3
- package/dist/lib/codex-manager/commands/forecast.d.ts +1 -1
- package/dist/lib/codex-manager/commands/forecast.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/forecast.js +7 -3
- package/dist/lib/codex-manager/commands/report.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/report.js +5 -1
- package/dist/lib/codex-manager/commands/resets.d.ts +2 -0
- package/dist/lib/codex-manager/commands/resets.d.ts.map +1 -0
- package/dist/lib/codex-manager/commands/resets.js +67 -0
- package/dist/lib/codex-manager/commands/rotation.d.ts +2 -2
- package/dist/lib/codex-manager/commands/rotation.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/rotation.js +63 -12
- package/dist/lib/codex-manager/commands/status.d.ts +12 -1
- package/dist/lib/codex-manager/commands/status.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/status.js +166 -22
- package/dist/lib/codex-manager/commands/uninstall.js +1 -1
- package/dist/lib/codex-manager/formatters/quota-formatters.d.ts.map +1 -1
- package/dist/lib/codex-manager/formatters/quota-formatters.js +3 -2
- package/dist/lib/codex-manager/health-check.d.ts +3 -0
- package/dist/lib/codex-manager/health-check.d.ts.map +1 -1
- package/dist/lib/codex-manager/health-check.js +57 -7
- package/dist/lib/codex-manager/help.d.ts.map +1 -1
- package/dist/lib/codex-manager/help.js +4 -2
- package/dist/lib/codex-manager/login-flow.d.ts.map +1 -1
- package/dist/lib/codex-manager/login-flow.js +69 -7
- package/dist/lib/codex-manager/login-menu-data.d.ts.map +1 -1
- package/dist/lib/codex-manager/login-menu-data.js +21 -8
- package/dist/lib/codex-manager/login-oauth.d.ts +3 -0
- package/dist/lib/codex-manager/login-oauth.d.ts.map +1 -1
- package/dist/lib/codex-manager/login-oauth.js +6 -1
- package/dist/lib/codex-manager/login-workspace-choice.d.ts +11 -0
- package/dist/lib/codex-manager/login-workspace-choice.d.ts.map +1 -0
- package/dist/lib/codex-manager/login-workspace-choice.js +37 -0
- package/dist/lib/codex-manager/persist-selected-account.d.ts.map +1 -1
- package/dist/lib/codex-manager/persist-selected-account.js +2 -1
- package/dist/lib/codex-manager/quota-cache-helpers.d.ts +7 -1
- package/dist/lib/codex-manager/quota-cache-helpers.d.ts.map +1 -1
- package/dist/lib/codex-manager/quota-cache-helpers.js +34 -19
- package/dist/lib/codex-manager/repair-commands.d.ts +13 -0
- package/dist/lib/codex-manager/repair-commands.d.ts.map +1 -1
- package/dist/lib/codex-manager/repair-commands.js +144 -9
- package/dist/lib/codex-manager.d.ts.map +1 -1
- package/dist/lib/codex-manager.js +25 -6
- package/dist/lib/concurrency.d.ts +3 -0
- package/dist/lib/concurrency.d.ts.map +1 -0
- package/dist/lib/concurrency.js +31 -0
- package/dist/lib/context-budget-response.js +8 -8
- package/dist/lib/context-overflow.js +10 -10
- package/dist/lib/model-route-policy.d.ts +52 -0
- package/dist/lib/model-route-policy.d.ts.map +1 -0
- package/dist/lib/model-route-policy.js +159 -0
- package/dist/lib/oauth-success.html +125 -125
- package/dist/lib/policy/runtime-policy.d.ts +1 -0
- package/dist/lib/policy/runtime-policy.d.ts.map +1 -1
- package/dist/lib/policy/runtime-policy.js +3 -0
- package/dist/lib/preemptive-quota-scheduler.d.ts +2 -0
- package/dist/lib/preemptive-quota-scheduler.d.ts.map +1 -1
- package/dist/lib/preemptive-quota-scheduler.js +4 -0
- package/dist/lib/prompts/codex-host-bridge.js +138 -138
- package/dist/lib/prompts/codex.js +79 -79
- package/dist/lib/quota-cache.d.ts +7 -3
- package/dist/lib/quota-cache.d.ts.map +1 -1
- package/dist/lib/quota-cache.js +91 -59
- package/dist/lib/quota-probe.d.ts +5 -0
- package/dist/lib/quota-probe.d.ts.map +1 -1
- package/dist/lib/quota-probe.js +26 -2
- package/dist/lib/quota-readiness.d.ts +7 -2
- package/dist/lib/quota-readiness.d.ts.map +1 -1
- package/dist/lib/quota-readiness.js +25 -4
- package/dist/lib/request/client-cancellation.d.ts +5 -0
- package/dist/lib/request/client-cancellation.d.ts.map +1 -0
- package/dist/lib/request/client-cancellation.js +7 -0
- package/dist/lib/request/response-outcome.d.ts +25 -0
- package/dist/lib/request/response-outcome.d.ts.map +1 -0
- package/dist/lib/request/response-outcome.js +49 -0
- package/dist/lib/request/stream-failover-runtime.d.ts +2 -1
- package/dist/lib/request/stream-failover-runtime.d.ts.map +1 -1
- package/dist/lib/request/stream-failover-runtime.js +29 -10
- package/dist/lib/runtime/account-check.d.ts.map +1 -1
- package/dist/lib/runtime/account-check.js +2 -8
- package/dist/lib/runtime/account-model-catalog.d.ts +64 -0
- package/dist/lib/runtime/account-model-catalog.d.ts.map +1 -0
- package/dist/lib/runtime/account-model-catalog.js +154 -0
- package/dist/lib/runtime/account-pool.d.ts +3 -1
- package/dist/lib/runtime/account-pool.d.ts.map +1 -1
- package/dist/lib/runtime/account-pool.js +4 -0
- package/dist/lib/runtime/account-reset-credits.d.ts +42 -0
- package/dist/lib/runtime/account-reset-credits.d.ts.map +1 -0
- package/dist/lib/runtime/account-reset-credits.js +82 -0
- package/dist/lib/runtime/api-model-capabilities.d.ts +30 -0
- package/dist/lib/runtime/api-model-capabilities.d.ts.map +1 -0
- package/dist/lib/runtime/api-model-capabilities.js +434 -0
- package/dist/lib/runtime/api-model-runtime.d.ts +42 -0
- package/dist/lib/runtime/api-model-runtime.d.ts.map +1 -0
- package/dist/lib/runtime/api-model-runtime.js +358 -0
- package/dist/lib/runtime/app-bind.d.ts +19 -1
- package/dist/lib/runtime/app-bind.d.ts.map +1 -1
- package/dist/lib/runtime/app-bind.js +89 -11
- package/dist/lib/runtime/automatic-account-checks.d.ts +35 -0
- package/dist/lib/runtime/automatic-account-checks.d.ts.map +1 -0
- package/dist/lib/runtime/automatic-account-checks.js +140 -0
- package/dist/lib/runtime/automatic-subscription-checks.d.ts +7 -0
- package/dist/lib/runtime/automatic-subscription-checks.d.ts.map +1 -0
- package/dist/lib/runtime/automatic-subscription-checks.js +54 -0
- package/dist/lib/runtime/catalog-capabilities.d.ts +8 -0
- package/dist/lib/runtime/catalog-capabilities.d.ts.map +1 -0
- package/dist/lib/runtime/catalog-capabilities.js +61 -0
- package/dist/lib/runtime/inference-activity.d.ts +15 -0
- package/dist/lib/runtime/inference-activity.d.ts.map +1 -0
- package/dist/lib/runtime/inference-activity.js +95 -0
- package/dist/lib/runtime/model-discovery-status.d.ts +100 -0
- package/dist/lib/runtime/model-discovery-status.d.ts.map +1 -0
- package/dist/lib/runtime/model-discovery-status.js +387 -0
- package/dist/lib/runtime/native-account-storage.d.ts +11 -0
- package/dist/lib/runtime/native-account-storage.d.ts.map +1 -0
- package/dist/lib/runtime/native-account-storage.js +50 -0
- package/dist/lib/runtime/native-account-sync.d.ts +19 -0
- package/dist/lib/runtime/native-account-sync.d.ts.map +1 -0
- package/dist/lib/runtime/native-account-sync.js +62 -0
- package/dist/lib/runtime/native-binding-lock.d.ts +3 -0
- package/dist/lib/runtime/native-binding-lock.d.ts.map +1 -0
- package/dist/lib/runtime/native-binding-lock.js +5 -0
- package/dist/lib/runtime/native-client-auth.d.ts +3 -0
- package/dist/lib/runtime/native-client-auth.d.ts.map +1 -0
- package/dist/lib/runtime/native-client-auth.js +42 -0
- package/dist/lib/runtime/native-provider-config.d.ts +4 -0
- package/dist/lib/runtime/native-provider-config.d.ts.map +1 -0
- package/dist/lib/runtime/native-provider-config.js +52 -0
- package/dist/lib/runtime/native-rate-limits.d.ts +18 -0
- package/dist/lib/runtime/native-rate-limits.d.ts.map +1 -0
- package/dist/lib/runtime/native-rate-limits.js +135 -0
- package/dist/lib/runtime/reset-credit-routing.d.ts +41 -0
- package/dist/lib/runtime/reset-credit-routing.d.ts.map +1 -0
- package/dist/lib/runtime/reset-credit-routing.js +66 -0
- package/dist/lib/runtime/reset-credits.d.ts +101 -0
- package/dist/lib/runtime/reset-credits.d.ts.map +1 -0
- package/dist/lib/runtime/reset-credits.js +162 -0
- package/dist/lib/runtime/response-output-history.d.ts +17 -0
- package/dist/lib/runtime/response-output-history.d.ts.map +1 -0
- package/dist/lib/runtime/response-output-history.js +85 -0
- package/dist/lib/runtime/responses-websocket.d.ts +31 -0
- package/dist/lib/runtime/responses-websocket.d.ts.map +1 -0
- package/dist/lib/runtime/responses-websocket.js +636 -0
- package/dist/lib/runtime/resume-picker.d.ts +41 -0
- package/dist/lib/runtime/resume-picker.d.ts.map +1 -0
- package/dist/lib/runtime/resume-picker.js +169 -0
- package/dist/lib/runtime/rotation-account-selection.d.ts +6 -0
- package/dist/lib/runtime/rotation-account-selection.d.ts.map +1 -1
- package/dist/lib/runtime/rotation-account-selection.js +63 -0
- package/dist/lib/runtime/rotation-proxy-state.d.ts +33 -0
- package/dist/lib/runtime/rotation-proxy-state.d.ts.map +1 -1
- package/dist/lib/runtime/rotation-server-types.d.ts +18 -0
- package/dist/lib/runtime/rotation-server-types.d.ts.map +1 -1
- package/dist/lib/runtime/runtime-capability-failures.d.ts +14 -0
- package/dist/lib/runtime/runtime-capability-failures.d.ts.map +1 -0
- package/dist/lib/runtime/runtime-capability-failures.js +76 -0
- package/dist/lib/runtime/runtime-observability.d.ts +7 -0
- package/dist/lib/runtime/runtime-observability.d.ts.map +1 -1
- package/dist/lib/runtime/runtime-observability.js +42 -2
- package/dist/lib/runtime/subscription-first-use.d.ts +10 -0
- package/dist/lib/runtime/subscription-first-use.d.ts.map +1 -0
- package/dist/lib/runtime/subscription-first-use.js +64 -0
- package/dist/lib/runtime/subscription-quota-event.d.ts +6 -0
- package/dist/lib/runtime/subscription-quota-event.d.ts.map +1 -0
- package/dist/lib/runtime/subscription-quota-event.js +31 -0
- package/dist/lib/runtime/subscription-quota-order.d.ts +17 -0
- package/dist/lib/runtime/subscription-quota-order.d.ts.map +1 -0
- package/dist/lib/runtime/subscription-quota-order.js +31 -0
- package/dist/lib/runtime/workspace-model-scopes.d.ts +15 -0
- package/dist/lib/runtime/workspace-model-scopes.d.ts.map +1 -0
- package/dist/lib/runtime/workspace-model-scopes.js +34 -0
- package/dist/lib/runtime-constants.d.ts +3 -0
- package/dist/lib/runtime-constants.d.ts.map +1 -1
- package/dist/lib/runtime-constants.js +5 -0
- package/dist/lib/runtime-paths.d.ts.map +1 -1
- package/dist/lib/runtime-paths.js +4 -1
- package/dist/lib/runtime-rotation-proxy.d.ts.map +1 -1
- package/dist/lib/runtime-rotation-proxy.js +852 -42
- package/dist/lib/schemas.d.ts +20 -0
- package/dist/lib/schemas.d.ts.map +1 -1
- package/dist/lib/schemas.js +3 -0
- package/dist/lib/storage/credential-sidecars.d.ts +13 -0
- package/dist/lib/storage/credential-sidecars.d.ts.map +1 -0
- package/dist/lib/storage/credential-sidecars.js +52 -0
- package/dist/lib/storage/file-lock.d.ts +9 -0
- package/dist/lib/storage/file-lock.d.ts.map +1 -0
- package/dist/lib/storage/file-lock.js +186 -0
- package/dist/lib/storage/flagged-storage.d.ts.map +1 -1
- package/dist/lib/storage/flagged-storage.js +12 -0
- package/dist/lib/storage/path-state.d.ts +2 -0
- package/dist/lib/storage/path-state.d.ts.map +1 -1
- package/dist/lib/storage/path-state.js +9 -0
- package/dist/lib/storage/paths.js +4 -4
- package/dist/lib/storage/pending-auth.d.ts +18 -0
- package/dist/lib/storage/pending-auth.d.ts.map +1 -0
- package/dist/lib/storage/pending-auth.js +155 -0
- package/dist/lib/storage/public-types.d.ts +13 -0
- package/dist/lib/storage/public-types.d.ts.map +1 -1
- package/dist/lib/storage/record-identity.d.ts +16 -0
- package/dist/lib/storage/record-identity.d.ts.map +1 -0
- package/dist/lib/storage/record-identity.js +16 -0
- package/dist/lib/storage/snapshot-merge.d.ts +16 -0
- package/dist/lib/storage/snapshot-merge.d.ts.map +1 -0
- package/dist/lib/storage/snapshot-merge.js +206 -0
- package/dist/lib/storage/transactions.d.ts.map +1 -1
- package/dist/lib/storage/transactions.js +5 -4
- package/dist/lib/storage.d.ts +6 -0
- package/dist/lib/storage.d.ts.map +1 -1
- package/dist/lib/storage.js +77 -7
- package/dist/lib/ui/auth-menu-builder.d.ts +2 -0
- package/dist/lib/ui/auth-menu-builder.d.ts.map +1 -1
- package/dist/lib/ui/auth-menu-builder.js +1 -0
- package/dist/lib/ui/auth-menu.d.ts.map +1 -1
- package/dist/lib/ui/auth-menu.js +1 -0
- package/dist/lib/ui/check-progress.d.ts +8 -0
- package/dist/lib/ui/check-progress.d.ts.map +1 -0
- package/dist/lib/ui/check-progress.js +30 -0
- package/dist/lib/ui/format.d.ts +3 -1
- package/dist/lib/ui/format.d.ts.map +1 -1
- package/dist/lib/ui/format.js +8 -0
- package/dist/lib/ui/ui-copy.d.ts +2 -2
- package/dist/lib/ui/ui-copy.js +2 -2
- package/dist/lib/usage/pricing.js +2 -2
- package/dist/lib/usage/usage-extraction.d.ts +3 -1
- package/dist/lib/usage/usage-extraction.d.ts.map +1 -1
- package/dist/lib/usage/usage-extraction.js +46 -9
- 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 +200 -197
- package/scripts/codex-app-launcher.js +653 -653
- package/scripts/codex-app-router.js +373 -366
- package/scripts/codex-bin-resolver.js +313 -281
- package/scripts/codex-multi-auth.js +59 -59
- package/scripts/codex-routing.js +62 -61
- package/scripts/codex.js +6642 -6564
- 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/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>`;
|
|
@@ -14,6 +14,8 @@ export interface QuotaCacheEntry {
|
|
|
14
14
|
export interface QuotaCacheData {
|
|
15
15
|
byAccountId: Record<string, QuotaCacheEntry>;
|
|
16
16
|
byEmail: Record<string, QuotaCacheEntry>;
|
|
17
|
+
/** Quota scoped to a saved credential record and exact workspace. */
|
|
18
|
+
byWorkspace?: Record<string, QuotaCacheEntry>;
|
|
17
19
|
}
|
|
18
20
|
/**
|
|
19
21
|
* Get the absolute filesystem path to the quota-cache.json file.
|
|
@@ -52,8 +54,9 @@ export declare function loadQuotaCache(): Promise<QuotaCacheData>;
|
|
|
52
54
|
* quota cache path. Failures are logged and do not throw, so callers should handle
|
|
53
55
|
* eventual consistency or retry as needed.
|
|
54
56
|
*
|
|
55
|
-
* Concurrency:
|
|
56
|
-
*
|
|
57
|
+
* Concurrency: reload, apply changes since `baseline`, and atomically write under
|
|
58
|
+
* a cross-process lock. Pass the pre-edit snapshot for read–modify–write callers.
|
|
59
|
+
* Without a baseline, supplied entries are upserts; omitted entries are retained.
|
|
57
60
|
*
|
|
58
61
|
* Filesystem notes: Windows path length, permissions, or antivirus locks may cause
|
|
59
62
|
* write failures; such errors are logged rather than thrown.
|
|
@@ -63,6 +66,7 @@ export declare function loadQuotaCache(): Promise<QuotaCacheData>;
|
|
|
63
66
|
*
|
|
64
67
|
* @param data - The quota cache data (byAccountId and byEmail maps) to persist; callers
|
|
65
68
|
* should pass normalized QuotaCacheData.
|
|
69
|
+
* @param baseline - The unmodified pre-edit snapshot; only changes since it are applied.
|
|
66
70
|
*/
|
|
67
|
-
export declare function saveQuotaCache(data: QuotaCacheData): Promise<void>;
|
|
71
|
+
export declare function saveQuotaCache(data: QuotaCacheData, baseline?: QuotaCacheData): Promise<void>;
|
|
68
72
|
//# sourceMappingURL=quota-cache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quota-cache.d.ts","sourceRoot":"","sources":["../../lib/quota-cache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"quota-cache.d.ts","sourceRoot":"","sources":["../../lib/quota-cache.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,gBAAgB;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,SAAS,EAAE,gBAAgB,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC9B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC7C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACzC,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CAC9C;AAwGD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,cAAc,CAAC,CAO9D;AA2CD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,GAAE,cAAiD,GAAG,OAAO,CAAC,IAAI,CAAC,CA6DrI"}
|