@sentry/junior 0.317.0 → 0.318.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 (74) hide show
  1. package/dist/{admin-CAugg87B.js → admin-UOHix_5P.js} +1 -1
  2. package/dist/{agent-runner-AjrEV6Qe.js → agent-runner-DeYymwh2.js} +183 -113
  3. package/dist/{agent-update-delivery-B_YIZcgf.js → agent-update-delivery-DH8bx7jU.js} +5 -5
  4. package/dist/api/schema.d.ts +42 -28
  5. package/dist/api/schema.js +3 -3
  6. package/dist/api.js +38 -41
  7. package/dist/{app-MoNAsVV5.d.ts → app-DKAOuaoC.d.ts} +4 -9
  8. package/dist/app.d.ts +1 -1
  9. package/dist/app.js +62 -91
  10. package/dist/{thread-context-CqZDKErp.js → auth-pause-state-f9hJM_zO.js} +6 -59
  11. package/dist/{catalog-runtime-DfSpJZdY.js → catalog-runtime-BfdAnztW.js} +1 -1
  12. package/dist/{channel-access-j-YAVYK4.js → channel-access-A0de5lRv.js} +1 -1
  13. package/dist/{chat-core-engine-aH85nEHv.js → chat-core-engine-D3Wd7f5n.js} +6 -6
  14. package/dist/{child-message-DHjQLEd1.js → child-message-peFWLcCZ.js} +1 -5
  15. package/dist/cli/chat.js +32 -24
  16. package/dist/cli/check.js +4 -4
  17. package/dist/cli/main.js +2 -2
  18. package/dist/cli/plugins.js +4 -4
  19. package/dist/cli/snapshot-create.js +4 -5
  20. package/dist/cli/upgrade.js +3 -3
  21. package/dist/context-BKF_5zzI.js +1833 -0
  22. package/dist/{continue-in-slack-D-FZ8Fin.js → continue-in-slack-YxwMQVeR.js} +3 -2
  23. package/dist/{conversation-feed--9S0_PXL.js → conversation-feed-Cj7IuBtM.js} +1 -1
  24. package/dist/{conversation-privacy-B1uXn5sf.js → conversation-privacy-Cr_dNW1p.js} +1 -1
  25. package/dist/{conversation-turn-BUE_7xaN.js → conversation-turn-Bru4w_FD.js} +111 -18
  26. package/dist/{create-DoDIYgtZ.js → create-Btl1y1rq.js} +13 -15
  27. package/dist/{credential-sync-BJOqGnjV.js → credential-sync-DTarZ63K.js} +17 -17
  28. package/dist/{db-BFmyYZtJ.js → db-of6e3sGt.js} +1943 -1189
  29. package/dist/{deployment-DXq9ZLU4.js → deployment-C0qXa0FD.js} +1 -1
  30. package/dist/{engine-context-CgQ7mlHt.js → engine-context-C_QL_bMQ.js} +52 -21
  31. package/dist/{html-B3VKTGbJ.js → html-9_pS9SjY.js} +6 -6
  32. package/dist/instrumentation.js +2 -2
  33. package/dist/{job-runner-A1lCkybD.js → job-runner-B2XEvpif.js} +11 -12
  34. package/dist/{lineage-Bktb0UcV.js → lineage-nh4z9iQN.js} +1 -1
  35. package/dist/{list-Bxvg5wXf.js → list-HRP3TIRl.js} +45 -37
  36. package/dist/{logging--smS7XRK.js → logging-BnOG0qz2.js} +3 -49
  37. package/dist/{mailbox-turn-uSXhUFc9.js → mailbox-turn-Byrry9o1.js} +220 -223
  38. package/dist/{parent-result-Ck1rFYRQ.js → markers-CTTtJqYn.js} +84 -52
  39. package/dist/{message-BNenhsmB.js → message-BRUuLgrY.js} +9 -10
  40. package/dist/{model-input-BReSnwHp.js → model-input-CFC62mf-.js} +2 -2
  41. package/dist/nitro.d.ts +1 -1
  42. package/dist/nitro.js +4 -4
  43. package/dist/{oauth-callback-server-CE4soEIY.js → oauth-callback-server-CjnnUr4o.js} +2 -2
  44. package/dist/{oauth-relay-C36gX1gH.js → oauth-relay-BvHFH0fV.js} +1 -1
  45. package/dist/{profile-BQ-iBDsZ.js → profile-iHw1uu32.js} +7 -7
  46. package/dist/{prompt-Dv7gkpD6.js → prompt-DEkStuxG.js} +10 -10
  47. package/dist/{registry-iXMT5Jmh.js → registry-Cl7Labpe.js} +7 -7
  48. package/dist/{reports-WKHfGTsU.js → reports-C1d9azyV.js} +2 -2
  49. package/dist/{resolve-tony4ibz.js → resolve-DC6zBuDV.js} +5 -5
  50. package/dist/{result-Bta_dlWa.js → result-DxewDuXb.js} +12 -12
  51. package/dist/{run-conversation-DL6ru7iW.js → run-conversation-Cz2ubZK-.js} +6 -5
  52. package/dist/{runner-BstDRbD9.js → runner-99YxVN_r.js} +10 -18
  53. package/dist/{sandbox-egress-signals-oSJMJOnn.js → sandbox-egress-signals-CgoX5CTI.js} +1 -1
  54. package/dist/{schema-DfqrHACA.js → schema-BTojNBr5.js} +2 -2
  55. package/dist/{sender-actors-CPglLd5R.js → sender-actors-77zTQbSG.js} +7 -6
  56. package/dist/{service-account-CTV_jaNu.js → service-account-YDCPSByj.js} +3 -3
  57. package/dist/{skills-BCEU41zM.js → skills-CleC0Hze.js} +5 -4
  58. package/dist/{slack-conversation-unfurl-DxVmhbGP.js → slack-conversation-unfurl-BNQLC12R.js} +7 -7
  59. package/dist/{spawn-frczVPIr.js → spawn-DuZfodPa.js} +7 -10
  60. package/dist/{system-prompt-table-CiXy0eNR.js → system-prompt-table-Ci6Ck4gk.js} +2 -2
  61. package/dist/{task-runner-C9Yc2_ae.js → task-runner-BJ9Up3bG.js} +18 -15
  62. package/dist/{topics-SRN7IVX-.js → topics-BoCkoPJJ.js} +2 -5
  63. package/dist/{turn-membership-CENFf3kI.js → turn-membership-VT7XZh-L.js} +4 -4
  64. package/dist/{turn-wake-BhloiI2h.js → turn-wake-C7HeLHAM.js} +4 -4
  65. package/dist/{types-C4iC-IMC.js → types-DCzTAA63.js} +55 -49
  66. package/dist/{users-ByG5RCEJ.js → users-Cb9c1k9q.js} +1 -1
  67. package/dist/{validation-8gjfR91V.js → validation-BiUmWPhy.js} +1 -1
  68. package/dist/{version-BeZhWWBE.js → version-VEXiEcZu.js} +1 -1
  69. package/dist/version.js +1 -1
  70. package/dist/{worker-BqMQQNRk.js → worker-ChWYQdhm.js} +5 -5
  71. package/migrations/20261127002500_turn_discarded_usage/migration.sql +2 -0
  72. package/migrations/20261127002500_turn_discarded_usage/snapshot.json +73 -0
  73. package/package.json +5 -5
  74. package/dist/config-CHQ8X251.js +0 -2422
