@ian-pascoe/pi-advisor 0.3.3 → 0.3.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 +1 -1
- package/skills/pi-advisor/SKILL.md +1 -0
- package/src/index.ts +15 -7
- package/src/troubleshooting-skill.ts +9 -0
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: pi-advisor
|
|
3
3
|
description: Diagnose Pi Advisor when reviews or advisor_ask are missing, consultation fails, the Advisor is paused, settings are ineffective, backlog waits do not release, or corrective advice is not delivered safely.
|
|
4
4
|
license: MIT
|
|
5
|
+
disable-model-invocation: true
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
# Pi Advisor
|
package/src/index.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { completeAdvisorCommandArguments, parseAdvisorCommand } from "./advisor-
|
|
|
19
19
|
import { AdvisorObserver } from "./advisor-observer.js";
|
|
20
20
|
import { isAdvisorSession, type AdvisorResourceInputs } from "./advisor-session.js";
|
|
21
21
|
import { advisorRuntimeWarning } from "./advisor-runtime.js";
|
|
22
|
+
import { TROUBLESHOOTING_HINT } from "./troubleshooting-skill.js";
|
|
22
23
|
|
|
23
24
|
interface WatchedChild {
|
|
24
25
|
agentId: string;
|
|
@@ -76,13 +77,20 @@ export default function advisor(pi: ExtensionAPI): void {
|
|
|
76
77
|
parameters: askToolParameters,
|
|
77
78
|
executionMode: "sequential",
|
|
78
79
|
execute: async (_id, { message }, signal) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
try {
|
|
81
|
+
const current = observer;
|
|
82
|
+
if (!current)
|
|
83
|
+
throw new Error(
|
|
84
|
+
`${error ?? "Advisor consultation is unavailable"}. Inspect /advisor status, then run /advisor on or correct its configuration.`,
|
|
85
|
+
);
|
|
86
|
+
const answer = await current.consult(message, signal);
|
|
87
|
+
return { content: [{ type: "text", text: answer }], details: {} };
|
|
88
|
+
} catch (cause) {
|
|
89
|
+
// Caller cancellation is not a malfunction the Skill diagnoses.
|
|
90
|
+
if (signal?.aborted) throw cause;
|
|
91
|
+
const text = cause instanceof Error ? cause.message : String(cause);
|
|
92
|
+
throw new Error(`${text}\n\n${TROUBLESHOOTING_HINT}`, { cause });
|
|
93
|
+
}
|
|
86
94
|
},
|
|
87
95
|
});
|
|
88
96
|
askToolRegistered = true;
|
|
@@ -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-advisor/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-advisor troubleshooting Skill at ${TROUBLESHOOTING_SKILL_PATH}.`;
|