codex-model-router 1.1.0 → 1.2.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/MAINTAINERS.md +92 -0
- package/README.md +144 -78
- package/SECURITY.md +21 -0
- package/lib/manifest.js +95 -0
- package/lib/router-core.js +808 -217
- package/lib/router.js +1 -210
- package/lib/toml.js +11 -15
- package/package.json +16 -5
package/MAINTAINERS.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Maintainer Guide
|
|
2
|
+
|
|
3
|
+
## First npm publication bootstrap
|
|
4
|
+
|
|
5
|
+
The first publication of a new npm package cannot use Trusted Publishing because the npm package settings do not exist yet. Use the Release workflow's explicit `bootstrap` publication mode exactly once.
|
|
6
|
+
|
|
7
|
+
The bootstrap token must be a granular npm access token with package read/write access and non-interactive publishing permission. Store it only as the GitHub Actions repository secret named `NPM_TOKEN`; never commit it to the repository or write it into workflow logs.
|
|
8
|
+
|
|
9
|
+
For the first publication:
|
|
10
|
+
|
|
11
|
+
1. Open **Actions → Release → Run workflow**.
|
|
12
|
+
2. Keep the workflow definition branch on `main`.
|
|
13
|
+
3. Enter the exact version tag required by `package.json`, for example `v1.2.0`.
|
|
14
|
+
4. Select `bootstrap` for `publish_mode`.
|
|
15
|
+
5. Run the workflow.
|
|
16
|
+
|
|
17
|
+
The tag may already exist. When it does, the workflow checks out that exact tag and verifies that it is reachable from `main`.
|
|
18
|
+
|
|
19
|
+
When the tag does not yet exist, a manual bootstrap run starts from the exact current `origin/main` commit, verifies the requested tag matches `v<package.json version>`, runs all tests, validates the release metadata and current Changelog entry, and only then creates and pushes the tag. Normal mode and tag-triggered runs are never allowed to create a missing tag.
|
|
20
|
+
|
|
21
|
+
Bootstrap mode is rejected when the npm package or exact version already exists. The token is exposed only to the guarded bootstrap step. Tag-triggered releases and manual runs in `normal` mode never receive `NPM_TOKEN`.
|
|
22
|
+
|
|
23
|
+
After the first version is published, configure Trusted Publishing as described below. Once a later release succeeds through OIDC, delete the `NPM_TOKEN` repository secret.
|
|
24
|
+
|
|
25
|
+
## npm Trusted Publishing setup
|
|
26
|
+
|
|
27
|
+
This one-time npm account configuration cannot be committed to the repository.
|
|
28
|
+
|
|
29
|
+
On the npm package settings page for `codex-model-router`, add a GitHub Actions trusted publisher with:
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
Organization or user: Honguan
|
|
33
|
+
Repository: codex-model-router
|
|
34
|
+
Workflow filename: release.yml
|
|
35
|
+
Environment: leave empty unless the workflow is updated to use one
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The same relationship can be configured by an authenticated maintainer with npm 11.15.0 or newer:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
npm trust github codex-model-router \
|
|
42
|
+
--repo Honguan/codex-model-router \
|
|
43
|
+
--file release.yml \
|
|
44
|
+
--allow-publish \
|
|
45
|
+
--yes
|
|
46
|
+
npm trust list codex-model-router
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Normal releases use only `contents: write` and `id-token: write` and publish with provenance.
|
|
50
|
+
|
|
51
|
+
## Release checklist
|
|
52
|
+
|
|
53
|
+
1. Verify all Issues and pull-request checks are complete.
|
|
54
|
+
2. Update `package.json`, `CHANGELOG.md`, README version examples, and the shared manifest behavior together.
|
|
55
|
+
3. Run `npm run check`, `npm test`, `npm run test:package`, and `npm pack --dry-run`.
|
|
56
|
+
4. Confirm CI passes on Windows, Linux, and macOS with Node.js 18, 20, 22, and 24.
|
|
57
|
+
5. Confirm actionlint and ShellCheck pass.
|
|
58
|
+
6. For normal releases, create and push the exact tag `v<package.json version>` from `main`.
|
|
59
|
+
7. For the first package publication only, the manual bootstrap flow may create the missing exact tag after all validations pass.
|
|
60
|
+
8. Verify the Release workflow publishes with npm provenance.
|
|
61
|
+
9. Verify the clean public npm end-to-end step passes before the GitHub Release appears.
|
|
62
|
+
10. Confirm `npm view codex-model-router version` and `npx --yes codex-model-router@<version> --version`.
|
|
63
|
+
|
|
64
|
+
## Manual release retry
|
|
65
|
+
|
|
66
|
+
Open **Actions → Release → Run workflow**, keep the workflow definition on `main`, and enter the exact version tag in the required `tag` field.
|
|
67
|
+
|
|
68
|
+
Select publication mode as follows:
|
|
69
|
+
|
|
70
|
+
- `bootstrap`: only for the first creation of the npm package; it may safely create the missing exact version tag from current `main` after validation.
|
|
71
|
+
- `normal`: every later version and every idempotent retry after the package exists; the tag must already exist.
|
|
72
|
+
|
|
73
|
+
The branch selector chooses which workflow definition to run; it is not the release target. For an existing tag, the workflow checks out that tag, verifies that its commit is reachable from `main`, validates that the tag matches `package.json`, and then resumes the npm and GitHub Release checks.
|
|
74
|
+
|
|
75
|
+
Never enter a branch name in the `tag` field. Never reuse a package version that already exists on npm. Never use bootstrap mode for later versions.
|
|
76
|
+
|
|
77
|
+
## Compatibility update checklist
|
|
78
|
+
|
|
79
|
+
For every release that changes generated paths, TOML fields, models, or Codex integration:
|
|
80
|
+
|
|
81
|
+
1. Review the official Codex subagent, skill, and configuration references.
|
|
82
|
+
2. Record the exact Codex CLI version used as the compatibility baseline.
|
|
83
|
+
3. Run the compatibility smoke check in CI.
|
|
84
|
+
4. Update README paths and minimum version claims.
|
|
85
|
+
5. Test project and global scope separately.
|
|
86
|
+
6. Preserve Windows junction, POSIX symlink, LF/CRLF, and user-modification tests.
|
|
87
|
+
|
|
88
|
+
## Recovery
|
|
89
|
+
|
|
90
|
+
A failed npm publication does not create a GitHub Release. For an unpublished package, verify the `NPM_TOKEN` bootstrap secret and run the exact version with `publish_mode=bootstrap`; the workflow can create the missing tag safely when necessary. For an existing package, fix the Trusted Publisher relationship and retry the existing exact tag with `publish_mode=normal`.
|
|
91
|
+
|
|
92
|
+
Delete or recreate a tag manually only when npm does not contain that version and the existing tag is demonstrably wrong. Published npm versions are immutable and must never be reused.
|
package/README.md
CHANGED
|
@@ -1,74 +1,140 @@
|
|
|
1
1
|
# codex-model-router
|
|
2
2
|
|
|
3
|
-
A small Node.js CLI that installs
|
|
3
|
+
A small Node.js CLI that safely installs advisory Codex subagent routing for Terra, Luna, and Sol without replacing unrelated user configuration.
|
|
4
4
|
|
|
5
|
-
Routing is advisory
|
|
5
|
+
> Routing is advisory. Terra reads the installed skill and decides when to delegate. This package does not intercept prompts or guarantee a hard model switch.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Compatibility
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- A current Codex release with custom agents and local skills
|
|
9
|
+
Compatibility was verified on 2026-07-31 against:
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
- Codex CLI `0.145.0` or newer
|
|
12
|
+
- Node.js 18, 20, 22, and 24
|
|
13
|
+
- Windows, Linux, and macOS GitHub-hosted runners
|
|
14
|
+
- Codex project agents in `.codex/agents/`
|
|
15
|
+
- Codex user agents in `$CODEX_HOME/agents/` or `~/.codex/agents/`
|
|
16
|
+
- project skills in `.agents/skills/`
|
|
17
|
+
- user skills in `~/.agents/skills/`
|
|
18
|
+
|
|
19
|
+
The selected Codex account must have access to `gpt-5.6-terra`, `gpt-5.6-luna`, and `gpt-5.6-sol`. Older Codex versions may not recognize the generated agent or skill files.
|
|
13
20
|
|
|
14
|
-
|
|
21
|
+
## Quick start
|
|
22
|
+
|
|
23
|
+
Preview a project installation without changing files:
|
|
15
24
|
|
|
16
25
|
```sh
|
|
17
|
-
npx codex-model-router install
|
|
26
|
+
npx codex-model-router install --set-default --dry-run
|
|
18
27
|
```
|
|
19
28
|
|
|
20
|
-
|
|
29
|
+
Install Terra/high as the project default, add Luna and Sol, then verify:
|
|
21
30
|
|
|
22
31
|
```sh
|
|
23
|
-
|
|
24
|
-
codex-model-router
|
|
32
|
+
npx codex-model-router install --set-default
|
|
33
|
+
npx codex-model-router doctor
|
|
25
34
|
```
|
|
26
35
|
|
|
27
|
-
|
|
36
|
+
Remove only unchanged package-managed settings and files:
|
|
28
37
|
|
|
29
38
|
```sh
|
|
30
|
-
codex-model-router
|
|
39
|
+
npx codex-model-router uninstall
|
|
31
40
|
```
|
|
32
41
|
|
|
33
|
-
|
|
42
|
+
## Install
|
|
43
|
+
|
|
44
|
+
Run directly from npm without installing the CLI globally:
|
|
34
45
|
|
|
35
46
|
```sh
|
|
36
|
-
codex-model-router install
|
|
47
|
+
npx codex-model-router install
|
|
37
48
|
```
|
|
38
49
|
|
|
39
|
-
|
|
50
|
+
Install the CLI command globally:
|
|
40
51
|
|
|
41
52
|
```sh
|
|
42
|
-
|
|
43
|
-
codex-model-router
|
|
53
|
+
npm install -g codex-model-router
|
|
54
|
+
codex-model-router install
|
|
44
55
|
```
|
|
45
56
|
|
|
46
|
-
|
|
57
|
+
Installing the CLI globally only makes the command available system-wide. It does not modify user-level Codex configuration. The separate `install --global` option applies routing to the current user's Codex configuration.
|
|
58
|
+
|
|
59
|
+
Install a specific GitHub release:
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
npm install -g https://github.com/Honguan/codex-model-router/archive/refs/tags/v1.2.0.tar.gz
|
|
63
|
+
codex-model-router install
|
|
64
|
+
```
|
|
47
65
|
|
|
48
|
-
Project
|
|
66
|
+
## Project and global scope
|
|
67
|
+
|
|
68
|
+
Project scope is the default:
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
codex-model-router install
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
It manages only:
|
|
49
75
|
|
|
50
76
|
```text
|
|
51
77
|
.codex/config.toml
|
|
52
78
|
.codex/agents/luna.toml
|
|
53
79
|
.codex/agents/sol.toml
|
|
80
|
+
.codex/model-router-state.json
|
|
81
|
+
.codex/config.toml.codex-model-router.bak # only when needed
|
|
54
82
|
.agents/skills/model-router/SKILL.md
|
|
55
83
|
```
|
|
56
84
|
|
|
57
|
-
|
|
85
|
+
During a mutating operation it may temporarily create:
|
|
86
|
+
|
|
87
|
+
```text
|
|
88
|
+
.codex/model-router.lock
|
|
89
|
+
.codex/model-router-transaction.json
|
|
90
|
+
.codex/model-router-transaction-data/
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
These transient files are removed after a successful operation or safe recovery.
|
|
94
|
+
|
|
95
|
+
Use global scope only when the routing configuration should apply to every Codex project for the current user:
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
codex-model-router install --global
|
|
99
|
+
codex-model-router doctor --global
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Global scope manages the equivalent paths under `$CODEX_HOME` and stores the skill under `~/.agents/skills/model-router/`. When `CODEX_HOME` is unset, it defaults to `~/.codex`.
|
|
103
|
+
|
|
104
|
+
## Existing settings
|
|
105
|
+
|
|
106
|
+
A normal install adds Terra/high only when the top-level values are absent. Existing model values are preserved:
|
|
107
|
+
|
|
108
|
+
```sh
|
|
109
|
+
codex-model-router install
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
To explicitly set and track Terra/high:
|
|
58
113
|
|
|
59
|
-
|
|
114
|
+
```sh
|
|
115
|
+
codex-model-router install --set-default
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`--set-default` changes only:
|
|
60
119
|
|
|
61
|
-
|
|
120
|
+
```toml
|
|
121
|
+
model = "gpt-5.6-terra"
|
|
122
|
+
model_reasoning_effort = "high"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
The exact prior values are recorded. Uninstall restores them only while the current values still match what the package installed. Later user edits are preserved and reported instead of overwritten.
|
|
126
|
+
|
|
127
|
+
Existing Luna, Sol, or skill files are never overwritten. Unrelated TOML settings, comments, BOM, ordering, and LF/CRLF line endings are preserved.
|
|
62
128
|
|
|
63
129
|
## Installed routing
|
|
64
130
|
|
|
65
|
-
- Terra/high
|
|
66
|
-
- Luna/high
|
|
67
|
-
- Sol/medium/workspace-write
|
|
68
|
-
- Sol normally reviews first
|
|
69
|
-
- Simple questions do not spawn a subagent
|
|
131
|
+
- Terra/high handles normal questions, coding, debugging, fixes, tests, and implementation.
|
|
132
|
+
- Luna/high handles deterministic repeated edits, bulk patterns, searches, formatting, counting, extraction, and summaries.
|
|
133
|
+
- Sol/medium/workspace-write handles security-sensitive or high-regression-risk review and implementation.
|
|
134
|
+
- Sol normally reviews first and may edit files only when Terra explicitly delegates implementation or a confirmed fix.
|
|
135
|
+
- Simple questions do not spawn a subagent.
|
|
70
136
|
|
|
71
|
-
Users may edit model names, reasoning levels, and `sandbox_mode` directly in the generated TOML files. Later installs preserve
|
|
137
|
+
Users may edit model names, reasoning levels, and `sandbox_mode` directly in the generated TOML files. Later installs preserve manual edits, and `doctor` reports changed managed files.
|
|
72
138
|
|
|
73
139
|
## Commands
|
|
74
140
|
|
|
@@ -79,78 +145,78 @@ codex-model-router doctor [--global]
|
|
|
79
145
|
codex-model-router --version
|
|
80
146
|
```
|
|
81
147
|
|
|
82
|
-
`doctor` is read-only. Exit code `0` means healthy; exit code `1`
|
|
148
|
+
`doctor` is read-only. Exit code `0` means healthy; exit code `1` means action is required.
|
|
83
149
|
|
|
84
|
-
|
|
150
|
+
Common statuses:
|
|
85
151
|
|
|
86
|
-
|
|
152
|
+
- `healthy`: the managed item matches its expected state.
|
|
153
|
+
- `preserve` or `user-modified`: user content was detected and left unchanged.
|
|
154
|
+
- `missing` or `invalid`: a required item is absent or malformed.
|
|
155
|
+
- `unsafe-state`: state paths or path components are unsafe.
|
|
156
|
+
- `locked` or `stale-lock`: another operation is active or a previous process ended unexpectedly.
|
|
157
|
+
- `unfinished`, `recoverable`, `conflicting`, or `corrupt`: an interrupted transaction needs attention.
|
|
87
158
|
|
|
88
|
-
|
|
89
|
-
Repository Settings
|
|
90
|
-
→ Secrets and variables
|
|
91
|
-
→ Actions
|
|
92
|
-
→ New repository secret
|
|
93
|
-
```
|
|
159
|
+
## Safety behavior
|
|
94
160
|
|
|
95
|
-
|
|
161
|
+
- Rejects malformed, non-UTF-8, duplicate, or unsafe configuration before writing.
|
|
162
|
+
- Rejects symlinks and Windows junctions in managed paths so writes cannot escape the selected scope.
|
|
163
|
+
- Uses a scope-level process lock to prevent concurrent install/uninstall races.
|
|
164
|
+
- Uses an atomic transaction journal and private snapshots to recover interrupted multi-file operations.
|
|
165
|
+
- Never overwrites post-interruption user changes during recovery.
|
|
166
|
+
- Uses atomic file replacement and rollback for handled failures.
|
|
167
|
+
- Removes or restores only unchanged package-managed content.
|
|
168
|
+
- Never modifies `AGENTS.md`, shell profiles, editor settings, hooks, MCP servers, telemetry, accounts, or environment variables.
|
|
169
|
+
- Dry-run creates no files, directories, backups, locks, journals, or state.
|
|
170
|
+
- Tests use temporary directories and never touch real Codex configuration.
|
|
96
171
|
|
|
97
|
-
|
|
172
|
+
## Troubleshooting
|
|
98
173
|
|
|
99
|
-
|
|
100
|
-
2. Reads the name and version from `package.json`.
|
|
101
|
-
3. Creates the matching GitHub release when missing.
|
|
102
|
-
4. Checks whether that exact version already exists on npm.
|
|
103
|
-
5. Publishes only a version that is not already present.
|
|
174
|
+
### Agents or skills do not appear
|
|
104
175
|
|
|
105
|
-
|
|
176
|
+
Restart Codex after installation. Verify the selected scope with `doctor` or `doctor --global`, and confirm that your Codex version is at least the compatibility baseline above.
|
|
106
177
|
|
|
107
|
-
|
|
178
|
+
### `user-modified`
|
|
108
179
|
|
|
109
|
-
|
|
180
|
+
The file or setting was changed after installation. The CLI intentionally leaves it untouched. Review the reported path and decide manually whether to retain the custom value or reinstall the package template under a different name.
|
|
110
181
|
|
|
111
|
-
|
|
182
|
+
### `unsafe-state` or unsafe path component
|
|
112
183
|
|
|
113
|
-
|
|
184
|
+
Do not delete the reported file blindly. Check whether `.codex`, `.agents`, `CODEX_HOME`, or one of their parent directories is a symlink or Windows junction. Use a normal directory inside the intended project or user scope.
|
|
114
185
|
|
|
115
|
-
|
|
116
|
-
npm view codex-model-router
|
|
117
|
-
npm login
|
|
118
|
-
npm whoami
|
|
119
|
-
```
|
|
186
|
+
### Active or stale lock
|
|
120
187
|
|
|
121
|
-
|
|
188
|
+
An active lock includes the operation and process ID. Wait for that process to finish. A later mutating command automatically removes a stale lock only when the recorded local process is no longer alive. A corrupt or remote-host lock must be inspected manually before removal.
|
|
122
189
|
|
|
123
|
-
|
|
124
|
-
npm run check
|
|
125
|
-
npm test
|
|
126
|
-
npm run test:package
|
|
127
|
-
npm pack --dry-run
|
|
128
|
-
npm publish --dry-run
|
|
129
|
-
```
|
|
190
|
+
### Interrupted transaction
|
|
130
191
|
|
|
131
|
-
|
|
192
|
+
Run `doctor` first. A mutating command automatically rolls back `unfinished` or `recoverable` transactions when all hashes still match. `conflicting` means a managed file changed after interruption; preserve that file and resolve the journal manually rather than forcing an overwrite. `corrupt` means the journal or snapshot cannot be trusted.
|
|
132
193
|
|
|
133
|
-
|
|
134
|
-
npm publish
|
|
135
|
-
```
|
|
194
|
+
### Untracked backup already exists
|
|
136
195
|
|
|
137
|
-
|
|
196
|
+
The CLI refuses to replace `config.toml.codex-model-router.bak`. Compare it with `config.toml`, move it to a clearly named safe location, and retry only after confirming its ownership.
|
|
197
|
+
|
|
198
|
+
### Permission or `CODEX_HOME` errors
|
|
199
|
+
|
|
200
|
+
For project scope, verify write access to the project. For global scope, print and verify `CODEX_HOME`; do not run with elevated privileges merely to bypass an unexplained path error.
|
|
201
|
+
|
|
202
|
+
### Manual backup recovery
|
|
203
|
+
|
|
204
|
+
The managed `.bak` is the exact pre-change configuration. Before restoring it, stop Codex, preserve the current `config.toml` under a new name, verify both files, and restore only within the same project/global scope.
|
|
205
|
+
|
|
206
|
+
### npx uses an old version
|
|
207
|
+
|
|
208
|
+
Request the exact version first:
|
|
138
209
|
|
|
139
210
|
```sh
|
|
140
|
-
|
|
141
|
-
npx codex-model-router --version
|
|
211
|
+
npx --yes codex-model-router@1.2.0 --version
|
|
142
212
|
```
|
|
143
213
|
|
|
144
|
-
|
|
214
|
+
When necessary, inspect the npm cache with `npm cache verify`; avoid deleting unrelated cache directories blindly.
|
|
145
215
|
|
|
146
|
-
##
|
|
216
|
+
## Security and release integrity
|
|
147
217
|
|
|
148
|
-
|
|
149
|
-
- Uses atomic file replacement and rolls back failed multi-file upgrades where possible
|
|
150
|
-
- Stores a small package-owned state file and one backup only when an existing config is changed
|
|
151
|
-
- Never modifies `AGENTS.md`, shell profiles, editor settings, hooks, MCP servers, telemetry, or environment variables
|
|
152
|
-
- Dry-run creates no files, directories, backups, or temporary state
|
|
218
|
+
Security vulnerabilities should be reported privately according to [SECURITY.md](SECURITY.md).
|
|
153
219
|
|
|
154
|
-
|
|
220
|
+
Releases use npm Trusted Publishing through GitHub Actions, verified provenance, exact tag/version validation, current-version-only release notes, workflow linting, and a clean public-registry end-to-end install/doctor/uninstall check before the GitHub Release is created. Maintainer setup and release steps are documented in [MAINTAINERS.md](MAINTAINERS.md).
|
|
155
221
|
|
|
156
222
|
Codex references: [Subagents](https://developers.openai.com/codex/subagents), [Build skills](https://developers.openai.com/codex/build-skills), and [Configuration reference](https://developers.openai.com/codex/config-reference).
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported versions
|
|
4
|
+
|
|
5
|
+
Only the latest stable release receives security fixes.
|
|
6
|
+
|
|
7
|
+
## Reporting a vulnerability
|
|
8
|
+
|
|
9
|
+
Do not report security vulnerabilities through a public Issue.
|
|
10
|
+
|
|
11
|
+
Use GitHub's private security advisory feature for this repository and include:
|
|
12
|
+
|
|
13
|
+
- affected version and operating system
|
|
14
|
+
- selected project or global scope
|
|
15
|
+
- minimal reproduction steps
|
|
16
|
+
- files or paths affected
|
|
17
|
+
- expected and observed behavior
|
|
18
|
+
|
|
19
|
+
Do not include npm tokens, OpenAI credentials, private Codex configuration, or unrelated project source code.
|
|
20
|
+
|
|
21
|
+
Reports involving path escape, unsafe uninstall, transaction recovery, release provenance, or package publication are treated as security-sensitive.
|
package/lib/manifest.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
const packageJson = require("../package.json");
|
|
5
|
+
|
|
6
|
+
export const VERSION = packageJson.version;
|
|
7
|
+
|
|
8
|
+
export const DEFAULTS = Object.freeze({
|
|
9
|
+
model: "gpt-5.6-terra",
|
|
10
|
+
model_reasoning_effort: "high"
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const luna = `name = "luna"
|
|
14
|
+
description = "Low-risk helper for repeated edits, searches, formatting, extraction, counting, and summaries."
|
|
15
|
+
model = "gpt-5.6-luna"
|
|
16
|
+
model_reasoning_effort = "high"
|
|
17
|
+
developer_instructions = """
|
|
18
|
+
Handle only deterministic, low-risk work delegated by Terra.
|
|
19
|
+
Follow the assigned pattern exactly and return a concise result.
|
|
20
|
+
Escalate ambiguous, security-sensitive, or logic-heavy decisions to Terra.
|
|
21
|
+
"""
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
const sol = `name = "sol"
|
|
25
|
+
description = "High-capability specialist for security-sensitive or high-regression-risk work."
|
|
26
|
+
model = "gpt-5.6-sol"
|
|
27
|
+
model_reasoning_effort = "medium"
|
|
28
|
+
sandbox_mode = "workspace-write"
|
|
29
|
+
developer_instructions = """
|
|
30
|
+
Review or implement only when explicitly delegated by Terra.
|
|
31
|
+
For review-only tasks, report concrete findings without changing files.
|
|
32
|
+
For implementation tasks, make focused changes, run relevant checks, and report the result to Terra.
|
|
33
|
+
Focus on security, authentication, permissions, secrets, destructive actions, financial logic, SQL writes, concurrency, complex state, and regression risk.
|
|
34
|
+
Do not expand the scope beyond the delegated task.
|
|
35
|
+
"""
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
const skill = `---
|
|
39
|
+
name: model-router
|
|
40
|
+
description: Route Codex work between Terra, Luna, and Sol with the fewest required agents.
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
Terra handles ordinary questions, coding, debugging, fixes, testing, and implementation. Never create a Terra subagent.
|
|
44
|
+
Use Luna only for deterministic low-risk repeated edits, bulk patterns, read-heavy searches, formatting, counting, extraction, or summaries; prefer Luna when the same clear operation repeats at least three times.
|
|
45
|
+
Use Sol for security, authentication, authorization, permissions, secrets, destructive actions, financial logic, SQL writes, concurrency, complex state changes, high-regression-risk logic, or an explicit review. Prefer review-only delegation first; when implementation or a confirmed fix is explicitly required, Sol may edit files in workspace-write mode and run relevant checks.
|
|
46
|
+
Do not spawn a subagent for a simple question. Use the minimum number of agents and run Luna with Sol only when both independent tasks are required.
|
|
47
|
+
`;
|
|
48
|
+
|
|
49
|
+
export const TEMPLATES = Object.freeze({
|
|
50
|
+
luna: Object.freeze({ relative: ["agents", "luna.toml"], content: luna }),
|
|
51
|
+
sol: Object.freeze({ relative: ["agents", "sol.toml"], content: sol }),
|
|
52
|
+
skill: Object.freeze({ content: skill })
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const legacySolReadOnly = `name = "sol"
|
|
56
|
+
description = "Read-only reviewer for security-sensitive or high-regression-risk logic."
|
|
57
|
+
model = "gpt-5.6-sol"
|
|
58
|
+
model_reasoning_effort = "medium"
|
|
59
|
+
sandbox_mode = "read-only"
|
|
60
|
+
developer_instructions = """
|
|
61
|
+
Review only. Focus on security, authentication, permissions, secrets, destructive actions, financial logic, SQL writes, concurrency, complex state, and regression risk.
|
|
62
|
+
Report concrete findings to Terra; do not apply fixes.
|
|
63
|
+
"""
|
|
64
|
+
`;
|
|
65
|
+
|
|
66
|
+
const legacySkillReadOnly = `---
|
|
67
|
+
name: model-router
|
|
68
|
+
description: Route Codex work between Terra, Luna, and Sol with the fewest required agents.
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
Terra handles ordinary questions, coding, debugging, fixes, testing, and implementation. Never create a Terra subagent.
|
|
72
|
+
Use Luna only for deterministic low-risk repeated edits, bulk patterns, read-heavy searches, formatting, counting, extraction, or summaries; prefer Luna when the same clear operation repeats at least three times.
|
|
73
|
+
Use Sol only as a read-only reviewer for security, authentication, authorization, permissions, secrets, destructive actions, financial logic, SQL writes, concurrency, complex state changes, high-regression-risk logic, or an explicit review. Terra applies fixes.
|
|
74
|
+
Do not spawn a subagent for a simple question. Use the minimum number of agents and run Luna with Sol only when both independent tasks are required.
|
|
75
|
+
`;
|
|
76
|
+
|
|
77
|
+
export const LEGACY_TEMPLATES = Object.freeze({
|
|
78
|
+
luna: Object.freeze([]),
|
|
79
|
+
sol: Object.freeze([legacySolReadOnly]),
|
|
80
|
+
skill: Object.freeze([legacySkillReadOnly])
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export const AGENT_EXPECTATIONS = Object.freeze({
|
|
84
|
+
luna: Object.freeze({
|
|
85
|
+
name: "luna",
|
|
86
|
+
model: "gpt-5.6-luna",
|
|
87
|
+
model_reasoning_effort: "high"
|
|
88
|
+
}),
|
|
89
|
+
sol: Object.freeze({
|
|
90
|
+
name: "sol",
|
|
91
|
+
model: "gpt-5.6-sol",
|
|
92
|
+
model_reasoning_effort: "medium",
|
|
93
|
+
sandbox_mode: "workspace-write"
|
|
94
|
+
})
|
|
95
|
+
});
|