@sentry/junior 0.285.0 → 0.286.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 (73) hide show
  1. package/dist/{adapter-DN5AB4VU.js → adapter-JQZaJ-B_.js} +1 -1
  2. package/dist/{admin-DOITMKnn.js → admin-Dm2bimJ-.js} +1 -1
  3. package/dist/{agent-runner-BsWhHe4N.js → agent-runner-DGCwOEyL.js} +1567 -1048
  4. package/dist/api/schema.d.ts +1 -1
  5. package/dist/api/schema.js +5 -5
  6. package/dist/api.d.ts +1 -1
  7. package/dist/api.js +70 -92
  8. package/dist/{app-DyMs9330.d.ts → app-BKq0JzWx.d.ts} +2 -3
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +37 -40
  11. package/dist/{assistant-reply-9Jip5bsr.js → assistant-reply-CAPafcUY.js} +1 -1
  12. package/dist/{automation-Mk8aaHzy.js → automation-B-jJN_gM.js} +1 -1
  13. package/dist/{background-compaction-queue-DXkLsWoH.js → background-compaction-queue-Btu2oab_.js} +137 -3
  14. package/dist/{briefs-Cl8-nK9B.js → briefs-UMeYehUe.js} +4 -4
  15. package/dist/{catalog-runtime-Bte6jRB2.js → catalog-runtime-Bym8GVdh.js} +1 -1
  16. package/dist/cli/chat.js +14 -14
  17. package/dist/cli/check.js +3 -3
  18. package/dist/cli/main.js +3 -3
  19. package/dist/cli/plugins.js +4 -4
  20. package/dist/cli/snapshot-create.js +5 -6
  21. package/dist/cli/upgrade.d.ts +1 -1
  22. package/dist/cli/upgrade.js +3 -3
  23. package/dist/{client-DDbBucBw.js → client-B0aAs7wC.js} +2 -2
  24. package/dist/{config-DqFnykQT.js → config-B9f9Lqo5.js} +1 -1
  25. package/dist/{connections-DA4LT9LL.js → connections-CQ7p0aNJ.js} +16 -50
  26. package/dist/{conversation-D8kVoCrP.js → conversation-BusI2uzj.js} +15 -6
  27. package/dist/{conversation-pending-messages-BvROq1bq.js → conversation-pending-messages-DwehU0Fd.js} +1 -1
  28. package/dist/{conversation-privacy-D0j_h70R.js → conversation-privacy-Cd_nZZBM.js} +1 -1
  29. package/dist/{credential-sync-hcsYatw-.js → credential-sync-DmiJi_At.js} +13 -13
  30. package/dist/{db-BhHZSuFw.d.ts → db-C5zi4ecs.d.ts} +4 -4
  31. package/dist/{executor-BLEMIgIZ.js → executor-Dipi2Ixl.js} +11 -17
  32. package/dist/instrumentation.js +2 -2
  33. package/dist/{logging-BfORLKoq.js → logging-CMFhLLj4.js} +1 -1
  34. package/dist/{media-Bu9C6lz0.js → media-B-BpXo41.js} +14 -2
  35. package/dist/{message-DqjuKzUx.js → message-D1xLljUF.js} +9 -9
  36. package/dist/nitro.d.ts +1 -1
  37. package/dist/nitro.js +2 -3
  38. package/dist/{oauth-callback-server-CFSRzu1n.js → oauth-callback-server-DCAFIUQr.js} +2 -2
  39. package/dist/{projection-DliWYrnT.js → projection-CoeMNxJ4.js} +286 -212
  40. package/dist/{prompt-BvIUzY4y.js → prompt-C9OQEfan.js} +1 -1
  41. package/dist/{registry-rC7MCxu8.js → registry-u-sFYtx_.js} +1 -1
  42. package/dist/{resolve-Biu8Qw3u.js → resolve-DYqgL3Eo.js} +3 -3
  43. package/dist/{result-DxJMCX47.js → result-CescSwAw.js} +8 -8
  44. package/dist/{runner-BQJSFLKg.js → runner-Cr67a8TB.js} +16 -12
  45. package/dist/{sandbox-egress-signals-6aMxJSDn.js → sandbox-egress-signals-DLOazy5W.js} +1 -1
  46. package/dist/{schema-BasXTvi2.js → schema-BUSi3sgv.js} +5 -5
  47. package/dist/{schema-BUviRAs8.d.ts → schema-Ih60j59-.d.ts} +44 -7
  48. package/dist/{service-account-BI5Wgx22.js → service-account-CGEqz9wG.js} +3 -3
  49. package/dist/{service-account-CAE-_1dR.js → service-account-CsKxktLk.js} +3 -3
  50. package/dist/{session-stop-CA-jOJ84.js → session-stop-CGz5DByb.js} +22 -20
  51. package/dist/{skills-B22duVJU.js → skills-COCqf61f.js} +2 -2
  52. package/dist/{spawn-BB2_4VYn.js → spawn-C8F_iXWO.js} +13 -2
  53. package/dist/{stop-DioIcEAu.js → stop-GyFZkHuQ.js} +242 -952
  54. package/dist/{store-Dn4W7qgH.js → store-D0-8plWp.js} +3 -3
  55. package/dist/{turn-session-routing-CGMKrYOj.js → task-runner-xPuQmEot.js} +1439 -993
  56. package/dist/{store-B26LV6UP.js → turn-failure-response-BOviBdT-.js} +331 -5
  57. package/dist/{validation-TzhfQABF.js → validation-DZDKorGz.js} +1 -1
  58. package/dist/{version-DSk8CFvA.js → version-BTIz7fGi.js} +1 -1
  59. package/dist/version.js +1 -1
  60. package/dist/{viewer-1Ea81s0b.js → viewer-CH-ASQzh.js} +39 -36
  61. package/dist/{work-ybG4_q5C.js → work-C75_IM5e.js} +92 -87
  62. package/dist/{worker-ccSyZRNz.js → worker-Dl47I729.js} +6 -6
  63. package/migrations/0086_shared_archive.sql +31 -0
  64. package/migrations/0087_child_location.sql +64 -0
  65. package/migrations/meta/0086_snapshot.json +4366 -0
  66. package/migrations/meta/0087_snapshot.json +4366 -0
  67. package/migrations/meta/_journal.json +14 -0
  68. package/package.json +5 -4
  69. package/dist/task-queue-Bt0IoR2i.js +0 -139
  70. package/dist/task-runner-D8lddjzp.js +0 -290
  71. package/dist/thread-state-CrFk3K_7.js +0 -173
  72. package/dist/turn-failure-response-DaJ04qVj.js +0 -224
  73. package/dist/turn-lifecycle-C2mXS7AZ.js +0 -58
