@gfgghgftgffg/rpiv-todo-lean 0.1.8 → 0.1.10

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/MAINTENANCE.md CHANGED
@@ -14,9 +14,9 @@
14
14
 
15
15
  ## 锁定的上游版本
16
16
 
17
- - `@juicesharp/rpiv-todo@2.13.9`(精确固定;`dependencies`;此前为 2.13.8)。
18
- - `@juicesharp/rpiv-i18n@2.13.9`(精确固定;上游仍为可选 peer,保留安装以维持本地化 UI)。
19
- - 上游 2.13.9 自带传递依赖 `@juicesharp/rpiv-config@^2.13.9`(此前为 ^2.13.8;由 npm 解析,不显式固定)。
17
+ - `@juicesharp/rpiv-todo@2.15.0`(精确固定;`dependencies`;此前为 2.13.9)。
18
+ - `@juicesharp/rpiv-i18n@2.15.0`(精确固定;上游仍为可选 peer,保留安装以维持本地化 UI)。
19
+ - 上游 2.15.0 自带传递依赖 `@juicesharp/rpiv-config@^2.15.0`(此前为 ^2.13.9;由 npm 解析,不显式固定)。
20
20
  - Pi 宿主 peer:`@earendil-works/pi-ai`、`@earendil-works/pi-coding-agent`、`@earendil-works/pi-tui`
21
21
  均为 `>=1.1.0`,`typebox` 为 `*`。
22
22
  - 开发/测试依赖:Pi 1.1.0、typebox 1.3.36、jiti 2.7.0、TypeScript 7.0.2
@@ -154,6 +154,73 @@
154
154
  重审未提供的引擎源码。六个 action、默认值与内部 overlay/store 依赖由现有真实集成验证。
155
155
  - 本次无门面改动,不加重复回归。check 运行现有全部断言并更新本仓字符代理,结果以其输出为准。
156
156
 
