@sentry/junior 0.302.0 → 0.304.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 (100) hide show
  1. package/dist/{adapter-context-Cx9fn9B3.js → adapter-context-B1IpoELr.js} +2 -2
  2. package/dist/{admin-_poE5NKL.js → admin-BnVFGo_z.js} +5 -5
  3. package/dist/{agent-runner-CY9RvsTX.js → agent-runner-CoEeZSRh.js} +1461 -1248
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +6 -6
  6. package/dist/api.d.ts +13 -12
  7. package/dist/api.js +230 -105
  8. package/dist/{app-BpY3wtRP.d.ts → app-Cs157Zc5.d.ts} +17 -15
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +108 -96
  11. package/dist/{automation-Cva5ZOwW.js → automation-CuA3yEcD.js} +3 -1
  12. package/dist/{background-compaction-queue-CXFq1_Cz.js → background-compaction-queue-WLPNSF_b.js} +6 -6
  13. package/dist/{briefs-B3NG-pid.js → briefs-CagVVefw.js} +12 -9
  14. package/dist/{catalog-runtime-Dss0lSV6.js → catalog-runtime-B8ZXvXWm.js} +2 -2
  15. package/dist/cli/chat.d.ts +1 -1
  16. package/dist/cli/chat.js +21 -21
  17. package/dist/cli/check.js +10 -10
  18. package/dist/cli/env.d.ts +1 -0
  19. package/dist/cli/env.js +8 -7
  20. package/dist/cli/init.js +13 -4
  21. package/dist/cli/main.js +4 -4
  22. package/dist/cli/plugins.js +6 -6
  23. package/dist/cli/snapshot-create.js +7 -5
  24. package/dist/cli/upgrade.d.ts +2 -2
  25. package/dist/cli/upgrade.js +6 -6
  26. package/dist/{config-CzeZiMKs.js → config-DdO1BNcw.js} +142 -67
  27. package/dist/{connections-CDYhMfrs.js → connections-D20kp0j5.js} +6 -6
  28. package/dist/{continue-in-slack-7Uf05ndC.js → continue-in-slack-BKEVMBj1.js} +8 -8
  29. package/dist/{conversation-BNXfq6Lb.js → conversation-BOqdRtUx.js} +4 -12
  30. package/dist/{conversation-feed-Clf_cv0n.js → conversation-feed-CgpgP7yi.js} +35 -2
  31. package/dist/{conversation-privacy-D9xnM5mK.js → conversation-privacy-L1SK_v0V.js} +16 -8
  32. package/dist/{conversation-turn-D7SEZgTG.js → conversation-turn-BptVJylj.js} +20 -23
  33. package/dist/{credential-sync-DoD0gW-j.js → credential-sync-D1J1CGzL.js} +19 -19
  34. package/dist/{db-B-gtnNjr.js → db-EKJnkrIb.js} +180 -17
  35. package/dist/{db-BdsCzytP.d.ts → db-zbN5ZV_o.d.ts} +26 -26
  36. package/dist/{executor-DZg20EqU.js → executor-CoIZmFK8.js} +55 -15
  37. package/dist/{history-IjdmO_r6.js → history-m2-ceTTX.js} +21 -12
  38. package/dist/{install-t1KQyTUs.js → install-BT2Pf6HP.js} +3 -3
  39. package/dist/instrumentation.d.ts +4 -4
  40. package/dist/instrumentation.js +15 -11
  41. package/dist/{lineage-C79GjoQr.js → lineage-C5DGQCS_.js} +2 -2
  42. package/dist/{logging-C9oDAg4M.js → logging-QSZuMcvo.js} +19 -19
  43. package/dist/{message-BLUCzJXN.js → message-TtxftRHj.js} +9 -9
  44. package/dist/{model-input-5jwNC45G.js → model-input-BHXfA29g.js} +4 -9
  45. package/dist/nitro.d.ts +1 -1
  46. package/dist/nitro.js +8 -8
  47. package/dist/{oauth-callback-server-BBl66vCb.js → oauth-callback-server-B0enqHtZ.js} +5 -4
  48. package/dist/{oauth-relay-DRzq73b6.js → oauth-relay-DAmfVmJu.js} +3 -6
  49. package/dist/{package-discovery-DJhGdS4c.js → package-discovery-x4AvVhMj.js} +1 -1
  50. package/dist/{plugin-module-Cf5gVPWP.js → plugin-module-Cv2ETe8Y.js} +1 -1
  51. package/dist/{plugins-BBX07Jzt.js → plugins-Bkk0XRo2.js} +3 -3
  52. package/dist/{projection-CIBwgD3s.js → projection-CNKK7doO.js} +755 -221
  53. package/dist/{prompt-CRQbzp5e.js → prompt-DSjhoKu5.js} +185 -12
  54. package/dist/{queue-DtCDaIct.js → queue-CDxkit82.js} +4 -4
  55. package/dist/{queue-CZyYgPF0.d.ts → queue-CbEHUO0l.d.ts} +1 -1
  56. package/dist/{registry-DdFQHZ_d.js → registry-DBDNUUmz.js} +37 -37
  57. package/dist/{resolve-CdW4BdrK.js → resolve-CQLhMWSu.js} +3 -3
  58. package/dist/{result-oOMv1t4O.js → result-B-pauj42.js} +10 -15
  59. package/dist/rolldown-runtime-BKpuH2hG.js +26 -0
  60. package/dist/{runner-DqitLtm-.js → runner-B3KxKks5.js} +10 -10
  61. package/dist/{sandbox-egress-signals-Bw9I0yfJ.js → sandbox-egress-signals-DJJX9ClG.js} +1 -1
  62. package/dist/{schema-DnVQepWP.js → schema-Bx0Mlo32.js} +77 -13
  63. package/dist/{schema-BIFM-U1a.d.ts → schema-CKcu-IK6.d.ts} +562 -23
  64. package/dist/{secrets-DebYU866.js → secrets-DHaJ5TTn.js} +4 -4
  65. package/dist/{sentry-BRTJqumy.js → sentry-CPbZjomA.js} +3 -28
  66. package/dist/{sentry-route-name-BhwWnfqj.js → sentry-route-name-C6EIzAGP.js} +1 -1
  67. package/dist/{service-account-CrZftRTb.js → service-account-2HmlNPvy.js} +49 -48
  68. package/dist/{service-account-B6mKAPVo.js → service-account-DQLqkSVv.js} +5 -5
  69. package/dist/{session-stop-DW63Z3kj.js → session-stop-DEeZKqbX.js} +132 -74
  70. package/dist/{skills-C16fz60Z.js → skills-2UrD7JkN.js} +6 -9
  71. package/dist/{slack-conversation-unfurl-BHhefEb7.js → slack-conversation-unfurl-Dd129Uov.js} +14 -18
  72. package/dist/{spawn-D_RnFYfy.js → spawn-eMho9HDJ.js} +7 -7
  73. package/dist/{legacy-web-actor-id-C-cEeWqL.js → state-Bveuc4Zh.js} +32 -32
  74. package/dist/{stop-7p1i08CY.js → stop-D_ltJLDS.js} +359 -171
  75. package/dist/{store-C28I0CVW.js → store-COeYnPL_.js} +5 -5
  76. package/dist/{task-queue-BVUJbQ28.js → task-queue-CBIDXZpV.js} +3 -3
  77. package/dist/{task-runner-CWi8j7Z6.js → task-runner-CJF7zIJL.js} +15 -18
  78. package/dist/{thread-context-D3-yYUd0.js → thread-context-Cg0jt0aE.js} +12 -12
  79. package/dist/{turn-session-routing-BFMS9ATF.js → turn-session-routing-CaY3Tp8m.js} +32 -32
  80. package/dist/{turn-user-message-C3-O8Omt.js → turn-user-message-tcom1RYd.js} +3 -3
  81. package/dist/{validation-BSFKUIb4.js → validation-EU91JwIT.js} +2 -2
  82. package/dist/vercel.js +1 -1
  83. package/dist/{version-BHHXNi-0.js → version-BYRPhY5G.js} +1 -1
  84. package/dist/version.js +1 -1
  85. package/dist/{viewer-B1SO21Qa.js → viewer-Cf8ISkAc.js} +3 -3
  86. package/dist/{warmup-Bz9bzkzN.js → warmup-TgY4S1vx.js} +202 -577
  87. package/dist/{worker-BspReIIK.js → worker-C6Uq4OKD.js} +9 -12
  88. package/migrations/0109_user_preferences.sql +1 -0
  89. package/migrations/0110_code_change_repository_state_index.sql +1 -0
  90. package/migrations/0111_attachment_kinds.sql +14 -0
  91. package/migrations/0112_attachment_url_fill.sql +51 -0
  92. package/migrations/0113_attachment_url_index.sql +1 -0
  93. package/migrations/meta/0099_snapshot.json +102 -326
  94. package/migrations/meta/0109_snapshot.json +4925 -0
  95. package/migrations/meta/0110_snapshot.json +4952 -0
  96. package/migrations/meta/0111_snapshot.json +5011 -0
  97. package/migrations/meta/0112_snapshot.json +5011 -0
  98. package/migrations/meta/0113_snapshot.json +5033 -0
  99. package/migrations/meta/_journal.json +36 -1
  100. package/package.json +16 -19
