@sentry/junior 0.184.0 → 0.186.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 (129) hide show
  1. package/dist/{agent-hooks-XTZVALGQ.js → agent-hooks-4B3Z4WRK.js} +13 -11
  2. package/dist/api/acp/schema.d.ts +20 -2
  3. package/dist/api/code/overview.d.ts +39 -0
  4. package/dist/api/locations/detail.d.ts +1 -1
  5. package/dist/api/people/code.d.ts +22 -0
  6. package/dist/api/schema/code.d.ts +46 -0
  7. package/dist/api/schema/conversation.d.ts +108 -20
  8. package/dist/api/schema/location.d.ts +1 -1
  9. package/dist/api/schema/person.d.ts +1 -1
  10. package/dist/api/schema.d.ts +4 -4
  11. package/dist/api/schema.js +12 -1
  12. package/dist/api.js +368 -78
  13. package/dist/app.js +1412 -538
  14. package/dist/{catalog-runtime-5357XR4F.js → catalog-runtime-AFJCAOHC.js} +4 -4
  15. package/dist/chat/api-turns/accepted-reply.d.ts +11 -0
  16. package/dist/chat/api-turns/cancellation.d.ts +3 -5
  17. package/dist/chat/api-turns/mailbox-input.d.ts +7 -0
  18. package/dist/chat/api-turns/routing.d.ts +18 -3
  19. package/dist/chat/api-turns/work.d.ts +4 -9
  20. package/dist/chat/app/conversation-work.d.ts +1 -1
  21. package/dist/chat/app/factory.d.ts +4 -0
  22. package/dist/chat/app/services.d.ts +4 -3
  23. package/dist/chat/conversations/history.d.ts +83 -9
  24. package/dist/chat/conversations/turn-lifecycle.d.ts +6 -3
  25. package/dist/chat/providers/slack/input.d.ts +32 -0
  26. package/dist/chat/{runtime → providers/slack}/processing-reaction.d.ts +6 -8
  27. package/dist/chat/{runtime/slack-resume.d.ts → providers/slack/resume.d.ts} +16 -19
  28. package/dist/chat/providers/slack/runtime.d.ts +1 -12
  29. package/dist/chat/providers/slack/turn.d.ts +10 -25
  30. package/dist/chat/resource-events/actor.d.ts +7 -2
  31. package/dist/chat/resource-events/app-publisher.d.ts +18 -0
  32. package/dist/chat/resource-events/catalog.d.ts +19 -0
  33. package/dist/chat/resource-events/ingest.d.ts +0 -1
  34. package/dist/chat/resource-events/notification.d.ts +28 -3
  35. package/dist/chat/resource-events/runtime-catalog.d.ts +7 -2
  36. package/dist/chat/resource-events/store.d.ts +2 -14
  37. package/dist/chat/resource-events/tool-support.d.ts +0 -5
  38. package/dist/chat/resource-events/workspace.d.ts +7 -3
  39. package/dist/chat/runtime/turn-execution.d.ts +7 -2
  40. package/dist/chat/sandbox/egress/credentials.d.ts +5 -4
  41. package/dist/chat/sandbox/egress/session.d.ts +10 -11
  42. package/dist/chat/sandbox/errors.d.ts +1 -1
  43. package/dist/chat/sandbox/ref.d.ts +1 -1
  44. package/dist/chat/sandbox/snapshot/events.d.ts +8 -1
  45. package/dist/chat/sandbox/snapshot/not-ready-error.d.ts +6 -1
  46. package/dist/chat/scheduled-tasks/tool-support.d.ts +5 -5
  47. package/dist/chat/scheduled-tasks/tools/create.d.ts +2 -2
  48. package/dist/chat/scheduled-tasks/tools/delete.d.ts +2 -2
  49. package/dist/chat/scheduled-tasks/tools/list.d.ts +2 -2
  50. package/dist/chat/scheduled-tasks/tools/run-now.d.ts +2 -2
  51. package/dist/chat/scheduled-tasks/tools/update.d.ts +2 -2
  52. package/dist/chat/scheduled-tasks/types.d.ts +1 -1
  53. package/dist/chat/sentry-links.d.ts +2 -0
  54. package/dist/chat/services/provider-retry.d.ts +2 -0
  55. package/dist/chat/services/turn-failure-response.d.ts +4 -0
  56. package/dist/chat/services/turn-session-routing.d.ts +20 -5
  57. package/dist/chat/task-execution/paused-turn.d.ts +0 -2
  58. package/dist/chat/task-execution/slack-resource-event.d.ts +47 -0
  59. package/dist/chat/task-execution/slack-work.d.ts +0 -21
  60. package/dist/chat/task-execution/state.d.ts +2 -2
  61. package/dist/chat/task-execution/store.d.ts +1 -1
  62. package/dist/chat/task-execution/turn-wake.d.ts +12 -0
  63. package/dist/chat/tool-support/action-review.d.ts +1 -1
  64. package/dist/chat/tools/event-tasks.d.ts +1 -1
  65. package/dist/chat/tools/resource-events.d.ts +2 -2
  66. package/dist/chat/tools/search-conversation-events.d.ts +1 -1
  67. package/dist/chat/tools/types.d.ts +1 -1
  68. package/dist/chat/tools/watch-resource-events.d.ts +2 -2
  69. package/dist/{chunk-Z3QAXJR7.js → chunk-2IBDVE62.js} +12 -9
  70. package/dist/{chunk-4RONS3WR.js → chunk-2U7EPTRZ.js} +11 -5
  71. package/dist/{chunk-3S7ULUWW.js → chunk-3CVEE6LA.js} +1 -1
  72. package/dist/{chunk-IZDYYYGP.js → chunk-43LODHJM.js} +24 -384
  73. package/dist/{chunk-LHXIZLFF.js → chunk-64WF2GQ3.js} +1 -1
  74. package/dist/{chunk-YKX6MTLU.js → chunk-7EOWT62G.js} +1 -1
  75. package/dist/{chunk-UBOIHNTH.js → chunk-7EU4YSZ4.js} +362 -188
  76. package/dist/{chunk-UF6BUA5W.js → chunk-ACGWTJ74.js} +3 -3
  77. package/dist/{chunk-6UDPINOX.js → chunk-AD64YMEC.js} +19 -44
  78. package/dist/{chunk-MLSQX2EX.js → chunk-BRKB5R7P.js} +1 -1
  79. package/dist/{chunk-E57WPXWY.js → chunk-CM6RTYSO.js} +5 -5
  80. package/dist/{chunk-MAPJFUMV.js → chunk-CV5CPRVG.js} +3 -3
  81. package/dist/chunk-D4YV5TDV.js +45 -0
  82. package/dist/{chunk-HIPUIPJM.js → chunk-DHYZ4VKG.js} +383 -254
  83. package/dist/{chunk-DUKIDPF6.js → chunk-DOP3FIQC.js} +1 -1
  84. package/dist/{chunk-BT53RIGJ.js → chunk-EWRPUXE3.js} +12 -50
  85. package/dist/{chunk-BHYRYYLY.js → chunk-FFYDRLXW.js} +1 -1
  86. package/dist/chunk-GFBR4S3Q.js +406 -0
  87. package/dist/chunk-GQMQCY7H.js +58 -0
  88. package/dist/{chunk-JNO2GUDS.js → chunk-GSB3NTNS.js} +926 -1856
  89. package/dist/{chunk-2ZQPVX7C.js → chunk-H7X2G2KS.js} +25 -12
  90. package/dist/{chunk-WQFEWULF.js → chunk-HKFLRIBD.js} +2 -2
  91. package/dist/{chunk-SHJK75Z2.js → chunk-HWXP6RHG.js} +38 -4
  92. package/dist/{chunk-RF6J3DIO.js → chunk-INQHUE72.js} +84 -1
  93. package/dist/{chunk-4CNDGK25.js → chunk-JFPY6XFF.js} +911 -993
  94. package/dist/{chunk-6WGC3SO4.js → chunk-MCLWOBPN.js} +80 -18
  95. package/dist/{chunk-PJPRXO2T.js → chunk-NRMAOGRS.js} +1 -1
  96. package/dist/{chunk-ACPDVEJO.js → chunk-O6GQO7VP.js} +201 -218
  97. package/dist/{chunk-M5YWNMTE.js → chunk-OZG7E22Y.js} +24 -6
  98. package/dist/{chunk-WVIA7V3M.js → chunk-PFAZSRGR.js} +29 -1
  99. package/dist/{chunk-LCP4EDKR.js → chunk-PZZOGHVR.js} +14 -4
  100. package/dist/{chunk-QABCY33S.js → chunk-QBL2AVFF.js} +2 -2
  101. package/dist/{chunk-FKEZZMXS.js → chunk-QU3URVWG.js} +9 -94
  102. package/dist/{chunk-M3QYTBQ6.js → chunk-STOCCPWH.js} +11 -2
  103. package/dist/{chunk-K7VDC2QW.js → chunk-TXLBLGNQ.js} +6 -6
  104. package/dist/{chunk-JA43DV4Y.js → chunk-VOGOTEW7.js} +1 -1
  105. package/dist/{chunk-HUXFMDBZ.js → chunk-VQIWBJOP.js} +1 -1
  106. package/dist/{chunk-JM2COLGC.js → chunk-VQZYIVYN.js} +6 -6
  107. package/dist/{chunk-BCHYQS4B.js → chunk-VXL2LBPK.js} +1 -1
  108. package/dist/{chunk-6VOYP4M6.js → chunk-YXSBZRP7.js} +1 -1
  109. package/dist/cli/chat.js +35 -33
  110. package/dist/cli/check.js +5 -5
  111. package/dist/cli/plugins.js +14 -12
  112. package/dist/cli/snapshot-create.js +10 -9
  113. package/dist/cli/upgrade.js +7 -6
  114. package/dist/{db-MA52H62H.js → db-7XL4UPAE.js} +8 -6
  115. package/dist/instrumentation.js +3 -3
  116. package/dist/nitro.js +7 -6
  117. package/dist/{oauth-callback-server-DXGHKN6S.js → oauth-callback-server-RAOYHWDI.js} +30 -27
  118. package/dist/{runner-4IXUAQNK.js → runner-KMPBWRPM.js} +24 -19
  119. package/dist/{skills-X3DY7AXO.js → skills-IPCALGLQ.js} +5 -5
  120. package/dist/spawn-OSOWTMBG.js +41 -0
  121. package/dist/task-runner-IQNBA3RY.js +34 -0
  122. package/dist/{validation-Z6JXSTJS.js → validation-BSRCCX6N.js} +5 -5
  123. package/dist/version.js +1 -1
  124. package/dist/{work-OKWRFBDW.js → work-T6UFTOJY.js} +24 -19
  125. package/dist/worker-L35OG7VA.js +24 -0
  126. package/package.json +5 -5
  127. package/dist/spawn-43WGS6CH.js +0 -37
  128. package/dist/task-runner-VDRKITPV.js +0 -32
  129. package/dist/worker-B236AE72.js +0 -22
