@goodandready/dsh-cron 0.3.42 → 0.3.45
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/lib/client.js +998 -3987
- package/lib/llm-ask.js +2 -1
- package/lib/routes/api-actions.js +36 -6
- package/lib/routes/api-item.js +1 -1
- package/lib/routes/api-webhook.js +2 -4
- package/lib/runtimes/runner-external.js +2 -3
- package/lib/runtimes/runner-session.js +385 -0
- package/lib/runtimes/runner-turn.js +255 -0
- package/lib/runtimes/runner.js +43 -616
- package/lib/scheduler/scheduler-execution.js +4 -1
- package/lib/scheduler/scheduler-lifecycle.js +65 -0
- package/lib/scheduler/scheduler-parser.js +261 -0
- package/lib/scheduler/scheduler.js +24 -319
- package/lib/store/store-archive.js +195 -0
- package/lib/store/store-io.js +331 -0
- package/lib/store/store-loader.js +165 -0
- package/lib/store/store-migration.js +38 -0
- package/lib/store/store-settings.js +126 -0
- package/lib/store/store-stats.js +55 -0
- package/lib/store/store.js +127 -810
- package/package.json +8 -6
- package/lib/client-src/00-open.js +0 -63
- package/lib/client-src/10-locales.js +0 -540
- package/lib/client-src/20-styles.js +0 -64
- package/lib/client-src/30-utils.js +0 -372
- package/lib/client-src/40-delivery-settings.js +0 -96
- package/lib/client-src/45-dag-graph-view.js +0 -287
- package/lib/client-src/46-live-logs-modal.js +0 -108
- package/lib/client-src/47-analytics-digest-modal.js +0 -166
- package/lib/client-src/48-timeline-heatmap-view.js +0 -176
- package/lib/client-src/50-cron-screen-state.js +0 -457
- package/lib/client-src/52-cron-screen-actions.js +0 -330
- package/lib/client-src/53-cron-screen-modal-actions.js +0 -677
- package/lib/client-src/54-cron-screen-analytics-actions.js +0 -68
- package/lib/client-src/55-cron-screen-view.js +0 -378
- package/lib/client-src/60-modal-task-form-head.js +0 -581
- package/lib/client-src/62-modal-task-form-tail.js +0 -563
- package/lib/client-src/65-modal-dialogs.js +0 -350
- package/lib/client-src/70-settings-card.js +0 -453
- package/lib/client-src/75-quick-action-bar.js +0 -146
- package/lib/client-src/80-sidebar-jobs.js +0 -200
- package/lib/client-src/90-close.js +0 -219
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export function getTaskStats(store, id) {
|
|
2
|
+
const runs = store.history.get(id) || [];
|
|
3
|
+
const total = runs.length;
|
|
4
|
+
let success = 0;
|
|
5
|
+
let error = 0;
|
|
6
|
+
let timeout = 0;
|
|
7
|
+
const recentDurations = [];
|
|
8
|
+
|
|
9
|
+
for (let i = 0; i < runs.length; i++) {
|
|
10
|
+
const r = runs[i];
|
|
11
|
+
if (r.status === 'success') success++;
|
|
12
|
+
else if (r.status === 'error') error++;
|
|
13
|
+
else if (r.status === 'timeout') timeout++;
|
|
14
|
+
|
|
15
|
+
if (recentDurations.length < 10 && r.durationMs !== undefined) {
|
|
16
|
+
recentDurations.push({
|
|
17
|
+
at: r.at,
|
|
18
|
+
durationMs: r.durationMs,
|
|
19
|
+
status: r.status,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const successRate = total > 0 ? Number((success / total).toFixed(2)) : 1.0;
|
|
25
|
+
return {
|
|
26
|
+
totalRuns: total,
|
|
27
|
+
successRuns: success,
|
|
28
|
+
errorRuns: error,
|
|
29
|
+
timeoutRuns: timeout,
|
|
30
|
+
successRate,
|
|
31
|
+
recentDurations,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function getAggregatedStats(store) {
|
|
36
|
+
let totalRuns = 0;
|
|
37
|
+
let totalTokens = 0;
|
|
38
|
+
let totalCostUsd = 0;
|
|
39
|
+
let activeTasks = 0;
|
|
40
|
+
|
|
41
|
+
for (const t of store.tasks.values()) {
|
|
42
|
+
if (t.status === 'active') activeTasks++;
|
|
43
|
+
totalTokens += (t.totalTokens || 0);
|
|
44
|
+
totalCostUsd += (t.totalCostUsd || 0);
|
|
45
|
+
const h = store.history.get(t.id) || [];
|
|
46
|
+
totalRuns += h.length;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
activeTasks,
|
|
51
|
+
totalRuns,
|
|
52
|
+
totalTokens,
|
|
53
|
+
totalCostUsd: Number(totalCostUsd.toFixed(4)),
|
|
54
|
+
};
|
|
55
|
+
}
|