This commit is contained in:
Chris Tate
2026-01-10 11:43:55 -06:00
parent 2d0520b770
commit 9d253da8bd
8 changed files with 527 additions and 62 deletions
+32
View File
@@ -101,6 +101,33 @@ const closeSchema = baseCommandSchema.extend({
action: z.literal('close'),
});
// Tab/Window schemas
const tabNewSchema = baseCommandSchema.extend({
action: z.literal('tab_new'),
});
const tabListSchema = baseCommandSchema.extend({
action: z.literal('tab_list'),
});
const tabSwitchSchema = baseCommandSchema.extend({
action: z.literal('tab_switch'),
index: z.number().nonnegative(),
});
const tabCloseSchema = baseCommandSchema.extend({
action: z.literal('tab_close'),
index: z.number().nonnegative().optional(),
});
const windowNewSchema = baseCommandSchema.extend({
action: z.literal('window_new'),
viewport: z.object({
width: z.number().positive(),
height: z.number().positive(),
}).optional(),
});
// Union schema for all commands
const commandSchema = z.discriminatedUnion('action', [
launchSchema,
@@ -117,6 +144,11 @@ const commandSchema = z.discriminatedUnion('action', [
hoverSchema,
contentSchema,
closeSchema,
tabNewSchema,
tabListSchema,
tabSwitchSchema,
tabCloseSchema,
windowNewSchema,
]);
// Parse result type