@dougbots/avenor-pi 0.6.0 → 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 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
@@ -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;
@@ -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.6.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.6.0"
38
+ "@dougbots/avenor-core": "^0.7.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@earendil-works/pi-coding-agent": "*",