@sentry/junior 0.73.0 → 0.74.1

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 (54) hide show
  1. package/dist/api-reference.d.ts +1 -1
  2. package/dist/app.js +258 -62
  3. package/dist/chat/app/production.d.ts +3 -0
  4. package/dist/chat/config.d.ts +3 -0
  5. package/dist/chat/conversations/configured.d.ts +5 -0
  6. package/dist/chat/conversations/sql/migrations.d.ts +11 -0
  7. package/dist/chat/conversations/sql/schema/conversations.d.ts +435 -0
  8. package/dist/chat/conversations/sql/schema/destinations.d.ts +200 -0
  9. package/dist/chat/conversations/sql/schema/identities.d.ts +214 -0
  10. package/dist/chat/conversations/sql/schema/migrations.d.ts +58 -0
  11. package/dist/chat/conversations/sql/schema/timestamps.d.ts +1 -0
  12. package/dist/chat/conversations/sql/schema.d.ts +910 -0
  13. package/dist/chat/conversations/sql/store.d.ts +52 -0
  14. package/dist/chat/conversations/state.d.ts +4 -0
  15. package/dist/chat/conversations/store.d.ts +57 -0
  16. package/dist/chat/ingress/slack-webhook.d.ts +2 -0
  17. package/dist/chat/plugins/agent-hooks.d.ts +2 -2
  18. package/dist/chat/respond.d.ts +1 -1
  19. package/dist/chat/services/mcp-auth-orchestration.d.ts +6 -5
  20. package/dist/chat/services/pending-auth.d.ts +2 -0
  21. package/dist/chat/services/plugin-auth-orchestration.d.ts +7 -6
  22. package/dist/chat/sql/db.d.ts +20 -0
  23. package/dist/chat/sql/neon.d.ts +9 -0
  24. package/dist/chat/sql/schema.d.ts +906 -0
  25. package/dist/chat/state/turn-session.d.ts +3 -0
  26. package/dist/chat/task-execution/slack-work.d.ts +2 -0
  27. package/dist/chat/task-execution/state.d.ts +209 -0
  28. package/dist/chat/task-execution/store.d.ts +30 -114
  29. package/dist/chat/task-execution/vercel-callback.d.ts +2 -0
  30. package/dist/chat/task-execution/worker.d.ts +2 -0
  31. package/dist/{chunk-ZDA2HYX5.js → chunk-2LUZA3LY.js} +3 -3
  32. package/dist/{chunk-RY6AL5C7.js → chunk-6UP2Z2RZ.js} +2 -2
  33. package/dist/{chunk-DIMX5F3T.js → chunk-F6HWCPOC.js} +1 -1
  34. package/dist/{chunk-WS2EG3GW.js → chunk-GM7HTXYC.js} +6 -0
  35. package/dist/{chunk-UZVHXZ7V.js → chunk-HYHKTFG2.js} +59 -15
  36. package/dist/chunk-JL2SLRAT.js +1970 -0
  37. package/dist/{chunk-OQSYYOLM.js → chunk-SQGMG7OD.js} +128 -114
  38. package/dist/{chunk-QUXPUKBH.js → chunk-Y7X25LFY.js} +1 -1
  39. package/dist/{chunk-UOTZ3EEQ.js → chunk-YOHFWWBV.js} +1 -1
  40. package/dist/{chunk-V4VYUY4A.js → chunk-YRDS7VKO.js} +1 -1
  41. package/dist/cli/chat.js +2 -2
  42. package/dist/cli/init.js +1 -1
  43. package/dist/cli/snapshot-warmup.js +3 -3
  44. package/dist/cli/upgrade.js +77 -7
  45. package/dist/instrumentation.js +0 -1
  46. package/dist/nitro.js +3 -3
  47. package/dist/reporting/conversations.d.ts +13 -3
  48. package/dist/reporting.d.ts +9 -2
  49. package/dist/reporting.js +101 -37
  50. package/dist/{runner-LMAM4OGD.js → runner-27NP2TEO.js} +7 -7
  51. package/dist/vercel.d.ts +6 -1
  52. package/dist/vercel.js +1 -1
  53. package/package.json +9 -4
  54. package/dist/chunk-AL5T52ZD.js +0 -1119
@@ -1,13 +1,15 @@
1
1
  import {
2
- recordConversationActivity
3
- } from "./chunk-AL5T52ZD.js";
2
+ createNeonJuniorSqlExecutor,
3
+ createSqlStore,
4
+ createStateConversationStore
5
+ } from "./chunk-JL2SLRAT.js";
4
6
  import {
5
7
  isConversationChannel,
6
8
  isConversationScopedChannel,
7
9
  isDmChannel,
8
10
  normalizeSlackConversationId,
9
11
  parseDestination
10
- } from "./chunk-V4VYUY4A.js";
12
+ } from "./chunk-YRDS7VKO.js";
11
13
  import {
12
14
  SANDBOX_DATA_ROOT,
13
15
  SANDBOX_WORKSPACE_ROOT,
@@ -21,12 +23,12 @@ import {
21
23
  import {
22
24
  getConnectedStateContext,
23
25
  getStateAdapter
24
- } from "./chunk-DIMX5F3T.js";
26
+ } from "./chunk-F6HWCPOC.js";
25
27
  import {
26
28
  TURN_CONTEXT_TAG,
27
29
  botConfig,
28
30
  getChatConfig
29
- } from "./chunk-WS2EG3GW.js";
31
+ } from "./chunk-GM7HTXYC.js";
30
32
  import {
31
33
  isActorUserId,
32
34
  parseActorUserId,
@@ -683,7 +685,7 @@ function failedOperationalReport(args) {
683
685
  ]
684
686
  };
685
687
  }