@@ -1,12 +1,12 @@
1
- import { Gd as juniorAgentBindings, Mn as readParentMessage, Nn as readInboundMessageSender, Pn as isEventMailboxMetadata, Qd as juniorConversationEvents, V as conversationLastTurnOutcomeSql, fs as conversationSubtree, i as getConversationStore, in as getConversationWorkStates, lf as juniorConversations, n as getConversationEventStore, nu as isPersonInput, o as getSqlExecutor, ps as conversationSubtreeColumns, rn as getConversationWorkState } from "./db-BFmyYZtJ.js";
2
- import { L as mapBounded } from "./prompt-Dv7gkpD6.js";
3
- import { kn as isAgentUpdateEventType } from "./types-C4iC-IMC.js";
4
- import { Or as TURN_OUTCOME_STATUSES, Rt as buildDeterministicTurnId, W as getConversationStoppedAtMs, Xn as EVENT_SYSTEM_ACTOR, _ as readChildOfStoredParent, b as readAgentConfig, i as listActiveMailboxTurns, r as listActiveMailboxTurnSources } from "./mailbox-turn-uSXhUFc9.js";
1
+ import { Fn as readInboundMessageSender, In as isEventMailboxMetadata, Pn as readParentMessage, U as conversationLastTurnOutcomeSql, Zd as juniorAgentBindings, an as getConversationWorkState, cs as conversationSubtreeColumns, hf as juniorConversations, i as getConversationStore, if as juniorConversationEvents, jl as isPersonInput, n as getConversationEventStore, o as getSqlExecutor, on as getConversationWorkStates, ss as conversationSubtree } from "./db-of6e3sGt.js";
2
+ import { Hn as isAgentUpdateEventType } from "./types-DCzTAA63.js";
3
+ import { G as mapBounded } from "./prompt-DEkStuxG.js";
4
+ import { Er as TURN_OUTCOME_STATUSES, Vt as buildDeterministicTurnId, b as readAgentConfig, i as listActiveMailboxTurns, m as hasParentMessageAuthor, r as listActiveMailboxTurnSources } from "./mailbox-turn-Byrry9o1.js";
5
5
  import * as z from "zod";
6
6
  import { and, desc, eq, inArray, isNotNull, ne, sql } from "drizzle-orm";
7
7
  import { alias } from "drizzle-orm/pg-core";
8
- import pLimit from "p-limit";
9
8
  // src/chat/child-agents/child-input.ts
