@sentry/junior 0.271.0 → 0.272.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 (71) hide show
  1. package/dist/{adapter-Bqbtr1RV.js → adapter-BDYDi1F9.js} +1 -1
  2. package/dist/{admin-CWBjzyN0.js → admin-Dj7EFycG.js} +1 -1
  3. package/dist/{agent-runner-BiHsH8O_.js → agent-runner-Cl6Usx2Y.js} +320 -271
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +4 -4
  6. package/dist/api.d.ts +1 -1
  7. package/dist/api.js +71 -29
  8. package/dist/{app-C81xfpNa.d.ts → app-DjZblE2J.d.ts} +2 -2
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +29 -36
  11. package/dist/{assistant-reply-DgtX9DaJ.js → assistant-reply-DN2w6JL_.js} +1 -1
  12. package/dist/{automation-Dwh_xcqM.js → automation-CV7g5h3A.js} +1 -1
  13. package/dist/{briefs-0FeSJHQ3.js → briefs-PysAqnjV.js} +4 -4
  14. package/dist/{catalog-runtime-Bw9kjGVu.js → catalog-runtime-BNeCWIaF.js} +1 -1
  15. package/dist/cli/chat.js +14 -14
  16. package/dist/cli/check.js +3 -3
  17. package/dist/cli/main.js +3 -3
  18. package/dist/cli/plugins.js +4 -4
  19. package/dist/cli/snapshot-create.js +4 -4
  20. package/dist/cli/upgrade.d.ts +1 -1
  21. package/dist/cli/upgrade.js +3 -3
  22. package/dist/{client-B0jlQSgO.js → client-FRphcDWW.js} +2 -2
  23. package/dist/{config-DrAeD8sr.js → config-BUP9wjiR.js} +3 -3
  24. package/dist/{connections-BzN2K0G9.js → connections-CesHau9u.js} +10 -10
  25. package/dist/{conversation-AhOVzN_k.js → conversation-BtQzLoK8.js} +12 -1
  26. package/dist/{conversation-privacy-D1NhUxyo.js → conversation-privacy-DiGvA9a3.js} +1 -1
  27. package/dist/{credential-sync-DpNWl4yy.js → credential-sync-D2odJC30.js} +14 -14
  28. package/dist/{credentialed-mh7HBqey.js → credentialed-CgTulRDH.js} +11 -11
  29. package/dist/{db-DSabI7jJ.d.ts → db-BPLmOwXf.d.ts} +11 -1
  30. package/dist/{executor-C2cRw0hZ.js → executor-DGDpyegI.js} +25 -7
  31. package/dist/instrumentation.js +2 -2
  32. package/dist/{job-queue-CEeLYkSj.js → job-queue-CjB97sii.js} +2 -2
  33. package/dist/{list-DjJJ5K0x.js → list-JZUP1yog.js} +35 -51
  34. package/dist/{logging-DuwXUuIY.js → logging-CjkDr-jP.js} +1 -1
  35. package/dist/message-D9y8PKA1.js +186 -0
  36. package/dist/nitro.d.ts +1 -1
  37. package/dist/nitro.js +3 -3
  38. package/dist/{oauth-callback-server-oM5TJt34.js → oauth-callback-server-02Pej6hj.js} +2 -2
  39. package/dist/{prompt-BPSdXYXV.js → prompt-vfceH0c-.js} +1 -1
  40. package/dist/{registry-BPtbAVFo.js → registry-7XgwNgQe.js} +1 -1
  41. package/dist/{resolve-D44G1jJm.js → resolve-CuuxNfWG.js} +3 -3
  42. package/dist/{result-CvP8c5bb.js → result-BRhb6iN1.js} +16 -12
  43. package/dist/{runner-FIGIKvk2.js → runner-DaWCofuS.js} +11 -11
  44. package/dist/{sandbox-egress-signals-C_JzucwP.js → sandbox-egress-signals-Bn6FA1UC.js} +1 -1
  45. package/dist/{schema-DPCvePop.d.ts → schema-CNjAzYOw.d.ts} +15 -3
  46. package/dist/{schema-DKZgO-xf.js → schema-D5VLF4NT.js} +3 -4
  47. package/dist/{service-account-1mJGRAvx.js → service-account-D9vrsi8d.js} +3 -3
  48. package/dist/{service-account-CHO3YXpt.js → service-account-H45LIAG2.js} +3 -3
  49. package/dist/{session-stop-DuUB1rwQ.js → session-stop-HKl0ECX0.js} +50 -24
  50. package/dist/{skills-DHK7L9Eo.js → skills-CsiKu3-g.js} +2 -2
  51. package/dist/{spawn-CKl_ySIq.js → spawn-DqjBxqWh.js} +2 -2
  52. package/dist/{store-BF2XEeQz.js → store-CPF2kzbu.js} +3 -3
  53. package/dist/{store-Di0E4EvU.js → store-DyVKH0QB.js} +47 -30
  54. package/dist/{task-queue-CC7IFtbT.js → task-queue-BbQXCcNX.js} +3 -3
  55. package/dist/{task-runner-DKZtMFwa.js → task-runner-ChzW5E7R.js} +6 -6
  56. package/dist/{thread-state-BQ1T3eeF.js → thread-state-Ds8JTsX6.js} +5 -5
  57. package/dist/{turn-failure-response-B5eSFoHn.js → turn-failure-response-DCMvjsA0.js} +8 -8
  58. package/dist/{turn-lifecycle-CTLEIEOn.js → turn-lifecycle-DM_77q33.js} +1 -1
  59. package/dist/{turn-session-routing-BFVp8TbU.js → turn-session-routing-BV_gX7n3.js} +12 -12
  60. package/dist/{validation-Cjo-3yt3.js → validation-DcGelbBi.js} +1 -1
  61. package/dist/{version-D30MBLLw.js → version-C48azPKq.js} +1 -1
  62. package/dist/version.js +1 -1
  63. package/dist/{viewer-D3jhuP66.js → viewer-BCRuO8Wg.js} +25 -9
  64. package/dist/{work-CL9QwQcl.js → work-zxkmbJAp.js} +27 -11
  65. package/dist/{worker-S2P7IJDI.js → worker-CNNxHF1V.js} +6 -6
  66. package/migrations/0072_conversation_read_positions.sql +10 -0
  67. package/migrations/meta/0072_snapshot.json +4064 -0
  68. package/migrations/meta/_journal.json +7 -0
  69. package/package.json +4 -4
  70. package/dist/message-CRe3WBKc.js +0 -59
  71. package/migrations/AGENTS.md +0 -8
