agent-shim 11.86.1 → 11.86.2

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/cli.cjs CHANGED
@@ -41958,7 +41958,7 @@ var init_package = __esm({
41958
41958
  "package.json"() {
41959
41959
  package_default = {
41960
41960
  name: "agent-shim",
41961
- version: "11.86.1",
41961
+ version: "11.86.2",
41962
41962
  description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
41963
41963
  license: "MIT",
41964
41964
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -71704,7 +71704,9 @@ var init_anthropic = __esm({
71704
71704
  ToolSchema = external_exports.looseObject({
71705
71705
  name: external_exports.string().min(1),
71706
71706
  description: external_exports.string().optional(),
71707
- input_schema: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
71707
+ input_schema: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
71708
+ allowed_domains: external_exports.array(external_exports.string()).optional(),
71709
+ blocked_domains: external_exports.array(external_exports.string()).optional()
71708
71710
  });
71709
71711
  ToolChoiceSchema = external_exports.union([
71710
71712
  external_exports.looseObject({ type: external_exports.enum(["auto", "none", "any"]) }),
@@ -72164,13 +72166,13 @@ function mapTools2(tools, names) {
72164
72166
  if (tools === void 0 || tools.length === 0) {
72165
72167
  return void 0;
72166
72168
  }
72167
- return tools.map((tool) => ({
72169
+ return tools.map((tool) => tool.type === "web_search_20250305" ? { type: "web_search", ...tool.allowed_domains === void 0 && tool.blocked_domains === void 0 ? {} : { filters: { ...tool.allowed_domains === void 0 ? {} : { allowed_domains: tool.allowed_domains }, ...tool.blocked_domains === void 0 ? {} : { blocked_domains: tool.blocked_domains } } } } : {
72168
72170
  type: "function",
72169
72171
  name: shortToolName2(tool.name, names),
72170
72172
  description: tool.description ?? "",
72171
72173
  parameters: tool.input_schema ?? EMPTY_PARAMETERS,
72172
72174
  strict: false
72173
- }));
72175
+ });
72174
72176
  }
72175
72177
  function mapToolChoice(choice, names) {
72176
72178
  if (choice === void 0) {
@@ -72192,7 +72194,8 @@ function translateRequest2(body, config2) {
72192
72194
  const names = /* @__PURE__ */ new Map();
72193
72195
  const effort = mapEffort2(body, config2);
72194
72196
  const tools = mapTools2(body.tools, names);
72195
- const toolChoice = mapToolChoice(body.tool_choice, names);
72197
+ const webSearch = body.tools?.some((tool) => tool.type === "web_search_20250305") === true;
72198
+ const toolChoice = webSearch && body.tool_choice?.type === "tool" && body.tool_choice.name === "web_search" ? { type: "allowed_tools", mode: "required", tools: [{ type: "web_search" }] } : mapToolChoice(body.tool_choice, names);
72196
72199
  const userId = body.metadata?.user_id;
72197
72200
  const request7 = {
72198
72201
  model: mapModel(body.model ?? "", config2),
@@ -72204,7 +72207,8 @@ function translateRequest2(body, config2) {
72204
72207
  ...effort === "none" ? {} : { reasoning: { effort, summary: "auto" } },
72205
72208
  ...userId === void 0 ? {} : { prompt_cache_key: userId },
72206
72209
  ...tools === void 0 ? {} : { tools },
72207
- ...toolChoice === void 0 ? {} : { tool_choice: toolChoice }
72210
+ ...toolChoice === void 0 ? {} : { tool_choice: toolChoice },
72211
+ ...webSearch ? { include: ["web_search_call.action.sources"] } : {}
72208
72212
  };
72209
72213
  return { request: request7, toolNames: names };
72210
72214
  }
@@ -142531,7 +142535,13 @@ var FunctionArgumentsDeltaSchema = external_exports.looseObject({
142531
142535
  });
142532
142536
  var OutputItemDoneSchema = external_exports.looseObject({
142533
142537
  type: external_exports.literal("response.output_item.done"),
142534
- output_index: external_exports.number()
142538
+ output_index: external_exports.number(),
142539
+ item: external_exports.looseObject({
142540
+ type: external_exports.string(),
142541
+ id: external_exports.string().optional(),
142542
+ action: external_exports.looseObject({ sources: external_exports.array(external_exports.looseObject({ url: external_exports.string().optional() })).optional() }).optional(),
142543
+ content: external_exports.array(external_exports.looseObject({ annotations: external_exports.array(external_exports.looseObject({ url: external_exports.string().optional(), title: external_exports.string().optional() })).optional() })).optional()
142544
+ }).optional()
142535
142545
  });
142536
142546
  var ResponseCompletedSchema = external_exports.looseObject({
142537
142547
  type: external_exports.literal("response.completed"),
@@ -142736,6 +142746,8 @@ var STREAM_ERROR = "codex backend stream error";
142736
142746
  function createRelay(params) {
142737
142747
  const blockByOutput = /* @__PURE__ */ new Map();
142738
142748
  const blocks = [];
142749
+ const searches = [];
142750
+ const titles = /* @__PURE__ */ new Map();
142739
142751
  let messageId;
142740
142752
  let sawToolUse = false;
142741
142753
  const block2 = (outputIndex) => {
@@ -142808,6 +142820,14 @@ function createRelay(params) {
142808
142820
  };
142809
142821
  }
142810
142822
  case "response.output_item.done": {
142823
+ if (event.item?.type === "web_search_call" && event.item.id !== void 0) {
142824
+ searches.push({ id: event.item.id, urls: (event.item.action?.sources ?? []).flatMap((source) => source.url === void 0 ? [] : [source.url]) });
142825
+ }
142826
+ for (const part of event.item?.content ?? []) {
142827
+ for (const annotation of part.annotations ?? []) {
142828
+ if (annotation.url !== void 0 && annotation.title !== void 0) titles.set(annotation.url, annotation.title);
142829
+ }
142830
+ }
142811
142831
  const target = block2(event.output_index);
142812
142832
  return target === void 0 ? { frames: [] } : { frames: [{ event: "content_block_stop", data: { type: "content_block_stop", index: target.index } }] };
142813
142833
  }
@@ -142815,9 +142835,14 @@ function createRelay(params) {
142815
142835
  const usage = event.response?.usage ?? void 0;
142816
142836
  const stopReason = sawToolUse ? "tool_use" : event.response?.status === "incomplete" ? "max_tokens" : "end_turn";
142817
142837
  const converted = anthropicUsage(usage);
142818
- const content = blocks.map(finalBlock);
142838
+ const content = [...blocks.map(finalBlock), ...searches.map((search) => ({ type: "web_search_tool_result", tool_use_id: search.id, content: search.urls.map((url2) => ({ type: "web_search_result", url: url2, title: titles.get(url2) ?? url2 })) }))];
142819
142839
  return {
142820
142840
  frames: [
142841
+ ...searches.flatMap((search, offset) => {
142842
+ const index = blocks.length + offset;
142843
+ const contentBlock = content[index];
142844
+ return [{ event: "content_block_start", data: { type: "content_block_start", index, content_block: contentBlock } }, { event: "content_block_stop", data: { type: "content_block_stop", index } }];
142845
+ }),
142821
142846
  { event: "message_delta", data: { type: "message_delta", delta: { stop_reason: stopReason, stop_sequence: null }, usage: converted } },
142822
142847
  { event: "message_stop", data: { type: "message_stop" } }
142823
142848
  ],
package/dist/index.cjs CHANGED
@@ -5171,7 +5171,7 @@ var init_package = __esm({
5171
5171
  "package.json"() {
5172
5172
  package_default = {
5173
5173
  name: "agent-shim",
5174
- version: "11.86.1",
5174
+ version: "11.86.2",
5175
5175
  description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
5176
5176
  license: "MIT",
5177
5177
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -11998,7 +11998,9 @@ var init_anthropic = __esm({
11998
11998
  ToolSchema = import_zod33.z.looseObject({
11999
11999
  name: import_zod33.z.string().min(1),
12000
12000
  description: import_zod33.z.string().optional(),
12001
- input_schema: import_zod33.z.record(import_zod33.z.string(), import_zod33.z.unknown()).optional()
12001
+ input_schema: import_zod33.z.record(import_zod33.z.string(), import_zod33.z.unknown()).optional(),
12002
+ allowed_domains: import_zod33.z.array(import_zod33.z.string()).optional(),
12003
+ blocked_domains: import_zod33.z.array(import_zod33.z.string()).optional()
12002
12004
  });
12003
12005
  ToolChoiceSchema = import_zod33.z.union([
12004
12006
  import_zod33.z.looseObject({ type: import_zod33.z.enum(["auto", "none", "any"]) }),
package/dist/index.mjs CHANGED
@@ -5146,7 +5146,7 @@ var init_package = __esm({
5146
5146
  "package.json"() {
5147
5147
  package_default = {
5148
5148
  name: "agent-shim",
5149
- version: "11.86.1",
5149
+ version: "11.86.2",
5150
5150
  description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
5151
5151
  license: "MIT",
5152
5152
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -11969,7 +11969,9 @@ var init_anthropic = __esm({
11969
11969
  ToolSchema = z33.looseObject({
11970
11970
  name: z33.string().min(1),
11971
11971
  description: z33.string().optional(),
11972
- input_schema: z33.record(z33.string(), z33.unknown()).optional()
11972
+ input_schema: z33.record(z33.string(), z33.unknown()).optional(),
11973
+ allowed_domains: z33.array(z33.string()).optional(),
11974
+ blocked_domains: z33.array(z33.string()).optional()
11973
11975
  });
11974
11976
  ToolChoiceSchema = z33.union([
11975
11977
  z33.looseObject({ type: z33.enum(["auto", "none", "any"]) }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-shim",
3
- "version": "11.86.1",
3
+ "version": "11.86.2",
4
4
  "description": "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
5
5
  "license": "MIT",
6
6
  "author": "Joseph Mearman <joseph@mearman.co.uk>",