@dougbots/pi-agents 0.2.0 → 0.2.1
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 +6 -0
- package/extensions/agents/index.ts +16 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -79,6 +79,12 @@ is accepted as a convenience alias. Both take precedence over a saved session
|
|
|
79
79
|
selection. Explicit `--model` still takes precedence over an agent-profile's
|
|
80
80
|
model.
|
|
81
81
|
|
|
82
|
+
While a session has a profile active, the extension reflects it into
|
|
83
|
+
`process.env.PI_AGENT_PROFILE` (cleared on `/agent-profile none`). Child
|
|
84
|
+
processes inherit it, so tooling like `agent-model.sh <role> pi` resolves the
|
|
85
|
+
same model the session runs, and fresh dispatches from the session stay on the
|
|
86
|
+
active profile.
|
|
87
|
+
|
|
82
88
|
## Commands
|
|
83
89
|
|
|
84
90
|
| Command | Description |
|
|
@@ -161,6 +161,20 @@ export default async function (pi: ExtensionAPI) {
|
|
|
161
161
|
);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
/**
|
|
165
|
+
* Surface the session's active agent-profile to child processes.
|
|
166
|
+
*
|
|
167
|
+
* agent-model.sh resolves a role's effective model by reading
|
|
168
|
+
* $PI_AGENT_PROFILE; absent a launch-time override, the interactive
|
|
169
|
+
* /agent-profile selection is otherwise invisible to anything pi spawns.
|
|
170
|
+
* Mirroring it into the env lets the resolver agree with the session and,
|
|
171
|
+
* since children inherit it, keeps fresh dispatches on the same profile.
|
|
172
|
+
*/
|
|
173
|
+
function syncProfileEnv(name: string | undefined) {
|
|
174
|
+
if (name) process.env.PI_AGENT_PROFILE = name;
|
|
175
|
+
else delete process.env.PI_AGENT_PROFILE;
|
|
176
|
+
}
|
|
177
|
+
|
|
164
178
|
/** Apply a named agent-profile, optionally saving the choice in this session. */
|
|
165
179
|
async function selectAgentProfile(
|
|
166
180
|
name: string | undefined,
|
|
@@ -175,6 +189,7 @@ export default async function (pi: ExtensionAPI) {
|
|
|
175
189
|
const previousName = activeAgentProfileName;
|
|
176
190
|
activeAgentProfileName = name;
|
|
177
191
|
setAgentProfileStatus(ctx);
|
|
192
|
+
syncProfileEnv(name);
|
|
178
193
|
|
|
179
194
|
// The active role must receive a new effective model/thinking level now;
|
|
180
195
|
// future roles resolve the overlay when /agent is invoked. Do not persist
|
|
@@ -182,6 +197,7 @@ export default async function (pi: ExtensionAPI) {
|
|
|
182
197
|
if (activeAgent && !(await applyAgent(activeAgent.name, ctx))) {
|
|
183
198
|
activeAgentProfileName = previousName;
|
|
184
199
|
setAgentProfileStatus(ctx);
|
|
200
|
+
syncProfileEnv(previousName);
|
|
185
201
|
return false;
|
|
186
202
|
}
|
|
187
203
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dougbots/pi-agents",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Agent profiles for pi — preconfigured model, system prompt, tool restrictions, and permission gates",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "node --experimental-strip-types --test tests/*.test.mts"
|