@sentry/junior 0.301.0 → 0.302.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 (79) hide show
  1. package/dist/adapter-context-Cx9fn9B3.js +43 -0
  2. package/dist/{admin-CRJHvCGg.js → admin-_poE5NKL.js} +2 -2
  3. package/dist/{agent-runner-H4YhvNBj.js → agent-runner-CY9RvsTX.js} +1380 -10601
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +4 -5
  6. package/dist/api.d.ts +1 -1
  7. package/dist/api.js +91 -68
  8. package/dist/{app-HDZglaIu.d.ts → app-BpY3wtRP.d.ts} +2 -2
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +66 -296
  11. package/dist/{background-compaction-queue-CNrZ3QcU.js → background-compaction-queue-CXFq1_Cz.js} +94 -203
  12. package/dist/{briefs-x6Mzwxmg.js → briefs-B3NG-pid.js} +2 -2
  13. package/dist/{catalog-runtime-BEY6EGRi.js → catalog-runtime-Dss0lSV6.js} +1 -1
  14. package/dist/cli/chat.js +15 -15
  15. package/dist/cli/check.js +3 -3
  16. package/dist/cli/main.js +3 -3
  17. package/dist/cli/plugins.js +4 -4
  18. package/dist/cli/snapshot-create.js +4 -4
  19. package/dist/cli/upgrade.d.ts +1 -1
  20. package/dist/cli/upgrade.js +3 -3
  21. package/dist/{config-CmjhyqgB.js → config-CzeZiMKs.js} +2 -2
  22. package/dist/{connections-CfIRm0xv.js → connections-CDYhMfrs.js} +6 -6
  23. package/dist/{continue-in-slack-DPoABVkB.js → continue-in-slack-7Uf05ndC.js} +5 -6
  24. package/dist/{conversation-feed-CfpyFMHP.js → conversation-feed-Clf_cv0n.js} +1 -0
  25. package/dist/{conversation-privacy-0CM0V2qK.js → conversation-privacy-D9xnM5mK.js} +1 -1
  26. package/dist/{conversation-turn-C0sxyvS-.js → conversation-turn-D7SEZgTG.js} +15 -16
  27. package/dist/{credential-sync-tEMKZ_8M.js → credential-sync-DoD0gW-j.js} +13 -15
  28. package/dist/{db-Czra10QW.js → db-B-gtnNjr.js} +314 -5
  29. package/dist/{db-BdUHQhrC.d.ts → db-BdsCzytP.d.ts} +1 -1
  30. package/dist/{executor-D_023K0H.js → executor-DZg20EqU.js} +39 -4
  31. package/dist/install-t1KQyTUs.js +228 -0
  32. package/dist/instrumentation.js +2 -2
  33. package/dist/{state-CEbZuZD6.js → legacy-web-actor-id-C-cEeWqL.js} +33 -4
  34. package/dist/{lineage-DmMIE0VL.js → lineage-C79GjoQr.js} +2 -2
  35. package/dist/{logging-DcjLDDqi.js → logging-C9oDAg4M.js} +7 -3
  36. package/dist/{message-C0JY9RJP.js → message-BLUCzJXN.js} +8 -8
  37. package/dist/{model-input-CBp-p24N.js → model-input-5jwNC45G.js} +3 -3
  38. package/dist/nitro.d.ts +1 -1
  39. package/dist/nitro.js +4 -3
  40. package/dist/{oauth-callback-server-BRq9QNhU.js → oauth-callback-server-BBl66vCb.js} +2 -2
  41. package/dist/{projection-CQNDOi82.js → projection-CIBwgD3s.js} +282 -64
  42. package/dist/{prompt-DLUB5m72.js → prompt-CRQbzp5e.js} +14 -4
  43. package/dist/queue-DtCDaIct.js +115 -0
  44. package/dist/{registry-Dj377ADs.js → registry-DdFQHZ_d.js} +1 -1
  45. package/dist/{resolve-DJkh9Fky.js → resolve-CdW4BdrK.js} +4 -229
  46. package/dist/{result-C8iIpDl1.js → result-oOMv1t4O.js} +9 -9
  47. package/dist/{runner-DZqrOy8C.js → runner-DqitLtm-.js} +8 -8
  48. package/dist/{sandbox-egress-signals-CGwH86S9.js → sandbox-egress-signals-Bw9I0yfJ.js} +1 -1
  49. package/dist/{schema-CdZFn7Qd.d.ts → schema-BIFM-U1a.d.ts} +441 -30
  50. package/dist/{schema-DyHXiQKI.js → schema-DnVQepWP.js} +66 -29
  51. package/dist/{service-account-D6jGR4a1.js → service-account-B6mKAPVo.js} +3 -3
  52. package/dist/{service-account-suY004dx.js → service-account-CrZftRTb.js} +257 -6
  53. package/dist/{session-stop-BLmfFI3d.js → session-stop-DW63Z3kj.js} +543 -548
  54. package/dist/{skills-CmNG0dHb.js → skills-C16fz60Z.js} +2 -2
  55. package/dist/{slack-conversation-unfurl-Bty-DlHe.js → slack-conversation-unfurl-BHhefEb7.js} +8 -7
  56. package/dist/{spawn-CNjkpXpk.js → spawn-D_RnFYfy.js} +6 -6
  57. package/dist/{stop-Bjy2-K4H.js → stop-7p1i08CY.js} +724 -106
  58. package/dist/{store-DmV4CoNr.js → store-C28I0CVW.js} +5 -5
  59. package/dist/{task-queue-AhG1tSXR.js → task-queue-BVUJbQ28.js} +3 -3
  60. package/dist/{task-runner-BMxZI3o7.js → task-runner-CWi8j7Z6.js} +6 -8
  61. package/dist/{thread-context-CXLnbg7g.js → thread-context-D3-yYUd0.js} +7 -7
  62. package/dist/{store-Epv6t4vV.js → turn-session-routing-BFMS9ATF.js} +381 -10
  63. package/dist/{turn-user-message-DsUZi9gn.js → turn-user-message-C3-O8Omt.js} +3 -3
  64. package/dist/{validation-DOz8X9BU.js → validation-BSFKUIb4.js} +1 -1
  65. package/dist/{version-CGMRmMPK.js → version-BHHXNi-0.js} +1 -1
  66. package/dist/version.js +1 -1
  67. package/dist/{viewer-H3EsMWtJ.js → viewer-B1SO21Qa.js} +3 -3
  68. package/dist/warmup-Bz9bzkzN.js +13927 -0
  69. package/dist/{statuses-Hn-HsOph.js → web-message-id-lNodcCOI.js} +136 -1
  70. package/dist/{worker-ClphajjD.js → worker-BspReIIK.js} +7 -7
  71. package/migrations/0108_conversation_embeddings.sql +13 -0
  72. package/migrations/meta/0108_snapshot.json +4688 -0
  73. package/migrations/meta/_journal.json +7 -0
  74. package/package.json +8 -6
  75. package/dist/adapter-CNjGEJO9.js +0 -303
  76. package/dist/reporting-window-DopzcOHh.js +0 -137
  77. package/dist/turn-session-routing-BD3-jJl7.js +0 -380
  78. package/dist/users-BxvYclQg.js +0 -424
  79. package/dist/warmup-CdU5hR49.js +0 -3715
