@sentry/junior 0.109.0 → 0.110.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 (92) hide show
  1. package/dist/{agent-hooks-FHHVLNPA.js → agent-hooks-ELT4ODFF.js} +12 -13
  2. package/dist/api/conversations/access.d.ts +9 -0
  3. package/dist/api/conversations/aggregate.d.ts +12 -1
  4. package/dist/api/conversations/archive.d.ts +3 -5
  5. package/dist/api/conversations/detail.d.ts +156 -7
  6. package/dist/api/conversations/events.d.ts +1 -1
  7. package/dist/api/conversations/list.d.ts +57 -6
  8. package/dist/api/conversations/projection.d.ts +6 -7
  9. package/dist/api/conversations/reporting.d.ts +10 -4
  10. package/dist/api/conversations/routes.d.ts +2 -1
  11. package/dist/api/conversations/shared.d.ts +1 -1
  12. package/dist/api/conversations/stats.d.ts +37 -6
  13. package/dist/api/conversations/stats.query.d.ts +1 -1
  14. package/dist/api/conversations/usage.d.ts +9 -0
  15. package/dist/api/http.d.ts +7 -0
  16. package/dist/api/locations/detail.d.ts +102 -6
  17. package/dist/api/locations/list.d.ts +43 -5
  18. package/dist/api/locations/query.d.ts +4 -2
  19. package/dist/api/locations/routes.d.ts +2 -1
  20. package/dist/api/people/list.d.ts +28 -6
  21. package/dist/api/people/list.query.d.ts +1 -1
  22. package/dist/api/people/profile.d.ts +96 -7
  23. package/dist/api/people/profile.query.d.ts +4 -2
  24. package/dist/api/people/routes.d.ts +2 -1
  25. package/dist/api/people/shared.d.ts +1219 -2
  26. package/dist/api/route.d.ts +18 -4
  27. package/dist/api/schema/common.d.ts +6 -0
  28. package/dist/api/{conversations/schema.d.ts → schema/conversation.d.ts} +31 -3
  29. package/dist/api/{locations/schema.d.ts → schema/location.d.ts} +5 -0
  30. package/dist/api/{people/schema.d.ts → schema/person.d.ts} +37 -45
  31. package/dist/api/schema.d.ts +8 -22
  32. package/dist/api/schema.js +10 -2
  33. package/dist/api.d.ts +5 -1
  34. package/dist/api.js +767 -384
  35. package/dist/app.js +87 -70
  36. package/dist/catalog-runtime-4GI22PXK.js +16 -0
  37. package/dist/chat/agent/resume.d.ts +11 -12
  38. package/dist/chat/conversations/history.d.ts +3 -0
  39. package/dist/chat/conversations/sql/privacy.d.ts +3 -15
  40. package/dist/chat/pi/messages.d.ts +2 -2
  41. package/dist/chat/pi/sql-model-usage.d.ts +4 -1
  42. package/dist/chat/services/auth-pause.d.ts +4 -0
  43. package/dist/chat/services/context-compaction.d.ts +1 -0
  44. package/dist/chat/task-execution/queue-signing.d.ts +10 -8
  45. package/dist/chat/task-execution/queue.d.ts +9 -7
  46. package/dist/chat/task-execution/slack-work.d.ts +6 -6
  47. package/dist/{chunk-QY636HZU.js → chunk-2T7TIEXI.js} +90 -7
  48. package/dist/{chunk-CEA3A3UA.js → chunk-2ZTTXTSZ.js} +24 -1
  49. package/dist/{chunk-FWJRXN4F.js → chunk-3S7YYHBI.js} +3 -139
  50. package/dist/{chunk-3SXUV423.js → chunk-3TV7OEHL.js} +1 -1
  51. package/dist/{chunk-MXW4GL53.js → chunk-3UBQI73J.js} +7 -7
  52. package/dist/{chunk-IVVGFRQQ.js → chunk-42WRQLJ6.js} +10 -38
  53. package/dist/{chunk-FENLIFJD.js → chunk-4QU44P7Q.js} +69 -10
  54. package/dist/{chunk-O3JMSZLI.js → chunk-6Y5L4BOM.js} +3 -5
  55. package/dist/{chunk-PLB7MRCQ.js → chunk-C4MZ3GP5.js} +1 -1
  56. package/dist/{chunk-72OMGPDS.js → chunk-C5XAFTHY.js} +7 -9
  57. package/dist/{chunk-HHVY4SMP.js → chunk-FPK7XY3F.js} +98 -92
  58. package/dist/{chunk-OUHNWH46.js → chunk-GK47NBDE.js} +1 -1
  59. package/dist/{chunk-ISMWX44P.js → chunk-IYKPU7H6.js} +2 -2
  60. package/dist/{chunk-TMBRFULF.js → chunk-JQFJO5WH.js} +7 -1
  61. package/dist/{chunk-RGX4V75M.js → chunk-L5XQPJ7T.js} +3 -3
  62. package/dist/{chunk-7Q6WCISF.js → chunk-MIAKQNYX.js} +43 -31
  63. package/dist/{chunk-IXKSQGIO.js → chunk-RHHRKSPI.js} +178 -142
  64. package/dist/{chunk-WHMOBKT7.js → chunk-SBOBTS27.js} +2 -2
  65. package/dist/{chunk-HO5NT6OE.js → chunk-W6RJZG7F.js} +4 -4
  66. package/dist/chunk-W75ZPAGG.js +44 -0
  67. package/dist/{chunk-JNAVF45E.js → chunk-WNOVRQ67.js} +2 -2
  68. package/dist/{chunk-TT6GMXNA.js → chunk-Y3H2DN6F.js} +2 -2
  69. package/dist/{chunk-MGUMR35T.js → chunk-Y5FK3CNG.js} +1 -1
  70. package/dist/{chunk-OCD3OZRK.js → chunk-ZKIOWEFL.js} +1 -1
  71. package/dist/cli/chat.js +23 -24
  72. package/dist/cli/check.js +8 -8
  73. package/dist/cli/plugins.js +15 -16
  74. package/dist/cli/snapshot-warmup.js +11 -11
  75. package/dist/cli/upgrade.js +9 -9
  76. package/dist/db/schema/conversations.d.ts +17 -0
  77. package/dist/db/schema.d.ts +17 -0
  78. package/dist/{db-V3NU72O2.js → db-Y6W6CWWW.js} +8 -9
  79. package/dist/instrumentation.js +4 -4
  80. package/dist/nitro.js +3 -4
  81. package/dist/reporting-schema.d.ts +46 -0
  82. package/dist/{runner-JYBCQBLK.js → runner-BBFV5GLR.js} +14 -15
  83. package/dist/{skills-U6MDAST7.js → skills-AR4AF32L.js} +8 -8
  84. package/dist/{validation-72N3JVRU.js → validation-FBIEPTC2.js} +8 -8
  85. package/dist/version.js +1 -1
  86. package/migrations/0007_thick_sugar_man.sql +23 -0
  87. package/migrations/meta/0007_snapshot.json +1013 -0
  88. package/migrations/meta/_journal.json +7 -0
  89. package/package.json +5 -5
  90. package/dist/catalog-runtime-DMGJSLV2.js +0 -16
  91. package/dist/chunk-OB42YVAE.js +0 -16
  92. package/dist/chunk-SYAQIR5Z.js +0 -53