9
+ const parent = alias(juniorConversations, "parent");
10
10
  function childAgentInputKind(namespace, eventType, watchId) {
11
11
  if (namespace !== "junior" || !eventType) return;
12
12
  if (eventType === "agent.message") return "message";
@@ -39,38 +39,83 @@ function isChildAgentEvent(meta) {
39
39
  return Boolean(childAgentInputKind(meta?.eventNamespace, meta?.eventType, meta?.eventWatchId));
40
40
  }
41
41
  /**
42
+ * Return the stored parent edge that a parent message claims, or undefined
43
+ * when its author id is not that parent's, so it is dropped with no read.
44
+ */
45
+ function claimedParentEdge(message, parentMessage) {
46
+ return hasParentMessageAuthor(message, parentMessage) ? parentEdgeKey(message.conversationId, parentMessage.parentConversationId) : void 0;
47
+ }
48
+ function parentEdgeKey(childConversationId, parentConversationId) {
49
+ return JSON.stringify([childConversationId, parentConversationId]);
50
+ }
51
+ /**
52
+ * Return the child that sent a reply that a stop can skip. A message that a
53
+ * child sent is still delivered, and so is the `stopped` result that a
54
+ * person's stop sends.
55
+ */
56
+ function skippableReplySender(message) {
57
+ if (childAgentInput(message)?.kind !== "reply" || isStopResult(message)) return;
58
+ return readInboundMessageSender(message)?.conversationId;
59
+ }
60
+ /**
61
+ * Read the stops that `isDroppedChildInput` needs for many inputs, with one
62
+ * query for the receiving children and one for the reply senders.
63
+ */
64
+ async function readChildInputDropFacts(messages) {
65
+ const childIds = /* @__PURE__ */ new Set();
66
+ const parentIds = /* @__PURE__ */ new Set();
67
+ const senderIds = /* @__PURE__ */ new Set();
68
+ for (const message of messages) {
69
+ const parentMessage = readParentMessage(message);
70
+ if (parentMessage) {
71
+ if (claimedParentEdge(message, parentMessage)) {
72
+ childIds.add(message.conversationId);
73
+ parentIds.add(parentMessage.parentConversationId);
74
+ }
75
+ continue;
76
+ }
77
+ const sender = skippableReplySender(message);
78
+ if (sender) senderIds.add(sender);
79
+ }
80
+ const db = getSqlExecutor().db();
81
+ const [children, senders] = await Promise.all([childIds.size > 0 ? db.select({
82
+ conversationId: juniorConversations.conversationId,
83
+ parentConversationId: parent.conversationId,
84
+ stoppedAt: juniorConversations.stoppedAt
85
+ }).from(juniorConversations).innerJoin(parent, eq(parent.conversationId, juniorConversations.parentConversationId)).where(and(inArray(juniorConversations.conversationId, [...childIds]), inArray(parent.conversationId, [...parentIds]))) : [], senderIds.size > 0 ? db.select({
86
+ conversationId: juniorConversations.conversationId,
87
+ stoppedAt: juniorConversations.stoppedAt
88
+ }).from(juniorConversations).where(inArray(juniorConversations.conversationId, [...senderIds])) : []]);
89
+ return {
90
+ childStops: new Map(children.map((row) => [parentEdgeKey(row.conversationId, row.parentConversationId), row.stoppedAt])),
91
+ senderStops: new Map(senders.flatMap((row) => row.stoppedAt ? [[row.conversationId, row.stoppedAt]] : []))
92
+ };
93
+ }
94
+ /**
42
95
  * Return whether a Conversation drops one input, so it starts no work.
43
- * Routing, the stop skips, and the child agent status all read this, so they
44
- * agree on which input starts work.
96
+ * Routing and the child agent status both read this, so they agree on which
97
+ * input starts work. `facts` must come from `readChildInputDropFacts` for
98
+ * this input.
45
99
  *
46
100
  * A parent message is dropped when it does not come from the stored parent,
47
- * or when it was sent before the child's stop. A child reply that a stop
48
- * skips is dropped too. A stopped Conversation never reads other automated
49
- * input: `enqueueAutomatedInput` and the stop hold it first.
101
+ * or when it was sent before the child's stop. A stop drops a child's unread
102
+ * replies from the parent's mailbox. One sent before the stop can reach the
103
+ * mailbox after that drop, so while the sending child is stopped, a reply
104
+ * that it sent after the stop is dropped too. A stopped Conversation never
105
+ * reads other automated input: `enqueueAutomatedInput` and the stop hold it
106
+ * first.
50
107
  */
51
- async function isDroppedChildInput(message) {
108
+ function isDroppedChildInput(message, facts) {
52
109
  if (isPersonInput(message.source)) return false;
53
110
  const parentMessage = readParentMessage(message);
54
111
  if (parentMessage) {
55
- const child = await readChildOfStoredParent(message, parentMessage);
56
- if (!child) return true;
57
- const stoppedAtMs = child.stoppedAt?.getTime();
112
+ const edge = claimedParentEdge(message, parentMessage);
113
+ if (!edge || !facts.childStops.has(edge)) return true;
114
+ const stoppedAtMs = facts.childStops.get(edge)?.getTime();
58
115
  return stoppedAtMs !== void 0 && message.receivedAtMs <= stoppedAtMs;
59
116
  }
60
- return childAgentInput(message)?.kind === "reply" && await isSkippedReply(message);
61
- }
62
- /**
63
- * Return whether a stop skipped this reply. A stop drops a child's unread
64
- * replies from the parent's mailbox. One sent before the stop can reach the
65
- * mailbox after that drop, so while the sending child is stopped, a reply
66
- * that it sent after the stop is dropped too, except the `stopped` result
67
- * that a person's stop sends. A message that a child sent is still
68
- * delivered.
69
- */
70
- async function isSkippedReply(message) {
71
- const sender = readInboundMessageSender(message);
72
- if (!sender || isStopResult(message)) return false;
73
- const senderStoppedAtMs = await getConversationStoppedAtMs(sender.conversationId);
117
+ const sender = skippableReplySender(message);
118
+ const senderStoppedAtMs = sender ? facts.senderStops.get(sender)?.getTime() : void 0;
74
119
  return senderStoppedAtMs !== void 0 && message.createdAtMs >= senderStoppedAtMs;
75
120
  }
76
121
  /**
@@ -78,7 +123,6 @@ async function isSkippedReply(message) {
78
123
  * binding. A Conversation without a parent has none.
79
124
  */
80
125
  async function readChildConversationSender(childConversationId) {
81
- const parent = alias(juniorConversations, "parent");
82
126
  const [row] = await getSqlExecutor().db().select({
83
127
  agentName: juniorAgentBindings.name,
84
128
  parentConversationId: parent.conversationId,
@@ -95,8 +139,9 @@ async function readChildConversationSender(childConversationId) {
95
139
  }
96
140
  /**
97
141
  * Read the sender of one reply or message, when it is a child of the
98
- * Conversation that received it. Otherwise the input has no child sender,
99
- * such as one that an earlier release sent.
142
+ * Conversation that received it. Input that names no child of this
143
+ * Conversation has no sender, so `withSenderActors` runs it as the Event
144
+ * system Actor and it gets no child's authority.
100
145
  */
101
146
  async function getChildAgentInputSender(message, input) {
102
147
  const sender = await readChildConversationSender(input.senderId);
@@ -133,11 +178,12 @@ async function listChildAgents(parentConversationId) {
133
178
  }).from(juniorConversations).leftJoin(juniorAgentBindings, eq(juniorAgentBindings.childConversationId, juniorConversations.conversationId)).where(and(eq(juniorConversations.parentConversationId, parentConversationId), isNotNull(juniorConversations.agentConfig))).orderBy(desc(sql`coalesce(${juniorConversations.executionUpdatedAt}, ${juniorConversations.updatedAt})`)).limit(CHILD_AGENT_LIST_LIMIT);
134
179
  const ids = rows.map((row) => row.conversationId);
135
180
  const [workStates, mailboxTurnSources] = await Promise.all([getConversationWorkStates(ids), listActiveMailboxTurnSources(ids)]);
136
- const limit = pLimit(8);
137
- return (await Promise.all(rows.map(async (row) => {
181
+ const pendingInput = (conversationId) => workStates.get(conversationId)?.execution.pendingMessages ?? [];
182
+ const dropFacts = await readChildInputDropFacts(rows.flatMap((row) => row.stoppedAt ? [] : pendingInput(row.conversationId)));
183
+ return rows.map((row) => {
138
184
  const kind = childConversationKindSchema.parse(row.kind);
139
185
  const stoppedAtMs = row.stoppedAt?.getTime();
140
- const running = stoppedAtMs === void 0 && await limit(() => runsOnConversationLoop(workStates.get(row.conversationId)?.execution.pendingMessages ?? [], mailboxTurnSources.get(row.conversationId) ?? []));
186
+ const running = stoppedAtMs === void 0 && runsOnConversationLoop(pendingInput(row.conversationId), mailboxTurnSources.get(row.conversationId) ?? [], dropFacts);
141
187
  const outcome = row.lastTurnOutcome;
142
188
  const lastResult = outcome === "failed" ? "failed" : outcome ? TURN_OUTCOME_STATUSES[outcome] : void 0;
143
189
  return {
@@ -150,7 +196,7 @@ async function listChildAgents(parentConversationId) {
150
196
  ...row.title ? { title: row.title } : void 0,
151
197
  updatedAtMs: (row.executionUpdatedAt ?? row.updatedAt).getTime()
152
198
  };
153
- }))).sort((left, right) => right.updatedAtMs - left.updatedAtMs);
199
+ }).sort((left, right) => right.updatedAtMs - left.updatedAtMs);
154
200
  }
155
201
  /** List the ids of the child agents of one parent that have open work. */
156
202
  async function listOpenChildAgents(parentConversationId) {
@@ -162,10 +208,8 @@ async function listOpenChildAgents(parentConversationId) {
162
208
  * Event in its debounce window, or an open mailbox Turn. Every Turn of a
163
209
  * child answers its parent, whoever started it.
164
210
  */
165
- async function runsOnConversationLoop(pending, mailboxTurnSources) {
166
- if (mailboxTurnSources.length > 0) return true;
167
- for (const message of pending) if (!await isDroppedChildInput(message)) return true;
168
- return false;
211
+ function runsOnConversationLoop(pending, mailboxTurnSources, dropFacts) {
212
+ return mailboxTurnSources.length > 0 || pending.some((message) => !isDroppedChildInput(message, dropFacts));
169
213
  }
170
214
  /**
171
215
  * List the ids of a child's open Turns on the Conversation loop. A Turn keeps
@@ -295,16 +339,4 @@ async function appendSubagentEnded(parentConversationId, markerIds, outcome, cre
295
339
  createdAtMs
296
340
  })));
297
341
  }
298
- // src/chat/child-agents/parent-result.ts
299
- /**
300
- * Return the Actor that a child Turn's update carries to its parent, whose
301
- * Turn for it runs as that Actor. Only a Turn that agent work started, a
302
- * parent message or an Event such as a child result, keeps its Actor. Any
303
- * other Turn, such as a person's Turn in a Thread or a saved Turn with no
304
- * Source, reports as the Event system Actor, so the parent never gets a
305
- * person's access.
306
- */
307
- function parentResultActor(actor, source) {
308
- return source === "parent_message" || source === "event" ? actor : EVENT_SYSTEM_ACTOR;
309
- }
310
- export { listChildAgents as a, listUnreportedSiblingAgents as c, isChildAgentEvent as d, isDroppedChildInput as f, listAgentRelatives as i, childAgentInput as l, readChildConversationSender as m, recordChildAgentEnded as n, listDescendantAgents as o, isStopResult as p, recordSubagentStartedMarker as r, listOpenChildAgents as s, parentResultActor as t, getChildAgentInputSender as u };
342
+ export { listDescendantAgents as a, childAgentInput as c, isDroppedChildInput as d, isStopResult as f, listChildAgents as i, getChildAgentInputSender as l, readChildInputDropFacts as m, recordSubagentStartedMarker as n, listOpenChildAgents as o, readChildConversationSender as p, listAgentRelatives as r, listUnreportedSiblingAgents as s, recordChildAgentEnded as t, isChildAgentEvent as u };
@@ -1,14 +1,13 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { F as AgentMessageTargetError, b as actorFromRun } from "./agent-runner-AjrEV6Qe.js";
3
- import { Pt as PARENT_AGENT_TARGET, Sr as readConversationAccessFromSql, a as getDb, hr as canAccessConversation, i as getConversationStore, jt as findChildAgentConversationId, oc as SYSTEM_IDENTITY_ID } from "./db-BFmyYZtJ.js";
4
- import { m as readChildConversationSender } from "./parent-result-Ck1rFYRQ.js";
5
- import { n as enqueueAgentMessageToParent } from "./result-Bta_dlWa.js";
6
- import { t as messageChildAgent } from "./create-DoDIYgtZ.js";
7
- import { O as EVENT_WAIT_MS, U as enqueueAutomatedInput } from "./mailbox-turn-uSXhUFc9.js";
8
- import { U as renderDataTag } from "./prompt-Dv7gkpD6.js";
9
- import { Dn as TOP_LEVEL_AGENT_MESSAGE_EVENT_TYPE } from "./types-C4iC-IMC.js";
2
+ import { F as AgentMessageTargetError, b as actorFromRun } from "./agent-runner-DeYymwh2.js";
3
+ import { $s as SYSTEM_IDENTITY_ID, It as PARENT_AGENT_TARGET, Kl as CORE_EVENT_NAMESPACE, Nt as findChildAgentConversationId, _r as canAccessConversation, a as getDb, i as getConversationStore, wr as readConversationAccessFromSql } from "./db-of6e3sGt.js";
4
+ import { p as readChildConversationSender } from "./markers-CTTtJqYn.js";
5
+ import { n as enqueueAgentMessageToParent } from "./result-DxewDuXb.js";
6
+ import { t as messageChildAgent } from "./create-Btl1y1rq.js";
7
+ import { H as enqueueAutomatedInput, O as EVENT_WAIT_MS } from "./mailbox-turn-Byrry9o1.js";
8
+ import { H as renderDataTag } from "./prompt-DEkStuxG.js";
9
+ import { Bn as TOP_LEVEL_AGENT_MESSAGE_EVENT_TYPE } from "./types-DCzTAA63.js";
10
10
  // src/chat/child-agents/top-level-message.ts
11
- const AGENT_MESSAGE_EVENT_NAMESPACE = "junior";
12
11
  /**
13
12
  * Check that a top-level agent can message another top-level agent under
14
13
  * `policies/conversation-access.md`. Public agents can message each other.
@@ -57,7 +56,7 @@ async function enqueueTopLevelAgentMessage(args) {
57
56
  eventKey: inboundMessageId,
58
57
  eventType: TOP_LEVEL_AGENT_MESSAGE_EVENT_TYPE,
59
58
  identifier: args.senderConversationId,
60
- namespace: AGENT_MESSAGE_EVENT_NAMESPACE,
59
+ namespace: CORE_EVENT_NAMESPACE,
61
60
  trustedSummary: summary
62
61
  }
63
62
  };
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { o as getSqlExecutor } from "./db-BFmyYZtJ.js";
2
+ import { o as getSqlExecutor } from "./db-of6e3sGt.js";
3
3
  import { o as detectImageMediaType, s as isVisionImageMediaType } from "./user-customization-CvfuY9Eo.js";
4
- import { d as readLiveAttachment } from "./turn-membership-CENFf3kI.js";
4
+ import { d as readLiveAttachment } from "./turn-membership-VT7XZh-L.js";
5
5
  import { escapeTagText, renderTag } from "@sentry/junior-plugin-api";
6
6
  // src/chat/attachments/model-input.ts
7
7
  var model_input_exports = /* @__PURE__ */ __exportAll({ loadInputAttachments: () => loadInputAttachments });
package/dist/nitro.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as JuniorPluginSet } from "./plugins-fBrz8PCV.js";
2
- import { r as JuniorDashboardOptions } from "./app-MoNAsVV5.js";
2
+ import { r as JuniorDashboardOptions } from "./app-DKAOuaoC.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,7 +1,7 @@
1
- import { a as resolveConversationWorkQueueTopic, i as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, n as CACHE_WARMUP_QUEUE_TOPIC, o as toOptionalTrimmed, r as PLUGIN_TASK_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC } from "./topics-SRN7IVX-.js";
1
+ import { a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, i as PLUGIN_TASK_QUEUE_TOPIC, n as CACHE_WARMUP_QUEUE_TOPIC, o as toOptionalTrimmed, t as BACKGROUND_COMPACTION_QUEUE_TOPIC } from "./topics-BoCkoPJJ.js";
2
2
  import { t as startLocalVercelQueueServer } from "./local-server-CpnGhYml.js";
3
3
  import { n as TURN_STEP_TOPIC, t as DELIVERY_TOPIC } from "./topic-CRYYBYp-.js";
4
- import { a as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, c as JUNIOR_HEARTBEAT_ROUTE, d as JUNIOR_RETENTION_ROUTE, f as JUNIOR_TURN_STEP_CALLBACK_ROUTE, g as getDeploymentServiceVersion, i as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, l as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, n as JUNIOR_AUTO_ARCHIVE_ROUTE, o as JUNIOR_DELIVERY_CALLBACK_ROUTE, p as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, r as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE, s as JUNIOR_HEARTBEAT_CRON_SCHEDULE, t as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, u as JUNIOR_RETENTION_CRON_SCHEDULE } from "./deployment-DXq9ZLU4.js";
4
+ import { a as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, c as JUNIOR_HEARTBEAT_ROUTE, d as JUNIOR_RETENTION_ROUTE, f as JUNIOR_TURN_STEP_CALLBACK_ROUTE, g as getDeploymentServiceVersion, i as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, l as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, n as JUNIOR_AUTO_ARCHIVE_ROUTE, o as JUNIOR_DELIVERY_CALLBACK_ROUTE, p as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, r as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE, s as JUNIOR_HEARTBEAT_CRON_SCHEDULE, t as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, u as JUNIOR_RETENTION_CRON_SCHEDULE } from "./deployment-C0qXa0FD.js";
5
5
  import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-DD9vencX.js";
6
6
  import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-D_Ru4CWc.js";
7
7
  import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cv2ETe8Y.js";
@@ -18,7 +18,7 @@ function queueCallbackRoutes() {
18
18
  return [
19
19
  {
20
20
  route: JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
21
- topic: resolveConversationWorkQueueTopic()
21
+ topic: process.env["JUNIOR_CONVERSATION_WORK_QUEUE_TOPIC"]?.trim() || "junior_conversation_work"
22
22
  },
23
23
  {
24
24
  route: JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE,
@@ -253,7 +253,7 @@ function injectVirtualConfig(nitro, options) {
253
253
  */
254
254
  function injectVirtualSystemPrompts(nitro, options) {
255
255
  nitro.options.virtual["#junior/system-prompts"] = async () => {
256
- const { buildSystemPromptTable } = await import("./system-prompt-table-CiXy0eNR.js").then((n) => n.r);
256
+ const { buildSystemPromptTable } = await import("./system-prompt-table-Ci6Ck4gk.js").then((n) => n.r);
257
257
  const table = await buildSystemPromptTable(await options.loadPlugins(), options.botName);
258
258
  return `export const systemPrompts = ${JSON.stringify(table)};`;
259
259
  };
@@ -1,5 +1,5 @@
1
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-BJOqGnjV.js";
2
- import { A as createUserTokenStore } from "./profile-BQ-iBDsZ.js";
1
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-DTarZ63K.js";
2
+ import { A as createUserTokenStore } from "./profile-iHw1uu32.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,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { n as getChatConfig } from "./config-CHQ8X251.js";
2
+ import { R as getChatConfig } from "./context-BKF_5zzI.js";
3
3
  import * as z from "zod";
4
4
  import { randomBytes } from "node:crypto";
5
5
  import { SignJWT, jwtVerify } from "jose";
@@ -1,15 +1,15 @@
1
- import { M as acquireActiveLock, P as withLock, j as MUTATION_LOCK_TTL_MS, n as getChatConfig } from "./config-CHQ8X251.js";
2
- import { n as pluginCatalogRuntime } from "./catalog-runtime-DfSpJZdY.js";
3
- import { Ho as credentialLogContext, Ji as createPluginCache, Js as sleep, Ku as getStateAdapter, Vo as credentialContextSchema, Wo as credentialUserSubjectId, a as getDb, qi as runNonInteractiveCommand, xt as getPlugins } from "./db-BFmyYZtJ.js";
4
- import { L as mapBounded, d as SANDBOX_WORKSPACE_ROOT, h as createPluginLogger } from "./prompt-Dv7gkpD6.js";
5
- import { E as withSpan, b as setSpanAttributes, d as logAudit, h as logWarn, p as logException, y as setSentryUser } from "./logging--smS7XRK.js";
6
- import { A as createEncryptedState, I as resolvePluginCommandEnv, J as CredentialUnavailableError, M as findLegacyWebActorUserId, P as resolveApiHeaderTransforms, Q as workloadIdentityHeader, Y as ServiceAccountUnavailableError, i as mergeHeaderTransforms, j as readEncryptedState, n as HOST_MANAGED_CREDENTIAL_PLACEHOLDER, q as CredentialMintError, r as resolveAuthTokenPlaceholder } from "./registry-iXMT5Jmh.js";
1
+ import { C as acquireActiveLock, R as getChatConfig, S as MUTATION_LOCK_TTL_MS, T as withLock, i as credentialLogContext, o as credentialUserSubjectId, r as credentialContextSchema, y as getStateAdapter } from "./context-BKF_5zzI.js";
2
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BfdAnztW.js";
3
+ import { $i as runNonInteractiveCommand, Ct as getPlugins, Vs as sleep, a as getDb, ea as createPluginCache } from "./db-of6e3sGt.js";
4
+ import { G as mapBounded, d as SANDBOX_WORKSPACE_ROOT, h as createPluginLogger } from "./prompt-DEkStuxG.js";
5
+ import { T as withSpan, f as logException, m as logWarn, u as logAudit, v as setSentryUser, y as setSpanAttributes } from "./logging-BnOG0qz2.js";
6
+ import { A as createEncryptedState, I as resolvePluginCommandEnv, J as CredentialUnavailableError, M as findLegacyWebActorUserId, P as resolveApiHeaderTransforms, Q as workloadIdentityHeader, Y as ServiceAccountUnavailableError, i as mergeHeaderTransforms, j as readEncryptedState, n as HOST_MANAGED_CREDENTIAL_PLACEHOLDER, q as CredentialMintError, r as resolveAuthTokenPlaceholder } from "./registry-Cl7Labpe.js";
7
7
  import { n as redactSandboxEgressProxyPath, t as SANDBOX_EGRESS_PROXY_PATH } from "./proxy-path-BHYoKZdq.js";
8
8
  import { r as continueTrace } from "./sentry-CPbZjomA.js";
9
9
  import * as z from "zod";
10
10
  import path from "node:path";
11
- import { createHash, createHmac, createPrivateKey, createPublicKey, generateKeyPairSync, randomBytes, randomUUID, sign, timingSafeEqual } from "node:crypto";
12
11
  import { EgressAuthRequired, EgressPolicyDenied, pluginAuditAttributesSchema, pluginAuthorizationSchema, pluginCredentialHeaderTransformSchema, pluginCredentialResultSchema, pluginGrantSchema, pluginProviderAccountSchema, pluginStoredTokensSchema } from "@sentry/junior-plugin-api";
12
+ import { createHash, createHmac, createPrivateKey, createPublicKey, generateKeyPairSync, randomBytes, randomUUID, sign, timingSafeEqual } from "node:crypto";
13
13
  import fs from "node:fs/promises";
14
14
  import http from "node:http";
15
15
  import os from "node:os";
@@ -1,6 +1,14 @@
1
- import { h as logWarn, m as logInfo, p as logException } from "./logging--smS7XRK.js";
1
+ import { f as logException, m as logWarn, p as logInfo } from "./logging-BnOG0qz2.js";
2
2
  import { escapeClosingTags, escapeTagText, escapeTagTextAndQuotes, findTag, openingTag, readTag, renderTag, startsWithTag, stripTags, unescapeClosingTags, unescapeTagText } from "@sentry/junior-plugin-api";
3
3
  import pLimit from "p-limit";
4
+ /**
5
+ * Map each item through `fn`, with at most `concurrency` calls at once. The
6
+ * results keep the order of `items`. Use it for independent work over a list
7
+ * whose length the code does not fix.
8
+ */
9
+ async function mapBounded(items, fn, concurrency = 8) {
10
+ return await pLimit(concurrency).map(items, fn);
11
+ }
4
12
  // src/chat/input-tags.ts
5
13
  /**
6
14
  * Tags for Turn inputs that the runtime creates. Each input is its own prompt
@@ -121,14 +129,6 @@ function instructionBlock(text) {
121
129
  const closeStart = block.end - 19 - 3;
122
130
  return text[bodyStart] === "\n" && text[closeStart - 1] === "\n" ? block : void 0;
123
131
  }
124
- /**
125
- * Map each item through `fn`, with at most `concurrency` calls at once. The
126
- * results keep the order of `items`. Use it for independent work over a list
127
- * whose length the code does not fix.
128
- */
129
- async function mapBounded(items, fn, concurrency = 8) {
130
- return await pLimit(concurrency).map(items, fn);
131
- }
132
132
  // src/chat/turn-context-tag.ts
133
133
  /**
134
134
  * Canonical tag name for the runtime turn context block injected into Pi
@@ -401,4 +401,4 @@ function toPromptContributionContext(args) {
401
401
  text: args.message.text
402
402
  };
403
403
  }
404
- export { retainRuntimeTurnContext as A, THREAD_CONTEXT_TAGS as B, instructionTextForProjection as C, isToolResultError as D, isStandaloneRuntimeContextMessage as E, SESSION_CONTEXT_SECTION_TAG as F, renderThreadContext as G, readParentAgentTask as H, TURN_CONTEXT_TAG as I, mapBounded as L, trimTrailingAssistantMessages as M, CAPABILITY_SECTION_TAG as N, isToolResultMessage as O, REQUEST_CONTEXT_SECTION_TAG as P, renderCurrentInstruction as R, hasTurnInput as S, isContinuablePiBoundary as T, renderDataTag as U, authorAttrs as V, renderParentAgentTask as W, extractAssistantText as _, SANDBOX_COMMAND_PATH as a, getUserMessageInstructionText as b, SANDBOX_REPOS_ROOT as c, SANDBOX_WORKSPACE_ROOT as d, sandboxSkillDir as f, RUNTIME_CONTEXT_TEXT_STARTS as g, createPluginLogger as h, ATTACHMENT_DIR as i, stripRuntimeTurnContext as j, normalizeToolNameFromResult as k, SANDBOX_SCRATCH_ROOT as l, sandboxSkillPathResolution as m, toPromptContributionContext as n, SANDBOX_DATA_ROOT as o, sandboxSkillFile as p, runPluginHooksAtOnce as r, SANDBOX_JUNIOR_ROOT as s, PLUGIN_PROMPT_CONTRIBUTION_TOTAL_MAX_CHARS as t, SANDBOX_SKILLS_ROOT as u, getPiMessageRole as v, isAssistantMessage as w, hasRuntimeTurnContext as x, getTerminalAssistantMessages as y, unwrapCurrentInstruction as z };
404
+ export { retainRuntimeTurnContext as A, authorAttrs as B, instructionTextForProjection as C, isToolResultError as D, isStandaloneRuntimeContextMessage as E, SESSION_CONTEXT_SECTION_TAG as F, mapBounded as G, renderDataTag as H, TURN_CONTEXT_TAG as I, renderCurrentInstruction as L, trimTrailingAssistantMessages as M, CAPABILITY_SECTION_TAG as N, isToolResultMessage as O, REQUEST_CONTEXT_SECTION_TAG as P, unwrapCurrentInstruction as R, hasTurnInput as S, isContinuablePiBoundary as T, renderParentAgentTask as U, readParentAgentTask as V, renderThreadContext as W, extractAssistantText as _, SANDBOX_COMMAND_PATH as a, getUserMessageInstructionText as b, SANDBOX_REPOS_ROOT as c, SANDBOX_WORKSPACE_ROOT as d, sandboxSkillDir as f, RUNTIME_CONTEXT_TEXT_STARTS as g, createPluginLogger as h, ATTACHMENT_DIR as i, stripRuntimeTurnContext as j, normalizeToolNameFromResult as k, SANDBOX_SCRATCH_ROOT as l, sandboxSkillPathResolution as m, toPromptContributionContext as n, SANDBOX_DATA_ROOT as o, sandboxSkillFile as p, runPluginHooksAtOnce as r, SANDBOX_JUNIOR_ROOT as s, PLUGIN_PROMPT_CONTRIBUTION_TOTAL_MAX_CHARS as t, SANDBOX_SKILLS_ROOT as u, getPiMessageRole as v, isAssistantMessage as w, hasRuntimeTurnContext as x, getTerminalAssistantMessages as y, THREAD_CONTEXT_TAGS as z };
@@ -1,15 +1,15 @@
1
1
  import { n as normalizePluginPackageNames, o as pluginRoots, t as discoverInstalledPluginPackageContent } from "./package-discovery-DD9vencX.js";
2
- import { E as withSpan, b as setSpanAttributes, h as logWarn, m as logInfo } from "./logging--smS7XRK.js";
3
- import { Ku as getStateAdapter, Wo as credentialUserSubjectId, a as getDb, hf as juniorUsers } from "./db-BFmyYZtJ.js";
4
- import { N as fenceLock, P as withLock, j as MUTATION_LOCK_TTL_MS, n as getChatConfig, t as botConfig } from "./config-CHQ8X251.js";
5
- import { L as mapBounded } from "./prompt-Dv7gkpD6.js";
2
+ import { T as withSpan, m as logWarn, p as logInfo, y as setSpanAttributes } from "./logging-BnOG0qz2.js";
3
+ import { L as botConfig, R as getChatConfig, S as MUTATION_LOCK_TTL_MS, T as withLock, o as credentialUserSubjectId, w as fenceLock, y as getStateAdapter } from "./context-BKF_5zzI.js";
4
+ import { a as getDb, xf as juniorUsers } from "./db-of6e3sGt.js";
5
+ import { G as mapBounded } from "./prompt-DEkStuxG.js";
6
6
  import * as z from "zod";
7
- import { getVercelOidcToken } from "@vercel/oidc";
8
7
  import path from "node:path";
8
+ import { eq } from "drizzle-orm";
9
+ import { destinationSchema, sourceSchema } from "@sentry/junior-plugin-api";
9
10
  import { AsyncLocalStorage } from "node:async_hooks";
10
11
  import { createCipheriv, createDecipheriv, createHash, randomBytes, randomUUID } from "node:crypto";
11
- import { destinationSchema, sourceSchema } from "@sentry/junior-plugin-api";
12
- import { eq } from "drizzle-orm";
12
+ import { getVercelOidcToken } from "@vercel/oidc";
13
13
  import { parse } from "yaml";
14
14
  import { readFileSync, readdirSync, statSync } from "node:fs";
15
15
  import { UnauthorizedError, auth } from "@modelcontextprotocol/sdk/client/auth.js";
@@ -1,5 +1,5 @@
1
- import { Pi as createPluginState, St as getRegistrations, Vi as basePluginContext, ur as createPluginConversationEventStats } from "./db-BFmyYZtJ.js";
2
- import { h as createPluginLogger, r as runPluginHooksAtOnce } from "./prompt-Dv7gkpD6.js";
1
+ import { Bi as createPluginState, fr as createPluginConversationEventStats, qi as basePluginContext, wt as getRegistrations } from "./db-of6e3sGt.js";
2
+ import { h as createPluginLogger, r as runPluginHooksAtOnce } from "./prompt-DEkStuxG.js";
3
3
  // src/chat/plugins/hooks/reports.ts
4
4
  const OPERATIONAL_REPORT_MAX_METRICS = 8;
5
5
  const OPERATIONAL_REPORT_MAX_WIDGETS = 12;
@@ -1,8 +1,8 @@
1
- import { n as getChatConfig } from "./config-CHQ8X251.js";
2
- import { Js as sleep, Ku as getStateAdapter, qi as runNonInteractiveCommand } from "./db-BFmyYZtJ.js";
3
- import { a as SANDBOX_COMMAND_PATH, d as SANDBOX_WORKSPACE_ROOT } from "./prompt-Dv7gkpD6.js";
4
- import { i as CURL_DOWNLOAD_ARGS, o as getSandboxProvider, r as isStale, t as create } from "./profile-BQ-iBDsZ.js";
5
- import { E as withSpan, b as setSpanAttributes } from "./logging--smS7XRK.js";
1
+ import { R as getChatConfig, y as getStateAdapter } from "./context-BKF_5zzI.js";
2
+ import { $i as runNonInteractiveCommand, Vs as sleep } from "./db-of6e3sGt.js";
3
+ import { a as SANDBOX_COMMAND_PATH, d as SANDBOX_WORKSPACE_ROOT } from "./prompt-DEkStuxG.js";
4
+ import { i as CURL_DOWNLOAD_ARGS, o as getSandboxProvider, r as isStale, t as create } from "./profile-iHw1uu32.js";
5
+ import { T as withSpan, y as setSpanAttributes } from "./logging-BnOG0qz2.js";
6
6
  import * as z from "zod";
7
7
  // src/chat/sandbox/resources.ts
8
8
  /**
@@ -1,11 +1,11 @@
1
- import { Nn as readInboundMessageSender, i as getConversationStore, lu as remindsNoReplyForChildStatus, mo as publishAgentUpdate, oc as SYSTEM_IDENTITY_ID, rn as getConversationWorkState } from "./db-BFmyYZtJ.js";
2
- import { O as EVENT_WAIT_MS, Rt as buildDeterministicTurnId, S as getAgentReplyMessageId, U as enqueueAutomatedInput, W as getConversationStoppedAtMs, Xn as EVENT_SYSTEM_ACTOR, b as readAgentConfig, i as listActiveMailboxTurns, x as getAgentMessageId } from "./mailbox-turn-uSXhUFc9.js";
3
- import { c as listUnreportedSiblingAgents, m as readChildConversationSender, n as recordChildAgentEnded, s as listOpenChildAgents, t as parentResultActor } from "./parent-result-Ck1rFYRQ.js";
4
- import { t as resultAuthorId } from "./sender-actors-CPglLd5R.js";
5
- import { n as listChildMessages, t as childMessageSenderMetadata } from "./child-message-DHjQLEd1.js";
6
- import { U as renderDataTag } from "./prompt-Dv7gkpD6.js";
7
- import { _ as NO_REPLY_TOOL_NAME } from "./system-prompt-table-CiXy0eNR.js";
8
- import { En as AGENT_UPDATE_EVENT_TYPE, Tn as AGENT_MESSAGE_EVENT_TYPE, wn as AGENT_EVENT_NAMESPACE } from "./types-C4iC-IMC.js";
1
+ import { $s as SYSTEM_IDENTITY_ID, Fn as readInboundMessageSender, Hl as EVENT_SYSTEM_ACTOR, Kl as CORE_EVENT_NAMESPACE, Ll as remindsNoReplyForChildStatus, Pl as parentResultActor, an as getConversationWorkState, i as getConversationStore, xo as publishAgentUpdate } from "./db-of6e3sGt.js";
2
+ import { H as enqueueAutomatedInput, O as EVENT_WAIT_MS, S as getAgentReplyMessageId, U as getConversationStoppedAtMs, Vt as buildDeterministicTurnId, b as readAgentConfig, i as listActiveMailboxTurns, x as getAgentMessageId } from "./mailbox-turn-Byrry9o1.js";
3
+ import { o as listOpenChildAgents, p as readChildConversationSender, s as listUnreportedSiblingAgents, t as recordChildAgentEnded } from "./markers-CTTtJqYn.js";
4
+ import { t as resultAuthorId } from "./sender-actors-77zTQbSG.js";
5
+ import { t as listChildMessages } from "./child-message-peFWLcCZ.js";
6
+ import { H as renderDataTag } from "./prompt-DEkStuxG.js";
7
+ import { _ as NO_REPLY_TOOL_NAME } from "./system-prompt-table-Ci6Ck4gk.js";
8
+ import { Rn as AGENT_MESSAGE_EVENT_TYPE, zn as AGENT_UPDATE_EVENT_TYPE } from "./types-DCzTAA63.js";
9
9
  // src/chat/child-agents/store.ts
10
10
  /**
11
11
  * Read the name, agent type, fork flag, and title of one child Conversation,
@@ -139,7 +139,7 @@ async function enqueueAgentMessageToParent(args) {
139
139
  eventKey: inboundMessageId,
140
140
  eventType: AGENT_MESSAGE_EVENT_TYPE,
141
141
  identifier: senderId,
142
- namespace: AGENT_EVENT_NAMESPACE,
142
+ namespace: CORE_EVENT_NAMESPACE,
143
143
  trustedSummary: summary
144
144
  });
145
145
  await enqueueAutomatedInput({
@@ -200,14 +200,14 @@ async function enqueueStarterUpdate(args) {
200
200
  eventKey: inboundMessageId,
201
201
  eventType: AGENT_UPDATE_EVENT_TYPE,
202
202
  identifier: senderId,
203
- namespace: AGENT_EVENT_NAMESPACE,
203
+ namespace: CORE_EVENT_NAMESPACE,
204
204
  ...stillWorks ? void 0 : { status },
205
205
  trustedSummary: `${childAgentLabel(args.sender)} ${stillWorks ? "sent a message." : RESULT_SUMMARIES[status]}`
206
206
  }),
207
- ...childMessageSenderMetadata({
207
+ sender: {
208
208
  conversationId: senderId,
209
209
  turnId: args.turnId
210
- })
210
+ }
211
211
  };
212
212
  await enqueueAutomatedInput({
213
213
  message: {
@@ -1,9 +1,10 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { $r as getDispatchIdForConversation, Bo as credentialContextForActor, Oa as linkAutomationRunConversation, Qr as getDispatchConversationId, Vt as appendAndEnqueueInboundMessage, Xr as confirmDispatchMailboxAppend, Yr as claimDispatchMailboxAppend, ci as markDispatchCompleted, ei as getDispatchInputMessageId, hu as indexEndedTurnEvents, i as getConversationStore, ii as isTerminalDispatchStatus, li as markDispatchFailed, ni as getDispatchTurnId, o as getSqlExecutor, oi as markDispatchAwaitingResume, sc as resolveActorIdentityId, si as markDispatchBlocked, ti as getDispatchRecord, ui as markDispatchRunning } from "./db-BFmyYZtJ.js";
3
- import { h as logWarn } from "./logging--smS7XRK.js";
4
- import { Cr as listTurnSummaries, Sr as getTurnRecord, a as resolveMailboxTurnWork, at as isCooperativeTurnYieldError, cr as AuthorizationFlowDisabledError, ir as PluginCredentialFailureError, it as getConversationTurnBoundaryError, nt as TurnInputCommitLostError, ot as isTurnInputCommitLostError, wr as recordTurnSummary } from "./mailbox-turn-uSXhUFc9.js";
5
- import { n as recordChildAgentEnded } from "./parent-result-Ck1rFYRQ.js";
6
- import { n as withSenderActors } from "./sender-actors-CPglLd5R.js";
2
+ import { Fa as linkAutomationRunConversation, Ut as appendAndEnqueueInboundMessage, ai as getDispatchIdForConversation, ci as getDispatchTurnId, ec as resolveActorIdentityId, fi as markDispatchAwaitingResume, gi as markDispatchRunning, hi as markDispatchFailed, i as getConversationStore, ii as getDispatchConversationId, mi as markDispatchCompleted, ni as confirmDispatchMailboxAppend, o as getSqlExecutor, oi as getDispatchInputMessageId, pi as markDispatchBlocked, si as getDispatchRecord, ti as claimDispatchMailboxAppend, ui as isTerminalDispatchStatus, uu as indexEndedTurnEvents } from "./db-of6e3sGt.js";
3
+ import { n as credentialContextForActor } from "./context-BKF_5zzI.js";
4
+ import { m as logWarn } from "./logging-BnOG0qz2.js";
5
+ import { Sr as recordTurnSummary, a as resolveMailboxTurnWork, at as isTurnInputCommitLostError, br as getTurnRecord, it as isCooperativeTurnYieldError, nr as PluginCredentialFailureError, or as AuthorizationFlowDisabledError, rt as getConversationTurnBoundaryError, tt as TurnInputCommitLostError, xr as listTurnSummaries } from "./mailbox-turn-Byrry9o1.js";
6
+ import { t as recordChildAgentEnded } from "./markers-CTTtJqYn.js";
7
+ import { n as withSenderActors } from "./sender-actors-77zTQbSG.js";
7
8
  import * as z from "zod";
8
9
  // src/chat/agent-dispatch/work.ts
9
10
  const agentDispatchMailboxMetadataSchema = z.object({
@@ -1,12 +1,13 @@
1
- import { Ht as messageCardText } from "./types-C4iC-IMC.js";
2
- import { a as buildDeliveredTurnStatePatch, o as loadPendingMessageCards, r as completeAuthPauseTurn, t as buildTurnThreadContext } from "./thread-context-CqZDKErp.js";
3
- import { h as getAssistantReplyText } from "./system-prompt-table-CiXy0eNR.js";
4
- import { S as setTags, T as withLogContext, p as logException } from "./logging--smS7XRK.js";
5
- import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-C9Yc2_ae.js";
6
- import { Er as getTurnLifecycle, Fn as persistConversationMessages, Gn as recordDeliveredAssistantMessage, Hn as latestConversationMessageSeq, Jn as upsertConversationMessage, Nn as hydrateConversationMessages, Rr as finalizeFailedTurnReplyWithEvent, Tn as recordAuthorizationCompleted, Un as markConversationMessage, Wn as normalizeConversationText, _t as coerceThreadConversationState, dt as startActiveTurn, gn as commitAcceptedReply, gt as persistThreadStateById, mt as getPersistedThreadState, or as authorizationId, pt as getPersistedSandboxState, ti as persistWithRetry, ut as markTurnFailed, vr as saveTurnCheckpoint, yn as loadConversationProjection } from "./mailbox-turn-uSXhUFc9.js";
7
- import { Bo as credentialContextForActor, i as getConversationStore, oc as SYSTEM_IDENTITY_ID } from "./db-BFmyYZtJ.js";
8
- import { randomUUID } from "node:crypto";
1
+ import { Ht as messageCardText } from "./types-DCzTAA63.js";
2
+ import { i as loadPendingMessageCards, r as buildDeliveredTurnStatePatch, t as completeAuthPauseTurn } from "./auth-pause-state-f9hJM_zO.js";
3
+ import { h as getAssistantReplyText } from "./system-prompt-table-Ci6Ck4gk.js";
4
+ import { f as logException, w as withLogContext, x as setTags } from "./logging-BnOG0qz2.js";
5
+ import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-BJ9Up3bG.js";
6
+ import { En as recordAuthorizationCompleted, Gn as normalizeConversationText, In as persistConversationMessages, Kn as recordDeliveredAssistantMessage, Lr as finalizeFailedTurnReplyWithEvent, Pn as hydrateConversationMessages, Un as latestConversationMessageSeq, Wn as markConversationMessage, Xn as upsertConversationMessage, _n as commitAcceptedReply, bn as loadConversationProjection, ei as persistWithRetry, ft as getPersistedSandboxState, gr as saveTurnCheckpoint, gt as coerceThreadConversationState, ht as persistThreadStateById, ir as authorizationId, lt as markTurnFailed, pt as getPersistedThreadState, ut as startActiveTurn, wr as getTurnLifecycle } from "./mailbox-turn-Byrry9o1.js";
7
+ import { n as credentialContextForActor } from "./context-BKF_5zzI.js";
8
+ import { $s as SYSTEM_IDENTITY_ID, i as getConversationStore } from "./db-of6e3sGt.js";
9
9
  import { createLocalSource, localDestinationSchema } from "@sentry/junior-plugin-api";
10
+ import { randomUUID } from "node:crypto";
10
11
  // src/chat/local/runner.ts
11
12
  /**
12
13
  * Local agent turn runtime.
@@ -179,16 +180,7 @@ async function runLocalAgentTurnInContext(input, deps) {
179
180
  conversationId: input.conversationId,
180
181
  turnId,
181
182
  runId: currentRunId,
182
- instruction: {
183
- text,
184
- context: await buildTurnThreadContext({
185
- conversation,
186
- conversationId: input.conversationId,
187
- excludeMessageIds: [userMessageId],
188
- hasHistory: Boolean(history?.messages.length),
189
- turnId
190
- })
191
- },
183
+ instruction: { text },
192
184
  history,
193
185
  actor: localActor,
194
186
  credentialContext: credentialContextForActor(localActor),
@@ -1,4 +1,4 @@
1
- import { k as sandboxEgressSignalsResponseSchema } from "./profile-BQ-iBDsZ.js";
1
+ import { k as sandboxEgressSignalsResponseSchema } from "./profile-iHw1uu32.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;
@@ -1,7 +1,7 @@
1
1
  import "./user-customization-CvfuY9Eo.js";
2
- import { F as actorIdentitySchema, G as conversationParamsSchema, Jt as inputFileSchema, Lt as conversationTreeStateSchema, Q as conversationUsageSchema, Rn as notificationScheduleSchema, X as conversationSummaryReportSchema, dn as inboxItemNoticeRequestSchema, et as conversationChildAgentTotalsSchema, i as TODO_STATUSES, pn as inboxItemRequestSchema, z as conversationAuxiliaryCostsSchema } from "./types-C4iC-IMC.js";
2
+ import { F as actorIdentitySchema, G as conversationParamsSchema, Jt as inputFileSchema, Lt as conversationTreeStateSchema, Q as conversationUsageSchema, X as conversationSummaryReportSchema, dn as inboxItemNoticeRequestSchema, et as conversationChildAgentTotalsSchema, i as TODO_STATUSES, jn as notificationScheduleSchema, pn as inboxItemRequestSchema, z as conversationAuxiliaryCostsSchema } from "./types-DCzTAA63.js";
3
3
  import { a as fillUtcDays, l as sumUtcHoursIntoSixHours, m as CHILD_AGENT_RESULTS, o as fillUtcHours, t as AGENT_STATUSES } from "./agent-status-BA5x3Xtp.js";
4
- import { f as conversationTitleSchema } from "./conversation-feed--9S0_PXL.js";
4
+ import { f as conversationTitleSchema } from "./conversation-feed-Cj7IuBtM.js";
5
5
  import { t as isPushServiceEndpoint } from "./push-endpoint-CO-nomUd.js";
6
6
  import * as z from "zod";
7
7
  import { codeChangeStateSchema, eventMatchSchema, objectTypeSchema, ownedObjectAnnotationSchema } from "@sentry/junior-plugin-api";
@@ -1,7 +1,7 @@
1
- import { L as mapBounded } from "./prompt-Dv7gkpD6.js";
2
- import { Xn as EVENT_SYSTEM_ACTOR, g as parentMessageText, h as logDroppedParentMessage } from "./mailbox-turn-uSXhUFc9.js";
3
- import { f as isDroppedChildInput, l as childAgentInput, u as getChildAgentInputSender } from "./parent-result-Ck1rFYRQ.js";
4
- import { Mn as readParentMessage } from "./db-BFmyYZtJ.js";
1
+ import { G as mapBounded } from "./prompt-DEkStuxG.js";
2
+ import { Hl as EVENT_SYSTEM_ACTOR, Pn as readParentMessage } from "./db-of6e3sGt.js";
3
+ import { c as childAgentInput, d as isDroppedChildInput, l as getChildAgentInputSender, m as readChildInputDropFacts } from "./markers-CTTtJqYn.js";
4
+ import { _ as parentMessageText, g as logDroppedParentMessage } from "./mailbox-turn-Byrry9o1.js";
5
5
  import * as z from "zod";
6
6
  import { actorSchema } from "@sentry/junior-plugin-api";
7
7
  // src/chat/child-agents/sender-actors.ts
@@ -39,10 +39,11 @@ function senderActorFromMetadata(metadata) {
39
39
  */
40
40
  async function withSenderActors(work) {
41
41
  if (work.kind !== "mailbox") return work;
42
+ const dropFacts = await readChildInputDropFacts(work.batch.map((entry) => entry.message));
42
43
  const kept = (await mapBounded(work.batch, async (entry) => {
43
44
  const parentMessage = readParentMessage(entry.message);
44
45
  if (parentMessage) {
45
- if (await isDroppedChildInput(entry.message)) {
46
+ if (isDroppedChildInput(entry.message, dropFacts)) {
46
47
  logDroppedParentMessage(entry.message, parentMessage);
47
48
  return;
48
49
  }
@@ -63,7 +64,7 @@ async function withSenderActors(work) {
63
64
  }
64
65
  const input = childAgentInput(entry.message);
65
66
  if (!input) return entry;
66
- if (await isDroppedChildInput(entry.message)) return;
67
+ if (isDroppedChildInput(entry.message, dropFacts)) return;
67
68
  const sender = await getChildAgentInputSender(entry.message, input);
68
69
  const actor = senderActorFromMetadata(entry.message.input.metadata);
69
70
  if (!sender || !actor || entry.message.input.authorId !== resultAuthorId(actor)) return {
@@ -1,6 +1,6 @@
1
- import { a as disconnectServiceAccount, d as startServiceAccountSignIn, o as finishServiceAccountSignIn, s as getServiceAccountStatus, u as serviceAccountPlugins } from "./registry-iXMT5Jmh.js";
2
- import { n as pluginCatalogRuntime } from "./catalog-runtime-DfSpJZdY.js";
3
- import { Gu as disconnectStateAdapter } from "./db-BFmyYZtJ.js";
1
+ import { a as disconnectServiceAccount, d as startServiceAccountSignIn, o as finishServiceAccountSignIn, s as getServiceAccountStatus, u as serviceAccountPlugins } from "./registry-Cl7Labpe.js";
2
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BfdAnztW.js";
3
+ import { _ as disconnectStateAdapter } from "./context-BKF_5zzI.js";
4
4
  import { CLI_USAGE } from "./cli/run.js";
5
5
  import { createServer } from "node:http";
6
6
  // src/cli/service-account.ts