@maxiaochao/pi-toolkit 0.5.0 → 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 +8 -0
- package/bin/pi-worktree +19 -0
- package/extensions/btw.ts +11 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
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
|
+
|
|
5
|
+
## 2026-09-11 - v0.5.1
|
|
6
|
+
|
|
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
|
|
8
|
+
|
|
1
9
|
## 2026-09-11 - v0.5.0
|
|
2
10
|
|
|
3
11
|
- fix pi-worktree: new worktrees now branch from the current branch instead of a stale origin/main (worktree content no longer misses current work); add start --base <ref> to branch from an explicit ref
|
package/bin/pi-worktree
CHANGED
|
@@ -144,12 +144,31 @@ cmd_remove() {
|
|
|
144
144
|
[[ -d "$dir" ]] || die "worktree not found: $dir"
|
|
145
145
|
# refuse to remove if the branch is not merged into main
|
|
146
146
|
local branch; branch=$(git -C "$dir" branch --show-current)
|
|
147
|
+
local rm_anyway=0
|
|
147
148
|
if [[ -n "$branch" ]] && ! git merge-base --is-ancestor "$branch" main 2>/dev/null; then
|
|
148
149
|
warn "branch '$branch' does not appear merged into 'main' (or no main branch exists)."
|
|
149
150
|
read -rp "Remove anyway? [y/N] " ans
|
|
150
151
|
[[ "$ans" =~ ^[Yy]$ ]] || die "aborted"
|
|
152
|
+
rm_anyway=1
|
|
151
153
|
fi
|
|
152
154
|
git worktree remove "$dir" && ok "removed: $dir"
|
|
155
|
+
# The branch survives `git worktree remove`; recreating the same name would
|
|
156
|
+
# silently reuse this stale branch. Delete merged branches automatically.
|
|
157
|
+
if [[ -n "$branch" ]] && git show-ref --verify --quiet "refs/heads/$branch"; then
|
|
158
|
+
if git branch -d "$branch" 2>/dev/null; then
|
|
159
|
+
ok "deleted merged branch: $branch"
|
|
160
|
+
elif [[ "$rm_anyway" == 1 ]]; then
|
|
161
|
+
git branch -D "$branch" && ok "deleted unmerged branch: $branch (confirmed above)"
|
|
162
|
+
else
|
|
163
|
+
warn "branch '$branch' has unmerged commits."
|
|
164
|
+
read -rp "Delete anyway? [y/N] " ans
|
|
165
|
+
if [[ "$ans" =~ ^[Yy]$ ]]; then
|
|
166
|
+
git branch -D "$branch" && ok "deleted branch: $branch"
|
|
167
|
+
else
|
|
168
|
+
warn "branch '$branch' kept; 'pi-worktree start $branch' will reuse it as-is"
|
|
169
|
+
fi
|
|
170
|
+
fi
|
|
171
|
+
fi
|
|
153
172
|
}
|
|
154
173
|
|
|
155
174
|
cd_wt() {
|
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
|
-
|
|
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
|
-
|
|
835
|
+
modelRuntime: getParentModelRuntime(ctx),
|
|
827
836
|
thinkingLevel: "off",
|
|
828
837
|
tools: [],
|
|
829
838
|
resourceLoader: createBtwResourceLoader(ctx, [BTW_SUMMARY_PROMPT]),
|
package/package.json
CHANGED