pi-caveman 1.0.10 → 1.0.11
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/README.md +1 -1
- package/extensions/caveman.ts +13 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -82,7 +82,7 @@ When active, a status bar displays caveman level and an animated campfire flicke
|
|
|
82
82
|
|
|
83
83
|
## How It Works
|
|
84
84
|
|
|
85
|
-
The extension hooks `before_agent_start` to
|
|
85
|
+
The extension hooks `before_agent_start` to add caveman communication rules at the selected intensity. On Pi hosts with `systemPromptOptions.sections`, it writes a `caveman` section so later extensions can still add their own prompt sections, and removes that section when disabled. Older hosts use whole-prompt replacement, preserving ordered prompt blocks on OMP. Within a session, the active level is stored as a custom session entry and restored on resume. Across sessions, persistent config (`~/.pi/agent/caveman.json` by default, or `$XDG_CONFIG_HOME/pi/agent/caveman.json` when `XDG_CONFIG_HOME` is set; `PI_CODING_AGENT_DIR` overrides both) provides the default level and status bar preference. Auto-clarity rules tell the model to drop caveman mode for security warnings or irreversible actions.
|
|
86
86
|
|
|
87
87
|
## Warning
|
|
88
88
|
|
package/extensions/caveman.ts
CHANGED
|
@@ -439,13 +439,25 @@ export default function caveman(pi: ExtensionAPI) {
|
|
|
439
439
|
|
|
440
440
|
pi.on("before_agent_start", async (event) => {
|
|
441
441
|
await ensureConfigLoaded();
|
|
442
|
-
|
|
442
|
+
// Use a structural check so older Pi/OMP hosts can still use the legacy path.
|
|
443
|
+
const sections = (event as { systemPromptOptions?: { sections?: Record<string, string> } })
|
|
444
|
+
.systemPromptOptions?.sections;
|
|
445
|
+
const hasSections = sections !== null && typeof sections === "object" && !Array.isArray(sections);
|
|
446
|
+
if (level === "off") {
|
|
447
|
+
if (hasSections) delete sections.caveman;
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
443
450
|
const addition =
|
|
444
451
|
level === "micro"
|
|
445
452
|
? MICRO_PROMPT
|
|
446
453
|
: level === "lite"
|
|
447
454
|
? `${INTENSITY.lite}\n\n${SAFETY}`
|
|
448
455
|
: `${BASE}\n\n${INTENSITY[level]}\n\n${SAFETY}`;
|
|
456
|
+
if (hasSections) {
|
|
457
|
+
// Returning a whole prompt freezes it before later handlers add their sections.
|
|
458
|
+
sections.caveman = addition;
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
449
461
|
return {
|
|
450
462
|
systemPrompt: appendSystemPrompt(
|
|
451
463
|
event.systemPrompt as string | string[] | null | undefined,
|
package/package.json
CHANGED