@zyro-sec/protocol 1.0.1 → 1.0.3

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 (61) hide show
  1. package/openapi.json +33222 -33222
  2. package/package.json +6 -2
  3. package/script/build.ts +9 -9
  4. package/script/generate-openapi.ts +25 -25
  5. package/script/openapi-parameters.ts +30 -30
  6. package/script/openapi-stabilize.ts +102 -102
  7. package/script/pack.ts +5 -5
  8. package/src/api.ts +264 -264
  9. package/src/client.ts +127 -127
  10. package/src/errors.ts +398 -398
  11. package/src/groups/agent.ts +39 -39
  12. package/src/groups/artifact.ts +103 -103
  13. package/src/groups/automation.ts +75 -75
  14. package/src/groups/blob.ts +20 -20
  15. package/src/groups/command.ts +27 -27
  16. package/src/groups/config.ts +46 -46
  17. package/src/groups/credential.ts +72 -72
  18. package/src/groups/debug.ts +68 -68
  19. package/src/groups/event.ts +86 -86
  20. package/src/groups/experimental.ts +19 -19
  21. package/src/groups/form.ts +26 -26
  22. package/src/groups/fs.ts +136 -136
  23. package/src/groups/generate.ts +120 -120
  24. package/src/groups/integration.ts +230 -230
  25. package/src/groups/job.ts +57 -57
  26. package/src/groups/location.ts +66 -66
  27. package/src/groups/machine.ts +120 -120
  28. package/src/groups/mcp.ts +167 -167
  29. package/src/groups/media.ts +23 -23
  30. package/src/groups/message.ts +124 -124
  31. package/src/groups/migration.ts +28 -28
  32. package/src/groups/model.ts +52 -52
  33. package/src/groups/permission.ts +164 -164
  34. package/src/groups/persistent-pty.ts +153 -153
  35. package/src/groups/plugin.ts +80 -80
  36. package/src/groups/project.ts +51 -51
  37. package/src/groups/provider.ts +45 -45
  38. package/src/groups/pty.ts +153 -153
  39. package/src/groups/push.ts +94 -94
  40. package/src/groups/reference.ts +42 -42
  41. package/src/groups/rpc.ts +30 -30
  42. package/src/groups/server.ts +80 -80
  43. package/src/groups/session.ts +918 -918
  44. package/src/groups/shell.ts +88 -88
  45. package/src/groups/skill.ts +46 -46
  46. package/src/groups/usage.ts +30 -30
  47. package/src/groups/vcs.ts +131 -131
  48. package/src/groups/voice.ts +96 -96
  49. package/src/groups/websearch.ts +46 -46
  50. package/src/groups/worktree.ts +78 -78
  51. package/src/middleware/authorization.ts +6 -6
  52. package/src/middleware/schema-error.ts +7 -7
  53. package/src/simulation.ts +691 -691
  54. package/tsconfig.build.json +11 -11
  55. package/tsconfig.json +14 -14
  56. package/test/event.test.ts +0 -34
  57. package/test/experimental-identifiers.test.ts +0 -24
  58. package/test/openapi-parameters.test.ts +0 -43
  59. package/test/openapi-patterns.test.ts +0 -28
  60. package/test/openapi-stabilize.test.ts +0 -161
  61. package/test/session-cursor.test.ts +0 -7
