The Coline App SDK: apps, tools, file types and surfaces that run inside Coline workspaces, and public websites with Coline Sites. TypeScript, with an in-memory test workspace. MIT.
| 5 | * Command palette contributions (plan §11.1). |
| 6 | * |
| 7 | * A command is a second door into capabilities the app already declares: |
| 8 | * run a tool (the host renders an input form from the tool's schema), |
| 9 | * open a surface, or follow a deep link. |
| 10 | */ |
| 11 |
| 12 | export const commandIdSchema = z |
| 13 | .string() |
| 14 | .trim() |
| 15 | .regex(/^[a-z][a-z0-9-]*$/, "Command ids are lowercase kebab-case.") |
| 16 | .max(120); |
| 17 |
| 18 | export const appCommandTargetSchema = z.discriminatedUnion("kind", [ |
| 19 | z.object({ kind: z.literal("tool"), tool: toolNameSchema }), |
| 20 | z.object({ kind: z.literal("surface"), surface: z.literal("home") }), |
| 21 | z.object({ kind: z.literal("href"), href: z.string().trim().min(1).max(2000) }), |
| 22 | ]); |
| 23 | export type AppCommandTarget = z.infer<typeof appCommandTargetSchema>; |
| 24 |
| 25 | export const appCommandSchema = z.strictObject({ |
| 26 | id: commandIdSchema, |
| 27 | name: z.string().trim().min(1).max(120), |
| 28 | icon: z.string().trim().max(120).optional(), |
| 29 | target: appCommandTargetSchema, |
| 30 | }); |
| 31 |
| 32 | export type AppCommand = z.infer<typeof appCommandSchema>; |
| 33 |