@sentry/junior 0.144.0 → 0.146.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 (104) hide show
  1. package/dist/{agent-hooks-GCUTGKY3.js → agent-hooks-SLJADYE5.js} +10 -10
  2. package/dist/api/conversations/detail.d.ts +1 -0
  3. package/dist/api/schema/conversation.d.ts +2 -0
  4. package/dist/api/schema.js +1 -1
  5. package/dist/api.js +40 -22
  6. package/dist/app.js +400 -461
  7. package/dist/{catalog-runtime-DWVYKDC6.js → catalog-runtime-RQIMSDPR.js} +5 -5
  8. package/dist/chat/agent/request.d.ts +1 -1
  9. package/dist/chat/agent/resume.d.ts +6 -18
  10. package/dist/chat/agent/skills.d.ts +0 -1
  11. package/dist/chat/agent/tools.d.ts +1 -2
  12. package/dist/chat/agent-dispatch/types.d.ts +1 -1
  13. package/dist/chat/app/conversation-work.d.ts +24 -0
  14. package/dist/chat/conversations/message-search.d.ts +32 -0
  15. package/dist/chat/conversations/projection.d.ts +11 -3
  16. package/dist/chat/conversations/sql/message-search.d.ts +4 -0
  17. package/dist/chat/conversations/store.d.ts +1 -1
  18. package/dist/chat/conversations/tool-source.d.ts +5 -0
  19. package/dist/chat/db.d.ts +2 -2
  20. package/dist/chat/runtime/agent-run-outcome.d.ts +1 -1
  21. package/dist/chat/runtime/reply-executor.d.ts +5 -5
  22. package/dist/chat/runtime/slack-resume.d.ts +12 -4
  23. package/dist/chat/slack/message/attachments.d.ts +2 -0
  24. package/dist/chat/slack/message/blocks.d.ts +2 -0
  25. package/dist/chat/slack/message/content.d.ts +18 -0
  26. package/dist/chat/slack/message/identity.d.ts +7 -0
  27. package/dist/chat/slack/tools/{conversation-search.d.ts → conversation-message-search.d.ts} +21 -14
  28. package/dist/chat/slack/tools/user-lookup.d.ts +2 -1
  29. package/dist/chat/state/locks.d.ts +28 -0
  30. package/dist/chat/task-execution/checkpoint.d.ts +84 -0
  31. package/dist/chat/task-execution/paused-turn.d.ts +29 -0
  32. package/dist/chat/task-execution/queue-signing.d.ts +1 -0
  33. package/dist/chat/task-execution/queue.d.ts +7 -1
  34. package/dist/chat/task-execution/slack-work.d.ts +1 -1
  35. package/dist/chat/task-execution/state.d.ts +4 -4
  36. package/dist/chat/task-execution/store.d.ts +2 -2
  37. package/dist/chat/task-execution/turn-cursor-keys.d.ts +6 -0
  38. package/dist/chat/{state/turn-session.d.ts → task-execution/turn-cursor.d.ts} +52 -51
  39. package/dist/chat/task-execution/turn-wake.d.ts +29 -0
  40. package/dist/chat/tools/{query-conversation-events.d.ts → search-conversation-events.d.ts} +3 -3
  41. package/dist/chat/tools/types.d.ts +1 -1
  42. package/dist/{chunk-SBZP2J5Q.js → chunk-37EVZP66.js} +48 -35
  43. package/dist/{chunk-A67GZN73.js → chunk-37JJDS4H.js} +1 -1
  44. package/dist/{chunk-BBCWYXHB.js → chunk-47OSH2ZO.js} +7 -7
  45. package/dist/{chunk-4X5KM7Z6.js → chunk-AISNSNDV.js} +14 -14
  46. package/dist/{chunk-RIFJUJSI.js → chunk-B63BF443.js} +1 -1
  47. package/dist/{chunk-SSDTQDYQ.js → chunk-BLETMLRX.js} +566 -268
  48. package/dist/{chunk-I44JB7HQ.js → chunk-F7REGDKO.js} +1 -1
  49. package/dist/{chunk-DVO5VKYQ.js → chunk-FEKQHPVA.js} +5 -5
  50. package/dist/{chunk-SUK7NC5A.js → chunk-FGHADGIC.js} +2 -2
  51. package/dist/{chunk-7KAW7UF4.js → chunk-FXDDDSPL.js} +4 -4
  52. package/dist/{chunk-BEGGFVFR.js → chunk-GDQEU4I7.js} +414 -542
  53. package/dist/{chunk-UDQMY6RS.js → chunk-GYEKOX7N.js} +43 -1
  54. package/dist/{chunk-W7JFV5SB.js → chunk-H6U2U3EP.js} +14 -17
  55. package/dist/{chunk-WTX2RFJG.js → chunk-HQE6EJS5.js} +1 -1
  56. package/dist/{chunk-IUFM5JWV.js → chunk-JAL3CH4G.js} +3 -0
  57. package/dist/{chunk-E7HCWOHG.js → chunk-JLMVCNXL.js} +2 -1
  58. package/dist/{chunk-PELZ2ZSY.js → chunk-JUA6VU2Z.js} +33 -63
  59. package/dist/{chunk-SHEEZSLY.js → chunk-LVW7BLLT.js} +2 -2
  60. package/dist/{chunk-GKA74DRA.js → chunk-M6ZWP4RI.js} +1 -1
  61. package/dist/{chunk-HNO2E5WB.js → chunk-MCFIXAV5.js} +1 -1
  62. package/dist/{chunk-3GU4PWA3.js → chunk-MKRIZ4VG.js} +29 -30
  63. package/dist/{chunk-QUZJDAQQ.js → chunk-OFPYOC3M.js} +93 -90
  64. package/dist/{chunk-ZF3N3JD6.js → chunk-PB222GIA.js} +1 -1
  65. package/dist/{chunk-PKH6762I.js → chunk-PH4Q3A6W.js} +1 -1
  66. package/dist/{chunk-STFCL3K4.js → chunk-QG7OOKIN.js} +1 -1
  67. package/dist/{chunk-WSOLZJJS.js → chunk-QSXZ42KX.js} +3 -3
  68. package/dist/{chunk-44RJWAND.js → chunk-SCGVWUZX.js} +6 -6
  69. package/dist/{chunk-CNTWB2SM.js → chunk-T5GXFFLA.js} +1 -1
  70. package/dist/{chunk-LDWNYCZ6.js → chunk-TCEJ7XXM.js} +1 -1
  71. package/dist/{chunk-QE3TICD4.js → chunk-V6SRLKUB.js} +2 -2
  72. package/dist/{chunk-54JMYQYS.js → chunk-W65V465O.js} +2 -2
  73. package/dist/{chunk-KCBZSJRU.js → chunk-WR76IVA5.js} +5 -2
  74. package/dist/{chunk-ZZCTGAIT.js → chunk-X22KCSCO.js} +4 -4
  75. package/dist/{chunk-HD6BHR25.js → chunk-X2WMBTS3.js} +32 -34
  76. package/dist/{chunk-KQBXT5B7.js → chunk-ZDGHGY74.js} +6 -6
  77. package/dist/cli/chat.js +32 -32
  78. package/dist/cli/check.js +6 -6
  79. package/dist/cli/plugins.js +13 -13
  80. package/dist/cli/snapshot-create.js +9 -9
  81. package/dist/cli/upgrade.js +7 -7
  82. package/dist/{db-EFLHTBU6.js → db-WWOMXWTT.js} +9 -9
  83. package/dist/instrumentation.js +4 -4
  84. package/dist/nitro.js +4 -4
  85. package/dist/{oauth-callback-server-RO3IQKWM.js → oauth-callback-server-A6ZZX74U.js} +25 -25
  86. package/dist/{runner-LOWW7JKA.js → runner-KSGB2UAV.js} +19 -20
  87. package/dist/{skills-ZLMUG7AE.js → skills-26QPWKVS.js} +6 -6
  88. package/dist/spawn-5LAJXZ2P.js +39 -0
  89. package/dist/{validation-MAKEZNTS.js → validation-OPSRGFGH.js} +6 -6
  90. package/dist/version.js +1 -1
  91. package/dist/{work-5OAGC3I4.js → work-VMSW7STJ.js} +17 -16
  92. package/dist/worker-2JNFB7C7.js +24 -0
  93. package/package.json +5 -5
  94. package/dist/chat/agent/session.d.ts +0 -19
  95. package/dist/chat/conversations/search.d.ts +0 -24
  96. package/dist/chat/conversations/sql/search.d.ts +0 -4
  97. package/dist/chat/runtime/agent-continue-runner.d.ts +0 -37
  98. package/dist/chat/services/agent-continue.d.ts +0 -29
  99. package/dist/chat/services/turn-session-record.d.ts +0 -164
  100. package/dist/chat/slack/legacy-attachments.d.ts +0 -4
  101. package/dist/chat/slack/message.d.ts +0 -12
  102. package/dist/chat/state/turn-session-keys.d.ts +0 -6
  103. package/dist/spawn-R3LUV6RF.js +0 -38
  104. package/dist/worker-KTGGRTTP.js +0 -24
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  ensureConversationWake,
6
6
  requestConversationWork
