codex-openai-proxy 0.1.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +253 -0
- package/dist/app-server/app-server.d.ts +39 -0
- package/dist/app-server/app-server.js +261 -0
- package/dist/app-server/app-server.js.map +1 -0
- package/dist/app-server/auth.d.ts +16 -0
- package/dist/app-server/auth.js +102 -0
- package/dist/app-server/auth.js.map +1 -0
- package/dist/app-server/json-rpc.d.ts +29 -0
- package/dist/app-server/json-rpc.js +141 -0
- package/dist/app-server/json-rpc.js.map +1 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +11 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli/cli.d.ts +6 -0
- package/dist/cli/cli.js +319 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/continuation/state.d.ts +71 -0
- package/dist/continuation/state.js +460 -0
- package/dist/continuation/state.js.map +1 -0
- package/dist/core/abort.d.ts +13 -0
- package/dist/core/abort.js +74 -0
- package/dist/core/abort.js.map +1 -0
- package/dist/core/canonical.d.ts +6 -0
- package/dist/core/canonical.js +22 -0
- package/dist/core/canonical.js.map +1 -0
- package/dist/core/config.d.ts +33 -0
- package/dist/core/config.js +139 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/logger.d.ts +17 -0
- package/dist/core/logger.js +44 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/policy.d.ts +98 -0
- package/dist/core/policy.js +242 -0
- package/dist/core/policy.js.map +1 -0
- package/dist/core/redact.d.ts +2 -0
- package/dist/core/redact.js +35 -0
- package/dist/core/redact.js.map +1 -0
- package/dist/http/chat-execute.d.ts +24 -0
- package/dist/http/chat-execute.js +491 -0
- package/dist/http/chat-execute.js.map +1 -0
- package/dist/http/chat-normalize.d.ts +100 -0
- package/dist/http/chat-normalize.js +379 -0
- package/dist/http/chat-normalize.js.map +1 -0
- package/dist/http/chat-sse.d.ts +14 -0
- package/dist/http/chat-sse.js +52 -0
- package/dist/http/chat-sse.js.map +1 -0
- package/dist/http/chat-validate.d.ts +37 -0
- package/dist/http/chat-validate.js +190 -0
- package/dist/http/chat-validate.js.map +1 -0
- package/dist/http/chat.d.ts +8 -0
- package/dist/http/chat.js +137 -0
- package/dist/http/chat.js.map +1 -0
- package/dist/http/errors.d.ts +19 -0
- package/dist/http/errors.js +56 -0
- package/dist/http/errors.js.map +1 -0
- package/dist/http/server.d.ts +19 -0
- package/dist/http/server.js +254 -0
- package/dist/http/server.js.map +1 -0
- package/package.json +67 -0
- package/protocol/VERSION.json +10 -0
- package/protocol/schemas/response-mapping.schema.json +38 -0
- package/protocol/schemas/x-codex.schema.json +12 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { isAbsolute, parse, sep } from "node:path";
|
|
3
|
+
/** Identifies a nonempty path that is not itself a filesystem root. */
|
|
4
|
+
function isRedactablePath(path) {
|
|
5
|
+
return path.length > 0 && parse(path).root !== path;
|
|
6
|
+
}
|
|
7
|
+
/** Removes common URL, credential, and local-path forms from diagnostics. */
|
|
8
|
+
export function redact(value, root, sensitivePaths = []) {
|
|
9
|
+
const home = homedir();
|
|
10
|
+
let result = value;
|
|
11
|
+
const replacements = [
|
|
12
|
+
...sensitivePaths
|
|
13
|
+
.filter((path) => path.length > 1 &&
|
|
14
|
+
isRedactablePath(path) &&
|
|
15
|
+
(isAbsolute(path) || path.includes(sep)))
|
|
16
|
+
.map((path) => [path, "[REDACTED_PATH]"]),
|
|
17
|
+
...(isRedactablePath(root) && root !== home
|
|
18
|
+
? [[root, "[REDACTED_CWD]"]]
|
|
19
|
+
: []),
|
|
20
|
+
[home, "[REDACTED_HOME]"],
|
|
21
|
+
].sort(([left], [right]) => right.length - left.length);
|
|
22
|
+
// Replace the most specific paths first so masking a parent never exposes a
|
|
23
|
+
// sensitive child as a readable relative suffix.
|
|
24
|
+
const seen = new Set();
|
|
25
|
+
for (const [path, replacement] of replacements) {
|
|
26
|
+
if (seen.has(path))
|
|
27
|
+
continue;
|
|
28
|
+
seen.add(path);
|
|
29
|
+
result = result.replaceAll(path, replacement);
|
|
30
|
+
}
|
|
31
|
+
return result
|
|
32
|
+
.replace(/https?:\/\/\S+/gi, "[REDACTED_URL]")
|
|
33
|
+
.replace(/\b(token|code|secret)=\S+/gi, "$1=[REDACTED]");
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=redact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../../src/core/redact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEnD,uEAAuE;AACvE,SAAS,gBAAgB,CAAC,IAAY;IACpC,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC;AACtD,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,MAAM,CACpB,KAAa,EACb,IAAY,EACZ,iBAAoC,EAAE;IAEtC,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,MAAM,YAAY,GAAG;QACnB,GAAG,cAAc;aACd,MAAM,CACL,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,MAAM,GAAG,CAAC;YACf,gBAAgB,CAAC,IAAI,CAAC;YACtB,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAC3C;aACA,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,iBAAiB,CAAU,CAAC;QACpD,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,IAAI;YACzC,CAAC,CAAE,CAAC,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAW;YACvC,CAAC,CAAC,EAAE,CAAC;QACP,CAAC,IAAI,EAAE,iBAAiB,CAAU;KACnC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IACxD,4EAA4E;IAC5E,iDAAiD;IACjD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,YAAY,EAAE,CAAC;QAC/C,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,SAAS;QAC7B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACf,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,MAAM;SACV,OAAO,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;SAC7C,OAAO,CAAC,6BAA6B,EAAE,eAAe,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { JsonRpcTransport } from "../app-server/json-rpc.js";
|
|
2
|
+
import type { Logger } from "../core/logger.js";
|
|
3
|
+
import { type PolicyRequirements } from "../core/policy.js";
|
|
4
|
+
import { type ContinuationCoordinator } from "../continuation/state.js";
|
|
5
|
+
import { type NormalizedEvent } from "./chat-normalize.js";
|
|
6
|
+
import { type ChatRequest } from "./chat-validate.js";
|
|
7
|
+
/** Dependencies used by one Chat Completions request. */
|
|
8
|
+
export interface ChatHandlerOptions {
|
|
9
|
+
rpc: JsonRpcTransport;
|
|
10
|
+
log: Logger;
|
|
11
|
+
requestId: string;
|
|
12
|
+
signal: AbortSignal;
|
|
13
|
+
continuations: ContinuationCoordinator;
|
|
14
|
+
root: string;
|
|
15
|
+
requirements: PolicyRequirements;
|
|
16
|
+
implicitToolContinuation: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** One eagerly prepared execution with cleanup independent of generator startup. */
|
|
19
|
+
export interface ExecutionSession {
|
|
20
|
+
events: AsyncGenerator<NormalizedEvent>;
|
|
21
|
+
dispose(): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
/** Runs or resumes a Codex thread and yields its normalized event stream. */
|
|
24
|
+
export declare function execute(request: ChatRequest, options: ChatHandlerOptions, responseId: string): Promise<ExecutionSession>;
|
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
import { record } from "../core/canonical.js";
|
|
2
|
+
import { policyBindingHash, } from "../core/policy.js";
|
|
3
|
+
import { bindingHash, } from "../continuation/state.js";
|
|
4
|
+
import { diagnoseUnexposedNotification, EventNormalizer, isEstablishedUnrelatedNotification, matchesTurn, notificationBehavior, } from "./chat-normalize.js";
|
|
5
|
+
import { toHistoryItem, validateToolResults, } from "./chat-validate.js";
|
|
6
|
+
import { HttpError } from "./errors.js";
|
|
7
|
+
/** Maximum buffered app-server activity retained for one HTTP response. */
|
|
8
|
+
const MAX_INGRESS_EVENTS = 1_024;
|
|
9
|
+
/** Maximum approximate JSON bytes retained in one response's ingress queue. */
|
|
10
|
+
const MAX_INGRESS_BYTES = 8 * 1024 * 1024;
|
|
11
|
+
/** Owns bounded request ingress and its wake and failure state. */
|
|
12
|
+
class IngressQueue {
|
|
13
|
+
#ingress = [];
|
|
14
|
+
#ingressBytes = 0;
|
|
15
|
+
#wake;
|
|
16
|
+
#queueError;
|
|
17
|
+
#transportError;
|
|
18
|
+
#rejectDynamicCall;
|
|
19
|
+
constructor(rejectDynamicCall) {
|
|
20
|
+
this.#rejectDynamicCall = rejectDynamicCall;
|
|
21
|
+
}
|
|
22
|
+
/** Reports whether no retained event is ready for consumption. */
|
|
23
|
+
get empty() {
|
|
24
|
+
return this.#ingress.length === 0;
|
|
25
|
+
}
|
|
26
|
+
/** Returns the next retained event without consuming it. */
|
|
27
|
+
peek() {
|
|
28
|
+
return this.#ingress[0]?.event;
|
|
29
|
+
}
|
|
30
|
+
/** Retains one event within the count and approximate-byte limits. */
|
|
31
|
+
enqueue(event) {
|
|
32
|
+
if (this.#queueError) {
|
|
33
|
+
if (event.type === "dynamic_tool")
|
|
34
|
+
this.#rejectDynamicCall(event.call);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const eventBytes = approximateJsonBytes(event);
|
|
38
|
+
if (this.#ingress.length >= MAX_INGRESS_EVENTS ||
|
|
39
|
+
this.#ingressBytes + eventBytes > MAX_INGRESS_BYTES) {
|
|
40
|
+
this.#queueError = new Error("App-server activity queue overflowed.");
|
|
41
|
+
if (event.type === "dynamic_tool")
|
|
42
|
+
this.#rejectDynamicCall(event.call);
|
|
43
|
+
this.notify();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this.#ingress.push({ event, bytes: eventBytes });
|
|
47
|
+
this.#ingressBytes += eventBytes;
|
|
48
|
+
this.notify();
|
|
49
|
+
}
|
|
50
|
+
/** Records a terminal transport failure and wakes the consumer. */
|
|
51
|
+
failTransport(error) {
|
|
52
|
+
this.#transportError = error;
|
|
53
|
+
this.notify();
|
|
54
|
+
}
|
|
55
|
+
/** Wakes a consumer currently waiting for ingress or terminal state. */
|
|
56
|
+
notify() {
|
|
57
|
+
this.#wake?.();
|
|
58
|
+
}
|
|
59
|
+
/** Throws terminal failures with transport failure taking precedence. */
|
|
60
|
+
assertHealthy() {
|
|
61
|
+
if (this.#transportError)
|
|
62
|
+
throw this.#transportError;
|
|
63
|
+
if (this.#queueError)
|
|
64
|
+
throw this.#queueError;
|
|
65
|
+
}
|
|
66
|
+
/** Rechecks only overflow before the suspension queue is drained. */
|
|
67
|
+
assertQueueHealthy() {
|
|
68
|
+
if (this.#queueError)
|
|
69
|
+
throw this.#queueError;
|
|
70
|
+
}
|
|
71
|
+
/** Consumes the next retained event and releases its byte budget. */
|
|
72
|
+
shift() {
|
|
73
|
+
const next = this.#ingress.shift();
|
|
74
|
+
if (!next)
|
|
75
|
+
return undefined;
|
|
76
|
+
this.#ingressBytes -= next.bytes;
|
|
77
|
+
return next.event;
|
|
78
|
+
}
|
|
79
|
+
/** Drains all retained events in arrival order and resets byte accounting. */
|
|
80
|
+
drainAll() {
|
|
81
|
+
const captured = this.#ingress.splice(0).map((queued) => queued.event);
|
|
82
|
+
this.#ingressBytes = 0;
|
|
83
|
+
return captured;
|
|
84
|
+
}
|
|
85
|
+
/** Waits until ingress, failure, or abort can advance the consumer. */
|
|
86
|
+
async waitForActivity(signal) {
|
|
87
|
+
await new Promise((resolve) => {
|
|
88
|
+
this.#wake = resolve;
|
|
89
|
+
if (this.#ingress.length ||
|
|
90
|
+
this.#queueError ||
|
|
91
|
+
this.#transportError ||
|
|
92
|
+
signal.aborted)
|
|
93
|
+
resolve();
|
|
94
|
+
});
|
|
95
|
+
this.#wake = undefined;
|
|
96
|
+
}
|
|
97
|
+
/** Rejects every retained dynamic request during unsuspended cleanup. */
|
|
98
|
+
rejectQueuedDynamicCalls() {
|
|
99
|
+
for (const { event } of this.#ingress)
|
|
100
|
+
if (event.type === "dynamic_tool")
|
|
101
|
+
this.#rejectDynamicCall(event.call);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/** Runs or resumes a Codex thread and yields its normalized event stream. */
|
|
105
|
+
export async function execute(request, options, responseId) {
|
|
106
|
+
const queue = new IngressQueue((call) => rejectDynamicCall(options, call));
|
|
107
|
+
const handle = { terminal: false, suspended: false };
|
|
108
|
+
const onNotification = (method, params) => {
|
|
109
|
+
const behavior = notificationBehavior(method);
|
|
110
|
+
if (behavior === "diagnose") {
|
|
111
|
+
diagnoseUnexposedNotification(method, params, options.rpc, options.log);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (behavior === "ignore")
|
|
115
|
+
return;
|
|
116
|
+
// Notifications can arrive while thread/start or turn/start is still
|
|
117
|
+
// resolving. Once both identifiers are established, discard unrelated work
|
|
118
|
+
// before it consumes this request's bounded ingress budget.
|
|
119
|
+
if (isEstablishedUnrelatedNotification(params, handle.threadId, handle.turnId))
|
|
120
|
+
return;
|
|
121
|
+
const item = record(record(params)?.item);
|
|
122
|
+
if ((method === "item/started" || method === "item/completed") &&
|
|
123
|
+
item?.type === "dynamicToolCall") {
|
|
124
|
+
// The server request is authoritative and carries the responder ID; using
|
|
125
|
+
// notification lifecycle messages would expose the same call twice.
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
queue.enqueue({ type: "notification", method, params });
|
|
129
|
+
};
|
|
130
|
+
const onToolRequest = (toolRequest) => {
|
|
131
|
+
queue.enqueue({ type: "dynamic_tool", call: toolRequest });
|
|
132
|
+
};
|
|
133
|
+
const onClose = (error) => {
|
|
134
|
+
queue.failTransport(error);
|
|
135
|
+
};
|
|
136
|
+
options.rpc.on("notification", onNotification);
|
|
137
|
+
options.rpc.once("close", onClose);
|
|
138
|
+
let disposed = false;
|
|
139
|
+
const normalizer = new EventNormalizer();
|
|
140
|
+
let continuationResults = [];
|
|
141
|
+
const binding = {
|
|
142
|
+
model: request.model,
|
|
143
|
+
cwd: request.policy.cwd,
|
|
144
|
+
toolsHash: bindingHash(request.dynamicTools),
|
|
145
|
+
policyHash: policyBindingHash(request.policy),
|
|
146
|
+
};
|
|
147
|
+
const abort = async () => {
|
|
148
|
+
if (handle.threadId && handle.turnId && !handle.terminal)
|
|
149
|
+
await options.rpc
|
|
150
|
+
.request("turn/interrupt", {
|
|
151
|
+
threadId: handle.threadId,
|
|
152
|
+
turnId: handle.turnId,
|
|
153
|
+
})
|
|
154
|
+
.catch(() => undefined);
|
|
155
|
+
};
|
|
156
|
+
const onAbort = () => {
|
|
157
|
+
// Interrupt is best-effort, but waking the consumer is mandatory: a wedged
|
|
158
|
+
// app-server may never emit the terminal event that previously released it.
|
|
159
|
+
queue.notify();
|
|
160
|
+
void abort();
|
|
161
|
+
};
|
|
162
|
+
const cleanup = async () => {
|
|
163
|
+
if (disposed)
|
|
164
|
+
return;
|
|
165
|
+
disposed = true;
|
|
166
|
+
await abort();
|
|
167
|
+
options.signal.removeEventListener("abort", onAbort);
|
|
168
|
+
options.rpc.off("notification", onNotification);
|
|
169
|
+
options.rpc.off("close", onClose);
|
|
170
|
+
if (handle.threadId)
|
|
171
|
+
options.continuations.clearToolOwner(handle.threadId, onToolRequest);
|
|
172
|
+
if (handle.threadId && !handle.suspended)
|
|
173
|
+
options.continuations.release(handle.threadId);
|
|
174
|
+
if (!handle.suspended)
|
|
175
|
+
queue.rejectQueuedDynamicCalls();
|
|
176
|
+
};
|
|
177
|
+
options.signal.addEventListener("abort", onAbort, { once: true });
|
|
178
|
+
try {
|
|
179
|
+
if (request.previousResponseId) {
|
|
180
|
+
continuationResults = await resumeContinuation(request, options, binding, handle, onToolRequest);
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
await startFreshThread(request, options, handle, onToolRequest);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
// Setup failures occur before HTTP headers, but still must release any
|
|
188
|
+
// ownership acquired by an earlier setup step.
|
|
189
|
+
await cleanup();
|
|
190
|
+
throw error;
|
|
191
|
+
}
|
|
192
|
+
const events = (async function* streamExecution() {
|
|
193
|
+
let failed = false;
|
|
194
|
+
let pendingFinishReason;
|
|
195
|
+
let pendingUsage;
|
|
196
|
+
try {
|
|
197
|
+
for (const result of continuationResults)
|
|
198
|
+
yield normalizer.dynamicToolResult(result.call, result.content);
|
|
199
|
+
while (!handle.terminal) {
|
|
200
|
+
queue.assertHealthy();
|
|
201
|
+
// Preserve all already-arrived events. Once they are drained, abort is a
|
|
202
|
+
// terminal wake source even if interrupt fails or the transport wedges.
|
|
203
|
+
if (queue.empty && options.signal.aborted)
|
|
204
|
+
throw new HttpError(408, "The request timed out or was disconnected.", "server_error", "request_timeout");
|
|
205
|
+
if (queue.empty)
|
|
206
|
+
await queue.waitForActivity(options.signal);
|
|
207
|
+
queue.assertHealthy();
|
|
208
|
+
if (queue.peek()?.type === "dynamic_tool") {
|
|
209
|
+
// Let parallel app-server requests arriving in this event-loop turn
|
|
210
|
+
// join the batch before the synchronous suspension handoff.
|
|
211
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
212
|
+
const captured = suspendCapturedBatch(queue, options, responseId, binding, handle);
|
|
213
|
+
handle.suspended = true;
|
|
214
|
+
yield* emitCapturedBatch(captured, normalizer, handle);
|
|
215
|
+
yield { finishReason: "tool_calls" };
|
|
216
|
+
handle.terminal = true;
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
const next = queue.shift();
|
|
220
|
+
if (!next)
|
|
221
|
+
continue;
|
|
222
|
+
if (next.type === "dynamic_tool")
|
|
223
|
+
continue;
|
|
224
|
+
if (!matchesTurn(next.params, handle.threadId, handle.turnId))
|
|
225
|
+
continue;
|
|
226
|
+
for (const event of normalizer.normalize(next.method, next.params)) {
|
|
227
|
+
if (event.error) {
|
|
228
|
+
handle.terminal = true;
|
|
229
|
+
failed = true;
|
|
230
|
+
yield event;
|
|
231
|
+
}
|
|
232
|
+
else if (event.finishReason) {
|
|
233
|
+
// Persistence is part of successful completion. Do not expose a
|
|
234
|
+
// terminal success frame until the continuation can be recorded.
|
|
235
|
+
handle.terminal = true;
|
|
236
|
+
pendingFinishReason = event.finishReason;
|
|
237
|
+
}
|
|
238
|
+
else if (event.usage) {
|
|
239
|
+
pendingUsage = event.usage;
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
yield event;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (!handle.suspended &&
|
|
247
|
+
!failed &&
|
|
248
|
+
handle.threadId &&
|
|
249
|
+
!options.continuations.recordReady(responseId, handle.threadId, binding))
|
|
250
|
+
throw new Error("App-server transport was replaced before completion.");
|
|
251
|
+
if (!failed) {
|
|
252
|
+
if (pendingFinishReason)
|
|
253
|
+
yield { finishReason: pendingFinishReason };
|
|
254
|
+
if (pendingUsage)
|
|
255
|
+
yield { usage: pendingUsage };
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
catch (error) {
|
|
259
|
+
// Failures must interrupt the app-server turn before ownership is released;
|
|
260
|
+
// otherwise work could continue without an HTTP consumer.
|
|
261
|
+
await abort();
|
|
262
|
+
// The failed execution is terminal from the proxy's perspective. Mark it
|
|
263
|
+
// before cleanup so the same best-effort interrupt is not sent twice.
|
|
264
|
+
handle.terminal = true;
|
|
265
|
+
throw error;
|
|
266
|
+
}
|
|
267
|
+
finally {
|
|
268
|
+
await cleanup();
|
|
269
|
+
}
|
|
270
|
+
})();
|
|
271
|
+
return { events, dispose: cleanup };
|
|
272
|
+
}
|
|
273
|
+
/** Captures and durably suspends the current dynamic-tool batch synchronously. */
|
|
274
|
+
function suspendCapturedBatch(queue, options, responseId, binding, handle) {
|
|
275
|
+
queue.assertQueueHealthy();
|
|
276
|
+
const captured = queue.drainAll();
|
|
277
|
+
const calls = captured
|
|
278
|
+
.filter((event) => event.type === "dynamic_tool")
|
|
279
|
+
.map((event) => event.call);
|
|
280
|
+
if (calls.some((call) => call.threadId !== handle.threadId || call.turnId !== handle.turnId)) {
|
|
281
|
+
for (const call of calls)
|
|
282
|
+
options.rpc.respondError(call.request.id, {
|
|
283
|
+
code: -32602,
|
|
284
|
+
message: "Dynamic tool correlation mismatch",
|
|
285
|
+
});
|
|
286
|
+
throw new Error("Dynamic tool request did not match the active turn.");
|
|
287
|
+
}
|
|
288
|
+
try {
|
|
289
|
+
options.continuations.suspend(responseId, binding, calls);
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
// Captured calls are no longer in ingress, so this handoff owns rejecting
|
|
293
|
+
// every responder if durable suspension fails.
|
|
294
|
+
for (const call of calls)
|
|
295
|
+
rejectDynamicCall(options, call);
|
|
296
|
+
throw error;
|
|
297
|
+
}
|
|
298
|
+
return captured;
|
|
299
|
+
}
|
|
300
|
+
/** Normalizes one captured batch synchronously with the shared normalizer. */
|
|
301
|
+
function* emitCapturedBatch(captured, normalizer, handle) {
|
|
302
|
+
for (const event of captured) {
|
|
303
|
+
if (event.type === "notification") {
|
|
304
|
+
if (!matchesTurn(event.params, handle.threadId, handle.turnId))
|
|
305
|
+
continue;
|
|
306
|
+
yield* normalizer.normalize(event.method, event.params);
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
yield normalizer.dynamicToolCall(event.call);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
/** Resumes and validates one durable continuation on the shared turn handle. */
|
|
313
|
+
async function resumeContinuation(request, options, binding, handle, onToolRequest) {
|
|
314
|
+
const stored = options.continuations.store.get(request.previousResponseId);
|
|
315
|
+
if (!stored)
|
|
316
|
+
continuationFailure(404, "unknown_previous_response_id");
|
|
317
|
+
if (stored.model !== binding.model)
|
|
318
|
+
continuationFailure(409, "continuation_model_mismatch");
|
|
319
|
+
if (stored.cwd !== binding.cwd)
|
|
320
|
+
continuationFailure(409, "continuation_cwd_mismatch");
|
|
321
|
+
if (stored.toolsHash !== binding.toolsHash)
|
|
322
|
+
continuationFailure(409, "continuation_tools_mismatch");
|
|
323
|
+
if (stored.policyHash !== binding.policyHash)
|
|
324
|
+
continuationFailure(409, "continuation_policy_mismatch");
|
|
325
|
+
// Assignment precedes state validation so cleanup retains the original
|
|
326
|
+
// release behavior for every mid-setup continuation failure.
|
|
327
|
+
handle.threadId = stored.threadId;
|
|
328
|
+
if (stored.state === "expired" &&
|
|
329
|
+
stored.callIds?.length &&
|
|
330
|
+
request.messages.some((message) => message.role === "tool"))
|
|
331
|
+
continuationFailure(410, "expired_tool_continuation");
|
|
332
|
+
if (stored.state === "pending_tool") {
|
|
333
|
+
// A pending response already owns the thread, so this path deliberately
|
|
334
|
+
// installs only the responder and must never claim ownership again.
|
|
335
|
+
if (!request.messages.some((message) => message.role === "tool"))
|
|
336
|
+
continuationFailure(409, "tool_results_required");
|
|
337
|
+
const pending = options.continuations.pending(request.previousResponseId);
|
|
338
|
+
if (!pending)
|
|
339
|
+
continuationFailure(410, "expired_tool_continuation");
|
|
340
|
+
const results = validateToolResults(request.messages, pending);
|
|
341
|
+
handle.turnId = pending[0].turnId;
|
|
342
|
+
if (!options.continuations.setToolOwner(handle.threadId, onToolRequest))
|
|
343
|
+
continuationFailure(409, "thread_busy");
|
|
344
|
+
const continuationResults = pending.map((call) => ({
|
|
345
|
+
call,
|
|
346
|
+
content: results.get(call.callId),
|
|
347
|
+
}));
|
|
348
|
+
options.continuations.resolve(request.previousResponseId, results);
|
|
349
|
+
return continuationResults;
|
|
350
|
+
}
|
|
351
|
+
if (stored.state === "expired")
|
|
352
|
+
continuationFailure(410, "expired_previous_response_id");
|
|
353
|
+
if (stored.state === "superseded")
|
|
354
|
+
continuationFailure(409, "superseded_previous_response_id");
|
|
355
|
+
if (stored.state !== "ready")
|
|
356
|
+
continuationFailure(500, "corrupt_response_state");
|
|
357
|
+
if (request.messages.at(-1)?.role === "tool")
|
|
358
|
+
continuationFailure(409, "tool_results_without_pending_call");
|
|
359
|
+
acquireThread(handle, options, onToolRequest);
|
|
360
|
+
let resumed;
|
|
361
|
+
try {
|
|
362
|
+
const read = asRecord(await options.rpc.request("thread/read", { threadId: handle.threadId, includeTurns: false }, options.signal), "thread/read");
|
|
363
|
+
const readThread = asRecord(read.thread, "thread/read.thread");
|
|
364
|
+
const status = record(readThread.status)?.type;
|
|
365
|
+
if (status === "active")
|
|
366
|
+
continuationFailure(409, "thread_busy");
|
|
367
|
+
// Only protocol states that can safely enter thread/resume are accepted.
|
|
368
|
+
// Missing, malformed, and future status values fail closed.
|
|
369
|
+
if (status !== "idle" && status !== "notLoaded")
|
|
370
|
+
continuationFailure(409, "thread_not_resumable");
|
|
371
|
+
resumed = asRecord(await options.rpc.request("thread/resume", {
|
|
372
|
+
threadId: handle.threadId,
|
|
373
|
+
excludeTurns: true,
|
|
374
|
+
...threadPolicyParams(request.policy),
|
|
375
|
+
}, options.signal), "thread/resume");
|
|
376
|
+
}
|
|
377
|
+
catch (error) {
|
|
378
|
+
if (error instanceof HttpError)
|
|
379
|
+
throw error;
|
|
380
|
+
continuationFailure(409, "thread_not_resumable");
|
|
381
|
+
}
|
|
382
|
+
const resumedThreadId = requiredId(resumed.thread, "thread/resume.thread");
|
|
383
|
+
// The durable mapping is authoritative. A mismatched resume result must
|
|
384
|
+
// never transfer ownership to, or start work on, an unexpected thread.
|
|
385
|
+
if (resumedThreadId !== handle.threadId)
|
|
386
|
+
continuationFailure(409, "thread_not_resumable");
|
|
387
|
+
await startTurn(request, options, handle);
|
|
388
|
+
return [];
|
|
389
|
+
}
|
|
390
|
+
/** Starts one fresh durable thread and its initial turn. */
|
|
391
|
+
async function startFreshThread(request, options, handle, onToolRequest) {
|
|
392
|
+
const started = asRecord(await options.rpc.request("thread/start", {
|
|
393
|
+
model: request.model,
|
|
394
|
+
ephemeral: false,
|
|
395
|
+
...threadPolicyParams(request.policy),
|
|
396
|
+
...(request.dynamicTools.length
|
|
397
|
+
? { dynamicTools: request.dynamicTools }
|
|
398
|
+
: {}),
|
|
399
|
+
}, options.signal), "thread/start");
|
|
400
|
+
handle.threadId = requiredId(started.thread, "thread/start.thread");
|
|
401
|
+
acquireThread(handle, options, onToolRequest);
|
|
402
|
+
const prior = request.messages.slice(0, -1).map(toHistoryItem);
|
|
403
|
+
if (prior.length)
|
|
404
|
+
await options.rpc.request("thread/inject_items", { threadId: handle.threadId, items: prior }, options.signal);
|
|
405
|
+
await startTurn(request, options, handle);
|
|
406
|
+
}
|
|
407
|
+
/** Claims a known thread and installs its dynamic-tool responder. */
|
|
408
|
+
function acquireThread(handle, options, onToolRequest) {
|
|
409
|
+
if (!options.continuations.claim(handle.threadId))
|
|
410
|
+
continuationFailure(409, "thread_busy");
|
|
411
|
+
if (!options.continuations.setToolOwner(handle.threadId, onToolRequest))
|
|
412
|
+
continuationFailure(409, "thread_busy");
|
|
413
|
+
}
|
|
414
|
+
/** Starts the next turn and records its validated identifier in place. */
|
|
415
|
+
async function startTurn(request, options, handle) {
|
|
416
|
+
const last = request.messages.at(-1);
|
|
417
|
+
const turn = asRecord(await options.rpc.request("turn/start", {
|
|
418
|
+
threadId: handle.threadId,
|
|
419
|
+
model: request.model,
|
|
420
|
+
input: [{ type: "text", text: last.content, text_elements: [] }],
|
|
421
|
+
...turnPolicyParams(request.policy),
|
|
422
|
+
}, options.signal), "turn/start");
|
|
423
|
+
handle.turnId = requiredId(turn.turn, "turn/start.turn");
|
|
424
|
+
}
|
|
425
|
+
/** Rejects a dynamic request that cannot be safely retained or suspended. */
|
|
426
|
+
function rejectDynamicCall(options, call) {
|
|
427
|
+
try {
|
|
428
|
+
options.rpc.respondError(call.request.id, {
|
|
429
|
+
code: -32000,
|
|
430
|
+
message: "Active turn ended before dynamic tool suspension",
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
catch {
|
|
434
|
+
// A closed transport has already made the request unanswerable.
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
/** Builds explicit thread start/resume settings for one effective policy. */
|
|
438
|
+
function threadPolicyParams(policy) {
|
|
439
|
+
return {
|
|
440
|
+
cwd: policy.cwd,
|
|
441
|
+
sandbox: policy.sandbox,
|
|
442
|
+
approvalPolicy: policy.approvalPolicy,
|
|
443
|
+
...(policy.approvalsReviewer
|
|
444
|
+
? { approvalsReviewer: policy.approvalsReviewer }
|
|
445
|
+
: {}),
|
|
446
|
+
config: { web_search: policy.webSearch },
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
/** Builds sticky turn overrides so prior thread state is never inherited. */
|
|
450
|
+
function turnPolicyParams(policy) {
|
|
451
|
+
return {
|
|
452
|
+
cwd: policy.cwd,
|
|
453
|
+
approvalPolicy: policy.approvalPolicy,
|
|
454
|
+
...(policy.approvalsReviewer
|
|
455
|
+
? { approvalsReviewer: policy.approvalsReviewer }
|
|
456
|
+
: {}),
|
|
457
|
+
sandboxPolicy: policy.sandboxPolicy,
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
/** Estimates retained ingress size using its JSON representation. */
|
|
461
|
+
function approximateJsonBytes(value) {
|
|
462
|
+
try {
|
|
463
|
+
return Buffer.byteLength(JSON.stringify(value) ?? "null");
|
|
464
|
+
}
|
|
465
|
+
catch {
|
|
466
|
+
return MAX_INGRESS_BYTES + 1;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
/** Throws the stable OpenAI-shaped error for continuation failures. */
|
|
470
|
+
function continuationFailure(status, code) {
|
|
471
|
+
throw new HttpError(status, "The previous response cannot be continued.", status >= 500
|
|
472
|
+
? "server_error"
|
|
473
|
+
: status === 409
|
|
474
|
+
? "conflict_error"
|
|
475
|
+
: "invalid_request_error", code, "previous_response_id");
|
|
476
|
+
}
|
|
477
|
+
/** Requires an app-server response object. */
|
|
478
|
+
function asRecord(value, location) {
|
|
479
|
+
const result = record(value);
|
|
480
|
+
if (!result)
|
|
481
|
+
throw new Error(`Invalid ${location} response.`);
|
|
482
|
+
return result;
|
|
483
|
+
}
|
|
484
|
+
/** Requires an object with a string identifier in an app-server response. */
|
|
485
|
+
function requiredId(value, location) {
|
|
486
|
+
const result = asRecord(value, location);
|
|
487
|
+
if (typeof result.id !== "string")
|
|
488
|
+
throw new Error("Invalid app-server id.");
|
|
489
|
+
return result.id;
|
|
490
|
+
}
|
|
491
|
+
//# sourceMappingURL=chat-execute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-execute.js","sourceRoot":"","sources":["../../src/http/chat-execute.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EACL,iBAAiB,GAGlB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,WAAW,GAIZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,6BAA6B,EAC7B,eAAe,EACf,kCAAkC,EAClC,WAAW,EACX,oBAAoB,GAGrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL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