@opencode-ai/protocol 0.0.0-dev-18110 → 0.0.0-dev-18112

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/errors.d.ts CHANGED
@@ -78,11 +78,11 @@ declare const CommandNotFoundError_base: Schema.Class<CommandNotFoundError, Sche
78
78
  }>, import("effect/Cause").YieldableError>;
79
79
  export declare class CommandNotFoundError extends CommandNotFoundError_base {
80
80
  }
81
- declare const CommandEvaluationError_base: Schema.Class<CommandEvaluationError, Schema.TaggedStruct<"CommandEvaluationError", {
81
+ declare const CommandExecutionError_base: Schema.Class<CommandExecutionError, Schema.TaggedStruct<"CommandExecutionError", {
82
82
  readonly command: Schema.String;
83
83
  readonly message: Schema.String;
84
84
  }>, import("effect/Cause").YieldableError>;
85
- export declare class CommandEvaluationError extends CommandEvaluationError_base {
85
+ export declare class CommandExecutionError extends CommandExecutionError_base {
86
86
  }
87
87
  declare const InvalidCursorError_base: Schema.Class<InvalidCursorError, Schema.TaggedStruct<"InvalidCursorError", {
88
88
  readonly message: Schema.String;
package/dist/errors.js CHANGED
@@ -64,7 +64,7 @@ export class CommandNotFoundError extends Schema.TaggedError()("CommandNotFoundE
64
64
  message: Schema.String,
65
65
  }, { httpApiStatus: 404 }) {
66
66
  }
67
- export class CommandEvaluationError extends Schema.TaggedError()("CommandEvaluationError", {
67
+ export class CommandExecutionError extends Schema.TaggedError()("CommandExecutionError", {
68
68
  command: Schema.String,
69
69
  message: Schema.String,
70
70
  }, { httpApiStatus: 500 }) {
@@ -10,54 +10,6 @@ export declare const CommandGroup: HttpApiGroup.HttpApiGroup<"server.command", H
10
10
  readonly location: typeof Location.Info;
11
11
  readonly data: Schema.$Array<Schema.Struct<{
12
12
  readonly name: Schema.String;
13
- readonly template: Schema.String;
14
13
  readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
15
- readonly agent: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Agent.ID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Agent.ID">>, never, never>;
16
- readonly model: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
17
- readonly id: Schema.brand<Schema.String, "Model.ID">;
18
- readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
19
- opencode: string & import("effect/Brand").Brand<"Provider.ID">;
20
- anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
21
- openai: string & import("effect/Brand").Brand<"Provider.ID">;
22
- google: string & import("effect/Brand").Brand<"Provider.ID">;
23
- googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
24
- githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
25
- amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
26
- azure: string & import("effect/Brand").Brand<"Provider.ID">;
27
- openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
28
- mistral: string & import("effect/Brand").Brand<"Provider.ID">;
29
- gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
30
- };
31
- readonly variant: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.VariantID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.VariantID">>, never, never>;
32
- }> & {
33
- parse: (input: string) => {
34
- readonly id: string & import("effect/Brand").Brand<"Model.ID">;
35
- readonly providerID: string & import("effect/Brand").Brand<"Provider.ID">;
36
- readonly variant?: (string & import("effect/Brand").Brand<"Model.VariantID">) | undefined;
37
- };
38
- }>>, Schema.optionalKey<Schema.Struct<{
39
- readonly id: Schema.brand<Schema.String, "Model.ID">;
40
- readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
41
- opencode: string & import("effect/Brand").Brand<"Provider.ID">;
42
- anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
43
- openai: string & import("effect/Brand").Brand<"Provider.ID">;
44
- google: string & import("effect/Brand").Brand<"Provider.ID">;
45
- googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
46
- githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
47
- amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
48
- azure: string & import("effect/Brand").Brand<"Provider.ID">;
49
- openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
50
- mistral: string & import("effect/Brand").Brand<"Provider.ID">;
51
- gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
52
- };
53
- readonly variant: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.VariantID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.VariantID">>, never, never>;
54
- }> & {
55
- parse: (input: string) => {
56
- readonly id: string & import("effect/Brand").Brand<"Model.ID">;
57
- readonly providerID: string & import("effect/Brand").Brand<"Provider.ID">;
58
- readonly variant?: (string & import("effect/Brand").Brand<"Model.VariantID">) | undefined;
59
- };
60
- }>, never, never>;
61
- readonly subtask: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
62
14
  }>>;
63
15
  }>>, never, never, never>, false>;
@@ -3,7 +3,7 @@ import { InstructionEntry } from "@opencode-ai/schema/instruction-entry";
3
3
  import { Event } from "@opencode-ai/schema/event";
4
4
  import { Context, Effect, Schema } from "effect";
5
5
  import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema } from "effect/unstable/httpapi";
