@sentry/junior 0.192.0 → 0.193.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 (77) hide show
  1. package/dist/{agent-hooks-3JY76L5X.js → agent-hooks-DWY3MZZ7.js} +11 -11
  2. package/dist/api.js +24 -24
  3. package/dist/app.js +49 -82
  4. package/dist/{catalog-runtime-5JVLWXRY.js → catalog-runtime-NAD44W5K.js} +4 -4
  5. package/dist/chat/agent/prompt.d.ts +1 -1
  6. package/dist/chat/agent-dispatch/types.d.ts +2 -1
  7. package/dist/chat/agent-dispatch/validation.d.ts +1 -1
  8. package/dist/chat/agent-invocations/types.d.ts +24 -28
  9. package/dist/chat/event-tasks/tool-support.d.ts +10 -1
  10. package/dist/chat/plugins/agent-hooks.d.ts +2 -2
  11. package/dist/chat/prompt.d.ts +4 -5
  12. package/dist/chat/services/turn-session-routing.d.ts +4 -3
  13. package/dist/chat/slack/tool-support/context.d.ts +3 -6
  14. package/dist/chat/source.d.ts +4 -6
  15. package/dist/chat/tools/delete-event-task.d.ts +1 -1
  16. package/dist/chat/tools/types.d.ts +10 -9
  17. package/dist/chat/tools/update-event-task.d.ts +1 -1
  18. package/dist/{chunk-AKR6W7VV.js → chunk-2CYWEVOP.js} +4 -4
  19. package/dist/{chunk-PYVGXGKC.js → chunk-3YZ2Q6AW.js} +2 -2
  20. package/dist/{chunk-47JFLZSF.js → chunk-42N6CDWF.js} +4 -4
  21. package/dist/{chunk-ITTEDZGY.js → chunk-4UA5C7AM.js} +32 -25
  22. package/dist/{chunk-3O2NXVGB.js → chunk-5E5SLAVD.js} +21 -21
  23. package/dist/{chunk-G4E5WIRL.js → chunk-5LEVZYXF.js} +4 -4
  24. package/dist/{chunk-IBO4YFFZ.js → chunk-5S6AQFNG.js} +1 -1
  25. package/dist/{chunk-4CCQZHD3.js → chunk-AZVDODSP.js} +11 -11
  26. package/dist/{chunk-EIYOABL4.js → chunk-BFP3ZKG6.js} +12 -8
  27. package/dist/{chunk-SSR6YBWW.js → chunk-COCVPDWX.js} +11 -7
  28. package/dist/{chunk-YE6DVM43.js → chunk-D4XQZOHB.js} +8 -8
  29. package/dist/{chunk-OBN7UEQJ.js → chunk-D5YQPCEG.js} +2 -2
  30. package/dist/{chunk-BGLMT6KP.js → chunk-DVU734PI.js} +3 -3
  31. package/dist/{chunk-FGYWKKTJ.js → chunk-DXFUYLHX.js} +1 -1
  32. package/dist/{chunk-BUTAWPUV.js → chunk-FQ5HFSFR.js} +37 -31
  33. package/dist/{chunk-YRWGJ5OO.js → chunk-GTXQHZ2O.js} +5 -5
  34. package/dist/{chunk-5V4BAUCH.js → chunk-GUKGU6R7.js} +1 -1
  35. package/dist/{chunk-MB2CTEPD.js → chunk-GUMBIDDL.js} +3 -3
  36. package/dist/{chunk-4WIA45WD.js → chunk-HMBTX5RK.js} +1 -1
  37. package/dist/{chunk-3UJSII43.js → chunk-IBXXTO3J.js} +3 -3
  38. package/dist/{chunk-LRTEMMCZ.js → chunk-IOUUS6H4.js} +1 -1
  39. package/dist/{chunk-SZ2O3CGS.js → chunk-IQCL5JGL.js} +1 -1
  40. package/dist/{chunk-7XO7PTZE.js → chunk-K47OVEO4.js} +1 -1
  41. package/dist/{chunk-6LX6KV5C.js → chunk-KWXZMHJS.js} +3 -3
  42. package/dist/{chunk-KR5F3QSP.js → chunk-LG7Q4OW4.js} +8 -8
  43. package/dist/{chunk-PXP2M32M.js → chunk-LXRTHE43.js} +6 -7
  44. package/dist/{chunk-RWBZZMW6.js → chunk-N6Q2PNSI.js} +3 -3
  45. package/dist/{chunk-EYNUOZCN.js → chunk-OICYQPKP.js} +1 -1
  46. package/dist/{chunk-4B4DQGOM.js → chunk-PYBFVK6K.js} +73 -64
  47. package/dist/{chunk-ARSUYYQG.js → chunk-QDU5MW2R.js} +1 -1
  48. package/dist/{chunk-6FCKJDKS.js → chunk-QWY4KI2V.js} +1 -1
  49. package/dist/{chunk-3ADPXQBL.js → chunk-QY2IU47O.js} +1 -1
  50. package/dist/{chunk-Z4DNJI5F.js → chunk-S5HS6WRH.js} +5 -5
  51. package/dist/{chunk-4AFSQJD6.js → chunk-THFNL3TL.js} +3 -4
  52. package/dist/{chunk-H5Q2T5VC.js → chunk-THYNA2QN.js} +1 -1
  53. package/dist/{chunk-PXUBRZBU.js → chunk-WH5VV2RW.js} +1 -1
  54. package/dist/{chunk-4Z7B5WVV.js → chunk-WJJDQLVL.js} +2 -2
  55. package/dist/{chunk-VF3EDS7P.js → chunk-ZFPEPWOO.js} +6 -6
  56. package/dist/cli/chat.js +33 -33
  57. package/dist/cli/check.js +5 -5
  58. package/dist/cli/plugins.js +12 -12
  59. package/dist/cli/snapshot-create.js +9 -9
  60. package/dist/cli/upgrade.js +6 -6
  61. package/dist/db/schema/agent-invocations.d.ts +16 -0
  62. package/dist/db/schema.d.ts +16 -0
  63. package/dist/{db-LRM6AP66.js → db-H5MDRQEY.js} +6 -6
  64. package/dist/instrumentation.js +3 -3
  65. package/dist/nitro.js +6 -6
  66. package/dist/{oauth-callback-server-BKCDVYVH.js → oauth-callback-server-IOU3NUHT.js} +29 -29
  67. package/dist/{runner-RUXGS3E6.js → runner-FZ5ZHLFG.js} +21 -21
  68. package/dist/{skills-DXP2RCJF.js → skills-AR3WD6BX.js} +5 -5
  69. package/dist/spawn-ZU6JABR7.js +42 -0
  70. package/dist/task-runner-EEGGG2PM.js +36 -0
  71. package/dist/{validation-F4KYLIF2.js → validation-VYE7TQY7.js} +5 -5
  72. package/dist/version.js +1 -1
  73. package/dist/{work-UUNMNSML.js → work-CTQFWYKE.js} +21 -21
  74. package/dist/{worker-PMIJ5NLD.js → worker-6WQU3IT5.js} +10 -10
  75. package/package.json +4 -4
  76. package/dist/spawn-HH7GH7XT.js +0 -42
  77. package/dist/task-runner-H5I7R3LJ.js +0 -36
