@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,73 +1,73 @@
1
- export * as PersistentPty from "./persistent-pty.js"
2
-
3
- import { Schema } from "effect"
4
- import { ephemeral, inventory } from "./event.js"
5
- import { Pty } from "./pty.js"
6
- import { NonNegativeInt, PositiveInt, optional } from "./schema.js"
7
- import { Session } from "./session.js"
8
-
9
- export const Info = Schema.Struct({
10
- ...Pty.Info.fields,
11
- sessionID: Session.ID,
12
- userTitle: Schema.NullOr(Schema.String),
13
- foregroundProcess: Schema.NullOr(Schema.String),
14
- size: Schema.Struct({ cols: PositiveInt, rows: PositiveInt }),
15
- output: Schema.Struct({ head: NonNegativeInt, tail: NonNegativeInt }),
16
- }).annotate({ identifier: "PersistentPty.Info" })
17
- export interface Info extends Schema.Schema.Type<typeof Info> {}
18
-
19
- export const Handoff = Schema.Struct({
20
- directory: Schema.String,
21
- instanceID: Schema.String,
22
- ticket: Schema.String,
23
- expiresAt: Schema.Number,
24
- }).annotate({ identifier: "PersistentPty.Handoff" })
25
- export interface Handoff extends Schema.Schema.Type<typeof Handoff> {}
26
-
27
- export const CreateInput = Schema.Struct({
28
- command: optional(Schema.String),
29
- args: Schema.Array(Schema.String),
30
- cwd: optional(Schema.String),
31
- title: Schema.String,
32
- env: Schema.Record(Schema.String, Schema.String),
33
- size: optional(Schema.Struct({ cols: PositiveInt, rows: PositiveInt })),
34
- }).annotate({ identifier: "PersistentPty.CreateInput" })
35
- export interface CreateInput extends Schema.Schema.Type<typeof CreateInput> {}
36
-
37
- export const UpdateInput = Schema.Struct({
38
- attachmentID: optional(Schema.String),
39
- size: optional(Schema.Struct({ cols: PositiveInt, rows: PositiveInt })),
40
- title: optional(Schema.NullOr(Schema.String)),
41
- }).annotate({ identifier: "PersistentPty.UpdateInput" })
42
- export interface UpdateInput extends Schema.Schema.Type<typeof UpdateInput> {}
43
-
44
- export const Snapshot = Schema.Struct({
45
- info: Info,
46
- text: Schema.String,
47
- checkpoint: Schema.Uint8Array,
48
- cursor: Schema.Struct({ x: NonNegativeInt, y: NonNegativeInt }),
49
- }).annotate({ identifier: "PersistentPty.Snapshot" })
50
- export interface Snapshot extends Schema.Schema.Type<typeof Snapshot> {}
51
-
52
- export const ReadLines = PositiveInt.check(Schema.isLessThanOrEqualTo(65535)).annotate({
53
- identifier: "PersistentPty.ReadLines",
54
- })
55
-
56
- export const ReadResult = Schema.Struct({
57
- ptyID: Pty.ID,
58
- title: Schema.String,
59
- cwd: Schema.String,
60
- foregroundProcess: Schema.NullOr(Schema.String),
61
- screen: Schema.Struct({
62
- text: Schema.String,
63
- cols: PositiveInt,
64
- rows: PositiveInt,
65
- cursor: Snapshot.fields.cursor,
66
- }),
67
- }).annotate({ identifier: "PersistentPty.ReadResult" })
68
- export interface ReadResult extends Schema.Schema.Type<typeof ReadResult> {}
69
-
70
- export const Added = ephemeral({ type: "persistent-pty.added", schema: { sessionID: Session.ID, terminal: Info } })
71
- export const Removed = ephemeral({ type: "persistent-pty.removed", schema: { sessionID: Session.ID, ptyID: Pty.ID } })
72
- export const Updated = ephemeral({ type: "persistent-pty.updated", schema: { sessionID: Session.ID, terminal: Info } })
73
- export const Event = { Added, Removed, Updated, Definitions: inventory(Added, Removed, Updated) }
1
+ export * as PersistentPty from "./persistent-pty.js"
2
+
3
+ import { Schema } from "effect"
4
+ import { ephemeral, inventory } from "./event.js"
5
+ import { Pty } from "./pty.js"
6
+ import { NonNegativeInt, PositiveInt, optional } from "./schema.js"
7
+ import { Session } from "./session.js"
8
+
9
+ export const Info = Schema.Struct({
10
+ ...Pty.Info.fields,
11
+ sessionID: Session.ID,
12
+ userTitle: Schema.NullOr(Schema.String),
13
+ foregroundProcess: Schema.NullOr(Schema.String),
14
+ size: Schema.Struct({ cols: PositiveInt, rows: PositiveInt }),
15
+ output: Schema.Struct({ head: NonNegativeInt, tail: NonNegativeInt }),
16
+ }).annotate({ identifier: "PersistentPty.Info" })
17
+ export interface Info extends Schema.Schema.Type<typeof Info> {}
18
+
19
+ export const Handoff = Schema.Struct({
20
+ directory: Schema.String,
21
+ instanceID: Schema.String,
22
+ ticket: Schema.String,
23
+ expiresAt: Schema.Number,
24
+ }).annotate({ identifier: "PersistentPty.Handoff" })
25
+ export interface Handoff extends Schema.Schema.Type<typeof Handoff> {}
26
+
27
+ export const CreateInput = Schema.Struct({
28
+ command: optional(Schema.String),
29
+ args: Schema.Array(Schema.String),
30
+ cwd: optional(Schema.String),
31
+ title: Schema.String,
32
+ env: Schema.Record(Schema.String, Schema.String),
33
+ size: optional(Schema.Struct({ cols: PositiveInt, rows: PositiveInt })),
34
+ }).annotate({ identifier: "PersistentPty.CreateInput" })
35
+ export interface CreateInput extends Schema.Schema.Type<typeof CreateInput> {}
36
+
37
+ export const UpdateInput = Schema.Struct({
38
+ attachmentID: optional(Schema.String),
39
+ size: optional(Schema.Struct({ cols: PositiveInt, rows: PositiveInt })),
40
+ title: optional(Schema.NullOr(Schema.String)),
41
+ }).annotate({ identifier: "PersistentPty.UpdateInput" })
42
+ export interface UpdateInput extends Schema.Schema.Type<typeof UpdateInput> {}
43
+
44
+ export const Snapshot = Schema.Struct({
45
+ info: Info,
46
+ text: Schema.String,
47
+ checkpoint: Schema.Uint8Array,
48
+ cursor: Schema.Struct({ x: NonNegativeInt, y: NonNegativeInt }),
49
+ }).annotate({ identifier: "PersistentPty.Snapshot" })
50
+ export interface Snapshot extends Schema.Schema.Type<typeof Snapshot> {}
51
+
52
+ export const ReadLines = PositiveInt.check(Schema.isLessThanOrEqualTo(65535)).annotate({
53
+ identifier: "PersistentPty.ReadLines",
54
+ })
55
+
56
+ export const ReadResult = Schema.Struct({
57
+ ptyID: Pty.ID,
58
+ title: Schema.String,
59
+ cwd: Schema.String,
60
+ foregroundProcess: Schema.NullOr(Schema.String),
61
+ screen: Schema.Struct({
62
+ text: Schema.String,
63
+ cols: PositiveInt,
64
+ rows: PositiveInt,
65
+ cursor: Snapshot.fields.cursor,
66
+ }),
67
+ }).annotate({ identifier: "PersistentPty.ReadResult" })
68
+ export interface ReadResult extends Schema.Schema.Type<typeof ReadResult> {}
69
+
70
+ export const Added = ephemeral({ type: "persistent-pty.added", schema: { sessionID: Session.ID, terminal: Info } })
71
+ export const Removed = ephemeral({ type: "persistent-pty.removed", schema: { sessionID: Session.ID, ptyID: Pty.ID } })
72
+ export const Updated = ephemeral({ type: "persistent-pty.updated", schema: { sessionID: Session.ID, terminal: Info } })
73
+ export const Event = { Added, Removed, Updated, Definitions: inventory(Added, Removed, Updated) }
package/src/plugin.ts CHANGED
@@ -1,62 +1,62 @@
1
- export * as Plugin from "./plugin.js"
2
-
3
- import { Schema } from "effect"
4
- import { ephemeral, inventory } from "./event.js"
5
- import { optional } from "./schema.js"
6
-
7
- export const ID = Schema.String.pipe(Schema.brand("Plugin.ID"), Schema.annotate({ identifier: "Plugin.ID" }))
8
- export type ID = typeof ID.Type
9
-
10
- export const Source = Schema.Union([
11
- Schema.Struct({ type: Schema.Literal("builtin") }),
12
- Schema.Struct({
13
- type: Schema.Literal("package"),
14
- target: Schema.String,
15
- version: Schema.String.pipe(optional),
16
- outdated: Schema.Literal(true).pipe(optional),
17
- updating: Schema.Literal(true).pipe(optional),
18
- }),
19
- Schema.Struct({ type: Schema.Literal("local"), path: Schema.String }),
20
- Schema.Struct({ type: Schema.Literal("sdk") }),
21
- ]).annotate({ identifier: "Plugin.Source" })
22
- export type Source = typeof Source.Type
23
-
24
- export const Features = Schema.Struct({
25
- server: Schema.Literal(true).pipe(optional),
26
- tui: Schema.Literal(true).pipe(optional),
27
- rpc: Schema.Literal(true).pipe(optional),
28
- /** The package exports `./gui-experimental`, the GUI bundle the desktop app loads. */
29
- gui: Schema.Literal(true).pipe(optional),
30
- }).annotate({ identifier: "Plugin.Features" })
31
- export type Features = typeof Features.Type
32
-
33
- /** A plugin's prebuilt CommonJS `./gui-experimental` bundle. */
34
- export interface GuiBundle extends Schema.Schema.Type<typeof GuiBundle> {}
35
- export const GuiBundle = Schema.Struct({
36
- /** The bundle's CommonJS code. */
37
- code: Schema.String,
38
- /** An opaque value that changes whenever the plugin, its options or its bundle change. */
39
- revision: Schema.String,
40
- /** The plugin's options from its `opencode.json` entry, as its server entry receives them. */
41
- options: Schema.Record(Schema.String, Schema.Json),
42
- }).annotate({ identifier: "Plugin.GuiBundle" })
43
-
44
- export const State = Schema.Union([
45
- Schema.Struct({ status: Schema.Literal("active") }),
46
- Schema.Struct({ status: Schema.Literal("failed"), error: Schema.String, ref: Schema.String.pipe(optional) }),
47
- ]).annotate({ identifier: "Plugin.State" })
48
- export type State = typeof State.Type
49
-
50
- export interface Info extends Schema.Schema.Type<typeof Info> {}
51
- export const Info = Schema.Struct({
52
- id: ID.pipe(optional),
53
- source: Source,
54
- features: Features,
55
- state: State,
56
- }).annotate({ identifier: "Plugin.Info" })
57
-
58
- const Updated = ephemeral({
59
- type: "plugin.updated",
60
- schema: {},
61
- })
62
- export const Event = { Updated, Definitions: inventory(Updated) }
1
+ export * as Plugin from "./plugin.js"
2
+
3
+ import { Schema } from "effect"
4
+ import { ephemeral, inventory } from "./event.js"
5
+ import { optional } from "./schema.js"
6
+
7
+ export const ID = Schema.String.pipe(Schema.brand("Plugin.ID"), Schema.annotate({ identifier: "Plugin.ID" }))
8
+ export type ID = typeof ID.Type
9
+
10
+ export const Source = Schema.Union([
11
+ Schema.Struct({ type: Schema.Literal("builtin") }),
12
+ Schema.Struct({
13
+ type: Schema.Literal("package"),
14
+ target: Schema.String,
15
+ version: Schema.String.pipe(optional),
16
+ outdated: Schema.Literal(true).pipe(optional),
17
+ updating: Schema.Literal(true).pipe(optional),
18
+ }),
19
+ Schema.Struct({ type: Schema.Literal("local"), path: Schema.String }),
20
+ Schema.Struct({ type: Schema.Literal("sdk") }),
21
+ ]).annotate({ identifier: "Plugin.Source" })
22
+ export type Source = typeof Source.Type
23
+
24
+ export const Features = Schema.Struct({
25
+ server: Schema.Literal(true).pipe(optional),
26
+ tui: Schema.Literal(true).pipe(optional),
27
+ rpc: Schema.Literal(true).pipe(optional),
28
+ /** The package exports `./gui-experimental`, the GUI bundle the desktop app loads. */
29
+ gui: Schema.Literal(true).pipe(optional),
30
+ }).annotate({ identifier: "Plugin.Features" })
31
+ export type Features = typeof Features.Type
32
+
33
+ /** A plugin's prebuilt CommonJS `./gui-experimental` bundle. */
34
+ export interface GuiBundle extends Schema.Schema.Type<typeof GuiBundle> {}
35
+ export const GuiBundle = Schema.Struct({
36
+ /** The bundle's CommonJS code. */
37
+ code: Schema.String,
38
+ /** An opaque value that changes whenever the plugin, its options or its bundle change. */
39
+ revision: Schema.String,
40
+ /** The plugin's options from its `opencode.json` entry, as its server entry receives them. */
41
+ options: Schema.Record(Schema.String, Schema.Json),
42
+ }).annotate({ identifier: "Plugin.GuiBundle" })
43
+
44
+ export const State = Schema.Union([
45
+ Schema.Struct({ status: Schema.Literal("active") }),
46
+ Schema.Struct({ status: Schema.Literal("failed"), error: Schema.String, ref: Schema.String.pipe(optional) }),
47
+ ]).annotate({ identifier: "Plugin.State" })
48
+ export type State = typeof State.Type
49
+
50
+ export interface Info extends Schema.Schema.Type<typeof Info> {}
51
+ export const Info = Schema.Struct({
52
+ id: ID.pipe(optional),
53
+ source: Source,
54
+ features: Features,
55
+ state: State,
56
+ }).annotate({ identifier: "Plugin.Info" })
57
+
58
+ const Updated = ephemeral({
59
+ type: "plugin.updated",
60
+ schema: {},
61
+ })
62
+ export const Event = { Updated, Definitions: inventory(Updated) }
package/src/project-id.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { Schema } from "effect"
2
- import { statics } from "./schema.js"
3
-
4
- export const ProjectID = Schema.String.pipe(
5
- Schema.brand("Project.ID"),
6
- Schema.annotate({ identifier: "Project.ID" }),
7
- statics((schema) => ({ global: schema.make("global") })),
8
- )
9
- export type ProjectID = typeof ProjectID.Type
1
+ import { Schema } from "effect"
2
+ import { statics } from "./schema.js"
3
+
4
+ export const ProjectID = Schema.String.pipe(
5
+ Schema.brand("Project.ID"),
6
+ Schema.annotate({ identifier: "Project.ID" }),
7
+ statics((schema) => ({ global: schema.make("global") })),
8
+ )
9
+ export type ProjectID = typeof ProjectID.Type
package/src/project.ts CHANGED
@@ -1,62 +1,62 @@
1
- export * as Project from "./project.js"
2
-
3
- import { Schema } from "effect"
4
- import { ephemeral, inventory } from "./event.js"
5
- import { AbsolutePath, NonNegativeInt, optional } from "./schema.js"
6
- import { ProjectID } from "./project-id.js"
7
-
8
- export const ID = ProjectID
9
- export type ID = typeof ID.Type
10
-
11
- export const Vcs = Schema.String.check(Schema.isPattern(/^[a-z][a-z0-9._-]*$/u)).annotate({
12
- identifier: "Project.Vcs",
13
- })
14
- export const Current = Schema.Struct({
15
- id: ID,
16
- directory: AbsolutePath,
17
- canonical: AbsolutePath,
18
- }).annotate({ identifier: "Project.Current" })
19
- export interface Current extends Schema.Schema.Type<typeof Current> {}
20
- export const Icon = Schema.Struct({
21
- url: optional(Schema.String),
22
- override: optional(Schema.String),
23
- color: optional(Schema.String),
24
- }).annotate({ identifier: "Project.Icon" })
25
- export interface Icon extends Schema.Schema.Type<typeof Icon> {}
26
- export const Commands = Schema.Struct({
27
- start: optional(
28
- Schema.String.annotate({ description: "Startup script to run when creating a new workspace (worktree)" }),
29
- ),
30
- }).annotate({ identifier: "Project.Commands" })
31
- export interface Commands extends Schema.Schema.Type<typeof Commands> {}
32
- export const Time = Schema.Struct({
33
- created: NonNegativeInt,
34
- updated: NonNegativeInt,
35
- active: NonNegativeInt,
36
- archived: optional(NonNegativeInt),
37
- }).annotate({ identifier: "Project.Time" })
38
- export interface Time extends Schema.Schema.Type<typeof Time> {}
39
-
40
- export const Info = Schema.Struct({
41
- id: ID,
42
- canonical: AbsolutePath,
43
- vcs: optional(Vcs),
44
- name: optional(Schema.String),
45
- icon: optional(Icon),
46
- commands: optional(Commands),
47
- time: Time,
48
- sandboxes: Schema.Array(Schema.String),
49
- }).annotate({ identifier: "Project" })
50
- export interface Info extends Schema.Schema.Type<typeof Info> {}
51
-
52
- export const UpdateInput = Schema.Struct({
53
- projectID: ID,
54
- canonical: optional(AbsolutePath),
55
- name: optional(Schema.String),
56
- icon: optional(Icon),
57
- commands: optional(Commands),
58
- }).annotate({ identifier: "Project.UpdateInput" })
59
- export interface UpdateInput extends Schema.Schema.Type<typeof UpdateInput> {}
60
-
61
- const Updated = ephemeral({ type: "project.updated", schema: Info.fields })
62
- export const Event = { Updated, Definitions: inventory(Updated) }
1
+ export * as Project from "./project.js"
2
+
3
+ import { Schema } from "effect"
4
+ import { ephemeral, inventory } from "./event.js"
5
+ import { AbsolutePath, NonNegativeInt, optional } from "./schema.js"
6
+ import { ProjectID } from "./project-id.js"
7
+
8
+ export const ID = ProjectID
9
+ export type ID = typeof ID.Type
10
+
11
+ export const Vcs = Schema.String.check(Schema.isPattern(/^[a-z][a-z0-9._-]*$/u)).annotate({
12
+ identifier: "Project.Vcs",
13
+ })
14
+ export const Current = Schema.Struct({
15
+ id: ID,
16
+ directory: AbsolutePath,
17
+ canonical: AbsolutePath,
18
+ }).annotate({ identifier: "Project.Current" })
19
+ export interface Current extends Schema.Schema.Type<typeof Current> {}
20
+ export const Icon = Schema.Struct({
21
+ url: optional(Schema.String),
22
+ override: optional(Schema.String),
23
+ color: optional(Schema.String),
24
+ }).annotate({ identifier: "Project.Icon" })
25
+ export interface Icon extends Schema.Schema.Type<typeof Icon> {}
26
+ export const Commands = Schema.Struct({
27
+ start: optional(
28
+ Schema.String.annotate({ description: "Startup script to run when creating a new workspace (worktree)" }),
29
+ ),
30
+ }).annotate({ identifier: "Project.Commands" })
31
+ export interface Commands extends Schema.Schema.Type<typeof Commands> {}
32
+ export const Time = Schema.Struct({
33
+ created: NonNegativeInt,
34
+ updated: NonNegativeInt,
35
+ active: NonNegativeInt,
36
+ archived: optional(NonNegativeInt),
37
+ }).annotate({ identifier: "Project.Time" })
38
+ export interface Time extends Schema.Schema.Type<typeof Time> {}
39
+
40
+ export const Info = Schema.Struct({
41
+ id: ID,
42
+ canonical: AbsolutePath,
43
+ vcs: optional(Vcs),
44
+ name: optional(Schema.String),
45
+ icon: optional(Icon),
46
+ commands: optional(Commands),
47
+ time: Time,
48
+ sandboxes: Schema.Array(Schema.String),
49
+ }).annotate({ identifier: "Project" })
50
+ export interface Info extends Schema.Schema.Type<typeof Info> {}
51
+
52
+ export const UpdateInput = Schema.Struct({
53
+ projectID: ID,
54
+ canonical: optional(AbsolutePath),
55
+ name: optional(Schema.String),
56
+ icon: optional(Icon),
57
+ commands: optional(Commands),
58
+ }).annotate({ identifier: "Project.UpdateInput" })
59
+ export interface UpdateInput extends Schema.Schema.Type<typeof UpdateInput> {}
60
+
61
+ const Updated = ephemeral({ type: "project.updated", schema: Info.fields })
62
+ export const Event = { Updated, Definitions: inventory(Updated) }
@@ -1,33 +1,33 @@
1
- export * as PromptInput from "./prompt-input.js"
2
-
3
- import { Schema } from "effect"
4
- import { AgentAttachment, FileSource, PromptMention } from "./prompt.js"
5
- import { optional } from "./schema.js"
6
- import { Skill } from "./skill.js"
7
-
8
- export interface FileAttachment extends Schema.Schema.Type<typeof FileAttachment> {}
9
- export const FileAttachment = Schema.Struct({
10
- uri: Schema.String.annotate({
11
- description:
12
- "A file: URL on the server (a file, a directory, or ?start=N&end=M for lines of a text file), a data: URL, or a media: ref from a message. Up to 20 MB.",
13
- }),
14
- // Source metadata does not require reopening the original file.
15
- source: FileSource.pipe(optional),
16
- name: Schema.String.pipe(optional),
17
- description: Schema.String.pipe(optional),
18
- mention: PromptMention.pipe(optional),
19
- }).annotate({ identifier: "PromptInput.FileAttachment" })
20
-
21
- export interface Prompt extends Schema.Schema.Type<typeof Prompt> {}
22
- export interface SkillAttachment extends Schema.Schema.Type<typeof SkillAttachment> {}
23
- export const SkillAttachment = Schema.Struct({
24
- id: Skill.ID,
25
- mention: PromptMention.pipe(optional),
26
- }).annotate({ identifier: "PromptInput.SkillAttachment" })
27
-
28
- export const Prompt = Schema.Struct({
29
- text: Schema.String,
30
- files: Schema.Array(FileAttachment).pipe(optional),
31
- agents: Schema.Array(AgentAttachment).pipe(optional),
32
- skills: Schema.Array(SkillAttachment).pipe(optional),
33
- }).annotate({ identifier: "PromptInput" })
1
+ export * as PromptInput from "./prompt-input.js"
2
+
3
+ import { Schema } from "effect"
4
+ import { AgentAttachment, FileSource, PromptMention } from "./prompt.js"
5
+ import { optional } from "./schema.js"
6
+ import { Skill } from "./skill.js"
7
+
8
+ export interface FileAttachment extends Schema.Schema.Type<typeof FileAttachment> {}
9
+ export const FileAttachment = Schema.Struct({
10
+ uri: Schema.String.annotate({
11
+ description:
12
+ "A file: URL on the server (a file, a directory, or ?start=N&end=M for lines of a text file), a data: URL, or a media: ref from a message. Up to 20 MB.",
13
+ }),
14
+ // Source metadata does not require reopening the original file.
15
+ source: FileSource.pipe(optional),
16
+ name: Schema.String.pipe(optional),
17
+ description: Schema.String.pipe(optional),
18
+ mention: PromptMention.pipe(optional),
19
+ }).annotate({ identifier: "PromptInput.FileAttachment" })
20
+
21
+ export interface Prompt extends Schema.Schema.Type<typeof Prompt> {}
22
+ export interface SkillAttachment extends Schema.Schema.Type<typeof SkillAttachment> {}
23
+ export const SkillAttachment = Schema.Struct({
24
+ id: Skill.ID,
25
+ mention: PromptMention.pipe(optional),
26
+ }).annotate({ identifier: "PromptInput.SkillAttachment" })
27
+
28
+ export const Prompt = Schema.Struct({
29
+ text: Schema.String,
30
+ files: Schema.Array(FileAttachment).pipe(optional),
31
+ agents: Schema.Array(AgentAttachment).pipe(optional),
32
+ skills: Schema.Array(SkillAttachment).pipe(optional),
33
+ }).annotate({ identifier: "PromptInput" })