6
- import { ConflictError, CommandEvaluationError, CommandNotFoundError, InvalidCursorError, InvalidRequestError, MessageNotFoundError, ServiceUnavailableError, SessionBusyError, SessionNotFoundError, SkillNotFoundError, UnknownError } from "../errors.js";
6
+ import { ConflictError, CommandExecutionError, CommandNotFoundError, InvalidCursorError, InvalidRequestError, MessageNotFoundError, ServiceUnavailableError, SessionBusyError, SessionNotFoundError, SkillNotFoundError, UnknownError } from "../errors.js";
7
7
  import { SessionEvent } from "@opencode-ai/schema/session-event";
8
8
  declare const SessionsCursorInput: Schema.Union<readonly [Schema.Struct<{
9
9
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
@@ -3077,36 +3077,8 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S>(se
3077
3077
  descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
3078
3078
  };
3079
3079
  }>>, never, Schema.toCodecJson<Schema.Struct<{
3080
- readonly id: Schema.optional<Schema.brand<Schema.String, "Session.Message.ID"> & {
3081
- create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
3082
- fromEvent: (eventID: Event.ID) => string & import("effect/Brand").Brand<"Session.Message.ID">;
3083
- }>;
3084
- readonly command: Schema.String;
3085
- readonly arguments: Schema.optional<Schema.String>;
3086
- readonly agent: Schema.optional<Schema.brand<Schema.String, "Agent.ID">>;
3087
- readonly model: Schema.optional<Schema.Struct<{
3088
- readonly id: Schema.brand<Schema.String, "Model.ID">;
3089
- readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
3090
- opencode: string & import("effect/Brand").Brand<"Provider.ID">;
3091
- anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
3092
- openai: string & import("effect/Brand").Brand<"Provider.ID">;
3093
- google: string & import("effect/Brand").Brand<"Provider.ID">;
3094
- googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
3095
- githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
3096
- amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
3097
- azure: string & import("effect/Brand").Brand<"Provider.ID">;
3098
- openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
3099
- mistral: string & import("effect/Brand").Brand<"Provider.ID">;
3100
- gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
3101
- };
3102
- readonly variant: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.VariantID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.VariantID">>, never, never>;
3103
- }> & {
3104
- parse: (input: string) => {
3105
- readonly id: string & import("effect/Brand").Brand<"Model.ID">;
3106
- readonly providerID: string & import("effect/Brand").Brand<"Provider.ID">;
3107
- readonly variant?: (string & import("effect/Brand").Brand<"Model.VariantID">) | undefined;
3108
- };
3109
- }>;
3080
+ readonly delivery: Schema.optional<Schema.Literals<readonly ["steer", "queue"]>>;
3081
+ readonly text: Schema.String;
3110
3082
  readonly files: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
3111
3083
  readonly uri: Schema.String;
3112
3084
  readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
@@ -3202,152 +3174,8 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S>(se
3202
3174
  readonly text: Schema.String;
3203
3175
  }>>, never, never>;
3204
3176
  }>>>, never, never>;
