@andares/pi-toolkits 0.7.1 → 0.7.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/README.md +6 -6
- package/README.zh-CN.md +6 -6
- package/package.json +5 -5
- package/src/features/autostart/index.ts +1 -1
- package/src/features/compact/index.ts +3 -3
- package/src/features/compact/prompt.ts +7 -4
- package/src/features/favorites/constants.ts +4 -4
- package/src/features/favorites/patch-cycle.ts +3 -3
- package/src/features/favorites/patch-selector.ts +3 -3
- package/src/features/stash/stash.ts +1 -1
- package/src/lib/model-config.ts +1 -1
- package/src/lib/model-picker.ts +2 -2
package/README.md
CHANGED
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
[](https://www.npmjs.com/package/@andares/pi-toolkits)
|
|
10
10
|
[](LICENSE)
|
|
11
11
|
[](https://pnpm.io)
|
|
12
|
-
[](https://github.com/earendil-works/pi)
|
|
13
13
|
[](https://github.com/andares/pi-toolkits)
|
|
14
14
|
|
|
15
15
|
In a nutshell: six ready-to-use capabilities — **read-only consult mode** `ask`, **model favorites** `favorites`, **prompt stash** `stash`, **third-party code review** `third-review`, **dedicated compaction model** `compact-model` and **session startup automation** `autostart` — with more to come.
|
|
16
16
|
|
|
17
|
-
**Requirements**: pi `>=0.
|
|
17
|
+
**Requirements**: pi `>=0.87.0 <2.0.0` (covering the four most recently released minor lines — 0.87.x / 0.99.x / 1.0.x / 1.1.x; 0.88–0.98 were never released). Every one of the 11 published versions inside that range (0.87.0 → 1.1.0) was compared against the host `dist`: the extension APIs we use carry no breaking differences (1.0.4 → 1.1.0 only adds fields), and the two runtime patch targets used by favorites — `ModelSelectorComponent` / `AgentSession.cycleModel` — are byte-identical. `typecheck` plus the full test suite pass on each of 0.87.0, 0.87.1, 0.99.0, 0.99.2, 1.0.0, 1.0.4 and 1.1.0, and smoke-loading on real pi 1.1.0 produces no warnings. Note: pi ≥ 0.99 hosts require `@earendil-works/pi-tui` to be declared in `peerDependencies` as `"*"` (provided by the host); this package declares it as required.
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
@@ -36,7 +36,7 @@ pi -e ./src/index.ts
|
|
|
36
36
|
After installing, verify in any pi session:
|
|
37
37
|
|
|
38
38
|
- `/ask` → a grey `ask` status appears in the footer, `write`/`edit` are hard-disabled
|
|
39
|
-
- `/model` (or `ctrl+l`) → a favorites hint line appears at the top of the selector
|
|
39
|
+
- `/model` (or `ctrl+l`) → a favorites hint line appears at the top of the selector; `ctrl+A` on the selected model → it turns bold bright yellow and the favorites counter goes up (this step is also the real-machine keypress check — see Keybindings)
|
|
40
40
|
- press `ctrl+alt+y` in the input box → the current prompt is stashed and the input box is cleared
|
|
41
41
|
- after finishing a development task, type `/third-review` → switches to the review model and runs check + fix
|
|
42
42
|
- `/compact-model`, pick a cheap fast model → from then on both `/compact` and auto-compaction summarize with it (a grey `compact` status appears in the footer)
|
|
@@ -118,7 +118,7 @@ The `/favorites` command lists the current favorites and the cycling mode.
|
|
|
118
118
|
|
|
119
119
|
> **Implementation notes**: pi's `app.model.cycleForward` (`ctrl+p`) and `cycleBackward` are **reserved keybindings** that extension shortcuts cannot override; extension shortcuts also only fire while the editor is focused. This feature therefore rebinds nothing; instead it patches two built-in prototypes at runtime (version-guarded, idempotent under `/reload`): `ModelSelectorComponent` (hint line, `ctrl+A`/`ctrl+J`, bright-yellow rendering, favorites-only filter — the keys are consumed only inside the selector, so in the editor `ctrl+j` still inserts a newline) and `AgentSession.cycleModel` (favorites-only cycling). If a pi upgrade makes the patch inapplicable, it warns and degrades gracefully without affecting the other features.
|
|
120
120
|
>
|
|
121
|
-
> **Why `ctrl+A` and not `ctrl+F`**: since pi 1.0 the default `tuiMode` is `fullscreen` (0.
|
|
121
|
+
> **Why `ctrl+A` and not `ctrl+F`**: since pi 1.0 the default `tuiMode` is `fullscreen` (0.87–0.99 defaulted to `regular`), and on Windows/WSL the host resolves `tui.altScreen.search` to `ctrl+f`; `TuiAltScreen.handleViewportInput()` checks that binding **before** handing input to the focused overlay, so `ctrl+f` opened the transcript search instead of reaching the selector. An interim pick, `ctrl+alt+f`, was clean at the pi layer but turned out to be grabbed by a Windows screenshot tool — a key free in the host table is not necessarily free on the machine. The final pick takes a letter from "favorite" and audits each: `v` is Windows Terminal's paste, `o`/`r`/`t` are host app actions, `i` is byte-identical to Tab (the selector's scope toggle), `e` works but carries no mnemonic; `a` only shadows the search box's jump-to-line-start, reads as *add favorite*, and nothing upstream of the selector claims it. Full audit: `src/features/favorites/constants.ts` and `pnpm check:keybindings`.
|
|
122
122
|
|
|
123
123
|
---
|
|
124
124
|
|
|
@@ -195,7 +195,7 @@ pi's `/compact` and auto-compact summarize the context **with the current sessio
|
|
|
195
195
|
| auto-compact threshold reached | summarized by the compaction model |
|
|
196
196
|
| context overflow recovery | summarized by the compaction model, retry behavior unchanged |
|
|
197
197
|
|
|
198
|
-
**Parts that are identical to pi's built-in behavior after takeover** (the built-in implementation is mirrored verbatim — byte-identical since 0.87.1, verified up to 1.0.
|
|
198
|
+
**Parts that are identical to pi's built-in behavior after takeover** (the built-in implementation is mirrored verbatim — byte-identical since 0.87.1, verified up to 1.1.0; 0.87.0 shipped an earlier split-turn prompt, and the mirror carries the 0.87.1 fix for every host — and only the executing model changes):
|
|
199
199
|
|
|
200
200
|
- **Summary format** — the structured Goal / Progress / Key Decisions checkpoint; when a summary already exists, the iterative-update prompt is used so information carries over instead of being lost
|
|
201
201
|
- **Split behavior** — the `keepRecentTokens` retention policy, and `firstKeptEntryId` / `tokensBefore` passed back unchanged
|
|
@@ -262,7 +262,7 @@ No file = feature disabled, zero overhead, silently skipped.
|
|
|
262
262
|
|
|
263
263
|
**Key constraint: extension commands only**. Commands registered via `registerCommand` such as `/add-dir` (pi-add-dir) and `/cd` (pi-cd) work; built-in commands (`/compact`, `/reload`, `/resume`, …) are dispatched in the TUI layer and cannot be triggered from the extension layer; skill commands (`/skill:name`) are an expansion mechanism rather than an execution mechanism. The target extension you depend on (e.g. pi-add-dir) must be installed first.
|
|
264
264
|
|
|
265
|
-
> **Implementation notes**: execution uses `sendUserMessage(cmd, { expandPromptTemplates: true })` — that option routes `/cmd args` into command dispatch instead of the model prompt path (the wrapper defaults to `false`; verified against pi 0.
|
|
265
|
+
> **Implementation notes**: execution uses `sendUserMessage(cmd, { expandPromptTemplates: true })` — that option routes `/cmd args` into command dispatch instead of the model prompt path (the wrapper defaults to `false`; verified against pi 0.87.0–1.1.0 sources, see the host-compatibility discipline in AGENTS.md). Pre-validation uses `pi.getCommands()` (accepting only `source: "extension"`). Depends on `smol-toml` (zero-dependency, ~10KB, TOML 1.0).
|
|
266
266
|
|
|
267
267
|
---
|
|
268
268
|
|
package/README.zh-CN.md
CHANGED
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
[](https://www.npmjs.com/package/@andares/pi-toolkits)
|
|
10
10
|
[](LICENSE)
|
|
11
11
|
[](https://pnpm.io)
|
|
12
|
-
[](https://github.com/earendil-works/pi)
|
|
13
13
|
[](https://github.com/andares/pi-toolkits)
|
|
14
14
|
|
|
15
15
|
一句话介绍:目前包含六个开箱即用的功能——**只读咨询模式** `ask`、**模型收藏** `favorites`、**提示词暂存** `stash`、**第三方代码评审** `third-review`、**独立压缩模型** `compact-model`、**会话启动自动化** `autostart`,后续持续追加。
|
|
16
16
|
|
|
17
|
-
**版本要求**:pi `>=0.
|
|
17
|
+
**版本要求**:pi `>=0.87.0 <2.0.0`(覆盖最近 4 个中版本线 0.87.x / 0.99.x / 1.0.x / 1.1.x —— 0.88–0.98 从未发布。区间内全部 11 个已发布版本(0.87.0 → 1.1.0)逐版本比对宿主 dist:用到的扩展 API 无破坏性差异(1.0.4 → 1.1.0 仅新增字段),favorites 两处运行时 patch 目标 `ModelSelectorComponent` / `AgentSession.cycleModel` 字节级一致;并在 0.87.0、0.87.1、0.99.0、0.99.2、1.0.0、1.0.4、1.1.0 上逐一通过 typecheck + 全量测试,在真实 pi 1.1.0 上冒烟加载无警告)。注:pi ≥ 0.99 的宿主要求 `@earendil-works/pi-tui` 声明为 peerDependencies `"*"`(由宿主提供),本包已按要求声明。
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
@@ -36,7 +36,7 @@ pi -e ./src/index.ts
|
|
|
36
36
|
安装后在任意 pi 会话中验证:
|
|
37
37
|
|
|
38
38
|
- `/ask` → footer 出现灰色 `ask` 状态,`write`/`edit` 被硬禁用
|
|
39
|
-
- `/model`(或 `ctrl+l`)→
|
|
39
|
+
- `/model`(或 `ctrl+l`)→ 选择器顶部出现收藏提示行;对选中模型按 `ctrl+A` → 文字变**加粗亮黄**、收藏计数 +1(这一步同时就是真机按键检查,见「键位」约定)
|
|
40
40
|
- 输入框内按 `ctrl+alt+y` → 当前提示词被暂存并清空输入框
|
|
41
41
|
- 完成一个开发任务后输入 `/third-review` → 切换到评审模型执行查+修
|
|
42
42
|
- `/compact-model` 选一个便宜快模型 → 之后 `/compact` 与自动压缩的总结都由它执行(footer 出现灰色 `compact` 状态)
|
|
@@ -118,7 +118,7 @@ pi -e ./src/index.ts
|
|
|
118
118
|
|
|
119
119
|
> **实现说明**:pi 的 `app.model.cycleForward`(`ctrl+p`)与 `cycleBackward` 是**保留键位**,扩展快捷键无法覆盖;且扩展快捷键只在编辑器聚焦时生效。因此本功能不重绑任何按键,而是在运行时 patch 两个内置原型(带版本守卫、`/reload` 幂等):`ModelSelectorComponent`(提示行、`ctrl+A`/`ctrl+J`、亮黄渲染、仅收藏过滤——按键仅在选择器内消费,编辑器里 `ctrl+j` 换行不受影响)与 `AgentSession.cycleModel`(收藏循环)。若 pi 升级导致 patch 无法应用,会 warn 并优雅降级,不影响其它功能。
|
|
120
120
|
>
|
|
121
|
-
> **为何是 `ctrl+A` 而不是 `ctrl+F`**:pi 自 1.0 起 `tuiMode` 默认 `fullscreen`(0.
|
|
121
|
+
> **为何是 `ctrl+A` 而不是 `ctrl+F`**:pi 自 1.0 起 `tuiMode` 默认 `fullscreen`(0.87–0.99 默认 `regular`),而在 Windows/WSL 上宿主把 `tui.altScreen.search` 解析为 `ctrl+f`;`TuiAltScreen.handleViewportInput()` 在**把输入交给聚焦覆盖层之前**先检查该绑定,于是 `ctrl+f` 打开了会话记录搜索、根本到不了选择器。曾过渡性地选过 `ctrl+alt+f`——pi 层完全空闲,却被 Windows 侧截图工具作为全局热键截走:**宿主表空闲 ≠ 机器层空闲**。最终从 "favorite" 一词里逐字母审计:`v` 是 Windows Terminal 的粘贴键,`o`/`r`/`t` 是宿主 app 层动作,`i` 与 Tab 字节恒等(选择器的 scope 切换),`e` 可用但无记忆点;`a` 仅遮蔽搜索框内的行首跳转、读作 *add favorite*,且选择器上游无任何消费者。完整依据见 `src/features/favorites/constants.ts` 与 `pnpm check:keybindings`。
|
|
122
122
|
|
|
123
123
|
---
|
|
124
124
|
|
|
@@ -195,7 +195,7 @@ pi 的 `/compact` 与 auto-compact 默认**用当前会话模型**做上下文
|
|
|
195
195
|
| auto-compact 阈值触发 | 压缩模型总结 |
|
|
196
196
|
| context overflow 恢复 | 压缩模型总结,重试行为不变 |
|
|
197
197
|
|
|
198
|
-
**接管后与 pi 内建行为完全一致的部分**(逐字同步 pi 内建实现,0.87.1 起字节级不变、已核对至 1.0.
|
|
198
|
+
**接管后与 pi 内建行为完全一致的部分**(逐字同步 pi 内建实现,0.87.1 起字节级不变、已核对至 1.1.0,只换执行模型;0.87.0 的分割轮次前缀 prompt 与 0.87.1 不同,本镜像对所有宿主采用 0.87.1 的修复文本):
|
|
199
199
|
|
|
200
200
|
- **摘要格式** —— Goal / Progress / Key Decisions 结构化 checkpoint;已有摘要时用迭代更新版 prompt,信息延续不丢
|
|
201
201
|
- **切分行为** —— 保留最近 `keepRecentTokens` 的策略、`firstKeptEntryId` / `tokensBefore` 原样回传,不动
|
|
@@ -262,7 +262,7 @@ run = [
|
|
|
262
262
|
|
|
263
263
|
**关键约束:只支持扩展命令**。`/add-dir`(pi-add-dir)、`/cd`(pi-cd)等 `registerCommand` 注册的命令可以;内置命令(`/compact`、`/reload`、`/resume`…)在 TUI 层分发,扩展层触发不了;skill 命令(`/skill:name`)是展开机制而非执行机制。依赖的目标扩展(如 pi-add-dir)需要先安装。
|
|
264
264
|
|
|
265
|
-
> **实现说明**:执行用 `sendUserMessage(cmd, { expandPromptTemplates: true })` —— 该选项把 `/cmd args` 路由到命令分发而不是模型 prompt 路径(包装层默认 `false`,已对照 pi 0.
|
|
265
|
+
> **实现说明**:执行用 `sendUserMessage(cmd, { expandPromptTemplates: true })` —— 该选项把 `/cmd args` 路由到命令分发而不是模型 prompt 路径(包装层默认 `false`,已对照 pi 0.87.0–1.1.0 源码核实,见 AGENTS.md 宿主兼容纪律)。预校验用 `pi.getCommands()`(只认 `source: "extension"`)。依赖 `smol-toml`(零依赖、~10KB、TOML 1.0)。
|
|
266
266
|
|
|
267
267
|
---
|
|
268
268
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andares/pi-toolkits",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Integrated toolkit extension for pi — ask mode (read-only Q&A), model favorites, prompt stash, third-party code review, and a dedicated compaction model",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"autostart"
|
|
29
29
|
],
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@earendil-works/pi-coding-agent": ">=0.
|
|
31
|
+
"@earendil-works/pi-coding-agent": ">=0.87.0 <2.0.0",
|
|
32
32
|
"@earendil-works/pi-tui": "*"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"smol-toml": "^1.9.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@earendil-works/pi-ai": "^1.0
|
|
40
|
-
"@earendil-works/pi-coding-agent": "^1.0
|
|
41
|
-
"@earendil-works/pi-tui": "^1.0
|
|
39
|
+
"@earendil-works/pi-ai": "^1.1.0",
|
|
40
|
+
"@earendil-works/pi-coding-agent": "^1.1.0",
|
|
41
|
+
"@earendil-works/pi-tui": "^1.1.0",
|
|
42
42
|
"@types/node": "^26.6.2",
|
|
43
43
|
"typescript": "^5.6.0",
|
|
44
44
|
"vitest": "^4.1.10"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* Dispatch uses `sendUserMessage(cmd, { expandPromptTemplates: true })` —
|
|
17
17
|
* that flag is what routes "/cmd args" through _tryExecuteExtensionCommand
|
|
18
18
|
* instead of the model prompt path. The wrapper defaults it to false
|
|
19
|
-
* (verified against pi 1.0
|
|
19
|
+
* (verified against pi 1.1.0 agent-session.js; see AGENTS.md host-compat
|
|
20
20
|
* discipline for the version matrix).
|
|
21
21
|
*
|
|
22
22
|
* Only extension commands can run this way. Built-in commands (/compact,
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* before running its own compaction
|
|
12
12
|
* - prompts, message assembly, split-turn handling, output budgets, and the
|
|
13
13
|
* summary file-list tail are verbatim pi built-in behavior (copied from
|
|
14
|
-
* 0.87.1, verified unchanged through 1.0
|
|
14
|
+
* 0.87.1, verified unchanged through 1.1.0) — only the executing model
|
|
15
15
|
* differs
|
|
16
16
|
* - lossless fallback: unset config, unavailable model, empty/failed
|
|
17
17
|
* summary, or user abort → return undefined and pi's default compaction
|
|
@@ -116,7 +116,7 @@ async function completeSummary(
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
|
-
* pi's output-budget formula (compaction.js, 0.87.1 → 1.0
|
|
119
|
+
* pi's output-budget formula (compaction.js, 0.87.1 → 1.1.0 unchanged): a
|
|
120
120
|
* fraction of reserveTokens clamped by the model's own output cap.
|
|
121
121
|
*/
|
|
122
122
|
function summarizationBudget(
|
|
@@ -132,7 +132,7 @@ function summarizationBudget(
|
|
|
132
132
|
|
|
133
133
|
/**
|
|
134
134
|
* Run the full compaction summarization with the configured model,
|
|
135
|
-
* replicating pi's compact() (0.87.1, verified unchanged through 1.0
|
|
135
|
+
* replicating pi's compact() (0.87.1, verified unchanged through 1.1.0):
|
|
136
136
|
* history summary (first-connection or iterative-update prompt, custom
|
|
137
137
|
* focus appended), plus a separate turn-prefix checkpoint when the cut point
|
|
138
138
|
* splits a turn, merged into one summary with the file-list tail. Returns
|
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
* compaction (dist/core/compaction/compaction.js and utils.js) so that
|
|
6
6
|
* summaries produced by the configured compact model are formatted exactly
|
|
7
7
|
* like pi's own compaction output. Only the executing model differs.
|
|
8
|
-
* Verified byte-identical against pi 1.0
|
|
9
|
-
* the only 0.87.1→1.0
|
|
10
|
-
* shared
|
|
8
|
+
* Verified byte-identical against pi 1.1.0 (0.88–0.98 were never published;
|
|
9
|
+
* the only 0.87.1→1.1.0 change there is a combineUsage refactor into a
|
|
10
|
+
* shared core/usage-totals.js, no prompt or budget change). 0.87.0 shipped a
|
|
11
|
+
* different split-turn prefix prompt; the text mirrored here is 0.87.1+'s
|
|
12
|
+
* fix, which is also what 0.87.0 hosts get — intentional.
|
|
11
13
|
*
|
|
12
14
|
* Update these strings whenever pi changes its built-in prompts (diff
|
|
13
15
|
* dist/core/compaction/compaction.js between versions).
|
|
@@ -196,7 +198,8 @@ export function formatFileOperations(
|
|
|
196
198
|
|
|
197
199
|
/**
|
|
198
200
|
* Combine two provider usage records field-wise (pi 0.87.1 compaction.js
|
|
199
|
-
* combineUsage
|
|
201
|
+
* combineUsage, moved verbatim to core/usage-totals.js in 0.99.0): used when
|
|
202
|
+
* a split turn produces two summarization calls.
|
|
200
203
|
*/
|
|
201
204
|
export function combineUsage<T extends UsageLike>(first: T, second: T): T {
|
|
202
205
|
return {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* bindings — only the cycle semantics change (patch-cycle.ts), so no
|
|
9
9
|
* keybinding conflicts arise.
|
|
10
10
|
*
|
|
11
|
-
* Verified against pi 0.
|
|
11
|
+
* Verified against pi 0.87.0 / 0.99.0 / 1.0.4 / 1.1.0 keybinding
|
|
12
12
|
* tables + pi-tui input dispatch on WSL2 + Windows Terminal; re-run
|
|
13
13
|
* `pnpm check:keybindings` after every host upgrade before trusting this.
|
|
14
14
|
*/
|
|
@@ -25,15 +25,15 @@ export const FAVORITES_FILE = "pi-toolkits-favorites.json";
|
|
|
25
25
|
* missed — audit trail below; re-run `pnpm check:keybindings` on upgrades.
|
|
26
26
|
*
|
|
27
27
|
* Why ctrl+f is dead: fullscreen became pi's default `tuiMode` in 1.0
|
|
28
|
-
* (0.
|
|
28
|
+
* (0.87–0.99 defaulted to `regular`, where the binding is inert). On
|
|
29
29
|
* Windows/WSL `tui.altScreen.search` resolves to ctrl+f, and
|
|
30
30
|
* `TuiAltScreen.handleViewportInput()` checks it before
|
|
31
31
|
* `shouldDeferViewportInputToOverlay()`, so the keystroke opens transcript
|
|
32
|
-
* search and the selector never sees it (verified in pi-tui 1.0
|
|
32
|
+
* search and the selector never sees it (verified in pi-tui 1.1.0
|
|
33
33
|
* `dist/tui-alt-screen.js`: the search check is the first key branch and
|
|
34
34
|
* returns `{ consume: true }` unconditionally).
|
|
35
35
|
*
|
|
36
|
-
* Why ctrl+alt+f was discarded: clean at the pi layer across 0.
|
|
36
|
+
* Why ctrl+alt+f was discarded: clean at the pi layer across 0.87–1.1 (only
|
|
37
37
|
* ctrl+alt+] is taken from that family) and byte-distinguishable without
|
|
38
38
|
* kitty — but grabbed at the OS/app layer on the author's machine by a
|
|
39
39
|
* Windows screenshot tool, so it never reached the terminal. Lesson: a key
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* - with exactly one favorite, already on it → undefined (stock "only one
|
|
15
15
|
* model available" feedback); otherwise jump to it
|
|
16
16
|
* - the apply logic mirrors pi's _cycleScopedModel/_cycleAvailableModel
|
|
17
|
-
* (byte-identical across every published version in 0.
|
|
17
|
+
* (byte-identical across every published version in 0.87.0 → 1.1.0:
|
|
18
18
|
* state swap, session persistence, default-model persistence only when
|
|
19
19
|
* `options.persist` is set, thinking-level re-clamp, model_select emit
|
|
20
20
|
* with source "cycle")
|
|
@@ -30,9 +30,9 @@ import { getFavoritesStore, modelKey } from "./store.js";
|
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* pi's `Model<any>` — the exact type of `ModelCycleResult.model`
|
|
33
|
-
* (pi-coding-agent 0.
|
|
33
|
+
* (pi-coding-agent 0.87–1.1; the field is unchanged across that span).
|
|
34
34
|
* Derived here instead of importing `Model` from @earendil-works/pi-ai,
|
|
35
|
-
* whose index.d.ts (0.
|
|
35
|
+
* whose index.d.ts (0.87 through 1.1.0 alike) re-exports it via an
|
|
36
36
|
* extensioned `"./types.ts"` specifier that not every TS resolver substitutes
|
|
37
37
|
* to `types.d.ts` (tsc 5.9 bundler does; other tsserver builds don't).
|
|
38
38
|
*/
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* keeps loading and ctrl+p falls back to stock behavior. The prototype
|
|
23
23
|
* shape touched here (handleInput/updateList/filterModels and the instance
|
|
24
24
|
* fields below) is byte-identical across every published version in
|
|
25
|
-
* pi 0.
|
|
25
|
+
* pi 0.87.0 → 1.1.0.
|
|
26
26
|
*/
|
|
27
27
|
import {
|
|
28
28
|
ModelSelectorComponent,
|
|
@@ -116,7 +116,7 @@ let patched = false;
|
|
|
116
116
|
export function applyModelSelectorPatches(): boolean {
|
|
117
117
|
if (patched) return true;
|
|
118
118
|
// SAFETY: ModelSelectorComponent's members are TS-private (compile-time
|
|
119
|
-
// only); the structural view matches pi 0.
|
|
119
|
+
// only); the structural view matches pi 0.87–1.1's prototype shape
|
|
120
120
|
// (byte-identical across that span) and every touched method is
|
|
121
121
|
// existence-checked below before any patching happens.
|
|
122
122
|
const proto =
|
|
@@ -155,7 +155,7 @@ export function applyModelSelectorPatches(): boolean {
|
|
|
155
155
|
};
|
|
156
156
|
|
|
157
157
|
// ── 2. List rendering: hint row + bold bright yellow favorites ────────
|
|
158
|
-
// Replicates the built-in updateList layout (pi 0.
|
|
158
|
+
// Replicates the built-in updateList layout (pi 0.87–1.1: fixed-width cursor
|
|
159
159
|
// and ✓ current-marker columns, provider badge, `· default` badge, scroll
|
|
160
160
|
// indicator, empty/error states, refresh status, Model Name footer) with
|
|
161
161
|
// one change: favorited model ids render in the favorite style.
|
|
@@ -21,7 +21,7 @@ import type { KeyId } from "@earendil-works/pi-tui";
|
|
|
21
21
|
/**
|
|
22
22
|
* Stash hotkey.
|
|
23
23
|
*
|
|
24
|
-
* Compatibility rationale (verified against pi 0.
|
|
24
|
+
* Compatibility rationale (verified against pi 0.87.0–1.1.0 keybindings, live
|
|
25
25
|
* matchesKey probes and terminal/OS behavior):
|
|
26
26
|
* - pi: no default binding for ctrl+alt+<letter> (only ctrl+alt+] is taken);
|
|
27
27
|
* extension shortcuts dispatch first while the editor is focused
|
package/src/lib/model-config.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Types are derived from pi-coding-agent's own exports (ModelRegistry)
|
|
7
7
|
* rather than imported from @earendil-works/pi-ai: pi-ai's index.d.ts (0.87
|
|
8
|
-
* through 1.0
|
|
8
|
+
* through 1.1.0 alike) re-exports `Model`/`Api` via extensioned
|
|
9
9
|
* `./types.ts` specifiers, which tsc 5.9 bundler resolution substitutes to
|
|
10
10
|
* `.d.ts` but some tsserver builds do not. Deriving from ModelRegistry keeps
|
|
11
11
|
* every resolver in agreement with the exact type
|
package/src/lib/model-picker.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* The component is driven through a small ModelRuntime facade backed by
|
|
11
11
|
* ctx.modelRegistry (pi's extension-facing wrapper). SAFETY: verified
|
|
12
|
-
* against pi 0.
|
|
12
|
+
* against pi 0.87.0–1.1.0 dist (modes/interactive/components/model-selector.js +
|
|
13
13
|
* model-catalog-refresh.js — byte-identical across that span) — the
|
|
14
14
|
* component only calls getAvailableSnapshot, getModel, getError and refresh
|
|
15
15
|
* on modelRuntime, and ModelRegistry provides exactly those
|
|
@@ -42,7 +42,7 @@ function modelRuntimeFacade(ctx: ExtensionContext): ModelRuntime {
|
|
|
42
42
|
refresh: (options?: { signal?: AbortSignal }) =>
|
|
43
43
|
ctx.modelRegistry.refresh(options),
|
|
44
44
|
};
|
|
45
|
-
// SAFETY: the selector only touches the four members above (pi 0.
|
|
45
|
+
// SAFETY: the selector only touches the four members above (pi 0.87–1.1
|
|
46
46
|
// model-selector.js); everything else on ModelRuntime is never reached
|
|
47
47
|
// from this component.
|
|
48
48
|
return facade as unknown as ModelRuntime;
|