add embedded terminal to code mode (node-pty + xterm)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Arjun 2026-06-12 23:45:38 +05:30 committed by arkml
parent 45100580c9
commit 1632b16dfc
14 changed files with 467 additions and 15 deletions

View file

@ -648,6 +648,51 @@ const ipcSchemas = {
}),
res: z.null(),
},
// ==========================================================================
// Embedded terminal (Code section): one PTY per coding session
// ==========================================================================
// Create-or-attach. Returns the scrollback backlog so a remounted view can
// repaint what happened while it was closed.
'terminal:ensure': {
req: z.object({
id: z.string(),
cwd: z.string(),
cols: z.number().int().positive(),
rows: z.number().int().positive(),
}),
res: z.object({
backlog: z.string(),
running: z.boolean(),
}),
},
'terminal:input': {
req: z.object({
id: z.string(),
data: z.string(),
}),
res: z.object({ success: z.literal(true) }),
},
'terminal:resize': {
req: z.object({
id: z.string(),
cols: z.number().int().positive(),
rows: z.number().int().positive(),
}),
res: z.object({ success: z.literal(true) }),
},
'terminal:dispose': {
req: z.object({ id: z.string() }),
res: z.object({ success: z.literal(true) }),
},
// main → renderer streams
'terminal:data': {
req: z.object({ id: z.string(), data: z.string() }),
res: z.null(),
},
'terminal:exit': {
req: z.object({ id: z.string(), exitCode: z.number() }),
res: z.null(),
},
'granola:setConfig': {
req: z.object({
enabled: z.boolean(),