@@ -2,29 +2,29 @@ import {
2
2
  coerceThreadConversationState,
3
3
  getPersistedThreadState,
4
4
  persistThreadStateById
5
- } from "./chunk-E57WPXWY.js";
5
+ } from "./chunk-CM6RTYSO.js";
6
6
  import {
7
7
  buildDeterministicTurnId,
8
8
  clearPendingAuth,
9
9
  markTurnClosed,
10
10
  markTurnCompleted
11
- } from "./chunk-JA43DV4Y.js";
11
+ } from "./chunk-VOGOTEW7.js";
12
12
  import {
13
13
  hydrateConversationMessages,
14
14
  markConversationMessage
15
- } from "./chunk-2ZQPVX7C.js";
15
+ } from "./chunk-H7X2G2KS.js";
16
16
  import {
17
17
  ProviderError,
18
18
  findProviderError,
19
19
  getProviderErrorAttributes,
20
20
  getProviderErrorUserMessage
21
- } from "./chunk-6UDPINOX.js";
21
+ } from "./chunk-AD64YMEC.js";
22
22
  import {
23
23
  parseSlackMessageTs
24
24
  } from "./chunk-N7TMSOZH.js";
25
25
  import {
26
26
  buildTurnFailureResponse
27
- } from "./chunk-3S7ULUWW.js";
27
+ } from "./chunk-3CVEE6LA.js";
28
28
 