@@ -0,0 +1,186 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
+ import { n as botConfig } from "./config-BUP9wjiR.js";
3
+ import { S as getDb, i as readActorIdentity, j as SYSTEM_IDENTITY_ID, x as getConversationStore } from "./viewer-BCRuO8Wg.js";
4
+ import { Mt as actorFromRun, Nt as toolInvocationDestination } from "./agent-runner-Cl6Usx2Y.js";
5
+ import { or as readConversationAccessFromSql } from "./credentialed-CgTulRDH.js";
6
+ import { A as AgentMessagePausedError, I as PARENT_AGENT_TARGET, M as AgentMessageTargetError, P as findChildAgentConversationId, i as createAgentInvocationForMessage, o as getActiveAgentInvocationForConversation } from "./store-DyVKH0QB.js";
7
+ import { T as postAutomatedTurnLimitNoticeForConversation, a as EVENT_WAIT_MS, k as admitAutomatedTurn } from "./session-stop-HKl0ECX0.js";
8
+ import { r as appendAndEnqueueInboundMessage } from "./store-CPF2kzbu.js";
9
+ import { r as enqueueAgentMessageToParent } from "./result-BRhb6iN1.js";
10
+ import { r as enqueueAgentInvocation } from "./work-zxkmbJAp.js";
11
+ // src/chat/agent-invocations/top-level-message.ts
12
+ const AGENT_MESSAGE_EVENT_NAMESPACE = "junior";
13
+ /** Event type of a message from another top-level agent. */
14
+ const TOP_LEVEL_AGENT_MESSAGE_EVENT_TYPE = "agent.top_level_message";
15
+ /**
16
+ * Check that a top-level agent can message another top-level agent. Both
17
+ * must be in the same provider tenant and have the same scope: public or
18
+ * private. To reach a private agent, the person behind the sender's Actor
19
+ * must be a member of the target Conversation. A system Actor has no
20
+ * person, so it reaches only public agents. Every target that the Actor
21
+ * cannot see gets the same error, so the error does not show that a private
22
+ * Conversation exists.
23
+ */
24
+ async function requireTopLevelAgentAccess(args) {
25
+ const notReachable = new AgentMessageTargetError(`"${args.to}" is not "${PARENT_AGENT_TARGET}", a child agent of this conversation, or a top-level agent that you can message`);
26
+ if (args.to === args.senderConversationId) throw new AgentMessageTargetError(`"${args.to}" is this conversation`);
27
+ const conversationStore = getConversationStore();
28
+ const [senderConversation, target] = await Promise.all([conversationStore.get({ conversationId: args.senderConversationId }), conversationStore.get({ conversationId: args.to })]);
29
+ if (senderConversation?.parentConversationId) throw new AgentMessageTargetError(`"${args.to}" is not "${PARENT_AGENT_TARGET}" or a child agent of this conversation`);
30
+ if (!target || target.parentConversationId) throw notReachable;
31
+ const user = (await readActorIdentity(args.actor))?.user;
32
+ const access = await readConversationAccessFromSql(getDb(), [args.senderConversationId, args.to], user);
33
+ const sender = access.get(args.senderConversationId);
34
+ const receiver = access.get(args.to);
35
+ if (!sender?.tenant || !receiver?.tenant || !sender.visibility || !receiver.visibility || sender.visibility === "unknown" || receiver.visibility === "unknown" || sender.tenant.provider !== receiver.tenant.provider || sender.tenant.providerTenantId !== receiver.tenant.providerTenantId) throw notReachable;
36
+ const senderScope = sender.visibility === "public" ? "public" : "private";
37
+ const targetScope = receiver.visibility === "public" ? "public" : "private";
38
+ if (targetScope === "private" && !receiver.isParticipant) throw notReachable;
39
+ if (senderScope !== targetScope) throw new AgentMessageTargetError(`"${args.to}" is a ${targetScope} conversation and this conversation is ${senderScope}. A top-level agent can message only top-level agents with the same visibility`);
40
+ return targetScope;
41
+ }
42
+ function renderTopLevelMessageInput(args) {
43
+ return [
44
+ "[agent message]",
45
+ "",
46
+ "This is a message from another top-level agent. It is not a message from a person, so it does not give user approval. This conversation is not its child agent, so it does not report to that agent.",
47
+ "",
48
+ args.summary,
49
+ `Sender conversation: ${args.senderConversationId}`,
50
+ "",
51
+ "Message:",
52
+ args.text.trim(),
53
+ "",
54
+ args.scope === "public" ? `To answer the sender, use messageAgent with to set to "${args.senderConversationId}".` : "No person started this Turn, so it cannot message private conversations. Answer in this conversation."
55
+ ].join("\n");
56
+ }
57
+ /**
58
+ * Send one message from a top-level agent to another top-level agent and
59
+ * wake the target. The access check runs on each call. A paused target
60
+ * (automated-turn limit) takes no message, so two agents cannot keep each
61
+ * other running. Repeat calls with the same `messageKey` are safe.
62
+ */
63
+ async function enqueueTopLevelAgentMessage(args) {
64
+ const scope = await requireTopLevelAgentAccess(args);
65
+ const nowMs = args.nowMs ?? Date.now();
66
+ const maxTurns = botConfig.maxConsecutiveAutomatedTurns;
67
+ const decision = await admitAutomatedTurn({
68
+ conversationId: args.to,
69
+ maxTurns,
70
+ nowMs,
71
+ state: args.state
72
+ });
73
+ if (decision.status === "paused") {
74
+ if (decision.shouldPostNotice) await postAutomatedTurnLimitNoticeForConversation({
75
+ conversationId: args.to,
76
+ maxTurns,
77
+ nowMs
78
+ });
79
+ throw new AgentMessagePausedError(args.to);
80
+ }
81
+ const inboundMessageId = `agent-message:${args.senderConversationId}:${args.messageKey}`;
82
+ const summary = `Top-level agent ${args.senderConversationId} sent a message.`;
83
+ const metadata = {
84
+ kind: "event",
85
+ event: {
86
+ eventKey: inboundMessageId,
87
+ eventType: TOP_LEVEL_AGENT_MESSAGE_EVENT_TYPE,
88
+ identifier: args.senderConversationId,
89
+ namespace: AGENT_MESSAGE_EVENT_NAMESPACE,
90
+ trustedSummary: summary
91
+ }
92
+ };
93
+ await appendAndEnqueueInboundMessage({
94
+ message: {
95
+ conversationId: args.to,
96
+ createdAtMs: nowMs,
97
+ delivery: "defer",
98
+ inboundMessageId,
99
+ input: {
100
+ authorId: `agent-message:${args.senderConversationId}`,
101
+ authorIdentityId: SYSTEM_IDENTITY_ID,
102
+ metadata,
103
+ text: renderTopLevelMessageInput({
104
+ scope,
105
+ senderConversationId: args.senderConversationId,
106
+ summary,
107
+ text: args.text
108
+ })
109
+ },
110
+ receivedAtMs: nowMs,
111
+ source: "event"
112
+ },
113
+ queue: args.queue,
114
+ queueDelayMs: EVENT_WAIT_MS,
115
+ state: args.state
116
+ });
117
+ }
118
+ // src/chat/agent-invocations/message.ts
119
+ var message_exports = /* @__PURE__ */ __exportAll({ bindMessageAgent: () => bindMessageAgent });
120
+ /**
121
+ * Bind a Run's Actor and credentials to messages for its parent and child
122
+ * agents, and for other top-level agents. A message to a child continues that
123
+ * child. A message to the parent wakes the parent like a result. A top-level
124
+ * agent can also message another top-level agent that it has access to.
125
+ */
126
+ function bindMessageAgent(run, options) {
127
+ const actor = actorFromRun(run);
128
+ if (!actor) return;
129
+ return async (input, call) => {
130
+ call.signal?.throwIfAborted();
131
+ const queue = typeof options.queue === "function" ? options.queue() : options.queue;
132
+ if (input.to === "parent") {
133
+ const sender = await getActiveAgentInvocationForConversation(run.conversationId);
134
+ if (!sender) throw new AgentMessageTargetError("This conversation has no parent agent");
135
+ await enqueueAgentMessageToParent({
136
+ messageKey: `${run.turnId}:${call.toolCallId}`,
137
+ queue,
138
+ sender,
139
+ state: options.state,
140
+ text: input.text
141
+ });
142
+ return {
143
+ conversationId: sender.parentConversationId,
144
+ delivery: "queued"
145
+ };
146
+ }
147
+ const childConversationId = await findChildAgentConversationId({
148
+ parentConversationId: run.conversationId,
149
+ target: input.to
150
+ });
151
+ if (!childConversationId) {
152
+ await enqueueTopLevelAgentMessage({
153
+ actor,
154
+ messageKey: `${run.turnId}:${call.toolCallId}`,
155
+ queue,
156
+ senderConversationId: run.conversationId,
157
+ state: options.state,
158
+ text: input.text,
159
+ to: input.to
160
+ });
161
+ return {
162
+ conversationId: input.to,
163
+ delivery: "queued"
164
+ };
165
+ }
166
+ const { invocation, queued } = await createAgentInvocationForMessage({
167
+ actor,
168
+ childConversationId,
169
+ ...run.credentialContext ? { credentialContext: run.credentialContext } : void 0,
170
+ destination: toolInvocationDestination(run),
171
+ idempotencyKey: `${run.turnId}:${call.toolCallId}`,
172
+ input: input.text,
173
+ parentConversationId: run.conversationId,
174
+ parentToolCallId: call.toolCallId
175
+ });
176
+ await enqueueAgentInvocation(invocation, {
177
+ ...options,
178
+ queue
179
+ });
180
+ return {
181
+ conversationId: childConversationId,
182
+ delivery: queued ? "queued" : "started"
183
+ };
184
+ };
185
+ }
186
+ export { message_exports as n, bindMessageAgent as t };
package/dist/nitro.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as JuniorDashboardOptions } from "./app-C81xfpNa.js";
1
+ import { i as JuniorDashboardOptions } from "./app-DjZblE2J.js";
2
2
  import { n as JuniorPluginSet } from "./plugins-B_0Cr0MO.js";
