@studio8collective/patent-render 1.0.0 → 1.1.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.
- package/CHANGELOG.md +29 -0
- package/README.md +2 -1
- package/dist/core.d.ts +405 -0
- package/dist/core.js +185 -117
- package/dist/core.js.map +1 -1
- package/dist/index.d.ts +451 -4
- package/dist/index.js +1041 -447
- package/dist/index.js.map +1 -1
- package/dist/server-actions.d.ts +367 -0
- package/dist/server-actions.js +185 -117
- package/dist/server-actions.js.map +1 -1
- package/dist/server.d.ts +367 -0
- package/dist/server.js +391 -322
- package/dist/server.js.map +1 -1
- package/docs/nextjs.md +58 -10
- package/package.json +6 -1
package/dist/server.js
CHANGED
|
@@ -51,134 +51,189 @@ function llmModels(config, env = process.env) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
// ../../src/patent-render/schema/document.ts
|
|
54
|
+
import { z as z2 } from "zod";
|
|
55
|
+
|
|
56
|
+
// ../../src/patent-render/schema/plan.ts
|
|
54
57
|
import { z } from "zod";
|
|
58
|
+
var FigureType = z.enum([
|
|
59
|
+
"flowchart",
|
|
60
|
+
"blockDiagram",
|
|
61
|
+
"mechanical2d",
|
|
62
|
+
"uiScreen",
|
|
63
|
+
"perspective3d",
|
|
64
|
+
"circuit",
|
|
65
|
+
"chemical"
|
|
66
|
+
]);
|
|
67
|
+
var FigurePlan = z.object({
|
|
68
|
+
figureType: FigureType,
|
|
69
|
+
/** e.g. "Cross-sectional view taken along line A-A of FIG. 2" */
|
|
70
|
+
view: z.string(),
|
|
71
|
+
summary: z.string(),
|
|
72
|
+
/**
|
|
73
|
+
* Full generation spec: overall form and proportions (mm), every component's
|
|
74
|
+
* shape, position and relationships, counts, surface details and what faces
|
|
75
|
+
* the viewer. Written so a draftsperson can draw without guessing.
|
|
76
|
+
*/
|
|
77
|
+
spec: z.string().default(""),
|
|
78
|
+
components: z.array(z.object({
|
|
79
|
+
numeral: z.string(),
|
|
80
|
+
name: z.string(),
|
|
81
|
+
description: z.string().optional(),
|
|
82
|
+
reused: z.boolean().default(false)
|
|
83
|
+
// numeral came from the host registry
|
|
84
|
+
})),
|
|
85
|
+
layers: z.array(z.object({ id: z.string(), name: z.string() })),
|
|
86
|
+
notes: z.array(z.string()).default([])
|
|
87
|
+
});
|
|
88
|
+
var DrawingStyle = z.enum(["standard", "detailed", "minimal"]);
|
|
89
|
+
var STYLE_LABEL = {
|
|
90
|
+
standard: { label: "Standard line art", hint: "Clean outlines and key details, as most filings" },
|
|
91
|
+
detailed: { label: "Detailed rendering", hint: "Shading strokes, glare, textures, fine features" },
|
|
92
|
+
minimal: { label: "Minimal outline", hint: "Essential outlines only, fewest lines" }
|
|
93
|
+
};
|
|
94
|
+
var GenerationPrefs = z.object({
|
|
95
|
+
figureType: FigureType.optional(),
|
|
96
|
+
// undefined = let the planner decide
|
|
97
|
+
style: DrawingStyle.default("standard")
|
|
98
|
+
});
|
|
99
|
+
var FIGURE_TYPE_LABEL = {
|
|
100
|
+
flowchart: "Flowchart",
|
|
101
|
+
blockDiagram: "Block diagram",
|
|
102
|
+
mechanical2d: "Mechanical 2D",
|
|
103
|
+
uiScreen: "UI screen",
|
|
104
|
+
perspective3d: "Perspective 3D",
|
|
105
|
+
circuit: "Circuit",
|
|
106
|
+
chemical: "Chemical structure"
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// ../../src/patent-render/schema/document.ts
|
|
55
110
|
function vec(n2) {
|
|
56
|
-
return
|
|
111
|
+
return z2.array(z2.number()).length(n2);
|
|
57
112
|
}
|
|
58
113
|
var Point = vec(2);
|
|
59
|
-
var StrokeStyle =
|
|
60
|
-
var Stroke =
|
|
61
|
-
width:
|
|
114
|
+
var StrokeStyle = z2.enum(["solid", "dashed", "centre", "phantom"]);
|
|
115
|
+
var Stroke = z2.object({
|
|
116
|
+
width: z2.number().positive().default(0.35),
|
|
62
117
|
style: StrokeStyle.default("solid")
|
|
63
118
|
});
|
|
64
|
-
var Fill =
|
|
119
|
+
var Fill = z2.enum(["none", "black", "white"]);
|
|
65
120
|
var base = {
|
|
66
|
-
id:
|
|
67
|
-
name:
|
|
121
|
+
id: z2.string().min(1),
|
|
122
|
+
name: z2.string().optional(),
|
|
68
123
|
/** Degrees, clockwise, about the item's bounding-box centre. */
|
|
69
|
-
rotation:
|
|
70
|
-
locked:
|
|
71
|
-
hidden:
|
|
124
|
+
rotation: z2.number().default(0),
|
|
125
|
+
locked: z2.boolean().default(false),
|
|
126
|
+
hidden: z2.boolean().default(false)
|
|
72
127
|
};
|
|
73
128
|
var stroked = { stroke: Stroke.default({ width: 0.35, style: "solid" }) };
|
|
74
|
-
var LineItem =
|
|
75
|
-
var PolylineItem =
|
|
129
|
+
var LineItem = z2.object({ ...base, ...stroked, type: z2.literal("line"), a: Point, b: Point });
|
|
130
|
+
var PolylineItem = z2.object({
|
|
76
131
|
...base,
|
|
77
132
|
...stroked,
|
|
78
|
-
type:
|
|
79
|
-
points:
|
|
80
|
-
closed:
|
|
133
|
+
type: z2.literal("polyline"),
|
|
134
|
+
points: z2.array(Point).min(2),
|
|
135
|
+
closed: z2.boolean().default(false),
|
|
81
136
|
fill: Fill.default("none")
|
|
82
137
|
});
|
|
83
|
-
var PathItem =
|
|
84
|
-
var RectItem =
|
|
138
|
+
var PathItem = z2.object({ ...base, ...stroked, type: z2.literal("path"), d: z2.string().min(1), fill: Fill.default("none") });
|
|
139
|
+
var RectItem = z2.object({
|
|
85
140
|
...base,
|
|
86
141
|
...stroked,
|
|
87
|
-
type:
|
|
88
|
-
x:
|
|
89
|
-
y:
|
|
90
|
-
w:
|
|
91
|
-
h:
|
|
92
|
-
radius:
|
|
142
|
+
type: z2.literal("rect"),
|
|
143
|
+
x: z2.number(),
|
|
144
|
+
y: z2.number(),
|
|
145
|
+
w: z2.number().positive(),
|
|
146
|
+
h: z2.number().positive(),
|
|
147
|
+
radius: z2.number().min(0).default(0),
|
|
93
148
|
fill: Fill.default("none")
|
|
94
149
|
});
|
|
95
|
-
var EllipseItem =
|
|
150
|
+
var EllipseItem = z2.object({
|
|
96
151
|
...base,
|
|
97
152
|
...stroked,
|
|
98
|
-
type:
|
|
99
|
-
cx:
|
|
100
|
-
cy:
|
|
101
|
-
rx:
|
|
102
|
-
ry:
|
|
153
|
+
type: z2.literal("ellipse"),
|
|
154
|
+
cx: z2.number(),
|
|
155
|
+
cy: z2.number(),
|
|
156
|
+
rx: z2.number().positive(),
|
|
157
|
+
ry: z2.number().positive(),
|
|
103
158
|
fill: Fill.default("none")
|
|
104
159
|
});
|
|
105
|
-
var ArcItem =
|
|
160
|
+
var ArcItem = z2.object({
|
|
106
161
|
...base,
|
|
107
162
|
...stroked,
|
|
108
|
-
type:
|
|
109
|
-
cx:
|
|
110
|
-
cy:
|
|
111
|
-
r:
|
|
163
|
+
type: z2.literal("arc"),
|
|
164
|
+
cx: z2.number(),
|
|
165
|
+
cy: z2.number(),
|
|
166
|
+
r: z2.number().positive(),
|
|
112
167
|
/** Degrees, 0 = +x axis, clockwise (SVG convention). */
|
|
113
|
-
start:
|
|
114
|
-
end:
|
|
168
|
+
start: z2.number(),
|
|
169
|
+
end: z2.number()
|
|
115
170
|
});
|
|
116
|
-
var TextAnchor =
|
|
117
|
-
var TextItem =
|
|
171
|
+
var TextAnchor = z2.enum(["start", "middle", "end"]);
|
|
172
|
+
var TextItem = z2.object({
|
|
118
173
|
...base,
|
|
119
|
-
type:
|
|
120
|
-
x:
|
|
121
|
-
y:
|
|
122
|
-
text:
|
|
174
|
+
type: z2.literal("text"),
|
|
175
|
+
x: z2.number(),
|
|
176
|
+
y: z2.number(),
|
|
177
|
+
text: z2.string().min(1),
|
|
123
178
|
/** Cap height in mm. */
|
|
124
|
-
size:
|
|
179
|
+
size: z2.number().positive().default(3.5),
|
|
125
180
|
anchor: TextAnchor.default("start")
|
|
126
181
|
});
|
|
127
|
-
var NumeralItem =
|
|
182
|
+
var NumeralItem = z2.object({
|
|
128
183
|
...base,
|
|
129
|
-
type:
|
|
184
|
+
type: z2.literal("numeral"),
|
|
130
185
|
/** Numeral text, e.g. "102" or "102a". Looked up in Document.numerals. */
|
|
131
|
-
n:
|
|
186
|
+
n: z2.string().regex(/^\d+[a-z']*$/i),
|
|
132
187
|
at: Point,
|
|
133
188
|
target: Point,
|
|
134
|
-
leader:
|
|
189
|
+
leader: z2.enum(["straight", "curved", "none"]).default("curved"),
|
|
135
190
|
/** When true, numeral is underlined (refers to the whole assembly). */
|
|
136
|
-
underline:
|
|
137
|
-
size:
|
|
191
|
+
underline: z2.boolean().default(false),
|
|
192
|
+
size: z2.number().positive().default(3.5)
|
|
138
193
|
});
|
|
139
|
-
var FigLabelItem =
|
|
194
|
+
var FigLabelItem = z2.object({
|
|
140
195
|
...base,
|
|
141
|
-
type:
|
|
142
|
-
x:
|
|
143
|
-
y:
|
|
144
|
-
size:
|
|
196
|
+
type: z2.literal("figLabel"),
|
|
197
|
+
x: z2.number(),
|
|
198
|
+
y: z2.number(),
|
|
199
|
+
size: z2.number().positive().default(5)
|
|
145
200
|
});
|
|
146
|
-
var Side =
|
|
147
|
-
var ConnectorEnd =
|
|
148
|
-
|
|
149
|
-
|
|
201
|
+
var Side = z2.enum(["top", "bottom", "left", "right"]);
|
|
202
|
+
var ConnectorEnd = z2.union([
|
|
203
|
+
z2.object({ itemId: z2.string() }),
|
|
204
|
+
z2.object({ point: Point })
|
|
150
205
|
]);
|
|
151
|
-
var ConnectorItem =
|
|
206
|
+
var ConnectorItem = z2.object({
|
|
152
207
|
...base,
|
|
153
208
|
...stroked,
|
|
154
|
-
type:
|
|
209
|
+
type: z2.literal("connector"),
|
|
155
210
|
from: ConnectorEnd,
|
|
156
211
|
to: ConnectorEnd,
|
|
157
|
-
routing:
|
|
212
|
+
routing: z2.enum(["straight", "orthogonal", "curved"]).default("orthogonal"),
|
|
158
213
|
/** Which side of an attached item the connector leaves/enters; auto when omitted. */
|
|
159
214
|
fromSide: Side.optional(),
|
|
160
215
|
toSide: Side.optional(),
|
|
161
|
-
arrow:
|
|
162
|
-
arrowStyle:
|
|
163
|
-
label:
|
|
216
|
+
arrow: z2.enum(["none", "end", "start", "both"]).default("end"),
|
|
217
|
+
arrowStyle: z2.enum(["filled", "open"]).default("filled"),
|
|
218
|
+
label: z2.string().optional()
|
|
164
219
|
});
|
|
165
|
-
var HatchItem =
|
|
220
|
+
var HatchItem = z2.object({
|
|
166
221
|
...base,
|
|
167
|
-
type:
|
|
168
|
-
points:
|
|
169
|
-
angle:
|
|
170
|
-
spacing:
|
|
171
|
-
lineWidth:
|
|
222
|
+
type: z2.literal("hatch"),
|
|
223
|
+
points: z2.array(Point).min(3),
|
|
224
|
+
angle: z2.number().default(45),
|
|
225
|
+
spacing: z2.number().positive().default(1.5),
|
|
226
|
+
lineWidth: z2.number().positive().default(0.25)
|
|
172
227
|
});
|
|
173
|
-
var SectionLineItem =
|
|
228
|
+
var SectionLineItem = z2.object({
|
|
174
229
|
...base,
|
|
175
230
|
...stroked,
|
|
176
|
-
type:
|
|
231
|
+
type: z2.literal("sectionLine"),
|
|
177
232
|
a: Point,
|
|
178
233
|
b: Point,
|
|
179
|
-
label:
|
|
234
|
+
label: z2.string().min(1).max(3)
|
|
180
235
|
});
|
|
181
|
-
var Item =
|
|
236
|
+
var Item = z2.discriminatedUnion("type", [
|
|
182
237
|
LineItem,
|
|
183
238
|
PolylineItem,
|
|
184
239
|
PathItem,
|
|
@@ -192,120 +247,106 @@ var Item = z.discriminatedUnion("type", [
|
|
|
192
247
|
HatchItem,
|
|
193
248
|
SectionLineItem
|
|
194
249
|
]);
|
|
195
|
-
var Offset =
|
|
196
|
-
var Layer =
|
|
197
|
-
id:
|
|
198
|
-
name:
|
|
199
|
-
visible:
|
|
200
|
-
locked:
|
|
250
|
+
var Offset = z2.object({ dx: z2.number(), dy: z2.number() });
|
|
251
|
+
var Layer = z2.object({
|
|
252
|
+
id: z2.string().min(1),
|
|
253
|
+
name: z2.string().min(1),
|
|
254
|
+
visible: z2.boolean().default(true),
|
|
255
|
+
locked: z2.boolean().default(false),
|
|
201
256
|
/** Where this component moves to in the exploded view (mm). */
|
|
202
257
|
explode: Offset.optional(),
|
|
203
|
-
items:
|
|
258
|
+
items: z2.array(Item).default([])
|
|
204
259
|
});
|
|
205
|
-
var JurisdictionId =
|
|
206
|
-
var SheetSize =
|
|
207
|
-
var Sheet =
|
|
260
|
+
var JurisdictionId = z2.enum(["uspto", "pct", "epo", "ipo"]);
|
|
261
|
+
var SheetSize = z2.enum(["a4", "letter"]);
|
|
262
|
+
var Sheet = z2.object({
|
|
208
263
|
size: SheetSize.default("a4"),
|
|
209
|
-
orientation:
|
|
264
|
+
orientation: z2.enum(["portrait", "landscape"]).default("portrait")
|
|
265
|
+
});
|
|
266
|
+
var LetteringStyle = z2.object({
|
|
267
|
+
numeralWeight: z2.enum(["regular", "bold"]).default("regular"),
|
|
268
|
+
figLabel: z2.enum(["sans-bold", "serif-italic"]).default("sans-bold")
|
|
210
269
|
});
|
|
211
|
-
var
|
|
212
|
-
|
|
213
|
-
|
|
270
|
+
var NumeralRegistry = z2.record(z2.string(), z2.string());
|
|
271
|
+
var ChatTranscript = z2.array(z2.unknown());
|
|
272
|
+
var DrawingSnapshot = z2.object({
|
|
273
|
+
jurisdiction: JurisdictionId,
|
|
274
|
+
sheet: Sheet,
|
|
275
|
+
layers: z2.array(Layer),
|
|
276
|
+
numerals: NumeralRegistry,
|
|
277
|
+
lettering: LetteringStyle,
|
|
278
|
+
view: z2.enum(["composite", "exploded"]),
|
|
279
|
+
explodeLines: z2.boolean(),
|
|
280
|
+
sheetLabel: z2.string().max(12).optional()
|
|
214
281
|
});
|
|
215
|
-
var
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
282
|
+
var RunRecord = z2.object({
|
|
283
|
+
id: z2.string().min(1),
|
|
284
|
+
/** "new" draws the figure, "edit" changes one that already had content. */
|
|
285
|
+
kind: z2.enum(["new", "edit"]),
|
|
286
|
+
request: z2.string(),
|
|
287
|
+
preferences: GenerationPrefs.optional(),
|
|
288
|
+
selection: z2.array(z2.string()).default([]),
|
|
289
|
+
/** Transcript length before the request, so a retry can replace the turn. */
|
|
290
|
+
chatLength: z2.number().int().nonnegative().default(0),
|
|
291
|
+
plan: FigurePlan.optional(),
|
|
292
|
+
steps: z2.array(z2.object({ label: z2.string(), status: z2.enum(["done", "active"]) })).default([]),
|
|
293
|
+
/** Number of individual changes the run made. */
|
|
294
|
+
edits: z2.number().int().nonnegative().default(0),
|
|
295
|
+
before: DrawingSnapshot
|
|
296
|
+
});
|
|
297
|
+
var PatentDocument = z2.object({
|
|
298
|
+
version: z2.literal(1).default(1),
|
|
299
|
+
id: z2.string().min(1),
|
|
300
|
+
figureNumber: z2.string().min(1),
|
|
221
301
|
/** Patent office whose drawing rules apply. Defaults to India (IPO). */
|
|
222
302
|
jurisdiction: JurisdictionId.default("ipo"),
|
|
223
303
|
sheet: Sheet.default({ size: "a4", orientation: "portrait" }),
|
|
224
|
-
layers:
|
|
304
|
+
layers: z2.array(Layer).default([]),
|
|
225
305
|
numerals: NumeralRegistry.default({}),
|
|
226
306
|
lettering: LetteringStyle.default({ numeralWeight: "regular", figLabel: "sans-bold" }),
|
|
227
307
|
/** Which view of the same model is shown and exported. */
|
|
228
|
-
view:
|
|
308
|
+
view: z2.enum(["composite", "exploded"]).default("composite"),
|
|
229
309
|
/** Exploded view: dash-dot alignment lines between separated components. */
|
|
230
|
-
explodeLines:
|
|
310
|
+
explodeLines: z2.boolean().default(true),
|
|
231
311
|
/** Sheet number shown top-centre inside the sight, e.g. "1/3" (37 CFR 1.84(t)). Set by the host. */
|
|
232
|
-
sheetLabel:
|
|
233
|
-
chat: ChatTranscript.default([])
|
|
312
|
+
sheetLabel: z2.string().max(12).optional(),
|
|
313
|
+
chat: ChatTranscript.default([]),
|
|
314
|
+
/** Unfinished assistant run. A record that can't be read is dropped, never a load error. */
|
|
315
|
+
run: RunRecord.optional().catch(void 0)
|
|
234
316
|
});
|
|
235
317
|
|
|
236
|
-
// ../../src/patent-render/schema/
|
|
237
|
-
import { z as
|
|
238
|
-
var
|
|
239
|
-
"
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
"perspective3d",
|
|
244
|
-
"circuit",
|
|
245
|
-
"chemical"
|
|
246
|
-
]);
|
|
247
|
-
var FigurePlan = z2.object({
|
|
248
|
-
figureType: FigureType,
|
|
249
|
-
/** e.g. "Cross-sectional view taken along line A-A of FIG. 2" */
|
|
250
|
-
view: z2.string(),
|
|
251
|
-
summary: z2.string(),
|
|
252
|
-
/**
|
|
253
|
-
* Full generation spec: overall form and proportions (mm), every component's
|
|
254
|
-
* shape, position and relationships, counts, surface details and what faces
|
|
255
|
-
* the viewer. Written so a draftsperson can draw without guessing.
|
|
256
|
-
*/
|
|
257
|
-
spec: z2.string().default(""),
|
|
258
|
-
components: z2.array(z2.object({
|
|
259
|
-
numeral: z2.string(),
|
|
260
|
-
name: z2.string(),
|
|
261
|
-
description: z2.string().optional(),
|
|
262
|
-
reused: z2.boolean().default(false)
|
|
263
|
-
// numeral came from the host registry
|
|
264
|
-
})),
|
|
265
|
-
layers: z2.array(z2.object({ id: z2.string(), name: z2.string() })),
|
|
266
|
-
notes: z2.array(z2.string()).default([])
|
|
267
|
-
});
|
|
268
|
-
var DrawingStyle = z2.enum(["standard", "detailed", "minimal"]);
|
|
269
|
-
var STYLE_LABEL = {
|
|
270
|
-
standard: { label: "Standard line art", hint: "Clean outlines and key details, as most filings" },
|
|
271
|
-
detailed: { label: "Detailed rendering", hint: "Shading strokes, glare, textures, fine features" },
|
|
272
|
-
minimal: { label: "Minimal outline", hint: "Essential outlines only, fewest lines" }
|
|
273
|
-
};
|
|
274
|
-
var GenerationPrefs = z2.object({
|
|
275
|
-
figureType: FigureType.optional(),
|
|
276
|
-
// undefined = let the planner decide
|
|
277
|
-
style: DrawingStyle.default("standard")
|
|
318
|
+
// ../../src/patent-render/schema/run.ts
|
|
319
|
+
import { z as z3 } from "zod";
|
|
320
|
+
var RunResume = z3.object({
|
|
321
|
+
kind: z3.enum(["new", "edit"]),
|
|
322
|
+
request: z3.string(),
|
|
323
|
+
plan: FigurePlan.optional(),
|
|
324
|
+
steps: z3.array(z3.string()).default([])
|
|
278
325
|
});
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
mechanical2d: "Mechanical 2D",
|
|
283
|
-
uiScreen: "UI screen",
|
|
284
|
-
perspective3d: "Perspective 3D",
|
|
285
|
-
circuit: "Circuit",
|
|
286
|
-
chemical: "Chemical structure"
|
|
287
|
-
};
|
|
326
|
+
function isNewFigure(doc) {
|
|
327
|
+
return doc.layers.every((l) => l.items.every((i) => i.type === "figLabel"));
|
|
328
|
+
}
|
|
288
329
|
|
|
289
330
|
// ../../src/patent-render/schema/patch.ts
|
|
290
|
-
import { z as
|
|
291
|
-
var ItemChanges =
|
|
331
|
+
import { z as z4 } from "zod";
|
|
332
|
+
var ItemChanges = z4.record(z4.string(), z4.unknown());
|
|
292
333
|
var LayerChanges = Layer.omit({ id: true, items: true }).partial();
|
|
293
|
-
var Patch =
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
334
|
+
var Patch = z4.discriminatedUnion("op", [
|
|
335
|
+
z4.object({ op: z4.literal("addLayer"), layer: Layer, index: z4.number().int().optional() }),
|
|
336
|
+
z4.object({ op: z4.literal("updateLayer"), id: z4.string(), changes: LayerChanges }),
|
|
337
|
+
z4.object({ op: z4.literal("removeLayer"), id: z4.string() }),
|
|
338
|
+
z4.object({ op: z4.literal("moveLayer"), id: z4.string(), toIndex: z4.number().int() }),
|
|
339
|
+
z4.object({ op: z4.literal("addItem"), layerId: z4.string(), item: Item, index: z4.number().int().optional() }),
|
|
340
|
+
z4.object({ op: z4.literal("updateItem"), id: z4.string(), changes: ItemChanges }),
|
|
341
|
+
z4.object({ op: z4.literal("removeItem"), id: z4.string() }),
|
|
342
|
+
z4.object({ op: z4.literal("moveItem"), id: z4.string(), toLayerId: z4.string(), toIndex: z4.number().int().optional() }),
|
|
343
|
+
z4.object({ op: z4.literal("setNumeral"), n: z4.string(), label: z4.string().nullable() }),
|
|
344
|
+
z4.object({ op: z4.literal("setSheet"), sheet: Sheet }),
|
|
345
|
+
z4.object({ op: z4.literal("setJurisdiction"), jurisdiction: JurisdictionId }),
|
|
346
|
+
z4.object({ op: z4.literal("setLettering"), lettering: LetteringStyle }),
|
|
347
|
+
z4.object({ op: z4.literal("setView"), view: z4.enum(["composite", "exploded"]), explodeLines: z4.boolean().optional() }),
|
|
348
|
+
z4.object({ op: z4.literal("setSheetLabel"), sheetLabel: z4.string().max(12).nullable() }),
|
|
349
|
+
z4.object({ op: z4.literal("batch"), patches: z4.array(z4.lazy(() => Patch)) })
|
|
309
350
|
]);
|
|
310
351
|
var PatchError = class extends Error {
|
|
311
352
|
};
|
|
@@ -1250,7 +1291,7 @@ function summariseIssues(issues) {
|
|
|
1250
1291
|
|
|
1251
1292
|
// ../../src/patent-render/server/tools.ts
|
|
1252
1293
|
import { toolDefinition as toolDefinition8 } from "@tanstack/ai";
|
|
1253
|
-
import { z as
|
|
1294
|
+
import { z as z12 } from "zod";
|
|
1254
1295
|
|
|
1255
1296
|
// ../../src/patent-render/server/describe.ts
|
|
1256
1297
|
var n = (v) => Math.round(v * 10) / 10;
|
|
@@ -1309,7 +1350,7 @@ function describeDocument(doc, selection = []) {
|
|
|
1309
1350
|
|
|
1310
1351
|
// ../../src/patent-render/server/skills/diagram.ts
|
|
1311
1352
|
import { toolDefinition } from "@tanstack/ai";
|
|
1312
|
-
import { z as
|
|
1353
|
+
import { z as z5 } from "zod";
|
|
1313
1354
|
import ELK from "elkjs/lib/elk.bundled.js";
|
|
1314
1355
|
|
|
1315
1356
|
// ../../src/patent-render/geometry/shapes.ts
|
|
@@ -1453,7 +1494,7 @@ var r12 = (n2) => Math.round(n2 * 10) / 10;
|
|
|
1453
1494
|
|
|
1454
1495
|
// ../../src/patent-render/server/skills/diagram.ts
|
|
1455
1496
|
var elk = new ELK();
|
|
1456
|
-
var Shape =
|
|
1497
|
+
var Shape = z5.enum(SHAPE_KINDS);
|
|
1457
1498
|
var CAP = 3.5;
|
|
1458
1499
|
var LINE_H = CAP / 0.7 * 1.2;
|
|
1459
1500
|
function nodeSize(shape, lines) {
|
|
@@ -1472,28 +1513,28 @@ function nodeSize(shape, lines) {
|
|
|
1472
1513
|
return { w: Math.max(36, tw + 12), h: Math.max(16, th + 8) };
|
|
1473
1514
|
}
|
|
1474
1515
|
}
|
|
1475
|
-
var LayoutInput =
|
|
1476
|
-
direction:
|
|
1477
|
-
layers:
|
|
1478
|
-
shapes:
|
|
1479
|
-
labels:
|
|
1480
|
-
flow:
|
|
1481
|
-
annotations:
|
|
1516
|
+
var LayoutInput = z5.object({
|
|
1517
|
+
direction: z5.enum(["DOWN", "RIGHT"]).default("DOWN"),
|
|
1518
|
+
layers: z5.object({
|
|
1519
|
+
shapes: z5.string().default("steps"),
|
|
1520
|
+
labels: z5.string().default("labels"),
|
|
1521
|
+
flow: z5.string().default("flow"),
|
|
1522
|
+
annotations: z5.string().default("annotations")
|
|
1482
1523
|
}).default({ shapes: "steps", labels: "labels", flow: "flow", annotations: "annotations" }),
|
|
1483
|
-
nodes:
|
|
1484
|
-
id:
|
|
1485
|
-
label:
|
|
1524
|
+
nodes: z5.array(z5.object({
|
|
1525
|
+
id: z5.string(),
|
|
1526
|
+
label: z5.string().meta({ description: "Short label; use \\n for a second line. Keep within the jurisdiction's word limit." }),
|
|
1486
1527
|
shape: Shape.default("process"),
|
|
1487
|
-
numeral:
|
|
1528
|
+
numeral: z5.string().optional().meta({ description: "Reference numeral for this element, e.g. 302." })
|
|
1488
1529
|
})).min(1),
|
|
1489
|
-
edges:
|
|
1490
|
-
from:
|
|
1491
|
-
to:
|
|
1492
|
-
label:
|
|
1493
|
-
arrow:
|
|
1530
|
+
edges: z5.array(z5.object({
|
|
1531
|
+
from: z5.string(),
|
|
1532
|
+
to: z5.string(),
|
|
1533
|
+
label: z5.string().optional().meta({ description: "Catchword such as YES / NO." }),
|
|
1534
|
+
arrow: z5.enum(["end", "both", "none"]).default("end")
|
|
1494
1535
|
})).default([]),
|
|
1495
|
-
numeralSide:
|
|
1496
|
-
area:
|
|
1536
|
+
numeralSide: z5.enum(["left", "right"]).default("left"),
|
|
1537
|
+
area: z5.object({ x: z5.number(), y: z5.number(), w: z5.number(), h: z5.number() }).optional().meta({ description: "Region to fit the graph in (mm). Defaults to the usable area above the FIG. label." })
|
|
1497
1538
|
});
|
|
1498
1539
|
async function layoutGraph(session, input, ctx) {
|
|
1499
1540
|
const area = input.area ?? usableArea(session.doc);
|
|
@@ -1636,7 +1677,7 @@ After layout_graph: set_numerals for every numeral used, check the FIG. label si
|
|
|
1636
1677
|
|
|
1637
1678
|
// ../../src/patent-render/server/skills/mechanical.ts
|
|
1638
1679
|
import { toolDefinition as toolDefinition2 } from "@tanstack/ai";
|
|
1639
|
-
import { z as
|
|
1680
|
+
import { z as z6 } from "zod";
|
|
1640
1681
|
var mechanicalSkill = {
|
|
1641
1682
|
types: ["mechanical2d"],
|
|
1642
1683
|
title: "Mechanical 2D views (orthographic, section, exploded)",
|
|
@@ -1669,11 +1710,11 @@ Workflow: plan components \u2192 add layers \u2192 outlines \u2192 interior deta
|
|
|
1669
1710
|
toolDefinition2({
|
|
1670
1711
|
name: "mirror_items",
|
|
1671
1712
|
description: "Create mirrored copies of items across a vertical line x=\u2026 or horizontal line y=\u2026 (for symmetric parts). New ids get the given suffix.",
|
|
1672
|
-
inputSchema:
|
|
1673
|
-
ids:
|
|
1674
|
-
axis:
|
|
1675
|
-
suffix:
|
|
1676
|
-
layerId:
|
|
1713
|
+
inputSchema: z6.object({
|
|
1714
|
+
ids: z6.array(z6.string()).min(1),
|
|
1715
|
+
axis: z6.union([z6.object({ x: z6.number() }), z6.object({ y: z6.number() })]),
|
|
1716
|
+
suffix: z6.string().default("-m"),
|
|
1717
|
+
layerId: z6.string().optional().meta({ description: "Target layer; defaults to each item's own layer." })
|
|
1677
1718
|
})
|
|
1678
1719
|
}).server(async ({ ids, axis, suffix = "-m", layerId }, ctx) => {
|
|
1679
1720
|
const patches = [];
|
|
@@ -1700,7 +1741,7 @@ Workflow: plan components \u2192 add layers \u2192 outlines \u2192 interior deta
|
|
|
1700
1741
|
|
|
1701
1742
|
// ../../src/patent-render/server/skills/ui-screen.ts
|
|
1702
1743
|
import { toolDefinition as toolDefinition3 } from "@tanstack/ai";
|
|
1703
|
-
import { z as
|
|
1744
|
+
import { z as z7 } from "zod";
|
|
1704
1745
|
var FRAMES = {
|
|
1705
1746
|
phone: { aspect: 2.05, radius: 7, bezel: 3.5, statusBar: 6 },
|
|
1706
1747
|
tablet: { aspect: 1.38, radius: 6, bezel: 5, statusBar: 5 },
|
|
@@ -1724,12 +1765,12 @@ GUI figures show a screen as line art. Start with device_frame, then draw inside
|
|
|
1724
1765
|
toolDefinition3({
|
|
1725
1766
|
name: "device_frame",
|
|
1726
1767
|
description: "Draw a device outline (phone, tablet, desktop monitor, browser window) and return the inner screen box (mm) to draw the UI into.",
|
|
1727
|
-
inputSchema:
|
|
1728
|
-
kind:
|
|
1729
|
-
layerId:
|
|
1730
|
-
width:
|
|
1731
|
-
x:
|
|
1732
|
-
y:
|
|
1768
|
+
inputSchema: z7.object({
|
|
1769
|
+
kind: z7.enum(["phone", "tablet", "desktop", "browser"]),
|
|
1770
|
+
layerId: z7.string().default("frame"),
|
|
1771
|
+
width: z7.number().optional().meta({ description: "Outer width in mm; defaults to fit the usable area." }),
|
|
1772
|
+
x: z7.number().optional(),
|
|
1773
|
+
y: z7.number().optional()
|
|
1733
1774
|
})
|
|
1734
1775
|
}).server(async ({ kind, layerId: lid, width, x, y }, ctx) => {
|
|
1735
1776
|
const layerId = lid ?? "frame";
|
|
@@ -1774,26 +1815,26 @@ function rnd(b) {
|
|
|
1774
1815
|
|
|
1775
1816
|
// ../../src/patent-render/server/skills/perspective.ts
|
|
1776
1817
|
import { toolDefinition as toolDefinition4 } from "@tanstack/ai";
|
|
1777
|
-
import { z as
|
|
1818
|
+
import { z as z8 } from "zod";
|
|
1778
1819
|
var C30 = Math.cos(Math.PI / 6);
|
|
1779
|
-
var iso = ([x, y,
|
|
1780
|
-
var depth = ([x, y,
|
|
1781
|
-
var Solid =
|
|
1782
|
-
|
|
1783
|
-
kind:
|
|
1784
|
-
id:
|
|
1785
|
-
name:
|
|
1820
|
+
var iso = ([x, y, z14]) => [(x - y) * C30, (x + y) * 0.5 - z14];
|
|
1821
|
+
var depth = ([x, y, z14]) => x + y + z14;
|
|
1822
|
+
var Solid = z8.discriminatedUnion("kind", [
|
|
1823
|
+
z8.object({
|
|
1824
|
+
kind: z8.literal("box"),
|
|
1825
|
+
id: z8.string(),
|
|
1826
|
+
name: z8.string().optional(),
|
|
1786
1827
|
position: vec(3).meta({ description: "Min corner [x, y, z] in model units." }),
|
|
1787
1828
|
size: vec(3).meta({ description: "[width x, depth y, height z]" })
|
|
1788
1829
|
}),
|
|
1789
|
-
|
|
1790
|
-
kind:
|
|
1791
|
-
id:
|
|
1792
|
-
name:
|
|
1830
|
+
z8.object({
|
|
1831
|
+
kind: z8.literal("cylinder"),
|
|
1832
|
+
id: z8.string(),
|
|
1833
|
+
name: z8.string().optional(),
|
|
1793
1834
|
base: vec(3).meta({ description: "Centre of the base circle." }),
|
|
1794
|
-
radius:
|
|
1795
|
-
length:
|
|
1796
|
-
axis:
|
|
1835
|
+
radius: z8.number().positive(),
|
|
1836
|
+
length: z8.number().positive(),
|
|
1837
|
+
axis: z8.enum(["x", "y", "z"]).default("z")
|
|
1797
1838
|
})
|
|
1798
1839
|
]);
|
|
1799
1840
|
function circle(c, r, axis, n2 = 48) {
|
|
@@ -1820,12 +1861,12 @@ function hull(pts2) {
|
|
|
1820
1861
|
}
|
|
1821
1862
|
function toShape(s) {
|
|
1822
1863
|
if (s.kind === "box") {
|
|
1823
|
-
const [x, y,
|
|
1824
|
-
const X = x + w, Y = y + d, Z =
|
|
1864
|
+
const [x, y, z14] = s.position, [w, d, h] = s.size;
|
|
1865
|
+
const X = x + w, Y = y + d, Z = z14 + h;
|
|
1825
1866
|
const top = [[x, y, Z], [X, y, Z], [X, Y, Z], [x, Y, Z]];
|
|
1826
|
-
const px = [[X, y,
|
|
1827
|
-
const py = [[x, Y,
|
|
1828
|
-
return { id: s.id, name: s.name, depth: depth([x + w / 2, y + d / 2,
|
|
1867
|
+
const px = [[X, y, z14], [X, Y, z14], [X, Y, Z], [X, y, Z]];
|
|
1868
|
+
const py = [[x, Y, z14], [X, Y, z14], [X, Y, Z], [x, Y, Z]];
|
|
1869
|
+
return { id: s.id, name: s.name, depth: depth([x + w / 2, y + d / 2, z14 + h / 2]), polys: [top, px, py] };
|
|
1829
1870
|
}
|
|
1830
1871
|
const { base: b, radius: r, length: L, axis } = s;
|
|
1831
1872
|
const end = axis === "z" ? [b[0], b[1], b[2] + L] : axis === "x" ? [b[0] + L, b[1], b[2]] : [b[0], b[1] + L, b[2]];
|
|
@@ -1850,12 +1891,12 @@ Perspective figures give an overall impression of a device. Build them from simp
|
|
|
1850
1891
|
toolDefinition4({
|
|
1851
1892
|
name: "project_solids",
|
|
1852
1893
|
description: "Draw an isometric line-art view of boxes and cylinders with hidden surfaces removed (painter's algorithm, white-filled faces). Fits into the usable area. Returns per-solid screen boxes and anchor points in mm.",
|
|
1853
|
-
inputSchema:
|
|
1854
|
-
layerId:
|
|
1855
|
-
layerName:
|
|
1856
|
-
solids:
|
|
1857
|
-
area:
|
|
1858
|
-
fill:
|
|
1894
|
+
inputSchema: z8.object({
|
|
1895
|
+
layerId: z8.string().default("body"),
|
|
1896
|
+
layerName: z8.string().default("Body"),
|
|
1897
|
+
solids: z8.array(Solid).min(1),
|
|
1898
|
+
area: z8.object({ x: z8.number(), y: z8.number(), w: z8.number(), h: z8.number() }).optional(),
|
|
1899
|
+
fill: z8.number().min(0.2).max(1).default(0.75).meta({ description: "Fraction of the area to fill." })
|
|
1859
1900
|
})
|
|
1860
1901
|
}).server(async ({ layerId: lid, layerName: lname, solids: rawSolids, area, fill = 0.75 }, ctx) => {
|
|
1861
1902
|
const layerId = lid ?? "body", layerName = lname ?? "Body";
|
|
@@ -1908,8 +1949,8 @@ Perspective figures give an overall impression of a device. Build them from simp
|
|
|
1908
1949
|
|
|
1909
1950
|
// ../../src/patent-render/server/skills/circuit.ts
|
|
1910
1951
|
import { toolDefinition as toolDefinition5 } from "@tanstack/ai";
|
|
1911
|
-
import { z as
|
|
1912
|
-
var Kind =
|
|
1952
|
+
import { z as z9 } from "zod";
|
|
1953
|
+
var Kind = z9.enum([
|
|
1913
1954
|
"resistor",
|
|
1914
1955
|
"capacitor",
|
|
1915
1956
|
"inductor",
|
|
@@ -2021,16 +2062,16 @@ function rot(p, deg) {
|
|
|
2021
2062
|
const [x, y] = p;
|
|
2022
2063
|
return r === 90 ? [-y, x] : r === 180 ? [-x, -y] : r === 270 ? [y, -x] : [x, y];
|
|
2023
2064
|
}
|
|
2024
|
-
var PlaceInput =
|
|
2025
|
-
layerId:
|
|
2026
|
-
components:
|
|
2027
|
-
id:
|
|
2065
|
+
var PlaceInput = z9.object({
|
|
2066
|
+
layerId: z9.string().default("components"),
|
|
2067
|
+
components: z9.array(z9.object({
|
|
2068
|
+
id: z9.string(),
|
|
2028
2069
|
kind: Kind,
|
|
2029
|
-
x:
|
|
2030
|
-
y:
|
|
2031
|
-
rotation:
|
|
2032
|
-
pinsPerSide:
|
|
2033
|
-
label:
|
|
2070
|
+
x: z9.number().meta({ description: "Position of the symbol origin (first pin for two-terminal parts)." }),
|
|
2071
|
+
y: z9.number(),
|
|
2072
|
+
rotation: z9.union([z9.literal(0), z9.literal(90), z9.literal(180), z9.literal(270)]).default(0),
|
|
2073
|
+
pinsPerSide: z9.number().int().min(1).max(12).optional().meta({ description: "For ic only." }),
|
|
2074
|
+
label: z9.string().optional().meta({ description: "Optional short label drawn next to the symbol (e.g. MCU for an ic)." })
|
|
2034
2075
|
})).min(1)
|
|
2035
2076
|
});
|
|
2036
2077
|
var circuitSkill = {
|
|
@@ -2093,7 +2134,7 @@ Draw schematics with place_component for each symbol, then wire pins with polyli
|
|
|
2093
2134
|
|
|
2094
2135
|
// ../../src/patent-render/server/skills/chemical.ts
|
|
2095
2136
|
import { toolDefinition as toolDefinition6 } from "@tanstack/ai";
|
|
2096
|
-
import { z as
|
|
2137
|
+
import { z as z10 } from "zod";
|
|
2097
2138
|
import { Molecule } from "openchemlib";
|
|
2098
2139
|
var BOND_MM = 16;
|
|
2099
2140
|
var LABEL_GAP = 2.4;
|
|
@@ -2186,14 +2227,14 @@ Draw chemical structures with draw_molecule from a SMILES string; do not hand-pl
|
|
|
2186
2227
|
toolDefinition6({
|
|
2187
2228
|
name: "draw_molecule",
|
|
2188
2229
|
description: "Draw a chemical structure from SMILES (skeletal formula, 2D coordinates from OpenChemLib). Returns the structure's bounding box in mm.",
|
|
2189
|
-
inputSchema:
|
|
2190
|
-
id:
|
|
2191
|
-
smiles:
|
|
2192
|
-
layerId:
|
|
2230
|
+
inputSchema: z10.object({
|
|
2231
|
+
id: z10.string(),
|
|
2232
|
+
smiles: z10.string(),
|
|
2233
|
+
layerId: z10.string().default("structures"),
|
|
2193
2234
|
centre: vec(2).optional().meta({ description: "Centre point in mm; defaults to the middle of the usable area." }),
|
|
2194
|
-
maxWidth:
|
|
2195
|
-
maxHeight:
|
|
2196
|
-
caption:
|
|
2235
|
+
maxWidth: z10.number().default(120),
|
|
2236
|
+
maxHeight: z10.number().default(110),
|
|
2237
|
+
caption: z10.string().optional().meta({ description: "Short identifier drawn below, e.g. (I)." })
|
|
2197
2238
|
})
|
|
2198
2239
|
}).server(async ({ id, smiles, layerId: layerIdIn, centre: centre2, maxWidth = 120, maxHeight = 110, caption }, ctx) => {
|
|
2199
2240
|
const layerId = layerIdIn ?? "structures";
|
|
@@ -2215,7 +2256,7 @@ Draw chemical structures with draw_molecule from a SMILES string; do not hand-pl
|
|
|
2215
2256
|
|
|
2216
2257
|
// ../../src/patent-render/server/skills/detail.ts
|
|
2217
2258
|
import { toolDefinition as toolDefinition7 } from "@tanstack/ai";
|
|
2218
|
-
import { z as
|
|
2259
|
+
import { z as z11 } from "zod";
|
|
2219
2260
|
|
|
2220
2261
|
// ../../src/patent-render/geometry/bezier.ts
|
|
2221
2262
|
var r3 = (n2) => Math.round(n2 * 1e3) / 1e3;
|
|
@@ -2352,7 +2393,7 @@ function mapItem(item, f, angleDeg = 0) {
|
|
|
2352
2393
|
return null;
|
|
2353
2394
|
}
|
|
2354
2395
|
}
|
|
2355
|
-
var Region =
|
|
2396
|
+
var Region = z11.object({ x: z11.number(), y: z11.number(), w: z11.number().positive(), h: z11.number().positive() });
|
|
2356
2397
|
var RENDERING_GUIDE = `
|
|
2357
2398
|
Rendering detail for perspective and product drawings (the look of formal US design/utility figures):
|
|
2358
2399
|
- Surface shading: a few thin (0.25 mm) parallel strokes, never fills or grey. Cylinders get vertical strokes bunched toward the shadow edge (shade kind "cylinder"). Glass and polished faces get 2-3 short parallel diagonal glare strokes (shade kind "glare"). Flat faces in shadow get sparse parallel strokes (kind "flat").
|
|
@@ -2371,15 +2412,15 @@ var detailSkill = {
|
|
|
2371
2412
|
toolDefinition7({
|
|
2372
2413
|
name: "array_items",
|
|
2373
2414
|
description: "Repeat existing items: linear (step dx, dy) or polar (rotate about a centre; squash < 1 foreshortens the circle into a perspective ellipse). Copies get ids <id>-1, <id>-2, ... Use for ticks, knurling, holes, teeth, buttons, stitching dots.",
|
|
2374
|
-
inputSchema:
|
|
2375
|
-
ids:
|
|
2376
|
-
count:
|
|
2377
|
-
mode:
|
|
2378
|
-
dx:
|
|
2379
|
-
dy:
|
|
2380
|
-
centre:
|
|
2381
|
-
stepDeg:
|
|
2382
|
-
squash:
|
|
2415
|
+
inputSchema: z11.object({
|
|
2416
|
+
ids: z11.array(z11.string()).min(1),
|
|
2417
|
+
count: z11.number().int().min(1).max(120).meta({ description: "Number of copies (excluding the original)." }),
|
|
2418
|
+
mode: z11.enum(["linear", "polar"]),
|
|
2419
|
+
dx: z11.number().optional(),
|
|
2420
|
+
dy: z11.number().optional(),
|
|
2421
|
+
centre: z11.array(z11.number()).length(2).optional().meta({ description: "Polar centre [x, y] in mm." }),
|
|
2422
|
+
stepDeg: z11.number().optional().meta({ description: "Polar angle between copies (default 360/(count+1))." }),
|
|
2423
|
+
squash: z11.number().min(0.1).max(1).optional().meta({ description: "Polar only: vertical scale of the circle (ry/rx) for perspective." })
|
|
2383
2424
|
})
|
|
2384
2425
|
}).server(async ({ ids, count, mode, dx = 0, dy = 0, centre: centre2, stepDeg, squash = 1 }, ctx) => {
|
|
2385
2426
|
const patches = [];
|
|
@@ -2417,17 +2458,17 @@ var detailSkill = {
|
|
|
2417
2458
|
toolDefinition7({
|
|
2418
2459
|
name: "graduations",
|
|
2419
2460
|
description: "Draw tick marks around a circle or perspective ellipse (bezels, dials, scales): radial ticks with longer major ticks, optional index triangle at 12 o'clock.",
|
|
2420
|
-
inputSchema:
|
|
2421
|
-
id:
|
|
2422
|
-
layerId:
|
|
2423
|
-
centre:
|
|
2424
|
-
radius:
|
|
2425
|
-
squash:
|
|
2426
|
-
count:
|
|
2427
|
-
length:
|
|
2428
|
-
majorEvery:
|
|
2429
|
-
majorLength:
|
|
2430
|
-
indexTriangle:
|
|
2461
|
+
inputSchema: z11.object({
|
|
2462
|
+
id: z11.string(),
|
|
2463
|
+
layerId: z11.string(),
|
|
2464
|
+
centre: z11.array(z11.number()).length(2),
|
|
2465
|
+
radius: z11.number().positive().meta({ description: "Outer radius (horizontal, mm)." }),
|
|
2466
|
+
squash: z11.number().min(0.1).max(1).default(1).meta({ description: "ry/rx for a perspective ellipse." }),
|
|
2467
|
+
count: z11.number().int().min(4).max(240).default(60),
|
|
2468
|
+
length: z11.number().positive().default(1.2),
|
|
2469
|
+
majorEvery: z11.number().int().min(0).default(5),
|
|
2470
|
+
majorLength: z11.number().positive().default(2.2),
|
|
2471
|
+
indexTriangle: z11.boolean().default(false)
|
|
2431
2472
|
})
|
|
2432
2473
|
}).server(async (raw, ctx) => {
|
|
2433
2474
|
const { id, layerId, centre: centre2, radius, squash = 1, count = 60, length = 1.2, majorEvery = 5, majorLength = 2.2, indexTriangle = false } = raw;
|
|
@@ -2459,14 +2500,14 @@ var detailSkill = {
|
|
|
2459
2500
|
toolDefinition7({
|
|
2460
2501
|
name: "shade",
|
|
2461
2502
|
description: "Add surface shading strokes in a region: 'cylinder' (vertical strokes bunched toward one side), 'glare' (2-3 short diagonal strokes for glass), 'flat' (sparse parallel strokes).",
|
|
2462
|
-
inputSchema:
|
|
2463
|
-
id:
|
|
2464
|
-
layerId:
|
|
2465
|
-
kind:
|
|
2503
|
+
inputSchema: z11.object({
|
|
2504
|
+
id: z11.string(),
|
|
2505
|
+
layerId: z11.string(),
|
|
2506
|
+
kind: z11.enum(["cylinder", "glare", "flat"]),
|
|
2466
2507
|
region: Region,
|
|
2467
|
-
side:
|
|
2468
|
-
count:
|
|
2469
|
-
angle:
|
|
2508
|
+
side: z11.enum(["left", "right"]).default("right").meta({ description: "Shadow side for cylinder/flat." }),
|
|
2509
|
+
count: z11.number().int().min(1).max(12).default(3),
|
|
2510
|
+
angle: z11.number().default(45).meta({ description: "Stroke angle for glare/flat, degrees." })
|
|
2470
2511
|
})
|
|
2471
2512
|
}).server(async (raw, ctx) => {
|
|
2472
2513
|
const { id, layerId, kind, region: b, side = "right", count = 3, angle = 45 } = raw;
|
|
@@ -2522,12 +2563,12 @@ function createDrawingTools(session, deps) {
|
|
|
2522
2563
|
const getDrawing = toolDefinition8({
|
|
2523
2564
|
name: "get_drawing",
|
|
2524
2565
|
description: "Return the current drawing: layers, items (id, type, bbox, key fields), numeral registry and selection. Call before editing an existing figure if unsure of ids or positions.",
|
|
2525
|
-
inputSchema:
|
|
2566
|
+
inputSchema: z12.object({})
|
|
2526
2567
|
}).server(async () => ({ drawing: describeDocument(session.doc, session.selection) }));
|
|
2527
2568
|
const planFigure = toolDefinition8({
|
|
2528
2569
|
name: "plan_figure",
|
|
2529
2570
|
description: "Plan a NEW figure before drawing it. Runs the prompt enhancer, which expands the user's request into a figure plan: figure type, view, components with reference numerals (reusing the application's registry), and the layer breakdown. Call once at the start of a new figure, not for small edits.",
|
|
2530
|
-
inputSchema:
|
|
2571
|
+
inputSchema: z12.object({ request: z12.string().meta({ description: "The user's request, plus anything relevant you know from the conversation." }) })
|
|
2531
2572
|
}).server(async ({ request }, ctx) => {
|
|
2532
2573
|
const emit = emitOf2(ctx);
|
|
2533
2574
|
session.status(emit, "enhancing", "Planning the figure");
|
|
@@ -2541,7 +2582,7 @@ function createDrawingTools(session, deps) {
|
|
|
2541
2582
|
const loadSkill = toolDefinition8({
|
|
2542
2583
|
name: "load_skill",
|
|
2543
2584
|
description: `Load drawing conventions and specialist tool guidance for a figure type. Types: ${SKILLS.filter((s) => s.types.length).map((s) => `${s.types.join("/")} (${s.title})`).join("; ")}.`,
|
|
2544
|
-
inputSchema:
|
|
2585
|
+
inputSchema: z12.object({ figureType: FigureType })
|
|
2545
2586
|
}).server(async ({ figureType }) => {
|
|
2546
2587
|
const s = skillFor(figureType);
|
|
2547
2588
|
return { skill: s.title, instructions: s.instructions };
|
|
@@ -2549,10 +2590,10 @@ function createDrawingTools(session, deps) {
|
|
|
2549
2590
|
const addLayer = toolDefinition8({
|
|
2550
2591
|
name: "add_layer",
|
|
2551
2592
|
description: "Create a layer. Layers group a component and its parts (e.g. 'Housing 202'). Later layers draw on top. Use stable, readable ids.",
|
|
2552
|
-
inputSchema:
|
|
2553
|
-
id:
|
|
2554
|
-
name:
|
|
2555
|
-
index:
|
|
2593
|
+
inputSchema: z12.object({
|
|
2594
|
+
id: z12.string(),
|
|
2595
|
+
name: z12.string(),
|
|
2596
|
+
index: z12.number().int().optional().meta({ description: "Z position; omit to put it on top." })
|
|
2556
2597
|
})
|
|
2557
2598
|
}).server(async ({ id, name, index }, ctx) => {
|
|
2558
2599
|
const layer = { id, name, visible: true, locked: false, items: [] };
|
|
@@ -2564,7 +2605,7 @@ function createDrawingTools(session, deps) {
|
|
|
2564
2605
|
const updateLayer = toolDefinition8({
|
|
2565
2606
|
name: "update_layer",
|
|
2566
2607
|
description: "Rename, hide/show or lock/unlock a layer.",
|
|
2567
|
-
inputSchema:
|
|
2608
|
+
inputSchema: z12.object({ id: z12.string(), name: z12.string().optional(), visible: z12.boolean().optional(), locked: z12.boolean().optional() })
|
|
2568
2609
|
}).server(async ({ id, ...changes }, ctx) => {
|
|
2569
2610
|
const err = session.apply({ op: "updateLayer", id, changes }, emitOf2(ctx));
|
|
2570
2611
|
return err ? { ok: false, error: err } : { ok: true };
|
|
@@ -2572,7 +2613,7 @@ function createDrawingTools(session, deps) {
|
|
|
2572
2613
|
const removeLayer = toolDefinition8({
|
|
2573
2614
|
name: "remove_layer",
|
|
2574
2615
|
description: "Delete a layer and everything on it.",
|
|
2575
|
-
inputSchema:
|
|
2616
|
+
inputSchema: z12.object({ id: z12.string() })
|
|
2576
2617
|
}).server(async ({ id }, ctx) => {
|
|
2577
2618
|
const err = session.apply({ op: "removeLayer", id }, emitOf2(ctx));
|
|
2578
2619
|
return err ? { ok: false, error: err } : { ok: true };
|
|
@@ -2580,7 +2621,7 @@ function createDrawingTools(session, deps) {
|
|
|
2580
2621
|
const addItems = toolDefinition8({
|
|
2581
2622
|
name: "add_items",
|
|
2582
2623
|
description: `Add drawing items to a layer. Give every item a unique, readable id (e.g. "housing-outer", "n102"). ${ITEM_FIELDS_HELP} Types: line{a,b} polyline{points,closed,fill} path{d,fill} rect{x,y,w,h,radius,fill} ellipse{cx,cy,rx,ry,fill} arc{cx,cy,r,start,end} text{x,y(baseline),text,size,anchor} numeral{n,at(label centre),target(point on the part),leader:curved|straight|none,underline} figLabel{x,y,size} connector{from:{itemId}|{point},to,routing:orthogonal|straight,arrow:end|start|both|none,label} hatch{points(closed outline),angle,spacing} sectionLine{a,b,label}.`,
|
|
2583
|
-
inputSchema:
|
|
2624
|
+
inputSchema: z12.object({ layerId: z12.string(), items: z12.array(Item).min(1) })
|
|
2584
2625
|
}).server(async ({ layerId, items: raw }, ctx) => {
|
|
2585
2626
|
const emit = emitOf2(ctx);
|
|
2586
2627
|
const items = raw.map((i) => Item.parse(i));
|
|
@@ -2592,8 +2633,8 @@ function createDrawingTools(session, deps) {
|
|
|
2592
2633
|
const updateItems = toolDefinition8({
|
|
2593
2634
|
name: "update_items",
|
|
2594
2635
|
description: `Change fields of existing items by id (partial updates; type and id cannot change). ${ITEM_FIELDS_HELP}`,
|
|
2595
|
-
inputSchema:
|
|
2596
|
-
updates:
|
|
2636
|
+
inputSchema: z12.object({
|
|
2637
|
+
updates: z12.array(z12.object({ id: z12.string(), changes: z12.record(z12.string(), z12.unknown()) })).min(1)
|
|
2597
2638
|
})
|
|
2598
2639
|
}).server(async ({ updates }, ctx) => {
|
|
2599
2640
|
const r = session.applyMany(updates.map((u) => ({ op: "updateItem", id: u.id, changes: u.changes })), emitOf2(ctx));
|
|
@@ -2602,7 +2643,7 @@ function createDrawingTools(session, deps) {
|
|
|
2602
2643
|
const removeItems = toolDefinition8({
|
|
2603
2644
|
name: "remove_items",
|
|
2604
2645
|
description: "Delete items by id.",
|
|
2605
|
-
inputSchema:
|
|
2646
|
+
inputSchema: z12.object({ ids: z12.array(z12.string()).min(1) })
|
|
2606
2647
|
}).server(async ({ ids }, ctx) => {
|
|
2607
2648
|
const r = session.applyMany(ids.map((id) => ({ op: "removeItem", id })), emitOf2(ctx));
|
|
2608
2649
|
return { ok: r.errors.length === 0, removed: r.accepted, ...r.errors.length ? { errors: r.errors } : {} };
|
|
@@ -2610,7 +2651,7 @@ function createDrawingTools(session, deps) {
|
|
|
2610
2651
|
const moveItems = toolDefinition8({
|
|
2611
2652
|
name: "move_items",
|
|
2612
2653
|
description: "Move items to another layer (or reorder within a layer with toIndex).",
|
|
2613
|
-
inputSchema:
|
|
2654
|
+
inputSchema: z12.object({ ids: z12.array(z12.string()).min(1), toLayerId: z12.string(), toIndex: z12.number().int().optional() })
|
|
2614
2655
|
}).server(async ({ ids, toLayerId, toIndex }, ctx) => {
|
|
2615
2656
|
const r = session.applyMany(ids.map((id) => ({ op: "moveItem", id, toLayerId, toIndex })), emitOf2(ctx));
|
|
2616
2657
|
return { ok: r.errors.length === 0, moved: r.accepted, ...r.errors.length ? { errors: r.errors } : {} };
|
|
@@ -2618,7 +2659,7 @@ function createDrawingTools(session, deps) {
|
|
|
2618
2659
|
const setNumerals = toolDefinition8({
|
|
2619
2660
|
name: "set_numerals",
|
|
2620
2661
|
description: "Add or update reference numeral descriptions in the registry (shared with the specification). Use null to remove. Every numeral drawn must be described.",
|
|
2621
|
-
inputSchema:
|
|
2662
|
+
inputSchema: z12.object({ entries: z12.array(z12.object({ n: z12.string(), label: z12.string().nullable() })).min(1) })
|
|
2622
2663
|
}).server(async ({ entries }, ctx) => {
|
|
2623
2664
|
const r = session.applyMany(entries.map((e) => ({ op: "setNumeral", n: e.n, label: e.label })), emitOf2(ctx));
|
|
2624
2665
|
return { ok: true, updated: r.accepted };
|
|
@@ -2626,7 +2667,7 @@ function createDrawingTools(session, deps) {
|
|
|
2626
2667
|
const setSheet = toolDefinition8({
|
|
2627
2668
|
name: "set_sheet",
|
|
2628
2669
|
description: "Change sheet size or orientation. Prefer portrait; use landscape only for wide figures.",
|
|
2629
|
-
inputSchema:
|
|
2670
|
+
inputSchema: z12.object({ size: z12.enum(["a4", "letter"]).optional(), orientation: z12.enum(["portrait", "landscape"]).optional() })
|
|
2630
2671
|
}).server(async ({ size, orientation }, ctx) => {
|
|
2631
2672
|
const sheet = { ...session.doc.sheet, ...size ? { size } : {}, ...orientation ? { orientation } : {} };
|
|
2632
2673
|
const err = session.apply({ op: "setSheet", sheet }, emitOf2(ctx));
|
|
@@ -2635,7 +2676,7 @@ function createDrawingTools(session, deps) {
|
|
|
2635
2676
|
const checkCompliance = toolDefinition8({
|
|
2636
2677
|
name: "check_compliance",
|
|
2637
2678
|
description: "Run the deterministic patent-office rule check on the whole figure. Errors must be fixed before you finish; warnings should be fixed when reasonable.",
|
|
2638
|
-
inputSchema:
|
|
2679
|
+
inputSchema: z12.object({})
|
|
2639
2680
|
}).server(async () => {
|
|
2640
2681
|
const r = session.report();
|
|
2641
2682
|
return { ok: r.ok, errors: summariseIssues(r.errors), warnings: summariseIssues(r.warnings) };
|
|
@@ -2643,7 +2684,7 @@ function createDrawingTools(session, deps) {
|
|
|
2643
2684
|
const reviewDrawing = toolDefinition8({
|
|
2644
2685
|
name: "review_drawing",
|
|
2645
2686
|
description: "Render the figure and have a reviewer look at it for visual problems (overlaps, crossing leaders, cramped or unbalanced layout, missing parts from the plan). Use after the initial drawing is complete and compliance is clean; not needed for small edits.",
|
|
2646
|
-
inputSchema:
|
|
2687
|
+
inputSchema: z12.object({ focus: z12.string().optional().meta({ description: "Optional area to scrutinise." }) })
|
|
2647
2688
|
}).server(async ({ focus }, ctx) => {
|
|
2648
2689
|
if (session.reviews >= deps.maxReviews) {
|
|
2649
2690
|
return { ok: true, verdict: "ok", findings: [], note: "Review budget used. Finish now." };
|
|
@@ -2659,11 +2700,11 @@ function createDrawingTools(session, deps) {
|
|
|
2659
2700
|
const setExplodedView = toolDefinition8({
|
|
2660
2701
|
name: "set_exploded_view",
|
|
2661
2702
|
description: "Switch between the composite (assembled) and exploded view of the same model. Each component layer has an explode offset; numerals follow the part their leader touches and dash-dot alignment lines are drawn. Use auto with an axis to spread parts automatically, or give explicit offsets (mm) per layer.",
|
|
2662
|
-
inputSchema:
|
|
2663
|
-
view:
|
|
2664
|
-
auto:
|
|
2665
|
-
offsets:
|
|
2666
|
-
alignmentLines:
|
|
2703
|
+
inputSchema: z12.object({
|
|
2704
|
+
view: z12.enum(["composite", "exploded"]),
|
|
2705
|
+
auto: z12.enum(["x", "y"]).optional().meta({ description: "Spread component layers along this axis." }),
|
|
2706
|
+
offsets: z12.array(z12.object({ layerId: z12.string(), dx: z12.number(), dy: z12.number() })).optional(),
|
|
2707
|
+
alignmentLines: z12.boolean().optional()
|
|
2667
2708
|
})
|
|
2668
2709
|
}).server(async ({ view, auto, offsets, alignmentLines }, ctx) => {
|
|
2669
2710
|
const patches = [];
|
|
@@ -2712,9 +2753,47 @@ ${ctx.specExcerpt.slice(0, 12e3)}`);
|
|
|
2712
2753
|
if (reg.length) parts.push(`Reference numerals already used in the application: ${reg.map(([k, v]) => `${k} ${v}`).join("; ")}`);
|
|
2713
2754
|
return parts.join("\n\n") || "No application context was provided.";
|
|
2714
2755
|
}
|
|
2715
|
-
|
|
2756
|
+
var NEW_FIGURE = `This is a NEW figure.
|
|
2757
|
+
1. Call plan_figure with the user's request (include relevant claim language). The plan fixes the figure type, view, components and numerals, and its "spec" is your blueprint: follow its proportions, counts and placements exactly.
|
|
2758
|
+
2. Call load_skill for the plan's figure type and follow its conventions.
|
|
2759
|
+
3. Draw: create the plan's layers, then the geometry, then reference numerals and set_numerals for every numeral.
|
|
2760
|
+
4. Call check_compliance and fix every error (and warnings where reasonable).
|
|
2761
|
+
5. Call review_drawing once; apply its fixes; review a second time only if the first review found real problems.
|
|
2762
|
+
6. Finish with a short plain-text message (at most 3 sentences, no markdown, no lists) saying what the figure shows and anything the user should check.`;
|
|
2763
|
+
var EDIT_FIGURE = `This figure already has content, possibly edited by hand. Treat the request as an EDIT.
|
|
2764
|
+
- Make targeted changes with update_items / add_items / remove_items / move_items. Never redraw the figure from scratch unless explicitly asked.
|
|
2765
|
+
- Preserve manual edits: do not move or restyle items the request does not concern.
|
|
2766
|
+
- If the user has a selection, "this", "these" and "it" refer to the selected items.
|
|
2767
|
+
- Call get_drawing if you need fresh positions after several edits. Call load_skill if you need conventions for an unfamiliar figure type.
|
|
2768
|
+
- Run check_compliance after edits; review_drawing is optional for small edits.
|
|
2769
|
+
- Finish with one plain-text sentence describing the change (no markdown).`;
|
|
2770
|
+
function howToWork(doc, resume) {
|
|
2771
|
+
if (!resume) return isNewFigure(doc) ? NEW_FIGURE : EDIT_FIGURE;
|
|
2772
|
+
const background = [
|
|
2773
|
+
`The user's original request: ${JSON.stringify(resume.request)}`,
|
|
2774
|
+
resume.steps.length ? `Steps reached before it was interrupted: ${resume.steps.join("; ")}` : "",
|
|
2775
|
+
resume.plan ? `The figure plan:
|
|
2776
|
+
${JSON.stringify(resume.plan, null, 1)}` : ""
|
|
2777
|
+
].filter(Boolean).join("\n");
|
|
2778
|
+
if (resume.kind === "edit") {
|
|
2779
|
+
return `${EDIT_FIGURE}
|
|
2780
|
+
|
|
2781
|
+
The edit was interrupted partway. Finish it; do not repeat changes already visible in the figure listing above.
|
|
2782
|
+
${background}`;
|
|
2783
|
+
}
|
|
2784
|
+
return `This figure was interrupted before it was finished. CONTINUE it from where it stopped; do not start again.
|
|
2785
|
+
${background}
|
|
2786
|
+
|
|
2787
|
+
1. ${resume.plan ? 'Do not call plan_figure: the plan above still applies and its "spec" is your blueprint.' : "Call plan_figure with the original request, since the plan was lost."}
|
|
2788
|
+
2. Call load_skill for the plan's figure type and follow its conventions.
|
|
2789
|
+
3. Compare the plan with the figure listing above. Items listed there are done, possibly edited by hand: keep them, do not add them again under new ids. The last step may have been cut off partway.
|
|
2790
|
+
4. Draw only what is missing: layers, geometry, then reference numerals and set_numerals.
|
|
2791
|
+
5. Call check_compliance and fix every error (and warnings where reasonable).
|
|
2792
|
+
6. Call review_drawing once; apply its fixes; review a second time only if the first review found real problems.
|
|
2793
|
+
7. Finish with a short plain-text message (at most 3 sentences, no markdown, no lists) saying what the figure shows and anything the user should check.`;
|
|
2794
|
+
}
|
|
2795
|
+
function drawerSystemPrompt(doc, selection, ctx, prefs, resume) {
|
|
2716
2796
|
const p = PROFILES[doc.jurisdiction];
|
|
2717
|
-
const isEmpty = doc.layers.every((l) => l.items.every((i) => i.type === "figLabel"));
|
|
2718
2797
|
return `
|
|
2719
2798
|
You are a patent draftsperson. You produce formal patent drawings as editable vector line art by calling tools. Everything you draw appears live on the user's canvas, layer by layer.
|
|
2720
2799
|
|
|
@@ -2728,19 +2807,7 @@ ${contextBlock(ctx)}
|
|
|
2728
2807
|
${preferencesBlock(prefs)}
|
|
2729
2808
|
|
|
2730
2809
|
# How to work
|
|
2731
|
-
${
|
|
2732
|
-
1. Call plan_figure with the user's request (include relevant claim language). The plan fixes the figure type, view, components and numerals, and its "spec" is your blueprint: follow its proportions, counts and placements exactly.
|
|
2733
|
-
2. Call load_skill for the plan's figure type and follow its conventions.
|
|
2734
|
-
3. Draw: create the plan's layers, then the geometry, then reference numerals and set_numerals for every numeral.
|
|
2735
|
-
4. Call check_compliance and fix every error (and warnings where reasonable).
|
|
2736
|
-
5. Call review_drawing once; apply its fixes; review a second time only if the first review found real problems.
|
|
2737
|
-
6. Finish with a short plain-text message (at most 3 sentences, no markdown, no lists) saying what the figure shows and anything the user should check.` : `This figure already has content, possibly edited by hand. Treat the request as an EDIT.
|
|
2738
|
-
- Make targeted changes with update_items / add_items / remove_items / move_items. Never redraw the figure from scratch unless explicitly asked.
|
|
2739
|
-
- Preserve manual edits: do not move or restyle items the request does not concern.
|
|
2740
|
-
- If the user has a selection, "this", "these" and "it" refer to the selected items.
|
|
2741
|
-
- Call get_drawing if you need fresh positions after several edits. Call load_skill if you need conventions for an unfamiliar figure type.
|
|
2742
|
-
- Run check_compliance after edits; review_drawing is optional for small edits.
|
|
2743
|
-
- Finish with one plain-text sentence describing the change (no markdown).`}
|
|
2810
|
+
${howToWork(doc, resume)}
|
|
2744
2811
|
|
|
2745
2812
|
# Drawing rules (${p.name}, ${p.citation})
|
|
2746
2813
|
- Black line art only. No colour, no grey, no shading except hatching for cut sections. Fill is none, white (to occlude) or black (very thin parts only).
|
|
@@ -2813,7 +2880,7 @@ Return verdict "ok" when nothing important needs fixing (minor nitpicks don't co
|
|
|
2813
2880
|
|
|
2814
2881
|
// ../../src/patent-render/server/agents.ts
|
|
2815
2882
|
import { chat } from "@tanstack/ai";
|
|
2816
|
-
import { z as
|
|
2883
|
+
import { z as z13 } from "zod";
|
|
2817
2884
|
|
|
2818
2885
|
// ../../src/patent-render/server/png.ts
|
|
2819
2886
|
import { Resvg } from "@resvg/resvg-js";
|
|
@@ -3110,12 +3177,12 @@ function renderPng(doc, opts = {}) {
|
|
|
3110
3177
|
}
|
|
3111
3178
|
|
|
3112
3179
|
// ../../src/patent-render/server/agents.ts
|
|
3113
|
-
var Review =
|
|
3114
|
-
verdict:
|
|
3115
|
-
findings:
|
|
3116
|
-
issue:
|
|
3117
|
-
itemIds:
|
|
3118
|
-
fix:
|
|
3180
|
+
var Review = z13.object({
|
|
3181
|
+
verdict: z13.enum(["ok", "revise"]),
|
|
3182
|
+
findings: z13.array(z13.object({
|
|
3183
|
+
issue: z13.string(),
|
|
3184
|
+
itemIds: z13.array(z13.string()).default([]),
|
|
3185
|
+
fix: z13.string().meta({ description: "Concrete instruction, e.g. 'move n204 label to (186, 80)'." })
|
|
3119
3186
|
})).max(8)
|
|
3120
3187
|
});
|
|
3121
3188
|
async function runPlanner(adapter, session, request, o) {
|
|
@@ -3192,6 +3259,8 @@ function createPatentRenderHandler(config = {}) {
|
|
|
3192
3259
|
attachments: latestAttachments(params.messages),
|
|
3193
3260
|
prefs: GenerationPrefs.safeParse(body.preferences ?? {}).data
|
|
3194
3261
|
});
|
|
3262
|
+
const resume = RunResume.safeParse(body.resume).data;
|
|
3263
|
+
if (resume?.plan) session.plan = resume.plan;
|
|
3195
3264
|
let models;
|
|
3196
3265
|
try {
|
|
3197
3266
|
models = { drawer: drawer(), planner: planner(), critic: critic() };
|
|
@@ -3211,7 +3280,7 @@ function createPatentRenderHandler(config = {}) {
|
|
|
3211
3280
|
adapter: models.drawer,
|
|
3212
3281
|
messages: params.messages,
|
|
3213
3282
|
threadId: params.threadId,
|
|
3214
|
-
systemPrompts: [drawerSystemPrompt(session.doc, session.selection, session.context, session.prefs)],
|
|
3283
|
+
systemPrompts: [drawerSystemPrompt(session.doc, session.selection, session.context, session.prefs, resume)],
|
|
3215
3284
|
tools,
|
|
3216
3285
|
agentLoopStrategy: maxIterations(config.maxTurns ?? 40),
|
|
3217
3286
|
abortController,
|