brass-runtime 1.18.0 → 1.18.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.
Files changed (77) hide show
  1. package/dist/agent/cli/main.cjs +30 -30
  2. package/dist/agent/cli/main.js +2 -2
  3. package/dist/agent/cli/main.mjs +2 -2
  4. package/dist/agent/index.cjs +3 -3
  5. package/dist/agent/index.d.ts +1 -1
  6. package/dist/agent/index.js +2 -2
  7. package/dist/agent/index.mjs +2 -2
  8. package/dist/{chunk-PSEU65ND.js → chunk-22HZQG5F.js} +6 -6
  9. package/dist/{chunk-SSQJKDN3.cjs → chunk-2JHJ4YHS.cjs} +227 -117
  10. package/dist/{chunk-IFRBVMWJ.cjs → chunk-2OW6IFY2.cjs} +19 -19
  11. package/dist/{chunk-YTX2JYYP.cjs → chunk-5LC7V2OZ.cjs} +18 -18
  12. package/dist/{chunk-7TXQJFZX.cjs → chunk-5RZ7YITF.cjs} +13 -13
  13. package/dist/{chunk-OT2TESZU.mjs → chunk-6V2AWT4R.mjs} +1 -1
  14. package/dist/{chunk-BG5RNEA2.js → chunk-7DU7IQHK.js} +3 -3
  15. package/dist/{chunk-QCOLAHU3.mjs → chunk-7GBJYOX7.mjs} +5 -5
  16. package/dist/{chunk-ITG6I7ZS.js → chunk-7VQLEN37.js} +1 -1
  17. package/dist/{chunk-QZ6QFJNM.mjs → chunk-B5FKOLTB.mjs} +3 -3
  18. package/dist/{chunk-RREBJX2S.mjs → chunk-BC6Q6BCO.mjs} +1 -1
  19. package/dist/{chunk-KRYP6CAE.mjs → chunk-COOW7BJX.mjs} +2 -2
  20. package/dist/{chunk-ELLF55ER.mjs → chunk-EEN5OTCR.mjs} +1 -1
  21. package/dist/{chunk-3PFZGP23.cjs → chunk-EICAJDNX.cjs} +13 -13
  22. package/dist/{chunk-5XADBMSU.cjs → chunk-ELIECDYN.cjs} +5 -5
  23. package/dist/{chunk-2QNREG6K.mjs → chunk-H626ZTDZ.mjs} +211 -101
  24. package/dist/{chunk-JH4GI3DW.js → chunk-IPSMXUWA.js} +1 -1
  25. package/dist/{chunk-2SLT3X6G.cjs → chunk-J6DUHITE.cjs} +6 -6
  26. package/dist/{chunk-OI4ESUMC.mjs → chunk-JWIEMBE6.mjs} +6 -6
  27. package/dist/{chunk-N6QNSTWD.cjs → chunk-KNTJ7FQB.cjs} +5 -5
  28. package/dist/{chunk-W6WR37HN.js → chunk-LSYQ3C2M.js} +2 -2
  29. package/dist/{chunk-AADFFVYS.js → chunk-OW5VHAOE.js} +1 -1
  30. package/dist/{chunk-G5JTCFMI.mjs → chunk-RBHNOKH4.mjs} +2 -2
  31. package/dist/{chunk-IBRHSH5H.js → chunk-S4HXADU4.js} +1 -1
  32. package/dist/{chunk-XSAHV5HQ.js → chunk-TTSPIU3U.js} +211 -101
  33. package/dist/{chunk-S4HHFUYP.js → chunk-UAKAF32U.js} +2 -2
  34. package/dist/{chunk-R6WDSZA6.mjs → chunk-WCBNXPN6.mjs} +1 -1
  35. package/dist/{chunk-AJMKZXRB.cjs → chunk-WGE2FEZE.cjs} +2 -2
  36. package/dist/{chunk-LXBU5E77.cjs → chunk-WI7GZF3B.cjs} +16 -16
  37. package/dist/{chunk-H5GYX7RZ.js → chunk-WUDHOZIH.js} +113 -5
  38. package/dist/{chunk-KHACHFBQ.cjs → chunk-WVSZOPGQ.cjs} +54 -54
  39. package/dist/{chunk-VIFA4DPN.cjs → chunk-XPIMJQYS.cjs} +193 -85
  40. package/dist/{chunk-3PHU7FWS.js → chunk-YGR2IN4R.js} +5 -5
  41. package/dist/{chunk-ITZQ526U.mjs → chunk-YWLLH27R.mjs} +2 -2
  42. package/dist/{chunk-4YQHPIWJ.js → chunk-YZ5LQ32F.js} +2 -2
  43. package/dist/{chunk-Z3PSSXP3.mjs → chunk-Z3ZZMQUZ.mjs} +113 -5
  44. package/dist/core/index.cjs +13 -7
  45. package/dist/core/index.d.ts +6 -6
  46. package/dist/core/index.js +12 -6
  47. package/dist/core/index.mjs +12 -6
  48. package/dist/{defaultClient-DhpCQW9m.d.ts → defaultClient-Cid0JoUR.d.ts} +29 -4
  49. package/dist/{effect-CtUDl5M5.d.ts → effect-DnGUuhw6.d.ts} +22 -1
  50. package/dist/http/index.cjs +52 -48
  51. package/dist/http/index.d.ts +8 -8
  52. package/dist/http/index.js +10 -6
  53. package/dist/http/index.mjs +10 -6
  54. package/dist/http/testing.cjs +8 -8
  55. package/dist/http/testing.d.ts +4 -4
  56. package/dist/http/testing.js +4 -4
  57. package/dist/http/testing.mjs +4 -4
  58. package/dist/index.cjs +91 -85
  59. package/dist/index.d.ts +7 -7
  60. package/dist/index.js +13 -7
  61. package/dist/index.mjs +13 -7
  62. package/dist/{layer-BalPI6cN.d.ts → layer-D2LFcBVx.d.ts} +1 -1
  63. package/dist/observability/index.cjs +9 -9
  64. package/dist/observability/index.d.ts +7 -7
  65. package/dist/observability/index.js +8 -8
  66. package/dist/observability/index.mjs +8 -8
  67. package/dist/perf/cli.cjs +25 -25
  68. package/dist/perf/cli.js +10 -10
  69. package/dist/perf/cli.mjs +10 -10
  70. package/dist/perf/index.cjs +12 -12
  71. package/dist/perf/index.js +10 -10
  72. package/dist/perf/index.mjs +10 -10
  73. package/dist/{server-C1zVmqE6.d.ts → server-Bf1zNYZk.d.ts} +4 -4
  74. package/dist/{stream-Bb4FTejt.d.ts → stream-I7bkvF7a.d.ts} +1 -1
  75. package/dist/{tracer-DzfuE6um.d.ts → tracer-DF83nLn6.d.ts} +2 -2
  76. package/dist/{tracing-BABA5arE.d.ts → tracing-CWV4gT0u.d.ts} +1 -1
  77. package/package.json +3 -2
