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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/tools/index.js +10 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "picocode-core",
3
- "version": "0.9.236",
3
+ "version": "0.9.237",
4
4
  "description": "The agent runtime behind pico: sessions, tools, subagents, MCP, memory, and model access",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -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. One of: ${(agents.models?.() ?? []).join(', ')}`, 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; as provider/model, like ${agents.defaultModel?.() || 'codex/gpt-6.1-sol'}`, optional: true },
182
182
  },
183
183
  execute: ({ prompt, description, tools, model }) => {
184
- if (model && !(agents.models?.() ?? []).includes(model)) throw new Error(`no model ${model}; available: ${(agents.models?.() ?? []).join(', ')}`)
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
  },