@sentry/junior 0.93.0 → 0.95.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-ZG7IDOIN.js → agent-hooks-FTQ5EGPO.js} +9 -10
- package/dist/api/people/list.js +7 -7
- package/dist/api/people/profile.js +7 -7
- package/dist/api/people/shared.d.ts +2 -2
- package/dist/api-reference.d.ts +1 -1
- package/dist/app.js +474 -231
- package/dist/{catalog-runtime-NZHMSMYC.js → catalog-runtime-2D7IVKUT.js} +3 -3
- package/dist/chat/advisor-request.d.ts +4 -0
- package/dist/chat/agent/request.d.ts +2 -0
- package/dist/chat/agent/resume.d.ts +2 -0
- package/dist/chat/conversations/history.d.ts +128 -0
- package/dist/chat/conversations/legacy-import.d.ts +38 -0
- package/dist/chat/conversations/messages.d.ts +39 -0
- package/dist/chat/conversations/projection.d.ts +94 -0
- package/dist/chat/conversations/retention.d.ts +36 -0
- package/dist/chat/conversations/sql/conversation-row.d.ts +14 -0
- package/dist/chat/conversations/sql/history.d.ts +4 -0
- package/dist/chat/conversations/sql/legacy-history-import.d.ts +55 -0
- package/dist/chat/conversations/sql/messages.d.ts +4 -0
- package/dist/chat/conversations/sql/migrations.d.ts +14 -3
- package/dist/chat/conversations/sql/purge.d.ts +53 -0
- package/dist/chat/conversations/sql/store.d.ts +7 -2
- package/dist/chat/conversations/store.d.ts +19 -0
- package/dist/chat/conversations/visible-compactions.d.ts +11 -0
- package/dist/chat/conversations/visible-messages.d.ts +47 -0
- package/dist/chat/db.d.ts +12 -1
- package/dist/chat/egress/credentialed.d.ts +1 -1
- package/dist/chat/identities/sql.d.ts +1 -1
- package/dist/chat/logging.d.ts +2 -1
- package/dist/chat/resource-events/store.d.ts +2 -1
- package/dist/chat/runtime/reply-executor.d.ts +8 -0
- package/dist/chat/runtime/thread-state.d.ts +2 -0
- package/dist/chat/sandbox/egress/schemas.d.ts +4 -0
- package/dist/chat/sandbox/egress/session.d.ts +2 -2
- package/dist/chat/sandbox/resources.d.ts +4 -0
- package/dist/chat/services/mcp-auth-orchestration.d.ts +8 -0
- package/dist/chat/services/plugin-auth-orchestration.d.ts +12 -0
- package/dist/chat/services/turn-session-record.d.ts +14 -2
- package/dist/chat/sleep.d.ts +2 -0
- package/dist/chat/state/conversation.d.ts +7 -4
- package/dist/chat/state/session-log.d.ts +23 -1
- package/dist/chat/state/turn-session.d.ts +6 -0
- package/dist/chat/tool-support/private-trace-result.d.ts +4 -0
- package/dist/chat/tool-support/zod-tool.d.ts +1 -0
- package/dist/chat/tools/advisor/tool.d.ts +9 -4
- package/dist/chat/tools/definition.d.ts +2 -0
- package/dist/chat/tools/execution/tool-error-handler.d.ts +2 -2
- package/dist/chat/tools/system-time.d.ts +8 -0
- package/dist/chat/xml.d.ts +2 -0
- package/dist/{chunk-NYWPISSO.js → chunk-2XXEKR44.js} +1 -1
- package/dist/{chunk-QGEWC27H.js → chunk-5XMNOD3S.js} +5 -7
- package/dist/{chunk-NFXSLTYG.js → chunk-6ONME5IG.js} +864 -62
- package/dist/{chunk-LFLTJQVR.js → chunk-7FBGKXPE.js} +4 -0
- package/dist/{chunk-MC4ZZE4Q.js → chunk-AYP4ERVZ.js} +1 -1
- package/dist/{chunk-GHGPTPBL.js → chunk-B7PUBQQM.js} +1 -1
- package/dist/chunk-CM5EZD5F.js +17 -0
- package/dist/chunk-CRRBJ3JP.js +1037 -0
- package/dist/{chunk-G3E7SCME.js → chunk-CZEX6KIQ.js} +23 -0
- package/dist/{chunk-TNUUATT7.js → chunk-E3E2XNCN.js} +2 -2
- package/dist/{chunk-LNCREA5Z.js → chunk-EKNJM5IG.js} +3 -127
- package/dist/{chunk-NAPITCZ6.js → chunk-GUE7HTNR.js} +251 -6
- package/dist/{chunk-BTH37NCU.js → chunk-GVOUCI2O.js} +1 -1
- package/dist/{chunk-YYBX2BD5.js → chunk-GY34VGP5.js} +1 -1
- package/dist/{chunk-JJUJ4CO2.js → chunk-HCXXB35T.js} +1489 -360
- package/dist/{chunk-YTNPU7I2.js → chunk-HDTO3A74.js} +2 -2
- package/dist/{chunk-YJ4OPVNA.js → chunk-HZNJLKKI.js} +1 -1
- package/dist/{chunk-HDNWZMUN.js → chunk-KDPCGVIT.js} +116 -51
- package/dist/chunk-N4RNJ32C.js +48 -0
- package/dist/{chunk-UUB3D2XI.js → chunk-NSCHU54X.js} +8 -10
- package/dist/{chunk-PFXC67GJ.js → chunk-RAIB6WSG.js} +6 -80
- package/dist/chunk-WAGQ377B.js +724 -0
- package/dist/{chunk-6H4PP63X.js → chunk-WCMQJE4F.js} +24 -14
- package/dist/{chunk-S6QKIGRM.js → chunk-WPOJ443W.js} +15 -25
- package/dist/{chunk-MAVOJ54A.js → chunk-XX4N4E6C.js} +25 -388
- package/dist/cli/chat.js +24 -23
- package/dist/cli/check.js +4 -4
- package/dist/cli/plugins.js +11 -12
- package/dist/cli/snapshot-warmup.js +7 -8
- package/dist/cli/upgrade.js +78 -17
- package/dist/db/schema/agent-steps.d.ts +134 -0
- package/dist/db/schema/conversation-messages.d.ts +153 -0
- package/dist/{chat/conversations/sql → db}/schema/conversations.d.ts +34 -0
- package/dist/{chat/conversations/sql → db}/schema.d.ts +319 -8
- package/dist/db-W55B74OP.js +24 -0
- package/dist/deployment.d.ts +2 -0
- package/dist/handlers/retention.d.ts +6 -0
- package/dist/instrumentation.js +16 -3
- package/dist/legacy-import-ZPLGLAFD.js +17 -0
- package/dist/nitro.js +14 -4
- package/dist/reporting/conversations/activity.d.ts +40 -0
- package/dist/reporting/conversations/context.d.ts +8 -0
- package/dist/reporting/conversations/details.d.ts +6 -0
- package/dist/reporting/conversations/index.d.ts +4 -0
- package/dist/reporting/conversations/shared.d.ts +9 -0
- package/dist/reporting/conversations/statistics.d.ts +4 -0
- package/dist/reporting/conversations/summaries.d.ts +17 -0
- package/dist/reporting/conversations/transcript.d.ts +28 -0
- package/dist/reporting/conversations/types.d.ts +178 -0
- package/dist/reporting/conversations.d.ts +1 -178
- package/dist/reporting.d.ts +4 -3
- package/dist/reporting.js +603 -827
- package/dist/{runner-XAZPJNAQ.js → runner-OOSBDYRK.js} +35 -41
- package/dist/{validation-KYAWETI4.js → validation-QCGRFRFZ.js} +4 -4
- package/migrations/README.md +32 -0
- package/migrations/meta/0000_snapshot.json +978 -0
- package/migrations/meta/_journal.json +13 -0
- package/package.json +9 -6
- package/dist/chat/sql/schema.d.ts +0 -1049
- package/dist/chat/state/conversation-details.d.ts +0 -47
- package/dist/chunk-7STN2ZSK.js +0 -250
- package/dist/chunk-LE5ANBUZ.js +0 -1040
- package/dist/chunk-QL66APYJ.js +0 -1377
- package/dist/db-YDN6AFJH.js +0 -18
- /package/dist/{chat/sql → db}/db.d.ts +0 -0
- /package/dist/{chat/sql → db}/executor.d.ts +0 -0
- /package/dist/{chat/sql → db}/neon.d.ts +0 -0
- /package/dist/{chat/sql → db}/postgres.d.ts +0 -0
- /package/dist/{chat/conversations/sql → db}/schema/destinations.d.ts +0 -0
- /package/dist/{chat/conversations/sql → db}/schema/identities.d.ts +0 -0
- /package/dist/{chat/conversations/sql → db}/schema/migrations.d.ts +0 -0
- /package/dist/{chat/conversations/sql → db}/schema/timestamps.d.ts +0 -0
- /package/dist/{chat/conversations/sql → db}/schema/users.d.ts +0 -0
package/dist/cli/chat.js
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
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-
|
|
4
|
+
} from "../chunk-HCXXB35T.js";
|
|
5
|
+
import "../chunk-KDPCGVIT.js";
|
|
6
|
+
import "../chunk-RAIB6WSG.js";
|
|
7
|
+
import "../chunk-WCMQJE4F.js";
|
|
8
|
+
import "../chunk-CM5EZD5F.js";
|
|
9
|
+
import "../chunk-N4RNJ32C.js";
|
|
10
|
+
import "../chunk-WAGQ377B.js";
|
|
11
|
+
import "../chunk-CRRBJ3JP.js";
|
|
10
12
|
import {
|
|
11
13
|
loadAppPluginSet
|
|
12
14
|
} from "../chunk-Y2CM7HXH.js";
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-S6QKIGRM.js";
|
|
15
|
+
import "../chunk-NSCHU54X.js";
|
|
16
|
+
import "../chunk-E3E2XNCN.js";
|
|
17
|
+
import "../chunk-CZEX6KIQ.js";
|
|
18
|
+
import "../chunk-6ONME5IG.js";
|
|
19
|
+
import "../chunk-GUE7HTNR.js";
|
|
20
|
+
import "../chunk-GY34VGP5.js";
|
|
21
|
+
import "../chunk-B7PUBQQM.js";
|
|
22
|
+
import "../chunk-HDTO3A74.js";
|
|
23
|
+
import "../chunk-GVOUCI2O.js";
|
|
24
|
+
import "../chunk-WPOJ443W.js";
|
|
24
25
|
import "../chunk-OB42YVAE.js";
|
|
25
26
|
import "../chunk-3DA7X2U3.js";
|
|
26
27
|
import "../chunk-6APU57E6.js";
|
|
27
|
-
import "../chunk-
|
|
28
|
+
import "../chunk-7FBGKXPE.js";
|
|
28
29
|
import "../chunk-MLKGABMK.js";
|
|
29
30
|
|
|
30
31
|
// src/cli/chat.ts
|
|
@@ -147,10 +148,10 @@ async function configureLocalChatPlugins(pluginSet) {
|
|
|
147
148
|
databaseModule
|
|
148
149
|
] = await Promise.all([
|
|
149
150
|
import("../plugins-PZMDS7AT.js"),
|
|
150
|
-
import("../agent-hooks-
|
|
151
|
-
import("../catalog-runtime-
|
|
152
|
-
import("../validation-
|
|
153
|
-
import("../db-
|
|
151
|
+
import("../agent-hooks-FTQ5EGPO.js"),
|
|
152
|
+
import("../catalog-runtime-2D7IVKUT.js"),
|
|
153
|
+
import("../validation-QCGRFRFZ.js"),
|
|
154
|
+
import("../db-W55B74OP.js")
|
|
154
155
|
]);
|
|
155
156
|
const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
|
|
156
157
|
const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
|
|
@@ -211,7 +212,7 @@ function newRunConversationId() {
|
|
|
211
212
|
async function prepareLocalChatRun(io, pluginSet) {
|
|
212
213
|
defaultStateAdapterForLocalChat();
|
|
213
214
|
await configureLocalChatPlugins(pluginSet);
|
|
214
|
-
const { runLocalAgentTurn } = await import("../runner-
|
|
215
|
+
const { runLocalAgentTurn } = await import("../runner-OOSBDYRK.js");
|
|
215
216
|
const deps = {
|
|
216
217
|
agentRunner: createAgentRunner(executeAgentRun),
|
|
217
218
|
deliverReply: async (reply) => {
|
package/dist/cli/check.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseSkillFile
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-HDTO3A74.js";
|
|
4
4
|
import {
|
|
5
5
|
parseInlinePluginManifest,
|
|
6
6
|
parsePluginManifest
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-GVOUCI2O.js";
|
|
8
|
+
import "../chunk-WPOJ443W.js";
|
|
9
9
|
import "../chunk-OB42YVAE.js";
|
|
10
10
|
import "../chunk-3DA7X2U3.js";
|
|
11
11
|
import "../chunk-6APU57E6.js";
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
|
|
14
14
|
JUNIOR_HEARTBEAT_ROUTE,
|
|
15
15
|
LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-7FBGKXPE.js";
|
|
17
17
|
import "../chunk-MLKGABMK.js";
|
|
18
18
|
|
|
19
19
|
// src/cli/check.ts
|
package/dist/cli/plugins.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
validatePluginEgressCredentialHooks,
|
|
3
3
|
validatePluginRegistrations
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-AYP4ERVZ.js";
|
|
5
5
|
import {
|
|
6
6
|
pluginCatalogConfigFromPluginSet,
|
|
7
7
|
pluginCliRegistrationsFromPluginSet,
|
|
@@ -13,26 +13,25 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
setPlugins,
|
|
15
15
|
validatePlugins
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-NSCHU54X.js";
|
|
17
17
|
import {
|
|
18
18
|
createPluginLogger
|
|
19
|
-
} from "../chunk-
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-7STN2ZSK.js";
|
|
19
|
+
} from "../chunk-E3E2XNCN.js";
|
|
20
|
+
import "../chunk-CZEX6KIQ.js";
|
|
22
21
|
import {
|
|
23
22
|
getDb
|
|
24
|
-
} from "../chunk-
|
|
25
|
-
import "../chunk-
|
|
26
|
-
import "../chunk-
|
|
27
|
-
import "../chunk-
|
|
23
|
+
} from "../chunk-6ONME5IG.js";
|
|
24
|
+
import "../chunk-GUE7HTNR.js";
|
|
25
|
+
import "../chunk-GY34VGP5.js";
|
|
26
|
+
import "../chunk-B7PUBQQM.js";
|
|
28
27
|
import {
|
|
29
28
|
pluginCatalogRuntime
|
|
30
|
-
} from "../chunk-
|
|
31
|
-
import "../chunk-
|
|
29
|
+
} from "../chunk-GVOUCI2O.js";
|
|
30
|
+
import "../chunk-WPOJ443W.js";
|
|
32
31
|
import "../chunk-OB42YVAE.js";
|
|
33
32
|
import "../chunk-3DA7X2U3.js";
|
|
34
33
|
import "../chunk-6APU57E6.js";
|
|
35
|
-
import "../chunk-
|
|
34
|
+
import "../chunk-7FBGKXPE.js";
|
|
36
35
|
import "../chunk-MLKGABMK.js";
|
|
37
36
|
|
|
38
37
|
// src/cli/plugins.ts
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveRuntimeDependencySnapshot
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-WCMQJE4F.js";
|
|
4
|
+
import "../chunk-CZEX6KIQ.js";
|
|
5
5
|
import {
|
|
6
6
|
disconnectStateAdapter
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-YYBX2BD5.js";
|
|
7
|
+
} from "../chunk-GUE7HTNR.js";
|
|
8
|
+
import "../chunk-GY34VGP5.js";
|
|
10
9
|
import {
|
|
11
10
|
pluginCatalogRuntime
|
|
12
|
-
} from "../chunk-
|
|
13
|
-
import "../chunk-
|
|
11
|
+
} from "../chunk-GVOUCI2O.js";
|
|
12
|
+
import "../chunk-WPOJ443W.js";
|
|
14
13
|
import "../chunk-OB42YVAE.js";
|
|
15
14
|
import "../chunk-3DA7X2U3.js";
|
|
16
15
|
import "../chunk-6APU57E6.js";
|
|
17
|
-
import "../chunk-
|
|
16
|
+
import "../chunk-7FBGKXPE.js";
|
|
18
17
|
import "../chunk-MLKGABMK.js";
|
|
19
18
|
|
|
20
19
|
// src/cli/snapshot-warmup.ts
|
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-5XMNOD3S.js";
|
|
8
8
|
import {
|
|
9
9
|
defineJuniorPlugins,
|
|
10
10
|
pluginCatalogConfigFromEnv,
|
|
@@ -12,37 +12,40 @@ import {
|
|
|
12
12
|
pluginRuntimeRegistrationsFromPluginSet
|
|
13
13
|
} from "../chunk-SG5WAA7H.js";
|
|
14
14
|
import {
|
|
15
|
-
JUNIOR_THREAD_STATE_TTL_MS,
|
|
16
15
|
coerceThreadConversationState
|
|
17
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-RAIB6WSG.js";
|
|
17
|
+
import {
|
|
18
|
+
JUNIOR_THREAD_STATE_TTL_MS,
|
|
19
|
+
importConversationFromLegacy
|
|
20
|
+
} from "../chunk-CRRBJ3JP.js";
|
|
18
21
|
import {
|
|
19
22
|
loadAppPluginSet
|
|
20
23
|
} from "../chunk-Y2CM7HXH.js";
|
|
21
24
|
import {
|
|
22
25
|
createPluginLogger,
|
|
23
26
|
createPluginState
|
|
24
|
-
} from "../chunk-
|
|
25
|
-
import {
|
|
26
|
-
disconnectStateAdapter,
|
|
27
|
-
getConnectedStateContext
|
|
28
|
-
} from "../chunk-7STN2ZSK.js";
|
|
27
|
+
} from "../chunk-E3E2XNCN.js";
|
|
29
28
|
import {
|
|
30
29
|
createJuniorSqlExecutor,
|
|
30
|
+
createSqlConversationMessageStore,
|
|
31
31
|
createSqlStore,
|
|
32
|
-
getDb
|
|
33
|
-
|
|
32
|
+
getDb,
|
|
33
|
+
migrateSchema
|
|
34
|
+
} from "../chunk-6ONME5IG.js";
|
|
34
35
|
import {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
disconnectStateAdapter,
|
|
37
|
+
getChatConfig,
|
|
38
|
+
getConnectedStateContext
|
|
39
|
+
} from "../chunk-GUE7HTNR.js";
|
|
40
|
+
import "../chunk-GY34VGP5.js";
|
|
38
41
|
import {
|
|
39
42
|
parseDestination,
|
|
40
43
|
sameDestination
|
|
41
|
-
} from "../chunk-
|
|
44
|
+
} from "../chunk-B7PUBQQM.js";
|
|
42
45
|
import {
|
|
43
46
|
pluginCatalogRuntime
|
|
44
|
-
} from "../chunk-
|
|
45
|
-
import "../chunk-
|
|
47
|
+
} from "../chunk-GVOUCI2O.js";
|
|
48
|
+
import "../chunk-WPOJ443W.js";
|
|
46
49
|
import {
|
|
47
50
|
isRecord,
|
|
48
51
|
toOptionalNumber,
|
|
@@ -50,7 +53,7 @@ import {
|
|
|
50
53
|
} from "../chunk-OB42YVAE.js";
|
|
51
54
|
import "../chunk-3DA7X2U3.js";
|
|
52
55
|
import "../chunk-6APU57E6.js";
|
|
53
|
-
import "../chunk-
|
|
56
|
+
import "../chunk-7FBGKXPE.js";
|
|
54
57
|
import "../chunk-MLKGABMK.js";
|
|
55
58
|
|
|
56
59
|
// src/cli/upgrade.ts
|
|
@@ -78,6 +81,9 @@ function createStateConversationStore(state) {
|
|
|
78
81
|
// Task-execution state has no destination records, so visibility is never
|
|
79
82
|
// source-confirmed here and cross-context reads fail closed to private.
|
|
80
83
|
getDestinationVisibility: async () => void 0,
|
|
84
|
+
// Subagent child conversations are a SQL-only concept; the advisor always
|
|
85
|
+
// links its child through the SQL store, never this legacy metadata path.
|
|
86
|
+
ensureChildConversation: async () => void 0,
|
|
81
87
|
recordActivity: (args) => recordConversationActivity({ ...args, state }),
|
|
82
88
|
recordExecution: (args) => recordConversationExecution({ ...args, state }),
|
|
83
89
|
listByActivity: (args) => listConversationsByActivity({ ...args, state })
|
|
@@ -121,6 +127,60 @@ var sqlConversationMigration = {
|
|
|
121
127
|
run: migrateConversationsToSql
|
|
122
128
|
};
|
|
123
129
|
|
|
130
|
+
// src/cli/upgrade/migrations/conversations-history-sql.ts
|
|
131
|
+
var HISTORY_BACKFILL_LIMIT = 1e4;
|
|
132
|
+
async function migrateConversationHistoryToSql(context, options = {}) {
|
|
133
|
+
const source = createStateConversationStore(context.stateAdapter);
|
|
134
|
+
let executor = options.executor;
|
|
135
|
+
let closeExecutor;
|
|
136
|
+
if (!executor) {
|
|
137
|
+
const { sql } = getChatConfig();
|
|
138
|
+
executor = createJuniorSqlExecutor({
|
|
139
|
+
connectionString: sql.databaseUrl,
|
|
140
|
+
driver: sql.driver
|
|
141
|
+
});
|
|
142
|
+
closeExecutor = () => executor.close();
|
|
143
|
+
}
|
|
144
|
+
const limit = Math.max(1, options.batchSize ?? HISTORY_BACKFILL_LIMIT);
|
|
145
|
+
try {
|
|
146
|
+
await migrateSchema(executor);
|
|
147
|
+
const messageStore = createSqlConversationMessageStore(executor);
|
|
148
|
+
const conversations = await source.listByActivity({ limit });
|
|
149
|
+
let migrated = 0;
|
|
150
|
+
let existing = 0;
|
|
151
|
+
for (const conversation of conversations) {
|
|
152
|
+
const result = await importConversationFromLegacy(
|
|
153
|
+
conversation.conversationId,
|
|
154
|
+
{
|
|
155
|
+
executor,
|
|
156
|
+
messageStore,
|
|
157
|
+
conversationRecord: conversation,
|
|
158
|
+
...options.sessionLogStore ? { sessionLogStore: options.sessionLogStore } : {},
|
|
159
|
+
...options.advisorSessionStore ? { advisorSessionStore: options.advisorSessionStore } : {},
|
|
160
|
+
...options.loadVisibleMessages ? { loadVisibleMessages: options.loadVisibleMessages } : {}
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
if (result.imported) {
|
|
164
|
+
migrated += 1;
|
|
165
|
+
} else {
|
|
166
|
+
existing += 1;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
existing,
|
|
171
|
+
migrated,
|
|
172
|
+
missing: 0,
|
|
173
|
+
scanned: conversations.length
|
|
174
|
+
};
|
|
175
|
+
} finally {
|
|
176
|
+
await closeExecutor?.();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
var sqlConversationHistoryMigration = {
|
|
180
|
+
name: "backfill-agent-steps-sql",
|
|
181
|
+
run: migrateConversationHistoryToSql
|
|
182
|
+
};
|
|
183
|
+
|
|
124
184
|
// src/cli/upgrade/migrations/upgrade-plugins.ts
|
|
125
185
|
function unique(values) {
|
|
126
186
|
return [...new Set(values)];
|
|
@@ -940,6 +1000,7 @@ var localPluginLoader = createJiti(import.meta.url, { moduleCache: false });
|
|
|
940
1000
|
var MIGRATIONS = [
|
|
941
1001
|
redisConversationStateMigration,
|
|
942
1002
|
sqlConversationMigration,
|
|
1003
|
+
sqlConversationHistoryMigration,
|
|
943
1004
|
sqlPluginMigration,
|
|
944
1005
|
pluginStorageMigration
|
|
945
1006
|
];
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Append-only durable execution history: one row per agent step. `context_epoch`
|
|
3
|
+
* partitions the log into rebuild generations; the model context is the highest
|
|
4
|
+
* epoch's `pi_message` rows in `seq` order. The `(conversation_id, seq)` primary
|
|
5
|
+
* key doubles as the lease-fencing tripwire — a conflicting append fails loudly.
|
|
6
|
+
*/
|
|
7
|
+
export declare const juniorAgentSteps: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
8
|
+
name: "junior_agent_steps";
|
|
9
|
+
schema: undefined;
|
|
10
|
+
columns: {
|
|
11
|
+
conversationId: import("drizzle-orm/pg-core").PgColumn<{
|
|
12
|
+
name: "conversation_id";
|
|
13
|
+
tableName: "junior_agent_steps";
|
|
14
|
+
dataType: "string";
|
|
15
|
+
columnType: "PgText";
|
|
16
|
+
data: string;
|
|
17
|
+
driverParam: string;
|
|
18
|
+
notNull: true;
|
|
19
|
+
hasDefault: false;
|
|
20
|
+
isPrimaryKey: false;
|
|
21
|
+
isAutoincrement: false;
|
|
22
|
+
hasRuntimeDefault: false;
|
|
23
|
+
enumValues: [string, ...string[]];
|
|
24
|
+
baseColumn: never;
|
|
25
|
+
identity: undefined;
|
|
26
|
+
generated: undefined;
|
|
27
|
+
}, {}, {}>;
|
|
28
|
+
seq: import("drizzle-orm/pg-core").PgColumn<{
|
|
29
|
+
name: "seq";
|
|
30
|
+
tableName: "junior_agent_steps";
|
|
31
|
+
dataType: "number";
|
|
32
|
+
columnType: "PgInteger";
|
|
33
|
+
data: number;
|
|
34
|
+
driverParam: string | number;
|
|
35
|
+
notNull: true;
|
|
36
|
+
hasDefault: false;
|
|
37
|
+
isPrimaryKey: false;
|
|
38
|
+
isAutoincrement: false;
|
|
39
|
+
hasRuntimeDefault: false;
|
|
40
|
+
enumValues: undefined;
|
|
41
|
+
baseColumn: never;
|
|
42
|
+
identity: undefined;
|
|
43
|
+
generated: undefined;
|
|
44
|
+
}, {}, {}>;
|
|
45
|
+
contextEpoch: import("drizzle-orm/pg-core").PgColumn<{
|
|
46
|
+
name: "context_epoch";
|
|
47
|
+
tableName: "junior_agent_steps";
|
|
48
|
+
dataType: "number";
|
|
49
|
+
columnType: "PgInteger";
|
|
50
|
+
data: number;
|
|
51
|
+
driverParam: string | number;
|
|
52
|
+
notNull: true;
|
|
53
|
+
hasDefault: false;
|
|
54
|
+
isPrimaryKey: false;
|
|
55
|
+
isAutoincrement: false;
|
|
56
|
+
hasRuntimeDefault: false;
|
|
57
|
+
enumValues: undefined;
|
|
58
|
+
baseColumn: never;
|
|
59
|
+
identity: undefined;
|
|
60
|
+
generated: undefined;
|
|
61
|
+
}, {}, {}>;
|
|
62
|
+
type: import("drizzle-orm/pg-core").PgColumn<{
|
|
63
|
+
name: "type";
|
|
64
|
+
tableName: "junior_agent_steps";
|
|
65
|
+
dataType: "string";
|
|
66
|
+
columnType: "PgText";
|
|
67
|
+
data: string;
|
|
68
|
+
driverParam: string;
|
|
69
|
+
notNull: true;
|
|
70
|
+
hasDefault: false;
|
|
71
|
+
isPrimaryKey: false;
|
|
72
|
+
isAutoincrement: false;
|
|
73
|
+
hasRuntimeDefault: false;
|
|
74
|
+
enumValues: [string, ...string[]];
|
|
75
|
+
baseColumn: never;
|
|
76
|
+
identity: undefined;
|
|
77
|
+
generated: undefined;
|
|
78
|
+
}, {}, {}>;
|
|
79
|
+
role: import("drizzle-orm/pg-core").PgColumn<{
|
|
80
|
+
name: "role";
|
|
81
|
+
tableName: "junior_agent_steps";
|
|
82
|
+
dataType: "string";
|
|
83
|
+
columnType: "PgText";
|
|
84
|
+
data: string;
|
|
85
|
+
driverParam: string;
|
|
86
|
+
notNull: false;
|
|
87
|
+
hasDefault: false;
|
|
88
|
+
isPrimaryKey: false;
|
|
89
|
+
isAutoincrement: false;
|
|
90
|
+
hasRuntimeDefault: false;
|
|
91
|
+
enumValues: [string, ...string[]];
|
|
92
|
+
baseColumn: never;
|
|
93
|
+
identity: undefined;
|
|
94
|
+
generated: undefined;
|
|
95
|
+
}, {}, {}>;
|
|
96
|
+
payload: import("drizzle-orm/pg-core").PgColumn<{
|
|
97
|
+
name: "payload";
|
|
98
|
+
tableName: "junior_agent_steps";
|
|
99
|
+
dataType: "json";
|
|
100
|
+
columnType: "PgJsonb";
|
|
101
|
+
data: Record<string, unknown>;
|
|
102
|
+
driverParam: unknown;
|
|
103
|
+
notNull: true;
|
|
104
|
+
hasDefault: false;
|
|
105
|
+
isPrimaryKey: false;
|
|
106
|
+
isAutoincrement: false;
|
|
107
|
+
hasRuntimeDefault: false;
|
|
108
|
+
enumValues: undefined;
|
|
109
|
+
baseColumn: never;
|
|
110
|
+
identity: undefined;
|
|
111
|
+
generated: undefined;
|
|
112
|
+
}, {}, {
|
|
113
|
+
$type: Record<string, unknown>;
|
|
114
|
+
}>;
|
|
115
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
116
|
+
name: string;
|
|
117
|
+
tableName: "junior_agent_steps";
|
|
118
|
+
dataType: "date";
|
|
119
|
+
columnType: "PgTimestamp";
|
|
120
|
+
data: Date;
|
|
121
|
+
driverParam: string;
|
|
122
|
+
notNull: true;
|
|
123
|
+
hasDefault: false;
|
|
124
|
+
isPrimaryKey: false;
|
|
125
|
+
isAutoincrement: false;
|
|
126
|
+
hasRuntimeDefault: false;
|
|
127
|
+
enumValues: undefined;
|
|
128
|
+
baseColumn: never;
|
|
129
|
+
identity: undefined;
|
|
130
|
+
generated: undefined;
|
|
131
|
+
}, {}, {}>;
|
|
132
|
+
};
|
|
133
|
+
dialect: "pg";
|
|
134
|
+
}>;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import type { ConversationMessageRole } from "@/chat/conversations/messages";
|
|
2
|
+
/**
|
|
3
|
+
* Visible conversation transcript: one immutable row per source message keyed by
|
|
4
|
+
* `(conversation_id, message_id)`. `role`/`text`/`author_identity_id`/`created_at`
|
|
5
|
+
* never change after insert; `replied_at` is the only mutable delivery mark.
|
|
6
|
+
*/
|
|
7
|
+
export declare const juniorConversationMessages: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
8
|
+
name: "junior_conversation_messages";
|
|
9
|
+
schema: undefined;
|
|
10
|
+
columns: {
|
|
11
|
+
conversationId: import("drizzle-orm/pg-core").PgColumn<{
|
|
12
|
+
name: "conversation_id";
|
|
13
|
+
tableName: "junior_conversation_messages";
|
|
14
|
+
dataType: "string";
|
|
15
|
+
columnType: "PgText";
|
|
16
|
+
data: string;
|
|
17
|
+
driverParam: string;
|
|
18
|
+
notNull: true;
|
|
19
|
+
hasDefault: false;
|
|
20
|
+
isPrimaryKey: false;
|
|
21
|
+
isAutoincrement: false;
|
|
22
|
+
hasRuntimeDefault: false;
|
|
23
|
+
enumValues: [string, ...string[]];
|
|
24
|
+
baseColumn: never;
|
|
25
|
+
identity: undefined;
|
|
26
|
+
generated: undefined;
|
|
27
|
+
}, {}, {}>;
|
|
28
|
+
messageId: import("drizzle-orm/pg-core").PgColumn<{
|
|
29
|
+
name: "message_id";
|
|
30
|
+
tableName: "junior_conversation_messages";
|
|
31
|
+
dataType: "string";
|
|
32
|
+
columnType: "PgText";
|
|
33
|
+
data: string;
|
|
34
|
+
driverParam: string;
|
|
35
|
+
notNull: true;
|
|
36
|
+
hasDefault: false;
|
|
37
|
+
isPrimaryKey: false;
|
|
38
|
+
isAutoincrement: false;
|
|
39
|
+
hasRuntimeDefault: false;
|
|
40
|
+
enumValues: [string, ...string[]];
|
|
41
|
+
baseColumn: never;
|
|
42
|
+
identity: undefined;
|
|
43
|
+
generated: undefined;
|
|
44
|
+
}, {}, {}>;
|
|
45
|
+
role: import("drizzle-orm/pg-core").PgColumn<{
|
|
46
|
+
name: "role";
|
|
47
|
+
tableName: "junior_conversation_messages";
|
|
48
|
+
dataType: "string";
|
|
49
|
+
columnType: "PgText";
|
|
50
|
+
data: ConversationMessageRole;
|
|
51
|
+
driverParam: string;
|
|
52
|
+
notNull: true;
|
|
53
|
+
hasDefault: false;
|
|
54
|
+
isPrimaryKey: false;
|
|
55
|
+
isAutoincrement: false;
|
|
56
|
+
hasRuntimeDefault: false;
|
|
57
|
+
enumValues: [string, ...string[]];
|
|
58
|
+
baseColumn: never;
|
|
59
|
+
identity: undefined;
|
|
60
|
+
generated: undefined;
|
|
61
|
+
}, {}, {
|
|
62
|
+
$type: ConversationMessageRole;
|
|
63
|
+
}>;
|
|
64
|
+
authorIdentityId: import("drizzle-orm/pg-core").PgColumn<{
|
|
65
|
+
name: "author_identity_id";
|
|
66
|
+
tableName: "junior_conversation_messages";
|
|
67
|
+
dataType: "string";
|
|
68
|
+
columnType: "PgText";
|
|
69
|
+
data: string;
|
|
70
|
+
driverParam: string;
|
|
71
|
+
notNull: false;
|
|
72
|
+
hasDefault: false;
|
|
73
|
+
isPrimaryKey: false;
|
|
74
|
+
isAutoincrement: false;
|
|
75
|
+
hasRuntimeDefault: false;
|
|
76
|
+
enumValues: [string, ...string[]];
|
|
77
|
+
baseColumn: never;
|
|
78
|
+
identity: undefined;
|
|
79
|
+
generated: undefined;
|
|
80
|
+
}, {}, {}>;
|
|
81
|
+
text: import("drizzle-orm/pg-core").PgColumn<{
|
|
82
|
+
name: "text";
|
|
83
|
+
tableName: "junior_conversation_messages";
|
|
84
|
+
dataType: "string";
|
|
85
|
+
columnType: "PgText";
|
|
86
|
+
data: string;
|
|
87
|
+
driverParam: string;
|
|
88
|
+
notNull: true;
|
|
89
|
+
hasDefault: false;
|
|
90
|
+
isPrimaryKey: false;
|
|
91
|
+
isAutoincrement: false;
|
|
92
|
+
hasRuntimeDefault: false;
|
|
93
|
+
enumValues: [string, ...string[]];
|
|
94
|
+
baseColumn: never;
|
|
95
|
+
identity: undefined;
|
|
96
|
+
generated: undefined;
|
|
97
|
+
}, {}, {}>;
|
|
98
|
+
meta: import("drizzle-orm/pg-core").PgColumn<{
|
|
99
|
+
name: "meta";
|
|
100
|
+
tableName: "junior_conversation_messages";
|
|
101
|
+
dataType: "json";
|
|
102
|
+
columnType: "PgJsonb";
|
|
103
|
+
data: Record<string, unknown>;
|
|
104
|
+
driverParam: unknown;
|
|
105
|
+
notNull: false;
|
|
106
|
+
hasDefault: false;
|
|
107
|
+
isPrimaryKey: false;
|
|
108
|
+
isAutoincrement: false;
|
|
109
|
+
hasRuntimeDefault: false;
|
|
110
|
+
enumValues: undefined;
|
|
111
|
+
baseColumn: never;
|
|
112
|
+
identity: undefined;
|
|
113
|
+
generated: undefined;
|
|
114
|
+
}, {}, {
|
|
115
|
+
$type: Record<string, unknown>;
|
|
116
|
+
}>;
|
|
117
|
+
repliedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
118
|
+
name: string;
|
|
119
|
+
tableName: "junior_conversation_messages";
|
|
120
|
+
dataType: "date";
|
|
121
|
+
columnType: "PgTimestamp";
|
|
122
|
+
data: Date;
|
|
123
|
+
driverParam: string;
|
|
124
|
+
notNull: false;
|
|
125
|
+
hasDefault: false;
|
|
126
|
+
isPrimaryKey: false;
|
|
127
|
+
isAutoincrement: false;
|
|
128
|
+
hasRuntimeDefault: false;
|
|
129
|
+
enumValues: undefined;
|
|
130
|
+
baseColumn: never;
|
|
131
|
+
identity: undefined;
|
|
132
|
+
generated: undefined;
|
|
133
|
+
}, {}, {}>;
|
|
134
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
135
|
+
name: string;
|
|
136
|
+
tableName: "junior_conversation_messages";
|
|
137
|
+
dataType: "date";
|
|
138
|
+
columnType: "PgTimestamp";
|
|
139
|
+
data: Date;
|
|
140
|
+
driverParam: string;
|
|
141
|
+
notNull: true;
|
|
142
|
+
hasDefault: false;
|
|
143
|
+
isPrimaryKey: false;
|
|
144
|
+
isAutoincrement: false;
|
|
145
|
+
hasRuntimeDefault: false;
|
|
146
|
+
enumValues: undefined;
|
|
147
|
+
baseColumn: never;
|
|
148
|
+
identity: undefined;
|
|
149
|
+
generated: undefined;
|
|
150
|
+
}, {}, {}>;
|
|
151
|
+
};
|
|
152
|
+
dialect: "pg";
|
|
153
|
+
}>;
|
|
@@ -413,6 +413,40 @@ export declare const juniorConversations: import("drizzle-orm/pg-core").PgTableW
|
|
|
413
413
|
identity: undefined;
|
|
414
414
|
generated: undefined;
|
|
415
415
|
}, {}, {}>;
|
|
416
|
+
parentConversationId: import("drizzle-orm/pg-core").PgColumn<{
|
|
417
|
+
name: "parent_conversation_id";
|
|
418
|
+
tableName: "junior_conversations";
|
|
419
|
+
dataType: "string";
|
|
420
|
+
columnType: "PgText";
|
|
421
|
+
data: string;
|
|
422
|
+
driverParam: string;
|
|
423
|
+
notNull: false;
|
|
424
|
+
hasDefault: false;
|
|
425
|
+
isPrimaryKey: false;
|
|
426
|
+
isAutoincrement: false;
|
|
427
|
+
hasRuntimeDefault: false;
|
|
428
|
+
enumValues: [string, ...string[]];
|
|
429
|
+
baseColumn: never;
|
|
430
|
+
identity: undefined;
|
|
431
|
+
generated: undefined;
|
|
432
|
+
}, {}, {}>;
|
|
433
|
+
transcriptPurgedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
434
|
+
name: string;
|
|
435
|
+
tableName: "junior_conversations";
|
|
436
|
+
dataType: "date";
|
|
437
|
+
columnType: "PgTimestamp";
|
|
438
|
+
data: Date;
|
|
439
|
+
driverParam: string;
|
|
440
|
+
notNull: false;
|
|
441
|
+
hasDefault: false;
|
|
442
|
+
isPrimaryKey: false;
|
|
443
|
+
isAutoincrement: false;
|
|
444
|
+
hasRuntimeDefault: false;
|
|
445
|
+
enumValues: undefined;
|
|
446
|
+
baseColumn: never;
|
|
447
|
+
identity: undefined;
|
|
448
|
+
generated: undefined;
|
|
449
|
+
}, {}, {}>;
|
|
416
450
|
};
|
|
417
451
|
dialect: "pg";
|
|
418
452
|
}>;
|