@zyro-sec/protocol 1.0.2 → 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 +2 -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,96 +1,96 @@
1
- import { Schema } from "effect"
2
- import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api"
3
- import { InvalidRequestError, LocationNotFoundError, ServiceUnavailableError } from "../errors.js"
4
-
5
- export const VoiceTransportType = Schema.Literals(["webrtc", "websocket"]).annotate({
6
- identifier: "VoiceTransportType",
7
- })
8
-
9
- export const VoiceModel = Schema.Struct({
10
- model: Schema.String,
11
- name: Schema.String,
12
- engine: Schema.String,
13
- provider: Schema.String,
14
- transports: Schema.Array(VoiceTransportType),
15
- available: Schema.Boolean,
16
- }).annotate({ identifier: "VoiceModel" })
17
-
18
- export const VoiceWebRTCTransportInput = Schema.Struct({
19
- type: Schema.Literal("webrtc"),
20
- sdp: Schema.String,
21
- dcid: Schema.optional(Schema.Number),
22
- }).annotate({ identifier: "VoiceWebRTCTransportInput" })
23
-
24
- export const VoiceWebSocketTransportInput = Schema.Struct({
25
- type: Schema.Literal("websocket"),
26
- }).annotate({ identifier: "VoiceWebSocketTransportInput" })
27
-
28
- export const VoiceTransportInput = Schema.Union([
29
- VoiceWebRTCTransportInput,
30
- VoiceWebSocketTransportInput,
31
- ]).annotate({ identifier: "VoiceTransportInput" })
32
-
33
- export const VoiceWebRTCTransport = Schema.Struct({
34
- type: Schema.Literal("webrtc"),
35
- sdp: Schema.String,
36
- }).annotate({ identifier: "VoiceWebRTCTransport" })
37
-
38
- export const VoiceWebSocketTransport = Schema.Struct({
39
- type: Schema.Literal("websocket"),
40
- url: Schema.String,
41
- token: Schema.String,
42
- expiresAt: Schema.Number,
43
- }).annotate({ identifier: "VoiceWebSocketTransport" })
44
-
45
- export const VoiceTransport = Schema.Union([
46
- VoiceWebRTCTransport,
47
- VoiceWebSocketTransport,
48
- ]).annotate({ identifier: "VoiceTransport" })
49
-
50
- export const VoiceGroup = HttpApiGroup.make("server.voice")
51
- .add(
52
- HttpApiEndpoint.get("voice.models", "/api/experimental/voice/models", {
53
- success: Schema.Struct({
54
- data: Schema.Struct({
55
- models: Schema.Array(VoiceModel),
56
- default: Schema.optional(Schema.String),
57
- }),
58
- }).annotate({ identifier: "VoiceModelsResponse" }),
59
- error: [ServiceUnavailableError, LocationNotFoundError],
60
- }).annotateMerge(
61
- OpenApi.annotations({
62
- identifier: "experimental.voice.models",
63
- summary: "List voice models",
64
- description:
65
- "List supported voice models, their transports, and whether the server has a usable API key for each provider.",
66
- }),
67
- ),
68
- )
69
- .add(
70
- HttpApiEndpoint.post("voice.session", "/api/experimental/voice/session", {
71
- payload: Schema.Struct({
72
- model: Schema.String,
73
- session: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
74
- transport: VoiceTransportInput,
75
- }),
76
- success: Schema.Struct({
77
- data: Schema.Struct({
78
- transport: VoiceTransport,
79
- }),
80
- }).annotate({ identifier: "VoiceSessionResponse" }),
81
- error: [InvalidRequestError, ServiceUnavailableError, LocationNotFoundError],
82
- }).annotateMerge(
83
- OpenApi.annotations({
84
- identifier: "experimental.voice.session",
85
- summary: "Create voice session",
86
- description:
87
- "Create a server-brokered voice session using the server's configured provider credentials and return the WebRTC SDP answer or WebSocket ephemeral token.",
88
- }),
89
- ),
90
- )
91
- .annotateMerge(
92
- OpenApi.annotations({
93
- title: "voice",
94
- description: "Experimental server-brokered voice session routes.",
95
- }),
96
- )
1
+ import { Schema } from "effect"
2
+ import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api"
3
+ import { InvalidRequestError, LocationNotFoundError, ServiceUnavailableError } from "../errors.js"
4
+
5
+ export const VoiceTransportType = Schema.Literals(["webrtc", "websocket"]).annotate({
6
+ identifier: "VoiceTransportType",
7
+ })
8
+
9
+ export const VoiceModel = Schema.Struct({
10
+ model: Schema.String,
11
+ name: Schema.String,
12
+ engine: Schema.String,
13
+ provider: Schema.String,
14
+ transports: Schema.Array(VoiceTransportType),
15
+ available: Schema.Boolean,
16
+ }).annotate({ identifier: "VoiceModel" })
17
+
18
+ export const VoiceWebRTCTransportInput = Schema.Struct({
19
+ type: Schema.Literal("webrtc"),
20
+ sdp: Schema.String,
21
+ dcid: Schema.optional(Schema.Number),
22
+ }).annotate({ identifier: "VoiceWebRTCTransportInput" })
23
+
24
+ export const VoiceWebSocketTransportInput = Schema.Struct({
25
+ type: Schema.Literal("websocket"),
26
+ }).annotate({ identifier: "VoiceWebSocketTransportInput" })
27
+
28
+ export const VoiceTransportInput = Schema.Union([
29
+ VoiceWebRTCTransportInput,
30
+ VoiceWebSocketTransportInput,
31
+ ]).annotate({ identifier: "VoiceTransportInput" })
32
+
33
+ export const VoiceWebRTCTransport = Schema.Struct({
34
+ type: Schema.Literal("webrtc"),
35
+ sdp: Schema.String,
36
+ }).annotate({ identifier: "VoiceWebRTCTransport" })
37
+
38
+ export const VoiceWebSocketTransport = Schema.Struct({
39
+ type: Schema.Literal("websocket"),
40
+ url: Schema.String,
41
+ token: Schema.String,
42
+ expiresAt: Schema.Number,
43
+ }).annotate({ identifier: "VoiceWebSocketTransport" })
44
+
45
+ export const VoiceTransport = Schema.Union([
46
+ VoiceWebRTCTransport,
47
+ VoiceWebSocketTransport,
48
+ ]).annotate({ identifier: "VoiceTransport" })
49
+
50
+ export const VoiceGroup = HttpApiGroup.make("server.voice")
51
+ .add(
52
+ HttpApiEndpoint.get("voice.models", "/api/experimental/voice/models", {
53
+ success: Schema.Struct({
54
+ data: Schema.Struct({
55
+ models: Schema.Array(VoiceModel),
56
+ default: Schema.optional(Schema.String),
57
+ }),
58
+ }).annotate({ identifier: "VoiceModelsResponse" }),
59
+ error: [ServiceUnavailableError, LocationNotFoundError],
60
+ }).annotateMerge(
61
+ OpenApi.annotations({
62
+ identifier: "experimental.voice.models",
63
+ summary: "List voice models",
64
+ description:
65
+ "List supported voice models, their transports, and whether the server has a usable API key for each provider.",
66
+ }),
67
+ ),
68
+ )
69
+ .add(
70
+ HttpApiEndpoint.post("voice.session", "/api/experimental/voice/session", {
71
+ payload: Schema.Struct({
72
+ model: Schema.String,
73
+ session: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
74
+ transport: VoiceTransportInput,
75
+ }),
76
+ success: Schema.Struct({
77
+ data: Schema.Struct({
78
+ transport: VoiceTransport,
79
+ }),
80
+ }).annotate({ identifier: "VoiceSessionResponse" }),
81
+ error: [InvalidRequestError, ServiceUnavailableError, LocationNotFoundError],
82
+ }).annotateMerge(
83
+ OpenApi.annotations({
84
+ identifier: "experimental.voice.session",
85
+ summary: "Create voice session",
86
+ description:
87
+ "Create a server-brokered voice session using the server's configured provider credentials and return the WebRTC SDP answer or WebSocket ephemeral token.",
88
+ }),
89
+ ),
90
+ )
91
+ .annotateMerge(
92
+ OpenApi.annotations({
93
+ title: "voice",
94
+ description: "Experimental server-brokered voice session routes.",
95
+ }),
96
+ )
@@ -1,46 +1,46 @@
1
- import { Location } from "@zyro-sec/schema/location"
2
- import { WebSearch } from "@zyro-sec/schema/websearch"
3
- import { Schema } from "effect"
4
- import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api"
5
- import { InvalidRequestError, ServiceUnavailableError } from "../errors.js"
6
- import { LocationQuery, locationQueryOpenApi } from "./location.js"
7
-
8
- export const WebSearchGroup = HttpApiGroup.make("server.websearch")
9
- .add(
10
- HttpApiEndpoint.get("websearch.providers", "/api/websearch/provider", {
11
- query: LocationQuery,
12
- success: Location.response(Schema.Array(WebSearch.Provider)),
13
- error: ServiceUnavailableError,
14
- })
15
- .annotateMerge(locationQueryOpenApi)
16
- .annotateMerge(
17
- OpenApi.annotations({
18
- identifier: "websearch.providers",
19
- summary: "List web search providers",
20
- description: "Return the registered web search providers.",
21
- }),
22
- ),
23
- )
24
- .add(
25
- HttpApiEndpoint.post("websearch.query", "/api/websearch", {
26
- query: LocationQuery,
27
- payload: Schema.Struct(WebSearch.Input.fields),
28
- success: Location.response(WebSearch.Response),
29
- error: [InvalidRequestError, ServiceUnavailableError],
30
- })
31
- .annotateMerge(locationQueryOpenApi)
32
- .annotateMerge(
33
- OpenApi.annotations({
34
- identifier: "websearch.query",
35
- summary: "Search the web",
36
- description:
37
- "Run one web search through the selected provider. Specify a provider to override the configured default.",
38
- }),
39
- ),
40
- )
41
- .annotateMerge(
42
- OpenApi.annotations({
43
- title: "websearch",
44
- description: "Location-scoped web search routes.",
45
- }),
46
- )
1
+ import { Location } from "@zyro-sec/schema/location"
2
+ import { WebSearch } from "@zyro-sec/schema/websearch"
3
+ import { Schema } from "effect"
4
+ import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api"
5
+ import { InvalidRequestError, ServiceUnavailableError } from "../errors.js"
6
+ import { LocationQuery, locationQueryOpenApi } from "./location.js"
7
+
8
+ export const WebSearchGroup = HttpApiGroup.make("server.websearch")
9
+ .add(
10
+ HttpApiEndpoint.get("websearch.providers", "/api/websearch/provider", {
11
+ query: LocationQuery,
12
+ success: Location.response(Schema.Array(WebSearch.Provider)),
13
+ error: ServiceUnavailableError,
14
+ })
15
+ .annotateMerge(locationQueryOpenApi)
16
+ .annotateMerge(
17
+ OpenApi.annotations({
18
+ identifier: "websearch.providers",
19
+ summary: "List web search providers",
20
+ description: "Return the registered web search providers.",
21
+ }),
22
+ ),
23
+ )
24
+ .add(
25
+ HttpApiEndpoint.post("websearch.query", "/api/websearch", {
26
+ query: LocationQuery,
27
+ payload: Schema.Struct(WebSearch.Input.fields),
28
+ success: Location.response(WebSearch.Response),
29
+ error: [InvalidRequestError, ServiceUnavailableError],
30
+ })
31
+ .annotateMerge(locationQueryOpenApi)
32
+ .annotateMerge(
33
+ OpenApi.annotations({
34
+ identifier: "websearch.query",
35
+ summary: "Search the web",
36
+ description:
37
+ "Run one web search through the selected provider. Specify a provider to override the configured default.",
38
+ }),
39
+ ),
40
+ )
41
+ .annotateMerge(
42
+ OpenApi.annotations({
43
+ title: "websearch",
44
+ description: "Location-scoped web search routes.",
45
+ }),
46
+ )
@@ -1,78 +1,78 @@
1
- import { Worktree } from "@zyro-sec/schema/worktree"
2
- import { Schema } from "effect"
3
- import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api"
4
- import { Project } from "@zyro-sec/schema/project"
5
- import { ProjectNotFoundError } from "../errors.js"
6
-
7
- const root = "/api/worktree"
8
-
9
- export class WorktreeError extends Schema.TaggedError<WorktreeError>()(
10
- "WorktreeError",
11
- {
12
- name: Schema.Literal("WorktreeError"),
13
- data: Schema.Struct({
14
- message: Schema.String,
15
- forceRequired: Schema.optional(Schema.Boolean),
16
- }),
17
- },
18
- { httpApiStatus: 400 },
19
- ) {}
20
-
21
- export const WorktreeGroup = HttpApiGroup.make("server.worktree")
22
- .add(
23
- HttpApiEndpoint.get("worktree.list", root, {
24
- query: Schema.Struct({ projectID: Project.ID }),
25
- success: Worktree.List,
26
- error: ProjectNotFoundError,
27
- }).annotateMerge(
28
- OpenApi.annotations({
29
- identifier: "worktree.list",
30
- summary: "List worktrees",
31
- description:
32
- "Return the project's saved worktree inventory without loading configuration or running discovery.",
33
- }),
34
- ),
35
- )
36
- .add(
37
- HttpApiEndpoint.post("worktree.create", root, {
38
- payload: Worktree.CreateInput,
39
- success: Worktree.Info,
40
- error: [WorktreeError, ProjectNotFoundError],
41
- }).annotateMerge(
42
- OpenApi.annotations({
43
- identifier: "worktree.create",
44
- summary: "Create worktree",
45
- description:
46
- "Load the project's canonical configuration, create a local worktree using its selected strategy, then run the project's setup script.",
47
- }),
48
- ),
49
- )
50
- .add(
51
- HttpApiEndpoint.delete("worktree.remove", root, {
52
- payload: Worktree.RemoveInput,
53
- success: HttpApiSchema.NoContent,
54
- error: [WorktreeError, ProjectNotFoundError],
55
- }).annotateMerge(
56
- OpenApi.annotations({
57
- identifier: "worktree.remove",
58
- summary: "Remove worktree",
59
- description:
60
- "Load the project's canonical configuration and remove a saved worktree using its recorded strategy.",
61
- }),
62
- ),
63
- )
64
- .add(
65
- HttpApiEndpoint.post("worktree.refresh", `${root}/refresh`, {
66
- payload: Schema.Struct({ projectID: Project.ID }),
67
- success: HttpApiSchema.NoContent,
68
- error: [WorktreeError, ProjectNotFoundError],
69
- }).annotateMerge(
70
- OpenApi.annotations({
71
- identifier: "worktree.refresh",
72
- summary: "Refresh worktrees",
73
- description:
74
- "Load the project's canonical configuration, discover worktrees across known checkout roots using all available strategies, and reconcile saved state.",
75
- }),
76
- ),
77
- )
78
- .annotateMerge(OpenApi.annotations({ title: "worktree", description: "Project-based worktree management routes." }))
1
+ import { Worktree } from "@zyro-sec/schema/worktree"
2
+ import { Schema } from "effect"
3
+ import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api"
4
+ import { Project } from "@zyro-sec/schema/project"
5
+ import { ProjectNotFoundError } from "../errors.js"
6
+
7
+ const root = "/api/worktree"
8
+
9
+ export class WorktreeError extends Schema.TaggedError<WorktreeError>()(
10
+ "WorktreeError",
11
+ {
12
+ name: Schema.Literal("WorktreeError"),
13
+ data: Schema.Struct({
14
+ message: Schema.String,
15
+ forceRequired: Schema.optional(Schema.Boolean),
16
+ }),
17
+ },
18
+ { httpApiStatus: 400 },
19
+ ) {}
20
+
21
+ export const WorktreeGroup = HttpApiGroup.make("server.worktree")
22
+ .add(
23
+ HttpApiEndpoint.get("worktree.list", root, {
24
+ query: Schema.Struct({ projectID: Project.ID }),
25
+ success: Worktree.List,
26
+ error: ProjectNotFoundError,
27
+ }).annotateMerge(
28
+ OpenApi.annotations({
29
+ identifier: "worktree.list",
30
+ summary: "List worktrees",
31
+ description:
32
+ "Return the project's saved worktree inventory without loading configuration or running discovery.",
33
+ }),
34
+ ),
35
+ )
36
+ .add(
37
+ HttpApiEndpoint.post("worktree.create", root, {
38
+ payload: Worktree.CreateInput,
39
+ success: Worktree.Info,
40
+ error: [WorktreeError, ProjectNotFoundError],
41
+ }).annotateMerge(
42
+ OpenApi.annotations({
43
+ identifier: "worktree.create",
44
+ summary: "Create worktree",
45
+ description:
46
+ "Load the project's canonical configuration, create a local worktree using its selected strategy, then run the project's setup script.",
47
+ }),
48
+ ),
49
+ )
50
+ .add(
51
+ HttpApiEndpoint.delete("worktree.remove", root, {
52
+ payload: Worktree.RemoveInput,
53
+ success: HttpApiSchema.NoContent,
54
+ error: [WorktreeError, ProjectNotFoundError],
55
+ }).annotateMerge(
56
+ OpenApi.annotations({
57
+ identifier: "worktree.remove",
58
+ summary: "Remove worktree",
59
+ description:
60
+ "Load the project's canonical configuration and remove a saved worktree using its recorded strategy.",
61
+ }),
62
+ ),
63
+ )
64
+ .add(
65
+ HttpApiEndpoint.post("worktree.refresh", `${root}/refresh`, {
66
+ payload: Schema.Struct({ projectID: Project.ID }),
67
+ success: HttpApiSchema.NoContent,
68
+ error: [WorktreeError, ProjectNotFoundError],
69
+ }).annotateMerge(
70
+ OpenApi.annotations({
71
+ identifier: "worktree.refresh",
72
+ summary: "Refresh worktrees",
73
+ description:
74
+ "Load the project's canonical configuration, discover worktrees across known checkout roots using all available strategies, and reconcile saved state.",
75
+ }),
76
+ ),
77
+ )
78
+ .annotateMerge(OpenApi.annotations({ title: "worktree", description: "Project-based worktree management routes." }))
@@ -1,6 +1,6 @@
1
- import { HttpApiMiddleware } from "effect/http-api"
2
- import { UnauthorizedError } from "../errors.js"
3
-
4
- export class Authorization extends HttpApiMiddleware.Service<Authorization>()("@zyro-sec/HttpApiAuthorization", {
5
- error: UnauthorizedError,
6
- }) {}
1
+ import { HttpApiMiddleware } from "effect/http-api"
2
+ import { UnauthorizedError } from "../errors.js"
3
+
4
+ export class Authorization extends HttpApiMiddleware.Service<Authorization>()("@zyro-sec/HttpApiAuthorization", {
5
+ error: UnauthorizedError,
6
+ }) {}
@@ -1,7 +1,7 @@
1
- import { HttpApiMiddleware } from "effect/http-api"
2
- import { InvalidRequestError } from "../errors.js"
3
-
4
- export class SchemaErrorMiddleware extends HttpApiMiddleware.Service<SchemaErrorMiddleware>()(
5
- "@zyro-sec/HttpApiSchemaError",
6
- { error: InvalidRequestError },
7
- ) {}
1
+ import { HttpApiMiddleware } from "effect/http-api"
2
+ import { InvalidRequestError } from "../errors.js"
3
+
4
+ export class SchemaErrorMiddleware extends HttpApiMiddleware.Service<SchemaErrorMiddleware>()(
5
+ "@zyro-sec/HttpApiSchemaError",
6
+ { error: InvalidRequestError },
7
+ ) {}