pi-open-agents 0.1.22 → 0.1.23
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/README.md +2 -0
- package/package.json +1 -1
- package/src/subagent/tool.ts +15 -3
package/README.md
CHANGED
|
@@ -175,6 +175,8 @@ This means:
|
|
|
175
175
|
single call — `subagent({ agent: "deep-research", task: "...", model: "zai/glm-5.3-flash" })`.
|
|
176
176
|
Handy for "run this one task on the cheap model" without forking an agent
|
|
177
177
|
definition. Malformed values (`no-slash`) are rejected before any spawn.
|
|
178
|
+
Aggregator providers work too — the model id may contain slashes:
|
|
179
|
+
`model: "openrouter/anthropic/claude-opus-5.5"`.
|
|
178
180
|
|
|
179
181
|
The `--tools` whitelist is derived from both explicit `tools:` arrays and
|
|
180
182
|
permission allow-lists. An agent with `permission: { read: allow, edit: allow }`
|
package/package.json
CHANGED
package/src/subagent/tool.ts
CHANGED
|
@@ -66,6 +66,18 @@ function availableAgentsText(agents: AgentDefinition[]): string {
|
|
|
66
66
|
);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Validate a per-call model spec: "provider/model-id".
|
|
71
|
+
*
|
|
72
|
+
* The model id may itself contain slashes — aggregator providers use
|
|
73
|
+
* `vendor/model` ids (e.g. "openrouter/anthropic/claude-opus-5.5"), so the
|
|
74
|
+
* split is on the FIRST slash and only the separator is validated.
|
|
75
|
+
*/
|
|
76
|
+
function isValidModelSpec(spec: string): boolean {
|
|
77
|
+
const slash = spec.indexOf("/");
|
|
78
|
+
return slash > 0 && slash < spec.length - 1 && !/\s/.test(spec);
|
|
79
|
+
}
|
|
80
|
+
|
|
69
81
|
function toToolResult(result: AgentResult) {
|
|
70
82
|
return {
|
|
71
83
|
content: [{ type: "text" as const, text: result.output || "(no output)" }],
|
|
@@ -213,7 +225,7 @@ export function registerSubagentTool(
|
|
|
213
225
|
),
|
|
214
226
|
model: Type.Optional(
|
|
215
227
|
Type.String({
|
|
216
|
-
description: 'Per-call model override in "provider/model-id" format (e.g. "anthropic/claude-sonnet-4-5"). Takes precedence over the agent definition default.',
|
|
228
|
+
description: 'Per-call model override in "provider/model-id" format (e.g. "anthropic/claude-sonnet-4-5"). Model ids may contain slashes for aggregator providers ("openrouter/anthropic/claude-opus-5.5"). Takes precedence over the agent definition default.',
|
|
217
229
|
}),
|
|
218
230
|
),
|
|
219
231
|
}),
|
|
@@ -244,9 +256,9 @@ export function registerSubagentTool(
|
|
|
244
256
|
|
|
245
257
|
const childCwd = params.cwd ?? ctx.cwd;
|
|
246
258
|
|
|
247
|
-
if (params.model !== undefined &&
|
|
259
|
+
if (params.model !== undefined && !isValidModelSpec(params.model)) {
|
|
248
260
|
throw new Error(
|
|
249
|
-
`Invalid model "${params.model}": expected "provider/model-id" format (e.g. "anthropic/claude-sonnet-4-5").`,
|
|
261
|
+
`Invalid model "${params.model}": expected "provider/model-id" format (e.g. "anthropic/claude-sonnet-4-5" or "openrouter/anthropic/claude-opus-5.5").`,
|
|
250
262
|
);
|
|
251
263
|
}
|
|
252
264
|
|