@@ -1,21 +1,22 @@
1
- import { i as getActiveSpan, r as continueTrace, v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { A as latestConversationMessageSeq, Di as verifyTimerWatchCredentialSubject, I as upsertConversationMessage, M as normalizeConversationText, N as recordDeliveredAssistantMessage, a as loadProjection, at as failTurnRecord, b as persistConversationMessages, bn as persistWithRetry, j as markConversationMessage, nt as saveTurnCheckpoint, st as getTurnRecord, t as commitAcceptedReply, un as getAssistantReplyText, v as hydrateConversationMessages } from "./projection-CIBwgD3s.js";
3
- import { n as botConfig } from "./config-CzeZiMKs.js";
4
- import { E as withSpan, S as setTags, h as logWarn, p as logException } from "./logging-C9oDAg4M.js";
5
- import { C as isPersonInput, D as turnBehavior, a as getConversationStore, ft as nextDetailVersion, o as getDb, r as getConversationEventStore, s as getSqlExecutor, w as isTopLevelKind } from "./db-B-gtnNjr.js";
6
- import { M as juniorConversations } from "./executor-DZg20EqU.js";
7
- import { p as instructionProvenanceFor } from "./history-IjdmO_r6.js";
8
- import { f as credentialContextForActor } from "./registry-DdFQHZ_d.js";
9
- import { i as measureTurnCompactionWait } from "./agent-runner-CY9RvsTX.js";
10
- import { o as isEventConversationMessage } from "./prompt-CRQbzp5e.js";
11
- import { Y as readMessageAttachments } from "./conversation-BNXfq6Lb.js";
12
- import { D as turnInputFactsFromConversationMessage, E as sourceFromTurnInput, I as maybePostAutomatedTurnLimitNotice, M as isEventMailboxMetadata, N as renderEventBatchInputs, O as legacyWebMailboxMetadataSchema, P as timerWatchCredentialSubject, U as recordFinishedTurnForAutomatedLimit, c as loadReviewItemInput, f as buildSteeringPiMessage, g as withoutSavedSteeringMessages, j as eventBatchMessageMeta, m as instructionForInputs, p as instructionActorFor, s as eventReviewItemInputs, x as getEventBatchDelayMs } from "./session-stop-DW63Z3kj.js";
13
- import { An as supersedeOpenMailboxTurns, Gn as executeTurn, Tt as resolveConversationDestination, Vn as createWebAuthorization, Wn as AgentRunError, an as childAgentTurnOptions, bn as completeCancelledConversationTurn, ln as readParentMessage, on as isParentMessageMeta } from "./warmup-Bz9bzkzN.js";
14
- import { B as blockScheduledAutomation, E as notifyAutomationBlocked, X as blockEventAutomation, a as getPersistedThreadState, c as coerceThreadConversationState, g as getDispatchRecord, i as getPersistedSandboxState, k as readAutomationExecutionByConversationId, m as getDispatchIdForConversation, s as persistThreadStateById } from "./turn-session-routing-BFMS9ATF.js";
15
- import { R as buildDeterministicTurnId, _ as ConversationTurnLifecycleService, d as isTurnInputCommitLostError, g as startActiveTurn, h as markTurnFailed, l as getConversationTurnBoundaryError, s as TurnInputCommitLostError, t as getTurnUserMessage } from "./turn-user-message-C3-O8Omt.js";
16
- import { t as readConversationLineage } from "./lineage-C79GjoQr.js";
17
- import { c as buildDeliveredTurnStatePatch, l as loadPendingMessageCards, o as completeAuthPauseTurn, r as finalizeFailedTurnReplyWithEvent, t as buildTurnThreadContext } from "./thread-context-D3-yYUd0.js";
18
- import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-CWi8j7Z6.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
+ import { B as blockScheduledAutomation, E as notifyAutomationBlocked, X as blockEventAutomation, a as getPersistedThreadState, c as coerceThreadConversationState, g as getDispatchRecord, i as getPersistedSandboxState, k as readAutomationExecutionByConversationId, m as getDispatchIdForConversation, s as persistThreadStateById } from "./turn-session-routing-CaY3Tp8m.js";
3
+ import { E as isTopLevelKind, T as isPersonInput, a as getConversationStore, k as turnBehavior, mt as nextDetailVersion, o as getDb, r as getConversationEventStore, s as getSqlExecutor } from "./db-EKJnkrIb.js";
4
+ import { E as withSpan, S as setTags, h as logWarn, p as logException } from "./logging-QSZuMcvo.js";
5
+ import { J as readMessageAttachments } from "./conversation-BOqdRtUx.js";
6
+ import { N as juniorConversations } from "./executor-CoIZmFK8.js";
7
+ import { c as buildDeliveredTurnStatePatch, l as loadPendingMessageCards, o as completeAuthPauseTurn, r as finalizeFailedTurnReplyWithEvent, t as buildTurnThreadContext } from "./thread-context-Cg0jt0aE.js";
8
+ import { Hn as AgentRunError, On as supersedeOpenMailboxTurns, Ot as resolveConversationDestination, Un as executeTurn, in as isParentMessageMeta, rn as childAgentTurnOptions, sn as readParentMessage, vn as completeCancelledConversationTurn, zn as createWebAuthorization } from "./warmup-TgY4S1vx.js";
9
+ import { A as latestConversationMessageSeq, Di as verifyTimerWatchCredentialSubject, I as upsertConversationMessage, M as normalizeConversationText, N as recordDeliveredAssistantMessage, a as loadProjection, at as failTurnRecord, b as persistConversationMessages, bn as persistWithRetry, j as markConversationMessage, nt as saveTurnCheckpoint, st as getTurnRecord, t as commitAcceptedReply, un as getAssistantReplyText, v as hydrateConversationMessages } from "./projection-CNKK7doO.js";
10
+ import { R as buildDeterministicTurnId, _ as ConversationTurnLifecycleService, d as isTurnInputCommitLostError, g as startActiveTurn, h as markTurnFailed, l as getConversationTurnBoundaryError, s as TurnInputCommitLostError, t as getTurnUserMessage } from "./turn-user-message-tcom1RYd.js";
11
+ import { f as credentialContextForActor } from "./registry-DBDNUUmz.js";
12
+ import { i as getActiveSpan, r as continueTrace } from "./sentry-CPbZjomA.js";
13
+ import { i as measureTurnCompactionWait } from "./agent-runner-CoEeZSRh.js";
14
+ import { n as botConfig } from "./config-DdO1BNcw.js";
15
+ import { D as turnInputFactsFromConversationMessage, E as sourceFromTurnInput, I as maybePostAutomatedTurnLimitNotice, M as isEventMailboxMetadata, N as renderEventBatchInputs, O as legacyWebMailboxMetadataSchema, P as timerWatchCredentialSubject, U as recordFinishedTurnForAutomatedLimit, c as loadReviewItemInput, f as buildSteeringPiMessage, g as withoutSavedSteeringMessages, j as eventBatchMessageMeta, m as instructionForInputs, p as instructionActorFor, s as eventReviewItemInputs, x as getEventBatchDelayMs } from "./session-stop-DEeZKqbX.js";
16
+ import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-CJF7zIJL.js";
17
+ import { p as instructionProvenanceFor } from "./history-m2-ceTTX.js";
18
+ import { o as isEventConversationMessage } from "./prompt-DSjhoKu5.js";
19
+ import { t as readConversationLineage } from "./lineage-C5DGQCS_.js";
19
20
  import { isDeepStrictEqual } from "node:util";
20
21
  import { createHash } from "node:crypto";
21
22
  import { and, eq, isNotNull, isNull } from "drizzle-orm";
@@ -146,7 +147,6 @@ async function commitAssistantMessage(args) {
146
147
  const conversationMessageId = recordDeliveredAssistantMessage({
147
148
  cards: args.cards,
148
149
  conversation: args.conversation,
149
- ...args.quiet ? { quiet: args.quiet } : void 0,
150
150
  sessionId: args.sessionId,
151
151
  source: args.source,
152
152
  text: args.text,
@@ -531,9 +531,8 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
531
531
  if (!replyText?.trim()) return;
532
532
  failureCode = "delivery_failed";
533
533
  const cards = await loadPendingMessageCards(context.conversationId);
534
- const quiet = options?.quiet === true && isEventTurn && cards.length === 0;
535
534
  let deliveryResult;
536
- if ((options?.reply ? postsToProvider : deliverToProvider) && !quiet && !await isConversationDeliveryPaused(context.conversationId)) {
535
+ if ((options?.reply ? postsToProvider : deliverToProvider) && !await isConversationDeliveryPaused(context.conversationId)) {
537
536
  if (!conversationLocation || !deliverMessage) throw new Error(`Conversation ${context.conversationId} cannot deliver to its Location`);
538
537
  deliveryResult = await deliverMessage({
539
538
  cards,
@@ -548,7 +547,6 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
548
547
  conversation,
549
548
  conversationId: context.conversationId,
550
549
  ...deliveryResult ? { deliveryResult } : void 0,
551
- ...quiet ? { quiet } : void 0,
552
550
  sessionId: turnId,
553
551
  ...deliveryResult ? { source: "slack" } : source.kind === "web" ? { source: "web" } : void 0,
554
552
  text: replyText,
@@ -667,7 +665,6 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
667
665
  text: reply.blocked.missing
668
666
  });
669
667
  else if (reply.blocked) await blockRunAutomation(context.conversationId, reply.blocked);
670
- else if (reply.noReply?.note && isEventTurn) await deliverAssistantMessage(reply.noReply.note, { quiet: true });
671
668
  const completedState = buildDeliveredTurnStatePatch({
672
669
  conversation,
673
670
  reply,
@@ -1,20 +1,20 @@
1
- import { $n as resolvePluginOAuthAccount, Da as postSlackMessage, Xo as getSlackClient, Z as getConversationPendingAuth, Zn as createUserTokenStore, ca as formatProviderLabel, d as recordAuthorizationCompleted, la as parseOAuthStatePayload, st as getTurnRecord, u as recordAuthenticationLinked, ua as resolveBaseUrl } from "./projection-CIBwgD3s.js";
2
- import { R as escapeXml, a as getRuntimeMetadata, n as botConfig } from "./config-CzeZiMKs.js";
3
- import { W as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-C9oDAg4M.js";
1
+ import { Da as postSlackMessage, Yn as createUserTokenStore, Z as getConversationPendingAuth, Zn as resolvePluginOAuthAccount, ca as formatProviderLabel, d as recordAuthorizationCompleted, is as getSlackClient, la as parseOAuthStatePayload, st as getTurnRecord, u as recordAuthenticationLinked, ua as resolveBaseUrl } from "./projection-CNKK7doO.js";
2
+ import { V as escapeXml, a as getRuntimeMetadata, n as botConfig } from "./config-DdO1BNcw.js";
3
+ import { W as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-QSZuMcvo.js";
4
4
  import { p as parseSlackUserId } from "./actor-D2iXzvlN.js";
5
- import { H as upsertLinkedIdentity, J as getStateAdapter, P as resolveActorIdentityId, Q as acquireActiveLock, R as findUserByVerifiedEmails, s as getSqlExecutor } from "./db-B-gtnNjr.js";
6
- import { i as homeDir } from "./package-discovery-DJhGdS4c.js";
7
- import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-DdFQHZ_d.js";
8
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Dss0lSV6.js";
9
- import { t as discoverSkills } from "./skills-C16fz60Z.js";
10
- import { o as finalizeMcpAuthorization } from "./agent-runner-CY9RvsTX.js";
11
- import { o as readIdentityById } from "./viewer-B1SO21Qa.js";
12
- import { t as readJuniorSecret } from "./secrets-DebYU866.js";
13
- import { Fn as wakePausedTurn, Hn as deleteWebAuthorization, I as lookupSlackUserProfile, Pn as wakeAuthorizedTurn } from "./warmup-Bz9bzkzN.js";
14
- import { a as getPersistedThreadState, c as coerceThreadConversationState } from "./turn-session-routing-BFMS9ATF.js";
15
- import { O as getMcpProviderErrorAttributes, S as putMcpStoredOAuthCredentials, f as deleteMcpAuthSession, g as getMcpAuthSession, v as getMcpStoredOAuthCredentials } from "./service-account-CrZftRTb.js";
16
- import { i as readConnectedOAuthTokens, s as htmlCallbackResponse } from "./connections-CDYhMfrs.js";
17
- import { n as relayLocalOAuthCallback } from "./oauth-relay-DRzq73b6.js";
5
+ import { B as findUserByVerifiedEmails, I as resolveActorIdentityId, W as upsertLinkedIdentity, X as getStateAdapter, et as acquireActiveLock, s as getSqlExecutor } from "./db-EKJnkrIb.js";
6
+ import { i as homeDir } from "./package-discovery-x4AvVhMj.js";
7
+ import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-DBDNUUmz.js";
8
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-B8ZXvXWm.js";
9
+ import { t as discoverSkills } from "./skills-2UrD7JkN.js";
10
+ import { o as finalizeMcpAuthorization } from "./agent-runner-CoEeZSRh.js";
11
+ import { O as getMcpProviderErrorAttributes, S as putMcpStoredOAuthCredentials, f as deleteMcpAuthSession, g as getMcpAuthSession, v as getMcpStoredOAuthCredentials } from "./service-account-2HmlNPvy.js";
12
+ import { o as readIdentityById } from "./viewer-Cf8ISkAc.js";
13
+ import { t as readJuniorSecret } from "./secrets-DHaJ5TTn.js";
14
+ import { Bn as deleteWebAuthorization, L as lookupSlackUserProfile, Mn as wakeAuthorizedTurn, Nn as wakePausedTurn } from "./warmup-TgY4S1vx.js";
15
+ import { a as getPersistedThreadState, c as coerceThreadConversationState } from "./turn-session-routing-CaY3Tp8m.js";
16
+ import { i as readConnectedOAuthTokens, s as htmlCallbackResponse } from "./connections-D20kp0j5.js";
17
+ import { n as relayLocalOAuthCallback } from "./oauth-relay-DAmfVmJu.js";
18
18
  import * as z from "zod";
19
19
  import path from "node:path";
20
20
  import { createHmac, createSecretKey, timingSafeEqual } from "node:crypto";
@@ -432,7 +432,7 @@ async function linkOAuthAccountIdentity(args) {
432
432
  const actorUserId = await resolveOAuthActorUserId(args.actor);
433
433
  const emailMatch = await findUserByVerifiedEmails(executor, args.verifiedEmails);
434
434
  const userId = actorUserId ?? emailMatch?.userId;
435
- if (!userId) throw new Error("OAuth account has no Junior user to link");
435
+ if (!userId) throw new Error("OAuth account has no User to link");
436
436
  const email = emailMatch?.userId === userId ? emailMatch.email : void 0;
437
437
  await upsertLinkedIdentity(executor, userId, {
438
438
  kind: "user",
@@ -661,7 +661,7 @@ async function syncLocalOAuthCredential(provider, tokens) {
661
661
  provider,
662
662
  tokens
663
663
  });
664
- const port = process.env.PORT?.trim() || "3000";
664
+ const port = process.env["PORT"]?.trim() || "3000";
665
665
  const response = await fetch(`http://127.0.0.1:${port}/api/internal/local-oauth-credentials`, {
666
666
  method: "POST",
667
667
  headers: {
@@ -675,7 +675,7 @@ async function syncLocalOAuthCredential(provider, tokens) {
675
675
  /** Verify and store one credential sent by the local CLI over loopback. */
676
676
  async function receiveLocalOAuthCredential(request) {
677
677
  const hostname = new URL(request.url).hostname;
678
- if (process.env.NODE_ENV !== "development" || hostname !== "127.0.0.1" && hostname !== "localhost") return new Response(null, { status: 404 });
678
+ if (process.env["NODE_ENV"] !== "development" || hostname !== "127.0.0.1" && hostname !== "localhost") return new Response(null, { status: 404 });
679
679
  const body = await request.text();
680
680
  const actualSignature = request.headers.get("x-junior-local-credential-signature");
681
681
  if (!actualSignature || !signaturesMatch(signature(body), actualSignature)) return Response.json({ error: "Unauthorized" }, { status: 401 });
@@ -1,11 +1,11 @@
1
- import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { i as getChatConfig } from "./config-CzeZiMKs.js";
3
- import { G as normalizeIdentityEmail, U as GOOGLE_IDENTITY_PROVIDER, h as logWarn } from "./logging-C9oDAg4M.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
+ import { i as getChatConfig } from "./config-DdO1BNcw.js";
4
3
  import { a as isSlackUserId, d as parseSlackChannelReferenceId, f as parseSlackTeamId, s as parseActorUserId } from "./actor-D2iXzvlN.js";
5
- import { C as juniorConversationMetrics, D as juniorConversationAnnotations, F as juniorDestinations, M as juniorConversations, N as juniorIdentities, P as juniorUsers, S as CONVERSATION_METRICS, T as juniorConversationEvents, t as createJuniorSqlExecutor, v as juniorConversationParticipants, w as isUserInstruction, y as juniorConversationBindings } from "./executor-DZg20EqU.js";
6
- import { c as newConversationEventSchema, h as usageSchema, l as encodeHistoryPayload, o as decodeStoredConversationEvent, r as conversationEventDataSchema, s as historyReplacementSchema } from "./history-IjdmO_r6.js";
4
+ import { C as juniorConversationMetrics, D as juniorConversationAnnotations, F as juniorUsers, I as juniorDestinations, M as juniorMessageAttachments, N as juniorConversations, P as juniorIdentities, S as CONVERSATION_METRICS, T as juniorConversationEvents, j as juniorAttachments, t as createJuniorSqlExecutor, v as juniorConversationParticipants, w as isUserInstruction, y as juniorConversationBindings } from "./executor-CoIZmFK8.js";
5
+ import { c as newConversationEventSchema, h as usageSchema, l as encodeHistoryPayload, o as decodeStoredConversationEvent, r as conversationEventDataSchema, s as historyReplacementSchema } from "./history-m2-ceTTX.js";
6
+ import { G as normalizeIdentityEmail, U as GOOGLE_IDENTITY_PROVIDER, h as logWarn } from "./logging-QSZuMcvo.js";
7
7
  import * as z from "zod";
8
- import { randomUUID } from "node:crypto";
8
+ import { createHash, randomUUID } from "node:crypto";
9
9
  import { and, asc, desc, eq, gt, gte, inArray, isNull, lt, lte, ne, or, sql } from "drizzle-orm";
10
10
  import { destinationSchema, locationSchema, sourceSchema } from "@sentry/junior-plugin-api";
11
11
  import { alias } from "drizzle-orm/pg-core";
@@ -1937,14 +1937,14 @@ function isRecord(value) {
1937
1937
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
1938
1938
  }
1939
1939
  function readAuthor(meta) {
1940
- if (!isRecord(meta) || !isRecord(meta.author)) return {};
1941
- const author = meta.author;
1940
+ if (!isRecord(meta) || !isRecord(meta["author"])) return {};
1941
+ const author = meta["author"];
1942
1942
  return {
1943
- ...typeof author.email === "string" ? { email: author.email } : void 0,
1944
- ...typeof author.fullName === "string" ? { fullName: author.fullName } : void 0,
1945
- ...typeof author.isBot === "boolean" ? { isBot: author.isBot } : void 0,
1946
- ...typeof author.userId === "string" ? { userId: author.userId } : void 0,
1947
- ...typeof author.userName === "string" ? { userName: author.userName } : void 0
1943
+ ...typeof author["email"] === "string" ? { email: author["email"] } : void 0,
1944
+ ...typeof author["fullName"] === "string" ? { fullName: author["fullName"] } : void 0,
1945
+ ...typeof author["isBot"] === "boolean" ? { isBot: author["isBot"] } : void 0,
1946
+ ...typeof author["userId"] === "string" ? { userId: author["userId"] } : void 0,
1947
+ ...typeof author["userName"] === "string" ? { userName: author["userName"] } : void 0
1948
1948
  };
1949
1949
  }
1950
1950
  /** Read the Slack workspace that owns a conversation, when it has one. */
@@ -2136,6 +2136,168 @@ async function restoreArchivedPath(db, conversationId) {
2136
2136
  async function withConversationEventLock(executor, conversationId, callback) {
2137
2137
  return executor.withLock(`junior_conversation:${conversationId}`, callback);
2138
2138
  }
2139
+ // src/chat/conversations/message-links.ts
2140
+ /**
2141
+ * Web link matches in message text. Slack wraps links as <url|label>, and
2142
+ * Markdown as (url), so a match stops at those delimiters. Trailing
2143
+ * punctuation is dropped. Readers parse a link before they show it.
2144
+ *
2145
+ * Migration `0112_attachment_url_fill` runs these patterns in Postgres to
2146
+ * fill links for older messages, so they use only syntax that JavaScript and
2147
+ * Postgres read the same way. The whitespace set is the one that JavaScript
2148
+ * `\s` matches, spelled out, because Postgres `\s` depends on the locale.
2149
+ */
2150
+ const MESSAGE_URL_PATTERN = String.raw`https?://[^\t\n\v\f\r \u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff<>|"'\u0060]+`;
2151
+ const TRAILING_PUNCTUATION_PATTERN = String.raw`[.,;:!?)\]}*_~]+$`;
2152
+ /**
2153
+ * Longest link, in UTF-8 bytes, that a message stores. The unique index on
2154
+ * `(conversation_id, url)` holds the whole link, and a Postgres btree entry
2155
+ * cannot pass about 2.7 kB. Migration `0112_attachment_url_fill` uses the
2156
+ * same limit.
2157
+ */
2158
+ const MAX_LINK_BYTES = 2048;
2159
+ const messageUrlPattern = new RegExp(MESSAGE_URL_PATTERN, "g");
2160
+ const trailingPunctuation = new RegExp(TRAILING_PUNCTUATION_PATTERN);
2161
+ /**
2162
+ * Id of a Conversation's `url` Attachment. A repeat of the link in the
2163
+ * Conversation gets the same id. A link never holds a space, so the space
2164
+ * keeps the two parts apart. Migration `0112_attachment_url_fill` computes
2165
+ * the same id in SQL.
2166
+ */
2167
+ function urlAttachmentId(conversationId, url) {
2168
+ return createHash("sha256").update(`${conversationId} ${url}`).digest("hex");
2169
+ }
2170
+ /**
2171
+ * The links of one stored event payload, first match of each link only. Only
2172
+ * messages count, and a channel message that did not mention Junior stays
2173
+ * out, as in the transcript.
2174
+ */
2175
+ function messageLinks(event) {
2176
+ const { meta, text } = event.payload;
2177
+ if (event.type !== "message" || typeof text !== "string") return [];
2178
+ const mention = meta !== null && typeof meta === "object" && !Array.isArray(meta) && "explicitMention" in meta ? meta.explicitMention : void 0;
2179
+ if (mention === false || mention === "false") return [];
2180
+ const links = /* @__PURE__ */ new Map();
2181
+ let position = 0;
2182
+ for (const match of text.matchAll(messageUrlPattern)) {
2183
+ position += 1;
2184
+ const url = match[0].replace(trailingPunctuation, "");
2185
+ if (links.has(url) || Buffer.byteLength(url) > MAX_LINK_BYTES) continue;
2186
+ links.set(url, {
2187
+ conversationId: event.conversationId,
2188
+ createdAt: event.createdAt,
2189
+ position,
2190
+ seq: event.seq,
2191
+ url
2192
+ });
2193
+ }
2194
+ return [...links.values()];
2195
+ }
2196
+ /**
2197
+ * The links that a batch of new event rows writes. Links keep the seq of the
2198
+ * first save of their message, like the transcript, and an edit replaces
2199
+ * them. `storedMessageSeqs` maps the Message ids that the batch edits to
2200
+ * their stored seqs; `replacedSeqs` names the stored seqs whose links go.
2201
+ */
2202
+ function batchMessageLinks(rows, storedMessageSeqs) {
2203
+ const seqById = new Map(storedMessageSeqs);
2204
+ const linksBySeq = /* @__PURE__ */ new Map();
2205
+ const replacedSeqs = /* @__PURE__ */ new Set();
2206
+ for (const row of rows) {
2207
+ const { messageId } = row.payload;
2208
+ if (row.type === "message") {
2209
+ if (typeof messageId === "string" && !seqById.has(messageId)) seqById.set(messageId, row.seq);
2210
+ linksBySeq.set(row.seq, messageLinks(row));
2211
+ continue;
2212
+ }
2213
+ if (row.type !== "message_updated" || typeof messageId !== "string") continue;
2214
+ const seq = seqById.get(messageId);
2215
+ if (seq === void 0) continue;
2216
+ if (storedMessageSeqs.get(messageId) === seq) replacedSeqs.add(seq);
2217
+ linksBySeq.set(seq, messageLinks({
2218
+ ...row,
2219
+ seq,
2220
+ type: "message"
2221
+ }));
2222
+ }
2223
+ return {
2224
+ links: [...linksBySeq.values()].flat(),
2225
+ replacedSeqs: [...replacedSeqs]
2226
+ };
2227
+ }
2228
+ // src/chat/conversations/sql/message-links.ts
2229
+ /**
2230
+ * The stored seqs of the Messages that new `message_updated` rows edit, so
2231
+ * their links can be replaced. An edit of a Message that is not stored yet
2232
+ * finds no seq here.
2233
+ */
2234
+ async function readEditedMessageSeqs(executor, conversationId, rows) {
2235
+ const messageIds = rows.flatMap(({ payload, type }) => type === "message_updated" && typeof payload["messageId"] === "string" ? [payload["messageId"]] : []);
2236
+ if (messageIds.length === 0) return /* @__PURE__ */ new Map();
2237
+ const e = juniorConversationEvents;
2238
+ const messageId = sql`${e.payload}->>'messageId'`;
2239
+ const stored = await executor.db().select({
2240
+ messageId,
2241
+ seq: e.seq
2242
+ }).from(e).where(and(eq(e.conversationId, conversationId), eq(e.type, "message"), inArray(messageId, messageIds))).orderBy(desc(e.seq));
2243
+ return new Map(stored.map((row) => [row.messageId, row.seq]));
2244
+ }
2245
+ /**
2246
+ * Store the web links of new message events as `url` Attachments of their
2247
+ * Conversation, and where each message uses them. Call it in the transaction
2248
+ * that inserts the events, so a message is never stored without its links.
2249
+ */
2250
+ async function writeMessageLinks(executor, conversationId, rows) {
2251
+ const { links, replacedSeqs } = batchMessageLinks(rows, await readEditedMessageSeqs(executor, conversationId, rows));
2252
+ const db = executor.db();
2253
+ if (replacedSeqs.length > 0) await db.delete(juniorMessageAttachments).where(and(eq(juniorMessageAttachments.conversationId, conversationId), inArray(juniorMessageAttachments.seq, replacedSeqs)));
2254
+ await insertLinks(executor, conversationId, links);
2255
+ }
2256
+ async function insertLinks(executor, conversationId, links) {
2257
+ if (links.length === 0) return;
2258
+ const db = executor.db();
2259
+ const withIds = links.map((link) => ({
2260
+ ...link,
2261
+ attachmentId: urlAttachmentId(conversationId, link.url)
2262
+ }));
2263
+ const attachments = new Map(withIds.map((link) => [link.attachmentId, {
2264
+ conversationId,
2265
+ createdAt: link.createdAt,
2266
+ id: link.attachmentId,
2267
+ kind: "url",
2268
+ url: link.url
2269
+ }]));
2270
+ await db.with(conversationDetailTouch(db, [conversationId])).insert(juniorAttachments).values([...attachments.values()]).onConflictDoNothing({ target: juniorAttachments.id });
2271
+ await db.insert(juniorMessageAttachments).values(withIds.map(({ attachmentId, position, seq }) => ({
2272
+ attachmentId,
2273
+ conversationId,
2274
+ position,
2275
+ seq
2276
+ }))).onConflictDoNothing();
2277
+ }
2278
+ /**
2279
+ * Copy the links of the copied messages into a fork. Copies keep their seq,
2280
+ * and the fork gets its own `url` Attachments.
2281
+ */
2282
+ async function copyMessageLinks(executor, args) {
2283
+ if (args.seqs.length === 0) return;
2284
+ const m = juniorMessageAttachments;
2285
+ const a = juniorAttachments;
2286
+ const links = await executor.db().select({
2287
+ createdAt: a.createdAt,
2288
+ position: m.position,
2289
+ seq: m.seq,
2290
+ url: a.url
2291
+ }).from(m).innerJoin(a, eq(a.id, m.attachmentId)).where(and(eq(m.conversationId, args.sourceConversationId), inArray(m.seq, [...args.seqs]), isNull(a.deleteRequestedAt)));
2292
+ await insertLinks(executor, args.conversationId, links.flatMap(({ url, ...link }) => url === null ? [] : [{
2293
+ ...link,
2294
+ url
2295
+ }]));
2296
+ }
2297
+ /** Delete where purged messages use Attachments, with the messages. */
2298
+ async function deleteMessageLinks(executor, conversationIds) {
2299
+ await executor.db().delete(juniorMessageAttachments).where(inArray(juniorMessageAttachments.conversationId, [...conversationIds]));
2300
+ }
2139
2301
  // src/chat/conversations/sql/history.ts
2140
2302
  const messageHistoryEventTypes = [
2141
2303
  "message",
@@ -2155,7 +2317,7 @@ const HUMAN_INSTRUCTION_PLATFORMS = /* @__PURE__ */ new Set([
2155
2317
  * mentions and DMs, always address Junior.
2156
2318
  */
2157
2319
  function eventAddressesJunior(data) {
2158
- return data.type === "message" && data.meta?.explicitMention !== false;
2320
+ return data.type === "message" && data.meta?.["explicitMention"] !== false;
2159
2321
  }
2160
2322
  /**
2161
2323
  * Whether one event should restore an archived conversation to the feed.
@@ -2175,8 +2337,8 @@ function eventUnarchivesConversation(data) {
2175
2337
  if (data.role !== "user") return false;
2176
2338
  const meta = data.meta;
2177
2339
  if (!meta) return true;
2178
- if (typeof meta.eventType === "string" && meta.eventType.length > 0) return false;
2179
- const author = meta.author;
2340
+ if (typeof meta["eventType"] === "string" && meta["eventType"].length > 0) return false;
2341
+ const author = meta["author"];
2180
2342
  if (author && typeof author === "object" && !Array.isArray(author) && author.isBot === true) return false;
2181
2343
  return true;
2182
2344
  }
@@ -2258,6 +2420,7 @@ var SqlConversationEventStore = class {
2258
2420
  }
2259
2421
  const db = this.executor.db();
2260
2422
  await db.with(conversationDetailTouch(db, [conversationId])).insert(juniorConversationEvents).values(rows);
2423
+ await writeMessageLinks(this.executor, conversationId, rows);
2261
2424
  if (pending.some((event) => event.data.type === "message" || event.data.type === "user_message")) await refreshLastMessageAt(this.executor, conversationId);
2262
2425
  for (const event of pending) if (event.data.type === "turn_started") await this.recordTurnInputParticipants(conversationId, event.data.inputMessageIds);
2263
2426
  return rows.map((row) => ({
@@ -2573,4 +2736,4 @@ async function closeDb() {
2573
2736
  current = void 0;
2574
2737
  await previous?.db.close();
2575
2738
  }
2576
- export { fenceLock as $, setFirstConversationLocation as A, recordGoogleSignIn as B, isPersonInput as C, turnBehavior as D, promptModeTurnTools as E, saveActorAvatar as F, createCache as G, upsertLinkedIdentity as H, deleteProviderIdentityForSlackUser as I, getStateAdapter as J, disconnectStateAdapter as K, deleteProviderIdentityForUser as L, SYSTEM_IDENTITY_ID as M, findActorIdentityId as N, conversationKindFromRow as O, resolveActorIdentityId as P, acquireActiveLock as Q, findUserByVerifiedEmails as R, deliversFinalText as S, postsRunNotices as T, clearCachedUser as U, saveUserTimezone as V, readCachedUserByEmail as W, setStateValues as X, getStateValues as Y, MUTATION_LOCK_TTL_MS as Z, loadConversationSlackTenantIds as _, sameDestination as _t, getConversationStore as a, agentTurnCostUsd as at, createSqlStore as b, hasAnnotationKey as c, hasAgentTurnUsage as ct, eventFromRow as d, conversationDetailTouch as dt, withLock as et, withConversationEventLock as f, nextDetailVersion as ft, setArchivedAt as g, requireSlackDestination as gt, readConversationTrees as h, parseDestination as ht, getConversationMessageSearchStore as i, addAgentTurnUsage as it, startLocationThread as j, locationFromRow as k, treeHasAnnotationKey as l, resolveRootConversationId as lt, conversationDescendants as m, createSlackDestination as mt, db_exports as n, getConversationIdByProviderConversation as nt, getDb as o, agentTurnTotalTokens as ot, conversationAncestors as p, touchConversationDetail as pt, getDefaultRedisStateAdapterFor as q, getConversationEventStore as r, parseSessionSource as rt, getSqlExecutor as s, agentTurnUsageSchema as st, closeDb as t, claimProviderConversation as tt, createSqlConversationEventStore as u, rootConversationIsArchived as ut, lastMessageAtSql as v, isTopLevelKind as w, withConversationMutationLock as x, userMessageQueries as y, readUserTimezone as z };
2739
+ export { MUTATION_LOCK_TTL_MS as $, conversationKindFromRow as A, findUserByVerifiedEmails as B, withConversationMutationLock as C, postsRunNotices as D, isTopLevelKind as E, findActorIdentityId as F, clearCachedUser as G, recordGoogleSignIn as H, resolveActorIdentityId as I, disconnectStateAdapter as J, readCachedUserByEmail as K, saveActorAvatar as L, setFirstConversationLocation as M, startLocationThread as N, promptModeTurnTools as O, SYSTEM_IDENTITY_ID as P, setStateValues as Q, deleteProviderIdentityForSlackUser as R, createSqlStore as S, isPersonInput as T, saveUserTimezone as U, readUserTimezone as V, upsertLinkedIdentity as W, getStateAdapter as X, getDefaultRedisStateAdapterFor as Y, getStateValues as Z, readConversationTrees as _, parseDestination as _t, getConversationStore as a, parseSessionSource as at, lastMessageAtSql as b, hasAnnotationKey as c, agentTurnTotalTokens as ct, eventFromRow as d, resolveRootConversationId as dt, acquireActiveLock as et, copyMessageLinks as f, rootConversationIsArchived as ft, conversationDescendants as g, createSlackDestination as gt, conversationAncestors as h, touchConversationDetail as ht, getConversationMessageSearchStore as i, getConversationIdByProviderConversation as it, locationFromRow as j, turnBehavior as k, treeHasAnnotationKey as l, agentTurnUsageSchema as lt, withConversationEventLock as m, nextDetailVersion as mt, db_exports as n, withLock as nt, getDb as o, addAgentTurnUsage as ot, deleteMessageLinks as p, conversationDetailTouch as pt, createCache as q, getConversationEventStore as r, claimProviderConversation as rt, getSqlExecutor as s, agentTurnCostUsd as st, closeDb as t, fenceLock as tt, createSqlConversationEventStore as u, hasAgentTurnUsage as ut, setArchivedAt as v, requireSlackDestination as vt, deliversFinalText as w, userMessageQueries as x, loadConversationSlackTenantIds as y, sameDestination as yt, deleteProviderIdentityForUser as z };
@@ -1,10 +1,10 @@
1
- import "./schema-BIFM-U1a.js";
1
+ import "./schema-CKcu-IK6.js";
2
2
  import * as z from "zod";
3
+ import "@earendil-works/pi-ai";
3
4
  import "drizzle-orm";
4
5
  import { Destination, Source, locationSchema } from "@sentry/junior-plugin-api";
5
6
  import "drizzle-orm/pg-core";
6
7
  import "drizzle-orm/migrator";
7
- import "@earendil-works/pi-ai";
8
8
  import "drizzle-orm/pg-core/session";
9
9
  type ConversationPrivacy = "public" | "private";
10
10
  /** Validated Location associated with a Conversation. */
@@ -67,11 +67,11 @@ interface ConversationRunMetrics {
67
67
  usage?: AgentTurnUsage;
68
68
  }
69
69
  interface ConversationExecution {
70
- lastCheckpointAtMs?: number;
71
- lastEnqueuedAtMs?: number;
72
- runId?: string;
70
+ lastCheckpointAtMs?: number | undefined;
71
+ lastEnqueuedAtMs?: number | undefined;
72
+ runId?: string | undefined;
73
73
  status: ConversationStatus;
74
- updatedAtMs?: number;
74
+ updatedAtMs?: number | undefined;
75
75
  }
76
76
  /**
77
77
  * Durable Conversation owned by Junior.
@@ -86,10 +86,10 @@ interface ConversationExecution {
86
86
  * Their field TODOs state when each legacy copy can be removed.
87
87
  */
88
88
  interface Conversation {
89
- channelName?: string;
89
+ channelName?: string | undefined;
90
90
  conversationId: string;
91
91
  createdAtMs: number;
92
- destination?: Destination;
92
+ destination?: Destination | undefined;
93
93
  execution: ConversationExecution;
94
94
  /** Metrics of the latest Run that wrote metrics. */
95
95
  executionMetrics?: ConversationRunMetrics & {
@@ -107,27 +107,27 @@ interface Conversation {
107
107
  archivedAtMs?: number;
108
108
  /** Optional provider coordinates associated with this Conversation. */
109
109
  location?: Location;
110
- actor?: StoredSlackActor;
110
+ actor?: StoredSlackActor | undefined;
111
111
  schemaVersion: 1;
112
- source?: ConversationSource;
112
+ source?: ConversationSource | undefined;
113
113
  /**
114
114
  * Structured inbound Source locator for this conversation session.
115
115
  * Session-stable (threaded Slack keeps threadTs; channel-level turns omit
116
116
  * it; never stores per-message ts). Set-once.
117
117
  */
118
118
  sessionSource?: SessionSource;
119
- title?: string;
119
+ title?: string | undefined;
120
120
  updatedAtMs: number;
121
121
  /**
122
122
  * When retention purged this conversation's content. Set means messages and
123
123
  * events were deleted wholesale; reporting presents the transcript as expired
124
124
  * rather than privacy-redacted (`../../../../../policies/data-redaction.md`).
125
125
  */
126
- transcriptPurgedAtMs?: number;
126
+ transcriptPurgedAtMs?: number | undefined;
127
127
  /** When a person stopped this Conversation. Unset when it is not stopped. */
128
- stoppedAtMs?: number;
128
+ stoppedAtMs?: number | undefined;
129
129
  /** Set while a root's Event Turn replies stay out of its Location. */
130
- deliveryPausedAtMs?: number;
130
+ deliveryPausedAtMs?: number | undefined;
131
131
  /** Confirmed Conversation visibility. Undefined means no confirmation exists. */
132
132
  visibility?: ConversationPrivacy;
133
133
  }
@@ -212,12 +212,12 @@ interface ConversationStore {
212
212
  } | undefined>;
213
213
  recordActivity(args: {
214
214
  activityAtMs?: number;
215
- channelName?: string;
215
+ channelName?: string | undefined;
216
216
  conversationId: string;
217
- destination?: Destination;
217
+ destination?: Destination | undefined;
218
218
  nowMs?: number;
219
- actor?: StoredSlackActor;
220
- source?: ConversationSource;
219
+ actor?: StoredSlackActor | undefined;
220
+ source?: ConversationSource | undefined;
221
221
  /** Source normalized to a stable session locator; set-once when absent. */
222
222
  sessionSource?: Source;
223
223
  title?: string;
@@ -231,7 +231,7 @@ interface ConversationStore {
231
231
  * replaces the visibility of the shared Destination row. Omit it for saved
232
232
  * values, such as visibility captured when an Automation was created.
233
233
  */
234
- visibility?: ConversationPrivacy;
234
+ visibility?: ConversationPrivacy | undefined;
235
235
  }): Promise<void>;
236
236
  /**
237
237
  * Store execution state and one Run's metrics.
@@ -239,25 +239,25 @@ interface ConversationStore {
239
239
  */
240
240
  recordExecution(args: {
241
241
  /** Identity of the Turn Actor. Its metric rows record it. */
242
- actorIdentityId?: string;
243
- channelName?: string;
242
+ actorIdentityId?: string | undefined;
243
+ channelName?: string | undefined;
244
244
  conversationId: string;
245
245
  /** When this Run started. */
246
246
  createdAtMs: number;
247
- destination?: Destination;
247
+ destination?: Destination | undefined;
248
248
  execution: ConversationExecution;
249
249
  lastActivityAtMs: number;
250
250
  metrics: ConversationRunMetrics | null;
251
- actor?: StoredSlackActor;
252
- source?: ConversationSource;
253
- title?: string;
251
+ actor?: StoredSlackActor | undefined;
252
+ source?: ConversationSource | undefined;
253
+ title?: string | undefined;
254
254
  updatedAtMs: number;
255
255
  /**
256
256
  * Current visibility from its owner, such as a Slack event channel type. It
257
257
  * replaces the visibility of the shared Destination row. Omit it for saved
258
258
  * values, such as visibility captured when an Automation was created.
259
259
  */
260
- visibility?: ConversationPrivacy;
260
+ visibility?: ConversationPrivacy | undefined;
261
261
  }): Promise<void>;
262
262
  listByActivity(args?: {
263
263
  limit?: number;