picocode-core 0.9.236 → 0.9.237
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/package.json +1 -1
- package/src/tools/index.js +10 -2
package/package.json
CHANGED
package/src/tools/index.js
CHANGED
|
@@ -178,10 +178,18 @@ export function createToolset({ toolResult, cwd, env, tracker, skills, shells, s
|
|
|
178
178
|
prompt: { type: 'string', description: 'complete, self-contained task and desired output, including necessary context from the parent conversation' },
|
|
179
179
|
description: describeParam,
|
|
180
180
|
tools: { type: 'array', items: { type: 'string' }, description: 'tool names to allow; omit for the configured worker tools', optional: true },
|
|
181
|
-
model: { type: 'string', description: `leave out to run on the default worker model${agents.defaultModel?.() ? ` (${agents.defaultModel()})` : ''}. Name a model only when the user asked for that model, or the task truly cannot be done well on the default one
|
|
181
|
+
model: { type: 'string', description: `leave out to run on the default worker model${agents.defaultModel?.() ? ` (${agents.defaultModel()})` : ''}. Name a model only when the user asked for that model, or the task truly cannot be done well on the default one; as provider/model, like ${agents.defaultModel?.() || 'codex/gpt-6.1-sol'}`, optional: true },
|
|
182
182
|
},
|
|
183
183
|
execute: ({ prompt, description, tools, model }) => {
|
|
184
|
-
|
|
184
|
+
// a name not known is answered with the known ones it most resembles: its provider's, else ones sharing a word
|
|
185
|
+
if (model && !(agents.models?.() ?? []).includes(model)) {
|
|
186
|
+
const known = agents.models?.() ?? []
|
|
187
|
+
const provider = model.split('/')[0]
|
|
188
|
+
const words = model.toLowerCase().split(/[^a-z0-9.]+/).filter((w) => w.length > 1)
|
|
189
|
+
const near = known.filter((m) => m.startsWith(`${provider}/`))
|
|
190
|
+
const alike = near.length ? near : known.filter((m) => words.some((w) => m.toLowerCase().includes(w)))
|
|
191
|
+
throw new Error(`no model ${model}${alike.length ? `; models like it: ${alike.slice(0, 20).join(', ')}` : ''}`)
|
|
192
|
+
}
|
|
185
193
|
const agent = agents.start({ prompt, description, tools, sessionId, sessionFile, ...(model && { model }) })
|
|
186
194
|
return { agentId: agent.id, status: agent.status, model: agent.model }
|
|
187
195
|
},
|