157
+ ## 本次审查:2.13.9 → 2.15.0
158
+
159
+ - 精确源码来自 sources.json:`54df50eea935fc9753edc300d5f23c5e28d906d7` →
160
+ `ce6d3530410812ca504ec294995581a52170f9e1`,同时包含相关 i18n;远端
161
+ `46dbdfd78ab631bbf3ce41c2618bb173a5ec2725` 未采用。三个 lean 作者 HEAD 均未变,
162
+ 没有本次作者新实现可复用,既往复用决定保留。web 0.44.0、subagents 0.22.0 不变,
163
+ 库存没有其 before/after,不声称审查未发布远端源码。
164
+ - 对比 todo 两版 CHANGELOG、package.json、index.ts、todo.ts、tool/types.ts、state/state-reducer.ts、
165
+ tool/response-envelope.ts、state/replay.ts、view/format.ts、todo-overlay.ts、state/store.ts、config.ts、
166
+ state/i18n-bridge.ts;阅读新增 tool/normalize-params.ts。相关 i18n 的 CHANGELOG 新节为空,
167
+ package.json 更新版本及 config 范围;对比 index.ts 与 loader.ts,无相关接口变化。
168
+ rpiv-config 本体不在库存,不声称审查其实现,实际安装由 check 验证。
169
+ - 工具仍仅 todo,六个 action 和 required=[action] 不变。新增可选 tasks 数组,项必填 subject,
170
+ 可选 description/activeForm/blockedBy/owner/metadata。顶层仍保留原字段;create 默认 pending、
171
+ list 默认不含 deleted、clear 重置 nextId=1 均不变。复制原生 schema 后压缩,保留 tasks 的完整嵌套结构
172
+ 和名为 description 的实际输入字段,不再原地改动上游 schema。字符串 enum 的 type 与无限制 metadata
173
+ 的空 patternProperties 等价冗余项被删除;其余字段、枚举、required、类型与约束保留。
174
+ - create 接受 subject 或非空 tasks 二选一;批量五个 per-task 字段只能放在项内,先完整验证再提交,
175
+ 禁止引用同批新 ID,允许引用已有未删除任务。原单个创建仍可用。Reducer create op 从 taskId 改为
176
+ taskIds 数组,本包装不读该 op;content 每项一行 Created,details 仍为全量 tasks/nextId 快照,
177
+ 成功整批追加一次 rpiv-todo-state,失败不追加,错误在 details.error 和文本中(不新增 isError)。
178
+ - 上游首次注册 prepareArguments,解码字符串 tasks 数组和字符串对象项,非法 JSON 保留原值供校验报错。
179
+ 本仓已有 hook-first 委派,之后才做旧 create/update 推断;本次不扩大 action 推断,批量须显式 action。
180
+ 常驻描述明确 subject 或 tasks[],单行指南保留原有多步任务、单个 in_progress、及时完成、变更字段、
181
+ 筛选、清空和依赖增删规则;批量原子性与各项约束在 README 说明并由上游验证。
182
+ 不扩大 action 推断,不引入作者旧版 withHostPlan,也不复制 reducer 或归一化实现。
183
+ - view/format 在无 action 时不显示 undefined,批量调用卡显示数量;renderResult 检测 details.error 或宿主
184
+ context.isError,以 ✗ 和首行错误取代成功状态。模型收到的错误 envelope 不变,由已有 render hook 委派承接。
185
+ - replay 现在检查每项的安全整数 id、subject/status、可选文本、blockedBy 与 metadata 形状及安全整数 nextId;
186
+ 损坏快照整条跳过,保留最近有效快照;自定义条目优先、历史 toolResult 回放和快照浅拷贝规则不变。
187
+ RPC 的 session_start/compact/tree 均调用同一 replay,因此承接修复。
188
+ - index.ts、todo-overlay.ts、state/store.ts、config.ts 与 bridge 的已审查接口不变。依赖的普通 private
189
+ 字段/getSnapshot、公开方法、会话函数、事件/命令/快捷键继续成立,stale guard 与异步命令等待保留。
190
+ - tests/upstream-215-regression.test.mjs 使用真实 facade 覆盖完整批量字段、双重 JSON 归一化、批量
191
+ 成功/原子拒绝/已有依赖、一次持久化、RPC 生命周期损坏快照回放与 render 委派。新增 schema 等价
192
+ 校验,比较有效及无效输入在原生与压缩 schema 下的结果,并确认原生 schema 不被改动。
193
+ - 维护者已明确批准更新 wrapper.test.mjs 中两处过时契约期望:当前描述与新增 tasks 字段。
194
+ 所有原行为断言和 metadata<=1200 上限保持不变;不隐藏新参数、不按测试切换行为。
195
+ fixture 使用 jiti moduleCache=true 共享真实状态图,避免 reset/read 另一份 store。
196
+ - 固定 check 重新捕获契约、字符代理并实际执行类型/测试、生产安装和审计,结果以检查日志为准。
197
+ 字符代理 ceil(chars/4) 非计费 token;交互式终端与三平台验收仍由后续流程分别确认。
198
+
199
+ ## 本次 lean-only 审查:作者同步 2.15.0
200
+
201
+ - 精确作者 before/after:`f1e3fc7bcde2644a89803fa6a3a256fb7422d89f` →
202
+ `664409f1e91e7eb8375cb0e473321a7075f20de1`,以 sources.json 为准。完整比较两版 index.ts、
203
+ package.json、中英文 README、wrapper 和 rpc-sessions 测试,并阅读本地入口与当前用法。
204
+ - 入口唯一差异为指南增加 `or a tasks[] batch`。不是新 schema/action/默认值或执行逻辑;本地描述
205
+ 已有 `create subject or tasks[]`,完整批量 schema、hook-first 归一化及原子执行已由前次适配承接。
206
+ 不重复增加常驻文本;中英文 README 保留完整批量约束,并明确已有的单个 in_progress/及时完成指导。
207
+ - 作者 package.json 包装 2.13.12 → 2.15.0,todo/i18n pins 2.13.9 → 2.15.0;本仓已固定 2.15.0。
208
+ peer/dev 不变,不复制作者包装版本、锁文件或开发依赖。README 更新依赖、测量表及 Pi 1.3 → 1.4,
209
+ 但 Versions 中包装版本和中文依赖仍残留旧值,package description 也保留旧代理;不复用这些数字。
210
+ 本仓版本由固定脚本管理,字符代理由 check 重测。
211
+ - 作者 wrapper 测试新增 tasks 字段期望,并把 metadata 上限 1200 放宽到 1500;本仓已有完整 tasks
212
+ schema/真实执行回归,不复制重复期望,不放宽 1200 上限。rpc-sessions 两版完全一致。
213
+ - 历史未采用功能没有变化:bare id 推断、较强逐步 workflow 指令及 withHostPlan 仍不引入。
214
+ withHostPlan 仍在 await 后读取 ctx.mode/sid,未增加 stale 防护;本地保留已有 stale guards、异步命令
215
+ 等待、逐会话覆盖层及原始响应,不替换为作者入口或原地修改上游 schema。
216
+ - 六个 action、完整字段、required=[action]、create=pending、list 默认不含 deleted、clear 重置 nextId=1
217
+ 不变;没有新的本地行为适配。依赖的 overlay/store/replay 接口由已有固定依赖真实集成回归验证。
218
+ - 本次没有引擎 before/after/CHANGELOG,todo/i18n 稳定版仍为 2.15.0 /
219
+ `ce6d3530410812ca504ec294995581a52170f9e1`;远端 `46dbdfd78ab631bbf3ce41c2618bb173a5ec2725`
220
+ 未采用,不声称重审该远端源码。subagents 引擎 0.22.0 与 lean HEAD 均不变,无本次快照或复用变动。
221
+ - 本次无门面行为变化,不加重复测试或修改既有断言。check 实际执行类型/既有回归/契约、三包独立
222
+ 生产安装和两种审计,并重测字符代理;结果以其输出为准。ceil(chars/4) 非计费 token,Pi 1.4 与交互 UI 未实测。
223
+
157
224
  ## 升级步骤
