@xom11/whiteboard 0.25.0 → 0.27.0

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.
Files changed (93) hide show
  1. package/dist/{ExcalidrawWithMenus-WENZRYYE.mjs → ExcalidrawWithMenus-2QPPTXJM.mjs} +3 -2
  2. package/dist/ExcalidrawWithMenus-2QPPTXJM.mjs.map +1 -0
  3. package/dist/ai.d.mts +3035 -108
  4. package/dist/ai.d.ts +3035 -108
  5. package/dist/ai.js +6736 -775
  6. package/dist/ai.js.map +1 -1
  7. package/dist/ai.mjs +5110 -578
  8. package/dist/ai.mjs.map +1 -1
  9. package/dist/catalog.json +5 -5
  10. package/dist/{chunk-ESVPQWHX.mjs → chunk-4ETJ4CDY.mjs} +5 -5
  11. package/dist/{chunk-ESVPQWHX.mjs.map → chunk-4ETJ4CDY.mjs.map} +1 -1
  12. package/dist/{chunk-VNCCIV6O.mjs → chunk-AJAHD35N.mjs} +779 -9
  13. package/dist/chunk-AJAHD35N.mjs.map +1 -0
  14. package/dist/chunk-AYJPOHCI.mjs +265 -0
  15. package/dist/chunk-AYJPOHCI.mjs.map +1 -0
  16. package/dist/{chunk-M42TGYT6.mjs → chunk-BNBOIDO5.mjs} +3 -3
  17. package/dist/{chunk-M42TGYT6.mjs.map → chunk-BNBOIDO5.mjs.map} +1 -1
  18. package/dist/{chunk-CJBLJUWG.mjs → chunk-CXHNVYMD.mjs} +4 -4
  19. package/dist/{chunk-CJBLJUWG.mjs.map → chunk-CXHNVYMD.mjs.map} +1 -1
  20. package/dist/{chunk-NDEZJKNY.mjs → chunk-D5JLJ3PT.mjs} +4 -4
  21. package/dist/{chunk-NDEZJKNY.mjs.map → chunk-D5JLJ3PT.mjs.map} +1 -1
  22. package/dist/{chunk-REIJZDVZ.mjs → chunk-D5LWSN2Y.mjs} +942 -195
  23. package/dist/chunk-D5LWSN2Y.mjs.map +1 -0
  24. package/dist/{chunk-I24QOHPU.mjs → chunk-HLAOGXEK.mjs} +3 -3
  25. package/dist/{chunk-I24QOHPU.mjs.map → chunk-HLAOGXEK.mjs.map} +1 -1
  26. package/dist/{chunk-TB4CL25L.mjs → chunk-I3L56GVH.mjs} +206 -66
  27. package/dist/chunk-I3L56GVH.mjs.map +1 -0
  28. package/dist/chunk-J5LGTIGS.mjs +10 -0
  29. package/dist/chunk-J5LGTIGS.mjs.map +1 -0
  30. package/dist/{chunk-ONBCUWVI.mjs → chunk-KYMBUTPO.mjs} +3 -3
  31. package/dist/{chunk-ONBCUWVI.mjs.map → chunk-KYMBUTPO.mjs.map} +1 -1
  32. package/dist/{chunk-YSJOVBCD.mjs → chunk-KZGPSTZI.mjs} +4 -4
  33. package/dist/{chunk-YSJOVBCD.mjs.map → chunk-KZGPSTZI.mjs.map} +1 -1
  34. package/dist/{chunk-SGFJLHHG.mjs → chunk-PPKHCRRE.mjs} +3 -3
  35. package/dist/{chunk-SGFJLHHG.mjs.map → chunk-PPKHCRRE.mjs.map} +1 -1
  36. package/dist/{chunk-AYSFWUPK.mjs → chunk-SZDAS7LK.mjs} +79 -2
  37. package/dist/chunk-SZDAS7LK.mjs.map +1 -0
  38. package/dist/chunk-T3SOHYB2.mjs +851 -0
  39. package/dist/chunk-T3SOHYB2.mjs.map +1 -0
  40. package/dist/geometry-2d.d.mts +1 -1
  41. package/dist/geometry-2d.d.ts +1 -1
  42. package/dist/geometry-2d.js +5389 -1362
  43. package/dist/geometry-2d.js.map +1 -1
  44. package/dist/geometry-2d.mjs +5 -4
  45. package/dist/geometry-3d.d.mts +1 -1
  46. package/dist/geometry-3d.d.ts +1 -1
  47. package/dist/geometry-3d.js +1333 -251
  48. package/dist/geometry-3d.js.map +1 -1
  49. package/dist/geometry-3d.mjs +4 -3
  50. package/dist/graph-2d.d.mts +1 -1
  51. package/dist/graph-2d.d.ts +1 -1
  52. package/dist/graph-2d.js +1499 -340
  53. package/dist/graph-2d.js.map +1 -1
  54. package/dist/graph-2d.mjs +7 -6
  55. package/dist/handleExtractProblem-C-U5KluK.d.mts +158 -0
  56. package/dist/handleExtractProblem-C-U5KluK.d.ts +158 -0
  57. package/dist/{host-L7FMFZUW.mjs → host-HAYCJJ2T.mjs} +1258 -441
  58. package/dist/host-HAYCJJ2T.mjs.map +1 -0
  59. package/dist/{host-QK53UYMD.mjs → host-LTJHAY5A.mjs} +10 -9
  60. package/dist/host-LTJHAY5A.mjs.map +1 -0
  61. package/dist/{host-A64ITWVX.mjs → host-M26FS244.mjs} +6 -5
  62. package/dist/host-M26FS244.mjs.map +1 -0
  63. package/dist/{host-QS2EOTRJ.mjs → host-ZQCDAT6O.mjs} +3 -2
  64. package/dist/host-ZQCDAT6O.mjs.map +1 -0
  65. package/dist/index.d.mts +3 -2
  66. package/dist/index.d.ts +3 -2
  67. package/dist/index.js +5621 -1590
  68. package/dist/index.js.map +1 -1
  69. package/dist/index.mjs +22 -20
  70. package/dist/index.mjs.map +1 -1
  71. package/dist/latex.d.mts +1 -1
  72. package/dist/latex.d.ts +1 -1
  73. package/dist/latex.mjs +2 -1
  74. package/dist/render-ZX2O2IK7.mjs +10 -0
  75. package/dist/{render-3WTY7NZB.mjs.map → render-ZX2O2IK7.mjs.map} +1 -1
  76. package/dist/serialize-C3LSUMSA.mjs +9 -0
  77. package/dist/{serialize-SRJVKYUG.mjs.map → serialize-C3LSUMSA.mjs.map} +1 -1
  78. package/dist/{types-DWRyCa2m.d.ts → types-zc_Pa0mp.d.mts} +105 -0
  79. package/dist/{types-DWRyCa2m.d.mts → types-zc_Pa0mp.d.ts} +105 -0
  80. package/package.json +10 -1
  81. package/dist/ExcalidrawWithMenus-WENZRYYE.mjs.map +0 -1
  82. package/dist/chunk-AYSFWUPK.mjs.map +0 -1
  83. package/dist/chunk-REIJZDVZ.mjs.map +0 -1
  84. package/dist/chunk-TB4CL25L.mjs.map +0 -1
  85. package/dist/chunk-VNCCIV6O.mjs.map +0 -1
  86. package/dist/chunk-VRHWDZ66.mjs +0 -96
  87. package/dist/chunk-VRHWDZ66.mjs.map +0 -1
  88. package/dist/host-A64ITWVX.mjs.map +0 -1
  89. package/dist/host-L7FMFZUW.mjs.map +0 -1
  90. package/dist/host-QK53UYMD.mjs.map +0 -1
  91. package/dist/host-QS2EOTRJ.mjs.map +0 -1
  92. package/dist/render-3WTY7NZB.mjs +0 -9
  93. package/dist/serialize-SRJVKYUG.mjs +0 -8
package/dist/ai.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- import { b as State, D as DslInputT, a as AiFigureUiResult } from './types-DWRyCa2m.js';
1
+ import { b as State, D as DslInputT, a as AiFigureUiResult } from './types-zc_Pa0mp.js';
2
2
  import { z } from 'zod';
3
+ import { A as AIProvider, P as ProviderRequest, a as ProviderOutput, V as VisionRequest, S as SelectProviderOptions, I as ImagePart } from './handleExtractProblem-C-U5KluK.js';
4
+ export { b as ExtractProblemFailure, c as ExtractProblemOptions, d as ExtractProblemOutcome, e as ExtractProblemSuccess, E as ExtractUiResult, H as HandleExtractProblemOptions, f as ProviderTokenUsage, g as extractProblemFromImage, h as handleExtractProblem, p as pickVisionModel, s as selectProvider } from './handleExtractProblem-C-U5KluK.js';
3
5
  import 'react';
4
6
  import '@excalidraw/excalidraw/element/types';
5
7
 
@@ -10,45 +12,13 @@ interface TranspileError {
10
12
  path?: string[];
11
13
  hint?: string;
12
14
  }
