@sentry/junior 0.179.0 → 0.180.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 (126) hide show
  1. package/dist/{agent-hooks-32IDCLMW.js → agent-hooks-DKDDRKZA.js} +16 -18
  2. package/dist/api/schema.js +0 -1
  3. package/dist/api.js +199 -197
  4. package/dist/app.d.ts +4 -0
  5. package/dist/app.js +300 -1259
  6. package/dist/catalog-runtime-WXKGUF3W.js +14 -0
  7. package/dist/chat/agent/sandbox.d.ts +0 -2
  8. package/dist/chat/api-turns/routing.d.ts +4 -0
  9. package/dist/chat/api-turns/work.d.ts +5 -0
  10. package/dist/chat/config.d.ts +5 -2
  11. package/dist/chat/configuration/defaults.d.ts +1 -1
  12. package/dist/chat/conversations/projection.d.ts +6 -4
  13. package/dist/chat/ingress/message-router.d.ts +3 -0
  14. package/dist/chat/model-profile.d.ts +8 -10
  15. package/dist/chat/pi/conversation-events.d.ts +3 -2
  16. package/dist/chat/plugins/task-queue.d.ts +40 -3
  17. package/dist/chat/plugins/task-runner.d.ts +1 -1
  18. package/dist/chat/queue/callback.d.ts +26 -0
  19. package/dist/chat/queue/sign.d.ts +30 -0
  20. package/dist/chat/sandbox/sandbox.d.ts +0 -2
  21. package/dist/chat/sandbox/session.d.ts +0 -2
  22. package/dist/chat/sandbox/skill-sync.d.ts +1 -1
  23. package/dist/chat/sandbox/snapshot/events.d.ts +23 -0
  24. package/dist/chat/sandbox/snapshot/job-callback.d.ts +5 -0
  25. package/dist/chat/sandbox/snapshot/job-queue.d.ts +26 -0
  26. package/dist/chat/sandbox/snapshot/job-runner.d.ts +11 -0
  27. package/dist/chat/sandbox/snapshot/not-ready-error.d.ts +6 -0
  28. package/dist/chat/sandbox/snapshot/workspace.d.ts +9 -3
  29. package/dist/chat/services/turn-router.d.ts +4 -3
  30. package/dist/chat/task-execution/queue-signing.d.ts +10 -21
  31. package/dist/chat/task-execution/state.d.ts +48 -0
  32. package/dist/chat/task-execution/store.d.ts +28 -2
  33. package/dist/chat/task-execution/worker.d.ts +4 -1
  34. package/dist/chat/tools/handoff/tool.d.ts +1 -1
  35. package/dist/{chunk-B6ECUSVX.js → chunk-2AYEVN7K.js} +8 -8
  36. package/dist/{chunk-SLGGOASN.js → chunk-2YIRH4E3.js} +46 -46
  37. package/dist/{chunk-KJLHIHFF.js → chunk-3ILJBWP7.js} +35 -227
  38. package/dist/{chunk-RZRYOLCE.js → chunk-5PUMIMNQ.js} +2292 -1147
  39. package/dist/{chunk-CJLBLELR.js → chunk-5TUR4M3M.js} +8 -61
  40. package/dist/{chunk-6ZWRNC4D.js → chunk-6Y5B5PEX.js} +1 -1
  41. package/dist/{chunk-XSPSCWLH.js → chunk-6YCEWOLO.js} +4 -4
  42. package/dist/chunk-7H2VZTWN.js +103 -0
  43. package/dist/{chunk-FAS6AIMF.js → chunk-CCDXTDSY.js} +8 -8
  44. package/dist/{chunk-CGA4ERJ5.js → chunk-CEMMLV5L.js} +1 -1
  45. package/dist/{chunk-XZY6G5YZ.js → chunk-CK6EINVZ.js} +180 -87
  46. package/dist/{chunk-FIANEE7Z.js → chunk-CM5HNV2W.js} +6 -6
  47. package/dist/{chunk-JT4WMD3C.js → chunk-CP73FKME.js} +144 -218
  48. package/dist/{chunk-3I7XE3PA.js → chunk-DHLOGWYH.js} +36 -36
  49. package/dist/chunk-DKIJ2RP5.js +68 -0
  50. package/dist/{chunk-YFNAMRGE.js → chunk-DRHEGXTZ.js} +1 -1
  51. package/dist/{chunk-OOUNJNMR.js → chunk-DWPN6SCH.js} +1 -1
  52. package/dist/chunk-EWHP2IRG.js +209 -0
  53. package/dist/{chunk-R6U7N4FS.js → chunk-FGC3PHNH.js} +3 -3
  54. package/dist/{chunk-3TM3FYLQ.js → chunk-GA5NS74S.js} +1 -1
  55. package/dist/{chunk-FIDMHAO6.js → chunk-GPXAHUQH.js} +84 -274
  56. package/dist/chunk-GUKXEPMX.js +218 -0
  57. package/dist/{chunk-GENV6KF2.js → chunk-I6IFTAPF.js} +108 -76
  58. package/dist/{chunk-R5NWWYIS.js → chunk-IANUX7HX.js} +5 -5
  59. package/dist/{chunk-G2CAC4CV.js → chunk-KCL6AWYW.js} +74 -68
  60. package/dist/{chunk-5IRROPA5.js → chunk-L7LTGN4Z.js} +129 -31
  61. package/dist/{chunk-Q5B3WTGG.js → chunk-LGVQLNLS.js} +42 -41
  62. package/dist/chunk-M3QYTBQ6.js +55 -0
  63. package/dist/{chunk-FTGD2FBP.js → chunk-MXEUIGHO.js} +2 -2
  64. package/dist/{chunk-M63DETLL.js → chunk-N7TMSOZH.js} +6 -6
  65. package/dist/{chunk-2HIPYNQI.js → chunk-O4QYZTDK.js} +33 -32
  66. package/dist/chunk-PEQXYSSE.js +45 -0
  67. package/dist/{chunk-RTRBYSF3.js → chunk-QSO7B5JO.js} +1 -1
  68. package/dist/{chunk-HQNE5APD.js → chunk-RAZG3YHC.js} +100 -79
  69. package/dist/{chunk-VP4OVRDD.js → chunk-S7YRTOSQ.js} +69 -73
  70. package/dist/{chunk-U4TKB6F6.js → chunk-SDBKZ5LV.js} +108 -5
  71. package/dist/{chunk-GPLAT6H7.js → chunk-TC5DE5KJ.js} +22 -18
  72. package/dist/{chunk-H4HBKISO.js → chunk-TXKUKMVO.js} +1 -1
  73. package/dist/chunk-U5EUCUBH.js +164 -0
  74. package/dist/{chunk-3AFVR5UC.js → chunk-VG722ONZ.js} +18 -16
  75. package/dist/{chunk-ZQMG3CL5.js → chunk-VGPPWWHF.js} +16 -16
  76. package/dist/{chunk-JMJNFEDC.js → chunk-WVAMRKYG.js} +9 -54
  77. package/dist/chunk-X6GDDWQH.js +60 -0
  78. package/dist/{chunk-4GWXAILB.js → chunk-ZE2KOV3G.js} +1 -1
  79. package/dist/{chunk-TIEKUH4Q.js → chunk-ZM7ZURJS.js} +4 -3
  80. package/dist/cli/chat.js +47 -43
  81. package/dist/cli/check.js +13 -15
  82. package/dist/cli/env.js +0 -1
  83. package/dist/cli/init.js +0 -1
  84. package/dist/cli/main.js +2 -3
  85. package/dist/cli/plugins.js +18 -20
  86. package/dist/cli/run.js +0 -1
  87. package/dist/cli/snapshot-create.js +14 -16
  88. package/dist/cli/upgrade.js +16 -18
  89. package/dist/{conversation-work-KATFHLG3.js → conversation-work-VIOQ5ZF3.js} +0 -2
  90. package/dist/{db-EJAV7JL6.js → db-6SBHIAJK.js} +8 -10
  91. package/dist/deployment.d.ts +1 -0
  92. package/dist/{discovery-GUFTFBTL.js → discovery-DWVDM7UK.js} +1 -2
  93. package/dist/{experimental-XVDOSRBS.js → experimental-SIJSRDJD.js} +0 -1
  94. package/dist/instrumentation.js +7 -9
  95. package/dist/nitro.js +39 -13
  96. package/dist/{oauth-callback-server-GAVSUBTQ.js → oauth-callback-server-WSDQPZZS.js} +34 -32
  97. package/dist/{oauth-relay-3ZU72UGL.js → oauth-relay-5XPVRPYB.js} +0 -1
  98. package/dist/{plugins-HW4VWW6G.js → plugins-YTYJMMJF.js} +1 -2
  99. package/dist/{runner-34JL64JF.js → runner-GWTSWESR.js} +39 -33
  100. package/dist/{sandbox-egress-signals-DXOOBSBI.js → sandbox-egress-signals-FIL7EGPR.js} +5 -6
  101. package/dist/{sentry-JMWTS32N.js → sentry-MB3NL3IR.js} +1 -2
  102. package/dist/skills-F32BPFYW.js +27 -0
  103. package/dist/spawn-X5BPP5OE.js +37 -0
  104. package/dist/task-runner-2FPBV5PP.js +32 -0
  105. package/dist/validation-62WO524A.js +17 -0
  106. package/dist/vercel.js +0 -1
  107. package/dist/version.js +1 -2
  108. package/dist/work-3C3CMZ24.js +45 -0
  109. package/dist/worker-MFAI6ZEK.js +22 -0
  110. package/package.json +8 -7
  111. package/dist/catalog-runtime-FBVA6WAQ.js +0 -16
  112. package/dist/chat/plugins/task-callback.d.ts +0 -5
  113. package/dist/chat/plugins/task-message.d.ts +0 -23
  114. package/dist/chat/plugins/task-signing.d.ts +0 -31
  115. package/dist/chat/sandbox/snapshot/waiting-error.d.ts +0 -15
  116. package/dist/chat/services/workspace-snapshot-wait.d.ts +0 -27
  117. package/dist/chunk-5I6ORJUY.js +0 -127
  118. package/dist/chunk-6GWA276C.js +0 -72
  119. package/dist/chunk-MLKGABMK.js +0 -9
  120. package/dist/chunk-UT6X7XN7.js +0 -51
  121. package/dist/chunk-WR76IVA5.js +0 -130
  122. package/dist/skills-U545HALM.js +0 -29
  123. package/dist/spawn-I2S4IDUQ.js +0 -37
  124. package/dist/validation-EVXVGA44.js +0 -19
  125. package/dist/work-QOAUPDBU.js +0 -45
  126. package/dist/worker-5GX2IKLZ.js +0 -24