29
29
  // src/chat/runtime/delivered-turn-state.ts
30
30
  function buildDeliveredTurnStatePatch(args) {
@@ -71,6 +71,21 @@ function getExecutionFailureReason(reply) {
71
71
  }
72
72
  return "empty assistant turn";
73
73
  }
74
+ function getTurnFailureReason(reply) {
75
+ if (reply.diagnostics.outcome === "success") {
76
+ return void 0;
77
+ }
78
+ if (reply.diagnostics.outcome === "provider_error") {
79
+ return findProviderError(reply.diagnostics.providerError)?.kind ?? "unknown";
80
+ }
81
+ if (reply.diagnostics.toolErrorCount > 0) {
82
+ return "tool_errors";
83
+ }
84
+ if (reply.diagnostics.usedPrimaryText && reply.diagnostics.assistantMessageCount > 0) {
85
+ return "suppressed_output";
86
+ }
87
+ return "empty_output";
88
+ }
74
89
  function getFailureCapture(reply) {
75
90
  if (reply.diagnostics.outcome === "provider_error") {
76
91
  const providerError = findProviderError(reply.diagnostics.providerError);
@@ -114,12 +129,14 @@ function finalizeFailedTurnReplyWithEvent(args) {
114
129
  if (args.reply.diagnostics.outcome === "success") {
115
130
  return { reply: args.reply };
116
131
  }
132
+ const failureReason = getTurnFailureReason(args.reply);
117
133
  const capture = getFailureCapture(args.reply);
118
134
  const eventId = requireTurnFailureEventId(
119
135
  args.logException(capture.error, capture.eventName, {
120
136
  ...getAgentTurnDiagnosticsAttributes(args.reply),
121
137
  ...args.attributes,
122
- ...capture.attributes
138
+ ...capture.attributes,
139
+ ...failureReason ? { "app.ai.failure_reason": failureReason } : void 0
123
140
  }),
124
141
  capture.eventName
125
142
  );
@@ -128,6 +145,7 @@ function finalizeFailedTurnReplyWithEvent(args) {
128
145
  const failureText = providerUserMessage ? `${providerUserMessage} Reference: \`event_id=${eventId}\`.` : buildTurnFailureResponse(eventId);
129
146
  return {
130
147
  eventId,
148
+ ...failureReason ? { failureReason } : void 0,
131
149
  reply: {
132
150
  ...args.reply,
133
151
  text: providerPartialText ? `${providerPartialText}${getInterruptionMarker()}` : failureText
@@ -1,6 +1,10 @@
1
1
  import {
2
2
  usageSchema
3
3
  } from "./chunk-PDO5BLNM.js";
4
+ import {
5
+ conversationTurnFailureCodeSchema,
6
+ conversationTurnFailureReasonSchema
7
+ } from "./chunk-GFBR4S3Q.js";
4
8
  import {
5
9
  juniorDestinationKindSchema
6
10
  } from "./chunk-VFUK3X5B.js";
@@ -42,16 +46,27 @@ import { z as z2 } from "zod";
42
46
  import { codeChangeStateSchema } from "@sentry/junior-plugin-api";
43
47
  var codeChangeSummarySchema = z2.object({
44
48
  closed: z2.number().int().nonnegative(),
49
+ costUsd: z2.number().nonnegative().optional(),
45
50
  created: z2.number().int().nonnegative(),
51
+ medianCostUsd: z2.number().nonnegative().optional(),
52
+ medianMergeTimeMs: z2.number().nonnegative().optional(),
46
53
  merged: z2.number().int().nonnegative(),
47
54
  mergeRate: z2.number().min(0).max(1).optional(),
48
55
  open: z2.number().int().nonnegative()
49
56
  }).strict();
57
+ var codeActivityDaySchema = z2.object({
58
+ closed: z2.number().int().nonnegative(),
59
+ created: z2.number().int().nonnegative(),
60
+ date: z2.string().date(),
61
+ merged: z2.number().int().nonnegative()
62
+ }).strict();
50
63
  var codeRepositorySummarySchema = z2.object({
51
64
  closed: z2.number().int().nonnegative(),
52
65
  created: z2.number().int().nonnegative(),
53
66
  id: z2.string().uuid(),
67
+ medianCostUsd: z2.number().nonnegative().optional(),
54
68
  merged: z2.number().int().nonnegative(),
69
+ mergeRate: z2.number().min(0).max(1).optional(),
55
70
  name: z2.string().min(1),
56
71
  open: z2.number().int().nonnegative(),
57
72
  provider: z2.string().min(1),
@@ -70,6 +85,7 @@ var codeChangeSummaryReportSchema = z2.object({
70
85
  url: z2.string().url().optional()
71
86
  }).strict();
72
87
  var codeOverviewReportSchema = z2.object({
88
+ activityDays: z2.array(codeActivityDaySchema),
73
89
  changes: z2.array(codeChangeSummaryReportSchema),
74
90
  generatedAt: z2.string(),
75
91
  repositories: z2.array(codeRepositorySummarySchema),
@@ -77,6 +93,13 @@ var codeOverviewReportSchema = z2.object({
77
93
  windowEnd: z2.string(),
78
94
  windowStart: z2.string()
79
95
  }).strict();
96
+ var codePersonReportSchema = z2.object({
97
+ activityDays: z2.array(codeActivityDaySchema),
98
+ generatedAt: z2.string(),
99
+ summary: codeChangeSummarySchema,
100
+ windowEnd: z2.string(),
101
+ windowStart: z2.string()
102
+ }).strict();
80
103
 
81
104
  // src/api/schema/conversation.ts
82
105
  import { z as z3 } from "zod";
@@ -381,7 +404,10 @@ var conversationReportTurnLifecycleEventDataSchema = z3.discriminatedUnion(
381
404
  type: z3.literal("turn_lifecycle"),
382
405
  turnId: z3.string().min(1),
383
406
  state: z3.literal("failed"),
384
- failureKind: z3.enum(["agent", "delivery"])
407
+ failureCode: conversationTurnFailureCodeSchema,
408
+ failureReason: conversationTurnFailureReasonSchema.optional(),
409
+ eventId: z3.string().regex(/^[a-f0-9]{32}$/i).optional(),
410
+ sentryEventUrl: z3.string().url().optional()
385
411
  }).strict()
386
412
  ]
387
413
  );
@@ -933,9 +959,11 @@ export {
933
959
  conversationFeedSchema,
934
960
  conversationStatsReportSchema,
935
961
  codeChangeSummarySchema,
962
+ codeActivityDaySchema,
936
963
  codeRepositorySummarySchema,
937
964
  codeChangeSummaryReportSchema,
938
965
  codeOverviewReportSchema,
966
+ codePersonReportSchema,
939
967
  dailyConversationActivitySchema,
940
968
  activityDays,
941
969
  locationParamsSchema,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getStateAdapter
3
- } from "./chunk-DUKIDPF6.js";
3
+ } from "./chunk-DOP3FIQC.js";
4
4
  import {
5
5
  getClient
6
6
  } from "./chunk-PEQXYSSE.js";
@@ -61,7 +61,7 @@ function buildSentryWebBaseUrl(dsn) {
61
61
  const path = dsn.path ? `/${dsn.path}` : "";
62
62
  return `${dsn.protocol}://${dsn.host}${port}${path}`;
63
63
  }
64
- function buildSentryConversationUrl(conversationId) {
64
+ function buildSentryOrgPath(args) {
65
65
  const client = getClient();
66
66
  const dsn = client?.getDsn();
67
67
  if (!dsn?.host || !dsn.projectId) {
@@ -71,18 +71,28 @@ function buildSentryConversationUrl(conversationId) {
71
71
  if (!orgSlug) {
72
72
  return void 0;
73
73
  }
74
- const encodedId = encodeURIComponent(conversationId);
75
74
  const params = new URLSearchParams();
76
75
  params.set("project", dsn.projectId);
77
- const path = `explore/conversations/${encodedId}/?${params.toString()}`;
76
+ const path = `${args.path}?${params.toString()}`;
78
77
  if (isSentrySaasDsnHost(dsn.host)) {
79
78
  return `https://${orgSlug}.sentry.io/${path}`;
80
79
  }
81
80
  return `${buildSentryWebBaseUrl(dsn)}/organizations/${orgSlug}/${path}`;
82
81
  }
82
+ function buildSentryConversationUrl(conversationId) {
83
+ return buildSentryOrgPath({
84
+ path: `explore/conversations/${encodeURIComponent(conversationId)}/`
85
+ });
86
+ }
87
+ function buildSentryEventUrl(eventId) {
88
+ return buildSentryOrgPath({
89
+ path: `events/${encodeURIComponent(eventId)}/`
90
+ });
91
+ }
83
92
 
84
93
  export {
85
94
  buildSentryConversationUrl,
95
+ buildSentryEventUrl,
86
96
  createWebAuthorization,
87
97
  getWebAuthorization,
88
98
  deleteWebAuthorization
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createAndEnqueueAgentInvocation
3
- } from "./chunk-BT53RIGJ.js";
3
+ } from "./chunk-EWRPUXE3.js";
4
4
  import {
5
5
  actorFromRun,
6
6
  toolInvocationDestination
7
- } from "./chunk-RF6J3DIO.js";
7
+ } from "./chunk-INQHUE72.js";
8
8
 
9
9
  // src/chat/agent-invocations/spawn.ts
10
10
  function bindSpawnAgent(run, options) {
@@ -1,38 +1,32 @@
1
- import {
2
- isAgentRunFeatureDisabled
3
- } from "./chunk-RF6J3DIO.js";
4
1
  import {
5
2
  resolveBaseUrl
6
- } from "./chunk-JM2COLGC.js";
7
- import {
8
- isExperimentalFeatureEnabled
9
- } from "./chunk-2LYHWMR4.js";
3
+ } from "./chunk-VQZYIVYN.js";
10
4
  import {
11
5
  createPluginLogger,
12
6
  getPlugins,
13
7
  getSlackClient,
14
8
  withSlackRetries
15
- } from "./chunk-4CNDGK25.js";
9
+ } from "./chunk-JFPY6XFF.js";
16
10
  import {
17
11
  getDb,
18
12
  parseDestination
19
- } from "./chunk-IZDYYYGP.js";
13
+ } from "./chunk-43LODHJM.js";
20
14
  import {
21
15
  sleep
22
- } from "./chunk-SHJK75Z2.js";
16
+ } from "./chunk-HWXP6RHG.js";
23
17
  import {
24
18
  acquireActiveLock,
25
19
  getStateAdapter
26
- } from "./chunk-DUKIDPF6.js";
20
+ } from "./chunk-DOP3FIQC.js";
27
21
  import {
28
22
  pluginCatalogRuntime
29
- } from "./chunk-PJPRXO2T.js";
23
+ } from "./chunk-NRMAOGRS.js";
30
24
  import {
31
25
  fetchWithBoundedOAuthErrorBodies
32
- } from "./chunk-LHXIZLFF.js";
26
+ } from "./chunk-64WF2GQ3.js";
33
27
  import {
34
28
  isRecord
35
- } from "./chunk-3S7ULUWW.js";
29
+ } from "./chunk-3CVEE6LA.js";
36
30
 
