@saltcorn/copilot 0.7.5 → 0.8.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.
@@ -0,0 +1,585 @@
1
+ const Field = require("@saltcorn/data/models/field");
2
+ const Table = require("@saltcorn/data/models/table");
3
+ const Form = require("@saltcorn/data/models/form");
4
+ const MetaData = require("@saltcorn/data/models/metadata");
5
+ const View = require("@saltcorn/data/models/view");
6
+ const Trigger = require("@saltcorn/data/models/trigger");
7
+ const Page = require("@saltcorn/data/models/page");
8
+ const Plugin = require("@saltcorn/data/models/plugin");
9
+ const { findType } = require("@saltcorn/data/models/discovery");
10
+ const { save_menu_items } = require("@saltcorn/data/models/config");
11
+ const db = require("@saltcorn/data/db");
12
+ const WorkflowRun = require("@saltcorn/data/models/workflow_run");
13
+ const {
14
+ localeDateTime,
15
+ renderForm,
16
+ mkTable,
17
+ post_delete_btn,
18
+ } = require("@saltcorn/markup");
19
+ const {
20
+ div,
21
+ script,
22
+ domReady,
23
+ pre,
24
+ code,
25
+ input,
26
+ h4,
27
+ style,
28
+ h5,
29
+ button,
30
+ text_attr,
31
+ i,
32
+ p,
33
+ span,
34
+ small,
35
+ a,
36
+ textarea,
37
+ } = require("@saltcorn/markup/tags");
38
+ const { getState } = require("@saltcorn/data/db/state");
39
+ const renderLayout = require("@saltcorn/markup/layout");
40
+ const { viewname } = require("./common");
41
+ const { runTask, runNextTask } = require("./run_task");
42
+ const { task_tool } = require("./tools");
43
+ const {
44
+ saltcorn_description,
45
+ existing_tables_list,
46
+ existing_entities_list,
47
+ available_plugins_list,
48
+ } = require("./prompts");
49
+
50
+ const makeTaskList = async (req) => {
51
+ const rs = await MetaData.find(
52
+ {
53
+ type: "CopilotConstructMgr",
54
+ name: "task",
55
+ },
56
+ { orderBy: "written_at" }
57
+ );
58
+ const settings = await MetaData.findOne({
59
+ type: "CopilotConstructMgr",
60
+ name: "settings",
61
+ });
62
+ const running = !!settings?.body?.running;
63
+ const status = div(
64
+ running ? "Currently running" : "Currently not running",
65
+ running
66
+ ? button(
67
+ {
68
+ class: "btn btn-danger ms-2",
69
+ onclick: `view_post("${viewname}", "stop", {})`,
70
+ },
71
+ i({ class: "fas fa-stop me-1" }),
72
+ "Stop running"
73
+ )
74
+ : button(
75
+ {
76
+ class: "btn btn-success ms-2",
77
+ onclick: `view_post("${viewname}", "start", {})`,
78
+ },
79
+ i({ class: "fas fa-play me-1" }),
80
+ "Start running now"
81
+ ),
82
+ button(
83
+ {
84
+ class: "btn btn-outline-success ms-2",
85
+ onclick: `press_store_button(this);view_post("${viewname}", "run_task", {})`,
86
+ },
87
+ i({ class: "fas fa-play me-1" }),
88
+ "Run next task"
89
+ )
90
+ );
91
+ if (rs.length) {
92
+ return div(
93
+ { class: "mt-2" },
94
+ status,
95
+ mkTable(
96
+ [
97
+ { label: "Name", key: (m) => m.body.name },
98
+ { label: "Description", key: (m) => m.body.description },
99
+ {
100
+ label: "Depends on",
101
+ key: (m) => (m.body.depends_on || []).join(", "),
102
+ },
103
+ { label: "Priority", key: (m) => m.body.priority },
104
+ { label: "Status", key: (m) => m.body.status || "To do" },
105
+ {
106
+ label: "Run",
107
+ key: (r) =>
108
+ r.body.status === "Running"
109
+ ? span(
110
+ {
111
+ class: "task-spinner",
112
+ "data-task-id": r.id,
113
+ },
114
+ i({ class: "fas fa-spinner fa-spin text-warning" })
115
+ )
116
+ : r.body.status === "Done"
117
+ ? r.body.run_id
118
+ ? a(
119
+ {
120
+ target: "_blank",
121
+ href: `/view/Saltcorn%20Agent%20copilot?run_id=${r.body.run_id}`,
122
+ },
123
+ i({ class: "fas fa-external-link-alt" })
124
+ )
125
+ : ""
126
+ : button(
127
+ {
128
+ class: "btn btn-outline-success btn-sm",
129
+ onclick: `press_store_button(this);view_post("${viewname}", "run_task", {id:${r.id}})`,
130
+ },
131
+ i({ class: "fas fa-play" })
132
+ ),
133
+ },
134
+ {
135
+ label: "",
136
+ key: (r) =>
137
+ r.body.status === "To do" || !r.body.status
138
+ ? button(
139
+ {
140
+ class: "btn btn-outline-secondary btn-sm",
141
+ title: "Mark as done without running",
142
+ onclick: `view_post("${viewname}", "mark_done_task", {id:${r.id}})`,
143
+ },
144
+ i({ class: "fas fa-check" })
145
+ )
146
+ : "",
147
+ },
148
+ {
149
+ label: "Delete",
150
+ key: (r) =>
151
+ button(
152
+ {
153
+ class: "btn btn-outline-danger btn-sm",
154
+ onclick: `view_post("${viewname}", "del_task", {id:${r.id}})`,
155
+ },
156
+ i({ class: "fas fa-trash-alt" })
157
+ ),
158
+ },
159
+ ],
160
+ {
161
+ "To do": rs.filter(
162
+ (t) => !t.body.status || t.body.status === "To do"
163
+ ),
164
+ Running: rs.filter((t) => t.body.status === "Running"),
165
+ Done: rs.filter((t) => t.body.status === "Done"),
166
+ },
167
+ { grouped: true }
168
+ ),
169
+ rs.some((t) => t.body.status === "Running")
170
+ ? script(
171
+ domReady(`
172
+ (function() {
173
+ function pollTasks() {
174
+ var spinners = document.querySelectorAll('.task-spinner[data-task-id]');
175
+ if (!spinners.length) return;
176
+ var ids = Array.from(spinners).map(function(el) { return el.getAttribute('data-task-id'); });
177
+ view_post(${JSON.stringify(
178
+ viewname
179
+ )}, 'task_status', { ids: ids }, function(resp) {
180
+ if (resp && resp.any_done) {
181
+ location.reload();
182
+ } else {
183
+ setTimeout(pollTasks, 3000);
184
+ }
185
+ });
186
+ }
187
+ setTimeout(pollTasks, 3000);
188
+ })();
189
+ `)
190
+ )
191
+ : "",
192
+ button(
193
+ {
194
+ class: "btn btn-outline-danger mb-4",
195
+ onclick: `view_post("${viewname}", "del_all_tasks")`,
196
+ },
197
+ "Delete all"
198
+ )
199
+ );
200
+ } else {
201
+ const planning = await MetaData.findOne({
202
+ type: "CopilotConstructMgr",
203
+ name: "planning",
204
+ });
205
+ if (planning) {
206
+ return div(
207
+ { class: "mt-2" },
208
+ p(
209
+ i({ class: "fas fa-spinner fa-spin me-2" }),
210
+ "Planning tasks, please wait..."
211
+ ),
212
+ script(
213
+ domReady(`
214
+ (function() {
215
+ function poll() {
216
+ view_post(${JSON.stringify(
217
+ viewname
218
+ )}, 'planning_status', {}, function(resp) {
219
+ if (resp && !resp.planning) location.reload();
220
+ else setTimeout(poll, 3000);
221
+ });
222
+ }
223
+ setTimeout(poll, 3000);
224
+ })();
225
+ `)
226
+ )
227
+ );
228
+ }
229
+ return div(
230
+ { class: "mt-2" },
231
+ p("No tasks found"),
232
+ button(
233
+ {
234
+ class: "btn btn-primary",
235
+ onclick: `press_store_button(this);view_post("${viewname}", "gen_tasks")`,
236
+ },
237
+ "Plan tasks"
238
+ )
239
+ );
240
+ }
241
+ };
242
+
243
+ const get_view_config_tool = {
244
+ type: "function",
245
+ function: {
246
+ name: "get_view_config",
247
+ description:
248
+ "Fetch the full configuration of an existing view so you can decide whether to reuse it or create a new one. Call this before planning a task if you are unsure whether an existing view already meets the requirements.",
249
+ parameters: {
250
+ type: "object",
251
+ required: ["name"],
252
+ properties: {
253
+ name: {
254
+ type: "string",
255
+ description: "The exact name of the existing view to inspect.",
256
+ },
257
+ },
258
+ },
259
+ },
260
+ };
261
+
262
+ const doGenTasks = async (spec, rs, schema, userId) => {
263
+ const planningMd = await MetaData.create({
264
+ type: "CopilotConstructMgr",
265
+ name: "planning",
266
+ body: {},
267
+ });
268
+ try {
269
+ const tables = await Table.find({});
270
+ const tableById = Object.fromEntries(tables.map((t) => [t.id, t.name]));
271
+ const views = await View.find({});
272
+ const triggers = await Trigger.find({});
273
+ const pages = await Page.find({});
274
+ const entitiesSection = existing_entities_list({
275
+ views,
276
+ triggers,
277
+ pages,
278
+ tableById,
279
+ });
280
+ const installedPlugins = await Plugin.find({});
281
+ const installedNames = new Set(installedPlugins.map((p) => p.name));
282
+ let storePlugins = [];
283
+ try {
284
+ storePlugins = await Plugin.store_plugins_available();
285
+ } catch (_) {}
286
+ const pluginsSection = available_plugins_list(storePlugins, installedNames);
287
+
288
+ const systemPrompt =
289
+ "You are a project manager. The user wants to build an application, and you must analyse their application description";
290
+
291
+ const tools = [get_view_config_tool, task_tool];
292
+ const chat = [];
293
+
294
+ let answer = await getState().functions.llm_generate.run(
295
+ `Generate a plan for building this application:
296
+
297
+ Description: ${spec.body.description}
298
+ Audience: ${spec.body.audience}
299
+ Core features: ${spec.body.core_features}
300
+ Out of scope: ${spec.body.out_of_scope}
301
+ Visual style: ${spec.body.visual_style}
302
+
303
+ These are the requirements of the application:
304
+
305
+ ${rs.map((r) => `* ${r.body.requirement}`).join("\n")}
306
+
307
+ ${saltcorn_description}
308
+
309
+ The database has already been built. The following tables are now present in the database:
310
+
311
+ ${existing_tables_list(tables)}
312
+
313
+ The plan should outline the continued development of the application on top of this database.
314
+ Your plan can add additional tables if needed or adjust the table fields, but normally the tables
315
+ should be designed optimally for this application.
316
+
317
+ ${entitiesSection ? entitiesSection + "\n\n" : ""}${
318
+ pluginsSection ? pluginsSection + "\n\n" : ""
319
+ }The plan should focus on building views, triggers (including workflows) and pages.
320
+
321
+ Important trigger planning rules:
322
+ * When a task involves a simple field update (e.g. marking an item complete or incomplete), plan it as a trigger using modify_row — NOT a workflow. Use a workflow only when multiple steps, branching, or looping are genuinely required.
323
+ * If multiple independent single-step actions are needed (e.g. "mark complete" and "mark incomplete"), describe them as separate triggers in the task description — do not describe them as one combined workflow.
324
+ * Do NOT mention "navigate back" or "return to context" in trigger task descriptions. Navigation is configured at the view level (GoBack button), not inside a trigger.
325
+ * If a trigger should be accessible as a button in a view, the task description must name the target view and say to add an action segment with action_name set to the trigger's name. If the view already exists, combine trigger creation and view update in the same task. If the view is created in a later task, that task's description must mention adding the trigger button, and it must depend on the trigger task.
326
+ * Do NOT plan any task that writes to a virtual (read-only) calculated field. Virtual fields are computed automatically and cannot be stored — any trigger or workflow that tries to update them will be refused. If you find yourself planning a trigger to keep a calculated field "current", delete that task — the field already updates itself.
327
+
328
+ Important view planning rules:
329
+ * Each task must create exactly one view. Never put two or more views in the same task. Edit, Show, and List for the same table are always three separate tasks with three separate names, descriptions, and dependencies.
330
+ * Do NOT plan separate tasks for "create" and "edit" on the same table. In Saltcorn, a single Edit view handles both (no id = create, id present = edit). One task, one Edit view, description says "create and edit".
331
+ * Edit, Show, and List views for a table form a natural group and should normally each be planned as their own task. A List without a Show leaves users with no way to inspect details; omit or adjust only when the requirements explicitly say the data is read-only or not editable. When all three are planned, the ordering of tasks must be: Edit and Show first (in either order, they are independent of each other), then List last, because the List depends on both.
332
+ * A List view task must depend on the Edit view task and the Show view task for the same table (if both exist), since its rows link to them. Set depends_on accordingly.
333
+ * When a List view links to a Show view or Edit view, the task description must say: "Add a viewlink column to [view_name] for the current row" — not just "link each row". This wording makes it unambiguous that a viewlink column must be added to the list for each target view.
334
+ * In general, if a view embeds or links to another view, the linked view's task must be listed as a dependency.
335
+ * When a table has foreign key fields referencing the users table, the task description must explicitly state for each one whether it is an ownership field (automatically set from the logged-in user, omit from the form) or a selector field (the user picks a value, include a selector in the form). Example: "user_id records the owner and is set automatically; shared_with_user_id must have a user selector."
336
+ * For FK fields that represent a parent context (e.g. trip_id on packing_items), always include the field as a normal selector in the Edit view form. Do NOT say to omit it. Saltcorn automatically pre-fills the selector from the URL query parameter when the view is opened from a parent context, and the user can select it manually when the view is used standalone.
337
+ * For every task that creates a view, include the exact view name in the task description. View names must be lowercase, snake_case, unique across all tasks in the plan, and descriptive enough to identify the table and purpose — for example 'packing_items_edit' rather than just 'edit'.
338
+
339
+ Important user account rules:
340
+ * The platform (Saltcorn) provides a built-in user account system with login, registration, and session management. Do NOT plan any tasks for user registration, login pages, password management, or authentication flows — these are already handled by the platform.
341
+ * User identity is always available as the logged-in user. Ownership fields (FK to users) are set automatically from the session; no custom logic is needed.
342
+ * If a requirement mentions "user accounts", "secure login", "saving data per user", "user-specific data", or "sharing between users", treat it as already satisfied by the platform's built-in user system. Do not generate any task in response to such a requirement.
343
+
344
+ Important plugin rules:
345
+ * If multiple plugins need to be installed, combine them ALL into a single task named "Install plugins" that lists every required plugin name. Do NOT create a separate task per plugin.
346
+
347
+ Important schema/table rules:
348
+ * The database schema is already fully designed and implemented before task planning begins. ALL tables and fields needed by the application already exist. Do NOT plan any tasks that create tables, add fields, modify fields, or change the schema in any way. If you find yourself writing a task whose output is a table or a field, delete it — that work is already done.
349
+ * Ownership behaviour (auto-setting a FK-to-users field from the logged-in user) is configured in the Edit view, not in the database. Do not create tasks for it at the schema level.
350
+ * Do NOT plan tasks to add uniqueness constraints or validation to existing fields — those are already in the schema.
351
+ * Do NOT plan a standalone task for "access control", "row-level security", "permissions", or "roles". These are schema-level concerns already handled during schema design, or view-level concerns handled when building each view. The ownership field and sharing logic are already in the schema — there is nothing extra to configure as a separate task.
352
+
353
+ Your plan should not include any clarification or questions to the product owner. The
354
+ information you have been given so far is all that is available. Every step in the plan
355
+ should be immediately implementable in Saltcorn. You are writing the steps in the plan
356
+ for a person who is competent in using saltcorn but has no other business knowledge.
357
+
358
+ Do not include any steps that contain planning, design or review instructions. You are only writing a
359
+ plan for the engineer building the application. Every step in the plan should have the construction or the modification
360
+ of one or several application entity types.
361
+
362
+ Before finalising the plan, you may call get_view_config for any existing view you are unsure about — to inspect its configuration and decide whether a task should reuse it (updating it) or create a new one. Once you have gathered all necessary information, call plan_tasks to submit the complete task list.
363
+ `,
364
+ {
365
+ tools,
366
+ chat,
367
+ appendToChat: true,
368
+ systemPrompt,
369
+ }
370
+ );
371
+
372
+ const MAX_ITERATIONS = 10;
373
+ let iterations = 0;
374
+
375
+ while (iterations++ < MAX_ITERATIONS) {
376
+ if (typeof answer !== "object" || !answer.getToolCalls) break;
377
+ const toolCalls = answer.getToolCalls();
378
+ if (!toolCalls.length) break;
379
+
380
+ const planCall = toolCalls.find((tc) => tc.tool_name === "plan_tasks");
381
+ if (planCall) {
382
+ for (const task of planCall.input.tasks)
383
+ await MetaData.create({
384
+ type: "CopilotConstructMgr",
385
+ name: "task",
386
+ body: task,
387
+ user_id: userId,
388
+ });
389
+ break;
390
+ }
391
+
392
+ const getViewCalls = toolCalls.filter(
393
+ (tc) => tc.tool_name === "get_view_config"
394
+ );
395
+ if (!getViewCalls.length) break;
396
+
397
+ for (const tc of getViewCalls) {
398
+ const viewName = tc.input?.name;
399
+ const view = viewName ? await View.findOne({ name: viewName }) : null;
400
+ const result = view
401
+ ? JSON.stringify(
402
+ {
403
+ name: view.name,
404
+ viewtemplate: view.viewtemplate,
405
+ configuration: view.configuration,
406
+ },
407
+ null,
408
+ 2
409
+ )
410
+ : `No view named "${viewName}" found.`;
411
+
412
+ if (answer.ai_sdk) {
413
+ chat.push({
414
+ role: "tool",
415
+ content: [
416
+ {
417
+ type: "tool-result",
418
+ toolCallId: tc.tool_call_id,
419
+ toolName: "get_view_config",
420
+ result,
421
+ },
422
+ ],
423
+ });
424
+ } else {
425
+ chat.push({
426
+ role: "tool",
427
+ tool_call_id: tc.tool_call_id,
428
+ name: "get_view_config",
429
+ content: result,
430
+ });
431
+ }
432
+ }
433
+
434
+ answer = await getState().functions.llm_generate.run(null, {
435
+ tools,
436
+ chat,
437
+ appendToChat: true,
438
+ systemPrompt,
439
+ });
440
+ }
441
+ } finally {
442
+ await planningMd.delete();
443
+ }
444
+ };
445
+
446
+ const gen_tasks = async (table_id, viewname, config, body, { req, res }) => {
447
+ const spec = await MetaData.findOne({
448
+ type: "CopilotConstructMgr",
449
+ name: "spec",
450
+ });
451
+ if (!spec) throw new Error("Specification not found");
452
+ const rs = await MetaData.find({
453
+ type: "CopilotConstructMgr",
454
+ name: "requirement",
455
+ });
456
+ if (!rs.length) throw new Error("No requirements found");
457
+ const schema = await MetaData.findOne({
458
+ type: "CopilotConstructMgr",
459
+ name: "schema",
460
+ });
461
+ if (!schema) throw new Error("No schema found");
462
+ if (!schema.body.implemented) throw new Error("Schema not implemented");
463
+ doGenTasks(spec, rs, schema, req.user?.id).catch((e) =>
464
+ console.error("gen_tasks error", e)
465
+ );
466
+ return { json: { reload_page: true } };
467
+ };
468
+
469
+ const del_task = async (table_id, viewname, config, body, { req, res }) => {
470
+ const r = await MetaData.findOne({
471
+ id: body.id,
472
+ });
473
+
474
+ if (!r) throw new Error("Task not found");
475
+ await r.delete();
476
+ return { json: { reload_page: true } };
477
+ };
478
+ const run_task = async (table_id, viewname, config, body, { req, res }) => {
479
+ const reqUser = req?.user;
480
+ if (body.id)
481
+ runTask(body.id, { user: reqUser, __: req.__ }).catch((e) =>
482
+ console.error("run_task error", e)
483
+ );
484
+ else runNextTask(true).catch((e) => console.error("run_task error", e));
485
+ return { json: { reload_page: true } };
486
+ };
487
+
488
+ const planning_status = async (
489
+ table_id,
490
+ viewname,
491
+ config,
492
+ body,
493
+ { req, res }
494
+ ) => {
495
+ const planning = await MetaData.findOne({
496
+ type: "CopilotConstructMgr",
497
+ name: "planning",
498
+ });
499
+ return { json: { planning: !!planning } };
500
+ };
501
+
502
+ const task_status = async (table_id, viewname, config, body, { req, res }) => {
503
+ const ids = body.ids || [];
504
+ const tasks = await MetaData.find({
505
+ type: "CopilotConstructMgr",
506
+ name: "task",
507
+ });
508
+ const relevant = tasks.filter((t) => ids.includes(String(t.id)));
509
+ const any_done = relevant.some((t) => t.body.status !== "Running");
510
+ return { json: { any_done } };
511
+ };
512
+
513
+ const start = async (table_id, viewname, config, body, { req, res }) => {
514
+ const settings = await MetaData.findOne({
515
+ type: "CopilotConstructMgr",
516
+ name: "settings",
517
+ });
518
+ if (settings)
519
+ await settings.update({ body: { ...settings.body, running: true } });
520
+ else
521
+ await MetaData.create({
522
+ type: "CopilotConstructMgr",
523
+ name: "settings",
524
+ body: { running: true },
525
+ });
526
+ runNextTask().catch((e) => console.error("start error", e));
527
+ return { json: { reload_page: true } };
528
+ };
529
+ const stop = async (table_id, viewname, config, body, { req, res }) => {
530
+ const settings = await MetaData.findOne({
531
+ type: "CopilotConstructMgr",
532
+ name: "settings",
533
+ });
534
+ if (settings)
535
+ await settings.update({ body: { ...settings.body, running: false } });
536
+ else
537
+ await MetaData.create({
538
+ type: "CopilotConstructMgr",
539
+ name: "settings",
540
+ body: { running: false },
541
+ });
542
+ return { json: { reload_page: true } };
543
+ };
544
+
545
+ const mark_done_task = async (
546
+ table_id,
547
+ viewname,
548
+ config,
549
+ body,
550
+ { req, res }
551
+ ) => {
552
+ const r = await MetaData.findOne({ id: body.id });
553
+ if (!r) throw new Error("Task not found");
554
+ await r.update({ body: { ...r.body, status: "Done" } });
555
+ return { json: { reload_page: true } };
556
+ };
557
+
558
+ const del_all_tasks = async (
559
+ table_id,
560
+ viewname,
561
+ config,
562
+ body,
563
+ { req, res }
564
+ ) => {
565
+ const rs = await MetaData.find({
566
+ type: "CopilotConstructMgr",
567
+ name: "task",
568
+ });
569
+ for (const r of rs) await r.delete();
570
+ return { json: { reload_page: true } };
571
+ };
572
+
573
+ const task_routes = {
574
+ gen_tasks,
575
+ del_task,
576
+ del_all_tasks,
577
+ mark_done_task,
578
+ run_task,
579
+ planning_status,
580
+ task_status,
581
+ start,
582
+ stop,
583
+ };
584
+
585
+ module.exports = { makeTaskList, task_routes };
@@ -0,0 +1,81 @@
1
+ const requirements_tool = {
2
+ type: "function",
3
+ function: {
4
+ name: "make_requirements",
5
+ description: "Provide a list of requirements for the application",
6
+ parameters: {
7
+ type: "object",
8
+ required: ["requirements"],
9
+ additionalProperties: false,
10
+ properties: {
11
+ requirements: {
12
+ type: "array",
13
+ items: {
14
+ type: "object",
15
+ required: ["requirement", "priority"],
16
+ additionalProperties: false,
17
+ properties: {
18
+ requirement: {
19
+ type: "string",
20
+ description: "A statement of the requirement",
21
+ },
22
+ priority: {
23
+ type: "number",
24
+ description:
25
+ "Priority 1-5. 5: Most important, 1: Least important",
26
+ },
27
+ },
28
+ },
29
+ },
30
+ },
31
+ },
32
+ },
33
+ };
34
+
35
+ const task_tool = {
36
+ type: "function",
37
+ function: {
38
+ name: "plan_tasks",
39
+ description: "Provide a series of tasks for building the application",
40
+ parameters: {
41
+ type: "object",
42
+ required: ["tasks"],
43
+ additionalProperties: false,
44
+ properties: {
45
+ tasks: {
46
+ type: "array",
47
+ items: {
48
+ type: "object",
49
+ required: ["requirement", "priority"],
50
+ additionalProperties: false,
51
+ properties: {
52
+ name: {
53
+ type: "string",
54
+ description: "A short name for the task",
55
+ },
56
+ description: {
57
+ type: "string",
58
+ description: "A full description of the task",
59
+ },
60
+ priority: {
61
+ type: "number",
62
+ description:
63
+ "Priority 1-5. 5: Most important, 1: Least important",
64
+ },
65
+ depends_on: {
66
+ type: "array",
67
+ description:
68
+ "The names of the tasks that must be completed before this tasks can be started",
69
+ items: {
70
+ type: "string",
71
+ },
72
+ },
73
+ },
74
+ },
75
+ },
76
+ },
77
+ },
78
+ },
79
+ };
80
+
81
+ module.exports = { requirements_tool,task_tool };