158
225
 
159
226
  1. `npm view @juicesharp/rpiv-todo version` 确认目标稳定版本,对比 manifest 中当前固定版本/revision 与目标源码(`tool/types.ts`、`todo.ts`、`todo-overlay.ts`、`index.ts`、`state/*`)及 `CHANGELOG.md`。
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Part of the [`amox-pi-extensions-lean`](https://github.com/gfgghgftgffg/amox_pi_extensions_lean/blob/main/README.md) monorepo. A lightweight Pi facade for
4
4
  [`@juicesharp/rpiv-todo`](https://github.com/juicesharp/rpiv-mono/tree/main/packages/rpiv-todo): the
5
- complete task-management engine with a compact flat schema, preserved RPC/session/overlay behavior,
5
+ complete task-management engine with a compact schema, preserved RPC/session/overlay behavior,
6
6
  and per-session isolated overlays.
7
7
 
8
8
  Original lean facade by [kunkun9527](https://github.com/kunkun9527/rpiv-todo-lean); upstream extension
@@ -13,8 +13,8 @@ is preserved in this package.
13
13
 
14
14
  * Full task lifecycle: `create`, `update`, `list`, `get`, `delete`, `clear`, status transitions,
15
15
  `blockedBy` dependencies, metadata, `/todos` command, and branch replay.
16
- * Compact provider-facing schema: the native flat schema is kept; verbose field descriptions are
17
- stripped and the prompt guidelines are compressed to a single line.
16
+ * Compact provider-facing schema: all native fields, including batch items, are retained. Verbose
17
+ descriptions and redundant constraints are removed without changing validation; guidelines use one line.
18
18
  * Upstream persistence preserved: every state-changing call still appends upstream's
19
19
  `rpiv-todo-state` custom entry so replay survives codemode-style calls.
20
20
  * RPC/session behavior preserved: per-session state slots, per-session overlays, stale-context
@@ -43,25 +43,35 @@ The model sees one tool, `todo`, with actions `create`, `update`, `list`, `get`,
43
43
  `action` is normally required; when it is omitted the facade infers `create` from `subject` or
44
44
  `update` from `id` plus a mutable field, and otherwise lets upstream report the error.
45
45
 
46
- New tasks default to `pending`. Listing excludes deleted tasks unless `includeDeleted: true`;
47
- clearing resets task IDs to 1. State persists through `rpiv-todo-state` entries, with legacy tool-result
48
- replay retained. RPC responses are not expanded with an additional full-plan snapshot.
46
+ New tasks default to `pending`. For multi-step work, keep one task `in_progress` and mark it
47
+ `completed` promptly when finished. Create one with `subject`, or create independent tasks atomically with
48
+ `{"action":"create","tasks":[{"subject":"Inspect"},{"subject":"Test"}]}`. Batch calls require explicit
49
+ `action: "create"`; `tasks` and individual items may be JSON strings and are normalized before validation.
50
+ Use either `subject` or a nonempty `tasks` array. In a batch, put `description`, `activeForm`, `blockedBy`,
51
+ `owner`, and `metadata` on each item. Invalid items reject the whole batch without changing the list.
52
+ Items can depend on existing tasks, but cannot reference another item in the same batch; create prerequisites first.
53
+
54
+ Listing excludes deleted tasks unless `includeDeleted: true`; clearing resets task IDs to 1.
55
+ State persists through `rpiv-todo-state` entries, with legacy tool-result replay retained. Malformed saved
56
+ snapshots are skipped as a whole, retaining the latest valid snapshot. Failed calls show an error card;
57
+ model-facing errors remain in text content and `details.error`. RPC responses are not expanded with an
58
+ additional full-plan snapshot.
49
59
 
50
60
  ## Context footprint (character proxy)
51
61
 
52
62
  <!-- amox-measurement:start -->
53
63
  | Package | Version | Registered character proxy |
54
64
  | --- | --- | ---: |
55
- | @gfgghgftgffg/rpiv-todo-lean | 0.1.8 | 247 |
56
- | @juicesharp/rpiv-todo | 2.13.9 | 882 |
65
+ | @gfgghgftgffg/rpiv-todo-lean | 0.1.10 | 277 |
66
+ | @juicesharp/rpiv-todo | 2.15.0 | 1222 |
57
67
 
58
68
  Fixed ceil(characters / 4), not provider billing tokens.
59
69
  <!-- amox-measurement:end -->
60
70
 
61
71
  ## Versions
62
72
 
63
- * Wrapper: `0.1.8`
64
- * Upstream runtime: pinned to `@juicesharp/rpiv-todo@2.13.9` and `@juicesharp/rpiv-i18n@2.13.9` (exact)
73
+ * Wrapper: `0.1.10`
74
+ * Upstream runtime: pinned to `@juicesharp/rpiv-todo@2.15.0` and `@juicesharp/rpiv-i18n@2.15.0` (exact)
65
75
  * Development test baseline: Pi `1.1.0`, Node `22.22.1`.
66
76
 
67
77
  ## Development
package/README.zh-CN.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  隶属于 [`amox-pi-extensions-lean`](https://github.com/gfgghgftgffg/amox_pi_extensions_lean/blob/main/README.zh-CN.md) 单仓。基于
4
4
  [`@juicesharp/rpiv-todo`](https://github.com/juicesharp/rpiv-mono/tree/main/packages/rpiv-todo) 的精简封装:
5
- 保留完整任务管理引擎,使用紧凑扁平 Schema,并保留原 lean 封装的 RPC/会话/覆盖层行为与逐会话隔离。
5
+ 保留完整任务管理引擎,使用紧凑 Schema,并保留原 lean 封装的 RPC/会话/覆盖层行为与逐会话隔离。
6
6
 
7
7
  原 lean 封装作者 [kunkun9527](https://github.com/kunkun9527/rpiv-todo-lean),上游扩展作者
8
8
  [juicesharp](https://github.com/juicesharp/rpiv-mono)。两者均为 MIT 协议,本包保留原始 `LICENSE`。
@@ -11,7 +11,7 @@
11
11
 
12
12
  * 完整任务生命周期:`create`、`update`、`list`、`get`、`delete`、`clear`,状态流转、`blockedBy`
13
13
  依赖、元数据、`/todos` 命令与分支回放全部沿用上游。
14
- * 精简模型侧 Schema:保留原生扁平 Schema,仅去除冗长字段描述,将 Prompt 指南压缩为一行。
14
+ * 精简模型侧 Schema:保留全部原生字段和批量项,去除冗长描述及等价冗余约束,不改变校验语义;Prompt 指南压缩为一行。
15
15
  * 保留上游持久化:每次改变状态仍写入上游的 `rpiv-todo-state` 自定义条目,codemode 等路径下的回放不受影响。
16
16
  * 保留 RPC/会话行为:逐会话状态槽、逐会话覆盖层、失效上下文处理及快捷键/命令包装均与原 lean 封装一致。
17
17
 
@@ -38,24 +38,33 @@ node scripts/install-extension.mjs rpiv-todo-lean
38
38
  通常需要显式传入 `action`;省略时封装会依据 `subject` 推断 `create`,或依据 `id` 加可变字段推断
39
39
  `update`,其余情况交由上游报错。
40
40
 
41
- 新任务默认 `pending`;list 默认不含已删除任务,`includeDeleted: true` 可包含;clear 重置任务 ID 为 1。
42
- 状态通过 `rpiv-todo-state` 条目持久化,保留历史工具结果回放。RPC 响应不会额外追加全量 Plan 快照。
41
+ 新任务默认 `pending`。多步骤工作保持一个任务为 `in_progress`,完成后及时标记为 `completed`。
42
+ 单个创建传 `subject`,独立任务可原子批量创建:
43
+ `{"action":"create","tasks":[{"subject":"Inspect"},{"subject":"Test"}]}`。批量调用须显式传
44
+ `action: "create"`;`tasks` 或其中各项为 JSON 字符串时,上游在校验前归一化。
45
+ `subject` 与非空 `tasks` 数组二选一。批量的 `description`、`activeForm`、`blockedBy`、`owner`、
46
+ `metadata` 须放在各项内;任一项无效则整批拒绝,任务列表不变。可依赖已有任务,但不能引用同批其它项,
47
+ 依赖链须先创建前置任务。
48
+
49
+ list 默认不含已删除任务,`includeDeleted: true` 可包含;clear 重置任务 ID 为 1。
50
+ 状态通过 `rpiv-todo-state` 条目持久化,保留历史工具结果回放;损坏的已存快照整条跳过,保留最近有效快照。
51
+ 失败调用显示错误卡片;模型侧错误仍在文本 content 与 `details.error` 中。RPC 响应不会额外追加全量 Plan 快照。
43
52
 
44
53
  ## 上下文占用(字符代理)
45
54
 
46
55
  <!-- amox-measurement:start -->
47
56
  | Package | Version | Registered character proxy |
48
57
  | --- | --- | ---: |
49
- | @gfgghgftgffg/rpiv-todo-lean | 0.1.8 | 247 |
50
- | @juicesharp/rpiv-todo | 2.13.9 | 882 |
58
+ | @gfgghgftgffg/rpiv-todo-lean | 0.1.10 | 277 |
59
+ | @juicesharp/rpiv-todo | 2.15.0 | 1222 |
51
60
 
52
61
  Fixed ceil(characters / 4), not provider billing tokens.
53
62
  <!-- amox-measurement:end -->
54
63
 
55
64
  ## 版本
56
65
 
57
- * 包装层:`0.1.8`
58
- * 上游运行时:锁定 `@juicesharp/rpiv-todo@2.13.9` 与 `@juicesharp/rpiv-i18n@2.13.9`(精确版本)
66
+ * 包装层:`0.1.10`
67
+ * 上游运行时:锁定 `@juicesharp/rpiv-todo@2.15.0` 与 `@juicesharp/rpiv-i18n@2.15.0`(精确版本)
59
68
  * 开发测试基线:Pi `1.1.0`、Node `22.22.1`。
60
69
 
61
70
  ## 开发
package/index.ts CHANGED
@@ -25,10 +25,10 @@ function decorateWithCollapsedDisplay<T extends CollapsedDisplayTool>(tool: T):
25
25
  : tool;
26
26
  }
27
27
 
28
- const TOOL_DESCRIPTION = "Task tracker. action is required: create|update|list|get|delete|clear; create needs subject; update/get/delete need id.";
28
+ const TOOL_DESCRIPTION = "Required action: create|update|list|get|delete|clear. create subject or tasks[]; update/get/delete id.";
29
29
  const PROMPT_SNIPPET = "";
30
30
  const PROMPT_GUIDELINES = [
31
- "todo: Use for multi-step tasks. update needs changed fields; list accepts status/includeDeleted; clear removes all; create supports blockedBy; update supports addBlockedBy/removeBlockedBy; keep one in_progress and complete tasks promptly.",
31
+ "Multi-step; one in_progress; complete promptly. update changes/addBlockedBy/removeBlockedBy; list status/includeDeleted; clear all; create blockedBy.",
32
32
  ];
33
33
 
34
34
  function prepareTodoArguments(args: unknown): unknown {
@@ -43,12 +43,23 @@ function prepareTodoArguments(args: unknown): unknown {
43
43
  return input;
44
44
  }
45
45
 
46
- function removeSchemaDescriptions(value: unknown, seen = new Set<object>(), isPropertiesMap = false): void {
46
+ function compactSchema(value: unknown, seen = new Set<object>(), isPropertiesMap = false): void {
47
47
  if (value === null || typeof value !== "object" || seen.has(value)) return;
48
48
  seen.add(value);
49
- if (!isPropertiesMap) delete (value as Record<string, unknown>).description;
49
+ if (!isPropertiesMap) {
50
+ const schema = value as Record<string, unknown>;
51
+ delete schema.description;
52
+ // A string-only enum already excludes every non-string value.
53
+ if (schema.type === "string" && Array.isArray(schema.enum)
54
+ && schema.enum.length > 0 && schema.enum.every((item) => typeof item === "string")) delete schema.type;
55
+ const patterns = schema.patternProperties as Record<string, unknown> | undefined;
56
+ // Unrestricted metadata stays unrestricted without an empty pattern.
57
+ if (schema.type === "object" && (schema.additionalProperties === undefined || schema.additionalProperties === true)
58
+ && patterns && Object.keys(patterns).length === 1 && patterns["^.*$"]
59
+ && typeof patterns["^.*$"] === "object" && Object.keys(patterns["^.*$"] as object).length === 0) delete schema.patternProperties;
60
+ }
50
61
  for (const [key, child] of Object.entries(value)) {
51
- removeSchemaDescriptions(child, seen, key === "properties");
62
+ compactSchema(child, seen, key === "properties");
52
63
  }
53
64
  }
54
65
 
@@ -339,9 +350,11 @@ export default function (pi: ExtensionAPI): void {
339
350
  if (property === "registerTool") {
340
351
  return (tool: Parameters<ExtensionAPI["registerTool"]>[0]) => {
341
352
  if (tool.name === "todo") {
342
- removeSchemaDescriptions(tool.parameters);
353
+ const parameters = JSON.parse(JSON.stringify(tool.parameters)) as typeof tool.parameters;
354
+ compactSchema(parameters);
343
355
  return target.registerTool(decorateWithCollapsedDisplay({
344
356
  ...tool,
357
+ parameters,
345
358
  description: TOOL_DESCRIPTION,
346
359
  promptSnippet: PROMPT_SNIPPET,
347
360
  promptGuidelines: PROMPT_GUIDELINES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gfgghgftgffg/rpiv-todo-lean",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "description": "Lean Pi todo extension: the full @juicesharp/rpiv-todo runtime with a compact flat schema and per-session RPC overlay handling preserved.",
6
6
  "license": "MIT",
@@ -46,8 +46,8 @@
46
46
  "check": "npm run typecheck && npm test"
47
47
  },
48
48
  "dependencies": {
49
- "@juicesharp/rpiv-i18n": "2.13.9",
50
- "@juicesharp/rpiv-todo": "2.13.9"
49
+ "@juicesharp/rpiv-i18n": "2.15.0",
50
+ "@juicesharp/rpiv-todo": "2.15.0"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "@earendil-works/pi-ai": ">=1.1.0",