@sentry/junior 0.97.1 → 0.99.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 (59) hide show
  1. package/dist/{agent-hooks-XSUIVRQS.js → agent-hooks-OSW6C3CJ.js} +2 -2
  2. package/dist/api/conversations/detail.d.ts +1 -1
  3. package/dist/api/conversations/detail.query.d.ts +1 -1
  4. package/dist/api/conversations/list.d.ts +7 -2
  5. package/dist/api/conversations/list.query.d.ts +9 -3
  6. package/dist/api/conversations/projection.d.ts +0 -1
  7. package/dist/api/conversations/schema.d.ts +31 -8
  8. package/dist/api/people/schema.d.ts +0 -11
  9. package/dist/api/people/shared.d.ts +2 -4
  10. package/dist/api/schema.d.ts +4 -1
  11. package/dist/api/schema.js +5 -3
  12. package/dist/api-reference.d.ts +2 -2
  13. package/dist/api.js +28 -13
  14. package/dist/app.js +50 -37
  15. package/dist/chat/conversations/search.d.ts +24 -0
  16. package/dist/chat/conversations/sql/search.d.ts +4 -0
  17. package/dist/chat/db.d.ts +3 -0
  18. package/dist/chat/runtime/report-progress.d.ts +3 -0
  19. package/dist/chat/runtime/slack-resume.d.ts +2 -0
  20. package/dist/chat/services/context-compaction.d.ts +1 -0
  21. package/dist/chat/slack/assistant-thread/status-scheduler.d.ts +4 -3
  22. package/dist/chat/slack/outbound.d.ts +6 -0
  23. package/dist/chat/slack/tools/conversation-search.d.ts +71 -0
  24. package/dist/chat/state/turn-session.d.ts +2 -0
  25. package/dist/chat/tool-support/zod-tool.d.ts +1 -1
  26. package/dist/chunk-6DTVCPLO.js +146 -0
  27. package/dist/{chunk-VFH4ZKZT.js → chunk-CRQVIHDI.js} +1 -3
  28. package/dist/{chunk-6U26PYI5.js → chunk-CV22LUIV.js} +7 -17
  29. package/dist/{chunk-GUAP3H7O.js → chunk-DHHU2WSG.js} +2 -2
  30. package/dist/{chunk-T533JLM3.js → chunk-ER45IV77.js} +8 -6
  31. package/dist/{chunk-LUAE4MGW.js → chunk-EUZ44ROE.js} +21 -4
  32. package/dist/{chunk-5HLDPVYS.js → chunk-FTTFV6DC.js} +1 -1
  33. package/dist/{chunk-3F4OPKGF.js → chunk-IO65E4ZD.js} +2 -2
  34. package/dist/{chunk-ON6YKIQ7.js → chunk-KFUSLFLL.js} +21 -15
  35. package/dist/{chunk-FBHZJFHI.js → chunk-NJEDJFK4.js} +1 -1
  36. package/dist/{chunk-35BNLDOJ.js → chunk-OGHXZ4KQ.js} +134 -57
  37. package/dist/{chunk-WJOSZOON.js → chunk-OL6XQ23W.js} +11 -150
  38. package/dist/{chunk-XIRPQQVE.js → chunk-PYK7R5A7.js} +312 -175
  39. package/dist/{chunk-UAMKJPDF.js → chunk-T55RBE4Z.js} +4 -0
  40. package/dist/{chunk-WGXMTFNU.js → chunk-WJ7STXT6.js} +5 -3
  41. package/dist/{chunk-AUUCAFDE.js → chunk-ZZUBLPXD.js} +134 -11
  42. package/dist/cli/chat.js +11 -10
  43. package/dist/cli/plugins.js +2 -2
  44. package/dist/cli/upgrade.js +9 -7
  45. package/dist/{db-BWXYIKFQ.js → db-GFSCDAHS.js} +3 -1
  46. package/dist/detail-Q4IVDNGS.js +67 -0
  47. package/dist/{legacy-import-3NQJVGQL.js → legacy-import-6WWXMALY.js} +2 -2
  48. package/dist/{list-UXJI5Q5X.js → list-A3F5JDYV.js} +7 -5
  49. package/dist/{list-A3WFRIYX.js → list-M5BRWW3D.js} +5 -6
  50. package/dist/{plugin-conversations-DDNGC35A.js → plugin-conversations-PDCQWU3O.js} +3 -3
  51. package/dist/{profile-4RYDXWTF.js → profile-UEIRSVT3.js} +5 -5
  52. package/dist/{runner-JALSYH2P.js → runner-267ZRLZD.js} +8 -7
  53. package/dist/{stats-XKXH3PTY.js → stats-L62E4O4U.js} +7 -17
  54. package/dist/{subagent-TZ55XY37.js → subagent-UN3MP6LV.js} +6 -6
  55. package/migrations/0002_conversation_message_search.sql +1 -0
  56. package/migrations/meta/0002_snapshot.json +987 -0
  57. package/migrations/meta/_journal.json +7 -0
  58. package/package.json +6 -6
  59. package/dist/detail-GA6NXWQJ.js +0 -43
