Files
oh-my-pi/packages/coding-agent/test/fixtures/cli-initial-title-probe.ts
T
roboomp 223122d6b0 fix(cli): generated titles for positional initial messages
Moved automatic title eligibility and persistence into AgentSession so editor and CLI bootstrap submissions share one path.

Added a PTY regression probe covering the positional-message launch flow.

Fixes #7166
2026-07-31 10:28:48 +00:00

22 lines
650 B
TypeScript

import { AgentSession } from "../../src/session/agent-session";
const outputPath = Bun.env.OMP_TITLE_PROBE_PATH;
if (!outputPath) {
throw new Error("OMP_TITLE_PROBE_PATH is required");
}
let generatedFrom: string | undefined;
AgentSession.prototype.generateTitle = (firstMessage: string): Promise<string | null> => {
generatedFrom = firstMessage;
return Promise.resolve("CLI Initial Title");
};
AgentSession.prototype.prompt = async function (): Promise<boolean> {
void Bun.sleep(100).then(async () => {
await Bun.write(outputPath, JSON.stringify({ generatedFrom, sessionName: this.sessionName }));
process.exit(0);
});
return true;
};