@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,196 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
packageName: string;
|
|
3
|
+
displayName: string;
|
|
4
|
+
description: string | undefined;
|
|
5
|
+
moduleMeta: import("@happyvertical/smrt-types").SmrtModuleMeta;
|
|
6
|
+
entries: ({
|
|
7
|
+
id: string;
|
|
8
|
+
title: string;
|
|
9
|
+
description: string;
|
|
10
|
+
loadComponent: () => Promise<typeof import("./components/AgentDashboard.svelte")>;
|
|
11
|
+
order: number;
|
|
12
|
+
props: {
|
|
13
|
+
schedules: ({
|
|
14
|
+
id: string;
|
|
15
|
+
agentType: string;
|
|
16
|
+
agentId: string;
|
|
17
|
+
agentConfig: {
|
|
18
|
+
region: string;
|
|
19
|
+
profileKey?: undefined;
|
|
20
|
+
};
|
|
21
|
+
cron: string;
|
|
22
|
+
timezone: string;
|
|
23
|
+
enabled: boolean;
|
|
24
|
+
status: string;
|
|
25
|
+
lastRun: string;
|
|
26
|
+
nextRun: string;
|
|
27
|
+
lastStatus: string;
|
|
28
|
+
lastError: null;
|
|
29
|
+
runCount: number;
|
|
30
|
+
successCount: number;
|
|
31
|
+
failureCount: number;
|
|
32
|
+
maxConcurrent: number;
|
|
33
|
+
runningCount: number;
|
|
34
|
+
timeout: number;
|
|
35
|
+
method: string;
|
|
36
|
+
methodArgs: {
|
|
37
|
+
backfill?: undefined;
|
|
38
|
+
};
|
|
39
|
+
createdAt: string;
|
|
40
|
+
updatedAt: string;
|
|
41
|
+
} | {
|
|
42
|
+
id: string;
|
|
43
|
+
agentType: string;
|
|
44
|
+
agentId: null;
|
|
45
|
+
agentConfig: {
|
|
46
|
+
profileKey: string;
|
|
47
|
+
region?: undefined;
|
|
48
|
+
};
|
|
49
|
+
cron: string;
|
|
50
|
+
timezone: string;
|
|
51
|
+
enabled: boolean;
|
|
52
|
+
status: string;
|
|
53
|
+
lastRun: string;
|
|
54
|
+
nextRun: string;
|
|
55
|
+
lastStatus: string;
|
|
56
|
+
lastError: string;
|
|
57
|
+
runCount: number;
|
|
58
|
+
successCount: number;
|
|
59
|
+
failureCount: number;
|
|
60
|
+
maxConcurrent: number;
|
|
61
|
+
runningCount: number;
|
|
62
|
+
timeout: number;
|
|
63
|
+
method: string;
|
|
64
|
+
methodArgs: {
|
|
65
|
+
backfill: boolean;
|
|
66
|
+
};
|
|
67
|
+
createdAt: string;
|
|
68
|
+
updatedAt: string;
|
|
69
|
+
})[];
|
|
70
|
+
recentHistory: ({
|
|
71
|
+
id: string;
|
|
72
|
+
scheduleId: string;
|
|
73
|
+
agentType: string;
|
|
74
|
+
status: string;
|
|
75
|
+
startedAt: string;
|
|
76
|
+
completedAt: string;
|
|
77
|
+
duration: number;
|
|
78
|
+
error: string;
|
|
79
|
+
} | {
|
|
80
|
+
id: string;
|
|
81
|
+
scheduleId: string;
|
|
82
|
+
agentType: string;
|
|
83
|
+
status: string;
|
|
84
|
+
startedAt: string;
|
|
85
|
+
completedAt: string;
|
|
86
|
+
duration: number;
|
|
87
|
+
error: null;
|
|
88
|
+
})[];
|
|
89
|
+
onScheduleClick: () => void;
|
|
90
|
+
onEnable: () => void;
|
|
91
|
+
onDisable: () => void;
|
|
92
|
+
onDelete: () => void;
|
|
93
|
+
onRunNow: () => void;
|
|
94
|
+
onCreateSchedule: () => void;
|
|
95
|
+
onHistoryEntryClick: () => void;
|
|
96
|
+
initialData?: undefined;
|
|
97
|
+
agentTypes?: undefined;
|
|
98
|
+
onSubmit?: undefined;
|
|
99
|
+
onCancel?: undefined;
|
|
100
|
+
editMode?: undefined;
|
|
101
|
+
history?: undefined;
|
|
102
|
+
onEntryClick?: undefined;
|
|
103
|
+
};
|
|
104
|
+
modes: {
|
|
105
|
+
mock: {
|
|
106
|
+
label: string;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
} | {
|
|
110
|
+
id: string;
|
|
111
|
+
title: string;
|
|
112
|
+
description: string;
|
|
113
|
+
loadComponent: () => Promise<typeof import("./components/AgentScheduleForm.svelte")>;
|
|
114
|
+
order: number;
|
|
115
|
+
props: {
|
|
116
|
+
initialData: {
|
|
117
|
+
agentType: string;
|
|
118
|
+
cron: string;
|
|
119
|
+
timezone: string;
|
|
120
|
+
enabled: boolean;
|
|
121
|
+
maxConcurrent: number;
|
|
122
|
+
timeout: number;
|
|
123
|
+
method: string;
|
|
124
|
+
};
|
|
125
|
+
agentTypes: string[];
|
|
126
|
+
onSubmit: () => void;
|
|
127
|
+
onCancel: () => void;
|
|
128
|
+
editMode: boolean;
|
|
129
|
+
schedules?: undefined;
|
|
130
|
+
recentHistory?: undefined;
|
|
131
|
+
onScheduleClick?: undefined;
|
|
132
|
+
onEnable?: undefined;
|
|
133
|
+
onDisable?: undefined;
|
|
134
|
+
onDelete?: undefined;
|
|
135
|
+
onRunNow?: undefined;
|
|
136
|
+
onCreateSchedule?: undefined;
|
|
137
|
+
onHistoryEntryClick?: undefined;
|
|
138
|
+
history?: undefined;
|
|
139
|
+
onEntryClick?: undefined;
|
|
140
|
+
};
|
|
141
|
+
modes: {
|
|
142
|
+
mock: {
|
|
143
|
+
label: string;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
} | {
|
|
147
|
+
id: string;
|
|
148
|
+
title: string;
|
|
149
|
+
description: string;
|
|
150
|
+
loadComponent: () => Promise<typeof import("./components/AgentRunHistory.svelte")>;
|
|
151
|
+
order: number;
|
|
152
|
+
props: {
|
|
153
|
+
history: ({
|
|
154
|
+
id: string;
|
|
155
|
+
scheduleId: string;
|
|
156
|
+
agentType: string;
|
|
157
|
+
status: string;
|
|
158
|
+
startedAt: string;
|
|
159
|
+
completedAt: string;
|
|
160
|
+
duration: number;
|
|
161
|
+
error: string;
|
|
162
|
+
} | {
|
|
163
|
+
id: string;
|
|
164
|
+
scheduleId: string;
|
|
165
|
+
agentType: string;
|
|
166
|
+
status: string;
|
|
167
|
+
startedAt: string;
|
|
168
|
+
completedAt: string;
|
|
169
|
+
duration: number;
|
|
170
|
+
error: null;
|
|
171
|
+
})[];
|
|
172
|
+
onEntryClick: () => void;
|
|
173
|
+
schedules?: undefined;
|
|
174
|
+
recentHistory?: undefined;
|
|
175
|
+
onScheduleClick?: undefined;
|
|
176
|
+
onEnable?: undefined;
|
|
177
|
+
onDisable?: undefined;
|
|
178
|
+
onDelete?: undefined;
|
|
179
|
+
onRunNow?: undefined;
|
|
180
|
+
onCreateSchedule?: undefined;
|
|
181
|
+
onHistoryEntryClick?: undefined;
|
|
182
|
+
initialData?: undefined;
|
|
183
|
+
agentTypes?: undefined;
|
|
184
|
+
onSubmit?: undefined;
|
|
185
|
+
onCancel?: undefined;
|
|
186
|
+
editMode?: undefined;
|
|
187
|
+
};
|
|
188
|
+
modes: {
|
|
189
|
+
mock: {
|
|
190
|
+
label: string;
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
})[];
|
|
194
|
+
};
|
|
195
|
+
export default _default;
|
|
196
|
+
//# sourceMappingURL=playground.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../../src/svelte/playground.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFA,wBA4EE"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { AGENTS_MODULE_META } from '../ui.js';
|
|
2
|
+
const noop = () => { };
|
|
3
|
+
const sampleSchedules = [
|
|
4
|
+
{
|
|
5
|
+
id: 'schedule-digest',
|
|
6
|
+
agentType: 'DailyDigestAgent',
|
|
7
|
+
agentId: 'digest-western',
|
|
8
|
+
agentConfig: { region: 'western-canada' },
|
|
9
|
+
cron: '0 7 * * *',
|
|
10
|
+
timezone: 'America/Edmonton',
|
|
11
|
+
enabled: true,
|
|
12
|
+
status: 'active',
|
|
13
|
+
lastRun: '2026-03-21T13:00:00.000Z',
|
|
14
|
+
nextRun: '2026-03-22T13:00:00.000Z',
|
|
15
|
+
lastStatus: 'success',
|
|
16
|
+
lastError: null,
|
|
17
|
+
runCount: 184,
|
|
18
|
+
successCount: 179,
|
|
19
|
+
failureCount: 5,
|
|
20
|
+
maxConcurrent: 1,
|
|
21
|
+
runningCount: 0,
|
|
22
|
+
timeout: 1800000,
|
|
23
|
+
method: 'run',
|
|
24
|
+
methodArgs: {},
|
|
25
|
+
createdAt: '2026-01-04T17:00:00.000Z',
|
|
26
|
+
updatedAt: '2026-03-21T13:02:00.000Z',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 'schedule-governance',
|
|
30
|
+
agentType: 'GovernanceWatchAgent',
|
|
31
|
+
agentId: null,
|
|
32
|
+
agentConfig: { profileKey: 'publication' },
|
|
33
|
+
cron: '*/30 * * * *',
|
|
34
|
+
timezone: 'UTC',
|
|
35
|
+
enabled: true,
|
|
36
|
+
status: 'error',
|
|
37
|
+
lastRun: '2026-03-21T16:00:00.000Z',
|
|
38
|
+
nextRun: '2026-03-21T16:30:00.000Z',
|
|
39
|
+
lastStatus: 'failed',
|
|
40
|
+
lastError: 'Readiness sync failed for one assignment.',
|
|
41
|
+
runCount: 928,
|
|
42
|
+
successCount: 901,
|
|
43
|
+
failureCount: 27,
|
|
44
|
+
maxConcurrent: 2,
|
|
45
|
+
runningCount: 1,
|
|
46
|
+
timeout: 900000,
|
|
47
|
+
method: 'reconcile',
|
|
48
|
+
methodArgs: { backfill: false },
|
|
49
|
+
createdAt: '2026-02-09T10:10:00.000Z',
|
|
50
|
+
updatedAt: '2026-03-21T16:01:11.000Z',
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
const sampleHistory = [
|
|
54
|
+
{
|
|
55
|
+
id: 'run-1',
|
|
56
|
+
scheduleId: 'schedule-governance',
|
|
57
|
+
agentType: 'GovernanceWatchAgent',
|
|
58
|
+
status: 'failed',
|
|
59
|
+
startedAt: '2026-03-21T16:00:00.000Z',
|
|
60
|
+
completedAt: '2026-03-21T16:01:11.000Z',
|
|
61
|
+
duration: 71000,
|
|
62
|
+
error: 'One assignment was missing readiness metadata.',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'run-2',
|
|
66
|
+
scheduleId: 'schedule-digest',
|
|
67
|
+
agentType: 'DailyDigestAgent',
|
|
68
|
+
status: 'success',
|
|
69
|
+
startedAt: '2026-03-21T13:00:00.000Z',
|
|
70
|
+
completedAt: '2026-03-21T13:00:18.000Z',
|
|
71
|
+
duration: 18000,
|
|
72
|
+
error: null,
|
|
73
|
+
},
|
|
74
|
+
];
|
|
75
|
+
const loadAgentDashboard = () => import('./components/AgentDashboard.svelte');
|
|
76
|
+
const loadAgentRunHistory = () => import('./components/AgentRunHistory.svelte');
|
|
77
|
+
const loadAgentScheduleForm = () => import('./components/AgentScheduleForm.svelte');
|
|
78
|
+
export default {
|
|
79
|
+
packageName: '@happyvertical/smrt-agents',
|
|
80
|
+
displayName: AGENTS_MODULE_META.displayName,
|
|
81
|
+
description: AGENTS_MODULE_META.description,
|
|
82
|
+
moduleMeta: AGENTS_MODULE_META,
|
|
83
|
+
entries: [
|
|
84
|
+
{
|
|
85
|
+
id: 'agent-dashboard',
|
|
86
|
+
title: 'Agent Dashboard',
|
|
87
|
+
description: 'Overview of active schedules, run health, and recent execution history.',
|
|
88
|
+
loadComponent: loadAgentDashboard,
|
|
89
|
+
order: 1,
|
|
90
|
+
props: {
|
|
91
|
+
schedules: sampleSchedules,
|
|
92
|
+
recentHistory: sampleHistory,
|
|
93
|
+
onScheduleClick: noop,
|
|
94
|
+
onEnable: noop,
|
|
95
|
+
onDisable: noop,
|
|
96
|
+
onDelete: noop,
|
|
97
|
+
onRunNow: noop,
|
|
98
|
+
onCreateSchedule: noop,
|
|
99
|
+
onHistoryEntryClick: noop,
|
|
100
|
+
},
|
|
101
|
+
modes: {
|
|
102
|
+
mock: {
|
|
103
|
+
label: 'Mock',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: 'agent-schedule-form',
|
|
109
|
+
title: 'Agent Schedule Form',
|
|
110
|
+
description: 'Configuration form for a scheduled agent run, with presets and execution controls.',
|
|
111
|
+
loadComponent: loadAgentScheduleForm,
|
|
112
|
+
order: 2,
|
|
113
|
+
props: {
|
|
114
|
+
initialData: {
|
|
115
|
+
agentType: 'GovernanceWatchAgent',
|
|
116
|
+
cron: '*/30 * * * *',
|
|
117
|
+
timezone: 'UTC',
|
|
118
|
+
enabled: true,
|
|
119
|
+
maxConcurrent: 2,
|
|
120
|
+
timeout: 900000,
|
|
121
|
+
method: 'reconcile',
|
|
122
|
+
},
|
|
123
|
+
agentTypes: ['DailyDigestAgent', 'GovernanceWatchAgent', 'ExportAgent'],
|
|
124
|
+
onSubmit: noop,
|
|
125
|
+
onCancel: noop,
|
|
126
|
+
editMode: true,
|
|
127
|
+
},
|
|
128
|
+
modes: {
|
|
129
|
+
mock: {
|
|
130
|
+
label: 'Mock',
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: 'agent-run-history',
|
|
136
|
+
title: 'Agent Run History',
|
|
137
|
+
description: 'Execution history table for recent schedule runs and failures.',
|
|
138
|
+
loadComponent: loadAgentRunHistory,
|
|
139
|
+
order: 3,
|
|
140
|
+
props: {
|
|
141
|
+
history: sampleHistory,
|
|
142
|
+
onEntryClick: noop,
|
|
143
|
+
},
|
|
144
|
+
modes: {
|
|
145
|
+
mock: {
|
|
146
|
+
label: 'Mock',
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for agent schedule UI components
|
|
3
|
+
*/
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
|
+
export type ScheduleStatus = 'active' | 'paused' | 'disabled' | 'error';
|
|
6
|
+
export type RunStatus = 'success' | 'failed';
|
|
7
|
+
/**
|
|
8
|
+
* Agent schedule data structure for display
|
|
9
|
+
*/
|
|
10
|
+
export interface AgentScheduleData {
|
|
11
|
+
id: string;
|
|
12
|
+
agentType: string;
|
|
13
|
+
agentId: string | null;
|
|
14
|
+
agentConfig: Record<string, unknown>;
|
|
15
|
+
cron: string;
|
|
16
|
+
timezone: string;
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
status: ScheduleStatus;
|
|
19
|
+
lastRun: Date | string | null;
|
|
20
|
+
nextRun: Date | string | null;
|
|
21
|
+
lastStatus: RunStatus | null;
|
|
22
|
+
lastError: string | null;
|
|
23
|
+
runCount: number;
|
|
24
|
+
successCount: number;
|
|
25
|
+
failureCount: number;
|
|
26
|
+
maxConcurrent: number;
|
|
27
|
+
runningCount: number;
|
|
28
|
+
timeout: number;
|
|
29
|
+
method: string;
|
|
30
|
+
methodArgs: Record<string, unknown>;
|
|
31
|
+
createdAt: Date | string;
|
|
32
|
+
updatedAt: Date | string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Agent run history entry
|
|
36
|
+
*/
|
|
37
|
+
export interface AgentRunHistoryEntry {
|
|
38
|
+
id: string;
|
|
39
|
+
scheduleId: string;
|
|
40
|
+
agentType: string;
|
|
41
|
+
status: RunStatus;
|
|
42
|
+
startedAt: Date | string;
|
|
43
|
+
completedAt: Date | string | null;
|
|
44
|
+
duration: number | null;
|
|
45
|
+
error: string | null;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Schedule form data for create/edit
|
|
49
|
+
*/
|
|
50
|
+
export interface ScheduleFormData {
|
|
51
|
+
agentType: string;
|
|
52
|
+
agentId?: string;
|
|
53
|
+
agentConfig?: Record<string, unknown>;
|
|
54
|
+
cron: string;
|
|
55
|
+
timezone?: string;
|
|
56
|
+
enabled?: boolean;
|
|
57
|
+
maxConcurrent?: number;
|
|
58
|
+
timeout?: number;
|
|
59
|
+
method?: string;
|
|
60
|
+
methodArgs?: Record<string, unknown>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* AgentScheduleList component props
|
|
64
|
+
*/
|
|
65
|
+
export interface AgentScheduleListProps {
|
|
66
|
+
/** Schedules to display */
|
|
67
|
+
schedules: AgentScheduleData[];
|
|
68
|
+
/** Loading state */
|
|
69
|
+
loading?: boolean;
|
|
70
|
+
/** Callback when schedule is clicked */
|
|
71
|
+
onScheduleClick?: (schedule: AgentScheduleData) => void;
|
|
72
|
+
/** Callback when enable is clicked */
|
|
73
|
+
onEnable?: (schedule: AgentScheduleData) => void;
|
|
74
|
+
/** Callback when disable is clicked */
|
|
75
|
+
onDisable?: (schedule: AgentScheduleData) => void;
|
|
76
|
+
/** Callback when delete is clicked */
|
|
77
|
+
onDelete?: (schedule: AgentScheduleData) => void;
|
|
78
|
+
/** Callback when run now is clicked */
|
|
79
|
+
onRunNow?: (schedule: AgentScheduleData) => void;
|
|
80
|
+
/** Empty state snippet */
|
|
81
|
+
empty?: Snippet;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* AgentScheduleForm component props
|
|
85
|
+
*/
|
|
86
|
+
export interface AgentScheduleFormProps {
|
|
87
|
+
/** Initial form data (for editing) */
|
|
88
|
+
initialData?: Partial<ScheduleFormData>;
|
|
89
|
+
/** Available agent types */
|
|
90
|
+
agentTypes?: string[];
|
|
91
|
+
/** Submit callback */
|
|
92
|
+
onSubmit?: (data: ScheduleFormData) => void;
|
|
93
|
+
/** Cancel callback */
|
|
94
|
+
onCancel?: () => void;
|
|
95
|
+
/** Loading state */
|
|
96
|
+
loading?: boolean;
|
|
97
|
+
/** Edit mode */
|
|
98
|
+
editMode?: boolean;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* AgentRunHistory component props
|
|
102
|
+
*/
|
|
103
|
+
export interface AgentRunHistoryProps {
|
|
104
|
+
/** Run history entries */
|
|
105
|
+
history: AgentRunHistoryEntry[];
|
|
106
|
+
/** Loading state */
|
|
107
|
+
loading?: boolean;
|
|
108
|
+
/** Callback when entry is clicked */
|
|
109
|
+
onEntryClick?: (entry: AgentRunHistoryEntry) => void;
|
|
110
|
+
/** Empty state snippet */
|
|
111
|
+
empty?: Snippet;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* AgentDashboard component props
|
|
115
|
+
*/
|
|
116
|
+
export interface AgentDashboardProps {
|
|
117
|
+
/** All schedules */
|
|
118
|
+
schedules: AgentScheduleData[];
|
|
119
|
+
/** Recent run history */
|
|
120
|
+
recentHistory?: AgentRunHistoryEntry[];
|
|
121
|
+
/** Loading state */
|
|
122
|
+
loading?: boolean;
|
|
123
|
+
/** Callbacks */
|
|
124
|
+
onScheduleClick?: (schedule: AgentScheduleData) => void;
|
|
125
|
+
onEnable?: (schedule: AgentScheduleData) => void;
|
|
126
|
+
onDisable?: (schedule: AgentScheduleData) => void;
|
|
127
|
+
onDelete?: (schedule: AgentScheduleData) => void;
|
|
128
|
+
onRunNow?: (schedule: AgentScheduleData) => void;
|
|
129
|
+
onCreateSchedule?: () => void;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Helper function to get status variant for Badge
|
|
133
|
+
*/
|
|
134
|
+
export declare function getScheduleStatusVariant(status: ScheduleStatus): 'default' | 'primary' | 'success' | 'warning' | 'error' | 'info';
|
|
135
|
+
/**
|
|
136
|
+
* Helper function to get run status variant
|
|
137
|
+
*/
|
|
138
|
+
export declare function getRunStatusVariant(status: RunStatus | null): 'default' | 'success' | 'error';
|
|
139
|
+
/**
|
|
140
|
+
* Helper function to format cron expression for display
|
|
141
|
+
*/
|
|
142
|
+
export declare function formatCronExpression(cron: string): string;
|
|
143
|
+
/**
|
|
144
|
+
* Helper function to format relative time
|
|
145
|
+
*/
|
|
146
|
+
export declare function formatRelativeTime(date: Date | string | null): string;
|
|
147
|
+
/**
|
|
148
|
+
* Helper function to format duration
|
|
149
|
+
*/
|
|
150
|
+
export declare function formatDuration(ms: number | null): string;
|
|
151
|
+
/**
|
|
152
|
+
* Calculate success rate
|
|
153
|
+
*/
|
|
154
|
+
export declare function calculateSuccessRate(schedule: AgentScheduleData): number | null;
|
|
155
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/svelte/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGtC,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;AAGxE,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;IAC9B,OAAO,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;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AAM,CAMxD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,iBAAiB,GAC1B,MAAM,GAAG,IAAI,CAGf"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper function to get status variant for Badge
|
|
3
|
+
*/
|
|
4
|
+
export function getScheduleStatusVariant(status) {
|
|
5
|
+
switch (status) {
|
|
6
|
+
case 'active':
|
|
7
|
+
return 'success';
|
|
8
|
+
case 'paused':
|
|
9
|
+
return 'warning';
|
|
10
|
+
case 'disabled':
|
|
11
|
+
return 'default';
|
|
12
|
+
case 'error':
|
|
13
|
+
return 'error';
|
|
14
|
+
default:
|
|
15
|
+
return 'default';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Helper function to get run status variant
|
|
20
|
+
*/
|
|
21
|
+
export function getRunStatusVariant(status) {
|
|
22
|
+
if (status === 'success')
|
|
23
|
+
return 'success';
|
|
24
|
+
if (status === 'failed')
|
|
25
|
+
return 'error';
|
|
26
|
+
return 'default';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Helper function to format cron expression for display
|
|
30
|
+
*/
|
|
31
|
+
export function formatCronExpression(cron) {
|
|
32
|
+
const parts = cron.trim().split(/\s+/);
|
|
33
|
+
if (parts.length !== 5)
|
|
34
|
+
return cron;
|
|
35
|
+
const [minute, hour, dayOfMonth, month, dayOfWeek] = parts;
|
|
36
|
+
// Common patterns
|
|
37
|
+
if (minute === '0' &&
|
|
38
|
+
hour !== '*' &&
|
|
39
|
+
dayOfMonth === '*' &&
|
|
40
|
+
month === '*' &&
|
|
41
|
+
dayOfWeek === '*') {
|
|
42
|
+
return `Daily at ${hour}:00`;
|
|
43
|
+
}
|
|
44
|
+
if (minute !== '*' &&
|
|
45
|
+
hour !== '*' &&
|
|
46
|
+
dayOfMonth === '*' &&
|
|
47
|
+
month === '*' &&
|
|
48
|
+
dayOfWeek === '0') {
|
|
49
|
+
return `Weekly on Sunday at ${hour}:${minute.padStart(2, '0')}`;
|
|
50
|
+
}
|
|
51
|
+
if (minute !== '*' &&
|
|
52
|
+
hour !== '*' &&
|
|
53
|
+
dayOfMonth === '1' &&
|
|
54
|
+
month === '*' &&
|
|
55
|
+
dayOfWeek === '*') {
|
|
56
|
+
return `Monthly on 1st at ${hour}:${minute.padStart(2, '0')}`;
|
|
57
|
+
}
|
|
58
|
+
if (minute.includes('/')) {
|
|
59
|
+
const interval = minute.split('/')[1];
|
|
60
|
+
return `Every ${interval} minutes`;
|
|
61
|
+
}
|
|
62
|
+
if (hour.includes('/')) {
|
|
63
|
+
const interval = hour.split('/')[1];
|
|
64
|
+
return `Every ${interval} hours`;
|
|
65
|
+
}
|
|
66
|
+
return cron;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Helper function to format relative time
|
|
70
|
+
*/
|
|
71
|
+
export function formatRelativeTime(date) {
|
|
72
|
+
if (!date)
|
|
73
|
+
return '-';
|
|
74
|
+
const d = typeof date === 'string' ? new Date(date) : date;
|
|
75
|
+
const now = new Date();
|
|
76
|
+
const diff = now.getTime() - d.getTime();
|
|
77
|
+
if (diff < 0) {
|
|
78
|
+
const absDiff = Math.abs(diff);
|
|
79
|
+
if (absDiff < 60000)
|
|
80
|
+
return 'in a moment';
|
|
81
|
+
if (absDiff < 3600000)
|
|
82
|
+
return `in ${Math.round(absDiff / 60000)}m`;
|
|
83
|
+
if (absDiff < 86400000)
|
|
84
|
+
return `in ${Math.round(absDiff / 3600000)}h`;
|
|
85
|
+
return `in ${Math.round(absDiff / 86400000)}d`;
|
|
86
|
+
}
|
|
87
|
+
if (diff < 60000)
|
|
88
|
+
return 'just now';
|
|
89
|
+
if (diff < 3600000)
|
|
90
|
+
return `${Math.round(diff / 60000)}m ago`;
|
|
91
|
+
if (diff < 86400000)
|
|
92
|
+
return `${Math.round(diff / 3600000)}h ago`;
|
|
93
|
+
return `${Math.round(diff / 86400000)}d ago`;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Helper function to format duration
|
|
97
|
+
*/
|
|
98
|
+
export function formatDuration(ms) {
|
|
99
|
+
if (ms === null || ms === undefined)
|
|
100
|
+
return '-';
|
|
101
|
+
if (ms < 1000)
|
|
102
|
+
return `${ms}ms`;
|
|
103
|
+
if (ms < 60000)
|
|
104
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
105
|
+
if (ms < 3600000)
|
|
106
|
+
return `${(ms / 60000).toFixed(1)}m`;
|
|
107
|
+
return `${(ms / 3600000).toFixed(1)}h`;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Calculate success rate
|
|
111
|
+
*/
|
|
112
|
+
export function calculateSuccessRate(schedule) {
|
|
113
|
+
if (schedule.runCount === 0)
|
|
114
|
+
return null;
|
|
115
|
+
return schedule.successCount / schedule.runCount;
|
|
116
|
+
}
|