13
-
14
- interface ProviderTokenUsage {
15
- inputTokens: number;
16
- outputTokens: number;
17
- /** Anthropic prompt caching — local provider để 0. */
18
- cacheReadTokens?: number;
19
- /** Anthropic prompt caching — local provider để 0. */
20
- cacheCreationTokens?: number;
21
- }
22
- interface ProviderRequest {
23
- systemPrompt: string;
24
- userPrompt: string;
25
- /**
26
- * JSON Schema mà provider phải honor để constrain output. Anthropic → wrap
27
- * thành tool input_schema. Ollama → pass thẳng vào `format` (v0.5+).
28
- */
29
- schema: Record<string, unknown>;
30
- /** Provider-specific model id (vd "gemma3:4b", "claude-opus-4-7"). */
31
- model: string;
32
- /** Token cap cho response. */
33
- maxTokens: number;
34
- signal?: AbortSignal;
35
- }
36
- type ProviderOutput = {
37
- kind: 'json';
38
- data: unknown;
39
- usage?: ProviderTokenUsage;
15
+ type TranspileResult = {
16
+ ok: true;
17
+ state: State;
40
18
  } | {
41
- kind: 'error';
42
- message: string;
43
- status?: number;
19
+ ok: false;
20
+ errors: TranspileError[];
44
21
  };
45
- interface AIProvider {
46
- /** Tên định danh ("anthropic", "ollama", ...). */
47
- readonly name: string;
48
- /** Default model id khi caller không truyền. */
49
- readonly defaultModel: string;
50
- call(req: ProviderRequest): Promise<ProviderOutput>;
51
- }
52
22
 
53
23
  interface AnthropicProviderOptions {
54
24
  apiKey: string;
@@ -61,6 +31,7 @@ declare class AnthropicProvider implements AIProvider {
61
31
  readonly defaultModel = "claude-opus-4-7";
62
32
  constructor(opts: AnthropicProviderOptions);
63
33
  call(req: ProviderRequest): Promise<ProviderOutput>;
34
+ extractText(req: VisionRequest): Promise<ProviderOutput>;
64
35
  }
65
36
 
66
37
  interface OllamaProviderOptions {
@@ -79,110 +50,2922 @@ declare class OllamaProvider implements AIProvider {
79
50
  constructor(opts?: OllamaProviderOptions);
80
51
  private resolveFetch;
81
52
  call(req: ProviderRequest): Promise<ProviderOutput>;
53
+ extractText(req: VisionRequest): Promise<ProviderOutput>;
82
54
  }
83
55
 
84
- interface SelectProviderOptions {
85
- /** Provider instance dùng trực tiếp (override mọi env). */
86
- provider?: AIProvider;
87
- /** Anthropic API key. Khi truyền → auto chọn AnthropicProvider. */
88
- apiKey?: string;
89
- /** Anthropic prompt-caching, default true (chỉ áp dụng provider Anthropic). */
90
- enableCaching?: boolean;
91
- /** Ollama endpoint override. */
92
- ollamaBaseUrl?: string;
93
- /** Ollama model override (vd "gemma3:1b"). */
94
- ollamaDefaultModel?: string;
95
- /** Test env: env vars getter (default process.env). */
96
- env?: Record<string, string | undefined>;
56
+ declare const DrawShapeIntentZ: z.ZodObject<{
57
+ op: z.ZodLiteral<"draw-shape">;
58
+ shape: z.ZodEnum<["triangle", "square", "rectangle", "rhombus", "trapezoid", "parallelogram", "quadrilateral"]>;
59
+ labels: z.ZodArray<z.ZodString, "many">;
60
+ variant: z.ZodDefault<z.ZodEnum<["any", "equilateral", "isoceles-AB", "isoceles-BC", "isoceles-CA", "right-at-A", "right-at-B", "right-at-C", "standard", "wide", "tall", "right", "isoceles", "general"]>>;
61
+ explicitCoords: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
62
+ }, "strip", z.ZodTypeAny, {
63
+ shape: "square" | "rectangle" | "rhombus" | "parallelogram" | "triangle" | "trapezoid" | "quadrilateral";
64
+ op: "draw-shape";
65
+ labels: string[];
66
+ variant: "any" | "equilateral" | "isoceles-AB" | "isoceles-BC" | "isoceles-CA" | "right-at-A" | "right-at-B" | "right-at-C" | "standard" | "wide" | "tall" | "right" | "isoceles" | "general";
67
+ explicitCoords?: Record<string, [number, number]> | undefined;
68
+ }, {
69
+ shape: "square" | "rectangle" | "rhombus" | "parallelogram" | "triangle" | "trapezoid" | "quadrilateral";
70
+ op: "draw-shape";
71
+ labels: string[];
72
+ variant?: "any" | "equilateral" | "isoceles-AB" | "isoceles-BC" | "isoceles-CA" | "right-at-A" | "right-at-B" | "right-at-C" | "standard" | "wide" | "tall" | "right" | "isoceles" | "general" | undefined;
73
+ explicitCoords?: Record<string, [number, number]> | undefined;
74
+ }>;
75
+ declare const AddPointIntentZ: z.ZodObject<{
76
+ op: z.ZodLiteral<"add-point">;
77
+ name: z.ZodString;
78
+ constraint: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
79
+ kind: z.ZodLiteral<"midpoint">;
80
+ of: z.ZodString;
81
+ }, "strip", z.ZodTypeAny, {
82
+ kind: "midpoint";
83
+ of: string;
84
+ }, {
85
+ kind: "midpoint";
86
+ of: string;
87
+ }>, z.ZodObject<{
88
+ kind: z.ZodLiteral<"perpFoot">;
89
+ from: z.ZodString;
90
+ onLine: z.ZodString;
91
+ }, "strip", z.ZodTypeAny, {
92
+ kind: "perpFoot";
93
+ onLine: string;
94
+ from: string;
95
+ }, {
96
+ kind: "perpFoot";
97
+ onLine: string;
98
+ from: string;
99
+ }>, z.ZodObject<{
100
+ kind: z.ZodLiteral<"centroid">;
101
+ of: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
102
+ }, "strip", z.ZodTypeAny, {
103
+ kind: "centroid";
104
+ of: [string, string, string];
105
+ }, {
106
+ kind: "centroid";
107
+ of: [string, string, string];
108
+ }>, z.ZodObject<{
109
+ kind: z.ZodLiteral<"circumcenter">;
110
+ of: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
111
+ }, "strip", z.ZodTypeAny, {
112
+ kind: "circumcenter";
113
+ of: [string, string, string];
114
+ }, {
115
+ kind: "circumcenter";
116
+ of: [string, string, string];
117
+ }>, z.ZodObject<{
118
+ kind: z.ZodLiteral<"incenter">;
119
+ of: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
120
+ }, "strip", z.ZodTypeAny, {
121
+ kind: "incenter";
122
+ of: [string, string, string];
123
+ }, {
124
+ kind: "incenter";
125
+ of: [string, string, string];
126
+ }>, z.ZodObject<{
127
+ kind: z.ZodLiteral<"orthocenter">;
128
+ of: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
129
+ }, "strip", z.ZodTypeAny, {
130
+ kind: "orthocenter";
131
+ of: [string, string, string];
132
+ }, {
133
+ kind: "orthocenter";
134
+ of: [string, string, string];
135
+ }>, z.ZodObject<{
136
+ kind: z.ZodLiteral<"intersection">;
137
+ of: z.ZodTuple<[z.ZodString, z.ZodString], null>;
138
+ branch: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
139
+ }, "strip", z.ZodTypeAny, {
140
+ kind: "intersection";
141
+ of: [string, string];
142
+ branch?: 0 | 1 | undefined;
143
+ }, {
144
+ kind: "intersection";
145
+ of: [string, string];
146
+ branch?: 0 | 1 | undefined;
147
+ }>, z.ZodObject<{
148
+ kind: z.ZodLiteral<"onSegment">;
149
+ of: z.ZodString;
150
+ t: z.ZodOptional<z.ZodNumber>;
151
+ }, "strip", z.ZodTypeAny, {
152
+ kind: "onSegment";
153
+ of: string;
154
+ t?: number | undefined;
155
+ }, {
156
+ kind: "onSegment";
157
+ of: string;
158
+ t?: number | undefined;
159
+ }>, z.ZodObject<{
160
+ kind: z.ZodLiteral<"free">;
161
+ at: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
162
+ }, "strip", z.ZodTypeAny, {
163
+ kind: "free";
164
+ at?: [number, number] | undefined;
165
+ }, {
166
+ kind: "free";
167
+ at?: [number, number] | undefined;
168
+ }>, z.ZodObject<{
169
+ kind: z.ZodLiteral<"externalToCircle">;
170
+ circle: z.ZodString;
171
+ }, "strip", z.ZodTypeAny, {
172
+ kind: "externalToCircle";
173
+ circle: string;
174
+ }, {
175
+ kind: "externalToCircle";
176
+ circle: string;
177
+ }>, z.ZodObject<{
178
+ kind: z.ZodLiteral<"onCircle">;
179
+ circle: z.ZodString;
180
+ theta: z.ZodOptional<z.ZodNumber>;
181
+ }, "strip", z.ZodTypeAny, {
182
+ kind: "onCircle";
183
+ circle: string;
184
+ theta?: number | undefined;
185
+ }, {
186
+ kind: "onCircle";
187
+ circle: string;
188
+ theta?: number | undefined;
189
+ }>, z.ZodObject<{
190
+ kind: z.ZodLiteral<"secondIntersection">;
191
+ line: z.ZodString;
192
+ circle: z.ZodString;
193
+ other: z.ZodString;
194
+ }, "strip", z.ZodTypeAny, {
195
+ kind: "secondIntersection";
196
+ line: string;
197
+ circle: string;
198
+ other: string;
199
+ }, {
200
+ kind: "secondIntersection";
201
+ line: string;
202
+ circle: string;
203
+ other: string;
204
+ }>, z.ZodObject<{
205
+ kind: z.ZodLiteral<"circleIntersection">;
206
+ c1: z.ZodString;
207
+ c2: z.ZodString;
208
+ which: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
209
+ }, "strip", z.ZodTypeAny, {
210
+ kind: "circleIntersection";
211
+ c1: string;
212
+ c2: string;
213
+ which: 0 | 1;
214
+ }, {
215
+ kind: "circleIntersection";
216
+ c1: string;
217
+ c2: string;
218
+ which: 0 | 1;
219
+ }>, z.ZodObject<{
220
+ kind: z.ZodLiteral<"circleSecondIntersection">;
221
+ c1: z.ZodString;
222
+ c2: z.ZodString;
223
+ exclude: z.ZodString;
224
+ }, "strip", z.ZodTypeAny, {
225
+ kind: "circleSecondIntersection";
226
+ c1: string;
227
+ c2: string;
228
+ exclude: string;
229
+ }, {
230
+ kind: "circleSecondIntersection";
231
+ c1: string;
232
+ c2: string;
233
+ exclude: string;
234
+ }>, z.ZodObject<{
235
+ kind: z.ZodLiteral<"tangencyPoint">;
236
+ circle: z.ZodString;
237
+ onLine: z.ZodString;
238
+ }, "strip", z.ZodTypeAny, {
239
+ kind: "tangencyPoint";
240
+ circle: string;
241
+ onLine: string;
242
+ }, {
243
+ kind: "tangencyPoint";
244
+ circle: string;
245
+ onLine: string;
246
+ }>, z.ZodObject<{
247
+ kind: z.ZodLiteral<"tangentPoint">;
248
+ from: z.ZodString;
249
+ circle: z.ZodString;
250
+ which: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
251
+ }, "strip", z.ZodTypeAny, {
252
+ kind: "tangentPoint";
253
+ circle: string;
254
+ from: string;
255
+ which: 0 | 1;
256
+ }, {
257
+ kind: "tangentPoint";
258
+ circle: string;
259
+ from: string;
260
+ which: 0 | 1;
261
+ }>, z.ZodObject<{
262
+ kind: z.ZodLiteral<"angleBisectorFoot">;
263
+ from: z.ZodString;
264
+ onLine: z.ZodString;
265
+ }, "strip", z.ZodTypeAny, {
266
+ kind: "angleBisectorFoot";
267
+ onLine: string;
268
+ from: string;
269
+ }, {
270
+ kind: "angleBisectorFoot";
271
+ onLine: string;
272
+ from: string;
273
+ }>, z.ZodObject<{
274
+ kind: z.ZodLiteral<"externalAngleBisectorFoot">;
275
+ from: z.ZodString;
276
+ onLine: z.ZodString;
277
+ }, "strip", z.ZodTypeAny, {
278
+ kind: "externalAngleBisectorFoot";
279
+ onLine: string;
280
+ from: string;
281
+ }, {
282
+ kind: "externalAngleBisectorFoot";
283
+ onLine: string;
284
+ from: string;
285
+ }>, z.ZodObject<{
286
+ kind: z.ZodLiteral<"arcMidpoint">;
287
+ circle: z.ZodString;
288
+ a: z.ZodString;
289
+ b: z.ZodString;
290
+ notContaining: z.ZodString;
291
+ }, "strip", z.ZodTypeAny, {
292
+ kind: "arcMidpoint";
293
+ circle: string;
294
+ a: string;
295
+ b: string;
296
+ notContaining: string;
297
+ }, {
298
+ kind: "arcMidpoint";
299
+ circle: string;
300
+ a: string;
301
+ b: string;
302
+ notContaining: string;
303
+ }>, z.ZodObject<{
304
+ kind: z.ZodLiteral<"reflectPoint">;
305
+ of: z.ZodString;
306
+ through: z.ZodString;
307
+ }, "strip", z.ZodTypeAny, {
308
+ kind: "reflectPoint";
309
+ through: string;
310
+ of: string;
311
+ }, {
312
+ kind: "reflectPoint";
313
+ through: string;
314
+ of: string;
315
+ }>, z.ZodObject<{
316
+ kind: z.ZodLiteral<"reflectLine">;
317
+ of: z.ZodString;
318
+ through: z.ZodString;
319
+ }, "strip", z.ZodTypeAny, {
320
+ kind: "reflectLine";
321
+ through: string;
322
+ of: string;
323
+ }, {
324
+ kind: "reflectLine";
325
+ through: string;
326
+ of: string;
327
+ }>, z.ZodObject<{
328
+ kind: z.ZodLiteral<"excenter">;
329
+ of: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
330
+ opposite: z.ZodString;
331
+ }, "strip", z.ZodTypeAny, {
332
+ kind: "excenter";
333
+ opposite: string;
334
+ of: [string, string, string];
335
+ }, {
336
+ kind: "excenter";
337
+ opposite: string;
338
+ of: [string, string, string];
339
+ }>, z.ZodObject<{
340
+ kind: z.ZodLiteral<"rightAngleViewing">;
341
+ a: z.ZodString;
342
+ b: z.ZodString;
343
+ onLine: z.ZodString;
344
+ which: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
345
+ }, "strip", z.ZodTypeAny, {
346
+ kind: "rightAngleViewing";
347
+ onLine: string;
348
+ a: string;
349
+ b: string;
350
+ which?: 0 | 1 | undefined;
351
+ }, {
352
+ kind: "rightAngleViewing";
353
+ onLine: string;
354
+ a: string;
355
+ b: string;
356
+ which?: 0 | 1 | undefined;
357
+ }>, z.ZodObject<{
358
+ kind: z.ZodLiteral<"pointAtDistance">;
359
+ from: z.ZodString;
360
+ through: z.ZodString;
361
+ distance: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
362
+ kind: z.ZodLiteral<"circleRadius">;
363
+ circle: z.ZodString;
364
+ scale: z.ZodOptional<z.ZodNumber>;
365
+ offset: z.ZodOptional<z.ZodNumber>;
366
+ }, "strip", z.ZodTypeAny, {
367
+ kind: "circleRadius";
368
+ circle: string;
369
+ scale?: number | undefined;
370
+ offset?: number | undefined;
371
+ }, {
372
+ kind: "circleRadius";
373
+ circle: string;
374
+ scale?: number | undefined;
375
+ offset?: number | undefined;
376
+ }>, z.ZodObject<{
377
+ kind: z.ZodLiteral<"segmentLength">;
378
+ p1: z.ZodString;
379
+ p2: z.ZodString;
380
+ scale: z.ZodOptional<z.ZodNumber>;
381
+ offset: z.ZodOptional<z.ZodNumber>;
382
+ }, "strip", z.ZodTypeAny, {
383
+ kind: "segmentLength";
384
+ p1: string;
385
+ p2: string;
386
+ scale?: number | undefined;
387
+ offset?: number | undefined;
388
+ }, {
389
+ kind: "segmentLength";
390
+ p1: string;
391
+ p2: string;
392
+ scale?: number | undefined;
393
+ offset?: number | undefined;
394
+ }>, z.ZodObject<{
395
+ kind: z.ZodLiteral<"literal">;
396
+ value: z.ZodNumber;
397
+ scale: z.ZodOptional<z.ZodNumber>;
398
+ offset: z.ZodOptional<z.ZodNumber>;
399
+ }, "strip", z.ZodTypeAny, {
400
+ kind: "literal";
401
+ value: number;
402
+ scale?: number | undefined;
403
+ offset?: number | undefined;
404
+ }, {
405
+ kind: "literal";
406
+ value: number;
407
+ scale?: number | undefined;
408
+ offset?: number | undefined;
409
+ }>]>;
410
+ }, "strip", z.ZodTypeAny, {
411
+ kind: "pointAtDistance";
412
+ from: string;
413
+ through: string;
414
+ distance: {
415
+ kind: "circleRadius";
416
+ circle: string;
417
+ scale?: number | undefined;
418
+ offset?: number | undefined;
419
+ } | {
420
+ kind: "segmentLength";
421
+ p1: string;
422
+ p2: string;
423
+ scale?: number | undefined;
424
+ offset?: number | undefined;
425
+ } | {
426
+ kind: "literal";
427
+ value: number;
428
+ scale?: number | undefined;
429
+ offset?: number | undefined;
430
+ };
431
+ }, {
432
+ kind: "pointAtDistance";
433
+ from: string;
434
+ through: string;
435
+ distance: {
436
+ kind: "circleRadius";
437
+ circle: string;
438
+ scale?: number | undefined;
439
+ offset?: number | undefined;
440
+ } | {
441
+ kind: "segmentLength";
442
+ p1: string;
443
+ p2: string;
444
+ scale?: number | undefined;
445
+ offset?: number | undefined;
446
+ } | {
447
+ kind: "literal";
448
+ value: number;
449
+ scale?: number | undefined;
450
+ offset?: number | undefined;
451
+ };
452
+ }>]>;
453
+ }, "strip", z.ZodTypeAny, {
454
+ constraint: {
455
+ kind: "midpoint";
456
+ of: string;
457
+ } | {
458
+ kind: "perpFoot";
459
+ onLine: string;
460
+ from: string;
461
+ } | {
462
+ kind: "centroid";
463
+ of: [string, string, string];
464
+ } | {
465
+ kind: "circumcenter";
466
+ of: [string, string, string];
467
+ } | {
468
+ kind: "incenter";
469
+ of: [string, string, string];
470
+ } | {
471
+ kind: "orthocenter";
472
+ of: [string, string, string];
473
+ } | {
474
+ kind: "intersection";
475
+ of: [string, string];
476
+ branch?: 0 | 1 | undefined;
477
+ } | {
478
+ kind: "onSegment";
479
+ of: string;
480
+ t?: number | undefined;
481
+ } | {
482
+ kind: "free";
483
+ at?: [number, number] | undefined;
484
+ } | {
485
+ kind: "externalToCircle";
486
+ circle: string;
487
+ } | {
488
+ kind: "onCircle";
489
+ circle: string;
490
+ theta?: number | undefined;
491
+ } | {
492
+ kind: "secondIntersection";
493
+ line: string;
494
+ circle: string;
495
+ other: string;
496
+ } | {
497
+ kind: "circleIntersection";
498
+ c1: string;
499
+ c2: string;
500
+ which: 0 | 1;
501
+ } | {
502
+ kind: "circleSecondIntersection";
503
+ c1: string;
504
+ c2: string;
505
+ exclude: string;
506
+ } | {
507
+ kind: "tangencyPoint";
508
+ circle: string;
509
+ onLine: string;
510
+ } | {
511
+ kind: "tangentPoint";
512
+ circle: string;
513
+ from: string;
514
+ which: 0 | 1;
515
+ } | {
516
+ kind: "angleBisectorFoot";
517
+ onLine: string;
518
+ from: string;
519
+ } | {
520
+ kind: "externalAngleBisectorFoot";
521
+ onLine: string;
522
+ from: string;
523
+ } | {
524
+ kind: "arcMidpoint";
525
+ circle: string;
526
+ a: string;
527
+ b: string;
528
+ notContaining: string;
529
+ } | {
530
+ kind: "reflectPoint";
531
+ through: string;
532
+ of: string;
533
+ } | {
534
+ kind: "reflectLine";
535
+ through: string;
536
+ of: string;
537
+ } | {
538
+ kind: "excenter";
539
+ opposite: string;
540
+ of: [string, string, string];
541
+ } | {
542
+ kind: "rightAngleViewing";
543
+ onLine: string;
544
+ a: string;
545
+ b: string;
546
+ which?: 0 | 1 | undefined;
547
+ } | {
548
+ kind: "pointAtDistance";
549
+ from: string;
550
+ through: string;
551
+ distance: {
552
+ kind: "circleRadius";
553
+ circle: string;
554
+ scale?: number | undefined;
555
+ offset?: number | undefined;
556
+ } | {
557
+ kind: "segmentLength";
558
+ p1: string;
559
+ p2: string;
560
+ scale?: number | undefined;
561
+ offset?: number | undefined;
562
+ } | {
563
+ kind: "literal";
564
+ value: number;
565
+ scale?: number | undefined;
566
+ offset?: number | undefined;
567
+ };
568
+ };
569
+ name: string;
570
+ op: "add-point";
571
+ }, {
572
+ constraint: {
573
+ kind: "midpoint";
574
+ of: string;
575
+ } | {
576
+ kind: "perpFoot";
577
+ onLine: string;
578
+ from: string;
579
+ } | {
580
+ kind: "centroid";
581
+ of: [string, string, string];
582
+ } | {
583
+ kind: "circumcenter";
584
+ of: [string, string, string];
585
+ } | {
586
+ kind: "incenter";
587
+ of: [string, string, string];
588
+ } | {
589
+ kind: "orthocenter";
590
+ of: [string, string, string];
591
+ } | {
592
+ kind: "intersection";
593
+ of: [string, string];
594
+ branch?: 0 | 1 | undefined;
595
+ } | {
596
+ kind: "onSegment";
597
+ of: string;
598
+ t?: number | undefined;
599
+ } | {
600
+ kind: "free";
601
+ at?: [number, number] | undefined;
602
+ } | {
603
+ kind: "externalToCircle";
604
+ circle: string;
605
+ } | {
606
+ kind: "onCircle";
607
+ circle: string;
608
+ theta?: number | undefined;
609
+ } | {
610
+ kind: "secondIntersection";
611
+ line: string;
612
+ circle: string;
613
+ other: string;
614
+ } | {
615
+ kind: "circleIntersection";
616
+ c1: string;
617
+ c2: string;
618
+ which: 0 | 1;
619
+ } | {
620
+ kind: "circleSecondIntersection";
621
+ c1: string;
622
+ c2: string;
623
+ exclude: string;
624
+ } | {
625
+ kind: "tangencyPoint";
626
+ circle: string;
627
+ onLine: string;
628
+ } | {
629
+ kind: "tangentPoint";
630
+ circle: string;
631
+ from: string;
632
+ which: 0 | 1;
633
+ } | {
634
+ kind: "angleBisectorFoot";
635
+ onLine: string;
636
+ from: string;
637
+ } | {
638
+ kind: "externalAngleBisectorFoot";
639
+ onLine: string;
640
+ from: string;
641
+ } | {
642
+ kind: "arcMidpoint";
643
+ circle: string;
644
+ a: string;
645
+ b: string;
646
+ notContaining: string;
647
+ } | {
648
+ kind: "reflectPoint";
649
+ through: string;
650
+ of: string;
651
+ } | {
652
+ kind: "reflectLine";
653
+ through: string;
654
+ of: string;
655
+ } | {
656
+ kind: "excenter";
657
+ opposite: string;
658
+ of: [string, string, string];
659
+ } | {
660
+ kind: "rightAngleViewing";
661
+ onLine: string;
662
+ a: string;
663
+ b: string;
664
+ which?: 0 | 1 | undefined;
665
+ } | {
666
+ kind: "pointAtDistance";
667
+ from: string;
668
+ through: string;
669
+ distance: {
670
+ kind: "circleRadius";
671
+ circle: string;
672
+ scale?: number | undefined;
673
+ offset?: number | undefined;
674
+ } | {
675
+ kind: "segmentLength";
676
+ p1: string;
677
+ p2: string;
678
+ scale?: number | undefined;
679
+ offset?: number | undefined;
680
+ } | {
681
+ kind: "literal";
682
+ value: number;
683
+ scale?: number | undefined;
684
+ offset?: number | undefined;
685
+ };
686
+ };
687
+ name: string;
688
+ op: "add-point";
689
+ }>;
690
+ declare const ConnectIntentZ: z.ZodObject<{
691
+ op: z.ZodLiteral<"connect">;
692
+ from: z.ZodString;
693
+ to: z.ZodString;
694
+ style: z.ZodDefault<z.ZodEnum<["segment", "line", "ray", "perpBisector", "angleBisector"]>>;
695
+ }, "strip", z.ZodTypeAny, {
696
+ from: string;
697
+ op: "connect";
698
+ to: string;
699
+ style: "segment" | "line" | "ray" | "perpBisector" | "angleBisector";
700
+ }, {
701
+ from: string;
702
+ op: "connect";
703
+ to: string;
704
+ style?: "segment" | "line" | "ray" | "perpBisector" | "angleBisector" | undefined;
705
+ }>;
706
+ declare const DrawCircleIntentZ: z.ZodObject<{
707
+ op: z.ZodLiteral<"draw-circle">;
708
+ name: z.ZodString;
709
+ spec: z.ZodEnum<["centerThrough", "through3", "centerRadius", "inscribedIn", "diameter"]>;
710
+ center: z.ZodOptional<z.ZodString>;
711
+ through: z.ZodOptional<z.ZodString>;
712
+ points: z.ZodOptional<z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>>;
713
+ radius: z.ZodOptional<z.ZodNumber>;
714
+ triangle: z.ZodOptional<z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>>;
715
+ endpoints: z.ZodOptional<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
716
+ }, "strip", z.ZodTypeAny, {
717
+ name: string;
718
+ op: "draw-circle";
719
+ spec: "diameter" | "centerThrough" | "through3" | "centerRadius" | "inscribedIn";
720
+ points?: [string, string, string] | undefined;
721
+ through?: string | undefined;
722
+ center?: string | undefined;
723
+ radius?: number | undefined;
724
+ triangle?: [string, string, string] | undefined;
725
+ endpoints?: [string, string] | undefined;
726
+ }, {
727
+ name: string;
728
+ op: "draw-circle";
729
+ spec: "diameter" | "centerThrough" | "through3" | "centerRadius" | "inscribedIn";
730
+ points?: [string, string, string] | undefined;
731
+ through?: string | undefined;
732
+ center?: string | undefined;
733
+ radius?: number | undefined;
734
+ triangle?: [string, string, string] | undefined;
735
+ endpoints?: [string, string] | undefined;
736
+ }>;
737
+ declare const IntentZ: z.ZodDiscriminatedUnion<"op", [z.ZodObject<{
738
+ op: z.ZodLiteral<"draw-shape">;
739
+ shape: z.ZodEnum<["triangle", "square", "rectangle", "rhombus", "trapezoid", "parallelogram", "quadrilateral"]>;
740
+ labels: z.ZodArray<z.ZodString, "many">;
741
+ variant: z.ZodDefault<z.ZodEnum<["any", "equilateral", "isoceles-AB", "isoceles-BC", "isoceles-CA", "right-at-A", "right-at-B", "right-at-C", "standard", "wide", "tall", "right", "isoceles", "general"]>>;
742
+ explicitCoords: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
743
+ }, "strip", z.ZodTypeAny, {
744
+ shape: "square" | "rectangle" | "rhombus" | "parallelogram" | "triangle" | "trapezoid" | "quadrilateral";
745
+ op: "draw-shape";
746
+ labels: string[];
747
+ variant: "any" | "equilateral" | "isoceles-AB" | "isoceles-BC" | "isoceles-CA" | "right-at-A" | "right-at-B" | "right-at-C" | "standard" | "wide" | "tall" | "right" | "isoceles" | "general";
748
+ explicitCoords?: Record<string, [number, number]> | undefined;
749
+ }, {
750
+ shape: "square" | "rectangle" | "rhombus" | "parallelogram" | "triangle" | "trapezoid" | "quadrilateral";
751
+ op: "draw-shape";
752
+ labels: string[];
753
+ variant?: "any" | "equilateral" | "isoceles-AB" | "isoceles-BC" | "isoceles-CA" | "right-at-A" | "right-at-B" | "right-at-C" | "standard" | "wide" | "tall" | "right" | "isoceles" | "general" | undefined;
754
+ explicitCoords?: Record<string, [number, number]> | undefined;
755
+ }>, z.ZodObject<{
756
+ op: z.ZodLiteral<"add-point">;
757
+ name: z.ZodString;
758
+ constraint: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
759
+ kind: z.ZodLiteral<"midpoint">;
760
+ of: z.ZodString;
761
+ }, "strip", z.ZodTypeAny, {
762
+ kind: "midpoint";
763
+ of: string;
764
+ }, {
765
+ kind: "midpoint";
766
+ of: string;
767
+ }>, z.ZodObject<{
768
+ kind: z.ZodLiteral<"perpFoot">;
769
+ from: z.ZodString;
770
+ onLine: z.ZodString;
771
+ }, "strip", z.ZodTypeAny, {
772
+ kind: "perpFoot";
773
+ onLine: string;
774
+ from: string;
775
+ }, {
776
+ kind: "perpFoot";
777
+ onLine: string;
778
+ from: string;
779
+ }>, z.ZodObject<{
780
+ kind: z.ZodLiteral<"centroid">;
781
+ of: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
782
+ }, "strip", z.ZodTypeAny, {
783
+ kind: "centroid";
784
+ of: [string, string, string];
785
+ }, {
786
+ kind: "centroid";
787
+ of: [string, string, string];
788
+ }>, z.ZodObject<{
789
+ kind: z.ZodLiteral<"circumcenter">;
790
+ of: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
791
+ }, "strip", z.ZodTypeAny, {
792
+ kind: "circumcenter";
793
+ of: [string, string, string];
794
+ }, {
795
+ kind: "circumcenter";
796
+ of: [string, string, string];
797
+ }>, z.ZodObject<{
798
+ kind: z.ZodLiteral<"incenter">;
799
+ of: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
800
+ }, "strip", z.ZodTypeAny, {
801
+ kind: "incenter";
802
+ of: [string, string, string];
803
+ }, {
804
+ kind: "incenter";
805
+ of: [string, string, string];
806
+ }>, z.ZodObject<{
807
+ kind: z.ZodLiteral<"orthocenter">;
808
+ of: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
809
+ }, "strip", z.ZodTypeAny, {
810
+ kind: "orthocenter";
811
+ of: [string, string, string];
812
+ }, {
813
+ kind: "orthocenter";
814
+ of: [string, string, string];
815
+ }>, z.ZodObject<{
816
+ kind: z.ZodLiteral<"intersection">;
817
+ of: z.ZodTuple<[z.ZodString, z.ZodString], null>;
818
+ branch: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
819
+ }, "strip", z.ZodTypeAny, {
820
+ kind: "intersection";
821
+ of: [string, string];
822
+ branch?: 0 | 1 | undefined;
823
+ }, {
824
+ kind: "intersection";
825
+ of: [string, string];
826
+ branch?: 0 | 1 | undefined;
827
+ }>, z.ZodObject<{
828
+ kind: z.ZodLiteral<"onSegment">;
829
+ of: z.ZodString;
830
+ t: z.ZodOptional<z.ZodNumber>;
831
+ }, "strip", z.ZodTypeAny, {
832
+ kind: "onSegment";
833
+ of: string;
834
+ t?: number | undefined;
835
+ }, {
836
+ kind: "onSegment";
837
+ of: string;
838
+ t?: number | undefined;
839
+ }>, z.ZodObject<{
840
+ kind: z.ZodLiteral<"free">;
841
+ at: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
842
+ }, "strip", z.ZodTypeAny, {
843
+ kind: "free";
844
+ at?: [number, number] | undefined;
845
+ }, {
846
+ kind: "free";
847
+ at?: [number, number] | undefined;
848
+ }>, z.ZodObject<{
849
+ kind: z.ZodLiteral<"externalToCircle">;
850
+ circle: z.ZodString;
851
+ }, "strip", z.ZodTypeAny, {
852
+ kind: "externalToCircle";
853
+ circle: string;
854
+ }, {
855
+ kind: "externalToCircle";
856
+ circle: string;
857
+ }>, z.ZodObject<{
858
+ kind: z.ZodLiteral<"onCircle">;
859
+ circle: z.ZodString;
860
+ theta: z.ZodOptional<z.ZodNumber>;
861
+ }, "strip", z.ZodTypeAny, {
862
+ kind: "onCircle";
863
+ circle: string;
864
+ theta?: number | undefined;
865
+ }, {
866
+ kind: "onCircle";
867
+ circle: string;
868
+ theta?: number | undefined;
869
+ }>, z.ZodObject<{
870
+ kind: z.ZodLiteral<"secondIntersection">;
871
+ line: z.ZodString;
872
+ circle: z.ZodString;
873
+ other: z.ZodString;
874
+ }, "strip", z.ZodTypeAny, {
875
+ kind: "secondIntersection";
876
+ line: string;
877
+ circle: string;
878
+ other: string;
879
+ }, {
880
+ kind: "secondIntersection";
881
+ line: string;
882
+ circle: string;
883
+ other: string;
884
+ }>, z.ZodObject<{
885
+ kind: z.ZodLiteral<"circleIntersection">;
886
+ c1: z.ZodString;
887
+ c2: z.ZodString;
888
+ which: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
889
+ }, "strip", z.ZodTypeAny, {
890
+ kind: "circleIntersection";
891
+ c1: string;
892
+ c2: string;
893
+ which: 0 | 1;
894
+ }, {
895
+ kind: "circleIntersection";
896
+ c1: string;
897
+ c2: string;
898
+ which: 0 | 1;
899
+ }>, z.ZodObject<{
900
+ kind: z.ZodLiteral<"circleSecondIntersection">;
901
+ c1: z.ZodString;
902
+ c2: z.ZodString;
903
+ exclude: z.ZodString;
904
+ }, "strip", z.ZodTypeAny, {
905
+ kind: "circleSecondIntersection";
906
+ c1: string;
907
+ c2: string;
908
+ exclude: string;
909
+ }, {
910
+ kind: "circleSecondIntersection";
911
+ c1: string;
912
+ c2: string;
913
+ exclude: string;
914
+ }>, z.ZodObject<{
915
+ kind: z.ZodLiteral<"tangencyPoint">;
916
+ circle: z.ZodString;
917
+ onLine: z.ZodString;
918
+ }, "strip", z.ZodTypeAny, {
919
+ kind: "tangencyPoint";
920
+ circle: string;
921
+ onLine: string;
922
+ }, {
923
+ kind: "tangencyPoint";
924
+ circle: string;
925
+ onLine: string;
926
+ }>, z.ZodObject<{
927
+ kind: z.ZodLiteral<"tangentPoint">;
928
+ from: z.ZodString;
929
+ circle: z.ZodString;
930
+ which: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
931
+ }, "strip", z.ZodTypeAny, {
932
+ kind: "tangentPoint";
933
+ circle: string;
934
+ from: string;
935
+ which: 0 | 1;
936
+ }, {
937
+ kind: "tangentPoint";
938
+ circle: string;
939
+ from: string;
940
+ which: 0 | 1;
941
+ }>, z.ZodObject<{
942
+ kind: z.ZodLiteral<"angleBisectorFoot">;
943
+ from: z.ZodString;
944
+ onLine: z.ZodString;
945
+ }, "strip", z.ZodTypeAny, {
946
+ kind: "angleBisectorFoot";
947
+ onLine: string;
948
+ from: string;
949
+ }, {
950
+ kind: "angleBisectorFoot";
951
+ onLine: string;
952
+ from: string;
953
+ }>, z.ZodObject<{
954
+ kind: z.ZodLiteral<"externalAngleBisectorFoot">;
955
+ from: z.ZodString;
956
+ onLine: z.ZodString;
957
+ }, "strip", z.ZodTypeAny, {
958
+ kind: "externalAngleBisectorFoot";
959
+ onLine: string;
960
+ from: string;
961
+ }, {
962
+ kind: "externalAngleBisectorFoot";
963
+ onLine: string;
964
+ from: string;
965
+ }>, z.ZodObject<{
966
+ kind: z.ZodLiteral<"arcMidpoint">;
967
+ circle: z.ZodString;
968
+ a: z.ZodString;
969
+ b: z.ZodString;
970
+ notContaining: z.ZodString;
971
+ }, "strip", z.ZodTypeAny, {
972
+ kind: "arcMidpoint";
973
+ circle: string;
974
+ a: string;
975
+ b: string;
976
+ notContaining: string;
977
+ }, {
978
+ kind: "arcMidpoint";
979
+ circle: string;
980
+ a: string;
981
+ b: string;
982
+ notContaining: string;
983
+ }>, z.ZodObject<{
984
+ kind: z.ZodLiteral<"reflectPoint">;
985
+ of: z.ZodString;
986
+ through: z.ZodString;
987
+ }, "strip", z.ZodTypeAny, {
988
+ kind: "reflectPoint";
989
+ through: string;
990
+ of: string;
991
+ }, {
992
+ kind: "reflectPoint";
993
+ through: string;
994
+ of: string;
995
+ }>, z.ZodObject<{
996
+ kind: z.ZodLiteral<"reflectLine">;
997
+ of: z.ZodString;
998
+ through: z.ZodString;
999
+ }, "strip", z.ZodTypeAny, {
1000
+ kind: "reflectLine";
1001
+ through: string;
1002
+ of: string;
1003
+ }, {
1004
+ kind: "reflectLine";
1005
+ through: string;
1006
+ of: string;
1007
+ }>, z.ZodObject<{
1008
+ kind: z.ZodLiteral<"excenter">;
1009
+ of: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
1010
+ opposite: z.ZodString;
1011
+ }, "strip", z.ZodTypeAny, {
1012
+ kind: "excenter";
1013
+ opposite: string;
1014
+ of: [string, string, string];
1015
+ }, {
1016
+ kind: "excenter";
1017
+ opposite: string;
1018
+ of: [string, string, string];
1019
+ }>, z.ZodObject<{
1020
+ kind: z.ZodLiteral<"rightAngleViewing">;
1021
+ a: z.ZodString;
1022
+ b: z.ZodString;
1023
+ onLine: z.ZodString;
1024
+ which: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
1025
+ }, "strip", z.ZodTypeAny, {
1026
+ kind: "rightAngleViewing";
1027
+ onLine: string;
1028
+ a: string;
1029
+ b: string;
1030
+ which?: 0 | 1 | undefined;
1031
+ }, {
1032
+ kind: "rightAngleViewing";
1033
+ onLine: string;
1034
+ a: string;
1035
+ b: string;
1036
+ which?: 0 | 1 | undefined;
1037
+ }>, z.ZodObject<{
1038
+ kind: z.ZodLiteral<"pointAtDistance">;
1039
+ from: z.ZodString;
1040
+ through: z.ZodString;
1041
+ distance: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1042
+ kind: z.ZodLiteral<"circleRadius">;
1043
+ circle: z.ZodString;
1044
+ scale: z.ZodOptional<z.ZodNumber>;
1045
+ offset: z.ZodOptional<z.ZodNumber>;
1046
+ }, "strip", z.ZodTypeAny, {
1047
+ kind: "circleRadius";
1048
+ circle: string;
1049
+ scale?: number | undefined;
1050
+ offset?: number | undefined;
1051
+ }, {
1052
+ kind: "circleRadius";
1053
+ circle: string;
1054
+ scale?: number | undefined;
1055
+ offset?: number | undefined;
1056
+ }>, z.ZodObject<{
1057
+ kind: z.ZodLiteral<"segmentLength">;
1058
+ p1: z.ZodString;
1059
+ p2: z.ZodString;
1060
+ scale: z.ZodOptional<z.ZodNumber>;
1061
+ offset: z.ZodOptional<z.ZodNumber>;
1062
+ }, "strip", z.ZodTypeAny, {
1063
+ kind: "segmentLength";
1064
+ p1: string;
1065
+ p2: string;
1066
+ scale?: number | undefined;
1067
+ offset?: number | undefined;
1068
+ }, {
1069
+ kind: "segmentLength";
1070
+ p1: string;
1071
+ p2: string;
1072
+ scale?: number | undefined;
1073
+ offset?: number | undefined;
1074
+ }>, z.ZodObject<{
1075
+ kind: z.ZodLiteral<"literal">;
1076
+ value: z.ZodNumber;
1077
+ scale: z.ZodOptional<z.ZodNumber>;
1078
+ offset: z.ZodOptional<z.ZodNumber>;
1079
+ }, "strip", z.ZodTypeAny, {
1080
+ kind: "literal";
1081
+ value: number;
1082
+ scale?: number | undefined;
1083
+ offset?: number | undefined;
1084
+ }, {
1085
+ kind: "literal";
1086
+ value: number;
1087
+ scale?: number | undefined;
1088
+ offset?: number | undefined;
1089
+ }>]>;
1090
+ }, "strip", z.ZodTypeAny, {
1091
+ kind: "pointAtDistance";
1092
+ from: string;
1093
+ through: string;
1094
+ distance: {
1095
+ kind: "circleRadius";
1096
+ circle: string;
1097
+ scale?: number | undefined;
1098
+ offset?: number | undefined;
1099
+ } | {
1100
+ kind: "segmentLength";
1101
+ p1: string;
1102
+ p2: string;
1103
+ scale?: number | undefined;
1104
+ offset?: number | undefined;
1105
+ } | {
1106
+ kind: "literal";
1107
+ value: number;
1108
+ scale?: number | undefined;
1109
+ offset?: number | undefined;
1110
+ };
1111
+ }, {
1112
+ kind: "pointAtDistance";
1113
+ from: string;
1114
+ through: string;
1115
+ distance: {
1116
+ kind: "circleRadius";
1117
+ circle: string;
1118
+ scale?: number | undefined;
1119
+ offset?: number | undefined;
1120
+ } | {
1121
+ kind: "segmentLength";
1122
+ p1: string;
1123
+ p2: string;
1124
+ scale?: number | undefined;
1125
+ offset?: number | undefined;
1126
+ } | {
1127
+ kind: "literal";
1128
+ value: number;
1129
+ scale?: number | undefined;
1130
+ offset?: number | undefined;
1131
+ };
1132
+ }>]>;
1133
+ }, "strip", z.ZodTypeAny, {
1134
+ constraint: {
1135
+ kind: "midpoint";
1136
+ of: string;
1137
+ } | {
1138
+ kind: "perpFoot";
1139
+ onLine: string;
1140
+ from: string;
1141
+ } | {
1142
+ kind: "centroid";
1143
+ of: [string, string, string];
1144
+ } | {
1145
+ kind: "circumcenter";
1146
+ of: [string, string, string];
1147
+ } | {
1148
+ kind: "incenter";
1149
+ of: [string, string, string];
1150
+ } | {
1151
+ kind: "orthocenter";
1152
+ of: [string, string, string];
1153
+ } | {
1154
+ kind: "intersection";
1155
+ of: [string, string];
1156
+ branch?: 0 | 1 | undefined;
1157
+ } | {
1158
+ kind: "onSegment";
1159
+ of: string;
1160
+ t?: number | undefined;
1161
+ } | {
1162
+ kind: "free";
1163
+ at?: [number, number] | undefined;
1164
+ } | {
1165
+ kind: "externalToCircle";
1166
+ circle: string;
1167
+ } | {
1168
+ kind: "onCircle";
1169
+ circle: string;
1170
+ theta?: number | undefined;
1171
+ } | {
1172
+ kind: "secondIntersection";
1173
+ line: string;
1174
+ circle: string;
1175
+ other: string;
1176
+ } | {
1177
+ kind: "circleIntersection";
1178
+ c1: string;
1179
+ c2: string;
1180
+ which: 0 | 1;
1181
+ } | {
1182
+ kind: "circleSecondIntersection";
1183
+ c1: string;
1184
+ c2: string;
1185
+ exclude: string;
1186
+ } | {
1187
+ kind: "tangencyPoint";
1188
+ circle: string;
1189
+ onLine: string;
1190
+ } | {
1191
+ kind: "tangentPoint";
1192
+ circle: string;
1193
+ from: string;
1194
+ which: 0 | 1;
1195
+ } | {
1196
+ kind: "angleBisectorFoot";
1197
+ onLine: string;
1198
+ from: string;
1199
+ } | {
1200
+ kind: "externalAngleBisectorFoot";
1201
+ onLine: string;
1202
+ from: string;
1203
+ } | {
1204
+ kind: "arcMidpoint";
1205
+ circle: string;
1206
+ a: string;
1207
+ b: string;
1208
+ notContaining: string;
1209
+ } | {
1210
+ kind: "reflectPoint";
1211
+ through: string;
1212
+ of: string;
1213
+ } | {
1214
+ kind: "reflectLine";
1215
+ through: string;
1216
+ of: string;
1217
+ } | {
1218
+ kind: "excenter";
1219
+ opposite: string;
1220
+ of: [string, string, string];
1221
+ } | {
1222
+ kind: "rightAngleViewing";
1223
+ onLine: string;
1224
+ a: string;
1225
+ b: string;
1226
+ which?: 0 | 1 | undefined;
1227
+ } | {
1228
+ kind: "pointAtDistance";
1229
+ from: string;
1230
+ through: string;
1231
+ distance: {
1232
+ kind: "circleRadius";
1233
+ circle: string;
1234
+ scale?: number | undefined;
1235
+ offset?: number | undefined;
1236
+ } | {
1237
+ kind: "segmentLength";
1238
+ p1: string;
1239
+ p2: string;
1240
+ scale?: number | undefined;
1241
+ offset?: number | undefined;
1242
+ } | {
1243
+ kind: "literal";
1244
+ value: number;
1245
+ scale?: number | undefined;
1246
+ offset?: number | undefined;
1247
+ };
1248
+ };
1249
+ name: string;
1250
+ op: "add-point";
1251
+ }, {
1252
+ constraint: {
1253
+ kind: "midpoint";
1254
+ of: string;
1255
+ } | {
1256
+ kind: "perpFoot";
1257
+ onLine: string;
1258
+ from: string;
1259
+ } | {
1260
+ kind: "centroid";
1261
+ of: [string, string, string];
1262
+ } | {
1263
+ kind: "circumcenter";
1264
+ of: [string, string, string];
1265
+ } | {
1266
+ kind: "incenter";
1267
+ of: [string, string, string];
1268
+ } | {
1269
+ kind: "orthocenter";
1270
+ of: [string, string, string];
1271
+ } | {
1272
+ kind: "intersection";
1273
+ of: [string, string];
1274
+ branch?: 0 | 1 | undefined;
1275
+ } | {
1276
+ kind: "onSegment";
1277
+ of: string;
1278
+ t?: number | undefined;
1279
+ } | {
1280
+ kind: "free";
1281
+ at?: [number, number] | undefined;
1282
+ } | {
1283
+ kind: "externalToCircle";
1284
+ circle: string;
1285
+ } | {
1286
+ kind: "onCircle";
1287
+ circle: string;
1288
+ theta?: number | undefined;
1289
+ } | {
1290
+ kind: "secondIntersection";
1291
+ line: string;
1292
+ circle: string;
1293
+ other: string;
1294
+ } | {
1295
+ kind: "circleIntersection";
1296
+ c1: string;
1297
+ c2: string;
1298
+ which: 0 | 1;
1299
+ } | {
1300
+ kind: "circleSecondIntersection";
1301
+ c1: string;
1302
+ c2: string;
1303
+ exclude: string;
1304
+ } | {
1305
+ kind: "tangencyPoint";
1306
+ circle: string;
1307
+ onLine: string;
1308
+ } | {
1309
+ kind: "tangentPoint";
1310
+ circle: string;
1311
+ from: string;
1312
+ which: 0 | 1;
1313
+ } | {
1314
+ kind: "angleBisectorFoot";
1315
+ onLine: string;
1316
+ from: string;
1317
+ } | {
1318
+ kind: "externalAngleBisectorFoot";
1319
+ onLine: string;
1320
+ from: string;
1321
+ } | {
1322
+ kind: "arcMidpoint";
1323
+ circle: string;
1324
+ a: string;
1325
+ b: string;
1326
+ notContaining: string;
1327
+ } | {
1328
+ kind: "reflectPoint";
1329
+ through: string;
1330
+ of: string;
1331
+ } | {
1332
+ kind: "reflectLine";
1333
+ through: string;
1334
+ of: string;
1335
+ } | {
1336
+ kind: "excenter";
1337
+ opposite: string;
1338
+ of: [string, string, string];
1339
+ } | {
1340
+ kind: "rightAngleViewing";
1341
+ onLine: string;
1342
+ a: string;
1343
+ b: string;
1344
+ which?: 0 | 1 | undefined;
1345
+ } | {
1346
+ kind: "pointAtDistance";
1347
+ from: string;
1348
+ through: string;
1349
+ distance: {
1350
+ kind: "circleRadius";
1351
+ circle: string;
1352
+ scale?: number | undefined;
1353
+ offset?: number | undefined;
1354
+ } | {
1355
+ kind: "segmentLength";
1356
+ p1: string;
1357
+ p2: string;
1358
+ scale?: number | undefined;
1359
+ offset?: number | undefined;
1360
+ } | {
1361
+ kind: "literal";
1362
+ value: number;
1363
+ scale?: number | undefined;
1364
+ offset?: number | undefined;
1365
+ };
1366
+ };
1367
+ name: string;
1368
+ op: "add-point";
1369
+ }>, z.ZodObject<{
1370
+ op: z.ZodLiteral<"connect">;
1371
+ from: z.ZodString;
1372
+ to: z.ZodString;
1373
+ style: z.ZodDefault<z.ZodEnum<["segment", "line", "ray", "perpBisector", "angleBisector"]>>;
1374
+ }, "strip", z.ZodTypeAny, {
1375
+ from: string;
1376
+ op: "connect";
1377
+ to: string;
1378
+ style: "segment" | "line" | "ray" | "perpBisector" | "angleBisector";
1379
+ }, {
1380
+ from: string;
1381
+ op: "connect";
1382
+ to: string;
1383
+ style?: "segment" | "line" | "ray" | "perpBisector" | "angleBisector" | undefined;
1384
+ }>, z.ZodObject<{
1385
+ op: z.ZodLiteral<"draw-circle">;
1386
+ name: z.ZodString;
1387
+ spec: z.ZodEnum<["centerThrough", "through3", "centerRadius", "inscribedIn", "diameter"]>;
1388
+ center: z.ZodOptional<z.ZodString>;
1389
+ through: z.ZodOptional<z.ZodString>;
1390
+ points: z.ZodOptional<z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>>;
1391
+ radius: z.ZodOptional<z.ZodNumber>;
1392
+ triangle: z.ZodOptional<z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>>;
1393
+ endpoints: z.ZodOptional<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
1394
+ }, "strip", z.ZodTypeAny, {
1395
+ name: string;
1396
+ op: "draw-circle";
1397
+ spec: "diameter" | "centerThrough" | "through3" | "centerRadius" | "inscribedIn";
1398
+ points?: [string, string, string] | undefined;
1399
+ through?: string | undefined;
1400
+ center?: string | undefined;
1401
+ radius?: number | undefined;
1402
+ triangle?: [string, string, string] | undefined;
1403
+ endpoints?: [string, string] | undefined;
1404
+ }, {
1405
+ name: string;
1406
+ op: "draw-circle";
1407
+ spec: "diameter" | "centerThrough" | "through3" | "centerRadius" | "inscribedIn";
1408
+ points?: [string, string, string] | undefined;
1409
+ through?: string | undefined;
1410
+ center?: string | undefined;
1411
+ radius?: number | undefined;
1412
+ triangle?: [string, string, string] | undefined;
1413
+ endpoints?: [string, string] | undefined;
1414
+ }>, z.ZodObject<{
1415
+ op: z.ZodLiteral<"draw-line">;
1416
+ name: z.ZodString;
1417
+ kind: z.ZodEnum<["perpThrough", "parallelThrough", "tangentAt", "tangentFromExt", "angleBisector", "lineThrough", "radicalAxis"]>;
1418
+ through: z.ZodOptional<z.ZodString>;
1419
+ to: z.ZodOptional<z.ZodString>;
1420
+ from: z.ZodOptional<z.ZodString>;
1421
+ circle: z.ZodOptional<z.ZodString>;
1422
+ which: z.ZodOptional<z.ZodEnum<["first", "second", "both"]>>;
1423
+ points: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1424
+ circle1: z.ZodOptional<z.ZodString>;
1425
+ circle2: z.ZodOptional<z.ZodString>;
1426
+ p1: z.ZodOptional<z.ZodString>;
1427
+ vertex: z.ZodOptional<z.ZodString>;
1428
+ p2: z.ZodOptional<z.ZodString>;
1429
+ }, "strip", z.ZodTypeAny, {
1430
+ kind: "angleBisector" | "lineThrough" | "radicalAxis" | "perpThrough" | "parallelThrough" | "tangentAt" | "tangentFromExt";
1431
+ name: string;
1432
+ op: "draw-line";
1433
+ circle?: string | undefined;
1434
+ points?: string[] | undefined;
1435
+ p1?: string | undefined;
1436
+ p2?: string | undefined;
1437
+ from?: string | undefined;
1438
+ through?: string | undefined;
1439
+ vertex?: string | undefined;
1440
+ circle1?: string | undefined;
1441
+ circle2?: string | undefined;
1442
+ which?: "first" | "second" | "both" | undefined;
1443
+ to?: string | undefined;
1444
+ }, {
1445
+ kind: "angleBisector" | "lineThrough" | "radicalAxis" | "perpThrough" | "parallelThrough" | "tangentAt" | "tangentFromExt";
1446
+ name: string;
1447
+ op: "draw-line";
1448
+ circle?: string | undefined;
1449
+ points?: string[] | undefined;
1450
+ p1?: string | undefined;
1451
+ p2?: string | undefined;
1452
+ from?: string | undefined;
1453
+ through?: string | undefined;
1454
+ vertex?: string | undefined;
1455
+ circle1?: string | undefined;
1456
+ circle2?: string | undefined;
1457
+ which?: "first" | "second" | "both" | undefined;
1458
+ to?: string | undefined;
1459
+ }>, z.ZodObject<{
1460
+ op: z.ZodLiteral<"mark-shape">;
1461
+ shape: z.ZodEnum<["triangle", "quadrilateral"]>;
1462
+ labels: z.ZodArray<z.ZodString, "many">;
1463
+ }, "strip", z.ZodTypeAny, {
1464
+ shape: "triangle" | "quadrilateral";
1465
+ op: "mark-shape";
1466
+ labels: string[];
1467
+ }, {
1468
+ shape: "triangle" | "quadrilateral";
1469
+ op: "mark-shape";
1470
+ labels: string[];
1471
+ }>]>;
1472
+
1473
+ type IntentT = z.infer<typeof IntentZ>;
1474
+ type DrawShapeIntentT = z.infer<typeof DrawShapeIntentZ>;
1475
+ type AddPointIntentT = z.infer<typeof AddPointIntentZ>;
1476
+ type ConnectIntentT = z.infer<typeof ConnectIntentZ>;
1477
+ type DrawCircleIntentT = z.infer<typeof DrawCircleIntentZ>;
1478
+ declare const IntentEnvelopeZ: z.ZodEffects<z.ZodObject<{
1479
+ decision: z.ZodEnum<["build", "refuse"]>;
1480
+ intents: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"op", [z.ZodObject<{
1481
+ op: z.ZodLiteral<"draw-shape">;
1482
+ shape: z.ZodEnum<["triangle", "square", "rectangle", "rhombus", "trapezoid", "parallelogram", "quadrilateral"]>;
1483
+ labels: z.ZodArray<z.ZodString, "many">;
1484
+ variant: z.ZodDefault<z.ZodEnum<["any", "equilateral", "isoceles-AB", "isoceles-BC", "isoceles-CA", "right-at-A", "right-at-B", "right-at-C", "standard", "wide", "tall", "right", "isoceles", "general"]>>;
1485
+ explicitCoords: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
1486
+ }, "strip", z.ZodTypeAny, {
1487
+ shape: "square" | "rectangle" | "rhombus" | "parallelogram" | "triangle" | "trapezoid" | "quadrilateral";
1488
+ op: "draw-shape";
1489
+ labels: string[];
1490
+ variant: "any" | "equilateral" | "isoceles-AB" | "isoceles-BC" | "isoceles-CA" | "right-at-A" | "right-at-B" | "right-at-C" | "standard" | "wide" | "tall" | "right" | "isoceles" | "general";
1491
+ explicitCoords?: Record<string, [number, number]> | undefined;
1492
+ }, {
1493
+ shape: "square" | "rectangle" | "rhombus" | "parallelogram" | "triangle" | "trapezoid" | "quadrilateral";
1494
+ op: "draw-shape";
1495
+ labels: string[];
1496
+ variant?: "any" | "equilateral" | "isoceles-AB" | "isoceles-BC" | "isoceles-CA" | "right-at-A" | "right-at-B" | "right-at-C" | "standard" | "wide" | "tall" | "right" | "isoceles" | "general" | undefined;
1497
+ explicitCoords?: Record<string, [number, number]> | undefined;
1498
+ }>, z.ZodObject<{
1499
+ op: z.ZodLiteral<"add-point">;
1500
+ name: z.ZodString;
1501
+ constraint: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1502
+ kind: z.ZodLiteral<"midpoint">;
1503
+ of: z.ZodString;
1504
+ }, "strip", z.ZodTypeAny, {
1505
+ kind: "midpoint";
1506
+ of: string;
1507
+ }, {
1508
+ kind: "midpoint";
1509
+ of: string;
1510
+ }>, z.ZodObject<{
1511
+ kind: z.ZodLiteral<"perpFoot">;
1512
+ from: z.ZodString;
1513
+ onLine: z.ZodString;
1514
+ }, "strip", z.ZodTypeAny, {
1515
+ kind: "perpFoot";
1516
+ onLine: string;
1517
+ from: string;
1518
+ }, {
1519
+ kind: "perpFoot";
1520
+ onLine: string;
1521
+ from: string;
1522
+ }>, z.ZodObject<{
1523
+ kind: z.ZodLiteral<"centroid">;
1524
+ of: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
1525
+ }, "strip", z.ZodTypeAny, {
1526
+ kind: "centroid";
1527
+ of: [string, string, string];
1528
+ }, {
1529
+ kind: "centroid";
1530
+ of: [string, string, string];
1531
+ }>, z.ZodObject<{
1532
+ kind: z.ZodLiteral<"circumcenter">;
1533
+ of: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
1534
+ }, "strip", z.ZodTypeAny, {
1535
+ kind: "circumcenter";
1536
+ of: [string, string, string];
1537
+ }, {
1538
+ kind: "circumcenter";
1539
+ of: [string, string, string];
1540
+ }>, z.ZodObject<{
1541
+ kind: z.ZodLiteral<"incenter">;
1542
+ of: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
1543
+ }, "strip", z.ZodTypeAny, {
1544
+ kind: "incenter";
1545
+ of: [string, string, string];
1546
+ }, {
1547
+ kind: "incenter";
1548
+ of: [string, string, string];
1549
+ }>, z.ZodObject<{
1550
+ kind: z.ZodLiteral<"orthocenter">;
1551
+ of: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
1552
+ }, "strip", z.ZodTypeAny, {
1553
+ kind: "orthocenter";
1554
+ of: [string, string, string];
1555
+ }, {
1556
+ kind: "orthocenter";
1557
+ of: [string, string, string];
1558
+ }>, z.ZodObject<{
1559
+ kind: z.ZodLiteral<"intersection">;
1560
+ of: z.ZodTuple<[z.ZodString, z.ZodString], null>;
1561
+ branch: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
1562
+ }, "strip", z.ZodTypeAny, {
1563
+ kind: "intersection";
1564
+ of: [string, string];
1565
+ branch?: 0 | 1 | undefined;
1566
+ }, {
1567
+ kind: "intersection";
1568
+ of: [string, string];
1569
+ branch?: 0 | 1 | undefined;
1570
+ }>, z.ZodObject<{
1571
+ kind: z.ZodLiteral<"onSegment">;
1572
+ of: z.ZodString;
1573
+ t: z.ZodOptional<z.ZodNumber>;
1574
+ }, "strip", z.ZodTypeAny, {
1575
+ kind: "onSegment";
1576
+ of: string;
1577
+ t?: number | undefined;
1578
+ }, {
1579
+ kind: "onSegment";
1580
+ of: string;
1581
+ t?: number | undefined;
1582
+ }>, z.ZodObject<{
1583
+ kind: z.ZodLiteral<"free">;
1584
+ at: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
1585
+ }, "strip", z.ZodTypeAny, {
1586
+ kind: "free";
1587
+ at?: [number, number] | undefined;
1588
+ }, {
1589
+ kind: "free";
1590
+ at?: [number, number] | undefined;
1591
+ }>, z.ZodObject<{
1592
+ kind: z.ZodLiteral<"externalToCircle">;
1593
+ circle: z.ZodString;
1594
+ }, "strip", z.ZodTypeAny, {
1595
+ kind: "externalToCircle";
1596
+ circle: string;
1597
+ }, {
1598
+ kind: "externalToCircle";
1599
+ circle: string;
1600
+ }>, z.ZodObject<{
1601
+ kind: z.ZodLiteral<"onCircle">;
1602
+ circle: z.ZodString;
1603
+ theta: z.ZodOptional<z.ZodNumber>;
1604
+ }, "strip", z.ZodTypeAny, {
1605
+ kind: "onCircle";
1606
+ circle: string;
1607
+ theta?: number | undefined;
1608
+ }, {
1609
+ kind: "onCircle";
1610
+ circle: string;
1611
+ theta?: number | undefined;
1612
+ }>, z.ZodObject<{
1613
+ kind: z.ZodLiteral<"secondIntersection">;
1614
+ line: z.ZodString;
1615
+ circle: z.ZodString;
1616
+ other: z.ZodString;
1617
+ }, "strip", z.ZodTypeAny, {
1618
+ kind: "secondIntersection";
1619
+ line: string;
1620
+ circle: string;
1621
+ other: string;
1622
+ }, {
1623
+ kind: "secondIntersection";
1624
+ line: string;
1625
+ circle: string;
1626
+ other: string;
1627
+ }>, z.ZodObject<{
1628
+ kind: z.ZodLiteral<"circleIntersection">;
1629
+ c1: z.ZodString;
1630
+ c2: z.ZodString;
1631
+ which: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
1632
+ }, "strip", z.ZodTypeAny, {
1633
+ kind: "circleIntersection";
1634
+ c1: string;
1635
+ c2: string;
1636
+ which: 0 | 1;
1637
+ }, {
1638
+ kind: "circleIntersection";
1639
+ c1: string;
1640
+ c2: string;
1641
+ which: 0 | 1;
1642
+ }>, z.ZodObject<{
1643
+ kind: z.ZodLiteral<"circleSecondIntersection">;
1644
+ c1: z.ZodString;
1645
+ c2: z.ZodString;
1646
+ exclude: z.ZodString;
1647
+ }, "strip", z.ZodTypeAny, {
1648
+ kind: "circleSecondIntersection";
1649
+ c1: string;
1650
+ c2: string;
1651
+ exclude: string;
1652
+ }, {
1653
+ kind: "circleSecondIntersection";
1654
+ c1: string;
1655
+ c2: string;
1656
+ exclude: string;
1657
+ }>, z.ZodObject<{
1658
+ kind: z.ZodLiteral<"tangencyPoint">;
1659
+ circle: z.ZodString;
1660
+ onLine: z.ZodString;
1661
+ }, "strip", z.ZodTypeAny, {
1662
+ kind: "tangencyPoint";
1663
+ circle: string;
1664
+ onLine: string;
1665
+ }, {
1666
+ kind: "tangencyPoint";
1667
+ circle: string;
1668
+ onLine: string;
1669
+ }>, z.ZodObject<{
1670
+ kind: z.ZodLiteral<"tangentPoint">;
1671
+ from: z.ZodString;
1672
+ circle: z.ZodString;
1673
+ which: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
1674
+ }, "strip", z.ZodTypeAny, {
1675
+ kind: "tangentPoint";
1676
+ circle: string;
1677
+ from: string;
1678
+ which: 0 | 1;
1679
+ }, {
1680
+ kind: "tangentPoint";
1681
+ circle: string;
1682
+ from: string;
1683
+ which: 0 | 1;
1684
+ }>, z.ZodObject<{
1685
+ kind: z.ZodLiteral<"angleBisectorFoot">;
1686
+ from: z.ZodString;
1687
+ onLine: z.ZodString;
1688
+ }, "strip", z.ZodTypeAny, {
1689
+ kind: "angleBisectorFoot";
1690
+ onLine: string;
1691
+ from: string;
1692
+ }, {
1693
+ kind: "angleBisectorFoot";
1694
+ onLine: string;
1695
+ from: string;
1696
+ }>, z.ZodObject<{
1697
+ kind: z.ZodLiteral<"externalAngleBisectorFoot">;
1698
+ from: z.ZodString;
1699
+ onLine: z.ZodString;
1700
+ }, "strip", z.ZodTypeAny, {
1701
+ kind: "externalAngleBisectorFoot";
1702
+ onLine: string;
1703
+ from: string;
1704
+ }, {
1705
+ kind: "externalAngleBisectorFoot";
1706
+ onLine: string;
1707
+ from: string;
1708
+ }>, z.ZodObject<{
1709
+ kind: z.ZodLiteral<"arcMidpoint">;
1710
+ circle: z.ZodString;
1711
+ a: z.ZodString;
1712
+ b: z.ZodString;
1713
+ notContaining: z.ZodString;
1714
+ }, "strip", z.ZodTypeAny, {
1715
+ kind: "arcMidpoint";
1716
+ circle: string;
1717
+ a: string;
1718
+ b: string;
1719
+ notContaining: string;
1720
+ }, {
1721
+ kind: "arcMidpoint";
1722
+ circle: string;
1723
+ a: string;
1724
+ b: string;
1725
+ notContaining: string;
1726
+ }>, z.ZodObject<{
1727
+ kind: z.ZodLiteral<"reflectPoint">;
1728
+ of: z.ZodString;
1729
+ through: z.ZodString;
1730
+ }, "strip", z.ZodTypeAny, {
1731
+ kind: "reflectPoint";
1732
+ through: string;
1733
+ of: string;
1734
+ }, {
1735
+ kind: "reflectPoint";
1736
+ through: string;
1737
+ of: string;
1738
+ }>, z.ZodObject<{
1739
+ kind: z.ZodLiteral<"reflectLine">;
1740
+ of: z.ZodString;
1741
+ through: z.ZodString;
1742
+ }, "strip", z.ZodTypeAny, {
1743
+ kind: "reflectLine";
1744
+ through: string;
1745
+ of: string;
1746
+ }, {
1747
+ kind: "reflectLine";
1748
+ through: string;
1749
+ of: string;
1750
+ }>, z.ZodObject<{
1751
+ kind: z.ZodLiteral<"excenter">;
1752
+ of: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
1753
+ opposite: z.ZodString;
1754
+ }, "strip", z.ZodTypeAny, {
1755
+ kind: "excenter";
1756
+ opposite: string;
1757
+ of: [string, string, string];
1758
+ }, {
1759
+ kind: "excenter";
1760
+ opposite: string;
1761
+ of: [string, string, string];
1762
+ }>, z.ZodObject<{
1763
+ kind: z.ZodLiteral<"rightAngleViewing">;
1764
+ a: z.ZodString;
1765
+ b: z.ZodString;
1766
+ onLine: z.ZodString;
1767
+ which: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
1768
+ }, "strip", z.ZodTypeAny, {
1769
+ kind: "rightAngleViewing";
1770
+ onLine: string;
1771
+ a: string;
1772
+ b: string;
1773
+ which?: 0 | 1 | undefined;
1774
+ }, {
1775
+ kind: "rightAngleViewing";
1776
+ onLine: string;
1777
+ a: string;
1778
+ b: string;
1779
+ which?: 0 | 1 | undefined;
1780
+ }>, z.ZodObject<{
1781
+ kind: z.ZodLiteral<"pointAtDistance">;
1782
+ from: z.ZodString;
1783
+ through: z.ZodString;
1784
+ distance: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1785
+ kind: z.ZodLiteral<"circleRadius">;
1786
+ circle: z.ZodString;
1787
+ scale: z.ZodOptional<z.ZodNumber>;
1788
+ offset: z.ZodOptional<z.ZodNumber>;
1789
+ }, "strip", z.ZodTypeAny, {
1790
+ kind: "circleRadius";
1791
+ circle: string;
1792
+ scale?: number | undefined;
1793
+ offset?: number | undefined;
1794
+ }, {
1795
+ kind: "circleRadius";
1796
+ circle: string;
1797
+ scale?: number | undefined;
1798
+ offset?: number | undefined;
1799
+ }>, z.ZodObject<{
1800
+ kind: z.ZodLiteral<"segmentLength">;
1801
+ p1: z.ZodString;
1802
+ p2: z.ZodString;
1803
+ scale: z.ZodOptional<z.ZodNumber>;
1804
+ offset: z.ZodOptional<z.ZodNumber>;
1805
+ }, "strip", z.ZodTypeAny, {
1806
+ kind: "segmentLength";
1807
+ p1: string;
1808
+ p2: string;
1809
+ scale?: number | undefined;
1810
+ offset?: number | undefined;
1811
+ }, {
1812
+ kind: "segmentLength";
1813
+ p1: string;
1814
+ p2: string;
1815
+ scale?: number | undefined;
1816
+ offset?: number | undefined;
1817
+ }>, z.ZodObject<{
1818
+ kind: z.ZodLiteral<"literal">;
1819
+ value: z.ZodNumber;
1820
+ scale: z.ZodOptional<z.ZodNumber>;
1821
+ offset: z.ZodOptional<z.ZodNumber>;
1822
+ }, "strip", z.ZodTypeAny, {
1823
+ kind: "literal";
1824
+ value: number;
1825
+ scale?: number | undefined;
1826
+ offset?: number | undefined;
1827
+ }, {
1828
+ kind: "literal";
1829
+ value: number;
1830
+ scale?: number | undefined;
1831
+ offset?: number | undefined;
1832
+ }>]>;
1833
+ }, "strip", z.ZodTypeAny, {
1834
+ kind: "pointAtDistance";
1835
+ from: string;
1836
+ through: string;
1837
+ distance: {
1838
+ kind: "circleRadius";
1839
+ circle: string;
1840
+ scale?: number | undefined;
1841
+ offset?: number | undefined;
1842
+ } | {
1843
+ kind: "segmentLength";
1844
+ p1: string;
1845
+ p2: string;
1846
+ scale?: number | undefined;
1847
+ offset?: number | undefined;
1848
+ } | {
1849
+ kind: "literal";
1850
+ value: number;
1851
+ scale?: number | undefined;
1852
+ offset?: number | undefined;
1853
+ };
1854
+ }, {
1855
+ kind: "pointAtDistance";
1856
+ from: string;
1857
+ through: string;
1858
+ distance: {
1859
+ kind: "circleRadius";
1860
+ circle: string;
1861
+ scale?: number | undefined;
1862
+ offset?: number | undefined;
1863
+ } | {
1864
+ kind: "segmentLength";
1865
+ p1: string;
1866
+ p2: string;
1867
+ scale?: number | undefined;
1868
+ offset?: number | undefined;
1869
+ } | {
1870
+ kind: "literal";
1871
+ value: number;
1872
+ scale?: number | undefined;
1873
+ offset?: number | undefined;
1874
+ };
1875
+ }>]>;
1876
+ }, "strip", z.ZodTypeAny, {
1877
+ constraint: {
1878
+ kind: "midpoint";
1879
+ of: string;
1880
+ } | {
1881
+ kind: "perpFoot";
1882
+ onLine: string;
1883
+ from: string;
1884
+ } | {
1885
+ kind: "centroid";
1886
+ of: [string, string, string];
1887
+ } | {
1888
+ kind: "circumcenter";
1889
+ of: [string, string, string];
1890
+ } | {
1891
+ kind: "incenter";
1892
+ of: [string, string, string];
1893
+ } | {
1894
+ kind: "orthocenter";
1895
+ of: [string, string, string];
1896
+ } | {
1897
+ kind: "intersection";
1898
+ of: [string, string];
1899
+ branch?: 0 | 1 | undefined;
1900
+ } | {
1901
+ kind: "onSegment";
1902
+ of: string;
1903
+ t?: number | undefined;
1904
+ } | {
1905
+ kind: "free";
1906
+ at?: [number, number] | undefined;
1907
+ } | {
1908
+ kind: "externalToCircle";
1909
+ circle: string;
1910
+ } | {
1911
+ kind: "onCircle";
1912
+ circle: string;
1913
+ theta?: number | undefined;
1914
+ } | {
1915
+ kind: "secondIntersection";
1916
+ line: string;
1917
+ circle: string;
1918
+ other: string;
1919
+ } | {
1920
+ kind: "circleIntersection";
1921
+ c1: string;
1922
+ c2: string;
1923
+ which: 0 | 1;
1924
+ } | {
1925
+ kind: "circleSecondIntersection";
1926
+ c1: string;
1927
+ c2: string;
1928
+ exclude: string;
1929
+ } | {
1930
+ kind: "tangencyPoint";
1931
+ circle: string;
1932
+ onLine: string;
1933
+ } | {
1934
+ kind: "tangentPoint";
1935
+ circle: string;
1936
+ from: string;
1937
+ which: 0 | 1;
1938
+ } | {
1939
+ kind: "angleBisectorFoot";
1940
+ onLine: string;
1941
+ from: string;
1942
+ } | {
1943
+ kind: "externalAngleBisectorFoot";
1944
+ onLine: string;
1945
+ from: string;
1946
+ } | {
1947
+ kind: "arcMidpoint";
1948
+ circle: string;
1949
+ a: string;
1950
+ b: string;
1951
+ notContaining: string;
1952
+ } | {
1953
+ kind: "reflectPoint";
1954
+ through: string;
1955
+ of: string;
1956
+ } | {
1957
+ kind: "reflectLine";
1958
+ through: string;
1959
+ of: string;
1960
+ } | {
1961
+ kind: "excenter";
1962
+ opposite: string;
1963
+ of: [string, string, string];
1964
+ } | {
1965
+ kind: "rightAngleViewing";
1966
+ onLine: string;
1967
+ a: string;
1968
+ b: string;
1969
+ which?: 0 | 1 | undefined;
1970
+ } | {
1971
+ kind: "pointAtDistance";
1972
+ from: string;
1973
+ through: string;
1974
+ distance: {
1975
+ kind: "circleRadius";
1976
+ circle: string;
1977
+ scale?: number | undefined;
1978
+ offset?: number | undefined;
1979
+ } | {
1980
+ kind: "segmentLength";
1981
+ p1: string;
1982
+ p2: string;
1983
+ scale?: number | undefined;
1984
+ offset?: number | undefined;
1985
+ } | {
1986
+ kind: "literal";
1987
+ value: number;
1988
+ scale?: number | undefined;
1989
+ offset?: number | undefined;
1990
+ };
1991
+ };
1992
+ name: string;
1993
+ op: "add-point";
1994
+ }, {
1995
+ constraint: {
1996
+ kind: "midpoint";
1997
+ of: string;
1998
+ } | {
1999
+ kind: "perpFoot";
2000
+ onLine: string;
2001
+ from: string;
2002
+ } | {
2003
+ kind: "centroid";
2004
+ of: [string, string, string];
2005
+ } | {
2006
+ kind: "circumcenter";
2007
+ of: [string, string, string];
2008
+ } | {
2009
+ kind: "incenter";
2010
+ of: [string, string, string];
2011
+ } | {
2012
+ kind: "orthocenter";
2013
+ of: [string, string, string];
2014
+ } | {
2015
+ kind: "intersection";
2016
+ of: [string, string];
2017
+ branch?: 0 | 1 | undefined;
2018
+ } | {
2019
+ kind: "onSegment";
2020
+ of: string;
2021
+ t?: number | undefined;
2022
+ } | {
2023
+ kind: "free";
2024
+ at?: [number, number] | undefined;
2025
+ } | {
2026
+ kind: "externalToCircle";
2027
+ circle: string;
2028
+ } | {
2029
+ kind: "onCircle";
2030
+ circle: string;
2031
+ theta?: number | undefined;
2032
+ } | {
2033
+ kind: "secondIntersection";
2034
+ line: string;
2035
+ circle: string;
2036
+ other: string;
2037
+ } | {
2038
+ kind: "circleIntersection";
2039
+ c1: string;
2040
+ c2: string;
2041
+ which: 0 | 1;
2042
+ } | {
2043
+ kind: "circleSecondIntersection";
2044
+ c1: string;
2045
+ c2: string;
2046
+ exclude: string;
2047
+ } | {
2048
+ kind: "tangencyPoint";
2049
+ circle: string;
2050
+ onLine: string;
2051
+ } | {
2052
+ kind: "tangentPoint";
2053
+ circle: string;
2054
+ from: string;
2055
+ which: 0 | 1;
2056
+ } | {
2057
+ kind: "angleBisectorFoot";
2058
+ onLine: string;
2059
+ from: string;
2060
+ } | {
2061
+ kind: "externalAngleBisectorFoot";
2062
+ onLine: string;
2063
+ from: string;
2064
+ } | {
2065
+ kind: "arcMidpoint";
2066
+ circle: string;
2067
+ a: string;
2068
+ b: string;
2069
+ notContaining: string;
2070
+ } | {
2071
+ kind: "reflectPoint";
2072
+ through: string;
2073
+ of: string;
2074
+ } | {
2075
+ kind: "reflectLine";
2076
+ through: string;
2077
+ of: string;
2078
+ } | {
2079
+ kind: "excenter";
2080
+ opposite: string;
2081
+ of: [string, string, string];
2082
+ } | {
2083
+ kind: "rightAngleViewing";
2084
+ onLine: string;
2085
+ a: string;
2086
+ b: string;
2087
+ which?: 0 | 1 | undefined;
2088
+ } | {
2089
+ kind: "pointAtDistance";
2090
+ from: string;
2091
+ through: string;
2092
+ distance: {
2093
+ kind: "circleRadius";
2094
+ circle: string;
2095
+ scale?: number | undefined;
2096
+ offset?: number | undefined;
2097
+ } | {
2098
+ kind: "segmentLength";
2099
+ p1: string;
2100
+ p2: string;
2101
+ scale?: number | undefined;
2102
+ offset?: number | undefined;
2103
+ } | {
2104
+ kind: "literal";
2105
+ value: number;
2106
+ scale?: number | undefined;
2107
+ offset?: number | undefined;
2108
+ };
2109
+ };
2110
+ name: string;
2111
+ op: "add-point";
2112
+ }>, z.ZodObject<{
2113
+ op: z.ZodLiteral<"connect">;
2114
+ from: z.ZodString;
2115
+ to: z.ZodString;
2116
+ style: z.ZodDefault<z.ZodEnum<["segment", "line", "ray", "perpBisector", "angleBisector"]>>;
2117
+ }, "strip", z.ZodTypeAny, {
2118
+ from: string;
2119
+ op: "connect";
2120
+ to: string;
2121
+ style: "segment" | "line" | "ray" | "perpBisector" | "angleBisector";
2122
+ }, {
2123
+ from: string;
2124
+ op: "connect";
2125
+ to: string;
2126
+ style?: "segment" | "line" | "ray" | "perpBisector" | "angleBisector" | undefined;
2127
+ }>, z.ZodObject<{
2128
+ op: z.ZodLiteral<"draw-circle">;
2129
+ name: z.ZodString;
2130
+ spec: z.ZodEnum<["centerThrough", "through3", "centerRadius", "inscribedIn", "diameter"]>;
2131
+ center: z.ZodOptional<z.ZodString>;
2132
+ through: z.ZodOptional<z.ZodString>;
2133
+ points: z.ZodOptional<z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>>;
2134
+ radius: z.ZodOptional<z.ZodNumber>;
2135
+ triangle: z.ZodOptional<z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>>;
2136
+ endpoints: z.ZodOptional<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
2137
+ }, "strip", z.ZodTypeAny, {
2138
+ name: string;
2139
+ op: "draw-circle";
2140
+ spec: "diameter" | "centerThrough" | "through3" | "centerRadius" | "inscribedIn";
2141
+ points?: [string, string, string] | undefined;
2142
+ through?: string | undefined;
2143
+ center?: string | undefined;
2144
+ radius?: number | undefined;
2145
+ triangle?: [string, string, string] | undefined;
2146
+ endpoints?: [string, string] | undefined;
2147
+ }, {
2148
+ name: string;
2149
+ op: "draw-circle";
2150
+ spec: "diameter" | "centerThrough" | "through3" | "centerRadius" | "inscribedIn";
2151
+ points?: [string, string, string] | undefined;
2152
+ through?: string | undefined;
2153
+ center?: string | undefined;
2154
+ radius?: number | undefined;
2155
+ triangle?: [string, string, string] | undefined;
2156
+ endpoints?: [string, string] | undefined;
2157
+ }>, z.ZodObject<{
2158
+ op: z.ZodLiteral<"draw-line">;
2159
+ name: z.ZodString;
2160
+ kind: z.ZodEnum<["perpThrough", "parallelThrough", "tangentAt", "tangentFromExt", "angleBisector", "lineThrough", "radicalAxis"]>;
2161
+ through: z.ZodOptional<z.ZodString>;
2162
+ to: z.ZodOptional<z.ZodString>;
2163
+ from: z.ZodOptional<z.ZodString>;
2164
+ circle: z.ZodOptional<z.ZodString>;
2165
+ which: z.ZodOptional<z.ZodEnum<["first", "second", "both"]>>;
2166
+ points: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2167
+ circle1: z.ZodOptional<z.ZodString>;
2168
+ circle2: z.ZodOptional<z.ZodString>;
2169
+ p1: z.ZodOptional<z.ZodString>;
2170
+ vertex: z.ZodOptional<z.ZodString>;
2171
+ p2: z.ZodOptional<z.ZodString>;
2172
+ }, "strip", z.ZodTypeAny, {
2173
+ kind: "angleBisector" | "lineThrough" | "radicalAxis" | "perpThrough" | "parallelThrough" | "tangentAt" | "tangentFromExt";
2174
+ name: string;
2175
+ op: "draw-line";
2176
+ circle?: string | undefined;
2177
+ points?: string[] | undefined;
2178
+ p1?: string | undefined;
2179
+ p2?: string | undefined;
2180
+ from?: string | undefined;
2181
+ through?: string | undefined;
2182
+ vertex?: string | undefined;
2183
+ circle1?: string | undefined;
2184
+ circle2?: string | undefined;
2185
+ which?: "first" | "second" | "both" | undefined;
2186
+ to?: string | undefined;
2187
+ }, {
2188
+ kind: "angleBisector" | "lineThrough" | "radicalAxis" | "perpThrough" | "parallelThrough" | "tangentAt" | "tangentFromExt";
2189
+ name: string;
2190
+ op: "draw-line";
2191
+ circle?: string | undefined;
2192
+ points?: string[] | undefined;
2193
+ p1?: string | undefined;
2194
+ p2?: string | undefined;
2195
+ from?: string | undefined;
2196
+ through?: string | undefined;
2197
+ vertex?: string | undefined;
2198
+ circle1?: string | undefined;
2199
+ circle2?: string | undefined;
2200
+ which?: "first" | "second" | "both" | undefined;
2201
+ to?: string | undefined;
2202
+ }>, z.ZodObject<{
2203
+ op: z.ZodLiteral<"mark-shape">;
2204
+ shape: z.ZodEnum<["triangle", "quadrilateral"]>;
2205
+ labels: z.ZodArray<z.ZodString, "many">;
2206
+ }, "strip", z.ZodTypeAny, {
2207
+ shape: "triangle" | "quadrilateral";
2208
+ op: "mark-shape";
2209
+ labels: string[];
2210
+ }, {
2211
+ shape: "triangle" | "quadrilateral";
2212
+ op: "mark-shape";
2213
+ labels: string[];
2214
+ }>]>, "many">>;
2215
+ reason: z.ZodOptional<z.ZodString>;
2216
+ }, "strip", z.ZodTypeAny, {
2217
+ decision: "build" | "refuse";
2218
+ reason?: string | undefined;
2219
+ intents?: ({
2220
+ shape: "square" | "rectangle" | "rhombus" | "parallelogram" | "triangle" | "trapezoid" | "quadrilateral";
2221
+ op: "draw-shape";
2222
+ labels: string[];
2223
+ variant: "any" | "equilateral" | "isoceles-AB" | "isoceles-BC" | "isoceles-CA" | "right-at-A" | "right-at-B" | "right-at-C" | "standard" | "wide" | "tall" | "right" | "isoceles" | "general";
2224
+ explicitCoords?: Record<string, [number, number]> | undefined;
2225
+ } | {
2226
+ constraint: {
2227
+ kind: "midpoint";
2228
+ of: string;
2229
+ } | {
2230
+ kind: "perpFoot";
2231
+ onLine: string;
2232
+ from: string;
2233
+ } | {
2234
+ kind: "centroid";
2235
+ of: [string, string, string];
2236
+ } | {
2237
+ kind: "circumcenter";
2238
+ of: [string, string, string];
2239
+ } | {
2240
+ kind: "incenter";
2241
+ of: [string, string, string];
2242
+ } | {
2243
+ kind: "orthocenter";
2244
+ of: [string, string, string];
2245
+ } | {
2246
+ kind: "intersection";
2247
+ of: [string, string];
2248
+ branch?: 0 | 1 | undefined;
2249
+ } | {
2250
+ kind: "onSegment";
2251
+ of: string;
2252
+ t?: number | undefined;
2253
+ } | {
2254
+ kind: "free";
2255
+ at?: [number, number] | undefined;
2256
+ } | {
2257
+ kind: "externalToCircle";
2258
+ circle: string;
2259
+ } | {
2260
+ kind: "onCircle";
2261
+ circle: string;
2262
+ theta?: number | undefined;
2263
+ } | {
2264
+ kind: "secondIntersection";
2265
+ line: string;
2266
+ circle: string;
2267
+ other: string;
2268
+ } | {
2269
+ kind: "circleIntersection";
2270
+ c1: string;
2271
+ c2: string;
2272
+ which: 0 | 1;
2273
+ } | {
2274
+ kind: "circleSecondIntersection";
2275
+ c1: string;
2276
+ c2: string;
2277
+ exclude: string;
2278
+ } | {
2279
+ kind: "tangencyPoint";
2280
+ circle: string;
2281
+ onLine: string;
2282
+ } | {
2283
+ kind: "tangentPoint";
2284
+ circle: string;
2285
+ from: string;
2286
+ which: 0 | 1;
2287
+ } | {
2288
+ kind: "angleBisectorFoot";
2289
+ onLine: string;
2290
+ from: string;
2291
+ } | {
2292
+ kind: "externalAngleBisectorFoot";
2293
+ onLine: string;
2294
+ from: string;
2295
+ } | {
2296
+ kind: "arcMidpoint";
2297
+ circle: string;
2298
+ a: string;
2299
+ b: string;
2300
+ notContaining: string;
2301
+ } | {
2302
+ kind: "reflectPoint";
2303
+ through: string;
2304
+ of: string;
2305
+ } | {
2306
+ kind: "reflectLine";
2307
+ through: string;
2308
+ of: string;
2309
+ } | {
2310
+ kind: "excenter";
2311
+ opposite: string;
2312
+ of: [string, string, string];
2313
+ } | {
2314
+ kind: "rightAngleViewing";
2315
+ onLine: string;
2316
+ a: string;
2317
+ b: string;
2318
+ which?: 0 | 1 | undefined;
2319
+ } | {
2320
+ kind: "pointAtDistance";
2321
+ from: string;
2322
+ through: string;
2323
+ distance: {
2324
+ kind: "circleRadius";
2325
+ circle: string;
2326
+ scale?: number | undefined;
2327
+ offset?: number | undefined;
2328
+ } | {
2329
+ kind: "segmentLength";
2330
+ p1: string;
2331
+ p2: string;
2332
+ scale?: number | undefined;
2333
+ offset?: number | undefined;
2334
+ } | {
2335
+ kind: "literal";
2336
+ value: number;
2337
+ scale?: number | undefined;
2338
+ offset?: number | undefined;
2339
+ };
2340
+ };
2341
+ name: string;
2342
+ op: "add-point";
2343
+ } | {
2344
+ from: string;
2345
+ op: "connect";
2346
+ to: string;
2347
+ style: "segment" | "line" | "ray" | "perpBisector" | "angleBisector";
2348
+ } | {
2349
+ name: string;
2350
+ op: "draw-circle";
2351
+ spec: "diameter" | "centerThrough" | "through3" | "centerRadius" | "inscribedIn";
2352
+ points?: [string, string, string] | undefined;
2353
+ through?: string | undefined;
2354
+ center?: string | undefined;
2355
+ radius?: number | undefined;
2356
+ triangle?: [string, string, string] | undefined;
2357
+ endpoints?: [string, string] | undefined;
2358
+ } | {
2359
+ kind: "angleBisector" | "lineThrough" | "radicalAxis" | "perpThrough" | "parallelThrough" | "tangentAt" | "tangentFromExt";
2360
+ name: string;
2361
+ op: "draw-line";
2362
+ circle?: string | undefined;
2363
+ points?: string[] | undefined;
2364
+ p1?: string | undefined;
2365
+ p2?: string | undefined;
2366
+ from?: string | undefined;
2367
+ through?: string | undefined;
2368
+ vertex?: string | undefined;
2369
+ circle1?: string | undefined;
2370
+ circle2?: string | undefined;
2371
+ which?: "first" | "second" | "both" | undefined;
2372
+ to?: string | undefined;
2373
+ } | {
2374
+ shape: "triangle" | "quadrilateral";
2375
+ op: "mark-shape";
2376
+ labels: string[];
2377
+ })[] | undefined;
2378
+ }, {
2379
+ decision: "build" | "refuse";
2380
+ reason?: string | undefined;
2381
+ intents?: ({
2382
+ shape: "square" | "rectangle" | "rhombus" | "parallelogram" | "triangle" | "trapezoid" | "quadrilateral";
2383
+ op: "draw-shape";
2384
+ labels: string[];
2385
+ variant?: "any" | "equilateral" | "isoceles-AB" | "isoceles-BC" | "isoceles-CA" | "right-at-A" | "right-at-B" | "right-at-C" | "standard" | "wide" | "tall" | "right" | "isoceles" | "general" | undefined;
2386
+ explicitCoords?: Record<string, [number, number]> | undefined;
2387
+ } | {
2388
+ constraint: {
2389
+ kind: "midpoint";
2390
+ of: string;
2391
+ } | {
2392
+ kind: "perpFoot";
2393
+ onLine: string;
2394
+ from: string;
2395
+ } | {
2396
+ kind: "centroid";
2397
+ of: [string, string, string];
2398
+ } | {
2399
+ kind: "circumcenter";
2400
+ of: [string, string, string];
2401
+ } | {
2402
+ kind: "incenter";
2403
+ of: [string, string, string];
2404
+ } | {
2405
+ kind: "orthocenter";
2406
+ of: [string, string, string];
2407
+ } | {
2408
+ kind: "intersection";
2409
+ of: [string, string];
2410
+ branch?: 0 | 1 | undefined;
2411
+ } | {
2412
+ kind: "onSegment";
2413
+ of: string;
2414
+ t?: number | undefined;
2415
+ } | {
2416
+ kind: "free";
2417
+ at?: [number, number] | undefined;
2418
+ } | {
2419
+ kind: "externalToCircle";
2420
+ circle: string;
2421
+ } | {
2422
+ kind: "onCircle";
2423
+ circle: string;
2424
+ theta?: number | undefined;
2425
+ } | {
2426
+ kind: "secondIntersection";
2427
+ line: string;
2428
+ circle: string;
2429
+ other: string;
2430
+ } | {
2431
+ kind: "circleIntersection";
2432
+ c1: string;
2433
+ c2: string;
2434
+ which: 0 | 1;
2435
+ } | {
2436
+ kind: "circleSecondIntersection";
2437
+ c1: string;
2438
+ c2: string;
2439
+ exclude: string;
2440
+ } | {
2441
+ kind: "tangencyPoint";
2442
+ circle: string;
2443
+ onLine: string;
2444
+ } | {
2445
+ kind: "tangentPoint";
2446
+ circle: string;
2447
+ from: string;
2448
+ which: 0 | 1;
2449
+ } | {
2450
+ kind: "angleBisectorFoot";
2451
+ onLine: string;
2452
+ from: string;
2453
+ } | {
2454
+ kind: "externalAngleBisectorFoot";
2455
+ onLine: string;
2456
+ from: string;
2457
+ } | {
2458
+ kind: "arcMidpoint";
2459
+ circle: string;
2460
+ a: string;
2461
+ b: string;
2462
+ notContaining: string;
2463
+ } | {
2464
+ kind: "reflectPoint";
2465
+ through: string;
2466
+ of: string;
2467
+ } | {
2468
+ kind: "reflectLine";
2469
+ through: string;
2470
+ of: string;
2471
+ } | {
2472
+ kind: "excenter";
2473
+ opposite: string;
2474
+ of: [string, string, string];
2475
+ } | {
2476
+ kind: "rightAngleViewing";
2477
+ onLine: string;
2478
+ a: string;
2479
+ b: string;
2480
+ which?: 0 | 1 | undefined;
2481
+ } | {
2482
+ kind: "pointAtDistance";
2483
+ from: string;
2484
+ through: string;
2485
+ distance: {
2486
+ kind: "circleRadius";
2487
+ circle: string;
2488
+ scale?: number | undefined;
2489
+ offset?: number | undefined;
2490
+ } | {
2491
+ kind: "segmentLength";
2492
+ p1: string;
2493
+ p2: string;
2494
+ scale?: number | undefined;
2495
+ offset?: number | undefined;
2496
+ } | {
2497
+ kind: "literal";
2498
+ value: number;
2499
+ scale?: number | undefined;
2500
+ offset?: number | undefined;
2501
+ };
2502
+ };
2503
+ name: string;
2504
+ op: "add-point";
2505
+ } | {
2506
+ from: string;
2507
+ op: "connect";
2508
+ to: string;
2509
+ style?: "segment" | "line" | "ray" | "perpBisector" | "angleBisector" | undefined;
2510
+ } | {
2511
+ name: string;
2512
+ op: "draw-circle";
2513
+ spec: "diameter" | "centerThrough" | "through3" | "centerRadius" | "inscribedIn";
2514
+ points?: [string, string, string] | undefined;
2515
+ through?: string | undefined;
2516
+ center?: string | undefined;
2517
+ radius?: number | undefined;
2518
+ triangle?: [string, string, string] | undefined;
2519
+ endpoints?: [string, string] | undefined;
2520
+ } | {
2521
+ kind: "angleBisector" | "lineThrough" | "radicalAxis" | "perpThrough" | "parallelThrough" | "tangentAt" | "tangentFromExt";
2522
+ name: string;
2523
+ op: "draw-line";
2524
+ circle?: string | undefined;
2525
+ points?: string[] | undefined;
2526
+ p1?: string | undefined;
2527
+ p2?: string | undefined;
2528
+ from?: string | undefined;
2529
+ through?: string | undefined;
2530
+ vertex?: string | undefined;
2531
+ circle1?: string | undefined;
2532
+ circle2?: string | undefined;
2533
+ which?: "first" | "second" | "both" | undefined;
2534
+ to?: string | undefined;
2535
+ } | {
2536
+ shape: "triangle" | "quadrilateral";
2537
+ op: "mark-shape";
2538
+ labels: string[];
2539
+ })[] | undefined;
2540
+ }>, {
2541
+ decision: "build" | "refuse";
2542
+ reason?: string | undefined;
2543
+ intents?: ({
2544
+ shape: "square" | "rectangle" | "rhombus" | "parallelogram" | "triangle" | "trapezoid" | "quadrilateral";
2545
+ op: "draw-shape";
2546
+ labels: string[];
2547
+ variant: "any" | "equilateral" | "isoceles-AB" | "isoceles-BC" | "isoceles-CA" | "right-at-A" | "right-at-B" | "right-at-C" | "standard" | "wide" | "tall" | "right" | "isoceles" | "general";
2548
+ explicitCoords?: Record<string, [number, number]> | undefined;
2549
+ } | {
2550
+ constraint: {
2551
+ kind: "midpoint";
2552
+ of: string;
2553
+ } | {
2554
+ kind: "perpFoot";
2555
+ onLine: string;
2556
+ from: string;
2557
+ } | {
2558
+ kind: "centroid";
2559
+ of: [string, string, string];
2560
+ } | {
2561
+ kind: "circumcenter";
2562
+ of: [string, string, string];
2563
+ } | {
2564
+ kind: "incenter";
2565
+ of: [string, string, string];
2566
+ } | {
2567
+ kind: "orthocenter";
2568
+ of: [string, string, string];
2569
+ } | {
2570
+ kind: "intersection";
2571
+ of: [string, string];
2572
+ branch?: 0 | 1 | undefined;
2573
+ } | {
2574
+ kind: "onSegment";
2575
+ of: string;
2576
+ t?: number | undefined;
2577
+ } | {
2578
+ kind: "free";
2579
+ at?: [number, number] | undefined;
2580
+ } | {
2581
+ kind: "externalToCircle";
2582
+ circle: string;
2583
+ } | {
2584
+ kind: "onCircle";
2585
+ circle: string;
2586
+ theta?: number | undefined;
2587
+ } | {
2588
+ kind: "secondIntersection";
2589
+ line: string;
2590
+ circle: string;
2591
+ other: string;
2592
+ } | {
2593
+ kind: "circleIntersection";
2594
+ c1: string;
2595
+ c2: string;
2596
+ which: 0 | 1;
2597
+ } | {
2598
+ kind: "circleSecondIntersection";
2599
+ c1: string;
2600
+ c2: string;
2601
+ exclude: string;
2602
+ } | {
2603
+ kind: "tangencyPoint";
2604
+ circle: string;
2605
+ onLine: string;
2606
+ } | {
2607
+ kind: "tangentPoint";
2608
+ circle: string;
2609
+ from: string;
2610
+ which: 0 | 1;
2611
+ } | {
2612
+ kind: "angleBisectorFoot";
2613
+ onLine: string;
2614
+ from: string;
2615
+ } | {
2616
+ kind: "externalAngleBisectorFoot";
2617
+ onLine: string;
2618
+ from: string;
2619
+ } | {
2620
+ kind: "arcMidpoint";
2621
+ circle: string;
2622
+ a: string;
2623
+ b: string;
2624
+ notContaining: string;
2625
+ } | {
2626
+ kind: "reflectPoint";
2627
+ through: string;
2628
+ of: string;
2629
+ } | {
2630
+ kind: "reflectLine";
2631
+ through: string;
2632
+ of: string;
2633
+ } | {
2634
+ kind: "excenter";
2635
+ opposite: string;
2636
+ of: [string, string, string];
2637
+ } | {
2638
+ kind: "rightAngleViewing";
2639
+ onLine: string;
2640
+ a: string;
2641
+ b: string;
2642
+ which?: 0 | 1 | undefined;
2643
+ } | {
2644
+ kind: "pointAtDistance";
2645
+ from: string;
2646
+ through: string;
2647
+ distance: {
2648
+ kind: "circleRadius";
2649
+ circle: string;
2650
+ scale?: number | undefined;
2651
+ offset?: number | undefined;
2652
+ } | {
2653
+ kind: "segmentLength";
2654
+ p1: string;
2655
+ p2: string;
2656
+ scale?: number | undefined;
2657
+ offset?: number | undefined;
2658
+ } | {
2659
+ kind: "literal";
2660
+ value: number;
2661
+ scale?: number | undefined;
2662
+ offset?: number | undefined;
2663
+ };
2664
+ };
2665
+ name: string;
2666
+ op: "add-point";
2667
+ } | {
2668
+ from: string;
2669
+ op: "connect";
2670
+ to: string;
2671
+ style: "segment" | "line" | "ray" | "perpBisector" | "angleBisector";
2672
+ } | {
2673
+ name: string;
2674
+ op: "draw-circle";
2675
+ spec: "diameter" | "centerThrough" | "through3" | "centerRadius" | "inscribedIn";
2676
+ points?: [string, string, string] | undefined;
2677
+ through?: string | undefined;
2678
+ center?: string | undefined;
2679
+ radius?: number | undefined;
2680
+ triangle?: [string, string, string] | undefined;
2681
+ endpoints?: [string, string] | undefined;
2682
+ } | {
2683
+ kind: "angleBisector" | "lineThrough" | "radicalAxis" | "perpThrough" | "parallelThrough" | "tangentAt" | "tangentFromExt";
2684
+ name: string;
2685
+ op: "draw-line";
2686
+ circle?: string | undefined;
2687
+ points?: string[] | undefined;
2688
+ p1?: string | undefined;
2689
+ p2?: string | undefined;
2690
+ from?: string | undefined;
2691
+ through?: string | undefined;
2692
+ vertex?: string | undefined;
2693
+ circle1?: string | undefined;
2694
+ circle2?: string | undefined;
2695
+ which?: "first" | "second" | "both" | undefined;
2696
+ to?: string | undefined;
2697
+ } | {
2698
+ shape: "triangle" | "quadrilateral";
2699
+ op: "mark-shape";
2700
+ labels: string[];
2701
+ })[] | undefined;
2702
+ }, {
2703
+ decision: "build" | "refuse";
2704
+ reason?: string | undefined;
2705
+ intents?: ({
2706
+ shape: "square" | "rectangle" | "rhombus" | "parallelogram" | "triangle" | "trapezoid" | "quadrilateral";
2707
+ op: "draw-shape";
2708
+ labels: string[];
2709
+ variant?: "any" | "equilateral" | "isoceles-AB" | "isoceles-BC" | "isoceles-CA" | "right-at-A" | "right-at-B" | "right-at-C" | "standard" | "wide" | "tall" | "right" | "isoceles" | "general" | undefined;
2710
+ explicitCoords?: Record<string, [number, number]> | undefined;
2711
+ } | {
2712
+ constraint: {
2713
+ kind: "midpoint";
2714
+ of: string;
2715
+ } | {
2716
+ kind: "perpFoot";
2717
+ onLine: string;
2718
+ from: string;
2719
+ } | {
2720
+ kind: "centroid";
2721
+ of: [string, string, string];
2722
+ } | {
2723
+ kind: "circumcenter";
2724
+ of: [string, string, string];
2725
+ } | {
2726
+ kind: "incenter";
2727
+ of: [string, string, string];
2728
+ } | {
2729
+ kind: "orthocenter";
2730
+ of: [string, string, string];
2731
+ } | {
2732
+ kind: "intersection";
2733
+ of: [string, string];
2734
+ branch?: 0 | 1 | undefined;
2735
+ } | {
2736
+ kind: "onSegment";
2737
+ of: string;
2738
+ t?: number | undefined;
2739
+ } | {
2740
+ kind: "free";
2741
+ at?: [number, number] | undefined;
2742
+ } | {
2743
+ kind: "externalToCircle";
2744
+ circle: string;
2745
+ } | {
2746
+ kind: "onCircle";
2747
+ circle: string;
2748
+ theta?: number | undefined;
2749
+ } | {
2750
+ kind: "secondIntersection";
2751
+ line: string;
2752
+ circle: string;
2753
+ other: string;
2754
+ } | {
2755
+ kind: "circleIntersection";
2756
+ c1: string;
2757
+ c2: string;
2758
+ which: 0 | 1;
2759
+ } | {
2760
+ kind: "circleSecondIntersection";
2761
+ c1: string;
2762
+ c2: string;
2763
+ exclude: string;
2764
+ } | {
2765
+ kind: "tangencyPoint";
2766
+ circle: string;
2767
+ onLine: string;
2768
+ } | {
2769
+ kind: "tangentPoint";
2770
+ circle: string;
2771
+ from: string;
2772
+ which: 0 | 1;
2773
+ } | {
2774
+ kind: "angleBisectorFoot";
2775
+ onLine: string;
2776
+ from: string;
2777
+ } | {
2778
+ kind: "externalAngleBisectorFoot";
2779
+ onLine: string;
2780
+ from: string;
2781
+ } | {
2782
+ kind: "arcMidpoint";
2783
+ circle: string;
2784
+ a: string;
2785
+ b: string;
2786
+ notContaining: string;
2787
+ } | {
2788
+ kind: "reflectPoint";
2789
+ through: string;
2790
+ of: string;
2791
+ } | {
2792
+ kind: "reflectLine";
2793
+ through: string;
2794
+ of: string;
2795
+ } | {
2796
+ kind: "excenter";
2797
+ opposite: string;
2798
+ of: [string, string, string];
2799
+ } | {
2800
+ kind: "rightAngleViewing";
2801
+ onLine: string;
2802
+ a: string;
2803
+ b: string;
2804
+ which?: 0 | 1 | undefined;
2805
+ } | {
2806
+ kind: "pointAtDistance";
2807
+ from: string;
2808
+ through: string;
2809
+ distance: {
2810
+ kind: "circleRadius";
2811
+ circle: string;
2812
+ scale?: number | undefined;
2813
+ offset?: number | undefined;
2814
+ } | {
2815
+ kind: "segmentLength";
2816
+ p1: string;
2817
+ p2: string;
2818
+ scale?: number | undefined;
2819
+ offset?: number | undefined;
2820
+ } | {
2821
+ kind: "literal";
2822
+ value: number;
2823
+ scale?: number | undefined;
2824
+ offset?: number | undefined;
2825
+ };
2826
+ };
2827
+ name: string;
2828
+ op: "add-point";
2829
+ } | {
2830
+ from: string;
2831
+ op: "connect";
2832
+ to: string;
2833
+ style?: "segment" | "line" | "ray" | "perpBisector" | "angleBisector" | undefined;
2834
+ } | {
2835
+ name: string;
2836
+ op: "draw-circle";
2837
+ spec: "diameter" | "centerThrough" | "through3" | "centerRadius" | "inscribedIn";
2838
+ points?: [string, string, string] | undefined;
2839
+ through?: string | undefined;
2840
+ center?: string | undefined;
2841
+ radius?: number | undefined;
2842
+ triangle?: [string, string, string] | undefined;
2843
+ endpoints?: [string, string] | undefined;
2844
+ } | {
2845
+ kind: "angleBisector" | "lineThrough" | "radicalAxis" | "perpThrough" | "parallelThrough" | "tangentAt" | "tangentFromExt";
2846
+ name: string;
2847
+ op: "draw-line";
2848
+ circle?: string | undefined;
2849
+ points?: string[] | undefined;
2850
+ p1?: string | undefined;
2851
+ p2?: string | undefined;
2852
+ from?: string | undefined;
2853
+ through?: string | undefined;
2854
+ vertex?: string | undefined;
2855
+ circle1?: string | undefined;
2856
+ circle2?: string | undefined;
2857
+ which?: "first" | "second" | "both" | undefined;
2858
+ to?: string | undefined;
2859
+ } | {
2860
+ shape: "triangle" | "quadrilateral";
2861
+ op: "mark-shape";
2862
+ labels: string[];
2863
+ })[] | undefined;
2864
+ }>;
2865
+ type IntentEnvelopeT = z.infer<typeof IntentEnvelopeZ>;
2866
+
2867
+ declare class IntentBuilderError extends Error {
2868
+ readonly intent: IntentT;
2869
+ readonly cause?: string | undefined;
2870
+ constructor(message: string, intent: IntentT, cause?: string | undefined);
97
2871
  }
