@sentry/junior 0.72.0 → 0.74.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 (109) hide show
  1. package/bin/junior.mjs +12 -10
  2. package/dist/api-reference.d.ts +1 -1
  3. package/dist/app.d.ts +11 -2
  4. package/dist/app.js +1233 -13143
  5. package/dist/chat/agent-dispatch/runner.d.ts +2 -0
  6. package/dist/chat/agent-dispatch/store.d.ts +2 -2
  7. package/dist/chat/agent-dispatch/types.d.ts +6 -3
  8. package/dist/chat/agent-dispatch/validation.d.ts +2 -3
  9. package/dist/chat/app/production.d.ts +11 -1
  10. package/dist/chat/app/services.d.ts +7 -0
  11. package/dist/chat/config.d.ts +3 -0
  12. package/dist/chat/conversations/configured.d.ts +5 -0
  13. package/dist/chat/conversations/sql/migrations.d.ts +11 -0
  14. package/dist/chat/conversations/sql/schema/conversations.d.ts +435 -0
  15. package/dist/chat/conversations/sql/schema/destinations.d.ts +200 -0
  16. package/dist/chat/conversations/sql/schema/identities.d.ts +214 -0
  17. package/dist/chat/conversations/sql/schema/migrations.d.ts +58 -0
  18. package/dist/chat/conversations/sql/schema/timestamps.d.ts +1 -0
  19. package/dist/chat/conversations/sql/schema.d.ts +910 -0
  20. package/dist/chat/conversations/sql/store.d.ts +52 -0
  21. package/dist/chat/conversations/state.d.ts +4 -0
  22. package/dist/chat/conversations/store.d.ts +57 -0
  23. package/dist/chat/destination.d.ts +3 -1
  24. package/dist/chat/ingress/slack-webhook.d.ts +2 -0
  25. package/dist/chat/logging.d.ts +3 -0
  26. package/dist/chat/oauth-flow.d.ts +1 -1
  27. package/dist/chat/plugins/agent-hooks.d.ts +2 -2
  28. package/dist/chat/plugins/registry.d.ts +2 -0
  29. package/dist/chat/plugins/types.d.ts +2 -0
  30. package/dist/chat/prompt.d.ts +4 -1
  31. package/dist/chat/requester.d.ts +19 -12
  32. package/dist/chat/respond.d.ts +7 -3
  33. package/dist/chat/runtime/agent-continue-runner.d.ts +1 -1
  34. package/dist/chat/runtime/reply-executor.d.ts +3 -1
  35. package/dist/chat/runtime/slack-resume.d.ts +3 -3
  36. package/dist/chat/runtime/slack-runtime.d.ts +13 -3
  37. package/dist/chat/runtime/turn.d.ts +15 -1
  38. package/dist/chat/sandbox/egress-credentials.d.ts +5 -2
  39. package/dist/chat/sandbox/egress-policy.d.ts +5 -1
  40. package/dist/chat/sandbox/egress-proxy.d.ts +2 -0
  41. package/dist/chat/sandbox/egress-schemas.d.ts +4 -0
  42. package/dist/chat/sandbox/egress-session.d.ts +3 -1
  43. package/dist/chat/sandbox/egress-tracing.d.ts +7 -0
  44. package/dist/chat/sandbox/sandbox.d.ts +2 -0
  45. package/dist/chat/sandbox/session.d.ts +3 -2
  46. package/dist/chat/services/auth-pause-response.d.ts +1 -1
  47. package/dist/chat/services/auth-pause.d.ts +2 -1
  48. package/dist/chat/services/mcp-auth-orchestration.d.ts +7 -6
  49. package/dist/chat/services/message-actor-identity.d.ts +2 -2
  50. package/dist/chat/services/pending-auth.d.ts +2 -0
  51. package/dist/chat/services/plugin-auth-orchestration.d.ts +14 -12
  52. package/dist/chat/services/turn-result.d.ts +3 -0
  53. package/dist/chat/slack/user.d.ts +2 -2
  54. package/dist/chat/sql/db.d.ts +20 -0
  55. package/dist/chat/sql/neon.d.ts +9 -0
  56. package/dist/chat/sql/schema.d.ts +906 -0
  57. package/dist/chat/state/turn-session.d.ts +3 -0
  58. package/dist/chat/task-execution/slack-work.d.ts +2 -0
  59. package/dist/chat/task-execution/state.d.ts +209 -0
  60. package/dist/chat/task-execution/store.d.ts +30 -114
  61. package/dist/chat/task-execution/vercel-callback.d.ts +2 -0
  62. package/dist/chat/task-execution/worker.d.ts +2 -0
  63. package/dist/chat/tools/slack/canvas-tools.d.ts +3 -2
  64. package/dist/chat/tools/slack/channel-list-messages.d.ts +2 -2
  65. package/dist/chat/tools/slack/channel-post-message.d.ts +3 -2
  66. package/dist/chat/tools/slack/context.d.ts +15 -2
  67. package/dist/chat/tools/slack/message-add-reaction.d.ts +3 -2
  68. package/dist/chat/tools/slack/thread-read.d.ts +2 -2
  69. package/dist/chat/tools/types.d.ts +19 -19
  70. package/dist/chunk-2LUZA3LY.js +275 -0
  71. package/dist/{chunk-6GEYPE6T.js → chunk-3BYAPS6B.js} +30 -6
  72. package/dist/{chunk-VLIO6RQR.js → chunk-6UP2Z2RZ.js} +4 -4
  73. package/dist/{chunk-GB3AL54K.js → chunk-7Q5YOUUT.js} +10 -2
  74. package/dist/{chunk-PP7AGSBU.js → chunk-CYUI7JU5.js} +18 -8
  75. package/dist/{chunk-3FYPXHPL.js → chunk-F6HWCPOC.js} +1 -1
  76. package/dist/{chunk-ZJQPA67D.js → chunk-GM7HTXYC.js} +230 -224
  77. package/dist/{chunk-VSNA5KAB.js → chunk-HYHKTFG2.js} +1338 -1499
  78. package/dist/chunk-JL2SLRAT.js +1970 -0
  79. package/dist/{chunk-4JXCSGSA.js → chunk-M4FLLXXD.js} +1 -1
  80. package/dist/{chunk-55XEZFGD.js → chunk-OR6NQJ5E.js} +2 -2
  81. package/dist/chunk-SJHUF3DP.js +43 -0
  82. package/dist/chunk-SQGMG7OD.js +12801 -0
  83. package/dist/{chunk-QUXPUKBH.js → chunk-Y7X25LFY.js} +1 -1
  84. package/dist/{chunk-ICKIDP7G.js → chunk-YOHFWWBV.js} +1 -1
  85. package/dist/{chunk-XC33FJZN.js → chunk-YRDS7VKO.js} +25 -4
  86. package/dist/cli/chat.js +205 -0
  87. package/dist/cli/check.js +9 -10
  88. package/dist/cli/init.js +1 -1
  89. package/dist/cli/run.js +10 -2
  90. package/dist/cli/snapshot-warmup.js +7 -7
  91. package/dist/cli/upgrade.js +81 -11
  92. package/dist/deployment.d.ts +4 -0
  93. package/dist/handlers/agent-dispatch.d.ts +6 -1
  94. package/dist/handlers/mcp-oauth-callback.d.ts +6 -1
  95. package/dist/handlers/oauth-callback.d.ts +6 -1
  96. package/dist/handlers/sandbox-egress-proxy.d.ts +2 -0
  97. package/dist/handlers/webhooks.d.ts +4 -2
  98. package/dist/instrumentation.js +17 -3
  99. package/dist/nitro.js +9 -10
  100. package/dist/reporting/conversations.d.ts +13 -3
  101. package/dist/reporting.d.ts +9 -2
  102. package/dist/reporting.js +114 -48
  103. package/dist/runner-27NP2TEO.js +259 -0
  104. package/dist/vercel.d.ts +6 -1
  105. package/dist/vercel.js +1 -1
  106. package/package.json +9 -4
  107. package/dist/chunk-6YY4Q3D4.js +0 -12
  108. package/dist/chunk-HNMUVGSR.js +0 -1119
  109. package/dist/chunk-Z3YD6NHK.js +0 -12
