diff options
| author | Igor Soarez <igor@soarez.org> | 2026-11-05 19:45:08 +0200 |
|---|---|---|
| committer | Igor Soarez <igor@soarez.org> | 2026-11-05 19:45:08 +0200 |
| commit | 9575ead9c637a2dc482c00f417a1d784d46e076a (patch) | |
| tree | a47abc5722d4f978e7c94428e06634e88101152a /crates/dinggerd/assets/pi | |
| parent | 5842b093cc502b46076423e4f8efdbbc568f86aa (diff) | |
name pi agents by their reported session name, not the terminal title; scroll a panel list taller than the screen
Diffstat (limited to 'crates/dinggerd/assets/pi')
| -rw-r--r-- | crates/dinggerd/assets/pi/pi-agent-state.ts | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/crates/dinggerd/assets/pi/pi-agent-state.ts b/crates/dinggerd/assets/pi/pi-agent-state.ts index ceac45b..0575ba9 100644 --- a/crates/dinggerd/assets/pi/pi-agent-state.ts +++ b/crates/dinggerd/assets/pi/pi-agent-state.ts @@ -119,6 +119,9 @@ let draft = ""; // How full the context window is, in percent, as pi's footer shows it; // "" when unknown (right after compacting, before the next reply). let context = ""; +// The session's name ("" for none): dingger shows it as the agent's name, +// whatever the terminal title says. +let sessionName = ""; const draftDir = path.join(path.dirname(socketPath), "drafts"); // Enough to find the agent by it; the file keeps all of it. const reportedDraftChars = 500; @@ -212,6 +215,7 @@ async function report(state: AgentState | undefined, message?: string, end: RunE ...(controlListening ? { control: controlPath } : {}), draft: draft.slice(0, reportedDraftChars), context, + name: sessionName, seq: Date.now() * 1000, ...(sessionFile ? { agent_session_path: sessionFile } : {}), }, @@ -563,8 +567,9 @@ export default function (pi) { // Each session has its own: /new starts at normal, /resume brings its own back. importance = savedImportance(ctx); announceImportance(); - // The report below carries it. + // The reports below carry them. checkContext(ctx, true); + sessionName = pi.getSessionName?.() ?? ""; publishState(true); }); @@ -588,6 +593,12 @@ export default function (pi) { }); } + // /name, or a name given by an extension. + pi.on("session_info_changed", (event) => { + sessionName = event?.name ?? ""; + void report(undefined); + }); + pi.on("agent_settled", (event, ctx) => { latestCtx = ctx; if (ctx?.isIdle?.() !== true) { |
