brass-runtime 1.15.0 → 1.16.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 (93) hide show
  1. package/README.md +409 -137
  2. package/dist/agent/cli/main.cjs +40 -35
  3. package/dist/agent/cli/main.js +9 -4
  4. package/dist/agent/cli/main.mjs +9 -4
  5. package/dist/agent/index.cjs +8 -4
  6. package/dist/agent/index.d.ts +1 -1
  7. package/dist/agent/index.js +7 -3
  8. package/dist/agent/index.mjs +7 -3
  9. package/dist/{chunk-PPUXIH5R.js → chunk-2WC63LJK.mjs} +11 -7
  10. package/dist/chunk-3RG5ZIWI.js +10 -0
  11. package/dist/chunk-45F7OKGT.cjs +104 -0
  12. package/dist/chunk-5YOQOXEQ.cjs +2491 -0
  13. package/dist/{chunk-STVLQ3XD.cjs → chunk-7HUOJA4W.cjs} +78 -74
  14. package/dist/{chunk-BMH5AV44.js → chunk-7LVI2GIN.js} +251 -370
  15. package/dist/chunk-7TL2LHQJ.js +2491 -0
  16. package/dist/chunk-7V4KY4RL.mjs +104 -0
  17. package/dist/chunk-7XOPAB5Q.js +2143 -0
  18. package/dist/chunk-CCKHV5BT.mjs +193 -0
  19. package/dist/{chunk-AR22SXML.js → chunk-CY33PGEX.mjs} +488 -421
  20. package/dist/chunk-DJQ7OMMB.cjs +144 -0
  21. package/dist/chunk-F5EUMJL7.mjs +2143 -0
  22. package/dist/chunk-FM4W4QPL.js +193 -0
  23. package/dist/{chunk-TO7IKXYT.js → chunk-G3XGCZDQ.js} +1 -1
  24. package/dist/{chunk-BDF4AMWX.mjs → chunk-G6IQOE4P.mjs} +251 -370
  25. package/dist/chunk-GOV47PPB.mjs +552 -0
  26. package/dist/chunk-H55LI6WY.js +93 -0
  27. package/dist/chunk-IJT6RRQ5.cjs +93 -0
  28. package/dist/{chunk-ELOOF35R.mjs → chunk-J3H54ZRV.mjs} +1 -1
  29. package/dist/chunk-JF4XXPZ5.cjs +552 -0
  30. package/dist/chunk-JNFRRJYH.cjs +2143 -0
  31. package/dist/chunk-JX3LZQJH.cjs +354 -0
  32. package/dist/chunk-K2T3DV26.mjs +93 -0
  33. package/dist/chunk-KCPT2D6G.js +552 -0
  34. package/dist/chunk-MWXMNYJS.cjs +1110 -0
  35. package/dist/{chunk-VEZNF5GZ.cjs → chunk-N6VHMOWB.cjs} +130 -126
  36. package/dist/{chunk-3QMOKAS5.js → chunk-NC5SDRYE.js} +9 -5
  37. package/dist/chunk-NOYZIMUJ.mjs +144 -0
  38. package/dist/{chunk-R3R2FVLG.cjs → chunk-NYL4D7SK.cjs} +5 -5
  39. package/dist/chunk-OBGZSXTJ.cjs +10 -0
  40. package/dist/{chunk-4NHES7VK.mjs → chunk-OOGJ73B6.js} +11 -7
  41. package/dist/chunk-PNVFW245.js +144 -0
  42. package/dist/chunk-PRWCB3QL.mjs +2491 -0
  43. package/dist/{chunk-JFPU5GQI.mjs → chunk-QY5FKYEQ.js} +488 -421
  44. package/dist/chunk-ROJC3NBJ.js +104 -0
  45. package/dist/chunk-SPUEME2B.cjs +343 -0
  46. package/dist/chunk-TDVMADDN.js +343 -0
  47. package/dist/chunk-TVN5I4U6.cjs +193 -0
  48. package/dist/chunk-U5KWK3PX.mjs +343 -0
  49. package/dist/chunk-VFIUZG7J.mjs +354 -0
  50. package/dist/{chunk-TGIFUAK4.cjs → chunk-WQ5QNU5R.cjs} +459 -578
  51. package/dist/chunk-XDZOO4L5.js +354 -0
  52. package/dist/chunk-Y6FXYEAI.mjs +10 -0
  53. package/dist/{chunk-K6M7MDZ4.mjs → chunk-ZGLD4TVZ.mjs} +9 -5
  54. package/dist/client-CtFmoDvM.d.ts +645 -0
  55. package/dist/core/index.cjs +72 -4
  56. package/dist/core/index.d.ts +92 -198
  57. package/dist/core/index.js +106 -38
  58. package/dist/core/index.mjs +106 -38
  59. package/dist/{effect-CMOQKX8y.d.ts → effect-CGNl5Rqp.d.ts} +107 -1
  60. package/dist/effectRunner-3ZHAD3LE.cjs +8 -0
  61. package/dist/effectRunner-A4CHJXJI.js +8 -0
  62. package/dist/effectRunner-OPUF6QRN.mjs +8 -0
  63. package/dist/http/index.cjs +2189 -1271
  64. package/dist/http/index.d.ts +830 -270
  65. package/dist/http/index.js +2008 -1090
  66. package/dist/http/index.mjs +2008 -1090
  67. package/dist/http/testing.cjs +159 -0
  68. package/dist/http/testing.d.ts +42 -0
  69. package/dist/http/testing.js +159 -0
  70. package/dist/http/testing.mjs +159 -0
  71. package/dist/index.cjs +246 -178
  72. package/dist/index.d.ts +9 -35
  73. package/dist/index.js +120 -52
  74. package/dist/index.mjs +120 -52
  75. package/dist/observability/index.cjs +677 -0
  76. package/dist/observability/index.d.ts +79 -0
  77. package/dist/observability/index.js +677 -0
  78. package/dist/observability/index.mjs +677 -0
  79. package/dist/schedule-Fque9Abz.d.ts +70 -0
  80. package/dist/schema/index.cjs +25 -0
  81. package/dist/schema/index.d.ts +177 -0
  82. package/dist/schema/index.js +25 -0
  83. package/dist/schema/index.mjs +25 -0
  84. package/dist/server-C8hDXA74.d.ts +674 -0
  85. package/dist/{stream-FQm9h4Mg.d.ts → stream-dvSs0QS5.d.ts} +1 -1
  86. package/dist/tracer-B5tRH9H7.d.ts +230 -0
  87. package/dist/tracing-Dt9S_6V8.d.ts +148 -0
  88. package/package.json +27 -1
  89. package/dist/chunk-BDYEENHT.js +0 -224
  90. package/dist/chunk-MS34J5LY.cjs +0 -224
  91. package/dist/chunk-UMAZLXAB.mjs +0 -224
  92. package/dist/chunk-XPZNXSVN.cjs +0 -1043
  93. package/dist/tracing-DNT9jEbr.d.ts +0 -106
