@sentry/junior 0.148.0 → 0.150.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 (84) hide show
  1. package/dist/{agent-hooks-VAUYT6PD.js → agent-hooks-SEOGOGKX.js} +10 -10
  2. package/dist/api/conversations/aggregate.d.ts +2 -0
  3. package/dist/api/conversations/create.d.ts +1 -1
  4. package/dist/api/conversations/pending-messages.d.ts +15 -0
  5. package/dist/api/people/shared.d.ts +2 -0
  6. package/dist/api/schema/conversation.d.ts +78 -4
  7. package/dist/api/schema.d.ts +2 -2
  8. package/dist/api/schema.js +7 -1
  9. package/dist/api.d.ts +1 -1
  10. package/dist/api.js +186 -35
  11. package/dist/app.js +152 -186
  12. package/dist/{catalog-runtime-WADOZVTB.js → catalog-runtime-HA7RIWYT.js} +5 -5
  13. package/dist/chat/agent/index.d.ts +5 -4
  14. package/dist/chat/agent/prompt.d.ts +8 -5
  15. package/dist/chat/agent/resume.d.ts +2 -2
  16. package/dist/chat/agent/tools.d.ts +4 -7
  17. package/dist/chat/agent/{request.d.ts → types.d.ts} +138 -129
  18. package/dist/chat/agent-dispatch/types.d.ts +2 -2
  19. package/dist/chat/agent-invocations/spawn.d.ts +2 -2
  20. package/dist/chat/api-turns/work.d.ts +6 -1
  21. package/dist/chat/app/services.d.ts +1 -1
  22. package/dist/chat/plugins/viewer.d.ts +4 -0
  23. package/dist/chat/runtime/agent-runner.d.ts +7 -5
  24. package/dist/chat/runtime/reply-executor.d.ts +0 -2
  25. package/dist/chat/runtime/slack-resume.d.ts +3 -3
  26. package/dist/chat/services/conversation-memory.d.ts +2 -2
  27. package/dist/chat/services/conversation-title.d.ts +20 -0
  28. package/dist/chat/slack/assistant-thread/title.d.ts +10 -27
  29. package/dist/chat/state/conversation.d.ts +1 -0
  30. package/dist/chat/task-execution/paused-turn.d.ts +2 -2
  31. package/dist/chat/tools/types.d.ts +1 -1
  32. package/dist/{chunk-QOWHHM3F.js → chunk-3GL327SC.js} +1 -1
  33. package/dist/{chunk-45LOR4PU.js → chunk-3JVUWLR7.js} +45 -1
  34. package/dist/{chunk-4GXJUYJV.js → chunk-3ZMKDHCT.js} +2 -2
  35. package/dist/{chunk-DUY5CDAM.js → chunk-4KAYAIBV.js} +1 -1
  36. package/dist/{chunk-ULAU5ZGU.js → chunk-4VH7KLGC.js} +106 -113
  37. package/dist/{chunk-V2FXMOEA.js → chunk-64K7GKRW.js} +2 -2
  38. package/dist/{chunk-2B3PT3V2.js → chunk-6PFDWAK2.js} +1 -1
  39. package/dist/{chunk-LNVEIJ2L.js → chunk-7D4GNUV2.js} +5 -5
  40. package/dist/{chunk-ZPL2RR7F.js → chunk-7GOP6VFJ.js} +40 -36
  41. package/dist/{chunk-HWQGBIH7.js → chunk-7NLW2NF5.js} +1 -1
  42. package/dist/{chunk-55F4QU2V.js → chunk-7QB2CKCW.js} +1 -1
  43. package/dist/{chunk-WCN4YSH7.js → chunk-DWETNV66.js} +6 -6
  44. package/dist/{chunk-D3WPMGEX.js → chunk-F5NMSEBL.js} +1 -1
  45. package/dist/{chunk-IL4EDBMV.js → chunk-FEFEIA3Z.js} +5 -5
  46. package/dist/{chunk-WOONT5ZP.js → chunk-H2RLIJ7G.js} +1 -1
  47. package/dist/{chunk-VRHTNBA6.js → chunk-ILYL6YFD.js} +3 -3
  48. package/dist/{chunk-VCYSOXON.js → chunk-IPGNWXA3.js} +545 -7
  49. package/dist/{chunk-LAZGHEYU.js → chunk-IZRSLANA.js} +1 -1
  50. package/dist/{chunk-EAI67NTM.js → chunk-JQXJ2E53.js} +1 -1
  51. package/dist/{chunk-HLPLT3NY.js → chunk-M5OZSVJI.js} +8 -4
  52. package/dist/{chunk-XJ42NBP5.js → chunk-MCNP7A7T.js} +8 -8
  53. package/dist/{chunk-OJCP3C3J.js → chunk-NCGVQXX5.js} +22 -26
  54. package/dist/{chunk-4AQZYNHM.js → chunk-NNOCRVQO.js} +2 -2
  55. package/dist/{chunk-GXYDVZKM.js → chunk-P43QM7JY.js} +5 -5
  56. package/dist/{chunk-EINWQFXI.js → chunk-QPIPYVGE.js} +5 -5
  57. package/dist/{chunk-GDFF3BQG.js → chunk-RF6J3DIO.js} +34 -36
  58. package/dist/{chunk-D6YX4NNN.js → chunk-SH6ZKJFZ.js} +4 -4
  59. package/dist/{chunk-LE5H7LMT.js → chunk-SHDREBGC.js} +1 -1
  60. package/dist/{chunk-VMNRXKAH.js → chunk-TZLYAO2J.js} +191 -134
  61. package/dist/{chunk-RRJV5UR5.js → chunk-UIMBNY6O.js} +11 -337
  62. package/dist/{chunk-ZCHIC2GM.js → chunk-UOFQEVR5.js} +15 -6
  63. package/dist/{chunk-7OEIXFC3.js → chunk-Y2VZ54CQ.js} +12 -12
  64. package/dist/{chunk-VY6W3T43.js → chunk-ZBOGYZ53.js} +4 -4
  65. package/dist/{chunk-POSZWRGL.js → chunk-ZUQT35YC.js} +1 -1
  66. package/dist/cli/chat.js +31 -32
  67. package/dist/cli/check.js +6 -6
  68. package/dist/cli/plugins.js +13 -13
  69. package/dist/cli/snapshot-create.js +9 -9
  70. package/dist/cli/upgrade.js +7 -7
  71. package/dist/{db-XUKZRFFK.js → db-HUW75QG7.js} +7 -7
  72. package/dist/instrumentation.js +4 -4
  73. package/dist/nitro.js +2 -2
  74. package/dist/{oauth-callback-server-LPZMMGFI.js → oauth-callback-server-DP7NIZPQ.js} +24 -25
  75. package/dist/{runner-DGKUTMPX.js → runner-AINV7K3M.js} +47 -45
  76. package/dist/{skills-P7YUFSXM.js → skills-PKS37E6B.js} +6 -6
  77. package/dist/spawn-NJCDEPPL.js +38 -0
  78. package/dist/{validation-S7U5M5NR.js → validation-PDC3MVMM.js} +6 -6
  79. package/dist/version.js +1 -1
  80. package/dist/{work-GAA7TVAD.js → work-KJLJRPXS.js} +17 -17
  81. package/dist/{worker-JXPJH3QB.js → worker-TYQ7YVIR.js} +11 -11
  82. package/package.json +5 -5
  83. package/dist/chunk-4EA2SFK2.js +0 -137
  84. package/dist/spawn-DSK3ZEVD.js +0 -38
