@zyro-sec/schema 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 (136) hide show
  1. package/AGENTS.md +95 -95
  2. package/package.json +1 -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
package/src/schema.ts CHANGED
@@ -1,41 +1,41 @@
1
- import { DateTime, Option, Schema, SchemaGetter } from "effect"
2
-
3
- export const PositiveInt = Schema.Int.check(Schema.isGreaterThan(0))
4
- export const NonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))
5
-
6
- export const RelativePath = Schema.String.pipe(
7
- Schema.brand("RelativePath"),
8
- Schema.annotate({ identifier: "RelativePath" }),
9
- )
10
- export type RelativePath = typeof RelativePath.Type
11
-
12
- export const AbsolutePath = Schema.String.pipe(
13
- Schema.brand("AbsolutePath"),
14
- Schema.annotate({ identifier: "AbsolutePath" }),
15
- )
16
- export type AbsolutePath = typeof AbsolutePath.Type
17
-
18
- export const optional = <S extends Schema.Top>(schema: S) =>
19
- Schema.optionalKey(schema).pipe(
20
- Schema.decodeTo(Schema.optional(Schema.toType(schema)), {
21
- decode: SchemaGetter.passthrough({ strict: false }),
22
- encode: SchemaGetter.transformOptional(Option.filter((value) => value !== undefined)),
23
- }),
24
- )
25
-
26
- // Effect schemas expose `make` through prototype getters, so `Object.assign` cannot override it.
27
- // Defining the properties replaces a constructor as long as the schema's own `make` has not been read.
28
- export const withStatics = <S extends object, M extends Record<string, unknown>>(schema: S, methods: M): S & M =>
29
- Object.defineProperties(schema, Object.getOwnPropertyDescriptors(methods)) as S & M
30
-
31
- export const statics =
32
- <S extends object, M extends Record<string, unknown>>(methods: (schema: S) => M) =>
33
- (schema: S): S & M =>
34
- withStatics(schema, methods(schema))
35
-
36
- export const DateTimeUtcFromMillis = Schema.Finite.pipe(
37
- Schema.decodeTo(Schema.DateTimeUtc, {
38
- decode: SchemaGetter.transform((value) => DateTime.makeUnsafe(value)),
39
- encode: SchemaGetter.transform((value) => DateTime.toEpochMillis(value)),
40
- }),
41
- )
1
+ import { DateTime, Option, Schema, SchemaGetter } from "effect"
2
+
3
+ export const PositiveInt = Schema.Int.check(Schema.isGreaterThan(0))
4
+ export const NonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))
5
+
6
+ export const RelativePath = Schema.String.pipe(
7
+ Schema.brand("RelativePath"),
8
+ Schema.annotate({ identifier: "RelativePath" }),
9
+ )
10
+ export type RelativePath = typeof RelativePath.Type
11
+
12
+ export const AbsolutePath = Schema.String.pipe(
13
+ Schema.brand("AbsolutePath"),
14
+ Schema.annotate({ identifier: "AbsolutePath" }),
15
+ )
16
+ export type AbsolutePath = typeof AbsolutePath.Type
17
+
18
+ export const optional = <S extends Schema.Top>(schema: S) =>
19
+ Schema.optionalKey(schema).pipe(
20
+ Schema.decodeTo(Schema.optional(Schema.toType(schema)), {
21
+ decode: SchemaGetter.passthrough({ strict: false }),
22
+ encode: SchemaGetter.transformOptional(Option.filter((value) => value !== undefined)),
23
+ }),
24
+ )
25
+
26
+ // Effect schemas expose `make` through prototype getters, so `Object.assign` cannot override it.
27
+ // Defining the properties replaces a constructor as long as the schema's own `make` has not been read.
28
+ export const withStatics = <S extends object, M extends Record<string, unknown>>(schema: S, methods: M): S & M =>
29
+ Object.defineProperties(schema, Object.getOwnPropertyDescriptors(methods)) as S & M
30
+
31
+ export const statics =
32
+ <S extends object, M extends Record<string, unknown>>(methods: (schema: S) => M) =>
33
+ (schema: S): S & M =>
34
+ withStatics(schema, methods(schema))
35
+
36
+ export const DateTimeUtcFromMillis = Schema.Finite.pipe(
37
+ Schema.decodeTo(Schema.DateTimeUtc, {
38
+ decode: SchemaGetter.transform((value) => DateTime.makeUnsafe(value)),
39
+ encode: SchemaGetter.transform((value) => DateTime.toEpochMillis(value)),
40
+ }),
41
+ )
@@ -1,8 +1,8 @@
1
- export * as ServerEvent from "./server-event.js"
2
-
3
- import { Event } from "./event.js"
4
-
5
- export const Connected = Event.ephemeral({ type: "server.connected", schema: {} })
6
- export const Disposed = Event.ephemeral({ type: "global.disposed", schema: {} })
7
-
8
- export const Definitions = Event.inventory(Connected, Disposed)
1
+ export * as ServerEvent from "./server-event.js"
2
+
3
+ import { Event } from "./event.js"
4
+
5
+ export const Connected = Event.ephemeral({ type: "server.connected", schema: {} })
6
+ export const Disposed = Event.ephemeral({ type: "global.disposed", schema: {} })
7
+
8
+ export const Definitions = Event.inventory(Connected, Disposed)
@@ -1,14 +1,14 @@
1
- export * as SessionError from "./session-error.js"
2
-
3
- import { Schema } from "effect"
4
- import { NonNegativeInt, optional } from "./schema.js"
5
-
6
- export interface Error extends Schema.Schema.Type<typeof Error> {}
7
- export const Error = Schema.Struct({
8
- type: Schema.String,
9
- message: Schema.String,
10
- status: Schema.Int.check(Schema.isBetween({ minimum: 100, maximum: 599 })).pipe(optional),
11
- response: Schema.Struct({ body: Schema.String }).pipe(optional),
12
- /** How long the provider asked to wait before trying again, counted from when the failure was recorded. */
13
- retryAfterMs: NonNegativeInt.pipe(optional),
14
- }).annotate({ identifier: "Session.StructuredError" })
1
+ export * as SessionError from "./session-error.js"
2
+
3
+ import { Schema } from "effect"
4
+ import { NonNegativeInt, optional } from "./schema.js"
5
+
6
+ export interface Error extends Schema.Schema.Type<typeof Error> {}
7
+ export const Error = Schema.Struct({
8
+ type: Schema.String,
9
+ message: Schema.String,
10
+ status: Schema.Int.check(Schema.isBetween({ minimum: 100, maximum: 599 })).pipe(optional),
11
+ response: Schema.Struct({ body: Schema.String }).pipe(optional),
12
+ /** How long the provider asked to wait before trying again, counted from when the failure was recorded. */
13
+ retryAfterMs: NonNegativeInt.pipe(optional),
14
+ }).annotate({ identifier: "Session.StructuredError" })