supertag-ai 0.2.0-alpha.4 → 0.2.0-alpha.6
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 +155 -94
- package/dist/chunk-33IFPHXE.js +136 -0
- package/dist/chunk-33IFPHXE.js.map +1 -0
- package/dist/{chunk-YJCJLNXV.js → chunk-CUH5CP7W.js} +34 -50
- package/dist/chunk-CUH5CP7W.js.map +1 -0
- package/dist/chunk-PEGY7YJA.js +84 -0
- package/dist/chunk-PEGY7YJA.js.map +1 -0
- package/dist/{chunk-KUH6RQAM.js → chunk-WGPRACJB.js} +48 -41
- package/dist/chunk-WGPRACJB.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/docs/guides/coding-agent-operator.md +14 -7
- package/dist/docs/guides/custom-workers.md +3 -3
- package/dist/docs/guides/modal-workers.md +3 -4
- package/dist/docs/guides/python-workers.md +11 -12
- package/dist/docs/guides/self-hosting.md +2 -2
- package/dist/docs/guides/troubleshooting.md +18 -0
- package/dist/docs/operations/install.md +89 -29
- package/dist/docs/operations/requirements.md +17 -15
- package/dist/docs/reference/control-plane-api.md +2 -2
- package/dist/harnesses/claude-code.d.ts +11 -1
- package/dist/harnesses/claude-code.js +2 -1
- package/dist/harnesses/codex.d.ts +11 -4
- package/dist/harnesses/codex.js +2 -1
- package/dist/harnesses-4UPB47DO.js +5 -0
- package/dist/harnesses-4UPB47DO.js.map +1 -0
- package/dist/src-2PGBHIMD.js +9 -0
- package/dist/{src-25NGYB52.js.map → src-2PGBHIMD.js.map} +1 -1
- package/dist/src-JYMWKZIE.js +8 -0
- package/dist/src-JYMWKZIE.js.map +1 -0
- package/dist/{src-IM5LBBN7.js → src-OUTXJBMT.js} +45 -126
- package/dist/src-OUTXJBMT.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-KUH6RQAM.js.map +0 -1
- package/dist/chunk-YJCJLNXV.js.map +0 -1
- package/dist/src-25NGYB52.js +0 -7
- package/dist/src-IM5LBBN7.js.map +0 -1
- package/dist/src-OSKS5ATA.js +0 -8
- package/dist/src-OSKS5ATA.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,34 +1,114 @@
|
|
|
1
1
|
# supertag-ai
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
outcomes instead of tasks, and an AI engineering team delivers them.
|
|
3
|
+
**Define outcomes, not tasks. An AI engineering team delivers them.**
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
SuperTag is open infrastructure for running autonomous AI engineering teams on your models,
|
|
6
|
+
harnesses, and machines. Describe an outcome with success criteria, a budget, a deadline, and the
|
|
7
|
+
approvals you want to keep. A team plans the work, runs it in parallel, reviews results, and brings
|
|
8
|
+
you the decisions that need you.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
runs, and a **Worklet** connects that host to the Control Plane. An **execution environment**
|
|
14
|
-
provides the files, processes, and network used by a harness. A **collaboration surface** links SuperTag to an
|
|
15
|
-
external work tool. This SDK lets applications extend each of these boundaries.
|
|
10
|
+
Each team member is a **Tag**: a persistent AI identity with its own responsibilities and permissions.
|
|
11
|
+
An **Objective** records the outcome the team works toward. A **Team** is a group of Tags with a lead,
|
|
12
|
+
and a **Task** is one assignment accepted by a Tag. Objectives and their history survive individual
|
|
13
|
+
agent sessions and restarts.
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
For example: “People can invite teammates to a workspace and choose their role. Done when the
|
|
16
|
+
end-to-end tests pass and the API docs cover it. Ask me before changing the database schema.”
|
|
17
|
+
A lead Tag can coordinate builders and reviewers across that work while you steer the outcome.
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
This package contains the **CLI and TypeScript extension SDK**. It is the only public SuperTag npm
|
|
20
|
+
package; applications use its public entry points rather than private workspace packages.
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
[Documentation](https://github.com/atemaguer/supertag/blob/main/docs/README.md) ·
|
|
23
|
+
[Repository](https://github.com/atemaguer/supertag) ·
|
|
24
|
+
[First Team walkthrough](https://github.com/atemaguer/supertag/blob/main/docs/guides/first-team.md) ·
|
|
25
|
+
[Changelog](https://github.com/atemaguer/supertag/blob/main/CHANGELOG.md)
|
|
26
|
+
|
|
27
|
+
## Install the CLI
|
|
28
|
+
|
|
29
|
+
Use Node.js 22.13.0 or newer on macOS or Linux:
|
|
24
30
|
|
|
25
31
|
```sh
|
|
26
|
-
npm install
|
|
32
|
+
npm install -g supertag-ai
|
|
33
|
+
supertag --version
|
|
27
34
|
```
|
|
28
35
|
|
|
29
|
-
|
|
36
|
+
No SuperTag source checkout is required. If npm's global prefix is not writable, follow the
|
|
37
|
+
[installation guide](https://github.com/atemaguer/supertag/blob/main/docs/operations/install.md)
|
|
38
|
+
for a user-owned prefix and PATH setup. SuperTag is in alpha; the
|
|
39
|
+
[API stability policy](https://github.com/atemaguer/supertag/blob/main/docs/reference/api-stability.md)
|
|
40
|
+
describes compatibility and which extension interfaces are stable enough to build on.
|
|
41
|
+
|
|
42
|
+
## Get a first result
|
|
43
|
+
|
|
44
|
+
Start in a git repository with at least one commit. Install and sign in to the coding harnesses
|
|
45
|
+
you want to use before setup; a **harness** connects a Worker to an agent system such as Codex or
|
|
46
|
+
Claude Code. Cursor uses an API key rather than the Cursor app's sign-in. See
|
|
47
|
+
[requirements and harness sign-in](https://github.com/atemaguer/supertag/blob/main/docs/operations/requirements.md).
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
cd /path/to/your/repository
|
|
51
|
+
supertag init
|
|
52
|
+
supertag ps
|
|
53
|
+
```
|
|
30
54
|
|
|
31
|
-
|
|
55
|
+
`init` sets up a local **Control Plane**, the service that stores your organization and schedules
|
|
56
|
+
work, and connects your machine as a **Worker Host**, which provides execution capacity. A
|
|
57
|
+
**Worker** completes a Task, and a **Worklet** connects its host to the Control Plane.
|
|
58
|
+
|
|
59
|
+
Keep the default lead Tag name `lead`. Replace `YOUR_WORKSPACE` below with the Workspace name
|
|
60
|
+
printed by setup; a **Workspace** connects a repository to SuperTag.
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
supertag create objective first-reply --owner lead --workspace YOUR_WORKSPACE \
|
|
64
|
+
--budget-minor 1000 --budget-currency USD \
|
|
65
|
+
--outcome 'Create SUPERTAG-HELLO.md containing exactly: Hello from SuperTag. Done when the file exists and you have checked its contents. Do this yourself without delegating; change no other files.'
|
|
66
|
+
supertag watch objective first-reply
|
|
67
|
+
supertag describe objective first-reply
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Work arrives on a separate git branch for you to review. Use the branch and review commands printed
|
|
71
|
+
by `describe objective`; your original checkout stays on its current branch. Stopping `watch` does
|
|
72
|
+
not stop the work. `supertag down` stops the local services, and `supertag up` starts them again.
|
|
73
|
+
|
|
74
|
+
Next, [add a builder and run your first Team](https://github.com/atemaguer/supertag/blob/main/docs/guides/first-team.md).
|
|
75
|
+
You can also give your coding agent the
|
|
76
|
+
[operator skill](https://github.com/atemaguer/supertag/blob/main/docs/guides/coding-agent-operator.md)
|
|
77
|
+
and use one conversation to create Objectives, follow progress, answer questions, and review results.
|
|
78
|
+
|
|
79
|
+
## What you can use today
|
|
80
|
+
|
|
81
|
+
- **Choose each Tag's coding harness.** Codex, Claude Code, Cursor, OpenCode, or a custom harness.
|
|
82
|
+
See [harness runtime](https://github.com/atemaguer/supertag/blob/main/docs/guides/harness-runtime.md)
|
|
83
|
+
for supported execution modes and credential handling.
|
|
84
|
+
- **Run work where your code lives.** Use local or remote Worker Hosts, with execution adapters
|
|
85
|
+
for Modal and E2B. Supported harness/provider combinations and current limits are documented in
|
|
86
|
+
[shared execution](https://github.com/atemaguer/supertag/blob/main/docs/guides/shared-execution.md).
|
|
87
|
+
- **Direct the team from your tools.** Use the CLI or API, or connect Slack, GitHub, Linear,
|
|
88
|
+
Lark/Feishu, and Microsoft Teams through
|
|
89
|
+
[collaboration surfaces](https://github.com/atemaguer/supertag/blob/main/docs/surfaces/README.md).
|
|
90
|
+
- **Keep explicit authority.** A **Permission Set** lists allowed actions; a **Context Set**
|
|
91
|
+
selects reusable knowledge. Tasks retain the policy recorded when accepted. Set approval points,
|
|
92
|
+
inspect the operator inbox, and track reported usage and spend.
|
|
93
|
+
- **Keep work going across interruptions.** Persistent organization state, resumable sessions,
|
|
94
|
+
durable delivery, and recorded recovery support work across sessions and hosts. See
|
|
95
|
+
[scheduling and recovery](https://github.com/atemaguer/supertag/blob/main/docs/reference/scheduling-and-recovery.md).
|
|
96
|
+
|
|
97
|
+
For a team deployment, follow
|
|
98
|
+
[self-hosting](https://github.com/atemaguer/supertag/blob/main/docs/guides/self-hosting.md).
|
|
99
|
+
For ongoing work such as dependency upkeep or backlog triage, see
|
|
100
|
+
[ongoing responsibilities](https://github.com/atemaguer/supertag/blob/main/docs/guides/ongoing-responsibilities.md).
|
|
101
|
+
|
|
102
|
+
## Build with the TypeScript SDK
|
|
103
|
+
|
|
104
|
+
Add the package to your application:
|
|
105
|
+
|
|
106
|
+
```sh
|
|
107
|
+
npm install supertag-ai
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The package is ESM-only and includes TypeScript declarations. Its root entry point exposes the
|
|
111
|
+
common Worker and Worklet building blocks:
|
|
32
112
|
|
|
33
113
|
```ts
|
|
34
114
|
import {
|
|
@@ -40,85 +120,66 @@ import {
|
|
|
40
120
|
} from "supertag-ai";
|
|
41
121
|
```
|
|
42
122
|
|
|
43
|
-
Use explicit
|
|
123
|
+
Use explicit entry points for integrations and lower-level contracts:
|
|
124
|
+
|
|
125
|
+
| Entry point | Use it for |
|
|
126
|
+
| --- | --- |
|
|
127
|
+
| `supertag-ai` | Worker composition, local execution, and Worklet connections |
|
|
128
|
+
| `supertag-ai/core` | Domain types and resource schemas |
|
|
129
|
+
| `supertag-ai/worker` | Custom Workers, harnesses, input resolution, tools, environments, and continuity |
|
|
130
|
+
| `supertag-ai/transport` | Worklet transport and protocol contracts |
|
|
131
|
+
| `supertag-ai/messaging` | Tag messaging, Team channels, and custom Worker consumers |
|
|
132
|
+
| `supertag-ai/coordination` | Typed operator client and the redacted coordination inbox |
|
|
133
|
+
| `supertag-ai/testing` | Extension conformance probes |
|
|
134
|
+
| `supertag-ai/surfaces` | Custom collaboration surfaces |
|
|
135
|
+
| `supertag-ai/control-plane` | Embedding the Control Plane |
|
|
136
|
+
| `supertag-ai/harnesses/codex` | Codex harness |
|
|
137
|
+
| `supertag-ai/harnesses/claude-code` | Claude Code harness |
|
|
138
|
+
| `supertag-ai/harnesses/cursor` | Cursor harness |
|
|
139
|
+
| `supertag-ai/harnesses/opencode` | OpenCode harness |
|
|
140
|
+
| `supertag-ai/environments/e2b` | E2B execution adapter |
|
|
141
|
+
| `supertag-ai/environments/modal` | Modal execution adapter |
|
|
142
|
+
| `supertag-ai/environments/shared-execution` | Shared execution service integration |
|
|
143
|
+
| `supertag-ai/resources/github` | GitHub workspace and permission-derived resource integrations |
|
|
144
|
+
| `supertag-ai/spec/*` | Language-neutral wire schemas |
|
|
145
|
+
|
|
146
|
+
See the [entry-point stability table](https://github.com/atemaguer/supertag/blob/main/docs/reference/api-stability.md#package-entry-points)
|
|
147
|
+
before selecting an extension boundary. The
|
|
148
|
+
[custom Worker guide](https://github.com/atemaguer/supertag/blob/main/docs/guides/custom-workers.md)
|
|
149
|
+
and [external example](https://github.com/atemaguer/supertag/tree/main/examples/custom-worker)
|
|
150
|
+
show complete implementations. To add reusable knowledge, follow
|
|
151
|
+
[custom Context types](https://github.com/atemaguer/supertag/blob/main/docs/guides/custom-context.md).
|
|
152
|
+
|
|
153
|
+
Custom Workers are ordinary applications run through Node.js, Bun, a container, or a process
|
|
154
|
+
supervisor. The CLI launches SuperTag's built-in TypeScript Workers; it does not turn custom
|
|
155
|
+
Workers into CLI subcommands. Optional execution integrations load through their explicit entry points.
|
|
156
|
+
|
|
157
|
+
The installed package includes guides under `dist/docs/` and wire schemas under `dist/spec/`.
|
|
158
|
+
For example, resolve a schema through `supertag-ai/spec/task-attempt-spec.schema.json`.
|
|
159
|
+
To find bundled collaboration surface guides and manifests, run `supertag setup surface slack --help`.
|
|
160
|
+
|
|
161
|
+
## Python Workers
|
|
162
|
+
|
|
163
|
+
The matching Python SDK is published separately as `supertag` on PyPI:
|
|
44
164
|
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
import { CoordinationClient } from "supertag-ai/coordination";
|
|
48
|
-
import { type Surface } from "supertag-ai/surfaces";
|
|
49
|
-
import { CodexHarness } from "supertag-ai/harnesses/codex";
|
|
50
|
-
import { ClaudeCodeHarness } from "supertag-ai/harnesses/claude-code";
|
|
51
|
-
import { OpenCodeHarness } from "supertag-ai/harnesses/opencode";
|
|
52
|
-
import { E2BExecutionEnvironmentProvider } from "supertag-ai/environments/e2b";
|
|
53
|
-
import { ModalExecutionEnvironmentProvider } from "supertag-ai/environments/modal";
|
|
54
|
-
import { GitHubRepositoryWorkspaceResolver } from "supertag-ai/resources/github";
|
|
55
|
-
import { ControlPlane } from "supertag-ai/control-plane";
|
|
165
|
+
```sh
|
|
166
|
+
python -m pip install 'supertag==0.2.0a6'
|
|
56
167
|
```
|
|
57
168
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
## Public entry points
|
|
63
|
-
|
|
64
|
-
| Import | Stability | Purpose |
|
|
65
|
-
| --- | --- | --- |
|
|
66
|
-
| `supertag-ai` | Beta | Worker Host, Worklet, Worker, local harness runtime and execution components, and Worklet transport |
|
|
67
|
-
| `supertag-ai/core` | Beta | Tag, Role, Context Set, Permission Set, Task, Session, and surface-neutral domain contracts |
|
|
68
|
-
| `supertag-ai/worker` | Beta | Worker, harness, environment, Context Resolver, tool, and sessionState contracts |
|
|
69
|
-
| `supertag-ai/transport` | Experimental | Persistent remote Worklet connection and protocol |
|
|
70
|
-
| `supertag-ai/messaging` | Experimental | Durable Tag messaging, Team channels (Workstreams), and custom Worker consumer |
|
|
71
|
-
| `supertag-ai/coordination` | Experimental | Typed operator client and redacted coordination inbox contract |
|
|
72
|
-
| `supertag-ai/testing` | Beta | Reusable extension conformance probes |
|
|
73
|
-
| `supertag-ai/spec/*` | Experimental | Language-neutral JSON Schemas for Worker interoperability |
|
|
74
|
-
| `supertag-ai/surfaces` | Beta | Custom collaboration surface contract and Markdown pipeline |
|
|
75
|
-
| `supertag-ai/control-plane` | Experimental | Embeddable Control Plane service boundary |
|
|
76
|
-
| `supertag-ai/harnesses/*` | Experimental | Shipped Codex, Claude Code, and OpenCode harnesses |
|
|
77
|
-
| `supertag-ai/environments/e2b` | Experimental | Shipped E2B execution environment |
|
|
78
|
-
| `supertag-ai/environments/modal` | Experimental | Shipped Modal execution environment |
|
|
79
|
-
| `supertag-ai/environments/shared-execution` | Experimental | Task Attempt access to a shared execution service |
|
|
80
|
-
| `supertag-ai/resources/*` | Experimental | Permission-derived MCP and workspace integrations |
|
|
81
|
-
|
|
82
|
-
The package is ESM-only. See [Requirements](../../docs/operations/requirements.md) for the supported Node.js runtime. The CLI includes the shipped collaboration surface and harness integrations. E2B, Modal, and shared execution are loaded only through their explicit subpaths.
|
|
83
|
-
|
|
84
|
-
The CLI launches SuperTag's built-in TypeScript Workers. Applications built with the SDK keep
|
|
85
|
-
their own entry point and run through `node`, `bun`, a package script, a container command, or a
|
|
86
|
-
process supervisor; they do not become `supertag` subcommands.
|
|
87
|
-
|
|
88
|
-
Wire schemas can be resolved directly from the installed package, for example
|
|
89
|
-
`supertag-ai/spec/task-attempt-spec.schema.json`. See the
|
|
90
|
-
[custom Worker and harness guide](dist/docs/guides/custom-workers.md)
|
|
91
|
-
for a complete implementation and Control Plane connection walkthrough, or the
|
|
92
|
-
[custom Context guide](dist/docs/guides/custom-context.md)
|
|
93
|
-
to add a namespaced knowledge type without replacing the Worker.
|
|
94
|
-
|
|
95
|
-
The testing entry point currently provides conformance probes for Workers,
|
|
96
|
-
harnesses, collaboration surfaces, execution environments, Tool Providers, Tool Adapters,
|
|
97
|
-
and Worklet transport version negotiation. The repository also contains an
|
|
98
|
-
[external extension example](https://github.com/atemaguer/supertag/tree/main/examples/custom-worker)
|
|
99
|
-
with custom Worker, harness, and Environment Provider implementations verified
|
|
100
|
-
against the built distribution.
|
|
101
|
-
|
|
102
|
-
## License
|
|
103
|
-
|
|
104
|
-
Apache-2.0
|
|
105
|
-
|
|
106
|
-
For surface-independent coordination, see the [Tag messaging guide](dist/docs/guides/tag-messaging.md).
|
|
169
|
+
Pin the prerelease explicitly so pip selects the matching SDK. Python applications can compose
|
|
170
|
+
custom Workers and use the Codex or OpenAI Agents harness integrations. See the
|
|
171
|
+
[Python Worker guide](https://github.com/atemaguer/supertag/blob/main/docs/guides/python-workers.md)
|
|
172
|
+
for installation extras, examples, and Control Plane connection details.
|
|
107
173
|
|
|
108
|
-
|
|
109
|
-
or acceptance criteria:
|
|
174
|
+
## Contributing and support
|
|
110
175
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
```
|
|
176
|
+
Report issues or propose improvements in the
|
|
177
|
+
[GitHub repository](https://github.com/atemaguer/supertag/issues). Read
|
|
178
|
+
[CONTRIBUTING.md](https://github.com/atemaguer/supertag/blob/main/CONTRIBUTING.md)
|
|
179
|
+
for source setup and checks, and use
|
|
180
|
+
[SECURITY.md](https://github.com/atemaguer/supertag/blob/main/SECURITY.md)
|
|
181
|
+
for private vulnerability reports.
|
|
118
182
|
|
|
119
|
-
|
|
120
|
-
`update_task` invocation with the current status fence and any fields the operator still needs to
|
|
121
|
-
supply. Authority and stale-write checks run again when the update is submitted.
|
|
183
|
+
## License
|
|
122
184
|
|
|
123
|
-
|
|
124
|
-
success criteria and explicit completion assessments. See the [Objective guide](../../docs/guides/objectives.md).
|
|
185
|
+
[Apache-2.0](https://github.com/atemaguer/supertag/blob/main/LICENSE).
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { checkInstalledCli } from './chunk-PEGY7YJA.js';
|
|
2
|
+
import { execFile } from 'child_process';
|
|
3
|
+
import { constants } from 'fs';
|
|
4
|
+
import { stat, access } from 'fs/promises';
|
|
5
|
+
import { delimiter, join } from 'path';
|
|
6
|
+
import { promisify } from 'util';
|
|
7
|
+
|
|
8
|
+
var HARNESSES = ["claude-code", "codex", "cursor", "opencode"];
|
|
9
|
+
var HARNESS_COMMANDS = {
|
|
10
|
+
"claude-code": "claude",
|
|
11
|
+
codex: "codex",
|
|
12
|
+
cursor: "cursor-agent",
|
|
13
|
+
opencode: "opencode"
|
|
14
|
+
};
|
|
15
|
+
function isHarness(value) {
|
|
16
|
+
return typeof value === "string" && HARNESSES.includes(value);
|
|
17
|
+
}
|
|
18
|
+
async function detectHarnesses(path = process.env["PATH"], environment = process.env) {
|
|
19
|
+
return (await inspectHarnesses(path, environment)).found;
|
|
20
|
+
}
|
|
21
|
+
async function inspectHarnesses(path = process.env["PATH"], environment = process.env) {
|
|
22
|
+
const found = [];
|
|
23
|
+
const problems = [];
|
|
24
|
+
for (const harness of HARNESSES) {
|
|
25
|
+
if (harness === "cursor") {
|
|
26
|
+
if (environment["CURSOR_API_KEY"]?.trim() || await isOnPath("cursor-agent", path) || await isCursorAgentAlias(path))
|
|
27
|
+
found.push(harness);
|
|
28
|
+
} else if (harness === "claude-code" || harness === "codex") {
|
|
29
|
+
const check = await checkHarnessCli(harness, { path, environment });
|
|
30
|
+
if (check.status === "ok") found.push(harness);
|
|
31
|
+
else if (check.status !== "missing") problems.push(check.message);
|
|
32
|
+
} else if (await isOnPath(HARNESS_COMMANDS[harness], path)) found.push(harness);
|
|
33
|
+
}
|
|
34
|
+
return { found, problems };
|
|
35
|
+
}
|
|
36
|
+
async function checkHarnessCli(harness, options = {}) {
|
|
37
|
+
if (harness === "codex") {
|
|
38
|
+
const { codexCliRequirement } = await import('./src-JYMWKZIE.js');
|
|
39
|
+
return checkInstalledCli(await codexCliRequirement(), options);
|
|
40
|
+
}
|
|
41
|
+
const { claudeCodeCliRequirement } = await import('./src-2PGBHIMD.js');
|
|
42
|
+
return checkInstalledCli(await claudeCodeCliRequirement(), options);
|
|
43
|
+
}
|
|
44
|
+
function harnessSignInInstructions(harness) {
|
|
45
|
+
if (harness === "claude-code")
|
|
46
|
+
return "Claude Code: run claude and use /login, or set ANTHROPIC_API_KEY in the host's env_file (default ~/.supertag/.env). A background host also inherits it from the shell; a service unit does not. The bundled Claude Agent SDK reads the secure sign-in store selected by CLAUDE_SECURESTORAGE_CONFIG_DIR, then CLAUDE_CONFIG_DIR, then ~/.claude (macOS Keychain on macOS; .credentials.json on Linux). Task sessions and settings stay in a separate temporary directory.";
|
|
47
|
+
if (harness === "codex")
|
|
48
|
+
return `Codex: run codex -c 'cli_auth_credentials_store="file"' login, or set CODEX_API_KEY or OPENAI_API_KEY in the host's env_file (default ~/.supertag/.env). On macOS, a Keychain-only login is not copied to Task Attempts. A background host also inherits environment credentials from the shell; a service unit does not. The bundled Codex SDK reads CODEX_API_KEY first, then copies $CODEX_HOME/auth.json (default ~/.codex/auth.json), then falls back to OPENAI_API_KEY if that file cannot be read. The file-backed init check only verifies credential structure; it cannot verify account access without rotating a refresh token.`;
|
|
49
|
+
if (harness === "cursor")
|
|
50
|
+
return "Cursor: generate an API key at https://cursor.com/dashboard/api and set CURSOR_API_KEY in the host's env_file (default ~/.supertag/.env). The Cursor app and cursor-agent logins do not authenticate the bundled SDK runner.";
|
|
51
|
+
return "OpenCode: set the API key for the selected provider/model in the Worker Host environment (for example OPENAI_API_KEY for openai, or ANTHROPIC_API_KEY for anthropic). Tasks use an isolated OpenCode home and do not read your usual OpenCode auth.json.";
|
|
52
|
+
}
|
|
53
|
+
async function probeHarnessSignIn(harness, model, environment = process.env) {
|
|
54
|
+
const options = { environment, ...model === void 0 ? {} : { model } };
|
|
55
|
+
if (harness === "claude-code") {
|
|
56
|
+
const { checkClaudeCodeSignIn } = await import('./src-2PGBHIMD.js');
|
|
57
|
+
return checkClaudeCodeSignIn(options);
|
|
58
|
+
}
|
|
59
|
+
if (harness === "codex") {
|
|
60
|
+
const { checkCodexSignIn } = await import('./src-JYMWKZIE.js');
|
|
61
|
+
return checkCodexSignIn(options);
|
|
62
|
+
}
|
|
63
|
+
if (harness === "cursor") {
|
|
64
|
+
const { checkCursorSignIn } = await import('./cursor-sign-in-VZYMNUV7.js');
|
|
65
|
+
const { checkCursorModels } = await import('./src-NJP6L4P7.js');
|
|
66
|
+
const result = await checkCursorSignIn({
|
|
67
|
+
environment,
|
|
68
|
+
verifyModels: async (apiKey) => {
|
|
69
|
+
const check = await checkCursorModels(
|
|
70
|
+
model === void 0 ? [] : [model],
|
|
71
|
+
apiKey === void 0 ? {} : { apiKey }
|
|
72
|
+
);
|
|
73
|
+
return check.status === "ok" ? { status: "ok", models: check.availableIds } : { status: "error" };
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
return result.signedIn;
|
|
77
|
+
}
|
|
78
|
+
const { checkOpenCodeSignIn } = await import('./opencode-sign-in-KSCTH2WC.js');
|
|
79
|
+
return model === void 0 ? false : checkOpenCodeSignIn(model, environment);
|
|
80
|
+
}
|
|
81
|
+
async function isOnPath(command, path) {
|
|
82
|
+
const extensions = process.platform === "win32" ? (process.env["PATHEXT"] ?? ".EXE;.CMD;.BAT").split(";").filter(Boolean) : [""];
|
|
83
|
+
for (const directory of (path ?? "").split(delimiter).filter(Boolean))
|
|
84
|
+
for (const extension of extensions) {
|
|
85
|
+
const candidate = join(directory, `${command}${extension}`);
|
|
86
|
+
const stats = await stat(candidate).catch(() => void 0);
|
|
87
|
+
if (stats === void 0 || stats.isDirectory()) continue;
|
|
88
|
+
if (await access(candidate, constants.X_OK).then(
|
|
89
|
+
() => true,
|
|
90
|
+
() => false
|
|
91
|
+
))
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
var execFileAsync = promisify(execFile);
|
|
97
|
+
async function isCursorAgentAlias(path) {
|
|
98
|
+
if (!await isOnPath("agent", path)) return false;
|
|
99
|
+
const options = {
|
|
100
|
+
env: { PATH: path },
|
|
101
|
+
timeout: 5e3,
|
|
102
|
+
killSignal: "SIGKILL",
|
|
103
|
+
maxBuffer: 64 * 1024
|
|
104
|
+
};
|
|
105
|
+
const cursorName = (value) => typeof value === "string" && /^cursor(?:[- ]agent)?\b/i.test(value.trim());
|
|
106
|
+
const about = await execFileAsync("agent", ["about", "--format", "json"], options).catch(
|
|
107
|
+
() => void 0
|
|
108
|
+
);
|
|
109
|
+
if (about) {
|
|
110
|
+
try {
|
|
111
|
+
const parsed = JSON.parse(about.stdout);
|
|
112
|
+
if (parsed !== null && typeof parsed === "object" && ["name", "product", "application", "cli"].some(
|
|
113
|
+
(field) => cursorName(parsed[field])
|
|
114
|
+
))
|
|
115
|
+
return true;
|
|
116
|
+
} catch {
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const version = await execFileAsync("agent", ["--version"], options).catch(() => void 0);
|
|
120
|
+
return version !== void 0 && cursorName(version.stdout);
|
|
121
|
+
}
|
|
122
|
+
var SIGN_IN_DOCS = "https://github.com/atemaguer/supertag/blob/main/docs/operations/requirements.md#choose-and-sign-in-to-a-harness";
|
|
123
|
+
function noHarnessMessage() {
|
|
124
|
+
return `No harness is available on this machine. SuperTag runs Tasks through Claude Code, Codex, Cursor, or OpenCode.
|
|
125
|
+
Install one and sign in:
|
|
126
|
+
Claude Code npm install -g @anthropic-ai/claude-code, then run claude to sign in
|
|
127
|
+
Codex npm install -g @openai/codex, then codex -c 'cli_auth_credentials_store="file"' login
|
|
128
|
+
Cursor Add CURSOR_API_KEY to ~/.supertag/.env, using a key from https://cursor.com/dashboard/api
|
|
129
|
+
OpenCode npm install -g opencode-ai, then set your provider's API key
|
|
130
|
+
Sign-in details: ${SIGN_IN_DOCS}
|
|
131
|
+
SuperTag looks for claude, codex, and opencode on PATH, and for Cursor through CURSOR_API_KEY or cursor-agent.`;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export { HARNESSES, HARNESS_COMMANDS, checkHarnessCli, detectHarnesses, harnessSignInInstructions, inspectHarnesses, isHarness, noHarnessMessage, probeHarnessSignIn };
|
|
135
|
+
//# sourceMappingURL=chunk-33IFPHXE.js.map
|
|
136
|
+
//# sourceMappingURL=chunk-33IFPHXE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../apps/cli/src/harnesses.ts"],"names":[],"mappings":";;;;;;;AAQO,IAAM,SAAA,GAAuC,CAAC,aAAA,EAAe,OAAA,EAAS,UAAU,UAAU;AAG1F,IAAM,gBAAA,GAA6D;AAAA,EACxE,aAAA,EAAe,QAAA;AAAA,EACf,KAAA,EAAO,OAAA;AAAA,EACP,MAAA,EAAQ,cAAA;AAAA,EACR,QAAA,EAAU;AACZ;AAEO,SAAS,UAAU,KAAA,EAAyC;AACjE,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAa,SAAA,CAAgC,SAAS,KAAK,CAAA;AACrF;AAGA,eAAsB,eAAA,CACpB,OAA2B,OAAA,CAAQ,GAAA,CAAI,MAAM,CAAA,EAC7C,WAAA,GAA4D,QAAQ,GAAA,EAChC;AACpC,EAAA,OAAA,CAAQ,MAAM,gBAAA,CAAiB,IAAA,EAAM,WAAW,CAAA,EAAG,KAAA;AACrD;AAMA,eAAsB,gBAAA,CACpB,OAA2B,OAAA,CAAQ,GAAA,CAAI,MAAM,CAAA,EAC7C,WAAA,GAA4D,QAAQ,GAAA,EAC0B;AAC9F,EAAA,MAAM,QAA0B,EAAC;AACjC,EAAA,MAAM,WAAqB,EAAC;AAC5B,EAAA,KAAA,MAAW,WAAW,SAAA,EAAW;AAC/B,IAAA,IAAI,YAAY,QAAA,EAAU;AACxB,MAAA,IACE,WAAA,CAAY,gBAAgB,CAAA,EAAG,IAAA,EAAK,IACnC,MAAM,QAAA,CAAS,cAAA,EAAgB,IAAI,CAAA,IACnC,MAAM,kBAAA,CAAmB,IAAI,CAA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fs\";\nimport { access, stat } from \"node:fs/promises\";\nimport { delimiter, join } from \"node:path\";\nimport { promisify } from \"node:util\";\nimport { checkInstalledCli, type InstalledCliCheck } from \"@supertag/worker-sdk/installed-cli\";\nimport type { WorkletHarness } from \"./worker.js\";\n\nexport const HARNESSES: readonly WorkletHarness[] = [\"claude-code\", \"codex\", \"cursor\", \"opencode\"];\n\n/** Optional PATH command associated with each harness. */\nexport const HARNESS_COMMANDS: Readonly<Record<WorkletHarness, string>> = {\n \"claude-code\": \"claude\",\n codex: \"codex\",\n cursor: \"cursor-agent\",\n opencode: \"opencode\",\n};\n\nexport function isHarness(value: unknown): value is WorkletHarness {\n return typeof value === \"string\" && (HARNESSES as readonly string[]).includes(value);\n}\n\n/** Available harnesses in stable order; Cursor also accepts CURSOR_API_KEY. */\nexport async function detectHarnesses(\n path: string | undefined = process.env[\"PATH\"],\n environment: Readonly<Record<string, string | undefined>> = process.env,\n): Promise<readonly WorkletHarness[]> {\n return (await inspectHarnesses(path, environment)).found;\n}\n\n/**\n * Usable harnesses, plus why an installed one can't be used. Claude Code and Codex run the user's\n * own CLI, so each must be installed and at least the version SuperTag's SDK targets.\n */\nexport async function inspectHarnesses(\n path: string | undefined = process.env[\"PATH\"],\n environment: Readonly<Record<string, string | undefined>> = process.env,\n): Promise<{ readonly found: readonly WorkletHarness[]; readonly problems: readonly string[] }> {\n const found: WorkletHarness[] = [];\n const problems: string[] = [];\n for (const harness of HARNESSES) {\n if (harness === \"cursor\") {\n if (\n environment[\"CURSOR_API_KEY\"]?.trim() ||\n (await isOnPath(\"cursor-agent\", path)) ||\n (await isCursorAgentAlias(path))\n )\n found.push(harness);\n } else if (harness === \"claude-code\" || harness === \"codex\") {\n const check = await checkHarnessCli(harness, { path, environment });\n if (check.status === \"ok\") found.push(harness);\n else if (check.status !== \"missing\") problems.push(check.message);\n } else if (await isOnPath(HARNESS_COMMANDS[harness], path)) found.push(harness);\n }\n return { found, problems };\n}\n\n/** Checks the installed CLI a harness runs: present on PATH and new enough. */\nexport async function checkHarnessCli(\n harness: \"claude-code\" | \"codex\",\n options: Parameters<typeof checkInstalledCli>[1] = {},\n): Promise<InstalledCliCheck> {\n if (harness === \"codex\") {\n const { codexCliRequirement } = await import(\"@supertag/worker-codex\");\n return checkInstalledCli(await codexCliRequirement(), options);\n }\n const { claudeCodeCliRequirement } = await import(\"@supertag/worker-claude-code\");\n return checkInstalledCli(await claudeCodeCliRequirement(), options);\n}\n\n/** Exact local Worker credential lookup, shared with Task Attempt error translation. */\nexport function harnessSignInInstructions(harness: WorkletHarness): string {\n if (harness === \"claude-code\")\n return \"Claude Code: run claude and use /login, or set ANTHROPIC_API_KEY in the host's env_file (default ~/.supertag/.env). A background host also inherits it from the shell; a service unit does not. The bundled Claude Agent SDK reads the secure sign-in store selected by CLAUDE_SECURESTORAGE_CONFIG_DIR, then CLAUDE_CONFIG_DIR, then ~/.claude (macOS Keychain on macOS; .credentials.json on Linux). Task sessions and settings stay in a separate temporary directory.\";\n if (harness === \"codex\")\n return `Codex: run codex -c 'cli_auth_credentials_store=\"file\"' login, or set CODEX_API_KEY or OPENAI_API_KEY in the host's env_file (default ~/.supertag/.env). On macOS, a Keychain-only login is not copied to Task Attempts. A background host also inherits environment credentials from the shell; a service unit does not. The bundled Codex SDK reads CODEX_API_KEY first, then copies $CODEX_HOME/auth.json (default ~/.codex/auth.json), then falls back to OPENAI_API_KEY if that file cannot be read. The file-backed init check only verifies credential structure; it cannot verify account access without rotating a refresh token.`;\n if (harness === \"cursor\")\n return \"Cursor: generate an API key at https://cursor.com/dashboard/api and set CURSOR_API_KEY in the host's env_file (default ~/.supertag/.env). The Cursor app and cursor-agent logins do not authenticate the bundled SDK runner.\";\n return \"OpenCode: set the API key for the selected provider/model in the Worker Host environment (for example OPENAI_API_KEY for openai, or ANTHROPIC_API_KEY for anthropic). Tasks use an isolated OpenCode home and do not read your usual OpenCode auth.json.\";\n}\n\n/** Verify a model turn through the same bundled runtimes used by local Workers. */\nexport async function probeHarnessSignIn(\n harness: WorkletHarness,\n model?: string,\n environment: Readonly<Record<string, string | undefined>> = process.env,\n): Promise<boolean> {\n const options = { environment, ...(model === undefined ? {} : { model }) };\n if (harness === \"claude-code\") {\n const { checkClaudeCodeSignIn } = await import(\"@supertag/worker-claude-code\");\n return checkClaudeCodeSignIn(options);\n }\n if (harness === \"codex\") {\n const { checkCodexSignIn } = await import(\"@supertag/worker-codex\");\n return checkCodexSignIn(options);\n }\n if (harness === \"cursor\") {\n const { checkCursorSignIn } = await import(\"./cursor-sign-in.js\");\n const { checkCursorModels } = await import(\"@supertag/worker-cursor\");\n const result = await checkCursorSignIn({\n environment,\n verifyModels: async (apiKey) => {\n const check = await checkCursorModels(\n model === undefined ? [] : [model],\n apiKey === undefined ? {} : { apiKey },\n );\n return check.status === \"ok\"\n ? { status: \"ok\" as const, models: check.availableIds }\n : { status: \"error\" as const };\n },\n });\n return result.signedIn;\n }\n const { checkOpenCodeSignIn } = await import(\"./opencode-sign-in.js\");\n return model === undefined ? false : checkOpenCodeSignIn(model, environment);\n}\n\nasync function isOnPath(command: string, path: string | undefined): Promise<boolean> {\n const extensions =\n process.platform === \"win32\"\n ? (process.env[\"PATHEXT\"] ?? \".EXE;.CMD;.BAT\").split(\";\").filter(Boolean)\n : [\"\"];\n for (const directory of (path ?? \"\").split(delimiter).filter(Boolean))\n for (const extension of extensions) {\n const candidate = join(directory, `${command}${extension}`);\n const stats = await stat(candidate).catch(() => undefined);\n if (stats === undefined || stats.isDirectory()) continue;\n if (\n await access(candidate, constants.X_OK).then(\n () => true,\n () => false,\n )\n )\n return true;\n }\n return false;\n}\n\nconst execFileAsync = promisify(execFile);\n\nasync function isCursorAgentAlias(path: string | undefined): Promise<boolean> {\n if (!(await isOnPath(\"agent\", path))) return false;\n const options = {\n env: { PATH: path },\n timeout: 5_000,\n killSignal: \"SIGKILL\" as const,\n maxBuffer: 64 * 1024,\n };\n const cursorName = (value: unknown): boolean =>\n typeof value === \"string\" && /^cursor(?:[- ]agent)?\\b/i.test(value.trim());\n const about = await execFileAsync(\"agent\", [\"about\", \"--format\", \"json\"], options).catch(\n () => undefined,\n );\n if (about) {\n try {\n const parsed: unknown = JSON.parse(about.stdout);\n if (\n parsed !== null &&\n typeof parsed === \"object\" &&\n [\"name\", \"product\", \"application\", \"cli\"].some((field) =>\n cursorName((parsed as Record<string, unknown>)[field]),\n )\n )\n return true;\n } catch {\n // Some Cursor versions only identify themselves in --version.\n }\n }\n const version = await execFileAsync(\"agent\", [\"--version\"], options).catch(() => undefined);\n return version !== undefined && cursorName(version.stdout);\n}\n\nconst SIGN_IN_DOCS =\n \"https://github.com/atemaguer/supertag/blob/main/docs/operations/requirements.md#choose-and-sign-in-to-a-harness\";\n\n/** The message shown when no harness is available. */\nexport function noHarnessMessage(): string {\n return `No harness is available on this machine. SuperTag runs Tasks through Claude Code, Codex, Cursor, or OpenCode.\nInstall one and sign in:\n Claude Code npm install -g @anthropic-ai/claude-code, then run claude to sign in\n Codex npm install -g @openai/codex, then codex -c 'cli_auth_credentials_store=\"file\"' login\n Cursor Add CURSOR_API_KEY to ~/.supertag/.env, using a key from https://cursor.com/dashboard/api\n OpenCode npm install -g opencode-ai, then set your provider's API key\nSign-in details: ${SIGN_IN_DOCS}\nSuperTag looks for claude, codex, and opencode on PATH, and for Cursor through CURSOR_API_KEY or cursor-agent.`;\n}\n"]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { checkInstalledCli } from './chunk-PEGY7YJA.js';
|
|
1
2
|
import { minimalProcessEnvironment, withoutProviderCredentials, harnessModels, PROCESS_OUTPUT_STREAMING_CAPABILITY, PROCESS_INPUT_STREAMING_CAPABILITY, HARNESS_EFFORTS, attemptModel, runtimeInputs, harnessArtifactRestoreDestination, inPlaceWorkspacePath, executionRootWorkspace, executionRootCheckoutPath, artifactInputPath, ExecutionCleanupError, assertHarnessMcpPolicyEnforceable, isControlPlaneCoordinationTool, startMcpPolicyProxy, connectWorkerMcpClient, connectExecutionEnvironmentMcpClient, resolveHarnessContinuity, executionWarningProgress, LocalExecutionEnvironmentProvider, createWorker, CHANGE_SUMMARY_INSTRUCTION, FINDINGS_INSTRUCTION, resolveSkillPackages, describeToolCall, toolCallOutcomeFromText, HarnessProviderError, ToolAdapterRegistry, McpToolAdapter, LocalHarnessExecutionControl, ExecutionBudgetExceededError } from './chunk-GGLTVY7F.js';
|
|
2
3
|
import { reportedCodexModel, codexCostFields } from './chunk-FMADEKHP.js';
|
|
3
4
|
import { readFile, mkdtemp, rm, access, open, stat, mkdir, copyFile, chmod, realpath } from 'fs/promises';
|
|
4
5
|
import { tmpdir, homedir } from 'os';
|
|
5
|
-
import { join, resolve, isAbsolute
|
|
6
|
+
import { join, resolve, isAbsolute } from 'path';
|
|
6
7
|
import { Codex } from '@openai/codex-sdk';
|
|
7
8
|
import { constants } from 'fs';
|
|
8
9
|
import { createRequire } from 'module';
|
|
@@ -89,7 +90,9 @@ async function checkCodexSignIn(options = {}) {
|
|
|
89
90
|
if (controller.signal.aborted) return false;
|
|
90
91
|
const home = join(directory, ".codex");
|
|
91
92
|
const apiKey = await prepareCodexHome(home, environment);
|
|
93
|
+
const codexPath = options.createCodex === void 0 ? (await import('./src-JYMWKZIE.js').then(({ installedCodex: installedCodex2 }) => installedCodex2())).command : void 0;
|
|
92
94
|
const codex = (options.createCodex ?? ((config) => new Codex(config)))({
|
|
95
|
+
...codexPath === void 0 ? {} : { codexPathOverride: codexPath },
|
|
93
96
|
...apiKey ? { apiKey } : {},
|
|
94
97
|
env: { ...minimalProcessEnvironment(environment), CODEX_HOME: home },
|
|
95
98
|
config: {
|
|
@@ -1643,8 +1646,8 @@ async function checkCodexModels(models, options = {}) {
|
|
|
1643
1646
|
}
|
|
1644
1647
|
}
|
|
1645
1648
|
async function codexCommand() {
|
|
1646
|
-
const {
|
|
1647
|
-
return
|
|
1649
|
+
const { installedCodex: installedCodex2 } = await import('./src-JYMWKZIE.js');
|
|
1650
|
+
return (await installedCodex2()).command;
|
|
1648
1651
|
}
|
|
1649
1652
|
|
|
1650
1653
|
// ../runtime/harnesses/codex/src/portable-session-state.ts
|
|
@@ -1990,15 +1993,10 @@ var CodexHarness = class {
|
|
|
1990
1993
|
executionEnvironment
|
|
1991
1994
|
);
|
|
1992
1995
|
const native = this.#executionMode === "app-server" || environment.placement === "local";
|
|
1993
|
-
const source = !this.#enforceMcpPolicy ? "injected" :
|
|
1996
|
+
const source = !this.#enforceMcpPolicy ? "injected" : "configured";
|
|
1994
1997
|
let version;
|
|
1995
|
-
if (source === "
|
|
1996
|
-
|
|
1997
|
-
const manifest = JSON.parse(
|
|
1998
|
-
await readFile(sdk.resolve("@openai/codex/package.json"), "utf8")
|
|
1999
|
-
);
|
|
2000
|
-
if (typeof manifest.version === "string") version = manifest.version;
|
|
2001
|
-
}
|
|
1998
|
+
if (source === "configured" && environment.placement === "local" && this.#command === "codex")
|
|
1999
|
+
version = (await installedCodex()).version;
|
|
2002
2000
|
return {
|
|
2003
2001
|
capabilities: {
|
|
2004
2002
|
...await this.describe(),
|
|
@@ -2275,18 +2273,14 @@ var CodexHarness = class {
|
|
|
2275
2273
|
try {
|
|
2276
2274
|
const home = runtime.resolvePath(".codex");
|
|
2277
2275
|
const apiKey = request.authFileStaged ? void 0 : runtime.placement === "local" ? await prepareCodexHome(home) : process.env["CODEX_API_KEY"] ?? process.env["OPENAI_API_KEY"];
|
|
2278
|
-
const executable = runtime.placement === "local" && request.command === "codex" ? await
|
|
2279
|
-
command: request.command,
|
|
2280
|
-
path: void 0
|
|
2281
|
-
};
|
|
2276
|
+
const executable = runtime.placement === "local" && request.command === "codex" ? await installedCodex() : { command: request.command };
|
|
2282
2277
|
const processEnvironment = {
|
|
2283
2278
|
...minimalProcessEnvironment(process.env),
|
|
2284
2279
|
...request.outputDirectory === void 0 ? {} : { SUPERTAG_OUTPUT_DIR: request.outputDirectory },
|
|
2285
2280
|
...request.scratchDirectory === void 0 ? {} : { SUPERTAG_SCRATCH_DIR: request.scratchDirectory },
|
|
2286
2281
|
CODEX_HOME: home,
|
|
2287
2282
|
...apiKey ? { CODEX_API_KEY: apiKey } : {},
|
|
2288
|
-
...codexMcpRuntimeEnvironment(request.mcpServers)
|
|
2289
|
-
...executable.path ? { PATH: [executable.path, process.env["PATH"]].filter(Boolean).join(delimiter) } : {}
|
|
2283
|
+
...codexMcpRuntimeEnvironment(request.mcpServers)
|
|
2290
2284
|
};
|
|
2291
2285
|
const requestedLimits = input.attempt.execution.limits;
|
|
2292
2286
|
if (requestedLimits?.maxNativeAgents !== void 0 && requestedLimits.maxNativeAgents !== 0)
|
|
@@ -3058,36 +3052,27 @@ function assertCodexEventSucceeded(event) {
|
|
|
3058
3052
|
throw new HarnessProviderError(`Codex SDK failed: ${event.error.message}`);
|
|
3059
3053
|
if (event.type === "error") throw new HarnessProviderError(`Codex SDK failed: ${event.message}`);
|
|
3060
3054
|
}
|
|
3061
|
-
async function
|
|
3062
|
-
try {
|
|
3063
|
-
return (await bundledCodex()).command;
|
|
3064
|
-
} catch {
|
|
3065
|
-
return "codex";
|
|
3066
|
-
}
|
|
3067
|
-
}
|
|
3068
|
-
async function bundledCodex() {
|
|
3069
|
-
const os = process.platform === "android" ? "linux" : process.platform;
|
|
3070
|
-
const cpu = process.arch === "x64" ? "x86_64" : process.arch === "arm64" ? "aarch64" : void 0;
|
|
3071
|
-
const target = os === "linux" ? "unknown-linux-musl" : os === "darwin" ? "apple-darwin" : os === "win32" ? "pc-windows-msvc" : void 0;
|
|
3072
|
-
if (!cpu || !target) throw new Error("Unsupported bundled Codex platform");
|
|
3055
|
+
async function codexCliRequirement() {
|
|
3073
3056
|
const sdk = createRequire(import.meta.resolve("@openai/codex-sdk"));
|
|
3074
|
-
const
|
|
3075
|
-
|
|
3057
|
+
const manifest = JSON.parse(
|
|
3058
|
+
await readFile(sdk.resolve("@openai/codex/package.json"), "utf8")
|
|
3059
|
+
);
|
|
3076
3060
|
if (typeof manifest.version !== "string" || !manifest.version)
|
|
3077
|
-
throw new Error("
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3061
|
+
throw new Error("The pinned Codex SDK has no CLI version");
|
|
3062
|
+
return {
|
|
3063
|
+
name: "Codex",
|
|
3064
|
+
command: "codex",
|
|
3065
|
+
minimumVersion: manifest.version,
|
|
3066
|
+
install: "Install or upgrade it with: npm install -g @openai/codex"
|
|
3067
|
+
};
|
|
3068
|
+
}
|
|
3069
|
+
async function checkCodexCli(options = {}) {
|
|
3070
|
+
return checkInstalledCli(await codexCliRequirement(), options);
|
|
3071
|
+
}
|
|
3072
|
+
async function installedCodex() {
|
|
3073
|
+
const check = await checkCodexCli();
|
|
3074
|
+
if (check.status !== "ok") throw new HarnessProviderError(check.message);
|
|
3075
|
+
return { command: check.path, version: check.version };
|
|
3091
3076
|
}
|
|
3092
3077
|
async function codexCliVersion(runtime, command, timeoutMs) {
|
|
3093
3078
|
const handle = await runtime.spawn({
|
|
@@ -3116,7 +3101,7 @@ async function* codexProcessEvents(request, environment, signal) {
|
|
|
3116
3101
|
validateExternalSandbox(request, environment);
|
|
3117
3102
|
const home = environment.resolvePath(".codex");
|
|
3118
3103
|
const apiKey = request.authFileStaged ? void 0 : environment.placement === "local" ? await prepareCodexHome(home) : process.env["CODEX_API_KEY"] ?? process.env["OPENAI_API_KEY"];
|
|
3119
|
-
const executable = environment.placement === "local" && request.command === "codex" ? await
|
|
3104
|
+
const executable = environment.placement === "local" && request.command === "codex" ? await installedCodex() : { command: request.command };
|
|
3120
3105
|
const env = {
|
|
3121
3106
|
...minimalProcessEnvironment(process.env),
|
|
3122
3107
|
...request.outputDirectory === void 0 ? {} : { SUPERTAG_OUTPUT_DIR: request.outputDirectory },
|
|
@@ -3125,7 +3110,6 @@ async function* codexProcessEvents(request, environment, signal) {
|
|
|
3125
3110
|
...apiKey ? { CODEX_API_KEY: apiKey } : {},
|
|
3126
3111
|
...codexMcpRuntimeEnvironment(request.mcpServers)
|
|
3127
3112
|
};
|
|
3128
|
-
if (executable.path) env["PATH"] = [executable.path, env["PATH"]].filter(Boolean).join(delimiter);
|
|
3129
3113
|
const sandbox = codexSandboxAllowance(request.sandboxMode, request.runtimeActions);
|
|
3130
3114
|
const sandboxMode = codexSandboxMode(sandbox);
|
|
3131
3115
|
const commonGitDir = environment.placement === "local" ? await codexProtectedGitDirectory(request.workspace) : void 0;
|
|
@@ -3515,6 +3499,6 @@ function validatedUsageBaselines(value) {
|
|
|
3515
3499
|
return value;
|
|
3516
3500
|
}
|
|
3517
3501
|
|
|
3518
|
-
export { CodexHarness,
|
|
3519
|
-
//# sourceMappingURL=chunk-
|
|
3520
|
-
//# sourceMappingURL=chunk-
|
|
3502
|
+
export { CodexHarness, checkCodexCli, checkCodexModels, checkCodexSignIn, codexCliRequirement, codexInformationRetrievalPrompt, codexSandboxAllowance, compareModels, createCodexWorker, installedCodex, listCodexModels, runCodex, taskProgressFromCodexTodo };
|
|
3503
|
+
//# sourceMappingURL=chunk-CUH5CP7W.js.map
|
|
3504
|
+
//# sourceMappingURL=chunk-CUH5CP7W.js.map
|