@xom11/whiteboard 0.28.0 → 0.29.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 (39) hide show
  1. package/dist/ai.d.mts +236 -295
  2. package/dist/ai.d.ts +236 -295
  3. package/dist/ai.js +6019 -7612
  4. package/dist/ai.js.map +1 -1
  5. package/dist/ai.mjs +4804 -5457
  6. package/dist/ai.mjs.map +1 -1
  7. package/dist/catalog.json +2 -2
  8. package/dist/{chunk-AJAHD35N.mjs → chunk-E6EDOPGT.mjs} +3 -105
  9. package/dist/chunk-E6EDOPGT.mjs.map +1 -0
  10. package/dist/{chunk-QCZVFEN4.mjs → chunk-GEC2D2EQ.mjs} +3 -3
  11. package/dist/{chunk-QCZVFEN4.mjs.map → chunk-GEC2D2EQ.mjs.map} +1 -1
  12. package/dist/geometry-2d.d.mts +1 -2
  13. package/dist/geometry-2d.d.ts +1 -2
  14. package/dist/geometry-2d.js +888 -3623
  15. package/dist/geometry-2d.js.map +1 -1
  16. package/dist/geometry-2d.mjs +1 -1
  17. package/dist/geometry-3d.d.mts +1 -2
  18. package/dist/geometry-3d.d.ts +1 -2
  19. package/dist/graph-2d.d.mts +1 -2
  20. package/dist/graph-2d.d.ts +1 -2
  21. package/dist/{host-4P766V4J.mjs → host-HKMZSCIT.mjs} +54 -313
  22. package/dist/host-HKMZSCIT.mjs.map +1 -0
  23. package/dist/index.d.mts +2 -4
  24. package/dist/index.d.ts +2 -4
  25. package/dist/index.js +880 -3619
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +3 -4
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/latex.d.mts +1 -2
  30. package/dist/latex.d.ts +1 -2
  31. package/dist/{types-BHYC2Fiw.d.mts → types-C3FjpoUi.d.mts} +1 -232
  32. package/dist/{types-BHYC2Fiw.d.ts → types-C3FjpoUi.d.ts} +1 -232
  33. package/package.json +1 -9
  34. package/dist/chunk-AJAHD35N.mjs.map +0 -1
  35. package/dist/chunk-T3SOHYB2.mjs +0 -851
  36. package/dist/chunk-T3SOHYB2.mjs.map +0 -1
  37. package/dist/handleExtractProblem-C-U5KluK.d.mts +0 -158
  38. package/dist/handleExtractProblem-C-U5KluK.d.ts +0 -158
  39. package/dist/host-4P766V4J.mjs.map +0 -1
package/dist/ai.d.ts CHANGED
@@ -1,10 +1,233 @@
1
- import { c as State, D as DslInputT, b as AiFigureUiResult } from './types-BHYC2Fiw.js';
1
+ import { c as State, b as AiFigureUiResult } from './types-C3FjpoUi.js';
2
2
  import { z } from 'zod';
3
- import { A as AIProvider, P as ProviderRequest, a as ProviderOutput, V as VisionRequest, S as SelectProviderOptions, I as ImagePart } from './handleExtractProblem-C-U5KluK.js';
4
- export { b as ExtractProblemFailure, c as ExtractProblemOptions, d as ExtractProblemOutcome, e as ExtractProblemSuccess, E as ExtractUiResult, H as HandleExtractProblemOptions, f as ProviderTokenUsage, g as extractProblemFromImage, h as handleExtractProblem, p as pickVisionModel, s as selectProvider } from './handleExtractProblem-C-U5KluK.js';
5
3
  import 'react';
6
4
  import '@excalidraw/excalidraw/element/types';
7
5
 
