@dougbots/avenor-pi 0.5.2 → 0.7.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 -0
- package/dist/index.js +32 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -151,6 +151,11 @@ When `agent` is set, avenor passes `PI_AGENT=<name>` to the pi subprocess. The `
|
|
|
151
151
|
|
|
152
152
|
If you don't need a named profile, `model` alone is sufficient — no agent config or extension setup required.
|
|
153
153
|
|
|
154
|
+
When `pi-agents` has selected a session-scoped `/agent-profile`, this extension
|
|
155
|
+
also forwards that optional session metadata to Pi automatically. Avenor does
|
|
156
|
+
not depend on `pi-agents`; absent or malformed metadata is ignored. The setting
|
|
157
|
+
is not an `avenor_spawn` parameter and applies only to Pi-backed child runs.
|
|
158
|
+
|
|
154
159
|
## Typical workflows
|
|
155
160
|
|
|
156
161
|
**Blocking (default):**
|
package/dist/index.js
CHANGED
|
@@ -155,7 +155,7 @@ function helpText(state) {
|
|
|
155
155
|
"home/end jump",
|
|
156
156
|
"esc close"
|
|
157
157
|
];
|
|
158
|
-
if (state.status && isPromptable(state.status, state.snapshot)) actions.unshift("enter send
|
|
158
|
+
if (state.status && isPromptable(state.status, state.snapshot)) actions.unshift("enter interrupt and send", "ctrl-c cancel run");
|
|
159
159
|
else if (isFollowUpable(state.status, state.snapshot)) actions.unshift("enter follow up");
|
|
160
160
|
return actions.join(" · ");
|
|
161
161
|
}
|
|
@@ -319,12 +319,12 @@ var RunInspectorOverlay = class {
|
|
|
319
319
|
const runtimeId = this.state.run.runtimeId ?? this.state.status?.runtime_id ?? this.state.snapshot.identity.runtime_id;
|
|
320
320
|
if (this.state.status && isPromptable(this.state.status, this.state.snapshot) && runtimeId) {
|
|
321
321
|
this.runAction(async () => {
|
|
322
|
-
await this.deps.
|
|
322
|
+
await this.deps.interruptAndPromptRun(this.state.run, runtimeId, text);
|
|
323
323
|
this.state = {
|
|
324
324
|
...this.state,
|
|
325
|
-
actionMessage: clipText(`
|
|
325
|
+
actionMessage: clipText(`Interrupted and sent: ${text}`, ACTION_STATUS_CHARS)
|
|
326
326
|
};
|
|
327
|
-
}, "sending
|
|
327
|
+
}, "interrupting and sending…");
|
|
328
328
|
return;
|
|
329
329
|
}
|
|
330
330
|
if (!isFollowUpable(this.state.status, this.state.snapshot)) return;
|
|
@@ -463,7 +463,7 @@ var RunInspectorOverlay = class {
|
|
|
463
463
|
for (const line of body) lines.push(padLine(line, innerWidth));
|
|
464
464
|
lines.push(horizontal);
|
|
465
465
|
lines.push(...this.input.render(innerWidth).map((line) => truncateToWidth(line, innerWidth)));
|
|
466
|
-
const promptHint = this.state.status && isPromptable(this.state.status, this.state.snapshot) ? "send
|
|
466
|
+
const promptHint = this.state.status && isPromptable(this.state.status, this.state.snapshot) ? "interrupt and send to running/waiting run" : isFollowUpable(this.state.status, this.state.snapshot) ? "start a follow-up run from this transcript" : "read-only view";
|
|
467
467
|
lines.push(truncateToWidth(theme.fg("dim", `${promptHint} · ${helpText(this.state)}`), innerWidth));
|
|
468
468
|
lines.push(horizontal);
|
|
469
469
|
return lines.map((line) => truncateToWidth(line, innerWidth));
|
|
@@ -553,6 +553,28 @@ function formatRunLine(entry) {
|
|
|
553
553
|
return `${emoji} ${entry.label} (${entry.agent}) — ${entry.status}${phase}${perm}`;
|
|
554
554
|
}
|
|
555
555
|
//#endregion
|
|
556
|
+
//#region src/agent-profile.ts
|
|
557
|
+
const PROFILE_ENTRY_TYPE = "pi-agents:profile";
|
|
558
|
+
/**
|
|
559
|
+
* Read the optional pi-agents session convention without depending on its
|
|
560
|
+
* package. A namespaced environment variable is an optional launch override.
|
|
561
|
+
*/
|
|
562
|
+
function resolveAgentProfile(entries, environment = process.env) {
|
|
563
|
+
const fromEnvironment = environment.PI_AGENT_PROFILE;
|
|
564
|
+
if (fromEnvironment) return fromEnvironment;
|
|
565
|
+
let selected;
|
|
566
|
+
for (const entry of entries ?? []) {
|
|
567
|
+
if (!entry || typeof entry !== "object") continue;
|
|
568
|
+
const custom = entry;
|
|
569
|
+
if (custom.type !== "custom" || custom.customType !== PROFILE_ENTRY_TYPE) continue;
|
|
570
|
+
if (!custom.data || typeof custom.data !== "object") continue;
|
|
571
|
+
const name = custom.data.name;
|
|
572
|
+
if (typeof name === "string") selected = name;
|
|
573
|
+
if (name === null) selected = void 0;
|
|
574
|
+
}
|
|
575
|
+
return selected;
|
|
576
|
+
}
|
|
577
|
+
//#endregion
|
|
556
578
|
//#region src/index.ts
|
|
557
579
|
const POLL_INTERVAL_MS = 3e3;
|
|
558
580
|
const INSPECT_LIMIT = 128;
|
|
@@ -915,9 +937,9 @@ function createExtension(deps = defaultDeps) {
|
|
|
915
937
|
await client.cancel(runtimeId);
|
|
916
938
|
});
|
|
917
939
|
},
|
|
918
|
-
|
|
940
|
+
interruptAndPromptRun(run, runtimeId, text) {
|
|
919
941
|
return withClient(run, async (client) => {
|
|
920
|
-
await client.
|
|
942
|
+
await client.interruptAndPrompt(runtimeId, text);
|
|
921
943
|
});
|
|
922
944
|
},
|
|
923
945
|
followUpRun(run, text) {
|
|
@@ -1134,6 +1156,8 @@ function createExtension(deps = defaultDeps) {
|
|
|
1134
1156
|
const dir = params.dir ?? ctx.cwd;
|
|
1135
1157
|
const label = params.label ?? `${params.agent}-${Date.now()}`;
|
|
1136
1158
|
const backend = params.backend ?? "pi";
|
|
1159
|
+
const entries = ctx.sessionManager?.getEntries?.();
|
|
1160
|
+
const agentProfile = backend === "pi" ? resolveAgentProfile(entries) : void 0;
|
|
1137
1161
|
const result = await deps.spawnTool({
|
|
1138
1162
|
agent: params.agent,
|
|
1139
1163
|
prompt: params.prompt,
|
|
@@ -1143,6 +1167,7 @@ function createExtension(deps = defaultDeps) {
|
|
|
1143
1167
|
timeout: params.timeout,
|
|
1144
1168
|
model: params.model,
|
|
1145
1169
|
backend,
|
|
1170
|
+
agentProfile,
|
|
1146
1171
|
serverUrl: params.server_url,
|
|
1147
1172
|
supervisorId: params.supervisor_id
|
|
1148
1173
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dougbots/avenor-pi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dev": "tsdown --watch"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@dougbots/avenor-core": "^0.
|
|
38
|
+
"@dougbots/avenor-core": "^0.7.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@earendil-works/pi-coding-agent": "*",
|