@@ -3,19 +3,18 @@ import {
3
3
  } from "./chunk-FA6POGLH.js";
4
4
  import {
5
5
  getTurnRequestDeadline
6
- } from "./chunk-DUY5CDAM.js";
6
+ } from "./chunk-4KAYAIBV.js";
7
7
  import {
8
8
  persistAuthPauseTurnState
9
- } from "./chunk-LNVEIJ2L.js";
9
+ } from "./chunk-7D4GNUV2.js";
10
10
  import {
11
11
  buildSentryConversationUrl
12
12
  } from "./chunk-4CODA7P5.js";
13
13
  import {
14
14
  ensureConversationWake,
15
15
  requestConversationWork
16
- } from "./chunk-HLPLT3NY.js";
16
+ } from "./chunk-M5OZSVJI.js";
17
17
  import {
18
- buildConversationContext,
19
18
  buildDeliveredTurnStatePatch,
20
19
  finalizeFailedTurnReplyWithEvent,
21
20
  getInterruptionMarker,
@@ -23,13 +22,10 @@ import {
23
22
  getTurnUserMessageId,
24
23
  getTurnUserReplyAttachmentContext,
25
24
  getTurnUserSlackMessageTs,
26
- markConversationMessage,
27
- recordDeliveredAssistantMessage,
28
25
  requireTurnFailureEventId,
29
26
  resolveTurnSessionRouting,
30
- scheduleSessionCompletedPluginTasks,
31
- turnHasReply
32
- } from "./chunk-RRJV5UR5.js";
27
+ scheduleSessionCompletedPluginTasks
28
+ } from "./chunk-UIMBNY6O.js";
33
29
  import {
34
30
  ConversationTurnLifecycleService,
35
31
  coerceThreadConversationState,
@@ -38,7 +34,7 @@ import {
38
34
  getPersistedSandboxState,
39
35
  getPersistedThreadState,
40
36
  persistThreadStateById
41
- } from "./chunk-IL4EDBMV.js";
37
+ } from "./chunk-FEFEIA3Z.js";
42
38
  import {
43
39
  getVercelConversationWorkQueue
44
40
  } from "./chunk-WR76IVA5.js";