37
31
  // src/chat/capabilities/router.ts
38
32
  var ProviderCredentialRouter = class {
@@ -144,83 +138,6 @@ async function issueProviderCredentialLease(input) {
144
138
  return await getSandboxEgressRouter().issue(input);
145
139
  }
146
140
 
147
- // src/chat/runtime/agent-runner.ts
148
- var AGENT_ABORT_SETTLE_GRACE_MS = 5e3;
149
- function createAgentRunner(execute, options) {
150
- const attachmentStorage = options?.attachmentStorage;
151
- const streamFn = options?.streamFn;
152
- const tracePropagation = options?.tracePropagation;
153
- const bindSpawnAgent = options?.bindSpawnAgent;
154
- const canBindSpawn = Boolean(bindSpawnAgent) && isExperimentalFeatureEnabled("subagents");
155
- return {
156
- run: async (run) => {
157
- const spawnAgent = bindSpawnAgent && canBindSpawn && !isAgentRunFeatureDisabled(run.disabledFeatures, "subagents") ? bindSpawnAgent(run) : void 0;
158
- const nextRun = {
159
- ...run,
160
- environment: {
161
- ...run.environment,
162
- attachmentStorage: run.environment?.attachmentStorage ?? attachmentStorage,
163
- sandboxTracePropagation: run.environment?.sandboxTracePropagation ?? tracePropagation
164
- },
165
- ...spawnAgent ? {
166
- durability: {
167
- ...run.durability,
168
- spawnAgent
169
- }
170
- } : void 0
171
- };
172
- return await execute(nextRun, streamFn);
173
- }
174
- };
175
- }
176
- async function waitForAgentSettlement(runPromise) {
177
- let timeoutId;
178
- const settleGrace = new Promise((resolve) => {
179
- timeoutId = setTimeout(resolve, AGENT_ABORT_SETTLE_GRACE_MS);
180
- timeoutId.unref?.();
181
- });
182
- await Promise.race([
183
- runPromise.then(
184
- () => void 0,
185
- () => void 0
186
- ),
187
- settleGrace
188
- ]);
189
- if (timeoutId) {
190
- clearTimeout(timeoutId);
191
- }
192
- }
193
- async function runAgentWithTimeout(agentRunner, run, timeoutMs) {
194
- if (typeof timeoutMs !== "number") {
195
- return await agentRunner.run(run);
196
- }
197
- const timeoutError = new Error(
198
- `executeAgentRun timed out after ${timeoutMs}ms`
199
- );
200
- const abortController = new AbortController();
201
- const signal = run.signal ? AbortSignal.any([run.signal, abortController.signal]) : abortController.signal;
202
- const runPromise = agentRunner.run({ ...run, signal });
203
- let timeoutId;
204
- const timeoutPromise = new Promise((_, reject) => {
205
- timeoutId = setTimeout(() => {
206
- abortController.abort(timeoutError);
207
- reject(timeoutError);
208
- }, timeoutMs);
209
- });
210
- try {
211
- return await Promise.race([runPromise, timeoutPromise]);
212
- } catch (error) {
213
- if (abortController.signal.aborted) {
214
- await waitForAgentSettlement(runPromise);
215
- }
216
- throw error;
217
- } finally {
218
- if (timeoutId) {
219
- clearTimeout(timeoutId);
220
- }
221
- }
222
- }
223
-
224
141
  // src/chat/mcp/errors.ts
225
142
  var McpProviderError = class extends Error {
226
143
  phase;
@@ -1241,7 +1158,5 @@ export {
1241
1158
  deleteMcpStoredOAuthCredentials,
1242
1159
  deleteMcpServerSessionId,
1243
1160
  createMcpOAuthClientProvider,
1244
- finalizeMcpAuthorization,
1245
- createAgentRunner,
1246
- runAgentWithTimeout
1161
+ finalizeMcpAuthorization
1247
1162
  };
@@ -1,3 +1,7 @@
1
+ import {
2
+ getConversationEventStore
3
+ } from "./chunk-43LODHJM.js";
4
+
1
5
  // src/chat/conversations/turn-lifecycle.ts
2
6
  var ConversationTurnLifecycleService = class {
3
7
  constructor(events) {
@@ -33,7 +37,7 @@ var ConversationTurnLifecycleService = class {
33
37
  }
34
38
  ]);
35
39
  }
36
- /** Record a classified failure once without accepting raw error details. */
40
+ /** Record a classified failure once. Do not store raw error text. */
37
41
  async fail(input) {
38
42
  await this.events.append(input.conversationId, [
39
43
  {
@@ -43,13 +47,18 @@ var ConversationTurnLifecycleService = class {
43
47
  type: "turn_failed",
44
48
  turnId: input.turnId,
45
49
  failureCode: input.failureCode,
50
+ ...input.failureReason ? { failureReason: input.failureReason } : void 0,
46
51
  ...input.eventId ? { eventId: input.eventId } : void 0
47
52
  }
48
53
  }
49
54
  ]);
50
55
  }
51
56
  };
