@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
package/dist/chunk-VKFOVMZL.js
DELETED
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
summaryFromRow
|
|
3
|
-
} from "./chunk-QOZOJNSE.js";
|
|
4
|
-
import {
|
|
5
|
-
conversationAggregateColumns,
|
|
6
|
-
conversationRangeColumns
|
|
7
|
-
} from "./chunk-6FPTHPXF.js";
|
|
8
|
-
import {
|
|
9
|
-
activityDays
|
|
10
|
-
} from "./chunk-GCGRQJR5.js";
|
|
11
|
-
import {
|
|
12
|
-
getDb,
|
|
13
|
-
juniorConversations,
|
|
14
|
-
juniorIdentities,
|
|
15
|
-
juniorUsers
|
|
16
|
-
} from "./chunk-HOBDQQJY.js";
|
|
17
|
-
import {
|
|
18
|
-
juniorDestinations
|
|
19
|
-
} from "./chunk-FXFQNHRU.js";
|
|
20
|
-
|
|
21
|
-
// src/api/locations/query.ts
|
|
22
|
-
import { and, asc, desc, eq, gte, isNull, sql } from "drizzle-orm";
|
|
23
|
-
var RECENT_LIMIT = 25;
|
|
24
|
-
var ACTIVITY_DAYS = 90;
|
|
25
|
-
function emptyMetrics() {
|
|
26
|
-
return {
|
|
27
|
-
active: 0,
|
|
28
|
-
conversations: 0,
|
|
29
|
-
durationMs: 0,
|
|
30
|
-
failed: 0
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function addMetrics(target, row) {
|
|
34
|
-
target.active += row.active;
|
|
35
|
-
target.conversations += row.conversations;
|
|
36
|
-
target.durationMs += row.durationMs;
|
|
37
|
-
target.failed += row.failed;
|
|
38
|
-
if (row.tokens !== null) {
|
|
39
|
-
target.tokens = (target.tokens ?? 0) + row.tokens;
|
|
40
|
-
}
|
|
41
|
-
if (row.costUsd !== null) {
|
|
42
|
-
target.costUsd = Math.round(((target.costUsd ?? 0) + row.costUsd) * 1e12) / 1e12;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function publicLabel(input) {
|
|
46
|
-
const name = input.displayName?.trim().replace(/^#/, "");
|
|
47
|
-
return name ? `#${name}` : `Public channel ${input.providerDestinationId}`;
|
|
48
|
-
}
|
|
49
|
-
function actorLabel(actor) {
|
|
50
|
-
return actor.email?.trim() || actor.fullName?.trim() || actor.slackUserName?.trim() || actor.slackUserId?.trim() || "Unknown";
|
|
51
|
-
}
|
|
52
|
-
function emptyActor(actor) {
|
|
53
|
-
return {
|
|
54
|
-
...emptyMetrics(),
|
|
55
|
-
actor,
|
|
56
|
-
label: actorLabel(actor)
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
function topLevelWhere() {
|
|
60
|
-
return isNull(juniorConversations.parentConversationId);
|
|
61
|
-
}
|
|
62
|
-
function publicLocationWhere(destinationId) {
|
|
63
|
-
return and(
|
|
64
|
-
topLevelWhere(),
|
|
65
|
-
eq(juniorDestinations.id, destinationId),
|
|
66
|
-
eq(juniorDestinations.visibility, "public")
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
function locationColumns() {
|
|
70
|
-
return {
|
|
71
|
-
destinationDisplayName: juniorDestinations.displayName,
|
|
72
|
-
destinationId: juniorDestinations.id,
|
|
73
|
-
destinationKind: juniorDestinations.kind,
|
|
74
|
-
destinationProvider: juniorDestinations.provider,
|
|
75
|
-
destinationProviderId: juniorDestinations.providerDestinationId,
|
|
76
|
-
destinationVisibility: juniorDestinations.visibility
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
function locationGroupBy() {
|
|
80
|
-
return [
|
|
81
|
-
juniorDestinations.displayName,
|
|
82
|
-
juniorDestinations.id,
|
|
83
|
-
juniorDestinations.kind,
|
|
84
|
-
juniorDestinations.provider,
|
|
85
|
-
juniorDestinations.providerDestinationId,
|
|
86
|
-
juniorDestinations.visibility
|
|
87
|
-
];
|
|
88
|
-
}
|
|
89
|
-
function locationFromAggregate(row) {
|
|
90
|
-
if (row.destinationVisibility !== "public" || !row.destinationId || !row.destinationProvider || !row.destinationProviderId || !row.destinationKind) {
|
|
91
|
-
return void 0;
|
|
92
|
-
}
|
|
93
|
-
const location = {
|
|
94
|
-
...emptyMetrics(),
|
|
95
|
-
firstSeenAt: row.firstSeenAt.toISOString(),
|
|
96
|
-
id: row.destinationId,
|
|
97
|
-
kind: row.destinationKind,
|
|
98
|
-
label: publicLabel({
|
|
99
|
-
displayName: row.destinationDisplayName,
|
|
100
|
-
providerDestinationId: row.destinationProviderId
|
|
101
|
-
}),
|
|
102
|
-
lastSeenAt: row.lastSeenAt.toISOString(),
|
|
103
|
-
provider: row.destinationProvider,
|
|
104
|
-
providerDestinationId: row.destinationProviderId,
|
|
105
|
-
visibility: "public"
|
|
106
|
-
};
|
|
107
|
-
addMetrics(location, row);
|
|
108
|
-
return location;
|
|
109
|
-
}
|
|
110
|
-
async function directoryRows(db) {
|
|
111
|
-
return db.select({
|
|
112
|
-
...locationColumns(),
|
|
113
|
-
...conversationAggregateColumns(),
|
|
114
|
-
...conversationRangeColumns()
|
|
115
|
-
}).from(juniorConversations).leftJoin(
|
|
116
|
-
juniorDestinations,
|
|
117
|
-
eq(juniorDestinations.id, juniorConversations.destinationId)
|
|
118
|
-
).where(topLevelWhere()).groupBy(...locationGroupBy());
|
|
119
|
-
}
|
|
120
|
-
async function directoryActivityRows(db, start) {
|
|
121
|
-
const date = sql`TO_CHAR(
|
|
122
|
-
${juniorConversations.lastActivityAt} AT TIME ZONE 'UTC',
|
|
123
|
-
'YYYY-MM-DD'
|
|
124
|
-
)`;
|
|
125
|
-
return db.select({
|
|
126
|
-
conversations: sql`COUNT(*)::integer`,
|
|
127
|
-
date,
|
|
128
|
-
visibility: juniorDestinations.visibility
|
|
129
|
-
}).from(juniorConversations).leftJoin(
|
|
130
|
-
juniorDestinations,
|
|
131
|
-
eq(juniorDestinations.id, juniorConversations.destinationId)
|
|
132
|
-
).where(and(topLevelWhere(), gte(juniorConversations.lastActivityAt, start))).groupBy(date, juniorDestinations.visibility);
|
|
133
|
-
}
|
|
134
|
-
function directoryActivityDays(rows, nowMs) {
|
|
135
|
-
const days = /* @__PURE__ */ new Map();
|
|
136
|
-
for (const row of rows) {
|
|
137
|
-
const day = days.get(row.date) ?? {
|
|
138
|
-
date: row.date,
|
|
139
|
-
privateConversations: 0,
|
|
140
|
-
publicConversations: 0
|
|
141
|
-
};
|
|
142
|
-
if (row.visibility === "public") {
|
|
143
|
-
day.publicConversations += row.conversations;
|
|
144
|
-
} else {
|
|
145
|
-
day.privateConversations += row.conversations;
|
|
146
|
-
}
|
|
147
|
-
days.set(row.date, day);
|
|
148
|
-
}
|
|
149
|
-
const end = new Date(nowMs);
|
|
150
|
-
end.setUTCHours(0, 0, 0, 0);
|
|
151
|
-
const start = new Date(end);
|
|
152
|
-
start.setUTCDate(start.getUTCDate() - (ACTIVITY_DAYS - 1));
|
|
153
|
-
const activity = [];
|
|
154
|
-
for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setUTCDate(cursor.getUTCDate() + 1)) {
|
|
155
|
-
const date = cursor.toISOString().slice(0, 10);
|
|
156
|
-
activity.push(
|
|
157
|
-
days.get(date) ?? {
|
|
158
|
-
date,
|
|
159
|
-
privateConversations: 0,
|
|
160
|
-
publicConversations: 0
|
|
161
|
-
}
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
return activity;
|
|
165
|
-
}
|
|
166
|
-
async function readLocationDirectoryFromSql() {
|
|
167
|
-
const nowMs = Date.now();
|
|
168
|
-
const end = new Date(nowMs);
|
|
169
|
-
end.setUTCHours(0, 0, 0, 0);
|
|
170
|
-
const start = new Date(end);
|
|
171
|
-
start.setUTCDate(start.getUTCDate() - (ACTIVITY_DAYS - 1));
|
|
172
|
-
const [rows, activityRows] = await Promise.all([
|
|
173
|
-
directoryRows(getDb()),
|
|
174
|
-
directoryActivityRows(getDb(), start)
|
|
175
|
-
]);
|
|
176
|
-
const locations = [];
|
|
177
|
-
const privateActivity = {
|
|
178
|
-
...emptyMetrics(),
|
|
179
|
-
label: "Private activity"
|
|
180
|
-
};
|
|
181
|
-
for (const row of rows) {
|
|
182
|
-
const location = locationFromAggregate(row);
|
|
183
|
-
if (location) locations.push(location);
|
|
184
|
-
else addMetrics(privateActivity, row);
|
|
185
|
-
}
|
|
186
|
-
return {
|
|
187
|
-
activityDays: directoryActivityDays(activityRows, nowMs),
|
|
188
|
-
generatedAt: new Date(nowMs).toISOString(),
|
|
189
|
-
locations: locations.sort(
|
|
190
|
-
(left, right) => Date.parse(right.lastSeenAt) - Date.parse(left.lastSeenAt) || right.conversations - left.conversations || left.label.localeCompare(right.label)
|
|
191
|
-
),
|
|
192
|
-
privateActivity,
|
|
193
|
-
source: "conversation_index",
|
|
194
|
-
windowEnd: end.toISOString(),
|
|
195
|
-
windowStart: start.toISOString()
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
async function recentLocationRows(db, locationId) {
|
|
199
|
-
return db.select({
|
|
200
|
-
channelName: juniorConversations.channelName,
|
|
201
|
-
conversationId: juniorConversations.conversationId,
|
|
202
|
-
createdAt: juniorConversations.createdAt,
|
|
203
|
-
destinationId: juniorDestinations.id,
|
|
204
|
-
destinationVisibility: juniorDestinations.visibility,
|
|
205
|
-
durationMs: juniorConversations.durationMs,
|
|
206
|
-
email: sql`COALESCE(
|
|
207
|
-
${juniorUsers.primaryEmailNormalized},
|
|
208
|
-
${juniorIdentities.email}
|
|
209
|
-
)`,
|
|
210
|
-
executionStatus: juniorConversations.executionStatus,
|
|
211
|
-
executionUpdatedAt: juniorConversations.executionUpdatedAt,
|
|
212
|
-
fullName: juniorUsers.displayName,
|
|
213
|
-
handle: juniorIdentities.handle,
|
|
214
|
-
lastActivityAt: juniorConversations.lastActivityAt,
|
|
215
|
-
providerSubjectId: sql`CASE
|
|
216
|
-
WHEN ${juniorIdentities.provider} = 'slack'
|
|
217
|
-
THEN ${juniorIdentities.providerSubjectId}
|
|
218
|
-
ELSE NULL
|
|
219
|
-
END`,
|
|
220
|
-
source: juniorConversations.source,
|
|
221
|
-
title: juniorConversations.title,
|
|
222
|
-
updatedAt: juniorConversations.updatedAt,
|
|
223
|
-
usage: juniorConversations.usage
|
|
224
|
-
}).from(juniorConversations).innerJoin(
|
|
225
|
-
juniorDestinations,
|
|
226
|
-
eq(juniorDestinations.id, juniorConversations.destinationId)
|
|
227
|
-
).leftJoin(
|
|
228
|
-
juniorIdentities,
|
|
229
|
-
eq(juniorIdentities.id, juniorConversations.actorIdentityId)
|
|
230
|
-
).leftJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(publicLocationWhere(locationId)).orderBy(
|
|
231
|
-
desc(juniorConversations.lastActivityAt),
|
|
232
|
-
asc(juniorConversations.conversationId)
|
|
233
|
-
).limit(RECENT_LIMIT);
|
|
234
|
-
}
|
|
235
|
-
async function readLocationDetailFromSql(locationId) {
|
|
236
|
-
const nowMs = Date.now();
|
|
237
|
-
const end = new Date(nowMs);
|
|
238
|
-
end.setUTCHours(0, 0, 0, 0);
|
|
239
|
-
const start = new Date(end);
|
|
240
|
-
start.setUTCDate(start.getUTCDate() - (ACTIVITY_DAYS - 1));
|
|
241
|
-
const where = publicLocationWhere(locationId);
|
|
242
|
-
const activityDate = sql`TO_CHAR(
|
|
243
|
-
${juniorConversations.lastActivityAt} AT TIME ZONE 'UTC',
|
|
244
|
-
'YYYY-MM-DD'
|
|
245
|
-
)`;
|
|
246
|
-
const [locationRows, dayRows, actorRows, recentRows] = await Promise.all([
|
|
247
|
-
getDb().select({
|
|
248
|
-
...locationColumns(),
|
|
249
|
-
...conversationAggregateColumns(),
|
|
250
|
-
...conversationRangeColumns()
|
|
251
|
-
}).from(juniorConversations).innerJoin(
|
|
252
|
-
juniorDestinations,
|
|
253
|
-
eq(juniorDestinations.id, juniorConversations.destinationId)
|
|
254
|
-
).where(where).groupBy(...locationGroupBy()),
|
|
255
|
-
getDb().select({ date: activityDate, ...conversationAggregateColumns() }).from(juniorConversations).innerJoin(
|
|
256
|
-
juniorDestinations,
|
|
257
|
-
eq(juniorDestinations.id, juniorConversations.destinationId)
|
|
258
|
-
).where(and(where, gte(juniorConversations.lastActivityAt, start))).groupBy(activityDate),
|
|
259
|
-
getDb().select({
|
|
260
|
-
actorIdentityId: juniorConversations.actorIdentityId,
|
|
261
|
-
email: juniorUsers.primaryEmailNormalized,
|
|
262
|
-
fullName: juniorUsers.displayName,
|
|
263
|
-
handle: juniorIdentities.handle,
|
|
264
|
-
identityEmail: juniorIdentities.email,
|
|
265
|
-
identityProvider: juniorIdentities.provider,
|
|
266
|
-
providerSubjectId: juniorIdentities.providerSubjectId,
|
|
267
|
-
...conversationAggregateColumns()
|
|
268
|
-
}).from(juniorConversations).innerJoin(
|
|
269
|
-
juniorDestinations,
|
|
270
|
-
eq(juniorDestinations.id, juniorConversations.destinationId)
|
|
271
|
-
).leftJoin(
|
|
272
|
-
juniorIdentities,
|
|
273
|
-
eq(juniorIdentities.id, juniorConversations.actorIdentityId)
|
|
274
|
-
).leftJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(where).groupBy(
|
|
275
|
-
juniorConversations.actorIdentityId,
|
|
276
|
-
juniorUsers.primaryEmailNormalized,
|
|
277
|
-
juniorUsers.displayName,
|
|
278
|
-
juniorIdentities.handle,
|
|
279
|
-
juniorIdentities.email,
|
|
280
|
-
juniorIdentities.provider,
|
|
281
|
-
juniorIdentities.providerSubjectId
|
|
282
|
-
),
|
|
283
|
-
recentLocationRows(getDb(), locationId)
|
|
284
|
-
]);
|
|
285
|
-
const locationRow = locationRows[0];
|
|
286
|
-
const location = locationRow ? locationFromAggregate(locationRow) : void 0;
|
|
287
|
-
if (!location) return void 0;
|
|
288
|
-
const days = /* @__PURE__ */ new Map();
|
|
289
|
-
for (const row of dayRows) {
|
|
290
|
-
days.set(row.date, {
|
|
291
|
-
active: row.active,
|
|
292
|
-
conversations: row.conversations,
|
|
293
|
-
date: row.date,
|
|
294
|
-
durationMs: row.durationMs,
|
|
295
|
-
failed: row.failed,
|
|
296
|
-
...row.tokens !== null ? { tokens: row.tokens } : {}
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
const actors = [];
|
|
300
|
-
for (const row of actorRows) {
|
|
301
|
-
if (!row.actorIdentityId) continue;
|
|
302
|
-
const actor = {
|
|
303
|
-
...row.email ?? row.identityEmail ? { email: row.email ?? row.identityEmail ?? void 0 } : {},
|
|
304
|
-
...row.fullName ? { fullName: row.fullName } : {},
|
|
305
|
-
...row.identityProvider === "slack" && row.providerSubjectId ? { slackUserId: row.providerSubjectId } : {},
|
|
306
|
-
...row.handle ? { slackUserName: row.handle } : {}
|
|
307
|
-
};
|
|
308
|
-
if (!actor.email && !actor.slackUserId) continue;
|
|
309
|
-
const item = emptyActor(actor);
|
|
310
|
-
addMetrics(item, row);
|
|
311
|
-
actors.push(item);
|
|
312
|
-
}
|
|
313
|
-
const activity = activityDays(days, nowMs, ACTIVITY_DAYS);
|
|
314
|
-
return {
|
|
315
|
-
...location,
|
|
316
|
-
activityDays: activity,
|
|
317
|
-
actors: actors.sort(
|
|
318
|
-
(left, right) => right.conversations - left.conversations || left.label.localeCompare(right.label)
|
|
319
|
-
),
|
|
320
|
-
generatedAt: new Date(nowMs).toISOString(),
|
|
321
|
-
recentConversations: recentRows.map(summaryFromRow),
|
|
322
|
-
source: "conversation_index",
|
|
323
|
-
windowEnd: end.toISOString(),
|
|
324
|
-
windowStart: activity[0] ? `${activity[0].date}T00:00:00.000Z` : end.toISOString()
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
export {
|
|
329
|
-
readLocationDirectoryFromSql,
|
|
330
|
-
readLocationDetailFromSql
|
|
331
|
-
};
|
package/dist/detail-ENVV4HIY.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
buildConversationDetail
|
|
3
|
-
} from "./chunk-FW7DVHTL.js";
|
|
4
|
-
import {
|
|
5
|
-
readConversationRecordFromSql
|
|
6
|
-
} from "./chunk-HRDWLE7Q.js";
|
|
7
|
-
import {
|
|
8
|
-
conversationDetailReportSchema
|
|
9
|
-
} from "./chunk-7LLRS2OK.js";
|
|
10
|
-
import "./chunk-LVUKF5CE.js";
|
|
11
|
-
import "./chunk-DEQZ23O3.js";
|
|
12
|
-
import {
|
|
13
|
-
listBoundedAgentTurnSessionSummariesForConversation
|
|
14
|
-
} from "./chunk-C4BT2P2K.js";
|
|
15
|
-
import "./chunk-BQCPAIAB.js";
|
|
16
|
-
import "./chunk-E2VS47AZ.js";
|
|
17
|
-
import "./chunk-PDO5BLNM.js";
|
|
18
|
-
import "./chunk-CCTCIISK.js";
|
|
19
|
-
import "./chunk-HOBDQQJY.js";
|
|
20
|
-
import "./chunk-4ZNGQH7C.js";
|
|
21
|
-
import "./chunk-M3UAVLEN.js";
|
|
22
|
-
import "./chunk-FXFQNHRU.js";
|
|
23
|
-
import "./chunk-RT5BUHR5.js";
|
|
24
|
-
import "./chunk-B7PUBQQM.js";
|
|
25
|
-
import {
|
|
26
|
-
logException
|
|
27
|
-
} from "./chunk-AEWZ7F65.js";
|
|
28
|
-
import "./chunk-OB42YVAE.js";
|
|
29
|
-
import "./chunk-6GWA276C.js";
|
|
30
|
-
import "./chunk-7FBGKXPE.js";
|
|
31
|
-
import "./chunk-MLKGABMK.js";
|
|
32
|
-
|
|
33
|
-
// src/api/conversations/detail.query.ts
|
|
34
|
-
async function readLatestRun(conversationId) {
|
|
35
|
-
try {
|
|
36
|
-
return (await listBoundedAgentTurnSessionSummariesForConversation(conversationId)).find((summary) => summary.modelId || summary.reasoningLevel);
|
|
37
|
-
} catch (error) {
|
|
38
|
-
logException(error, "conversation_execution_settings_read_failed", {
|
|
39
|
-
conversationId
|
|
40
|
-
});
|
|
41
|
-
return void 0;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
async function readConversationDetailFromSql(conversationId) {
|
|
45
|
-
const record = await readConversationRecordFromSql(conversationId);
|
|
46
|
-
if (!record) return void 0;
|
|
47
|
-
const [report, latestRun] = await Promise.all([
|
|
48
|
-
buildConversationDetail({
|
|
49
|
-
...record,
|
|
50
|
-
usage: record.usage ?? void 0
|
|
51
|
-
}),
|
|
52
|
-
readLatestRun(conversationId)
|
|
53
|
-
]);
|
|
54
|
-
return {
|
|
55
|
-
...report,
|
|
56
|
-
...latestRun?.modelId ? { modelId: latestRun.modelId } : {},
|
|
57
|
-
...latestRun?.reasoningLevel ? { reasoningLevel: latestRun.reasoningLevel } : {}
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// src/api/conversations/detail.ts
|
|
62
|
-
async function readConversationDetail(conversationId) {
|
|
63
|
-
const report = await readConversationDetailFromSql(conversationId);
|
|
64
|
-
return report ? conversationDetailReportSchema.parse(report) : void 0;
|
|
65
|
-
}
|
|
66
|
-
export {
|
|
67
|
-
readConversationDetail
|
|
68
|
-
};
|
package/dist/detail-UIOKVIET.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
readLocationDetailFromSql
|
|
3
|
-
} from "./chunk-VKFOVMZL.js";
|
|
4
|
-
import "./chunk-QOZOJNSE.js";
|
|
5
|
-
import "./chunk-6FPTHPXF.js";
|
|
6
|
-
import {
|
|
7
|
-
locationDetailReportSchema
|
|
8
|
-
} from "./chunk-GCGRQJR5.js";
|
|
9
|
-
import "./chunk-7LLRS2OK.js";
|
|
10
|
-
import "./chunk-PDO5BLNM.js";
|
|
11
|
-
import "./chunk-HOBDQQJY.js";
|
|
12
|
-
import "./chunk-M3UAVLEN.js";
|
|
13
|
-
import "./chunk-FXFQNHRU.js";
|
|
14
|
-
import "./chunk-RT5BUHR5.js";
|
|
15
|
-
import "./chunk-B7PUBQQM.js";
|
|
16
|
-
import "./chunk-AEWZ7F65.js";
|
|
17
|
-
import "./chunk-OB42YVAE.js";
|
|
18
|
-
import "./chunk-6GWA276C.js";
|
|
19
|
-
import "./chunk-7FBGKXPE.js";
|
|
20
|
-
import "./chunk-MLKGABMK.js";
|
|
21
|
-
|
|
22
|
-
// src/api/locations/detail.ts
|
|
23
|
-
async function readLocationDetail(locationId) {
|
|
24
|
-
const report = await readLocationDetailFromSql(locationId);
|
|
25
|
-
return report ? locationDetailReportSchema.parse(report) : void 0;
|
|
26
|
-
}
|
|
27
|
-
export {
|
|
28
|
-
readLocationDetail
|
|
29
|
-
};
|
package/dist/list-WR5U6JVM.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
readLocationDirectoryFromSql
|
|
3
|
-
} from "./chunk-VKFOVMZL.js";
|
|
4
|
-
import "./chunk-QOZOJNSE.js";
|
|
5
|
-
import "./chunk-6FPTHPXF.js";
|
|
6
|
-
import {
|
|
7
|
-
locationDirectoryReportSchema
|
|
8
|
-
} from "./chunk-GCGRQJR5.js";
|
|
9
|
-
import "./chunk-7LLRS2OK.js";
|
|
10
|
-
import "./chunk-PDO5BLNM.js";
|
|
11
|
-
import "./chunk-HOBDQQJY.js";
|
|
12
|
-
import "./chunk-M3UAVLEN.js";
|
|
13
|
-
import "./chunk-FXFQNHRU.js";
|
|
14
|
-
import "./chunk-RT5BUHR5.js";
|
|
15
|
-
import "./chunk-B7PUBQQM.js";
|
|
16
|
-
import "./chunk-AEWZ7F65.js";
|
|
17
|
-
import "./chunk-OB42YVAE.js";
|
|
18
|
-
import "./chunk-6GWA276C.js";
|
|
19
|
-
import "./chunk-7FBGKXPE.js";
|
|
20
|
-
import "./chunk-MLKGABMK.js";
|
|
21
|
-
|
|
22
|
-
// src/api/locations/list.ts
|
|
23
|
-
async function readLocationDirectory() {
|
|
24
|
-
return locationDirectoryReportSchema.parse(
|
|
25
|
-
await readLocationDirectoryFromSql()
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
readLocationDirectory
|
|
30
|
-
};
|
package/dist/list-XZ4HKQ4R.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
verifiedActorWhere
|
|
3
|
-
} from "./chunk-B43K4C5K.js";
|
|
4
|
-
import {
|
|
5
|
-
conversationActiveDaysColumn,
|
|
6
|
-
conversationAggregateColumns,
|
|
7
|
-
conversationRangeColumns
|
|
8
|
-
} from "./chunk-6FPTHPXF.js";
|
|
9
|
-
import {
|
|
10
|
-
actorDirectoryReportSchema
|
|
11
|
-
} from "./chunk-6LBNXC4F.js";
|
|
12
|
-
import "./chunk-7LLRS2OK.js";
|
|
13
|
-
import "./chunk-PDO5BLNM.js";
|
|
14
|
-
import {
|
|
15
|
-
getDb,
|
|
16
|
-
juniorConversations,
|
|
17
|
-
juniorIdentities,
|
|
18
|
-
juniorUsers
|
|
19
|
-
} from "./chunk-HOBDQQJY.js";
|
|
20
|
-
import "./chunk-M3UAVLEN.js";
|
|
21
|
-
import "./chunk-FXFQNHRU.js";
|
|
22
|
-
import "./chunk-RT5BUHR5.js";
|
|
23
|
-
import "./chunk-B7PUBQQM.js";
|
|
24
|
-
import "./chunk-AEWZ7F65.js";
|
|
25
|
-
import "./chunk-OB42YVAE.js";
|
|
26
|
-
import "./chunk-6GWA276C.js";
|
|
27
|
-
import "./chunk-7FBGKXPE.js";
|
|
28
|
-
import "./chunk-MLKGABMK.js";
|
|
29
|
-
|
|
30
|
-
// src/api/people/list.query.ts
|
|
31
|
-
import { and, eq, gte, sql } from "drizzle-orm";
|
|
32
|
-
var DIRECTORY_ACTIVITY_DAYS = 90;
|
|
33
|
-
function activityWindow(nowMs) {
|
|
34
|
-
const end = new Date(nowMs);
|
|
35
|
-
end.setUTCHours(0, 0, 0, 0);
|
|
36
|
-
const start = new Date(end);
|
|
37
|
-
start.setUTCDate(start.getUTCDate() - (DIRECTORY_ACTIVITY_DAYS - 1));
|
|
38
|
-
return { end, start };
|
|
39
|
-
}
|
|
40
|
-
function directoryActivityDays(rows, nowMs) {
|
|
41
|
-
const days = new Map(rows.map((row) => [row.date, row]));
|
|
42
|
-
const { end, start } = activityWindow(nowMs);
|
|
43
|
-
const items = [];
|
|
44
|
-
for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setUTCDate(cursor.getUTCDate() + 1)) {
|
|
45
|
-
const date = cursor.toISOString().slice(0, 10);
|
|
46
|
-
items.push(days.get(date) ?? { activePeople: 0, conversations: 0, date });
|
|
47
|
-
}
|
|
48
|
-
return items;
|
|
49
|
-
}
|
|
50
|
-
async function readPeopleListFromSql() {
|
|
51
|
-
const nowMs = Date.now();
|
|
52
|
-
const { end, start } = activityWindow(nowMs);
|
|
53
|
-
const activityDate = sql`TO_CHAR(
|
|
54
|
-
${juniorConversations.lastActivityAt} AT TIME ZONE 'UTC',
|
|
55
|
-
'YYYY-MM-DD'
|
|
56
|
-
)`;
|
|
57
|
-
const [rows, activityRows] = await Promise.all([
|
|
58
|
-
getDb().select({
|
|
59
|
-
email: juniorUsers.primaryEmailNormalized,
|
|
60
|
-
fullName: juniorUsers.displayName,
|
|
61
|
-
slackUserId: sql`MAX(${juniorIdentities.providerSubjectId})`,
|
|
62
|
-
slackUserName: sql`MAX(${juniorIdentities.handle})`,
|
|
63
|
-
activeDays: conversationActiveDaysColumn(),
|
|
64
|
-
...conversationAggregateColumns(),
|
|
65
|
-
...conversationRangeColumns()
|
|
66
|
-
}).from(juniorConversations).innerJoin(
|
|
67
|
-
juniorIdentities,
|
|
68
|
-
eq(juniorIdentities.id, juniorConversations.actorIdentityId)
|
|
69
|
-
).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(verifiedActorWhere()).groupBy(juniorUsers.primaryEmailNormalized, juniorUsers.displayName),
|
|
70
|
-
getDb().select({
|
|
71
|
-
activePeople: sql`COUNT(DISTINCT ${juniorUsers.id})::int`,
|
|
72
|
-
conversations: sql`COUNT(*)::int`,
|
|
73
|
-
date: activityDate
|
|
74
|
-
}).from(juniorConversations).innerJoin(
|
|
75
|
-
juniorIdentities,
|
|
76
|
-
eq(juniorIdentities.id, juniorConversations.actorIdentityId)
|
|
77
|
-
).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(
|
|
78
|
-
and(
|
|
79
|
-
verifiedActorWhere(),
|
|
80
|
-
gte(juniorConversations.lastActivityAt, start)
|
|
81
|
-
)
|
|
82
|
-
).groupBy(activityDate)
|
|
83
|
-
]);
|
|
84
|
-
const people = rows.map((row) => {
|
|
85
|
-
const actor = {
|
|
86
|
-
email: row.email,
|
|
87
|
-
...row.fullName ? { fullName: row.fullName } : {},
|
|
88
|
-
...row.slackUserId ? { slackUserId: row.slackUserId } : {},
|
|
89
|
-
...row.slackUserName ? { slackUserName: row.slackUserName } : {}
|
|
90
|
-
};
|
|
91
|
-
return {
|
|
92
|
-
active: row.active,
|
|
93
|
-
activeDays: row.activeDays,
|
|
94
|
-
conversations: row.conversations,
|
|
95
|
-
durationMs: row.durationMs,
|
|
96
|
-
failed: row.failed,
|
|
97
|
-
firstSeenAt: row.firstSeenAt.toISOString(),
|
|
98
|
-
lastSeenAt: row.lastSeenAt.toISOString(),
|
|
99
|
-
actor,
|
|
100
|
-
...row.tokens !== null ? { tokens: row.tokens } : {}
|
|
101
|
-
};
|
|
102
|
-
});
|
|
103
|
-
return {
|
|
104
|
-
activityDays: directoryActivityDays(activityRows, nowMs),
|
|
105
|
-
generatedAt: new Date(nowMs).toISOString(),
|
|
106
|
-
people: people.sort(
|
|
107
|
-
(left, right) => Date.parse(right.lastSeenAt) - Date.parse(left.lastSeenAt) || right.conversations - left.conversations || left.actor.email.localeCompare(right.actor.email)
|
|
108
|
-
),
|
|
109
|
-
source: "conversation_index",
|
|
110
|
-
windowEnd: end.toISOString(),
|
|
111
|
-
windowStart: start.toISOString()
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// src/api/people/list.ts
|
|
116
|
-
async function readPeopleList() {
|
|
117
|
-
return actorDirectoryReportSchema.parse(await readPeopleListFromSql());
|
|
118
|
-
}
|
|
119
|
-
export {
|
|
120
|
-
readPeopleList
|
|
121
|
-
};
|
package/dist/list-ZOUSMSEH.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
readConversationFeedFromSql
|
|
3
|
-
} from "./chunk-HRDWLE7Q.js";
|
|
4
|
-
import {
|
|
5
|
-
conversationFeedSchema
|
|
6
|
-
} from "./chunk-7LLRS2OK.js";
|
|
7
|
-
import "./chunk-DEQZ23O3.js";
|
|
8
|
-
import "./chunk-PDO5BLNM.js";
|
|
9
|
-
import "./chunk-CCTCIISK.js";
|
|
10
|
-
import "./chunk-HOBDQQJY.js";
|
|
11
|
-
import "./chunk-4ZNGQH7C.js";
|
|
12
|
-
import "./chunk-M3UAVLEN.js";
|
|
13
|
-
import "./chunk-FXFQNHRU.js";
|
|
14
|
-
import "./chunk-RT5BUHR5.js";
|
|
15
|
-
import "./chunk-B7PUBQQM.js";
|
|
16
|
-
import "./chunk-AEWZ7F65.js";
|
|
17
|
-
import "./chunk-OB42YVAE.js";
|
|
18
|
-
import "./chunk-6GWA276C.js";
|
|
19
|
-
import "./chunk-7FBGKXPE.js";
|
|
20
|
-
import "./chunk-MLKGABMK.js";
|
|
21
|
-
|
|
22
|
-
// src/api/conversations/list.ts
|
|
23
|
-
async function readConversationFeed(options = {}) {
|
|
24
|
-
return conversationFeedSchema.parse(
|
|
25
|
-
await readConversationFeedFromSql({ actorEmail: options.actorEmail })
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
readConversationFeed
|
|
30
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
readConversationFeedFromSql
|
|
3
|
-
} from "./chunk-HRDWLE7Q.js";
|
|
4
|
-
import "./chunk-DEQZ23O3.js";
|
|
5
|
-
import "./chunk-CCTCIISK.js";
|
|
6
|
-
import "./chunk-HOBDQQJY.js";
|
|
7
|
-
import "./chunk-4ZNGQH7C.js";
|
|
8
|
-
import "./chunk-M3UAVLEN.js";
|
|
9
|
-
import "./chunk-FXFQNHRU.js";
|
|
10
|
-
import "./chunk-RT5BUHR5.js";
|
|
11
|
-
import "./chunk-B7PUBQQM.js";
|
|
12
|
-
import "./chunk-AEWZ7F65.js";
|
|
13
|
-
import "./chunk-OB42YVAE.js";
|
|
14
|
-
import "./chunk-6GWA276C.js";
|
|
15
|
-
import "./chunk-7FBGKXPE.js";
|
|
16
|
-
import "./chunk-MLKGABMK.js";
|
|
17
|
-
|
|
18
|
-
// src/reporting/plugin-conversations.ts
|
|
19
|
-
async function listRecentConversationSummaries(requestedLimit = 25) {
|
|
20
|
-
const limit = Math.max(0, Math.min(100, Math.floor(requestedLimit)));
|
|
21
|
-
const feed = await readConversationFeedFromSql({ limit });
|
|
22
|
-
return feed.conversations.map((report) => {
|
|
23
|
-
return {
|
|
24
|
-
conversationId: report.conversationId,
|
|
25
|
-
displayTitle: report.displayTitle,
|
|
26
|
-
lastActivityAt: report.lastSeenAt,
|
|
27
|
-
lastUpdatedAt: report.lastProgressAt,
|
|
28
|
-
status: report.status,
|
|
29
|
-
...report.channelName ? { channelName: report.channelName } : {},
|
|
30
|
-
...report.channelNameRedacted ? { channelNameRedacted: true } : {},
|
|
31
|
-
source: report.surface
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
export {
|
|
36
|
-
listRecentConversationSummaries
|
|
37
|
-
};
|