@jacobbd/relay-ai 0.12.8 → 0.12.10
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/dist/{chunk-BK34AFR4.js → chunk-2KEDU24N.js} +2 -2
- package/dist/{chunk-HLPRPOIV.js → chunk-OIL75EGI.js} +57 -10
- package/dist/chunk-OIL75EGI.js.map +1 -0
- package/dist/{chunk-VUEGVJMH.js → chunk-YIEEHFVL.js} +2 -2
- package/dist/cli.js +51 -6
- package/dist/cli.js.map +1 -1
- package/dist/core/index.js +102 -10
- package/dist/core/index.js.map +1 -1
- package/dist/{manual-models-BAWTDEYL.js → manual-models-XV4TB7FB.js} +3 -3
- package/dist/{ui-command-QUT3R4HW.js → ui-command-CJYKHNG6.js} +4 -4
- package/package.json +1 -1
- package/dist/chunk-HLPRPOIV.js.map +0 -1
- /package/dist/{chunk-BK34AFR4.js.map → chunk-2KEDU24N.js.map} +0 -0
- /package/dist/{chunk-VUEGVJMH.js.map → chunk-YIEEHFVL.js.map} +0 -0
- /package/dist/{manual-models-BAWTDEYL.js.map → manual-models-XV4TB7FB.js.map} +0 -0
- /package/dist/{ui-command-QUT3R4HW.js.map → ui-command-CJYKHNG6.js.map} +0 -0
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
supportsManualModels,
|
|
11
11
|
translateRequest,
|
|
12
12
|
validateCustomEndpointUrl
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-OIL75EGI.js";
|
|
14
14
|
|
|
15
15
|
// src/registry/validate-manual-model.ts
|
|
16
16
|
import { randomUUID } from "crypto";
|
|
@@ -149,4 +149,4 @@ export {
|
|
|
149
149
|
addManualModel,
|
|
150
150
|
removeManualModel
|
|
151
151
|
};
|
|
152
|
-
//# sourceMappingURL=chunk-
|
|
152
|
+
//# sourceMappingURL=chunk-YIEEHFVL.js.map
|
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
addManualModel,
|
|
4
4
|
removeManualModel
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YIEEHFVL.js";
|
|
6
6
|
import {
|
|
7
7
|
CODEX_APP_AUTO_COMPACT_RATIO,
|
|
8
8
|
CODEX_APP_PROVIDER_ID,
|
|
@@ -148,7 +148,7 @@ import {
|
|
|
148
148
|
waitForCodexAppQuit,
|
|
149
149
|
writeSecureLogLine,
|
|
150
150
|
zenRegistryStub
|
|
151
|
-
} from "./chunk-
|
|
151
|
+
} from "./chunk-2KEDU24N.js";
|
|
152
152
|
import {
|
|
153
153
|
filterTemplates,
|
|
154
154
|
getTemplateById,
|
|
@@ -222,7 +222,7 @@ import {
|
|
|
222
222
|
thinkingProviderOptions,
|
|
223
223
|
upstreamHttpStatus,
|
|
224
224
|
validateCustomEndpointUrl
|
|
225
|
-
} from "./chunk-
|
|
225
|
+
} from "./chunk-OIL75EGI.js";
|
|
226
226
|
import "./chunk-JIDIH7DS.js";
|
|
227
227
|
|
|
228
228
|
// src/cli.ts
|
|
@@ -2544,6 +2544,22 @@ function messageContent(content) {
|
|
|
2544
2544
|
});
|
|
2545
2545
|
return parts.length > 0 ? parts : [{ type: "text", text: "" }];
|
|
2546
2546
|
}
|
|
2547
|
+
function splitToolOutputImages(output) {
|
|
2548
|
+
if (!Array.isArray(output)) return { content: serializeToolResultContent(output), images: [] };
|
|
2549
|
+
const images = [];
|
|
2550
|
+
const rest = [];
|
|
2551
|
+
for (const part of output) {
|
|
2552
|
+
const record = part && typeof part === "object" ? part : void 0;
|
|
2553
|
+
const imageUrl = record?.["type"] === "input_image" ? record["image_url"] : void 0;
|
|
2554
|
+
if (typeof imageUrl === "string" && imageUrl.trim()) images.push(imageUrl);
|
|
2555
|
+
else rest.push(part);
|
|
2556
|
+
}
|
|
2557
|
+
if (images.length === 0) return { content: serializeToolResultContent(output), images };
|
|
2558
|
+
return {
|
|
2559
|
+
content: rest.length > 0 ? serializeToolResultContent(rest) : "[image attached in the following message]",
|
|
2560
|
+
images
|
|
2561
|
+
};
|
|
2562
|
+
}
|
|
2547
2563
|
function extractDeveloperAndInstructions(items, instructions) {
|
|
2548
2564
|
const developerParts = [];
|
|
2549
2565
|
const remaining = [];
|
|
@@ -2668,15 +2684,26 @@ function translateResponsesInput(input, instructions, npm, toolContext = createC
|
|
|
2668
2684
|
messages.push({ role: "assistant", content: parts });
|
|
2669
2685
|
} else if (item.type === "function_call_output") {
|
|
2670
2686
|
const { rawId } = splitToolUseId(item.call_id);
|
|
2687
|
+
const toolName = toolNames.get(rawId) ?? "unknown";
|
|
2688
|
+
const { content, images } = splitToolOutputImages(item.output);
|
|
2671
2689
|
messages.push({
|
|
2672
2690
|
role: "tool",
|
|
2673
2691
|
content: [{
|
|
2674
2692
|
type: "tool-result",
|
|
2675
2693
|
toolCallId: rawId,
|
|
2676
|
-
toolName
|
|
2677
|
-
output: { type: "text", value:
|
|
2694
|
+
toolName,
|
|
2695
|
+
output: { type: "text", value: content }
|
|
2678
2696
|
}]
|
|
2679
2697
|
});
|
|
2698
|
+
if (images.length > 0) {
|
|
2699
|
+
messages.push({
|
|
2700
|
+
role: "user",
|
|
2701
|
+
content: [
|
|
2702
|
+
{ type: "text", text: `Image${images.length > 1 ? "s" : ""} returned by ${toolName} (${rawId}):` },
|
|
2703
|
+
...images.map((image) => ({ type: "image", image }))
|
|
2704
|
+
]
|
|
2705
|
+
});
|
|
2706
|
+
}
|
|
2680
2707
|
} else if (item.type === "tool_search_call") {
|
|
2681
2708
|
const { rawId } = splitToolUseId(item.call_id);
|
|
2682
2709
|
messages.push({
|
|
@@ -4097,6 +4124,11 @@ function isExternalToolCallItem(item) {
|
|
|
4097
4124
|
function isExternalToolContinuation(input) {
|
|
4098
4125
|
return Array.isArray(input) && input.length > 0 && input.some(isExternalToolOutputItem) && !input.some(isExternalToolCallItem);
|
|
4099
4126
|
}
|
|
4127
|
+
var IMAGE_PART_CHAR_WEIGHT = 4e3;
|
|
4128
|
+
function isImageContentPart(part) {
|
|
4129
|
+
if (part["type"] === "image") return true;
|
|
4130
|
+
return part["type"] === "file" && typeof part["mediaType"] === "string" && part["mediaType"].startsWith("image");
|
|
4131
|
+
}
|
|
4100
4132
|
function estimateCodexRequestChars(params) {
|
|
4101
4133
|
let chars = (params.instructions ?? "").length;
|
|
4102
4134
|
for (const msg of params.messages) {
|
|
@@ -4106,6 +4138,8 @@ function estimateCodexRequestChars(params) {
|
|
|
4106
4138
|
const p16 = part;
|
|
4107
4139
|
if (typeof p16["text"] === "string") {
|
|
4108
4140
|
chars += p16["text"].length;
|
|
4141
|
+
} else if (isImageContentPart(p16)) {
|
|
4142
|
+
chars += IMAGE_PART_CHAR_WEIGHT;
|
|
4109
4143
|
} else {
|
|
4110
4144
|
chars += JSON.stringify(part).length;
|
|
4111
4145
|
}
|
|
@@ -4137,6 +4171,17 @@ function clipLargeTextParts(params, maxCharsPerPart) {
|
|
|
4137
4171
|
content: msg.content.map((part) => {
|
|
4138
4172
|
if (!part || typeof part !== "object") return part;
|
|
4139
4173
|
const p16 = part;
|
|
4174
|
+
if (p16["type"] === "tool-result") {
|
|
4175
|
+
const output = p16["output"];
|
|
4176
|
+
if (!output) return part;
|
|
4177
|
+
if (typeof output["value"] === "string" && (output["type"] === "text" || output["type"] === "error-text")) {
|
|
4178
|
+
return { ...p16, output: { ...output, value: clipTextForContext(output["value"], maxCharsPerPart) } };
|
|
4179
|
+
}
|
|
4180
|
+
if (output["type"] === "json") {
|
|
4181
|
+
return { ...p16, output: { type: "text", value: clipTextForContext(JSON.stringify(output["value"]), maxCharsPerPart) } };
|
|
4182
|
+
}
|
|
4183
|
+
return part;
|
|
4184
|
+
}
|
|
4140
4185
|
if (typeof p16.text !== "string") return part;
|
|
4141
4186
|
return { ...p16, text: clipTextForContext(p16.text, maxCharsPerPart) };
|
|
4142
4187
|
})
|
|
@@ -16188,7 +16233,7 @@ Options:
|
|
|
16188
16233
|
--trace Write debug logs under ~/.relay-ai/logs/`);
|
|
16189
16234
|
return 0;
|
|
16190
16235
|
}
|
|
16191
|
-
const { runUiCommand } = await import("./ui-command-
|
|
16236
|
+
const { runUiCommand } = await import("./ui-command-CJYKHNG6.js");
|
|
16192
16237
|
return runUiCommand({ trace: parsed.trace, serverMode: parsed.uiServerMode });
|
|
16193
16238
|
}
|
|
16194
16239
|
if (parsed.command === "models") {
|