pi-todo-ledger 0.8.1 → 0.8.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-todo-ledger",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "A todo list for pi agents with a public bookkeeping contract: snapshot entries, change events, and namespace validators. Fork of @juicesharp/rpiv-todo",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/todo.ts CHANGED
@@ -56,20 +56,13 @@ export { TOOL_NAME } from "./tool/types.ts";
56
56
  // Tool registration
57
57
  // ---------------------------------------------------------------------------
58
58
 
59
- export const DEFAULT_PROMPT_SNIPPET = "Manage a task list to track multi-step progress";
59
+ export const DEFAULT_PROMPT_SNIPPET = "Track multi-step work in a task list";
60
60
  export const DEFAULT_PROMPT_GUIDELINES: string[] = [
61
- "Use `todo` for complex work with 3+ steps, when the user gives you a list of tasks, or immediately after receiving new instructions to capture requirements. Skip it for single trivial tasks and purely conversational requests.",
62
- "When starting a task from the todo list, mark it in_progress BEFORE beginning work. Mark it completed IMMEDIATELY when done — never batch completions. Exactly one task in_progress at a time.",
63
- "Never mark a task completed if tests are failing, the implementation is partial, or you hit unresolved errors — keep it in_progress and create a new task for the blocker instead.",
64
- "Task status is a 4-state machine: pending → in_progress → completed, plus deleted as a tombstone. Pass activeForm (present-continuous label, e.g. 'researching existing tool') when marking in_progress.",
65
- 'To change a task\'s status, call update with the task id and the target status, e.g. {"action":"update","id":3,"status":"completed"} or {"action":"update","id":3,"status":"in_progress","activeForm":"writing tests"}. status is the field that changes the task; an update without a mutable field (status or another) is rejected.',
66
- "Use blockedBy to express dependencies (A is blocked by B). On create, pass blockedBy as the initial set. On update, use addBlockedBy / removeBlockedBy (additive merge — do not resend the full array). Cycles are rejected.",
67
- "To create several independent tasks at once, pass create with tasks: [{subject}, ...]. Do not also pass subject. tasks[] cannot blockedBy each other (ids do not exist until the call commits); create the prerequisite first, then the dependent with blockedBy. Dependency chains stay single-create.",
68
- "Use import with a snapshot file path, or session (an earlier session's id), to restore a handed-over list into an empty session list.",
69
- "list hides tombstoned (deleted) tasks by default; pass includeDeleted:true to see them. Pass status to filter by a single status.",
70
- "Subject must be short and imperative (e.g. 'Research existing tool'); description is for long-form detail. activeForm is a present-continuous label shown while in_progress.",
71
- "Optional bookkeeping fields: points (effort, 0 to 10), anchor (the check that shows the task is done, e.g. a test command), and evidence (runs of checks, each {command, sha?, result: pass|fail, at?}). On update, points and anchor replace; evidence is appended, never replaced.",
72
- "When a task waits on something outside your control (a person, CI, a train, a release window), mark it with waitsOn (what it waits on) and, if known, until (ISO time); it shows ⏸ and reminders leave it alone while it waits. To end a wait early, clear every field you set (waitsOn: null, until: null), since an until left in place keeps the task waiting; completing the task clears both.",
61
+ "Use todo for work with 3+ steps, a user task list, or immediately on new instructions to capture requirements. Skip single trivial tasks and conversation.",
62
+ "Mark one task in_progress before starting (with activeForm); mark it completed immediately when done, never in batches. With failing tests, partial work or unresolved errors, keep it in_progress and create a blocker task.",
63
+ "Set status with update and id: pending → in_progress → completed; deleted is a tombstone. update needs a mutable field.",
64
+ "For dependencies, create prerequisites first, then dependents with blockedBy. Update via addBlockedBy/removeBlockedBy, not a full set; cycles are rejected.",
65
+ "On external waits (person, CI, train, release window), set waitsOn and, if known, until. End a wait early with waitsOn: null and until: null for the fields you set; a future until still holds the wait.",
73
66
  ];
74
67
 