@@ -6,230 +6,7 @@ import {
6
6
  setSpanAttributes,
7
7
  toOptionalString,
8
8
  withSpan
9
- } from "./chunk-6GEYPE6T.js";
10
-
11
- // src/chat/config.ts
12
- import { getModel } from "@earendil-works/pi-ai";
13
-
14
- // src/chat/optional-string.ts
15
- function toOptionalTrimmed(value) {
16
- if (!value) {
17
- return void 0;
18
- }
19
- const trimmed = value.trim();
20
- return trimmed.length > 0 ? trimmed : void 0;
21
- }
22
-
23
- // src/chat/pi/client.ts
24
- import {
25
- completeSimple,
26
- getEnvApiKey,
27
- getModels,
28
- registerApiProvider
29
- } from "@earendil-works/pi-ai";
30
- import {
31
- streamAnthropic,
32
- streamSimpleAnthropic
33
- } from "@earendil-works/pi-ai/anthropic";
34
-
35
- // src/chat/slack/context.ts
36
- function toTrimmedSlackString(value) {
37
- const normalized = toOptionalString(value);
38
- return normalized?.trim() || void 0;
39
- }
40
- function parseSlackThreadId(threadId) {
41
- const normalizedThreadId = toTrimmedSlackString(threadId);
42
- if (!normalizedThreadId) {
43
- return void 0;
44
- }
45
- const parts = normalizedThreadId.split(":");
46
- if (parts.length !== 3 || parts[0] !== "slack") {
47
- return void 0;
48
- }
49
- const channelId = toTrimmedSlackString(parts[1]);
50
- const threadTs = toTrimmedSlackString(parts[2]);
51
- if (!channelId || !threadTs) {
52
- return void 0;
53
- }
54
- return { channelId, threadTs };
55
- }
56
- function resolveSlackChannelIdFromThreadId(threadId) {
57
- return parseSlackThreadId(threadId)?.channelId;
58
- }
59
- function resolveSlackChannelIdFromMessage(message) {
60
- const messageChannelId = toTrimmedSlackString(
61
- message.channelId
62
- );
63
- if (messageChannelId) {
64
- return messageChannelId;
65
- }
66
- const raw = message.raw;
67
- if (raw && typeof raw === "object") {
68
- const rawChannel = toTrimmedSlackString(
69
- raw.channel
70
- );
71
- if (rawChannel) {
72
- return rawChannel;
73
- }
74
- }
75
- const threadId = toTrimmedSlackString(
76
- message.threadId
77
- );
78
- return resolveSlackChannelIdFromThreadId(threadId);
79
- }
80
-
81
- // src/chat/conversation-privacy.ts
82
- var SAFE_METADATA_KEY_LIMIT = 20;
83
- function conversationPrivacyFromChannelId(channelId) {
84
- const normalized = channelId?.trim();
85
- if (!normalized) return void 0;
86
- return normalized.startsWith("C") ? "public" : "private";
87
- }
88
- function conversationPrivacyFromConversationId(conversationId) {
89
- if (!conversationId?.trim()) return void 0;
90
- const slackThread = parseSlackThreadId(conversationId);
91
- if (slackThread) {
92
- return conversationPrivacyFromChannelId(slackThread.channelId);
93
- }
94
- return "private";
95
- }
96
- function resolveConversationPrivacy(input) {
97
- return conversationPrivacyFromChannelId(input.channelId) ?? conversationPrivacyFromConversationId(input.conversationId);
98
- }
99
- function canExposeConversationPayload(input) {
100
- return resolveConversationPrivacy(input) === "public";
101
- }
102
- function contentMetadata(content) {
103
- if (typeof content === "string") {
104
- return [{ type: "text", chars: content.length }];
105
- }
106
- if (!Array.isArray(content)) {
107
- return { type: typeof content };
108
- }
109
- return content.map((part) => {
110
- if (!part || typeof part !== "object") {
111
- return { type: typeof part };
112
- }
113
- const record = part;
114
- const type = typeof record.type === "string" ? record.type : "unknown";
115
- return {
116
- type,
117
- ...typeof record.text === "string" ? { chars: record.text.length } : {},
118
- ...typeof record.mimeType === "string" ? { mimeType: record.mimeType } : {},
119
- ...typeof record.mediaType === "string" ? { mediaType: record.mediaType } : {},
120
- ...typeof record.data === "string" ? { dataChars: record.data.length } : {}
121
- };
122
- });
123
- }
124
- function toGenAiMessageMetadata(message) {
125
- const record = message && typeof message === "object" ? message : {};
126
- return {
127
- role: record.role,
128
- content: contentMetadata(record.content)
129
- };
130
- }
131
- function toGenAiTextMetadata(text) {
132
- return { type: "text", chars: text.length };
133
- }
134
- function payloadType(payload) {
135
- return Array.isArray(payload) ? "array" : typeof payload;
136
- }
137
- function payloadKeys(payload) {
138
- if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
139
- return void 0;
140
- }
141
- const keys = Object.keys(payload).slice(
142
- 0,
143
- SAFE_METADATA_KEY_LIMIT
144
- );
145
- return keys.length > 0 ? keys : void 0;
146
- }
147
- function serializedLength(payload) {
148
- const serialized = typeof payload === "string" ? payload : JSON.stringify(payload);
149
- return serialized?.length ?? 0;
150
- }
151
- function toGenAiPayloadMetadata(payload) {
152
- const base = {
153
- type: payloadType(payload),
154
- chars: serializedLength(payload)
155
- };
156
- if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
157
- return base;
158
- }
159
- const keys = payloadKeys(payload);
160
- return {
161
- ...base,
162
- ...keys ? { keys } : {}
163
- };
164
- }
165
- function toGenAiPayloadTraceAttributes(prefix, payload) {
166
- const attributes = {
167
- [`${prefix}.type`]: payloadType(payload),
168
- [`${prefix}.size_chars`]: serializedLength(payload)
169
- };
170
- const keys = payloadKeys(payload);
171
- if (keys) {
172
- attributes[`${prefix}.keys`] = keys;
173
- }
174
- return attributes;
175
- }
176
- function summarizeContent(content) {
177
- if (typeof content === "string") {
178
- return { chars: content.length, partTypes: ["text"] };
179
- }
180
- if (!Array.isArray(content)) {
181
- return {
182
- chars: serializedLength(content),
183
- partTypes: [payloadType(content)]
184
- };
185
- }
186
- let chars = 0;
187
- const partTypes = /* @__PURE__ */ new Set();
188
- for (const part of content) {
189
- if (!part || typeof part !== "object") {
190
- chars += serializedLength(part);
191
- partTypes.add(payloadType(part));
192
- continue;
193
- }
194
- const record = part;
195
- const type = typeof record.type === "string" ? record.type : "unknown";
196
- partTypes.add(type);
197
- if (typeof record.text === "string") {
198
- chars += record.text.length;
199
- } else if (typeof record.data === "string") {
200
- chars += record.data.length;
201
- } else {
202
- chars += serializedLength(part);
203
- }
204
- }
205
- return { chars, partTypes: [...partTypes] };
206
- }
207
- function toGenAiMessagesTraceAttributes(prefix, messages) {
208
- let contentChars = 0;
209
- const roles = /* @__PURE__ */ new Set();
210
- const partTypes = /* @__PURE__ */ new Set();
211
- for (const message of messages) {
212
- if (!message || typeof message !== "object") {
213
- contentChars += serializedLength(message);
214
- continue;
215
- }
216
- const record = message;
217
- if (typeof record.role === "string") {
218
- roles.add(record.role);
219
- }
220
- const summary = summarizeContent(record.content);
221
- contentChars += summary.chars;
222
- for (const partType of summary.partTypes) {
223
- partTypes.add(partType);
224
- }
225
- }
226
- return {
227
- [`${prefix}.message_count`]: messages.length,
228
- [`${prefix}.content_chars`]: contentChars,
229
- ...roles.size > 0 ? { [`${prefix}.roles`]: [...roles] } : {},
230
- ...partTypes.size > 0 ? { [`${prefix}.part_types`]: [...partTypes] } : {}
231
- };
232
- }
9
+ } from "./chunk-3BYAPS6B.js";
233
10
 
