@sentry/junior 0.132.0 → 0.133.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 (58) hide show
  1. package/dist/{agent-hooks-ONXOJDR6.js → agent-hooks-5BUIXVIX.js} +9 -9
  2. package/dist/api.js +16 -16
  3. package/dist/app.js +84 -37
  4. package/dist/{catalog-runtime-BATAY4R7.js → catalog-runtime-VGB3DWXZ.js} +5 -5
  5. package/dist/chat/config.d.ts +2 -0
  6. package/dist/chat/conversations/projection.d.ts +3 -1
  7. package/dist/chat/conversations/sql/bindings.d.ts +13 -0
  8. package/dist/chat/conversations/sql/store.d.ts +3 -0
  9. package/dist/chat/conversations/store.d.ts +15 -0
  10. package/dist/chat/runtime/reply-executor.d.ts +1 -0
  11. package/dist/chat/runtime/slack-runtime.d.ts +2 -0
  12. package/dist/chat/slack/dispatch-turn.d.ts +1 -0
  13. package/dist/chat/slack/reply.d.ts +1 -1
  14. package/dist/{chunk-JYQAE2ZU.js → chunk-5ZAZHLIW.js} +1 -1
  15. package/dist/{chunk-G3WYA2RS.js → chunk-AH5HTUYX.js} +1 -1
  16. package/dist/{chunk-GPXVDJML.js → chunk-ECUILEUX.js} +24 -15
  17. package/dist/{chunk-GOEZU33G.js → chunk-EJRJWBKG.js} +1 -1
  18. package/dist/{chunk-WEJIS7OC.js → chunk-FX6BLEDP.js} +1 -1
  19. package/dist/{chunk-V44FFBO3.js → chunk-HJ4KDO4N.js} +1 -1
  20. package/dist/{chunk-SKWIIUS7.js → chunk-HTGXUNEC.js} +7 -7
  21. package/dist/{chunk-2425Q4OR.js → chunk-IKO5LFIU.js} +1 -1
  22. package/dist/{chunk-BKE47OOW.js → chunk-IVTHTAVK.js} +2 -2
  23. package/dist/{chunk-B7IY6SVJ.js → chunk-JLN4XSPR.js} +1 -1
  24. package/dist/{chunk-NNHUGGO4.js → chunk-LDRO4OQ4.js} +19 -3
  25. package/dist/{chunk-WYQP7QSB.js → chunk-LNYNTR27.js} +101 -61
  26. package/dist/{chunk-KB2M27DL.js → chunk-QWGZ273D.js} +78 -36
  27. package/dist/{chunk-ZMV2YBT6.js → chunk-T5FPIBU2.js} +14 -14
  28. package/dist/{chunk-AW5Z3T7V.js → chunk-TBVS7GBE.js} +4 -4
  29. package/dist/{chunk-ODIP5CEM.js → chunk-TLN54TOQ.js} +1 -1
  30. package/dist/{chunk-GTKNPQNN.js → chunk-TU7P77FI.js} +36 -24
  31. package/dist/{chunk-U76PS7AT.js → chunk-V365UVCU.js} +2 -2
  32. package/dist/{chunk-ISNRPCPG.js → chunk-VL7OYSHD.js} +1 -1
  33. package/dist/{chunk-O2UXPUVQ.js → chunk-VQA25AL4.js} +6 -6
  34. package/dist/{chunk-ALDPUN3Z.js → chunk-WHEMUEXT.js} +5 -5
  35. package/dist/{chunk-XN656LB4.js → chunk-XTQGVNM3.js} +3 -3
  36. package/dist/cli/chat.js +24 -24
  37. package/dist/cli/check.js +6 -6
  38. package/dist/cli/init.js +1 -0
  39. package/dist/cli/plugins.js +12 -12
  40. package/dist/cli/snapshot-create.js +9 -9
  41. package/dist/cli/upgrade.js +9 -8
  42. package/dist/db/executor.d.ts +2 -1
  43. package/dist/db/neon.d.ts +1 -0
  44. package/dist/db/postgres.d.ts +1 -0
  45. package/dist/db/schema/conversation-bindings.d.ts +110 -0
  46. package/dist/db/schema.d.ts +111 -1
  47. package/dist/{db-QFFZACXF.js → db-RICMPUFT.js} +7 -7
  48. package/dist/instrumentation.js +4 -4
  49. package/dist/nitro.js +2 -2
  50. package/dist/{oauth-callback-server-5WXLD533.js → oauth-callback-server-YFVS4SAX.js} +17 -17
  51. package/dist/{runner-Y3LTUNAA.js → runner-A3LVGZR6.js} +11 -11
  52. package/dist/{skills-7M5C24GM.js → skills-P7Q6Z6PN.js} +6 -6
  53. package/dist/{validation-MRILMYDI.js → validation-RYHOWBET.js} +6 -6
  54. package/dist/version.js +1 -1
  55. package/migrations/0018_curvy_excalibur.sql +12 -0
  56. package/migrations/meta/0018_snapshot.json +1756 -0
  57. package/migrations/meta/_journal.json +8 -1
  58. package/package.json +5 -5
