@sentry/junior 0.103.0 → 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.
- package/dist/{agent-hooks-NHIXBJW3.js → agent-hooks-EOFSY2PD.js} +3 -3
- package/dist/api/conversations/archive.d.ts +7 -0
- package/dist/api/conversations/detail.d.ts +7 -0
- package/dist/api/conversations/list.d.ts +109 -0
- package/dist/api/conversations/routes.d.ts +3 -0
- package/dist/api/conversations/schema.d.ts +72 -69
- package/dist/api/conversations/stats.d.ts +7 -0
- package/dist/api/conversations/subagent.d.ts +7 -0
- package/dist/api/http.d.ts +5 -0
- package/dist/api/locations/detail.d.ts +10 -2
- package/dist/api/locations/list.d.ts +7 -0
- package/dist/api/locations/routes.d.ts +3 -0
- package/dist/api/locations/schema.d.ts +4 -3
- package/dist/api/people/list.d.ts +7 -0
- package/dist/api/people/profile.d.ts +7 -0
- package/dist/api/people/routes.d.ts +3 -0
- package/dist/api/people/schema.d.ts +35 -33
- package/dist/api/people/shared.d.ts +3 -3
- package/dist/api/route.d.ts +7 -0
- package/dist/api/schema.js +11 -17
- package/dist/api.js +2184 -88
- package/dist/app.js +107 -101
- package/dist/chat/conversations/history.d.ts +6 -6
- package/dist/chat/conversations/store.d.ts +1 -0
- package/dist/chat/pi/messages.d.ts +2 -2
- package/dist/chat/plugins/agent-hooks.d.ts +2 -2
- package/dist/chat/resource-events/store.d.ts +2 -2
- package/dist/chat/slack/tools/conversation-search.d.ts +2 -2
- package/dist/chat/state/session-log.d.ts +2 -2
- package/dist/chat/task-execution/store.d.ts +2 -2
- package/dist/chat/tools/search-tools.d.ts +2 -2
- package/dist/chunk-AIRE7Q2W.js +362 -0
- package/dist/{chunk-HOBDQQJY.js → chunk-BCULHGZK.js} +23 -3
- package/dist/{chunk-DEQZ23O3.js → chunk-O7ILGCMJ.js} +77 -0
- package/dist/{chunk-C4BT2P2K.js → chunk-QDKRE3LS.js} +339 -8
- package/dist/{chunk-GY5ZRYPH.js → chunk-QVTVCJR4.js} +5 -5
- package/dist/{chunk-JXQWOCBE.js → chunk-RMZ65YAA.js} +2 -2
- package/dist/{chunk-E2VS47AZ.js → chunk-RYDF4GOX.js} +2 -2
- package/dist/{chunk-OE453VRG.js → chunk-TMWUGGSA.js} +26 -28
- package/dist/{chunk-JPXLAJUU.js → chunk-VDHMFCDY.js} +9 -10
- package/dist/cli/chat.js +10 -11
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/upgrade.js +3 -4
- package/dist/db/schema/conversations.d.ts +17 -0
- package/dist/db/schema.d.ts +17 -0
- package/dist/{db-I343BSOM.js → db-PDMC67T3.js} +1 -1
- package/dist/{legacy-import-M7VBOQTK.js → legacy-import-G333RHJZ.js} +2 -2
- package/dist/reporting-schema.d.ts +4 -4
- package/dist/{runner-IEE5G4NV.js → runner-6A7MQRUE.js} +7 -8
- package/migrations/0004_useful_magus.sql +1 -0
- package/migrations/meta/0004_snapshot.json +1041 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +6 -6
- package/dist/api/conversations/list.query.d.ts +0 -103
- package/dist/chunk-2RNOB32R.js +0 -17
- package/dist/chunk-6FPTHPXF.js +0 -77
- package/dist/chunk-6LBNXC4F.js +0 -66
- package/dist/chunk-7LLRS2OK.js +0 -215
- package/dist/chunk-B43K4C5K.js +0 -102
- package/dist/chunk-BQCPAIAB.js +0 -319
- package/dist/chunk-FW7DVHTL.js +0 -673
- package/dist/chunk-GCGRQJR5.js +0 -84
- package/dist/chunk-HRDWLE7Q.js +0 -273
- package/dist/chunk-LVUKF5CE.js +0 -63
- package/dist/chunk-QNVHH5PU.js +0 -20
- package/dist/chunk-QOZOJNSE.js +0 -96
- package/dist/chunk-VKFOVMZL.js +0 -331
- package/dist/detail-ENVV4HIY.js +0 -68
- package/dist/detail-UIOKVIET.js +0 -29
- package/dist/list-WR5U6JVM.js +0 -30
- package/dist/list-XZ4HKQ4R.js +0 -121
- package/dist/list-ZOUSMSEH.js +0 -30
- package/dist/plugin-conversations-DTUP4RH6.js +0 -37
- package/dist/profile-UO2N3XXG.js +0 -212
- package/dist/reporting/plugin-conversations.d.ts +0 -3
- package/dist/stats-NZIET4LT.js +0 -174
- package/dist/subagent-DY6XKTJ5.js +0 -49
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import {
|
|
2
|
+
usageSchema
|
|
3
|
+
} from "./chunk-PDO5BLNM.js";
|
|
4
|
+
import {
|
|
5
|
+
juniorDestinationKindSchema
|
|
6
|
+
} from "./chunk-FXFQNHRU.js";
|
|
7
|
+
|
|
8
|
+
// src/api/activity.ts
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
var dailyConversationActivitySchema = z.object({
|
|
11
|
+
active: z.number(),
|
|
12
|
+
conversations: z.number(),
|
|
13
|
+
date: z.string(),
|
|
14
|
+
durationMs: z.number(),
|
|
15
|
+
failed: z.number(),
|
|
16
|
+
tokens: z.number().optional()
|
|
17
|
+
}).strict();
|
|
18
|
+
function emptyActivityDay(date) {
|
|
19
|
+
return {
|
|
20
|
+
active: 0,
|
|
21
|
+
conversations: 0,
|
|
22
|
+
date,
|
|
23
|
+
durationMs: 0,
|
|
24
|
+
failed: 0
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function activityDays(days, nowMs, count) {
|
|
28
|
+
const items = [];
|
|
29
|
+
const end = new Date(nowMs);
|
|
30
|
+
end.setUTCHours(0, 0, 0, 0);
|
|
31
|
+
const start = new Date(end);
|
|
32
|
+
start.setUTCDate(start.getUTCDate() - (count - 1));
|
|
33
|
+
for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setUTCDate(cursor.getUTCDate() + 1)) {
|
|
34
|
+
const date = cursor.toISOString().slice(0, 10);
|
|
35
|
+
items.push(days.get(date) ?? emptyActivityDay(date));
|
|
36
|
+
}
|
|
37
|
+
return items;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// src/api/conversations/schema.ts
|
|
41
|
+
import { z as z2 } from "zod";
|
|
42
|
+
var conversationReportStatusSchema = z2.enum([
|
|
43
|
+
"active",
|
|
44
|
+
"completed",
|
|
45
|
+
"failed"
|
|
46
|
+
]);
|
|
47
|
+
var conversationSurfaceSchema = z2.enum([
|
|
48
|
+
"api",
|
|
49
|
+
"internal",
|
|
50
|
+
"scheduler",
|
|
51
|
+
"slack"
|
|
52
|
+
]);
|
|
53
|
+
var conversationUsageSchema = usageSchema;
|
|
54
|
+
var actorIdentitySchema = z2.object({
|
|
55
|
+
email: z2.string().optional(),
|
|
56
|
+
fullName: z2.string().optional(),
|
|
57
|
+
slackUserId: z2.string().optional(),
|
|
58
|
+
slackUserName: z2.string().optional()
|
|
59
|
+
}).strict();
|
|
60
|
+
var conversationSummaryReportSchema = z2.object({
|
|
61
|
+
displayTitle: z2.string(),
|
|
62
|
+
cumulativeDurationMs: z2.number(),
|
|
63
|
+
cumulativeUsage: conversationUsageSchema.optional(),
|
|
64
|
+
conversationId: z2.string(),
|
|
65
|
+
status: conversationReportStatusSchema,
|
|
66
|
+
startedAt: z2.string(),
|
|
67
|
+
lastSeenAt: z2.string(),
|
|
68
|
+
lastProgressAt: z2.string(),
|
|
69
|
+
surface: conversationSurfaceSchema,
|
|
70
|
+
actorIdentity: actorIdentitySchema.optional(),
|
|
71
|
+
archivedAt: z2.string().optional(),
|
|
72
|
+
channel: z2.string().optional(),
|
|
73
|
+
channelName: z2.string().optional(),
|
|
74
|
+
channelNameRedacted: z2.boolean().optional(),
|
|
75
|
+
locationId: z2.string().optional(),
|
|
76
|
+
sentryTraceUrl: z2.string().optional(),
|
|
77
|
+
traceId: z2.string().optional()
|
|
78
|
+
}).strict();
|
|
79
|
+
var transcriptPartTypeSchema = z2.enum([
|
|
80
|
+
"text",
|
|
81
|
+
"thinking",
|
|
82
|
+
"tool_call",
|
|
83
|
+
"tool_result",
|
|
84
|
+
"unknown"
|
|
85
|
+
]);
|
|
86
|
+
var transcriptPartSchema = z2.object({
|
|
87
|
+
bytes: z2.number().optional(),
|
|
88
|
+
chars: z2.number().optional(),
|
|
89
|
+
id: z2.string().optional(),
|
|
90
|
+
input: z2.unknown().optional(),
|
|
91
|
+
inputKeys: z2.array(z2.string()).optional(),
|
|
92
|
+
inputSizeBytes: z2.number().optional(),
|
|
93
|
+
inputSizeChars: z2.number().optional(),
|
|
94
|
+
inputType: z2.string().optional(),
|
|
95
|
+
name: z2.string().optional(),
|
|
96
|
+
output: z2.unknown().optional(),
|
|
97
|
+
outputKeys: z2.array(z2.string()).optional(),
|
|
98
|
+
outputSizeBytes: z2.number().optional(),
|
|
99
|
+
outputSizeChars: z2.number().optional(),
|
|
100
|
+
outputType: z2.string().optional(),
|
|
101
|
+
redacted: z2.boolean().optional(),
|
|
102
|
+
sourceType: z2.string().optional(),
|
|
103
|
+
text: z2.string().optional(),
|
|
104
|
+
type: transcriptPartTypeSchema
|
|
105
|
+
}).strict();
|
|
106
|
+
var transcriptRoleSchema = z2.enum([
|
|
107
|
+
"assistant",
|
|
108
|
+
"system",
|
|
109
|
+
"tool",
|
|
110
|
+
"toolResult",
|
|
111
|
+
"unknown",
|
|
112
|
+
"user"
|
|
113
|
+
]);
|
|
114
|
+
var transcriptMessageSchema = z2.object({
|
|
115
|
+
outcome: z2.enum(["error", "aborted"]).optional(),
|
|
116
|
+
parts: z2.array(transcriptPartSchema),
|
|
117
|
+
role: transcriptRoleSchema,
|
|
118
|
+
timestamp: z2.number().optional()
|
|
119
|
+
}).strict();
|
|
120
|
+
var conversationActivityStatusSchema = z2.enum([
|
|
121
|
+
"aborted",
|
|
122
|
+
"completed",
|
|
123
|
+
"error",
|
|
124
|
+
"running",
|
|
125
|
+
"success"
|
|
126
|
+
]);
|
|
127
|
+
var conversationSubagentActivityReportSchema = z2.object({
|
|
128
|
+
type: z2.literal("subagent"),
|
|
129
|
+
createdAt: z2.string(),
|
|
130
|
+
endedAt: z2.string().optional(),
|
|
131
|
+
id: z2.string(),
|
|
132
|
+
modelId: z2.string().optional(),
|
|
133
|
+
outcome: z2.enum(["success", "error", "aborted"]).optional(),
|
|
134
|
+
parentToolCallId: z2.string().optional(),
|
|
135
|
+
reasoningLevel: z2.string().optional(),
|
|
136
|
+
status: conversationActivityStatusSchema,
|
|
137
|
+
subagentKind: z2.string(),
|
|
138
|
+
transcriptAvailable: z2.boolean().optional()
|
|
139
|
+
}).strict();
|
|
140
|
+
var conversationToolActivityReportSchema = z2.object({
|
|
141
|
+
type: z2.literal("tool_execution"),
|
|
142
|
+
args: z2.unknown().optional(),
|
|
143
|
+
createdAt: z2.string(),
|
|
144
|
+
id: z2.string(),
|
|
145
|
+
inputKeys: z2.array(z2.string()).optional(),
|
|
146
|
+
inputSizeBytes: z2.number().optional(),
|
|
147
|
+
inputSizeChars: z2.number().optional(),
|
|
148
|
+
inputType: z2.string().optional(),
|
|
149
|
+
redacted: z2.boolean().optional(),
|
|
150
|
+
status: conversationActivityStatusSchema,
|
|
151
|
+
subagents: z2.array(conversationSubagentActivityReportSchema),
|
|
152
|
+
toolCallId: z2.string(),
|
|
153
|
+
toolName: z2.string()
|
|
154
|
+
}).strict();
|
|
155
|
+
var conversationActivityReportSchema = z2.discriminatedUnion("type", [
|
|
156
|
+
conversationToolActivityReportSchema,
|
|
157
|
+
conversationSubagentActivityReportSchema
|
|
158
|
+
]);
|
|
159
|
+
var conversationContextEventSchema = z2.discriminatedUnion("type", [
|
|
160
|
+
z2.object({
|
|
161
|
+
type: z2.literal("context_compacted"),
|
|
162
|
+
createdAt: z2.string(),
|
|
163
|
+
modelId: z2.string().optional(),
|
|
164
|
+
summary: z2.string().optional(),
|
|
165
|
+
transcriptIndex: z2.number().int().nonnegative()
|
|
166
|
+
}).strict(),
|
|
167
|
+
z2.object({
|
|
168
|
+
type: z2.literal("model_handoff"),
|
|
169
|
+
createdAt: z2.string(),
|
|
170
|
+
fromModelId: z2.string().optional(),
|
|
171
|
+
message: z2.string().optional(),
|
|
172
|
+
toModelId: z2.string(),
|
|
173
|
+
transcriptIndex: z2.number().int().nonnegative()
|
|
174
|
+
}).strict()
|
|
175
|
+
]);
|
|
176
|
+
var conversationDetailReportSchema = conversationSummaryReportSchema.extend({
|
|
177
|
+
activity: z2.array(conversationActivityReportSchema).optional(),
|
|
178
|
+
modelId: z2.string().optional(),
|
|
179
|
+
reasoningLevel: z2.string().optional(),
|
|
180
|
+
contextEvents: z2.array(conversationContextEventSchema).optional(),
|
|
181
|
+
transcriptAvailable: z2.boolean(),
|
|
182
|
+
transcriptMetadata: z2.array(transcriptMessageSchema).optional(),
|
|
183
|
+
transcriptMessageCount: z2.number().optional(),
|
|
184
|
+
transcriptRedacted: z2.boolean().optional(),
|
|
185
|
+
transcriptRedactionReason: z2.literal("non_public_conversation").optional(),
|
|
186
|
+
transcriptExpired: z2.boolean().optional(),
|
|
187
|
+
transcriptExpiredAt: z2.string().optional(),
|
|
188
|
+
transcript: z2.array(transcriptMessageSchema),
|
|
189
|
+
generatedAt: z2.string(),
|
|
190
|
+
sentryConversationUrl: z2.string().optional()
|
|
191
|
+
}).strict();
|
|
192
|
+
var conversationSubagentTranscriptReportSchema = z2.object({
|
|
193
|
+
type: z2.literal("subagent"),
|
|
194
|
+
createdAt: z2.string(),
|
|
195
|
+
endedAt: z2.string().optional(),
|
|
196
|
+
id: z2.string(),
|
|
197
|
+
modelId: z2.string().optional(),
|
|
198
|
+
outcome: z2.enum(["success", "error", "aborted"]).optional(),
|
|
199
|
+
parentToolCallId: z2.string().optional(),
|
|
200
|
+
reasoningLevel: z2.string().optional(),
|
|
201
|
+
status: conversationActivityStatusSchema,
|
|
202
|
+
subagentConversationId: z2.string().optional(),
|
|
203
|
+
subagentKind: z2.string(),
|
|
204
|
+
subagentSentryConversationUrl: z2.string().optional(),
|
|
205
|
+
transcript: z2.array(transcriptMessageSchema),
|
|
206
|
+
transcriptAvailable: z2.boolean(),
|
|
207
|
+
transcriptMessageCount: z2.number().optional(),
|
|
208
|
+
transcriptRedacted: z2.boolean().optional(),
|
|
209
|
+
transcriptRedactionReason: z2.literal("non_public_conversation").optional(),
|
|
210
|
+
transcriptExpired: z2.boolean().optional(),
|
|
211
|
+
transcriptExpiredAt: z2.string().optional(),
|
|
212
|
+
unavailableReason: z2.enum(["missing_transcript_range", "missing_transcript_ref", "not_found"]).optional()
|
|
213
|
+
}).strict();
|
|
214
|
+
var conversationFeedSchema = z2.object({
|
|
215
|
+
conversations: z2.array(conversationSummaryReportSchema),
|
|
216
|
+
source: z2.literal("conversation_index"),
|
|
217
|
+
generatedAt: z2.string()
|
|
218
|
+
}).strict();
|
|
219
|
+
var conversationStatsItemSchema = z2.object({
|
|
220
|
+
active: z2.number(),
|
|
221
|
+
conversations: z2.number(),
|
|
222
|
+
durationMs: z2.number(),
|
|
223
|
+
failed: z2.number(),
|
|
224
|
+
label: z2.string(),
|
|
225
|
+
costUsd: z2.number().optional(),
|
|
226
|
+
tokens: z2.number().optional()
|
|
227
|
+
}).strict();
|
|
228
|
+
var conversationStatsReportSchema = z2.object({
|
|
229
|
+
active: z2.number(),
|
|
230
|
+
conversations: z2.number(),
|
|
231
|
+
durationMs: z2.number(),
|
|
232
|
+
failed: z2.number(),
|
|
233
|
+
generatedAt: z2.string(),
|
|
234
|
+
locations: z2.array(conversationStatsItemSchema),
|
|
235
|
+
actors: z2.array(conversationStatsItemSchema),
|
|
236
|
+
source: z2.literal("conversation_index"),
|
|
237
|
+
costUsd: z2.number().optional(),
|
|
238
|
+
tokens: z2.number().optional(),
|
|
239
|
+
windowEnd: z2.string(),
|
|
240
|
+
windowStart: z2.string()
|
|
241
|
+
}).strict();
|
|
242
|
+
|
|
243
|
+
// src/api/people/schema.ts
|
|
244
|
+
import { z as z3 } from "zod";
|
|
245
|
+
var peopleConversationSummaryReportSchema = conversationSummaryReportSchema.omit({
|
|
246
|
+
cumulativeUsage: true,
|
|
247
|
+
sentryTraceUrl: true,
|
|
248
|
+
traceId: true
|
|
249
|
+
});
|
|
250
|
+
var peopleConversationStatsItemSchema = conversationStatsItemSchema.omit({ costUsd: true });
|
|
251
|
+
var actorActivityDayReportSchema = z3.object({
|
|
252
|
+
active: z3.number(),
|
|
253
|
+
conversations: z3.number(),
|
|
254
|
+
date: z3.string(),
|
|
255
|
+
durationMs: z3.number(),
|
|
256
|
+
failed: z3.number(),
|
|
257
|
+
tokens: z3.number().optional()
|
|
258
|
+
}).strict();
|
|
259
|
+
var peopleActivityDayReportSchema = z3.object({
|
|
260
|
+
activePeople: z3.number(),
|
|
261
|
+
conversations: z3.number(),
|
|
262
|
+
date: z3.string()
|
|
263
|
+
}).strict();
|
|
264
|
+
var actorTotalsReportSchema = z3.object({
|
|
265
|
+
active: z3.number(),
|
|
266
|
+
activeDays: z3.number(),
|
|
267
|
+
conversations: z3.number(),
|
|
268
|
+
durationMs: z3.number(),
|
|
269
|
+
failed: z3.number(),
|
|
270
|
+
tokens: z3.number().optional()
|
|
271
|
+
}).strict();
|
|
272
|
+
var identifiedActorSchema = actorIdentitySchema.extend({ email: z3.string().min(1) }).strict();
|
|
273
|
+
var actorSummaryReportSchema = actorTotalsReportSchema.extend({
|
|
274
|
+
firstSeenAt: z3.string(),
|
|
275
|
+
lastSeenAt: z3.string(),
|
|
276
|
+
actor: identifiedActorSchema
|
|
277
|
+
}).strict();
|
|
278
|
+
var actorDirectoryReportSchema = z3.object({
|
|
279
|
+
activityDays: z3.array(peopleActivityDayReportSchema),
|
|
280
|
+
generatedAt: z3.string(),
|
|
281
|
+
people: z3.array(actorSummaryReportSchema),
|
|
282
|
+
source: z3.literal("conversation_index"),
|
|
283
|
+
windowEnd: z3.string(),
|
|
284
|
+
windowStart: z3.string()
|
|
285
|
+
}).strict();
|
|
286
|
+
var actorProfileReportSchema = z3.object({
|
|
287
|
+
activityDays: z3.array(actorActivityDayReportSchema),
|
|
288
|
+
generatedAt: z3.string(),
|
|
289
|
+
locations: z3.array(peopleConversationStatsItemSchema),
|
|
290
|
+
recentConversations: z3.array(peopleConversationSummaryReportSchema),
|
|
291
|
+
actor: identifiedActorSchema,
|
|
292
|
+
source: z3.literal("conversation_index"),
|
|
293
|
+
surfaces: z3.array(peopleConversationStatsItemSchema),
|
|
294
|
+
totals: actorTotalsReportSchema,
|
|
295
|
+
windowEnd: z3.string(),
|
|
296
|
+
windowStart: z3.string()
|
|
297
|
+
}).strict();
|
|
298
|
+
|
|
299
|
+
// src/api/locations/schema.ts
|
|
300
|
+
import { z as z4 } from "zod";
|
|
301
|
+
var locationSummaryReportSchema = conversationStatsItemSchema.extend({
|
|
302
|
+
id: z4.string(),
|
|
303
|
+
firstSeenAt: z4.string(),
|
|
304
|
+
kind: juniorDestinationKindSchema,
|
|
305
|
+
lastSeenAt: z4.string(),
|
|
306
|
+
provider: z4.string(),
|
|
307
|
+
providerDestinationId: z4.string(),
|
|
308
|
+
visibility: z4.literal("public")
|
|
309
|
+
}).strict();
|
|
310
|
+
var locationActorSummaryReportSchema = conversationStatsItemSchema.extend({ actor: actorIdentitySchema }).strict();
|
|
311
|
+
var locationActivityDayReportSchema = z4.object({
|
|
312
|
+
date: z4.string(),
|
|
313
|
+
privateConversations: z4.number(),
|
|
314
|
+
publicConversations: z4.number()
|
|
315
|
+
}).strict();
|
|
316
|
+
var locationDirectoryReportSchema = z4.object({
|
|
317
|
+
activityDays: z4.array(locationActivityDayReportSchema),
|
|
318
|
+
generatedAt: z4.string(),
|
|
319
|
+
locations: z4.array(locationSummaryReportSchema),
|
|
320
|
+
privateActivity: conversationStatsItemSchema,
|
|
321
|
+
source: z4.literal("conversation_index"),
|
|
322
|
+
windowEnd: z4.string(),
|
|
323
|
+
windowStart: z4.string()
|
|
324
|
+
}).strict();
|
|
325
|
+
var locationDetailReportSchema = locationSummaryReportSchema.extend({
|
|
326
|
+
activityDays: z4.array(dailyConversationActivitySchema),
|
|
327
|
+
actors: z4.array(locationActorSummaryReportSchema),
|
|
328
|
+
generatedAt: z4.string(),
|
|
329
|
+
recentConversations: z4.array(conversationSummaryReportSchema),
|
|
330
|
+
source: z4.literal("conversation_index"),
|
|
331
|
+
windowEnd: z4.string(),
|
|
332
|
+
windowStart: z4.string()
|
|
333
|
+
}).strict();
|
|
334
|
+
|
|
335
|
+
// src/api/schema.ts
|
|
336
|
+
import { z as z5 } from "zod";
|
|
337
|
+
var conversationParamsSchema = z5.object({ conversationId: z5.string().min(1) }).strict();
|
|
338
|
+
var conversationFeedQuerySchema = z5.object({
|
|
339
|
+
actorEmail: z5.string().trim().email().transform((value) => value.toLowerCase()).optional()
|
|
340
|
+
}).strict();
|
|
341
|
+
var subagentParamsSchema = conversationParamsSchema.extend({ subagentId: z5.string().min(1) }).strict();
|
|
342
|
+
var personParamsSchema = z5.object({ email: z5.string().trim().min(1) }).strict();
|
|
343
|
+
var locationParamsSchema = z5.object({ locationId: z5.string().min(1) }).strict();
|
|
344
|
+
|
|
345
|
+
export {
|
|
346
|
+
dailyConversationActivitySchema,
|
|
347
|
+
activityDays,
|
|
348
|
+
conversationDetailReportSchema,
|
|
349
|
+
conversationSubagentTranscriptReportSchema,
|
|
350
|
+
conversationFeedSchema,
|
|
351
|
+
conversationStatsReportSchema,
|
|
352
|
+
actorDirectoryReportSchema,
|
|
353
|
+
actorProfileReportSchema,
|
|
354
|
+
locationActivityDayReportSchema,
|
|
355
|
+
locationDirectoryReportSchema,
|
|
356
|
+
locationDetailReportSchema,
|
|
357
|
+
conversationParamsSchema,
|
|
358
|
+
conversationFeedQuerySchema,
|
|
359
|
+
subagentParamsSchema,
|
|
360
|
+
personParamsSchema,
|
|
361
|
+
locationParamsSchema
|
|
362
|
+
};
|
|
@@ -153,7 +153,8 @@ var juniorConversations = pgTable3(
|
|
|
153
153
|
usage: jsonb2("usage_json").$type(),
|
|
154
154
|
executionDurationMs: integer("execution_duration_ms").notNull().default(0),
|
|
155
155
|
executionUsage: jsonb2("execution_usage_json").$type(),
|
|
156
|
-
metricRunId: text3("metric_run_id")
|
|
156
|
+
metricRunId: text3("metric_run_id"),
|
|
157
|
+
archivedAt: timestamptz("archived_at")
|
|
157
158
|
},
|
|
158
159
|
(table) => [
|
|
159
160
|
index2("junior_conversations_last_activity_idx").on(
|
|
@@ -537,6 +538,7 @@ function conversationFromRow(readRow) {
|
|
|
537
538
|
execution,
|
|
538
539
|
...destination ? { destination } : {},
|
|
539
540
|
...actor ? { actor } : {},
|
|
541
|
+
...msFromDate(row.archivedAt) !== void 0 ? { archivedAtMs: msFromDate(row.archivedAt) } : {},
|
|
540
542
|
...row.channelName ? { channelName: row.channelName } : {},
|
|
541
543
|
...source ? { source } : {},
|
|
542
544
|
...row.title ? { title: row.title } : {},
|
|
@@ -969,7 +971,7 @@ function createSqlStore(executor) {
|
|
|
969
971
|
}
|
|
970
972
|
|
|
971
973
|
// src/chat/conversations/sql/history.ts
|
|
972
|
-
import { and as and3, asc as asc2, eq as eq3, sql as sql7 } from "drizzle-orm";
|
|
974
|
+
import { and as and3, asc as asc2, eq as eq3, isNotNull, sql as sql7 } from "drizzle-orm";
|
|
973
975
|
|
|
974
976
|
// src/chat/conversations/history.ts
|
|
975
977
|
import { z as z3 } from "zod";
|
|
@@ -1533,6 +1535,12 @@ var SqlAgentStepStore = class {
|
|
|
1533
1535
|
conversationId,
|
|
1534
1536
|
newestCreatedAtMs
|
|
1535
1537
|
);
|
|
1538
|
+
await this.executor.db().update(juniorConversations).set({ archivedAt: null }).where(
|
|
1539
|
+
and3(
|
|
1540
|
+
eq3(juniorConversations.conversationId, conversationId),
|
|
1541
|
+
isNotNull(juniorConversations.archivedAt)
|
|
1542
|
+
)
|
|
1543
|
+
);
|
|
1536
1544
|
const cursor = await this.readCursor(conversationId);
|
|
1537
1545
|
const contextEpoch = cursor.maxEpoch ?? 0;
|
|
1538
1546
|
let seq = cursor.nextSeq;
|
|
@@ -1546,6 +1554,12 @@ var SqlAgentStepStore = class {
|
|
|
1546
1554
|
const parsed = contextEpochStartSchema.parse(opts);
|
|
1547
1555
|
await this.executor.transaction(async () => {
|
|
1548
1556
|
await ensureConversationRow(this.executor, conversationId, Date.now());
|
|
1557
|
+
await this.executor.db().update(juniorConversations).set({ archivedAt: null }).where(
|
|
1558
|
+
and3(
|
|
1559
|
+
eq3(juniorConversations.conversationId, conversationId),
|
|
1560
|
+
isNotNull(juniorConversations.archivedAt)
|
|
1561
|
+
)
|
|
1562
|
+
);
|
|
1549
1563
|
const cursor = await this.readCursor(conversationId);
|
|
1550
1564
|
const contextEpoch = parsed.reason === "initial" ? cursor.maxEpoch ?? 0 : (cursor.maxEpoch ?? -1) + 1;
|
|
1551
1565
|
let seq = cursor.nextSeq;
|
|
@@ -1596,7 +1610,7 @@ function createSqlAgentStepStore(executor) {
|
|
|
1596
1610
|
}
|
|
1597
1611
|
|
|
1598
1612
|
// src/chat/conversations/sql/messages.ts
|
|
1599
|
-
import { and as and4, asc as asc3, eq as eq4, isNull as isNull2, sql as sql8 } from "drizzle-orm";
|
|
1613
|
+
import { and as and4, asc as asc3, eq as eq4, isNotNull as isNotNull2, isNull as isNull2, sql as sql8 } from "drizzle-orm";
|
|
1600
1614
|
function messageFromRow(row) {
|
|
1601
1615
|
return {
|
|
1602
1616
|
conversationId: row.conversationId,
|
|
@@ -1627,6 +1641,12 @@ var SqlConversationMessageStore = class {
|
|
|
1627
1641
|
conversationId,
|
|
1628
1642
|
newestCreatedAtMs
|
|
1629
1643
|
);
|
|
1644
|
+
await this.executor.db().update(juniorConversations).set({ archivedAt: null }).where(
|
|
1645
|
+
and4(
|
|
1646
|
+
eq4(juniorConversations.conversationId, conversationId),
|
|
1647
|
+
isNotNull2(juniorConversations.archivedAt)
|
|
1648
|
+
)
|
|
1649
|
+
);
|
|
1630
1650
|
await this.executor.db().insert(juniorConversationMessages).values(
|
|
1631
1651
|
messages.map((message) => ({
|
|
1632
1652
|
conversationId,
|
|
@@ -1,9 +1,82 @@
|
|
|
1
|
+
import {
|
|
2
|
+
healthReportSchema
|
|
3
|
+
} from "./chunk-CEA3A3UA.js";
|
|
1
4
|
import {
|
|
2
5
|
normalizeSlackConversationId
|
|
3
6
|
} from "./chunk-CCTCIISK.js";
|
|
4
7
|
import {
|
|
5
8
|
parseSlackThreadId
|
|
6
9
|
} from "./chunk-RT5BUHR5.js";
|
|
10
|
+
import {
|
|
11
|
+
getClient
|
|
12
|
+
} from "./chunk-6GWA276C.js";
|
|
13
|
+
|
|
14
|
+
// src/handlers/health.ts
|
|
15
|
+
function readHealthReport() {
|
|
16
|
+
return healthReportSchema.parse({
|
|
17
|
+
status: "ok",
|
|
18
|
+
service: "junior",
|
|
19
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function GET() {
|
|
23
|
+
return Response.json(readHealthReport());
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// src/chat/sentry-links.ts
|
|
27
|
+
function getSentryOrgSlug() {
|
|
28
|
+
const slug = process.env.SENTRY_ORG_SLUG?.trim();
|
|
29
|
+
return slug || void 0;
|
|
30
|
+
}
|
|
31
|
+
function isSentrySaasDsnHost(host) {
|
|
32
|
+
return host === "sentry.io" || host.endsWith(".sentry.io");
|
|
33
|
+
}
|
|
34
|
+
function buildSentryWebBaseUrl(dsn) {
|
|
35
|
+
if (isSentrySaasDsnHost(dsn.host)) {
|
|
36
|
+
return "https://sentry.io";
|
|
37
|
+
}
|
|
38
|
+
const port = dsn.port ? `:${dsn.port}` : "";
|
|
39
|
+
const path = dsn.path ? `/${dsn.path}` : "";
|
|
40
|
+
return `${dsn.protocol}://${dsn.host}${port}${path}`;
|
|
41
|
+
}
|
|
42
|
+
function buildSentryConversationUrl(conversationId) {
|
|
43
|
+
const client = getClient();
|
|
44
|
+
const dsn = client?.getDsn();
|
|
45
|
+
if (!dsn?.host || !dsn.projectId) {
|
|
46
|
+
return void 0;
|
|
47
|
+
}
|
|
48
|
+
const orgSlug = getSentryOrgSlug();
|
|
49
|
+
if (!orgSlug) {
|
|
50
|
+
return void 0;
|
|
51
|
+
}
|
|
52
|
+
const encodedId = encodeURIComponent(conversationId);
|
|
53
|
+
const params = new URLSearchParams();
|
|
54
|
+
params.set("project", dsn.projectId);
|
|
55
|
+
const path = `explore/conversations/${encodedId}/?${params.toString()}`;
|
|
56
|
+
if (isSentrySaasDsnHost(dsn.host)) {
|
|
57
|
+
return `https://${orgSlug}.sentry.io/${path}`;
|
|
58
|
+
}
|
|
59
|
+
return `${buildSentryWebBaseUrl(dsn)}/organizations/${orgSlug}/${path}`;
|
|
60
|
+
}
|
|
61
|
+
function buildSentryTraceUrl(traceId) {
|
|
62
|
+
const client = getClient();
|
|
63
|
+
const dsn = client?.getDsn();
|
|
64
|
+
if (!dsn?.host || !dsn.projectId) {
|
|
65
|
+
return void 0;
|
|
66
|
+
}
|
|
67
|
+
const orgSlug = getSentryOrgSlug();
|
|
68
|
+
if (!orgSlug) {
|
|
69
|
+
return void 0;
|
|
70
|
+
}
|
|
71
|
+
const encodedTraceId = encodeURIComponent(traceId);
|
|
72
|
+
const params = new URLSearchParams();
|
|
73
|
+
params.set("project", dsn.projectId);
|
|
74
|
+
const path = `performance/trace/${encodedTraceId}/?${params.toString()}`;
|
|
75
|
+
if (isSentrySaasDsnHost(dsn.host)) {
|
|
76
|
+
return `https://${orgSlug}.sentry.io/${path}`;
|
|
77
|
+
}
|
|
78
|
+
return `${buildSentryWebBaseUrl(dsn)}/organizations/${orgSlug}/${path}`;
|
|
79
|
+
}
|
|
7
80
|
|
|
8
81
|
// src/chat/slack/conversation-context.ts
|
|
9
82
|
function normalizeConversationName(type, channelName) {
|
|
@@ -88,6 +161,10 @@ function formatSlackConversationRedactedLabel(context) {
|
|
|
88
161
|
}
|
|
89
162
|
|
|
90
163
|
export {
|
|
164
|
+
readHealthReport,
|
|
165
|
+
GET,
|
|
166
|
+
buildSentryConversationUrl,
|
|
167
|
+
buildSentryTraceUrl,
|
|
91
168
|
conversationVisibilityFromSlackChannelType,
|
|
92
169
|
resolveSlackChannelTypeFromMessage,
|
|
93
170
|
resolveSlackConversationContext,
|