@sentry/junior 0.94.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.
Files changed (119) hide show
  1. package/dist/{agent-hooks-ZG7IDOIN.js → agent-hooks-FTQ5EGPO.js} +9 -10
  2. package/dist/api/people/list.js +7 -7
  3. package/dist/api/people/profile.js +7 -7
  4. package/dist/api/people/shared.d.ts +2 -2
  5. package/dist/api-reference.d.ts +1 -1
  6. package/dist/app.js +427 -196
  7. package/dist/{catalog-runtime-NZHMSMYC.js → catalog-runtime-2D7IVKUT.js} +3 -3
  8. package/dist/chat/advisor-request.d.ts +4 -0
  9. package/dist/chat/agent/request.d.ts +2 -0
  10. package/dist/chat/agent/resume.d.ts +2 -0
  11. package/dist/chat/conversations/history.d.ts +128 -0
  12. package/dist/chat/conversations/legacy-import.d.ts +38 -0
  13. package/dist/chat/conversations/messages.d.ts +39 -0
  14. package/dist/chat/conversations/projection.d.ts +94 -0
  15. package/dist/chat/conversations/retention.d.ts +36 -0
  16. package/dist/chat/conversations/sql/conversation-row.d.ts +14 -0
  17. package/dist/chat/conversations/sql/history.d.ts +4 -0
  18. package/dist/chat/conversations/sql/legacy-history-import.d.ts +55 -0
  19. package/dist/chat/conversations/sql/messages.d.ts +4 -0
  20. package/dist/chat/conversations/sql/migrations.d.ts +14 -3
  21. package/dist/chat/conversations/sql/purge.d.ts +53 -0
  22. package/dist/chat/conversations/sql/store.d.ts +7 -2
  23. package/dist/chat/conversations/store.d.ts +19 -0
  24. package/dist/chat/conversations/visible-compactions.d.ts +11 -0
  25. package/dist/chat/conversations/visible-messages.d.ts +47 -0
  26. package/dist/chat/db.d.ts +12 -1
  27. package/dist/chat/identities/sql.d.ts +1 -1
  28. package/dist/chat/logging.d.ts +2 -1
  29. package/dist/chat/resource-events/store.d.ts +2 -1
  30. package/dist/chat/runtime/reply-executor.d.ts +8 -0
  31. package/dist/chat/runtime/thread-state.d.ts +2 -0
  32. package/dist/chat/sandbox/resources.d.ts +4 -0
  33. package/dist/chat/services/mcp-auth-orchestration.d.ts +8 -0
  34. package/dist/chat/services/plugin-auth-orchestration.d.ts +12 -0
  35. package/dist/chat/services/turn-session-record.d.ts +14 -2
  36. package/dist/chat/sleep.d.ts +2 -0
  37. package/dist/chat/state/conversation.d.ts +7 -4
  38. package/dist/chat/state/session-log.d.ts +23 -1
  39. package/dist/chat/state/turn-session.d.ts +6 -0
  40. package/dist/chat/tool-support/private-trace-result.d.ts +4 -0
  41. package/dist/chat/tool-support/zod-tool.d.ts +1 -0
  42. package/dist/chat/tools/advisor/tool.d.ts +9 -4
  43. package/dist/chat/tools/definition.d.ts +2 -0
  44. package/dist/chat/tools/execution/tool-error-handler.d.ts +2 -2
  45. package/dist/chat/tools/system-time.d.ts +8 -0
  46. package/dist/chat/xml.d.ts +2 -0
  47. package/dist/{chunk-NYWPISSO.js → chunk-2XXEKR44.js} +1 -1
  48. package/dist/{chunk-QGEWC27H.js → chunk-5XMNOD3S.js} +5 -7
  49. package/dist/{chunk-NFXSLTYG.js → chunk-6ONME5IG.js} +864 -62
  50. package/dist/{chunk-LFLTJQVR.js → chunk-7FBGKXPE.js} +4 -0
  51. package/dist/{chunk-MC4ZZE4Q.js → chunk-AYP4ERVZ.js} +1 -1
  52. package/dist/{chunk-GHGPTPBL.js → chunk-B7PUBQQM.js} +1 -1
  53. package/dist/chunk-CM5EZD5F.js +17 -0
  54. package/dist/chunk-CRRBJ3JP.js +1037 -0
  55. package/dist/{chunk-G3E7SCME.js → chunk-CZEX6KIQ.js} +23 -0
  56. package/dist/{chunk-TNUUATT7.js → chunk-E3E2XNCN.js} +2 -2
  57. package/dist/{chunk-LNCREA5Z.js → chunk-EKNJM5IG.js} +3 -127
  58. package/dist/{chunk-NAPITCZ6.js → chunk-GUE7HTNR.js} +251 -6
  59. package/dist/{chunk-BTH37NCU.js → chunk-GVOUCI2O.js} +1 -1
  60. package/dist/{chunk-YYBX2BD5.js → chunk-GY34VGP5.js} +1 -1
  61. package/dist/{chunk-KRMANDHI.js → chunk-HCXXB35T.js} +1481 -349
  62. package/dist/{chunk-YTNPU7I2.js → chunk-HDTO3A74.js} +2 -2
  63. package/dist/{chunk-YJ4OPVNA.js → chunk-HZNJLKKI.js} +1 -1
  64. package/dist/{chunk-HDNWZMUN.js → chunk-KDPCGVIT.js} +116 -51
  65. package/dist/chunk-N4RNJ32C.js +48 -0
  66. package/dist/{chunk-UUB3D2XI.js → chunk-NSCHU54X.js} +8 -10
  67. package/dist/{chunk-PFXC67GJ.js → chunk-RAIB6WSG.js} +6 -80
  68. package/dist/chunk-WAGQ377B.js +724 -0
  69. package/dist/{chunk-6H4PP63X.js → chunk-WCMQJE4F.js} +24 -14
  70. package/dist/{chunk-S6QKIGRM.js → chunk-WPOJ443W.js} +15 -25
  71. package/dist/{chunk-MAVOJ54A.js → chunk-XX4N4E6C.js} +25 -388
  72. package/dist/cli/chat.js +24 -23
  73. package/dist/cli/check.js +4 -4
  74. package/dist/cli/plugins.js +11 -12
  75. package/dist/cli/snapshot-warmup.js +7 -8
  76. package/dist/cli/upgrade.js +78 -17
  77. package/dist/db/schema/agent-steps.d.ts +134 -0
  78. package/dist/db/schema/conversation-messages.d.ts +153 -0
  79. package/dist/{chat/conversations/sql → db}/schema/conversations.d.ts +34 -0
  80. package/dist/{chat/conversations/sql → db}/schema.d.ts +319 -8
  81. package/dist/db-W55B74OP.js +24 -0
  82. package/dist/deployment.d.ts +2 -0
  83. package/dist/handlers/retention.d.ts +6 -0
  84. package/dist/instrumentation.js +16 -3
  85. package/dist/legacy-import-ZPLGLAFD.js +17 -0
  86. package/dist/nitro.js +14 -4
  87. package/dist/reporting/conversations/activity.d.ts +40 -0
  88. package/dist/reporting/conversations/context.d.ts +8 -0
  89. package/dist/reporting/conversations/details.d.ts +6 -0
  90. package/dist/reporting/conversations/index.d.ts +4 -0
  91. package/dist/reporting/conversations/shared.d.ts +9 -0
  92. package/dist/reporting/conversations/statistics.d.ts +4 -0
  93. package/dist/reporting/conversations/summaries.d.ts +17 -0
  94. package/dist/reporting/conversations/transcript.d.ts +28 -0
  95. package/dist/reporting/conversations/types.d.ts +178 -0
  96. package/dist/reporting/conversations.d.ts +1 -178
  97. package/dist/reporting.d.ts +4 -3
  98. package/dist/reporting.js +603 -827
  99. package/dist/{runner-XAZPJNAQ.js → runner-OOSBDYRK.js} +35 -41
  100. package/dist/{validation-KYAWETI4.js → validation-QCGRFRFZ.js} +4 -4
  101. package/migrations/README.md +32 -0
  102. package/migrations/meta/0000_snapshot.json +978 -0
  103. package/migrations/meta/_journal.json +13 -0
  104. package/package.json +10 -7
  105. package/dist/chat/sql/schema.d.ts +0 -1049
  106. package/dist/chat/state/conversation-details.d.ts +0 -47
  107. package/dist/chunk-7STN2ZSK.js +0 -250
  108. package/dist/chunk-LE5ANBUZ.js +0 -1040
  109. package/dist/chunk-QL66APYJ.js +0 -1377
  110. package/dist/db-YDN6AFJH.js +0 -18
  111. /package/dist/{chat/sql → db}/db.d.ts +0 -0
  112. /package/dist/{chat/sql → db}/executor.d.ts +0 -0
  113. /package/dist/{chat/sql → db}/neon.d.ts +0 -0
  114. /package/dist/{chat/sql → db}/postgres.d.ts +0 -0
  115. /package/dist/{chat/conversations/sql → db}/schema/destinations.d.ts +0 -0
  116. /package/dist/{chat/conversations/sql → db}/schema/identities.d.ts +0 -0
  117. /package/dist/{chat/conversations/sql → db}/schema/migrations.d.ts +0 -0
  118. /package/dist/{chat/conversations/sql → db}/schema/timestamps.d.ts +0 -0
  119. /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-KRMANDHI.js";
