@jacobbd/relay-ai 0.11.1 → 0.12.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/README.md +2 -2
- package/dist/{chunk-TRM2WGI6.js → chunk-3R25QO5X.js} +11 -1
- package/dist/chunk-3R25QO5X.js.map +1 -0
- package/dist/{chunk-VXQ7ZVTW.js → chunk-FD5EDSBM.js} +2 -2
- package/dist/{chunk-YD6A3ZB3.js → chunk-HL3EZ4OU.js} +171 -18
- package/dist/chunk-HL3EZ4OU.js.map +1 -0
- package/dist/{chunk-O2XZFXHG.js → chunk-Z5GL4ALA.js} +34 -6
- package/dist/chunk-Z5GL4ALA.js.map +1 -0
- package/dist/cli.js +241 -234
- package/dist/cli.js.map +1 -1
- package/dist/core/index.js +11 -1
- package/dist/core/index.js.map +1 -1
- package/dist/{manual-models-VEBTRQFK.js → manual-models-A6FSQV3S.js} +3 -3
- package/dist/{provider-templates-JY3NXZK7.js → provider-templates-WXVGL4XE.js} +2 -2
- package/dist/{ui-command-WKPJI2CU.js → ui-command-J7PTTCM5.js} +6 -6
- package/package.json +1 -1
- package/dist/chunk-O2XZFXHG.js.map +0 -1
- package/dist/chunk-TRM2WGI6.js.map +0 -1
- package/dist/chunk-YD6A3ZB3.js.map +0 -1
- /package/dist/{chunk-VXQ7ZVTW.js.map → chunk-FD5EDSBM.js.map} +0 -0
- /package/dist/{manual-models-VEBTRQFK.js.map → manual-models-A6FSQV3S.js.map} +0 -0
- /package/dist/{provider-templates-JY3NXZK7.js.map → provider-templates-WXVGL4XE.js.map} +0 -0
- /package/dist/{ui-command-WKPJI2CU.js.map → ui-command-J7PTTCM5.js.map} +0 -0
|
@@ -7,7 +7,7 @@ import { join } from "path";
|
|
|
7
7
|
// package.json
|
|
8
8
|
var package_default = {
|
|
9
9
|
name: "@jacobbd/relay-ai",
|
|
10
|
-
version: "0.
|
|
10
|
+
version: "0.12.0",
|
|
11
11
|
publishConfig: {
|
|
12
12
|
access: "public"
|
|
13
13
|
},
|
|
@@ -4173,6 +4173,30 @@ function resolveUpstreamTools(tools, messages) {
|
|
|
4173
4173
|
return upstream;
|
|
4174
4174
|
}
|
|
4175
4175
|
|
|
4176
|
+
// src/tool-schema.ts
|
|
4177
|
+
var GOOGLE_NPM = /* @__PURE__ */ new Set(["@ai-sdk/google", "@ai-sdk/google-vertex"]);
|
|
4178
|
+
function collapseSchemaUnionTypes(value) {
|
|
4179
|
+
if (Array.isArray(value)) return value.map(collapseSchemaUnionTypes);
|
|
4180
|
+
if (!value || typeof value !== "object") return value;
|
|
4181
|
+
const out = {};
|
|
4182
|
+
for (const [key, child] of Object.entries(value)) {
|
|
4183
|
+
if (key === "type" && Array.isArray(child)) {
|
|
4184
|
+
const nonNull = child.filter((entry) => entry !== "null");
|
|
4185
|
+
if (nonNull.length === 1) {
|
|
4186
|
+
out.type = nonNull[0];
|
|
4187
|
+
if (nonNull.length < child.length) out.nullable = true;
|
|
4188
|
+
continue;
|
|
4189
|
+
}
|
|
4190
|
+
}
|
|
4191
|
+
out[key] = collapseSchemaUnionTypes(child);
|
|
4192
|
+
}
|
|
4193
|
+
return out;
|
|
4194
|
+
}
|
|
4195
|
+
function normalizeToolSchemaForNpm(schema, npm) {
|
|
4196
|
+
if (!npm || !GOOGLE_NPM.has(npm)) return schema;
|
|
4197
|
+
return collapseSchemaUnionTypes(schema);
|
|
4198
|
+
}
|
|
4199
|
+
|
|
4176
4200
|
// src/sdk-adapter.ts
|
|
4177
4201
|
var NEEDS_TRAILING_TOOL_NUDGE = /* @__PURE__ */ new Set(["@ai-sdk/alibaba"]);
|
|
4178
4202
|
var TRAILING_TOOL_NUDGE_TEXT = "Continue.";
|
|
@@ -4303,12 +4327,15 @@ function stripNullInputs(input) {
|
|
|
4303
4327
|
}
|
|
4304
4328
|
return out;
|
|
4305
4329
|
}
|
|
4306
|
-
function translateTools(anthropicTools) {
|
|
4330
|
+
function translateTools(anthropicTools, npm) {
|
|
4307
4331
|
if (!anthropicTools?.length) return void 0;
|
|
4308
4332
|
const tools = {};
|
|
4309
4333
|
for (const t of anthropicTools) {
|
|
4310
4334
|
if (!t.name || !t.input_schema) continue;
|
|
4311
|
-
tools[t.name] = tool({
|
|
4335
|
+
tools[t.name] = tool({
|
|
4336
|
+
description: t.description ?? "",
|
|
4337
|
+
inputSchema: jsonSchema(normalizeToolSchemaForNpm(t.input_schema, npm))
|
|
4338
|
+
});
|
|
4312
4339
|
}
|
|
4313
4340
|
return Object.keys(tools).length ? tools : void 0;
|
|
4314
4341
|
}
|
|
@@ -4356,7 +4383,7 @@ function translateRequest(body, npm, options) {
|
|
|
4356
4383
|
return {
|
|
4357
4384
|
instructions: options?.openAiOAuth ? void 0 : systemText,
|
|
4358
4385
|
messages: translateMessages(messages, npm, options?.onDebug),
|
|
4359
|
-
tools: translateTools(upstreamTools.length ? upstreamTools : void 0),
|
|
4386
|
+
tools: translateTools(upstreamTools.length ? upstreamTools : void 0, npm),
|
|
4360
4387
|
toolChoice: translateToolChoice(body.tool_choice),
|
|
4361
4388
|
maxOutputTokens: options?.openAiOAuth ? void 0 : body.max_tokens,
|
|
4362
4389
|
temperature: body.temperature,
|
|
@@ -4681,7 +4708,7 @@ export {
|
|
|
4681
4708
|
getLogsPath,
|
|
4682
4709
|
getVertexModelsPath,
|
|
4683
4710
|
getLegacyConfPath,
|
|
4684
|
-
|
|
4711
|
+
contextWindowFromHeuristics,
|
|
4685
4712
|
resolveContextWindow,
|
|
4686
4713
|
stripOneMContextSuffix,
|
|
4687
4714
|
claudeCodeClientModelId,
|
|
@@ -4751,6 +4778,7 @@ export {
|
|
|
4751
4778
|
splitToolUseId,
|
|
4752
4779
|
encodeToolUseId,
|
|
4753
4780
|
serializeToolResultContent,
|
|
4781
|
+
normalizeToolSchemaForNpm,
|
|
4754
4782
|
formatUpstreamErrorTrace,
|
|
4755
4783
|
formatUpstreamError,
|
|
4756
4784
|
upstreamHttpStatus,
|
|
@@ -4760,4 +4788,4 @@ export {
|
|
|
4760
4788
|
streamAnthropicResponse,
|
|
4761
4789
|
generateAnthropicResponse
|
|
4762
4790
|
};
|
|
4763
|
-
//# sourceMappingURL=chunk-
|
|
4791
|
+
//# sourceMappingURL=chunk-Z5GL4ALA.js.map
|