@zhushanwen/pi-todo 0.4.1 → 0.5.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/package.json +3 -3
- package/src/__tests__/todo.test.ts +1 -1
- package/src/__tests__/tool-rpc.test.ts +2 -2
- package/src/commands.ts +8 -3
- package/src/component.ts +1 -1
- package/src/handlers.ts +1 -1
- package/src/index.ts +1 -1
- package/src/render.ts +1 -1
- package/src/tool.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhushanwen/pi-todo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "AI-driven todo list for Pi — stateful task management with session persistence and /todos command.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"@xyz-agent/extension-protocol": "^0.2.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@
|
|
31
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
32
32
|
"@earendil-works/pi-tui": "*",
|
|
33
33
|
"@earendil-works/pi-ai": "*",
|
|
34
|
-
"
|
|
34
|
+
"typebox": "*"
|
|
35
35
|
},
|
|
36
36
|
"peerDependenciesMeta": {
|
|
37
37
|
"@earendil-works/pi-tui": {
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* 已注册 tool,再以不同 ctx.mode 调 execute。每个用例新建 state(隔离),
|
|
7
7
|
* 无模块级状态需重置。
|
|
8
8
|
*/
|
|
9
|
-
import type { ExtensionAPI } from "@
|
|
10
|
-
import type { Theme } from "@
|
|
9
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
10
|
+
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
11
11
|
import { describe, expect, it } from "vitest";
|
|
12
12
|
|
|
13
13
|
import { createTodoSessionState, type TodoSessionState } from "../state";
|
package/src/commands.ts
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* 用户在 TUI 中不可见。
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { ExtensionAPI, ExtensionCommandContext, Theme } from "@
|
|
9
|
+
import type { ExtensionAPI, ExtensionCommandContext, KeybindingsManager, Theme } from "@earendil-works/pi-coding-agent";
|
|
10
|
+
import type { TUI } from "@earendil-works/pi-tui";
|
|
10
11
|
|
|
11
12
|
import type { TodoSessionState } from "./state";
|
|
12
13
|
import { TodoListComponent } from "./component";
|
|
@@ -21,8 +22,12 @@ export function registerTodosCommand(pi: ExtensionAPI, state: TodoSessionState):
|
|
|
21
22
|
return;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
// ctx.ui.custom 的 factory 签名为
|
|
26
|
+
// (tui: TUI, theme: Theme, keybindings: KeybindingsManager, done: (result) => void)
|
|
27
|
+
// 返回 Component & { dispose?(): void }。TodoListComponent 实现该形状,
|
|
28
|
+
// done 接收 result(此处忽略)。
|
|
29
|
+
await ctx.ui.custom((_tui: TUI, theme: Theme, _kb: KeybindingsManager, done: (result: unknown) => void) => {
|
|
30
|
+
return new TodoListComponent(state.todos, theme, () => done(undefined));
|
|
26
31
|
});
|
|
27
32
|
},
|
|
28
33
|
});
|
package/src/component.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* /todos 命令的 TUI 组件 — 独立可关闭的 todo 列表视图(双列布局)。
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { Theme } from "@
|
|
5
|
+
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
6
6
|
import { matchesKey, truncateToWidth } from "@earendil-works/pi-tui";
|
|
7
7
|
|
|
8
8
|
import type { Todo } from "./model";
|
package/src/handlers.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* model 层纯函数返回 Result 对象(合法),dispatcher 拿到 error 时 throw。
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
import type { ExtensionAPI, ExtensionContext } from "@
|
|
23
|
+
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
24
24
|
|
|
25
25
|
import { registerTodosCommand } from "./commands";
|
|
26
26
|
import { registerTodoEventHandlers } from "./handlers";
|
package/src/render.ts
CHANGED
package/src/tool.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { StringEnum } from "@earendil-works/pi-ai";
|
|
6
6
|
import { Text } from "@earendil-works/pi-tui";
|
|
7
|
-
import type { ExtensionAPI, ExtensionContext, Theme } from "@
|
|
7
|
+
import type { ExtensionAPI, ExtensionContext, Theme } from "@earendil-works/pi-coding-agent";
|
|
8
8
|
import { type Static, Type } from "typebox";
|
|
9
9
|
|
|
10
10
|
import {
|