@sentry/junior 0.147.0 → 0.149.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 (162) hide show
  1. package/dist/{agent-hooks-HS6VGUPM.js → agent-hooks-CWMCXAMT.js} +10 -10
  2. package/dist/api/conversations/access.d.ts +2 -1
  3. package/dist/api/conversations/aggregate.d.ts +2 -0
  4. package/dist/api/conversations/archive.d.ts +3 -5
  5. package/dist/api/conversations/create.d.ts +6 -0
  6. package/dist/api/conversations/detail.d.ts +2 -296
  7. package/dist/api/conversations/event-list.d.ts +2 -193
  8. package/dist/api/conversations/list.d.ts +4 -66
  9. package/dist/api/conversations/pending-messages.d.ts +15 -0
  10. package/dist/api/conversations/routes.d.ts +1 -1
  11. package/dist/api/conversations/stats.d.ts +0 -54
  12. package/dist/api/http.d.ts +2 -6
  13. package/dist/api/locations/detail.d.ts +3 -111
  14. package/dist/api/locations/list.d.ts +0 -45
  15. package/dist/api/locations/query.d.ts +2 -1
  16. package/dist/api/locations/routes.d.ts +1 -1
  17. package/dist/api/people/list.d.ts +0 -29
  18. package/dist/api/people/profile.d.ts +2 -106
  19. package/dist/api/people/profile.query.d.ts +2 -1
  20. package/dist/api/people/routes.d.ts +1 -1
  21. package/dist/api/people/shared.d.ts +3 -1
  22. package/dist/api/people/spend.d.ts +3 -4
  23. package/dist/api/personal-tokens/routes.d.ts +2 -2
  24. package/dist/api/route.d.ts +8 -14
  25. package/dist/api/schema/conversation.d.ts +130 -25
  26. package/dist/api/schema/location.d.ts +4 -0
  27. package/dist/api/schema/person.d.ts +7 -3
  28. package/dist/api/schema.d.ts +2 -2
  29. package/dist/api/schema.js +13 -1
  30. package/dist/api/stats.d.ts +0 -13
  31. package/dist/api/validation.d.ts +7 -0
  32. package/dist/api/viewer.d.ts +3 -0
  33. package/dist/api.d.ts +2 -1
  34. package/dist/api.js +772 -561
  35. package/dist/app.js +241 -204
  36. package/dist/{catalog-runtime-M6ZTPYRV.js → catalog-runtime-GAW5APVI.js} +5 -5
  37. package/dist/chat/actor.d.ts +4 -1
  38. package/dist/chat/agent/request.d.ts +2 -0
  39. package/dist/chat/agent/resume.d.ts +1 -0
  40. package/dist/chat/agent-dispatch/context.d.ts +2 -2
  41. package/dist/chat/agent-invocations/types.d.ts +52 -0
  42. package/dist/chat/api-turns/work.d.ts +108 -0
  43. package/dist/chat/app/services.d.ts +1 -1
  44. package/dist/chat/conversations/history.d.ts +60 -0
  45. package/dist/chat/conversations/provenance.d.ts +6 -0
  46. package/dist/chat/conversations/sql/actor-identity.d.ts +19 -0
  47. package/dist/chat/conversations/store.d.ts +1 -1
  48. package/dist/chat/resource-events/store.d.ts +1 -1
  49. package/dist/chat/runtime/reply-executor.d.ts +1 -3
  50. package/dist/chat/runtime/slack-runtime.d.ts +2 -1
  51. package/dist/chat/runtime/turn-preparation.d.ts +9 -0
  52. package/dist/chat/scheduled-tasks/tool-support.d.ts +5 -5
  53. package/dist/chat/scheduled-tasks/tools/create.d.ts +2 -2
  54. package/dist/chat/scheduled-tasks/tools/delete.d.ts +2 -2
  55. package/dist/chat/scheduled-tasks/tools/list.d.ts +2 -2
  56. package/dist/chat/scheduled-tasks/tools/run-now.d.ts +2 -2
  57. package/dist/chat/scheduled-tasks/tools/update.d.ts +2 -2
  58. package/dist/chat/services/conversation-memory.d.ts +2 -2
  59. package/dist/chat/services/conversation-title.d.ts +20 -0
  60. package/dist/chat/slack/assistant-thread/title.d.ts +10 -27
  61. package/dist/chat/slack/channel.d.ts +26 -0
  62. package/dist/chat/slack/dispatch-turn.d.ts +1 -0
  63. package/dist/chat/slack/timestamp-param.d.ts +0 -2
  64. package/dist/chat/slack/{tools → tool-support}/canvas/api.d.ts +1 -1
  65. package/dist/chat/slack/{tools → tool-support}/canvas/context.d.ts +3 -0
  66. package/dist/chat/slack/tool-support/channel-access.d.ts +42 -0
  67. package/dist/chat/slack/tool-support/channel-target.d.ts +27 -0
  68. package/dist/chat/slack/tool-support/list/params.d.ts +5 -0
  69. package/dist/chat/slack/tools/canvas/create.d.ts +1 -1
  70. package/dist/chat/slack/tools/channel-join.d.ts +28 -0
  71. package/dist/chat/slack/tools/channel-list-messages.d.ts +3 -2
  72. package/dist/chat/slack/tools/conversation-message-search.d.ts +2 -8
  73. package/dist/chat/slack/tools/message-add-reaction.d.ts +1 -1
  74. package/dist/chat/slack/tools/public-search.d.ts +63 -2
  75. package/dist/chat/slack/tools/send-files.d.ts +1 -1
  76. package/dist/chat/slack/tools/thread-read.d.ts +2 -5
  77. package/dist/chat/source.d.ts +2 -0
  78. package/dist/chat/state/conversation.d.ts +1 -0
  79. package/dist/chat/task-execution/checkpoint.d.ts +1 -0
  80. package/dist/chat/task-execution/state.d.ts +9 -4
  81. package/dist/chat/task-execution/store.d.ts +3 -2
  82. package/dist/chat/task-execution/turn-cursor.d.ts +2 -0
  83. package/dist/chat/task-execution/worker.d.ts +2 -0
  84. package/dist/chat/tasks/read.d.ts +1 -1
  85. package/dist/chat/tools/search-conversation-events.d.ts +1 -1
  86. package/dist/chat/tools/types.d.ts +11 -4
  87. package/dist/chat/tools/watch-resource-events.d.ts +2 -2
  88. package/dist/{chunk-ORO3PWKQ.js → chunk-25SC7D6Z.js} +1 -1
  89. package/dist/{chunk-GGB4WL5A.js → chunk-2JHKISQA.js} +1 -1
  90. package/dist/{chunk-AVZDSUFB.js → chunk-2P6BQQER.js} +4 -4
  91. package/dist/{chunk-7NVJVJID.js → chunk-32CXPIZE.js} +2 -2
  92. package/dist/{chunk-YSB2N563.js → chunk-3GYZ5YEH.js} +121 -87
  93. package/dist/{chunk-DU74WPIC.js → chunk-3I2IVWSZ.js} +1 -1
  94. package/dist/{chunk-SVHUEHUL.js → chunk-3JVUWLR7.js} +65 -4
  95. package/dist/{chunk-RXBVB2JM.js → chunk-3KGQOKIG.js} +1 -1
  96. package/dist/{chunk-YBVXBNSV.js → chunk-4JGM7FXO.js} +2 -2
  97. package/dist/{chunk-AZ7EAOBE.js → chunk-4YKPOYRV.js} +5 -5
  98. package/dist/chunk-5CWUQXXT.js +806 -0
  99. package/dist/{chunk-DLDRQHG5.js → chunk-6G5RCDKP.js} +1 -1
  100. package/dist/{chunk-AYU72WO7.js → chunk-75DSYFFB.js} +47 -70
  101. package/dist/{chunk-YHDERDRO.js → chunk-7BH46NB4.js} +91 -75
  102. package/dist/{chunk-745QJ3ZA.js → chunk-ALJG73MQ.js} +2 -2
  103. package/dist/chunk-ART7P442.js +48 -0
  104. package/dist/{chunk-7A4M7PCV.js → chunk-DK5UT6PQ.js} +1180 -556
  105. package/dist/{chunk-AIOK6LAG.js → chunk-EW2LNCRL.js} +813 -44
  106. package/dist/chunk-EXW76GW4.js +36 -0
  107. package/dist/chunk-GDFF3BQG.js +136 -0
  108. package/dist/{chunk-7UQIVT6G.js → chunk-JMH3DBM5.js} +6 -6
  109. package/dist/{chunk-CWP5RHVX.js → chunk-JMSMXXED.js} +12 -5
  110. package/dist/{chunk-CSZINQJ2.js → chunk-MEMURSBG.js} +1 -1
  111. package/dist/{chunk-YNTTROJT.js → chunk-QIW7OQEO.js} +1 -1
  112. package/dist/{chunk-Q4R73I43.js → chunk-RB26T3LU.js} +58 -28
  113. package/dist/{chunk-4LJO56OJ.js → chunk-RLVZIWNQ.js} +1 -1
  114. package/dist/{chunk-SGZO7UWH.js → chunk-SWHPVZBV.js} +2 -2
  115. package/dist/{chunk-PVNG6UMU.js → chunk-TFBNBXPU.js} +22 -10
  116. package/dist/{chunk-EFLJ2WJH.js → chunk-URDCZAL4.js} +5 -5
  117. package/dist/{chunk-6H5SZR24.js → chunk-UZGASGOD.js} +300 -383
  118. package/dist/{chunk-YEO3VX72.js → chunk-W7UONUIZ.js} +8 -6
  119. package/dist/{chunk-JUUKWRBE.js → chunk-X22XXSZA.js} +1 -1
  120. package/dist/{chunk-X5UY34KT.js → chunk-XPYWWMHR.js} +8 -8
  121. package/dist/{chunk-IIOOO4FQ.js → chunk-ZYMYLLWG.js} +2 -1
  122. package/dist/cli/chat.js +32 -35
  123. package/dist/cli/check.js +6 -6
  124. package/dist/cli/plugins.js +13 -13
  125. package/dist/cli/snapshot-create.js +9 -9
  126. package/dist/cli/upgrade.js +7 -7
  127. package/dist/db/schema/agent-invocations.d.ts +20 -0
  128. package/dist/db/schema/conversation-annotations.d.ts +2 -2
  129. package/dist/db/schema.d.ts +22 -2
  130. package/dist/{db-CSEW4RII.js → db-JBZLRIVY.js} +7 -7
  131. package/dist/instrumentation.js +4 -4
  132. package/dist/nitro.js +2 -2
  133. package/dist/{oauth-callback-server-FUEV5HNG.js → oauth-callback-server-MNTVYY2I.js} +24 -26
  134. package/dist/{runner-U3XHSKSH.js → runner-K24BWZSZ.js} +23 -25
  135. package/dist/{skills-AKE6W3WI.js → skills-AU5ST2CG.js} +6 -6
  136. package/dist/spawn-6PO7CVJ6.js +38 -0
  137. package/dist/{validation-WDTAULUF.js → validation-IXGZCFRO.js} +6 -6
  138. package/dist/version.js +1 -1
  139. package/dist/{work-C3HAO2BG.js → work-WCZIYILX.js} +18 -19
  140. package/dist/{worker-LNP4YKBM.js → worker-U2AACBEY.js} +11 -10
  141. package/package.json +6 -5
  142. package/dist/api/health.d.ts +0 -7
  143. package/dist/api/personal-tokens/create.d.ts +0 -11
  144. package/dist/api/personal-tokens/list.d.ts +0 -12
  145. package/dist/api/personal-tokens/revoke.d.ts +0 -5
  146. package/dist/api/plugin-reports.d.ts +0 -63
  147. package/dist/api/plugins.d.ts +0 -8
  148. package/dist/api/runtime.d.ts +0 -24
  149. package/dist/api/skills.d.ts +0 -6
  150. package/dist/chat/slack/tools/channel-access.d.ts +0 -30
  151. package/dist/chunk-34GS7B6L.js +0 -115
  152. package/dist/chunk-AVOCH2Z5.js +0 -285
  153. package/dist/chunk-HLXXQI5Q.js +0 -238
  154. package/dist/chunk-K4SZAP3K.js +0 -67
  155. package/dist/chunk-R776HKPK.js +0 -81
  156. package/dist/chunk-Z4YU7Z4L.js +0 -76
  157. package/dist/spawn-B6GDTWJ4.js +0 -39
  158. /package/dist/chat/slack/{tools → tool-support}/canvas/markdown.d.ts +0 -0
  159. /package/dist/chat/slack/{tools → tool-support}/channel-capabilities.d.ts +0 -0
  160. /package/dist/chat/slack/{tools → tool-support}/context.d.ts +0 -0
  161. /package/dist/chat/slack/{tools → tool-support}/list/api.d.ts +0 -0
  162. /package/dist/chat/slack/{tools → tool-support}/slack-message-url.d.ts +0 -0
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-JUUKWRBE.js";
4
- import "./chunk-GGB4WL5A.js";
3
+ } from "./chunk-X22XXSZA.js";
4
+ import "./chunk-2JHKISQA.js";
5
5
  import "./chunk-RUIXF3YQ.js";