@@ -126,6 +126,14 @@ export declare const agentInvocationSchema: z.ZodDiscriminatedUnion<[z.ZodObject
126
126
  eventType: z.ZodString;
127
127
  identifier: z.ZodString;
128
128
  namespace: z.ZodString;
129
+ }, z.core.$strict>, z.ZodObject<{
130
+ kind: z.ZodLiteral<"scheduled_task">;
131
+ }, z.core.$strict>, z.ZodObject<{
132
+ kind: z.ZodLiteral<"event_task">;
133
+ }, z.core.$strict>, z.ZodObject<{
134
+ kind: z.ZodLiteral<"plugin_dispatch">;
135
+ }, z.core.$strict>, z.ZodObject<{
136
+ kind: z.ZodLiteral<"agent_invocation">;
129
137
  }, z.core.$strict>], "kind">, unknown>;
130
138
  updatedAtMs: z.ZodNumber;
131
139
  status: z.ZodEnum<{
@@ -253,6 +261,14 @@ export declare const agentInvocationSchema: z.ZodDiscriminatedUnion<[z.ZodObject
253
261
  eventType: z.ZodString;
254
262
  identifier: z.ZodString;
255
263
  namespace: z.ZodString;
264
+ }, z.core.$strict>, z.ZodObject<{
265
+ kind: z.ZodLiteral<"scheduled_task">;
266
+ }, z.core.$strict>, z.ZodObject<{
267
+ kind: z.ZodLiteral<"event_task">;
268
+ }, z.core.$strict>, z.ZodObject<{
269
+ kind: z.ZodLiteral<"plugin_dispatch">;
270
+ }, z.core.$strict>, z.ZodObject<{
271
+ kind: z.ZodLiteral<"agent_invocation">;
256
272
  }, z.core.$strict>], "kind">, unknown>;
257
273
  updatedAtMs: z.ZodNumber;
258
274
  result: z.ZodString;
@@ -378,6 +394,14 @@ export declare const agentInvocationSchema: z.ZodDiscriminatedUnion<[z.ZodObject
378
394
  eventType: z.ZodString;
379
395
  identifier: z.ZodString;
380
396
  namespace: z.ZodString;
397
+ }, z.core.$strict>, z.ZodObject<{
398
+ kind: z.ZodLiteral<"scheduled_task">;
399
+ }, z.core.$strict>, z.ZodObject<{
400
+ kind: z.ZodLiteral<"event_task">;
401
+ }, z.core.$strict>, z.ZodObject<{
402
+ kind: z.ZodLiteral<"plugin_dispatch">;
403
+ }, z.core.$strict>, z.ZodObject<{
404
+ kind: z.ZodLiteral<"agent_invocation">;
381
405
  }, z.core.$strict>], "kind">, unknown>;
382
406
  updatedAtMs: z.ZodNumber;
383
407
  errorMessage: z.ZodString;
