@zhushanwen/pi-todo 0.8.4 → 0.8.6
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 +6 -6
- package/src/index.ts +8 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhushanwen/pi-todo",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.6",
|
|
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",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"vitest": "^4.1.8"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@xyz-agent/extension-protocol": "0.
|
|
33
|
-
"@zhushanwen/pi-extension-logger": "0.3.
|
|
32
|
+
"@xyz-agent/extension-protocol": "0.7.0",
|
|
33
|
+
"@zhushanwen/pi-extension-logger": "0.3.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@earendil-works/pi-coding-agent": "^0.84.
|
|
37
|
-
"@earendil-works/pi-tui": "^0.84.
|
|
38
|
-
"@earendil-works/pi-ai": "^0.84.
|
|
36
|
+
"@earendil-works/pi-coding-agent": "^0.84.4",
|
|
37
|
+
"@earendil-works/pi-tui": "^0.84.4",
|
|
38
|
+
"@earendil-works/pi-ai": "^0.84.4",
|
|
39
39
|
"typebox": "*"
|
|
40
40
|
},
|
|
41
41
|
"peerDependenciesMeta": {
|
package/src/index.ts
CHANGED
|
@@ -35,9 +35,11 @@ import { registerTodoTool } from "./tool";
|
|
|
35
35
|
/**
|
|
36
36
|
* 构造依赖 TodoSessionState 的 refreshDisplay(M17 widget 面板推送)。
|
|
37
37
|
*
|
|
38
|
-
* 类型断言根因:pi 的 ExtensionContext.ui.custom
|
|
39
|
-
* 与 GuiContext
|
|
40
|
-
*
|
|
38
|
+
* 类型断言根因:pi 的 ExtensionContext.ui.custom 是泛型方法(返回 Promise<T>),
|
|
39
|
+
* 与 GuiContext.ui.custom 的具体返回类型静态不兼容,传参需断言收窄;
|
|
40
|
+
* mode/hasUI/ui.setWidget 形状一致(ExtensionMode 与 GuiContext.mode union 完全
|
|
41
|
+
* 相同),单层直接断言可过 tsc(guiSetWidget/isGuiCapable 不读 custom),
|
|
42
|
+
* 与 goal adapters/ports.ts setGuiWidget 同款。
|
|
41
43
|
*
|
|
42
44
|
* isGuiCapable 外层判定不可省略:guiSetWidget 内部无 isGui 守卫
|
|
43
45
|
* (extension-protocol helpers.ts 仅查 ctx.ui?.setWidget 存在性),
|
|
@@ -47,15 +49,15 @@ export function makeRefreshDisplay(state: TodoSessionState): (ctx: ExtensionCont
|
|
|
47
49
|
return function refreshDisplay(ctx: ExtensionContext): void {
|
|
48
50
|
const statusText = renderStatusText(state.todos, ctx.ui.theme);
|
|
49
51
|
ctx.ui.setStatus("todo", statusText || undefined);
|
|
50
|
-
const isGui = isGuiCapable(ctx as
|
|
52
|
+
const isGui = isGuiCapable(ctx as GuiContext);
|
|
51
53
|
if (state.todos.length === 0) {
|
|
52
54
|
if (isGui) {
|
|
53
|
-
guiSetWidget(ctx as
|
|
55
|
+
guiSetWidget(ctx as GuiContext, "todo", undefined);
|
|
54
56
|
} else {
|
|
55
57
|
ctx.ui.setWidget("todo", undefined);
|
|
56
58
|
}
|
|
57
59
|
} else if (isGui) {
|
|
58
|
-
guiSetWidget(ctx as
|
|
60
|
+
guiSetWidget(ctx as GuiContext, "todo", buildGui(state.todos));
|
|
59
61
|
} else {
|
|
60
62
|
ctx.ui.setWidget("todo", renderWidgetLines(state.todos, ctx.ui.theme));
|
|
61
63
|
}
|