@@ -22,7 +22,7 @@ import {
22
22
  recordMcpProviderConnected,
23
23
  recordToolExecutionStarted,
24
24
  updateConversationStats
25
- } from "./chunk-72OMGPDS.js";
25
+ } from "./chunk-C5XAFTHY.js";
26
26
  import {
27
27
  buildNonInteractiveShellScript,
28
28
  createSandboxInstance,
@@ -32,7 +32,7 @@ import {
32
32
  isSnapshotMissingError,
33
33
  resolveRuntimeDependencySnapshot,
34
34
  runNonInteractiveCommand
35
- } from "./chunk-HO5NT6OE.js";
35
+ } from "./chunk-W6RJZG7F.js";
36
36
  import {
37
37
  addAgentTurnUsage,
38
38
  hasAgentTurnUsage
@@ -49,7 +49,7 @@ import {
49
49
  getPlugins,
50
50
  getSlackToolContext,
51
51
  resolveChannelCapabilities
52
- } from "./chunk-QY636HZU.js";
52
+ } from "./chunk-2T7TIEXI.js";
53
53
  import {
54
54
  SANDBOX_DATA_ROOT,
55
55
  SANDBOX_SKILLS_ROOT,
@@ -58,7 +58,7 @@ import {
58
58
  getStateAdapter,
59
59
  sandboxSkillDir,
60
60
  sandboxSkillFile
61
- } from "./chunk-OUHNWH46.js";
61
+ } from "./chunk-GK47NBDE.js";
62
62
  import {
63
63
  SlackActionError,
64
64
  downloadPrivateSlackFile,
@@ -68,7 +68,7 @@ import {
68
68
  isDmChannel,
69
69
  normalizeSlackConversationId,
70
70
  withSlackRetries
71
- } from "./chunk-RGX4V75M.js";
71
+ } from "./chunk-L5XQPJ7T.js";
72
72
  import {
73
73
  contextProvenance,
74
74
  getConversationEventStore,
@@ -76,8 +76,9 @@ import {
76
76
  getConversationStore,
77
77
  getDb,
78
78
  instructionActors,
79
- instructionProvenanceFor
80
- } from "./chunk-FENLIFJD.js";
79
+ instructionProvenanceFor,
80
+ parseDestination
81
+ } from "./chunk-4QU44P7Q.js";
81
82
  import {
82
83
  sleep
83
84
  } from "./chunk-4ZNGQH7C.js";