57
+ function getTurnLifecycle() {
58
+ return new ConversationTurnLifecycleService(getConversationEventStore());
59
+ }
52
60
 
53
61
  export {
54
- ConversationTurnLifecycleService
62
+ ConversationTurnLifecycleService,
63
+ getTurnLifecycle
55
64
  };
@@ -7,23 +7,23 @@ import {
7
7
  import {
8
8
  formatProviderLabel,
9
9
  startOAuthFlow
10
- } from "./chunk-JM2COLGC.js";
10
+ } from "./chunk-VQZYIVYN.js";
11
11
  import {
12
12
  abandonReplacedPendingAuth,
13
13
  canReusePendingAuthLink
14
- } from "./chunk-JA43DV4Y.js";
14
+ } from "./chunk-VOGOTEW7.js";
15
15
  import {
16
16
  recordAuthorizationRequested
17
- } from "./chunk-2ZQPVX7C.js";
17
+ } from "./chunk-H7X2G2KS.js";
18
18
  import {
19
19
  AGENT_INVOCATION_MAILBOX_STATUSES
20
- } from "./chunk-BCHYQS4B.js";
20
+ } from "./chunk-VXL2LBPK.js";
21
21
  import {
22
22
  TURN_REASONING_LEVELS
23
- } from "./chunk-6UDPINOX.js";
23
+ } from "./chunk-D4YV5TDV.js";
24
24
  import {
25
25
  pluginCatalogRuntime
26
- } from "./chunk-PJPRXO2T.js";
26
+ } from "./chunk-NRMAOGRS.js";
27
27
  import {
28
28
  credentialContextSchema
29
29
  } from "./chunk-CEMMLV5L.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  abandonTurnRecord,
