@johnnywu/pi-agent-profiles 0.2.0 → 0.3.0
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 +5 -5
- package/dist/agent-profile.d.ts +13 -0
- package/dist/agent-profile.js +32 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ Start the file with a `---` block containing one `key: value` entry per line. Th
|
|
|
45
45
|
### Model selection
|
|
46
46
|
|
|
47
47
|
- `models: anthropic/claude-sonnet-4-6, magpie/claude/*, deep-*` allows three kinds of entries. A provider-qualified entry matches the full selection. An unqualified entry such as `deep-*` also matches the model ID portion of a qualified selection.
|
|
48
|
-
- `subagent` and `
|
|
48
|
+
- `subagent` and `hc_subagent` accept an optional `model` argument. A selection outside a configured list fails before launch. Leave it out to use the first `models` entry. If that entry is a pattern, the launcher takes the first matching model in Pi's available catalog. A pattern with no available match produces an error even if later entries could match.
|
|
49
49
|
- `pi --agent` applies the first entry to the current session. If model selection or activation fails, it warns and keeps the current model.
|
|
50
50
|
- An omitted or empty `models` list allows any caller selection. With no explicit selection, Pi keeps its normal model selection. Rename old `model:` fields to `models:`. A profile that still contains `model:` is rejected with a migration message.
|
|
51
51
|
|
|
@@ -58,9 +58,9 @@ Start the file with a `---` block containing one `key: value` entry per line. Th
|
|
|
58
58
|
| `tools:` or omitted | Keep the entry point's existing tool selection. |
|
|
59
59
|
| `tools: read, -write` or `tools: +hc_*` | Reject the profile. Use names and patterns together, or modifiers exclusively. Modifiers require exact tool names. |
|
|
60
60
|
|
|
61
|
-
`pi-subagents` passes the list to the child Pi's `--tools`. `pi-herdr-agents`
|
|
61
|
+
`pi-subagents` passes the list to the child Pi's `--tools`. `pi-herdr-agents` passes the result of `herdrAgentTools()`: each exact `subagent` entry becomes the Herdr delegation tools `hc_subagent`, `hc_renew`, `hc_read`, `hc_stop`, and `hc_rm`, keeping any `+` or `-` prefix. A non-empty list also gets `hc_send` and `hc_agents` for reporting, as `+` entries in modifier mode. Pi applies its own tool availability and MCP exposure rules.
|
|
62
62
|
|
|
63
|
-
`pi --agent` resolves names and patterns against registered tools, warns about entries with no match, and applies the result to the current session's active tool list. A non-empty allowlist with zero matches clears the active selection.
|
|
63
|
+
`pi --agent` resolves names and patterns against registered tools. When `hc_subagent` is registered, it first applies `herdrAgentTools()` and keeps `subagent`, so a Herdr lead gets both delegation tools, warns about entries with no match, and applies the result to the current session's active tool list. A non-empty allowlist with zero matches clears the active selection.
|
|
64
64
|
|
|
65
65
|
### Skills
|
|
66
66
|
|
|
@@ -73,8 +73,8 @@ Use `skills: review-*, tdd` to select matching skills or `skills: *` to select a
|
|
|
73
73
|
| Entry point | `allowedAgents` | `maxDepth` |
|
|
74
74
|
| --- | --- | --- |
|
|
75
75
|
| `pi-subagents` | Filters the named agents offered by the child `subagent` tool when the launcher can pass a non-empty list of matching names. | The child `subagent` tool is disabled when the child depth exceeds the profile limit. |
|
|
76
|
-
| `pi-herdr-agents` | Intersects the profile list with any inherited list. When restricted, `
|
|
77
|
-
| `pi --agent` |
|
|
76
|
+
| `pi-herdr-agents` | Intersects the profile list with any inherited list. When restricted, `hc_subagent` requires an allowed agent name. | Inherits the stricter of the profile limit and the parent limit. Exceeding it disables `hc_subagent` in the child. |
|
|
77
|
+
| `pi --agent` | Emits `pi-subagents:configure`, which restricts `subagent` from `pi-subagents` and `hc_subagent` from `pi-herdr-agents` when they are loaded. | The field is parsed. `custom-agent` does not set a depth limit for the current session. |
|
|
78
78
|
|
|
79
79
|
The first delegated child starts at depth `1`. A child at depth `1` with `maxDepth: 0` cannot delegate further through its launcher. With `maxDepth: 1`, that child is still at the limit and may delegate if its tools and agent scope permit it. Each launch increments the depth. `pi-subagents` sets the new child's limit from the new profile, while Herdr also carries forward the inherited limit.
|
|
80
80
|
|
package/dist/agent-profile.d.ts
CHANGED
|
@@ -47,6 +47,19 @@ export declare function selectAgentTools(entries: readonly string[], available:
|
|
|
47
47
|
selected: string[];
|
|
48
48
|
missing: string[];
|
|
49
49
|
};
|
|
50
|
+
/** Tools a Herdr agent uses to delegate to and manage its children. */
|
|
51
|
+
export declare const herdrDelegationTools: readonly ["hc_subagent", "hc_renew", "hc_read", "hc_stop", "hc_rm"];
|
|
52
|
+
/** Tools every Herdr agent keeps for reporting and coordination. */
|
|
53
|
+
export declare const herdrReportingTools: readonly ["hc_send", "hc_agents"];
|
|
54
|
+
/**
|
|
55
|
+
* Translate a profile's tool list for a session that runs in Herdr Core. Each exact `subagent`
|
|
56
|
+
* entry selects the Herdr delegation tools with the same `+` or `-` prefix, and keeps the
|
|
57
|
+
* `subagent` entry itself when `keepSubagent` is set. A non-empty list also selects the reporting
|
|
58
|
+
* tools, as `+` entries in modifier mode. An empty list stays empty.
|
|
59
|
+
*/
|
|
60
|
+
export declare function herdrAgentTools(entries: readonly string[], options?: {
|
|
61
|
+
keepSubagent?: boolean;
|
|
62
|
+
}): string[];
|
|
50
63
|
export declare function loadAgentFromPath(selector: string, cwd?: string): Promise<AgentProfile>;
|
|
51
64
|
export declare function loadAgentDefinitions(options?: LoadAgentDefinitionsOptions): Promise<AgentDefinitions>;
|
|
52
65
|
export {};
|
package/dist/agent-profile.js
CHANGED
|
@@ -172,6 +172,38 @@ export function selectAgentTools(entries, available, active) {
|
|
|
172
172
|
}
|
|
173
173
|
return { selected: [...selected], missing: [...missing] };
|
|
174
174
|
}
|
|
175
|
+
/** Tools a Herdr agent uses to delegate to and manage its children. */
|
|
176
|
+
export const herdrDelegationTools = [
|
|
177
|
+
'hc_subagent',
|
|
178
|
+
'hc_renew',
|
|
179
|
+
'hc_read',
|
|
180
|
+
'hc_stop',
|
|
181
|
+
'hc_rm',
|
|
182
|
+
];
|
|
183
|
+
/** Tools every Herdr agent keeps for reporting and coordination. */
|
|
184
|
+
export const herdrReportingTools = ['hc_send', 'hc_agents'];
|
|
185
|
+
/**
|
|
186
|
+
* Translate a profile's tool list for a session that runs in Herdr Core. Each exact `subagent`
|
|
187
|
+
* entry selects the Herdr delegation tools with the same `+` or `-` prefix, and keeps the
|
|
188
|
+
* `subagent` entry itself when `keepSubagent` is set. A non-empty list also selects the reporting
|
|
189
|
+
* tools, as `+` entries in modifier mode. An empty list stays empty.
|
|
190
|
+
*/
|
|
191
|
+
export function herdrAgentTools(entries, options = {}) {
|
|
192
|
+
validateToolList(entries);
|
|
193
|
+
if (!entries.length)
|
|
194
|
+
return [];
|
|
195
|
+
const tools = entries.flatMap((entry) => {
|
|
196
|
+
const prefix = /^([+-]?)subagent$/.exec(entry)?.[1];
|
|
197
|
+
if (prefix === undefined)
|
|
198
|
+
return [entry];
|
|
199
|
+
const delegation = herdrDelegationTools.map((tool) => `${prefix}${tool}`);
|
|
200
|
+
return options.keepSubagent ? [entry, ...delegation] : delegation;
|
|
201
|
+
});
|
|
202
|
+
const modifiers = isToolModifier(entries[0]);
|
|
203
|
+
for (const tool of herdrReportingTools)
|
|
204
|
+
tools.push(modifiers ? `+${tool}` : tool);
|
|
205
|
+
return tools;
|
|
206
|
+
}
|
|
175
207
|
export async function loadAgentFromPath(selector, cwd = process.cwd()) {
|
|
176
208
|
const input = selector.trim();
|
|
177
209
|
const filePath = resolve(cwd, /^~[/\\]/.test(input) ? join(homedir(), input.slice(2)) : input);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { loadAgentDefinitions, loadAgentFromPath, parseAgentProfile, selectAgentModel, selectAgentTools, type AgentDefinitions, type AgentDefinitionWarning, type AgentProfile, type AgentSource, type LoadAgentDefinitionsOptions, type SystemPromptMode, type ThinkingLevel, } from './agent-profile.js';
|
|
1
|
+
export { herdrAgentTools, herdrDelegationTools, herdrReportingTools, loadAgentDefinitions, loadAgentFromPath, parseAgentProfile, selectAgentModel, selectAgentTools, type AgentDefinitions, type AgentDefinitionWarning, type AgentProfile, type AgentSource, type LoadAgentDefinitionsOptions, type SystemPromptMode, type ThinkingLevel, } from './agent-profile.js';
|
|
2
2
|
export { applyAgentProfile, formatRuntimeTools, selectAgentSkills, type AgentPromptResult, type SkillSelection, } from './agent-prompt.js';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { loadAgentDefinitions, loadAgentFromPath, parseAgentProfile, selectAgentModel, selectAgentTools, } from './agent-profile.js';
|
|
1
|
+
export { herdrAgentTools, herdrDelegationTools, herdrReportingTools, loadAgentDefinitions, loadAgentFromPath, parseAgentProfile, selectAgentModel, selectAgentTools, } from './agent-profile.js';
|
|
2
2
|
export { applyAgentProfile, formatRuntimeTools, selectAgentSkills, } from './agent-prompt.js';
|