@radheim/protocol 0.0.0-stage → 2.4.3
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/api.d.ts +60 -0
- package/dist/api.js +81 -0
- package/dist/client.d.ts +69 -0
- package/dist/client.js +102 -0
- package/dist/errors.d.ts +273 -0
- package/dist/errors.js +227 -0
- package/dist/groups/agent.d.ts +299 -0
- package/dist/groups/agent.js +30 -0
- package/dist/groups/artifact.d.ts +173 -0
- package/dist/groups/artifact.js +80 -0
- package/dist/groups/automation.d.ts +480 -0
- package/dist/groups/automation.js +55 -0
- package/dist/groups/blob.d.ts +415 -0
- package/dist/groups/blob.js +79 -0
- package/dist/groups/command.d.ts +15 -0
- package/dist/groups/command.js +20 -0
- package/dist/groups/config.d.ts +27 -0
- package/dist/groups/config.js +32 -0
- package/dist/groups/credential.d.ts +93 -0
- package/dist/groups/credential.js +50 -0
- package/dist/groups/debug.d.ts +22 -0
- package/dist/groups/debug.js +49 -0
- package/dist/groups/event.d.ts +16442 -0
- package/dist/groups/event.js +68 -0
- package/dist/groups/experimental/browser-tunnel.d.ts +20 -0
- package/dist/groups/experimental/browser-tunnel.js +29 -0
- package/dist/groups/experimental.d.ts +1519 -0
- package/dist/groups/experimental.js +12 -0
- package/dist/groups/flag.d.ts +12 -0
- package/dist/groups/flag.js +19 -0
- package/dist/groups/form.d.ts +138 -0
- package/dist/groups/form.js +18 -0
- package/dist/groups/fs.d.ts +60 -0
- package/dist/groups/fs.js +101 -0
- package/dist/groups/generate.d.ts +397 -0
- package/dist/groups/generate.js +77 -0
- package/dist/groups/integration.d.ts +1724 -0
- package/dist/groups/integration.js +169 -0
- package/dist/groups/job.d.ts +95 -0
- package/dist/groups/job.js +45 -0
- package/dist/groups/location.d.ts +23 -0
- package/dist/groups/location.js +47 -0
- package/dist/groups/machine.d.ts +91 -0
- package/dist/groups/machine.js +61 -0
- package/dist/groups/mcp.d.ts +104 -0
- package/dist/groups/mcp.js +125 -0
- package/dist/groups/media.d.ts +8 -0
- package/dist/groups/media.js +18 -0
- package/dist/groups/message.d.ts +3696 -0
- package/dist/groups/message.js +102 -0
- package/dist/groups/migration.d.ts +28 -0
- package/dist/groups/migration.js +21 -0
- package/dist/groups/model.d.ts +536 -0
- package/dist/groups/model.js +39 -0
- package/dist/groups/permission.d.ts +175 -0
- package/dist/groups/permission.js +115 -0
- package/dist/groups/persistent-pty.d.ts +251 -0
- package/dist/groups/persistent-pty.js +109 -0
- package/dist/groups/plugin.d.ts +102 -0
- package/dist/groups/plugin.js +59 -0
- package/dist/groups/project.d.ts +83 -0
- package/dist/groups/project.js +37 -0
- package/dist/groups/provider.d.ts +354 -0
- package/dist/groups/provider.js +34 -0
- package/dist/groups/pty.d.ts +151 -0
- package/dist/groups/pty.js +117 -0
- package/dist/groups/push.d.ts +123 -0
- package/dist/groups/push.js +60 -0
- package/dist/groups/reference.d.ts +25 -0
- package/dist/groups/reference.js +33 -0
- package/dist/groups/rpc.d.ts +21 -0
- package/dist/groups/rpc.js +24 -0
- package/dist/groups/server.d.ts +46 -0
- package/dist/groups/server.js +55 -0
- package/dist/groups/session.d.ts +11874 -0
- package/dist/groups/session.js +663 -0
- package/dist/groups/shell.d.ts +125 -0
- package/dist/groups/shell.js +65 -0
- package/dist/groups/skill.d.ts +26 -0
- package/dist/groups/skill.js +34 -0
- package/dist/groups/space.d.ts +56 -0
- package/dist/groups/space.js +59 -0
- package/dist/groups/usage.d.ts +96 -0
- package/dist/groups/usage.js +22 -0
- package/dist/groups/vcs.d.ts +89 -0
- package/dist/groups/vcs.js +94 -0
- package/dist/groups/voice.d.ts +81 -0
- package/dist/groups/voice.js +75 -0
- package/dist/groups/websearch.d.ts +29 -0
- package/dist/groups/websearch.js +34 -0
- package/dist/groups/worktree.d.ts +41 -0
- package/dist/groups/worktree.js +52 -0
- package/dist/middleware/authorization.d.ts +13 -0
- package/dist/middleware/authorization.js +6 -0
- package/dist/middleware/schema-error.d.ts +13 -0
- package/dist/middleware/schema-error.js +4 -0
- package/dist/simulation/image.d.ts +35 -0
- package/dist/simulation/image.js +21 -0
- package/dist/simulation/terminal.d.ts +81 -0
- package/dist/simulation/terminal.js +49 -0
- package/dist/simulation.d.ts +1784 -0
- package/dist/simulation.js +485 -0
- package/package.json +46 -4
- package/README.md +0 -3
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Session } from "@radheim/schema/session";
|
|
2
|
+
import { SessionMessage } from "@radheim/schema/session-message";
|
|
3
|
+
import { Location } from "@radheim/schema/location";
|
|
4
|
+
import { Schema, Struct } from "effect";
|
|
5
|
+
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api";
|
|
6
|
+
import { InvalidCursorError, SessionNotFoundError, UnknownError } from "../errors.js";
|
|
7
|
+
// Keyed by message type so a new message type cannot be left out of the filter.
|
|
8
|
+
const MessageTypes = {
|
|
9
|
+
"agent-switched": true,
|
|
10
|
+
"model-switched": true,
|
|
11
|
+
"location-switched": true,
|
|
12
|
+
user: true,
|
|
13
|
+
synthetic: true,
|
|
14
|
+
system: true,
|
|
15
|
+
skill: true,
|
|
16
|
+
shell: true,
|
|
17
|
+
assistant: true,
|
|
18
|
+
compaction: true,
|
|
19
|
+
idle: true,
|
|
20
|
+
};
|
|
21
|
+
export const SessionMessagesQuery = Schema.Struct({
|
|
22
|
+
limit: Schema.optional(Schema.NumberFromString.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(200))).annotate({
|
|
23
|
+
description: "Maximum number of messages to return. When omitted, the endpoint returns its default page size.",
|
|
24
|
+
}),
|
|
25
|
+
order: Schema.optional(Schema.Union([Schema.Literal("asc"), Schema.Literal("desc")])).annotate({
|
|
26
|
+
description: "Message order for the first page. Use desc for newest first or asc for oldest first.",
|
|
27
|
+
}),
|
|
28
|
+
cursor: Schema.optional(Schema.String.annotate({
|
|
29
|
+
description: "Opaque pagination cursor returned as cursor.previous or cursor.next in the previous response. Do not combine with order.",
|
|
30
|
+
})),
|
|
31
|
+
type: Schema.optional(Schema.Literals(Object.keys(MessageTypes))).annotate({
|
|
32
|
+
description: "Filter by message type before pagination. When omitted, all message types are returned. Pass the same type when following cursors.",
|
|
33
|
+
}),
|
|
34
|
+
}).annotate({ identifier: "SessionMessagesQuery" });
|
|
35
|
+
const PublicLocationSwitched = Schema.Struct({
|
|
36
|
+
...Struct.omit(SessionMessage.LocationSwitched.fields, ["location", "previous"]),
|
|
37
|
+
location: Location.PublicRef,
|
|
38
|
+
previous: Schema.Struct({
|
|
39
|
+
location: Location.PublicRef,
|
|
40
|
+
projectID: SessionMessage.LocationSwitched.fields.projectID,
|
|
41
|
+
subpath: SessionMessage.LocationSwitched.fields.subpath,
|
|
42
|
+
}).pipe(Schema.optional),
|
|
43
|
+
}).annotate({ identifier: "Session.Message.LocationSwitched" });
|
|
44
|
+
export const PublicSessionMessage = Schema.Union([
|
|
45
|
+
SessionMessage.AgentSelected,
|
|
46
|
+
SessionMessage.ModelSelected,
|
|
47
|
+
PublicLocationSwitched,
|
|
48
|
+
SessionMessage.User,
|
|
49
|
+
SessionMessage.Synthetic,
|
|
50
|
+
SessionMessage.System,
|
|
51
|
+
SessionMessage.Skill,
|
|
52
|
+
SessionMessage.Shell,
|
|
53
|
+
SessionMessage.Assistant,
|
|
54
|
+
SessionMessage.Compaction,
|
|
55
|
+
SessionMessage.Idle,
|
|
56
|
+
]).annotate({ identifier: "Session.Message.Info" });
|
|
57
|
+
/**
|
|
58
|
+
* Experimental: {@link PublicSessionMessage} as sent to clients that opt in with `X-OpenCode-Capabilities:
|
|
59
|
+
* experimental-media-uri` while `experimental.media_blob` is on. User files stored in `blob` stay `media:` refs.
|
|
60
|
+
*/
|
|
61
|
+
export const PublicMediaSessionMessage = Schema.Union([
|
|
62
|
+
SessionMessage.AgentSelected,
|
|
63
|
+
SessionMessage.ModelSelected,
|
|
64
|
+
PublicLocationSwitched,
|
|
65
|
+
SessionMessage.MediaUser,
|
|
66
|
+
SessionMessage.Synthetic,
|
|
67
|
+
SessionMessage.System,
|
|
68
|
+
SessionMessage.Skill,
|
|
69
|
+
SessionMessage.Shell,
|
|
70
|
+
SessionMessage.Assistant,
|
|
71
|
+
SessionMessage.Compaction,
|
|
72
|
+
SessionMessage.Idle,
|
|
73
|
+
]).annotate({ identifier: "Session.Message.MediaInfo" });
|
|
74
|
+
const MessagesCursor = Schema.Struct({
|
|
75
|
+
previous: Schema.String.pipe(Schema.optional),
|
|
76
|
+
next: Schema.String.pipe(Schema.optional),
|
|
77
|
+
});
|
|
78
|
+
/** Experimental: the `session.messages` response for clients that opt into `experimental-media-uri`. */
|
|
79
|
+
export const SessionMediaMessagesResponse = Schema.Struct({
|
|
80
|
+
data: Schema.Array(PublicMediaSessionMessage),
|
|
81
|
+
cursor: MessagesCursor,
|
|
82
|
+
});
|
|
83
|
+
/** Experimental: the `session.message` response for clients that opt into `experimental-media-uri`. */
|
|
84
|
+
export const SessionMediaMessageResponse = Schema.Struct({ data: PublicMediaSessionMessage });
|
|
85
|
+
export const MessageGroup = HttpApiGroup.make("server.message")
|
|
86
|
+
.add(HttpApiEndpoint.get("session.messages", "/api/session/:sessionID/message", {
|
|
87
|
+
params: { sessionID: Session.ID },
|
|
88
|
+
query: SessionMessagesQuery,
|
|
89
|
+
success: Schema.Struct({
|
|
90
|
+
data: Schema.Array(PublicSessionMessage),
|
|
91
|
+
cursor: MessagesCursor,
|
|
92
|
+
}).annotate({ identifier: "SessionMessagesResponse" }),
|
|
93
|
+
error: [InvalidCursorError, SessionNotFoundError, UnknownError],
|
|
94
|
+
}).annotateMerge(OpenApi.annotations({
|
|
95
|
+
identifier: "session.message.list",
|
|
96
|
+
summary: "Get session messages",
|
|
97
|
+
description: "List a session's messages, optionally filtered by type. Follow cursor.next or cursor.previous with the same type filter. Items still in the inbox aren't included.",
|
|
98
|
+
})))
|
|
99
|
+
.annotateMerge(OpenApi.annotations({
|
|
100
|
+
title: "session",
|
|
101
|
+
description: "Experimental message routes.",
|
|
102
|
+
}));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { HttpApiEndpoint, HttpApiGroup } from "effect/http-api";
|
|
3
|
+
export declare const V1MigrationStatus: Schema.Union<readonly [Schema.Struct<{
|
|
4
|
+
readonly status: Schema.Literals<readonly ["required", "completed"]>;
|
|
5
|
+
}>, Schema.Struct<{
|
|
6
|
+
readonly status: Schema.Literal<"running">;
|
|
7
|
+
readonly progress: Schema.Struct<{
|
|
8
|
+
readonly label: Schema.String;
|
|
9
|
+
readonly numerator: Schema.optional<Schema.Int>;
|
|
10
|
+
readonly denominator: Schema.optional<Schema.Int>;
|
|
11
|
+
}>;
|
|
12
|
+
}>, Schema.Struct<{
|
|
13
|
+
readonly status: Schema.Literal<"error">;
|
|
14
|
+
readonly error: Schema.String;
|
|
15
|
+
}>]>;
|
|
16
|
+
export declare const MigrationGroup: HttpApiGroup.HttpApiGroup<"server.migration", HttpApiEndpoint.HttpApiEndpoint<"migration.v1.status", "GET", "/api/experimental/migration/v1", never, never, never, never, Schema.toCodecJson<Schema.Union<readonly [Schema.Struct<{
|
|
17
|
+
readonly status: Schema.Literals<readonly ["required", "completed"]>;
|
|
18
|
+
}>, Schema.Struct<{
|
|
19
|
+
readonly status: Schema.Literal<"running">;
|
|
20
|
+
readonly progress: Schema.Struct<{
|
|
21
|
+
readonly label: Schema.String;
|
|
22
|
+
readonly numerator: Schema.optional<Schema.Int>;
|
|
23
|
+
readonly denominator: Schema.optional<Schema.Int>;
|
|
24
|
+
}>;
|
|
25
|
+
}>, Schema.Struct<{
|
|
26
|
+
readonly status: Schema.Literal<"error">;
|
|
27
|
+
readonly error: Schema.String;
|
|
28
|
+
}>]>>, never, never, never>, false>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api";
|
|
3
|
+
const V1MigrationProgress = Schema.Struct({
|
|
4
|
+
label: Schema.String,
|
|
5
|
+
numerator: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
|
|
6
|
+
denominator: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
|
|
7
|
+
});
|
|
8
|
+
export const V1MigrationStatus = Schema.Union([
|
|
9
|
+
Schema.Struct({ status: Schema.Literals(["required", "completed"]) }),
|
|
10
|
+
Schema.Struct({ status: Schema.Literal("running"), progress: V1MigrationProgress }),
|
|
11
|
+
Schema.Struct({ status: Schema.Literal("error"), error: Schema.String }),
|
|
12
|
+
]);
|
|
13
|
+
export const MigrationGroup = HttpApiGroup.make("server.migration")
|
|
14
|
+
.add(HttpApiEndpoint.get("migration.v1.status", "/api/experimental/migration/v1", {
|
|
15
|
+
success: V1MigrationStatus,
|
|
16
|
+
}).annotateMerge(OpenApi.annotations({
|
|
17
|
+
identifier: "experimental.migration.v1.status",
|
|
18
|
+
summary: "Get V1 migration status",
|
|
19
|
+
description: "Return the progress of the V1 to V2 session history migration.",
|
|
20
|
+
})))
|
|
21
|
+
.annotateMerge(OpenApi.annotations({ title: "migration" }));
|