3
3
  extractAssistantText
4
- } from "./chunk-2ZQPVX7C.js";
4
+ } from "./chunk-H7X2G2KS.js";
5
5
 
6
6
  // src/chat/state/turn-id.ts
7
7
  function buildDeterministicTurnId(messageId) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-PJPRXO2T.js";
3
+ } from "./chunk-NRMAOGRS.js";
4
4
 
5
5
  // src/chat/plugins/validation.ts
6
6
  import { isDeepStrictEqual } from "util";
@@ -5,19 +5,19 @@ import {
5
5
  isDmChannel,
6
6
  normalizeSlackConversationId,
7
7
  withSlackRetries
8
- } from "./chunk-4CNDGK25.js";
8
+ } from "./chunk-JFPY6XFF.js";
9
9
  import {
10
10
  parseDestination
11
- } from "./chunk-IZDYYYGP.js";
11
+ } from "./chunk-43LODHJM.js";
12
12
  import {
13
13
  getStateAdapter
14
- } from "./chunk-DUKIDPF6.js";
14
+ } from "./chunk-DOP3FIQC.js";
15
15
  import {
16
16
  normalizeSlackEmojiName
17
- } from "./chunk-6UDPINOX.js";
17
+ } from "./chunk-AD64YMEC.js";
18
18
  import {
19
19
  pluginCatalogRuntime
20
- } from "./chunk-PJPRXO2T.js";
20
+ } from "./chunk-NRMAOGRS.js";
21
21
  import {
22
22
  parseSlackMessageTs,
23
23
  parseSlackUserId
@@ -26,7 +26,7 @@ import {
26
26
  isRecord,
27
27
  logInfo,
28
28
  logWarn
29
- } from "./chunk-3S7ULUWW.js";
29
+ } from "./chunk-3CVEE6LA.js";
30
30
 
