@opencode/protocol 0.0.0-dev-19653 → 0.0.0-dev-19656
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 +3 -3
- package/dist/api.js +2 -2
- package/dist/groups/form.d.ts +3 -651
- package/dist/groups/form.js +6 -83
- package/dist/groups/permission.d.ts +5 -1
- package/dist/groups/permission.js +1 -1
- package/dist/groups/session.d.ts +533 -22
- package/dist/groups/session.js +75 -19
- package/package.json +2 -2
package/dist/groups/session.js
CHANGED
|
@@ -9,7 +9,7 @@ import { AbsolutePath, DateTimeUtcFromMillis, NonNegativeInt, PositiveInt, Relat
|
|
|
9
9
|
import { Event } from "@opencode/schema/event";
|
|
10
10
|
import { Context, Effect, Encoding, Result, Schema, SchemaGetter, Struct } from "effect";
|
|
11
11
|
import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema, OpenApi } from "effect/unstable/httpapi";
|
|
12
|
-
import { ConflictError, CommandExecutionError, CommandNotFoundError, InvalidCursorError, InvalidRequestError, MessageNotFoundError, ServiceUnavailableError, SessionBusyError, SessionNotFoundError, SkillNotFoundError, UnknownError, } from "../errors.js";
|
|
12
|
+
import { ConflictError, CommandExecutionError, CommandNotFoundError, FormAlreadySettledError, FormInvalidAnswerError, FormNotFoundError, InvalidCursorError, InvalidRequestError, MessageNotFoundError, ServiceUnavailableError, SessionBusyError, SessionNotFoundError, SkillNotFoundError, UnknownError, } from "../errors.js";
|
|
13
13
|
import { Agent } from "@opencode/schema/agent";
|
|
14
14
|
import { Skill } from "@opencode/schema/skill";
|
|
15
15
|
import { Model } from "@opencode/schema/model";
|
|
@@ -18,6 +18,7 @@ import { Location } from "@opencode/schema/location";
|
|
|
18
18
|
import { SessionEvent } from "@opencode/schema/session-event";
|
|
19
19
|
import { EventLog } from "@opencode/schema/event-log";
|
|
20
20
|
import { FileDiff } from "@opencode/schema/file-diff";
|
|
21
|
+
import { Form } from "@opencode/schema/form";
|
|
21
22
|
import { PublicSessionMessage } from "./message.js";
|
|
22
23
|
const ParentIDFilter = Schema.Union([
|
|
23
24
|
Session.ID,
|
|
@@ -98,6 +99,12 @@ const PublicInboxInfo = Schema.Union([
|
|
|
98
99
|
SessionInbox.Compaction,
|
|
99
100
|
PublicMove,
|
|
100
101
|
]).annotate({ identifier: "Session.Inbox.Info" });
|
|
102
|
+
const FormCreatePayload = Schema.Struct({
|
|
103
|
+
id: Form.ID.pipe(Schema.optional),
|
|
104
|
+
title: Form.Info.fields.title,
|
|
105
|
+
metadata: Form.Info.fields.metadata,
|
|
106
|
+
fields: Form.Info.fields.fields,
|
|
107
|
+
}).annotate({ identifier: "Form.CreatePayload" });
|
|
101
108
|
const BooleanFromString = Schema.Literals(["true", "false"]).pipe(Schema.decodeTo(Schema.Boolean, {
|
|
102
109
|
decode: SchemaGetter.transform((value) => value === "true"),
|
|
103
110
|
encode: SchemaGetter.transform((value) => (value ? "true" : "false")),
|
|
@@ -112,7 +119,7 @@ export const SessionsQuery = Schema.Struct({
|
|
|
112
119
|
subpath: RelativePath.pipe(Schema.optional),
|
|
113
120
|
cursor: SessionsQueryCursor.pipe(Schema.optional),
|
|
114
121
|
}).annotate({ identifier: "SessionsQuery" });
|
|
115
|
-
export const makeSessionGroup = (sessionLocationMiddleware) => HttpApiGroup.make("server.session")
|
|
122
|
+
export const makeSessionGroup = (sessionLocationMiddleware, formLocationMiddleware) => HttpApiGroup.make("server.session")
|
|
116
123
|
.add(HttpApiEndpoint.get("session.list", "/api/session", {
|
|
117
124
|
query: SessionsQuery,
|
|
118
125
|
success: Schema.Struct({
|
|
@@ -440,29 +447,21 @@ export const makeSessionGroup = (sessionLocationMiddleware) => HttpApiGroup.make
|
|
|
440
447
|
.add(HttpApiEndpoint.delete("session.inbox.cancel", "/api/session/:sessionID/inbox/:inboxID", {
|
|
441
448
|
params: { sessionID: Session.ID, inboxID: SessionMessage.ID },
|
|
442
449
|
success: HttpApiSchema.NoContent,
|
|
443
|
-
error:
|
|
450
|
+
error: SessionNotFoundError,
|
|
444
451
|
}).annotateMerge(OpenApi.annotations({
|
|
445
452
|
identifier: "session.inbox.cancel",
|
|
446
453
|
summary: "Cancel inbox input",
|
|
447
|
-
description: "Cancel an inbox item that has not yet been delivered.",
|
|
448
|
-
})))
|
|
449
|
-
.add(HttpApiEndpoint.post("session.inbox.steer", "/api/session/:sessionID/inbox/:inboxID/steer", {
|
|
450
|
-
params: { sessionID: Session.ID, inboxID: SessionMessage.ID },
|
|
451
|
-
success: HttpApiSchema.NoContent,
|
|
452
|
-
error: [ConflictError, SessionNotFoundError],
|
|
453
|
-
}).annotateMerge(OpenApi.annotations({
|
|
454
|
-
identifier: "session.inbox.steer",
|
|
455
|
-
summary: "Steer queued item",
|
|
456
|
-
description: "Change a queued inbox item to steer delivery and wake session execution.",
|
|
454
|
+
description: "Cancel an inbox item that has not yet been delivered. Unavailable items are a no-op.",
|
|
457
455
|
})))
|
|
458
|
-
.add(HttpApiEndpoint.
|
|
456
|
+
.add(HttpApiEndpoint.patch("session.inbox.update", "/api/session/:sessionID/inbox/:inboxID", {
|
|
459
457
|
params: { sessionID: Session.ID, inboxID: SessionMessage.ID },
|
|
458
|
+
payload: Schema.Struct({ delivery: SessionInbox.Delivery }),
|
|
460
459
|
success: HttpApiSchema.NoContent,
|
|
461
460
|
error: [ConflictError, SessionNotFoundError],
|
|
462
461
|
}).annotateMerge(OpenApi.annotations({
|
|
463
|
-
identifier: "session.inbox.
|
|
464
|
-
summary: "
|
|
465
|
-
description: "Change a
|
|
462
|
+
identifier: "session.inbox.update",
|
|
463
|
+
summary: "Update inbox item",
|
|
464
|
+
description: "Change a pending inbox item's delivery mode. Steering wakes session execution.",
|
|
466
465
|
})))
|
|
467
466
|
.add(HttpApiEndpoint.get("session.instructions.entry.list", "/api/experimental/session/:sessionID/instructions/entries", {
|
|
468
467
|
params: { sessionID: Session.ID },
|
|
@@ -563,13 +562,70 @@ export const makeSessionGroup = (sessionLocationMiddleware) => HttpApiGroup.make
|
|
|
563
562
|
summary: "Get session message",
|
|
564
563
|
description: "Retrieve one projected message owned by the Session.",
|
|
565
564
|
})))
|
|
566
|
-
.add(HttpApiEndpoint.
|
|
565
|
+
.add(HttpApiEndpoint.get("session.form.list", "/api/session/:sessionID/form", {
|
|
566
|
+
params: { sessionID: Schema.String },
|
|
567
|
+
success: Schema.Struct({ data: Schema.Array(Form.Info) }),
|
|
568
|
+
error: SessionNotFoundError,
|
|
569
|
+
})
|
|
570
|
+
.middleware(formLocationMiddleware)
|
|
571
|
+
.annotateMerge(OpenApi.annotations({
|
|
572
|
+
identifier: "session.form.list",
|
|
573
|
+
summary: "List session forms",
|
|
574
|
+
description: "Retrieve pending forms for a session.",
|
|
575
|
+
})))
|
|
576
|
+
.add(HttpApiEndpoint.post("session.form.create", "/api/session/:sessionID/form", {
|
|
577
|
+
params: { sessionID: Schema.String },
|
|
578
|
+
payload: FormCreatePayload,
|
|
579
|
+
success: Schema.Struct({ data: Form.Info }),
|
|
580
|
+
error: [SessionNotFoundError, ConflictError, InvalidRequestError],
|
|
581
|
+
})
|
|
582
|
+
.middleware(formLocationMiddleware)
|
|
583
|
+
.annotateMerge(OpenApi.annotations({
|
|
584
|
+
identifier: "session.form.create",
|
|
585
|
+
summary: "Create session form",
|
|
586
|
+
description: "Create a form for a session.",
|
|
587
|
+
})))
|
|
588
|
+
.add(HttpApiEndpoint.get("session.form.get", "/api/session/:sessionID/form/:formID", {
|
|
589
|
+
params: { sessionID: Schema.String, formID: Form.ID },
|
|
590
|
+
success: Schema.Struct({ data: Form.Detail }),
|
|
591
|
+
error: [SessionNotFoundError, FormNotFoundError],
|
|
592
|
+
})
|
|
593
|
+
.middleware(formLocationMiddleware)
|
|
594
|
+
.annotateMerge(OpenApi.annotations({
|
|
595
|
+
identifier: "session.form.get",
|
|
596
|
+
summary: "Get session form",
|
|
597
|
+
description: "Retrieve a form and its current state for a session.",
|
|
598
|
+
})))
|
|
599
|
+
.add(HttpApiEndpoint.post("session.form.reply", "/api/session/:sessionID/form/:formID/reply", {
|
|
600
|
+
params: { sessionID: Schema.String, formID: Form.ID },
|
|
601
|
+
payload: Form.Reply,
|
|
602
|
+
success: HttpApiSchema.NoContent,
|
|
603
|
+
error: [SessionNotFoundError, FormAlreadySettledError, FormInvalidAnswerError, FormNotFoundError],
|
|
604
|
+
})
|
|
605
|
+
.middleware(formLocationMiddleware)
|
|
606
|
+
.annotateMerge(OpenApi.annotations({
|
|
607
|
+
identifier: "session.form.reply",
|
|
608
|
+
summary: "Reply to form",
|
|
609
|
+
description: "Submit an answer to a pending form.",
|
|
610
|
+
})))
|
|
611
|
+
.add(HttpApiEndpoint.delete("session.form.cancel", "/api/session/:sessionID/form/:formID", {
|
|
612
|
+
params: { sessionID: Schema.String, formID: Form.ID },
|
|
613
|
+
success: HttpApiSchema.NoContent,
|
|
614
|
+
error: [SessionNotFoundError, FormAlreadySettledError, FormNotFoundError],
|
|
615
|
+
})
|
|
616
|
+
.middleware(formLocationMiddleware)
|
|
617
|
+
.annotateMerge(OpenApi.annotations({
|
|
618
|
+
identifier: "session.form.cancel",
|
|
619
|
+
summary: "Cancel form",
|
|
620
|
+
description: "Cancel a pending form.",
|
|
621
|
+
})))
|
|
622
|
+
.add(HttpApiEndpoint.put("session.environment", "/api/session/:sessionID/environment", {
|
|
567
623
|
params: { sessionID: Session.ID },
|
|
568
624
|
payload: Schema.Struct({ variables: Schema.Record(Schema.String, Schema.String) }),
|
|
569
625
|
success: HttpApiSchema.NoContent,
|
|
570
626
|
error: SessionNotFoundError,
|
|
571
627
|
}).annotateMerge(OpenApi.annotations({
|
|
572
|
-
identifier: "
|
|
628
|
+
identifier: "session.environment",
|
|
573
629
|
summary: "Set session environment",
|
|
574
630
|
description: "Replace the process environment used by local shell commands for this session.",
|
|
575
631
|
})))
|
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-19656",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"typecheck": "tsgo --noEmit"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@opencode/schema": "0.0.0-dev-
|
|
35
|
+
"@opencode/schema": "0.0.0-dev-19656",
|
|
36
36
|
"effect": "4.0.0-rc.112"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|