@sentry/junior 0.315.0 → 0.316.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/{adapter-context-BlSGE44V.js → adapter-context-Bref7aPI.js} +1 -1
  2. package/dist/{admin-5jUYY46p.js → admin-QYiDMnsu.js} +1 -1
  3. package/dist/{agent-runner-C7GNLRB6.js → agent-runner-Cr5Fhjf-.js} +2298 -1866
  4. package/dist/{agent-update-delivery-BNEYQsAf.js → agent-update-delivery-BY13DPSD.js} +10 -37
  5. package/dist/api/schema.d.ts +69 -20
  6. package/dist/api/schema.js +4 -4
  7. package/dist/api.js +202 -315
  8. package/dist/{app-D_bAXRDe.d.ts → app-BhvzRD__.d.ts} +18 -14
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +34 -34
  11. package/dist/{chat-core-engine-CxkwRpn9.js → chat-core-engine-3dtlMku3.js} +3 -3
  12. package/dist/cli/chat.js +17 -17
  13. package/dist/cli/check.js +4 -4
  14. package/dist/cli/main.js +2 -2
  15. package/dist/cli/plugins.js +3 -3
  16. package/dist/cli/snapshot-create.js +2 -2
  17. package/dist/cli/upgrade.js +23 -3
  18. package/dist/{continue-in-slack-BGKjIdFp.js → continue-in-slack-DbQUFe_F.js} +3 -3
  19. package/dist/{conversation-feed-Sl8lKKmR.js → conversation-feed-B84pMjHo.js} +8 -3
  20. package/dist/{conversation-turn-BoLK9i6g.js → conversation-turn-DzEpTIaf.js} +16 -109
  21. package/dist/{create-BOycVH9h.js → create-DUJBXr6E.js} +4 -5
  22. package/dist/{credential-sync-Mn4OdkEh.js → credential-sync-JH_K9Adg.js} +9 -9
  23. package/dist/{db-DXTOYRzR.js → db-DhzvUY23.js} +343 -179
  24. package/dist/{deployment-CG3TchWh.js → deployment-BhvrhQeh.js} +1 -1
  25. package/dist/{engine-context-dyWlfNdD.js → engine-context-C9Nal48K.js} +9 -12
  26. package/dist/{html-CfXEwl_h.js → html-B_12WjKT.js} +2 -2
  27. package/dist/instrumentation.js +2 -2
  28. package/dist/{job-runner-CySgpi9v.js → job-runner-DO8nslyY.js} +17 -9
  29. package/dist/{lineage-tRTOcrsL.js → lineage-D3AZAJVe.js} +1 -1
  30. package/dist/{list-DXBz8SYL.js → list-B0zsb5Cp.js} +64 -182
  31. package/dist/{parent-result-Dg6P6roR.js → list-mkB_GU8R.js} +80 -108
  32. package/dist/{logging-czs0nqLC.js → logging-B8KEJegM.js} +1 -1
  33. package/dist/{media-Cr9pGkzr.js → media-BebquhET.js} +15 -3
  34. package/dist/{message-BTox2Cmb.js → message-B5fKDYzz.js} +8 -8
  35. package/dist/{model-input-IRGa98V7.js → model-input-CuMWy37l.js} +3 -3
  36. package/dist/nitro.d.ts +1 -1
  37. package/dist/nitro.js +2 -2
  38. package/dist/{oauth-callback-server-NXK7AlBp.js → oauth-callback-server-B3Vvlydo.js} +2 -2
  39. package/dist/{oauth-relay-6NBPSpFE.js → oauth-relay-6ERrGPbA.js} +1 -1
  40. package/dist/{people-Cegp1Iwq.js → people-CUtFApfL.js} +2 -2
  41. package/dist/{proxy-path-Dc-0jXGi.js → proxy-path-BTmXDjfx.js} +1 -1
  42. package/dist/{resolve-BUFkmxkT.js → resolve-D5JVvv6A.js} +3 -3
  43. package/dist/{result-DfATzX77.js → result-CS_7mo8a.js} +30 -14
  44. package/dist/{runner-CmKP3inb.js → runner-BzAES5W3.js} +7 -7
  45. package/dist/{sandbox-egress-signals-DYo5BsM7.js → sandbox-egress-signals-Dwhk2Q5F.js} +1 -1
  46. package/dist/{schema-DrBMdPmv.js → schema-z5-wA6N4.js} +34 -13
  47. package/dist/{service-account-CxTX7nnR.js → service-account-D6AsAtc1.js} +1 -1
  48. package/dist/{mailbox-turn-79Nv1JXv.js → session-stop-DponjDUZ.js} +3075 -3092
  49. package/dist/{skills-BlHUDj7k.js → skills-DgJ9GBPR.js} +3 -3
  50. package/dist/{slack-conversation-unfurl-Dhe3lB1U.js → slack-conversation-unfurl-Dq71EkhM.js} +6 -6
  51. package/dist/{spawn-CfvlFdfz.js → spawn-BJWpdwhQ.js} +4 -4
  52. package/dist/{start-conversation-Uh8Sk1EF.js → start-conversation-B-LIqqNi.js} +2 -2
  53. package/dist/{system-prompt-table-CDCYVwqN.js → system-prompt-table-iIgpmslr.js} +6 -4
  54. package/dist/{task-runner-DcdQJd9e.js → task-runner-BJae4JwE.js} +23 -11
  55. package/dist/{thread-context-DF5uDcWN.js → thread-context-fiMNylbg.js} +5 -5
  56. package/dist/{transcript-BHhJVY0P.js → transcript-CCi7323k.js} +1 -1
  57. package/dist/{turn-session-routing-GtetHsdO.js → turn-session-routing-D15orfwy.js} +7 -7
  58. package/dist/{turn-wake-um5Ubd4m.js → turn-wake-BjDW7x-5.js} +4 -4
  59. package/dist/{validation-CJyuOPD2.js → validation-D5WmmmhX.js} +1 -1
  60. package/dist/{version-Bhe7RPIe.js → version-CBQoanXb.js} +1 -1
  61. package/dist/version.js +1 -1
  62. package/dist/{worker-D8PRgUqr.js → worker-Cyb4kF17.js} +3 -3
  63. package/migrations/20261125171254_conversation_visibility/migration.sql +4 -0
  64. package/migrations/20261125171254_conversation_visibility/snapshot.json +67 -0
  65. package/migrations/20261125171257_conversation_visibility_backfill/migration.sql +25 -0
  66. package/migrations/20261125171257_conversation_visibility_backfill/snapshot.json +9 -0
  67. package/migrations/20261125213232_drop_versions_notify/migration.sql +19 -0
  68. package/migrations/20261125213232_drop_versions_notify/snapshot.json +9 -0
  69. package/migrations/20261125225138_conversation_kind_root_thread/migration.sql +23 -0
  70. package/migrations/20261125225138_conversation_kind_root_thread/snapshot.json +55 -0
  71. package/migrations/20261125225142_conversation_kind_root_thread_backfill/migration.sql +7 -0
  72. package/migrations/20261125225142_conversation_kind_root_thread_backfill/snapshot.json +9 -0
  73. package/migrations/20261126000151_conversation_event_message_role_seq_index/migration.sql +1 -0
  74. package/migrations/20261126000151_conversation_event_message_role_seq_index/snapshot.json +69 -0
  75. package/migrations/20261126012917_merge_leaves/migration.sql +2 -0
  76. package/migrations/20261126012917_merge_leaves/snapshot.json +12 -0
  77. package/package.json +5 -5
  78. package/skills/jr-rpc/SKILL.md +3 -5
  79. package/dist/direct-url-BYgYfuIy.js +0 -22
  80. package/dist/markers-CE0HMXWT.js +0 -67
