@opencode/protocol 0.0.0-dev-537 → 0.0.0-dev-549
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/groups/experimental.d.ts +55 -1
- package/dist/groups/experimental.js +2 -1
- package/dist/groups/job.d.ts +68 -0
- package/dist/groups/job.js +36 -0
- package/package.json +2 -2
|
@@ -167,7 +167,61 @@ export declare const ExperimentalGroup: import("effect/http-api/HttpApiGroup").H
|
|
|
167
167
|
readonly location: import("effect/Schema").optional<import("effect/Schema").Struct<{
|
|
168
168
|
readonly directory: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
169
169
|
}>>;
|
|
170
|
-
}>>, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Uint8Array>, import("effect/Schema").toCodecJson<typeof import("../errors.js").LocationNotFoundError | typeof import("../errors.js").InvalidRequestError | typeof import("../errors.js").ServiceUnavailableError | typeof import("../errors.js").FileNotFoundError | typeof import("../errors.js").ForbiddenError | typeof import("../errors.js").ArtifactNotFoundError>, never, never> | import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"
|
|
170
|
+
}>>, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Uint8Array>, import("effect/Schema").toCodecJson<typeof import("../errors.js").LocationNotFoundError | typeof import("../errors.js").InvalidRequestError | typeof import("../errors.js").ServiceUnavailableError | typeof import("../errors.js").FileNotFoundError | typeof import("../errors.js").ForbiddenError | typeof import("../errors.js").ArtifactNotFoundError>, never, never> | import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"job.list", "GET", "/api/experimental/job", never, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
171
|
+
readonly sessionID: import("effect/Schema").optional<import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
172
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
173
|
+
}>;
|
|
174
|
+
readonly kind: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["shell", "subagent", "image"]>>;
|
|
175
|
+
readonly status: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["running", "completed", "error", "cancelled"]>>;
|
|
176
|
+
readonly descendants: import("effect/Schema").optional<import("effect/Schema").decodeTo<import("effect/Schema").Boolean, import("effect/Schema").Literals<readonly ["true", "false"]>, never, never>>;
|
|
177
|
+
}>>, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
178
|
+
readonly data: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
179
|
+
readonly id: import("effect/Schema").String;
|
|
180
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
181
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
182
|
+
};
|
|
183
|
+
readonly status: import("effect/Schema").Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
184
|
+
readonly title: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
185
|
+
readonly time: import("effect/Schema").Struct<{
|
|
186
|
+
readonly started: import("effect/Schema").Finite;
|
|
187
|
+
readonly completed: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Finite>>, import("effect/Schema").optionalKey<import("effect/Schema").Finite>, never, never>;
|
|
188
|
+
}>;
|
|
189
|
+
readonly kind: import("effect/Schema").tag<"shell">;
|
|
190
|
+
readonly shellID: import("effect/Schema").String;
|
|
191
|
+
readonly command: import("effect/Schema").String;
|
|
192
|
+
}>, import("effect/Schema").Struct<{
|
|
193
|
+
readonly id: import("effect/Schema").String;
|
|
194
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
195
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
196
|
+
};
|
|
197
|
+
readonly status: import("effect/Schema").Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
198
|
+
readonly title: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
199
|
+
readonly time: import("effect/Schema").Struct<{
|
|
200
|
+
readonly started: import("effect/Schema").Finite;
|
|
201
|
+
readonly completed: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Finite>>, import("effect/Schema").optionalKey<import("effect/Schema").Finite>, never, never>;
|
|
202
|
+
}>;
|
|
203
|
+
readonly kind: import("effect/Schema").tag<"subagent">;
|
|
204
|
+
readonly childSessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
205
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
206
|
+
};
|
|
207
|
+
readonly agent: import("effect/Schema").String;
|
|
208
|
+
readonly description: import("effect/Schema").String;
|
|
209
|
+
}>, import("effect/Schema").Struct<{
|
|
210
|
+
readonly id: import("effect/Schema").String;
|
|
211
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
212
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
213
|
+
};
|
|
214
|
+
readonly status: import("effect/Schema").Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
215
|
+
readonly title: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
216
|
+
readonly time: import("effect/Schema").Struct<{
|
|
217
|
+
readonly started: import("effect/Schema").Finite;
|
|
218
|
+
readonly completed: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Finite>>, import("effect/Schema").optionalKey<import("effect/Schema").Finite>, never, never>;
|
|
219
|
+
}>;
|
|
220
|
+
readonly kind: import("effect/Schema").tag<"image">;
|
|
221
|
+
readonly path: import("effect/Schema").String;
|
|
222
|
+
readonly model: import("effect/Schema").String;
|
|
223
|
+
}>]>>;
|
|
224
|
+
}>>, import("effect/Schema").toCodecJson<typeof import("../errors.js").InvalidRequestError | typeof import("../errors.js").SessionNotFoundError>, never, never> | import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"media.get", "GET", "/api/experimental/media/:hash", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
171
225
|
hash: import("effect/Schema").String;
|
|
172
226
|
}>>, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Uint8Array>, import("effect/Schema").toCodecJson<typeof import("../errors.js").InvalidRequestError | typeof import("../errors.js").FileNotFoundError>, never, never> | import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"persistentPty.connect", "GET", "/api/experimental/persistent-pty/:ptyID/connect", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
173
227
|
ptyID: import("effect/Schema").brand<import("effect/Schema").String, "PtyID"> & {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ArtifactEndpoints } from "./artifact.js";
|
|
2
|
+
import { JobEndpoints } from "./job.js";
|
|
2
3
|
import { MediaGetEndpoint } from "./media.js";
|
|
3
4
|
import { PersistentPtyGroup } from "./persistent-pty.js";
|
|
4
5
|
import { ScheduleEndpoints } from "./schedule.js";
|
|
5
6
|
/** `server.experimental`: routes under /api/experimental, without compatibility guarantees. */
|
|
6
|
-
export const ExperimentalGroup = PersistentPtyGroup.add(MediaGetEndpoint, ...ScheduleEndpoints, ...ArtifactEndpoints);
|
|
7
|
+
export const ExperimentalGroup = PersistentPtyGroup.add(MediaGetEndpoint, ...ScheduleEndpoints, ...ArtifactEndpoints, ...JobEndpoints);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { HttpApiEndpoint } from "effect/http-api";
|
|
3
|
+
import { InvalidRequestError, SessionNotFoundError } from "../errors.js";
|
|
4
|
+
export declare const ListQuery: Schema.Struct<{
|
|
5
|
+
readonly sessionID: Schema.optional<Schema.brand<Schema.String, "SessionID"> & {
|
|
6
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
7
|
+
}>;
|
|
8
|
+
readonly kind: Schema.optional<Schema.Literals<readonly ["shell", "subagent", "image"]>>;
|
|
9
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["running", "completed", "error", "cancelled"]>>;
|
|
10
|
+
readonly descendants: Schema.optional<Schema.decodeTo<Schema.Boolean, Schema.Literals<readonly ["true", "false"]>, never, never>>;
|
|
11
|
+
}>;
|
|
12
|
+
export type ListQuery = typeof ListQuery.Type;
|
|
13
|
+
/** Lives in the `server.experimental` group (see `groups/experimental.ts`). */
|
|
14
|
+
export declare const JobEndpoints: readonly [HttpApiEndpoint.HttpApiEndpoint<"job.list", "GET", "/api/experimental/job", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
15
|
+
readonly sessionID: Schema.optional<Schema.brand<Schema.String, "SessionID"> & {
|
|
16
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
17
|
+
}>;
|
|
18
|
+
readonly kind: Schema.optional<Schema.Literals<readonly ["shell", "subagent", "image"]>>;
|
|
19
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["running", "completed", "error", "cancelled"]>>;
|
|
20
|
+
readonly descendants: Schema.optional<Schema.decodeTo<Schema.Boolean, Schema.Literals<readonly ["true", "false"]>, never, never>>;
|
|
21
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
22
|
+
readonly data: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
23
|
+
readonly id: Schema.String;
|
|
24
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
25
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
26
|
+
};
|
|
27
|
+
readonly status: Schema.Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
28
|
+
readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
29
|
+
readonly time: Schema.Struct<{
|
|
30
|
+
readonly started: Schema.Finite;
|
|
31
|
+
readonly completed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
32
|
+
}>;
|
|
33
|
+
readonly kind: Schema.tag<"shell">;
|
|
34
|
+
readonly shellID: Schema.String;
|
|
35
|
+
readonly command: Schema.String;
|
|
36
|
+
}>, Schema.Struct<{
|
|
37
|
+
readonly id: Schema.String;
|
|
38
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
39
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
40
|
+
};
|
|
41
|
+
readonly status: Schema.Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
42
|
+
readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
43
|
+
readonly time: Schema.Struct<{
|
|
44
|
+
readonly started: Schema.Finite;
|
|
45
|
+
readonly completed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
46
|
+
}>;
|
|
47
|
+
readonly kind: Schema.tag<"subagent">;
|
|
48
|
+
readonly childSessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
49
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
50
|
+
};
|
|
51
|
+
readonly agent: Schema.String;
|
|
52
|
+
readonly description: Schema.String;
|
|
53
|
+
}>, Schema.Struct<{
|
|
54
|
+
readonly id: Schema.String;
|
|
55
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
56
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
57
|
+
};
|
|
58
|
+
readonly status: Schema.Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
59
|
+
readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
60
|
+
readonly time: Schema.Struct<{
|
|
61
|
+
readonly started: Schema.Finite;
|
|
62
|
+
readonly completed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
63
|
+
}>;
|
|
64
|
+
readonly kind: Schema.tag<"image">;
|
|
65
|
+
readonly path: Schema.String;
|
|
66
|
+
readonly model: Schema.String;
|
|
67
|
+
}>]>>;
|
|
68
|
+
}>>, Schema.toCodecJson<typeof InvalidRequestError | typeof SessionNotFoundError>, never, never>];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Job } from "@opencode/schema/job";
|
|
2
|
+
import { Session } from "@opencode/schema/session";
|
|
3
|
+
import { Schema, SchemaGetter } from "effect";
|
|
4
|
+
import { HttpApiEndpoint, OpenApi } from "effect/http-api";
|
|
5
|
+
import { InvalidRequestError, SessionNotFoundError } from "../errors.js";
|
|
6
|
+
const BooleanFromString = Schema.Literals(["true", "false"]).pipe(Schema.decodeTo(Schema.Boolean, {
|
|
7
|
+
decode: SchemaGetter.transform((value) => value === "true"),
|
|
8
|
+
encode: SchemaGetter.transform((value) => (value ? "true" : "false")),
|
|
9
|
+
}));
|
|
10
|
+
export const ListQuery = Schema.Struct({
|
|
11
|
+
sessionID: Schema.optional(Session.ID).annotate({
|
|
12
|
+
description: "Filter to background jobs owned by this session.",
|
|
13
|
+
}),
|
|
14
|
+
kind: Schema.optional(Job.Kind).annotate({
|
|
15
|
+
description: "Filter by background job kind (shell, subagent, or image).",
|
|
16
|
+
}),
|
|
17
|
+
status: Schema.optional(Job.Status).annotate({
|
|
18
|
+
description: "Filter by job status (running, completed, error, or cancelled).",
|
|
19
|
+
}),
|
|
20
|
+
descendants: Schema.optional(BooleanFromString).annotate({
|
|
21
|
+
description: "When sessionID is set, also include background jobs owned by child and nested subagent sessions.",
|
|
22
|
+
}),
|
|
23
|
+
}).annotate({ identifier: "Job.ListQuery" });
|
|
24
|
+
/** Lives in the `server.experimental` group (see `groups/experimental.ts`). */
|
|
25
|
+
export const JobEndpoints = [
|
|
26
|
+
HttpApiEndpoint.get("job.list", "/api/experimental/job", {
|
|
27
|
+
query: ListQuery,
|
|
28
|
+
success: Schema.Struct({ data: Schema.Array(Job.Info) }),
|
|
29
|
+
error: [InvalidRequestError, SessionNotFoundError],
|
|
30
|
+
}).annotateMerge(OpenApi.annotations({
|
|
31
|
+
identifier: "experimental.job.list",
|
|
32
|
+
summary: "List background jobs",
|
|
33
|
+
description: "List active and unconsumed background jobs, optionally filtered by owning session, descendants, or kind. Experimental: may change without compatibility guarantees.",
|
|
34
|
+
transform: (operation) => ({ ...operation, tags: ["experimental"] }),
|
|
35
|
+
})),
|
|
36
|
+
];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@opencode/protocol",
|
|
4
|
-
"version": "0.0.0-dev-
|
|
4
|
+
"version": "0.0.0-dev-549",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"typecheck:tsc": "tsc --noEmit"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@opencode/schema": "0.0.0-dev-
|
|
38
|
+
"@opencode/schema": "0.0.0-dev-549",
|
|
39
39
|
"effect": "4.1.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|