@opencode/protocol 2.1.4 → 2.2.1

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.
Files changed (42) hide show
  1. package/dist/api.d.ts +4 -3
  2. package/dist/api.js +5 -3
  3. package/dist/client.d.ts +4 -0
  4. package/dist/client.js +13 -1
  5. package/dist/errors.d.ts +38 -0
  6. package/dist/errors.js +40 -0
  7. package/dist/groups/agent.d.ts +12 -2
  8. package/dist/groups/agent.js +2 -1
  9. package/dist/groups/event.d.ts +15 -2
  10. package/dist/groups/event.js +9 -0
  11. package/dist/groups/experimental.d.ts +523 -0
  12. package/dist/groups/experimental.js +5 -0
  13. package/dist/groups/fs.d.ts +15 -3
  14. package/dist/groups/fs.js +27 -1
  15. package/dist/groups/generate.d.ts +194 -3
  16. package/dist/groups/generate.js +41 -5
  17. package/dist/groups/mcp.d.ts +1 -0
  18. package/dist/groups/media.d.ts +8 -0
  19. package/dist/groups/media.js +18 -0
  20. package/dist/groups/message.d.ts +2240 -0
  21. package/dist/groups/message.js +29 -4
  22. package/dist/groups/model.d.ts +33 -6
  23. package/dist/groups/model.js +8 -2
  24. package/dist/groups/permission.d.ts +2 -2
  25. package/dist/groups/permission.js +4 -3
  26. package/dist/groups/persistent-pty.js +11 -10
  27. package/dist/groups/plugin.d.ts +18 -2
  28. package/dist/groups/plugin.js +15 -1
  29. package/dist/groups/provider.d.ts +24 -0
  30. package/dist/groups/schedule.d.ts +332 -0
  31. package/dist/groups/schedule.js +51 -0
  32. package/dist/groups/server.d.ts +2 -0
  33. package/dist/groups/server.js +2 -0
  34. package/dist/groups/session.d.ts +295 -11
  35. package/dist/groups/session.js +19 -35
  36. package/dist/groups/usage.d.ts +95 -0
  37. package/dist/groups/usage.js +22 -0
  38. package/dist/groups/vcs.d.ts +2 -0
  39. package/dist/groups/vcs.js +1 -0
  40. package/dist/groups/voice.d.ts +2 -18
  41. package/dist/groups/voice.js +3 -19
  42. package/package.json +3 -2
@@ -46,6 +46,12 @@ const PublicInboxInfo = Schema.Union([
46
46
  SessionInbox.Compaction,
47
47
  PublicMove,
48
48
  ]).annotate({ identifier: "Session.Inbox.Info" });
49
+ /** Experimental: the `session.inbox.list` response for clients that opt into `experimental-media-uri`. */
50
+ export const SessionMediaInboxResponse = Schema.Struct({
51
+ data: Schema.Array(Schema.Union([SessionInbox.MediaUser, SessionInbox.Synthetic, SessionInbox.Compaction, PublicMove]).annotate({
52
+ identifier: "Session.Inbox.MediaInfo",
53
+ })),
54
+ });
49
55
  // Transcripts exported before v2.1 carry older names for native data. The wire stays plain JSON so any export file
50
56
  // is accepted; decoding upgrades those names and then validates the current message shape.
