effect 4.0.2 → 4.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 (243) hide show
  1. package/dist/Context.js +3 -3
  2. package/dist/Context.js.map +1 -1
  3. package/dist/Crypto.d.ts +33 -5
  4. package/dist/Crypto.d.ts.map +1 -1
  5. package/dist/Crypto.js +8 -2
  6. package/dist/Crypto.js.map +1 -1
  7. package/dist/DateTime.d.ts +9 -6
  8. package/dist/DateTime.d.ts.map +1 -1
  9. package/dist/DateTime.js +9 -6
  10. package/dist/DateTime.js.map +1 -1
  11. package/dist/Duration.d.ts +6 -6
  12. package/dist/Duration.d.ts.map +1 -1
  13. package/dist/Duration.js +27 -8
  14. package/dist/Duration.js.map +1 -1
  15. package/dist/FileSystem.d.ts +44 -2
  16. package/dist/FileSystem.d.ts.map +1 -1
  17. package/dist/FileSystem.js.map +1 -1
  18. package/dist/Schema.d.ts +473 -1
  19. package/dist/Schema.d.ts.map +1 -1
  20. package/dist/Schema.js +355 -4
  21. package/dist/Schema.js.map +1 -1
  22. package/dist/Stdio.d.ts +7 -1
  23. package/dist/Stdio.d.ts.map +1 -1
  24. package/dist/Stdio.js +1 -0
  25. package/dist/Stdio.js.map +1 -1
  26. package/dist/Stream.d.ts +11 -11
  27. package/dist/Stream.js +5 -5
  28. package/dist/ai/McpServer.d.ts +6 -0
  29. package/dist/ai/McpServer.d.ts.map +1 -1
  30. package/dist/ai/McpServer.js +65 -23
  31. package/dist/ai/McpServer.js.map +1 -1
  32. package/dist/ai/internal/mcpProtocol/v2026_07_28.js +5 -0
  33. package/dist/ai/internal/mcpProtocol/v2026_07_28.js.map +1 -1
  34. package/dist/ai/internal/mcpProtocol.js.map +1 -1
  35. package/dist/ai/internal/mcpRuntime.js +1 -0
  36. package/dist/ai/internal/mcpRuntime.js.map +1 -1
  37. package/dist/cli/CliOutput.d.ts +27 -0
  38. package/dist/cli/CliOutput.d.ts.map +1 -1
  39. package/dist/cli/CliOutput.js +33 -10
  40. package/dist/cli/CliOutput.js.map +1 -1
  41. package/dist/cli/Command.d.ts.map +1 -1
  42. package/dist/cli/Command.js +6 -3
  43. package/dist/cli/Command.js.map +1 -1
  44. package/dist/cli/Completions.d.ts +3 -3
  45. package/dist/cli/Completions.d.ts.map +1 -1
  46. package/dist/cli/Completions.js +8 -5
  47. package/dist/cli/Completions.js.map +1 -1
  48. package/dist/cli/GlobalFlag.d.ts +5 -4
  49. package/dist/cli/GlobalFlag.d.ts.map +1 -1
  50. package/dist/cli/GlobalFlag.js +3 -3
  51. package/dist/cli/GlobalFlag.js.map +1 -1
  52. package/dist/cli/Prompt.d.ts +17 -1
  53. package/dist/cli/Prompt.d.ts.map +1 -1
  54. package/dist/cli/Prompt.js +119 -114
  55. package/dist/cli/Prompt.js.map +1 -1
  56. package/dist/cli/internal/ansi.d.ts +0 -1
  57. package/dist/cli/internal/ansi.d.ts.map +1 -1
  58. package/dist/cli/internal/ansi.js +20 -3
  59. package/dist/cli/internal/ansi.js.map +1 -1
  60. package/dist/cli/internal/completions/powershell.d.ts +2 -0
  61. package/dist/cli/internal/completions/powershell.d.ts.map +1 -0
  62. package/dist/cli/internal/completions/powershell.js +273 -0
  63. package/dist/cli/internal/completions/powershell.js.map +1 -0
  64. package/dist/cli/internal/completions/zsh.js +3 -2
  65. package/dist/cli/internal/completions/zsh.js.map +1 -1
  66. package/dist/cli/internal/wizard.d.ts +3 -3
  67. package/dist/cli/internal/wizard.d.ts.map +1 -1
  68. package/dist/cli/internal/wizard.js +21 -18
  69. package/dist/cli/internal/wizard.js.map +1 -1
  70. package/dist/cluster/ClusterSchema.d.ts +28 -0
  71. package/dist/cluster/ClusterSchema.d.ts.map +1 -1
  72. package/dist/cluster/ClusterSchema.js +30 -0
  73. package/dist/cluster/ClusterSchema.js.map +1 -1
  74. package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  75. package/dist/cluster/ClusterWorkflowEngine.js +10 -18
  76. package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
  77. package/dist/cluster/MessageStorage.d.ts +18 -3
  78. package/dist/cluster/MessageStorage.d.ts.map +1 -1
  79. package/dist/cluster/MessageStorage.js +31 -11
  80. package/dist/cluster/MessageStorage.js.map +1 -1
  81. package/dist/cluster/Runners.d.ts.map +1 -1
  82. package/dist/cluster/Runners.js +8 -2
  83. package/dist/cluster/Runners.js.map +1 -1
  84. package/dist/cluster/Sharding.d.ts.map +1 -1
  85. package/dist/cluster/Sharding.js +181 -62
  86. package/dist/cluster/Sharding.js.map +1 -1
  87. package/dist/cluster/SqlMessageStorage.d.ts +59 -19
  88. package/dist/cluster/SqlMessageStorage.d.ts.map +1 -1
  89. package/dist/cluster/SqlMessageStorage.js +84 -55
  90. package/dist/cluster/SqlMessageStorage.js.map +1 -1
  91. package/dist/cluster/SqlRunnerStorage.d.ts +68 -19
  92. package/dist/cluster/SqlRunnerStorage.d.ts.map +1 -1
  93. package/dist/cluster/SqlRunnerStorage.js +191 -113
  94. package/dist/cluster/SqlRunnerStorage.js.map +1 -1
  95. package/dist/cluster/internal/entityManager.js +104 -37
  96. package/dist/cluster/internal/entityManager.js.map +1 -1
  97. package/dist/http/FindMyWay/internal/router.js +3 -6
  98. package/dist/http/FindMyWay/internal/router.js.map +1 -1
  99. package/dist/http/HttpClient.d.ts +6 -0
  100. package/dist/http/HttpClient.d.ts.map +1 -1
  101. package/dist/http/HttpClient.js +39 -2
  102. package/dist/http/HttpClient.js.map +1 -1
  103. package/dist/http/HttpTraceContext.d.ts.map +1 -1
  104. package/dist/http/HttpTraceContext.js +4 -2
  105. package/dist/http/HttpTraceContext.js.map +1 -1
  106. package/dist/internal/effect.js +12 -7
  107. package/dist/internal/effect.js.map +1 -1
  108. package/dist/internal/version.js +1 -1
  109. package/dist/net/AddressResolver.d.ts +145 -0
  110. package/dist/net/AddressResolver.d.ts.map +1 -0
  111. package/dist/net/AddressResolver.js +114 -0
  112. package/dist/net/AddressResolver.js.map +1 -0
  113. package/dist/net/Dns.d.ts +596 -0
  114. package/dist/net/Dns.d.ts.map +1 -0
  115. package/dist/net/Dns.js +549 -0
  116. package/dist/net/Dns.js.map +1 -0
  117. package/dist/net/Host.d.ts +320 -0
  118. package/dist/net/Host.d.ts.map +1 -0
  119. package/dist/net/Host.js +342 -0
  120. package/dist/net/Host.js.map +1 -0
  121. package/dist/net/IpInterface.d.ts +76 -3
  122. package/dist/net/IpInterface.d.ts.map +1 -1
  123. package/dist/net/IpInterface.js +53 -4
  124. package/dist/net/IpInterface.js.map +1 -1
  125. package/dist/net/IpNetwork.d.ts +82 -8
  126. package/dist/net/IpNetwork.d.ts.map +1 -1
  127. package/dist/net/IpNetwork.js +60 -4
  128. package/dist/net/IpNetwork.js.map +1 -1
  129. package/dist/net/NetAddress.d.ts +388 -35
  130. package/dist/net/NetAddress.d.ts.map +1 -1
  131. package/dist/net/NetAddress.js +350 -34
  132. package/dist/net/NetAddress.js.map +1 -1
  133. package/dist/net/index.d.ts +15 -0
  134. package/dist/net/index.d.ts.map +1 -1
  135. package/dist/net/index.js +15 -0
  136. package/dist/net/index.js.map +1 -1
  137. package/dist/observability/OtlpMetrics.d.ts.map +1 -1
  138. package/dist/observability/OtlpMetrics.js +15 -21
  139. package/dist/observability/OtlpMetrics.js.map +1 -1
  140. package/dist/observability/PrometheusMetrics.js +1 -0
  141. package/dist/observability/PrometheusMetrics.js.map +1 -1
  142. package/dist/persistence/PersistedQueue.d.ts +32 -3
  143. package/dist/persistence/PersistedQueue.d.ts.map +1 -1
  144. package/dist/persistence/PersistedQueue.js +75 -16
  145. package/dist/persistence/PersistedQueue.js.map +1 -1
  146. package/dist/rpc/RpcClient.d.ts +22 -6
  147. package/dist/rpc/RpcClient.d.ts.map +1 -1
  148. package/dist/rpc/RpcClient.js +12 -5
  149. package/dist/rpc/RpcClient.js.map +1 -1
  150. package/dist/rpc/RpcServer.d.ts +6 -0
  151. package/dist/rpc/RpcServer.d.ts.map +1 -1
  152. package/dist/rpc/RpcServer.js +42 -20
  153. package/dist/rpc/RpcServer.js.map +1 -1
  154. package/dist/socket/DatagramSocket.d.ts +456 -0
  155. package/dist/socket/DatagramSocket.d.ts.map +1 -0
  156. package/dist/socket/DatagramSocket.js +535 -0
  157. package/dist/socket/DatagramSocket.js.map +1 -0
  158. package/dist/socket/Socket.d.ts +14 -1
  159. package/dist/socket/Socket.d.ts.map +1 -1
  160. package/dist/socket/Socket.js +9 -1
  161. package/dist/socket/Socket.js.map +1 -1
  162. package/dist/socket/index.d.ts +5 -0
  163. package/dist/socket/index.d.ts.map +1 -1
  164. package/dist/socket/index.js +5 -0
  165. package/dist/socket/index.js.map +1 -1
  166. package/dist/sql/Migrator.d.ts.map +1 -1
  167. package/dist/sql/Migrator.js +7 -2
  168. package/dist/sql/Migrator.js.map +1 -1
  169. package/dist/sql/SqlClient.d.ts +7 -1
  170. package/dist/sql/SqlClient.d.ts.map +1 -1
  171. package/dist/sql/SqlClient.js +31 -6
  172. package/dist/sql/SqlClient.js.map +1 -1
  173. package/dist/testing/TestCrypto.d.ts +73 -0
  174. package/dist/testing/TestCrypto.d.ts.map +1 -0
  175. package/dist/testing/TestCrypto.js +87 -0
  176. package/dist/testing/TestCrypto.js.map +1 -0
  177. package/dist/testing/index.d.ts +5 -0
  178. package/dist/testing/index.d.ts.map +1 -1
  179. package/dist/testing/index.js +5 -0
  180. package/dist/testing/index.js.map +1 -1
  181. package/dist/workflow/DurableDeferred.d.ts +54 -0
  182. package/dist/workflow/DurableDeferred.d.ts.map +1 -1
  183. package/dist/workflow/DurableDeferred.js +78 -49
  184. package/dist/workflow/DurableDeferred.js.map +1 -1
  185. package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
  186. package/dist/workflow/WorkflowEngine.js +2 -1
  187. package/dist/workflow/WorkflowEngine.js.map +1 -1
  188. package/package.json +1 -1
  189. package/src/Context.ts +3 -3
  190. package/src/Crypto.ts +43 -9
  191. package/src/DateTime.ts +9 -6
  192. package/src/Duration.ts +36 -16
  193. package/src/FileSystem.ts +48 -2
  194. package/src/Schema.ts +669 -5
  195. package/src/Stdio.ts +9 -2
  196. package/src/Stream.ts +11 -11
  197. package/src/ai/McpServer.ts +63 -23
  198. package/src/ai/internal/mcpProtocol/v2026_07_28.ts +5 -0
  199. package/src/ai/internal/mcpProtocol.ts +3 -0
  200. package/src/ai/internal/mcpRuntime.ts +2 -0
  201. package/src/cli/CliOutput.ts +33 -16
  202. package/src/cli/Command.ts +4 -3
  203. package/src/cli/Completions.ts +9 -6
  204. package/src/cli/GlobalFlag.ts +19 -11
  205. package/src/cli/Prompt.ts +159 -149
  206. package/src/cli/internal/ansi.ts +26 -3
  207. package/src/cli/internal/completions/powershell.ts +322 -0
  208. package/src/cli/internal/completions/zsh.ts +4 -2
  209. package/src/cli/internal/wizard.ts +34 -26
  210. package/src/cluster/ClusterSchema.ts +32 -0
  211. package/src/cluster/ClusterWorkflowEngine.ts +13 -24
  212. package/src/cluster/MessageStorage.ts +45 -14
  213. package/src/cluster/Runners.ts +8 -2
  214. package/src/cluster/Sharding.ts +207 -49
  215. package/src/cluster/SqlMessageStorage.ts +118 -84
  216. package/src/cluster/SqlRunnerStorage.ts +224 -128
  217. package/src/cluster/internal/entityManager.ts +151 -55
  218. package/src/http/FindMyWay/internal/router.ts +4 -7
  219. package/src/http/HttpClient.ts +56 -2
  220. package/src/http/HttpTraceContext.ts +8 -2
  221. package/src/internal/effect.ts +15 -13
  222. package/src/internal/version.ts +1 -1
  223. package/src/net/AddressResolver.ts +222 -0
  224. package/src/net/Dns.ts +1035 -0
  225. package/src/net/Host.ts +472 -0
  226. package/src/net/IpInterface.ts +117 -7
  227. package/src/net/IpNetwork.ts +116 -17
  228. package/src/net/NetAddress.ts +611 -76
  229. package/src/net/index.ts +18 -0
  230. package/src/observability/OtlpMetrics.ts +12 -23
  231. package/src/observability/PrometheusMetrics.ts +1 -0
  232. package/src/persistence/PersistedQueue.ts +146 -53
  233. package/src/rpc/RpcClient.ts +41 -19
  234. package/src/rpc/RpcServer.ts +60 -25
  235. package/src/socket/DatagramSocket.ts +919 -0
  236. package/src/socket/Socket.ts +22 -2
  237. package/src/socket/index.ts +6 -0
  238. package/src/sql/Migrator.ts +21 -5
  239. package/src/sql/SqlClient.ts +39 -15
  240. package/src/testing/TestCrypto.ts +94 -0
  241. package/src/testing/index.ts +6 -0
  242. package/src/workflow/DurableDeferred.ts +123 -48
  243. package/src/workflow/WorkflowEngine.ts +2 -1
