ultracode-for-codex 0.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/README.md +182 -0
- package/ULTRACODE_INSTALL.md +133 -0
- package/dist/cli.d.ts +24 -0
- package/dist/cli.js +616 -0
- package/dist/codex/env.d.ts +2 -0
- package/dist/codex/env.js +45 -0
- package/dist/codex/subagent-backend.d.ts +72 -0
- package/dist/codex/subagent-backend.js +685 -0
- package/dist/runtime/async-queue.d.ts +10 -0
- package/dist/runtime/async-queue.js +55 -0
- package/dist/runtime/types.d.ts +61 -0
- package/dist/runtime/types.js +18 -0
- package/dist/runtime/workflow-journal.d.ts +135 -0
- package/dist/runtime/workflow-journal.js +681 -0
- package/dist/runtime/workflow-runtime.d.ts +266 -0
- package/dist/runtime/workflow-runtime.js +3280 -0
- package/dist/settings.d.ts +38 -0
- package/dist/settings.js +153 -0
- package/dist/ultracode-install-guide.d.ts +4 -0
- package/dist/ultracode-install-guide.js +22 -0
- package/docs/ultracode-p3a-journal-design.md +78 -0
- package/docs/ultracode-p3b-resume-cache.md +43 -0
- package/docs/ultracode-p3c-worktree-isolation.md +60 -0
- package/package.json +77 -0
- package/postinstall.mjs +23 -0
- package/settings.json +20 -0
- package/skills/ultracode-for-codex/SKILL.md +102 -0
- package/skills/ultracode-for-codex/agents/openai.yaml +4 -0
package/README.md
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Ultracode for Codex
|
|
2
|
+
|
|
3
|
+
Ultracode for Codex runs local workflows as CLI commands backed by an
|
|
4
|
+
already-authenticated Codex CLI session. Progress streams to stderr as JSONL by
|
|
5
|
+
default, the final result prints to stdout as JSON, and cancellation/retry stay
|
|
6
|
+
inside the same command process.
|
|
7
|
+
The packaged `settings.json` defaults workflow runs to OS background execution
|
|
8
|
+
with result and progress files under `.ultracode-for-codex/background/{jobId}`.
|
|
9
|
+
|
|
10
|
+
## Quick Start
|
|
11
|
+
|
|
12
|
+
Install from npm:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install --save-dev ultracode-for-codex
|
|
16
|
+
npm exec -- ultracode-for-codex --llm-guide
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Build and verify a local installable tarball from a source checkout:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install
|
|
23
|
+
npm run pack:ultracode-for-codex
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Install the tarball from a target project:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install --save-dev /path/to/ultracode-for-codex-0.2.0.tgz
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Run a workflow:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm exec -- ultracode-for-codex run \
|
|
36
|
+
--accept-llm-guide=v1 \
|
|
37
|
+
--cwd /path/to/target-repo \
|
|
38
|
+
--script-file .codex/workflows/review.js \
|
|
39
|
+
--args '{"prompt":"review the current change"}'
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
By default this prints a background launch record to stdout. The record contains
|
|
43
|
+
`jobId`, `pid`, `resultPath`, `progressPath`, `metadataPath`, and `pidPath`.
|
|
44
|
+
|
|
45
|
+
Run attached to the current terminal:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm exec -- ultracode-for-codex run \
|
|
49
|
+
--accept-llm-guide=v1 \
|
|
50
|
+
--execution attached \
|
|
51
|
+
--cwd /path/to/target-repo \
|
|
52
|
+
--script-file .codex/workflows/review.js \
|
|
53
|
+
--args '{"prompt":"review the current change"}'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Named workflows are resolved from `.codex/workflows`, user workflow folders,
|
|
57
|
+
plugin workflow folders, and built-ins:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm exec -- ultracode-for-codex run \
|
|
61
|
+
--accept-llm-guide=v1 \
|
|
62
|
+
--cwd /path/to/target-repo \
|
|
63
|
+
--name code-review \
|
|
64
|
+
--args '{"prompt":"review correctness risks"}'
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Settings
|
|
68
|
+
|
|
69
|
+
Package defaults live in `settings.json`:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"workflow": {
|
|
74
|
+
"executionMode": "background",
|
|
75
|
+
"progress": "jsonl",
|
|
76
|
+
"permission": "ask",
|
|
77
|
+
"retryLimit": 0,
|
|
78
|
+
"timeoutMs": 180000,
|
|
79
|
+
"background": {
|
|
80
|
+
"runDir": ".ultracode-for-codex/background/{jobId}",
|
|
81
|
+
"resultFile": "result.json",
|
|
82
|
+
"progressFile": "progress.jsonl",
|
|
83
|
+
"metadataFile": "metadata.json",
|
|
84
|
+
"pidFile": "pid"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Use `--execution attached`, `--progress`, `--permission`, `--retry-limit`, and
|
|
91
|
+
`--timeout-ms` to override settings for one run.
|
|
92
|
+
|
|
93
|
+
## CLI Controls
|
|
94
|
+
|
|
95
|
+
- Progress is printed to stderr as JSONL by default.
|
|
96
|
+
- The final workflow result is printed as JSON to stdout.
|
|
97
|
+
- JSONL records include `kind`, `version`, `event`, `status`, and `summary`;
|
|
98
|
+
agent records also include stable agent identity and label fields.
|
|
99
|
+
- Press `Ctrl-C` once to cancel the active workflow.
|
|
100
|
+
- Use `--retry-limit <n>` to retry failed workflows inside the same process.
|
|
101
|
+
- Use `--permission ask|allow|deny` for project/user/plugin/scriptPath workflow
|
|
102
|
+
permission reviews.
|
|
103
|
+
- Use `--progress plain` for human-readable log lines.
|
|
104
|
+
- Use `--execution background` for OS background runs and `--execution attached`
|
|
105
|
+
when Codex should read progress until completion.
|
|
106
|
+
|
|
107
|
+
## Codex Companion Skill
|
|
108
|
+
|
|
109
|
+
The npm package is the runtime artifact. The companion Codex skill in
|
|
110
|
+
`skills/ultracode-for-codex` is a lightweight operating guide for agents using
|
|
111
|
+
the package; it contains no runtime code.
|
|
112
|
+
|
|
113
|
+
Install or copy that folder into `${CODEX_HOME:-$HOME/.codex}/skills` when you
|
|
114
|
+
want Codex to auto-load the package boundaries and verification routine.
|
|
115
|
+
|
|
116
|
+
## Runtime Boundaries
|
|
117
|
+
|
|
118
|
+
- The only production backend is Codex app-server over stdio.
|
|
119
|
+
- Direct provider credentials are stripped from the Codex child process
|
|
120
|
+
environment.
|
|
121
|
+
- Workflow execution is local and command-owned; settings default to OS
|
|
122
|
+
background execution and `--execution attached` keeps the process connected
|
|
123
|
+
until completion.
|
|
124
|
+
- `.ultracode-for-codex` workflow state is sensitive local data.
|
|
125
|
+
- `journalPath`, `journal.jsonl`, and journal contents stay out of CLI output.
|
|
126
|
+
Local runtime state may still contain runtime-owned
|
|
127
|
+
`transcriptDir`, `scriptPath`, and result files.
|
|
128
|
+
- `resumeFromRunId` remains runtime-internal and same-session; users retry the
|
|
129
|
+
active run or rerun the workflow command.
|
|
130
|
+
- `agent(..., { isolation: "worktree" })` runs the agent in a detached git
|
|
131
|
+
worktree, removes it when clean, and preserves changed or unsafe-to-clean
|
|
132
|
+
worktrees for review.
|
|
133
|
+
|
|
134
|
+
## Development
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
npm install
|
|
138
|
+
npm test
|
|
139
|
+
npm run pack:ultracode-for-codex
|
|
140
|
+
npm run test:e2e:ultracode-for-codex
|
|
141
|
+
npm run test:all
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Publishing
|
|
145
|
+
|
|
146
|
+
The npm package name is `ultracode-for-codex`. Public publish metadata lives in
|
|
147
|
+
`package.json`, and `prepublishOnly` runs the full verification suite before
|
|
148
|
+
`npm publish`.
|
|
149
|
+
|
|
150
|
+
Check the package before publishing:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npm run publish:dry-run
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Publish after `npm login`:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
npm run publish:npm
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
For supported CI/CD environments, provenance is available as an explicit opt-in:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
npm run publish:npm:provenance
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Useful local run:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
npm run build
|
|
172
|
+
node dist/cli.js run --accept-llm-guide=v1 --script-file ./workflow.js
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Docs
|
|
176
|
+
|
|
177
|
+
- `skills/ultracode-for-codex/SKILL.md`: Codex companion skill for operating
|
|
178
|
+
the npm runtime safely.
|
|
179
|
+
- `ULTRACODE_INSTALL.md`: install and operating guide for LLM agents.
|
|
180
|
+
- `docs/ultracode-p3a-journal-design.md`: journal contract.
|
|
181
|
+
- `docs/ultracode-p3b-resume-cache.md`: runtime-internal resume/cache contract.
|
|
182
|
+
- `docs/ultracode-p3c-worktree-isolation.md`: worktree isolation contract.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Ultracode install and usage guide
|
|
2
|
+
|
|
3
|
+
This file is for LLM agents installing or operating `ultracode-for-codex`.
|
|
4
|
+
Read it before running workflows or generating integration code.
|
|
5
|
+
|
|
6
|
+
## What This Package Does
|
|
7
|
+
|
|
8
|
+
`ultracode-for-codex` provides a local command-owned workflow runtime backed by an
|
|
9
|
+
already-authenticated Codex CLI session. The packaged `settings.json` defaults
|
|
10
|
+
workflow runs to OS background execution with result and progress files under
|
|
11
|
+
`.ultracode-for-codex/background/{jobId}`.
|
|
12
|
+
|
|
13
|
+
Production surface:
|
|
14
|
+
|
|
15
|
+
- `ultracode-for-codex run`
|
|
16
|
+
|
|
17
|
+
Progress, cancellation, permission review, retry, and final result projection
|
|
18
|
+
are handled inside the CLI process. Progress is JSONL on stderr by
|
|
19
|
+
default so Codex can parse and summarize workflow state.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
Use the npm package for consumer installs.
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install --save-dev ultracode-for-codex
|
|
27
|
+
npm exec -- ultracode-for-codex --help
|
|
28
|
+
npm exec -- ultracode-for-codex --llm-guide
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
For source-checkout validation, install the generated tarball instead:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install --save-dev ./ultracode-for-codex-0.2.0.tgz
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Optional Codex companion skill:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
mkdir -p "${CODEX_HOME:-$HOME/.codex}/skills"
|
|
41
|
+
cp -R ./node_modules/ultracode-for-codex/skills/ultracode-for-codex \
|
|
42
|
+
"${CODEX_HOME:-$HOME/.codex}/skills/"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The skill is only an operating guide. The npm package remains the runtime
|
|
46
|
+
artifact.
|
|
47
|
+
|
|
48
|
+
## Run
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm exec -- ultracode-for-codex run \
|
|
52
|
+
--accept-llm-guide=v1 \
|
|
53
|
+
--cwd /path/to/project \
|
|
54
|
+
--script-file .codex/workflows/review.js \
|
|
55
|
+
--args '{"prompt":"review the current change"}'
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The default run prints a background launch record to stdout. Use
|
|
59
|
+
`--execution attached` when Codex should read progress until completion.
|
|
60
|
+
|
|
61
|
+
Settings defaults:
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"workflow": {
|
|
66
|
+
"executionMode": "background",
|
|
67
|
+
"progress": "jsonl",
|
|
68
|
+
"permission": "ask",
|
|
69
|
+
"retryLimit": 0,
|
|
70
|
+
"timeoutMs": 180000,
|
|
71
|
+
"background": {
|
|
72
|
+
"runDir": ".ultracode-for-codex/background/{jobId}",
|
|
73
|
+
"resultFile": "result.json",
|
|
74
|
+
"progressFile": "progress.jsonl",
|
|
75
|
+
"metadataFile": "metadata.json",
|
|
76
|
+
"pidFile": "pid"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Useful controls:
|
|
83
|
+
|
|
84
|
+
- Progress events are printed to stderr as JSONL by default.
|
|
85
|
+
- The final workflow result is printed as JSON to stdout.
|
|
86
|
+
- JSONL records include `kind`, `version`, `event`, `status`, and `summary`;
|
|
87
|
+
agent records also include stable agent identity and label fields.
|
|
88
|
+
- Press `Ctrl-C` once to cancel the running workflow.
|
|
89
|
+
- Use `--retry-limit <n>` to retry failed runs in the same process.
|
|
90
|
+
- Use `--permission ask|allow|deny` for project/user/plugin/scriptPath
|
|
91
|
+
workflow permission reviews.
|
|
92
|
+
- Use `--progress plain` for human-readable log lines.
|
|
93
|
+
- Use `--execution background` for OS background runs and `--execution attached`
|
|
94
|
+
for current-terminal progress streaming.
|
|
95
|
+
|
|
96
|
+
## Runtime Contract
|
|
97
|
+
|
|
98
|
+
- Use Codex app-server over stdio as the production backend.
|
|
99
|
+
- Keep workflow execution local and command-owned; settings default to OS
|
|
100
|
+
background execution and `--execution attached` keeps the process connected
|
|
101
|
+
until completion.
|
|
102
|
+
- Route progress, cancellation, permission review, retry, and result projection
|
|
103
|
+
through the CLI command.
|
|
104
|
+
- Keep stdout reserved for the final JSON result; stream progress records to
|
|
105
|
+
stderr as JSONL unless a human chooses `--progress plain`.
|
|
106
|
+
- Strip direct provider credentials from child CLI environments.
|
|
107
|
+
- Install consumers from a packaged artifact.
|
|
108
|
+
- Keep `journalPath`, `journal.jsonl`, and journal contents out of CLI output.
|
|
109
|
+
Local runtime state may still contain runtime-owned
|
|
110
|
+
`transcriptDir`, `scriptPath`, and result files.
|
|
111
|
+
- `resumeFromRunId` remains a runtime-internal same-session capability; the
|
|
112
|
+
CLI uses retry or explicit reruns for user-facing recovery.
|
|
113
|
+
- Use `isolation: "worktree"` only in git repositories with at least one commit.
|
|
114
|
+
Changed or unsafe-to-clean worktrees are intentionally preserved for review.
|
|
115
|
+
- Treat `.ultracode-for-codex` workflow state as sensitive local data.
|
|
116
|
+
|
|
117
|
+
## First Checks After Install
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npm exec -- ultracode-for-codex --help
|
|
121
|
+
npm exec -- ultracode-for-codex --llm-guide
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
If this guide is missing, treat the package as invalid. If `run` is used without
|
|
125
|
+
`--accept-llm-guide=v1`, the CLI prints this guide and exits before executing a
|
|
126
|
+
workflow.
|
|
127
|
+
|
|
128
|
+
## Documentation Map
|
|
129
|
+
|
|
130
|
+
- `README.md`: human quickstart and common examples.
|
|
131
|
+
- `docs/ultracode-p3a-journal-design.md`: implemented journal contract.
|
|
132
|
+
- `docs/ultracode-p3b-resume-cache.md`: runtime-internal resume/cache contract.
|
|
133
|
+
- `docs/ultracode-p3c-worktree-isolation.md`: worktree isolation contract.
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export type { WorkflowAgentPreservedWorktree, WorkflowEvent, WorkflowLaunchInput, WorkflowLaunchResult, WorkflowPermissionReview, WorkflowTaskSnapshot, WorkflowTaskStatus, WorkflowTaskType, } from './runtime/workflow-runtime.js';
|
|
3
|
+
interface ParsedOptions {
|
|
4
|
+
readonly _: string[];
|
|
5
|
+
readonly args?: string;
|
|
6
|
+
readonly argsFile?: string;
|
|
7
|
+
readonly command?: string;
|
|
8
|
+
readonly model?: string;
|
|
9
|
+
readonly timeoutMs?: string;
|
|
10
|
+
readonly cwd?: string;
|
|
11
|
+
readonly execution?: string;
|
|
12
|
+
readonly reasoningEffort?: string;
|
|
13
|
+
readonly verbosity?: string;
|
|
14
|
+
readonly progress?: string;
|
|
15
|
+
readonly acceptLlmGuide?: string;
|
|
16
|
+
readonly script?: string;
|
|
17
|
+
readonly scriptFile?: string;
|
|
18
|
+
readonly scriptPath?: string;
|
|
19
|
+
readonly name?: string;
|
|
20
|
+
readonly resumeFromRunId?: string;
|
|
21
|
+
readonly permission?: string;
|
|
22
|
+
readonly retryLimit?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function parseOptions(args: readonly string[]): ParsedOptions;
|