31
31
  // src/chat/slack/outbound.ts
32
32
  var MAX_SLACK_MESSAGE_TEXT_CHARS = 4e4;
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-VFUK3X5B.js";
5
5
  import {
6
6
  DEFAULT_SQL_STATEMENT_TIMEOUT_MS
7
- } from "./chunk-6UDPINOX.js";
7
+ } from "./chunk-AD64YMEC.js";
8
8
 
9
9
  // src/db/neon.ts
10
10
  import { AsyncLocalStorage } from "async_hooks";
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@sentry/junior",
4
- version: "0.184.0",
4
+ version: "0.186.0",
5
5
  private: false,
6
6
  publishConfig: {
7
7
  access: "public"
package/dist/cli/chat.js CHANGED
@@ -1,50 +1,52 @@
1
1
  import {
2
2
  executeAgentRun
3
- } from "../chunk-JNO2GUDS.js";
4
- import "../chunk-K7VDC2QW.js";
3
+ } from "../chunk-GSB3NTNS.js";
4
+ import "../chunk-TXLBLGNQ.js";
5
5
  import "../chunk-6Y5B5PEX.js";
6
6
  import "../chunk-DIB4GX3G.js";
7
+ import "../chunk-QU3URVWG.js";
8
+ import "../chunk-VQZYIVYN.js";
9
+ import "../chunk-DHYZ4VKG.js";
10
+ import "../chunk-7EOWT62G.js";
7
11
  import {
8
12
  createAgentRunner
9
- } from "../chunk-FKEZZMXS.js";
10
- import "../chunk-RF6J3DIO.js";
11
- import "../chunk-JM2COLGC.js";
13
+ } from "../chunk-INQHUE72.js";
14
+ import "../chunk-2IBDVE62.js";
15
+ import "../chunk-VOGOTEW7.js";
16
+ import "../chunk-H7X2G2KS.js";
12
17
  import "../chunk-2LYHWMR4.js";
13
- import "../chunk-HIPUIPJM.js";
14
- import "../chunk-YKX6MTLU.js";
15
- import "../chunk-Z3QAXJR7.js";
16
- import "../chunk-JA43DV4Y.js";
17
- import "../chunk-2ZQPVX7C.js";
18
- import "../chunk-MAPJFUMV.js";
18
+ import "../chunk-CV5CPRVG.js";
19
19
  import "../chunk-PDO5BLNM.js";
20
20
  import "../chunk-UIE3R5XU.js";
21
21
  import "../chunk-X6GDDWQH.js";
22
22
  import "../chunk-DKIJ2RP5.js";
23
23
  import "../chunk-JAL3CH4G.js";
24
24
  import "../chunk-7H2VZTWN.js";
25
- import "../chunk-MLSQX2EX.js";
25
+ import "../chunk-BRKB5R7P.js";
26
26
  import {
27
27
  loadAppPluginSet
28
28
  } from "../chunk-Y2CM7HXH.js";
29
- import "../chunk-4CNDGK25.js";
29
+ import "../chunk-JFPY6XFF.js";
30
30
  import "../chunk-3Y47VMHV.js";
