@zyro-sec/schema 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 (136) hide show
  1. package/AGENTS.md +95 -95
  2. package/package.json +5 -1
  3. package/script/build.ts +9 -9
  4. package/script/config-schema.ts +86 -86
  5. package/script/config-v1.json +1311 -1311
  6. package/script/pack.ts +5 -5
  7. package/src/agent.ts +68 -68
  8. package/src/artifact.ts +81 -81
  9. package/src/automation.ts +224 -224
  10. package/src/blob-store.ts +25 -25
  11. package/src/command.ts +18 -18
  12. package/src/config/agent.ts +26 -26
  13. package/src/config/command.ts +14 -14
  14. package/src/config/compaction.ts +27 -27
  15. package/src/config/experimental.ts +72 -72
  16. package/src/config/flag.ts +39 -39
  17. package/src/config/formatter.ts +13 -13
  18. package/src/config/lsp.ts +19 -19
  19. package/src/config/mcp.ts +22 -22
  20. package/src/config/media.ts +15 -15
  21. package/src/config/model.ts +37 -37
  22. package/src/config/plugin.ts +14 -14
  23. package/src/config/policy.ts +57 -57
  24. package/src/config/provider.ts +122 -122
  25. package/src/config/reference.ts +23 -23
  26. package/src/config/shell.ts +10 -10
  27. package/src/config/tool-output.ts +9 -9
  28. package/src/config/warming.ts +21 -21
  29. package/src/config/watcher.ts +8 -8
  30. package/src/config/websearch.ts +17 -17
  31. package/src/config/worktree.ts +10 -10
  32. package/src/config.ts +149 -149
  33. package/src/connection.ts +38 -38
  34. package/src/credential-legacy.ts +29 -29
  35. package/src/credential.ts +78 -78
  36. package/src/durable-event-manifest.ts +7 -7
  37. package/src/event-log.ts +21 -21
  38. package/src/event-manifest.ts +108 -108
  39. package/src/event.ts +205 -205
  40. package/src/file-diff.ts +25 -25
  41. package/src/filesystem-v1.ts +1 -1
  42. package/src/filesystem.ts +48 -48
  43. package/src/form.ts +177 -177
  44. package/src/generate.ts +292 -292
  45. package/src/goal.ts +46 -46
  46. package/src/identifier.ts +32 -32
  47. package/src/index.ts +51 -51
  48. package/src/installation-event.ts +20 -20
  49. package/src/instruction-entry.ts +40 -40
  50. package/src/instruction.ts +25 -25
  51. package/src/integration-id.ts +13 -13
  52. package/src/integration.ts +129 -129
  53. package/src/job.ts +79 -79
  54. package/src/legacy-event.ts +1 -1
  55. package/src/llm.ts +6 -6
  56. package/src/location-event.ts +8 -8
  57. package/src/location.ts +36 -36
  58. package/src/lsp-event.ts +7 -7
  59. package/src/mcp-event.ts +63 -63
  60. package/src/mcp.ts +171 -171
  61. package/src/model-compatibility.ts +55 -55
  62. package/src/model.ts +176 -176
  63. package/src/models-dev.ts +9 -9
  64. package/src/money.ts +18 -18
  65. package/src/permission-saved.ts +25 -25
  66. package/src/permission-v1.ts +1 -1
  67. package/src/permission.ts +67 -67
  68. package/src/persistent-pty.ts +73 -73
  69. package/src/plugin.ts +62 -62
  70. package/src/project-id.ts +9 -9
  71. package/src/project.ts +62 -62
  72. package/src/prompt-input.ts +33 -33
  73. package/src/prompt.ts +117 -117
  74. package/src/provider.ts +136 -136
  75. package/src/pty-ticket.ts +10 -10
  76. package/src/pty.ts +61 -61
  77. package/src/push.ts +86 -86
  78. package/src/question.ts +22 -22
  79. package/src/reference.ts +40 -40
  80. package/src/rpc.ts +167 -167
  81. package/src/schema.ts +41 -41
  82. package/src/server-event.ts +8 -8
  83. package/src/session-error.ts +14 -14
  84. package/src/session-event.ts +739 -739
  85. package/src/session-fork.ts +10 -10
  86. package/src/session-id.ts +12 -12
  87. package/src/session-inbox.ts +102 -102
  88. package/src/session-legacy.ts +117 -117
  89. package/src/session-message.ts +352 -352
  90. package/src/session-metadata.ts +11 -11
  91. package/src/session-revert.ts +86 -86
  92. package/src/session-stats.ts +68 -68
  93. package/src/session-status-event.ts +53 -53
  94. package/src/session-transfer.ts +11 -11
  95. package/src/session-v1.ts +1 -1
  96. package/src/session.ts +147 -147
  97. package/src/shell.ts +90 -90
  98. package/src/skill.ts +68 -68
  99. package/src/snapshot.ts +6 -6
  100. package/src/token-usage.ts +18 -18
  101. package/src/tool.ts +143 -143
  102. package/src/tui-event.ts +59 -59
  103. package/src/usage-limits.ts +76 -76
  104. package/src/v1/filesystem.ts +11 -11
  105. package/src/v1/legacy-event.ts +18 -18
  106. package/src/v1/permission.ts +66 -66
  107. package/src/v1/session.ts +667 -667
  108. package/src/vcs-event.ts +14 -14
  109. package/src/vcs.ts +41 -41
  110. package/src/websearch.ts +44 -44
  111. package/src/workspace-event.ts +32 -32
  112. package/src/workspace-id.ts +19 -19
  113. package/src/workspace.ts +20 -20
  114. package/src/worktree-event.ts +22 -22
  115. package/src/worktree.ts +109 -109
  116. package/tsconfig.build.json +11 -11
  117. package/tsconfig.json +14 -14
  118. package/test/agent.test.ts +0 -10
  119. package/test/automation.test.ts +0 -48
  120. package/test/compatibility.test.ts +0 -10
  121. package/test/config.test.ts +0 -194
  122. package/test/contract-hygiene.test.ts +0 -352
  123. package/test/credential-legacy.test.ts +0 -55
  124. package/test/event-manifest.test.ts +0 -228
  125. package/test/event.test.ts +0 -52
  126. package/test/legacy-event.test.ts +0 -46
  127. package/test/mcp.test.ts +0 -37
  128. package/test/model.test.ts +0 -104
  129. package/test/session-cursor.test.ts +0 -16
  130. package/test/session-error.test.ts +0 -51
  131. package/test/session-legacy.test.ts +0 -178
  132. package/test/session-terminal.test.ts +0 -50
  133. package/test/token-usage.test.ts +0 -18
  134. package/test/v1-isolation.test.ts +0 -26
  135. package/test/vcs.test.ts +0 -23
  136. package/test/worktree.test.ts +0 -45
