@xom11/whiteboard 0.24.2 → 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 (103) hide show
  1. package/README.md +84 -11
  2. package/dist/{ExcalidrawWithMenus-WENZRYYE.mjs → ExcalidrawWithMenus-2QPPTXJM.mjs} +3 -2
  3. package/dist/ExcalidrawWithMenus-2QPPTXJM.mjs.map +1 -0
  4. package/dist/ai.d.mts +3217 -434
  5. package/dist/ai.d.ts +3217 -434
  6. package/dist/ai.js +7679 -598
  7. package/dist/ai.js.map +1 -1
  8. package/dist/ai.mjs +5707 -679
  9. package/dist/ai.mjs.map +1 -1
  10. package/dist/catalog.json +5 -5
  11. package/dist/{chunk-7WQXXEVR.mjs → chunk-4ETJ4CDY.mjs} +5 -5
  12. package/dist/{chunk-7WQXXEVR.mjs.map → chunk-4ETJ4CDY.mjs.map} +1 -1
  13. package/dist/chunk-AJAHD35N.mjs +1708 -0
  14. package/dist/chunk-AJAHD35N.mjs.map +1 -0
  15. package/dist/chunk-AYJPOHCI.mjs +265 -0
  16. package/dist/chunk-AYJPOHCI.mjs.map +1 -0
  17. package/dist/chunk-B4NJJZFR.mjs +18 -0
  18. package/dist/chunk-B4NJJZFR.mjs.map +1 -0
  19. package/dist/{chunk-AZIARTGX.mjs → chunk-BNBOIDO5.mjs} +3 -3
  20. package/dist/{chunk-AZIARTGX.mjs.map → chunk-BNBOIDO5.mjs.map} +1 -1
  21. package/dist/{chunk-LVNCYP4J.mjs → chunk-CXHNVYMD.mjs} +5 -5
  22. package/dist/{chunk-LVNCYP4J.mjs.map → chunk-CXHNVYMD.mjs.map} +1 -1
  23. package/dist/{chunk-45CGKJ7S.mjs → chunk-D5JLJ3PT.mjs} +4 -4
  24. package/dist/{chunk-45CGKJ7S.mjs.map → chunk-D5JLJ3PT.mjs.map} +1 -1
  25. package/dist/{chunk-WM2VDYQA.mjs → chunk-D5LWSN2Y.mjs} +944 -196
  26. package/dist/chunk-D5LWSN2Y.mjs.map +1 -0
  27. package/dist/{chunk-KRC2XOIG.mjs → chunk-HLAOGXEK.mjs} +3 -3
  28. package/dist/{chunk-KRC2XOIG.mjs.map → chunk-HLAOGXEK.mjs.map} +1 -1
  29. package/dist/{chunk-2WF6KIGF.mjs → chunk-I3L56GVH.mjs} +212 -71
  30. package/dist/chunk-I3L56GVH.mjs.map +1 -0
  31. package/dist/{chunk-ZBJBQKJ2.mjs → chunk-IHUFOV7L.mjs} +4 -19
  32. package/dist/chunk-IHUFOV7L.mjs.map +1 -0
  33. package/dist/chunk-J5LGTIGS.mjs +10 -0
  34. package/dist/chunk-J5LGTIGS.mjs.map +1 -0
  35. package/dist/{chunk-BEZSQKPY.mjs → chunk-KYMBUTPO.mjs} +5 -4
  36. package/dist/chunk-KYMBUTPO.mjs.map +1 -0
  37. package/dist/{chunk-4DS3MKID.mjs → chunk-KZGPSTZI.mjs} +4 -4
  38. package/dist/{chunk-4DS3MKID.mjs.map → chunk-KZGPSTZI.mjs.map} +1 -1
  39. package/dist/{chunk-SGFJLHHG.mjs → chunk-PPKHCRRE.mjs} +3 -3
  40. package/dist/{chunk-SGFJLHHG.mjs.map → chunk-PPKHCRRE.mjs.map} +1 -1
  41. package/dist/{chunk-BKSXPNPQ.mjs → chunk-SZDAS7LK.mjs} +81 -3
  42. package/dist/chunk-SZDAS7LK.mjs.map +1 -0
  43. package/dist/chunk-T3SOHYB2.mjs +851 -0
  44. package/dist/chunk-T3SOHYB2.mjs.map +1 -0
  45. package/dist/geometry-2d.d.mts +2 -2
  46. package/dist/geometry-2d.d.ts +2 -2
  47. package/dist/geometry-2d.js +6288 -901
  48. package/dist/geometry-2d.js.map +1 -1
  49. package/dist/geometry-2d.mjs +7 -5
  50. package/dist/geometry-3d.d.mts +2 -2
  51. package/dist/geometry-3d.d.ts +2 -2
  52. package/dist/geometry-3d.js +1335 -253
  53. package/dist/geometry-3d.js.map +1 -1
  54. package/dist/geometry-3d.mjs +6 -4
  55. package/dist/graph-2d.d.mts +2 -2
  56. package/dist/graph-2d.d.ts +2 -2
  57. package/dist/graph-2d.js +1501 -342
  58. package/dist/graph-2d.js.map +1 -1
  59. package/dist/graph-2d.mjs +9 -7
  60. package/dist/handleExtractProblem-C-U5KluK.d.mts +158 -0
  61. package/dist/handleExtractProblem-C-U5KluK.d.ts +158 -0
  62. package/dist/{host-EPZCNFLH.mjs → host-HAYCJJ2T.mjs} +1390 -376
  63. package/dist/host-HAYCJJ2T.mjs.map +1 -0
  64. package/dist/{host-LKCMYEAV.mjs → host-LTJHAY5A.mjs} +12 -10
  65. package/dist/host-LTJHAY5A.mjs.map +1 -0
  66. package/dist/{host-ZIQ77W33.mjs → host-M26FS244.mjs} +8 -6
  67. package/dist/host-M26FS244.mjs.map +1 -0
  68. package/dist/{host-QS2EOTRJ.mjs → host-ZQCDAT6O.mjs} +3 -2
  69. package/dist/host-ZQCDAT6O.mjs.map +1 -0
  70. package/dist/index.d.mts +4 -3
  71. package/dist/index.d.ts +4 -3
  72. package/dist/index.js +6493 -1102
  73. package/dist/index.js.map +1 -1
  74. package/dist/index.mjs +24 -21
  75. package/dist/index.mjs.map +1 -1
  76. package/dist/latex.d.mts +2 -2
  77. package/dist/latex.d.ts +2 -2
  78. package/dist/latex.mjs +2 -1
  79. package/dist/render-ZX2O2IK7.mjs +10 -0
  80. package/dist/{render-SA4JTOW3.mjs.map → render-ZX2O2IK7.mjs.map} +1 -1
  81. package/dist/serialize-C3LSUMSA.mjs +9 -0
  82. package/dist/{serialize-JAVOU22E.mjs.map → serialize-C3LSUMSA.mjs.map} +1 -1
  83. package/dist/types-zc_Pa0mp.d.mts +418 -0
  84. package/dist/types-zc_Pa0mp.d.ts +418 -0
  85. package/package.json +10 -1
  86. package/dist/ExcalidrawWithMenus-WENZRYYE.mjs.map +0 -1
  87. package/dist/chunk-2WF6KIGF.mjs.map +0 -1
  88. package/dist/chunk-BEZSQKPY.mjs.map +0 -1
  89. package/dist/chunk-BKSXPNPQ.mjs.map +0 -1
  90. package/dist/chunk-CGZZO4BX.mjs +0 -96
  91. package/dist/chunk-CGZZO4BX.mjs.map +0 -1
  92. package/dist/chunk-WM2VDYQA.mjs.map +0 -1
  93. package/dist/chunk-ZBJBQKJ2.mjs.map +0 -1
  94. package/dist/host-EPZCNFLH.mjs.map +0 -1
  95. package/dist/host-LKCMYEAV.mjs.map +0 -1
  96. package/dist/host-QS2EOTRJ.mjs.map +0 -1
  97. package/dist/host-ZIQ77W33.mjs.map +0 -1
  98. package/dist/render-SA4JTOW3.mjs +0 -8
  99. package/dist/serialize-JAVOU22E.mjs +0 -7
  100. package/dist/types-Crbefnfe.d.ts +0 -128
  101. package/dist/types-DxlMPh-6.d.mts +0 -49
  102. package/dist/types-DxlMPh-6.d.ts +0 -49
  103. package/dist/types-vtvyKGAA.d.mts +0 -128