3
3
  import { withSentryConfig as withSentryConfig$1 } from "@sentry/nitro";
4
4
  type SentryNitroConfig = Parameters<typeof withSentryConfig$1>[0];
package/dist/nitro.js CHANGED
@@ -1,8 +1,8 @@
1
- import { A as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, D as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, F as getDeploymentServiceVersion, M as JUNIOR_RETENTION_ROUTE, N as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, O as JUNIOR_HEARTBEAT_CRON_SCHEDULE, j as JUNIOR_RETENTION_CRON_SCHEDULE, k as JUNIOR_HEARTBEAT_ROUTE } from "./logging-DuwXUuIY.js";
1
+ import { A as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, D as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, F as getDeploymentServiceVersion, M as JUNIOR_RETENTION_ROUTE, N as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, O as JUNIOR_HEARTBEAT_CRON_SCHEDULE, j as JUNIOR_RETENTION_CRON_SCHEDULE, k as JUNIOR_HEARTBEAT_ROUTE } from "./logging-CjkDr-jP.js";
2
2
  import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-DJBompdd.js";
3
- import { o as resolveConversationWorkQueueTopic, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-CEeLYkSj.js";
3
+ import { o as resolveConversationWorkQueueTopic, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-CjB97sii.js";
4
4
  import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-DOm9Y6qI.js";
5
- import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-CC7IFtbT.js";
5
+ import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-BbQXCcNX.js";
6
6
  import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cf5gVPWP.js";
7
7
  import path from "node:path";
8
8
  import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
@@ -1,5 +1,5 @@
1
- import { n as createUserTokenStore } from "./credentialed-mh7HBqey.js";
2
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-DpNWl4yy.js";
1
+ import { n as createUserTokenStore } from "./credentialed-CgTulRDH.js";
2
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-D2odJC30.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;
@@ -1,4 +1,4 @@
1
- import { J as conversationBriefSchema, Y as parseBriefInput, q as briefOutcomeStatusSchema } from "./conversation-AhOVzN_k.js";
1
+ import { J as briefOutcomeStatusSchema, X as parseBriefInput, Y as conversationBriefSchema } from "./conversation-BtQzLoK8.js";
2
2
  import { z } from "zod";
3
3
  // src/chat/briefs/generate.ts
4
4
  const MAX_INPUT_CHARS = 6e4;
@@ -1,4 +1,4 @@
1
- import { b as setSpanAttributes, h as logWarn, m as logInfo } from "./logging-DuwXUuIY.js";
1
+ import { b as setSpanAttributes, h as logWarn, m as logInfo } from "./logging-CjkDr-jP.js";
2
2
  import { o as isUserActor, s as parseActorUserId } from "./actor-B4DYygOB.js";
3
3
  import { n as normalizePluginPackageNames, o as pluginRoots, t as discoverInstalledPluginPackageContent } from "./package-discovery-DJBompdd.js";
4
4
  import path from "node:path";
@@ -1,6 +1,6 @@
1
- import { E as withSpan, b as setSpanAttributes } from "./logging-DuwXUuIY.js";
2
- import { Kn as runNonInteractiveCommand, Nn as sleep, Qn as SANDBOX_WORKSPACE_ROOT, it as isStale, nt as create, ot as getSandboxProvider, qn as SANDBOX_COMMAND_PATH } from "./credentialed-mh7HBqey.js";
3
- import { r as getStateAdapter } from "./adapter-Bqbtr1RV.js";
1
+ import { E as withSpan, b as setSpanAttributes } from "./logging-CjkDr-jP.js";
2
+ import { Kn as runNonInteractiveCommand, Nn as sleep, Qn as SANDBOX_WORKSPACE_ROOT, it as isStale, nt as create, ot as getSandboxProvider, qn as SANDBOX_COMMAND_PATH } from "./credentialed-CgTulRDH.js";
3
+ import { r as getStateAdapter } from "./adapter-BDYDi1F9.js";
4
4
  import { z } from "zod";
5
5
  // src/chat/sandbox/resources.ts
6
6
  let configuredResources;
@@ -1,14 +1,14 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { On as getTurnRecord, kn as listTurnSummaries } from "./turn-session-routing-BFVp8TbU.js";
2
+ import { On as getTurnRecord, kn as listTurnSummaries } from "./turn-session-routing-BV_gX7n3.js";
3
3
  import { t as createActor } from "./actor-B4DYygOB.js";
4
- import { j as SYSTEM_IDENTITY_ID } from "./viewer-D3jhuP66.js";
5
- import { f as credentialContextForActor } from "./registry-BPtbAVFo.js";
6
- import { xt as listUnreportedSiblingAgents } from "./agent-runner-BiHsH8O_.js";
7
- import { a as EVENT_SYSTEM_ACTOR, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage } from "./prompt-BPSdXYXV.js";
8
- import { C as markAgentInvocationParentMailboxAppended, _ as getLatestAgentInvocationForConversation, a as createAgentInvocationFromLatest, c as getAgentInvocation, d as getAgentInvocationIdForResult, l as getAgentInvocationIdForEvents, p as getAgentInvocationResultMessageId, u as getAgentInvocationIdForMessage, y as isTerminalAgentInvocation } from "./store-Di0E4EvU.js";
9
- import { a as EVENT_WAIT_MS, c as isEventMailboxMetadata, l as renderEventBatchText, u as timerWatchCredentialSubject } from "./session-stop-DuUB1rwQ.js";
10
- import { r as appendAndEnqueueInboundMessage } from "./store-BF2XEeQz.js";
11
- import { i as resolveAgentInvocationId, r as enqueueAgentInvocation, t as createAgentInvocationWorker } from "./work-CL9QwQcl.js";
4
+ import { j as SYSTEM_IDENTITY_ID } from "./viewer-BCRuO8Wg.js";
5
+ import { f as credentialContextForActor } from "./registry-7XgwNgQe.js";
6
+ import { St as listUnreportedSiblingAgents } from "./agent-runner-Cl6Usx2Y.js";
7
+ import { a as EVENT_SYSTEM_ACTOR, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage } from "./prompt-vfceH0c-.js";
8
+ import { C as markAgentInvocationParentMailboxAppended, a as createAgentInvocationFromLatest, c as getAgentInvocationIdForEvents, f as getAgentInvocationResultMessageId, g as getLatestAgentInvocationForConversation, l as getAgentInvocationIdForMessage, s as getAgentInvocation, u as getAgentInvocationIdForResult, v as isTerminalAgentInvocation } from "./store-DyVKH0QB.js";
9
+ import { a as EVENT_WAIT_MS, c as isEventMailboxMetadata, l as renderEventBatchText, u as timerWatchCredentialSubject } from "./session-stop-HKl0ECX0.js";
10
+ import { r as appendAndEnqueueInboundMessage } from "./store-CPF2kzbu.js";
11
+ import { i as resolveAgentInvocationId, r as enqueueAgentInvocation, t as createAgentInvocationWorker } from "./work-zxkmbJAp.js";
12
12
  import { z } from "zod";
13
13
  import { createEventSource, createLocalSource, createWebSource } from "@sentry/junior-plugin-api";
14
14
  // src/chat/conversations/web-mailbox.ts
@@ -62,10 +62,14 @@ async function getActiveConversationTurnId(conversationId) {
62
62
  const record = await getTurnRecord(conversationId, turnId);
63
63
  return record && (record.source?.kind === "web" || !record.source && record.surface === "api") && !record.dispatchId && (record.state === "paused" || record.state === "running") ? turnId : void 0;
64
64
  }
65
+ /** Return the web and event mailbox Turns that are paused or running. */
66
+ async function listActiveMailboxTurns(conversationId) {
67
+ const summaries = await listTurnSummaries(conversationId);
68
+ return (await Promise.all(summaries.filter((summary) => !summary.dispatchId && (summary.state === "paused" || summary.state === "running")).map((summary) => getTurnRecord(conversationId, summary.turnId)))).filter((record) => record !== void 0 && !record.dispatchId && (record.source?.kind === "web" || record.source?.kind === "event" || !record.source && (record.surface === "api" || hasEventActor(record.actors))) && (record.state === "paused" || record.state === "running"));
69
+ }
65
70
  /** Return the active web or event mailbox Turn. */
66
71
  async function getActiveMailboxTurnId(conversationId) {
67
- const summaries = await listTurnSummaries(conversationId);
68
- const active = (await Promise.all(summaries.filter((summary) => !summary.dispatchId && (summary.state === "paused" || summary.state === "running")).map((summary) => getTurnRecord(conversationId, summary.turnId)))).filter((record) => record && !record.dispatchId && (record.source?.kind === "web" || record.source?.kind === "event" || !record.source && (record.surface === "api" || hasEventActor(record.actors))) && (record.state === "paused" || record.state === "running"));
72
+ const active = await listActiveMailboxTurns(conversationId);
69
73
  if (active.length > 1) throw new Error(`Conversation ${conversationId} has multiple active mailbox Turns`);
70
74
  return active[0]?.turnId;
71
75
  }
@@ -476,4 +480,4 @@ async function withAgentInvocationResultActors(work) {
476
480
  }))