51
57
  const ImportedMessages = Schema.Array(Schema.Json).pipe(Schema.decodeTo(Schema.Array(Schema.Unknown), {
@@ -176,9 +182,7 @@ export const makeSessionGroup = (sessionLocationMiddleware, formLocationMiddlewa
176
182
  payload: Schema.Struct({ before: SessionMessage.ID.pipe(Schema.optional) }),
177
183
  success: Schema.Struct({ data: PublicSessionInfo }),
178
184
  error: [SessionNotFoundError, MessageNotFoundError, InvalidRequestError],
179
- })
180
- .middleware(sessionLocationMiddleware)
181
- .annotateMerge(OpenApi.annotations({
185
+ }).annotateMerge(OpenApi.annotations({
182
186
  identifier: "session.fork",
183
187
  summary: "Fork session",
184
188
  description: "Create a child session by copying projected history before a message. Omit before to copy the full history.",
@@ -188,9 +192,7 @@ export const makeSessionGroup = (sessionLocationMiddleware, formLocationMiddlewa
188
192
  payload: Schema.Struct({ agent: Agent.ID }),
189
193
  success: HttpApiSchema.NoContent,
190
194
  error: SessionNotFoundError,
191
- })
192
- .middleware(sessionLocationMiddleware)
193
- .annotateMerge(OpenApi.annotations({
195
+ }).annotateMerge(OpenApi.annotations({
194
196
  identifier: "session.switchAgent",
195
197
  summary: "Switch session agent",
196
198
  description: "Switch the agent used by subsequent provider turns.",
@@ -200,9 +202,7 @@ export const makeSessionGroup = (sessionLocationMiddleware, formLocationMiddlewa
200
202
  payload: Schema.Struct({ model: Model.Ref }),
201
203
  success: HttpApiSchema.NoContent,
202
204
  error: SessionNotFoundError,
203
- })
204
- .middleware(sessionLocationMiddleware)
205
- .annotateMerge(OpenApi.annotations({
205
+ }).annotateMerge(OpenApi.annotations({
206
206
  identifier: "session.switchModel",
207
207
  summary: "Switch session model",
208
208
  description: "Switch the model used by subsequent provider turns.",
@@ -218,10 +218,8 @@ export const makeSessionGroup = (sessionLocationMiddleware, formLocationMiddlewa
218
218
  }),
219
219
  }),
220
220
  success: HttpApiSchema.NoContent,
221
- error: SessionNotFoundError,
222
- })
223
- .middleware(sessionLocationMiddleware)
224
- .annotateMerge(OpenApi.annotations({
221
+ error: [SessionNotFoundError, LocationNotFoundError],
222
+ }).annotateMerge(OpenApi.annotations({
225
223
  identifier: "session.update",
226
224
  summary: "Update session",
227
225
  description: "Update mutable session properties.",
@@ -338,9 +336,7 @@ export const makeSessionGroup = (sessionLocationMiddleware, formLocationMiddlewa
338
336
  params: { sessionID: Session.ID },
339
337
  success: HttpApiSchema.NoContent,
340
338
  error: [SessionNotFoundError, ServiceUnavailableError],
341
- })
342
- .middleware(sessionLocationMiddleware)
343
- .annotateMerge(OpenApi.annotations({
339
+ }).annotateMerge(OpenApi.annotations({
344
340
  identifier: "experimental.session.wait",
345
341
  summary: "Wait for session",
346
342
  description: "Wait for a session agent loop to become idle.",
@@ -368,9 +364,7 @@ export const makeSessionGroup = (sessionLocationMiddleware, formLocationMiddlewa
368
364
  params: { sessionID: Session.ID },
369
365
  success: HttpApiSchema.NoContent,
370
366
  error: [SessionNotFoundError, SessionBusyError],
371
- })
372
- .middleware(sessionLocationMiddleware)
373
- .annotateMerge(OpenApi.annotations({ identifier: "session.revert.commit", summary: "Commit staged revert" })))
367
+ }).annotateMerge(OpenApi.annotations({ identifier: "session.revert.commit", summary: "Commit staged revert" })))
374
368
  .add(HttpApiEndpoint.get("session.context", "/api/session/:sessionID/context", {
375
369
  params: { sessionID: Session.ID },
376
370
  success: Schema.Struct({ data: Schema.Array(PublicSessionMessage) }),
@@ -432,9 +426,7 @@ export const makeSessionGroup = (sessionLocationMiddleware, formLocationMiddlewa
432
426
  params: { sessionID: Session.ID },
433
427
  success: Schema.Struct({ data: Schema.Array(InstructionEntry.Info) }),
434
428
  error: SessionNotFoundError,
435
- })
436
- .middleware(sessionLocationMiddleware)
437
- .annotateMerge(OpenApi.annotations({
429
+ }).annotateMerge(OpenApi.annotations({
438
430
  identifier: "experimental.session.instructions.entry.list",
439
431
  summary: "List instruction entries",
440
432
  description: "List API-managed instruction entries attached to the session.",
@@ -444,9 +436,7 @@ export const makeSessionGroup = (sessionLocationMiddleware, formLocationMiddlewa
444
436
  payload: Schema.Struct({ value: Schema.Json }),
445
437
  success: HttpApiSchema.NoContent,
446
438
  error: [SessionNotFoundError, InstructionEntry.ValueTooLargeError],
447
- })
448
- .middleware(sessionLocationMiddleware)
449
- .annotateMerge(OpenApi.annotations({
439
+ }).annotateMerge(OpenApi.annotations({
450
440
  identifier: "experimental.session.instructions.entry.put",
451
441
  summary: "Put instruction entry",
452
442
  description: "Attach or replace one durable instruction entry. Changes announce as updates at the next step boundary.",
@@ -455,9 +445,7 @@ export const makeSessionGroup = (sessionLocationMiddleware, formLocationMiddlewa
455
445
  params: { sessionID: Session.ID, key: InstructionEntry.Key },
456
446
  success: HttpApiSchema.NoContent,
457
447
  error: SessionNotFoundError,
458
- })
459
- .middleware(sessionLocationMiddleware)
460
- .annotateMerge(OpenApi.annotations({
448
+ }).annotateMerge(OpenApi.annotations({
461
449
  identifier: "experimental.session.instructions.entry.remove",
462
450
  summary: "Remove instruction entry",
463
451
  description: "Remove one instruction entry; the removal is announced to the model at the next step boundary.",
@@ -487,7 +475,7 @@ export const makeSessionGroup = (sessionLocationMiddleware, formLocationMiddlewa
487
475
  }),
488
476
  error: SessionNotFoundError,
489
477
  }).annotateMerge(OpenApi.annotations({
490
- identifier: "session.log",
478
+ identifier: "experimental.session.log",
491
479
  summary: "Read the session log",
492
480
  description: "Experimental durable session event log. Reads events after an exclusive aggregate sequence and continues with live events when follow=true.",
493
481
  })))
@@ -500,9 +488,7 @@ export const makeSessionGroup = (sessionLocationMiddleware, formLocationMiddlewa
500
488
  }),
501
489
  }).annotate({ identifier: "SessionInterruptResponse" }),
502
490
  error: SessionNotFoundError,
503
- })
504
- .middleware(sessionLocationMiddleware)
505
- .annotateMerge(OpenApi.annotations({
491
+ }).annotateMerge(OpenApi.annotations({
506
492
  identifier: "session.interrupt",
507
493
  summary: "Interrupt session execution",
508
494
  description: "Interrupt active execution owned by this OpenCode process. Returns interrupted=true when an active execution was interrupted and false for the idle no-op. When resume=true, execution resumes pending steering input and next-in-line control items (manual compaction, moves) while queued prompts remain parked.",
@@ -511,9 +497,7 @@ export const makeSessionGroup = (sessionLocationMiddleware, formLocationMiddlewa
511
497
  params: { sessionID: Session.ID },
512
498
  success: HttpApiSchema.NoContent,
513
499
  error: SessionNotFoundError,
514
- })
515
- .middleware(sessionLocationMiddleware)
516
- .annotateMerge(OpenApi.annotations({
500
+ }).annotateMerge(OpenApi.annotations({
517
501
  identifier: "session.background",
518
502
  summary: "Background blocking session tools",
519
503
  description: "Move active foreground backgroundable tools for this session into background observation. Idle requests are a no-op.",
@@ -0,0 +1,95 @@
1
+ import { Schema } from "effect";
2
+ import { HttpApiEndpoint, HttpApiGroup } from "effect/http-api";
3
+ import { ServiceUnavailableError } from "../errors.js";
4
+ export declare const UsageGroup: HttpApiGroup.HttpApiGroup<"server.usage", HttpApiEndpoint.HttpApiEndpoint<"usage.limits", "GET", "/api/experimental/usage/limits", never, Schema.toCodecStringTree<Schema.Struct<{
5
+ readonly location: Schema.optional<Schema.Struct<{
6
+ readonly directory: Schema.optional<Schema.String>;
7
+ }>>;
8
+ }>>, never, never, Schema.toCodecJson<Schema.Struct<{
9
+ readonly location: Schema.Struct<{
10
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
11
+ }>;
12
+ readonly data: Schema.NullOr<Schema.Struct<{
13
+ readonly workspace: Schema.Struct<{
14
+ readonly id: Schema.String;
15
+ readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
16
+ readonly usageURL: Schema.String;
17
+ }>;
18
+ readonly go: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
19
+ readonly rolling: Schema.Struct<{
20
+ readonly percent: Schema.Finite;
21
+ readonly limited: Schema.Boolean;
22
+ readonly resetsAt: Schema.Finite;
23
+ }>;
24
+ readonly weekly: Schema.Struct<{
25
+ readonly percent: Schema.Finite;
26
+ readonly limited: Schema.Boolean;
27
+ readonly resetsAt: Schema.Finite;
28
+ }>;
29
+ readonly monthly: Schema.Struct<{
30
+ readonly percent: Schema.Finite;
31
+ readonly limited: Schema.Boolean;
32
+ readonly resetsAt: Schema.Finite;
33
+ }>;
34
+ }>>>, Schema.optionalKey<Schema.Struct<{
35
+ readonly rolling: Schema.Struct<{
36
+ readonly percent: Schema.Finite;
37
+ readonly limited: Schema.Boolean;
38
+ readonly resetsAt: Schema.Finite;
39
+ }>;
40
+ readonly weekly: Schema.Struct<{
41
+ readonly percent: Schema.Finite;
42
+ readonly limited: Schema.Boolean;
43
+ readonly resetsAt: Schema.Finite;
44
+ }>;
45
+ readonly monthly: Schema.Struct<{
46
+ readonly percent: Schema.Finite;
47
+ readonly limited: Schema.Boolean;
48
+ readonly resetsAt: Schema.Finite;
49
+ }>;
50
+ }>>, never, never>;
51
+ readonly budgets: Schema.$Array<Schema.Struct<{
52
+ readonly id: Schema.String;
53
+ readonly limit: Schema.brand<Schema.Finite, "Money.USD"> & {
54
+ zero: number & import("effect/Brand").Brand<"Money.USD">;
55
+ };
56
+ readonly spent: Schema.brand<Schema.Finite, "Money.USD"> & {
57
+ zero: number & import("effect/Brand").Brand<"Money.USD">;
58
+ };
59
+ readonly scope: Schema.Literals<readonly ["each", "combined"]>;
60
+ readonly per: Schema.Literals<readonly ["set", "model"]>;
61
+ readonly coverage: Schema.Literals<readonly ["all", "models"]>;
62
+ readonly models: Schema.$Array<Schema.Struct<{
63
+ readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
64
+ opencode: string & import("effect/Brand").Brand<"Provider.ID">;
65
+ anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
66
+ openai: string & import("effect/Brand").Brand<"Provider.ID">;
67
+ google: string & import("effect/Brand").Brand<"Provider.ID">;
68
+ googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
69
+ githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
70
+ amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
71
+ azure: string & import("effect/Brand").Brand<"Provider.ID">;
72
+ openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
73
+ mistral: string & import("effect/Brand").Brand<"Provider.ID">;
74
+ gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
75
+ };
76
+ readonly modelID: Schema.brand<Schema.String, "Model.ID">;
77
+ readonly name: Schema.String;
78
+ readonly spent: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.Finite, "Money.USD"> & {
79
+ zero: number & import("effect/Brand").Brand<"Money.USD">;
80
+ }>>, Schema.optionalKey<Schema.brand<Schema.Finite, "Money.USD"> & {
81
+ zero: number & import("effect/Brand").Brand<"Money.USD">;
82
+ }>, never, never>;
83
+ }>>;
84
+ readonly vendors: Schema.$Array<Schema.String>;
85
+ readonly inputPriceAtLeast: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.Finite, "Money.USDPerMillionTokens"> & {
86
+ zero: number & import("effect/Brand").Brand<"Money.USDPerMillionTokens">;
87
+ }>>, Schema.optionalKey<Schema.brand<Schema.Finite, "Money.USDPerMillionTokens"> & {
88
+ zero: number & import("effect/Brand").Brand<"Money.USDPerMillionTokens">;
89
+ }>, never, never>;
90
+ readonly picked: Schema.Boolean;
91
+ readonly shared: Schema.Boolean;
92
+ readonly resetsAt: Schema.Finite;
93
+ }>>;
94
+ }>>;
95
+ }>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never>, false>;
@@ -0,0 +1,22 @@
1
+ import { Location } from "@opencode/schema/location";
2
+ import { UsageLimits } from "@opencode/schema/usage-limits";
3
+ import { Schema } from "effect";
4
+ import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api";
5
+ import { ServiceUnavailableError } from "../errors.js";
6
+ import { LocationQuery, locationQueryOpenApi } from "./location.js";
7
+ export const UsageGroup = HttpApiGroup.make("server.usage")
8
+ .add(HttpApiEndpoint.get("usage.limits", "/api/experimental/usage/limits", {
9
+ query: LocationQuery,
10
+ success: Location.response(Schema.NullOr(UsageLimits.Info)),
11
+ error: ServiceUnavailableError,
12
+ })
13
+ .annotateMerge(locationQueryOpenApi)
14
+ .annotateMerge(OpenApi.annotations({
15
+ identifier: "experimental.usage.limits",
16
+ summary: "Get usage limits",
17
+ description: "Return the OpenCode Go allowance and Console budgets of the OpenCode Console workspace the location is signed in to, or null when it isn't signed in.",
18
+ })))
19
+ .annotateMerge(OpenApi.annotations({
20
+ title: "usage",
21
+ description: "Experimental usage limit routes.",
22
+ }));
@@ -38,6 +38,7 @@ export declare const VcsGroup: HttpApiGroup.HttpApiGroup<"server.vcs", HttpApiEn
38
38
  readonly mode: Schema.Literals<readonly ["working", "branch", "committed"]>;
39
39
  readonly base: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
40
40
  readonly context: Schema.optional<Schema.compose<Schema.Int, Schema.NumberFromString>>;
41
+ readonly untracked: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["files", "folders"]>>>, Schema.optionalKey<Schema.Literals<readonly ["files", "folders"]>>, never, never>;
41
42
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
42
43
  readonly location: Schema.Struct<{
43
44
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
@@ -48,6 +49,7 @@ export declare const VcsGroup: HttpApiGroup.HttpApiGroup<"server.vcs", HttpApiEn
48
49
  readonly additions: Schema.Int;
49
50
  readonly deletions: Schema.Int;
50
51
  readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
52
+ readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
51
53
  }>>;
52
54
  }>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.get", "GET", "/api/vcs", never, Schema.toCodecStringTree<Schema.Struct<{
53
55
  readonly location: Schema.optional<Schema.Struct<{
@@ -22,6 +22,7 @@ const DiffQuery = Schema.Struct({
22
22
  mode: Vcs.Mode,
23
23
  base: optional(Schema.String),
24
24
  context: Schema.NumberFromString.pipe(Schema.decodeTo(NonNegativeInt), Schema.optional),
25
+ untracked: optional(Vcs.Untracked),
25
26
  });
26
27
  export const VcsGroup = HttpApiGroup.make("server.vcs")
27
28
  .add(HttpApiEndpoint.post("vcs.init", "/api/vcs/init", {
@@ -1,5 +1,5 @@
1
1
  import { Schema } from "effect";
2
- import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/http-api";
2
+ import { HttpApiEndpoint, HttpApiGroup } from "effect/http-api";
3
3
  import { InvalidRequestError, LocationNotFoundError, ServiceUnavailableError } from "../errors.js";
4
4
  export declare const VoiceTransportType: Schema.Literals<readonly ["webrtc", "websocket"]>;
5
5
  export declare const VoiceModel: Schema.Struct<{
@@ -7,10 +7,6 @@ export declare const VoiceModel: Schema.Struct<{
7
7
  readonly provider: Schema.String;
8
8
  readonly transports: Schema.$Array<Schema.Literals<readonly ["webrtc", "websocket"]>>;
9
9
  readonly available: Schema.Boolean;
10
- /** The integration whose connection starts its sessions: the provider's stored key, or `opencode` when the connected OpenCode Console hosts it. */
11
- readonly integration: Schema.optional<Schema.String>;
12
- /** The OpenCode Console workspace a hosted model's sessions bill to. */
13
- readonly workspace: Schema.optional<Schema.String>;
14
10
  }>;
15
11
  export declare const VoiceWebRTCTransportInput: Schema.Struct<{
16
12
  readonly type: Schema.Literal<"webrtc">;
@@ -46,21 +42,13 @@ export declare const VoiceTransport: Schema.Union<readonly [Schema.Struct<{
46
42
  readonly token: Schema.String;
47
43
  readonly expiresAt: Schema.Number;
48
44
  }>]>;
49
- export declare const VoiceGroup: HttpApiGroup.HttpApiGroup<"server.voice", HttpApiEndpoint.HttpApiEndpoint<"voice.instructions", "POST", "/api/experimental/voice/session/:sessionID/instructions", Schema.toCodecStringTree<Schema.Struct<{
50
- sessionID: Schema.String;
51
- }>>, never, Schema.toCodecJson<Schema.Struct<{
52
- readonly instructions: Schema.String;
53
- }>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof LocationNotFoundError | typeof InvalidRequestError | typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"voice.models", "GET", "/api/experimental/voice/models", never, never, never, never, Schema.toCodecJson<Schema.Struct<{
45
+ export declare const VoiceGroup: HttpApiGroup.HttpApiGroup<"server.voice", HttpApiEndpoint.HttpApiEndpoint<"voice.models", "GET", "/api/experimental/voice/models", never, never, never, never, Schema.toCodecJson<Schema.Struct<{
54
46
  readonly data: Schema.Struct<{
55
47
  readonly models: Schema.$Array<Schema.Struct<{
56
48
  readonly model: Schema.String;
57
49
  readonly provider: Schema.String;
58
50
  readonly transports: Schema.$Array<Schema.Literals<readonly ["webrtc", "websocket"]>>;
59
51
  readonly available: Schema.Boolean;
60
- /** The integration whose connection starts its sessions: the provider's stored key, or `opencode` when the connected OpenCode Console hosts it. */
61
- readonly integration: Schema.optional<Schema.String>;
62
- /** The OpenCode Console workspace a hosted model's sessions bill to. */
63
- readonly workspace: Schema.optional<Schema.String>;
64
52
  }>>;
65
53
  readonly default: Schema.optional<Schema.String>;
66
54
  }>;
@@ -85,9 +73,5 @@ export declare const VoiceGroup: HttpApiGroup.HttpApiGroup<"server.voice", HttpA
85
73
  readonly token: Schema.String;
86
74
  readonly expiresAt: Schema.Number;
87
75
  }>]>;
88
- /** A hosted session's ID, for `voice.instructions`. */
89
- readonly session: Schema.optional<Schema.Struct<{
90
- readonly id: Schema.String;
91
- }>>;
92
76
  }>;
93
77
  }>>, Schema.toCodecJson<typeof LocationNotFoundError | typeof InvalidRequestError | typeof ServiceUnavailableError>, never, never>, false>;
@@ -1,5 +1,5 @@
1
1
  import { Schema } from "effect";
2
- import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api";
2
+ import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api";
3
3
  import { InvalidRequestError, LocationNotFoundError, ServiceUnavailableError } from "../errors.js";
4
4
  export const VoiceTransportType = Schema.Literals(["webrtc", "websocket"]).annotate({
5
5
  identifier: "VoiceTransportType",
@@ -9,10 +9,6 @@ export const VoiceModel = Schema.Struct({
9
9
  provider: Schema.String,
10
10
  transports: Schema.Array(VoiceTransportType),
11
11
  available: Schema.Boolean,
12
- /** The integration whose connection starts its sessions: the provider's stored key, or `opencode` when the connected OpenCode Console hosts it. */
13
- integration: Schema.optional(Schema.String),
14
- /** The OpenCode Console workspace a hosted model's sessions bill to. */
15
- workspace: Schema.optional(Schema.String),
16
12
  }).annotate({ identifier: "VoiceModel" });
17
13
  export const VoiceWebRTCTransportInput = Schema.Struct({
18
14
  type: Schema.Literal("webrtc"),
@@ -52,7 +48,7 @@ export const VoiceGroup = HttpApiGroup.make("server.voice")
52
48
  }).annotateMerge(OpenApi.annotations({
53
49
  identifier: "experimental.voice.models",
54
50
  summary: "List voice models",
55
- description: "List supported voice models, their transports, whether the server has a usable API key for each provider or the connected OpenCode Console hosts the model, and the Console workspace a hosted model bills to.",
51
+ description: "List supported voice models, their transports, and whether the server has a usable API key for each provider.",
56
52
  })))
57
53
  .add(HttpApiEndpoint.post("voice.session", "/api/experimental/voice/session", {
58
54
  payload: Schema.Struct({
@@ -63,25 +59,13 @@ export const VoiceGroup = HttpApiGroup.make("server.voice")
63
59
  success: Schema.Struct({
64
60
  data: Schema.Struct({
65
61
  transport: VoiceTransport,
66
- /** A hosted session's ID, for `voice.instructions`. */
67
- session: Schema.optional(Schema.Struct({ id: Schema.String })),
68
62
  }),
69
63
  }).annotate({ identifier: "VoiceSessionResponse" }),
70
64
  error: [InvalidRequestError, ServiceUnavailableError, LocationNotFoundError],
71
65
  }).annotateMerge(OpenApi.annotations({
72
66
  identifier: "experimental.voice.session",
73
67
  summary: "Create voice session",
74
- description: "Create a server-brokered voice session using the server's configured provider credentials, or the connected OpenCode Console when it hosts the model, and return the WebRTC SDP answer or WebSocket ephemeral token.",
75
- })))
76
- .add(HttpApiEndpoint.post("voice.instructions", "/api/experimental/voice/session/:sessionID/instructions", {
77
- params: { sessionID: Schema.String },
78
- payload: Schema.Struct({ instructions: Schema.String }),
79
- success: HttpApiSchema.NoContent,
80
- error: [InvalidRequestError, ServiceUnavailableError, LocationNotFoundError],
81
- }).annotateMerge(OpenApi.annotations({
82
- identifier: "experimental.voice.instructions",
83
- summary: "Replace voice session instructions",
84
- description: "Replace the backend instructions of a running session the connected OpenCode Console hosts, whose data channel can't change them.",
68
+ description: "Create a server-brokered voice session using the server's configured provider credentials and return the WebRTC SDP answer or WebSocket ephemeral token.",
85
69
  })))
86
70
  .annotateMerge(OpenApi.annotations({
87
71
  title: "voice",
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": "2.1.4",
4
+ "version": "2.2.1",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -27,6 +27,7 @@
27
27
  },
28
28
  "scripts": {
29
29
  "build": "bun run script/build.ts",
30
+ "pack": "bun run script/pack.ts",
30
31
  "generate": "bun run script/generate-openapi.ts",
31
32
  "check:generated": "bun run script/generate-openapi.ts --check",
32
33
  "test": "bun test --only-failures",
@@ -34,7 +35,7 @@
34
35
  "typecheck:tsc": "tsc --noEmit"
35
36
  },
36
37
  "dependencies": {
37
- "@opencode/schema": "2.1.4",
38
+ "@opencode/schema": "2.2.1",
38
39
  "effect": "4.0.1"
39
40
  },
40
41
  "devDependencies": {