@jacobbd/relay-ai 0.12.6 → 0.12.8

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.
@@ -10,7 +10,7 @@ import {
10
10
  supportsManualModels,
11
11
  translateRequest,
12
12
  validateCustomEndpointUrl
13
- } from "./chunk-VPDX24ZR.js";
13
+ } from "./chunk-HLPRPOIV.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-6ULON7FU.js.map
152
+ //# sourceMappingURL=chunk-VUEGVJMH.js.map
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  addManualModel,
4
4
  removeManualModel
5
- } from "./chunk-6ULON7FU.js";
5
+ } from "./chunk-VUEGVJMH.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-5MEDBKPX.js";
151
+ } from "./chunk-BK34AFR4.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-VPDX24ZR.js";
225
+ } from "./chunk-HLPRPOIV.js";
226
226
  import "./chunk-JIDIH7DS.js";
227
227
 
228
228
  // src/cli.ts
@@ -2875,6 +2875,16 @@ function resolveOutputKind(flatName, ctx) {
2875
2875
  if (ns) return { kind: "namespace", namespace: ns.namespace, name: ns.name };
2876
2876
  return { kind: "plain" };
2877
2877
  }
2878
+ function toolItemId(kind, upstreamId) {
2879
+ switch (kind.kind) {
2880
+ case "tool_search":
2881
+ return upstreamId.startsWith("tsc_") ? upstreamId : newItemId("tsc");
2882
+ case "custom":
2883
+ return upstreamId.startsWith("ctc_") ? upstreamId : newItemId("ctc");
2884
+ default:
2885
+ return functionCallItemId(upstreamId);
2886
+ }
2887
+ }
2878
2888
  function buildFinalToolItem(kind, flatName, callId, itemId, argsStr) {
2879
2889
  argsStr = normalizeCodexSubagentArguments(flatName, argsStr);
2880
2890
  switch (kind.kind) {
@@ -2962,14 +2972,16 @@ async function writeResponsesStream(fullStream, modelId, write, onDone, onProgre
2962
2972
  return state;
2963
2973
  };
2964
2974
  const createToolState = (rawId, name, signature) => {
2975
+ const kind = resolveOutputKind(name ?? "", options?.toolContext);
2965
2976
  const upstreamId = rawId ?? newItemId("call");
2966
- const itemId = functionCallItemId(upstreamId);
2977
+ const itemId = toolItemId(kind, upstreamId);
2967
2978
  const state = rememberToolState({
2968
2979
  itemId,
2969
2980
  callId: encodeToolUseId(upstreamId, signature, false),
2970
2981
  name: name ?? "unknown",
2971
2982
  outputIndex: outputIndex++,
2972
- args: ""
2983
+ args: "",
2984
+ kind
2973
2985
  });
2974
2986
  emit("response.output_item.added", {
2975
2987
  type: "response.output_item.added",
@@ -3256,7 +3268,7 @@ async function writeResponsesStream(fullStream, modelId, write, onDone, onProgre
3256
3268
  output_index: tool4.outputIndex,
3257
3269
  arguments: normalizedArgs
3258
3270
  });
3259
- const fcItem = buildFinalToolItem(resolveOutputKind(tool4.name, options?.toolContext), tool4.name, tool4.callId, tool4.itemId, normalizedArgs);
3271
+ const fcItem = buildFinalToolItem(tool4.kind, tool4.name, tool4.callId, tool4.itemId, normalizedArgs);
3260
3272
  emit("response.output_item.done", {
3261
3273
  type: "response.output_item.done",
3262
3274
  output_index: tool4.outputIndex,
@@ -3352,11 +3364,12 @@ async function generateResponsesResponse(model, params, modelId) {
3352
3364
  for (const tc of r.toolCalls) {
3353
3365
  const encodedId = encodeToolUseId(tc.toolCallId, grabRoundTripSignature(tc), false);
3354
3366
  const argsStr = JSON.stringify(tc.input ?? {});
3367
+ const kind = resolveOutputKind(tc.toolName, toolContext);
3355
3368
  output.push(buildFinalToolItem(
3356
- resolveOutputKind(tc.toolName, toolContext),
3369
+ kind,
3357
3370
  tc.toolName,
3358
3371
  encodedId,
3359
- functionCallItemId(tc.toolCallId),
3372
+ toolItemId(kind, tc.toolCallId),
3360
3373
  argsStr
3361
3374
  ));
3362
3375
  }
@@ -4059,6 +4072,11 @@ var EXTERNAL_TOOL_OUTPUT_TYPES = /* @__PURE__ */ new Set([
4059
4072
  "custom_tool_call_output",
4060
4073
  "tool_search_output"
4061
4074
  ]);
4075
+ var EXTERNAL_TOOL_CALL_TYPES = /* @__PURE__ */ new Set([
4076
+ "function_call",
4077
+ "custom_tool_call",
4078
+ "tool_search_call"
4079
+ ]);
4062
4080
  function responsesInputItems(input) {
4063
4081
  if (Array.isArray(input)) return input;
4064
4082
  if (typeof input === "string") {
@@ -4071,8 +4089,13 @@ function isExternalToolOutputItem(item) {
4071
4089
  const type = item.type;
4072
4090
  return typeof type === "string" && EXTERNAL_TOOL_OUTPUT_TYPES.has(type);
4073
4091
  }
4092
+ function isExternalToolCallItem(item) {
4093
+ if (!item || typeof item !== "object" || Array.isArray(item)) return false;
4094
+ const type = item.type;
4095
+ return typeof type === "string" && EXTERNAL_TOOL_CALL_TYPES.has(type);
4096
+ }
4074
4097
  function isExternalToolContinuation(input) {
4075
- return Array.isArray(input) && input.length > 0 && input.every(isExternalToolOutputItem);
4098
+ return Array.isArray(input) && input.length > 0 && input.some(isExternalToolOutputItem) && !input.some(isExternalToolCallItem);
4076
4099
  }
4077
4100
  function estimateCodexRequestChars(params) {
4078
4101
  let chars = (params.instructions ?? "").length;
@@ -6044,6 +6067,12 @@ function buildCodexProxyRoutesFromResolved(resolved, providersById) {
6044
6067
  oauthAccountId: route.oauthAccountId,
6045
6068
  providerData: route.providerData,
6046
6069
  contextWindow: route.contextWindow,
6070
+ // Reasoning metadata decides whether a picked effort can be translated
6071
+ // at all (e.g. OpenRouter's supportedParameters gate). Dropping these
6072
+ // silently turned every effort selection into a no-op on the wire.
6073
+ supportedParameters: route.supportedParameters,
6074
+ reasoning: route.reasoning,
6075
+ interleavedReasoningField: route.interleavedReasoningField,
6047
6076
  headers: route.headers
6048
6077
  };
6049
6078
  }).filter((r) => r !== void 0);
@@ -6327,7 +6356,10 @@ async function prepareCodexMixedRelayRoutes(models, trace = false) {
6327
6356
  authType: "oauth",
6328
6357
  oauthAccountId: original.oauthAccountId,
6329
6358
  providerData: original.providerData,
6330
- contextWindow: proxyRoute.contextWindow
6359
+ contextWindow: proxyRoute.contextWindow,
6360
+ supportedParameters: original.model.supportedParameters,
6361
+ reasoning: original.model.reasoning,
6362
+ interleavedReasoningField: original.model.interleavedReasoningField
6331
6363
  }),
6332
6364
  trace
6333
6365
  );
@@ -16156,7 +16188,7 @@ Options:
16156
16188
  --trace Write debug logs under ~/.relay-ai/logs/`);
16157
16189
  return 0;
16158
16190
  }
16159
- const { runUiCommand } = await import("./ui-command-U3L4LI2K.js");
16191
+ const { runUiCommand } = await import("./ui-command-QUT3R4HW.js");
16160
16192
  return runUiCommand({ trace: parsed.trace, serverMode: parsed.uiServerMode });
16161
16193
  }
16162
16194
  if (parsed.command === "models") {