7
- } from "./chunk-HD6BHR25.js";
7
+ } from "./chunk-X2WMBTS3.js";
8
8
  import {
9
9
  buildConversationContext,
10
10
  buildDeliveredTurnStatePatch,
@@ -21,7 +21,7 @@ import {
21
21
  resolveTurnSessionRouting,
22
22
  scheduleSessionCompletedPluginTasks,
23
23
  turnHasReply
24
- } from "./chunk-W7JFV5SB.js";
24
+ } from "./chunk-H6U2U3EP.js";
25
25
  import {
26
26
  ConversationTurnLifecycleService
27
27
  } from "./chunk-Q6QZTTLS.js";
@@ -30,7 +30,7 @@ import {
30
30
  } from "./chunk-4CODA7P5.js";
31
31
  import {
32
32
  getVercelConversationWorkQueue
33
- } from "./chunk-KCBZSJRU.js";
33
+ } from "./chunk-WR76IVA5.js";
34
34
  import {
35
35
  createUserTokenStore,
36
36
  deleteMcpAuthSession,
@@ -39,7 +39,7 @@ import {
39
39
  getMcpProviderErrorAttributes,
40
40
  getMcpStoredOAuthCredentials,
41
41
  resolvePluginOAuthAccount
42
- } from "./chunk-BBCWYXHB.js";
42
+ } from "./chunk-47OSH2ZO.js";
43
43
  import {
44
44
  RetryableDeliveryError
45
45
  } from "./chunk-R776HKPK.js";
