@sentry/junior-scheduler 0.88.0 → 0.90.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/dist/index.js +198 -158
- package/dist/schedule-tools.d.ts +6 -19
- package/dist/tool-support.d.ts +275 -0
- package/dist/tools/create-task.d.ts +54 -0
- package/dist/tools/delete-task.d.ts +49 -0
- package/dist/tools/list-tasks.d.ts +48 -0
- package/dist/tools/run-task-now.d.ts +49 -0
- package/dist/tools/update-task.d.ts +55 -0
- package/package.json +2 -3
- package/src/plugin.ts +2 -2
- package/src/schedule-tools.ts +6 -692
- package/src/tool-support.ts +471 -0
- package/src/tools/create-task.ts +121 -0
- package/src/tools/delete-task.ts +48 -0
- package/src/tools/list-tasks.ts +42 -0
- package/src/tools/run-task-now.ts +53 -0
- package/src/tools/update-task.ts +121 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { type PluginCredentialSubject, type SlackDestination, type SlackRequester, type SlackSource } from "@sentry/junior-plugin-api";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { type SchedulerStore } from "./store";
|
|
4
|
+
import type { ScheduledTask, ScheduledTaskConversationAccess, ScheduledTaskPrincipal, ScheduledTaskRecurrence, ScheduledTaskStatus } from "./types";
|
|
5
|
+
export interface SchedulerToolContext {
|
|
6
|
+
credentialSubject?: PluginCredentialSubject;
|
|
7
|
+
requester?: SlackRequester;
|
|
8
|
+
source?: SlackSource;
|
|
9
|
+
store: SchedulerStore;
|
|
10
|
+
userText?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const MAX_LISTED_TASKS = 50;
|
|
13
|
+
declare const compactTaskResultSchema: z.ZodObject<{
|
|
14
|
+
id: z.ZodString;
|
|
15
|
+
status: z.ZodEnum<{
|
|
16
|
+
blocked: "blocked";
|
|
17
|
+
active: "active";
|
|
18
|
+
paused: "paused";
|
|
19
|
+
deleted: "deleted";
|
|
20
|
+
}>;
|
|
21
|
+
task: z.ZodString;
|
|
22
|
+
schedule: z.ZodString;
|
|
23
|
+
timezone: z.ZodString;
|
|
24
|
+
recurrence: z.ZodNullable<z.ZodUnknown>;
|
|
25
|
+
next_run_at: z.ZodNullable<z.ZodString>;
|
|
26
|
+
conversation_access: z.ZodNullable<z.ZodUnknown>;
|
|
27
|
+
credential_subject: z.ZodNullable<z.ZodUnknown>;
|
|
28
|
+
last_run_at: z.ZodNullable<z.ZodString>;
|
|
29
|
+
run_now_at: z.ZodNullable<z.ZodString>;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
export declare const scheduleTaskToolResultSchema: z.ZodObject<{
|
|
32
|
+
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
33
|
+
continuation: z.ZodOptional<z.ZodObject<{
|
|
34
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
35
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, z.core.$strict>>;
|
|
37
|
+
error: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
38
|
+
kind: z.ZodString;
|
|
39
|
+
message: z.ZodString;
|
|
40
|
+
retryable: z.ZodOptional<z.ZodBoolean>;
|
|
41
|
+
}, z.core.$strict>, z.ZodString]>>;
|
|
42
|
+
ok: z.ZodLiteral<true>;
|
|
43
|
+
status: z.ZodLiteral<"success">;
|
|
44
|
+
target: z.ZodString;
|
|
45
|
+
data: z.ZodObject<{
|
|
46
|
+
ok: z.ZodLiteral<true>;
|
|
47
|
+
task: z.ZodObject<{
|
|
48
|
+
id: z.ZodString;
|
|
49
|
+
status: z.ZodEnum<{
|
|
50
|
+
blocked: "blocked";
|
|
51
|
+
active: "active";
|
|
52
|
+
paused: "paused";
|
|
53
|
+
deleted: "deleted";
|
|
54
|
+
}>;
|
|
55
|
+
task: z.ZodString;
|
|
56
|
+
schedule: z.ZodString;
|
|
57
|
+
timezone: z.ZodString;
|
|
58
|
+
recurrence: z.ZodNullable<z.ZodUnknown>;
|
|
59
|
+
next_run_at: z.ZodNullable<z.ZodString>;
|
|
60
|
+
conversation_access: z.ZodNullable<z.ZodUnknown>;
|
|
61
|
+
credential_subject: z.ZodNullable<z.ZodUnknown>;
|
|
62
|
+
last_run_at: z.ZodNullable<z.ZodString>;
|
|
63
|
+
run_now_at: z.ZodNullable<z.ZodString>;
|
|
64
|
+
}, z.core.$strict>;
|
|
65
|
+
}, z.core.$strict>;
|
|
66
|
+
task: z.ZodObject<{
|
|
67
|
+
id: z.ZodString;
|
|
68
|
+
status: z.ZodEnum<{
|
|
69
|
+
blocked: "blocked";
|
|
70
|
+
active: "active";
|
|
71
|
+
paused: "paused";
|
|
72
|
+
deleted: "deleted";
|
|
73
|
+
}>;
|
|
74
|
+
task: z.ZodString;
|
|
75
|
+
schedule: z.ZodString;
|
|
76
|
+
timezone: z.ZodString;
|
|
77
|
+
recurrence: z.ZodNullable<z.ZodUnknown>;
|
|
78
|
+
next_run_at: z.ZodNullable<z.ZodString>;
|
|
79
|
+
conversation_access: z.ZodNullable<z.ZodUnknown>;
|
|
80
|
+
credential_subject: z.ZodNullable<z.ZodUnknown>;
|
|
81
|
+
last_run_at: z.ZodNullable<z.ZodString>;
|
|
82
|
+
run_now_at: z.ZodNullable<z.ZodString>;
|
|
83
|
+
}, z.core.$strict>;
|
|
84
|
+
}, z.core.$loose>;
|
|
85
|
+
export declare const scheduleListToolResultSchema: z.ZodObject<{
|
|
86
|
+
continuation: z.ZodOptional<z.ZodObject<{
|
|
87
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
88
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
89
|
+
}, z.core.$strict>>;
|
|
90
|
+
error: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
91
|
+
kind: z.ZodString;
|
|
92
|
+
message: z.ZodString;
|
|
93
|
+
retryable: z.ZodOptional<z.ZodBoolean>;
|
|
94
|
+
}, z.core.$strict>, z.ZodString]>>;
|
|
95
|
+
ok: z.ZodLiteral<true>;
|
|
96
|
+
status: z.ZodLiteral<"success">;
|
|
97
|
+
target: z.ZodString;
|
|
98
|
+
data: z.ZodObject<{
|
|
99
|
+
ok: z.ZodLiteral<true>;
|
|
100
|
+
tasks: z.ZodArray<z.ZodObject<{
|
|
101
|
+
id: z.ZodString;
|
|
102
|
+
status: z.ZodEnum<{
|
|
103
|
+
blocked: "blocked";
|
|
104
|
+
active: "active";
|
|
105
|
+
paused: "paused";
|
|
106
|
+
deleted: "deleted";
|
|
107
|
+
}>;
|
|
108
|
+
task: z.ZodString;
|
|
109
|
+
schedule: z.ZodString;
|
|
110
|
+
timezone: z.ZodString;
|
|
111
|
+
recurrence: z.ZodNullable<z.ZodUnknown>;
|
|
112
|
+
next_run_at: z.ZodNullable<z.ZodString>;
|
|
113
|
+
conversation_access: z.ZodNullable<z.ZodUnknown>;
|
|
114
|
+
credential_subject: z.ZodNullable<z.ZodUnknown>;
|
|
115
|
+
last_run_at: z.ZodNullable<z.ZodString>;
|
|
116
|
+
run_now_at: z.ZodNullable<z.ZodString>;
|
|
117
|
+
}, z.core.$strict>>;
|
|
118
|
+
truncated: z.ZodBoolean;
|
|
119
|
+
}, z.core.$strict>;
|
|
120
|
+
tasks: z.ZodArray<z.ZodObject<{
|
|
121
|
+
id: z.ZodString;
|
|
122
|
+
status: z.ZodEnum<{
|
|
123
|
+
blocked: "blocked";
|
|
124
|
+
active: "active";
|
|
125
|
+
paused: "paused";
|
|
126
|
+
deleted: "deleted";
|
|
127
|
+
}>;
|
|
128
|
+
task: z.ZodString;
|
|
129
|
+
schedule: z.ZodString;
|
|
130
|
+
timezone: z.ZodString;
|
|
131
|
+
recurrence: z.ZodNullable<z.ZodUnknown>;
|
|
132
|
+
next_run_at: z.ZodNullable<z.ZodString>;
|
|
133
|
+
conversation_access: z.ZodNullable<z.ZodUnknown>;
|
|
134
|
+
credential_subject: z.ZodNullable<z.ZodUnknown>;
|
|
135
|
+
last_run_at: z.ZodNullable<z.ZodString>;
|
|
136
|
+
run_now_at: z.ZodNullable<z.ZodString>;
|
|
137
|
+
}, z.core.$strict>>;
|
|
138
|
+
truncated: z.ZodBoolean;
|
|
139
|
+
}, z.core.$loose>;
|
|
140
|
+
export type CompactTaskResult = z.output<typeof compactTaskResultSchema>;
|
|
141
|
+
/** Normalize scheduler validation failures into the plugin tool error contract. */
|
|
142
|
+
export declare function throwToolInputError(error: string): never;
|
|
143
|
+
/** Require scheduler mutations to stay scoped to the active Slack conversation. */
|
|
144
|
+
export declare function requireActiveConversation(context: SchedulerToolContext): SlackDestination;
|
|
145
|
+
/** Require a concrete Slack requester before creating scheduler ownership state. */
|
|
146
|
+
export declare function requireRequester(context: SchedulerToolContext): ScheduledTaskPrincipal;
|
|
147
|
+
/** Preserve destination visibility so scheduled work can replay with matching access. */
|
|
148
|
+
export declare function getConversationAccess(destination: SlackDestination): ScheduledTaskConversationAccess;
|
|
149
|
+
/** Carry private-DM credential authority only when scheduled work is allowed to reuse it. */
|
|
150
|
+
export declare function getCredentialSubject(args: {
|
|
151
|
+
access: ScheduledTaskConversationAccess;
|
|
152
|
+
subject: PluginCredentialSubject | undefined;
|
|
153
|
+
}): PluginCredentialSubject | undefined;
|
|
154
|
+
/** Keep scheduler management operations bound to the task's original Slack destination. */
|
|
155
|
+
export declare function sameDestination(task: ScheduledTask, destination: SlackDestination): boolean;
|
|
156
|
+
/** Look up a mutable task only after enforcing active-conversation ownership. */
|
|
157
|
+
export declare function getWritableTask(args: {
|
|
158
|
+
context: SchedulerToolContext;
|
|
159
|
+
taskId: string;
|
|
160
|
+
}): Promise<ScheduledTask>;
|
|
161
|
+
/** Project scheduled task state into the stable model-facing result shape. */
|
|
162
|
+
export declare function compactTask(task: ScheduledTask): CompactTaskResult;
|
|
163
|
+
/** Build the structured result shared by single-task scheduler tools. */
|
|
164
|
+
export declare function scheduleTaskToolResult(target: string, task: CompactTaskResult): {
|
|
165
|
+
readonly ok: true;
|
|
166
|
+
readonly status: "success";
|
|
167
|
+
readonly target: string;
|
|
168
|
+
readonly data: {
|
|
169
|
+
readonly ok: true;
|
|
170
|
+
readonly task: {
|
|
171
|
+
id: string;
|
|
172
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
173
|
+
task: string;
|
|
174
|
+
schedule: string;
|
|
175
|
+
timezone: string;
|
|
176
|
+
recurrence: unknown;
|
|
177
|
+
next_run_at: string | null;
|
|
178
|
+
conversation_access: unknown;
|
|
179
|
+
credential_subject: unknown;
|
|
180
|
+
last_run_at: string | null;
|
|
181
|
+
run_now_at: string | null;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
readonly task: {
|
|
185
|
+
id: string;
|
|
186
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
187
|
+
task: string;
|
|
188
|
+
schedule: string;
|
|
189
|
+
timezone: string;
|
|
190
|
+
recurrence: unknown;
|
|
191
|
+
next_run_at: string | null;
|
|
192
|
+
conversation_access: unknown;
|
|
193
|
+
credential_subject: unknown;
|
|
194
|
+
last_run_at: string | null;
|
|
195
|
+
run_now_at: string | null;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
/** Build the structured result for listing scheduler tools. */
|
|
199
|
+
export declare function scheduleListToolResult(args: {
|
|
200
|
+
target: string;
|
|
201
|
+
tasks: CompactTaskResult[];
|
|
202
|
+
truncated: boolean;
|
|
203
|
+
}): {
|
|
204
|
+
readonly ok: true;
|
|
205
|
+
readonly status: "success";
|
|
206
|
+
readonly target: string;
|
|
207
|
+
readonly data: {
|
|
208
|
+
readonly ok: true;
|
|
209
|
+
readonly tasks: {
|
|
210
|
+
id: string;
|
|
211
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
212
|
+
task: string;
|
|
213
|
+
schedule: string;
|
|
214
|
+
timezone: string;
|
|
215
|
+
recurrence: unknown;
|
|
216
|
+
next_run_at: string | null;
|
|
217
|
+
conversation_access: unknown;
|
|
218
|
+
credential_subject: unknown;
|
|
219
|
+
last_run_at: string | null;
|
|
220
|
+
run_now_at: string | null;
|
|
221
|
+
}[];
|
|
222
|
+
readonly truncated: boolean;
|
|
223
|
+
};
|
|
224
|
+
readonly tasks: {
|
|
225
|
+
id: string;
|
|
226
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
227
|
+
task: string;
|
|
228
|
+
schedule: string;
|
|
229
|
+
timezone: string;
|
|
230
|
+
recurrence: unknown;
|
|
231
|
+
next_run_at: string | null;
|
|
232
|
+
conversation_access: unknown;
|
|
233
|
+
credential_subject: unknown;
|
|
234
|
+
last_run_at: string | null;
|
|
235
|
+
run_now_at: string | null;
|
|
236
|
+
}[];
|
|
237
|
+
readonly truncated: boolean;
|
|
238
|
+
};
|
|
239
|
+
/** Prefix generated scheduler ids so tool results are distinguishable from provider ids. */
|
|
240
|
+
export declare function buildTaskId(): string;
|
|
241
|
+
/** Keep concrete scheduler tools coupled to the injected store, not global state. */
|
|
242
|
+
export declare function schedulerStore(context: SchedulerToolContext): SchedulerStore;
|
|
243
|
+
/** Accept only persisted scheduler statuses from model-facing update input. */
|
|
244
|
+
export declare function normalizeStatus(value: string | undefined): ScheduledTaskStatus | undefined;
|
|
245
|
+
/** Rebuild recurrence only from validated daily-or-slower schedule requests. */
|
|
246
|
+
export declare function buildRecurrence(args: {
|
|
247
|
+
existing?: ScheduledTaskRecurrence;
|
|
248
|
+
input: {
|
|
249
|
+
recurrence?: unknown;
|
|
250
|
+
};
|
|
251
|
+
nextRunAtMs: number | undefined;
|
|
252
|
+
timezone: string;
|
|
253
|
+
}): ScheduledTaskRecurrence | undefined;
|
|
254
|
+
/** Reject recurrence values that would exceed the scheduler cadence policy. */
|
|
255
|
+
export declare function validateRecurringFrequencyLimit(input: {
|
|
256
|
+
recurrence?: unknown;
|
|
257
|
+
}): void;
|
|
258
|
+
/** Force create-tool callers to explicitly choose one-off versus recurring semantics. */
|
|
259
|
+
export declare function validateCreateScheduleKind(input: {
|
|
260
|
+
recurrence?: unknown;
|
|
261
|
+
schedule_kind?: unknown;
|
|
262
|
+
}): void;
|
|
263
|
+
/** Detect update inputs that affect calendar recurrence materialization. */
|
|
264
|
+
export declare function shouldRebuildRecurrence(input: {
|
|
265
|
+
next_run_at?: string;
|
|
266
|
+
recurrence?: unknown;
|
|
267
|
+
timezone?: string;
|
|
268
|
+
}): boolean;
|
|
269
|
+
/** Centralize scheduler timezone defaulting for all concrete tool entry points. */
|
|
270
|
+
export declare function getDefaultScheduleTimezone(): string;
|
|
271
|
+
/** Validate IANA timezone names before persisting scheduler cadence state. */
|
|
272
|
+
export declare function isValidTimeZone(timezone: string): boolean;
|
|
273
|
+
/** Parse model-supplied timestamps without leaking date parser details to tools. */
|
|
274
|
+
export declare function parseNextRunAtMs(nextRunAtIso: string | undefined): number | undefined;
|
|
275
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type SchedulerToolContext } from "../tool-support";
|
|
2
|
+
/** Create a tool that stores a scheduled task for the active Slack context. */
|
|
3
|
+
export declare function createSlackScheduleCreateTaskTool(context: SchedulerToolContext): import("@sentry/junior-plugin-api").PluginToolDefinition<{
|
|
4
|
+
task: string;
|
|
5
|
+
schedule: string;
|
|
6
|
+
schedule_kind: "one_off" | "recurring";
|
|
7
|
+
timezone?: string | undefined;
|
|
8
|
+
next_run_at?: string | undefined;
|
|
9
|
+
recurrence?: "daily" | "weekly" | "monthly" | "yearly" | null | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
[x: string]: unknown;
|
|
12
|
+
ok: true;
|
|
13
|
+
status: "success";
|
|
14
|
+
target: string;
|
|
15
|
+
data: {
|
|
16
|
+
ok: true;
|
|
17
|
+
task: {
|
|
18
|
+
id: string;
|
|
19
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
20
|
+
task: string;
|
|
21
|
+
schedule: string;
|
|
22
|
+
timezone: string;
|
|
23
|
+
recurrence: unknown;
|
|
24
|
+
next_run_at: string | null;
|
|
25
|
+
conversation_access: unknown;
|
|
26
|
+
credential_subject: unknown;
|
|
27
|
+
last_run_at: string | null;
|
|
28
|
+
run_now_at: string | null;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
task: {
|
|
32
|
+
id: string;
|
|
33
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
34
|
+
task: string;
|
|
35
|
+
schedule: string;
|
|
36
|
+
timezone: string;
|
|
37
|
+
recurrence: unknown;
|
|
38
|
+
next_run_at: string | null;
|
|
39
|
+
conversation_access: unknown;
|
|
40
|
+
credential_subject: unknown;
|
|
41
|
+
last_run_at: string | null;
|
|
42
|
+
run_now_at: string | null;
|
|
43
|
+
};
|
|
44
|
+
truncated?: boolean | undefined;
|
|
45
|
+
continuation?: {
|
|
46
|
+
arguments: Record<string, unknown>;
|
|
47
|
+
reason?: string | undefined;
|
|
48
|
+
} | undefined;
|
|
49
|
+
error?: string | {
|
|
50
|
+
kind: string;
|
|
51
|
+
message: string;
|
|
52
|
+
retryable?: boolean | undefined;
|
|
53
|
+
} | undefined;
|
|
54
|
+
}>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type SchedulerToolContext } from "../tool-support";
|
|
2
|
+
/** Create a tool that removes a scheduled task from the active Slack conversation. */
|
|
3
|
+
export declare function createSlackScheduleDeleteTaskTool(context: SchedulerToolContext): import("@sentry/junior-plugin-api").PluginToolDefinition<{
|
|
4
|
+
task_id: string;
|
|
5
|
+
}, {
|
|
6
|
+
[x: string]: unknown;
|
|
7
|
+
ok: true;
|
|
8
|
+
status: "success";
|
|
9
|
+
target: string;
|
|
10
|
+
data: {
|
|
11
|
+
ok: true;
|
|
12
|
+
task: {
|
|
13
|
+
id: string;
|
|
14
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
15
|
+
task: string;
|
|
16
|
+
schedule: string;
|
|
17
|
+
timezone: string;
|
|
18
|
+
recurrence: unknown;
|
|
19
|
+
next_run_at: string | null;
|
|
20
|
+
conversation_access: unknown;
|
|
21
|
+
credential_subject: unknown;
|
|
22
|
+
last_run_at: string | null;
|
|
23
|
+
run_now_at: string | null;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
task: {
|
|
27
|
+
id: string;
|
|
28
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
29
|
+
task: string;
|
|
30
|
+
schedule: string;
|
|
31
|
+
timezone: string;
|
|
32
|
+
recurrence: unknown;
|
|
33
|
+
next_run_at: string | null;
|
|
34
|
+
conversation_access: unknown;
|
|
35
|
+
credential_subject: unknown;
|
|
36
|
+
last_run_at: string | null;
|
|
37
|
+
run_now_at: string | null;
|
|
38
|
+
};
|
|
39
|
+
truncated?: boolean | undefined;
|
|
40
|
+
continuation?: {
|
|
41
|
+
arguments: Record<string, unknown>;
|
|
42
|
+
reason?: string | undefined;
|
|
43
|
+
} | undefined;
|
|
44
|
+
error?: string | {
|
|
45
|
+
kind: string;
|
|
46
|
+
message: string;
|
|
47
|
+
retryable?: boolean | undefined;
|
|
48
|
+
} | undefined;
|
|
49
|
+
}>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type SchedulerToolContext } from "../tool-support";
|
|
2
|
+
/** Create a tool that lists scheduled tasks for the active Slack conversation. */
|
|
3
|
+
export declare function createSlackScheduleListTasksTool(context: SchedulerToolContext): import("@sentry/junior-plugin-api").PluginToolDefinition<Record<string, never>, {
|
|
4
|
+
[x: string]: unknown;
|
|
5
|
+
ok: true;
|
|
6
|
+
status: "success";
|
|
7
|
+
target: string;
|
|
8
|
+
data: {
|
|
9
|
+
ok: true;
|
|
10
|
+
tasks: {
|
|
11
|
+
id: string;
|
|
12
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
13
|
+
task: string;
|
|
14
|
+
schedule: string;
|
|
15
|
+
timezone: string;
|
|
16
|
+
recurrence: unknown;
|
|
17
|
+
next_run_at: string | null;
|
|
18
|
+
conversation_access: unknown;
|
|
19
|
+
credential_subject: unknown;
|
|
20
|
+
last_run_at: string | null;
|
|
21
|
+
run_now_at: string | null;
|
|
22
|
+
}[];
|
|
23
|
+
truncated: boolean;
|
|
24
|
+
};
|
|
25
|
+
tasks: {
|
|
26
|
+
id: string;
|
|
27
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
28
|
+
task: string;
|
|
29
|
+
schedule: string;
|
|
30
|
+
timezone: string;
|
|
31
|
+
recurrence: unknown;
|
|
32
|
+
next_run_at: string | null;
|
|
33
|
+
conversation_access: unknown;
|
|
34
|
+
credential_subject: unknown;
|
|
35
|
+
last_run_at: string | null;
|
|
36
|
+
run_now_at: string | null;
|
|
37
|
+
}[];
|
|
38
|
+
truncated: boolean;
|
|
39
|
+
continuation?: {
|
|
40
|
+
arguments: Record<string, unknown>;
|
|
41
|
+
reason?: string | undefined;
|
|
42
|
+
} | undefined;
|
|
43
|
+
error?: string | {
|
|
44
|
+
kind: string;
|
|
45
|
+
message: string;
|
|
46
|
+
retryable?: boolean | undefined;
|
|
47
|
+
} | undefined;
|
|
48
|
+
}>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type SchedulerToolContext } from "../tool-support";
|
|
2
|
+
/** Create a tool that marks an existing scheduled task due immediately. */
|
|
3
|
+
export declare function createSlackScheduleRunTaskNowTool(context: SchedulerToolContext): import("@sentry/junior-plugin-api").PluginToolDefinition<{
|
|
4
|
+
task_id: string;
|
|
5
|
+
}, {
|
|
6
|
+
[x: string]: unknown;
|
|
7
|
+
ok: true;
|
|
8
|
+
status: "success";
|
|
9
|
+
target: string;
|
|
10
|
+
data: {
|
|
11
|
+
ok: true;
|
|
12
|
+
task: {
|
|
13
|
+
id: string;
|
|
14
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
15
|
+
task: string;
|
|
16
|
+
schedule: string;
|
|
17
|
+
timezone: string;
|
|
18
|
+
recurrence: unknown;
|
|
19
|
+
next_run_at: string | null;
|
|
20
|
+
conversation_access: unknown;
|
|
21
|
+
credential_subject: unknown;
|
|
22
|
+
last_run_at: string | null;
|
|
23
|
+
run_now_at: string | null;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
task: {
|
|
27
|
+
id: string;
|
|
28
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
29
|
+
task: string;
|
|
30
|
+
schedule: string;
|
|
31
|
+
timezone: string;
|
|
32
|
+
recurrence: unknown;
|
|
33
|
+
next_run_at: string | null;
|
|
34
|
+
conversation_access: unknown;
|
|
35
|
+
credential_subject: unknown;
|
|
36
|
+
last_run_at: string | null;
|
|
37
|
+
run_now_at: string | null;
|
|
38
|
+
};
|
|
39
|
+
truncated?: boolean | undefined;
|
|
40
|
+
continuation?: {
|
|
41
|
+
arguments: Record<string, unknown>;
|
|
42
|
+
reason?: string | undefined;
|
|
43
|
+
} | undefined;
|
|
44
|
+
error?: string | {
|
|
45
|
+
kind: string;
|
|
46
|
+
message: string;
|
|
47
|
+
retryable?: boolean | undefined;
|
|
48
|
+
} | undefined;
|
|
49
|
+
}>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type SchedulerToolContext } from "../tool-support";
|
|
2
|
+
/** Create a tool that edits a scheduled task in the active Slack conversation. */
|
|
3
|
+
export declare function createSlackScheduleUpdateTaskTool(context: SchedulerToolContext): import("@sentry/junior-plugin-api").PluginToolDefinition<{
|
|
4
|
+
task_id: string;
|
|
5
|
+
task?: string | undefined;
|
|
6
|
+
schedule?: string | undefined;
|
|
7
|
+
timezone?: string | undefined;
|
|
8
|
+
next_run_at?: string | undefined;
|
|
9
|
+
recurrence?: "daily" | "weekly" | "monthly" | "yearly" | null | undefined;
|
|
10
|
+
status?: "blocked" | "active" | "paused" | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
[x: string]: unknown;
|
|
13
|
+
ok: true;
|
|
14
|
+
status: "success";
|
|
15
|
+
target: string;
|
|
16
|
+
data: {
|
|
17
|
+
ok: true;
|
|
18
|
+
task: {
|
|
19
|
+
id: string;
|
|
20
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
21
|
+
task: string;
|
|
22
|
+
schedule: string;
|
|
23
|
+
timezone: string;
|
|
24
|
+
recurrence: unknown;
|
|
25
|
+
next_run_at: string | null;
|
|
26
|
+
conversation_access: unknown;
|
|
27
|
+
credential_subject: unknown;
|
|
28
|
+
last_run_at: string | null;
|
|
29
|
+
run_now_at: string | null;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
task: {
|
|
33
|
+
id: string;
|
|
34
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
35
|
+
task: string;
|
|
36
|
+
schedule: string;
|
|
37
|
+
timezone: string;
|
|
38
|
+
recurrence: unknown;
|
|
39
|
+
next_run_at: string | null;
|
|
40
|
+
conversation_access: unknown;
|
|
41
|
+
credential_subject: unknown;
|
|
42
|
+
last_run_at: string | null;
|
|
43
|
+
run_now_at: string | null;
|
|
44
|
+
};
|
|
45
|
+
truncated?: boolean | undefined;
|
|
46
|
+
continuation?: {
|
|
47
|
+
arguments: Record<string, unknown>;
|
|
48
|
+
reason?: string | undefined;
|
|
49
|
+
} | undefined;
|
|
50
|
+
error?: string | {
|
|
51
|
+
kind: string;
|
|
52
|
+
message: string;
|
|
53
|
+
retryable?: boolean | undefined;
|
|
54
|
+
} | undefined;
|
|
55
|
+
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-scheduler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.90.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -23,10 +23,9 @@
|
|
|
23
23
|
"src"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@sinclair/typebox": "^0.34.49",
|
|
27
26
|
"drizzle-orm": "^0.45.2",
|
|
28
27
|
"zod": "^4.4.3",
|
|
29
|
-
"@sentry/junior-plugin-api": "0.
|
|
28
|
+
"@sentry/junior-plugin-api": "0.90.0"
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|
|
32
31
|
"@types/node": "^25.9.1",
|
package/src/plugin.ts
CHANGED
|
@@ -431,7 +431,7 @@ export function createSchedulerPlugin() {
|
|
|
431
431
|
ctx.source.platform !== "slack" ||
|
|
432
432
|
ctx.requester?.platform !== "slack"
|
|
433
433
|
) {
|
|
434
|
-
return {} as Record<string, PluginToolDefinition
|
|
434
|
+
return {} as Record<string, PluginToolDefinition>;
|
|
435
435
|
}
|
|
436
436
|
const context = createSchedulerToolContext(ctx);
|
|
437
437
|
return {
|
|
@@ -440,7 +440,7 @@ export function createSchedulerPlugin() {
|
|
|
440
440
|
slackScheduleUpdateTask: createSlackScheduleUpdateTaskTool(context),
|
|
441
441
|
slackScheduleDeleteTask: createSlackScheduleDeleteTaskTool(context),
|
|
442
442
|
slackScheduleRunTaskNow: createSlackScheduleRunTaskNowTool(context),
|
|
443
|
-
} satisfies Record<string, PluginToolDefinition
|
|
443
|
+
} satisfies Record<string, PluginToolDefinition>;
|
|
444
444
|
},
|
|
445
445
|
async heartbeat(ctx) {
|
|
446
446
|
const store = schedulerStore(ctx);
|