@@ -474,34 +498,6 @@ export declare const createAgentInvocationSchema: z.ZodObject<{
474
498
  xhigh: "xhigh";
475
499
  none: "none";
476
500
  }>>;
477
- source: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
478
- kind: z.ZodLiteral<"slack">;
479
- teamId: z.ZodString;
480
- channelId: z.ZodString;
481
- visibility: z.ZodEnum<{
482
- private: "private";
483
- public: "public";
484
- }>;
485
- messageTs: z.ZodOptional<z.ZodString>;
486
- threadTs: z.ZodOptional<z.ZodString>;
487
- }, z.core.$strict>, z.ZodObject<{
488
- kind: z.ZodLiteral<"local">;
489
- visibility: z.ZodLiteral<"private">;
490
- conversationId: z.ZodString;
491
- }, z.core.$strict>, z.ZodObject<{
492
- kind: z.ZodLiteral<"web">;
493
- visibility: z.ZodEnum<{
494
- private: "private";
495
- public: "public";
496
- }>;
497
- conversationId: z.ZodString;
498
- }, z.core.$strict>, z.ZodObject<{
499
- kind: z.ZodLiteral<"resource_event">;
500
- eventKey: z.ZodString;
501
- eventType: z.ZodString;
502
- identifier: z.ZodString;
503
- namespace: z.ZodString;
504
- }, z.core.$strict>], "kind">, unknown>;
505
501
  }, z.core.$strict>;
506
502
  export type AgentBinding = z.output<typeof agentBindingSchema>;
507
503
  export type AgentInvocation = z.output<typeof agentInvocationSchema>;
@@ -106,7 +106,16 @@ export declare function eventTaskMatchesDestination(task: EventTask, destination
106
106
  channelId: string;
107
107
  teamId: string;
108
108
  }): boolean;
109
- /** Load one task only when it belongs to this Slack channel or DM. */
109
+ /**
110
+ * Return whether the active destination may update or delete this task.
111
+ * Same-destination tasks stay local. Public tasks may be managed by id from
112
+ * another destination in the same workspace.
113
+ */
114
+ export declare function eventTaskIsWritableFrom(task: EventTask, destination: {
115
+ channelId: string;
116
+ teamId: string;
117
+ }): boolean;
118
+ /** Load one task the active destination may update or delete. */
110
119
  export declare function writableEventTask(context: ToolRuntimeContext, id: string): Promise<EventTask>;
111
120
  export declare function eventTaskTriggerAvailable(task: EventTask, catalog: ResourceEventCatalog): boolean;
112
121
  /** Project an event task into the bounded tool-result shape. */
@@ -1,4 +1,4 @@
1
- import type { PluginRoute, PluginSandbox, PluginOperationalReport, PluginRouteApp, ResourceEvent, SlackConversationLink, PluginRegistration, User } from "@sentry/junior-plugin-api";
1
+ import type { PluginRoute, PluginSandbox, PluginOperationalReport, PluginRouteApp, Platform, ResourceEvent, SlackConversationLink, PluginRegistration, User } from "@sentry/junior-plugin-api";
2
2
  import type { PluginPromptContributionContext } from "@/chat/plugins/prompt";
3
3
  import type { AnyToolDefinition } from "@/chat/tools/definition";
4
4
  import type { ToolRuntimeContext } from "@/chat/tools/types";
@@ -50,7 +50,7 @@ export declare function getPlugins(): PluginRegistration[];
50
50
  /** Apply plugin Markdown rewrites before destination delivery formatting. */
51
51
  export declare function applyPluginFormatMarkdown(text: string): string;
52
52
  /** Collect stable plugin prompt contributions for the static system prompt. */
53
- export declare function getPluginSystemPromptContributions(source: ToolRuntimeContext["source"]): Promise<PluginPromptContributionContext[]>;
53
+ export declare function getPluginSystemPromptContributions(platform: Platform): Promise<PluginPromptContributionContext[]>;
54
54
  /** Collect request-scoped plugin prompt contributions. */
