@opencode/protocol 2.3.0 → 2.3.2
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/client.d.ts +1 -0
- package/dist/client.js +31 -0
- package/dist/errors.d.ts +15 -3
- package/dist/errors.js +12 -2
- package/dist/groups/automation.d.ts +459 -0
- package/dist/groups/automation.js +55 -0
- package/dist/groups/blob.d.ts +7 -0
- package/dist/groups/blob.js +16 -0
- package/dist/groups/experimental.d.ts +410 -557
- package/dist/groups/experimental.js +3 -2
- package/dist/groups/generate.d.ts +95 -2
- package/dist/groups/generate.js +19 -1
- package/dist/groups/job.d.ts +14 -2
- package/dist/groups/job.js +1 -1
- package/package.json +2 -2
- package/dist/groups/schedule.d.ts +0 -675
- package/dist/groups/schedule.js +0 -51
package/dist/groups/schedule.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { Schedule } from "@opencode/schema/schedule";
|
|
2
|
-
import { Session } from "@opencode/schema/session";
|
|
3
|
-
import { Schema } from "effect";
|
|
4
|
-
import { HttpApiEndpoint, HttpApiSchema, OpenApi } from "effect/http-api";
|
|
5
|
-
import { ForbiddenError, InvalidRequestError, ScheduleNotFoundError, SessionNotFoundError } from "../errors.js";
|
|
6
|
-
const EXPERIMENTAL = "Experimental: needs experimental.schedules in the Session's config and may change without notice.";
|
|
7
|
-
const errors = [ScheduleNotFoundError, ForbiddenError];
|
|
8
|
-
const params = { scheduleID: Schedule.ID };
|
|
9
|
-
const annotations = (identifier, summary, description) => OpenApi.annotations({
|
|
10
|
-
identifier: `experimental.schedule.${identifier}`,
|
|
11
|
-
summary,
|
|
12
|
-
description: `${description} ${EXPERIMENTAL}`,
|
|
13
|
-
// The routes share the `server.experimental` group with the persistent PTY prototype; tag them on their own.
|
|
14
|
-
transform: (operation) => ({ ...operation, tags: ["experimental"] }),
|
|
15
|
-
});
|
|
16
|
-
export const CreatePayload = Schema.Struct({ sessionID: Session.ID, ...Schedule.Request.fields }).annotate({
|
|
17
|
-
identifier: "Schedule.CreatePayload",
|
|
18
|
-
});
|
|
19
|
-
/** Lives in the `server.experimental` group (see `groups/experimental.ts`). */
|
|
20
|
-
export const ScheduleEndpoints = [
|
|
21
|
-
HttpApiEndpoint.post("schedule.create", "/api/experimental/schedule", {
|
|
22
|
-
payload: CreatePayload,
|
|
23
|
-
success: Schema.Struct({ data: Schedule.Info }),
|
|
24
|
-
error: [InvalidRequestError, SessionNotFoundError, ForbiddenError],
|
|
25
|
-
}).annotateMerge(annotations("create", "Create schedule", "Schedule a prompt that wakes the Session once after a delay, at a time, every interval, or on a cron.")),
|
|
26
|
-
HttpApiEndpoint.get("schedule.list", "/api/experimental/schedule", {
|
|
27
|
-
query: { sessionID: Session.ID },
|
|
28
|
-
success: Schema.Struct({ data: Schema.Array(Schedule.Info) }),
|
|
29
|
-
error: [SessionNotFoundError, ForbiddenError],
|
|
30
|
-
}).annotateMerge(annotations("list", "List schedules", "List a Session's schedules, oldest first.")),
|
|
31
|
-
HttpApiEndpoint.get("schedule.get", "/api/experimental/schedule/:scheduleID", {
|
|
32
|
-
params,
|
|
33
|
-
success: Schema.Struct({ data: Schedule.Info }),
|
|
34
|
-
error: errors,
|
|
35
|
-
}).annotateMerge(annotations("get", "Get schedule", "Read one schedule.")),
|
|
36
|
-
HttpApiEndpoint.post("schedule.pause", "/api/experimental/schedule/:scheduleID/pause", {
|
|
37
|
-
params,
|
|
38
|
-
success: Schema.Struct({ data: Schedule.Info }),
|
|
39
|
-
error: errors,
|
|
40
|
-
}).annotateMerge(annotations("pause", "Pause schedule", "Stop a schedule from firing until it is resumed.")),
|
|
41
|
-
HttpApiEndpoint.post("schedule.resume", "/api/experimental/schedule/:scheduleID/resume", {
|
|
42
|
-
params,
|
|
43
|
-
success: Schema.Struct({ data: Schedule.Info }),
|
|
44
|
-
error: errors,
|
|
45
|
-
}).annotateMerge(annotations("resume", "Resume schedule", "Resume a paused schedule. A one-shot that fell due while paused fires once; a repeating schedule resumes at its next slot.")),
|
|
46
|
-
HttpApiEndpoint.delete("schedule.delete", "/api/experimental/schedule/:scheduleID", {
|
|
47
|
-
params,
|
|
48
|
-
success: HttpApiSchema.NoContent,
|
|
49
|
-
error: errors,
|
|
50
|
-
}).annotateMerge(annotations("delete", "Delete schedule", "Delete a schedule.")),
|
|
51
|
-
];
|