@@ -1,14 +1,13 @@
1
- import { Ii as startOAuthFlow, Z as loadTurnCheckpoint, nt as getTurnRecord, tt as failTurnRecord } from "./projection-DliWYrnT.js";
2
- import { n as botConfig } from "./config-DqFnykQT.js";
3
- import { C as getSqlExecutor, G as deleteProviderIdentityForSlackUser, K as deleteProviderIdentityForUser, y as getConversationEventStore } from "./viewer-1Ea81s0b.js";
4
- import { u as hasRequiredOAuthScope } from "./registry-rC7MCxu8.js";
5
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Bte6jRB2.js";
6
- import { c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-BsWhHe4N.js";
7
- import { r as getStateAdapter } from "./adapter-DN5AB4VU.js";
8
- import { l as getVercelConversationWorkQueue } from "./background-compaction-queue-DXkLsWoH.js";
9
- import { T as requestConversationWork, h as ensureConversationWake } from "./store-Dn4W7qgH.js";
10
- import { n as resolveTurnSessionRouting } from "./turn-session-routing-CGMKrYOj.js";
11
- import { randomBytes, randomUUID } from "node:crypto";
1
+ import { Ri as startOAuthFlow, Z as loadTurnCheckpoint, it as getTurnRecord, rt as failTurnRecord } from "./projection-CoeMNxJ4.js";
2
+ import { n as botConfig } from "./config-B9f9Lqo5.js";
3
+ import { C as getSqlExecutor, G as deleteProviderIdentityForUser, W as deleteProviderIdentityForSlackUser, x as getConversationStore, y as getConversationEventStore } from "./viewer-CH-ASQzh.js";
4
+ import { u as hasRequiredOAuthScope } from "./registry-u-sFYtx_.js";
5
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-Bym8GVdh.js";
6
+ import { c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-DGCwOEyL.js";
7
+ import { _ as getVercelConversationWorkQueue } from "./background-compaction-queue-Btu2oab_.js";
8
+ import { T as requestConversationWork, h as ensureConversationWake } from "./store-D0-8plWp.js";
9
+ import { mt as resolveTurnSessionRouting } from "./task-runner-xPuQmEot.js";
10
+ import { randomBytes } from "node:crypto";
12
11
  import * as z from "zod";
13
12
  // src/chat/task-execution/authorized-turn.ts
14
13
  /**
@@ -25,7 +24,7 @@ const authorizationSchema = z.object({
25
24
  configuration: z.record(z.string(), z.unknown()).optional(),
26
25
  toolChannelId: z.string().optional()
27
26
  });
28
- function authorizationKey$1(turn) {
27
+ function authorizationKey(turn) {
29
28
  return `turn:${turn.turnId}:authorization:${turn.version}`;
30
29
  }
31
30
  /** Save authorization for this parked boundary without changing model history. */
@@ -33,7 +32,7 @@ async function recordTurnAuthorization(args) {
33
32
  const turn = await getTurnRecord(args.conversationId, args.turnId);
34
33
  if (!turn || turn.state !== "paused" || turn.resumeReason !== "auth") return;
35
34
  await getConversationEventStore().append(args.conversationId, [{
36
- idempotencyKey: authorizationKey$1(turn),
35
+ idempotencyKey: authorizationKey(turn),
37
36
  createdAtMs: Date.now(),
38
37
  data: {
39
38
  type: "structured_event",
@@ -53,7 +52,7 @@ async function recordTurnAuthorization(args) {
53
52
  }
54
53
  /** Read authorization for the exact pause; a later auth pause needs its own callback. */
55
54
  async function getTurnAuthorization(turn) {
56
- const event = await getConversationEventStore().loadByIdempotencyKey(turn.conversationId, authorizationKey$1(turn));
55
+ const event = await getConversationEventStore().loadByIdempotencyKey(turn.conversationId, authorizationKey(turn));
57
56
  if (event?.data.type !== "structured_event") return void 0;
58
57
  return authorizationSchema.parse(event.data.content);
59
58
  }
@@ -91,9 +90,10 @@ async function getPausedTurnRequest(args) {
91
90
  /** Wake the conversation worker for a paused turn. */
92
91
  async function wakePausedTurn(request, options = {}) {
93
92
  const nowMs = options.nowMs ?? Date.now();
93
+ const conversation = await (options.conversationStore ?? getConversationStore()).get({ conversationId: request.conversationId });
94
94
  await requestConversationWork({
95
95
  conversationId: request.conversationId,
96
- destination: request.destination,
96
+ destination: conversation && conversation.kind !== "root" ? void 0 : request.destination,
97
97
  nowMs,
98
98
  state: options.state
99
99
  });
@@ -290,40 +290,6 @@ function htmlCallbackResponse(title, message, status, options = {}) {
290
290
  }
291
291
  });
292
292
  }
293
- // src/chat/conversations/web-authorization.ts
294
- const WEB_AUTHORIZATION_PREFIX = "junior:web_authorization:v1";
295
- const WEB_AUTHORIZATION_TTL_MS = 864e5;
296
- function authorizationKey(conversationId, actorId) {
297
- return `${WEB_AUTHORIZATION_PREFIX}:${conversationId}:${actorId}`;
298
- }
299
- /** Build authorization delivery for one web turn. */
300
- function createWebAuthorization(args) {
301
- return {
302
- createState: async () => randomUUID(),
303
- deliver: async (request) => {
304
- await getStateAdapter().set(authorizationKey(args.conversationId, args.actorId), JSON.stringify({
305
- ...request,
306
- ...args
307
- }), WEB_AUTHORIZATION_TTL_MS);
308
- }
309
- };
310
- }
311
- /** Read the pending authorization request for one web actor. */
312
- async function getWebAuthorization(args) {
313
- const value = await getStateAdapter().get(authorizationKey(args.conversationId, args.actorId));
314
- if (typeof value !== "string") return void 0;
315
- try {
316
- const parsed = JSON.parse(value);
317
- if (parsed.actorId !== args.actorId || parsed.conversationId !== args.conversationId || typeof parsed.authorizationUrl !== "string" || typeof parsed.label !== "string" || typeof parsed.completionText !== "string") return;
318
- return parsed;
319
- } catch {
320
- return;
321
- }
322
- }
323
- /** Remove a web authorization request after the parked turn continues. */
324
- async function deleteWebAuthorization(args) {
325
- await getStateAdapter().delete(authorizationKey(args.conversationId, args.actorId));
326
- }
327
293
  // src/chat/credentials/unlink-provider.ts
328
294
  /** Remove one provider connection and its exact stored account identity. */
329
295
  async function unlinkProvider(userId, provider, userTokenStore, slackTeamId) {
@@ -401,4 +367,4 @@ async function disconnectConnection(userId, provider, userTokenStore) {
401
367
  if (tokens?.account) await deleteProviderIdentityForUser(getSqlExecutor(), userId, provider, tokens.account.id);
402
368
  await unlinkProvider(userId, provider, userTokenStore);
403
369
  }
404
- export { startConnection as a, deleteWebAuthorization as c, createPausedTurns as d, getPausedTurnRequest as f, getTurnAuthorization as h, readConnectedOAuthTokens as i, getWebAuthorization as l, wakePausedTurn as m, isConnectableProvider as n, unlinkProvider as o, wakeAuthorizedTurn as p, listConnections as r, createWebAuthorization as s, disconnectConnection as t, htmlCallbackResponse as u };
370
+ export { startConnection as a, createPausedTurns as c, wakePausedTurn as d, getTurnAuthorization as f, readConnectedOAuthTokens as i, getPausedTurnRequest as l, isConnectableProvider as n, unlinkProvider as o, listConnections as r, htmlCallbackResponse as s, disconnectConnection as t, wakeAuthorizedTurn as u };
@@ -1,4 +1,4 @@
1
- import { c as conversationTurnFailureCodeSchema, l as conversationTurnFailureReasonSchema, n as INPUT_IMAGE_TYPES, y as usageSchema } from "./media-Bu9C6lz0.js";
1
+ import { c as conversationTurnFailureCodeSchema, l as conversationTurnFailureReasonSchema, n as INPUT_IMAGE_TYPES, y as usageSchema } from "./media-B-BpXo41.js";
2
2
  import * as z from "zod";
3
3
  import { codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, objectFactFields, objectTypeSchema } from "@sentry/junior-plugin-api";
4
4
  // src/chat/briefs/schema.ts
@@ -437,11 +437,6 @@ const conversationSummaryReportSchema = z.object({
437
437
  kind: conversationKindSchema,
438
438
  /** Present on Threads and Tasks. */
439
439
  parentConversationId: z.string().min(1).optional(),
440
- /**
441
- * Present on Threads and Tasks: when the child was archived for everyone,
442
- * or null. `archivedAt` stays the viewer's archive of the root.
443
- */
444
- childArchivedAt: z.string().datetime().nullable().optional(),
445
440
  isParticipant: z.boolean(),
446
441
  visibility: z.enum(["private", "public"]).optional(),
447
442
  status: conversationReportStatusSchema,
@@ -451,6 +446,10 @@ const conversationSummaryReportSchema = z.object({
451
446
  surface: conversationSurfaceSchema,
452
447
  actorIdentity: actorIdentitySchema.optional(),
453
448
  participants: z.array(actorIdentitySchema).optional(),
449
+ /**
450
+ * When this Conversation was archived for everyone, or null. It shows
451
+ * only while it and every ancestor are unarchived.
452
+ */
454
453
  archivedAt: z.string().datetime().nullable().optional(),
455
454
  pinnedAt: z.string().datetime().nullable().optional(),
456
455
  /** The viewer's place in Pinned. Unset until they reorder their pins. */
@@ -513,6 +512,8 @@ const conversationReportMessageEventDataSchema = z.object({
513
512
  /** Agent invocation whose input this is. An agent wrote it, not a person. */
514
513
  agentInvocationId: z.string().min(1).optional(),
515
514
  eventType: z.string().min(1).optional(),
515
+ /** Namespace of the first Event, such as `github`. */
516
+ eventNamespace: z.string().min(1).optional(),
516
517
  eventObjectType: objectTypeSchema.optional(),
517
518
  explicitMention: z.boolean().optional(),
518
519
  quiet: z.literal(true).optional(),
@@ -668,6 +669,13 @@ const conversationReportAttachmentsDeliveredEventDataSchema = z.object({
668
669
  type: z.literal("attachments_delivered"),
669
670
  attachments: z.array(messageAttachmentSchema).min(1)
670
671
  }).strict();
672
+ /** Junior text that a plugin tool posted to its provider. */
673
+ const conversationReportReplyPostedEventDataSchema = z.object({
674
+ type: z.literal("reply_posted"),
675
+ plugin: z.string().min(1),
676
+ text: z.string().min(1),
677
+ url: z.string().url().optional()
678
+ }).strict();
671
679
  const conversationReportCompactionEventDataSchema = z.object({
672
680
  type: z.literal("compaction"),
673
681
  modelId: z.string().min(1).optional(),
@@ -711,6 +719,7 @@ const conversationReportEventDataSchema = z.discriminatedUnion("type", [
711
719
  conversationReportTurnContextEventDataSchema,
712
720
  conversationReportStructuredEventDataSchema,
713
721
  conversationReportAttachmentsDeliveredEventDataSchema,
722
+ conversationReportReplyPostedEventDataSchema,
714
723
  conversationReportGuardianActionReviewedEventDataSchema,
715
724
  conversationReportCompactionEventDataSchema,
716
725
  conversationReportSubagentEventDataSchema
@@ -1,4 +1,4 @@
1
- import { A as reviewItemChangeRecordSchema, i as actorIdentitySchema, l as conversationDetailReportSchema, z as messageAttachmentSchema } from "./conversation-D8kVoCrP.js";
1
+ import { A as reviewItemChangeRecordSchema, i as actorIdentitySchema, l as conversationDetailReportSchema, z as messageAttachmentSchema } from "./conversation-BusI2uzj.js";
2
2
  import * as z from "zod";
3
3
  // src/reporting-schema.ts
4
4
  const healthReportSchema = z.object({
@@ -1,4 +1,4 @@
1
- import { h as logWarn } from "./logging-BfORLKoq.js";
1
+ import { h as logWarn } from "./logging-CMFhLLj4.js";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  // src/chat/conversation-privacy.ts
4
4
  const SAFE_METADATA_KEY_LIMIT = 20;
@@ -1,19 +1,19 @@
1
- import { Fi as resolveBaseUrl, J as getConversationPendingAuth, Ni as formatProviderLabel, Pi as parseOAuthStatePayload, Pn as createUserTokenStore, Rn as resolvePluginOAuthAccount, Yi as postSlackMessage, aa as getSlackClient, d as recordAuthorizationCompleted, nt as getTurnRecord, u as recordAuthenticationLinked } from "./projection-DliWYrnT.js";
2
- import { m as escapeXml } from "./client-DDbBucBw.js";
3
- import { a as getRuntimeMetadata, n as botConfig } from "./config-DqFnykQT.js";
4
- import { H as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-BfORLKoq.js";
1
+ import { Bn as resolvePluginOAuthAccount, Fi as formatProviderLabel, Ii as parseOAuthStatePayload, In as createUserTokenStore, J as getConversationPendingAuth, Li as resolveBaseUrl, Zi as postSlackMessage, d as recordAuthorizationCompleted, it as getTurnRecord, sa as getSlackClient, u as recordAuthenticationLinked } from "./projection-CoeMNxJ4.js";
2
+ import { m as escapeXml } from "./client-B0aAs7wC.js";
3
+ import { a as getRuntimeMetadata, n as botConfig } from "./config-B9f9Lqo5.js";
4
+ import { H as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-CMFhLLj4.js";
5
5
  import { p as parseSlackUserId } from "./actor-6jsm_v96.js";
6
- import { C as getSqlExecutor, U as resolveActorIdentityId, Z as upsertLinkedIdentity, o as readIdentityById, q as findUserByVerifiedEmails } from "./viewer-1Ea81s0b.js";
6
+ import { C as getSqlExecutor, H as resolveActorIdentityId, K as findUserByVerifiedEmails, X as upsertLinkedIdentity, o as readIdentityById } from "./viewer-CH-ASQzh.js";
7
7
  import { i as homeDir } from "./package-discovery-DJhGdS4c.js";
8
- import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-rC7MCxu8.js";
9
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Bte6jRB2.js";
10
- import { t as discoverSkills } from "./skills-B22duVJU.js";
11
- import { d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, y as lookupSlackUserProfile } from "./agent-runner-BsWhHe4N.js";
8
+ import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-u-sFYtx_.js";
9
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-Bym8GVdh.js";
10
+ import { t as discoverSkills } from "./skills-COCqf61f.js";
11
+ import { Mt as deleteWebAuthorization, d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, y as lookupSlackUserProfile } from "./agent-runner-DGCwOEyL.js";
12
12
  import { r as acquireActiveLock } from "./locks-D-0h111u.js";
13
- import { r as getStateAdapter } from "./adapter-DN5AB4VU.js";
14
- import { _ as getMcpProviderErrorAttributes } from "./service-account-BI5Wgx22.js";
15
- import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-CrFk3K_7.js";
16
- import { c as deleteWebAuthorization, i as readConnectedOAuthTokens, m as wakePausedTurn, p as wakeAuthorizedTurn, u as htmlCallbackResponse } from "./connections-DA4LT9LL.js";
13
+ import { r as getStateAdapter } from "./adapter-JQZaJ-B_.js";
14
+ import { _t as getPersistedThreadState, bt as coerceThreadConversationState } from "./task-runner-xPuQmEot.js";
15
+ import { _ as getMcpProviderErrorAttributes } from "./service-account-CGEqz9wG.js";
16
+ import { d as wakePausedTurn, i as readConnectedOAuthTokens, s as htmlCallbackResponse, u as wakeAuthorizedTurn } from "./connections-CQ7p0aNJ.js";
17
17
  import { n as relayLocalOAuthCallback } from "./oauth-relay-D6xxVywK.js";
18
18
  import path from "node:path";
19
19
  import { createHmac, createSecretKey, timingSafeEqual } from "node:crypto";
@@ -1,4 +1,4 @@
1
- import "./schema-BUviRAs8.js";
1
+ import "./schema-Ih60j59-.js";
2
2
  import * as z from "zod";
3
3
  import "drizzle-orm";
4
4
  import { Destination, Source, locationSchema } from "@sentry/junior-plugin-api";
@@ -99,10 +99,10 @@ interface Conversation {
99
99
  /** Immutable parent Conversation. */
100
100
  parentConversationId?: string;
101
101
  /**
102
- * When a child Conversation was archived for everyone. Only child archive
103
- * and a person's message write it; `upsertConversation` does not.
102
+ * When the Conversation was archived for everyone. Only archive, auto-archive,
103
+ * pin, and a person's message write it; `upsertConversation` does not.
104
104
  */
105
- childArchivedAtMs?: number;
105
+ archivedAtMs?: number;
106
106
  /** Optional provider coordinates associated with this Conversation. */
107
107
  location?: Location;
108
108
  actor?: StoredSlackActor;
@@ -1,7 +1,7 @@
1
- import "./config-DqFnykQT.js";
2
- import { p as logException } from "./logging-BfORLKoq.js";
1
+ import "./config-B9f9Lqo5.js";
2
+ import { p as logException } from "./logging-CMFhLLj4.js";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
- import { getTableColumns, sql } from "drizzle-orm";
4
+ import { sql } from "drizzle-orm";
5
5
  import { bigint, boolean, check, date, doublePrecision, foreignKey, index, integer, jsonb, pgTable, primaryKey, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
6
6
  import { Pool } from "@neondatabase/serverless";
7
7
  import { drizzle } from "drizzle-orm/neon-serverless";
@@ -115,7 +115,8 @@ const juniorConversations = pgTable("junior_conversations", {
115
115
  lastEnqueuedAt: timestamptz("last_enqueued_at"),
116
116
  parentConversationId: text("parent_conversation_id").references(() => juniorConversations.conversationId),
117
117
  kind: text("kind").$type(),
118
- childArchivedAt: timestamptz("child_archived_at"),
118
+ archivedAt: timestamptz("archived_at"),
119
+ legacyChildArchivedAt: timestamptz("child_archived_at"),
119
120
  forkedFromConversationId: text("forked_from_conversation_id").references(() => juniorConversations.conversationId, { onDelete: "set null" }),
120
121
  quickQuestionAt: timestamptz("quick_question_at"),
121
122
  rootConversationId: text("root_conversation_id").references(() => juniorConversations.conversationId),
@@ -131,8 +132,7 @@ const juniorConversations = pgTable("junior_conversations", {
131
132
  executionDurationMs: integer("execution_duration_ms").notNull().default(0),
132
133
  executionUsage: jsonb("execution_usage_json").$type(),
133
134
  metricRunId: text("metric_run_id"),
134
- detailVersion: integer("detail_version").notNull().default(0),
135
- legacyArchivedAt: timestamptz("archived_at")
135
+ detailVersion: integer("detail_version").notNull().default(0)
136
136
  }, (table) => [
137
137
  check("junior_conversations_kind_check", sql`${table.kind} in ('root', 'thread', 'task')`),
138
138
  check("junior_conversations_kind_parent_check", sql`${table.kind} is null or ((${table.kind} = 'root') = (${table.parentConversationId} is null))`),
@@ -144,11 +144,6 @@ const juniorConversations = pgTable("junior_conversations", {
144
144
  index("junior_conversations_forked_from_idx").on(table.forkedFromConversationId),
145
145
  index("junior_conversations_root_idx").on(table.rootConversationId)
146
146
  ]);
147
- /** Select runtime conversation fields without reading the legacy archive column. */
148
- function conversationReadColumns() {
149
- const { legacyArchivedAt, ...columns } = getTableColumns(juniorConversations);
150
- return columns;
151
- }
152
147
  // src/db/schema/attachments.ts
153
148
  /** Durable metadata for files owned by one conversation. */
154
149
  const juniorAttachments = pgTable("junior_attachments", {
@@ -377,12 +372,12 @@ const juniorConversationParticipants = pgTable("junior_conversation_participants
377
372
  userId: text("user_id").notNull().references(() => juniorUsers.id),
378
373
  rootConversationId: text("root_conversation_id").notNull().references(() => juniorConversations.conversationId),
379
374
  lastMessageAt: timestamptz("last_message_at").notNull(),
380
- archivedAt: timestamptz("archived_at"),
375
+ legacyArchivedAt: timestamptz("archived_at"),
381
376
  pinnedAt: timestamptz("pinned_at"),
382
377
  /**
383
378
  * The viewer's place for this pin in the Pinned section, from a drag
384
- * reorder. Null until the first reorder, and cleared on unpin, re-pin,
385
- * and archive. Null pins sort first, by activity.
379
+ * reorder. Null until the first reorder, and cleared on unpin and
380
+ * re-pin. Null pins sort first, by activity.
386
381
  */
387
382
  pinPosition: integer("pin_position"),
388
383
  /**
@@ -397,8 +392,7 @@ const juniorConversationParticipants = pgTable("junior_conversation_participants
397
392
  }),
398
393
  index("junior_conversation_participants_user_activity_idx").on(table.userId, table.lastMessageAt.desc()),
399
394
  index("junior_conversation_participants_root_idx").on(table.rootConversationId),
400
- index("junior_conversation_participants_auto_archive_idx").on(table.userId).where(sql`${table.autoArchive} and ${table.archivedAt} is null`),
401
- index("junior_conversation_participants_unarchived_activity_idx").on(table.userId, table.lastMessageAt, table.rootConversationId).where(sql`${table.archivedAt} is null`)
395
+ index("junior_conversation_participants_auto_archive_idx").on(table.userId).where(sql`${table.autoArchive}`)
402
396
  ]);
403
397
  // src/db/schema/conversation-read-positions.ts
404
398
  /**
@@ -1001,4 +995,4 @@ function createJuniorSqlExecutor(args) {
1001
995
  statementTimeoutMs
1002
996
  });
1003
997
  }
1004
- export { conversationReadColumns as A, isUserInstruction as C, juniorCodeChanges as D, juniorConversationAnnotations as E, juniorArtifacts as F, juniorIdentities as M, juniorUsers as N, juniorCodeRepositories as O, juniorDestinations as P, juniorConversationMetrics as S, juniorApiTokens as T, juniorConversationReadPositions as _, juniorPushSubscriptions as a, juniorConversationBriefs as b, juniorReviewItemSlackCards as c, juniorAutomationVersions as d, juniorAutomations as f, juniorAgentInvocations as g, juniorAgentBindings as h, juniorWorkspaces as i, juniorConversations as j, juniorAttachments as k, juniorReviewItems as l, juniorLocationConfigurations as m, juniorSnapshots as n, juniorReviewItemAssignees as o, juniorStats as p, juniorWorkspaceRepos as r, juniorReviewItemConversations as s, createJuniorSqlExecutor as t, juniorAutomationRuns as u, juniorConversationParticipants as v, juniorConversationEvents as w, CONVERSATION_METRICS as x, juniorConversationBindings as y };
998
+ export { juniorConversations as A, isUserInstruction as C, juniorCodeChanges as D, juniorConversationAnnotations as E, juniorUsers as M, juniorDestinations as N, juniorCodeRepositories as O, juniorArtifacts as P, juniorConversationMetrics as S, juniorApiTokens as T, juniorConversationReadPositions as _, juniorPushSubscriptions as a, juniorConversationBriefs as b, juniorReviewItemSlackCards as c, juniorAutomationVersions as d, juniorAutomations as f, juniorAgentInvocations as g, juniorAgentBindings as h, juniorWorkspaces as i, juniorIdentities as j, juniorAttachments as k, juniorReviewItems as l, juniorLocationConfigurations as m, juniorSnapshots as n, juniorReviewItemAssignees as o, juniorStats as p, juniorWorkspaceRepos as r, juniorReviewItemConversations as s, createJuniorSqlExecutor as t, juniorAutomationRuns as u, juniorConversationParticipants as v, juniorConversationEvents as w, CONVERSATION_METRICS as x, juniorConversationBindings as y };
@@ -1,6 +1,6 @@
1
1
  import { a as getClient, c as init, i as getActiveSpan, o as getGlobalScope, p as spanToJSON, s as getTraceData } from "./sentry-BRTJqumy.js";
2
- import { R as getDeploymentServiceVersion, z as getDeploymentTelemetryAttributes } from "./logging-BfORLKoq.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-D0j_h70R.js";
2
+ import { R as getDeploymentServiceVersion, z as getDeploymentTelemetryAttributes } from "./logging-CMFhLLj4.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-Cd_nZZBM.js";
4
4
  import { n as redactSandboxEgressProxyPath } from "./proxy-path-BHYoKZdq.js";
5
5
  import { t as consumePrivateTraceResultMarker } from "./private-trace-result-CE7_lEdq.js";
6
6
  import { n as promoteHttpRouteName, r as routeNameMiddleware, t as nameRequestRoute } from "./sentry-route-name-BhwWnfqj.js";
@@ -1,5 +1,5 @@
1
1
  import { _ as withScope, d as setTag, f as setUser, h as startSpan, i as getActiveSpan, l as logger, n as captureMessage, p as spanToJSON, s as getTraceData, t as captureException } from "./sentry-BRTJqumy.js";
2
- import { t as JUNIOR_VERSION } from "./version-DSk8CFvA.js";
2
+ import { t as JUNIOR_VERSION } from "./version-BTIz7fGi.js";
3
3
  import path from "node:path";
4
4
  import { styleText } from "node:util";
5
5
  import { ConfigError, configureSync, getConfig, getLogger } from "@logtape/logtape";
@@ -274,7 +274,7 @@ const messagesSummarizedEventDataSchema = z.object({
274
274
  createdAtMs: z.number(),
275
275
  id: z.string().min(1),
276
276
  summary: z.string()
277
- }).strict())
277
+ }).strict()).optional()
278
278
  }).strict();
279
279
  /** Product surface that owns a durable conversation turn. */
280
280
  const conversationTurnSurfaceSchema = z.enum([
@@ -315,7 +315,9 @@ const turnStartedEventDataSchema = z.object({
315
315
  type: z.literal("turn_started"),
316
316
  turnId: z.string().min(1),
317
317
  inputMessageIds: z.array(z.string().min(1)).min(1),
318
- surface: conversationTurnSurfaceSchema
318
+ surface: conversationTurnSurfaceSchema,
319
+ /** Highest Message seq known when the Turn built its thread context. */
320
+ threadContextThroughSeq: z.number().int().nonnegative().optional()
319
321
  }).strict().refine((data) => new Set(data.inputMessageIds).size === data.inputMessageIds.length, "turn input message ids must be unique");
320
322
  const legacyTurnRoutedEventDataSchema = z.object({
321
323
  type: z.literal("turn_routed"),
@@ -357,6 +359,14 @@ const attachmentsDeliveredEventDataSchema = z.object({
357
359
  toolCallId: z.string().min(1).optional(),
358
360
  turnId: z.string().min(1).optional()
359
361
  }).strict();
362
+ /** Host-owned transcript item for a reply that a plugin tool posted. */
363
+ const replyPostedEventDataSchema = z.object({
364
+ type: z.literal("reply_posted"),
365
+ plugin: z.string().min(1),
366
+ text: z.string().min(1),
367
+ url: z.string().url().optional(),
368
+ toolCallId: z.string().min(1)
369
+ }).strict();
360
370
  const turnCompletedEventDataSchema = z.object({
361
371
  type: z.literal("turn_completed"),
362
372
  turnId: z.string().min(1),
@@ -428,6 +438,7 @@ const appendableConversationEventDataSchema = z.union([
428
438
  turnContextEventDataSchema,
429
439
  structuredConversationEventDataSchema,
430
440
  attachmentsDeliveredEventDataSchema,
441
+ replyPostedEventDataSchema,
431
442
  turnCompletedEventDataSchema,
432
443
  turnFailedEventDataSchema,
433
444
  subagentStartedEventDataSchema,
@@ -462,6 +473,7 @@ const KNOWN_CONVERSATION_EVENT_TYPES = [
462
473
  "turn_context",
463
474
  "structured_event",
464
475
  "attachments_delivered",
476
+ "reply_posted",
465
477
  "turn_routed",
466
478
  "turn_completed",
467
479
  "turn_failed",
@@ -1,13 +1,13 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { Qa as readConversationAccessFromSql, Xa as canAccessConversation, _n as renderUntrustedTag } from "./projection-DliWYrnT.js";
3
- import { n as botConfig } from "./config-DqFnykQT.js";
4
- import { H as SYSTEM_IDENTITY_ID, S as getDb, x as getConversationStore } from "./viewer-1Ea81s0b.js";
5
- import { Et as AgentMessagePausedError, Ft as actorFromRun, It as toolInvocationDestination, Ot as AgentMessageTargetError } from "./agent-runner-BsWhHe4N.js";
6
- import { i as getActiveAgentInvocationForConversation, x as PARENT_AGENT_TARGET } from "./store-B26LV6UP.js";
7
- import { U as admitAutomatedTurn, b as EVENT_WAIT_MS, z as postAutomatedTurnLimitNoticeForConversation } from "./session-stop-CA-jOJ84.js";
8
- import { r as appendAndEnqueueInboundMessage } from "./store-Dn4W7qgH.js";
9
- import { c as createAgentInvocationForMessage, i as enqueueAgentInvocation, u as findChildAgentConversationId } from "./work-ybG4_q5C.js";
10
- import { r as enqueueAgentMessageToParent } from "./result-DxJMCX47.js";
2
+ import { Qa as canAccessConversation, eo as readConversationAccessFromSql, yn as renderUntrustedTag } from "./projection-CoeMNxJ4.js";
3
+ import { n as botConfig } from "./config-B9f9Lqo5.js";
4
+ import { S as getDb, V as SYSTEM_IDENTITY_ID, x as getConversationStore } from "./viewer-CH-ASQzh.js";
5
+ import { Gt as actorFromRun, It as AgentMessagePausedError, Kt as toolInvocationDestination, Rt as AgentMessageTargetError } from "./agent-runner-DGCwOEyL.js";
6
+ import { F as PARENT_AGENT_TARGET, v as getActiveAgentInvocationForConversation } from "./turn-failure-response-BOviBdT-.js";
7
+ import { G as admitAutomatedTurn, S as EVENT_WAIT_MS, V as postAutomatedTurnLimitNoticeForConversation } from "./session-stop-CGz5DByb.js";
8
+ import { r as appendAndEnqueueInboundMessage } from "./store-D0-8plWp.js";
9
+ import { a as enqueueAgentInvocation, c as createAgentInvocationForMessage, u as findChildAgentConversationId } from "./work-C75_IM5e.js";
10
+ import { r as enqueueAgentMessageToParent } from "./result-CescSwAw.js";
11
11
  // src/chat/agent-invocations/top-level-message.ts
12
12
  const AGENT_MESSAGE_EVENT_NAMESPACE = "junior";
13
13
  /** Event type of a message from another top-level agent. */
package/dist/nitro.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as JuniorDashboardOptions } from "./app-DyMs9330.js";
1
+ import { i as JuniorDashboardOptions } from "./app-BKq0JzWx.js";
2
2
  import { n as JuniorPluginSet } from "./plugins-DtmjkTza.js";
3
3
  import { withSentryConfig as withSentryConfig$1 } from "@sentry/nitro";
4
4
  type SentryNitroConfig = Parameters<typeof withSentryConfig$1>[0];
package/dist/nitro.js CHANGED
@@ -1,8 +1,7 @@
1
- import { A as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_ROUTE, I as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_ROUTE, N as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_RETENTION_CRON_SCHEDULE, R as getDeploymentServiceVersion, j as JUNIOR_HEARTBEAT_CRON_SCHEDULE, k as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE } from "./logging-BfORLKoq.js";
1
+ import { A as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_ROUTE, I as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_ROUTE, N as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_RETENTION_CRON_SCHEDULE, R as getDeploymentServiceVersion, j as JUNIOR_HEARTBEAT_CRON_SCHEDULE, k as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE } from "./logging-CMFhLLj4.js";
2
2
  import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-DJhGdS4c.js";
3
- import { a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, u as resolveConversationWorkQueueTopic } from "./background-compaction-queue-DXkLsWoH.js";
3
+ import { a as PLUGIN_TASK_QUEUE_TOPIC, p as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, v as resolveConversationWorkQueueTopic } from "./background-compaction-queue-Btu2oab_.js";
4
4
  import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-HYh_JOdw.js";
5
- import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-Bt0IoR2i.js";
6
5
  import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cf5gVPWP.js";
7
6
  import path from "node:path";
8
7
  import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
@@ -1,5 +1,5 @@
1
- import { Pn as createUserTokenStore } from "./projection-DliWYrnT.js";
2
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-hcsYatw-.js";
1
+ import { In as createUserTokenStore } from "./projection-CoeMNxJ4.js";
2
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-DmiJi_At.js";
3
3
  import { createServer } from "node:http";
4
4
  // src/chat/local/oauth-callback-server.ts
5
5
  const LOCAL_OAUTH_TIMEOUT_MS = 6e5;