agent-shim 11.86.0 → 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 +35 -10
- package/dist/index.cjs +5 -3
- package/dist/index.mjs +5 -3
- package/package.json +1 -1
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.
|
|
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"]) }),
|
|
@@ -71721,7 +71723,7 @@ var init_anthropic = __esm({
|
|
|
71721
71723
|
/** `user_id` is stable for one Claude Code session and differs between sessions, which is what makes it the right key for both the backend's prompt cache and its session header. */
|
|
71722
71724
|
metadata: external_exports.looseObject({ user_id: external_exports.string().optional() }).optional(),
|
|
71723
71725
|
/** Claude Code's effort setting. Any string is accepted; the translator honours only the levels the backend understands. */
|
|
71724
|
-
output_config: external_exports.looseObject({ effort: external_exports.string().optional() }).optional()
|
|
71726
|
+
output_config: external_exports.looseObject({ effort: external_exports.string().optional(), format: external_exports.object({ type: external_exports.literal("json_schema"), schema: external_exports.record(external_exports.string(), external_exports.unknown()) }).optional() }).optional()
|
|
71725
71727
|
});
|
|
71726
71728
|
CountTokensRequestSchema = external_exports.looseObject({
|
|
71727
71729
|
system: external_exports.unknown().optional(),
|
|
@@ -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
|
|
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),
|
|
@@ -72200,11 +72203,12 @@ function translateRequest2(body, config2) {
|
|
|
72200
72203
|
input: messagesToInput(body.messages, names),
|
|
72201
72204
|
stream: true,
|
|
72202
72205
|
store: false,
|
|
72203
|
-
text: { verbosity: "medium" },
|
|
72206
|
+
text: { verbosity: "medium", ...body.output_config?.format === void 0 ? {} : { format: { type: "json_schema", name: "response", schema: body.output_config.format.schema, strict: false } } },
|
|
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.
|
|
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"]) }),
|
|
@@ -12015,7 +12017,7 @@ var init_anthropic = __esm({
|
|
|
12015
12017
|
/** `user_id` is stable for one Claude Code session and differs between sessions, which is what makes it the right key for both the backend's prompt cache and its session header. */
|
|
12016
12018
|
metadata: import_zod33.z.looseObject({ user_id: import_zod33.z.string().optional() }).optional(),
|
|
12017
12019
|
/** Claude Code's effort setting. Any string is accepted; the translator honours only the levels the backend understands. */
|
|
12018
|
-
output_config: import_zod33.z.looseObject({ effort: import_zod33.z.string().optional() }).optional()
|
|
12020
|
+
output_config: import_zod33.z.looseObject({ effort: import_zod33.z.string().optional(), format: import_zod33.z.object({ type: import_zod33.z.literal("json_schema"), schema: import_zod33.z.record(import_zod33.z.string(), import_zod33.z.unknown()) }).optional() }).optional()
|
|
12019
12021
|
});
|
|
12020
12022
|
CountTokensRequestSchema = import_zod33.z.looseObject({
|
|
12021
12023
|
system: import_zod33.z.unknown().optional(),
|
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.
|
|
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"]) }),
|
|
@@ -11986,7 +11988,7 @@ var init_anthropic = __esm({
|
|
|
11986
11988
|
/** `user_id` is stable for one Claude Code session and differs between sessions, which is what makes it the right key for both the backend's prompt cache and its session header. */
|
|
11987
11989
|
metadata: z33.looseObject({ user_id: z33.string().optional() }).optional(),
|
|
11988
11990
|
/** Claude Code's effort setting. Any string is accepted; the translator honours only the levels the backend understands. */
|
|
11989
|
-
output_config: z33.looseObject({ effort: z33.string().optional() }).optional()
|
|
11991
|
+
output_config: z33.looseObject({ effort: z33.string().optional(), format: z33.object({ type: z33.literal("json_schema"), schema: z33.record(z33.string(), z33.unknown()) }).optional() }).optional()
|
|
11990
11992
|
});
|
|
11991
11993
|
CountTokensRequestSchema = z33.looseObject({
|
|
11992
11994
|
system: z33.unknown().optional(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-shim",
|
|
3
|
-
"version": "11.86.
|
|
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>",
|