@opencode/protocol 0.0.0-dev-21876 → 0.0.0-dev-21894

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.
@@ -1,7 +1,7 @@
1
1
  import { Agent } from "@opencode/schema/agent";
2
2
  import { Schema } from "effect";
3
3
  import { HttpApiEndpoint, HttpApiGroup } from "effect/http-api";
4
- import { AgentNotFoundError } from "../errors.js";
4
+ import { AgentNotFoundError, ServiceUnavailableError } from "../errors.js";
5
5
  export declare const AgentGroup: HttpApiGroup.HttpApiGroup<"server.agent", HttpApiEndpoint.HttpApiEndpoint<"agent.get", "GET", "/api/agent/:agentID", Schema.toCodecStringTree<Schema.Struct<{
6
6
  agentID: Schema.brand<Schema.String, "Agent.ID">;
7
7
  }>>, Schema.toCodecStringTree<Schema.Struct<{
@@ -222,4 +222,4 @@ export declare const AgentGroup: HttpApiGroup.HttpApiGroup<"server.agent", HttpA
222
222
  })[];
223
223
  };
224
224
  }>;
225
- }>>, never, never, never>, false>;
225
+ }>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never>, false>;
@@ -3,11 +3,12 @@ import { Location } from "@opencode/schema/location";
3
3
  import { Schema } from "effect";
4
4
  import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api";
5
5
  import { LocationQuery, locationQueryOpenApi } from "./location.js";
6
- import { AgentNotFoundError } from "../errors.js";
6
+ import { AgentNotFoundError, ServiceUnavailableError } from "../errors.js";
7
7
  export const AgentGroup = HttpApiGroup.make("server.agent")
