@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.
- package/dist/{agent-hooks-I4I2DHSW.js → agent-hooks-EOFSY2PD.js} +5 -5
- 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 +88 -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 +4 -4
- 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 +120 -162
- 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/sandbox/runtime-dependencies.d.ts +2 -0
- package/dist/chat/sandbox/sandbox.d.ts +1 -0
- package/dist/chat/services/provider-retry.d.ts +1 -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-ZSHL44IQ.js → chunk-4PDVOHXP.js} +1 -1
- package/dist/{chunk-3OABPOHR.js → chunk-7G4J3CR7.js} +11 -2
- package/dist/chunk-AIRE7Q2W.js +362 -0
- package/dist/{chunk-QZGVPPIJ.js → chunk-BCULHGZK.js} +24 -4
- package/dist/{chunk-IQ36I3DF.js → chunk-CCTCIISK.js} +1 -1
- package/dist/{chunk-SHBPSE7A.js → chunk-M3UAVLEN.js} +2 -3
- package/dist/{chunk-EMUZSROX.js → chunk-O7ILGCMJ.js} +78 -1
- package/dist/{chunk-EOB77KME.js → chunk-QDKRE3LS.js} +340 -9
- package/dist/{chunk-DTUSCR2Y.js → chunk-QVTVCJR4.js} +7 -7
- package/dist/{chunk-5K4N73TP.js → chunk-RMZ65YAA.js} +3 -3
- package/dist/{chunk-VSAFV2GI.js → chunk-RYDF4GOX.js} +3 -3
- package/dist/{chunk-ZIX4PNBI.js → chunk-TMWUGGSA.js} +37 -35
- package/dist/{chunk-3UK5DFKW.js → chunk-U26ZWZCN.js} +1 -1
- package/dist/{chunk-X2IPNCB5.js → chunk-VDHMFCDY.js} +65 -12
- package/dist/cli/chat.js +13 -14
- package/dist/cli/plugins.js +6 -6
- package/dist/cli/snapshot-warmup.js +7 -3
- package/dist/cli/upgrade.js +6 -7
- package/dist/db/schema/conversations.d.ts +17 -0
- package/dist/db/schema.d.ts +17 -0
- package/dist/{db-6QP6HY7U.js → db-PDMC67T3.js} +2 -2
- package/dist/{legacy-import-R3BMM2GH.js → legacy-import-G333RHJZ.js} +3 -3
- package/dist/reporting-schema.d.ts +4 -4
- package/dist/{runner-C2ZTIOUD.js → runner-6A7MQRUE.js} +9 -10
- 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-4XNQSJAX.js +0 -331
- package/dist/chunk-4YN2ZXKB.js +0 -66
- package/dist/chunk-B5QS4AVO.js +0 -319
- package/dist/chunk-F4CQEUTP.js +0 -77
- package/dist/chunk-HYDQULR2.js +0 -214
- package/dist/chunk-KFP3TZOS.js +0 -102
- package/dist/chunk-LJB2TLVT.js +0 -273
- package/dist/chunk-LVUKF5CE.js +0 -63
- package/dist/chunk-NSP6OGL2.js +0 -671
- package/dist/chunk-QNVHH5PU.js +0 -20
- package/dist/chunk-QOZOJNSE.js +0 -96
- package/dist/chunk-WPHCUGN7.js +0 -84
- package/dist/detail-OEIVZYXS.js +0 -68
- package/dist/detail-V37NTVBN.js +0 -29
- package/dist/list-AJ6RWBOG.js +0 -30
- package/dist/list-FWLIZHSW.js +0 -30
- package/dist/list-NTUT6A5M.js +0 -121
- package/dist/plugin-conversations-F3IBVNFX.js +0 -37
- package/dist/profile-3FRQP4HP.js +0 -212
- package/dist/reporting/plugin-conversations.d.ts +0 -3
- package/dist/stats-7UFY6FPE.js +0 -174
- package/dist/subagent-X3ZWJHR4.js +0 -49
package/dist/chunk-KFP3TZOS.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getDb,
|
|
3
|
-
juniorConversations,
|
|
4
|
-
juniorIdentities,
|
|
5
|
-
juniorUsers
|
|
6
|
-
} from "./chunk-QZGVPPIJ.js";
|
|
7
|
-
import {
|
|
8
|
-
juniorDestinations
|
|
9
|
-
} from "./chunk-FXFQNHRU.js";
|
|
10
|
-
|
|
11
|
-
// src/api/people/shared.ts
|
|
12
|
-
import { and, asc, desc, eq, sql } from "drizzle-orm";
|
|
13
|
-
var RECENT_LIMIT = 25;
|
|
14
|
-
var ACTIVITY_DAYS = 90;
|
|
15
|
-
function normalizeEmail(email) {
|
|
16
|
-
const normalized = email?.trim().toLowerCase();
|
|
17
|
-
return normalized || void 0;
|
|
18
|
-
}
|
|
19
|
-
function emptyTotals() {
|
|
20
|
-
return {
|
|
21
|
-
active: 0,
|
|
22
|
-
activeDays: 0,
|
|
23
|
-
conversations: 0,
|
|
24
|
-
durationMs: 0,
|
|
25
|
-
failed: 0
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function emptyActivityDay(date) {
|
|
29
|
-
return {
|
|
30
|
-
active: 0,
|
|
31
|
-
conversations: 0,
|
|
32
|
-
date,
|
|
33
|
-
durationMs: 0,
|
|
34
|
-
failed: 0
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function activityDays(days, nowMs) {
|
|
38
|
-
const items = [];
|
|
39
|
-
const end = new Date(nowMs);
|
|
40
|
-
end.setUTCHours(0, 0, 0, 0);
|
|
41
|
-
const start = new Date(end);
|
|
42
|
-
start.setUTCDate(start.getUTCDate() - (ACTIVITY_DAYS - 1));
|
|
43
|
-
for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setUTCDate(cursor.getUTCDate() + 1)) {
|
|
44
|
-
const date = cursor.toISOString().slice(0, 10);
|
|
45
|
-
items.push(days.get(date) ?? emptyActivityDay(date));
|
|
46
|
-
}
|
|
47
|
-
return items;
|
|
48
|
-
}
|
|
49
|
-
function statsItems(map) {
|
|
50
|
-
return [...map.values()].sort(
|
|
51
|
-
(left, right) => right.conversations - left.conversations || right.durationMs - left.durationMs || left.label.localeCompare(right.label)
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
function verifiedActorWhere(email) {
|
|
55
|
-
const normalizedEmail = normalizeEmail(email);
|
|
56
|
-
return and(
|
|
57
|
-
eq(juniorIdentities.provider, "slack"),
|
|
58
|
-
eq(juniorIdentities.emailVerified, true),
|
|
59
|
-
sql`${juniorUsers.primaryEmailNormalized} IS NOT NULL`,
|
|
60
|
-
normalizedEmail ? eq(juniorUsers.primaryEmailNormalized, normalizedEmail) : void 0
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
async function recentActorRows(email) {
|
|
64
|
-
return getDb().select({
|
|
65
|
-
channelName: juniorConversations.channelName,
|
|
66
|
-
conversationId: juniorConversations.conversationId,
|
|
67
|
-
createdAt: juniorConversations.createdAt,
|
|
68
|
-
destinationId: juniorDestinations.id,
|
|
69
|
-
destinationVisibility: juniorDestinations.visibility,
|
|
70
|
-
durationMs: juniorConversations.durationMs,
|
|
71
|
-
email: juniorUsers.primaryEmailNormalized,
|
|
72
|
-
executionStatus: juniorConversations.executionStatus,
|
|
73
|
-
executionUpdatedAt: juniorConversations.executionUpdatedAt,
|
|
74
|
-
fullName: juniorUsers.displayName,
|
|
75
|
-
handle: juniorIdentities.handle,
|
|
76
|
-
lastActivityAt: juniorConversations.lastActivityAt,
|
|
77
|
-
providerSubjectId: juniorIdentities.providerSubjectId,
|
|
78
|
-
source: juniorConversations.source,
|
|
79
|
-
title: juniorConversations.title,
|
|
80
|
-
updatedAt: juniorConversations.updatedAt,
|
|
81
|
-
usage: juniorConversations.usage
|
|
82
|
-
}).from(juniorConversations).innerJoin(
|
|
83
|
-
juniorIdentities,
|
|
84
|
-
eq(juniorIdentities.id, juniorConversations.actorIdentityId)
|
|
85
|
-
).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).leftJoin(
|
|
86
|
-
juniorDestinations,
|
|
87
|
-
eq(juniorDestinations.id, juniorConversations.destinationId)
|
|
88
|
-
).where(verifiedActorWhere(email)).orderBy(
|
|
89
|
-
desc(juniorConversations.lastActivityAt),
|
|
90
|
-
asc(juniorConversations.conversationId)
|
|
91
|
-
).limit(RECENT_LIMIT);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export {
|
|
95
|
-
ACTIVITY_DAYS,
|
|
96
|
-
normalizeEmail,
|
|
97
|
-
emptyTotals,
|
|
98
|
-
activityDays,
|
|
99
|
-
statsItems,
|
|
100
|
-
verifiedActorWhere,
|
|
101
|
-
recentActorRows
|
|
102
|
-
};
|
package/dist/chunk-LJB2TLVT.js
DELETED
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
formatSlackConversationRedactedLabel,
|
|
3
|
-
resolveSlackConversationContextFromThreadId
|
|
4
|
-
} from "./chunk-EMUZSROX.js";
|
|
5
|
-
import {
|
|
6
|
-
getDb,
|
|
7
|
-
juniorConversations,
|
|
8
|
-
juniorIdentities
|
|
9
|
-
} from "./chunk-QZGVPPIJ.js";
|
|
10
|
-
import {
|
|
11
|
-
juniorDestinations
|
|
12
|
-
} from "./chunk-FXFQNHRU.js";
|
|
13
|
-
import {
|
|
14
|
-
parseSlackThreadId,
|
|
15
|
-
resolveConversationPrivacy
|
|
16
|
-
} from "./chunk-RT5BUHR5.js";
|
|
17
|
-
|
|
18
|
-
// src/api/conversations/list.query.ts
|
|
19
|
-
import { and, asc, desc, eq, isNull } from "drizzle-orm";
|
|
20
|
-
|
|
21
|
-
// src/api/conversations/shared.ts
|
|
22
|
-
function slackStatsLocationLabel(input) {
|
|
23
|
-
const channelId = input.channel;
|
|
24
|
-
if (!channelId) return void 0;
|
|
25
|
-
if (input.channelNameRedacted && input.channelName) {
|
|
26
|
-
return input.channelName;
|
|
27
|
-
}
|
|
28
|
-
const name = input.channelName?.replace(/^#/, "");
|
|
29
|
-
if (channelId.startsWith("D")) return "Direct Message";
|
|
30
|
-
if (channelId.startsWith("C")) return name ? `#${name}` : "Public Channel";
|
|
31
|
-
if (channelId.startsWith("G")) {
|
|
32
|
-
if (name?.startsWith("mpdm-")) return "Group DM";
|
|
33
|
-
return "Private Channel";
|
|
34
|
-
}
|
|
35
|
-
return name || channelId;
|
|
36
|
-
}
|
|
37
|
-
function surfaceFallbackLabel(surface) {
|
|
38
|
-
if (surface === "scheduler") return "Scheduler";
|
|
39
|
-
if (surface === "api") return "API";
|
|
40
|
-
if (surface === "internal") return "Internal";
|
|
41
|
-
return "Conversation";
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// src/api/conversations/projection.ts
|
|
45
|
-
var PRIVATE_CONVERSATION_LABEL = "Private Conversation";
|
|
46
|
-
function privateConversationLabel(slackConversation) {
|
|
47
|
-
if (!slackConversation) {
|
|
48
|
-
return PRIVATE_CONVERSATION_LABEL;
|
|
49
|
-
}
|
|
50
|
-
return slackConversation.visibility === "private" ? formatSlackConversationRedactedLabel(slackConversation) ?? PRIVATE_CONVERSATION_LABEL : PRIVATE_CONVERSATION_LABEL;
|
|
51
|
-
}
|
|
52
|
-
function surfaceFromConversationId(conversationId) {
|
|
53
|
-
if (parseSlackThreadId(conversationId)) return "slack";
|
|
54
|
-
if (conversationId.startsWith("scheduler:")) return "scheduler";
|
|
55
|
-
if (conversationId.startsWith("api:")) return "api";
|
|
56
|
-
return "internal";
|
|
57
|
-
}
|
|
58
|
-
function surfaceFromSource(source, conversationId) {
|
|
59
|
-
if (source === "slack" || source === "api" || source === "scheduler") {
|
|
60
|
-
return source;
|
|
61
|
-
}
|
|
62
|
-
return surfaceFromConversationId(conversationId);
|
|
63
|
-
}
|
|
64
|
-
function actorIdentityReport(actor) {
|
|
65
|
-
if (!actor) return void 0;
|
|
66
|
-
const identity = {
|
|
67
|
-
...actor.email !== void 0 ? { email: actor.email } : {},
|
|
68
|
-
...actor.fullName !== void 0 ? { fullName: actor.fullName } : {},
|
|
69
|
-
...actor.slackUserId !== void 0 ? { slackUserId: actor.slackUserId } : {},
|
|
70
|
-
...actor.slackUserName !== void 0 ? { slackUserName: actor.slackUserName } : {}
|
|
71
|
-
};
|
|
72
|
-
return Object.keys(identity).length > 0 ? identity : void 0;
|
|
73
|
-
}
|
|
74
|
-
function statusFromConversation(conversation) {
|
|
75
|
-
if (conversation.execution.status === "idle") {
|
|
76
|
-
return "completed";
|
|
77
|
-
}
|
|
78
|
-
if (conversation.execution.status === "failed") {
|
|
79
|
-
return "failed";
|
|
80
|
-
}
|
|
81
|
-
return "active";
|
|
82
|
-
}
|
|
83
|
-
function titleFromConversation(args) {
|
|
84
|
-
const slackThread = parseSlackThreadId(args.conversation.conversationId);
|
|
85
|
-
const effectiveChannelName = args.conversation.channelName;
|
|
86
|
-
const slackConversation = resolveSlackConversationContextFromThreadId({
|
|
87
|
-
threadId: args.conversation.conversationId,
|
|
88
|
-
channelName: effectiveChannelName
|
|
89
|
-
});
|
|
90
|
-
const privateLabel = resolveConversationPrivacy({
|
|
91
|
-
conversationId: args.conversation.conversationId,
|
|
92
|
-
visibility: args.conversation.visibility
|
|
93
|
-
}) !== "public" ? privateConversationLabel(slackConversation) : void 0;
|
|
94
|
-
return privateLabel ?? args.conversation.title ?? slackStatsLocationLabel({
|
|
95
|
-
channel: slackThread?.channelId,
|
|
96
|
-
channelName: effectiveChannelName
|
|
97
|
-
}) ?? surfaceFallbackLabel(args.surface);
|
|
98
|
-
}
|
|
99
|
-
function channelNameFromConversation(conversation) {
|
|
100
|
-
const effectiveChannelName = conversation.channelName;
|
|
101
|
-
const slackThread = parseSlackThreadId(conversation.conversationId);
|
|
102
|
-
if (!effectiveChannelName && !slackThread) {
|
|
103
|
-
return void 0;
|
|
104
|
-
}
|
|
105
|
-
const slackConversation = resolveSlackConversationContextFromThreadId({
|
|
106
|
-
threadId: conversation.conversationId,
|
|
107
|
-
channelName: effectiveChannelName
|
|
108
|
-
});
|
|
109
|
-
if (resolveConversationPrivacy({
|
|
110
|
-
conversationId: conversation.conversationId,
|
|
111
|
-
visibility: conversation.visibility
|
|
112
|
-
}) !== "public") {
|
|
113
|
-
return privateConversationLabel(slackConversation);
|
|
114
|
-
}
|
|
115
|
-
return effectiveChannelName;
|
|
116
|
-
}
|
|
117
|
-
function channelNameRedactedFromConversation(conversation) {
|
|
118
|
-
const effectiveChannelName = conversation.channelName;
|
|
119
|
-
const slackThread = parseSlackThreadId(conversation.conversationId);
|
|
120
|
-
if (!effectiveChannelName && !slackThread) {
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
return resolveConversationPrivacy({
|
|
124
|
-
conversationId: conversation.conversationId,
|
|
125
|
-
visibility: conversation.visibility
|
|
126
|
-
}) !== "public";
|
|
127
|
-
}
|
|
128
|
-
function conversationSummaryFromStoredConversation(args) {
|
|
129
|
-
const { conversation, durationMs, usage } = args;
|
|
130
|
-
const surface = surfaceFromSource(
|
|
131
|
-
conversation.source,
|
|
132
|
-
conversation.conversationId
|
|
133
|
-
);
|
|
134
|
-
const actorIdentity = actorIdentityReport(conversation.actor);
|
|
135
|
-
const slackThread = parseSlackThreadId(conversation.conversationId);
|
|
136
|
-
const channelName = channelNameFromConversation(conversation);
|
|
137
|
-
const channelNameRedacted = channelNameRedactedFromConversation(conversation);
|
|
138
|
-
return {
|
|
139
|
-
conversationId: conversation.conversationId,
|
|
140
|
-
cumulativeDurationMs: durationMs,
|
|
141
|
-
displayTitle: titleFromConversation({ conversation, surface }),
|
|
142
|
-
lastProgressAt: new Date(
|
|
143
|
-
conversation.execution.updatedAtMs ?? conversation.updatedAtMs
|
|
144
|
-
).toISOString(),
|
|
145
|
-
lastSeenAt: new Date(conversation.lastActivityAtMs).toISOString(),
|
|
146
|
-
startedAt: new Date(conversation.createdAtMs).toISOString(),
|
|
147
|
-
status: statusFromConversation(conversation),
|
|
148
|
-
surface,
|
|
149
|
-
...usage ? { cumulativeUsage: usage } : {},
|
|
150
|
-
...actorIdentity ? { actorIdentity } : {},
|
|
151
|
-
...slackThread ? { channel: slackThread.channelId } : {},
|
|
152
|
-
...channelName ? { channelName } : {},
|
|
153
|
-
...channelNameRedacted ? { channelNameRedacted: true } : {},
|
|
154
|
-
...args.locationId && !channelNameRedacted ? { locationId: args.locationId } : {}
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// src/api/conversations/list.query.ts
|
|
159
|
-
var CONVERSATION_FEED_LIMIT = 50;
|
|
160
|
-
async function conversationRows(db, limit, actorEmail) {
|
|
161
|
-
return db.select({
|
|
162
|
-
conversation: juniorConversations,
|
|
163
|
-
destinationId: juniorDestinations.id,
|
|
164
|
-
destinationVisibility: juniorDestinations.visibility,
|
|
165
|
-
identityDisplayName: juniorIdentities.displayName,
|
|
166
|
-
identityEmail: juniorIdentities.email,
|
|
167
|
-
identityHandle: juniorIdentities.handle,
|
|
168
|
-
identityProvider: juniorIdentities.provider,
|
|
169
|
-
identitySubjectId: juniorIdentities.providerSubjectId,
|
|
170
|
-
identityTenantId: juniorIdentities.providerTenantId
|
|
171
|
-
}).from(juniorConversations).leftJoin(
|
|
172
|
-
juniorDestinations,
|
|
173
|
-
eq(juniorDestinations.id, juniorConversations.destinationId)
|
|
174
|
-
).leftJoin(
|
|
175
|
-
juniorIdentities,
|
|
176
|
-
eq(juniorIdentities.id, juniorConversations.actorIdentityId)
|
|
177
|
-
).where(
|
|
178
|
-
and(
|
|
179
|
-
isNull(juniorConversations.parentConversationId),
|
|
180
|
-
actorEmail ? and(
|
|
181
|
-
eq(juniorIdentities.emailNormalized, actorEmail),
|
|
182
|
-
eq(juniorIdentities.emailVerified, true)
|
|
183
|
-
) : void 0
|
|
184
|
-
)
|
|
185
|
-
).orderBy(
|
|
186
|
-
desc(juniorConversations.lastActivityAt),
|
|
187
|
-
asc(juniorConversations.conversationId)
|
|
188
|
-
).limit(limit);
|
|
189
|
-
}
|
|
190
|
-
function conversationFromRow(row) {
|
|
191
|
-
const value = row.conversation;
|
|
192
|
-
const actor = row.identityProvider === "slack" ? {
|
|
193
|
-
platform: "slack",
|
|
194
|
-
...row.identityEmail ? { email: row.identityEmail } : {},
|
|
195
|
-
...row.identityDisplayName ? { fullName: row.identityDisplayName } : {},
|
|
196
|
-
...row.identitySubjectId ? { slackUserId: row.identitySubjectId } : {},
|
|
197
|
-
...row.identityHandle ? { slackUserName: row.identityHandle } : {},
|
|
198
|
-
...row.identityTenantId ? { teamId: row.identityTenantId } : {}
|
|
199
|
-
} : void 0;
|
|
200
|
-
return {
|
|
201
|
-
schemaVersion: 1,
|
|
202
|
-
conversationId: value.conversationId,
|
|
203
|
-
createdAtMs: value.createdAt.getTime(),
|
|
204
|
-
lastActivityAtMs: value.lastActivityAt.getTime(),
|
|
205
|
-
updatedAtMs: value.updatedAt.getTime(),
|
|
206
|
-
execution: {
|
|
207
|
-
status: value.executionStatus,
|
|
208
|
-
...value.runId ? { runId: value.runId } : {},
|
|
209
|
-
...value.executionUpdatedAt ? { updatedAtMs: value.executionUpdatedAt.getTime() } : {}
|
|
210
|
-
},
|
|
211
|
-
...actor ? { actor } : {},
|
|
212
|
-
...value.channelName ? { channelName: value.channelName } : {},
|
|
213
|
-
...value.source ? { source: value.source } : {},
|
|
214
|
-
...value.title ? { title: value.title } : {},
|
|
215
|
-
...value.transcriptPurgedAt ? { transcriptPurgedAtMs: value.transcriptPurgedAt.getTime() } : {},
|
|
216
|
-
...row.destinationVisibility ? {
|
|
217
|
-
visibility: row.destinationVisibility === "public" ? "public" : "private"
|
|
218
|
-
} : {}
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
async function readConversationRecordFromSql(conversationId) {
|
|
222
|
-
const db = getDb();
|
|
223
|
-
const rows = await db.select({
|
|
224
|
-
conversation: juniorConversations,
|
|
225
|
-
destinationId: juniorDestinations.id,
|
|
226
|
-
destinationVisibility: juniorDestinations.visibility,
|
|
227
|
-
identityDisplayName: juniorIdentities.displayName,
|
|
228
|
-
identityEmail: juniorIdentities.email,
|
|
229
|
-
identityHandle: juniorIdentities.handle,
|
|
230
|
-
identityProvider: juniorIdentities.provider,
|
|
231
|
-
identitySubjectId: juniorIdentities.providerSubjectId,
|
|
232
|
-
identityTenantId: juniorIdentities.providerTenantId
|
|
233
|
-
}).from(juniorConversations).leftJoin(
|
|
234
|
-
juniorDestinations,
|
|
235
|
-
eq(juniorDestinations.id, juniorConversations.destinationId)
|
|
236
|
-
).leftJoin(
|
|
237
|
-
juniorIdentities,
|
|
238
|
-
eq(juniorIdentities.id, juniorConversations.actorIdentityId)
|
|
239
|
-
).where(eq(juniorConversations.conversationId, conversationId)).limit(1);
|
|
240
|
-
const row = rows[0];
|
|
241
|
-
return row ? {
|
|
242
|
-
conversation: conversationFromRow(row),
|
|
243
|
-
durationMs: row.conversation.durationMs,
|
|
244
|
-
...row.destinationVisibility === "public" && row.destinationId ? { locationId: row.destinationId } : {},
|
|
245
|
-
usage: row.conversation.usage
|
|
246
|
-
} : void 0;
|
|
247
|
-
}
|
|
248
|
-
async function readConversationFeedFromSql(options = {}) {
|
|
249
|
-
const nowMs = Date.now();
|
|
250
|
-
const rows = await conversationRows(
|
|
251
|
-
getDb(),
|
|
252
|
-
options.limit ?? CONVERSATION_FEED_LIMIT,
|
|
253
|
-
options.actorEmail
|
|
254
|
-
);
|
|
255
|
-
return {
|
|
256
|
-
conversations: rows.map(
|
|
257
|
-
(row) => conversationSummaryFromStoredConversation({
|
|
258
|
-
conversation: conversationFromRow(row),
|
|
259
|
-
durationMs: row.conversation.durationMs,
|
|
260
|
-
...row.destinationVisibility === "public" && row.destinationId ? { locationId: row.destinationId } : {},
|
|
261
|
-
usage: row.conversation.usage ?? void 0
|
|
262
|
-
})
|
|
263
|
-
),
|
|
264
|
-
generatedAt: new Date(nowMs).toISOString(),
|
|
265
|
-
source: "conversation_index"
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
export {
|
|
270
|
-
conversationSummaryFromStoredConversation,
|
|
271
|
-
readConversationRecordFromSql,
|
|
272
|
-
readConversationFeedFromSql
|
|
273
|
-
};
|
package/dist/chunk-LVUKF5CE.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getClient
|
|
3
|
-
} from "./chunk-6GWA276C.js";
|
|
4
|
-
|
|
5
|
-
// src/chat/sentry-links.ts
|
|
6
|
-
function getSentryOrgSlug() {
|
|
7
|
-
const slug = process.env.SENTRY_ORG_SLUG?.trim();
|
|
8
|
-
return slug || void 0;
|
|
9
|
-
}
|
|
10
|
-
function isSentrySaasDsnHost(host) {
|
|
11
|
-
return host === "sentry.io" || host.endsWith(".sentry.io");
|
|
12
|
-
}
|
|
13
|
-
function buildSentryWebBaseUrl(dsn) {
|
|
14
|
-
if (isSentrySaasDsnHost(dsn.host)) {
|
|
15
|
-
return "https://sentry.io";
|
|
16
|
-
}
|
|
17
|
-
const port = dsn.port ? `:${dsn.port}` : "";
|
|
18
|
-
const path = dsn.path ? `/${dsn.path}` : "";
|
|
19
|
-
return `${dsn.protocol}://${dsn.host}${port}${path}`;
|
|
20
|
-
}
|
|
21
|
-
function buildSentryConversationUrl(conversationId) {
|
|
22
|
-
const client = getClient();
|
|
23
|
-
const dsn = client?.getDsn();
|
|
24
|
-
if (!dsn?.host || !dsn.projectId) {
|
|
25
|
-
return void 0;
|
|
26
|
-
}
|
|
27
|
-
const orgSlug = getSentryOrgSlug();
|
|
28
|
-
if (!orgSlug) {
|
|
29
|
-
return void 0;
|
|
30
|
-
}
|
|
31
|
-
const encodedId = encodeURIComponent(conversationId);
|
|
32
|
-
const params = new URLSearchParams();
|
|
33
|
-
params.set("project", dsn.projectId);
|
|
34
|
-
const path = `explore/conversations/${encodedId}/?${params.toString()}`;
|
|
35
|
-
if (isSentrySaasDsnHost(dsn.host)) {
|
|
36
|
-
return `https://${orgSlug}.sentry.io/${path}`;
|
|
37
|
-
}
|
|
38
|
-
return `${buildSentryWebBaseUrl(dsn)}/organizations/${orgSlug}/${path}`;
|
|
39
|
-
}
|
|
40
|
-
function buildSentryTraceUrl(traceId) {
|
|
41
|
-
const client = getClient();
|
|
42
|
-
const dsn = client?.getDsn();
|
|
43
|
-
if (!dsn?.host || !dsn.projectId) {
|
|
44
|
-
return void 0;
|
|
45
|
-
}
|
|
46
|
-
const orgSlug = getSentryOrgSlug();
|
|
47
|
-
if (!orgSlug) {
|
|
48
|
-
return void 0;
|
|
49
|
-
}
|
|
50
|
-
const encodedTraceId = encodeURIComponent(traceId);
|
|
51
|
-
const params = new URLSearchParams();
|
|
52
|
-
params.set("project", dsn.projectId);
|
|
53
|
-
const path = `performance/trace/${encodedTraceId}/?${params.toString()}`;
|
|
54
|
-
if (isSentrySaasDsnHost(dsn.host)) {
|
|
55
|
-
return `https://${orgSlug}.sentry.io/${path}`;
|
|
56
|
-
}
|
|
57
|
-
return `${buildSentryWebBaseUrl(dsn)}/organizations/${orgSlug}/${path}`;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export {
|
|
61
|
-
buildSentryConversationUrl,
|
|
62
|
-
buildSentryTraceUrl
|
|
63
|
-
};
|