pi-sage 0.2.0 → 0.2.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/.pi/extensions/sage/index.ts +17 -9
- package/.pi/extensions/sage/runner.ts +8 -1
- package/README.md +11 -2
- package/package.json +1 -1
|
@@ -45,7 +45,8 @@ const SAGE_GUIDANCE = [
|
|
|
45
45
|
"Do not overuse Sage for routine edits.",
|
|
46
46
|
"Sage is advisory-only: treat output as recommendations and implement changes yourself.",
|
|
47
47
|
"Use one focused Sage question per consultation.",
|
|
48
|
-
"If user explicitly requests Sage/second opinion, prefer at least one Sage consultation unless blocked by hard safety limits."
|
|
48
|
+
"If user explicitly requests Sage/second opinion, prefer at least one Sage consultation unless blocked by hard safety limits.",
|
|
49
|
+
"For `sage_consult` params: `objective` is optional and must be one of debug|design|review|refactor|general (omit if unsure); `urgency` is optional and must be low|medium|high."
|
|
49
50
|
].join("\n- ");
|
|
50
51
|
|
|
51
52
|
export default function registerSageExtension(pi: ExtensionAPI): void {
|
|
@@ -99,6 +100,8 @@ export default function registerSageExtension(pi: ExtensionAPI): void {
|
|
|
99
100
|
promptGuidelines: [
|
|
100
101
|
"Use Sage for high-impact ambiguous tasks or explicit second-opinion requests.",
|
|
101
102
|
"Set force=true when the user explicitly asks for Sage to bypass soft limits.",
|
|
103
|
+
"`objective` is optional: debug|design|review|refactor|general. Omit instead of free text.",
|
|
104
|
+
"`urgency` is optional: low|medium|high.",
|
|
102
105
|
"After Sage returns, synthesize recommendations and continue execution."
|
|
103
106
|
],
|
|
104
107
|
parameters: Type.Object({
|
|
@@ -107,16 +110,21 @@ export default function registerSageExtension(pi: ExtensionAPI): void {
|
|
|
107
110
|
files: Type.Optional(Type.Array(Type.String(), { description: "Relevant file paths" })),
|
|
108
111
|
evidence: Type.Optional(Type.Array(Type.String(), { description: "Logs, errors, or observations" })),
|
|
109
112
|
objective: Type.Optional(
|
|
110
|
-
Type.Union(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
Type.Union(
|
|
114
|
+
[
|
|
115
|
+
Type.Literal("debug"),
|
|
116
|
+
Type.Literal("design"),
|
|
117
|
+
Type.Literal("review"),
|
|
118
|
+
Type.Literal("refactor"),
|
|
119
|
+
Type.Literal("general")
|
|
120
|
+
],
|
|
121
|
+
{ description: "Optional objective: debug | design | review | refactor | general" }
|
|
122
|
+
)
|
|
117
123
|
),
|
|
118
124
|
urgency: Type.Optional(
|
|
119
|
-
Type.Union([Type.Literal("low"), Type.Literal("medium"), Type.Literal("high")]
|
|
125
|
+
Type.Union([Type.Literal("low"), Type.Literal("medium"), Type.Literal("high")], {
|
|
126
|
+
description: "Optional urgency: low | medium | high"
|
|
127
|
+
})
|
|
120
128
|
),
|
|
121
129
|
force: Type.Optional(
|
|
122
130
|
Type.Boolean({ description: "Bypass soft limits for explicit user-requested consultations" })
|
|
@@ -257,8 +257,12 @@ export async function runSageSingleShot(input: SageRunnerInput): Promise<SageRun
|
|
|
257
257
|
throw new Error(`Sage subprocess failed (code ${String(exit.code)}): ${stderrBuffer.trim() || "no stderr"}`);
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
+
if (assistantText.trim().length === 0) {
|
|
261
|
+
throw new Error(`Sage subprocess returned no assistant text (code ${String(exit.code)}): ${stderrBuffer.trim() || "no stderr"}`);
|
|
262
|
+
}
|
|
263
|
+
|
|
260
264
|
return {
|
|
261
|
-
text: assistantText
|
|
265
|
+
text: assistantText,
|
|
262
266
|
latencyMs,
|
|
263
267
|
stopReason,
|
|
264
268
|
usage,
|
|
@@ -311,6 +315,9 @@ function buildPiArgs(model: string, reasoningLevel: ReasoningLevel, cliTools: st
|
|
|
311
315
|
"-p",
|
|
312
316
|
"--no-session",
|
|
313
317
|
"--no-extensions",
|
|
318
|
+
"--no-skills",
|
|
319
|
+
"--no-prompt-templates",
|
|
320
|
+
"--no-themes",
|
|
314
321
|
"--model",
|
|
315
322
|
model,
|
|
316
323
|
"--thinking",
|
package/README.md
CHANGED
|
@@ -17,13 +17,13 @@ Interactive-only advisory Sage extension for Pi.
|
|
|
17
17
|
### Global install (all projects)
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
pi install pi-sage
|
|
20
|
+
pi install npm:pi-sage
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
### Project-local install (current project only)
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
pi install -l pi-sage
|
|
26
|
+
pi install -l npm:pi-sage
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
Then in Pi run:
|
|
@@ -91,3 +91,12 @@ Project settings always override global settings for that project.
|
|
|
91
91
|
|
|
92
92
|
Package name `sage` is already taken on npm.
|
|
93
93
|
`pi-sage` is currently available and is the intended publish name.
|
|
94
|
+
|
|
95
|
+
## Install troubleshooting
|
|
96
|
+
|
|
97
|
+
If `pi install pi-sage` fails with a local-path error (for example `Path does not exist: .../pi-sage`), your Pi version is interpreting bare names as local paths.
|
|
98
|
+
Use the explicit npm source form instead:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
pi install npm:pi-sage
|
|
102
|
+
```
|