@sentry/junior 0.102.3 → 0.104.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 (86) hide show
  1. package/dist/{agent-hooks-I4I2DHSW.js → agent-hooks-EOFSY2PD.js} +5 -5
  2. package/dist/api/conversations/archive.d.ts +7 -0
  3. package/dist/api/conversations/detail.d.ts +7 -0
  4. package/dist/api/conversations/list.d.ts +109 -0
  5. package/dist/api/conversations/routes.d.ts +3 -0
  6. package/dist/api/conversations/schema.d.ts +88 -69
  7. package/dist/api/conversations/stats.d.ts +7 -0
  8. package/dist/api/conversations/subagent.d.ts +7 -0
  9. package/dist/api/http.d.ts +5 -0
  10. package/dist/api/locations/detail.d.ts +10 -2
  11. package/dist/api/locations/list.d.ts +7 -0
  12. package/dist/api/locations/routes.d.ts +3 -0
  13. package/dist/api/locations/schema.d.ts +4 -3
  14. package/dist/api/people/list.d.ts +7 -0
  15. package/dist/api/people/profile.d.ts +7 -0
  16. package/dist/api/people/routes.d.ts +3 -0
  17. package/dist/api/people/schema.d.ts +35 -33
  18. package/dist/api/people/shared.d.ts +4 -4
  19. package/dist/api/route.d.ts +7 -0
  20. package/dist/api/schema.js +11 -17
  21. package/dist/api.js +2184 -88
  22. package/dist/app.js +120 -162
  23. package/dist/chat/conversations/history.d.ts +6 -6
  24. package/dist/chat/conversations/store.d.ts +1 -0
  25. package/dist/chat/pi/messages.d.ts +2 -2
  26. package/dist/chat/plugins/agent-hooks.d.ts +2 -2
  27. package/dist/chat/resource-events/store.d.ts +2 -2
  28. package/dist/chat/sandbox/runtime-dependencies.d.ts +2 -0
  29. package/dist/chat/sandbox/sandbox.d.ts +1 -0
  30. package/dist/chat/services/provider-retry.d.ts +1 -2
  31. package/dist/chat/slack/tools/conversation-search.d.ts +2 -2
  32. package/dist/chat/state/session-log.d.ts +2 -2
  33. package/dist/chat/task-execution/store.d.ts +2 -2
  34. package/dist/chat/tools/search-tools.d.ts +2 -2
  35. package/dist/{chunk-ZSHL44IQ.js → chunk-4PDVOHXP.js} +1 -1
  36. package/dist/{chunk-3OABPOHR.js → chunk-7G4J3CR7.js} +11 -2
  37. package/dist/chunk-AIRE7Q2W.js +362 -0
  38. package/dist/{chunk-QZGVPPIJ.js → chunk-BCULHGZK.js} +24 -4
  39. package/dist/{chunk-IQ36I3DF.js → chunk-CCTCIISK.js} +1 -1
  40. package/dist/{chunk-SHBPSE7A.js → chunk-M3UAVLEN.js} +2 -3
  41. package/dist/{chunk-EMUZSROX.js → chunk-O7ILGCMJ.js} +78 -1
  42. package/dist/{chunk-EOB77KME.js → chunk-QDKRE3LS.js} +340 -9
  43. package/dist/{chunk-DTUSCR2Y.js → chunk-QVTVCJR4.js} +7 -7
  44. package/dist/{chunk-5K4N73TP.js → chunk-RMZ65YAA.js} +3 -3
  45. package/dist/{chunk-VSAFV2GI.js → chunk-RYDF4GOX.js} +3 -3
  46. package/dist/{chunk-ZIX4PNBI.js → chunk-TMWUGGSA.js} +37 -35
  47. package/dist/{chunk-3UK5DFKW.js → chunk-U26ZWZCN.js} +1 -1
  48. package/dist/{chunk-X2IPNCB5.js → chunk-VDHMFCDY.js} +65 -12
  49. package/dist/cli/chat.js +13 -14
  50. package/dist/cli/plugins.js +6 -6
  51. package/dist/cli/snapshot-warmup.js +7 -3
  52. package/dist/cli/upgrade.js +6 -7
  53. package/dist/db/schema/conversations.d.ts +17 -0
  54. package/dist/db/schema.d.ts +17 -0
  55. package/dist/{db-6QP6HY7U.js → db-PDMC67T3.js} +2 -2
  56. package/dist/{legacy-import-R3BMM2GH.js → legacy-import-G333RHJZ.js} +3 -3
  57. package/dist/reporting-schema.d.ts +4 -4
  58. package/dist/{runner-C2ZTIOUD.js → runner-6A7MQRUE.js} +9 -10
  59. package/migrations/0004_useful_magus.sql +1 -0
  60. package/migrations/meta/0004_snapshot.json +1041 -0
  61. package/migrations/meta/_journal.json +7 -0
  62. package/package.json +6 -6
  63. package/dist/api/conversations/list.query.d.ts +0 -103
  64. package/dist/chunk-2RNOB32R.js +0 -17
  65. package/dist/chunk-4XNQSJAX.js +0 -331
  66. package/dist/chunk-4YN2ZXKB.js +0 -66
  67. package/dist/chunk-B5QS4AVO.js +0 -319
  68. package/dist/chunk-F4CQEUTP.js +0 -77
  69. package/dist/chunk-HYDQULR2.js +0 -214
  70. package/dist/chunk-KFP3TZOS.js +0 -102
  71. package/dist/chunk-LJB2TLVT.js +0 -273
  72. package/dist/chunk-LVUKF5CE.js +0 -63
  73. package/dist/chunk-NSP6OGL2.js +0 -671
  74. package/dist/chunk-QNVHH5PU.js +0 -20
  75. package/dist/chunk-QOZOJNSE.js +0 -96
  76. package/dist/chunk-WPHCUGN7.js +0 -84
  77. package/dist/detail-OEIVZYXS.js +0 -68
  78. package/dist/detail-V37NTVBN.js +0 -29
  79. package/dist/list-AJ6RWBOG.js +0 -30
  80. package/dist/list-FWLIZHSW.js +0 -30
  81. package/dist/list-NTUT6A5M.js +0 -121
  82. package/dist/plugin-conversations-F3IBVNFX.js +0 -37
  83. package/dist/profile-3FRQP4HP.js +0 -212
  84. package/dist/reporting/plugin-conversations.d.ts +0 -3
  85. package/dist/stats-7UFY6FPE.js +0 -174
  86. package/dist/subagent-X3ZWJHR4.js +0 -49
