@vite-hub/schedule 0.0.4 → 0.3.1

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.
Files changed (62) hide show
  1. package/README.md +139 -58
  2. package/dist/console-wEhr0LWn.d.ts +330 -0
  3. package/dist/definition.d.ts +8 -6
  4. package/dist/definition.js +34 -28
  5. package/dist/due-BVMRQ93v.js +144 -0
  6. package/dist/durability.d.ts +14 -0
  7. package/dist/durability.js +23 -0
  8. package/dist/error-diagnostics-DSkCJC_L.js +266 -0
  9. package/dist/error-diagnostics-Mpeks7J0.js +166 -0
  10. package/dist/index.d.ts +61 -40
  11. package/dist/index.js +27 -7
  12. package/dist/inspect-DTfAo5gS.js +118 -0
  13. package/dist/invariant-DolT9EEx.js +22 -0
  14. package/dist/kv-storage-C0KZZB6v.d.ts +18 -0
  15. package/dist/{kv-storage-DWinmLLy.js → kv-storage-iJChCS5A.js} +2 -2
  16. package/dist/object-Da1zyPCR.js +11 -0
  17. package/dist/operation-definition-8gOe-ubD.d.ts +234 -0
  18. package/dist/operations-DwZWFIUX.js +184 -0
  19. package/dist/operations.d.ts +84 -0
  20. package/dist/operations.js +318 -0
  21. package/dist/os.d.ts +167 -0
  22. package/dist/os.js +1659 -0
  23. package/dist/registry-module.d.ts +0 -5
  24. package/dist/runtime/console.d.ts +12 -0
  25. package/dist/runtime/console.js +85 -0
  26. package/dist/runtime/kv.d.ts +4 -0
  27. package/dist/{kv-BJ1I9IlJ.js → runtime/kv.js} +1 -1
  28. package/dist/runtime/process.d.ts +53 -5
  29. package/dist/runtime/process.js +501 -251
  30. package/dist/runtime/state.d.ts +2 -13
  31. package/dist/runtime/state.js +2 -2
  32. package/dist/runtime/static.d.ts +44 -12
  33. package/dist/runtime/static.js +2 -150
  34. package/dist/runtime.d.ts +38 -4
  35. package/dist/runtime.js +6 -3
  36. package/dist/started-BuGmnus4.js +201 -0
  37. package/dist/started-Bx7MDbrl.js +146 -0
  38. package/dist/started-errors-p7cu_rI7.js +250 -0
  39. package/dist/state-B-Fuyfb4.js +468 -0
  40. package/dist/state-Do2wV4Tx.d.ts +49 -0
  41. package/dist/static-DQwzzvPg.js +266 -0
  42. package/dist/store-Df0-fzCl.d.ts +53 -0
  43. package/dist/time-zone-SBldrUgt.js +59 -0
  44. package/dist/types-Cw5LjPuc.d.ts +167 -0
  45. package/dist/vite.d.ts +214 -11
  46. package/dist/vite.js +5876 -3
  47. package/dist/wait-until-Dy4Bn3ZN.js +112 -0
  48. package/package.json +65 -24
  49. package/dist/client-DpCD4YFE.js +0 -233
  50. package/dist/discovery-DkFAN7Wd.d.ts +0 -15
  51. package/dist/discovery-DvU3B6iD.js +0 -753
  52. package/dist/due-Bbh4yIxq.js +0 -59
  53. package/dist/execute-B-pii4wf.js +0 -211
  54. package/dist/nuxt.d.ts +0 -19
  55. package/dist/nuxt.js +0 -26
  56. package/dist/runtime/driver.d.ts +0 -26
  57. package/dist/runtime/driver.js +0 -337
  58. package/dist/state-By7WU_ks.js +0 -472
  59. package/dist/store-t-74rsM_.d.ts +0 -48
  60. package/dist/types-Bcje4dLV.d.ts +0 -136
  61. package/dist/vite-BHs17nWX.js +0 -4166
  62. package/dist/wait-until-BzIwzXw4.js +0 -23
