Fix caveman: pi.setStatus -> ctx.ui.setStatus
This commit is contained in:
@@ -88,32 +88,9 @@ export default function (pi: ExtensionAPI): void {
|
|||||||
// ── State ──
|
// ── State ──
|
||||||
let state = readState();
|
let state = readState();
|
||||||
|
|
||||||
function applyMode(): void {
|
// ── Footer badge ──
|
||||||
writeState(state);
|
function updateFooter(ctx: { ui: { setStatus: (k: string, v: string) => void } }): void {
|
||||||
if (state.active) {
|
ctx.ui.setStatus("caveman", state.active ? `🦴 caveman:${state.level}` : "");
|
||||||
pi.setStatus("caveman", `🦴 caveman:${state.level}`);
|
|
||||||
// Inject caveman instructions into the system prompt each turn
|
|
||||||
pi.on("before_agent_start", async (_event) => {
|
|
||||||
if (!state.active) return;
|
|
||||||
const skill = getSkillContent();
|
|
||||||
if (!skill) return;
|
|
||||||
return {
|
|
||||||
systemPrompt: `${_event.systemPrompt}\n\n---\nCRITICAL OUTPUT MODE: You are in CAVEMAN MODE. Follow these rules:\n\n${skill}`,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// Clear any previous status
|
|
||||||
// (constructor-style state means we can't easily unregister)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ── Footer badge (always shown) ──
|
|
||||||
function updateFooter(): void {
|
|
||||||
if (state.active) {
|
|
||||||
pi.setStatus("caveman", `🦴 caveman:${state.level}`);
|
|
||||||
} else {
|
|
||||||
pi.setStatus("caveman", "");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── /caveman command ────────────────────────────────────────────────
|
// ── /caveman command ────────────────────────────────────────────────
|
||||||
@@ -169,7 +146,7 @@ export default function (pi: ExtensionAPI): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
writeState(state);
|
writeState(state);
|
||||||
updateFooter();
|
updateFooter(ctx);
|
||||||
|
|
||||||
// Inject skill content as a user message when activating
|
// Inject skill content as a user message when activating
|
||||||
if (state.active) {
|
if (state.active) {
|
||||||
@@ -186,10 +163,10 @@ export default function (pi: ExtensionAPI): void {
|
|||||||
|
|
||||||
// ── Startup ─────────────────────────────────────────────────────────
|
// ── Startup ─────────────────────────────────────────────────────────
|
||||||
|
|
||||||
pi.on("session_start", async () => {
|
pi.on("session_start", async (_event, ctx) => {
|
||||||
// Re-read state (may have changed externally)
|
// Re-read state (may have changed externally)
|
||||||
state = readState();
|
state = readState();
|
||||||
updateFooter();
|
updateFooter(ctx);
|
||||||
|
|
||||||
// If active, inject skill into agent context
|
// If active, inject skill into agent context
|
||||||
if (state.active) {
|
if (state.active) {
|
||||||
@@ -221,6 +198,4 @@ export default function (pi: ExtensionAPI): void {
|
|||||||
writeState(state);
|
writeState(state);
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── Apply initial mode ──────────────────────────────────────────────
|
|
||||||
applyMode();
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user