@fiale-plus/pi-rogue-advisor 0.1.0 → 0.1.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.
@@ -0,0 +1 @@
1
+ export { default, registerAdvisor } from "../src/extension.js";
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "@fiale-plus/pi-rogue-advisor",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "PiRogue advisor extension for Pi — multi-model support, SOTA model suggestion, cache-aware session advisory.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
- "repository": "https://github.com/fiale-plus/pi-rogue",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/fiale-plus/pi-rogue.git"
10
+ },
8
11
  "keywords": [
9
12
  "pi-package"
10
13
  ],
@@ -14,7 +17,7 @@
14
17
  },
15
18
  "pi": {
16
19
  "extensions": [
17
- "./src/extension.ts"
20
+ "./advisor"
18
21
  ],
19
22
  "skills": [
20
23
  "./skills"
@@ -32,6 +35,7 @@
32
35
  "access": "public"
33
36
  },
34
37
  "files": [
38
+ "advisor",
35
39
  "src",
36
40
  "skills",
37
41
  "assets",
package/src/extension.ts CHANGED
@@ -114,7 +114,7 @@ function loadState(): SessionState {
114
114
  return {
115
115
  turns: raw.turns ?? 0,
116
116
  lastTask: raw.lastTask ?? "",
117
- notes: (raw.notes ?? []).slice(-MAX_NOTES),
117
+ notes: (raw.notes ?? []).map(noteText).filter(Boolean).slice(-MAX_NOTES),
118
118
  files: (raw.files ?? []).slice(-MAX_FILES),
119
119
  errors: (raw.errors ?? []).slice(-MAX_ERRORS),
120
120
  advisorCalls: raw.advisorCalls ?? 0,
@@ -178,6 +178,14 @@ function squish(t: unknown, max = 200): string {
178
178
  return s.length <= max ? s : s.slice(0, max - 1).trimEnd() + "…";
179
179
  }
180
180
 
181
+ function noteText(note: unknown): string {
182
+ const text = contentText(note);
183
+ if (/^\[object Object\](,\[object Object\])*$/.test(text)) return "";
184
+ if (text) return squish(text, 500);
185
+ if (note && typeof note === "object") return squish(JSON.stringify(note), 500);
186
+ return text;
187
+ }
188
+
181
189
  type AdvisorHintDetails = {
182
190
  decision?: "continue" | "review" | "defer";
183
191
  reason?: string;
@@ -497,7 +505,7 @@ export function registerAdvisor(pi: ExtensionAPI): void {
497
505
  const tools = (event.toolResults || []).map((t: any) => String(t?.toolName || t?.name || "tool"));
498
506
  const fileChanged = tools.some((t: string) => /^(edit|write)$/i.test(t));
499
507
  const failed = (event.toolResults || []).some((t: any) => isActualFailure(t));
500
- const text = squish(event.message?.content || "");
508
+ const text = squish(contentText(event.message?.content));
501
509
  if (text && text !== state.notes[state.notes.length - 1]) state.notes.push(text);
502
510
  saveState(state);
503
511