@@ -1,42 +1,42 @@
1
- import { Location } from "@zyro-sec/schema/location"
2
- import { Reference } from "@zyro-sec/schema/reference"
3
- import { Schema, Struct } from "effect"
4
- import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api"
5
- import { LocationQuery, locationQueryOpenApi } from "./location.js"
6
-
7
- const PublicLocalSource = Schema.Struct(Struct.omit(Reference.LocalSource.fields, ["description", "hidden"])).annotate({
8
- identifier: "Reference.LocalSource",
9
- })
10
- const PublicGitSource = Schema.Struct(Struct.omit(Reference.GitSource.fields, ["description", "hidden"])).annotate({
11
- identifier: "Reference.GitSource",
12
- })
13
- const PublicSource = Schema.Union([PublicLocalSource, PublicGitSource])
14
- .pipe(Schema.toTaggedUnion("type"))
15
- .annotate({ identifier: "Reference.Source" })
16
-
17
- const PublicInfo = Schema.Struct({
18
- ...Struct.omit(Reference.Info.fields, ["source"]),
19
- source: PublicSource,
20
- }).annotate({ identifier: "Reference.Info" })
21
-
22
- export const ReferenceGroup = HttpApiGroup.make("server.reference")
23
- .add(
24
- HttpApiEndpoint.get("reference.list", "/api/reference", {
25
- query: LocationQuery,
26
- success: Location.response(Schema.Array(PublicInfo)),
27
- })
28
- .annotateMerge(locationQueryOpenApi)
29
- .annotateMerge(
30
- OpenApi.annotations({
31
- identifier: "reference.list",
32
- summary: "List references",
33
- description: "List references available in the requested location.",
34
- }),
35
- ),
36
- )
37
- .annotateMerge(
38
- OpenApi.annotations({
39
- title: "reference",
40
- description: "Location-scoped project references.",
41
- }),
42
- )
1
+ import { Location } from "@zyro-sec/schema/location"
2
+ import { Reference } from "@zyro-sec/schema/reference"
3
+ import { Schema, Struct } from "effect"
4
+ import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api"
5
+ import { LocationQuery, locationQueryOpenApi } from "./location.js"
6
+
7
+ const PublicLocalSource = Schema.Struct(Struct.omit(Reference.LocalSource.fields, ["description", "hidden"])).annotate({
8
+ identifier: "Reference.LocalSource",
9
+ })
10
+ const PublicGitSource = Schema.Struct(Struct.omit(Reference.GitSource.fields, ["description", "hidden"])).annotate({
11
+ identifier: "Reference.GitSource",
12
+ })
13
+ const PublicSource = Schema.Union([PublicLocalSource, PublicGitSource])
14
+ .pipe(Schema.toTaggedUnion("type"))
15
+ .annotate({ identifier: "Reference.Source" })
16
+
17
+ const PublicInfo = Schema.Struct({
18
+ ...Struct.omit(Reference.Info.fields, ["source"]),
19
+ source: PublicSource,
20
+ }).annotate({ identifier: "Reference.Info" })
21
+
22
+ export const ReferenceGroup = HttpApiGroup.make("server.reference")
23
+ .add(
24
+ HttpApiEndpoint.get("reference.list", "/api/reference", {
25
+ query: LocationQuery,
26
+ success: Location.response(Schema.Array(PublicInfo)),
27
+ })
28
+ .annotateMerge(locationQueryOpenApi)
29
+ .annotateMerge(
30
+ OpenApi.annotations({
31
+ identifier: "reference.list",
32
+ summary: "List references",
33
+ description: "List references available in the requested location.",
34
+ }),
35
+ ),
36
+ )
37
+ .annotateMerge(
38
+ OpenApi.annotations({
39
+ title: "reference",
40
+ description: "Location-scoped project references.",
41
+ }),
42
+ )
package/src/groups/rpc.ts CHANGED
@@ -1,30 +1,30 @@
1
- import { optional } from "@zyro-sec/schema/schema"
2
- import { Schema } from "effect"
3
- import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api"
4
- import { RpcError, RpcInternalError } from "../errors.js"
5
- import { LocationQuery, locationQueryOpenApi } from "./location.js"
6
-
7
- export const RpcInput = Schema.Struct({ input: optional(Schema.Unknown) }).annotate({ identifier: "Rpc.Input" })
8
- export const RpcOutput = Schema.Struct({ output: Schema.optionalKey(Schema.Unknown) }).annotate({
9
- identifier: "Rpc.Output",
10
- })
11
-
12
- export const RpcGroup = HttpApiGroup.make("server.rpc")
13
- .add(
14
- HttpApiEndpoint.post("rpc.call", "/api/rpc/:rpcID/:method", {
15
- params: { rpcID: Schema.String, method: Schema.String },
16
- query: LocationQuery,
17
- payload: RpcInput,
18
- success: RpcOutput,
19
- error: [RpcError, RpcInternalError],
20
- })
21
- .annotateMerge(locationQueryOpenApi)
22
- .annotateMerge(
23
- OpenApi.annotations({
24
- identifier: "rpc.call",
25
- summary: "Call a plugin RPC",
26
- description: "Dispatch a method to the currently registered RPC at the requested location.",
27
- }),
28
- ),
29
- )
30
- .annotateMerge(OpenApi.annotations({ title: "rpc", description: "Plugin RPC routes." }))
1
+ import { optional } from "@zyro-sec/schema/schema"
2
+ import { Schema } from "effect"
3
+ import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api"
4
+ import { RpcError, RpcInternalError } from "../errors.js"
5
+ import { LocationQuery, locationQueryOpenApi } from "./location.js"
6
+
7
+ export const RpcInput = Schema.Struct({ input: optional(Schema.Unknown) }).annotate({ identifier: "Rpc.Input" })
8
+ export const RpcOutput = Schema.Struct({ output: Schema.optionalKey(Schema.Unknown) }).annotate({
9
+ identifier: "Rpc.Output",
10
+ })
11
+
12
+ export const RpcGroup = HttpApiGroup.make("server.rpc")
13
+ .add(
14
+ HttpApiEndpoint.post("rpc.call", "/api/rpc/:rpcID/:method", {
15
+ params: { rpcID: Schema.String, method: Schema.String },
16
+ query: LocationQuery,
17
+ payload: RpcInput,
18
+ success: RpcOutput,
19
+ error: [RpcError, RpcInternalError],
20
+ })
21
+ .annotateMerge(locationQueryOpenApi)
22
+ .annotateMerge(
23
+ OpenApi.annotations({
24
+ identifier: "rpc.call",
25
+ summary: "Call a plugin RPC",
26
+ description: "Dispatch a method to the currently registered RPC at the requested location.",
27
+ }),
28
+ ),
29
+ )
30
+ .annotateMerge(OpenApi.annotations({ title: "rpc", description: "Plugin RPC routes." }))
@@ -1,80 +1,80 @@
1
- import { Schema } from "effect"
2
- import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api"
3
- import { UnauthorizedError } from "../errors.js"
4
-
5
- export const ServerInfo = Schema.Struct({
6
- version: Schema.String,
7
- // 0 means the runtime has no OS process identity (e.g. workerd).
8
- pid: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
9
- // The machine's name, absent where the runtime has none (e.g. workerd).
10
- hostname: Schema.optional(Schema.String),
11
- urls: Schema.Array(Schema.String),
12
- paths: Schema.Struct({
13
- tmp: Schema.String,
14
- }),
15
- // Optional at every level so clients still decode servers that predate a capability.
16
- capabilities: Schema.optional(
17
- Schema.Struct({
18
- persistentPty: Schema.optional(Schema.Boolean),
19
- }),
20
- ),
21
- }).annotate({ identifier: "ServerInfo" })
22
- export type ServerInfo = typeof ServerInfo.Type
23
-
24
- export const PairingCode = Schema.Struct({
25
- code: Schema.String,
26
- expires_in: Schema.Int,
27
- }).annotate({ identifier: "PairingCode" })
28
- export type PairingCode = typeof PairingCode.Type
29
-
30
- export const PairingSession = Schema.Struct({
31
- token: Schema.String,
32
- }).annotate({ identifier: "PairingSession" })
33
- export type PairingSession = typeof PairingSession.Type
34
-
35
- export const PAIRING_CONNECT_PATH = "/auth/connect/:code"
36
-
37
- const PAIRING_CONNECT_URL = /^\/auth\/connect\/[^/]+$/
38
-
39
- export function isPairingConnectURL(url: URL) {
40
- return PAIRING_CONNECT_URL.test(url.pathname)
41
- }
42
-
43
- export const ServerGroup = HttpApiGroup.make("server.server")
44
- .add(
45
- HttpApiEndpoint.get("server.info", "/api/info", {
46
- success: ServerInfo,
47
- }).annotateMerge(
48
- OpenApi.annotations({
49
- identifier: "server.info",
50
- summary: "Get server info",
51
- description: "Return the server identity, connection URLs, paths, and readiness status.",
52
- }),
53
- ),
54
- )
55
- .add(
56
- HttpApiEndpoint.post("server.pair", "/api/pair", {
57
- success: PairingCode,
58
- }).annotateMerge(
59
- OpenApi.annotations({
60
- identifier: "server.pair",
61
- summary: "Create pairing code",
62
- description: "Create a short-lived, single-use code for a /auth/connect/:code pairing link.",
63
- }),
64
- ),
65
- )
66
- .add(
67
- HttpApiEndpoint.get("server.connect", PAIRING_CONNECT_PATH, {
68
- params: { code: Schema.String },
69
- success: PairingSession,
70
- error: UnauthorizedError,
71
- }).annotateMerge(
72
- OpenApi.annotations({
73
- identifier: "server.connect",
74
- summary: "Redeem pairing code",
75
- description:
76
- "Redeem a pairing code. Browsers receive a session cookie and a redirect to the web app; requests that accept JSON receive a session token to use as the password.",
77
- }),
78
- ),
79
- )
80
- .annotateMerge(OpenApi.annotations({ title: "server" }))
1
+ import { Schema } from "effect"
2
+ import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api"
3
+ import { UnauthorizedError } from "../errors.js"
4
+
5
+ export const ServerInfo = Schema.Struct({
6
+ version: Schema.String,
7
+ // 0 means the runtime has no OS process identity (e.g. workerd).
8
+ pid: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
9
+ // The machine's name, absent where the runtime has none (e.g. workerd).
10
+ hostname: Schema.optional(Schema.String),
11
+ urls: Schema.Array(Schema.String),
12
+ paths: Schema.Struct({
13
+ tmp: Schema.String,
14
+ }),
15
+ // Optional at every level so clients still decode servers that predate a capability.
16
+ capabilities: Schema.optional(
17
+ Schema.Struct({
18
+ persistentPty: Schema.optional(Schema.Boolean),
19
+ }),
20
+ ),
21
+ }).annotate({ identifier: "ServerInfo" })
22
+ export type ServerInfo = typeof ServerInfo.Type
23
+
24
+ export const PairingCode = Schema.Struct({
25
+ code: Schema.String,
26
+ expires_in: Schema.Int,
27
+ }).annotate({ identifier: "PairingCode" })
28
+ export type PairingCode = typeof PairingCode.Type
29
+
30
+ export const PairingSession = Schema.Struct({
31
+ token: Schema.String,
32
+ }).annotate({ identifier: "PairingSession" })
33
+ export type PairingSession = typeof PairingSession.Type
34
+
35
+ export const PAIRING_CONNECT_PATH = "/auth/connect/:code"
36
+
37
+ const PAIRING_CONNECT_URL = /^\/auth\/connect\/[^/]+$/
38
+
39
+ export function isPairingConnectURL(url: URL) {
40
+ return PAIRING_CONNECT_URL.test(url.pathname)
41
+ }
42
+
43
+ export const ServerGroup = HttpApiGroup.make("server.server")
44
+ .add(
45
+ HttpApiEndpoint.get("server.info", "/api/info", {
46
+ success: ServerInfo,
47
+ }).annotateMerge(
48
+ OpenApi.annotations({
49
+ identifier: "server.info",
50
+ summary: "Get server info",
51
+ description: "Return the server identity, connection URLs, paths, and readiness status.",
52
+ }),
53
+ ),
54
+ )
55
+ .add(
56
+ HttpApiEndpoint.post("server.pair", "/api/pair", {
57
+ success: PairingCode,
58
+ }).annotateMerge(
59
+ OpenApi.annotations({
60
+ identifier: "server.pair",
61
+ summary: "Create pairing code",
62
+ description: "Create a short-lived, single-use code for a /auth/connect/:code pairing link.",
63
+ }),
64
+ ),
65
+ )
66
+ .add(
67
+ HttpApiEndpoint.get("server.connect", PAIRING_CONNECT_PATH, {
68
+ params: { code: Schema.String },
69
+ success: PairingSession,
70
+ error: UnauthorizedError,
71
+ }).annotateMerge(
72
+ OpenApi.annotations({
73
+ identifier: "server.connect",
74
+ summary: "Redeem pairing code",
75
+ description:
76
+ "Redeem a pairing code. Browsers receive a session cookie and a redirect to the web app; requests that accept JSON receive a session token to use as the password.",
77
+ }),
78
+ ),
79
+ )
80
+ .annotateMerge(OpenApi.annotations({ title: "server" }))