55
55
  export declare function getPluginUserPromptContributions(args: {
56
56
  context: Pick<ToolRuntimeContext, "conversationId" | "locationId" | "destination" | "actor" | "resolveActorIdentity" | "source" | "userText">;
@@ -2,7 +2,7 @@ import type { SlackConversationContext } from "@/chat/slack/conversation-context
2
2
  import type { SkillMetadata } from "@/chat/skills";
3
3
  import type { ActiveMcpCatalogSummary } from "@/chat/tool-support/skill/mcp-tool-summary";
4
4
  import type { PluginPromptContributionContext } from "@/chat/plugins/prompt";
5
- import type { Destination, Source, SystemActor } from "@sentry/junior-plugin-api";
5
+ import type { Destination, Platform, Source, SystemActor } from "@sentry/junior-plugin-api";
6
6
  export declare const JUNIOR_PERSONALITY: string;
7
7
  export declare const JUNIOR_WORLD: string | null;
8
8
  interface ToolPromptContext {
@@ -10,6 +10,7 @@ interface ToolPromptContext {
10
10
  promptGuidelines?: string[];
11
11
  promptSnippet?: string;
12
12
  }
13
+ type PromptPlatform = Platform;
13
14
  /** Render plugin system prompt additions under a core-owned wrapper. */
14
15
  export declare function buildPluginSystemPromptContributions(contributions: PluginPromptContributionContext[]): string | null;
15
16
  type TurnContextPromptInput = {
@@ -36,10 +37,8 @@ type TurnContextPromptInput = {
36
37
  };
37
38
  configuration?: Record<string, unknown>;
38
39
  };
39
- /** Return byte-stable platform instructions shared by every conversation and turn. */
40
- export declare function buildSystemPrompt(params: {
41
- source: Source;
42
- }): string;
40
+ /** Return the fixed instructions shared by every Conversation and Turn. */
41
+ export declare function buildSystemPrompt(platform: PromptPlatform): string;
43
42
  /** Build volatile runtime context that belongs in the user turn, not the system prompt. */
44
43
  export declare function buildTurnContextPrompt(params: TurnContextPromptInput): string | null;
45
44
  export {};
@@ -5,18 +5,19 @@
5
5
  * parent reads through that relation. Later Turns and mailbox wakes use the
6
6
  * same Destination so tools stay consistent for the whole Conversation.
7
7
  */
8
- import type { Destination, Source } from "@sentry/junior-plugin-api";
8
+ import type { Destination } from "@sentry/junior-plugin-api";
9
9
  import type { ConversationStore } from "@/chat/conversations/store";
10
10
  import type { Location } from "@/chat/conversations/location";
11
+ import type { SessionSource } from "@/chat/source";
11
12
  export interface TurnSessionRouting {
12
13
  destination: Destination;
13
14
  location?: Location;
14
15
  /** Present when the conversation already stores a session source. */
15
- source?: Source;
16
+ source?: SessionSource;
16
17
  }
17
18
  /** Conversation data with a required Destination and Source. */
18
19
  export type RequiredTurnSessionRouting = TurnSessionRouting & {
19
- source: Source;
20
+ source: SessionSource;
20
21
  };
21
22
  /**
22
23
  * Resolve the Conversation Location, Destination, and session Source.
@@ -1,18 +1,15 @@
1
1
  import type { ToolRuntimeContext } from "@/chat/tools/types";
2
- import type { SlackDestination } from "@sentry/junior-plugin-api";
3
- import type { SlackSource } from "@sentry/junior-plugin-api";
4
2
  import type { SlackActor } from "@/chat/actor";
5
3
  import { type SlackChannelId, type SlackTeamId } from "@/chat/slack/ids";
6
4
  import { type SlackMessageTs } from "@/chat/slack/timestamp";
7
5
  export interface SlackToolContext {
8
- destination: SlackDestination;
9
- source: SlackSource;
10
6
  actor?: SlackActor;
11
7
  destinationChannelId: SlackChannelId;
8
+ locationChannelId: SlackChannelId;
9
+ messageChannelId?: SlackChannelId;
12
10
  messageTs?: SlackMessageTs;
13
- sourceChannelId: SlackChannelId;
14
11
  teamId: SlackTeamId;
15
12
  threadTs?: SlackMessageTs;
16
13
  }
17
- /** Resolve Slack-specific tool context from the active source/destination/actor. */
14
+ /** Resolve Slack tool context from the Conversation Location. */
18
15
  export declare function getSlackToolContext(context: ToolRuntimeContext): SlackToolContext | undefined;
@@ -1,5 +1,5 @@
1
1
  import { type Source } from "@sentry/junior-plugin-api";
2
- /** Source coordinates reduced to the stable locator for one conversation. */
2
+ /** Legacy provider Source fields stored on a Conversation. */
3
3
  export type SessionSource = Extract<Source, {
4
4
  kind: "web";
5
5
  }> | Extract<Source, {
@@ -8,11 +8,9 @@ export type SessionSource = Extract<Source, {
8
8
  kind: "slack";
9
9
  }>, "messageTs">;
10
10
  /**
11
- * Normalize a turn Source into the session-stable locator persisted on a
12
- * conversation. Drops per-message timestamps. Threaded Slack turns keep their
13
- * thread anchor; channel-level turns (scheduled/event dispatch) keep the
14
- * channel locator without inventing a threadTs.
11
+ * Normalize a Turn Source into legacy provider fields stored on a Conversation.
12
+ * System Sources do not contain a Conversation Location.
15
13
  */
16
14
  export declare function normalizeSessionSource(value: Source | undefined): SessionSource | undefined;
17
- /** Parse a serialized Source into the stable locator stored on a conversation. */
15
+ /** Parse a serialized Source into legacy provider fields stored on a Conversation. */
18
16
  export declare function parseSessionSource(value: unknown): SessionSource | undefined;
@@ -1,6 +1,6 @@
1
1
  import type { ResourceEventCatalog } from "@/chat/resource-events/catalog";
2
2
  import type { ToolRuntimeContext } from "@/chat/tools/types";
3
- /** Create the core tool that deletes an event task in this destination. */
3
+ /** Create the core tool that deletes an event task. */
4
4
  export declare function createDeleteEventTaskTool(context: ToolRuntimeContext, catalog: ResourceEventCatalog): Omit<import("./definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
5
5
  inputSchema: import("./definition").JsonSchemaObject;
6
6
  outputSchema: import("./definition").JsonSchemaObject;
@@ -1,5 +1,5 @@
1
1
  import type { FileUpload } from "chat";
2
- import type { WebSource, ResourceEventSource, Destination, Identity, LocalDestination, LocalSource, PluginEgress, SlackDestination, SlackSource, Source, SystemActor, User } from "@sentry/junior-plugin-api";
2
+ import type { AgentInvocationSource, EventTaskSource, WebSource, ResourceEventSource, Destination, Identity, Location, LocalDestination, LocalSource, PluginDispatchSource, PluginEgress, SlackDestination, SlackSource, Source, ScheduledTaskSource, User } from "@sentry/junior-plugin-api";
3
3
  import type { McpToolManager } from "@/chat/mcp/tool-manager";
4
4
  import type { SandboxWorkspace } from "@/chat/sandbox/workspace";
5
5
  import type { AgentTurnSurface } from "@/chat/task-execution/checkpoint";
@@ -12,6 +12,7 @@ import type { GeneratedArtifactFileRef } from "@/chat/tools/sandbox/file-uploads
12
12
  import type { SpawnAgent } from "@/chat/agent/types";
13
13
  import type { AttachmentStorage } from "@/chat/attachments/storage";
14
14
  import type { Workspace } from "@/chat/workspaces/types";
15
+ import type { ConversationPrivacy } from "@/chat/conversation-privacy";
15
16
  interface HandoffControl {
16
17
  /** Non-empty catalog of configured targets. */
17
18
  profiles: readonly [ModelProfile, ...ModelProfile[]];
@@ -65,7 +66,11 @@ interface BaseToolRuntimeContext {
65
66
  */
66
67
  conversationId: string;
67
68
  /** Location associated with this Conversation. */
69
+ location?: Location;
70
+ /** Legacy Location identity used by memory and plugin contexts. */
68
71
  locationId?: string;
72
+ /** Stored Conversation visibility used by tools. */
73
+ conversationPrivacy?: ConversationPrivacy;
69
74
  /** Runtime-owned default outbound destination for this invocation. */
70
75
  destination: Destination;
71
76
  actor?: Actor;
@@ -99,24 +104,20 @@ interface LocalToolRuntimeContext extends BaseToolRuntimeContext {
99
104
  destination: LocalDestination;
100
105
  actor?: LocalActor;
101
106
  source: LocalSource;
102
- slack?: never;
103
107
  slackActionToken?: never;
104
108
  }
105
109
  interface WebToolRuntimeContext extends BaseToolRuntimeContext {
106
110
  destination: Destination;
107
111
  actor?: WebActor;
108
112
  source: WebSource;
109
- slack?: never;
110
113
  slackActionToken?: never;
111
114
  }
112
- interface ResourceEventToolRuntimeContext extends BaseToolRuntimeContext {
115
+ export type ToolRuntimeContext = LocalToolRuntimeContext | SlackToolRuntimeContext | WebToolRuntimeContext | (BaseToolRuntimeContext & {
113
116
  destination: Destination;
114
- actor?: SystemActor;
115
- source: ResourceEventSource;
116
- slack?: never;
117
+ actor?: Actor;
118
+ source: AgentInvocationSource | EventTaskSource | PluginDispatchSource | ResourceEventSource | ScheduledTaskSource;
117
119
  slackActionToken?: never;
118
- }
119
- export type ToolRuntimeContext = LocalToolRuntimeContext | ResourceEventToolRuntimeContext | SlackToolRuntimeContext | WebToolRuntimeContext;
120
+ });
120
121
  export interface ToolState {
121
122
  getOperationResult: <T>(operationKey: string) => T | undefined;
122
123
  setOperationResult: (operationKey: string, result: unknown) => void;
@@ -1,6 +1,6 @@
1
1
  import { type ResourceEventCatalog } from "@/chat/resource-events/catalog";
2
2
  import type { ToolRuntimeContext } from "@/chat/tools/types";
3
- /** Create the core tool that updates an event task in this destination. */
3
+ /** Create the core tool that updates an event task. */
4
4
  export declare function createUpdateEventTaskTool(context: ToolRuntimeContext, catalog: ResourceEventCatalog): Omit<import("./definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
5
5
  inputSchema: import("./definition").JsonSchemaObject;
6
6
  outputSchema: import("./definition").JsonSchemaObject;
@@ -8,7 +8,7 @@ import {
8
8
  juniorConversations,
9
9
  juniorIdentities,
10
10
  juniorUsers
11
- } from "./chunk-IBO4YFFZ.js";
11
+ } from "./chunk-5S6AQFNG.js";
12
12
  import {
13
13
  conversationEventDataSchema,
14
14
  decodeStoredConversationEvent,
@@ -20,7 +20,7 @@ import {
20
20
  } from "./chunk-VFUK3X5B.js";
21
21
  import {
22
22
  getChatConfig
23
- } from "./chunk-4Z7B5WVV.js";
23
+ } from "./chunk-WJJDQLVL.js";
24
24
  import {
25
25
  parseActorUserId,
26
26
  parseSlackChannelReferenceId,
@@ -28,7 +28,7 @@ import {
28
28
  } from "./chunk-N7TMSOZH.js";
29
29
  import {
30
30
  normalizeIdentityEmail
31
- } from "./chunk-3ADPXQBL.js";
31
+ } from "./chunk-QY2IU47O.js";
32
32
 
33
33
  // src/chat/conversations/sql/store.ts
34
34
  import { randomUUID as randomUUID2 } from "crypto";
@@ -271,7 +271,7 @@ function normalizeSessionSource(value) {
271
271
  conversationId: value.conversationId
272
272
  };
273
273
  }
274
- if (value.kind === "resource_event") {
274
+ if (value.kind === "resource_event" || value.kind === "scheduled_task" || value.kind === "event_task" || value.kind === "plugin_dispatch" || value.kind === "agent_invocation") {
275
275
  return void 0;
276
276
  }
277
277
  const threadTs = value.threadTs?.trim();
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-FGYWKKTJ.js";
3
+ } from "./chunk-DXFUYLHX.js";
4
4
  import {
5
5
  skillRoots
6
6
  } from "./chunk-TXKUKMVO.js";
7
7
  import {
8
8
  logWarn
9
- } from "./chunk-3ADPXQBL.js";
9
+ } from "./chunk-QY2IU47O.js";
10
10
 
11
11
  // src/chat/skills.ts
12
12
  import fs from "fs/promises";
@@ -19,23 +19,23 @@ import {
19
19
  releaseConversationWork,
20
20
  requestAnotherSlice,
21
21
  startConversationWork
22
- } from "./chunk-G4E5WIRL.js";
22
+ } from "./chunk-5LEVZYXF.js";
23
23
  import {
24
24
  getTurnRequestDeadline
25
- } from "./chunk-SZ2O3CGS.js";
25
+ } from "./chunk-IQCL5JGL.js";
26
26
  import {
27
27
  ConversationQueueMessageRejectedError
28
28
  } from "./chunk-JAL3CH4G.js";
29
29
  import {
30
30
  getChatConfig,
31
31
  isProviderRetryError
32
- } from "./chunk-4Z7B5WVV.js";
32
+ } from "./chunk-WJJDQLVL.js";
33
33
  import {
34
34
  logException,
35
35
  logInfo,
36
36
  logWarn,
37
37
  withLogContext
38
- } from "./chunk-3ADPXQBL.js";
38
+ } from "./chunk-QY2IU47O.js";
39
39
 
40
40
  // src/chat/task-execution/worker.ts
41
41
  var CONVERSATION_WORK_DEFER_DELAY_MS = 15e3;
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  coerceThreadConversationState,
3
3
  getPersistedThreadState
4
- } from "./chunk-Z4DNJI5F.js";
4
+ } from "./chunk-S5HS6WRH.js";
5
5
  import {
6
6
  recordTaskExecution
7
- } from "./chunk-MB2CTEPD.js";
7
+ } from "./chunk-GUMBIDDL.js";
8
8
  import {
9
9
  pluginTaskId,
10
10
  pluginTaskParamsSchema,
11
11
  sendVercelPluginTask
12
- } from "./chunk-RWBZZMW6.js";
12
+ } from "./chunk-N6Q2PNSI.js";
13
13
  import {
14
14
  getPiMessageRole,
15
15
  getTurnRecord,
@@ -19,7 +19,7 @@ import {
19
19
  isToolResultMessage,
20
20
  normalizeToolNameFromResult,
21
21
  stripRuntimeTurnContext
22
- } from "./chunk-VF3EDS7P.js";
22
+ } from "./chunk-ZFPEPWOO.js";
23
23
  import {
24
24
  createPluginConversationEvents,
25
25
  createPluginEmbedder,
@@ -28,17 +28,17 @@ import {
28
28
  createPluginState,
29
29
  getPlugins,
30
30
  readActorIdentity
31
- } from "./chunk-BUTAWPUV.js";
31
+ } from "./chunk-FQ5HFSFR.js";
32
32
  import {
33
33
  JUNIOR_THREAD_STATE_TTL_MS
34
34
  } from "./chunk-3Y47VMHV.js";
