@sentry/junior 0.305.0 → 0.306.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 (80) hide show
  1. package/dist/{adapter-context-BpvbUki8.js → adapter-context-CnY-i32r.js} +2 -2
  2. package/dist/{admin-CoDt35ny.js → admin-BLLdLnXh.js} +2 -2
  3. package/dist/{agent-runner-C5d6rY5g.js → agent-runner-BaLjEjPR.js} +261 -190
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +7 -8
  6. package/dist/api.d.ts +19 -4
  7. package/dist/api.js +137 -40
  8. package/dist/{app-Cs157Zc5.d.ts → app-DvYbM9UD.d.ts} +2 -2
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +487 -434
  11. package/dist/{background-compaction-queue-BTqMIfTA.js → background-compaction-queue-D2wzxtGU.js} +2 -2
  12. package/dist/{briefs-BRdznF7c.js → briefs-DvyzXfrF.js} +3 -3
  13. package/dist/{catalog-runtime-J52Tej47.js → catalog-runtime-B1R-nHd3.js} +1 -1
  14. package/dist/cli/chat.js +15 -15
  15. package/dist/cli/check.js +3 -3
  16. package/dist/cli/main.js +3 -3
  17. package/dist/cli/plugins.js +4 -4
  18. package/dist/cli/snapshot-create.js +5 -5
  19. package/dist/cli/upgrade.d.ts +1 -1
  20. package/dist/cli/upgrade.js +3 -3
  21. package/dist/{config-CBZp0udd.js → config-DUD-zMvp.js} +111 -13
  22. package/dist/{connections-BYmuJ6Vm.js → connections-CDhsqPcC.js} +6 -6
  23. package/dist/{continue-in-slack-Cvot6S38.js → continue-in-slack-BXQizz9o.js} +5 -5
  24. package/dist/{conversation-BOqdRtUx.js → conversation--f85g4zL.js} +132 -132
  25. package/dist/{conversation-feed-CgpgP7yi.js → conversation-feed-BNs9KiqC.js} +1 -1
  26. package/dist/{conversation-privacy-D2pOzBNl.js → conversation-privacy-YE54gMN8.js} +1 -1
  27. package/dist/{conversation-turn-CI8WDpnK.js → conversation-turn-BzdmrHb0.js} +22 -40
  28. package/dist/{credential-sync-COqnZ1Dx.js → credential-sync-Cdm-e1vJ.js} +14 -13
  29. package/dist/{db-DU84dCVu.js → db-DV2ZUb1Y.js} +90 -11
  30. package/dist/{db-zbN5ZV_o.d.ts → db-pH357Dkt.d.ts} +1 -1
  31. package/dist/{executor-CFyrgOu1.js → executor-CjNhwwnj.js} +47 -4
  32. package/dist/{history-m2-ceTTX.js → history-N7IVbUom.js} +5 -1
  33. package/dist/{install-CQ76CfRw.js → install-DbD7C5td.js} +2 -2
  34. package/dist/instrumentation.js +2 -2
  35. package/dist/{lineage-DLd2UxVP.js → lineage-BFdIPb3o.js} +2 -2
  36. package/dist/{logging-BPNTQVFu.js → logging-oYpJYr-S.js} +1 -1
  37. package/dist/{message-BWJLeQ5e.js → message-BBPcMKJY.js} +8 -8
  38. package/dist/{model-input-DoM9Ht-d.js → model-input-DYYF3a8B.js} +3 -3
  39. package/dist/nitro.d.ts +1 -1
  40. package/dist/nitro.js +4 -4
  41. package/dist/{oauth-callback-server-DeHbnAQl.js → oauth-callback-server-C7Q987su.js} +2 -2
  42. package/dist/{projection-CcFBVFUo.js → projection-CWXDE0f6.js} +7738 -6166
  43. package/dist/{prompt-C5LREK2p.js → prompt-P3eRqO8C.js} +15 -7
  44. package/dist/{queue-B2AAL3ym.js → queue-7FSijgqG.js} +4 -4
  45. package/dist/{registry-BjZZqKqi.js → registry-1pzXmplY.js} +1 -1
  46. package/dist/{resolve-CeJgXuH1.js → resolve-n87oXY-d.js} +3 -3
  47. package/dist/{result-icDrueyB.js → result-BmF9v9bv.js} +9 -9
  48. package/dist/{runner-nVfMkMMB.js → runner-4j7ZsxP5.js} +13 -15
  49. package/dist/{sandbox-egress-signals-H9vQ5qRf.js → sandbox-egress-signals-BRQI8HvT.js} +1 -1
  50. package/dist/{automation-CuA3yEcD.js → schedule-CHPWQn-x.js} +347 -5
  51. package/dist/{schema-CKcu-IK6.d.ts → schema-CVbIjrF3.d.ts} +71 -1
  52. package/dist/{schema-Bx0Mlo32.js → schema-D7iIEh6t.js} +52 -6
  53. package/dist/{service-account-Dw06p3zm.js → service-account-BDQ9xzta.js} +3 -3
  54. package/dist/{service-account-DU5865XA.js → service-account-DzQiOmqa.js} +5 -5
  55. package/dist/{session-stop-uotLtp4g.js → session-stop-BQxgHR4X.js} +854 -160
  56. package/dist/{skills-Bex1EaO5.js → skills-CPf4vNuC.js} +2 -2
  57. package/dist/{slack-conversation-unfurl-EPG3riWF.js → slack-conversation-unfurl-B1KEptUg.js} +10 -9
  58. package/dist/{spawn-CoD3vDuS.js → spawn-CjGddiAU.js} +6 -6
  59. package/dist/{state-nCR4Muhn.js → state-9wfj6aSD.js} +4 -4
  60. package/dist/{stop-BFVd0P0m.js → stop-CsQGuN5n.js} +62 -117
  61. package/dist/{store-Ca6G962n.js → store-Dz3YZ7gQ.js} +5 -5
  62. package/dist/{task-queue-BLPZU6kC.js → task-queue-CFlrJguF.js} +3 -3
  63. package/dist/{task-runner-xsOPIxCZ.js → task-runner-frzlUvFD.js} +8 -9
  64. package/dist/{thread-context-BOvZhsKK.js → thread-context-C4QuZlM8.js} +8 -91
  65. package/dist/turn-session-routing-BXaubz2w.js +244 -0
  66. package/dist/{turn-user-message-BrhuyYrH.js → turn-user-message-DNC0eRZ7.js} +3 -3
  67. package/dist/users-XCCKn3xW.js +181 -0
  68. package/dist/{validation-BnY9K5WB.js → validation-L5fdjmFX.js} +1 -1
  69. package/dist/{version-qROlRQGF.js → version-BFmuwgxP.js} +1 -1
  70. package/dist/version.js +1 -1
  71. package/dist/{viewer-CxUiOraX.js → viewer-DKOeHpv3.js} +3 -3
  72. package/dist/{warmup--Gkz7iB-.js → warmup-mTMIatCV.js} +267 -272
  73. package/dist/{web-message-id-lNodcCOI.js → web-message-id-CUaSiGme.js} +16 -1
  74. package/dist/{worker-DJ8d9fmD.js → worker-Bz4KNxjI.js} +7 -7
  75. package/migrations/0114_plan_items.sql +22 -0
  76. package/migrations/meta/0114_snapshot.json +5203 -0
  77. package/migrations/meta/_journal.json +7 -0
  78. package/package.json +6 -6
  79. package/dist/schedule-cP0AACm1.js +0 -344
  80. package/dist/turn-session-routing-2bW2qfeb.js +0 -1792
