maestro-agent-sdk 0.1.26 → 0.1.28
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 +20 -0
- package/dist/core/agent.d.ts +28 -0
- package/dist/core/agent.d.ts.map +1 -1
- package/dist/core/agent.js +2 -0
- package/dist/core/agent.js.map +1 -1
- package/dist/core/is-abort-error.d.ts +18 -0
- package/dist/core/is-abort-error.d.ts.map +1 -1
- package/dist/core/is-abort-error.js +34 -0
- package/dist/core/is-abort-error.js.map +1 -1
- package/dist/core/loop.d.ts.map +1 -1
- package/dist/core/loop.js +69 -14
- package/dist/core/loop.js.map +1 -1
- package/dist/core/tool-result-truncation.d.ts +34 -0
- package/dist/core/tool-result-truncation.d.ts.map +1 -0
- package/dist/core/tool-result-truncation.js +162 -0
- package/dist/core/tool-result-truncation.js.map +1 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/memory/active-task-template.d.ts +7 -4
- package/dist/memory/active-task-template.d.ts.map +1 -1
- package/dist/memory/active-task-template.js +19 -4
- package/dist/memory/active-task-template.js.map +1 -1
- package/dist/memory/aux-model-map.d.ts +49 -0
- package/dist/memory/aux-model-map.d.ts.map +1 -0
- package/dist/memory/aux-model-map.js +103 -0
- package/dist/memory/aux-model-map.js.map +1 -0
- package/dist/memory/compressor.d.ts +34 -59
- package/dist/memory/compressor.d.ts.map +1 -1
- package/dist/memory/compressor.js +222 -89
- package/dist/memory/compressor.js.map +1 -1
- package/dist/platform/config.d.ts +5 -0
- package/dist/platform/config.d.ts.map +1 -1
- package/dist/platform/config.js +9 -0
- package/dist/platform/config.js.map +1 -1
- package/dist/platform/version.d.ts +1 -1
- package/dist/platform/version.js +1 -1
- package/dist/provider.d.ts +18 -6
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +71 -8
- package/dist/provider.js.map +1 -1
- package/dist/providers/codex-auth.d.ts +149 -0
- package/dist/providers/codex-auth.d.ts.map +1 -0
- package/dist/providers/codex-auth.js +332 -0
- package/dist/providers/codex-auth.js.map +1 -0
- package/dist/providers/codex-stream.d.ts +42 -0
- package/dist/providers/codex-stream.d.ts.map +1 -0
- package/dist/providers/codex-stream.js +330 -0
- package/dist/providers/codex-stream.js.map +1 -0
- package/dist/providers/codex-translators.d.ts +105 -0
- package/dist/providers/codex-translators.d.ts.map +1 -0
- package/dist/providers/codex-translators.js +244 -0
- package/dist/providers/codex-translators.js.map +1 -0
- package/dist/providers/codex.d.ts +145 -0
- package/dist/providers/codex.d.ts.map +1 -0
- package/dist/providers/codex.js +417 -0
- package/dist/providers/codex.js.map +1 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +25 -1
- package/dist/registry.js.map +1 -1
- package/dist/types.d.ts +24 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +17 -1
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CodexResponsesProvider — call OpenAI's Responses API through the ChatGPT
|
|
3
|
+
* Codex backend using a `codex login` OAuth token.
|
|
4
|
+
*
|
|
5
|
+
* High-level shape:
|
|
6
|
+
*
|
|
7
|
+
* ┌────────────────────────┐ ┌──────────────────────────────────────┐
|
|
8
|
+
* │ AIAgent loop │ │ CodexResponsesProvider │
|
|
9
|
+
* │ ProviderMessage[] ─┼───▶│ - resolveAccessToken (refresh-aware)│
|
|
10
|
+
* │ │ │ - translateMessagesToResponses │
|
|
11
|
+
* │ │ │ - translateToolsToResponses │
|
|
12
|
+
* │ │ │ - POST /responses (stream:true) │
|
|
13
|
+
* │ ProviderStreamChunk ◀┼────│ - parseCodexStream │
|
|
14
|
+
* └────────────────────────┘ └──────────────────────────────────────┘
|
|
15
|
+
*
|
|
16
|
+
* Pinned constraints (verified empirically against
|
|
17
|
+
* `https://chatgpt.com/backend-api/codex/responses` on 2026-05-23):
|
|
18
|
+
*
|
|
19
|
+
* - **Stream is required**: non-streaming requests return
|
|
20
|
+
* `400 {"detail":"Stream must be set to true"}`.
|
|
21
|
+
* - **Model whitelist**: ChatGPT-account requests are limited to a small
|
|
22
|
+
* set of codex-issued model slugs (`gpt-5.5`, `gpt-5.4`, `gpt-5.4-mini`,
|
|
23
|
+
* `gpt-5.3-codex`, `gpt-5.2`, ...). Passing `gpt-5` returns 400 with
|
|
24
|
+
* `not supported when using Codex with a ChatGPT account`.
|
|
25
|
+
* - **Cloudflare headers required**: `originator: codex_cli_rs` plus a
|
|
26
|
+
* codex-shaped `User-Agent` are mandatory on non-residential IPs.
|
|
27
|
+
* - **`store: false`**: required when the rollout lives on the client side.
|
|
28
|
+
* Without it, the server expects subsequent requests to look items up
|
|
29
|
+
* by `id` and 404s when they can't.
|
|
30
|
+
*
|
|
31
|
+
* What this provider does NOT cover (deliberate scope cuts):
|
|
32
|
+
*
|
|
33
|
+
* - Reasoning chain replay across turns (would need `encrypted_content`
|
|
34
|
+
* plumbed into the message history). Reasoning summaries flow through
|
|
35
|
+
* as `thinking` blocks for the current turn only.
|
|
36
|
+
* - Built-in hosted tools (`web_search`, `file_search`). Only
|
|
37
|
+
* user-supplied function tools are wired.
|
|
38
|
+
* - Token-bucket rate-limit handling. The backend rate-limits aggressively
|
|
39
|
+
* for free accounts; surfacing a structured retry hint can be a follow-up.
|
|
40
|
+
*
|
|
41
|
+
* Hermes reference: `agent/transports/codex.py` + `_run_codex_stream`. We
|
|
42
|
+
* implement the same wire contract using only `fetch` and the SSE parser in
|
|
43
|
+
* `codex-stream.ts`, with no httpx / OpenAI SDK dependency.
|
|
44
|
+
*/
|
|
45
|
+
import { logger } from "../platform/logger.js";
|
|
46
|
+
import { cloudflareHeaders, resolveAccessToken, } from "../providers/codex-auth.js";
|
|
47
|
+
import { parseCodexStream } from "../providers/codex-stream.js";
|
|
48
|
+
import { translateMessagesToResponses, translateToolsToResponses, } from "../providers/codex-translators.js";
|
|
49
|
+
/** Default base URL — the ChatGPT-hosted Codex endpoint. Hosts that point at
|
|
50
|
+
* an alternate proxy (corporate gateway, mock server for tests) can override
|
|
51
|
+
* via the constructor opts.baseUrl. */
|
|
52
|
+
const DEFAULT_CODEX_BASE_URL = "https://chatgpt.com/backend-api/codex";
|
|
53
|
+
/**
|
|
54
|
+
* Map maestro's `EffortLevel` to the Responses API `reasoning.effort` string.
|
|
55
|
+
*
|
|
56
|
+
* Codex backend accepts `low | medium | high | xhigh`. The 5-tier maestro
|
|
57
|
+
* scale collapses as follows:
|
|
58
|
+
* - `low` / `medium` / `high` → direct passthrough.
|
|
59
|
+
* - `xhigh` → passthrough (Codex actually supports this tier on gpt-5.x).
|
|
60
|
+
* - `max` → `xhigh`. Codex has no `max`; we pick the deepest tier the
|
|
61
|
+
* backend exposes rather than silently dropping the user's intent.
|
|
62
|
+
*/
|
|
63
|
+
export function effortForCodex(e) {
|
|
64
|
+
switch (e) {
|
|
65
|
+
case "low":
|
|
66
|
+
return "low";
|
|
67
|
+
case "medium":
|
|
68
|
+
return "medium";
|
|
69
|
+
case "high":
|
|
70
|
+
return "high";
|
|
71
|
+
case "xhigh":
|
|
72
|
+
return "xhigh";
|
|
73
|
+
case "max":
|
|
74
|
+
return "xhigh";
|
|
75
|
+
default:
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Provider implementation. Construct once per process; safe to share across
|
|
81
|
+
* concurrent agent turns (token refresh is best-effort idempotent under the
|
|
82
|
+
* skew check + on-disk persistence).
|
|
83
|
+
*/
|
|
84
|
+
export class CodexResponsesProvider {
|
|
85
|
+
baseUrl;
|
|
86
|
+
refreshTimeoutMs;
|
|
87
|
+
refreshSkewSeconds;
|
|
88
|
+
fetchTimeoutMs;
|
|
89
|
+
constructor(opts = {}) {
|
|
90
|
+
this.baseUrl = (opts.baseUrl ?? DEFAULT_CODEX_BASE_URL).replace(/\/+$/, "");
|
|
91
|
+
this.refreshTimeoutMs = opts.refreshTimeoutMs ?? 20_000;
|
|
92
|
+
this.refreshSkewSeconds = opts.refreshSkewSeconds;
|
|
93
|
+
this.fetchTimeoutMs = opts.fetchTimeoutMs ?? 600_000;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Build the AbortSignal we pass to `fetch`. Combines an explicit
|
|
97
|
+
* wall-clock timeout (`this.fetchTimeoutMs`) with the caller's optional
|
|
98
|
+
* abort signal so either path can short-circuit the request:
|
|
99
|
+
* - User abort fires → request cancels immediately.
|
|
100
|
+
* - Timeout fires → DOMException(name="TimeoutError") surfaces, which
|
|
101
|
+
* the v0.1.28 `isTimeoutError` helper catches in `provider.ts`.
|
|
102
|
+
*
|
|
103
|
+
* Why explicit timeout: Bun's undici default `headersTimeout` is 300_000
|
|
104
|
+
* ms (5 min) and fires regardless of user signal. Long requests on the
|
|
105
|
+
* heavy gpt-5.* tiers with large bodies blew through that wall in
|
|
106
|
+
* production. We raise the ceiling to 10 minutes (configurable) and pin
|
|
107
|
+
* the same value across the initial POST and the 401-refresh retry below.
|
|
108
|
+
*/
|
|
109
|
+
buildFetchSignal(userSignal) {
|
|
110
|
+
const timeoutSignal = AbortSignal.timeout(this.fetchTimeoutMs);
|
|
111
|
+
if (!userSignal)
|
|
112
|
+
return timeoutSignal;
|
|
113
|
+
return AbortSignal.any([userSignal, timeoutSignal]);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Factory parity with `DeepseekProvider.fromEnv()` — for Codex the "env"
|
|
117
|
+
* inputs are really the on-disk `~/.codex/auth.json` (no API key env var
|
|
118
|
+
* makes sense for OAuth). The factory still throws early if the auth file
|
|
119
|
+
* is missing or stale, so a host can fail fast at startup instead of on
|
|
120
|
+
* the first user message.
|
|
121
|
+
*/
|
|
122
|
+
static fromEnv(opts = {}) {
|
|
123
|
+
return new CodexResponsesProvider(opts);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Streaming entry point. The Codex backend rejects non-streaming requests
|
|
127
|
+
* outright, so this is the load-bearing method — `complete()` is just a
|
|
128
|
+
* convenience wrapper around it.
|
|
129
|
+
*/
|
|
130
|
+
async *stream(opts) {
|
|
131
|
+
// v0.1.28 diagnostic instrumentation. The gpt-5.5 swap reproducer
|
|
132
|
+
// surfaced "The operation timed out" as the bare error message bubbled
|
|
133
|
+
// through `maestroProvider`'s catch. We don't yet know which hop —
|
|
134
|
+
// OAuth refresh (`codex-auth.ts`), `/responses` POST below, or SSE
|
|
135
|
+
// stream parse — actually raises it. Each `logger.*` line below stamps
|
|
136
|
+
// a phase + elapsed time so the next reproduction pinpoints the source.
|
|
137
|
+
const streamStart = Date.now();
|
|
138
|
+
const tokenStart = Date.now();
|
|
139
|
+
let token;
|
|
140
|
+
try {
|
|
141
|
+
token = await resolveAccessToken({
|
|
142
|
+
timeoutMs: this.refreshTimeoutMs,
|
|
143
|
+
...(this.refreshSkewSeconds !== undefined
|
|
144
|
+
? { skewSeconds: this.refreshSkewSeconds }
|
|
145
|
+
: {}),
|
|
146
|
+
});
|
|
147
|
+
logger.info({ model: opts.model, elapsedMs: Date.now() - tokenStart }, "codex: resolveAccessToken OK");
|
|
148
|
+
}
|
|
149
|
+
catch (e) {
|
|
150
|
+
logger.error({
|
|
151
|
+
phase: "resolveAccessToken",
|
|
152
|
+
elapsedMs: Date.now() - tokenStart,
|
|
153
|
+
model: opts.model,
|
|
154
|
+
errName: e instanceof Error ? e.name : typeof e,
|
|
155
|
+
errCode: e?.code,
|
|
156
|
+
errMessage: e instanceof Error ? e.message : String(e),
|
|
157
|
+
errCause: e?.cause,
|
|
158
|
+
stack: e instanceof Error ? e.stack : undefined,
|
|
159
|
+
}, "codex: resolveAccessToken FAILED");
|
|
160
|
+
throw e;
|
|
161
|
+
}
|
|
162
|
+
const body = buildRequestBody(opts);
|
|
163
|
+
const url = `${this.baseUrl}/responses`;
|
|
164
|
+
const headers = {
|
|
165
|
+
...cloudflareHeaders(token),
|
|
166
|
+
"Content-Type": "application/json",
|
|
167
|
+
Accept: "text/event-stream",
|
|
168
|
+
};
|
|
169
|
+
const init = {
|
|
170
|
+
method: "POST",
|
|
171
|
+
headers,
|
|
172
|
+
body: JSON.stringify(body),
|
|
173
|
+
// v0.1.28+: bundled user-abort + wall-clock timeout. See
|
|
174
|
+
// `buildFetchSignal` for the rationale; the default ceiling is
|
|
175
|
+
// 10 minutes, configurable via `CodexProviderOptions.fetchTimeoutMs`.
|
|
176
|
+
signal: this.buildFetchSignal(opts.abortSignal),
|
|
177
|
+
};
|
|
178
|
+
const responseStart = Date.now();
|
|
179
|
+
logger.info({
|
|
180
|
+
url,
|
|
181
|
+
model: opts.model,
|
|
182
|
+
bodyBytes: init.body.length,
|
|
183
|
+
fetchTimeoutMs: this.fetchTimeoutMs,
|
|
184
|
+
}, "codex: /responses fetch start");
|
|
185
|
+
let response;
|
|
186
|
+
try {
|
|
187
|
+
response = await fetch(url, init);
|
|
188
|
+
logger.info({
|
|
189
|
+
status: response.status,
|
|
190
|
+
elapsedMs: Date.now() - responseStart,
|
|
191
|
+
model: opts.model,
|
|
192
|
+
}, "codex: /responses fetch returned headers");
|
|
193
|
+
}
|
|
194
|
+
catch (e) {
|
|
195
|
+
logger.error({
|
|
196
|
+
phase: "/responses fetch",
|
|
197
|
+
elapsedMs: Date.now() - responseStart,
|
|
198
|
+
totalElapsedMs: Date.now() - streamStart,
|
|
199
|
+
url,
|
|
200
|
+
model: opts.model,
|
|
201
|
+
errName: e instanceof Error ? e.name : typeof e,
|
|
202
|
+
errCode: e?.code,
|
|
203
|
+
errMessage: e instanceof Error ? e.message : String(e),
|
|
204
|
+
errCause: e?.cause,
|
|
205
|
+
stack: e instanceof Error ? e.stack : undefined,
|
|
206
|
+
}, "codex: /responses fetch THREW (likely the source of 'The operation timed out')");
|
|
207
|
+
throw e;
|
|
208
|
+
}
|
|
209
|
+
if (response.status === 401) {
|
|
210
|
+
// Refresh-then-retry once. The on-disk token may have rotated since
|
|
211
|
+
// resolveAccessToken's skew check (e.g. another process refreshed and
|
|
212
|
+
// wrote a token we still saw as valid). A second attempt under
|
|
213
|
+
// forceRefresh covers that race.
|
|
214
|
+
const fresh = await resolveAccessToken({
|
|
215
|
+
forceRefresh: true,
|
|
216
|
+
timeoutMs: this.refreshTimeoutMs,
|
|
217
|
+
...(this.refreshSkewSeconds !== undefined
|
|
218
|
+
? { skewSeconds: this.refreshSkewSeconds }
|
|
219
|
+
: {}),
|
|
220
|
+
});
|
|
221
|
+
const retryInit = {
|
|
222
|
+
method: "POST",
|
|
223
|
+
headers: {
|
|
224
|
+
...cloudflareHeaders(fresh),
|
|
225
|
+
"Content-Type": "application/json",
|
|
226
|
+
Accept: "text/event-stream",
|
|
227
|
+
},
|
|
228
|
+
body: JSON.stringify(body),
|
|
229
|
+
// Same combined timeout + user-abort signal as the primary POST
|
|
230
|
+
// above. The 401-refresh retry path otherwise inherits Bun's
|
|
231
|
+
// undici default headersTimeout (5 min) and can mask the real
|
|
232
|
+
// failure mode.
|
|
233
|
+
signal: this.buildFetchSignal(opts.abortSignal),
|
|
234
|
+
};
|
|
235
|
+
const retry = await fetch(url, retryInit);
|
|
236
|
+
if (!retry.ok) {
|
|
237
|
+
await throwCodexHttpError(retry);
|
|
238
|
+
}
|
|
239
|
+
if (!retry.body)
|
|
240
|
+
throw new Error("Codex Responses API: missing response body on 401 retry");
|
|
241
|
+
yield* parseCodexStream(retry.body, opts.abortSignal);
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
if (!response.ok) {
|
|
245
|
+
await throwCodexHttpError(response);
|
|
246
|
+
}
|
|
247
|
+
if (!response.body) {
|
|
248
|
+
throw new Error("Codex Responses API: missing response body");
|
|
249
|
+
}
|
|
250
|
+
yield* parseCodexStream(response.body, opts.abortSignal);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Non-streaming entry point. The Codex backend doesn't support
|
|
254
|
+
* `stream: false`, so we drain `stream()` into a single `ProviderResponse`.
|
|
255
|
+
* Callers that want progressive UI updates should use `stream()` directly.
|
|
256
|
+
*
|
|
257
|
+
* The reconstruction follows DeepseekProvider's convention:
|
|
258
|
+
* - text deltas collapse into one `text` content block per stream;
|
|
259
|
+
* - tool_use_start + tool_use_input_delta + tool_use_complete bundle
|
|
260
|
+
* into one `tool_use` block with parsed JSON args;
|
|
261
|
+
* - thinking_complete blocks are forwarded verbatim.
|
|
262
|
+
*
|
|
263
|
+
* Block order in the returned `content`: thinking → text → tool_use,
|
|
264
|
+
* matching the assistant-history convention the loop expects on replay.
|
|
265
|
+
*/
|
|
266
|
+
async complete(opts) {
|
|
267
|
+
let text = "";
|
|
268
|
+
const thinkingBlocks = [];
|
|
269
|
+
const tools = new Map();
|
|
270
|
+
let stopReason = "end_turn";
|
|
271
|
+
let usage = { inputTokens: 0, outputTokens: 0 };
|
|
272
|
+
for await (const chunk of this.stream(opts)) {
|
|
273
|
+
switch (chunk.type) {
|
|
274
|
+
case "text_delta":
|
|
275
|
+
text += chunk.text;
|
|
276
|
+
break;
|
|
277
|
+
case "tool_use_start":
|
|
278
|
+
tools.set(chunk.id, { name: chunk.name, args: "" });
|
|
279
|
+
break;
|
|
280
|
+
case "tool_use_input_delta": {
|
|
281
|
+
const entry = tools.get(chunk.id);
|
|
282
|
+
if (entry)
|
|
283
|
+
entry.args += chunk.partial_json;
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
case "tool_use_complete": {
|
|
287
|
+
const entry = tools.get(chunk.id);
|
|
288
|
+
if (entry && !entry.name)
|
|
289
|
+
entry.name = chunk.name;
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
case "thinking_complete":
|
|
293
|
+
thinkingBlocks.push(chunk.block);
|
|
294
|
+
break;
|
|
295
|
+
case "message_complete":
|
|
296
|
+
stopReason = chunk.stopReason;
|
|
297
|
+
usage = chunk.usage;
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
const content = [];
|
|
302
|
+
for (const block of thinkingBlocks)
|
|
303
|
+
content.push(block);
|
|
304
|
+
if (text.length > 0)
|
|
305
|
+
content.push({ type: "text", text });
|
|
306
|
+
for (const [id, entry] of tools.entries()) {
|
|
307
|
+
let input = {};
|
|
308
|
+
const trimmed = entry.args.trim();
|
|
309
|
+
if (trimmed.length > 0) {
|
|
310
|
+
try {
|
|
311
|
+
input = JSON.parse(trimmed);
|
|
312
|
+
}
|
|
313
|
+
catch {
|
|
314
|
+
// Defensive — malformed JSON args fall through as `{}`. Matches
|
|
315
|
+
// DeepseekProvider's behavior on the same failure mode.
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
content.push({ type: "tool_use", id, name: entry.name, input });
|
|
319
|
+
}
|
|
320
|
+
return { content, stopReason, usage };
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Build the JSON body the Responses API expects.
|
|
325
|
+
*
|
|
326
|
+
* Notable fields:
|
|
327
|
+
* - `instructions`: maestro's `system` string. The Responses API has no
|
|
328
|
+
* `system` role; this slot is the canonical place for persona / global
|
|
329
|
+
* constraints.
|
|
330
|
+
* - `input`: the message history as Responses input items
|
|
331
|
+
* (translateMessagesToResponses).
|
|
332
|
+
* - `tools` / `tool_choice` / `parallel_tool_calls`: standard.
|
|
333
|
+
* - `store: false`: keep the conversation client-side. With `store: true`
|
|
334
|
+
* the server expects subsequent requests to reference earlier items
|
|
335
|
+
* by ID and 404s when they don't — incompatible with maestro's
|
|
336
|
+
* stateless turn model.
|
|
337
|
+
* - `stream: true`: required; non-streaming returns 400.
|
|
338
|
+
* - `reasoning`: only emitted when the caller picked an effort tier.
|
|
339
|
+
* We always include `summary: "auto"` so the model surfaces a
|
|
340
|
+
* human-readable reasoning trace alongside the encrypted content.
|
|
341
|
+
* - `include: ["reasoning.encrypted_content"]`: makes the encrypted
|
|
342
|
+
* reasoning blob available in `output_item.done` payloads. We don't
|
|
343
|
+
* replay it yet, but capturing it now keeps the future replay path
|
|
344
|
+
* a translator change rather than another wire change.
|
|
345
|
+
*/
|
|
346
|
+
function buildRequestBody(opts) {
|
|
347
|
+
const input = translateMessagesToResponses(opts.messages);
|
|
348
|
+
const tools = translateToolsToResponses(opts.tools);
|
|
349
|
+
const body = {
|
|
350
|
+
model: opts.model,
|
|
351
|
+
instructions: opts.system ?? "",
|
|
352
|
+
input,
|
|
353
|
+
store: false,
|
|
354
|
+
stream: true,
|
|
355
|
+
parallel_tool_calls: true,
|
|
356
|
+
};
|
|
357
|
+
if (tools && tools.length > 0) {
|
|
358
|
+
body.tools = tools;
|
|
359
|
+
body.tool_choice = "auto";
|
|
360
|
+
}
|
|
361
|
+
// NOTE: the codex chatgpt backend rejects `max_output_tokens` outright
|
|
362
|
+
// (verified 2026-05-23: returns 400 "Unsupported parameter: max_output_tokens").
|
|
363
|
+
// This matches hermes's `agent/transports/codex.py` which only sets
|
|
364
|
+
// max_output_tokens when `not is_codex_backend`. Hosts that need to clamp
|
|
365
|
+
// output length on Codex should rely on iteration caps + `effort` instead.
|
|
366
|
+
// We deliberately drop `opts.maxTokens` here even though the field exists.
|
|
367
|
+
const effort = effortForCodex(opts.effort);
|
|
368
|
+
if (effort) {
|
|
369
|
+
body.reasoning = { effort, summary: "auto" };
|
|
370
|
+
body.include = ["reasoning.encrypted_content"];
|
|
371
|
+
}
|
|
372
|
+
return body;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Construct a thrown `Error` carrying as much diagnostic context as the
|
|
376
|
+
* Codex backend gives us. The backend returns several shapes:
|
|
377
|
+
*
|
|
378
|
+
* - `{"detail":"..."}` (most common, e.g. model-not-allowed, stream-required)
|
|
379
|
+
* - `{"error":{"message":"..."}}` (OpenAI legacy)
|
|
380
|
+
* - Plain text (Cloudflare 403)
|
|
381
|
+
*
|
|
382
|
+
* We surface whichever is present, prefixed with the HTTP status so the
|
|
383
|
+
* caller can grep by status code in logs.
|
|
384
|
+
*/
|
|
385
|
+
async function throwCodexHttpError(response) {
|
|
386
|
+
let bodyText = "";
|
|
387
|
+
try {
|
|
388
|
+
bodyText = await response.text();
|
|
389
|
+
}
|
|
390
|
+
catch {
|
|
391
|
+
bodyText = "";
|
|
392
|
+
}
|
|
393
|
+
let detail = bodyText.slice(0, 500);
|
|
394
|
+
try {
|
|
395
|
+
const j = JSON.parse(bodyText);
|
|
396
|
+
if (typeof j.detail === "string")
|
|
397
|
+
detail = j.detail;
|
|
398
|
+
else if (j.error && typeof j.error === "object") {
|
|
399
|
+
const inner = j.error;
|
|
400
|
+
if (typeof inner.message === "string")
|
|
401
|
+
detail = inner.message;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
catch {
|
|
405
|
+
// bodyText wasn't JSON; keep the snippet.
|
|
406
|
+
}
|
|
407
|
+
const cf = response.headers.get("cf-mitigated");
|
|
408
|
+
const suffix = cf ? ` (cf-mitigated: ${cf})` : "";
|
|
409
|
+
const err = new Error(`Codex Responses API ${response.status} ${response.statusText}: ${detail}${suffix}`);
|
|
410
|
+
// Attach the raw status for callers that want to switch on it.
|
|
411
|
+
err.httpStatus = response.status;
|
|
412
|
+
throw err;
|
|
413
|
+
}
|
|
414
|
+
// Re-export for hosts that want to surface the typed error from
|
|
415
|
+
// `codex-auth.ts` without importing both modules.
|
|
416
|
+
export { CodexAuthError } from "../providers/codex-auth.js";
|
|
417
|
+
//# sourceMappingURL=codex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/providers/codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EACL,iBAAiB,EAEjB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAQhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAEL,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,+BAA+B,CAAC;AAGvC;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AAE,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAClD,MAAM,GAAG,GAAG,IAAI,KAAK,CACnB,uBAAuB,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,KAAK,MAAM,GAAG,MAAM,EAAE,CACpF,CAAC;IACF,+DAA+D;IAC9D,GAAyC,CAAC,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC;IACxE,MAAM,GAAG,CAAC;AACZ,CAAC;AAED,gEAAgE;AAChE,kDAAkD;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAyDxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAmB3D,CAAC;AAEX;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,EAAG,KAAe,CAAC;AAEzD;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,eAAO,MAAM,eAAe,EAAE,aAkF7B,CAAC"}
|
package/dist/registry.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { unlinkSync } from "node:fs";
|
|
2
|
-
import { MODEL_DEEPSEEK_V4_FLASH, MODEL_DEEPSEEK_V4_PRO, MODEL_OPUS, MODEL_SONNET, } from "./platform/config.js";
|
|
2
|
+
import { MODEL_CODEX_GPT5_2, MODEL_CODEX_GPT5_3_CODEX, MODEL_CODEX_GPT5_4, MODEL_CODEX_GPT5_4_MINI, MODEL_CODEX_GPT5_5, MODEL_DEEPSEEK_V4_FLASH, MODEL_DEEPSEEK_V4_PRO, MODEL_OPUS, MODEL_SONNET, } from "./platform/config.js";
|
|
3
3
|
import { logger } from "./platform/logger.js";
|
|
4
4
|
import { maestroSessionPath, writeMaestroRollout } from "./session-store.js";
|
|
5
5
|
import { readConversation } from "./storage/conversations.js";
|
|
@@ -24,6 +24,19 @@ const ALIAS_MAP = {
|
|
|
24
24
|
deepseek: MODEL_DEEPSEEK_V4_FLASH,
|
|
25
25
|
"deepseek-flash": MODEL_DEEPSEEK_V4_FLASH,
|
|
26
26
|
"deepseek-pro": MODEL_DEEPSEEK_V4_PRO,
|
|
27
|
+
// Codex (ChatGPT OAuth-backed Responses API). The short alias `codex`
|
|
28
|
+
// resolves to the lightest model so default-effort calls don't burn
|
|
29
|
+
// through the ChatGPT subscription's hourly cap on the heaviest tier;
|
|
30
|
+
// hosts that want gpt-5.5 should pass the full slug or `codex-pro`.
|
|
31
|
+
codex: MODEL_CODEX_GPT5_4_MINI,
|
|
32
|
+
"codex-mini": MODEL_CODEX_GPT5_4_MINI,
|
|
33
|
+
"codex-pro": MODEL_CODEX_GPT5_5,
|
|
34
|
+
"codex-coder": MODEL_CODEX_GPT5_3_CODEX,
|
|
35
|
+
"gpt-5.5": MODEL_CODEX_GPT5_5,
|
|
36
|
+
"gpt-5.4": MODEL_CODEX_GPT5_4,
|
|
37
|
+
"gpt-5.4-mini": MODEL_CODEX_GPT5_4_MINI,
|
|
38
|
+
"gpt-5.3-codex": MODEL_CODEX_GPT5_3_CODEX,
|
|
39
|
+
"gpt-5.2": MODEL_CODEX_GPT5_2,
|
|
27
40
|
};
|
|
28
41
|
const VALID_ALIASES = new Set(Object.keys(ALIAS_MAP));
|
|
29
42
|
const VALID_FULL_IDS = new Set(Object.values(ALIAS_MAP));
|
|
@@ -78,6 +91,17 @@ export const MODEL_MAX_OUTPUT_TOKENS = {
|
|
|
78
91
|
// DeepSeek V4 — conservative defaults below the 384K native cap (see docstring).
|
|
79
92
|
[MODEL_DEEPSEEK_V4_PRO]: 65_536,
|
|
80
93
|
[MODEL_DEEPSEEK_V4_FLASH]: 32_768,
|
|
94
|
+
// Codex Responses API — the `/codex/models` catalog reports a 272K context
|
|
95
|
+
// window across the gpt-5.x lineup; output cap isn't surfaced separately,
|
|
96
|
+
// so we anchor against the same per-tier defaults we use for the Anthropic
|
|
97
|
+
// family (64K heavy, 32K mini). The Codex backend silently caps long
|
|
98
|
+
// outputs anyway, so picking a generous-but-finite default here just keeps
|
|
99
|
+
// a runaway turn bounded.
|
|
100
|
+
[MODEL_CODEX_GPT5_5]: 65_536,
|
|
101
|
+
[MODEL_CODEX_GPT5_4]: 65_536,
|
|
102
|
+
[MODEL_CODEX_GPT5_4_MINI]: 32_768,
|
|
103
|
+
[MODEL_CODEX_GPT5_3_CODEX]: 65_536,
|
|
104
|
+
[MODEL_CODEX_GPT5_2]: 65_536,
|
|
81
105
|
};
|
|
82
106
|
/**
|
|
83
107
|
* Default `max_tokens` for an unknown model id. Sized generously (32_768)
|
package/dist/registry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,UAAU,EACV,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,iBAA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,CAAC;QACD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,cAAc,CAAC,QAAQ,EAAE,gCAAgC,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;CACF,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ export type LlmPostHook = (text: string, ctx: {
|
|
|
55
55
|
messages: ProviderMessage[];
|
|
56
56
|
abortSignal?: AbortSignal;
|
|
57
57
|
}) => GuardrailResult | Promise<GuardrailResult>;
|
|
58
|
+
import type { ToolResultTruncationMetadata } from "./core/tool-result-truncation.js";
|
|
58
59
|
/**
|
|
59
60
|
* These imports are for the guardrail types only — re-exported below the
|
|
60
61
|
* ProviderMessage reference.
|
|
@@ -107,6 +108,7 @@ export type UnifiedEvent = {
|
|
|
107
108
|
type: "tool_result";
|
|
108
109
|
toolUseId: string;
|
|
109
110
|
content: string;
|
|
111
|
+
metadata?: ToolResultTruncationMetadata;
|
|
110
112
|
} | {
|
|
111
113
|
type: "text_delta";
|
|
112
114
|
content: string;
|
|
@@ -254,6 +256,18 @@ export interface AgentQueryOptions {
|
|
|
254
256
|
* never silently shrinks it.
|
|
255
257
|
*/
|
|
256
258
|
maxTokens?: number;
|
|
259
|
+
/**
|
|
260
|
+
* Override the auxiliary (compaction) model id. When omitted, the loop
|
|
261
|
+
* resolves it via `resolveAuxModel(model)` — intra-provider remap to the
|
|
262
|
+
* cheapest sibling (gpt-5.5 → gpt-5.4-mini, opus → haiku,
|
|
263
|
+
* deepseek-v4-pro → deepseek-v4-flash). Set this to pin a specific
|
|
264
|
+
* compaction model regardless of which main model the call uses.
|
|
265
|
+
*
|
|
266
|
+
* v0.1.28+: added after production logs showed gpt-5.5 main + gpt-5.5
|
|
267
|
+
* aux both hitting undici's 5-minute headersTimeout while POSTing ~1.3MB
|
|
268
|
+
* request bodies. The default mapping is usually what you want.
|
|
269
|
+
*/
|
|
270
|
+
auxModel?: string;
|
|
257
271
|
mcpEnabled?: string[] | null;
|
|
258
272
|
mcpExtra?: Record<string, unknown>;
|
|
259
273
|
isCron?: boolean;
|
|
@@ -361,5 +375,15 @@ export interface AgentQueryOptions {
|
|
|
361
375
|
* set (it must be callable for the model to discover anything else).
|
|
362
376
|
*/
|
|
363
377
|
enableToolSearch?: boolean;
|
|
378
|
+
/**
|
|
379
|
+
* Tool result truncation — when enabled, string tool outputs that exceed
|
|
380
|
+
* `maxBytes` are truncated to head+tail before being fed back into the model
|
|
381
|
+
* context. The full output is optionally persisted to disk. Disabled by
|
|
382
|
+
* default (opt-in).
|
|
383
|
+
*
|
|
384
|
+
* Mirrors `AIAgentConfig.toolResultTruncation` — wired through to the agent
|
|
385
|
+
* loop via `maestroProvider`.
|
|
386
|
+
*/
|
|
387
|
+
toolResultTruncation?: import("./core/tool-result-truncation.js").ToolResultTruncationConfig;
|
|
364
388
|
}
|
|
365
389
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,gBAAgB,GAAG,UAAU,CAAC;AAExE,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,GAAG,CACvB,QAAQ,EAAE,eAAe,EAAE,EAC3B,GAAG,EAAE;IAAE,WAAW,CAAC,EAAE,WAAW,CAAA;CAAE,KAC/B,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,WAAW,GAAG,CACxB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE;IACH,sFAAsF;IAC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CAAC;CAC3F"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA2EH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAU,CAAC;AAQxF,MAAM,CAAC,MAAM,gBAAgB,GAAyB,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAU,CAAC;AAC9F,MAAM,CAAC,MAAM,cAAc,GAAc,QAAQ,CAAC;AAElD,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,gBAAsC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC9F,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "maestro-agent-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.28",
|
|
4
4
|
"description": "Embeddable, provider-agnostic TypeScript agent SDK — pluggable providers, built-in tools, skills, memory, and MCP.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Yeonwoo Jeong <aadd4020@gmail.com>",
|
|
@@ -24,6 +24,22 @@
|
|
|
24
24
|
"types": "./dist/providers/deepseek.d.ts",
|
|
25
25
|
"import": "./dist/providers/deepseek.js"
|
|
26
26
|
},
|
|
27
|
+
"./providers/codex": {
|
|
28
|
+
"types": "./dist/providers/codex.d.ts",
|
|
29
|
+
"import": "./dist/providers/codex.js"
|
|
30
|
+
},
|
|
31
|
+
"./providers/codex-auth": {
|
|
32
|
+
"types": "./dist/providers/codex-auth.d.ts",
|
|
33
|
+
"import": "./dist/providers/codex-auth.js"
|
|
34
|
+
},
|
|
35
|
+
"./providers/codex-stream": {
|
|
36
|
+
"types": "./dist/providers/codex-stream.d.ts",
|
|
37
|
+
"import": "./dist/providers/codex-stream.js"
|
|
38
|
+
},
|
|
39
|
+
"./providers/codex-translators": {
|
|
40
|
+
"types": "./dist/providers/codex-translators.d.ts",
|
|
41
|
+
"import": "./dist/providers/codex-translators.js"
|
|
42
|
+
},
|
|
27
43
|
"./tools": {
|
|
28
44
|
"types": "./dist/tools/index.d.ts",
|
|
29
45
|
"import": "./dist/tools/index.js"
|