6
6
  import "./chunk-HZF5P5UN.js";
7
7
  import "./chunk-F3B2YJ76.js";
8
- import "./chunk-4LJO56OJ.js";
8
+ import "./chunk-RLVZIWNQ.js";
9
9
  import "./chunk-6GWA276C.js";
10
10
  import "./chunk-OOUNJNMR.js";
11
11
  import "./chunk-H4HBKISO.js";
12
- import "./chunk-DLDRQHG5.js";
13
- import "./chunk-IIOOO4FQ.js";
12
+ import "./chunk-6G5RCDKP.js";
13
+ import "./chunk-ZYMYLLWG.js";
14
14
  import "./chunk-MLKGABMK.js";
15
15
  export {
16
16
  pluginCatalogRuntime
@@ -26,11 +26,14 @@ export interface SlackActor extends BaseActor {
26
26
  export interface LocalActor extends BaseActor {
27
27
  platform: "local";
28
28
  }
29
+ export interface WebActor extends BaseActor {
30
+ platform: "web";
31
+ }
29
32
  export interface SystemActor {
30
33
  platform: "system";
31
34
  name: string;
32
35
  }
33
- export type UserActor = SlackActor | LocalActor;
36
+ export type UserActor = SlackActor | LocalActor | WebActor;
34
37
  export type Actor = UserActor | SystemActor;
35
38
  export interface SlackActorProfile {
36
39
  email?: string;
@@ -96,6 +96,8 @@ export interface AgentRunRouting {
96
96
  */
97
97
  slackActionToken?: SlackActionToken;
98
98
  destination: Destination;
99
+ /** When true, also publish assistant output to the conversation destination. */
100
+ publishExternally?: boolean;
99
101
  /** Confirmed visibility of the destination where this run is delivered. */
100
102
  destinationVisibility?: ConversationPrivacy;
101
103
  surface?: AgentTurnSurface;
@@ -22,6 +22,7 @@ interface ResumeStateArgs {
22
22
  dispatchId?: string;
23
23
  durability: AgentRunDurability;
24
24
  recordActiveMcpProviders: () => Promise<void>;
25
+ publishExternally: boolean;
25
26
  actor?: Actor;
26
27
  runSource: Source;
27
28
  conversationId: string;
@@ -21,7 +21,7 @@ export declare function dispatchEventTask(args: {
21
21
  };
22
22
  }): Promise<{
23
23
  id: string;
24
- status: "already_exists" | "created";
24
+ status: "created" | "already_exists";
25
25
  }>;
26
26
  /** Create and enqueue one core-owned scheduled task dispatch. */
27
27
  export declare function dispatchScheduledTask(args: {
@@ -37,7 +37,7 @@ export declare function dispatchScheduledTask(args: {
37
37
  };
38
38
  }): Promise<{
39
39
  id: string;
40
- status: "already_exists" | "created";
40
+ status: "created" | "already_exists";
41
41
  }>;
42
42
  /** Read the bounded outcome for one core-owned scheduled task dispatch. */
43
43
  export declare function getScheduledTaskDispatch(id: string): Promise<import("./types").DispatchProjection | undefined>;
@@ -20,6 +20,12 @@ export declare const agentInvocationSchema: z.ZodDiscriminatedUnion<[z.ZodObject
20
20
  fullName: z.ZodOptional<z.ZodString>;
21
21
  userId: z.ZodString;
22
22
  userName: z.ZodOptional<z.ZodString>;
23
+ }, z.core.$strict>, z.ZodObject<{
24
+ platform: z.ZodLiteral<"web">;
25
+ email: z.ZodOptional<z.ZodString>;
26
+ fullName: z.ZodOptional<z.ZodString>;
27
+ userId: z.ZodString;
28
+ userName: z.ZodOptional<z.ZodString>;
23
29
  }, z.core.$strict>, z.ZodObject<{
24
30
  platform: z.ZodLiteral<"system">;
25
31
  name: z.ZodString;
@@ -111,6 +117,13 @@ export declare const agentInvocationSchema: z.ZodDiscriminatedUnion<[z.ZodObject
111
117
  platform: z.ZodLiteral<"local">;
112
118
  visibility: z.ZodLiteral<"private">;
113
119
  conversationId: z.ZodString;
120
+ }, z.core.$strict>, z.ZodObject<{
121
+ platform: z.ZodLiteral<"web">;
122
+ visibility: z.ZodEnum<{
123
+ public: "public";
124
+ private: "private";
125
+ }>;
126
+ conversationId: z.ZodString;
114
127
  }, z.core.$strict>], "platform">;
115
128
  updatedAtMs: z.ZodNumber;
116
129
  status: z.ZodEnum<{
@@ -132,6 +145,12 @@ export declare const agentInvocationSchema: z.ZodDiscriminatedUnion<[z.ZodObject
132
145
  fullName: z.ZodOptional<z.ZodString>;
133
146
  userId: z.ZodString;
134
147
  userName: z.ZodOptional<z.ZodString>;
148
+ }, z.core.$strict>, z.ZodObject<{
149
+ platform: z.ZodLiteral<"web">;
150
+ email: z.ZodOptional<z.ZodString>;
151
+ fullName: z.ZodOptional<z.ZodString>;
152
+ userId: z.ZodString;
153
+ userName: z.ZodOptional<z.ZodString>;
135
154
  }, z.core.$strict>, z.ZodObject<{
136
155
  platform: z.ZodLiteral<"system">;
137
156
  name: z.ZodString;
@@ -223,6 +242,13 @@ export declare const agentInvocationSchema: z.ZodDiscriminatedUnion<[z.ZodObject
223
242
  platform: z.ZodLiteral<"local">;
224
243
  visibility: z.ZodLiteral<"private">;
225
244
  conversationId: z.ZodString;
245
+ }, z.core.$strict>, z.ZodObject<{
246
+ platform: z.ZodLiteral<"web">;
247
+ visibility: z.ZodEnum<{
248
+ public: "public";
249
+ private: "private";
250
+ }>;
251
+ conversationId: z.ZodString;
226
252
  }, z.core.$strict>], "platform">;
227
253
  updatedAtMs: z.ZodNumber;
228
254
  result: z.ZodString;
@@ -242,6 +268,12 @@ export declare const agentInvocationSchema: z.ZodDiscriminatedUnion<[z.ZodObject
242
268
  fullName: z.ZodOptional<z.ZodString>;
243
269
  userId: z.ZodString;
244
270
  userName: z.ZodOptional<z.ZodString>;
271
+ }, z.core.$strict>, z.ZodObject<{
272
+ platform: z.ZodLiteral<"web">;
273
+ email: z.ZodOptional<z.ZodString>;
274
+ fullName: z.ZodOptional<z.ZodString>;
275
+ userId: z.ZodString;
276
+ userName: z.ZodOptional<z.ZodString>;
245
277
  }, z.core.$strict>, z.ZodObject<{
246
278
  platform: z.ZodLiteral<"system">;
247
279
  name: z.ZodString;
@@ -333,6 +365,13 @@ export declare const agentInvocationSchema: z.ZodDiscriminatedUnion<[z.ZodObject
333
365
  platform: z.ZodLiteral<"local">;
334
366
  visibility: z.ZodLiteral<"private">;
335
367
  conversationId: z.ZodString;
368
+ }, z.core.$strict>, z.ZodObject<{
369
+ platform: z.ZodLiteral<"web">;
370
+ visibility: z.ZodEnum<{
371
+ public: "public";
372
+ private: "private";
373
+ }>;
374
+ conversationId: z.ZodString;
336
375
  }, z.core.$strict>], "platform">;
337
376
  updatedAtMs: z.ZodNumber;
338
377
  errorMessage: z.ZodString;
@@ -356,6 +395,12 @@ export declare const createAgentInvocationSchema: z.ZodObject<{
356
395
  fullName: z.ZodOptional<z.ZodString>;
357
396
  userId: z.ZodString;
358
397
  userName: z.ZodOptional<z.ZodString>;
398
+ }, z.core.$strict>, z.ZodObject<{
399
+ platform: z.ZodLiteral<"web">;
400
+ email: z.ZodOptional<z.ZodString>;
401
+ fullName: z.ZodOptional<z.ZodString>;
402
+ userId: z.ZodString;
403
+ userName: z.ZodOptional<z.ZodString>;
359
404
  }, z.core.$strict>, z.ZodObject<{
360
405
  platform: z.ZodLiteral<"system">;
361
406
  name: z.ZodString;
@@ -441,6 +486,13 @@ export declare const createAgentInvocationSchema: z.ZodObject<{
441
486
  platform: z.ZodLiteral<"local">;
442
487
  visibility: z.ZodLiteral<"private">;
443
488
  conversationId: z.ZodString;
489
+ }, z.core.$strict>, z.ZodObject<{
490
+ platform: z.ZodLiteral<"web">;
491
+ visibility: z.ZodEnum<{
492
+ public: "public";
493
+ private: "private";
494
+ }>;
495
+ conversationId: z.ZodString;
444
496
  }, z.core.$strict>], "platform">;
445
497
  }, z.core.$strict>;
446
498
  export type AgentBinding = z.output<typeof agentBindingSchema>;
@@ -0,0 +1,108 @@
1
+ import { z } from "zod";
2
+ import type { StateAdapter } from "chat";
3
+ import { type Destination } from "@sentry/junior-plugin-api";
4
+ import type { ConversationPrivacy } from "@/chat/conversation-privacy";
5
+ import type { WebActor } from "@/chat/actor";
6
+ import type { ConversationStore } from "@/chat/conversations/store";
7
+ import { type ConversationTurnLifecycle } from "@/chat/conversations/turn-lifecycle";
8
+ import type { AgentRunner } from "@/chat/runtime/agent-runner";
9
+ import { type InboundMessage } from "@/chat/task-execution/store";
10
+ import type { ConversationWorkQueue } from "@/chat/task-execution/queue";
11
+ import type { ConversationWorkerContext, ConversationWorkerResult } from "@/chat/task-execution/worker";
12
+ declare const apiTurnMailboxMetadataSchema: z.ZodObject<{
13
+ authorEmail: z.ZodString;
14
+ authorFullName: z.ZodOptional<z.ZodString>;
15
+ authorUserId: z.ZodString;
16
+ authorUserName: z.ZodOptional<z.ZodString>;
17
+ kind: z.ZodLiteral<"api_turn">;
18
+ messageId: z.ZodString;
19
+ }, z.core.$strict>;
20
+ type ApiTurnMailboxMetadata = z.output<typeof apiTurnMailboxMetadataSchema>;
21
+ type EnqueueOptions = {
22
+ conversationStore?: ConversationStore;
23
+ nowMs?: number;
24
+ queue: ConversationWorkQueue;
25
+ state?: StateAdapter;
26
+ };
27
+ export interface CreateApiConversationInput {
28
+ actor: WebActor;
29
+ message: string;
30
+ /** Client-supplied idempotency key for the first message. */
31
+ idempotencyKey: string;
32
+ /** New roots default public. Continues never rewrite visibility. */
33
+ visibility?: ConversationPrivacy;
34
+ }
35
+ export interface AppendApiConversationMessageInput {
36
+ actor: WebActor;
37
+ conversationId: string;
38
+ message: string;
39
+ idempotencyKey: string;
40
+ /** Applied only when this call creates the conversation root. */
41
+ rootVisibility?: ConversationPrivacy;
42
+ }
43
+ export interface ApiConversationMessageAccepted {
44
+ conversationId: string;
45
+ messageId: string;
46
+ status: "accepted" | "duplicate";
47
+ }
48
+ /**
49
+ * Build a durable API conversation id for one viewer + create key.
50
+ *
51
+ * Retries of POST /api/conversations with the same key must address the same
52
+ * conversation before the mailbox message id is derived.
53
+ */
54
+ export declare function createApiConversationId(args: {
55
+ actorEmail: string;
56
+ idempotencyKey: string;
57
+ }): string;
58
+ /** Stable turn id for one API mailbox message (matches getTurnUserMessage). */
59
+ export declare function apiTurnIdForMessage(messageId: string): string;
60
+ /** Rebuild the dashboard actor from durable conversation identity. */
61
+ export declare function webActorFromEmail(email: string, profile?: {
62
+ fullName?: string;
63
+ userName?: string;
64
+ }): WebActor;
65
+ /** Build one API mailbox entry with conversation-only publish. */
66
+ export declare function buildApiTurnInboundMessage(args: {
67
+ actor: WebActor;
68
+ conversationId: string;
69
+ createdAtMs?: number;
70
+ /** Existing conversation destination; required when continuing a provider root. */
71
+ destination?: Destination;
72
+ message: string;
73
+ messageId: string;
74
+ nowMs?: number;
75
+ }): InboundMessage;
76
+ /** Create a dashboard root conversation and enqueue its first message. */
77
+ export declare function createAndEnqueueApiConversation(input: CreateApiConversationInput, options: EnqueueOptions): Promise<ApiConversationMessageAccepted>;
78
+ /** Append one API message to an existing conversation and wake the worker. */
79
+ export declare function appendAndEnqueueApiConversationMessage(input: AppendApiConversationMessageInput, options: EnqueueOptions): Promise<ApiConversationMessageAccepted>;
80
+ /**
81
+ * Resolve API turn work from mailbox metadata or an active API turn checkpoint.
82
+ *
83
+ * Empty resume wakes after yield carry no mailbox rows; match agent-invocation
84
+ * and look up durable active turn state instead of falling through to Slack.
85
+ */
86
+ export declare function resolveApiTurnWork(context: ConversationWorkerContext): Promise<{
87
+ kind: "mailbox";
88
+ batch: Array<{
89
+ message: InboundMessage;
90
+ metadata: ApiTurnMailboxMetadata;
91
+ }>;
92
+ } | {
93
+ kind: "resume";
94
+ turnId: string;
95
+ } | undefined>;
96
+ /** True when this leased attempt is API-authored root work. */
97
+ export declare function isApiTurnWork(context: ConversationWorkerContext): Promise<boolean>;
98
+ /** Build the mailbox consumer for API-authored root turns. */
99
+ export declare function createApiTurnWorker(options: {
100
+ agentRunner: AgentRunner;
101
+ turnLifecycle?: ConversationTurnLifecycle;
102
+ }): (context: ConversationWorkerContext) => Promise<ConversationWorkerResult>;
103
+ /** Route API turn work before falling through to other consumers. */
104
+ export declare function routeApiTurnWork(options: {
105
+ apiTurnWorker: (context: ConversationWorkerContext) => Promise<ConversationWorkerResult>;
106
+ fallbackWorker: (context: ConversationWorkerContext) => Promise<ConversationWorkerResult>;
107
+ }): (context: ConversationWorkerContext) => Promise<ConversationWorkerResult>;
108
+ export {};
@@ -14,7 +14,7 @@ export interface JuniorRuntimeServices {
14
14
  export interface JuniorRuntimeServiceOverrides {
15
15
  conversationMemory?: Partial<ConversationMemoryDeps>;
16
16
  contextCompactor?: Partial<ContextCompactorDeps>;
17
- replyExecutor?: Partial<Omit<ReplyExecutorServices, "generateThreadTitle">>;
17
+ replyExecutor?: Partial<ReplyExecutorServices>;
18
18
  subscribedReplyPolicy?: Partial<SubscribedReplyPolicyDeps>;
19
19
  sandbox?: {
20
20
  tracePropagation?: SandboxEgressTracePropagationConfig;
@@ -31,6 +31,12 @@ export declare const agentHistoryItemSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
31
31
  fullName: z.ZodOptional<z.ZodString>;
32
32
  userId: z.ZodString;
33
33
  userName: z.ZodOptional<z.ZodString>;
34
+ }, z.core.$strict>, z.ZodObject<{
35
+ platform: z.ZodLiteral<"web">;
36
+ email: z.ZodOptional<z.ZodString>;
37
+ fullName: z.ZodOptional<z.ZodString>;
38
+ userId: z.ZodString;
39
+ userName: z.ZodOptional<z.ZodString>;
34
40
  }, z.core.$strict>, z.ZodObject<{
35
41
  platform: z.ZodLiteral<"system">;
36
42
  name: z.ZodString;
@@ -73,6 +79,12 @@ export declare const historyReplacementSchema: z.ZodObject<{
73
79
  fullName: z.ZodOptional<z.ZodString>;
74
80
  userId: z.ZodString;
75
81
  userName: z.ZodOptional<z.ZodString>;
82
+ }, z.core.$strict>, z.ZodObject<{
83
+ platform: z.ZodLiteral<"web">;
84
+ email: z.ZodOptional<z.ZodString>;
85
+ fullName: z.ZodOptional<z.ZodString>;
86
+ userId: z.ZodString;
87
+ userName: z.ZodOptional<z.ZodString>;
76
88
  }, z.core.$strict>, z.ZodObject<{
77
89
  platform: z.ZodLiteral<"system">;
78
90
  name: z.ZodString;
@@ -121,6 +133,12 @@ export declare const historyReplacementSchema: z.ZodObject<{
121
133
  fullName: z.ZodOptional<z.ZodString>;
122
134
  userId: z.ZodString;
123
135
  userName: z.ZodOptional<z.ZodString>;
136
+ }, z.core.$strict>, z.ZodObject<{
137
+ platform: z.ZodLiteral<"web">;
138
+ email: z.ZodOptional<z.ZodString>;
139
+ fullName: z.ZodOptional<z.ZodString>;
140
+ userId: z.ZodString;
141
+ userName: z.ZodOptional<z.ZodString>;
124
142
  }, z.core.$strict>, z.ZodObject<{
125
143
  platform: z.ZodLiteral<"system">;
126
144
  name: z.ZodString;
@@ -192,6 +210,12 @@ export declare const conversationEventDataSchema: z.ZodUnion<readonly [z.ZodUnio
192
210
  fullName: z.ZodOptional<z.ZodString>;
193
211
  userId: z.ZodString;
194
212
  userName: z.ZodOptional<z.ZodString>;
213
+ }, z.core.$strict>, z.ZodObject<{
214
+ platform: z.ZodLiteral<"web">;
215
+ email: z.ZodOptional<z.ZodString>;
216
+ fullName: z.ZodOptional<z.ZodString>;
217
+ userId: z.ZodString;
218
+ userName: z.ZodOptional<z.ZodString>;
195
219
  }, z.core.$strict>, z.ZodObject<{
196
220
  platform: z.ZodLiteral<"system">;
197
221
  name: z.ZodString;
@@ -357,6 +381,12 @@ export declare const conversationEventDataSchema: z.ZodUnion<readonly [z.ZodUnio
357
381
  fullName: z.ZodOptional<z.ZodString>;
358
382
  userId: z.ZodString;
359
383
  userName: z.ZodOptional<z.ZodString>;
384
+ }, z.core.$strict>, z.ZodObject<{
385
+ platform: z.ZodLiteral<"web">;
386
+ email: z.ZodOptional<z.ZodString>;
387
+ fullName: z.ZodOptional<z.ZodString>;
388
+ userId: z.ZodString;
389
+ userName: z.ZodOptional<z.ZodString>;
360
390
  }, z.core.$strict>, z.ZodObject<{
361
391
  platform: z.ZodLiteral<"system">;
362
392
  name: z.ZodString;
@@ -405,6 +435,12 @@ export declare const conversationEventDataSchema: z.ZodUnion<readonly [z.ZodUnio
405
435
  fullName: z.ZodOptional<z.ZodString>;
406
436
  userId: z.ZodString;
407
437
  userName: z.ZodOptional<z.ZodString>;
438
+ }, z.core.$strict>, z.ZodObject<{
439
+ platform: z.ZodLiteral<"web">;
440
+ email: z.ZodOptional<z.ZodString>;
441
+ fullName: z.ZodOptional<z.ZodString>;
442
+ userId: z.ZodString;
443
+ userName: z.ZodOptional<z.ZodString>;
408
444
  }, z.core.$strict>, z.ZodObject<{
409
445
  platform: z.ZodLiteral<"system">;
410
446
  name: z.ZodString;
@@ -475,6 +511,12 @@ export declare const conversationEventSchema: z.ZodUnion<readonly [z.ZodObject<{
475
511
  fullName: z.ZodOptional<z.ZodString>;
476
512
  userId: z.ZodString;
477
513
  userName: z.ZodOptional<z.ZodString>;
514
+ }, z.core.$strict>, z.ZodObject<{
515
+ platform: z.ZodLiteral<"web">;
516
+ email: z.ZodOptional<z.ZodString>;
517
+ fullName: z.ZodOptional<z.ZodString>;
518
+ userId: z.ZodString;
519
+ userName: z.ZodOptional<z.ZodString>;
478
520
  }, z.core.$strict>, z.ZodObject<{
479
521
  platform: z.ZodLiteral<"system">;
480
522
  name: z.ZodString;
@@ -640,6 +682,12 @@ export declare const conversationEventSchema: z.ZodUnion<readonly [z.ZodObject<{
640
682
  fullName: z.ZodOptional<z.ZodString>;
641
683
  userId: z.ZodString;
642
684
  userName: z.ZodOptional<z.ZodString>;
685
+ }, z.core.$strict>, z.ZodObject<{
686
+ platform: z.ZodLiteral<"web">;
687
+ email: z.ZodOptional<z.ZodString>;
688
+ fullName: z.ZodOptional<z.ZodString>;
689
+ userId: z.ZodString;
690
+ userName: z.ZodOptional<z.ZodString>;
643
691
  }, z.core.$strict>, z.ZodObject<{
644
692
  platform: z.ZodLiteral<"system">;
645
693
  name: z.ZodString;
@@ -688,6 +736,12 @@ export declare const conversationEventSchema: z.ZodUnion<readonly [z.ZodObject<{
688
736
  fullName: z.ZodOptional<z.ZodString>;
689
737
  userId: z.ZodString;
690
738
  userName: z.ZodOptional<z.ZodString>;
739
+ }, z.core.$strict>, z.ZodObject<{
740
+ platform: z.ZodLiteral<"web">;
741
+ email: z.ZodOptional<z.ZodString>;
742
+ fullName: z.ZodOptional<z.ZodString>;
743
+ userId: z.ZodString;
744
+ userName: z.ZodOptional<z.ZodString>;
691
745
  }, z.core.$strict>, z.ZodObject<{
692
746
  platform: z.ZodLiteral<"system">;
693
747
  name: z.ZodString;
@@ -781,6 +835,12 @@ export declare const newConversationEventSchema: z.ZodObject<{
781
835
  fullName: z.ZodOptional<z.ZodString>;
782
836
  userId: z.ZodString;
783
837
  userName: z.ZodOptional<z.ZodString>;
838
+ }, z.core.$strict>, z.ZodObject<{
839
+ platform: z.ZodLiteral<"web">;
840
+ email: z.ZodOptional<z.ZodString>;
841
+ fullName: z.ZodOptional<z.ZodString>;
842
+ userId: z.ZodString;
843
+ userName: z.ZodOptional<z.ZodString>;
784
844
  }, z.core.$strict>, z.ZodObject<{
785
845
  platform: z.ZodLiteral<"system">;
786
846
  name: z.ZodString;
@@ -21,6 +21,12 @@ export declare const conversationMessageProvenanceSchema: z.ZodObject<{
21
21
  fullName: z.ZodOptional<z.ZodString>;
22
22
  userId: z.ZodString;
23
23
  userName: z.ZodOptional<z.ZodString>;
24
+ }, z.core.$strict>, z.ZodObject<{
25
+ platform: z.ZodLiteral<"web">;
26
+ email: z.ZodOptional<z.ZodString>;
27
+ fullName: z.ZodOptional<z.ZodString>;
28
+ userId: z.ZodString;
29
+ userName: z.ZodOptional<z.ZodString>;
24
30
  }, z.core.$strict>, z.ZodObject<{
25
31
  platform: z.ZodLiteral<"system">;
26
32
  name: z.ZodString;
@@ -0,0 +1,19 @@
1
+ import type { StoredSlackActor } from "@/chat/actor";
2
+ import type { IdentityUpsert } from "@/chat/identities/identity";
3
+ import type { Conversation, ConversationSource } from "../store";
4
+ import type { juniorIdentities } from "@/db/schema";
5
+ type IdentityRow = typeof juniorIdentities.$inferSelect;
6
+ /** Build a durable identity observation from a stored conversation actor. */
7
+ export declare function identityFromActor(actor: StoredSlackActor | undefined): IdentityUpsert | undefined;
8
+ /** Build a system identity when a conversation has no user actor. */
9
+ export declare function systemIdentityFromSource(source: ConversationSource | undefined): IdentityUpsert | undefined;
10
+ /** Prefer the user actor identity, else a source-derived system identity. */
11
+ export declare function actorIdentityForConversation(conversation: Conversation): IdentityUpsert | undefined;
12
+ /**
13
+ * Reconstruct a stored actor with the linked user name and identity-scoped
14
+ * provider fields.
15
+ */
16
+ export declare function actorFromIdentityRow(identity: IdentityRow | null, userDisplayName: string | null): StoredSlackActor | undefined;
17
+ /** Merge later actor observations without replacing a durable Slack subject. */
18
+ export declare function mergeActor(current: StoredSlackActor | undefined, next: StoredSlackActor | undefined): StoredSlackActor | undefined;
19
+ export {};
@@ -4,7 +4,7 @@ import type { StoredSlackActor } from "@/chat/actor";
4
4
  import type { Location } from "@/chat/conversations/location";
5
5
  import type { SessionSource } from "@/chat/source";
6
6
  import type { AgentTurnUsage } from "@/chat/usage";
7
- export type ConversationSource = "api" | "internal" | "local" | "plugin" | "resource_event" | "scheduler" | "slack";
7
+ export type ConversationSource = "api" | "internal" | "local" | "plugin" | "resource_event" | "scheduler" | "slack" | "web";
8
8
  export type ConversationStatus = "paused" | "failed" | "idle" | "pending" | "running";
9
9
  export interface ConversationExecution {
10
10
  lastCheckpointAtMs?: number;
@@ -21,9 +21,9 @@ declare const subscriptionSchema: z.ZodObject<{
21
21
  identifier: z.ZodString;
22
22
  resourceType: z.ZodString;
23
23
  status: z.ZodEnum<{
24
- cancelled: "cancelled";
25
24
  completed: "completed";
26
25
  active: "active";
26
+ cancelled: "cancelled";
27
27
  }>;
28
28
  updatedAtMs: z.ZodNumber;
29
29
  }, z.core.$strict>;
@@ -12,7 +12,6 @@ import { type Destination } from "@sentry/junior-plugin-api";
12
12
  import type { AgentRunner } from "@/chat/runtime/agent-runner";
13
13
  import type { PreparedTurnState } from "@/chat/runtime/turn-preparation";
14
14
  import { type PrepareTurnStateInput, type QueuedTurnMessage, type TurnToolInvocation } from "@/chat/runtime/turn-input";
15
- import { type ConversationMemoryService } from "@/chat/services/conversation-memory";
16
15
  import type { ContextCompactor } from "@/chat/services/context-compaction";
17
16
  import { lookupSlackUser } from "@/chat/slack/user";
18
17
  import type { PausedTurnRequest } from "@/chat/task-execution/turn-wake";
@@ -21,7 +20,6 @@ import type { DispatchTurnContext, DispatchTurnResult } from "@/chat/agent-dispa
21
20
  export interface ReplyExecutorServices {
22
21
  agentRunner: AgentRunner;
23
22
  contextCompactor: ContextCompactor;
24
- generateThreadTitle: ConversationMemoryService["generateThreadTitle"];
25
23
  getPausedTurnRequest: (args: {
26
24
  conversationId: string;
27
25
  turnId: string;
@@ -52,7 +50,6 @@ interface ReplyExecutorDeps {
52
50
  prepareTurnState: (args: PrepareTurnStateInput) => Promise<PreparedTurnState>;
53
51
  services: ReplyExecutorServices;
54
52
  }
55
- /** Build the shared reply handler that prepares, advances, and commits a turn. */
56
53
  export declare function createReplyToThread(deps: ReplyExecutorDeps): (thread: Thread, message: Message, options: {
57
54
  beforeFirstResponsePost?: () => Promise<void>;
58
55
  conversationId?: string;
@@ -66,6 +63,7 @@ export declare function createReplyToThread(deps: ReplyExecutorDeps): (thread: T
66
63
  onTurnStatePersisted?: () => Promise<void>;
67
64
  preparedState?: PreparedTurnState;
68
65
  queuedMessages?: QueuedTurnMessage[];
66
+ publishExternally?: boolean;
69
67
  execution?: DispatchTurnContext;
70
68
  skipBackfill?: boolean;
71
69
  drainSteeringMessages?: (accept: (messages: QueuedTurnMessage[]) => Promise<void>, context?: {
@@ -40,6 +40,7 @@ interface SteeringDrainContext {
40
40
  export interface SlackTurnOptions extends ReplyHooks {
41
41
  conversationId?: string;
42
42
  destination: Destination;
43
+ publishExternally?: boolean;
43
44
  }
44
45
  export interface SlackTurnRuntimeDependencies<TPreparedState> {
45
46
  assistantUserName: string;
@@ -103,6 +104,7 @@ export interface SlackTurnRuntimeDependencies<TPreparedState> {
103
104
  onTurnStatePersisted?: () => Promise<void>;
104
105
  preparedState?: TPreparedState;
105
106
  queuedMessages?: QueuedTurnMessage[];
107
+ publishExternally?: boolean;
106
108
  drainSteeringMessages?: (accept: (messages: QueuedTurnMessage[]) => Promise<void>, context?: SteeringDrainContext) => Promise<QueuedTurnMessage[]>;
107
109
  shouldYield?: () => boolean;
108
110
  }) => Promise<void>;
@@ -119,6 +121,5 @@ export interface SlackTurnRuntime<_TPreparedState, TAssistantEvent extends Assis
119
121
  handleNewMention: (thread: Thread, message: Message, hooks: SlackTurnOptions) => Promise<void>;
120
122
  handleSubscribedMessage: (thread: Thread, message: Message, hooks: SlackTurnOptions) => Promise<void>;
121
123
  }
122
- /** Build the Slack event runtime that routes mentions and subscribed messages. */
123
124
  export declare function createSlackTurnRuntime<TPreparedState, TAssistantEvent extends AssistantLifecycleEvent = AssistantLifecycleEvent>(deps: SlackTurnRuntimeDependencies<TPreparedState>): SlackTurnRuntime<TPreparedState, TAssistantEvent>;
124
125
  export {};
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Turn state preparation.
3
+ *
4
+ * This module turns durable chat thread state plus the current Slack message
5
+ * into the state needed before agent execution. It owns conversation backfill,
6
+ * memory/context rendering, vision hydration, and configuration; it should not execute the agent or post replies.
7
+ */
8
+ import type { Message } from "chat";
1
9
  import type { ThreadConversationState } from "@/chat/state/conversation";
2
10
  import type { SandboxRef } from "@/chat/sandbox/ref";
3
11
  import type { LocationConfigurationService } from "@/chat/configuration/types";
@@ -16,6 +24,7 @@ export interface PrepareTurnStateDeps {
16
24
  hydrateConversationVisionContext: (conversation: ThreadConversationState, context: TurnContext & {
17
25
  threadTs?: string;
18
26
  }) => Promise<void>;
27
+ resolveBackfillMessageActors: (messages: Message[], destination: PrepareTurnStateInput["destination"]) => Promise<void>;
19
28
  }
20
29
  /** Build the turn-state preparer from injected conversation services. */
21
30
  export declare function createPrepareTurnState(deps: PrepareTurnStateDeps): (args: PrepareTurnStateInput) => Promise<PreparedTurnState>;
@@ -36,8 +36,8 @@ declare const compactTaskResultSchema: z.ZodObject<{
36
36
  }, z.core.$strict>;
37
37
  conversation_access: z.ZodObject<{
38
38
  audience: z.ZodEnum<{
39
- direct: "direct";
40
39
  channel: "channel";
40
+ direct: "direct";
41
41
  group: "group";
42
42
  }>;
43
43
  visibility: z.ZodEnum<{
@@ -81,8 +81,8 @@ export declare const scheduleTaskToolResultSchema: z.ZodObject<{
81
81
  }, z.core.$strict>;
82
82
  conversation_access: z.ZodObject<{
83
83
  audience: z.ZodEnum<{
84
- direct: "direct";
85
84
  channel: "channel";
85
+ direct: "direct";
86
86
  group: "group";
87
87
  }>;
88
88
  visibility: z.ZodEnum<{
@@ -126,8 +126,8 @@ export declare const scheduleListToolResultSchema: z.ZodObject<{
126
126
  }, z.core.$strict>;
127
127
  conversation_access: z.ZodObject<{
128
128
  audience: z.ZodEnum<{
129
- direct: "direct";
130
129
  channel: "channel";
130
+ direct: "direct";
131
131
  group: "group";
132
132
  }>;
133
133
  visibility: z.ZodEnum<{
@@ -180,7 +180,7 @@ export declare function scheduleTaskToolResult(target: string, task: CompactTask
180
180
  channel_id: string;
181
181
  };
182
182
  conversation_access: {
183
- audience: "direct" | "channel" | "group";
183
+ audience: "channel" | "direct" | "group";
184
184
  visibility: "public" | "private";
185
185
  };
186
186
  credential_mode: "system" | "creator";
@@ -210,7 +210,7 @@ export declare function scheduleListToolResult(args: {
210
210
  channel_id: string;
211
211
  };
212
212
  conversation_access: {
213
- audience: "direct" | "channel" | "group";
213
+ audience: "channel" | "direct" | "group";
214
214
  visibility: "public" | "private";
215
215
  };
216
216
  credential_mode: "system" | "creator";
@@ -47,7 +47,7 @@ export declare function createSlackScheduleCreateTaskTool(context: SchedulerTool
47
47
  channel_id: string;
48
48
  };
49
49
  conversation_access: {
50
- audience: "direct" | "channel" | "group";
50
+ audience: "channel" | "direct" | "group";
51
51
  visibility: "public" | "private";
52
52
  };
53
53
  credential_mode: "system" | "creator";
@@ -77,7 +77,7 @@ export declare function createSlackScheduleCreateTaskTool(context: SchedulerTool
77
77
  channel_id: string;
78
78
  };
79
79
  conversation_access: {
80
- audience: "direct" | "channel" | "group";
80
+ audience: "channel" | "direct" | "group";
81
81
  visibility: "public" | "private";
82
82
  };
83
83
  credential_mode: "system" | "creator";
@@ -22,7 +22,7 @@ export declare function createSlackScheduleDeleteTaskTool(context: SchedulerTool
22
22
  channel_id: string;
23
23
  };
24
24
  conversation_access: {
25
- audience: "direct" | "channel" | "group";
25
+ audience: "channel" | "direct" | "group";
26
26
  visibility: "public" | "private";
27
27
  };
28
28
  credential_mode: "system" | "creator";
@@ -52,7 +52,7 @@ export declare function createSlackScheduleDeleteTaskTool(context: SchedulerTool
52
52
  channel_id: string;
53
53
  };
54
54
  conversation_access: {
55
- audience: "direct" | "channel" | "group";
55
+ audience: "channel" | "direct" | "group";
56
56
  visibility: "public" | "private";
57
57
  };
58
58
  credential_mode: "system" | "creator";