@xom11/whiteboard 0.24.1 → 0.24.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/ai.d.mts +616 -0
- package/dist/ai.d.ts +616 -0
- package/dist/ai.js +1036 -0
- package/dist/ai.js.map +1 -0
- package/dist/ai.mjs +999 -0
- package/dist/ai.mjs.map +1 -0
- package/dist/catalog.json +4 -4
- package/dist/{chunk-4D5CSIJO.mjs → chunk-2WF6KIGF.mjs} +4 -3
- package/dist/chunk-2WF6KIGF.mjs.map +1 -0
- package/dist/{chunk-WWMQ2VHZ.mjs → chunk-45CGKJ7S.mjs} +4 -4
- package/dist/{chunk-WWMQ2VHZ.mjs.map → chunk-45CGKJ7S.mjs.map} +1 -1
- package/dist/{chunk-CRAPWQKJ.mjs → chunk-4DS3MKID.mjs} +4 -4
- package/dist/{chunk-CRAPWQKJ.mjs.map → chunk-4DS3MKID.mjs.map} +1 -1
- package/dist/chunk-73Q7ADVL.mjs +35 -0
- package/dist/chunk-73Q7ADVL.mjs.map +1 -0
- package/dist/{chunk-YIPI3WUL.mjs → chunk-7WQXXEVR.mjs} +4 -4
- package/dist/{chunk-YIPI3WUL.mjs.map → chunk-7WQXXEVR.mjs.map} +1 -1
- package/dist/{chunk-CSCF3YFZ.mjs → chunk-BEZSQKPY.mjs} +4 -3
- package/dist/chunk-BEZSQKPY.mjs.map +1 -0
- package/dist/{chunk-MFOGFFIL.mjs → chunk-CGZZO4BX.mjs} +5 -4
- package/dist/chunk-CGZZO4BX.mjs.map +1 -0
- package/dist/{chunk-IBTRMWD6.mjs → chunk-KRC2XOIG.mjs} +3 -3
- package/dist/{chunk-IBTRMWD6.mjs.map → chunk-KRC2XOIG.mjs.map} +1 -1
- package/dist/{chunk-6V4SH4JJ.mjs → chunk-WM2VDYQA.mjs} +4 -34
- package/dist/chunk-WM2VDYQA.mjs.map +1 -0
- package/dist/geometry-2d.d.mts +2 -1
- package/dist/geometry-2d.d.ts +2 -1
- package/dist/geometry-2d.mjs +5 -4
- package/dist/geometry-3d.d.mts +2 -1
- package/dist/geometry-3d.d.ts +2 -1
- package/dist/geometry-3d.mjs +4 -3
- package/dist/graph-2d.d.mts +2 -1
- package/dist/graph-2d.d.ts +2 -1
- package/dist/graph-2d.mjs +4 -3
- package/dist/{host-DOAYVL35.mjs → host-EPZCNFLH.mjs} +8 -7
- package/dist/host-EPZCNFLH.mjs.map +1 -0
- package/dist/{host-GKNQBBUE.mjs → host-LKCMYEAV.mjs} +7 -6
- package/dist/host-LKCMYEAV.mjs.map +1 -0
- package/dist/{host-TLIXN4CF.mjs → host-ZIQ77W33.mjs} +6 -5
- package/dist/host-ZIQ77W33.mjs.map +1 -0
- package/dist/index.d.mts +4 -616
- package/dist/index.d.ts +4 -616
- package/dist/index.js +28 -1028
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -1009
- package/dist/index.mjs.map +1 -1
- package/dist/latex.d.mts +2 -1
- package/dist/latex.d.ts +2 -1
- package/dist/serialize-JAVOU22E.mjs +7 -0
- package/dist/{serialize-3NZS6A6Q.mjs.map → serialize-JAVOU22E.mjs.map} +1 -1
- package/dist/{types-rA4slL08.d.mts → types-Crbefnfe.d.ts} +2 -49
- package/dist/types-DxlMPh-6.d.mts +49 -0
- package/dist/types-DxlMPh-6.d.ts +49 -0
- package/dist/{types-rA4slL08.d.ts → types-vtvyKGAA.d.mts} +2 -49
- package/package.json +6 -1
- package/dist/chunk-4D5CSIJO.mjs.map +0 -1
- package/dist/chunk-6V4SH4JJ.mjs.map +0 -1
- package/dist/chunk-CSCF3YFZ.mjs.map +0 -1
- package/dist/chunk-MFOGFFIL.mjs.map +0 -1
- package/dist/host-DOAYVL35.mjs.map +0 -1
- package/dist/host-GKNQBBUE.mjs.map +0 -1
- package/dist/host-TLIXN4CF.mjs.map +0 -1
- package/dist/serialize-3NZS6A6Q.mjs +0 -6
package/README.md
CHANGED
|
@@ -88,7 +88,7 @@ export function ClassroomBoard() {
|
|
|
88
88
|
Ví dụ route phía server trong Next.js:
|
|
89
89
|
|
|
90
90
|
```ts
|
|
91
|
-
import { generateFigure } from '@xom11/whiteboard';
|
|
91
|
+
import { generateFigure } from '@xom11/whiteboard/ai';
|
|
92
92
|
|
|
93
93
|
export async function POST(request: Request) {
|
|
94
94
|
const { problem } = await request.json();
|
package/dist/ai.d.mts
ADDED
|
@@ -0,0 +1,616 @@
|
|
|
1
|
+
import { S as State } from './types-DxlMPh-6.mjs';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
declare const DslInput: z.ZodObject<{
|
|
5
|
+
version: z.ZodLiteral<1>;
|
|
6
|
+
points: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
kind: z.ZodLiteral<"free">;
|
|
9
|
+
x: z.ZodNumber;
|
|
10
|
+
y: z.ZodNumber;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
kind: "free";
|
|
13
|
+
name: string;
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
}, {
|
|
17
|
+
kind: "free";
|
|
18
|
+
name: string;
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
}>, z.ZodObject<{
|
|
22
|
+
name: z.ZodString;
|
|
23
|
+
kind: z.ZodLiteral<"midpoint">;
|
|
24
|
+
p1: z.ZodString;
|
|
25
|
+
p2: z.ZodString;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
kind: "midpoint";
|
|
28
|
+
name: string;
|
|
29
|
+
p1: string;
|
|
30
|
+
p2: string;
|
|
31
|
+
}, {
|
|
32
|
+
kind: "midpoint";
|
|
33
|
+
name: string;
|
|
34
|
+
p1: string;
|
|
35
|
+
p2: string;
|
|
36
|
+
}>, z.ZodObject<{
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
kind: z.ZodLiteral<"onSegment">;
|
|
39
|
+
segmentId: z.ZodString;
|
|
40
|
+
t: z.ZodNumber;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
kind: "onSegment";
|
|
43
|
+
name: string;
|
|
44
|
+
segmentId: string;
|
|
45
|
+
t: number;
|
|
46
|
+
}, {
|
|
47
|
+
kind: "onSegment";
|
|
48
|
+
name: string;
|
|
49
|
+
segmentId: string;
|
|
50
|
+
t: number;
|
|
51
|
+
}>, z.ZodObject<{
|
|
52
|
+
name: z.ZodString;
|
|
53
|
+
kind: z.ZodLiteral<"onLine">;
|
|
54
|
+
lineId: z.ZodString;
|
|
55
|
+
t: z.ZodNumber;
|
|
56
|
+
}, "strip", z.ZodTypeAny, {
|
|
57
|
+
kind: "onLine";
|
|
58
|
+
name: string;
|
|
59
|
+
t: number;
|
|
60
|
+
lineId: string;
|
|
61
|
+
}, {
|
|
62
|
+
kind: "onLine";
|
|
63
|
+
name: string;
|
|
64
|
+
t: number;
|
|
65
|
+
lineId: string;
|
|
66
|
+
}>, z.ZodObject<{
|
|
67
|
+
name: z.ZodString;
|
|
68
|
+
kind: z.ZodLiteral<"onCircle">;
|
|
69
|
+
circleId: z.ZodString;
|
|
70
|
+
theta: z.ZodNumber;
|
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
|
72
|
+
kind: "onCircle";
|
|
73
|
+
name: string;
|
|
74
|
+
circleId: string;
|
|
75
|
+
theta: number;
|
|
76
|
+
}, {
|
|
77
|
+
kind: "onCircle";
|
|
78
|
+
name: string;
|
|
79
|
+
circleId: string;
|
|
80
|
+
theta: number;
|
|
81
|
+
}>, z.ZodObject<{
|
|
82
|
+
name: z.ZodString;
|
|
83
|
+
kind: z.ZodLiteral<"perpFoot">;
|
|
84
|
+
from: z.ZodString;
|
|
85
|
+
onLine: z.ZodString;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
kind: "perpFoot";
|
|
88
|
+
name: string;
|
|
89
|
+
onLine: string;
|
|
90
|
+
from: string;
|
|
91
|
+
}, {
|
|
92
|
+
kind: "perpFoot";
|
|
93
|
+
name: string;
|
|
94
|
+
onLine: string;
|
|
95
|
+
from: string;
|
|
96
|
+
}>, z.ZodObject<{
|
|
97
|
+
name: z.ZodString;
|
|
98
|
+
kind: z.ZodLiteral<"circumcenter">;
|
|
99
|
+
vertices: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
|
|
100
|
+
}, "strip", z.ZodTypeAny, {
|
|
101
|
+
kind: "circumcenter";
|
|
102
|
+
name: string;
|
|
103
|
+
vertices: [string, string, string];
|
|
104
|
+
}, {
|
|
105
|
+
kind: "circumcenter";
|
|
106
|
+
name: string;
|
|
107
|
+
vertices: [string, string, string];
|
|
108
|
+
}>, z.ZodObject<{
|
|
109
|
+
name: z.ZodString;
|
|
110
|
+
kind: z.ZodLiteral<"incenter">;
|
|
111
|
+
vertices: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
|
|
112
|
+
}, "strip", z.ZodTypeAny, {
|
|
113
|
+
kind: "incenter";
|
|
114
|
+
name: string;
|
|
115
|
+
vertices: [string, string, string];
|
|
116
|
+
}, {
|
|
117
|
+
kind: "incenter";
|
|
118
|
+
name: string;
|
|
119
|
+
vertices: [string, string, string];
|
|
120
|
+
}>, z.ZodObject<{
|
|
121
|
+
name: z.ZodString;
|
|
122
|
+
kind: z.ZodLiteral<"centroid">;
|
|
123
|
+
vertices: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
|
|
124
|
+
}, "strip", z.ZodTypeAny, {
|
|
125
|
+
kind: "centroid";
|
|
126
|
+
name: string;
|
|
127
|
+
vertices: [string, string, string];
|
|
128
|
+
}, {
|
|
129
|
+
kind: "centroid";
|
|
130
|
+
name: string;
|
|
131
|
+
vertices: [string, string, string];
|
|
132
|
+
}>, z.ZodObject<{
|
|
133
|
+
name: z.ZodString;
|
|
134
|
+
kind: z.ZodLiteral<"orthocenter">;
|
|
135
|
+
vertices: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
|
|
136
|
+
}, "strip", z.ZodTypeAny, {
|
|
137
|
+
kind: "orthocenter";
|
|
138
|
+
name: string;
|
|
139
|
+
vertices: [string, string, string];
|
|
140
|
+
}, {
|
|
141
|
+
kind: "orthocenter";
|
|
142
|
+
name: string;
|
|
143
|
+
vertices: [string, string, string];
|
|
144
|
+
}>, z.ZodObject<{
|
|
145
|
+
name: z.ZodString;
|
|
146
|
+
kind: z.ZodLiteral<"intersection">;
|
|
147
|
+
ref1: z.ZodString;
|
|
148
|
+
ref2: z.ZodString;
|
|
149
|
+
branch: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
|
|
150
|
+
}, "strip", z.ZodTypeAny, {
|
|
151
|
+
kind: "intersection";
|
|
152
|
+
name: string;
|
|
153
|
+
ref1: string;
|
|
154
|
+
ref2: string;
|
|
155
|
+
branch?: 0 | 1 | undefined;
|
|
156
|
+
}, {
|
|
157
|
+
kind: "intersection";
|
|
158
|
+
name: string;
|
|
159
|
+
ref1: string;
|
|
160
|
+
ref2: string;
|
|
161
|
+
branch?: 0 | 1 | undefined;
|
|
162
|
+
}>]>, "many">;
|
|
163
|
+
shapes: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
164
|
+
name: z.ZodString;
|
|
165
|
+
kind: z.ZodLiteral<"segment">;
|
|
166
|
+
p1: z.ZodString;
|
|
167
|
+
p2: z.ZodString;
|
|
168
|
+
}, "strip", z.ZodTypeAny, {
|
|
169
|
+
kind: "segment";
|
|
170
|
+
name: string;
|
|
171
|
+
p1: string;
|
|
172
|
+
p2: string;
|
|
173
|
+
}, {
|
|
174
|
+
kind: "segment";
|
|
175
|
+
name: string;
|
|
176
|
+
p1: string;
|
|
177
|
+
p2: string;
|
|
178
|
+
}>, z.ZodObject<{
|
|
179
|
+
name: z.ZodString;
|
|
180
|
+
kind: z.ZodLiteral<"line">;
|
|
181
|
+
p1: z.ZodString;
|
|
182
|
+
p2: z.ZodString;
|
|
183
|
+
}, "strip", z.ZodTypeAny, {
|
|
184
|
+
kind: "line";
|
|
185
|
+
name: string;
|
|
186
|
+
p1: string;
|
|
187
|
+
p2: string;
|
|
188
|
+
}, {
|
|
189
|
+
kind: "line";
|
|
190
|
+
name: string;
|
|
191
|
+
p1: string;
|
|
192
|
+
p2: string;
|
|
193
|
+
}>, z.ZodObject<{
|
|
194
|
+
name: z.ZodString;
|
|
195
|
+
kind: z.ZodLiteral<"ray">;
|
|
196
|
+
origin: z.ZodString;
|
|
197
|
+
through: z.ZodString;
|
|
198
|
+
}, "strip", z.ZodTypeAny, {
|
|
199
|
+
kind: "ray";
|
|
200
|
+
name: string;
|
|
201
|
+
origin: string;
|
|
202
|
+
through: string;
|
|
203
|
+
}, {
|
|
204
|
+
kind: "ray";
|
|
205
|
+
name: string;
|
|
206
|
+
origin: string;
|
|
207
|
+
through: string;
|
|
208
|
+
}>, z.ZodObject<{
|
|
209
|
+
name: z.ZodString;
|
|
210
|
+
kind: z.ZodLiteral<"polygon">;
|
|
211
|
+
vertices: z.ZodArray<z.ZodString, "many">;
|
|
212
|
+
}, "strip", z.ZodTypeAny, {
|
|
213
|
+
kind: "polygon";
|
|
214
|
+
name: string;
|
|
215
|
+
vertices: string[];
|
|
216
|
+
}, {
|
|
217
|
+
kind: "polygon";
|
|
218
|
+
name: string;
|
|
219
|
+
vertices: string[];
|
|
220
|
+
}>, z.ZodObject<{
|
|
221
|
+
name: z.ZodString;
|
|
222
|
+
kind: z.ZodLiteral<"perpendicular">;
|
|
223
|
+
throughPoint: z.ZodString;
|
|
224
|
+
toLine: z.ZodString;
|
|
225
|
+
}, "strip", z.ZodTypeAny, {
|
|
226
|
+
kind: "perpendicular";
|
|
227
|
+
name: string;
|
|
228
|
+
throughPoint: string;
|
|
229
|
+
toLine: string;
|
|
230
|
+
}, {
|
|
231
|
+
kind: "perpendicular";
|
|
232
|
+
name: string;
|
|
233
|
+
throughPoint: string;
|
|
234
|
+
toLine: string;
|
|
235
|
+
}>, z.ZodObject<{
|
|
236
|
+
name: z.ZodString;
|
|
237
|
+
kind: z.ZodLiteral<"parallel">;
|
|
238
|
+
throughPoint: z.ZodString;
|
|
239
|
+
toLine: z.ZodString;
|
|
240
|
+
}, "strip", z.ZodTypeAny, {
|
|
241
|
+
kind: "parallel";
|
|
242
|
+
name: string;
|
|
243
|
+
throughPoint: string;
|
|
244
|
+
toLine: string;
|
|
245
|
+
}, {
|
|
246
|
+
kind: "parallel";
|
|
247
|
+
name: string;
|
|
248
|
+
throughPoint: string;
|
|
249
|
+
toLine: string;
|
|
250
|
+
}>, z.ZodObject<{
|
|
251
|
+
name: z.ZodString;
|
|
252
|
+
kind: z.ZodLiteral<"perpBisector">;
|
|
253
|
+
p1: z.ZodString;
|
|
254
|
+
p2: z.ZodString;
|
|
255
|
+
}, "strip", z.ZodTypeAny, {
|
|
256
|
+
kind: "perpBisector";
|
|
257
|
+
name: string;
|
|
258
|
+
p1: string;
|
|
259
|
+
p2: string;
|
|
260
|
+
}, {
|
|
261
|
+
kind: "perpBisector";
|
|
262
|
+
name: string;
|
|
263
|
+
p1: string;
|
|
264
|
+
p2: string;
|
|
265
|
+
}>, z.ZodObject<{
|
|
266
|
+
name: z.ZodString;
|
|
267
|
+
kind: z.ZodLiteral<"angleBisector">;
|
|
268
|
+
p1: z.ZodString;
|
|
269
|
+
vertex: z.ZodString;
|
|
270
|
+
p2: z.ZodString;
|
|
271
|
+
}, "strip", z.ZodTypeAny, {
|
|
272
|
+
kind: "angleBisector";
|
|
273
|
+
name: string;
|
|
274
|
+
p1: string;
|
|
275
|
+
p2: string;
|
|
276
|
+
vertex: string;
|
|
277
|
+
}, {
|
|
278
|
+
kind: "angleBisector";
|
|
279
|
+
name: string;
|
|
280
|
+
p1: string;
|
|
281
|
+
p2: string;
|
|
282
|
+
vertex: string;
|
|
283
|
+
}>, z.ZodObject<{
|
|
284
|
+
name: z.ZodString;
|
|
285
|
+
kind: z.ZodLiteral<"tangent">;
|
|
286
|
+
throughPoint: z.ZodString;
|
|
287
|
+
toCircle: z.ZodString;
|
|
288
|
+
branch: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<"on">]>>;
|
|
289
|
+
}, "strip", z.ZodTypeAny, {
|
|
290
|
+
kind: "tangent";
|
|
291
|
+
name: string;
|
|
292
|
+
throughPoint: string;
|
|
293
|
+
toCircle: string;
|
|
294
|
+
branch?: 0 | 1 | "on" | undefined;
|
|
295
|
+
}, {
|
|
296
|
+
kind: "tangent";
|
|
297
|
+
name: string;
|
|
298
|
+
throughPoint: string;
|
|
299
|
+
toCircle: string;
|
|
300
|
+
branch?: 0 | 1 | "on" | undefined;
|
|
301
|
+
}>, z.ZodObject<{
|
|
302
|
+
name: z.ZodString;
|
|
303
|
+
kind: z.ZodLiteral<"circleCP">;
|
|
304
|
+
center: z.ZodString;
|
|
305
|
+
surfacePoint: z.ZodString;
|
|
306
|
+
}, "strip", z.ZodTypeAny, {
|
|
307
|
+
kind: "circleCP";
|
|
308
|
+
name: string;
|
|
309
|
+
center: string;
|
|
310
|
+
surfacePoint: string;
|
|
311
|
+
}, {
|
|
312
|
+
kind: "circleCP";
|
|
313
|
+
name: string;
|
|
314
|
+
center: string;
|
|
315
|
+
surfacePoint: string;
|
|
316
|
+
}>, z.ZodObject<{
|
|
317
|
+
name: z.ZodString;
|
|
318
|
+
kind: z.ZodLiteral<"circle3">;
|
|
319
|
+
p1: z.ZodString;
|
|
320
|
+
p2: z.ZodString;
|
|
321
|
+
p3: z.ZodString;
|
|
322
|
+
}, "strip", z.ZodTypeAny, {
|
|
323
|
+
kind: "circle3";
|
|
324
|
+
name: string;
|
|
325
|
+
p1: string;
|
|
326
|
+
p2: string;
|
|
327
|
+
p3: string;
|
|
328
|
+
}, {
|
|
329
|
+
kind: "circle3";
|
|
330
|
+
name: string;
|
|
331
|
+
p1: string;
|
|
332
|
+
p2: string;
|
|
333
|
+
p3: string;
|
|
334
|
+
}>]>, "many">>;
|
|
335
|
+
}, "strip", z.ZodTypeAny, {
|
|
336
|
+
version: 1;
|
|
337
|
+
points: ({
|
|
338
|
+
kind: "free";
|
|
339
|
+
name: string;
|
|
340
|
+
x: number;
|
|
341
|
+
y: number;
|
|
342
|
+
} | {
|
|
343
|
+
kind: "midpoint";
|
|
344
|
+
name: string;
|
|
345
|
+
p1: string;
|
|
346
|
+
p2: string;
|
|
347
|
+
} | {
|
|
348
|
+
kind: "onSegment";
|
|
349
|
+
name: string;
|
|
350
|
+
segmentId: string;
|
|
351
|
+
t: number;
|
|
352
|
+
} | {
|
|
353
|
+
kind: "onLine";
|
|
354
|
+
name: string;
|
|
355
|
+
t: number;
|
|
356
|
+
lineId: string;
|
|
357
|
+
} | {
|
|
358
|
+
kind: "onCircle";
|
|
359
|
+
name: string;
|
|
360
|
+
circleId: string;
|
|
361
|
+
theta: number;
|
|
362
|
+
} | {
|
|
363
|
+
kind: "perpFoot";
|
|
364
|
+
name: string;
|
|
365
|
+
onLine: string;
|
|
366
|
+
from: string;
|
|
367
|
+
} | {
|
|
368
|
+
kind: "circumcenter";
|
|
369
|
+
name: string;
|
|
370
|
+
vertices: [string, string, string];
|
|
371
|
+
} | {
|
|
372
|
+
kind: "incenter";
|
|
373
|
+
name: string;
|
|
374
|
+
vertices: [string, string, string];
|
|
375
|
+
} | {
|
|
376
|
+
kind: "centroid";
|
|
377
|
+
name: string;
|
|
378
|
+
vertices: [string, string, string];
|
|
379
|
+
} | {
|
|
380
|
+
kind: "orthocenter";
|
|
381
|
+
name: string;
|
|
382
|
+
vertices: [string, string, string];
|
|
383
|
+
} | {
|
|
384
|
+
kind: "intersection";
|
|
385
|
+
name: string;
|
|
386
|
+
ref1: string;
|
|
387
|
+
ref2: string;
|
|
388
|
+
branch?: 0 | 1 | undefined;
|
|
389
|
+
})[];
|
|
390
|
+
shapes: ({
|
|
391
|
+
kind: "segment";
|
|
392
|
+
name: string;
|
|
393
|
+
p1: string;
|
|
394
|
+
p2: string;
|
|
395
|
+
} | {
|
|
396
|
+
kind: "line";
|
|
397
|
+
name: string;
|
|
398
|
+
p1: string;
|
|
399
|
+
p2: string;
|
|
400
|
+
} | {
|
|
401
|
+
kind: "ray";
|
|
402
|
+
name: string;
|
|
403
|
+
origin: string;
|
|
404
|
+
through: string;
|
|
405
|
+
} | {
|
|
406
|
+
kind: "polygon";
|
|
407
|
+
name: string;
|
|
408
|
+
vertices: string[];
|
|
409
|
+
} | {
|
|
410
|
+
kind: "perpendicular";
|
|
411
|
+
name: string;
|
|
412
|
+
throughPoint: string;
|
|
413
|
+
toLine: string;
|
|
414
|
+
} | {
|
|
415
|
+
kind: "parallel";
|
|
416
|
+
name: string;
|
|
417
|
+
throughPoint: string;
|
|
418
|
+
toLine: string;
|
|
419
|
+
} | {
|
|
420
|
+
kind: "perpBisector";
|
|
421
|
+
name: string;
|
|
422
|
+
p1: string;
|
|
423
|
+
p2: string;
|
|
424
|
+
} | {
|
|
425
|
+
kind: "angleBisector";
|
|
426
|
+
name: string;
|
|
427
|
+
p1: string;
|
|
428
|
+
p2: string;
|
|
429
|
+
vertex: string;
|
|
430
|
+
} | {
|
|
431
|
+
kind: "tangent";
|
|
432
|
+
name: string;
|
|
433
|
+
throughPoint: string;
|
|
434
|
+
toCircle: string;
|
|
435
|
+
branch?: 0 | 1 | "on" | undefined;
|
|
436
|
+
} | {
|
|
437
|
+
kind: "circleCP";
|
|
438
|
+
name: string;
|
|
439
|
+
center: string;
|
|
440
|
+
surfacePoint: string;
|
|
441
|
+
} | {
|
|
442
|
+
kind: "circle3";
|
|
443
|
+
name: string;
|
|
444
|
+
p1: string;
|
|
445
|
+
p2: string;
|
|
446
|
+
p3: string;
|
|
447
|
+
})[];
|
|
448
|
+
}, {
|
|
449
|
+
version: 1;
|
|
450
|
+
points: ({
|
|
451
|
+
kind: "free";
|
|
452
|
+
name: string;
|
|
453
|
+
x: number;
|
|
454
|
+
y: number;
|
|
455
|
+
} | {
|
|
456
|
+
kind: "midpoint";
|
|
457
|
+
name: string;
|
|
458
|
+
p1: string;
|
|
459
|
+
p2: string;
|
|
460
|
+
} | {
|
|
461
|
+
kind: "onSegment";
|
|
462
|
+
name: string;
|
|
463
|
+
segmentId: string;
|
|
464
|
+
t: number;
|
|
465
|
+
} | {
|
|
466
|
+
kind: "onLine";
|
|
467
|
+
name: string;
|
|
468
|
+
t: number;
|
|
469
|
+
lineId: string;
|
|
470
|
+
} | {
|
|
471
|
+
kind: "onCircle";
|
|
472
|
+
name: string;
|
|
473
|
+
circleId: string;
|
|
474
|
+
theta: number;
|
|
475
|
+
} | {
|
|
476
|
+
kind: "perpFoot";
|
|
477
|
+
name: string;
|
|
478
|
+
onLine: string;
|
|
479
|
+
from: string;
|
|
480
|
+
} | {
|
|
481
|
+
kind: "circumcenter";
|
|
482
|
+
name: string;
|
|
483
|
+
vertices: [string, string, string];
|
|
484
|
+
} | {
|
|
485
|
+
kind: "incenter";
|
|
486
|
+
name: string;
|
|
487
|
+
vertices: [string, string, string];
|
|
488
|
+
} | {
|
|
489
|
+
kind: "centroid";
|
|
490
|
+
name: string;
|
|
491
|
+
vertices: [string, string, string];
|
|
492
|
+
} | {
|
|
493
|
+
kind: "orthocenter";
|
|
494
|
+
name: string;
|
|
495
|
+
vertices: [string, string, string];
|
|
496
|
+
} | {
|
|
497
|
+
kind: "intersection";
|
|
498
|
+
name: string;
|
|
499
|
+
ref1: string;
|
|
500
|
+
ref2: string;
|
|
501
|
+
branch?: 0 | 1 | undefined;
|
|
502
|
+
})[];
|
|
503
|
+
shapes?: ({
|
|
504
|
+
kind: "segment";
|
|
505
|
+
name: string;
|
|
506
|
+
p1: string;
|
|
507
|
+
p2: string;
|
|
508
|
+
} | {
|
|
509
|
+
kind: "line";
|
|
510
|
+
name: string;
|
|
511
|
+
p1: string;
|
|
512
|
+
p2: string;
|
|
513
|
+
} | {
|
|
514
|
+
kind: "ray";
|
|
515
|
+
name: string;
|
|
516
|
+
origin: string;
|
|
517
|
+
through: string;
|
|
518
|
+
} | {
|
|
519
|
+
kind: "polygon";
|
|
520
|
+
name: string;
|
|
521
|
+
vertices: string[];
|
|
522
|
+
} | {
|
|
523
|
+
kind: "perpendicular";
|
|
524
|
+
name: string;
|
|
525
|
+
throughPoint: string;
|
|
526
|
+
toLine: string;
|
|
527
|
+
} | {
|
|
528
|
+
kind: "parallel";
|
|
529
|
+
name: string;
|
|
530
|
+
throughPoint: string;
|
|
531
|
+
toLine: string;
|
|
532
|
+
} | {
|
|
533
|
+
kind: "perpBisector";
|
|
534
|
+
name: string;
|
|
535
|
+
p1: string;
|
|
536
|
+
p2: string;
|
|
537
|
+
} | {
|
|
538
|
+
kind: "angleBisector";
|
|
539
|
+
name: string;
|
|
540
|
+
p1: string;
|
|
541
|
+
p2: string;
|
|
542
|
+
vertex: string;
|
|
543
|
+
} | {
|
|
544
|
+
kind: "tangent";
|
|
545
|
+
name: string;
|
|
546
|
+
throughPoint: string;
|
|
547
|
+
toCircle: string;
|
|
548
|
+
branch?: 0 | 1 | "on" | undefined;
|
|
549
|
+
} | {
|
|
550
|
+
kind: "circleCP";
|
|
551
|
+
name: string;
|
|
552
|
+
center: string;
|
|
553
|
+
surfacePoint: string;
|
|
554
|
+
} | {
|
|
555
|
+
kind: "circle3";
|
|
556
|
+
name: string;
|
|
557
|
+
p1: string;
|
|
558
|
+
p2: string;
|
|
559
|
+
p3: string;
|
|
560
|
+
})[] | undefined;
|
|
561
|
+
}>;
|
|
562
|
+
type DslInputT = z.infer<typeof DslInput>;
|
|
563
|
+
|
|
564
|
+
type TranspileErrorCode = 'SCHEMA' | 'DUPLICATE_NAME' | 'UNKNOWN_REF' | 'KIND_MISMATCH' | 'CYCLE';
|
|
565
|
+
interface TranspileError {
|
|
566
|
+
code: TranspileErrorCode;
|
|
567
|
+
message: string;
|
|
568
|
+
path?: string[];
|
|
569
|
+
hint?: string;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
interface GenerateOptions {
|
|
573
|
+
apiKey: string;
|
|
574
|
+
model?: string;
|
|
575
|
+
maxTokens?: number;
|
|
576
|
+
enableCaching?: boolean;
|
|
577
|
+
signal?: AbortSignal;
|
|
578
|
+
}
|
|
579
|
+
interface TokenUsage {
|
|
580
|
+
inputTokens: number;
|
|
581
|
+
outputTokens: number;
|
|
582
|
+
cacheReadTokens: number;
|
|
583
|
+
cacheCreationTokens: number;
|
|
584
|
+
}
|
|
585
|
+
type GenerateResult = {
|
|
586
|
+
ok: true;
|
|
587
|
+
state: State;
|
|
588
|
+
dsl: DslInputT;
|
|
589
|
+
usage: TokenUsage;
|
|
590
|
+
} | {
|
|
591
|
+
ok: false;
|
|
592
|
+
reason: 'refused';
|
|
593
|
+
message: string;
|
|
594
|
+
usage?: TokenUsage;
|
|
595
|
+
} | {
|
|
596
|
+
ok: false;
|
|
597
|
+
reason: 'parse_error';
|
|
598
|
+
message: string;
|
|
599
|
+
raw?: unknown;
|
|
600
|
+
usage?: TokenUsage;
|
|
601
|
+
} | {
|
|
602
|
+
ok: false;
|
|
603
|
+
reason: 'transpile_error';
|
|
604
|
+
message: string;
|
|
605
|
+
errors: TranspileError[];
|
|
606
|
+
dsl: unknown;
|
|
607
|
+
usage?: TokenUsage;
|
|
608
|
+
} | {
|
|
609
|
+
ok: false;
|
|
610
|
+
reason: 'api_error';
|
|
611
|
+
message: string;
|
|
612
|
+
status?: number;
|
|
613
|
+
};
|
|
614
|
+
declare function generateFigure(problem: string, opts: GenerateOptions): Promise<GenerateResult>;
|
|
615
|
+
|
|
616
|
+
export { type GenerateOptions, type GenerateResult, type TokenUsage, generateFigure };
|