@maxiaochao/pi-toolkit 0.5.1 → 0.5.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 2026-09-11 - v0.5.2
2
+
3
+ - fix btw: side-session and summarize passed a nonexistent `modelRegistry` option to `createAgentSession`, so a fresh ModelRuntime was created that didn't know extension-registered providers (e.g. volcengine-plan) and prompting failed with "No API key found"; now the main session's ModelRuntime is reused via `modelRuntime`
4
+
1
5
  ## 2026-09-11 - v0.5.1
2
6
 
3
7
  - fix pi-worktree: remove now cleans up the branch automatically — merged branches are deleted without prompting, unmerged ones confirm once (one prompt covers both worktree removal and branch deletion), so recreating the same name no longer silently reuses a stale branch
package/extensions/btw.ts CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  type ExtensionAPI,
10
10
  type ExtensionCommandContext,
11
11
  type ExtensionContext,
12
+ type ModelRuntime,
12
13
  type ResourceLoader,
13
14
  } from "@earendil-works/pi-coding-agent";
14
15
  import { type AssistantMessage, type Message, type ThinkingLevel as AiThinkingLevel } from "@earendil-works/pi-ai";
@@ -633,7 +634,7 @@ export default function (pi: ExtensionAPI) {
633
634
  const { session } = await createAgentSession({
634
635
  sessionManager: SessionManager.inMemory(),
635
636
  model: ctx.model,
636
- modelRegistry: ctx.modelRegistry as AgentSession["modelRegistry"],
637
+ modelRuntime: getParentModelRuntime(ctx),
637
638
  thinkingLevel: pi.getThinkingLevel() as SessionThinkingLevel,
638
639
  tools: ["read", "bash", "edit", "write"],
639
640
  resourceLoader: createBtwResourceLoader(ctx),
@@ -809,6 +810,14 @@ export default function (pi: ExtensionAPI) {
809
810
  });
810
811
  }
811
812
 
813
+ function getParentModelRuntime(ctx: ExtensionCommandContext | ExtensionContext): ModelRuntime {
814
+ // The ModelRegistry facade keeps its runtime in a JS property that is
815
+ // private at the type level. Reusing it is required: a fresh ModelRuntime
816
+ // would not know about extension-registered providers (e.g. volcengine-plan),
817
+ // causing "No API key found" even when auth.json has the credential.
818
+ return (ctx.modelRegistry as unknown as { runtime: ModelRuntime }).runtime;
819
+ }
820
+
812
821
  async function summarizeThread(ctx: ExtensionContext, items: BtwDetails[]): Promise<string> {
813
822
  const model = ctx.model;
814
823
  if (!model) {
@@ -823,7 +832,7 @@ export default function (pi: ExtensionAPI) {
823
832
  const { session } = await createAgentSession({
824
833
  sessionManager: SessionManager.inMemory(),
825
834
  model,
826
- modelRegistry: ctx.modelRegistry as AgentSession["modelRegistry"],
835
+ modelRuntime: getParentModelRuntime(ctx),
827
836
  thinkingLevel: "off",
828
837
  tools: [],
829
838
  resourceLoader: createBtwResourceLoader(ctx, [BTW_SUMMARY_PROMPT]),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maxiaochao/pi-toolkit",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Personal pi coding agent toolkit: /todos, /btw, /cache_export extensions, browser automation, and bundled theme/skills.",
5
5
  "type": "module",
6
6
  "keywords": [