@@ -4,7 +4,7 @@ import {
4
4
  juniorDestinations,
5
5
  juniorIdentities,
6
6
  juniorUsers
7
- } from "./chunk-35BNLDOJ.js";
7
+ } from "./chunk-OGHXZ4KQ.js";
8
8
 
9
9
  // src/api/people/shared.ts
10
10
  import { and, asc, desc, eq, sql } from "drizzle-orm";
@@ -12,7 +12,6 @@ var PRIVATE_CONVERSATION_LABEL = "Private Conversation";
12
12
  var SAMPLE_LIMIT = 5e3;
13
13
  var RECENT_LIMIT = 25;
14
14
  var ACTIVITY_DAYS = 366;
15
- var HUNG_PROGRESS_MS = 5 * 60 * 1e3;
16
15
  function normalizeEmail(email) {
17
16
  const normalized = email?.trim().toLowerCase();
18
17
  return normalized || void 0;
@@ -39,17 +38,13 @@ function surfaceFromRow(row) {
39
38
  if (row.conversationId.startsWith("api:")) return "api";
40
39
  return "internal";
41
40
  }
42
- function statusFromRow(row, nowMs) {
41
+ function statusFromRow(row) {
43
42
  if (row.executionStatus === "failed") {
44
43
  return "failed";
45
44
  }
46
45
  if (row.executionStatus === "idle") {
47
46
  return "completed";
48
47
  }
49
- const updatedAtMs = (row.executionUpdatedAt ?? row.updatedAt).getTime();
50
- if (row.executionStatus === "running" && nowMs - updatedAtMs > HUNG_PROGRESS_MS) {
51
- return "hung";
52
- }
53
48
  return "active";
54
49
  }
55
50
  function surfaceLabel(surface) {
@@ -89,7 +84,7 @@ function titleFromRow(row, surface) {
89
84
  channelName: row.channelName ?? void 0
90
85
  }) ?? surfaceLabel(surface);
91
86
  }
92
- function summaryFromRow(row, nowMs) {
87
+ function summaryFromRow(row) {
93
88
  const surface = surfaceFromRow(row);
94
89
  const channel = channelFromConversationId(row.conversationId);
95
90
  const channelName = channelNameFromRow(row);
@@ -103,7 +98,7 @@ function summaryFromRow(row, nowMs) {
103
98
  ).toISOString(),
104
99
  lastSeenAt: row.lastActivityAt.toISOString(),
105
100
  startedAt: row.createdAt.toISOString(),
106
- status: statusFromRow(row, nowMs),
101
+ status: statusFromRow(row),
107
102
  surface,
108
103
  actorIdentity: {
109
104
  email: row.email,
@@ -134,8 +129,7 @@ function emptyTotals() {
134
129
  activeDays: 0,
135
130
  conversations: 0,
136
131
  durationMs: 0,
137
- failed: 0,
138
- hung: 0
132
+ failed: 0
139
133
  };
140
134
  }
141
135
  function emptyStatsItem(label) {
@@ -144,7 +138,6 @@ function emptyStatsItem(label) {
144
138
  conversations: 0,
145
139
  durationMs: 0,
146
140
  failed: 0,
147
- hung: 0,
148
141
  label
149
142
  };
150
143
  }
@@ -154,21 +147,18 @@ function emptyActivityDay(date) {
154
147
  conversations: 0,
155
148
  date,
156
149
  durationMs: 0,
157
- failed: 0,
158
- hung: 0
150
+ failed: 0
159
151
  };
160
152
  }
161
153
  function signals(summary) {
162
154
  return {
163
155
  active: summary.status === "active",
164
- failed: summary.status === "failed",
165
- hung: summary.status === "hung"
156
+ failed: summary.status === "failed"
166
157
  };
167
158
  }
168
159
  function addSignals(target, value) {
169
160
  target.active += value.active ? 1 : 0;
170
161
  target.failed += value.failed ? 1 : 0;
171
- target.hung += value.hung ? 1 : 0;
172
162
  }
173
163
  function identityWithEmail(actor) {
174
164
  const email = normalizeEmail(actor?.email);
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  ensureLegacyConversationImport
3
- } from "./chunk-3F4OPKGF.js";
3
+ } from "./chunk-IO65E4ZD.js";
4
4
  import {
5
5
  contextProvenance,
6
6
  getAgentStepStore
7
- } from "./chunk-35BNLDOJ.js";
7
+ } from "./chunk-OGHXZ4KQ.js";
8
8
 