3205
- readonly delivery: Schema.optional<Schema.Literals<readonly ["steer", "queue"]>>;
3206
- readonly resume: Schema.optional<Schema.Boolean>;
3207
- }>>, never, Schema.toCodecJson<Schema.Struct<{
3208
- readonly data: Schema.Struct<{
3209
- readonly type: Schema.tag<"user">;
3210
- readonly payload: Schema.Struct<{
3211
- readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
3212
- readonly text: Schema.String;
3213
- readonly files: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
3214
- readonly data: Schema.String;
3215
- readonly mime: Schema.String;
3216
- readonly source: Schema.Union<readonly [Schema.Struct<{
3217
- readonly type: Schema.Literal<"inline">;
3218
- }>, Schema.Struct<{
3219
- readonly type: Schema.Literal<"uri">;
3220
- readonly uri: Schema.String;
3221
- }>]>;
3222
- readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
3223
- readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
3224
- readonly mention: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
3225
- readonly start: Schema.Finite;
3226
- readonly end: Schema.Finite;
3227
- readonly text: Schema.String;
3228
- }>>>, Schema.optionalKey<Schema.Struct<{
3229
- readonly start: Schema.Finite;
3230
- readonly end: Schema.Finite;
3231
- readonly text: Schema.String;
3232
- }>>, never, never>;
3233
- }> & {
3234
- create: (input: SessionEvent.FileAttachment) => {
3235
- readonly data: string;
3236
- readonly source: {
3237
- readonly type: "inline";
3238
- } | {
3239
- readonly type: "uri";
3240
- readonly uri: string;
3241
- };
3242
- readonly mime: string;
3243
- readonly description?: string | undefined;
3244
- readonly name?: string | undefined;
3245
- readonly mention?: {
3246
- readonly start: number;
3247
- readonly end: number;
3248
- readonly text: string;
3249
- } | undefined;
3250
- };
3251
- }>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
3252
- readonly data: Schema.String;
3253
- readonly mime: Schema.String;
3254
- readonly source: Schema.Union<readonly [Schema.Struct<{
3255
- readonly type: Schema.Literal<"inline">;
3256
- }>, Schema.Struct<{
3257
- readonly type: Schema.Literal<"uri">;
3258
- readonly uri: Schema.String;
3259
- }>]>;
3260
- readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
3261
- readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
3262
- readonly mention: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
3263
- readonly start: Schema.Finite;
3264
- readonly end: Schema.Finite;
3265
- readonly text: Schema.String;
3266
- }>>>, Schema.optionalKey<Schema.Struct<{
3267
- readonly start: Schema.Finite;
3268
- readonly end: Schema.Finite;
3269
- readonly text: Schema.String;
3270
- }>>, never, never>;
3271
- }> & {
3272
- create: (input: SessionEvent.FileAttachment) => {
3273
- readonly data: string;
3274
- readonly source: {
3275
- readonly type: "inline";
3276
- } | {
3277
- readonly type: "uri";
3278
- readonly uri: string;
3279
- };
3280
- readonly mime: string;
3281
- readonly description?: string | undefined;
3282
- readonly name?: string | undefined;
3283
- readonly mention?: {
3284
- readonly start: number;
3285
- readonly end: number;
3286
- readonly text: string;
3287
- } | undefined;
3288
- };
3289
- }>>, never, never>;
3290
- readonly agents: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
3291
- readonly name: Schema.String;
3292
- readonly mention: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
3293
- readonly start: Schema.Finite;
3294
- readonly end: Schema.Finite;
3295
- readonly text: Schema.String;
3296
- }>>>, Schema.optionalKey<Schema.Struct<{
3297
- readonly start: Schema.Finite;
3298
- readonly end: Schema.Finite;
3299
- readonly text: Schema.String;
3300
- }>>, never, never>;
3301
- }>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
3302
- readonly name: Schema.String;
3303
- readonly mention: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
3304
- readonly start: Schema.Finite;
3305
- readonly end: Schema.Finite;
3306
- readonly text: Schema.String;
3307
- }>>>, Schema.optionalKey<Schema.Struct<{
3308
- readonly start: Schema.Finite;
3309
- readonly end: Schema.Finite;
3310
- readonly text: Schema.String;
3311
- }>>, never, never>;
3312
- }>>>, never, never>;
3313
- readonly skills: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
3314
- readonly id: Schema.brand<Schema.String, "Skill.ID">;
3315
- readonly name: Schema.brand<Schema.String, "Skill.Name">;
3316
- readonly mention: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
3317
- readonly start: Schema.Finite;
3318
- readonly end: Schema.Finite;
3319
- readonly text: Schema.String;
3320
- }>>>, Schema.optionalKey<Schema.Struct<{
3321
- readonly start: Schema.Finite;
3322
- readonly end: Schema.Finite;
3323
- readonly text: Schema.String;
3324
- }>>, never, never>;
3325
- }>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
3326
- readonly id: Schema.brand<Schema.String, "Skill.ID">;
3327
- readonly name: Schema.brand<Schema.String, "Skill.Name">;
3328
- readonly mention: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
3329
- readonly start: Schema.Finite;
3330
- readonly end: Schema.Finite;
3331
- readonly text: Schema.String;
3332
- }>>>, Schema.optionalKey<Schema.Struct<{
3333
- readonly start: Schema.Finite;
3334
- readonly end: Schema.Finite;
3335
- readonly text: Schema.String;
3336
- }>>, never, never>;
3337
- }>>>, never, never>;
3338
- }>;
3339
- readonly delivery: Schema.Literals<readonly ["steer", "queue"]>;
3340
- readonly id: Schema.brand<Schema.String, "Session.Message.ID"> & {
3341
- create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
3342
- fromEvent: (eventID: Event.ID) => string & import("effect/Brand").Brand<"Session.Message.ID">;
3343
- };
3344
- readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
3345
- create: () => string & import("effect/Brand").Brand<"SessionID">;
3346
- descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
3347
- };
3348
- readonly timeCreated: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
3349
- }>;
3350
- }>>, Schema.toCodecJson<typeof InvalidRequestError | typeof ConflictError | typeof SessionNotFoundError | typeof CommandNotFoundError | typeof CommandEvaluationError>, I, HttpApiMiddleware.Requires<I>> | HttpApiEndpoint.HttpApiEndpoint<"session.skill", "POST", "/api/session/:sessionID/skill", Schema.toCodecStringTree<Schema.Struct<{
3177
+ readonly command: Schema.String;
3178
+ }>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof SessionNotFoundError | typeof CommandNotFoundError | typeof CommandExecutionError>, I, HttpApiMiddleware.Requires<I>> | HttpApiEndpoint.HttpApiEndpoint<"session.skill", "POST", "/api/session/:sessionID/skill", Schema.toCodecStringTree<Schema.Struct<{
3351
3179
  sessionID: Schema.brand<Schema.String, "SessionID"> & {
3352
3180
  create: () => string & import("effect/Brand").Brand<"SessionID">;
3353
3181
  descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
@@ -11,7 +11,7 @@ import { Event } from "@opencode-ai/schema/event";
11
11
  import { Workspace } from "@opencode-ai/schema/workspace";
12
12
  import { Context, Effect, Encoding, Result, Schema, SchemaGetter, Struct } from "effect";
13
13
  import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema, OpenApi } from "effect/unstable/httpapi";
14
- import { ConflictError, CommandEvaluationError, CommandNotFoundError, InvalidCursorError, InvalidRequestError, MessageNotFoundError, ServiceUnavailableError, SessionBusyError, SessionNotFoundError, SkillNotFoundError, UnknownError, } from "../errors.js";
14
+ import { ConflictError, CommandExecutionError, CommandNotFoundError, InvalidCursorError, InvalidRequestError, MessageNotFoundError, ServiceUnavailableError, SessionBusyError, SessionNotFoundError, SkillNotFoundError, UnknownError, } from "../errors.js";
15
15
  import { Agent } from "@opencode-ai/schema/agent";
16
16
  import { Skill } from "@opencode-ai/schema/skill";
17
17
  import { Model } from "@opencode-ai/schema/model";
@@ -263,25 +263,18 @@ export const makeSessionGroup = (sessionLocationMiddleware) => HttpApiGroup.make
263
263
  .add(HttpApiEndpoint.post("session.command", "/api/session/:sessionID/command", {
264
264
  params: { sessionID: Session.ID },
265
265
  payload: Schema.Struct({
266
- id: SessionMessage.ID.pipe(Schema.optional),
267
266
  command: Schema.String,
268
- arguments: Schema.String.pipe(Schema.optional),
269
- agent: Agent.ID.pipe(Schema.optional),
270
- model: Model.Ref.pipe(Schema.optional),
271
- files: PromptInput.Prompt.fields.files,
272
- agents: PromptInput.Prompt.fields.agents,
273
- skills: PromptInput.Prompt.fields.skills,
267
+ ...PromptInput.Prompt.fields,
274
268
  delivery: SessionInbox.Delivery.pipe(Schema.optional),
275
- resume: Schema.Boolean.pipe(Schema.optional),
276
269
  }),
277
- success: Schema.Struct({ data: SessionInbox.User }),
278
- error: [ConflictError, InvalidRequestError, SessionNotFoundError, CommandNotFoundError, CommandEvaluationError],
270
+ success: HttpApiSchema.NoContent,
271
+ error: [SessionNotFoundError, CommandNotFoundError, CommandExecutionError],
279
272
  })
280
273
  .middleware(sessionLocationMiddleware)
281
274
  .annotateMerge(OpenApi.annotations({
282
275
  identifier: "v2.session.command",
283
276
  summary: "Run command",
284
- description: "Resolve a slash command into prompt input, admit it durably, and schedule execution unless resume is false.",
277
+ description: "Execute a slash command callback immediately.",
285
278
  })))
286
279
  .add(HttpApiEndpoint.post("session.skill", "/api/session/:sessionID/skill", {
287
280
  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-ai/protocol",
4
- "version": "0.0.0-dev-18110",
4
+ "version": "0.0.0-dev-18112",
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-ai/schema": "0.0.0-dev-18110",
35
+ "@opencode-ai/schema": "0.0.0-dev-18112",
36
36
  "effect": "4.0.0-rc.111"
37
37
  },
38
38
  "devDependencies": {