@@ -1,4 +1,4 @@
1
- import { h as logWarn } from "./logging-BPNTQVFu.js";
1
+ import { h as logWarn } from "./logging-oYpJYr-S.js";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  import { renderSystemMessageUpdate } from "@earendil-works/pi-ai";
4
4
  // src/chat/conversation-privacy.ts
@@ -1,22 +1,22 @@
1
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-2bW2qfeb.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-DU84dCVu.js";
4
- import { E as withSpan, S as setTags, h as logWarn, p as logException } from "./logging-BPNTQVFu.js";
5
- import { J as readMessageAttachments } from "./conversation-BOqdRtUx.js";
6
- import { N as juniorConversations } from "./executor-CFyrgOu1.js";
7
- import { c as buildDeliveredTurnStatePatch, l as loadPendingMessageCards, o as completeAuthPauseTurn, r as finalizeFailedTurnReplyWithEvent, t as buildTurnThreadContext } from "./thread-context-BOvZhsKK.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--Gkz7iB-.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-CcFBVFUo.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-BrhuyYrH.js";
11
- import { f as credentialContextForActor } from "./registry-BjZZqKqi.js";
2
+ import { A as normalizeConversationText, Do as readConversationAutomationRun, Go as notifyAutomationBlocked, No as getDispatchIdForConversation, O as latestConversationMessageSeq, P as upsertConversationMessage, Xs as blockEventAutomation, a as loadProjection, at as getTurnRecord, b as persistConversationMessages, bi as verifyTimerWatchCredentialSubject, cn as getAssistantReplyText, et as saveTurnCheckpoint, j as recordDeliveredAssistantMessage, k as markConversationMessage, ks as blockScheduledAutomation, rt as failTurnRecord, t as commitAcceptedReply, v as hydrateConversationMessages, vn as persistWithRetry } from "./projection-CWXDE0f6.js";
3
+ import { E as isTopLevelKind, T as isPersonInput, _t as nextDetailVersion, a as getConversationStore, k as turnBehavior, o as getDb, r as getConversationEventStore, s as getSqlExecutor } from "./db-DV2ZUb1Y.js";
4
+ import { E as withSpan, S as setTags, h as logWarn, p as logException } from "./logging-oYpJYr-S.js";
5
+ import { tt as readMessageAttachments } from "./conversation--f85g4zL.js";
6
+ import { F as juniorConversations } from "./executor-CjNhwwnj.js";
7
+ import { a as buildDeliveredTurnStatePatch, o as loadPendingMessageCards, r as completeAuthPauseTurn, t as buildTurnThreadContext } from "./thread-context-C4QuZlM8.js";
8
+ import { Bn as AgentRunError, En as supersedeOpenMailboxTurns, Et as resolveConversationDestination, Ln as createWebAuthorization, Vn as executeTurn, an as readParentMessage, gn as completeCancelledConversationTurn, nn as isParentMessageMeta, tn as childAgentTurnOptions } from "./warmup-mTMIatCV.js";
9
+ 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-DNC0eRZ7.js";
10
+ import { f as credentialContextForActor } from "./registry-1pzXmplY.js";
12
11
  import { i as getActiveSpan, r as continueTrace } from "./sentry-CPbZjomA.js";
