@sentry/junior 0.160.0 → 0.162.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 (78) hide show
  1. package/dist/{agent-hooks-U6R3O2V4.js → agent-hooks-TL2SGC5W.js} +13 -10
  2. package/dist/api/locations/detail.d.ts +17 -0
  3. package/dist/api/people/plugin-reports.d.ts +7 -0
  4. package/dist/api/schema/conversation.d.ts +80 -8
  5. package/dist/api/schema/location.d.ts +30 -0
  6. package/dist/api/schema/person.d.ts +30 -0
  7. package/dist/api/schema.js +1 -1
  8. package/dist/api.js +128 -27
  9. package/dist/app.js +73 -42
  10. package/dist/{catalog-runtime-HIDNHGOP.js → catalog-runtime-IGSMIADJ.js} +5 -5
  11. package/dist/chat/artifacts/store.d.ts +42 -0
  12. package/dist/chat/conversations/message-search.d.ts +6 -0
  13. package/dist/chat/plugins/agent-hooks.d.ts +9 -1
  14. package/dist/chat/plugins/annotations.d.ts +3 -0
  15. package/dist/chat/plugins/conversation-sidebar.d.ts +3 -0
  16. package/dist/chat/plugins/viewer.d.ts +4 -0
  17. package/dist/chat/slack/mrkdwn.d.ts +3 -4
  18. package/dist/chat/slack/tools/conversation-message-search.d.ts +9 -0
  19. package/dist/chat/tools/publish-image.d.ts +44 -0
  20. package/dist/chat/tools/unpublish-image.d.ts +35 -0
  21. package/dist/{chunk-RJGRXDA7.js → chunk-4WYGQ47U.js} +5 -5
  22. package/dist/{chunk-FKMWPA4A.js → chunk-5NEBOHRG.js} +4 -4
  23. package/dist/{chunk-BGVQGEKB.js → chunk-6BJFIWEV.js} +4 -4
  24. package/dist/{chunk-TBRJGMTO.js → chunk-7DTPFFQX.js} +1 -1
  25. package/dist/{chunk-WACYTIIK.js → chunk-AJ7J2HWY.js} +6 -6
  26. package/dist/{chunk-YPMDNE7R.js → chunk-BPZQWAZJ.js} +1 -1
  27. package/dist/{chunk-TPFOVXRB.js → chunk-C3KUKA27.js} +19 -21
  28. package/dist/{chunk-4UO3UAW7.js → chunk-CZ6EHOU5.js} +239 -199
  29. package/dist/{chunk-JQZIUESN.js → chunk-DDQ43S5Q.js} +49 -4
  30. package/dist/{chunk-UNDTW2PY.js → chunk-DZC3F2UI.js} +1 -1
  31. package/dist/{chunk-42E7432W.js → chunk-EBEHJPFF.js} +1 -1
  32. package/dist/{chunk-M5HCOMDR.js → chunk-EHQLTK3X.js} +450 -115
  33. package/dist/{chunk-2SFMRMDV.js → chunk-FESUWAYU.js} +1 -1
  34. package/dist/{chunk-XPX3DYG7.js → chunk-FEWT5KPP.js} +2 -2
  35. package/dist/{chunk-2MK6S2UA.js → chunk-H2KW7AZC.js} +1 -1
  36. package/dist/{chunk-FJR66CQT.js → chunk-HW4BW3PC.js} +4 -4
  37. package/dist/{chunk-PZUJPPON.js → chunk-JJ3VXFDI.js} +1 -1
  38. package/dist/{chunk-MBDWMEO6.js → chunk-JRVURR3H.js} +10 -10
  39. package/dist/{chunk-756F567I.js → chunk-K7IV6UV3.js} +5 -5
  40. package/dist/{chunk-URPLKXLG.js → chunk-KQSO4DJ4.js} +9 -9
  41. package/dist/{chunk-LNUZXEEI.js → chunk-MMBMDSRK.js} +1 -1
  42. package/dist/{chunk-J77DLAPE.js → chunk-MNCEGXEH.js} +2 -2
  43. package/dist/{chunk-P7W3ZL5J.js → chunk-O6P7DZ6O.js} +8 -36
  44. package/dist/{chunk-PVIM2RWO.js → chunk-OBFRMQBY.js} +8 -10
  45. package/dist/{chunk-3AHIB66R.js → chunk-OPNJRQDP.js} +5 -5
  46. package/dist/{chunk-U26KRMYX.js → chunk-QHCIZLIX.js} +537 -27
  47. package/dist/{chunk-472VVYYV.js → chunk-RDV4BQRZ.js} +1 -1
  48. package/dist/{chunk-UYUS4L6F.js → chunk-SA6BEEAB.js} +16 -9
  49. package/dist/{chunk-HDPH4CHJ.js → chunk-THXMSSFZ.js} +1 -1
  50. package/dist/{chunk-RLOXMHLA.js → chunk-V7QL4QMW.js} +4 -4
  51. package/dist/{chunk-56TFPTZU.js → chunk-WHAJ3QVY.js} +1 -1
  52. package/dist/{chunk-ZNBGWMVQ.js → chunk-Y75ZDQB5.js} +1 -1
  53. package/dist/cli/chat.js +29 -30
  54. package/dist/cli/check.js +6 -6
  55. package/dist/cli/plugins.js +12 -13
  56. package/dist/cli/snapshot-create.js +9 -9
  57. package/dist/cli/upgrade.js +7 -7
  58. package/dist/db/schema/artifacts.d.ts +178 -0
  59. package/dist/db/schema.d.ts +179 -1
  60. package/dist/{db-2JKT3BB5.js → db-66XZ4HHQ.js} +7 -7
  61. package/dist/handlers/artifacts.d.ts +8 -0
  62. package/dist/instrumentation.js +4 -4
  63. package/dist/nitro.js +2 -2
  64. package/dist/{oauth-callback-server-7MC2UMQC.js → oauth-callback-server-FMLKDUUF.js} +22 -23
  65. package/dist/{runner-GUU4G7XO.js → runner-YZONUMNY.js} +12 -13
  66. package/dist/{skills-7NW5N3VM.js → skills-3UDJJXSO.js} +6 -6
  67. package/dist/spawn-TBPVA5S2.js +37 -0
  68. package/dist/{validation-AQLI6N2C.js → validation-3HTDBONC.js} +6 -6
  69. package/dist/version.js +1 -1
  70. package/dist/{work-FLFK5XNU.js → work-O4YTIS54.js} +17 -17
  71. package/dist/worker-WHURUEYX.js +24 -0
  72. package/migrations/0028_artifacts.sql +16 -0
  73. package/migrations/meta/0028_snapshot.json +2685 -0
  74. package/migrations/meta/_journal.json +8 -1
  75. package/package.json +4 -4
  76. package/dist/chunk-OUAZDZTZ.js +0 -441
  77. package/dist/spawn-WGK4W3XF.js +0 -37
  78. package/dist/worker-KSJIRBQJ.js +0 -24
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_SQL_STATEMENT_TIMEOUT_MS
3
- } from "./chunk-J77DLAPE.js";
3
+ } from "./chunk-MNCEGXEH.js";
4
4
  import {
5
5
  juniorDestinations,
6
6
  timestamptz
@@ -14,186 +14,224 @@ import {
14
14
  import { drizzle } from "drizzle-orm/neon-serverless";
15
15
  import { migrate } from "drizzle-orm/neon-serverless/migrator";
16
16
 
17
+ // src/db/schema/artifacts.ts
18
+ import {
19
+ boolean,
20
+ index,
21
+ integer,
22
+ pgTable,
23
+ text,
24
+ uniqueIndex
25
+ } from "drizzle-orm/pg-core";
26
+ var juniorArtifacts = pgTable(
27
+ "junior_artifacts",
28
+ {
29
+ /** Public identity used in `/public/artifacts/<id>.<ext>`. */
30
+ id: text("id").primaryKey(),
31
+ conversationId: text("conversation_id").notNull(),
32
+ sha256: text("sha256").notNull(),
33
+ ext: text("ext").notNull(),
34
+ storageKey: text("storage_key").notNull(),
35
+ contentType: text("content_type").notNull(),
36
+ bytes: integer("bytes").notNull(),
37
+ public: boolean("public").notNull(),
38
+ createdAt: timestamptz("created_at").notNull(),
39
+ /** Set when the artifact should stop being served publicly. */
40
+ deleteRequestedAt: timestamptz("delete_requested_at")
41
+ },
42
+ (table) => [
43
+ uniqueIndex("junior_artifacts_conversation_sha_uidx").on(
44
+ table.conversationId,
45
+ table.sha256
46
+ ),
47
+ index("junior_artifacts_gc_idx").on(
48
+ table.deleteRequestedAt,
49
+ table.createdAt
50
+ ),
51
+ index("junior_artifacts_conversation_idx").on(table.conversationId)
52
+ ]
53
+ );
54
+
17
55
  // src/db/schema/attachments.ts
18
- import { index as index3, integer as integer2, pgTable as pgTable4, text as text4 } from "drizzle-orm/pg-core";
56
+ import { index as index4, integer as integer3, pgTable as pgTable5, text as text5 } from "drizzle-orm/pg-core";
19
57
 
20
58
  // src/db/schema/conversations.ts
21
59
  import { sql as sql2 } from "drizzle-orm";
22
60
  import {
23
- index as index2,
24
- integer,
61
+ index as index3,
62
+ integer as integer2,
25
63
  jsonb as jsonb2,
26
- pgTable as pgTable3,
27
- text as text3
64
+ pgTable as pgTable4,
65
+ text as text4
28
66
  } from "drizzle-orm/pg-core";
29
67
 
30
68
  // src/db/schema/identities.ts
31
69
  import { sql } from "drizzle-orm";
32
70
  import {
33
- boolean,
34
- index,
71
+ boolean as boolean2,
72
+ index as index2,
35
73
  jsonb,
36
- pgTable as pgTable2,
37
- text as text2,
38
- uniqueIndex as uniqueIndex2
74
+ pgTable as pgTable3,
75
+ text as text3,
76
+ uniqueIndex as uniqueIndex3
39
77
  } from "drizzle-orm/pg-core";
40
78
 
41
79
  // src/db/schema/users.ts
42
- import { text, pgTable, uniqueIndex } from "drizzle-orm/pg-core";
43
- var juniorUsers = pgTable(
80
+ import { text as text2, pgTable as pgTable2, uniqueIndex as uniqueIndex2 } from "drizzle-orm/pg-core";
81
+ var juniorUsers = pgTable2(
44
82
  "junior_users",
45
83
  {
46
- id: text("id").primaryKey(),
47
- primaryEmail: text("primary_email").notNull(),
48
- primaryEmailNormalized: text("primary_email_normalized").notNull(),
49
- displayName: text("display_name"),
84
+ id: text2("id").primaryKey(),
85
+ primaryEmail: text2("primary_email").notNull(),
86
+ primaryEmailNormalized: text2("primary_email_normalized").notNull(),
87
+ displayName: text2("display_name"),
50
88
  createdAt: timestamptz("created_at").notNull(),
51
89
  updatedAt: timestamptz("updated_at").notNull()
52
90
  },
53
91
  (table) => [
54
- uniqueIndex("junior_users_primary_email_normalized_uidx").on(
92
+ uniqueIndex2("junior_users_primary_email_normalized_uidx").on(
55
93
  table.primaryEmailNormalized
56
94
  )
57
95
  ]
58
96
  );
59
97
 
60
98
  // src/db/schema/identities.ts
61
- var juniorIdentities = pgTable2(
99
+ var juniorIdentities = pgTable3(
62
100
  "junior_identities",
63
101
  {
64
- id: text2("id").primaryKey(),
65
- kind: text2("kind").$type().notNull(),
66
- provider: text2("provider").notNull(),
67
- providerTenantId: text2("provider_tenant_id").notNull().default(""),
68
- providerSubjectId: text2("provider_subject_id").notNull(),
69
- displayName: text2("display_name"),
70
- handle: text2("handle"),
71
- email: text2("email"),
72
- avatarUrl: text2("avatar_url"),
102
+ id: text3("id").primaryKey(),
103
+ kind: text3("kind").$type().notNull(),
104
+ provider: text3("provider").notNull(),
105
+ providerTenantId: text3("provider_tenant_id").notNull().default(""),
106
+ providerSubjectId: text3("provider_subject_id").notNull(),
107
+ displayName: text3("display_name"),
108
+ handle: text3("handle"),
109
+ email: text3("email"),
110
+ avatarUrl: text3("avatar_url"),
73
111
  metadata: jsonb("metadata_json"),
74
112
  createdAt: timestamptz("created_at").notNull(),
75
113
  updatedAt: timestamptz("updated_at").notNull(),
76
- userId: text2("user_id").references(() => juniorUsers.id),
77
- emailNormalized: text2("email_normalized"),
78
- emailVerified: boolean("email_verified").notNull().default(false)
114
+ userId: text3("user_id").references(() => juniorUsers.id),
115
+ emailNormalized: text3("email_normalized"),
116
+ emailVerified: boolean2("email_verified").notNull().default(false)
79
117
  },
80
118
  (table) => [
81
- uniqueIndex2("junior_identities_provider_subject_uidx").on(
119
+ uniqueIndex3("junior_identities_provider_subject_uidx").on(
82
120
  table.provider,
83
121
  table.providerTenantId,
84
122
  table.providerSubjectId
85
123
  ),
86
- index("junior_identities_user_idx").on(table.userId),
87
- index("junior_identities_verified_email_idx").on(table.emailNormalized).where(
124
+ index2("junior_identities_user_idx").on(table.userId),
125
+ index2("junior_identities_verified_email_idx").on(table.emailNormalized).where(
88
126
  sql`${table.emailVerified} = true AND ${table.emailNormalized} IS NOT NULL`
89
127
  ),
90
- index("junior_identities_kind_provider_idx").on(table.kind, table.provider)
128
+ index2("junior_identities_kind_provider_idx").on(table.kind, table.provider)
91
129
  ]
92
130
  );
93
131
 
94
132
  // src/db/schema/conversations.ts
95
- var juniorConversations = pgTable3(
133
+ var juniorConversations = pgTable4(
96
134
  "junior_conversations",
97
135
  {
98
- conversationId: text3("conversation_id").primaryKey(),
99
- schemaVersion: integer("schema_version").notNull().default(1),
100
- source: text3("source").$type(),
136
+ conversationId: text4("conversation_id").primaryKey(),
137
+ schemaVersion: integer2("schema_version").notNull().default(1),
138
+ source: text4("source").$type(),
101
139
  /** Structured session Source locator; set-once on the conversation root. */
102
140
  sessionSource: jsonb2("source_json").$type(),
103
- originType: text3("origin_type"),
104
- originId: text3("origin_id"),
105
- originRunId: text3("origin_run_id"),
106
- destinationId: text3("destination_id").references(
141
+ originType: text4("origin_type"),
142
+ originId: text4("origin_id"),
143
+ originRunId: text4("origin_run_id"),
144
+ destinationId: text4("destination_id").references(
107
145
  () => juniorDestinations.id
108
146
  ),
109
147
  destination: jsonb2("destination_json").$type(),
110
- actorIdentityId: text3("actor_identity_id").references(
148
+ actorIdentityId: text4("actor_identity_id").references(
111
149
  () => juniorIdentities.id
112
150
  ),
113
- creatorIdentityId: text3("creator_identity_id").references(
151
+ creatorIdentityId: text4("creator_identity_id").references(
114
152
  () => juniorIdentities.id
115
153
  ),
116
- credentialSubjectIdentityId: text3(
154
+ credentialSubjectIdentityId: text4(
117
155
  "credential_subject_identity_id"
118
156
  ).references(() => juniorIdentities.id),
119
157
  actor: jsonb2("actor_json").$type(),
120
- channelName: text3("channel_name"),
121
- title: text3("title"),
158
+ channelName: text4("channel_name"),
159
+ title: text4("title"),
122
160
  createdAt: timestamptz("created_at").notNull(),
123
161
  lastActivityAt: timestamptz("last_activity_at").notNull(),
124
162
  updatedAt: timestamptz("updated_at").notNull(),
125
163
  executionUpdatedAt: timestamptz("execution_updated_at"),
126
- executionStatus: text3("execution_status").$type().notNull(),
127
- runId: text3("run_id"),
164
+ executionStatus: text4("execution_status").$type().notNull(),
165
+ runId: text4("run_id"),
128
166
  lastCheckpointAt: timestamptz("last_checkpoint_at"),
129
167
  lastEnqueuedAt: timestamptz("last_enqueued_at"),
130
168
  // Subagent runs are child conversations; top-level listings filter
131
169
  // parent_conversation_id IS NULL. Historical advisor children use this too.
132
- parentConversationId: text3("parent_conversation_id").references(
170
+ parentConversationId: text4("parent_conversation_id").references(
133
171
  () => juniorConversations.conversationId
134
172
  ),
135
173
  // Roots reference themselves; descendants reference the root whose actor
136
174
  // and destination own their privacy boundary.
137
- rootConversationId: text3("root_conversation_id").references(
175
+ rootConversationId: text4("root_conversation_id").references(
138
176
  () => juniorConversations.conversationId
139
177
  ),
140
178
  transcriptPurgedAt: timestamptz("transcript_purged_at"),
141
- durationMs: integer("duration_ms").notNull().default(0),
179
+ durationMs: integer2("duration_ms").notNull().default(0),
142
180
  usage: jsonb2("usage_json").$type(),
143
- executionDurationMs: integer("execution_duration_ms").notNull().default(0),
181
+ executionDurationMs: integer2("execution_duration_ms").notNull().default(0),
144
182
  executionUsage: jsonb2("execution_usage_json").$type(),
145
- metricRunId: text3("metric_run_id"),
183
+ metricRunId: text4("metric_run_id"),
146
184
  archivedAt: timestamptz("archived_at")
147
185
  },
148
186
  (table) => [
149
- index2("junior_conversations_last_activity_idx").on(
187
+ index3("junior_conversations_last_activity_idx").on(
150
188
  table.lastActivityAt.desc(),
151
189
  table.conversationId
152
190
  ),
153
- index2("junior_conversations_active_idx").using(
191
+ index3("junior_conversations_active_idx").using(
154
192
  "btree",
155
193
  sql2`coalesce(${table.executionUpdatedAt}, ${table.updatedAt})`,
156
194
  table.conversationId
157
195
  ).where(sql2`${table.executionStatus} <> 'idle'`),
158
- index2("junior_conversations_destination_activity_idx").on(
196
+ index3("junior_conversations_destination_activity_idx").on(
159
197
  table.destinationId,
160
198
  table.lastActivityAt.desc()
161
199
  ),
162
- index2("junior_conversations_actor_activity_idx").on(
200
+ index3("junior_conversations_actor_activity_idx").on(
163
201
  table.actorIdentityId,
164
202
  table.lastActivityAt.desc()
165
203
  ),
166
- index2("junior_conversations_origin_idx").on(
204
+ index3("junior_conversations_origin_idx").on(
167
205
  table.originType,
168
206
  table.originId,
169
207
  table.lastActivityAt.desc()
170
208
  ),
171
- index2("junior_conversations_parent_idx").on(table.parentConversationId),
172
- index2("junior_conversations_root_idx").on(table.rootConversationId)
209
+ index3("junior_conversations_parent_idx").on(table.parentConversationId),
210
+ index3("junior_conversations_root_idx").on(table.rootConversationId)
173
211
  ]
174
212
  );
175
213
 
176
214
  // src/db/schema/attachments.ts
177
- var juniorAttachments = pgTable4(
215
+ var juniorAttachments = pgTable5(
178
216
  "junior_attachments",
179
217
  {
180
- id: text4("id").primaryKey(),
181
- conversationId: text4("conversation_id").notNull().references(() => juniorConversations.conversationId, {
218
+ id: text5("id").primaryKey(),
219
+ conversationId: text5("conversation_id").notNull().references(() => juniorConversations.conversationId, {
182
220
  onDelete: "cascade"
183
221
  }),
184
- provider: text4("provider").notNull(),
185
- storageKey: text4("storage_key").notNull(),
186
- filename: text4("filename").notNull(),
187
- contentType: text4("content_type").notNull(),
188
- bytes: integer2("bytes").notNull(),
189
- sha256: text4("sha256").notNull(),
222
+ provider: text5("provider").notNull(),
223
+ storageKey: text5("storage_key").notNull(),
224
+ filename: text5("filename").notNull(),
225
+ contentType: text5("content_type").notNull(),
226
+ bytes: integer3("bytes").notNull(),
227
+ sha256: text5("sha256").notNull(),
190
228
  createdAt: timestamptz("created_at").notNull(),
191
229
  /** Set when conversation purge marks the attachment unavailable. */
192
230
  deleteRequestedAt: timestamptz("delete_requested_at")
193
231
  },
194
232
  (table) => [
195
- index3("junior_attachments_conversation_idx").on(table.conversationId),
196
- index3("junior_attachments_gc_idx").on(
233
+ index4("junior_attachments_conversation_idx").on(table.conversationId),
234
+ index4("junior_attachments_gc_idx").on(
197
235
  table.provider,
198
236
  table.deleteRequestedAt,
199
237
  table.createdAt
@@ -205,17 +243,17 @@ var juniorAttachments = pgTable4(
205
243
  import {
206
244
  foreignKey,
207
245
  jsonb as jsonb3,
208
- pgTable as pgTable5,
246
+ pgTable as pgTable6,
209
247
  primaryKey,
210
- text as text5
248
+ text as text6
211
249
  } from "drizzle-orm/pg-core";
212
- var juniorConversationAnnotations = pgTable5(
250
+ var juniorConversationAnnotations = pgTable6(
213
251
  "junior_conversation_annotations",
214
252
  {
215
- conversationId: text5("conversation_id").notNull(),
216
- plugin: text5("plugin").notNull(),
217
- kind: text5("kind").notNull(),
218
- key: text5("key").notNull(),
253
+ conversationId: text6("conversation_id").notNull(),
254
+ plugin: text6("plugin").notNull(),
255
+ kind: text6("kind").notNull(),
256
+ key: text6("key").notNull(),
219
257
  annotation: jsonb3("annotation_json").$type().notNull(),
220
258
  createdAt: timestamptz("created_at").notNull(),
221
259
  updatedAt: timestamptz("updated_at").notNull()
@@ -234,49 +272,49 @@ var juniorConversationAnnotations = pgTable5(
234
272
  );
235
273
 
236
274
  // src/db/schema/api-tokens.ts
237
- import { index as index4, pgTable as pgTable6, text as text6, uniqueIndex as uniqueIndex3 } from "drizzle-orm/pg-core";
238
- var juniorApiTokens = pgTable6(
275
+ import { index as index5, pgTable as pgTable7, text as text7, uniqueIndex as uniqueIndex4 } from "drizzle-orm/pg-core";
276
+ var juniorApiTokens = pgTable7(
239
277
  "junior_api_tokens",
240
278
  {
241
- id: text6("id").primaryKey(),
242
- ownerEmailNormalized: text6("owner_email_normalized").notNull(),
243
- name: text6("name").notNull(),
244
- tokenHash: text6("token_hash").notNull(),
245
- tokenSuffix: text6("token_suffix").notNull(),
279
+ id: text7("id").primaryKey(),
280
+ ownerEmailNormalized: text7("owner_email_normalized").notNull(),
281
+ name: text7("name").notNull(),
282
+ tokenHash: text7("token_hash").notNull(),
283
+ tokenSuffix: text7("token_suffix").notNull(),
246
284
  createdAt: timestamptz("created_at").notNull(),
247
285
  expiresAt: timestamptz("expires_at").notNull(),
248
286
  lastUsedAt: timestamptz("last_used_at"),
249
287
  revokedAt: timestamptz("revoked_at")
250
288
  },
251
289
  (table) => [
252
- uniqueIndex3("junior_api_tokens_token_hash_uidx").on(table.tokenHash),
253
- index4("junior_api_tokens_owner_email_idx").on(table.ownerEmailNormalized)
290
+ uniqueIndex4("junior_api_tokens_token_hash_uidx").on(table.tokenHash),
291
+ index5("junior_api_tokens_owner_email_idx").on(table.ownerEmailNormalized)
254
292
  ]
255
293
  );
256
294
 
257
295
  // src/db/schema/conversation-events.ts
258
296
  import {
259
297
  foreignKey as foreignKey2,
260
- index as index5,
261
- integer as integer3,
298
+ index as index6,
299
+ integer as integer4,
262
300
  jsonb as jsonb4,
263
- pgTable as pgTable7,
301
+ pgTable as pgTable8,
264
302
  primaryKey as primaryKey2,
265
- text as text7,
266
- uniqueIndex as uniqueIndex4
303
+ text as text8,
304
+ uniqueIndex as uniqueIndex5
267
305
  } from "drizzle-orm/pg-core";
268
306
  import { sql as sql3 } from "drizzle-orm";
269
- var juniorConversationEvents = pgTable7(
307
+ var juniorConversationEvents = pgTable8(
270
308
  "junior_conversation_events",
271
309
  {
272
- conversationId: text7("conversation_id").notNull(),
273
- seq: integer3("seq").notNull(),
274
- historyVersion: integer3("history_version").notNull(),
275
- schemaVersion: integer3("schema_version").default(1).notNull(),
276
- idempotencyKey: text7("idempotency_key"),
277
- type: text7("type").notNull(),
310
+ conversationId: text8("conversation_id").notNull(),
311
+ seq: integer4("seq").notNull(),
312
+ historyVersion: integer4("history_version").notNull(),
313
+ schemaVersion: integer4("schema_version").default(1).notNull(),
314
+ idempotencyKey: text8("idempotency_key"),
315
+ type: text8("type").notNull(),
278
316
  payload: jsonb4("payload").$type().notNull(),
279
- actorIdentityId: text7("actor_identity_id").references(
317
+ actorIdentityId: text8("actor_identity_id").references(
280
318
  () => juniorIdentities.id
281
319
  ),
282
320
  createdAt: timestamptz("created_at").notNull()
@@ -291,23 +329,23 @@ var juniorConversationEvents = pgTable7(
291
329
  columns: [table.conversationId],
292
330
  foreignColumns: [juniorConversations.conversationId]
293
331
  }),
294
- index5("junior_conversation_events_history_version_idx").on(
332
+ index6("junior_conversation_events_history_version_idx").on(
295
333
  table.conversationId,
296
334
  table.historyVersion,
297
335
  table.seq
298
336
  ),
299
- index5("junior_conversation_events_type_idx").on(
337
+ index6("junior_conversation_events_type_idx").on(
300
338
  table.conversationId,
301
339
  table.type,
302
340
  table.seq
303
341
  ),
304
- index5("junior_conversation_events_actor_identity_idx").on(
342
+ index6("junior_conversation_events_actor_identity_idx").on(
305
343
  table.actorIdentityId,
306
344
  table.conversationId,
307
345
  table.seq
308
346
  ),
309
- index5("junior_conversation_events_message_search_idx").using("gin", sql3`to_tsvector('english', ${table.payload}->>'text')`).where(sql3`${table.type} = 'message'`),
310
- uniqueIndex4("junior_conversation_events_idempotency_idx").on(
347
+ index6("junior_conversation_events_message_search_idx").using("gin", sql3`to_tsvector('english', ${table.payload}->>'text')`).where(sql3`${table.type} = 'message'`),
348
+ uniqueIndex5("junior_conversation_events_idempotency_idx").on(
311
349
  table.conversationId,
312
350
  table.idempotencyKey
313
351
  )
@@ -315,15 +353,15 @@ var juniorConversationEvents = pgTable7(
315
353
  );
316
354
 
317
355
  // src/db/schema/conversation-bindings.ts
318
- import { index as index6, pgTable as pgTable8, primaryKey as primaryKey3, text as text8 } from "drizzle-orm/pg-core";
319
- var juniorConversationBindings = pgTable8(
356
+ import { index as index7, pgTable as pgTable9, primaryKey as primaryKey3, text as text9 } from "drizzle-orm/pg-core";
357
+ var juniorConversationBindings = pgTable9(
320
358
  "junior_conversation_bindings",
321
359
  {
322
- conversationId: text8("conversation_id").notNull().references(() => juniorConversations.conversationId),
323
- provider: text8("provider").notNull(),
324
- providerTenantId: text8("provider_tenant_id").notNull().default(""),
325
- providerDestinationId: text8("provider_destination_id").notNull(),
326
- providerConversationId: text8("provider_conversation_id").notNull(),
360
+ conversationId: text9("conversation_id").notNull().references(() => juniorConversations.conversationId),
361
+ provider: text9("provider").notNull(),
362
+ providerTenantId: text9("provider_tenant_id").notNull().default(""),
363
+ providerDestinationId: text9("provider_destination_id").notNull(),
364
+ providerConversationId: text9("provider_conversation_id").notNull(),
327
365
  createdAt: timestamptz("created_at").notNull()
328
366
  },
329
367
  (table) => [
@@ -336,19 +374,19 @@ var juniorConversationBindings = pgTable8(
336
374
  table.providerConversationId
337
375
  ]
338
376
  }),
339
- index6("junior_conversation_bindings_conversation_idx").on(
377
+ index7("junior_conversation_bindings_conversation_idx").on(
340
378
  table.conversationId
341
379
  )
342
380
  ]
343
381
  );
344
382
 
345
383
  // src/db/schema/conversation-participants.ts
346
- import { index as index7, pgTable as pgTable9, primaryKey as primaryKey4, text as text9 } from "drizzle-orm/pg-core";
347
- var juniorConversationParticipants = pgTable9(
384
+ import { index as index8, pgTable as pgTable10, primaryKey as primaryKey4, text as text10 } from "drizzle-orm/pg-core";
385
+ var juniorConversationParticipants = pgTable10(
348
386
  "junior_conversation_participants",
349
387
  {
350
- userId: text9("user_id").notNull().references(() => juniorUsers.id),
351
- rootConversationId: text9("root_conversation_id").notNull().references(() => juniorConversations.conversationId),
388
+ userId: text10("user_id").notNull().references(() => juniorUsers.id),
389
+ rootConversationId: text10("root_conversation_id").notNull().references(() => juniorConversations.conversationId),
352
390
  lastMessageAt: timestamptz("last_message_at").notNull()
353
391
  },
354
392
  (table) => [
@@ -356,11 +394,11 @@ var juniorConversationParticipants = pgTable9(
356
394
  name: "junior_conversation_participants_user_root_pk",
357
395
  columns: [table.userId, table.rootConversationId]
358
396
  }),
359
- index7("junior_conversation_participants_user_activity_idx").on(
397
+ index8("junior_conversation_participants_user_activity_idx").on(
360
398
  table.userId,
361
399
  table.lastMessageAt.desc()
362
400
  ),
363
- index7("junior_conversation_participants_root_idx").on(
401
+ index8("junior_conversation_participants_root_idx").on(
364
402
  table.rootConversationId
365
403
  )
366
404
  ]
@@ -368,62 +406,62 @@ var juniorConversationParticipants = pgTable9(
368
406
 
369
407
  // src/db/schema/agent-invocations.ts
370
408
  import {
371
- index as index8,
409
+ index as index9,
372
410
  jsonb as jsonb5,
373
- pgTable as pgTable10,
411
+ pgTable as pgTable11,
374
412
  primaryKey as primaryKey5,
375
- text as text10,
376
- uniqueIndex as uniqueIndex5
413
+ text as text11,
414
+ uniqueIndex as uniqueIndex6
377
415
  } from "drizzle-orm/pg-core";
378
416
  var AGENT_INVOCATION_MAILBOX_STATUSES = [
379
417
  "pending",
380
418
  "appended"
381
419
  ];
382
- var juniorAgentBindings = pgTable10(
420
+ var juniorAgentBindings = pgTable11(
383
421
  "junior_agent_bindings",
384
422
  {
385
- parentConversationId: text10("parent_conversation_id").notNull().references(() => juniorConversations.conversationId),
386
- name: text10("name").notNull(),
387
- childConversationId: text10("child_conversation_id").notNull().references(() => juniorConversations.conversationId)
423
+ parentConversationId: text11("parent_conversation_id").notNull().references(() => juniorConversations.conversationId),
424
+ name: text11("name").notNull(),
425
+ childConversationId: text11("child_conversation_id").notNull().references(() => juniorConversations.conversationId)
388
426
  },
389
427
  (table) => [
390
428
  primaryKey5({
391
429
  columns: [table.parentConversationId, table.name]
392
430
  }),
393
- uniqueIndex5("junior_agent_bindings_child_idx").on(
431
+ uniqueIndex6("junior_agent_bindings_child_idx").on(
394
432
  table.childConversationId
395
433
  )
396
434
  ]
397
435
  );
398
- var juniorAgentInvocations = pgTable10(
436
+ var juniorAgentInvocations = pgTable11(
399
437
  "junior_agent_invocations",
400
438
  {
401
- invocationId: text10("invocation_id").primaryKey(),
402
- parentConversationId: text10("parent_conversation_id").notNull().references(() => juniorConversations.conversationId),
403
- childConversationId: text10("child_conversation_id").notNull().references(() => juniorConversations.conversationId),
404
- agentName: text10("agent_name"),
405
- input: text10("input").notNull(),
439
+ invocationId: text11("invocation_id").primaryKey(),
440
+ parentConversationId: text11("parent_conversation_id").notNull().references(() => juniorConversations.conversationId),
441
+ childConversationId: text11("child_conversation_id").notNull().references(() => juniorConversations.conversationId),
442
+ agentName: text11("agent_name"),
443
+ input: text11("input").notNull(),
406
444
  actor: jsonb5("actor_json").$type().notNull(),
407
445
  credentialContext: jsonb5(
408
446
  "credential_context_json"
409
447
  ).$type(),
410
448
  source: jsonb5("source_json").$type().notNull(),
411
449
  destination: jsonb5("destination_json").$type().notNull(),
412
- destinationVisibility: text10(
450
+ destinationVisibility: text11(
413
451
  "destination_visibility"
414
452
  ).$type(),
415
- reasoningLevel: text10("reasoning_level").$type(),
416
- status: text10("status").$type().notNull(),
417
- mailboxStatus: text10("mailbox_status").$type().notNull(),
418
- result: text10("result"),
419
- errorMessage: text10("error_message"),
453
+ reasoningLevel: text11("reasoning_level").$type(),
454
+ status: text11("status").$type().notNull(),
455
+ mailboxStatus: text11("mailbox_status").$type().notNull(),
456
+ result: text11("result"),
457
+ errorMessage: text11("error_message"),
420
458
  createdAt: timestamptz("created_at").notNull(),
421
459
  updatedAt: timestamptz("updated_at").notNull(),
422
460
  terminalAt: timestamptz("terminal_at")
423
461
  },
424
462
  (table) => [
425
- index8("junior_agent_invocations_child_idx").on(table.childConversationId),
426
- index8("junior_agent_invocations_mailbox_idx").on(
463
+ index9("junior_agent_invocations_child_idx").on(table.childConversationId),
464
+ index9("junior_agent_invocations_mailbox_idx").on(
427
465
  table.mailboxStatus,
428
466
  table.createdAt
429
467
  )
@@ -431,42 +469,42 @@ var juniorAgentInvocations = pgTable10(
431
469
  );
432
470
 
433
471
  // src/db/schema/location-configurations.ts
434
- import { pgTable as pgTable11, primaryKey as primaryKey6, text as text11 } from "drizzle-orm/pg-core";
435
- var juniorLocationConfigurations = pgTable11(
472
+ import { pgTable as pgTable12, primaryKey as primaryKey6, text as text12 } from "drizzle-orm/pg-core";
473
+ var juniorLocationConfigurations = pgTable12(
436
474
  "junior_location_configurations",
437
475
  {
438
- locationId: text11("location_id").notNull().references(() => juniorDestinations.id, { onDelete: "cascade" }),
439
- key: text11("key").notNull(),
440
- value: text11("value").notNull(),
476
+ locationId: text12("location_id").notNull().references(() => juniorDestinations.id, { onDelete: "cascade" }),
477
+ key: text12("key").notNull(),
478
+ value: text12("value").notNull(),
441
479
  updatedAt: timestamptz("updated_at").notNull(),
442
- updatedBy: text11("updated_by"),
443
- source: text11("source"),
444
- expiresAt: text11("expires_at")
480
+ updatedBy: text12("updated_by"),
481
+ source: text12("source"),
482
+ expiresAt: text12("expires_at")
445
483
  },
446
484
  (table) => [primaryKey6({ columns: [table.locationId, table.key] })]
447
485
  );
448
486
 
449
487
  // src/db/schema/event-tasks.ts
450
- import { bigint, index as index9, jsonb as jsonb6, pgTable as pgTable12, text as text12 } from "drizzle-orm/pg-core";
451
- var juniorEventTasks = pgTable12(
488
+ import { bigint, index as index10, jsonb as jsonb6, pgTable as pgTable13, text as text13 } from "drizzle-orm/pg-core";
489
+ var juniorEventTasks = pgTable13(
452
490
  "junior_event_tasks",
453
491
  {
454
- id: text12("id").primaryKey(),
455
- teamId: text12("team_id").notNull(),
456
- namespace: text12("namespace").notNull(),
457
- identifier: text12("identifier").notNull(),
492
+ id: text13("id").primaryKey(),
493
+ teamId: text13("team_id").notNull(),
494
+ namespace: text13("namespace").notNull(),
495
+ identifier: text13("identifier").notNull(),
458
496
  createdAtMs: bigint("created_at_ms", { mode: "number" }).notNull(),
459
497
  /** Short display title generated from the task instruction. */
460
- title: text12("title"),
498
+ title: text13("title"),
461
499
  task: jsonb6("task_json").$type().notNull()
462
500
  },
463
501
  (table) => [
464
- index9("junior_event_tasks_team_idx").on(
502
+ index10("junior_event_tasks_team_idx").on(
465
503
  table.teamId,
466
504
  table.createdAtMs,
467
505
  table.id
468
506
  ),
469
- index9("junior_event_tasks_match_idx").on(
507
+ index10("junior_event_tasks_match_idx").on(
470
508
  table.namespace,
471
509
  table.identifier,
472
510
  table.createdAtMs,
@@ -476,15 +514,15 @@ var juniorEventTasks = pgTable12(
476
514
  );
477
515
 
478
516
  // src/db/schema/stats.ts
479
- import { date, integer as integer4, pgTable as pgTable13, primaryKey as primaryKey7, text as text13 } from "drizzle-orm/pg-core";
480
- var juniorStats = pgTable13(
517
+ import { date, integer as integer5, pgTable as pgTable14, primaryKey as primaryKey7, text as text14 } from "drizzle-orm/pg-core";
518
+ var juniorStats = pgTable14(
481
519
  "junior_stats",
482
520
  {
483
521
  date: date("date", { mode: "string" }).notNull(),
484
- namespace: text13("namespace").notNull(),
485
- metric: text13("metric").notNull(),
486
- name: text13("name").notNull(),
487
- count: integer4("count").notNull().default(0)
522
+ namespace: text14("namespace").notNull(),
523
+ metric: text14("metric").notNull(),
524
+ name: text14("name").notNull(),
525
+ count: integer5("count").notNull().default(0)
488
526
  },
489
527
  (table) => [
490
528
  primaryKey7({
@@ -500,21 +538,21 @@ import {
500
538
  bigint as bigint2,
501
539
  check,
502
540
  foreignKey as foreignKey3,
503
- index as index10,
504
- pgTable as pgTable14,
541
+ index as index11,
542
+ pgTable as pgTable15,
505
543
  primaryKey as primaryKey8,
506
- text as text14
544
+ text as text15
507
545
  } from "drizzle-orm/pg-core";
508
- var juniorTaskExecutions = pgTable14(
546
+ var juniorTaskExecutions = pgTable15(
509
547
  "junior_task_executions",
510
548
  {
511
- executionId: text14("execution_id").notNull(),
512
- kind: text14("kind").notNull(),
513
- namespace: text14("namespace").notNull(),
514
- taskId: text14("task_id").notNull(),
515
- conversationId: text14("conversation_id"),
549
+ executionId: text15("execution_id").notNull(),
550
+ kind: text15("kind").notNull(),
551
+ namespace: text15("namespace").notNull(),
552
+ taskId: text15("task_id").notNull(),
553
+ conversationId: text15("conversation_id"),
516
554
  executedAtMs: bigint2("executed_at_ms", { mode: "number" }).notNull(),
517
- status: text14("status").$type().notNull()
555
+ status: text15("status").$type().notNull()
518
556
  },
519
557
  (table) => [
520
558
  check(
@@ -534,17 +572,17 @@ var juniorTaskExecutions = pgTable14(
534
572
  columns: [table.conversationId],
535
573
  foreignColumns: [juniorConversations.conversationId]
536
574
  }),
537
- index10("junior_task_executions_task_time_idx").on(
575
+ index11("junior_task_executions_task_time_idx").on(
538
576
  table.kind,
539
577
  table.namespace,
540
578
  table.taskId,
541
579
  table.executedAtMs
542
580
  ),
543
- index10("junior_task_executions_time_kind_idx").on(
581
+ index11("junior_task_executions_time_kind_idx").on(
544
582
  table.executedAtMs,
545
583
  table.kind
546
584
  ),
547
- index10("junior_task_executions_conversation_time_idx").on(
585
+ index11("junior_task_executions_conversation_time_idx").on(
548
586
  table.conversationId,
549
587
  table.executedAtMs
550
588
  )
@@ -553,54 +591,54 @@ var juniorTaskExecutions = pgTable14(
553
591
 
554
592
  // src/db/schema/scheduled-tasks.ts
555
593
  import { sql as sql5 } from "drizzle-orm";
556
- import { bigint as bigint3, index as index11, jsonb as jsonb7, pgTable as pgTable15, text as text15 } from "drizzle-orm/pg-core";
557
- var juniorSchedulerTasks = pgTable15(
594
+ import { bigint as bigint3, index as index12, jsonb as jsonb7, pgTable as pgTable16, text as text16 } from "drizzle-orm/pg-core";
595
+ var juniorSchedulerTasks = pgTable16(
558
596
  "junior_scheduler_tasks",
559
597
  {
560
- id: text15("id").primaryKey(),
561
- teamId: text15("team_id").notNull(),
598
+ id: text16("id").primaryKey(),
599
+ teamId: text16("team_id").notNull(),
562
600
  // TODO(v0.128.0): Remove after v0.127.x runtimes no longer write this column.
563
- creatorSlackUserId: text15("creator_slack_user_id"),
564
- creatorIdentityId: text15("creator_identity_id"),
565
- status: text15("status").notNull(),
601
+ creatorSlackUserId: text16("creator_slack_user_id"),
602
+ creatorIdentityId: text16("creator_identity_id"),
603
+ status: text16("status").notNull(),
566
604
  nextRunAtMs: bigint3("next_run_at_ms", { mode: "number" }),
567
605
  runNowAtMs: bigint3("run_now_at_ms", { mode: "number" }),
568
606
  createdAtMs: bigint3("created_at_ms", { mode: "number" }).notNull(),
569
607
  /** Short display title generated from the task instruction. */
570
- title: text15("title"),
608
+ title: text16("title"),
571
609
  record: jsonb7("record").$type().notNull()
572
610
  },
573
611
  (table) => [
574
612
  // TODO(v0.128.0): Remove with creatorSlackUserId.
575
- index11("junior_scheduler_tasks_creator_idx").on(table.teamId, table.creatorSlackUserId, table.createdAtMs, table.id).where(sql5`${table.status} <> 'deleted'`),
576
- index11("junior_scheduler_tasks_creator_identity_idx").on(table.creatorIdentityId, table.createdAtMs, table.id).where(
613
+ index12("junior_scheduler_tasks_creator_idx").on(table.teamId, table.creatorSlackUserId, table.createdAtMs, table.id).where(sql5`${table.status} <> 'deleted'`),
614
+ index12("junior_scheduler_tasks_creator_identity_idx").on(table.creatorIdentityId, table.createdAtMs, table.id).where(
577
615
  sql5`${table.status} <> 'deleted' AND ${table.creatorIdentityId} IS NOT NULL`
578
616
  ),
579
- index11("junior_scheduler_tasks_team_status_idx").on(table.teamId, table.createdAtMs, table.id).where(sql5`${table.status} <> 'deleted'`),
580
- index11("junior_scheduler_tasks_run_now_due_idx").on(table.runNowAtMs, table.createdAtMs, table.id).where(
617
+ index12("junior_scheduler_tasks_team_status_idx").on(table.teamId, table.createdAtMs, table.id).where(sql5`${table.status} <> 'deleted'`),
618
+ index12("junior_scheduler_tasks_run_now_due_idx").on(table.runNowAtMs, table.createdAtMs, table.id).where(
581
619
  sql5`${table.status} = 'active' AND ${table.runNowAtMs} IS NOT NULL`
582
620
  ),
583
- index11("junior_scheduler_tasks_next_run_due_idx").on(table.nextRunAtMs, table.createdAtMs, table.id).where(
621
+ index12("junior_scheduler_tasks_next_run_due_idx").on(table.nextRunAtMs, table.createdAtMs, table.id).where(
584
622
  sql5`${table.status} = 'active' AND ${table.nextRunAtMs} IS NOT NULL`
585
623
  )
586
624
  ]
587
625
  );
588
- var juniorSchedulerRuns = pgTable15(
626
+ var juniorSchedulerRuns = pgTable16(
589
627
  "junior_scheduler_runs",
590
628
  {
591
- id: text15("id").primaryKey(),
592
- taskId: text15("task_id").notNull(),
593
- status: text15("status").notNull(),
629
+ id: text16("id").primaryKey(),
630
+ taskId: text16("task_id").notNull(),
631
+ status: text16("status").notNull(),
594
632
  scheduledForMs: bigint3("scheduled_for_ms", { mode: "number" }).notNull(),
595
633
  record: jsonb7("record").$type().notNull()
596
634
  },
597
635
  (table) => [
598
- index11("junior_scheduler_runs_task_status_idx").on(
636
+ index12("junior_scheduler_runs_task_status_idx").on(
599
637
  table.taskId,
600
638
  table.status,
601
639
  table.scheduledForMs
602
640
  ),
603
- index11("junior_scheduler_runs_status_idx").on(
641
+ index12("junior_scheduler_runs_status_idx").on(
604
642
  table.status,
605
643
  table.scheduledForMs
606
644
  )
@@ -609,6 +647,7 @@ var juniorSchedulerRuns = pgTable15(
609
647
 
610
648
  // src/db/schema.ts
611
649
  var juniorSqlSchema = {
650
+ juniorArtifacts,
612
651
  juniorAttachments,
613
652
  juniorConversationAnnotations,
614
653
  juniorApiTokens,
@@ -879,6 +918,7 @@ function createJuniorSqlExecutor(args) {
879
918
  }
880
919
 
881
920
  export {
921
+ juniorArtifacts,
882
922
  juniorUsers,
883
923
  juniorIdentities,
884
924
  juniorConversations,