477
481
  };
478
482
  }
479
- export { withAgentInvocationResultActors as a, resolveMailboxTurnWork as c, legacyWebMailboxMetadataSchema as d, result_exports as i, sourceFromTurnInput as l, enqueueAgentInvocationResult as n, getAuthPausedConversationTurnId as o, enqueueAgentMessageToParent as r, getEventBatchDelayMs as s, createChildConversationWorker as t, turnInputFactsFromConversationMessage as u };
483
+ export { withAgentInvocationResultActors as a, listActiveMailboxTurns as c, turnInputFactsFromConversationMessage as d, legacyWebMailboxMetadataSchema as f, result_exports as i, resolveMailboxTurnWork as l, enqueueAgentInvocationResult as n, getAuthPausedConversationTurnId as o, enqueueAgentMessageToParent as r, getEventBatchDelayMs as s, createChildConversationWorker as t, sourceFromTurnInput as u };
@@ -1,14 +1,14 @@
1
- import { At as loadProjection, Gt as hydrateConversationMessages, Kt as persistConversationMessages, Lt as recordAuthorizationCompleted, Tt as commitAcceptedReply, an as markConversationMessage, en as buildConversationContext, gr as persistWithRetry, ln as upsertConversationMessage, on as normalizeConversationText, pn as authorizationId, sn as recordDeliveredAssistantMessage, wn as saveTurnCheckpoint } from "./turn-session-routing-BFVp8TbU.js";
2
- import { S as setTags, T as withLogContext, p as logException } from "./logging-DuwXUuIY.js";
3
- import { j as SYSTEM_IDENTITY_ID, x as getConversationStore, y as getConversationEventStore } from "./viewer-D3jhuP66.js";
4
- import { f as credentialContextForActor } from "./registry-BPtbAVFo.js";
5
- import { R as messageCardText } from "./conversation-AhOVzN_k.js";
6
- import { X as markTurnFailed, Z as startActiveTurn } from "./store-Di0E4EvU.js";
7
- import { n as getAssistantReplyText } from "./assistant-reply-DgtX9DaJ.js";
8
- import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-CTLEIEOn.js";
9
- import { a as persistThreadStateById, n as getPersistedSandboxState, o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-BQ1T3eeF.js";
10
- import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-DKZtMFwa.js";
11
- import { i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, t as finalizeFailedTurnReplyWithEvent, u as loadPendingMessageCards } from "./turn-failure-response-B5eSFoHn.js";
1
+ import { At as loadProjection, Gt as hydrateConversationMessages, Kt as persistConversationMessages, Lt as recordAuthorizationCompleted, Tt as commitAcceptedReply, an as markConversationMessage, en as buildConversationContext, gr as persistWithRetry, ln as upsertConversationMessage, on as normalizeConversationText, pn as authorizationId, sn as recordDeliveredAssistantMessage, wn as saveTurnCheckpoint } from "./turn-session-routing-BV_gX7n3.js";
2
+ import { S as setTags, T as withLogContext, p as logException } from "./logging-CjkDr-jP.js";
3
+ import { j as SYSTEM_IDENTITY_ID, x as getConversationStore, y as getConversationEventStore } from "./viewer-BCRuO8Wg.js";
4
+ import { f as credentialContextForActor } from "./registry-7XgwNgQe.js";
5
+ import { z as messageCardText } from "./conversation-BtQzLoK8.js";
6
+ import { $ as startActiveTurn, Q as markTurnFailed } from "./store-DyVKH0QB.js";
7
+ import { n as getAssistantReplyText } from "./assistant-reply-DN2w6JL_.js";
8
+ import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-DM_77q33.js";
9
+ import { a as persistThreadStateById, n as getPersistedSandboxState, o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-Ds8JTsX6.js";
10
+ import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-ChzW5E7R.js";
11
+ import { i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, t as finalizeFailedTurnReplyWithEvent, u as loadPendingMessageCards } from "./turn-failure-response-DCMvjsA0.js";
12
12
  import { randomUUID } from "node:crypto";
13
13
  import { createLocalSource, localDestinationSchema } from "@sentry/junior-plugin-api";
14
14
  // src/chat/local/runner.ts
@@ -1,4 +1,4 @@
1
- import { Kt as sandboxEgressSignalsResponseSchema } from "./credentialed-mh7HBqey.js";
1
+ import { Kt as sandboxEgressSignalsResponseSchema } from "./credentialed-CgTulRDH.js";
2
2
  // src/chat/local/sandbox-egress-signals.ts
3
3
  const SANDBOX_EGRESS_SIGNALS_PATH = "/api/internal/sandbox-egress/signals";
4
4
  const LOCAL_DEV_SERVER_TIMEOUT_MS = 1e3;
@@ -1729,6 +1729,9 @@ declare const conversationDetailReportSchema: z.ZodObject<{
1729
1729
  label: z.ZodString;
1730
1730
  }, z.core.$strict>>>;
1731
1731
  canFork: z.ZodOptional<z.ZodBoolean>;
1732
+ readPosition: z.ZodOptional<z.ZodObject<{
1733
+ lastReadSeq: z.ZodNumber;
1734
+ }, z.core.$strict>>;
1732
1735
  forkedFromConversationId: z.ZodOptional<z.ZodString>;
1733
1736
  forkedFromTitle: z.ZodOptional<z.ZodString>;
1734
1737
  forks: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -2880,6 +2883,17 @@ declare const stopConversationTurnResponseSchema: z.ZodObject<{
2880
2883
  }, z.core.$strict>>;
2881
2884
  }, z.core.$strict>;
2882
2885
  type StopConversationTurnResponse = z.infer<typeof stopConversationTurnResponseSchema>;
2886
+ /**
2887
+ * How far the signed-in viewer has read a Conversation transcript.
2888
+ *
2889
+ * `lastReadSeq` is the event sequence of the last transcript row the viewer
2890
+ * saw. The server keeps the highest value it receives, so it only moves
2891
+ * forward.
2892
+ */
2893
+ declare const conversationReadPositionSchema: z.ZodObject<{
2894
+ lastReadSeq: z.ZodNumber;
2895
+ }, z.core.$strict>;
2896
+ type ConversationReadPosition = z.infer<typeof conversationReadPositionSchema>;
2883
2897
  /**
2884
2898
  * One direct child agent of a Conversation, from agent invocation records.
2885
2899
  *
@@ -5946,8 +5960,6 @@ declare const reviewItemWaitingConversationsSchema: z.ZodObject<{
5946
5960
  /** One person action on a Review item. */
5947
5961
  declare const reviewItemActionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
5948
5962
  action: z.ZodLiteral<"take">;
5949
- }, z.core.$strict>, z.ZodObject<{
5950
- action: z.ZodLiteral<"complete">;
5951
5963
  }, z.core.$strict>, z.ZodObject<{
5952
5964
  action: z.ZodLiteral<"dismiss">;
5953
5965
  }, z.core.$strict>, z.ZodObject<{
@@ -5958,4 +5970,4 @@ declare const reviewItemActionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
5958
5970
  }, z.core.$strict>;
5959
5971
  }, z.core.$strict>], "action">;
5960
5972
  type ReviewItemActionBody = z.output<typeof reviewItemActionSchema>;
