@opencode/protocol 0.0.0-dev-1328 → 0.0.0-dev-1330

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.
@@ -3,7 +3,7 @@ import { Session } from "@opencode/schema/session";
3
3
  import { Schema } from "effect";
4
4
  import { HttpApiEndpoint, HttpApiSchema, OpenApi } from "effect/http-api";
5
5
  import { AutomationNotFoundError, ForbiddenError, InvalidRequestError, SessionNotFoundError } from "../errors.js";
6
- const EXPERIMENTAL = "Experimental: needs experimental.automations in the config of the automation's directory and may change without compatibility guarantees.";
6
+ const EXPERIMENTAL = "Experimental: may change without compatibility guarantees. Set automations to false in the directory's config to disable access.";
7
7
  const errors = [AutomationNotFoundError, ForbiddenError];
8
8
  const params = { automationID: Automation.ID };
9
9
  const annotations = (identifier, summary, description) => OpenApi.annotations({
@@ -675,6 +675,12 @@ export declare const ExperimentalGroup: import("effect/http-api/HttpApiGroup").H
675
675
  readonly name: import("effect/Schema").String;
676
676
  readonly join: import("effect/Schema").String;
677
677
  readonly expires: import("effect/Schema").Int;
678
+ readonly reach: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
679
+ readonly type: import("effect/Schema").Literal<"url">;
680
+ readonly url: import("effect/Schema").String;
681
+ }>, import("effect/Schema").Struct<{
682
+ readonly type: import("effect/Schema").Literal<"iroh">;
683
+ }>]>>;
678
684
  }>;
679
685
  }>>, import("effect/Schema").toCodecJson<typeof import("../errors.js").InvalidRequestError | typeof import("../errors.js").ConflictError | typeof import("../errors.js").ForbiddenError | typeof import("../errors.js").MachineNotFoundError>, never, never> | import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"machine.link", "GET", "/api/experimental/machine/link", never, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Boolean>, never, never, never> | import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"machine.list", "GET", "/api/experimental/machine", never, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
680
686
  readonly data: import("effect/Schema").$Array<import("effect/Schema").Struct<{
@@ -683,10 +689,15 @@ export declare const ExperimentalGroup: import("effect/http-api/HttpApiGroup").H
683
689
  readonly paired: import("effect/Schema").Boolean;
684
690
  readonly os: import("effect/Schema").optionalKey<import("effect/Schema").String>;
685
691
  readonly arch: import("effect/Schema").optionalKey<import("effect/Schema").String>;
692
+ readonly connection: import("effect/Schema").optionalKey<import("effect/Schema").Struct<{
693
+ readonly kind: import("effect/Schema").Literals<readonly ["websocket", "iroh"]>;
694
+ readonly path: import("effect/Schema").optionalKey<import("effect/Schema").Literals<readonly ["direct", "relayed"]>>;
695
+ readonly rtt: import("effect/Schema").optionalKey<import("effect/Schema").Number>;
696
+ }>>;
686
697
  }>>;
687
698
  }>>, import("effect/Schema").toCodecJson<typeof import("../errors.js").ForbiddenError>, never, never> | import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"machine.remove", "DELETE", "/api/experimental/machine/:name", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
688
699
  name: import("effect/Schema").String;
689
- }>>, never, never, never, import("effect/Schema").toCodecJson<import("effect/http-api/HttpApiSchema").NoContent>, import("effect/Schema").toCodecJson<typeof import("../errors.js").ForbiddenError>, never, never> | import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"media.get", "GET", "/api/experimental/media/:hash", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
700
+ }>>, never, never, never, import("effect/Schema").toCodecJson<import("effect/http-api/HttpApiSchema").NoContent>, import("effect/Schema").toCodecJson<typeof import("../errors.js").ForbiddenError | typeof import("../errors.js").MachineNotFoundError>, never, never> | import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"media.get", "GET", "/api/experimental/media/:hash", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
690
701
  hash: import("effect/Schema").String;
691
702
  }>>, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Uint8Array>, import("effect/Schema").toCodecJson<typeof import("../errors.js").InvalidRequestError | typeof import("../errors.js").FileNotFoundError>, never, never> | import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"persistentPty.connect", "GET", "/api/experimental/persistent-pty/:ptyID/connect", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
692
703
  ptyID: import("effect/Schema").brand<import("effect/Schema").String, "PtyID"> & {
@@ -8,6 +8,12 @@ export declare const MachineInfo: Schema.Struct<{
8
8
  readonly paired: Schema.Boolean;
9
9
  readonly os: Schema.optionalKey<Schema.String>;
10
10
  readonly arch: Schema.optionalKey<Schema.String>;
11
+ readonly connection: Schema.optionalKey<Schema.Struct<{
12
+ readonly kind: Schema.Literals<readonly ["websocket", "iroh"]>;
13
+ readonly path: Schema.optionalKey<Schema.Literals<readonly ["direct", "relayed"]>>;
14
+ /** Round-trip time in milliseconds. */
15
+ readonly rtt: Schema.optionalKey<Schema.Number>;
16
+ }>>;
11
17
  }>;
12
18
  export type MachineInfo = typeof MachineInfo.Type;
13
19
  export declare const MachineReach: Schema.Struct<{
@@ -28,6 +34,12 @@ export declare const MachineInvite: Schema.Struct<{
28
34
  readonly name: Schema.String;
29
35
  readonly join: Schema.String;
30
36
  readonly expires: Schema.Int;
37
+ readonly reach: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
38
+ readonly type: Schema.Literal<"url">;
39
+ readonly url: Schema.String;
40
+ }>, Schema.Struct<{
41
+ readonly type: Schema.Literal<"iroh">;
42
+ }>]>>;
31
43
  }>;
