@sentry/junior 0.304.0 → 0.306.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-B1IpoELr.js → adapter-context-CnY-i32r.js} +2 -2
  2. package/dist/{admin-BnVFGo_z.js → admin-BLLdLnXh.js} +2 -2
  3. package/dist/{agent-runner-CoEeZSRh.js → agent-runner-BaLjEjPR.js} +312 -204
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +7 -8
  6. package/dist/api.d.ts +19 -4
  7. package/dist/api.js +137 -40
  8. package/dist/{app-Cs157Zc5.d.ts → app-DvYbM9UD.d.ts} +2 -2
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +489 -445
  11. package/dist/{background-compaction-queue-WLPNSF_b.js → background-compaction-queue-D2wzxtGU.js} +7 -3
  12. package/dist/{briefs-CagVVefw.js → briefs-DvyzXfrF.js} +3 -3
  13. package/dist/{catalog-runtime-B8ZXvXWm.js → catalog-runtime-B1R-nHd3.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 +5 -5
  19. package/dist/cli/upgrade.d.ts +1 -1
  20. package/dist/cli/upgrade.js +3 -3
  21. package/dist/{config-DdO1BNcw.js → config-DUD-zMvp.js} +111 -13
  22. package/dist/{connections-D20kp0j5.js → connections-CDhsqPcC.js} +6 -6
  23. package/dist/{continue-in-slack-BKEVMBj1.js → continue-in-slack-BXQizz9o.js} +5 -5
  24. package/dist/{conversation-BOqdRtUx.js → conversation--f85g4zL.js} +132 -132
  25. package/dist/{conversation-feed-CgpgP7yi.js → conversation-feed-BNs9KiqC.js} +1 -1
  26. package/dist/{conversation-privacy-L1SK_v0V.js → conversation-privacy-YE54gMN8.js} +1 -1
  27. package/dist/{conversation-turn-BptVJylj.js → conversation-turn-BzdmrHb0.js} +22 -40
  28. package/dist/{credential-sync-D1J1CGzL.js → credential-sync-Cdm-e1vJ.js} +14 -13
  29. package/dist/{db-EKJnkrIb.js → db-DV2ZUb1Y.js} +90 -11
  30. package/dist/{db-zbN5ZV_o.d.ts → db-pH357Dkt.d.ts} +1 -1
  31. package/dist/{executor-CoIZmFK8.js → executor-CjNhwwnj.js} +47 -4
  32. package/dist/{history-m2-ceTTX.js → history-N7IVbUom.js} +5 -1
  33. package/dist/{install-BT2Pf6HP.js → install-DbD7C5td.js} +2 -2
  34. package/dist/instrumentation.js +2 -2
  35. package/dist/{lineage-C5DGQCS_.js → lineage-BFdIPb3o.js} +2 -2
  36. package/dist/{logging-QSZuMcvo.js → logging-oYpJYr-S.js} +1 -1
  37. package/dist/{message-TtxftRHj.js → message-BBPcMKJY.js} +8 -8
  38. package/dist/{model-input-BHXfA29g.js → model-input-DYYF3a8B.js} +3 -3
  39. package/dist/nitro.d.ts +1 -1
  40. package/dist/nitro.js +4 -4
  41. package/dist/{oauth-callback-server-B0enqHtZ.js → oauth-callback-server-C7Q987su.js} +2 -2
  42. package/dist/{projection-CNKK7doO.js → projection-CWXDE0f6.js} +7740 -6165
  43. package/dist/{prompt-DSjhoKu5.js → prompt-P3eRqO8C.js} +15 -7
  44. package/dist/{queue-CDxkit82.js → queue-7FSijgqG.js} +4 -4
  45. package/dist/{registry-DBDNUUmz.js → registry-1pzXmplY.js} +1 -1
  46. package/dist/{resolve-CQLhMWSu.js → resolve-n87oXY-d.js} +3 -3
  47. package/dist/{result-B-pauj42.js → result-BmF9v9bv.js} +9 -9
  48. package/dist/{runner-B3KxKks5.js → runner-4j7ZsxP5.js} +13 -15
  49. package/dist/{sandbox-egress-signals-DJJX9ClG.js → sandbox-egress-signals-BRQI8HvT.js} +1 -1
  50. package/dist/{automation-CuA3yEcD.js → schedule-CHPWQn-x.js} +347 -5
  51. package/dist/{schema-CKcu-IK6.d.ts → schema-CVbIjrF3.d.ts} +71 -1
  52. package/dist/{schema-Bx0Mlo32.js → schema-D7iIEh6t.js} +52 -6
  53. package/dist/{service-account-DQLqkSVv.js → service-account-BDQ9xzta.js} +3 -3
  54. package/dist/{service-account-2HmlNPvy.js → service-account-DzQiOmqa.js} +5 -5
  55. package/dist/{session-stop-DEeZKqbX.js → session-stop-BQxgHR4X.js} +919 -168
  56. package/dist/{skills-2UrD7JkN.js → skills-CPf4vNuC.js} +2 -2
  57. package/dist/{slack-conversation-unfurl-Dd129Uov.js → slack-conversation-unfurl-B1KEptUg.js} +10 -9
  58. package/dist/{spawn-eMho9HDJ.js → spawn-CjGddiAU.js} +6 -6
  59. package/dist/{state-Bveuc4Zh.js → state-9wfj6aSD.js} +4 -4
  60. package/dist/{stop-D_ltJLDS.js → stop-CsQGuN5n.js} +62 -118
  61. package/dist/{store-COeYnPL_.js → store-Dz3YZ7gQ.js} +5 -5
  62. package/dist/{task-queue-CBIDXZpV.js → task-queue-CFlrJguF.js} +3 -3
  63. package/dist/{task-runner-CJF7zIJL.js → task-runner-frzlUvFD.js} +8 -9
  64. package/dist/{thread-context-Cg0jt0aE.js → thread-context-C4QuZlM8.js} +8 -91
  65. package/dist/turn-session-routing-BXaubz2w.js +244 -0
  66. package/dist/{turn-user-message-tcom1RYd.js → turn-user-message-DNC0eRZ7.js} +3 -3
  67. package/dist/users-XCCKn3xW.js +181 -0
  68. package/dist/{validation-EU91JwIT.js → validation-L5fdjmFX.js} +1 -1
  69. package/dist/{version-BYRPhY5G.js → version-BFmuwgxP.js} +1 -1
  70. package/dist/version.js +1 -1
  71. package/dist/{viewer-Cf8ISkAc.js → viewer-DKOeHpv3.js} +3 -3
  72. package/dist/{warmup-TgY4S1vx.js → warmup-mTMIatCV.js} +271 -279
  73. package/dist/{web-message-id-lNodcCOI.js → web-message-id-CUaSiGme.js} +16 -1
  74. package/dist/{worker-C6Uq4OKD.js → worker-Bz4KNxjI.js} +7 -7
  75. package/migrations/0114_plan_items.sql +22 -0
  76. package/migrations/meta/0114_snapshot.json +5203 -0
  77. package/migrations/meta/_journal.json +7 -0
  78. package/package.json +6 -6
  79. package/dist/schedule-cP0AACm1.js +0 -344
  80. package/dist/turn-session-routing-CaY3Tp8m.js +0 -1792
@@ -1,136 +1,6 @@
1
- import { a as conversationTurnFailureReasonSchema, h as usageSchema, i as conversationTurnFailureCodeSchema } from "./history-m2-ceTTX.js";
1
+ import { a as conversationTurnFailureReasonSchema, h as usageSchema, i as conversationTurnFailureCodeSchema } from "./history-N7IVbUom.js";
2
2
  import * as z from "zod";
3
3
  import { codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, objectFactFields, objectTypeSchema } from "@sentry/junior-plugin-api";
4
- // src/chat/briefs/schema.ts
5
- /**
6
- * Runtime schemas for the Brief record and the generator input. Both cross a
7
- * durable or CLI edge, so these schemas own the exported types.
8
- */
9
- const LINE_MAX = 400;
10
- const lineSchema = z.string().trim().min(1).max(LINE_MAX);
11
- const urlSchema = z.string().url().max(2048);
12
- const timestampSchema = z.string().datetime();
13
- const briefLocationSchema = z.object({
14
- provider: z.string().trim().min(1).max(100),
15
- channelName: lineSchema.optional()
16
- }).strict();
17
- const briefOutcomeStatusSchema = z.enum([
18
- "in_progress",
19
- "answered",
20
- "done",
21
- "partial",
22
- "blocked",
23
- "abandoned"
24
- ]);
25
- const briefCodeChangeSchema = z.object({
26
- repository: lineSchema,
27
- number: z.number().int().positive(),
28
- title: lineSchema.optional(),
29
- url: urlSchema,
30
- state: codeChangeStateSchema,
31
- openedAt: timestampSchema.optional(),
32
- mergedAt: timestampSchema.optional(),
33
- closedAt: timestampSchema.optional()
34
- }).strict();
35
- const briefLinkSchema = z.object({
36
- kind: z.enum([
37
- "code_change",
38
- "resource",
39
- "url"
40
- ]),
41
- label: lineSchema,
42
- url: urlSchema,
43
- status: lineSchema.optional()
44
- }).strict();
45
- const briefRecordSchema = z.object({
46
- startedAt: timestampSchema,
47
- lastActivityAt: timestampSchema,
48
- durationMs: z.number().int().nonnegative(),
49
- participants: z.array(z.object({
50
- name: lineSchema,
51
- messages: z.number().int().positive()
52
- }).strict()),
53
- userMessages: z.number().int().nonnegative(),
54
- assistantMessages: z.number().int().nonnegative(),
55
- toolResults: z.number().int().nonnegative(),
56
- events: z.number().int().nonnegative(),
57
- turns: z.number().int().positive().optional(),
58
- location: briefLocationSchema.optional(),
59
- codeChanges: z.array(briefCodeChangeSchema)
60
- }).strict();
61
- const conversationBriefSchema = z.object({
62
- schemaVersion: z.literal(1),
63
- record: briefRecordSchema,
64
- summary: z.string().trim().min(1).max(600),
65
- intent: lineSchema,
66
- outcome: z.object({
67
- status: briefOutcomeStatusSchema,
68
- text: z.string().trim().min(1).max(600)
69
- }).strict(),
70
- decisions: z.array(z.object({
71
- text: lineSchema,
72
- by: lineSchema.optional(),
73
- kind: z.enum([
74
- "stated",
75
- "confirmed",
76
- "assumed"
77
- ])
78
- }).strict()).max(20),
79
- facts: z.array(lineSchema).max(30),
80
- links: z.array(briefLinkSchema).max(40),
81
- keywords: z.array(z.string().trim().toLowerCase().min(1).max(400)).max(12)
82
- }).strict();
83
- /** Parse a stored Brief row, dropping fields that older versions wrote. */
84
- function parseStoredBrief(content) {
85
- if (content && typeof content === "object" && "openDecisions" in content) {
86
- const { openDecisions: _openDecisions, ...rest } = content;
87
- return conversationBriefSchema.parse(rest);
88
- }
89
- return conversationBriefSchema.parse(content);
90
- }
91
- const briefEntrySchema = z.object({
92
- index: z.number().int().nonnegative(),
93
- role: z.enum([
94
- "user",
95
- "assistant",
96
- "tool",
97
- "event"
98
- ]),
99
- author: lineSchema.optional(),
100
- text: z.string().min(1),
101
- createdAtMs: z.number().int().nonnegative(),
102
- turnId: z.string().min(1).optional()
103
- }).strict();
104
- const briefResourceSchema = z.object({
105
- label: lineSchema,
106
- url: urlSchema,
107
- status: lineSchema.optional()
108
- }).strict();
109
- const briefInputSchema = z.object({
110
- conversationId: z.string().min(1),
111
- title: lineSchema.optional(),
112
- visibility: z.enum(["private", "public"]),
113
- location: briefLocationSchema.optional(),
114
- entries: z.array(briefEntrySchema),
115
- codeChanges: z.array(briefCodeChangeSchema),
116
- resources: z.array(briefResourceSchema)
117
- }).strict();
118
- /**
119
- * Label an annotation as a Brief resource. An object label is only its id,
120
- * such as `owner/repo#123`, so keep its title: Brief search matches labels,
121
- * and a later Conversation must find the object by its topic.
122
- */
123
- function briefResourceLabel(annotation) {
124
- return (annotation.kind === "object" && annotation.title !== annotation.label ? `${annotation.label} · ${annotation.title}` : annotation.label).slice(0, LINE_MAX).trim();
125
- }
126
- /** Parse the provider-neutral input used by every Brief generator adapter. */
127
- function parseBriefInput(input) {
128
- const parsed = briefInputSchema.parse(input);
129
- return {
130
- ...parsed,
131
- entries: [...parsed.entries].sort((left, right) => left.index - right.index || left.createdAtMs - right.createdAtMs)
132
- };
133
- }
134
4
  // src/chat/attachments/input.ts
135
5
  /**
136
6
  * Largest file that Junior stores from Slack or the web, or loads into the
@@ -288,6 +158,136 @@ const conversationTitleSchema = z.string().trim().min(1).max(200);
288
158
  const renameConversationBodySchema = z.object({ title: conversationTitleSchema }).strict();
289
159
  /** The stored title after the rename. */
290
160
  const renameConversationResponseSchema = z.object({ title: z.string().min(1) }).strict();
161
+ // src/chat/briefs/schema.ts
162
+ /**
163
+ * Runtime schemas for the Brief record and the generator input. Both cross a
164
+ * durable or CLI edge, so these schemas own the exported types.
165
+ */
166
+ const LINE_MAX = 400;
167
+ const lineSchema = z.string().trim().min(1).max(LINE_MAX);
168
+ const urlSchema = z.string().url().max(2048);
169
+ const timestampSchema = z.string().datetime();
170
+ const briefLocationSchema = z.object({
171
+ provider: z.string().trim().min(1).max(100),
172
+ channelName: lineSchema.optional()
173
+ }).strict();
174
+ const briefOutcomeStatusSchema = z.enum([
175
+ "in_progress",
176
+ "answered",
177
+ "done",
178
+ "partial",
179
+ "blocked",
180
+ "abandoned"
181
+ ]);
182
+ const briefCodeChangeSchema = z.object({
183
+ repository: lineSchema,
184
+ number: z.number().int().positive(),
185
+ title: lineSchema.optional(),
186
+ url: urlSchema,
187
+ state: codeChangeStateSchema,
188
+ openedAt: timestampSchema.optional(),
189
+ mergedAt: timestampSchema.optional(),
190
+ closedAt: timestampSchema.optional()
191
+ }).strict();
192
+ const briefLinkSchema = z.object({
193
+ kind: z.enum([
194
+ "code_change",
195
+ "resource",
196
+ "url"
197
+ ]),
198
+ label: lineSchema,
199
+ url: urlSchema,
200
+ status: lineSchema.optional()
201
+ }).strict();
202
+ const briefRecordSchema = z.object({
203
+ startedAt: timestampSchema,
204
+ lastActivityAt: timestampSchema,
205
+ durationMs: z.number().int().nonnegative(),
206
+ participants: z.array(z.object({
207
+ name: lineSchema,
208
+ messages: z.number().int().positive()
209
+ }).strict()),
210
+ userMessages: z.number().int().nonnegative(),
211
+ assistantMessages: z.number().int().nonnegative(),
212
+ toolResults: z.number().int().nonnegative(),
213
+ events: z.number().int().nonnegative(),
214
+ turns: z.number().int().positive().optional(),
215
+ location: briefLocationSchema.optional(),
216
+ codeChanges: z.array(briefCodeChangeSchema)
217
+ }).strict();
218
+ const conversationBriefSchema = z.object({
219
+ schemaVersion: z.literal(1),
220
+ record: briefRecordSchema,
221
+ summary: z.string().trim().min(1).max(600),
222
+ intent: lineSchema,
223
+ outcome: z.object({
224
+ status: briefOutcomeStatusSchema,
225
+ text: z.string().trim().min(1).max(600)
226
+ }).strict(),
227
+ decisions: z.array(z.object({
228
+ text: lineSchema,
229
+ by: lineSchema.optional(),
230
+ kind: z.enum([
231
+ "stated",
232
+ "confirmed",
233
+ "assumed"
234
+ ])
235
+ }).strict()).max(20),
236
+ facts: z.array(lineSchema).max(30),
237
+ links: z.array(briefLinkSchema).max(40),
238
+ keywords: z.array(z.string().trim().toLowerCase().min(1).max(400)).max(12)
239
+ }).strict();
240
+ /** Parse a stored Brief row, dropping fields that older versions wrote. */
241
+ function parseStoredBrief(content) {
242
+ if (content && typeof content === "object" && "openDecisions" in content) {
243
+ const { openDecisions: _openDecisions, ...rest } = content;
244
+ return conversationBriefSchema.parse(rest);
245
+ }
246
+ return conversationBriefSchema.parse(content);
247
+ }
248
+ const briefEntrySchema = z.object({
249
+ index: z.number().int().nonnegative(),
250
+ role: z.enum([
251
+ "user",
252
+ "assistant",
253
+ "tool",
254
+ "event"
255
+ ]),
256
+ author: lineSchema.optional(),
257
+ text: z.string().min(1),
258
+ createdAtMs: z.number().int().nonnegative(),
259
+ turnId: z.string().min(1).optional()
260
+ }).strict();
261
+ const briefResourceSchema = z.object({
262
+ label: lineSchema,
263
+ url: urlSchema,
264
+ status: lineSchema.optional()
265
+ }).strict();
266
+ const briefInputSchema = z.object({
267
+ conversationId: z.string().min(1),
268
+ title: lineSchema.optional(),
269
+ visibility: z.enum(["private", "public"]),
270
+ location: briefLocationSchema.optional(),
271
+ entries: z.array(briefEntrySchema),
272
+ codeChanges: z.array(briefCodeChangeSchema),
273
+ resources: z.array(briefResourceSchema)
274
+ }).strict();
275
+ /**
276
+ * Label an annotation as a Brief resource. An object label is only its id,
277
+ * such as `owner/repo#123`, so keep its title: Brief search matches labels,
278
+ * and a later Conversation must find the object by its topic.
279
+ */
280
+ function briefResourceLabel(annotation) {
281
+ return (annotation.kind === "object" && annotation.title !== annotation.label ? `${annotation.label} · ${annotation.title}` : annotation.label).slice(0, LINE_MAX).trim();
282
+ }
283
+ /** Parse the provider-neutral input used by every Brief generator adapter. */
284
+ function parseBriefInput(input) {
285
+ const parsed = briefInputSchema.parse(input);
286
+ return {
287
+ ...parsed,
288
+ entries: [...parsed.entries].sort((left, right) => left.index - right.index || left.createdAtMs - right.createdAtMs)
289
+ };
290
+ }
291
291
  // src/chat/agent-invocations/agent-types.ts
292
292
  /**
293
293
  * Child agent types. A type is plain data: when to pick it and what the child
@@ -1016,4 +1016,4 @@ const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
1016
1016
  sentryConversationUrl: z.string().optional(),
1017
1017
  sourceTask: conversationSourceTaskSchema.optional()
1018
1018
  }).strict().superRefine(validateConversationEvents);
1019
- export { conversationBriefSchema as $, agentTypeSchema as A, messageCardText as B, createConversationMessageBodySchema as C, conversationChildAgentTotalsSchema as D, idempotencyKeySchema as E, renameConversationResponseSchema as F, MAX_INPUT_ATTACHMENTS as G, removedCardSchema as H, conversationReadPositionSchema as I, readMessageAttachments as J, inputFileSchema as K, reviewItemChangeRecordSchema as L, CONVERSATION_TITLE_MAX_LENGTH as M, conversationTitleSchema as N, AGENT_TYPES as O, renameConversationBodySchema as P, briefResourceLabel as Q, annotationCard as R, createConversationBodySchema as S, forkConversationResponseSchema as T, resolveMessageCards as U, readMessageCardRefs as V, MAX_ATTACHMENT_BYTES as W, briefLinkSchema as X, briefCodeChangeSchema as Y, briefOutcomeStatusSchema as Z, conversationReportMessageEventSchema as _, conversationActivityPreviewSchema as a, conversationSurfaceSchema as b, conversationAuxiliaryCostsSchema as c, conversationEventHistorySchema as d, parseBriefInput as et, conversationEventPageSchema as f, conversationReportEventSchema as g, conversationReportEventDataSchema as h, actorIdentitySchema as i, formatAgentTypes as j, agentTypeInstructions as k, conversationDetailQuerySchema as l, conversationParamsSchema as m, CONVERSATION_VERSION_HEADER as n, conversationAttachmentParamsSchema as o, conversationEventsQuerySchema as p, messageAttachmentSchema as q, acceptedConversationMessageSchema as r, conversationAttachmentQuerySchema as s, CONVERSATION_DETAIL_VERSION_HEADER as t, parseStoredBrief as tt, conversationDetailReportSchema as u, conversationReportStatusSchema as v, forkConversationBodySchema as w, conversationUsageSchema as x, conversationSummaryReportSchema as y, messageCardRef as z };
1019
+ export { inputFileSchema as $, agentTypeSchema as A, conversationTitleSchema as B, createConversationMessageBodySchema as C, conversationChildAgentTotalsSchema as D, idempotencyKeySchema as E, briefResourceLabel as F, annotationCard as G, renameConversationResponseSchema as H, conversationBriefSchema as I, readMessageCardRefs as J, messageCardRef as K, parseBriefInput as L, briefCodeChangeSchema as M, briefLinkSchema as N, AGENT_TYPES as O, briefOutcomeStatusSchema as P, MAX_INPUT_ATTACHMENTS as Q, parseStoredBrief as R, createConversationBodySchema as S, forkConversationResponseSchema as T, conversationReadPositionSchema as U, renameConversationBodySchema as V, reviewItemChangeRecordSchema as W, resolveMessageCards as X, removedCardSchema as Y, MAX_ATTACHMENT_BYTES as Z, conversationReportMessageEventSchema as _, conversationActivityPreviewSchema as a, conversationSurfaceSchema as b, conversationAuxiliaryCostsSchema as c, conversationEventHistorySchema as d, messageAttachmentSchema as et, conversationEventPageSchema as f, conversationReportEventSchema as g, conversationReportEventDataSchema as h, actorIdentitySchema as i, formatAgentTypes as j, agentTypeInstructions as k, conversationDetailQuerySchema as l, conversationParamsSchema as m, CONVERSATION_VERSION_HEADER as n, conversationAttachmentParamsSchema as o, conversationEventsQuerySchema as p, messageCardText as q, acceptedConversationMessageSchema as r, conversationAttachmentQuerySchema as s, CONVERSATION_DETAIL_VERSION_HEADER as t, readMessageAttachments as tt, conversationDetailReportSchema as u, conversationReportStatusSchema as v, forkConversationBodySchema as w, conversationUsageSchema as x, conversationSummaryReportSchema as y, CONVERSATION_TITLE_MAX_LENGTH as z };
@@ -1,4 +1,4 @@
1
- import { L as reviewItemChangeRecordSchema, Z as briefOutcomeStatusSchema, i as actorIdentitySchema, q as messageAttachmentSchema, u as conversationDetailReportSchema, y as conversationSummaryReportSchema } from "./conversation-BOqdRtUx.js";
1
+ import { P as briefOutcomeStatusSchema, W as reviewItemChangeRecordSchema, et as messageAttachmentSchema, i as actorIdentitySchema, u as conversationDetailReportSchema, y as conversationSummaryReportSchema } from "./conversation--f85g4zL.js";
2
2
  import * as z from "zod";
3
3
  // src/api/objects/cards.ts
4
4
  const MAX_LABEL_CHARS = 256;
@@ -1,4 +1,4 @@
1
- import { h as logWarn } from "./logging-QSZuMcvo.js";
1
+ import { h as logWarn } from "./logging-oYpJYr-S.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,22 +1,22 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { B as blockScheduledAutomation, E as notifyAutomationBlocked, X as blockEventAutomation, a as getPersistedThreadState, c as coerceThreadConversationState, g as getDispatchRecord, i as getPersistedSandboxState, k as readAutomationExecutionByConversationId, m as getDispatchIdForConversation, s as persistThreadStateById } from "./turn-session-routing-CaY3Tp8m.js";
3
- import { E as isTopLevelKind, T as isPersonInput, a as getConversationStore, k as turnBehavior, mt as nextDetailVersion, o as getDb, r as getConversationEventStore, s as getSqlExecutor } from "./db-EKJnkrIb.js";
4
- import { E as withSpan, S as setTags, h as logWarn, p as logException } from "./logging-QSZuMcvo.js";
5
- import { J as readMessageAttachments } from "./conversation-BOqdRtUx.js";
6
- import { N as juniorConversations } from "./executor-CoIZmFK8.js";
7
- import { c as buildDeliveredTurnStatePatch, l as loadPendingMessageCards, o as completeAuthPauseTurn, r as finalizeFailedTurnReplyWithEvent, t as buildTurnThreadContext } from "./thread-context-Cg0jt0aE.js";
8
- import { Hn as AgentRunError, On as supersedeOpenMailboxTurns, Ot as resolveConversationDestination, Un as executeTurn, in as isParentMessageMeta, rn as childAgentTurnOptions, sn as readParentMessage, vn as completeCancelledConversationTurn, zn as createWebAuthorization } from "./warmup-TgY4S1vx.js";
9
- import { A as latestConversationMessageSeq, Di as verifyTimerWatchCredentialSubject, I as upsertConversationMessage, M as normalizeConversationText, N as recordDeliveredAssistantMessage, a as loadProjection, at as failTurnRecord, b as persistConversationMessages, bn as persistWithRetry, j as markConversationMessage, nt as saveTurnCheckpoint, st as getTurnRecord, t as commitAcceptedReply, un as getAssistantReplyText, v as hydrateConversationMessages } from "./projection-CNKK7doO.js";
10
- import { R as buildDeterministicTurnId, _ as ConversationTurnLifecycleService, d as isTurnInputCommitLostError, g as startActiveTurn, h as markTurnFailed, l as getConversationTurnBoundaryError, s as TurnInputCommitLostError, t as getTurnUserMessage } from "./turn-user-message-tcom1RYd.js";
11
- import { f as credentialContextForActor } from "./registry-DBDNUUmz.js";
2
+ import { A as normalizeConversationText, Do as readConversationAutomationRun, Go as notifyAutomationBlocked, No as getDispatchIdForConversation, O as latestConversationMessageSeq, P as upsertConversationMessage, Xs as blockEventAutomation, a as loadProjection, at as getTurnRecord, b as persistConversationMessages, bi as verifyTimerWatchCredentialSubject, cn as getAssistantReplyText, et as saveTurnCheckpoint, j as recordDeliveredAssistantMessage, k as markConversationMessage, ks as blockScheduledAutomation, rt as failTurnRecord, t as commitAcceptedReply, v as hydrateConversationMessages, vn as persistWithRetry } from "./projection-CWXDE0f6.js";
3
+ import { E as isTopLevelKind, T as isPersonInput, _t as nextDetailVersion, a as getConversationStore, k as turnBehavior, o as getDb, r as getConversationEventStore, s as getSqlExecutor } from "./db-DV2ZUb1Y.js";
4
+ import { E as withSpan, S as setTags, h as logWarn, p as logException } from "./logging-oYpJYr-S.js";
5
+ import { tt as readMessageAttachments } from "./conversation--f85g4zL.js";
6
+ import { F as juniorConversations } from "./executor-CjNhwwnj.js";
7
+ import { a as buildDeliveredTurnStatePatch, o as loadPendingMessageCards, r as completeAuthPauseTurn, t as buildTurnThreadContext } from "./thread-context-C4QuZlM8.js";
8
+ import { Bn as AgentRunError, En as supersedeOpenMailboxTurns, Et as resolveConversationDestination, Ln as createWebAuthorization, Vn as executeTurn, an as readParentMessage, gn as completeCancelledConversationTurn, nn as isParentMessageMeta, tn as childAgentTurnOptions } from "./warmup-mTMIatCV.js";
9
+ import { R as buildDeterministicTurnId, _ as ConversationTurnLifecycleService, d as isTurnInputCommitLostError, g as startActiveTurn, h as markTurnFailed, l as getConversationTurnBoundaryError, s as TurnInputCommitLostError, t as getTurnUserMessage } from "./turn-user-message-DNC0eRZ7.js";
10
+ import { f as credentialContextForActor } from "./registry-1pzXmplY.js";
12
11
  import { i as getActiveSpan, r as continueTrace } from "./sentry-CPbZjomA.js";
13
- import { i as measureTurnCompactionWait } from "./agent-runner-CoEeZSRh.js";
14
- import { n as botConfig } from "./config-DdO1BNcw.js";
15
- import { D as turnInputFactsFromConversationMessage, E as sourceFromTurnInput, I as maybePostAutomatedTurnLimitNotice, M as isEventMailboxMetadata, N as renderEventBatchInputs, O as legacyWebMailboxMetadataSchema, P as timerWatchCredentialSubject, U as recordFinishedTurnForAutomatedLimit, c as loadReviewItemInput, f as buildSteeringPiMessage, g as withoutSavedSteeringMessages, j as eventBatchMessageMeta, m as instructionForInputs, p as instructionActorFor, s as eventReviewItemInputs, x as getEventBatchDelayMs } from "./session-stop-DEeZKqbX.js";
16
- import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-CJF7zIJL.js";
17
- import { p as instructionProvenanceFor } from "./history-m2-ceTTX.js";
18
- import { o as isEventConversationMessage } from "./prompt-DSjhoKu5.js";
19
- import { t as readConversationLineage } from "./lineage-C5DGQCS_.js";
12
+ import { N as finalizeFailedTurnReplyWithEvent, i as measureTurnCompactionWait } from "./agent-runner-BaLjEjPR.js";
13
+ import { a as getPersistedThreadState, c as coerceThreadConversationState, i as getPersistedSandboxState, s as persistThreadStateById } from "./turn-session-routing-BXaubz2w.js";
14
+ import { n as botConfig } from "./config-DUD-zMvp.js";
15
+ import { B as renderEventBatchInputs, D as getEventBatchDelayMs, M as sourceFromTurnInput, N as turnInputFactsFromConversationMessage, P as legacyWebMailboxMetadataSchema, Q as maybePostAutomatedTurnLimitNotice, R as eventBatchMessageMeta, V as timerWatchCredentialSubject, c as loadReviewItemInput, f as buildSteeringPiMessage, g as withoutSavedSteeringMessages, m as instructionForInputs, p as instructionActorFor, s as eventReviewItemInputs, st as recordFinishedTurnForAutomatedLimit, z as isEventMailboxMetadata } from "./session-stop-BQxgHR4X.js";
16
+ import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-frzlUvFD.js";
17
+ import { p as instructionProvenanceFor } from "./history-N7IVbUom.js";
18
+ import { s as isEventConversationMessage } from "./prompt-P3eRqO8C.js";
19
+ import { t as readConversationLineage } from "./lineage-BFdIPb3o.js";
20
20
  import { isDeepStrictEqual } from "node:util";
21
21
  import { createHash } from "node:crypto";
22
22
  import { and, eq, isNotNull, isNull } from "drizzle-orm";
@@ -79,28 +79,13 @@ function getTurnInputSpanAttributes(input, turnStartedAtMs) {
79
79
  }
80
80
  // src/chat/automations/block-run.ts
81
81
  /**
82
- * Find the Automation of a run. The SQL run row lasts as long as the
83
- * Automation, but a Watch can outlive the dispatch record. The dispatch record
84
- * covers a run whose row does not link its Conversation yet.
85
- */
86
- async function findRunAutomation(conversationId, dispatchId) {
87
- const run = await readAutomationExecutionByConversationId({ conversationId });
88
- if (run) return run;
89
- const source = dispatchId ? (await getDispatchRecord(dispatchId))?.source : void 0;
90
- if (!source || !("automationId" in source) || !source.automationId) return;
91
- return {
92
- automationId: source.automationId,
93
- kind: source.kind === "scheduled_automation" ? "scheduled" : "event"
94
- };
95
- }
96
- /**
97
82
  * Block the Automation of a run from a later Turn of the run, such as a Watch
98
83
  * Event or child result Turn. The dispatch Turn blocks through its dispatch
99
84
  * outcome. Its creator is told when the block is first stored.
100
85
  */
101
86
  async function blockRunAutomation(conversationId, blocked) {
102
87
  const dispatchId = getDispatchIdForConversation(conversationId);
103
- const automation = await findRunAutomation(conversationId, dispatchId);
88
+ const automation = await readConversationAutomationRun(conversationId);
104
89
  if (!automation) {
105
90
  logWarn("automation.block.unresolved", { "gen_ai.conversation.id": conversationId });
106
91
  return;
@@ -424,7 +409,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
424
409
  personInput: isPersonInput(source.kind)
425
410
  });
426
411
  const webActor = actor.platform === "web" ? actor : void 0;
427
- const signInActor = behavior.promptMode === "child_agent" ? void 0 : webActor;
412
+ const signInActor = behavior.waitsForSignIn ? webActor : void 0;
428
413
  const disabledFeatures = signInActor ? [] : ["interactive-auth"];
429
414
  const deliverToProvider = postsToProvider && behavior.delivery === "location";
430
415
  const sendToParent = async (result) => {
@@ -642,10 +627,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
642
627
  }, async (result) => {
643
628
  if (stopSignal?.aborted) throw stopSignal.reason ?? new DOMException("Turn cancelled", "AbortError");
644
629
  modelFailureCaptureAttempted = result.diagnostics.outcome !== "success";
645
- const finalized = finalizeFailedTurnReplyWithEvent({
646
- reply: result,
647
- logException
648
- });
630
+ const finalized = finalizeFailedTurnReplyWithEvent({ reply: result });
649
631
  const modelFailureReason = finalized.failureReason;
650
632
  const reply = finalized.reply;
651
633
  modelFailureEventId = finalized.eventId;
@@ -728,7 +710,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
728
710
  await scheduleSessionCompletedPluginTasks({
729
711
  conversationId: context.conversationId,
730
712
  sessionId: turnId
731
- }, { send: async (message) => {
713
+ }, async (message) => {
732
714
  try {
733
715
  await processPluginTask(message);
734
716
  } catch (error) {
@@ -739,7 +721,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
739
721
  turnId
740
722
  });
741
723
  }
742
- } });
724
+ });
743
725
  } catch (error) {
744
726
  logException(error, "conversation.plugin.session_completion_task.failed", {
745
727
  conversationId: context.conversationId,
@@ -1,19 +1,20 @@
1
- import { Da as postSlackMessage, Yn as createUserTokenStore, Z as getConversationPendingAuth, Zn as resolvePluginOAuthAccount, ca as formatProviderLabel, d as recordAuthorizationCompleted, is as getSlackClient, la as parseOAuthStatePayload, st as getTurnRecord, u as recordAuthenticationLinked, ua as resolveBaseUrl } from "./projection-CNKK7doO.js";
2
- import { V as escapeXml, a as getRuntimeMetadata, n as botConfig } from "./config-DdO1BNcw.js";
3
- import { W as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-QSZuMcvo.js";
1
+ import { Bn as createUserTokenStore, Gi as parseOAuthStatePayload, Hn as resolvePluginOAuthAccount, Ki as resolveBaseUrl, Qo as postSlackMessage, Wi as formatProviderLabel, Y as getConversationPendingAuth, at as getTurnRecord, d as recordAuthorizationCompleted, ls as getSlackClient, u as recordAuthenticationLinked } from "./projection-CWXDE0f6.js";
2
+ import { V as escapeXml, a as getRuntimeMetadata, n as botConfig } from "./config-DUD-zMvp.js";
3
+ import { W as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-oYpJYr-S.js";
4
4
  import { p as parseSlackUserId } from "./actor-D2iXzvlN.js";
5
- import { B as findUserByVerifiedEmails, I as resolveActorIdentityId, W as upsertLinkedIdentity, X as getStateAdapter, et as acquireActiveLock, s as getSqlExecutor } from "./db-EKJnkrIb.js";
5
+ import { $ as getStateAdapter, H as findUserByVerifiedEmails, I as resolveActorIdentityId, q as upsertLinkedIdentity, rt as acquireActiveLock, s as getSqlExecutor } from "./db-DV2ZUb1Y.js";
6
6
  import { i as homeDir } from "./package-discovery-x4AvVhMj.js";
7
- import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-DBDNUUmz.js";
8
- import { n as pluginCatalogRuntime } from "./catalog-runtime-B8ZXvXWm.js";
9
- import { t as discoverSkills } from "./skills-2UrD7JkN.js";
10
- import { o as finalizeMcpAuthorization } from "./agent-runner-CoEeZSRh.js";
11
- import { O as getMcpProviderErrorAttributes, S as putMcpStoredOAuthCredentials, f as deleteMcpAuthSession, g as getMcpAuthSession, v as getMcpStoredOAuthCredentials } from "./service-account-2HmlNPvy.js";
12
- import { o as readIdentityById } from "./viewer-Cf8ISkAc.js";
7
+ import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-1pzXmplY.js";
8
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-B1R-nHd3.js";
9
+ import { t as discoverSkills } from "./skills-CPf4vNuC.js";
10
+ import { o as finalizeMcpAuthorization } from "./agent-runner-BaLjEjPR.js";
11
+ import { O as getMcpProviderErrorAttributes, S as putMcpStoredOAuthCredentials, f as deleteMcpAuthSession, g as getMcpAuthSession, v as getMcpStoredOAuthCredentials } from "./service-account-DzQiOmqa.js";
12
+ import { o as readIdentityById } from "./viewer-DKOeHpv3.js";
13
13
  import { t as readJuniorSecret } from "./secrets-DHaJ5TTn.js";
14
- import { Bn as deleteWebAuthorization, L as lookupSlackUserProfile, Mn as wakeAuthorizedTurn, Nn as wakePausedTurn } from "./warmup-TgY4S1vx.js";
15
- import { a as getPersistedThreadState, c as coerceThreadConversationState } from "./turn-session-routing-CaY3Tp8m.js";
16
- import { i as readConnectedOAuthTokens, s as htmlCallbackResponse } from "./connections-D20kp0j5.js";
14
+ import { An as wakeAuthorizedTurn, Rn as deleteWebAuthorization, jn as wakePausedTurn } from "./warmup-mTMIatCV.js";
15
+ import { i as lookupSlackUserProfile } from "./users-XCCKn3xW.js";
16
+ import { a as getPersistedThreadState, c as coerceThreadConversationState } from "./turn-session-routing-BXaubz2w.js";
17
+ import { i as readConnectedOAuthTokens, s as htmlCallbackResponse } from "./connections-CDhsqPcC.js";
17
18
  import { n as relayLocalOAuthCallback } from "./oauth-relay-DAmfVmJu.js";
18
19
  import * as z from "zod";
19
20
  import path from "node:path";