@right-link/paperclip-plugin-codex-remote 0.3.1
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/LICENSE +21 -0
- package/README.md +77 -0
- package/dist/cli/format-event.d.ts +2 -0
- package/dist/cli/format-event.d.ts.map +1 -0
- package/dist/cli/format-event.js +213 -0
- package/dist/cli/format-event.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/quota-probe.d.ts +3 -0
- package/dist/cli/quota-probe.d.ts.map +1 -0
- package/dist/cli/quota-probe.js +97 -0
- package/dist/cli/quota-probe.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +84 -0
- package/dist/index.js.map +1 -0
- package/dist/server/adapter.d.ts +16 -0
- package/dist/server/adapter.d.ts.map +1 -0
- package/dist/server/adapter.js +157 -0
- package/dist/server/adapter.js.map +1 -0
- package/dist/server/adapter.test.d.ts +2 -0
- package/dist/server/adapter.test.d.ts.map +1 -0
- package/dist/server/adapter.test.js +84 -0
- package/dist/server/adapter.test.js.map +1 -0
- package/dist/server/codex-args.d.ts +13 -0
- package/dist/server/codex-args.d.ts.map +1 -0
- package/dist/server/codex-args.js +60 -0
- package/dist/server/codex-args.js.map +1 -0
- package/dist/server/codex-args.test.d.ts +2 -0
- package/dist/server/codex-args.test.d.ts.map +1 -0
- package/dist/server/codex-args.test.js +94 -0
- package/dist/server/codex-args.test.js.map +1 -0
- package/dist/server/codex-home.d.ts +47 -0
- package/dist/server/codex-home.d.ts.map +1 -0
- package/dist/server/codex-home.js +378 -0
- package/dist/server/codex-home.js.map +1 -0
- package/dist/server/codex-home.test.d.ts +2 -0
- package/dist/server/codex-home.test.d.ts.map +1 -0
- package/dist/server/codex-home.test.js +244 -0
- package/dist/server/codex-home.test.js.map +1 -0
- package/dist/server/execute.d.ts +16 -0
- package/dist/server/execute.d.ts.map +1 -0
- package/dist/server/execute.js +906 -0
- package/dist/server/execute.js.map +1 -0
- package/dist/server/execute.remote.test.d.ts +2 -0
- package/dist/server/execute.remote.test.d.ts.map +1 -0
- package/dist/server/execute.remote.test.js +487 -0
- package/dist/server/execute.remote.test.js.map +1 -0
- package/dist/server/index.d.ts +8 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +57 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/parse.d.ts +22 -0
- package/dist/server/parse.d.ts.map +1 -0
- package/dist/server/parse.js +213 -0
- package/dist/server/parse.js.map +1 -0
- package/dist/server/parse.test.d.ts +2 -0
- package/dist/server/parse.test.d.ts.map +1 -0
- package/dist/server/parse.test.js +107 -0
- package/dist/server/parse.test.js.map +1 -0
- package/dist/server/quota-spawn-error.test.d.ts +2 -0
- package/dist/server/quota-spawn-error.test.d.ts.map +1 -0
- package/dist/server/quota-spawn-error.test.js +77 -0
- package/dist/server/quota-spawn-error.test.js.map +1 -0
- package/dist/server/quota.d.ts +64 -0
- package/dist/server/quota.d.ts.map +1 -0
- package/dist/server/quota.js +432 -0
- package/dist/server/quota.js.map +1 -0
- package/dist/server/sandbox-env.d.ts +4 -0
- package/dist/server/sandbox-env.d.ts.map +1 -0
- package/dist/server/sandbox-env.js +23 -0
- package/dist/server/sandbox-env.js.map +1 -0
- package/dist/server/skills.d.ts +8 -0
- package/dist/server/skills.d.ts.map +1 -0
- package/dist/server/skills.js +24 -0
- package/dist/server/skills.js.map +1 -0
- package/dist/server/tailscale.d.ts +24 -0
- package/dist/server/tailscale.d.ts.map +1 -0
- package/dist/server/tailscale.js +95 -0
- package/dist/server/tailscale.js.map +1 -0
- package/dist/server/test.d.ts +3 -0
- package/dist/server/test.d.ts.map +1 -0
- package/dist/server/test.js +811 -0
- package/dist/server/test.js.map +1 -0
- package/dist/server/test.remote.test.d.ts +2 -0
- package/dist/server/test.remote.test.d.ts.map +1 -0
- package/dist/server/test.remote.test.js +257 -0
- package/dist/server/test.remote.test.js.map +1 -0
- package/dist/ui/build-config.d.ts +3 -0
- package/dist/ui/build-config.d.ts.map +1 -0
- package/dist/ui/build-config.js +113 -0
- package/dist/ui/build-config.js.map +1 -0
- package/dist/ui/build-config.test.d.ts +2 -0
- package/dist/ui/build-config.test.d.ts.map +1 -0
- package/dist/ui/build-config.test.js +49 -0
- package/dist/ui/build-config.test.js.map +1 -0
- package/dist/ui/index.d.ts +3 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +3 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/parse-stdout.d.ts +3 -0
- package/dist/ui/parse-stdout.d.ts.map +1 -0
- package/dist/ui/parse-stdout.js +261 -0
- package/dist/ui/parse-stdout.js.map +1 -0
- package/dist/ui/parse-stdout.test.d.ts +2 -0
- package/dist/ui/parse-stdout.test.d.ts.map +1 -0
- package/dist/ui/parse-stdout.test.js +77 -0
- package/dist/ui/parse-stdout.test.js.map +1 -0
- package/dist/ui-parser.d.ts +2 -0
- package/dist/ui-parser.d.ts.map +1 -0
- package/dist/ui-parser.js +245 -0
- package/dist/ui-parser.js.map +1 -0
- package/package.json +69 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Paperclip AI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# paperclip-plugin-codex-remote
|
|
2
|
+
|
|
3
|
+
Runs **Codex inside a remote sandbox** (e.g. the `cloudflare-bridge` sandbox
|
|
4
|
+
provider) and lets the agent talk back to Paperclip through the runtime API
|
|
5
|
+
bridge. The agent owns task work, Git, PR creation, comments, and issue status
|
|
6
|
+
updates; this adapter owns sandbox setup, remote `CODEX_HOME` sync, preflight,
|
|
7
|
+
and clean finalization.
|
|
8
|
+
|
|
9
|
+
Adapter type: `codex_remote`.
|
|
10
|
+
|
|
11
|
+
## A standalone external adapter (no upstream changes)
|
|
12
|
+
|
|
13
|
+
This is a **fork add-on** packaged as an external adapter. Paperclip loads it
|
|
14
|
+
through the adapter-plugin store (`buildExternalAdapters` →
|
|
15
|
+
`createServerAdapter()`), so **nothing in upstream Paperclip is modified** — no
|
|
16
|
+
edits to `server/src/adapters/registry.ts`, `builtin-adapter-types.ts`, or any
|
|
17
|
+
core file. Upstream pulls apply conflict-free.
|
|
18
|
+
|
|
19
|
+
It is also fully **independent of `codex_local`**: it does not import, extend, or
|
|
20
|
+
fall back to the upstream codex-local adapter (an earlier experiment built it on
|
|
21
|
+
top of codex-local and was unstable). It ships its own `parse`, `skills`,
|
|
22
|
+
`quota`, `codex-home`, `codex-args`, `cli`, `ui`, and model lists, and depends
|
|
23
|
+
only on **published** `@paperclipai/adapter-utils` exports.
|
|
24
|
+
|
|
25
|
+
## Entry points
|
|
26
|
+
|
|
27
|
+
- `.` → `createServerAdapter()` — the complete `ServerAdapterModule` the host
|
|
28
|
+
loads. Folds the sandbox preflight/verify + remote defaults (`timeoutSec`
|
|
29
|
+
default, `dangerouslyBypassApprovalsAndSandbox`, `remoteWorkspaceSync: false`)
|
|
30
|
+
over the package's base `execute`/`testEnvironment`.
|
|
31
|
+
- `./server` — raw building blocks (`execute`, `skills`, `quota`, `sessionCodec`, …).
|
|
32
|
+
- `./meta` — isomorphic metadata (`models`, `modelProfiles`, `agentConfigurationDoc`).
|
|
33
|
+
- `./ui` — UI helpers (`parseCodexStdoutLine`, `buildCodexRemoteConfig`).
|
|
34
|
+
- `./cli` — quota probe CLI.
|
|
35
|
+
|
|
36
|
+
## Install
|
|
37
|
+
|
|
38
|
+
Build, then register the package with a Paperclip instance through the adapter
|
|
39
|
+
plugin store (Adapters page → install by package name, or a `localPath` record
|
|
40
|
+
pointing at this directory's built output):
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
paperclip-plugin-codex-remote
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
No restart-time wiring is required — the host picks it up via the plugin store
|
|
47
|
+
and registers the `codex_remote` adapter type.
|
|
48
|
+
|
|
49
|
+
## How a run works (happy path)
|
|
50
|
+
|
|
51
|
+
1. Acquire/resume a **per-issue** sandbox via the configured sandbox provider.
|
|
52
|
+
2. Verify the workspace (main + bridge session), sync a sanitized `CODEX_HOME`
|
|
53
|
+
(provider `config.toml`, no `auth.json`), install it at `/root/.codex`.
|
|
54
|
+
3. Start the runtime-API bridge so the agent can call Paperclip from inside the
|
|
55
|
+
sandbox.
|
|
56
|
+
4. Preflight, then run `codex exec` in the sandbox over the HTTP execution path.
|
|
57
|
+
5. The agent calls Paperclip via the bridge (fetch issue context, post comments,
|
|
58
|
+
`PATCH` issue status) and finalizes its own work.
|
|
59
|
+
|
|
60
|
+
## Configuration
|
|
61
|
+
|
|
62
|
+
See `agentConfigurationDoc` (exported from `./meta`) for the full field list.
|
|
63
|
+
|
|
64
|
+
## Not yet included
|
|
65
|
+
|
|
66
|
+
- **Custom UI run-log parser** — external adapters serve a self-contained,
|
|
67
|
+
zero-dependency worker module at `/api/adapters/:type/ui-parser.js`. The
|
|
68
|
+
package's `parse-stdout` logic isn't yet bundled into that worker-compatible
|
|
69
|
+
form, so the run log uses Paperclip's default rendering until a bundled
|
|
70
|
+
`./ui-parser` export is added. Functionality is unaffected.
|
|
71
|
+
|
|
72
|
+
## Build / test
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
pnpm --filter paperclip-plugin-codex-remote build
|
|
76
|
+
pnpm --filter paperclip-plugin-codex-remote exec vitest run
|
|
77
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-event.d.ts","sourceRoot":"","sources":["../../src/cli/format-event.ts"],"names":[],"mappings":"AA6IA,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAuFxE"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import pc from "picocolors";
|
|
2
|
+
function asRecord(value) {
|
|
3
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
4
|
+
return null;
|
|
5
|
+
return value;
|
|
6
|
+
}
|
|
7
|
+
function asString(value, fallback = "") {
|
|
8
|
+
return typeof value === "string" ? value : fallback;
|
|
9
|
+
}
|
|
10
|
+
function asNumber(value, fallback = 0) {
|
|
11
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
12
|
+
}
|
|
13
|
+
function errorText(value) {
|
|
14
|
+
if (typeof value === "string")
|
|
15
|
+
return value;
|
|
16
|
+
const rec = asRecord(value);
|
|
17
|
+
if (!rec)
|
|
18
|
+
return "";
|
|
19
|
+
const msg = (typeof rec.message === "string" && rec.message) ||
|
|
20
|
+
(typeof rec.error === "string" && rec.error) ||
|
|
21
|
+
(typeof rec.code === "string" && rec.code) ||
|
|
22
|
+
"";
|
|
23
|
+
if (msg)
|
|
24
|
+
return msg;
|
|
25
|
+
try {
|
|
26
|
+
return JSON.stringify(rec);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return "";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function printItemStarted(item) {
|
|
33
|
+
const itemType = asString(item.type);
|
|
34
|
+
if (itemType === "command_execution") {
|
|
35
|
+
const command = asString(item.command);
|
|
36
|
+
console.log(pc.yellow("tool_call: command_execution"));
|
|
37
|
+
if (command)
|
|
38
|
+
console.log(pc.gray(command));
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
if (itemType === "tool_use") {
|
|
42
|
+
const name = asString(item.name, "unknown");
|
|
43
|
+
console.log(pc.yellow(`tool_call: ${name}`));
|
|
44
|
+
if (item.input !== undefined) {
|
|
45
|
+
try {
|
|
46
|
+
console.log(pc.gray(JSON.stringify(item.input, null, 2)));
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
console.log(pc.gray(String(item.input)));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
function printItemCompleted(item) {
|
|
57
|
+
const itemType = asString(item.type);
|
|
58
|
+
if (itemType === "agent_message") {
|
|
59
|
+
const text = asString(item.text);
|
|
60
|
+
if (text)
|
|
61
|
+
console.log(pc.green(`assistant: ${text}`));
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
if (itemType === "reasoning") {
|
|
65
|
+
const text = asString(item.text);
|
|
66
|
+
if (text)
|
|
67
|
+
console.log(pc.gray(`thinking: ${text}`));
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
if (itemType === "tool_use") {
|
|
71
|
+
const name = asString(item.name, "unknown");
|
|
72
|
+
console.log(pc.yellow(`tool_call: ${name}`));
|
|
73
|
+
if (item.input !== undefined) {
|
|
74
|
+
try {
|
|
75
|
+
console.log(pc.gray(JSON.stringify(item.input, null, 2)));
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
console.log(pc.gray(String(item.input)));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
if (itemType === "command_execution") {
|
|
84
|
+
const command = asString(item.command);
|
|
85
|
+
const status = asString(item.status);
|
|
86
|
+
const exitCode = typeof item.exit_code === "number" && Number.isFinite(item.exit_code) ? item.exit_code : null;
|
|
87
|
+
const output = asString(item.aggregated_output).replace(/\s+$/, "");
|
|
88
|
+
const isError = (exitCode !== null && exitCode !== 0) ||
|
|
89
|
+
status === "failed" ||
|
|
90
|
+
status === "errored" ||
|
|
91
|
+
status === "error" ||
|
|
92
|
+
status === "cancelled";
|
|
93
|
+
const summaryParts = [
|
|
94
|
+
"tool_result: command_execution",
|
|
95
|
+
command ? `command="${command}"` : "",
|
|
96
|
+
status ? `status=${status}` : "",
|
|
97
|
+
exitCode !== null ? `exit_code=${exitCode}` : "",
|
|
98
|
+
].filter(Boolean);
|
|
99
|
+
console.log((isError ? pc.red : pc.cyan)(summaryParts.join(" ")));
|
|
100
|
+
if (output)
|
|
101
|
+
console.log((isError ? pc.red : pc.gray)(output));
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
if (itemType === "file_change") {
|
|
105
|
+
const changes = Array.isArray(item.changes) ? item.changes : [];
|
|
106
|
+
const entries = changes
|
|
107
|
+
.map((changeRaw) => asRecord(changeRaw))
|
|
108
|
+
.filter((change) => Boolean(change))
|
|
109
|
+
.map((change) => {
|
|
110
|
+
const kind = asString(change.kind, "update");
|
|
111
|
+
const path = asString(change.path, "unknown");
|
|
112
|
+
return `${kind} ${path}`;
|
|
113
|
+
});
|
|
114
|
+
const preview = entries.length > 0 ? entries.slice(0, 6).join(", ") : "none";
|
|
115
|
+
const more = entries.length > 6 ? ` (+${entries.length - 6} more)` : "";
|
|
116
|
+
console.log(pc.cyan(`file_change: ${preview}${more}`));
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
if (itemType === "error") {
|
|
120
|
+
const message = errorText(item.message ?? item.error ?? item);
|
|
121
|
+
if (message)
|
|
122
|
+
console.log(pc.red(`error: ${message}`));
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
if (itemType === "tool_result") {
|
|
126
|
+
const isError = item.is_error === true || asString(item.status) === "error";
|
|
127
|
+
const text = asString(item.content) || asString(item.result) || asString(item.output);
|
|
128
|
+
console.log((isError ? pc.red : pc.cyan)(`tool_result${isError ? " (error)" : ""}`));
|
|
129
|
+
if (text)
|
|
130
|
+
console.log((isError ? pc.red : pc.gray)(text));
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
export function printCodexStreamEvent(raw, _debug) {
|
|
136
|
+
const line = raw.trim();
|
|
137
|
+
if (!line)
|
|
138
|
+
return;
|
|
139
|
+
let parsed = null;
|
|
140
|
+
try {
|
|
141
|
+
parsed = JSON.parse(line);
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
console.log(line);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const type = asString(parsed.type);
|
|
148
|
+
if (type === "thread.started") {
|
|
149
|
+
const threadId = asString(parsed.thread_id);
|
|
150
|
+
const model = asString(parsed.model);
|
|
151
|
+
const details = [threadId ? `session: ${threadId}` : "", model ? `model: ${model}` : ""].filter(Boolean).join(", ");
|
|
152
|
+
console.log(pc.blue(`Codex thread started${details ? ` (${details})` : ""}`));
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (type === "turn.started") {
|
|
156
|
+
console.log(pc.blue("turn started"));
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (type === "item.started" || type === "item.completed") {
|
|
160
|
+
const item = asRecord(parsed.item);
|
|
161
|
+
if (item) {
|
|
162
|
+
const handled = type === "item.started"
|
|
163
|
+
? printItemStarted(item)
|
|
164
|
+
: printItemCompleted(item);
|
|
165
|
+
if (!handled) {
|
|
166
|
+
const itemType = asString(item.type, "unknown");
|
|
167
|
+
const id = asString(item.id);
|
|
168
|
+
const status = asString(item.status);
|
|
169
|
+
const meta = [id ? `id=${id}` : "", status ? `status=${status}` : ""].filter(Boolean).join(" ");
|
|
170
|
+
console.log(pc.gray(`${type}: ${itemType}${meta ? ` (${meta})` : ""}`));
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
console.log(pc.gray(type));
|
|
175
|
+
}
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (type === "turn.completed") {
|
|
179
|
+
const usage = asRecord(parsed.usage);
|
|
180
|
+
const input = asNumber(usage?.input_tokens);
|
|
181
|
+
const output = asNumber(usage?.output_tokens);
|
|
182
|
+
const cached = asNumber(usage?.cached_input_tokens, asNumber(usage?.cache_read_input_tokens));
|
|
183
|
+
const cost = asNumber(parsed.total_cost_usd);
|
|
184
|
+
const isError = parsed.is_error === true;
|
|
185
|
+
const subtype = asString(parsed.subtype);
|
|
186
|
+
const errors = Array.isArray(parsed.errors) ? parsed.errors.map(errorText).filter(Boolean) : [];
|
|
187
|
+
console.log(pc.blue(`tokens: in=${input} out=${output} cached=${cached} cost=$${cost.toFixed(6)}`));
|
|
188
|
+
if (subtype || isError || errors.length > 0) {
|
|
189
|
+
console.log(pc.red(`result: subtype=${subtype || "unknown"} is_error=${isError ? "true" : "false"}`));
|
|
190
|
+
if (errors.length > 0)
|
|
191
|
+
console.log(pc.red(`errors: ${errors.join(" | ")}`));
|
|
192
|
+
}
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (type === "turn.failed") {
|
|
196
|
+
const usage = asRecord(parsed.usage);
|
|
197
|
+
const input = asNumber(usage?.input_tokens);
|
|
198
|
+
const output = asNumber(usage?.output_tokens);
|
|
199
|
+
const cached = asNumber(usage?.cached_input_tokens, asNumber(usage?.cache_read_input_tokens));
|
|
200
|
+
const message = errorText(parsed.error ?? parsed.message);
|
|
201
|
+
console.log(pc.red(`turn failed${message ? `: ${message}` : ""}`));
|
|
202
|
+
console.log(pc.blue(`tokens: in=${input} out=${output} cached=${cached}`));
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (type === "error") {
|
|
206
|
+
const message = errorText(parsed.message ?? parsed.error ?? parsed);
|
|
207
|
+
if (message)
|
|
208
|
+
console.log(pc.red(`error: ${message}`));
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
console.log(line);
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=format-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-event.js","sourceRoot":"","sources":["../../src/cli/format-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,SAAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACrF,OAAO,KAAgC,CAAC;AAC1C,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc,EAAE,QAAQ,GAAG,EAAE;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AACtD,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc,EAAE,QAAQ,GAAG,CAAC;IAC5C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AAChF,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,IAAI,OAAO,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O,EAAE,CAAC,CAAC,CAAC;QACtD,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quota-probe.d.ts","sourceRoot":"","sources":["../../src/cli/quota-probe.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { fetchCodexQuota, fetchCodexRpcQuota, getQuotaWindows, readCodexAuthInfo, readCodexToken, } from "../server/quota.js";
|
|
3
|
+
function parseArgs(argv) {
|
|
4
|
+
return {
|
|
5
|
+
json: argv.includes("--json"),
|
|
6
|
+
rpcOnly: argv.includes("--rpc-only"),
|
|
7
|
+
whamOnly: argv.includes("--wham-only"),
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function stringifyError(error) {
|
|
11
|
+
return error instanceof Error ? error.message : String(error);
|
|
12
|
+
}
|
|
13
|
+
async function main() {
|
|
14
|
+
const args = parseArgs(process.argv.slice(2));
|
|
15
|
+
if (args.rpcOnly && args.whamOnly) {
|
|
16
|
+
throw new Error("Choose either --rpc-only or --wham-only, not both.");
|
|
17
|
+
}
|
|
18
|
+
const auth = await readCodexAuthInfo();
|
|
19
|
+
const token = await readCodexToken();
|
|
20
|
+
const result = {
|
|
21
|
+
timestamp: new Date().toISOString(),
|
|
22
|
+
auth,
|
|
23
|
+
tokenAvailable: token != null,
|
|
24
|
+
};
|
|
25
|
+
if (!args.whamOnly) {
|
|
26
|
+
try {
|
|
27
|
+
result.rpc = {
|
|
28
|
+
ok: true,
|
|
29
|
+
...(await fetchCodexRpcQuota()),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
result.rpc = {
|
|
34
|
+
ok: false,
|
|
35
|
+
error: stringifyError(error),
|
|
36
|
+
windows: [],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (!args.rpcOnly) {
|
|
41
|
+
if (!token) {
|
|
42
|
+
result.wham = {
|
|
43
|
+
ok: false,
|
|
44
|
+
error: "No local Codex auth token found in ~/.codex/auth.json.",
|
|
45
|
+
windows: [],
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
try {
|
|
50
|
+
result.wham = {
|
|
51
|
+
ok: true,
|
|
52
|
+
windows: await fetchCodexQuota(token.token, token.accountId),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
result.wham = {
|
|
57
|
+
ok: false,
|
|
58
|
+
error: stringifyError(error),
|
|
59
|
+
windows: [],
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (!args.rpcOnly && !args.whamOnly) {
|
|
65
|
+
try {
|
|
66
|
+
result.aggregated = await getQuotaWindows();
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
result.aggregated = {
|
|
70
|
+
ok: false,
|
|
71
|
+
error: stringifyError(error),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const rpcOk = result.rpc?.ok === true;
|
|
76
|
+
const whamOk = result.wham?.ok === true;
|
|
77
|
+
const aggregatedOk = result.aggregated?.ok === true;
|
|
78
|
+
const ok = rpcOk || whamOk || aggregatedOk;
|
|
79
|
+
if (args.json || process.stdout.isTTY === false) {
|
|
80
|
+
console.log(JSON.stringify({ ok, ...result }, null, 2));
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
console.log(`timestamp: ${result.timestamp}`);
|
|
84
|
+
console.log(`auth: ${JSON.stringify(auth)}`);
|
|
85
|
+
console.log(`tokenAvailable: ${token != null}`);
|
|
86
|
+
if (result.rpc)
|
|
87
|
+
console.log(`rpc: ${JSON.stringify(result.rpc, null, 2)}`);
|
|
88
|
+
if (result.wham)
|
|
89
|
+
console.log(`wham: ${JSON.stringify(result.wham, null, 2)}`);
|
|
90
|
+
if (result.aggregated)
|
|
91
|
+
console.log(`aggregated: ${JSON.stringify(result.aggregated, null, 2)}`);
|
|
92
|
+
}
|
|
93
|
+
if (!ok)
|
|
94
|
+
process.exitCode = 1;
|
|
95
|
+
}
|
|
96
|
+
await main();
|
|
97
|
+
//# sourceMappingURL=quota-probe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quota-probe.js","sourceRoot":"","sources":["../../src/cli/quota-probe.ts"],"names":[],"mappings":";AAEA,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,cAAc,GACf,MAAM,oBAAoB,CAAC;AAQ5B,SAAS,SAAS,CAAC,IAAc;IAC/B,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC7B,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;QACpC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC;KACvC,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC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C;QAChD,IAAI,MAAM,CAAC,GAAG;YAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAC3E,IAAI,MAAM,CAAC,IAAI;YAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAC9E,IAAI,MAAM,CAAC,UAAU;YAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAClG,CAAC;IAED,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AdapterModelProfileDefinition } from "@paperclipai/adapter-utils";
|
|
2
|
+
export declare const type = "codex_remote";
|
|
3
|
+
export declare const label = "Codex (remote)";
|
|
4
|
+
export declare const SANDBOX_INSTALL_COMMAND = "npm install -g @openai/codex";
|
|
5
|
+
export declare const DEFAULT_CODEX_REMOTE_MODEL = "gpt-5.3-codex";
|
|
6
|
+
export declare const DEFAULT_CODEX_REMOTE_BYPASS_APPROVALS_AND_SANDBOX = true;
|
|
7
|
+
export declare const CODEX_REMOTE_FAST_MODE_SUPPORTED_MODELS: readonly ["gpt-5.4"];
|
|
8
|
+
export declare function isCodexRemoteKnownModel(model: string | null | undefined): boolean;
|
|
9
|
+
export declare function isCodexRemoteManualModel(model: string | null | undefined): boolean;
|
|
10
|
+
export declare function isCodexRemoteFastModeSupported(model: string | null | undefined): boolean;
|
|
11
|
+
export declare const models: {
|
|
12
|
+
id: string;
|
|
13
|
+
label: string;
|
|
14
|
+
}[];
|
|
15
|
+
export declare const modelProfiles: AdapterModelProfileDefinition[];
|
|
16
|
+
export declare const agentConfigurationDoc = "# codex_remote agent configuration\n\nAdapter: codex_remote\n\nCore fields:\n- cwd (string, optional): default absolute working directory fallback for the agent process (created if missing when possible)\n- instructionsFilePath (string, optional): absolute path to a markdown instructions file prepended to stdin prompt at runtime\n- model (string, optional): Codex model id\n- modelReasoningEffort (string, optional): reasoning effort override (minimal|low|medium|high|xhigh) passed via -c model_reasoning_effort=...\n- promptTemplate (string, optional): run prompt template\n- search (boolean, optional): run codex with --search\n- fastMode (boolean, optional): enable Codex Fast mode; supported on GPT-5.4 and passed through for manual model IDs\n- dangerouslyBypassApprovalsAndSandbox (boolean, optional): run with bypass flag\n- command (string, optional): defaults to \"codex\"\n- extraArgs (string[], optional): additional CLI args\n- env (object, optional): KEY=VALUE environment variables\n- workspaceStrategy (object, optional): execution workspace strategy; currently supports { type: \"git_worktree\", baseRef?, branchTemplate?, worktreeParentDir? }\n- workspaceRuntime (object, optional): reserved for workspace runtime metadata; workspace runtime services are manually controlled from the workspace UI and are not auto-started by heartbeats\n\nOperational fields:\n- timeoutSec (number, optional): run timeout in seconds\n- graceSec (number, optional): SIGTERM grace period in seconds\n\nNotes:\n- Prompts are piped via stdin (Codex receives \"-\" prompt argument).\n- If instructionsFilePath is configured, Paperclip prepends that file's contents to the stdin prompt on every run.\n- Codex exec automatically applies repo-scoped AGENTS.md instructions from the active workspace. Paperclip cannot suppress that discovery in exec mode, so repo AGENTS.md files may still apply even when you only configured an explicit instructionsFilePath.\n- Paperclip injects desired local skills into the effective CODEX_HOME/skills/ directory at execution time so Codex can discover \"$paperclip\" and related skills without polluting the project working directory. In managed-home mode (the default) this is ~/.paperclip/instances/<id>/companies/<companyId>/codex-home/skills/; when CODEX_HOME is explicitly overridden in adapter config, that override is used instead.\n- Unless explicitly overridden in adapter config, Paperclip runs Codex with a per-company managed CODEX_HOME under the active Paperclip instance and seeds auth/config from the shared Codex home (the CODEX_HOME env var, when set, or ~/.codex).\n- Some model/tool combinations reject certain effort levels (for example minimal with web search enabled).\n- Fast mode is supported on GPT-5.4 and manual model IDs. When enabled for those models, Paperclip applies `service_tier=\"fast\"` and `features.fast_mode=true`.\n- When Paperclip realizes a workspace/runtime for a run, it injects PAPERCLIP_WORKSPACE_* and PAPERCLIP_RUNTIME_* env vars for agent-side tooling.\n";
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAEhF,eAAO,MAAM,IAAI,iBAAiB,CAAC;AACnC,eAAO,MAAM,KAAK,mBAAmB,CAAC;AAEtC,eAAO,MAAM,uBAAuB,iCAAiC,CAAC;AAEtE,eAAO,MAAM,0BAA0B,kBAAkB,CAAC;AAC1D,eAAO,MAAM,iDAAiD,OAAO,CAAC;AACtE,eAAO,MAAM,uCAAuC,sBAAuB,CAAC;AAM5E,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAIjF;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAGlF;AAED,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAMxF;AAED,eAAO,MAAM,MAAM;;;GAWlB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,6BAA6B,EAYxD,CAAC;AAEF,eAAO,MAAM,qBAAqB,+9FAgCjC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export const type = "codex_remote";
|
|
2
|
+
export const label = "Codex (remote)";
|
|
3
|
+
export const SANDBOX_INSTALL_COMMAND = "npm install -g @openai/codex";
|
|
4
|
+
export const DEFAULT_CODEX_REMOTE_MODEL = "gpt-5.3-codex";
|
|
5
|
+
export const DEFAULT_CODEX_REMOTE_BYPASS_APPROVALS_AND_SANDBOX = true;
|
|
6
|
+
export const CODEX_REMOTE_FAST_MODE_SUPPORTED_MODELS = ["gpt-5.4"];
|
|
7
|
+
function normalizeModelId(model) {
|
|
8
|
+
return typeof model === "string" ? model.trim() : "";
|
|
9
|
+
}
|
|
10
|
+
export function isCodexRemoteKnownModel(model) {
|
|
11
|
+
const normalizedModel = normalizeModelId(model);
|
|
12
|
+
if (!normalizedModel)
|
|
13
|
+
return false;
|
|
14
|
+
return models.some((entry) => entry.id === normalizedModel);
|
|
15
|
+
}
|
|
16
|
+
export function isCodexRemoteManualModel(model) {
|
|
17
|
+
const normalizedModel = normalizeModelId(model);
|
|
18
|
+
return Boolean(normalizedModel) && !isCodexRemoteKnownModel(normalizedModel);
|
|
19
|
+
}
|
|
20
|
+
export function isCodexRemoteFastModeSupported(model) {
|
|
21
|
+
if (isCodexRemoteManualModel(model))
|
|
22
|
+
return true;
|
|
23
|
+
const normalizedModel = typeof model === "string" ? model.trim() : "";
|
|
24
|
+
return CODEX_REMOTE_FAST_MODE_SUPPORTED_MODELS.includes(normalizedModel);
|
|
25
|
+
}
|
|
26
|
+
export const models = [
|
|
27
|
+
{ id: "gpt-5.4", label: "gpt-5.4" },
|
|
28
|
+
{ id: DEFAULT_CODEX_REMOTE_MODEL, label: DEFAULT_CODEX_REMOTE_MODEL },
|
|
29
|
+
{ id: "gpt-5.3-codex-spark", label: "gpt-5.3-codex-spark" },
|
|
30
|
+
{ id: "gpt-5", label: "gpt-5" },
|
|
31
|
+
{ id: "o3", label: "o3" },
|
|
32
|
+
{ id: "o4-mini", label: "o4-mini" },
|
|
33
|
+
{ id: "gpt-5-mini", label: "gpt-5-mini" },
|
|
34
|
+
{ id: "gpt-5-nano", label: "gpt-5-nano" },
|
|
35
|
+
{ id: "o3-mini", label: "o3-mini" },
|
|
36
|
+
{ id: "codex-mini-latest", label: "Codex Mini" },
|
|
37
|
+
];
|
|
38
|
+
export const modelProfiles = [
|
|
39
|
+
{
|
|
40
|
+
key: "cheap",
|
|
41
|
+
label: "Cheap",
|
|
42
|
+
description: "Use the lowest-cost known Codex local model lane without changing the primary model.",
|
|
43
|
+
adapterConfig: {
|
|
44
|
+
model: "gpt-5.3-codex-spark",
|
|
45
|
+
// Spark is the cheap lane by model price; high effort keeps Codex coding behavior usable for delegated work.
|
|
46
|
+
modelReasoningEffort: "high",
|
|
47
|
+
},
|
|
48
|
+
source: "adapter_default",
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
export const agentConfigurationDoc = `# codex_remote agent configuration
|
|
52
|
+
|
|
53
|
+
Adapter: codex_remote
|
|
54
|
+
|
|
55
|
+
Core fields:
|
|
56
|
+
- cwd (string, optional): default absolute working directory fallback for the agent process (created if missing when possible)
|
|
57
|
+
- instructionsFilePath (string, optional): absolute path to a markdown instructions file prepended to stdin prompt at runtime
|
|
58
|
+
- model (string, optional): Codex model id
|
|
59
|
+
- modelReasoningEffort (string, optional): reasoning effort override (minimal|low|medium|high|xhigh) passed via -c model_reasoning_effort=...
|
|
60
|
+
- promptTemplate (string, optional): run prompt template
|
|
61
|
+
- search (boolean, optional): run codex with --search
|
|
62
|
+
- fastMode (boolean, optional): enable Codex Fast mode; supported on GPT-5.4 and passed through for manual model IDs
|
|
63
|
+
- dangerouslyBypassApprovalsAndSandbox (boolean, optional): run with bypass flag
|
|
64
|
+
- command (string, optional): defaults to "codex"
|
|
65
|
+
- extraArgs (string[], optional): additional CLI args
|
|
66
|
+
- env (object, optional): KEY=VALUE environment variables
|
|
67
|
+
- workspaceStrategy (object, optional): execution workspace strategy; currently supports { type: "git_worktree", baseRef?, branchTemplate?, worktreeParentDir? }
|
|
68
|
+
- workspaceRuntime (object, optional): reserved for workspace runtime metadata; workspace runtime services are manually controlled from the workspace UI and are not auto-started by heartbeats
|
|
69
|
+
|
|
70
|
+
Operational fields:
|
|
71
|
+
- timeoutSec (number, optional): run timeout in seconds
|
|
72
|
+
- graceSec (number, optional): SIGTERM grace period in seconds
|
|
73
|
+
|
|
74
|
+
Notes:
|
|
75
|
+
- Prompts are piped via stdin (Codex receives "-" prompt argument).
|
|
76
|
+
- If instructionsFilePath is configured, Paperclip prepends that file's contents to the stdin prompt on every run.
|
|
77
|
+
- Codex exec automatically applies repo-scoped AGENTS.md instructions from the active workspace. Paperclip cannot suppress that discovery in exec mode, so repo AGENTS.md files may still apply even when you only configured an explicit instructionsFilePath.
|
|
78
|
+
- Paperclip injects desired local skills into the effective CODEX_HOME/skills/ directory at execution time so Codex can discover "$paperclip" and related skills without polluting the project working directory. In managed-home mode (the default) this is ~/.paperclip/instances/<id>/companies/<companyId>/codex-home/skills/; when CODEX_HOME is explicitly overridden in adapter config, that override is used instead.
|
|
79
|
+
- Unless explicitly overridden in adapter config, Paperclip runs Codex with a per-company managed CODEX_HOME under the active Paperclip instance and seeds auth/config from the shared Codex home (the CODEX_HOME env var, when set, or ~/.codex).
|
|
80
|
+
- Some model/tool combinations reject certain effort levels (for example minimal with web search enabled).
|
|
81
|
+
- Fast mode is supported on GPT-5.4 and manual model IDs. When enabled for those models, Paperclip applies \`service_tier="fast"\` and \`features.fast_mode=true\`.
|
|
82
|
+
- When Paperclip realizes a workspace/runtime for a run, it injects PAPERCLIP_WORKSPACE_* and PAPERCLIP_RUNTIME_* env vars for agent-side tooling.
|
|
83
|
+
`;
|
|
84
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,IAAI,GAAG,cAAc,CAAC;AACnC,MAAM,CAAC,MAAM,KAAK,GAAG,gBAAgB,CAAC;AAEtC,MAAM,CAAC,MAAM,uBAAuB,GAAG,8BAA8B,CAAC;AAEtE,MAAM,CAAC,MAAM,0BAA0B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EAAE,KAAK,EAAE,qBAAqB,EAAE;IAC3D,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;IAC/B,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;IACzB,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;IACnC,EAAE,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;IACzC,EAAE,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;IACzC,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;IACnC,EAAE,EAAE,EAAE,mBAAmB,EAAE,KAAK,EAAE,YAAY,EAAE;CACjD,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAoC;IAC5D;QACE,GAAG,EAAE,OAAO;QACZ,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,sFAAsF;QACnG,aAAa,EAAE;YACb,KAAK,EAAE,qBAAqB;YAC5B,6GAA6G;YAC7G,oBAAoB,EAAE,MAAM;SAC7B;QACD,MAAM,EAAE,iBAAiB;KAC1B;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCpC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External adapter entry point.
|
|
3
|
+
*
|
|
4
|
+
* Paperclip's adapter-plugin store loads an external adapter package by
|
|
5
|
+
* importing its main entry and calling `createServerAdapter()`, which must
|
|
6
|
+
* return a complete `ServerAdapterModule`. This module assembles the
|
|
7
|
+
* standalone codex_remote adapter from the package's own building blocks plus
|
|
8
|
+
* the sandbox preflight / remote-default behavior that previously lived in a
|
|
9
|
+
* host-side registry wrapper — so nothing needs to change in upstream
|
|
10
|
+
* Paperclip to register this adapter.
|
|
11
|
+
*/
|
|
12
|
+
import { type ServerAdapterModule } from "@paperclipai/adapter-utils";
|
|
13
|
+
export declare const CODEX_REMOTE_TYPE = "codex_remote";
|
|
14
|
+
export declare function applyCodexRemoteDefaults(config: Record<string, unknown>): Record<string, unknown>;
|
|
15
|
+
export declare function createServerAdapter(): ServerAdapterModule;
|
|
16
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/server/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAML,KAAK,mBAAmB,EACzB,MAAM,4BAA4B,CAAC;AAapC,eAAO,MAAM,iBAAiB,iBAAO,CAAC;AAyCtC,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAYjG;AA2FD,wBAAgB,mBAAmB,IAAI,mBAAmB,CAwBzD"}
|