@@ -51,10 +47,10 @@ import {
51
47
  getMcpStoredOAuthCredentials,
52
48
  lookupSlackUserProfile,
53
49
  resolvePluginOAuthAccount
54
- } from "./chunk-XJ42NBP5.js";
50
+ } from "./chunk-MCNP7A7T.js";
55
51
  import {
56
52
  RetryableDeliveryError
57
- } from "./chunk-GDFF3BQG.js";
53
+ } from "./chunk-RF6J3DIO.js";
58
54
  import {
59
55
  addReactionToMessage,
60
56
  escapeSlackMrkdwnText,
@@ -67,16 +63,17 @@ import {
67
63
  removeReactionFromMessage,
68
64
  resolveBaseUrl,
69
65
  truncateStatusText
70
- } from "./chunk-WCN4YSH7.js";
66
+ } from "./chunk-DWETNV66.js";
71
67
  import {
72
68
  parseSlackThreadId,
73
69
  readSlackRawMessageContext,
74
70
  resolveSlackChannelIdFromMessage,
75
71
  resolveSlackChannelIdFromThreadId
76
- } from "./chunk-WOONT5ZP.js";
72
+ } from "./chunk-H2RLIJ7G.js";
77
73
  import {
78
74
  TurnSliceLimitExceededError,
79
75
  abandonTurnRecord,
76
+ buildConversationContext,
80
77
  buildTurnLimitResponse,
81
78
  clearPendingAuth,
82
79
  commitAcceptedReply,
@@ -88,35 +85,38 @@ import {
88
85
  isPendingAuthLatestRequest,
89
86
  loadProjection,
90
87
  loadTurnCheckpoint,
88
+ markConversationMessage,
91
89
  markTurnFailed,
92
90
  persistWithRetry,
93
91
  recordAuthenticationLinked,
94
92
  recordAuthorizationCompleted,
93
+ recordDeliveredAssistantMessage,
95
94
  recordTurnSummary,
96
- saveTurnCheckpoint
97
- } from "./chunk-VCYSOXON.js";
95
+ saveTurnCheckpoint,
96
+ turnHasReply
97
+ } from "./chunk-IPGNWXA3.js";
98
98
  import {
99
99
  getDashboardConversationLink,
100
100
  getPluginSlackConversationLink
101
- } from "./chunk-ZCHIC2GM.js";
101
+ } from "./chunk-UOFQEVR5.js";
102
102
  import {
103
103
  SlackActionError,
104
104
  getHeaderString,
105
105
  getSlackClient,
106
106
  isDmChannel,
107
107
  normalizeSlackConversationId
108
- } from "./chunk-V2FXMOEA.js";
108
+ } from "./chunk-64K7GKRW.js";
109
109
  import {
110
110
  getConversationEventStore,
111
111
  getSqlExecutor,
112
112
  requireSlackDestination,
113
113
  upsertIdentity,
114
114
  upsertLinkedIdentity
115
- } from "./chunk-VRHTNBA6.js";
115
+ } from "./chunk-ILYL6YFD.js";
116
116
  import {
117
117
  acquireActiveLock,
118
118
  getStateAdapter
119
- } from "./chunk-2B3PT3V2.js";
119
+ } from "./chunk-6PFDWAK2.js";
120
120
  import {
121
121
  botConfig,
122
122
  escapeXml,
@@ -124,18 +124,18 @@ import {
124
124
  getRuntimeMetadata,
125
125
  normalizeSlackEmojiName,
126
126
  standardModelId
127
- } from "./chunk-4GXJUYJV.js";
127
+ } from "./chunk-3ZMKDHCT.js";
128
128
  import {
129
129
  discoverSkills
130
- } from "./chunk-4AQZYNHM.js";
130
+ } from "./chunk-NNOCRVQO.js";
131
131
  import {
132
132
  pluginCatalogRuntime
133
- } from "./chunk-HWQGBIH7.js";
133
+ } from "./chunk-7NLW2NF5.js";
134
134
  import {
135
135
  buildOAuthTokenRequest,
136
136
  hasRequiredOAuthScope,
137
137
  parseOAuthTokenResponse
138
- } from "./chunk-POSZWRGL.js";
138
+ } from "./chunk-ZUQT35YC.js";
139
139
  import {
140
140
  createSlackResumeActor,
141
141
  isUserActor
@@ -153,7 +153,7 @@ import {
153
153
  setTags,
154
154
  toOptionalString,
155
155
  withLogContext
156
- } from "./chunk-EAI67NTM.js";
156
+ } from "./chunk-JQXJ2E53.js";
157
157
  import {
158
158
  homeDir
159
159
  } from "./chunk-H4HBKISO.js";
