@glasstrace/sdk 0.15.1 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +148 -1
  2. package/dist/adapters/drizzle.js +2 -5
  3. package/dist/adapters/drizzle.js.map +1 -1
  4. package/dist/{chunk-PD2SKFQQ.js → chunk-55FBXXER.js} +4 -8
  5. package/dist/{chunk-PD2SKFQQ.js.map → chunk-55FBXXER.js.map} +1 -1
  6. package/dist/{chunk-ZNOD6FC7.js → chunk-CTJI2YKA.js} +8 -15
  7. package/dist/{chunk-ZNOD6FC7.js.map → chunk-CTJI2YKA.js.map} +1 -1
  8. package/dist/{chunk-WK7MPK2T.js → chunk-DQ25VOKK.js} +1 -89
  9. package/dist/chunk-DQ25VOKK.js.map +1 -0
  10. package/dist/{chunk-BL3YDC6V.js → chunk-DXRZKKSO.js} +1 -6
  11. package/dist/{chunk-BL3YDC6V.js.map → chunk-DXRZKKSO.js.map} +1 -1
  12. package/dist/{chunk-2LDBR3F3.js → chunk-E33Y7BQH.js} +36 -74
  13. package/dist/chunk-E33Y7BQH.js.map +1 -0
  14. package/dist/{chunk-YMEXDDTA.js → chunk-GSGX76Q5.js} +4 -99
  15. package/dist/chunk-GSGX76Q5.js.map +1 -0
  16. package/dist/{chunk-ECEN724Y.js → chunk-J5BW7V2D.js} +4 -8
  17. package/dist/{chunk-ECEN724Y.js.map → chunk-J5BW7V2D.js.map} +1 -1
  18. package/dist/{chunk-BGZ7J74D.js → chunk-NSBPE2FW.js} +2 -16
  19. package/dist/{chunk-A2AZL6MZ.js → chunk-O63DJKIJ.js} +169 -18
  20. package/dist/chunk-O63DJKIJ.js.map +1 -0
  21. package/dist/chunk-UUUKI65I.js +851 -0
  22. package/dist/chunk-UUUKI65I.js.map +1 -0
  23. package/dist/chunk-VUZCLMIX.js +57 -0
  24. package/dist/chunk-VUZCLMIX.js.map +1 -0
  25. package/dist/{chunk-OSXIUKD5.js → chunk-WZXVS2EO.js} +1 -6
  26. package/dist/{chunk-OSXIUKD5.js.map → chunk-WZXVS2EO.js.map} +1 -1
  27. package/dist/{chunk-ROFOJQWN.js → chunk-XNDHQN4S.js} +7 -11
  28. package/dist/{chunk-ROFOJQWN.js.map → chunk-XNDHQN4S.js.map} +1 -1
  29. package/dist/cli/init.cjs +673 -161
  30. package/dist/cli/init.cjs.map +1 -1
  31. package/dist/cli/init.d.cts +54 -1
  32. package/dist/cli/init.d.ts +54 -1
  33. package/dist/cli/init.js +146 -37
  34. package/dist/cli/init.js.map +1 -1
  35. package/dist/cli/mcp-add.cjs +16 -16
  36. package/dist/cli/mcp-add.cjs.map +1 -1
  37. package/dist/cli/mcp-add.js +10 -13
  38. package/dist/cli/mcp-add.js.map +1 -1
  39. package/dist/cli/status.cjs +2 -2
  40. package/dist/cli/status.js +4 -7
  41. package/dist/cli/status.js.map +1 -1
  42. package/dist/cli/uninit.cjs +56 -59
  43. package/dist/cli/uninit.cjs.map +1 -1
  44. package/dist/cli/uninit.js +4 -4
  45. package/dist/cli/validate.cjs +2 -2
  46. package/dist/cli/validate.js +3 -6
  47. package/dist/cli/validate.js.map +1 -1
  48. package/dist/{esm-MDK7CZID.js → esm-KBPHCVB4.js} +3 -3
  49. package/dist/{getMachineId-bsd-4NIRBWME.js → getMachineId-bsd-345PYXFX.js} +4 -7
  50. package/dist/{getMachineId-bsd-4NIRBWME.js.map → getMachineId-bsd-345PYXFX.js.map} +1 -1
  51. package/dist/{getMachineId-darwin-2XNOCCJQ.js → getMachineId-darwin-5L2D25AD.js} +4 -7
  52. package/dist/{getMachineId-darwin-2XNOCCJQ.js.map → getMachineId-darwin-5L2D25AD.js.map} +1 -1
  53. package/dist/{getMachineId-linux-V6YSQEY7.js → getMachineId-linux-KJR4P5HN.js} +3 -6
  54. package/dist/{getMachineId-linux-V6YSQEY7.js.map → getMachineId-linux-KJR4P5HN.js.map} +1 -1
  55. package/dist/{getMachineId-unsupported-4FKBJNVO.js → getMachineId-unsupported-NDNXDYDY.js} +3 -6
  56. package/dist/{getMachineId-unsupported-4FKBJNVO.js.map → getMachineId-unsupported-NDNXDYDY.js.map} +1 -1
  57. package/dist/{getMachineId-win-WLRZBKVG.js → getMachineId-win-T7PJNJXG.js} +4 -7
  58. package/dist/{getMachineId-win-WLRZBKVG.js.map → getMachineId-win-T7PJNJXG.js.map} +1 -1
  59. package/dist/index.cjs +565 -463
  60. package/dist/index.cjs.map +1 -1
  61. package/dist/index.d.cts +93 -4
  62. package/dist/index.d.ts +93 -4
  63. package/dist/index.js +286 -702
  64. package/dist/index.js.map +1 -1
  65. package/dist/{monorepo-YILKGQXQ.js → monorepo-N5Z63XP7.js} +4 -4
  66. package/dist/{source-map-uploader-3GWUQDTS.js → source-map-uploader-26QPRSCG.js} +5 -4
  67. package/dist/source-map-uploader-26QPRSCG.js.map +1 -0
  68. package/package.json +1 -1
  69. package/dist/chunk-2LDBR3F3.js.map +0 -1
  70. package/dist/chunk-A2AZL6MZ.js.map +0 -1
  71. package/dist/chunk-BGZ7J74D.js.map +0 -1
  72. package/dist/chunk-UPS5BGER.js +0 -182
  73. package/dist/chunk-UPS5BGER.js.map +0 -1
  74. package/dist/chunk-WK7MPK2T.js.map +0 -1
  75. package/dist/chunk-YMEXDDTA.js.map +0 -1
  76. /package/dist/{esm-MDK7CZID.js.map → chunk-NSBPE2FW.js.map} +0 -0
  77. /package/dist/{monorepo-YILKGQXQ.js.map → esm-KBPHCVB4.js.map} +0 -0
  78. /package/dist/{source-map-uploader-3GWUQDTS.js.map → monorepo-N5Z63XP7.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -30,13 +30,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  ));
31
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
32
 
33
- // ../../node_modules/tsup/assets/cjs_shims.js
34
- var init_cjs_shims = __esm({
35
- "../../node_modules/tsup/assets/cjs_shims.js"() {
36
- "use strict";
37
- }
38
- });
39
-
40
33
  // src/env-detection.ts