@@ -1,12 +1,10 @@
1
- import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { Ci as readParentMessage, K as getConversationStoppedAtMs, Mn as buildDeterministicTurnId, N as isEventMailboxMetadata, Nn as conversationSubtree, Pn as conversationSubtreeColumns, T as isPersonStopTurnId, _ as readChildOfStoredParent, b as readAgentConfig, dn as getConversationWorkState, fn as getConversationWorkStates, i as listActiveMailboxTurns, jr as EVENT_SYSTEM_ACTOR, r as listActiveMailboxTurnSources, vi as readInboundMessageSender } from "./mailbox-turn-79Nv1JXv.js";
3
- import { Wf as TURN_REASONING_LEVELS, Wt as isPersonInput, bu as juniorConversations, i as getConversationStore, id as listWatches, o as getSqlExecutor, rf as credentialContextSchema, ru as juniorAgentBindings, ws as conversationTurnFailedSql } from "./db-DXTOYRzR.js";
4
- import { An as isAgentUpdateEventType, ot as agentTypeSchema } from "./media-Cr9pGkzr.js";
5
- import { G as mapBounded } from "./transcript-BHhJVY0P.js";
1
+ import { Tu as juniorConversations, Wt as isPersonInput, cu as juniorAgentBindings, hu as juniorConversationEvents, i as getConversationStore, n as getConversationEventStore, o as getSqlExecutor, ws as conversationTurnFailedSql } from "./db-DhzvUY23.js";
2
+ import { G as mapBounded } from "./transcript-CCi7323k.js";
3
+ import { An as isAgentUpdateEventType } from "./media-BebquhET.js";
4
+ import { E as readChildOfStoredParent, P as isPersonStopTurnId, Xt as getConversationWorkState, Zt as getConversationWorkStates, c as conversationSubtreeColumns, dn as isEventMailboxMetadata, et as buildDeterministicTurnId, f as listActiveMailboxTurnSources, gi as readInboundMessageSender, k as readAgentConfig, kr as EVENT_SYSTEM_ACTOR, n as getConversationStoppedAtMs, p as listActiveMailboxTurns, s as conversationSubtree, xi as readParentMessage } from "./session-stop-DponjDUZ.js";
6
5
  import * as z from "zod";
7
6
  import pLimit from "p-limit";
8
- import { actorSchema } from "@sentry/junior-plugin-api";
9
- import { and, desc, eq, isNotNull, ne, sql } from "drizzle-orm";
7
+ import { and, desc, eq, inArray, isNotNull, ne, sql } from "drizzle-orm";
10
8
  import { alias } from "drizzle-orm/pg-core";
11
9
  // src/chat/agent-invocations/child-input.ts
