Merge commit '67b361f0e99135c578d5764c915b413f457dd67a' as 'third_party/pi'
This commit is contained in:
17
third_party/pi/packages/coding-agent/examples/extensions/system-prompt-header.ts
vendored
Normal file
17
third_party/pi/packages/coding-agent/examples/extensions/system-prompt-header.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* 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);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user