@sentry/junior 0.99.0 → 0.101.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/README.md +0 -1
- 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 +9 -9
- 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 +126 -70
- package/dist/chat/agent/request.d.ts +4 -1
- package/dist/chat/config.d.ts +2 -0
- package/dist/chat/conversations/store.d.ts +1 -1
- package/dist/chat/mcp/auth-store.d.ts +1 -0
- package/dist/chat/mcp/client.d.ts +2 -0
- package/dist/chat/mcp/oauth-provider.d.ts +4 -1
- package/dist/chat/mcp/oauth.d.ts +3 -1
- package/dist/chat/mcp/tool-manager.d.ts +2 -0
- package/dist/chat/reasoning-level.d.ts +4 -0
- package/dist/chat/services/mcp-auth-orchestration.d.ts +1 -1
- package/dist/chat/services/pending-auth.d.ts +17 -9
- 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/state/conversation.d.ts +7 -3
- package/dist/chat/tools/search-tools.d.ts +2 -2
- package/dist/{chunk-T55RBE4Z.js → chunk-2RNOB32R.js} +3 -1
- package/dist/{chunk-ZZUBLPXD.js → chunk-5VGJJSSV.js} +9 -7
- package/dist/{chunk-EEZCY5WX.js → chunk-A7X2FDUO.js} +18 -2
- package/dist/{chunk-CRQVIHDI.js → chunk-DBPLXSBK.js} +2 -8
- package/dist/{chunk-NJEDJFK4.js → chunk-EBFJOOUE.js} +2 -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-HNIT4HXU.js +75 -0
- package/dist/{chunk-EUZ44ROE.js → chunk-HYDQULR2.js} +2 -4
- 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-ER45IV77.js → chunk-L2JIOAA2.js} +10 -10
- 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-FTTFV6DC.js → chunk-TPTJEHUE.js} +4 -4
- package/dist/{chunk-PYK7R5A7.js → chunk-UWGTSF5O.js} +285 -174
- package/dist/chunk-VFBFK6EY.js +275 -0
- package/dist/{chunk-OGHXZ4KQ.js → chunk-VHRM6GNH.js} +88 -122
- package/dist/{chunk-NG2AV7IB.js → chunk-VVIXK2BX.js} +1 -1
- package/dist/{chunk-6DTVCPLO.js → chunk-XIMUQ4IU.js} +4 -3
- package/dist/{chunk-H66UCBPW.js → chunk-XJA7BPHS.js} +1 -1
- package/dist/{chunk-WJ7STXT6.js → chunk-XVR4O24H.js} +8 -10
- package/dist/cli/chat.js +16 -15
- package/dist/cli/plugins.js +6 -5
- package/dist/cli/snapshot-warmup.js +2 -2
- package/dist/cli/upgrade.js +126 -8
- 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-Q4IVDNGS.js → detail-4EPUMSDU.js} +11 -10
- package/dist/detail-CD4SPJ4K.js +29 -0
- package/dist/{legacy-import-6WWXMALY.js → legacy-import-VCYLWT2V.js} +4 -3
- package/dist/list-7L5LY2WU.js +30 -0
- package/dist/list-DA2ATOM4.js +80 -0
- package/dist/{list-A3F5JDYV.js → list-J6ROVH56.js} +7 -6
- package/dist/{plugin-conversations-PDCQWU3O.js → plugin-conversations-JANXC4GA.js} +6 -5
- package/dist/profile-6NRWEKMZ.js +212 -0
- package/dist/{runner-267ZRLZD.js → runner-CZIKSWGC.js} +13 -12
- package/dist/stats-Q5FRUXLY.js +174 -0
- package/dist/{subagent-UN3MP6LV.js → subagent-YIINCFAS.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 +6 -6
- package/dist/api-reference.d.ts +0 -14
- 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
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
JUNIOR_THREAD_STATE_TTL_MS,
|
|
3
3
|
buildConversationStatePatch
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XIMUQ4IU.js";
|
|
5
5
|
import {
|
|
6
6
|
abandonAgentTurnSessionRecord,
|
|
7
7
|
addAgentTurnUsage,
|
|
8
8
|
getAgentTurnSessionRecord,
|
|
9
9
|
upsertAgentTurnSessionRecord
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-IVXL57YF.js";
|
|
11
11
|
import {
|
|
12
12
|
persistConversationMessages
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JPQISMMJ.js";
|
|
14
14
|
import {
|
|
15
15
|
sleep
|
|
16
16
|
} from "./chunk-4ZNGQH7C.js";
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
getPiMessageRole,
|
|
19
19
|
getStateAdapter,
|
|
20
20
|
trimTrailingAssistantMessages
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-A7X2FDUO.js";
|
|
22
22
|
import {
|
|
23
23
|
getActiveTraceId,
|
|
24
24
|
logException
|
|
@@ -899,13 +899,11 @@ function clearPendingAuth(conversation, sessionId) {
|
|
|
899
899
|
}
|
|
900
900
|
conversation.processing.pendingAuth = void 0;
|
|
901
901
|
}
|
|
902
|
-
async function
|
|
903
|
-
|
|
904
|
-
args.conversation.processing.pendingAuth = args.nextPendingAuth;
|
|
905
|
-
if (previousPendingAuth && previousPendingAuth.sessionId !== args.nextPendingAuth.sessionId && args.conversationId) {
|
|
902
|
+
async function abandonReplacedPendingAuth(args) {
|
|
903
|
+
if (args.previousPendingAuth && args.previousPendingAuth.sessionId !== args.nextPendingAuth.sessionId && args.conversationId) {
|
|
906
904
|
await abandonAgentTurnSessionRecord({
|
|
907
905
|
conversationId: args.conversationId,
|
|
908
|
-
sessionId: previousPendingAuth.sessionId,
|
|
906
|
+
sessionId: args.previousPendingAuth.sessionId,
|
|
909
907
|
errorMessage: "Abandoned by a newer auth-blocked request in the same conversation."
|
|
910
908
|
});
|
|
911
909
|
}
|
|
@@ -951,7 +949,7 @@ export {
|
|
|
951
949
|
canReusePendingAuthLink,
|
|
952
950
|
getConversationPendingAuth,
|
|
953
951
|
clearPendingAuth,
|
|
954
|
-
|
|
952
|
+
abandonReplacedPendingAuth,
|
|
955
953
|
isPendingAuthLatestRequest,
|
|
956
954
|
coerceThreadArtifactsState,
|
|
957
955
|
mergeArtifactsState,
|
package/dist/cli/chat.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAgentRunner,
|
|
3
3
|
executeAgentRun
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-UWGTSF5O.js";
|
|
5
|
+
import "../chunk-XVR4O24H.js";
|
|
6
|
+
import "../chunk-XIMUQ4IU.js";
|
|
7
|
+
import "../chunk-IVXL57YF.js";
|
|
8
|
+
import "../chunk-IQIBZXGB.js";
|
|
9
|
+
import "../chunk-JPQISMMJ.js";
|
|
10
|
+
import "../chunk-XJA7BPHS.js";
|
|
11
11
|
import "../chunk-PDO5BLNM.js";
|
|
12
12
|
import "../chunk-CM5EZD5F.js";
|
|
13
13
|
import {
|
|
14
14
|
loadAppPluginSet
|
|
15
15
|
} from "../chunk-Y2CM7HXH.js";
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
16
|
+
import "../chunk-TPTJEHUE.js";
|
|
17
|
+
import "../chunk-FP5N5OWZ.js";
|
|
18
|
+
import "../chunk-PWC24W5F.js";
|
|
19
|
+
import "../chunk-VHRM6GNH.js";
|
|
20
20
|
import "../chunk-G3E7SCME.js";
|
|
21
21
|
import "../chunk-4ZNGQH7C.js";
|
|
22
|
-
import "../chunk-
|
|
22
|
+
import "../chunk-A7X2FDUO.js";
|
|
23
|
+
import "../chunk-FXFQNHRU.js";
|
|
23
24
|
import "../chunk-LVA4I4H7.js";
|
|
24
25
|
import "../chunk-B7PUBQQM.js";
|
|
25
26
|
import "../chunk-3ECW2K2O.js";
|
|
@@ -152,10 +153,10 @@ async function configureLocalChatPlugins(pluginSet) {
|
|
|
152
153
|
databaseModule
|
|
153
154
|
] = await Promise.all([
|
|
154
155
|
import("../plugins-PZMDS7AT.js"),
|
|
155
|
-
import("../agent-hooks-
|
|
156
|
+
import("../agent-hooks-V6KU7PQN.js"),
|
|
156
157
|
import("../catalog-runtime-PFHVMHDR.js"),
|
|
157
158
|
import("../validation-FMEAEKCY.js"),
|
|
158
|
-
import("../db-
|
|
159
|
+
import("../db-RCZB7KNM.js")
|
|
159
160
|
]);
|
|
160
161
|
const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
|
|
161
162
|
const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
|
|
@@ -216,7 +217,7 @@ function newRunConversationId() {
|
|
|
216
217
|
async function prepareLocalChatRun(io, pluginSet) {
|
|
217
218
|
defaultStateAdapterForLocalChat();
|
|
218
219
|
await configureLocalChatPlugins(pluginSet);
|
|
219
|
-
const { runLocalAgentTurn } = await import("../runner-
|
|
220
|
+
const { runLocalAgentTurn } = await import("../runner-CZIKSWGC.js");
|
|
220
221
|
const deps = {
|
|
221
222
|
agentRunner: createAgentRunner(executeAgentRun),
|
|
222
223
|
deliverReply: async (reply) => {
|
package/dist/cli/plugins.js
CHANGED
|
@@ -13,17 +13,18 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
setPlugins,
|
|
15
15
|
validatePlugins
|
|
16
|
-
} from "../chunk-
|
|
17
|
-
import "../chunk-
|
|
16
|
+
} from "../chunk-TPTJEHUE.js";
|
|
17
|
+
import "../chunk-FP5N5OWZ.js";
|
|
18
18
|
import {
|
|
19
19
|
createPluginLogger
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-PWC24W5F.js";
|
|
21
21
|
import {
|
|
22
22
|
getDb
|
|
23
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-VHRM6GNH.js";
|
|
24
24
|
import "../chunk-G3E7SCME.js";
|
|
25
25
|
import "../chunk-4ZNGQH7C.js";
|
|
26
|
-
import "../chunk-
|
|
26
|
+
import "../chunk-A7X2FDUO.js";
|
|
27
|
+
import "../chunk-FXFQNHRU.js";
|
|
27
28
|
import "../chunk-LVA4I4H7.js";
|
|
28
29
|
import "../chunk-B7PUBQQM.js";
|
|
29
30
|
import {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveRuntimeDependencySnapshot
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-XJA7BPHS.js";
|
|
4
4
|
import "../chunk-G3E7SCME.js";
|
|
5
5
|
import "../chunk-4ZNGQH7C.js";
|
|
6
6
|
import {
|
|
7
7
|
disconnectStateAdapter
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-A7X2FDUO.js";
|
|
9
9
|
import "../chunk-LVA4I4H7.js";
|
|
10
10
|
import {
|
|
11
11
|
pluginCatalogRuntime
|
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-EBFJOOUE.js";
|
|
8
8
|
import {
|
|
9
9
|
defineJuniorPlugins,
|
|
10
10
|
pluginCatalogConfigFromEnv,
|
|
@@ -14,15 +14,15 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
JUNIOR_THREAD_STATE_TTL_MS,
|
|
16
16
|
coerceThreadConversationState
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-XIMUQ4IU.js";
|
|
18
18
|
import {
|
|
19
19
|
addAgentTurnUsage,
|
|
20
20
|
listAgentTurnSessionSummariesForConversations
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import "../chunk-
|
|
21
|
+
} from "../chunk-IVXL57YF.js";
|
|
22
|
+
import "../chunk-IQIBZXGB.js";
|
|
23
23
|
import {
|
|
24
24
|
importConversationFromLegacy
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-JPQISMMJ.js";
|
|
26
26
|
import "../chunk-PDO5BLNM.js";
|
|
27
27
|
import {
|
|
28
28
|
loadAppPluginSet
|
|
@@ -30,18 +30,19 @@ import {
|
|
|
30
30
|
import {
|
|
31
31
|
createPluginLogger,
|
|
32
32
|
createPluginState
|
|
33
|
-
} from "../chunk-
|
|
33
|
+
} from "../chunk-PWC24W5F.js";
|
|
34
34
|
import {
|
|
35
35
|
createJuniorSqlExecutor,
|
|
36
36
|
createSqlConversationMessageStore,
|
|
37
37
|
createSqlStore,
|
|
38
38
|
getDb
|
|
39
|
-
} from "../chunk-
|
|
39
|
+
} from "../chunk-VHRM6GNH.js";
|
|
40
40
|
import {
|
|
41
41
|
disconnectStateAdapter,
|
|
42
42
|
getChatConfig,
|
|
43
43
|
getConnectedStateContext
|
|
44
|
-
} from "../chunk-
|
|
44
|
+
} from "../chunk-A7X2FDUO.js";
|
|
45
|
+
import "../chunk-FXFQNHRU.js";
|
|
45
46
|
import "../chunk-LVA4I4H7.js";
|
|
46
47
|
import {
|
|
47
48
|
parseDestination,
|
|
@@ -1121,12 +1122,129 @@ var redisConversationStateMigration = {
|
|
|
1121
1122
|
run: migrateRedisConversationState
|
|
1122
1123
|
};
|
|
1123
1124
|
|
|
1125
|
+
// src/cli/upgrade/migrations/agent-turn-session-actor.ts
|
|
1126
|
+
import { THREAD_STATE_TTL_MS } from "chat";
|
|
1127
|
+
var AGENT_TURN_SESSION_PREFIX2 = "junior:agent_turn_session";
|
|
1128
|
+
var AGENT_TURN_SESSION_INDEX_KEY2 = `${AGENT_TURN_SESSION_PREFIX2}:index`;
|
|
1129
|
+
var AGENT_TURN_SESSION_INDEX_MAX_LENGTH = 5e3;
|
|
1130
|
+
function conversationIndexKey(conversationId) {
|
|
1131
|
+
return `${AGENT_TURN_SESSION_PREFIX2}:conversation:${conversationId}:index`;
|
|
1132
|
+
}
|
|
1133
|
+
function sessionRecordKey(conversationId, sessionId) {
|
|
1134
|
+
return `${AGENT_TURN_SESSION_PREFIX2}:${conversationId}:${sessionId}`;
|
|
1135
|
+
}
|
|
1136
|
+
function migrateRequesterToActor(value) {
|
|
1137
|
+
if (!isRecord(value) || value.requester === void 0) {
|
|
1138
|
+
return { changed: false, value };
|
|
1139
|
+
}
|
|
1140
|
+
const { requester, ...record } = value;
|
|
1141
|
+
return {
|
|
1142
|
+
changed: true,
|
|
1143
|
+
value: {
|
|
1144
|
+
...record,
|
|
1145
|
+
...record.actor === void 0 ? { actor: requester } : {}
|
|
1146
|
+
}
|
|
1147
|
+
};
|
|
1148
|
+
}
|
|
1149
|
+
async function rewriteList(args) {
|
|
1150
|
+
const values = await args.stateAdapter.getList(args.key);
|
|
1151
|
+
const migrated = values.map(migrateRequesterToActor);
|
|
1152
|
+
const changed = migrated.filter((entry) => entry.changed).length;
|
|
1153
|
+
if (changed === 0) {
|
|
1154
|
+
return { migrated: 0, values };
|
|
1155
|
+
}
|
|
1156
|
+
await args.stateAdapter.delete(args.key);
|
|
1157
|
+
for (const entry of migrated) {
|
|
1158
|
+
await args.stateAdapter.appendToList(args.key, entry.value, {
|
|
1159
|
+
...args.maxLength !== void 0 ? { maxLength: args.maxLength } : {},
|
|
1160
|
+
ttlMs: THREAD_STATE_TTL_MS
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
return { migrated: changed, values: migrated.map((entry) => entry.value) };
|
|
1164
|
+
}
|
|
1165
|
+
async function migrateSessionRecord(args) {
|
|
1166
|
+
const key = sessionRecordKey(args.conversationId, args.sessionId);
|
|
1167
|
+
const existing = await args.stateAdapter.get(key);
|
|
1168
|
+
if (existing === void 0) {
|
|
1169
|
+
return "missing";
|
|
1170
|
+
}
|
|
1171
|
+
const migrated = migrateRequesterToActor(existing);
|
|
1172
|
+
if (!migrated.changed) {
|
|
1173
|
+
return "existing";
|
|
1174
|
+
}
|
|
1175
|
+
await args.stateAdapter.set(key, migrated.value, THREAD_STATE_TTL_MS);
|
|
1176
|
+
return "migrated";
|
|
1177
|
+
}
|
|
1178
|
+
async function migrateAgentTurnSessionActor(context) {
|
|
1179
|
+
const result = {
|
|
1180
|
+
existing: 0,
|
|
1181
|
+
migrated: 0,
|
|
1182
|
+
missing: 0,
|
|
1183
|
+
scanned: 0
|
|
1184
|
+
};
|
|
1185
|
+
const global = await rewriteList({
|
|
1186
|
+
key: AGENT_TURN_SESSION_INDEX_KEY2,
|
|
1187
|
+
maxLength: AGENT_TURN_SESSION_INDEX_MAX_LENGTH,
|
|
1188
|
+
stateAdapter: context.stateAdapter
|
|
1189
|
+
});
|
|
1190
|
+
result.scanned += global.values.length;
|
|
1191
|
+
result.migrated += global.migrated;
|
|
1192
|
+
const conversations = /* @__PURE__ */ new Set();
|
|
1193
|
+
const sessions = /* @__PURE__ */ new Set();
|
|
1194
|
+
for (const value of global.values) {
|
|
1195
|
+
if (!isRecord(value)) {
|
|
1196
|
+
continue;
|
|
1197
|
+
}
|
|
1198
|
+
const conversationId = toOptionalString(value.conversationId);
|
|
1199
|
+
const sessionId = toOptionalString(value.sessionId);
|
|
1200
|
+
if (!conversationId) {
|
|
1201
|
+
continue;
|
|
1202
|
+
}
|
|
1203
|
+
conversations.add(conversationId);
|
|
1204
|
+
if (sessionId) {
|
|
1205
|
+
sessions.add(`${conversationId}\0${sessionId}`);
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
for (const conversationId of conversations) {
|
|
1209
|
+
const conversation = await rewriteList({
|
|
1210
|
+
key: conversationIndexKey(conversationId),
|
|
1211
|
+
stateAdapter: context.stateAdapter
|
|
1212
|
+
});
|
|
1213
|
+
result.scanned += conversation.values.length;
|
|
1214
|
+
result.migrated += conversation.migrated;
|
|
1215
|
+
}
|
|
1216
|
+
for (const session of sessions) {
|
|
1217
|
+
const separator = session.indexOf("\0");
|
|
1218
|
+
const conversationId = session.slice(0, separator);
|
|
1219
|
+
const sessionId = session.slice(separator + 1);
|
|
1220
|
+
result.scanned += 1;
|
|
1221
|
+
const status = await migrateSessionRecord({
|
|
1222
|
+
conversationId,
|
|
1223
|
+
sessionId,
|
|
1224
|
+
stateAdapter: context.stateAdapter
|
|
1225
|
+
});
|
|
1226
|
+
if (status === "migrated") {
|
|
1227
|
+
result.migrated += 1;
|
|
1228
|
+
} else if (status === "existing") {
|
|
1229
|
+
result.existing += 1;
|
|
1230
|
+
} else {
|
|
1231
|
+
result.missing += 1;
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
return result;
|
|
1235
|
+
}
|
|
1236
|
+
var agentTurnSessionActorMigration = {
|
|
1237
|
+
name: "migrate-agent-turn-session-requester-to-actor",
|
|
1238
|
+
run: migrateAgentTurnSessionActor
|
|
1239
|
+
};
|
|
1240
|
+
|
|
1124
1241
|
// src/cli/upgrade.ts
|
|
1125
1242
|
var DEFAULT_IO = {
|
|
1126
1243
|
info: console.log
|
|
1127
1244
|
};
|
|
1128
1245
|
var localPluginLoader = createJiti(import.meta.url, { moduleCache: false });
|
|
1129
1246
|
var MIGRATIONS = [
|
|
1247
|
+
agentTurnSessionActorMigration,
|
|
1130
1248
|
redisConversationStateMigration,
|
|
1131
1249
|
coreSqlSchemaMigration,
|
|
1132
1250
|
sqlConversationMigration,
|
|
@@ -575,6 +575,23 @@ export declare const juniorConversations: import("drizzle-orm/pg-core").PgTableW
|
|
|
575
575
|
} | undefined;
|
|
576
576
|
};
|
|
577
577
|
}>;
|
|
578
|
+
metricRunId: import("drizzle-orm/pg-core").PgColumn<{
|
|
579
|
+
name: "metric_run_id";
|
|
580
|
+
tableName: "junior_conversations";
|
|
581
|
+
dataType: "string";
|
|
582
|
+
columnType: "PgText";
|
|
583
|
+
data: string;
|
|
584
|
+
driverParam: string;
|
|
585
|
+
notNull: false;
|
|
586
|
+
hasDefault: false;
|
|
587
|
+
isPrimaryKey: false;
|
|
588
|
+
isAutoincrement: false;
|
|
589
|
+
hasRuntimeDefault: false;
|
|
590
|
+
enumValues: [string, ...string[]];
|
|
591
|
+
baseColumn: never;
|
|
592
|
+
identity: undefined;
|
|
593
|
+
generated: undefined;
|
|
594
|
+
}, {}, {}>;
|
|
578
595
|
};
|
|
579
596
|
dialect: "pg";
|
|
580
597
|
}>;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const juniorDestinationKindSchema: z.ZodEnum<{
|
|
3
|
+
channel: "channel";
|
|
4
|
+
dm: "dm";
|
|
5
|
+
group: "group";
|
|
6
|
+
local_conversation: "local_conversation";
|
|
7
|
+
thread: "thread";
|
|
8
|
+
web_session: "web_session";
|
|
9
|
+
}>;
|
|
10
|
+
export type JuniorDestinationKind = z.infer<typeof juniorDestinationKindSchema>;
|
|
2
11
|
export type JuniorDestinationVisibility = "direct" | "private" | "public" | "unknown";
|
|
3
12
|
export declare const juniorDestinations: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
4
13
|
name: "junior_destinations";
|
|
@@ -77,7 +86,7 @@ export declare const juniorDestinations: import("drizzle-orm/pg-core").PgTableWi
|
|
|
77
86
|
tableName: "junior_destinations";
|
|
78
87
|
dataType: "string";
|
|
79
88
|
columnType: "PgText";
|
|
80
|
-
data:
|
|
89
|
+
data: "channel" | "dm" | "group" | "local_conversation" | "thread" | "web_session";
|
|
81
90
|
driverParam: string;
|
|
82
91
|
notNull: true;
|
|
83
92
|
hasDefault: false;
|
|
@@ -89,7 +98,7 @@ export declare const juniorDestinations: import("drizzle-orm/pg-core").PgTableWi
|
|
|
89
98
|
identity: undefined;
|
|
90
99
|
generated: undefined;
|
|
91
100
|
}, {}, {
|
|
92
|
-
$type:
|
|
101
|
+
$type: "channel" | "dm" | "group" | "local_conversation" | "thread" | "web_session";
|
|
93
102
|
}>;
|
|
94
103
|
parentDestinationId: import("drizzle-orm/pg-core").PgColumn<{
|
|
95
104
|
name: "parent_destination_id";
|
package/dist/db/schema.d.ts
CHANGED
|
@@ -857,6 +857,23 @@ export declare const juniorSqlSchema: {
|
|
|
857
857
|
} | undefined;
|
|
858
858
|
};
|
|
859
859
|
}>;
|
|
860
|
+
metricRunId: import("drizzle-orm/pg-core").PgColumn<{
|
|
861
|
+
name: "metric_run_id";
|
|
862
|
+
tableName: "junior_conversations";
|
|
863
|
+
dataType: "string";
|
|
864
|
+
columnType: "PgText";
|
|
865
|
+
data: string;
|
|
866
|
+
driverParam: string;
|
|
867
|
+
notNull: false;
|
|
868
|
+
hasDefault: false;
|
|
869
|
+
isPrimaryKey: false;
|
|
870
|
+
isAutoincrement: false;
|
|
871
|
+
hasRuntimeDefault: false;
|
|
872
|
+
enumValues: [string, ...string[]];
|
|
873
|
+
baseColumn: never;
|
|
874
|
+
identity: undefined;
|
|
875
|
+
generated: undefined;
|
|
876
|
+
}, {}, {}>;
|
|
860
877
|
};
|
|
861
878
|
dialect: "pg";
|
|
862
879
|
}>;
|
|
@@ -937,7 +954,7 @@ export declare const juniorSqlSchema: {
|
|
|
937
954
|
tableName: "junior_destinations";
|
|
938
955
|
dataType: "string";
|
|
939
956
|
columnType: "PgText";
|
|
940
|
-
data:
|
|
957
|
+
data: "channel" | "dm" | "group" | "local_conversation" | "thread" | "web_session";
|
|
941
958
|
driverParam: string;
|
|
942
959
|
notNull: true;
|
|
943
960
|
hasDefault: false;
|
|
@@ -949,7 +966,7 @@ export declare const juniorSqlSchema: {
|
|
|
949
966
|
identity: undefined;
|
|
950
967
|
generated: undefined;
|
|
951
968
|
}, {}, {
|
|
952
|
-
$type:
|
|
969
|
+
$type: "channel" | "dm" | "group" | "local_conversation" | "thread" | "web_session";
|
|
953
970
|
}>;
|
|
954
971
|
parentDestinationId: import("drizzle-orm/pg-core").PgColumn<{
|
|
955
972
|
name: "parent_destination_id";
|
|
@@ -6,8 +6,9 @@ import {
|
|
|
6
6
|
getConversationStore,
|
|
7
7
|
getDb,
|
|
8
8
|
getSqlExecutor
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-VHRM6GNH.js";
|
|
10
|
+
import "./chunk-A7X2FDUO.js";
|
|
11
|
+
import "./chunk-FXFQNHRU.js";
|
|
11
12
|
import "./chunk-LVA4I4H7.js";
|
|
12
13
|
import "./chunk-B7PUBQQM.js";
|
|
13
14
|
import "./chunk-I35CTGPO.js";
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildConversationDetail
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5VGJJSSV.js";
|
|
4
4
|
import {
|
|
5
5
|
readConversationRecordFromSql
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JSAANELJ.js";
|
|
7
7
|
import {
|
|
8
8
|
conversationDetailReportSchema
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-HYDQULR2.js";
|
|
10
10
|
import "./chunk-LVUKF5CE.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-VVIXK2BX.js";
|
|
12
12
|
import {
|
|
13
13
|
listBoundedAgentTurnSessionSummariesForConversation
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-IVXL57YF.js";
|
|
15
|
+
import "./chunk-IQIBZXGB.js";
|
|
16
|
+
import "./chunk-JPQISMMJ.js";
|
|
17
17
|
import "./chunk-PDO5BLNM.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-FP5N5OWZ.js";
|
|
19
|
+
import "./chunk-VHRM6GNH.js";
|
|
20
20
|
import "./chunk-4ZNGQH7C.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-A7X2FDUO.js";
|
|
22
|
+
import "./chunk-FXFQNHRU.js";
|
|
22
23
|
import "./chunk-LVA4I4H7.js";
|
|
23
24
|
import "./chunk-B7PUBQQM.js";
|
|
24
25
|
import {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
readLocationDetailFromSql
|
|
3
|
+
} from "./chunk-VFBFK6EY.js";
|
|
4
|
+
import "./chunk-QOZOJNSE.js";
|
|
5
|
+
import "./chunk-PGGEOCQY.js";
|
|
6
|
+
import {
|
|
7
|
+
locationDetailReportSchema
|
|
8
|
+
} from "./chunk-HNIT4HXU.js";
|
|
9
|
+
import "./chunk-HYDQULR2.js";
|
|
10
|
+
import "./chunk-PDO5BLNM.js";
|
|
11
|
+
import "./chunk-VHRM6GNH.js";
|
|
12
|
+
import "./chunk-A7X2FDUO.js";
|
|
13
|
+
import "./chunk-FXFQNHRU.js";
|
|
14
|
+
import "./chunk-LVA4I4H7.js";
|
|
15
|
+
import "./chunk-B7PUBQQM.js";
|
|
16
|
+
import "./chunk-I35CTGPO.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
|
+
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureLegacyConversationImport,
|
|
3
3
|
importConversationFromLegacy
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-JPQISMMJ.js";
|
|
5
|
+
import "./chunk-VHRM6GNH.js";
|
|
6
|
+
import "./chunk-A7X2FDUO.js";
|
|
7
|
+
import "./chunk-FXFQNHRU.js";
|
|
7
8
|
import "./chunk-LVA4I4H7.js";
|
|
8
9
|
import "./chunk-B7PUBQQM.js";
|
|
9
10
|
import "./chunk-I35CTGPO.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
readLocationDirectoryFromSql
|
|
3
|
+
} from "./chunk-VFBFK6EY.js";
|
|
4
|
+
import "./chunk-QOZOJNSE.js";
|
|
5
|
+
import "./chunk-PGGEOCQY.js";
|
|
6
|
+
import {
|
|
7
|
+
locationDirectoryReportSchema
|
|
8
|
+
} from "./chunk-HNIT4HXU.js";
|
|
9
|
+
import "./chunk-HYDQULR2.js";
|
|
10
|
+
import "./chunk-PDO5BLNM.js";
|
|
11
|
+
import "./chunk-VHRM6GNH.js";
|
|
12
|
+
import "./chunk-A7X2FDUO.js";
|
|
13
|
+
import "./chunk-FXFQNHRU.js";
|
|
14
|
+
import "./chunk-LVA4I4H7.js";
|
|
15
|
+
import "./chunk-B7PUBQQM.js";
|
|
16
|
+
import "./chunk-I35CTGPO.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
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import {
|
|
2
|
+
verifiedActorWhere
|
|
3
|
+
} from "./chunk-GEUUJRQF.js";
|
|
4
|
+
import {
|
|
5
|
+
conversationActiveDaysColumn,
|
|
6
|
+
conversationAggregateColumns,
|
|
7
|
+
conversationRangeColumns
|
|
8
|
+
} from "./chunk-PGGEOCQY.js";
|
|
9
|
+
import {
|
|
10
|
+
actorDirectoryReportSchema
|
|
11
|
+
} from "./chunk-DBPLXSBK.js";
|
|
12
|
+
import "./chunk-HYDQULR2.js";
|
|
13
|
+
import "./chunk-PDO5BLNM.js";
|
|
14
|
+
import {
|
|
15
|
+
getDb,
|
|
16
|
+
juniorConversations,
|
|
17
|
+
juniorIdentities,
|
|
18
|
+
juniorUsers
|
|
19
|
+
} from "./chunk-VHRM6GNH.js";
|
|
20
|
+
import "./chunk-A7X2FDUO.js";
|
|
21
|
+
import "./chunk-FXFQNHRU.js";
|
|
22
|
+
import "./chunk-LVA4I4H7.js";
|
|
23
|
+
import "./chunk-B7PUBQQM.js";
|
|
24
|
+
import "./chunk-I35CTGPO.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 { eq, sql } from "drizzle-orm";
|
|
32
|
+
async function readPeopleListFromSql() {
|
|
33
|
+
const nowMs = Date.now();
|
|
34
|
+
const rows = await getDb().select({
|
|
35
|
+
email: juniorUsers.primaryEmailNormalized,
|
|
36
|
+
fullName: juniorUsers.displayName,
|
|
37
|
+
slackUserId: sql`MAX(${juniorIdentities.providerSubjectId})`,
|
|
38
|
+
slackUserName: sql`MAX(${juniorIdentities.handle})`,
|
|
39
|
+
activeDays: conversationActiveDaysColumn(),
|
|
40
|
+
...conversationAggregateColumns(),
|
|
41
|
+
...conversationRangeColumns()
|
|
42
|
+
}).from(juniorConversations).innerJoin(
|
|
43
|
+
juniorIdentities,
|
|
44
|
+
eq(juniorIdentities.id, juniorConversations.actorIdentityId)
|
|
45
|
+
).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(verifiedActorWhere()).groupBy(juniorUsers.primaryEmailNormalized, juniorUsers.displayName);
|
|
46
|
+
const people = rows.map((row) => {
|
|
47
|
+
const actor = {
|
|
48
|
+
email: row.email,
|
|
49
|
+
...row.fullName ? { fullName: row.fullName } : {},
|
|
50
|
+
...row.slackUserId ? { slackUserId: row.slackUserId } : {},
|
|
51
|
+
...row.slackUserName ? { slackUserName: row.slackUserName } : {}
|
|
52
|
+
};
|
|
53
|
+
return {
|
|
54
|
+
active: row.active,
|
|
55
|
+
activeDays: row.activeDays,
|
|
56
|
+
conversations: row.conversations,
|
|
57
|
+
durationMs: row.durationMs,
|
|
58
|
+
failed: row.failed,
|
|
59
|
+
firstSeenAt: row.firstSeenAt.toISOString(),
|
|
60
|
+
lastSeenAt: row.lastSeenAt.toISOString(),
|
|
61
|
+
actor,
|
|
62
|
+
...row.tokens !== null ? { tokens: row.tokens } : {}
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
return {
|
|
66
|
+
generatedAt: new Date(nowMs).toISOString(),
|
|
67
|
+
people: people.sort(
|
|
68
|
+
(left, right) => Date.parse(right.lastSeenAt) - Date.parse(left.lastSeenAt) || right.conversations - left.conversations || left.actor.email.localeCompare(right.actor.email)
|
|
69
|
+
),
|
|
70
|
+
source: "conversation_index"
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// src/api/people/list.ts
|
|
75
|
+
async function readPeopleList() {
|
|
76
|
+
return actorDirectoryReportSchema.parse(await readPeopleListFromSql());
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
readPeopleList
|
|
80
|
+
};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readConversationFeedFromSql
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JSAANELJ.js";
|
|
4
4
|
import {
|
|
5
5
|
conversationFeedSchema
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-HYDQULR2.js";
|
|
7
|
+
import "./chunk-VVIXK2BX.js";
|
|
8
8
|
import "./chunk-PDO5BLNM.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-FP5N5OWZ.js";
|
|
10
|
+
import "./chunk-VHRM6GNH.js";
|
|
11
11
|
import "./chunk-4ZNGQH7C.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-A7X2FDUO.js";
|
|
13
|
+
import "./chunk-FXFQNHRU.js";
|
|
13
14
|
import "./chunk-LVA4I4H7.js";
|
|
14
15
|
import "./chunk-B7PUBQQM.js";
|
|
15
16
|
import "./chunk-I35CTGPO.js";
|