brass-runtime 1.17.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 (120) hide show
  1. package/README.md +36 -3
  2. package/dist/agent/cli/main.cjs +31 -32
  3. package/dist/agent/cli/main.js +3 -4
  4. package/dist/agent/cli/main.mjs +3 -4
  5. package/dist/agent/index.cjs +4 -5
  6. package/dist/agent/index.d.ts +1 -1
  7. package/dist/agent/index.js +3 -4
  8. package/dist/agent/index.mjs +3 -4
  9. package/dist/{chunk-7X3K5RMS.js → chunk-22HZQG5F.js} +9 -11
  10. package/dist/{chunk-GLE2WY7Z.cjs → chunk-2JHJ4YHS.cjs} +417 -124
  11. package/dist/{chunk-Q2I37RP3.cjs → chunk-2OW6IFY2.cjs} +44 -323
  12. package/dist/{chunk-7ZPEZ57L.cjs → chunk-5LC7V2OZ.cjs} +18 -20
  13. package/dist/{chunk-AGR5B2BC.cjs → chunk-5RZ7YITF.cjs} +564 -12
  14. package/dist/{chunk-DNFJLJMW.mjs → chunk-6MLAZPBL.mjs} +48 -24
  15. package/dist/{chunk-EJ6BPYVR.mjs → chunk-6V2AWT4R.mjs} +1 -1
  16. package/dist/{chunk-3AYM6WPJ.js → chunk-7DU7IQHK.js} +20 -299
  17. package/dist/{chunk-SK7UZRNI.mjs → chunk-7GBJYOX7.mjs} +528 -23
  18. package/dist/chunk-7TKI527D.cjs +123 -0
  19. package/dist/{chunk-52OB2ROS.js → chunk-7VQLEN37.js} +2 -4
  20. package/dist/{chunk-KH4SYAOS.mjs → chunk-B5FKOLTB.mjs} +20 -299
  21. package/dist/{chunk-FHQGHPMO.mjs → chunk-BC6Q6BCO.mjs} +2 -4
  22. package/dist/{chunk-4P2HHGAX.mjs → chunk-COOW7BJX.mjs} +32 -11
  23. package/dist/{chunk-2HQTDLHF.mjs → chunk-EEN5OTCR.mjs} +555 -3
  24. package/dist/{chunk-KZJQ723N.cjs → chunk-EICAJDNX.cjs} +13 -15
  25. package/dist/chunk-ELIECDYN.cjs +33 -0
  26. package/dist/{chunk-GYM3LLGS.mjs → chunk-H626ZTDZ.mjs} +399 -106
  27. package/dist/{chunk-C3MDXTRZ.js → chunk-HCJ4S3YB.js} +48 -24
  28. package/dist/{chunk-7JIJOVCT.js → chunk-IPSMXUWA.js} +2 -4
  29. package/dist/{chunk-4ROBZFL6.cjs → chunk-J6DUHITE.cjs} +6 -8
  30. package/dist/{chunk-6RY2FFN4.mjs → chunk-JWIEMBE6.mjs} +9 -11
  31. package/dist/{chunk-PD4EJTQC.cjs → chunk-KNTJ7FQB.cjs} +5 -5
  32. package/dist/chunk-KTGDLBLD.mjs +123 -0
  33. package/dist/chunk-LSYQ3C2M.js +33 -0
  34. package/dist/{chunk-RKGKFN2A.js → chunk-OW5VHAOE.js} +1 -1
  35. package/dist/{chunk-EOC4UHBS.mjs → chunk-RBHNOKH4.mjs} +2 -2
  36. package/dist/{chunk-6IXXWIUM.js → chunk-S4HXADU4.js} +555 -3
  37. package/dist/{chunk-FH2X7BVP.js → chunk-TTSPIU3U.js} +399 -106
  38. package/dist/{chunk-5QC7LRZ3.js → chunk-UAKAF32U.js} +2 -2
  39. package/dist/{chunk-CZIVE6NT.cjs → chunk-UUMKZJRJ.cjs} +48 -24
  40. package/dist/{chunk-MBEJI5HF.mjs → chunk-WCBNXPN6.mjs} +2 -4
  41. package/dist/{chunk-52PPNNI4.cjs → chunk-WGE2FEZE.cjs} +2 -2
  42. package/dist/{chunk-WBGRHGBP.cjs → chunk-WI7GZF3B.cjs} +114 -93
  43. package/dist/chunk-WUDHOZIH.js +6234 -0
  44. package/dist/{chunk-F6XWZQY4.cjs → chunk-WVSZOPGQ.cjs} +583 -78
  45. package/dist/chunk-XPIMJQYS.cjs +6234 -0
  46. package/dist/{chunk-VWIPB6I5.js → chunk-YGR2IN4R.js} +528 -23
  47. package/dist/chunk-YM3EDNYD.js +123 -0
  48. package/dist/chunk-YWLLH27R.mjs +33 -0
  49. package/dist/{chunk-BKK77SBA.js → chunk-YZ5LQ32F.js} +32 -11
  50. package/dist/chunk-Z3ZZMQUZ.mjs +6234 -0
  51. package/dist/core/index.cjs +37 -9
  52. package/dist/core/index.d.ts +19 -152
  53. package/dist/core/index.js +86 -58
  54. package/dist/core/index.mjs +86 -58
  55. package/dist/defaultClient-Cid0JoUR.d.ts +1648 -0
  56. package/dist/{effect-DIUHZ9IN.d.ts → effect-DnGUuhw6.d.ts} +22 -1
  57. package/dist/http/index.cjs +206 -59
  58. package/dist/http/index.d.ts +55 -819
  59. package/dist/http/index.js +220 -73
  60. package/dist/http/index.mjs +220 -73
  61. package/dist/http/testing.cjs +31 -10
  62. package/dist/http/testing.d.ts +16 -5
  63. package/dist/http/testing.js +29 -8
  64. package/dist/http/testing.mjs +29 -8
  65. package/dist/index.cjs +116 -88
  66. package/dist/index.d.ts +9 -8
  67. package/dist/index.js +87 -59
  68. package/dist/index.mjs +87 -59
  69. package/dist/{schedule-CK3Ml_7p.d.ts → layer-D2LFcBVx.d.ts} +176 -2
  70. package/dist/observability/index.cjs +20 -7
  71. package/dist/observability/index.d.ts +32 -8
  72. package/dist/observability/index.js +19 -6
  73. package/dist/observability/index.mjs +19 -6
  74. package/dist/perf/cli.cjs +26 -28
  75. package/dist/perf/cli.js +11 -13
  76. package/dist/perf/cli.mjs +11 -13
  77. package/dist/perf/index.cjs +13 -15
  78. package/dist/perf/index.js +11 -13
  79. package/dist/perf/index.mjs +11 -13
  80. package/dist/schema/index.cjs +2 -2
  81. package/dist/schema/index.js +1 -1
  82. package/dist/schema/index.mjs +1 -1
  83. package/dist/{server-D6JZ15_e.d.ts → server-Bf1zNYZk.d.ts} +5 -5
  84. package/dist/{stream-B4oK9JFP.d.ts → stream-I7bkvF7a.d.ts} +1 -1
  85. package/dist/{tracer-Hwt1cl7h.d.ts → tracer-DF83nLn6.d.ts} +2 -2
  86. package/dist/{tracing-DqbTKGcf.d.ts → tracing-CWV4gT0u.d.ts} +1 -1
  87. package/docs/README.md +2 -0
  88. package/docs/ai/PUBLIC_API.md +28 -7
  89. package/docs/articles/brass-runtime-http-observability.md +467 -0
  90. package/docs/frameworks/angular.md +51 -0
  91. package/docs/frameworks/express.md +58 -0
  92. package/docs/frameworks/fastify.md +49 -0
  93. package/docs/frameworks/nestjs.md +53 -0
  94. package/docs/frameworks/nextjs.md +55 -0
  95. package/docs/frameworks/react.md +44 -0
  96. package/docs/frameworks/vanilla.md +56 -0
  97. package/docs/guides/layers.md +130 -0
  98. package/docs/http-recipes.md +31 -1
  99. package/docs/http.md +50 -1
  100. package/docs/observability.md +132 -0
  101. package/docs/performance-profiler.md +6 -2
  102. package/docs/recipes/layers.md +46 -2
  103. package/docs/recipes/testing.md +25 -0
  104. package/package.json +6 -2
  105. package/dist/chunk-3LOYJFRR.cjs +0 -300
  106. package/dist/chunk-3Y2RIUMM.js +0 -300
  107. package/dist/chunk-5EC274J5.cjs +0 -2874
  108. package/dist/chunk-5VRJNBLZ.mjs +0 -2874
  109. package/dist/chunk-62AZW6UT.cjs +0 -313
  110. package/dist/chunk-74ZTY6CP.js +0 -2871
  111. package/dist/chunk-7CMJS3QE.mjs +0 -2871
  112. package/dist/chunk-A2OM6NEH.mjs +0 -194
  113. package/dist/chunk-B33ICAKP.js +0 -313
  114. package/dist/chunk-JF5WGYJJ.cjs +0 -194
  115. package/dist/chunk-KN32XNTH.mjs +0 -313
  116. package/dist/chunk-KQLYONSE.cjs +0 -2871
  117. package/dist/chunk-L2SYFEBS.js +0 -194
  118. package/dist/chunk-MIIYDLGM.js +0 -2874
  119. package/dist/chunk-PWC3RBQE.mjs +0 -300
  120. package/dist/client-CZHU674n.d.ts +0 -820