@@ -120,7 +121,7 @@ import {
120
121
  stripRuntimeTurnContext,
121
122
  trimTrailingAssistantMessages,
122
123
  unwrapCurrentInstruction
123
- } from "./chunk-JNAVF45E.js";
124
+ } from "./chunk-WNOVRQ67.js";
124
125
  import {
125
126
  parseSlackThreadId,
126
127
  resolveConversationPrivacy,
@@ -130,29 +131,26 @@ import {
130
131
  toGenAiMessagesTraceAttributes,
131
132
  toGenAiPayloadMetadata,
132
133
  toGenAiPayloadTraceAttributes
133
- } from "./chunk-O3JMSZLI.js";
134
- import {
135
- parseDestination
136
- } from "./chunk-SYAQIR5Z.js";
134
+ } from "./chunk-6Y5L4BOM.js";
137
135
  import {
138
136
  discoverSkills,
139
137
  findSkillByName,
140
138
  loadSkillsByName,
141
139
  parseSkillInvocation
142
- } from "./chunk-WHMOBKT7.js";
140
+ } from "./chunk-SBOBTS27.js";
143
141
  import {
144
142
  pluginCatalogRuntime
145
- } from "./chunk-3SXUV423.js";
143
+ } from "./chunk-3TV7OEHL.js";
146
144
  import {
147
145
  CredentialUnavailableError,
148
146
  credentialContextSchema,
149
147
  credentialUserSubjectId,
150
148
  resolveAuthTokenPlaceholder,
151
149
  resolvePluginCommandEnv
152
- } from "./chunk-TT6GMXNA.js";
150
+ } from "./chunk-Y3H2DN6F.js";
153
151
  import {
154
152
  isUserActor
155
- } from "./chunk-PLB7MRCQ.js";
153
+ } from "./chunk-C4MZ3GP5.js";
156
154
  import {
157
155
  extractGenAiUsageAttributes,
158
156
  extractGenAiUsageSummary,
@@ -170,10 +168,13 @@ import {
170
168
  summarizeMessageText,
171
169
  withLogContext,
172
170
  withSpan
173
- } from "./chunk-ISMWX44P.js";
171
+ } from "./chunk-IYKPU7H6.js";
174
172
  import {
175
- isRecord
176
- } from "./chunk-OB42YVAE.js";
173
+ isRecord,
174
+ parseSlackChannelId,
175
+ parseSlackMessageTs,
176
+ parseSlackUserId
177
+ } from "./chunk-42WRQLJ6.js";
177
178
  import {
178
179
  startInactiveSpan,
179
180
  withActiveSpan
@@ -183,11 +184,6 @@ import {
183
184
  soulPathCandidates,
184
185
  worldPathCandidates
185
186
  } from "./chunk-3V7OFJZC.js";
186
- import {
187
- parseSlackChannelId,
188
- parseSlackMessageTs,
189
- parseSlackUserId
190
- } from "./chunk-IVVGFRQQ.js";
191
187
 
192
188
  // src/chat/configuration/defaults.ts
193
189
  var installDefaults = {};
@@ -1211,6 +1207,15 @@ var AuthorizationPauseError = class extends Error {
1211
1207
  this.providerDisplayName = providerDisplayName;
1212
1208
  }
1213
1209
  };