@@ -5,28 +5,28 @@ import {
5
5
  isDmChannel,
6
6
  normalizeSlackConversationId,
7
7
  withSlackRetries
8
- } from "./chunk-3I7XE3PA.js";
8
+ } from "./chunk-DHLOGWYH.js";
9
9
  import {
10
10
  parseDestination
11
- } from "./chunk-VP4OVRDD.js";
11
+ } from "./chunk-S7YRTOSQ.js";
12
12
  import {
13
13
  getStateAdapter
14
- } from "./chunk-3TM3FYLQ.js";
14
+ } from "./chunk-GA5NS74S.js";
15
15
  import {
16
16
  normalizeSlackEmojiName
17
- } from "./chunk-GENV6KF2.js";
17
+ } from "./chunk-I6IFTAPF.js";
18
18
  import {
19
19
  pluginCatalogRuntime
20
- } from "./chunk-YFNAMRGE.js";
20
+ } from "./chunk-DRHEGXTZ.js";
21
21
  import {
22
22
  parseSlackMessageTs,
23
23
  parseSlackUserId
24
- } from "./chunk-M63DETLL.js";
24
+ } from "./chunk-N7TMSOZH.js";
25
25
  import {
26
26
  isRecord,
27
27
  logInfo,
28
28
  logWarn
29
- } from "./chunk-HQNE5APD.js";
29
+ } from "./chunk-RAZG3YHC.js";
30
30
 