8
8
  .add(HttpApiEndpoint.get("agent.list", "/api/agent", {
9
9
  query: LocationQuery,
10
10
  success: Location.response(Schema.Array(Agent.Info)),
11
+ error: ServiceUnavailableError,
11
12
  })
12
13
  .annotateMerge(locationQueryOpenApi)
13
14
  .annotateMerge(OpenApi.annotations({
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
- import { HttpApiEndpoint, HttpApiGroup } from "effect/http-api";
3
- import { FileNotFoundError } from "../errors.js";
2
+ import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/http-api";
3
+ import { FileNotFoundError, ServiceUnavailableError } from "../errors.js";
4
4
  export declare const FileSystemGroup: HttpApiGroup.HttpApiGroup<"server.fs", HttpApiEndpoint.HttpApiEndpoint<"fs.find", "GET", "/api/fs/find", never, Schema.toCodecStringTree<Schema.Struct<{
5
5
  readonly location: Schema.optional<Schema.Struct<{
6
6
  readonly directory: Schema.optional<Schema.String>;
@@ -33,7 +33,19 @@ export declare const FileSystemGroup: HttpApiGroup.HttpApiGroup<"server.fs", Htt
33
33
  readonly location: Schema.optional<Schema.Struct<{
34
34
  readonly directory: Schema.optional<Schema.String>;
35
35
  }>>;
36
- }>>, never, never, Schema.toCodecJson<Schema.Uint8Array>, Schema.toCodecJson<typeof FileNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"fs.write", "POST", "/api/experimental/fs/write", never, Schema.toCodecStringTree<Schema.Struct<{
36
+ }>>, never, never, Schema.toCodecJson<Schema.Uint8Array>, Schema.toCodecJson<typeof FileNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"fs.unwatch", "DELETE", "/api/experimental/fs/watch", never, Schema.toCodecStringTree<Schema.Struct<{
37
+ readonly location: Schema.optional<Schema.Struct<{
38
+ readonly directory: Schema.optional<Schema.String>;
39
+ }>>;
40
+ }>>, Schema.toCodecJson<Schema.Struct<{
41
+ readonly path: Schema.String;
42
+ }>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"fs.watch", "POST", "/api/experimental/fs/watch", never, Schema.toCodecStringTree<Schema.Struct<{
43
+ readonly location: Schema.optional<Schema.Struct<{
44
+ readonly directory: Schema.optional<Schema.String>;
45
+ }>>;
46
+ }>>, Schema.toCodecJson<Schema.Struct<{
47
+ readonly path: Schema.String;
48
+ }>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof ServiceUnavailableError | typeof FileNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"fs.write", "POST", "/api/experimental/fs/write", never, Schema.toCodecStringTree<Schema.Struct<{
37
49
  readonly location: Schema.optional<Schema.Struct<{
38
50
  readonly directory: Schema.optional<Schema.String>;
39
51
  }>>;
package/dist/groups/fs.js CHANGED
@@ -3,7 +3,7 @@ import { Location } from "@opencode/schema/location";
3
3
  import { PositiveInt } from "@opencode/schema/schema";
4
4
  import { Schema } from "effect";
5
5
  import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api";
6
- import { FileNotFoundError } from "../errors.js";
6
+ import { FileNotFoundError, ServiceUnavailableError } from "../errors.js";
7
7
  import { LocationQuery, locationQueryOpenApi } from "./location.js";
8
8
  const ListQuery = Schema.Struct({
9
9
  ...LocationQuery.fields,
@@ -17,6 +17,9 @@ const WriteQuery = Schema.Struct({
17
17
  description: "An absolute path or a path relative to the requested location. Missing parent directories are created.",
18
18
  }),
19
19
  });
20
+ const WatchPayload = Schema.Struct({
21
+ path: Schema.String.annotate({ description: "A file path relative to the requested location." }),
22
+ });
20
23
  const FindQuery = Schema.Struct({
21
24
  ...LocationQuery.fields,
22
25
  query: FileSystem.FindInput.fields.query,
@@ -66,6 +69,29 @@ export const FileSystemGroup = HttpApiGroup.make("server.fs")
66
69
  identifier: "experimental.fs.write",
67
70
  summary: "Write file",
68
71
  description: "Write the raw request body to an absolute path or a path relative to the requested location, creating parent directories, and return the resolved absolute path. Unlike read, the target is not confined to the location. Experimental: may change without compatibility guarantees.",
72
+ })))
73
+ .add(HttpApiEndpoint.post("fs.watch", "/api/experimental/fs/watch", {
74
+ query: LocationQuery,
75
+ payload: WatchPayload,
76
+ success: HttpApiSchema.NoContent,
77
+ error: [FileNotFoundError, ServiceUnavailableError],
78
+ })
79
+ .annotateMerge(locationQueryOpenApi)
80
+ .annotateMerge(OpenApi.annotations({
81
+ identifier: "experimental.fs.watch",
82
+ summary: "Watch file",
83
+ description: "Watch one file relative to the requested location for 24 hours, publishing filesystem.changed on that location when it changes. Watching an already watched file resets its expiry. Paths follow read confinement. Experimental: may change without compatibility guarantees.",
84
+ })))
85
+ .add(HttpApiEndpoint.delete("fs.unwatch", "/api/experimental/fs/watch", {
86
+ query: LocationQuery,
87
+ payload: WatchPayload,
88
+ success: HttpApiSchema.NoContent,
89
+ })
90
+ .annotateMerge(locationQueryOpenApi)
91
+ .annotateMerge(OpenApi.annotations({
92
+ identifier: "experimental.fs.unwatch",
93
+ summary: "Unwatch file",
94
+ description: "Stop watching one file relative to the requested location. Experimental: may change without compatibility guarantees.",
69
95
  })))
70
96
  .annotateMerge(OpenApi.annotations({
71
97
  title: "filesystem",
@@ -4,6 +4,7 @@ import { UnauthorizedError } from "../errors.js";
4
4
  export declare const ServerInfo: Schema.Struct<{
5
5
  readonly version: Schema.String;
6
6
  readonly pid: Schema.Int;
7
+ readonly hostname: Schema.optional<Schema.String>;
7
8
  readonly urls: Schema.$Array<Schema.String>;
8
9
  readonly paths: Schema.Struct<{
9
10
  readonly tmp: Schema.String;
@@ -31,6 +32,7 @@ export declare const ServerGroup: HttpApiGroup.HttpApiGroup<"server.server", Htt
31
32
  }>>, Schema.toCodecJson<typeof UnauthorizedError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"server.info", "GET", "/api/info", never, never, never, never, Schema.toCodecJson<Schema.Struct<{
32
33
  readonly version: Schema.String;
33
34
  readonly pid: Schema.Int;
35
+ readonly hostname: Schema.optional<Schema.String>;
34
36
  readonly urls: Schema.$Array<Schema.String>;
35
37
  readonly paths: Schema.Struct<{
36
38
  readonly tmp: Schema.String;
@@ -5,6 +5,8 @@ export const ServerInfo = Schema.Struct({
5
5
  version: Schema.String,
6
6
  // 0 means the runtime has no OS process identity (e.g. workerd).
7
7
  pid: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
8
+ // The machine's name, absent where the runtime has none (e.g. workerd).
9
+ hostname: Schema.optional(Schema.String),
8
10
  urls: Schema.Array(Schema.String),
9
11
  paths: Schema.Struct({
10
12
  tmp: Schema.String,
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-21876",
4
+ "version": "0.0.0-dev-21894",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -34,7 +34,7 @@
34
34
  "typecheck:tsc": "tsc --noEmit"
35
35
  },
36
36
  "dependencies": {
37
- "@opencode/schema": "0.0.0-dev-21876",
37
+ "@opencode/schema": "0.0.0-dev-21894",
38
38
  "effect": "4.0.1"
39
39
  },
40
40
  "devDependencies": {