@xom11/whiteboard 0.24.1 → 0.24.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +1 -1
  2. package/dist/ai.d.mts +616 -0
  3. package/dist/ai.d.ts +616 -0
  4. package/dist/ai.js +1036 -0
  5. package/dist/ai.js.map +1 -0
  6. package/dist/ai.mjs +999 -0
  7. package/dist/ai.mjs.map +1 -0
  8. package/dist/catalog.json +4 -4
  9. package/dist/{chunk-4D5CSIJO.mjs → chunk-2WF6KIGF.mjs} +4 -3
  10. package/dist/chunk-2WF6KIGF.mjs.map +1 -0
  11. package/dist/{chunk-WWMQ2VHZ.mjs → chunk-45CGKJ7S.mjs} +4 -4
  12. package/dist/{chunk-WWMQ2VHZ.mjs.map → chunk-45CGKJ7S.mjs.map} +1 -1
  13. package/dist/{chunk-CRAPWQKJ.mjs → chunk-4DS3MKID.mjs} +4 -4
  14. package/dist/{chunk-CRAPWQKJ.mjs.map → chunk-4DS3MKID.mjs.map} +1 -1
  15. package/dist/chunk-73Q7ADVL.mjs +35 -0
  16. package/dist/chunk-73Q7ADVL.mjs.map +1 -0
  17. package/dist/{chunk-YIPI3WUL.mjs → chunk-7WQXXEVR.mjs} +4 -4
  18. package/dist/{chunk-YIPI3WUL.mjs.map → chunk-7WQXXEVR.mjs.map} +1 -1
  19. package/dist/{chunk-CSCF3YFZ.mjs → chunk-BEZSQKPY.mjs} +4 -3
  20. package/dist/chunk-BEZSQKPY.mjs.map +1 -0
  21. package/dist/{chunk-MFOGFFIL.mjs → chunk-CGZZO4BX.mjs} +5 -4
  22. package/dist/chunk-CGZZO4BX.mjs.map +1 -0
  23. package/dist/{chunk-IBTRMWD6.mjs → chunk-KRC2XOIG.mjs} +3 -3
  24. package/dist/{chunk-IBTRMWD6.mjs.map → chunk-KRC2XOIG.mjs.map} +1 -1
  25. package/dist/{chunk-6V4SH4JJ.mjs → chunk-WM2VDYQA.mjs} +4 -34
  26. package/dist/chunk-WM2VDYQA.mjs.map +1 -0
  27. package/dist/geometry-2d.d.mts +2 -1
  28. package/dist/geometry-2d.d.ts +2 -1
  29. package/dist/geometry-2d.mjs +5 -4
  30. package/dist/geometry-3d.d.mts +2 -1
  31. package/dist/geometry-3d.d.ts +2 -1
  32. package/dist/geometry-3d.mjs +4 -3
  33. package/dist/graph-2d.d.mts +2 -1
  34. package/dist/graph-2d.d.ts +2 -1
  35. package/dist/graph-2d.mjs +4 -3
  36. package/dist/{host-DOAYVL35.mjs → host-EPZCNFLH.mjs} +8 -7
  37. package/dist/host-EPZCNFLH.mjs.map +1 -0
  38. package/dist/{host-GKNQBBUE.mjs → host-LKCMYEAV.mjs} +7 -6
  39. package/dist/host-LKCMYEAV.mjs.map +1 -0
  40. package/dist/{host-TLIXN4CF.mjs → host-ZIQ77W33.mjs} +6 -5
  41. package/dist/host-ZIQ77W33.mjs.map +1 -0
  42. package/dist/index.d.mts +4 -616
  43. package/dist/index.d.ts +4 -616
  44. package/dist/index.js +28 -1028
  45. package/dist/index.js.map +1 -1
  46. package/dist/index.mjs +17 -1009
  47. package/dist/index.mjs.map +1 -1
  48. package/dist/latex.d.mts +2 -1
  49. package/dist/latex.d.ts +2 -1
  50. package/dist/serialize-JAVOU22E.mjs +7 -0
  51. package/dist/{serialize-3NZS6A6Q.mjs.map → serialize-JAVOU22E.mjs.map} +1 -1
  52. package/dist/{types-rA4slL08.d.mts → types-Crbefnfe.d.ts} +2 -49
  53. package/dist/types-DxlMPh-6.d.mts +49 -0
  54. package/dist/types-DxlMPh-6.d.ts +49 -0
  55. package/dist/{types-rA4slL08.d.ts → types-vtvyKGAA.d.mts} +2 -49
  56. package/package.json +6 -1
  57. package/dist/chunk-4D5CSIJO.mjs.map +0 -1
  58. package/dist/chunk-6V4SH4JJ.mjs.map +0 -1
  59. package/dist/chunk-CSCF3YFZ.mjs.map +0 -1
  60. package/dist/chunk-MFOGFFIL.mjs.map +0 -1
  61. package/dist/host-DOAYVL35.mjs.map +0 -1
  62. package/dist/host-GKNQBBUE.mjs.map +0 -1
  63. package/dist/host-TLIXN4CF.mjs.map +0 -1
  64. package/dist/serialize-3NZS6A6Q.mjs +0 -6