@@ -1,319 +0,0 @@
1
- import {
2
- ensureLegacyConversationImport
3
- } from "./chunk-VSAFV2GI.js";
4
- import {
5
- contextProvenance,
6
- getAgentStepStore
7
- } from "./chunk-QZGVPPIJ.js";
8
-
9
- // src/chat/conversations/projection.ts
10
- import { isDeepStrictEqual } from "util";
11
- function authorizationObservationMessage(entry, createdAtMs) {
12
- const label = entry.kind === "mcp" ? "MCP authorization" : "Authorization";
13
- return {
14
- role: "user",
15
- content: [
16
- {
17
- type: "text",
18
- text: `${label} completed for provider "${entry.provider}". Continue the blocked request and retry the provider operation if needed.`
19
- }
20
- ],
21
- timestamp: createdAtMs
22
- };
23
- }
24
- function piEntryProvenance(entry) {
25
- return entry.provenance ?? contextProvenance;
26
- }
27
- function projectSteps(steps, opts) {
28
- const messages = [];
29
- const provenance = [];
30
- const seqs = [];
31
- let modelProfile = "standard";
32
- let modelId;
33
- for (const step of steps) {
34
- if (opts?.maxSeq !== void 0 && step.seq > opts.maxSeq) {
35
- break;
36
- }
37
- if (step.entry.type === "context_epoch_started") {
38
- modelProfile = step.entry.modelProfile ?? "standard";
39
- modelId = step.entry.modelId;
40
- continue;
41
- }
42
- if (step.entry.type === "pi_message") {
43
- messages.push(step.entry.message);
44
- provenance.push(piEntryProvenance(step.entry));
45
- seqs.push(step.seq);
46
- continue;
47
- }
48
- if (step.entry.type === "authorization_completed") {
49
- messages.push(
50
- authorizationObservationMessage(step.entry, step.createdAtMs)
51
- );
52
- provenance.push(contextProvenance);
53
- seqs.push(step.seq);
54
- }
55
- }
56
- return { messages, provenance, seqs, modelProfile, modelId };
57
- }
58
- function connectedMcpProvidersFromSteps(steps) {
59
- const providers = /* @__PURE__ */ new Set();
60
- for (const step of steps) {
61
- if (step.entry.type === "mcp_provider_connected") {
62
- providers.add(step.entry.provider);
63
- }
64
- }
65
- return [...providers].sort((left, right) => left.localeCompare(right));
66
- }
67
- function isUserMessage(message) {
68
- return message.role === "user";
69
- }
70
- function countMatchingPrefix(left, right) {
71
- const limit = Math.min(left.length, right.length);
72
- for (let index = 0; index < limit; index += 1) {
73
- if (!isDeepStrictEqual(left[index], right[index])) {
74
- return index;
75
- }
76
- }
77
- return limit;
78
- }
79
- function resolveCommitProvenance(args) {
80
- if (args.explicitProvenance) {
81
- if (args.explicitProvenance.length !== args.nextMessages.length) {
82
- throw new Error("commit provenance must align one-to-one with messages");
83
- }
84
- return args.explicitProvenance;
85
- }
86
- const matchingPrefix = args.matchingPrefix;
87
- const provenance = args.nextMessages.map(
88
- (_, index) => index < matchingPrefix ? args.existing.provenance[index] ?? contextProvenance : contextProvenance
89
- );
90
- if (args.newMessageProvenance) {
91
- for (let index = args.nextMessages.length - 1; index >= matchingPrefix; index -= 1) {
92
- if (isUserMessage(args.nextMessages[index])) {
93
- provenance[index] = args.newMessageProvenance;
94
- break;
95
- }
96
- }
97
- }
98
- if (args.trailingMessageProvenance) {
99
- if (args.trailingMessageProvenance.length > provenance.length) {
100
- throw new Error(
101
- "trailing commit provenance cannot exceed committed messages"
102
- );
103
- }
104
- const newMessageCount = args.nextMessages.length - matchingPrefix;
105
- if (args.trailingMessageProvenance.length > newMessageCount) {
106
- throw new Error(
107
- "trailing commit provenance must align to newly committed messages"
108
- );
109
- }
110
- const start = provenance.length - args.trailingMessageProvenance.length;
111
- args.trailingMessageProvenance.forEach((entry, offset) => {
112
- provenance[start + offset] = entry;
113
- });
114
- }
115
- return provenance;
116
- }
117
- async function importLegacyIfNeeded(args) {
118
- await ensureLegacyConversationImport({ conversationId: args.conversationId });
119
- }
120
- async function loadProjection(args) {
121
- await importLegacyIfNeeded(args);
122
- const steps = await getAgentStepStore().loadCurrentEpoch(args.conversationId);
123
- return projectSteps(steps).messages;
124
- }
125
- async function loadConversationProjection(args) {
126
- await importLegacyIfNeeded(args);
127
- const steps = await getAgentStepStore().loadCurrentEpoch(args.conversationId);
128
- const { messages, provenance, modelProfile, modelId } = projectSteps(steps);
129
- return { messages, provenance, modelProfile, modelId };
130
- }
131
- async function openConversationProjection(args) {
132
- await importLegacyIfNeeded(args);
133
- const stepStore = getAgentStepStore();
134
- const steps = await stepStore.loadCurrentEpoch(args.conversationId);
135
- const projection = projectSteps(steps);
136
- if (steps.some(
137
- (step) => step.entry.type === "context_epoch_started" || step.entry.type === "pi_message"
138
- )) {
139
- return projection;
140
- }
141
- await stepStore.startEpoch(args.conversationId, {
142
- reason: "initial",
143
- modelProfile: "standard",
144
- modelId: args.modelId,
145
- messages: []
146
- });
147
- return {
148
- messages: projection.messages,
149
- provenance: projection.provenance,
150
- modelProfile: "standard",
151
- modelId: args.modelId
152
- };
153
- }
154
- async function loadTurnProjection(args) {
155
- await importLegacyIfNeeded(args);
156
- const stepStore = getAgentStepStore();
157
- if (args.committedSeq < 0) {
158
- return projectSteps(await stepStore.loadCurrentEpoch(args.conversationId));
159
- }
160
- const history = await stepStore.loadHistory(args.conversationId);
161
- const committedStep = history.find((step) => step.seq === args.committedSeq);
162
- if (!committedStep) {
163
- return void 0;
164
- }
165
- const epochSteps = history.filter(
166
- (step) => step.contextEpoch === committedStep.contextEpoch
167
- );
168
- return args.includeTail ? projectSteps(epochSteps) : projectSteps(epochSteps, { maxSeq: args.committedSeq });
169
- }
170
- async function loadConnectedMcpProviders(args) {
171
- await importLegacyIfNeeded(args);
172
- const steps = await getAgentStepStore().loadCurrentEpoch(args.conversationId);
173
- return connectedMcpProvidersFromSteps(steps);
174
- }
175
- function messageTimestamp(message) {
176
- const timestamp = message.timestamp;
177
- return typeof timestamp === "number" ? timestamp : Date.now();
178
- }
179
- async function commitMessages(args) {
180
- const stepStore = getAgentStepStore();
181
- const currentSteps = await stepStore.loadCurrentEpoch(args.conversationId);
182
- const existing = projectSteps(currentSteps);
183
- const matchingPrefix = countMatchingPrefix(existing.messages, args.messages);
184
- const nextProvenance = resolveCommitProvenance({
185
- existing,
186
- nextMessages: args.messages,
187
- matchingPrefix,
188
- ...args.provenance ? { explicitProvenance: args.provenance } : {},
189
- ...args.trailingMessageProvenance ? { trailingMessageProvenance: args.trailingMessageProvenance } : {},
190
- ...args.newMessageProvenance ? { newMessageProvenance: args.newMessageProvenance } : {}
191
- });
192
- if (currentSteps.length === 0) {
193
- await stepStore.startEpoch(args.conversationId, {
194
- reason: "initial",
195
- modelProfile: "standard",
196
- modelId: args.modelId,
197
- messages: args.messages.map((message, index) => ({
198
- message,
199
- createdAtMs: messageTimestamp(message),
200
- provenance: nextProvenance[index]
201
- }))
202
- });
203
- } else if (matchingPrefix === existing.messages.length) {
204
- const newMessages = args.messages.slice(matchingPrefix);
205
- await stepStore.append(
206
- args.conversationId,
207
- newMessages.map((message, index) => ({
208
- entry: {
209
- type: "pi_message",
210
- message,
211
- provenance: nextProvenance[matchingPrefix + index]
212
- },
213
- createdAtMs: messageTimestamp(message)
214
- }))
215
- );
216
- } else {
217
- await stepStore.startEpoch(args.conversationId, {
218
- reason: "rollback",
219
- modelProfile: existing.modelProfile,
220
- modelId: args.modelId,
221
- messages: args.messages.map((message, index) => ({
222
- message,
223
- createdAtMs: messageTimestamp(message),
224
- provenance: nextProvenance[index]
225
- }))
226
- });
227
- }
228
- const committed = projectSteps(
229
- await stepStore.loadCurrentEpoch(args.conversationId)
230
- );
231
- return {
232
- committedSeq: committed.seqs.at(-1) ?? -1,
233
- messageSeqs: committed.seqs,
234
- provenance: nextProvenance
235
- };
236
- }
237
- async function recordMcpProviderConnected(args) {
238
- const stepStore = getAgentStepStore();
239
- const steps = await stepStore.loadCurrentEpoch(args.conversationId);
240
- if (connectedMcpProvidersFromSteps(steps).includes(args.provider)) {
241
- return;
242
- }
243
- await stepStore.append(args.conversationId, [
244
- {
245
- entry: { type: "mcp_provider_connected", provider: args.provider },
246
- createdAtMs: Date.now()
247
- }
248
- ]);
249
- }
250
- async function recordAuthorizationRequested(args) {
251
- const stepStore = getAgentStepStore();
252
- const steps = await stepStore.loadCurrentEpoch(args.conversationId);
253
- if (steps.some(
254
- (step) => step.entry.type === "authorization_requested" && step.entry.authorizationId === args.authorizationId
255
- )) {
256
- return;
257
- }
258
- await stepStore.append(args.conversationId, [
259
- {
260
- entry: {
261
- type: "authorization_requested",
262
- kind: args.kind,
263
- provider: args.provider,
264
- actorId: args.actorId,
265
- authorizationId: args.authorizationId,
266
- delivery: args.delivery
267
- },
268
- createdAtMs: Date.now()
269
- }
270
- ]);
271
- }
272
- async function recordAuthorizationCompleted(args) {
273
- const stepStore = getAgentStepStore();
274
- const steps = await stepStore.loadCurrentEpoch(args.conversationId);
275
- if (steps.some(
276
- (step) => step.entry.type === "authorization_completed" && step.entry.authorizationId === args.authorizationId
277
- )) {
278
- return;
279
- }
280
- await stepStore.append(args.conversationId, [
281
- {
282
- entry: {
283
- type: "authorization_completed",
284
- kind: args.kind,
285
- provider: args.provider,
286
- actorId: args.actorId,
287
- authorizationId: args.authorizationId
288
- },
289
- createdAtMs: Date.now()
290
- }
291
- ]);
292
- }
293
- async function recordToolExecutionStarted(args) {
294
- await getAgentStepStore().append(args.conversationId, [
295
- {
296
- entry: {
297
- type: "tool_execution_started",
298
- toolCallId: args.toolCallId,
299
- toolName: args.toolName,
300
- ...args.args !== void 0 ? { args: args.args } : {}
301
- },
302
- createdAtMs: args.createdAtMs ?? Date.now()
303
- }
304
- ]);
305
- }
306
-
307
- export {
308
- projectSteps,
309
- loadProjection,
310
- loadConversationProjection,
311
- openConversationProjection,
312
- loadTurnProjection,
313
- loadConnectedMcpProviders,
314
- commitMessages,
315
- recordMcpProviderConnected,
316
- recordAuthorizationRequested,
317
- recordAuthorizationCompleted,
318
- recordToolExecutionStarted
319
- };
@@ -1,77 +0,0 @@
1
- import {
2
- juniorConversations
3
- } from "./chunk-QZGVPPIJ.js";
4
-
5
- // src/api/conversations/aggregate.ts
6
- import { sql } from "drizzle-orm";
7
- function tokenValue() {
8
- return sql`
9
- CASE
10
- WHEN ${juniorConversations.usage}->>'totalTokens' IS NOT NULL
11
- THEN (${juniorConversations.usage}->>'totalTokens')::double precision
12
- WHEN COALESCE(
13
- ${juniorConversations.usage}->>'inputTokens',
14
- ${juniorConversations.usage}->>'outputTokens',
15
- ${juniorConversations.usage}->>'cachedInputTokens',
16
- ${juniorConversations.usage}->>'cacheCreationTokens'
17
- ) IS NOT NULL
18
- THEN COALESCE((${juniorConversations.usage}->>'inputTokens')::double precision, 0)
19
- + COALESCE((${juniorConversations.usage}->>'outputTokens')::double precision, 0)
20
- + COALESCE((${juniorConversations.usage}->>'cachedInputTokens')::double precision, 0)
21
- + COALESCE((${juniorConversations.usage}->>'cacheCreationTokens')::double precision, 0)
22
- ELSE NULL
23
- END
24
- `;
25
- }
26
- function costValue() {
27
- return sql`
28
- CASE
29
- WHEN ${juniorConversations.usage}->'cost'->>'total' IS NOT NULL
30
- THEN (${juniorConversations.usage}->'cost'->>'total')::double precision
31
- WHEN COALESCE(
32
- ${juniorConversations.usage}->'cost'->>'input',
33
- ${juniorConversations.usage}->'cost'->>'output',
34
- ${juniorConversations.usage}->'cost'->>'cacheRead',
35
- ${juniorConversations.usage}->'cost'->>'cacheWrite'
36
- ) IS NOT NULL
37
- THEN COALESCE((${juniorConversations.usage}->'cost'->>'input')::double precision, 0)
38
- + COALESCE((${juniorConversations.usage}->'cost'->>'output')::double precision, 0)
39
- + COALESCE((${juniorConversations.usage}->'cost'->>'cacheRead')::double precision, 0)
40
- + COALESCE((${juniorConversations.usage}->'cost'->>'cacheWrite')::double precision, 0)
41
- ELSE NULL
42
- END
43
- `;
44
- }
45
- function conversationAggregateColumns() {
46
- return {
47
- active: sql`COUNT(*) FILTER (
48
- WHERE ${juniorConversations.executionStatus} NOT IN ('idle', 'failed')
49
- )::integer`,
50
- conversations: sql`COUNT(*)::integer`,
51
- costUsd: sql`SUM(${costValue()})::double precision`,
52
- durationMs: sql`COALESCE(SUM(${juniorConversations.durationMs}), 0)::double precision`,
53
- failed: sql`COUNT(*) FILTER (
54
- WHERE ${juniorConversations.executionStatus} = 'failed'
55
- )::integer`,
56
- tokens: sql`SUM(${tokenValue()})::double precision`
57
- };
58
- }
59
- function conversationRangeColumns() {
60
- return {
61
- firstSeenAt: sql`MIN(${juniorConversations.createdAt})`.mapWith(
62
- juniorConversations.createdAt
63
- ),
64
- lastSeenAt: sql`MAX(${juniorConversations.lastActivityAt})`.mapWith(
65
- juniorConversations.lastActivityAt
66
- )
67
- };
68
- }
69
- function conversationActiveDaysColumn() {
70
- return sql`COUNT(DISTINCT (${juniorConversations.lastActivityAt} AT TIME ZONE 'UTC')::date)::integer`;
71
- }
72
-
73
- export {
74
- conversationAggregateColumns,
75
- conversationRangeColumns,
76
- conversationActiveDaysColumn
77
- };
@@ -1,214 +0,0 @@
1
- import {
2
- usageSchema
3
- } from "./chunk-PDO5BLNM.js";
4
-
5
- // src/api/conversations/schema.ts
6
- import { z } from "zod";
7
- var conversationReportStatusSchema = z.enum([
8
- "active",
9
- "completed",
10
- "failed"
11
- ]);
12
- var conversationSurfaceSchema = z.enum([
13
- "api",
14
- "internal",
15
- "scheduler",
16
- "slack"
17
- ]);
18
- var conversationUsageSchema = usageSchema;
19
- var actorIdentitySchema = z.object({
20
- email: z.string().optional(),
21
- fullName: z.string().optional(),
22
- slackUserId: z.string().optional(),
23
- slackUserName: z.string().optional()
24
- }).strict();
25
- var conversationSummaryReportSchema = z.object({
26
- displayTitle: z.string(),
27
- cumulativeDurationMs: z.number(),
28
- cumulativeUsage: conversationUsageSchema.optional(),
29
- conversationId: z.string(),
30
- status: conversationReportStatusSchema,
31
- startedAt: z.string(),
32
- lastSeenAt: z.string(),
33
- lastProgressAt: z.string(),
34
- surface: conversationSurfaceSchema,
35
- actorIdentity: actorIdentitySchema.optional(),
36
- channel: z.string().optional(),
37
- channelName: z.string().optional(),
38
- channelNameRedacted: z.boolean().optional(),
39
- locationId: z.string().optional(),
40
- sentryTraceUrl: z.string().optional(),
41
- traceId: z.string().optional()
42
- }).strict();
43
- var transcriptPartTypeSchema = z.enum([
44
- "text",
45
- "thinking",
46
- "tool_call",
47
- "tool_result",
48
- "unknown"
49
- ]);
50
- var transcriptPartSchema = z.object({
51
- bytes: z.number().optional(),
52
- chars: z.number().optional(),
53
- id: z.string().optional(),
54
- input: z.unknown().optional(),
55
- inputKeys: z.array(z.string()).optional(),
56
- inputSizeBytes: z.number().optional(),
57
- inputSizeChars: z.number().optional(),
58
- inputType: z.string().optional(),
59
- name: z.string().optional(),
60
- output: z.unknown().optional(),
61
- outputKeys: z.array(z.string()).optional(),
62
- outputSizeBytes: z.number().optional(),
63
- outputSizeChars: z.number().optional(),
64
- outputType: z.string().optional(),
65
- redacted: z.boolean().optional(),
66
- sourceType: z.string().optional(),
67
- text: z.string().optional(),
68
- type: transcriptPartTypeSchema
69
- }).strict();
70
- var transcriptRoleSchema = z.enum([
71
- "assistant",
72
- "system",
73
- "tool",
74
- "toolResult",
75
- "unknown",
76
- "user"
77
- ]);
78
- var transcriptMessageSchema = z.object({
79
- parts: z.array(transcriptPartSchema),
80
- role: transcriptRoleSchema,
81
- timestamp: z.number().optional()
82
- }).strict();
83
- var conversationActivityStatusSchema = z.enum([
84
- "aborted",
85
- "completed",
86
- "error",
87
- "running",
88
- "success"
89
- ]);
90
- var conversationSubagentActivityReportSchema = z.object({
91
- type: z.literal("subagent"),
92
- createdAt: z.string(),
93
- endedAt: z.string().optional(),
94
- id: z.string(),
95
- modelId: z.string().optional(),
96
- outcome: z.enum(["success", "error", "aborted"]).optional(),
97
- parentToolCallId: z.string().optional(),
98
- reasoningLevel: z.string().optional(),
99
- status: conversationActivityStatusSchema,
100
- subagentKind: z.string(),
101
- transcriptAvailable: z.boolean().optional()
102
- }).strict();
103
- var conversationToolActivityReportSchema = z.object({
104
- type: z.literal("tool_execution"),
105
- args: z.unknown().optional(),
106
- createdAt: z.string(),
107
- id: z.string(),
108
- inputKeys: z.array(z.string()).optional(),
109
- inputSizeBytes: z.number().optional(),
110
- inputSizeChars: z.number().optional(),
111
- inputType: z.string().optional(),
112
- redacted: z.boolean().optional(),
113
- status: conversationActivityStatusSchema,
114
- subagents: z.array(conversationSubagentActivityReportSchema),
115
- toolCallId: z.string(),
116
- toolName: z.string()
117
- }).strict();
118
- var conversationActivityReportSchema = z.discriminatedUnion("type", [
119
- conversationToolActivityReportSchema,
120
- conversationSubagentActivityReportSchema
121
- ]);
122
- var conversationContextEventSchema = z.discriminatedUnion("type", [
123
- z.object({
124
- type: z.literal("context_compacted"),
125
- createdAt: z.string(),
126
- modelId: z.string().optional(),
127
- summary: z.string().optional(),
128
- transcriptIndex: z.number().int().nonnegative()
129
- }).strict(),
130
- z.object({
131
- type: z.literal("model_handoff"),
132
- createdAt: z.string(),
133
- fromModelId: z.string().optional(),
134
- message: z.string().optional(),
135
- toModelId: z.string(),
136
- transcriptIndex: z.number().int().nonnegative()
137
- }).strict()
138
- ]);
139
- var conversationDetailReportSchema = conversationSummaryReportSchema.extend({
140
- activity: z.array(conversationActivityReportSchema).optional(),
141
- modelId: z.string().optional(),
142
- reasoningLevel: z.string().optional(),
143
- contextEvents: z.array(conversationContextEventSchema).optional(),
144
- transcriptAvailable: z.boolean(),
145
- transcriptMetadata: z.array(transcriptMessageSchema).optional(),
146
- transcriptMessageCount: z.number().optional(),
147
- transcriptRedacted: z.boolean().optional(),
148
- transcriptRedactionReason: z.literal("non_public_conversation").optional(),
149
- transcriptExpired: z.boolean().optional(),
150
- transcriptExpiredAt: z.string().optional(),
151
- transcript: z.array(transcriptMessageSchema),
152
- generatedAt: z.string(),
153
- sentryConversationUrl: z.string().optional()
154
- }).strict();
155
- var conversationSubagentTranscriptReportSchema = z.object({
156
- type: z.literal("subagent"),
157
- createdAt: z.string(),
158
- endedAt: z.string().optional(),
159
- id: z.string(),
160
- modelId: z.string().optional(),
161
- outcome: z.enum(["success", "error", "aborted"]).optional(),
162
- parentToolCallId: z.string().optional(),
163
- reasoningLevel: z.string().optional(),
164
- status: conversationActivityStatusSchema,
165
- subagentConversationId: z.string().optional(),
166
- subagentKind: z.string(),
167
- subagentSentryConversationUrl: z.string().optional(),
168
- transcript: z.array(transcriptMessageSchema),
169
- transcriptAvailable: z.boolean(),
170
- transcriptMessageCount: z.number().optional(),
171
- transcriptRedacted: z.boolean().optional(),
172
- transcriptRedactionReason: z.literal("non_public_conversation").optional(),
173
- transcriptExpired: z.boolean().optional(),
174
- transcriptExpiredAt: z.string().optional(),
175
- unavailableReason: z.enum(["missing_transcript_range", "missing_transcript_ref", "not_found"]).optional()
176
- }).strict();
177
- var conversationFeedSchema = z.object({
178
- conversations: z.array(conversationSummaryReportSchema),
179
- source: z.literal("conversation_index"),
180
- generatedAt: z.string()
181
- }).strict();
182
- var conversationStatsItemSchema = z.object({
183
- active: z.number(),
184
- conversations: z.number(),
185
- durationMs: z.number(),
186
- failed: z.number(),
187
- label: z.string(),
188
- costUsd: z.number().optional(),
189
- tokens: z.number().optional()
190
- }).strict();
191
- var conversationStatsReportSchema = z.object({
192
- active: z.number(),
193
- conversations: z.number(),
194
- durationMs: z.number(),
195
- failed: z.number(),
196
- generatedAt: z.string(),
197
- locations: z.array(conversationStatsItemSchema),
198
- actors: z.array(conversationStatsItemSchema),
199
- source: z.literal("conversation_index"),
200
- costUsd: z.number().optional(),
201
- tokens: z.number().optional(),
202
- windowEnd: z.string(),
203
- windowStart: z.string()
204
- }).strict();
205
-
206
- export {
207
- actorIdentitySchema,
208
- conversationSummaryReportSchema,
209
- conversationDetailReportSchema,
210
- conversationSubagentTranscriptReportSchema,
211
- conversationFeedSchema,
212
- conversationStatsItemSchema,
213
- conversationStatsReportSchema
214
- };