@@ -759,6 +759,7 @@ declare class Runtime<R> {
759
759
  capabilities(): RuntimeCapabilities;
760
760
  shutdown(): Promise<void> | void;
761
761
  unsafeRunAsync<E, A>(effect: Async<R, E, A>, cb: (exit: Exit<E, A>) => void): void;
762
+ private static exitToError;
762
763
  toPromise<E, A>(effect: Async<R, E, A>): Promise<A>;
763
764
  private tryRunNativeTopLevel;
764
765
  unsafeRun<E, A>(effect: Async<R, E, A>): void;
@@ -785,6 +786,16 @@ type AbortablePromiseFinish = {
785
786
  readonly durationMs: number;
786
787
  readonly error?: unknown;
787
788
  };
789
+ /**
790
+ * Duck-typed timer wheel interface for use in AbortablePromiseOptions.
791
+ * Avoids importing from `src/http/timerWheel.ts` to prevent circular dependencies.
792
+ * Any object with a compatible `schedule` method can be used.
793
+ */
794
+ interface AbortablePromiseTimerWheel {
795
+ schedule(timeoutMs: number, cb: () => void): {
796
+ cancel(): void;
797
+ };
798
+ }
788
799
  type AbortablePromiseOptions = {
789
800
  /** Logical label used by diagnostics. Keep it low-cardinality: e.g. `http:GET:https://api.foo.com`. */
790
801
  readonly label?: string;
@@ -794,6 +805,8 @@ type AbortablePromiseOptions = {
794
805
  readonly timeoutReason?: () => unknown;
795
806
  readonly onStart?: (label: string) => void;
796
807
  readonly onFinish?: (finish: AbortablePromiseFinish) => void;
808
+ /** Optional timer wheel for efficient timeout scheduling. When provided, uses wheel.schedule() instead of setTimeout. */
809
+ readonly timerWheel?: AbortablePromiseTimerWheel;
797
810
  };
798
811
  type AbortablePromiseLabelStats = {
799
812
  readonly label: string;
@@ -815,6 +828,14 @@ type AbortablePromiseStats = {
815
828
  readonly lateSettlements: number;
816
829
  readonly byLabel: AbortablePromiseLabelStats[];
817
830
  };
831
+ /**
832
+ * Enable or disable per-label tracking for abortable promise diagnostics.
833
+ * When disabled (default), only global integer counters are incremented on the hot path,
834
+ * avoiding Map allocations entirely. Returns the previous enabled state.
835
+ */
836
+ declare function setAbortablePromisePerLabelTracking(enabled: boolean): boolean;
837
+ declare const recordAbortablePromiseStart: (label: string) => void;
838
+ declare const recordAbortablePromiseFinish: (label: string, outcome: AbortablePromiseOutcome) => void;
818
839
  declare function abortablePromiseStats(): AbortablePromiseStats;
819
840
  declare function resetAbortablePromiseStats(): void;
820
841
  /**
@@ -1159,4 +1180,4 @@ declare function uninterruptibleMask<R, E, A>(body: (restore: RestoreInterruptib
1159
1180
  declare function orElseOptional<R, E, A, R2, A2>(fa: ZIO<R, Option<E>, A>, that: () => ZIO<R2, Option<E>, A2>): ZIO<R & R2, Option<E>, A | A2>;
1160
1181
  declare const end: <E>() => ZIO<unknown, Option<E>, never>;
1161
1182
 
1162
- export { type FiberEngineKind as $, Async as A, type Baggage as B, type AsyncWithPromise as C, type RingLike as D, Exit as E, type FiberEngine as F, type CancelToken as G, type Canceler as H, Cause as I, type JSONValue as J, type CausePrettyOptions as K, type ContextNode as L, type CustomHostAction as M, type NodeId as N, type Option as O, type DbHostAction as P, type DecodeRef as Q, type RuntimeHooks as R, Scope as S, type TraceContext as T, DefaultHostExecutor as U, type EngineKind as V, type WasmEngineRuntime as W, type EngineSelection as X, type EngineSelectionMode as Y, type ZIO as Z, type FiberContext as _, type RuntimeEmitContext as a, emptyContext as a$, type FiberInfo as a0, type FiberReadyQueue as a1, type FiberReadyQueueOptions as a2, type FiberReadyQueueStats as a3, type FiberRunState as a4, type FlatMapRef as a5, type FoldFailureRef as a6, type FoldSuccessRef as a7, type HostAction as a8, type HostActionKind as a9, type SchedulerLaneMode as aA, type SchedulerOptions as aB, type SchedulerStats as aC, type SchedulerStatsData as aD, type ScopeId as aE, type ScopeInfo as aF, type Some as aG, type SyncRef as aH, type Task as aI, WasmFiberEngine as aJ, type WasmFiberEngineOptions as aK, abortablePromiseStats as aL, acquireRelease as aM, asyncEffect as aN, asyncCatchAll as aO, asyncFail as aP, asyncFlatMap as aQ, asyncFold as aR, asyncInterruptible as aS, asyncMap as aT, asyncMapError as aU, asyncSucceed as aV, asyncSync as aW, asyncTotal as aX, catchAll as aY, ctxExtend as aZ, ctxToObject as a_, type HostActionResult as aa, type HostExecutionContext as ab, type HostExecutor as ac, HostRegistry as ad, type HostRegistryStats as ae, type HttpHostAction as af, type Interrupted as ag, type InterruptibilityMode as ah, type Joiner as ai, type LaneStatsData as aj, type None as ak, NoopHooks as al, ProgramBuilder as am, type ProgramPatch as an, PushStatus as ao, type QueueHostAction as ap, type ReadyQueueScheduleKind as aq, type RestoreInterruptibility as ar, RingBuffer as as, type RingBufferEngine as at, type RingBufferStatsData as au, type RuntimeCapabilities as av, type RuntimeEngineMode as aw, type ScheduleResult as ax, Scheduler as ay, type SchedulerEngine as az, type RingBufferOptions as b, end as b0, engineStats as b1, fail as b2, flatMap as b3, fork as b4, formatCause as b5, fromPromiseAbortable as b6, getBenchmarkBudget as b7, getCurrentFiber as b8, globalScheduler as b9, toPromise as bA, toPromiseByCaller as bB, uninterruptible as bC, uninterruptibleMask as bD, unit as bE, unsafeGetCurrentRuntime as bF, unsafeRunAsync as bG, unsafeRunFoldWithEnv as bH, withAsyncPromise as bI, withCurrentFiber as bJ, withScope as bK, withScopeAsync as bL, inferCallerLaneFromStack as ba, interruptible as bb, isCause as bc, laneTag as bd, linkAbortController as be, makeBoundedRingBuffer as bf, makeCancelToken as bg, makeFiberReadyQueue as bh, makeRuntimeEventRecord as bi, map as bj, mapAsync as bk, mapError as bl, mapTryAsync as bm, none as bn, orElseOptional as bo, prettyCause as bp, resetAbortablePromiseStats as bq, runtimeCapabilities as br, runtimeEventRecordContext as bs, runtimeForCaller as bt, sanitizeLaneKey as bu, selectedEngineStats as bv, setBenchmarkBudget as bw, some as bx, succeed as by, sync as bz, type RuntimeEvent as c, type RuntimeEventRecord as d, type RuntimeSpanLink as e, Runtime as f, RuntimeRegistry as g, type RuntimeOptions as h, RuntimeFiber as i, type FiberEngineStats as j, type Fiber as k, type FiberId as l, type FiberStatus as m, type WasmBridge as n, type OpcodeProgram as o, type FiberId$1 as p, type EngineEvent as q, type RefId as r, type OpcodeNode as s, type EngineStats as t, type AbortablePromiseFinish as u, type AbortablePromiseLabelStats as v, type AbortablePromiseOptions as w, type AbortablePromiseOutcome as x, type AbortablePromiseStats as y, type AsyncRegisterRef as z };
1183
+ export { type FiberContext as $, Async as A, type Baggage as B, type AsyncRegisterRef as C, type AsyncWithPromise as D, Exit as E, type FiberEngine as F, type RingLike as G, type CancelToken as H, type Canceler as I, type JSONValue as J, Cause as K, type CausePrettyOptions as L, type ContextNode as M, type NodeId as N, type Option as O, type CustomHostAction as P, type DbHostAction as Q, type RuntimeHooks as R, Scope as S, type TraceContext as T, type DecodeRef as U, DefaultHostExecutor as V, type WasmEngineRuntime as W, type EngineKind as X, type EngineSelection as Y, type ZIO as Z, type EngineSelectionMode as _, type RuntimeOptions as a, ctxToObject as a$, type FiberEngineKind as a0, type FiberInfo as a1, type FiberReadyQueue as a2, type FiberReadyQueueOptions as a3, type FiberReadyQueueStats as a4, type FiberRunState as a5, type FlatMapRef as a6, type FoldFailureRef as a7, type FoldSuccessRef as a8, type HostAction as a9, type SchedulerEngine as aA, type SchedulerLaneMode as aB, type SchedulerOptions as aC, type SchedulerStats as aD, type SchedulerStatsData as aE, type ScopeId as aF, type ScopeInfo as aG, type Some as aH, type SyncRef as aI, type Task as aJ, WasmFiberEngine as aK, type WasmFiberEngineOptions as aL, abortablePromiseStats as aM, acquireRelease as aN, asyncEffect as aO, asyncCatchAll as aP, asyncFail as aQ, asyncFlatMap as aR, asyncFold as aS, asyncInterruptible as aT, asyncMap as aU, asyncMapError as aV, asyncSucceed as aW, asyncSync as aX, asyncTotal as aY, catchAll as aZ, ctxExtend as a_, type HostActionKind as aa, type HostActionResult as ab, type HostExecutionContext as ac, type HostExecutor as ad, HostRegistry as ae, type HostRegistryStats as af, type HttpHostAction as ag, type Interrupted as ah, type InterruptibilityMode as ai, type Joiner as aj, type LaneStatsData as ak, type None as al, NoopHooks as am, ProgramBuilder as an, type ProgramPatch as ao, PushStatus as ap, type QueueHostAction as aq, type ReadyQueueScheduleKind as ar, type RestoreInterruptibility as as, RingBuffer as at, type RingBufferEngine as au, type RingBufferStatsData as av, type RuntimeCapabilities as aw, type RuntimeEngineMode as ax, type ScheduleResult as ay, Scheduler as az, Runtime as b, emptyContext as b0, end as b1, engineStats as b2, fail as b3, flatMap as b4, fork as b5, formatCause as b6, fromPromiseAbortable as b7, getBenchmarkBudget as b8, getCurrentFiber as b9, setBenchmarkBudget as bA, some as bB, succeed as bC, sync as bD, toPromise as bE, toPromiseByCaller as bF, uninterruptible as bG, uninterruptibleMask as bH, unit as bI, unsafeGetCurrentRuntime as bJ, unsafeRunAsync as bK, unsafeRunFoldWithEnv as bL, withAsyncPromise as bM, withCurrentFiber as bN, withScope as bO, withScopeAsync as bP, globalScheduler as ba, inferCallerLaneFromStack as bb, interruptible as bc, isCause as bd, laneTag as be, linkAbortController as bf, makeBoundedRingBuffer as bg, makeCancelToken as bh, makeFiberReadyQueue as bi, makeRuntimeEventRecord as bj, map as bk, mapAsync as bl, mapError as bm, mapTryAsync as bn, none as bo, orElseOptional as bp, prettyCause as bq, recordAbortablePromiseFinish as br, recordAbortablePromiseStart as bs, resetAbortablePromiseStats as bt, runtimeCapabilities as bu, runtimeEventRecordContext as bv, runtimeForCaller as bw, sanitizeLaneKey as bx, selectedEngineStats as by, setAbortablePromisePerLabelTracking as bz, type RingBufferOptions as c, type RuntimeEvent as d, type RuntimeEmitContext as e, type RuntimeEventRecord as f, type RuntimeSpanLink as g, RuntimeRegistry as h, RuntimeFiber as i, type FiberEngineStats as j, type Fiber as k, type FiberId as l, type FiberStatus as m, type WasmBridge as n, type OpcodeProgram as o, type FiberId$1 as p, type EngineEvent as q, type RefId as r, type OpcodeNode as s, type EngineStats as t, type AbortablePromiseFinish as u, type AbortablePromiseLabelStats as v, type AbortablePromiseOptions as w, type AbortablePromiseOutcome as x, type AbortablePromiseStats as y, type AbortablePromiseTimerWheel as z };