6
+ declare const NameZ: z.ZodString;
7
+
8
+ type Name = z.infer<typeof NameZ>;
9
+ type DslDistanceSpec = {
10
+ kind: 'circleRadius';
11
+ circle: Name;
12
+ scale?: number;
13
+ offset?: number;
14
+ } | {
15
+ kind: 'segmentLength';
16
+ p1: Name;
17
+ p2: Name;
18
+ scale?: number;
19
+ offset?: number;
20
+ } | {
21
+ kind: 'literal';
22
+ value: number;
23
+ scale?: number;
24
+ offset?: number;
25
+ };
26
+ type DslPointT = {
27
+ name: Name;
28
+ kind: 'free';
29
+ x: number;
30
+ y: number;
31
+ } | {
32
+ name: Name;
33
+ kind: 'midpoint';
34
+ p1: Name;
35
+ p2: Name;
36
+ visible?: boolean;
37
+ } | {
38
+ name: Name;
39
+ kind: 'onSegment';
40
+ segmentId: Name;
41
+ t: number;
42
+ } | {
43
+ name: Name;
44
+ kind: 'onLine';
45
+ lineId: Name;
46
+ t: number;
47
+ } | {
48
+ name: Name;
49
+ kind: 'onCircle';
50
+ circleId: Name;
51
+ theta: number;
52
+ } | {
53
+ name: Name;
54
+ kind: 'perpFoot';
55
+ from: Name;
56
+ onLine: Name;
57
+ } | {
58
+ name: Name;
59
+ kind: 'circumcenter';
60
+ vertices: [Name, Name, Name];
61
+ } | {
62
+ name: Name;
63
+ kind: 'incenter';
64
+ vertices: [Name, Name, Name];
65
+ } | {
66
+ name: Name;
67
+ kind: 'centroid';
68
+ vertices: [Name, Name, Name];
69
+ } | {
70
+ name: Name;
71
+ kind: 'orthocenter';
72
+ vertices: [Name, Name, Name];
73
+ } | {
74
+ name: Name;
75
+ kind: 'intersection';
76
+ ref1: Name;
77
+ ref2: Name;
78
+ branch?: 0 | 1;
79
+ } | {
80
+ name: Name;
81
+ kind: 'secondIntersection';
82
+ line: Name;
83
+ circle: Name;
84
+ other: Name;
85
+ } | {
86
+ name: Name;
87
+ kind: 'circleIntersection';
88
+ c1: Name;
89
+ c2: Name;
90
+ which: 0 | 1;
91
+ } | {
92
+ name: Name;
93
+ kind: 'circleSecondIntersection';
94
+ c1: Name;
95
+ c2: Name;
96
+ exclude: Name;
97
+ } | {
98
+ name: Name;
99
+ kind: 'tangencyPoint';
100
+ circle: Name;
101
+ onLine: Name;
102
+ } | {
103
+ name: Name;
104
+ kind: 'tangentPointExt';
105
+ from: Name;
106
+ circle: Name;
107
+ which: 0 | 1;
108
+ } | {
109
+ name: Name;
110
+ kind: 'arcMidpoint';
111
+ circle: Name;
112
+ a: Name;
113
+ b: Name;
114
+ notContaining: Name;
115
+ } | {
116
+ name: Name;
117
+ kind: 'excenter';
118
+ vertices: [Name, Name, Name];
119
+ opposite: Name;
120
+ } | {
121
+ name: Name;
122
+ kind: 'reflectPoint';
123
+ of: Name;
124
+ through: Name;
125
+ } | {
126
+ name: Name;
127
+ kind: 'reflectLine';
128
+ of: Name;
129
+ through: Name;
130
+ } | {
131
+ name: Name;
132
+ kind: 'pointAtDistance';
133
+ from: Name;
134
+ through: Name;
135
+ distance: DslDistanceSpec;
136
+ };
137
+ type DslShapeT = {
138
+ name: Name;
139
+ kind: 'segment';
140
+ p1: Name;
141
+ p2: Name;
142
+ } | {
143
+ name: Name;
144
+ kind: 'line';
145
+ p1: Name;
146
+ p2: Name;
147
+ } | {
148
+ name: Name;
149
+ kind: 'ray';
150
+ origin: Name;
151
+ through: Name;
152
+ } | {
153
+ name: Name;
154
+ kind: 'polygon';
155
+ vertices: Name[];
156
+ } | {
157
+ name: Name;
158
+ kind: 'perpendicular';
159
+ throughPoint: Name;
160
+ toLine: Name;
161
+ } | {
162
+ name: Name;
163
+ kind: 'parallel';
164
+ throughPoint: Name;
165
+ toLine: Name;
166
+ } | {
167
+ name: Name;
168
+ kind: 'perpBisector';
169
+ p1: Name;
170
+ p2: Name;
171
+ } | {
172
+ name: Name;
173
+ kind: 'angleBisector';
174
+ p1: Name;
175
+ vertex: Name;
176
+ p2: Name;
177
+ } | {
178
+ name: Name;
179
+ kind: 'lineThrough';
180
+ points: Name[];
181
+ } | {
182
+ name: Name;
183
+ kind: 'radicalAxis';
184
+ circle1: Name;
185
+ circle2: Name;
186
+ } | {
187
+ name: Name;
188
+ kind: 'tangent';
189
+ throughPoint: Name;
190
+ toCircle: Name;
191
+ branch?: 0 | 1 | 'on';
192
+ } | {
193
+ name: Name;
194
+ kind: 'circleCP';
195
+ center: Name;
196
+ surfacePoint: Name;
197
+ visible?: boolean;
198
+ } | {
199
+ name: Name;
200
+ kind: 'circle3';
201
+ p1: Name;
202
+ p2: Name;
203
+ p3: Name;
204
+ } | {
205
+ name: Name;
206
+ kind: 'circleDiameter';
207
+ p1: Name;
208
+ p2: Name;
209
+ visible?: boolean;
210
+ } | {
211
+ name: Name;
212
+ kind: 'circleCR';
213
+ center: Name;
214
+ radius: number;
215
+ } | {
216
+ name: Name;
217
+ kind: 'incircle';
218
+ vertices: [Name, Name, Name];
219
+ } | {
220
+ name: Name;
221
+ kind: 'excircle';
222
+ vertices: [Name, Name, Name];
223
+ opposite: Name;
224
+ };
225
+ type DslInputT = {
226
+ version: 1;
227
+ points: DslPointT[];
228
+ shapes: DslShapeT[];
229
+ };
230
+
8
231
  type TranspileErrorCode = 'SCHEMA' | 'DUPLICATE_NAME' | 'UNKNOWN_REF' | 'KIND_MISMATCH' | 'CYCLE';
