@happyvertical/smrt-agents 0.30.0
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/AGENTS.md +96 -0
- package/CLAUDE.md +1 -0
- package/LICENSE +7 -0
- package/README.md +139 -0
- package/dist/__smrt-register__.d.ts +2 -0
- package/dist/__smrt-register__.d.ts.map +1 -0
- package/dist/agent.d.ts +545 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/ai-config.d.ts +27 -0
- package/dist/ai-config.d.ts.map +1 -0
- package/dist/chunks/config-BYbOxt24.js +179 -0
- package/dist/chunks/config-BYbOxt24.js.map +1 -0
- package/dist/chunks/manifest-utils-DLXfTOq0.js +69 -0
- package/dist/chunks/manifest-utils-DLXfTOq0.js.map +1 -0
- package/dist/config.d.ts +117 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/identity.d.ts +19 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1477 -0
- package/dist/index.js.map +1 -0
- package/dist/interests.d.ts +291 -0
- package/dist/interests.d.ts.map +1 -0
- package/dist/manifest.json +2012 -0
- package/dist/playground.d.ts +2 -0
- package/dist/playground.d.ts.map +1 -0
- package/dist/playground.js +156 -0
- package/dist/playground.js.map +1 -0
- package/dist/schedule.d.ts +168 -0
- package/dist/schedule.d.ts.map +1 -0
- package/dist/server/action-types.d.ts +65 -0
- package/dist/server/action-types.d.ts.map +1 -0
- package/dist/server/action-types.js +2 -0
- package/dist/server/action-types.js.map +1 -0
- package/dist/server/api-routes.d.ts +57 -0
- package/dist/server/api-routes.d.ts.map +1 -0
- package/dist/server/config-loader.d.ts +17 -0
- package/dist/server/config-loader.d.ts.map +1 -0
- package/dist/server/index.d.ts +34 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/manifest-utils.d.ts +63 -0
- package/dist/server/manifest-utils.d.ts.map +1 -0
- package/dist/server/serialization.d.ts +58 -0
- package/dist/server/serialization.d.ts.map +1 -0
- package/dist/server.js +105 -0
- package/dist/server.js.map +1 -0
- package/dist/smrt-knowledge.json +983 -0
- package/dist/summary-article.d.ts +30 -0
- package/dist/summary-article.d.ts.map +1 -0
- package/dist/summary-article.js +2 -0
- package/dist/summary-article.js.map +1 -0
- package/dist/svelte/components/AgentDashboard.svelte +250 -0
- package/dist/svelte/components/AgentDashboard.svelte.d.ts +21 -0
- package/dist/svelte/components/AgentDashboard.svelte.d.ts.map +1 -0
- package/dist/svelte/components/AgentRunHistory.svelte +225 -0
- package/dist/svelte/components/AgentRunHistory.svelte.d.ts +16 -0
- package/dist/svelte/components/AgentRunHistory.svelte.d.ts.map +1 -0
- package/dist/svelte/components/AgentScheduleForm.svelte +381 -0
- package/dist/svelte/components/AgentScheduleForm.svelte.d.ts +19 -0
- package/dist/svelte/components/AgentScheduleForm.svelte.d.ts.map +1 -0
- package/dist/svelte/components/AgentScheduleList.svelte +370 -0
- package/dist/svelte/components/AgentScheduleList.svelte.d.ts +24 -0
- package/dist/svelte/components/AgentScheduleList.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ScheduleStatusBadge.svelte +23 -0
- package/dist/svelte/components/ScheduleStatusBadge.svelte.d.ts +9 -0
- package/dist/svelte/components/ScheduleStatusBadge.svelte.d.ts.map +1 -0
- package/dist/svelte/i18n.d.ts +33 -0
- package/dist/svelte/i18n.d.ts.map +1 -0
- package/dist/svelte/i18n.js +37 -0
- package/dist/svelte/index.d.ts +23 -0
- package/dist/svelte/index.d.ts.map +1 -0
- package/dist/svelte/index.js +26 -0
- package/dist/svelte/playground.d.ts +196 -0
- package/dist/svelte/playground.d.ts.map +1 -0
- package/dist/svelte/playground.js +151 -0
- package/dist/svelte/types.d.ts +155 -0
- package/dist/svelte/types.d.ts.map +1 -0
- package/dist/svelte/types.js +116 -0
- package/dist/tenant-agent.d.ts +106 -0
- package/dist/tenant-agent.d.ts.map +1 -0
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/ui.d.ts +298 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +133 -0
- package/dist/ui.js.map +1 -0
- package/dist/vite-plugin.d.ts +61 -0
- package/dist/vite-plugin.d.ts.map +1 -0
- package/dist/vite-plugin.js +173 -0
- package/dist/vite-plugin.js.map +1 -0
- package/package.json +104 -0
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* AgentScheduleList - Display a list of scheduled agents
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { useI18n } from '@happyvertical/smrt-ui/i18n';
|
|
7
|
+
import { Button } from '@happyvertical/smrt-ui/ui';
|
|
8
|
+
import type { Snippet } from 'svelte';
|
|
9
|
+
import { M } from '../i18n.js';
|
|
10
|
+
import type { AgentScheduleData } from '../types.js';
|
|
11
|
+
import {
|
|
12
|
+
calculateSuccessRate,
|
|
13
|
+
formatCronExpression,
|
|
14
|
+
formatRelativeTime,
|
|
15
|
+
} from '../types.js';
|
|
16
|
+
import ScheduleStatusBadge from './ScheduleStatusBadge.svelte';
|
|
17
|
+
|
|
18
|
+
const { t } = useI18n();
|
|
19
|
+
|
|
20
|
+
export interface Props {
|
|
21
|
+
/** Schedules to display */
|
|
22
|
+
schedules: AgentScheduleData[];
|
|
23
|
+
/** Loading state */
|
|
24
|
+
loading?: boolean;
|
|
25
|
+
/** Show actions column */
|
|
26
|
+
showActions?: boolean;
|
|
27
|
+
/** Callback when schedule is clicked */
|
|
28
|
+
onScheduleClick?: (schedule: AgentScheduleData) => void;
|
|
29
|
+
/** Callback when enable is clicked */
|
|
30
|
+
onEnable?: (schedule: AgentScheduleData) => void;
|
|
31
|
+
/** Callback when disable is clicked */
|
|
32
|
+
onDisable?: (schedule: AgentScheduleData) => void;
|
|
33
|
+
/** Callback when run now is clicked */
|
|
34
|
+
onRunNow?: (schedule: AgentScheduleData) => void;
|
|
35
|
+
/** Empty state snippet */
|
|
36
|
+
empty?: Snippet;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let {
|
|
40
|
+
schedules = [],
|
|
41
|
+
loading = false,
|
|
42
|
+
showActions = true,
|
|
43
|
+
onScheduleClick,
|
|
44
|
+
onEnable,
|
|
45
|
+
onDisable,
|
|
46
|
+
onRunNow,
|
|
47
|
+
empty,
|
|
48
|
+
}: Props = $props();
|
|
49
|
+
|
|
50
|
+
function handleRowClick(schedule: AgentScheduleData) {
|
|
51
|
+
onScheduleClick?.(schedule);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function handleToggle(schedule: AgentScheduleData, event: Event) {
|
|
55
|
+
event.stopPropagation();
|
|
56
|
+
if (schedule.enabled) {
|
|
57
|
+
onDisable?.(schedule);
|
|
58
|
+
} else {
|
|
59
|
+
onEnable?.(schedule);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function handleRunNow(schedule: AgentScheduleData, event: Event) {
|
|
64
|
+
event.stopPropagation();
|
|
65
|
+
onRunNow?.(schedule);
|
|
66
|
+
}
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<div class="schedule-list-container">
|
|
70
|
+
<table class="schedule-list" class:loading>
|
|
71
|
+
<thead class="schedule-list__head">
|
|
72
|
+
<tr>
|
|
73
|
+
<th class="schedule-list__cell">Status</th>
|
|
74
|
+
<th class="schedule-list__cell">Agent</th>
|
|
75
|
+
<th class="schedule-list__cell">Schedule</th>
|
|
76
|
+
<th class="schedule-list__cell">{t(M['agents.schedule_list.last_run'])}</th>
|
|
77
|
+
<th class="schedule-list__cell">{t(M['agents.schedule_list.next_run'])}</th>
|
|
78
|
+
<th class="schedule-list__cell">{t(M['agents.schedule_list.success_rate'])}</th>
|
|
79
|
+
<th class="schedule-list__cell">Runs</th>
|
|
80
|
+
{#if showActions}
|
|
81
|
+
<th class="schedule-list__cell">Actions</th>
|
|
82
|
+
{/if}
|
|
83
|
+
</tr>
|
|
84
|
+
</thead>
|
|
85
|
+
|
|
86
|
+
<tbody class="schedule-list__body">
|
|
87
|
+
{#if loading}
|
|
88
|
+
<tr class="schedule-list__row schedule-list__row--loading">
|
|
89
|
+
<td class="schedule-list__cell schedule-list__cell--loading" colspan="8">
|
|
90
|
+
<div class="schedule-list__loading">
|
|
91
|
+
<span class="schedule-list__spinner"></span>
|
|
92
|
+
<span>{t(M['agents.schedule_list.loading_schedules'])}</span>
|
|
93
|
+
</div>
|
|
94
|
+
</td>
|
|
95
|
+
</tr>
|
|
96
|
+
{:else if schedules.length === 0}
|
|
97
|
+
<tr class="schedule-list__row schedule-list__row--empty">
|
|
98
|
+
<td class="schedule-list__cell schedule-list__cell--empty" colspan="8">
|
|
99
|
+
{#if empty}
|
|
100
|
+
{@render empty()}
|
|
101
|
+
{:else}
|
|
102
|
+
<div class="schedule-list__empty">
|
|
103
|
+
<span>{t(M['agents.schedule_list.no_schedules_found'])}</span>
|
|
104
|
+
</div>
|
|
105
|
+
{/if}
|
|
106
|
+
</td>
|
|
107
|
+
</tr>
|
|
108
|
+
{:else}
|
|
109
|
+
{#each schedules as schedule (schedule.id)}
|
|
110
|
+
{@const successRate = calculateSuccessRate(schedule)}
|
|
111
|
+
<tr
|
|
112
|
+
class="schedule-list__row"
|
|
113
|
+
onclick={() => handleRowClick(schedule)}
|
|
114
|
+
role={onScheduleClick ? 'button' : undefined}
|
|
115
|
+
tabindex={onScheduleClick ? 0 : undefined}
|
|
116
|
+
>
|
|
117
|
+
<td class="schedule-list__cell">
|
|
118
|
+
<ScheduleStatusBadge status={schedule.status} />
|
|
119
|
+
</td>
|
|
120
|
+
<td class="schedule-list__cell schedule-list__cell--agent">
|
|
121
|
+
<span class="agent-type">{schedule.agentType}</span>
|
|
122
|
+
{#if schedule.agentId}
|
|
123
|
+
<span class="agent-id">#{schedule.agentId.slice(0, 8)}</span>
|
|
124
|
+
{/if}
|
|
125
|
+
<span class="agent-method">.{schedule.method}()</span>
|
|
126
|
+
</td>
|
|
127
|
+
<td class="schedule-list__cell schedule-list__cell--schedule">
|
|
128
|
+
<span class="cron-human">{formatCronExpression(schedule.cron)}</span>
|
|
129
|
+
<span class="cron-raw">{schedule.cron}</span>
|
|
130
|
+
</td>
|
|
131
|
+
<td class="schedule-list__cell schedule-list__cell--date">
|
|
132
|
+
<span
|
|
133
|
+
class="last-run"
|
|
134
|
+
class:success={schedule.lastStatus === 'success'}
|
|
135
|
+
class:failed={schedule.lastStatus === 'failed'}
|
|
136
|
+
>
|
|
137
|
+
{formatRelativeTime(schedule.lastRun)}
|
|
138
|
+
</span>
|
|
139
|
+
</td>
|
|
140
|
+
<td class="schedule-list__cell schedule-list__cell--date">
|
|
141
|
+
{formatRelativeTime(schedule.nextRun)}
|
|
142
|
+
</td>
|
|
143
|
+
<td class="schedule-list__cell schedule-list__cell--rate">
|
|
144
|
+
{#if successRate !== null}
|
|
145
|
+
<span
|
|
146
|
+
class="success-rate"
|
|
147
|
+
class:good={successRate >= 0.9}
|
|
148
|
+
class:warning={successRate >= 0.7 && successRate < 0.9}
|
|
149
|
+
class:bad={successRate < 0.7}
|
|
150
|
+
>
|
|
151
|
+
{(successRate * 100).toFixed(0)}%
|
|
152
|
+
</span>
|
|
153
|
+
{:else}
|
|
154
|
+
<span class="success-rate">-</span>
|
|
155
|
+
{/if}
|
|
156
|
+
</td>
|
|
157
|
+
<td class="schedule-list__cell schedule-list__cell--runs">
|
|
158
|
+
{schedule.runCount}
|
|
159
|
+
{#if schedule.runningCount > 0}
|
|
160
|
+
<span class="running-indicator">({schedule.runningCount} running)</span>
|
|
161
|
+
{/if}
|
|
162
|
+
</td>
|
|
163
|
+
{#if showActions}
|
|
164
|
+
<td class="schedule-list__cell schedule-list__cell--actions">
|
|
165
|
+
<div class="actions">
|
|
166
|
+
<Button
|
|
167
|
+
variant="secondary"
|
|
168
|
+
size="sm"
|
|
169
|
+
onclick={(event: MouseEvent) => handleToggle(schedule, event)}
|
|
170
|
+
>
|
|
171
|
+
{schedule.enabled ? 'Disable' : 'Enable'}
|
|
172
|
+
</Button>
|
|
173
|
+
{#if schedule.enabled && schedule.status === 'active'}
|
|
174
|
+
<Button
|
|
175
|
+
variant="secondary"
|
|
176
|
+
size="sm"
|
|
177
|
+
onclick={(event: MouseEvent) => handleRunNow(schedule, event)}
|
|
178
|
+
>
|
|
179
|
+
{t(M['agents.schedule_list.run_now'])}
|
|
180
|
+
</Button>
|
|
181
|
+
{/if}
|
|
182
|
+
</div>
|
|
183
|
+
</td>
|
|
184
|
+
{/if}
|
|
185
|
+
</tr>
|
|
186
|
+
{/each}
|
|
187
|
+
{/if}
|
|
188
|
+
</tbody>
|
|
189
|
+
</table>
|
|
190
|
+
</div>
|
|
191
|
+
|
|
192
|
+
<style>
|
|
193
|
+
.schedule-list-container {
|
|
194
|
+
width: 100%;
|
|
195
|
+
overflow-x: auto;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.schedule-list {
|
|
199
|
+
width: 100%;
|
|
200
|
+
border-collapse: collapse;
|
|
201
|
+
border-spacing: 0;
|
|
202
|
+
font: var(--smrt-typography-body-medium-font, 0.875rem / 1.25 sans-serif);
|
|
203
|
+
background: var(--smrt-color-surface, #ffffff);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.schedule-list.loading {
|
|
207
|
+
opacity: 0.7;
|
|
208
|
+
pointer-events: none;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.schedule-list__head {
|
|
212
|
+
background: var(--smrt-color-surface-container, #f3f4f6);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.schedule-list__head th {
|
|
216
|
+
padding: var(--smrt-spacing-sm, 0.5rem) var(--smrt-spacing-md, 1rem);
|
|
217
|
+
font-weight: var(--smrt-typography-weight-semibold, 600);
|
|
218
|
+
text-align: left;
|
|
219
|
+
white-space: nowrap;
|
|
220
|
+
border-bottom: 1px solid var(--smrt-color-outline-variant, #c4c6cf);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.schedule-list__body tr {
|
|
224
|
+
border-bottom: 1px solid var(--smrt-color-outline-variant, #c4c6cf);
|
|
225
|
+
transition: background-color var(--smrt-duration-short2, 150ms) var(--smrt-easing-standard, ease);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.schedule-list__body tr:hover:not(.schedule-list__row--loading):not(.schedule-list__row--empty) {
|
|
229
|
+
background: var(--smrt-color-surface-container-low, #f9fafb);
|
|
230
|
+
cursor: pointer;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
@media (prefers-reduced-motion: reduce) {
|
|
234
|
+
.schedule-list__body tr {
|
|
235
|
+
transition: none;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.schedule-list__spinner {
|
|
239
|
+
animation: none;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.schedule-list__cell {
|
|
244
|
+
padding: var(--smrt-spacing-sm, 0.5rem) var(--smrt-spacing-md, 1rem);
|
|
245
|
+
vertical-align: middle;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.schedule-list__cell--agent {
|
|
249
|
+
max-width: 250px;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.agent-type {
|
|
253
|
+
font-weight: var(--smrt-typography-weight-medium, 500);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.agent-id {
|
|
257
|
+
margin-left: var(--smrt-spacing-xs, 0.25rem);
|
|
258
|
+
color: var(--smrt-color-on-surface-variant, #43474e);
|
|
259
|
+
font-family: var(--smrt-font-family-mono, ui-monospace, monospace);
|
|
260
|
+
font: var(--smrt-typography-body-small-font, 0.75rem / 1.25 sans-serif);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.agent-method {
|
|
264
|
+
margin-left: var(--smrt-spacing-xs, 0.25rem);
|
|
265
|
+
color: var(--smrt-color-on-surface-variant, #43474e);
|
|
266
|
+
font-family: var(--smrt-font-family-mono, ui-monospace, monospace);
|
|
267
|
+
font: var(--smrt-typography-body-small-font, 0.75rem / 1.25 sans-serif);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.schedule-list__cell--schedule {
|
|
271
|
+
max-width: 200px;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.cron-human {
|
|
275
|
+
display: block;
|
|
276
|
+
font-weight: var(--smrt-typography-weight-medium, 500);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.cron-raw {
|
|
280
|
+
display: block;
|
|
281
|
+
font-family: var(--smrt-font-family-mono, ui-monospace, monospace);
|
|
282
|
+
font: var(--smrt-typography-body-small-font, 0.75rem / 1.25 sans-serif);
|
|
283
|
+
color: var(--smrt-color-on-surface-variant, #43474e);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.schedule-list__cell--date {
|
|
287
|
+
color: var(--smrt-color-on-surface-variant, #43474e);
|
|
288
|
+
white-space: nowrap;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.last-run.success {
|
|
292
|
+
color: var(--smrt-color-tertiary, #006c4f);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.last-run.failed {
|
|
296
|
+
color: var(--smrt-color-error, #ba1a1a);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.schedule-list__cell--rate {
|
|
300
|
+
text-align: center;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.success-rate {
|
|
304
|
+
font-weight: var(--smrt-typography-weight-semibold, 600);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.success-rate.good {
|
|
308
|
+
color: var(--smrt-color-tertiary, #006c4f);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.success-rate.warning {
|
|
312
|
+
color: var(--smrt-color-secondary, #00639b);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.success-rate.bad {
|
|
316
|
+
color: var(--smrt-color-error, #ba1a1a);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.schedule-list__cell--runs {
|
|
320
|
+
text-align: center;
|
|
321
|
+
font-family: var(--smrt-font-family-mono, monospace);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.running-indicator {
|
|
325
|
+
color: var(--color-primary, #3b82f6);
|
|
326
|
+
font-size: var(--smrt-typography-label-medium-size, 0.75rem);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.schedule-list__cell--actions {
|
|
330
|
+
white-space: nowrap;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.actions {
|
|
334
|
+
display: flex;
|
|
335
|
+
gap: var(--spacing-xs, 0.25rem);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.schedule-list__cell--loading,
|
|
339
|
+
.schedule-list__cell--empty {
|
|
340
|
+
padding: var(--spacing-xl, 2rem);
|
|
341
|
+
text-align: center;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.schedule-list__loading {
|
|
345
|
+
display: flex;
|
|
346
|
+
align-items: center;
|
|
347
|
+
justify-content: center;
|
|
348
|
+
gap: var(--spacing-sm, 0.5rem);
|
|
349
|
+
color: var(--color-text-secondary, #6b7280);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.schedule-list__spinner {
|
|
353
|
+
width: 20px;
|
|
354
|
+
height: 20px;
|
|
355
|
+
border: 2px solid var(--color-neutral-gray200, #e5e7eb);
|
|
356
|
+
border-top-color: var(--color-primary, #3b82f6);
|
|
357
|
+
border-radius: var(--smrt-radius-full, 9999px);
|
|
358
|
+
animation: spin 0.8s linear infinite;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
@keyframes spin {
|
|
362
|
+
to {
|
|
363
|
+
transform: rotate(360deg);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.schedule-list__empty {
|
|
368
|
+
color: var(--color-text-secondary, #6b7280);
|
|
369
|
+
}
|
|
370
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { AgentScheduleData } from '../types.js';
|
|
3
|
+
export interface Props {
|
|
4
|
+
/** Schedules to display */
|
|
5
|
+
schedules: AgentScheduleData[];
|
|
6
|
+
/** Loading state */
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
/** Show actions column */
|
|
9
|
+
showActions?: boolean;
|
|
10
|
+
/** Callback when schedule is clicked */
|
|
11
|
+
onScheduleClick?: (schedule: AgentScheduleData) => void;
|
|
12
|
+
/** Callback when enable is clicked */
|
|
13
|
+
onEnable?: (schedule: AgentScheduleData) => void;
|
|
14
|
+
/** Callback when disable is clicked */
|
|
15
|
+
onDisable?: (schedule: AgentScheduleData) => void;
|
|
16
|
+
/** Callback when run now is clicked */
|
|
17
|
+
onRunNow?: (schedule: AgentScheduleData) => void;
|
|
18
|
+
/** Empty state snippet */
|
|
19
|
+
empty?: Snippet;
|
|
20
|
+
}
|
|
21
|
+
declare const AgentScheduleList: import("svelte").Component<Props, {}, "">;
|
|
22
|
+
type AgentScheduleList = ReturnType<typeof AgentScheduleList>;
|
|
23
|
+
export default AgentScheduleList;
|
|
24
|
+
//# sourceMappingURL=AgentScheduleList.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentScheduleList.svelte.d.ts","sourceRoot":"","sources":["../../../src/svelte/components/AgentScheduleList.svelte.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AASrD,MAAM,WAAW,KAAK;IACpB,2BAA2B;IAC3B,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC/B,oBAAoB;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0BAA0B;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,wCAAwC;IACxC,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACxD,sCAAsC;IACtC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACjD,uCAAuC;IACvC,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAClD,uCAAuC;IACvC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACjD,0BAA0B;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAsJD,QAAA,MAAM,iBAAiB,2CAAwC,CAAC;AAChE,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* ScheduleStatusBadge - Display schedule status with appropriate styling
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { Badge } from '@happyvertical/smrt-ui/ui';
|
|
7
|
+
import type { ScheduleStatus } from '../types.js';
|
|
8
|
+
import { getScheduleStatusVariant } from '../types.js';
|
|
9
|
+
|
|
10
|
+
export interface Props {
|
|
11
|
+
status: ScheduleStatus;
|
|
12
|
+
size?: 'sm' | 'md';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const { status, size = 'sm' }: Props = $props();
|
|
16
|
+
|
|
17
|
+
const variant = $derived(getScheduleStatusVariant(status));
|
|
18
|
+
const label = $derived(status.charAt(0).toUpperCase() + status.slice(1));
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<Badge {variant} {size}>
|
|
22
|
+
{label}
|
|
23
|
+
</Badge>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ScheduleStatus } from '../types.js';
|
|
2
|
+
export interface Props {
|
|
3
|
+
status: ScheduleStatus;
|
|
4
|
+
size?: 'sm' | 'md';
|
|
5
|
+
}
|
|
6
|
+
declare const ScheduleStatusBadge: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type ScheduleStatusBadge = ReturnType<typeof ScheduleStatusBadge>;
|
|
8
|
+
export default ScheduleStatusBadge;
|
|
9
|
+
//# sourceMappingURL=ScheduleStatusBadge.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScheduleStatusBadge.svelte.d.ts","sourceRoot":"","sources":["../../../src/svelte/components/ScheduleStatusBadge.svelte.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlD,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,cAAc,CAAC;IACvB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB;AAqBD,QAAA,MAAM,mBAAmB,2CAAwC,CAAC;AAClE,KAAK,mBAAmB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAClE,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const M: {
|
|
2
|
+
readonly 'agents.dashboard.total_schedules': "agents.dashboard.total_schedules";
|
|
3
|
+
readonly 'agents.dashboard.running_now': "agents.dashboard.running_now";
|
|
4
|
+
readonly 'agents.dashboard.total_runs': "agents.dashboard.total_runs";
|
|
5
|
+
readonly 'agents.dashboard.success_rate': "agents.dashboard.success_rate";
|
|
6
|
+
readonly 'agents.dashboard.scheduled_agents': "agents.dashboard.scheduled_agents";
|
|
7
|
+
readonly 'agents.dashboard.new_schedule': "agents.dashboard.new_schedule";
|
|
8
|
+
readonly 'agents.dashboard.no_scheduled_agents': "agents.dashboard.no_scheduled_agents";
|
|
9
|
+
readonly 'agents.dashboard.create_first_schedule': "agents.dashboard.create_first_schedule";
|
|
10
|
+
readonly 'agents.dashboard.recent_runs': "agents.dashboard.recent_runs";
|
|
11
|
+
readonly 'agents.run_history.loading_history': "agents.run_history.loading_history";
|
|
12
|
+
readonly 'agents.run_history.no_run_history': "agents.run_history.no_run_history";
|
|
13
|
+
readonly 'agents.schedule_form.agent_type': "agents.schedule_form.agent_type";
|
|
14
|
+
readonly 'agents.schedule_form.select_agent_type': "agents.schedule_form.select_agent_type";
|
|
15
|
+
readonly 'agents.schedule_form.agent_type_placeholder': "agents.schedule_form.agent_type_placeholder";
|
|
16
|
+
readonly 'agents.schedule_form.agent_id': "agents.schedule_form.agent_id";
|
|
17
|
+
readonly 'agents.schedule_form.agent_id_placeholder': "agents.schedule_form.agent_id_placeholder";
|
|
18
|
+
readonly 'agents.schedule_form.agent_id_hint': "agents.schedule_form.agent_id_hint";
|
|
19
|
+
readonly 'agents.schedule_form.method_placeholder': "agents.schedule_form.method_placeholder";
|
|
20
|
+
readonly 'agents.schedule_form.method_hint': "agents.schedule_form.method_hint";
|
|
21
|
+
readonly 'agents.schedule_form.cron_schedule': "agents.schedule_form.cron_schedule";
|
|
22
|
+
readonly 'agents.schedule_form.cron_hint': "agents.schedule_form.cron_hint";
|
|
23
|
+
readonly 'agents.schedule_form.max_concurrent': "agents.schedule_form.max_concurrent";
|
|
24
|
+
readonly 'agents.schedule_form.max_concurrent_hint': "agents.schedule_form.max_concurrent_hint";
|
|
25
|
+
readonly 'agents.schedule_form.enable_schedule_immediately': "agents.schedule_form.enable_schedule_immediately";
|
|
26
|
+
readonly 'agents.schedule_list.last_run': "agents.schedule_list.last_run";
|
|
27
|
+
readonly 'agents.schedule_list.next_run': "agents.schedule_list.next_run";
|
|
28
|
+
readonly 'agents.schedule_list.success_rate': "agents.schedule_list.success_rate";
|
|
29
|
+
readonly 'agents.schedule_list.loading_schedules': "agents.schedule_list.loading_schedules";
|
|
30
|
+
readonly 'agents.schedule_list.no_schedules_found': "agents.schedule_list.no_schedules_found";
|
|
31
|
+
readonly 'agents.schedule_list.run_now': "agents.schedule_list.run_now";
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=i18n.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/svelte/i18n.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CZ,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { defineMessages } from '@happyvertical/smrt-ui/i18n';
|
|
2
|
+
export const M = defineMessages({
|
|
3
|
+
// AgentDashboard
|
|
4
|
+
'agents.dashboard.total_schedules': 'Total Schedules',
|
|
5
|
+
'agents.dashboard.running_now': 'Running Now',
|
|
6
|
+
'agents.dashboard.total_runs': 'Total Runs',
|
|
7
|
+
'agents.dashboard.success_rate': 'Success Rate',
|
|
8
|
+
'agents.dashboard.scheduled_agents': 'Scheduled Agents',
|
|
9
|
+
'agents.dashboard.new_schedule': 'New Schedule',
|
|
10
|
+
'agents.dashboard.no_scheduled_agents': 'No scheduled agents',
|
|
11
|
+
'agents.dashboard.create_first_schedule': 'Create First Schedule',
|
|
12
|
+
'agents.dashboard.recent_runs': 'Recent Runs',
|
|
13
|
+
// AgentRunHistory
|
|
14
|
+
'agents.run_history.loading_history': 'Loading history...',
|
|
15
|
+
'agents.run_history.no_run_history': 'No run history',
|
|
16
|
+
// AgentScheduleForm
|
|
17
|
+
'agents.schedule_form.agent_type': 'Agent Type *',
|
|
18
|
+
'agents.schedule_form.select_agent_type': 'Select agent type...',
|
|
19
|
+
'agents.schedule_form.agent_type_placeholder': 'e.g., Praeco, Scraper',
|
|
20
|
+
'agents.schedule_form.agent_id': 'Agent ID (optional)',
|
|
21
|
+
'agents.schedule_form.agent_id_placeholder': 'Specific instance ID',
|
|
22
|
+
'agents.schedule_form.agent_id_hint': 'Leave empty to create a new instance for each run',
|
|
23
|
+
'agents.schedule_form.method_placeholder': 'run',
|
|
24
|
+
'agents.schedule_form.method_hint': 'Method to call on the agent (default: run)',
|
|
25
|
+
'agents.schedule_form.cron_schedule': 'Cron Schedule *',
|
|
26
|
+
'agents.schedule_form.cron_hint': 'Standard 5-field cron format: minute hour day-of-month month day-of-week',
|
|
27
|
+
'agents.schedule_form.max_concurrent': 'Max Concurrent',
|
|
28
|
+
'agents.schedule_form.max_concurrent_hint': 'Maximum concurrent runs (prevents overlapping)',
|
|
29
|
+
'agents.schedule_form.enable_schedule_immediately': 'Enable schedule immediately',
|
|
30
|
+
// AgentScheduleList
|
|
31
|
+
'agents.schedule_list.last_run': 'Last Run',
|
|
32
|
+
'agents.schedule_list.next_run': 'Next Run',
|
|
33
|
+
'agents.schedule_list.success_rate': 'Success Rate',
|
|
34
|
+
'agents.schedule_list.loading_schedules': 'Loading schedules...',
|
|
35
|
+
'agents.schedule_list.no_schedules_found': 'No schedules found',
|
|
36
|
+
'agents.schedule_list.run_now': 'Run Now',
|
|
37
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agents Module Svelte Components
|
|
3
|
+
*
|
|
4
|
+
* Optional Svelte UI components for agent schedule management.
|
|
5
|
+
* Auto-registers components with ModuleUIRegistry on import.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import type { ComponentProps } from 'svelte';
|
|
10
|
+
import AgentDashboard from './components/AgentDashboard.svelte';
|
|
11
|
+
import AgentRunHistory from './components/AgentRunHistory.svelte';
|
|
12
|
+
import AgentScheduleForm from './components/AgentScheduleForm.svelte';
|
|
13
|
+
import AgentScheduleList from './components/AgentScheduleList.svelte';
|
|
14
|
+
import ScheduleStatusBadge from './components/ScheduleStatusBadge.svelte';
|
|
15
|
+
export { AgentDashboard, AgentRunHistory, AgentScheduleForm, AgentScheduleList, ScheduleStatusBadge, };
|
|
16
|
+
export type AgentDashboardProps = ComponentProps<typeof AgentDashboard>;
|
|
17
|
+
export type AgentRunHistoryProps = ComponentProps<typeof AgentRunHistory>;
|
|
18
|
+
export type AgentScheduleFormProps = ComponentProps<typeof AgentScheduleForm>;
|
|
19
|
+
export type AgentScheduleListProps = ComponentProps<typeof AgentScheduleList>;
|
|
20
|
+
export type ScheduleStatusBadgeProps = ComponentProps<typeof ScheduleStatusBadge>;
|
|
21
|
+
export type { AgentDashboardProps as AgentDashboardPropsLegacy, AgentRunHistoryEntry, AgentRunHistoryProps as AgentRunHistoryPropsLegacy, AgentScheduleData, AgentScheduleFormProps as AgentScheduleFormPropsLegacy, AgentScheduleListProps as AgentScheduleListPropsLegacy, RunStatus, ScheduleFormData, ScheduleStatus, } from './types.js';
|
|
22
|
+
export { calculateSuccessRate, formatCronExpression, formatDuration, formatRelativeTime, getRunStatusVariant, getScheduleStatusVariant, } from './types.js';
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/svelte/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAI7C,OAAO,cAAc,MAAM,oCAAoC,CAAC;AAChE,OAAO,eAAe,MAAM,qCAAqC,CAAC;AAClE,OAAO,iBAAiB,MAAM,uCAAuC,CAAC;AACtE,OAAO,iBAAiB,MAAM,uCAAuC,CAAC;AACtE,OAAO,mBAAmB,MAAM,yCAAyC,CAAC;AAG1E,OAAO,EACL,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,GACpB,CAAC;AAGF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,cAAc,CAAC,CAAC;AACxE,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,OAAO,eAAe,CAAC,CAAC;AAC1E,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9E,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9E,MAAM,MAAM,wBAAwB,GAAG,cAAc,CACnD,OAAO,mBAAmB,CAC3B,CAAC;AAGF,YAAY,EACV,mBAAmB,IAAI,yBAAyB,EAChD,oBAAoB,EACpB,oBAAoB,IAAI,0BAA0B,EAClD,iBAAiB,EACjB,sBAAsB,IAAI,4BAA4B,EACtD,sBAAsB,IAAI,4BAA4B,EACtD,SAAS,EACT,gBAAgB,EAChB,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agents Module Svelte Components
|
|
3
|
+
*
|
|
4
|
+
* Optional Svelte UI components for agent schedule management.
|
|
5
|
+
* Auto-registers components with ModuleUIRegistry on import.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import { ModuleUIRegistry } from '@happyvertical/smrt-ui/registry';
|
|
10
|
+
import { AGENTS_MODULE_META } from '../ui.js';
|
|
11
|
+
// Import components
|
|
12
|
+
import AgentDashboard from './components/AgentDashboard.svelte';
|
|
13
|
+
import AgentRunHistory from './components/AgentRunHistory.svelte';
|
|
14
|
+
import AgentScheduleForm from './components/AgentScheduleForm.svelte';
|
|
15
|
+
import AgentScheduleList from './components/AgentScheduleList.svelte';
|
|
16
|
+
import ScheduleStatusBadge from './components/ScheduleStatusBadge.svelte';
|
|
17
|
+
// Export components
|
|
18
|
+
export { AgentDashboard, AgentRunHistory, AgentScheduleForm, AgentScheduleList, ScheduleStatusBadge, };
|
|
19
|
+
export { calculateSuccessRate, formatCronExpression, formatDuration, formatRelativeTime, getRunStatusVariant, getScheduleStatusVariant, } from './types.js';
|
|
20
|
+
// Auto-register with ModuleUIRegistry
|
|
21
|
+
ModuleUIRegistry.registerModule(AGENTS_MODULE_META);
|
|
22
|
+
ModuleUIRegistry.register('@happyvertical/smrt-agents', 'agent-dashboard', AgentDashboard);
|
|
23
|
+
ModuleUIRegistry.register('@happyvertical/smrt-agents', 'agent-schedule-list', AgentScheduleList);
|
|
24
|
+
ModuleUIRegistry.register('@happyvertical/smrt-agents', 'agent-schedule-form', AgentScheduleForm);
|
|
25
|
+
ModuleUIRegistry.register('@happyvertical/smrt-agents', 'agent-run-history', AgentRunHistory);
|
|
26
|
+
ModuleUIRegistry.register('@happyvertical/smrt-agents', 'schedule-status-badge', ScheduleStatusBadge);
|