686
- async function getAgentPluginOperationalReports(nowMs = Date.now()) {
688
+ async function getAgentPluginOperationalReports(nowMs, conversations) {
687
689
  const reports = [];
688
690
  for (const plugin of getAgentPlugins()) {
689
691
  const hook = plugin.hooks?.operationalReport;
@@ -698,6 +700,7 @@ async function getAgentPluginOperationalReports(nowMs = Date.now()) {
698
700
  const report = await hook({
699
701
  plugin: { name: plugin.name },
700
702
  log,
703
+ conversations,
701
704
  nowMs,
702
705
  state: pluginReadState(state)
703
706
  });
@@ -1290,6 +1293,27 @@ async function commitMessages(args) {
1290
1293
  };
1291
1294
  }
1292
1295
 
1296
+ // src/chat/conversations/configured.ts
1297
+ var configuredStore;
1298
+ function getConfiguredConversationStore() {
1299
+ const databaseUrl = getChatConfig().sql.databaseUrl;
1300
+ if (!databaseUrl) {
1301
+ return createStateConversationStore();
1302
+ }
1303
+ if (configuredStore?.databaseUrl !== databaseUrl) {
1304
+ configuredStore = {
1305
+ databaseUrl,
1306
+ store: createSqlStore(
1307
+ createNeonJuniorSqlExecutor({ connectionString: databaseUrl })
1308
+ )
1309
+ };
1310
+ }
1311
+ return configuredStore.store;
1312
+ }
1313
+ function hasConfiguredSqlConversationStore() {
1314
+ return Boolean(getChatConfig().sql.databaseUrl);
1315
+ }
1316
+
1293
1317
  // src/chat/xml.ts
1294
1318
  function escapeXml(value) {
1295
1319
  return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&apos;");
@@ -2359,24 +2383,36 @@ async function appendAgentTurnSessionSummary(summary, ttlMs) {
2359
2383
  )
2360
2384
  ]);
2361
2385
  }
2362
- async function recordConversationActivityBestEffort(args) {
2386
+ async function recordConversationActivityMetadata(args) {
2387
+ const conversationStore = args.conversationStore ?? getConfiguredConversationStore();
2388
+ const source = args.summary.destination?.platform === "local" ? "local" : args.summary.surface;
2389
+ const shouldRequireExistingStateConversation = !args.conversationStore && args.summary.destination?.platform === "slack" && !hasConfiguredSqlConversationStore();
2363
2390
  try {
2364
- await recordConversationActivity({
2391
+ if (shouldRequireExistingStateConversation) {
2392
+ const existing = await conversationStore.get({
2393
+ conversationId: args.summary.conversationId
2394
+ });
2395
+ if (!existing) {
2396
+ return;
2397
+ }
2398
+ }
2399
+ await conversationStore.recordActivity({
2365
2400
  activityAtMs: args.summary.updatedAtMs,
2366
2401
  channelName: args.summary.channelName,
2367
2402
  conversationId: args.summary.conversationId,
2368
2403
  destination: args.summary.destination,
2369
2404
  nowMs: args.nowMs,
2370
2405
  requester: args.summary.requester,
2371
- source: args.summary.surface
2406
+ source
2372
2407
  });
2373
2408
  } catch (error) {
2374
- logException(
2375
- error,
2376
- "conversation_activity_record_failed",
2409
+ logWarn(
2410
+ "conversation_activity_metadata_update_failed",
2377
2411
  { conversationId: args.summary.conversationId },
2378
- {},
2379
- "Failed to mirror turn session summary into conversation activity"
2412
+ {
2413
+ "exception.message": error instanceof Error ? error.message : String(error)
2414
+ },
2415
+ "Failed to update conversation activity metadata"
2380
2416
  );
2381
2417
  }
2382
2418
  }
@@ -2503,6 +2539,11 @@ async function setStoredRecord(args) {
2503
2539
  ...summary
2504
2540
  } = args.record;
2505
2541
  await appendAgentTurnSessionSummary(summary, args.ttlMs);
2542
+ await recordConversationActivityMetadata({
2543
+ conversationStore: args.conversationStore,
2544
+ nowMs: Date.now(),
2545
+ summary
2546
+ });
2506
2547
  return materializeAgentTurnSessionRecord(args.record, [...args.piMessages]);
2507
2548
  }
2508
2549
  async function updateAgentTurnSessionState(args) {
@@ -2554,6 +2595,7 @@ async function upsertAgentTurnSessionRecord(args) {
2554
2595
  ttlMs
2555
2596
  });
2556
2597
  return await setStoredRecord({
2598
+ conversationStore: args.conversationStore,
2557
2599
  piMessages: args.piMessages,
2558
2600
  ttlMs,
2559
2601
  record: buildStoredRecord({
@@ -2614,7 +2656,8 @@ async function recordAgentTurnSessionSummary(args) {
2614
2656
  ...args.traceId ?? existing?.traceId ? { traceId: args.traceId ?? existing?.traceId } : {}
2615
2657
  };
2616
2658
  await appendAgentTurnSessionSummary(summary, ttlMs);
2617
- await recordConversationActivityBestEffort({
2659
+ await recordConversationActivityMetadata({
2660
+ conversationStore: args.conversationStore,
2618
2661
  nowMs,
2619
2662
  summary
2620
2663
  });
@@ -2706,6 +2749,7 @@ export {
2706
2749
  recordAuthorizationRequested,
2707
2750
  recordAuthorizationCompleted,
2708
2751
  commitMessages,
2752
+ getConfiguredConversationStore,
2709
2753
  getAgentTurnSessionRecord,
2710
2754
  upsertAgentTurnSessionRecord,
2711
2755
  recordAgentTurnSessionSummary,