@@ -0,0 +1,70 @@
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 };
@@ -0,0 +1,25 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+ var _chunkSPUEME2Bcjs = require('../chunk-SPUEME2B.cjs');
13
+ require('../chunk-OBGZSXTJ.cjs');
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+ exports.ConfigValidationError = _chunkSPUEME2Bcjs.ConfigValidationError; exports.Schema = _chunkSPUEME2Bcjs.Schema; exports.SchemaValidationException = _chunkSPUEME2Bcjs.SchemaValidationException; exports.formatIssues = _chunkSPUEME2Bcjs.formatIssues; exports.isSchema = _chunkSPUEME2Bcjs.isSchema; exports.makeSchemaIssue = _chunkSPUEME2Bcjs.makeSchemaIssue; exports.parseConfig = _chunkSPUEME2Bcjs.parseConfig; exports.s = _chunkSPUEME2Bcjs.s; exports.schema = _chunkSPUEME2Bcjs.schema; exports.validateValue = _chunkSPUEME2Bcjs.validateValue;
@@ -0,0 +1,177 @@
1
+ type SchemaPathPart = string | number;
2
+ type SchemaIssue = {
3
+ readonly path: readonly SchemaPathPart[];
4
+ readonly expected: string;
5
+ readonly received: string;
6
+ readonly message: string;
7
+ };
8
+ type SchemaResult<A> = {
9
+ readonly success: true;
10
+ readonly data: A;
11
+ } | {
12
+ readonly success: false;
13
+ readonly issues: readonly SchemaIssue[];
14
+ };
15
+ type AnySchema = Schema<any, any>;
16
+ type InferSchema<S> = S extends Schema<infer A, any> ? A : never;
17
+ type SchemaShape = Record<string, AnySchema>;
18
+ type OptionalKeys<Shape extends SchemaShape> = {
19
+ [K in keyof Shape]: Shape[K] extends Schema<any, true> ? K : never;
20
+ }[keyof Shape];
21
+ type RequiredKeys<Shape extends SchemaShape> = Exclude<keyof Shape, OptionalKeys<Shape>>;
22
+ type Simplify<T> = {
23
+ [K in keyof T]: T[K];
24
+ } & {};
25
+ type InferObject<Shape extends SchemaShape> = Simplify<{
26
+ [K in RequiredKeys<Shape>]: InferSchema<Shape[K]>;
27
+ } & {
28
+ [K in OptionalKeys<Shape>]?: Exclude<InferSchema<Shape[K]>, undefined>;
29
+ }>;
30
+ type JsonValidatorResult<A> = {
31
+ readonly success: true;
32
+ readonly data: A;
33
+ } | {
34
+ readonly success: false;
35
+ readonly error: string;
36
+ readonly issues?: readonly SchemaIssue[];
37
+ };
38
+ type JsonValidator<A> = (data: unknown) => JsonValidatorResult<A>;
39
+ type JsonSchemaLike<A> = Schema<A, any> | JsonValidator<A>;
40
+ type AnyJsonSchemaLike = JsonSchemaLike<any>;
41
+ type InferJsonSchema<V> = V extends Schema<infer A, any> ? A : V extends JsonValidator<infer A> ? A : never;
42
+ type StringSchemaOptions = {
43
+ readonly minLength?: number;
44
+ readonly maxLength?: number;
45
+ readonly pattern?: RegExp;
46
+ readonly name?: string;
47
+ };
48
+ type NumberSchemaOptions = {
49
+ readonly min?: number;
50
+ readonly max?: number;
51
+ readonly int?: boolean;
52
+ readonly finite?: boolean;
53
+ readonly name?: string;
54
+ };
55
+ type ObjectSchemaOptions = {
56
+ readonly unknownKeys?: "strip" | "passthrough" | "strict";
57
+ readonly name?: string;
58
+ };
59
+ declare class SchemaValidationException extends Error {
60
+ readonly issues: readonly SchemaIssue[];
61
+ constructor(issues: readonly SchemaIssue[]);
62
+ }
63
+ declare class ConfigValidationError extends Error {
64
+ readonly _tag = "ConfigValidationError";
65
+ readonly configName: string;
66
+ readonly issues: readonly SchemaIssue[];
67
+ constructor(configName: string, issues: readonly SchemaIssue[]);
68
+ }
69
+ declare const makeSchemaIssue: (path: readonly SchemaPathPart[], expected: string, received: unknown, message?: string) => SchemaIssue;
70
+ declare function formatIssues(issues: readonly SchemaIssue[]): string;
71
+ declare function stringSchema(options?: StringSchemaOptions): Schema<string>;
72
+ declare function nonEmptyStringSchema(options?: Omit<StringSchemaOptions, "minLength">): Schema<string>;
73
+ declare function emailSchema(): Schema<string>;
74
+ declare function uuidSchema(): Schema<string>;
75
+ declare function urlSchema(): Schema<string>;
76
+ declare function dateIsoSchema(): Schema<string>;
77
+ declare function numberSchema(options?: NumberSchemaOptions): Schema<number>;
78
+ declare function intSchema(options?: Omit<NumberSchemaOptions, "int">): Schema<number>;
79
+ declare function positiveSchema(options?: NumberSchemaOptions): Schema<number>;
80
+ declare function booleanSchema(name?: string): Schema<boolean>;
81
+ declare function unknownSchema(): Schema<unknown>;
82
+ declare function anySchema(): Schema<any>;
83
+ declare function literalSchema<const Value extends string | number | boolean | null>(value: Value): Schema<Value>;
84
+ declare function enumSchema<const Values extends readonly [string | number, ...(string | number)[]]>(values: Values): Schema<Values[number]>;
85
+ declare function arraySchema<S extends AnySchema>(item: S): Schema<Array<InferSchema<S>>>;
86
+ declare function objectSchema<Shape extends SchemaShape>(shape: Shape, options?: ObjectSchemaOptions): Schema<InferObject<Shape>>;
87
+ declare function recordSchema<S extends AnySchema>(valueSchema: S): Schema<Record<string, InferSchema<S>>>;
88
+ declare function unionSchema<const Members extends readonly [AnySchema, AnySchema, ...AnySchema[]]>(members: Members): Schema<InferSchema<Members[number]>>;
89
+ declare function customSchema<A>(guard: (input: unknown) => input is A, expected: string, message?: string): Schema<A>;
90
+ declare const schema: Readonly<{
91
+ string: typeof stringSchema;
92
+ nonEmptyString: typeof nonEmptyStringSchema;
93
+ email: typeof emailSchema;
94
+ url: typeof urlSchema;
95
+ uuid: typeof uuidSchema;
96
+ dateIso: typeof dateIsoSchema;
97
+ number: typeof numberSchema;
98
+ int: typeof intSchema;
99
+ positive: typeof positiveSchema;
100
+ boolean: typeof booleanSchema;
101
+ literal: typeof literalSchema;
102
+ enum: typeof enumSchema;
103
+ array: typeof arraySchema;
104
+ object: typeof objectSchema;
105
+ record: typeof recordSchema;
106
+ union: typeof unionSchema;
107
+ optional: <S extends AnySchema>(inner: S) => Schema<InferSchema<S> | undefined, true>;
108
+ nullable: <S extends AnySchema>(inner: S) => Schema<InferSchema<S> | null, S["isOptional"]>;
109
+ unknown: typeof unknownSchema;
110
+ any: typeof anySchema;
111
+ custom: typeof customSchema;
112
+ }>;
113
+ declare const s: Readonly<{
114
+ string: typeof stringSchema;
115
+ nonEmptyString: typeof nonEmptyStringSchema;
116
+ email: typeof emailSchema;
117
+ url: typeof urlSchema;
118
+ uuid: typeof uuidSchema;
119
+ dateIso: typeof dateIsoSchema;
120
+ number: typeof numberSchema;
121
+ int: typeof intSchema;
122
+ positive: typeof positiveSchema;
123
+ boolean: typeof booleanSchema;
124
+ literal: typeof literalSchema;
125
+ enum: typeof enumSchema;
126
+ array: typeof arraySchema;
127
+ object: typeof objectSchema;
128
+ record: typeof recordSchema;
129
+ union: typeof unionSchema;
130
+ optional: <S extends AnySchema>(inner: S) => Schema<InferSchema<S> | undefined, true>;
131
+ nullable: <S extends AnySchema>(inner: S) => Schema<InferSchema<S> | null, S["isOptional"]>;
132
+ unknown: typeof unknownSchema;
133
+ any: typeof anySchema;
134
+ custom: typeof customSchema;
135
+ }>;
136
+ type Schema<A, Optional extends boolean = false> = {
137
+ readonly _tag: "Schema";
138
+ readonly kind: string;
139
+ readonly name?: string;
140
+ readonly isOptional: Optional;
141
+ readonly _parse: (input: unknown, path: readonly SchemaPathPart[]) => SchemaResult<A>;
142
+ readonly safeParse: (input: unknown) => SchemaResult<A>;
143
+ readonly parse: (input: unknown) => A;
144
+ readonly optional: () => Schema<A | undefined, true>;
145
+ readonly nullable: () => Schema<A | null, Optional>;
146
+ readonly array: () => Schema<A[], false>;
147
+ readonly refine: (predicate: (value: A) => boolean, message?: string) => Schema<A, Optional>;
148
+ readonly transform: <B>(fn: (value: A) => B, expected?: string) => Schema<B, false>;
149
+ };
150
+ declare const Schema: Readonly<{
151
+ string: typeof stringSchema;
152
+ nonEmptyString: typeof nonEmptyStringSchema;
153
+ email: typeof emailSchema;
154
+ url: typeof urlSchema;
155
+ uuid: typeof uuidSchema;
156
+ dateIso: typeof dateIsoSchema;
157
+ number: typeof numberSchema;
158
+ int: typeof intSchema;
159
+ positive: typeof positiveSchema;
160
+ boolean: typeof booleanSchema;
161
+ literal: typeof literalSchema;
162
+ enum: typeof enumSchema;
163
+ array: typeof arraySchema;
164
+ object: typeof objectSchema;
165
+ record: typeof recordSchema;
166
+ union: typeof unionSchema;
167
+ optional: <S extends AnySchema>(inner: S) => Schema<InferSchema<S> | undefined, true>;
168
+ nullable: <S extends AnySchema>(inner: S) => Schema<InferSchema<S> | null, S["isOptional"]>;
169
+ unknown: typeof unknownSchema;
170
+ any: typeof anySchema;
171
+ custom: typeof customSchema;
172
+ }>;
173
+ declare function isSchema(value: unknown): value is AnySchema;
174
+ declare function validateValue<A>(data: unknown, validator: JsonSchemaLike<A>): SchemaResult<A>;
175
+ declare function parseConfig<A>(configName: string, validator: JsonSchemaLike<A>, value: unknown): A;
176
+
177
+ export { type AnyJsonSchemaLike, type AnySchema, ConfigValidationError, type InferJsonSchema, type InferObject, type InferSchema, type JsonSchemaLike, type JsonValidator, type JsonValidatorResult, type NumberSchemaOptions, type ObjectSchemaOptions, Schema, type SchemaIssue, type SchemaPathPart, type SchemaResult, type SchemaShape, SchemaValidationException, type StringSchemaOptions, formatIssues, isSchema, makeSchemaIssue, parseConfig, s, schema, validateValue };
@@ -0,0 +1,25 @@
1
+ import {
2
+ ConfigValidationError,
3
+ Schema,
4
+ SchemaValidationException,
5
+ formatIssues,
6
+ isSchema,
7
+ makeSchemaIssue,
8
+ parseConfig,
9
+ s,
10
+ schema,
11
+ validateValue
12
+ } from "../chunk-TDVMADDN.js";
13
+ import "../chunk-3RG5ZIWI.js";
14
+ export {
15
+ ConfigValidationError,
16
+ Schema,
17
+ SchemaValidationException,
18
+ formatIssues,
19
+ isSchema,
20
+ makeSchemaIssue,
21
+ parseConfig,
22
+ s,
23
+ schema,
24
+ validateValue
25
+ };
@@ -0,0 +1,25 @@
1
+ import {
2
+ ConfigValidationError,
3
+ Schema,
4
+ SchemaValidationException,
5
+ formatIssues,
6
+ isSchema,
7
+ makeSchemaIssue,
8
+ parseConfig,
9
+ s,
10
+ schema,
11
+ validateValue
12
+ } from "../chunk-U5KWK3PX.mjs";
13
+ import "../chunk-Y6FXYEAI.mjs";
14
+ export {
15
+ ConfigValidationError,
16
+ Schema,
17
+ SchemaValidationException,
18
+ formatIssues,
19
+ isSchema,
20
+ makeSchemaIssue,
21
+ parseConfig,
22
+ s,
23
+ schema,
24
+ validateValue
25
+ };