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.
| * |
| 6 | * A reference identifies a workspace object without knowing how to render |
| 7 | * it: hosts resolve presentation per kind (file → FilePreview, member → |
| 8 | * UserChip, app_record → the owning app's registered renderer, task/event → |
| 9 | * native components). The same shape is used by tree UIs, tool result |
| 10 | * cards, and the future `coline.references` API. |
| 11 | */ |
| 12 |
| 13 | const referenceIdSchema = z.string().trim().min(1).max(200); |
| 14 |
| 15 | export const colineReferenceSchema = z.discriminatedUnion("kind", [ |
| 16 | z.object({ kind: z.literal("file"), id: referenceIdSchema }), |
| 17 | z.object({ kind: z.literal("member"), id: referenceIdSchema }), |
| 18 | z.object({ kind: z.literal("app_record"), id: referenceIdSchema }), |
| 19 | z.object({ kind: z.literal("task"), id: referenceIdSchema }), |
| 20 | z.object({ kind: z.literal("event"), id: referenceIdSchema }), |
| 21 | ]); |
| 22 |
| 23 | export type ColineReference = z.infer<typeof colineReferenceSchema>; |
| 24 | export type ColineReferenceKind = ColineReference["kind"]; |
| 25 |