@@ -55,58 +55,59 @@ import {
55
55
  removeReactionFromMessage,
56
56
  resolveBaseUrl,
57
57
  truncateStatusText
58
- } from "./chunk-KQBXT5B7.js";
58
+ } from "./chunk-ZDGHGY74.js";
59
59
  import {
60
60
  TurnSliceLimitExceededError,
61
- abandonAgentTurnSessionRecord,
61
+ abandonTurnRecord,
62
62
  buildTurnLimitResponse,
63
63
  clearPendingAuth,
64
64
  coerceThreadArtifactsState,
65
65
  coerceThreadConversationState,
66
66
  commitAcceptedReply,
67
- failAgentTurnSessionRecord,
68
- getAgentTurnSessionRecord,
67
+ failTurnRecord,
69
68
  getAssistantReplyText,
70
69
  getChannelConfigurationServiceById,
71
70
  getConversationPendingAuth,
72
71
  getPersistedSandboxState,
73
72
  getPersistedThreadState,
73
+ getTurnRecord,
74
74
  hydrateConversationMessages,
75
75
  isPendingAuthLatestRequest,
76
76
  loadProjection,
77
+ loadTurnCheckpoint,
77
78
  markTurnFailed,
78
- persistCompletedSessionRecord,
79
79
  persistThreadStateById,
80
80
  persistWithRetry,
81
- recordAgentTurnSessionSummary,
82
81
  recordAuthenticationLinked,
83
- recordAuthorizationCompleted
84
- } from "./chunk-BEGGFVFR.js";
82
+ recordAuthorizationCompleted,
83
+ recordTurnSummary,
84
+ saveTurnCheckpoint
85
+ } from "./chunk-GDQEU4I7.js";
85
86
  import {
86
87
  parseSlackThreadId,
87
88
  readSlackRawMessageContext,
88
89
  resolveSlackChannelIdFromMessage,
89
90
  resolveSlackChannelIdFromThreadId
90
- } from "./chunk-PKH6762I.js";
91
+ } from "./chunk-PH4Q3A6W.js";
91
92
  import {
92
93
  getDashboardConversationLink,
93
94
  getPluginSlackConversationLink
94
- } from "./chunk-44RJWAND.js";
95
+ } from "./chunk-SCGVWUZX.js";
95
96
  import {
96
97
  SlackActionError,
97
98
  getHeaderString,
98
99
  getSlackClient,
99
100
  isDmChannel,
100
101
  normalizeSlackConversationId
101
- } from "./chunk-QE3TICD4.js";
102
+ } from "./chunk-V6SRLKUB.js";
102
103
  import {
103
104
  getConversationEventStore,
104
105
  requireSlackDestination
105
- } from "./chunk-SBZP2J5Q.js";
106
+ } from "./chunk-37EVZP66.js";
106
107
  import {
107
108
  acquireActiveLock,
108
109
  getStateAdapter
109
- } from "./chunk-UDQMY6RS.js";
110
+ } from "./chunk-GYEKOX7N.js";
110
111
  import {
111
112
  FUNCTION_TIMEOUT_BUFFER_SECONDS,
112
113
  botConfig,
@@ -115,18 +116,18 @@ import {
115
116
  getRuntimeMetadata,
116
117
  normalizeSlackEmojiName,
117
118
  standardModelId
118
- } from "./chunk-3GU4PWA3.js";
119
+ } from "./chunk-MKRIZ4VG.js";
119
120
  import {
120
121
  discoverSkills
121
- } from "./chunk-SUK7NC5A.js";
122
+ } from "./chunk-FGHADGIC.js";
122
123
  import {
123
124
  pluginCatalogRuntime
124
- } from "./chunk-ZF3N3JD6.js";
125
+ } from "./chunk-PB222GIA.js";
125
126
  import {
126
127
  buildOAuthTokenRequest,
127
128
  hasRequiredOAuthScope,
128
129
  parseOAuthTokenResponse
129
- } from "./chunk-A67GZN73.js";
130
+ } from "./chunk-37JJDS4H.js";
130
131
  import {
131
132
  createSlackResumeActor,
132
133
  isUserActor
@@ -142,7 +143,7 @@ import {
142
143
  setTags,
143
144
  toOptionalString,
144
145
  withLogContext
145
- } from "./chunk-RIFJUJSI.js";
146
+ } from "./chunk-B63BF443.js";
146
147
  import {
147
148
  homeDir
148
149
  } from "./chunk-H4HBKISO.js";