41
34
  function readEnvVars() {
42
35
  return {
@@ -89,7 +82,6 @@ var DEFAULT_ENDPOINT;
89
82
  var init_env_detection = __esm({
90
83
  "src/env-detection.ts"() {
91
84
  "use strict";
92
- init_cjs_shims();
93
85
  DEFAULT_ENDPOINT = "https://api.glasstrace.dev";
94
86
  }
95
87
  });
@@ -156,7 +148,6 @@ var NEVER, $brand, $ZodAsyncError, $ZodEncodeError, globalConfig;
156
148
  var init_core = __esm({
157
149
  "../../node_modules/zod/v4/core/core.js"() {
158
150
  "use strict";
159
- init_cjs_shims();
160
151
  NEVER = Object.freeze({
161
152
  status: "aborted"
162
153
  });
@@ -782,7 +773,6 @@ var EVALUATING, captureStackTrace, allowsEval, getParsedType, propertyKeyTypes,
782
773
  var init_util = __esm({
783
774
  "../../node_modules/zod/v4/core/util.js"() {
784
775
  "use strict";
785
- init_cjs_shims();
786
776
  EVALUATING = /* @__PURE__ */ Symbol("evaluating");
787
777
  captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
788
778
  };
@@ -983,7 +973,6 @@ var initializer, $ZodError, $ZodRealError;
983
973
  var init_errors = __esm({
984
974
  "../../node_modules/zod/v4/core/errors.js"() {
985
975
  "use strict";
986
- init_cjs_shims();
987
976
  init_core();
988
977
  init_util();
989
978
  initializer = (inst, def) => {
@@ -1012,7 +1001,6 @@ var _parse, parse, _parseAsync, parseAsync, _safeParse, safeParse, _safeParseAsy
1012
1001
  var init_parse = __esm({
1013
1002
  "../../node_modules/zod/v4/core/parse.js"() {
1014
1003
  "use strict";
1015
- init_cjs_shims();
1016
1004
  init_core();
1017
1005
  init_errors();
1018
1006
  init_util();
@@ -1198,7 +1186,6 @@ var cuid, cuid2, ulid, xid, ksuid, nanoid, duration, extendedDuration, guid, uui
1198
1186
  var init_regexes = __esm({
1199
1187
  "../../node_modules/zod/v4/core/regexes.js"() {
1200
1188
  "use strict";
1201
- init_cjs_shims();
1202
1189
  init_util();
1203
1190
  cuid = /^[cC][^\s-]{8,}$/;
1204
1191
  cuid2 = /^[0-9a-z]+$/;
@@ -1280,7 +1267,6 @@ var $ZodCheck, numericOriginMap, $ZodCheckLessThan, $ZodCheckGreaterThan, $ZodCh
1280
1267
  var init_checks = __esm({
1281
1268
  "../../node_modules/zod/v4/core/checks.js"() {
1282
1269
  "use strict";
1283
- init_cjs_shims();
1284
1270
  init_core();
1285
1271
  init_regexes();
1286
1272
  init_util();
@@ -1833,7 +1819,6 @@ var Doc;
1833
1819
  var init_doc = __esm({
1834
1820
  "../../node_modules/zod/v4/core/doc.js"() {
1835
1821
  "use strict";
1836
- init_cjs_shims();
1837
1822
  Doc = class {
1838
1823
  constructor(args = []) {
1839
1824
  this.content = [];
@@ -1876,7 +1861,6 @@ var version;
1876
1861
  var init_versions = __esm({
1877
1862
  "../../node_modules/zod/v4/core/versions.js"() {
1878
1863
  "use strict";
1879
- init_cjs_shims();
1880
1864
  version = {
1881
1865
  major: 4,
1882
1866
  minor: 3,
@@ -2247,7 +2231,6 @@ var $ZodType, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, $ZodU
2247
2231
  var init_schemas = __esm({
2248
2232
  "../../node_modules/zod/v4/core/schemas.js"() {
2249
2233
  "use strict";
2250
- init_cjs_shims();
2251
2234
  init_checks();
2252
2235
  init_core();
2253
2236
  init_doc();
@@ -3881,7 +3864,6 @@ var error;
3881
3864
  var init_ar = __esm({
3882
3865
  "../../node_modules/zod/v4/locales/ar.js"() {
3883
3866
  "use strict";
3884
- init_cjs_shims();
3885
3867
  init_util();
3886
3868
  error = () => {
3887
3869
  const Sizable = {
@@ -3996,7 +3978,6 @@ var error2;
3996
3978
  var init_az = __esm({
3997
3979
  "../../node_modules/zod/v4/locales/az.js"() {
3998
3980
  "use strict";
3999
- init_cjs_shims();
4000
3981
  init_util();
4001
3982
  error2 = () => {
4002
3983
  const Sizable = {
@@ -4125,7 +4106,6 @@ var error3;
4125
4106
  var init_be = __esm({
4126
4107
  "../../node_modules/zod/v4/locales/be.js"() {
4127
4108
  "use strict";
4128
- init_cjs_shims();
4129
4109
  init_util();
4130
4110
  error3 = () => {
4131
4111
  const Sizable = {
@@ -4275,7 +4255,6 @@ var error4;
4275
4255
  var init_bg = __esm({
4276
4256
  "../../node_modules/zod/v4/locales/bg.js"() {
4277
4257
  "use strict";
4278
- init_cjs_shims();
4279
4258
  init_util();
4280
4259
  error4 = () => {
4281
4260
  const Sizable = {
@@ -4404,7 +4383,6 @@ var error5;
4404
4383
  var init_ca = __esm({
4405
4384
  "../../node_modules/zod/v4/locales/ca.js"() {
4406
4385
  "use strict";
4407
- init_cjs_shims();
4408
4386
  init_util();
4409
4387
  error5 = () => {
4410
4388
  const Sizable = {
@@ -4521,7 +4499,6 @@ var error6;
4521
4499
  var init_cs = __esm({
4522
4500
  "../../node_modules/zod/v4/locales/cs.js"() {
4523
4501
  "use strict";
4524
- init_cjs_shims();
4525
4502
  init_util();
4526
4503
  error6 = () => {
4527
4504
  const Sizable = {
@@ -4641,7 +4618,6 @@ var error7;
4641
4618
  var init_da = __esm({
4642
4619
  "../../node_modules/zod/v4/locales/da.js"() {
4643
4620
  "use strict";
4644
- init_cjs_shims();
4645
4621
  init_util();
4646
4622
  error7 = () => {
4647
4623
  const Sizable = {
@@ -4765,7 +4741,6 @@ var error8;
4765
4741
  var init_de = __esm({
4766
4742
  "../../node_modules/zod/v4/locales/de.js"() {
4767
4743
  "use strict";
4768
- init_cjs_shims();
4769
4744
  init_util();
4770
4745
  error8 = () => {
4771
4746
  const Sizable = {
@@ -4882,7 +4857,6 @@ var error9;
4882
4857
  var init_en = __esm({
4883
4858
  "../../node_modules/zod/v4/locales/en.js"() {
4884
4859
  "use strict";
4885
- init_cjs_shims();
4886
4860
  init_util();
4887
4861
  error9 = () => {
4888
4862
  const Sizable = {
@@ -4999,7 +4973,6 @@ var error10;
4999
4973
  var init_eo = __esm({
5000
4974
  "../../node_modules/zod/v4/locales/eo.js"() {
5001
4975
  "use strict";
5002
- init_cjs_shims();
5003
4976
  init_util();
5004
4977
  error10 = () => {
5005
4978
  const Sizable = {
@@ -5117,7 +5090,6 @@ var error11;
5117
5090
  var init_es = __esm({
5118
5091
  "../../node_modules/zod/v4/locales/es.js"() {
5119
5092
  "use strict";
5120
- init_cjs_shims();
5121
5093
  init_util();
5122
5094
  error11 = () => {
5123
5095
  const Sizable = {
@@ -5258,7 +5230,6 @@ var error12;
5258
5230
  var init_fa = __esm({
5259
5231
  "../../node_modules/zod/v4/locales/fa.js"() {
5260
5232
  "use strict";
5261
- init_cjs_shims();
5262
5233
  init_util();
5263
5234
  error12 = () => {
5264
5235
  const Sizable = {
@@ -5381,7 +5352,6 @@ var error13;
5381
5352
  var init_fi = __esm({
5382
5353
  "../../node_modules/zod/v4/locales/fi.js"() {
5383
5354
  "use strict";
5384
- init_cjs_shims();
5385
5355
  init_util();
5386
5356
  error13 = () => {
5387
5357
  const Sizable = {
@@ -5502,7 +5472,6 @@ var error14;
5502
5472
  var init_fr = __esm({
5503
5473
  "../../node_modules/zod/v4/locales/fr.js"() {
5504
5474
  "use strict";
5505
- init_cjs_shims();
5506
5475
  init_util();
5507
5476
  error14 = () => {
5508
5477
  const Sizable = {
@@ -5619,7 +5588,6 @@ var error15;
5619
5588
  var init_fr_CA = __esm({
5620
5589
  "../../node_modules/zod/v4/locales/fr-CA.js"() {
5621
5590
  "use strict";
5622
- init_cjs_shims();
5623
5591
  init_util();
5624
5592
  error15 = () => {
5625
5593
  const Sizable = {
@@ -5735,7 +5703,6 @@ var error16;
5735
5703
  var init_he = __esm({
5736
5704
  "../../node_modules/zod/v4/locales/he.js"() {
5737
5705
  "use strict";
5738
- init_cjs_shims();
5739
5706
  init_util();
5740
5707
  error16 = () => {
5741
5708
  const TypeNames = {
@@ -5938,7 +5905,6 @@ var error17;
5938
5905
  var init_hu = __esm({
5939
5906
  "../../node_modules/zod/v4/locales/hu.js"() {
5940
5907
  "use strict";
5941
- init_cjs_shims();
5942
5908
  init_util();
5943
5909
  error17 = () => {
5944
5910
  const Sizable = {
@@ -6065,7 +6031,6 @@ var error18;
6065
6031
  var init_hy = __esm({
6066
6032
  "../../node_modules/zod/v4/locales/hy.js"() {
6067
6033
  "use strict";
6068
- init_cjs_shims();
6069
6034
  init_util();
6070
6035
  error18 = () => {
6071
6036
  const Sizable = {
@@ -6211,7 +6176,6 @@ var error19;
6211
6176
  var init_id = __esm({
6212
6177
  "../../node_modules/zod/v4/locales/id.js"() {
6213
6178
  "use strict";
6214
- init_cjs_shims();
6215
6179
  init_util();
6216
6180
  error19 = () => {
6217
6181
  const Sizable = {
@@ -6326,7 +6290,6 @@ var error20;
6326
6290
  var init_is = __esm({
6327
6291
  "../../node_modules/zod/v4/locales/is.js"() {
6328
6292
  "use strict";
6329
- init_cjs_shims();
6330
6293
  init_util();
6331
6294
  error20 = () => {
6332
6295
  const Sizable = {
@@ -6444,7 +6407,6 @@ var error21;
6444
6407
  var init_it = __esm({
6445
6408
  "../../node_modules/zod/v4/locales/it.js"() {
6446
6409
  "use strict";
6447
- init_cjs_shims();
6448
6410
  init_util();
6449
6411
  error21 = () => {
6450
6412
  const Sizable = {
@@ -6561,7 +6523,6 @@ var error22;
6561
6523
  var init_ja = __esm({
6562
6524
  "../../node_modules/zod/v4/locales/ja.js"() {
6563
6525
  "use strict";
6564
- init_cjs_shims();
6565
6526
  init_util();
6566
6527
  error22 = () => {
6567
6528
  const Sizable = {
@@ -6677,7 +6638,6 @@ var error23;
6677
6638
  var init_ka = __esm({
6678
6639
  "../../node_modules/zod/v4/locales/ka.js"() {
6679
6640
  "use strict";
6680
- init_cjs_shims();
6681
6641
  init_util();
6682
6642
  error23 = () => {
6683
6643
  const Sizable = {
@@ -6798,7 +6758,6 @@ var error24;
6798
6758
  var init_km = __esm({
6799
6759
  "../../node_modules/zod/v4/locales/km.js"() {
6800
6760
  "use strict";
6801
- init_cjs_shims();
6802
6761
  init_util();
6803
6762
  error24 = () => {
6804
6763
  const Sizable = {
@@ -6914,7 +6873,6 @@ function kh_default() {
6914
6873
  var init_kh = __esm({
6915
6874
  "../../node_modules/zod/v4/locales/kh.js"() {
6916
6875
  "use strict";
6917
- init_cjs_shims();
6918
6876
  init_km();
6919
6877
  }
6920
6878
  });
@@ -6929,7 +6887,6 @@ var error25;
6929
6887
  var init_ko = __esm({
6930
6888
  "../../node_modules/zod/v4/locales/ko.js"() {
6931
6889
  "use strict";
6932
- init_cjs_shims();
6933
6890
  init_util();
6934
6891
  error25 = () => {
6935
6892
  const Sizable = {
@@ -7059,7 +7016,6 @@ var capitalizeFirstCharacter, error26;
7059
7016
  var init_lt = __esm({
7060
7017
  "../../node_modules/zod/v4/locales/lt.js"() {
7061
7018
  "use strict";
7062
- init_cjs_shims();
7063
7019
  init_util();
7064
7020
  capitalizeFirstCharacter = (text) => {
7065
7021
  return text.charAt(0).toUpperCase() + text.slice(1);
@@ -7261,7 +7217,6 @@ var error27;
7261
7217
  var init_mk = __esm({
7262
7218
  "../../node_modules/zod/v4/locales/mk.js"() {
7263
7219
  "use strict";
7264
- init_cjs_shims();
7265
7220
  init_util();
7266
7221
  error27 = () => {
7267
7222
  const Sizable = {
@@ -7379,7 +7334,6 @@ var error28;
7379
7334
  var init_ms = __esm({
7380
7335
  "../../node_modules/zod/v4/locales/ms.js"() {
7381
7336
  "use strict";
7382
- init_cjs_shims();
7383
7337
  init_util();
7384
7338
  error28 = () => {
7385
7339
  const Sizable = {
@@ -7495,7 +7449,6 @@ var error29;
7495
7449
  var init_nl = __esm({
7496
7450
  "../../node_modules/zod/v4/locales/nl.js"() {
7497
7451
  "use strict";
7498
- init_cjs_shims();
7499
7452
  init_util();
7500
7453
  error29 = () => {
7501
7454
  const Sizable = {
@@ -7614,7 +7567,6 @@ var error30;
7614
7567
  var init_no = __esm({
7615
7568
  "../../node_modules/zod/v4/locales/no.js"() {
7616
7569
  "use strict";
7617
- init_cjs_shims();
7618
7570
  init_util();
7619
7571
  error30 = () => {
7620
7572
  const Sizable = {
@@ -7731,7 +7683,6 @@ var error31;
7731
7683
  var init_ota = __esm({
7732
7684
  "../../node_modules/zod/v4/locales/ota.js"() {
7733
7685
  "use strict";
7734
- init_cjs_shims();
7735
7686
  init_util();
7736
7687
  error31 = () => {
7737
7688
  const Sizable = {
@@ -7849,7 +7800,6 @@ var error32;
7849
7800
  var init_ps = __esm({
7850
7801
  "../../node_modules/zod/v4/locales/ps.js"() {
7851
7802
  "use strict";
7852
- init_cjs_shims();
7853
7803
  init_util();
7854
7804
  error32 = () => {
7855
7805
  const Sizable = {
@@ -7972,7 +7922,6 @@ var error33;
7972
7922
  var init_pl = __esm({
7973
7923
  "../../node_modules/zod/v4/locales/pl.js"() {
7974
7924
  "use strict";
7975
- init_cjs_shims();
7976
7925
  init_util();
7977
7926
  error33 = () => {
7978
7927
  const Sizable = {
@@ -8090,7 +8039,6 @@ var error34;
8090
8039
  var init_pt = __esm({
8091
8040
  "../../node_modules/zod/v4/locales/pt.js"() {
8092
8041
  "use strict";
8093
- init_cjs_shims();
8094
8042
  init_util();
8095
8043
  error34 = () => {
8096
8044
  const Sizable = {
@@ -8222,7 +8170,6 @@ var error35;
8222
8170
  var init_ru = __esm({
8223
8171
  "../../node_modules/zod/v4/locales/ru.js"() {
8224
8172
  "use strict";
8225
- init_cjs_shims();
8226
8173
  init_util();
8227
8174
  error35 = () => {
8228
8175
  const Sizable = {
@@ -8372,7 +8319,6 @@ var error36;
8372
8319
  var init_sl = __esm({
8373
8320
  "../../node_modules/zod/v4/locales/sl.js"() {
8374
8321
  "use strict";
8375
- init_cjs_shims();
8376
8322
  init_util();
8377
8323
  error36 = () => {
8378
8324
  const Sizable = {
@@ -8490,7 +8436,6 @@ var error37;
8490
8436
  var init_sv = __esm({
8491
8437
  "../../node_modules/zod/v4/locales/sv.js"() {
8492
8438
  "use strict";
8493
- init_cjs_shims();
8494
8439
  init_util();
8495
8440
  error37 = () => {
8496
8441
  const Sizable = {
@@ -8609,7 +8554,6 @@ var error38;
8609
8554
  var init_ta = __esm({
8610
8555
  "../../node_modules/zod/v4/locales/ta.js"() {
8611
8556
  "use strict";
8612
- init_cjs_shims();
8613
8557
  init_util();
8614
8558
  error38 = () => {
8615
8559
  const Sizable = {
@@ -8728,7 +8672,6 @@ var error39;
8728
8672
  var init_th = __esm({
8729
8673
  "../../node_modules/zod/v4/locales/th.js"() {
8730
8674
  "use strict";
8731
- init_cjs_shims();
8732
8675
  init_util();
8733
8676
  error39 = () => {
8734
8677
  const Sizable = {
@@ -8847,7 +8790,6 @@ var error40;
8847
8790
  var init_tr = __esm({
8848
8791
  "../../node_modules/zod/v4/locales/tr.js"() {
8849
8792
  "use strict";
8850
- init_cjs_shims();
8851
8793
  init_util();
8852
8794
  error40 = () => {
8853
8795
  const Sizable = {
@@ -8961,7 +8903,6 @@ var error41;
8961
8903
  var init_uk = __esm({
8962
8904
  "../../node_modules/zod/v4/locales/uk.js"() {
8963
8905
  "use strict";
8964
- init_cjs_shims();
8965
8906
  init_util();
8966
8907
  error41 = () => {
8967
8908
  const Sizable = {
@@ -9075,7 +9016,6 @@ function ua_default() {
9075
9016
  var init_ua = __esm({
9076
9017
  "../../node_modules/zod/v4/locales/ua.js"() {
9077
9018
  "use strict";
9078
- init_cjs_shims();
9079
9019
  init_uk();
9080
9020
  }
9081
9021
  });
@@ -9090,7 +9030,6 @@ var error42;
9090
9030
  var init_ur = __esm({
9091
9031
  "../../node_modules/zod/v4/locales/ur.js"() {
9092
9032
  "use strict";
9093
- init_cjs_shims();
9094
9033
  init_util();
9095
9034
  error42 = () => {
9096
9035
  const Sizable = {
@@ -9209,7 +9148,6 @@ var error43;
9209
9148
  var init_uz = __esm({
9210
9149
  "../../node_modules/zod/v4/locales/uz.js"() {
9211
9150
  "use strict";
9212
- init_cjs_shims();
9213
9151
  init_util();
9214
9152
  error43 = () => {
9215
9153
  const Sizable = {
@@ -9327,7 +9265,6 @@ var error44;
9327
9265
  var init_vi = __esm({
9328
9266
  "../../node_modules/zod/v4/locales/vi.js"() {
9329
9267
  "use strict";
9330
- init_cjs_shims();
9331
9268
  init_util();
9332
9269
  error44 = () => {
9333
9270
  const Sizable = {
@@ -9444,7 +9381,6 @@ var error45;
9444
9381
  var init_zh_CN = __esm({
9445
9382
  "../../node_modules/zod/v4/locales/zh-CN.js"() {
9446
9383
  "use strict";
9447
- init_cjs_shims();
9448
9384
  init_util();
9449
9385
  error45 = () => {
9450
9386
  const Sizable = {
@@ -9562,7 +9498,6 @@ var error46;
9562
9498
  var init_zh_TW = __esm({
9563
9499
  "../../node_modules/zod/v4/locales/zh-TW.js"() {
9564
9500
  "use strict";
9565
- init_cjs_shims();
9566
9501
  init_util();
9567
9502
  error46 = () => {
9568
9503
  const Sizable = {
@@ -9678,7 +9613,6 @@ var error47;
9678
9613
  var init_yo = __esm({
9679
9614
  "../../node_modules/zod/v4/locales/yo.js"() {
9680
9615
  "use strict";
9681
- init_cjs_shims();
9682
9616
  init_util();
9683
9617
  error47 = () => {
9684
9618
  const Sizable = {
@@ -9840,7 +9774,6 @@ __export(locales_exports, {
9840
9774
  var init_locales = __esm({
9841
9775
  "../../node_modules/zod/v4/locales/index.js"() {
9842
9776
  "use strict";
9843
- init_cjs_shims();
9844
9777
  init_ar();
9845
9778
  init_az();
9846
9779
  init_be();
@@ -9901,7 +9834,6 @@ var _a, $output, $input, $ZodRegistry, globalRegistry;
9901
9834
  var init_registries = __esm({
9902
9835
  "../../node_modules/zod/v4/core/registries.js"() {
9903
9836
  "use strict";
9904
- init_cjs_shims();
9905
9837
  $output = /* @__PURE__ */ Symbol("ZodOutput");
9906
9838
  $input = /* @__PURE__ */ Symbol("ZodInput");
9907
9839
  $ZodRegistry = class {
@@ -10984,7 +10916,6 @@ var TimePrecision;
10984
10916
  var init_api = __esm({
10985
10917
  "../../node_modules/zod/v4/core/api.js"() {
10986
10918
  "use strict";
10987
- init_cjs_shims();
10988
10919
  init_checks();
10989
10920
  init_registries();
10990
10921
  init_schemas();
@@ -11341,7 +11272,6 @@ var createToJSONSchemaMethod, createStandardJSONSchemaMethod;
11341
11272
  var init_to_json_schema = __esm({
11342
11273
  "../../node_modules/zod/v4/core/to-json-schema.js"() {
11343
11274
  "use strict";
11344
- init_cjs_shims();
11345
11275
  init_registries();
11346
11276
  createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
11347
11277
  const ctx = initializeContext({ ...params, processors });
@@ -11398,7 +11328,6 @@ var formatMap, stringProcessor, numberProcessor, booleanProcessor, bigintProcess
11398
11328
  var init_json_schema_processors = __esm({
11399
11329
  "../../node_modules/zod/v4/core/json-schema-processors.js"() {
11400
11330
  "use strict";
11401
- init_cjs_shims();
11402
11331
  init_to_json_schema();
11403
11332
  init_util();
11404
11333
  formatMap = {
@@ -11924,7 +11853,6 @@ var JSONSchemaGenerator;
11924
11853
  var init_json_schema_generator = __esm({
11925
11854
  "../../node_modules/zod/v4/core/json-schema-generator.js"() {
11926
11855
  "use strict";
11927
- init_cjs_shims();
11928
11856
  init_json_schema_processors();
11929
11857
  init_to_json_schema();
11930
11858
  JSONSchemaGenerator = class {
@@ -12008,7 +11936,6 @@ var json_schema_exports = {};
12008
11936
  var init_json_schema = __esm({
12009
11937
  "../../node_modules/zod/v4/core/json-schema.js"() {
12010
11938
  "use strict";
12011
- init_cjs_shims();
12012
11939
  }
12013
11940
  });
12014
11941
 
@@ -12292,7 +12219,6 @@ __export(core_exports2, {
12292
12219
  var init_core2 = __esm({
12293
12220
  "../../node_modules/zod/v4/core/index.js"() {
12294
12221
  "use strict";
12295
- init_cjs_shims();
12296
12222
  init_core();
12297
12223
  init_parse();
12298
12224
  init_errors();
@@ -12348,7 +12274,6 @@ __export(checks_exports2, {
12348
12274
  var init_checks2 = __esm({
12349
12275
  "../../node_modules/zod/v4/classic/checks.js"() {
12350
12276
  "use strict";
12351
- init_cjs_shims();
12352
12277
  init_core2();
12353
12278
  }
12354
12279
  });
@@ -12381,7 +12306,6 @@ var ZodISODateTime, ZodISODate, ZodISOTime, ZodISODuration;
12381
12306
  var init_iso = __esm({
12382
12307
  "../../node_modules/zod/v4/classic/iso.js"() {
12383
12308
  "use strict";
12384
- init_cjs_shims();
12385
12309
  init_core2();
12386
12310
  init_schemas2();
12387
12311
  ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
@@ -12408,7 +12332,6 @@ var initializer2, ZodError, ZodRealError;
12408
12332
  var init_errors2 = __esm({
12409
12333
  "../../node_modules/zod/v4/classic/errors.js"() {
12410
12334
  "use strict";
12411
- init_cjs_shims();
12412
12335
  init_core2();
12413
12336
  init_core2();
12414
12337
  init_util();
@@ -12458,7 +12381,6 @@ var parse2, parseAsync2, safeParse2, safeParseAsync2, encode2, decode2, encodeAs
12458
12381
  var init_parse2 = __esm({
12459
12382
  "../../node_modules/zod/v4/classic/parse.js"() {
12460
12383
  "use strict";
12461
- init_cjs_shims();
12462
12384
  init_core2();
12463
12385
  init_errors2();
12464
12386
  parse2 = /* @__PURE__ */ _parse(ZodRealError);
@@ -13102,7 +13024,6 @@ var ZodType, _ZodString, ZodString, ZodStringFormat, ZodEmail, ZodGUID, ZodUUID,
13102
13024
  var init_schemas2 = __esm({
13103
13025
  "../../node_modules/zod/v4/classic/schemas.js"() {
13104
13026
  "use strict";
13105
- init_cjs_shims();
13106
13027
  init_core2();
13107
13028
  init_core2();
13108
13029
  init_json_schema_processors();
@@ -13749,7 +13670,6 @@ var ZodIssueCode, ZodFirstPartyTypeKind;
13749
13670
  var init_compat = __esm({
13750
13671
  "../../node_modules/zod/v4/classic/compat.js"() {
13751
13672
  "use strict";
13752
- init_cjs_shims();
13753
13673
  init_core2();
13754
13674
  init_core2();
13755
13675
  ZodIssueCode = {
@@ -14171,7 +14091,6 @@ var z, RECOGNIZED_KEYS;
14171
14091
  var init_from_json_schema = __esm({
14172
14092
  "../../node_modules/zod/v4/classic/from-json-schema.js"() {
14173
14093
  "use strict";
14174
- init_cjs_shims();
14175
14094
  init_registries();
14176
14095
  init_checks2();
14177
14096
  init_iso();
@@ -14282,7 +14201,6 @@ function date4(params) {
14282
14201
  var init_coerce = __esm({
14283
14202
  "../../node_modules/zod/v4/classic/coerce.js"() {
14284
14203
  "use strict";
14285
- init_cjs_shims();
14286
14204
  init_core2();
14287
14205
  init_schemas2();
14288
14206
  }
@@ -14531,7 +14449,6 @@ __export(external_exports, {
14531
14449
  var init_external = __esm({
14532
14450
  "../../node_modules/zod/v4/classic/external.js"() {
14533
14451
  "use strict";
14534
- init_cjs_shims();
14535
14452
  init_core2();
14536
14453
  init_schemas2();
14537
14454
  init_checks2();
@@ -14555,7 +14472,6 @@ var init_external = __esm({
14555
14472
  var init_zod = __esm({
14556
14473
  "../../node_modules/zod/index.js"() {
14557
14474
  "use strict";
14558
- init_cjs_shims();
14559
14475
  init_external();
14560
14476
  init_external();
14561
14477
  }
@@ -14577,7 +14493,6 @@ var DevApiKeySchema, AnonApiKeySchema, SessionIdSchema, BuildHashSchema, SdkDiag
14577
14493
  var init_dist = __esm({
14578
14494
  "../protocol/dist/index.js"() {
14579
14495
  "use strict";
14580
- init_cjs_shims();
14581
14496
  init_zod();
14582
14497
  init_zod();
14583
14498
  init_zod();
@@ -14735,6 +14650,7 @@ var init_dist = __esm({
14735
14650
  SOURCE_MAPPED: "glasstrace.source.mapped",
14736
14651
  TRPC_PROCEDURE: "glasstrace.trpc.procedure",
14737
14652
  ERROR_RESPONSE_BODY: "glasstrace.error.response_body",
14653
+ NEXT_ACTION_DETECTED: "glasstrace.next.action.detected",
14738
14654
  // Client-side attributes
14739
14655
  PLATFORM: "glasstrace.platform",
14740
14656
  GESTURE_TYPE: "glasstrace.gesture.type",
@@ -14760,7 +14676,6 @@ var VERSION;
14760
14676
  var init_version = __esm({
14761
14677
  "../../node_modules/@opentelemetry/api/build/esm/version.js"() {
14762
14678
  "use strict";
14763
- init_cjs_shims();
14764
14679
  VERSION = "1.9.1";
14765
14680
  }
14766
14681
  });
@@ -14831,7 +14746,6 @@ var re, isCompatible;
14831
14746
  var init_semver = __esm({
14832
14747
  "../../node_modules/@opentelemetry/api/build/esm/internal/semver.js"() {
14833
14748
  "use strict";
14834
- init_cjs_shims();
14835
14749
  init_version();
14836
14750
  re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
14837
14751
  isCompatible = _makeCompatibilityCheck(VERSION);
@@ -14877,7 +14791,6 @@ var major, GLOBAL_OPENTELEMETRY_API_KEY, _global;
14877
14791
  var init_global_utils = __esm({
14878
14792
  "../../node_modules/@opentelemetry/api/build/esm/internal/global-utils.js"() {
14879
14793
  "use strict";
14880
- init_cjs_shims();
14881
14794
  init_version();
14882
14795
  init_semver();
14883
14796
  major = VERSION.split(".")[0];
@@ -14898,7 +14811,6 @@ var DiagComponentLogger;
14898
14811
  var init_ComponentLogger = __esm({
14899
14812
  "../../node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js"() {
14900
14813
  "use strict";
14901
- init_cjs_shims();
14902
14814
  init_global_utils();
14903
14815
  DiagComponentLogger = class {
14904
14816
  constructor(props) {
@@ -14928,7 +14840,6 @@ var DiagLogLevel;
14928
14840
  var init_types = __esm({
14929
14841
  "../../node_modules/@opentelemetry/api/build/esm/diag/types.js"() {
14930
14842
  "use strict";
14931
- init_cjs_shims();
14932
14843
  (function(DiagLogLevel2) {
14933
14844
  DiagLogLevel2[DiagLogLevel2["NONE"] = 0] = "NONE";
14934
14845
  DiagLogLevel2[DiagLogLevel2["ERROR"] = 30] = "ERROR";
@@ -14968,7 +14879,6 @@ function createLogLevelDiagLogger(maxLevel, logger) {
14968
14879
  var init_logLevelLogger = __esm({
14969
14880
  "../../node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js"() {
14970
14881
  "use strict";
14971
- init_cjs_shims();
14972
14882
  init_types();
14973
14883
  }
14974
14884
  });
@@ -14978,7 +14888,6 @@ var API_NAME, DiagAPI;
14978
14888
  var init_diag = __esm({
14979
14889
  "../../node_modules/@opentelemetry/api/build/esm/api/diag.js"() {
14980
14890
  "use strict";
14981
- init_cjs_shims();
14982
14891
  init_ComponentLogger();
14983
14892
  init_logLevelLogger();
14984
14893
  init_types();
@@ -15049,7 +14958,6 @@ var BaggageImpl;
15049
14958
  var init_baggage_impl = __esm({
15050
14959
  "../../node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.js"() {
15051
14960
  "use strict";
15052
- init_cjs_shims();
15053
14961
  BaggageImpl = class _BaggageImpl {
15054
14962
  constructor(entries) {
15055
14963
  this._entries = entries ? new Map(entries) : /* @__PURE__ */ new Map();
@@ -15093,7 +15001,6 @@ var baggageEntryMetadataSymbol;
15093
15001
  var init_symbol = __esm({
15094
15002
  "../../node_modules/@opentelemetry/api/build/esm/baggage/internal/symbol.js"() {
15095
15003
  "use strict";
15096
- init_cjs_shims();
15097
15004
  baggageEntryMetadataSymbol = /* @__PURE__ */ Symbol("BaggageEntryMetadata");
15098
15005
  }
15099
15006
  });
@@ -15118,7 +15025,6 @@ var diag;
15118
15025
  var init_utils = __esm({
15119
15026
  "../../node_modules/@opentelemetry/api/build/esm/baggage/utils.js"() {
15120
15027
  "use strict";
15121
- init_cjs_shims();
15122
15028
  init_diag();
15123
15029
  init_baggage_impl();
15124
15030
  init_symbol();
@@ -15134,7 +15040,6 @@ var BaseContext, ROOT_CONTEXT;
15134
15040
  var init_context = __esm({
15135
15041
  "../../node_modules/@opentelemetry/api/build/esm/context/context.js"() {
15136
15042
  "use strict";
15137
- init_cjs_shims();
15138
15043
  BaseContext = class _BaseContext {
15139
15044
  /**
15140
15045
  * Construct a new context which inherits values from an optional parent context.
@@ -15166,7 +15071,6 @@ var consoleMap, _originalConsoleMethods, DiagConsoleLogger;
15166
15071
  var init_consoleLogger = __esm({
15167
15072
  "../../node_modules/@opentelemetry/api/build/esm/diag/consoleLogger.js"() {
15168
15073
  "use strict";
15169
- init_cjs_shims();
15170
15074
  consoleMap = [
15171
15075
  { n: "error", c: "error" },
15172
15076
  { n: "warn", c: "warn" },
@@ -15225,7 +15129,6 @@ var NoopMeter, NoopMetric, NoopCounterMetric, NoopUpDownCounterMetric, NoopGauge
15225
15129
  var init_NoopMeter = __esm({
15226
15130
  "../../node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js"() {
15227
15131
  "use strict";
15228
- init_cjs_shims();
15229
15132
  NoopMeter = class {
15230
15133
  constructor() {
15231
15134
  }
@@ -15328,7 +15231,6 @@ var ValueType;
15328
15231
  var init_Metric = __esm({
15329
15232
  "../../node_modules/@opentelemetry/api/build/esm/metrics/Metric.js"() {
15330
15233
  "use strict";
15331
- init_cjs_shims();
15332
15234
  (function(ValueType2) {
15333
15235
  ValueType2[ValueType2["INT"] = 0] = "INT";
15334
15236
  ValueType2[ValueType2["DOUBLE"] = 1] = "DOUBLE";
@@ -15341,7 +15243,6 @@ var defaultTextMapGetter, defaultTextMapSetter;
15341
15243
  var init_TextMapPropagator = __esm({
15342
15244
  "../../node_modules/@opentelemetry/api/build/esm/propagation/TextMapPropagator.js"() {
15343
15245
  "use strict";
15344
- init_cjs_shims();
15345
15246
  defaultTextMapGetter = {
15346
15247
  get(carrier, key) {
15347
15248
  if (carrier == null) {
@@ -15372,7 +15273,6 @@ var NoopContextManager;
15372
15273
  var init_NoopContextManager = __esm({
15373
15274
  "../../node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js"() {
15374
15275
  "use strict";
15375
- init_cjs_shims();
15376
15276
  init_context();
15377
15277
  NoopContextManager = class {
15378
15278
  active() {
@@ -15399,7 +15299,6 @@ var API_NAME2, NOOP_CONTEXT_MANAGER, ContextAPI;
15399
15299
  var init_context2 = __esm({
15400
15300
  "../../node_modules/@opentelemetry/api/build/esm/api/context.js"() {
15401
15301
  "use strict";
15402
- init_cjs_shims();
15403
15302
  init_NoopContextManager();
15404
15303
  init_global_utils();
15405
15304
  init_diag();
@@ -15467,7 +15366,6 @@ var TraceFlags;
15467
15366
  var init_trace_flags = __esm({
15468
15367
  "../../node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js"() {
15469
15368
  "use strict";
15470
- init_cjs_shims();
15471
15369
  (function(TraceFlags2) {
15472
15370
  TraceFlags2[TraceFlags2["NONE"] = 0] = "NONE";
15473
15371
  TraceFlags2[TraceFlags2["SAMPLED"] = 1] = "SAMPLED";
@@ -15480,7 +15378,6 @@ var INVALID_SPANID, INVALID_TRACEID, INVALID_SPAN_CONTEXT;
15480
15378
  var init_invalid_span_constants = __esm({
15481
15379
  "../../node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js"() {
15482
15380
  "use strict";
15483
- init_cjs_shims();
15484
15381
  init_trace_flags();
15485
15382
  INVALID_SPANID = "0000000000000000";
15486
15383
  INVALID_TRACEID = "00000000000000000000000000000000";
@@ -15497,7 +15394,6 @@ var NonRecordingSpan;
15497
15394
  var init_NonRecordingSpan = __esm({
15498
15395
  "../../node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js"() {
15499
15396
  "use strict";
15500
- init_cjs_shims();
15501
15397
  init_invalid_span_constants();
15502
15398
  NonRecordingSpan = class {
15503
15399
  constructor(spanContext = INVALID_SPAN_CONTEXT) {
@@ -15571,7 +15467,6 @@ var SPAN_KEY;
15571
15467
  var init_context_utils = __esm({
15572
15468
  "../../node_modules/@opentelemetry/api/build/esm/trace/context-utils.js"() {
15573
15469
  "use strict";
15574
- init_cjs_shims();
15575
15470
  init_context();
15576
15471
  init_NonRecordingSpan();
15577
15472
  init_context2();
@@ -15605,7 +15500,6 @@ var isHex;
15605
15500
  var init_spancontext_utils = __esm({
15606
15501
  "../../node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js"() {
15607
15502
  "use strict";
15608
- init_cjs_shims();
15609
15503
  init_invalid_span_constants();
15610
15504
  init_NonRecordingSpan();
15611
15505
  isHex = new Uint8Array([
@@ -15724,7 +15618,6 @@ var contextApi, NoopTracer;
15724
15618
  var init_NoopTracer = __esm({
15725
15619
  "../../node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js"() {
15726
15620
  "use strict";
15727
- init_cjs_shims();
15728
15621
  init_context2();
15729
15622
  init_context_utils();
15730
15623
  init_NonRecordingSpan();
@@ -15774,7 +15667,6 @@ var NOOP_TRACER, ProxyTracer;
15774
15667
  var init_ProxyTracer = __esm({
15775
15668
  "../../node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js"() {
15776
15669
  "use strict";
15777
- init_cjs_shims();
15778
15670
  init_NoopTracer();
15779
15671
  NOOP_TRACER = new NoopTracer();
15780
15672
  ProxyTracer = class {
@@ -15815,7 +15707,6 @@ var NoopTracerProvider;
15815
15707
  var init_NoopTracerProvider = __esm({
15816
15708
  "../../node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js"() {
15817
15709
  "use strict";
15818
- init_cjs_shims();
15819
15710
  init_NoopTracer();
15820
15711
  NoopTracerProvider = class {
15821
15712
  getTracer(_name, _version, _options) {
@@ -15830,7 +15721,6 @@ var NOOP_TRACER_PROVIDER, ProxyTracerProvider;
15830
15721
  var init_ProxyTracerProvider = __esm({
15831
15722
  "../../node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js"() {
15832
15723
  "use strict";
15833
- init_cjs_shims();
15834
15724
  init_ProxyTracer();
15835
15725
  init_NoopTracerProvider();
15836
15726
  NOOP_TRACER_PROVIDER = new NoopTracerProvider();
@@ -15865,7 +15755,6 @@ var SamplingDecision;
15865
15755
  var init_SamplingResult = __esm({
15866
15756
  "../../node_modules/@opentelemetry/api/build/esm/trace/SamplingResult.js"() {
15867
15757
  "use strict";
15868
- init_cjs_shims();
15869
15758
  (function(SamplingDecision3) {
15870
15759
  SamplingDecision3[SamplingDecision3["NOT_RECORD"] = 0] = "NOT_RECORD";
15871
15760
  SamplingDecision3[SamplingDecision3["RECORD"] = 1] = "RECORD";
@@ -15879,7 +15768,6 @@ var SpanKind;
15879
15768
  var init_span_kind = __esm({
15880
15769
  "../../node_modules/@opentelemetry/api/build/esm/trace/span_kind.js"() {
15881
15770
  "use strict";
15882
- init_cjs_shims();
15883
15771
  (function(SpanKind2) {
15884
15772
  SpanKind2[SpanKind2["INTERNAL"] = 0] = "INTERNAL";
15885
15773
  SpanKind2[SpanKind2["SERVER"] = 1] = "SERVER";
@@ -15895,7 +15783,6 @@ var SpanStatusCode;
15895
15783
  var init_status = __esm({
15896
15784
  "../../node_modules/@opentelemetry/api/build/esm/trace/status.js"() {
15897
15785
  "use strict";
15898
- init_cjs_shims();
15899
15786
  (function(SpanStatusCode2) {
15900
15787
  SpanStatusCode2[SpanStatusCode2["UNSET"] = 0] = "UNSET";
15901
15788
  SpanStatusCode2[SpanStatusCode2["OK"] = 1] = "OK";
@@ -15915,7 +15802,6 @@ var VALID_KEY_CHAR_RANGE, VALID_KEY, VALID_VENDOR_KEY, VALID_KEY_REGEX, VALID_VA
15915
15802
  var init_tracestate_validators = __esm({
15916
15803
  "../../node_modules/@opentelemetry/api/build/esm/trace/internal/tracestate-validators.js"() {
15917
15804
  "use strict";
15918
- init_cjs_shims();
15919
15805
  VALID_KEY_CHAR_RANGE = "[_0-9a-z-*/]";
15920
15806
  VALID_KEY = `[a-z]${VALID_KEY_CHAR_RANGE}{0,255}`;
15921
15807
  VALID_VENDOR_KEY = `[a-z0-9]${VALID_KEY_CHAR_RANGE}{0,240}@[a-z]${VALID_KEY_CHAR_RANGE}{0,13}`;
@@ -15930,7 +15816,6 @@ var MAX_TRACE_STATE_ITEMS, MAX_TRACE_STATE_LEN, LIST_MEMBERS_SEPARATOR, LIST_MEM
15930
15816
  var init_tracestate_impl = __esm({
15931
15817
  "../../node_modules/@opentelemetry/api/build/esm/trace/internal/tracestate-impl.js"() {
15932
15818
  "use strict";
15933
- init_cjs_shims();
15934
15819
  init_tracestate_validators();
15935
15820
  MAX_TRACE_STATE_ITEMS = 32;
15936
15821
  MAX_TRACE_STATE_LEN = 512;
@@ -16004,7 +15889,6 @@ function createTraceState(rawTraceState) {
16004
15889
  var init_utils2 = __esm({
16005
15890
  "../../node_modules/@opentelemetry/api/build/esm/trace/internal/utils.js"() {
16006
15891
  "use strict";
16007
- init_cjs_shims();
16008
15892
  init_tracestate_impl();
16009
15893
  }
16010
15894
  });
@@ -16014,7 +15898,6 @@ var context;
16014
15898
  var init_context_api = __esm({
16015
15899
  "../../node_modules/@opentelemetry/api/build/esm/context-api.js"() {
16016
15900
  "use strict";
16017
- init_cjs_shims();
16018
15901
  init_context2();
16019
15902
  context = ContextAPI.getInstance();
16020
15903
  }
@@ -16025,7 +15908,6 @@ var diag2;
16025
15908
  var init_diag_api = __esm({
16026
15909
  "../../node_modules/@opentelemetry/api/build/esm/diag-api.js"() {
16027
15910
  "use strict";
16028
- init_cjs_shims();
16029
15911
  init_diag();
16030
15912
  diag2 = DiagAPI.instance();
16031
15913
  }
@@ -16036,7 +15918,6 @@ var NoopMeterProvider, NOOP_METER_PROVIDER;
16036
15918
  var init_NoopMeterProvider = __esm({
16037
15919
  "../../node_modules/@opentelemetry/api/build/esm/metrics/NoopMeterProvider.js"() {
16038
15920
  "use strict";
16039
- init_cjs_shims();
16040
15921
  init_NoopMeter();
16041
15922
  NoopMeterProvider = class {
16042
15923
  getMeter(_name, _version, _options) {
@@ -16052,7 +15933,6 @@ var API_NAME3, MetricsAPI;
16052
15933
  var init_metrics = __esm({
16053
15934
  "../../node_modules/@opentelemetry/api/build/esm/api/metrics.js"() {
16054
15935
  "use strict";
16055
- init_cjs_shims();
16056
15936
  init_NoopMeterProvider();
16057
15937
  init_global_utils();
16058
15938
  init_diag();
@@ -16100,7 +15980,6 @@ var metrics;
16100
15980
  var init_metrics_api = __esm({
16101
15981
  "../../node_modules/@opentelemetry/api/build/esm/metrics-api.js"() {
16102
15982
  "use strict";
16103
- init_cjs_shims();
16104
15983
  init_metrics();
16105
15984
  metrics = MetricsAPI.getInstance();
16106
15985
  }
@@ -16111,7 +15990,6 @@ var NoopTextMapPropagator;
16111
15990
  var init_NoopTextMapPropagator = __esm({
16112
15991
  "../../node_modules/@opentelemetry/api/build/esm/propagation/NoopTextMapPropagator.js"() {
16113
15992
  "use strict";
16114
- init_cjs_shims();
16115
15993
  NoopTextMapPropagator = class {
16116
15994
  /** Noop inject function does nothing */
16117
15995
  inject(_context, _carrier) {
@@ -16144,7 +16022,6 @@ var BAGGAGE_KEY;
16144
16022
  var init_context_helpers = __esm({
16145
16023
  "../../node_modules/@opentelemetry/api/build/esm/baggage/context-helpers.js"() {
16146
16024
  "use strict";
16147
- init_cjs_shims();
16148
16025
  init_context2();
16149
16026
  init_context();
16150
16027
  BAGGAGE_KEY = createContextKey("OpenTelemetry Baggage Key");
@@ -16156,7 +16033,6 @@ var API_NAME4, NOOP_TEXT_MAP_PROPAGATOR, PropagationAPI;
16156
16033
  var init_propagation = __esm({
16157
16034
  "../../node_modules/@opentelemetry/api/build/esm/api/propagation.js"() {
16158
16035
  "use strict";
16159
- init_cjs_shims();
16160
16036
  init_global_utils();
16161
16037
  init_NoopTextMapPropagator();
16162
16038
  init_TextMapPropagator();
@@ -16231,7 +16107,6 @@ var propagation;
16231
16107
  var init_propagation_api = __esm({
16232
16108
  "../../node_modules/@opentelemetry/api/build/esm/propagation-api.js"() {
16233
16109
  "use strict";
16234
- init_cjs_shims();
16235
16110
  init_propagation();
16236
16111
  propagation = PropagationAPI.getInstance();
16237
16112
  }
@@ -16242,7 +16117,6 @@ var API_NAME5, TraceAPI;
16242
16117
  var init_trace = __esm({
16243
16118
  "../../node_modules/@opentelemetry/api/build/esm/api/trace.js"() {
16244
16119
  "use strict";
16245
- init_cjs_shims();
16246
16120
  init_global_utils();
16247
16121
  init_ProxyTracerProvider();
16248
16122
  init_spancontext_utils();
@@ -16307,7 +16181,6 @@ var trace;
16307
16181
  var init_trace_api = __esm({
16308
16182
  "../../node_modules/@opentelemetry/api/build/esm/trace-api.js"() {
16309
16183
  "use strict";
16310
- init_cjs_shims();
16311
16184
  init_trace();
16312
16185
  trace = TraceAPI.getInstance();
16313
16186
  }
@@ -16349,7 +16222,6 @@ var esm_default;
16349
16222
  var init_esm = __esm({
16350
16223
  "../../node_modules/@opentelemetry/api/build/esm/index.js"() {
16351
16224
  "use strict";
16352
- init_cjs_shims();
16353
16225
  init_utils();
16354
16226
  init_context();
16355
16227
  init_consoleLogger();
@@ -16387,8 +16259,8 @@ function sanitize(input) {
16387
16259
  }
16388
16260
  function markerFileExists() {
16389
16261
  try {
16390
- const fs4 = require("fs");
16391
- const path4 = require("path");
16262
+ const fs4 = require("node:fs");
16263
+ const path4 = require("node:path");
16392
16264
  const markerPath = path4.join(process.cwd(), ".glasstrace", "mcp-connected");
16393
16265
  return fs4.existsSync(markerPath);
16394
16266
  } catch {
@@ -16417,13 +16289,32 @@ function maybeShowMcpNudge(errorSummary) {
16417
16289
  `
16418
16290
  );
16419
16291
  }
16420
- var hasFired;
16292
+ function maybeShowServerActionNudge() {
16293
+ if (hasFiredServerAction) {
16294
+ return;
16295
+ }
16296
+ if (process.env.GLASSTRACE_SUPPRESS_ACTION_NUDGE === "1") {
16297
+ hasFiredServerAction = true;
16298
+ return;
16299
+ }
16300
+ const config2 = resolveConfig();
16301
+ if (isProductionDisabled(config2)) {
16302
+ hasFiredServerAction = true;
16303
+ return;
16304
+ }
16305
+ hasFiredServerAction = true;
16306
+ process.stderr.write(
16307
+ `[glasstrace] Detected a Next.js Server Action trace. Install the Glasstrace browser extension to capture the Server Action identifier for precise action-level debugging. https://glasstrace.dev/ext
16308
+ `
16309
+ );
16310
+ }
16311
+ var hasFired, hasFiredServerAction;
16421
16312
  var init_error_nudge = __esm({
16422
16313
  "src/nudge/error-nudge.ts"() {
16423
16314
  "use strict";
16424
- init_cjs_shims();
16425
16315
  init_env_detection();
16426
16316
  hasFired = false;
16317
+ hasFiredServerAction = false;
16427
16318
  }
16428
16319
  });
16429
16320
 
@@ -16494,7 +16385,6 @@ var isGlasstraceLog, originalError, originalWarn, installed, otelApi;
16494
16385
  var init_console_capture = __esm({
16495
16386
  "src/console-capture.ts"() {
16496
16387
  "use strict";
16497
- init_cjs_shims();
16498
16388
  init_error_nudge();
16499
16389
  isGlasstraceLog = false;
16500
16390
  originalError = null;
@@ -16825,11 +16715,10 @@ var fs2, path2, crypto2, import_node_child_process, LARGE_FILE_WARNING_BYTES, PR
16825
16715
  var init_source_map_uploader = __esm({
16826
16716
  "src/source-map-uploader.ts"() {
16827
16717
  "use strict";
16828
- init_cjs_shims();
16829
- fs2 = __toESM(require("fs/promises"), 1);
16830
- path2 = __toESM(require("path"), 1);
16831
- crypto2 = __toESM(require("crypto"), 1);
16832
- import_node_child_process = require("child_process");
16718
+ fs2 = __toESM(require("node:fs/promises"), 1);
16719
+ path2 = __toESM(require("node:path"), 1);
16720
+ crypto2 = __toESM(require("node:crypto"), 1);
16721
+ import_node_child_process = require("node:child_process");
16833
16722
  init_console_capture();
16834
16723
  init_dist();
16835
16724
  LARGE_FILE_WARNING_BYTES = 50 * 1024 * 1024;
@@ -16847,6 +16736,7 @@ __export(src_exports, {
16847
16736
  SdkError: () => SdkError,
16848
16737
  SessionManager: () => SessionManager,
16849
16738
  buildImportGraph: () => buildImportGraph,
16739
+ captureCorrelationId: () => captureCorrelationId,
16850
16740
  captureError: () => captureError,
16851
16741
  classifyFetchTarget: () => classifyFetchTarget,
16852
16742
  collectSourceMaps: () => collectSourceMaps,
@@ -16882,10 +16772,8 @@ __export(src_exports, {
16882
16772
  withGlasstraceConfig: () => withGlasstraceConfig
16883
16773
  });
16884
16774
  module.exports = __toCommonJS(src_exports);
16885
- init_cjs_shims();
16886
16775
 
16887
16776
  // src/errors.ts
16888
- init_cjs_shims();
16889
16777
  var SdkError = class extends Error {
16890
16778
  code;
16891
16779
  constructor(code, message, cause) {
@@ -16899,7 +16787,6 @@ var SdkError = class extends Error {
16899
16787
  init_env_detection();
16900
16788
 
16901
16789
  // src/session.ts
16902
- init_cjs_shims();
16903
16790
  init_dist();
16904
16791
  var FOUR_HOURS_MS = 4 * 60 * 60 * 1e3;
16905
16792
  var hashFn = null;
@@ -16915,7 +16802,7 @@ function fnv1aHash(input) {
16915
16802
  function getHashFn() {
16916
16803
  if (hashFn) return hashFn;
16917
16804
  try {
16918
- const { createHash: createHash3 } = require("crypto");
16805
+ const { createHash: createHash3 } = require("node:crypto");
16919
16806
  hashFn = (input) => createHash3("sha256").update(input).digest("hex").slice(0, 16);
16920
16807
  } catch {
16921
16808
  hashFn = (input) => {
@@ -16991,7 +16878,6 @@ var SessionManager = class {
16991
16878
  };
16992
16879
 
16993
16880
  // src/fetch-classifier.ts
16994
- init_cjs_shims();
16995
16881
  var cachedPort2 = process.env.PORT ?? "3000";
16996
16882
  function classifyFetchTarget(url2) {
16997
16883
  let parsed;
@@ -17017,7 +16903,6 @@ function classifyFetchTarget(url2) {
17017
16903
  }
17018
16904
 
17019
16905
  // src/anon-key.ts
17020
- init_cjs_shims();
17021
16906
  init_dist();
17022
16907
  var GLASSTRACE_DIR = ".glasstrace";
17023
16908
  var ANON_KEY_FILE = "anon_key";
@@ -17026,8 +16911,8 @@ async function loadFsPath() {
17026
16911
  if (fsPathCache !== void 0) return fsPathCache;
17027
16912
  try {
17028
16913
  const [fs4, path4] = await Promise.all([
17029
- import("fs/promises"),
17030
- import("path")
16914
+ import("node:fs/promises"),
16915
+ import("node:path")
17031
16916
  ]);
17032
16917
  fsPathCache = { fs: fs4, path: path4 };
17033
16918
  return fsPathCache;
@@ -17107,11 +16992,9 @@ async function getOrCreateAnonKey(projectRoot) {
17107
16992
  }
17108
16993
 
17109
16994
  // src/init-client.ts
17110
- init_cjs_shims();
17111
16995
  init_dist();
17112
16996
 
17113
16997
  // src/health-collector.ts
17114
- init_cjs_shims();
17115
16998
  var tracesExported = 0;
17116
16999
  var tracesDropped = 0;
17117
17000
  var initFailures = 0;
@@ -17163,6 +17046,238 @@ function acknowledgeHealthReport(report) {
17163
17046
  initFailures = Number.isFinite(failVal) ? Math.max(0, failVal) : initFailures;
17164
17047
  }
17165
17048
 
17049
+ // src/https-transport.ts
17050
+ var import_node_https = require("node:https");
17051
+ var import_node_http = require("node:http");
17052
+ var import_node_url = require("node:url");
17053
+ var HttpsTransportError = class extends Error {
17054
+ kind = "transport";
17055
+ cause;
17056
+ constructor(message, cause) {
17057
+ super(message);
17058
+ this.name = "HttpsTransportError";
17059
+ this.cause = cause;
17060
+ }
17061
+ };
17062
+ var HttpsStatusError = class extends Error {
17063
+ kind = "status";
17064
+ status;
17065
+ /** Raw response body text (may be truncated by caller if large). */
17066
+ body;
17067
+ constructor(status, body) {
17068
+ super(`Server returned HTTP ${status}`);
17069
+ this.name = "HttpsStatusError";
17070
+ this.status = status;
17071
+ this.body = body;
17072
+ }
17073
+ };
17074
+ var HttpsBodyParseError = class extends Error {
17075
+ kind = "parse";
17076
+ status;
17077
+ cause;
17078
+ constructor(status, cause) {
17079
+ super(`Server returned malformed response (HTTP ${status})`);
17080
+ this.name = "HttpsBodyParseError";
17081
+ this.status = status;
17082
+ this.cause = cause;
17083
+ }
17084
+ };
17085
+ var DEFAULT_TIMEOUT_MS = 1e4;
17086
+ var DEFAULT_RETRY_DELAYS_MS = [500, 1500];
17087
+ var DEFAULT_TOTAL_DEADLINE_MS = 2e4;
17088
+ async function httpsPostJson(url2, jsonBody, options) {
17089
+ const parsed = new import_node_url.URL(url2);
17090
+ const isHttps = parsed.protocol === "https:";
17091
+ const isHttp = parsed.protocol === "http:";
17092
+ if (!isHttps && !isHttp) {
17093
+ throw new HttpsTransportError(
17094
+ `Unsupported protocol: ${parsed.protocol} (expected http: or https:)`
17095
+ );
17096
+ }
17097
+ const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
17098
+ const maxAttempts = options.maxAttempts ?? 3;
17099
+ const retryDelaysMs = options.retryDelaysMs ?? DEFAULT_RETRY_DELAYS_MS;
17100
+ const totalDeadlineMs = options.totalDeadlineMs ?? DEFAULT_TOTAL_DEADLINE_MS;
17101
+ const scheduler = options.scheduler ?? ((fn, ms) => setTimeout(fn, ms));
17102
+ const requestImpl = isHttps ? options.requestImpl ?? import_node_https.request : options.httpRequestImpl ?? import_node_http.request;
17103
+ let payload;
17104
+ try {
17105
+ payload = JSON.stringify(jsonBody);
17106
+ } catch (err) {
17107
+ throw new HttpsTransportError(
17108
+ `Failed to serialize request body: ${err instanceof Error ? err.message : String(err)}`,
17109
+ err
17110
+ );
17111
+ }
17112
+ const payloadBuffer = Buffer.from(payload, "utf-8");
17113
+ const startedAt = Date.now();
17114
+ let lastError;
17115
+ for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
17116
+ if (options.signal?.aborted) {
17117
+ throw new HttpsTransportError("Request aborted");
17118
+ }
17119
+ const elapsed = Date.now() - startedAt;
17120
+ if (elapsed >= totalDeadlineMs) {
17121
+ break;
17122
+ }
17123
+ const remainingBudget = totalDeadlineMs - elapsed;
17124
+ const attemptTimeoutMs = Math.min(timeoutMs, remainingBudget);
17125
+ try {
17126
+ return await sendSingleRequest(
17127
+ parsed,
17128
+ payloadBuffer,
17129
+ options.headers,
17130
+ attemptTimeoutMs,
17131
+ options.signal,
17132
+ requestImpl
17133
+ );
17134
+ } catch (err) {
17135
+ lastError = err;
17136
+ if (err instanceof HttpsStatusError || err instanceof HttpsBodyParseError) {
17137
+ throw err;
17138
+ }
17139
+ const isLast = attempt === maxAttempts - 1;
17140
+ if (isLast) break;
17141
+ const delayMs = retryDelaysMs[attempt] ?? retryDelaysMs[retryDelaysMs.length - 1] ?? 0;
17142
+ const elapsedBeforeSleep = Date.now() - startedAt;
17143
+ const remaining = totalDeadlineMs - elapsedBeforeSleep;
17144
+ if (remaining <= 0) break;
17145
+ const actualDelayMs = Math.min(delayMs, remaining);
17146
+ await sleep(actualDelayMs, scheduler, options.signal);
17147
+ }
17148
+ }
17149
+ if (lastError instanceof HttpsTransportError) throw lastError;
17150
+ throw new HttpsTransportError(
17151
+ lastError instanceof Error ? lastError.message : "Request failed",
17152
+ lastError
17153
+ );
17154
+ }
17155
+ function sendSingleRequest(url2, payload, headers, timeoutMs, signal, requestImpl) {
17156
+ return new Promise((resolve3, reject) => {
17157
+ const finalHeaders = {
17158
+ ...headers,
17159
+ "Content-Length": payload.byteLength
17160
+ };
17161
+ const reqOptions = {
17162
+ method: "POST",
17163
+ hostname: url2.hostname,
17164
+ port: url2.port === "" ? void 0 : Number(url2.port),
17165
+ path: `${url2.pathname}${url2.search}`,
17166
+ headers: finalHeaders,
17167
+ // Explicit timeout at the socket level. Still complemented by a
17168
+ // manual timer below because `timeout` only fires when the socket
17169
+ // is idle — it does not cover "TLS handshake hangs forever".
17170
+ timeout: timeoutMs
17171
+ };
17172
+ let settled = false;
17173
+ let cleanup = () => {
17174
+ };
17175
+ const settle = (fn) => {
17176
+ if (settled) return;
17177
+ settled = true;
17178
+ cleanup();
17179
+ fn();
17180
+ };
17181
+ const req = requestImpl(reqOptions, (res) => {
17182
+ const chunks = [];
17183
+ res.on("data", (chunk) => {
17184
+ chunks.push(typeof chunk === "string" ? Buffer.from(chunk, "utf-8") : chunk);
17185
+ });
17186
+ res.on("end", () => {
17187
+ const raw = Buffer.concat(chunks).toString("utf-8");
17188
+ const status = res.statusCode ?? 0;
17189
+ if (status < 200 || status >= 300) {
17190
+ settle(() => reject(new HttpsStatusError(status, raw)));
17191
+ return;
17192
+ }
17193
+ if (status === 204 || raw.length === 0) {
17194
+ settle(() => resolve3({ status, body: void 0, raw }));
17195
+ return;
17196
+ }
17197
+ try {
17198
+ const parsed = JSON.parse(raw);
17199
+ settle(() => resolve3({ status, body: parsed, raw }));
17200
+ } catch (err) {
17201
+ settle(() => reject(new HttpsBodyParseError(status, err)));
17202
+ }
17203
+ });
17204
+ res.on("error", (err) => {
17205
+ settle(() => reject(new HttpsTransportError(`Response stream error: ${err.message}`, err)));
17206
+ });
17207
+ });
17208
+ const timer = setTimeout(() => {
17209
+ settle(() => {
17210
+ req.destroy(new Error("Request timed out"));
17211
+ reject(new HttpsTransportError(`Request timed out after ${timeoutMs}ms`));
17212
+ });
17213
+ }, timeoutMs);
17214
+ if (typeof timer.unref === "function") timer.unref();
17215
+ const onAbort = () => {
17216
+ settle(() => {
17217
+ req.destroy(new Error("Aborted"));
17218
+ reject(new HttpsTransportError("Request aborted"));
17219
+ });
17220
+ };
17221
+ cleanup = () => {
17222
+ clearTimeout(timer);
17223
+ if (signal !== void 0) {
17224
+ signal.removeEventListener("abort", onAbort);
17225
+ }
17226
+ };
17227
+ req.on("error", (err) => {
17228
+ settle(() => reject(new HttpsTransportError(`fetch failed: ${err.message}`, err)));
17229
+ });
17230
+ req.on("timeout", () => {
17231
+ settle(() => {
17232
+ req.destroy(new Error("Request timed out"));
17233
+ reject(new HttpsTransportError(`Request timed out after ${timeoutMs}ms`));
17234
+ });
17235
+ });
17236
+ if (signal !== void 0) {
17237
+ if (signal.aborted) {
17238
+ req.destroy(new Error("Aborted"));
17239
+ settle(() => reject(new HttpsTransportError("Request aborted")));
17240
+ return;
17241
+ }
17242
+ signal.addEventListener("abort", onAbort, { once: true });
17243
+ }
17244
+ req.end(payload);
17245
+ });
17246
+ }
17247
+ function sleep(ms, scheduler, signal) {
17248
+ return new Promise((resolve3, reject) => {
17249
+ let settled = false;
17250
+ let cleanup = () => {
17251
+ };
17252
+ const settle = (fn) => {
17253
+ if (settled) return;
17254
+ settled = true;
17255
+ cleanup();
17256
+ fn();
17257
+ };
17258
+ const onAbort = () => {
17259
+ settle(() => reject(new HttpsTransportError("Request aborted")));
17260
+ };
17261
+ const timer = scheduler(() => {
17262
+ settle(resolve3);
17263
+ }, ms);
17264
+ if (typeof timer.unref === "function") timer.unref();
17265
+ cleanup = () => {
17266
+ clearTimeout(timer);
17267
+ if (signal !== void 0) {
17268
+ signal.removeEventListener("abort", onAbort);
17269
+ }
17270
+ };
17271
+ if (signal !== void 0) {
17272
+ if (signal.aborted) {
17273
+ onAbort();
17274
+ return;
17275
+ }
17276
+ signal.addEventListener("abort", onAbort, { once: true });
17277
+ }
17278
+ });
17279
+ }
17280
+
17166
17281
  // src/init-client.ts
17167
17282
  var GLASSTRACE_DIR2 = ".glasstrace";
17168
17283
  var CONFIG_FILE = "config";
@@ -17173,8 +17288,8 @@ async function loadFsPathAsync() {
17173
17288
  if (fsPathAsyncCache !== void 0) return fsPathAsyncCache;
17174
17289
  try {
17175
17290
  const [fs4, path4] = await Promise.all([
17176
- import("fs/promises"),
17177
- import("path")
17291
+ import("node:fs/promises"),
17292
+ import("node:path")
17178
17293
  ]);
17179
17294
  fsPathAsyncCache = { fs: fs4, path: path4 };
17180
17295
  return fsPathAsyncCache;
@@ -17185,13 +17300,14 @@ async function loadFsPathAsync() {
17185
17300
  }
17186
17301
  function loadFsSyncOrNull() {
17187
17302
  try {
17188
- const fs4 = require("fs");
17189
- const path4 = require("path");
17303
+ const fs4 = require("node:fs");
17304
+ const path4 = require("node:path");
17190
17305
  return { readFileSync: fs4.readFileSync, join: path4.join };
17191
17306
  } catch {
17192
17307
  return null;
17193
17308
  }
17194
17309
  }
17310
+ var transportOverride = null;
17195
17311
  var currentConfig = null;
17196
17312
  var configCacheChecked = false;
17197
17313
  var rateLimitBackoff = false;
@@ -17281,26 +17397,34 @@ async function sendInitRequest(config2, anonKey, sdkVersion, importGraph, health
17281
17397
  payload.diagnostics = diagnostics;
17282
17398
  }
17283
17399
  const url2 = `${config2.endpoint}/v1/sdk/init`;
17284
- const response = await fetch(url2, {
17285
- method: "POST",
17286
- headers: {
17287
- "Content-Type": "application/json",
17288
- Authorization: `Bearer ${effectiveKey}`
17289
- },
17290
- body: JSON.stringify(payload),
17291
- signal
17292
- });
17293
- if (!response.ok) {
17294
- try {
17295
- await response.text();
17296
- } catch {
17400
+ const transport = transportOverride ?? httpsPostJson;
17401
+ let result;
17402
+ try {
17403
+ result = await transport(url2, payload, {
17404
+ headers: {
17405
+ "Content-Type": "application/json",
17406
+ Authorization: `Bearer ${effectiveKey}`
17407
+ },
17408
+ timeoutMs: INIT_TIMEOUT_MS,
17409
+ signal
17410
+ });
17411
+ } catch (err) {
17412
+ if (err instanceof HttpsStatusError) {
17413
+ const error48 = new Error(`Init request failed with status ${err.status}`);
17414
+ error48.status = err.status;
17415
+ throw error48;
17297
17416
  }
17298
- const error48 = new Error(`Init request failed with status ${response.status}`);
17299
- error48.status = response.status;
17300
- throw error48;
17417
+ if (err instanceof HttpsBodyParseError) {
17418
+ const cause = err.cause;
17419
+ if (cause instanceof SyntaxError) throw cause;
17420
+ throw err;
17421
+ }
17422
+ if (err instanceof HttpsTransportError) {
17423
+ throw err;
17424
+ }
17425
+ throw err;
17301
17426
  }
17302
- const body = await response.json();
17303
- return SdkInitResponseSchema.parse(body);
17427
+ return SdkInitResponseSchema.parse(result.body);
17304
17428
  }
17305
17429
  async function writeClaimedKey(newApiKey, projectRoot) {
17306
17430
  const modules = await loadFsPathAsync();
@@ -17389,8 +17513,6 @@ async function performInit(config2, anonKey, sdkVersion, healthReport) {
17389
17513
  console.warn("[glasstrace] No API key available for init request.");
17390
17514
  return null;
17391
17515
  }
17392
- const controller = new AbortController();
17393
- const timeoutId = setTimeout(() => controller.abort(), INIT_TIMEOUT_MS);
17394
17516
  try {
17395
17517
  const result = await sendInitRequest(
17396
17518
  config2,
@@ -17398,10 +17520,8 @@ async function performInit(config2, anonKey, sdkVersion, healthReport) {
17398
17520
  sdkVersion,
17399
17521
  void 0,
17400
17522
  healthReport ?? void 0,
17401
- void 0,
17402
- controller.signal
17523
+ void 0
17403
17524
  );
17404
- clearTimeout(timeoutId);
17405
17525
  currentConfig = result;
17406
17526
  recordConfigSync(Date.now());
17407
17527
  if (healthReport) {
@@ -17418,10 +17538,13 @@ async function performInit(config2, anonKey, sdkVersion, healthReport) {
17418
17538
  }
17419
17539
  return null;
17420
17540
  } catch (err) {
17421
- clearTimeout(timeoutId);
17422
17541
  recordInitFailure();
17423
- if (err instanceof DOMException && err.name === "AbortError") {
17424
- console.warn("[glasstrace] ingestion_unreachable: Init request timed out.");
17542
+ if (err instanceof HttpsTransportError) {
17543
+ if (/timed out|aborted/i.test(err.message)) {
17544
+ console.warn("[glasstrace] ingestion_unreachable: Init request timed out.");
17545
+ } else {
17546
+ console.warn(`[glasstrace] ingestion_unreachable: ${err.message}`);
17547
+ }
17425
17548
  return null;
17426
17549
  }
17427
17550
  const status = err.status;
@@ -17495,7 +17618,6 @@ function didLastInitSucceed() {
17495
17618
  }
17496
17619
 
17497
17620
  // src/span-processor.ts
17498
- init_cjs_shims();
17499
17621
  var GlasstraceSpanProcessor = class {
17500
17622
  wrappedProcessor;
17501
17623
  /* eslint-disable @typescript-eslint/no-unused-vars -- backward compat signature */
@@ -17517,10 +17639,10 @@ var GlasstraceSpanProcessor = class {
17517
17639
  };
17518
17640
 
17519
17641
  // src/enriching-exporter.ts
17520
- init_cjs_shims();
17521
17642
  init_esm();
17522
17643
  init_dist();
17523
17644
  init_console_capture();
17645
+ init_error_nudge();
17524
17646
  var ATTR = GLASSTRACE_ATTRIBUTE_NAMES;
17525
17647
  var API_KEY_PENDING = "pending";
17526
17648
  var MAX_PENDING_SPANS = 1024;
@@ -17639,7 +17761,8 @@ var GlasstraceExporter = class {
17639
17761
  if (typeof existingCid === "string") {
17640
17762
  extra[ATTR.CORRELATION_ID] = existingCid;
17641
17763
  }
17642
- const route = attrs["http.route"] ?? name;
17764
+ const rawRoute = attrs["http.route"];
17765
+ const route = typeof rawRoute === "string" ? rawRoute : name;
17643
17766
  if (route) {
17644
17767
  extra[ATTR.ROUTE] = route;
17645
17768
  }
@@ -17663,6 +17786,17 @@ var GlasstraceExporter = class {
17663
17786
  if (method) {
17664
17787
  extra[ATTR.HTTP_METHOD] = method;
17665
17788
  }
17789
+ const actionRoute = extractLeadingPath(route);
17790
+ if (method === "POST" && actionRoute) {
17791
+ const isApiRoute = actionRoute === "/api" || actionRoute.startsWith("/api/");
17792
+ const isInternalRoute = actionRoute.startsWith("/_next/");
17793
+ if (!isApiRoute && !isInternalRoute) {
17794
+ extra[ATTR.NEXT_ACTION_DETECTED] = true;
17795
+ if (typeof extra[ATTR.CORRELATION_ID] !== "string") {
17796
+ maybeShowServerActionNudge();
17797
+ }
17798
+ }
17799
+ }
17666
17800
  const statusCode = attrs["http.status_code"] ?? attrs["http.response.status_code"];
17667
17801
  if (statusCode !== void 0) {
17668
17802
  extra[ATTR.HTTP_STATUS_CODE] = statusCode;
@@ -17871,6 +18005,21 @@ function getExceptionEventDetails(span) {
17871
18005
  message: typeof message === "string" ? message : void 0
17872
18006
  };
17873
18007
  }
18008
+ function extractLeadingPath(raw) {
18009
+ if (!raw) return void 0;
18010
+ const trimmed = raw.trim();
18011
+ if (trimmed.length === 0) return void 0;
18012
+ if (trimmed.startsWith("/")) {
18013
+ const firstSpace = trimmed.indexOf(" ");
18014
+ return firstSpace === -1 ? trimmed : trimmed.slice(0, firstSpace);
18015
+ }
18016
+ for (const token of trimmed.split(/\s+/)) {
18017
+ if (token.startsWith("/")) {
18018
+ return token;
18019
+ }
18020
+ }
18021
+ return void 0;
18022
+ }
17874
18023
  function deriveOrmProvider(instrumentationName) {
17875
18024
  const lower = instrumentationName.toLowerCase();
17876
18025
  if (lower.includes("prisma")) {
@@ -17899,7 +18048,6 @@ function deriveErrorCategory(errorType) {
17899
18048
  }
17900
18049
 
17901
18050
  // src/discovery-endpoint.ts
17902
- init_cjs_shims();
17903
18051
  function isAllowedOrigin(origin) {
17904
18052
  if (origin === null) return true;
17905
18053
  if (origin.startsWith("chrome-extension://")) return true;
@@ -17989,29 +18137,9 @@ function createDiscoveryHandler(getAnonKey, getSessionId, getClaimState) {
17989
18137
  }
17990
18138
 
17991
18139
  // src/register.ts
17992
- init_cjs_shims();
17993
18140
  init_env_detection();
17994
18141
 
17995
- // src/otel-config.ts
17996
- init_cjs_shims();
17997
-
17998
- // ../../node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/index.js
17999
- init_cjs_shims();
18000
-
18001
- // ../../node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/platform/index.js
18002
- init_cjs_shims();
18003
-
18004
- // ../../node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/platform/node/index.js
18005
- init_cjs_shims();
18006
-
18007
- // ../../node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/platform/node/OTLPTraceExporter.js
18008
- init_cjs_shims();
18009
-
18010
- // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/index.js
18011
- init_cjs_shims();
18012
-
18013
18142
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/OTLPExporterBase.js
18014
- init_cjs_shims();
18015
18143
  var OTLPExporterBase = class {
18016
18144
  _delegate;
18017
18145
  constructor(delegate) {
@@ -18034,7 +18162,6 @@ var OTLPExporterBase = class {
18034
18162
  };
18035
18163
 
18036
18164
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/types.js
18037
- init_cjs_shims();
18038
18165
  var OTLPExporterError = class extends Error {
18039
18166
  code;
18040
18167
  name = "OTLPExporterError";
@@ -18047,7 +18174,6 @@ var OTLPExporterError = class extends Error {
18047
18174
  };
18048
18175
 
18049
18176
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/shared-configuration.js
18050
- init_cjs_shims();
18051
18177
  function validateTimeoutMillis(timeoutMillis) {
18052
18178
  if (Number.isFinite(timeoutMillis) && timeoutMillis > 0) {
18053
18179
  return timeoutMillis;
@@ -18076,7 +18202,6 @@ function getSharedConfigurationDefaults() {
18076
18202
  }
18077
18203
 
18078
18204
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/bounded-queue-export-promise-handler.js
18079
- init_cjs_shims();
18080
18205
  var BoundedQueueExportPromiseHandler = class {
18081
18206
  _concurrencyLimit;
18082
18207
  _sendingPromises = [];
@@ -18108,14 +18233,7 @@ function createBoundedQueueExportPromiseHandler(options) {
18108
18233
  return new BoundedQueueExportPromiseHandler(options.concurrencyLimit);
18109
18234
  }
18110
18235
 
18111
- // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-export-delegate.js
18112
- init_cjs_shims();
18113
-
18114
- // ../../node_modules/@opentelemetry/core/build/esm/index.js
18115
- init_cjs_shims();
18116
-
18117
18236
  // ../../node_modules/@opentelemetry/core/build/esm/trace/suppress-tracing.js
18118
- init_cjs_shims();
18119
18237
  init_esm();
18120
18238
  var SUPPRESS_TRACING_KEY = createContextKey("OpenTelemetry SDK Context Key SUPPRESS_TRACING");
18121
18239
  function suppressTracing(context2) {
@@ -18126,13 +18244,11 @@ function isTracingSuppressed(context2) {
18126
18244
  }
18127
18245
 
18128
18246
  // ../../node_modules/@opentelemetry/core/build/esm/baggage/constants.js
18129
- init_cjs_shims();
18130
18247
  var BAGGAGE_KEY_PAIR_SEPARATOR = "=";
18131
18248
  var BAGGAGE_PROPERTIES_SEPARATOR = ";";
18132
18249
  var BAGGAGE_ITEMS_SEPARATOR = ",";
18133
18250
 
18134
18251
  // ../../node_modules/@opentelemetry/core/build/esm/baggage/utils.js
18135
- init_cjs_shims();
18136
18252
  init_esm();
18137
18253
  function parsePairKeyValue(entry) {
18138
18254
  if (!entry)
@@ -18175,7 +18291,6 @@ function parseKeyPairsIntoRecord(value) {
18175
18291
  }
18176
18292
 
18177
18293
  // ../../node_modules/@opentelemetry/core/build/esm/common/attributes.js
18178
- init_cjs_shims();
18179
18294
  init_esm();
18180
18295
  function sanitizeAttributes(attributes) {
18181
18296
  const out = {};
@@ -18245,11 +18360,7 @@ function isValidPrimitiveAttributeValueType(valType) {
18245
18360
  return false;
18246
18361
  }
18247
18362
 
18248
- // ../../node_modules/@opentelemetry/core/build/esm/common/global-error-handler.js
18249
- init_cjs_shims();
18250
-
18251
18363
  // ../../node_modules/@opentelemetry/core/build/esm/common/logging-error-handler.js
18252
- init_cjs_shims();
18253
18364
  init_esm();
18254
18365
  function loggingErrorHandler() {
18255
18366
  return (ex) => {
@@ -18289,17 +18400,7 @@ function globalErrorHandler(ex) {
18289
18400
  }
18290
18401
  }
18291
18402
 
18292
- // ../../node_modules/@opentelemetry/core/build/esm/common/time.js
18293
- init_cjs_shims();
18294
-
18295
- // ../../node_modules/@opentelemetry/core/build/esm/platform/index.js
18296
- init_cjs_shims();
18297
-
18298
- // ../../node_modules/@opentelemetry/core/build/esm/platform/node/index.js
18299
- init_cjs_shims();
18300
-
18301
18403
  // ../../node_modules/@opentelemetry/core/build/esm/platform/node/environment.js
18302
- init_cjs_shims();
18303
18404
  init_esm();
18304
18405
  var import_util3 = require("util");
18305
18406
  function getNumberFromEnv(key) {
@@ -18322,15 +18423,10 @@ function getStringFromEnv(key) {
18322
18423
  return raw;
18323
18424
  }
18324
18425
 
18325
- // ../../node_modules/@opentelemetry/core/build/esm/platform/node/sdk-info.js
18326
- init_cjs_shims();
18327
-
18328
18426
  // ../../node_modules/@opentelemetry/core/build/esm/version.js
18329
- init_cjs_shims();
18330
18427
  var VERSION2 = "2.6.1";
18331
18428
 
18332
18429
  // ../../node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js
18333
- init_cjs_shims();
18334
18430
  var ATTR_EXCEPTION_MESSAGE = "exception.message";
18335
18431
  var ATTR_EXCEPTION_STACKTRACE = "exception.stacktrace";
18336
18432
  var ATTR_EXCEPTION_TYPE = "exception.type";
@@ -18341,7 +18437,6 @@ var ATTR_TELEMETRY_SDK_NAME = "telemetry.sdk.name";
18341
18437
  var ATTR_TELEMETRY_SDK_VERSION = "telemetry.sdk.version";
18342
18438
 
18343
18439
  // ../../node_modules/@opentelemetry/core/build/esm/semconv.js
18344
- init_cjs_shims();
18345
18440
  var ATTR_PROCESS_RUNTIME_NAME = "process.runtime.name";
18346
18441
 
18347
18442
  // ../../node_modules/@opentelemetry/core/build/esm/platform/node/sdk-info.js
@@ -18399,18 +18494,13 @@ function addHrTimes(time1, time22) {
18399
18494
  }
18400
18495
 
18401
18496
  // ../../node_modules/@opentelemetry/core/build/esm/ExportResult.js
18402
- init_cjs_shims();
18403
18497
  var ExportResultCode;
18404
18498
  (function(ExportResultCode2) {
18405
18499
  ExportResultCode2[ExportResultCode2["SUCCESS"] = 0] = "SUCCESS";
18406
18500
  ExportResultCode2[ExportResultCode2["FAILED"] = 1] = "FAILED";
18407
18501
  })(ExportResultCode || (ExportResultCode = {}));
18408
18502
 
18409
- // ../../node_modules/@opentelemetry/core/build/esm/utils/merge.js
18410
- init_cjs_shims();
18411
-
18412
18503
  // ../../node_modules/@opentelemetry/core/build/esm/utils/lodash.merge.js
18413
- init_cjs_shims();
18414
18504
  var objectTag = "[object Object]";
18415
18505
  var nullTag = "[object Null]";
18416
18506
  var undefinedTag = "[object Undefined]";
@@ -18570,11 +18660,7 @@ function shouldMerge(one, two) {
18570
18660
  return true;
18571
18661
  }
18572
18662
 
18573
- // ../../node_modules/@opentelemetry/core/build/esm/utils/callback.js
18574
- init_cjs_shims();
18575
-
18576
18663
  // ../../node_modules/@opentelemetry/core/build/esm/utils/promise.js
18577
- init_cjs_shims();
18578
18664
  var Deferred = class {
18579
18665
  _promise;
18580
18666
  _resolve;
@@ -18626,7 +18712,6 @@ var BindOnceFuture = class {
18626
18712
  };
18627
18713
 
18628
18714
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/logging-response-handler.js
18629
- init_cjs_shims();
18630
18715
  init_esm();
18631
18716
  function isPartialSuccessResponse(response) {
18632
18717
  return Object.prototype.hasOwnProperty.call(response, "partialSuccess");
@@ -18726,11 +18811,7 @@ function createOtlpExportDelegate(components, settings) {
18726
18811
  return new OTLPExportDelegate(components.transport, components.serializer, createLoggingPartialSuccessResponseHandler(), components.promiseHandler, settings.timeout);
18727
18812
  }
18728
18813
 
18729
- // ../../node_modules/@opentelemetry/otlp-transformer/build/esm/index.js
18730
- init_cjs_shims();
18731
-
18732
18814
  // ../../node_modules/@opentelemetry/otlp-transformer/build/esm/common/internal.js
18733
- init_cjs_shims();
18734
18815
  function createResource(resource, encoder) {
18735
18816
  const result = {
18736
18817
  attributes: toAttributes(resource.attributes, encoder),
@@ -18791,7 +18872,6 @@ function toAnyValue(value, encoder) {
18791
18872
  }
18792
18873
 
18793
18874
  // ../../node_modules/@opentelemetry/otlp-transformer/build/esm/common/utils.js
18794
- init_cjs_shims();
18795
18875
  function hrTimeToNanos(hrTime2) {
18796
18876
  const NANOSECONDS = BigInt(1e9);
18797
18877
  return BigInt(Math.trunc(hrTime2[0])) * NANOSECONDS + BigInt(Math.trunc(hrTime2[1]));
@@ -18820,15 +18900,10 @@ var JSON_ENCODER = {
18820
18900
  }
18821
18901
  };
18822
18902
 
18823
- // ../../node_modules/@opentelemetry/resources/build/esm/index.js
18824
- init_cjs_shims();
18825
-
18826
18903
  // ../../node_modules/@opentelemetry/resources/build/esm/ResourceImpl.js
18827
- init_cjs_shims();
18828
18904
  init_esm();
18829
18905
 
18830
18906
  // ../../node_modules/@opentelemetry/resources/build/esm/default-service-name.js
18831
- init_cjs_shims();
18832
18907
  var serviceName;
18833
18908
  function defaultServiceName() {
18834
18909
  if (serviceName === void 0) {
@@ -18843,7 +18918,6 @@ function defaultServiceName() {
18843
18918
  }
18844
18919
 
18845
18920
  // ../../node_modules/@opentelemetry/resources/build/esm/utils.js
18846
- init_cjs_shims();
18847
18921
  var isPromiseLike = (val) => {
18848
18922
  return val !== null && typeof val === "object" && typeof val.then === "function";
18849
18923
  };
@@ -18971,7 +19045,6 @@ function mergeSchemaUrl(old, updating) {
18971
19045
  }
18972
19046
 
18973
19047
  // ../../node_modules/@opentelemetry/otlp-transformer/build/esm/trace/internal.js
18974
- init_cjs_shims();
18975
19048
  var SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK = 256;
18976
19049
  var SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = 512;
18977
19050
  function buildSpanFlagsFrom(traceFlags, isRemote) {
@@ -19084,11 +19157,7 @@ function spanRecordsToResourceSpans(readableSpans, encoder) {
19084
19157
  return out;
19085
19158
  }
19086
19159
 
19087
- // ../../node_modules/@opentelemetry/otlp-transformer/build/esm/trace/json/index.js
19088
- init_cjs_shims();
19089
-
19090
19160
  // ../../node_modules/@opentelemetry/otlp-transformer/build/esm/trace/json/trace.js
19091
- init_cjs_shims();
19092
19161
  var JsonTraceSerializer = {
19093
19162
  serializeRequest: (arg) => {
19094
19163
  const request = createExportTraceServiceRequest(arg, JSON_ENCODER);
@@ -19104,17 +19173,7 @@ var JsonTraceSerializer = {
19104
19173
  }
19105
19174
  };
19106
19175
 
19107
- // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/index-node-http.js
19108
- init_cjs_shims();
19109
-
19110
- // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/otlp-node-http-configuration.js
19111
- init_cjs_shims();
19112
-
19113
- // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/otlp-http-configuration.js
19114
- init_cjs_shims();
19115
-
19116
19176
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/util.js
19117
- init_cjs_shims();
19118
19177
  init_esm();
19119
19178
  function validateAndNormalizeHeaders(partialHeaders) {
19120
19179
  const headers = {};
@@ -19197,19 +19256,11 @@ function getNodeHttpConfigurationDefaults(requiredHeaders, signalResourcePath) {
19197
19256
  };
19198
19257
  }
19199
19258
 
19200
- // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-http-export-delegate.js
19201
- init_cjs_shims();
19202
-
19203
- // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/transport/http-exporter-transport.js
19204
- init_cjs_shims();
19205
-
19206
19259
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/transport/http-transport-utils.js
19207
- init_cjs_shims();
19208
19260
  var zlib = __toESM(require("zlib"));
19209
19261
  var import_stream = require("stream");
19210
19262
 
19211
19263
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/is-export-retryable.js
19212
- init_cjs_shims();
19213
19264
  function isExportHTTPErrorRetryable(statusCode) {
19214
19265
  return statusCode === 429 || statusCode === 502 || statusCode === 503 || statusCode === 504;
19215
19266
  }
@@ -19229,7 +19280,6 @@ function parseRetryAfterToMills(retryAfter) {
19229
19280
  }
19230
19281
 
19231
19282
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/version.js
19232
- init_cjs_shims();
19233
19283
  var VERSION3 = "0.214.0";
19234
19284
 
19235
19285
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/transport/http-transport-utils.js
@@ -19387,7 +19437,6 @@ function createHttpExporterTransport(parameters) {
19387
19437
  }
19388
19438
 
19389
19439
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/retrying-transport.js
19390
- init_cjs_shims();
19391
19440
  init_esm();
19392
19441
  var MAX_ATTEMPTS = 5;
19393
19442
  var INITIAL_BACKOFF = 1e3;
@@ -19456,7 +19505,6 @@ function createOtlpHttpExportDelegate(options, serializer) {
19456
19505
  }
19457
19506
 
19458
19507
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/shared-env-configuration.js
19459
- init_cjs_shims();
19460
19508
  init_esm();
19461
19509
  function parseAndValidateTimeoutFromEnv(timeoutEnvVar) {
19462
19510
  const envTimeout = getNumberFromEnv(timeoutEnvVar);
@@ -19494,11 +19542,9 @@ function getSharedConfigurationFromEnvironment(signalIdentifier) {
19494
19542
  }
19495
19543
 
19496
19544
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/convert-legacy-node-http-options.js
19497
- init_cjs_shims();
19498
19545
  init_esm();
19499
19546
 
19500
19547
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/otlp-node-http-env-configuration.js
19501
- init_cjs_shims();
19502
19548
  var fs = __toESM(require("fs"));
19503
19549
  var path = __toESM(require("path"));
19504
19550
  init_esm();
@@ -19593,7 +19639,6 @@ function getNodeHttpConfigurationFromEnvironment(signalIdentifier, signalResourc
19593
19639
  }
19594
19640
 
19595
19641
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/convert-legacy-http-options.js
19596
- init_cjs_shims();
19597
19642
  function convertLegacyHeaders(config2) {
19598
19643
  if (typeof config2.headers === "function") {
19599
19644
  return config2.headers;
@@ -19640,22 +19685,13 @@ var OTLPTraceExporter = class extends OTLPExporterBase {
19640
19685
  }
19641
19686
  };
19642
19687
 
19643
- // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/index.js
19644
- init_cjs_shims();
19645
-
19646
- // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/BasicTracerProvider.js
19647
- init_cjs_shims();
19648
-
19649
19688
  // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/Tracer.js
19650
- init_cjs_shims();
19651
19689
  init_esm();
19652
19690
 
19653
19691
  // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/Span.js
19654
- init_cjs_shims();
19655
19692
  init_esm();
19656
19693
 
19657
19694
  // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/enums.js
19658
- init_cjs_shims();
19659
19695
  var ExceptionEventName = "exception";
19660
19696
 
19661
19697
  // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/Span.js
@@ -20007,18 +20043,10 @@ var SpanImpl = class {
20007
20043
  }
20008
20044
  };
20009
20045
 
20010
- // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/utility.js
20011
- init_cjs_shims();
20012
-
20013
20046
  // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/config.js
20014
- init_cjs_shims();
20015
20047
  init_esm();
20016
20048
 
20017
- // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/AlwaysOffSampler.js
20018
- init_cjs_shims();
20019
-
20020
20049
  // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/Sampler.js
20021
- init_cjs_shims();
20022
20050
  var SamplingDecision2;
20023
20051
  (function(SamplingDecision3) {
20024
20052
  SamplingDecision3[SamplingDecision3["NOT_RECORD"] = 0] = "NOT_RECORD";
@@ -20039,7 +20067,6 @@ var AlwaysOffSampler = class {
20039
20067
  };
20040
20068
 
20041
20069
  // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/AlwaysOnSampler.js
20042
- init_cjs_shims();
20043
20070
  var AlwaysOnSampler = class {
20044
20071
  shouldSample() {
20045
20072
  return {
@@ -20052,7 +20079,6 @@ var AlwaysOnSampler = class {
20052
20079
  };
20053
20080
 
20054
20081
  // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/ParentBasedSampler.js
20055
- init_cjs_shims();
20056
20082
  init_esm();
20057
20083
  var ParentBasedSampler = class {
20058
20084
  _root;
@@ -20093,7 +20119,6 @@ var ParentBasedSampler = class {
20093
20119
  };
20094
20120
 
20095
20121
  // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/TraceIdRatioBasedSampler.js
20096
- init_cjs_shims();
20097
20122
  init_esm();
20098
20123
  var TraceIdRatioBasedSampler = class {
20099
20124
  _ratio;
@@ -20216,17 +20241,7 @@ function reconfigureLimits(userConfig) {
20216
20241
  return Object.assign({}, userConfig, { spanLimits });
20217
20242
  }
20218
20243
 
20219
- // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/index.js
20220
- init_cjs_shims();
20221
-
20222
- // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/node/index.js
20223
- init_cjs_shims();
20224
-
20225
- // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/node/export/BatchSpanProcessor.js
20226
- init_cjs_shims();
20227
-
20228
20244
  // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/export/BatchSpanProcessorBase.js
20229
- init_cjs_shims();
20230
20245
  init_esm();
20231
20246
  var BatchSpanProcessorBase = class {
20232
20247
  _maxExportBatchSize;
@@ -20399,7 +20414,6 @@ var BatchSpanProcessor = class extends BatchSpanProcessorBase {
20399
20414
  };
20400
20415
 
20401
20416
  // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/node/RandomIdGenerator.js
20402
- init_cjs_shims();
20403
20417
  var SPAN_ID_BYTES = 8;
20404
20418
  var TRACE_ID_BYTES = 16;
20405
20419
  var RandomIdGenerator = class {
@@ -20431,11 +20445,7 @@ function getIdGenerator(bytes) {
20431
20445
  };
20432
20446
  }
20433
20447
 
20434
- // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/TracerMetrics.js
20435
- init_cjs_shims();
20436
-
20437
20448
  // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/semconv.js
20438
- init_cjs_shims();
20439
20449
  var ATTR_OTEL_SPAN_PARENT_ORIGIN = "otel.span.parent.origin";
20440
20450
  var ATTR_OTEL_SPAN_SAMPLING_RESULT = "otel.span.sampling_result";
20441
20451
  var METRIC_OTEL_SDK_SPAN_LIVE = "otel.sdk.span.live";
@@ -20495,7 +20505,6 @@ function samplingDecisionToString(decision) {
20495
20505
  }
20496
20506
 
20497
20507
  // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/version.js
20498
- init_cjs_shims();
20499
20508
  var VERSION4 = "2.6.1";
20500
20509
 
20501
20510
  // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/Tracer.js
@@ -20617,7 +20626,6 @@ var Tracer = class {
20617
20626
  };
20618
20627
 
20619
20628
  // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/MultiSpanProcessor.js
20620
- init_cjs_shims();
20621
20629
  var MultiSpanProcessor = class {
20622
20630
  _spanProcessors;
20623
20631
  constructor(spanProcessors) {
@@ -20742,8 +20750,7 @@ init_esm();
20742
20750
  init_console_capture();
20743
20751
 
20744
20752
  // src/lifecycle.ts
20745
- init_cjs_shims();
20746
- var import_node_events = require("events");
20753
+ var import_node_events = require("node:events");
20747
20754
  var CoreState = {
20748
20755
  IDLE: "IDLE",
20749
20756
  REGISTERING: "REGISTERING",
@@ -21088,9 +21095,9 @@ function registerBeforeExitTrigger() {
21088
21095
  }
21089
21096
 
21090
21097
  // src/coexistence.ts
21091
- init_cjs_shims();
21092
21098
  init_env_detection();
21093
21099
  init_console_capture();
21100
+ var GLASSTRACE_EXPORTER_BRAND = /* @__PURE__ */ Symbol.for("glasstrace.exporter");
21094
21101
  function createGlasstraceSpanProcessor(options) {
21095
21102
  const config2 = resolveConfig(options);
21096
21103
  const exporterUrl = `${config2.endpoint}/v1/traces`;
@@ -21101,13 +21108,64 @@ function createGlasstraceSpanProcessor(options) {
21101
21108
  getConfig: () => getActiveConfig(),
21102
21109
  environment: config2.environment,
21103
21110
  endpointUrl: exporterUrl,
21104
- createDelegate: createOtlpExporter
21111
+ createDelegate: createOtlpExporter,
21112
+ // Propagate verbose so exporter-level enrichment and export logs
21113
+ // stay observable whether the processor is built automatically by
21114
+ // the coexistence path or wired manually by the developer.
21115
+ verbose: config2.verbose
21105
21116
  });
21106
21117
  registerExporterForKeyNotification(exporter);
21107
21118
  return new BatchSpanProcessor(exporter, {
21108
21119
  scheduledDelayMillis: 1e3
21109
21120
  });
21110
21121
  }
21122
+ function isGlasstraceProcessorPresent(tracerProvider) {
21123
+ try {
21124
+ const proxy = tracerProvider;
21125
+ const delegate = typeof proxy.getDelegate === "function" ? proxy.getDelegate() : tracerProvider;
21126
+ const v2 = delegate;
21127
+ const v2Processors = v2._activeSpanProcessor?._spanProcessors;
21128
+ if (Array.isArray(v2Processors) && hasBrandedProcessor(v2Processors)) {
21129
+ return true;
21130
+ }
21131
+ const v1 = delegate;
21132
+ if (typeof v1.getActiveSpanProcessor === "function") {
21133
+ const active = v1.getActiveSpanProcessor();
21134
+ const processors = active?._spanProcessors;
21135
+ if (Array.isArray(processors) && hasBrandedProcessor(processors)) {
21136
+ return true;
21137
+ }
21138
+ }
21139
+ return false;
21140
+ } catch {
21141
+ return false;
21142
+ }
21143
+ }
21144
+ function tryAutoAttachGlasstraceProcessor(tracerProvider, options) {
21145
+ try {
21146
+ if (isGlasstraceProcessorPresent(tracerProvider)) {
21147
+ return "already_present";
21148
+ }
21149
+ const proxy = tracerProvider;
21150
+ const delegate = typeof proxy.getDelegate === "function" ? proxy.getDelegate() : tracerProvider;
21151
+ const withAdd = delegate;
21152
+ if (typeof withAdd.addSpanProcessor === "function") {
21153
+ const processor2 = createGlasstraceSpanProcessor(options);
21154
+ withAdd.addSpanProcessor(processor2);
21155
+ return { method: "v1_public", processor: processor2 };
21156
+ }
21157
+ const v2 = delegate;
21158
+ const multiProcessor = v2._activeSpanProcessor;
21159
+ if (!multiProcessor || !Array.isArray(multiProcessor._spanProcessors)) {
21160
+ return null;
21161
+ }
21162
+ const processor = createGlasstraceSpanProcessor(options);
21163
+ multiProcessor._spanProcessors.push(processor);
21164
+ return { method: "v2_private", processor };
21165
+ } catch {
21166
+ return null;
21167
+ }
21168
+ }
21111
21169
  function emitNudgeMessage() {
21112
21170
  const isSentry = detectSentry();
21113
21171
  if (isSentry) {
@@ -21176,6 +21234,12 @@ Add Glasstrace to your provider configuration:
21176
21234
  );
21177
21235
  }
21178
21236
  }
21237
+ function hasBrandedProcessor(processors) {
21238
+ return processors.some((p) => {
21239
+ const exporter = p._exporter;
21240
+ return exporter?.[GLASSTRACE_EXPORTER_BRAND] === true;
21241
+ });
21242
+ }
21179
21243
  function detectSentry() {
21180
21244
  try {
21181
21245
  require.resolve("@sentry/node");
@@ -21217,65 +21281,75 @@ async function tryImport(moduleId) {
21217
21281
  return null;
21218
21282
  }
21219
21283
  }
21220
- function tryInjectProcessor(tracerProvider, glasstraceExporter) {
21221
- try {
21222
- const proxy = tracerProvider;
21223
- const delegate = typeof proxy.getDelegate === "function" ? proxy.getDelegate() : tracerProvider;
21224
- const withAdd = delegate;
21225
- if (typeof withAdd.addSpanProcessor === "function") {
21226
- if (typeof withAdd.getActiveSpanProcessor === "function") {
21227
- const active = withAdd.getActiveSpanProcessor();
21228
- const brand = /* @__PURE__ */ Symbol.for("glasstrace.exporter");
21229
- const processors = active?._spanProcessors;
21230
- if (Array.isArray(processors) && processors.some((p) => {
21231
- const exp = p._exporter;
21232
- return exp?.[brand] === true;
21233
- })) {
21234
- return "already_present";
21235
- }
21236
- }
21237
- const processor2 = new BatchSpanProcessor(glasstraceExporter, {
21238
- scheduledDelayMillis: 1e3
21239
- });
21240
- withAdd.addSpanProcessor(processor2);
21241
- _injectedProcessor = processor2;
21242
- return "v1_public";
21243
- }
21244
- const provider = delegate;
21245
- const multiProcessor = provider._activeSpanProcessor;
21246
- if (!multiProcessor || !Array.isArray(multiProcessor._spanProcessors)) {
21247
- return null;
21284
+ async function configureOtel(config2, sessionManager) {
21285
+ setOtelState(OtelState.CONFIGURING);
21286
+ await new Promise((resolve3) => {
21287
+ if (typeof setImmediate === "function") {
21288
+ setImmediate(resolve3);
21289
+ } else {
21290
+ setTimeout(resolve3, 0);
21248
21291
  }
21249
- const processor = new BatchSpanProcessor(glasstraceExporter, {
21250
- scheduledDelayMillis: 1e3
21251
- });
21252
- multiProcessor._spanProcessors.push(processor);
21253
- _injectedProcessor = processor;
21254
- return "v2_private";
21255
- } catch {
21256
- return null;
21292
+ });
21293
+ const existingProvider = trace.getTracerProvider();
21294
+ const probeTracer = existingProvider.getTracer("glasstrace-probe");
21295
+ const anotherProviderRegistered = probeTracer.constructor.name !== "ProxyTracer";
21296
+ if (anotherProviderRegistered) {
21297
+ await runCoexistencePath(existingProvider, config2);
21298
+ return;
21257
21299
  }
21300
+ await runRegistrationPath(config2, sessionManager);
21258
21301
  }
21259
- function isGlasstraceProcessorPresent(tracerProvider) {
21260
- try {
21261
- const proxy = tracerProvider;
21262
- const delegate = typeof proxy.getDelegate === "function" ? proxy.getDelegate() : tracerProvider;
21263
- const provider = delegate;
21264
- const processors = provider._activeSpanProcessor?._spanProcessors;
21265
- if (!Array.isArray(processors)) {
21266
- return false;
21302
+ async function runCoexistencePath(existingProvider, config2) {
21303
+ const result = tryAutoAttachGlasstraceProcessor(existingProvider, {
21304
+ endpoint: config2.endpoint,
21305
+ verbose: config2.verbose
21306
+ });
21307
+ if (result === "already_present") {
21308
+ if (config2.verbose) {
21309
+ sdkLog("info", "[glasstrace] Existing provider detected \u2014 Glasstrace processor already present.");
21310
+ }
21311
+ setOtelState(OtelState.PROCESSOR_PRESENT);
21312
+ emitLifecycleEvent("otel:configured", { state: OtelState.PROCESSOR_PRESENT, scenario: "B-clean" });
21313
+ return;
21314
+ }
21315
+ if (result !== null) {
21316
+ _injectedProcessor = result.processor;
21317
+ if (config2.verbose) {
21318
+ sdkLog(
21319
+ "info",
21320
+ "[glasstrace] Existing provider detected \u2014 auto-attached Glasstrace span processor."
21321
+ );
21267
21322
  }
21268
- const brand = /* @__PURE__ */ Symbol.for("glasstrace.exporter");
21269
- return processors.some((p) => {
21270
- const exporter = p._exporter;
21271
- return exporter?.[brand] === true;
21323
+ registerShutdownHook({
21324
+ name: "coexistence-flush",
21325
+ priority: 5,
21326
+ fn: async () => {
21327
+ if (_injectedProcessor) {
21328
+ await _injectedProcessor.forceFlush();
21329
+ }
21330
+ }
21272
21331
  });
21273
- } catch {
21274
- return false;
21332
+ registerBeforeExitTrigger();
21333
+ const scenario = result.method === "v1_public" ? "D1" : "B-auto";
21334
+ setOtelState(OtelState.AUTO_ATTACHED);
21335
+ emitLifecycleEvent("otel:configured", { state: OtelState.AUTO_ATTACHED, scenario });
21336
+ emitLifecycleEvent("otel:injection_succeeded", { method: result.method });
21337
+ emitNudgeMessage();
21338
+ return;
21339
+ }
21340
+ if (config2.verbose) {
21341
+ sdkLog("info", "[glasstrace] Existing provider detected \u2014 could not auto-attach.");
21342
+ }
21343
+ emitGuidanceMessage();
21344
+ setOtelState(OtelState.COEXISTENCE_FAILED);
21345
+ emitLifecycleEvent("otel:configured", { state: OtelState.COEXISTENCE_FAILED, scenario: "C/F" });
21346
+ emitLifecycleEvent("otel:injection_failed", { reason: "provider internals inaccessible" });
21347
+ const coreState = getCoreState();
21348
+ if (coreState === CoreState.ACTIVE || coreState === CoreState.KEY_RESOLVED) {
21349
+ setCoreState(CoreState.ACTIVE_DEGRADED);
21275
21350
  }
21276
21351
  }
21277
- async function configureOtel(config2, sessionManager) {
21278
- setOtelState(OtelState.CONFIGURING);
21352
+ async function runRegistrationPath(config2, sessionManager) {
21279
21353
  const exporterUrl = `${config2.endpoint}/v1/traces`;
21280
21354
  const createOtlpExporter = (url2, headers) => new OTLPTraceExporter({ url: url2, headers });
21281
21355
  const glasstraceExporter = new GlasstraceExporter({
@@ -21288,71 +21362,6 @@ async function configureOtel(config2, sessionManager) {
21288
21362
  verbose: config2.verbose
21289
21363
  });
21290
21364
  _activeExporter = glasstraceExporter;
21291
- await new Promise((resolve3) => {
21292
- if (typeof setImmediate === "function") {
21293
- setImmediate(resolve3);
21294
- } else {
21295
- setTimeout(resolve3, 0);
21296
- }
21297
- });
21298
- const existingProvider = trace.getTracerProvider();
21299
- const probeTracer = existingProvider.getTracer("glasstrace-probe");
21300
- const anotherProviderRegistered = probeTracer.constructor.name !== "ProxyTracer";
21301
- if (anotherProviderRegistered) {
21302
- if (isGlasstraceProcessorPresent(existingProvider)) {
21303
- if (config2.verbose) {
21304
- sdkLog("info", "[glasstrace] Existing provider detected \u2014 Glasstrace processor already present.");
21305
- }
21306
- _activeExporter = null;
21307
- setOtelState(OtelState.PROCESSOR_PRESENT);
21308
- emitLifecycleEvent("otel:configured", { state: OtelState.PROCESSOR_PRESENT, scenario: "B-clean" });
21309
- return;
21310
- }
21311
- const injectionMethod = tryInjectProcessor(existingProvider, glasstraceExporter);
21312
- if (injectionMethod === "already_present") {
21313
- if (config2.verbose) {
21314
- sdkLog("info", "[glasstrace] Existing provider detected \u2014 Glasstrace processor already present (v1 check).");
21315
- }
21316
- _activeExporter = null;
21317
- setOtelState(OtelState.PROCESSOR_PRESENT);
21318
- emitLifecycleEvent("otel:configured", { state: OtelState.PROCESSOR_PRESENT, scenario: "B-clean" });
21319
- return;
21320
- }
21321
- if (injectionMethod) {
21322
- if (config2.verbose) {
21323
- sdkLog("info", "[glasstrace] Existing provider detected \u2014 auto-attaching Glasstrace processor.");
21324
- }
21325
- registerShutdownHook({
21326
- name: "coexistence-flush",
21327
- priority: 5,
21328
- fn: async () => {
21329
- if (_injectedProcessor) {
21330
- await _injectedProcessor.forceFlush();
21331
- }
21332
- }
21333
- });
21334
- registerBeforeExitTrigger();
21335
- const scenario = injectionMethod === "v1_public" ? "D1" : "B-auto";
21336
- setOtelState(OtelState.AUTO_ATTACHED);
21337
- emitLifecycleEvent("otel:configured", { state: OtelState.AUTO_ATTACHED, scenario });
21338
- emitLifecycleEvent("otel:injection_succeeded", { method: injectionMethod });
21339
- emitNudgeMessage();
21340
- return;
21341
- }
21342
- if (config2.verbose) {
21343
- sdkLog("info", "[glasstrace] Existing provider detected \u2014 could not auto-attach.");
21344
- }
21345
- emitGuidanceMessage();
21346
- _activeExporter = null;
21347
- setOtelState(OtelState.COEXISTENCE_FAILED);
21348
- emitLifecycleEvent("otel:configured", { state: OtelState.COEXISTENCE_FAILED, scenario: "C/F" });
21349
- emitLifecycleEvent("otel:injection_failed", { reason: "provider internals inaccessible" });
21350
- const coreState = getCoreState();
21351
- if (coreState === CoreState.ACTIVE || coreState === CoreState.KEY_RESOLVED) {
21352
- setCoreState(CoreState.ACTIVE_DEGRADED);
21353
- }
21354
- return;
21355
- }
21356
21365
  const vercelOtel = await tryImport("@vercel/otel");
21357
21366
  if (vercelOtel && typeof vercelOtel.registerOTel === "function") {
21358
21367
  const otelConfig = {
@@ -21415,8 +21424,7 @@ async function configureOtel(config2, sessionManager) {
21415
21424
  }
21416
21425
 
21417
21426
  // src/context-manager.ts
21418
- init_cjs_shims();
21419
- var import_node_async_hooks = require("async_hooks");
21427
+ var import_node_async_hooks = require("node:async_hooks");
21420
21428
  init_esm();
21421
21429
  function installContextManager() {
21422
21430
  try {
@@ -21451,7 +21459,6 @@ init_esm();
21451
21459
  init_console_capture();
21452
21460
 
21453
21461
  // src/heartbeat.ts
21454
- init_cjs_shims();
21455
21462
  init_console_capture();
21456
21463
  var HEARTBEAT_INTERVAL_MS = 5 * 60 * 1e3;
21457
21464
  var BACKOFF_BASE_MS = HEARTBEAT_INTERVAL_MS;
@@ -21488,8 +21495,8 @@ function checkShutdownMarker(projectRoot) {
21488
21495
  let fsSync2 = null;
21489
21496
  let pathSync = null;
21490
21497
  try {
21491
- fsSync2 = require("fs");
21492
- pathSync = require("path");
21498
+ fsSync2 = require("node:fs");
21499
+ pathSync = require("node:path");
21493
21500
  } catch {
21494
21501
  return { triggered: false };
21495
21502
  }
@@ -21577,9 +21584,8 @@ function registerHeartbeatShutdownHook(config2, anonKey, sdkVersion) {
21577
21584
  }
21578
21585
 
21579
21586
  // src/runtime-state.ts
21580
- init_cjs_shims();
21581
- var import_node_fs = require("fs");
21582
- var import_node_path = require("path");
21587
+ var import_node_fs = require("node:fs");
21588
+ var import_node_path = require("node:path");
21583
21589
  init_console_capture();
21584
21590
  var _projectRoot = null;
21585
21591
  var _sdkVersion = "unknown";
@@ -21675,7 +21681,7 @@ function registerGlasstrace(options) {
21675
21681
  setCoreState(CoreState.REGISTERING);
21676
21682
  startRuntimeStateWriter({
21677
21683
  projectRoot: process.cwd(),
21678
- sdkVersion: "0.15.1"
21684
+ sdkVersion: "0.17.0"
21679
21685
  });
21680
21686
  const config2 = resolveConfig(options);
21681
21687
  if (config2.verbose) {
@@ -21840,8 +21846,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
21840
21846
  if (config2.verbose) {
21841
21847
  console.info("[glasstrace] Background init firing.");
21842
21848
  }
21843
- const healthReport = collectHealthReport("0.15.1");
21844
- const initResult = await performInit(config2, anonKeyForInit, "0.15.1", healthReport);
21849
+ const healthReport = collectHealthReport("0.17.0");
21850
+ const initResult = await performInit(config2, anonKeyForInit, "0.17.0", healthReport);
21845
21851
  if (generation !== registrationGeneration) return;
21846
21852
  const currentState = getCoreState();
21847
21853
  if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
@@ -21864,7 +21870,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
21864
21870
  }
21865
21871
  maybeInstallConsoleCapture();
21866
21872
  if (didLastInitSucceed()) {
21867
- startHeartbeat(config2, anonKeyForInit, "0.15.1", generation, (newApiKey, accountId) => {
21873
+ startHeartbeat(config2, anonKeyForInit, "0.17.0", generation, (newApiKey, accountId) => {
21868
21874
  setAuthState(AuthState.CLAIMING);
21869
21875
  emitLifecycleEvent("auth:claim_started", { accountId });
21870
21876
  setResolvedApiKey(newApiKey);
@@ -21894,7 +21900,7 @@ function isDiscoveryEnabled(config2) {
21894
21900
  }
21895
21901
 
21896
21902
  // src/config-wrapper.ts
21897
- init_cjs_shims();
21903
+ var import_node_module = require("node:module");
21898
21904
  function isTurbopackBuild() {
21899
21905
  if (typeof process === "undefined") return false;
21900
21906
  const argv = Array.isArray(process.argv) ? process.argv : [];
@@ -21903,6 +21909,36 @@ function isTurbopackBuild() {
21903
21909
  if (process.env?.TURBOPACK === "1") return true;
21904
21910
  return false;
21905
21911
  }
21912
+ var SDK_PACKAGE_NAME = "@glasstrace/sdk";
21913
+ function appendNodeSchemeExternal(webpackConfig) {
21914
+ const nodeBuiltinExternal = (data, callback) => {
21915
+ const request = data.request;
21916
+ if (typeof request === "string" && (0, import_node_module.isBuiltin)(request)) {
21917
+ callback(null, "commonjs " + request);
21918
+ return;
21919
+ }
21920
+ callback(null);
21921
+ };
21922
+ const existing = webpackConfig.externals;
21923
+ if (Array.isArray(existing)) {
21924
+ webpackConfig.externals = [...existing, nodeBuiltinExternal];
21925
+ } else if (existing == null) {
21926
+ webpackConfig.externals = [nodeBuiltinExternal];
21927
+ } else {
21928
+ webpackConfig.externals = [existing, nodeBuiltinExternal];
21929
+ }
21930
+ }
21931
+ function ensureServerExternal(config2) {
21932
+ const existingStable = config2.serverExternalPackages;
21933
+ const stable = Array.isArray(existingStable) ? (
21934
+ // Clone so we never mutate a caller-owned array in place.
21935
+ existingStable.filter((entry) => typeof entry === "string")
21936
+ ) : [];
21937
+ if (!stable.includes(SDK_PACKAGE_NAME)) {
21938
+ stable.push(SDK_PACKAGE_NAME);
21939
+ }
21940
+ config2.serverExternalPackages = stable;
21941
+ }
21906
21942
  function withGlasstraceConfig(nextConfig) {
21907
21943
  if (typeof process === "undefined" || typeof process.versions?.node !== "string") {
21908
21944
  return nextConfig != null ? { ...nextConfig } : {};
@@ -21914,6 +21950,7 @@ function withGlasstraceConfig(nextConfig) {
21914
21950
  ...existingExperimental,
21915
21951
  serverSourceMaps: true
21916
21952
  };
21953
+ ensureServerExternal(bag);
21917
21954
  if (bag.turbopack == null) {
21918
21955
  bag.turbopack = {};
21919
21956
  }
@@ -21928,6 +21965,9 @@ function withGlasstraceConfig(nextConfig) {
21928
21965
  result = existingWebpack(webpackConfig, context2);
21929
21966
  }
21930
21967
  const webpackContext = context2;
21968
+ if (webpackContext.isServer) {
21969
+ appendNodeSchemeExternal(result);
21970
+ }
21931
21971
  if (!webpackContext.isServer && webpackContext.dev === false) {
21932
21972
  const plugins = result.plugins ?? [];
21933
21973
  plugins.push({
@@ -21990,7 +22030,6 @@ async function handleSourceMapUpload(distDir) {
21990
22030
  init_source_map_uploader();
21991
22031
 
21992
22032
  // src/capture-error.ts
21993
- init_cjs_shims();
21994
22033
  init_esm();
21995
22034
  init_error_nudge();
21996
22035
  function captureError(error48) {
@@ -22012,12 +22051,74 @@ function captureError(error48) {
22012
22051
  }
22013
22052
  }
22014
22053
 
22054
+ // src/correlation-id.ts
22055
+ init_esm();
22056
+ init_dist();
22057
+ var ATTR2 = GLASSTRACE_ATTRIBUTE_NAMES;
22058
+ var HEADER_NAME = "x-gt-cid";
22059
+ var MAX_CID_LENGTH = 128;
22060
+ function captureCorrelationId(req) {
22061
+ try {
22062
+ if (!req || !req.headers) {
22063
+ return;
22064
+ }
22065
+ const value = readHeader(req.headers);
22066
+ if (!value) {
22067
+ return;
22068
+ }
22069
+ const span = trace.getActiveSpan();
22070
+ if (!span) {
22071
+ return;
22072
+ }
22073
+ span.setAttribute(ATTR2.CORRELATION_ID, value);
22074
+ } catch {
22075
+ }
22076
+ }
22077
+ function readHeader(headers) {
22078
+ const asFetch = headers;
22079
+ if (typeof asFetch.get === "function") {
22080
+ const raw = asFetch.get(HEADER_NAME);
22081
+ return firstToken(raw);
22082
+ }
22083
+ const dict = headers;
22084
+ const direct = dict[HEADER_NAME];
22085
+ if (direct !== void 0) {
22086
+ return firstValue(direct);
22087
+ }
22088
+ for (const key of Object.keys(dict)) {
22089
+ if (key.toLowerCase() === HEADER_NAME) {
22090
+ return firstValue(dict[key]);
22091
+ }
22092
+ }
22093
+ return void 0;
22094
+ }
22095
+ function firstValue(value) {
22096
+ if (Array.isArray(value)) {
22097
+ for (const entry of value) {
22098
+ const token = firstToken(entry);
22099
+ if (token) return token;
22100
+ }
22101
+ return void 0;
22102
+ }
22103
+ return firstToken(value);
22104
+ }
22105
+ function firstToken(value) {
22106
+ if (typeof value !== "string") return void 0;
22107
+ const parts = value.split(",");
22108
+ for (const part of parts) {
22109
+ const trimmed = part.trim();
22110
+ if (trimmed.length === 0) continue;
22111
+ if (trimmed.length > MAX_CID_LENGTH) return void 0;
22112
+ return trimmed;
22113
+ }
22114
+ return void 0;
22115
+ }
22116
+
22015
22117
  // src/import-graph.ts
22016
- init_cjs_shims();
22017
- var fs3 = __toESM(require("fs/promises"), 1);
22018
- var fsSync = __toESM(require("fs"), 1);
22019
- var path3 = __toESM(require("path"), 1);
22020
- var crypto3 = __toESM(require("crypto"), 1);
22118
+ var fs3 = __toESM(require("node:fs/promises"), 1);
22119
+ var fsSync = __toESM(require("node:fs"), 1);
22120
+ var path3 = __toESM(require("node:path"), 1);
22121
+ var crypto3 = __toESM(require("node:crypto"), 1);
22021
22122
  init_dist();
22022
22123
  var MAX_TEST_FILES = 5e3;
22023
22124
  var EXCLUDED_DIRS = /* @__PURE__ */ new Set(["node_modules", ".next", ".git", "dist", ".turbo"]);
@@ -22189,6 +22290,7 @@ async function buildImportGraph(projectRoot) {
22189
22290
  SdkError,
22190
22291
  SessionManager,
22191
22292
  buildImportGraph,
22293
+ captureCorrelationId,
22192
22294
  captureError,
22193
22295
  classifyFetchTarget,
22194
22296
  collectSourceMaps,