@sentry/junior 0.182.0 → 0.184.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 (98) hide show
  1. package/dist/{agent-hooks-3S25UIHO.js → agent-hooks-XTZVALGQ.js} +11 -11
  2. package/dist/api/acp/auth.d.ts +46 -0
  3. package/dist/api/acp/authorization-page.d.ts +11 -0
  4. package/dist/api/acp/conversations.d.ts +70 -0
  5. package/dist/api/acp/errors.d.ts +6 -0
  6. package/dist/api/acp/route.d.ts +16 -0
  7. package/dist/api/acp/schema.d.ts +97 -0
  8. package/dist/api/acp/sleep.d.ts +2 -0
  9. package/dist/api/acp/state.d.ts +22 -0
  10. package/dist/api/acp/transport.d.ts +113 -0
  11. package/dist/api/code/overview.d.ts +35 -0
  12. package/dist/api/code/routes.d.ts +4 -0
  13. package/dist/api/schema/code.d.ts +75 -0
  14. package/dist/api/schema.d.ts +2 -0
  15. package/dist/api/schema.js +9 -1
  16. package/dist/api.js +258 -134
  17. package/dist/app.d.ts +0 -4
  18. package/dist/app.js +2171 -220
  19. package/dist/{catalog-runtime-ESLMBQBV.js → catalog-runtime-5357XR4F.js} +4 -4
  20. package/dist/chat/agent-invocations/store.d.ts +4 -2
  21. package/dist/chat/agent-invocations/work.d.ts +1 -3
  22. package/dist/chat/app/factory.d.ts +3 -3
  23. package/dist/chat/app/services.d.ts +3 -3
  24. package/dist/chat/code/publisher.d.ts +3 -0
  25. package/dist/chat/code/store.d.ts +9 -0
  26. package/dist/chat/event-tasks/store.d.ts +10 -0
  27. package/dist/chat/ingress/slack-webhook.d.ts +1 -1
  28. package/dist/chat/plugins/agent-hooks.d.ts +5 -0
  29. package/dist/chat/{runtime/slack-runtime.d.ts → providers/slack/runtime.d.ts} +2 -2
  30. package/dist/chat/{runtime/reply-executor.d.ts → providers/slack/turn.d.ts} +10 -9
  31. package/dist/chat/resource-events/store.d.ts +12 -0
  32. package/dist/chat/runtime/turn-execution.d.ts +30 -0
  33. package/dist/chat/slack/dispatch-turn.d.ts +12 -14
  34. package/dist/chat/task-execution/slack-work.d.ts +1 -1
  35. package/dist/{chunk-SXOZIG5X.js → chunk-2ZQPVX7C.js} +6 -6
  36. package/dist/{chunk-UQP54CXZ.js → chunk-3S7ULUWW.js} +1 -1
  37. package/dist/{chunk-2CEOXDG2.js → chunk-4CNDGK25.js} +174 -6
  38. package/dist/{chunk-3THPTNN6.js → chunk-4RONS3WR.js} +4 -4
  39. package/dist/{chunk-LHQK5XCU.js → chunk-6UDPINOX.js} +2 -2
  40. package/dist/{chunk-BZD4ADQH.js → chunk-6VOYP4M6.js} +2 -3
  41. package/dist/{chunk-QHALFHZA.js → chunk-6WGC3SO4.js} +9 -9
  42. package/dist/{chunk-BDDWVY32.js → chunk-ACPDVEJO.js} +22 -20
  43. package/dist/{chunk-44BQ3TSK.js → chunk-BCHYQS4B.js} +233 -173
  44. package/dist/{chunk-SVFSYQMT.js → chunk-BHYRYYLY.js} +1 -1
  45. package/dist/{chunk-LT4QYGKM.js → chunk-BT53RIGJ.js} +160 -97
  46. package/dist/{chunk-Z7ALSQS3.js → chunk-DUKIDPF6.js} +1 -1
  47. package/dist/{chunk-PQES5LB5.js → chunk-E57WPXWY.js} +5 -5
  48. package/dist/{chunk-GGYA5NPN.js → chunk-FKEZZMXS.js} +8 -8
  49. package/dist/{chunk-LB4FWMCV.js → chunk-HIPUIPJM.js} +183 -155
  50. package/dist/{chunk-3NFHI2NA.js → chunk-HUXFMDBZ.js} +1 -1
  51. package/dist/{chunk-6TSWXBTQ.js → chunk-IZDYYYGP.js} +3 -3
  52. package/dist/{chunk-YHL2L2ZZ.js → chunk-JA43DV4Y.js} +1 -1
  53. package/dist/{chunk-V5UZCCNW.js → chunk-JM2COLGC.js} +6 -6
  54. package/dist/{chunk-A7THOQ6N.js → chunk-JNO2GUDS.js} +21 -21
  55. package/dist/{chunk-KGMHUDVF.js → chunk-K7VDC2QW.js} +6 -6
  56. package/dist/{chunk-CVBIM4Z3.js → chunk-LCP4EDKR.js} +1 -1
  57. package/dist/{chunk-4DZ62L36.js → chunk-LHXIZLFF.js} +1 -1
  58. package/dist/{chunk-D6OHGAIO.js → chunk-M5YWNMTE.js} +5 -5
  59. package/dist/{chunk-3ENUMZNG.js → chunk-MAPJFUMV.js} +3 -3
  60. package/dist/{chunk-UUMBHORH.js → chunk-MLSQX2EX.js} +1 -1
  61. package/dist/{chunk-WOIALVN2.js → chunk-PJPRXO2T.js} +1 -1
  62. package/dist/{chunk-VHMAFMHB.js → chunk-QABCY33S.js} +1 -1
  63. package/dist/{chunk-UKIHNBBD.js → chunk-SHJK75Z2.js} +3 -3
  64. package/dist/{chunk-S35OZMSL.js → chunk-UBOIHNTH.js} +13 -13
  65. package/dist/{chunk-DZR3L74W.js → chunk-UF6BUA5W.js} +3 -3
  66. package/dist/{chunk-JIOKUIAS.js → chunk-WQFEWULF.js} +2 -2
  67. package/dist/chunk-WVIA7V3M.js +975 -0
  68. package/dist/{chunk-MJISSOWB.js → chunk-YKX6MTLU.js} +1 -1
  69. package/dist/{chunk-TEFNHMO2.js → chunk-Z3QAXJR7.js} +4 -4
  70. package/dist/cli/chat.js +33 -35
  71. package/dist/cli/check.js +5 -5
  72. package/dist/cli/plugins.js +12 -12
  73. package/dist/cli/snapshot-create.js +9 -9
  74. package/dist/cli/upgrade.js +6 -6
  75. package/dist/db/schema/code.d.ts +367 -0
  76. package/dist/db/schema.d.ts +367 -1
  77. package/dist/{db-NYIWZ4L5.js → db-MA52H62H.js} +6 -6
  78. package/dist/instrumentation.js +3 -3
  79. package/dist/nitro.js +6 -6
  80. package/dist/{oauth-callback-server-A2YTPVVX.js → oauth-callback-server-DXGHKN6S.js} +25 -25
  81. package/dist/{runner-VKAEU52J.js → runner-4IXUAQNK.js} +18 -18
  82. package/dist/{skills-52GMXUTY.js → skills-X3DY7AXO.js} +5 -5
  83. package/dist/spawn-43WGS6CH.js +37 -0
  84. package/dist/task-runner-VDRKITPV.js +32 -0
  85. package/dist/{validation-VD2YQX2W.js → validation-Z6JXSTJS.js} +5 -5
  86. package/dist/version.js +1 -1
  87. package/dist/{work-ZWBTGEQP.js → work-OKWRFBDW.js} +18 -18
  88. package/dist/worker-B236AE72.js +22 -0
  89. package/migrations/0036_complex_rage.sql +32 -0
  90. package/migrations/meta/0036_snapshot.json +3186 -0
  91. package/migrations/meta/_journal.json +8 -1
  92. package/package.json +6 -7
  93. package/dist/app-adapter.d.ts +0 -85
  94. package/dist/chat/api-turns/adapter-conversations.d.ts +0 -15
  95. package/dist/chunk-CZYNWPWD.js +0 -930
  96. package/dist/spawn-GSS4EBLR.js +0 -37
  97. package/dist/task-runner-DUGDWF5O.js +0 -32
  98. package/dist/worker-XUWD5WS7.js +0 -22
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-VFUK3X5B.js";
5
5
  import {
6
6
  DEFAULT_SQL_STATEMENT_TIMEOUT_MS
7
- } from "./chunk-LHQK5XCU.js";
7
+ } from "./chunk-6UDPINOX.js";
8
8
 
