@zhushanwen/pi-unified-hooks 0.0.4 → 0.0.5
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 +1 -1
- package/src/hooks/tool-error-handler.ts +4 -1
- package/src/index.ts +4 -2
package/package.json
CHANGED
|
@@ -22,6 +22,9 @@ export function setupToolErrorHandler(pi: ExtensionAPI): void {
|
|
|
22
22
|
pi.on("tool_execution_end", async (event: unknown) => {
|
|
23
23
|
const e = event as ToolExecutionEndLikeEvent;
|
|
24
24
|
if (!e.isError) return;
|
|
25
|
-
|
|
25
|
+
// Tool error diagnostics are internal — surfacing to the terminal
|
|
26
|
+
// would leak to the input area. ctx.ui.notify is unnecessary because
|
|
27
|
+
// tool errors are already surfaced by Pi's own error rendering.
|
|
28
|
+
console.warn(`[unified-hooks] ${e.toolName} error (callId=${e.toolCallId})`);
|
|
26
29
|
});
|
|
27
30
|
}
|
package/src/index.ts
CHANGED
|
@@ -41,11 +41,13 @@ export default function unifiedHooksExtension(pi: ExtensionAPI): void {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
//
|
|
44
|
+
// Hook status is an internal diagnostic — surfacing to the terminal
|
|
45
|
+
// would leak to the input area. Use console.warn (stderr) for
|
|
46
|
+
// development debugging; production should be silent.
|
|
45
47
|
pi.on("session_start", () => {
|
|
46
48
|
const enabled = hooks.filter((h) => h.enabled).map((h) => h.name);
|
|
47
49
|
const disabled = hooks.filter((h) => !h.enabled).map((h) => h.name);
|
|
48
|
-
console.
|
|
50
|
+
console.warn(
|
|
49
51
|
`[unified-hooks] Loaded: ${enabled.join(", ") || "(none)"}${
|
|
50
52
|
disabled.length ? ` | Failed: ${disabled.join(", ")}` : ""
|
|
51
53
|
}`
|