pi-open-agents 0.1.21 → 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 +9 -1
- package/package.json +1 -1
- package/src/config/paths.ts +2 -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 }`
|
|
@@ -271,7 +273,13 @@ Agents are loaded from multiple locations (project overrides global by name):
|
|
|
271
273
|
| `~/.opencode/{agent,agents,mode}/*.md` | Global | OpenCode |
|
|
272
274
|
| `.pi/agents/*.md` | Project | pi |
|
|
273
275
|
| `.opencode/{agent,agents,mode}/*.md` | Project | OpenCode |
|
|
274
|
-
| `.agents/*.md` | Project | Shared |
|
|
276
|
+
| `.agents/agents/*.md` | Project | Shared |
|
|
277
|
+
|
|
278
|
+
> **⚠️ Migration note (v0.1.22):** discovery in the shared `.agents/` directory is now
|
|
279
|
+
> scoped to `.agents/agents/*.md` — previously *every* markdown file under `.agents/`
|
|
280
|
+
> (including `skills/` and `commands/`) was parsed as an agent and showed up in `/agents`
|
|
281
|
+
> and the `subagent` tool. If you relied on the loose loading, move your agent files into
|
|
282
|
+
> `.agents/agents/`. Skills and commands are picked up natively by pi as before. (#14)
|
|
275
283
|
|
|
276
284
|
---
|
|
277
285
|
|
package/package.json
CHANGED
package/src/config/paths.ts
CHANGED
|
@@ -88,7 +88,7 @@ export function getDiscoveryPaths(cwd: string, agentDir: string): DiscoveryPath[
|
|
|
88
88
|
dir: path.join(cwd, ".agents"),
|
|
89
89
|
source: "project",
|
|
90
90
|
family: "shared",
|
|
91
|
-
subdirs: [""],
|
|
91
|
+
subdirs: ["agents"],
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
return paths;
|
|
@@ -99,6 +99,7 @@ export function getDiscoveryPaths(cwd: string, agentDir: string): DiscoveryPath[
|
|
|
99
99
|
*
|
|
100
100
|
* For pi/shared: uses the filename without extension
|
|
101
101
|
* .pi/agents/my-agent.md → "my-agent"
|
|
102
|
+
* .agents/agents/my-agent.md → "my-agent"
|
|
102
103
|
*
|
|
103
104
|
* For OpenCode: strips the subdir prefix
|
|
104
105
|
* .opencode/agent/triage.md → "triage"
|
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
|
|