@@ -1,380 +0,0 @@
1
- import { Oi as JUNIOR_THREAD_STATE_TTL_MS, b as persistConversationMessages, bs as createDurableLocationConfigurationService, eo as ToolInputError } from "./projection-CQNDOi82.js";
2
- import { G as isRecord, K as toOptionalNumber, q as toOptionalString } from "./logging-DcjLDDqi.js";
3
- import { o as getDb } from "./db-Czra10QW.js";
4
- import { r as getStateAdapter } from "./adapter-CNjGEJO9.js";
5
- import * as z from "zod";
6
- import { agentEventMatchSchema, anyResourceMatchFields, describeEventTrigger, eventTriggerChoices, eventTriggerProblems, normalizeEventIdentifier, normalizeEventMatch } from "@sentry/junior-plugin-api";
7
- // src/chat/events/catalog.ts
8
- /** A source with nothing enabled, for a namespace that the catalog lacks. */
9
- const NO_SOURCE = {
10
- resourceTypes: [],
11
- events: {},
12
- anyResourceFields: {}
13
- };
14
- /**
15
- * Build one catalog entry. It merges the filters of every resource type here,
16
- * once, so trigger checks for each event copy and each row do not merge them
17
- * again.
18
- */
19
- function eventCatalogEntry(registration) {
20
- return {
21
- ...registration,
22
- anyResourceFields: anyResourceMatchFields(registration.resourceTypes)
23
- };
24
- }
25
- /** Core-owned event namespace. Not a plugin publisher. */
26
- const CORE_EVENT_NAMESPACE = "junior";
27
- /** True when the catalog has any enabled registration. */
28
- function hasEventCatalogEntries(catalog) {
29
- return Object.keys(catalog).length > 0;
30
- }
31
- /**
32
- * Catalog entries that durable event automations may select.
33
- *
34
- * Resource types with `automation: false` stay out of create/update schemas
35
- * and trigger availability. A namespace with no such resource type left is
36
- * removed.
37
- */
38
- function automationEventCatalog(catalog) {
39
- return Object.fromEntries(Object.entries(catalog).flatMap(([namespace, registration]) => {
40
- const resourceTypes = registration.resourceTypes.filter((resourceType) => registration.limits?.[resourceType.type]?.automation !== false);
41
- if (resourceTypes.length === 0) return [];
42
- if (resourceTypes.length === registration.resourceTypes.length) return [[namespace, registration]];
43
- const supported = new Set(resourceTypes.flatMap((resourceType) => resourceType.supportedEvents));
44
- return [[namespace, eventCatalogEntry({
45
- ...registration,
46
- resourceTypes,
47
- events: Object.fromEntries(Object.entries(registration.events).filter(([eventType]) => supported.has(eventType)))
48
- })]];
49
- }));
50
- }
51
- /** Return why watchEvents cannot watch one resource type, if it cannot. */
52
- function eventWatchUnavailable(catalog, namespace, resourceType) {
53
- const limits = catalog[namespace]?.limits?.[resourceType];
54
- return limits?.watch === false ? limits.watchUnavailableMessage : void 0;
55
- }
56
- function enumSchema(values, unavailableMessage) {
57
- if (values.length === 0) return z.string().refine(() => false, unavailableMessage);
58
- return z.enum(values);
59
- }
60
- /** Build the model-facing namespace enum from enabled event plugins. */
61
- function eventNamespaceSchema(catalog) {
62
- return enumSchema(Object.keys(catalog).sort(), "No event namespaces are enabled.");
63
- }
64
- /** Build the model-facing event enum from enabled plugin registrations. */
65
- function registeredEventTypeSchema(catalog) {
66
- return enumSchema([...new Set(Object.values(catalog).flatMap((registration) => registration.resourceTypes.flatMap((resourceType) => resourceType.supportedEvents)))].sort(), "No event types are enabled.");
67
- }
68
- /** Build the model-facing resource type enum from enabled plugin registrations. */
69
- function registeredResourceTypeSchema(catalog) {
70
- return enumSchema([...new Set(Object.values(catalog).flatMap((registration) => registration.resourceTypes.map((resourceType) => resourceType.type)))].sort(), "No resource types are enabled.");
71
- }
72
- /**
73
- * Return app guidance for one event of a namespace. The source declares it
74
- * once for the event, so every resource type and a trigger with no resource
75
- * type get the same guidance.
76
- */
77
- function eventGuidance(catalog, namespace, eventType) {
78
- return catalog[namespace]?.events[eventType]?.guidance;
79
- }
80
- /** Build the match object the tools accept for one resource type. */
81
- function registeredEventMatchSchema() {
82
- return agentEventMatchSchema.optional().describe("Optional filters: exact values for the resource type match_fields, with snake_case keys. A single value must equal the event data. A list means the event value may be any one entry. For a field with list: true, the event value is a list, and it matches when it includes the value or any entry. A field with events is set only on those events, so every selected event must be in that list. Omit a key to ignore it. Unmatched events are dropped with no agent turn.");
83
- }
84
- /**
85
- * List why a selection cannot work with the enabled plugins. Use it for new
86
- * selections and for saved triggers, which can go stale after a plugin renames
87
- * or removes a resource type, event, or filter.
88
- */
89
- function registeredEventTriggerProblems(catalog, selection, options) {
90
- return eventTriggerProblems(catalog[selection.namespace] ?? NO_SOURCE, selection, options);
91
- }
92
- /**
93
- * Describe a selection with the enabled plugins, for the dashboard and Slack.
94
- * Its problems are the same as `registeredEventTriggerProblems`.
95
- */
96
- function describeRegisteredEventTrigger(catalog, selection) {
97
- return describeEventTrigger(catalog[selection.namespace] ?? NO_SOURCE, selection);
98
- }
99
- function uniqueMatchValues(match) {
100
- if (!match || Object.keys(match).length === 0) return void 0;
101
- return Object.fromEntries(Object.entries(match).map(([key, value]) => [key, Array.isArray(value) ? [...new Set(value)] : value]));
102
- }
103
- /**
104
- * Reject an event automation trigger or a Watch that cannot work, with every
105
- * problem in one message for the agent. Return its match as it is saved:
106
- * each text value in the case that its plugin declares, with no repeated
107
- * list values. The dashboard clears `inputKeys` so messages name the filters
108
- * as its plugin declares them.
109
- */
110
- function requireValidEventTrigger(catalog, selection, target, options = { inputKeys: true }) {
111
- const fields = eventTriggerChoices(catalog[selection.namespace] ?? NO_SOURCE, selection)?.fields ?? {};
112
- const normalized = {
113
- ...selection,
114
- match: normalizeEventMatch(fields, selection.match)
115
- };
116
- const problems = registeredEventTriggerProblems(catalog, normalized, options);
117
- if (problems.length > 0) {
118
- const source = catalog[selection.namespace]?.displayName ?? selection.namespace;
119
- const resource = selection.resourceType ? `${source} ${selection.resourceType.replaceAll("_", " ")}` : source;
120
- throw new ToolInputError([target === "watch" ? `This ${resource} watch cannot be created.` : `This ${resource} trigger cannot be saved.`, ...problems.map((problem) => problem.message)].join(" "));
121
- }
122
- return uniqueMatchValues(normalized.match);
123
- }
124
- /**
125
- * Normalize one selector with the convention declared by its plugin.
126
- *
127
- * Reject a selector that does not fit its resource type. Resource types can
128
- * share event types, so only the identifier shows which one a selector names.
129
- */
130
- function requireEventIdentifier(catalog, input) {
131
- const registration = catalog[input.namespace];
132
- const identifier = normalizeEventIdentifier(registration, input.identifier);
133
- const resourceTypes = registration?.resourceTypes ?? [];
134
- const fits = (resourceType) => resourceType.identifier !== void 0 && new RegExp(resourceType.identifier.pattern).test(identifier);
135
- const resourceType = resourceTypes.find((candidate) => candidate.type === input.resourceType);
136
- if (!resourceType?.identifier || fits(resourceType)) return identifier;
137
- const fitting = resourceTypes.filter(fits).map((candidate) => candidate.type);
138
- throw new ToolInputError([`Identifier "${identifier}" does not fit resource_type "${input.resourceType}" in namespace "${input.namespace}". Expected format: "${resourceType.identifier.format}".`, ...fitting.length > 0 ? [`If the identifier is correct, use one of these resource_type values: ${fitting.map((type) => `"${type}"`).join(", ")}.`] : []].join(" "));
139
- }
140
- // src/chat/state/conversation.ts
141
- function defaultConversationState() {
142
- return {
143
- schemaVersion: 1,
144
- messages: [],
145
- processing: {},
146
- vision: { byFileId: {} }
147
- };
148
- }
149
- function coercePendingAuthState(value) {
150
- if (!isRecord(value)) return;
151
- const kind = value.kind;
152
- const provider = toOptionalString(value.provider);
153
- const actorId = toOptionalString(value.actorId);
154
- const authSessionId = toOptionalString(value.authSessionId);
155
- const scope = toOptionalString(value.scope);
156
- const sessionId = toOptionalString(value.sessionId);
157
- const linkSentAtMs = toOptionalNumber(value.linkSentAtMs);
158
- if (kind !== "mcp" && kind !== "plugin" || !provider || !actorId || kind === "mcp" && !authSessionId || !sessionId || typeof linkSentAtMs !== "number") return;
159
- const base = {
160
- provider,
161
- actorId,
162
- ...scope ? { scope } : void 0,
163
- sessionId,
164
- linkSentAtMs
165
- };
166
- return kind === "mcp" ? {
167
- ...base,
168
- authSessionId,
169
- kind
170
- } : {
171
- ...base,
172
- kind
173
- };
174
- }
175
- /** Safely coerce an unknown persisted value into a ThreadConversationState. */
176
- function coerceThreadConversationState(value) {
177
- if (!isRecord(value)) return defaultConversationState();
178
- const root = value;
179
- const rawConversation = isRecord(root.conversation) ? root.conversation : {};
180
- const messages = [];
181
- const rawProcessing = isRecord(rawConversation.processing) ? rawConversation.processing : {};
182
- const processing = {
183
- activeTurnId: toOptionalString(rawProcessing.activeTurnId),
184
- lastCompletedAtMs: toOptionalNumber(rawProcessing.lastCompletedAtMs),
185
- pendingAuth: coercePendingAuthState(rawProcessing.pendingAuth)
186
- };
187
- const rawVision = isRecord(rawConversation.vision) ? rawConversation.vision : {};
188
- const rawVisionByFileId = isRecord(rawVision.byFileId) ? rawVision.byFileId : {};
189
- const byFileId = {};
190
- for (const [fileId, value] of Object.entries(rawVisionByFileId)) {
191
- if (typeof fileId !== "string" || fileId.trim().length === 0) continue;
192
- if (!isRecord(value)) continue;
193
- const summary = toOptionalString(value.summary);
194
- const analyzedAtMs = toOptionalNumber(value.analyzedAtMs);
195
- if (!summary || !analyzedAtMs) continue;
196
- byFileId[fileId] = {
197
- summary,
198
- analyzedAtMs
199
- };
200
- }
201
- return {
202
- schemaVersion: 1,
203
- messages,
204
- processing,
205
- vision: {
206
- backfillCompletedAtMs: toOptionalNumber(rawVision.backfillCompletedAtMs),
207
- byFileId
208
- }
209
- };
210
- }
211
- /**
212
- * Wrap active conversation control into the thread scratch envelope.
213
- *
214
- * Visible history lives in SQL. Image summaries use a separate disposable
215
- * cache, so thread scratch does not retain them.
216
- */
217
- function buildConversationStatePatch(conversation) {
218
- return { conversation: {
219
- schemaVersion: 1,
220
- processing: { ...conversation.processing }
221
- } };
222
- }
223
- // src/chat/runtime/thread-state.ts
224
- function threadStateKey(threadId) {
225
- return `thread-state:${threadId}`;
226
- }
227
- function channelStateKey(channelId) {
228
- return `channel-state:${channelId}`;
229
- }
230
- function buildThreadStatePayload(patch) {
231
- const payload = {};
232
- if (patch.conversation) Object.assign(payload, buildConversationStatePatch(patch.conversation));
233
- if (patch.sandboxRef !== void 0) {
234
- payload.app_sandbox_id = patch.sandboxRef?.id ?? "";
235
- payload.app_sandbox_dependency_profile_hash = patch.sandboxRef?.profileHash ?? "";
236
- payload.app_sandbox_workspace_id = patch.sandboxRef?.workspaceId ?? "";
237
- }
238
- return payload;
239
- }
240
- /**
241
- * Merge a payload into thread scratch with Junior's TTL.
242
- *
243
- * Chat SDK state writes hardcode a 30-day TTL. This boundary owns Junior's
244
- * shorter retention policy for the same scratch keys.
245
- */
246
- async function mergePersistedState(key, payload) {
247
- if (Object.keys(payload).length === 0) return;
248
- const stateAdapter = getStateAdapter();
249
- await stateAdapter.connect();
250
- const existing = await stateAdapter.get(key) ?? {};
251
- await stateAdapter.set(key, {
252
- ...existing,
253
- ...payload
254
- }, JUNIOR_THREAD_STATE_TTL_MS);
255
- }
256
- /** Extract persisted sandbox metadata from thread state payload. */
257
- function getPersistedSandboxState(state) {
258
- const id = toOptionalString(state.app_sandbox_id);
259
- if (!id) return;
260
- const profileHash = toOptionalString(state.app_sandbox_dependency_profile_hash);
261
- const workspaceId = toOptionalString(state.app_sandbox_workspace_id);
262
- return {
263
- id,
264
- ...profileHash ? { profileHash } : void 0,
265
- ...workspaceId ? { workspaceId } : void 0
266
- };
267
- }
268
- /** Persist only the Redis-backed runtime scratch in a thread-state patch. */
269
- async function persistThreadRuntimeState(conversationId, patch) {
270
- await mergePersistedState(threadStateKey(conversationId), buildThreadStatePayload(patch));
271
- }
272
- /** Load the persisted state payload for a thread without requiring a Chat singleton. */
273
- async function getPersistedThreadState(threadId) {
274
- const stateAdapter = getStateAdapter();
275
- await stateAdapter.connect();
276
- return await stateAdapter.get(threadStateKey(threadId)) ?? {};
277
- }
278
- /** Persist a thread-state patch by thread id without constructing a Chat thread. */
279
- async function persistThreadStateById(threadId, patch) {
280
- if (patch.conversation) await persistConversationMessages({
281
- conversation: patch.conversation,
282
- conversationId: threadId
283
- });
284
- await mergePersistedState(threadStateKey(threadId), buildThreadStatePayload(patch));
285
- }
286
- /** Load legacy Redis-backed channel state during the SQL cutover. */
287
- async function getLegacyChannelState(channelId) {
288
- const stateAdapter = getStateAdapter();
289
- await stateAdapter.connect();
290
- return await stateAdapter.get(channelStateKey(channelId)) ?? {};
291
- }
292
- /**
293
- * Resolve durable location configuration.
294
- *
295
- * Slack still reads the old channel-id Redis bag once during cutover.
296
- */
297
- function getLocationConfigurationService(destination) {
298
- if (destination.platform !== "slack") throw new Error("Location configuration requires a Slack Location");
299
- return createDurableLocationConfigurationService({
300
- destination,
301
- db: getDb(),
302
- loadLegacy: async () => await getLegacyChannelState(destination.channelId)
303
- });
304
- }
305
- // src/chat/services/turn-session-routing.ts
306
- async function loadConversationChain(conversationId, conversationStore) {
307
- const chain = [];
308
- const seen = /* @__PURE__ */ new Set();
309
- let cursor = conversationId;
310
- while (cursor && !seen.has(cursor)) {
311
- seen.add(cursor);
312
- const conversation = await conversationStore.get({ conversationId: cursor });
313
- if (!conversation) break;
314
- chain.push(conversation);
315
- cursor = conversation.parentConversationId;
316
- }
317
- return chain;
318
- }
319
- /**
320
- * Normalize a stored Slack session source against the conversation destination.
321
- *
322
- * Does not create channel or thread values from the conversation id.
323
- */
324
- function slackSourceForDestination(args) {
325
- if (args.source?.kind !== "slack" || args.source.channelId !== args.destination.channelId) return;
326
- const threadTs = args.source.threadTs?.trim();
327
- return {
328
- kind: "slack",
329
- visibility: args.source.visibility ?? "public",
330
- teamId: args.source.teamId?.trim() || args.destination.teamId,
331
- channelId: args.source.channelId,
332
- ...threadTs ? { threadTs } : void 0
333
- };
334
- }
335
- /**
336
- * Resolve the Conversation Location, Destination, and session Source.
337
- *
338
- * Reads parent Conversations when this Conversation has no Destination.
339
- */
340
- async function resolveConversationRouting(args) {
341
- const conversationStore = args.conversationStore ?? (await import("./db-Czra10QW.js").then((n) => n.n)).getConversationStore();
342
- const chain = await loadConversationChain(args.conversationId, conversationStore);
343
- let destination;
344
- let source;
345
- let location;
346
- for (const conversation of chain) {
347
- destination ??= conversation.destination;
348
- source ??= conversation.sessionSource;
349
- location ??= conversation.location;
350
- if (destination && source) break;
351
- }
352
- if (!destination) return;
353
- if (destination.platform === "slack") {
354
- const slackSource = slackSourceForDestination({
355
- destination,
356
- source
357
- });
358
- return {
359
- destination,
360
- ...location ? { location } : void 0,
361
- ...slackSource ? { source: slackSource } : void 0
362
- };
363
- }
364
- return {
365
- destination,
366
- ...location ? { location } : void 0,
367
- ...source ? { source } : void 0
368
- };
369
- }
370
- /** Require the Conversation Destination and Source from SQL. */
371
- async function resolveTurnSessionRouting(args) {
372
- const routing = await resolveConversationRouting(args);
373
- if (!routing?.destination || !routing.source) throw new Error(`Conversation ${args.conversationId} is missing durable routing metadata`);
374
- return {
375
- destination: routing.destination,
376
- ...routing.location ? { location: routing.location } : void 0,
377
- source: routing.source
378
- };
379
- }
380
- export { requireValidEventTrigger as S, registeredEventMatchSchema as _, getPersistedThreadState as a, registeredResourceTypeSchema as b, coerceThreadConversationState as c, describeRegisteredEventTrigger as d, eventCatalogEntry as f, hasEventCatalogEntries as g, eventWatchUnavailable as h, getPersistedSandboxState as i, CORE_EVENT_NAMESPACE as l, eventNamespaceSchema as m, resolveTurnSessionRouting as n, persistThreadRuntimeState as o, eventGuidance as p, getLocationConfigurationService as r, persistThreadStateById as s, resolveConversationRouting as t, automationEventCatalog as u, registeredEventTriggerProblems as v, requireEventIdentifier as x, registeredEventTypeSchema as y };