@ian-pascoe/pi-todo 0.1.3 → 0.1.4
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
package/skills/pi-todo/SKILL.md
CHANGED
package/src/pi-todo-extension.ts
CHANGED
|
@@ -13,8 +13,10 @@ import {
|
|
|
13
13
|
type TodoStateSnapshot,
|
|
14
14
|
type TodoStatus,
|
|
15
15
|
type TodoTask,
|
|
16
|
+
TodoOperationError,
|
|
16
17
|
type TodoToolDetails,
|
|
17
18
|
} from "./todo-list.js";
|
|
19
|
+
import { TROUBLESHOOTING_HINT } from "./troubleshooting-skill.js";
|
|
18
20
|
|
|
19
21
|
const TODO_STATE_ENTRY_TYPE = "pi-todo-state";
|
|
20
22
|
const JOURNAL_FAULT = Symbol.for("@ian-pascoe/pi-todo/journal-fault");
|
|
@@ -161,7 +163,15 @@ export default function piTodoExtension(pi: ExtensionAPI): void {
|
|
|
161
163
|
executionMode: "sequential",
|
|
162
164
|
async execute(_toolCallId, params, signal, _onUpdate, context) {
|
|
163
165
|
signal?.throwIfAborted();
|
|
164
|
-
|
|
166
|
+
let result: ReturnType<typeof runTodoAction>;
|
|
167
|
+
try {
|
|
168
|
+
result = runTodoAction(params, context);
|
|
169
|
+
} catch (cause) {
|
|
170
|
+
// Task-operation errors are model-fixable input errors; anything else is a journal failure.
|
|
171
|
+
if (cause instanceof TodoOperationError) throw cause;
|
|
172
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
173
|
+
throw new Error(`${message}\n\n${TROUBLESHOOTING_HINT}`, { cause });
|
|
174
|
+
}
|
|
165
175
|
return {
|
|
166
176
|
content: [{ type: "text", text: result.message }],
|
|
167
177
|
details: result.details,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
|
|
3
|
+
/** Absolute path of this package's user-invoked troubleshooting Skill. */
|
|
4
|
+
export const TROUBLESHOOTING_SKILL_PATH = fileURLToPath(
|
|
5
|
+
new URL("../skills/pi-todo/SKILL.md", import.meta.url),
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
/** Model-facing pointer appended to failures this package's Skill diagnoses. */
|
|
9
|
+
export const TROUBLESHOOTING_HINT = `For diagnosis, read the pi-todo troubleshooting Skill at ${TROUBLESHOOTING_SKILL_PATH}.`;
|