31
31
  // src/chat/slack/outbound.ts
32
32
  var MAX_SLACK_MESSAGE_TEXT_CHARS = 4e4;
@@ -101,16 +101,17 @@ async function postSlackMessage(input) {
101
101
  unfurl_links: false,
102
102
  unfurl_media: false,
103
103
  ...input.blocks?.length ? {
104
+ // @ts-expect-error non-overlapping boundary cast; rule forbids as-unknown-as chains
104
105
  blocks: input.blocks
105
- } : {},
106
- ...threadTs ? { thread_ts: threadTs } : {}
106
+ } : void 0,
107
+ ...threadTs ? { thread_ts: threadTs } : void 0
107
108
  }),
108
109
  3,
109
110
  {
110
111
  action: "chat.postMessage",
111
112
  spanAttributes: {
112
113
  "app.slack.channel_id": channelId,
113
- ...threadTs ? { "app.slack.thread_ts": threadTs } : {}
114
+ ...threadTs ? { "app.slack.thread_ts": threadTs } : void 0
114
115
  }
115
116
  }
116
117
  );
@@ -125,7 +126,7 @@ async function postSlackMessage(input) {
125
126
  channelId,
126
127
  messageTs
127
128
  })
128
- } : {}
129
+ } : void 0
129
130
  };
