@sentry/junior 0.97.0 → 0.98.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-XSUIVRQS.js → agent-hooks-OSW6C3CJ.js} +2 -2
- package/dist/api/conversations/detail.d.ts +1 -1
- package/dist/api/conversations/detail.query.d.ts +1 -1
- package/dist/api/conversations/projection.d.ts +0 -1
- package/dist/api/conversations/schema.d.ts +31 -8
- package/dist/api/people/schema.d.ts +0 -11
- package/dist/api/people/shared.d.ts +2 -4
- package/dist/api/schema.d.ts +1 -1
- package/dist/api/schema.js +2 -2
- package/dist/api-reference.d.ts +1 -1
- package/dist/api.js +10 -10
- package/dist/app.js +40 -29
- package/dist/chat/conversations/search.d.ts +24 -0
- package/dist/chat/conversations/sql/search.d.ts +4 -0
- package/dist/chat/db.d.ts +3 -0
- package/dist/chat/runtime/report-progress.d.ts +3 -0
- package/dist/chat/runtime/slack-resume.d.ts +2 -0
- package/dist/chat/slack/assistant-thread/status-scheduler.d.ts +4 -3
- package/dist/chat/slack/outbound.d.ts +6 -0
- package/dist/chat/slack/tools/conversation-search.d.ts +71 -0
- package/dist/chat/state/turn-session.d.ts +2 -0
- package/dist/chat/tool-support/zod-tool.d.ts +1 -1
- package/dist/chunk-6DTVCPLO.js +146 -0
- package/dist/{chunk-AUUCAFDE.js → chunk-6HHEZENZ.js} +126 -11
- package/dist/{chunk-VFH4ZKZT.js → chunk-CRQVIHDI.js} +1 -3
- package/dist/{chunk-6U26PYI5.js → chunk-CV22LUIV.js} +7 -17
- package/dist/{chunk-GUAP3H7O.js → chunk-DHHU2WSG.js} +2 -2
- package/dist/{chunk-XIRPQQVE.js → chunk-DPHWDS6I.js} +297 -171
- package/dist/{chunk-T533JLM3.js → chunk-ER45IV77.js} +8 -6
- package/dist/{chunk-LUAE4MGW.js → chunk-EUZ44ROE.js} +21 -4
- package/dist/{chunk-5HLDPVYS.js → chunk-FTTFV6DC.js} +1 -1
- package/dist/{chunk-3F4OPKGF.js → chunk-IO65E4ZD.js} +2 -2
- package/dist/{chunk-ON6YKIQ7.js → chunk-KJHAW6VE.js} +4 -10
- package/dist/{chunk-FBHZJFHI.js → chunk-NJEDJFK4.js} +1 -1
- package/dist/{chunk-35BNLDOJ.js → chunk-OGHXZ4KQ.js} +134 -57
- package/dist/{chunk-WJOSZOON.js → chunk-OL6XQ23W.js} +11 -150
- package/dist/{chunk-WGXMTFNU.js → chunk-WJ7STXT6.js} +5 -3
- package/dist/cli/chat.js +11 -10
- package/dist/cli/plugins.js +2 -2
- package/dist/cli/upgrade.js +9 -7
- package/dist/{db-BWXYIKFQ.js → db-GFSCDAHS.js} +3 -1
- package/dist/detail-W4ZSD45K.js +67 -0
- package/dist/{legacy-import-3NQJVGQL.js → legacy-import-6WWXMALY.js} +2 -2
- package/dist/{list-UXJI5Q5X.js → list-3KZNG3SJ.js} +3 -3
- package/dist/{list-A3WFRIYX.js → list-M5BRWW3D.js} +5 -6
- package/dist/{plugin-conversations-DDNGC35A.js → plugin-conversations-ZYRWZYEA.js} +2 -2
- package/dist/{profile-4RYDXWTF.js → profile-UEIRSVT3.js} +5 -5
- package/dist/{runner-JALSYH2P.js → runner-267ZRLZD.js} +8 -7
- package/dist/{stats-XKXH3PTY.js → stats-L62E4O4U.js} +7 -17
- package/dist/{subagent-TZ55XY37.js → subagent-5HZPQC7V.js} +6 -6
- package/migrations/0002_conversation_message_search.sql +1 -0
- package/migrations/meta/0002_snapshot.json +987 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +5 -5
- package/dist/detail-GA6NXWQJ.js +0 -43
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
commitMessages,
|
|
3
3
|
loadTurnProjection
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DHHU2WSG.js";
|
|
5
5
|
import {
|
|
6
6
|
usageSchema
|
|
7
7
|
} from "./chunk-PDO5BLNM.js";
|
|
@@ -9,150 +9,13 @@ import {
|
|
|
9
9
|
getConversationStore,
|
|
10
10
|
instructionActors,
|
|
11
11
|
instructionProvenanceFor
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-OGHXZ4KQ.js";
|
|
13
13
|
import {
|
|
14
14
|
getStateAdapter
|
|
15
15
|
} from "./chunk-EEZCY5WX.js";
|
|
16
16
|
import {
|
|
17
17
|
toStoredSlackActor
|
|
18
18
|
} from "./chunk-I35CTGPO.js";
|
|
19
|
-
import {
|
|
20
|
-
isRecord,
|
|
21
|
-
toOptionalNumber,
|
|
22
|
-
toOptionalString
|
|
23
|
-
} from "./chunk-OB42YVAE.js";
|
|
24
|
-
|
|
25
|
-
// src/chat/state/conversation.ts
|
|
26
|
-
function defaultConversationState() {
|
|
27
|
-
const nowMs = Date.now();
|
|
28
|
-
return {
|
|
29
|
-
schemaVersion: 1,
|
|
30
|
-
messages: [],
|
|
31
|
-
compactions: [],
|
|
32
|
-
backfill: {},
|
|
33
|
-
processing: {},
|
|
34
|
-
stats: {
|
|
35
|
-
estimatedContextTokens: 0,
|
|
36
|
-
totalMessageCount: 0,
|
|
37
|
-
compactedMessageCount: 0,
|
|
38
|
-
updatedAtMs: nowMs
|
|
39
|
-
},
|
|
40
|
-
vision: {
|
|
41
|
-
byFileId: {}
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function coercePendingAuthState(value) {
|
|
46
|
-
if (!isRecord(value)) {
|
|
47
|
-
return void 0;
|
|
48
|
-
}
|
|
49
|
-
const kind = value.kind;
|
|
50
|
-
const provider = toOptionalString(value.provider);
|
|
51
|
-
const actorId = toOptionalString(value.actorId);
|
|
52
|
-
const scope = toOptionalString(value.scope);
|
|
53
|
-
const sessionId = toOptionalString(value.sessionId);
|
|
54
|
-
const linkSentAtMs = toOptionalNumber(value.linkSentAtMs);
|
|
55
|
-
if (kind !== "mcp" && kind !== "plugin" || !provider || !actorId || !sessionId || typeof linkSentAtMs !== "number") {
|
|
56
|
-
return void 0;
|
|
57
|
-
}
|
|
58
|
-
return {
|
|
59
|
-
kind,
|
|
60
|
-
provider,
|
|
61
|
-
actorId,
|
|
62
|
-
...scope ? { scope } : {},
|
|
63
|
-
sessionId,
|
|
64
|
-
linkSentAtMs
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
function coerceThreadConversationState(value) {
|
|
68
|
-
if (!isRecord(value)) {
|
|
69
|
-
return defaultConversationState();
|
|
70
|
-
}
|
|
71
|
-
const root = value;
|
|
72
|
-
const rawConversation = isRecord(root.conversation) ? root.conversation : {};
|
|
73
|
-
const base = defaultConversationState();
|
|
74
|
-
const messages = [];
|
|
75
|
-
const rawCompactions = Array.isArray(rawConversation.compactions) ? rawConversation.compactions : [];
|
|
76
|
-
const compactions = [];
|
|
77
|
-
for (const item of rawCompactions) {
|
|
78
|
-
if (!isRecord(item)) continue;
|
|
79
|
-
const id = toOptionalString(item.id);
|
|
80
|
-
const summary = toOptionalString(item.summary);
|
|
81
|
-
const createdAtMs = toOptionalNumber(item.createdAtMs);
|
|
82
|
-
if (!id || !summary || !createdAtMs) continue;
|
|
83
|
-
const coveredMessageIds = Array.isArray(item.coveredMessageIds) ? item.coveredMessageIds.filter(
|
|
84
|
-
(entry) => typeof entry === "string" && entry.length > 0
|
|
85
|
-
) : [];
|
|
86
|
-
compactions.push({
|
|
87
|
-
id,
|
|
88
|
-
summary,
|
|
89
|
-
createdAtMs,
|
|
90
|
-
coveredMessageIds
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
const rawBackfill = isRecord(rawConversation.backfill) ? rawConversation.backfill : {};
|
|
94
|
-
const backfill = {
|
|
95
|
-
completedAtMs: toOptionalNumber(rawBackfill.completedAtMs),
|
|
96
|
-
source: rawBackfill.source === "recent_messages" || rawBackfill.source === "thread_fetch" ? rawBackfill.source : void 0
|
|
97
|
-
};
|
|
98
|
-
const rawProcessing = isRecord(rawConversation.processing) ? rawConversation.processing : {};
|
|
99
|
-
const processing = {
|
|
100
|
-
activeTurnId: toOptionalString(rawProcessing.activeTurnId),
|
|
101
|
-
lastCompletedAtMs: toOptionalNumber(rawProcessing.lastCompletedAtMs),
|
|
102
|
-
pendingAuth: coercePendingAuthState(rawProcessing.pendingAuth)
|
|
103
|
-
};
|
|
104
|
-
const rawStats = isRecord(rawConversation.stats) ? rawConversation.stats : {};
|
|
105
|
-
const stats = {
|
|
106
|
-
estimatedContextTokens: toOptionalNumber(rawStats.estimatedContextTokens) ?? base.stats.estimatedContextTokens,
|
|
107
|
-
totalMessageCount: toOptionalNumber(rawStats.totalMessageCount) ?? messages.length,
|
|
108
|
-
compactedMessageCount: toOptionalNumber(rawStats.compactedMessageCount) ?? 0,
|
|
109
|
-
updatedAtMs: toOptionalNumber(rawStats.updatedAtMs) ?? base.stats.updatedAtMs
|
|
110
|
-
};
|
|
111
|
-
const rawVision = isRecord(rawConversation.vision) ? rawConversation.vision : {};
|
|
112
|
-
const rawVisionByFileId = isRecord(rawVision.byFileId) ? rawVision.byFileId : {};
|
|
113
|
-
const byFileId = {};
|
|
114
|
-
for (const [fileId, value2] of Object.entries(rawVisionByFileId)) {
|
|
115
|
-
if (typeof fileId !== "string" || fileId.trim().length === 0) continue;
|
|
116
|
-
if (!isRecord(value2)) continue;
|
|
117
|
-
const summary = toOptionalString(value2.summary);
|
|
118
|
-
const analyzedAtMs = toOptionalNumber(value2.analyzedAtMs);
|
|
119
|
-
if (!summary || !analyzedAtMs) continue;
|
|
120
|
-
byFileId[fileId] = {
|
|
121
|
-
summary,
|
|
122
|
-
analyzedAtMs
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
return {
|
|
126
|
-
schemaVersion: 1,
|
|
127
|
-
messages,
|
|
128
|
-
compactions,
|
|
129
|
-
backfill,
|
|
130
|
-
processing,
|
|
131
|
-
stats,
|
|
132
|
-
vision: {
|
|
133
|
-
backfillCompletedAtMs: toOptionalNumber(rawVision.backfillCompletedAtMs),
|
|
134
|
-
byFileId
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
function buildConversationStatePatch(conversation) {
|
|
139
|
-
const {
|
|
140
|
-
compactions: _compactions,
|
|
141
|
-
messages: _messages,
|
|
142
|
-
...scratch
|
|
143
|
-
} = conversation;
|
|
144
|
-
return {
|
|
145
|
-
conversation: {
|
|
146
|
-
...scratch,
|
|
147
|
-
schemaVersion: 1,
|
|
148
|
-
stats: {
|
|
149
|
-
...conversation.stats,
|
|
150
|
-
totalMessageCount: conversation.messages.length,
|
|
151
|
-
updatedAtMs: Date.now()
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
19
|
|
|
157
20
|
// src/chat/usage.ts
|
|
158
21
|
var agentTurnUsageSchema = usageSchema;
|
|
@@ -649,10 +512,7 @@ async function readAgentTurnSessionSummariesFromIndex(key, stateAdapter) {
|
|
|
649
512
|
}
|
|
650
513
|
async function listAgentTurnSessionSummariesForConversation(conversationId) {
|
|
651
514
|
const stateAdapter = getStateAdapter();
|
|
652
|
-
const summaries = await
|
|
653
|
-
agentTurnSessionConversationIndexKey(conversationId),
|
|
654
|
-
stateAdapter
|
|
655
|
-
);
|
|
515
|
+
const summaries = await listBoundedAgentTurnSessionSummariesForConversation(conversationId);
|
|
656
516
|
if (summaries.length > 0) {
|
|
657
517
|
return summaries;
|
|
658
518
|
}
|
|
@@ -661,6 +521,12 @@ async function listAgentTurnSessionSummariesForConversation(conversationId) {
|
|
|
661
521
|
stateAdapter
|
|
662
522
|
)).filter((summary) => summary.conversationId === conversationId);
|
|
663
523
|
}
|
|
524
|
+
async function listBoundedAgentTurnSessionSummariesForConversation(conversationId) {
|
|
525
|
+
return readAgentTurnSessionSummariesFromIndex(
|
|
526
|
+
agentTurnSessionConversationIndexKey(conversationId),
|
|
527
|
+
getStateAdapter()
|
|
528
|
+
);
|
|
529
|
+
}
|
|
664
530
|
async function listAgentTurnSessionSummariesForConversations(stateAdapter, conversationIds) {
|
|
665
531
|
const ids = [...new Set(conversationIds)];
|
|
666
532
|
const globalSummaries = await readAgentTurnSessionSummariesFromIndex(
|
|
@@ -730,9 +596,6 @@ async function failAgentTurnSessionRecord(args) {
|
|
|
730
596
|
});
|
|
731
597
|
}
|
|
732
598
|
|
|
733
|
-
// src/chat/state/ttl.ts
|
|
734
|
-
var JUNIOR_THREAD_STATE_TTL_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
735
|
-
|
|
736
599
|
export {
|
|
737
600
|
hasAgentTurnUsage,
|
|
738
601
|
addAgentTurnUsage,
|
|
@@ -740,10 +603,8 @@ export {
|
|
|
740
603
|
upsertAgentTurnSessionRecord,
|
|
741
604
|
recordAgentTurnSessionSummary,
|
|
742
605
|
listAgentTurnSessionSummariesForConversation,
|
|
606
|
+
listBoundedAgentTurnSessionSummariesForConversation,
|
|
743
607
|
listAgentTurnSessionSummariesForConversations,
|
|
744
608
|
abandonAgentTurnSessionRecord,
|
|
745
|
-
failAgentTurnSessionRecord
|
|
746
|
-
JUNIOR_THREAD_STATE_TTL_MS,
|
|
747
|
-
coerceThreadConversationState,
|
|
748
|
-
buildConversationStatePatch
|
|
609
|
+
failAgentTurnSessionRecord
|
|
749
610
|
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
JUNIOR_THREAD_STATE_TTL_MS,
|
|
3
|
+
buildConversationStatePatch
|
|
4
|
+
} from "./chunk-6DTVCPLO.js";
|
|
5
|
+
import {
|
|
3
6
|
abandonAgentTurnSessionRecord,
|
|
4
7
|
addAgentTurnUsage,
|
|
5
|
-
buildConversationStatePatch,
|
|
6
8
|
getAgentTurnSessionRecord,
|
|
7
9
|
upsertAgentTurnSessionRecord
|
|
8
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-OL6XQ23W.js";
|
|
9
11
|
import {
|
|
10
12
|
persistConversationMessages
|
|
11
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-IO65E4ZD.js";
|
|
12
14
|
import {
|
|
13
15
|
sleep
|
|
14
16
|
} from "./chunk-4ZNGQH7C.js";
|
package/dist/cli/chat.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAgentRunner,
|
|
3
3
|
executeAgentRun
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-DPHWDS6I.js";
|
|
5
|
+
import "../chunk-WJ7STXT6.js";
|
|
6
|
+
import "../chunk-6DTVCPLO.js";
|
|
7
|
+
import "../chunk-OL6XQ23W.js";
|
|
8
|
+
import "../chunk-DHHU2WSG.js";
|
|
9
|
+
import "../chunk-IO65E4ZD.js";
|
|
9
10
|
import "../chunk-H66UCBPW.js";
|
|
10
11
|
import "../chunk-PDO5BLNM.js";
|
|
11
12
|
import "../chunk-CM5EZD5F.js";
|
|
12
13
|
import {
|
|
13
14
|
loadAppPluginSet
|
|
14
15
|
} from "../chunk-Y2CM7HXH.js";
|
|
15
|
-
import "../chunk-
|
|
16
|
+
import "../chunk-FTTFV6DC.js";
|
|
16
17
|
import "../chunk-WTYEKPXU.js";
|
|
17
18
|
import "../chunk-EOWXRY5E.js";
|
|
18
|
-
import "../chunk-
|
|
19
|
+
import "../chunk-OGHXZ4KQ.js";
|
|
19
20
|
import "../chunk-G3E7SCME.js";
|
|
20
21
|
import "../chunk-4ZNGQH7C.js";
|
|
21
22
|
import "../chunk-EEZCY5WX.js";
|
|
@@ -151,10 +152,10 @@ async function configureLocalChatPlugins(pluginSet) {
|
|
|
151
152
|
databaseModule
|
|
152
153
|
] = await Promise.all([
|
|
153
154
|
import("../plugins-PZMDS7AT.js"),
|
|
154
|
-
import("../agent-hooks-
|
|
155
|
+
import("../agent-hooks-OSW6C3CJ.js"),
|
|
155
156
|
import("../catalog-runtime-PFHVMHDR.js"),
|
|
156
157
|
import("../validation-FMEAEKCY.js"),
|
|
157
|
-
import("../db-
|
|
158
|
+
import("../db-GFSCDAHS.js")
|
|
158
159
|
]);
|
|
159
160
|
const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
|
|
160
161
|
const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
|
|
@@ -215,7 +216,7 @@ function newRunConversationId() {
|
|
|
215
216
|
async function prepareLocalChatRun(io, pluginSet) {
|
|
216
217
|
defaultStateAdapterForLocalChat();
|
|
217
218
|
await configureLocalChatPlugins(pluginSet);
|
|
218
|
-
const { runLocalAgentTurn } = await import("../runner-
|
|
219
|
+
const { runLocalAgentTurn } = await import("../runner-267ZRLZD.js");
|
|
219
220
|
const deps = {
|
|
220
221
|
agentRunner: createAgentRunner(executeAgentRun),
|
|
221
222
|
deliverReply: async (reply) => {
|
package/dist/cli/plugins.js
CHANGED
|
@@ -13,14 +13,14 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
setPlugins,
|
|
15
15
|
validatePlugins
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-FTTFV6DC.js";
|
|
17
17
|
import "../chunk-WTYEKPXU.js";
|
|
18
18
|
import {
|
|
19
19
|
createPluginLogger
|
|
20
20
|
} from "../chunk-EOWXRY5E.js";
|
|
21
21
|
import {
|
|
22
22
|
getDb
|
|
23
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-OGHXZ4KQ.js";
|
|
24
24
|
import "../chunk-G3E7SCME.js";
|
|
25
25
|
import "../chunk-4ZNGQH7C.js";
|
|
26
26
|
import "../chunk-EEZCY5WX.js";
|
package/dist/cli/upgrade.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
recordConversationActivity,
|
|
5
5
|
recordConversationExecution,
|
|
6
6
|
requestConversationWork
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-NJEDJFK4.js";
|
|
8
8
|
import {
|
|
9
9
|
defineJuniorPlugins,
|
|
10
10
|
pluginCatalogConfigFromEnv,
|
|
@@ -13,14 +13,16 @@ import {
|
|
|
13
13
|
} from "../chunk-SG5WAA7H.js";
|
|
14
14
|
import {
|
|
15
15
|
JUNIOR_THREAD_STATE_TTL_MS,
|
|
16
|
+
coerceThreadConversationState
|
|
17
|
+
} from "../chunk-6DTVCPLO.js";
|
|
18
|
+
import {
|
|
16
19
|
addAgentTurnUsage,
|
|
17
|
-
coerceThreadConversationState,
|
|
18
20
|
listAgentTurnSessionSummariesForConversations
|
|
19
|
-
} from "../chunk-
|
|
20
|
-
import "../chunk-
|
|
21
|
+
} from "../chunk-OL6XQ23W.js";
|
|
22
|
+
import "../chunk-DHHU2WSG.js";
|
|
21
23
|
import {
|
|
22
24
|
importConversationFromLegacy
|
|
23
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-IO65E4ZD.js";
|
|
24
26
|
import "../chunk-PDO5BLNM.js";
|
|
25
27
|
import {
|
|
26
28
|
loadAppPluginSet
|
|
@@ -34,7 +36,7 @@ import {
|
|
|
34
36
|
createSqlConversationMessageStore,
|
|
35
37
|
createSqlStore,
|
|
36
38
|
getDb
|
|
37
|
-
} from "../chunk-
|
|
39
|
+
} from "../chunk-OGHXZ4KQ.js";
|
|
38
40
|
import {
|
|
39
41
|
disconnectStateAdapter,
|
|
40
42
|
getChatConfig,
|
|
@@ -209,7 +211,7 @@ WHERE table_schema = 'public'
|
|
|
209
211
|
`Cannot adopt partial legacy core migration state; missing: ${missingIds.join(", ")}`
|
|
210
212
|
);
|
|
211
213
|
}
|
|
212
|
-
const migration = metrics?.complete ? migrations
|
|
214
|
+
const migration = metrics?.complete ? migrations[1] : migrations[0];
|
|
213
215
|
if (!migration) {
|
|
214
216
|
throw new Error("No core Drizzle migrations were packaged");
|
|
215
217
|
}
|
|
@@ -2,10 +2,11 @@ import {
|
|
|
2
2
|
closeDb,
|
|
3
3
|
getAgentStepStore,
|
|
4
4
|
getConversationMessageStore,
|
|
5
|
+
getConversationSearchStore,
|
|
5
6
|
getConversationStore,
|
|
6
7
|
getDb,
|
|
7
8
|
getSqlExecutor
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-OGHXZ4KQ.js";
|
|
9
10
|
import "./chunk-EEZCY5WX.js";
|
|
10
11
|
import "./chunk-LVA4I4H7.js";
|
|
11
12
|
import "./chunk-B7PUBQQM.js";
|
|
@@ -18,6 +19,7 @@ export {
|
|
|
18
19
|
closeDb,
|
|
19
20
|
getAgentStepStore,
|
|
20
21
|
getConversationMessageStore,
|
|
22
|
+
getConversationSearchStore,
|
|
21
23
|
getConversationStore,
|
|
22
24
|
getDb,
|
|
23
25
|
getSqlExecutor
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildConversationDetail
|
|
3
|
+
} from "./chunk-6HHEZENZ.js";
|
|
4
|
+
import {
|
|
5
|
+
readConversationRecordFromSql
|
|
6
|
+
} from "./chunk-KJHAW6VE.js";
|
|
7
|
+
import {
|
|
8
|
+
conversationDetailReportSchema
|
|
9
|
+
} from "./chunk-EUZ44ROE.js";
|
|
10
|
+
import "./chunk-LVUKF5CE.js";
|
|
11
|
+
import "./chunk-NG2AV7IB.js";
|
|
12
|
+
import {
|
|
13
|
+
listBoundedAgentTurnSessionSummariesForConversation
|
|
14
|
+
} from "./chunk-OL6XQ23W.js";
|
|
15
|
+
import "./chunk-DHHU2WSG.js";
|
|
16
|
+
import "./chunk-IO65E4ZD.js";
|
|
17
|
+
import "./chunk-PDO5BLNM.js";
|
|
18
|
+
import "./chunk-WTYEKPXU.js";
|
|
19
|
+
import "./chunk-OGHXZ4KQ.js";
|
|
20
|
+
import "./chunk-4ZNGQH7C.js";
|
|
21
|
+
import "./chunk-EEZCY5WX.js";
|
|
22
|
+
import "./chunk-LVA4I4H7.js";
|
|
23
|
+
import "./chunk-B7PUBQQM.js";
|
|
24
|
+
import {
|
|
25
|
+
logException
|
|
26
|
+
} from "./chunk-I35CTGPO.js";
|
|
27
|
+
import "./chunk-OB42YVAE.js";
|
|
28
|
+
import "./chunk-6GWA276C.js";
|
|
29
|
+
import "./chunk-7FBGKXPE.js";
|
|
30
|
+
import "./chunk-MLKGABMK.js";
|
|
31
|
+
|
|
32
|
+
// src/api/conversations/detail.query.ts
|
|
33
|
+
async function readLatestRun(conversationId) {
|
|
34
|
+
try {
|
|
35
|
+
return (await listBoundedAgentTurnSessionSummariesForConversation(conversationId)).find((summary) => summary.modelId || summary.reasoningLevel);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
logException(error, "conversation_execution_settings_read_failed", {
|
|
38
|
+
conversationId
|
|
39
|
+
});
|
|
40
|
+
return void 0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function readConversationDetailFromSql(conversationId) {
|
|
44
|
+
const record = await readConversationRecordFromSql(conversationId);
|
|
45
|
+
if (!record) return void 0;
|
|
46
|
+
const [report, latestRun] = await Promise.all([
|
|
47
|
+
buildConversationDetail({
|
|
48
|
+
...record,
|
|
49
|
+
usage: record.usage ?? void 0
|
|
50
|
+
}),
|
|
51
|
+
readLatestRun(conversationId)
|
|
52
|
+
]);
|
|
53
|
+
return {
|
|
54
|
+
...report,
|
|
55
|
+
...latestRun?.modelId ? { modelId: latestRun.modelId } : {},
|
|
56
|
+
...latestRun?.reasoningLevel ? { reasoningLevel: latestRun.reasoningLevel } : {}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// src/api/conversations/detail.ts
|
|
61
|
+
async function readConversationDetail(conversationId) {
|
|
62
|
+
const report = await readConversationDetailFromSql(conversationId);
|
|
63
|
+
return report ? conversationDetailReportSchema.parse(report) : void 0;
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
readConversationDetail
|
|
67
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureLegacyConversationImport,
|
|
3
3
|
importConversationFromLegacy
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-IO65E4ZD.js";
|
|
5
|
+
import "./chunk-OGHXZ4KQ.js";
|
|
6
6
|
import "./chunk-EEZCY5WX.js";
|
|
7
7
|
import "./chunk-LVA4I4H7.js";
|
|
8
8
|
import "./chunk-B7PUBQQM.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readConversationFeedFromSql
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KJHAW6VE.js";
|
|
4
4
|
import {
|
|
5
5
|
conversationFeedSchema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-EUZ44ROE.js";
|
|
7
7
|
import "./chunk-NG2AV7IB.js";
|
|
8
8
|
import "./chunk-PDO5BLNM.js";
|
|
9
9
|
import "./chunk-WTYEKPXU.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-OGHXZ4KQ.js";
|
|
11
11
|
import "./chunk-4ZNGQH7C.js";
|
|
12
12
|
import "./chunk-EEZCY5WX.js";
|
|
13
13
|
import "./chunk-LVA4I4H7.js";
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
signals,
|
|
11
11
|
summaryFromRow,
|
|
12
12
|
usageTokens
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-CV22LUIV.js";
|
|
14
14
|
import {
|
|
15
15
|
actorDirectoryReportSchema
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-CRQVIHDI.js";
|
|
17
|
+
import "./chunk-EUZ44ROE.js";
|
|
18
18
|
import "./chunk-PDO5BLNM.js";
|
|
19
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-OGHXZ4KQ.js";
|
|
20
20
|
import "./chunk-EEZCY5WX.js";
|
|
21
21
|
import "./chunk-LVA4I4H7.js";
|
|
22
22
|
import "./chunk-B7PUBQQM.js";
|
|
@@ -35,7 +35,6 @@ function directoryItem(accumulator) {
|
|
|
35
35
|
durationMs: accumulator.durationMs,
|
|
36
36
|
failed: accumulator.failed,
|
|
37
37
|
firstSeenAt: new Date(accumulator.firstSeenMs).toISOString(),
|
|
38
|
-
hung: accumulator.hung,
|
|
39
38
|
lastSeenAt: new Date(accumulator.lastSeenMs).toISOString(),
|
|
40
39
|
actor: accumulator.actor,
|
|
41
40
|
...accumulator.tokens !== void 0 ? { tokens: accumulator.tokens } : {}
|
|
@@ -46,7 +45,7 @@ async function readPeopleListFromSql() {
|
|
|
46
45
|
const { rows, truncated } = await actorRows();
|
|
47
46
|
const people = /* @__PURE__ */ new Map();
|
|
48
47
|
for (const row of rows) {
|
|
49
|
-
const summary = summaryFromRow(row
|
|
48
|
+
const summary = summaryFromRow(row);
|
|
50
49
|
const actor = identityWithEmail(summary.actorIdentity);
|
|
51
50
|
if (!actor) continue;
|
|
52
51
|
const firstSeenMs = reportTime(summary.startedAt) ?? row.createdAt.getTime();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readConversationFeedFromSql
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KJHAW6VE.js";
|
|
4
4
|
import "./chunk-NG2AV7IB.js";
|
|
5
5
|
import "./chunk-WTYEKPXU.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-OGHXZ4KQ.js";
|
|
7
7
|
import "./chunk-4ZNGQH7C.js";
|
|
8
8
|
import "./chunk-EEZCY5WX.js";
|
|
9
9
|
import "./chunk-LVA4I4H7.js";
|
|
@@ -19,13 +19,13 @@ import {
|
|
|
19
19
|
summaryFromRow,
|
|
20
20
|
surfaceLabel,
|
|
21
21
|
usageTokens
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-CV22LUIV.js";
|
|
23
23
|
import {
|
|
24
24
|
actorProfileReportSchema
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-CRQVIHDI.js";
|
|
26
|
+
import "./chunk-EUZ44ROE.js";
|
|
27
27
|
import "./chunk-PDO5BLNM.js";
|
|
28
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-OGHXZ4KQ.js";
|
|
29
29
|
import "./chunk-EEZCY5WX.js";
|
|
30
30
|
import "./chunk-LVA4I4H7.js";
|
|
31
31
|
import "./chunk-B7PUBQQM.js";
|
|
@@ -72,7 +72,7 @@ async function readPeopleProfileFromSql(email) {
|
|
|
72
72
|
const surfaces = /* @__PURE__ */ new Map();
|
|
73
73
|
const recentConversations = [];
|
|
74
74
|
for (const row of rows) {
|
|
75
|
-
const summary = summaryFromRow(row
|
|
75
|
+
const summary = summaryFromRow(row);
|
|
76
76
|
const identity = identityWithEmail(summary.actorIdentity);
|
|
77
77
|
if (identity) {
|
|
78
78
|
actor = actor ? mergeIdentity(actor, identity) : identity;
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
finalizeFailedTurnReply,
|
|
4
4
|
processPluginTask,
|
|
5
5
|
scheduleSessionCompletedPluginTasks
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ER45IV77.js";
|
|
7
7
|
import "./chunk-KNFROR7R.js";
|
|
8
8
|
import {
|
|
9
9
|
coerceThreadArtifactsState,
|
|
@@ -13,14 +13,15 @@ import {
|
|
|
13
13
|
markTurnFailed,
|
|
14
14
|
persistThreadStateById,
|
|
15
15
|
startActiveTurn
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WJ7STXT6.js";
|
|
17
17
|
import {
|
|
18
18
|
coerceThreadConversationState
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-6DTVCPLO.js";
|
|
20
|
+
import "./chunk-OL6XQ23W.js";
|
|
20
21
|
import {
|
|
21
22
|
commitMessages,
|
|
22
23
|
loadProjection
|
|
23
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-DHHU2WSG.js";
|
|
24
25
|
import {
|
|
25
26
|
buildConversationContext,
|
|
26
27
|
hydrateConversationMessages,
|
|
@@ -28,12 +29,12 @@ import {
|
|
|
28
29
|
normalizeConversationText,
|
|
29
30
|
updateConversationStats,
|
|
30
31
|
upsertConversationMessage
|
|
31
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-IO65E4ZD.js";
|
|
32
33
|
import "./chunk-PDO5BLNM.js";
|
|
33
|
-
import "./chunk-
|
|
34
|
+
import "./chunk-FTTFV6DC.js";
|
|
34
35
|
import "./chunk-WTYEKPXU.js";
|
|
35
36
|
import "./chunk-EOWXRY5E.js";
|
|
36
|
-
import "./chunk-
|
|
37
|
+
import "./chunk-OGHXZ4KQ.js";
|
|
37
38
|
import "./chunk-G3E7SCME.js";
|
|
38
39
|
import {
|
|
39
40
|
sleep
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
conversationStatsReportSchema
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EUZ44ROE.js";
|
|
4
4
|
import "./chunk-PDO5BLNM.js";
|
|
5
5
|
import {
|
|
6
6
|
getDb,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
juniorDestinations,
|
|
9
9
|
juniorIdentities,
|
|
10
10
|
juniorUsers
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-OGHXZ4KQ.js";
|
|
12
12
|
import "./chunk-EEZCY5WX.js";
|
|
13
13
|
import "./chunk-LVA4I4H7.js";
|
|
14
14
|
import "./chunk-B7PUBQQM.js";
|
|
@@ -22,14 +22,12 @@ import "./chunk-MLKGABMK.js";
|
|
|
22
22
|
import { and, asc, desc, eq, gte, isNull, lte } from "drizzle-orm";
|
|
23
23
|
var SAMPLE_LIMIT = 5e3;
|
|
24
24
|
var WINDOW_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
25
|
-
var HUNG_PROGRESS_MS = 5 * 60 * 1e3;
|
|
26
25
|
function emptyStatsItem(label) {
|
|
27
26
|
return {
|
|
28
27
|
active: 0,
|
|
29
28
|
conversations: 0,
|
|
30
29
|
durationMs: 0,
|
|
31
30
|
failed: 0,
|
|
32
|
-
hung: 0,
|
|
33
31
|
label
|
|
34
32
|
};
|
|
35
33
|
}
|
|
@@ -58,16 +56,14 @@ function locationLabel(row) {
|
|
|
58
56
|
const name = (row.channelName ?? row.destinationDisplayName)?.trim().replace(/^#/, "");
|
|
59
57
|
return name ? `#${name}` : "Public Channel";
|
|
60
58
|
}
|
|
61
|
-
function signals(row
|
|
59
|
+
function signals(row) {
|
|
62
60
|
if (row.executionStatus === "failed") {
|
|
63
|
-
return { active: false, failed: true
|
|
61
|
+
return { active: false, failed: true };
|
|
64
62
|
}
|
|
65
63
|
if (row.executionStatus === "idle") {
|
|
66
|
-
return { active: false, failed: false
|
|
64
|
+
return { active: false, failed: false };
|
|
67
65
|
}
|
|
68
|
-
|
|
69
|
-
const hung = row.executionStatus === "running" && nowMs - updatedAt > HUNG_PROGRESS_MS;
|
|
70
|
-
return { active: !hung, failed: false, hung };
|
|
66
|
+
return { active: true, failed: false };
|
|
71
67
|
}
|
|
72
68
|
function addConversation(map, label, rowSignals, metrics) {
|
|
73
69
|
const item = map.get(label) ?? emptyStatsItem(label);
|
|
@@ -81,7 +77,6 @@ function addConversation(map, label, rowSignals, metrics) {
|
|
|
81
77
|
}
|
|
82
78
|
item.active += rowSignals.active ? 1 : 0;
|
|
83
79
|
item.failed += rowSignals.failed ? 1 : 0;
|
|
84
|
-
item.hung += rowSignals.hung ? 1 : 0;
|
|
85
80
|
map.set(label, item);
|
|
86
81
|
}
|
|
87
82
|
function statsItems(map) {
|
|
@@ -98,13 +93,11 @@ async function statsRows(db, start, end) {
|
|
|
98
93
|
destinationVisibility: juniorDestinations.visibility,
|
|
99
94
|
durationMs: juniorConversations.durationMs,
|
|
100
95
|
executionStatus: juniorConversations.executionStatus,
|
|
101
|
-
executionUpdatedAt: juniorConversations.executionUpdatedAt,
|
|
102
96
|
identityDisplayName: juniorIdentities.displayName,
|
|
103
97
|
identityEmail: juniorIdentities.emailNormalized,
|
|
104
98
|
identityHandle: juniorIdentities.handle,
|
|
105
99
|
identitySubjectId: juniorIdentities.providerSubjectId,
|
|
106
100
|
source: juniorConversations.source,
|
|
107
|
-
updatedAt: juniorConversations.updatedAt,
|
|
108
101
|
usage: juniorConversations.usage,
|
|
109
102
|
userDisplayName: juniorUsers.displayName,
|
|
110
103
|
userEmail: juniorUsers.primaryEmailNormalized
|
|
@@ -162,13 +155,11 @@ async function readConversationStatsFromSql() {
|
|
|
162
155
|
let costUsd;
|
|
163
156
|
let durationMs = 0;
|
|
164
157
|
let failed = 0;
|
|
165
|
-
let hung = 0;
|
|
166
158
|
let tokens;
|
|
167
159
|
for (const row of rows) {
|
|
168
|
-
const rowSignals = signals(row
|
|
160
|
+
const rowSignals = signals(row);
|
|
169
161
|
active += rowSignals.active ? 1 : 0;
|
|
170
162
|
failed += rowSignals.failed ? 1 : 0;
|
|
171
|
-
hung += rowSignals.hung ? 1 : 0;
|
|
172
163
|
const rowTokens = usageTokens(row.usage);
|
|
173
164
|
const rowCostUsd = usageCostUsd(row.usage);
|
|
174
165
|
const metrics = {
|
|
@@ -192,7 +183,6 @@ async function readConversationStatsFromSql() {
|
|
|
192
183
|
durationMs,
|
|
193
184
|
failed,
|
|
194
185
|
generatedAt: new Date(nowMs).toISOString(),
|
|
195
|
-
hung,
|
|
196
186
|
locations: statsItems(locations),
|
|
197
187
|
actors: statsItems(actors),
|
|
198
188
|
sampleLimit: SAMPLE_LIMIT,
|