Imported as a linear vendor commit so forge rebases do not replay the upstream root tree. git-subtree-dir: third_party/pi git-subtree-split: d981de1229ef899957bbe968bc8dcda02a21f477
18 lines
528 B
TypeScript
18 lines
528 B
TypeScript
/**
|
|
* Displays a status widget showing the system prompt length.
|
|
*
|
|
* Demonstrates ctx.getSystemPrompt() for accessing the effective system prompt.
|
|
*/
|
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
|
|
export default function (pi: ExtensionAPI) {
|
|
pi.on("agent_start", (_event, ctx) => {
|
|
const prompt = ctx.getSystemPrompt();
|
|
ctx.ui.setStatus("system-prompt", `System: ${prompt.length} chars`);
|
|
});
|
|
|
|
pi.on("session_shutdown", (_event, ctx) => {
|
|
ctx.ui.setStatus("system-prompt", undefined);
|
|
});
|
|
}
|