5
- import "../chunk-HDNWZMUN.js";
6
- import "../chunk-PFXC67GJ.js";
7
- import "../chunk-6H4PP63X.js";
8
- import "../chunk-LE5ANBUZ.js";
9
- import "../chunk-QL66APYJ.js";
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-UUB3D2XI.js";
14
- import "../chunk-TNUUATT7.js";
15
- import "../chunk-G3E7SCME.js";
16
- import "../chunk-7STN2ZSK.js";
17
- import "../chunk-NFXSLTYG.js";
18
- import "../chunk-NAPITCZ6.js";
19
- import "../chunk-YYBX2BD5.js";
20
- import "../chunk-GHGPTPBL.js";
21
- import "../chunk-YTNPU7I2.js";
22
- import "../chunk-BTH37NCU.js";
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-LFLTJQVR.js";
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-ZG7IDOIN.js"),
151
- import("../catalog-runtime-NZHMSMYC.js"),
152
- import("../validation-KYAWETI4.js"),
153
- import("../db-YDN6AFJH.js")
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-XAZPJNAQ.js");
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-YTNPU7I2.js";
3
+ } from "../chunk-HDTO3A74.js";
4
4
  import {
5
5
  parseInlinePluginManifest,
6
6
  parsePluginManifest
7
- } from "../chunk-BTH37NCU.js";
8
- import "../chunk-S6QKIGRM.js";
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-LFLTJQVR.js";
16
+ } from "../chunk-7FBGKXPE.js";
17
17
  import "../chunk-MLKGABMK.js";
