@pi-unipi/btw 2.6.2 → 2.9.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.
Files changed (2) hide show
  1. package/extensions/btw.ts +16 -2
  2. package/package.json +6 -6
package/extensions/btw.ts CHANGED
@@ -26,6 +26,7 @@ import {
26
26
  type ExtensionAPI,
27
27
  type ExtensionCommandContext,
28
28
  type ExtensionContext,
29
+ type ModelRuntime,
29
30
  type ResourceLoader,
30
31
  } from "@earendil-works/pi-coding-agent";
31
32
  import { type AssistantMessage, type Message, type ThinkingLevel as AiThinkingLevel, type UserMessage } from "@earendil-works/pi-ai";
@@ -161,6 +162,17 @@ function stripDynamicSystemPromptFooter(systemPrompt: string): string {
161
162
  .trim();
162
163
  }
163
164
 
165
+ /**
166
+ * Extract the canonical ModelRuntime from the extension-facing ModelRegistry
167
+ * facade. The SDK (>=0.84) exposes `modelRuntime` on AgentSession and expects
168
+ * it in CreateAgentSessionOptions; the extension context only hands us the
169
+ * ModelRegistry wrapper, whose `runtime` field is the same instance the
170
+ * parent session uses (agent-session wires `new ModelRegistry(this._modelRuntime)`).
171
+ */
172
+ function sessionModelRuntime(ctx: ExtensionCommandContext): ModelRuntime {
173
+ return (ctx.modelRegistry as unknown as { runtime: ModelRuntime }).runtime;
174
+ }
175
+
164
176
  function createBtwResourceLoader(
165
177
  ctx: ExtensionCommandContext,
166
178
  appendSystemPrompt: string[] = [BTW_SYSTEM_PROMPT],
@@ -175,7 +187,9 @@ function createBtwResourceLoader(
175
187
  getThemes: () => ({ themes: [], diagnostics: [] }),
176
188
  getAgentsFiles: () => ({ agentsFiles: [] }),
177
189
  getSystemPrompt: () => systemPrompt,
190
+ getSystemPromptSource: () => undefined,
178
191
  getAppendSystemPrompt: () => appendSystemPrompt,
192
+ getAppendSystemPromptSources: () => [],
179
193
  extendResources: () => {},
180
194
  reload: async () => {},
181
195
  };
@@ -1339,7 +1353,7 @@ export default function (pi: ExtensionAPI) {
1339
1353
  const { session } = await createAgentSession({
1340
1354
  sessionManager: SessionManager.inMemory(),
1341
1355
  model: ctx.model,
1342
- modelRegistry: ctx.modelRegistry as AgentSession["modelRegistry"],
1356
+ modelRuntime: sessionModelRuntime(ctx),
1343
1357
  thinkingLevel: pi.getThinkingLevel() as SessionThinkingLevel,
1344
1358
  tools: ["read", "bash", "edit", "write"],
1345
1359
  resourceLoader: createBtwResourceLoader(ctx),
@@ -1816,7 +1830,7 @@ export default function (pi: ExtensionAPI) {
1816
1830
  const { session } = await createAgentSession({
1817
1831
  sessionManager: SessionManager.inMemory(),
1818
1832
  model,
1819
- modelRegistry: ctx.modelRegistry as AgentSession["modelRegistry"],
1833
+ modelRuntime: sessionModelRuntime(ctx),
1820
1834
  thinkingLevel: "off",
1821
1835
  tools: [],
1822
1836
  resourceLoader: createBtwResourceLoader(ctx, [BTW_SUMMARIZE_SYSTEM_PROMPT]),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pi-unipi/btw",
3
- "version": "2.6.2",
4
- "description": "A pi extension for parallel side conversations with /unipi:btw part of the Unipi suite",
3
+ "version": "2.9.0",
4
+ "description": "A pi extension for parallel side conversations with /unipi:btw \u2014 part of the Unipi suite",
5
5
  "type": "module",
6
6
  "main": "extensions/btw.ts",
7
7
  "license": "MIT",
@@ -32,12 +32,12 @@
32
32
  "access": "public"
33
33
  },
34
34
  "peerDependencies": {
35
- "@earendil-works/pi-ai": "^0.80.0",
36
- "@earendil-works/pi-coding-agent": "^0.80.0",
37
- "@earendil-works/pi-tui": "^0.80.0"
35
+ "@earendil-works/pi-ai": "^0.84.0",
36
+ "@earendil-works/pi-coding-agent": "^0.84.0",
37
+ "@earendil-works/pi-tui": "^0.84.0"
38
38
  },
39
39
  "dependencies": {
40
- "@pi-unipi/core": "2.6.1"
40
+ "@pi-unipi/core": "2.9.0"
41
41
  },
42
42
  "pi": {
43
43
  "extensions": [