clay-server 2.27.0-beta.13 → 2.27.0-beta.14
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/README.md +10 -0
- package/lib/daemon-projects.js +164 -0
- package/lib/daemon.js +11 -124
- package/lib/mates-identity.js +132 -0
- package/lib/mates-knowledge.js +113 -0
- package/lib/mates-prompts.js +398 -0
- package/lib/mates.js +40 -599
- package/lib/public/app.js +2 -0
- package/lib/public/modules/app-connection.js +4 -4
- package/lib/public/modules/app-header.js +3 -3
- package/lib/public/modules/app-messages.js +4 -0
- package/lib/public/modules/app-projects.js +8 -0
- package/lib/public/modules/input.js +30 -20
- package/lib/public/modules/scheduler-config.js +1532 -0
- package/lib/public/modules/scheduler-history.js +79 -0
- package/lib/public/modules/scheduler.js +33 -1554
- package/lib/sdk-bridge.js +26 -707
- package/lib/sdk-message-processor.js +573 -0
- package/lib/sdk-message-queue.js +42 -0
- package/lib/sdk-skill-discovery.js +131 -0
- package/lib/users-auth.js +146 -0
- package/lib/users-permissions.js +118 -0
- package/lib/users-preferences.js +210 -0
- package/lib/users.js +48 -398
- package/lib/ws-schema.js +498 -0
- package/package.json +1 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scheduler history module — Run history rendering and schedule event handlers.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from scheduler.js to keep module sizes manageable.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { renderMarkdown } from './markdown.js';
|
|
8
|
+
|
|
9
|
+
var histCtx = null;
|
|
10
|
+
|
|
11
|
+
// --- Init ---
|
|
12
|
+
|
|
13
|
+
export function initSchedulerHistory(_histCtx) {
|
|
14
|
+
histCtx = _histCtx;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// --- History rendering ---
|
|
18
|
+
|
|
19
|
+
export function renderHistory(runs) {
|
|
20
|
+
var el = document.getElementById("sched-history");
|
|
21
|
+
if (!el || !runs || runs.length === 0) { if (el) el.innerHTML = '<div class="sched-history-empty">No runs yet</div>'; return; }
|
|
22
|
+
var html = "";
|
|
23
|
+
var sorted = runs.slice().reverse();
|
|
24
|
+
for (var i = 0; i < sorted.length; i++) {
|
|
25
|
+
var run = sorted[i];
|
|
26
|
+
html += '<div class="sched-history-item"><span class="sched-history-dot ' + (run.result || "") + '"></span>';
|
|
27
|
+
html += '<span class="sched-history-date">' + histCtx.formatDateTime(new Date(run.startedAt)) + '</span>';
|
|
28
|
+
html += '<span class="sched-history-result">' + (run.result || "?") + '</span>';
|
|
29
|
+
html += '<span class="sched-history-iterations">' + (run.iterations || 0) + ' iter</span></div>';
|
|
30
|
+
}
|
|
31
|
+
el.innerHTML = html;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// --- Message handlers ---
|
|
35
|
+
|
|
36
|
+
export function handleLoopRegistryUpdated(msg) {
|
|
37
|
+
histCtx.setRecords(msg.records || []);
|
|
38
|
+
if (histCtx.isPanelOpen()) {
|
|
39
|
+
histCtx.renderSidebar();
|
|
40
|
+
var mode = histCtx.getCurrentMode();
|
|
41
|
+
if (mode === "calendar") histCtx.render();
|
|
42
|
+
else if (mode === "detail") histCtx.renderDetail();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function handleLoopRegistryFiles(msg) {
|
|
47
|
+
if (!histCtx.isPanelOpen() || histCtx.getCurrentMode() !== "detail") return;
|
|
48
|
+
if (msg.id !== histCtx.getSelectedTaskId()) return;
|
|
49
|
+
var bodyEl = document.getElementById("scheduler-detail-body");
|
|
50
|
+
if (!bodyEl) return;
|
|
51
|
+
var contentDetailEl = histCtx.getContentDetailEl();
|
|
52
|
+
var activeTab = contentDetailEl ? contentDetailEl.querySelector(".scheduler-detail-tab.active") : null;
|
|
53
|
+
var tab = activeTab ? activeTab.dataset.tab : "prompt";
|
|
54
|
+
if (tab === "prompt") {
|
|
55
|
+
bodyEl.innerHTML = msg.prompt ? '<div class="md-content">' + renderMarkdown(msg.prompt) + '</div>' : '<div class="scheduler-empty">No PROMPT.md found</div>';
|
|
56
|
+
} else if (tab === "judge") {
|
|
57
|
+
bodyEl.innerHTML = msg.judge ? '<div class="md-content">' + renderMarkdown(msg.judge) + '</div>' : '<div class="scheduler-empty">No JUDGE.md found</div>';
|
|
58
|
+
}
|
|
59
|
+
// Disable "Run now" if PROMPT.md is missing
|
|
60
|
+
var runBtn = contentDetailEl ? contentDetailEl.querySelector('[data-action="run"]') : null;
|
|
61
|
+
if (runBtn) {
|
|
62
|
+
var filesReady = !!msg.prompt;
|
|
63
|
+
runBtn.disabled = !filesReady;
|
|
64
|
+
runBtn.title = filesReady ? "Run now" : "PROMPT.md is required to run";
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function handleScheduleRunStarted(msg) {
|
|
69
|
+
if (histCtx.isPanelOpen()) histCtx.render();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function handleScheduleRunFinished(msg) {
|
|
73
|
+
histCtx.send({ type: "loop_registry_list" });
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function handleLoopScheduled(msg) {
|
|
77
|
+
// A loop was just registered as scheduled (from approval bar)
|
|
78
|
+
histCtx.send({ type: "loop_registry_list" });
|
|
79
|
+
}
|