12
10
  function childAgentInputKind(namespace, eventType, watchId) {
@@ -93,44 +91,82 @@ async function getChildAgentInputSender(message, input) {
93
91
  const sender = await readChildConversationSender(input.senderId);
94
92
  return sender?.parentConversationId === message.conversationId ? sender : void 0;
95
93
  }
96
- // src/chat/agent-invocations/types.ts
97
- const exactStringSchema = z.string().min(1).refine((value) => value === value.trim());
98
- const agentNameSchema = exactStringSchema.max(64);
94
+ // src/chat/agent-invocations/markers.ts
95
+ const SUBAGENT_KIND = "agent";
96
+ const SUBAGENT_STARTED_KEY_PREFIX = "subagent_started:";
97
+ const SUBAGENT_ENDED_KEY_PREFIX = "subagent_ended:";
99
98
  /**
100
- * Kind of a new child Conversation. A Thread is a child that people can
101
- * message; a Task is one that only its parent messages.
99
+ * Record in the parent Conversation that a child agent got one task or
100
+ * message. Write it before the input reaches the child's mailbox, so the
101
+ * child cannot end first.
102
102
  */
103
- const CHILD_AGENT_KINDS = ["thread", "task"];
104
- /** `messageAgent` target for the parent of a child agent. */
105
- const PARENT_AGENT_TARGET = "parent";
106
- const agentBindingSchema = z.object({
107
- childConversationId: exactStringSchema,
108
- name: agentNameSchema,
109
- parentConversationId: exactStringSchema
110
- }).strict();
111
- /** Input of one `startAgent` call that starts a child agent. */
112
- const spawnChildAgentInputSchema = z.object({
113
- actor: actorSchema,
114
- agentName: agentNameSchema.optional(),
115
- credentialContext: credentialContextSchema.optional(),
116
- idempotencyKey: exactStringSchema,
117
- input: exactStringSchema,
118
- kind: z.enum(CHILD_AGENT_KINDS).default("task"),
119
- parentConversationId: exactStringSchema,
120
- parentToolCallId: exactStringSchema,
121
- agentType: agentTypeSchema.optional(),
122
- fork: z.literal(true).optional(),
123
- reasoningLevel: z.enum(TURN_REASONING_LEVELS).optional(),
124
- title: exactStringSchema.optional()
125
- }).strict();
126
- /** How a finished task of a child agent ended. A stop is not a result. */
127
- const CHILD_AGENT_RESULTS = [
128
- "completed",
129
- "blocked",
130
- "failed"
131
- ];
103
+ async function recordSubagentStartedMarker(start) {
104
+ await getConversationEventStore().append(start.parentConversationId, [{
105
+ idempotencyKey: `${SUBAGENT_STARTED_KEY_PREFIX}${start.markerId}`,
106
+ data: {
107
+ type: "subagent_started",
108
+ subagentInvocationId: start.markerId,
109
+ subagentKind: SUBAGENT_KIND,
110
+ childConversationId: start.childConversationId,
111
+ ...start.agentName ? { agentName: start.agentName } : void 0,
112
+ parentToolCallId: start.parentToolCallId,
113
+ task: start.input,
114
+ ...start.title ? { title: start.title } : void 0,
115
+ ...start.reasoningLevel ? { reasoningLevel: start.reasoningLevel } : void 0
116
+ },
117
+ createdAtMs: start.createdAtMs
118
+ }]);
119
+ }
120
+ /**
121
+ * Record in the parent Conversation how the work of a child agent ended.
122
+ * Each parent message has its own `subagent_started` marker, named by the
123
+ * message id, and each one that the child already took ends with `outcome`.
124
+ * A parent message that still waits in the child's mailbox stays open,
125
+ * because later work reads it, unless `includeWaiting` is set, as for a stop
126
+ * that skips it. Write it before the child's result reaches the parent.
127
+ */
128
+ async function recordChildAgentEnded(childConversationId, outcome, options = {}) {
129
+ if (!await readAgentConfig(childConversationId)) return;
130
+ const work = await getConversationWorkState({
131
+ conversationId: childConversationId,
132
+ state: options.state
133
+ });
134
+ const running = new Set(work?.runningInboundMessageIds);
135
+ const waiting = new Set(options.includeWaiting ? [] : (work?.messages ?? []).map((message) => message.inboundMessageId).filter((id) => !running.has(id)));
136
+ const taken = (work?.execution.inboundMessageIds ?? []).filter((id) => !waiting.has(id));
137
+ if (taken.length === 0) return;
138
+ const sender = await readChildConversationSender(childConversationId);
139
+ if (!sender) return;
140
+ const keys = await getSqlExecutor().db().select({ idempotencyKey: juniorConversationEvents.idempotencyKey }).from(juniorConversationEvents).where(and(eq(juniorConversationEvents.conversationId, sender.parentConversationId), inArray(juniorConversationEvents.idempotencyKey, taken.flatMap((id) => [`${SUBAGENT_STARTED_KEY_PREFIX}${id}`, `${SUBAGENT_ENDED_KEY_PREFIX}${id}`]))));
141
+ const found = new Set(keys.map((row) => row.idempotencyKey));
142
+ const open = taken.filter((id) => found.has(`${SUBAGENT_STARTED_KEY_PREFIX}${id}`) && !found.has(`${SUBAGENT_ENDED_KEY_PREFIX}${id}`));
143
+ if (open.length > 0) await appendSubagentEnded(sender.parentConversationId, open, outcome, options.nowMs ?? Date.now());
144
+ }
145
+ async function appendSubagentEnded(parentConversationId, markerIds, outcome, createdAtMs) {
146
+ await getConversationEventStore().append(parentConversationId, markerIds.map((id) => ({
147
+ idempotencyKey: `${SUBAGENT_ENDED_KEY_PREFIX}${id}`,
148
+ data: {
149
+ type: "subagent_ended",
150
+ subagentInvocationId: id,
151
+ outcome
152
+ },
153
+ createdAtMs
154
+ })));
155
+ }
156
+ // src/chat/agent-invocations/parent-result.ts
157
+ /**
158
+ * Return the Actor that a child Turn's update carries to its parent, whose
159
+ * Turn for it runs as that Actor. Only a Turn that agent work started, a
160
+ * parent message or an Event such as a child result, keeps its Actor. Any
161
+ * other Turn, such as a person's Turn in a Thread or a saved Turn with no
162
+ * Source, reports as the Event system Actor, so the parent never gets a
163
+ * person's access.
164
+ */
165
+ function parentResultActor(actor, source) {
166
+ return source === "parent_message" || source === "event" ? actor : EVENT_SYSTEM_ACTOR;
167
+ }
132
168
  // src/chat/agent-invocations/list.ts
133
- const childAgentKindSchema = z.enum(CHILD_AGENT_KINDS);
169
+ const childConversationKindSchema = z.enum(["thread", "task"]);
134
170
  /** Bound the child agents that one listing reads. */
135
171
  const CHILD_AGENT_LIST_LIMIT = 200;
136
172
  /**
@@ -159,7 +195,7 @@ async function listChildAgents(parentConversationId) {
159
195
  const [workStates, mailboxTurnSources] = await Promise.all([getConversationWorkStates(ids), listActiveMailboxTurnSources(ids)]);
160
196
  const limit = pLimit(8);
161
197
  return (await Promise.all(rows.map(async (row) => {
162
- const kind = childAgentKindSchema.parse(row.kind);
198
+ const kind = childConversationKindSchema.parse(row.kind);
163
199
  const stoppedAtMs = row.stoppedAt?.getTime();
164
200
  const running = stoppedAtMs === void 0 && await limit(() => runsOnConversationLoop(workStates.get(row.conversationId)?.execution.pendingMessages ?? [], mailboxTurnSources.get(row.conversationId) ?? []));
165
201
  return {
@@ -191,17 +227,6 @@ async function runsOnConversationLoop(pending, mailboxTurnSources) {
191
227
  return false;
192
228
  }
193
229
  /**
194
- * Return whether input waits in a child's mailbox that will run a later Turn
195
- * that answers its parent, such as a fired Timer whose Watch is already gone.
196
- * The input that the running attempt took belongs to its own Turn, which
197
- * can ack it as late as its end.
198
- */
199
- async function hasWaitingParentWork(conversationId) {
200
- const work = await getConversationWorkState({ conversationId });
201
- const running = new Set(work?.runningInboundMessageIds);
202
- return await runsOnConversationLoop((work?.messages ?? []).filter((message) => !running.has(message.inboundMessageId)), []);
203
- }
204
- /**
205
230
  * List the ids of a child's open Turns on the Conversation loop. A Turn keeps
206
231
  * its input in the mailbox until it commits it, so before its first
207
232
  * checkpoint its id comes from its first input. Attempt selection can take
@@ -267,57 +292,4 @@ async function listAgentRelatives(input) {
267
292
  siblings: family.filter((agent) => agent.childConversationId !== conversationId)
268
293
  };
269
294
  }
270
- // src/chat/agent-invocations/store.ts
271
- /**
272
- * Read the name, agent type, fork flag, and title of one child Conversation,
273
- * for labels, from its binding, title, and agent config.
274
- */
275
- async function getChildAgentLabel(childConversationId) {
276
- const [sender, options] = await Promise.all([readChildConversationSender(childConversationId), readAgentConfig(childConversationId)]);
277
- return sender && options ? {
278
- agentName: sender.agentName ?? null,
279
- agentType: options.agentType ?? null,
280
- fork: options.fork ?? false,
281
- title: sender.title ?? null
282
- } : void 0;
283
- }
284
- /**
285
- * Return whether a child agent still works when its Turn ends with final
286
- * text: one of its own child agents has open work, or a result or message
287
- * from one of them waits in its mailbox. That final text then goes to the
288
- * parent as a message, not as the child's result.
289
- */
290
- async function childAgentStillWorks(conversationId) {
291
- if ((await listOpenChildAgents(conversationId)).length > 0) return true;
292
- return ((await getConversationWorkState({ conversationId }))?.messages ?? []).some((message) => readInboundMessageSender(message) !== void 0);
293
- }
294
- // src/chat/agent-invocations/parent-result.ts
295
- var parent_result_exports = /* @__PURE__ */ __exportAll({ childWorkGoesOn: () => childWorkGoesOn });
296
- /**
297
- * Return the Actor that a child Turn's update carries to its parent, whose
298
- * Turn for it runs as that Actor. Only a Turn that agent work started, a
299
- * parent message or an Event such as a child result, keeps its Actor. Any
300
- * other Turn, such as a person's Turn in a Thread or a saved Turn with no
301
- * Source, reports as the Event system Actor, so the parent never gets a
302
- * person's access.
303
- */
304
- function parentResultActor(actor, source) {
305
- return source === "parent_message" || source === "event" ? actor : EVENT_SYSTEM_ACTOR;
306
- }
307
- /**
308
- * Return whether the work of a child agent goes on after a Turn ends: one
309
- * of its own child agents still works, it has an active Watch or Timer, or
310
- * input waits to run a later Turn. A `noReply` end then has nothing new for
311
- * the agent that started it, which waits for the child's last word. A root
312
- * has no starter, so its work never goes on here.
313
- */
314
- async function childWorkGoesOn(conversationId) {
315
- if (!await readChildConversationSender(conversationId)) return false;
316
- const [stillWorks, watches, waiting] = await Promise.all([
317
- childAgentStillWorks(conversationId),
318
- listWatches({ conversationId }),
319
- hasWaitingParentWork(conversationId)
320
- ]);
321
- return stillWorks || watches.length > 0 || waiting;
322
- }
323
- export { getChildAgentInputSender as _, listAgentRelatives as a, readChildConversationSender as b, listOpenChildAgents as c, CHILD_AGENT_RESULTS as d, PARENT_AGENT_TARGET as f, childAgentInput as g, spawnChildAgentInputSchema as h, getChildAgentLabel as i, listUnreportedSiblingAgents as l, agentNameSchema as m, parent_result_exports as n, listChildAgents as o, agentBindingSchema as p, childAgentStillWorks as r, listDescendantAgents as s, parentResultActor as t, CHILD_AGENT_KINDS as u, isChildAgentEvent as v, isDroppedChildInput as y };
295
+ export { listUnreportedSiblingAgents as a, recordSubagentStartedMarker as c, isChildAgentEvent as d, isDroppedChildInput as f, listOpenChildAgents as i, childAgentInput as l, listChildAgents as n, parentResultActor as o, readChildConversationSender as p, listDescendantAgents as r, recordChildAgentEnded as s, listAgentRelatives as t, getChildAgentInputSender as u };
@@ -1,5 +1,5 @@
1
1
  import { _ as withScope, a as getClient, d as setTag, f as setUser, h as startSpan, i as getActiveSpan, l as logger, n as captureMessage, p as spanToJSON, s as getTraceData, t as captureException } from "./sentry-CPbZjomA.js";
2
- import { v as getDeploymentTelemetryAttributes } from "./deployment-CG3TchWh.js";
2
+ import { v as getDeploymentTelemetryAttributes } from "./deployment-BhvrhQeh.js";
3
3
  import path from "node:path";
4
4
  import { styleText } from "node:util";
5
5
  import { ConfigError, configureSync, getConfig, getLogger } from "@logtape/logtape";
@@ -1105,10 +1105,9 @@ const conversationReadPositionSchema = z.object({ lastReadSeq: z.number().int().
1105
1105
  // src/api/schema/conversation-kind.ts
1106
1106
  /** Where a Conversation sits in its tree. See `TERMINOLOGY.md`. */
1107
1107
  const conversationKindSchema = z.enum([
1108
- "root",
1108
+ "thread",
1109
1109
  "automation",
1110
1110
  "lead",
1111
- "thread",
1112
1111
  "task"
1113
1112
  ]);
1114
1113
  // src/api/schema/conversation-tree-state.ts
@@ -1165,7 +1164,16 @@ const spaceSchema = z.object({
1165
1164
  updatedAt: z.iso.datetime(),
1166
1165
  archivedAt: z.iso.datetime().nullable(),
1167
1166
  memberCount: z.number().int().nonnegative(),
1168
- viewerIsMember: z.boolean()
1167
+ viewerIsMember: z.boolean(),
1168
+ /**
1169
+ * The tree states of the Space's Conversations that are not archived,
1170
+ * rolled up for the viewer: the first that applies. List rows only.
1171
+ */
1172
+ treeState: conversationTreeStateSchema.optional(),
1173
+ /**
1174
+ * The latest Turn of one of those Conversations failed. List rows only.
1175
+ */
1176
+ latestTurnFailed: z.boolean().optional()
1169
1177
  }).strict();
1170
1178
  const spaceListSchema = z.object({ spaces: z.array(spaceSchema) }).strict();
1171
1179
  // src/chat/conversations/provenance.ts
@@ -2425,6 +2433,10 @@ const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
2425
2433
  canFork: z.boolean().optional(),
2426
2434
  /** The viewer can move this dashboard conversation to a Slack thread. */
2427
2435
  canContinueInSlack: z.literal(true).optional(),
2436
+ /** The viewer can Invite a person to this conversation. */
2437
+ canInvite: z.literal(true).optional(),
2438
+ /** Leave removes the viewer from this private conversation's access. */
2439
+ leaveEndsAccess: z.literal(true).optional(),
2428
2440
  /**
2429
2441
  * Event Turn replies stay out of the Location. Set only for a root with
2430
2442
  * a Location, when the viewer is a participant, who can change it.
@@ -1,12 +1,12 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { Q as findChildAgentConversationId, R as actorFromRun, st as AgentMessageTargetError } from "./agent-runner-C7GNLRB6.js";
3
- import { El as readConversationAccessFromSql, Wt as isPersonInput, Xc as readActorIdentity, a as getDb, i as getConversationStore, ul as SYSTEM_IDENTITY_ID, xl as canAccessConversation } from "./db-DXTOYRzR.js";
4
- import { b as readChildConversationSender, f as PARENT_AGENT_TARGET } from "./parent-result-Dg6P6roR.js";
5
- import { r as enqueueAgentMessageToParent } from "./result-DfATzX77.js";
6
- import { t as messageChildAgent } from "./create-BOycVH9h.js";
7
- import { G as enqueueAutomatedInput, O as EVENT_WAIT_MS } from "./mailbox-turn-79Nv1JXv.js";
8
- import { H as renderDataTag } from "./transcript-BHhJVY0P.js";
9
- import { o as readLeadSpace } from "./turn-session-routing-GtetHsdO.js";
2
+ import { Q as findChildAgentConversationId, R as actorFromRun, et as PARENT_AGENT_TARGET, it as AgentMessageTargetError } from "./agent-runner-Cr5Fhjf-.js";
3
+ import { Tl as readConversationAccessFromSql, Wt as isPersonInput, a as getDb, i as getConversationStore, qc as readActorIdentity, sl as SYSTEM_IDENTITY_ID, vl as canAccessConversation } from "./db-DhzvUY23.js";
4
+ import { p as readChildConversationSender } from "./list-mkB_GU8R.js";
5
+ import { r as enqueueAgentMessageToParent } from "./result-CS_7mo8a.js";
6
+ import { t as messageChildAgent } from "./create-DUJBXr6E.js";
7
+ import { on as EVENT_WAIT_MS, t as enqueueAutomatedInput } from "./session-stop-DponjDUZ.js";
8
+ import { H as renderDataTag } from "./transcript-CCi7323k.js";
9
+ import { o as readLeadSpace } from "./turn-session-routing-D15orfwy.js";
10
10
  // src/chat/agent-invocations/top-level-message.ts
11
11
  const AGENT_MESSAGE_EVENT_NAMESPACE = "junior";
12
12
  /** Event type of a message from another top-level agent. */
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { o as getSqlExecutor } from "./db-DXTOYRzR.js";
3
- import { i as isVisionImageMediaType, r as detectImageMediaType } from "./media-Cr9pGkzr.js";
4
- import { M as readLiveAttachment } from "./turn-session-routing-GtetHsdO.js";
2
+ import { o as getSqlExecutor } from "./db-DhzvUY23.js";
3
+ import { i as isVisionImageMediaType, r as detectImageMediaType } from "./media-BebquhET.js";
4
+ import { M as readLiveAttachment } from "./turn-session-routing-D15orfwy.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-D_bAXRDe.js";
2
+ import { r as JuniorDashboardOptions } from "./app-BhvzRD__.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
1
  import { _ as readQueueConfig, d as resolvePackageDir, f as BACKGROUND_COMPACTION_QUEUE_TOPIC, g as resolveConversationWorkQueueTopic, h as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, m as PLUGIN_TASK_QUEUE_TOPIC, p as CACHE_WARMUP_QUEUE_TOPIC, t as discoverInstalledPluginPackageContent, u as isValidPackageName, v as resolveBotName } from "./package-discovery-BI6T_RkD.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 { _ as getDeploymentServiceVersion, a as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, c as JUNIOR_HEARTBEAT_ROUTE, d as JUNIOR_RETENTION_ROUTE, f as JUNIOR_TURN_STEP_CALLBACK_ROUTE, 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-CG3TchWh.js";
4
+ import { _ as getDeploymentServiceVersion, a as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, c as JUNIOR_HEARTBEAT_ROUTE, d as JUNIOR_RETENTION_ROUTE, f as JUNIOR_TURN_STEP_CALLBACK_ROUTE, 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-BhvrhQeh.js";
5
5
  import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-BXMdNdyA.js";
6
6
  import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cv2ETe8Y.js";
7
7
  import path from "node:path";
@@ -252,7 +252,7 @@ function injectVirtualConfig(nitro, options) {
252
252
  */
253
253
  function injectVirtualSystemPrompts(nitro, options) {
254
254
  nitro.options.virtual["#junior/system-prompts"] = async () => {
255
- const { buildSystemPromptTable } = await import("./system-prompt-table-CDCYVwqN.js").then((n) => n.r);
255
+ const { buildSystemPromptTable } = await import("./system-prompt-table-iIgpmslr.js").then((n) => n.r);
256
256
  const table = await buildSystemPromptTable(await options.loadPlugins(), options.botName);
257
257
  return `export const systemPrompts = ${JSON.stringify(table)};`;
258
258
  };
@@ -1,5 +1,5 @@
1
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-Mn4OdkEh.js";
2
- import { Cr as createUserTokenStore } from "./db-DXTOYRzR.js";
1
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-JH_K9Adg.js";
2
+ import { wr as createUserTokenStore } from "./db-DhzvUY23.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 { md as readJuniorSecret } from "./db-DXTOYRzR.js";
2
+ import { vd as readJuniorSecret } from "./db-DhzvUY23.js";
3
3
  import * as z from "zod";
4
4
  import { randomBytes } from "node:crypto";
5
5
  import { SignJWT, jwtVerify } from "jose";
@@ -1,5 +1,5 @@
1
- import { V as slackMention, o as getSqlExecutor, wu as juniorIdentities } from "./db-DXTOYRzR.js";
2
- import { N as normalizeIdentityEmail } from "./logging-czs0nqLC.js";
1
+ import { V as slackMention, ku as juniorIdentities, o as getSqlExecutor } from "./db-DhzvUY23.js";
2
+ import { N as normalizeIdentityEmail } from "./logging-B8KEJegM.js";
3
3
  import { and, eq, inArray, or, sql } from "drizzle-orm";
4
4
  import { alias } from "drizzle-orm/pg-core";
5
5
  // src/chat/events/people.ts
@@ -1,4 +1,4 @@
1
- import { h as logWarn } from "./logging-czs0nqLC.js";
1
+ import { h as logWarn } from "./logging-B8KEJegM.js";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  import { renderSystemMessageUpdate } from "@earendil-works/pi-ai";
4
4
  // src/chat/conversation-privacy.ts
@@ -1,6 +1,6 @@
1
- import { Ad as sleep, Kn as isStale, Oa as runNonInteractiveCommand, Qd as getStateAdapter, Wn as create, Yn as getSandboxProvider, qn as CURL_DOWNLOAD_ARGS } from "./db-DXTOYRzR.js";
2
- import { E as SANDBOX_COMMAND_PATH, M as SANDBOX_WORKSPACE_ROOT } from "./transcript-BHhJVY0P.js";
3
- import { E as withSpan, b as setSpanAttributes } from "./logging-czs0nqLC.js";
1
+ import { Gn as create, Jn as CURL_DOWNLOAD_ARGS, Oa as runNonInteractiveCommand, Pd as sleep, Xn as getSandboxProvider, nf as getStateAdapter, qn as isStale } from "./db-DhzvUY23.js";
2
+ import { E as SANDBOX_COMMAND_PATH, M as SANDBOX_WORKSPACE_ROOT } from "./transcript-CCi7323k.js";
3
+ import { E as withSpan, b as setSpanAttributes } from "./logging-B8KEJegM.js";
4
4
  import * as z from "zod";
5
5
  // src/chat/sandbox/resources.ts
6
6
  let configuredResources;
@@ -1,11 +1,10 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { Gu as publishAgentUpdate, Ku as starterWatchId, i as getConversationStore, qu as updateEventKey, ul as SYSTEM_IDENTITY_ID } from "./db-DXTOYRzR.js";
3
- import { An as hasConversationNote, Ci as readParentMessage, G as enqueueAutomatedInput, K as getConversationStoppedAtMs, Mn as buildDeterministicTurnId, O as EVENT_WAIT_MS, P as quietEventNoteKey, a as resolveMailboxTurnWork, dn as getConversationWorkState, g as parentMessageText, h as logDroppedParentMessage, i as listActiveMailboxTurns, jr as EVENT_SYSTEM_ACTOR, x as getAgentReplyMessageId } from "./mailbox-turn-79Nv1JXv.js";
4
- import { G as mapBounded, H as renderDataTag } from "./transcript-BHhJVY0P.js";
5
- import { _ as getChildAgentInputSender, b as readChildConversationSender, g as childAgentInput, l as listUnreportedSiblingAgents, r as childAgentStillWorks, t as parentResultActor, y as isDroppedChildInput } from "./parent-result-Dg6P6roR.js";
2
+ import { Xu as publishAgentUpdate, i as getConversationStore, sl as SYSTEM_IDENTITY_ID } from "./db-DhzvUY23.js";
3
+ import { A as getAgentReplyMessageId, T as parentMessageText, Xt as getConversationWorkState, et as buildDeterministicTurnId, gi as readInboundMessageSender, k as readAgentConfig, kr as EVENT_SYSTEM_ACTOR, m as resolveMailboxTurnWork, n as getConversationStoppedAtMs, on as EVENT_WAIT_MS, p as listActiveMailboxTurns, t as enqueueAutomatedInput, w as logDroppedParentMessage, xi as readParentMessage } from "./session-stop-DponjDUZ.js";
4
+ import { a as listUnreportedSiblingAgents, f as isDroppedChildInput, i as listOpenChildAgents, l as childAgentInput, o as parentResultActor, p as readChildConversationSender, s as recordChildAgentEnded, u as getChildAgentInputSender } from "./list-mkB_GU8R.js";
5
+ import { G as mapBounded, H as renderDataTag } from "./transcript-CCi7323k.js";
6
6
  import { n as listChildMessages, t as childMessageSenderMetadata } from "./child-message--2G3Ft26.js";
7
- import { t as recordChildAgentEnded } from "./markers-CE0HMXWT.js";
8
- import { Dn as AGENT_MESSAGE_EVENT_TYPE, En as AGENT_INVOCATION_EVENT_NAMESPACE, On as AGENT_UPDATE_EVENT_TYPE } from "./media-Cr9pGkzr.js";
7
+ import { Dn as AGENT_MESSAGE_EVENT_TYPE, En as AGENT_INVOCATION_EVENT_NAMESPACE, On as AGENT_UPDATE_EVENT_TYPE } from "./media-BebquhET.js";
9
8
  import * as z from "zod";
10
9
  import { actorSchema } from "@sentry/junior-plugin-api";
11
10
  // src/chat/agent-invocations/result-actors.ts
@@ -82,6 +81,30 @@ async function withAgentInvocationResultActors(work) {
82
81
  batch: kept
83
82
  } : void 0;
84
83
  }
84
+ // src/chat/agent-invocations/store.ts
85
+ /**
86
+ * Read the name, agent type, fork flag, and title of one child Conversation,
87
+ * for labels, from its binding, title, and agent config.
88
+ */
89
+ async function getChildAgentLabel(childConversationId) {
90
+ const [sender, options] = await Promise.all([readChildConversationSender(childConversationId), readAgentConfig(childConversationId)]);
91
+ return sender && options ? {
92
+ agentName: sender.agentName ?? null,
93
+ agentType: options.agentType ?? null,
94
+ fork: options.fork ?? false,
95
+ title: sender.title ?? null
96
+ } : void 0;
97
+ }
98
+ /**
99
+ * Return whether a child agent still works when its Turn ends with final
100
+ * text: one of its own child agents has open work, or a result or message
101
+ * from one of them waits in its mailbox. That final text then goes to the
102
+ * parent as a message, not as the child's result.
103
+ */
104
+ async function childAgentStillWorks(conversationId) {
105
+ if ((await listOpenChildAgents(conversationId)).length > 0) return true;
106
+ return ((await getConversationWorkState({ conversationId }))?.messages ?? []).some((message) => readInboundMessageSender(message) !== void 0);
107
+ }
85
108
  // src/chat/agent-invocations/agent-update.ts
86
109
  /**
87
110
  * Agent update: what one Conversation reports to the agents that wait on
@@ -293,13 +316,6 @@ function createEndStoppedChildWork(options) {
293
316
  const pending = (await getConversationWorkState({ conversationId }))?.execution.pendingMessages ?? [];
294
317
  const turnIds = /* @__PURE__ */ new Set([...turns.map((turn) => turn.turnId), ...pending.map((message) => buildDeterministicTurnId(message.inboundMessageId))]);
295
318
  if ((await readParentChildMessages(sender.parentConversationId, void 0)).some((message) => message.sender.conversationId === conversationId && turnIds.has(message.sender.turnId))) return;
296
- if ((await mapBounded([...turnIds], (turnId) => hasConversationNote({
297
- conversationId: sender.parentConversationId,
298
- key: quietEventNoteKey(starterWatchId(conversationId), updateEventKey(conversationId, {
299
- type: "turn",
300
- turnId
301
- }))
302
- }))).some(Boolean)) return;
303
319
  const [turn] = turns;
304
320
  await publishAgentUpdate(conversationId, {
305
321
  type: "turn_failed",
@@ -334,4 +350,4 @@ function createChildConversationWorker(options) {
334
350
  return result;
335
351
  };
336
352
  }
337
- export { result_exports as a, enqueueStarterUpdate as i, createEndStoppedChildWork as n, renderAgentResult as o, enqueueAgentMessageToParent as r, withAgentInvocationResultActors as s, createChildConversationWorker as t };
353
+ export { result_exports as a, withAgentInvocationResultActors as c, enqueueStarterUpdate as i, createEndStoppedChildWork as n, renderAgentResult as o, enqueueAgentMessageToParent as r, getChildAgentLabel as s, createChildConversationWorker as t };
@@ -1,10 +1,10 @@
1
- import { Rt as messageCardText } from "./media-Cr9pGkzr.js";
2
- import { a as buildDeliveredTurnStatePatch, o as loadPendingMessageCards, r as completeAuthPauseTurn, t as buildTurnThreadContext } from "./thread-context-DF5uDcWN.js";
3
- import { p as getAssistantReplyText } from "./system-prompt-table-CDCYVwqN.js";
4
- import { S as setTags, T as withLogContext, p as logException } from "./logging-czs0nqLC.js";
5
- import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-DcdQJd9e.js";
6
- import { $i as persistWithRetry, $r as saveTurnCheckpoint, Cr as latestConversationMessageSeq, Er as recordDeliveredAssistantMessage, Ii as finalizeFailedTurnReplyWithEvent, Ti as getTurnLifecycle, Tr as normalizeConversationText, Vr as authorizationId, Zn as commitAcceptedReply, er as loadConversationProjection, ft as markTurnFailed, gr as persistConversationMessages, gt as getPersistedThreadState, ht as getPersistedSandboxState, kr as upsertConversationMessage, mr as hydrateConversationMessages, or as recordAuthorizationCompleted, pt as startActiveTurn, vt as persistThreadStateById, wr as markConversationMessage, yt as coerceThreadConversationState } from "./mailbox-turn-79Nv1JXv.js";
7
- import { i as getConversationStore, nf as credentialContextForActor, ul as SYSTEM_IDENTITY_ID } from "./db-DXTOYRzR.js";
1
+ import { Rt as messageCardText } from "./media-BebquhET.js";
2
+ import { a as buildDeliveredTurnStatePatch, o as loadPendingMessageCards, r as completeAuthPauseTurn, t as buildTurnThreadContext } from "./thread-context-fiMNylbg.js";
3
+ import { p as getAssistantReplyText } from "./system-prompt-table-iIgpmslr.js";
4
+ import { S as setTags, T as withLogContext, p as logException } from "./logging-B8KEJegM.js";
5
+ import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-BJae4JwE.js";
6
+ import { Ci as getTurnLifecycle, Cr as normalizeConversationText, Dr as upsertConversationMessage, Pi as finalizeFailedTurnReplyWithEvent, Q as startActiveTurn, Qn as loadConversationProjection, Sr as markConversationMessage, Yn as commitAcceptedReply, Z as markTurnFailed, Zi as persistWithRetry, Zr as saveTurnCheckpoint, at as persistThreadStateById, fr as hydrateConversationMessages, ir as recordAuthorizationCompleted, mr as persistConversationMessages, nt as getPersistedSandboxState, ot as coerceThreadConversationState, rt as getPersistedThreadState, wr as recordDeliveredAssistantMessage, xr as latestConversationMessageSeq, zr as authorizationId } from "./session-stop-DponjDUZ.js";
7
+ import { i as getConversationStore, of as credentialContextForActor, sl as SYSTEM_IDENTITY_ID } from "./db-DhzvUY23.js";
8
8
  import { randomUUID } from "node:crypto";
9
9
  import { createLocalSource, localDestinationSchema } from "@sentry/junior-plugin-api";
10
10
  // src/chat/local/runner.ts
@@ -1,4 +1,4 @@
1
- import { Sr as sandboxEgressSignalsResponseSchema } from "./db-DXTOYRzR.js";
1
+ import { Cr as sandboxEgressSignalsResponseSchema } from "./db-DhzvUY23.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,5 +1,5 @@
1
- import { $ as conversationSummaryReportSchema, H as conversationAuxiliaryCostsSchema, J as conversationParamsSchema, R as actorIdentitySchema, Wt as inputFileSchema, _n as inboxItemRequestSchema, fn as TODO_STATUSES, rt as conversationChildAgentTotalsSchema, s as notificationScheduleSchema, tt as conversationUsageSchema } from "./media-Cr9pGkzr.js";
2
- import { d as conversationTitleSchema } from "./conversation-feed-Sl8lKKmR.js";
1
+ import { $ as conversationSummaryReportSchema, H as conversationAuxiliaryCostsSchema, J as conversationParamsSchema, R as actorIdentitySchema, Wt as inputFileSchema, _n as inboxItemRequestSchema, fn as TODO_STATUSES, rt as conversationChildAgentTotalsSchema, s as notificationScheduleSchema, tt as conversationUsageSchema } from "./media-BebquhET.js";
2
+ import { f as conversationTitleSchema } from "./conversation-feed-B84pMjHo.js";
3
3
  import { i as fillUtcHours, r as fillUtcDays, s as sumUtcHoursIntoSixHours } from "./reporting-window-C4dbzDiR.js";
4
4
  import { t as isPushServiceEndpoint } from "./push-endpoint-CO-nomUd.js";
5
5
  import "./user-customization-B27StpVQ.js";
@@ -787,6 +787,37 @@ const personCardReportSchema = z.object({
787
787
  /** The same code changes as the People profile, newest merge first. */
788
788
  mergedChanges: z.array(codeChangeSummaryReportSchema).max(3)
789
789
  }).strict();
790
+ // src/api/schema/user-search.ts
791
+ /** Users a search returns when the request sets no limit. */
792
+ const USER_SEARCH_DEFAULT_LIMIT = 10;
793
+ /** The most Users one search returns. */
794
+ const USER_SEARCH_MAX_LIMIT = 25;
795
+ /**
796
+ * A search for Users to add to one Space or Conversation that the viewer
797
+ * can read. Set exactly one of `spaceId` and `conversationId`.
798
+ */
799
+ const userSearchQuerySchema = z.object({
800
+ conversationId: z.string().min(1).max(500).optional(),
801
+ limit: z.coerce.number().int().min(1).max(25).default(10),
802
+ q: z.string().trim().min(1).max(100),
803
+ spaceId: z.string().uuid().optional()
804
+ }).strict().refine((query) => query.spaceId === void 0 !== !query.conversationId, { message: "Set exactly one of spaceId and conversationId." });
805
+ /**
806
+ * One User that the people picker shows. `isMember` is true when they are
807
+ * already a Member of the Space or a Participant of the Conversation.
808
+ * `slackUserId` is set for a Conversation search, because Invite names a
809
+ * person by their Slack account in its workspace.
810
+ */
811
+ const userSearchResultSchema = z.object({
812
+ avatarUrl: z.string().optional(),
813
+ email: z.string().min(1),
814
+ fullName: z.string().optional(),
815
+ isMember: z.literal(true).optional(),
816
+ slackUserId: z.string().min(1).optional(),
817
+ slackUserName: z.string().optional(),
818
+ userId: z.string().min(1)
819
+ }).strict();
820
+ const userSearchReportSchema = z.object({ users: z.array(userSearchResultSchema) }).strict();
790
821
  // src/api/schema/personal-token.ts
791
822
  const personalTokenMetadataSchema = z.object({
792
823
  id: z.string().uuid(),
@@ -1417,16 +1448,6 @@ const statsReportSchema = z.object({
1417
1448
  // src/api/schema/versions.ts
1418
1449
  /** The most Conversations that one versions read gives tokens for. */
1419
1450
  const VERSIONS_CONVERSATION_LIMIT = 50;
1420
- /**
1421
- * `GET /api/versions` sets this header when `GET /api/versions/stream` can
1422
- * push the same tokens, so a dashboard opens the stream only when it works.
1423
- */
1424
- const VERSIONS_STREAM_HEADER = "x-junior-versions-stream";
1425
- /**
1426
- * The SSE event that the versions stream sends while no token moves. A
1427
- * `Versions` object comes as a plain `message` event.
1428
- */
1429
- const VERSIONS_STREAM_KEEPALIVE_EVENT = "keepalive";
1430
1451
  const versionsQuerySchema = z.object({
1431
1452
  /**
1432
1453
  * The Conversations on screen, comma separated. Their tokens come back
@@ -1456,4 +1477,4 @@ const versionsSchema = z.object({
1456
1477
  /** The viewer's rolling model spend. */
1457
1478
  spend: z.string().min(1)
1458
1479
  }).strict();
1459
- export { PERSON_CARD_RECENT_LIMIT as $, conversationChildAgentSchema as $t, gatewayProvidersSchema as A, disconnectConnectionResponseSchema as At, disconnectServiceAccountResponseSchema as B, codeRepositoryParamsSchema as Bt, INBOX_SNOOZE_MAX_TRIGGERS as C, notificationSettingsSchema as Ct, inboxSnoozeSchema as D, connectionListSchema as Dt, inboxSnoozeResourceSchema as E, testNotificationResponseSchema as Et, cacheWarmingBreakerParamsSchema as F, codeChangeSearchReportSchema as Ft, searchQuerySchema as G, personCodeQuerySchema as Gt, serviceAccountParamsSchema as H, codeRepositoryReportSchema as Ht, cacheWarmingSavingsQuerySchema as I, codeChangeSummaryReportSchema as It, createdPersonalTokenSchema as J, todoParamsSchema as Jt, searchReportSchema as K, conversationTodoSchema as Kt, cacheWarmingSavingsRefillResponseSchema as L, codeChangeSummarySchema as Lt, cacheHealthQuerySchema as M, IDLE_CHANGE_DAYS as Mt, cacheHealthReportSchema as N, codeActivityDaySchema as Nt, inboxSnoozeSubjectSchema as O, connectionParamsSchema as Ot, cacheWarmingBreakerListSchema as P, codeChangeSearchQuerySchema as Pt, revokePersonalTokenResponseSchema as Q, watchParamsSchema as Qt, cacheWarmingSavingsReportSchema as R, codeOverviewReportSchema as Rt, inboxItemWaitingConversationsSchema as S, forkConversationResponseSchema as Sn, dailyConversationActivitySchema as St, inboxSnoozeResourceQuerySchema as T, pushSubscriptionDeleteBodySchema as Tt, serviceAccountSchema as U, codeRepositorySummarySchema as Ut, serviceAccountListSchema as V, codeRepositoryQuerySchema as Vt, startServiceAccountSignInResponseSchema as W, mentionableCodeChangeSchema as Wt, personalTokenMetadataSchema as X, conversationWatchSchema as Xt, personalTokenListSchema as Y, todoStatusBodySchema as Yt, personalTokenParamsSchema as Z, conversationWatchesReportSchema as Zt, inboxItemCountSchema as _, createAttachmentUploadBodySchema as _n, locationDirectoryReportSchema as _t, versionsSchema as a, attachObjectLinkResponseSchema as an, peopleSearchReportSchema as at, inboxItemParamsSchema as b, createConversationMessageBodySchema as bn, activityHours as bt, baselineSnapshotSchema as c, conversationStatsReportSchema as cn, personalSpendReportSchema as ct, workspaceListSchema as d, conversationDeliveryBodySchema as dn, spaceMemberSchema as dt, conversationChildAgentsReportSchema as en, actorDirectoryReportSchema as et, workspaceParamsSchema as f, conversationDeliveryResponseSchema as fn, leadSchema as ft, inboxItemCountQuerySchema as g, attachmentUploadSchema as gn, locationDetailReportSchema as gt, inboxItemActionSchema as h, attachmentUploadParamsSchema as hn, locationActivityDayReportSchema as ht, versionsQuerySchema as i, attachObjectLinkBodySchema as in, peopleSearchQuerySchema as it, updateGatewayProvidersBodySchema as j, startConnectionResponseSchema as jt, inboxSnoozeWakesClearSchema as k, connectionSchema as kt, deleteWorkspaceResponseSchema as l, CONVERSATION_OUTLINE_TEXT_LENGTH as ln, addSpaceMemberBodySchema as lt, workspaceSchema as m, conversationCatchUpSchema as mn, spaceConfigurationSchema as mt, VERSIONS_STREAM_HEADER as n, continueConversationInSlackResponseSchema as nn, avatarParamsSchema as nt, statSchema as o, objectLinksQuerySchema as on, personCardReportSchema as ot, workspaceRepoSchema as p, conversationCatchUpBodySchema as pn, spaceConfigEntrySchema as pt, createPersonalTokenBodySchema as q, conversationTodosReportSchema as qt, VERSIONS_STREAM_KEEPALIVE_EVENT as r, MAX_OBJECT_LINKS as rn, mentionablePersonSchema as rt, statsReportSchema as s, objectLinksReportSchema as sn, personParamsSchema as st, VERSIONS_CONVERSATION_LIMIT as t, continueConversationInSlackBodySchema as tn, actorProfileReportSchema as tt, workspaceBodySchema as u, conversationOutlineSchema as un, spaceMemberListSchema as ut, inboxItemListQuerySchema as v, acceptedConversationMessageSchema as vn, locationParamsSchema as vt, inboxSnoozeCreateSchema as w, pushSubscriptionBodySchema as wt, inboxItemSchema as x, forkConversationBodySchema as xn, activitySixHours as xt, inboxItemListSchema as y, createConversationBodySchema as yn, activityDays as yt, closeCacheWarmingBreakerResponseSchema as z, codePersonReportSchema as zt };
1480
+ export { userSearchQuerySchema as $, conversationWatchSchema as $t, cacheHealthQuerySchema as A, connectionListSchema as At, serviceAccountParamsSchema as B, codeChangeSummarySchema as Bt, inboxSnoozeResourceQuerySchema as C, createConversationMessageBodySchema as Cn, activityHours as Ct, inboxSnoozeWakesClearSchema as D, pushSubscriptionBodySchema as Dt, inboxSnoozeSubjectSchema as E, notificationSettingsSchema as Et, cacheWarmingSavingsRefillResponseSchema as F, IDLE_CHANGE_DAYS as Ft, createPersonalTokenBodySchema as G, codeRepositoryReportSchema as Gt, startServiceAccountSignInResponseSchema as H, codePersonReportSchema as Ht, cacheWarmingSavingsReportSchema as I, codeActivityDaySchema as It, personalTokenMetadataSchema as J, personCodeQuerySchema as Jt, createdPersonalTokenSchema as K, codeRepositorySummarySchema as Kt, closeCacheWarmingBreakerResponseSchema as L, codeChangeSearchQuerySchema as Lt, cacheWarmingBreakerListSchema as M, connectionSchema as Mt, cacheWarmingBreakerParamsSchema as N, disconnectConnectionResponseSchema as Nt, gatewayProvidersSchema as O, pushSubscriptionDeleteBodySchema as Ot, cacheWarmingSavingsQuerySchema as P, startConnectionResponseSchema as Pt, USER_SEARCH_MAX_LIMIT as Q, todoStatusBodySchema as Qt, disconnectServiceAccountResponseSchema as R, codeChangeSearchReportSchema as Rt, inboxSnoozeCreateSchema as S, createConversationBodySchema as Sn, activityDays as St, inboxSnoozeSchema as T, forkConversationResponseSchema as Tn, dailyConversationActivitySchema as Tt, searchQuerySchema as U, codeRepositoryParamsSchema as Ut, serviceAccountSchema as V, codeOverviewReportSchema as Vt, searchReportSchema as W, codeRepositoryQuerySchema as Wt, revokePersonalTokenResponseSchema as X, conversationTodosReportSchema as Xt, personalTokenParamsSchema as Y, conversationTodoSchema as Yt, USER_SEARCH_DEFAULT_LIMIT as Z, todoParamsSchema as Zt, inboxItemListSchema as _, conversationCatchUpSchema as _n, spaceConfigurationSchema as _t, statsReportSchema as a, continueConversationInSlackResponseSchema as an, avatarParamsSchema as at, inboxItemWaitingConversationsSchema as b, createAttachmentUploadBodySchema as bn, locationDirectoryReportSchema as bt, workspaceBodySchema as c, attachObjectLinkResponseSchema as cn, peopleSearchReportSchema as ct, workspaceRepoSchema as d, conversationStatsReportSchema as dn, personalSpendReportSchema as dt, conversationWatchesReportSchema as en, userSearchReportSchema as et, workspaceSchema as f, CONVERSATION_OUTLINE_TEXT_LENGTH as fn, addSpaceMemberBodySchema as ft, inboxItemListQuerySchema as g, conversationCatchUpBodySchema as gn, spaceConfigEntrySchema as gt, inboxItemCountSchema as h, conversationDeliveryResponseSchema as hn, leadSchema as ht, statSchema as i, continueConversationInSlackBodySchema as in, actorProfileReportSchema as it, cacheHealthReportSchema as j, connectionParamsSchema as jt, updateGatewayProvidersBodySchema as k, testNotificationResponseSchema as kt, workspaceListSchema as l, objectLinksQuerySchema as ln, personCardReportSchema as lt, inboxItemCountQuerySchema as m, conversationDeliveryBodySchema as mn, spaceMemberSchema as mt, versionsQuerySchema as n, conversationChildAgentSchema as nn, PERSON_CARD_RECENT_LIMIT as nt, baselineSnapshotSchema as o, MAX_OBJECT_LINKS as on, mentionablePersonSchema as ot, inboxItemActionSchema as p, conversationOutlineSchema as pn, spaceMemberListSchema as pt, personalTokenListSchema as q, mentionableCodeChangeSchema as qt, versionsSchema as r, conversationChildAgentsReportSchema as rn, actorDirectoryReportSchema as rt, deleteWorkspaceResponseSchema as s, attachObjectLinkBodySchema as sn, peopleSearchQuerySchema as st, VERSIONS_CONVERSATION_LIMIT as t, watchParamsSchema as tn, userSearchResultSchema as tt, workspaceParamsSchema as u, objectLinksReportSchema as un, personParamsSchema as ut, inboxItemParamsSchema as v, attachmentUploadParamsSchema as vn, locationActivityDayReportSchema as vt, inboxSnoozeResourceSchema as w, forkConversationBodySchema as wn, activitySixHours as wt, INBOX_SNOOZE_MAX_TRIGGERS as x, acceptedConversationMessageSchema as xn, locationParamsSchema as xt, inboxItemSchema as y, attachmentUploadSchema as yn, locationDetailReportSchema as yt, serviceAccountListSchema as z, codeChangeSummaryReportSchema as zt };
@@ -1,4 +1,4 @@
1
- import { Ar as pluginCatalogRuntime, Lr as serviceAccountPlugins, Mr as disconnectServiceAccount, Nr as finishServiceAccountSignIn, Pr as getServiceAccountStatus, Rr as startServiceAccountSignIn, Xd as disconnectStateAdapter } from "./db-DXTOYRzR.js";
1
+ import { Fr as getServiceAccountStatus, Nr as disconnectServiceAccount, Pr as finishServiceAccountSignIn, Rr as serviceAccountPlugins, ef as disconnectStateAdapter, jr as pluginCatalogRuntime, zr as startServiceAccountSignIn } from "./db-DhzvUY23.js";
2
2
  import { CLI_USAGE } from "./cli/run.js";
3
3
  import { createServer } from "node:http";
4
4
  // src/cli/service-account.ts