@picassohq/cli 1.0.6 → 1.0.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.
- package/LICENSE +14 -0
- package/README.md +100 -0
- package/dist/build-info.json +1 -1
- package/dist/index.js +1699 -1461
- package/package.json +27 -5
- package/runtime/engine-manifest.json +13 -3
- package/runtime/packages/picasso-compaction/index.js +116 -1
- package/runtime/packages/picasso-computer/cordis.patch.yml +5 -0
- package/runtime/packages/picasso-computer/index.js +670 -0
- package/runtime/packages/picasso-computer/native-anthropic.js +212 -0
- package/runtime/packages/picasso-computer/package.json +30 -0
- package/runtime/packages/picasso-computer/support.js +95 -0
- package/runtime/packages/picasso-lean-context/index.js +714 -8
- package/runtime/packages/picasso-lean-context/timeline.js +3 -2
- package/runtime/plugins/picasso-compaction/index.js +116 -1
- package/runtime/plugins/picasso-computer/index.js +670 -0
- package/runtime/plugins/picasso-computer/native-anthropic.js +212 -0
- package/runtime/plugins/picasso-computer/package.json +30 -0
- package/runtime/plugins/picasso-computer/support.js +95 -0
- package/runtime/plugins/picasso-lean-context/index.js +714 -8
- package/runtime/plugins/picasso-lean-context/timeline.js +3 -2
- package/runtime/relay/main.mjs +3052 -1564
- package/runtime/relay/remote/index.html +10 -2
- package/runtime/relay/remote/remote.css +8 -1
- package/runtime/relay/remote/remote.js +78 -17
- package/runtime/relay/versions-routes.mjs +14 -1
- package/scripts/install-runtime.mjs +33 -7
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
// Anthropic's computer toolset on Anthropic-native routes.
|
|
2
|
+
//
|
|
3
|
+
// On api.anthropic.com the toolset Claude models (support.js TOOLSET_FAMILIES) take computer use only as the
|
|
4
|
+
// `computer_toolset_20260801` entry: one `tools` item with no name and no display size; the model calls its members
|
|
5
|
+
// (`screenshot`, `left_click`, …) as `tool_use` blocks carrying `toolset_name: "computer"`, and every `tool_result`
|
|
6
|
+
// for them must echo `toolset_name: "computer"`. The engine's provider layer has no hook for a typed tool entry, so
|
|
7
|
+
// this bridge sits on the engine process's `fetch` and rewrites only POSTs to `<native host>/v1/messages` whose model
|
|
8
|
+
// is a toolset model:
|
|
9
|
+
// request — appends `{type: "computer_toolset_20260801"}` to `tools` (always, for that route/model, so the tool
|
|
10
|
+
// list never changes between turns or modes); turns history `tool_use` blocks named `computer_<member>`
|
|
11
|
+
// back into `<member>` + `toolset_name`, and adds `toolset_name` to their `tool_result`s; drops the
|
|
12
|
+
// fine-grained tool streaming beta, which the API refuses beside a toolset.
|
|
13
|
+
// response — renames a member `tool_use` (`left_click` + `toolset_name: "computer"`) to the registered tool
|
|
14
|
+
// (`computer_left_click`), in streamed `content_block_start` events and in plain JSON bodies.
|
|
15
|
+
// The member tools' input shapes are the computer_* tools' shapes, so nothing else is translated. Any other request
|
|
16
|
+
// (another host, another model, a GET) passes through untouched.
|
|
17
|
+
import { NATIVE_ANTHROPIC_HOSTS, isToolsetModel } from './support.js';
|
|
18
|
+
|
|
19
|
+
export const TOOLSET_TYPE = 'computer_toolset_20260801';
|
|
20
|
+
export const TOOLSET_NAME = 'computer';
|
|
21
|
+
export const TOOL_PREFIX = 'computer_';
|
|
22
|
+
export const FINE_GRAINED_BETA = 'fine-grained-tool-streaming-2025-05-14';
|
|
23
|
+
|
|
24
|
+
/** The toolset's 17 members, each served by the registered tool `computer_<member>`. */
|
|
25
|
+
export const TOOLSET_MEMBERS = Object.freeze([
|
|
26
|
+
'screenshot', 'zoom', 'left_click', 'right_click', 'middle_click', 'double_click', 'triple_click',
|
|
27
|
+
'left_click_drag', 'mouse_move', 'left_mouse_down', 'left_mouse_up', 'cursor_position', 'scroll', 'type', 'key',
|
|
28
|
+
'hold_key', 'wait',
|
|
29
|
+
]);
|
|
30
|
+
const MEMBER_SET = new Set(TOOLSET_MEMBERS);
|
|
31
|
+
|
|
32
|
+
const BRIDGED = Symbol.for('picasso.computer.anthropicBridge');
|
|
33
|
+
const isRecord = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
34
|
+
|
|
35
|
+
/** `computer_left_click` → `left_click`; undefined for any other name. */
|
|
36
|
+
export function memberOf(toolName) {
|
|
37
|
+
if (typeof toolName !== 'string' || !toolName.startsWith(TOOL_PREFIX)) return undefined;
|
|
38
|
+
const member = toolName.slice(TOOL_PREFIX.length);
|
|
39
|
+
return MEMBER_SET.has(member) ? member : undefined;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Whether one request URL is a native Anthropic Messages call. */
|
|
43
|
+
export function isNativeMessagesUrl(url, hosts = NATIVE_ANTHROPIC_HOSTS) {
|
|
44
|
+
try {
|
|
45
|
+
const parsed = url instanceof URL ? url : new URL(String(url));
|
|
46
|
+
return hosts.includes(parsed.hostname.toLowerCase()) && /\/v1\/messages\/?$/.test(parsed.pathname);
|
|
47
|
+
} catch {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The request body with the toolset in place, or undefined when this body is not a toolset model's. Pure: the input
|
|
54
|
+
* is not mutated.
|
|
55
|
+
*/
|
|
56
|
+
export function rewriteRequestBody(body) {
|
|
57
|
+
if (!isRecord(body) || !isToolsetModel(body.model)) return undefined;
|
|
58
|
+
const tools = Array.isArray(body.tools) ? body.tools.filter((tool) => !(isRecord(tool) && tool.type === TOOLSET_TYPE)) : [];
|
|
59
|
+
// A function tool named after a member (or `computer`) would clash with the toolset; none is ever wired, but a
|
|
60
|
+
// stray one is dropped rather than failing the request.
|
|
61
|
+
const kept = tools.filter((tool) => !(isRecord(tool) && tool.type === undefined && (tool.name === TOOLSET_NAME || memberOf(tool.name) !== undefined)));
|
|
62
|
+
const memberCalls = new Set();
|
|
63
|
+
const messages = Array.isArray(body.messages)
|
|
64
|
+
? body.messages.map((message) => {
|
|
65
|
+
if (!isRecord(message) || !Array.isArray(message.content)) return message;
|
|
66
|
+
let changed = false;
|
|
67
|
+
const content = message.content.map((block) => {
|
|
68
|
+
if (!isRecord(block)) return block;
|
|
69
|
+
if (block.type === 'tool_use') {
|
|
70
|
+
const member = memberOf(block.name);
|
|
71
|
+
if (member === undefined) return block;
|
|
72
|
+
if (typeof block.id === 'string') memberCalls.add(block.id);
|
|
73
|
+
changed = true;
|
|
74
|
+
return { ...block, name: member, toolset_name: TOOLSET_NAME };
|
|
75
|
+
}
|
|
76
|
+
return block;
|
|
77
|
+
});
|
|
78
|
+
return changed ? { ...message, content } : message;
|
|
79
|
+
})
|
|
80
|
+
: body.messages;
|
|
81
|
+
const withResults = Array.isArray(messages)
|
|
82
|
+
? messages.map((message) => {
|
|
83
|
+
if (!isRecord(message) || !Array.isArray(message.content) || memberCalls.size === 0) return message;
|
|
84
|
+
let changed = false;
|
|
85
|
+
const content = message.content.map((block) => {
|
|
86
|
+
if (isRecord(block) && block.type === 'tool_result' && memberCalls.has(block.tool_use_id) && block.toolset_name !== TOOLSET_NAME) {
|
|
87
|
+
changed = true;
|
|
88
|
+
return { ...block, toolset_name: TOOLSET_NAME };
|
|
89
|
+
}
|
|
90
|
+
return block;
|
|
91
|
+
});
|
|
92
|
+
return changed ? { ...message, content } : message;
|
|
93
|
+
})
|
|
94
|
+
: messages;
|
|
95
|
+
return { ...body, tools: [...kept, { type: TOOLSET_TYPE }], ...(withResults !== undefined ? { messages: withResults } : {}) };
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** One `anthropic-beta` header value without the fine-grained tool streaming beta ('' when nothing is left). */
|
|
99
|
+
export function stripFineGrainedBeta(value) {
|
|
100
|
+
return String(value ?? '')
|
|
101
|
+
.split(',')
|
|
102
|
+
.map((part) => part.trim())
|
|
103
|
+
.filter((part) => part && part !== FINE_GRAINED_BETA)
|
|
104
|
+
.join(',');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function rewriteHeaders(headers) {
|
|
108
|
+
const out = new Headers(headers ?? {});
|
|
109
|
+
const beta = out.get('anthropic-beta');
|
|
110
|
+
if (beta !== null) {
|
|
111
|
+
const next = stripFineGrainedBeta(beta);
|
|
112
|
+
if (next) out.set('anthropic-beta', next);
|
|
113
|
+
else out.delete('anthropic-beta');
|
|
114
|
+
}
|
|
115
|
+
out.delete('content-length');
|
|
116
|
+
return out;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** A member `tool_use` block renamed to its registered tool; anything else unchanged. */
|
|
120
|
+
export function renameMemberBlock(block) {
|
|
121
|
+
if (!isRecord(block) || block.type !== 'tool_use' || block.toolset_name !== TOOLSET_NAME || !MEMBER_SET.has(block.name)) return block;
|
|
122
|
+
const { toolset_name: _toolset, ...rest } = block;
|
|
123
|
+
return { ...rest, name: `${TOOL_PREFIX}${block.name}` };
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** One SSE `data:` payload with a member `content_block_start` renamed; other payloads come back byte for byte. */
|
|
127
|
+
export function rewriteSseData(data) {
|
|
128
|
+
if (!data.includes('"toolset_name"')) return data;
|
|
129
|
+
let event;
|
|
130
|
+
try { event = JSON.parse(data); } catch { return data; }
|
|
131
|
+
if (!isRecord(event) || event.type !== 'content_block_start' || !isRecord(event.content_block)) return data;
|
|
132
|
+
const renamed = renameMemberBlock(event.content_block);
|
|
133
|
+
return renamed === event.content_block ? data : JSON.stringify({ ...event, content_block: renamed });
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** A TransformStream over an SSE byte stream that renames member tool calls line by line. */
|
|
137
|
+
export function sseRenameStream() {
|
|
138
|
+
const decoder = new TextDecoder();
|
|
139
|
+
const encoder = new TextEncoder();
|
|
140
|
+
let pending = '';
|
|
141
|
+
const line = (text) => (text.startsWith('data: ') ? `data: ${rewriteSseData(text.slice(6))}` : text.startsWith('data:') ? `data:${rewriteSseData(text.slice(5))}` : text);
|
|
142
|
+
return new TransformStream({
|
|
143
|
+
transform(chunk, controller) {
|
|
144
|
+
pending += decoder.decode(chunk, { stream: true });
|
|
145
|
+
const cut = pending.lastIndexOf('\n');
|
|
146
|
+
if (cut < 0) return;
|
|
147
|
+
const complete = pending.slice(0, cut + 1);
|
|
148
|
+
pending = pending.slice(cut + 1);
|
|
149
|
+
controller.enqueue(encoder.encode(complete.split('\n').map(line).join('\n')));
|
|
150
|
+
},
|
|
151
|
+
flush(controller) {
|
|
152
|
+
pending += decoder.decode();
|
|
153
|
+
if (pending) controller.enqueue(encoder.encode(line(pending)));
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** A JSON Messages response with member tool calls renamed. */
|
|
159
|
+
export function rewriteJsonResponse(json) {
|
|
160
|
+
if (!isRecord(json) || !Array.isArray(json.content)) return json;
|
|
161
|
+
return { ...json, content: json.content.map(renameMemberBlock) };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async function translateResponse(response) {
|
|
165
|
+
if (!response || !response.ok || response.body === null) return response;
|
|
166
|
+
const type = response.headers.get('content-type') ?? '';
|
|
167
|
+
const headers = new Headers(response.headers);
|
|
168
|
+
headers.delete('content-length');
|
|
169
|
+
headers.delete('content-encoding');
|
|
170
|
+
if (type.includes('text/event-stream')) {
|
|
171
|
+
return new Response(response.body.pipeThrough(sseRenameStream()), { status: response.status, statusText: response.statusText, headers });
|
|
172
|
+
}
|
|
173
|
+
if (type.includes('application/json')) {
|
|
174
|
+
const json = await response.json();
|
|
175
|
+
return new Response(JSON.stringify(rewriteJsonResponse(json)), { status: response.status, statusText: response.statusText, headers });
|
|
176
|
+
}
|
|
177
|
+
return response;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function requestUrl(input) {
|
|
181
|
+
if (typeof input === 'string' || input instanceof URL) return String(input);
|
|
182
|
+
if (isRecord(input) && typeof input.url === 'string') return input.url;
|
|
183
|
+
return undefined;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Wrap `target.fetch` (the engine process's global) with the bridge. Idempotent; returns an uninstall function.
|
|
188
|
+
* `hosts` overrides the native host list (tests).
|
|
189
|
+
*/
|
|
190
|
+
export function installAnthropicComputerBridge({ target = globalThis, hosts = NATIVE_ANTHROPIC_HOSTS } = {}) {
|
|
191
|
+
const original = target.fetch;
|
|
192
|
+
if (typeof original !== 'function') return () => {};
|
|
193
|
+
if (original[BRIDGED]) return () => {};
|
|
194
|
+
const bridged = async function picassoComputerFetch(input, init) {
|
|
195
|
+
const url = requestUrl(input);
|
|
196
|
+
const method = String(init?.method ?? (isRecord(input) && typeof input.method === 'string' ? input.method : 'GET')).toUpperCase();
|
|
197
|
+
if (url === undefined || method !== 'POST' || typeof init?.body !== 'string' || !isNativeMessagesUrl(url, hosts)) {
|
|
198
|
+
return original.call(this, input, init);
|
|
199
|
+
}
|
|
200
|
+
let body;
|
|
201
|
+
try { body = JSON.parse(init.body); } catch { return original.call(this, input, init); }
|
|
202
|
+
const rewritten = rewriteRequestBody(body);
|
|
203
|
+
if (rewritten === undefined) return original.call(this, input, init);
|
|
204
|
+
const response = await original.call(this, input, { ...init, headers: rewriteHeaders(init.headers), body: JSON.stringify(rewritten) });
|
|
205
|
+
return translateResponse(response);
|
|
206
|
+
};
|
|
207
|
+
bridged[BRIDGED] = true;
|
|
208
|
+
target.fetch = bridged;
|
|
209
|
+
return () => {
|
|
210
|
+
if (target.fetch === bridged) target.fetch = original;
|
|
211
|
+
};
|
|
212
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@picasso/computer",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "dsh cordis plugin: computer_* model tools (screenshots, mouse, keyboard, app and window lists) executed by Picasso for Mac over the picassoComputer/* Host Remote service the helper relay long-polls; Anthropic's computer toolset on Anthropic-native routes.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./index.js",
|
|
10
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"dshTarget": "0.2.2-rc.3",
|
|
14
|
+
"dsh": {
|
|
15
|
+
"bundle": {
|
|
16
|
+
"patch": "./cordis.patch.yml"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"test": "node --import ../../test/setup/hermetic-preload.mjs --test test/*.test.mjs"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"index.js",
|
|
24
|
+
"support.js",
|
|
25
|
+
"native-anthropic.js",
|
|
26
|
+
"cordis.patch.yml",
|
|
27
|
+
"README.md"
|
|
28
|
+
],
|
|
29
|
+
"license": "UNLICENSED"
|
|
30
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// Which models can use the computer_* tools, and in which form.
|
|
2
|
+
//
|
|
3
|
+
// Computer use needs a model that reads screenshots and acts on pixel coordinates. The answer is fixed per
|
|
4
|
+
// route/model (never per mode or per turn), so a session's tool list and Tier-1 bytes stay the same for as long as
|
|
5
|
+
// it runs on one model:
|
|
6
|
+
// 'toolset' — Anthropic's own computer toolset (`computer_toolset_20260801`) on an Anthropic-native route
|
|
7
|
+
// (api.anthropic.com). The members are sent natively; native-anthropic.js renames them to and from
|
|
8
|
+
// the computer_* tools below.
|
|
9
|
+
// 'function' — plain function tools (computer_*, deferred, found through tool_search) on every other route of a
|
|
10
|
+
// capable model: Claude through Bedrock, Vertex, OpenRouter or Picasso's managed route, the computer-use
|
|
11
|
+
// capable GPT and Gemini families, and any model the catalog (config) flags.
|
|
12
|
+
// 'none' — hidden: the model can't see images or isn't known to act on screens (most managed and text models).
|
|
13
|
+
|
|
14
|
+
/** Claude models whose Anthropic-native route takes `computer_toolset_20260801` (and refuses the older tool types). */
|
|
15
|
+
const TOOLSET_FAMILIES = [
|
|
16
|
+
/^claude-fable-5-2(?:$|[-@])/,
|
|
17
|
+
/^claude-mythos-5-2(?:$|[-@])/,
|
|
18
|
+
/^claude-opus-5-5(?:$|[-@])/,
|
|
19
|
+
/^claude-sonnet-5-5(?:$|[-@])/,
|
|
20
|
+
/^claude-haiku-5-5(?:$|[-@])/,
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
/** Other vision models trained for screen actions: offered as plain function tools. */
|
|
24
|
+
const FUNCTION_FAMILIES = [
|
|
25
|
+
/^claude-(?:opus|sonnet|fable|mythos)-(?:4-[5-9]|5)(?:$|[-@.])/,
|
|
26
|
+
/^claude-haiku-4-5(?:$|[-@])/,
|
|
27
|
+
/^claude-(?:fable|mythos)-5-1(?:$|[-@])/,
|
|
28
|
+
/^computer-use-preview(?:$|-)/,
|
|
29
|
+
/^gpt-5(?:$|[.-])/,
|
|
30
|
+
/^gemini-(?:2\.5|3)(?:$|[.-])/,
|
|
31
|
+
/^qwen[0-9.]*-vl/,
|
|
32
|
+
/^ui-tars/,
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
/** Hosts whose `/v1/messages` is Anthropic's own API (the toolset is sent natively there). */
|
|
36
|
+
export const NATIVE_ANTHROPIC_HOSTS = Object.freeze(['api.anthropic.com']);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The bare model id: vendor prefixes dropped (`anthropic/claude-opus-5-5`, `us.anthropic.claude-opus-5-5`,
|
|
40
|
+
* the managed route's `anthropic:claude-opus-5-5`), lowercased, dots in Claude version numbers made dashes.
|
|
41
|
+
*/
|
|
42
|
+
export function bareModelId(model) {
|
|
43
|
+
let id = String(model ?? '').trim().toLowerCase();
|
|
44
|
+
const colon = id.lastIndexOf(':');
|
|
45
|
+
if (colon >= 0) id = id.slice(colon + 1);
|
|
46
|
+
const slash = id.lastIndexOf('/');
|
|
47
|
+
if (slash >= 0) id = id.slice(slash + 1);
|
|
48
|
+
id = id.replace(/^(?:[a-z]{2,4}\.)?anthropic\./, '');
|
|
49
|
+
if (id.startsWith('claude-')) id = id.replace(/(\d)\.(\d)/g, '$1-$2');
|
|
50
|
+
return id;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Whether a model id is one of the toolset Claude models (whatever route serves it). */
|
|
54
|
+
export function isToolsetModel(model) {
|
|
55
|
+
const id = bareModelId(model);
|
|
56
|
+
return TOOLSET_FAMILIES.some((re) => re.test(id));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function knownFamily(model, flagged) {
|
|
60
|
+
const id = bareModelId(model);
|
|
61
|
+
if (flagged.some((entry) => bareModelId(entry) === id)) return true;
|
|
62
|
+
return TOOLSET_FAMILIES.some((re) => re.test(id)) || FUNCTION_FAMILIES.some((re) => re.test(id));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Whether a route's base URL is Anthropic's own API. */
|
|
66
|
+
export function isNativeAnthropicUrl(baseUrl) {
|
|
67
|
+
if (typeof baseUrl !== 'string' || !baseUrl) return false;
|
|
68
|
+
try {
|
|
69
|
+
return NATIVE_ANTHROPIC_HOSTS.includes(new URL(baseUrl).hostname.toLowerCase());
|
|
70
|
+
} catch {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* `{mode, reason?}` for one route/model. `info` (all optional): `provider` (route id), `model`, `api`
|
|
77
|
+
* (`anthropic-messages`, …), `baseUrl`, `inputModalities` (absent = unknown; present without `image` = can't see),
|
|
78
|
+
* `flagged` (catalog-flagged model ids, config `computerUseModels`).
|
|
79
|
+
*/
|
|
80
|
+
export function computerUseSupport(info = {}) {
|
|
81
|
+
const model = typeof info.model === 'string' ? info.model : '';
|
|
82
|
+
if (!model) return { mode: 'none', reason: 'no-model' };
|
|
83
|
+
const flagged = Array.isArray(info.flagged) ? info.flagged.filter((m) => typeof m === 'string') : [];
|
|
84
|
+
if (Array.isArray(info.inputModalities) && !info.inputModalities.includes('image')) return { mode: 'none', reason: 'no-vision' };
|
|
85
|
+
if (!knownFamily(model, flagged)) return { mode: 'none', reason: 'not-trained' };
|
|
86
|
+
const nativeRoute = info.provider === 'anthropic' || (info.api === 'anthropic-messages' && isNativeAnthropicUrl(info.baseUrl));
|
|
87
|
+
if (nativeRoute && isToolsetModel(model)) return { mode: 'toolset' };
|
|
88
|
+
return { mode: 'function' };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** A short, person-facing model name for messages ("claude-opus-5-5" → "claude-opus-5-5"; managed ids stay readable). */
|
|
92
|
+
export function modelLabel(model) {
|
|
93
|
+
const id = String(model ?? '').trim();
|
|
94
|
+
return id || 'this model';
|
|
95
|
+
}
|