package/src/Duration.ts CHANGED
@@ -36,11 +36,12 @@ const bigint1e3 = BigInt(1_000)
36
36
  const bigint1e6 = BigInt(1_000_000)
37
37
  const bigint1e9 = BigInt(1_000_000_000)
38
38
 
39
- const roundTiesAwayFromZero = (input: number): bigint =>
40
- BigInt(input < 0 ? Math.ceil(input - 0.5) : Math.floor(input + 0.5))
39
+ const roundTiesAwayFromZero = (input: number): bigint => BigInt(Math.sign(input) * Math.round(Math.abs(input)))
41
40
 
42
41
  const roundMillisToNanos = (millis: number): bigint => roundTiesAwayFromZero(millis * 1_000_000)
43
42
 
43
+ const fromNanosNumber = (nanos: number): Duration => make(Number.isFinite(nanos) ? roundTiesAwayFromZero(nanos) : nanos)
44
+
44
45
  const parseNanos = (input: string, scale: bigint): bigint => {
45
46
  const decimalIndex = input.indexOf(".")
46
47
  if (decimalIndex === -1) return BigInt(input) * scale
@@ -51,9 +52,13 @@ const parseNanos = (input: string, scale: bigint): bigint => {
51
52
  const scaled = (
52
53
  BigInt(input.slice(isNegative ? 1 : 0, decimalIndex)) * fractionalScale + BigInt(fractional)
53
54
  ) * scale
54
- const rounded = scaled / fractionalScale +
55
- (scaled % fractionalScale * bigint2 >= fractionalScale ? bigint1 : bigint0)
56
- return isNegative ? -rounded : rounded
55
+ return divideTiesAwayFromZero(isNegative ? -scaled : scaled, fractionalScale)
56
+ }
57
+
58
+ const divideTiesAwayFromZero = (numerator: bigint, denominator: bigint): bigint => {
59
+ const absolute = numerator < bigint0 ? -numerator : numerator
60
+ const rounded = absolute / denominator + (absolute % denominator * bigint2 >= denominator ? bigint1 : bigint0)
61
+ return numerator < bigint0 ? -rounded : rounded
57
62
  }
58
63
 
59
64
  const nanosToHrTime = (nanos: bigint): [seconds: number, nanos: number] => {
@@ -307,7 +312,7 @@ export const fromInputUnsafe = (input: Input): Duration => {
307
312
  if (input[0] === Infinity || input[1] === Infinity) {
308
313
  return infinity
309
314
  }
310
- return make(roundTiesAwayFromZero(input[0] * 1_000_000_000 + input[1]))
315
+ return fromNanosNumber(input[0] * 1_000_000_000 + input[1])
311
316
  }
312
317
  const obj = input as DurationObject
313
318
  let millis = 0
@@ -319,9 +324,7 @@ export const fromInputUnsafe = (input: Input): Duration => {
319
324
  if (obj.seconds) millis += obj.seconds * 1_000
320
325
  if (obj.milliseconds) millis += obj.milliseconds
321
326
  if (!obj.microseconds && !obj.nanoseconds) return make(millis)
322
- return make(roundTiesAwayFromZero(
323
- millis * 1_000_000 + (obj.microseconds ?? 0) * 1_000 + (obj.nanoseconds ?? 0)
324
- ))
327
+ return fromNanosNumber(millis * 1_000_000 + (obj.microseconds ?? 0) * 1_000 + (obj.nanoseconds ?? 0))
325
328
  }
326
329
  }
327
330
  return invalid(input)
@@ -1794,8 +1797,8 @@ export const divideUnsafe: {
1794
1797
  *
1795
1798
  * **Details**
1796
1799
  *
1797
- * For nanosecond-backed durations, the multiplier must be convertible to a
1798
- * `bigint`; fractional or non-finite multipliers can throw. Infinite
1800
+ * Fractional multipliers on nanosecond-backed durations round the result to
1801
+ * the nearest nanosecond, with ties rounding away from zero. Infinite
1799
1802
  * durations return positive infinity, negative infinity, or zero depending on
1800
1803
  * the multiplier sign.
1801
1804
  *
@@ -1817,8 +1820,8 @@ export const times: {
1817
1820
  *
1818
1821
  * **Details**
1819
1822
  *
1820
- * For nanosecond-backed durations, the multiplier must be convertible to a
1821
- * `bigint`; fractional or non-finite multipliers can throw. Infinite
1823
+ * Fractional multipliers on nanosecond-backed durations round the result to
1824
+ * the nearest nanosecond, with ties rounding away from zero. Infinite
1822
1825
  * durations return positive infinity, negative infinity, or zero depending on
1823
1826
  * the multiplier sign.
1824
1827
  *
@@ -1840,8 +1843,8 @@ export const times: {
1840
1843
  *
1841
1844
  * **Details**
1842
1845
  *
1843
- * For nanosecond-backed durations, the multiplier must be convertible to a
1844
- * `bigint`; fractional or non-finite multipliers can throw. Infinite
1846
+ * Fractional multipliers on nanosecond-backed durations round the result to
1847
+ * the nearest nanosecond, with ties rounding away from zero. Infinite
1845
1848
  * durations return positive infinity, negative infinity, or zero depending on
1846
1849
  * the multiplier sign.
1847
1850
  *
@@ -1863,7 +1866,24 @@ export const times: {
1863
1866
  (self: Duration, times: number): Duration =>
1864
1867
  match(self, {
1865
1868
  onMillis: (millis) => make(millis * times),
1866
- onNanos: (nanos) => make(nanos * BigInt(times)),
1869
+ onNanos: (nanos) => {
1870
+ if (Number.isInteger(times)) return make(nanos * BigInt(times))
1871
+ const nanosNumber = Number(nanos)
1872
+ const scaled = nanosNumber * times
1873
+ if (
1874
+ !Number.isFinite(times) ||
1875
+ (Number.isSafeInteger(nanosNumber) && Math.abs(scaled) <= Number.MAX_SAFE_INTEGER)
1876
+ ) {
1877
+ return fromNanosNumber(scaled)
1878
+ }
1879
+ let numerator = times
1880
+ let denominator = bigint1
1881
+ while (!Number.isInteger(numerator)) {
1882
+ numerator *= 2
1883
+ denominator *= bigint2
1884
+ }
1885
+ return make(divideTiesAwayFromZero(nanos * BigInt(numerator), denominator))
1886
+ },
1867
1887
  onInfinity: () => times > 0 ? infinity : times < 0 ? negativeInfinity : zero,
1868
1888
  onNegativeInfinity: () => times > 0 ? negativeInfinity : times < 0 ? infinity : zero
1869
1889
  })
package/src/FileSystem.ts CHANGED
@@ -220,12 +220,17 @@ export interface FileSystem {
220
220
  * **Details**
221
221
  *
222
222
  * The file handle will be automatically closed when the scope is closed.
223
+ *
224
+ * `noFollow` rejects symlinks at the final path component, not in parent
225
+ * directories. Node and Bun support it on POSIX; unsupported platforms,
226
+ * including Windows and Deno, fail with `BadArgument`.
223
227
  */
224
228
  readonly open: (
225
229
  path: string,
226
230
  options?: {
227
231
  readonly flag?: OpenFlag | undefined
228
232
  readonly mode?: number | undefined
233
+ readonly noFollow?: boolean | undefined
229
234
  }
230
235
  ) => Effect.Effect<File, PlatformError, Scope>
231
236
  /**
@@ -827,6 +832,10 @@ export const isFile = (u: unknown): u is File => hasProperty(u, FileTypeId)
827
832
  * cursor. Outside append mode, `truncate` clamps a cursor past the new length
828
833
  * to that length.
829
834
  *
835
+ * Positional reads leave the cursor unchanged and may run concurrently on
836
+ * one handle. Cursor operations (`seek`, reads without a position, and writes)
837
+ * must not run concurrently with each other.
838
+ *
830
839
  * **Example** (Working with file handles)
831
840
  *
832
841
  * ```ts import.meta.vitest
@@ -877,8 +886,20 @@ export interface File {
877
886
  */
878
887
  readonly seek: (offset: bigint, from: SeekMode) => Effect.Effect<bigint, PlatformError>
879
888
  readonly sync: Effect.Effect<void, PlatformError>
880
- readonly read: (buffer: Uint8Array) => Effect.Effect<number, PlatformError>
881
- readonly readAlloc: (size: number) => Effect.Effect<Option.Option<Uint8Array>, PlatformError>
889
+ /**
890
+ * Reads into `buffer`, returning the byte count or `0` at EOF. Advances the
891
+ * cursor unless `options.position` is set (see `File.ReadOptions`).
892
+ */
893
+ readonly read: (buffer: Uint8Array, options?: File.ReadOptions) => Effect.Effect<number, PlatformError>
894
+ /**
895
+ * Reads up to `size` bytes into a new buffer, returning `Option.none()` at
896
+ * EOF. Advances the cursor unless `options.position` is set (see
897
+ * `File.ReadOptions`).
898
+ */
899
+ readonly readAlloc: (
900
+ size: number,
901
+ options?: File.ReadOptions
902
+ ) => Effect.Effect<Option.Option<Uint8Array>, PlatformError>
882
903
  readonly truncate: (length?: number) => Effect.Effect<void, PlatformError>
883
904
  readonly write: (buffer: Uint8Array) => Effect.Effect<number, PlatformError>
884
905
  readonly writeAll: (buffer: Uint8Array) => Effect.Effect<void, PlatformError>
@@ -892,6 +913,31 @@ export interface File {
892
913
  * @since 4.0.0
893
914
  */
894
915
  export declare namespace File {
916
+ /**
917
+ * Options for `File.read` and `File.readAlloc`.
918
+ *
919
+ * **Details**
920
+ *
921
+ * `position` is a byte offset from the start of the file. It leaves the
922
+ * cursor unchanged, fails with `BadArgument` if negative, and reads nothing
923
+ * at or past EOF.
924
+ *
925
+ * **Example** (Reading a byte range without moving the cursor)
926
+ *
927
+ * ```ts import.meta.vitest
928
+ * import type { FileSystem } from "effect"
929
+ *
930
+ * const options: FileSystem.File.ReadOptions = { position: BigInt(1024) }
931
+ * options.position // => 1024n
932
+ * ```
933
+ *
934
+ * @category models
935
+ * @since 4.1.0
936
+ */
937
+ export interface ReadOptions {
938
+ readonly position?: bigint | undefined
939
+ }
940
+
895
941
  /**
896
942
  * Enumeration of possible file system entry types.
897
943
  *