32
44
  export type MachineInvite = typeof MachineInvite.Type;
33
45
  /**
@@ -57,6 +69,12 @@ export declare const MachineEndpoints: readonly [HttpApiEndpoint.HttpApiEndpoint
57
69
  readonly paired: Schema.Boolean;
58
70
  readonly os: Schema.optionalKey<Schema.String>;
59
71
  readonly arch: Schema.optionalKey<Schema.String>;
72
+ readonly connection: Schema.optionalKey<Schema.Struct<{
73
+ readonly kind: Schema.Literals<readonly ["websocket", "iroh"]>;
74
+ readonly path: Schema.optionalKey<Schema.Literals<readonly ["direct", "relayed"]>>;
75
+ /** Round-trip time in milliseconds. */
76
+ readonly rtt: Schema.optionalKey<Schema.Number>;
77
+ }>>;
60
78
  }>>;
61
79
  }>>, Schema.toCodecJson<typeof ForbiddenError>, never, never>, HttpApiEndpoint.HttpApiEndpoint<"machine.add", "POST", "/api/experimental/machine", never, never, Schema.toCodecJson<Schema.Struct<{
62
80
  readonly name: Schema.String;
@@ -70,7 +88,13 @@ export declare const MachineEndpoints: readonly [HttpApiEndpoint.HttpApiEndpoint
70
88
  readonly name: Schema.String;
71
89
  readonly join: Schema.String;
72
90
  readonly expires: Schema.Int;
91
+ readonly reach: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
92
+ readonly type: Schema.Literal<"url">;
93
+ readonly url: Schema.String;
94
+ }>, Schema.Struct<{
95
+ readonly type: Schema.Literal<"iroh">;
96
+ }>]>>;
73
97
  }>;
74
98
  }>>, Schema.toCodecJson<typeof InvalidRequestError | typeof ConflictError | typeof ForbiddenError | typeof MachineNotFoundError>, never, never>, HttpApiEndpoint.HttpApiEndpoint<"machine.remove", "DELETE", "/api/experimental/machine/:name", Schema.toCodecStringTree<Schema.Struct<{
75
99
  name: Schema.String;
76
- }>>, never, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof ForbiddenError>, never, never>];
100
+ }>>, never, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof ForbiddenError | typeof MachineNotFoundError>, never, never>];
@@ -15,6 +15,12 @@ export const MachineInfo = Schema.Struct({
15
15
  paired: Schema.Boolean,
16
16
  os: Schema.optionalKey(Schema.String),
17
17
  arch: Schema.optionalKey(Schema.String),
18
+ connection: Schema.optionalKey(Schema.Struct({
19
+ kind: Schema.Literals(["websocket", "iroh"]),
20
+ path: Schema.optionalKey(Schema.Literals(["direct", "relayed"])),
21
+ /** Round-trip time in milliseconds. */
22
+ rtt: Schema.optionalKey(Schema.Number),
23
+ })),
18
24
  }).annotate({ identifier: "Machine.Info" });
19
25
  export const MachineReach = Schema.Struct({
20
26
  type: Schema.Literal("url"),
@@ -29,6 +35,7 @@ export const MachineInvite = Schema.Struct({
29
35
  name: Schema.String,
30
36
  join: Schema.String,
31
37
  expires: Schema.Int,
38
+ reach: Schema.Array(Schema.Union([MachineReach, Schema.Struct({ type: Schema.Literal("iroh") })])),
32
39
  }).annotate({ identifier: "Machine.Invite" });
33
40
  /**
34
41
  * Whether a request asks to become a WebSocket, the one request the machine link serves and the one the server lets in
@@ -70,6 +77,6 @@ export const MachineEndpoints = [
70
77
  HttpApiEndpoint.delete("machine.remove", "/api/experimental/machine/:name", {
71
78
  params: { name: Schema.String },
72
79
  success: HttpApiSchema.NoContent,
73
- error: [ForbiddenError],
80
+ error: [ForbiddenError, MachineNotFoundError],
74
81
  }).annotateMerge(annotations("remove", "Remove a machine", "Forget a machine by name, closing any live link and revoking its key.")),
75
82
  ];
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-1328",
4
+ "version": "0.0.0-dev-1330",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -35,7 +35,7 @@
35
35
  "typecheck:tsc": "tsc --noEmit"
36
36
  },
37
37
  "dependencies": {
38
- "@opencode/schema": "0.0.0-dev-1328",
38
+ "@opencode/schema": "0.0.0-dev-1330",
39
39
  "effect": "4.1.0"
40
40
  },
41
41
  "devDependencies": {