35
35
  import {
36
36
  getConversationStore,
37
37
  getDb
38
- } from "./chunk-AKR6W7VV.js";
38
+ } from "./chunk-2CYWEVOP.js";
39
39
  import {
40
40
  getStateAdapter
41
- } from "./chunk-LRTEMMCZ.js";
41
+ } from "./chunk-IOUUS6H4.js";
42
42
  import {
43
43
  sameActorIdentity
44
44
  } from "./chunk-GFBR4S3Q.js";
@@ -84,7 +84,7 @@ function slackSourceForDestination(args) {
84
84
  };
85
85
  }
86
86
  async function resolveConversationRouting(args) {
87
- const conversationStore = args.conversationStore ?? (await import("./db-LRM6AP66.js")).getConversationStore();
87
+ const conversationStore = args.conversationStore ?? (await import("./db-H5MDRQEY.js")).getConversationStore();
88
88
  const chain = await loadConversationChain(
89
89
  args.conversationId,
90
90
  conversationStore
@@ -579,14 +579,14 @@ function turnMessagesWithProvenance(record) {
579
579
  }
580
580
  return paired;
581
581
  }
582
- function slackContextAuthor(source, message) {
582
+ function slackContextAuthor(location, message) {
583
583
  const userId = message.author?.userId?.trim();
584
584
  if (!userId) {
585
585
  return void 0;
586
586
  }
587
587
  return {
588
588
  platform: "slack",
589
- teamId: source.teamId,
589
+ teamId: location.teamId,
590
590
  userId,
591
591
  ...message.author?.userName ? { userName: message.author.userName } : void 0,
592
592
  ...message.author?.fullName ? { fullName: message.author.fullName } : void 0
@@ -610,17 +610,9 @@ function messageExistedAtRunCompletion(message, completedAtMs) {
610
610
  const messageTimestampMs = conversationMessageTimestampMs(message);
611
611
  return messageTimestampMs !== void 0 && messageTimestampMs <= completedAtMs;
612
612
  }
613
- async function loadConversationContextTranscriptEntries(record, source, runActor) {
614
- switch (source.kind) {
615
- case "slack":
616
- if (source.visibility === "private") {
617
- return [];
618
- }
619
- break;
620
- case "web":
621
- case "local":
622
- case "resource_event":
623
- return [];
613
+ async function loadConversationContextTranscriptEntries(record, location, visibility, runActor) {
614
+ if (location?.provider !== "slack" || visibility !== "public") {
615
+ return [];
624
616
  }
625
617
  const state = await getPersistedThreadState(record.conversationId);
626
618
  const conversation = coerceThreadConversationState(state);
@@ -640,7 +632,7 @@ async function loadConversationContextTranscriptEntries(record, source, runActor
640
632
  if (!text) {
641
633
  continue;
642
634
  }
643
- const author = slackContextAuthor(source, message);
635
+ const author = slackContextAuthor(location, message);
644
636
  entries.push({
645
637
  type: "message",
646
638
  role: "user",
@@ -678,7 +670,21 @@ async function loadPluginRun(params) {
678
670
  if (record.state !== "completed") {
679
671
  throw new Error("Completed plugin task session record is not completed");
680
672
  }
681
- const routing = await resolveTurnSessionRouting({
673
+ const conversationStore = getConversationStore();
674
+ const routing = await resolveConversationRouting({
675
+ conversationId: params.conversationId,
676
+ conversationStore
677
+ });
678
+ if (!routing) {
679
+ throw new Error(
680
+ `Conversation ${params.conversationId} is missing durable routing metadata`
681
+ );
682
+ }
683
+ const source = record.source ?? routing.source;
684
+ if (!source) {
685
+ throw new Error("Completed plugin task session record is missing Source");
686
+ }
687
+ const conversation = await conversationStore.get({
682
688
  conversationId: params.conversationId
683
689
  });
684
690
  const runActor = record.actor ?? record.actors[0] ?? (record.dispatchId ? (await getDispatchRecord(record.dispatchId))?.actor : void 0);
@@ -691,7 +697,8 @@ async function loadPluginRun(params) {
691
697
  );
692
698
  const contextEntries = (await loadConversationContextTranscriptEntries(
693
699
  record,
694
- routing.source,
700
+ conversation?.location,
701
+ conversation?.visibility,
695
702
  runActor
696
703
  )).filter(
697
704
  (entry) => entry.type !== "message" || !runMessageTexts.has(entry.text)
@@ -707,7 +714,7 @@ async function loadPluginRun(params) {
707
714
  actors: record.actors,
708
715
  ...runActor ? { actor: runActor } : void 0,
709
716
  runId: record.turnId,
710
- source: routing.source,
717
+ source,
711
718
  transcript: [...contextEntries, ...runEntries]
712
719
  });
713
720
  }
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  AgentRunError,
6
6
  executeTurn
7
- } from "./chunk-BGLMT6KP.js";
7
+ } from "./chunk-DVU734PI.js";
8
8
  import {
9
9
  buildDeliveredTurnStatePatch,
10
10
  finalizeFailedTurnReplyWithEvent,
@@ -15,14 +15,14 @@ import {
15
15
  getTurnUserSlackMessageTs,
16
16
  persistAuthPauseTurnState,
17
17
  requireTurnFailureEventId
18
- } from "./chunk-YRWGJ5OO.js";
18
+ } from "./chunk-GTXQHZ2O.js";
19
19
  import {
20
20
  resolveTurnSessionRouting,
21
21
  scheduleSessionCompletedPluginTasks
22
- } from "./chunk-ITTEDZGY.js";
22
+ } from "./chunk-4UA5C7AM.js";
23
23
  import {
24
24
  getTurnLifecycle
25
- } from "./chunk-PXUBRZBU.js";
25
+ } from "./chunk-WH5VV2RW.js";
26
26
  import {
27
27
  coerceThreadConversationState,
28
28
  configValueSchema,
@@ -30,11 +30,11 @@ import {
30
30
  getPersistedSandboxState,
31
31
  getPersistedThreadState,
32
32
  persistThreadStateById
33
- } from "./chunk-Z4DNJI5F.js";
33
+ } from "./chunk-S5HS6WRH.js";
34
34
  import {
35
35
  buildSentryConversationUrl,
36
36
  deleteWebAuthorization
37
- } from "./chunk-H5Q2T5VC.js";
37
+ } from "./chunk-THYNA2QN.js";
38
38
  import {
39
39
  createUserTokenStore,
40
40
  deleteMcpAuthSession,
@@ -45,7 +45,7 @@ import {
45
45
  lookupSlackUserProfile,
46
46
  putMcpStoredOAuthCredentials,
47
47
  resolvePluginOAuthAccount
48
- } from "./chunk-YE6DVM43.js";
48
+ } from "./chunk-D4XQZOHB.js";
49
49
  import {
50
50
  RetryableDeliveryError,
51
51
  addReactionToMessage,
@@ -59,7 +59,7 @@ import {
59
59
  removeReactionFromMessage,
60
60
  resolveBaseUrl,
61
61
  truncateStatusText
62
- } from "./chunk-SSR6YBWW.js";
62
+ } from "./chunk-COCVPDWX.js";
63
63
  import {
64
64
  CooperativeTurnYieldError,
65
65
  clearPendingAuth,
@@ -68,7 +68,7 @@ import {
68
68
  isCooperativeTurnYieldError,
69
69
  isPendingAuthLatestRequest,
70
70
  markTurnFailed
71
- } from "./chunk-7XO7PTZE.js";
71
+ } from "./chunk-K47OVEO4.js";
72
72
  import {
73
73
  TurnSliceLimitExceededError,
74
74
  abandonTurnRecord,
@@ -88,20 +88,20 @@ import {
88
88
  recordTurnSummary,
89
89
  saveTurnCheckpoint,
90
90
  turnHasReply
91
- } from "./chunk-VF3EDS7P.js";
91
+ } from "./chunk-ZFPEPWOO.js";
92
92
  import {
93
93
  parseSlackThreadId,
94
94
  readSlackRawMessageContext,
95
95
  resolveSlackChannelIdFromMessage,
96
96
  resolveSlackChannelIdFromThreadId
97
- } from "./chunk-4WIA45WD.js";
97
+ } from "./chunk-HMBTX5RK.js";
98
98
  import {
99
99
  ensureConversationWake,
100
100
  requestConversationWork
101
- } from "./chunk-G4E5WIRL.js";
101
+ } from "./chunk-5LEVZYXF.js";
102
102
  import {
103
103
  getTurnRequestDeadline
104
- } from "./chunk-SZ2O3CGS.js";
104
+ } from "./chunk-IQCL5JGL.js";
105
105
  import {
106
106
  getVercelConversationWorkQueue
107
107
  } from "./chunk-DKIJ2RP5.js";
@@ -113,39 +113,39 @@ import {
113
113
  getSlackClient,
114
114
  isDmChannel,
115
115
  normalizeSlackConversationId
116
- } from "./chunk-BUTAWPUV.js";
116
+ } from "./chunk-FQ5HFSFR.js";
117
117
  import {
118
118
  getConversationStore,
119
119
  getSqlExecutor,
120
120
  requireSlackDestination,
121
121
  upsertIdentity,
122
122
  upsertLinkedIdentity
123
- } from "./chunk-AKR6W7VV.js";
123
+ } from "./chunk-2CYWEVOP.js";
124
124
  import {
125
125
  acquireActiveLock,
126
126
  getStateAdapter
127
- } from "./chunk-LRTEMMCZ.js";
127
+ } from "./chunk-IOUUS6H4.js";
128
128
  import {
129
129
  botConfig,
130
130
  escapeXml,
131
131
  getChatConfig,
132
132
  getRuntimeMetadata,
133
133
  normalizeSlackEmojiName
134
- } from "./chunk-4Z7B5WVV.js";
134
+ } from "./chunk-WJJDQLVL.js";
135
135
  import {
136
136
  defaultModelId
137
137
  } from "./chunk-D4YV5TDV.js";
138
138
  import {
139
139
  discoverSkills
140
- } from "./chunk-PYVGXGKC.js";
140
+ } from "./chunk-3YZ2Q6AW.js";
141
141
  import {
142
142
  pluginCatalogRuntime
143
- } from "./chunk-FGYWKKTJ.js";
143
+ } from "./chunk-DXFUYLHX.js";
144
144
  import {
145
145
  buildOAuthTokenRequest,
146
146
  hasRequiredOAuthScope,
147
147
  parseOAuthTokenResponse
148
- } from "./chunk-6FCKJDKS.js";
148
+ } from "./chunk-QWY4KI2V.js";
149
149
  import {
150
150
  createSlackResumeActor,
151
151
  isUserActor,
@@ -164,7 +164,7 @@ import {
164
164
  setTags,
165
165
  toOptionalString,
166
166
  withLogContext
167
- } from "./chunk-3ADPXQBL.js";
167
+ } from "./chunk-QY2IU47O.js";
168
168
 
169
169
  // src/chat/slack/assistant-thread/status-render.ts
170
170
  var DEFAULT_STATUS_CONTEXTS = {