@andares/pi-toolkits 0.7.3 → 0.8.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 +13 -5
- package/README.zh-CN.md +13 -5
- package/package.json +7 -5
- package/src/features/ask/reasons.ts +2 -2
- package/src/features/autostart/index.ts +1 -1
- package/src/features/compact/index.ts +3 -3
- package/src/features/compact/prompt.ts +2 -2
- package/src/features/favorites/constants.ts +3 -3
- package/src/features/favorites/patch-cycle.ts +6 -6
- package/src/features/favorites/patch-selector.ts +4 -4
- package/src/features/stash/stash.ts +1 -1
- package/src/lib/model-config.ts +2 -2
- 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 `>=1.0.0 <1.12.0` — the four most recently released minor lines (1.0.x / 1.1.x / 1.2.x / 1.3.x) are supported best-effort, and the upper bound encodes the forward probe: on every host release we check up to **8 minor lines** beyond the newest one (now 1.4 … 1.11) and never claim past that cap. **Measured natural compatibility: 1.3.0** (the newest release at the time of writing — nothing newer exists to probe yet). A single command, `pnpm check:compat`, derives that version set from the registry and runs, per version, in a sandbox under the system temp dir with the whole `@earendil-works/*` family pinned to the version under test: install → `tsc --noEmit` → full test suite → keybinding audit → hash-compare of the host `dist` files this package patches or mirrors. Results over 1.0.0 → 1.3.0 (all 8 published versions): typecheck, 289 tests and the keybinding audit pass on every one; the tracked host files drift only in `core/agent-session.js` (1.3.0 changed the tool-restore path; `cycleModel` untouched), `core/keybindings.js` and `core/compaction/utils.js` (both changed in 1.2.0, table semantics for our keys unchanged), and `extensions/types.d.ts` (additive) — `ModelSelectorComponent`, `core/compaction/compaction.js` and `core/usage-totals.js` are byte-identical across the whole window. Smoke-loading on real pi 1.3.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
|
|
|
@@ -196,7 +196,7 @@ pi's `/compact` and auto-compact summarize the context **with the current sessio
|
|
|
196
196
|
| auto-compact threshold reached | summarized by the compaction model |
|
|
197
197
|
| context overflow recovery | summarized by the compaction model, retry behavior unchanged |
|
|
198
198
|
|
|
199
|
-
**Parts that are identical to pi's built-in behavior after takeover** (the built-in implementation is mirrored verbatim — copied from 0.87.1, byte-identical across every published version of the supported window, 0.
|
|
199
|
+
**Parts that are identical to pi's built-in behavior after takeover** (the built-in implementation is mirrored verbatim — copied from 0.87.1, byte-identical across every published version of the supported window, 1.0.0 → 1.3.0 — and only the executing model changes; the conversation serializer itself is imported from the host, so it follows whatever the running host does, e.g. 1.2.0 stops feeding assistant thinking back into the summarization request):
|
|
200
200
|
|
|
201
201
|
- **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
|
|
202
202
|
- **Split behavior** — the `keepRecentTokens` retention policy, and `firstKeptEntryId` / `tokensBefore` passed back unchanged
|
|
@@ -263,7 +263,7 @@ No file = feature disabled, zero overhead, silently skipped.
|
|
|
263
263
|
|
|
264
264
|
**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.
|
|
265
265
|
|
|
266
|
-
> **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`; `sendUserMessage` and `_tryExecuteExtensionCommand` are byte-identical across 0.
|
|
266
|
+
> **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`; `sendUserMessage` and `_tryExecuteExtensionCommand` are byte-identical across 1.0.0–1.3.0, 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).
|
|
267
267
|
|
|
268
268
|
---
|
|
269
269
|
|
|
@@ -277,6 +277,9 @@ No file = feature disabled, zero overhead, silently skipped.
|
|
|
277
277
|
pnpm install # install deps
|
|
278
278
|
pnpm typecheck # tsc --noEmit
|
|
279
279
|
pnpm test # vitest (all feature unit tests)
|
|
280
|
+
|
|
281
|
+
pnpm check:keybindings # audit this plugin's keys against the host's own dispatch table
|
|
282
|
+
pnpm check:compat # verify the declared pi range: last 4 minor lines + 8-line forward probe
|
|
280
283
|
```
|
|
281
284
|
|
|
282
285
|
### Project structure
|
|
@@ -310,9 +313,13 @@ pnpm release patch # 0.1.2 → 0.1.3
|
|
|
310
313
|
pnpm release minor # 0.1.2 → 0.2.0 (patch zeroed)
|
|
311
314
|
pnpm release major # 0.1.2 → 1.0.0 (minor + patch zeroed)
|
|
312
315
|
pnpm release patch --dry-run # preview without changing anything
|
|
316
|
+
pnpm release:github # create/verify the GitHub Release for the current version
|
|
317
|
+
pnpm release:github --audit # list npm versions vs GitHub Releases vs remote tags
|
|
313
318
|
```
|
|
314
319
|
|
|
315
|
-
`release` requires exactly one of `major | minor | patch`; incrementing a higher level zeroes the lower ones. The chain is: **the working tree must be clean (any uncommitted change aborts before anything happens, guaranteeing tag content == published content)** → `typecheck + test` gate → version bump → git commit + `vX.Y.Z` tag (self-check that tag == HEAD and the tree is clean) → `pnpm publish` (with `prepublishOnly` as a second gate) → push
|
|
320
|
+
`release` requires exactly one of `major | minor | patch`; incrementing a higher level zeroes the lower ones. The chain is: **the working tree must be clean (any uncommitted change aborts before anything happens, guaranteeing tag content == published content)** → `typecheck + test` gate → version bump → git commit + `vX.Y.Z` tag (self-check that tag == HEAD and the tree is clean) → `pnpm publish` (with `prepublishOnly` as a second gate) → push the current branch → push the tag if the remote lacks it, verify the remote tag hash (with bounded retries, because GitHub's ref view lags right after a push) and create the GitHub Release.
|
|
321
|
+
|
|
322
|
+
If that last step is skipped (no `GITHUB_TOKEN`, a failed push, an HTTP error), the version would otherwise stay Release-less forever: the next release's auto-generated notes diff against the previous *published* Release, so the missing version's commits get folded into the next one and GitHub drifts away from npm. `pnpm release:github` is the resume path — it never bumps the version and never touches npm; `--audit` is the drift detector (`--allow-gaps` downgrades a historical gap to a warning).
|
|
316
323
|
|
|
317
324
|
---
|
|
318
325
|
|
|
@@ -328,6 +335,7 @@ PRs and issues welcome. A few conventions:
|
|
|
328
335
|
- **Built-in patches** (favorites) must stay **version-guarded and idempotent** — verify the target prototype members exist before patching, guard against double-apply, degrade with a `console.warn` instead of breaking the extension
|
|
329
336
|
- **Built-in prompt sync** (compact) — the summarization prompts in `src/features/compact/prompt.ts` are copied verbatim from pi's built-in compaction; when upgrading the pi dependency, diff `dist/core/compaction/compaction.js` (and `utils.js`) and update the strings + assembly helpers to match, keeping takeover output byte-compatible with stock
|
|
330
337
|
- **Keybindings** — before picking a new shortcut, check pi defaults + reserved keys, terminal control chars, and OS/terminal-emulator grabs; prefer `ctrl+alt+<letter>` for cross-platform safety. Do not stop at "it works on my machine in the main screen": in `fullscreen` mode (pi's default since 1.0) the alt-screen layer consumes `tui.altScreen.*` **before** dialogs see the key, and on Windows/WSL several of those bindings differ from the Linux defaults. Run `pnpm check:keybindings [candidate...]` (and `pnpm check:keybindings --all` after a pi upgrade) — it probes the installed host's resolved keybinding table with the host's own `matchesKey`. A key free in the host table can still be taken at the machine layer: Windows Terminal binds `ctrl+v` (paste) and `ctrl+shift+f` (find), and third-party Windows tools commonly grab `ctrl+alt+<letter>` (a screenshot tool once took `ctrl+alt+f`) — so try the key for real on the target machine before shipping it.
|
|
338
|
+
- **Host compatibility** — the peer range is a measured statement, not a wish: the four most recently released pi minor lines are supported best-effort, the upper bound encodes the forward probe cap (newest line + 8 minor lines), and the README annotation must name the highest version actually verified. Re-run `pnpm check:compat` whenever the host dependency moves and read its verdict block (it fails if the declared range drifts from the policy). See the pi 宿主兼容 section of AGENTS.md; keybinding collisions found during an upgrade are reported to the maintainer for a decision, never re-keyed silently.
|
|
331
339
|
- **Quality gate** — `pnpm typecheck && pnpm test` must pass before submitting
|
|
332
340
|
|
|
333
341
|
---
|
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 `>=1.0.0 <1.12.0` —— 最近 4 个中版本线(1.0.x / 1.1.x / 1.2.x / 1.3.x)尽力支持,上界编码「向后探针」的硬上限:宿主每发一版,我们最多向后查 **8 条中版本线**(当前 1.4 … 1.11),再晚不宣称。**实测自然兼容最高 1.3.0**(写此文时的最新版本,更新的还没发布、无物可探)。一条命令 `pnpm check:compat` 从 registry 推导目标集合,逐版本在系统临时目录沙箱中(把整个 `@earendil-works/*` 家族钉在待测版本)跑:安装 → `tsc --noEmit` → 全量测试 → 键位审计 → 对 patch/mirror 的宿主 `dist` 文件做哈希比对。1.0.0 → 1.3.0 全部 8 个已发布版本:typecheck、289 个测试、键位审计全绿;被跟踪的宿主文件仅在 `core/agent-session.js`(1.3.0 改了 tool-restore 路径,`cycleModel` 未动)、`core/keybindings.js` 与 `core/compaction/utils.js`(二者都是 1.2.0 变的,我们按键的解析结果不变)、`extensions/types.d.ts`(纯增量)上有差异 —— `ModelSelectorComponent`、`core/compaction/compaction.js` 与 `core/usage-totals.js` 在窗口内字节级不变。真实 pi 1.3.0 冒烟加载无警告。注:pi ≥ 0.99 的宿主要求 `@earendil-works/pi-tui` 声明为 peerDependencies `"*"`(由宿主提供),本包已按要求声明。
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
@@ -196,7 +196,7 @@ pi 的 `/compact` 与 auto-compact 默认**用当前会话模型**做上下文
|
|
|
196
196
|
| auto-compact 阈值触发 | 压缩模型总结 |
|
|
197
197
|
| context overflow 恢复 | 压缩模型总结,重试行为不变 |
|
|
198
198
|
|
|
199
|
-
**接管后与 pi 内建行为完全一致的部分**(逐字同步 pi 内建实现,复制自 0.87.1、在支持区间内全部已发布版本(0.
|
|
199
|
+
**接管后与 pi 内建行为完全一致的部分**(逐字同步 pi 内建实现,复制自 0.87.1、在支持区间内全部已发布版本(1.0.0 → 1.3.0)字节级不变,只换执行模型;对话序列化函数(`serializeConversation`)是直接从宿主导入的,因此跟随宿主行为 —— 例如 1.2.0 起不再把 assistant thinking 回填进摘要请求):
|
|
200
200
|
|
|
201
201
|
- **摘要格式** —— Goal / Progress / Key Decisions 结构化 checkpoint;已有摘要时用迭代更新版 prompt,信息延续不丢
|
|
202
202
|
- **切分行为** —— 保留最近 `keepRecentTokens` 的策略、`firstKeptEntryId` / `tokensBefore` 原样回传,不动
|
|
@@ -263,7 +263,7 @@ run = [
|
|
|
263
263
|
|
|
264
264
|
**关键约束:只支持扩展命令**。`/add-dir`(pi-add-dir)、`/cd`(pi-cd)等 `registerCommand` 注册的命令可以;内置命令(`/compact`、`/reload`、`/resume`…)在 TUI 层分发,扩展层触发不了;skill 命令(`/skill:name`)是展开机制而非执行机制。依赖的目标扩展(如 pi-add-dir)需要先安装。
|
|
265
265
|
|
|
266
|
-
> **实现说明**:执行用 `sendUserMessage(cmd, { expandPromptTemplates: true })` —— 该选项把 `/cmd args` 路由到命令分发而不是模型 prompt 路径(包装层默认 `false`,`sendUserMessage` 与 `_tryExecuteExtensionCommand` 在 0.
|
|
266
|
+
> **实现说明**:执行用 `sendUserMessage(cmd, { expandPromptTemplates: true })` —— 该选项把 `/cmd args` 路由到命令分发而不是模型 prompt 路径(包装层默认 `false`,`sendUserMessage` 与 `_tryExecuteExtensionCommand` 在 1.0.0–1.3.0 全区间字节级一致,见 AGENTS.md 宿主兼容纪律)。预校验用 `pi.getCommands()`(只认 `source: "extension"`)。依赖 `smol-toml`(零依赖、~10KB、TOML 1.0)。
|
|
267
267
|
|
|
268
268
|
---
|
|
269
269
|
|
|
@@ -277,6 +277,9 @@ run = [
|
|
|
277
277
|
pnpm install # 安装依赖
|
|
278
278
|
pnpm typecheck # tsc --noEmit
|
|
279
279
|
pnpm test # vitest(全部功能单元测试)
|
|
280
|
+
|
|
281
|
+
pnpm check:keybindings # 用宿主自己的分发表审计本插件的按键
|
|
282
|
+
pnpm check:compat # 校验声明的 pi 区间:最近 4 条中版本线 + 向后 8 条线探针
|
|
280
283
|
```
|
|
281
284
|
|
|
282
285
|
### 项目结构
|
|
@@ -309,9 +312,13 @@ pnpm release patch # 0.1.2 → 0.1.3
|
|
|
309
312
|
pnpm release minor # 0.1.2 → 0.2.0 (patch 清零)
|
|
310
313
|
pnpm release major # 0.1.2 → 1.0.0 (minor + patch 清零)
|
|
311
314
|
pnpm release patch --dry-run # 预览,不做任何改动
|
|
315
|
+
pnpm release:github # 为当前版本创建/校验 GitHub Release(幂等)
|
|
316
|
+
pnpm release:github --audit # 列出 npm 版本 vs GitHub Release vs 远端 tag
|
|
312
317
|
```
|
|
313
318
|
|
|
314
|
-
`release` 要求且仅要求 `major | minor | patch` 之一;上级递增清零下级。执行链:**工作区必须干净(有未提交变更直接中止,保证 tag 内容 == 发布内容)** → `typecheck + test` 门禁 → 改版本 → git commit + `vX.Y.Z` tag(自检 tag==HEAD 且工作区干净) → `pnpm publish`(`prepublishOnly` 二次门禁) →
|
|
319
|
+
`release` 要求且仅要求 `major | minor | patch` 之一;上级递增清零下级。执行链:**工作区必须干净(有未提交变更直接中止,保证 tag 内容 == 发布内容)** → `typecheck + test` 门禁 → 改版本 → git commit + `vX.Y.Z` tag(自检 tag==HEAD 且工作区干净) → `pnpm publish`(`prepublishOnly` 二次门禁) → 推当前分支 → tag 远端没有就推、有就校验哈希一致(带有限次重试——刚推完 GitHub 的 ref 可见性可能滞后)→ 创建 GitHub Release。
|
|
320
|
+
|
|
321
|
+
若最后一步被跳过(无 `GITHUB_TOKEN`、push 失败、HTTP 报错),该版本会永远没有 Release:下一版自动生成的 release notes 是**对着上一个已发布的 Release** 算 diff 的,于是缺的那版提交被吞进下一版,GitHub 的版本线就与 npm 对不上。`pnpm release:github` 就是补建/续跑入口——不动版本号、不碰 npm;`--audit` 是差集探测器(`--allow-gaps` 把历史缺口降级为警告)。
|
|
315
322
|
|
|
316
323
|
---
|
|
317
324
|
|
|
@@ -327,6 +334,7 @@ pnpm release patch --dry-run # 预览,不做任何改动
|
|
|
327
334
|
- **内建 patch**(favorites)必须保持**版本守卫 + 幂等** —— 打 patch 前先确认目标原型成员存在,防止重复应用,失败时用 `console.warn` 降级而不是把扩展搞挂
|
|
328
335
|
- **内建提示词同步**(compact) —— `src/features/compact/prompt.ts` 里的总结 prompt 逐字抄自 pi 内建压缩;升级 pi 依赖时 diff `dist/core/compaction/compaction.js`(及 `utils.js`),同步字符串与组装辅助函数,保持接管输出与内建字节级一致
|
|
329
336
|
- **键位** —— 定新快捷键前先查 pi 默认键位 + 保留键、终端控制字符、OS/终端模拟器占用;跨平台安全优先选 `ctrl+alt+<字母>`。**不得只验证「主屏下我这台机器能用」**:自 pi 1.0 起默认 `fullscreen`,alt-screen 层在对话框看到按键**之前**就消费 `tui.altScreen.*`,且 Windows/WSL 上多个绑定与 Linux 默认值不同。用 `pnpm check:keybindings [候选键...]` 核查(pi 升级后跑 `pnpm check:keybindings --all`),它用宿主自己的 `matchesKey` 探测已安装宿主的**已解析**键位表。**宿主表空闲 ≠ 机器层空闲**:Windows Terminal 默认占 `ctrl+v`(粘贴)与 `ctrl+shift+f`(查找),第三方 Windows 工具常绑 `ctrl+alt+<字母>`(截图工具占过 `ctrl+alt+f`)——定键后必须在真机试按,确认按键真的到得了应用。
|
|
337
|
+
- **宿主兼容** —— peer 区间是实测结论而非愿望:最近 4 个已发布中版本线尽力支持,上界编码「向后探 8 条中版本线」的上限,README 必须标注**实测支持到的最高版本**。宿主依赖一动就重跑 `pnpm check:compat`,读它的 verdict 段(区间与策略不一致会直接判失败)。详见 AGENTS.md「pi 宿主兼容」;升级中发现的键位冲突**上报崔总决策**,不得顺手换键。
|
|
330
338
|
- **质量门禁** —— 提交前必须通过 `pnpm typecheck && pnpm test`
|
|
331
339
|
|
|
332
340
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andares/pi-toolkits",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
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": ">=1.0.0 <1.12.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.
|
|
40
|
-
"@earendil-works/pi-coding-agent": "^1.
|
|
41
|
-
"@earendil-works/pi-tui": "^1.
|
|
39
|
+
"@earendil-works/pi-ai": "^1.3.0",
|
|
40
|
+
"@earendil-works/pi-coding-agent": "^1.3.0",
|
|
41
|
+
"@earendil-works/pi-tui": "^1.3.0",
|
|
42
42
|
"@types/node": "^26.6.2",
|
|
43
43
|
"typescript": "^5.6.0",
|
|
44
44
|
"vitest": "^4.1.10"
|
|
@@ -52,6 +52,8 @@
|
|
|
52
52
|
"typecheck": "tsc --noEmit",
|
|
53
53
|
"test": "vitest run",
|
|
54
54
|
"check:keybindings": "node ./scripts/check-keybindings.mjs",
|
|
55
|
+
"check:compat": "node ./scripts/check-compat.mjs",
|
|
56
|
+
"release:github": "node ./scripts/release-github.mjs",
|
|
55
57
|
"release": "node ./scripts/publish.mjs",
|
|
56
58
|
"tag-current": "node ./scripts/tag-current.mjs"
|
|
57
59
|
}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* ask feature — actionable rejection messages.
|
|
3
3
|
*
|
|
4
4
|
* The `tool_call` hook's `reason` is delivered to the model as the tool result
|
|
5
|
-
* (verified against pi 1.
|
|
5
|
+
* (verified against pi 1.3.0: `extensions/runner.js` returns the `{block,
|
|
6
6
|
* reason}` result unchanged and pi-agent-core's `agent-loop.js` turns it into
|
|
7
|
-
* `createErrorToolResult(reason)`; both paths are byte-identical to 1.
|
|
7
|
+
* `createErrorToolResult(reason)`; both paths are byte-identical to 1.2.0), so it
|
|
8
8
|
* is the best place to name the nearest allowed alternative and stop the model
|
|
9
9
|
* from retrying variants of a blocked command.
|
|
10
10
|
*/
|
|
@@ -17,7 +17,7 @@
|
|
|
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
19
|
* (each byte-identical across every published version of the supported
|
|
20
|
-
* window, 0.
|
|
20
|
+
* window, 1.0.0 → 1.3.0; see AGENTS.md host-compat
|
|
21
21
|
* discipline for the version matrix).
|
|
22
22
|
*
|
|
23
23
|
* Only extension commands can run this way. Built-in commands (/compact,
|
|
@@ -12,7 +12,7 @@
|
|
|
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
14
|
* 0.87.1, byte-identical across every published version of the supported
|
|
15
|
-
* window, 0.
|
|
15
|
+
* window, 1.0.0 → 1.3.0) — only the executing model differs. The one
|
|
16
16
|
* exception is `serializeConversation`, which is imported from the host
|
|
17
17
|
* instead of mirrored, so it tracks whatever the running host does
|
|
18
18
|
* (1.2.0 stopped feeding assistant thinking into the request).
|
|
@@ -119,7 +119,7 @@ async function completeSummary(
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
|
-
* pi's output-budget formula (compaction.js, 0.87.1 → 1.
|
|
122
|
+
* pi's output-budget formula (compaction.js, 0.87.1 → 1.3.0 unchanged): a
|
|
123
123
|
* fraction of reserveTokens clamped by the model's own output cap.
|
|
124
124
|
*/
|
|
125
125
|
function summarizationBudget(
|
|
@@ -136,7 +136,7 @@ function summarizationBudget(
|
|
|
136
136
|
/**
|
|
137
137
|
* Run the full compaction summarization with the configured model,
|
|
138
138
|
* replicating pi's compact() (0.87.1, byte-identical across the supported
|
|
139
|
-
* 0.
|
|
139
|
+
* 1.0.0 → 1.3.0 window):
|
|
140
140
|
* history summary (first-connection or iterative-update prompt, custom
|
|
141
141
|
* focus appended), plus a separate turn-prefix checkpoint when the cut point
|
|
142
142
|
* splits a turn, merged into one summary with the file-list tail. Returns
|
|
@@ -6,7 +6,7 @@
|
|
|
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
8
|
* Verified byte-identical against every published version of the supported
|
|
9
|
-
* window (0.
|
|
9
|
+
* window (1.0.0 → 1.3.0): dist/core/compaction/compaction.js and
|
|
10
10
|
* core/usage-totals.js are unchanged files across that span, and the only
|
|
11
11
|
* utils.js change (1.2.0 dropping assistant thinking from
|
|
12
12
|
* serializeConversation) does not touch the strings mirrored here — that
|
|
@@ -203,7 +203,7 @@ export function formatFileOperations(
|
|
|
203
203
|
/**
|
|
204
204
|
* Combine two provider usage records field-wise (pi 0.87.1 compaction.js
|
|
205
205
|
* combineUsage, moved verbatim to core/usage-totals.js in 0.99.0 and
|
|
206
|
-
* unchanged through 1.
|
|
206
|
+
* unchanged through 1.3.0): used when
|
|
207
207
|
* a split turn produces two summarization calls.
|
|
208
208
|
*/
|
|
209
209
|
export function combineUsage<T extends UsageLike>(first: T, second: T): T {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* keybinding conflicts arise.
|
|
10
10
|
*
|
|
11
11
|
* Verified against every published version of the supported window
|
|
12
|
-
* (0.
|
|
12
|
+
* (1.0.0 → 1.3.0) keybinding
|
|
13
13
|
* tables + pi-tui input dispatch on WSL2 + Windows Terminal; re-run
|
|
14
14
|
* `pnpm check:keybindings` after every host upgrade before trusting this.
|
|
15
15
|
*/
|
|
@@ -30,11 +30,11 @@ export const FAVORITES_FILE = "pi-toolkits-favorites.json";
|
|
|
30
30
|
* Windows/WSL `tui.altScreen.search` resolves to ctrl+f, and
|
|
31
31
|
* `TuiAltScreen.handleViewportInput()` checks it before
|
|
32
32
|
* `shouldDeferViewportInputToOverlay()`, so the keystroke opens transcript
|
|
33
|
-
* search and the selector never sees it (verified in pi-tui 1.
|
|
33
|
+
* search and the selector never sees it (verified in pi-tui 1.3.0
|
|
34
34
|
* `dist/tui-alt-screen.js`: the search check is the first key branch and
|
|
35
35
|
* returns `{ consume: true }` unconditionally).
|
|
36
36
|
*
|
|
37
|
-
* Why ctrl+alt+f was discarded: clean at the pi layer across 0
|
|
37
|
+
* Why ctrl+alt+f was discarded: clean at the pi layer across 1.0–1.3 (only
|
|
38
38
|
* ctrl+alt+] is taken from that family) and byte-distinguishable without
|
|
39
39
|
* kitty — but grabbed at the OS/app layer on the author's machine by a
|
|
40
40
|
* Windows screenshot tool, so it never reached the terminal. Lesson: a key
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* model available" feedback); otherwise jump to it
|
|
16
16
|
* - the apply logic mirrors pi's _cycleScopedModel/_cycleAvailableModel
|
|
17
17
|
* (byte-identical across every published version in the supported window
|
|
18
|
-
* 0.
|
|
18
|
+
* 1.0.0 → 1.3.0:
|
|
19
19
|
* state swap, session persistence, default-model persistence only when
|
|
20
20
|
* `options.persist` is set, thinking-level re-clamp, model_select emit
|
|
21
21
|
* with source "cycle")
|
|
@@ -31,9 +31,9 @@ import { getFavoritesStore, modelKey } from "./store.js";
|
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* pi's `Model<any>` — the exact type of `ModelCycleResult.model`
|
|
34
|
-
* (pi-coding-agent 0
|
|
34
|
+
* (pi-coding-agent 1.0–1.3; the field is unchanged across that span).
|
|
35
35
|
* Derived here instead of importing `Model` from @earendil-works/pi-ai,
|
|
36
|
-
* whose index.d.ts (0
|
|
36
|
+
* whose index.d.ts (1.0 through 1.3.0 alike) re-exports it via an
|
|
37
37
|
* extensioned `"./types.ts"` specifier that not every TS resolver substitutes
|
|
38
38
|
* to `types.d.ts` (tsc 5.9 bundler does; other tsserver builds don't).
|
|
39
39
|
*/
|
|
@@ -57,7 +57,7 @@ interface CycleSessionInternals {
|
|
|
57
57
|
setDefaultModelAndProvider(provider: string, id: string): void;
|
|
58
58
|
};
|
|
59
59
|
/**
|
|
60
|
-
* pi 0
|
|
60
|
+
* pi 1.0–1.3: keeps a persisted default usable when cycling inside a
|
|
61
61
|
* non-empty --models scope.
|
|
62
62
|
*/
|
|
63
63
|
_addPersistedDefaultToNonEmptyScope(model: unknown): void;
|
|
@@ -140,7 +140,7 @@ export function applyCyclePatch(): boolean {
|
|
|
140
140
|
return original.call(this, direction, options);
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
// Same source and availability filtering as pi's stock cycling (0
|
|
143
|
+
// Same source and availability filtering as pi's stock cycling (1.0–1.3).
|
|
144
144
|
const scoped = this._scopedModels.length > 0;
|
|
145
145
|
let candidates: CycleCandidate[];
|
|
146
146
|
if (scoped) {
|
|
@@ -185,7 +185,7 @@ export function applyCyclePatch(): boolean {
|
|
|
185
185
|
: this._getThinkingLevelForModelSwitch();
|
|
186
186
|
this.agent.state.model = next.model;
|
|
187
187
|
this.sessionManager.appendModelChange(next.model.provider, next.model.id);
|
|
188
|
-
// pi 0
|
|
188
|
+
// pi 1.0–1.3: only persist the default model when the caller asked for it.
|
|
189
189
|
if (options.persist) {
|
|
190
190
|
this.settingsManager.setDefaultModelAndProvider(
|
|
191
191
|
next.model.provider,
|
|
@@ -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 1.0.0 → 1.3.0 (and 0.99.0 → 1.2.0 before the floor moved).
|
|
26
26
|
*/
|
|
27
27
|
import {
|
|
28
28
|
ModelSelectorComponent,
|
|
@@ -61,7 +61,7 @@ interface SelectorPatchTarget {
|
|
|
61
61
|
handleInput(keyData: string): void;
|
|
62
62
|
updateList(): void;
|
|
63
63
|
filterModels(query: string): void;
|
|
64
|
-
/** pi 0
|
|
64
|
+
/** pi 1.0–1.3: default-model badge source. */
|
|
65
65
|
isDefaultModel(model: ModelRef): boolean;
|
|
66
66
|
listContainer: ListContainerLike;
|
|
67
67
|
searchInput: SearchInputLike;
|
|
@@ -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 1.0–1.3'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 1.0–1.3: 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 1.0.0–1.3.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
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* (review, compact-model — favorites keeps its own store-local key logic).
|
|
5
5
|
*
|
|
6
6
|
* Types are derived from pi-coding-agent's own exports (ModelRegistry)
|
|
7
|
-
* rather than imported from @earendil-works/pi-ai: pi-ai's index.d.ts (0.
|
|
8
|
-
* through 1.
|
|
7
|
+
* rather than imported from @earendil-works/pi-ai: pi-ai's index.d.ts (1.0.0
|
|
8
|
+
* through 1.3.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 1.0.0–1.3.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 1.0–1.3
|
|
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;
|