import type { ExtensionAPI as _ExtensionAPI } from '@earendil-works/pi-coding-agent'; export default function (pi: _ExtensionAPI) { pi.registerCommand('newp', { description: 'Start a new session with an initial prompt', handler: async (args, ctx) => { if (!args || args.trim().length === 0) { if (ctx.hasUI) ctx.ui.notify('Usage: /newp ', 'error'); return; } const prompt = args.trim(); const result = await ctx.newSession({ withSession: async (newCtx) => { await newCtx.sendUserMessage(prompt); }, }); if (result.cancelled) { if (ctx.hasUI) ctx.ui.notify('New session was cancelled', 'warning'); } }, }); }