@pi-archimedes/todo 2.12.0 → 2.14.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 +5 -5
- package/package.json +4 -6
- package/src/tool.test.ts +24 -0
- package/src/tool.ts +19 -1
package/README.md
CHANGED
|
@@ -24,10 +24,10 @@ New to Pi? Pi itself is a one-time global install and needs Node.js ≥ 22.19.0:
|
|
|
24
24
|
npm install -g --ignore-scripts @earendil-works/pi-coding-agent
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
After installing Pi, choose one installation command above, then `cd` into your project and run `pi`. Inside the session, `/login` signs you in and `/model` picks a model — the [setup section](https://github.com/
|
|
27
|
+
After installing Pi, choose one installation command above, then `cd` into your project and run `pi`. Inside the session, `/login` signs you in and `/model` picks a model — the [setup section](https://github.com/archimedes-codes/pi-archimedes#setup) covers the first run. `/reload` works two ways here: it picks the extension up, **and** it restores the todo list, which survives `/reload` through session state reconstruction.
|
|
28
28
|
|
|
29
29
|
<div align="center">
|
|
30
|
-
<img src="https://raw.githubusercontent.com/
|
|
30
|
+
<img src="https://raw.githubusercontent.com/archimedes-codes/pi-archimedes/main/docs/images/todos-and-subagent.png" width="750" alt="Main agent and subagent todos side by side">
|
|
31
31
|
</div>
|
|
32
32
|
|
|
33
33
|
## The `manage_todo_list` tool
|
|
@@ -54,7 +54,7 @@ Two operations, `write` and `read`:
|
|
|
54
54
|
States are `pending`, `in_progress`, and `completed`. Finished items render struck through; the current one stays highlighted.
|
|
55
55
|
|
|
56
56
|
<p align="center">
|
|
57
|
-
<img src="https://raw.githubusercontent.com/
|
|
57
|
+
<img src="https://raw.githubusercontent.com/archimedes-codes/pi-archimedes/main/docs/images/todos-multiple-todos.png" width="600" alt="Multiple todos tracking progress">
|
|
58
58
|
</p>
|
|
59
59
|
|
|
60
60
|
## Commands
|
|
@@ -68,6 +68,6 @@ When every task reaches `completed`, the widget shows a brief confirmation, then
|
|
|
68
68
|
|
|
69
69
|
## Part of the suite
|
|
70
70
|
|
|
71
|
-
With subagents running alongside in the [full suite](https://github.com/
|
|
71
|
+
With subagents running alongside in the [full suite](https://github.com/archimedes-codes/pi-archimedes), each child gets its own named column to the right of yours — it appears on the child's first non-empty todo update over the host's event bus, `pi.events` (empty updates are ignored; it does not appear when the worker merely starts), and it is removed when the child exits. The 2-second auto-clear is local to whatever list completed — a child clearing its own list does not dismiss the column in your session. On/off is managed by the suite: toggle via `/plugins` (`archimedes.todo.enabled`, default on).
|
|
72
72
|
|
|
73
|
-
← [Back to pi-archimedes](https://github.com/
|
|
73
|
+
← [Back to pi-archimedes](https://github.com/archimedes-codes/pi-archimedes)
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-archimedes/todo",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
|
-
"url": "https://github.com/
|
|
6
|
+
"url": "https://github.com/archimedes-codes/pi-archimedes.git"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
9
|
"keywords": [
|
|
@@ -19,16 +19,14 @@
|
|
|
19
19
|
"./prepare-args": "./src/prepare-args.ts"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@pi-archimedes/core": "2.
|
|
22
|
+
"@pi-archimedes/core": "2.14.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@earendil-works/pi-ai": ">=0.99.0",
|
|
26
25
|
"@earendil-works/pi-coding-agent": ">=0.99.0",
|
|
27
26
|
"@earendil-works/pi-tui": ">=0.99.0",
|
|
28
27
|
"typebox": ">=1.1.0"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
|
-
"@earendil-works/pi-ai": "1.4.0",
|
|
32
30
|
"@earendil-works/pi-coding-agent": "1.4.0",
|
|
33
31
|
"@earendil-works/pi-tui": "1.4.0",
|
|
34
32
|
"typebox": "^1.1.38",
|
|
@@ -38,6 +36,6 @@
|
|
|
38
36
|
"extensions": [
|
|
39
37
|
"./src/index.ts"
|
|
40
38
|
],
|
|
41
|
-
"image": "https://raw.githubusercontent.com/
|
|
39
|
+
"image": "https://raw.githubusercontent.com/archimedes-codes/pi-archimedes/main/docs/images/todos-and-subagent.png"
|
|
42
40
|
}
|
|
43
41
|
}
|
package/src/tool.test.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { Value } from "typebox/value";
|
|
2
3
|
import type { AgentToolResult, Theme } from "@earendil-works/pi-coding-agent";
|
|
3
4
|
import { createManageTodoListTool } from "./tool.js";
|
|
5
|
+
import type { ManageTodoListInput } from "./tool.js";
|
|
6
|
+
import { ManageTodoListParams } from "./tool.js";
|
|
4
7
|
import { TodoStateManager } from "./state-manager.js";
|
|
5
8
|
import type { TodoDetails } from "./types.js";
|
|
6
9
|
|
|
@@ -112,6 +115,27 @@ describe("tool schema", () => {
|
|
|
112
115
|
});
|
|
113
116
|
});
|
|
114
117
|
|
|
118
|
+
// Parity guards for the schema's enum plumbing. `StringEnum` used to come from
|
|
119
|
+
// pi-ai; it now lives in tool.ts, built on Type.Unsafe. Two ways that move can
|
|
120
|
+
// go silently wrong, so both are pinned here: the emitted JSON Schema can stop
|
|
121
|
+
// rejecting out-of-vocabulary values (caught below by Value.Check), and the
|
|
122
|
+
// derived TypeScript type can widen from a narrow union to `string` — invisible
|
|
123
|
+
// to every runtime assertion, so it is caught at compile time.
|
|
124
|
+
describe("schema enum guards", () => {
|
|
125
|
+
it("rejects out-of-vocabulary operation values at runtime", () => {
|
|
126
|
+
expect(Value.Check(ManageTodoListParams, { operation: "nope" })).toBe(false);
|
|
127
|
+
expect(Value.Check(ManageTodoListParams, { operation: "read" })).toBe(true);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it("keeps operation a narrow union at the type level", () => {
|
|
131
|
+
const good: ManageTodoListInput = { operation: "read" };
|
|
132
|
+
// @ts-expect-error "nope" is not a member of the operation union
|
|
133
|
+
const bad: ManageTodoListInput = { operation: "nope" };
|
|
134
|
+
void good;
|
|
135
|
+
void bad;
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
|
|
115
139
|
describe("renderResult — successful results unchanged", () => {
|
|
116
140
|
it("renders the completed counter from details.todos", () => {
|
|
117
141
|
const result = {
|
package/src/tool.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Static
|
|
1
|
+
import { Type, type Static } from "typebox";
|
|
2
2
|
import type { AgentToolResult, EventBus, ExtensionContext, Theme, ToolRenderResultOptions } from "@earendil-works/pi-coding-agent";
|
|
3
3
|
import { Text } from "@earendil-works/pi-tui";
|
|
4
4
|
import { Events, emitOn } from "@pi-archimedes/core/events";
|
|
@@ -8,6 +8,24 @@ import type { TodoStateManager } from "./state-manager.js";
|
|
|
8
8
|
import { STATUS_ICONS } from "./types.js";
|
|
9
9
|
import type { TodoDetails, TodoItem, TodoStatus } from "./types.js";
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* pi-ai shipped this helper; typebox has no equivalent, and pi 1.5.0 dropped
|
|
13
|
+
* pi-ai's typebox re-exports, so the suite no longer takes schema symbols from
|
|
14
|
+
* the host. Emits the identical JSON Schema: { type: "string", enum: [...] }.
|
|
15
|
+
* pi-ai's version also accepted a `default`; no caller here does, so it is not
|
|
16
|
+
* carried.
|
|
17
|
+
*/
|
|
18
|
+
function StringEnum<T extends readonly string[]>(
|
|
19
|
+
values: readonly [...T],
|
|
20
|
+
options?: { description?: string },
|
|
21
|
+
) {
|
|
22
|
+
return Type.Unsafe<T[number]>({
|
|
23
|
+
type: "string",
|
|
24
|
+
enum: [...values],
|
|
25
|
+
...(options?.description ? { description: options.description } : {}),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
11
29
|
const TodoItemSchema = Type.Object({
|
|
12
30
|
content: Type.String({
|
|
13
31
|
description: "Short imperative label for the task (3-10 words). Displayed in UI. Example: \"Fix the auth middleware\".",
|