5961
- export { automationExecutionStatusDaySchema as $, ConversationReportEvent as $n, codePersonReportSchema as $r, LocationSummaryReport as $t, StatsReport as A, ConversationStatsReport as An, conversationPendingMessageSchema as Ar, createPersonalTokenBodySchema as At, AutomationRun as B, ConversationActivityPreview as Bn, steerConversationPendingMessagesResponseSchema as Br, startServiceAccountSignInResponseSchema as Bt, pluginPackageContentReportSchema as C, INPUT_IMAGE_TYPES as Ci, ConversationChildAgentsReport as Cn, conversationEventPageSchema as Cr, workspaceListSchema as Ct, skillReportSchema as D, stopConversationTurnResponseSchema as Dn, conversationParamsSchema as Dr, USER_CUSTOMIZATION_MAX_CHARS as Dt, runtimeInfoReportSchema as E, StopConversationTurnResponse as En, conversationFeedSchema as Er, workspaceSchema as Et, AutomationExecutionDay as F, ActorIdentity as Fn, createConversationBodySchema as Fr, revokePersonalTokenResponseSchema as Ft, AutomationUpdate as G, ConversationEventHistory as Gn, CodeOverviewReport as Gr, startConnectionResponseSchema as Gt, AutomationRunWindows as H, ConversationAuxiliaryCosts as Hn, conversationTurnFailureReasonSchema as Hr, connectionParamsSchema as Ht, AutomationExecutionList as I, ArchiveConversationBody as In, createConversationMessageBodySchema as Ir, disconnectServiceAccountResponseSchema as It, automationEditErrorSchema as J, ConversationModelUsage as Jn, CodeRepositorySummary as Jr, LocationActivityDayReport as Jt, AutomationVersionList as K, ConversationEventPage as Kn, CodePersonReport as Kr, ApiError as Kt, AutomationExecutionStatusDay as L, ArchiveConversationResponse as Ln, forkConversationBodySchema as Lr, serviceAccountListSchema as Lt, statsReportSchema as M, GuardianStats as Mn, conversationReportEventDataSchema as Mr, personalTokenListSchema as Mt, AutomationEdit as N, conversationStatsReportSchema as Nn, conversationReportEventSchema as Nr, personalTokenMetadataSchema as Nt, skillReportsSchema as O, ConversationMetricDay as On, conversationPendingAuthorizationSchema as Or, userCustomizationSchema as Ot, AutomationExecution as P, AcceptedConversationMessage as Pn, conversationSummaryReportSchema as Pr, personalTokenParamsSchema as Pt, automationExecutionSchema as Q, ConversationPendingMessagesReport as Qn, codeOverviewReportSchema as Qr, LocationParams as Qt, AutomationList as R, CancelConversationPendingMessagesBody as Rn, forkConversationResponseSchema as Rr, serviceAccountParamsSchema as Rt, pluginPackageContentItemReportSchema as S, MessageAttachment as Si, ConversationChildAgent as Sn, conversationEventHistorySchema as Sr, workspaceBodySchema as St, pluginsSchema as T, conversationChildAgentsReportSchema as Tn, conversationFeedQuerySchema as Tr, workspaceRepoSchema as Tt, AutomationScheduleIntent as U, ConversationCost as Un, CodeActivityDay as Ur, connectionSchema as Ut, AutomationRunList as V, ConversationAgentTreeNode as Vn, conversationTurnFailureCodeSchema as Vr, connectionListSchema as Vt, AutomationSummary as W, ConversationDetailReport as Wn, CodeChangeSummaryReport as Wr, disconnectConnectionResponseSchema as Wt, automationEventCatalogSchema as X, ConversationPendingMessage as Xn, codeChangeSummaryReportSchema as Xr, LocationDetailReport as Xt, automationEditSchema as Y, ConversationParams as Yn, codeActivityDaySchema as Yr, LocationActorSummaryReport as Yt, automationExecutionListSchema as Z, ConversationPendingMessageDelivery as Zn, codeChangeSummarySchema as Zr, LocationDirectoryReport as Zt, SkillReport as _, normalizeUserInputAnswer as _i, personalSpendReportSchema as _n, cancelConversationPendingMessagesResponseSchema as _r, BaselineSnapshotReport as _t, reviewItemCountSchema as a, DailyConversationActivity as ai, ActorDirectoryReport as an, ConversationSurface as ar, automationRunSchema as at, pluginOperationalReportFeedSchema as b, MAX_INPUT_IMAGES as bi, conversationWatchSchema as bn, conversationDetailQuerySchema as br, baselineSnapshotSchema as bt, reviewItemWaitingConversationsSchema as c, messageCardText as ci, ActorSummaryReport as cn, ConversationUsage as cr, automationSchedulePreviewSchema as ct, PluginOperationalReport as d, USER_INPUT_NOTE as di, PeopleActivityDayReport as dn, SteerConversationPendingMessagesBody as dr, automationVersionActivateSchema as dt, codeRepositoryParamsSchema as ei, locationActivityDayReportSchema as en, ConversationReportEventData as er, automationExecutionStatusSchema as et, PluginOperationalReportFeed as f, UserInputAnswer as fi, PersonParams as fn, SteerConversationPendingMessagesResponse as fr, automationVersionListSchema as ft, RuntimeInfoReport as g, isEmptyUserInputAnswer as gi, personParamsSchema as gn, cancelConversationPendingMessagesBodySchema as gr, scheduledAutomationSummarySchema as gt, Plugins as h, buttonUserInputField as hi, actorProfileReportSchema as hn, archiveConversationResponseSchema as hr, eventAutomationSummarySchema as ht, reviewItemActionSchema as i, conversationChildAgentTotalsSchema as ii, ActorActivityDayReport as in, ConversationSummaryReport as ir, automationRunListSchema as it, statSchema as j, GuardianMetricDay as jn, conversationPendingMessagesReportSchema as jr, createdPersonalTokenSchema as jt, StatReport as k, ConversationStatsItem as kn, conversationPendingMessageDeliverySchema as kr, PersonalTokenMetadata as kt, HealthReport as l, resolveMessageCards as li, ActorTotalsReport as ln, CreateConversationBody as lr, automationSummarySchema as lt, PluginPackageContentReport as m, UserInputRequest as mi, actorDirectoryReportSchema as mn, archiveConversationBodySchema as mr, automationVersionSchema as mt, ReviewItemActionBody as n, codeRepositorySummarySchema as ni, locationDirectoryReportSchema as nn, ConversationReportStatus as nr, automationListSchema as nt, reviewItemListSchema as o, dailyConversationActivitySchema as oi, ActorDirectoryWindows as on, ConversationTurnFailureCode as or, automationRunWindowsSchema as ot, PluginPackageContentItemReport as p, UserInputField as pi, PersonalSpendReport as pn, acceptedConversationMessageSchema as pr, automationVersionParamsSchema as pt, ListedAutomationVersion as q, ConversationFeed as qn, CodeRepositoryReport as qr, apiErrorSchema as qt, ReviewItemPayload as r, ConversationChildAgentTotals as ri, locationParamsSchema as rn, ConversationSourceTask as rr, automationParamsSchema as rt, reviewItemSchema as s, MessageCard as si, ActorProfileReport as sn, ConversationTurnFailureReason as sr, automationScheduleIntentSchema as st, OwnedObjectAnnotation$1 as t, codeRepositoryReportSchema as ti, locationDetailReportSchema as tn, ConversationReportMessageEvent as tr, automationListQuerySchema as tt, Plugin as u, AutomationCard as ui, ActorWindowMetrics as un, CreateConversationMessageBody as ur, automationUpdateSchema as ut, SkillReports as v, webMessageId as vi, ConversationWatch as vn, conversationActivityPreviewSchema as vr, WorkspaceListReport as vt, pluginSchema as w, conversationChildAgentSchema as wn, conversationEventsQuerySchema as wr, workspaceParamsSchema as wt, pluginOperationalReportSchema as x, MAX_INPUT_IMAGE_BYTES as xi, conversationWatchesReportSchema as xn, conversationDetailReportSchema as xr, deleteWorkspaceResponseSchema as xt, healthReportSchema as y, InputImage as yi, ConversationWatchesReport as yn, conversationAuxiliaryCostsSchema as yr, WorkspaceReport as yt, AutomationListQuery as z, CancelConversationPendingMessagesResponse as zn, steerConversationPendingMessagesBodySchema as zr, serviceAccountSchema as zt };
5973
+ export { automationExecutionStatusDaySchema as $, ConversationPendingMessageDelivery as $n, codeChangeSummarySchema as $r, LocationSummaryReport as $t, StatsReport as A, ConversationMetricDay as An, conversationPendingAuthorizationSchema as Ar, createPersonalTokenBodySchema as At, AutomationRun as B, CancelConversationPendingMessagesBody as Bn, forkConversationResponseSchema as Br, startServiceAccountSignInResponseSchema as Bt, pluginPackageContentReportSchema as C, MAX_INPUT_IMAGE_BYTES as Ci, ConversationChildAgentsReport as Cn, conversationDetailReportSchema as Cr, workspaceListSchema as Ct, skillReportSchema as D, conversationReadPositionSchema as Dn, conversationFeedQuerySchema as Dr, USER_CUSTOMIZATION_MAX_CHARS as Dt, runtimeInfoReportSchema as E, ConversationReadPosition as En, conversationEventsQuerySchema as Er, workspaceSchema as Et, AutomationExecutionDay as F, conversationStatsReportSchema as Fn, conversationReportEventSchema as Fr, revokePersonalTokenResponseSchema as Ft, AutomationUpdate as G, ConversationCost as Gn, CodeActivityDay as Gr, startConnectionResponseSchema as Gt, AutomationRunWindows as H, ConversationActivityPreview as Hn, steerConversationPendingMessagesResponseSchema as Hr, connectionParamsSchema as Ht, AutomationExecutionList as I, AcceptedConversationMessage as In, conversationSummaryReportSchema as Ir, disconnectServiceAccountResponseSchema as It, automationEditErrorSchema as J, ConversationEventPage as Jn, CodePersonReport as Jr, LocationActivityDayReport as Jt, AutomationVersionList as K, ConversationDetailReport as Kn, CodeChangeSummaryReport as Kr, ApiError as Kt, AutomationExecutionStatusDay as L, ActorIdentity as Ln, createConversationBodySchema as Lr, serviceAccountListSchema as Lt, statsReportSchema as M, ConversationStatsReport as Mn, conversationPendingMessageSchema as Mr, personalTokenListSchema as Mt, AutomationEdit as N, GuardianMetricDay as Nn, conversationPendingMessagesReportSchema as Nr, personalTokenMetadataSchema as Nt, skillReportsSchema as O, StopConversationTurnResponse as On, conversationFeedSchema as Or, userCustomizationSchema as Ot, AutomationExecution as P, GuardianStats as Pn, conversationReportEventDataSchema as Pr, personalTokenParamsSchema as Pt, automationExecutionSchema as Q, ConversationPendingMessage as Qn, codeChangeSummaryReportSchema as Qr, LocationParams as Qt, AutomationList as R, ArchiveConversationBody as Rn, createConversationMessageBodySchema as Rr, serviceAccountParamsSchema as Rt, pluginPackageContentItemReportSchema as S, MAX_INPUT_IMAGES as Si, ConversationChildAgent as Sn, conversationDetailQuerySchema as Sr, workspaceBodySchema as St, pluginsSchema as T, INPUT_IMAGE_TYPES as Ti, conversationChildAgentsReportSchema as Tn, conversationEventPageSchema as Tr, workspaceRepoSchema as Tt, AutomationScheduleIntent as U, ConversationAgentTreeNode as Un, conversationTurnFailureCodeSchema as Ur, connectionSchema as Ut, AutomationRunList as V, CancelConversationPendingMessagesResponse as Vn, steerConversationPendingMessagesBodySchema as Vr, connectionListSchema as Vt, AutomationSummary as W, ConversationAuxiliaryCosts as Wn, conversationTurnFailureReasonSchema as Wr, disconnectConnectionResponseSchema as Wt, automationEventCatalogSchema as X, ConversationModelUsage as Xn, CodeRepositorySummary as Xr, LocationDetailReport as Xt, automationEditSchema as Y, ConversationFeed as Yn, CodeRepositoryReport as Yr, LocationActorSummaryReport as Yt, automationExecutionListSchema as Z, ConversationParams as Zn, codeActivityDaySchema as Zr, LocationDirectoryReport as Zt, SkillReport as _, buttonUserInputField as _i, personalSpendReportSchema as _n, archiveConversationResponseSchema as _r, BaselineSnapshotReport as _t, reviewItemCountSchema as a, ConversationChildAgentTotals as ai, ActorDirectoryReport as an, ConversationSourceTask as ar, automationRunSchema as at, pluginOperationalReportFeedSchema as b, webMessageId as bi, conversationWatchSchema as bn, conversationActivityPreviewSchema as br, baselineSnapshotSchema as bt, reviewItemWaitingConversationsSchema as c, dailyConversationActivitySchema as ci, ActorSummaryReport as cn, ConversationTurnFailureCode as cr, automationSchedulePreviewSchema as ct, PluginOperationalReport as d, resolveMessageCards as di, PeopleActivityDayReport as dn, CreateConversationBody as dr, automationVersionActivateSchema as dt, codeOverviewReportSchema as ei, locationActivityDayReportSchema as en, ConversationPendingMessagesReport as er, automationExecutionStatusSchema as et, PluginOperationalReportFeed as f, AutomationCard as fi, PersonParams as fn, CreateConversationMessageBody as fr, automationVersionListSchema as ft, RuntimeInfoReport as g, UserInputRequest as gi, personParamsSchema as gn, archiveConversationBodySchema as gr, scheduledAutomationSummarySchema as gt, Plugins as h, UserInputField as hi, actorProfileReportSchema as hn, acceptedConversationMessageSchema as hr, eventAutomationSummarySchema as ht, reviewItemActionSchema as i, codeRepositorySummarySchema as ii, ActorActivityDayReport as in, ConversationReportStatus as ir, automationRunListSchema as it, statSchema as j, ConversationStatsItem as jn, conversationPendingMessageDeliverySchema as jr, createdPersonalTokenSchema as jt, StatReport as k, stopConversationTurnResponseSchema as kn, conversationParamsSchema as kr, PersonalTokenMetadata as kt, HealthReport as l, MessageCard as li, ActorTotalsReport as ln, ConversationTurnFailureReason as lr, automationSummarySchema as lt, PluginPackageContentReport as m, UserInputAnswer as mi, actorDirectoryReportSchema as mn, SteerConversationPendingMessagesResponse as mr, automationVersionSchema as mt, ReviewItemActionBody as n, codeRepositoryParamsSchema as ni, locationDirectoryReportSchema as nn, ConversationReportEventData as nr, automationListSchema as nt, reviewItemListSchema as o, conversationChildAgentTotalsSchema as oi, ActorDirectoryWindows as on, ConversationSummaryReport as or, automationRunWindowsSchema as ot, PluginPackageContentItemReport as p, USER_INPUT_NOTE as pi, PersonalSpendReport as pn, SteerConversationPendingMessagesBody as pr, automationVersionParamsSchema as pt, ListedAutomationVersion as q, ConversationEventHistory as qn, CodeOverviewReport as qr, apiErrorSchema as qt, ReviewItemPayload as r, codeRepositoryReportSchema as ri, locationParamsSchema as rn, ConversationReportMessageEvent as rr, automationParamsSchema as rt, reviewItemSchema as s, DailyConversationActivity as si, ActorProfileReport as sn, ConversationSurface as sr, automationScheduleIntentSchema as st, OwnedObjectAnnotation$1 as t, codePersonReportSchema as ti, locationDetailReportSchema as tn, ConversationReportEvent as tr, automationListQuerySchema as tt, Plugin as u, messageCardText as ui, ActorWindowMetrics as un, ConversationUsage as ur, automationUpdateSchema as ut, SkillReports as v, isEmptyUserInputAnswer as vi, ConversationWatch as vn, cancelConversationPendingMessagesBodySchema as vr, WorkspaceListReport as vt, pluginSchema as w, MessageAttachment as wi, conversationChildAgentSchema as wn, conversationEventHistorySchema as wr, workspaceParamsSchema as wt, pluginOperationalReportSchema as x, InputImage as xi, conversationWatchesReportSchema as xn, conversationAuxiliaryCostsSchema as xr, deleteWorkspaceResponseSchema as xt, healthReportSchema as y, normalizeUserInputAnswer as yi, ConversationWatchesReport as yn, cancelConversationPendingMessagesResponseSchema as yr, WorkspaceReport as yt, AutomationListQuery as z, ArchiveConversationResponse as zn, forkConversationBodySchema as zr, serviceAccountSchema as zt };
@@ -1,7 +1,7 @@
1
1
  import { r as AGENT_INVOCATION_STATUSES, u as juniorDestinationKindSchema } from "./agent-invocations-C1RNOCs8.js";
