@saltcorn/copilot 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/generate-tables.js +14 -0
- package/actions/generate-trigger.js +61 -0
- package/actions/generate-workflow.js +6 -1
- package/agent-skills/pagegen.js +39 -12
- package/agent-skills/registry-editor.js +15 -0
- package/agent-skills/triggergen.js +259 -0
- package/agent-skills/viewgen.js +248 -22
- package/app-constructor/prompts.js +65 -3
- package/app-constructor/requirements.js +98 -36
- package/app-constructor/run_task.js +116 -68
- package/app-constructor/schema.js +227 -49
- package/app-constructor/tasks.js +622 -83
- package/app-constructor/tools.js +5 -4
- package/app-constructor/view.js +7 -0
- package/builder-gen.js +135 -35
- package/copilot-as-agent.js +2 -0
- package/index.js +1 -2
- package/js-code-gen.js +1 -0
- package/package.json +1 -1
- package/relation-paths.js +269 -0
- package/standard-prompt.js +1 -0
- package/user-copilot.js +2 -0
- package/workflow-gen.js +1 -0
- package/agent-skills/app-constructor-context.js +0 -25
- package/chat-copilot.js +0 -769
package/app-constructor/tasks.js
CHANGED
|
@@ -4,6 +4,8 @@ const Form = require("@saltcorn/data/models/form");
|
|
|
4
4
|
const MetaData = require("@saltcorn/data/models/metadata");
|
|
5
5
|
const View = require("@saltcorn/data/models/view");
|
|
6
6
|
const Trigger = require("@saltcorn/data/models/trigger");
|
|
7
|
+
const Page = require("@saltcorn/data/models/page");
|
|
8
|
+
const Plugin = require("@saltcorn/data/models/plugin");
|
|
7
9
|
const { findType } = require("@saltcorn/data/models/discovery");
|
|
8
10
|
const { save_menu_items } = require("@saltcorn/data/models/config");
|
|
9
11
|
const db = require("@saltcorn/data/db");
|
|
@@ -32,13 +34,51 @@ const {
|
|
|
32
34
|
small,
|
|
33
35
|
a,
|
|
34
36
|
textarea,
|
|
37
|
+
tr,
|
|
38
|
+
td,
|
|
35
39
|
} = require("@saltcorn/markup/tags");
|
|
36
40
|
const { getState } = require("@saltcorn/data/db/state");
|
|
37
41
|
const renderLayout = require("@saltcorn/markup/layout");
|
|
38
|
-
const { viewname
|
|
42
|
+
const { viewname } = require("./common");
|
|
39
43
|
const { runTask, runNextTask } = require("./run_task");
|
|
40
44
|
const { task_tool } = require("./tools");
|
|
41
|
-
const {
|
|
45
|
+
const {
|
|
46
|
+
saltcorn_description,
|
|
47
|
+
existing_tables_list,
|
|
48
|
+
existing_entities_list,
|
|
49
|
+
available_plugins_list,
|
|
50
|
+
} = require("./prompts");
|
|
51
|
+
|
|
52
|
+
const doneTaskRowHtml = (task) =>
|
|
53
|
+
tr(
|
|
54
|
+
{ "data-row-id": task.id },
|
|
55
|
+
td(task.body.name || ""),
|
|
56
|
+
td(task.body.description || ""),
|
|
57
|
+
td((task.body.depends_on || []).join(", ")),
|
|
58
|
+
td(task.body.priority || ""),
|
|
59
|
+
td("Done"),
|
|
60
|
+
td(
|
|
61
|
+
task.body.run_id
|
|
62
|
+
? a(
|
|
63
|
+
{
|
|
64
|
+
target: "_blank",
|
|
65
|
+
href: `/view/Saltcorn%20Agent%20copilot?run_id=${task.body.run_id}`,
|
|
66
|
+
},
|
|
67
|
+
i({ class: "fas fa-external-link-alt" })
|
|
68
|
+
)
|
|
69
|
+
: ""
|
|
70
|
+
),
|
|
71
|
+
td(""),
|
|
72
|
+
td(
|
|
73
|
+
button(
|
|
74
|
+
{
|
|
75
|
+
class: "btn btn-outline-danger btn-sm",
|
|
76
|
+
onclick: `view_post("${viewname}", "del_task", {id:${task.id}})`,
|
|
77
|
+
},
|
|
78
|
+
i({ class: "fas fa-trash-alt" })
|
|
79
|
+
)
|
|
80
|
+
)
|
|
81
|
+
);
|
|
42
82
|
|
|
43
83
|
const makeTaskList = async (req) => {
|
|
44
84
|
const rs = await MetaData.find(
|
|
@@ -53,8 +93,18 @@ const makeTaskList = async (req) => {
|
|
|
53
93
|
name: "settings",
|
|
54
94
|
});
|
|
55
95
|
const running = !!settings?.body?.running;
|
|
96
|
+
const stopping = !running && rs.some((t) => t.body.status === "Running");
|
|
97
|
+
const runningTask = rs.find((t) => t.body.status === "Running");
|
|
98
|
+
const statusText = runningTask
|
|
99
|
+
? span(
|
|
100
|
+
"Running: ",
|
|
101
|
+
span({ class: "fw-bold" }, runningTask.body.name || "task")
|
|
102
|
+
)
|
|
103
|
+
: running
|
|
104
|
+
? "Currently running"
|
|
105
|
+
: "Currently not running";
|
|
56
106
|
const status = div(
|
|
57
|
-
|
|
107
|
+
span({ id: "copilot-status-text" }, statusText),
|
|
58
108
|
running
|
|
59
109
|
? button(
|
|
60
110
|
{
|
|
@@ -66,22 +116,46 @@ const makeTaskList = async (req) => {
|
|
|
66
116
|
)
|
|
67
117
|
: button(
|
|
68
118
|
{
|
|
119
|
+
id: "copilot-start-btn",
|
|
69
120
|
class: "btn btn-success ms-2",
|
|
70
|
-
|
|
121
|
+
...(stopping
|
|
122
|
+
? { disabled: true }
|
|
123
|
+
: { onclick: `copilotStartRunning(this)` }),
|
|
71
124
|
},
|
|
72
|
-
|
|
73
|
-
|
|
125
|
+
stopping
|
|
126
|
+
? i({ class: "fas fa-spinner fa-spin me-1" })
|
|
127
|
+
: i({ class: "fas fa-play me-1" }),
|
|
128
|
+
stopping ? "Running..." : "Start running now"
|
|
74
129
|
),
|
|
130
|
+
stopping &&
|
|
131
|
+
span(
|
|
132
|
+
{
|
|
133
|
+
id: "copilot-stop-notice",
|
|
134
|
+
class:
|
|
135
|
+
"alert alert-warning alert-dismissible d-inline-block ms-2 py-1 px-2 mb-0",
|
|
136
|
+
style: "font-size:0.875rem",
|
|
137
|
+
},
|
|
138
|
+
button({
|
|
139
|
+
type: "button",
|
|
140
|
+
class: "btn-close btn-sm",
|
|
141
|
+
"data-bs-dismiss": "alert",
|
|
142
|
+
}),
|
|
143
|
+
"The current task will complete, then the queue stops. No new tasks will be started."
|
|
144
|
+
),
|
|
75
145
|
button(
|
|
76
146
|
{
|
|
147
|
+
id: "copilot-run-next-btn",
|
|
77
148
|
class: "btn btn-outline-success ms-2",
|
|
78
|
-
|
|
149
|
+
style: running || stopping ? "display:none" : "",
|
|
150
|
+
onclick: `copilotRunNext(this)`,
|
|
79
151
|
},
|
|
80
152
|
i({ class: "fas fa-play me-1" }),
|
|
81
153
|
"Run next task"
|
|
82
154
|
)
|
|
83
155
|
);
|
|
84
156
|
if (rs.length) {
|
|
157
|
+
const runningOnLoad =
|
|
158
|
+
!stopping && rs.some((t) => t.body.status === "Running");
|
|
85
159
|
return div(
|
|
86
160
|
{ class: "mt-2" },
|
|
87
161
|
status,
|
|
@@ -119,7 +193,8 @@ const makeTaskList = async (req) => {
|
|
|
119
193
|
: button(
|
|
120
194
|
{
|
|
121
195
|
class: "btn btn-outline-success btn-sm",
|
|
122
|
-
|
|
196
|
+
"data-task-run": r.id,
|
|
197
|
+
onclick: `copilotRunTask(this,${r.id})`,
|
|
123
198
|
},
|
|
124
199
|
i({ class: "fas fa-play" })
|
|
125
200
|
),
|
|
@@ -152,33 +227,261 @@ const makeTaskList = async (req) => {
|
|
|
152
227
|
],
|
|
153
228
|
{
|
|
154
229
|
"To do": rs.filter(
|
|
155
|
-
(t) =>
|
|
230
|
+
(t) =>
|
|
231
|
+
!t.body.status ||
|
|
232
|
+
t.body.status === "To do" ||
|
|
233
|
+
t.body.status === "Running"
|
|
156
234
|
),
|
|
157
|
-
Running: rs.filter((t) => t.body.status === "Running"),
|
|
158
235
|
Done: rs.filter((t) => t.body.status === "Done"),
|
|
159
236
|
},
|
|
160
237
|
{ grouped: true }
|
|
161
238
|
),
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
239
|
+
script(`
|
|
240
|
+
function copilotInitStopping() {
|
|
241
|
+
const startBtn = document.getElementById('copilot-start-btn');
|
|
242
|
+
const noticeEl = document.getElementById('copilot-stop-notice');
|
|
243
|
+
const runNextBtn = document.getElementById('copilot-run-next-btn');
|
|
244
|
+
const movedToDone = copilotDoneIds();
|
|
245
|
+
const poll = () => {
|
|
246
|
+
view_post(${JSON.stringify(viewname)}, 'tasks_poll', {}, (resp) => {
|
|
247
|
+
if (!resp || !resp.tasks) return;
|
|
248
|
+
let hasRunning = false;
|
|
249
|
+
for (const task of resp.tasks) {
|
|
250
|
+
if (task.status === 'Done' && !movedToDone.has(task.id)) {
|
|
251
|
+
movedToDone.add(task.id);
|
|
252
|
+
view_post(${JSON.stringify(
|
|
253
|
+
viewname
|
|
254
|
+
)}, 'task_row_done', {id: task.id}, (rowResp) => {
|
|
255
|
+
copilotAppendDoneRow(task.id, rowResp);
|
|
256
|
+
});
|
|
257
|
+
} else if (task.status === 'Running') {
|
|
258
|
+
hasRunning = true;
|
|
259
|
+
copilotShowSpinner(task.id);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (hasRunning) {
|
|
263
|
+
setTimeout(poll, 3000);
|
|
175
264
|
} else {
|
|
176
|
-
|
|
265
|
+
if (noticeEl) noticeEl.remove();
|
|
266
|
+
const statusTextEl = document.getElementById('copilot-status-text');
|
|
267
|
+
if (statusTextEl) statusTextEl.textContent = 'Currently not running';
|
|
268
|
+
if (startBtn) {
|
|
269
|
+
startBtn.disabled = false;
|
|
270
|
+
startBtn.innerHTML = '<i class="fas fa-play me-1"></i>Start running now';
|
|
271
|
+
startBtn.onclick = () => copilotStartRunning(startBtn);
|
|
272
|
+
}
|
|
273
|
+
if (runNextBtn) runNextBtn.style.display = '';
|
|
177
274
|
}
|
|
178
275
|
});
|
|
276
|
+
};
|
|
277
|
+
setTimeout(poll, 1000);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function copilotAppendDoneRow(taskId, rowResp) {
|
|
281
|
+
const row = document.querySelector('tr[data-row-id="' + taskId + '"]');
|
|
282
|
+
if (row) row.remove();
|
|
283
|
+
const doneHeader = Array.from(document.querySelectorAll('h4.list-group-header'))
|
|
284
|
+
.find(h => h.textContent.trim() === 'Done');
|
|
285
|
+
if (doneHeader && rowResp && rowResp.html) {
|
|
286
|
+
const tbody = doneHeader.closest('tr').parentNode;
|
|
287
|
+
const tmp = document.createElement('tbody');
|
|
288
|
+
tmp.innerHTML = rowResp.html;
|
|
289
|
+
tbody.appendChild(tmp.firstChild);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function copilotRunTask(btn, taskId) {
|
|
294
|
+
btn.innerHTML = '<i class="fas fa-spinner fa-spin"></i>';
|
|
295
|
+
btn.disabled = true;
|
|
296
|
+
const runNextBtn = document.getElementById('copilot-run-next-btn');
|
|
297
|
+
const startBtn = document.getElementById('copilot-start-btn');
|
|
298
|
+
if (runNextBtn) runNextBtn.disabled = true;
|
|
299
|
+
if (startBtn) startBtn.disabled = true;
|
|
300
|
+
const row = document.querySelector('tr[data-row-id="' + taskId + '"]');
|
|
301
|
+
const taskName = row ? (row.cells[0]?.textContent?.trim() || '') : '';
|
|
302
|
+
const statusTextEl = document.getElementById('copilot-status-text');
|
|
303
|
+
if (statusTextEl) statusTextEl.innerHTML =
|
|
304
|
+
'Running: <span class="fw-bold">' + (taskName || 'task') + '</span>';
|
|
305
|
+
view_post(${JSON.stringify(viewname)}, 'run_task', {id: taskId}, () => {
|
|
306
|
+
const poll = () => {
|
|
307
|
+
view_post(${JSON.stringify(
|
|
308
|
+
viewname
|
|
309
|
+
)}, 'task_status', {ids: [String(taskId)]}, (resp) => {
|
|
310
|
+
if (resp && resp.any_done) {
|
|
311
|
+
if (statusTextEl) statusTextEl.textContent = 'Currently not running';
|
|
312
|
+
if (runNextBtn) runNextBtn.disabled = false;
|
|
313
|
+
if (startBtn) startBtn.disabled = false;
|
|
314
|
+
view_post(${JSON.stringify(
|
|
315
|
+
viewname
|
|
316
|
+
)}, 'task_row_done', {id: taskId}, (rowResp) => {
|
|
317
|
+
copilotAppendDoneRow(taskId, rowResp);
|
|
318
|
+
});
|
|
319
|
+
} else {
|
|
320
|
+
setTimeout(poll, 3000);
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
};
|
|
324
|
+
setTimeout(poll, 3000);
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function copilotDoneIds() {
|
|
329
|
+
const ids = new Set();
|
|
330
|
+
const doneHeader = Array.from(document.querySelectorAll('h4.list-group-header'))
|
|
331
|
+
.find(h => h.textContent.trim() === 'Done');
|
|
332
|
+
if (doneHeader) {
|
|
333
|
+
let sib = doneHeader.closest('tr').nextElementSibling;
|
|
334
|
+
while (sib) {
|
|
335
|
+
const id = sib.getAttribute('data-row-id');
|
|
336
|
+
if (id) ids.add(Number(id));
|
|
337
|
+
sib = sib.nextElementSibling;
|
|
338
|
+
}
|
|
179
339
|
}
|
|
180
|
-
|
|
181
|
-
}
|
|
340
|
+
return ids;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
function copilotShowSpinner(taskId) {
|
|
344
|
+
const row = document.querySelector('tr[data-row-id="' + taskId + '"]');
|
|
345
|
+
if (row && !row.querySelector('.task-spinner')) {
|
|
346
|
+
const runBtn = row.querySelector('[data-task-run]');
|
|
347
|
+
if (runBtn) {
|
|
348
|
+
runBtn.closest('td').innerHTML =
|
|
349
|
+
'<span class="task-spinner" data-task-id="' + taskId + '">' +
|
|
350
|
+
'<i class="fas fa-spinner fa-spin text-warning"></i></span>';
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
function copilotRunNext(btn) {
|
|
356
|
+
btn.disabled = true;
|
|
357
|
+
const originalHtml = btn.innerHTML;
|
|
358
|
+
btn.innerHTML = '<i class="fas fa-spinner fa-spin me-1"></i>Running...';
|
|
359
|
+
const firstRunBtn = document.querySelector('[data-task-run]');
|
|
360
|
+
const optimisticId = firstRunBtn ? Number(firstRunBtn.getAttribute('data-task-run')) : null;
|
|
361
|
+
if (optimisticId) copilotShowSpinner(optimisticId);
|
|
362
|
+
const movedToDone = copilotDoneIds();
|
|
363
|
+
view_post(${JSON.stringify(viewname)}, 'run_task', {}, () => {
|
|
364
|
+
const poll = () => {
|
|
365
|
+
view_post(${JSON.stringify(viewname)}, 'tasks_poll', {}, (resp) => {
|
|
366
|
+
if (!resp || !resp.tasks) return;
|
|
367
|
+
let hasRunning = false;
|
|
368
|
+
const runningIds = new Set(resp.tasks.filter(t => t.status === 'Running').map(t => t.id));
|
|
369
|
+
if (optimisticId && !runningIds.has(optimisticId) && !movedToDone.has(optimisticId)) {
|
|
370
|
+
const staleRow = document.querySelector('tr[data-row-id="' + optimisticId + '"]');
|
|
371
|
+
const staleSpinner = staleRow?.querySelector('.task-spinner');
|
|
372
|
+
if (staleSpinner) staleSpinner.closest('td').innerHTML =
|
|
373
|
+
'<button class="btn btn-outline-success btn-sm" data-task-run="' + optimisticId + '" onclick="copilotRunTask(this,' + optimisticId + ')"><i class="fas fa-play"></i></button>';
|
|
374
|
+
}
|
|
375
|
+
for (const task of resp.tasks) {
|
|
376
|
+
if (task.status === 'Done' && !movedToDone.has(task.id)) {
|
|
377
|
+
movedToDone.add(task.id);
|
|
378
|
+
view_post(${JSON.stringify(
|
|
379
|
+
viewname
|
|
380
|
+
)}, 'task_row_done', {id: task.id}, (rowResp) => {
|
|
381
|
+
copilotAppendDoneRow(task.id, rowResp);
|
|
382
|
+
});
|
|
383
|
+
} else if (task.status === 'Running') {
|
|
384
|
+
hasRunning = true;
|
|
385
|
+
copilotShowSpinner(task.id);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
if (hasRunning) setTimeout(poll, 3000);
|
|
389
|
+
else {
|
|
390
|
+
btn.disabled = false;
|
|
391
|
+
btn.innerHTML = originalHtml;
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
};
|
|
395
|
+
setTimeout(poll, 500);
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
function copilotStartRunning(btn) {
|
|
400
|
+
btn.disabled = true;
|
|
401
|
+
btn.innerHTML = '<i class="fas fa-spinner fa-spin me-1"></i>Running...';
|
|
402
|
+
const runNextBtn = document.getElementById('copilot-run-next-btn');
|
|
403
|
+
const statusTextEl = document.getElementById('copilot-status-text');
|
|
404
|
+
if (runNextBtn) runNextBtn.style.display = 'none';
|
|
405
|
+
if (statusTextEl) statusTextEl.innerHTML = '<i class="fas fa-spinner fa-spin me-1"></i>Running';
|
|
406
|
+
let stopped = false;
|
|
407
|
+
let stopNotice = null;
|
|
408
|
+
const stopBtn = document.createElement('button');
|
|
409
|
+
stopBtn.className = 'btn btn-danger ms-2';
|
|
410
|
+
stopBtn.innerHTML = '<i class="fas fa-stop me-1"></i>Stop';
|
|
411
|
+
stopBtn.onclick = () => {
|
|
412
|
+
stopped = true;
|
|
413
|
+
stopBtn.disabled = true;
|
|
414
|
+
view_post(${JSON.stringify(viewname)}, 'stop', {});
|
|
415
|
+
if (!stopNotice) {
|
|
416
|
+
stopNotice = document.createElement('span');
|
|
417
|
+
stopNotice.className = 'alert alert-warning alert-dismissible d-inline-block ms-2 py-1 px-2 mb-0';
|
|
418
|
+
stopNotice.style.fontSize = '0.875rem';
|
|
419
|
+
stopNotice.innerHTML =
|
|
420
|
+
'<button type="button" class="btn-close btn-sm" data-bs-dismiss="alert"></button>' +
|
|
421
|
+
'The current task will complete, then the queue stops. No new tasks will be started.';
|
|
422
|
+
stopBtn.insertAdjacentElement('afterend', stopNotice);
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
btn.insertAdjacentElement('afterend', stopBtn);
|
|
426
|
+
view_post(${JSON.stringify(viewname)}, 'start', {}, () => {
|
|
427
|
+
const movedToDone = copilotDoneIds();
|
|
428
|
+
const poll = () => {
|
|
429
|
+
view_post(${JSON.stringify(viewname)}, 'tasks_poll', {}, (resp) => {
|
|
430
|
+
if (!resp || !resp.tasks) return;
|
|
431
|
+
let hasPending = false;
|
|
432
|
+
let hasRunning = false;
|
|
433
|
+
for (const task of resp.tasks) {
|
|
434
|
+
if (task.status === 'Done' && !movedToDone.has(task.id)) {
|
|
435
|
+
movedToDone.add(task.id);
|
|
436
|
+
view_post(${JSON.stringify(
|
|
437
|
+
viewname
|
|
438
|
+
)}, 'task_row_done', {id: task.id}, (rowResp) => {
|
|
439
|
+
copilotAppendDoneRow(task.id, rowResp);
|
|
440
|
+
});
|
|
441
|
+
} else if (task.status === 'Running') {
|
|
442
|
+
hasRunning = true;
|
|
443
|
+
copilotShowSpinner(task.id);
|
|
444
|
+
if (statusTextEl) statusTextEl.innerHTML =
|
|
445
|
+
'Running: <span class="fw-bold">' + (task.name || 'task') + '</span>';
|
|
446
|
+
} else if (task.status !== 'Done') {
|
|
447
|
+
hasPending = true;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
if (hasRunning || (!stopped && hasPending)) {
|
|
451
|
+
setTimeout(poll, 3000);
|
|
452
|
+
} else {
|
|
453
|
+
stopBtn.remove();
|
|
454
|
+
if (stopNotice) { stopNotice.remove(); stopNotice = null; }
|
|
455
|
+
btn.disabled = false;
|
|
456
|
+
btn.innerHTML = '<i class="fas fa-play me-1"></i>Start running now';
|
|
457
|
+
if (statusTextEl) statusTextEl.textContent = 'Currently not running';
|
|
458
|
+
if (runNextBtn) runNextBtn.style.display = '';
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
};
|
|
462
|
+
setTimeout(poll, 1000);
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
`),
|
|
466
|
+
stopping
|
|
467
|
+
? script(domReady(`copilotInitStopping();`))
|
|
468
|
+
: runningOnLoad
|
|
469
|
+
? script(
|
|
470
|
+
domReady(`
|
|
471
|
+
const runNextBtn = document.getElementById('copilot-run-next-btn');
|
|
472
|
+
const startBtn = document.getElementById('copilot-start-btn');
|
|
473
|
+
if (runNextBtn) runNextBtn.disabled = true;
|
|
474
|
+
if (startBtn) startBtn.disabled = true;
|
|
475
|
+
const pollTasks = () => {
|
|
476
|
+
const spinners = document.querySelectorAll('.task-spinner[data-task-id]');
|
|
477
|
+
if (!spinners.length) return;
|
|
478
|
+
const ids = Array.from(spinners).map(el => el.getAttribute('data-task-id'));
|
|
479
|
+
view_post(${JSON.stringify(viewname)}, 'task_status', {ids}, (resp) => {
|
|
480
|
+
if (resp && resp.any_done) location.reload();
|
|
481
|
+
else setTimeout(pollTasks, 3000);
|
|
482
|
+
});
|
|
483
|
+
};
|
|
484
|
+
setTimeout(pollTasks, 3000);
|
|
182
485
|
`)
|
|
183
486
|
)
|
|
184
487
|
: "",
|
|
@@ -191,6 +494,30 @@ const makeTaskList = async (req) => {
|
|
|
191
494
|
)
|
|
192
495
|
);
|
|
193
496
|
} else {
|
|
497
|
+
const planning = await MetaData.findOne({
|
|
498
|
+
type: "CopilotConstructMgr",
|
|
499
|
+
name: "planning",
|
|
500
|
+
});
|
|
501
|
+
if (planning) {
|
|
502
|
+
return div(
|
|
503
|
+
{ class: "mt-2" },
|
|
504
|
+
p(
|
|
505
|
+
i({ class: "fas fa-spinner fa-spin me-2" }),
|
|
506
|
+
"Planning tasks, please wait..."
|
|
507
|
+
),
|
|
508
|
+
script(
|
|
509
|
+
domReady(`
|
|
510
|
+
const poll = () => {
|
|
511
|
+
view_post(${JSON.stringify(viewname)}, 'planning_status', {}, (resp) => {
|
|
512
|
+
if (resp && !resp.planning) location.reload();
|
|
513
|
+
else setTimeout(poll, 3000);
|
|
514
|
+
});
|
|
515
|
+
};
|
|
516
|
+
setTimeout(poll, 3000);
|
|
517
|
+
`)
|
|
518
|
+
)
|
|
519
|
+
);
|
|
520
|
+
}
|
|
194
521
|
return div(
|
|
195
522
|
{ class: "mt-2" },
|
|
196
523
|
p("No tasks found"),
|
|
@@ -205,27 +532,59 @@ const makeTaskList = async (req) => {
|
|
|
205
532
|
}
|
|
206
533
|
};
|
|
207
534
|
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
name: "
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
535
|
+
const get_view_config_tool = {
|
|
536
|
+
type: "function",
|
|
537
|
+
function: {
|
|
538
|
+
name: "get_view_config",
|
|
539
|
+
description:
|
|
540
|
+
"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.",
|
|
541
|
+
parameters: {
|
|
542
|
+
type: "object",
|
|
543
|
+
required: ["name"],
|
|
544
|
+
properties: {
|
|
545
|
+
name: {
|
|
546
|
+
type: "string",
|
|
547
|
+
description: "The exact name of the existing view to inspect.",
|
|
548
|
+
},
|
|
549
|
+
},
|
|
550
|
+
},
|
|
551
|
+
},
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
const doGenTasks = async (spec, rs, schema, userId) => {
|
|
555
|
+
const planningMd = await MetaData.create({
|
|
220
556
|
type: "CopilotConstructMgr",
|
|
221
|
-
name: "
|
|
557
|
+
name: "planning",
|
|
558
|
+
body: {},
|
|
222
559
|
});
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
560
|
+
try {
|
|
561
|
+
const tables = await Table.find({});
|
|
562
|
+
const tableById = Object.fromEntries(tables.map((t) => [t.id, t.name]));
|
|
563
|
+
const views = await View.find({});
|
|
564
|
+
const triggers = await Trigger.find({});
|
|
565
|
+
const pages = await Page.find({});
|
|
566
|
+
const entitiesSection = existing_entities_list({
|
|
567
|
+
views,
|
|
568
|
+
triggers,
|
|
569
|
+
pages,
|
|
570
|
+
tableById,
|
|
571
|
+
});
|
|
572
|
+
const installedPlugins = await Plugin.find({});
|
|
573
|
+
const installedNames = new Set(installedPlugins.map((p) => p.name));
|
|
574
|
+
let storePlugins = [];
|
|
575
|
+
try {
|
|
576
|
+
storePlugins = await Plugin.store_plugins_available();
|
|
577
|
+
} catch (_) {}
|
|
578
|
+
const pluginsSection = available_plugins_list(storePlugins, installedNames);
|
|
579
|
+
|
|
580
|
+
const systemPrompt =
|
|
581
|
+
"You are a project manager. The user wants to build an application, and you must analyse their application description";
|
|
226
582
|
|
|
227
|
-
|
|
228
|
-
|
|
583
|
+
const tools = [get_view_config_tool, task_tool];
|
|
584
|
+
const chat = [];
|
|
585
|
+
|
|
586
|
+
let answer = await getState().functions.llm_generate.run(
|
|
587
|
+
`Generate a plan for building this application:
|
|
229
588
|
|
|
230
589
|
Description: ${spec.body.description}
|
|
231
590
|
Audience: ${spec.body.audience}
|
|
@@ -233,7 +592,7 @@ Core features: ${spec.body.core_features}
|
|
|
233
592
|
Out of scope: ${spec.body.out_of_scope}
|
|
234
593
|
Visual style: ${spec.body.visual_style}
|
|
235
594
|
|
|
236
|
-
These are the requirements of the application:
|
|
595
|
+
These are the requirements of the application:
|
|
237
596
|
|
|
238
597
|
${rs.map((r) => `* ${r.body.requirement}`).join("\n")}
|
|
239
598
|
|
|
@@ -243,55 +602,189 @@ The database has already been built. The following tables are now present in the
|
|
|
243
602
|
|
|
244
603
|
${existing_tables_list(tables)}
|
|
245
604
|
|
|
246
|
-
The plan should outline the continued development of the application on top of this database.
|
|
247
|
-
Your plan can add additional tables if needed or adjust the table fields, but normally the tables
|
|
248
|
-
should be designed optimally for this application.
|
|
605
|
+
The plan should outline the continued development of the application on top of this database.
|
|
606
|
+
Your plan can add additional tables if needed or adjust the table fields, but normally the tables
|
|
607
|
+
should be designed optimally for this application.
|
|
608
|
+
|
|
609
|
+
${entitiesSection ? entitiesSection + "\n\n" : ""}${
|
|
610
|
+
pluginsSection ? pluginsSection + "\n\n" : ""
|
|
611
|
+
}The plan should focus on building views, triggers (including workflows) and pages.
|
|
249
612
|
|
|
250
|
-
|
|
613
|
+
Important trigger planning rules:
|
|
614
|
+
* 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.
|
|
615
|
+
* 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.
|
|
616
|
+
* 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.
|
|
617
|
+
* 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.
|
|
618
|
+
* 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.
|
|
251
619
|
|
|
252
620
|
Important view planning rules:
|
|
253
|
-
*
|
|
621
|
+
* 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.
|
|
622
|
+
* 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".
|
|
623
|
+
* Edit, Show, and List views for a table always go together as three separate tasks. Whenever you plan a List view AND a Show view for the same table, you MUST also plan an Edit view for that table — a List without an Edit leaves users unable to create or modify records. Only omit the Edit view when the requirements explicitly say the data is read-only.
|
|
624
|
+
* The three tasks must be ordered: Edit and Show first (independent of each other, in any order), List last. The List task MUST list both the Edit task and the Show task in its depends_on — without exception. If you plan a List that depends on neither, that is a bug in the plan.
|
|
625
|
+
* Before finalising the plan, for every List view task, verify that its depends_on includes the corresponding Edit task and the corresponding Show task (if they exist). If either is missing, add it.
|
|
626
|
+
* 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.
|
|
627
|
+
* In general, if a view embeds or links to another view, the linked view's task must be listed as a dependency.
|
|
254
628
|
* 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."
|
|
255
629
|
* 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.
|
|
256
|
-
*
|
|
257
|
-
|
|
258
|
-
*
|
|
630
|
+
* 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'.
|
|
631
|
+
Important user account rules:
|
|
632
|
+
* 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, authentication flows, or email verification — these are already handled by the platform. Users register at /auth/signup and log in at /auth/login.
|
|
633
|
+
* 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.
|
|
634
|
+
* 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.
|
|
259
635
|
|
|
260
|
-
|
|
636
|
+
Important role rules:
|
|
637
|
+
* Every view and page task description MUST state the min_role explicitly, e.g. "Set min_role to admin (1)." or "Set min_role to user (80).". Never omit it.
|
|
638
|
+
* Role values: admin=1, staff=40, user=80, public=100. Use the value that matches who will use the view or page — admin for management, staff for staff-only, user for logged-in users (clients, members, etc.), public only when the view or page must be accessible without login.
|
|
639
|
+
|
|
640
|
+
Important home page rules:
|
|
641
|
+
* Every role should land on the right page after visiting /. Plan a single task "Set home pages by role" that depends on all relevant page tasks and configures home_page_by_role for every role in one step.
|
|
642
|
+
* Role IDs: public=100, user=80, staff=40, admin=1.
|
|
643
|
+
* Landing/marketing page (public-facing intro): min_role must be 100 (public). It MUST include visible links to /auth/login (Log in) and /auth/signup (Create an account). Set as home for role 100 (public).
|
|
644
|
+
* If there is an admin dashboard page, set it as home for role 1 (admin).
|
|
645
|
+
* If there is a dashboard or main page for regular users or staff, set it as home for role 80 (user) and/or role 40 (staff) as appropriate.
|
|
646
|
+
* The "Set home pages by role" task description must list every role→page mapping explicitly using the exact page names planned in this task list, e.g.: "Set home_page_by_role: public (100) → landing, user (80) → client_dashboard, staff (40) → staff_dashboard, admin (1) → app_admin_dashboard." Never use "admin_dashboard" as a page name — it is reserved by the platform.
|
|
647
|
+
|
|
648
|
+
Important plugin rules:
|
|
649
|
+
* 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.
|
|
650
|
+
|
|
651
|
+
Important dependency rules:
|
|
652
|
+
* Every name in a task's depends_on MUST exactly match the name field of another task in the same plan_tasks call. Never reference a name that is not present in the tasks array — not a concept, not a table name, not a made-up label. If you find yourself writing a depends_on entry whose name does not appear as a task name in the list, either add the missing task or remove the dependency.
|
|
653
|
+
* Before calling plan_tasks, mentally verify: for every task, every name in its depends_on array appears as the name of another task in the array.
|
|
261
654
|
|
|
262
655
|
Important schema/table rules:
|
|
263
656
|
* 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.
|
|
264
657
|
* 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.
|
|
265
658
|
* Do NOT plan tasks to add uniqueness constraints or validation to existing fields — those are already in the schema.
|
|
659
|
+
* 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.
|
|
266
660
|
|
|
267
|
-
Your plan should not include any clarification or questions to the product owner. The
|
|
268
|
-
information you have been given so far is all that is available. Every step in the plan
|
|
661
|
+
Your plan should not include any clarification or questions to the product owner. The
|
|
662
|
+
information you have been given so far is all that is available. Every step in the plan
|
|
269
663
|
should be immediately implementable in Saltcorn. You are writing the steps in the plan
|
|
270
664
|
for a person who is competent in using saltcorn but has no other business knowledge.
|
|
271
665
|
|
|
272
666
|
Do not include any steps that contain planning, design or review instructions. You are only writing a
|
|
273
667
|
plan for the engineer building the application. Every step in the plan should have the construction or the modification
|
|
274
|
-
of one or several application entity types.
|
|
668
|
+
of one or several application entity types.
|
|
275
669
|
|
|
276
|
-
|
|
670
|
+
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.
|
|
277
671
|
`,
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
672
|
+
{
|
|
673
|
+
tools,
|
|
674
|
+
chat,
|
|
675
|
+
appendToChat: true,
|
|
676
|
+
systemPrompt,
|
|
677
|
+
}
|
|
678
|
+
);
|
|
285
679
|
|
|
286
|
-
|
|
680
|
+
const MAX_ITERATIONS = 10;
|
|
681
|
+
let iterations = 0;
|
|
287
682
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
683
|
+
while (iterations++ < MAX_ITERATIONS) {
|
|
684
|
+
if (typeof answer !== "object" || !answer.getToolCalls) break;
|
|
685
|
+
const toolCalls = answer.getToolCalls();
|
|
686
|
+
if (!toolCalls.length) break;
|
|
687
|
+
|
|
688
|
+
const planCall = toolCalls.find((tc) => tc.tool_name === "plan_tasks");
|
|
689
|
+
if (planCall) {
|
|
690
|
+
const tasks = planCall.input.tasks;
|
|
691
|
+
const plannedNames = new Set(tasks.map((t) => t.name).filter(Boolean));
|
|
692
|
+
|
|
693
|
+
for (const task of tasks) {
|
|
694
|
+
const validDeps = (task.depends_on || []).filter((nm) => {
|
|
695
|
+
if (!plannedNames.has(nm)) {
|
|
696
|
+
getState().log(
|
|
697
|
+
2,
|
|
698
|
+
`AppConstructor: dropping phantom dependency "${nm}" from task "${task.name}" — no such task in plan`
|
|
699
|
+
);
|
|
700
|
+
return false;
|
|
701
|
+
}
|
|
702
|
+
return true;
|
|
703
|
+
});
|
|
704
|
+
await MetaData.create({
|
|
705
|
+
type: "CopilotConstructMgr",
|
|
706
|
+
name: "task",
|
|
707
|
+
body: { ...task, depends_on: validDeps },
|
|
708
|
+
user_id: userId,
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
break;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
const getViewCalls = toolCalls.filter(
|
|
715
|
+
(tc) => tc.tool_name === "get_view_config"
|
|
716
|
+
);
|
|
717
|
+
if (!getViewCalls.length) break;
|
|
718
|
+
|
|
719
|
+
for (const tc of getViewCalls) {
|
|
720
|
+
const viewName = tc.input?.name;
|
|
721
|
+
const view = viewName ? await View.findOne({ name: viewName }) : null;
|
|
722
|
+
const result = view
|
|
723
|
+
? JSON.stringify(
|
|
724
|
+
{
|
|
725
|
+
name: view.name,
|
|
726
|
+
viewtemplate: view.viewtemplate,
|
|
727
|
+
configuration: view.configuration,
|
|
728
|
+
},
|
|
729
|
+
null,
|
|
730
|
+
2
|
|
731
|
+
)
|
|
732
|
+
: `No view named "${viewName}" found.`;
|
|
733
|
+
|
|
734
|
+
if (answer.ai_sdk) {
|
|
735
|
+
chat.push({
|
|
736
|
+
role: "tool",
|
|
737
|
+
content: [
|
|
738
|
+
{
|
|
739
|
+
type: "tool-result",
|
|
740
|
+
toolCallId: tc.tool_call_id,
|
|
741
|
+
toolName: "get_view_config",
|
|
742
|
+
result,
|
|
743
|
+
},
|
|
744
|
+
],
|
|
745
|
+
});
|
|
746
|
+
} else {
|
|
747
|
+
chat.push({
|
|
748
|
+
role: "tool",
|
|
749
|
+
tool_call_id: tc.tool_call_id,
|
|
750
|
+
name: "get_view_config",
|
|
751
|
+
content: result,
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
answer = await getState().functions.llm_generate.run(null, {
|
|
757
|
+
tools,
|
|
758
|
+
chat,
|
|
759
|
+
appendToChat: true,
|
|
760
|
+
systemPrompt,
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
} finally {
|
|
764
|
+
await planningMd.delete();
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
|
|
768
|
+
const gen_tasks = async (table_id, viewname, config, body, { req, res }) => {
|
|
769
|
+
const spec = await MetaData.findOne({
|
|
770
|
+
type: "CopilotConstructMgr",
|
|
771
|
+
name: "spec",
|
|
772
|
+
});
|
|
773
|
+
if (!spec) throw new Error("Specification not found");
|
|
774
|
+
const rs = await MetaData.find({
|
|
775
|
+
type: "CopilotConstructMgr",
|
|
776
|
+
name: "requirement",
|
|
777
|
+
});
|
|
778
|
+
if (!rs.length) throw new Error("No requirements found");
|
|
779
|
+
const schema = await MetaData.findOne({
|
|
780
|
+
type: "CopilotConstructMgr",
|
|
781
|
+
name: "schema",
|
|
782
|
+
});
|
|
783
|
+
if (!schema) throw new Error("No schema found");
|
|
784
|
+
if (!schema.body.implemented) throw new Error("Schema not implemented");
|
|
785
|
+
doGenTasks(spec, rs, schema, req.user?.id).catch((e) =>
|
|
786
|
+
console.error("gen_tasks error", e)
|
|
787
|
+
);
|
|
295
788
|
return { json: { reload_page: true } };
|
|
296
789
|
};
|
|
297
790
|
|
|
@@ -306,15 +799,57 @@ const del_task = async (table_id, viewname, config, body, { req, res }) => {
|
|
|
306
799
|
};
|
|
307
800
|
const run_task = async (table_id, viewname, config, body, { req, res }) => {
|
|
308
801
|
const reqUser = req?.user;
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
802
|
+
if (body.id) {
|
|
803
|
+
runTask(body.id, { user: reqUser, __: req.__ }).catch((e) =>
|
|
804
|
+
console.error("run_task error", e)
|
|
805
|
+
);
|
|
806
|
+
return { json: { success: true } };
|
|
807
|
+
}
|
|
808
|
+
runNextTask(true).catch((e) => console.error("run_task error", e));
|
|
809
|
+
return { json: { success: true } };
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
const planning_status = async (
|
|
813
|
+
table_id,
|
|
814
|
+
viewname,
|
|
815
|
+
config,
|
|
816
|
+
body,
|
|
817
|
+
{ req, res }
|
|
818
|
+
) => {
|
|
819
|
+
const planning = await MetaData.findOne({
|
|
820
|
+
type: "CopilotConstructMgr",
|
|
821
|
+
name: "planning",
|
|
316
822
|
});
|
|
317
|
-
return { json: {
|
|
823
|
+
return { json: { planning: !!planning } };
|
|
824
|
+
};
|
|
825
|
+
|
|
826
|
+
const tasks_poll = async (table_id, viewname, config, body, { req, res }) => {
|
|
827
|
+
const tasks = await MetaData.find({
|
|
828
|
+
type: "CopilotConstructMgr",
|
|
829
|
+
name: "task",
|
|
830
|
+
});
|
|
831
|
+
return {
|
|
832
|
+
json: {
|
|
833
|
+
tasks: tasks.map((t) => ({
|
|
834
|
+
id: t.id,
|
|
835
|
+
name: t.body.name,
|
|
836
|
+
status: t.body.status || "To do",
|
|
837
|
+
run_id: t.body.run_id,
|
|
838
|
+
})),
|
|
839
|
+
},
|
|
840
|
+
};
|
|
841
|
+
};
|
|
842
|
+
|
|
843
|
+
const task_row_done = async (
|
|
844
|
+
table_id,
|
|
845
|
+
viewname,
|
|
846
|
+
config,
|
|
847
|
+
body,
|
|
848
|
+
{ req, res }
|
|
849
|
+
) => {
|
|
850
|
+
const task = await MetaData.findOne({ id: body.id });
|
|
851
|
+
if (!task) return { json: { html: "" } };
|
|
852
|
+
return { json: { html: doneTaskRowHtml(task) } };
|
|
318
853
|
};
|
|
319
854
|
|
|
320
855
|
const task_status = async (table_id, viewname, config, body, { req, res }) => {
|
|
@@ -341,7 +876,8 @@ const start = async (table_id, viewname, config, body, { req, res }) => {
|
|
|
341
876
|
name: "settings",
|
|
342
877
|
body: { running: true },
|
|
343
878
|
});
|
|
344
|
-
|
|
879
|
+
runNextTask().catch((e) => console.error("start error", e));
|
|
880
|
+
return { json: { success: true } };
|
|
345
881
|
};
|
|
346
882
|
const stop = async (table_id, viewname, config, body, { req, res }) => {
|
|
347
883
|
const settings = await MetaData.findOne({
|
|
@@ -356,7 +892,7 @@ const stop = async (table_id, viewname, config, body, { req, res }) => {
|
|
|
356
892
|
name: "settings",
|
|
357
893
|
body: { running: false },
|
|
358
894
|
});
|
|
359
|
-
return { json: {
|
|
895
|
+
return { json: { success: true } };
|
|
360
896
|
};
|
|
361
897
|
|
|
362
898
|
const mark_done_task = async (
|
|
@@ -393,7 +929,10 @@ const task_routes = {
|
|
|
393
929
|
del_all_tasks,
|
|
394
930
|
mark_done_task,
|
|
395
931
|
run_task,
|
|
932
|
+
planning_status,
|
|
396
933
|
task_status,
|
|
934
|
+
tasks_poll,
|
|
935
|
+
task_row_done,
|
|
397
936
|
start,
|
|
398
937
|
stop,
|
|
399
938
|
};
|