@@ -3,18 +3,18 @@ import {
3
3
  } from "./chunk-TRM4JUZQ.js";
4
4
  import {
5
5
  streamFromReadableStream
6
- } from "./chunk-JH4GI3DW.js";
6
+ } from "./chunk-IPSMXUWA.js";
7
7
  import {
8
8
  layerEffect,
9
9
  makeScheduleDriver,
10
10
  makeServiceTag,
11
11
  sleep
12
- } from "./chunk-IBRHSH5H.js";
12
+ } from "./chunk-S4HXADU4.js";
13
13
  import {
14
14
  fromPromiseAbortable,
15
15
  resolveWasmModule,
16
16
  toPromise
17
- } from "./chunk-XSAHV5HQ.js";
17
+ } from "./chunk-TTSPIU3U.js";
18
18
  import {
19
19
  Cause,
20
20
  asyncEffect,
@@ -678,6 +678,18 @@ var HttpConcurrencyPool = class {
678
678
  acquire(key, signal) {
679
679
  return this.wasm ? this.acquireWasm(key, signal) : this.acquireJs(key, signal);
680
680
  }
681
+ /** Try synchronous acquire. Returns lease directly or undefined if contended. */
682
+ tryAcquireSync(key, signal) {
683
+ if (this.wasm) return void 0;
684
+ if (signal.aborted) return void 0;
685
+ const state = this.getState(key);
686
+ if (state.running < this.concurrency) {
687
+ state.running++;
688
+ state.acquired++;
689
+ return this.makeLease(state);
690
+ }
691
+ return void 0;
692
+ }
681
693
  stats() {
682
694
  const keys = Array.from(this.states.values()).map((state) => ({
683
695
  key: state.key,
@@ -1516,6 +1528,24 @@ var AdaptiveLimiter = class {
1516
1528
  this.enqueueWaiter(state, waiter);
1517
1529
  });
1518
1530
  }
1531
+ /**
1532
+ * Try to acquire a concurrency slot synchronously.
1533
+ * Returns a lease directly if under the limit, or undefined if contended/aborted/destroyed.
1534
+ * This avoids Promise.resolve() allocation and microtask scheduling on the uncontended path.
1535
+ */
1536
+ tryAcquireSync(key, signal) {
1537
+ if (this.destroyed) return void 0;
1538
+ if (signal.aborted) return void 0;
1539
+ const state = this.getOrCreateState(key);
1540
+ this.touch(state);
1541
+ if (state.inFlight < state.limit) {
1542
+ state.inFlight++;
1543
+ state.acquired++;
1544
+ state.rejectionStreak = 0;
1545
+ return this.makeLease(state);
1546
+ }
1547
+ return void 0;
1548
+ }
1519
1549
  /**
1520
1550
  * Get stats for a specific key, or aggregate stats if no key is provided.
1521
1551
  */
@@ -2194,6 +2224,9 @@ var mergeHeadersUnder = (under) => (req) => Lens.over(Request.headers, (h) => ({
2194
2224
  var setHeaderIfMissing = (k, v) => (req) => Lens.over(Request.headers, (h) => h[k] ? h : { ...h, [k]: v })(req);
2195
2225
 
2196
2226
  // src/http/transport.ts
2227
+ function isPromiseTransportDirect(transport) {
2228
+ return transport.__promiseTransport === true;
2229
+ }
2197
2230
  var isTaggedHttpError = (error) => {
2198
2231
  return isHttpError(error);
2199
2232
  };
@@ -2325,7 +2358,7 @@ var toPromiseTransportResponse = (bodyText, info) => ({
2325
2358
  ...info.transportMeta !== void 0 ? { transportMeta: info.transportMeta } : {}
2326
2359
  });
2327
2360
  function makePromiseHttpTransport(config) {
2328
- return (context) => asyncEffect((_env, cb) => {
2361
+ const transport = (context) => asyncEffect((_env, cb) => {
2329
2362
  let done = false;
2330
2363
  const finish = (exit) => {
2331
2364
  if (done) return;
@@ -2368,6 +2401,20 @@ function makePromiseHttpTransport(config) {
2368
2401
  context.signal.removeEventListener("abort", abort);
2369
2402
  };
2370
2403
  });
2404
+ const marked = transport;
2405
+ marked.__promiseTransport = true;
2406
+ marked.requestDirect = async (context) => {
2407
+ const startedAt = nowMs();
2408
+ try {
2409
+ const raw = await config.request(context);
2410
+ const durationMs = Math.round(nowMs() - startedAt);
2411
+ const mapped = await config.response(raw, context, { startedAt, durationMs });
2412
+ return { ...mapped, ms: mapped.ms ?? durationMs };
2413
+ } catch (error) {
2414
+ throw config.error?.(error, context) ?? normalizeHttpError(error, { signal: context.signal });
2415
+ }
2416
+ };
2417
+ return marked;
2371
2418
  }
2372
2419
  function makePromiseHttpTransportBodyBuilder(config) {
2373
2420
  const makeBodyTransport = (mode, body, responseMapper, currentConfig = config) => makePromiseHttpTransport({
@@ -3083,6 +3130,13 @@ function makeHttpStream(cfg = {}) {
3083
3130
  };
3084
3131
  return decorateStream(run, metrics.snapshot);
3085
3132
  }
3133
+ var ONCE_OPTIONS = Object.freeze({ once: true });
3134
+ var noopSignal = (() => {
3135
+ const c = new AbortController();
3136
+ const s = c.signal;
3137
+ globalThis.__brassNoopSignal = s;
3138
+ return s;
3139
+ })();
3086
3140
  function makeHttp(cfg = {}) {
3087
3141
  validateMakeHttpConfig(cfg);
3088
3142
  const baseUrl = cfg.baseUrl ?? "";
@@ -5867,10 +5921,14 @@ function makeDefaultHttpClient(config = {}) {
5867
5921
  wire = wire.with(withHttpPolicyPresets(policyPresets));
5868
5922
  }
5869
5923
  const features = featureSnapshot(lifecycleConfig2, compressionResult !== void 0, middleware.length);
5924
+ const hasMiddleware = compressionResult !== void 0 || middleware.length > 0 || policyPresets !== void 0 && Object.keys(policyPresets).length > 0;
5925
+ const transport = lifecycleConfig2.transport;
5926
+ const useInlineDecode = !hasMiddleware && transport !== void 0;
5870
5927
  return buildDefaultClient(wire, {
5871
5928
  preset,
5872
5929
  features,
5873
- compressionStats: compressionResult?.stats
5930
+ compressionStats: compressionResult?.stats,
5931
+ useInlineDecode
5874
5932
  });
5875
5933
  }
5876
5934
  function buildDefaultClient(wire, meta) {
@@ -5889,6 +5947,11 @@ function buildDefaultClient(wire, meta) {
5889
5947
  const req = setHeaderIfMissing("accept", "application/json")(
5890
5948
  buildHttpRequest("GET", url, init)
5891
5949
  );
5950
+ if (meta.useInlineDecode) {
5951
+ return withPromise(
5952
+ fusedWireAndDecode(requestRaw(req), init?.schema, init?.schemaName)
5953
+ );
5954
+ }
5892
5955
  return withPromise(
5893
5956
  asyncFlatMap(requestRaw(req), (w) => decodeResponse(w, init?.schema, init?.schemaName))
5894
5957
  );
@@ -5917,6 +5980,7 @@ function buildDefaultClient(wire, meta) {
5917
5980
  postJson,
5918
5981
  with: (mw) => buildDefaultClient(wire.with(mw), {
5919
5982
  ...meta,
5983
+ useInlineDecode: false,
5920
5984
  features: {
5921
5985
  ...meta.features,
5922
5986
  middleware: meta.features.middleware + 1
@@ -5944,6 +6008,48 @@ function toResponse(wire, body) {
5944
6008
  body
5945
6009
  };
5946
6010
  }
6011
+ function fusedWireAndDecode(wireEffect, schema, schemaName) {
6012
+ return {
6013
+ _tag: "Async",
6014
+ register: (env, cb) => {
6015
+ const innerEffect = wireEffect;
6016
+ if (innerEffect._tag === "Async" && innerEffect.register) {
6017
+ return innerEffect.register(env, (exit) => {
6018
+ if (exit._tag !== "Success") {
6019
+ cb(exit);
6020
+ return;
6021
+ }
6022
+ const wire = exit.value;
6023
+ inlineDecodeJson(wire, schema, schemaName, cb);
6024
+ });
6025
+ }
6026
+ const decoded = asyncFlatMap(wireEffect, (w) => decodeResponse(w, schema, schemaName));
6027
+ if (decoded._tag === "Async" && decoded.register) {
6028
+ return decoded.register(env, cb);
6029
+ }
6030
+ cb({ _tag: "Failure", cause: Cause.fail({ _tag: "ValidationError", message: "Internal: unexpected effect shape", body: "", issues: [], phase: "response" }) });
6031
+ }
6032
+ };
6033
+ }
6034
+ function inlineDecodeJson(wire, schema, schemaName, cb) {
6035
+ if (!schema) {
6036
+ let parsed;
6037
+ try {
6038
+ parsed = JSON.parse(wire.bodyText);
6039
+ } catch (error) {
6040
+ cb({ _tag: "Failure", cause: Cause.fail(makeJsonParseValidationError(wire.bodyText, error, { schemaName })) });
6041
+ return;
6042
+ }
6043
+ cb({ _tag: "Success", value: toResponse(wire, parsed) });
6044
+ return;
6045
+ }
6046
+ const result = decodeJsonBody(wire.bodyText, schema, { schemaName });
6047
+ if (result.success) {
6048
+ cb({ _tag: "Success", value: toResponse(wire, result.data) });
6049
+ } else {
6050
+ cb({ _tag: "Failure", cause: Cause.fail(result.error) });
6051
+ }
6052
+ }
5947
6053
  function decodeResponse(wire, schema, schemaName) {
5948
6054
  if (!schema) {
5949
6055
  try {
@@ -6069,6 +6175,7 @@ export {
6069
6175
  validateConfig,
6070
6176
  resolveConfig,
6071
6177
  AdaptiveLimiter,
6178
+ isPromiseTransportDirect,
6072
6179
  isTaggedHttpError,
6073
6180
  isAbortError,
6074
6181
  normalizeHttpError,
@@ -6084,6 +6191,7 @@ export {
6084
6191
  withMiddleware,
6085
6192
  normalizeHeadersInit,
6086
6193
  makeHttpStream,
6194
+ noopSignal,
6087
6195
  makeHttp,
6088
6196
  withRetryStream,
6089
6197
  SEPARATOR,
@@ -1,6 +1,6 @@
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 _chunk5XADBMSUcjs = require('./chunk-5XADBMSU.cjs');
3
+ var _chunkELIECDYNcjs = require('./chunk-ELIECDYN.cjs');
4
4
 
5
5
 
6
6
 
@@ -13,26 +13,26 @@ var _chunk5XADBMSUcjs = require('./chunk-5XADBMSU.cjs');
13
13
 
14
14
 
15
15
 
16
- var _chunkLXBU5E77cjs = require('./chunk-LXBU5E77.cjs');
16
+ var _chunkWI7GZF3Bcjs = require('./chunk-WI7GZF3B.cjs');
17
17
 
18
18
 
19
19
 
20
20
 
21
21
 
22
22
 
23
- var _chunkVIFA4DPNcjs = require('./chunk-VIFA4DPN.cjs');
23
+ var _chunkXPIMJQYScjs = require('./chunk-XPIMJQYS.cjs');
24
24
 
25
25
 
26
26
  var _chunkL6VB5N7Qcjs = require('./chunk-L6VB5N7Q.cjs');
27
27
 
28
28
 
29
29
 
30
- var _chunk7TXQJFZXcjs = require('./chunk-7TXQJFZX.cjs');
30
+ var _chunk5RZ7YITFcjs = require('./chunk-5RZ7YITF.cjs');
31
31
 
32
32
 
33
33
 
34
34
 
35
- var _chunkSSQJKDN3cjs = require('./chunk-SSQJKDN3.cjs');
35
+ var _chunk2JHJ4YHScjs = require('./chunk-2JHJ4YHS.cjs');
36
36
 
37
37
 
38
38
 
@@ -120,7 +120,7 @@ var HTTP_OBSERVABILITY_CONTRACT = Object.freeze({
120
120
  });
121
121
  function withHttpObservability(options) {
122
122
  if (!isObservabilityInstance(options)) {
123
- _chunkLXBU5E77cjs.validateHttpObservabilityOptions.call(void 0, _nullishCoalesce(options, () => ( {})));
123
+ _chunkWI7GZF3Bcjs.validateHttpObservabilityOptions.call(void 0, _nullishCoalesce(options, () => ( {})));
124
124
  }
125
125
  const resolved = resolveHttpObservabilityOptions(options);
126
126
  const metricCache = makeHttpMetricCache();
@@ -145,7 +145,7 @@ function withHttpObservability(options) {
145
145
  (error) => {
146
146
  const finish = state.finishWithError(error);
147
147
  const adaptiveLimiterAttrs = observeAdaptiveLimiter(wireReq, next, resolved);
148
- const traceEvent = !shouldEmitHttpSpanEvents(resolved) ? _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0) : _chunkLXBU5E77cjs.spanEvent.call(void 0, "http.client.error", {
148
+ const traceEvent = !shouldEmitHttpSpanEvents(resolved) ? _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0) : _chunkWI7GZF3Bcjs.spanEvent.call(void 0, "http.client.error", {
149
149
  ...finish.spanAttributes,
150
150
  ...adaptiveLimiterAttrs,
151
151
  "error.type": error._tag
@@ -158,7 +158,7 @@ function withHttpObservability(options) {
158
158
  (res) => {
159
159
  const finish = state.finishWithResponse(res);
160
160
  const adaptiveLimiterAttrs = observeAdaptiveLimiter(wireReq, next, resolved);
161
- const traceEvent = !shouldEmitHttpSpanEvents(resolved) ? _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0) : _chunkLXBU5E77cjs.spanEvent.call(void 0, "http.client.response", {
161
+ const traceEvent = !shouldEmitHttpSpanEvents(resolved) ? _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0) : _chunkWI7GZF3Bcjs.spanEvent.call(void 0, "http.client.response", {
162
162
  ...finish.spanAttributes,
163
163
  ...adaptiveLimiterAttrs
164
164
  });
@@ -172,7 +172,7 @@ function withHttpObservability(options) {
172
172
  )
173
173
  );
174
174
  if (resolved.spans === false) return run;
175
- return _chunkLXBU5E77cjs.withSpan.call(void 0, spanName(req, resolved.spans), run, spanStartAttributes(req, resolved));
175
+ return _chunkWI7GZF3Bcjs.withSpan.call(void 0, spanName(req, resolved.spans), run, spanStartAttributes(req, resolved));
176
176
  };
177
177
  };
178
178
  }
@@ -212,7 +212,7 @@ function withLeanHttpSampledSpanObservability(next, options, metricCache) {
212
212
  finishLeanHttpSpan(span, "success");
213
213
  } else {
214
214
  const error = httpErrorFromCause(exit.cause);
215
- const status = _chunkVIFA4DPNcjs.httpErrorStatus.call(void 0, error);
215
+ const status = _chunkXPIMJQYScjs.httpErrorStatus.call(void 0, error);
216
216
  recordHttpMetricsFinish(
217
217
  handles,
218
218
  httpErrorOutcome(error),
@@ -275,7 +275,7 @@ function withLeanHttpMetricsObservability(next, options, metricCache) {
275
275
  );
276
276
  } else {
277
277
  const error = httpErrorFromCause(exit.cause);
278
- const status = _chunkVIFA4DPNcjs.httpErrorStatus.call(void 0, error);
278
+ const status = _chunkXPIMJQYScjs.httpErrorStatus.call(void 0, error);
279
279
  recordHttpMetricsFinish(
280
280
  handles,
281
281
  httpErrorOutcome(error),
@@ -365,7 +365,7 @@ function startLeanHttpSpan(req, options) {
365
365
  if (configuredSampleRate <= 0) return void 0;
366
366
  if (configuredSampleRate < 1 && Math.random() >= configuredSampleRate) return void 0;
367
367
  }
368
- const fiber = _chunkSSQJKDN3cjs.getCurrentFiber.call(void 0, );
368
+ const fiber = _chunk2JHJ4YHScjs.getCurrentFiber.call(void 0, );
369
369
  const runtime = _optionalChain([fiber, 'optionalAccess', _11 => _11.runtime]);
370
370
  const sink = _nullishCoalesce(options.spanSink, () => ( _optionalChain([runtime, 'optionalAccess', _12 => _12.hooks])));
371
371
  if (!_optionalChain([fiber, 'optionalAccess', _13 => _13.fiberContext]) || !runtime || !sink) return void 0;
@@ -392,7 +392,7 @@ function startLeanHttpSpan(req, options) {
392
392
  attributes = spanStartAttributes(req, options);
393
393
  if (sampled === void 0) {
394
394
  traceId = _nullishCoalesce(traceId, () => ( tracer.newTraceId()));
395
- sampled = _chunkLXBU5E77cjs.shouldSampleWith.call(void 0, _optionalChain([brass, 'optionalAccess', _21 => _21.sampler]), {
395
+ sampled = _chunkWI7GZF3Bcjs.shouldSampleWith.call(void 0, _optionalChain([brass, 'optionalAccess', _21 => _21.sampler]), {
396
396
  traceId,
397
397
  spanName: name,
398
398
  parentSampled: _optionalChain([previousTrace, 'optionalAccess', _22 => _22.sampled]),
@@ -589,17 +589,17 @@ function beginHttpObservation(req, options, metricCache) {
589
589
  }
590
590
  };
591
591
  };
592
- const fiber = _chunkSSQJKDN3cjs.getCurrentFiber.call(void 0, );
592
+ const fiber = _chunk2JHJ4YHScjs.getCurrentFiber.call(void 0, );
593
593
  _optionalChain([fiber, 'optionalAccess', _43 => _43.addFinalizer, 'optionalCall', _44 => _44(() => {
594
594
  finish("abort", void 0, { "http.cancelled": true });
595
595
  })]);
596
596
  return {
597
597
  finishWithResponse: (res) => finish(httpStatusOutcome(res.status), String(res.status)),
598
598
  finishWithError: (error) => {
599
- const status = _chunkVIFA4DPNcjs.httpErrorStatus.call(void 0, error);
599
+ const status = _chunkXPIMJQYScjs.httpErrorStatus.call(void 0, error);
600
600
  return finish(httpErrorOutcome(error), status !== void 0 ? String(status) : void 0, {
601
601
  "error.type": error._tag,
602
- "http.retryable": _chunkVIFA4DPNcjs.isRetryableHttpError.call(void 0, error)
602
+ "http.retryable": _chunkXPIMJQYScjs.isRetryableHttpError.call(void 0, error)
603
603
  });
604
604
  }
605
605
  };
@@ -612,13 +612,13 @@ function prepareHttpRequest(req, options) {
612
612
  function logHttpRequest(req, options) {
613
613
  const level = options.logs === false ? false : _nullishCoalesce(options.logs.requestLevel, () => ( false));
614
614
  if (!level) return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0);
615
- return _chunkLXBU5E77cjs.logEffect.call(void 0, level, "http.client.request", requestLogFields(req, options));
615
+ return _chunkWI7GZF3Bcjs.logEffect.call(void 0, level, "http.client.request", requestLogFields(req, options));
616
616
  }
617
617
  function logHttpResponse(req, res, finish, options) {
618
618
  const configured = options.logs === false ? false : _nullishCoalesce(options.logs.responseLevel, () => ( false));
619
619
  const level = configured || (finish.outcome === "error" ? options.logs !== false ? _nullishCoalesce(options.logs.errorLevel, () => ( "warn")) : false : false);
620
620
  if (!level) return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0);
621
- return _chunkLXBU5E77cjs.logEffect.call(void 0, level, "http.client.response", {
621
+ return _chunkWI7GZF3Bcjs.logEffect.call(void 0, level, "http.client.response", {
622
622
  ...requestLogFields(req, options),
623
623
  status: res.status,
624
624
  statusText: res.statusText,
@@ -629,15 +629,15 @@ function logHttpResponse(req, res, finish, options) {
629
629
  function logHttpError(req, error, finish, options) {
630
630
  const level = options.logs === false ? false : _nullishCoalesce(options.logs.errorLevel, () => ( "error"));
631
631
  if (!level) return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0);
632
- const status = _chunkVIFA4DPNcjs.httpErrorStatus.call(void 0, error);
632
+ const status = _chunkXPIMJQYScjs.httpErrorStatus.call(void 0, error);
633
633
  const statusText = httpErrorStatusText(error);
634
- return _chunkLXBU5E77cjs.logEffect.call(void 0, level, "http.client.error", {
634
+ return _chunkWI7GZF3Bcjs.logEffect.call(void 0, level, "http.client.error", {
635
635
  ...requestLogFields(req, options),
636
636
  outcome: finish.outcome,
637
637
  durationMs: finish.durationMs,
638
638
  ...status !== void 0 ? { status } : {},
639
639
  ...statusText ? { statusText } : {},
640
- retryable: _chunkVIFA4DPNcjs.isRetryableHttpError.call(void 0, error),
640
+ retryable: _chunkXPIMJQYScjs.isRetryableHttpError.call(void 0, error),
641
641
  errorTag: error._tag,
642
642
  message: httpErrorMessage(error)
643
643
  });
@@ -719,7 +719,7 @@ function adaptiveLimiterLabels(req, stats, options) {
719
719
  });
720
720
  }
721
721
  function inferAdaptiveLimiterKey(req, stats) {
722
- const policy = _chunkVIFA4DPNcjs.getHttpRequestPolicy.call(void 0, req);
722
+ const policy = _chunkXPIMJQYScjs.getHttpRequestPolicy.call(void 0, req);
723
723
  if (policy.poolKey) return policy.poolKey;
724
724
  const host = requestHost(req);
725
725
  if (host) return host;
@@ -801,7 +801,7 @@ function requestLogFields(req, options) {
801
801
  }
802
802
  function requestPolicyLogFields(req, options) {
803
803
  if (!options.policy.enabled) return void 0;
804
- const policy = _chunkVIFA4DPNcjs.getHttpRequestPolicy.call(void 0, req);
804
+ const policy = _chunkXPIMJQYScjs.getHttpRequestPolicy.call(void 0, req);
805
805
  const fields = {
806
806
  ...policy.preset ? { preset: policy.preset } : {},
807
807
  ...policy.lane ? { lane: policy.lane } : {},
@@ -814,7 +814,7 @@ function requestPolicyLogFields(req, options) {
814
814
  }
815
815
  function requestPolicySpanAttributes(req, options) {
816
816
  if (!options.policy.enabled) return {};
817
- const policy = _chunkVIFA4DPNcjs.getHttpRequestPolicy.call(void 0, req);
817
+ const policy = _chunkXPIMJQYScjs.getHttpRequestPolicy.call(void 0, req);
818
818
  return {
819
819
  ...compactSpanAttributes({
820
820
  "http.request.policy.lane": policy.lane,
@@ -828,7 +828,7 @@ function requestPolicySpanAttributes(req, options) {
828
828
  }
829
829
  function requestPolicyMetricLabels(req, options) {
830
830
  if (!options.policy.enabled || options.policy.labelKeys.length === 0) return {};
831
- const policy = _chunkVIFA4DPNcjs.getHttpRequestPolicy.call(void 0, req);
831
+ const policy = _chunkXPIMJQYScjs.getHttpRequestPolicy.call(void 0, req);
832
832
  const values = {
833
833
  preset: policy.preset,
834
834
  lane: policy.lane,
@@ -904,17 +904,17 @@ function httpErrorStatusText(error) {
904
904
  return error._tag === "FetchError" ? error.statusText : void 0;
905
905
  }
906
906
  function injectCurrentTraceContext(req) {
907
- const fiber = _chunkSSQJKDN3cjs.getCurrentFiber.call(void 0, );
907
+ const fiber = _chunk2JHJ4YHScjs.getCurrentFiber.call(void 0, );
908
908
  const trace = _optionalChain([fiber, 'optionalAccess', _60 => _60.fiberContext, 'optionalAccess', _61 => _61.trace]);
909
909
  if (!_optionalChain([trace, 'optionalAccess', _62 => _62.traceId]) || !_optionalChain([trace, 'optionalAccess', _63 => _63.spanId])) return req;
910
910
  return {
911
911
  ...req,
912
- headers: _chunkLXBU5E77cjs.injectTraceContext.call(void 0, req.headers, trace)
912
+ headers: _chunkWI7GZF3Bcjs.injectTraceContext.call(void 0, req.headers, trace)
913
913
  };
914
914
  }
915
915
  function currentTraceExemplar(value, timestamp) {
916
- const fiber = _chunkSSQJKDN3cjs.getCurrentFiber.call(void 0, );
917
- return _chunkLXBU5E77cjs.exemplarFromTraceContext.call(void 0, _optionalChain([fiber, 'optionalAccess', _64 => _64.fiberContext, 'optionalAccess', _65 => _65.trace]), value, timestamp);
916
+ const fiber = _chunk2JHJ4YHScjs.getCurrentFiber.call(void 0, );
917
+ return _chunkWI7GZF3Bcjs.exemplarFromTraceContext.call(void 0, _optionalChain([fiber, 'optionalAccess', _64 => _64.fiberContext, 'optionalAccess', _65 => _65.trace]), value, timestamp);
918
918
  }
919
919
  function requestHost(req) {
920
920
  if (!isAbsoluteUrl(req.url)) return void 0;
@@ -982,38 +982,38 @@ function compactLabels(labels) {
982
982
 
983
983
  // src/observability/adapters.ts
984
984
  function makeFetchRequestObservabilityContext(observability, request, input = {}) {
985
- return _chunkLXBU5E77cjs.makeRequestObservabilityContext.call(void 0, observability, {
985
+ return _chunkWI7GZF3Bcjs.makeRequestObservabilityContext.call(void 0, observability, {
986
986
  headers: request.headers,
987
987
  method: request.method,
988
- target: _chunkLXBU5E77cjs.sanitizeHttpTarget.call(void 0, request.url),
989
- route: _nullishCoalesce(input.route, () => ( _chunkLXBU5E77cjs.normalizeHttpRoute.call(void 0, urlPathname(request.url)))),
988
+ target: _chunkWI7GZF3Bcjs.sanitizeHttpTarget.call(void 0, request.url),
989
+ route: _nullishCoalesce(input.route, () => ( _chunkWI7GZF3Bcjs.normalizeHttpRoute.call(void 0, urlPathname(request.url)))),
990
990
  ...input
991
991
  });
992
992
  }
993
993
  function makeNodeRequestObservabilityContext(observability, request, input = {}) {
994
- return _chunkLXBU5E77cjs.makeRequestObservabilityContext.call(void 0, observability, {
994
+ return _chunkWI7GZF3Bcjs.makeRequestObservabilityContext.call(void 0, observability, {
995
995
  headers: request.headers,
996
996
  method: request.method,
997
- target: _chunkLXBU5E77cjs.sanitizeHttpTarget.call(void 0, request.url),
998
- route: _nullishCoalesce(input.route, () => ( _chunkLXBU5E77cjs.normalizeHttpRoute.call(void 0, request.url))),
997
+ target: _chunkWI7GZF3Bcjs.sanitizeHttpTarget.call(void 0, request.url),
998
+ route: _nullishCoalesce(input.route, () => ( _chunkWI7GZF3Bcjs.normalizeHttpRoute.call(void 0, request.url))),
999
999
  ...input
1000
1000
  });
1001
1001
  }
1002
1002
  function makeExpressRequestObservabilityContext(observability, request, input = {}) {
1003
- return _chunkLXBU5E77cjs.makeRequestObservabilityContext.call(void 0, observability, {
1003
+ return _chunkWI7GZF3Bcjs.makeRequestObservabilityContext.call(void 0, observability, {
1004
1004
  headers: request.headers,
1005
1005
  method: request.method,
1006
- target: _chunkLXBU5E77cjs.sanitizeHttpTarget.call(void 0, _nullishCoalesce(request.originalUrl, () => ( request.url))),
1007
- route: _nullishCoalesce(_nullishCoalesce(input.route, () => ( _optionalChain([request, 'access', _66 => _66.route, 'optionalAccess', _67 => _67.path]))), () => ( _chunkLXBU5E77cjs.normalizeHttpRoute.call(void 0, _nullishCoalesce(request.path, () => ( request.url))))),
1006
+ target: _chunkWI7GZF3Bcjs.sanitizeHttpTarget.call(void 0, _nullishCoalesce(request.originalUrl, () => ( request.url))),
1007
+ route: _nullishCoalesce(_nullishCoalesce(input.route, () => ( _optionalChain([request, 'access', _66 => _66.route, 'optionalAccess', _67 => _67.path]))), () => ( _chunkWI7GZF3Bcjs.normalizeHttpRoute.call(void 0, _nullishCoalesce(request.path, () => ( request.url))))),
1008
1008
  ...input
1009
1009
  });
1010
1010
  }
1011
1011
  function makeFastifyRequestObservabilityContext(observability, request, input = {}) {
1012
- return _chunkLXBU5E77cjs.makeRequestObservabilityContext.call(void 0, observability, {
1012
+ return _chunkWI7GZF3Bcjs.makeRequestObservabilityContext.call(void 0, observability, {
1013
1013
  headers: request.headers,
1014
1014
  method: request.method,
1015
- target: _chunkLXBU5E77cjs.sanitizeHttpTarget.call(void 0, request.url),
1016
- route: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(input.route, () => ( _optionalChain([request, 'access', _68 => _68.routeOptions, 'optionalAccess', _69 => _69.url]))), () => ( request.routerPath)), () => ( _chunkLXBU5E77cjs.normalizeHttpRoute.call(void 0, request.url))),
1015
+ target: _chunkWI7GZF3Bcjs.sanitizeHttpTarget.call(void 0, request.url),
1016
+ route: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(input.route, () => ( _optionalChain([request, 'access', _68 => _68.routeOptions, 'optionalAccess', _69 => _69.url]))), () => ( request.routerPath)), () => ( _chunkWI7GZF3Bcjs.normalizeHttpRoute.call(void 0, request.url))),
1017
1017
  ...input
1018
1018
  });
1019
1019
  }
@@ -1034,7 +1034,7 @@ function urlPathname(url) {
1034
1034
 
1035
1035
  // src/observability/config.ts
1036
1036
  function makeNoopObservability() {
1037
- return _chunkLXBU5E77cjs.makeObservability.call(void 0, {
1037
+ return _chunkWI7GZF3Bcjs.makeObservability.call(void 0, {
1038
1038
  metrics: false,
1039
1039
  logs: false,
1040
1040
  traces: false,
@@ -1043,12 +1043,12 @@ function makeNoopObservability() {
1043
1043
  }
1044
1044
  function makeObservabilityPreset(preset, overrides = {}) {
1045
1045
  if (preset === "disabled") return makeNoopObservability();
1046
- return _chunkLXBU5E77cjs.makeObservability.call(void 0, mergeObservabilityOptions(observabilityOptionsForPreset(preset), overrides));
1046
+ return _chunkWI7GZF3Bcjs.makeObservability.call(void 0, mergeObservabilityOptions(observabilityOptionsForPreset(preset), overrides));
1047
1047
  }
1048
1048
  function makeObservabilityFromEnv(env = readProcessEnv(), overrides = {}) {
1049
1049
  const preset = env.BRASS_OBSERVABILITY === "disabled" ? "disabled" : parsePreset(_nullishCoalesce(env.BRASS_OBSERVABILITY_PRESET, () => ( env.NODE_ENV)));
1050
1050
  if (preset === "disabled") return makeNoopObservability();
1051
- return _chunkLXBU5E77cjs.makeObservability.call(void 0, mergeObservabilityOptions(observabilityOptionsFromEnv(env, preset), overrides));
1051
+ return _chunkWI7GZF3Bcjs.makeObservability.call(void 0, mergeObservabilityOptions(observabilityOptionsFromEnv(env, preset), overrides));
1052
1052
  }
1053
1053
  function observabilityOptionsForPreset(preset) {
1054
1054
  switch (preset) {
@@ -1179,27 +1179,27 @@ function readProcessEnv() {
1179
1179
  }
1180
1180
 
1181
1181
  // src/observability/layer.ts
1182
- var ObservabilityService = _chunk7TXQJFZXcjs.makeServiceTag.call(void 0, "Observability");
1182
+ var ObservabilityService = _chunk5RZ7YITFcjs.makeServiceTag.call(void 0, "Observability");
1183
1183
  function makeObservabilityLayer(config = {}, options = {}) {
1184
1184
  const tag = _nullishCoalesce(options.tag, () => ( ObservabilityService));
1185
- return _chunk7TXQJFZXcjs.layerEffect.call(void 0,
1185
+ return _chunk5RZ7YITFcjs.layerEffect.call(void 0,
1186
1186
  tag,
1187
- (context) => _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => _chunkLXBU5E77cjs.makeObservability.call(void 0, resolveObservabilityLayerConfig(config, context))),
1187
+ (context) => _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => _chunkWI7GZF3Bcjs.makeObservability.call(void 0, resolveObservabilityLayerConfig(config, context))),
1188
1188
  shutdownObservability
1189
1189
  );
1190
1190
  }
1191
1191
  function makeObservedRuntimeLayer(options = {}) {
1192
1192
  const {
1193
1193
  observabilityTag = ObservabilityService,
1194
- runtimeTag = _chunk5XADBMSUcjs.RuntimeService,
1194
+ runtimeTag = _chunkELIECDYNcjs.RuntimeService,
1195
1195
  env = {},
1196
1196
  ...runtimeOptions
1197
1197
  } = options;
1198
- return _chunk7TXQJFZXcjs.layerEffect.call(void 0,
1198
+ return _chunk5RZ7YITFcjs.layerEffect.call(void 0,
1199
1199
  runtimeTag,
1200
1200
  (context) => _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
1201
1201
  const observability = context.unsafeGet(observabilityTag);
1202
- return new (0, _chunkSSQJKDN3cjs.Runtime)({
1202
+ return new (0, _chunk2JHJ4YHScjs.Runtime)({
1203
1203
  ...runtimeOptions,
1204
1204
  env: mergeRuntimeEnv(resolveObservedRuntimeLayerEnv(env, context, observability), observability.env),
1205
1205
  hooks: observability.hooks
@@ -1209,8 +1209,8 @@ function makeObservedRuntimeLayer(options = {}) {
1209
1209
  }
1210
1210
  function makeObservedHttpClientLayer(config = {}, options = {}) {
1211
1211
  const observabilityTag = _nullishCoalesce(options.observabilityTag, () => ( ObservabilityService));
1212
- const httpTag = _nullishCoalesce(options.httpTag, () => ( _chunkVIFA4DPNcjs.HttpClientService));
1213
- return _chunk7TXQJFZXcjs.layerEffect.call(void 0,
1212
+ const httpTag = _nullishCoalesce(options.httpTag, () => ( _chunkXPIMJQYScjs.HttpClientService));
1213
+ return _chunk5RZ7YITFcjs.layerEffect.call(void 0,
1214
1214
  httpTag,
1215
1215
  (context) => _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
1216
1216
  const observability = context.unsafeGet(observabilityTag);
@@ -1220,7 +1220,7 @@ function makeObservedHttpClientLayer(config = {}, options = {}) {
1220
1220
  context,
1221
1221
  observability
1222
1222
  );
1223
- return _chunkVIFA4DPNcjs.makeDefaultHttpClient.call(void 0, {
1223
+ return _chunkXPIMJQYScjs.makeDefaultHttpClient.call(void 0, {
1224
1224
  ...httpConfig,
1225
1225
  middleware: [
1226
1226
  ..._nullishCoalesce(httpConfig.middleware, () => ( [])),
@@ -1250,7 +1250,7 @@ function mergeRuntimeEnv(env, observabilityEnv) {
1250
1250
  return Object.assign({}, env, observabilityEnv);
1251
1251
  }
1252
1252
  function shutdownObservability(observability) {
1253
- return _chunkSSQJKDN3cjs.fromPromiseAbortable.call(void 0,
1253
+ return _chunk2JHJ4YHScjs.fromPromiseAbortable.call(void 0,
1254
1254
  () => observability.shutdown().then(() => void 0),
1255
1255
  () => void 0,
1256
1256
  { label: "observability.shutdown" }