75
68
  export function registerTodoTool(pi: ExtensionAPI, finish: FinishCall): void {
@@ -77,8 +70,7 @@ export function registerTodoTool(pi: ExtensionAPI, finish: FinishCall): void {
77
70
  pi.registerTool({
78
71
  name: TOOL_NAME,
79
72
  label: TOOL_LABEL,
80
- description:
81
- "Manage a task list for tracking multi-step progress. Actions: create (new task, or several independent tasks at once via tasks[]), update (change status/fields/dependencies), list (all tasks, optionally filtered by status), get (single task details), delete (tombstone), clear (reset all), import (restore a snapshot file into an empty list). Status: pending → in_progress → completed, plus deleted tombstone. Use this to plan and track multi-step work like research, design, and implementation.",
73
+ description: "Track a plan and its progress: create, update, list, get, delete (tombstone), clear (reset all), or import a handoff into an empty list.",
82
74
  promptSnippet: guidance.promptSnippet ?? DEFAULT_PROMPT_SNIPPET,
83
75
  promptGuidelines: guidance.promptGuidelines ?? DEFAULT_PROMPT_GUIDELINES,
84
76
  parameters: TodoParamsSchema,
package/src/tool/types.ts CHANGED
@@ -151,135 +151,57 @@ export interface TaskMutationParams {
151
151
  }
152
152
 
153
153
  // ---------------------------------------------------------------------------
154
- // TypeBox parameter schema — every `description` doubles as LLM-facing prompt
155
- // copy. Field order and wording are pinned by registration tests.
154
+ // TypeBox parameter schema. Descriptions are prompt text: document shared
155
+ // fields once, on the top-level property rather than in each batch item.
156
156
  // ---------------------------------------------------------------------------
157
157
 
158
- const PointsSchema = (description: string) =>
159
- Type.Number({ minimum: POINTS_MIN, maximum: POINTS_MAX, description });
160
-
161
- const AnchorSchema = (description: string) => Type.String({ minLength: 1, description });
162
-
163
- const EvidenceInputSchema = Type.Object({
164
- ref: Type.Optional(Type.String({ minLength: 1, maxLength: 64, pattern: "^\\S*$", description: "Run or child:<id>" })),
165
- command: Type.String({ minLength: 1, description: "The check that ran, e.g. 'npm test -- replay'" }),
166
- sha: Type.Optional(Type.String({ description: "Revision the check ran on, e.g. a git commit SHA" })),
167
- result: StringEnum(["pass", "fail"] as const, { description: "How the run ended" }),
168
- at: Type.Optional(Type.String({ description: "ISO 8601 time of the run. Default: now" })),
169
- });
170
-
171
- const EvidenceSchema = (description: string) => Type.Array(EvidenceInputSchema, { description });
172
-
173
- const WAITS_ON_TEXT =
174
- "What this task waits on (a person, CI, a train to end); it shows ⏸, and close and stale reminders leave the task alone while it waits. Completing or deleting the task clears it; to end a wait early, clear both waitsOn and until";
175
- const UNTIL_TEXT = "ISO 8601 time the task waits until, e.g. 2027-01-15T09:00:00+08:00; once it passes, an until-only wait ends";
158
+ const PointsSchema = Type.Number({ minimum: POINTS_MIN, maximum: POINTS_MAX });
159
+ const AnchorSchema = Type.String({ minLength: 1 });
160
+ const EvidenceSchema = Type.Array(Type.Object({
161
+ ref: Type.Optional(Type.String({ minLength: 1, maxLength: 64, pattern: "^\\S*$" })),
162
+ command: Type.String({ minLength: 1 }),
163
+ sha: Type.Optional(Type.String()),
164
+ result: StringEnum(["pass", "fail"] as const),
165
+ at: Type.Optional(Type.String()),
166
+ }));
176
167
 
177
168
  const CreateTaskInputSchema = Type.Object({
178
- subject: Type.String({ description: "Task subject line" }),
179
- description: Type.Optional(Type.String({ description: "Long-form task description" })),
180
- activeForm: Type.Optional(
181
- Type.String({
182
- description: "Present-continuous spinner label shown while status is in_progress (e.g. 'writing tests')",
183
- }),
184
- ),
185
- blockedBy: Type.Optional(
186
- Type.Array(Type.Number(), {
187
- description:
188
- "Existing task ids this item waits on. Cannot name another item in this same batch; create the prerequisite first, then the dependent with blockedBy.",
189
- }),
190
- ),
191
- owner: Type.Optional(Type.String({ description: "Agent/owner assigned to this task" })),
192
- metadata: Type.Optional(
193
- Type.Record(Type.String(), Type.Unknown(), {
194
- description: "Arbitrary metadata",
195
- }),
196
- ),
197
- points: Type.Optional(PointsSchema("Effort points, 0 to 10")),
198
- anchor: Type.Optional(AnchorSchema("The check that shows this task is done, e.g. a test command")),
169
+ subject: Type.String(),
170
+ description: Type.Optional(Type.String()),
171
+ activeForm: Type.Optional(Type.String()),
172
+ blockedBy: Type.Optional(Type.Array(Type.Number())),
173
+ owner: Type.Optional(Type.String()),
174
+ metadata: Type.Optional(Type.Record(Type.String(), Type.Unknown())),
175
+ points: Type.Optional(PointsSchema),
176
+ anchor: Type.Optional(AnchorSchema),
199
177
  graph: Type.Optional(Type.String()),
200
- evidence: Type.Optional(EvidenceSchema("Check runs already recorded for this task")),
201
- waitsOn: Type.Optional(Type.String({ minLength: 1, description: WAITS_ON_TEXT })),
202
- until: Type.Optional(Type.String({ description: UNTIL_TEXT })),
178
+ evidence: Type.Optional(EvidenceSchema),
179
+ waitsOn: Type.Optional(Type.String({ minLength: 1 })),
180
+ until: Type.Optional(Type.String()),
203
181
  });
204
182
 
205
183
  export const TodoParamsSchema = Type.Object({
206
184
  action: StringEnum(["create", "update", "list", "get", "delete", "clear", "import"] as const),
207
- path: Type.Optional(Type.String({ description: "Snapshot file (import only); relative to the session cwd" })),
208
- session: Type.Optional(Type.String({ description: "Or a session id, id prefix, or .jsonl (import only)" })),
209
- subject: Type.Optional(
210
- Type.String({
211
- description: "Task subject line (required for create unless tasks[] is set)",
212
- }),
213
- ),
214
- description: Type.Optional(Type.String({ description: "Long-form task description" })),
215
- activeForm: Type.Optional(
216
- Type.String({
217
- description: "Present-continuous spinner label shown while status is in_progress (e.g. 'writing tests')",
218
- }),
219
- ),
220
- status: Type.Optional(
221
- StringEnum(["pending", "in_progress", "completed", "deleted"] as const, {
222
- description:
223
- "Set this task's status (update): one of pending, in_progress, completed, deleted. When action is list, filters returned tasks by this status.",
224
- }),
225
- ),
226
- blockedBy: Type.Optional(
227
- Type.Array(Type.Number(), {
228
- description: "Initial blockedBy ids (create only)",
229
- }),
230
- ),
231
- addBlockedBy: Type.Optional(
232
- Type.Array(Type.Number(), {
233
- description: "Task ids to add to blockedBy (update only, additive merge)",
234
- }),
235
- ),
236
- removeBlockedBy: Type.Optional(
237
- Type.Array(Type.Number(), {
238
- description: "Task ids to remove from blockedBy (update only, additive merge)",
239
- }),
240
- ),
241
- owner: Type.Optional(Type.String({ description: "Agent/owner assigned to this task" })),
242
- metadata: Type.Optional(
243
- Type.Record(Type.String(), Type.Unknown(), {
244
- description: "Arbitrary metadata; pass null value for a key to delete that key on update",
245
- }),
246
- ),
247
- points: Type.Optional(PointsSchema("Effort points, 0 to 10 (create or update; update replaces)")),
248
- anchor: Type.Optional(
249
- AnchorSchema(
250
- "The check that shows this task is done, e.g. a test command (create or update; update replaces)",
251
- ),
252
- ),
253
- graph: Type.Optional(
254
- Type.Union([Type.String(), Type.Null()], {
255
- description: "single-loop, fan-out/fan-in, or orchestrator-worker; null clears",
256
- }),
257
- ),
258
- evidence: Type.Optional(
259
- EvidenceSchema(
260
- "Check runs to record: the initial list on create; on update, appended to the task's evidence (never replaced or removed)",
261
- ),
262
- ),
263
- waitsOn: Type.Optional(
264
- Type.Union([Type.String({ minLength: 1 }), Type.Null()], { description: `${WAITS_ON_TEXT}; null clears (update)` }),
265
- ),
266
- until: Type.Optional(Type.Union([Type.String(), Type.Null()], { description: `${UNTIL_TEXT}; null clears (update)` })),
267
- id: Type.Optional(
268
- Type.Number({
269
- description: "Task id (required for update, get, delete)",
270
- }),
271
- ),
272
- includeDeleted: Type.Optional(
273
- Type.Boolean({
274
- description: "If true, list action returns deleted (tombstoned) tasks as well. Default: false.",
275
- }),
276
- ),
277
- tasks: Type.Optional(
278
- Type.Array(CreateTaskInputSchema, {
279
- description:
280
- "Batch create: independent tasks in one call, one-of with subject. The whole list is validated then committed together. Items cannot blockedBy each other; create the prerequisite first, then the dependent with blockedBy.",
281
- }),
282
- ),
185
+ path: Type.Optional(Type.String({ description: "Import snapshot, cwd-relative." })),
186
+ session: Type.Optional(Type.String({ description: "Import alternative: session ID, unique prefix or .jsonl." })),
187
+ subject: Type.Optional(Type.String({ description: "Short imperative title (create, unless tasks is set)." })),
188
+ description: Type.Optional(Type.String({ description: "Long-form detail." })),
189
+ activeForm: Type.Optional(Type.String({ description: "Present-continuous in_progress label, e.g. 'writing tests'." })),
190
+ status: Type.Optional(StringEnum(["pending", "in_progress", "completed", "deleted"] as const, { description: "Set on update; filter on list." })),
191
+ blockedBy: Type.Optional(Type.Array(Type.Number(), { description: "Existing prerequisite IDs (create)." })),
192
+ addBlockedBy: Type.Optional(Type.Array(Type.Number(), { description: "Update: add prerequisite IDs." })),
193
+ removeBlockedBy: Type.Optional(Type.Array(Type.Number(), { description: "Update: drop prerequisite IDs." })),
194
+ owner: Type.Optional(Type.String()),
195
+ metadata: Type.Optional(Type.Record(Type.String(), Type.Unknown(), { description: "Update: null drops that key." })),
196
+ points: Type.Optional({ ...PointsSchema, description: "Effort; update replaces." }),
197
+ anchor: Type.Optional({ ...AnchorSchema, description: "Completion check, e.g. test command; update replaces." }),
198
+ graph: Type.Optional(Type.Union([Type.String(), Type.Null()], { description: "single-loop, fan-out/fan-in or orchestrator-worker; null clears." })),
199
+ evidence: Type.Optional({ ...EvidenceSchema, description: "Check runs: update only appends. ref: run or child:<id>; sha: tested revision; at: ISO 8601 (default now)." }),
200
+ waitsOn: Type.Optional(Type.Union([Type.String({ minLength: 1 }), Type.Null()], { description: "What is pending. Wait shows ⏸, suppresses close/stale reminders; complete/delete clears it. null clears on update." })),
201
+ until: Type.Optional(Type.Union([Type.String(), Type.Null()], { description: "ISO 8601 deadline; an until-only wait ends then. null clears on update." })),
202
+ id: Type.Optional(Type.Number({ description: "Required for update/get/delete." })),
203
+ includeDeleted: Type.Optional(Type.Boolean({ description: "list: include tombstones (default false)." })),
204
+ tasks: Type.Optional(Type.Array(CreateTaskInputSchema, { description: "Atomic batch create instead of subject; same fields, no dependencies within the batch." })),
283
205
  });
284
206
 
285
207
  export type TodoParams = Static<typeof TodoParamsSchema>;