9
9
  // src/chat/conversations/projection.ts
10
10
  import { isDeepStrictEqual } from "util";
@@ -9,11 +9,13 @@ import {
9
9
  getPersistedThreadState,
10
10
  markTurnCompleted,
11
11
  mergeArtifactsState
12
- } from "./chunk-WGXMTFNU.js";
12
+ } from "./chunk-WJ7STXT6.js";
13
+ import {
14
+ coerceThreadConversationState
15
+ } from "./chunk-6DTVCPLO.js";
13
16
  import {
14
- coerceThreadConversationState,
15
17
  getAgentTurnSessionRecord
16
- } from "./chunk-WJOSZOON.js";
18
+ } from "./chunk-OL6XQ23W.js";
17
19
  import {
18
20
  generateConversationId,
19
21
  hydrateConversationMessages,
@@ -21,19 +23,19 @@ import {
21
23
  normalizeConversationText,
22
24
  updateConversationStats,
23
25
  upsertConversationMessage
24
- } from "./chunk-3F4OPKGF.js";
26
+ } from "./chunk-IO65E4ZD.js";
25
27
  import {
26
28
  createPluginEmbedder,
27
29
  createPluginModel,
28
30
  getPlugins
29
- } from "./chunk-5HLDPVYS.js";
31
+ } from "./chunk-FTTFV6DC.js";
30
32
  import {
31
33
  createPluginLogger,
32
34
  createPluginState
33
35
  } from "./chunk-EOWXRY5E.js";