@@ -1150,8 +1150,7 @@ function getDefaultLockKey(channelId, threadTs) {
1150
1150
  return threadTs ? `slack:${channelId}:${threadTs}` : `slack:${channelId}`;
1151
1151
  }
1152
1152
  function getResumeLogContext(args, lockKey) {
1153
- const routing = args.replyContext?.routing;
1154
- const actor = routing?.actor;
1153
+ const actor = args.replyContext?.actor;
1155
1154
  return {
1156
1155
  conversationId: args.conversationId,
1157
1156
  messageConversationId: lockKey,
@@ -1244,43 +1243,40 @@ function createResumeReplyContext(args, statusSession, delivery) {
1244
1243
  if (!replyContext) {
1245
1244
  throw new TypeError("Slack resume requires a reply context");
1246
1245
  }
1247
- if (!replyContext.routing.source) {
1246
+ if (!replyContext.source) {
1248
1247
  throw new TypeError("Slack resume requires a reply context source");
1249
1248
  }
1250
- const source = replyContext.routing.source;
1251
- if (replyContext.routing.destination.platform !== "slack") {
1249
+ const source = replyContext.source;
1250
+ if (replyContext.destination.platform !== "slack") {
1252
1251
  throw new TypeError("Slack resume requires a Slack destination");
1253
1252
  }
1254
1253
  const requestDeadline = getTurnRequestDeadline();
1255
1254
  const threadId = args.lockKey ?? getDefaultLockKey(args.channelId, args.threadTs);
1256
- const persistedLocationConfiguration = replyContext.policy?.locationConfiguration ?? (replyContext.policy?.configuration ? createReadOnlyConfigService(replyContext.policy.configuration) : void 0);
1255
+ const persistedLocationConfiguration = replyContext.environment?.locationConfiguration ?? (replyContext.environment?.configuration ? createReadOnlyConfigService(replyContext.environment.configuration) : void 0);
1256
+ const priorOnEvent = replyContext.onEvent;
1257
1257
  return {
1258
+ ...replyContext,
1258
1259
  conversationId: args.conversationId,
1259
1260
  turnId: args.turnId,
1260
- input: {
1261
- ...replyContext.input ?? {},
1262
- messageText: args.messageText
1261
+ instruction: {
1262
+ ...replyContext.instruction ?? { text: args.messageText },
1263
+ text: args.messageText
1263
1264
  },
1264
- routing: {
1265
- ...replyContext.routing,
1266
- source: source.platform === "slack" ? {
1267
- ...source,
1268
- channelId: args.channelId,
1269
- ...args.threadTs ? { threadTs: args.threadTs } : {}
1270
- } : source
1271
- },
1272
- policy: {
1273
- ...replyContext.policy,
1274
- turnDeadlineAtMs: replyContext.policy?.turnDeadlineAtMs ?? requestDeadline?.deadlineAtMs,
1265
+ source: source.platform === "slack" ? {
1266
+ ...source,
1267
+ channelId: args.channelId,
1268
+ ...args.threadTs ? { threadTs: args.threadTs } : {}
1269
+ } : source,
1270
+ deadlineAtMs: replyContext.deadlineAtMs ?? requestDeadline?.deadlineAtMs,
1271
+ environment: {
1272
+ ...replyContext.environment,
1275
1273
  locationConfiguration: persistedLocationConfiguration
1276
1274
  },
1277
- state: replyContext.state,
1278
- observers: {
1279
- ...replyContext.observers,
1280
- onStatus: async (nextStatus) => {
1281
- statusSession.update(nextStatus);
1282
- await replyContext.observers?.onStatus?.(nextStatus);
1275
+ onEvent: async (event) => {
1276
+ if (event.type === "status") {
1277
+ statusSession.update({ text: event.text });
1283
1278
  }
1279
+ await priorOnEvent?.(event);
1284
1280
  },
1285
1281
  delivery,
1286
1282
  durability: {
@@ -1336,23 +1332,23 @@ async function resumeSlackTurnInContext(args) {
1336
1332
  if (!activeReplyContext) {
1337
1333
  throw new Error("Resumed turn requires replyContext");
1338
1334
  }
1339
- const credentialContext = activeReplyContext.routing.credentialContext;
1335
+ const credentialContext = activeReplyContext.credentialContext;
1340
1336
  if (!credentialContext) {
1341
1337
  throw new Error("Resumed turn requires replyContext.credentialContext");
1342
1338
  }
1343
- const routingActor = activeReplyContext.routing.actor;
1339
+ const routingActor = activeReplyContext.actor;
1344
1340
  let resumeActor;
1345
1341
  if ("type" in credentialContext.actor) {
1346
1342
  if (!isUserActor(routingActor) || credentialContext.actor.userId !== routingActor.userId) {
1347
1343
  throw new Error(
1348
- "Resumed turn credential actor must match replyContext.routing.actor.userId"
1344
+ "Resumed turn credential actor must match replyContext.actor.userId"
1349
1345
  );
1350
1346
  }
1351
1347
  resumeActor = routingActor;
1352
1348
  } else {
1353
1349
  if (routingActor && (routingActor.platform !== "system" || routingActor.name !== credentialContext.actor.name)) {
1354
1350
  throw new Error(
1355
- "Resumed turn system credential actor must match replyContext.routing.actor"
1351
+ "Resumed turn system credential actor must match replyContext.actor"
1356
1352
  );
1357
1353
  }
1358
1354
  resumeActor = credentialContext.actor;
@@ -1415,11 +1411,11 @@ async function resumeSlackTurnInContext(args) {
1415
1411
  const deliveryState2 = await getDeliveryConversation();
1416
1412
  let slackMessageTs = [];
1417
1413
  try {
1418
- if (runArgs.replyContext?.routing.publishExternally !== false) {
1414
+ if (runArgs.replyContext?.publishExternally !== false) {
1419
1415
  slackMessageTs = await sendSlackReply({
1420
1416
  channelId: runArgs.channelId,
1421
1417
  conversationId: runArgs.conversationId,
1422
- replyAttribution: runArgs.replyContext?.routing.dispatch?.replyAttribution,
1418
+ replyAttribution: runArgs.replyContext?.dispatch?.replyAttribution,
1423
1419
  text,
1424
1420
  threadTs: runArgs.threadTs
1425
1421
  });
@@ -1445,8 +1441,7 @@ async function resumeSlackTurnInContext(args) {
1445
1441
  });
1446
1442
  }
1447
1443
  try {
1448
- const routing2 = runArgs.replyContext?.routing;
1449
- const destination = routing2?.destination;
1444
+ const destination = runArgs.replyContext?.destination;
1450
1445
  const providerConversationIds = runArgs.threadTs ? [runArgs.threadTs] : slackMessageTs;
1451
1446
  await persistWithRetry(
1452
1447
  () => commitAcceptedReply({
@@ -1454,7 +1449,7 @@ async function resumeSlackTurnInContext(args) {
1454
1449
  conversation: deliveryState2.conversation,
1455
1450
  conversationMessageId: recordedMessageId,
1456
1451
  conversationId,
1457
- ...routing2?.dispatch && destination?.platform === "slack" && providerConversationIds.length > 0 ? {
1452
+ ...runArgs.replyContext?.dispatch && destination?.platform === "slack" && providerConversationIds.length > 0 ? {
1458
1453
  providerConversationBindings: providerConversationIds.map(
1459
1454
  (providerConversationId) => ({
1460
1455
  provider: "slack",
@@ -1473,22 +1468,22 @@ async function resumeSlackTurnInContext(args) {
1473
1468
  { "error.type": error instanceof Error ? error.name : typeof error }
1474
1469
  );
1475
1470
  }
1476
- const routing = runArgs.replyContext?.routing;
1477
- const dispatchId = routing?.dispatch?.id;
1478
- if (messageTs && dispatchId && routing) {
1471
+ const replyContext2 = runArgs.replyContext;
1472
+ const dispatchId = replyContext2?.dispatch?.id;
1473
+ if (messageTs && dispatchId && replyContext2) {
1479
1474
  try {
1480
1475
  await persistWithRetry(
1481
1476
  () => recordTurnSummary({
1482
1477
  conversationId: runArgs.conversationId,
1483
- destination: routing.destination,
1484
- destinationVisibility: routing.destinationVisibility,
1478
+ destination: replyContext2.destination,
1479
+ destinationVisibility: replyContext2.destinationVisibility,
1485
1480
  dispatchId,
1486
1481
  resultMessageId: messageTs,
1487
1482
  turnId: runArgs.turnId,
1488
1483
  sliceId: runArgs.sliceId ?? 1,
1489
- source: routing.source,
1484
+ source: replyContext2.source,
1490
1485
  state: "running",
1491
- surface: routing.surface ?? "slack"
1486
+ surface: replyContext2.surface ?? "slack"
1492
1487
  })
1493
1488
  );
1494
1489
  } catch (error) {
@@ -1571,7 +1566,7 @@ async function resumeSlackTurnInContext(args) {
1571
1566
  logException
1572
1567
  });
1573
1568
  const reply = finalized.reply;
1574
- const dispatchErrorMessage = replyContext.routing.dispatch && reply.diagnostics.outcome !== "success" ? reply.diagnostics.errorMessage ?? `Agent turn ended with ${reply.diagnostics.outcome}.` : void 0;
1569
+ const dispatchErrorMessage = replyContext.dispatch && reply.diagnostics.outcome !== "success" ? reply.diagnostics.errorMessage ?? `Agent turn ended with ${reply.diagnostics.outcome}.` : void 0;
1575
1570
  if (reply.diagnostics.outcome !== "success") {
1576
1571
  await deliverAssistantMessage(reply.text);
1577
1572
  }
@@ -1586,30 +1581,30 @@ async function resumeSlackTurnInContext(args) {
1586
1581
  messages: reply.piMessages,
1587
1582
  durationMs: reply.diagnostics.durationMs,
1588
1583
  usage: reply.diagnostics.usage,
1589
- destination: replyContext.routing.destination,
1590
- destinationVisibility: replyContext.routing.destinationVisibility,
1591
- dispatchId: replyContext.routing.dispatch?.id,
1584
+ destination: replyContext.destination,
1585
+ destinationVisibility: replyContext.destinationVisibility,
1586
+ dispatchId: replyContext.dispatch?.id,
1592
1587
  dispatchOutcome: reply.diagnostics.outcome === "success" ? "completed" : "failed",
1593
1588
  ...dispatchErrorMessage ? { errorMessage: dispatchErrorMessage } : {},
1594
1589
  ...acceptedDeliveryId ? { resultMessageId: acceptedDeliveryId } : {},
1595
- source: replyContext.routing.source,
1590
+ source: replyContext.source,
1596
1591
  actor: resumeActor,
1597
- surface: replyContext.routing.surface ?? "slack",
1592
+ surface: replyContext.surface ?? "slack",
1598
1593
  sliceId: runArgs.sliceId
1599
1594
  });
1600
- } else if (replyContext.routing.dispatch?.id) {
1595
+ } else if (replyContext.dispatch?.id) {
1601
1596
  await recordTurnSummary({
1602
1597
  conversationId: runArgs.conversationId,
1603
- destination: replyContext.routing.destination,
1604
- destinationVisibility: replyContext.routing.destinationVisibility,
1605
- dispatchId: replyContext.routing.dispatch?.id,
1598
+ destination: replyContext.destination,
1599
+ destinationVisibility: replyContext.destinationVisibility,
1600
+ dispatchId: replyContext.dispatch?.id,
1606
1601
  dispatchOutcome: reply.diagnostics.outcome === "success" ? "completed" : "failed",
1607
1602
  ...acceptedDeliveryId ? { resultMessageId: acceptedDeliveryId } : {},
1608
1603
  turnId: runArgs.turnId,
1609
1604
  sliceId: runArgs.sliceId ?? 1,
1610
- source: replyContext.routing.source,
1605
+ source: replyContext.source,
1611
1606
  state: reply.diagnostics.outcome === "success" ? "completed" : "failed",
1612
- surface: replyContext.routing.surface ?? "slack"
1607
+ surface: replyContext.surface ?? "slack"
1613
1608
  });
1614
1609
  }
1615
1610
  await runArgs.commitResult?.(reply);
@@ -1710,7 +1705,7 @@ async function resumeSlackTurnInContext(args) {
1710
1705
  deferredAuthInfo.requestText
1711
1706
  ),
1712
1707
  runArgs.conversationId,
1713
- runArgs.replyContext?.routing.dispatch?.replyAttribution
1708
+ runArgs.replyContext?.dispatch?.replyAttribution
1714
1709
  );
1715
1710
  }
1716
1711
  return true;
@@ -2071,23 +2066,22 @@ async function resumeAuthorizedMcpTurn(args) {
2071
2066
  messageTs: lockedMessageTs,
2072
2067
  inputMessageIds: [lockedUserMessage.id],
2073
2068
  replyContext: {
2074
- input: {
2075
- conversationContext: lockedConversationContext,
2076
- // Pi history is SQL-authoritative: the resumed run reads its
2077
- // session record first and falls back to the step projection.
2078
- piMessages: await loadProjection({ conversationId: threadId }),
2069
+ instruction: {
2070
+ text: lockedUserMessage.text,
2071
+ context: lockedConversationContext,
2079
2072
  ...getTurnUserReplyAttachmentContext(lockedUserMessage)
2080
2073
  },
2081
- routing: {
2082
- credentialContext: {
2083
- actor: { type: "user", userId: actor.userId }
2084
- },
2085
- actor,
2086
- destination,
2087
- source: routing.source,
2088
- toolChannelId: authSession.toolChannelId ?? authSession.channelId
2074
+ // Pi history is SQL-authoritative: the resumed run reads its
2075
+ // session record first and falls back to the step projection.
2076
+ history: await loadProjection({ conversationId: threadId }),
2077
+ credentialContext: {
2078
+ actor: { type: "user", userId: actor.userId }
2089
2079
  },
2090
- policy: {
2080
+ actor,
2081
+ destination,
2082
+ source: routing.source,
2083
+ toolChannelId: authSession.toolChannelId ?? authSession.channelId,
2084
+ environment: {
2091
2085
  configuration: authSession.configuration,
2092
2086
  locationConfiguration: lockedLocationConfiguration
2093
2087
  },
@@ -2697,28 +2691,27 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
2697
2691
  messageTs: lockedMessageTs,
2698
2692
  inputMessageIds: [lockedUserMessage.id],
2699
2693
  replyContext: {
2700
- input: {
2701
- conversationContext: lockedConversationContext,
2702
- // Pi history is SQL-authoritative: the resumed run reads its
2703
- // session record first and falls back to the step projection.
2704
- piMessages: await loadProjection({
2705
- conversationId: stored.resumeConversationId
2706
- }),
2694
+ instruction: {
2695
+ text: lockedUserMessage.text,
2696
+ context: lockedConversationContext,
2707
2697
  ...getTurnUserReplyAttachmentContext(lockedUserMessage)
2708
2698
  },
2709
- routing: {
2710
- credentialContext: {
2711
- actor: {
2712
- type: "user",
2713
- userId: actor.userId
2714
- }
2715
- },
2716
- actor,
2717
- destination,
2718
- source: routing.source,
2719
- toolChannelId: stored.channelId
2699
+ // Pi history is SQL-authoritative: the resumed run reads its
2700
+ // session record first and falls back to the step projection.
2701
+ history: await loadProjection({
2702
+ conversationId: stored.resumeConversationId
2703
+ }),
2704
+ credentialContext: {
2705
+ actor: {
2706
+ type: "user",
2707
+ userId: actor.userId
2708
+ }
2720
2709
  },
2721
- policy: {
2710
+ actor,
2711
+ destination,
2712
+ source: routing.source,
2713
+ toolChannelId: stored.channelId,
2714
+ environment: {
2722
2715
  locationConfiguration: lockedLocationConfiguration
2723
2716
  },
2724
2717
  state: {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-EM225ITJ.js";
4
4
  import {
5
5
  getSlackBotToken
6
- } from "./chunk-4GXJUYJV.js";
6
+ } from "./chunk-3ZMKDHCT.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-EAI67NTM.js";
15
+ } from "./chunk-JQXJ2E53.js";
16
16
 
17
17
  // src/chat/slack/client.ts
18
18
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getChatConfig
3
- } from "./chunk-4GXJUYJV.js";
3
+ } from "./chunk-3ZMKDHCT.js";
4
4
 
5
5
  // src/chat/state/adapter.ts
6
6
  import { createMemoryState } from "@chat-adapter/state-memory";
@@ -1,16 +1,16 @@
1
1
  import {
2
- getTurnUserMessageId,
3
- markConversationMessage
4
- } from "./chunk-RRJV5UR5.js";
2
+ getTurnUserMessageId
3
+ } from "./chunk-UIMBNY6O.js";
5
4
  import {
6
5
  coerceThreadConversationState,
7
6
  getPersistedThreadState,
8
7
  persistThreadStateById
9
- } from "./chunk-IL4EDBMV.js";
8
+ } from "./chunk-FEFEIA3Z.js";
10
9
  import {
11
10
  hydrateConversationMessages,
11
+ markConversationMessage,
12
12
  markTurnClosed
13
- } from "./chunk-VCYSOXON.js";
13
+ } from "./chunk-IPGNWXA3.js";
14
14
 
15
15
  // src/chat/runtime/auth-pause-state.ts
16
16
  function completeAuthPauseTurn(args) {