130
131
  }
131
132
  async function postSlackEphemeralMessage(input) {
@@ -150,7 +151,7 @@ async function postSlackEphemeralMessage(input) {
150
151
  channel: channelId,
151
152
  user: userId,
152
153
  text,
153
- ...threadTs ? { thread_ts: threadTs } : {}
154
+ ...threadTs ? { thread_ts: threadTs } : void 0
154
155
  }),
155
156
  3,
156
157
  {
@@ -158,7 +159,7 @@ async function postSlackEphemeralMessage(input) {
158
159
  spanAttributes: {
159
160
  "app.slack.channel_id": channelId,
160
161
  "app.slack.user_id": userId,
161
- ...threadTs ? { "app.slack.thread_ts": threadTs } : {}
162
+ ...threadTs ? { "app.slack.thread_ts": threadTs } : void 0
162
163
  }
163
164
  }
164
165
  );
@@ -190,7 +191,7 @@ async function uploadFilesToConversation(input) {
190
191
  const response = await withSlackRetries(
191
192
  () => getSlackClient().filesUploadV2({
192
193
  channel_id: channelId,
193
- ...threadTs ? { thread_ts: threadTs } : {},
194
+ ...threadTs ? { thread_ts: threadTs } : void 0,
194
195
  file_uploads: fileUploads
195
196
  }),
196
197
  3,
@@ -198,7 +199,7 @@ async function uploadFilesToConversation(input) {
198
199
  action: "filesUploadV2",
199
200
  spanAttributes: {
200
201
  "app.slack.channel_id": channelId,
201
- ...threadTs ? { "app.slack.thread_ts": threadTs } : {}
202
+ ...threadTs ? { "app.slack.thread_ts": threadTs } : void 0
202
203
  }
203
204
  }
204
205
  );
@@ -534,14 +535,14 @@ function parseOAuthStatePayload(value) {
534
535
  return {
535
536
  userId: value.userId,
536
537
  provider: value.provider,
537
- ...actor?.success ? { actor: actor.data } : {},
538
- ...optionalString(value.channelId) ? { channelId: optionalString(value.channelId) } : {},
539
- ...destination ? { destination } : {},
540
- ...source?.success ? { source: source.data } : {},
541
- ...optionalString(value.threadTs) ? { threadTs: optionalString(value.threadTs) } : {},
542
- ...optionalString(value.resumeConversationId) ? { resumeConversationId: optionalString(value.resumeConversationId) } : {},
543
- ...optionalString(value.resumeSessionId) ? { resumeSessionId: optionalString(value.resumeSessionId) } : {},
544
- ...optionalString(value.scope) ? { scope: optionalString(value.scope) } : {}
538
+ ...actor?.success ? { actor: actor.data } : void 0,
539
+ ...optionalString(value.channelId) ? { channelId: optionalString(value.channelId) } : void 0,
540
+ ...destination ? { destination } : void 0,
541
+ ...source?.success ? { source: source.data } : void 0,
542
+ ...optionalString(value.threadTs) ? { threadTs: optionalString(value.threadTs) } : void 0,
543
+ ...optionalString(value.resumeConversationId) ? { resumeConversationId: optionalString(value.resumeConversationId) } : void 0,
544
+ ...optionalString(value.resumeSessionId) ? { resumeSessionId: optionalString(value.resumeSessionId) } : void 0,
545
+ ...optionalString(value.scope) ? { scope: optionalString(value.scope) } : void 0
545
546
  };
546
547
  }
547
548
  function formatProviderLabel(provider) {
@@ -657,14 +658,14 @@ async function startOAuthFlow(provider, input) {
657
658
  {
658
659
  userId: input.actorId,
659
660
  provider,
660
- ...input.actor ? { actor: input.actor } : {},
661
- ...input.channelId ? { channelId: input.channelId } : {},
662
- ...input.destination ? { destination: input.destination } : {},
663
- ...input.source ? { source: input.source } : {},
664
- ...input.threadTs ? { threadTs: input.threadTs } : {},
665
- ...input.resumeConversationId ? { resumeConversationId: input.resumeConversationId } : {},
666
- ...input.resumeSessionId ? { resumeSessionId: input.resumeSessionId } : {},
667
- ...requestedScope ? { scope: requestedScope } : {}
661
+ ...input.actor ? { actor: input.actor } : void 0,
662
+ ...input.channelId ? { channelId: input.channelId } : void 0,
663
+ ...input.destination ? { destination: input.destination } : void 0,
664
+ ...input.source ? { source: input.source } : void 0,
665
+ ...input.threadTs ? { threadTs: input.threadTs } : void 0,
666
+ ...input.resumeConversationId ? { resumeConversationId: input.resumeConversationId } : void 0,
667
+ ...input.resumeSessionId ? { resumeSessionId: input.resumeSessionId } : void 0,
668
+ ...requestedScope ? { scope: requestedScope } : void 0
668
669
  },
669
670
  OAUTH_STATE_TTL_MS
670
671
  );
@@ -684,7 +685,7 @@ async function startOAuthFlow(provider, input) {
684
685
  }
685
686
  logInfo("jr_rpc.oauth.started", {
686
687
  "app.credential.provider": provider,
687
- ...input.activeSkillName ? { "app.skill.name": input.activeSkillName } : {}
688
+ ...input.activeSkillName ? { "app.skill.name": input.activeSkillName } : void 0
688
689
  });
689
690
  const authorizationUrl = `${providerConfig.authorizeEndpoint}?${authorizeParams.toString()}`;
690
691
  const authorizationRequest = {
@@ -0,0 +1,45 @@
1
+ // src/chat/sentry.ts
2
+ import {
3
+ captureException,
4
+ captureMessage,
5
+ continueTrace,
6
+ flush,
7
+ getActiveSpan,
8
+ getClient,
9
+ getGlobalScope,
10
+ getTraceData,
11
+ init,
12
+ logger,
13
+ setTag,
14
+ setUser,
15
+ spanToJSON,
16
+ startInactiveSpan,
17
+ startSpan,
18
+ vercelAIIntegration,
19
+ withActiveSpan,
20
+ withScope,
21
+ withStreamedSpan
22
+ } from "@sentry/node";
23
+ export * from "@sentry/node";
24
+
25
+ export {
26
+ captureException,
27
+ captureMessage,
28
+ continueTrace,
29
+ flush,
30
+ getActiveSpan,
31
+ getClient,
32
+ getGlobalScope,
33
+ getTraceData,
34
+ init,
35
+ logger,
36
+ setTag,
37
+ setUser,
38
+ spanToJSON,
39
+ startInactiveSpan,
40
+ startSpan,
41
+ vercelAIIntegration,
42
+ withActiveSpan,
43
+ withScope,
44
+ withStreamedSpan
45
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-YFNAMRGE.js";
3
+ } from "./chunk-DRHEGXTZ.js";
4
4
 
5
5
  // src/chat/plugins/validation.ts
6
6
  import { isDeepStrictEqual } from "util";
@@ -1,15 +1,55 @@
1
1
  import {
2
2
  captureException,
3
+ captureMessage,
3
4
  getActiveSpan,
4
- sentry_exports,
5
+ getTraceData,
6
+ logger,
5
7
  setTag,
6
8
  setUser,
9
+ spanToJSON,
7
10
  startSpan,
8
11
  withScope
9
- } from "./chunk-6GWA276C.js";
12
+ } from "./chunk-PEQXYSSE.js";
10
13
  import {
11
- getDeploymentTelemetryAttributes
12
- } from "./chunk-UT6X7XN7.js";
14
+ JUNIOR_VERSION
15
+ } from "./chunk-ZM7ZURJS.js";
16
+
17
+ // src/deployment.ts
18
+ var JUNIOR_HEARTBEAT_ROUTE = "/api/internal/heartbeat";
19
+ var JUNIOR_HEARTBEAT_CRON_SCHEDULE = "* * * * *";
20
+ var JUNIOR_RETENTION_ROUTE = "/api/internal/retention";
21
+ var JUNIOR_RETENTION_CRON_SCHEDULE = "0 4 * * *";
22
+ var JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE = "/api/internal/agent/continue";
23
+ var JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE = "/api/internal/plugin/tasks";
24
+ var JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE = "/api/internal/workspace/snapshots";
25
+ var LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION = "api/internal/agent/continue.ts";
26
+ function toOptionalTrimmed(value) {
27
+ const trimmed = value?.trim();
28
+ return trimmed ? trimmed : void 0;
29
+ }
30
+ function getDeploymentServiceVersion() {
31
+ const configuredRelease = toOptionalTrimmed(process.env.SENTRY_RELEASE);
32
+ if (configuredRelease) {
33
+ return configuredRelease;
34
+ }
35
+ const deploymentRevision = toOptionalTrimmed(
36
+ process.env.VERCEL_GIT_COMMIT_SHA
37
+ );
38
+ return deploymentRevision ? `${JUNIOR_VERSION}+${deploymentRevision}` : void 0;
39
+ }
40
+ function getDeploymentTelemetryAttributes() {
41
+ const attributes = {};
42
+ const serviceVersion = getDeploymentServiceVersion();
43
+ const deploymentId = toOptionalTrimmed(process.env.VERCEL_DEPLOYMENT_ID);
44
+ attributes["app.junior.version"] = JUNIOR_VERSION;
45
+ if (serviceVersion) {
46
+ attributes["service.version"] = serviceVersion;
47
+ }
48
+ if (deploymentId) {
49
+ attributes["deployment.id"] = deploymentId;
50
+ }
51
+ return attributes;
52
+ }
13
53
 
14
54
  // src/chat/logging.ts
15
55
  import path from "path";
@@ -407,14 +447,10 @@ function contextToAttributes(context) {
407
447
  return mergeAttributes(logContextToAttributes(context));
408
448
  }
409
449
  function getTraceCorrelationAttributes() {
410
- const sentry = sentry_exports;
411
- if (typeof sentry.getActiveSpan !== "function" || typeof sentry.spanToJSON !== "function") {
412
- return {};
413
- }
414
450
  try {
415
- const span = sentry.getActiveSpan();
451
+ const span = getActiveSpan();
416
452
  if (!span) return {};
417
- const json = sentry.spanToJSON(span);
453
+ const json = spanToJSON(span);
418
454
  const attrs = {};
419
455
  if (json.trace_id) attrs.trace_id = json.trace_id;
420
456
  if (json.span_id) attrs.span_id = json.span_id;
@@ -553,37 +589,28 @@ function getLogTapeLogger(category = []) {
553
589
  if (!rootLogger) {
554
590
  throw new Error("LogTape backend is unavailable");
555
591
  }
556
- let logger = rootLogger;
592
+ let logger2 = rootLogger;
557
593
  for (const part of category) {
558
- logger = logger.getChild(part);
594
+ logger2 = logger2.getChild(part);
559
595
  }
560
- return logger;
596
+ return logger2;
561
597
  }
562
598
  function emitSentry(level, body, attributes) {
563
599
  if (shouldSuppressInfoLog(level)) {
564
600
  return;
565
601
  }
566
- const sentry = sentry_exports;
567
- const loggerFn = sentry.logger?.[level];
602
+ const loggerFn = logger?.[level];
568
603
  if (typeof loggerFn === "function") {
569
604
  loggerFn(body, attributes);
570
605
  return;
571
606
  }
572
- const sentryWithScope = sentry.withScope;
573
- const sentryCaptureMessage = sentry.captureMessage;
574
607
  const sentryLevel = level === "warn" ? "warning" : level;
575
- if (typeof sentryWithScope === "function" && typeof sentryCaptureMessage === "function") {
576
- sentryWithScope((scope) => {
577
- for (const [key, value] of Object.entries(attributes)) {
578
- scope.setExtra(key, value);
579
- }
580
- sentryCaptureMessage(body, sentryLevel);
581
- });
582
- return;
583
- }
584
- if (typeof sentryCaptureMessage === "function") {
585
- sentryCaptureMessage(body, sentryLevel);
586
- }
608
+ withScope((scope) => {
609
+ for (const [key, value] of Object.entries(attributes)) {
610
+ scope.setExtra(key, value);
611
+ }
612
+ captureMessage(body, sentryLevel);
613
+ });
587
614
  }
588
615
  function formatConsoleLevel(level) {
589
616
  if (level === "debug") return "DBG";
@@ -890,7 +917,7 @@ function emitRecord(category, level, eventName, attrs = {}, body) {
890
917
  traceAttributes,
891
918
  {
892
919
  "event.name": normalizedEventName,
893
- ...source ? { "app.log.source": source } : {},
920
+ ...source ? { "app.log.source": source } : void 0,
894
921
  ...attrs
895
922
  },
896
923
  // Deployment identity is process-owned and must win over event-local attrs.
@@ -900,24 +927,24 @@ function emitRecord(category, level, eventName, attrs = {}, body) {
900
927
  emitDirect(level, normalizedEventName, message, attributes);
901
928
  return;
902
929
  }
903
- const logger = getLogTapeLogger(category);
930
+ const logger2 = getLogTapeLogger(category);
904
931
  const properties = {
905
932
  [LOGTAPE_BODY_KEY]: message,
906
933
  ...attributes
907
934
  };
908
935
  if (level === "error") {
909
- logger.error(`{${LOGTAPE_BODY_KEY}}`, properties);
936
+ logger2.error(`{${LOGTAPE_BODY_KEY}}`, properties);
910
937
  return;
911
938
  }
912
939
  if (level === "warn") {
913
- logger.warn(`{${LOGTAPE_BODY_KEY}}`, properties);
940
+ logger2.warn(`{${LOGTAPE_BODY_KEY}}`, properties);
914
941
  return;
915
942
  }
916
943
  if (level === "info") {
917
- logger.info(`{${LOGTAPE_BODY_KEY}}`, properties);
944
+ logger2.info(`{${LOGTAPE_BODY_KEY}}`, properties);
918
945
  return;
919
946
  }
920
- logger.debug(`{${LOGTAPE_BODY_KEY}}`, properties);
947
+ logger2.debug(`{${LOGTAPE_BODY_KEY}}`, properties);
921
948
  }
922
949
  function emit(level, eventName, attrs = {}, body) {
923
950
  emitRecord([], level, eventName, attrs, body);
@@ -950,29 +977,18 @@ var log = {
950
977
  body
951
978
  );
952
979
  let eventId;
953
- const sentryWithScope = withScope;
954
- const sentryCaptureException = captureException;
955
- if (typeof sentryWithScope === "function" && typeof sentryCaptureException === "function") {
956
- sentryWithScope((scope) => {
957
- setSentryScopeContext(scope, getBoundLogContext());
958
- const mergedAttributes = mergeAttributes(
959
- getBoundLogAttributes(),
960
- attrs
961
- );
962
- for (const [key, value] of Object.entries(mergedAttributes)) {
963
- scope.setExtra(key, value);
964
- if (SENTRY_TAG_ATTRIBUTE_KEYS.has(key) && typeof value === "string" && value.length > 0) {
965
- scope.setTag(key, value);
966
- }
980
+ withScope((scope) => {
981
+ setSentryScopeContext(scope, getBoundLogContext());
982
+ const mergedAttributes = mergeAttributes(getBoundLogAttributes(), attrs);
983
+ for (const [key, value] of Object.entries(mergedAttributes)) {
984
+ scope.setExtra(key, value);
985
+ if (SENTRY_TAG_ATTRIBUTE_KEYS.has(key) && typeof value === "string" && value.length > 0) {
986
+ scope.setTag(key, value);
967
987
  }
968
- eventId = sentryCaptureException(normalizedError);
969
- });
970
- return eventId;
971
- }
972
- if (typeof sentryCaptureException === "function") {
973
- setSentryUser(sentryUserIdentityFromContext(getBoundLogContext()));
974
- eventId = sentryCaptureException(normalizedError);
975
- }
988
+ }
989
+ const capturedEventId = captureException(normalizedError);
990
+ eventId = typeof capturedEventId === "string" ? capturedEventId : void 0;
991
+ });
976
992
  return eventId;
977
993
  }
978
994
  };
@@ -1105,8 +1121,8 @@ function sentryUserIdentityFromContext(context) {
1105
1121
  const email = normalizeIdentityEmail(context.userEmail);
1106
1122
  return {
1107
1123
  id: context.userId,
1108
- ...context.userName ? { username: context.userName } : {},
1109
- ...email ? { email } : {}
1124
+ ...context.userName ? { username: context.userName } : void 0,
1125
+ ...email ? { email } : void 0
1110
1126
  };
1111
1127
  }
1112
1128
  return void 0;
@@ -1115,8 +1131,8 @@ function sentryUserFromIdentity(identity) {
1115
1131
  return {
1116
1132
  id: identity.id,
1117
1133
  ip_address: null,
1118
- ...identity.username ? { username: identity.username } : {},
1119
- ...identity.email ? { email: identity.email } : {}
1134
+ ...identity.username ? { username: identity.username } : void 0,
1135
+ ...identity.email ? { email: identity.email } : void 0
1120
1136
  };
1121
1137
  }
1122
1138
  function setSentryUser(identity) {
@@ -1231,8 +1247,7 @@ async function withSpan(name, op, context, callback, attributes = {}) {
1231
1247
  });
1232
1248
  }
1233
1249
  function getTracePropagationHeaders() {
1234
- const sentry = sentry_exports;
1235
- const traceData = sentry.getTraceData?.({ propagateTraceparent: true });
1250
+ const traceData = getTraceData({ propagateTraceparent: true });
1236
1251
  if (!traceData) {
1237
1252
  return {};
1238
1253
  }
@@ -1262,16 +1277,12 @@ function setSpanStatus(status) {
1262
1277
  );
1263
1278
  }
1264
1279
  function getActiveTraceId() {
1265
- const sentry = sentry_exports;
1266
- if (typeof sentry.getActiveSpan !== "function" || typeof sentry.spanToJSON !== "function") {
1267
- return void 0;
1268
- }
1269
1280
  try {
1270
- const span = sentry.getActiveSpan();
1281
+ const span = getActiveSpan();
1271
1282
  if (!span) {
1272
1283
  return void 0;
1273
1284
  }
1274
- return toOptionalString(sentry.spanToJSON(span).trace_id);
1285
+ return toOptionalString(spanToJSON(span).trace_id);
1275
1286
  } catch {
1276
1287
  return void 0;
1277
1288
  }
@@ -1454,17 +1465,17 @@ function extractGenAiUsageAttributes(...sources) {
1454
1465
  cacheCreationTokens
1455
1466
  );
1456
1467
  return {
1457
- ...semanticInputTokens !== void 0 ? { "gen_ai.usage.input_tokens": semanticInputTokens } : {},
1458
- ...outputTokens !== void 0 ? { "gen_ai.usage.output_tokens": outputTokens } : {},
1468
+ ...semanticInputTokens !== void 0 ? { "gen_ai.usage.input_tokens": semanticInputTokens } : void 0,
1469
+ ...outputTokens !== void 0 ? { "gen_ai.usage.output_tokens": outputTokens } : void 0,
1459
1470
  // OTel has no monetary cost attributes, so report accounting generically.
1460
- ...cachedInputTokens !== void 0 ? { "gen_ai.usage.cache_read.input_tokens": cachedInputTokens } : {},
1461
- ...cacheCreationTokens !== void 0 ? { "gen_ai.usage.cache_creation.input_tokens": cacheCreationTokens } : {},
1462
- ...reasoningTokens !== void 0 ? { "gen_ai.usage.reasoning.output_tokens": reasoningTokens } : {},
1463
- ...cost?.input !== void 0 ? { "app.cost.input_usd": cost.input } : {},
1464
- ...cost?.output !== void 0 ? { "app.cost.output_usd": cost.output } : {},
1465
- ...cost?.cacheRead !== void 0 ? { "app.cost.cache_read_usd": cost.cacheRead } : {},
1466
- ...cost?.cacheWrite !== void 0 ? { "app.cost.cache_write_usd": cost.cacheWrite } : {},
1467
- ...cost?.total !== void 0 ? { "app.cost.total_usd": cost.total } : {}
1471
+ ...cachedInputTokens !== void 0 ? { "gen_ai.usage.cache_read.input_tokens": cachedInputTokens } : void 0,
1472
+ ...cacheCreationTokens !== void 0 ? { "gen_ai.usage.cache_creation.input_tokens": cacheCreationTokens } : void 0,
1473
+ ...reasoningTokens !== void 0 ? { "gen_ai.usage.reasoning.output_tokens": reasoningTokens } : void 0,
1474
+ ...cost?.input !== void 0 ? { "app.cost.input_usd": cost.input } : void 0,
1475
+ ...cost?.output !== void 0 ? { "app.cost.output_usd": cost.output } : void 0,
1476
+ ...cost?.cacheRead !== void 0 ? { "app.cost.cache_read_usd": cost.cacheRead } : void 0,
1477
+ ...cost?.cacheWrite !== void 0 ? { "app.cost.cache_write_usd": cost.cacheWrite } : void 0,
1478
+ ...cost?.total !== void 0 ? { "app.cost.total_usd": cost.total } : void 0
1468
1479
  };
1469
1480
  }
1470
1481
 
@@ -1473,6 +1484,16 @@ export {
1473
1484
  toOptionalNumber,
1474
1485
  isRecord,
1475
1486
  normalizeIdentityEmail,
1487
+ JUNIOR_HEARTBEAT_ROUTE,
1488
+ JUNIOR_HEARTBEAT_CRON_SCHEDULE,
1489
+ JUNIOR_RETENTION_ROUTE,
1490
+ JUNIOR_RETENTION_CRON_SCHEDULE,
1491
+ JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
1492
+ JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE,
1493
+ JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE,
1494
+ LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION,
1495
+ getDeploymentServiceVersion,
1496
+ getDeploymentTelemetryAttributes,
1476
1497
  normalizeGenAiFinishReason,
1477
1498
  summarizeMessageText,
1478
1499
  createChatSdkLogger,