@esheet/builder 0.0.4-0 → 0.0.4-1
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/dist/index.d.ts +16 -417
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +115 -115
- package/dist/lib/EsheetBuilder.d.ts +46 -0
- package/dist/lib/EsheetBuilder.d.ts.map +1 -0
- package/dist/lib/EsheetBuilder.js +111 -0
- package/dist/lib/builder-tools.d.ts +107 -0
- package/dist/lib/builder-tools.d.ts.map +1 -0
- package/dist/lib/builder-tools.js +321 -0
- package/dist/lib/components/BuilderHeader.d.ts +7 -0
- package/dist/lib/components/BuilderHeader.d.ts.map +1 -0
- package/dist/lib/components/BuilderHeader.js +390 -0
- package/dist/lib/components/Canvas.d.ts +12 -0
- package/dist/lib/components/Canvas.d.ts.map +1 -0
- package/dist/lib/components/Canvas.js +288 -0
- package/dist/lib/components/CodeView.d.ts +12 -0
- package/dist/lib/components/CodeView.d.ts.map +1 -0
- package/dist/lib/components/CodeView.js +197 -0
- package/dist/lib/components/FeedbackModal.d.ts +23 -0
- package/dist/lib/components/FeedbackModal.d.ts.map +1 -0
- package/dist/lib/components/FeedbackModal.js +22 -0
- package/dist/lib/components/FieldWrapper.d.ts +53 -0
- package/dist/lib/components/FieldWrapper.d.ts.map +1 -0
- package/dist/lib/components/FieldWrapper.js +152 -0
- package/dist/lib/components/MobileBottomDrawer.d.ts +9 -0
- package/dist/lib/components/MobileBottomDrawer.d.ts.map +1 -0
- package/dist/lib/components/MobileBottomDrawer.js +6 -0
- package/dist/lib/components/ToolPanel.d.ts +11 -0
- package/dist/lib/components/ToolPanel.d.ts.map +1 -0
- package/dist/lib/components/ToolPanel.js +117 -0
- package/dist/lib/components/edit-panel/CommonEditor.d.ts +16 -0
- package/dist/lib/components/edit-panel/CommonEditor.d.ts.map +1 -0
- package/dist/lib/components/edit-panel/CommonEditor.js +16 -0
- package/dist/lib/components/edit-panel/DraftIdEditor.d.ts +16 -0
- package/dist/lib/components/edit-panel/DraftIdEditor.d.ts.map +1 -0
- package/dist/lib/components/edit-panel/DraftIdEditor.js +32 -0
- package/dist/lib/components/edit-panel/EditPanel.d.ts +10 -0
- package/dist/lib/components/edit-panel/EditPanel.d.ts.map +1 -0
- package/dist/lib/components/edit-panel/EditPanel.js +156 -0
- package/dist/lib/components/edit-panel/InputTypeEditor.d.ts +16 -0
- package/dist/lib/components/edit-panel/InputTypeEditor.d.ts.map +1 -0
- package/dist/lib/components/edit-panel/InputTypeEditor.js +32 -0
- package/dist/lib/components/edit-panel/LogicEditor.d.ts +15 -0
- package/dist/lib/components/edit-panel/LogicEditor.d.ts.map +1 -0
- package/dist/lib/components/edit-panel/LogicEditor.js +392 -0
- package/dist/lib/components/edit-panel/MatrixEditor.d.ts +12 -0
- package/dist/lib/components/edit-panel/MatrixEditor.d.ts.map +1 -0
- package/dist/lib/components/edit-panel/MatrixEditor.js +32 -0
- package/dist/lib/components/edit-panel/OptionListEditor.d.ts +14 -0
- package/dist/lib/components/edit-panel/OptionListEditor.d.ts.map +1 -0
- package/dist/lib/components/edit-panel/OptionListEditor.js +27 -0
- package/dist/lib/hooks/useFormApi.d.ts +55 -0
- package/dist/lib/hooks/useFormApi.d.ts.map +1 -0
- package/dist/lib/hooks/useFormApi.js +80 -0
- package/dist/lib/hooks/useUiApi.d.ts +22 -0
- package/dist/lib/hooks/useUiApi.d.ts.map +1 -0
- package/dist/lib/hooks/useUiApi.js +37 -0
- package/dist/lib/hooks/useVisibleRootIds.d.ts +11 -0
- package/dist/lib/hooks/useVisibleRootIds.d.ts.map +1 -0
- package/dist/lib/hooks/useVisibleRootIds.js +32 -0
- package/dist/lib/icons.d.ts +31 -0
- package/dist/lib/icons.d.ts.map +1 -0
- package/dist/lib/icons.js +47 -0
- package/dist/lib/mcp/index.d.ts +7 -0
- package/dist/lib/mcp/index.d.ts.map +1 -0
- package/dist/lib/mcp/index.js +4 -0
- package/dist/lib/mcp/system-prompt.d.ts +2 -0
- package/dist/lib/mcp/system-prompt.d.ts.map +1 -0
- package/dist/lib/mcp/system-prompt.js +9 -0
- package/dist/lib/mcp/tool-definitions.d.ts +10 -0
- package/dist/lib/mcp/tool-definitions.d.ts.map +1 -0
- package/dist/lib/mcp/tool-definitions.js +436 -0
- package/dist/lib/mcp/tool-executor.d.ts +5 -0
- package/dist/lib/mcp/tool-executor.d.ts.map +1 -0
- package/dist/lib/mcp/tool-executor.js +482 -0
- package/dist/lib/mcp/useBuilderToolBridge.d.ts +31 -0
- package/dist/lib/mcp/useBuilderToolBridge.d.ts.map +1 -0
- package/dist/lib/mcp/useBuilderToolBridge.js +56 -0
- package/dist/lib/register-defaults.d.ts +2 -0
- package/dist/lib/register-defaults.d.ts.map +1 -0
- package/dist/lib/register-defaults.js +37 -0
- package/package.json +4 -4
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
export const BUILDER_TOOL_DEFINITIONS = [
|
|
2
|
+
{
|
|
3
|
+
type: 'function',
|
|
4
|
+
function: {
|
|
5
|
+
name: 'get_form_summary',
|
|
6
|
+
description: 'CALL THIS FIRST. Returns {formId, fieldCount, fields} where each field has: id, fieldType, question, required, optionCount, rowCount, columnCount, editWith, hasRules, hasValue. Use get_field for full option/row/column values when needed.',
|
|
7
|
+
parameters: { type: 'object', properties: {} },
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
type: 'function',
|
|
12
|
+
function: {
|
|
13
|
+
name: 'fill_field',
|
|
14
|
+
description: 'Set a preview response for ONE field. Returns { result, filledCount, unfilledFields } where unfilledFields contains ONLY the fields still needing values (with full details). You are done when unfilledFields is empty.\n\nField type rules:\n- radio/dropdown/boolean/rating/slider: single string matching an option value\n- check/multiselectdropdown: array of strings matching option values\n- ranking: ordered array of option value strings\n- multitext: array of strings, one per option slot\n- singlematrix: { "Row Label": "Column Label" } — call once per row, calls accumulate\n- multimatrix: { "Row Label": ["Col1", "Col2"] }\n- text: use the valueFormat from the field schema (YYYY-MM-DD for date, YYYY-MM-DDTHH:mm for datetime-local, YYYY-MM for month, HH:mm for time). Wrong formats are rejected with an error.',
|
|
15
|
+
parameters: {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
fieldQuestion: { type: 'string' },
|
|
19
|
+
fieldId: { type: 'string' },
|
|
20
|
+
value: {},
|
|
21
|
+
},
|
|
22
|
+
required: ['value'],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'function',
|
|
28
|
+
function: {
|
|
29
|
+
name: 'clear_responses',
|
|
30
|
+
description: 'Clear all responses.',
|
|
31
|
+
parameters: { type: 'object', properties: {} },
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: 'function',
|
|
36
|
+
function: {
|
|
37
|
+
name: 'get_responses',
|
|
38
|
+
description: 'Get current response values.',
|
|
39
|
+
parameters: { type: 'object', properties: {} },
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: 'function',
|
|
44
|
+
function: {
|
|
45
|
+
name: 'reset_form',
|
|
46
|
+
description: 'Clear all fields.',
|
|
47
|
+
parameters: { type: 'object', properties: {} },
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: 'function',
|
|
52
|
+
function: {
|
|
53
|
+
name: 'create_field',
|
|
54
|
+
description: 'Add one field. fieldType: text|longtext|radio|check|boolean|dropdown|multiselectdropdown|rating|ranking|slider|section|html|display|image|signature|diagram. properties: {inputType,unit,min,max,step}. Pass parentId to place the field directly inside a section. For "html" fields: set properties.htmlContent to a raw HTML string (e.g. "<p>Your message</p>") — do NOT use "question". For "display" fields: set properties.content to a markdown/formula string that may embed field values using {fieldId} syntax (e.g. "Your score is **{score-field}**") — do NOT use "question". For "section" fields: use properties.title instead of question.',
|
|
55
|
+
parameters: {
|
|
56
|
+
type: 'object',
|
|
57
|
+
properties: {
|
|
58
|
+
fieldType: { type: 'string' },
|
|
59
|
+
question: { type: 'string' },
|
|
60
|
+
required: { type: 'boolean' },
|
|
61
|
+
options: {
|
|
62
|
+
type: 'array',
|
|
63
|
+
items: {
|
|
64
|
+
type: 'object',
|
|
65
|
+
properties: { value: { type: 'string' } },
|
|
66
|
+
required: ['value'],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
afterFieldId: { type: 'string' },
|
|
70
|
+
parentId: {
|
|
71
|
+
type: 'string',
|
|
72
|
+
description: 'ID of a section field to place this field inside.',
|
|
73
|
+
},
|
|
74
|
+
properties: { type: 'object', additionalProperties: true },
|
|
75
|
+
},
|
|
76
|
+
required: ['fieldType', 'question'],
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
type: 'function',
|
|
82
|
+
function: {
|
|
83
|
+
name: 'update_field',
|
|
84
|
+
description: 'Change scalar field properties (question, required, inputType, min, max, step, placeholder). Do NOT pass rows or columns here — use add_row/add_column instead. Identify by fieldQuestion or fieldId.',
|
|
85
|
+
parameters: {
|
|
86
|
+
type: 'object',
|
|
87
|
+
properties: {
|
|
88
|
+
fieldQuestion: { type: 'string' },
|
|
89
|
+
fieldId: { type: 'string' },
|
|
90
|
+
updates: { type: 'object', additionalProperties: true },
|
|
91
|
+
},
|
|
92
|
+
required: ['updates'],
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
type: 'function',
|
|
98
|
+
function: {
|
|
99
|
+
name: 'delete_field',
|
|
100
|
+
description: 'Delete a field by fieldQuestion or fieldId.',
|
|
101
|
+
parameters: {
|
|
102
|
+
type: 'object',
|
|
103
|
+
properties: {
|
|
104
|
+
fieldQuestion: { type: 'string' },
|
|
105
|
+
fieldId: { type: 'string' },
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
type: 'function',
|
|
112
|
+
function: {
|
|
113
|
+
name: 'add_option',
|
|
114
|
+
description: 'Add an option to a radio, check, boolean, dropdown, multiselectdropdown, rating, ranking, slider, or multitext field. NOT for singlematrix/multimatrix — those use add_column or add_row. If you are unsure of the field type, call get_form_summary first.',
|
|
115
|
+
parameters: {
|
|
116
|
+
type: 'object',
|
|
117
|
+
properties: {
|
|
118
|
+
fieldQuestion: { type: 'string' },
|
|
119
|
+
fieldId: { type: 'string' },
|
|
120
|
+
value: { type: 'string' },
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
type: 'function',
|
|
127
|
+
function: {
|
|
128
|
+
name: 'update_option',
|
|
129
|
+
description: 'Update the label of an existing option on radio, check, dropdown, etc. NOT for singlematrix/multimatrix — use update_column or update_row instead. If you are unsure of the field type, call get_form_summary first. Use optionId from get_field, or currentValue to match by current label.',
|
|
130
|
+
parameters: {
|
|
131
|
+
type: 'object',
|
|
132
|
+
properties: {
|
|
133
|
+
fieldQuestion: { type: 'string' },
|
|
134
|
+
fieldId: { type: 'string' },
|
|
135
|
+
optionId: { type: 'string' },
|
|
136
|
+
currentValue: {
|
|
137
|
+
type: 'string',
|
|
138
|
+
description: 'Current label to match if optionId unknown',
|
|
139
|
+
},
|
|
140
|
+
value: { type: 'string' },
|
|
141
|
+
},
|
|
142
|
+
required: ['value'],
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
type: 'function',
|
|
148
|
+
function: {
|
|
149
|
+
name: 'remove_option',
|
|
150
|
+
description: 'Remove an option from a radio, check, dropdown, etc. by its ID or current label. NOT for singlematrix/multimatrix — use remove_column or remove_row instead. If you are unsure of the field type, call get_form_summary first.',
|
|
151
|
+
parameters: {
|
|
152
|
+
type: 'object',
|
|
153
|
+
properties: {
|
|
154
|
+
fieldQuestion: { type: 'string' },
|
|
155
|
+
fieldId: { type: 'string' },
|
|
156
|
+
optionId: { type: 'string' },
|
|
157
|
+
currentValue: {
|
|
158
|
+
type: 'string',
|
|
159
|
+
description: 'Current label to match if optionId unknown',
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
type: 'function',
|
|
167
|
+
function: {
|
|
168
|
+
name: 'get_field',
|
|
169
|
+
description: 'Get full details of one field including its options/rows/columns with their IDs.',
|
|
170
|
+
parameters: {
|
|
171
|
+
type: 'object',
|
|
172
|
+
properties: {
|
|
173
|
+
fieldQuestion: { type: 'string' },
|
|
174
|
+
fieldId: { type: 'string' },
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
type: 'function',
|
|
181
|
+
function: {
|
|
182
|
+
name: 'move_field',
|
|
183
|
+
description: 'Reorder a field to a new index position (0-based). Use get_form_summary to see current order.',
|
|
184
|
+
parameters: {
|
|
185
|
+
type: 'object',
|
|
186
|
+
properties: {
|
|
187
|
+
fieldQuestion: { type: 'string' },
|
|
188
|
+
fieldId: { type: 'string' },
|
|
189
|
+
toIndex: { type: 'number', description: '0-based target position' },
|
|
190
|
+
toParentId: {
|
|
191
|
+
type: 'string',
|
|
192
|
+
description: 'Parent section ID, or omit for root',
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
required: ['toIndex'],
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
type: 'function',
|
|
201
|
+
function: {
|
|
202
|
+
name: 'add_row',
|
|
203
|
+
description: 'Add a row to a matrix field (singlematrix/multimatrix).',
|
|
204
|
+
parameters: {
|
|
205
|
+
type: 'object',
|
|
206
|
+
properties: {
|
|
207
|
+
fieldQuestion: { type: 'string' },
|
|
208
|
+
fieldId: { type: 'string' },
|
|
209
|
+
value: { type: 'string' },
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
type: 'function',
|
|
216
|
+
function: {
|
|
217
|
+
name: 'update_row',
|
|
218
|
+
description: 'Update a matrix row label. Use rowId from get_field, or currentValue to match by current label.',
|
|
219
|
+
parameters: {
|
|
220
|
+
type: 'object',
|
|
221
|
+
properties: {
|
|
222
|
+
fieldQuestion: { type: 'string' },
|
|
223
|
+
fieldId: { type: 'string' },
|
|
224
|
+
rowId: { type: 'string' },
|
|
225
|
+
currentValue: {
|
|
226
|
+
type: 'string',
|
|
227
|
+
description: 'Current label to match if rowId unknown',
|
|
228
|
+
},
|
|
229
|
+
value: { type: 'string' },
|
|
230
|
+
},
|
|
231
|
+
required: ['value'],
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
type: 'function',
|
|
237
|
+
function: {
|
|
238
|
+
name: 'remove_row',
|
|
239
|
+
description: 'Remove a matrix row by its ID.',
|
|
240
|
+
parameters: {
|
|
241
|
+
type: 'object',
|
|
242
|
+
properties: {
|
|
243
|
+
fieldQuestion: { type: 'string' },
|
|
244
|
+
fieldId: { type: 'string' },
|
|
245
|
+
rowId: { type: 'string' },
|
|
246
|
+
},
|
|
247
|
+
required: ['rowId'],
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
type: 'function',
|
|
253
|
+
function: {
|
|
254
|
+
name: 'add_column',
|
|
255
|
+
description: 'Add a column to a matrix field.',
|
|
256
|
+
parameters: {
|
|
257
|
+
type: 'object',
|
|
258
|
+
properties: {
|
|
259
|
+
fieldQuestion: { type: 'string' },
|
|
260
|
+
fieldId: { type: 'string' },
|
|
261
|
+
value: { type: 'string' },
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
type: 'function',
|
|
268
|
+
function: {
|
|
269
|
+
name: 'update_column',
|
|
270
|
+
description: 'Update a matrix column label. Use columnId from get_field, or currentValue to match by current label.',
|
|
271
|
+
parameters: {
|
|
272
|
+
type: 'object',
|
|
273
|
+
properties: {
|
|
274
|
+
fieldQuestion: { type: 'string' },
|
|
275
|
+
fieldId: { type: 'string' },
|
|
276
|
+
columnId: { type: 'string' },
|
|
277
|
+
currentValue: {
|
|
278
|
+
type: 'string',
|
|
279
|
+
description: 'Current label to match if columnId unknown',
|
|
280
|
+
},
|
|
281
|
+
value: { type: 'string' },
|
|
282
|
+
},
|
|
283
|
+
required: ['value'],
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
type: 'function',
|
|
289
|
+
function: {
|
|
290
|
+
name: 'remove_column',
|
|
291
|
+
description: 'Remove a matrix column by its ID.',
|
|
292
|
+
parameters: {
|
|
293
|
+
type: 'object',
|
|
294
|
+
properties: {
|
|
295
|
+
fieldQuestion: { type: 'string' },
|
|
296
|
+
fieldId: { type: 'string' },
|
|
297
|
+
columnId: { type: 'string' },
|
|
298
|
+
},
|
|
299
|
+
required: ['columnId'],
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
type: 'function',
|
|
305
|
+
function: {
|
|
306
|
+
name: 'get_field_types',
|
|
307
|
+
description: 'List all available field types with their key, label, category, and whether they support options or matrix rows/columns. Call this before create_field if unsure which fieldType to use.',
|
|
308
|
+
parameters: { type: 'object', properties: {} },
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
type: 'function',
|
|
313
|
+
function: {
|
|
314
|
+
name: 'get_field_spec',
|
|
315
|
+
description: 'Get the full spec for a specific field type: capabilities, default properties, and placeholder hints.',
|
|
316
|
+
parameters: {
|
|
317
|
+
type: 'object',
|
|
318
|
+
properties: {
|
|
319
|
+
fieldType: {
|
|
320
|
+
type: 'string',
|
|
321
|
+
description: 'The field type key, e.g. "radio", "slider", "singlematrix"',
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
required: ['fieldType'],
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
type: 'function',
|
|
330
|
+
function: {
|
|
331
|
+
name: 'get_definition',
|
|
332
|
+
description: 'Export the complete current form as a JSON definition tree — all fields, options, rows, columns, and logic rules. Use this to inspect the full form structure or to verify logic rules on any field.',
|
|
333
|
+
parameters: { type: 'object', properties: {} },
|
|
334
|
+
},
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
type: 'function',
|
|
338
|
+
function: {
|
|
339
|
+
name: 'set_form_id',
|
|
340
|
+
description: 'Update the top-level form ID without replacing or modifying any fields.',
|
|
341
|
+
parameters: {
|
|
342
|
+
type: 'object',
|
|
343
|
+
properties: {
|
|
344
|
+
id: { type: 'string', description: 'The new form ID.' },
|
|
345
|
+
},
|
|
346
|
+
required: ['id'],
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
type: 'function',
|
|
352
|
+
function: {
|
|
353
|
+
name: 'add_field_rule',
|
|
354
|
+
description: 'Add a conditional logic rule to a field based on another field\'s response. Controls whether this field is visible, enabled, or required. effect: "visible"|"enable"|"required". logic: "AND"|"OR". Each condition: { targetId, operator, expected }. For option-based fields (radio, check, dropdown, etc.), expected must be the option ID (e.g. "o1") — use get_field to look up IDs. Operators: equals|notEquals|contains|includes|empty|notEmpty|greaterThan|greaterThanOrEqual|lessThan|lessThanOrEqual. Use "includes" for multi-select fields (check, multiselectdropdown, ranking). Use "empty"/"notEmpty" with no expected value.',
|
|
355
|
+
parameters: {
|
|
356
|
+
type: 'object',
|
|
357
|
+
properties: {
|
|
358
|
+
fieldQuestion: { type: 'string' },
|
|
359
|
+
fieldId: { type: 'string' },
|
|
360
|
+
effect: {
|
|
361
|
+
type: 'string',
|
|
362
|
+
enum: ['visible', 'enable', 'required'],
|
|
363
|
+
},
|
|
364
|
+
logic: {
|
|
365
|
+
type: 'string',
|
|
366
|
+
enum: ['AND', 'OR'],
|
|
367
|
+
},
|
|
368
|
+
conditions: {
|
|
369
|
+
type: 'array',
|
|
370
|
+
items: {
|
|
371
|
+
type: 'object',
|
|
372
|
+
properties: {
|
|
373
|
+
targetId: {
|
|
374
|
+
type: 'string',
|
|
375
|
+
description: 'Field ID whose response is checked.',
|
|
376
|
+
},
|
|
377
|
+
operator: {
|
|
378
|
+
type: 'string',
|
|
379
|
+
description: 'equals|notEquals|contains|includes|empty|notEmpty|greaterThan|greaterThanOrEqual|lessThan|lessThanOrEqual',
|
|
380
|
+
},
|
|
381
|
+
expected: {
|
|
382
|
+
type: 'string',
|
|
383
|
+
description: 'For option-based fields use the option ID (e.g. "o1"), not the label. Omit for empty/notEmpty.',
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
required: ['targetId', 'operator'],
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
},
|
|
390
|
+
required: ['effect', 'logic', 'conditions'],
|
|
391
|
+
},
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
type: 'function',
|
|
396
|
+
function: {
|
|
397
|
+
name: 'add_expression_rule',
|
|
398
|
+
description: 'Add a conditional logic rule to a field using a custom expression. Use this for complex conditions that field-based rules cannot express (e.g. arithmetic, multi-field combinations). The expression is evaluated in a safe sandbox — NOT full JavaScript. CRITICAL SYNTAX: field IDs MUST be wrapped in curly braces: {fieldId}. Example: `{text-3} > 4 && {rating-1} < 3`. Available operators: +,-,*,/,%, comparisons (==,!=,===,!==,>,>=,<,<=), logical (&&,||,!), property access (.length, .count on field refs). NOT available: ANY function calls (parseInt, parseFloat, Object.values, .includes, .find, .filter, etc.), bare field names without {}, loops, or assignments. NEVER use parseInt() — text fields with inputType "number" and rating/slider fields already resolve to numbers automatically, use them directly. Field values in expressions: text/longtext with inputType "number" → number. text/longtext otherwise → string. radio/dropdown/boolean/slider/rating → option label string (NOT id). check/multiselectdropdown/ranking → array of option label strings (use .count for length). singlematrix/multimatrix → object keyed by rowId (use .count for answered row count). Valid examples: `{f1} > 4 && {f2} < 3`, `{f3}.length > 0`, `{f4} == "Yes"`. Invalid: `parseInt({f1}) > 4`, `f1 > 4` (missing braces).',
|
|
399
|
+
parameters: {
|
|
400
|
+
type: 'object',
|
|
401
|
+
properties: {
|
|
402
|
+
fieldQuestion: { type: 'string' },
|
|
403
|
+
fieldId: { type: 'string' },
|
|
404
|
+
effect: {
|
|
405
|
+
type: 'string',
|
|
406
|
+
enum: ['visible', 'enable', 'required'],
|
|
407
|
+
},
|
|
408
|
+
expression: {
|
|
409
|
+
type: 'string',
|
|
410
|
+
description: 'Expression string. Use field IDs as variable names. No method calls allowed.',
|
|
411
|
+
},
|
|
412
|
+
},
|
|
413
|
+
required: ['effect', 'expression'],
|
|
414
|
+
},
|
|
415
|
+
},
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
type: 'function',
|
|
419
|
+
function: {
|
|
420
|
+
name: 'remove_rule',
|
|
421
|
+
description: 'Remove a conditional logic rule from a field by its 0-based index. Use get_field or get_definition to see existing rules and their indices.',
|
|
422
|
+
parameters: {
|
|
423
|
+
type: 'object',
|
|
424
|
+
properties: {
|
|
425
|
+
fieldQuestion: { type: 'string' },
|
|
426
|
+
fieldId: { type: 'string' },
|
|
427
|
+
ruleIndex: {
|
|
428
|
+
type: 'number',
|
|
429
|
+
description: '0-based index of the rule to remove.',
|
|
430
|
+
},
|
|
431
|
+
},
|
|
432
|
+
required: ['ruleIndex'],
|
|
433
|
+
},
|
|
434
|
+
},
|
|
435
|
+
},
|
|
436
|
+
];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BuilderTools } from '../builder-tools.js';
|
|
2
|
+
type ToolArgs = Record<string, unknown>;
|
|
3
|
+
export declare function executeToolCall(toolName: string, args: ToolArgs, tools: BuilderTools): string | Record<string, unknown>;
|
|
4
|
+
export {};
|
|
5
|
+
//# sourceMappingURL=tool-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-executor.d.ts","sourceRoot":"","sources":["../../../src/lib/mcp/tool-executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAKxD,KAAK,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAExC,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,YAAY,GAClB,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgElC"}
|