9
9
  // src/db/neon.ts
10
10
  import { AsyncLocalStorage } from "async_hooks";
@@ -245,21 +245,77 @@ var juniorAttachments = pgTable5(
245
245
  ]
246
246
  );
247
247
 
248
+ // src/db/schema/code.ts
249
+ import { sql as sql3 } from "drizzle-orm";
250
+ import {
251
+ index as index5,
252
+ integer as integer4,
253
+ pgTable as pgTable6,
254
+ text as text6,
255
+ uniqueIndex as uniqueIndex4,
256
+ uuid
257
+ } from "drizzle-orm/pg-core";
258
+ var juniorCodeRepositories = pgTable6(
259
+ "junior_code_repositories",
260
+ {
261
+ id: uuid("id").primaryKey(),
262
+ name: text6("name").notNull(),
263
+ provider: text6("provider").notNull(),
264
+ providerId: text6("provider_id").notNull(),
265
+ url: text6("url"),
266
+ updatedAt: timestamptz("updated_at").notNull()
267
+ },
268
+ (table) => [
269
+ uniqueIndex4("junior_code_repositories_provider_id_idx").on(
270
+ table.provider,
271
+ table.providerId
272
+ )
273
+ ]
274
+ );
275
+ var juniorCodeChanges = pgTable6(
276
+ "junior_code_changes",
277
+ {
278
+ id: uuid("id").primaryKey(),
279
+ closedAt: timestamptz("closed_at"),
280
+ conversationIds: text6("conversation_ids").array().notNull().default(sql3`ARRAY[]::text[]`),
281
+ mergedAt: timestamptz("merged_at"),
282
+ number: integer4("number").notNull(),
283
+ openedAt: timestamptz("opened_at").notNull(),
284
+ provider: text6("provider").notNull(),
285
+ providerId: text6("provider_id").notNull(),
286
+ repositoryId: uuid("repository_id").notNull().references(() => juniorCodeRepositories.id, { onDelete: "cascade" }),
287
+ state: text6("state").$type().notNull(),
288
+ title: text6("title"),
289
+ updatedAt: timestamptz("updated_at").notNull(),
290
+ url: text6("url")
291
+ },
292
+ (table) => [
293
+ uniqueIndex4("junior_code_changes_provider_id_idx").on(
294
+ table.provider,
295
+ table.providerId
296
+ ),
297
+ index5("junior_code_changes_opened_at_idx").on(table.openedAt),
298
+ index5("junior_code_changes_merged_at_idx").on(table.mergedAt),
299
+ index5("junior_code_changes_closed_at_idx").on(table.closedAt),
300
+ index5("junior_code_changes_open_idx").on(table.id).where(sql3`${table.state} = 'open'`)
301
+ ]
302
+ );
303
+
248
304
  // src/db/schema/conversation-annotations.ts
249
305
  import {
250
306
  foreignKey,
251
307
  jsonb as jsonb3,
252
- pgTable as pgTable6,
308
+ pgTable as pgTable7,
253
309
  primaryKey,
254
- text as text6
310
+ text as text7
255
311
  } from "drizzle-orm/pg-core";
