betahi-copilot-bridge 0.20.5 → 0.20.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.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <h1 align="center">copilot-bridge</h1>
2
2
 
3
3
  <p align="center">
4
- <a href="https://www.npmjs.com/package/betahi-copilot-bridge"><img src="https://img.shields.io/npm/v/betahi-copilot-bridge.svg?v=0.20.5" alt="npm version"></a>
4
+ <a href="https://www.npmjs.com/package/betahi-copilot-bridge"><img src="https://img.shields.io/npm/v/betahi-copilot-bridge.svg?v=0.20.6" alt="npm version"></a>
5
5
  <a href="https://github.com/betahi/copilot-bridge/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/betahi-copilot-bridge.svg" alt="license"></a>
6
6
  </p>
7
7
 
package/dist/main.js CHANGED
@@ -3217,7 +3217,7 @@ const getRequestedQuery = (request) => {
3217
3217
  const cleaned = textFromContent([...inputItemsFromRequest(request)].reverse().find((item) => item.role === "user")?.content).replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g, " ").replace(/\s+/g, " ").trim();
3218
3218
  return cleaned.match(/\bsearch(?:\s+the\s+web)?(?:\s+for)?\s+(.+)$/i)?.[1]?.trim() || cleaned || "web search";
3219
3219
  };
3220
- const buildSearchInput = (request) => {
3220
+ const buildSearchInput = (request, requestedQuery) => {
3221
3221
  const conversation = inputItemsFromRequest(request).flatMap((item) => {
3222
3222
  const role = typeof item.role === "string" ? item.role : item.type;
3223
3223
  const text = textFromContent(item.content ?? item.output);
@@ -3229,19 +3229,23 @@ const buildSearchInput = (request) => {
3229
3229
  "Return useful search results as plain text lines in this exact shape:",
3230
3230
  "1. Title - https://example.com/page",
3231
3231
  "Include only real source URLs from the search results.",
3232
+ `Search query:\n${requestedQuery}`,
3232
3233
  request.instructions ? `Instructions:\n${request.instructions}` : "",
3233
3234
  conversation ? `Conversation:\n${conversation}` : ""
3234
3235
  ].filter(Boolean).join("\n\n");
3235
3236
  };
3236
- const createExecutionRequest = (request, requestedQuery) => ({
3237
- clientName: "Codex",
3238
- configurationHint: "Set COPILOT_WEB_SEARCH_BACKEND in ~/.codex/config.toml to a Copilot Responses search model id such as gpt-5.5, searxng, or copilot-cli.",
3239
- maxOutputTokens: request.max_output_tokens,
3240
- requestedQuery: requestedQuery?.trim() || getRequestedQuery(request),
3241
- searchInput: buildSearchInput(request),
3242
- temperature: request.temperature,
3243
- topP: request.top_p
3244
- });
3237
+ const createExecutionRequest = (request, requestedQuery) => {
3238
+ const query = requestedQuery?.trim() || getRequestedQuery(request);
3239
+ return {
3240
+ clientName: "Codex",
3241
+ configurationHint: "Set COPILOT_WEB_SEARCH_BACKEND in ~/.codex/config.toml to a Copilot Responses search model id such as gpt-5.5, searxng, or copilot-cli.",
3242
+ maxOutputTokens: request.max_output_tokens,
3243
+ requestedQuery: query,
3244
+ searchInput: buildSearchInput(request, query),
3245
+ temperature: request.temperature,
3246
+ topP: request.top_p
3247
+ };
3248
+ };
3245
3249
  const isCodexNativeWebSearchTool = (tool) => {
3246
3250
  if (!isRecord(tool)) return false;
3247
3251
  return tool.type === "web_search" || tool.type === "web_search_preview";