@sentry/junior 0.128.1 → 0.129.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/{agent-hooks-IWQNFJMS.js → agent-hooks-ZM4WMZCN.js} +9 -9
- package/dist/api/schema/task.d.ts +152 -0
- package/dist/api/schema.d.ts +2 -0
- package/dist/api/schema.js +13 -3
- package/dist/api/tasks/routes.d.ts +4 -0
- package/dist/api.js +425 -23
- package/dist/app.js +309 -27
- package/dist/{catalog-runtime-KLSYFS4A.js → catalog-runtime-TN2GPVEI.js} +5 -5
- package/dist/chat/agent-dispatch/context.d.ts +18 -0
- package/dist/chat/event-tasks/store.d.ts +7 -1
- package/dist/chat/event-tasks/tool-support.d.ts +1 -0
- package/dist/chat/resource-events/runtime-catalog.d.ts +3 -0
- package/dist/chat/scheduled-tasks/cadence.d.ts +27 -0
- package/dist/chat/scheduled-tasks/heartbeat.d.ts +6 -0
- package/dist/chat/scheduled-tasks/identity.d.ts +6 -0
- package/dist/chat/scheduled-tasks/personal.d.ts +26 -0
- package/dist/chat/scheduled-tasks/schedule-intent.d.ts +61 -0
- package/dist/chat/scheduled-tasks/store.d.ts +77 -0
- package/dist/chat/scheduled-tasks/tool-support.d.ts +203 -0
- package/dist/chat/scheduled-tasks/tools/create.d.ts +80 -0
- package/dist/chat/scheduled-tasks/tools/delete.d.ts +56 -0
- package/dist/chat/scheduled-tasks/tools/list.d.ts +54 -0
- package/dist/chat/scheduled-tasks/tools/run-now.d.ts +56 -0
- package/dist/chat/scheduled-tasks/tools/update.d.ts +82 -0
- package/dist/chat/scheduled-tasks/tools.d.ts +6 -0
- package/dist/chat/scheduled-tasks/types.d.ts +81 -0
- package/dist/chat/tasks/read.d.ts +9 -0
- package/dist/chat/tools/scheduled-tasks.d.ts +4 -0
- package/dist/{chunk-5IR7SGRO.js → chunk-2BCQKJTX.js} +2 -2
- package/dist/{chunk-MZ6ZOWMJ.js → chunk-3N4MWF3R.js} +1 -1
- package/dist/{chunk-ETGUGGO2.js → chunk-6CMYU62S.js} +7 -7
- package/dist/{chunk-AAMF2IRC.js → chunk-6QQOLIJJ.js} +1308 -804
- package/dist/{chunk-R2LXTX4J.js → chunk-A6QQPVSH.js} +1 -1
- package/dist/chunk-BDIEEZK7.js +1470 -0
- package/dist/{chunk-AFJF3RGU.js → chunk-BVKP37NE.js} +61 -13
- package/dist/{chunk-54KP2EAH.js → chunk-CZJUBH6O.js} +12 -12
- package/dist/{chunk-O3YROBH4.js → chunk-CZQ2DSQZ.js} +1 -1
- package/dist/{chunk-O3C5BJFD.js → chunk-E4UCPRYL.js} +1 -1
- package/dist/{chunk-S2O64VXP.js → chunk-ESYXDXNX.js} +6 -6
- package/dist/{chunk-EHEACYJ6.js → chunk-GPWHBHAG.js} +1 -1
- package/dist/{chunk-PLAMHS3D.js → chunk-GURSWCI4.js} +2 -2
- package/dist/{chunk-Q5TMMCBV.js → chunk-K3U5447S.js} +1 -1
- package/dist/{chunk-SHMHHXD5.js → chunk-KB2M27DL.js} +58 -0
- package/dist/{chunk-LIJ4APSS.js → chunk-LV2BQ26V.js} +1 -1
- package/dist/{chunk-MKM5552O.js → chunk-NNRV4T2C.js} +1 -2
- package/dist/{chunk-TONH5NXR.js → chunk-P6I7LFKC.js} +1 -1
- package/dist/{chunk-J3YIO3LE.js → chunk-PQFNTLZI.js} +3 -3
- package/dist/{chunk-H4HMCSOZ.js → chunk-QAOA4GUG.js} +5 -5
- package/dist/{chunk-EOIA25WC.js → chunk-R62DRNKB.js} +2 -2
- package/dist/{chunk-OIQCRZ67.js → chunk-U23X4ASF.js} +4 -4
- package/dist/{chunk-P7UUNWC4.js → chunk-XENYUOZG.js} +4 -4
- package/dist/cli/chat.js +24 -24
- package/dist/cli/check.js +6 -6
- package/dist/cli/plugins.js +12 -12
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +9 -17
- package/dist/db/schema/scheduled-tasks.d.ts +257 -0
- package/dist/db/schema.d.ts +258 -1
- package/dist/{db-VOU5QNLY.js → db-ZI6TBXIS.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-GS7FBYBC.js → oauth-callback-server-TLA4GARF.js} +17 -17
- package/dist/{runner-GSJSBI3J.js → runner-23YFRWQJ.js} +11 -11
- package/dist/{skills-DSHG54LM.js → skills-QIUG4D6M.js} +6 -6
- package/dist/{validation-25XWT6TA.js → validation-3KGEBATS.js} +6 -6
- package/dist/version.js +1 -1
- package/migrations/0016_neat_the_anarchist.sql +171 -0
- package/migrations/meta/0016_snapshot.json +1617 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +5 -6
- package/dist/chunk-REHOYCYS.js +0 -37
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Owns model-facing schedule intent and materializes it against the trusted
|
|
3
|
+
* server clock into the canonical schedule persisted by core.
|
|
4
|
+
*/
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import type { ScheduledTaskSchedule } from "./types";
|
|
7
|
+
export declare const scheduleIntentSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
8
|
+
kind: z.ZodLiteral<"one_off">;
|
|
9
|
+
timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
10
|
+
timing: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
11
|
+
type: z.ZodLiteral<"after">;
|
|
12
|
+
value: z.ZodNumber;
|
|
13
|
+
unit: z.ZodEnum<{
|
|
14
|
+
day: "day";
|
|
15
|
+
hour: "hour";
|
|
16
|
+
minute: "minute";
|
|
17
|
+
second: "second";
|
|
18
|
+
week: "week";
|
|
19
|
+
}>;
|
|
20
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
21
|
+
type: z.ZodLiteral<"at">;
|
|
22
|
+
date: z.ZodString;
|
|
23
|
+
time: z.ZodString;
|
|
24
|
+
}, z.core.$strict>], "type">;
|
|
25
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
26
|
+
kind: z.ZodLiteral<"recurring">;
|
|
27
|
+
frequency: z.ZodEnum<{
|
|
28
|
+
daily: "daily";
|
|
29
|
+
weekly: "weekly";
|
|
30
|
+
monthly: "monthly";
|
|
31
|
+
yearly: "yearly";
|
|
32
|
+
}>;
|
|
33
|
+
interval: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
34
|
+
time: z.ZodString;
|
|
35
|
+
weekdays: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
|
|
36
|
+
sunday: "sunday";
|
|
37
|
+
monday: "monday";
|
|
38
|
+
tuesday: "tuesday";
|
|
39
|
+
wednesday: "wednesday";
|
|
40
|
+
thursday: "thursday";
|
|
41
|
+
friday: "friday";
|
|
42
|
+
saturday: "saturday";
|
|
43
|
+
}>>>>;
|
|
44
|
+
day_of_month: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
45
|
+
month: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
46
|
+
start_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
47
|
+
timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
48
|
+
}, z.core.$strict>]>;
|
|
49
|
+
export type ScheduleIntent = z.infer<typeof scheduleIntentSchema>;
|
|
50
|
+
export interface CompiledScheduleIntent {
|
|
51
|
+
nextRunAtMs: number;
|
|
52
|
+
schedule: ScheduledTaskSchedule;
|
|
53
|
+
}
|
|
54
|
+
export declare class ScheduleIntentError extends Error {
|
|
55
|
+
}
|
|
56
|
+
/** Materialize model-interpreted schedule intent against the trusted server clock. */
|
|
57
|
+
export declare function compileScheduleIntent(args: {
|
|
58
|
+
defaultTimezone: string;
|
|
59
|
+
intent: ScheduleIntent;
|
|
60
|
+
nowMs: number;
|
|
61
|
+
}): CompiledScheduleIntent;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type PluginReadState, type PluginState } from "@sentry/junior-plugin-api";
|
|
2
|
+
import type { PgDatabase } from "drizzle-orm/pg-core";
|
|
3
|
+
import type { PgQueryResultHKT } from "drizzle-orm/pg-core/session";
|
|
4
|
+
import * as schedulerSqlSchema from "@/db/schema/scheduled-tasks";
|
|
5
|
+
import { type ScheduledRun, type ScheduledTask } from "./types";
|
|
6
|
+
export type SchedulerDb = PgDatabase<PgQueryResultHKT, typeof schedulerSqlSchema>;
|
|
7
|
+
export interface SchedulerStore {
|
|
8
|
+
claimDueRun(args: {
|
|
9
|
+
nowMs: number;
|
|
10
|
+
}): Promise<ScheduledRun | undefined>;
|
|
11
|
+
createTask(task: ScheduledTask): Promise<ScheduledTask>;
|
|
12
|
+
getRun(runId: string): Promise<ScheduledRun | undefined>;
|
|
13
|
+
getTask(taskId: string): Promise<ScheduledTask | undefined>;
|
|
14
|
+
listIncompleteRuns(): Promise<ScheduledRun[]>;
|
|
15
|
+
listTasks(): Promise<ScheduledTask[]>;
|
|
16
|
+
listTasksCreatedBy(input: ListTasksCreatedByInput): Promise<ScheduledTask[]>;
|
|
17
|
+
listTasksForTeam(teamId: string): Promise<ScheduledTask[]>;
|
|
18
|
+
markRunBlocked(args: {
|
|
19
|
+
completedAtMs: number;
|
|
20
|
+
errorMessage: string;
|
|
21
|
+
runId: string;
|
|
22
|
+
startedAtMs?: number;
|
|
23
|
+
}): Promise<ScheduledRun | undefined>;
|
|
24
|
+
markRunCompleted(args: {
|
|
25
|
+
completedAtMs: number;
|
|
26
|
+
resultMessageTs?: string;
|
|
27
|
+
runId: string;
|
|
28
|
+
startedAtMs: number;
|
|
29
|
+
}): Promise<ScheduledRun | undefined>;
|
|
30
|
+
markRunFailed(args: {
|
|
31
|
+
completedAtMs: number;
|
|
32
|
+
errorMessage: string;
|
|
33
|
+
startedAtMs?: number;
|
|
34
|
+
runId: string;
|
|
35
|
+
}): Promise<ScheduledRun | undefined>;
|
|
36
|
+
markRunSkipped(args: {
|
|
37
|
+
completedAtMs: number;
|
|
38
|
+
errorMessage: string;
|
|
39
|
+
runId: string;
|
|
40
|
+
}): Promise<ScheduledRun | undefined>;
|
|
41
|
+
markRunDispatched(args: {
|
|
42
|
+
claimedAtMs: number;
|
|
43
|
+
dispatchId: string;
|
|
44
|
+
nowMs: number;
|
|
45
|
+
runId: string;
|
|
46
|
+
}): Promise<ScheduledRun | undefined>;
|
|
47
|
+
saveTask(task: ScheduledTask): Promise<void>;
|
|
48
|
+
updateTaskAfterRun(args: {
|
|
49
|
+
errorMessage?: string;
|
|
50
|
+
nowMs: number;
|
|
51
|
+
run: ScheduledRun;
|
|
52
|
+
status: "blocked" | "completed" | "failed";
|
|
53
|
+
}): Promise<void>;
|
|
54
|
+
}
|
|
55
|
+
export interface ListTasksCreatedByInput {
|
|
56
|
+
before?: {
|
|
57
|
+
createdAtMs: number;
|
|
58
|
+
id: string;
|
|
59
|
+
};
|
|
60
|
+
identityIds: string[];
|
|
61
|
+
limit: number;
|
|
62
|
+
query?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface SchedulerOperationalStore {
|
|
65
|
+
listIncompleteRunsForTasks(tasks: ScheduledTask[]): Promise<ScheduledRun[]>;
|
|
66
|
+
listTasks(): Promise<ScheduledTask[]>;
|
|
67
|
+
}
|
|
68
|
+
/** Create a scheduler store backed by this plugin's durable state namespace. */
|
|
69
|
+
export declare function createSchedulerStore(state: PluginState): SchedulerStore;
|
|
70
|
+
/** Create a read-only scheduler store for operational reporting. */
|
|
71
|
+
export declare function createSchedulerOperationalStore(state: PluginReadState): SchedulerOperationalStore;
|
|
72
|
+
/** List scheduled tasks whose current Slack destination is public. */
|
|
73
|
+
export declare function listPublicScheduledTasksForTeams(db: SchedulerDb, teamIds: string[], limit: number): Promise<ScheduledTask[]>;
|
|
74
|
+
/** Create a scheduler store backed by the plugin SQL database. */
|
|
75
|
+
export declare function createSchedulerSqlStore(db: SchedulerDb): SchedulerStore;
|
|
76
|
+
/** Create a read-only scheduler operational store backed by SQL. */
|
|
77
|
+
export declare function createSchedulerOperationalSqlStore(db: SchedulerDb): SchedulerOperationalStore;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { type Identity, type SlackDestination, type SlackActor, type SlackSource, type User } from "@sentry/junior-plugin-api";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { type SchedulerStore } from "./store";
|
|
4
|
+
import type { ScheduledTask, ScheduledTaskConversationAccess, ScheduledTaskPrincipal, ScheduledTaskStatus } from "./types";
|
|
5
|
+
export interface SchedulerToolContext {
|
|
6
|
+
actor?: SlackActor;
|
|
7
|
+
now?: () => number;
|
|
8
|
+
source?: SlackSource;
|
|
9
|
+
store: SchedulerStore;
|
|
10
|
+
users: {
|
|
11
|
+
resolveActor(): Promise<{
|
|
12
|
+
identity: Identity;
|
|
13
|
+
user?: User;
|
|
14
|
+
} | undefined>;
|
|
15
|
+
};
|
|
16
|
+
userText?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const MAX_LISTED_TASKS = 50;
|
|
19
|
+
declare const compactTaskResultSchema: z.ZodObject<{
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
status: z.ZodEnum<{
|
|
22
|
+
blocked: "blocked";
|
|
23
|
+
active: "active";
|
|
24
|
+
paused: "paused";
|
|
25
|
+
deleted: "deleted";
|
|
26
|
+
}>;
|
|
27
|
+
task: z.ZodString;
|
|
28
|
+
schedule: z.ZodString;
|
|
29
|
+
timezone: z.ZodString;
|
|
30
|
+
recurrence: z.ZodNullable<z.ZodUnknown>;
|
|
31
|
+
next_run_at: z.ZodNullable<z.ZodString>;
|
|
32
|
+
conversation_access: z.ZodObject<{
|
|
33
|
+
audience: z.ZodEnum<{
|
|
34
|
+
direct: "direct";
|
|
35
|
+
channel: "channel";
|
|
36
|
+
group: "group";
|
|
37
|
+
}>;
|
|
38
|
+
visibility: z.ZodEnum<{
|
|
39
|
+
public: "public";
|
|
40
|
+
private: "private";
|
|
41
|
+
}>;
|
|
42
|
+
}, z.core.$strict>;
|
|
43
|
+
credential_mode: z.ZodEnum<{
|
|
44
|
+
system: "system";
|
|
45
|
+
creator: "creator";
|
|
46
|
+
}>;
|
|
47
|
+
last_run_at: z.ZodNullable<z.ZodString>;
|
|
48
|
+
run_now_at: z.ZodNullable<z.ZodString>;
|
|
49
|
+
}, z.core.$strict>;
|
|
50
|
+
export declare const scheduleTaskToolResultSchema: z.ZodObject<{
|
|
51
|
+
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
52
|
+
continuation: z.ZodOptional<z.ZodObject<{
|
|
53
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
54
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, z.core.$strict>>;
|
|
56
|
+
target: z.ZodString;
|
|
57
|
+
task: z.ZodObject<{
|
|
58
|
+
id: z.ZodString;
|
|
59
|
+
status: z.ZodEnum<{
|
|
60
|
+
blocked: "blocked";
|
|
61
|
+
active: "active";
|
|
62
|
+
paused: "paused";
|
|
63
|
+
deleted: "deleted";
|
|
64
|
+
}>;
|
|
65
|
+
task: z.ZodString;
|
|
66
|
+
schedule: z.ZodString;
|
|
67
|
+
timezone: z.ZodString;
|
|
68
|
+
recurrence: z.ZodNullable<z.ZodUnknown>;
|
|
69
|
+
next_run_at: z.ZodNullable<z.ZodString>;
|
|
70
|
+
conversation_access: z.ZodObject<{
|
|
71
|
+
audience: z.ZodEnum<{
|
|
72
|
+
direct: "direct";
|
|
73
|
+
channel: "channel";
|
|
74
|
+
group: "group";
|
|
75
|
+
}>;
|
|
76
|
+
visibility: z.ZodEnum<{
|
|
77
|
+
public: "public";
|
|
78
|
+
private: "private";
|
|
79
|
+
}>;
|
|
80
|
+
}, z.core.$strict>;
|
|
81
|
+
credential_mode: z.ZodEnum<{
|
|
82
|
+
system: "system";
|
|
83
|
+
creator: "creator";
|
|
84
|
+
}>;
|
|
85
|
+
last_run_at: z.ZodNullable<z.ZodString>;
|
|
86
|
+
run_now_at: z.ZodNullable<z.ZodString>;
|
|
87
|
+
}, z.core.$strict>;
|
|
88
|
+
}, z.core.$strict>;
|
|
89
|
+
export declare const scheduleListToolResultSchema: z.ZodObject<{
|
|
90
|
+
continuation: z.ZodOptional<z.ZodObject<{
|
|
91
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
92
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, z.core.$strict>>;
|
|
94
|
+
target: z.ZodString;
|
|
95
|
+
tasks: z.ZodArray<z.ZodObject<{
|
|
96
|
+
id: z.ZodString;
|
|
97
|
+
status: z.ZodEnum<{
|
|
98
|
+
blocked: "blocked";
|
|
99
|
+
active: "active";
|
|
100
|
+
paused: "paused";
|
|
101
|
+
deleted: "deleted";
|
|
102
|
+
}>;
|
|
103
|
+
task: z.ZodString;
|
|
104
|
+
schedule: z.ZodString;
|
|
105
|
+
timezone: z.ZodString;
|
|
106
|
+
recurrence: z.ZodNullable<z.ZodUnknown>;
|
|
107
|
+
next_run_at: z.ZodNullable<z.ZodString>;
|
|
108
|
+
conversation_access: z.ZodObject<{
|
|
109
|
+
audience: z.ZodEnum<{
|
|
110
|
+
direct: "direct";
|
|
111
|
+
channel: "channel";
|
|
112
|
+
group: "group";
|
|
113
|
+
}>;
|
|
114
|
+
visibility: z.ZodEnum<{
|
|
115
|
+
public: "public";
|
|
116
|
+
private: "private";
|
|
117
|
+
}>;
|
|
118
|
+
}, z.core.$strict>;
|
|
119
|
+
credential_mode: z.ZodEnum<{
|
|
120
|
+
system: "system";
|
|
121
|
+
creator: "creator";
|
|
122
|
+
}>;
|
|
123
|
+
last_run_at: z.ZodNullable<z.ZodString>;
|
|
124
|
+
run_now_at: z.ZodNullable<z.ZodString>;
|
|
125
|
+
}, z.core.$strict>>;
|
|
126
|
+
truncated: z.ZodBoolean;
|
|
127
|
+
}, z.core.$strict>;
|
|
128
|
+
export type CompactTaskResult = z.output<typeof compactTaskResultSchema>;
|
|
129
|
+
/** Normalize scheduled-task validation failures into the core tool contract. */
|
|
130
|
+
export declare function throwToolInputError(error: string): never;
|
|
131
|
+
/** Require scheduler mutations to stay scoped to the active Slack conversation. */
|
|
132
|
+
export declare function requireActiveConversation(context: SchedulerToolContext): SlackDestination;
|
|
133
|
+
/** Require a concrete Slack actor before creating scheduler ownership state. */
|
|
134
|
+
export declare function requireActor(context: SchedulerToolContext, destination: SlackDestination): ScheduledTaskPrincipal;
|
|
135
|
+
/** Preserve the active destination's ingress-confirmed access classification. */
|
|
136
|
+
export declare function getConversationAccess(destination: SlackDestination, source: SlackSource | undefined): ScheduledTaskConversationAccess;
|
|
137
|
+
/** Keep scheduler management operations bound to the task's original Slack destination. */
|
|
138
|
+
export declare function sameDestination(task: ScheduledTask, destination: SlackDestination): boolean;
|
|
139
|
+
/** Look up a mutable task only after enforcing active-conversation ownership. */
|
|
140
|
+
export declare function getWritableTask(args: {
|
|
141
|
+
context: SchedulerToolContext;
|
|
142
|
+
taskId: string;
|
|
143
|
+
}): Promise<ScheduledTask>;
|
|
144
|
+
/** Project scheduled task state into the stable model-facing result shape. */
|
|
145
|
+
export declare function compactTask(task: ScheduledTask): CompactTaskResult;
|
|
146
|
+
/** Build the structured result shared by single-task scheduler tools. */
|
|
147
|
+
export declare function scheduleTaskToolResult(target: string, task: CompactTaskResult): {
|
|
148
|
+
readonly target: string;
|
|
149
|
+
readonly task: {
|
|
150
|
+
id: string;
|
|
151
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
152
|
+
task: string;
|
|
153
|
+
schedule: string;
|
|
154
|
+
timezone: string;
|
|
155
|
+
recurrence: unknown;
|
|
156
|
+
next_run_at: string | null;
|
|
157
|
+
conversation_access: {
|
|
158
|
+
audience: "direct" | "channel" | "group";
|
|
159
|
+
visibility: "public" | "private";
|
|
160
|
+
};
|
|
161
|
+
credential_mode: "system" | "creator";
|
|
162
|
+
last_run_at: string | null;
|
|
163
|
+
run_now_at: string | null;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
/** Build the structured result for listing scheduler tools. */
|
|
167
|
+
export declare function scheduleListToolResult(args: {
|
|
168
|
+
target: string;
|
|
169
|
+
tasks: CompactTaskResult[];
|
|
170
|
+
truncated: boolean;
|
|
171
|
+
}): {
|
|
172
|
+
readonly target: string;
|
|
173
|
+
readonly tasks: {
|
|
174
|
+
id: string;
|
|
175
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
176
|
+
task: string;
|
|
177
|
+
schedule: string;
|
|
178
|
+
timezone: string;
|
|
179
|
+
recurrence: unknown;
|
|
180
|
+
next_run_at: string | null;
|
|
181
|
+
conversation_access: {
|
|
182
|
+
audience: "direct" | "channel" | "group";
|
|
183
|
+
visibility: "public" | "private";
|
|
184
|
+
};
|
|
185
|
+
credential_mode: "system" | "creator";
|
|
186
|
+
last_run_at: string | null;
|
|
187
|
+
run_now_at: string | null;
|
|
188
|
+
}[];
|
|
189
|
+
readonly truncated: boolean;
|
|
190
|
+
};
|
|
191
|
+
/** Build a retry-stable scheduler id scoped to the creating actor and destination. */
|
|
192
|
+
export declare function buildTaskId(args: {
|
|
193
|
+
actor: ScheduledTaskPrincipal;
|
|
194
|
+
destination: SlackDestination;
|
|
195
|
+
toolCallId: string | undefined;
|
|
196
|
+
}): string;
|
|
197
|
+
/** Keep concrete scheduler tools coupled to the injected store, not global state. */
|
|
198
|
+
export declare function schedulerStore(context: SchedulerToolContext): SchedulerStore;
|
|
199
|
+
/** Accept only persisted scheduler statuses from model-facing update input. */
|
|
200
|
+
export declare function normalizeStatus(value: string | undefined): ScheduledTaskStatus | undefined;
|
|
201
|
+
/** Centralize scheduler timezone defaulting for all concrete tool entry points. */
|
|
202
|
+
export declare function getDefaultScheduleTimezone(): string;
|
|
203
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
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): Omit<import("../../tools/definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
4
|
+
inputSchema: import("../../tools/definition").JsonSchemaObject;
|
|
5
|
+
outputSchema: import("../../tools/definition").JsonSchemaObject;
|
|
6
|
+
prepareArguments(args: unknown): {
|
|
7
|
+
task: string;
|
|
8
|
+
schedule: {
|
|
9
|
+
kind: "recurring";
|
|
10
|
+
frequency: "daily" | "weekly" | "monthly" | "yearly";
|
|
11
|
+
time: string;
|
|
12
|
+
interval?: number | null | undefined;
|
|
13
|
+
weekdays?: ("sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday")[] | null | undefined;
|
|
14
|
+
day_of_month?: number | null | undefined;
|
|
15
|
+
month?: number | null | undefined;
|
|
16
|
+
start_date?: string | null | undefined;
|
|
17
|
+
timezone?: string | null | undefined;
|
|
18
|
+
} | {
|
|
19
|
+
kind: "one_off";
|
|
20
|
+
timing: {
|
|
21
|
+
type: "after";
|
|
22
|
+
value: number;
|
|
23
|
+
unit: "day" | "hour" | "minute" | "second" | "week";
|
|
24
|
+
} | {
|
|
25
|
+
type: "at";
|
|
26
|
+
date: string;
|
|
27
|
+
time: string;
|
|
28
|
+
};
|
|
29
|
+
timezone?: string | null | undefined;
|
|
30
|
+
};
|
|
31
|
+
credential_mode?: "system" | "creator" | null | undefined;
|
|
32
|
+
};
|
|
33
|
+
execute?: ((input: unknown, options: import("../../tools/definition").ToolExecuteOptions) => {
|
|
34
|
+
target: string;
|
|
35
|
+
task: {
|
|
36
|
+
id: string;
|
|
37
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
38
|
+
task: string;
|
|
39
|
+
schedule: string;
|
|
40
|
+
timezone: string;
|
|
41
|
+
recurrence: unknown;
|
|
42
|
+
next_run_at: string | null;
|
|
43
|
+
conversation_access: {
|
|
44
|
+
audience: "direct" | "channel" | "group";
|
|
45
|
+
visibility: "public" | "private";
|
|
46
|
+
};
|
|
47
|
+
credential_mode: "system" | "creator";
|
|
48
|
+
last_run_at: string | null;
|
|
49
|
+
run_now_at: string | null;
|
|
50
|
+
};
|
|
51
|
+
truncated?: boolean | undefined;
|
|
52
|
+
continuation?: {
|
|
53
|
+
arguments: Record<string, unknown>;
|
|
54
|
+
reason?: string | undefined;
|
|
55
|
+
} | undefined;
|
|
56
|
+
} | Promise<{
|
|
57
|
+
target: string;
|
|
58
|
+
task: {
|
|
59
|
+
id: string;
|
|
60
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
61
|
+
task: string;
|
|
62
|
+
schedule: string;
|
|
63
|
+
timezone: string;
|
|
64
|
+
recurrence: unknown;
|
|
65
|
+
next_run_at: string | null;
|
|
66
|
+
conversation_access: {
|
|
67
|
+
audience: "direct" | "channel" | "group";
|
|
68
|
+
visibility: "public" | "private";
|
|
69
|
+
};
|
|
70
|
+
credential_mode: "system" | "creator";
|
|
71
|
+
last_run_at: string | null;
|
|
72
|
+
run_now_at: string | null;
|
|
73
|
+
};
|
|
74
|
+
truncated?: boolean | undefined;
|
|
75
|
+
continuation?: {
|
|
76
|
+
arguments: Record<string, unknown>;
|
|
77
|
+
reason?: string | undefined;
|
|
78
|
+
} | undefined;
|
|
79
|
+
}>) | undefined;
|
|
80
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
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): Omit<import("../../tools/definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
4
|
+
inputSchema: import("../../tools/definition").JsonSchemaObject;
|
|
5
|
+
outputSchema: import("../../tools/definition").JsonSchemaObject;
|
|
6
|
+
prepareArguments(args: unknown): {
|
|
7
|
+
task_id: string;
|
|
8
|
+
};
|
|
9
|
+
execute?: ((input: unknown, options: import("../../tools/definition").ToolExecuteOptions) => {
|
|
10
|
+
target: string;
|
|
11
|
+
task: {
|
|
12
|
+
id: string;
|
|
13
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
14
|
+
task: string;
|
|
15
|
+
schedule: string;
|
|
16
|
+
timezone: string;
|
|
17
|
+
recurrence: unknown;
|
|
18
|
+
next_run_at: string | null;
|
|
19
|
+
conversation_access: {
|
|
20
|
+
audience: "direct" | "channel" | "group";
|
|
21
|
+
visibility: "public" | "private";
|
|
22
|
+
};
|
|
23
|
+
credential_mode: "system" | "creator";
|
|
24
|
+
last_run_at: string | null;
|
|
25
|
+
run_now_at: string | null;
|
|
26
|
+
};
|
|
27
|
+
truncated?: boolean | undefined;
|
|
28
|
+
continuation?: {
|
|
29
|
+
arguments: Record<string, unknown>;
|
|
30
|
+
reason?: string | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
} | Promise<{
|
|
33
|
+
target: string;
|
|
34
|
+
task: {
|
|
35
|
+
id: string;
|
|
36
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
37
|
+
task: string;
|
|
38
|
+
schedule: string;
|
|
39
|
+
timezone: string;
|
|
40
|
+
recurrence: unknown;
|
|
41
|
+
next_run_at: string | null;
|
|
42
|
+
conversation_access: {
|
|
43
|
+
audience: "direct" | "channel" | "group";
|
|
44
|
+
visibility: "public" | "private";
|
|
45
|
+
};
|
|
46
|
+
credential_mode: "system" | "creator";
|
|
47
|
+
last_run_at: string | null;
|
|
48
|
+
run_now_at: string | null;
|
|
49
|
+
};
|
|
50
|
+
truncated?: boolean | undefined;
|
|
51
|
+
continuation?: {
|
|
52
|
+
arguments: Record<string, unknown>;
|
|
53
|
+
reason?: string | undefined;
|
|
54
|
+
} | undefined;
|
|
55
|
+
}>) | undefined;
|
|
56
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
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): Omit<import("../../tools/definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
4
|
+
inputSchema: import("../../tools/definition").JsonSchemaObject;
|
|
5
|
+
outputSchema: import("../../tools/definition").JsonSchemaObject;
|
|
6
|
+
prepareArguments(args: unknown): Record<string, never>;
|
|
7
|
+
execute?: ((input: unknown, options: import("../../tools/definition").ToolExecuteOptions) => {
|
|
8
|
+
target: string;
|
|
9
|
+
tasks: {
|
|
10
|
+
id: string;
|
|
11
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
12
|
+
task: string;
|
|
13
|
+
schedule: string;
|
|
14
|
+
timezone: string;
|
|
15
|
+
recurrence: unknown;
|
|
16
|
+
next_run_at: string | null;
|
|
17
|
+
conversation_access: {
|
|
18
|
+
audience: "direct" | "channel" | "group";
|
|
19
|
+
visibility: "public" | "private";
|
|
20
|
+
};
|
|
21
|
+
credential_mode: "system" | "creator";
|
|
22
|
+
last_run_at: string | null;
|
|
23
|
+
run_now_at: string | null;
|
|
24
|
+
}[];
|
|
25
|
+
truncated: boolean;
|
|
26
|
+
continuation?: {
|
|
27
|
+
arguments: Record<string, unknown>;
|
|
28
|
+
reason?: string | undefined;
|
|
29
|
+
} | undefined;
|
|
30
|
+
} | Promise<{
|
|
31
|
+
target: string;
|
|
32
|
+
tasks: {
|
|
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: {
|
|
41
|
+
audience: "direct" | "channel" | "group";
|
|
42
|
+
visibility: "public" | "private";
|
|
43
|
+
};
|
|
44
|
+
credential_mode: "system" | "creator";
|
|
45
|
+
last_run_at: string | null;
|
|
46
|
+
run_now_at: string | null;
|
|
47
|
+
}[];
|
|
48
|
+
truncated: boolean;
|
|
49
|
+
continuation?: {
|
|
50
|
+
arguments: Record<string, unknown>;
|
|
51
|
+
reason?: string | undefined;
|
|
52
|
+
} | undefined;
|
|
53
|
+
}>) | undefined;
|
|
54
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
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): Omit<import("../../tools/definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
4
|
+
inputSchema: import("../../tools/definition").JsonSchemaObject;
|
|
5
|
+
outputSchema: import("../../tools/definition").JsonSchemaObject;
|
|
6
|
+
prepareArguments(args: unknown): {
|
|
7
|
+
task_id: string;
|
|
8
|
+
};
|
|
9
|
+
execute?: ((input: unknown, options: import("../../tools/definition").ToolExecuteOptions) => {
|
|
10
|
+
target: string;
|
|
11
|
+
task: {
|
|
12
|
+
id: string;
|
|
13
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
14
|
+
task: string;
|
|
15
|
+
schedule: string;
|
|
16
|
+
timezone: string;
|
|
17
|
+
recurrence: unknown;
|
|
18
|
+
next_run_at: string | null;
|
|
19
|
+
conversation_access: {
|
|
20
|
+
audience: "direct" | "channel" | "group";
|
|
21
|
+
visibility: "public" | "private";
|
|
22
|
+
};
|
|
23
|
+
credential_mode: "system" | "creator";
|
|
24
|
+
last_run_at: string | null;
|
|
25
|
+
run_now_at: string | null;
|
|
26
|
+
};
|
|
27
|
+
truncated?: boolean | undefined;
|
|
28
|
+
continuation?: {
|
|
29
|
+
arguments: Record<string, unknown>;
|
|
30
|
+
reason?: string | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
} | Promise<{
|
|
33
|
+
target: string;
|
|
34
|
+
task: {
|
|
35
|
+
id: string;
|
|
36
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
37
|
+
task: string;
|
|
38
|
+
schedule: string;
|
|
39
|
+
timezone: string;
|
|
40
|
+
recurrence: unknown;
|
|
41
|
+
next_run_at: string | null;
|
|
42
|
+
conversation_access: {
|
|
43
|
+
audience: "direct" | "channel" | "group";
|
|
44
|
+
visibility: "public" | "private";
|
|
45
|
+
};
|
|
46
|
+
credential_mode: "system" | "creator";
|
|
47
|
+
last_run_at: string | null;
|
|
48
|
+
run_now_at: string | null;
|
|
49
|
+
};
|
|
50
|
+
truncated?: boolean | undefined;
|
|
51
|
+
continuation?: {
|
|
52
|
+
arguments: Record<string, unknown>;
|
|
53
|
+
reason?: string | undefined;
|
|
54
|
+
} | undefined;
|
|
55
|
+
}>) | undefined;
|
|
56
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
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): Omit<import("../../tools/definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
4
|
+
inputSchema: import("../../tools/definition").JsonSchemaObject;
|
|
5
|
+
outputSchema: import("../../tools/definition").JsonSchemaObject;
|
|
6
|
+
prepareArguments(args: unknown): {
|
|
7
|
+
task_id: string;
|
|
8
|
+
task?: string | undefined;
|
|
9
|
+
schedule?: {
|
|
10
|
+
kind: "recurring";
|
|
11
|
+
frequency: "daily" | "weekly" | "monthly" | "yearly";
|
|
12
|
+
time: string;
|
|
13
|
+
interval?: number | null | undefined;
|
|
14
|
+
weekdays?: ("sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday")[] | null | undefined;
|
|
15
|
+
day_of_month?: number | null | undefined;
|
|
16
|
+
month?: number | null | undefined;
|
|
17
|
+
start_date?: string | null | undefined;
|
|
18
|
+
timezone?: string | null | undefined;
|
|
19
|
+
} | {
|
|
20
|
+
kind: "one_off";
|
|
21
|
+
timing: {
|
|
22
|
+
type: "after";
|
|
23
|
+
value: number;
|
|
24
|
+
unit: "day" | "hour" | "minute" | "second" | "week";
|
|
25
|
+
} | {
|
|
26
|
+
type: "at";
|
|
27
|
+
date: string;
|
|
28
|
+
time: string;
|
|
29
|
+
};
|
|
30
|
+
timezone?: string | null | undefined;
|
|
31
|
+
} | null | undefined;
|
|
32
|
+
status?: "blocked" | "active" | "paused" | undefined;
|
|
33
|
+
credential_mode?: "system" | "creator" | null | undefined;
|
|
34
|
+
};
|
|
35
|
+
execute?: ((input: unknown, options: import("../../tools/definition").ToolExecuteOptions) => {
|
|
36
|
+
target: string;
|
|
37
|
+
task: {
|
|
38
|
+
id: string;
|
|
39
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
40
|
+
task: string;
|
|
41
|
+
schedule: string;
|
|
42
|
+
timezone: string;
|
|
43
|
+
recurrence: unknown;
|
|
44
|
+
next_run_at: string | null;
|
|
45
|
+
conversation_access: {
|
|
46
|
+
audience: "direct" | "channel" | "group";
|
|
47
|
+
visibility: "public" | "private";
|
|
48
|
+
};
|
|
49
|
+
credential_mode: "system" | "creator";
|
|
50
|
+
last_run_at: string | null;
|
|
51
|
+
run_now_at: string | null;
|
|
52
|
+
};
|
|
53
|
+
truncated?: boolean | undefined;
|
|
54
|
+
continuation?: {
|
|
55
|
+
arguments: Record<string, unknown>;
|
|
56
|
+
reason?: string | undefined;
|
|
57
|
+
} | undefined;
|
|
58
|
+
} | Promise<{
|
|
59
|
+
target: string;
|
|
60
|
+
task: {
|
|
61
|
+
id: string;
|
|
62
|
+
status: "blocked" | "active" | "paused" | "deleted";
|
|
63
|
+
task: string;
|
|
64
|
+
schedule: string;
|
|
65
|
+
timezone: string;
|
|
66
|
+
recurrence: unknown;
|
|
67
|
+
next_run_at: string | null;
|
|
68
|
+
conversation_access: {
|
|
69
|
+
audience: "direct" | "channel" | "group";
|
|
70
|
+
visibility: "public" | "private";
|
|
71
|
+
};
|
|
72
|
+
credential_mode: "system" | "creator";
|
|
73
|
+
last_run_at: string | null;
|
|
74
|
+
run_now_at: string | null;
|
|
75
|
+
};
|
|
76
|
+
truncated?: boolean | undefined;
|
|
77
|
+
continuation?: {
|
|
78
|
+
arguments: Record<string, unknown>;
|
|
79
|
+
reason?: string | undefined;
|
|
80
|
+
} | undefined;
|
|
81
|
+
}>) | undefined;
|
|
82
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { createSlackScheduleCreateTaskTool } from "./tools/create";
|
|
2
|
+
export { createSlackScheduleDeleteTaskTool } from "./tools/delete";
|
|
3
|
+
export { createSlackScheduleListTasksTool } from "./tools/list";
|
|
4
|
+
export { createSlackScheduleRunTaskNowTool } from "./tools/run-now";
|
|
5
|
+
export { createSlackScheduleUpdateTaskTool } from "./tools/update";
|
|
6
|
+
export type { SchedulerToolContext } from "./tool-support";
|