2
- import { E as conversationSummaryReportSchema, F as conversationChildAgentTotalsSchema, O as conversationUsageSchema, l as conversationAuxiliaryCostsSchema, n as actorIdentitySchema } from "./conversation-AhOVzN_k.js";
2
+ import { E as conversationSummaryReportSchema, F as conversationChildAgentTotalsSchema, O as conversationUsageSchema, l as conversationAuxiliaryCostsSchema, n as actorIdentitySchema } from "./conversation-BtQzLoK8.js";
3
3
  import { i as fillUtcHours, r as fillUtcDays, s as sumUtcHoursIntoSixHours, y as userInputRequestSchema } from "./reporting-window-DgHgwQB3.js";
4
- import "./automation-Dwh_xcqM.js";
4
+ import "./automation-CV7g5h3A.js";
5
5
  import "./reporting-schema-CZREhYc-.js";
6
6
  import { z } from "zod";
7
7
  import { codeChangeStateSchema, eventMatchSchema } from "@sentry/junior-plugin-api";
@@ -491,7 +491,7 @@ const reviewItemSchema = z.object({
491
491
  assignees: z.array(personSchema),
492
492
  automationId: z.string().min(1).optional(),
493
493
  body: z.string(),
494
- /** True when the viewer can take, submit, complete, or dismiss it. */
494
+ /** True when the viewer can take, submit, or dismiss it. */
495
495
  canAct: z.boolean(),
496
496
  /** True when the viewer can act and is not already the only assignee. */
497
497
  canTake: z.boolean(),
@@ -558,7 +558,6 @@ const reviewItemParamsSchema = z.object({ id: z.string().min(1) }).strict();
558
558
  /** One person action on a Review item. */
559
559
  const reviewItemActionSchema = z.discriminatedUnion("action", [
560
560
  z.object({ action: z.literal("take") }).strict(),
561
- z.object({ action: z.literal("complete") }).strict(),
562
561
  z.object({ action: z.literal("dismiss") }).strict(),
563
562
  z.object({
564
563
  action: z.literal("submit"),
@@ -1,6 +1,6 @@
1
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Bw9kjGVu.js";
2
- import { t as disconnectStateAdapter } from "./adapter-Bqbtr1RV.js";
3
- import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-CHO3YXpt.js";
1
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BNeCWIaF.js";
2
+ import { t as disconnectStateAdapter } from "./adapter-BDYDi1F9.js";
3
+ import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-H45LIAG2.js";
4
4
  import { CLI_USAGE } from "./cli/run.js";
5
5
  import { createServer } from "node:http";
6
6
  // src/cli/service-account.ts
@@ -1,7 +1,7 @@
1
- import { B as isRecord, b as setSpanAttributes, h as logWarn } from "./logging-DuwXUuIY.js";
2
- import { c as fetchWithBoundedOAuthErrorBodies, i as resolvePluginHeaderEnvRefs } from "./registry-BPtbAVFo.js";
1
+ import { B as isRecord, b as setSpanAttributes, h as logWarn } from "./logging-CjkDr-jP.js";
2
+ import { c as fetchWithBoundedOAuthErrorBodies, i as resolvePluginHeaderEnvRefs } from "./registry-7XgwNgQe.js";
3
3
  import { a as withLock, i as fenceLock, n as MUTATION_LOCK_TTL_MS } from "./locks-D-0h111u.js";
4
- import { r as getStateAdapter } from "./adapter-Bqbtr1RV.js";
4
+ import { r as getStateAdapter } from "./adapter-BDYDi1F9.js";
5
5
  import { AsyncLocalStorage } from "node:async_hooks";
6
6
  import { randomUUID } from "node:crypto";
7
7
  import { UnauthorizedError, auth } from "@modelcontextprotocol/sdk/client/auth.js";
@@ -1,16 +1,16 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { Cr as isAssistantMessage, Dr as normalizeToolNameFromResult, Er as isToolResultMessage, Tr as isToolResultError, dt as CORE_EVENT_NAMESPACE, ht as eventGuidance, mt as eventCatalogEntry } from "./turn-session-routing-BFVp8TbU.js";
3
- import { n as botConfig } from "./config-DrAeD8sr.js";
4
- import { h as logWarn, m as logInfo, p as logException } from "./logging-DuwXUuIY.js";
5
- import { C as getSqlExecutor, j as SYSTEM_IDENTITY_ID, x as getConversationStore } from "./viewer-D3jhuP66.js";
2
+ import { Cr as isAssistantMessage, Dr as normalizeToolNameFromResult, Er as isToolResultMessage, Tr as isToolResultError, dt as CORE_EVENT_NAMESPACE, ht as eventGuidance, mt as eventCatalogEntry } from "./turn-session-routing-BV_gX7n3.js";
3
+ import { n as botConfig } from "./config-BUP9wjiR.js";
4
+ import { h as logWarn, m as logInfo, p as logException } from "./logging-CjkDr-jP.js";
5
+ import { C as getSqlExecutor, j as SYSTEM_IDENTITY_ID, x as getConversationStore } from "./viewer-BCRuO8Wg.js";
6
6
  import { s as juniorConversations } from "./agent-invocations-C1RNOCs8.js";
7
- import "./executor-C2cRw0hZ.js";
8
- import { h as credentialSubjectSchema } from "./registry-BPtbAVFo.js";
9
- import { Et as postSlackMessage, Hn as ToolInputError, In as JUNIOR_THREAD_STATE_TTL_MS, Ln as getDashboardConversationLink, Rn as getDashboardObjectIconLink, Sn as verifyTimerWatchCredentialSubject, gt as normalizeSlackReplyMarkdown, ht as formatSlackLink, l as getPluginSlackConversationLink, mt as escapeSlackMrkdwnText, p as getPlugins, vr as buildSentryConversationUrl } from "./credentialed-mh7HBqey.js";
10
- import { r as getStateAdapter } from "./adapter-Bqbtr1RV.js";
11
- import { r as EVENT_AUTHOR_ID } from "./prompt-BPSdXYXV.js";
12
- import { r as sanitizeAssistantText } from "./assistant-reply-DgtX9DaJ.js";
13
- import { r as appendAndEnqueueInboundMessage } from "./store-BF2XEeQz.js";
7
+ import "./executor-DGDpyegI.js";
8
+ import { h as credentialSubjectSchema } from "./registry-7XgwNgQe.js";
9
+ import { Et as postSlackMessage, Hn as ToolInputError, In as JUNIOR_THREAD_STATE_TTL_MS, Ln as getDashboardConversationLink, Rn as getDashboardObjectIconLink, Sn as verifyTimerWatchCredentialSubject, gt as normalizeSlackReplyMarkdown, ht as formatSlackLink, l as getPluginSlackConversationLink, mt as escapeSlackMrkdwnText, p as getPlugins, vr as buildSentryConversationUrl } from "./credentialed-CgTulRDH.js";
10
+ import { r as getStateAdapter } from "./adapter-BDYDi1F9.js";
11
+ import { r as EVENT_AUTHOR_ID } from "./prompt-vfceH0c-.js";
12
+ import { r as sanitizeAssistantText } from "./assistant-reply-DN2w6JL_.js";
13
+ import { r as appendAndEnqueueInboundMessage } from "./store-CPF2kzbu.js";
14
14
  import { z } from "zod";
15
15
  import { eq, inArray } from "drizzle-orm";
16
16
  import { eventMatchFieldsSchema, objectFactFields, objectPresentation, objectTypeSchema } from "@sentry/junior-plugin-api";
@@ -903,10 +903,17 @@ const SLACK_CURRENT_CHANNEL_IDENTIFIER = "current_channel";
903
903
  const CHANNEL_RESOURCE_TYPE = "channel";
904
904
  const MESSAGE_POSTED_EVENT = "message.posted";
905
905
  const CHANNEL_ID_PATTERN = /^[CG][A-Z0-9]{2,}$/;
906
- const CHANNEL_MESSAGE_MATCH_FIELDS = eventMatchFieldsSchema.parse({ userId: {
907
- kind: "string",
908
- description: "Slack user ID of the message author. Required to run on bot posts, such as alert bots."
909
- } });
906
+ const CHANNEL_MESSAGE_MATCH_FIELDS = eventMatchFieldsSchema.parse({
907
+ channelId: {
908
+ kind: "string",
909
+ description: "Slack channel ID of the message. It is always the channel where the automation posts.",
910
+ events: [MESSAGE_POSTED_EVENT]
911
+ },
912
+ userId: {
913
+ kind: "string",
914
+ description: "Slack user ID of the message author. Required to run on bot posts, such as alert bots."
915
+ }
916
+ });
910
917
  /**
911
918
  * Event registration for new top-level Slack channel messages. Only event
912
919
  * automations can use it, so watchEvents rejects it.
@@ -924,7 +931,7 @@ function slackChannelMessageEvents() {
924
931
  matchFields: CHANNEL_MESSAGE_MATCH_FIELDS
925
932
  }],
926
933
  events: { [MESSAGE_POSTED_EVENT]: {
927
- reach: "resource",
934
+ reach: { anyOf: ["channelId"] },
928
935
  guidance: "A person or bot posted a new top-level message in this channel. A bot post runs the automation only when match names the bot in userId. A reply goes in that message's thread. If the instructions do not apply to this message, end with no action."
929
936
  } },
930
937
  limits: { [CHANNEL_RESOURCE_TYPE]: {
@@ -934,23 +941,42 @@ function slackChannelMessageEvents() {
934
941
  };
935
942
  }
936
943
  /**
944
+ * Set the `channelId` filter of a Slack channel-message trigger to the
945
+ * channel where the automation posts. A trigger that names another channel,
946
+ * or a saved trigger with an identifier, stays as it is for
947
+ * `requireSlackChannelMessageScope` to check.
948
+ */
949
+ function slackChannelMessageTrigger(trigger, channelId) {
950
+ if (trigger.namespace !== "slack") return trigger;
951
+ if (trigger.identifier != null || trigger.match?.channelId !== void 0) return trigger;
952
+ return {
953
+ ...trigger,
954
+ match: {
955
+ ...trigger.match,
956
+ channelId
957
+ }
958
+ };
959
+ }
960
+ /**
937
961
  * Bind a Slack channel-message automation to its own channel.
938
962
  *
939
- * Resolve `current_channel` to the destination channel and reject other
940
- * channels, so private channel text cannot reach another channel.
963
+ * The trigger names the channel with a `channelId` filter. A saved trigger
964
+ * can name it with an identifier instead, where `current_channel` means the
965
+ * destination channel. Reject other channels, so private channel text cannot
966
+ * reach another channel.
941
967
  */
942
968
  function requireSlackChannelMessageScope(automation) {
943
969
  if (automation.trigger.namespace !== "slack") return automation;
944
970
  const channelId = automation.destination.channelId;
945
971
  if (!CHANNEL_ID_PATTERN.test(channelId)) throw new ToolInputError("A Slack channel-message automation works only in a channel, not in a DM.");
946
- const identifier = automation.trigger.identifier === "current_channel" ? channelId : automation.trigger.identifier;
947
- if (identifier !== channelId) throw new ToolInputError(`A Slack channel-message automation can watch only the channel where it posts. Use identifier "${SLACK_CURRENT_CHANNEL_IDENTIFIER}", or create the automation in the channel to watch.`);
972
+ const { identifier, match } = automation.trigger;
973
+ if ((identifier === void 0 ? match?.channelId : identifier === "current_channel" ? channelId : identifier) !== channelId) throw new ToolInputError("A Slack channel-message automation can watch only the channel where it posts. Leave out the channelId filter, or create the automation in the channel to watch.");
948
974
  return {
949
975
  ...automation,
950
976
  credentialMode: "system",
951
977
  trigger: {
952
978
  ...automation.trigger,
953
- identifier
979
+ ...identifier === void 0 ? void 0 : { identifier: channelId }
954
980
  }
955
981
  };
956
982
  }
@@ -984,8 +1010,8 @@ function slackChannelMessageEvent(input) {
984
1010
  * Decide whether a channel-message Event may run one automation.
985
1011
  *
986
1012
  * A message runs only automations that post in its own channel, so private
987
- * channel text cannot reach another channel. The trigger identifier already
988
- * names that channel, and this check keeps the rule when it does not.
1013
+ * channel text cannot reach another channel. The trigger already names that
1014
+ * channel, and this check keeps the rule when it does not.
989
1015
  * A bot post runs only automations whose match names its author in `userId`.
990
1016
  * Bots can post often and would use up the run limit of every other
991
1017
  * automation in the channel.
@@ -1299,4 +1325,4 @@ async function skipInputBeforeConversationStop(context) {
1299
1325
  await context.attempt.ack();
1300
1326
  return { status: "completed" };
1301
1327
  }
1302
- export { automationResultSchema as A, maybePostAutomatedTurnLimitNotice as C, recordFinishedTurnForAutomatedLimit as D, renderSlackObjectCard as E, remindMissingAutomationResult as F, runDispatchOutcome as I, finishedRunReply as M, postsRunNotices as N, resetAutomatedTurnLimit as O, readAutomationResult as P, renderTaskInput as S, sendSlackReply as T, WORKSPACE_SNAPSHOT_FAILED_EVENT as _, EVENT_WAIT_MS as a, workspaceSnapshotWatch as b, isEventMailboxMetadata as c, getEventCatalog as d, SLACK_EVENT_NAMESPACE as f, slackChannelMessageRunsAutomation as g, slackChannelMessageReplyThreadTs as h, skipInputBeforeConversationStop as i, deliversFinalText as j, FINISH_AUTOMATION_RUN_TOOL_NAME as k, renderEventBatchText as l, slackChannelMessageEvent as m, markConversationsStopped as n, enqueueEventNotification as o, requireSlackChannelMessageScope as p, session_stop_exports as r, eventBatchMessageEvents as s, getConversationStoppedAtMs as t, timerWatchCredentialSubject as u, WORKSPACE_SNAPSHOT_READY_EVENT as v, resolveSlackReplyTarget as w, joinMailboxText as x, workspaceSnapshotFinishedEvent as y };
1328
+ export { recordFinishedTurnForAutomatedLimit as A, renderTaskInput as C, sendSlackReply as D, resolveSlackReplyTarget as E, finishedRunReply as F, postsRunNotices as I, readAutomationResult as L, FINISH_AUTOMATION_RUN_TOOL_NAME as M, automationResultSchema as N, renderSlackObjectCard as O, deliversFinalText as P, remindMissingAutomationResult as R, joinMailboxText as S, postAutomatedTurnLimitNoticeForConversation as T, slackChannelMessageTrigger as _, EVENT_WAIT_MS as a, workspaceSnapshotFinishedEvent as b, isEventMailboxMetadata as c, getEventCatalog as d, SLACK_EVENT_NAMESPACE as f, slackChannelMessageRunsAutomation as g, slackChannelMessageReplyThreadTs as h, skipInputBeforeConversationStop as i, resetAutomatedTurnLimit as j, admitAutomatedTurn as k, renderEventBatchText as l, slackChannelMessageEvent as m, markConversationsStopped as n, enqueueEventNotification as o, requireSlackChannelMessageScope as p, session_stop_exports as r, eventBatchMessageEvents as s, getConversationStoppedAtMs as t, timerWatchCredentialSubject as u, WORKSPACE_SNAPSHOT_FAILED_EVENT as v, maybePostAutomatedTurnLimitNotice as w, workspaceSnapshotWatch as x, WORKSPACE_SNAPSHOT_READY_EVENT as y, runDispatchOutcome as z };
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { h as logWarn } from "./logging-DuwXUuIY.js";
2
+ import { h as logWarn } from "./logging-CjkDr-jP.js";
3
3
  import { s as skillRoots } from "./package-discovery-DJBompdd.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Bw9kjGVu.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BNeCWIaF.js";
5
5
  import path from "node:path";
6
6
  import { z } from "zod";
7
7
  import fs from "node:fs/promises";
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { Mt as toolInvocationDestination, jt as actorFromRun } from "./agent-runner-BiHsH8O_.js";
3
- import { n as createAndEnqueueAgentInvocation } from "./work-CL9QwQcl.js";
2
+ import { Mt as actorFromRun, Nt as toolInvocationDestination } from "./agent-runner-Cl6Usx2Y.js";
3
+ import { n as createAndEnqueueAgentInvocation } from "./work-zxkmbJAp.js";
4
4
  // src/chat/agent-invocations/spawn.ts
5
5
  var spawn_exports = /* @__PURE__ */ __exportAll({ bindSpawnAgent: () => bindSpawnAgent });
6
6
  /** Bind a Run's Actor and credentials to new Agent invocations. */