34
36
  import {
35
37
  getDb
36
- } from "./chunk-35BNLDOJ.js";
38
+ } from "./chunk-OGHXZ4KQ.js";
37
39
  import {
38
40
  GEN_AI_PROVIDER_NAME,
39
41
  botConfig,
@@ -7,8 +7,7 @@ import { z } from "zod";
7
7
  var conversationReportStatusSchema = z.enum([
8
8
  "active",
9
9
  "completed",
10
- "failed",
11
- "hung"
10
+ "failed"
12
11
  ]);
13
12
  var conversationSurfaceSchema = z.enum([
14
13
  "api",
@@ -119,8 +118,28 @@ var conversationActivityReportSchema = z.discriminatedUnion("type", [
119
118
  conversationToolActivityReportSchema,
120
119
  conversationSubagentActivityReportSchema
121
120
  ]);
121
+ var conversationContextEventSchema = z.discriminatedUnion("type", [
122
+ z.object({
123
+ type: z.literal("context_compacted"),
124
+ createdAt: z.string(),
125
+ modelId: z.string().optional(),
126
+ summary: z.string().optional(),
127
+ transcriptIndex: z.number().int().nonnegative()
128
+ }).strict(),
129
+ z.object({
130
+ type: z.literal("model_handoff"),
131
+ createdAt: z.string(),
132
+ fromModelId: z.string().optional(),
133
+ summary: z.string().optional(),
134
+ toModelId: z.string(),
135
+ transcriptIndex: z.number().int().nonnegative()
136
+ }).strict()
137
+ ]);
122
138
  var conversationDetailReportSchema = conversationSummaryReportSchema.extend({
123
139
  activity: z.array(conversationActivityReportSchema).optional(),
140
+ modelId: z.string().optional(),
141
+ reasoningLevel: z.string().optional(),
142
+ contextEvents: z.array(conversationContextEventSchema).optional(),
124
143
  transcriptAvailable: z.boolean(),
125
144
  transcriptMetadata: z.array(transcriptMessageSchema).optional(),
126
145
  transcriptMessageCount: z.number().optional(),
@@ -164,7 +183,6 @@ var conversationStatsItemSchema = z.object({
164
183
  conversations: z.number(),
165
184
  durationMs: z.number(),
166
185
  failed: z.number(),
167
- hung: z.number(),
168
186
  label: z.string(),
169
187
  costUsd: z.number().optional(),
170
188
  tokens: z.number().optional()
@@ -175,7 +193,6 @@ var conversationStatsReportSchema = z.object({
175
193
  durationMs: z.number(),
176
194
  failed: z.number(),
177
195
  generatedAt: z.string(),
178
- hung: z.number(),
179
196
  locations: z.array(conversationStatsItemSchema),
180
197
  actors: z.array(conversationStatsItemSchema),
181
198
  sampleLimit: z.number(),
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-EOWXRY5E.js";
11
11
  import {
12
12
  getDb
13
- } from "./chunk-35BNLDOJ.js";
13
+ } from "./chunk-OGHXZ4KQ.js";
14
14
  import {
15
15
  SANDBOX_WORKSPACE_ROOT
16
16
  } from "./chunk-G3E7SCME.js";
@@ -11,7 +11,7 @@ import {
11
11
  legacyActorProvenance,
12
12
  piMessageSchema,
13
13
  readSessionLogEntries
14
- } from "./chunk-35BNLDOJ.js";
14
+ } from "./chunk-OGHXZ4KQ.js";
15
15
  import {
16
16
  botConfig,
17
17
  escapeXml,
@@ -464,7 +464,7 @@ async function hydrateConversationMessages(args) {
464
464
  args.conversation.messages = [];
465
465
  return;
466
466
  }
467
- const { ensureLegacyConversationImport: ensureLegacyConversationImport2 } = await import("./legacy-import-3NQJVGQL.js");
467
+ const { ensureLegacyConversationImport: ensureLegacyConversationImport2 } = await import("./legacy-import-6WWXMALY.js");
468
468
  await ensureLegacyConversationImport2({ conversationId: args.conversationId });
469
469
  await hydrateConversationCompactions({
470
470
  conversation: args.conversation,
@@ -7,14 +7,14 @@ import {
7
7
  juniorConversations,
8
8
  juniorDestinations,
9
9
  juniorIdentities
10
- } from "./chunk-35BNLDOJ.js";
10
+ } from "./chunk-OGHXZ4KQ.js";
11
11
  import {
12
12
  parseSlackThreadId,
13
13
  resolveConversationPrivacy
14
14
  } from "./chunk-LVA4I4H7.js";
15
15
 
16
16
  // src/api/conversations/list.query.ts
17
- import { asc, desc, eq, isNull } from "drizzle-orm";
17
+ import { and, asc, desc, eq, isNull } from "drizzle-orm";
18
18
 
19
19
  // src/api/conversations/shared.ts
20
20
  function slackStatsLocationLabel(input) {
@@ -40,7 +40,6 @@ function surfaceFallbackLabel(surface) {
40
40
  }
41
41
 
42
42
  // src/api/conversations/projection.ts
43
- var HUNG_TURN_PROGRESS_MS = 5 * 60 * 1e3;
44
43
  var PRIVATE_CONVERSATION_LABEL = "Private Conversation";
45
44
  function privateConversationLabel(slackConversation) {
46
45
  if (!slackConversation) {
@@ -70,17 +69,13 @@ function actorIdentityReport(actor) {
70
69
  };
71
70
  return Object.keys(identity).length > 0 ? identity : void 0;
72
71
  }
73
- function statusFromConversation(conversation, nowMs) {
72
+ function statusFromConversation(conversation) {
74
73
  if (conversation.execution.status === "idle") {
75
74
  return "completed";
76
75
  }
77
76
  if (conversation.execution.status === "failed") {
78
77
  return "failed";
79
78
  }
80
- const updatedAtMs = conversation.execution.updatedAtMs ?? conversation.updatedAtMs;
81
- if (conversation.execution.status === "running" && nowMs - updatedAtMs > HUNG_TURN_PROGRESS_MS) {
82
- return "hung";
83
- }
84
79
  return "active";
85
80
  }
86
81
  function titleFromConversation(args) {
@@ -129,7 +124,7 @@ function channelNameRedactedFromConversation(conversation) {
129
124
  }) !== "public";
130
125
  }
131
126
  function conversationSummaryFromStoredConversation(args) {
132
- const { conversation, durationMs, nowMs, usage } = args;
127
+ const { conversation, durationMs, usage } = args;
133
128
  const surface = surfaceFromSource(
134
129
  conversation.source,
135
130
  conversation.conversationId
@@ -147,7 +142,7 @@ function conversationSummaryFromStoredConversation(args) {
147
142
  ).toISOString(),
148
143
  lastSeenAt: new Date(conversation.lastActivityAtMs).toISOString(),
149
144
  startedAt: new Date(conversation.createdAtMs).toISOString(),
150
- status: statusFromConversation(conversation, nowMs),
145
+ status: statusFromConversation(conversation),
151
146
  surface,
152
147
  ...usage ? { cumulativeUsage: usage } : {},
153
148
  ...actorIdentity ? { actorIdentity } : {},
@@ -159,7 +154,7 @@ function conversationSummaryFromStoredConversation(args) {
159
154
 
160
155
  // src/api/conversations/list.query.ts
161
156
  var CONVERSATION_FEED_LIMIT = 50;
162
- async function conversationRows(db, limit) {
157
+ async function conversationRows(db, limit, actorEmail) {
163
158
  return db.select({
164
159
  conversation: juniorConversations,
165
160
  destinationVisibility: juniorDestinations.visibility,
@@ -175,7 +170,15 @@ async function conversationRows(db, limit) {
175
170
  ).leftJoin(
176
171
  juniorIdentities,
177
172
  eq(juniorIdentities.id, juniorConversations.actorIdentityId)
178
- ).where(isNull(juniorConversations.parentConversationId)).orderBy(
173
+ ).where(
174
+ and(
175
+ isNull(juniorConversations.parentConversationId),
176
+ actorEmail ? and(
177
+ eq(juniorIdentities.emailNormalized, actorEmail),
178
+ eq(juniorIdentities.emailVerified, true)
179
+ ) : void 0
180
+ )
181
+ ).orderBy(
179
182
  desc(juniorConversations.lastActivityAt),
180
183
  asc(juniorConversations.conversationId)
181
184
  ).limit(limit);
@@ -236,15 +239,18 @@ async function readConversationRecordFromSql(conversationId) {
236
239
  usage: row.conversation.usage
237
240
  } : void 0;
238
241
  }
239
- async function readConversationFeedFromSql(limit = CONVERSATION_FEED_LIMIT) {
242
+ async function readConversationFeedFromSql(options = {}) {
240
243
  const nowMs = Date.now();
241
- const rows = await conversationRows(getDb(), limit);
244
+ const rows = await conversationRows(
245
+ getDb(),
246
+ options.limit ?? CONVERSATION_FEED_LIMIT,
247
+ options.actorEmail
248
+ );
242
249
  return {
243
250
  conversations: rows.map(
244
251
  (row) => conversationSummaryFromStoredConversation({
245
252
  conversation: conversationFromRow(row),
246
253
  durationMs: row.conversation.durationMs,
247
- nowMs,
248
254
  usage: row.conversation.usage ?? void 0
249
255
  })
250
256
  ),
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  JUNIOR_THREAD_STATE_TTL_MS
3
- } from "./chunk-WJOSZOON.js";
3
+ } from "./chunk-6DTVCPLO.js";
4
4
  import {
5
5
  getChatConfig,
6
6
  getDefaultRedisStateAdapterFor,