apps 0.0.1-beta.4 → 0.0.1-beta.41

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 (171) hide show
  1. package/README.md +68 -44
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-QKHR7BMF.js → chunk-3MMG2H6M.js} +89 -53
  4. package/js/{chunk-EQB7JMAL.js → chunk-6XGB4BAL.js} +146 -31
  5. package/js/chunk-ADD6H64X.js +729 -0
  6. package/js/{chunk-6VRYO2BG.js → chunk-AHGGO2VY.js} +837 -254
  7. package/js/{chunk-FDNTX5QJ.js → chunk-CQD3WSYH.js} +2 -2
  8. package/js/{chunk-EVJUVWN2.js → chunk-DKUEYTYD.js} +463 -218
  9. package/js/chunk-EM4UL26F.js +118 -0
  10. package/js/{chunk-2VPJHFOU.js → chunk-FXWRE655.js} +128 -24
  11. package/js/{chunk-5MQZEB6Y.js → chunk-JI3EP2GL.js} +40 -12
  12. package/js/chunk-JJSLEJ6T.js +156 -0
  13. package/js/chunk-KAQD3DTI.js +16 -0
  14. package/js/chunk-KIM5HXNK.js +49 -0
  15. package/js/chunk-MJZYV7IO.js +255 -0
  16. package/js/{chunk-FW5HBOIK.js → chunk-MXDKXAY4.js} +19117 -18309
  17. package/js/{chunk-T2LAZCAD.js → chunk-NKWWPJYX.js} +3 -3
  18. package/js/chunk-OD3KFKZD.js +1617 -0
  19. package/js/{chunk-3M2MEDNL.js → chunk-OTCLXFLL.js} +1337 -188
  20. package/js/chunk-P7MGDPFD.js +240 -0
  21. package/js/{chunk-ZCAMUXSG.js → chunk-PNVCCB4L.js} +432 -79
  22. package/js/{chunk-D47C7KG5.js → chunk-RIXVGVA6.js} +2 -2
  23. package/js/{chunk-NQ3OMCA5.js → chunk-TT6OU4UG.js} +2 -2
  24. package/js/{chunk-YEJOQEII.js → chunk-UOZMSUJ2.js} +61 -9
  25. package/js/chunk-UTJIGUSS.js +42 -0
  26. package/js/{chunk-G7ZIRKMK.js → chunk-VIU2XXA7.js} +228 -264
  27. package/js/{chunk-HDJH3RPR.js → chunk-VJQXXOQ3.js} +4 -4
  28. package/js/{chunk-WFSQXYUT.js → chunk-WPBR4AWB.js} +523 -63
  29. package/js/{chunk-SATWJKN6.js → chunk-YQ35E7KS.js} +2 -2
  30. package/js/chunk-ZUKBIHMK.js +92 -0
  31. package/js/client.js +122 -88
  32. package/js/contracts.js +116 -25
  33. package/js/effect.js +19 -20
  34. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  35. package/js/graphql.js +57 -55
  36. package/js/host.js +19 -20
  37. package/js/index.js +245 -212
  38. package/js/mcp/effect.js +23 -22
  39. package/js/mcp/stdio.js +34 -30
  40. package/js/mcp.js +104 -68
  41. package/js/openapi.js +4087 -1503
  42. package/js/react.js +2 -3
  43. package/js/skills/effect.js +6 -3
  44. package/js/skills.js +147 -65
  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-data/src/contracts/database.d.ts +33 -6
  53. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  54. package/types/apps/src/contracts/app.d.ts +7 -8
  55. package/types/apps/src/contracts/cache.d.ts +14 -0
  56. package/types/apps/src/contracts/context.d.ts +12 -11
  57. package/types/apps/src/contracts/elicitation.d.ts +6 -6
  58. package/types/apps/src/contracts/failure.d.ts +54 -0
  59. package/types/apps/src/contracts/graphql.d.ts +2 -1
  60. package/types/apps/src/contracts/host.d.ts +44 -17
  61. package/types/apps/src/contracts/live.d.ts +2 -0
  62. package/types/apps/src/contracts/mcp.d.ts +96 -10
  63. package/types/apps/src/contracts/network.d.ts +84 -0
  64. package/types/apps/src/contracts/openapi-compile.d.ts +32 -3
  65. package/types/apps/src/contracts/openapi.d.ts +45 -9
  66. package/types/apps/src/contracts/operations.d.ts +8 -9
  67. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  68. package/types/apps/src/contracts/protocols/1.d.ts +263 -74
  69. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  70. package/types/apps/src/contracts/protocols/2.d.ts +66 -24
  71. package/types/apps/src/contracts/protocols/3.d.ts +715 -0
  72. package/types/apps/src/contracts/protocols/4.d.ts +1297 -0
  73. package/types/apps/src/contracts/protocols/5.d.ts +1174 -0
  74. package/types/apps/src/contracts/protocols/6.d.ts +1620 -0
  75. package/types/apps/src/contracts/protocols/7.d.ts +1784 -0
  76. package/types/apps/src/contracts/protocols/8.d.ts +1130 -0
  77. package/types/apps/src/contracts/protocols/9.d.ts +1106 -0
  78. package/types/apps/src/contracts/protocols/oauth.d.ts +89 -0
  79. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  80. package/types/apps/src/contracts/provider.d.ts +115 -10
  81. package/types/apps/src/contracts/router.d.ts +59 -0
  82. package/types/apps/src/contracts/skills.d.ts +39 -9
  83. package/types/apps/src/contracts/sql.d.ts +58 -0
  84. package/types/apps/src/contracts/ui.d.ts +19 -1
  85. package/types/apps/src/contracts/workflows.d.ts +40 -3
  86. package/types/apps/src/facet.d.ts +4 -5
  87. package/types/apps/src/graphql.d.ts +1 -3
  88. package/types/apps/src/implementation/account-router.d.ts +12 -0
  89. package/types/apps/src/implementation/app.d.ts +5 -4
  90. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  91. package/types/apps/src/implementation/catalog-cache.d.ts +32 -5
  92. package/types/apps/src/implementation/elicitation.d.ts +12 -12
  93. package/types/apps/src/implementation/failure-detail.d.ts +47 -0
  94. package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
  95. package/types/apps/src/implementation/graphql.d.ts +4 -3
  96. package/types/apps/src/implementation/input-problems.d.ts +6 -2
  97. package/types/apps/src/implementation/live.d.ts +2 -2
  98. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  99. package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
  100. package/types/apps/src/implementation/mcp-client.d.ts +49 -25
  101. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  102. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  103. package/types/apps/src/implementation/mcp.d.ts +52 -25
  104. package/types/apps/src/implementation/network.d.ts +16 -0
  105. package/types/apps/src/implementation/openapi-compile.d.ts +27 -6
  106. package/types/apps/src/implementation/openapi-document.d.ts +46 -19
  107. package/types/apps/src/implementation/openapi-names.d.ts +9 -4
  108. package/types/apps/src/implementation/openapi-request.d.ts +10 -2
  109. package/types/apps/src/implementation/openapi-source.d.ts +8 -6
  110. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  111. package/types/apps/src/implementation/operations.d.ts +36 -3
  112. package/types/apps/src/implementation/optimistic.d.ts +1 -1
  113. package/types/apps/src/implementation/protocol-operations.d.ts +6 -4
  114. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  115. package/types/apps/src/implementation/provider.d.ts +19 -5
  116. package/types/apps/src/implementation/query-commit.d.ts +1 -1
  117. package/types/apps/src/implementation/router-catalog.d.ts +223 -0
  118. package/types/apps/src/implementation/router.d.ts +68 -0
  119. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  120. package/types/apps/src/implementation/schema.d.ts +95 -11
  121. package/types/apps/src/implementation/skills.d.ts +18 -24
  122. package/types/apps/src/implementation/sql.d.ts +66 -0
  123. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  124. package/types/apps/src/implementation/ui-auth.d.ts +1 -1
  125. package/types/apps/src/implementation/ui-client.d.ts +2 -2
  126. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  127. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  128. package/types/apps/src/implementation/ui-serving.d.ts +11 -5
  129. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  130. package/types/apps/src/implementation/upstream-error.d.ts +7 -0
  131. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  132. package/types/apps/src/implementation/workflow-context.d.ts +11 -3
  133. package/types/apps/src/index.d.ts +30 -13
  134. package/types/apps/src/mcp-stdio.d.ts +2 -5
  135. package/types/apps/src/mcp.d.ts +25 -5
  136. package/types/apps/src/openapi.d.ts +6 -6
  137. package/types/apps/src/react.d.ts +1 -1
  138. package/types/apps/src/skills.d.ts +10 -8
  139. package/types/telemetry/src/app-records.d.ts +42 -0
  140. package/types/telemetry/src/browser-operations.d.ts +6 -3
  141. package/types/telemetry/src/browser.d.ts +2 -2
  142. package/types/telemetry/src/config.d.ts +2 -2
  143. package/types/telemetry/src/layer.d.ts +2 -2
  144. package/types/telemetry/src/recorded-failure.d.ts +20 -0
  145. package/types/telemetry/src/relay.d.ts +2 -2
  146. package/types/telemetry/src/transport.d.ts +8 -1
  147. package/types/utils/src/api-error.d.ts +53 -0
  148. package/types/utils/src/recorded-message.d.ts +15 -0
  149. package/js/chunk-BMOIAIVR.js +0 -138
  150. package/js/chunk-DHUDODG5.js +0 -213
  151. package/js/chunk-FZJOYIZO.js +0 -19
  152. package/js/chunk-LGIYBDWA.js +0 -85
  153. package/js/chunk-M6ZRRIBI.js +0 -877
  154. package/js/chunk-PLCMJREA.js +0 -590
  155. package/js/chunk-PYUYJRSK.js +0 -93
  156. package/js/chunk-SWPD52J7.js +0 -35
  157. package/js/chunk-W7D7WVSY.js +0 -18
  158. package/js/chunk-Z5NMEGJN.js +0 -29
  159. package/js/chunk-ZJWDMTE3.js +0 -63
  160. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  161. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  162. package/types/app-data/src/implementation/promise.d.ts +0 -68
  163. package/types/app-data/src/implementation/range.d.ts +0 -8
  164. package/types/app-data/src/implementation/schema.d.ts +0 -33
  165. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  166. package/types/app-data/src/index.d.ts +0 -4
  167. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  168. package/types/apps/src/contracts/storage.d.ts +0 -68
  169. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  170. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
  171. package/types/apps/src/implementation/storage.d.ts +0 -13
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  FetchHttpClient_exports
3
- } from "./chunk-HDJH3RPR.js";
3
+ } from "./chunk-VJQXXOQ3.js";
4
+ import {
5
+ recordedMessage
6
+ } from "./chunk-KAQD3DTI.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-QKHR7BMF.js";
26
+ } from "./chunk-3MMG2H6M.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,
@@ -39,6 +46,7 @@ import {
39
46
  Option_exports,
40
47
  Record2 as Record,
41
48
  Redacted_exports,
49
+ Schedule_exports,
42
50
  Schema_exports,
43
51
  Scope,
44
52
  Semaphore_exports,
@@ -53,7 +61,7 @@ import {
53
61
  UndefinedOr,
54
62
  addDelay,
55
63
  addFinalizer,
56
- all,
64
+ all2 as all,
57
65
  allocate,
58
66
  andThen,
59
67
  annotateLogs,
@@ -89,9 +97,9 @@ import {
89
97
  isSome,
90
98
  layer,
91
99
  logDebug,
92
- make2 as make,
93
- make7 as make2,
94
- make8 as make3,
100
+ make,
101
+ make4 as make2,
102
+ make5 as make3,
95
103
  map,
96
104
  map3 as map2,
97
105
  map5 as map3,
@@ -107,7 +115,7 @@ import {
107
115
  prettyErrors,
108
116
  provideMerge,
109
117
  provideService,
110
- randomHex,
118
+ random,
111
119
  run2 as run,
112
120
  runtime,
113
121
  schema,
@@ -125,7 +133,7 @@ import {
125
133
  withDefault2 as withDefault,
126
134
  withTracerEnabled,
127
135
  zero
128
- } from "./chunk-FW5HBOIK.js";
136
+ } from "./chunk-MXDKXAY4.js";
129
137
  import {
130
138
  __export
131
139
  } from "./chunk-CZ7CSFO4.js";
@@ -487,15 +495,15 @@ function getTextEncoding() {
487
495
  const te = new globalThis.TextEncoder();
488
496
  const td = new globalThis.TextDecoder();
489
497
  globalThis[symbol] = {
490
- encodeUtf8(text) {
491
- return te.encode(text);
498
+ encodeUtf8(text2) {
499
+ return te.encode(text2);
492
500
  },
493
501
  decodeUtf8(bytes) {
494
502
  return td.decode(bytes);
495
503
  },
496
- checkUtf8(text) {
504
+ checkUtf8(text2) {
497
505
  try {
498
- encodeURIComponent(text);
506
+ encodeURIComponent(text2);
499
507
  return true;
500
508
  } catch (_) {
501
509
  return false;
@@ -851,6 +859,42 @@ var telemetryHttpClient = Layer_exports.effect(
851
859
  )
852
860
  )
853
861
  ).pipe(Layer_exports.provide(selectedClient));
862
+ var retryDelay = (error) => Effect_exports.gen(function* () {
863
+ if (!HttpClientError_exports.isHttpClientError(error) || error.reason._tag !== "StatusCodeError" || error.reason.response.status !== 429 && error.reason.response.status !== 503)
864
+ return Duration_exports.seconds(1);
865
+ const header = error.reason.response.headers["retry-after"]?.trim();
866
+ if (header === void 0 || header === "")
867
+ return Duration_exports.seconds(error.reason.response.status === 429 ? 5 : 1);
868
+ const seconds2 = Number(header);
869
+ if (Number.isFinite(seconds2)) return Duration_exports.seconds(seconds2 >= 0 ? seconds2 : 5);
870
+ const date = Date.parse(header);
871
+ if (Number.isNaN(date)) return Duration_exports.seconds(5);
872
+ return Duration_exports.millis(Math.max(date - (yield* Clock_exports.currentTimeMillis), 1));
873
+ });
874
+ var retryTelemetryExport = (client) => client.pipe(
875
+ HttpClient_exports.retryTransient({
876
+ times: 3,
877
+ schedule: Schedule_exports.forever.pipe(
878
+ Schedule_exports.passthrough,
879
+ Schedule_exports.addDelay(({ output }) => retryDelay(output))
880
+ )
881
+ })
882
+ );
883
+
884
+ // ../telemetry/src/recorded-failure.ts
885
+ var recordedError = (error) => {
886
+ const message = recordedMessage(error);
887
+ if (message === void 0 || !(error instanceof Error)) return error;
888
+ const recorded = new Error(message);
889
+ recorded.name = error.name;
890
+ recorded.stack = `${error.name}: ${message}`;
891
+ return recorded;
892
+ };
893
+ var recordedCause = (cause) => Cause_exports.fromReasons(
894
+ Cause_exports.map(cause, recordedError).reasons.flatMap(
895
+ (reason) => Cause_exports.isDieReason(reason) && recordedMessage(reason.defect) !== void 0 ? Cause_exports.annotate(Cause_exports.die(recordedError(reason.defect)), Cause_exports.reasonAnnotations(reason)).reasons : [reason]
896
+ )
897
+ );
854
898
 
855
899
  // ../telemetry/src/span-attributes.ts
856
900
  var LogicalOperationFailed = class extends Schema_exports.TaggedError()(
@@ -878,7 +922,7 @@ var spanAttributeAllowed = (key) => {
878
922
  const name = key.toLowerCase();
879
923
  return !httpNamespaces.some((namespace) => name.startsWith(namespace)) || httpSpanAttributeAllowlist.has(name);
880
924
  };
881
- var allowedEntries = (attributes) => Object.fromEntries(Object.entries(attributes).filter(([key]) => spanAttributeAllowed(key)));
925
+ var allowedEntries = (attributes2) => Object.fromEntries(Object.entries(attributes2).filter(([key]) => spanAttributeAllowed(key)));
882
926
  var allowlistedSpan = (span) => ({
883
927
  _tag: "Span",
884
928
  get name() {
@@ -913,14 +957,15 @@ var allowlistedSpan = (span) => ({
913
957
  },
914
958
  // A successful transport can carry a failed domain operation. The producer
915
959
  // explicitly marks that outcome; arbitrary result payloads are never inspected.
960
+ // A failure records the fixed message an error declares in place of an app's text.
916
961
  end: (endTime, exit) => span.end(
917
962
  endTime,
918
- Exit_exports.isSuccess(exit) && span.attributes.get("executor.outcome") === "failed" ? Exit_exports.fail(new LogicalOperationFailed()) : exit
963
+ Exit_exports.isSuccess(exit) ? span.attributes.get("executor.outcome") === "failed" ? Exit_exports.fail(new LogicalOperationFailed()) : exit : Exit_exports.failCause(recordedCause(exit.cause))
919
964
  ),
920
965
  attribute: (key, value) => {
921
966
  if (spanAttributeAllowed(key)) span.attribute(key, value);
922
967
  },
923
- event: (name, startTime, attributes) => span.event(name, startTime, attributes === void 0 ? void 0 : allowedEntries(attributes)),
968
+ event: (name, startTime, attributes2) => span.event(name, startTime, attributes2 === void 0 ? void 0 : allowedEntries(attributes2)),
924
969
  addLinks: (links) => span.addLinks(links)
925
970
  });
926
971
  var spanAttributes = (clock, recordAll = false) => Layer_exports.effect(Tracer_exports.Tracer)(
@@ -941,7 +986,7 @@ var spanAttributes = (clock, recordAll = false) => Layer_exports.effect(Tracer_e
941
986
  );
942
987
  var allowlistedSpans = spanAttributes();
943
988
 
944
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/OtlpLogger.js
989
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpLogger.js
945
990
  var OtlpLogger_exports = {};
946
991
  __export(OtlpLogger_exports, {
947
992
  layer: () => layer2,
@@ -949,7 +994,7 @@ __export(OtlpLogger_exports, {
949
994
  make: () => make6
950
995
  });
951
996
 
952
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/internal/otlpEnv.js
997
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/internal/otlpEnv.js
953
998
  var exporterList = (path) => Array2(String2, path).pipe(map3((_) => _.map((_2) => _2.toLowerCase().trim()).filter((_2) => _2 !== "")));
954
999
  var headersRecord = (path) => Record(String2, StringFromUriComponent, path);
955
1000
  var headers = (signal) => headersRecord(`OTEL_EXPORTER_OTLP_${signal}_HEADERS`).pipe(orElse(() => headersRecord("OTEL_EXPORTER_OTLP_HEADERS")), withDefault(void 0));
@@ -960,7 +1005,7 @@ var endpoint = (signal) => URL2(`OTEL_EXPORTER_OTLP_${signal}_ENDPOINT`).pipe(or
960
1005
  }))), withDefault(void 0));
961
1006
  var exporters = (signal) => exporterList(`OTEL_${signal}_EXPORTER`).pipe(withDefault([]));
962
1007
 
963
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/OtlpExporter.js
1008
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpExporter.js
964
1009
  var OtlpExporter_exports = {};
965
1010
  __export(OtlpExporter_exports, {
966
1011
  Flusher: () => Flusher,
@@ -1015,7 +1060,7 @@ var make4 = /* @__PURE__ */ fnUntraced(function* (options) {
1015
1060
  const scope = get(services, Scope);
1016
1061
  const exportInterval = max(fromInputUnsafe(options.exportInterval), zero);
1017
1062
  let disabledUntil = void 0;
1018
- const client = filterStatusOk(get(services, HttpClient)).pipe(transformResponse(provideService(TracerPropagationEnabled, false)), retryTransient({
1063
+ 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
1064
  schedule: policy,
1020
1065
  times: 3
1021
1066
  }));
@@ -1072,7 +1117,7 @@ var make4 = /* @__PURE__ */ fnUntraced(function* (options) {
1072
1117
  };
1073
1118
  });
1074
1119
 
1075
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/OtlpResource.js
1120
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpResource.js
1076
1121
  var make5 = (options) => {
1077
1122
  const resourceAttributes = options.attributes ? entriesToAttributes(Object.entries(options.attributes)) : [];
1078
1123
  resourceAttributes.push({
@@ -1098,16 +1143,16 @@ var fromConfig = /* @__PURE__ */ fnUntraced(function* (options) {
1098
1143
  const env = yield* Record(StringFromUriComponent, StringFromUriComponent, "OTEL_RESOURCE_ATTRIBUTES").pipe(withDefault(void 0));
1099
1144
  const serviceName = options?.serviceName ?? options?.attributes?.["service.name"] ?? (yield* schema(UndefinedOr(String2), "OTEL_SERVICE_NAME")) ?? env?.["service.name"] ?? (yield* String3("OTEL_SERVICE_NAME"));
1100
1145
  const serviceVersion = options?.serviceVersion ?? options?.attributes?.["service.version"] ?? (yield* schema(UndefinedOr(String2), "OTEL_SERVICE_VERSION")) ?? env?.["service.version"];
1101
- const attributes = {
1146
+ const attributes2 = {
1102
1147
  ...env,
1103
1148
  ...options?.attributes
1104
1149
  };
1105
- delete attributes["service.name"];
1106
- delete attributes["service.version"];
1150
+ delete attributes2["service.name"];
1151
+ delete attributes2["service.version"];
1107
1152
  return make5({
1108
1153
  serviceName,
1109
1154
  serviceVersion,
1110
- attributes
1155
+ attributes: attributes2
1111
1156
  });
1112
1157
  }, orDie);
1113
1158
  var serviceNameUnsafe = (resource) => {
@@ -1118,14 +1163,14 @@ var serviceNameUnsafe = (resource) => {
1118
1163
  return serviceNameAttribute.value.stringValue;
1119
1164
  };
1120
1165
  var entriesToAttributes = (entries) => {
1121
- const attributes = [];
1166
+ const attributes2 = [];
1122
1167
  for (const [key, value] of entries) {
1123
- attributes.push({
1168
+ attributes2.push({
1124
1169
  key,
1125
1170
  value: unknownToAttributeValue(value)
1126
1171
  });
1127
1172
  }
1128
- return attributes;
1173
+ return attributes2;
1129
1174
  };
1130
1175
  var unknownToAttributeValue = (value) => {
1131
1176
  if (Array.isArray(value)) {
@@ -1161,7 +1206,7 @@ var unknownToAttributeValue = (value) => {
1161
1206
  }
1162
1207
  };
1163
1208
 
1164
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/OtlpSerialization.js
1209
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpSerialization.js
1165
1210
  var OtlpSerialization_exports = {};
1166
1211
  __export(OtlpSerialization_exports, {
1167
1212
  OtlpSerialization: () => OtlpSerialization,
@@ -1169,7 +1214,7 @@ __export(OtlpSerialization_exports, {
1169
1214
  layerProtobuf: () => layerProtobuf
1170
1215
  });
1171
1216
 
1172
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/internal/protobuf.js
1217
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/internal/protobuf.js
1173
1218
  var WireType2 = {
1174
1219
  Varint: 0,
1175
1220
  Fixed64: 1,
@@ -1238,7 +1283,7 @@ var messageField = (fieldNumber, message) => lengthDelimitedField(fieldNumber, m
1238
1283
  var repeatedField = (fieldNumber, values, encode) => concat(...values.map((v) => messageField(fieldNumber, encode(v))));
1239
1284
  var optionalStringField = (fieldNumber, value) => value !== void 0 && value !== "" ? stringField(fieldNumber, value) : new Uint8Array(0);
1240
1285
 
1241
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/internal/otlpProtobuf.js
1286
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/internal/otlpProtobuf.js
1242
1287
  var encodeAnyValue = (value) => {
1243
1288
  if (value.stringValue !== void 0 && value.stringValue !== null) {
1244
1289
  return stringField(1, value.stringValue);
@@ -1268,7 +1313,7 @@ var encodeKeyValueList = (value) => repeatedField(1, value.values, encodeKeyValu
1268
1313
  var encodeKeyValue = (kv) => concat(stringField(1, kv.key), messageField(2, encodeAnyValue(kv.value)));
1269
1314
  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
1315
  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));
1316
+ var encodeStatus = (status2) => concat(optionalStringField(2, status2.message), varintField(3, status2.code));
1272
1317
  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
1318
  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
1319
  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 +1322,7 @@ var encodeResourceSpans = (resourceSpans) => concat(messageField(1, encodeResour
1277
1322
  var encodeTracesData = (tracesData) => repeatedField(1, tracesData.resourceSpans, encodeResourceSpans);
1278
1323
  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
1324
  var encodeHistogramDataPoint = (point) => {
1280
- const bucketCountsEncoded = concat(...point.bucketCounts.map((count) => fixed64Field(6, BigInt(count))));
1325
+ const bucketCountsEncoded = concat(...point.bucketCounts.map((count2) => fixed64Field(6, BigInt(count2))));
1281
1326
  const explicitBoundsEncoded = concat(...point.explicitBounds.map((bound) => doubleField(7, bound)));
1282
1327
  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
1328
  };
@@ -1293,7 +1338,7 @@ var encodeScopeLogs = (scopeLogs) => concat(messageField(1, encodeInstrumentatio
1293
1338
  var encodeResourceLogs = (resourceLogs) => concat(messageField(1, encodeResource(resourceLogs.resource)), repeatedField(2, resourceLogs.scopeLogs, encodeScopeLogs), optionalStringField(3, resourceLogs.schemaUrl));
1294
1339
  var encodeLogsData = (logsData) => repeatedField(1, logsData.resourceLogs, encodeResourceLogs);
1295
1340
 
1296
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/OtlpSerialization.js
1341
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpSerialization.js
1297
1342
  var OtlpSerialization = class extends (/* @__PURE__ */ Service()("effect/observability/OtlpSerialization")) {
1298
1343
  };
1299
1344
  var layerJson = /* @__PURE__ */ succeed(OtlpSerialization, {
@@ -1307,7 +1352,7 @@ var layerProtobuf = /* @__PURE__ */ succeed(OtlpSerialization, {
1307
1352
  logs: (logs) => uint8Array(encodeLogsData(logs), "application/x-protobuf")
1308
1353
  });
1309
1354
 
1310
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/OtlpLogger.js
1355
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpLogger.js
1311
1356
  var make6 = /* @__PURE__ */ fnUntraced(function* (options) {
1312
1357
  const serialization = yield* OtlpSerialization;
1313
1358
  const otelResource = yield* fromConfig(options.resource);
@@ -1385,8 +1430,8 @@ var makeLogRecord = (options, opts) => {
1385
1430
  const now = opts.clock.currentTimeNanosUnsafe();
1386
1431
  const nanosString = now.toString();
1387
1432
  const nowMillis = options.date.getTime();
1388
- const attributes = entriesToAttributes(Object.entries(options.fiber.getRef(CurrentLogAnnotations)));
1389
- attributes.push({
1433
+ const attributes2 = entriesToAttributes(Object.entries(options.fiber.getRef(CurrentLogAnnotations)));
1434
+ attributes2.push({
1390
1435
  key: "fiberId",
1391
1436
  value: {
1392
1437
  intValue: options.fiber.id
@@ -1394,7 +1439,7 @@ var makeLogRecord = (options, opts) => {
1394
1439
  });
1395
1440
  if (!opts.excludeLogSpans) {
1396
1441
  for (const [label, startTime] of options.fiber.getRef(CurrentLogSpans)) {
1397
- attributes.push({
1442
+ attributes2.push({
1398
1443
  key: `logSpan.${label}`,
1399
1444
  value: {
1400
1445
  stringValue: `${nowMillis - startTime}ms`
@@ -1403,7 +1448,7 @@ var makeLogRecord = (options, opts) => {
1403
1448
  }
1404
1449
  }
1405
1450
  if (options.cause.reasons.length > 0) {
1406
- attributes.push({
1451
+ attributes2.push({
1407
1452
  key: "log.error",
1408
1453
  value: {
1409
1454
  stringValue: pretty(options.cause)
@@ -1416,7 +1461,7 @@ var makeLogRecord = (options, opts) => {
1416
1461
  severityText: options.logLevel,
1417
1462
  timeUnixNano: nanosString,
1418
1463
  observedTimeUnixNano: nanosString,
1419
- attributes,
1464
+ attributes: attributes2,
1420
1465
  body: unknownToAttributeValue(message.length === 1 ? message[0] : message),
1421
1466
  droppedAttributesCount: 0
1422
1467
  };
@@ -1473,7 +1518,7 @@ var ESeverityNumber = {
1473
1518
  SEVERITY_NUMBER_FATAL4: 24
1474
1519
  };
1475
1520
 
1476
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/OtlpMetrics.js
1521
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpMetrics.js
1477
1522
  var OtlpMetrics_exports = {};
1478
1523
  __export(OtlpMetrics_exports, {
1479
1524
  layer: () => layer3,
@@ -1519,7 +1564,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
1519
1564
  for (let i = 0, len = snapshot2.length; i < len; i++) {
1520
1565
  const state = snapshot2[i];
1521
1566
  const unit = state.attributes?.unit ?? state.attributes?.time_unit ?? "1";
1522
- const attributes = state.attributes ? entriesToAttributes(Object.entries(state.attributes)) : [];
1567
+ const attributes2 = state.attributes ? entriesToAttributes(Object.entries(state.attributes)) : [];
1523
1568
  const metricKey = makeMetricKey(state.id, state.attributes);
1524
1569
  switch (state.type) {
1525
1570
  case "Counter": {
@@ -1545,7 +1590,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
1545
1590
  nextCounterState.set(metricKey, currentCount);
1546
1591
  }
1547
1592
  const dataPoint = {
1548
- attributes,
1593
+ attributes: attributes2,
1549
1594
  startTimeUnixNano: intervalStartTime,
1550
1595
  timeUnixNano: nowTime
1551
1596
  };
@@ -1572,7 +1617,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
1572
1617
  }
1573
1618
  case "Gauge": {
1574
1619
  const dataPoint = {
1575
- attributes,
1620
+ attributes: attributes2,
1576
1621
  startTimeUnixNano: startTime,
1577
1622
  timeUnixNano: nowTime
1578
1623
  };
@@ -1632,7 +1677,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
1632
1677
  });
1633
1678
  }
1634
1679
  const dataPoint = {
1635
- attributes,
1680
+ attributes: attributes2,
1636
1681
  startTimeUnixNano: intervalStartTime,
1637
1682
  timeUnixNano: nowTime,
1638
1683
  count: reportCount,
@@ -1671,7 +1716,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
1671
1716
  }
1672
1717
  }
1673
1718
  dataPoints.push({
1674
- attributes: [...attributes, {
1719
+ attributes: [...attributes2, {
1675
1720
  key: "key",
1676
1721
  value: {
1677
1722
  stringValue: freqKey
@@ -1703,7 +1748,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
1703
1748
  }
1704
1749
  case "Summary": {
1705
1750
  const dataPoints = [{
1706
- attributes: [...attributes, {
1751
+ attributes: [...attributes2, {
1707
1752
  key: "quantile",
1708
1753
  value: {
1709
1754
  stringValue: "min"
@@ -1715,7 +1760,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
1715
1760
  }];
1716
1761
  for (const [quantile, value] of state.state.quantiles) {
1717
1762
  dataPoints.push({
1718
- attributes: [...attributes, {
1763
+ attributes: [...attributes2, {
1719
1764
  key: "quantile",
1720
1765
  value: {
1721
1766
  stringValue: quantile.toString()
@@ -1727,7 +1772,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
1727
1772
  });
1728
1773
  }
1729
1774
  dataPoints.push({
1730
- attributes: [...attributes, {
1775
+ attributes: [...attributes2, {
1731
1776
  key: "quantile",
1732
1777
  value: {
1733
1778
  stringValue: "max"
@@ -1751,13 +1796,13 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
1751
1796
  });
1752
1797
  }
1753
1798
  const countDataPoint = {
1754
- attributes,
1799
+ attributes: attributes2,
1755
1800
  startTimeUnixNano: intervalStartTime,
1756
1801
  timeUnixNano: nowTime,
1757
1802
  asInt: reportCount
1758
1803
  };
1759
1804
  const sumDataPoint = {
1760
- attributes,
1805
+ attributes: attributes2,
1761
1806
  startTimeUnixNano: intervalStartTime,
1762
1807
  timeUnixNano: nowTime,
1763
1808
  asDouble: reportSum
@@ -1870,11 +1915,11 @@ var layerFromConfig2 = (options) => gen(function* () {
1870
1915
  temporality: getOrUndefined(temporalityPreference)
1871
1916
  });
1872
1917
  }).pipe(orDie, unwrap);
1873
- var makeMetricKey = (id, attributes) => {
1874
- if (attributes === void 0 || Object.keys(attributes).length === 0) {
1918
+ var makeMetricKey = (id, attributes2) => {
1919
+ if (attributes2 === void 0 || Object.keys(attributes2).length === 0) {
1875
1920
  return id;
1876
1921
  }
1877
- const sortedEntries = Object.entries(attributes).sort((a, b) => a[0].localeCompare(b[0]));
1922
+ const sortedEntries = Object.entries(attributes2).sort((a, b) => a[0].localeCompare(b[0]));
1878
1923
  return `${id}:${JSON.stringify(sortedEntries)}`;
1879
1924
  };
1880
1925
  var EAggregationTemporality = {
@@ -1936,7 +1981,7 @@ var EAggregationTemporality = {
1936
1981
  AGGREGATION_TEMPORALITY_CUMULATIVE: 2
1937
1982
  };
1938
1983
 
1939
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/observability/OtlpTracer.js
1984
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpTracer.js
1940
1985
  var OtlpTracer_exports = {};
1941
1986
  __export(OtlpTracer_exports, {
1942
1987
  layer: () => layer4,
@@ -2051,10 +2096,10 @@ var SpanImpl = class {
2051
2096
  };
2052
2097
  }
2053
2098
  get traceId() {
2054
- return this._traceId ??= isSome(this.parent) ? this.parent.value.traceId : randomHex(32);
2099
+ return this._traceId ??= isSome(this.parent) ? this.parent.value.traceId : random(32);
2055
2100
  }
2056
2101
  get spanId() {
2057
- return this._spanId ??= randomHex(16);
2102
+ return this._spanId ??= random(16);
2058
2103
  }
2059
2104
  get attributes() {
2060
2105
  return this._attributes ??= /* @__PURE__ */ new Map();
@@ -2074,39 +2119,39 @@ var SpanImpl = class {
2074
2119
  attribute(key, value) {
2075
2120
  this.attributes.set(key, value);
2076
2121
  }
2077
- event(name, startTime, attributes) {
2078
- this.events.push([name, startTime, attributes]);
2122
+ event(name, startTime, attributes2) {
2123
+ this.events.push([name, startTime, attributes2]);
2079
2124
  }
2080
2125
  addLinks(links) {
2081
2126
  this.links.push(...links);
2082
2127
  }
2083
2128
  };
2084
2129
  var makeOtlpSpan = (self) => {
2085
- const status = self.status;
2086
- const attributes = self._attributes === void 0 ? [] : entriesToAttributes(self._attributes);
2130
+ const status2 = self.status;
2131
+ const attributes2 = self._attributes === void 0 ? [] : entriesToAttributes(self._attributes);
2087
2132
  const events = [];
2088
2133
  if (self._events !== void 0) {
2089
2134
  for (let i = 0; i < self._events.length; i++) {
2090
- const [name, startTime, attributes2] = self._events[i];
2135
+ const [name, startTime, attributes3] = self._events[i];
2091
2136
  events.push({
2092
2137
  name,
2093
2138
  timeUnixNano: String(startTime),
2094
- attributes: attributes2 ? entriesToAttributes(Object.entries(attributes2)) : [],
2139
+ attributes: attributes3 ? entriesToAttributes(Object.entries(attributes3)) : [],
2095
2140
  droppedAttributesCount: 0
2096
2141
  });
2097
2142
  }
2098
2143
  }
2099
2144
  let otelStatus;
2100
- if (status.exit._tag === "Success") {
2145
+ if (status2.exit._tag === "Success") {
2101
2146
  otelStatus = {
2102
2147
  code: StatusCode.Ok
2103
2148
  };
2104
- } else if (hasInterruptsOnly(status.exit.cause)) {
2149
+ } else if (hasInterruptsOnly(status2.exit.cause)) {
2105
2150
  otelStatus = {
2106
2151
  code: StatusCode.Ok,
2107
2152
  message: "Interrupted"
2108
2153
  };
2109
- attributes.push({
2154
+ attributes2.push({
2110
2155
  key: "span.label",
2111
2156
  value: {
2112
2157
  stringValue: "\u26A0\uFE0E Interrupted"
@@ -2118,7 +2163,7 @@ var makeOtlpSpan = (self) => {
2118
2163
  }
2119
2164
  });
2120
2165
  } else {
2121
- const errors = prettyErrors(status.exit.cause, {
2166
+ const errors = prettyErrors(status2.exit.cause, {
2122
2167
  includeCauseInStack: true
2123
2168
  });
2124
2169
  otelStatus = {
@@ -2129,7 +2174,7 @@ var makeOtlpSpan = (self) => {
2129
2174
  for (const error of errors) {
2130
2175
  events.push({
2131
2176
  name: "exception",
2132
- timeUnixNano: String(status.endTime),
2177
+ timeUnixNano: String(status2.endTime),
2133
2178
  droppedAttributesCount: 0,
2134
2179
  attributes: [{
2135
2180
  "key": "exception.type",
@@ -2167,9 +2212,9 @@ var makeOtlpSpan = (self) => {
2167
2212
  parentSpanId: isSome(self.parent) ? self.parent.value.spanId : void 0,
2168
2213
  name: self.name,
2169
2214
  kind: SpanKind[self.kind],
2170
- startTimeUnixNano: String(status.startTime),
2171
- endTimeUnixNano: String(status.endTime),
2172
- attributes,
2215
+ startTimeUnixNano: String(status2.startTime),
2216
+ endTimeUnixNano: String(status2.endTime),
2217
+ attributes: attributes2,
2173
2218
  droppedAttributesCount: 0,
2174
2219
  events,
2175
2220
  droppedEventsCount: 0,
@@ -2245,6 +2290,311 @@ var telemetryLayer = (config, lifetime = "process", logger = Logger_exports.with
2245
2290
  );
2246
2291
  };
2247
2292
 
2293
+ // ../telemetry/src/app-records.ts
2294
+ var appText = "Text from the app is not recorded";
2295
+ var unrecognized = "unrecognized";
2296
+ var operations = [
2297
+ "requirements",
2298
+ "inspect",
2299
+ "skills",
2300
+ "query",
2301
+ "mutate",
2302
+ "call",
2303
+ "account-check",
2304
+ "webhooks",
2305
+ "webhook-validate",
2306
+ "webhook-complete",
2307
+ "webhook-register",
2308
+ "webhook-unregister",
2309
+ "webhook-handle",
2310
+ "workflows",
2311
+ "workflow-validate",
2312
+ "workflow-run",
2313
+ "migrate"
2314
+ ];
2315
+ var httpMethods = [
2316
+ "GET",
2317
+ "HEAD",
2318
+ "POST",
2319
+ "PUT",
2320
+ "PATCH",
2321
+ "DELETE",
2322
+ "OPTIONS",
2323
+ "TRACE",
2324
+ "CONNECT"
2325
+ ];
2326
+ var appSpanNames = /* @__PURE__ */ new Set([
2327
+ "app.dispatch",
2328
+ ...operations.map((operation) => `app.${operation}`),
2329
+ "app.evaluate",
2330
+ "app.accounts.bind",
2331
+ "app.account.check",
2332
+ "app.catalog.read",
2333
+ "app.skills.load",
2334
+ "app.skills.routers",
2335
+ "app.tool.approval",
2336
+ "app.tool.elicitation",
2337
+ "app.operation.execute",
2338
+ "app.sql.migrate",
2339
+ "app.cache.get",
2340
+ "app.cache.load",
2341
+ "app.cache.command",
2342
+ "app.cache.publish",
2343
+ "app.cache.flush",
2344
+ "app.cache.lease.renew",
2345
+ "provider.http.request",
2346
+ "provider.http.response.read",
2347
+ "provider.openapi.call",
2348
+ "provider.graphql.request",
2349
+ "provider.graphql.call",
2350
+ "provider.mcp.session",
2351
+ "provider.mcp.connect",
2352
+ "provider.mcp.close",
2353
+ "provider.mcp.request",
2354
+ "provider.mcp.call",
2355
+ "provider.mcp.discover",
2356
+ "provider.mcp.check",
2357
+ "provider.mcp.health",
2358
+ "provider.mcp.anonymous",
2359
+ "provider.mcp.elicitation",
2360
+ "sql.execute",
2361
+ ...httpMethods.map((method) => `http.client ${method}`)
2362
+ ]);
2363
+ var errorKinds = /* @__PURE__ */ new Set([
2364
+ "HostRequestInvalid",
2365
+ "HostAccountsInvalid",
2366
+ "HostDeclarationInvalid",
2367
+ "HostEvaluationFailed",
2368
+ "HostOperationNotFound",
2369
+ "HostOperationFailed",
2370
+ "HostKindMismatch",
2371
+ "HostToolNotFound",
2372
+ "HostInputInvalid",
2373
+ "HostOutputInvalid",
2374
+ "HostToolBlocked",
2375
+ "HostToolApprovalRequired",
2376
+ "HostToolPolicyFailed",
2377
+ "ElicitationFailed",
2378
+ "DatabaseLimitExceeded",
2379
+ "DatabaseFieldReserved",
2380
+ "SkillLoadFailed",
2381
+ "WorkflowFailure",
2382
+ "ProviderError",
2383
+ "OpenapiResponseError",
2384
+ "OpenapiError",
2385
+ "OpenapiCompileError",
2386
+ "GraphqlError",
2387
+ "McpError",
2388
+ "McpToolError",
2389
+ "McpCredentialsUnverified",
2390
+ "CacheError",
2391
+ "AppDatabaseError",
2392
+ "AppStorageError",
2393
+ "AppStorageUnavailable",
2394
+ "NetworkRefused",
2395
+ "FetchOptionUnsupported",
2396
+ "LogicalOperationFailed",
2397
+ "HttpClientError",
2398
+ "SchemaError",
2399
+ "TimeoutError",
2400
+ "UnknownError",
2401
+ "InterruptError",
2402
+ "Error",
2403
+ "TypeError",
2404
+ "RangeError",
2405
+ "ReferenceError",
2406
+ "SyntaxError",
2407
+ "EvalError",
2408
+ "URIError",
2409
+ "AggregateError",
2410
+ "AbortError",
2411
+ "string",
2412
+ "number",
2413
+ "bigint",
2414
+ "boolean",
2415
+ "symbol",
2416
+ "undefined",
2417
+ "object",
2418
+ "function"
2419
+ ]);
2420
+ var failureCodes = /* @__PURE__ */ new Set([
2421
+ // CacheError
2422
+ "unavailable",
2423
+ "storage",
2424
+ "invalid",
2425
+ "capacity",
2426
+ "timeout",
2427
+ // AppDatabaseError
2428
+ "schema",
2429
+ "schema_changed",
2430
+ "table",
2431
+ "index",
2432
+ "range",
2433
+ "value",
2434
+ "readonly",
2435
+ "cursor",
2436
+ "limit",
2437
+ "closed",
2438
+ "replay",
2439
+ // OpenapiError
2440
+ "invalid_definition",
2441
+ "invalid_input",
2442
+ "request",
2443
+ // McpError, McpCredentialsUnverified and ProviderError
2444
+ "unauthorized",
2445
+ "invalid_response",
2446
+ "forbidden",
2447
+ "rate_limited",
2448
+ "rejected",
2449
+ "anonymous_access",
2450
+ // NetworkRefused and FetchOptionUnsupported
2451
+ "private_address",
2452
+ "credential_host",
2453
+ "credential_app",
2454
+ "credential_expired",
2455
+ "redirect",
2456
+ "cache",
2457
+ "integrity"
2458
+ ]);
2459
+ var text = (value) => typeof value["stringValue"] === "string" ? value["stringValue"] : void 0;
2460
+ var integer = (value) => {
2461
+ const raw = value["intValue"];
2462
+ const number = typeof raw === "string" && /^-?\d{1,15}$/.test(raw) ? Number(raw) : raw;
2463
+ return typeof number === "number" && Number.isSafeInteger(number) ? number : void 0;
2464
+ };
2465
+ var oneOf = (...values) => (value) => {
2466
+ const found = text(value);
2467
+ return found !== void 0 && values.includes(found) ? { stringValue: found } : void 0;
2468
+ };
2469
+ var classified = (known) => (value) => {
2470
+ const found = text(value);
2471
+ return found === void 0 ? void 0 : { stringValue: known.has(found) ? found : unrecognized };
2472
+ };
2473
+ var flag = (value) => typeof value["boolValue"] === "boolean" ? { boolValue: value["boolValue"] } : void 0;
2474
+ var count = (value) => {
2475
+ const found = integer(value);
2476
+ return found !== void 0 && found >= 0 ? { intValue: found } : void 0;
2477
+ };
2478
+ var status = (value) => {
2479
+ const found = integer(value);
2480
+ return found !== void 0 && found >= 100 && found <= 599 ? { intValue: found } : void 0;
2481
+ };
2482
+ var spanAttributes2 = {
2483
+ "executor.operation": oneOf(...operations, "mutation", "discover"),
2484
+ "executor.outcome": oneOf("failed"),
2485
+ "executor.clock.type": oneOf("system", "cloudflare-io"),
2486
+ "executor.trace.parent_sampled": flag,
2487
+ "executor.failure.source": oneOf("app", "storage", "service"),
2488
+ "executor.failure.code": classified(failureCodes),
2489
+ "error.type": classified(errorKinds),
2490
+ "cache.operation": oneOf(
2491
+ "read",
2492
+ "acquire",
2493
+ "claim",
2494
+ "publish",
2495
+ "release",
2496
+ "renew",
2497
+ "write",
2498
+ "invalidate"
2499
+ ),
2500
+ "cache.result": oneOf("fresh", "stale", "miss", "local"),
2501
+ "cache.load.leased": flag,
2502
+ "cache.flush.index": count,
2503
+ "cache.flush.count": count,
2504
+ "cache.flush.entries": count,
2505
+ "cache.flush.bytes": count,
2506
+ "cache.leases": count,
2507
+ "mcp.transport": oneOf("http", "sse", "stdio"),
2508
+ "mcp.operation": oneOf("discover", "call", "check", "health"),
2509
+ "mcp.tool.is_error": flag,
2510
+ "rpc.system.name": oneOf("jsonrpc"),
2511
+ "rpc.method": oneOf("initialize", "tools/list", "tools/call", "ping"),
2512
+ "graphql.operation.type": oneOf("query", "mutation", "subscription"),
2513
+ "db.system.name": oneOf("sqlite"),
2514
+ "db.operation.name": oneOf("execute"),
2515
+ "http.request.method": oneOf(...httpMethods),
2516
+ "http.response.status_code": status,
2517
+ "url.scheme": oneOf("http", "https"),
2518
+ "span.label": oneOf("\u26A0\uFE0E Interrupted"),
2519
+ "status.interrupted": flag,
2520
+ "executor.milestone.reached": flag
2521
+ };
2522
+ var appSpanAttributeKeys = new Set(Object.keys(spanAttributes2));
2523
+ var logMessages = /* @__PURE__ */ new Set([
2524
+ "The app's request failed unexpectedly",
2525
+ "App cache refresh failed",
2526
+ "MCP catalog invalidation failed",
2527
+ "Telemetry export failed"
2528
+ ]);
2529
+ var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
2530
+ var spanId = (value) => typeof value === "string" && /^[a-f0-9]{16}$/.test(value) ? value : void 0;
2531
+ var nanos = (value) => typeof value === "string" && /^\d{1,20}$/.test(value) ? value : void 0;
2532
+ var between = (value, minimum, maximum) => typeof value === "number" && Number.isInteger(value) && value >= minimum && value <= maximum ? value : void 0;
2533
+ var attributes = (from) => (Array.isArray(from) ? from : []).flatMap((attribute) => {
2534
+ if (!isObject(attribute) || typeof attribute["key"] !== "string") return [];
2535
+ const key = attribute["key"];
2536
+ const keep = Object.hasOwn(spanAttributes2, key) ? spanAttributes2[key] : void 0;
2537
+ const value = attribute["value"];
2538
+ const kept = keep === void 0 || !isObject(value) ? void 0 : keep(value);
2539
+ return kept === void 0 ? [] : [{ key, value: kept }];
2540
+ });
2541
+ var exception = (event) => {
2542
+ const named = (Array.isArray(event["attributes"]) ? event["attributes"] : []).find(
2543
+ (attribute) => isObject(attribute) && attribute["key"] === "exception.type"
2544
+ );
2545
+ const type = isObject(named) && isObject(named["value"]) ? text(named["value"]) : void 0;
2546
+ const recorded = type !== void 0 && errorKinds.has(type) ? type : unrecognized;
2547
+ const time = nanos(event["timeUnixNano"]);
2548
+ return {
2549
+ name: "exception",
2550
+ ...time === void 0 ? {} : { timeUnixNano: time },
2551
+ attributes: [
2552
+ { key: "exception.type", value: { stringValue: recorded } },
2553
+ { key: "exception.message", value: { stringValue: appText } },
2554
+ { key: "exception.stacktrace", value: { stringValue: `${recorded}: ${appText}` } }
2555
+ ]
2556
+ };
2557
+ };
2558
+ var appSpan = (span) => {
2559
+ const start = nanos(span["startTimeUnixNano"]);
2560
+ const end = nanos(span["endTimeUnixNano"]);
2561
+ if (start === void 0 || end === void 0) return void 0;
2562
+ const parent = spanId(span["parentSpanId"]);
2563
+ const kind = between(span["kind"], 0, 5);
2564
+ const code = isObject(span["status"]) ? between(span["status"]["code"], 0, 2) : void 0;
2565
+ const name = typeof span["name"] === "string" && appSpanNames.has(span["name"]) ? span["name"] : "app.unrecognized";
2566
+ return {
2567
+ traceId: span.traceId,
2568
+ spanId: span.spanId,
2569
+ ...parent === void 0 ? {} : { parentSpanId: parent },
2570
+ name,
2571
+ ...kind === void 0 ? {} : { kind },
2572
+ startTimeUnixNano: start,
2573
+ endTimeUnixNano: end,
2574
+ attributes: attributes(span["attributes"]),
2575
+ events: (Array.isArray(span["events"]) ? span["events"] : []).flatMap(
2576
+ (event) => isObject(event) && event["name"] === "exception" ? [exception(event)] : []
2577
+ ),
2578
+ ...code === void 0 ? {} : { status: { code } }
2579
+ };
2580
+ };
2581
+ var appLog = (log) => {
2582
+ const time = nanos(log["timeUnixNano"]);
2583
+ const observed = nanos(log["observedTimeUnixNano"]);
2584
+ const severity = between(log["severityNumber"], 1, 24);
2585
+ const level = log["severityText"];
2586
+ const body = isObject(log["body"]) ? text(log["body"]) : void 0;
2587
+ return {
2588
+ ...log.traceId === void 0 ? {} : { traceId: log.traceId },
2589
+ ...log.spanId === void 0 ? {} : { spanId: log.spanId },
2590
+ ...time === void 0 ? {} : { timeUnixNano: time },
2591
+ ...observed === void 0 ? {} : { observedTimeUnixNano: observed },
2592
+ ...severity === void 0 ? {} : { severityNumber: severity },
2593
+ ...typeof level === "string" && ["Trace", "Debug", "Info", "Warn", "Error", "Fatal"].includes(level) ? { severityText: level } : {},
2594
+ body: { stringValue: body !== void 0 && logMessages.has(body) ? body : appText }
2595
+ };
2596
+ };
2597
+
2248
2598
  // ../telemetry/src/relay.ts
2249
2599
  var makeTelemetryForwarder = Effect_exports.gen(function* () {
2250
2600
  const fibers = yield* FiberSet_exports.make();
@@ -2360,8 +2710,8 @@ var recordPacker = (prefix, suffix) => {
2360
2710
  }
2361
2711
  };
2362
2712
  };
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}$/));
2713
+ var HexTrace = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{32}$/u));
2714
+ var HexSpan = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{16}$/u));
2365
2715
  var Span = Schema_exports.StructWithRest(Schema_exports.Struct({ traceId: HexTrace, spanId: HexSpan }), [
2366
2716
  Schema_exports.Record(Schema_exports.String, Schema_exports.Json)
2367
2717
  ]);
@@ -2402,7 +2752,7 @@ var forwardTelemetry = (batch, traceId, build, service = "executor-app") => Effe
2402
2752
  ...build === void 0 ? [] : [{ key: "executor.build.id", value: { stringValue: build } }]
2403
2753
  ]
2404
2754
  };
2405
- const client = yield* HttpClient_exports.HttpClient;
2755
+ const client = retryTelemetryExport(yield* HttpClient_exports.HttpClient);
2406
2756
  if (batch.dropped > 0) yield* recordExportFailure("app", "capacity", batch.dropped);
2407
2757
  for (const signal of ["traces", "logs"]) {
2408
2758
  const target = config[signal];
@@ -2418,7 +2768,11 @@ var forwardTelemetry = (batch, traceId, build, service = "executor-app") => Effe
2418
2768
  scopeSpans: [
2419
2769
  {
2420
2770
  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)
2771
+ spans: payloads.flatMap((payload) => payload.resourceSpans).flatMap((r) => r.scopeSpans.flatMap((s) => s.spans)).filter((span) => traceId === void 0 || span.traceId === traceId).flatMap((span) => {
2772
+ if (service !== "executor-app") return [span];
2773
+ const kept = appSpan(span);
2774
+ return kept === void 0 ? [] : [kept];
2775
+ })
2422
2776
  }
2423
2777
  ]
2424
2778
  }
@@ -2435,14 +2789,14 @@ var forwardTelemetry = (batch, traceId, build, service = "executor-app") => Effe
2435
2789
  scopeLogs: [
2436
2790
  {
2437
2791
  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)
2792
+ 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
2793
  }
2440
2794
  ]
2441
2795
  }
2442
2796
  ]
2443
2797
  }))
2444
2798
  );
2445
- yield* client.pipe(HttpClient_exports.filterStatusOk).execute(
2799
+ yield* client.execute(
2446
2800
  HttpClientRequest_exports.post(target.url).pipe(
2447
2801
  HttpClientRequest_exports.setHeaders(
2448
2802
  target.headers === void 0 ? {} : Redacted_exports.value(target.headers)
@@ -2459,8 +2813,8 @@ var forwardTelemetry = (batch, traceId, build, service = "executor-app") => Effe
2459
2813
 
2460
2814
  // ../telemetry/src/trace-context.ts
2461
2815
  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}$/)),
2816
+ traceId: Schema_exports.String.check(Schema_exports.isPattern(/^(?!0{32}$)[a-f0-9]{32}$/u)),
2817
+ spanId: Schema_exports.String.check(Schema_exports.isPattern(/^(?!0{16}$)[a-f0-9]{16}$/u)),
2464
2818
  sampled: Schema_exports.Boolean
2465
2819
  });
2466
2820
  var currentTraceContext = Effect_exports.currentSpan.pipe(
@@ -2508,7 +2862,6 @@ export {
2508
2862
  withRemoteSpan,
2509
2863
  invocationFetch,
2510
2864
  collectTelemetry,
2511
- TraceContext,
2512
2865
  externalTrace,
2513
2866
  traceLinks,
2514
2867
  pendingSpan