256
- var juniorConversationAnnotations = pgTable6(
312
+ var juniorConversationAnnotations = pgTable7(
257
313
  "junior_conversation_annotations",
258
314
  {
259
- conversationId: text6("conversation_id").notNull(),
260
- plugin: text6("plugin").notNull(),
261
- kind: text6("kind").notNull(),
262
- key: text6("key").notNull(),
315
+ conversationId: text7("conversation_id").notNull(),
316
+ plugin: text7("plugin").notNull(),
317
+ kind: text7("kind").notNull(),
318
+ key: text7("key").notNull(),
263
319
  annotation: jsonb3("annotation_json").$type().notNull(),
264
320
  createdAt: timestamptz("created_at").notNull(),
265
321
  updatedAt: timestamptz("updated_at").notNull()
@@ -278,49 +334,49 @@ var juniorConversationAnnotations = pgTable6(
278
334
  );
279
335
 
280
336
  // src/db/schema/api-tokens.ts
281
- import { index as index5, pgTable as pgTable7, text as text7, uniqueIndex as uniqueIndex4 } from "drizzle-orm/pg-core";
282
- var juniorApiTokens = pgTable7(
337
+ import { index as index6, pgTable as pgTable8, text as text8, uniqueIndex as uniqueIndex5 } from "drizzle-orm/pg-core";
338
+ var juniorApiTokens = pgTable8(
283
339
  "junior_api_tokens",
284
340
  {
285
- id: text7("id").primaryKey(),
286
- ownerEmailNormalized: text7("owner_email_normalized").notNull(),
287
- name: text7("name").notNull(),
288
- tokenHash: text7("token_hash").notNull(),
289
- tokenSuffix: text7("token_suffix").notNull(),
341
+ id: text8("id").primaryKey(),
342
+ ownerEmailNormalized: text8("owner_email_normalized").notNull(),
343
+ name: text8("name").notNull(),
344
+ tokenHash: text8("token_hash").notNull(),
345
+ tokenSuffix: text8("token_suffix").notNull(),
290
346
  createdAt: timestamptz("created_at").notNull(),
291
347
  expiresAt: timestamptz("expires_at").notNull(),
292
348
  lastUsedAt: timestamptz("last_used_at"),
293
349
  revokedAt: timestamptz("revoked_at")
294
350
  },
295
351
  (table) => [
296
- uniqueIndex4("junior_api_tokens_token_hash_uidx").on(table.tokenHash),
297
- index5("junior_api_tokens_owner_email_idx").on(table.ownerEmailNormalized)
352
+ uniqueIndex5("junior_api_tokens_token_hash_uidx").on(table.tokenHash),
353
+ index6("junior_api_tokens_owner_email_idx").on(table.ownerEmailNormalized)
298
354
  ]
299
355
  );
300
356
 
301
357
  // src/db/schema/conversation-events.ts
302
358
  import {
303
359
  foreignKey as foreignKey2,
304
- index as index6,
305
- integer as integer4,
360
+ index as index7,
361
+ integer as integer5,
306
362
  jsonb as jsonb4,
307
- pgTable as pgTable8,
363
+ pgTable as pgTable9,
308
364
  primaryKey as primaryKey2,
309
- text as text8,
310
- uniqueIndex as uniqueIndex5
365
+ text as text9,
366
+ uniqueIndex as uniqueIndex6
311
367
  } from "drizzle-orm/pg-core";
312
- import { sql as sql3 } from "drizzle-orm";
313
- var juniorConversationEvents = pgTable8(
368
+ import { sql as sql4 } from "drizzle-orm";
369
+ var juniorConversationEvents = pgTable9(
314
370
  "junior_conversation_events",
315
371
  {
316
- conversationId: text8("conversation_id").notNull(),
317
- seq: integer4("seq").notNull(),
318
- historyVersion: integer4("history_version").notNull(),
319
- schemaVersion: integer4("schema_version").default(1).notNull(),
320
- idempotencyKey: text8("idempotency_key"),
321
- type: text8("type").notNull(),
372
+ conversationId: text9("conversation_id").notNull(),
373
+ seq: integer5("seq").notNull(),
374
+ historyVersion: integer5("history_version").notNull(),
375
+ schemaVersion: integer5("schema_version").default(1).notNull(),
376
+ idempotencyKey: text9("idempotency_key"),
377
+ type: text9("type").notNull(),
322
378
  payload: jsonb4("payload").$type().notNull(),
323
- actorIdentityId: text8("actor_identity_id").references(
379
+ actorIdentityId: text9("actor_identity_id").references(
324
380
  () => juniorIdentities.id
325
381
  ),
326
382
  createdAt: timestamptz("created_at").notNull()
@@ -335,23 +391,23 @@ var juniorConversationEvents = pgTable8(
335
391
  columns: [table.conversationId],
336
392
  foreignColumns: [juniorConversations.conversationId]
337
393
  }),
338
- index6("junior_conversation_events_history_version_idx").on(
394
+ index7("junior_conversation_events_history_version_idx").on(
339
395
  table.conversationId,
340
396
  table.historyVersion,
341
397
  table.seq
342
398
  ),
343
- index6("junior_conversation_events_type_idx").on(
399
+ index7("junior_conversation_events_type_idx").on(
344
400
  table.conversationId,
345
401
  table.type,
346
402
  table.seq
347
403
  ),
348
- index6("junior_conversation_events_actor_identity_idx").on(
404
+ index7("junior_conversation_events_actor_identity_idx").on(
349
405
  table.actorIdentityId,
350
406
  table.conversationId,
351
407
  table.seq
352
408
  ),
353
- index6("junior_conversation_events_message_search_idx").using("gin", sql3`to_tsvector('english', ${table.payload}->>'text')`).where(sql3`${table.type} = 'message'`),
354
- uniqueIndex5("junior_conversation_events_idempotency_idx").on(
409
+ index7("junior_conversation_events_message_search_idx").using("gin", sql4`to_tsvector('english', ${table.payload}->>'text')`).where(sql4`${table.type} = 'message'`),
410
+ uniqueIndex6("junior_conversation_events_idempotency_idx").on(
355
411
  table.conversationId,
356
412
  table.idempotencyKey
357
413
  )
@@ -359,15 +415,15 @@ var juniorConversationEvents = pgTable8(
359
415
  );
360
416
 
361
417
  // src/db/schema/conversation-bindings.ts
362
- import { index as index7, pgTable as pgTable9, primaryKey as primaryKey3, text as text9 } from "drizzle-orm/pg-core";
363
- var juniorConversationBindings = pgTable9(
418
+ import { index as index8, pgTable as pgTable10, primaryKey as primaryKey3, text as text10 } from "drizzle-orm/pg-core";
419
+ var juniorConversationBindings = pgTable10(
364
420
  "junior_conversation_bindings",
365
421
  {
366
- conversationId: text9("conversation_id").notNull().references(() => juniorConversations.conversationId),
367
- provider: text9("provider").notNull(),
368
- providerTenantId: text9("provider_tenant_id").notNull().default(""),
369
- providerDestinationId: text9("provider_destination_id").notNull(),
370
- providerConversationId: text9("provider_conversation_id").notNull(),
422
+ conversationId: text10("conversation_id").notNull().references(() => juniorConversations.conversationId),
423
+ provider: text10("provider").notNull(),
424
+ providerTenantId: text10("provider_tenant_id").notNull().default(""),
425
+ providerDestinationId: text10("provider_destination_id").notNull(),
426
+ providerConversationId: text10("provider_conversation_id").notNull(),
371
427
  createdAt: timestamptz("created_at").notNull()
372
428
  },
373
429
  (table) => [
@@ -380,19 +436,19 @@ var juniorConversationBindings = pgTable9(
380
436
  table.providerConversationId
381
437
  ]
382
438
  }),
383
- index7("junior_conversation_bindings_conversation_idx").on(
439
+ index8("junior_conversation_bindings_conversation_idx").on(
384
440
  table.conversationId
385
441
  )
386
442
  ]
387
443
  );
388
444
 
389
445
  // src/db/schema/conversation-participants.ts
390
- import { index as index8, pgTable as pgTable10, primaryKey as primaryKey4, text as text10 } from "drizzle-orm/pg-core";
391
- var juniorConversationParticipants = pgTable10(
446
+ import { index as index9, pgTable as pgTable11, primaryKey as primaryKey4, text as text11 } from "drizzle-orm/pg-core";
447
+ var juniorConversationParticipants = pgTable11(
392
448
  "junior_conversation_participants",
393
449
  {
394
- userId: text10("user_id").notNull().references(() => juniorUsers.id),
395
- rootConversationId: text10("root_conversation_id").notNull().references(() => juniorConversations.conversationId),
450
+ userId: text11("user_id").notNull().references(() => juniorUsers.id),
451
+ rootConversationId: text11("root_conversation_id").notNull().references(() => juniorConversations.conversationId),
396
452
  lastMessageAt: timestamptz("last_message_at").notNull(),
397
453
  archivedAt: timestamptz("archived_at")
398
454
  },
@@ -401,11 +457,11 @@ var juniorConversationParticipants = pgTable10(
401
457
  name: "junior_conversation_participants_user_root_pk",
402
458
  columns: [table.userId, table.rootConversationId]
403
459
  }),
404
- index8("junior_conversation_participants_user_activity_idx").on(
460
+ index9("junior_conversation_participants_user_activity_idx").on(
405
461
  table.userId,
406
462
  table.lastMessageAt.desc()
407
463
  ),
408
- index8("junior_conversation_participants_root_idx").on(
464
+ index9("junior_conversation_participants_root_idx").on(
409
465
  table.rootConversationId
410
466
  )
411
467
  ]
@@ -413,62 +469,62 @@ var juniorConversationParticipants = pgTable10(
413
469
 
414
470
  // src/db/schema/agent-invocations.ts
415
471
  import {
416
- index as index9,
472
+ index as index10,
417
473
  jsonb as jsonb5,
418
- pgTable as pgTable11,
474
+ pgTable as pgTable12,
419
475
  primaryKey as primaryKey5,
420
- text as text11,
421
- uniqueIndex as uniqueIndex6
476
+ text as text12,
477
+ uniqueIndex as uniqueIndex7
422
478
  } from "drizzle-orm/pg-core";
423
479
  var AGENT_INVOCATION_MAILBOX_STATUSES = [
424
480
  "pending",
425
481
  "appended"
426
482
  ];
427
- var juniorAgentBindings = pgTable11(
483
+ var juniorAgentBindings = pgTable12(
428
484
  "junior_agent_bindings",
429
485
  {
430
- parentConversationId: text11("parent_conversation_id").notNull().references(() => juniorConversations.conversationId),
431
- name: text11("name").notNull(),
432
- childConversationId: text11("child_conversation_id").notNull().references(() => juniorConversations.conversationId)
486
+ parentConversationId: text12("parent_conversation_id").notNull().references(() => juniorConversations.conversationId),
487
+ name: text12("name").notNull(),
488
+ childConversationId: text12("child_conversation_id").notNull().references(() => juniorConversations.conversationId)
433
489
  },
434
490
  (table) => [
435
491
  primaryKey5({
436
492
  columns: [table.parentConversationId, table.name]
437
493
  }),
438
- uniqueIndex6("junior_agent_bindings_child_idx").on(
494
+ uniqueIndex7("junior_agent_bindings_child_idx").on(
439
495
  table.childConversationId
440
496
  )
441
497
  ]
442
498
  );
443
- var juniorAgentInvocations = pgTable11(
499
+ var juniorAgentInvocations = pgTable12(
444
500
  "junior_agent_invocations",
445
501
  {
446
- invocationId: text11("invocation_id").primaryKey(),
447
- parentConversationId: text11("parent_conversation_id").notNull().references(() => juniorConversations.conversationId),
448
- childConversationId: text11("child_conversation_id").notNull().references(() => juniorConversations.conversationId),
449
- agentName: text11("agent_name"),
450
- input: text11("input").notNull(),
502
+ invocationId: text12("invocation_id").primaryKey(),
503
+ parentConversationId: text12("parent_conversation_id").notNull().references(() => juniorConversations.conversationId),
504
+ childConversationId: text12("child_conversation_id").notNull().references(() => juniorConversations.conversationId),
505
+ agentName: text12("agent_name"),
506
+ input: text12("input").notNull(),
451
507
  actor: jsonb5("actor_json").$type().notNull(),
452
508
  credentialContext: jsonb5(
453
509
  "credential_context_json"
454
510
  ).$type(),
455
511
  source: jsonb5("source_json").$type().notNull(),
456
512
  destination: jsonb5("destination_json").$type().notNull(),
457
- destinationVisibility: text11(
513
+ destinationVisibility: text12(
458
514
  "destination_visibility"
459
515
  ).$type(),
460
- reasoningLevel: text11("reasoning_level").$type(),
461
- status: text11("status").$type().notNull(),
462
- mailboxStatus: text11("mailbox_status").$type().notNull(),
463
- result: text11("result"),
464
- errorMessage: text11("error_message"),
516
+ reasoningLevel: text12("reasoning_level").$type(),
517
+ status: text12("status").$type().notNull(),
518
+ mailboxStatus: text12("mailbox_status").$type().notNull(),
519
+ result: text12("result"),
520
+ errorMessage: text12("error_message"),
465
521
  createdAt: timestamptz("created_at").notNull(),
466
522
  updatedAt: timestamptz("updated_at").notNull(),
467
523
  terminalAt: timestamptz("terminal_at")
468
524
  },
469
525
  (table) => [
470
- index9("junior_agent_invocations_child_idx").on(table.childConversationId),
471
- index9("junior_agent_invocations_mailbox_idx").on(
526
+ index10("junior_agent_invocations_child_idx").on(table.childConversationId),
527
+ index10("junior_agent_invocations_mailbox_idx").on(
472
528
  table.mailboxStatus,
473
529
  table.createdAt
474
530
  )
@@ -476,42 +532,42 @@ var juniorAgentInvocations = pgTable11(
476
532
  );
477
533
 
478
534
  // src/db/schema/location-configurations.ts
479
- import { pgTable as pgTable12, primaryKey as primaryKey6, text as text12 } from "drizzle-orm/pg-core";
480
- var juniorLocationConfigurations = pgTable12(
535
+ import { pgTable as pgTable13, primaryKey as primaryKey6, text as text13 } from "drizzle-orm/pg-core";
536
+ var juniorLocationConfigurations = pgTable13(
481
537
  "junior_location_configurations",
482
538
  {
483
- locationId: text12("location_id").notNull().references(() => juniorDestinations.id, { onDelete: "cascade" }),
484
- key: text12("key").notNull(),
485
- value: text12("value").notNull(),
539
+ locationId: text13("location_id").notNull().references(() => juniorDestinations.id, { onDelete: "cascade" }),
540
+ key: text13("key").notNull(),
541
+ value: text13("value").notNull(),
486
542
  updatedAt: timestamptz("updated_at").notNull(),
487
- updatedBy: text12("updated_by"),
488
- source: text12("source"),
489
- expiresAt: text12("expires_at")
543
+ updatedBy: text13("updated_by"),
544
+ source: text13("source"),
545
+ expiresAt: text13("expires_at")
490
546
  },
491
547
  (table) => [primaryKey6({ columns: [table.locationId, table.key] })]
492
548
  );
493
549
 
494
550
  // src/db/schema/event-tasks.ts
495
- import { bigint, index as index10, jsonb as jsonb6, pgTable as pgTable13, text as text13 } from "drizzle-orm/pg-core";
496
- var juniorEventTasks = pgTable13(
551
+ import { bigint, index as index11, jsonb as jsonb6, pgTable as pgTable14, text as text14 } from "drizzle-orm/pg-core";
552
+ var juniorEventTasks = pgTable14(
497
553
  "junior_event_tasks",
498
554
  {
499
- id: text13("id").primaryKey(),
500
- teamId: text13("team_id").notNull(),
501
- namespace: text13("namespace").notNull(),
502
- identifier: text13("identifier").notNull(),
555
+ id: text14("id").primaryKey(),
556
+ teamId: text14("team_id").notNull(),
557
+ namespace: text14("namespace").notNull(),
558
+ identifier: text14("identifier").notNull(),
503
559
  createdAtMs: bigint("created_at_ms", { mode: "number" }).notNull(),
504
560
  /** Short display title generated from the task instruction. */
505
- title: text13("title"),
561
+ title: text14("title"),
506
562
  task: jsonb6("task_json").$type().notNull()
507
563
  },
508
564
  (table) => [
509
- index10("junior_event_tasks_team_idx").on(
565
+ index11("junior_event_tasks_team_idx").on(
510
566
  table.teamId,
511
567
  table.createdAtMs,
512
568
  table.id
513
569
  ),
514
- index10("junior_event_tasks_match_idx").on(
570
+ index11("junior_event_tasks_match_idx").on(
515
571
  table.namespace,
516
572
  table.identifier,
517
573
  table.createdAtMs,
@@ -521,15 +577,15 @@ var juniorEventTasks = pgTable13(
521
577
  );
522
578
 
523
579
  // src/db/schema/stats.ts
524
- import { date, integer as integer5, pgTable as pgTable14, primaryKey as primaryKey7, text as text14 } from "drizzle-orm/pg-core";
525
- var juniorStats = pgTable14(
580
+ import { date, integer as integer6, pgTable as pgTable15, primaryKey as primaryKey7, text as text15 } from "drizzle-orm/pg-core";
581
+ var juniorStats = pgTable15(
526
582
  "junior_stats",
527
583
  {
528
584
  date: date("date", { mode: "string" }).notNull(),
529
- namespace: text14("namespace").notNull(),
530
- metric: text14("metric").notNull(),
531
- name: text14("name").notNull(),
532
- count: integer5("count").notNull().default(0)
585
+ namespace: text15("namespace").notNull(),
586
+ metric: text15("metric").notNull(),
587
+ name: text15("name").notNull(),
588
+ count: integer6("count").notNull().default(0)
533
589
  },
534
590
  (table) => [
535
591
  primaryKey7({
@@ -540,35 +596,35 @@ var juniorStats = pgTable14(
540
596
  );
541
597
 
542
598
  // src/db/schema/task-executions.ts
543
- import { sql as sql4 } from "drizzle-orm";
599
+ import { sql as sql5 } from "drizzle-orm";
544
600
  import {
545
601
  bigint as bigint2,
546
602
  check,
547
603
  foreignKey as foreignKey3,
548
- index as index11,
549
- pgTable as pgTable15,
604
+ index as index12,
605
+ pgTable as pgTable16,
550
606
  primaryKey as primaryKey8,
551
- text as text15
607
+ text as text16
552
608
  } from "drizzle-orm/pg-core";
553
- var juniorTaskExecutions = pgTable15(
609
+ var juniorTaskExecutions = pgTable16(
554
610
  "junior_task_executions",
555
611
  {
556
- executionId: text15("execution_id").notNull(),
557
- kind: text15("kind").notNull(),
558
- namespace: text15("namespace").notNull(),
559
- taskId: text15("task_id").notNull(),
560
- conversationId: text15("conversation_id"),
612
+ executionId: text16("execution_id").notNull(),
613
+ kind: text16("kind").notNull(),
614
+ namespace: text16("namespace").notNull(),
615
+ taskId: text16("task_id").notNull(),
616
+ conversationId: text16("conversation_id"),
561
617
  executedAtMs: bigint2("executed_at_ms", { mode: "number" }).notNull(),
562
- status: text15("status").$type().notNull()
618
+ status: text16("status").$type().notNull()
563
619
  },
564
620
  (table) => [
565
621
  check(
566
622
  "junior_task_executions_kind_check",
567
- sql4`${table.kind} in ('scheduled', 'event')`
623
+ sql5`${table.kind} in ('scheduled', 'event')`
568
624
  ),
569
625
  check(
570
626
  "junior_task_executions_status_check",
571
- sql4`${table.status} in ('blocked', 'completed', 'failed')`
627
+ sql5`${table.status} in ('blocked', 'completed', 'failed')`
572
628
  ),
573
629
  primaryKey8({
574
630
  name: "junior_task_executions_kind_namespace_execution_id_pk",
@@ -579,17 +635,17 @@ var juniorTaskExecutions = pgTable15(
579
635
  columns: [table.conversationId],
580
636
  foreignColumns: [juniorConversations.conversationId]
581
637
  }),
582
- index11("junior_task_executions_task_time_idx").on(
638
+ index12("junior_task_executions_task_time_idx").on(
583
639
  table.kind,
584
640
  table.namespace,
585
641
  table.taskId,
586
642
  table.executedAtMs
587
643
  ),
588
- index11("junior_task_executions_time_kind_idx").on(
644
+ index12("junior_task_executions_time_kind_idx").on(
589
645
  table.executedAtMs,
590
646
  table.kind
591
647
  ),
592
- index11("junior_task_executions_conversation_time_idx").on(
648
+ index12("junior_task_executions_conversation_time_idx").on(
593
649
  table.conversationId,
594
650
  table.executedAtMs
595
651
  )
@@ -597,55 +653,55 @@ var juniorTaskExecutions = pgTable15(
597
653
  );
598
654
 
599
655
  // src/db/schema/scheduled-tasks.ts
600
- import { sql as sql5 } from "drizzle-orm";
601
- import { bigint as bigint3, index as index12, jsonb as jsonb7, pgTable as pgTable16, text as text16 } from "drizzle-orm/pg-core";
602
- var juniorSchedulerTasks = pgTable16(
656
+ import { sql as sql6 } from "drizzle-orm";
657
+ import { bigint as bigint3, index as index13, jsonb as jsonb7, pgTable as pgTable17, text as text17 } from "drizzle-orm/pg-core";
658
+ var juniorSchedulerTasks = pgTable17(
603
659
  "junior_scheduler_tasks",
604
660
  {
605
- id: text16("id").primaryKey(),
606
- teamId: text16("team_id").notNull(),
661
+ id: text17("id").primaryKey(),
662
+ teamId: text17("team_id").notNull(),
607
663
  // TODO(v0.128.0): Remove after v0.127.x runtimes no longer write this column.
608
- creatorSlackUserId: text16("creator_slack_user_id"),
609
- creatorIdentityId: text16("creator_identity_id"),
610
- status: text16("status").notNull(),
664
+ creatorSlackUserId: text17("creator_slack_user_id"),
665
+ creatorIdentityId: text17("creator_identity_id"),
666
+ status: text17("status").notNull(),
611
667
  nextRunAtMs: bigint3("next_run_at_ms", { mode: "number" }),
612
668
  runNowAtMs: bigint3("run_now_at_ms", { mode: "number" }),
613
669
  createdAtMs: bigint3("created_at_ms", { mode: "number" }).notNull(),
614
670
  /** Short display title generated from the task instruction. */
615
- title: text16("title"),
671
+ title: text17("title"),
616
672
  record: jsonb7("record").$type().notNull()
617
673
  },
618
674
  (table) => [
619
675
  // TODO(v0.128.0): Remove with creatorSlackUserId.
620
- index12("junior_scheduler_tasks_creator_idx").on(table.teamId, table.creatorSlackUserId, table.createdAtMs, table.id).where(sql5`${table.status} <> 'deleted'`),
621
- index12("junior_scheduler_tasks_creator_identity_idx").on(table.creatorIdentityId, table.createdAtMs, table.id).where(
622
- sql5`${table.status} <> 'deleted' AND ${table.creatorIdentityId} IS NOT NULL`
676
+ index13("junior_scheduler_tasks_creator_idx").on(table.teamId, table.creatorSlackUserId, table.createdAtMs, table.id).where(sql6`${table.status} <> 'deleted'`),
677
+ index13("junior_scheduler_tasks_creator_identity_idx").on(table.creatorIdentityId, table.createdAtMs, table.id).where(
678
+ sql6`${table.status} <> 'deleted' AND ${table.creatorIdentityId} IS NOT NULL`
623
679
  ),
624
- index12("junior_scheduler_tasks_team_status_idx").on(table.teamId, table.createdAtMs, table.id).where(sql5`${table.status} <> 'deleted'`),
625
- index12("junior_scheduler_tasks_run_now_due_idx").on(table.runNowAtMs, table.createdAtMs, table.id).where(
626
- sql5`${table.status} = 'active' AND ${table.runNowAtMs} IS NOT NULL`
680
+ index13("junior_scheduler_tasks_team_status_idx").on(table.teamId, table.createdAtMs, table.id).where(sql6`${table.status} <> 'deleted'`),
681
+ index13("junior_scheduler_tasks_run_now_due_idx").on(table.runNowAtMs, table.createdAtMs, table.id).where(
682
+ sql6`${table.status} = 'active' AND ${table.runNowAtMs} IS NOT NULL`
627
683
  ),
628
- index12("junior_scheduler_tasks_next_run_due_idx").on(table.nextRunAtMs, table.createdAtMs, table.id).where(
629
- sql5`${table.status} = 'active' AND ${table.nextRunAtMs} IS NOT NULL`
684
+ index13("junior_scheduler_tasks_next_run_due_idx").on(table.nextRunAtMs, table.createdAtMs, table.id).where(
685
+ sql6`${table.status} = 'active' AND ${table.nextRunAtMs} IS NOT NULL`
630
686
  )
631
687
  ]
632
688
  );
633
- var juniorSchedulerRuns = pgTable16(
689
+ var juniorSchedulerRuns = pgTable17(
634
690
  "junior_scheduler_runs",
635
691
  {
636
- id: text16("id").primaryKey(),
637
- taskId: text16("task_id").notNull(),
638
- status: text16("status").notNull(),
692
+ id: text17("id").primaryKey(),
693
+ taskId: text17("task_id").notNull(),
694
+ status: text17("status").notNull(),
639
695
  scheduledForMs: bigint3("scheduled_for_ms", { mode: "number" }).notNull(),
640
696
  record: jsonb7("record").$type().notNull()
641
697
  },
642
698
  (table) => [
643
- index12("junior_scheduler_runs_task_status_idx").on(
699
+ index13("junior_scheduler_runs_task_status_idx").on(
644
700
  table.taskId,
645
701
  table.status,
646
702
  table.scheduledForMs
647
703
  ),
648
- index12("junior_scheduler_runs_status_idx").on(
704
+ index13("junior_scheduler_runs_status_idx").on(
649
705
  table.status,
650
706
  table.scheduledForMs
651
707
  )
@@ -653,36 +709,36 @@ var juniorSchedulerRuns = pgTable16(
653
709
  );
654
710
 
655
711
  // src/db/schema/snapshots.ts
656
- import { sql as sql6 } from "drizzle-orm";
712
+ import { sql as sql7 } from "drizzle-orm";
657
713
  import {
658
714
  bigint as bigint4,
659
715
  check as check2,
660
- index as index13,
661
- integer as integer6,
662
- pgTable as pgTable18,
663
- text as text18,
664
- uniqueIndex as uniqueIndex8
716
+ index as index14,
717
+ integer as integer7,
718
+ pgTable as pgTable19,
719
+ text as text19,
720
+ uniqueIndex as uniqueIndex9
665
721
  } from "drizzle-orm/pg-core";
666
722
 
667
723
  // src/db/schema/workspaces.ts
668
- import { pgTable as pgTable17, primaryKey as primaryKey9, text as text17, uniqueIndex as uniqueIndex7 } from "drizzle-orm/pg-core";
669
- var juniorWorkspaces = pgTable17(
724
+ import { pgTable as pgTable18, primaryKey as primaryKey9, text as text18, uniqueIndex as uniqueIndex8 } from "drizzle-orm/pg-core";
725
+ var juniorWorkspaces = pgTable18(
670
726
  "junior_workspaces",
671
727
  {
672
- id: text17("id").primaryKey(),
673
- name: text17("name").notNull(),
674
- setupScript: text17("setup_script").notNull().default(""),
728
+ id: text18("id").primaryKey(),
729
+ name: text18("name").notNull(),
730
+ setupScript: text18("setup_script").notNull().default(""),
675
731
  createdAt: timestamptz("created_at").notNull(),
676
732
  updatedAt: timestamptz("updated_at").notNull()
677
733
  },
678
- (table) => [uniqueIndex7("junior_workspaces_name_idx").on(table.name)]
734
+ (table) => [uniqueIndex8("junior_workspaces_name_idx").on(table.name)]
679
735
  );
680
- var juniorWorkspaceRepos = pgTable17(
736
+ var juniorWorkspaceRepos = pgTable18(
681
737
  "junior_workspace_repos",
682
738
  {
683
- workspaceId: text17("workspace_id").notNull().references(() => juniorWorkspaces.id, { onDelete: "cascade" }),
684
- provider: text17("provider").notNull(),
685
- repo: text17("repo").notNull()
739
+ workspaceId: text18("workspace_id").notNull().references(() => juniorWorkspaces.id, { onDelete: "cascade" }),
740
+ provider: text18("provider").notNull(),
741
+ repo: text18("repo").notNull()
686
742
  },
687
743
  (table) => [
688
744
  primaryKey9({ columns: [table.workspaceId, table.provider, table.repo] })
@@ -690,63 +746,63 @@ var juniorWorkspaceRepos = pgTable17(
690
746
  );
691
747
 
692
748
  // src/db/schema/snapshots.ts
693
- var juniorSnapshots = pgTable18(
749
+ var juniorSnapshots = pgTable19(
694
750
  "junior_snapshots",
695
751
  {
696
- id: text18("id").primaryKey(),
697
- workspaceId: text18("workspace_id").notNull().references(() => juniorWorkspaces.id, { onDelete: "cascade" }),
698
- profileHash: text18("profile_hash").notNull(),
699
- status: text18("status").$type().notNull(),
752
+ id: text19("id").primaryKey(),
753
+ workspaceId: text19("workspace_id").notNull().references(() => juniorWorkspaces.id, { onDelete: "cascade" }),
754
+ profileHash: text19("profile_hash").notNull(),
755
+ status: text19("status").$type().notNull(),
700
756
  // Ready artifact facts.
701
- snapshotId: text18("snapshot_id"),
702
- buildDurationMs: integer6("build_duration_ms"),
757
+ snapshotId: text19("snapshot_id"),
758
+ buildDurationMs: integer7("build_duration_ms"),
703
759
  // Provider snapshot size when the capture response includes it.
704
760
  sizeBytes: bigint4("size_bytes", { mode: "number" }),
705
761
  generatedAt: timestamptz("generated_at"),
706
762
  // Builder references for check-in and snapshot-owner cleanup.
707
763
  buildStartedAt: timestamptz("build_started_at"),
708
- buildPhase: text18("build_phase").$type(),
709
- buildSandboxName: text18("build_sandbox_name"),
710
- buildCommandId: text18("build_command_id"),
711
- buildError: text18("build_error"),
764
+ buildPhase: text19("build_phase").$type(),
765
+ buildSandboxName: text19("build_sandbox_name"),
766
+ buildCommandId: text19("build_command_id"),
767
+ buildError: text19("build_error"),
712
768
  createdAt: timestamptz("created_at").notNull(),
713
769
  updatedAt: timestamptz("updated_at").notNull()
714
770
  },
715
771
  (table) => [
716
772
  check2(
717
773
  "junior_snapshots_status_check",
718
- sql6`${table.status} in ('building', 'failed', 'ready')`
774
+ sql7`${table.status} in ('building', 'failed', 'ready')`
719
775
  ),
720
776
  check2(
721
777
  "junior_snapshots_build_phase_check",
722
- sql6`${table.buildPhase} is null or ${table.buildPhase} in ('created', 'dependencies_installed', 'repositories_prepared')`
778
+ sql7`${table.buildPhase} is null or ${table.buildPhase} in ('created', 'dependencies_installed', 'repositories_prepared')`
723
779
  ),
724
780
  check2(
725
781
  "junior_snapshots_ready_fields_check",
726
- sql6`${table.status} <> 'ready' or (${table.snapshotId} is not null and ${table.buildDurationMs} is not null and ${table.generatedAt} is not null)`
782
+ sql7`${table.status} <> 'ready' or (${table.snapshotId} is not null and ${table.buildDurationMs} is not null and ${table.generatedAt} is not null)`
727
783
  ),
728
784
  check2(
729
785
  "junior_snapshots_build_fields_check",
730
- sql6`${table.status} = 'ready' or (${table.buildStartedAt} is not null and ${table.buildPhase} is not null)`
786
+ sql7`${table.status} = 'ready' or (${table.buildStartedAt} is not null and ${table.buildPhase} is not null)`
731
787
  ),
732
788
  check2(
733
789
  "junior_snapshots_build_duration_check",
734
- sql6`${table.buildDurationMs} is null or ${table.buildDurationMs} >= 0`
790
+ sql7`${table.buildDurationMs} is null or ${table.buildDurationMs} >= 0`
735
791
  ),
736
792
  check2(
737
793
  "junior_snapshots_size_bytes_check",
738
- sql6`${table.sizeBytes} is null or ${table.sizeBytes} >= 0`
794
+ sql7`${table.sizeBytes} is null or ${table.sizeBytes} >= 0`
739
795
  ),
740
796
  // Provider snapshot ids are unique. Nulls stay allowed for in-flight rows.
741
- uniqueIndex8("junior_snapshots_snapshot_id_uidx").on(table.snapshotId),
742
- index13("junior_snapshots_workspace_idx").on(table.workspaceId),
743
- index13("junior_snapshots_workspace_profile_status_idx").on(
797
+ uniqueIndex9("junior_snapshots_snapshot_id_uidx").on(table.snapshotId),
798
+ index14("junior_snapshots_workspace_idx").on(table.workspaceId),
799
+ index14("junior_snapshots_workspace_profile_status_idx").on(
744
800
  table.workspaceId,
745
801
  table.profileHash,
746
802
  table.status
747
803
  ),
748
- uniqueIndex8("junior_snapshots_active_build_uidx").on(table.workspaceId, table.profileHash).where(sql6`${table.status} = 'building'`),
749
- index13("junior_snapshots_workspace_status_idx").on(
804
+ uniqueIndex9("junior_snapshots_active_build_uidx").on(table.workspaceId, table.profileHash).where(sql7`${table.status} = 'building'`),
805
+ index14("junior_snapshots_workspace_status_idx").on(
750
806
  table.workspaceId,
751
807
  table.status
752
808
  )
@@ -757,6 +813,8 @@ var juniorSnapshots = pgTable18(
757
813
  var juniorSqlSchema = {
758
814
  juniorArtifacts,
759
815
  juniorAttachments,
816
+ juniorCodeChanges,
817
+ juniorCodeRepositories,
760
818
  juniorConversationAnnotations,
761
819
  juniorApiTokens,
762
820
  juniorAgentBindings,
@@ -1035,6 +1093,8 @@ export {
1035
1093
  juniorConversations,
1036
1094
  conversationReadColumns,
1037
1095
  juniorAttachments,
1096
+ juniorCodeRepositories,
1097
+ juniorCodeChanges,
1038
1098
  juniorConversationAnnotations,
1039
1099
  juniorApiTokens,
1040
1100
  juniorConversationEvents,