@opeoginni/opencode-copilot-auto 0.1.5 → 0.1.6

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -93,10 +93,19 @@ function toResponsesRequest(payload, model) {
93
93
  ...typeof payload.temperature === "number" ? { temperature: payload.temperature } : {},
94
94
  ...typeof payload.top_p === "number" ? { top_p: payload.top_p } : {},
95
95
  ...typeof payload.max_tokens === "number" ? { max_output_tokens: payload.max_tokens } : typeof payload.max_completion_tokens === "number" ? { max_output_tokens: payload.max_completion_tokens } : {},
96
- ...Array.isArray(payload.tools) ? { tools: payload.tools } : {},
97
- ...payload.tool_choice !== undefined ? { tool_choice: payload.tool_choice } : {}
96
+ ...Array.isArray(payload.tools) ? { tools: flattenTools(payload.tools) } : {},
97
+ ...payload.tool_choice !== undefined ? { tool_choice: unwrapFunction(payload.tool_choice) } : {}
98
98
  };
99
99
  }
100
+ function flattenTools(tools) {
101
+ return tools.map(unwrapFunction);
102
+ }
103
+ function unwrapFunction(value) {
104
+ if (!isRecord(value) || !isRecord(value.function))
105
+ return value;
106
+ const { function: fn, ...rest } = value;
107
+ return { ...fn, ...rest };
108
+ }
100
109
  async function getSession(fetcher, requestHeaders) {
101
110
  const key = requestHeaders.get("authorization") ?? "anonymous";
102
111
  const cached = sessions.get(key);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opeoginni/opencode-copilot-auto",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Add GitHub Copilot Auto model routing to OpenCode",
5
5
  "keywords": [
6
6
  "opencode",