31
- import "../chunk-IZDYYYGP.js";
32
- import "../chunk-BCHYQS4B.js";
33
- import "../chunk-SHJK75Z2.js";
34
- import "../chunk-DUKIDPF6.js";
31
+ import "../chunk-43LODHJM.js";
32
+ import "../chunk-VXL2LBPK.js";
33
+ import "../chunk-HWXP6RHG.js";
34
+ import "../chunk-DOP3FIQC.js";
35
+ import "../chunk-GFBR4S3Q.js";
35
36
  import "../chunk-VFUK3X5B.js";
36
- import "../chunk-6UDPINOX.js";
37
- import "../chunk-BHYRYYLY.js";
38
- import "../chunk-WQFEWULF.js";
39
- import "../chunk-PJPRXO2T.js";
40
- import "../chunk-LHXIZLFF.js";
37
+ import "../chunk-AD64YMEC.js";
38
+ import "../chunk-D4YV5TDV.js";
39
+ import "../chunk-FFYDRLXW.js";
40
+ import "../chunk-HKFLRIBD.js";
41
+ import "../chunk-NRMAOGRS.js";
42
+ import "../chunk-64WF2GQ3.js";
41
43
  import "../chunk-CEMMLV5L.js";
42
44
  import "../chunk-N7TMSOZH.js";
43
45
  import "../chunk-DWPN6SCH.js";
44
46
  import "../chunk-TXKUKMVO.js";
45
- import "../chunk-3S7ULUWW.js";
47
+ import "../chunk-3CVEE6LA.js";
46
48
  import "../chunk-PEQXYSSE.js";
47
- import "../chunk-6VOYP4M6.js";
49
+ import "../chunk-YXSBZRP7.js";
48
50
 
49
51
  // src/cli/chat.ts
50
52
  import {
@@ -166,10 +168,10 @@ async function configureLocalChatPlugins(pluginSet) {
166
168
  databaseModule
167
169
  ] = await Promise.all([
168
170
  import("../plugins-YTYJMMJF.js"),
169
- import("../agent-hooks-XTZVALGQ.js"),
170
- import("../catalog-runtime-5357XR4F.js"),
171
- import("../validation-Z6JXSTJS.js"),
172
- import("../db-MA52H62H.js")
171
+ import("../agent-hooks-4B3Z4WRK.js"),
172
+ import("../catalog-runtime-AFJCAOHC.js"),
173
+ import("../validation-BSRCCX6N.js"),
174
+ import("../db-7XL4UPAE.js")
173
175
  ]);
174
176
  const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
175
177
  const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
@@ -235,14 +237,14 @@ async function prepareLocalChatRun(io, pluginSet) {
235
237
  await configureLocalChatPlugins(pluginSet);
236
238
  const { setExperimentalFeatures } = await import("../experimental-P5FZM4CU.js");
237
239
  setExperimentalFeatures({ subagents: true });
238
- const { runLocalAgentTurn } = await import("../runner-4IXUAQNK.js");
239
- const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-DXGHKN6S.js");
240
+ const { runLocalAgentTurn } = await import("../runner-KMPBWRPM.js");
241
+ const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-RAOYHWDI.js");
240
242
  const { createLocalOAuthState } = await import("../oauth-relay-5XPVRPYB.js");
241
243
  const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-FIL7EGPR.js");
242
- const { bindSpawnAgent } = await import("../spawn-43WGS6CH.js");
243
- const { createAgentInvocationWorker, routeAgentInvocationWork } = await import("../work-OKWRFBDW.js");
244
+ const { bindSpawnAgent } = await import("../spawn-OSOWTMBG.js");
245
+ const { createAgentInvocationWorker, routeAgentInvocationWork } = await import("../work-T6UFTOJY.js");
244
246
  const { createLocalConversationWork } = await import("../conversation-work-VIOQ5ZF3.js");
245
- const { processConversationWork } = await import("../worker-B236AE72.js");
247
+ const { processConversationWork } = await import("../worker-L35OG7VA.js");
246
248
  let agentRunner;
247
249
  const localConversationWork = createLocalConversationWork(async (message) => {
248
250
  if (!agentRunner) {
package/dist/cli/check.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  parseSkillFile
3
- } from "../chunk-WQFEWULF.js";
4
- import "../chunk-PJPRXO2T.js";
3
+ } from "../chunk-HKFLRIBD.js";
4
+ import "../chunk-NRMAOGRS.js";
5
5
  import {
6
6
  parseInlinePluginManifest,
7
7
  parsePluginManifest
8
- } from "../chunk-LHXIZLFF.js";
8
+ } from "../chunk-64WF2GQ3.js";
9
9
  import "../chunk-CEMMLV5L.js";
10
10
  import "../chunk-N7TMSOZH.js";
11
11
  import "../chunk-DWPN6SCH.js";
@@ -14,9 +14,9 @@ import {
14
14
  JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
15
15
  JUNIOR_HEARTBEAT_ROUTE,
16
16
  LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION
17
- } from "../chunk-3S7ULUWW.js";
17
+ } from "../chunk-3CVEE6LA.js";
18
18
  import "../chunk-PEQXYSSE.js";
19
- import "../chunk-6VOYP4M6.js";
19
+ import "../chunk-YXSBZRP7.js";
20
20
 
21
21
  // src/cli/check.ts
22
22
  import fs from "fs/promises";