Open History to see the last commit
1export type Position = { x: number; y: number; z: number };
2export const MAX_AI_PARTS = 240;
3export type AIGenerationStatus =
4 | "queued"
5 | "designing"
6 | "checking"
7 | "repairing"
8 | "ready"
9 | "failed"
10 | "cancelled"
11 | "accepted";
12export type AIGenerationProgress = {
13 id: string;
14 status: AIGenerationStatus;
15 attempt: number;
16 error: string | null;
17 world: string | null;
18 updated_at?: string;
19 source?: string | null;
20 target?: string | null;
21 activity?: string | null;
22 preview_version?: number;
23 preview?: { parts: Part[]; title: string } | null;
24};
25export type AIGeneration = AIGenerationProgress & {
26 prompt: string;
27 model: string;
28 parts: Part[];
29 blueprint: { title: string; summary: string } | null;
30 target_slug?: string | null;
31 author?: string;
32 author_name?: string;
33 author_color?: string;
34 created_at?: string;
35 piece_count?: number;
36};
37export type AIConversationRow = Omit<AIGeneration, "parts" | "blueprint"> & {
38 title?: string | null;
39 summary?: string | null;
40 blueprint?: AIGeneration["blueprint"];
41};
42export type Part = {
43 id: string;
44 key: string;
45 color: string;
46 position: Position;
47 rotation: number;
48 revision: number;
49 deleted?: boolean;
50};
51export type Connection = {
52 id: string;
53 a: string;
54 b: string;
55 ca: string;
56 cb: string;
57 revision: number;
58};
59export type World = {
60 id: string;
61 slug: string;
62 title: string;
63 generation: number;
64 catalogue: string;
65 status: string;
66};
67export type Member = {
68 id: string;
69 name: string;
70 color: string;
71 role: string;
72 can_reset: boolean;
73};
74export type SceneRow = {
75 kind: string;
76 id: string;
77 slug: string;
78 title: string;
79 generation: number;
80 catalogue: string;
81 status: string;
82 key: string;
83 color: string;
84 x: number;
85 y: number;
86 z: number;
87 rotation: number;
88 revision: number;
89 a: string;
90 b: string;
91 ca: string;
92 cb: string;
93};
94export function sceneEntity(r: SceneRow): World | Part | Connection {
95 if (r.kind === "world")
96 return {
97 id: r.id,
98 slug: r.slug,
99 title: r.title,
100 generation: r.generation,
101 catalogue: r.catalogue,
102 status: r.status,
103 };
104 if (r.kind === "part")
105 return {
106 id: r.id,
107 key: r.key,
108 color: r.color,
109 position: { x: r.x, y: r.y, z: r.z },
110 rotation: r.rotation,
111 revision: r.revision,
112 };
113 return { id: r.id, a: r.a, b: r.b, ca: r.ca, cb: r.cb, revision: r.revision };
114}
115export type Preview = {
116 key: string;
117 color: string;
118 position: Position;
119 rotation: number;
120};
121export type Viewer = {
122 id: string;
123 guest: string;
124 name: string;
125 color: string;
126 selection: string[];
127 preview: Preview | null;
128 cursor: Position | null;
129 generation: number;
130 preview_at: string | null;
131 cursor_at: string | null;
132 expires_at: string;
133};
134export type Edit = {
135 operationId: string;
136 generation: number;
137 action: "edit" | "undo" | "redo";
138 target?: string;
139 changes?: {
140 id: string;
141 expected?: number;
142 key?: string;
143 color?: string;
144 position?: Position;
145 rotation?: number;
146 deleted?: boolean;
147 }[];
148 connections?: { id: string; revision: number }[];
149};
150export type Receipt = {
151 accepted: boolean;
152 operationId: string;
153 generation: number;
154 txid?: string;
155 error?: string;
156 parts?: Part[];
157 history?: { undo: string | null; redo: string | null };
158};
159export const UNIT = 6;
160export const CATALOGUE_VERSION = "workshop-1";
161export const WORLD_LIMIT = 96;
162export const HEIGHT_LIMIT = 96;
163export const BUCKET = 24;