import { z } from "zod/v4"; /** * The universal typed pointer to a workspace object (plan §7.1). * * A reference identifies a workspace object without knowing how to render * it: hosts resolve presentation per kind (file → FilePreview, member → * UserChip, app_record → the owning app's registered renderer, task/event → * native components). The same shape is used by tree UIs, tool result * cards, and the future `coline.references` API. */ const referenceIdSchema = z.string().trim().min(1).max(200); export const colineReferenceSchema = z.discriminatedUnion("kind", [ z.object({ kind: z.literal("file"), id: referenceIdSchema }), z.object({ kind: z.literal("member"), id: referenceIdSchema }), z.object({ kind: z.literal("app_record"), id: referenceIdSchema }), z.object({ kind: z.literal("task"), id: referenceIdSchema }), z.object({ kind: z.literal("event"), id: referenceIdSchema }), ]); export type ColineReference = z.infer; export type ColineReferenceKind = ColineReference["kind"];