13
- import { i as measureTurnCompactionWait } from "./agent-runner-C5d6rY5g.js";
14
- import { n as botConfig } from "./config-CBZp0udd.js";
15
- import { D as turnInputFactsFromConversationMessage, E as sourceFromTurnInput, G as recordFinishedTurnForAutomatedLimit, I as maybePostAutomatedTurnLimitNotice, M as isEventMailboxMetadata, N as renderEventBatchInputs, O as legacyWebMailboxMetadataSchema, P as timerWatchCredentialSubject, 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-uotLtp4g.js";
16
- import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-xsOPIxCZ.js";
17
- import { p as instructionProvenanceFor } from "./history-m2-ceTTX.js";
18
- import { o as isEventConversationMessage } from "./prompt-C5LREK2p.js";
19
- import { t as readConversationLineage } from "./lineage-DLd2UxVP.js";
12
+ import { N as finalizeFailedTurnReplyWithEvent, i as measureTurnCompactionWait } from "./agent-runner-BaLjEjPR.js";
13
+ import { a as getPersistedThreadState, c as coerceThreadConversationState, i as getPersistedSandboxState, s as persistThreadStateById } from "./turn-session-routing-BXaubz2w.js";
14
+ import { n as botConfig } from "./config-DUD-zMvp.js";
15
+ import { B as renderEventBatchInputs, D as getEventBatchDelayMs, M as sourceFromTurnInput, N as turnInputFactsFromConversationMessage, P as legacyWebMailboxMetadataSchema, Q as maybePostAutomatedTurnLimitNotice, R as eventBatchMessageMeta, V as timerWatchCredentialSubject, c as loadReviewItemInput, f as buildSteeringPiMessage, g as withoutSavedSteeringMessages, m as instructionForInputs, p as instructionActorFor, s as eventReviewItemInputs, st as recordFinishedTurnForAutomatedLimit, z as isEventMailboxMetadata } from "./session-stop-BQxgHR4X.js";
16
+ import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-frzlUvFD.js";
17
+ import { p as instructionProvenanceFor } from "./history-N7IVbUom.js";
18
+ import { s as isEventConversationMessage } from "./prompt-P3eRqO8C.js";
19
+ import { t as readConversationLineage } from "./lineage-BFdIPb3o.js";
20
20
  import { isDeepStrictEqual } from "node:util";
21
21
  import { createHash } from "node:crypto";
22
22
  import { and, eq, isNotNull, isNull } from "drizzle-orm";
@@ -79,28 +79,13 @@ function getTurnInputSpanAttributes(input, turnStartedAtMs) {
79
79
  }
80
80
  // src/chat/automations/block-run.ts
81
81
  /**
82
- * Find the Automation of a run. The SQL run row lasts as long as the
83
- * Automation, but a Watch can outlive the dispatch record. The dispatch record
84
- * covers a run whose row does not link its Conversation yet.
85
- */
86
- async function findRunAutomation(conversationId, dispatchId) {
87
- const run = await readAutomationExecutionByConversationId({ conversationId });
88
- if (run) return run;
89
- const source = dispatchId ? (await getDispatchRecord(dispatchId))?.source : void 0;
90
- if (!source || !("automationId" in source) || !source.automationId) return;
91
- return {
92
- automationId: source.automationId,
93
- kind: source.kind === "scheduled_automation" ? "scheduled" : "event"
94
- };
95
- }
96
- /**
97
82
  * Block the Automation of a run from a later Turn of the run, such as a Watch
98
83
  * Event or child result Turn. The dispatch Turn blocks through its dispatch
99
84
  * outcome. Its creator is told when the block is first stored.
100
85
  */
101
86
  async function blockRunAutomation(conversationId, blocked) {
102
87
  const dispatchId = getDispatchIdForConversation(conversationId);
103
- const automation = await findRunAutomation(conversationId, dispatchId);
88
+ const automation = await readConversationAutomationRun(conversationId);
104
89
  if (!automation) {
105
90
  logWarn("automation.block.unresolved", { "gen_ai.conversation.id": conversationId });
106
91
  return;
@@ -424,7 +409,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
424
409
  personInput: isPersonInput(source.kind)
425
410
  });
426
411
  const webActor = actor.platform === "web" ? actor : void 0;
427
- const signInActor = behavior.promptMode === "child_agent" ? void 0 : webActor;
412
+ const signInActor = behavior.waitsForSignIn ? webActor : void 0;
428
413
  const disabledFeatures = signInActor ? [] : ["interactive-auth"];
429
414
  const deliverToProvider = postsToProvider && behavior.delivery === "location";
430
415
  const sendToParent = async (result) => {
@@ -642,10 +627,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
642
627
  }, async (result) => {
643
628
  if (stopSignal?.aborted) throw stopSignal.reason ?? new DOMException("Turn cancelled", "AbortError");
644
629
  modelFailureCaptureAttempted = result.diagnostics.outcome !== "success";
645
- const finalized = finalizeFailedTurnReplyWithEvent({
646
- reply: result,
647
- logException
648
- });
630
+ const finalized = finalizeFailedTurnReplyWithEvent({ reply: result });
649
631
  const modelFailureReason = finalized.failureReason;
650
632
  const reply = finalized.reply;
651
633
  modelFailureEventId = finalized.eventId;
@@ -728,7 +710,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
728
710
  await scheduleSessionCompletedPluginTasks({
729
711
  conversationId: context.conversationId,
730
712
  sessionId: turnId
731
- }, { send: async (message) => {
713
+ }, async (message) => {
732
714
  try {
733
715
  await processPluginTask(message);
734
716
  } catch (error) {
@@ -739,7 +721,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
739
721
  turnId
740
722
  });
741
723
  }
742
- } });
724
+ });
743
725
  } catch (error) {
744
726
  logException(error, "conversation.plugin.session_completion_task.failed", {
745
727
  conversationId: context.conversationId,
@@ -1,19 +1,20 @@
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-CcFBVFUo.js";
2
- import { V as escapeXml, a as getRuntimeMetadata, n as botConfig } from "./config-CBZp0udd.js";
3
- import { W as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-BPNTQVFu.js";
1
+ import { Bn as createUserTokenStore, Gi as parseOAuthStatePayload, Hn as resolvePluginOAuthAccount, Ki as resolveBaseUrl, Qo as postSlackMessage, Wi as formatProviderLabel, Y as getConversationPendingAuth, at as getTurnRecord, d as recordAuthorizationCompleted, ls as getSlackClient, u as recordAuthenticationLinked } from "./projection-CWXDE0f6.js";
2
+ import { V as escapeXml, a as getRuntimeMetadata, n as botConfig } from "./config-DUD-zMvp.js";
3
+ import { W as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-oYpJYr-S.js";
4
4
  import { p as parseSlackUserId } from "./actor-D2iXzvlN.js";
5
- import { B as findUserByVerifiedEmails, I as resolveActorIdentityId, W as upsertLinkedIdentity, X as getStateAdapter, et as acquireActiveLock, s as getSqlExecutor } from "./db-DU84dCVu.js";
5
+ import { $ as getStateAdapter, H as findUserByVerifiedEmails, I as resolveActorIdentityId, q as upsertLinkedIdentity, rt as acquireActiveLock, s as getSqlExecutor } from "./db-DV2ZUb1Y.js";
6
6
  import { i as homeDir } from "./package-discovery-x4AvVhMj.js";
7
- import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-BjZZqKqi.js";
8
- import { n as pluginCatalogRuntime } from "./catalog-runtime-J52Tej47.js";
9
- import { t as discoverSkills } from "./skills-Bex1EaO5.js";
10
- import { o as finalizeMcpAuthorization } from "./agent-runner-C5d6rY5g.js";
11
- import { O as getMcpProviderErrorAttributes, S as putMcpStoredOAuthCredentials, f as deleteMcpAuthSession, g as getMcpAuthSession, v as getMcpStoredOAuthCredentials } from "./service-account-DU5865XA.js";
12
- import { o as readIdentityById } from "./viewer-CxUiOraX.js";
7
+ import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-1pzXmplY.js";
8
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-B1R-nHd3.js";
9
+ import { t as discoverSkills } from "./skills-CPf4vNuC.js";
10
+ import { o as finalizeMcpAuthorization } from "./agent-runner-BaLjEjPR.js";
11
+ import { O as getMcpProviderErrorAttributes, S as putMcpStoredOAuthCredentials, f as deleteMcpAuthSession, g as getMcpAuthSession, v as getMcpStoredOAuthCredentials } from "./service-account-DzQiOmqa.js";
12
+ import { o as readIdentityById } from "./viewer-DKOeHpv3.js";
13
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--Gkz7iB-.js";
15
- import { a as getPersistedThreadState, c as coerceThreadConversationState } from "./turn-session-routing-2bW2qfeb.js";
16
- import { i as readConnectedOAuthTokens, s as htmlCallbackResponse } from "./connections-BYmuJ6Vm.js";
14
+ import { An as wakeAuthorizedTurn, Rn as deleteWebAuthorization, jn as wakePausedTurn } from "./warmup-mTMIatCV.js";
15
+ import { i as lookupSlackUserProfile } from "./users-XCCKn3xW.js";
16
+ import { a as getPersistedThreadState, c as coerceThreadConversationState } from "./turn-session-routing-BXaubz2w.js";
17
+ import { i as readConnectedOAuthTokens, s as htmlCallbackResponse } from "./connections-CDhsqPcC.js";
17
18
  import { n as relayLocalOAuthCallback } from "./oauth-relay-DAmfVmJu.js";
18
19
  import * as z from "zod";
19
20
  import path from "node:path";
@@ -1,9 +1,9 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { i as getChatConfig } from "./config-CBZp0udd.js";
2
+ import { i as getChatConfig } from "./config-DUD-zMvp.js";
3
3
  import { a as isSlackUserId, d as parseSlackChannelReferenceId, f as parseSlackTeamId, s as parseActorUserId } from "./actor-D2iXzvlN.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-CFyrgOu1.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-BPNTQVFu.js";
4
+ import { D as juniorConversationEvents, E as isUserInstruction, F as juniorConversations, I as juniorIdentities, L as juniorUsers, N as juniorAttachments, P as juniorMessageAttachments, R as juniorDestinations, T as juniorConversationMetrics, b as juniorConversationParticipants, k as juniorConversationAnnotations, t as createJuniorSqlExecutor, w as CONVERSATION_METRICS, x as juniorConversationBindings } from "./executor-CjNhwwnj.js";
5
+ import { c as newConversationEventSchema, h as usageSchema, l as encodeHistoryPayload, o as decodeStoredConversationEvent, r as conversationEventDataSchema, s as historyReplacementSchema } from "./history-N7IVbUom.js";
6
+ import { G as normalizeIdentityEmail, U as GOOGLE_IDENTITY_PROVIDER, h as logWarn } from "./logging-oYpJYr-S.js";
7
7
  import * as z from "zod";
8
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";
@@ -971,6 +971,17 @@ async function saveUserTimezone(db, userId, timezone, nowMs) {
971
971
  updatedAt: dateFromMs$1(nowMs)
972
972
  }).where(and(eq(juniorUsers.id, userId), sql`${juniorUsers.timezone} is distinct from ${timezone}`));
973
973
  }
974
+ /** Return the Slack user most recently linked to a Junior user. */
975
+ async function linkedSlackUser(db, userId) {
976
+ const row = (await db.select({
977
+ teamId: juniorIdentities.providerTenantId,
978
+ slackUserId: juniorIdentities.providerSubjectId
979
+ }).from(juniorIdentities).where(and(eq(juniorIdentities.userId, userId), eq(juniorIdentities.kind, "user"), eq(juniorIdentities.provider, "slack"))).orderBy(desc(juniorIdentities.updatedAt)).limit(1))[0];
980
+ return row?.teamId ? {
981
+ teamId: row.teamId,
982
+ userId: row.slackUserId
983
+ } : void 0;
984
+ }
974
985
  /** Persist one provider identity observation and link verified emails to users. */
975
986
  async function upsertIdentity(executor, identity, nowMs = Date.now()) {
976
987
  return await upsertIdentityRecord(executor, identity, void 0, nowMs);
@@ -997,6 +1008,45 @@ async function findUserByVerifiedEmails(executor, emails) {
997
1008
  }).from(juniorUsers).where(inArray(juniorUsers.primaryEmailNormalized, Array.from(normalized))).limit(2);
998
1009
  return rows.length === 1 ? rows[0] : void 0;
999
1010
  }
1011
+ const linkedSlackIdentity = alias(juniorIdentities, "linked_slack_identity");
1012
+ const linkedSlackUserColumns = {
1013
+ displayName: juniorUsers.displayName,
1014
+ email: juniorUsers.primaryEmail,
1015
+ slackUserId: linkedSlackIdentity.providerSubjectId,
1016
+ userId: juniorUsers.id
1017
+ };
1018
+ function singleLinkedSlackUser(rows) {
1019
+ const [row] = rows;
1020
+ if (rows.length !== 1 || !row) return void 0;
1021
+ return {
1022
+ slackUserId: row.slackUserId,
1023
+ user: {
1024
+ id: row.userId,
1025
+ email: row.email,
1026
+ ...row.displayName ? { displayName: row.displayName } : void 0
1027
+ }
1028
+ };
1029
+ }
1030
+ /**
1031
+ * Find the one Slack user in a workspace who is linked to an exact provider
1032
+ * Identity, and the User behind both.
1033
+ *
1034
+ * Only the provider account id from an account-linking flow matches. Handles,
1035
+ * emails, and display names never match. Return undefined when no Slack user
1036
+ * or more than one Slack user matches.
1037
+ */
1038
+ async function findLinkedSlackUser(executor, args) {
1039
+ return singleLinkedSlackUser(await executor.db().select(linkedSlackUserColumns).from(juniorIdentities).innerJoin(linkedSlackIdentity, and(eq(linkedSlackIdentity.userId, juniorIdentities.userId), eq(linkedSlackIdentity.kind, "user"), eq(linkedSlackIdentity.provider, "slack"), eq(linkedSlackIdentity.providerTenantId, args.slackTeamId))).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(and(eq(juniorIdentities.kind, "user"), eq(juniorIdentities.provider, args.provider), eq(juniorIdentities.providerTenantId, ""), eq(juniorIdentities.providerSubjectId, args.providerSubjectId))).limit(2));
1040
+ }
1041
+ /**
1042
+ * Find the one Slack user in a workspace whose User has this primary email.
1043
+ *
1044
+ * The caller must have verified that the person sent from this address.
1045
+ * Return undefined when no Slack user or more than one Slack user matches.
1046
+ */
1047
+ async function findSlackUserByPrimaryEmail(executor, args) {
1048
+ return singleLinkedSlackUser(await executor.db().select(linkedSlackUserColumns).from(juniorUsers).innerJoin(linkedSlackIdentity, eq(linkedSlackIdentity.userId, juniorUsers.id)).where(and(eq(juniorUsers.primaryEmailNormalized, args.normalizedEmail), eq(linkedSlackIdentity.kind, "user"), eq(linkedSlackIdentity.provider, "slack"), eq(linkedSlackIdentity.providerTenantId, args.slackTeamId))).limit(2));
1049
+ }
1000
1050
  /** Remove one exact provider identity owned by a workspace Slack user. */
1001
1051
  async function deleteProviderIdentityForSlackUser(executor, slackTeamId, slackUserId, provider, providerSubjectId) {
1002
1052
  const userId = (await executor.db().select({ userId: juniorIdentities.userId }).from(juniorIdentities).where(and(eq(juniorIdentities.kind, "user"), eq(juniorIdentities.provider, "slack"), eq(juniorIdentities.providerTenantId, slackTeamId), eq(juniorIdentities.providerSubjectId, slackUserId))).limit(1))[0]?.userId;
@@ -1333,6 +1383,8 @@ function conversationKindFromRow(row) {
1333
1383
  const ROOT = {
1334
1384
  delivery: "location",
1335
1385
  promptMode: "conversation",
1386
+ idleNeedsPendingWork: false,
1387
+ waitsForSignIn: true,
1336
1388
  gated: false,
1337
1389
  failureNotice: "none",
1338
1390
  sessionTasks: true,
@@ -1348,15 +1400,19 @@ const ROOT = {
1348
1400
  };
1349
1401
  const PERSON_IN_THREAD = {
1350
1402
  ...ROOT,
1403
+ promptMode: "thread",
1404
+ sender: "person",
1351
1405
  sessionTasks: false,
1352
1406
  tools: {
1353
1407
  ...ROOT.tools,
1354
1408
  agents: "none"
1355
1409
  }
1356
1410
  };
1357
- const AGENT_IN_THREAD = {
1411
+ const CHILD_AGENT_TURN = {
1358
1412
  delivery: "conversation",
1359
1413
  promptMode: "child_agent",
1414
+ idleNeedsPendingWork: false,
1415
+ waitsForSignIn: false,
1360
1416
  gated: true,
1361
1417
  failureNotice: "none",
1362
1418
  sessionTasks: false,
@@ -1370,14 +1426,28 @@ const AGENT_IN_THREAD = {
1370
1426
  noReply: true
1371
1427
  }
1372
1428
  };
1429
+ const AGENT_IN_THREAD = {
1430
+ ...CHILD_AGENT_TURN,
1431
+ promptMode: "thread",
1432
+ sender: "agent"
1433
+ };
1434
+ const THREAD_TOOLS = {
1435
+ ...AGENT_IN_THREAD.tools,
1436
+ reviewDesk: PERSON_IN_THREAD.tools.reviewDesk,
1437
+ subscriptions: PERSON_IN_THREAD.tools.subscriptions,
1438
+ userCustomization: PERSON_IN_THREAD.tools.userCustomization
1439
+ };
1373
1440
  const AGENT_IN_TASK = {
1374
- ...AGENT_IN_THREAD,
1441
+ ...CHILD_AGENT_TURN,
1375
1442
  missingAnswerError: "No reply was sent.",
1376
1443
  failureNotice: "parent"
1377
1444
  };
1378
1445
  const AUTOMATION_RUN = {
1379
1446
  delivery: "conversation",
1380
1447
  promptMode: "automation",
1448
+ sender: "automation",
1449
+ idleNeedsPendingWork: true,
1450
+ waitsForSignIn: true,
1381
1451
  gated: true,
1382
1452
  failureNotice: "none",
1383
1453
  sessionTasks: true,
@@ -1387,21 +1457,28 @@ const AUTOMATION_RUN = {
1387
1457
  reportBlocked: "automation"
1388
1458
  }
1389
1459
  };
1460
+ const PERSON_IN_AUTOMATION = {
1461
+ ...ROOT,
1462
+ promptMode: "automation",
1463
+ sender: "person"
1464
+ };
1390
1465
  /** Return the behavior of one Turn. */
1391
1466
  function turnBehavior(args) {
1392
1467
  if (args.kind === "root") return ROOT;
1393
- if (args.kind === "automation") return args.personInput ? ROOT : AUTOMATION_RUN;
1468
+ if (args.kind === "automation") return args.personInput ? PERSON_IN_AUTOMATION : AUTOMATION_RUN;
1394
1469
  if (args.kind === "thread") return args.personInput ? PERSON_IN_THREAD : AGENT_IN_THREAD;
1395
1470
  if (!args.personInput) return AGENT_IN_TASK;
1396
1471
  throw new Error("A task Conversation cannot have a person's input");
1397
1472
  }
1398
1473
  /**
1399
- * Return the Turn tools of one Prompt mode. A person's Turn in a Thread also
1400
- * uses the `conversation` mode with no agent tools, so this is the widest set.
1474
+ * Return the tools that every Turn of one Prompt mode lists. A Turn of a mode
1475
+ * with two senders can list more than its own tools. The listed tools that it
1476
+ * cannot use are disabled.
1401
1477
  */
1402
1478
  function promptModeTurnTools(mode) {
1403
1479
  if (mode === "automation") return AUTOMATION_RUN.tools;
1404
1480
  if (mode === "child_agent") return AGENT_IN_TASK.tools;
1481
+ if (mode === "thread") return THREAD_TOOLS;
1405
1482
  return ROOT.tools;
1406
1483
  }
1407
1484
  /** Return whether a Conversation of this kind has no parent. */
@@ -2432,7 +2509,8 @@ var SqlConversationEventStore = class {
2432
2509
  /**
2433
2510
  * Add the authors of Turn input messages to the conversation.
2434
2511
  * Only people who start a Turn join it. Thread context, such as backfilled
2435
- * or skipped messages, keeps its author without membership.
2512
+ * or skipped messages, and Event Messages keep their author without
2513
+ * membership.
2436
2514
  */
2437
2515
  async recordTurnInputParticipants(conversationId, inputMessageIds) {
2438
2516
  const rows = await this.executor.db().select().from(juniorConversationEvents).where(and(eq(juniorConversationEvents.conversationId, conversationId), eq(juniorConversationEvents.type, "message"), inArray(sql`${juniorConversationEvents.payload}->>'messageId'`, [...inputMessageIds])));
@@ -2441,6 +2519,7 @@ var SqlConversationEventStore = class {
2441
2519
  for (const row of rows) {
2442
2520
  const { data } = eventFromRow(row);
2443
2521
  if (!row.actorIdentityId || data.type !== "message") continue;
2522
+ if (data.meta?.["eventType"]) continue;
2444
2523
  const unarchives = eventUnarchivesConversation(data);
2445
2524
  const isPerson = await recordConversationParticipant(this.executor, {
2446
2525
  actorIdentityId: row.actorIdentityId,
@@ -2736,4 +2815,4 @@ async function closeDb() {
2736
2815
  current = void 0;
2737
2816
  await previous?.db.close();
2738
2817
  }
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 };
2818
+ export { getStateAdapter as $, conversationKindFromRow as A, findLinkedSlackUser as B, withConversationMutationLock as C, postsRunNotices as D, isTopLevelKind as E, findActorIdentityId as F, recordGoogleSignIn as G, findUserByVerifiedEmails as H, resolveActorIdentityId as I, clearCachedUser as J, saveUserTimezone as K, saveActorAvatar as L, setFirstConversationLocation as M, startLocationThread as N, promptModeTurnTools as O, SYSTEM_IDENTITY_ID as P, getDefaultRedisStateAdapterFor as Q, deleteProviderIdentityForSlackUser as R, createSqlStore as S, sameDestination as St, isPersonInput as T, linkedSlackUser as U, findSlackUserByPrimaryEmail as V, readUserTimezone as W, createCache as X, readCachedUserByEmail as Y, disconnectStateAdapter as Z, readConversationTrees as _, nextDetailVersion as _t, getConversationStore as a, withLock as at, lastMessageAtSql as b, parseDestination as bt, hasAnnotationKey as c, parseSessionSource as ct, eventFromRow as d, agentTurnTotalTokens as dt, getStateValues as et, copyMessageLinks as f, agentTurnUsageSchema as ft, conversationDescendants as g, conversationDetailTouch as gt, conversationAncestors as h, rootConversationIsArchived as ht, getConversationMessageSearchStore as i, fenceLock as it, locationFromRow as j, turnBehavior as k, treeHasAnnotationKey as l, addAgentTurnUsage as lt, withConversationEventLock as m, resolveRootConversationId as mt, db_exports as n, MUTATION_LOCK_TTL_MS as nt, getDb as o, claimProviderConversation as ot, deleteMessageLinks as p, hasAgentTurnUsage as pt, upsertLinkedIdentity as q, getConversationEventStore as r, acquireActiveLock as rt, getSqlExecutor as s, getConversationIdByProviderConversation as st, closeDb as t, setStateValues as tt, createSqlConversationEventStore as u, agentTurnCostUsd as ut, setArchivedAt as v, touchConversationDetail as vt, deliversFinalText as w, userMessageQueries as x, requireSlackDestination as xt, loadConversationSlackTenantIds as y, createSlackDestination as yt, deleteProviderIdentityForUser as z };
@@ -1,4 +1,4 @@
1
- import "./schema-CKcu-IK6.js";
1
+ import "./schema-CVbIjrF3.js";
2
2
  import * as z from "zod";
3
3
  import "@earendil-works/pi-ai";
4
4
  import "drizzle-orm";
@@ -1,9 +1,9 @@
1
- import { h as logWarn, p as logException } from "./logging-BPNTQVFu.js";
1
+ import { h as logWarn, p as logException } from "./logging-oYpJYr-S.js";
2
2
  import { _ as withScope } from "./sentry-CPbZjomA.js";
3
- import "./config-CBZp0udd.js";
3
+ import "./config-DUD-zMvp.js";
4
4
  import { AsyncLocalStorage } from "node:async_hooks";
5
5
  import { sql } from "drizzle-orm";
6
- import { bigint, boolean, check, customType, date, doublePrecision, foreignKey, index, integer, jsonb, pgTable, primaryKey, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
6
+ import { bigint, boolean, check, customType, date, doublePrecision, foreignKey, index, integer, jsonb, pgSequence, pgTable, primaryKey, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
7
7
  import { Pool as Pool$1, neon } from "@neondatabase/serverless";
8
8
  import { drizzle } from "drizzle-orm/neon-serverless";
9
9
  import { Agent } from "undici";
@@ -784,6 +784,48 @@ const juniorReviewItemSlackCards = pgTable("junior_review_item_slack_cards", {
784
784
  channelId: text("channel_id").notNull(),
785
785
  messageTs: text("message_ts").notNull()
786
786
  }, (table) => [primaryKey({ columns: [table.itemId, table.conversationId] })]);
787
+ // src/db/schema/plan-items.ts
788
+ /**
789
+ * Gives each Plan item its id and each change its version. One sequence
790
+ * serves every Conversation, so history that a fork copies from its parent
791
+ * never shows a version that the fork's own plan reuses.
792
+ */
793
+ const juniorPlanItemVersionSeq = pgSequence("junior_plan_item_version_seq");
794
+ /**
795
+ * One Plan item: work that a Conversation has not finished. At most one
796
+ * assignee: a Conversation (the plan's own agent or one of its child agents)
797
+ * or a User. An item without one belongs to the plan's own agent.
798
+ * `changed_by_user_id` is set when a person made the latest change, and null
799
+ * when the plan's own agent did. Both User keys block deleting the User, as
800
+ * Conversation participants do: setting them null would turn a person's item
801
+ * into the agent's and hide an unseen change from `<plan-delta>`.
802
+ */
803
+ const juniorPlanItems = pgTable("junior_plan_items", {
804
+ conversationId: text("conversation_id").notNull(),
805
+ id: bigint("id", { mode: "number" }).notNull(),
806
+ title: text("title").notNull(),
807
+ notes: text("notes"),
808
+ status: text("status").$type().notNull(),
809
+ assigneeConversationId: text("assignee_conversation_id"),
810
+ assigneeUserId: text("assignee_user_id").references(() => juniorUsers.id),
811
+ version: bigint("version", { mode: "number" }).notNull(),
812
+ changedByUserId: text("changed_by_user_id").references(() => juniorUsers.id),
813
+ createdAt: timestamptz("created_at").notNull(),
814
+ updatedAt: timestamptz("updated_at").notNull()
815
+ }, (table) => [
816
+ primaryKey({
817
+ name: "junior_plan_items_pk",
818
+ columns: [table.conversationId, table.id]
819
+ }),
820
+ foreignKey({
821
+ name: "junior_plan_items_conversation_id_fk",
822
+ columns: [table.conversationId],
823
+ foreignColumns: [juniorConversations.conversationId]
824
+ }).onDelete("cascade"),
825
+ check("junior_plan_items_status_check", sql`${table.status} in ('pending', 'in_progress', 'blocked', 'done', 'cancelled')`),
826
+ check("junior_plan_items_assignee_check", sql`${table.assigneeConversationId} is null or ${table.assigneeUserId} is null`),
827
+ uniqueIndex("junior_plan_items_in_progress_uidx").on(table.conversationId, sql`coalesce(${table.assigneeConversationId}, ${table.assigneeUserId}, ${table.conversationId})`).where(sql`${table.status} = 'in_progress'`)
828
+ ]);
787
829
  // src/db/schema/push-subscriptions.ts
788
830
  /**
789
831
  * One browser Web Push subscription for one user. A user can have one row for
@@ -879,6 +921,7 @@ const juniorSqlSchema = {
879
921
  juniorReviewItemConversations,
880
922
  juniorReviewItemSlackCards,
881
923
  juniorReviewItems,
924
+ juniorPlanItems,
882
925
  juniorPushSubscriptions,
883
926
  juniorSnapshots,
884
927
  juniorStats,
@@ -1374,4 +1417,4 @@ function createJuniorSqlExecutor(args) {
1374
1417
  statementTimeoutMs
1375
1418
  });
1376
1419
  }
1377
- export { juniorAttachmentUploads as A, juniorConversationMetrics as C, juniorConversationAnnotations as D, juniorApiTokens as E, juniorUsers as F, juniorDestinations as I, juniorArtifacts as L, juniorMessageAttachments as M, juniorConversations as N, juniorCodeChanges as O, juniorIdentities as P, CONVERSATION_METRICS as S, juniorConversationEvents as T, juniorConversationReadPositions as _, juniorPushSubscriptions as a, juniorConversationEmbeddings as b, juniorReviewItemSlackCards as c, juniorAutomationVersions as d, juniorAutomations as f, juniorAgentInvocations as g, juniorAgentBindings as h, juniorWorkspaces as i, juniorAttachments as j, juniorCodeRepositories 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, isUserInstruction as w, juniorConversationBriefs as x, juniorConversationBindings as y };
1420
+ export { juniorCodeChanges as A, juniorConversationBriefs as C, juniorConversationEvents as D, isUserInstruction as E, juniorConversations as F, juniorIdentities as I, juniorUsers as L, juniorAttachmentUploads as M, juniorAttachments as N, juniorApiTokens as O, juniorMessageAttachments as P, juniorDestinations as R, juniorConversationEmbeddings as S, juniorConversationMetrics as T, juniorAgentBindings as _, juniorPushSubscriptions as a, juniorConversationParticipants as b, juniorReviewItemAssignees as c, juniorReviewItems as d, juniorAutomationRuns as f, juniorLocationConfigurations as g, juniorStats as h, juniorWorkspaces as i, juniorCodeRepositories as j, juniorConversationAnnotations as k, juniorReviewItemConversations as l, juniorAutomations as m, juniorSnapshots as n, juniorPlanItemVersionSeq as o, juniorAutomationVersions as p, juniorWorkspaceRepos as r, juniorPlanItems as s, createJuniorSqlExecutor as t, juniorReviewItemSlackCards as u, juniorAgentInvocations as v, CONVERSATION_METRICS as w, juniorConversationBindings as x, juniorConversationReadPositions as y, juniorArtifacts as z };
@@ -100,7 +100,11 @@ function encodeHistoryPayload(data) {
100
100
  model: message["model"],
101
101
  provider: message["provider"],
102
102
  usage: message["usage"],
103
- toolCallId: message["toolCallId"]
103
+ toolCallId: message["toolCallId"],
104
+ stopReason: message["stopReason"],
105
+ timestamp: message["timestamp"],
106
+ toolName: message["toolName"],
107
+ isError: message["isError"]
104
108
  }
105
109
  };
106
110
  }
@@ -1,5 +1,5 @@
1
- import { ao as SANDBOX_COMMAND_PATH, ho as runNonInteractiveCommand, lo as SANDBOX_WORKSPACE_ROOT } from "./projection-CcFBVFUo.js";
2
- import { E as withSpan, b as setSpanAttributes } from "./logging-BPNTQVFu.js";
1
+ import { Ca as SANDBOX_WORKSPACE_ROOT, ka as runNonInteractiveCommand, ya as SANDBOX_COMMAND_PATH } from "./projection-CWXDE0f6.js";
2
+ import { E as withSpan, b as setSpanAttributes } from "./logging-oYpJYr-S.js";
3
3
  // src/chat/sandbox/resources.ts
4
4
  let configuredResources;
5
5
  function resourcesFromEnv() {
@@ -1,10 +1,10 @@
1
1
  import { a as getClient, c as init, i as getActiveSpan, o as getGlobalScope, p as spanToJSON, s as getTraceData } from "./sentry-CPbZjomA.js";
2
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-D2pOzBNl.js";
2
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-YE54gMN8.js";
3
3
  import { n as isPushServiceHost } from "./push-endpoint-CO-nomUd.js";
4
4
  import { n as redactSandboxEgressProxyPath } from "./proxy-path-BHYoKZdq.js";
5
5
  import { n as promoteHttpRouteName, r as routeNameMiddleware, t as nameRequestRoute } from "./sentry-route-name-C6EIzAGP.js";
6
6
  import { t as consumePrivateTraceResultMarker } from "./private-trace-result-CE7_lEdq.js";
7
- import { B as getDeploymentServiceVersion, V as getDeploymentTelemetryAttributes } from "./logging-BPNTQVFu.js";
7
+ import { B as getDeploymentServiceVersion, V as getDeploymentTelemetryAttributes } from "./logging-oYpJYr-S.js";
8
8
  import { performance } from "node:perf_hooks";
9
9
  import { subscribe, unsubscribe } from "node:diagnostics_channel";
10
10
  // src/chat/pi/gateway-request-timing.ts
@@ -1,5 +1,5 @@
1
- import { A as conversationKindFromRow, o as getDb } from "./db-DU84dCVu.js";
2
- import { N as juniorConversations } from "./executor-CFyrgOu1.js";
1
+ import { A as conversationKindFromRow, o as getDb } from "./db-DV2ZUb1Y.js";
2
+ import { F as juniorConversations } from "./executor-CjNhwwnj.js";
3
3
  import { desc, eq, sql } from "drizzle-orm";
4
4
  // src/chat/conversations/lineage.ts
5
5
  /**
@@ -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-CPbZjomA.js";
2
- import { t as JUNIOR_VERSION } from "./version-qROlRQGF.js";
2
+ import { t as JUNIOR_VERSION } from "./version-BFmuwgxP.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";
@@ -1,12 +1,12 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { M as toolInvocationDestination, j as actorFromRun } from "./agent-runner-C5d6rY5g.js";
3
- import { Cn as AgentMessagePausedError, Dn as PARENT_AGENT_TARGET, Gt as getLatestAgentInvocationForConversation, Ht as getActiveAgentInvocationForConversation, Tn as findChildAgentConversationId, bn as createAgentInvocationForMessage, fn as enqueueAgentInvocation, tn as readChildConversationSender, wn as AgentMessageTargetError } from "./warmup--Gkz7iB-.js";
4
- import { a as enqueueAgentMessageToParent } from "./result-icDrueyB.js";
5
- import { Kn as renderUntrustedTag, vo as canAccessConversation, xo as readConversationAccessFromSql } from "./projection-CcFBVFUo.js";
6
- import { n as botConfig } from "./config-CBZp0udd.js";
7
- import { P as SYSTEM_IDENTITY_ID, a as getConversationStore, o as getDb } from "./db-DU84dCVu.js";
8
- import { L as postAutomatedTurnLimitNoticeForConversation, W as admitAutomatedTurn, k as EVENT_WAIT_MS } from "./session-stop-uotLtp4g.js";
9
- import { r as appendAndEnqueueInboundMessage } from "./store-Ca6G962n.js";
2
+ import { M as toolInvocationDestination, j as actorFromRun } from "./agent-runner-BaLjEjPR.js";
3
+ import { $t as readChildConversationSender, Bt as getActiveAgentInvocationForConversation, Cn as findChildAgentConversationId, Sn as AgentMessageTargetError, Tn as PARENT_AGENT_TARGET, Ut as getLatestAgentInvocationForConversation, un as enqueueAgentInvocation, vn as createAgentInvocationForMessage, xn as AgentMessagePausedError } from "./warmup-mTMIatCV.js";
4
+ import { a as enqueueAgentMessageToParent } from "./result-BmF9v9bv.js";
5
+ import { Fa as readConversationAccessFromSql, Ma as canAccessConversation } from "./projection-CWXDE0f6.js";
6
+ import { Z as renderUntrustedTag, n as botConfig } from "./config-DUD-zMvp.js";
7
+ import { P as SYSTEM_IDENTITY_ID, a as getConversationStore, o as getDb } from "./db-DV2ZUb1Y.js";
8
+ import { $ as postAutomatedTurnLimitNoticeForConversation, F as EVENT_WAIT_MS, ot as admitAutomatedTurn } from "./session-stop-BQxgHR4X.js";
9
+ import { r as appendAndEnqueueInboundMessage } from "./store-Dz3YZ7gQ.js";
10
10
  // src/chat/agent-invocations/top-level-message.ts
11
11
  const AGENT_MESSAGE_EVENT_NAMESPACE = "junior";
12
12
  /** Event type of a message from another top-level agent. */
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { s as getSqlExecutor } from "./db-DU84dCVu.js";
3
- import { h as isVisionImageMediaType, m as detectImageMediaType } from "./web-message-id-lNodcCOI.js";
4
- import { Jo as readLiveAttachment } from "./projection-CcFBVFUo.js";
2
+ import { s as getSqlExecutor } from "./db-DV2ZUb1Y.js";
3
+ import { h as isVisionImageMediaType, m as detectImageMediaType } from "./web-message-id-CUaSiGme.js";
4
+ import { co as readLiveAttachment } from "./projection-CWXDE0f6.js";
5
5
  // src/chat/attachments/model-input.ts
6
6
  var model_input_exports = /* @__PURE__ */ __exportAll({ loadInputAttachments: () => loadInputAttachments });
7
7
  /** Largest file that Slack and web send to the model in the prompt. */
package/dist/nitro.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as JuniorPluginSet } from "./plugins-B_0Cr0MO.js";
2
- import { i as JuniorDashboardOptions } from "./app-Cs157Zc5.js";
2
+ import { i as JuniorDashboardOptions } from "./app-DvYbM9UD.js";
3
3
  import { withSentryConfig as withSentryConfig$1 } from "@sentry/nitro";
4
4
  type SentryNitroConfig = Parameters<typeof withSentryConfig$1>[0];
5
5
  type SentryNitroOptions = NonNullable<Parameters<typeof withSentryConfig$1>[1]>;
package/dist/nitro.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-x4AvVhMj.js";
2
2
  import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-Bkk0XRo2.js";
3
- import { o as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, t as CACHE_WARMUP_QUEUE_TOPIC } from "./queue-B2AAL3ym.js";
4
- import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-BLPZU6kC.js";
5
- import { s as resolveConversationWorkQueueTopic, t as BACKGROUND_COMPACTION_QUEUE_TOPIC } from "./background-compaction-queue-BTqMIfTA.js";
6
- import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, B as getDeploymentServiceVersion, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_CRON_SCHEDULE, I as JUNIOR_RETENTION_ROUTE, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_CRON_SCHEDULE, N as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, k as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE } from "./logging-BPNTQVFu.js";
3
+ import { o as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, t as CACHE_WARMUP_QUEUE_TOPIC } from "./queue-7FSijgqG.js";
4
+ import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-CFlrJguF.js";
5
+ import { s as resolveConversationWorkQueueTopic, t as BACKGROUND_COMPACTION_QUEUE_TOPIC } from "./background-compaction-queue-D2wzxtGU.js";
6
+ import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, B as getDeploymentServiceVersion, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_CRON_SCHEDULE, I as JUNIOR_RETENTION_ROUTE, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_CRON_SCHEDULE, N as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, k as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE } from "./logging-oYpJYr-S.js";
7
7
  import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cv2ETe8Y.js";
8
8
  import path from "node:path";
9
9
  import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
@@ -1,5 +1,5 @@
1
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-COqnZ1Dx.js";
2
- import { Yn as createUserTokenStore } from "./projection-CcFBVFUo.js";
1
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-Cdm-e1vJ.js";
2
+ import { Bn as createUserTokenStore } from "./projection-CWXDE0f6.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;