@@ -1,3 +1,6 @@
1
+ import {
2
+ DEFAULT_SQL_STATEMENT_TIMEOUT_MS
3
+ } from "./chunk-LDRO4OQ4.js";
1
4
  import {
2
5
  juniorDestinations,
3
6
  timestamptz
@@ -274,25 +277,53 @@ var juniorConversationEvents = pgTable6(
274
277
  ]
275
278
  );
276
279
 
280
+ // src/db/schema/conversation-bindings.ts
281
+ import { index as index5, pgTable as pgTable7, primaryKey as primaryKey3, text as text7 } from "drizzle-orm/pg-core";
282
+ var juniorConversationBindings = pgTable7(
283
+ "junior_conversation_bindings",
284
+ {
285
+ conversationId: text7("conversation_id").notNull().references(() => juniorConversations.conversationId),
286
+ provider: text7("provider").notNull(),
287
+ providerTenantId: text7("provider_tenant_id").notNull().default(""),
288
+ providerDestinationId: text7("provider_destination_id").notNull(),
289
+ providerConversationId: text7("provider_conversation_id").notNull(),
290
+ createdAt: timestamptz("created_at").notNull()
291
+ },
292
+ (table) => [
293
+ primaryKey3({
294
+ name: "junior_conversation_bindings_provider_conversation_pk",
295
+ columns: [
296
+ table.provider,
297
+ table.providerTenantId,
298
+ table.providerDestinationId,
299
+ table.providerConversationId
300
+ ]
301
+ }),
302
+ index5("junior_conversation_bindings_conversation_idx").on(
303
+ table.conversationId
304
+ )
305
+ ]
306
+ );
307
+
277
308
  // src/db/schema/event-tasks.ts
