brass-runtime 1.16.0 → 1.17.0

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 (219) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +287 -23
  3. package/dist/agent/cli/main.cjs +38 -38
  4. package/dist/agent/cli/main.js +6 -6
  5. package/dist/agent/cli/main.mjs +6 -6
  6. package/dist/agent/index.cjs +7 -7
  7. package/dist/agent/index.d.ts +1 -1
  8. package/dist/agent/index.js +6 -6
  9. package/dist/agent/index.mjs +6 -6
  10. package/dist/chunk-2HQTDLHF.mjs +683 -0
  11. package/dist/chunk-36I3M4UC.mjs +370 -0
  12. package/dist/{chunk-QY5FKYEQ.js → chunk-3AYM6WPJ.js} +570 -51
  13. package/dist/chunk-3LOYJFRR.cjs +300 -0
  14. package/dist/chunk-3Y2RIUMM.js +300 -0
  15. package/dist/{chunk-7XOPAB5Q.js → chunk-4P2HHGAX.mjs} +83 -5
  16. package/dist/{chunk-N6VHMOWB.cjs → chunk-4ROBZFL6.cjs} +128 -128
  17. package/dist/{chunk-NC5SDRYE.js → chunk-52OB2ROS.js} +4 -4
  18. package/dist/{chunk-JX3LZQJH.cjs → chunk-52PPNNI4.cjs} +82 -20
  19. package/dist/{chunk-5YOQOXEQ.cjs → chunk-5EC274J5.cjs} +676 -293
  20. package/dist/chunk-5QC7LRZ3.js +229 -0
  21. package/dist/{chunk-7TL2LHQJ.js → chunk-5VRJNBLZ.mjs} +524 -141
  22. package/dist/chunk-62AZW6UT.cjs +313 -0
  23. package/dist/chunk-6IXXWIUM.js +683 -0
  24. package/dist/chunk-6RY2FFN4.mjs +2024 -0
  25. package/dist/chunk-74ZTY6CP.js +2871 -0
  26. package/dist/chunk-7CMJS3QE.mjs +2871 -0
  27. package/dist/{chunk-2WC63LJK.mjs → chunk-7JIJOVCT.js} +20 -10
  28. package/dist/chunk-7X3K5RMS.js +2024 -0
  29. package/dist/chunk-7ZPEZ57L.cjs +2024 -0
  30. package/dist/{chunk-FM4W4QPL.js → chunk-A2OM6NEH.mjs} +5 -4
  31. package/dist/chunk-AGR5B2BC.cjs +683 -0
  32. package/dist/chunk-B33ICAKP.js +313 -0
  33. package/dist/{chunk-J3H54ZRV.mjs → chunk-B5JD23U7.mjs} +1 -1
  34. package/dist/{chunk-F5EUMJL7.mjs → chunk-BKK77SBA.js} +83 -5
  35. package/dist/{chunk-U5KWK3PX.mjs → chunk-C3MDXTRZ.js} +11 -0
  36. package/dist/{chunk-SPUEME2B.cjs → chunk-CZIVE6NT.cjs} +12 -1
  37. package/dist/{chunk-TDVMADDN.js → chunk-DNFJLJMW.mjs} +11 -0
  38. package/dist/{chunk-XDZOO4L5.js → chunk-EJ6BPYVR.mjs} +79 -17
  39. package/dist/chunk-EOC4UHBS.mjs +229 -0
  40. package/dist/chunk-F6XWZQY4.cjs +777 -0
  41. package/dist/{chunk-7LVI2GIN.js → chunk-FH2X7BVP.js} +507 -72
  42. package/dist/{chunk-OOGJ73B6.js → chunk-FHQGHPMO.mjs} +20 -10
  43. package/dist/{chunk-WQ5QNU5R.cjs → chunk-GLE2WY7Z.cjs} +652 -217
  44. package/dist/{chunk-G6IQOE4P.mjs → chunk-GYM3LLGS.mjs} +507 -72
  45. package/dist/{chunk-TVN5I4U6.cjs → chunk-JF5WGYJJ.cjs} +25 -24
  46. package/dist/{chunk-CY33PGEX.mjs → chunk-KH4SYAOS.mjs} +570 -51
  47. package/dist/chunk-KN32XNTH.mjs +313 -0
  48. package/dist/chunk-KQLYONSE.cjs +2871 -0
  49. package/dist/{chunk-7HUOJA4W.cjs → chunk-KZJQ723N.cjs} +90 -80
  50. package/dist/{chunk-CCKHV5BT.mjs → chunk-L2SYFEBS.js} +5 -4
  51. package/dist/{chunk-IJT6RRQ5.cjs → chunk-L6VB5N7Q.cjs} +20 -9
  52. package/dist/{chunk-ZGLD4TVZ.mjs → chunk-MBEJI5HF.mjs} +4 -4
  53. package/dist/{chunk-PRWCB3QL.mjs → chunk-MIIYDLGM.js} +524 -141
  54. package/dist/{chunk-H55LI6WY.js → chunk-MOO4L7F4.mjs} +15 -4
  55. package/dist/chunk-MVGUEJ5Z.cjs +370 -0
  56. package/dist/chunk-PD4EJTQC.cjs +229 -0
  57. package/dist/chunk-PWC3RBQE.mjs +300 -0
  58. package/dist/{chunk-MWXMNYJS.cjs → chunk-Q2I37RP3.cjs} +643 -124
  59. package/dist/{chunk-VFIUZG7J.mjs → chunk-RKGKFN2A.js} +79 -17
  60. package/dist/{chunk-NYL4D7SK.cjs → chunk-SA6HUJVI.cjs} +5 -5
  61. package/dist/chunk-SK7UZRNI.mjs +777 -0
  62. package/dist/{chunk-K2T3DV26.mjs → chunk-TRM4JUZQ.js} +15 -4
  63. package/dist/chunk-UB4B6OFY.js +370 -0
  64. package/dist/{chunk-G3XGCZDQ.js → chunk-UCUBNWM2.js} +1 -1
  65. package/dist/chunk-VWIPB6I5.js +777 -0
  66. package/dist/{chunk-JNFRRJYH.cjs → chunk-WBGRHGBP.cjs} +270 -192
  67. package/dist/{client-CtFmoDvM.d.ts → client-CZHU674n.d.ts} +211 -36
  68. package/dist/core/index.cjs +135 -9
  69. package/dist/core/index.d.ts +238 -33
  70. package/dist/core/index.js +155 -29
  71. package/dist/core/index.mjs +155 -29
  72. package/dist/{effect-CGNl5Rqp.d.ts → effect-DIUHZ9IN.d.ts} +89 -1
  73. package/dist/effectRunner-CFLC32IK.cjs +8 -0
  74. package/dist/{effectRunner-A4CHJXJI.js → effectRunner-L4S7IPT3.js} +2 -2
  75. package/dist/{effectRunner-OPUF6QRN.mjs → effectRunner-NNGG75QA.mjs} +2 -2
  76. package/dist/http/index.cjs +324 -2986
  77. package/dist/http/index.d.ts +54 -68
  78. package/dist/http/index.js +238 -2900
  79. package/dist/http/index.mjs +238 -2900
  80. package/dist/http/testing.cjs +14 -12
  81. package/dist/http/testing.d.ts +5 -4
  82. package/dist/http/testing.js +10 -8
  83. package/dist/http/testing.mjs +10 -8
  84. package/dist/index.cjs +423 -255
  85. package/dist/index.d.ts +87 -69
  86. package/dist/index.js +301 -133
  87. package/dist/index.mjs +301 -133
  88. package/dist/observability/index.cjs +18 -531
  89. package/dist/observability/index.d.ts +81 -8
  90. package/dist/observability/index.js +25 -538
  91. package/dist/observability/index.mjs +25 -538
  92. package/dist/perf/cli.cjs +401 -0
  93. package/dist/perf/cli.d.ts +1 -0
  94. package/dist/perf/cli.js +401 -0
  95. package/dist/perf/cli.mjs +401 -0
  96. package/dist/perf/index.cjs +141 -0
  97. package/dist/perf/index.d.ts +483 -0
  98. package/dist/perf/index.js +141 -0
  99. package/dist/perf/index.mjs +141 -0
  100. package/dist/schedule-CK3Ml_7p.d.ts +259 -0
  101. package/dist/schema/index.cjs +6 -2
  102. package/dist/schema/index.d.ts +3 -1
  103. package/dist/schema/index.js +5 -1
  104. package/dist/schema/index.mjs +5 -1
  105. package/dist/{server-C8hDXA74.d.ts → server-D6JZ15_e.d.ts} +16 -4
  106. package/dist/{stream-dvSs0QS5.d.ts → stream-B4oK9JFP.d.ts} +1 -1
  107. package/dist/{tracer-B5tRH9H7.d.ts → tracer-Hwt1cl7h.d.ts} +13 -54
  108. package/dist/{tracing-Dt9S_6V8.d.ts → tracing-DqbTKGcf.d.ts} +1 -1
  109. package/docs/ARCHITECTURE.md +292 -0
  110. package/docs/README.md +65 -0
  111. package/docs/adr/0001-ai-context-pack.md +32 -0
  112. package/docs/agent-apply-mode.md +104 -0
  113. package/docs/agent-approvals.md +110 -0
  114. package/docs/agent-batch.md +185 -0
  115. package/docs/agent-boundaries.md +112 -0
  116. package/docs/agent-chat-sessions.md +160 -0
  117. package/docs/agent-ci.md +17 -0
  118. package/docs/agent-cli.md +405 -0
  119. package/docs/agent-config.md +480 -0
  120. package/docs/agent-context-discovery.md +159 -0
  121. package/docs/agent-copilot-like-dx.md +126 -0
  122. package/docs/agent-declarative-optimized-planning.md +138 -0
  123. package/docs/agent-dx.md +224 -0
  124. package/docs/agent-env-files.md +126 -0
  125. package/docs/agent-follow-up-context.md +43 -0
  126. package/docs/agent-global-usage.md +180 -0
  127. package/docs/agent-init.md +109 -0
  128. package/docs/agent-install-and-configure.md +516 -0
  129. package/docs/agent-language-workspace-ux.md +99 -0
  130. package/docs/agent-llm-adapters.md +123 -0
  131. package/docs/agent-local-install.md +190 -0
  132. package/docs/agent-local-tests.md +51 -0
  133. package/docs/agent-observability.md +155 -0
  134. package/docs/agent-patch-quality-loop.md +162 -0
  135. package/docs/agent-presets.md +22 -0
  136. package/docs/agent-project-commands.md +237 -0
  137. package/docs/agent-project-intelligence.md +156 -0
  138. package/docs/agent-redaction.md +18 -0
  139. package/docs/agent-release-readiness.md +76 -0
  140. package/docs/agent-rollback-safety.md +162 -0
  141. package/docs/agent-rollback.md +23 -0
  142. package/docs/agent-run-artifacts.md +16 -0
  143. package/docs/agent-vscode-auto-discovery.md +137 -0
  144. package/docs/agent-vscode-batch-runner.md +100 -0
  145. package/docs/agent-vscode-chat-layout.md +90 -0
  146. package/docs/agent-vscode-clean-install.md +147 -0
  147. package/docs/agent-vscode-code-actions.md +70 -0
  148. package/docs/agent-vscode-diff-preview.md +45 -0
  149. package/docs/agent-vscode-inline-assist.md +56 -0
  150. package/docs/agent-vscode-install.md +186 -0
  151. package/docs/agent-vscode-model-setup.md +97 -0
  152. package/docs/agent-vscode-patch-preview.md +92 -0
  153. package/docs/agent-vscode-problems.md +79 -0
  154. package/docs/agent-vscode-project-dashboard.md +106 -0
  155. package/docs/agent-vscode-run-history.md +92 -0
  156. package/docs/agent-vscode-ux.md +73 -0
  157. package/docs/ai/INVARIANTS.md +84 -0
  158. package/docs/ai/PROJECT_MAP.md +338 -0
  159. package/docs/ai/PUBLIC_API.md +339 -0
  160. package/docs/ai/VALIDATION_MATRIX.md +67 -0
  161. package/docs/api-polish.md +37 -0
  162. package/docs/cancellation.md +162 -0
  163. package/docs/coverage.md +46 -0
  164. package/docs/framework-integrations.md +38 -0
  165. package/docs/frameworks/angular.md +153 -0
  166. package/docs/frameworks/express.md +125 -0
  167. package/docs/frameworks/fastify.md +124 -0
  168. package/docs/frameworks/nestjs.md +282 -0
  169. package/docs/frameworks/nextjs.md +147 -0
  170. package/docs/frameworks/react.md +139 -0
  171. package/docs/frameworks/vanilla.md +224 -0
  172. package/docs/getting-started.md +159 -0
  173. package/docs/guides/README.md +40 -0
  174. package/docs/guides/circuit-breaker.md +89 -0
  175. package/docs/guides/error-handling.md +91 -0
  176. package/docs/guides/getting-started.md +107 -0
  177. package/docs/guides/layers.md +189 -0
  178. package/docs/guides/metrics.md +101 -0
  179. package/docs/guides/resource-management.md +141 -0
  180. package/docs/guides/retry.md +215 -0
  181. package/docs/guides/semaphore.md +66 -0
  182. package/docs/guides/streams.md +117 -0
  183. package/docs/guides/supervisors.md +98 -0
  184. package/docs/guides/testing.md +162 -0
  185. package/docs/guides/tracing.md +71 -0
  186. package/docs/http-recipes.md +399 -0
  187. package/docs/http.md +749 -0
  188. package/docs/modules.md +285 -0
  189. package/docs/nestjs.md +6 -0
  190. package/docs/observability-collector-smoke.md +31 -0
  191. package/docs/observability-framework-examples.md +110 -0
  192. package/docs/observability.md +649 -0
  193. package/docs/otel-collector-smoke.yaml +27 -0
  194. package/docs/performance-profiler.md +199 -0
  195. package/docs/production-readiness.md +73 -0
  196. package/docs/recipes/README.md +12 -0
  197. package/docs/recipes/http-server.md +45 -0
  198. package/docs/recipes/layers.md +44 -0
  199. package/docs/recipes/performance.md +47 -0
  200. package/docs/recipes/runtime.md +41 -0
  201. package/docs/recipes/testing.md +41 -0
  202. package/docs/release.md +53 -0
  203. package/docs/wasm-bounded-queues.md +44 -0
  204. package/docs/wasm-engine-observability-benchmarks.md +85 -0
  205. package/docs/wasm-fiber-engine.md +117 -0
  206. package/docs/wasm-scheduler-state-machine.md +122 -0
  207. package/docs/wasm-stream-chunks.md +54 -0
  208. package/package.json +22 -2
  209. package/dist/chunk-45F7OKGT.cjs +0 -104
  210. package/dist/chunk-7V4KY4RL.mjs +0 -104
  211. package/dist/chunk-DJQ7OMMB.cjs +0 -144
  212. package/dist/chunk-GOV47PPB.mjs +0 -552
  213. package/dist/chunk-JF4XXPZ5.cjs +0 -552
  214. package/dist/chunk-KCPT2D6G.js +0 -552
  215. package/dist/chunk-NOYZIMUJ.mjs +0 -144
  216. package/dist/chunk-PNVFW245.js +0 -144
  217. package/dist/chunk-ROJC3NBJ.js +0 -104
  218. package/dist/effectRunner-3ZHAD3LE.cjs +0 -8
  219. package/dist/schedule-Fque9Abz.d.ts +0 -70