package/dist/ai.mjs ADDED
@@ -0,0 +1,999 @@
1
+ import { createEmptyState } from './chunk-73Q7ADVL.mjs';
2
+ import { z } from 'zod';
3
+ import Anthropic from '@anthropic-ai/sdk';
4
+ import { zodToJsonSchema } from 'zod-to-json-schema';
5
+
6
+ var NameZ = z.string().regex(/^[A-Za-z][A-Za-z0-9_'₀-₉]{0,11}$/);
7
+ var DslPoint = z.discriminatedUnion("kind", [
8
+ z.object({
9
+ name: NameZ,
10
+ kind: z.literal("free"),
11
+ x: z.number().finite(),
12
+ y: z.number().finite()
13
+ }),
14
+ z.object({
15
+ name: NameZ,
16
+ kind: z.literal("midpoint"),
17
+ p1: NameZ,
18
+ p2: NameZ
19
+ }),
20
+ z.object({
21
+ name: NameZ,
22
+ kind: z.literal("onSegment"),
23
+ segmentId: NameZ,
24
+ t: z.number().min(0).max(1)
25
+ }),
26
+ z.object({
27
+ name: NameZ,
28
+ kind: z.literal("onLine"),
29
+ lineId: NameZ,
30
+ t: z.number().finite()
31
+ }),
32
+ z.object({
33
+ name: NameZ,
34
+ kind: z.literal("onCircle"),
35
+ circleId: NameZ,
36
+ theta: z.number().finite()
37
+ }),
38
+ z.object({
39
+ name: NameZ,
40
+ kind: z.literal("perpFoot"),
41
+ from: NameZ,
42
+ onLine: NameZ
43
+ }),
44
+ z.object({
45
+ name: NameZ,
46
+ kind: z.literal("circumcenter"),
47
+ vertices: z.tuple([NameZ, NameZ, NameZ])
48
+ }),
49
+ z.object({
50
+ name: NameZ,
51
+ kind: z.literal("incenter"),
52
+ vertices: z.tuple([NameZ, NameZ, NameZ])
53
+ }),
54
+ z.object({
55
+ name: NameZ,
56
+ kind: z.literal("centroid"),
57
+ vertices: z.tuple([NameZ, NameZ, NameZ])
58
+ }),
59
+ z.object({
60
+ name: NameZ,
61
+ kind: z.literal("orthocenter"),
62
+ vertices: z.tuple([NameZ, NameZ, NameZ])
63
+ }),
64
+ z.object({
65
+ name: NameZ,
66
+ kind: z.literal("intersection"),
67
+ ref1: NameZ,
68
+ ref2: NameZ,
69
+ branch: z.union([z.literal(0), z.literal(1)]).optional()
70
+ })
71
+ ]);
72
+ var DslShape = z.discriminatedUnion("kind", [
73
+ z.object({
74
+ name: NameZ,
75
+ kind: z.literal("segment"),
76
+ p1: NameZ,
77
+ p2: NameZ
78
+ }),
79
+ z.object({
80
+ name: NameZ,
81
+ kind: z.literal("line"),
82
+ p1: NameZ,
83
+ p2: NameZ
84
+ }),
85
+ z.object({
86
+ name: NameZ,
87
+ kind: z.literal("ray"),
88
+ origin: NameZ,
89
+ through: NameZ
90
+ }),
91
+ z.object({
92
+ name: NameZ,
93
+ kind: z.literal("polygon"),
94
+ vertices: z.array(NameZ).min(3)
95
+ }),
96
+ // Line constructions
97
+ z.object({
98
+ name: NameZ,
99
+ kind: z.literal("perpendicular"),
100
+ throughPoint: NameZ,
101
+ toLine: NameZ
102
+ }),
103
+ z.object({
104
+ name: NameZ,
105
+ kind: z.literal("parallel"),
106
+ throughPoint: NameZ,
107
+ toLine: NameZ
108
+ }),
109
+ z.object({
110
+ name: NameZ,
111
+ kind: z.literal("perpBisector"),
112
+ p1: NameZ,
113
+ p2: NameZ
114
+ }),
115
+ z.object({
116
+ name: NameZ,
117
+ kind: z.literal("angleBisector"),
118
+ p1: NameZ,
119
+ vertex: NameZ,
120
+ p2: NameZ
121
+ }),
122
+ z.object({
123
+ name: NameZ,
124
+ kind: z.literal("tangent"),
125
+ throughPoint: NameZ,
126
+ toCircle: NameZ,
127
+ branch: z.union([z.literal(0), z.literal(1), z.literal("on")]).optional()
128
+ }),
129
+ // Circle constructions
130
+ z.object({
131
+ name: NameZ,
132
+ kind: z.literal("circleCP"),
133
+ center: NameZ,
134
+ surfacePoint: NameZ
135
+ }),
136
+ z.object({
137
+ name: NameZ,
138
+ kind: z.literal("circle3"),
139
+ p1: NameZ,
140
+ p2: NameZ,
141
+ p3: NameZ
142
+ })
143
+ ]);
144
+ var DslInput = z.object({
145
+ version: z.literal(1),
146
+ points: z.array(DslPoint),
147
+ shapes: z.array(DslShape).default([])
148
+ });
149
+
150
+ // src/stamps/geometry-2d/dsl/transpile/errors.ts
151
+ function mkError(code, message, opts) {
152
+ return { code, message, path: opts?.path, hint: opts?.hint };
153
+ }
154
+
155
+ // src/stamps/geometry-2d/dsl/transpile/symbols.ts
156
+ function buildSymbols(dsl) {
157
+ const symbols = /* @__PURE__ */ new Map();
158
+ const errors = [];
159
+ let counter = 0;
160
+ for (const p of dsl.points) {
161
+ if (symbols.has(p.name)) {
162
+ errors.push(mkError("DUPLICATE_NAME", `T\xEAn tr\xF9ng: "${p.name}"`, { path: [p.name] }));
163
+ continue;
164
+ }
165
+ symbols.set(p.name, { name: p.name, role: "point", entity: p, index: counter++ });
166
+ }
167
+ for (const s of dsl.shapes) {
168
+ if (symbols.has(s.name)) {
169
+ errors.push(mkError("DUPLICATE_NAME", `T\xEAn tr\xF9ng: "${s.name}"`, { path: [s.name] }));
170
+ continue;
171
+ }
172
+ symbols.set(s.name, { name: s.name, role: "shape", entity: s, index: counter++ });
173
+ }
174
+ return { symbols, errors };
175
+ }
176
+
177
+ // src/stamps/geometry-2d/dsl/transpile/refs.ts
178
+ function isPointLike(sym) {
179
+ return !!sym && sym.role === "point";
180
+ }
181
+ var LINE_LIKE_SHAPE_KINDS = /* @__PURE__ */ new Set([
182
+ "line",
183
+ "segment",
184
+ "ray",
185
+ "perpendicular",
186
+ "parallel",
187
+ "perpBisector",
188
+ "angleBisector",
189
+ "tangent"
190
+ ]);
191
+ var CIRCLE_KINDS = /* @__PURE__ */ new Set(["circleCP", "circle3"]);
192
+ function isLineLike(sym) {
193
+ if (!sym || sym.role !== "shape") return false;
194
+ return LINE_LIKE_SHAPE_KINDS.has(sym.entity.kind);
195
+ }
196
+ function isCircleLike(sym) {
197
+ if (!sym || sym.role !== "shape") return false;
198
+ return CIRCLE_KINDS.has(sym.entity.kind);
199
+ }
200
+ function isSegmentExact(sym) {
201
+ return !!sym && sym.role === "shape" && sym.entity.kind === "segment";
202
+ }
203
+ function validateRefs(dsl, symbols) {
204
+ const errors = [];
205
+ const check = (owner, field, refName, predicate, expected) => {
206
+ const sym = symbols.get(refName);
207
+ if (!sym) {
208
+ errors.push(mkError(
209
+ "UNKNOWN_REF",
210
+ `${owner}.${field} tham chi\u1EBFu "${refName}" kh\xF4ng t\u1ED3n t\u1EA1i`,
211
+ { path: [owner, field] }
212
+ ));
213
+ return;
214
+ }
215
+ if (!predicate(sym)) {
216
+ errors.push(mkError(
217
+ "KIND_MISMATCH",
218
+ `${owner}.${field}="${refName}" sai ki\u1EC3u (c\u1EA7n ${expected}, g\u1EB7p ${sym.role === "point" ? "point" : sym.entity.kind})`,
219
+ { path: [owner, field] }
220
+ ));
221
+ }
222
+ };
223
+ for (const p of dsl.points) {
224
+ switch (p.kind) {
225
+ case "free":
226
+ break;
227
+ case "midpoint":
228
+ check(p.name, "p1", p.p1, isPointLike, "point");
229
+ check(p.name, "p2", p.p2, isPointLike, "point");
230
+ break;
231
+ case "onSegment":
232
+ check(p.name, "segmentId", p.segmentId, isSegmentExact, "segment");
233
+ break;
234
+ case "onLine":
235
+ check(p.name, "lineId", p.lineId, isLineLike, "line-like");
236
+ break;
237
+ case "onCircle":
238
+ check(p.name, "circleId", p.circleId, isCircleLike, "circle");
239
+ break;
240
+ case "perpFoot":
241
+ check(p.name, "from", p.from, isPointLike, "point");
242
+ check(p.name, "onLine", p.onLine, isLineLike, "line-like");
243
+ break;
244
+ case "circumcenter":
245
+ case "incenter":
246
+ case "centroid":
247
+ case "orthocenter":
248
+ for (let i = 0; i < 3; i++) {
249
+ check(p.name, `vertices[${i}]`, p.vertices[i], isPointLike, "point");
250
+ }
251
+ break;
252
+ case "intersection": {
253
+ const refPredicate = (s) => isLineLike(s) || isCircleLike(s);
254
+ check(p.name, "ref1", p.ref1, refPredicate, "line-like ho\u1EB7c circle");
255
+ check(p.name, "ref2", p.ref2, refPredicate, "line-like ho\u1EB7c circle");
256
+ break;
257
+ }
258
+ }
259
+ }
260
+ for (const s of dsl.shapes) {
261
+ switch (s.kind) {
262
+ case "segment":
263
+ case "line":
264
+ check(s.name, "p1", s.p1, isPointLike, "point");
265
+ check(s.name, "p2", s.p2, isPointLike, "point");
266
+ break;
267
+ case "ray":
268
+ check(s.name, "origin", s.origin, isPointLike, "point");
269
+ check(s.name, "through", s.through, isPointLike, "point");
270
+ break;
271
+ case "polygon":
272
+ s.vertices.forEach((v, i) => check(s.name, `vertices[${i}]`, v, isPointLike, "point"));
273
+ break;
274
+ case "perpendicular":
275
+ case "parallel":
276
+ check(s.name, "throughPoint", s.throughPoint, isPointLike, "point");
277
+ check(s.name, "toLine", s.toLine, isLineLike, "line-like");
278
+ break;
279
+ case "perpBisector":
280
+ check(s.name, "p1", s.p1, isPointLike, "point");
281
+ check(s.name, "p2", s.p2, isPointLike, "point");
282
+ break;
283
+ case "angleBisector":
284
+ check(s.name, "p1", s.p1, isPointLike, "point");
285
+ check(s.name, "vertex", s.vertex, isPointLike, "point");
286
+ check(s.name, "p2", s.p2, isPointLike, "point");
287
+ break;
288
+ case "tangent":
289
+ check(s.name, "throughPoint", s.throughPoint, isPointLike, "point");
290
+ check(s.name, "toCircle", s.toCircle, isCircleLike, "circle");
291
+ break;
292
+ case "circleCP":
293
+ check(s.name, "center", s.center, isPointLike, "point");
294
+ check(s.name, "surfacePoint", s.surfacePoint, isPointLike, "point");
295
+ break;
296
+ case "circle3":
297
+ check(s.name, "p1", s.p1, isPointLike, "point");
298
+ check(s.name, "p2", s.p2, isPointLike, "point");
299
+ check(s.name, "p3", s.p3, isPointLike, "point");
300
+ break;
301
+ }
302
+ }
303
+ return { errors };
304
+ }
305
+ function collectRefs(entity) {
306
+ if ("kind" in entity) {
307
+ switch (entity.kind) {
308
+ case "free":
309
+ return [];
310
+ case "midpoint":
311
+ return [entity.p1, entity.p2];
312
+ case "onSegment":
313
+ return [entity.segmentId];
314
+ case "onLine":
315
+ return [entity.lineId];
316
+ case "onCircle":
317
+ return [entity.circleId];
318
+ case "perpFoot":
319
+ return [entity.from, entity.onLine];
320
+ case "circumcenter":
321
+ case "incenter":
322
+ case "centroid":
323
+ case "orthocenter":
324
+ return [...entity.vertices];
325
+ case "intersection":
326
+ return [entity.ref1, entity.ref2];
327
+ case "segment":
328
+ case "line":
329
+ return [entity.p1, entity.p2];
330
+ case "ray":
331
+ return [entity.origin, entity.through];
332
+ case "polygon":
333
+ return [...entity.vertices];
334
+ case "perpendicular":
335
+ case "parallel":
336
+ return [entity.throughPoint, entity.toLine];
337
+ case "perpBisector":
338
+ return [entity.p1, entity.p2];
339
+ case "angleBisector":
340
+ return [entity.p1, entity.vertex, entity.p2];
341
+ case "tangent":
342
+ return [entity.throughPoint, entity.toCircle];
343
+ case "circleCP":
344
+ return [entity.center, entity.surfacePoint];
345
+ case "circle3":
346
+ return [entity.p1, entity.p2, entity.p3];
347
+ }
348
+ }
349
+ return [];
350
+ }
351
+
352
+ // src/stamps/geometry-2d/dsl/transpile/cycles.ts
353
+ function detectCycles(symbols) {
354
+ const color = /* @__PURE__ */ new Map();
355
+ const parent = /* @__PURE__ */ new Map();
356
+ const errors = [];
357
+ const reportedCycles = /* @__PURE__ */ new Set();
358
+ for (const name of symbols.keys()) color.set(name, "white");
359
+ function reportCycle(start, hit) {
360
+ const chain = [start];
361
+ let cur = parent.get(start);
362
+ while (cur && cur !== hit && chain.length < symbols.size + 2) {
363
+ chain.push(cur);
364
+ cur = parent.get(cur);
365
+ }
366
+ chain.push(hit);
367
+ const minIdx = chain.indexOf(chain.reduce((a, b) => a < b ? a : b));
368
+ const rotated = [...chain.slice(minIdx), ...chain.slice(0, minIdx)];
369
+ const key = rotated.join("\u2192");
370
+ if (reportedCycles.has(key)) return;
371
+ reportedCycles.add(key);
372
+ errors.push(mkError(
373
+ "CYCLE",
374
+ `Ph\u1EE5 thu\u1ED9c v\xF2ng: ${chain.reverse().join(" \u2192 ")}`,
375
+ { path: [...chain], hint: "Ki\u1EC3m tra l\u1EA1i quan h\u1EC7 midpoint/perpFoot/intersection." }
376
+ ));
377
+ }
378
+ function dfs(name) {
379
+ color.set(name, "gray");
380
+ const sym = symbols.get(name);
381
+ if (sym) {
382
+ for (const ref of collectRefs(sym.entity)) {
383
+ if (!symbols.has(ref)) continue;
384
+ const c = color.get(ref);
385
+ if (c === "gray") {
386
+ reportCycle(name, ref);
387
+ continue;
388
+ }
389
+ if (c === "white") {
390
+ parent.set(ref, name);
391
+ dfs(ref);
392
+ }
393
+ }
394
+ }
395
+ color.set(name, "black");
396
+ }
397
+ for (const name of symbols.keys()) {
398
+ if (color.get(name) === "white") {
399
+ parent.set(name, null);
400
+ dfs(name);
401
+ }
402
+ }
403
+ return { errors };
404
+ }
405
+
406
+ // src/stamps/geometry-2d/dsl/transpile/ids.ts
407
+ function prefixFor(sym) {
408
+ if (sym.role === "point") {
409
+ const p = sym.entity;
410
+ return p.kind === "intersection" ? "i" : "p";
411
+ }
412
+ const s = sym.entity;
413
+ switch (s.kind) {
414
+ case "segment":
415
+ return "s";
416
+ case "ray":
417
+ return "r";
418
+ case "polygon":
419
+ return "poly";
420
+ case "circleCP":
421
+ case "circle3":
422
+ return "c";
423
+ // line + 5 line-constructions all share 'l'
424
+ case "line":
425
+ case "perpendicular":
426
+ case "parallel":
427
+ case "perpBisector":
428
+ case "angleBisector":
429
+ case "tangent":
430
+ return "l";
431
+ }
432
+ }
433
+ function assignIds(symbols) {
434
+ const counters = { p: 0, i: 0, s: 0, l: 0, r: 0, poly: 0, c: 0 };
435
+ const ids = /* @__PURE__ */ new Map();
436
+ for (const [name, sym] of symbols.entries()) {
437
+ const prefix = prefixFor(sym);
438
+ counters[prefix] += 1;
439
+ ids.set(name, `${prefix}${counters[prefix]}`);
440
+ }
441
+ return ids;
442
+ }
443
+
444
+ // src/stamps/geometry-2d/dsl/transpile/emitPoint.ts
445
+ function resolveId(ids, name) {
446
+ const id = ids.get(name);
447
+ if (!id) throw new Error(`emitPoint: id not assigned for "${name}"`);
448
+ return id;
449
+ }
450
+ function emitPoint(p, ids, kindHints) {
451
+ const baseId = resolveId(ids, p.name);
452
+ const baseFields = {
453
+ label: p.name,
454
+ visible: true,
455
+ locked: false,
456
+ layer: "default",
457
+ schemaVersion: 1
458
+ };
459
+ if (p.kind === "intersection") {
460
+ const r1Hint = kindHints.get(p.ref1);
461
+ const r2Hint = kindHints.get(p.ref2);
462
+ const r1IsCircle = r1Hint === "circle";
463
+ const r2IsCircle = r2Hint === "circle";
464
+ let intersectKind;
465
+ if (r1IsCircle && r2IsCircle) intersectKind = "circleCircle";
466
+ else if (r1IsCircle || r2IsCircle) intersectKind = "lineCircle";
467
+ else intersectKind = "lineLine";
468
+ const attrs = {
469
+ kind: intersectKind,
470
+ ref1: resolveId(ids, p.ref1),
471
+ ref2: resolveId(ids, p.ref2)
472
+ };
473
+ if (intersectKind !== "lineLine") {
474
+ attrs.branch = p.branch ?? 0;
475
+ }
476
+ return {
477
+ id: baseId,
478
+ kind: "intersection",
479
+ ...baseFields,
480
+ attrs
481
+ };
482
+ }
483
+ let constraint;
484
+ switch (p.kind) {
485
+ case "free":
486
+ constraint = { kind: "free", x: p.x, y: p.y };
487
+ break;
488
+ case "midpoint":
489
+ constraint = { kind: "midpoint", p1: resolveId(ids, p.p1), p2: resolveId(ids, p.p2) };
490
+ break;
491
+ case "onSegment":
492
+ constraint = { kind: "onSegment", segmentId: resolveId(ids, p.segmentId), t: p.t };
493
+ break;
494
+ case "onLine":
495
+ constraint = { kind: "onLine", lineId: resolveId(ids, p.lineId), t: p.t };
496
+ break;
497
+ case "onCircle":
498
+ constraint = { kind: "onCircle", circleId: resolveId(ids, p.circleId), theta: p.theta };
499
+ break;
500
+ case "perpFoot":
501
+ constraint = { kind: "perpFoot", from: resolveId(ids, p.from), onLine: resolveId(ids, p.onLine) };
502
+ break;
503
+ case "circumcenter":
504
+ case "incenter":
505
+ case "centroid":
506
+ case "orthocenter":
507
+ constraint = {
508
+ kind: p.kind,
509
+ vertices: [resolveId(ids, p.vertices[0]), resolveId(ids, p.vertices[1]), resolveId(ids, p.vertices[2])]
510
+ };
511
+ break;
512
+ }
513
+ return {
514
+ id: baseId,
515
+ kind: "point",
516
+ ...baseFields,
517
+ attrs: { constraint }
518
+ };
519
+ }
520
+
521
+ // src/stamps/geometry-2d/dsl/transpile/emitShape.ts
522
+ function r(ids, name) {
523
+ const id = ids.get(name);
524
+ if (!id) throw new Error(`emitShape: id not assigned for "${name}"`);
525
+ return id;
526
+ }
527
+ function emitShape(s, ids) {
528
+ const id = r(ids, s.name);
529
+ const base = {
530
+ label: s.name,
531
+ visible: true,
532
+ locked: false,
533
+ layer: "default",
534
+ schemaVersion: 1
535
+ };
536
+ switch (s.kind) {
537
+ case "segment":
538
+ return { id, kind: "segment", ...base, attrs: { p1: r(ids, s.p1), p2: r(ids, s.p2) } };
539
+ case "line":
540
+ return { id, kind: "line", ...base, attrs: { p1: r(ids, s.p1), p2: r(ids, s.p2) } };
541
+ case "ray":
542
+ return { id, kind: "ray", ...base, attrs: { origin: r(ids, s.origin), through: r(ids, s.through) } };
543
+ case "polygon":
544
+ return { id, kind: "polygon", ...base, attrs: { vertices: s.vertices.map((v) => r(ids, v)) } };
545
+ case "perpendicular":
546
+ case "parallel":
547
+ return {
548
+ id,
549
+ kind: "line",
550
+ ...base,
551
+ attrs: { construction: { kind: s.kind, throughPoint: r(ids, s.throughPoint), toLine: r(ids, s.toLine) } }
552
+ };
553
+ case "perpBisector":
554
+ return {
555
+ id,
556
+ kind: "line",
557
+ ...base,
558
+ attrs: { construction: { kind: "perpBisector", p1: r(ids, s.p1), p2: r(ids, s.p2) } }
559
+ };
560
+ case "angleBisector":
561
+ return {
562
+ id,
563
+ kind: "line",
564
+ ...base,
565
+ attrs: { construction: { kind: "angleBisector", p1: r(ids, s.p1), vertex: r(ids, s.vertex), p2: r(ids, s.p2) } }
566
+ };
567
+ case "tangent": {
568
+ const construction = {
569
+ kind: "tangent",
570
+ throughPoint: r(ids, s.throughPoint),
571
+ toCircle: r(ids, s.toCircle)
572
+ };
573
+ if (s.branch !== void 0) construction.branch = s.branch;
574
+ return { id, kind: "line", ...base, attrs: { construction } };
575
+ }
576
+ case "circleCP":
577
+ return {
578
+ id,
579
+ kind: "circle",
580
+ ...base,
581
+ attrs: { center: r(ids, s.center), surfacePoint: r(ids, s.surfacePoint) }
582
+ };
583
+ case "circle3":
584
+ return {
585
+ id,
586
+ kind: "circle",
587
+ ...base,
588
+ attrs: { construction: { kind: "circumscribed", p1: r(ids, s.p1), p2: r(ids, s.p2), p3: r(ids, s.p3) } }
589
+ };
590
+ }
591
+ }
592
+
593
+ // src/stamps/geometry-2d/dsl/transpile.ts
594
+ function hintOf(entity) {
595
+ if ("kind" in entity) {
596
+ switch (entity.kind) {
597
+ case "free":
598
+ case "midpoint":
599
+ case "onSegment":
600
+ case "onLine":
601
+ case "onCircle":
602
+ case "perpFoot":
603
+ case "circumcenter":
604
+ case "incenter":
605
+ case "centroid":
606
+ case "orthocenter":
607
+ case "intersection":
608
+ return "point";
609
+ case "segment":
610
+ return "segment";
611
+ case "line":
612
+ return "line";
613
+ case "ray":
614
+ return "ray";
615
+ case "polygon":
616
+ return "point";
617
+ // not used as ref target in MVP
618
+ case "perpendicular":
619
+ case "parallel":
620
+ case "perpBisector":
621
+ case "angleBisector":
622
+ case "tangent":
623
+ return "lineConstruction";
624
+ case "circleCP":
625
+ case "circle3":
626
+ return "circle";
627
+ }
628
+ }
629
+ return "point";
630
+ }
631
+ function transpile(dslRaw) {
632
+ const parsed = DslInput.safeParse(dslRaw);
633
+ if (!parsed.success) {
634
+ const errors = parsed.error.issues.map(
635
+ (iss) => mkError("SCHEMA", iss.message, { path: iss.path.map(String) })
636
+ );
637
+ return { ok: false, errors };
638
+ }
639
+ const dsl = parsed.data;
640
+ const { symbols, errors: dupErrors } = buildSymbols(dsl);
641
+ const { errors: refErrors } = validateRefs(dsl, symbols);
642
+ const { errors: cycleErrors } = detectCycles(symbols);
643
+ const allErrors = [...dupErrors, ...refErrors, ...cycleErrors];
644
+ if (allErrors.length > 0) return { ok: false, errors: allErrors };
645
+ const ids = assignIds(symbols);
646
+ const kindHints = /* @__PURE__ */ new Map();
647
+ for (const [name, sym] of symbols.entries()) {
648
+ kindHints.set(name, hintOf(sym.entity));
649
+ }
650
+ const objects = {};
651
+ const order = [];
652
+ for (const p of dsl.points) {
653
+ const obj = emitPoint(p, ids, kindHints);
654
+ objects[obj.id] = obj;
655
+ order.push(obj.id);
656
+ }
657
+ for (const s of dsl.shapes) {
658
+ const obj = emitShape(s, ids);
659
+ objects[obj.id] = obj;
660
+ order.push(obj.id);
661
+ }
662
+ const empty = createEmptyState("2d");
663
+ const state = {
664
+ objects,
665
+ order,
666
+ counter: order.length,
667
+ meta: empty.meta
668
+ };
669
+ return { ok: true, state };
670
+ }
671
+ async function callProvider(args) {
672
+ const client = new Anthropic({ apiKey: args.apiKey });
673
+ const resp = await client.messages.create(
674
+ {
675
+ model: args.model,
676
+ max_tokens: args.maxTokens,
677
+ system: args.system,
678
+ tools: args.tools,
679
+ tool_choice: args.toolChoice,
680
+ messages: args.messages
681
+ },
682
+ args.signal ? { signal: args.signal } : void 0
683
+ );
684
+ return resp;
685
+ }
686
+
687
+ // src/stamps/geometry-2d/dsl/fixtures/triangle-equilateral.ts
688
+ var fixture = {
689
+ problem: "Cho tam gi\xE1c \u0111\u1EC1u ABC c\u1EA1nh 4.",
690
+ dsl: {
691
+ version: 1,
692
+ points: [
693
+ { name: "A", kind: "free", x: 0, y: 0 },
694
+ { name: "B", kind: "free", x: 4, y: 0 },
695
+ { name: "C", kind: "free", x: 2, y: 3.464 }
696
+ ],
697
+ shapes: [
698
+ { name: "ABC", kind: "polygon", vertices: ["A", "B", "C"] }
699
+ ]
700
+ }
701
+ };
702
+
703
+ // src/stamps/geometry-2d/dsl/fixtures/triangle-median.ts
704
+ var fixture2 = {
705
+ problem: "Tam gi\xE1c ABC, M l\xE0 trung \u0111i\u1EC3m BC. V\u1EBD AM.",
706
+ dsl: {
707
+ version: 1,
708
+ points: [
709
+ { name: "A", kind: "free", x: 0, y: 3 },
710
+ { name: "B", kind: "free", x: -2, y: 0 },
711
+ { name: "C", kind: "free", x: 3, y: 0 },
712
+ { name: "M", kind: "midpoint", p1: "B", p2: "C" }
713
+ ],
714
+ shapes: [
715
+ { name: "ABC", kind: "polygon", vertices: ["A", "B", "C"] },
716
+ { name: "AM", kind: "segment", p1: "A", p2: "M" }
717
+ ]
718
+ }
719
+ };
720
+
721
+ // src/stamps/geometry-2d/dsl/fixtures/triangle-altitude.ts
722
+ var fixture3 = {
723
+ problem: "Tam gi\xE1c ABC, AH l\xE0 \u0111\u01B0\u1EDDng cao xu\u1ED1ng BC.",
724
+ dsl: {
725
+ version: 1,
726
+ points: [
727
+ { name: "A", kind: "free", x: 1, y: 3 },
728
+ { name: "B", kind: "free", x: -2, y: 0 },
729
+ { name: "C", kind: "free", x: 3, y: 0 },
730
+ { name: "H", kind: "perpFoot", from: "A", onLine: "BC" }
731
+ ],
732
+ shapes: [
733
+ { name: "ABC", kind: "polygon", vertices: ["A", "B", "C"] },
734
+ { name: "BC", kind: "segment", p1: "B", p2: "C" },
735
+ { name: "AH", kind: "segment", p1: "A", p2: "H" }
736
+ ]
737
+ }
738
+ };
739
+
740
+ // src/stamps/geometry-2d/dsl/fixtures/triangle-centroid.ts
741
+ var fixture4 = {
742
+ problem: "Tam gi\xE1c ABC, G l\xE0 tr\u1ECDng t\xE2m.",
743
+ dsl: {
744
+ version: 1,
745
+ points: [
746
+ { name: "A", kind: "free", x: 0, y: 3 },
747
+ { name: "B", kind: "free", x: -2, y: 0 },
748
+ { name: "C", kind: "free", x: 3, y: 0 },
749
+ { name: "G", kind: "centroid", vertices: ["A", "B", "C"] }
750
+ ],
751
+ shapes: [
752
+ { name: "ABC", kind: "polygon", vertices: ["A", "B", "C"] }
753
+ ]
754
+ }
755
+ };
756
+
757
+ // src/stamps/geometry-2d/dsl/fixtures/triangle-orthocenter.ts
758
+ var fixture5 = {
759
+ problem: "Tam gi\xE1c ABC, H l\xE0 tr\u1EF1c t\xE2m.",
760
+ dsl: {
761
+ version: 1,
762
+ points: [
763
+ { name: "A", kind: "free", x: 0, y: 3 },
764
+ { name: "B", kind: "free", x: -2, y: 0 },
765
+ { name: "C", kind: "free", x: 3, y: 0 },
766
+ { name: "H", kind: "orthocenter", vertices: ["A", "B", "C"] }
767
+ ],
768
+ shapes: [
769
+ { name: "ABC", kind: "polygon", vertices: ["A", "B", "C"] }
770
+ ]
771
+ }
772
+ };
773
+
774
+ // src/stamps/geometry-2d/dsl/fixtures/triangle-circumcircle.ts
775
+ var fixture6 = {
776
+ problem: "Tam gi\xE1c ABC n\u1ED9i ti\u1EBFp \u0111\u01B0\u1EDDng tr\xF2n t\xE2m O.",
777
+ dsl: {
778
+ version: 1,
779
+ points: [
780
+ { name: "A", kind: "free", x: 0, y: 3 },
781
+ { name: "B", kind: "free", x: -2, y: 0 },
782
+ { name: "C", kind: "free", x: 3, y: 0 },
783
+ { name: "O", kind: "circumcenter", vertices: ["A", "B", "C"] }
784
+ ],
785
+ shapes: [
786
+ { name: "ABC", kind: "polygon", vertices: ["A", "B", "C"] },
787
+ { name: "k", kind: "circle3", p1: "A", p2: "B", p3: "C" }
788
+ ]
789
+ }
790
+ };
791
+
792
+ // src/stamps/geometry-2d/dsl/fixtures/triangle-incircle.ts
793
+ var fixture7 = {
794
+ problem: "Tam gi\xE1c ABC, I l\xE0 t\xE2m n\u1ED9i ti\u1EBFp, \u0111\u01B0\u1EDDng tr\xF2n (I) ti\u1EBFp x\xFAc BC t\u1EA1i D.",
795
+ dsl: {
796
+ version: 1,
797
+ points: [
798
+ { name: "A", kind: "free", x: 0, y: 3 },
799
+ { name: "B", kind: "free", x: -2, y: 0 },
800
+ { name: "C", kind: "free", x: 3, y: 0 },
801
+ { name: "I", kind: "incenter", vertices: ["A", "B", "C"] },
802
+ { name: "D", kind: "perpFoot", from: "I", onLine: "BC" }
803
+ ],
804
+ shapes: [
805
+ { name: "ABC", kind: "polygon", vertices: ["A", "B", "C"] },
806
+ { name: "BC", kind: "segment", p1: "B", p2: "C" },
807
+ { name: "incircle", kind: "circleCP", center: "I", surfacePoint: "D" }
808
+ ]
809
+ }
810
+ };
811
+
812
+ // src/stamps/geometry-2d/dsl/fixtures/parallelogram.ts
813
+ var fixture8 = {
814
+ problem: "H\xECnh b\xECnh h\xE0nh ABCD, hai \u0111\u01B0\u1EDDng ch\xE9o AC, BD c\u1EAFt nhau t\u1EA1i O.",
815
+ dsl: {
816
+ version: 1,
817
+ points: [
818
+ { name: "A", kind: "free", x: 0, y: 0 },
819
+ { name: "B", kind: "free", x: 4, y: 0 },
820
+ { name: "C", kind: "free", x: 5, y: 2 },
821
+ { name: "D", kind: "free", x: 1, y: 2 },
822
+ { name: "O", kind: "intersection", ref1: "AC", ref2: "BD" }
823
+ ],
824
+ shapes: [
825
+ { name: "ABCD", kind: "polygon", vertices: ["A", "B", "C", "D"] },
826
+ { name: "AC", kind: "segment", p1: "A", p2: "C" },
827
+ { name: "BD", kind: "segment", p1: "B", p2: "D" }
828
+ ]
829
+ }
830
+ };
831
+
832
+ // src/stamps/geometry-2d/dsl/fixtures/two-circles-intersect.ts
833
+ var fixture9 = {
834
+ problem: "Hai \u0111\u01B0\u1EDDng tr\xF2n (O\u2081), (O\u2082) c\u1EAFt nhau t\u1EA1i P, Q.",
835
+ dsl: {
836
+ version: 1,
837
+ points: [
838
+ { name: "O1", kind: "free", x: 0, y: 0 },
839
+ { name: "A1", kind: "free", x: 2, y: 0 },
840
+ { name: "O2", kind: "free", x: 3, y: 0 },
841
+ { name: "A2", kind: "free", x: 5, y: 0 },
842
+ { name: "P", kind: "intersection", ref1: "k1", ref2: "k2", branch: 0 },
843
+ { name: "Q", kind: "intersection", ref1: "k1", ref2: "k2", branch: 1 }
844
+ ],
845
+ shapes: [
846
+ { name: "k1", kind: "circleCP", center: "O1", surfacePoint: "A1" },
847
+ { name: "k2", kind: "circleCP", center: "O2", surfacePoint: "A2" }
848
+ ]
849
+ }
850
+ };
851
+
852
+ // src/stamps/geometry-2d/ai/prompt.ts
853
+ var FIXTURES = [fixture, fixture2, fixture3, fixture4, fixture5, fixture6, fixture7, fixture8, fixture9];
854
+ function buildSystemPrompt() {
855
+ const examples = FIXTURES.map(
856
+ (f, i) => `### V\xED d\u1EE5 ${i + 1}
857
+ **\u0110\u1EC1:** ${f.problem}
858
+ **DSL:**
859
+ \`\`\`json
860
+ ${JSON.stringify(f.dsl, null, 2)}
861
+ \`\`\``
862
+ ).join("\n\n");
863
+ return `B\u1EA1n l\xE0 tr\u1EE3 l\xFD v\u1EBD h\xECnh h\u1ECDc 2D cho h\u1ECDc sinh THCS v\xE0 l\u1EDBp 10 Vi\u1EC7t Nam.
864
+
865
+ ## Nhi\u1EC7m v\u1EE5
866
+ \u0110\u1ECDc \u0111\u1EC1 b\xE0i ti\u1EBFng Vi\u1EC7t \u2192 emit DSL JSON m\xF4 t\u1EA3 h\xECnh. H\u1EC7 th\u1ED1ng s\u1EBD render h\xECnh t\u1EEB DSL.
867
+
868
+ ## Quy t\u1EAFc
869
+ 1. D\xF9ng tool \`build_figure\` khi v\u1EBD \u0111\u01B0\u1EE3c. D\xF9ng tool \`refuse\` khi kh\xF4ng v\u1EBD \u0111\u01B0\u1EE3c ho\u1EB7c \u0111\u1EC1 ngo\xE0i ph\u1EA1m vi (3D, l\u01B0\u1EE3ng gi\xE1c, ph\xE9p bi\u1EBFn h\xECnh l\u1EDBp 11+, \u0111\u1EA1i s\u1ED1).
870
+ 2. \u01AFu ti\xEAn derived points (midpoint, perpFoot, circumcenter, ...) thay v\xEC t\u1EF1 compute to\u1EA1 \u0111\u1ED9.
871
+ 3. Anchor (free) ch\u1EC9 d\xF9ng cho \u0111i\u1EC3m g\u1ED1c (th\u01B0\u1EDDng A, B, C c\u1EE7a tam gi\xE1c). \u0110\u1EB7t coord h\u1EE3p l\xFD quanh g\u1ED1c (-5..5).
872
+ 4. M\u1ECDi \u0111i\u1EC3m + h\xECnh ph\u1EA3i c\xF3 \`name\` (label "A", "M", "O\u2081", ...). Tham chi\u1EBFu b\u1EB1ng name, kh\xF4ng ph\u1EA3i id.
873
+ 5. Tam gi\xE1c: emit c\u1EA3 \`polygon\` (v\u1EBD vi\u1EC1n) + segment/\u0111\u01B0\u1EDDng ph\u1EE5 ri\xEAng n\u1EBFu \u0111\u1EC1 y\xEAu c\u1EA7u (\u0111\u01B0\u1EDDng cao, trung tuy\u1EBFn).
874
+ 6. \u0110\u01B0\u1EDDng tr\xF2n (O; R) cho tr\u01B0\u1EDBc b\xE1n k\xEDnh s\u1ED1: emit anchor helper tr\xEAn \u0111\u01B0\u1EDDng tr\xF2n r\u1ED3i d\xF9ng \`circleCP\` (DSL kh\xF4ng h\u1ED7 tr\u1EE3 radius numeric tr\u1EF1c ti\u1EBFp).
875
+ 7. N\u1EBFu \u0111\u1EC1 m\u01A1 h\u1ED3: ch\u1ECDn case ph\u1ED5 bi\u1EBFn nh\u1EA5t, kh\xF4ng h\u1ECFi l\u1EA1i.
876
+
877
+ ## Primitives s\u1EB5n c\xF3
878
+ **Points:** free, midpoint, onSegment, onLine, onCircle, perpFoot, circumcenter, incenter, centroid, orthocenter, intersection
879
+ **Shapes:** segment, line, ray, polygon, perpendicular, parallel, perpBisector, angleBisector, tangent, circleCP, circle3
880
+
881
+ ## 9 v\xED d\u1EE5
882
+ ${examples}
883
+
884
+ ## Khi kh\xF4ng v\u1EBD \u0111\u01B0\u1EE3c
885
+ G\u1ECDi \`refuse\` v\u1EDBi \`reason\` ti\u1EBFng Vi\u1EC7t gi\u1EA3i th\xEDch c\u1EE5 th\u1EC3 (vd: "\u0110\u1EC1 thu\u1ED9c l\u1EDBp 11, ngo\xE0i ph\u1EA1m vi MVP" ho\u1EB7c "\u0110\u1EC1 kh\xF4ng r\xF5 v\u1ECB tr\xED \u0111i\u1EC3m M").`;
886
+ }
887
+ var BUILD_FIGURE_TOOL = {
888
+ name: "build_figure",
889
+ description: "V\u1EBD h\xECnh h\u1ECDc 2D theo \u0111\u1EC1 b\xE0i. Emit DSL JSON m\xF4 t\u1EA3 c\xE1c \u0111i\u1EC3m v\xE0 h\xECnh.",
890
+ input_schema: zodToJsonSchema(DslInput, {
891
+ target: "jsonSchema7",
892
+ $refStrategy: "none"
893
+ })
894
+ };
895
+ var RefuseInputZ = z.object({
896
+ reason: z.string().min(1).describe("L\xFD do kh\xF4ng v\u1EBD \u0111\u01B0\u1EE3c (ti\u1EBFng Vi\u1EC7t)")
897
+ });
898
+ var REFUSE_TOOL = {
899
+ name: "refuse",
900
+ description: "T\u1EEB ch\u1ED1i khi kh\xF4ng v\u1EBD \u0111\u01B0\u1EE3c ho\u1EB7c \u0111\u1EC1 ngo\xE0i ph\u1EA1m vi (3D, l\u01B0\u1EE3ng gi\xE1c, l\u1EDBp 11+).",
901
+ input_schema: zodToJsonSchema(RefuseInputZ, { target: "jsonSchema7" })
902
+ };
903
+ var TOOLS = [BUILD_FIGURE_TOOL, REFUSE_TOOL];
904
+
905
+ // src/stamps/geometry-2d/ai/buildFigure.ts
906
+ var DEFAULT_MODEL = "claude-opus-4-7";
907
+ var DEFAULT_MAX_TOKENS = 8192;
908
+ function toUsage(u) {
909
+ return {
910
+ inputTokens: u.input_tokens,
911
+ outputTokens: u.output_tokens,
912
+ cacheReadTokens: u.cache_read_input_tokens ?? 0,
913
+ cacheCreationTokens: u.cache_creation_input_tokens ?? 0
914
+ };
915
+ }
916
+ async function generateFigure(problem, opts) {
917
+ if (!opts.apiKey) {
918
+ return { ok: false, reason: "api_error", message: "apiKey b\u1EAFt bu\u1ED9c" };
919
+ }
920
+ if (!problem || !problem.trim()) {
921
+ return { ok: false, reason: "api_error", message: "\u0110\u1EC1 b\xE0i r\u1ED7ng" };
922
+ }
923
+ const systemText = buildSystemPrompt();
924
+ const enableCaching = opts.enableCaching !== false;
925
+ const systemBlock = enableCaching ? { type: "text", text: systemText, cache_control: { type: "ephemeral" } } : { type: "text", text: systemText };
926
+ let response;
927
+ try {
928
+ response = await callProvider({
929
+ apiKey: opts.apiKey,
930
+ model: opts.model ?? DEFAULT_MODEL,
931
+ maxTokens: opts.maxTokens ?? DEFAULT_MAX_TOKENS,
932
+ system: [systemBlock],
933
+ tools: TOOLS,
934
+ toolChoice: { type: "any" },
935
+ messages: [{ role: "user", content: problem }],
936
+ signal: opts.signal
937
+ });
938
+ } catch (e) {
939
+ const err = e;
940
+ return {
941
+ ok: false,
942
+ reason: "api_error",
943
+ message: err.message ?? "L\u1ED7i g\u1ECDi Claude API",
944
+ ...err.status !== void 0 ? { status: err.status } : {}
945
+ };
946
+ }
947
+ const usage = toUsage(response.usage);
948
+ const toolUse = response.content.find((c) => c.type === "tool_use");
949
+ if (!toolUse || toolUse.type !== "tool_use") {
950
+ const text = response.content.find((c) => c.type === "text");
951
+ const textStr = text?.type === "text" ? text.text : "(empty)";
952
+ return {
953
+ ok: false,
954
+ reason: "parse_error",
955
+ message: "AI kh\xF4ng g\u1ECDi tool n\xE0o. Response: " + textStr,
956
+ raw: response.content,
957
+ usage
958
+ };
959
+ }
960
+ if (toolUse.name === "refuse") {
961
+ const input = toolUse.input;
962
+ return {
963
+ ok: false,
964
+ reason: "refused",
965
+ message: input.reason ?? "AI t\u1EEB ch\u1ED1i kh\xF4ng n\xEAu l\xFD do",
966
+ usage
967
+ };
968
+ }
969
+ if (toolUse.name !== "build_figure") {
970
+ return {
971
+ ok: false,
972
+ reason: "parse_error",
973
+ message: `Tool kh\xF4ng x\xE1c \u0111\u1ECBnh: "${toolUse.name}"`,
974
+ raw: toolUse,
975
+ usage
976
+ };
977
+ }
978
+ const tResult = transpile(toolUse.input);
979
+ if (!tResult.ok) {
980
+ return {
981
+ ok: false,
982
+ reason: "transpile_error",
983
+ message: "DSL t\u1EEB AI kh\xF4ng h\u1EE3p l\u1EC7",
984
+ errors: tResult.errors,
985
+ dsl: toolUse.input,
986
+ usage
987
+ };
988
+ }
989
+ return {
990
+ ok: true,
991
+ state: tResult.state,
992
+ dsl: toolUse.input,
993
+ usage
994
+ };
995
+ }
996
+
997
+ export { generateFigure };
998
+ //# sourceMappingURL=ai.mjs.map
999
+ //# sourceMappingURL=ai.mjs.map