18
18
 
19
19
  // src/cli/check.ts
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  validatePluginEgressCredentialHooks,
3
3
  validatePluginRegistrations
4
- } from "../chunk-MC4ZZE4Q.js";
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-UUB3D2XI.js";
16
+ } from "../chunk-NSCHU54X.js";
17
17
  import {
18
18
  createPluginLogger
19
- } from "../chunk-TNUUATT7.js";
20
- import "../chunk-G3E7SCME.js";
21
- import "../chunk-7STN2ZSK.js";
19
+ } from "../chunk-E3E2XNCN.js";
20
+ import "../chunk-CZEX6KIQ.js";
22
21
  import {
23
22
  getDb
24
- } from "../chunk-NFXSLTYG.js";
25
- import "../chunk-NAPITCZ6.js";
26
- import "../chunk-YYBX2BD5.js";
27
- import "../chunk-GHGPTPBL.js";
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-BTH37NCU.js";
31
- import "../chunk-S6QKIGRM.js";
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-LFLTJQVR.js";
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-6H4PP63X.js";
4
- import "../chunk-G3E7SCME.js";
3
+ } from "../chunk-WCMQJE4F.js";
4
+ import "../chunk-CZEX6KIQ.js";
5
5
  import {
6
6
  disconnectStateAdapter
7
- } from "../chunk-7STN2ZSK.js";
8
- import "../chunk-NAPITCZ6.js";
9
- import "../chunk-YYBX2BD5.js";
7
+ } from "../chunk-GUE7HTNR.js";
8
+ import "../chunk-GY34VGP5.js";
10
9
  import {
11
10
  pluginCatalogRuntime
12
- } from "../chunk-BTH37NCU.js";
13
- import "../chunk-S6QKIGRM.js";
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-LFLTJQVR.js";
16
+ import "../chunk-7FBGKXPE.js";
18
17
  import "../chunk-MLKGABMK.js";
19
18
 
20
19
  // src/cli/snapshot-warmup.ts
@@ -4,7 +4,7 @@ import {
4
4
  recordConversationActivity,
5
5
  recordConversationExecution,
6
6
  requestConversationWork
7
- } from "../chunk-QGEWC27H.js";
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-PFXC67GJ.js";
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-TNUUATT7.js";
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
- } from "../chunk-NFXSLTYG.js";
32
+ getDb,
33
+ migrateSchema
34
+ } from "../chunk-6ONME5IG.js";
34
35
  import {
35
- getChatConfig
36
- } from "../chunk-NAPITCZ6.js";
37
- import "../chunk-YYBX2BD5.js";
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-GHGPTPBL.js";
44
+ } from "../chunk-B7PUBQQM.js";
42
45
  import {
43
46
  pluginCatalogRuntime
44
- } from "../chunk-BTH37NCU.js";
45
- import "../chunk-S6QKIGRM.js";
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-LFLTJQVR.js";
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
  }>;