@@ -0,0 +1,234 @@
1
+ //#region ../../node_modules/.pnpm/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts
2
+ /** The Standard Typed interface. This is a base type extended by other specs. */
3
+ interface StandardTypedV1<Input = unknown, Output = Input> {
4
+ /** The Standard properties. */
5
+ readonly "~standard": StandardTypedV1.Props<Input, Output>;
6
+ }
7
+ declare namespace StandardTypedV1 {
8
+ /** The Standard Typed properties interface. */
9
+ interface Props<Input = unknown, Output = Input> {
10
+ /** The version number of the standard. */
11
+ readonly version: 1;
12
+ /** The vendor name of the schema library. */
13
+ readonly vendor: string;
14
+ /** Inferred types associated with the schema. */
15
+ readonly types?: Types<Input, Output> | undefined;
16
+ }
17
+ /** The Standard Typed types interface. */
18
+ interface Types<Input = unknown, Output = Input> {
19
+ /** The input type of the schema. */
20
+ readonly input: Input;
21
+ /** The output type of the schema. */
22
+ readonly output: Output;
23
+ }
24
+ /** Infers the input type of a Standard Typed. */
25
+ type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
26
+ /** Infers the output type of a Standard Typed. */
27
+ type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
28
+ }
29
+ /** The Standard Schema interface. */
30
+ interface StandardSchemaV1<Input = unknown, Output = Input> {
31
+ /** The Standard Schema properties. */
32
+ readonly "~standard": StandardSchemaV1.Props<Input, Output>;
33
+ }
34
+ declare namespace StandardSchemaV1 {
35
+ /** The Standard Schema properties interface. */
36
+ interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
37
+ /** Validates unknown input values. */
38
+ readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
39
+ }
40
+ /** The result interface of the validate function. */
41
+ type Result<Output> = SuccessResult<Output> | FailureResult;
42
+ /** The result interface if validation succeeds. */
43
+ interface SuccessResult<Output> {
44
+ /** The typed output value. */
45
+ readonly value: Output;
46
+ /** A falsy value for `issues` indicates success. */
47
+ readonly issues?: undefined;
48
+ }
49
+ interface Options {
50
+ /** Explicit support for additional vendor-specific parameters, if needed. */
51
+ readonly libraryOptions?: Record<string, unknown> | undefined;
52
+ }
53
+ /** The result interface if validation fails. */
54
+ interface FailureResult {
55
+ /** The issues of failed validation. */
56
+ readonly issues: ReadonlyArray<Issue>;
57
+ }
58
+ /** The issue interface of the failure output. */
59
+ interface Issue {
60
+ /** The error message of the issue. */
61
+ readonly message: string;
62
+ /** The path of the issue, if any. */
63
+ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
64
+ }
65
+ /** The path segment interface of the issue. */
66
+ interface PathSegment {
67
+ /** The key representing a path segment. */
68
+ readonly key: PropertyKey;
69
+ }
70
+ /** The Standard types interface. */
71
+ interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
72
+ /** Infers the input type of a Standard. */
73
+ type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
74
+ /** Infers the output type of a Standard. */
75
+ type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
76
+ }
77
+ //#endregion
78
+ //#region ../internal/src/operation-definition.d.ts
79
+ /** `read` never changes state. `write` changes state. `destructive` deletes or publishes. */
80
+ type OperationKind = "read" | "write" | "destructive";
81
+ /** The signed-in user of a call. */
82
+ interface OperationUser {
83
+ id: string;
84
+ name?: string;
85
+ email?: string;
86
+ image?: string;
87
+ [key: string]: unknown;
88
+ }
89
+ /** The Agent Actor when an agent calls through a capability or MCP on behalf of a user. */
90
+ interface OperationActor {
91
+ id: string;
92
+ kind?: string;
93
+ label?: string;
94
+ meta?: object;
95
+ }
96
+ /** The checked Console access of a call. `vite-hub` issues it. `ConsoleAccess` has this shape. */
97
+ interface OperationAccess {
98
+ readonly mode: string;
99
+ /**
100
+ * The sections that the call may use. `"all"` when no section filter applies. An entry is a section id (`"kv"`, every
101
+ * operation of the section), `"<section>:read"` (only the operations that read), or `"<section>:<scope>"` (only the
102
+ * calls of a scoped operation for that scope, such as `"blob:media"` for one Blob store). `"<section>:<scope>:read"`
103
+ * allows only the reads of that scope.
104
+ */
105
+ readonly sections: "all" | readonly string[];
106
+ readonly user?: OperationUser;
107
+ }
108
+ interface OperationContext {
109
+ /** The checked Console access of the call. */
110
+ access: OperationAccess;
111
+ /** The signed-in user, or null. */
112
+ user: OperationUser | null;
113
+ /** The Agent Actor when an agent calls on behalf of `user`. */
114
+ actor?: OperationActor;
115
+ surface: "console" | "cli" | "mcp" | "agent";
116
+ /** Set by the host from generated build identity, never from request input or runtime NODE_ENV. */
117
+ development?: boolean;
118
+ env?: Record<string, unknown>;
119
+ waitUntil?: (task: Promise<unknown>) => void;
120
+ request?: Request;
121
+ /**
122
+ * The request event of the HTTP request that carries the call, when there is one: the Request of the Console route,
123
+ * with its Standard Context. Operations hand it to app hooks that read the request's own session, such as `identify`
124
+ * of Comments.
125
+ */
126
+ event?: unknown;
127
+ /** Operations set a success status here, such as 202 for an accepted call. */
128
+ response?: {
129
+ status?: number;
130
+ };
131
+ /**
132
+ * An agent or an MCP client may pass `lease: "override"` to `content.save`, `content.remove`, and `content.restore`
133
+ * only when the developer allowed it. Defaults to false, so a model cannot take over a document that a person is editing.
134
+ */
135
+ overrideLeases?: boolean;
136
+ /**
137
+ * What an Agent may read of the Channel conversations, set by `operations({ conversations })`. `participant`: only the
138
+ * threads that the Actor takes part in. `all`: every thread. Unset: none.
139
+ */
140
+ conversations?: "all" | "participant";
141
+ }
142
+ interface OperationDefinition<Input, Output> {
143
+ /** `<section>.<verb>`, such as `content.publish`. Unique per app. */
144
+ name: string;
145
+ /** One sentence. Becomes the CLI help line and the MCP tool description. */
146
+ description: string;
147
+ /**
148
+ * Console section that grants access, such as `content`. `false`: any Console user. A function reads the section
149
+ * from the input, for operations that serve several sections. Section ids cannot contain `:`; it is reserved for
150
+ * scope and read-only grants. A function that returns an invalid id denies the call.
151
+ */
152
+ section: string | false | ((input: Input) => string | undefined);
153
+ /**
154
+ * The part of a string `section` that one call uses, such as the Blob store that the input names. The call then needs
155
+ * the section (every scope) or `"<section>:<scope>"` (only this scope). A scope that is empty, is `read`, or has a
156
+ * `:` needs the whole section.
157
+ */
158
+ scope?: (input: Input) => string | undefined;
159
+ /** `read` never changes state. `write` changes state. `destructive` deletes or publishes; the CLI asks for `--yes`, MCP marks `destructiveHint`, agents require approval by default. */
160
+ kind: OperationKind;
161
+ /** Standard Schema (valibot in this repo). Its Standard JSON Schema builds CLI flags and the MCP input schema. */
162
+ input: StandardSchemaV1<unknown, Input>;
163
+ output?: StandardSchemaV1<unknown, Output>;
164
+ cli?: {
165
+ /** Defaults: namespace = section, command = verb. */
166
+ namespace?: string;
167
+ /** A space groups commands: `jobs list` and `jobs show` run as `vitehub <namespace> jobs list` and `jobs show`. */
168
+ command?: string;
169
+ /** Input keys read from positional arguments, in order. */
170
+ positional?: string[];
171
+ /** Human output, written verbatim. Without it the CLI prints JSON. `--json` always prints JSON. */
172
+ format?: (output: Output) => string;
173
+ /** `vitehub <namespace>` runs this command when no command is named. */
174
+ default?: boolean;
175
+ };
176
+ /** Largest request body in bytes. It can raise the 64 KiB default but not lower it. */
177
+ maxRequestBytes?: number;
178
+ /**
179
+ * Returns true when this call only reads, such as a dry run of a `destructive` operation. The CLI then skips the
180
+ * confirmation, and agents run it without approval. Without it, every call of a `destructive` operation asks.
181
+ */
182
+ readOnlyWhen?: (input: Input) => boolean;
183
+ /**
184
+ * How MCP offers the operation as a tool. `false`: MCP does not offer it, such as an editor transport that only the
185
+ * Console uses. `title`: the short title that clients show, instead of the name in words. `format`: the text of a
186
+ * result for the Agent, such as a list of lines. The result stays the structured content. Without `format`, the text
187
+ * is the result as JSON.
188
+ */
189
+ mcp?: false | {
190
+ title?: string;
191
+ format?: (output: NoInfer<Output>) => string;
192
+ };
193
+ /** `false`: the operation never reads `context.user`, so the Console skips the session lookup for it. */
194
+ user?: false;
195
+ /**
196
+ * The operation runs code of the app, such as a workflow, a job, a task, or a schedule. The Console registers it only
197
+ * when `console.invoke` is on, which is the default in development and off in a production build.
198
+ */
199
+ invoke?: true;
200
+ run: (input: Input, context: OperationContext) => Output | Promise<Output>;
201
+ }
202
+ /** An operation of any input and output, as a registry holds it. */
203
+ interface AnyOperation extends Omit<OperationDefinition<unknown, unknown>, "cli" | "input" | "mcp" | "output" | "readOnlyWhen" | "run" | "scope" | "section"> {
204
+ readOnlyWhen?: (input: never) => boolean;
205
+ cli?: {
206
+ namespace?: string;
207
+ command?: string;
208
+ default?: boolean;
209
+ positional?: string[];
210
+ format?: (output: never) => string;
211
+ };
212
+ mcp?: false | {
213
+ title?: string;
214
+ format?: (output: never) => string;
215
+ };
216
+ input: StandardSchemaV1;
217
+ output?: StandardSchemaV1;
218
+ run: (input: never, context: OperationContext) => unknown;
219
+ scope?: (input: never) => string | undefined;
220
+ section: string | false | ((input: never) => string | undefined);
221
+ }
222
+ /** The contribution of one plugin: operations, or a module that exports them. */
223
+ interface OperationContributionEntry {
224
+ /** The absolute path of the module that generated code imports, such as `ownModule(import.meta.url, "operations")`. */
225
+ module: string;
226
+ /** Named export that holds an operation or an array of operations. Defaults to `default`. */
227
+ export?: string;
228
+ /** Loads the export in the tool process, for a module that the tool cannot resolve by name. */
229
+ load?: () => Promise<unknown>;
230
+ /** `false`: the app already has these operations at runtime. Only tools such as the CLI and `vitehub inspect` read the entry. */
231
+ runtime?: false;
232
+ }
233
+ //#endregion
234
+ export { OperationContributionEntry as n, AnyOperation as t };
@@ -0,0 +1,184 @@
1
+ import { t as scheduleErrorDiagnostics } from "./error-diagnostics-Mpeks7J0.js";
2
+ import { a as runScheduleFrom } from "./started-errors-p7cu_rI7.js";
3
+ import { r as getScheduleRunStore } from "./state-B-Fuyfb4.js";
4
+ import { i as startSchedule, r as listSchedules, t as cancelSchedule } from "./started-Bx7MDbrl.js";
5
+ import { t as redactInspectionText } from "./inspect-DTfAo5gS.js";
6
+ //#region src/runtime/operations.ts
7
+ function isoDate(value) {
8
+ if (value === void 0) return;
9
+ const date = value instanceof Date ? value : new Date(value);
10
+ return Number.isNaN(date.getTime()) ? String(value) : date.toISOString();
11
+ }
12
+ function summarizeError(error) {
13
+ if (!error) return;
14
+ const summary = { message: redactInspectionText(error.message) };
15
+ if (error.name) summary.name = redactInspectionText(error.name);
16
+ return summary;
17
+ }
18
+ function summarizeScheduleRun(run) {
19
+ const error = summarizeError(run.error);
20
+ const completedAt = isoDate(run.completedAt);
21
+ const startedAt = isoDate(run.startedAt);
22
+ const summary = {
23
+ attemptCount: run.attemptCount,
24
+ id: run.id,
25
+ scheduleId: run.scheduleId,
26
+ scheduledAt: isoDate(run.scheduledAt) ?? "",
27
+ status: run.status,
28
+ target: run.target
29
+ };
30
+ if (completedAt) summary.completedAt = completedAt;
31
+ if (error) summary.error = error;
32
+ if (run.response) summary.response = {
33
+ status: run.response.status,
34
+ statusText: redactInspectionText(run.response.statusText)
35
+ };
36
+ if (startedAt) summary.startedAt = startedAt;
37
+ return summary;
38
+ }
39
+ function summarizeManualScheduleRun(run) {
40
+ const error = summarizeError(run.error);
41
+ const completedAt = isoDate(run.completedAt);
42
+ const startedAt = isoDate(run.startedAt);
43
+ return {
44
+ ...completedAt ? { completedAt } : {},
45
+ ...error ? { error } : {},
46
+ id: run.id,
47
+ scheduleId: run.scheduleId,
48
+ scheduledAt: isoDate(run.scheduledAt) ?? "",
49
+ ...startedAt ? { startedAt } : {},
50
+ status: run.status
51
+ };
52
+ }
53
+ function summarizeScheduleRunAttempt(attempt) {
54
+ const error = summarizeError(attempt.error);
55
+ const completedAt = isoDate(attempt.completedAt);
56
+ return {
57
+ ...completedAt ? { completedAt } : {},
58
+ ...error ? { error } : {},
59
+ id: attempt.id,
60
+ runId: attempt.runId,
61
+ startedAt: isoDate(attempt.startedAt) ?? "",
62
+ status: attempt.status
63
+ };
64
+ }
65
+ function newestFirst(left, right) {
66
+ return new Date(right.scheduledAt).getTime() - new Date(left.scheduledAt).getTime();
67
+ }
68
+ /** Lists the recorded runs of one Schedule Definition, newest first. */
69
+ async function listScheduleRuns(scheduleId, options = {}) {
70
+ const runs = (await getScheduleRunStore().listRuns({
71
+ scheduleId,
72
+ limit: options.limit
73
+ })).filter((run) => run.scheduleId === scheduleId).sort(newestFirst);
74
+ return (options.limit === void 0 ? runs : runs.slice(0, options.limit)).map(summarizeScheduleRun);
75
+ }
76
+ /** Lists the attempts of one Schedule Run, oldest first. */
77
+ async function listScheduleRunAttempts(runId) {
78
+ return [...await getScheduleRunStore().listAttempts(runId)].sort((left, right) => new Date(left.startedAt).getTime() - new Date(right.startedAt).getTime()).map(summarizeScheduleRunAttempt);
79
+ }
80
+ /** Gives an operation error its HTTP status and the redacted message that the CLI and the Console report. */
81
+ function withStatus(error, status, fix) {
82
+ return Object.defineProperties(error, {
83
+ ...fix && !Reflect.get(error, "fix") ? { fix: {
84
+ configurable: true,
85
+ enumerable: false,
86
+ value: fix,
87
+ writable: true
88
+ } } : {},
89
+ status: {
90
+ configurable: true,
91
+ enumerable: false,
92
+ value: status,
93
+ writable: true
94
+ },
95
+ statusMessage: {
96
+ configurable: true,
97
+ enumerable: false,
98
+ value: redactInspectionText(error.message),
99
+ writable: true
100
+ }
101
+ });
102
+ }
103
+ const errorFix = { SCHEDULE_INVALID_SCHEDULED_AT: "Pass `at` as an ISO 8601 date-time with a time zone, such as 2026-01-31T23:59:00Z or 2026-01-31T23:59:00+01:00." };
104
+ const errorStatus = {
105
+ SCHEDULE_DEFINITION_NOT_FOUND: 404,
106
+ SCHEDULE_HISTORY_INCOMPLETE: 503,
107
+ SCHEDULE_INVALID_SCHEDULED_AT: 400,
108
+ SCHEDULE_MANUAL_RUN_DISABLED: 403,
109
+ SCHEDULE_OPERATION_FAILED: 500,
110
+ SCHEDULE_RUN_NOT_FOUND: 404
111
+ };
112
+ /** Gives a Schedule error the status and the redacted message that every surface reports. */
113
+ async function attempt(work) {
114
+ try {
115
+ return await work();
116
+ } catch (error) {
117
+ const code = Reflect.get(Object(error), "code");
118
+ const status = String(code) === code ? errorStatus[code] : void 0;
119
+ if (status && error instanceof Error) throw withStatus(error, status, errorFix[String(code)]);
120
+ throw withStatus(scheduleErrorDiagnostics.SCHEDULE_OPERATION_FAILED({ cause: error }), 500);
121
+ }
122
+ }
123
+ async function runScheduleRuns(input) {
124
+ return await attempt(async () => ({ runs: await listScheduleRuns(input.id, { limit: input.limit ?? 100 }) }));
125
+ }
126
+ async function runScheduleAttempts(input) {
127
+ return await attempt(async () => {
128
+ const run = await getScheduleRunStore().getRun(input.id);
129
+ if (!run) throw scheduleErrorDiagnostics.SCHEDULE_RUN_NOT_FOUND();
130
+ return {
131
+ attempts: await listScheduleRunAttempts(input.id),
132
+ run: summarizeScheduleRun(run)
133
+ };
134
+ });
135
+ }
136
+ /** The manual Static Schedule Definitions that the Console installed. Only `console.invoke` installs them. */
137
+ const consoleSchedulesKey = Symbol.for("vitehub.console.schedules");
138
+ /**
139
+ * Runs a Static Schedule Definition that sets `manual: true`, as if its cron fired at `at` (default: now). The registry holds only those definitions, and it is empty
140
+ * unless Console invocation is enabled, so anything else is "not available".
141
+ */
142
+ async function runScheduleNow(input, registry = Reflect.get(globalThis, consoleSchedulesKey) ?? {}) {
143
+ if (!Object.hasOwn(registry, input.name)) throw withStatus(scheduleErrorDiagnostics.SCHEDULE_DEFINITION_NOT_FOUND(), 404);
144
+ return await attempt(async () => ({ run: summarizeManualScheduleRun(await runScheduleFrom(registry, input.name, { scheduledAt: input.at })) }));
145
+ }
146
+ function summarizeStartedSchedule(schedule) {
147
+ return {
148
+ ...schedule.at ? { at: schedule.at.toISOString() } : {},
149
+ createdAt: schedule.createdAt.toISOString(),
150
+ ...schedule.cron === void 0 ? {} : { cron: schedule.cron },
151
+ id: schedule.id,
152
+ ...schedule.payload === void 0 ? {} : { payload: schedule.payload },
153
+ name: schedule.name,
154
+ ...schedule.timeZone === void 0 ? {} : { timeZone: schedule.timeZone }
155
+ };
156
+ }
157
+ const startedErrorStatus = {
158
+ SCHEDULE_INVALID_OPTIONS: 400,
159
+ SCHEDULE_NOT_FOUND: 404,
160
+ SCHEDULE_NOT_STARTABLE: 404,
161
+ SCHEDULE_STORE_FAILED: 503,
162
+ SCHEDULE_STORE_MISSING: 503
163
+ };
164
+ function operationError(error) {
165
+ return withStatus(error, startedErrorStatus[error.code] ?? 500);
166
+ }
167
+ async function runScheduleList(input) {
168
+ const [error, schedules] = await listSchedules(input.name === void 0 ? {} : { name: input.name });
169
+ if (error) throw operationError(error);
170
+ return { schedules: schedules.map(summarizeStartedSchedule) };
171
+ }
172
+ async function runScheduleStart(input) {
173
+ const { name, ...options } = input;
174
+ const [error, schedule] = await startSchedule(name, options);
175
+ if (error) throw operationError(error);
176
+ return { schedule: summarizeStartedSchedule(schedule) };
177
+ }
178
+ async function runScheduleCancel(input) {
179
+ const [error, schedule] = await cancelSchedule(input.id);
180
+ if (error) throw operationError(error);
181
+ return { schedule: summarizeStartedSchedule(schedule) };
182
+ }
183
+ //#endregion
184
+ export { listScheduleRunAttempts, listScheduleRuns, runScheduleAttempts, runScheduleCancel, runScheduleList, runScheduleNow, runScheduleRuns, runScheduleStart, summarizeScheduleRun, summarizeScheduleRunAttempt };
@@ -0,0 +1,84 @@
1
+ import { h as ScheduleRunStatus, l as ScheduleRunAttemptStatus } from "./types-Cw5LjPuc.js";
2
+ import { t as AnyOperation } from "./operation-definition-8gOe-ubD.js";
3
+ //#region src/runtime/operations.d.ts
4
+ /** Error of a run or attempt. The stack is not included. */
5
+ interface ScheduleRunErrorSummary {
6
+ message: string;
7
+ name?: string;
8
+ }
9
+ /** Serializable view of one Schedule Run. The response body is not included. */
10
+ interface ScheduleRunSummary {
11
+ attemptCount: number;
12
+ completedAt?: string;
13
+ error?: ScheduleRunErrorSummary;
14
+ id: string;
15
+ response?: {
16
+ status: number;
17
+ statusText: string;
18
+ };
19
+ scheduleId: string;
20
+ scheduledAt: string;
21
+ startedAt?: string;
22
+ status: ScheduleRunStatus;
23
+ target: string;
24
+ }
25
+ /** Serializable view of one Schedule Run attempt. */
26
+ interface ScheduleRunAttemptSummary {
27
+ completedAt?: string;
28
+ error?: ScheduleRunErrorSummary;
29
+ id: string;
30
+ runId: string;
31
+ startedAt: string;
32
+ status: ScheduleRunAttemptStatus;
33
+ }
34
+ /** Serializable view of one manual Static Schedule run, as `vitehub schedule run` prints it. */
35
+ interface ManualScheduleRunSummary {
36
+ completedAt?: string;
37
+ error?: ScheduleRunErrorSummary;
38
+ id: string;
39
+ scheduleId: string;
40
+ /** The fire time that the handler received. */
41
+ scheduledAt: string;
42
+ startedAt?: string;
43
+ status: ScheduleRunStatus;
44
+ }
45
+ /** Result of `schedule.runs`. */
46
+ interface ScheduleRunsResult {
47
+ runs: ScheduleRunSummary[];
48
+ }
49
+ /** Result of `schedule.attempts`. */
50
+ interface ScheduleAttemptsResult {
51
+ attempts: ScheduleRunAttemptSummary[];
52
+ run: ScheduleRunSummary;
53
+ }
54
+ /** Result of `schedule.run`. */
55
+ interface ScheduleRunResult {
56
+ run: ManualScheduleRunSummary;
57
+ }
58
+ /** Serializable view of one started Schedule, as `vitehub schedule list` prints it. */
59
+ interface StartedScheduleSummary {
60
+ at?: string;
61
+ createdAt: string;
62
+ cron?: string;
63
+ id: string;
64
+ name: string;
65
+ payload?: unknown;
66
+ timeZone?: string;
67
+ }
68
+ /** Result of `schedule.list`. */
69
+ interface ScheduleListResult {
70
+ schedules: StartedScheduleSummary[];
71
+ }
72
+ /** Result of `schedule.start` and `schedule.cancel`. */
73
+ interface StartedScheduleResult {
74
+ schedule: StartedScheduleSummary;
75
+ }
76
+ //#endregion
77
+ //#region src/operations.d.ts
78
+ /**
79
+ * The `schedule.*` operations: runs, attempts, run, list, start, and cancel. The Console, `vitehub schedule`, and agents
80
+ * run them.
81
+ */
82
+ export declare const scheduleOperations: readonly AnyOperation[];
83
+ //#endregion
84
+ export type { ScheduleAttemptsResult, ScheduleListResult, ScheduleRunResult, ScheduleRunsResult, StartedScheduleResult };