278
- import { bigint, index as index5, jsonb as jsonb5, pgTable as pgTable7, text as text7 } from "drizzle-orm/pg-core";
279
- var juniorEventTasks = pgTable7(
309
+ import { bigint, index as index6, jsonb as jsonb5, pgTable as pgTable8, text as text8 } from "drizzle-orm/pg-core";
310
+ var juniorEventTasks = pgTable8(
280
311
  "junior_event_tasks",
281
312
  {
282
- id: text7("id").primaryKey(),
283
- teamId: text7("team_id").notNull(),
284
- namespace: text7("namespace").notNull(),
285
- identifier: text7("identifier").notNull(),
313
+ id: text8("id").primaryKey(),
314
+ teamId: text8("team_id").notNull(),
315
+ namespace: text8("namespace").notNull(),
316
+ identifier: text8("identifier").notNull(),
286
317
  createdAtMs: bigint("created_at_ms", { mode: "number" }).notNull(),
287
318
  task: jsonb5("task_json").$type().notNull()
288
319
  },
289
320
  (table) => [
290
- index5("junior_event_tasks_team_idx").on(
321
+ index6("junior_event_tasks_team_idx").on(
291
322
  table.teamId,
292
323
  table.createdAtMs,
293
324
  table.id
294
325
  ),
295
- index5("junior_event_tasks_match_idx").on(
326
+ index6("junior_event_tasks_match_idx").on(
296
327
  table.namespace,
297
328
  table.identifier,
298
329
  table.createdAtMs,
@@ -302,18 +333,18 @@ var juniorEventTasks = pgTable7(
302
333
  );
303
334
 
304
335
  // src/db/schema/stats.ts
305
- import { date, integer as integer3, pgTable as pgTable8, primaryKey as primaryKey3, text as text8 } from "drizzle-orm/pg-core";
306
- var juniorStats = pgTable8(
336
+ import { date, integer as integer3, pgTable as pgTable9, primaryKey as primaryKey4, text as text9 } from "drizzle-orm/pg-core";
337
+ var juniorStats = pgTable9(
307
338
  "junior_stats",
308
339
  {
309
340
  date: date("date", { mode: "string" }).notNull(),
310
- namespace: text8("namespace").notNull(),
311
- metric: text8("metric").notNull(),
312
- name: text8("name").notNull(),
341
+ namespace: text9("namespace").notNull(),
342
+ metric: text9("metric").notNull(),
343
+ name: text9("name").notNull(),
313
344
  count: integer3("count").notNull().default(0)
314
345
  },
315
346
  (table) => [
316
- primaryKey3({
347
+ primaryKey4({
317
348
  name: "junior_stats_date_namespace_metric_name_pk",
318
349
  columns: [table.date, table.namespace, table.metric, table.name]
319
350
  })
@@ -322,16 +353,16 @@ var juniorStats = pgTable8(
322
353
 
323
354
  // src/db/schema/scheduled-tasks.ts
324
355
  import { sql as sql4 } from "drizzle-orm";
325
- import { bigint as bigint2, index as index6, jsonb as jsonb6, pgTable as pgTable9, text as text9 } from "drizzle-orm/pg-core";
326
- var juniorSchedulerTasks = pgTable9(
356
+ import { bigint as bigint2, index as index7, jsonb as jsonb6, pgTable as pgTable10, text as text10 } from "drizzle-orm/pg-core";
357
+ var juniorSchedulerTasks = pgTable10(
327
358
  "junior_scheduler_tasks",
328
359
  {
329
- id: text9("id").primaryKey(),
330
- teamId: text9("team_id").notNull(),
360
+ id: text10("id").primaryKey(),
361
+ teamId: text10("team_id").notNull(),
331
362
  // TODO(v0.128.0): Remove after v0.127.x runtimes no longer write this column.
332
- creatorSlackUserId: text9("creator_slack_user_id"),
333
- creatorIdentityId: text9("creator_identity_id"),
334
- status: text9("status").notNull(),
363
+ creatorSlackUserId: text10("creator_slack_user_id"),
364
+ creatorIdentityId: text10("creator_identity_id"),
365
+ status: text10("status").notNull(),
335
366
  nextRunAtMs: bigint2("next_run_at_ms", { mode: "number" }),
336
367
  runNowAtMs: bigint2("run_now_at_ms", { mode: "number" }),
337
368
  createdAtMs: bigint2("created_at_ms", { mode: "number" }).notNull(),
@@ -339,35 +370,35 @@ var juniorSchedulerTasks = pgTable9(
339
370
  },
340
371
  (table) => [
341
372
  // TODO(v0.128.0): Remove with creatorSlackUserId.
342
- index6("junior_scheduler_tasks_creator_idx").on(table.teamId, table.creatorSlackUserId, table.createdAtMs, table.id).where(sql4`${table.status} <> 'deleted'`),
343
- index6("junior_scheduler_tasks_creator_identity_idx").on(table.creatorIdentityId, table.createdAtMs, table.id).where(
373
+ index7("junior_scheduler_tasks_creator_idx").on(table.teamId, table.creatorSlackUserId, table.createdAtMs, table.id).where(sql4`${table.status} <> 'deleted'`),
374
+ index7("junior_scheduler_tasks_creator_identity_idx").on(table.creatorIdentityId, table.createdAtMs, table.id).where(
344
375
  sql4`${table.status} <> 'deleted' AND ${table.creatorIdentityId} IS NOT NULL`
345
376
  ),
346
- index6("junior_scheduler_tasks_team_status_idx").on(table.teamId, table.createdAtMs, table.id).where(sql4`${table.status} <> 'deleted'`),
347
- index6("junior_scheduler_tasks_run_now_due_idx").on(table.runNowAtMs, table.createdAtMs, table.id).where(
377
+ index7("junior_scheduler_tasks_team_status_idx").on(table.teamId, table.createdAtMs, table.id).where(sql4`${table.status} <> 'deleted'`),
378
+ index7("junior_scheduler_tasks_run_now_due_idx").on(table.runNowAtMs, table.createdAtMs, table.id).where(
348
379
  sql4`${table.status} = 'active' AND ${table.runNowAtMs} IS NOT NULL`
349
380
  ),
350
- index6("junior_scheduler_tasks_next_run_due_idx").on(table.nextRunAtMs, table.createdAtMs, table.id).where(
381
+ index7("junior_scheduler_tasks_next_run_due_idx").on(table.nextRunAtMs, table.createdAtMs, table.id).where(
351
382
  sql4`${table.status} = 'active' AND ${table.nextRunAtMs} IS NOT NULL`
352
383
  )
353
384
  ]
354
385
  );
355
- var juniorSchedulerRuns = pgTable9(
386
+ var juniorSchedulerRuns = pgTable10(
356
387
  "junior_scheduler_runs",
357
388
  {
358
- id: text9("id").primaryKey(),
359
- taskId: text9("task_id").notNull(),
360
- status: text9("status").notNull(),
389
+ id: text10("id").primaryKey(),
390
+ taskId: text10("task_id").notNull(),
391
+ status: text10("status").notNull(),
361
392
  scheduledForMs: bigint2("scheduled_for_ms", { mode: "number" }).notNull(),
362
393
  record: jsonb6("record").$type().notNull()
363
394
  },
364
395
  (table) => [
365
- index6("junior_scheduler_runs_task_status_idx").on(
396
+ index7("junior_scheduler_runs_task_status_idx").on(
366
397
  table.taskId,
367
398
  table.status,
368
399
  table.scheduledForMs
369
400
  ),
370
- index6("junior_scheduler_runs_status_idx").on(
401
+ index7("junior_scheduler_runs_status_idx").on(
371
402
  table.status,
372
403
  table.scheduledForMs
373
404
  )
@@ -379,6 +410,7 @@ var juniorSqlSchema = {
379
410
  juniorConversationAnnotations,
380
411
  juniorApiTokens,
381
412
  juniorConversationEvents,
413
+ juniorConversationBindings,
382
414
  juniorConversations,
383
415
  juniorDestinations,
384
416
  juniorEventTasks,
@@ -497,7 +529,8 @@ function createNeonJuniorSqlExecutor(args) {
497
529
  return new NeonExecutor(
498
530
  new Pool({
499
531
  connectionString: args.connectionString,
500
- max: 3
532
+ max: 3,
533
+ statement_timeout: args.statementTimeoutMs
501
534
  })
502
535
  );
503
536
  }
@@ -616,17 +649,25 @@ function createPostgresJuniorSqlExecutor(args) {
616
649
  new Pool2({
617
650
  application_name: args.applicationName,
618
651
  connectionString: args.connectionString,
619
- max: 3
652
+ max: 3,
653
+ statement_timeout: args.statementTimeoutMs
620
654
  })
621
655
  );
622
656
  }
623
657
 
624
658
  // src/db/executor.ts
625
659
  function createJuniorSqlExecutor(args) {
660
+ const statementTimeoutMs = args.statementTimeoutMs ?? DEFAULT_SQL_STATEMENT_TIMEOUT_MS;
626
661
  if (args.driver === "postgres") {
627
- return createPostgresJuniorSqlExecutor(args);
662
+ return createPostgresJuniorSqlExecutor({
663
+ connectionString: args.connectionString,
664
+ statementTimeoutMs
665
+ });
628
666
  }
629
- return createNeonJuniorSqlExecutor(args);
667
+ return createNeonJuniorSqlExecutor({
668
+ connectionString: args.connectionString,
669
+ statementTimeoutMs
670
+ });
630
671
  }
631
672
 
632
673
  export {
@@ -636,6 +677,7 @@ export {
636
677
  juniorConversationAnnotations,
637
678
  juniorApiTokens,
638
679
  juniorConversationEvents,
680
+ juniorConversationBindings,
639
681
  juniorEventTasks,
640
682
  juniorStats,
641
683
  juniorSchedulerTasks,
@@ -30,7 +30,7 @@ import {
30
30
  toMcpProviderError,
31
31
  toolInvocationDestination,
32
32
  uploadFilesToConversation
33
- } from "./chunk-SKWIIUS7.js";
33
+ } from "./chunk-HTGXUNEC.js";
34
34
  import {
35
35
  CooperativeTurnYieldError,
36
36
  JUNIOR_THREAD_STATE_TTL_MS,
@@ -80,7 +80,7 @@ import {
80
80
  stripRuntimeTurnContext,
81
81
  trimTrailingAssistantMessages,
82
82
  updateConversationStats
83
- } from "./chunk-GPXVDJML.js";
83
+ } from "./chunk-ECUILEUX.js";
84
84
  import {
85
85
  parseSandboxEgressAuthRequiredSignal,
86
86
  parseSandboxEgressPermissionDeniedSignal,
@@ -104,7 +104,7 @@ import {
104
104
  runNonInteractiveCommand,
105
105
  throwSandboxOperationError,
106
106
  wrapSandboxSetupError
107
- } from "./chunk-AW5Z3T7V.js";
107
+ } from "./chunk-TBVS7GBE.js";
108
108
  import {
109
109
  SCHEDULED_TASK_SYSTEM_ACTOR,
110
110
  ToolInputError,
@@ -136,10 +136,10 @@ import {
136
136
  resolveLocalScheduleAtMs,
137
137
  saveEventTask,
138
138
  writableEventTask
139
- } from "./chunk-XN656LB4.js";
139
+ } from "./chunk-XTQGVNM3.js";
140
140
  import {
141
141
  parseSlackThreadId
142
- } from "./chunk-G3WYA2RS.js";
142
+ } from "./chunk-AH5HTUYX.js";
143
143
  import {
144
144
  addAgentTurnUsage,
145
145
  hasAgentTurnUsage
@@ -162,7 +162,7 @@ import {
162
162
  readActorIdentity,
163
163
  resolveChannelCapabilities,
164
164
  withSlackRetries
165
- } from "./chunk-ALDPUN3Z.js";
165
+ } from "./chunk-WHEMUEXT.js";
166
166
  import {
167
167
  KNOWN_CONVERSATION_EVENT_TYPES,
168
168
  contextProvenance,
@@ -173,7 +173,7 @@ import {
173
173
  instructionActors,
174
174
  instructionProvenanceFor,
175
175
  sameActorIdentity
176
- } from "./chunk-WYQP7QSB.js";
176
+ } from "./chunk-LNYNTR27.js";
177
177
  import {
178
178
  SANDBOX_DATA_ROOT,
179
179
  SANDBOX_SKILLS_ROOT,
@@ -183,7 +183,7 @@ import {
183
183
  sandboxSkillFile,
184
184
  sandboxSkillPathResolution,
185
185
  sleep
186
- } from "./chunk-ODIP5CEM.js";
186
+ } from "./chunk-TLN54TOQ.js";
187
187
  import {
188
188
  ACTIVE_TURN_COMPACTION_SUMMARY_PREFIX,
189
189
  COMPACTION_SUMMARY_PREFIX,
@@ -217,7 +217,7 @@ import {
217
217
  renderCurrentInstruction,
218
218
  resolveGatewayModel,
219
219
  unwrapCurrentInstruction
220
- } from "./chunk-NNHUGGO4.js";
220
+ } from "./chunk-LDRO4OQ4.js";
221
221
  import {
222
222
  canExposeConversationPayload,
223
223
  resolveConversationPrivacy,
@@ -227,16 +227,16 @@ import {
227
227
  toGenAiMessagesTraceAttributes,
228
228
  toGenAiPayloadMetadata,
229
229
  toGenAiPayloadTraceAttributes
230
- } from "./chunk-ISNRPCPG.js";
230
+ } from "./chunk-VL7OYSHD.js";
231
231
  import {
232
232
  discoverSkills,
233
233
  findSkillByName,
234
234
  loadSkillsByName,
235
235
  parseSkillInvocation
236
- } from "./chunk-BKE47OOW.js";
236
+ } from "./chunk-IVTHTAVK.js";
237
237
  import {
238
238
  pluginCatalogRuntime
239
- } from "./chunk-B7IY6SVJ.js";
239
+ } from "./chunk-JLN4XSPR.js";
240
240
  import {
241
241
  CredentialUnavailableError,
242
242
  OAuthProviderError,
@@ -244,7 +244,7 @@ import {
244
244
  getOAuthProviderErrorAttributes,
245
245
  resolveAuthTokenPlaceholder,
246
246
  resolvePluginCommandEnv
247
- } from "./chunk-V44FFBO3.js";
247
+ } from "./chunk-HJ4KDO4N.js";
248
248
  import {
249
249
  credentialUserSubjectId
250
250
  } from "./chunk-77VDLF3Z.js";
@@ -273,7 +273,7 @@ import {
273
273
  summarizeMessageText,
274
274
  withLogContext,
275
275
  withSpan
276
- } from "./chunk-GOEZU33G.js";
276
+ } from "./chunk-EJRJWBKG.js";
277
277
  import {
278
278
  startInactiveSpan,
279
279
  withActiveSpan
@@ -2,18 +2,18 @@ import {
2
2
  SANDBOX_WORKSPACE_ROOT,
3
3
  getStateAdapter,
4
4
  sleep
5
- } from "./chunk-ODIP5CEM.js";
5
+ } from "./chunk-TLN54TOQ.js";
6
6
  import {
7
7
  toOptionalTrimmed
8
- } from "./chunk-NNHUGGO4.js";
8
+ } from "./chunk-LDRO4OQ4.js";
9
9
  import {
10
10
  pluginCatalogRuntime
11
- } from "./chunk-B7IY6SVJ.js";
11
+ } from "./chunk-JLN4XSPR.js";
12
12
  import {
13
13
  setSpanAttributes,
14
14
  setSpanStatus,
15
15
  withSpan
16
- } from "./chunk-GOEZU33G.js";
16
+ } from "./chunk-EJRJWBKG.js";
17
17
 
18
18
  // src/chat/sandbox/resources.ts
19
19
  var configuredResources;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getChatConfig
3
- } from "./chunk-NNHUGGO4.js";
3
+ } from "./chunk-LDRO4OQ4.js";
4
4
 
5
5
  // src/chat/state/adapter.ts
6
6
  import { createMemoryState } from "@chat-adapter/state-memory";
@@ -13,7 +13,7 @@ import {
13
13
  persistAuthPauseTurnState,
14
14
  requireTurnFailureEventId,
15
15
  scheduleSessionCompletedPluginTasks
16
- } from "./chunk-O2UXPUVQ.js";
16
+ } from "./chunk-VQA25AL4.js";
17
17
  import {
18
18
  buildSentryConversationUrl
19
19
  } from "./chunk-4CODA7P5.js";
@@ -40,7 +40,7 @@ import {
40
40
  resolveBaseUrl,
41
41
  resolvePluginOAuthAccount,
42
42
  truncateStatusText
43
- } from "./chunk-SKWIIUS7.js";
43
+ } from "./chunk-HTGXUNEC.js";
44
44
  import {
45
45
  JUNIOR_THREAD_STATE_TTL_MS,
46
46
  TurnSliceLimitExceededError,
@@ -64,7 +64,6 @@ import {
64
64
  markConversationMessage,
65
65
  markTurnFailed,
66
66
  persistCompletedSessionRecord,
67
- persistConversationMessages,
68
67
  persistThreadStateById,
69
68
  persistWithRetry,
70
69
  recordAgentTurnSessionSummary,
@@ -73,13 +72,13 @@ import {
73
72
  recordDeliveredAssistantMessage,
74
73
  turnHasReply,
75
74
  updateConversationStats
76
- } from "./chunk-GPXVDJML.js";
75
+ } from "./chunk-ECUILEUX.js";
77
76
  import {
78
77
  parseSlackThreadId,
79
78
  readSlackRawMessageContext,
80
79
  resolveSlackChannelIdFromMessage,
81
80
  resolveSlackChannelIdFromThreadId
82
- } from "./chunk-G3WYA2RS.js";
81
+ } from "./chunk-AH5HTUYX.js";
83
82
  import {
84
83
  SlackActionError,
85
84
  getDashboardConversationLink,
@@ -88,19 +87,19 @@ import {
88
87
  getSlackClient,
89
88
  isDmChannel,
90
89
  normalizeSlackConversationId
91
- } from "./chunk-ALDPUN3Z.js";
90
+ } from "./chunk-WHEMUEXT.js";
92
91
  import {
93
92
  getConversationEventStore,
94
93
  getConversationStore,
95
94
  parseDestination,
96
95
  requireSlackDestination,
97
96
  sameDestination
98
- } from "./chunk-WYQP7QSB.js";
97
+ } from "./chunk-LNYNTR27.js";
99
98
  import {
100
99
  acquireActiveLock,
101
100
  getDefaultRedisStateAdapterFor,
102
101
  getStateAdapter
103
- } from "./chunk-ODIP5CEM.js";
102
+ } from "./chunk-TLN54TOQ.js";
104
103
  import {
105
104
  FUNCTION_TIMEOUT_BUFFER_SECONDS,
106
105
  botConfig,
@@ -109,18 +108,18 @@ import {
109
108
  getRuntimeMetadata,
110
109
  normalizeSlackEmojiName,
111
110
  standardModelId
112
- } from "./chunk-NNHUGGO4.js";
111
+ } from "./chunk-LDRO4OQ4.js";
113
112
  import {
114
113
  discoverSkills
115
- } from "./chunk-BKE47OOW.js";
114
+ } from "./chunk-IVTHTAVK.js";
116
115
  import {
117
116
  pluginCatalogRuntime
118
- } from "./chunk-B7IY6SVJ.js";
117
+ } from "./chunk-JLN4XSPR.js";
119
118
  import {
120
119
  buildOAuthTokenRequest,
121
120
  hasRequiredOAuthScope,
122
121
  parseOAuthTokenResponse
123
- } from "./chunk-V44FFBO3.js";
122
+ } from "./chunk-HJ4KDO4N.js";
124
123
  import {
125
124
  createSlackResumeActor,
126
125
  isUserActor,
@@ -139,7 +138,7 @@ import {
139
138
  toOptionalNumber,
140
139
  toOptionalString,
141
140
  withLogContext
142
- } from "./chunk-GOEZU33G.js";
141
+ } from "./chunk-EJRJWBKG.js";
143
142
  import {
144
143
  homeDir
145
144
  } from "./chunk-H4HBKISO.js";
@@ -770,7 +769,7 @@ async function sendSlackReply(args) {
770
769
  conversationId: args.conversationId,
771
770
  replyAttribution: args.replyAttribution
772
771
  });
773
- let lastMessageTs;
772
+ const messageTs = [];
774
773
  for (const [index, text] of chunks.entries()) {
775
774
  const isFinalChunk = index === chunks.length - 1;
776
775
  const blocks = buildSlackReplyBlocks(
@@ -786,9 +785,11 @@ ${escapeSlackMrkdwnText(formatReplyAttribution(args.replyAttribution))}` : text;
786
785
  text: fallbackText,
787
786
  ...blocks ? { blocks } : {}
788
787
  });
789
- lastMessageTs = response.ts;
788
+ if (response.ts) {
789
+ messageTs.push(response.ts);
790
+ }
790
791
  }
791
- return lastMessageTs;
792
+ return messageTs;
792
793
  }
793
794
 
794
795
  // src/chat/slack/errors.ts
@@ -1422,9 +1423,9 @@ async function resumeSlackTurnInContext(args) {
1422
1423
  }
1423
1424
  failureCode = "delivery_failed";
1424
1425
  const deliveryState2 = await getDeliveryConversation();
1425
- let messageTs;
1426
+ let slackMessageTs;
1426
1427
  try {
1427
- messageTs = await sendSlackReply({
1428
+ slackMessageTs = await sendSlackReply({
1428
1429
  channelId: runArgs.channelId,
1429
1430
  conversationId: runArgs.conversationId,
1430
1431
  replyAttribution: runArgs.replyContext?.routing.dispatch?.replyAttribution,
@@ -1437,6 +1438,7 @@ async function resumeSlackTurnInContext(args) {
1437
1438
  }
1438
1439
  throw error;
1439
1440
  }
1441
+ const messageTs = slackMessageTs.at(-1);
1440
1442
  assistantMessageDelivered = true;
1441
1443
  acceptedDeliveryId = messageTs;
1442
1444
  const recordedMessageId = recordDeliveredAssistantMessage({
@@ -1451,15 +1453,25 @@ async function resumeSlackTurnInContext(args) {
1451
1453
  });
1452
1454
  }
1453
1455
  try {
1456
+ const routing2 = runArgs.replyContext?.routing;
1457
+ const destination = routing2?.destination;
1458
+ const providerConversationIds = runArgs.threadTs ? [runArgs.threadTs] : slackMessageTs;
1454
1459
  await persistWithRetry(
1455
- () => message ? commitAcceptedReply({
1456
- agentMessage: message,
1460
+ () => commitAcceptedReply({
1461
+ ...message ? { agentMessage: message } : {},
1457
1462
  conversation: deliveryState2.conversation,
1458
1463
  conversationMessageId: recordedMessageId,
1459
- conversationId
1460
- }) : persistConversationMessages({
1461
- conversation: deliveryState2.conversation,
1462
- conversationId
1464
+ conversationId,
1465
+ ...routing2?.dispatch && destination?.platform === "slack" && providerConversationIds.length > 0 ? {
1466
+ providerConversationBindings: providerConversationIds.map(
1467
+ (providerConversationId) => ({
1468
+ provider: "slack",
1469
+ providerDestinationId: destination.channelId,
1470
+ providerTenantId: destination.teamId,
1471
+ providerConversationId
1472
+ })
1473
+ )
1474
+ } : {}
1463
1475
  })
1464
1476
  );
1465
1477
  } catch (error) {
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-UTL3MHPC.js";
4
4
  import {
5
5
  parseSlackThreadId
6
- } from "./chunk-G3WYA2RS.js";
6
+ } from "./chunk-AH5HTUYX.js";
7
7
  import {
8
8
  normalizeSlackConversationId
9
- } from "./chunk-ALDPUN3Z.js";
9
+ } from "./chunk-WHEMUEXT.js";
10
10
 
11
11
  // src/handlers/health.ts
12
12
  function readHealthReport() {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logWarn
3
- } from "./chunk-GOEZU33G.js";
3
+ } from "./chunk-EJRJWBKG.js";
4
4
 
5
5
  // src/chat/conversation-privacy.ts
6
6
  import { AsyncLocalStorage } from "async_hooks";
@@ -22,7 +22,7 @@ import {
22
22
  persistThreadStateById,
23
23
  stripRuntimeTurnContext,
24
24
  updateConversationStats
25
- } from "./chunk-GPXVDJML.js";
25
+ } from "./chunk-ECUILEUX.js";
26
26
  import {
27
27
  createPluginConversationEvents,
28
28
  createPluginEmbedder,
@@ -30,26 +30,26 @@ import {
30
30
  createPluginModel,
31
31
  createPluginState,
32
32
  getPlugins
33
- } from "./chunk-ALDPUN3Z.js";
33
+ } from "./chunk-WHEMUEXT.js";
34
34
  import {
35
35
  getDb,
36
36
  sameActorIdentity
37
- } from "./chunk-WYQP7QSB.js";
37
+ } from "./chunk-LNYNTR27.js";
38
38
  import {
39
39
  getStateAdapter
40
- } from "./chunk-ODIP5CEM.js";
40
+ } from "./chunk-TLN54TOQ.js";
41
41
  import {
42
42
  ProviderError,
43
43
  findProviderError,
44
44
  getProviderErrorAttributes,
45
45
  getProviderErrorUserMessage
46
- } from "./chunk-NNHUGGO4.js";
46
+ } from "./chunk-LDRO4OQ4.js";
47
47
  import {
48
48
  parseSlackMessageTs
49
49
  } from "./chunk-F3B2YJ76.js";
50
50
  import {
51
51
  buildTurnFailureResponse
52
- } from "./chunk-GOEZU33G.js";
52
+ } from "./chunk-EJRJWBKG.js";
53
53
 
54
54
  // src/chat/runtime/delivered-turn-state.ts
55
55
  function buildDeliveredTurnStatePatch(args) {
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  getConversationEventStore,
3
3
  getDb
4
- } from "./chunk-WYQP7QSB.js";
4
+ } from "./chunk-LNYNTR27.js";
5
5
  import {
6
6
  juniorConversationAnnotations,
7
7
  juniorConversationEvents,
8
8
  juniorIdentities,
9
9
  juniorUsers
10
- } from "./chunk-KB2M27DL.js";
10
+ } from "./chunk-QWGZ273D.js";
11
11
  import {
12
12
  SANDBOX_WORKSPACE_ROOT,
13
13
  getStateAdapter,
14
14
  sleep
15
- } from "./chunk-ODIP5CEM.js";
15
+ } from "./chunk-TLN54TOQ.js";
16
16
  import {
17
17
  botConfig,
18
18
  completeObject,
19
19
  embedTexts,
20
20
  getSlackBotToken,
21
21
  standardModelId
22
- } from "./chunk-NNHUGGO4.js";
22
+ } from "./chunk-LDRO4OQ4.js";
23
23
  import {
24
24
  isActorUserId,
25
25
  parseActorUserId
@@ -37,7 +37,7 @@ import {
37
37
  setSpanAttributes,
38
38
  setSpanStatus,
39
39
  withSpan
40
- } from "./chunk-GOEZU33G.js";
40
+ } from "./chunk-EJRJWBKG.js";
41
41
 
42
42
  // src/chat/plugins/agent-hooks.ts
43
43
  import {
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  canRouteResourceEvents,
3
3
  getPlugins
4
- } from "./chunk-ALDPUN3Z.js";
4
+ } from "./chunk-WHEMUEXT.js";
5
5
  import {
6
6
  getDb
7
- } from "./chunk-WYQP7QSB.js";
7
+ } from "./chunk-LNYNTR27.js";
8
8
  import {
9
9
  juniorEventTasks,
10
10
  juniorSchedulerRuns,
11
11
  juniorSchedulerTasks,
12
12
  juniorStats
13
- } from "./chunk-KB2M27DL.js";
13
+ } from "./chunk-QWGZ273D.js";
14
14
  import {
15
15
  juniorDestinations
16
16
  } from "./chunk-VFUK3X5B.js";