brass-runtime 1.16.0 → 1.16.1
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.
- package/CHANGELOG.md +17 -0
- package/README.md +283 -18
- package/dist/agent/cli/main.cjs +38 -38
- package/dist/agent/cli/main.js +6 -6
- package/dist/agent/cli/main.mjs +6 -6
- package/dist/agent/index.cjs +7 -7
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +6 -6
- package/dist/agent/index.mjs +6 -6
- package/dist/chunk-2HQTDLHF.mjs +683 -0
- package/dist/chunk-36I3M4UC.mjs +370 -0
- package/dist/{chunk-QY5FKYEQ.js → chunk-3AYM6WPJ.js} +570 -51
- package/dist/chunk-3LOYJFRR.cjs +300 -0
- package/dist/chunk-3Y2RIUMM.js +300 -0
- package/dist/{chunk-N6VHMOWB.cjs → chunk-4ROBZFL6.cjs} +128 -128
- package/dist/{chunk-NC5SDRYE.js → chunk-52OB2ROS.js} +4 -4
- package/dist/{chunk-JX3LZQJH.cjs → chunk-52PPNNI4.cjs} +82 -20
- package/dist/{chunk-5YOQOXEQ.cjs → chunk-5EC274J5.cjs} +676 -293
- package/dist/chunk-5QC7LRZ3.js +229 -0
- package/dist/{chunk-7TL2LHQJ.js → chunk-5VRJNBLZ.mjs} +524 -141
- package/dist/chunk-62AZW6UT.cjs +313 -0
- package/dist/chunk-6IXXWIUM.js +683 -0
- package/dist/chunk-74ZTY6CP.js +2871 -0
- package/dist/chunk-76YMRMH2.cjs +777 -0
- package/dist/chunk-7CMJS3QE.mjs +2871 -0
- package/dist/{chunk-2WC63LJK.mjs → chunk-7JIJOVCT.js} +20 -10
- package/dist/{chunk-FM4W4QPL.js → chunk-A2OM6NEH.mjs} +5 -4
- package/dist/chunk-AGR5B2BC.cjs +683 -0
- package/dist/chunk-AVNQLJ5V.js +777 -0
- package/dist/chunk-B33ICAKP.js +313 -0
- package/dist/{chunk-J3H54ZRV.mjs → chunk-B5JD23U7.mjs} +1 -1
- package/dist/chunk-BABBZK4Y.js +2024 -0
- package/dist/{chunk-U5KWK3PX.mjs → chunk-C3MDXTRZ.js} +11 -0
- package/dist/{chunk-F5EUMJL7.mjs → chunk-CIZFIMK5.js} +55 -5
- package/dist/{chunk-SPUEME2B.cjs → chunk-CZIVE6NT.cjs} +12 -1
- package/dist/{chunk-TDVMADDN.js → chunk-DNFJLJMW.mjs} +11 -0
- package/dist/chunk-DNFO2EIZ.mjs +777 -0
- package/dist/{chunk-XDZOO4L5.js → chunk-EJ6BPYVR.mjs} +79 -17
- package/dist/{chunk-JNFRRJYH.cjs → chunk-ENKODRU3.cjs} +242 -192
- package/dist/chunk-EOC4UHBS.mjs +229 -0
- package/dist/{chunk-7LVI2GIN.js → chunk-FH2X7BVP.js} +507 -72
- package/dist/{chunk-OOGJ73B6.js → chunk-FHQGHPMO.mjs} +20 -10
- package/dist/{chunk-WQ5QNU5R.cjs → chunk-GLE2WY7Z.cjs} +652 -217
- package/dist/{chunk-G6IQOE4P.mjs → chunk-GYM3LLGS.mjs} +507 -72
- package/dist/chunk-HLWLMW2F.mjs +2024 -0
- package/dist/{chunk-TVN5I4U6.cjs → chunk-JF5WGYJJ.cjs} +25 -24
- package/dist/{chunk-CY33PGEX.mjs → chunk-KH4SYAOS.mjs} +570 -51
- package/dist/chunk-KN32XNTH.mjs +313 -0
- package/dist/chunk-KQLYONSE.cjs +2871 -0
- package/dist/{chunk-7HUOJA4W.cjs → chunk-KZJQ723N.cjs} +90 -80
- package/dist/{chunk-CCKHV5BT.mjs → chunk-L2SYFEBS.js} +5 -4
- package/dist/{chunk-IJT6RRQ5.cjs → chunk-L6VB5N7Q.cjs} +20 -9
- package/dist/{chunk-ZGLD4TVZ.mjs → chunk-MBEJI5HF.mjs} +4 -4
- package/dist/{chunk-PRWCB3QL.mjs → chunk-MIIYDLGM.js} +524 -141
- package/dist/{chunk-H55LI6WY.js → chunk-MOO4L7F4.mjs} +15 -4
- package/dist/{chunk-7XOPAB5Q.js → chunk-MT3OWDPC.mjs} +55 -5
- package/dist/chunk-MVGUEJ5Z.cjs +370 -0
- package/dist/chunk-PD4EJTQC.cjs +229 -0
- package/dist/chunk-PWC3RBQE.mjs +300 -0
- package/dist/{chunk-MWXMNYJS.cjs → chunk-Q2I37RP3.cjs} +643 -124
- package/dist/{chunk-VFIUZG7J.mjs → chunk-RKGKFN2A.js} +79 -17
- package/dist/{chunk-NYL4D7SK.cjs → chunk-SA6HUJVI.cjs} +5 -5
- package/dist/{chunk-K2T3DV26.mjs → chunk-TRM4JUZQ.js} +15 -4
- package/dist/chunk-UB4B6OFY.js +370 -0
- package/dist/{chunk-G3XGCZDQ.js → chunk-UCUBNWM2.js} +1 -1
- package/dist/chunk-VN44DYYT.cjs +2024 -0
- package/dist/{client-CtFmoDvM.d.ts → client-CZHU674n.d.ts} +211 -36
- package/dist/core/index.cjs +135 -9
- package/dist/core/index.d.ts +238 -33
- package/dist/core/index.js +155 -29
- package/dist/core/index.mjs +155 -29
- package/dist/{effect-CGNl5Rqp.d.ts → effect-DIUHZ9IN.d.ts} +89 -1
- package/dist/effectRunner-CFLC32IK.cjs +8 -0
- package/dist/{effectRunner-A4CHJXJI.js → effectRunner-L4S7IPT3.js} +2 -2
- package/dist/{effectRunner-OPUF6QRN.mjs → effectRunner-NNGG75QA.mjs} +2 -2
- package/dist/http/index.cjs +324 -2986
- package/dist/http/index.d.ts +54 -68
- package/dist/http/index.js +238 -2900
- package/dist/http/index.mjs +238 -2900
- package/dist/http/testing.cjs +14 -12
- package/dist/http/testing.d.ts +5 -4
- package/dist/http/testing.js +10 -8
- package/dist/http/testing.mjs +10 -8
- package/dist/index.cjs +423 -255
- package/dist/index.d.ts +87 -69
- package/dist/index.js +301 -133
- package/dist/index.mjs +301 -133
- package/dist/observability/index.cjs +16 -531
- package/dist/observability/index.d.ts +81 -8
- package/dist/observability/index.js +23 -538
- package/dist/observability/index.mjs +23 -538
- package/dist/perf/cli.cjs +401 -0
- package/dist/perf/cli.d.ts +1 -0
- package/dist/perf/cli.js +401 -0
- package/dist/perf/cli.mjs +401 -0
- package/dist/perf/index.cjs +141 -0
- package/dist/perf/index.d.ts +483 -0
- package/dist/perf/index.js +141 -0
- package/dist/perf/index.mjs +141 -0
- package/dist/schedule-CK3Ml_7p.d.ts +259 -0
- package/dist/schema/index.cjs +6 -2
- package/dist/schema/index.d.ts +3 -1
- package/dist/schema/index.js +5 -1
- package/dist/schema/index.mjs +5 -1
- package/dist/{server-C8hDXA74.d.ts → server-GJPg8ZSG.d.ts} +4 -3
- package/dist/{stream-dvSs0QS5.d.ts → stream-B4oK9JFP.d.ts} +1 -1
- package/dist/{tracer-B5tRH9H7.d.ts → tracer-Hwt1cl7h.d.ts} +13 -54
- package/dist/{tracing-Dt9S_6V8.d.ts → tracing-DqbTKGcf.d.ts} +1 -1
- package/docs/ARCHITECTURE.md +292 -0
- package/docs/README.md +63 -0
- package/docs/adr/0001-ai-context-pack.md +32 -0
- package/docs/agent-apply-mode.md +104 -0
- package/docs/agent-approvals.md +110 -0
- package/docs/agent-batch.md +185 -0
- package/docs/agent-boundaries.md +112 -0
- package/docs/agent-chat-sessions.md +160 -0
- package/docs/agent-ci.md +17 -0
- package/docs/agent-cli.md +405 -0
- package/docs/agent-config.md +480 -0
- package/docs/agent-context-discovery.md +159 -0
- package/docs/agent-copilot-like-dx.md +126 -0
- package/docs/agent-declarative-optimized-planning.md +138 -0
- package/docs/agent-dx.md +224 -0
- package/docs/agent-env-files.md +126 -0
- package/docs/agent-follow-up-context.md +43 -0
- package/docs/agent-global-usage.md +180 -0
- package/docs/agent-init.md +109 -0
- package/docs/agent-install-and-configure.md +516 -0
- package/docs/agent-language-workspace-ux.md +99 -0
- package/docs/agent-llm-adapters.md +123 -0
- package/docs/agent-local-install.md +190 -0
- package/docs/agent-local-tests.md +51 -0
- package/docs/agent-observability.md +155 -0
- package/docs/agent-patch-quality-loop.md +162 -0
- package/docs/agent-presets.md +22 -0
- package/docs/agent-project-commands.md +237 -0
- package/docs/agent-project-intelligence.md +156 -0
- package/docs/agent-redaction.md +18 -0
- package/docs/agent-release-readiness.md +76 -0
- package/docs/agent-rollback-safety.md +162 -0
- package/docs/agent-rollback.md +23 -0
- package/docs/agent-run-artifacts.md +16 -0
- package/docs/agent-vscode-auto-discovery.md +137 -0
- package/docs/agent-vscode-batch-runner.md +100 -0
- package/docs/agent-vscode-chat-layout.md +90 -0
- package/docs/agent-vscode-clean-install.md +147 -0
- package/docs/agent-vscode-code-actions.md +70 -0
- package/docs/agent-vscode-diff-preview.md +45 -0
- package/docs/agent-vscode-inline-assist.md +56 -0
- package/docs/agent-vscode-install.md +186 -0
- package/docs/agent-vscode-model-setup.md +97 -0
- package/docs/agent-vscode-patch-preview.md +92 -0
- package/docs/agent-vscode-problems.md +79 -0
- package/docs/agent-vscode-project-dashboard.md +106 -0
- package/docs/agent-vscode-run-history.md +92 -0
- package/docs/agent-vscode-ux.md +73 -0
- package/docs/ai/INVARIANTS.md +84 -0
- package/docs/ai/PROJECT_MAP.md +338 -0
- package/docs/ai/PUBLIC_API.md +336 -0
- package/docs/ai/VALIDATION_MATRIX.md +67 -0
- package/docs/api-polish.md +37 -0
- package/docs/cancellation.md +162 -0
- package/docs/coverage.md +46 -0
- package/docs/getting-started.md +159 -0
- package/docs/guides/README.md +40 -0
- package/docs/guides/circuit-breaker.md +89 -0
- package/docs/guides/error-handling.md +91 -0
- package/docs/guides/getting-started.md +107 -0
- package/docs/guides/layers.md +189 -0
- package/docs/guides/metrics.md +101 -0
- package/docs/guides/resource-management.md +141 -0
- package/docs/guides/retry.md +215 -0
- package/docs/guides/semaphore.md +66 -0
- package/docs/guides/streams.md +117 -0
- package/docs/guides/supervisors.md +98 -0
- package/docs/guides/testing.md +162 -0
- package/docs/guides/tracing.md +71 -0
- package/docs/http-recipes.md +399 -0
- package/docs/http.md +749 -0
- package/docs/modules.md +285 -0
- package/docs/observability-collector-smoke.md +31 -0
- package/docs/observability-framework-examples.md +98 -0
- package/docs/observability.md +542 -0
- package/docs/otel-collector-smoke.yaml +27 -0
- package/docs/performance-profiler.md +199 -0
- package/docs/production-readiness.md +73 -0
- package/docs/recipes/README.md +12 -0
- package/docs/recipes/http-server.md +45 -0
- package/docs/recipes/layers.md +44 -0
- package/docs/recipes/performance.md +47 -0
- package/docs/recipes/runtime.md +41 -0
- package/docs/recipes/testing.md +41 -0
- package/docs/release.md +53 -0
- package/docs/wasm-bounded-queues.md +44 -0
- package/docs/wasm-engine-observability-benchmarks.md +85 -0
- package/docs/wasm-fiber-engine.md +117 -0
- package/docs/wasm-scheduler-state-machine.md +122 -0
- package/docs/wasm-stream-chunks.md +54 -0
- package/package.json +22 -2
- package/dist/chunk-45F7OKGT.cjs +0 -104
- package/dist/chunk-7V4KY4RL.mjs +0 -104
- package/dist/chunk-DJQ7OMMB.cjs +0 -144
- package/dist/chunk-GOV47PPB.mjs +0 -552
- package/dist/chunk-JF4XXPZ5.cjs +0 -552
- package/dist/chunk-KCPT2D6G.js +0 -552
- package/dist/chunk-NOYZIMUJ.mjs +0 -144
- package/dist/chunk-PNVFW245.js +0 -144
- package/dist/chunk-ROJC3NBJ.js +0 -104
- package/dist/effectRunner-3ZHAD3LE.cjs +0 -8
- package/dist/schedule-Fque9Abz.d.ts +0 -70
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkSA6HUJVIcjs = require('./chunk-SA6HUJVI.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkJF5WGYJJcjs = require('./chunk-JF5WGYJJ.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkGLE2WY7Zcjs = require('./chunk-GLE2WY7Z.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
@@ -28,10 +28,10 @@ var _chunkWQ5QNU5Rcjs = require('./chunk-WQ5QNU5R.cjs');
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var _chunkMVGUEJ5Zcjs = require('./chunk-MVGUEJ5Z.cjs');
|
|
32
32
|
|
|
33
33
|
// src/core/stream/stream.ts
|
|
34
|
-
var widenOpt = (opt) => opt._tag === "None" ?
|
|
34
|
+
var widenOpt = (opt) => opt._tag === "None" ? _chunkMVGUEJ5Zcjs.none : _chunkMVGUEJ5Zcjs.some.call(void 0, opt.value);
|
|
35
35
|
var fromPull = (pull) => ({
|
|
36
36
|
_tag: "FromPull",
|
|
37
37
|
pull
|
|
@@ -76,28 +76,34 @@ function streamToRaceWithHandler(winnerSide, leftStream, rightStream, flip, id)
|
|
|
76
76
|
const [a, tailWin] = exit.value;
|
|
77
77
|
otherFiber.interrupt();
|
|
78
78
|
const next = winnerSide === "L" ? fromPull(makeMergePull(tailWin, rightStream, !flip, id)) : fromPull(makeMergePull(leftStream, tailWin, !flip, id));
|
|
79
|
-
return
|
|
79
|
+
return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, [a, next]);
|
|
80
80
|
}
|
|
81
|
-
if (exit.cause
|
|
82
|
-
return
|
|
83
|
-
cb(
|
|
81
|
+
if (_chunkMVGUEJ5Zcjs.Cause.isInterruptedOnly(exit.cause)) {
|
|
82
|
+
return _chunkMVGUEJ5Zcjs.asyncEffect.call(void 0, (_env, cb) => {
|
|
83
|
+
cb(_chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.interrupt()));
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
-
const
|
|
86
|
+
const failure = _chunkMVGUEJ5Zcjs.Cause.firstFailure(exit.cause);
|
|
87
|
+
if (failure._tag === "None") {
|
|
88
|
+
return _chunkMVGUEJ5Zcjs.asyncEffect.call(void 0, (_env, cb) => {
|
|
89
|
+
cb(_chunkMVGUEJ5Zcjs.Exit.failCause(exit.cause));
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const opt = failure.value;
|
|
87
93
|
if (opt._tag === "None") {
|
|
88
94
|
return winnerSide === "L" ? uncons(rightStream) : uncons(leftStream);
|
|
89
95
|
}
|
|
90
|
-
return
|
|
96
|
+
return _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, opt);
|
|
91
97
|
};
|
|
92
98
|
}
|
|
93
99
|
function makeMergePull(onLeft, onRight, flip, mergePullId) {
|
|
94
100
|
const id = ++mergePullId;
|
|
95
101
|
const onLeftHandler = streamToRaceWithHandler("L", onLeft, onRight, flip, id);
|
|
96
102
|
const onRightHandler = streamToRaceWithHandler("R", onLeft, onRight, flip, id);
|
|
97
|
-
return
|
|
98
|
-
const runtime =
|
|
99
|
-
const scope = new (0,
|
|
100
|
-
const handler =
|
|
103
|
+
return _chunkMVGUEJ5Zcjs.asyncEffect.call(void 0, (_env, cb) => {
|
|
104
|
+
const runtime = _chunkGLE2WY7Zcjs.unsafeGetCurrentRuntime.call(void 0, );
|
|
105
|
+
const scope = new (0, _chunkJF5WGYJJcjs.Scope)(runtime);
|
|
106
|
+
const handler = _chunkSA6HUJVIcjs.raceWith.call(void 0,
|
|
101
107
|
uncons(onLeft),
|
|
102
108
|
uncons(onRight),
|
|
103
109
|
scope,
|
|
@@ -116,33 +122,33 @@ function merge(left, right) {
|
|
|
116
122
|
function uncons(self) {
|
|
117
123
|
switch (self._tag) {
|
|
118
124
|
case "Empty":
|
|
119
|
-
return
|
|
125
|
+
return _chunkMVGUEJ5Zcjs.fail.call(void 0, _chunkMVGUEJ5Zcjs.none);
|
|
120
126
|
case "FromArray": {
|
|
121
127
|
const arr = self.values;
|
|
122
|
-
if (arr.length === 0) return
|
|
128
|
+
if (arr.length === 0) return _chunkMVGUEJ5Zcjs.fail.call(void 0, _chunkMVGUEJ5Zcjs.none);
|
|
123
129
|
const tail = arr.length === 1 ? EMPTY_STREAM : { _tag: "FromArray", values: arr.slice(1) };
|
|
124
|
-
return
|
|
130
|
+
return _chunkMVGUEJ5Zcjs.succeed.call(void 0, [arr[0], tail]);
|
|
125
131
|
}
|
|
126
132
|
case "Emit":
|
|
127
|
-
return
|
|
128
|
-
|
|
133
|
+
return _chunkMVGUEJ5Zcjs.map.call(void 0,
|
|
134
|
+
_chunkMVGUEJ5Zcjs.mapError.call(void 0, self.value, (e) => _chunkMVGUEJ5Zcjs.some.call(void 0, e)),
|
|
129
135
|
(a) => [a, EMPTY_STREAM]
|
|
130
136
|
);
|
|
131
137
|
case "FromPull":
|
|
132
138
|
return self.pull;
|
|
133
139
|
case "Concat":
|
|
134
|
-
return
|
|
135
|
-
|
|
140
|
+
return _chunkMVGUEJ5Zcjs.orElseOptional.call(void 0,
|
|
141
|
+
_chunkMVGUEJ5Zcjs.map.call(void 0,
|
|
136
142
|
uncons(self.left),
|
|
137
143
|
([a, tail]) => [a, concatStream(tail, self.right)]
|
|
138
144
|
),
|
|
139
145
|
() => uncons(self.right)
|
|
140
146
|
);
|
|
141
147
|
case "Flatten":
|
|
142
|
-
return
|
|
148
|
+
return _chunkMVGUEJ5Zcjs.flatMap.call(void 0,
|
|
143
149
|
uncons(self.stream),
|
|
144
|
-
([head, tail]) =>
|
|
145
|
-
|
|
150
|
+
([head, tail]) => _chunkMVGUEJ5Zcjs.orElseOptional.call(void 0,
|
|
151
|
+
_chunkMVGUEJ5Zcjs.map.call(void 0,
|
|
146
152
|
uncons(head),
|
|
147
153
|
([a, as]) => [
|
|
148
154
|
a,
|
|
@@ -155,10 +161,10 @@ function uncons(self) {
|
|
|
155
161
|
case "Merge":
|
|
156
162
|
return makeMergePull(self.left, self.right, self.flip, 0);
|
|
157
163
|
case "Scoped":
|
|
158
|
-
return
|
|
159
|
-
const runtime =
|
|
160
|
-
const scope = new (0,
|
|
161
|
-
const fiber =
|
|
164
|
+
return _chunkMVGUEJ5Zcjs.asyncEffect.call(void 0, (env, cb) => {
|
|
165
|
+
const runtime = _chunkGLE2WY7Zcjs.unsafeGetCurrentRuntime.call(void 0, );
|
|
166
|
+
const scope = new (0, _chunkJF5WGYJJcjs.Scope)(runtime);
|
|
167
|
+
const fiber = _chunkGLE2WY7Zcjs.getCurrentFiber.call(void 0, );
|
|
162
168
|
_optionalChain([fiber, 'optionalAccess', _2 => _2.addFinalizer, 'call', _3 => _3((exit) => {
|
|
163
169
|
try {
|
|
164
170
|
scope.close(exit);
|
|
@@ -167,7 +173,8 @@ function uncons(self) {
|
|
|
167
173
|
})]);
|
|
168
174
|
const closeWith = (exit) => {
|
|
169
175
|
if (exit._tag === "Failure") {
|
|
170
|
-
const
|
|
176
|
+
const failure = _chunkMVGUEJ5Zcjs.Cause.firstFailure(exit.cause);
|
|
177
|
+
const err = failure._tag === "Some" ? failure.value : void 0;
|
|
171
178
|
if (err && typeof err === "object" && err._tag === "None") {
|
|
172
179
|
scope.close({ _tag: "Success", value: void 0 });
|
|
173
180
|
return;
|
|
@@ -176,18 +183,18 @@ function uncons(self) {
|
|
|
176
183
|
scope.close(exit);
|
|
177
184
|
};
|
|
178
185
|
const wrap = (s) => fromPull(
|
|
179
|
-
|
|
186
|
+
_chunkMVGUEJ5Zcjs.asyncEffect.call(void 0, (env2, cb2) => {
|
|
180
187
|
const pull = uncons(s);
|
|
181
|
-
|
|
188
|
+
_chunkGLE2WY7Zcjs.unsafeRunFoldWithEnv.call(void 0,
|
|
182
189
|
pull,
|
|
183
190
|
env2,
|
|
184
191
|
(cause) => {
|
|
185
|
-
const ex =
|
|
192
|
+
const ex = _chunkMVGUEJ5Zcjs.Exit.failCause(cause);
|
|
186
193
|
closeWith(ex);
|
|
187
194
|
cb2(ex);
|
|
188
195
|
},
|
|
189
196
|
([a, tail]) => {
|
|
190
|
-
cb2(
|
|
197
|
+
cb2(_chunkMVGUEJ5Zcjs.Exit.succeed([a, wrap(tail)]));
|
|
191
198
|
}
|
|
192
199
|
);
|
|
193
200
|
})
|
|
@@ -195,19 +202,20 @@ function uncons(self) {
|
|
|
195
202
|
scope.fork(self.acquire).join((ex) => {
|
|
196
203
|
if (ex._tag === "Failure") {
|
|
197
204
|
closeWith(ex);
|
|
198
|
-
|
|
205
|
+
const failure = _chunkMVGUEJ5Zcjs.Cause.firstFailure(ex.cause);
|
|
206
|
+
cb(failure._tag === "Some" ? { _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail(_chunkMVGUEJ5Zcjs.some.call(void 0, failure.value)) } : { _tag: "Failure", cause: ex.cause });
|
|
199
207
|
return;
|
|
200
208
|
}
|
|
201
209
|
scope.addFinalizer((exit) => self.release(exit));
|
|
202
210
|
const inner = ex.value;
|
|
203
|
-
|
|
211
|
+
_chunkGLE2WY7Zcjs.unsafeGetCurrentRuntime.call(void 0, ).fork(uncons(wrap(inner))).join(cb);
|
|
204
212
|
});
|
|
205
213
|
});
|
|
206
214
|
case "Managed":
|
|
207
|
-
return
|
|
208
|
-
const runtime =
|
|
209
|
-
const scope = new (0,
|
|
210
|
-
_optionalChain([
|
|
215
|
+
return _chunkMVGUEJ5Zcjs.asyncEffect.call(void 0, (env, cb) => {
|
|
216
|
+
const runtime = _chunkGLE2WY7Zcjs.unsafeGetCurrentRuntime.call(void 0, );
|
|
217
|
+
const scope = new (0, _chunkJF5WGYJJcjs.Scope)(runtime);
|
|
218
|
+
_optionalChain([_chunkGLE2WY7Zcjs.getCurrentFiber.call(void 0, ), 'optionalAccess', _4 => _4.addFinalizer, 'call', _5 => _5((exit) => {
|
|
211
219
|
try {
|
|
212
220
|
scope.close(exit);
|
|
213
221
|
} catch (e4) {
|
|
@@ -215,7 +223,8 @@ function uncons(self) {
|
|
|
215
223
|
})]);
|
|
216
224
|
const closeWith = (exit) => {
|
|
217
225
|
if (exit._tag === "Failure") {
|
|
218
|
-
const
|
|
226
|
+
const failure = _chunkMVGUEJ5Zcjs.Cause.firstFailure(exit.cause);
|
|
227
|
+
const err = failure._tag === "Some" ? failure.value : void 0;
|
|
219
228
|
if (err && typeof err === "object" && err._tag === "None") {
|
|
220
229
|
scope.close({ _tag: "Success", value: void 0 });
|
|
221
230
|
return;
|
|
@@ -226,28 +235,29 @@ function uncons(self) {
|
|
|
226
235
|
scope.fork(self.acquire).join((ex) => {
|
|
227
236
|
if (ex._tag === "Failure") {
|
|
228
237
|
scope.close(ex);
|
|
229
|
-
|
|
238
|
+
const failure = _chunkMVGUEJ5Zcjs.Cause.firstFailure(ex.cause);
|
|
239
|
+
cb(failure._tag === "Some" ? { _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail(_chunkMVGUEJ5Zcjs.some.call(void 0, failure.value)) } : { _tag: "Failure", cause: ex.cause });
|
|
230
240
|
return;
|
|
231
241
|
}
|
|
232
242
|
const { stream: inner, release } = ex.value;
|
|
233
243
|
scope.addFinalizer((exit) => release(exit));
|
|
234
244
|
const wrap = (s) => fromPull(
|
|
235
|
-
|
|
236
|
-
|
|
245
|
+
_chunkMVGUEJ5Zcjs.asyncEffect.call(void 0, (env2, cb2) => {
|
|
246
|
+
_chunkGLE2WY7Zcjs.unsafeRunFoldWithEnv.call(void 0,
|
|
237
247
|
uncons(s),
|
|
238
248
|
env2,
|
|
239
249
|
(cause) => {
|
|
240
|
-
const ex2 =
|
|
250
|
+
const ex2 = _chunkMVGUEJ5Zcjs.Exit.failCause(cause);
|
|
241
251
|
closeWith(ex2);
|
|
242
252
|
cb2(ex2);
|
|
243
253
|
},
|
|
244
254
|
([a, tail]) => {
|
|
245
|
-
cb2(
|
|
255
|
+
cb2(_chunkMVGUEJ5Zcjs.Exit.succeed([a, wrap(tail)]));
|
|
246
256
|
}
|
|
247
257
|
);
|
|
248
258
|
})
|
|
249
259
|
);
|
|
250
|
-
|
|
260
|
+
_chunkGLE2WY7Zcjs.unsafeGetCurrentRuntime.call(void 0, ).fork(uncons(wrap(inner))).join(cb);
|
|
251
261
|
});
|
|
252
262
|
});
|
|
253
263
|
}
|
|
@@ -262,10 +272,10 @@ function mapStream(self, f) {
|
|
|
262
272
|
case "FromArray":
|
|
263
273
|
return { _tag: "FromArray", values: self.values.map(f) };
|
|
264
274
|
case "Emit":
|
|
265
|
-
return emitStream(
|
|
275
|
+
return emitStream(_chunkMVGUEJ5Zcjs.map.call(void 0, self.value, f));
|
|
266
276
|
case "FromPull":
|
|
267
277
|
return fromPull(
|
|
268
|
-
|
|
278
|
+
_chunkMVGUEJ5Zcjs.map.call(void 0, self.pull, ([a, tail]) => [f(a), mapStream(tail, f)])
|
|
269
279
|
);
|
|
270
280
|
case "Concat":
|
|
271
281
|
return concatStream(mapStream(self.left, f), mapStream(self.right, f));
|
|
@@ -284,12 +294,12 @@ function mapStream(self, f) {
|
|
|
284
294
|
);
|
|
285
295
|
case "Scoped":
|
|
286
296
|
return unwrapScoped(
|
|
287
|
-
|
|
297
|
+
_chunkMVGUEJ5Zcjs.map.call(void 0, self.acquire, (s) => mapStream(s, f)),
|
|
288
298
|
self.release
|
|
289
299
|
);
|
|
290
300
|
case "Managed":
|
|
291
301
|
return managedStream(
|
|
292
|
-
|
|
302
|
+
_chunkMVGUEJ5Zcjs.map.call(void 0, self.acquire, ({ stream, release }) => ({
|
|
293
303
|
stream: mapStream(stream, f),
|
|
294
304
|
release
|
|
295
305
|
}))
|
|
@@ -300,19 +310,19 @@ function mapStream(self, f) {
|
|
|
300
310
|
}
|
|
301
311
|
function rangeStream(start, end) {
|
|
302
312
|
const go = (i) => fromPull(
|
|
303
|
-
i > end ?
|
|
313
|
+
i > end ? _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, _chunkMVGUEJ5Zcjs.none) : _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, [i, go(i + 1)])
|
|
304
314
|
);
|
|
305
315
|
return go(start);
|
|
306
316
|
}
|
|
307
317
|
function zip(left, right) {
|
|
308
|
-
const pull =
|
|
309
|
-
|
|
318
|
+
const pull = _chunkMVGUEJ5Zcjs.asyncFold.call(void 0,
|
|
319
|
+
_chunkMVGUEJ5Zcjs.asyncMapError.call(void 0, uncons(left), (opt) => widenOpt(opt)),
|
|
310
320
|
// si left termina o falla, el zip termina/falla igual
|
|
311
|
-
(opt) =>
|
|
312
|
-
([a, tailL]) =>
|
|
313
|
-
|
|
314
|
-
(opt) =>
|
|
315
|
-
([b, tailR]) =>
|
|
321
|
+
(opt) => _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, opt),
|
|
322
|
+
([a, tailL]) => _chunkMVGUEJ5Zcjs.asyncFold.call(void 0,
|
|
323
|
+
_chunkMVGUEJ5Zcjs.asyncMapError.call(void 0, uncons(right), (opt) => widenOpt(opt)),
|
|
324
|
+
(opt) => _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, opt),
|
|
325
|
+
([b, tailR]) => _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, [
|
|
316
326
|
[a, b],
|
|
317
327
|
zip(tailL, tailR)
|
|
318
328
|
])
|
|
@@ -321,26 +331,26 @@ function zip(left, right) {
|
|
|
321
331
|
return fromPull(pull);
|
|
322
332
|
}
|
|
323
333
|
function foreachStream(stream, f) {
|
|
324
|
-
const loop = (cur) =>
|
|
334
|
+
const loop = (cur) => _chunkMVGUEJ5Zcjs.asyncFold.call(void 0,
|
|
325
335
|
// uncons: Option<E> -> Option<E|E2>
|
|
326
|
-
|
|
336
|
+
_chunkMVGUEJ5Zcjs.asyncMapError.call(void 0, uncons(cur), (opt) => widenOpt(opt)),
|
|
327
337
|
(opt) => {
|
|
328
|
-
if (opt._tag === "None") return
|
|
329
|
-
return
|
|
338
|
+
if (opt._tag === "None") return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0);
|
|
339
|
+
return _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, opt);
|
|
330
340
|
},
|
|
331
|
-
([a, tail]) =>
|
|
341
|
+
([a, tail]) => _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
332
342
|
// f(a): E2 -> Option<E|E2>
|
|
333
|
-
|
|
343
|
+
_chunkMVGUEJ5Zcjs.asyncMapError.call(void 0, f(a), (e2) => _chunkMVGUEJ5Zcjs.some.call(void 0, e2)),
|
|
334
344
|
() => loop(tail)
|
|
335
345
|
)
|
|
336
346
|
);
|
|
337
|
-
return
|
|
347
|
+
return _chunkMVGUEJ5Zcjs.asyncFold.call(void 0,
|
|
338
348
|
loop(stream),
|
|
339
349
|
(opt) => {
|
|
340
|
-
if (opt._tag === "None") return
|
|
341
|
-
return
|
|
350
|
+
if (opt._tag === "None") return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0);
|
|
351
|
+
return _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, opt.value);
|
|
342
352
|
},
|
|
343
|
-
() =>
|
|
353
|
+
() => _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0)
|
|
344
354
|
);
|
|
345
355
|
}
|
|
346
356
|
function fromArray(values) {
|
|
@@ -350,20 +360,20 @@ function fromArray(values) {
|
|
|
350
360
|
function collectStream(stream) {
|
|
351
361
|
const syncResult = drainStreamSyncFull(stream);
|
|
352
362
|
if (syncResult !== null) {
|
|
353
|
-
return
|
|
363
|
+
return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, syncResult);
|
|
354
364
|
}
|
|
355
|
-
const loop = (cur, acc) =>
|
|
365
|
+
const loop = (cur, acc) => _chunkMVGUEJ5Zcjs.asyncFold.call(void 0,
|
|
356
366
|
uncons(cur),
|
|
357
367
|
(opt) => {
|
|
358
|
-
if (opt._tag === "None") return
|
|
359
|
-
return
|
|
368
|
+
if (opt._tag === "None") return _chunkMVGUEJ5Zcjs.succeed.call(void 0, acc);
|
|
369
|
+
return _chunkMVGUEJ5Zcjs.fail.call(void 0, opt);
|
|
360
370
|
},
|
|
361
371
|
([a, tail]) => {
|
|
362
372
|
acc.push(a);
|
|
363
373
|
return loop(tail, acc);
|
|
364
374
|
}
|
|
365
375
|
);
|
|
366
|
-
return
|
|
376
|
+
return _chunkMVGUEJ5Zcjs.mapError.call(void 0, loop(stream, []), (opt) => {
|
|
367
377
|
if (opt._tag === "Some") return opt.value;
|
|
368
378
|
throw new Error("unreachable: stream end handled as success");
|
|
369
379
|
});
|
|
@@ -405,7 +415,7 @@ function drainStreamSyncFull(stream) {
|
|
|
405
415
|
}
|
|
406
416
|
}
|
|
407
417
|
function readerStream(reader, normalizeError, signal) {
|
|
408
|
-
const pull =
|
|
418
|
+
const pull = _chunkMVGUEJ5Zcjs.asyncEffect.call(void 0, (_, cb) => {
|
|
409
419
|
let done = false;
|
|
410
420
|
const cleanup = () => _optionalChain([signal, 'optionalAccess', _6 => _6.removeEventListener, 'call', _7 => _7("abort", abort)]);
|
|
411
421
|
const finish = (exit) => {
|
|
@@ -420,7 +430,7 @@ function readerStream(reader, normalizeError, signal) {
|
|
|
420
430
|
} catch (e5) {
|
|
421
431
|
}
|
|
422
432
|
const error = typeof DOMException === "function" ? new DOMException("aborted", "AbortError") : new Error("aborted");
|
|
423
|
-
finish({ _tag: "Failure", cause: { _tag: "Fail", error:
|
|
433
|
+
finish({ _tag: "Failure", cause: { _tag: "Fail", error: _chunkMVGUEJ5Zcjs.some.call(void 0, normalizeError(error)) } });
|
|
424
434
|
};
|
|
425
435
|
if (_optionalChain([signal, 'optionalAccess', _8 => _8.aborted])) {
|
|
426
436
|
abort();
|
|
@@ -429,7 +439,7 @@ function readerStream(reader, normalizeError, signal) {
|
|
|
429
439
|
_optionalChain([signal, 'optionalAccess', _9 => _9.addEventListener, 'call', _10 => _10("abort", abort, { once: true })]);
|
|
430
440
|
reader.read().then(({ done: done2, value }) => {
|
|
431
441
|
if (done2) {
|
|
432
|
-
finish({ _tag: "Failure", cause: { _tag: "Fail", error:
|
|
442
|
+
finish({ _tag: "Failure", cause: { _tag: "Fail", error: _chunkMVGUEJ5Zcjs.none } });
|
|
433
443
|
return;
|
|
434
444
|
}
|
|
435
445
|
finish({
|
|
@@ -437,7 +447,7 @@ function readerStream(reader, normalizeError, signal) {
|
|
|
437
447
|
value: [value, fromPull(pull)]
|
|
438
448
|
});
|
|
439
449
|
}).catch((e) => {
|
|
440
|
-
finish({ _tag: "Failure", cause: { _tag: "Fail", error:
|
|
450
|
+
finish({ _tag: "Failure", cause: { _tag: "Fail", error: _chunkMVGUEJ5Zcjs.some.call(void 0, normalizeError(e)) } });
|
|
441
451
|
});
|
|
442
452
|
return () => {
|
|
443
453
|
cleanup();
|
|
@@ -454,12 +464,12 @@ function streamFromReadableStream(body, normalizeError, options = {}) {
|
|
|
454
464
|
let reader;
|
|
455
465
|
return unwrapScoped(
|
|
456
466
|
// acquire: produce un ZStream
|
|
457
|
-
|
|
467
|
+
_chunkMVGUEJ5Zcjs.sync.call(void 0, () => {
|
|
458
468
|
reader = body.getReader();
|
|
459
469
|
return readerStream(reader, normalizeError, options.signal);
|
|
460
470
|
}),
|
|
461
471
|
// release: se corre en fin / error / interrupción
|
|
462
|
-
() =>
|
|
472
|
+
() => _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
|
|
463
473
|
try {
|
|
464
474
|
_optionalChain([reader, 'optionalAccess', _11 => _11.cancel, 'call', _12 => _12()]);
|
|
465
475
|
} catch (e7) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCurrentFiber
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FH2X7BVP.js";
|
|
4
4
|
import {
|
|
5
5
|
Cause,
|
|
6
6
|
Exit,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
asyncFlatMap,
|
|
9
9
|
asyncFold,
|
|
10
10
|
unit
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-UB4B6OFY.js";
|
|
12
12
|
|
|
13
13
|
// src/core/runtime/scope.ts
|
|
14
14
|
var nextScopeId = 1;
|
|
@@ -77,12 +77,13 @@ var Scope = class _Scope {
|
|
|
77
77
|
/** Emit the scope.close event if hooks are active. */
|
|
78
78
|
emitCloseEvent(exit) {
|
|
79
79
|
if (this.runtime.hasActiveHooks()) {
|
|
80
|
-
const status = exit._tag === "Success" ? "success" : exit.cause
|
|
80
|
+
const status = exit._tag === "Success" ? "success" : Cause.isInterruptedOnly(exit.cause) ? "interrupted" : "failure";
|
|
81
|
+
const failure = exit._tag === "Failure" ? Cause.firstFailure(exit.cause) : void 0;
|
|
81
82
|
this.runtime.emit({
|
|
82
83
|
type: "scope.close",
|
|
83
84
|
scopeId: this.id,
|
|
84
85
|
status,
|
|
85
|
-
error:
|
|
86
|
+
error: failure?._tag === "Some" ? failure.value : exit._tag === "Failure" ? exit.cause : void 0
|
|
86
87
|
});
|
|
87
88
|
}
|
|
88
89
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkMVGUEJ5Zcjs = require('./chunk-MVGUEJ5Z.cjs');
|
|
4
4
|
|
|
5
5
|
// src/http/effectRunner.ts
|
|
6
6
|
function registerHttpEffect(effect, env, cb) {
|
|
@@ -19,13 +19,13 @@ function registerHttpEffect(effect, env, cb) {
|
|
|
19
19
|
cont({ _tag: "Success", value: current.value });
|
|
20
20
|
return;
|
|
21
21
|
case "Fail":
|
|
22
|
-
cont({ _tag: "Failure", cause:
|
|
22
|
+
cont({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail(current.error) });
|
|
23
23
|
return;
|
|
24
24
|
case "Sync":
|
|
25
25
|
try {
|
|
26
26
|
cont({ _tag: "Success", value: current.thunk(env) });
|
|
27
27
|
} catch (e) {
|
|
28
|
-
cont({ _tag: "Failure", cause:
|
|
28
|
+
cont({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.die(e) });
|
|
29
29
|
}
|
|
30
30
|
return;
|
|
31
31
|
case "Async": {
|
|
@@ -47,7 +47,7 @@ function registerHttpEffect(effect, env, cb) {
|
|
|
47
47
|
try {
|
|
48
48
|
run(current.andThen(exit.value), cont);
|
|
49
49
|
} catch (e) {
|
|
50
|
-
cont({ _tag: "Failure", cause:
|
|
50
|
+
cont({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.die(e) });
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
return;
|
|
@@ -59,19 +59,30 @@ function registerHttpEffect(effect, env, cb) {
|
|
|
59
59
|
run(current.onSuccess(exit.value), cont);
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
|
-
if (exit.cause
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
if (_chunkMVGUEJ5Zcjs.Cause.isFailureOnly(exit.cause)) {
|
|
63
|
+
const failure = _chunkMVGUEJ5Zcjs.Cause.firstFailure(exit.cause);
|
|
64
|
+
if (failure._tag === "Some") {
|
|
65
|
+
run(current.onFailure(failure.value), cont);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
65
68
|
}
|
|
66
69
|
cont(exit);
|
|
67
70
|
} catch (e) {
|
|
68
|
-
cont({ _tag: "Failure", cause:
|
|
71
|
+
cont({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.die(e) });
|
|
69
72
|
}
|
|
70
73
|
});
|
|
71
74
|
return;
|
|
72
75
|
case "Fork":
|
|
73
76
|
cont({ _tag: "Success", value: void 0 });
|
|
74
77
|
return;
|
|
78
|
+
case "Interruptibility":
|
|
79
|
+
case "InterruptibilityRestore":
|
|
80
|
+
case "FiberRefLocally":
|
|
81
|
+
run(current.effect, cont);
|
|
82
|
+
return;
|
|
83
|
+
case "InterruptibilityMask":
|
|
84
|
+
run(current.body((effect2) => effect2), cont);
|
|
85
|
+
return;
|
|
75
86
|
}
|
|
76
87
|
};
|
|
77
88
|
run(effect, finish);
|
|
@@ -83,7 +94,7 @@ function registerHttpEffect(effect, env, cb) {
|
|
|
83
94
|
try {
|
|
84
95
|
_optionalChain([cancel, 'optionalCall', _ => _()]);
|
|
85
96
|
} finally {
|
|
86
|
-
cb({ _tag: "Failure", cause:
|
|
97
|
+
cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.interrupt() });
|
|
87
98
|
}
|
|
88
99
|
};
|
|
89
100
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
race
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-B5JD23U7.mjs";
|
|
4
4
|
import {
|
|
5
5
|
withScopeAsync
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-A2OM6NEH.mjs";
|
|
7
7
|
import {
|
|
8
8
|
fromPromiseAbortable
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GYM3LLGS.mjs";
|
|
10
10
|
import {
|
|
11
11
|
Cause,
|
|
12
12
|
Exit,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
asyncMap,
|
|
18
18
|
asyncSucceed,
|
|
19
19
|
asyncSync
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-36I3M4UC.mjs";
|
|
21
21
|
|
|
22
22
|
// src/agent/core/state.ts
|
|
23
23
|
var initialAgentState = (goal) => ({
|