apps 0.0.1-beta.6 → 0.0.1-beta.61

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 (173) hide show
  1. package/README.md +24 -21
  2. package/framework-reference.json +1 -1
  3. package/js/chunk-2A26IT3X.js +171 -0
  4. package/js/chunk-4HYFEAR7.js +49 -0
  5. package/js/chunk-5FHWNLCI.js +88 -0
  6. package/js/{chunk-M3B3DE4K.js → chunk-74YVXBKY.js} +463 -218
  7. package/js/{chunk-MNMNLXBL.js → chunk-7QBUFK6I.js} +316 -69
  8. package/js/{chunk-SB4HEPNJ.js → chunk-A4RQSTHG.js} +883 -189
  9. package/js/{chunk-T7GKZBLP.js → chunk-ANN7H2FL.js} +67 -55
  10. package/js/{chunk-NKLWZJLE.js → chunk-AQU56EPI.js} +9 -5
  11. package/js/chunk-CDXQDN7W.js +92 -0
  12. package/js/{chunk-UK573G7W.js → chunk-EOPQ727L.js} +87 -51
  13. package/js/{chunk-27F7W2LG.js → chunk-H2CJWXA3.js} +2 -2
  14. package/js/{chunk-JU7VHODU.js → chunk-H72MEDMN.js} +65 -10
  15. package/js/{chunk-CDL5PM2Q.js → chunk-IFJU5SYQ.js} +19082 -18402
  16. package/js/{chunk-VFZKSM3T.js → chunk-JPEUKEV4.js} +3 -3
  17. package/js/{chunk-RFVIONFX.js → chunk-JSAZHHWI.js} +79 -41
  18. package/js/{chunk-RJDDBDSN.js → chunk-K6P2US3D.js} +635 -89
  19. package/js/{chunk-5T57N25Q.js → chunk-KGCTYL2S.js} +511 -63
  20. package/js/{chunk-KUMBKVJD.js → chunk-KLYSEHUD.js} +2 -2
  21. package/js/chunk-MWKHKOTL.js +240 -0
  22. package/js/chunk-NFHURZBA.js +340 -0
  23. package/js/chunk-OD3KFKZD.js +1617 -0
  24. package/js/{chunk-57RKNWL2.js → chunk-PD6I2SDG.js} +4 -4
  25. package/js/{chunk-ITM77QPO.js → chunk-QE4JSN3X.js} +126 -31
  26. package/js/chunk-S34PXQUC.js +266 -0
  27. package/js/{chunk-B3EOZTK3.js → chunk-TLWLJ7PD.js} +2227 -453
  28. package/js/{chunk-IJX4CYZO.js → chunk-TUMGL2OC.js} +228 -264
  29. package/js/{chunk-ECQFRCH4.js → chunk-VHUR5HUL.js} +4 -3
  30. package/js/{chunk-IPI4MFSN.js → chunk-XBG7HHXC.js} +2 -2
  31. package/js/client.js +142 -94
  32. package/js/contracts.js +103 -26
  33. package/js/effect.js +19 -19
  34. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  35. package/js/graphql.js +50 -40
  36. package/js/host.js +83 -58
  37. package/js/index.js +90 -61
  38. package/js/mcp/effect.js +23 -21
  39. package/js/mcp/stdio.js +44 -34
  40. package/js/mcp.js +76 -53
  41. package/js/openapi.js +4050 -1354
  42. package/js/react.js +2 -3
  43. package/js/skills/effect.js +6 -3
  44. package/js/skills.js +208 -81
  45. package/js/storage/facet.js +1 -540
  46. package/js/ui/auth/contracts.js +2 -2
  47. package/js/ui/auth.js +5 -5
  48. package/js/ui/contracts.js +5 -4
  49. package/js/ui/serving.js +8517 -214
  50. package/package.json +2 -3
  51. package/runtime.json +1 -1
  52. package/types/app-cache/src/index.d.ts +10 -1
  53. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  54. package/types/apps/src/contracts/app.d.ts +7 -3
  55. package/types/apps/src/contracts/cache.d.ts +20 -0
  56. package/types/apps/src/contracts/context.d.ts +19 -11
  57. package/types/apps/src/contracts/elicitation.d.ts +6 -6
  58. package/types/apps/src/contracts/events.d.ts +93 -0
  59. package/types/apps/src/contracts/failure.d.ts +30 -1
  60. package/types/apps/src/contracts/graphql.d.ts +2 -1
  61. package/types/apps/src/contracts/host.d.ts +48 -13
  62. package/types/apps/src/contracts/live.d.ts +2 -0
  63. package/types/apps/src/contracts/mcp.d.ts +80 -10
  64. package/types/apps/src/contracts/network.d.ts +84 -0
  65. package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
  66. package/types/apps/src/contracts/openapi.d.ts +41 -9
  67. package/types/apps/src/contracts/operations.d.ts +8 -4
  68. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  69. package/types/apps/src/contracts/protocols/1.d.ts +733 -81
  70. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  71. package/types/apps/src/contracts/protocols/2.d.ts +69 -26
  72. package/types/apps/src/contracts/protocols/3.d.ts +133 -33
  73. package/types/apps/src/contracts/protocols/4.d.ts +122 -45
  74. package/types/apps/src/contracts/protocols/5.d.ts +1200 -0
  75. package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
  76. package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
  77. package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
  78. package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
  79. package/types/apps/src/contracts/protocols/current.d.ts +2476 -0
  80. package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
  81. package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
  82. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  83. package/types/apps/src/contracts/provider.d.ts +115 -10
  84. package/types/apps/src/contracts/skills.d.ts +50 -13
  85. package/types/apps/src/contracts/sql.d.ts +58 -0
  86. package/types/apps/src/contracts/ui.d.ts +19 -1
  87. package/types/apps/src/contracts/workflows.d.ts +6 -0
  88. package/types/apps/src/facet.d.ts +4 -5
  89. package/types/apps/src/host.d.ts +5 -0
  90. package/types/apps/src/implementation/account-router.d.ts +4 -3
  91. package/types/apps/src/implementation/authoring.d.ts +25 -5
  92. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  93. package/types/apps/src/implementation/cache.d.ts +4 -0
  94. package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
  95. package/types/apps/src/implementation/elicitation.d.ts +18 -15
  96. package/types/apps/src/implementation/events.d.ts +59 -0
  97. package/types/apps/src/implementation/failure-detail.d.ts +25 -3
  98. package/types/apps/src/implementation/graphql-catalog.d.ts +3 -3
  99. package/types/apps/src/implementation/graphql.d.ts +4 -3
  100. package/types/apps/src/implementation/input-problems.d.ts +6 -2
  101. package/types/apps/src/implementation/invocation-timing.d.ts +16 -0
  102. package/types/apps/src/implementation/live.d.ts +2 -2
  103. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  104. package/types/apps/src/implementation/mcp-catalog.d.ts +6 -4
  105. package/types/apps/src/implementation/mcp-client.d.ts +17 -9
  106. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  107. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  108. package/types/apps/src/implementation/mcp.d.ts +20 -9
  109. package/types/apps/src/implementation/network.d.ts +16 -0
  110. package/types/apps/src/implementation/openapi-compile.d.ts +26 -6
  111. package/types/apps/src/implementation/openapi-document.d.ts +46 -19
  112. package/types/apps/src/implementation/openapi-names.d.ts +9 -4
  113. package/types/apps/src/implementation/openapi-request.d.ts +10 -2
  114. package/types/apps/src/implementation/openapi-source.d.ts +18 -0
  115. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  116. package/types/apps/src/implementation/operations.d.ts +17 -2
  117. package/types/apps/src/implementation/optimistic.d.ts +1 -1
  118. package/types/apps/src/implementation/protocol-operations.d.ts +3 -0
  119. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  120. package/types/apps/src/implementation/provider.d.ts +19 -5
  121. package/types/apps/src/implementation/query-commit.d.ts +1 -1
  122. package/types/apps/src/implementation/router-catalog.d.ts +11 -13
  123. package/types/apps/src/implementation/router.d.ts +16 -5
  124. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  125. package/types/apps/src/implementation/schema.d.ts +90 -10
  126. package/types/apps/src/implementation/skills.d.ts +18 -24
  127. package/types/apps/src/implementation/sql.d.ts +71 -0
  128. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  129. package/types/apps/src/implementation/ui-auth.d.ts +1 -1
  130. package/types/apps/src/implementation/ui-client.d.ts +2 -2
  131. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  132. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  133. package/types/apps/src/implementation/ui-serving.d.ts +11 -5
  134. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  135. package/types/apps/src/implementation/upstream-error.d.ts +7 -0
  136. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  137. package/types/apps/src/implementation/workflows.d.ts +1 -1
  138. package/types/apps/src/index.d.ts +30 -12
  139. package/types/apps/src/mcp.d.ts +20 -1
  140. package/types/apps/src/openapi.d.ts +1 -1
  141. package/types/apps/src/react.d.ts +1 -1
  142. package/types/apps/src/skills.d.ts +10 -8
  143. package/types/telemetry/src/app-records.d.ts +42 -0
  144. package/types/telemetry/src/browser-operations.d.ts +7 -4
  145. package/types/telemetry/src/browser.d.ts +8 -3
  146. package/types/telemetry/src/config.d.ts +2 -2
  147. package/types/telemetry/src/index.d.ts +1 -0
  148. package/types/telemetry/src/layer.d.ts +2 -2
  149. package/types/telemetry/src/ownership.d.ts +56 -0
  150. package/types/telemetry/src/recorded-failure.d.ts +29 -0
  151. package/types/telemetry/src/relay.d.ts +11 -3
  152. package/types/telemetry/src/transport.d.ts +8 -1
  153. package/types/utils/src/api-error.d.ts +55 -0
  154. package/types/utils/src/connection-failure.d.ts +33 -0
  155. package/types/utils/src/recorded-message.d.ts +18 -0
  156. package/types/utils/src/user-facing-error.d.ts +83 -0
  157. package/js/chunk-6BSSI67S.js +0 -224
  158. package/js/chunk-MKWZPDR6.js +0 -63
  159. package/js/chunk-N7YDVXYJ.js +0 -186
  160. package/js/chunk-OE3QQTSB.js +0 -222
  161. package/js/chunk-PJJ24GU7.js +0 -877
  162. package/js/chunk-PZB6T6KU.js +0 -19
  163. package/js/chunk-R3EV5FTO.js +0 -97
  164. package/js/chunk-ZQINWV4W.js +0 -630
  165. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  166. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  167. package/types/app-data/src/implementation/promise.d.ts +0 -68
  168. package/types/app-data/src/implementation/range.d.ts +0 -8
  169. package/types/app-data/src/implementation/schema.d.ts +0 -18
  170. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  171. package/types/app-data/src/index.d.ts +0 -4
  172. package/types/apps/src/contracts/storage.d.ts +0 -68
  173. package/types/apps/src/implementation/storage.d.ts +0 -15
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  FetchHttpClient_exports
3
- } from "./chunk-57RKNWL2.js";
3
+ } from "./chunk-PD6I2SDG.js";
4
+ import {
5
+ recordedMessage
6
+ } from "./chunk-5FHWNLCI.js";
4
7
  import {
5
8
  HttpBody_exports,
6
9
  HttpClient,
@@ -16,17 +19,21 @@ import {
16
19
  post,
17
20
  retryTransient,
18
21
  setBody,
22
+ tap,
23
+ tapError,
19
24
  transformResponse,
20
25
  uint8Array
21
- } from "./chunk-UK573G7W.js";
26
+ } from "./chunk-EOPQ727L.js";
22
27
  import {
23
28
  Array as Array2,
24
29
  Boolean2 as Boolean,
30
+ Cause_exports,
25
31
  Clock,
26
32
  Clock_exports,
27
33
  Context_exports,
28
34
  CurrentLogAnnotations,
29
35
  CurrentLogSpans,
36
+ Duration_exports,
30
37
  Effect_exports,
31
38
  Exit_exports,
32
39
  FiberSet_exports,
@@ -37,8 +44,10 @@ import {
37
44
  Logger_exports,
38
45
  Metric_exports,
39
46
  Option_exports,
47
+ Predicate_exports,
40
48
  Record2 as Record,
41
49
  Redacted_exports,
50
+ Schedule_exports,
42
51
  Schema_exports,
43
52
  Scope,
44
53
  Semaphore_exports,
@@ -53,7 +62,7 @@ import {
53
62
  UndefinedOr,
54
63
  addDelay,
55
64
  addFinalizer,
56
- all,
65
+ all2 as all,
57
66
  allocate,
58
67
  andThen,
59
68
  annotateLogs,
@@ -89,9 +98,9 @@ import {
89
98
  isSome,
90
99
  layer,
91
100
  logDebug,
92
- make2 as make,
93
- make7 as make2,
94
- make8 as make3,
101
+ make,
102
+ make4 as make2,
103
+ make5 as make3,
95
104
  map,
96
105
  map3 as map2,
97
106
  map5 as map3,
@@ -107,7 +116,7 @@ import {
107
116
  prettyErrors,
108
117
  provideMerge,
109
118
  provideService,
110
- randomHex,
119
+ random,
111
120
  run2 as run,
112
121
  runtime,
113
122
  schema,
@@ -125,11 +134,150 @@ import {
125
134
  withDefault2 as withDefault,
126
135
  withTracerEnabled,
127
136
  zero
128
- } from "./chunk-CDL5PM2Q.js";
137
+ } from "./chunk-IFJU5SYQ.js";
129
138
  import {
130
139
  __export
131
140
  } from "./chunk-CZ7CSFO4.js";
132
141
 
142
+ // ../telemetry/src/ownership.ts
143
+ var ownerAttribute = "executor.owner";
144
+ var SpanOwner = Context_exports.Reference("@executor-js/telemetry/SpanOwner", {
145
+ defaultValue: () => void 0
146
+ });
147
+ var declaredOwner = (annotations) => Context_exports.get(annotations, SpanOwner);
148
+ var ownedBy = (owner, options = {}) => ({
149
+ ...options,
150
+ annotations: Context_exports.add(options.annotations ?? Context_exports.empty(), SpanOwner, owner)
151
+ });
152
+ var owned = (owner, name, options) => (effect2) => effect2.pipe(Effect_exports.withSpan(name, ownedBy(owner, options)));
153
+ var measuredSpan = (name, options, measure) => (effect2) => Effect_exports.useSpan(name, options, (span) => {
154
+ const inner = Effect_exports.withParentSpan(effect2, span);
155
+ if (span.status._tag === "Ended") return inner;
156
+ const { around, end } = measure(span.status.startTime);
157
+ return (around === void 0 ? inner : around(inner)).pipe(
158
+ Effect_exports.onExit(
159
+ (exit) => Effect_exports.flatMap(
160
+ Clock_exports.currentTimeNanos,
161
+ (now) => Effect_exports.sync(() => {
162
+ end(now, span);
163
+ span.end(now, exit);
164
+ })
165
+ )
166
+ )
167
+ );
168
+ });
169
+ var concurrent = ["executor", "person", "upstream", "app"];
170
+ var makeOwnershipAccounting = (origin, owner) => {
171
+ const totals = { executor: 0, app: 0, upstream: 0, person: 0 };
172
+ const innermost = { executor: 0, app: 0, upstream: 0, person: 0 };
173
+ const boundaries2 = /* @__PURE__ */ new WeakMap();
174
+ let reached = origin;
175
+ let done = false;
176
+ const advance = (time) => {
177
+ if (time <= reached) return;
178
+ const current = concurrent.find((candidate) => innermost[candidate] > 0) ?? owner;
179
+ totals[current] += Number(time - reached) / 1e6;
180
+ reached = time;
181
+ };
182
+ const enclosing = (boundary) => {
183
+ let found = boundary.parent;
184
+ while (found !== void 0 && !found.open) found = found.parent;
185
+ boundary.parent = found;
186
+ return found;
187
+ };
188
+ const opened = (boundary) => {
189
+ const parent = enclosing(boundary);
190
+ if (parent !== void 0 && parent.children++ === 0) innermost[parent.owner] -= 1;
191
+ innermost[boundary.owner] += 1;
192
+ };
193
+ const closed = (boundary) => {
194
+ boundary.open = false;
195
+ if (boundary.children === 0) innermost[boundary.owner] -= 1;
196
+ const parent = enclosing(boundary);
197
+ if (parent === void 0) return;
198
+ parent.children += boundary.children - 1;
199
+ if (parent.children === 0) innermost[parent.owner] += 1;
200
+ };
201
+ const observed = (tracer) => ({
202
+ ...tracer,
203
+ span: (options) => {
204
+ const span = tracer.span(options);
205
+ if (done) return span;
206
+ const parent = Option_exports.getOrUndefined(options.parent);
207
+ const enclosingBoundary = parent === void 0 ? void 0 : boundaries2.get(parent);
208
+ const boundary = {
209
+ owner: declaredOwner(options.annotations) ?? enclosingBoundary?.owner ?? owner,
210
+ parent: enclosingBoundary,
211
+ open: true,
212
+ children: 0
213
+ };
214
+ advance(options.startTime);
215
+ opened(boundary);
216
+ const tracked = {
217
+ _tag: "Span",
218
+ get name() {
219
+ return span.name;
220
+ },
221
+ get spanId() {
222
+ return span.spanId;
223
+ },
224
+ get traceId() {
225
+ return span.traceId;
226
+ },
227
+ get parent() {
228
+ return span.parent;
229
+ },
230
+ get annotations() {
231
+ return span.annotations;
232
+ },
233
+ get status() {
234
+ return span.status;
235
+ },
236
+ get attributes() {
237
+ return span.attributes;
238
+ },
239
+ get links() {
240
+ return span.links;
241
+ },
242
+ get sampled() {
243
+ return span.sampled;
244
+ },
245
+ get kind() {
246
+ return span.kind;
247
+ },
248
+ end: (endTime, exit) => {
249
+ if (boundary.open && !done) {
250
+ advance(endTime);
251
+ closed(boundary);
252
+ }
253
+ span.end(endTime, exit);
254
+ },
255
+ attribute: (key, value) => span.attribute(key, value),
256
+ event: (name, startTime, attributes2) => span.event(name, startTime, attributes2),
257
+ addLinks: (links) => span.addLinks(links)
258
+ };
259
+ boundaries2.set(tracked, boundary);
260
+ return tracked;
261
+ }
262
+ });
263
+ return {
264
+ /** Run `effect` with the spans it opens observed, including spans it hands to later work. */
265
+ observe: (effect2) => Effect_exports.gen(function* () {
266
+ const tracer = yield* Tracer_exports.Tracer;
267
+ return yield* effect2.pipe(Effect_exports.provideService(Tracer_exports.Tracer, observed(tracer)));
268
+ }),
269
+ /**
270
+ * Close the window at `end` and return its milliseconds by owner, each instant counted once.
271
+ * Spans still open count up to `end`; spans that open or end afterwards are ignored.
272
+ */
273
+ read: (end) => {
274
+ if (!done) advance(end);
275
+ done = true;
276
+ return totals;
277
+ }
278
+ };
279
+ };
280
+
133
281
  // ../telemetry/src/context.ts
134
282
  var captureTelemetry = Effect_exports.gen(function* () {
135
283
  let context2 = Context_exports.make(Tracer_exports.Tracer, yield* Tracer_exports.Tracer).pipe(
@@ -161,9 +309,10 @@ var invocationFetch = (signal) => Effect_exports.gen(function* () {
161
309
  const request = yield* Effect_exports.try(() => new Request(input, init));
162
310
  const client = yield* HttpClient_exports.HttpClient;
163
311
  const response = yield* client.execute(HttpClientRequest_exports.fromWeb(request)).pipe(
164
- Effect_exports.withSpan("provider.http.request", {
165
- attributes: { "http.request.method": request.method }
166
- }),
312
+ Effect_exports.withSpan(
313
+ "provider.http.request",
314
+ ownedBy("upstream", { attributes: { "http.request.method": request.method } })
315
+ ),
167
316
  Effect_exports.provideService(FetchHttpClient_exports.RequestInit, {
168
317
  cache: request.cache,
169
318
  credentials: request.credentials,
@@ -192,9 +341,12 @@ var invocationFetch = (signal) => Effect_exports.gen(function* () {
192
341
  streamed,
193
342
  HttpBody_exports.stream(
194
343
  body.stream.pipe(
195
- Stream_exports.withSpan("provider.http.response.read", {
196
- attributes: { "http.response.status_code": response.status }
197
- })
344
+ Stream_exports.withSpan(
345
+ "provider.http.response.read",
346
+ ownedBy("upstream", {
347
+ attributes: { "http.response.status_code": response.status }
348
+ })
349
+ )
198
350
  ),
199
351
  body.contentType,
200
352
  body.contentLength
@@ -487,15 +639,15 @@ function getTextEncoding() {
487
639
  const te = new globalThis.TextEncoder();
488
640
  const td = new globalThis.TextDecoder();
489
641
  globalThis[symbol] = {
490
- encodeUtf8(text) {
491
- return te.encode(text);
642
+ encodeUtf8(text2) {
643
+ return te.encode(text2);
492
644
  },
493
645
  decodeUtf8(bytes) {
494
646
  return td.decode(bytes);
495
647
  },
496
- checkUtf8(text) {
648
+ checkUtf8(text2) {
497
649
  try {
498
- encodeURIComponent(text);
650
+ encodeURIComponent(text2);
499
651
  return true;
500
652
  } catch (_) {
501
653
  return false;
@@ -851,6 +1003,53 @@ var telemetryHttpClient = Layer_exports.effect(
851
1003
  )
852
1004
  )
853
1005
  ).pipe(Layer_exports.provide(selectedClient));
1006
+ var retryDelay = (error) => Effect_exports.gen(function* () {
1007
+ if (!HttpClientError_exports.isHttpClientError(error) || error.reason._tag !== "StatusCodeError" || error.reason.response.status !== 429 && error.reason.response.status !== 503)
1008
+ return Duration_exports.seconds(1);
1009
+ const header = error.reason.response.headers["retry-after"]?.trim();
1010
+ if (header === void 0 || header === "")
1011
+ return Duration_exports.seconds(error.reason.response.status === 429 ? 5 : 1);
1012
+ const seconds2 = Number(header);
1013
+ if (Number.isFinite(seconds2)) return Duration_exports.seconds(seconds2 >= 0 ? seconds2 : 5);
1014
+ const date = Date.parse(header);
1015
+ if (Number.isNaN(date)) return Duration_exports.seconds(5);
1016
+ return Duration_exports.millis(Math.max(date - (yield* Clock_exports.currentTimeMillis), 1));
1017
+ });
1018
+ var retryTelemetryExport = (client) => client.pipe(
1019
+ HttpClient_exports.retryTransient({
1020
+ times: 3,
1021
+ schedule: Schedule_exports.forever.pipe(
1022
+ Schedule_exports.passthrough,
1023
+ Schedule_exports.addDelay(({ output }) => retryDelay(output))
1024
+ )
1025
+ })
1026
+ );
1027
+
1028
+ // ../telemetry/src/recorded-failure.ts
1029
+ var tagOf = (error) => Predicate_exports.hasProperty(error, "_tag") && Predicate_exports.isString(error._tag) ? error._tag : void 0;
1030
+ var recorded = (name, message) => {
1031
+ const error = new Error(message);
1032
+ error.name = name;
1033
+ error.stack = message === "" ? name : `${name}: ${message}`;
1034
+ return error;
1035
+ };
1036
+ var recordedError = (error) => {
1037
+ const tag = tagOf(error);
1038
+ if (tag !== void 0) return recorded(tag, recordedMessage(error) ?? "");
1039
+ if (!(error instanceof Error)) return recorded("UnrecognizedFailure", "");
1040
+ if (error.cause === void 0) return error;
1041
+ const copy = new Error(error.message, { cause: recordedError(error.cause) });
1042
+ copy.name = error.name;
1043
+ if (error.stack !== void 0) copy.stack = error.stack;
1044
+ return copy;
1045
+ };
1046
+ var recordedCause = (cause) => Cause_exports.fromReasons(
1047
+ cause.reasons.flatMap((reason) => {
1048
+ if (Cause_exports.isInterruptReason(reason)) return [reason];
1049
+ const replaced = Cause_exports.isFailReason(reason) ? Cause_exports.fail(recordedError(reason.error)) : Cause_exports.die(recordedError(reason.defect));
1050
+ return Cause_exports.annotate(replaced, Cause_exports.reasonAnnotations(reason)).reasons;
1051
+ })
1052
+ );
854
1053
 
855
1054
  // ../telemetry/src/span-attributes.ts
856
1055
  var LogicalOperationFailed = class extends Schema_exports.TaggedError()(
@@ -866,6 +1065,8 @@ var httpSpanAttributeAllowlist = /* @__PURE__ */ new Set([
866
1065
  "url.scheme",
867
1066
  // Path only. `url.full` and `url.query` carry the query string, so neither is listed.
868
1067
  "url.path",
1068
+ // The router's matched path template, such as `/api/organizations/:organization`; no values.
1069
+ "http.route",
869
1070
  "http.request.header.content-type",
870
1071
  "http.request.header.content-length",
871
1072
  "http.request.header.user-agent",
@@ -878,7 +1079,7 @@ var spanAttributeAllowed = (key) => {
878
1079
  const name = key.toLowerCase();
879
1080
  return !httpNamespaces.some((namespace) => name.startsWith(namespace)) || httpSpanAttributeAllowlist.has(name);
880
1081
  };
881
- var allowedEntries = (attributes) => Object.fromEntries(Object.entries(attributes).filter(([key]) => spanAttributeAllowed(key)));
1082
+ var allowedEntries = (attributes2) => Object.fromEntries(Object.entries(attributes2).filter(([key]) => spanAttributeAllowed(key)));
882
1083
  var allowlistedSpan = (span) => ({
883
1084
  _tag: "Span",
884
1085
  get name() {
@@ -913,14 +1114,15 @@ var allowlistedSpan = (span) => ({
913
1114
  },
914
1115
  // A successful transport can carry a failed domain operation. The producer
915
1116
  // explicitly marks that outcome; arbitrary result payloads are never inspected.
1117
+ // A failure records the fixed message an error declares in place of an app's text.
916
1118
  end: (endTime, exit) => span.end(
917
1119
  endTime,
918
- Exit_exports.isSuccess(exit) && span.attributes.get("executor.outcome") === "failed" ? Exit_exports.fail(new LogicalOperationFailed()) : exit
1120
+ Exit_exports.isSuccess(exit) ? span.attributes.get("executor.outcome") === "failed" ? Exit_exports.fail(new LogicalOperationFailed()) : exit : Exit_exports.failCause(recordedCause(exit.cause))
919
1121
  ),
920
1122
  attribute: (key, value) => {
921
1123
  if (spanAttributeAllowed(key)) span.attribute(key, value);
922
1124
  },
923
- event: (name, startTime, attributes) => span.event(name, startTime, attributes === void 0 ? void 0 : allowedEntries(attributes)),
1125
+ event: (name, startTime, attributes2) => span.event(name, startTime, attributes2 === void 0 ? void 0 : allowedEntries(attributes2)),
924
1126
  addLinks: (links) => span.addLinks(links)
925
1127
  });
926
1128
  var spanAttributes = (clock, recordAll = false) => Layer_exports.effect(Tracer_exports.Tracer)(
@@ -934,6 +1136,8 @@ var spanAttributes = (clock, recordAll = false) => Layer_exports.effect(Tracer_e
934
1136
  if (recordAll && Option_exports.isSome(options.parent) && options.parent.value._tag === "ExternalSpan")
935
1137
  span.attribute("executor.trace.parent_sampled", options.parent.value.sampled);
936
1138
  if (clock !== void 0) span.attribute("executor.clock.type", clock);
1139
+ const owner = declaredOwner(options.annotations);
1140
+ if (owner !== void 0) span.attribute(ownerAttribute, owner);
937
1141
  return span;
938
1142
  }
939
1143
  }))
@@ -941,7 +1145,7 @@ var spanAttributes = (clock, recordAll = false) => Layer_exports.effect(Tracer_e
941
1145
  );
942
1146
  var allowlistedSpans = spanAttributes();
943
1147
 
944
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/OtlpLogger.js
1148
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpLogger.js
945
1149
  var OtlpLogger_exports = {};
946
1150
  __export(OtlpLogger_exports, {
947
1151
  layer: () => layer2,
@@ -949,7 +1153,7 @@ __export(OtlpLogger_exports, {
949
1153
  make: () => make6
950
1154
  });
951
1155
 
952
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/internal/otlpEnv.js
1156
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/internal/otlpEnv.js
953
1157
  var exporterList = (path) => Array2(String2, path).pipe(map3((_) => _.map((_2) => _2.toLowerCase().trim()).filter((_2) => _2 !== "")));
954
1158
  var headersRecord = (path) => Record(String2, StringFromUriComponent, path);
955
1159
  var headers = (signal) => headersRecord(`OTEL_EXPORTER_OTLP_${signal}_HEADERS`).pipe(orElse(() => headersRecord("OTEL_EXPORTER_OTLP_HEADERS")), withDefault(void 0));
@@ -960,7 +1164,7 @@ var endpoint = (signal) => URL2(`OTEL_EXPORTER_OTLP_${signal}_ENDPOINT`).pipe(or
960
1164
  }))), withDefault(void 0));
961
1165
  var exporters = (signal) => exporterList(`OTEL_${signal}_EXPORTER`).pipe(withDefault([]));
962
1166
 
963
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/OtlpExporter.js
1167
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpExporter.js
964
1168
  var OtlpExporter_exports = {};
965
1169
  __export(OtlpExporter_exports, {
966
1170
  Flusher: () => Flusher,
@@ -1015,7 +1219,7 @@ var make4 = /* @__PURE__ */ fnUntraced(function* (options) {
1015
1219
  const scope = get(services, Scope);
1016
1220
  const exportInterval = max(fromInputUnsafe(options.exportInterval), zero);
1017
1221
  let disabledUntil = void 0;
1018
- const client = filterStatusOk(get(services, HttpClient)).pipe(transformResponse(provideService(TracerPropagationEnabled, false)), retryTransient({
1222
+ const client = get(services, HttpClient).pipe(tap((response) => ignore(response.arrayBuffer)), tapError((error) => error.response ? ignore(error.response.arrayBuffer) : void_), filterStatusOk, transformResponse(provideService(TracerPropagationEnabled, false)), retryTransient({
1019
1223
  schedule: policy,
1020
1224
  times: 3
1021
1225
  }));
@@ -1072,7 +1276,7 @@ var make4 = /* @__PURE__ */ fnUntraced(function* (options) {
1072
1276
  };
1073
1277
  });
1074
1278
 
1075
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/OtlpResource.js
1279
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpResource.js
1076
1280
  var make5 = (options) => {
1077
1281
  const resourceAttributes = options.attributes ? entriesToAttributes(Object.entries(options.attributes)) : [];
1078
1282
  resourceAttributes.push({
@@ -1098,16 +1302,16 @@ var fromConfig = /* @__PURE__ */ fnUntraced(function* (options) {
1098
1302
  const env = yield* Record(StringFromUriComponent, StringFromUriComponent, "OTEL_RESOURCE_ATTRIBUTES").pipe(withDefault(void 0));
1099
1303
  const serviceName = options?.serviceName ?? options?.attributes?.["service.name"] ?? (yield* schema(UndefinedOr(String2), "OTEL_SERVICE_NAME")) ?? env?.["service.name"] ?? (yield* String3("OTEL_SERVICE_NAME"));
1100
1304
  const serviceVersion = options?.serviceVersion ?? options?.attributes?.["service.version"] ?? (yield* schema(UndefinedOr(String2), "OTEL_SERVICE_VERSION")) ?? env?.["service.version"];
1101
- const attributes = {
1305
+ const attributes2 = {
1102
1306
  ...env,
1103
1307
  ...options?.attributes
1104
1308
  };
1105
- delete attributes["service.name"];
1106
- delete attributes["service.version"];
1309
+ delete attributes2["service.name"];
1310
+ delete attributes2["service.version"];
1107
1311
  return make5({
1108
1312
  serviceName,
1109
1313
  serviceVersion,
1110
- attributes
1314
+ attributes: attributes2
1111
1315
  });
1112
1316
  }, orDie);
1113
1317
  var serviceNameUnsafe = (resource) => {
@@ -1118,14 +1322,14 @@ var serviceNameUnsafe = (resource) => {
1118
1322
  return serviceNameAttribute.value.stringValue;
1119
1323
  };
1120
1324
  var entriesToAttributes = (entries) => {
1121
- const attributes = [];
1325
+ const attributes2 = [];
1122
1326
  for (const [key, value] of entries) {
1123
- attributes.push({
1327
+ attributes2.push({
1124
1328
  key,
1125
1329
  value: unknownToAttributeValue(value)
1126
1330
  });
1127
1331
  }
1128
- return attributes;
1332
+ return attributes2;
1129
1333
  };
1130
1334
  var unknownToAttributeValue = (value) => {
1131
1335
  if (Array.isArray(value)) {
@@ -1161,7 +1365,7 @@ var unknownToAttributeValue = (value) => {
1161
1365
  }
1162
1366
  };
1163
1367
 
1164
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/OtlpSerialization.js
1368
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpSerialization.js
1165
1369
  var OtlpSerialization_exports = {};
1166
1370
  __export(OtlpSerialization_exports, {
1167
1371
  OtlpSerialization: () => OtlpSerialization,
@@ -1169,7 +1373,7 @@ __export(OtlpSerialization_exports, {
1169
1373
  layerProtobuf: () => layerProtobuf
1170
1374
  });
1171
1375
 
1172
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/internal/protobuf.js
1376
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/internal/protobuf.js
1173
1377
  var WireType2 = {
1174
1378
  Varint: 0,
1175
1379
  Fixed64: 1,
@@ -1238,7 +1442,7 @@ var messageField = (fieldNumber, message) => lengthDelimitedField(fieldNumber, m
1238
1442
  var repeatedField = (fieldNumber, values, encode) => concat(...values.map((v) => messageField(fieldNumber, encode(v))));
1239
1443
  var optionalStringField = (fieldNumber, value) => value !== void 0 && value !== "" ? stringField(fieldNumber, value) : new Uint8Array(0);
1240
1444
 
1241
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/internal/otlpProtobuf.js
1445
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/internal/otlpProtobuf.js
1242
1446
  var encodeAnyValue = (value) => {
1243
1447
  if (value.stringValue !== void 0 && value.stringValue !== null) {
1244
1448
  return stringField(1, value.stringValue);
@@ -1268,7 +1472,7 @@ var encodeKeyValueList = (value) => repeatedField(1, value.values, encodeKeyValu
1268
1472
  var encodeKeyValue = (kv) => concat(stringField(1, kv.key), messageField(2, encodeAnyValue(kv.value)));
1269
1473
  var encodeInstrumentationScope = (scope) => concat(stringField(1, scope.name), optionalStringField(2, scope.version), scope.attributes ? repeatedField(3, scope.attributes, encodeKeyValue) : new Uint8Array(0), scope.droppedAttributesCount ? varintField(4, scope.droppedAttributesCount) : new Uint8Array(0));
1270
1474
  var encodeResource = (resource) => concat(repeatedField(1, resource.attributes, encodeKeyValue), resource.droppedAttributesCount > 0 ? varintField(2, resource.droppedAttributesCount) : new Uint8Array(0));
1271
- var encodeStatus = (status) => concat(optionalStringField(2, status.message), varintField(3, status.code));
1475
+ var encodeStatus = (status2) => concat(optionalStringField(2, status2.message), varintField(3, status2.code));
1272
1476
  var encodeEvent = (event) => concat(fixed64Field(1, BigInt(event.timeUnixNano)), stringField(2, event.name), repeatedField(3, event.attributes, encodeKeyValue), event.droppedAttributesCount > 0 ? varintField(4, event.droppedAttributesCount) : new Uint8Array(0));
1273
1477
  var encodeLink = (link) => concat(bytesFieldFromHex(1, link.traceId), bytesFieldFromHex(2, link.spanId), optionalStringField(3, link.traceState), repeatedField(4, link.attributes, encodeKeyValue), link.droppedAttributesCount > 0 ? varintField(5, link.droppedAttributesCount) : new Uint8Array(0), link.flags !== void 0 ? fixed32Field(6, link.flags) : new Uint8Array(0));
1274
1478
  var encodeSpan = (span) => concat(bytesFieldFromHex(1, span.traceId), bytesFieldFromHex(2, span.spanId), optionalStringField(3, span.traceState), span.parentSpanId !== void 0 ? bytesFieldFromHex(4, span.parentSpanId) : new Uint8Array(0), stringField(5, span.name), varintField(6, span.kind), fixed64Field(7, BigInt(span.startTimeUnixNano)), fixed64Field(8, BigInt(span.endTimeUnixNano)), repeatedField(9, span.attributes, encodeKeyValue), span.droppedAttributesCount > 0 ? varintField(10, span.droppedAttributesCount) : new Uint8Array(0), repeatedField(11, span.events, encodeEvent), span.droppedEventsCount > 0 ? varintField(12, span.droppedEventsCount) : new Uint8Array(0), repeatedField(13, span.links, encodeLink), span.droppedLinksCount > 0 ? varintField(14, span.droppedLinksCount) : new Uint8Array(0), messageField(15, encodeStatus(span.status)), span.flags !== void 0 ? fixed32Field(16, span.flags) : new Uint8Array(0));
@@ -1277,7 +1481,7 @@ var encodeResourceSpans = (resourceSpans) => concat(messageField(1, encodeResour
1277
1481
  var encodeTracesData = (tracesData) => repeatedField(1, tracesData.resourceSpans, encodeResourceSpans);
1278
1482
  var encodeNumberDataPoint = (point) => concat(fixed64Field(2, BigInt(point.startTimeUnixNano)), fixed64Field(3, BigInt(point.timeUnixNano)), point.asDouble !== void 0 ? doubleField(4, point.asDouble) : new Uint8Array(0), point.asInt !== void 0 ? fixed64Field(6, BigInt(point.asInt)) : new Uint8Array(0), repeatedField(7, point.attributes, encodeKeyValue), point.flags !== void 0 ? varintField(8, point.flags) : new Uint8Array(0));
1279
1483
  var encodeHistogramDataPoint = (point) => {
1280
- const bucketCountsEncoded = concat(...point.bucketCounts.map((count) => fixed64Field(6, BigInt(count))));
1484
+ const bucketCountsEncoded = concat(...point.bucketCounts.map((count2) => fixed64Field(6, BigInt(count2))));
1281
1485
  const explicitBoundsEncoded = concat(...point.explicitBounds.map((bound) => doubleField(7, bound)));
1282
1486
  return concat(fixed64Field(2, BigInt(point.startTimeUnixNano)), fixed64Field(3, BigInt(point.timeUnixNano)), fixed64Field(4, BigInt(point.count)), point.sum !== void 0 ? doubleField(5, point.sum) : new Uint8Array(0), bucketCountsEncoded, explicitBoundsEncoded, repeatedField(9, point.attributes, encodeKeyValue), point.flags !== void 0 ? varintField(10, point.flags) : new Uint8Array(0), point.min !== void 0 ? doubleField(11, point.min) : new Uint8Array(0), point.max !== void 0 ? doubleField(12, point.max) : new Uint8Array(0));
1283
1487
  };
@@ -1293,7 +1497,7 @@ var encodeScopeLogs = (scopeLogs) => concat(messageField(1, encodeInstrumentatio
1293
1497
  var encodeResourceLogs = (resourceLogs) => concat(messageField(1, encodeResource(resourceLogs.resource)), repeatedField(2, resourceLogs.scopeLogs, encodeScopeLogs), optionalStringField(3, resourceLogs.schemaUrl));
1294
1498
  var encodeLogsData = (logsData) => repeatedField(1, logsData.resourceLogs, encodeResourceLogs);
1295
1499
 
1296
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/OtlpSerialization.js
1500
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpSerialization.js
1297
1501
  var OtlpSerialization = class extends (/* @__PURE__ */ Service()("effect/observability/OtlpSerialization")) {
1298
1502
  };
1299
1503
  var layerJson = /* @__PURE__ */ succeed(OtlpSerialization, {
@@ -1307,7 +1511,7 @@ var layerProtobuf = /* @__PURE__ */ succeed(OtlpSerialization, {
1307
1511
  logs: (logs) => uint8Array(encodeLogsData(logs), "application/x-protobuf")
1308
1512
  });
1309
1513
 
1310
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/OtlpLogger.js
1514
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpLogger.js
1311
1515
  var make6 = /* @__PURE__ */ fnUntraced(function* (options) {
1312
1516
  const serialization = yield* OtlpSerialization;
1313
1517
  const otelResource = yield* fromConfig(options.resource);
@@ -1385,8 +1589,8 @@ var makeLogRecord = (options, opts) => {
1385
1589
  const now = opts.clock.currentTimeNanosUnsafe();
1386
1590
  const nanosString = now.toString();
1387
1591
  const nowMillis = options.date.getTime();
1388
- const attributes = entriesToAttributes(Object.entries(options.fiber.getRef(CurrentLogAnnotations)));
1389
- attributes.push({
1592
+ const attributes2 = entriesToAttributes(Object.entries(options.fiber.getRef(CurrentLogAnnotations)));
1593
+ attributes2.push({
1390
1594
  key: "fiberId",
1391
1595
  value: {
1392
1596
  intValue: options.fiber.id
@@ -1394,7 +1598,7 @@ var makeLogRecord = (options, opts) => {
1394
1598
  });
1395
1599
  if (!opts.excludeLogSpans) {
1396
1600
  for (const [label, startTime] of options.fiber.getRef(CurrentLogSpans)) {
1397
- attributes.push({
1601
+ attributes2.push({
1398
1602
  key: `logSpan.${label}`,
1399
1603
  value: {
1400
1604
  stringValue: `${nowMillis - startTime}ms`
@@ -1403,7 +1607,7 @@ var makeLogRecord = (options, opts) => {
1403
1607
  }
1404
1608
  }
1405
1609
  if (options.cause.reasons.length > 0) {
1406
- attributes.push({
1610
+ attributes2.push({
1407
1611
  key: "log.error",
1408
1612
  value: {
1409
1613
  stringValue: pretty(options.cause)
@@ -1416,7 +1620,7 @@ var makeLogRecord = (options, opts) => {
1416
1620
  severityText: options.logLevel,
1417
1621
  timeUnixNano: nanosString,
1418
1622
  observedTimeUnixNano: nanosString,
1419
- attributes,
1623
+ attributes: attributes2,
1420
1624
  body: unknownToAttributeValue(message.length === 1 ? message[0] : message),
1421
1625
  droppedAttributesCount: 0
1422
1626
  };
@@ -1473,7 +1677,7 @@ var ESeverityNumber = {
1473
1677
  SEVERITY_NUMBER_FATAL4: 24
1474
1678
  };
1475
1679
 
1476
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/OtlpMetrics.js
1680
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpMetrics.js
1477
1681
  var OtlpMetrics_exports = {};
1478
1682
  __export(OtlpMetrics_exports, {
1479
1683
  layer: () => layer3,
@@ -1519,7 +1723,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
1519
1723
  for (let i = 0, len = snapshot2.length; i < len; i++) {
1520
1724
  const state = snapshot2[i];
1521
1725
  const unit = state.attributes?.unit ?? state.attributes?.time_unit ?? "1";
1522
- const attributes = state.attributes ? entriesToAttributes(Object.entries(state.attributes)) : [];
1726
+ const attributes2 = state.attributes ? entriesToAttributes(Object.entries(state.attributes)) : [];
1523
1727
  const metricKey = makeMetricKey(state.id, state.attributes);
1524
1728
  switch (state.type) {
1525
1729
  case "Counter": {
@@ -1545,7 +1749,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
1545
1749
  nextCounterState.set(metricKey, currentCount);
1546
1750
  }
1547
1751
  const dataPoint = {
1548
- attributes,
1752
+ attributes: attributes2,
1549
1753
  startTimeUnixNano: intervalStartTime,
1550
1754
  timeUnixNano: nowTime
1551
1755
  };
@@ -1572,7 +1776,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
1572
1776
  }
1573
1777
  case "Gauge": {
1574
1778
  const dataPoint = {
1575
- attributes,
1779
+ attributes: attributes2,
1576
1780
  startTimeUnixNano: startTime,
1577
1781
  timeUnixNano: nowTime
1578
1782
  };
@@ -1632,7 +1836,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
1632
1836
  });
1633
1837
  }
1634
1838
  const dataPoint = {
1635
- attributes,
1839
+ attributes: attributes2,
1636
1840
  startTimeUnixNano: intervalStartTime,
1637
1841
  timeUnixNano: nowTime,
1638
1842
  count: reportCount,
@@ -1671,7 +1875,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
1671
1875
  }
1672
1876
  }
1673
1877
  dataPoints.push({
1674
- attributes: [...attributes, {
1878
+ attributes: [...attributes2, {
1675
1879
  key: "key",
1676
1880
  value: {
1677
1881
  stringValue: freqKey
@@ -1703,7 +1907,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
1703
1907
  }
1704
1908
  case "Summary": {
1705
1909
  const dataPoints = [{
1706
- attributes: [...attributes, {
1910
+ attributes: [...attributes2, {
1707
1911
  key: "quantile",
1708
1912
  value: {
1709
1913
  stringValue: "min"
@@ -1715,7 +1919,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
1715
1919
  }];
1716
1920
  for (const [quantile, value] of state.state.quantiles) {
1717
1921
  dataPoints.push({
1718
- attributes: [...attributes, {
1922
+ attributes: [...attributes2, {
1719
1923
  key: "quantile",
1720
1924
  value: {
1721
1925
  stringValue: quantile.toString()
@@ -1727,7 +1931,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
1727
1931
  });
1728
1932
  }
1729
1933
  dataPoints.push({
1730
- attributes: [...attributes, {
1934
+ attributes: [...attributes2, {
1731
1935
  key: "quantile",
1732
1936
  value: {
1733
1937
  stringValue: "max"
@@ -1751,13 +1955,13 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
1751
1955
  });
1752
1956
  }
1753
1957
  const countDataPoint = {
1754
- attributes,
1958
+ attributes: attributes2,
1755
1959
  startTimeUnixNano: intervalStartTime,
1756
1960
  timeUnixNano: nowTime,
1757
1961
  asInt: reportCount
1758
1962
  };
1759
1963
  const sumDataPoint = {
1760
- attributes,
1964
+ attributes: attributes2,
1761
1965
  startTimeUnixNano: intervalStartTime,
1762
1966
  timeUnixNano: nowTime,
1763
1967
  asDouble: reportSum
@@ -1870,11 +2074,11 @@ var layerFromConfig2 = (options) => gen(function* () {
1870
2074
  temporality: getOrUndefined(temporalityPreference)
1871
2075
  });
1872
2076
  }).pipe(orDie, unwrap);
1873
- var makeMetricKey = (id, attributes) => {
1874
- if (attributes === void 0 || Object.keys(attributes).length === 0) {
2077
+ var makeMetricKey = (id, attributes2) => {
2078
+ if (attributes2 === void 0 || Object.keys(attributes2).length === 0) {
1875
2079
  return id;
1876
2080
  }
1877
- const sortedEntries = Object.entries(attributes).sort((a, b) => a[0].localeCompare(b[0]));
2081
+ const sortedEntries = Object.entries(attributes2).sort((a, b) => a[0].localeCompare(b[0]));
1878
2082
  return `${id}:${JSON.stringify(sortedEntries)}`;
1879
2083
  };
1880
2084
  var EAggregationTemporality = {
@@ -1936,7 +2140,7 @@ var EAggregationTemporality = {
1936
2140
  AGGREGATION_TEMPORALITY_CUMULATIVE: 2
1937
2141
  };
1938
2142
 
1939
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/OtlpTracer.js
2143
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpTracer.js
1940
2144
  var OtlpTracer_exports = {};
1941
2145
  __export(OtlpTracer_exports, {
1942
2146
  layer: () => layer4,
@@ -2051,10 +2255,10 @@ var SpanImpl = class {
2051
2255
  };
2052
2256
  }
2053
2257
  get traceId() {
2054
- return this._traceId ??= isSome(this.parent) ? this.parent.value.traceId : randomHex(32);
2258
+ return this._traceId ??= isSome(this.parent) ? this.parent.value.traceId : random(32);
2055
2259
  }
2056
2260
  get spanId() {
2057
- return this._spanId ??= randomHex(16);
2261
+ return this._spanId ??= random(16);
2058
2262
  }
2059
2263
  get attributes() {
2060
2264
  return this._attributes ??= /* @__PURE__ */ new Map();
@@ -2074,39 +2278,39 @@ var SpanImpl = class {
2074
2278
  attribute(key, value) {
2075
2279
  this.attributes.set(key, value);
2076
2280
  }
2077
- event(name, startTime, attributes) {
2078
- this.events.push([name, startTime, attributes]);
2281
+ event(name, startTime, attributes2) {
2282
+ this.events.push([name, startTime, attributes2]);
2079
2283
  }
2080
2284
  addLinks(links) {
2081
2285
  this.links.push(...links);
2082
2286
  }
2083
2287
  };
2084
2288
  var makeOtlpSpan = (self) => {
2085
- const status = self.status;
2086
- const attributes = self._attributes === void 0 ? [] : entriesToAttributes(self._attributes);
2289
+ const status2 = self.status;
2290
+ const attributes2 = self._attributes === void 0 ? [] : entriesToAttributes(self._attributes);
2087
2291
  const events = [];
2088
2292
  if (self._events !== void 0) {
2089
2293
  for (let i = 0; i < self._events.length; i++) {
2090
- const [name, startTime, attributes2] = self._events[i];
2294
+ const [name, startTime, attributes3] = self._events[i];
2091
2295
  events.push({
2092
2296
  name,
2093
2297
  timeUnixNano: String(startTime),
2094
- attributes: attributes2 ? entriesToAttributes(Object.entries(attributes2)) : [],
2298
+ attributes: attributes3 ? entriesToAttributes(Object.entries(attributes3)) : [],
2095
2299
  droppedAttributesCount: 0
2096
2300
  });
2097
2301
  }
2098
2302
  }
2099
2303
  let otelStatus;
2100
- if (status.exit._tag === "Success") {
2304
+ if (status2.exit._tag === "Success") {
2101
2305
  otelStatus = {
2102
2306
  code: StatusCode.Ok
2103
2307
  };
2104
- } else if (hasInterruptsOnly(status.exit.cause)) {
2308
+ } else if (hasInterruptsOnly(status2.exit.cause)) {
2105
2309
  otelStatus = {
2106
2310
  code: StatusCode.Ok,
2107
2311
  message: "Interrupted"
2108
2312
  };
2109
- attributes.push({
2313
+ attributes2.push({
2110
2314
  key: "span.label",
2111
2315
  value: {
2112
2316
  stringValue: "\u26A0\uFE0E Interrupted"
@@ -2118,7 +2322,7 @@ var makeOtlpSpan = (self) => {
2118
2322
  }
2119
2323
  });
2120
2324
  } else {
2121
- const errors = prettyErrors(status.exit.cause, {
2325
+ const errors = prettyErrors(status2.exit.cause, {
2122
2326
  includeCauseInStack: true
2123
2327
  });
2124
2328
  otelStatus = {
@@ -2129,7 +2333,7 @@ var makeOtlpSpan = (self) => {
2129
2333
  for (const error of errors) {
2130
2334
  events.push({
2131
2335
  name: "exception",
2132
- timeUnixNano: String(status.endTime),
2336
+ timeUnixNano: String(status2.endTime),
2133
2337
  droppedAttributesCount: 0,
2134
2338
  attributes: [{
2135
2339
  "key": "exception.type",
@@ -2167,9 +2371,9 @@ var makeOtlpSpan = (self) => {
2167
2371
  parentSpanId: isSome(self.parent) ? self.parent.value.spanId : void 0,
2168
2372
  name: self.name,
2169
2373
  kind: SpanKind[self.kind],
2170
- startTimeUnixNano: String(status.startTime),
2171
- endTimeUnixNano: String(status.endTime),
2172
- attributes,
2374
+ startTimeUnixNano: String(status2.startTime),
2375
+ endTimeUnixNano: String(status2.endTime),
2376
+ attributes: attributes2,
2173
2377
  droppedAttributesCount: 0,
2174
2378
  events,
2175
2379
  droppedEventsCount: 0,
@@ -2245,6 +2449,341 @@ var telemetryLayer = (config, lifetime = "process", logger = Logger_exports.with
2245
2449
  );
2246
2450
  };
2247
2451
 
2452
+ // ../telemetry/src/app-records.ts
2453
+ var appText = "Text from the app is not recorded";
2454
+ var unrecognized = "unrecognized";
2455
+ var operations = [
2456
+ "requirements",
2457
+ "inspect",
2458
+ "skills",
2459
+ "query",
2460
+ "mutate",
2461
+ "call",
2462
+ "account-check",
2463
+ "webhooks",
2464
+ "webhook-validate",
2465
+ "webhook-complete",
2466
+ "webhook-register",
2467
+ "webhook-unregister",
2468
+ "webhook-handle",
2469
+ "workflows",
2470
+ "workflow-validate",
2471
+ "workflow-run",
2472
+ "migrate"
2473
+ ];
2474
+ var httpMethods = [
2475
+ "GET",
2476
+ "HEAD",
2477
+ "POST",
2478
+ "PUT",
2479
+ "PATCH",
2480
+ "DELETE",
2481
+ "OPTIONS",
2482
+ "TRACE",
2483
+ "CONNECT"
2484
+ ];
2485
+ var appSpanNames = /* @__PURE__ */ new Set([
2486
+ "app.dispatch",
2487
+ ...operations.map((operation) => `app.${operation}`),
2488
+ "app.evaluate",
2489
+ "app.accounts.bind",
2490
+ "app.account.check",
2491
+ "app.catalog.read",
2492
+ "app.skills.load",
2493
+ "app.skills.routers",
2494
+ "app.tool.resolve",
2495
+ "app.tool.approval",
2496
+ "app.tool.elicitation",
2497
+ "app.elicitation.wait",
2498
+ "app.workflow.control",
2499
+ "app.operation.execute",
2500
+ "app.sql.migrate",
2501
+ "app.code",
2502
+ "app.cache.call",
2503
+ "app.cache.get",
2504
+ "app.cache.load",
2505
+ "app.cache.command",
2506
+ "app.cache.publish",
2507
+ "app.cache.flush",
2508
+ "app.cache.lease.renew",
2509
+ "provider.http.request",
2510
+ "provider.http.response.read",
2511
+ "provider.openapi.call",
2512
+ "provider.graphql.request",
2513
+ "provider.graphql.call",
2514
+ "provider.mcp.session",
2515
+ "provider.mcp.connect",
2516
+ "provider.mcp.close",
2517
+ "provider.mcp.request",
2518
+ "provider.mcp.call",
2519
+ "provider.mcp.discover",
2520
+ "provider.mcp.check",
2521
+ "provider.mcp.health",
2522
+ "provider.mcp.anonymous",
2523
+ "provider.mcp.elicitation",
2524
+ "sql.execute",
2525
+ ...httpMethods.map((method) => `http.client ${method}`)
2526
+ ]);
2527
+ var errorKinds = /* @__PURE__ */ new Set([
2528
+ "HostRequestInvalid",
2529
+ "HostAccountsInvalid",
2530
+ "HostDeclarationInvalid",
2531
+ "HostEvaluationFailed",
2532
+ "HostOperationNotFound",
2533
+ "HostOperationFailed",
2534
+ "HostKindMismatch",
2535
+ "HostToolNotFound",
2536
+ "HostInputInvalid",
2537
+ "HostOutputInvalid",
2538
+ "HostToolBlocked",
2539
+ "HostToolApprovalRequired",
2540
+ "HostToolPolicyFailed",
2541
+ "ElicitationFailed",
2542
+ "DatabaseLimitExceeded",
2543
+ "DatabaseFieldReserved",
2544
+ "SkillLoadFailed",
2545
+ "WorkflowFailure",
2546
+ "ProviderError",
2547
+ "OpenapiResponseError",
2548
+ "OpenapiError",
2549
+ "OpenapiCompileError",
2550
+ "GraphqlError",
2551
+ "McpError",
2552
+ "McpToolError",
2553
+ "McpCredentialsUnverified",
2554
+ "CacheError",
2555
+ "AppDatabaseError",
2556
+ "AppStorageError",
2557
+ "AppStorageUnavailable",
2558
+ "NetworkRefused",
2559
+ "FetchOptionUnsupported",
2560
+ "LogicalOperationFailed",
2561
+ "HttpClientError",
2562
+ "SchemaError",
2563
+ "TimeoutError",
2564
+ "UnknownError",
2565
+ "InterruptError",
2566
+ "Error",
2567
+ "TypeError",
2568
+ "RangeError",
2569
+ "ReferenceError",
2570
+ "SyntaxError",
2571
+ "EvalError",
2572
+ "URIError",
2573
+ "AggregateError",
2574
+ "AbortError",
2575
+ "string",
2576
+ "number",
2577
+ "bigint",
2578
+ "boolean",
2579
+ "symbol",
2580
+ "undefined",
2581
+ "object",
2582
+ "function"
2583
+ ]);
2584
+ var failureCodes = /* @__PURE__ */ new Set([
2585
+ // CacheError
2586
+ "unavailable",
2587
+ "storage",
2588
+ "invalid",
2589
+ "capacity",
2590
+ "timeout",
2591
+ // AppDatabaseError
2592
+ "schema",
2593
+ "schema_changed",
2594
+ "table",
2595
+ "index",
2596
+ "range",
2597
+ "value",
2598
+ "readonly",
2599
+ "cursor",
2600
+ "limit",
2601
+ "closed",
2602
+ "replay",
2603
+ // OpenapiError
2604
+ "invalid_definition",
2605
+ "invalid_input",
2606
+ "request",
2607
+ // McpError, McpCredentialsUnverified and ProviderError
2608
+ "unauthorized",
2609
+ "invalid_response",
2610
+ "forbidden",
2611
+ "rate_limited",
2612
+ "rejected",
2613
+ "anonymous_access",
2614
+ // NetworkRefused and FetchOptionUnsupported
2615
+ "private_address",
2616
+ "credential_host",
2617
+ "credential_app",
2618
+ "credential_expired",
2619
+ "redirect",
2620
+ "cache",
2621
+ "integrity"
2622
+ ]);
2623
+ var text = (value) => typeof value["stringValue"] === "string" ? value["stringValue"] : void 0;
2624
+ var integer = (value) => {
2625
+ const raw = value["intValue"];
2626
+ const number = typeof raw === "string" && /^-?\d{1,15}$/.test(raw) ? Number(raw) : raw;
2627
+ return typeof number === "number" && Number.isSafeInteger(number) ? number : void 0;
2628
+ };
2629
+ var oneOf = (...values) => (value) => {
2630
+ const found = text(value);
2631
+ return found !== void 0 && values.includes(found) ? { stringValue: found } : void 0;
2632
+ };
2633
+ var classified = (known) => (value) => {
2634
+ const found = text(value);
2635
+ return found === void 0 ? void 0 : { stringValue: known.has(found) ? found : unrecognized };
2636
+ };
2637
+ var flag = (value) => typeof value["boolValue"] === "boolean" ? { boolValue: value["boolValue"] } : void 0;
2638
+ var count = (value) => {
2639
+ const found = integer(value);
2640
+ return found !== void 0 && found >= 0 ? { intValue: found } : void 0;
2641
+ };
2642
+ var status = (value) => {
2643
+ const found = integer(value);
2644
+ return found !== void 0 && found >= 100 && found <= 599 ? { intValue: found } : void 0;
2645
+ };
2646
+ var duration = (value) => {
2647
+ const found = typeof value["doubleValue"] === "number" ? value["doubleValue"] : integer(value);
2648
+ return found !== void 0 && Number.isFinite(found) && found >= 0 ? { doubleValue: found } : void 0;
2649
+ };
2650
+ var spanAttributes2 = {
2651
+ "executor.operation": oneOf(...operations, "mutation", "discover"),
2652
+ "executor.outcome": oneOf("failed"),
2653
+ "executor.clock.type": oneOf("system", "cloudflare-io"),
2654
+ "executor.trace.parent_sampled": flag,
2655
+ "executor.failure.source": oneOf("app", "storage", "service"),
2656
+ "executor.failure.code": classified(failureCodes),
2657
+ "error.type": classified(errorKinds),
2658
+ "cache.operation": oneOf(
2659
+ "read",
2660
+ "acquire",
2661
+ "claim",
2662
+ "publish",
2663
+ "release",
2664
+ "renew",
2665
+ "write",
2666
+ "invalidate"
2667
+ ),
2668
+ "cache.result": oneOf("fresh", "stale", "miss", "local"),
2669
+ "cache.load.leased": flag,
2670
+ "cache.flush.index": count,
2671
+ "cache.flush.count": count,
2672
+ "cache.flush.entries": count,
2673
+ "cache.flush.bytes": count,
2674
+ "cache.leases": count,
2675
+ "mcp.transport": oneOf("http", "sse", "stdio"),
2676
+ "mcp.operation": oneOf("discover", "call", "check", "health"),
2677
+ "mcp.tool.is_error": flag,
2678
+ "rpc.system.name": oneOf("jsonrpc"),
2679
+ "rpc.method": oneOf("initialize", "tools/list", "tools/call", "ping"),
2680
+ "graphql.operation.type": oneOf("query", "mutation", "subscription"),
2681
+ "db.system.name": oneOf("sqlite"),
2682
+ "db.operation.name": oneOf("execute"),
2683
+ "http.request.method": oneOf(...httpMethods),
2684
+ "http.response.status_code": status,
2685
+ "url.scheme": oneOf("http", "https"),
2686
+ "span.label": oneOf("\u26A0\uFE0E Interrupted"),
2687
+ "status.interrupted": flag,
2688
+ "executor.milestone.reached": flag,
2689
+ "executor.owner": oneOf("executor", "app", "upstream", "person"),
2690
+ "executor.app.code": oneOf(
2691
+ "factory",
2692
+ "router",
2693
+ "approval",
2694
+ "handler",
2695
+ "loader",
2696
+ "cache",
2697
+ "webhook",
2698
+ "check",
2699
+ "skills",
2700
+ "elicitation",
2701
+ "workflow",
2702
+ "step"
2703
+ ),
2704
+ "executor.workflow.operation": oneOf("start", "get", "list", "terminate"),
2705
+ "cache.method": oneOf("get", "revalidate", "read", "readMany", "write", "invalidate"),
2706
+ "executor.upstream.wait_ms": duration,
2707
+ "executor.elicitation.wait_ms": duration,
2708
+ "executor.authored_ms": duration,
2709
+ "executor.overhead_ms": duration
2710
+ };
2711
+ var appSpanAttributeKeys = new Set(Object.keys(spanAttributes2));
2712
+ var logMessages = /* @__PURE__ */ new Set([
2713
+ "The app's request failed unexpectedly",
2714
+ "App cache refresh failed",
2715
+ "MCP catalog invalidation failed",
2716
+ "Telemetry export failed"
2717
+ ]);
2718
+ var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
2719
+ var spanId = (value) => typeof value === "string" && /^[a-f0-9]{16}$/.test(value) ? value : void 0;
2720
+ var nanos = (value) => typeof value === "string" && /^\d{1,20}$/.test(value) ? value : void 0;
2721
+ var between = (value, minimum, maximum) => typeof value === "number" && Number.isInteger(value) && value >= minimum && value <= maximum ? value : void 0;
2722
+ var attributes = (from) => (Array.isArray(from) ? from : []).flatMap((attribute) => {
2723
+ if (!isObject(attribute) || typeof attribute["key"] !== "string") return [];
2724
+ const key = attribute["key"];
2725
+ const keep = Object.hasOwn(spanAttributes2, key) ? spanAttributes2[key] : void 0;
2726
+ const value = attribute["value"];
2727
+ const kept = keep === void 0 || !isObject(value) ? void 0 : keep(value);
2728
+ return kept === void 0 ? [] : [{ key, value: kept }];
2729
+ });
2730
+ var exception = (event) => {
2731
+ const named = (Array.isArray(event["attributes"]) ? event["attributes"] : []).find(
2732
+ (attribute) => isObject(attribute) && attribute["key"] === "exception.type"
2733
+ );
2734
+ const type = isObject(named) && isObject(named["value"]) ? text(named["value"]) : void 0;
2735
+ const recorded2 = type !== void 0 && errorKinds.has(type) ? type : unrecognized;
2736
+ const time = nanos(event["timeUnixNano"]);
2737
+ return {
2738
+ name: "exception",
2739
+ ...time === void 0 ? {} : { timeUnixNano: time },
2740
+ attributes: [
2741
+ { key: "exception.type", value: { stringValue: recorded2 } },
2742
+ { key: "exception.message", value: { stringValue: appText } },
2743
+ { key: "exception.stacktrace", value: { stringValue: `${recorded2}: ${appText}` } }
2744
+ ]
2745
+ };
2746
+ };
2747
+ var appSpan = (span) => {
2748
+ const start = nanos(span["startTimeUnixNano"]);
2749
+ const end = nanos(span["endTimeUnixNano"]);
2750
+ if (start === void 0 || end === void 0) return void 0;
2751
+ const parent = spanId(span["parentSpanId"]);
2752
+ const kind = between(span["kind"], 0, 5);
2753
+ const code = isObject(span["status"]) ? between(span["status"]["code"], 0, 2) : void 0;
2754
+ const name = typeof span["name"] === "string" && appSpanNames.has(span["name"]) ? span["name"] : "app.unrecognized";
2755
+ return {
2756
+ traceId: span.traceId,
2757
+ spanId: span.spanId,
2758
+ ...parent === void 0 ? {} : { parentSpanId: parent },
2759
+ name,
2760
+ ...kind === void 0 ? {} : { kind },
2761
+ startTimeUnixNano: start,
2762
+ endTimeUnixNano: end,
2763
+ attributes: attributes(span["attributes"]),
2764
+ events: (Array.isArray(span["events"]) ? span["events"] : []).flatMap(
2765
+ (event) => isObject(event) && event["name"] === "exception" ? [exception(event)] : []
2766
+ ),
2767
+ ...code === void 0 ? {} : { status: { code } }
2768
+ };
2769
+ };
2770
+ var appLog = (log) => {
2771
+ const time = nanos(log["timeUnixNano"]);
2772
+ const observed = nanos(log["observedTimeUnixNano"]);
2773
+ const severity = between(log["severityNumber"], 1, 24);
2774
+ const level = log["severityText"];
2775
+ const body = isObject(log["body"]) ? text(log["body"]) : void 0;
2776
+ return {
2777
+ ...log.traceId === void 0 ? {} : { traceId: log.traceId },
2778
+ ...log.spanId === void 0 ? {} : { spanId: log.spanId },
2779
+ ...time === void 0 ? {} : { timeUnixNano: time },
2780
+ ...observed === void 0 ? {} : { observedTimeUnixNano: observed },
2781
+ ...severity === void 0 ? {} : { severityNumber: severity },
2782
+ ...typeof level === "string" && ["Trace", "Debug", "Info", "Warn", "Error", "Fatal"].includes(level) ? { severityText: level } : {},
2783
+ body: { stringValue: body !== void 0 && logMessages.has(body) ? body : appText }
2784
+ };
2785
+ };
2786
+
2248
2787
  // ../telemetry/src/relay.ts
2249
2788
  var makeTelemetryForwarder = Effect_exports.gen(function* () {
2250
2789
  const fibers = yield* FiberSet_exports.make();
@@ -2257,10 +2796,10 @@ var makeTelemetryForwarder = Effect_exports.gen(function* () {
2257
2796
  Effect_exports.flatMap((drained) => Option_exports.isNone(drained) ? failed("shutdown") : Effect_exports.void)
2258
2797
  )
2259
2798
  );
2260
- return (batch, traceId, build) => FiberSet_exports.run(
2799
+ return (batch, traceId, source) => FiberSet_exports.run(
2261
2800
  fibers,
2262
2801
  sender.withPermits(1)(
2263
- forwardTelemetry(batch, traceId, build).pipe(Effect_exports.catch(() => failed("relay")))
2802
+ forwardTelemetry(batch, traceId, source).pipe(Effect_exports.catch(() => failed("relay")))
2264
2803
  ).pipe(
2265
2804
  pending.withPermitsIfAvailable(1),
2266
2805
  Effect_exports.flatMap(
@@ -2360,8 +2899,8 @@ var recordPacker = (prefix, suffix) => {
2360
2899
  }
2361
2900
  };
2362
2901
  };
2363
- var HexTrace = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{32}$/));
2364
- var HexSpan = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{16}$/));
2902
+ var HexTrace = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{32}$/u));
2903
+ var HexSpan = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{16}$/u));
2365
2904
  var Span = Schema_exports.StructWithRest(Schema_exports.Struct({ traceId: HexTrace, spanId: HexSpan }), [
2366
2905
  Schema_exports.Record(Schema_exports.String, Schema_exports.Json)
2367
2906
  ]);
@@ -2391,7 +2930,7 @@ var LogPayload = Schema_exports.fromJsonString(
2391
2930
  )
2392
2931
  })
2393
2932
  );
2394
- var forwardTelemetry = (batch, traceId, build, service = "executor-app") => Effect_exports.gen(function* () {
2933
+ var forwardTelemetry = (batch, traceId, { build, app }, service = "executor-app") => Effect_exports.gen(function* () {
2395
2934
  const config = yield* CurrentTelemetryConfig;
2396
2935
  if (config === void 0) return;
2397
2936
  const resource = {
@@ -2399,10 +2938,11 @@ var forwardTelemetry = (batch, traceId, build, service = "executor-app") => Effe
2399
2938
  { key: "service.name", value: { stringValue: service } },
2400
2939
  { key: "service.version", value: { stringValue: config.version } },
2401
2940
  { key: "deployment.environment.name", value: { stringValue: config.environment } },
2402
- ...build === void 0 ? [] : [{ key: "executor.build.id", value: { stringValue: build } }]
2941
+ ...build === void 0 ? [] : [{ key: "executor.build.id", value: { stringValue: build } }],
2942
+ ...app === void 0 ? [] : [{ key: "executor.app.id", value: { stringValue: app } }]
2403
2943
  ]
2404
2944
  };
2405
- const client = yield* HttpClient_exports.HttpClient;
2945
+ const client = retryTelemetryExport(yield* HttpClient_exports.HttpClient);
2406
2946
  if (batch.dropped > 0) yield* recordExportFailure("app", "capacity", batch.dropped);
2407
2947
  for (const signal of ["traces", "logs"]) {
2408
2948
  const target = config[signal];
@@ -2418,7 +2958,11 @@ var forwardTelemetry = (batch, traceId, build, service = "executor-app") => Effe
2418
2958
  scopeSpans: [
2419
2959
  {
2420
2960
  scope: { name: service },
2421
- spans: payloads.flatMap((payload) => payload.resourceSpans).flatMap((r) => r.scopeSpans.flatMap((s) => s.spans)).filter((span) => traceId === void 0 || span.traceId === traceId)
2961
+ spans: payloads.flatMap((payload) => payload.resourceSpans).flatMap((r) => r.scopeSpans.flatMap((s) => s.spans)).filter((span) => traceId === void 0 || span.traceId === traceId).flatMap((span) => {
2962
+ if (service !== "executor-app") return [span];
2963
+ const kept = appSpan(span);
2964
+ return kept === void 0 ? [] : [kept];
2965
+ })
2422
2966
  }
2423
2967
  ]
2424
2968
  }
@@ -2435,14 +2979,14 @@ var forwardTelemetry = (batch, traceId, build, service = "executor-app") => Effe
2435
2979
  scopeLogs: [
2436
2980
  {
2437
2981
  scope: { name: service },
2438
- logRecords: payloads.flatMap((payload) => payload.resourceLogs).flatMap((r) => r.scopeLogs.flatMap((s) => s.logRecords)).filter((log) => traceId === void 0 || log.traceId === traceId)
2982
+ logRecords: payloads.flatMap((payload) => payload.resourceLogs).flatMap((r) => r.scopeLogs.flatMap((s) => s.logRecords)).filter((log) => traceId === void 0 || log.traceId === traceId).map((log) => service === "executor-app" ? appLog(log) : log)
2439
2983
  }
2440
2984
  ]
2441
2985
  }
2442
2986
  ]
2443
2987
  }))
2444
2988
  );
2445
- yield* client.pipe(HttpClient_exports.filterStatusOk).execute(
2989
+ yield* client.execute(
2446
2990
  HttpClientRequest_exports.post(target.url).pipe(
2447
2991
  HttpClientRequest_exports.setHeaders(
2448
2992
  target.headers === void 0 ? {} : Redacted_exports.value(target.headers)
@@ -2459,8 +3003,8 @@ var forwardTelemetry = (batch, traceId, build, service = "executor-app") => Effe
2459
3003
 
2460
3004
  // ../telemetry/src/trace-context.ts
2461
3005
  var TraceContext = Schema_exports.Struct({
2462
- traceId: Schema_exports.String.check(Schema_exports.isPattern(/^(?!0{32}$)[a-f0-9]{32}$/)),
2463
- spanId: Schema_exports.String.check(Schema_exports.isPattern(/^(?!0{16}$)[a-f0-9]{16}$/)),
3006
+ traceId: Schema_exports.String.check(Schema_exports.isPattern(/^(?!0{32}$)[a-f0-9]{32}$/u)),
3007
+ spanId: Schema_exports.String.check(Schema_exports.isPattern(/^(?!0{16}$)[a-f0-9]{16}$/u)),
2464
3008
  sampled: Schema_exports.Boolean
2465
3009
  });
2466
3010
  var currentTraceContext = Effect_exports.currentSpan.pipe(
@@ -2502,13 +3046,15 @@ var pendingSpan = (name, options) => Effect_exports.gen(function* () {
2502
3046
 
2503
3047
  export {
2504
3048
  CurrentTelemetryConfig,
3049
+ owned,
3050
+ measuredSpan,
3051
+ makeOwnershipAccounting,
2505
3052
  OtlpExporter_exports,
2506
3053
  telemetryLayer,
2507
3054
  captureTelemetry,
2508
3055
  withRemoteSpan,
2509
3056
  invocationFetch,
2510
3057
  collectTelemetry,
2511
- TraceContext,
2512
3058
  externalTrace,
2513
3059
  traceLinks,
2514
3060
  pendingSpan