@@ -1,129 +1,129 @@
1
- export * as Integration from "./integration.js"
2
-
3
- import { Schema } from "effect"
4
- import { optional } from "./schema.js"
5
- import { ephemeral, inventory } from "./event.js"
6
- import { Connection } from "./connection.js"
7
- import { ascending } from "./identifier.js"
8
- import { statics } from "./schema.js"
9
- import { IntegrationID, IntegrationMethodID } from "./integration-id.js"
10
- import { Form } from "./form.js"
11
-
12
- export const ID = IntegrationID
13
- export type ID = typeof ID.Type
14
-
15
- export const MethodID = IntegrationMethodID
16
- export type MethodID = typeof MethodID.Type
17
-
18
- export interface OAuthMethod extends Schema.Schema.Type<typeof OAuthMethod> {}
19
- export const OAuthMethod = Schema.Struct({
20
- id: MethodID,
21
- type: Schema.Literal("oauth"),
22
- label: Schema.String,
23
- form: optional(Form.Fields),
24
- }).annotate({ identifier: "Integration.OAuthMethod" })
25
-
26
- export interface CommandMethod extends Schema.Schema.Type<typeof CommandMethod> {}
27
- export const CommandMethod = Schema.Struct({
28
- id: MethodID,
29
- type: Schema.Literal("command"),
30
- label: Schema.String,
31
- command: Schema.Array(Schema.String),
32
- }).annotate({ identifier: "Integration.CommandMethod" })
33
-
34
- export interface KeyMethod extends Schema.Schema.Type<typeof KeyMethod> {}
35
- export const KeyMethod = Schema.Struct({
36
- type: Schema.Literal("key"),
37
- label: optional(Schema.String),
38
- form: optional(Form.Fields),
39
- }).annotate({ identifier: "Integration.KeyMethod" })
40
-
41
- /** Saves a reference to credentials managed outside opencode, configured by the form answers. */
42
- export interface ExternalMethod extends Schema.Schema.Type<typeof ExternalMethod> {}
43
- export const ExternalMethod = Schema.Struct({
44
- id: MethodID,
45
- type: Schema.Literal("external"),
46
- label: Schema.String,
47
- form: optional(Form.Fields),
48
- }).annotate({ identifier: "Integration.ExternalMethod" })
49
-
50
- export interface EnvMethod extends Schema.Schema.Type<typeof EnvMethod> {}
51
- export const EnvMethod = Schema.Struct({
52
- type: Schema.Literal("env"),
53
- names: Schema.Array(Schema.String),
54
- }).annotate({ identifier: "Integration.EnvMethod" })
55
-
56
- export const Method = Schema.Union([OAuthMethod, CommandMethod, KeyMethod, ExternalMethod, EnvMethod])
57
- .pipe(Schema.toTaggedUnion("type"))
58
- .annotate({ identifier: "Integration.Method" })
59
- export type Method = typeof Method.Type
60
-
61
- const Updated = ephemeral({
62
- type: "integration.updated",
63
- schema: {},
64
- })
65
- export const Event = { Updated, Definitions: inventory(Updated) }
66
-
67
- export interface Ref extends Schema.Schema.Type<typeof Ref> {}
68
- export const Ref = Schema.Struct({
69
- id: ID,
70
- name: Schema.String,
71
- metadata: optional(Schema.Record(Schema.String, Schema.Any)),
72
- }).annotate({ identifier: "Integration.Ref" })
73
-
74
- export const Info = Schema.Struct({
75
- id: ID,
76
- name: Schema.String,
77
- metadata: optional(Schema.Record(Schema.String, Schema.Any)),
78
- methods: Schema.Array(Method),
79
- connections: Schema.Array(Connection.Info),
80
- }).annotate({ identifier: "Integration.Info" })
81
- export interface Info extends Schema.Schema.Type<typeof Info> {}
82
-
83
- export const AttemptID = Schema.String.pipe(
84
- Schema.brand("Integration.AttemptID"),
85
- Schema.annotate({ identifier: "Integration.AttemptID" }),
86
- statics((schema) => ({ create: () => schema.make("con_" + ascending()) })),
87
- )
88
- export type AttemptID = typeof AttemptID.Type
89
-
90
- const AttemptTime = Schema.Struct({
91
- created: Schema.Number,
92
- expires: Schema.Number,
93
- })
94
-
95
- export class Attempt extends Schema.Class<Attempt>("Integration.Attempt")({
96
- attemptID: AttemptID,
97
- url: Schema.String,
98
- instructions: Schema.String,
99
- mode: Schema.Literals(["auto", "code"]),
100
- /** An `auto` attempt also accepts the redirect URL pasted from the browser as its `code`. */
101
- paste: Schema.optionalKey(Schema.Literal(true)),
102
- time: AttemptTime,
103
- }) {}
104
-
105
- export const AttemptStatus = Schema.Union([
106
- Schema.Struct({ status: Schema.Literal("pending"), time: AttemptTime }),
107
- Schema.Struct({ status: Schema.Literal("complete"), time: AttemptTime }),
108
- Schema.Struct({ status: Schema.Literal("failed"), message: Schema.String, time: AttemptTime }),
109
- Schema.Struct({ status: Schema.Literal("expired"), time: AttemptTime }),
110
- ])
111
- .pipe(Schema.toTaggedUnion("status"))
112
- .annotate({ identifier: "Integration.AttemptStatus" })
113
- export type AttemptStatus = typeof AttemptStatus.Type
114
-
115
- export interface CommandAttempt extends Schema.Schema.Type<typeof CommandAttempt> {}
116
- export const CommandAttempt = Schema.Struct({
117
- attemptID: AttemptID,
118
- time: AttemptTime,
119
- }).annotate({ identifier: "Integration.CommandAttempt" })
120
-
121
- export const CommandAttemptStatus = Schema.Union([
122
- Schema.Struct({ status: Schema.Literal("pending"), message: optional(Schema.String), time: AttemptTime }),
123
- Schema.Struct({ status: Schema.Literal("complete"), time: AttemptTime }),
124
- Schema.Struct({ status: Schema.Literal("failed"), message: Schema.String, time: AttemptTime }),
125
- Schema.Struct({ status: Schema.Literal("expired"), time: AttemptTime }),
126
- ])
127
- .pipe(Schema.toTaggedUnion("status"))
128
- .annotate({ identifier: "Integration.CommandAttemptStatus" })
129
- export type CommandAttemptStatus = typeof CommandAttemptStatus.Type
1
+ export * as Integration from "./integration.js"
2
+
3
+ import { Schema } from "effect"
4
+ import { optional } from "./schema.js"
5
+ import { ephemeral, inventory } from "./event.js"
6
+ import { Connection } from "./connection.js"
7
+ import { ascending } from "./identifier.js"
8
+ import { statics } from "./schema.js"
9
+ import { IntegrationID, IntegrationMethodID } from "./integration-id.js"
10
+ import { Form } from "./form.js"
11
+
12
+ export const ID = IntegrationID
13
+ export type ID = typeof ID.Type
14
+
15
+ export const MethodID = IntegrationMethodID
16
+ export type MethodID = typeof MethodID.Type
17
+
18
+ export interface OAuthMethod extends Schema.Schema.Type<typeof OAuthMethod> {}
19
+ export const OAuthMethod = Schema.Struct({
20
+ id: MethodID,
21
+ type: Schema.Literal("oauth"),
22
+ label: Schema.String,
23
+ form: optional(Form.Fields),
24
+ }).annotate({ identifier: "Integration.OAuthMethod" })
25
+
26
+ export interface CommandMethod extends Schema.Schema.Type<typeof CommandMethod> {}
27
+ export const CommandMethod = Schema.Struct({
28
+ id: MethodID,
29
+ type: Schema.Literal("command"),
30
+ label: Schema.String,
31
+ command: Schema.Array(Schema.String),
32
+ }).annotate({ identifier: "Integration.CommandMethod" })
33
+
34
+ export interface KeyMethod extends Schema.Schema.Type<typeof KeyMethod> {}
35
+ export const KeyMethod = Schema.Struct({
36
+ type: Schema.Literal("key"),
37
+ label: optional(Schema.String),
38
+ form: optional(Form.Fields),
39
+ }).annotate({ identifier: "Integration.KeyMethod" })
40
+
41
+ /** Saves a reference to credentials managed outside opencode, configured by the form answers. */
42
+ export interface ExternalMethod extends Schema.Schema.Type<typeof ExternalMethod> {}
43
+ export const ExternalMethod = Schema.Struct({
44
+ id: MethodID,
45
+ type: Schema.Literal("external"),
46
+ label: Schema.String,
47
+ form: optional(Form.Fields),
48
+ }).annotate({ identifier: "Integration.ExternalMethod" })
49
+
50
+ export interface EnvMethod extends Schema.Schema.Type<typeof EnvMethod> {}
51
+ export const EnvMethod = Schema.Struct({
52
+ type: Schema.Literal("env"),
53
+ names: Schema.Array(Schema.String),
54
+ }).annotate({ identifier: "Integration.EnvMethod" })
55
+
56
+ export const Method = Schema.Union([OAuthMethod, CommandMethod, KeyMethod, ExternalMethod, EnvMethod])
57
+ .pipe(Schema.toTaggedUnion("type"))
58
+ .annotate({ identifier: "Integration.Method" })
59
+ export type Method = typeof Method.Type
60
+
61
+ const Updated = ephemeral({
62
+ type: "integration.updated",
63
+ schema: {},
64
+ })
65
+ export const Event = { Updated, Definitions: inventory(Updated) }
66
+
67
+ export interface Ref extends Schema.Schema.Type<typeof Ref> {}
68
+ export const Ref = Schema.Struct({
69
+ id: ID,
70
+ name: Schema.String,
71
+ metadata: optional(Schema.Record(Schema.String, Schema.Any)),
72
+ }).annotate({ identifier: "Integration.Ref" })
73
+
74
+ export const Info = Schema.Struct({
75
+ id: ID,
76
+ name: Schema.String,
77
+ metadata: optional(Schema.Record(Schema.String, Schema.Any)),
78
+ methods: Schema.Array(Method),
79
+ connections: Schema.Array(Connection.Info),
80
+ }).annotate({ identifier: "Integration.Info" })
81
+ export interface Info extends Schema.Schema.Type<typeof Info> {}
82
+
83
+ export const AttemptID = Schema.String.pipe(
84
+ Schema.brand("Integration.AttemptID"),
85
+ Schema.annotate({ identifier: "Integration.AttemptID" }),
86
+ statics((schema) => ({ create: () => schema.make("con_" + ascending()) })),
87
+ )
88
+ export type AttemptID = typeof AttemptID.Type
89
+
90
+ const AttemptTime = Schema.Struct({
91
+ created: Schema.Number,
92
+ expires: Schema.Number,
93
+ })
94
+
95
+ export class Attempt extends Schema.Class<Attempt>("Integration.Attempt")({
96
+ attemptID: AttemptID,
97
+ url: Schema.String,
98
+ instructions: Schema.String,
99
+ mode: Schema.Literals(["auto", "code"]),
100
+ /** An `auto` attempt also accepts the redirect URL pasted from the browser as its `code`. */
101
+ paste: Schema.optionalKey(Schema.Literal(true)),
102
+ time: AttemptTime,
103
+ }) {}
104
+
105
+ export const AttemptStatus = Schema.Union([
106
+ Schema.Struct({ status: Schema.Literal("pending"), time: AttemptTime }),
107
+ Schema.Struct({ status: Schema.Literal("complete"), time: AttemptTime }),
108
+ Schema.Struct({ status: Schema.Literal("failed"), message: Schema.String, time: AttemptTime }),
109
+ Schema.Struct({ status: Schema.Literal("expired"), time: AttemptTime }),
110
+ ])
111
+ .pipe(Schema.toTaggedUnion("status"))
112
+ .annotate({ identifier: "Integration.AttemptStatus" })
113
+ export type AttemptStatus = typeof AttemptStatus.Type
114
+
115
+ export interface CommandAttempt extends Schema.Schema.Type<typeof CommandAttempt> {}
116
+ export const CommandAttempt = Schema.Struct({
117
+ attemptID: AttemptID,
118
+ time: AttemptTime,
119
+ }).annotate({ identifier: "Integration.CommandAttempt" })
120
+
121
+ export const CommandAttemptStatus = Schema.Union([
122
+ Schema.Struct({ status: Schema.Literal("pending"), message: optional(Schema.String), time: AttemptTime }),
123
+ Schema.Struct({ status: Schema.Literal("complete"), time: AttemptTime }),
124
+ Schema.Struct({ status: Schema.Literal("failed"), message: Schema.String, time: AttemptTime }),
125
+ Schema.Struct({ status: Schema.Literal("expired"), time: AttemptTime }),
126
+ ])
127
+ .pipe(Schema.toTaggedUnion("status"))
128
+ .annotate({ identifier: "Integration.CommandAttemptStatus" })
129
+ export type CommandAttemptStatus = typeof CommandAttemptStatus.Type
package/src/job.ts CHANGED
@@ -1,79 +1,79 @@
1
- export * as Job from "./job.js"
2
-
3
- import { Schema } from "effect"
4
- import { ephemeral, inventory } from "./event.js"
5
- import { optional } from "./schema.js"
6
- import { SessionID } from "./session-id.js"
7
-
8
- export const Kind = Schema.Literals(["shell", "subagent", "image", "video", "codemode"]).annotate({
9
- identifier: "Job.Kind",
10
- })
11
- export type Kind = typeof Kind.Type
12
-
13
- export const Status = Schema.Literals(["running", "completed", "error", "cancelled"]).annotate({
14
- identifier: "Job.Status",
15
- })
16
- export type Status = typeof Status.Type
17
-
18
- export interface Time extends Schema.Schema.Type<typeof Time> {}
19
- export const Time = Schema.Struct({
20
- started: Schema.Finite.annotate({ description: "Start time in milliseconds since the Unix epoch" }),
21
- completed: optional(Schema.Finite).annotate({
22
- description: "Completion time in milliseconds since the Unix epoch",
23
- }),
24
- }).annotate({ identifier: "Job.Time" })
25
-
26
- const Base = {
27
- id: Schema.String,
28
- sessionID: SessionID,
29
- status: Status,
30
- title: optional(Schema.String),
31
- time: Time,
32
- }
33
-
34
- export interface Shell extends Schema.Schema.Type<typeof Shell> {}
35
- export const Shell = Schema.Struct({
36
- kind: Schema.tag("shell"),
37
- ...Base,
38
- shellID: Schema.String,
39
- command: Schema.String,
40
- }).annotate({ identifier: "Job.Shell" })
41
-
42
- export interface Subagent extends Schema.Schema.Type<typeof Subagent> {}
43
- export const Subagent = Schema.Struct({
44
- kind: Schema.tag("subagent"),
45
- ...Base,
46
- childSessionID: SessionID,
47
- agent: Schema.String,
48
- description: Schema.String,
49
- }).annotate({ identifier: "Job.Subagent" })
50
-
51
- export interface Image extends Schema.Schema.Type<typeof Image> {}
52
- export const Image = Schema.Struct({
53
- kind: Schema.tag("image"),
54
- ...Base,
55
- path: Schema.String,
56
- model: Schema.String,
57
- }).annotate({ identifier: "Job.Image" })
58
-
59
- export interface Video extends Schema.Schema.Type<typeof Video> {}
60
- export const Video = Schema.Struct({
61
- kind: Schema.tag("video"),
62
- ...Base,
63
- path: Schema.String,
64
- }).annotate({ identifier: "Job.Video" })
65
-
66
- export interface CodeMode extends Schema.Schema.Type<typeof CodeMode> {}
67
- export const CodeMode = Schema.Struct({ kind: Schema.tag("codemode"), ...Base }).annotate({
68
- identifier: "Job.CodeMode",
69
- })
70
-
71
- export const Info = Schema.Union([Shell, Subagent, Image, Video, CodeMode]).pipe(
72
- Schema.toTaggedUnion("kind"),
73
- Schema.annotate({ identifier: "Job.Info" }),
74
- )
75
- export type Info = typeof Info.Type
76
-
77
- /** A background job started, moved to the background, or ended. Experimental: may change without compatibility guarantees. */
78
- const Updated = ephemeral({ type: "experimental.job.updated", schema: { info: Info } })
79
- export const Event = { Updated, Definitions: inventory(Updated) }
1
+ export * as Job from "./job.js"
2
+
3
+ import { Schema } from "effect"
4
+ import { ephemeral, inventory } from "./event.js"
5
+ import { optional } from "./schema.js"
6
+ import { SessionID } from "./session-id.js"
7
+
8
+ export const Kind = Schema.Literals(["shell", "subagent", "image", "video", "codemode"]).annotate({
9
+ identifier: "Job.Kind",
10
+ })
11
+ export type Kind = typeof Kind.Type
12
+
13
+ export const Status = Schema.Literals(["running", "completed", "error", "cancelled"]).annotate({
14
+ identifier: "Job.Status",
15
+ })
16
+ export type Status = typeof Status.Type
17
+
18
+ export interface Time extends Schema.Schema.Type<typeof Time> {}
19
+ export const Time = Schema.Struct({
20
+ started: Schema.Finite.annotate({ description: "Start time in milliseconds since the Unix epoch" }),
21
+ completed: optional(Schema.Finite).annotate({
22
+ description: "Completion time in milliseconds since the Unix epoch",
23
+ }),
24
+ }).annotate({ identifier: "Job.Time" })
25
+
26
+ const Base = {
27
+ id: Schema.String,
28
+ sessionID: SessionID,
29
+ status: Status,
30
+ title: optional(Schema.String),
31
+ time: Time,
32
+ }
33
+
34
+ export interface Shell extends Schema.Schema.Type<typeof Shell> {}
35
+ export const Shell = Schema.Struct({
36
+ kind: Schema.tag("shell"),
37
+ ...Base,
38
+ shellID: Schema.String,
39
+ command: Schema.String,
40
+ }).annotate({ identifier: "Job.Shell" })
41
+
42
+ export interface Subagent extends Schema.Schema.Type<typeof Subagent> {}
43
+ export const Subagent = Schema.Struct({
44
+ kind: Schema.tag("subagent"),
45
+ ...Base,
46
+ childSessionID: SessionID,
47
+ agent: Schema.String,
48
+ description: Schema.String,
49
+ }).annotate({ identifier: "Job.Subagent" })
50
+
51
+ export interface Image extends Schema.Schema.Type<typeof Image> {}
52
+ export const Image = Schema.Struct({
53
+ kind: Schema.tag("image"),
54
+ ...Base,
55
+ path: Schema.String,
56
+ model: Schema.String,
57
+ }).annotate({ identifier: "Job.Image" })
58
+
59
+ export interface Video extends Schema.Schema.Type<typeof Video> {}
60
+ export const Video = Schema.Struct({
61
+ kind: Schema.tag("video"),
62
+ ...Base,
63
+ path: Schema.String,
64
+ }).annotate({ identifier: "Job.Video" })
65
+
66
+ export interface CodeMode extends Schema.Schema.Type<typeof CodeMode> {}
67
+ export const CodeMode = Schema.Struct({ kind: Schema.tag("codemode"), ...Base }).annotate({
68
+ identifier: "Job.CodeMode",
69
+ })
70
+
71
+ export const Info = Schema.Union([Shell, Subagent, Image, Video, CodeMode]).pipe(
72
+ Schema.toTaggedUnion("kind"),
73
+ Schema.annotate({ identifier: "Job.Info" }),
74
+ )
75
+ export type Info = typeof Info.Type
76
+
77
+ /** A background job started, moved to the background, or ended. Experimental: may change without compatibility guarantees. */
78
+ const Updated = ephemeral({ type: "experimental.job.updated", schema: { info: Info } })
79
+ export const Event = { Updated, Definitions: inventory(Updated) }
@@ -1 +1 @@
1
- export * from "./v1/legacy-event.js"
1
+ export * from "./v1/legacy-event.js"
package/src/llm.ts CHANGED
@@ -1,6 +1,6 @@
1
- export * as LLM from "./llm.js"
2
-
3
- import { Schema } from "effect"
4
-
5
- export const FinishReason = Schema.Literals(["stop", "length", "tool-calls", "content-filter", "error", "unknown"])
6
- export type FinishReason = typeof FinishReason.Type
1
+ export * as LLM from "./llm.js"
2
+
3
+ import { Schema } from "effect"
4
+
5
+ export const FinishReason = Schema.Literals(["stop", "length", "tool-calls", "content-filter", "error", "unknown"])
6
+ export type FinishReason = typeof FinishReason.Type
@@ -1,8 +1,8 @@
1
- export * as LocationEvent from "./location-event.js"
2
-
3
- import { ephemeral, inventory } from "./event.js"
4
-
5
- /** The location's cached services were shut down; clients must revalidate its reads. */
6
- export const Shutdown = ephemeral({ type: "location.shutdown", schema: {} })
7
-
8
- export const Definitions = inventory(Shutdown)
1
+ export * as LocationEvent from "./location-event.js"
2
+
3
+ import { ephemeral, inventory } from "./event.js"
4
+
5
+ /** The location's cached services were shut down; clients must revalidate its reads. */
6
+ export const Shutdown = ephemeral({ type: "location.shutdown", schema: {} })
7
+
8
+ export const Definitions = inventory(Shutdown)
package/src/location.ts CHANGED
@@ -1,36 +1,36 @@
1
- export * as Location from "./location.js"
2
-
3
- import { Schema, Struct } from "effect"
4
- import { AbsolutePath, optional } from "./schema.js"
5
- import { ProjectID } from "./project-id.js"
6
- import { WorkspaceID } from "./workspace-id.js"
7
-
8
- export interface Ref extends Schema.Schema.Type<typeof Ref> {}
9
- export const Ref = Schema.Struct({
10
- directory: AbsolutePath,
11
- workspaceID: optional(WorkspaceID),
12
- }).annotate({ identifier: "Location.Ref" })
13
-
14
- export const PublicRef = Schema.Struct(Struct.omit(Ref.fields, ["workspaceID"])).annotate({
15
- identifier: "Location.PublicRef",
16
- })
17
- export interface PublicRef extends Schema.Schema.Type<typeof PublicRef> {}
18
-
19
- export class Info extends Schema.Class<Info>("Location.Info")({
20
- directory: AbsolutePath,
21
- workspaceID: optional(WorkspaceID),
22
- project: Schema.Struct({
23
- id: ProjectID,
24
- directory: AbsolutePath,
25
- canonical: AbsolutePath,
26
- }),
27
- }) {}
28
-
29
- export const PublicInfo = Schema.Struct(Struct.omit(Info.fields, ["workspaceID"])).annotate({
30
- identifier: "Location.PublicInfo",
31
- })
32
- export interface PublicInfo extends Schema.Schema.Type<typeof PublicInfo> {}
33
-
34
- export function response<S extends Schema.Top>(data: S) {
35
- return Schema.Struct({ location: PublicRef, data })
36
- }
1
+ export * as Location from "./location.js"
2
+
3
+ import { Schema, Struct } from "effect"
4
+ import { AbsolutePath, optional } from "./schema.js"
5
+ import { ProjectID } from "./project-id.js"
6
+ import { WorkspaceID } from "./workspace-id.js"
7
+
8
+ export interface Ref extends Schema.Schema.Type<typeof Ref> {}
9
+ export const Ref = Schema.Struct({
10
+ directory: AbsolutePath,
11
+ workspaceID: optional(WorkspaceID),
12
+ }).annotate({ identifier: "Location.Ref" })
13
+
14
+ export const PublicRef = Schema.Struct(Struct.omit(Ref.fields, ["workspaceID"])).annotate({
15
+ identifier: "Location.PublicRef",
16
+ })
17
+ export interface PublicRef extends Schema.Schema.Type<typeof PublicRef> {}
18
+
19
+ export class Info extends Schema.Class<Info>("Location.Info")({
20
+ directory: AbsolutePath,
21
+ workspaceID: optional(WorkspaceID),
22
+ project: Schema.Struct({
23
+ id: ProjectID,
24
+ directory: AbsolutePath,
25
+ canonical: AbsolutePath,
26
+ }),
27
+ }) {}
28
+
29
+ export const PublicInfo = Schema.Struct(Struct.omit(Info.fields, ["workspaceID"])).annotate({
30
+ identifier: "Location.PublicInfo",
31
+ })
32
+ export interface PublicInfo extends Schema.Schema.Type<typeof PublicInfo> {}
33
+
34
+ export function response<S extends Schema.Top>(data: S) {
35
+ return Schema.Struct({ location: PublicRef, data })
36
+ }
package/src/lsp-event.ts CHANGED
@@ -1,7 +1,7 @@
1
- export * as LspEvent from "./lsp-event.js"
2
-
3
- import { Event } from "./event.js"
4
-
5
- export const Updated = Event.ephemeral({ type: "lsp.updated", schema: {} })
6
-
7
- export const Definitions = Event.inventory(Updated)
1
+ export * as LspEvent from "./lsp-event.js"
2
+
3
+ import { Event } from "./event.js"
4
+
5
+ export const Updated = Event.ephemeral({ type: "lsp.updated", schema: {} })
6
+
7
+ export const Definitions = Event.inventory(Updated)