98
- declare function selectProvider(opts?: SelectProviderOptions): AIProvider;
99
2872
 
100
- interface GenerateOptions extends SelectProviderOptions {
101
- /** Model id override (provider-specific). Mặc định: provider.defaultModel. */
2873
+ declare function intentsToDsl(intents: readonly IntentT[]): DslInputT;
2874
+
2875
+ interface VerifyIssue {
2876
+ readonly axis: 'missing' | 'wrong' | 'extra';
2877
+ readonly detail: string;
2878
+ }
2879
+ interface VerifyReport {
2880
+ readonly ok: boolean;
2881
+ readonly missing: readonly VerifyIssue[];
2882
+ readonly wrong: readonly VerifyIssue[];
2883
+ readonly extra: readonly VerifyIssue[];
2884
+ readonly geometric?: readonly VerifyIssue[];
2885
+ }
2886
+ declare function compareIntents(expected: readonly IntentT[], actual: readonly IntentT[]): VerifyReport;
2887
+ declare function verifyGeometry(intents: readonly IntentT[], dsl: DslInputT): VerifyReport;
2888
+
2889
+ interface GenerateIntentOptions extends SelectProviderOptions {
102
2890
  model?: string;
103
2891
  maxTokens?: number;
104
2892
  signal?: AbortSignal;
2893
+ /**
2894
+ * Track A deterministic-first (mặc định bật). Thử rule engine trước; chỉ gọi
2895
+ * LLM (Track B) khi deterministic không phủ đủ / không dựng được. Đặt false để
2896
+ * ép luôn dùng LLM (vd so sánh eval, debug).
2897
+ */
2898
+ useDeterministic?: boolean;
2899
+ /**
2900
+ * CHỈ deterministic — KHÔNG fallback LLM. Track A miss → trả failure
2901
+ * `deterministic_miss` (kèm lý do) thay vì gọi Track B. Dùng khi tối ưu rule
2902
+ * base: muốn THẤY đề nào rule chưa phủ (không tốn token, không che lấp gap).
2903
+ * Ưu tiên hơn `useDeterministic` (true ⇒ luôn chạy Track A, không bao giờ LLM).
2904
+ */
2905
+ deterministicOnly?: boolean;
105
2906
  }
106
- interface TokenUsage$1 {
2907
+ interface IntentTokenUsage {
107
2908
  inputTokens: number;
108
2909
  outputTokens: number;
109
- cacheReadTokens: number;
110
- cacheCreationTokens: number;
2910
+ cacheReadTokens?: number;
2911
+ cacheCreationTokens?: number;
111
2912
  }
112
- type GenerateResult = {
2913
+ interface IntentSuccessResult {
113
2914
  ok: true;
114
- state: State;
115
- dsl: DslInputT;
116
- usage: TokenUsage$1;
2915
+ intents: readonly IntentT[];
2916
+ dsl: ReturnType<typeof intentsToDsl>;
2917
+ transpile: Extract<TranspileResult, {
2918
+ ok: true;
2919
+ }>;
2920
+ verify: VerifyReport;
2921
+ usage: IntentTokenUsage;
117
2922
  provider: string;
118
- } | {
119
- ok: false;
120
- reason: 'refused';
121
- message: string;
122
- usage?: TokenUsage$1;
123
- provider?: string;
124
- } | {
125
- ok: false;
126
- reason: 'parse_error';
127
- message: string;
128
- raw?: unknown;
129
- usage?: TokenUsage$1;
130
- provider?: string;
131
- } | {
132
- ok: false;
133
- reason: 'transpile_error';
134
- message: string;
135
- errors: TranspileError[];
136
- dsl: unknown;
137
- usage?: TokenUsage$1;
138
- provider?: string;
139
- } | {
2923
+ }
2924
+ interface IntentFailureResult {
140
2925
  ok: false;
141
- reason: 'api_error';
2926
+ reason: 'refused' | 'parse_error' | 'builder_error' | 'transpile_error' | 'verify_error' | 'provider_error' | 'deterministic_miss';
142
2927
  message: string;
143
- status?: number;
2928
+ intents?: readonly IntentT[];
2929
+ dsl?: ReturnType<typeof intentsToDsl>;
2930
+ usage?: IntentTokenUsage;
144
2931
  provider?: string;
145
- };
146
- declare function generateFigure(problem: string, opts?: GenerateOptions): Promise<GenerateResult>;
2932
+ }
2933
+ type IntentGenerateResult = IntentSuccessResult | IntentFailureResult;
2934
+ declare function generateFigureIntent(problem: string, opts?: GenerateIntentOptions): Promise<IntentGenerateResult>;
147
2935
 
148
2936
  interface HandleGenerateFigureInput {
149
2937
  /** Đề bài tiếng Việt từ teacher. */
150
2938
  problem: string;
151
2939
  }
152
- interface HandleGenerateFigureOptions extends GenerateOptions {
2940
+ interface HandleGenerateFigureOptions extends GenerateIntentOptions {
153
2941
  /**
154
- * Optional telemetry hook. Gọi cho MỖI attempt với envelope nội bộ trước
2942
+ * Telemetry hook: gọi cho MỖI attempt với IntentGenerateResult nội bộ trước
155
2943
  * khi map sang AiFigureUiResult — consumer dùng để log usage/cost/error.
156
- * Không throw từ logger — sẽ swallow để không vỡ response.
2944
+ * Không throw từ logger (swallow để không vỡ response).
157
2945
  *
158
- * @param result GenerateResult của attempt
2946
+ * @param result IntentGenerateResult của attempt
159
2947
  * @param attempt 1-indexed (1 = lần đầu, 2 = retry, ...)
160
2948
  */
161
- onResult?: (result: GenerateResult, attempt: number) => void;
2949
+ onResult?: (result: IntentGenerateResult, attempt: number) => void;
162
2950
  /**
163
- * Số attempt tối đa khi nhận `transpile_error`. Default 2 (1 retry).
164
- * AI stochastic → lần 2 thường khá hơn. Min 1, max 5.
2951
+ * Số attempt tối đa khi build error (transpile/builder). Default 2 (1 retry).
2952
+ * LLM stochastic → lần 2 thường khá hơn. Clamp [1,5].
165
2953
  */
166
2954
  maxAttempts?: number;
167
2955
  }
168
2956
  /**
169
- * Gọi AI orchestrator và trả về kết quả ở dạng `AiFigureUiResult` mà
2957
+ * Gọi rule-engine intent pipeline và trả về `AiFigureUiResult` mà
170
2958
  * `<Whiteboard generateGeometryFigure>` chấp nhận trực tiếp.
171
2959
  *
172
- * Auto-retry: chỉ retry khi `transpile_error` (DSL không hợp lệ — model
173
- * stochastic hội emit khá hơn lần 2). KHÔNG retry `refused` (AI cố ý
174
- * từ chối), `parse_error` (envelope sai schema — chắc chắn sai mọi lần),
175
- * hay `api_error` (network / config — không liên quan model).
2960
+ * Track A (deterministic rules) chạy trong `generateFigureIntent` đề dễ→trung
2961
+ * bình dựng KHÔNG tốn token. Miss Track B (LLM intent).
176
2962
  *
177
- * Mapping:
178
- * - ok=true → { ok: true, state }
179
- * - refused { ok: false, message: <message AI gửi> }
180
- * - parse_error → { ok: false, message: 'AI trả JSON không hợp lệ…' }
181
- * - transpile_error → { ok: false, message: 'AI tạo hình không hợp lệ…' }
182
- * - api_error → { ok: false, message: <message gốc> }
2963
+ * Auto-retry: chỉ retry khi `transpile_error`/`builder_error` (AI emit hình
2964
+ * structurally sai model stochastic có cơ hội khá hơn lần 2). KHÔNG retry
2965
+ * `refused` (cố ý), `parse_error` (sai schema), `provider_error` (network/config).
183
2966
  *
184
- * Server-side caller giữ `GenerateResult` đầy đủ qua `onResult` callback cho
185
- * mục đích telemetry/logging.
2967
+ * Server-side caller giữ `IntentGenerateResult` đầy đủ qua `onResult` cho
2968
+ * telemetry/logging.
186
2969
  */
187
2970
  declare function handleGenerateFigure(input: HandleGenerateFigureInput, opts?: HandleGenerateFigureOptions): Promise<AiFigureUiResult>;
188
2971
 
@@ -469,4 +3252,148 @@ declare const FigureRefineEnvelopeZ: z.ZodEffects<z.ZodObject<{
469
3252
  type FigureRefineEnvelopeT = z.infer<typeof FigureRefineEnvelopeZ>;
470
3253
  declare function refineEnvelopeJsonSchema(): Record<string, unknown>;
471
3254
 
472
- export { type AIProvider, AnthropicProvider, type FigureEnvelopeT, FigureEnvelopeZ, type FigureRefineEnvelopeT, FigureRefineEnvelopeZ, type GenerateDeltaOptions, type GenerateDeltaResult, type GenerateFigureDeltaInput, type GenerateOptions, type GenerateResult, type HandleGenerateFigureDeltaInput, type HandleGenerateFigureDeltaOptions, type HandleGenerateFigureInput, type HandleGenerateFigureOptions, OllamaProvider, type ProviderOutput, type ProviderRequest, type ProviderTokenUsage, type SelectProviderOptions, type TokenUsage$1 as TokenUsage, envelopeBuildDsl, envelopeJsonSchema, generateFigure, generateFigureDelta, handleGenerateFigure, handleGenerateFigureDelta, refineEnvelopeJsonSchema, selectProvider };
3255
+ declare function intentEnvelopeJsonSchema(): Record<string, unknown>;
3256
+ declare function envelopeIntentList(env: IntentEnvelopeT): readonly IntentT[];
3257
+
3258
+ declare function buildIntentSystemPrompt(): string;
3259
+
3260
+ interface HandleGenerateFigureIntentOptions extends GenerateIntentOptions {
3261
+ }
3262
+ interface HandleGenerateFigureIntentInput {
3263
+ problem: string;
3264
+ }
3265
+ type AiFigureIntentUiResult = {
3266
+ kind: 'success';
3267
+ dsl: DslInputT;
3268
+ intents: readonly IntentT[];
3269
+ svg?: string;
3270
+ usage: {
3271
+ inputTokens: number;
3272
+ outputTokens: number;
3273
+ };
3274
+ } | {
3275
+ kind: 'refused';
3276
+ message: string;
3277
+ } | {
3278
+ kind: 'error';
3279
+ code: string;
3280
+ message: string;
3281
+ };
3282
+ declare function handleGenerateFigureIntent(problem: string, opts?: HandleGenerateFigureIntentOptions): Promise<AiFigureIntentUiResult>;
3283
+
3284
+ interface Clause {
3285
+ id: number;
3286
+ text: string;
3287
+ /** clause chứa ≥1 từ khoá hình học → tính vào mẫu số coverage. */
3288
+ hasGeometry: boolean;
3289
+ }
3290
+ interface CoverageReport {
3291
+ complete: boolean;
3292
+ coveredClauseIds: number[];
3293
+ uncovered: Clause[];
3294
+ ratio: number;
3295
+ }
3296
+
3297
+ type DeterministicReason = 'no-match' | 'incomplete-coverage' | 'build-throw' | 'transpile-throw' | 'transpile-fail' | 'verify-fail' | 'named-missing' | 'intent-dropped';
3298
+ interface DeterministicFigure {
3299
+ intents: IntentT[];
3300
+ dsl: DslInputT;
3301
+ transpile: Extract<TranspileResult, {
3302
+ ok: true;
3303
+ }>;
3304
+ verify: VerifyReport;
3305
+ coverage: CoverageReport;
3306
+ }
3307
+ type TryDeterministicResult = {
3308
+ ok: true;
3309
+ figure: DeterministicFigure;
3310
+ } | {
3311
+ ok: false;
3312
+ reason: DeterministicReason;
3313
+ detail?: string;
3314
+ coverage?: CoverageReport;
3315
+ };
3316
+ declare function tryDeterministicFigure(problem: string): TryDeterministicResult;
3317
+
3318
+ interface PartialDeterministicResult {
3319
+ /** Intent deterministic từ các clause đã được rule claim (deduped). */
3320
+ detIntents: IntentT[];
3321
+ /** Clause geo CHƯA được phủ — phần LLM cần bù (hybrid Phase 2). */
3322
+ uncovered: Clause[];
3323
+ coverage: CoverageReport;
3324
+ /**
3325
+ * true khi deterministic phủ MỘT PHẦN: có rule match + ≥1 intent NHƯNG coverage
3326
+ * CHƯA đầy đủ. Đây là điều kiện kích hoạt hybrid (Phase 2 gọi LLM bù `uncovered`
3327
+ * rồi mergeIntents). false khi: complete (Track A lo đủ) hoặc no-match/0 intent
3328
+ * (full LLM Track B).
3329
+ */
3330
+ hasPartial: boolean;
3331
+ }
3332
+ /**
3333
+ * Deterministic-only (KHÔNG LLM): thu intent phần đã phủ + clause còn thiếu, kể
3334
+ * cả khi coverage incomplete. Nền cho hybrid partial-coverage — Phase 2 sẽ gọi
3335
+ * LLM bù `uncovered` rồi `mergeIntents(detIntents, llmIntents)`.
3336
+ */
3337
+ declare function tryPartialDeterministic(problem: string): PartialDeterministicResult;
3338
+
3339
+ /**
3340
+ * Gộp intent deterministic (det) + intent LLM bù (llm). Det giữ nguyên; mỗi
3341
+ * intent LLM bị loại nếu: trùng JSON với intent đã có, HOẶC định nghĩa lại tên
3342
+ * mà det đã sở hữu (det thắng — phần deterministic đã đúng, đừng để LLM ghi đè).
3343
+ */
3344
+ declare function mergeIntents(det: readonly IntentT[], llm: readonly IntentT[]): IntentT[];
3345
+
3346
+ declare function buildVisionSystemPrompt(): string;
3347
+ declare const VISION_USER_PROMPT = "\u0110\u1ECDc \u0111\u1EC1 b\u00E0i h\u00ECnh h\u1ECDc trong \u1EA3nh sau.";
3348
+
3349
+ declare const VisionEnvelopeZ: z.ZodEffects<z.ZodObject<{
3350
+ decision: z.ZodEnum<["extract", "refuse"]>;
3351
+ text: z.ZodOptional<z.ZodString>;
3352
+ confidence: z.ZodOptional<z.ZodEnum<["high", "low"]>>;
3353
+ reason: z.ZodOptional<z.ZodString>;
3354
+ }, "strip", z.ZodTypeAny, {
3355
+ decision: "extract" | "refuse";
3356
+ text?: string | undefined;
3357
+ reason?: string | undefined;
3358
+ confidence?: "high" | "low" | undefined;
3359
+ }, {
3360
+ decision: "extract" | "refuse";
3361
+ text?: string | undefined;
3362
+ reason?: string | undefined;
3363
+ confidence?: "high" | "low" | undefined;
3364
+ }>, {
3365
+ decision: "extract" | "refuse";
3366
+ text?: string | undefined;
3367
+ reason?: string | undefined;
3368
+ confidence?: "high" | "low" | undefined;
3369
+ }, {
3370
+ decision: "extract" | "refuse";
3371
+ text?: string | undefined;
3372
+ reason?: string | undefined;
3373
+ confidence?: "high" | "low" | undefined;
3374
+ }>;
3375
+ type VisionEnvelopeT = z.infer<typeof VisionEnvelopeZ>;
3376
+ declare function visionEnvelopeJsonSchema(): Record<string, unknown>;
3377
+
3378
+ declare const MAX_EDGE_PX = 2048;
3379
+ declare const MAX_RAW_BYTES: number;
3380
+ declare const MAX_ENCODED_BYTES: number;
3381
+ declare const ALLOWED_TYPES: readonly ["image/png", "image/jpeg", "image/webp"];
3382
+ type AllowedType = (typeof ALLOWED_TYPES)[number];
3383
+ type ValidationResult = {
3384
+ ok: true;
3385
+ mediaType: AllowedType;
3386
+ } | {
3387
+ ok: false;
3388
+ code: 'invalid-format' | 'too-large';
3389
+ message: string;
3390
+ };
3391
+ declare function inferMediaType(file: File): AllowedType | null;
3392
+ declare function validateFile(file: File): ValidationResult;
3393
+ /**
3394
+ * Convert File → ImagePart. Auto-downscale nếu max edge > MAX_EDGE_PX.
3395
+ * Throws nếu file invalid hoặc decode fail.
3396
+ */
3397
+ declare function fileToImagePart(file: File): Promise<ImagePart>;
3398
+
3399
+ export { AIProvider, type AddPointIntentT, type AiFigureIntentUiResult, AnthropicProvider, type ConnectIntentT, type DeterministicFigure, type DrawCircleIntentT, type DrawShapeIntentT, type FigureEnvelopeT, FigureEnvelopeZ, type FigureRefineEnvelopeT, FigureRefineEnvelopeZ, type GenerateDeltaOptions, type GenerateDeltaResult, type GenerateFigureDeltaInput, type GenerateIntentOptions, type HandleGenerateFigureDeltaInput, type HandleGenerateFigureDeltaOptions, type HandleGenerateFigureInput, type HandleGenerateFigureIntentInput, type HandleGenerateFigureIntentOptions, type HandleGenerateFigureOptions, IntentBuilderError, type IntentEnvelopeT, IntentEnvelopeZ, type IntentFailureResult, type IntentGenerateResult, type IntentSuccessResult, type IntentT, IntentZ, MAX_EDGE_PX, MAX_ENCODED_BYTES, MAX_RAW_BYTES, OllamaProvider, type PartialDeterministicResult, ProviderOutput, ProviderRequest, SelectProviderOptions, type TryDeterministicResult, VISION_USER_PROMPT, type ValidationResult, type VerifyIssue, type VerifyReport, type VisionEnvelopeT, VisionEnvelopeZ, buildIntentSystemPrompt, buildVisionSystemPrompt, compareIntents, envelopeBuildDsl, envelopeIntentList, envelopeJsonSchema, fileToImagePart, generateFigureDelta, generateFigureIntent, handleGenerateFigure, handleGenerateFigureDelta, handleGenerateFigureIntent, inferMediaType, intentEnvelopeJsonSchema, intentsToDsl, mergeIntents, refineEnvelopeJsonSchema, tryDeterministicFigure, tryPartialDeterministic, validateFile, verifyGeometry, visionEnvelopeJsonSchema };