9
232
  interface TranspileError {
10
233
  code: TranspileErrorCode;
@@ -20,39 +243,6 @@ type TranspileResult = {
20
243
  errors: TranspileError[];
21
244
  };
22
245
 
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
246
  declare const DrawShapeIntentZ: z.ZodObject<{
57
247
  op: z.ZodLiteral<"draw-shape">;
58
248
  shape: z.ZodEnum<["triangle", "square", "rectangle", "rhombus", "trapezoid", "parallelogram", "quadrilateral"]>;
@@ -2886,23 +3076,8 @@ interface VerifyReport {
2886
3076
  declare function compareIntents(expected: readonly IntentT[], actual: readonly IntentT[]): VerifyReport;
2887
3077
  declare function verifyGeometry(intents: readonly IntentT[], dsl: DslInputT): VerifyReport;
2888
3078
 
2889
- interface GenerateIntentOptions extends SelectProviderOptions {
2890
- model?: string;
2891
- maxTokens?: number;
3079
+ interface GenerateIntentOptions {
2892
3080
  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
3081
  }
2907
3082
  interface IntentTokenUsage {
2908
3083
  inputTokens: number;
@@ -2923,7 +3098,7 @@ interface IntentSuccessResult {
2923
3098
  }
2924
3099
  interface IntentFailureResult {
2925
3100
  ok: false;
2926
- reason: 'refused' | 'parse_error' | 'builder_error' | 'transpile_error' | 'verify_error' | 'provider_error' | 'deterministic_miss';
3101
+ reason: 'builder_error' | 'transpile_error' | 'verify_error' | 'deterministic_miss';
2927
3102
  message: string;
2928
3103
  intents?: readonly IntentT[];
2929
3104
  dsl?: ReturnType<typeof intentsToDsl>;
@@ -2931,7 +3106,7 @@ interface IntentFailureResult {
2931
3106
  provider?: string;
2932
3107
  }
2933
3108
  type IntentGenerateResult = IntentSuccessResult | IntentFailureResult;
2934
- declare function generateFigureIntent(problem: string, opts?: GenerateIntentOptions): Promise<IntentGenerateResult>;
3109
+ declare function generateFigureIntent(problem: string, _opts?: GenerateIntentOptions): Promise<IntentGenerateResult>;
2935
3110
 
2936
3111
  interface HandleGenerateFigureInput {
2937
3112
  /** Đề bài tiếng Việt từ teacher. */
@@ -2949,7 +3124,8 @@ interface HandleGenerateFigureOptions extends GenerateIntentOptions {
2949
3124
  onResult?: (result: IntentGenerateResult, attempt: number) => void;
2950
3125
  /**
2951
3126
  * Số attempt tối đa khi build error (transpile/builder). Default 2 (1 retry).
2952
- * LLM stochasticlần 2 thường khá hơn. Clamp [1,5].
3127
+ * Rule base deterministic retry hiếm khi đổi kết quả, giữ để tương thích
3128
+ * contract cũ. Clamp [1,5].
2953
3129
  */
2954
3130
  maxAttempts?: number;
2955
3131
  }
@@ -2957,12 +3133,11 @@ interface HandleGenerateFigureOptions extends GenerateIntentOptions {
2957
3133
  * Gọi rule-engine intent pipeline và trả về `AiFigureUiResult` mà
2958
3134
  * `<Whiteboard generateGeometryFigure>` chấp nhận trực tiếp.
2959
3135
  *
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).
3136
+ * Deterministic rule base chạy trong `generateFigureIntent` — đề dễ→trung bình
3137
+ * dựng KHÔNG tốn token. Miss → `deterministic_miss` (KHÔNG LLM fallback).
2962
3138
  *
2963
- * Auto-retry: chỉ retry khi `transpile_error`/`builder_error` (AI emit hình
2964
- * structurally sai model stochastic hội khá hơn lần 2). KHÔNG retry
2965
- * `refused` (cố ý), `parse_error` (sai schema), `provider_error` (network/config).
3139
+ * Auto-retry: chỉ retry khi `transpile_error`/`builder_error`. KHÔNG retry
3140
+ * `deterministic_miss` (rule base ổn định, retry nghĩa).
2966
3141
  *
2967
3142
  * Server-side caller giữ `IntentGenerateResult` đầy đủ qua `onResult` cho
2968
3143
  * telemetry/logging.
@@ -3071,187 +3246,6 @@ declare function envelopeJsonSchema(): Record<string, unknown>;
3071
3246
  /** Helper: ép envelope build hợp lệ về DslInputT (sau khi đã validate). */
3072
3247
  declare function envelopeBuildDsl(env: FigureEnvelopeT): DslInputT;
3073
3248
 
3074
- interface GenerateDeltaOptions extends SelectProviderOptions {
3075
- model?: string;
3076
- maxTokens?: number;
3077
- signal?: AbortSignal;
3078
- maxAttempts?: number;
3079
- }
3080
- interface TokenUsage {
3081
- inputTokens: number;
3082
- outputTokens: number;
3083
- cacheReadTokens: number;
3084
- cacheCreationTokens: number;
3085
- }
3086
- type GenerateDeltaResult = {
3087
- ok: true;
3088
- state: State;
3089
- mergedDsl: DslInputT;
3090
- mode: 'add' | 'replace';
3091
- usage: TokenUsage;
3092
- provider: string;
3093
- } | {
3094
- ok: false;
3095
- reason: 'refused';
3096
- message: string;
3097
- usage?: TokenUsage;
3098
- provider?: string;
3099
- } | {
3100
- ok: false;
3101
- reason: 'parse_error';
3102
- message: string;
3103
- raw?: unknown;
3104
- usage?: TokenUsage;
3105
- provider?: string;
3106
- } | {
3107
- ok: false;
3108
- reason: 'transpile_error';
3109
- message: string;
3110
- errors: TranspileError[];
3111
- dsl: unknown;
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;
3132
- } | {
3133
- ok: false;
3134
- reason: 'api_error';
3135
- message: string;
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
3249
  declare function intentEnvelopeJsonSchema(): Record<string, unknown>;
3256
3250
  declare function envelopeIntentList(env: IntentEnvelopeT): readonly IntentT[];
3257
3251
 
@@ -3343,57 +3337,4 @@ declare function tryPartialDeterministic(problem: string): PartialDeterministicR
3343
3337
  */
3344
3338
  declare function mergeIntents(det: readonly IntentT[], llm: readonly IntentT[]): IntentT[];
3345
3339
 
3346
- declare function buildVisionSystemPrompt(): string;
3347
- declare const VISION_USER_PROMPT = "\u0110\u1ECDc \u0111\u1EC1 b\u00E0i h\u00ECnh h\u1ECDc trong \u1EA3nh sau.";
3348
-
3349
- declare const VisionEnvelopeZ: z.ZodEffects<z.ZodObject<{
3350
- decision: z.ZodEnum<["extract", "refuse"]>;
3351
- text: z.ZodOptional<z.ZodString>;
3352
- confidence: z.ZodOptional<z.ZodEnum<["high", "low"]>>;
3353
- reason: z.ZodOptional<z.ZodString>;
3354
- }, "strip", z.ZodTypeAny, {
3355
- decision: "extract" | "refuse";
3356
- text?: string | undefined;
3357
- reason?: string | undefined;
3358
- confidence?: "high" | "low" | undefined;
3359
- }, {
3360
- decision: "extract" | "refuse";
3361
- text?: string | undefined;
3362
- reason?: string | undefined;
3363
- confidence?: "high" | "low" | undefined;
3364
- }>, {
3365
- decision: "extract" | "refuse";
3366
- text?: string | undefined;
3367
- reason?: string | undefined;
3368
- confidence?: "high" | "low" | undefined;
3369
- }, {
3370
- decision: "extract" | "refuse";
3371
- text?: string | undefined;
3372
- reason?: string | undefined;
3373
- confidence?: "high" | "low" | undefined;
3374
- }>;
3375
- type VisionEnvelopeT = z.infer<typeof VisionEnvelopeZ>;
3376
- declare function visionEnvelopeJsonSchema(): Record<string, unknown>;
3377
-
3378
- declare const MAX_EDGE_PX = 2048;
3379
- declare const MAX_RAW_BYTES: number;
3380
- declare const MAX_ENCODED_BYTES: number;
3381
- declare const ALLOWED_TYPES: readonly ["image/png", "image/jpeg", "image/webp"];
3382
- type AllowedType = (typeof ALLOWED_TYPES)[number];
3383
- type ValidationResult = {
3384
- ok: true;
3385
- mediaType: AllowedType;
3386
- } | {
3387
- ok: false;
3388
- code: 'invalid-format' | 'too-large';
3389
- message: string;
3390
- };
3391
- declare function inferMediaType(file: File): AllowedType | null;
3392
- declare function validateFile(file: File): ValidationResult;
3393
- /**
3394
- * Convert File → ImagePart. Auto-downscale nếu max edge > MAX_EDGE_PX.
3395
- * Throws nếu file invalid hoặc decode fail.
3396
- */
3397
- declare function fileToImagePart(file: File): Promise<ImagePart>;
3398
-
3399
- export { AIProvider, type AddPointIntentT, type AiFigureIntentUiResult, AnthropicProvider, type ConnectIntentT, type DeterministicFigure, type DrawCircleIntentT, type DrawShapeIntentT, type FigureEnvelopeT, FigureEnvelopeZ, type FigureRefineEnvelopeT, FigureRefineEnvelopeZ, type GenerateDeltaOptions, type GenerateDeltaResult, type GenerateFigureDeltaInput, type GenerateIntentOptions, type HandleGenerateFigureDeltaInput, type HandleGenerateFigureDeltaOptions, type HandleGenerateFigureInput, type HandleGenerateFigureIntentInput, type HandleGenerateFigureIntentOptions, type HandleGenerateFigureOptions, IntentBuilderError, type IntentEnvelopeT, IntentEnvelopeZ, type IntentFailureResult, type IntentGenerateResult, type IntentSuccessResult, type IntentT, IntentZ, MAX_EDGE_PX, MAX_ENCODED_BYTES, MAX_RAW_BYTES, OllamaProvider, type PartialDeterministicResult, ProviderOutput, ProviderRequest, SelectProviderOptions, type TryDeterministicResult, VISION_USER_PROMPT, type ValidationResult, type VerifyIssue, type VerifyReport, type VisionEnvelopeT, VisionEnvelopeZ, buildIntentSystemPrompt, buildVisionSystemPrompt, compareIntents, envelopeBuildDsl, envelopeIntentList, envelopeJsonSchema, fileToImagePart, generateFigureDelta, generateFigureIntent, handleGenerateFigure, handleGenerateFigureDelta, handleGenerateFigureIntent, inferMediaType, intentEnvelopeJsonSchema, intentsToDsl, mergeIntents, refineEnvelopeJsonSchema, tryDeterministicFigure, tryPartialDeterministic, validateFile, verifyGeometry, visionEnvelopeJsonSchema };
3340
+ export { type AddPointIntentT, type AiFigureIntentUiResult, type ConnectIntentT, type DeterministicFigure, type DrawCircleIntentT, type DrawShapeIntentT, type FigureEnvelopeT, FigureEnvelopeZ, type GenerateIntentOptions, type HandleGenerateFigureInput, type HandleGenerateFigureIntentInput, type HandleGenerateFigureIntentOptions, type HandleGenerateFigureOptions, IntentBuilderError, type IntentEnvelopeT, IntentEnvelopeZ, type IntentFailureResult, type IntentGenerateResult, type IntentSuccessResult, type IntentT, IntentZ, type PartialDeterministicResult, type TryDeterministicResult, type VerifyIssue, type VerifyReport, buildIntentSystemPrompt, compareIntents, envelopeBuildDsl, envelopeIntentList, envelopeJsonSchema, generateFigureIntent, handleGenerateFigure, handleGenerateFigureIntent, intentEnvelopeJsonSchema, intentsToDsl, mergeIntents, tryDeterministicFigure, tryPartialDeterministic, verifyGeometry };