@opencode/protocol 0.0.0-dev-19533 → 0.0.0-dev-19537
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/message.d.ts +12 -1
- package/dist/groups/session.d.ts +72 -5
- package/dist/groups/session.js +21 -0
- package/package.json +2 -2
package/dist/groups/message.d.ts
CHANGED
|
@@ -726,7 +726,18 @@ export declare const MessageGroup: HttpApiGroup.HttpApiGroup<"server.message", H
|
|
|
726
726
|
readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
727
727
|
}>;
|
|
728
728
|
readonly type: Schema.tag<"compaction">;
|
|
729
|
-
}>]
|
|
729
|
+
}>]>, Schema.Struct<{
|
|
730
|
+
readonly type: Schema.tag<"idle">;
|
|
731
|
+
readonly outcome: Schema.Literals<readonly ["succeeded", "failed", "interrupted"]>;
|
|
732
|
+
readonly id: Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
733
|
+
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
734
|
+
fromEvent: (eventID: import("@opencode/schema/event").ID) => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
735
|
+
};
|
|
736
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
737
|
+
readonly time: Schema.Struct<{
|
|
738
|
+
readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
739
|
+
}>;
|
|
740
|
+
}>]>>;
|
|
730
741
|
readonly cursor: Schema.Struct<{
|
|
731
742
|
readonly previous: Schema.optional<Schema.String>;
|
|
732
743
|
readonly next: Schema.optional<Schema.String>;
|
package/dist/groups/session.d.ts
CHANGED
|
@@ -1634,7 +1634,18 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S>(se
|
|
|
1634
1634
|
readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
1635
1635
|
}>;
|
|
1636
1636
|
readonly type: Schema.tag<"compaction">;
|
|
1637
|
-
}>]
|
|
1637
|
+
}>]>, Schema.Struct<{
|
|
1638
|
+
readonly type: Schema.tag<"idle">;
|
|
1639
|
+
readonly outcome: Schema.Literals<readonly ["succeeded", "failed", "interrupted"]>;
|
|
1640
|
+
readonly id: Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
1641
|
+
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
1642
|
+
fromEvent: (eventID: Event.ID) => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
1643
|
+
};
|
|
1644
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
1645
|
+
readonly time: Schema.Struct<{
|
|
1646
|
+
readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
1647
|
+
}>;
|
|
1648
|
+
}>]>>;
|
|
1638
1649
|
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
1639
1650
|
readonly data: Schema.Struct<{
|
|
1640
1651
|
readonly id: Schema.brand<Schema.String, "SessionID"> & {
|
|
@@ -2717,7 +2728,18 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S>(se
|
|
|
2717
2728
|
readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
2718
2729
|
}>;
|
|
2719
2730
|
readonly type: Schema.tag<"compaction">;
|
|
2720
|
-
}>]
|
|
2731
|
+
}>]>, Schema.Struct<{
|
|
2732
|
+
readonly type: Schema.tag<"idle">;
|
|
2733
|
+
readonly outcome: Schema.Literals<readonly ["succeeded", "failed", "interrupted"]>;
|
|
2734
|
+
readonly id: Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
2735
|
+
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
2736
|
+
fromEvent: (eventID: Event.ID) => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
2737
|
+
};
|
|
2738
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
2739
|
+
readonly time: Schema.Struct<{
|
|
2740
|
+
readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
2741
|
+
}>;
|
|
2742
|
+
}>]>>;
|
|
2721
2743
|
}>;
|
|
2722
2744
|
}>>, Schema.toCodecJson<typeof UnknownError | typeof SessionNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"session.active", "GET", "/api/session/active", never, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
2723
2745
|
readonly data: Schema.$Record<Schema.brand<Schema.String, "SessionID"> & {
|
|
@@ -4377,8 +4399,42 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S>(se
|
|
|
4377
4399
|
readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
4378
4400
|
}>;
|
|
4379
4401
|
readonly type: Schema.tag<"compaction">;
|
|
4380
|
-
}>]
|
|
4381
|
-
|
|
4402
|
+
}>]>, Schema.Struct<{
|
|
4403
|
+
readonly type: Schema.tag<"idle">;
|
|
4404
|
+
readonly outcome: Schema.Literals<readonly ["succeeded", "failed", "interrupted"]>;
|
|
4405
|
+
readonly id: Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
4406
|
+
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
4407
|
+
fromEvent: (eventID: Event.ID) => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
4408
|
+
};
|
|
4409
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
4410
|
+
readonly time: Schema.Struct<{
|
|
4411
|
+
readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
4412
|
+
}>;
|
|
4413
|
+
}>]>>;
|
|
4414
|
+
}>>, Schema.toCodecJson<typeof UnknownError | typeof SessionNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"session.diff", "GET", "/api/session/:sessionID/diff", Schema.toCodecStringTree<Schema.Struct<{
|
|
4415
|
+
sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
4416
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
4417
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
4418
|
+
};
|
|
4419
|
+
}>>, Schema.toCodecStringTree<Schema.Struct<{
|
|
4420
|
+
readonly from: Schema.optional<Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
4421
|
+
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
4422
|
+
fromEvent: (eventID: Event.ID) => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
4423
|
+
}>;
|
|
4424
|
+
readonly to: Schema.optional<Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
4425
|
+
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
4426
|
+
fromEvent: (eventID: Event.ID) => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
4427
|
+
}>;
|
|
4428
|
+
readonly context: Schema.optional<Schema.compose<Schema.Int, Schema.NumberFromString>>;
|
|
4429
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
4430
|
+
readonly data: Schema.$Array<Schema.Struct<{
|
|
4431
|
+
readonly file: Schema.String;
|
|
4432
|
+
readonly patch: Schema.String;
|
|
4433
|
+
readonly additions: Schema.Int;
|
|
4434
|
+
readonly deletions: Schema.Int;
|
|
4435
|
+
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
4436
|
+
}>>;
|
|
4437
|
+
}>>, Schema.toCodecJson<typeof InvalidRequestError | typeof UnknownError | typeof SessionNotFoundError | typeof MessageNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"session.inbox.list", "GET", "/api/session/:sessionID/inbox", Schema.toCodecStringTree<Schema.Struct<{
|
|
4382
4438
|
sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
4383
4439
|
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
4384
4440
|
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
@@ -10775,7 +10831,18 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S>(se
|
|
|
10775
10831
|
readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
10776
10832
|
}>;
|
|
10777
10833
|
readonly type: Schema.tag<"compaction">;
|
|
10778
|
-
}>]
|
|
10834
|
+
}>]>, Schema.Struct<{
|
|
10835
|
+
readonly type: Schema.tag<"idle">;
|
|
10836
|
+
readonly outcome: Schema.Literals<readonly ["succeeded", "failed", "interrupted"]>;
|
|
10837
|
+
readonly id: Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
10838
|
+
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
10839
|
+
fromEvent: (eventID: Event.ID) => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
10840
|
+
};
|
|
10841
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
10842
|
+
readonly time: Schema.Struct<{
|
|
10843
|
+
readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
10844
|
+
}>;
|
|
10845
|
+
}>]>;
|
|
10779
10846
|
}>>, Schema.toCodecJson<typeof SessionNotFoundError | typeof MessageNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"session.environment", "PUT", "/api/session/:sessionID/environment", Schema.toCodecStringTree<Schema.Struct<{
|
|
10780
10847
|
sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
10781
10848
|
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
package/dist/groups/session.js
CHANGED
|
@@ -19,6 +19,7 @@ import { Permission } from "@opencode/schema/permission";
|
|
|
19
19
|
import { Location } from "@opencode/schema/location";
|
|
20
20
|
import { SessionEvent } from "@opencode/schema/session-event";
|
|
21
21
|
import { EventLog } from "@opencode/schema/event-log";
|
|
22
|
+
import { FileDiff } from "@opencode/schema/file-diff";
|
|
22
23
|
const ParentIDFilter = Schema.Union([
|
|
23
24
|
Session.ID,
|
|
24
25
|
Schema.Null.pipe(Schema.encodeTo(Schema.Literal("null"), {
|
|
@@ -387,6 +388,26 @@ export const makeSessionGroup = (sessionLocationMiddleware) => HttpApiGroup.make
|
|
|
387
388
|
identifier: "v2.session.context",
|
|
388
389
|
summary: "Get session context",
|
|
389
390
|
description: "Retrieve the active context messages for a session (all messages after the last compaction).",
|
|
391
|
+
})))
|
|
392
|
+
.add(HttpApiEndpoint.get("session.diff", "/api/session/:sessionID/diff", {
|
|
393
|
+
params: { sessionID: Session.ID },
|
|
394
|
+
query: Schema.Struct({
|
|
395
|
+
from: Schema.optional(SessionMessage.ID).annotate({
|
|
396
|
+
description: "User message whose turn to diff. Defaults to the turn of the newest user message.",
|
|
397
|
+
}),
|
|
398
|
+
to: Schema.optional(SessionMessage.ID).annotate({
|
|
399
|
+
description: "Later user message whose turn ends the range. Defaults to the turn of `from` alone.",
|
|
400
|
+
}),
|
|
401
|
+
context: Schema.NumberFromString.pipe(Schema.decodeTo(NonNegativeInt), Schema.optional).annotate({
|
|
402
|
+
description: "Unchanged lines around each hunk. Omit for full-file patches.",
|
|
403
|
+
}),
|
|
404
|
+
}),
|
|
405
|
+
success: Schema.Struct({ data: Schema.Array(FileDiff.Info) }),
|
|
406
|
+
error: [InvalidRequestError, MessageNotFoundError, SessionNotFoundError, UnknownError],
|
|
407
|
+
}).annotateMerge(OpenApi.annotations({
|
|
408
|
+
identifier: "v2.session.diff",
|
|
409
|
+
summary: "Diff session turns",
|
|
410
|
+
description: "Structured per-file diffs of the files a turn changed. A turn runs from the first prompt after the session was last idle until its next idle marker, so prompts steered in while it was busy belong to the same turn; `to` extends the range through a later turn. Compares the range's first recorded snapshot with its last; a step still running in the active session compares against the working copy. Ranges that span a location change are rejected. In sessions without any idle marker, a prompt's turn spans until the next user message.",
|
|
390
411
|
})))
|
|
391
412
|
.add(HttpApiEndpoint.get("session.inbox.list", "/api/session/:sessionID/inbox", {
|
|
392
413
|
params: { sessionID: Session.ID },
|
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-19537",
|
|
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-19537",
|
|
36
36
|
"effect": "4.0.0-rc.112"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|