234
11
  // src/chat/turn-context-tag.ts
235
12
  var TURN_CONTEXT_TAG = "runtime-turn-context";
@@ -491,6 +268,229 @@ function trimTrailingAssistantMessages(messages) {
491
268
  return end === messages.length ? [...messages] : messages.slice(0, end);
492
269
  }
493
270
 
271
+ // src/chat/config.ts
272
+ import { getModel } from "@earendil-works/pi-ai";
273
+
274
+ // src/chat/optional-string.ts
275
+ function toOptionalTrimmed(value) {
276
+ if (!value) {
277
+ return void 0;
278
+ }
279
+ const trimmed = value.trim();
280
+ return trimmed.length > 0 ? trimmed : void 0;
281
+ }
282
+
283
+ // src/chat/pi/client.ts
284
+ import {
285
+ completeSimple,
286
+ getEnvApiKey,
287
+ getModels,
288
+ registerApiProvider
289
+ } from "@earendil-works/pi-ai";
290
+ import {
291
+ streamAnthropic,
292
+ streamSimpleAnthropic
293
+ } from "@earendil-works/pi-ai/anthropic";
294
+
295
+ // src/chat/slack/context.ts
296
+ function toTrimmedSlackString(value) {
297
+ const normalized = toOptionalString(value);
298
+ return normalized?.trim() || void 0;
299
+ }
300
+ function parseSlackThreadId(threadId) {
301
+ const normalizedThreadId = toTrimmedSlackString(threadId);
302
+ if (!normalizedThreadId) {
303
+ return void 0;
304
+ }
305
+ const parts = normalizedThreadId.split(":");
306
+ if (parts.length !== 3 || parts[0] !== "slack") {
307
+ return void 0;
308
+ }
309
+ const channelId = toTrimmedSlackString(parts[1]);
310
+ const threadTs = toTrimmedSlackString(parts[2]);
311
+ if (!channelId || !threadTs) {
312
+ return void 0;
313
+ }
314
+ return { channelId, threadTs };
315
+ }
316
+ function resolveSlackChannelIdFromThreadId(threadId) {
317
+ return parseSlackThreadId(threadId)?.channelId;
318
+ }
319
+ function resolveSlackChannelIdFromMessage(message) {
320
+ const messageChannelId = toTrimmedSlackString(
321
+ message.channelId
322
+ );
323
+ if (messageChannelId) {
324
+ return messageChannelId;
325
+ }
326
+ const raw = message.raw;
327
+ if (raw && typeof raw === "object") {
328
+ const rawChannel = toTrimmedSlackString(
329
+ raw.channel
330
+ );
331
+ if (rawChannel) {
332
+ return rawChannel;
333
+ }
334
+ }
335
+ const threadId = toTrimmedSlackString(
336
+ message.threadId
337
+ );
338
+ return resolveSlackChannelIdFromThreadId(threadId);
339
+ }
340
+
341
+ // src/chat/conversation-privacy.ts
342
+ var SAFE_METADATA_KEY_LIMIT = 20;
343
+ function conversationPrivacyFromChannelId(channelId) {
344
+ const normalized = channelId?.trim();
345
+ if (!normalized) return void 0;
346
+ return normalized.startsWith("C") ? "public" : "private";
347
+ }
348
+ function conversationPrivacyFromConversationId(conversationId) {
349
+ if (!conversationId?.trim()) return void 0;
350
+ const slackThread = parseSlackThreadId(conversationId);
351
+ if (slackThread) {
352
+ return conversationPrivacyFromChannelId(slackThread.channelId);
353
+ }
354
+ return "private";
355
+ }
356
+ function resolveConversationPrivacy(input) {
357
+ return conversationPrivacyFromChannelId(input.channelId) ?? conversationPrivacyFromConversationId(input.conversationId);
358
+ }
359
+ function canExposeConversationPayload(input) {
360
+ return resolveConversationPrivacy(input) === "public";
361
+ }
362
+ function contentMetadata(content) {
363
+ if (typeof content === "string") {
364
+ return [{ type: "text", chars: content.length }];
365
+ }
366
+ if (!Array.isArray(content)) {
367
+ return { type: typeof content };
368
+ }
369
+ return content.map((part) => {
370
+ if (!part || typeof part !== "object") {
371
+ return { type: typeof part };
372
+ }
373
+ const record = part;
374
+ const type = typeof record.type === "string" ? record.type : "unknown";
375
+ return {
376
+ type,
377
+ ...typeof record.text === "string" ? { chars: record.text.length } : {},
378
+ ...typeof record.mimeType === "string" ? { mimeType: record.mimeType } : {},
379
+ ...typeof record.mediaType === "string" ? { mediaType: record.mediaType } : {},
380
+ ...typeof record.data === "string" ? { dataChars: record.data.length } : {}
381
+ };
382
+ });
383
+ }
384
+ function toGenAiMessageMetadata(message) {
385
+ const record = message && typeof message === "object" ? message : {};
386
+ return {
387
+ role: record.role,
388
+ content: contentMetadata(record.content)
389
+ };
390
+ }
391
+ function toGenAiTextMetadata(text) {
392
+ return { type: "text", chars: text.length };
393
+ }
394
+ function payloadType(payload) {
395
+ return Array.isArray(payload) ? "array" : typeof payload;
396
+ }
397
+ function payloadKeys(payload) {
398
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
399
+ return void 0;
400
+ }
401
+ const keys = Object.keys(payload).slice(
402
+ 0,
403
+ SAFE_METADATA_KEY_LIMIT
404
+ );
405
+ return keys.length > 0 ? keys : void 0;
406
+ }
407
+ function serializedLength(payload) {
408
+ const serialized = typeof payload === "string" ? payload : JSON.stringify(payload);
409
+ return serialized?.length ?? 0;
410
+ }
411
+ function toGenAiPayloadMetadata(payload) {
412
+ const base = {
413
+ type: payloadType(payload),
414
+ chars: serializedLength(payload)
415
+ };
416
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
417
+ return base;
418
+ }
419
+ const keys = payloadKeys(payload);
420
+ return {
421
+ ...base,
422
+ ...keys ? { keys } : {}
423
+ };
424
+ }
425
+ function toGenAiPayloadTraceAttributes(prefix, payload) {
426
+ const attributes = {
427
+ [`${prefix}.type`]: payloadType(payload),
428
+ [`${prefix}.size_chars`]: serializedLength(payload)
429
+ };
430
+ const keys = payloadKeys(payload);
431
+ if (keys) {
432
+ attributes[`${prefix}.keys`] = keys;
433
+ }
434
+ return attributes;
435
+ }
436
+ function summarizeContent(content) {
437
+ if (typeof content === "string") {
438
+ return { chars: content.length, partTypes: ["text"] };
439
+ }
440
+ if (!Array.isArray(content)) {
441
+ return {
442
+ chars: serializedLength(content),
443
+ partTypes: [payloadType(content)]
444
+ };
445
+ }
446
+ let chars = 0;
447
+ const partTypes = /* @__PURE__ */ new Set();
448
+ for (const part of content) {
449
+ if (!part || typeof part !== "object") {
450
+ chars += serializedLength(part);
451
+ partTypes.add(payloadType(part));
452
+ continue;
453
+ }
454
+ const record = part;
455
+ const type = typeof record.type === "string" ? record.type : "unknown";
456
+ partTypes.add(type);
457
+ if (typeof record.text === "string") {
458
+ chars += record.text.length;
459
+ } else if (typeof record.data === "string") {
460
+ chars += record.data.length;
461
+ } else {
462
+ chars += serializedLength(part);
463
+ }
464
+ }
465
+ return { chars, partTypes: [...partTypes] };
466
+ }
467
+ function toGenAiMessagesTraceAttributes(prefix, messages) {
468
+ let contentChars = 0;
469
+ const roles = /* @__PURE__ */ new Set();
470
+ const partTypes = /* @__PURE__ */ new Set();
471
+ for (const message of messages) {
472
+ if (!message || typeof message !== "object") {
473
+ contentChars += serializedLength(message);
474
+ continue;
475
+ }
476
+ const record = message;
477
+ if (typeof record.role === "string") {
478
+ roles.add(record.role);
479
+ }
480
+ const summary = summarizeContent(record.content);
481
+ contentChars += summary.chars;
482
+ for (const partType of summary.partTypes) {
483
+ partTypes.add(partType);
484
+ }
485
+ }
486
+ return {
487
+ [`${prefix}.message_count`]: messages.length,
488
+ [`${prefix}.content_chars`]: contentChars,
489
+ ...roles.size > 0 ? { [`${prefix}.roles`]: [...roles] } : {},
490
+ ...partTypes.size > 0 ? { [`${prefix}.part_types`]: [...partTypes] } : {}
491
+ };
492
+ }
493
+
494
494
  // src/chat/services/provider-retry.ts
495
495
  var PROVIDER_RETRY_DELAYS_MS = [2e3, 4e3, 8e3];
496
496
  var PROVIDER_ERROR_PREFIX = "AI provider error:";
@@ -980,10 +980,16 @@ function readBotConfig(env) {
980
980
  advisor: readAdvisorConfig(env)
981
981
  };
982
982
  }
983
+ function readJuniorDatabaseUrl(env) {
984
+ return toOptionalTrimmed(env.JUNIOR_DATABASE_URL) ?? toOptionalTrimmed(env.DATABASE_URL);
985
+ }
983
986
  function readChatConfig(env = process.env) {
984
987
  return {
985
988
  bot: readBotConfig(env),
986
989
  functionMaxDurationSeconds: resolveFunctionMaxDurationSeconds(env),
990
+ sql: {
991
+ databaseUrl: readJuniorDatabaseUrl(env)
992
+ },
987
993
  slack: {
988
994
  botToken: toOptionalTrimmed(env.SLACK_BOT_TOKEN) ?? toOptionalTrimmed(env.SLACK_BOT_USER_TOKEN),
989
995
  clientId: toOptionalTrimmed(env.SLACK_CLIENT_ID),