@@ -1319,8 +1320,8 @@ async function resumeSlackTurnInContext(args) {
1319
1320
  const stateAdapter = getStateAdapter();
1320
1321
  await stateAdapter.connect();
1321
1322
  const lockKey = args.lockKey ?? getDefaultLockKey(args.channelId, args.threadTs);
1322
- const lock = await acquireActiveLock(stateAdapter, lockKey);
1323
- if (!lock) {
1323
+ const lock = args.ownsConversationLease ? void 0 : await acquireActiveLock(stateAdapter, lockKey);
1324
+ if (!args.ownsConversationLease && !lock) {
1324
1325
  throw new ResumeTurnBusyError(lockKey);
1325
1326
  }
1326
1327
  const status = createSlackWebApiAssistantStatusSession({
@@ -1490,13 +1491,13 @@ async function resumeSlackTurnInContext(args) {
1490
1491
  if (messageTs && dispatchId && routing) {
1491
1492
  try {
1492
1493
  await persistWithRetry(
1493
- () => recordAgentTurnSessionSummary({
1494
+ () => recordTurnSummary({
1494
1495
  conversationId: runArgs.conversationId,
1495
1496
  destination: routing.destination,
1496
1497
  destinationVisibility: routing.destinationVisibility,
1497
1498
  dispatchId,
1498
1499
  resultMessageId: messageTs,
1499
- sessionId: runArgs.turnId,
1500
+ turnId: runArgs.turnId,
1500
1501
  sliceId: runArgs.sliceId ?? 1,
1501
1502
  source: routing.source,
1502
1503
  state: "running",
@@ -1591,13 +1592,13 @@ async function resumeSlackTurnInContext(args) {
1591
1592
  await status.clear();
1592
1593
  failureCode = "persistence_failed";
1593
1594
  if (reply.piMessages?.length) {
1594
- await persistCompletedSessionRecord({
1595
+ await saveTurnCheckpoint({
1596
+ mode: "completed",
1595
1597
  conversationId: runArgs.conversationId,
1596
- sessionId: runArgs.turnId,
1597
- allMessages: reply.piMessages,
1598
- modelId: reply.diagnostics.modelId,
1599
- currentDurationMs: reply.diagnostics.durationMs,
1600
- currentUsage: reply.diagnostics.usage,
1598
+ turnId: runArgs.turnId,
1599
+ messages: reply.piMessages,
1600
+ durationMs: reply.diagnostics.durationMs,
1601
+ usage: reply.diagnostics.usage,
1601
1602
  destination: replyContext.routing.destination,
1602
1603
  destinationVisibility: replyContext.routing.destinationVisibility,
1603
1604
  dispatchId: replyContext.routing.dispatch?.id,
@@ -1610,14 +1611,14 @@ async function resumeSlackTurnInContext(args) {
1610
1611
  sliceId: runArgs.sliceId
1611
1612
  });
1612
1613
  } else if (replyContext.routing.dispatch?.id) {
1613
- await recordAgentTurnSessionSummary({
1614
+ await recordTurnSummary({
1614
1615
  conversationId: runArgs.conversationId,
1615
1616
  destination: replyContext.routing.destination,
1616
1617
  destinationVisibility: replyContext.routing.destinationVisibility,
1617
1618
  dispatchId: replyContext.routing.dispatch?.id,
1618
1619
  dispatchOutcome: reply.diagnostics.outcome === "success" ? "completed" : "failed",
1619
1620
  ...acceptedDeliveryId ? { resultMessageId: acceptedDeliveryId } : {},
1620
- sessionId: runArgs.turnId,
1621
+ turnId: runArgs.turnId,
1621
1622
  sliceId: runArgs.sliceId ?? 1,
1622
1623
  source: replyContext.routing.source,
1623
1624
  state: reply.diagnostics.outcome === "success" ? "completed" : "failed",
@@ -1691,7 +1692,9 @@ async function resumeSlackTurnInContext(args) {
1691
1692
  } else {
1692
1693
  await processingReaction?.stop();
1693
1694
  }
1694
- await stateAdapter.releaseLock(lock);
1695
+ if (lock) {
1696
+ await stateAdapter.releaseLock(lock);
1697
+ }
1695
1698
  }
1696
1699
  if (postDeliveryCommitError) {
1697
1700
  const eventId = logException(
@@ -1743,13 +1746,14 @@ async function resumeSlackTurnInContext(args) {
1743
1746
  return true;
1744
1747
  }
1745
1748
 
1746
- // src/chat/services/agent-continue.ts
1747
- async function getAwaitingAgentContinueRequest(args) {
1748
- const sessionRecord = await getAgentTurnSessionRecord(
1749
- args.conversationId,
1750
- args.sessionId
1751
- );
1752
- if (!sessionRecord || sessionRecord.state !== "awaiting_resume" || sessionRecord.resumeReason !== "timeout" && sessionRecord.resumeReason !== "yield" && sessionRecord.resumeReason !== "retry" || sessionRecord.resumeReason === "timeout" && sessionRecord.sliceId < 2) {
1749
+ // src/chat/task-execution/turn-wake.ts
1750
+ async function getPausedTurnRequest(args) {
1751
+ const checkpoint = await loadTurnCheckpoint({
1752
+ conversationId: args.conversationId,
1753
+ turnId: args.turnId
1754
+ });
1755
+ const turn = checkpoint.record;
1756
+ if (!turn || turn.state !== "paused" || turn.resumeReason !== "timeout" && turn.resumeReason !== "yield" && turn.resumeReason !== "retry" || turn.resumeReason === "timeout" && turn.sliceId < 2) {
1753
1757
  return void 0;
1754
1758
  }
1755
1759
  let routing;
@@ -1759,10 +1763,10 @@ async function getAwaitingAgentContinueRequest(args) {
1759
1763
  conversationStore: args.conversationStore
1760
1764
  });
1761
1765
  } catch (error) {
1762
- await failAgentTurnSessionRecord({
1766
+ await failTurnRecord({
1763
1767
  conversationId: args.conversationId,
1764
- expectedVersion: sessionRecord.version,
1765
- sessionId: args.sessionId,
1768
+ expectedVersion: turn.version,
1769
+ turnId: args.turnId,
1766
1770
  errorMessage: error instanceof Error ? error.message : String(error)
1767
1771
  });
1768
1772
  return void 0;
@@ -1770,11 +1774,11 @@ async function getAwaitingAgentContinueRequest(args) {
1770
1774
  return {
1771
1775
  conversationId: args.conversationId,
1772
1776
  destination: routing.destination,
1773
- sessionId: args.sessionId,
1774
- expectedVersion: sessionRecord.version
1777
+ turnId: args.turnId,
1778
+ expectedVersion: turn.version
1775
1779
  };
1776
1780
  }
1777
- async function scheduleAgentContinue(request, options = {}) {
1781
+ async function wakePausedTurn(request, options = {}) {
1778
1782
  const nowMs = options.nowMs ?? Date.now();
1779
1783
  await requestConversationWork({
1780
1784
  conversationId: request.conversationId,
@@ -1788,7 +1792,7 @@ async function scheduleAgentContinue(request, options = {}) {
1788
1792
  idempotencyKey: [
1789
1793
  "agent-continue",
1790
1794
  request.conversationId,
1791
- request.sessionId,
1795
+ request.turnId,
1792
1796
  request.expectedVersion,
1793
1797
  nowMs
1794
1798
  ].join(":"),
@@ -1896,9 +1900,9 @@ async function persistCompletedReplyState(channelId, threadTs, sessionId, reply)
1896
1900
  }
1897
1901
  async function failSessionRecordBestEffort(args) {
1898
1902
  try {
1899
- await failAgentTurnSessionRecord({
1903
+ await failTurnRecord({
1900
1904
  conversationId: args.conversationId,
1901
- sessionId: args.sessionId,
1905
+ turnId: args.turnId,
1902
1906
  errorMessage: args.errorMessage,
1903
1907
  expectedVersion: args.expectedVersion
1904
1908
  });
@@ -1908,7 +1912,7 @@ async function failSessionRecordBestEffort(args) {
1908
1912
  "mcp.oauth_callback.session_record.failure_persistence.failed",
1909
1913
  {
1910
1914
  "app.ai.conversation_id": args.conversationId,
1911
- "app.ai.session_id": args.sessionId
1915
+ "app.ai.session_id": args.turnId
1912
1916
  }
1913
1917
  );
1914
1918
  }
@@ -1928,7 +1932,7 @@ async function persistFailedReplyState(channelId, threadTs, sessionId, expectedV
1928
1932
  });
1929
1933
  await failSessionRecordBestEffort({
1930
1934
  conversationId: threadId,
1931
- sessionId,
1935
+ turnId: sessionId,
1932
1936
  errorMessage: "OAuth-resumed MCP turn failed",
1933
1937
  expectedVersion
1934
1938
  });
@@ -1963,9 +1967,9 @@ async function resumeAuthorizedMcpTurn(args) {
1963
1967
  if (!isPendingAuthLatestRequest(conversation, pendingAuth)) {
1964
1968
  clearPendingAuth(conversation, pendingAuth.sessionId);
1965
1969
  await persistThreadStateById(threadId, { conversation });
1966
- await abandonAgentTurnSessionRecord({
1970
+ await abandonTurnRecord({
1967
1971
  conversationId: authSession.conversationId,
1968
- sessionId: pendingAuth.sessionId,
1972
+ turnId: pendingAuth.sessionId,
1969
1973
  errorMessage: "Auth completed after a newer thread message abandoned this blocked request."
1970
1974
  });
1971
1975
  return;
@@ -2009,9 +2013,9 @@ async function resumeAuthorizedMcpTurn(args) {
2009
2013
  await persistThreadStateById(threadId, {
2010
2014
  conversation: lockedConversation
2011
2015
  });
2012
- await abandonAgentTurnSessionRecord({
2016
+ await abandonTurnRecord({
2013
2017
  conversationId: authSession.conversationId,
2014
- sessionId: lockedPendingAuth.sessionId,
2018
+ turnId: lockedPendingAuth.sessionId,
2015
2019
  errorMessage: "Auth completed after a newer thread message abandoned this blocked request."
2016
2020
  });
2017
2021
  return false;
@@ -2023,11 +2027,11 @@ async function resumeAuthorizedMcpTurn(args) {
2023
2027
  if (!lockedUserMessage) {
2024
2028
  return false;
2025
2029
  }
2026
- const lockedSessionRecord = await getAgentTurnSessionRecord(
2030
+ const lockedSessionRecord = await getTurnRecord(
2027
2031
  authSession.conversationId,
2028
2032
  lockedSessionId
2029
2033
  );
2030
- if (!lockedSessionRecord || lockedSessionRecord.state !== "awaiting_resume" || lockedSessionRecord.resumeReason !== "auth") {
2034
+ if (!lockedSessionRecord || lockedSessionRecord.state !== "paused" || lockedSessionRecord.resumeReason !== "auth") {
2031
2035
  return false;
2032
2036
  }
2033
2037
  const lockedConversationContext = buildConversationContext(
@@ -2046,10 +2050,10 @@ async function resumeAuthorizedMcpTurn(args) {
2046
2050
  userId: authSession.userId
2047
2051
  });
2048
2052
  } catch {
2049
- await failAgentTurnSessionRecord({
2053
+ await failTurnRecord({
2050
2054
  conversationId: authSession.conversationId,
2051
2055
  expectedVersion: lockedSessionRecord.version,
2052
- sessionId: lockedSessionId,
2056
+ turnId: lockedSessionId,
2053
2057
  errorMessage: "Unable to rebuild Slack actor for OAuth resume"
2054
2058
  });
2055
2059
  return false;
@@ -2060,10 +2064,10 @@ async function resumeAuthorizedMcpTurn(args) {
2060
2064
  conversationId: authSession.conversationId
2061
2065
  });
2062
2066
  } catch (error) {
2063
- await failAgentTurnSessionRecord({
2067
+ await failTurnRecord({
2064
2068
  conversationId: authSession.conversationId,
2065
2069
  expectedVersion: lockedSessionRecord.version,
2066
- sessionId: lockedSessionId,
2070
+ turnId: lockedSessionId,
2067
2071
  errorMessage: error instanceof Error ? error.message : String(error)
2068
2072
  });
2069
2073
  return false;
@@ -2128,10 +2132,10 @@ async function resumeAuthorizedMcpTurn(args) {
2128
2132
  );
2129
2133
  },
2130
2134
  onPostDeliveryCommitFailure: async () => {
2131
- await failAgentTurnSessionRecord({
2135
+ await failTurnRecord({
2132
2136
  conversationId: authSession.conversationId,
2133
2137
  expectedVersion: lockedSessionRecord.version,
2134
- sessionId: lockedSessionId,
2138
+ turnId: lockedSessionId,
2135
2139
  errorMessage: "OAuth-resumed MCP reply was delivered but completion state did not persist"
2136
2140
  });
2137
2141
  },
@@ -2161,10 +2165,10 @@ async function resumeAuthorizedMcpTurn(args) {
2161
2165
  });
2162
2166
  },
2163
2167
  onSuspend: async (resumeVersion) => {
2164
- await scheduleAgentContinue({
2168
+ await wakePausedTurn({
2165
2169
  conversationId: authSession.conversationId,
2166
2170
  destination,
2167
- sessionId: lockedSessionId,
2171
+ turnId: lockedSessionId,
2168
2172
  expectedVersion: resumeVersion
2169
2173
  });
2170
2174
  }
@@ -2501,10 +2505,10 @@ function pluginAuthorizationId(args) {
2501
2505
  }
2502
2506
  async function failSessionRecordBestEffort2(args) {
2503
2507
  try {
2504
- await failAgentTurnSessionRecord({
2508
+ await failTurnRecord({
2505
2509
  conversationId: args.conversationId,
2506
2510
  expectedVersion: args.expectedVersion,
2507
- sessionId: args.sessionId,
2511
+ turnId: args.turnId,
2508
2512
  errorMessage: args.errorMessage
2509
2513
  });
2510
2514
  } catch (error) {
@@ -2513,7 +2517,7 @@ async function failSessionRecordBestEffort2(args) {
2513
2517
  "oauth.callback.session_record.failure_persistence.failed",
2514
2518
  {
2515
2519
  "app.ai.conversation_id": args.conversationId,
2516
- "app.ai.session_id": args.sessionId
2520
+ "app.ai.session_id": args.turnId
2517
2521
  }
2518
2522
  );
2519
2523
  }
@@ -2536,7 +2540,7 @@ async function persistFailedOAuthReplyState(args) {
2536
2540
  await failSessionRecordBestEffort2({
2537
2541
  conversationId: args.conversationId,
2538
2542
  expectedVersion: args.expectedVersion,
2539
- sessionId: args.sessionId,
2543
+ turnId: args.sessionId,
2540
2544
  errorMessage: "OAuth-resumed turn failed"
2541
2545
  });
2542
2546
  await persistThreadStateById(args.conversationId, {
@@ -2574,15 +2578,15 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
2574
2578
  await persistThreadStateById(stored.resumeConversationId, {
2575
2579
  conversation
2576
2580
  });
2577
- await abandonAgentTurnSessionRecord({
2581
+ await abandonTurnRecord({
2578
2582
  conversationId: stored.resumeConversationId,
2579
- sessionId: pendingAuth.sessionId,
2583
+ turnId: pendingAuth.sessionId,
2580
2584
  errorMessage: "Auth completed after a newer thread message abandoned this blocked request."
2581
2585
  });
2582
2586
  return;
2583
2587
  }
2584
2588
  }
2585
- const sessionRecord = await getAgentTurnSessionRecord(
2589
+ const sessionRecord = await getTurnRecord(
2586
2590
  stored.resumeConversationId,
2587
2591
  resolvedSessionId
2588
2592
  );
@@ -2592,7 +2596,7 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
2592
2596
  if (sessionRecord.state === "completed" || sessionRecord.state === "failed" || sessionRecord.state === "abandoned") {
2593
2597
  return;
2594
2598
  }
2595
- if (sessionRecord.state !== "awaiting_resume" || sessionRecord.resumeReason !== "auth") {
2599
+ if (sessionRecord.state !== "paused" || sessionRecord.resumeReason !== "auth") {
2596
2600
  return;
2597
2601
  }
2598
2602
  if (!userMessage?.author?.userId) {
@@ -2632,11 +2636,11 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
2632
2636
  if (lockedSessionId !== resolvedSessionId) {
2633
2637
  return false;
2634
2638
  }
2635
- const lockedSessionRecord = await getAgentTurnSessionRecord(
2639
+ const lockedSessionRecord = await getTurnRecord(
2636
2640
  stored.resumeConversationId,
2637
2641
  lockedSessionId
2638
2642
  );
2639
- if (!lockedSessionRecord || lockedSessionRecord.state !== "awaiting_resume" || lockedSessionRecord.resumeReason !== "auth") {
2643
+ if (!lockedSessionRecord || lockedSessionRecord.state !== "paused" || lockedSessionRecord.resumeReason !== "auth") {
2640
2644
  return false;
2641
2645
  }
2642
2646
  if (lockedPendingAuth) {
@@ -2645,9 +2649,9 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
2645
2649
  await persistThreadStateById(stored.resumeConversationId, {
2646
2650
  conversation: lockedConversation
2647
2651
  });
2648
- await abandonAgentTurnSessionRecord({
2652
+ await abandonTurnRecord({
2649
2653
  conversationId: stored.resumeConversationId,
2650
- sessionId: lockedPendingAuth.sessionId,
2654
+ turnId: lockedPendingAuth.sessionId,
2651
2655
  errorMessage: "Auth completed after a newer thread message abandoned this blocked request."
2652
2656
  });
2653
2657
  return false;
@@ -2678,10 +2682,10 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
2678
2682
  userId: lockedUserMessage.author.userId
2679
2683
  });
2680
2684
  } catch {
2681
- await failAgentTurnSessionRecord({
2685
+ await failTurnRecord({
2682
2686
  conversationId: stored.resumeConversationId,
2683
2687
  expectedVersion: lockedSessionRecord.version,
2684
- sessionId: lockedSessionId,
2688
+ turnId: lockedSessionId,
2685
2689
  errorMessage: "Unable to rebuild Slack actor for OAuth resume"
2686
2690
  });
2687
2691
  return false;
@@ -2692,10 +2696,10 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
2692
2696
  conversationId: stored.resumeConversationId
2693
2697
  });
2694
2698
  } catch (error) {
2695
- await failAgentTurnSessionRecord({
2699
+ await failTurnRecord({
2696
2700
  conversationId: stored.resumeConversationId,
2697
2701
  expectedVersion: lockedSessionRecord.version,
2698
- sessionId: lockedSessionId,
2702
+ turnId: lockedSessionId,
2699
2703
  errorMessage: error instanceof Error ? error.message : String(error)
2700
2704
  });
2701
2705
  return false;
@@ -2768,10 +2772,10 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
2768
2772
  });
2769
2773
  },
2770
2774
  onPostDeliveryCommitFailure: async () => {
2771
- await failAgentTurnSessionRecord({
2775
+ await failTurnRecord({
2772
2776
  conversationId: stored.resumeConversationId,
2773
2777
  expectedVersion: lockedSessionRecord.version,
2774
- sessionId: lockedSessionId,
2778
+ turnId: lockedSessionId,
2775
2779
  errorMessage: "OAuth-resumed reply was delivered but completion state did not persist"
2776
2780
  });
2777
2781
  },
@@ -2789,10 +2793,10 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
2789
2793
  });
2790
2794
  },
2791
2795
  onSuspend: async (resumeVersion) => {
2792
- await scheduleAgentContinue({
2796
+ await wakePausedTurn({
2793
2797
  conversationId: stored.resumeConversationId,
2794
2798
  destination,
2795
- sessionId: lockedSessionId,
2799
+ turnId: lockedSessionId,
2796
2800
  expectedVersion: resumeVersion
2797
2801
  });
2798
2802
  }
@@ -3153,10 +3157,9 @@ export {
3153
3157
  buildAuthPauseResponse,
3154
3158
  getTurnRequestDeadline,
3155
3159
  runWithTurnRequestDeadline,
3156
- ResumeTurnBusyError,
3157
3160
  resumeSlackTurn,
3158
- getAwaitingAgentContinueRequest,
3159
- scheduleAgentContinue,
3161
+ getPausedTurnRequest,
3162
+ wakePausedTurn,
3160
3163
  GET,
3161
3164
  publishAppHomeView,
3162
3165
  GET2,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createPluginCatalogRuntime
3
- } from "./chunk-A67GZN73.js";
3
+ } from "./chunk-37JJDS4H.js";
4
4
 
5
5
  // src/chat/plugins/catalog-runtime.ts
6
6
  var pluginCatalogRuntime = createPluginCatalogRuntime();
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-F3B2YJ76.js";
6
6
  import {
7
7
  toOptionalString
8
- } from "./chunk-RIFJUJSI.js";
8
+ } from "./chunk-B63BF443.js";
9
9
 
10
10
  // src/chat/slack/context.ts
11
11
  import { z } from "zod";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logWarn
3
- } from "./chunk-RIFJUJSI.js";
3
+ } from "./chunk-B63BF443.js";
4
4
 
5
5
  // src/chat/conversation-privacy.ts
6
6
  import { AsyncLocalStorage } from "async_hooks";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  getDb
3
- } from "./chunk-SBZP2J5Q.js";
3
+ } from "./chunk-37EVZP66.js";
4
4
  import {
5
5
  juniorConversations,
6
6
  juniorTaskExecutions
7
- } from "./chunk-HNO2E5WB.js";
7
+ } from "./chunk-MCFIXAV5.js";
8
8
  import {
9
9
  logWarn
10
- } from "./chunk-RIFJUJSI.js";
10
+ } from "./chunk-B63BF443.js";
11
11
 
12
12
  // src/chat/tasks/execution-stats.ts
13
13
  import {
@@ -4,30 +4,30 @@ import {
4
4
  isConversationScopedChannel,
5
5
  isDmChannel,
6
6
  normalizeSlackConversationId
7
- } from "./chunk-QE3TICD4.js";
7
+ } from "./chunk-V6SRLKUB.js";
8
8
  import {
9
9
  getConversationEventStore,
10
10
  getDb
11
- } from "./chunk-SBZP2J5Q.js";
11
+ } from "./chunk-37EVZP66.js";
12
12
  import {
13
13
  juniorConversationAnnotations,
14
14
  juniorConversationEvents,
15
15
  juniorIdentities,
16
16
  juniorUsers
17
- } from "./chunk-HNO2E5WB.js";
17
+ } from "./chunk-MCFIXAV5.js";
18
18
  import {
19
19
  SANDBOX_WORKSPACE_ROOT
20
20
  } from "./chunk-EM225ITJ.js";
21
21
  import {
22
22
  getStateAdapter
23
- } from "./chunk-UDQMY6RS.js";
23
+ } from "./chunk-GYEKOX7N.js";
24
24
  import {
25
25
  botConfig,
26
26
  completeObject,
27
27
  embedTexts,
28
28
  getSlackBotToken,
29
29
  standardModelId
30
- } from "./chunk-3GU4PWA3.js";
30
+ } from "./chunk-MKRIZ4VG.js";
31
31
  import {
32
32
  isActorUserId,
33
33
  parseActorUserId
@@ -42,7 +42,7 @@ import {
42
42
  logInfo,
43
43
  logWarn,
44
44
  normalizeIdentityEmail
45
- } from "./chunk-RIFJUJSI.js";
45
+ } from "./chunk-B63BF443.js";
46
46
 
47
47
  // src/chat/plugins/agent-hooks.ts
48
48
  import {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  botConfig,
3
3
  resolveGatewayModel
4
- } from "./chunk-3GU4PWA3.js";
4
+ } from "./chunk-MKRIZ4VG.js";
5
5
 
6
6
  // src/chat/services/context-budget.ts
7
7
  var COMPACTION_TRIGGER_RATIO = 0.9;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-ZF3N3JD6.js";
3
+ } from "./chunk-PB222GIA.js";
4
4
 
5
5
  // src/chat/plugins/validation.ts
6
6
  import { isDeepStrictEqual } from "util";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-EM225ITJ.js";
4
4
  import {
5
5
  getSlackBotToken
6
- } from "./chunk-3GU4PWA3.js";
6
+ } from "./chunk-MKRIZ4VG.js";
7
7
  import {
8
8
  parseSlackChannelReferenceId
9
9
  } from "./chunk-F3B2YJ76.js";
@@ -12,7 +12,7 @@ import {
12
12
  setSpanAttributes,
13
13
  setSpanStatus,
14
14
  withSpan
15
- } from "./chunk-RIFJUJSI.js";
15
+ } from "./chunk-B63BF443.js";
16
16
 
17
17
  // src/chat/slack/client.ts
18
18
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  botConfig
3
- } from "./chunk-3GU4PWA3.js";
3
+ } from "./chunk-MKRIZ4VG.js";
4
4
  import {
5
5
  logWarn
6
- } from "./chunk-RIFJUJSI.js";
6
+ } from "./chunk-B63BF443.js";
7
7
 
8
8
  // src/chat/services/short-title.ts
9
9
  var SHORT_TITLE_MAX_LENGTH = 60;