package/dist/ai.d.mts CHANGED
@@ -1,580 +1,3081 @@
1
- import { S as State } from './types-DxlMPh-6.mjs';
1
+ import { b as State, D as DslInputT, a as AiFigureUiResult } from './types-zc_Pa0mp.mjs';
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.mjs';
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.mjs';
5
+ import 'react';
6
+ import '@excalidraw/excalidraw/element/types';
3
7
 
4
- declare const DslInput: z.ZodObject<{
5
- version: z.ZodLiteral<1>;
6
- points: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
7
- name: z.ZodString;
8
- kind: z.ZodLiteral<"free">;
9
- x: z.ZodNumber;
10
- y: z.ZodNumber;
11
- }, "strip", z.ZodTypeAny, {
12
- kind: "free";
13
- name: string;
14
- x: number;
15
- y: number;
16
- }, {
17
- kind: "free";
18
- name: string;
19
- x: number;
20
- y: number;
21
- }>, z.ZodObject<{
22
- name: z.ZodString;
8
+ type TranspileErrorCode = 'SCHEMA' | 'DUPLICATE_NAME' | 'UNKNOWN_REF' | 'KIND_MISMATCH' | 'CYCLE';
9
+ interface TranspileError {
10
+ code: TranspileErrorCode;
11
+ message: string;
12
+ path?: string[];
13
+ hint?: string;
14
+ }
15
+ type TranspileResult = {
16
+ ok: true;
17
+ state: State;
18
+ } | {
19
+ ok: false;
20
+ errors: TranspileError[];
21
+ };
22
+
23
+ interface AnthropicProviderOptions {
24
+ apiKey: string;
25
+ /** Cache system prompt qua Anthropic prompt-caching (mặc định bật). */
26
+ enableCaching?: boolean;
27
+ }
28
+ declare class AnthropicProvider implements AIProvider {
29
+ private readonly opts;
30
+ readonly name = "anthropic";
31
+ readonly defaultModel = "claude-opus-4-7";
32
+ constructor(opts: AnthropicProviderOptions);
33
+ call(req: ProviderRequest): Promise<ProviderOutput>;
34
+ extractText(req: VisionRequest): Promise<ProviderOutput>;
35
+ }
36
+
37
+ interface OllamaProviderOptions {
38
+ /** Endpoint base URL, default http://localhost:11434. */
39
+ baseUrl?: string;
40
+ /** Default model id nếu request không truyền. */
41
+ defaultModel?: string;
42
+ /** Custom fetch impl (dùng cho test mock). */
43
+ fetchImpl?: typeof fetch;
44
+ }
45
+ declare class OllamaProvider implements AIProvider {
46
+ readonly name = "ollama";
47
+ readonly defaultModel: string;
48
+ private readonly baseUrl;
49
+ private readonly fetchImpl;
50
+ constructor(opts?: OllamaProviderOptions);
51
+ private resolveFetch;
52
+ call(req: ProviderRequest): Promise<ProviderOutput>;
53
+ extractText(req: VisionRequest): Promise<ProviderOutput>;
54
+ }
55
+
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<{
23
79
  kind: z.ZodLiteral<"midpoint">;
24
- p1: z.ZodString;
25
- p2: z.ZodString;
80
+ of: z.ZodString;
26
81
  }, "strip", z.ZodTypeAny, {
27
82
  kind: "midpoint";
28
- name: string;
29
- p1: string;
30
- p2: string;
83
+ of: string;
31
84
  }, {
32
85
  kind: "midpoint";
33
- name: string;
34
- p1: string;
35
- p2: string;
36
- }>, z.ZodObject<{
37
- name: z.ZodString;
38
- kind: z.ZodLiteral<"onSegment">;
39
- segmentId: z.ZodString;
40
- t: z.ZodNumber;
41
- }, "strip", z.ZodTypeAny, {
42
- kind: "onSegment";
43
- name: string;
44
- segmentId: string;
45
- t: number;
46
- }, {
47
- kind: "onSegment";
48
- name: string;
49
- segmentId: string;
50
- t: number;
51
- }>, z.ZodObject<{
52
- name: z.ZodString;
53
- kind: z.ZodLiteral<"onLine">;
54
- lineId: z.ZodString;
55
- t: z.ZodNumber;
56
- }, "strip", z.ZodTypeAny, {
57
- kind: "onLine";
58
- name: string;
59
- t: number;
60
- lineId: string;
61
- }, {
62
- kind: "onLine";
63
- name: string;
64
- t: number;
65
- lineId: string;
66
- }>, z.ZodObject<{
67
- name: z.ZodString;
68
- kind: z.ZodLiteral<"onCircle">;
69
- circleId: z.ZodString;
70
- theta: z.ZodNumber;
71
- }, "strip", z.ZodTypeAny, {
72
- kind: "onCircle";
73
- name: string;
74
- circleId: string;
75
- theta: number;
76
- }, {
77
- kind: "onCircle";
78
- name: string;
79
- circleId: string;
80
- theta: number;
86
+ of: string;
81
87
  }>, z.ZodObject<{
82
- name: z.ZodString;
83
88
  kind: z.ZodLiteral<"perpFoot">;
84
89
  from: z.ZodString;
85
90
  onLine: z.ZodString;
86
91
  }, "strip", z.ZodTypeAny, {
87
92
  kind: "perpFoot";
88
- name: string;
89
93
  onLine: string;
90
94
  from: string;
91
95
  }, {
92
96
  kind: "perpFoot";
93
- name: string;
94
97
  onLine: string;
95
98
  from: string;
96
99
  }>, z.ZodObject<{
97
- name: z.ZodString;
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<{
98
109
  kind: z.ZodLiteral<"circumcenter">;
99
- vertices: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
110
+ of: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
100
111
  }, "strip", z.ZodTypeAny, {
101
112
  kind: "circumcenter";
102
- name: string;
103
- vertices: [string, string, string];
113
+ of: [string, string, string];
104
114
  }, {
105
115
  kind: "circumcenter";
106
- name: string;
107
- vertices: [string, string, string];
116
+ of: [string, string, string];
108
117
  }>, z.ZodObject<{
109
- name: z.ZodString;
110
118
  kind: z.ZodLiteral<"incenter">;
111
- vertices: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
119
+ of: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
112
120
  }, "strip", z.ZodTypeAny, {
113
121
  kind: "incenter";
114
- name: string;
115
- vertices: [string, string, string];
122
+ of: [string, string, string];
116
123
  }, {
117
124
  kind: "incenter";
118
- name: string;
119
- vertices: [string, string, string];
120
- }>, z.ZodObject<{
121
- name: z.ZodString;
122
- kind: z.ZodLiteral<"centroid">;
123
- vertices: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
124
- }, "strip", z.ZodTypeAny, {
125
- kind: "centroid";
126
- name: string;
127
- vertices: [string, string, string];
128
- }, {
129
- kind: "centroid";
130
- name: string;
131
- vertices: [string, string, string];
125
+ of: [string, string, string];
132
126
  }>, z.ZodObject<{
133
- name: z.ZodString;
134
127
  kind: z.ZodLiteral<"orthocenter">;
135
- vertices: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
128
+ of: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodString], null>;
136
129
  }, "strip", z.ZodTypeAny, {
137
130
  kind: "orthocenter";
138
- name: string;
139
- vertices: [string, string, string];
131
+ of: [string, string, string];
140
132
  }, {
141
133
  kind: "orthocenter";
142
- name: string;
143
- vertices: [string, string, string];
134
+ of: [string, string, string];
144
135
  }>, z.ZodObject<{
145
- name: z.ZodString;
146
136
  kind: z.ZodLiteral<"intersection">;
147
- ref1: z.ZodString;
148
- ref2: z.ZodString;
137
+ of: z.ZodTuple<[z.ZodString, z.ZodString], null>;
149
138
  branch: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
150
139
  }, "strip", z.ZodTypeAny, {
151
140
  kind: "intersection";
152
- name: string;
153
- ref1: string;
154
- ref2: string;
141
+ of: [string, string];
155
142
  branch?: 0 | 1 | undefined;
156
143
  }, {
157
144
  kind: "intersection";
158
- name: string;
159
- ref1: string;
160
- ref2: string;
145
+ of: [string, string];
161
146
  branch?: 0 | 1 | undefined;
162
- }>]>, "many">;
163
- shapes: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
164
- name: z.ZodString;
165
- kind: z.ZodLiteral<"segment">;
166
- p1: z.ZodString;
167
- p2: z.ZodString;
147
+ }>, z.ZodObject<{
148
+ kind: z.ZodLiteral<"onSegment">;
149
+ of: z.ZodString;
150
+ t: z.ZodOptional<z.ZodNumber>;
168
151
  }, "strip", z.ZodTypeAny, {
169
- kind: "segment";
170
- name: string;
171
- p1: string;
172
- p2: string;
152
+ kind: "onSegment";
153
+ of: string;
154
+ t?: number | undefined;
173
155
  }, {
174
- kind: "segment";
175
- name: string;
176
- p1: string;
177
- p2: string;
156
+ kind: "onSegment";
157
+ of: string;
158
+ t?: number | undefined;
178
159
  }>, z.ZodObject<{
179
- name: z.ZodString;
180
- kind: z.ZodLiteral<"line">;
181
- p1: z.ZodString;
182
- p2: z.ZodString;
160
+ kind: z.ZodLiteral<"free">;
161
+ at: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
183
162
  }, "strip", z.ZodTypeAny, {
184
- kind: "line";
185
- name: string;
186
- p1: string;
187
- p2: string;
163
+ kind: "free";
164
+ at?: [number, number] | undefined;
188
165
  }, {
189
- kind: "line";
190
- name: string;
191
- p1: string;
192
- p2: string;
166
+ kind: "free";
167
+ at?: [number, number] | undefined;
193
168
  }>, z.ZodObject<{
194
- name: z.ZodString;
195
- kind: z.ZodLiteral<"ray">;
196
- origin: z.ZodString;
197
- through: z.ZodString;
169
+ kind: z.ZodLiteral<"externalToCircle">;
170
+ circle: z.ZodString;
198
171
  }, "strip", z.ZodTypeAny, {
199
- kind: "ray";
200
- name: string;
201
- origin: string;
202
- through: string;
172
+ kind: "externalToCircle";
173
+ circle: string;
203
174
  }, {
204
- kind: "ray";
205
- name: string;
206
- origin: string;
207
- through: string;
175
+ kind: "externalToCircle";
176
+ circle: string;
208
177
  }>, z.ZodObject<{
209
- name: z.ZodString;
210
- kind: z.ZodLiteral<"polygon">;
211
- vertices: z.ZodArray<z.ZodString, "many">;
178
+ kind: z.ZodLiteral<"onCircle">;
179
+ circle: z.ZodString;
180
+ theta: z.ZodOptional<z.ZodNumber>;
212
181
  }, "strip", z.ZodTypeAny, {
213
- kind: "polygon";
214
- name: string;
215
- vertices: string[];
182
+ kind: "onCircle";
183
+ circle: string;
184
+ theta?: number | undefined;
216
185
  }, {
217
- kind: "polygon";
218
- name: string;
219
- vertices: string[];
186
+ kind: "onCircle";
187
+ circle: string;
188
+ theta?: number | undefined;
220
189
  }>, z.ZodObject<{
221
- name: z.ZodString;
222
- kind: z.ZodLiteral<"perpendicular">;
223
- throughPoint: z.ZodString;
224
- toLine: z.ZodString;
190
+ kind: z.ZodLiteral<"secondIntersection">;
191
+ line: z.ZodString;
192
+ circle: z.ZodString;
193
+ other: z.ZodString;
225
194
  }, "strip", z.ZodTypeAny, {
226
- kind: "perpendicular";
227
- name: string;
228
- throughPoint: string;
229
- toLine: string;
195
+ kind: "secondIntersection";
196
+ line: string;
197
+ circle: string;
198
+ other: string;
230
199
  }, {
231
- kind: "perpendicular";
232
- name: string;
233
- throughPoint: string;
234
- toLine: string;
200
+ kind: "secondIntersection";
201
+ line: string;
202
+ circle: string;
203
+ other: string;
235
204
  }>, z.ZodObject<{
236
- name: z.ZodString;
237
- kind: z.ZodLiteral<"parallel">;
238
- throughPoint: z.ZodString;
239
- toLine: z.ZodString;
205
+ kind: z.ZodLiteral<"circleIntersection">;
206
+ c1: z.ZodString;
207
+ c2: z.ZodString;
208
+ which: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
240
209
  }, "strip", z.ZodTypeAny, {
241
- kind: "parallel";
242
- name: string;
243
- throughPoint: string;
244
- toLine: string;
210
+ kind: "circleIntersection";
211
+ c1: string;
212
+ c2: string;
213
+ which: 0 | 1;
245
214
  }, {
246
- kind: "parallel";
247
- name: string;
248
- throughPoint: string;
249
- toLine: string;
215
+ kind: "circleIntersection";
216
+ c1: string;
217
+ c2: string;
218
+ which: 0 | 1;
250
219
  }>, z.ZodObject<{
251
- name: z.ZodString;
252
- kind: z.ZodLiteral<"perpBisector">;
253
- p1: z.ZodString;
254
- p2: z.ZodString;
220
+ kind: z.ZodLiteral<"circleSecondIntersection">;
221
+ c1: z.ZodString;
222
+ c2: z.ZodString;
223
+ exclude: z.ZodString;
255
224
  }, "strip", z.ZodTypeAny, {
256
- kind: "perpBisector";
257
- name: string;
258
- p1: string;
259
- p2: string;
225
+ kind: "circleSecondIntersection";
226
+ c1: string;
227
+ c2: string;
228
+ exclude: string;
260
229
  }, {
261
- kind: "perpBisector";
262
- name: string;
263
- p1: string;
264
- p2: string;
230
+ kind: "circleSecondIntersection";
231
+ c1: string;
232
+ c2: string;
233
+ exclude: string;
265
234
  }>, z.ZodObject<{
266
- name: z.ZodString;
267
- kind: z.ZodLiteral<"angleBisector">;
268
- p1: z.ZodString;
269
- vertex: z.ZodString;
270
- p2: z.ZodString;
235
+ kind: z.ZodLiteral<"tangencyPoint">;
236
+ circle: z.ZodString;
237
+ onLine: z.ZodString;
271
238
  }, "strip", z.ZodTypeAny, {
272
- kind: "angleBisector";
273
- name: string;
274
- p1: string;
275
- p2: string;
276
- vertex: string;
239
+ kind: "tangencyPoint";
240
+ circle: string;
241
+ onLine: string;
277
242
  }, {
278
- kind: "angleBisector";
279
- name: string;
280
- p1: string;
281
- p2: string;
282
- vertex: string;
243
+ kind: "tangencyPoint";
244
+ circle: string;
245
+ onLine: string;
283
246
  }>, z.ZodObject<{
284
- name: z.ZodString;
285
- kind: z.ZodLiteral<"tangent">;
286
- throughPoint: z.ZodString;
287
- toCircle: z.ZodString;
288
- branch: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<"on">]>>;
247
+ kind: z.ZodLiteral<"tangentPoint">;
248
+ from: z.ZodString;
249
+ circle: z.ZodString;
250
+ which: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
289
251
  }, "strip", z.ZodTypeAny, {
290
- kind: "tangent";
291
- name: string;
292
- throughPoint: string;
293
- toCircle: string;
294
- branch?: 0 | 1 | "on" | undefined;
252
+ kind: "tangentPoint";
253
+ circle: string;
254
+ from: string;
255
+ which: 0 | 1;
295
256
  }, {
296
- kind: "tangent";
297
- name: string;
298
- throughPoint: string;
299
- toCircle: string;
300
- branch?: 0 | 1 | "on" | undefined;
257
+ kind: "tangentPoint";
258
+ circle: string;
259
+ from: string;
260
+ which: 0 | 1;
301
261
  }>, z.ZodObject<{
302
- name: z.ZodString;
303
- kind: z.ZodLiteral<"circleCP">;
304
- center: z.ZodString;
305
- surfacePoint: z.ZodString;
262
+ kind: z.ZodLiteral<"angleBisectorFoot">;
263
+ from: z.ZodString;
264
+ onLine: z.ZodString;
306
265
  }, "strip", z.ZodTypeAny, {
307
- kind: "circleCP";
308
- name: string;
309
- center: string;
310
- surfacePoint: string;
266
+ kind: "angleBisectorFoot";
267
+ onLine: string;
268
+ from: string;
311
269
  }, {
312
- kind: "circleCP";
313
- name: string;
314
- center: string;
315
- surfacePoint: string;
270
+ kind: "angleBisectorFoot";
271
+ onLine: string;
272
+ from: string;
316
273
  }>, z.ZodObject<{
317
- name: z.ZodString;
318
- kind: z.ZodLiteral<"circle3">;
319
- p1: z.ZodString;
320
- p2: z.ZodString;
321
- p3: z.ZodString;
274
+ kind: z.ZodLiteral<"externalAngleBisectorFoot">;
275
+ from: z.ZodString;
276
+ onLine: z.ZodString;
322
277
  }, "strip", z.ZodTypeAny, {
323
- kind: "circle3";
324
- name: string;
325
- p1: string;
326
- p2: string;
327
- p3: string;
278
+ kind: "externalAngleBisectorFoot";
279
+ onLine: string;
280
+ from: string;
328
281
  }, {
329
- kind: "circle3";
330
- name: string;
331
- p1: string;
332
- p2: string;
333
- p3: string;
334
- }>]>, "many">>;
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
+ }>]>;
335
453
  }, "strip", z.ZodTypeAny, {
336
- version: 1;
337
- points: ({
338
- kind: "free";
339
- name: string;
340
- x: number;
341
- y: number;
342
- } | {
454
+ constraint: {
343
455
  kind: "midpoint";
344
- name: string;
345
- p1: string;
346
- p2: string;
347
- } | {
348
- kind: "onSegment";
349
- name: string;
350
- segmentId: string;
351
- t: number;
352
- } | {
353
- kind: "onLine";
354
- name: string;
355
- t: number;
356
- lineId: string;
357
- } | {
358
- kind: "onCircle";
359
- name: string;
360
- circleId: string;
361
- theta: number;
456
+ of: string;
362
457
  } | {
363
458
  kind: "perpFoot";
364
- name: string;
365
459
  onLine: string;
366
460
  from: string;
461
+ } | {
462
+ kind: "centroid";
463
+ of: [string, string, string];
367
464
  } | {
368
465
  kind: "circumcenter";
369
- name: string;
370
- vertices: [string, string, string];
466
+ of: [string, string, string];
371
467
  } | {
372
468
  kind: "incenter";
373
- name: string;
374
- vertices: [string, string, string];
375
- } | {
376
- kind: "centroid";
377
- name: string;
378
- vertices: [string, string, string];
469
+ of: [string, string, string];
379
470
  } | {
380
471
  kind: "orthocenter";
381
- name: string;
382
- vertices: [string, string, string];
472
+ of: [string, string, string];
383
473
  } | {
384
474
  kind: "intersection";
385
- name: string;
386
- ref1: string;
387
- ref2: string;
475
+ of: [string, string];
388
476
  branch?: 0 | 1 | undefined;
389
- })[];
390
- shapes: ({
391
- kind: "segment";
392
- name: string;
393
- p1: string;
394
- p2: string;
395
477
  } | {
396
- kind: "line";
397
- name: string;
398
- p1: string;
399
- p2: string;
478
+ kind: "onSegment";
479
+ of: string;
480
+ t?: number | undefined;
400
481
  } | {
401
- kind: "ray";
402
- name: string;
403
- origin: string;
404
- through: string;
482
+ kind: "free";
483
+ at?: [number, number] | undefined;
405
484
  } | {
406
- kind: "polygon";
407
- name: string;
408
- vertices: string[];
485
+ kind: "externalToCircle";
486
+ circle: string;
409
487
  } | {
410
- kind: "perpendicular";
411
- name: string;
412
- throughPoint: string;
413
- toLine: string;
488
+ kind: "onCircle";
489
+ circle: string;
490
+ theta?: number | undefined;
414
491
  } | {
415
- kind: "parallel";
416
- name: string;
417
- throughPoint: string;
418
- toLine: string;
492
+ kind: "secondIntersection";
493
+ line: string;
494
+ circle: string;
495
+ other: string;
419
496
  } | {
420
- kind: "perpBisector";
421
- name: string;
422
- p1: string;
423
- p2: string;
497
+ kind: "circleIntersection";
498
+ c1: string;
499
+ c2: string;
500
+ which: 0 | 1;
424
501
  } | {
425
- kind: "angleBisector";
426
- name: string;
427
- p1: string;
428
- p2: string;
429
- vertex: string;
502
+ kind: "circleSecondIntersection";
503
+ c1: string;
504
+ c2: string;
505
+ exclude: string;
430
506
  } | {
431
- kind: "tangent";
432
- name: string;
433
- throughPoint: string;
434
- toCircle: string;
435
- branch?: 0 | 1 | "on" | undefined;
507
+ kind: "tangencyPoint";
508
+ circle: string;
509
+ onLine: string;
436
510
  } | {
437
- kind: "circleCP";
438
- name: string;
439
- center: string;
440
- surfacePoint: string;
511
+ kind: "tangentPoint";
512
+ circle: string;
513
+ from: string;
514
+ which: 0 | 1;
441
515
  } | {
442
- kind: "circle3";
443
- name: string;
444
- p1: string;
445
- p2: string;
446
- p3: string;
447
- })[];
448
- }, {
449
- version: 1;
450
- points: ({
451
- kind: "free";
452
- name: string;
453
- x: number;
454
- y: number;
516
+ kind: "angleBisectorFoot";
517
+ onLine: string;
518
+ from: string;
455
519
  } | {
456
- kind: "midpoint";
457
- name: string;
458
- p1: string;
459
- p2: string;
520
+ kind: "externalAngleBisectorFoot";
521
+ onLine: string;
522
+ from: string;
460
523
  } | {
461
- kind: "onSegment";
462
- name: string;
463
- segmentId: string;
464
- t: number;
524
+ kind: "arcMidpoint";
525
+ circle: string;
526
+ a: string;
527
+ b: string;
528
+ notContaining: string;
465
529
  } | {
466
- kind: "onLine";
467
- name: string;
468
- t: number;
469
- lineId: string;
530
+ kind: "reflectPoint";
531
+ through: string;
532
+ of: string;
470
533
  } | {
471
- kind: "onCircle";
472
- name: string;
473
- circleId: string;
474
- theta: number;
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;
475
575
  } | {
476
576
  kind: "perpFoot";
477
- name: string;
478
577
  onLine: string;
479
578
  from: string;
579
+ } | {
580
+ kind: "centroid";
581
+ of: [string, string, string];
480
582
  } | {
481
583
  kind: "circumcenter";
482
- name: string;
483
- vertices: [string, string, string];
584
+ of: [string, string, string];
484
585
  } | {
485
586
  kind: "incenter";
486
- name: string;
487
- vertices: [string, string, string];
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;
488
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, {
489
783
  kind: "centroid";
490
- name: string;
491
- vertices: [string, string, string];
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];
492
1150
  } | {
493
1151
  kind: "orthocenter";
494
- name: string;
495
- vertices: [string, string, string];
1152
+ of: [string, string, string];
496
1153
  } | {
497
1154
  kind: "intersection";
498
- name: string;
499
- ref1: string;
500
- ref2: string;
1155
+ of: [string, string];
501
1156
  branch?: 0 | 1 | undefined;
502
- })[];
503
- shapes?: ({
504
- kind: "segment";
505
- name: string;
506
- p1: string;
507
- p2: string;
508
1157
  } | {
509
- kind: "line";
510
- name: string;
511
- p1: string;
512
- p2: string;
1158
+ kind: "onSegment";
1159
+ of: string;
1160
+ t?: number | undefined;
513
1161
  } | {
514
- kind: "ray";
515
- name: string;
516
- origin: string;
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";
517
1211
  through: string;
1212
+ of: string;
518
1213
  } | {
519
- kind: "polygon";
520
- name: string;
521
- vertices: string[];
1214
+ kind: "reflectLine";
1215
+ through: string;
1216
+ of: string;
522
1217
  } | {
523
- kind: "perpendicular";
524
- name: string;
525
- throughPoint: string;
526
- toLine: string;
1218
+ kind: "excenter";
1219
+ opposite: string;
1220
+ of: [string, string, string];
527
1221
  } | {
528
- kind: "parallel";
529
- name: string;
530
- throughPoint: string;
531
- toLine: string;
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;
532
1327
  } | {
533
- kind: "perpBisector";
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
+ }, {
534
2148
  name: string;
535
- p1: string;
536
- p2: 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";
537
2348
  } | {
538
- kind: "angleBisector";
539
2349
  name: string;
540
- p1: string;
541
- p2: string;
542
- vertex: 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;
543
2510
  } | {
544
- kind: "tangent";
545
2511
  name: string;
546
- throughPoint: string;
547
- toCircle: string;
548
- branch?: 0 | 1 | "on" | undefined;
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";
549
2672
  } | {
550
- kind: "circleCP";
551
2673
  name: string;
552
- center: string;
553
- surfacePoint: 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;
554
2834
  } | {
555
- kind: "circle3";
556
2835
  name: string;
557
- p1: string;
558
- p2: string;
559
- p3: 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[];
560
2863
  })[] | undefined;
561
2864
  }>;
562
- type DslInputT = z.infer<typeof DslInput>;
2865
+ type IntentEnvelopeT = z.infer<typeof IntentEnvelopeZ>;
563
2866
 
564
- type TranspileErrorCode = 'SCHEMA' | 'DUPLICATE_NAME' | 'UNKNOWN_REF' | 'KIND_MISMATCH' | 'CYCLE';
565
- interface TranspileError {
566
- code: TranspileErrorCode;
2867
+ declare class IntentBuilderError extends Error {
2868
+ readonly intent: IntentT;
2869
+ readonly cause?: string | undefined;
2870
+ constructor(message: string, intent: IntentT, cause?: string | undefined);
2871
+ }
2872
+
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 {
2890
+ model?: string;
2891
+ maxTokens?: number;
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;
2906
+ }
2907
+ interface IntentTokenUsage {
2908
+ inputTokens: number;
2909
+ outputTokens: number;
2910
+ cacheReadTokens?: number;
2911
+ cacheCreationTokens?: number;
2912
+ }
2913
+ interface IntentSuccessResult {
2914
+ ok: true;
2915
+ intents: readonly IntentT[];
2916
+ dsl: ReturnType<typeof intentsToDsl>;
2917
+ transpile: Extract<TranspileResult, {
2918
+ ok: true;
2919
+ }>;
2920
+ verify: VerifyReport;
2921
+ usage: IntentTokenUsage;
2922
+ provider: string;
2923
+ }
2924
+ interface IntentFailureResult {
2925
+ ok: false;
2926
+ reason: 'refused' | 'parse_error' | 'builder_error' | 'transpile_error' | 'verify_error' | 'provider_error' | 'deterministic_miss';
567
2927
  message: string;
568
- path?: string[];
569
- hint?: string;
2928
+ intents?: readonly IntentT[];
2929
+ dsl?: ReturnType<typeof intentsToDsl>;
2930
+ usage?: IntentTokenUsage;
2931
+ provider?: string;
570
2932
  }
2933
+ type IntentGenerateResult = IntentSuccessResult | IntentFailureResult;
2934
+ declare function generateFigureIntent(problem: string, opts?: GenerateIntentOptions): Promise<IntentGenerateResult>;
571
2935
 
572
- interface GenerateOptions {
573
- apiKey: string;
2936
+ interface HandleGenerateFigureInput {
2937
+ /** Đề bài tiếng Việt từ teacher. */
2938
+ problem: string;
2939
+ }
2940
+ interface HandleGenerateFigureOptions extends GenerateIntentOptions {
2941
+ /**
2942
+ * Telemetry hook: gọi cho MỖI attempt với IntentGenerateResult nội bộ trước
2943
+ * khi map sang AiFigureUiResult — consumer dùng để log usage/cost/error.
2944
+ * Không throw từ logger (swallow để không vỡ response).
2945
+ *
2946
+ * @param result IntentGenerateResult của attempt
2947
+ * @param attempt 1-indexed (1 = lần đầu, 2 = retry, ...)
2948
+ */
2949
+ onResult?: (result: IntentGenerateResult, attempt: number) => void;
2950
+ /**
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].
2953
+ */
2954
+ maxAttempts?: number;
2955
+ }
2956
+ /**
2957
+ * Gọi rule-engine intent pipeline và trả về `AiFigureUiResult` mà
2958
+ * `<Whiteboard generateGeometryFigure>` chấp nhận trực tiếp.
2959
+ *
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).
2962
+ *
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).
2966
+ *
2967
+ * Server-side caller giữ `IntentGenerateResult` đầy đủ qua `onResult` cho
2968
+ * telemetry/logging.
2969
+ */
2970
+ declare function handleGenerateFigure(input: HandleGenerateFigureInput, opts?: HandleGenerateFigureOptions): Promise<AiFigureUiResult>;
2971
+
2972
+ declare const FigureEnvelopeZ: z.ZodEffects<z.ZodObject<{
2973
+ decision: z.ZodEnum<["build", "refuse"]>;
2974
+ figure: z.ZodOptional<z.ZodObject<{
2975
+ version: z.ZodLiteral<1>;
2976
+ points: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<any, z.UnknownKeysParam, z.ZodTypeAny, {
2977
+ [x: string]: any;
2978
+ }, {
2979
+ [x: string]: any;
2980
+ }>, z.ZodObject<any, z.UnknownKeysParam, z.ZodTypeAny, {
2981
+ [x: string]: any;
2982
+ }, {
2983
+ [x: string]: any;
2984
+ }>, ...z.ZodObject<any, z.UnknownKeysParam, z.ZodTypeAny, {
2985
+ [x: string]: any;
2986
+ }, {
2987
+ [x: string]: any;
2988
+ }>[]]>, "many">;
2989
+ shapes: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<any, z.UnknownKeysParam, z.ZodTypeAny, {
2990
+ [x: string]: any;
2991
+ }, {
2992
+ [x: string]: any;
2993
+ }>, z.ZodObject<any, z.UnknownKeysParam, z.ZodTypeAny, {
2994
+ [x: string]: any;
2995
+ }, {
2996
+ [x: string]: any;
2997
+ }>, ...z.ZodObject<any, z.UnknownKeysParam, z.ZodTypeAny, {
2998
+ [x: string]: any;
2999
+ }, {
3000
+ [x: string]: any;
3001
+ }>[]]>, "many">>;
3002
+ }, "strip", z.ZodTypeAny, {
3003
+ points: {
3004
+ [x: string]: any;
3005
+ }[];
3006
+ version: 1;
3007
+ shapes: {
3008
+ [x: string]: any;
3009
+ }[];
3010
+ }, {
3011
+ points: {
3012
+ [x: string]: any;
3013
+ }[];
3014
+ version: 1;
3015
+ shapes?: {
3016
+ [x: string]: any;
3017
+ }[] | undefined;
3018
+ }>>;
3019
+ reason: z.ZodOptional<z.ZodString>;
3020
+ }, "strip", z.ZodTypeAny, {
3021
+ decision: "build" | "refuse";
3022
+ reason?: string | undefined;
3023
+ figure?: {
3024
+ points: {
3025
+ [x: string]: any;
3026
+ }[];
3027
+ version: 1;
3028
+ shapes: {
3029
+ [x: string]: any;
3030
+ }[];
3031
+ } | undefined;
3032
+ }, {
3033
+ decision: "build" | "refuse";
3034
+ reason?: string | undefined;
3035
+ figure?: {
3036
+ points: {
3037
+ [x: string]: any;
3038
+ }[];
3039
+ version: 1;
3040
+ shapes?: {
3041
+ [x: string]: any;
3042
+ }[] | undefined;
3043
+ } | undefined;
3044
+ }>, {
3045
+ decision: "build" | "refuse";
3046
+ reason?: string | undefined;
3047
+ figure?: {
3048
+ points: {
3049
+ [x: string]: any;
3050
+ }[];
3051
+ version: 1;
3052
+ shapes: {
3053
+ [x: string]: any;
3054
+ }[];
3055
+ } | undefined;
3056
+ }, {
3057
+ decision: "build" | "refuse";
3058
+ reason?: string | undefined;
3059
+ figure?: {
3060
+ points: {
3061
+ [x: string]: any;
3062
+ }[];
3063
+ version: 1;
3064
+ shapes?: {
3065
+ [x: string]: any;
3066
+ }[] | undefined;
3067
+ } | undefined;
3068
+ }>;
3069
+ type FigureEnvelopeT = z.infer<typeof FigureEnvelopeZ>;
3070
+ declare function envelopeJsonSchema(): Record<string, unknown>;
3071
+ /** Helper: ép envelope build hợp lệ về DslInputT (sau khi đã validate). */
3072
+ declare function envelopeBuildDsl(env: FigureEnvelopeT): DslInputT;
3073
+
3074
+ interface GenerateDeltaOptions extends SelectProviderOptions {
574
3075
  model?: string;
575
3076
  maxTokens?: number;
576
- enableCaching?: boolean;
577
3077
  signal?: AbortSignal;
3078
+ maxAttempts?: number;
578
3079
  }
579
3080
  interface TokenUsage {
580
3081
  inputTokens: number;
@@ -582,22 +3083,26 @@ interface TokenUsage {
582
3083
  cacheReadTokens: number;
583
3084
  cacheCreationTokens: number;
584
3085
  }
585
- type GenerateResult = {
3086
+ type GenerateDeltaResult = {
586
3087
  ok: true;
587
3088
  state: State;
588
- dsl: DslInputT;
3089
+ mergedDsl: DslInputT;
3090
+ mode: 'add' | 'replace';
589
3091
  usage: TokenUsage;
3092
+ provider: string;
590
3093
  } | {
591
3094
  ok: false;
592
3095
  reason: 'refused';
593
3096
  message: string;
594
3097
  usage?: TokenUsage;
3098
+ provider?: string;
595
3099
  } | {
596
3100
  ok: false;
597
3101
  reason: 'parse_error';
598
3102
  message: string;
599
3103
  raw?: unknown;
600
3104
  usage?: TokenUsage;
3105
+ provider?: string;
601
3106
  } | {
602
3107
  ok: false;
603
3108
  reason: 'transpile_error';
@@ -605,12 +3110,290 @@ type GenerateResult = {
605
3110
  errors: TranspileError[];
606
3111
  dsl: unknown;
607
3112
  usage?: TokenUsage;
3113
+ provider?: string;
3114
+ } | {
3115
+ ok: false;
3116
+ reason: 'name_collision';
3117
+ message: string;
3118
+ collisions: string[];
3119
+ errors: TranspileError[];
3120
+ dsl: unknown;
3121
+ usage?: TokenUsage;
3122
+ provider?: string;
3123
+ } | {
3124
+ ok: false;
3125
+ reason: 'unresolved_ref';
3126
+ message: string;
3127
+ refs: string[];
3128
+ errors: TranspileError[];
3129
+ dsl: unknown;
3130
+ usage?: TokenUsage;
3131
+ provider?: string;
608
3132
  } | {
609
3133
  ok: false;
610
3134
  reason: 'api_error';
611
3135
  message: string;
612
3136
  status?: number;
3137
+ provider?: string;
3138
+ };
3139
+ interface GenerateFigureDeltaInput {
3140
+ problem: string;
3141
+ currentDsl: DslInputT;
3142
+ }
3143
+ declare function generateFigureDelta(input: GenerateFigureDeltaInput, opts?: GenerateDeltaOptions): Promise<GenerateDeltaResult>;
3144
+
3145
+ interface HandleGenerateFigureDeltaInput {
3146
+ problem: string;
3147
+ currentDsl: DslInputT;
3148
+ }
3149
+ interface HandleGenerateFigureDeltaOptions extends GenerateDeltaOptions {
3150
+ onResult?: (result: GenerateDeltaResult, attempt: number) => void;
3151
+ maxAttempts?: number;
3152
+ }
3153
+ declare function handleGenerateFigureDelta(input: HandleGenerateFigureDeltaInput, opts?: HandleGenerateFigureDeltaOptions): Promise<AiFigureUiResult>;
3154
+
3155
+ declare const FigureRefineEnvelopeZ: z.ZodEffects<z.ZodObject<{
3156
+ decision: z.ZodEnum<["add", "replace", "refuse"]>;
3157
+ figure: z.ZodOptional<z.ZodObject<{
3158
+ version: z.ZodLiteral<1>;
3159
+ points: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<any, z.UnknownKeysParam, z.ZodTypeAny, {
3160
+ [x: string]: any;
3161
+ }, {
3162
+ [x: string]: any;
3163
+ }>, z.ZodObject<any, z.UnknownKeysParam, z.ZodTypeAny, {
3164
+ [x: string]: any;
3165
+ }, {
3166
+ [x: string]: any;
3167
+ }>, ...z.ZodObject<any, z.UnknownKeysParam, z.ZodTypeAny, {
3168
+ [x: string]: any;
3169
+ }, {
3170
+ [x: string]: any;
3171
+ }>[]]>, "many">;
3172
+ shapes: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<any, z.UnknownKeysParam, z.ZodTypeAny, {
3173
+ [x: string]: any;
3174
+ }, {
3175
+ [x: string]: any;
3176
+ }>, z.ZodObject<any, z.UnknownKeysParam, z.ZodTypeAny, {
3177
+ [x: string]: any;
3178
+ }, {
3179
+ [x: string]: any;
3180
+ }>, ...z.ZodObject<any, z.UnknownKeysParam, z.ZodTypeAny, {
3181
+ [x: string]: any;
3182
+ }, {
3183
+ [x: string]: any;
3184
+ }>[]]>, "many">>;
3185
+ }, "strip", z.ZodTypeAny, {
3186
+ points: {
3187
+ [x: string]: any;
3188
+ }[];
3189
+ version: 1;
3190
+ shapes: {
3191
+ [x: string]: any;
3192
+ }[];
3193
+ }, {
3194
+ points: {
3195
+ [x: string]: any;
3196
+ }[];
3197
+ version: 1;
3198
+ shapes?: {
3199
+ [x: string]: any;
3200
+ }[] | undefined;
3201
+ }>>;
3202
+ reason: z.ZodOptional<z.ZodString>;
3203
+ }, "strip", z.ZodTypeAny, {
3204
+ decision: "refuse" | "add" | "replace";
3205
+ reason?: string | undefined;
3206
+ figure?: {
3207
+ points: {
3208
+ [x: string]: any;
3209
+ }[];
3210
+ version: 1;
3211
+ shapes: {
3212
+ [x: string]: any;
3213
+ }[];
3214
+ } | undefined;
3215
+ }, {
3216
+ decision: "refuse" | "add" | "replace";
3217
+ reason?: string | undefined;
3218
+ figure?: {
3219
+ points: {
3220
+ [x: string]: any;
3221
+ }[];
3222
+ version: 1;
3223
+ shapes?: {
3224
+ [x: string]: any;
3225
+ }[] | undefined;
3226
+ } | undefined;
3227
+ }>, {
3228
+ decision: "refuse" | "add" | "replace";
3229
+ reason?: string | undefined;
3230
+ figure?: {
3231
+ points: {
3232
+ [x: string]: any;
3233
+ }[];
3234
+ version: 1;
3235
+ shapes: {
3236
+ [x: string]: any;
3237
+ }[];
3238
+ } | undefined;
3239
+ }, {
3240
+ decision: "refuse" | "add" | "replace";
3241
+ reason?: string | undefined;
3242
+ figure?: {
3243
+ points: {
3244
+ [x: string]: any;
3245
+ }[];
3246
+ version: 1;
3247
+ shapes?: {
3248
+ [x: string]: any;
3249
+ }[] | undefined;
3250
+ } | undefined;
3251
+ }>;
3252
+ type FigureRefineEnvelopeT = z.infer<typeof FigureRefineEnvelopeZ>;
3253
+ declare function refineEnvelopeJsonSchema(): Record<string, unknown>;
3254
+
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;
613
3390
  };
614
- declare function generateFigure(problem: string, opts: GenerateOptions): Promise<GenerateResult>;
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>;
615
3398
 
616
- export { type GenerateOptions, type GenerateResult, type TokenUsage, generateFigure };
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 };