@sentry/junior 0.99.0 → 0.100.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-OSW6C3CJ.js → agent-hooks-V6KU7PQN.js} +6 -5
- package/dist/api/activity.d.ts +14 -0
- package/dist/api/conversations/aggregate.d.ts +16 -0
- package/dist/api/conversations/detail-projection.d.ts +1 -0
- package/dist/api/conversations/list.query.d.ts +3 -0
- package/dist/api/conversations/projection.d.ts +1 -0
- package/dist/api/conversations/reporting.d.ts +42 -0
- package/dist/api/conversations/schema.d.ts +7 -7
- package/dist/api/conversations/stats.query.d.ts +1 -1
- package/dist/api/locations/detail.d.ts +81 -0
- package/dist/api/locations/list.d.ts +30 -0
- package/dist/api/locations/query.d.ts +5 -0
- package/dist/api/locations/schema.d.ts +175 -0
- package/dist/api/people/list.query.d.ts +1 -1
- package/dist/api/people/profile.query.d.ts +1 -1
- package/dist/api/people/schema.d.ts +10 -14
- package/dist/api/people/shared.d.ts +38 -78
- package/dist/api/schema.d.ts +8 -0
- package/dist/api/schema.js +14 -3
- package/dist/api.js +24 -11
- package/dist/app.js +25 -19
- package/dist/chat/agent/request.d.ts +3 -0
- package/dist/chat/config.d.ts +2 -0
- package/dist/chat/reasoning-level.d.ts +4 -0
- package/dist/chat/services/{turn-thinking-level.d.ts → turn-reasoning-level.d.ts} +11 -10
- package/dist/chat/services/turn-result.d.ts +3 -3
- package/dist/chat/tools/search-tools.d.ts +2 -2
- package/dist/{chunk-T55RBE4Z.js → chunk-2RNOB32R.js} +3 -1
- package/dist/{chunk-NJEDJFK4.js → chunk-2T7DCRAW.js} +1 -1
- package/dist/{chunk-PYK7R5A7.js → chunk-45DMFMY2.js} +66 -65
- package/dist/chunk-4AQUWWEM.js +75 -0
- package/dist/{chunk-EEZCY5WX.js → chunk-A7X2FDUO.js} +18 -2
- package/dist/{chunk-WTYEKPXU.js → chunk-FP5N5OWZ.js} +1 -1
- package/dist/chunk-FXFQNHRU.js +48 -0
- package/dist/chunk-GEUUJRQF.js +102 -0
- package/dist/{chunk-CRQVIHDI.js → chunk-IDZBM3NW.js} +2 -8
- package/dist/{chunk-DHHU2WSG.js → chunk-IQIBZXGB.js} +2 -2
- package/dist/{chunk-OL6XQ23W.js → chunk-IVXL57YF.js} +3 -3
- package/dist/{chunk-IO65E4ZD.js → chunk-JPQISMMJ.js} +3 -3
- package/dist/{chunk-KFUSLFLL.js → chunk-JSAANELJ.js} +11 -4
- package/dist/{chunk-EUZ44ROE.js → chunk-MM5UFDAC.js} +1 -3
- package/dist/{chunk-WJ7STXT6.js → chunk-NSOCZGOH.js} +3 -3
- package/dist/chunk-PGGEOCQY.js +77 -0
- package/dist/{chunk-EOWXRY5E.js → chunk-PWC24W5F.js} +1 -1
- package/dist/chunk-QOZOJNSE.js +96 -0
- package/dist/chunk-QSBQJ3PA.js +275 -0
- package/dist/{chunk-FTTFV6DC.js → chunk-TPTJEHUE.js} +4 -4
- package/dist/{chunk-OGHXZ4KQ.js → chunk-VHRM6GNH.js} +88 -122
- package/dist/{chunk-NG2AV7IB.js → chunk-VVIXK2BX.js} +1 -1
- package/dist/{chunk-ZZUBLPXD.js → chunk-VY7BT4SM.js} +5 -4
- package/dist/{chunk-H66UCBPW.js → chunk-XJA7BPHS.js} +1 -1
- package/dist/{chunk-ER45IV77.js → chunk-XSBIISXS.js} +9 -9
- package/dist/cli/chat.js +15 -14
- package/dist/cli/plugins.js +6 -5
- package/dist/cli/snapshot-warmup.js +2 -2
- package/dist/cli/upgrade.js +8 -7
- package/dist/db/schema/conversations.d.ts +17 -0
- package/dist/db/schema/destinations.d.ts +12 -3
- package/dist/db/schema.d.ts +19 -2
- package/dist/{db-GFSCDAHS.js → db-RCZB7KNM.js} +3 -2
- package/dist/detail-5SLCGT6J.js +29 -0
- package/dist/{detail-Q4IVDNGS.js → detail-LU6COZO6.js} +11 -10
- package/dist/{legacy-import-6WWXMALY.js → legacy-import-VCYLWT2V.js} +4 -3
- package/dist/list-2FI5SFV7.js +80 -0
- package/dist/list-4ALSU6ZW.js +30 -0
- package/dist/{list-A3F5JDYV.js → list-KHRAWZWU.js} +7 -6
- package/dist/{plugin-conversations-PDCQWU3O.js → plugin-conversations-JANXC4GA.js} +6 -5
- package/dist/profile-3O3OVENT.js +212 -0
- package/dist/{runner-267ZRLZD.js → runner-BM7D35YW.js} +12 -11
- package/dist/stats-J3YGCYDF.js +174 -0
- package/dist/{subagent-UN3MP6LV.js → subagent-P7HOSMVC.js} +10 -9
- package/migrations/0003_peaceful_scalphunter.sql +4 -0
- package/migrations/meta/0003_snapshot.json +1035 -0
- package/migrations/meta/_journal.json +8 -1
- package/package.json +5 -5
- package/dist/chunk-CV22LUIV.js +0 -261
- package/dist/list-M5BRWW3D.js +0 -92
- package/dist/profile-UEIRSVT3.js +0 -146
- package/dist/stats-L62E4O4U.js +0 -207
package/dist/stats-L62E4O4U.js
DELETED
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
conversationStatsReportSchema
|
|
3
|
-
} from "./chunk-EUZ44ROE.js";
|
|
4
|
-
import "./chunk-PDO5BLNM.js";
|
|
5
|
-
import {
|
|
6
|
-
getDb,
|
|
7
|
-
juniorConversations,
|
|
8
|
-
juniorDestinations,
|
|
9
|
-
juniorIdentities,
|
|
10
|
-
juniorUsers
|
|
11
|
-
} from "./chunk-OGHXZ4KQ.js";
|
|
12
|
-
import "./chunk-EEZCY5WX.js";
|
|
13
|
-
import "./chunk-LVA4I4H7.js";
|
|
14
|
-
import "./chunk-B7PUBQQM.js";
|
|
15
|
-
import "./chunk-I35CTGPO.js";
|
|
16
|
-
import "./chunk-OB42YVAE.js";
|
|
17
|
-
import "./chunk-6GWA276C.js";
|
|
18
|
-
import "./chunk-7FBGKXPE.js";
|
|
19
|
-
import "./chunk-MLKGABMK.js";
|
|
20
|
-
|
|
21
|
-
// src/api/conversations/stats.query.ts
|
|
22
|
-
import { and, asc, desc, eq, gte, isNull, lte } from "drizzle-orm";
|
|
23
|
-
var SAMPLE_LIMIT = 5e3;
|
|
24
|
-
var WINDOW_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
25
|
-
function emptyStatsItem(label) {
|
|
26
|
-
return {
|
|
27
|
-
active: 0,
|
|
28
|
-
conversations: 0,
|
|
29
|
-
durationMs: 0,
|
|
30
|
-
failed: 0,
|
|
31
|
-
label
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function addUsd(current, next) {
|
|
35
|
-
return Math.round(((current ?? 0) + next) * 1e12) / 1e12;
|
|
36
|
-
}
|
|
37
|
-
function actorLabel(row) {
|
|
38
|
-
return row.userEmail?.trim() || row.identityEmail?.trim() || row.userDisplayName?.trim() || row.identityDisplayName?.trim() || row.identityHandle?.trim() || row.identitySubjectId?.trim() || "Unknown";
|
|
39
|
-
}
|
|
40
|
-
function surfaceLabel(source) {
|
|
41
|
-
if (source === "scheduler") return "Scheduler";
|
|
42
|
-
if (source === "api") return "API";
|
|
43
|
-
if (source === "internal" || source === "local") return "Internal";
|
|
44
|
-
return "Conversation";
|
|
45
|
-
}
|
|
46
|
-
function locationLabel(row) {
|
|
47
|
-
if (row.destinationProvider !== "slack") {
|
|
48
|
-
return surfaceLabel(row.source);
|
|
49
|
-
}
|
|
50
|
-
if (row.destinationKind === "dm") {
|
|
51
|
-
return "Direct Message";
|
|
52
|
-
}
|
|
53
|
-
if (row.destinationVisibility !== "public") {
|
|
54
|
-
return "Private Conversation";
|
|
55
|
-
}
|
|
56
|
-
const name = (row.channelName ?? row.destinationDisplayName)?.trim().replace(/^#/, "");
|
|
57
|
-
return name ? `#${name}` : "Public Channel";
|
|
58
|
-
}
|
|
59
|
-
function signals(row) {
|
|
60
|
-
if (row.executionStatus === "failed") {
|
|
61
|
-
return { active: false, failed: true };
|
|
62
|
-
}
|
|
63
|
-
if (row.executionStatus === "idle") {
|
|
64
|
-
return { active: false, failed: false };
|
|
65
|
-
}
|
|
66
|
-
return { active: true, failed: false };
|
|
67
|
-
}
|
|
68
|
-
function addConversation(map, label, rowSignals, metrics) {
|
|
69
|
-
const item = map.get(label) ?? emptyStatsItem(label);
|
|
70
|
-
item.conversations += 1;
|
|
71
|
-
item.durationMs += metrics.durationMs;
|
|
72
|
-
if (metrics.tokens !== void 0) {
|
|
73
|
-
item.tokens = (item.tokens ?? 0) + metrics.tokens;
|
|
74
|
-
}
|
|
75
|
-
if (metrics.costUsd !== void 0) {
|
|
76
|
-
item.costUsd = addUsd(item.costUsd, metrics.costUsd);
|
|
77
|
-
}
|
|
78
|
-
item.active += rowSignals.active ? 1 : 0;
|
|
79
|
-
item.failed += rowSignals.failed ? 1 : 0;
|
|
80
|
-
map.set(label, item);
|
|
81
|
-
}
|
|
82
|
-
function statsItems(map) {
|
|
83
|
-
return [...map.values()].sort(
|
|
84
|
-
(left, right) => right.conversations - left.conversations || left.label.localeCompare(right.label)
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
async function statsRows(db, start, end) {
|
|
88
|
-
return db.select({
|
|
89
|
-
channelName: juniorConversations.channelName,
|
|
90
|
-
destinationDisplayName: juniorDestinations.displayName,
|
|
91
|
-
destinationKind: juniorDestinations.kind,
|
|
92
|
-
destinationProvider: juniorDestinations.provider,
|
|
93
|
-
destinationVisibility: juniorDestinations.visibility,
|
|
94
|
-
durationMs: juniorConversations.durationMs,
|
|
95
|
-
executionStatus: juniorConversations.executionStatus,
|
|
96
|
-
identityDisplayName: juniorIdentities.displayName,
|
|
97
|
-
identityEmail: juniorIdentities.emailNormalized,
|
|
98
|
-
identityHandle: juniorIdentities.handle,
|
|
99
|
-
identitySubjectId: juniorIdentities.providerSubjectId,
|
|
100
|
-
source: juniorConversations.source,
|
|
101
|
-
usage: juniorConversations.usage,
|
|
102
|
-
userDisplayName: juniorUsers.displayName,
|
|
103
|
-
userEmail: juniorUsers.primaryEmailNormalized
|
|
104
|
-
}).from(juniorConversations).leftJoin(
|
|
105
|
-
juniorIdentities,
|
|
106
|
-
eq(juniorIdentities.id, juniorConversations.actorIdentityId)
|
|
107
|
-
).leftJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).leftJoin(
|
|
108
|
-
juniorDestinations,
|
|
109
|
-
eq(juniorDestinations.id, juniorConversations.destinationId)
|
|
110
|
-
).where(
|
|
111
|
-
and(
|
|
112
|
-
isNull(juniorConversations.parentConversationId),
|
|
113
|
-
gte(juniorConversations.lastActivityAt, start),
|
|
114
|
-
lte(juniorConversations.lastActivityAt, end)
|
|
115
|
-
)
|
|
116
|
-
).orderBy(
|
|
117
|
-
desc(juniorConversations.lastActivityAt),
|
|
118
|
-
asc(juniorConversations.conversationId)
|
|
119
|
-
).limit(SAMPLE_LIMIT);
|
|
120
|
-
}
|
|
121
|
-
function usageTokens(usage) {
|
|
122
|
-
if (!usage) return void 0;
|
|
123
|
-
if (usage.totalTokens !== void 0) return usage.totalTokens;
|
|
124
|
-
const values = [
|
|
125
|
-
usage.inputTokens,
|
|
126
|
-
usage.outputTokens,
|
|
127
|
-
usage.cachedInputTokens,
|
|
128
|
-
usage.cacheCreationTokens
|
|
129
|
-
].filter((value) => value !== void 0);
|
|
130
|
-
return values.length > 0 ? values.reduce((sum, value) => sum + value, 0) : void 0;
|
|
131
|
-
}
|
|
132
|
-
function usageCostUsd(usage) {
|
|
133
|
-
const cost = usage?.cost;
|
|
134
|
-
if (!cost) return void 0;
|
|
135
|
-
if (cost.total !== void 0) return cost.total;
|
|
136
|
-
const values = [
|
|
137
|
-
cost.input,
|
|
138
|
-
cost.output,
|
|
139
|
-
cost.cacheRead,
|
|
140
|
-
cost.cacheWrite
|
|
141
|
-
].filter((value) => value !== void 0);
|
|
142
|
-
return values.length > 0 ? values.reduce((sum, value) => sum + value, 0) : void 0;
|
|
143
|
-
}
|
|
144
|
-
async function readConversationStatsFromSql() {
|
|
145
|
-
const nowMs = Date.now();
|
|
146
|
-
const windowStartMs = nowMs - WINDOW_MS;
|
|
147
|
-
const rows = await statsRows(
|
|
148
|
-
getDb(),
|
|
149
|
-
new Date(windowStartMs),
|
|
150
|
-
new Date(nowMs)
|
|
151
|
-
);
|
|
152
|
-
const actors = /* @__PURE__ */ new Map();
|
|
153
|
-
const locations = /* @__PURE__ */ new Map();
|
|
154
|
-
let active = 0;
|
|
155
|
-
let costUsd;
|
|
156
|
-
let durationMs = 0;
|
|
157
|
-
let failed = 0;
|
|
158
|
-
let tokens;
|
|
159
|
-
for (const row of rows) {
|
|
160
|
-
const rowSignals = signals(row);
|
|
161
|
-
active += rowSignals.active ? 1 : 0;
|
|
162
|
-
failed += rowSignals.failed ? 1 : 0;
|
|
163
|
-
const rowTokens = usageTokens(row.usage);
|
|
164
|
-
const rowCostUsd = usageCostUsd(row.usage);
|
|
165
|
-
const metrics = {
|
|
166
|
-
...rowCostUsd !== void 0 ? { costUsd: rowCostUsd } : {},
|
|
167
|
-
durationMs: row.durationMs,
|
|
168
|
-
...rowTokens !== void 0 ? { tokens: rowTokens } : {}
|
|
169
|
-
};
|
|
170
|
-
durationMs += metrics.durationMs;
|
|
171
|
-
if (metrics.tokens !== void 0) {
|
|
172
|
-
tokens = (tokens ?? 0) + metrics.tokens;
|
|
173
|
-
}
|
|
174
|
-
if (metrics.costUsd !== void 0) {
|
|
175
|
-
costUsd = addUsd(costUsd, metrics.costUsd);
|
|
176
|
-
}
|
|
177
|
-
addConversation(actors, actorLabel(row), rowSignals, metrics);
|
|
178
|
-
addConversation(locations, locationLabel(row), rowSignals, metrics);
|
|
179
|
-
}
|
|
180
|
-
return {
|
|
181
|
-
active,
|
|
182
|
-
conversations: rows.length,
|
|
183
|
-
durationMs,
|
|
184
|
-
failed,
|
|
185
|
-
generatedAt: new Date(nowMs).toISOString(),
|
|
186
|
-
locations: statsItems(locations),
|
|
187
|
-
actors: statsItems(actors),
|
|
188
|
-
sampleLimit: SAMPLE_LIMIT,
|
|
189
|
-
sampleSize: rows.length,
|
|
190
|
-
source: "conversation_index",
|
|
191
|
-
...costUsd !== void 0 ? { costUsd } : {},
|
|
192
|
-
...tokens !== void 0 ? { tokens } : {},
|
|
193
|
-
truncated: rows.length >= SAMPLE_LIMIT,
|
|
194
|
-
windowEnd: new Date(nowMs).toISOString(),
|
|
195
|
-
windowStart: new Date(windowStartMs).toISOString()
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// src/api/conversations/stats.ts
|
|
200
|
-
async function readConversationStats() {
|
|
201
|
-
return conversationStatsReportSchema.parse(
|
|
202
|
-
await readConversationStatsFromSql()
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
export {
|
|
206
|
-
readConversationStats
|
|
207
|
-
};
|