@vtxmacro/cli 2026.9.37 → 2026.9.38
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/bin/exo-harness.ts +8 -5
- package/bin/vtx-service-bootstrap.js +1 -1
- package/bin/vtx.js +131 -58
- package/package.json +1 -1
package/bin/exo-harness.ts
CHANGED
|
@@ -36,6 +36,8 @@ type ExoModelModule = {
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
const record = (value: unknown): Json => value !== null && typeof value === 'object' && !Array.isArray(value) ? value as Json : {};
|
|
39
|
+
const validModel = (value: unknown): value is string => typeof value === 'string' && Boolean(value.trim())
|
|
40
|
+
&& value.length <= 256 && !/[\u0000-\u001f\u007f]/u.test(value);
|
|
39
41
|
const count = (value: unknown): number => {
|
|
40
42
|
if (!Number.isSafeInteger(value) || Number(value) < 0) throw new Error('exo_usage_invalid');
|
|
41
43
|
return Number(value);
|
|
@@ -286,7 +288,7 @@ export default {
|
|
|
286
288
|
const choices = Array.isArray(raw.choices) ? raw.choices : [];
|
|
287
289
|
const choice = record(choices[0]);
|
|
288
290
|
terminalKnown = choices.length === 1 && ['stop', 'tool_calls', 'length', 'content_filter'].includes(String(choice.finish_reason));
|
|
289
|
-
if (raw.model
|
|
291
|
+
if (!validModel(raw.model) || typeof raw.id !== 'string' || !raw.id) throw new Error('exo_response_identity_mismatch');
|
|
290
292
|
const controls = record(raw.venice_parameters);
|
|
291
293
|
if (controls.disable_thinking !== true || controls.strip_thinking_response !== false
|
|
292
294
|
|| controls.include_venice_system_prompt !== false || controls.enable_web_search !== 'off'
|
|
@@ -298,7 +300,7 @@ export default {
|
|
|
298
300
|
addUsage({ input_tokens: nativeUsage.prompt_tokens, output_tokens: nativeUsage.completion_tokens, total_tokens: nativeUsage.total_tokens,
|
|
299
301
|
input_tokens_details: nativeUsage.prompt_tokens_details, output_tokens_details: nativeUsage.completion_tokens_details });
|
|
300
302
|
lastCompletedResponseId = raw.id;
|
|
301
|
-
currentReceipt = { responseId: raw.id, providerModel:
|
|
303
|
+
currentReceipt = { responseId: raw.id, providerModel: raw.model, reasoningEffort: input.reasoningEffort };
|
|
302
304
|
// Exo synthesizes completed status for every Chat response. Inspect
|
|
303
305
|
// the real terminal reason before that normalization can hide loss.
|
|
304
306
|
if (choices.length !== 1 || !['stop', 'tool_calls'].includes(String(choice.finish_reason))) throw new Error('exo_response_incomplete');
|
|
@@ -333,14 +335,15 @@ export default {
|
|
|
333
335
|
// model tool call to the broker, especially decision submission.
|
|
334
336
|
if (response.status !== 'completed') throw new Error('exo_response_incomplete');
|
|
335
337
|
terminalKnown = true;
|
|
336
|
-
if (response.model
|
|
338
|
+
if (!validModel(response.model) || typeof response.id !== 'string' || !response.id) throw new Error('exo_response_identity_mismatch');
|
|
337
339
|
if (input.provider === 'openai') {
|
|
338
340
|
const effectiveEffort = record(response.reasoning).effort ?? null;
|
|
339
341
|
if (effectiveEffort !== input.nativeReasoningEffort) throw new Error('exo_response_effort_mismatch');
|
|
340
342
|
addUsage(record(response.usage));
|
|
341
343
|
lastCompletedResponseId = response.id;
|
|
342
|
-
currentReceipt = { responseId: response.id, providerModel:
|
|
344
|
+
currentReceipt = { responseId: response.id, providerModel: response.model, reasoningEffort: input.reasoningEffort };
|
|
343
345
|
}
|
|
346
|
+
if (!currentReceipt || currentReceipt.responseId !== response.id || currentReceipt.providerModel !== response.model) throw new Error('exo_response_identity_mismatch');
|
|
344
347
|
const events = model.responseToLinguaEvents(response);
|
|
345
348
|
await context.exoharness.current.turn.addEvents(input.provider === 'venice' ? chatResponseEvents(events) : events);
|
|
346
349
|
const calls = model.responseToolCalls(response);
|
|
@@ -354,7 +357,7 @@ export default {
|
|
|
354
357
|
if (input.mode !== 'agent' || calls.some((call) => !allowed.has(call.request.functionName))) throw new Error('exo_tool_not_allowed');
|
|
355
358
|
for (const call of calls) {
|
|
356
359
|
const result = await broker('/tool', { callId: call.toolCallId, tool: call.request.functionName, arguments: call.request.arguments,
|
|
357
|
-
effectiveModel: input.
|
|
360
|
+
effectiveModel: `${input.provider}/${currentReceipt!.providerModel}`, effectiveReasoningEffort: input.reasoningEffort }, input.deadlineAtMs);
|
|
358
361
|
// Append the entire result directly. The default registry replaces
|
|
359
362
|
// results over 8k with previews, which loses assignment data.
|
|
360
363
|
await context.exoharness.current.turn.addEvents([harness.toolResultEvent(call.toolCallId,
|
|
@@ -16,7 +16,7 @@ import { fileURLToPath } from "node:url";
|
|
|
16
16
|
// agent-cli-release.json
|
|
17
17
|
var agent_cli_release_default = {
|
|
18
18
|
package_name: "@vtxmacro/cli",
|
|
19
|
-
package_version: "2026.9.
|
|
19
|
+
package_version: "2026.9.38",
|
|
20
20
|
codex_package_name: "@openai/codex",
|
|
21
21
|
codex_version: "0.153.3",
|
|
22
22
|
copilot_sdk_package_name: "@github/copilot-sdk",
|
package/bin/vtx.js
CHANGED
|
@@ -77,7 +77,7 @@ var init_agent_cli_release = __esm({
|
|
|
77
77
|
"agent-cli-release.json"() {
|
|
78
78
|
agent_cli_release_default = {
|
|
79
79
|
package_name: "@vtxmacro/cli",
|
|
80
|
-
package_version: "2026.9.
|
|
80
|
+
package_version: "2026.9.38",
|
|
81
81
|
codex_package_name: "@openai/codex",
|
|
82
82
|
codex_version: "0.153.3",
|
|
83
83
|
copilot_sdk_package_name: "@github/copilot-sdk",
|
|
@@ -24222,7 +24222,7 @@ var init_codex_adapter = __esm({
|
|
|
24222
24222
|
reasoningContent: external_exports.string().min(1).max(CODEX_REASONING_CONTENT_MAX_UTF8_BYTES).nullable().optional().transform((value) => value ?? null),
|
|
24223
24223
|
reasoningSummary: external_exports.string().min(1).max(CODEX_REASONING_SUMMARY_MAX_UTF8_BYTES).nullable().optional().transform((value) => value ?? null),
|
|
24224
24224
|
requestedModel: external_exports.string().regex(CODEX_MODEL_NAME_PATTERN),
|
|
24225
|
-
effectiveModel: external_exports.string().
|
|
24225
|
+
effectiveModel: external_exports.string().min(1).max(256).refine((value) => value.trim().length > 0 && !/[\u0000-\u001f\u007f]/u.test(value)),
|
|
24226
24226
|
requestedReasoningEffort: external_exports.string().regex(CODEX_REASONING_EFFORT_PATTERN),
|
|
24227
24227
|
effectiveReasoningEffort: external_exports.string().regex(CODEX_REASONING_EFFORT_PATTERN),
|
|
24228
24228
|
adapterRequestId: external_exports.string().min(1).max(512),
|
|
@@ -24232,7 +24232,7 @@ var init_codex_adapter = __esm({
|
|
|
24232
24232
|
timeToFirstTokenMs: external_exports.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).nullable(),
|
|
24233
24233
|
terminalStatus: external_exports.literal("completed")
|
|
24234
24234
|
}).superRefine((value, context) => {
|
|
24235
|
-
if (value.reasoningContent != null && utf8Bytes(value.reasoningContent) > CODEX_REASONING_CONTENT_MAX_UTF8_BYTES || value.reasoningSummary != null && utf8Bytes(value.reasoningSummary) > CODEX_REASONING_SUMMARY_MAX_UTF8_BYTES || value.usage.cachedInputTokens > value.usage.inputTokens || value.usage.reasoningOutputTokens > value.usage.outputTokens || value.usage.totalTokens !== value.usage.inputTokens + value.usage.outputTokens || value.
|
|
24235
|
+
if (value.reasoningContent != null && utf8Bytes(value.reasoningContent) > CODEX_REASONING_CONTENT_MAX_UTF8_BYTES || value.reasoningSummary != null && utf8Bytes(value.reasoningSummary) > CODEX_REASONING_SUMMARY_MAX_UTF8_BYTES || value.usage.cachedInputTokens > value.usage.inputTokens || value.usage.reasoningOutputTokens > value.usage.outputTokens || value.usage.totalTokens !== value.usage.inputTokens + value.usage.outputTokens || value.effectiveReasoningEffort !== value.requestedReasoningEffort) {
|
|
24236
24236
|
context.addIssue({ code: "custom", message: "Invalid Codex recovery usage or identity." });
|
|
24237
24237
|
}
|
|
24238
24238
|
});
|
|
@@ -25232,7 +25232,7 @@ var init_codex_adapter = __esm({
|
|
|
25232
25232
|
}
|
|
25233
25233
|
if (prior.terminal?.kind === "completed") {
|
|
25234
25234
|
const recovered = prior.terminal.result;
|
|
25235
|
-
if (recovered.requestedModel !== input.requestedModel || recovered.effectiveModel !==
|
|
25235
|
+
if (recovered.requestedModel !== input.requestedModel || typeof recovered.effectiveModel !== "string" || recovered.effectiveModel.trim().length === 0 || recovered.effectiveModel.length > 256 || /[\u0000-\u001f\u007f]/u.test(recovered.effectiveModel) || recovered.requestedReasoningEffort !== input.requestedReasoningEffort || recovered.effectiveReasoningEffort !== input.requestedReasoningEffort || recovered.terminalStatus !== "completed") {
|
|
25236
25236
|
throw new CodexAppServerError({
|
|
25237
25237
|
message: "Codex completed recovery receipt changed immutable model identity.",
|
|
25238
25238
|
category: "adapter",
|
|
@@ -25849,7 +25849,7 @@ import {
|
|
|
25849
25849
|
RuntimeConnection,
|
|
25850
25850
|
defineTool
|
|
25851
25851
|
} from "@github/copilot-sdk";
|
|
25852
|
-
var COPILOT_SDK_VERSION, MAX_RESULT_BYTES, resolveRuntimePackage, copilotRuntimePackageCandidates, resolvePinnedCopilotCliPath, createPrivateWorkspace, cleanCopilotEnvironment, defaultClient, modelCapabilities, requiredUsageInteger, optionalUsageInteger, copilotAgentToolDefinitions, CopilotSubscriptionAdapter;
|
|
25852
|
+
var COPILOT_SDK_VERSION, MAX_RESULT_BYTES, resolveRuntimePackage, copilotRuntimePackageCandidates, resolvePinnedCopilotCliPath, createPrivateWorkspace, cleanCopilotEnvironment, defaultClient, modelCapabilities, requiredUsageInteger, optionalUsageInteger, responseModelLabel, coherentResponseModel, copilotAgentToolDefinitions, CopilotSubscriptionAdapter;
|
|
25853
25853
|
var init_copilot_adapter = __esm({
|
|
25854
25854
|
"lib/inference-host/copilot-adapter.ts"() {
|
|
25855
25855
|
"use strict";
|
|
@@ -25948,9 +25948,20 @@ var init_copilot_adapter = __esm({
|
|
|
25948
25948
|
}
|
|
25949
25949
|
return Number(value);
|
|
25950
25950
|
};
|
|
25951
|
-
|
|
25951
|
+
responseModelLabel = (value) => {
|
|
25952
|
+
if (typeof value !== "string" || value.trim().length === 0 || value.length > 256 || /[\u0000-\u001f\u007f]/u.test(value)) {
|
|
25953
|
+
throw new Error("copilot_effective_model_invalid");
|
|
25954
|
+
}
|
|
25955
|
+
return value;
|
|
25956
|
+
};
|
|
25957
|
+
coherentResponseModel = (models) => {
|
|
25958
|
+
if (models.size !== 1) throw new Error("copilot_effective_model_mismatch");
|
|
25959
|
+
return [...models][0];
|
|
25960
|
+
};
|
|
25961
|
+
copilotAgentToolDefinitions = (input, evidence, beforeExecute) => {
|
|
25952
25962
|
const execute = async (tool, argumentsValue) => {
|
|
25953
25963
|
const argumentsRecord = argumentsValue && typeof argumentsValue === "object" && !Array.isArray(argumentsValue) ? argumentsValue : {};
|
|
25964
|
+
await beforeExecute();
|
|
25954
25965
|
const callId = randomUUID();
|
|
25955
25966
|
const result2 = await input.executeTool({
|
|
25956
25967
|
callId,
|
|
@@ -26149,7 +26160,7 @@ ${input.outputSchemaJson}`
|
|
|
26149
26160
|
let providerCallId = null;
|
|
26150
26161
|
for (const event of usageEvents) {
|
|
26151
26162
|
if (event.type !== "assistant.usage") continue;
|
|
26152
|
-
observedModels.add(event.data.model);
|
|
26163
|
+
observedModels.add(responseModelLabel(event.data.model));
|
|
26153
26164
|
if (event.data.reasoningEffort) observedEfforts.add(event.data.reasoningEffort);
|
|
26154
26165
|
inputTokens += requiredUsageInteger(event.data.inputTokens, "input_tokens");
|
|
26155
26166
|
cachedInputTokens += optionalUsageInteger(event.data.cacheReadTokens, "cache_read_tokens");
|
|
@@ -26170,10 +26181,8 @@ ${input.outputSchemaJson}`
|
|
|
26170
26181
|
if (usageEvents.length === 0) {
|
|
26171
26182
|
throw new Error("copilot_usage_receipt_missing");
|
|
26172
26183
|
}
|
|
26173
|
-
if (response.data.model) observedModels.add(response.data.model);
|
|
26174
|
-
|
|
26175
|
-
throw new Error("copilot_effective_model_mismatch");
|
|
26176
|
-
}
|
|
26184
|
+
if (response.data.model !== void 0) observedModels.add(responseModelLabel(response.data.model));
|
|
26185
|
+
const effectiveModel = coherentResponseModel(observedModels);
|
|
26177
26186
|
const effectiveEffort = input.requestedReasoningEffort === "none" ? observedEfforts.size === 0 ? "none" : observedEfforts.size === 1 ? [...observedEfforts][0] : null : observedEfforts.size === 1 ? [...observedEfforts][0] : null;
|
|
26178
26187
|
if (effectiveEffort !== input.requestedReasoningEffort) {
|
|
26179
26188
|
throw new Error("copilot_effective_effort_mismatch");
|
|
@@ -26192,7 +26201,7 @@ ${input.outputSchemaJson}`
|
|
|
26192
26201
|
reasoningContent: response.data.reasoningText ?? null,
|
|
26193
26202
|
reasoningSummary: null,
|
|
26194
26203
|
requestedModel: input.requestedModel,
|
|
26195
|
-
effectiveModel
|
|
26204
|
+
effectiveModel,
|
|
26196
26205
|
requestedReasoningEffort: input.requestedReasoningEffort,
|
|
26197
26206
|
effectiveReasoningEffort: effectiveEffort,
|
|
26198
26207
|
adapterRequestId: providerCallId ?? response.data.requestId ?? response.data.messageId,
|
|
@@ -26261,9 +26270,22 @@ ${input.outputSchemaJson}`
|
|
|
26261
26270
|
let durableCheckpointed = input.durableThread !== null;
|
|
26262
26271
|
let dispatchEntered = false;
|
|
26263
26272
|
const toolEvidence = [];
|
|
26273
|
+
const observedModels = /* @__PURE__ */ new Set();
|
|
26274
|
+
let modelReceiptError = null;
|
|
26275
|
+
let thread = null;
|
|
26276
|
+
const checkpointObservedModel = async () => {
|
|
26277
|
+
if (modelReceiptError) throw modelReceiptError;
|
|
26278
|
+
if (observedModels.size === 0 || !thread) return;
|
|
26279
|
+
const effectiveModel = coherentResponseModel(observedModels);
|
|
26280
|
+
if (thread.effectiveModel !== effectiveModel) {
|
|
26281
|
+
const updatedThread = { ...thread, effectiveModel };
|
|
26282
|
+
await input.onThreadReady?.(updatedThread);
|
|
26283
|
+
thread = updatedThread;
|
|
26284
|
+
}
|
|
26285
|
+
};
|
|
26264
26286
|
try {
|
|
26265
26287
|
await client.start();
|
|
26266
|
-
const tools = copilotAgentToolDefinitions(input, toolEvidence);
|
|
26288
|
+
const tools = copilotAgentToolDefinitions(input, toolEvidence, checkpointObservedModel);
|
|
26267
26289
|
const sessionConfig = {
|
|
26268
26290
|
clientName: "@vtxmacro/cli durable Copilot Agent host",
|
|
26269
26291
|
model: input.requestedModel,
|
|
@@ -26289,7 +26311,7 @@ ${JSON.stringify(input.outputSchema)}`
|
|
|
26289
26311
|
workspacePath,
|
|
26290
26312
|
cleanup: ownedWorkspace?.cleanup ?? null
|
|
26291
26313
|
};
|
|
26292
|
-
|
|
26314
|
+
thread = {
|
|
26293
26315
|
threadId: session.sessionId,
|
|
26294
26316
|
threadPath: workspacePath,
|
|
26295
26317
|
effectiveModel: input.requestedModel,
|
|
@@ -26301,7 +26323,15 @@ ${JSON.stringify(input.outputSchema)}`
|
|
|
26301
26323
|
}
|
|
26302
26324
|
const usageEvents = [];
|
|
26303
26325
|
session.on((event) => {
|
|
26304
|
-
if (event.type === "assistant.usage" && !event.agentId)
|
|
26326
|
+
if (event.type === "assistant.usage" && !event.agentId) {
|
|
26327
|
+
usageEvents.push(event);
|
|
26328
|
+
try {
|
|
26329
|
+
observedModels.add(responseModelLabel(event.data.model));
|
|
26330
|
+
coherentResponseModel(observedModels);
|
|
26331
|
+
} catch (error48) {
|
|
26332
|
+
modelReceiptError = error48;
|
|
26333
|
+
}
|
|
26334
|
+
}
|
|
26305
26335
|
});
|
|
26306
26336
|
const onAbort = () => {
|
|
26307
26337
|
void session?.abort().catch(() => void 0);
|
|
@@ -26320,7 +26350,6 @@ ${JSON.stringify(input.outputSchema)}`
|
|
|
26320
26350
|
if (!response?.data.content || Buffer.byteLength(response.data.content, "utf8") > MAX_RESULT_BYTES) {
|
|
26321
26351
|
throw new Error("copilot_agent_invalid_result");
|
|
26322
26352
|
}
|
|
26323
|
-
const observedModels = /* @__PURE__ */ new Set();
|
|
26324
26353
|
const observedEfforts = /* @__PURE__ */ new Set();
|
|
26325
26354
|
let inputTokens = 0;
|
|
26326
26355
|
let cachedInputTokens = 0;
|
|
@@ -26332,7 +26361,7 @@ ${JSON.stringify(input.outputSchema)}`
|
|
|
26332
26361
|
let providerCallId = null;
|
|
26333
26362
|
for (const event of usageEvents) {
|
|
26334
26363
|
if (event.type !== "assistant.usage") continue;
|
|
26335
|
-
observedModels.add(event.data.model);
|
|
26364
|
+
observedModels.add(responseModelLabel(event.data.model));
|
|
26336
26365
|
if (event.data.reasoningEffort) observedEfforts.add(event.data.reasoningEffort);
|
|
26337
26366
|
inputTokens += requiredUsageInteger(event.data.inputTokens, "input_tokens");
|
|
26338
26367
|
cachedInputTokens += optionalUsageInteger(event.data.cacheReadTokens, "cache_read_tokens");
|
|
@@ -26348,10 +26377,9 @@ ${JSON.stringify(input.outputSchema)}`
|
|
|
26348
26377
|
providerCallId = event.data.providerCallId ?? event.data.apiCallId ?? providerCallId;
|
|
26349
26378
|
}
|
|
26350
26379
|
if (usageEvents.length === 0) throw new Error("copilot_agent_usage_receipt_missing");
|
|
26351
|
-
if (response.data.model) observedModels.add(response.data.model);
|
|
26352
|
-
|
|
26353
|
-
|
|
26354
|
-
}
|
|
26380
|
+
if (response.data.model !== void 0) observedModels.add(responseModelLabel(response.data.model));
|
|
26381
|
+
const effectiveModel = coherentResponseModel(observedModels);
|
|
26382
|
+
await checkpointObservedModel();
|
|
26355
26383
|
const effectiveEffort = input.requestedReasoningEffort === "none" ? observedEfforts.size === 0 ? "none" : observedEfforts.size === 1 ? [...observedEfforts][0] : null : observedEfforts.size === 1 ? [...observedEfforts][0] : null;
|
|
26356
26384
|
if (effectiveEffort !== input.requestedReasoningEffort) {
|
|
26357
26385
|
throw new Error("copilot_agent_effective_effort_mismatch");
|
|
@@ -26372,7 +26400,7 @@ ${JSON.stringify(input.outputSchema)}`
|
|
|
26372
26400
|
reasoningContent: response.data.reasoningText ?? null,
|
|
26373
26401
|
reasoningSummary: null,
|
|
26374
26402
|
requestedModel: input.requestedModel,
|
|
26375
|
-
effectiveModel
|
|
26403
|
+
effectiveModel,
|
|
26376
26404
|
requestedReasoningEffort: input.requestedReasoningEffort,
|
|
26377
26405
|
effectiveReasoningEffort: effectiveEffort,
|
|
26378
26406
|
adapterRequestId: providerCallId ?? response.data.requestId ?? response.data.messageId,
|
|
@@ -26482,6 +26510,7 @@ var init_deepseek_transport_proxy = __esm({
|
|
|
26482
26510
|
this.upstreamRequestStartedValue = false;
|
|
26483
26511
|
this.providerResponseObservedValue = false;
|
|
26484
26512
|
this.unansweredUpstreamRequestsValue = 0;
|
|
26513
|
+
this.latestReceiptValue = null;
|
|
26485
26514
|
}
|
|
26486
26515
|
get baseUrl() {
|
|
26487
26516
|
if (!this.urlValue) throw new Error("deepseek_transport_proxy_not_started");
|
|
@@ -26490,6 +26519,9 @@ var init_deepseek_transport_proxy = __esm({
|
|
|
26490
26519
|
get receipts() {
|
|
26491
26520
|
return [...this.receiptsValue];
|
|
26492
26521
|
}
|
|
26522
|
+
get lastReceipt() {
|
|
26523
|
+
return this.latestReceiptValue;
|
|
26524
|
+
}
|
|
26493
26525
|
get providerResponseObserved() {
|
|
26494
26526
|
return this.providerResponseObservedValue;
|
|
26495
26527
|
}
|
|
@@ -26528,6 +26560,7 @@ var init_deepseek_transport_proxy = __esm({
|
|
|
26528
26560
|
const controller = new AbortController();
|
|
26529
26561
|
this.controllers.add(controller);
|
|
26530
26562
|
try {
|
|
26563
|
+
this.latestReceiptValue = null;
|
|
26531
26564
|
this.upstreamRequestStartedValue = true;
|
|
26532
26565
|
this.unansweredUpstreamRequestsValue += 1;
|
|
26533
26566
|
const upstream = await this.fetchImpl(
|
|
@@ -26571,6 +26604,7 @@ var init_deepseek_transport_proxy = __esm({
|
|
|
26571
26604
|
const decoder2 = new TextDecoder();
|
|
26572
26605
|
let pending2 = "";
|
|
26573
26606
|
let observedId = "";
|
|
26607
|
+
let observedModel = "";
|
|
26574
26608
|
let terminalObserved = false;
|
|
26575
26609
|
const forwardLine = (line) => {
|
|
26576
26610
|
if (!line.startsWith("data:")) {
|
|
@@ -26585,25 +26619,18 @@ var init_deepseek_transport_proxy = __esm({
|
|
|
26585
26619
|
return;
|
|
26586
26620
|
}
|
|
26587
26621
|
if (value === "[DONE]") {
|
|
26588
|
-
if (terminalObserved || !observedId) {
|
|
26622
|
+
if (terminalObserved || !observedId || !observedModel) {
|
|
26589
26623
|
throw new Error("deepseek_provider_receipt_missing_or_mismatched");
|
|
26590
26624
|
}
|
|
26591
26625
|
terminalObserved = true;
|
|
26592
|
-
this.receiptsValue.push({
|
|
26593
|
-
id: observedId,
|
|
26594
|
-
model: this.expectedModel,
|
|
26595
|
-
requestedModel,
|
|
26596
|
-
requestedReasoningEffort: requestedEffort
|
|
26597
|
-
});
|
|
26598
|
-
response.write(`${line}
|
|
26599
|
-
`);
|
|
26600
26626
|
return;
|
|
26601
26627
|
}
|
|
26602
26628
|
const event = JSON.parse(value);
|
|
26603
26629
|
const eventId = typeof event.id === "string" ? event.id.trim() : "";
|
|
26604
|
-
const eventModel = typeof event.model === "string" ? event.model
|
|
26605
|
-
if (!eventId || eventModel
|
|
26630
|
+
const eventModel = typeof event.model === "string" ? event.model : "";
|
|
26631
|
+
if (terminalObserved || !eventId || !eventModel.trim() || eventModel.length > 256 || /[\u0000-\u001f\u007f]/u.test(eventModel) || observedModel && eventModel !== observedModel || observedId && eventId !== observedId) throw new Error("deepseek_provider_receipt_missing_or_mismatched");
|
|
26606
26632
|
observedId = eventId;
|
|
26633
|
+
observedModel = eventModel;
|
|
26607
26634
|
response.write(`${line}
|
|
26608
26635
|
`);
|
|
26609
26636
|
};
|
|
@@ -26620,6 +26647,10 @@ var init_deepseek_transport_proxy = __esm({
|
|
|
26620
26647
|
if (!terminalObserved) {
|
|
26621
26648
|
throw new Error("deepseek_provider_receipt_missing_or_mismatched");
|
|
26622
26649
|
}
|
|
26650
|
+
const receipt = { id: observedId, model: observedModel, requestedModel, requestedReasoningEffort: requestedEffort };
|
|
26651
|
+
this.receiptsValue.push(receipt);
|
|
26652
|
+
this.latestReceiptValue = receipt;
|
|
26653
|
+
response.write("data: [DONE]\n\n");
|
|
26623
26654
|
response.end();
|
|
26624
26655
|
} finally {
|
|
26625
26656
|
this.controllers.delete(controller);
|
|
@@ -27145,6 +27176,12 @@ ${JSON.stringify(input.outputSchema)}`,
|
|
|
27145
27176
|
},
|
|
27146
27177
|
execute: async (argumentsValue) => {
|
|
27147
27178
|
const argumentsRecord = argumentsValue && typeof argumentsValue === "object" && !Array.isArray(argumentsValue) ? argumentsValue : {};
|
|
27179
|
+
const receipt = proxy.lastReceipt;
|
|
27180
|
+
if (!receipt) throw new Error("deepseek_harness_agent_receipt_missing");
|
|
27181
|
+
if (thread.effectiveModel !== receipt.model) {
|
|
27182
|
+
thread = { ...thread, effectiveModel: receipt.model };
|
|
27183
|
+
await input.onThreadReady?.(thread);
|
|
27184
|
+
}
|
|
27148
27185
|
const callId = randomUUID2();
|
|
27149
27186
|
const result2 = await input.executeTool({ callId, tool: definition.name, arguments: argumentsRecord });
|
|
27150
27187
|
evidence.push({ callId, tool: definition.name, arguments: argumentsRecord, success: result2.success });
|
|
@@ -27192,7 +27229,7 @@ ${JSON.stringify(input.outputSchema)}`,
|
|
|
27192
27229
|
yield* next();
|
|
27193
27230
|
})();
|
|
27194
27231
|
});
|
|
27195
|
-
|
|
27232
|
+
let thread = {
|
|
27196
27233
|
threadId: String(sessionId),
|
|
27197
27234
|
threadPath: rootPath,
|
|
27198
27235
|
effectiveModel: input.requestedModel,
|
|
@@ -27244,6 +27281,10 @@ ${JSON.stringify(input.outputSchema)}`,
|
|
|
27244
27281
|
}
|
|
27245
27282
|
const text = validateText(textFromBlocks(last.data.message.content, "text"), "deepseek_harness_agent_result_invalid");
|
|
27246
27283
|
const receipts = proxy.receipts;
|
|
27284
|
+
if (thread.effectiveModel !== receipts.at(-1).model) {
|
|
27285
|
+
thread = { ...thread, effectiveModel: receipts.at(-1).model };
|
|
27286
|
+
await input.onThreadReady?.(thread);
|
|
27287
|
+
}
|
|
27247
27288
|
await handle.dispose();
|
|
27248
27289
|
return {
|
|
27249
27290
|
thread,
|
|
@@ -33852,7 +33893,7 @@ var init_pi_transport = __esm({
|
|
|
33852
33893
|
if (new Set(this.receipts.map((receipt) => receipt.id)).size !== this.receipts.length) throw new Error("pi_response_identity_reused");
|
|
33853
33894
|
for (const receipt of this.receipts) {
|
|
33854
33895
|
if (receipt.reasoningEffortChanged || (this.options.model.reasoning ? receipt.reasoningEffort !== this.options.expectedEffort.native : receipt.reasoningEffort !== null && receipt.reasoningEffort !== "none")) throw new Error("pi_native_effort_mismatch");
|
|
33855
|
-
if (!receipt.id || receipt.model !==
|
|
33896
|
+
if (!receipt.id || typeof receipt.model !== "string" || !receipt.model.trim() || receipt.model.length > 256 || /[\u0000-\u001f\u007f]/u.test(receipt.model) || !receipt.terminal || receipt.input === null || receipt.output === null || receipt.cachedInput > receipt.input || receipt.input + receipt.output <= 0) {
|
|
33856
33897
|
throw new Error("pi_native_receipt_unqualified");
|
|
33857
33898
|
}
|
|
33858
33899
|
}
|
|
@@ -34080,7 +34121,7 @@ var init_pi_adapter = __esm({
|
|
|
34080
34121
|
if (this.activeThreads.has(cwd)) throw fail("pi_thread_busy");
|
|
34081
34122
|
this.activeThreads.add(cwd);
|
|
34082
34123
|
ownedPath = cwd;
|
|
34083
|
-
if (agent.durableThread &&
|
|
34124
|
+
if (agent.durableThread && agent.durableThread.effectiveReasoningEffort !== input.requestedReasoningEffort) throw fail("pi_thread_binding_changed", "model");
|
|
34084
34125
|
}
|
|
34085
34126
|
const settings = SettingsManager.inMemory({
|
|
34086
34127
|
retry: { enabled: false, maxRetries: 0, provider: { maxRetries: 0 } },
|
|
@@ -34107,6 +34148,8 @@ var init_pi_adapter = __esm({
|
|
|
34107
34148
|
if (!info.isFile() || info.isSymbolicLink()) throw fail("pi_session_not_owned");
|
|
34108
34149
|
manager = SessionManager.open(sessionFile, cwd, cwd);
|
|
34109
34150
|
if (manager.getSessionId() !== agent.durableThread.threadId || manager.getHeader()?.cwd !== cwd) throw fail("pi_session_binding_changed");
|
|
34151
|
+
const selection = manager.buildSessionContext().model;
|
|
34152
|
+
if (!selection || selection.provider !== model.provider || selection.modelId !== model.id) throw fail("pi_thread_binding_changed", "model");
|
|
34110
34153
|
} else if (agent) {
|
|
34111
34154
|
const initial = SessionManager.inMemory(cwd, { id: basename2(cwd).slice("agent-".length) });
|
|
34112
34155
|
await writeAtomicInferencePrivateFile(sessionFile, `${JSON.stringify(initial.getHeader())}
|
|
@@ -34150,6 +34193,11 @@ var init_pi_adapter = __esm({
|
|
|
34150
34193
|
session?.agent.abort();
|
|
34151
34194
|
throw boundaryFailure;
|
|
34152
34195
|
}
|
|
34196
|
+
const effectiveModel2 = `${model.provider}/${transport.lastReceipt.model}`;
|
|
34197
|
+
if (thread && thread.effectiveModel !== effectiveModel2) {
|
|
34198
|
+
thread = { ...thread, effectiveModel: effectiveModel2 };
|
|
34199
|
+
await agent.onThreadReady?.(thread);
|
|
34200
|
+
}
|
|
34153
34201
|
const tool = definition.name;
|
|
34154
34202
|
const result2 = await agent.executeTool({ callId, tool, arguments: args });
|
|
34155
34203
|
tools.push({ callId, tool, arguments: args, success: result2.success });
|
|
@@ -34248,7 +34296,7 @@ var init_pi_adapter = __esm({
|
|
|
34248
34296
|
for (let i = 0; i < messages.length; i++) {
|
|
34249
34297
|
const message = messages[i];
|
|
34250
34298
|
const native = observer.receipts[i];
|
|
34251
|
-
if (message.responseId !== native.id || message.provider !== model.provider || message.
|
|
34299
|
+
if (message.responseId !== native.id || message.provider !== model.provider || message.usage.input + message.usage.cacheRead + message.usage.cacheWrite !== native.input || message.usage.output !== native.output || message.usage.cacheRead !== native.cachedInput) throw fail("pi_receipt_mismatch");
|
|
34252
34300
|
}
|
|
34253
34301
|
if (!last) throw fail("pi_result_missing");
|
|
34254
34302
|
if (last.stopReason !== "stop") throw fail("pi_terminal_incomplete");
|
|
@@ -34262,13 +34310,18 @@ var init_pi_adapter = __esm({
|
|
|
34262
34310
|
}
|
|
34263
34311
|
if (!validateOutput(output3)) throw fail("pi_output_schema_mismatch", "schema");
|
|
34264
34312
|
const reasoning = last.content.flatMap((part) => part.type === "thinking" ? [part.thinking] : []).join("");
|
|
34313
|
+
const effectiveModel = `${model.provider}/${observer.receipts.at(-1).model}`;
|
|
34314
|
+
if (agent && thread && thread.effectiveModel !== effectiveModel) {
|
|
34315
|
+
thread = { ...thread, effectiveModel };
|
|
34316
|
+
await agent.onThreadReady?.(thread);
|
|
34317
|
+
}
|
|
34265
34318
|
if (!agent) input.onTerminalDispatchOutcome?.("confirmed_dispatched");
|
|
34266
34319
|
return { thread, tools, turn: {
|
|
34267
34320
|
text,
|
|
34268
34321
|
reasoningContent: reasoning ? Buffer.from(reasoning).subarray(0, 32768).toString("utf8") : null,
|
|
34269
34322
|
reasoningSummary: null,
|
|
34270
34323
|
requestedModel: input.requestedModel,
|
|
34271
|
-
effectiveModel
|
|
34324
|
+
effectiveModel,
|
|
34272
34325
|
requestedReasoningEffort: input.requestedReasoningEffort,
|
|
34273
34326
|
effectiveReasoningEffort: observer.effectiveReasoningEffort(),
|
|
34274
34327
|
adapterRequestId: observer.receipts[0].id,
|
|
@@ -34292,7 +34345,9 @@ var init_pi_adapter = __esm({
|
|
|
34292
34345
|
};
|
|
34293
34346
|
try {
|
|
34294
34347
|
const effort2 = transport.effectiveReasoningEffort();
|
|
34295
|
-
|
|
34348
|
+
const provider = input.requestedModel.slice(0, input.requestedModel.indexOf("/"));
|
|
34349
|
+
const actualModel = transport.lastReceipt?.model;
|
|
34350
|
+
if (actualModel) terminalEvidence = { ...terminalEvidence, effectiveModel: `${provider}/${actualModel}`, effectiveReasoningEffort: effort2 };
|
|
34296
34351
|
} catch {
|
|
34297
34352
|
}
|
|
34298
34353
|
}
|
|
@@ -34300,7 +34355,7 @@ var init_pi_adapter = __esm({
|
|
|
34300
34355
|
try {
|
|
34301
34356
|
const qualified = messages.filter((message, index) => {
|
|
34302
34357
|
const receipt = transport?.receipts[index];
|
|
34303
|
-
return receipt && receipt.terminal && receipt.id === message.responseId &&
|
|
34358
|
+
return receipt && receipt.terminal && receipt.id === message.responseId && message.provider === input.requestedModel.slice(0, input.requestedModel.indexOf("/")) && typeof receipt.model === "string" && Boolean(receipt.model.trim()) && receipt.model.length <= 256 && !/[\u0000-\u001f\u007f]/u.test(receipt.model) && message.usage.input + message.usage.cacheRead + message.usage.cacheWrite === receipt.input && message.usage.output === receipt.output && message.usage.cacheRead === receipt.cachedInput && (receipt.input ?? 0) + (receipt.output ?? 0) > 0;
|
|
34304
34359
|
});
|
|
34305
34360
|
if (qualified.length) usage = usageSum(qualified);
|
|
34306
34361
|
} catch {
|
|
@@ -34920,17 +34975,17 @@ var init_grok_transport_proxy = __esm({
|
|
|
34920
34975
|
const event = record3(JSON.parse(data4));
|
|
34921
34976
|
const native = route === "/responses" ? record3(event.response) : event;
|
|
34922
34977
|
if (native.id !== void 0 || native.model !== void 0) {
|
|
34923
|
-
if (typeof native.id !== "string" || !native.id || !
|
|
34978
|
+
if (typeof native.id !== "string" || !native.id || typeof native.model !== "string" || !native.model.trim() || native.model.length > 256 || /[\u0000-\u001f\u007f]/u.test(native.model) || id2 && native.id !== id2) {
|
|
34924
34979
|
const idPresent = typeof native.id === "string" && native.id.length > 0;
|
|
34925
34980
|
const modelPresent = typeof native.model === "string" && native.model.length > 0;
|
|
34926
34981
|
const modelMatches = native.model === this.options.requestedModel;
|
|
34927
|
-
if (idPresent && !modelMatches && id2 && native.id !== id2
|
|
34982
|
+
if (idPresent && !modelMatches && id2 && native.id !== id2) {
|
|
34928
34983
|
throw new Error("grok_provider_response_id_changed");
|
|
34929
34984
|
}
|
|
34930
34985
|
const eventType = route === "/responses" ? event.type : event.object;
|
|
34931
34986
|
this.responseIdentityFailure = grokResponseIdentityDiagnosticSchema.parse({
|
|
34932
34987
|
schema_version: "external_inference_grok_response_identity_v1",
|
|
34933
|
-
reason: !idPresent ? "invalid_id" :
|
|
34988
|
+
reason: !idPresent ? "invalid_id" : id2 && native.id !== id2 ? "changed_id" : "model_mismatch",
|
|
34934
34989
|
route,
|
|
34935
34990
|
response_event: ["response.created", "response.in_progress", "response.completed", "chat.completion.chunk"].includes(String(eventType)) ? eventType : "other",
|
|
34936
34991
|
id_present: idPresent,
|
|
@@ -35605,11 +35660,11 @@ var init_grok_adapter = __esm({
|
|
|
35605
35660
|
isDefault: state.currentModelId === model.modelId
|
|
35606
35661
|
}];
|
|
35607
35662
|
});
|
|
35608
|
-
grokPromptUsage = (value, expectedModel
|
|
35663
|
+
grokPromptUsage = (value, expectedModel) => {
|
|
35609
35664
|
const usage = grokObject(value);
|
|
35610
35665
|
if (usage.usageIsIncomplete === true) throw new Error("grok_usage_incomplete");
|
|
35611
35666
|
const models = Object.keys(grokObject(usage.modelUsage));
|
|
35612
|
-
if (models.length !== 1 ||
|
|
35667
|
+
if (models.length !== 1 || models[0] !== expectedModel) throw new Error("grok_effective_model_mismatch");
|
|
35613
35668
|
const inputTokens = integer2(usage.inputTokens, "input_tokens");
|
|
35614
35669
|
const outputTokens = integer2(usage.outputTokens, "output_tokens");
|
|
35615
35670
|
const cachedInputTokens = integer2(usage.cachedReadTokens, "cached_input_tokens");
|
|
@@ -35880,7 +35935,7 @@ var init_grok_adapter = __esm({
|
|
|
35880
35935
|
const selectedCapability = grokModelCapabilities(catalog).find((entry) => entry.model === input.requestedModel);
|
|
35881
35936
|
if (!selectedCapability?.supportedReasoningEfforts.includes(input.requestedReasoningEffort)) throw new Error("grok_model_selection_unavailable");
|
|
35882
35937
|
if (provider && !provider.allowedEffectiveModels) throw new Error("grok_model_identity_contract_missing");
|
|
35883
|
-
const {
|
|
35938
|
+
const { transportModel } = proxy.bindModelIdentity(input.requestedModel, provider?.allowedEffectiveModels);
|
|
35884
35939
|
const metadata = {
|
|
35885
35940
|
systemPromptOverride: input.systemPrompt,
|
|
35886
35941
|
agentProfile: agentProfile(Boolean(agent)),
|
|
@@ -35947,8 +36002,9 @@ var init_grok_adapter = __esm({
|
|
|
35947
36002
|
if (meta3.structuredOutputError || meta3.structuredOutput === void 0) throw new Error("grok_structured_output_missing");
|
|
35948
36003
|
const text = JSON.stringify(meta3.structuredOutput);
|
|
35949
36004
|
if (Buffer.byteLength(text) > 3e5) throw new Error("grok_result_too_large");
|
|
35950
|
-
const
|
|
35951
|
-
|
|
36005
|
+
const actualModel = proxy.observedModel;
|
|
36006
|
+
if (!actualModel) throw new Error("grok_transport_receipt_missing");
|
|
36007
|
+
const usage = grokPromptUsage(meta3.usage, actualModel);
|
|
35952
36008
|
if (!proxy.dispatched || !proxy.responded || proxy.terminalFailure) throw new Error(proxy.failureCode ?? "grok_transport_receipt_missing");
|
|
35953
36009
|
const receipts = proxy.receipts;
|
|
35954
36010
|
if (!receipts.length || proxy.pendingRequest || receipts.some((receipt) => receipt.model !== actualModel || receipt.requestedReasoningEffort !== input.requestedReasoningEffort || receipt.input === null || receipt.output === null || receipt.cachedInput === null) || receipts.reduce((sum, receipt) => sum + receipt.input, 0) !== usage.inputTokens || receipts.reduce((sum, receipt) => sum + receipt.output, 0) !== usage.outputTokens || receipts.reduce((sum, receipt) => sum + receipt.cachedInput, 0) !== usage.cachedInputTokens || integer2(grokObject(meta3.usage).modelCalls, "model_calls") !== receipts.length) {
|
|
@@ -36118,7 +36174,7 @@ import { createServer as createServer5 } from "node:http";
|
|
|
36118
36174
|
import { access as access3, lstat as lstat8, readdir as readdir4, realpath as realpath7, rm as rm9 } from "node:fs/promises";
|
|
36119
36175
|
import { basename as basename4, dirname as dirname9, join as join12, resolve as resolve7 } from "node:path";
|
|
36120
36176
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
36121
|
-
var import_ajv2, failure, object4, receiptUsage, assertOwnedRuntime, cleanupExoOwnedState, ExoForegroundAdapter;
|
|
36177
|
+
var import_ajv2, failure, object4, validModel, receiptUsage, assertOwnedRuntime, cleanupExoOwnedState, ExoForegroundAdapter;
|
|
36122
36178
|
var init_exo_adapter = __esm({
|
|
36123
36179
|
"lib/inference-host/exo-adapter.ts"() {
|
|
36124
36180
|
"use strict";
|
|
@@ -36137,6 +36193,7 @@ var init_exo_adapter = __esm({
|
|
|
36137
36193
|
dispatchOutcome: dispatched ? "outcome_unknown" : "not_dispatched"
|
|
36138
36194
|
});
|
|
36139
36195
|
object4 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
36196
|
+
validModel = (value) => typeof value === "string" && Boolean(value.trim()) && value.length <= 256 && !/[\u0000-\u001f\u007f]/u.test(value);
|
|
36140
36197
|
receiptUsage = (value) => {
|
|
36141
36198
|
const usage = object4(value);
|
|
36142
36199
|
for (const key of ["inputTokens", "cachedInputTokens", "outputTokens", "reasoningOutputTokens", "totalTokens"]) {
|
|
@@ -36159,6 +36216,7 @@ var init_exo_adapter = __esm({
|
|
|
36159
36216
|
const raw = await readInferencePrivateFile(join12(root, "vtx-owner.json"), "Exo state owner");
|
|
36160
36217
|
const owner2 = raw === null ? {} : object4(JSON.parse(raw));
|
|
36161
36218
|
if (owner2.adapter !== "exo" || owner2.id !== id2 || owner2.root !== root) throw failure("exo_state_not_owned");
|
|
36219
|
+
return owner2;
|
|
36162
36220
|
};
|
|
36163
36221
|
cleanupExoOwnedState = async (stateRoot) => {
|
|
36164
36222
|
try {
|
|
@@ -36297,8 +36355,10 @@ var init_exo_adapter = __esm({
|
|
|
36297
36355
|
if (!credential || credential.provider !== provider) throw failure("exo_credential_required", false, "auth");
|
|
36298
36356
|
const id2 = agent?.durableThread?.threadId ?? randomUUID6();
|
|
36299
36357
|
const runtimeRoot = agent?.durableThread ? await this.ownedRoot(agent.durableThread) : join12(await realpath7(this.options.stateRoot), `${agent ? "agent" : "attempt"}-${id2}`);
|
|
36300
|
-
|
|
36301
|
-
|
|
36358
|
+
let thread = { threadId: id2, threadPath: runtimeRoot, effectiveModel: input.requestedModel, effectiveReasoningEffort: input.requestedReasoningEffort };
|
|
36359
|
+
const owner2 = agent?.durableThread ? await assertOwnedRuntime(runtimeRoot, id2) : null;
|
|
36360
|
+
const boundSelection = owner2?.requestedModel ?? agent?.durableThread?.effectiveModel;
|
|
36361
|
+
if (agent?.durableThread && (boundSelection !== input.requestedModel || agent.durableThread.effectiveReasoningEffort !== thread.effectiveReasoningEffort)) throw failure("exo_thread_selection_mismatch");
|
|
36302
36362
|
const schema = agent ? agent.outputSchema : JSON.parse(input.outputSchemaJson);
|
|
36303
36363
|
const validate = new import_ajv2.default({ allErrors: true }).compile(schema);
|
|
36304
36364
|
const started = Date.now();
|
|
@@ -36373,11 +36433,15 @@ var init_exo_adapter = __esm({
|
|
|
36373
36433
|
return;
|
|
36374
36434
|
}
|
|
36375
36435
|
if (request.url === "/tool") {
|
|
36376
|
-
if (!agent || !dispatched || toolBusy || typeof body.callId !== "string" || toolIds.has(body.callId) || !CODEX_AGENT_DYNAMIC_TOOLS.includes(body.tool) || body.effectiveModel
|
|
36436
|
+
if (!agent || !dispatched || toolBusy || typeof body.callId !== "string" || toolIds.has(body.callId) || !CODEX_AGENT_DYNAMIC_TOOLS.includes(body.tool) || !validModel(body.effectiveModel) || body.effectiveReasoningEffort !== input.requestedReasoningEffort) throw failure("exo_tool_not_authorized");
|
|
36377
36437
|
toolBusy = true;
|
|
36378
36438
|
toolIds.add(body.callId);
|
|
36379
36439
|
const call = { callId: body.callId, tool: body.tool, arguments: object4(body.arguments) };
|
|
36380
36440
|
try {
|
|
36441
|
+
if (thread.effectiveModel !== body.effectiveModel) {
|
|
36442
|
+
thread = { ...thread, effectiveModel: body.effectiveModel };
|
|
36443
|
+
await agent.onThreadReady?.(thread);
|
|
36444
|
+
}
|
|
36381
36445
|
let result2;
|
|
36382
36446
|
try {
|
|
36383
36447
|
result2 = await agent.executeTool(call);
|
|
@@ -36411,7 +36475,10 @@ var init_exo_adapter = __esm({
|
|
|
36411
36475
|
try {
|
|
36412
36476
|
input.signal?.throwIfAborted();
|
|
36413
36477
|
await ensureInferencePrivateDirectory(runtimeRoot);
|
|
36414
|
-
if (!
|
|
36478
|
+
if (!owner2 || owner2.requestedModel === void 0) await writeAtomicInferencePrivateFile(
|
|
36479
|
+
join12(runtimeRoot, "vtx-owner.json"),
|
|
36480
|
+
JSON.stringify({ adapter: "exo", id: id2, root: runtimeRoot, requestedModel: input.requestedModel })
|
|
36481
|
+
);
|
|
36415
36482
|
await new Promise((done, reject) => {
|
|
36416
36483
|
server.once("error", reject);
|
|
36417
36484
|
server.listen(0, "127.0.0.1", done);
|
|
@@ -36432,7 +36499,7 @@ var init_exo_adapter = __esm({
|
|
|
36432
36499
|
}
|
|
36433
36500
|
const result2 = terminal;
|
|
36434
36501
|
if (!result2 || workerFailure) throw failure("exo_terminal_receipt_missing", dispatched);
|
|
36435
|
-
if (result2.providerModel
|
|
36502
|
+
if (!validModel(result2.providerModel) || result2.reasoningEffort !== input.requestedReasoningEffort) throw failure("exo_effective_identity_mismatch", dispatched, "model");
|
|
36436
36503
|
const usage = receiptUsage(result2.usage);
|
|
36437
36504
|
if (!usage) throw failure("exo_usage_invalid", dispatched);
|
|
36438
36505
|
let validOutput = false;
|
|
@@ -36444,13 +36511,18 @@ var init_exo_adapter = __esm({
|
|
|
36444
36511
|
}
|
|
36445
36512
|
if (!validOutput || typeof result2.text !== "string") throw failure("exo_output_schema_invalid", dispatched, "schema");
|
|
36446
36513
|
if (typeof result2.responseId !== "string" || !result2.responseId) throw failure("exo_response_id_missing", dispatched);
|
|
36514
|
+
const effectiveModel = `${provider}/${result2.providerModel}`;
|
|
36515
|
+
if (thread.effectiveModel !== effectiveModel) {
|
|
36516
|
+
thread = { ...thread, effectiveModel };
|
|
36517
|
+
await agent?.onThreadReady?.(thread);
|
|
36518
|
+
}
|
|
36447
36519
|
if (!agent) input.onTerminalDispatchOutcome?.("confirmed_dispatched");
|
|
36448
36520
|
return { thread, tools, turn: {
|
|
36449
36521
|
text: result2.text,
|
|
36450
36522
|
reasoningContent: null,
|
|
36451
36523
|
reasoningSummary: null,
|
|
36452
36524
|
requestedModel: input.requestedModel,
|
|
36453
|
-
effectiveModel
|
|
36525
|
+
effectiveModel,
|
|
36454
36526
|
requestedReasoningEffort: input.requestedReasoningEffort,
|
|
36455
36527
|
effectiveReasoningEffort: input.requestedReasoningEffort,
|
|
36456
36528
|
adapterRequestId: id2,
|
|
@@ -36466,7 +36538,7 @@ var init_exo_adapter = __esm({
|
|
|
36466
36538
|
const receipt = terminal;
|
|
36467
36539
|
const completed = receipt !== null || knownFailure?.terminalKnown === true;
|
|
36468
36540
|
const evidence = receipt ?? knownFailure;
|
|
36469
|
-
const identityQualified = evidence?.providerModel
|
|
36541
|
+
const identityQualified = validModel(evidence?.providerModel) && evidence?.reasoningEffort === input.requestedReasoningEffort;
|
|
36470
36542
|
const outcome = !dispatched ? "not_dispatched" : completed ? "confirmed_dispatched" : "outcome_unknown";
|
|
36471
36543
|
const knownCode = typeof knownFailure?.code === "string" && /^exo_[a-z_]+$/u.test(knownFailure.code) ? knownFailure.code : null;
|
|
36472
36544
|
const observedCode = completed ? knownCode ?? (error48 instanceof CodexAppServerError ? error48.code : "exo_turn_failed") : abort.signal.aborted ? "exo_interrupted" : "exo_unconfirmed_result";
|
|
@@ -36482,7 +36554,7 @@ var init_exo_adapter = __esm({
|
|
|
36482
36554
|
httpStatusCode: ["quota_exceeded", "provider_rate_limited"].includes(code) ? 429 : null,
|
|
36483
36555
|
retryAtMs: completed && Number.isSafeInteger(evidence?.retryAtMs) && Number(evidence?.retryAtMs) > Date.now() ? Number(evidence?.retryAtMs) : null,
|
|
36484
36556
|
terminalEvidence: completed ? {
|
|
36485
|
-
effectiveModel: identityQualified ?
|
|
36557
|
+
effectiveModel: identityQualified ? `${provider}/${evidence.providerModel}` : null,
|
|
36486
36558
|
effectiveReasoningEffort: identityQualified ? input.requestedReasoningEffort : null,
|
|
36487
36559
|
adapterRequestId: id2,
|
|
36488
36560
|
adapterResponseId: typeof evidence?.responseId === "string" && evidence.responseId ? evidence.responseId : null
|
|
@@ -40784,7 +40856,8 @@ var init_runner = __esm({
|
|
|
40784
40856
|
const mapping2 = jobInput.allowed_model_identities.find(
|
|
40785
40857
|
(candidate) => candidate.requested_model === jobInput.requested_model
|
|
40786
40858
|
);
|
|
40787
|
-
|
|
40859
|
+
const effectiveModelMatches = mapping2 !== void 0 && jobInput.controller.adapter === (this.options.adapterId ?? "codex") && typeof result2.effectiveModel === "string" && result2.effectiveModel.trim().length > 0 && result2.effectiveModel.length <= 256 && !/[\u0000-\u001f\u007f]/u.test(result2.effectiveModel);
|
|
40860
|
+
if (result2.requestedModel !== jobInput.requested_model || result2.requestedReasoningEffort !== jobInput.requested_reasoning_effort || !effectiveModelMatches || !jobInput.allowed_effective_reasoning_efforts.includes(result2.effectiveReasoningEffort)) {
|
|
40788
40861
|
throw new InferenceHostRunnerError(
|
|
40789
40862
|
"effective_model_mismatch",
|
|
40790
40863
|
"The effective adapter model provenance did not match the immutable allowance."
|