1210
+ var AuthPausePersistenceError = class extends Error {
1211
+ constructor(conversationId, turnId, cause) {
1212
+ super(
1213
+ `Failed to persist auth pause for conversation=${conversationId} turn=${turnId}`,
1214
+ cause === void 0 ? void 0 : { cause }
1215
+ );
1216
+ this.name = "AuthPausePersistenceError";
1217
+ }
1218
+ };
1214
1219
  var AuthorizationFlowDisabledError = class extends Error {
1215
1220
  kind;
1216
1221
  provider;
@@ -14911,7 +14916,6 @@ function extractSliceUsage(messages, beforeMessageCount) {
14911
14916
  }
14912
14917
  function createResumeState(args) {
14913
14918
  let beforeMessageCount = 0;
14914
- let cooperativeYieldError;
14915
14919
  let inputCommitted = false;
14916
14920
  let latestSafeBoundaryMessages = [];
14917
14921
  let timedOut = false;
@@ -14942,9 +14946,6 @@ function createResumeState(args) {
14942
14946
  get timedOut() {
14943
14947
  return timedOut;
14944
14948
  },
14945
- get cooperativeYieldError() {
14946
- return cooperativeYieldError;
14947
- },
14948
14949
  setTurnStartMessageIndex(index) {
14949
14950
  turnStartMessageIndex = index;
14950
14951
  },
@@ -14998,25 +14999,53 @@ function createResumeState(args) {
14998
14999
  }
14999
15000
  return persisted;
15000
15001
  },
15001
- yieldAtSafeBoundaryIfDue(currentMessages) {
15002
+ /** Prepare a cooperative yield at the current durable boundary. */
15003
+ prepareYieldIfDue(currentMessages) {
15002
15004
  if (!args.durability.shouldYield?.()) {
15003
- return;
15005
+ return void 0;
15004
15006
  }
15005
15007
  resumeMessages = this.getResumeSnapshot(currentMessages);
15006
- cooperativeYieldError = new CooperativeTurnYieldError(
15008
+ return new CooperativeTurnYieldError(
15007
15009
  `Agent turn yielded at a safe boundary after ${currentDurationMs()}ms`
15008
15010
  );
15009
- throw cooperativeYieldError;
15010
15011
  },
15011
- /**
15012
- * Persist the continuation for an expected run ending and translate it
15013
- * into an outcome; returns no outcome for genuine errors so the caller's
15014
- * error guards run.
15015
- */
15016
- async translateExpectedEnding(args2) {
15017
- const { error } = args2;
15018
- if (cooperativeYieldError && error instanceof CooperativeTurnYieldError) {
15019
- const usage = args2.currentUsage ?? extractSliceUsage(resumeMessages, beforeMessageCount);
15012
+ /** Persist an auth pause; only a durable pause may return `awaiting_auth`. */
15013
+ async parkForAuth(pause, currentUsage) {
15014
+ const usage = currentUsage ?? (resumeMessages.length > 0 ? extractSliceUsage(resumeMessages, beforeMessageCount) : void 0);
15015
+ try {
15016
+ await args.recordActiveMcpProviders();
15017
+ const sessionRecord = await persistAuthPauseSessionRecord({
15018
+ ...sessionRecordBase(),
15019
+ currentSliceId,
15020
+ currentDurationMs: currentDurationMs(),
15021
+ currentUsage: usage,
15022
+ messages: resumeMessages,
15023
+ errorMessage: pause.message
15024
+ });
15025
+ if (!sessionRecord) {
15026
+ throw new AuthPausePersistenceError(args.conversationId, args.turnId);
15027
+ }
15028
+ return {
15029
+ status: "awaiting_auth",
15030
+ providerDisplayName: pause.providerDisplayName,
15031
+ ...usage ? { usage } : {}
15032
+ };
15033
+ } catch (error) {
15034
+ if (error instanceof AuthPausePersistenceError) {
15035
+ throw error;
15036
+ }
15037
+ throw new AuthPausePersistenceError(
15038
+ args.conversationId,
15039
+ args.turnId,
15040
+ error
15041
+ );
15042
+ }
15043
+ },
15044
+ /** Persist a yield, retry, or timeout as a suspended run. */
15045
+ async translateSuspension(ending) {
15046
+ const { error } = ending;
15047
+ if (error instanceof CooperativeTurnYieldError) {
15048
+ const usage = ending.currentUsage ?? extractSliceUsage(resumeMessages, beforeMessageCount);
15020
15049
  await args.recordActiveMcpProviders();
15021
15050
  const sessionRecord = await persistYieldSessionRecord({
15022
15051
  ...sessionRecordBase(),
@@ -15032,11 +15061,9 @@ function createResumeState(args) {
15032
15061
  );
15033
15062
  }
15034
15063
  return {
15035
- outcome: {
15036
- status: "suspended",
15037
- resumeVersion: sessionRecord.version,
15038
- ...usage ? { usage } : {}
15039
- }
15064
+ status: "suspended",
15065
+ resumeVersion: sessionRecord.version,
15066
+ ...usage ? { usage } : {}
15040
15067
  };
15041
15068
  }
15042
15069
  const resumeReason = error instanceof RetryableDeliveryError ? "retry" : timedOut ? "timeout" : void 0;
@@ -15044,7 +15071,7 @@ function createResumeState(args) {
15044
15071
  if (resumeReason === "retry") {
15045
15072
  resumeMessages = [...latestSafeBoundaryMessages];
15046
15073
  }
15047
- const usage = args2.currentUsage ?? extractSliceUsage(resumeMessages, beforeMessageCount);
15074
+ const usage = ending.currentUsage ?? extractSliceUsage(resumeMessages, beforeMessageCount);
15048
15075
  await args.recordActiveMcpProviders();
15049
15076
  const sessionRecord = await persistContinuationSessionRecord({
15050
15077
  ...sessionRecordBase(),
@@ -15062,37 +15089,14 @@ function createResumeState(args) {
15062
15089
  }
15063
15090
  if (sessionRecord.state === "awaiting_resume") {
15064
15091
  return {
15065
- outcome: {
15066
- status: "suspended",
15067
- resumeVersion: sessionRecord.version,
15068
- ...usage ? { usage } : {}
15069
- }
15092
+ status: "suspended",
15093
+ resumeVersion: sessionRecord.version,
15094
+ ...usage ? { usage } : {}
15070
15095
  };
15071
15096
  }
15072
15097
  throw new TurnSliceLimitExceededError(botConfig.maxSlicesPerTurn);
15073
15098
  }
15074
- if (error instanceof AuthorizationPauseError) {
15075
- const usage = args2.currentUsage ?? (resumeMessages.length > 0 ? extractSliceUsage(resumeMessages, beforeMessageCount) : void 0);
15076
- await args.recordActiveMcpProviders();
15077
- const sessionRecord = await persistAuthPauseSessionRecord({
15078
- ...sessionRecordBase(),
15079
- currentSliceId,
15080
- currentDurationMs: currentDurationMs(),
15081
- currentUsage: usage,
15082
- messages: resumeMessages,
15083
- errorMessage: error.message
15084
- });
15085
- if (sessionRecord) {
15086
- return {
15087
- outcome: {
15088
- status: "awaiting_auth",
15089
- providerDisplayName: error.providerDisplayName,
15090
- ...usage ? { usage } : {}
15091
- }
15092
- };
15093
- }
15094
- }
15095
- return {};
15099
+ return void 0;
15096
15100
  }
15097
15101
  };
15098
15102
  }
@@ -15410,6 +15414,7 @@ ${await summarizeContext(args, deps)}`;
15410
15414
  type: "handoff",
15411
15415
  modelProfile: args.target.modelProfile,
15412
15416
  modelId: args.target.modelId,
15417
+ ...args.target.reasoningLevel ? { reasoningLevel: args.target.reasoningLevel } : {},
15413
15418
  ...args.triggeringToolCallId ? { triggeringToolCallId: args.triggeringToolCallId } : {},
15414
15419
  replacementHistory: replacementMessages.map((replacementMessage) => ({
15415
15420
  message: replacementMessage,
@@ -15731,12 +15736,13 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
15731
15736
  );
15732
15737
  const phaseUsage = hasAgentTurnUsage(standardPhaseUsage) ? standardPhaseUsage : void 0;
15733
15738
  const selectedProfile = profileConfig(botConfig, args.profile);
15739
+ const handoffReasoningLevel = selectedProfile.reasoningLevel ?? turnRoute.reasoningLevel;
15734
15740
  const target = {
15735
15741
  modelId: selectedProfile.modelId,
15736
- modelProfile: args.profile
15742
+ modelProfile: args.profile,
15743
+ reasoningLevel: handoffReasoningLevel
15737
15744
  };
15738
15745
  const handoffModel = resolveGatewayModel(target.modelId);
15739
- const handoffReasoningLevel = selectedProfile.reasoningLevel ?? turnRoute.reasoningLevel;
15740
15746
  const handoffThinkingLevel = toPiReasoningLevel(handoffReasoningLevel);
15741
15747
  void (async () => {
15742
15748
  await observers.onStatus?.({ text: "Switching models" });
@@ -15953,6 +15959,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
15953
15959
  }
15954
15960
  };
15955
15961
  const apiKeyOverride = getPiGatewayApiKey();
15962
+ let pendingPiHookError;
15956
15963
  agent = new Agent({
15957
15964
  ...apiKeyOverride ? { getApiKey: () => apiKeyOverride } : {},
15958
15965
  streamFn: createTracedStreamFn({ conversationPrivacy }),
@@ -15976,7 +15983,11 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
15976
15983
  prepareNextTurn: async () => {
15977
15984
  const update = applyPendingHandoff();
15978
15985
  await drainSteeringMessages();
15979
- runResume.yieldAtSafeBoundaryIfDue(currentAgentMessages());
15986
+ const yieldError = runResume.prepareYieldIfDue(currentAgentMessages());
15987
+ if (yieldError) {
15988
+ pendingPiHookError = yieldError;
15989
+ throw yieldError;
15990
+ }
15980
15991
  return update;
15981
15992
  },
15982
15993
  initialState: {
@@ -16023,7 +16034,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
16023
16034
  if (shouldPromptAgent) {
16024
16035
  runResume.setTurnStartMessageIndex(agent.state.messages.length);
16025
16036
  }
16026
- await withSpan(
16037
+ const authPauseOutcome = await withSpan(
16027
16038
  `invoke_agent ${botConfig.userName}`,
16028
16039
  "gen_ai.invoke_agent",
16029
16040
  spanContext,
@@ -16076,8 +16087,9 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
16076
16087
  });
16077
16088
  removeAbortListener = () => signal.removeEventListener("abort", rejectWithAbort);
16078
16089
  }) : void 0;
16090
+ let result2;
16079
16091
  try {
16080
- return await Promise.race(
16092
+ result2 = await Promise.race(
16081
16093
  abortPromise ? [run2, timeoutPromise, abortPromise] : [run2, timeoutPromise]
16082
16094
  );
16083
16095
  } catch (error) {
@@ -16118,11 +16130,12 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
16118
16130
  runResume.getResumeSnapshot(currentAgentMessages())
16119
16131
  );
16120
16132
  }
16121
- if (getPendingAuthPause()) {
16133
+ const pendingAuthPause = getPendingAuthPause();
16134
+ if (pendingAuthPause) {
16122
16135
  runResume.captureResumeSnapshot(
16123
16136
  runResume.getResumeSnapshot(currentAgentMessages())
16124
16137
  );
16125
- throw getPendingAuthPause();
16138
+ throw pendingAuthPause;
16126
16139
  }
16127
16140
  throw error;
16128
16141
  } finally {
@@ -16131,6 +16144,12 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
16131
16144
  }
16132
16145
  removeAbortListener?.();
16133
16146
  }
16147
+ if (pendingPiHookError) {
16148
+ const error = pendingPiHookError;
16149
+ pendingPiHookError = void 0;
16150
+ throw error;
16151
+ }
16152
+ return result2;
16134
16153
  };
16135
16154
  const requestedProfile = activeModelProfile === STANDARD_MODEL_PROFILE ? turnRoute.profile : void 0;
16136
16155
  let run;
@@ -16159,69 +16178,77 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
16159
16178
  run = shouldPromptAgent ? agent.prompt(freshPromptMessage) : agent.continue();
16160
16179
  }
16161
16180
  let retryUsage;
16162
- for (let attempt = 0; ; attempt += 1) {
16163
- await runAgentStep(run);
16164
- if (assistantMessageDeliveryError) {
16165
- throw assistantMessageDeliveryError;
16166
- }
16167
- signal?.throwIfAborted();
16168
- if (runResume.cooperativeYieldError) {
16169
- throw runResume.cooperativeYieldError;
16170
- }
16171
- newMessages = agent.state.messages.slice(
16172
- runResume.beforeMessageCount
16173
- );
16174
- const outputMessages = newMessages.filter(isAssistantMessage);
16175
- const outputMessagesAttribute = serializeGenAiAttribute(
16176
- conversationPrivacy === "public" ? outputMessages.map(toCanonicalOutputMessage) : void 0
16177
- );
16178
- const lastAssistant = outputMessages.at(-1);
16179
- const usageSummary = extractGenAiUsageSummary(...outputMessages);
16180
- const currentUsage = hasAgentTurnUsage(usageSummary) ? usageSummary : void 0;
16181
- const currentPhaseUsage = addAgentTurnUsage(
16182
- retryUsage,
16183
- currentUsage
16184
- );
16185
- turnUsage = addAgentTurnUsage(handoffPhaseUsage, currentPhaseUsage);
16186
- setSpanAttributes({
16187
- ...outputMessagesAttribute ? { "gen_ai.output.messages": outputMessagesAttribute } : {},
16188
- ...toGenAiMessagesTraceAttributes(
16189
- "gen_ai.output",
16190
- outputMessages
16191
- ),
16192
- ...lastAssistant ? {
16193
- "gen_ai.response.finish_reasons": [
16194
- normalizeGenAiFinishReason(lastAssistant.stopReason)
16195
- ]
16196
- } : {},
16197
- ...extractGenAiUsageAttributes(usageSummary)
16198
- });
16199
- if (getPendingAuthPause()) {
16200
- runResume.captureResumeSnapshot(
16201
- runResume.getResumeSnapshot(currentAgentMessages())
16181
+ try {
16182
+ for (let attempt = 0; ; attempt += 1) {
16183
+ await runAgentStep(run);
16184
+ if (assistantMessageDeliveryError) {
16185
+ throw assistantMessageDeliveryError;
16186
+ }
16187
+ signal?.throwIfAborted();
16188
+ newMessages = agent.state.messages.slice(
16189
+ runResume.beforeMessageCount
16190
+ );
16191
+ const outputMessages = newMessages.filter(isAssistantMessage);
16192
+ const outputMessagesAttribute = serializeGenAiAttribute(
16193
+ conversationPrivacy === "public" ? outputMessages.map(toCanonicalOutputMessage) : void 0
16194
+ );
16195
+ const lastAssistant = outputMessages.at(-1);
16196
+ const usageSummary = extractGenAiUsageSummary(...outputMessages);
16197
+ const currentUsage = hasAgentTurnUsage(usageSummary) ? usageSummary : void 0;
16198
+ const currentPhaseUsage = addAgentTurnUsage(
16199
+ retryUsage,
16200
+ currentUsage
16201
+ );
16202
+ turnUsage = addAgentTurnUsage(
16203
+ handoffPhaseUsage,
16204
+ currentPhaseUsage
16202
16205
  );
16203
- throw getPendingAuthPause();
16206
+ setSpanAttributes({
16207
+ ...outputMessagesAttribute ? { "gen_ai.output.messages": outputMessagesAttribute } : {},
16208
+ ...toGenAiMessagesTraceAttributes(
16209
+ "gen_ai.output",
16210
+ outputMessages
16211
+ ),
16212
+ ...lastAssistant ? {
16213
+ "gen_ai.response.finish_reasons": [
16214
+ normalizeGenAiFinishReason(lastAssistant.stopReason)
16215
+ ]
16216
+ } : {},
16217
+ ...extractGenAiUsageAttributes(usageSummary)
16218
+ });
16219
+ const pendingAuthPause = getPendingAuthPause();
16220
+ if (pendingAuthPause) {
16221
+ runResume.captureResumeSnapshot(
16222
+ runResume.getResumeSnapshot(currentAgentMessages())
16223
+ );
16224
+ throw pendingAuthPause;
16225
+ }
16226
+ const providerRetry = nextProviderRetry({
16227
+ attempt,
16228
+ messages: agent.state.messages,
16229
+ retryableFailure: lastAssistant !== void 0 && isRetryableAssistantError(lastAssistant)
16230
+ });
16231
+ if (!providerRetry) {
16232
+ break;
16233
+ }
16234
+ retryUsage = currentPhaseUsage;
16235
+ agent.state.messages = providerRetry.messages;
16236
+ await runResume.persistSafeBoundary(providerRetry.messages);
16237
+ logWarn(
16238
+ "agent_turn_provider_retry",
16239
+ spanContext,
16240
+ {},
16241
+ "Retrying transient provider failure"
16242
+ );
16243
+ await sleep(providerRetry.delayMs, signal);
16244
+ signal?.throwIfAborted();
16245
+ run = agent.continue();
16204
16246
  }
16205
- const providerRetry = nextProviderRetry({
16206
- attempt,
16207
- messages: agent.state.messages,
16208
- retryableFailure: lastAssistant !== void 0 && isRetryableAssistantError(lastAssistant)
16209
- });
16210
- if (!providerRetry) {
16211
- break;
16247
+ } catch (error) {
16248
+ if (error instanceof AuthorizationPauseError) {
16249
+ return await runResume.parkForAuth(error, turnUsage);
16212
16250
  }
16213
- retryUsage = currentPhaseUsage;
16214
- agent.state.messages = providerRetry.messages;
16215
- await runResume.persistSafeBoundary(providerRetry.messages);
16216
- logWarn(
16217
- "agent_turn_provider_retry",
16218
- spanContext,
16219
- {},
16220
- "Retrying transient provider failure"
16221
- );
16222
- await sleep(providerRetry.delayMs, signal);
16223
- signal?.throwIfAborted();
16224
- run = agent.continue();
16251
+ throw error;
16225
16252
  }
16226
16253
  },
16227
16254
  {
@@ -16242,6 +16269,9 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
16242
16269
  ...inputMessagesAttribute ? { "gen_ai.input.messages": inputMessagesAttribute } : {}
16243
16270
  }
16244
16271
  );
16272
+ if (authPauseOutcome) {
16273
+ return authPauseOutcome;
16274
+ }
16245
16275
  } finally {
16246
16276
  unsubscribe();
16247
16277
  }
@@ -16272,8 +16302,14 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
16272
16302
  throw error.originalError;
16273
16303
  }
16274
16304
  const runError = error instanceof AssistantMessageDeliveryError ? error.originalError : error;
16305
+ if (runError instanceof AuthPausePersistenceError) {
16306
+ throw runError;
16307
+ }
16308
+ if (resume && runError instanceof AuthorizationPauseError) {
16309
+ return await resume.parkForAuth(runError, turnUsage);
16310
+ }
16275
16311
  if (resume) {
16276
- const { outcome } = await resume.translateExpectedEnding({
16312
+ const outcome = await resume.translateSuspension({
16277
16313
  currentUsage: turnUsage,
16278
16314
  error: runError
16279
16315
  });
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-3SXUV423.js";
3
+ } from "./chunk-3TV7OEHL.js";
4
4
  import {
5
5
  logWarn
6
- } from "./chunk-ISMWX44P.js";
6
+ } from "./chunk-IYKPU7H6.js";
7
7
  import {
8
8
  skillRoots
9
9
  } from "./chunk-3V7OFJZC.js";
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  SANDBOX_WORKSPACE_ROOT,
3
3
  getStateAdapter
4
- } from "./chunk-OUHNWH46.js";
4
+ } from "./chunk-GK47NBDE.js";
5
5
  import {
6
6
  sleep
7
7
  } from "./chunk-4ZNGQH7C.js";
8
8
  import {
9
9
  toOptionalTrimmed
10
- } from "./chunk-JNAVF45E.js";
10
+ } from "./chunk-WNOVRQ67.js";
11
11
  import {
12
12
  pluginCatalogRuntime
13
- } from "./chunk-3SXUV423.js";
13
+ } from "./chunk-3TV7OEHL.js";
14
14
  import {
15
15
  withSpan
16
- } from "./chunk-ISMWX44P.js";
16
+ } from "./chunk-IYKPU7H6.js";
17
17
 
18
18
  // src/chat/sandbox/runtime-dependencies.ts
19
19
  var GLOBAL_RUNTIME_DEPENDENCIES = [
@@ -0,0 +1,44 @@
1
+ import {
2
+ JUNIOR_VERSION
3
+ } from "./chunk-ZKIOWEFL.js";
4
+
5
+ // src/deployment.ts
6
+ var JUNIOR_HEARTBEAT_ROUTE = "/api/internal/heartbeat";
7
+ var JUNIOR_HEARTBEAT_CRON_SCHEDULE = "* * * * *";
8
+ var JUNIOR_RETENTION_ROUTE = "/api/internal/retention";
9
+ var JUNIOR_RETENTION_CRON_SCHEDULE = "0 4 * * *";
10
+ var JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE = "/api/internal/agent/continue";
11
+ var JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE = "/api/internal/plugin/tasks";
12
+ var LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION = "api/internal/agent/continue.ts";
13
+ function toOptionalTrimmed(value) {
14
+ const trimmed = value?.trim();
15
+ return trimmed ? trimmed : void 0;
16
+ }
17
+ function getDeploymentServiceVersion() {
18
+ return toOptionalTrimmed(process.env.SENTRY_RELEASE) ?? toOptionalTrimmed(process.env.VERCEL_GIT_COMMIT_SHA);
19
+ }
20
+ function getDeploymentTelemetryAttributes() {
21
+ const attributes = {};
22
+ const serviceVersion = getDeploymentServiceVersion();
23
+ const deploymentId = toOptionalTrimmed(process.env.VERCEL_DEPLOYMENT_ID);
24
+ attributes["app.junior.version"] = JUNIOR_VERSION;
25
+ if (serviceVersion) {
26
+ attributes["service.version"] = serviceVersion;
27
+ }
28
+ if (deploymentId) {
29
+ attributes["deployment.id"] = deploymentId;
30
+ }
31
+ return attributes;
32
+ }
33
+
34
+ export {
35
+ JUNIOR_HEARTBEAT_ROUTE,
36
+ JUNIOR_HEARTBEAT_CRON_SCHEDULE,
37
+ JUNIOR_RETENTION_ROUTE,
38
+ JUNIOR_RETENTION_CRON_SCHEDULE,
39
+ JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
40
+ JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE,
41
+ LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION,
42
+ getDeploymentServiceVersion,
43
+ getDeploymentTelemetryAttributes
44
+ };
@@ -4,7 +4,7 @@ import {
4
4
  toCanonicalInputMessage,
5
5
  toCanonicalOutputMessage,
6
6
  toGenAiMessagesTraceAttributes
7
- } from "./chunk-O3JMSZLI.js";
7
+ } from "./chunk-6Y5L4BOM.js";
8
8
  import {
9
9
  extractGenAiUsageAttributes,
10
10
  logException,
@@ -12,7 +12,7 @@ import {
12
12
  normalizeGenAiFinishReason,
13
13
  serializeGenAiAttribute,
14
14
  withSpan
15
- } from "./chunk-ISMWX44P.js";
15
+ } from "./chunk-IYKPU7H6.js";
16
16
 
17
17
  // src/chat/xml.ts
18
18
  function escapeXml(value) {
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  parseActorUserId
3
- } from "./chunk-PLB7MRCQ.js";
3
+ } from "./chunk-C4MZ3GP5.js";
4
4
  import {
5
5
  logInfo,
6
6
  logWarn,
7
7
  setSpanAttributes
8
- } from "./chunk-ISMWX44P.js";
8
+ } from "./chunk-IYKPU7H6.js";
9
9
  import {
10
10
  discoverInstalledPluginPackageContent,
11
11
  normalizePluginPackageNames
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-3SXUV423.js";
3
+ } from "./chunk-3TV7OEHL.js";
4
4
 
5
5
  // src/chat/plugins/validation.ts
6
6
  import { isDeepStrictEqual } from "util";
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@sentry/junior",
4
- version: "0.109.0",
4
+ version: "0.110.0",
5
5
  private: false,
6
6
  publishConfig: {
7
7
  access: "public"