@@ -1,144 +0,0 @@
1
- // src/core/types/asyncEffect.ts
2
- var Async = {
3
- succeed: (value) => ({ _tag: "Succeed", value }),
4
- fail: (error) => ({ _tag: "Fail", error }),
5
- sync: (thunk) => ({ _tag: "Sync", thunk }),
6
- async: (register) => ({ _tag: "Async", register })
7
- };
8
- function asyncFold(fa, onFailure, onSuccess) {
9
- return {
10
- _tag: "Fold",
11
- first: fa,
12
- onFailure,
13
- onSuccess
14
- };
15
- }
16
- function asyncCatchAll(fa, handler) {
17
- return asyncFold(fa, handler, asyncSucceed);
18
- }
19
- function asyncMapError(fa, f) {
20
- return asyncFold(fa, (e) => asyncFail(f(e)), asyncSucceed);
21
- }
22
- var SUCCEED_UNDEFINED = { _tag: "Succeed", value: void 0 };
23
- var SUCCEED_TRUE = { _tag: "Succeed", value: true };
24
- var SUCCEED_FALSE = { _tag: "Succeed", value: false };
25
- var SUCCEED_NULL = { _tag: "Succeed", value: null };
26
- var unit = () => SUCCEED_UNDEFINED;
27
- var asyncSucceed = (value) => {
28
- if (value === void 0) return SUCCEED_UNDEFINED;
29
- if (value === true) return SUCCEED_TRUE;
30
- if (value === false) return SUCCEED_FALSE;
31
- if (value === null) return SUCCEED_NULL;
32
- return { _tag: "Succeed", value };
33
- };
34
- var asyncFail = (error) => ({
35
- _tag: "Fail",
36
- error
37
- });
38
- var asyncSync = (thunk) => ({
39
- _tag: "Sync",
40
- thunk
41
- });
42
- var asyncTotal = (thunk) => asyncSync(() => thunk());
43
- var asyncEffect = (register) => ({
44
- _tag: "Async",
45
- register
46
- });
47
- function asyncMap(fa, f) {
48
- return asyncFlatMap(fa, (a) => asyncSucceed(f(a)));
49
- }
50
- function asyncFlatMap(fa, f) {
51
- return {
52
- _tag: "FlatMap",
53
- first: fa,
54
- andThen: f
55
- };
56
- }
57
- function acquireRelease(acquire, release, scope) {
58
- return asyncFlatMap(acquire, (resource) => {
59
- scope.addFinalizer((exit) => release(resource, exit));
60
- return asyncSucceed(resource);
61
- });
62
- }
63
- function asyncInterruptible(register) {
64
- return asyncEffect(register);
65
- }
66
- var withAsyncPromise = (run) => (eff) => {
67
- const anyEff = eff;
68
- if (!anyEff.toPromise) {
69
- anyEff.toPromise = (env) => run(eff, env);
70
- anyEff.unsafeRunPromise = () => run(eff, {});
71
- }
72
- return anyEff;
73
- };
74
- var mapAsync = (fa, f) => asyncFlatMap(fa, (a) => asyncSucceed(f(a)));
75
- var mapTryAsync = (fa, f) => asyncFlatMap(fa, (a) => asyncSync(() => f(a)));
76
-
77
- // src/core/types/option.ts
78
- var none = { _tag: "None" };
79
- var some = (value) => ({ _tag: "Some", value });
80
-
81
- // src/core/types/effect.ts
82
- var Cause = {
83
- fail: (error) => ({ _tag: "Fail", error }),
84
- interrupt: () => ({ _tag: "Interrupt" }),
85
- die: (defect) => ({ _tag: "Die", defect })
86
- };
87
- var Exit = {
88
- succeed: (value) => ({
89
- _tag: "Success",
90
- value
91
- }),
92
- failCause: (cause) => ({
93
- _tag: "Failure",
94
- cause
95
- })
96
- };
97
- var succeed = (value) => asyncSucceed(value);
98
- var fail = (error) => asyncFail(error);
99
- var sync = (thunk) => asyncSync((env) => thunk(env));
100
- var map = (fa, f) => asyncMap(fa, f);
101
- var flatMap = (fa, f) => asyncFlatMap(fa, f);
102
- var mapError = (fa, f) => asyncMapError(fa, f);
103
- var catchAll = (fa, handler) => asyncFold(fa, handler, asyncSucceed);
104
- function orElseOptional(fa, that) {
105
- return asyncFold(
106
- fa,
107
- (opt) => opt._tag === "Some" ? asyncFail(opt) : that(),
108
- asyncSucceed
109
- );
110
- }
111
- var end = () => fail(none);
112
-
113
- export {
114
- Async,
115
- asyncFold,
116
- asyncCatchAll,
117
- asyncMapError,
118
- unit,
119
- asyncSucceed,
120
- asyncFail,
121
- asyncSync,
122
- asyncTotal,
123
- asyncEffect,
124
- asyncMap,
125
- asyncFlatMap,
126
- acquireRelease,
127
- asyncInterruptible,
128
- withAsyncPromise,
129
- mapAsync,
130
- mapTryAsync,
131
- none,
132
- some,
133
- Cause,
134
- Exit,
135
- succeed,
136
- fail,
137
- sync,
138
- map,
139
- flatMap,
140
- mapError,
141
- catchAll,
142
- orElseOptional,
143
- end
144
- };
@@ -1,104 +0,0 @@
1
- import {
2
- unsafeGetCurrentRuntime
3
- } from "./chunk-7LVI2GIN.js";
4
- import {
5
- asyncEffect,
6
- asyncFail,
7
- asyncFlatMap,
8
- asyncFold,
9
- asyncSucceed
10
- } from "./chunk-PNVFW245.js";
11
-
12
- // src/core/runtime/combinators.ts
13
- function sleep(ms) {
14
- return asyncEffect((_env, cb) => {
15
- const delay = Math.max(0, Math.floor(ms));
16
- const id = setTimeout(() => cb({ _tag: "Success", value: void 0 }), delay);
17
- return () => clearTimeout(id);
18
- });
19
- }
20
- function timeout(effect, ms) {
21
- return asyncEffect((env, cb) => {
22
- let done = false;
23
- let timerId;
24
- let effectRunning = true;
25
- timerId = setTimeout(() => {
26
- if (done) return;
27
- done = true;
28
- effectRunning = false;
29
- cb({
30
- _tag: "Failure",
31
- cause: { _tag: "Fail", error: { _tag: "TimeoutError", ms } }
32
- });
33
- }, Math.max(0, Math.floor(ms)));
34
- const runtime = unsafeGetCurrentRuntime();
35
- const fiber = runtime.fork(effect);
36
- fiber.join((exit) => {
37
- if (done) return;
38
- done = true;
39
- clearTimeout(timerId);
40
- cb(exit);
41
- });
42
- return () => {
43
- if (done) return;
44
- done = true;
45
- clearTimeout(timerId);
46
- fiber.interrupt();
47
- };
48
- });
49
- }
50
- function retry(effect, policy) {
51
- const shouldRetry = policy.shouldRetry ?? (() => true);
52
- const jitter = policy.jitter ?? "full";
53
- const maxElapsedMs = policy.maxElapsedMs;
54
- const computeDelay = (attempt) => {
55
- const exp = policy.baseDelayMs * Math.pow(2, attempt);
56
- const capped = Math.min(exp, policy.maxDelayMs);
57
- if (jitter === "none") return capped;
58
- return Math.floor(Math.random() * capped);
59
- };
60
- const loop = (attempt, startedAt) => asyncFold(
61
- effect,
62
- (error) => {
63
- if (attempt >= policy.maxRetries) return asyncFail(error);
64
- if (!shouldRetry(error, attempt)) return asyncFail(error);
65
- if (maxElapsedMs !== void 0) {
66
- const elapsed = performance.now() - startedAt;
67
- if (elapsed >= maxElapsedMs) return asyncFail(error);
68
- }
69
- const delay = computeDelay(attempt);
70
- return asyncFlatMap(sleep(delay), () => loop(attempt + 1, startedAt));
71
- },
72
- (value) => asyncSucceed(value)
73
- );
74
- return asyncFlatMap(
75
- { _tag: "Sync", thunk: () => performance.now() },
76
- (startedAt) => loop(0, startedAt)
77
- );
78
- }
79
- function retryN(effect, n) {
80
- return retry(effect, {
81
- maxRetries: n,
82
- baseDelayMs: 0,
83
- maxDelayMs: 0,
84
- jitter: "none"
85
- });
86
- }
87
- function retryWithBackoff(effect, opts = {}) {
88
- return retry(effect, {
89
- maxRetries: opts.maxRetries ?? 3,
90
- baseDelayMs: opts.baseDelayMs ?? 100,
91
- maxDelayMs: opts.maxDelayMs ?? 1e4,
92
- maxElapsedMs: opts.maxElapsedMs,
93
- shouldRetry: opts.shouldRetry,
94
- jitter: "full"
95
- });
96
- }
97
-
98
- export {
99
- sleep,
100
- timeout,
101
- retry,
102
- retryN,
103
- retryWithBackoff
104
- };
@@ -1,8 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkIJT6RRQ5cjs = require('./chunk-IJT6RRQ5.cjs');
4
- require('./chunk-DJQ7OMMB.cjs');
5
- require('./chunk-OBGZSXTJ.cjs');
6
-
7
-
8
- exports.registerHttpEffect = _chunkIJT6RRQ5cjs.registerHttpEffect;
@@ -1,70 +0,0 @@
1
- import { A as Async } from './effect-CGNl5Rqp.js';
2
-
3
- type ScheduleDecision = {
4
- readonly continue: boolean;
5
- readonly delayMs: number;
6
- };
7
- type ScheduleJitterOptions = {
8
- /** 1 means full jitter in [0, delay], 0.2 means +/-20% around delay. */
9
- readonly factor?: number;
10
- /** Deterministic hook for tests. Defaults to Math.random. */
11
- readonly random?: () => number;
12
- };
13
- /**
14
- * A Schedule<I, O> takes an input I (typically the error or output of an effect)
15
- * and decides whether to continue and with what delay.
16
- */
17
- type Schedule<I, O> = {
18
- readonly _tag: "Schedule";
19
- /** Initial state */
20
- readonly initial: () => any;
21
- /** Given current state and input, produce a decision and next state */
22
- readonly step: (state: any, input: I) => [ScheduleDecision, any, O];
23
- };
24
- /** Retry/repeat up to N times with no delay. */
25
- declare function recurs(n: number): Schedule<unknown, number>;
26
- /** Fixed delay between each retry/repeat. */
27
- declare function fixed(delayMs: number): Schedule<unknown, number>;
28
- /** Exponential backoff: delay doubles each time, capped at maxDelayMs. */
29
- declare function exponential(baseMs: number, maxMs?: number): Schedule<unknown, number>;
30
- /** Fibonacci backoff: base, base, 2*base, 3*base, 5*base, capped at maxDelayMs. */
31
- declare function fibonacci(baseMs: number, maxMs?: number): Schedule<unknown, number>;
32
- /** Exponential backoff with full jitter (random in [0, delay]). */
33
- declare function jittered(baseMs: number, maxMs?: number): Schedule<unknown, number>;
34
- /** Stop after a total elapsed time. */
35
- declare function elapsed(maxMs: number): Schedule<unknown, number>;
36
- /** Only continue while a predicate holds on the input. */
37
- declare function whileInput<I>(pred: (input: I) => boolean): Schedule<I, I>;
38
- /** Limit a schedule to N repetitions. */
39
- declare function take<I, O>(schedule: Schedule<I, O>, n: number): Schedule<I, O>;
40
- /** Transform schedule output while preserving decisions and state. */
41
- declare function map<I, O, O2>(schedule: Schedule<I, O>, f: (output: O) => O2): Schedule<I, O2>;
42
- /** Transform schedule input before it reaches the wrapped schedule. */
43
- declare function contramap<I0, I, O>(schedule: Schedule<I, O>, f: (input: I0) => I): Schedule<I0, O>;
44
- /** Add jitter to any schedule's delay. */
45
- declare function jitteredSchedule<I, O>(schedule: Schedule<I, O>, options?: number | ScheduleJitterOptions): Schedule<I, O>;
46
- declare const jitter: typeof jitteredSchedule;
47
- /**
48
- * Reset a schedule's internal state after a rolling time window.
49
- * Useful for retry/polling policies that should forgive old bursts.
50
- */
51
- declare function windowed<I, O>(schedule: Schedule<I, O>, windowMs: number, clock?: () => number): Schedule<I, O>;
52
- /** Compose two schedules: use the first, then switch to the second. */
53
- declare function andThen<I, O1, O2>(first: Schedule<I, O1>, second: Schedule<I, O2>): Schedule<I, O1 | O2>;
54
- /** Run both schedules and continue while BOTH say continue. Use max delay. */
55
- declare function intersect<I, O1, O2>(left: Schedule<I, O1>, right: Schedule<I, O2>): Schedule<I, [O1, O2]>;
56
- /** Run both schedules and continue while EITHER says continue. Use min delay. */
57
- declare function union<I, O1, O2>(left: Schedule<I, O1>, right: Schedule<I, O2>): Schedule<I, [O1, O2]>;
58
- /**
59
- * Retry an effect according to a schedule.
60
- * The schedule receives the error as input on each failure.
61
- */
62
- declare function retryWithSchedule<R, E, A, O>(effect: Async<R, E, A>, schedule: Schedule<E, O>): Async<R, E, A>;
63
- /**
64
- * Repeat an effect according to a schedule.
65
- * The schedule receives the success value as input on each iteration.
66
- * Returns the last successful value.
67
- */
68
- declare function repeatWithSchedule<R, E, A, O>(effect: Async<R, E, A>, schedule: Schedule<A, O>): Async<R, E, A>;
69
-
70
- export { type Schedule as S, type ScheduleDecision as a, andThen as b, contramap as c, exponential as d, elapsed as e, fibonacci as f, fixed as g, jittered as h, intersect as i, jitter as j, jitteredSchedule as k, repeatWithSchedule as l, map as m, retryWithSchedule as n, windowed as o, recurs as r, take as t, union as u, whileInput as w };