@sentry/junior 0.184.0 → 0.186.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 (129) hide show
  1. package/dist/{agent-hooks-XTZVALGQ.js → agent-hooks-4B3Z4WRK.js} +13 -11
  2. package/dist/api/acp/schema.d.ts +20 -2
  3. package/dist/api/code/overview.d.ts +39 -0
  4. package/dist/api/locations/detail.d.ts +1 -1
  5. package/dist/api/people/code.d.ts +22 -0
  6. package/dist/api/schema/code.d.ts +46 -0
  7. package/dist/api/schema/conversation.d.ts +108 -20
  8. package/dist/api/schema/location.d.ts +1 -1
  9. package/dist/api/schema/person.d.ts +1 -1
  10. package/dist/api/schema.d.ts +4 -4
  11. package/dist/api/schema.js +12 -1
  12. package/dist/api.js +368 -78
  13. package/dist/app.js +1412 -538
  14. package/dist/{catalog-runtime-5357XR4F.js → catalog-runtime-AFJCAOHC.js} +4 -4
  15. package/dist/chat/api-turns/accepted-reply.d.ts +11 -0
  16. package/dist/chat/api-turns/cancellation.d.ts +3 -5
  17. package/dist/chat/api-turns/mailbox-input.d.ts +7 -0
  18. package/dist/chat/api-turns/routing.d.ts +18 -3
  19. package/dist/chat/api-turns/work.d.ts +4 -9
  20. package/dist/chat/app/conversation-work.d.ts +1 -1
  21. package/dist/chat/app/factory.d.ts +4 -0
  22. package/dist/chat/app/services.d.ts +4 -3
  23. package/dist/chat/conversations/history.d.ts +83 -9
  24. package/dist/chat/conversations/turn-lifecycle.d.ts +6 -3
  25. package/dist/chat/providers/slack/input.d.ts +32 -0
  26. package/dist/chat/{runtime → providers/slack}/processing-reaction.d.ts +6 -8
  27. package/dist/chat/{runtime/slack-resume.d.ts → providers/slack/resume.d.ts} +16 -19
  28. package/dist/chat/providers/slack/runtime.d.ts +1 -12
  29. package/dist/chat/providers/slack/turn.d.ts +10 -25
  30. package/dist/chat/resource-events/actor.d.ts +7 -2
  31. package/dist/chat/resource-events/app-publisher.d.ts +18 -0
  32. package/dist/chat/resource-events/catalog.d.ts +19 -0
  33. package/dist/chat/resource-events/ingest.d.ts +0 -1
  34. package/dist/chat/resource-events/notification.d.ts +28 -3
  35. package/dist/chat/resource-events/runtime-catalog.d.ts +7 -2
  36. package/dist/chat/resource-events/store.d.ts +2 -14
  37. package/dist/chat/resource-events/tool-support.d.ts +0 -5
  38. package/dist/chat/resource-events/workspace.d.ts +7 -3
  39. package/dist/chat/runtime/turn-execution.d.ts +7 -2
  40. package/dist/chat/sandbox/egress/credentials.d.ts +5 -4
  41. package/dist/chat/sandbox/egress/session.d.ts +10 -11
  42. package/dist/chat/sandbox/errors.d.ts +1 -1
  43. package/dist/chat/sandbox/ref.d.ts +1 -1
  44. package/dist/chat/sandbox/snapshot/events.d.ts +8 -1
  45. package/dist/chat/sandbox/snapshot/not-ready-error.d.ts +6 -1
  46. package/dist/chat/scheduled-tasks/tool-support.d.ts +5 -5
  47. package/dist/chat/scheduled-tasks/tools/create.d.ts +2 -2
  48. package/dist/chat/scheduled-tasks/tools/delete.d.ts +2 -2
  49. package/dist/chat/scheduled-tasks/tools/list.d.ts +2 -2
  50. package/dist/chat/scheduled-tasks/tools/run-now.d.ts +2 -2
  51. package/dist/chat/scheduled-tasks/tools/update.d.ts +2 -2
  52. package/dist/chat/scheduled-tasks/types.d.ts +1 -1
  53. package/dist/chat/sentry-links.d.ts +2 -0
  54. package/dist/chat/services/provider-retry.d.ts +2 -0
  55. package/dist/chat/services/turn-failure-response.d.ts +4 -0
  56. package/dist/chat/services/turn-session-routing.d.ts +20 -5
  57. package/dist/chat/task-execution/paused-turn.d.ts +0 -2
  58. package/dist/chat/task-execution/slack-resource-event.d.ts +47 -0
  59. package/dist/chat/task-execution/slack-work.d.ts +0 -21
  60. package/dist/chat/task-execution/state.d.ts +2 -2
  61. package/dist/chat/task-execution/store.d.ts +1 -1
  62. package/dist/chat/task-execution/turn-wake.d.ts +12 -0
  63. package/dist/chat/tool-support/action-review.d.ts +1 -1
  64. package/dist/chat/tools/event-tasks.d.ts +1 -1
  65. package/dist/chat/tools/resource-events.d.ts +2 -2
  66. package/dist/chat/tools/search-conversation-events.d.ts +1 -1
  67. package/dist/chat/tools/types.d.ts +1 -1
  68. package/dist/chat/tools/watch-resource-events.d.ts +2 -2
  69. package/dist/{chunk-Z3QAXJR7.js → chunk-2IBDVE62.js} +12 -9
  70. package/dist/{chunk-4RONS3WR.js → chunk-2U7EPTRZ.js} +11 -5
  71. package/dist/{chunk-3S7ULUWW.js → chunk-3CVEE6LA.js} +1 -1
  72. package/dist/{chunk-IZDYYYGP.js → chunk-43LODHJM.js} +24 -384
  73. package/dist/{chunk-LHXIZLFF.js → chunk-64WF2GQ3.js} +1 -1
  74. package/dist/{chunk-YKX6MTLU.js → chunk-7EOWT62G.js} +1 -1
  75. package/dist/{chunk-UBOIHNTH.js → chunk-7EU4YSZ4.js} +362 -188
  76. package/dist/{chunk-UF6BUA5W.js → chunk-ACGWTJ74.js} +3 -3
  77. package/dist/{chunk-6UDPINOX.js → chunk-AD64YMEC.js} +19 -44
  78. package/dist/{chunk-MLSQX2EX.js → chunk-BRKB5R7P.js} +1 -1
  79. package/dist/{chunk-E57WPXWY.js → chunk-CM6RTYSO.js} +5 -5
  80. package/dist/{chunk-MAPJFUMV.js → chunk-CV5CPRVG.js} +3 -3
  81. package/dist/chunk-D4YV5TDV.js +45 -0
  82. package/dist/{chunk-HIPUIPJM.js → chunk-DHYZ4VKG.js} +383 -254
  83. package/dist/{chunk-DUKIDPF6.js → chunk-DOP3FIQC.js} +1 -1
  84. package/dist/{chunk-BT53RIGJ.js → chunk-EWRPUXE3.js} +12 -50
  85. package/dist/{chunk-BHYRYYLY.js → chunk-FFYDRLXW.js} +1 -1
  86. package/dist/chunk-GFBR4S3Q.js +406 -0
  87. package/dist/chunk-GQMQCY7H.js +58 -0
  88. package/dist/{chunk-JNO2GUDS.js → chunk-GSB3NTNS.js} +926 -1856
  89. package/dist/{chunk-2ZQPVX7C.js → chunk-H7X2G2KS.js} +25 -12
  90. package/dist/{chunk-WQFEWULF.js → chunk-HKFLRIBD.js} +2 -2
  91. package/dist/{chunk-SHJK75Z2.js → chunk-HWXP6RHG.js} +38 -4
  92. package/dist/{chunk-RF6J3DIO.js → chunk-INQHUE72.js} +84 -1
  93. package/dist/{chunk-4CNDGK25.js → chunk-JFPY6XFF.js} +911 -993
  94. package/dist/{chunk-6WGC3SO4.js → chunk-MCLWOBPN.js} +80 -18
  95. package/dist/{chunk-PJPRXO2T.js → chunk-NRMAOGRS.js} +1 -1
  96. package/dist/{chunk-ACPDVEJO.js → chunk-O6GQO7VP.js} +201 -218
  97. package/dist/{chunk-M5YWNMTE.js → chunk-OZG7E22Y.js} +24 -6
  98. package/dist/{chunk-WVIA7V3M.js → chunk-PFAZSRGR.js} +29 -1
  99. package/dist/{chunk-LCP4EDKR.js → chunk-PZZOGHVR.js} +14 -4
  100. package/dist/{chunk-QABCY33S.js → chunk-QBL2AVFF.js} +2 -2
  101. package/dist/{chunk-FKEZZMXS.js → chunk-QU3URVWG.js} +9 -94
  102. package/dist/{chunk-M3QYTBQ6.js → chunk-STOCCPWH.js} +11 -2
  103. package/dist/{chunk-K7VDC2QW.js → chunk-TXLBLGNQ.js} +6 -6
  104. package/dist/{chunk-JA43DV4Y.js → chunk-VOGOTEW7.js} +1 -1
  105. package/dist/{chunk-HUXFMDBZ.js → chunk-VQIWBJOP.js} +1 -1
  106. package/dist/{chunk-JM2COLGC.js → chunk-VQZYIVYN.js} +6 -6
  107. package/dist/{chunk-BCHYQS4B.js → chunk-VXL2LBPK.js} +1 -1
  108. package/dist/{chunk-6VOYP4M6.js → chunk-YXSBZRP7.js} +1 -1
  109. package/dist/cli/chat.js +35 -33
  110. package/dist/cli/check.js +5 -5
  111. package/dist/cli/plugins.js +14 -12
  112. package/dist/cli/snapshot-create.js +10 -9
  113. package/dist/cli/upgrade.js +7 -6
  114. package/dist/{db-MA52H62H.js → db-7XL4UPAE.js} +8 -6
  115. package/dist/instrumentation.js +3 -3
  116. package/dist/nitro.js +7 -6
  117. package/dist/{oauth-callback-server-DXGHKN6S.js → oauth-callback-server-RAOYHWDI.js} +30 -27
  118. package/dist/{runner-4IXUAQNK.js → runner-KMPBWRPM.js} +24 -19
  119. package/dist/{skills-X3DY7AXO.js → skills-IPCALGLQ.js} +5 -5
  120. package/dist/spawn-OSOWTMBG.js +41 -0
  121. package/dist/task-runner-IQNBA3RY.js +34 -0
  122. package/dist/{validation-Z6JXSTJS.js → validation-BSRCCX6N.js} +5 -5
  123. package/dist/version.js +1 -1
  124. package/dist/{work-OKWRFBDW.js → work-T6UFTOJY.js} +24 -19
  125. package/dist/worker-L35OG7VA.js +24 -0
  126. package/package.json +5 -5
  127. package/dist/spawn-43WGS6CH.js +0 -37
  128. package/dist/task-runner-VDRKITPV.js +0 -32
  129. package/dist/worker-B236AE72.js +0 -22
@@ -1,4 +1,3 @@
1
- import { resumeSlackTurn } from "@/chat/runtime/slack-resume";
2
1
  import { type PausedTurnRequest } from "@/chat/task-execution/turn-wake";
3
2
  import type { AgentRunner } from "@/chat/runtime/agent-runner";
4
3
  import type { AgentRun } from "@/chat/agent/types";
@@ -8,7 +7,6 @@ export interface PausedTurnOptions {
8
7
  /** Exact persisted input ids accepted while running the paused turn. */
9
8
  inputMessageIds?: readonly string[];
10
9
  routingContext?: Pick<AgentRun, "actor" | "credentialContext" | "destinationVisibility" | "dispatch" | "surface">;
11
- resumeTurn?: typeof resumeSlackTurn;
12
10
  wakePausedTurn?: (request: PausedTurnRequest) => Promise<void>;
13
11
  scheduleSessionCompletedPluginTasks?: (params: {
14
12
  conversationId: string;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Slack edge helpers for resource-event mailbox wakes.
3
+ *
4
+ * Resource-event ingest stores plain conversation mailbox input. When the
5
+ * conversation destination is Slack, this module builds the Message and Thread
6
+ * the Slack runtime needs for one turn. It does not rewrite mailbox rows.
7
+ *
8
+ * TODO(slack-runtime): Drop this module once Slack turns can start from
9
+ * conversation destination + session source (channel, team, threadTs, text,
10
+ * event metadata) without a synthetic chat Message/Thread. Resource wakes and
11
+ * paused resume should share that entry; handleSubscribedMessage stays for
12
+ * real webhook traffic only.
13
+ */
14
+ import { Message, ThreadImpl, type StateAdapter } from "chat";
15
+ import type { SlackAdapter } from "@chat-adapter/slack";
16
+ import type { Destination, SlackDestination } from "@sentry/junior-plugin-api";
17
+ import type { ConversationStore } from "@/chat/conversations/store";
18
+ import type { InboundMessage } from "@/chat/task-execution/store";
19
+ /** Load Slack destination and threadTs for a resource-event wake. */
20
+ export declare function resolveSlackResourceEventThread(args: {
21
+ conversationId: string;
22
+ conversationStore?: ConversationStore;
23
+ destination?: Destination;
24
+ }): Promise<{
25
+ destination: SlackDestination;
26
+ threadTs: string;
27
+ }>;
28
+ /** Whether a mailbox row is a plain resource-event wake (no Slack envelope). */
29
+ export declare function isPlainResourceEventRecord(record: InboundMessage): boolean;
30
+ /**
31
+ * Build a Slack Message for one plain resource-event mailbox row.
32
+ *
33
+ * Used only at the Slack worker edge. The mailbox row stays plain.
34
+ */
35
+ export declare function buildResourceEventSlackMessage(args: {
36
+ channelId: string;
37
+ record: InboundMessage;
38
+ threadTs: string;
39
+ }): Message;
40
+ /** Build a ThreadImpl for a resource-event Slack turn. */
41
+ export declare function buildResourceEventSlackThread(args: {
42
+ adapter: SlackAdapter;
43
+ message: Message;
44
+ state: StateAdapter;
45
+ threadTs: string;
46
+ channelId: string;
47
+ }): ThreadImpl;
@@ -251,25 +251,6 @@ interface SlackInboxTurnRuntime {
251
251
  handleNewMention(thread: ThreadImpl, message: Message, hooks: SlackInboxTurnOptions): Promise<void>;
252
252
  handleSubscribedMessage(thread: ThreadImpl, message: Message, hooks: SlackInboxTurnOptions): Promise<void>;
253
253
  }
254
- interface SlackResourceEventInboundInput {
255
- event: {
256
- eventKey: string;
257
- eventType: string;
258
- occurredAtMs: number;
259
- namespace: string;
260
- identifier: string;
261
- };
262
- subscription: {
263
- conversationId: string;
264
- destination: {
265
- channelId: string;
266
- platform: "slack";
267
- teamId: string;
268
- };
269
- id: string;
270
- };
271
- text: string;
272
- }
273
254
  export interface CreateSlackConversationWorkerOptions {
274
255
  crossActorMidRunMode?: CrossActorMidRunMode;
275
256
  getSlackAdapter: () => SlackAdapter;
@@ -281,8 +262,6 @@ export interface CreateSlackConversationWorkerOptions {
281
262
  runtime: SlackInboxTurnRuntime;
282
263
  state?: StateAdapter;
283
264
  }
284
- /** Create a Slack mailbox record for a subscribed resource-event notification. */
285
- export declare function createSlackResourceEventInboundMessage(input: SlackResourceEventInboundInput): InboundMessage;
286
265
  /** Build the worker run function for queued Slack conversation work. */
287
266
  export declare function createSlackConversationWorker(options: CreateSlackConversationWorkerOptions): (context: ConversationWorkerContext) => Promise<ConversationWorkerResult>;
288
267
  /** Serialize a Slack message into the generic durable conversation mailbox. */
@@ -20,8 +20,8 @@ declare const inboundMessageSourceSchema: z.ZodEnum<{
20
20
  web: "web";
21
21
  plugin: "plugin";
22
22
  api: "api";
23
- internal: "internal";
24
23
  scheduler: "scheduler";
24
+ internal: "internal";
25
25
  resource_event: "resource_event";
26
26
  }>;
27
27
  export type Source = z.output<typeof inboundMessageSourceSchema>;
@@ -74,8 +74,8 @@ export declare const inboundMessageSchema: z.ZodObject<{
74
74
  web: "web";
75
75
  plugin: "plugin";
76
76
  api: "api";
77
- internal: "internal";
78
77
  scheduler: "scheduler";
78
+ internal: "internal";
79
79
  resource_event: "resource_event";
80
80
  }>;
81
81
  }, z.core.$strict>;
@@ -139,7 +139,7 @@ export declare function drainConversationMailbox(args: Parameters<typeof workSta
139
139
  };
140
140
  receivedAtMs: number;
141
141
  publishExternally: boolean;
142
- source: "slack" | "local" | "web" | "plugin" | "api" | "internal" | "scheduler" | "resource_event";
142
+ source: "slack" | "local" | "web" | "plugin" | "api" | "scheduler" | "internal" | "resource_event";
143
143
  attemptCount?: number | undefined;
144
144
  destination?: {
145
145
  platform: "slack";
@@ -18,6 +18,14 @@ interface TurnWakeOptions {
18
18
  queue?: ConversationWorkQueue;
19
19
  state?: StateAdapter;
20
20
  }
21
+ /** Look up and wake paused Turns without exposing queue or storage details. */
22
+ export interface PausedTurns {
23
+ get(args: {
24
+ conversationId: string;
25
+ turnId: string;
26
+ }): Promise<PausedTurnRequest | undefined>;
27
+ wake(request: PausedTurnRequest): Promise<void>;
28
+ }
21
29
  /** Build the worker input for a paused turn. */
22
30
  export declare function getPausedTurnRequest(args: {
23
31
  conversationId: string;
@@ -26,4 +34,8 @@ export declare function getPausedTurnRequest(args: {
26
34
  }): Promise<PausedTurnRequest | undefined>;
27
35
  /** Wake the conversation worker for a paused turn. */
28
36
  export declare function wakePausedTurn(request: PausedTurnRequest, options?: TurnWakeOptions): Promise<void>;
37
+ /** Create paused Turn operations for one app. */
38
+ export declare function createPausedTurns(options?: TurnWakeOptions & {
39
+ conversationStore?: ConversationStore;
40
+ }): PausedTurns;
29
41
  export {};
@@ -88,7 +88,7 @@ export interface ToolActionReviewer {
88
88
  /** Core-owned context used to prepare one exact action for Guardian. */
89
89
  export interface ToolActionReviewContext {
90
90
  actor?: Actor;
91
- conversationId?: string;
91
+ conversationId: string;
92
92
  credentialContext?: CredentialContext;
93
93
  destination: Destination;
94
94
  source: Source;
@@ -1,4 +1,4 @@
1
- import type { ResourceEventCatalog } from "@/chat/resource-events/catalog";
1
+ import { type ResourceEventCatalog } from "@/chat/resource-events/catalog";
2
2
  import type { ToolRegistry } from "@/chat/tools/definition";
3
3
  import type { ToolRuntimeContext } from "@/chat/tools/types";
4
4
  /** Build event task tools for an interactive Slack actor. */
@@ -1,5 +1,5 @@
1
- import type { ResourceEventCatalog } from "@/chat/resource-events/catalog";
1
+ import { type ResourceEventCatalog } from "@/chat/resource-events/catalog";
2
2
  import type { ToolRegistry } from "@/chat/tools/definition";
3
3
  import type { ToolRuntimeContext } from "@/chat/tools/types";
4
- /** Build the complete resource-watch tool set allowed by this runtime context. */
4
+ /** Build the complete resource-watch tool set for this runtime context. */
5
5
  export declare function createResourceEventTools(context: ToolRuntimeContext, catalog: ResourceEventCatalog): ToolRegistry;
@@ -9,7 +9,7 @@ export declare function createSearchConversationEventsTool(context: ToolRuntimeC
9
9
  after_seq?: number | null | undefined;
10
10
  before_seq?: number | null | undefined;
11
11
  limit?: number | null | undefined;
12
- types?: ("message" | "message_handled" | "assistant_message" | "turn_routed" | "guardian_action_reviewed" | "turn_context" | "structured_event" | "attachments_delivered" | "compaction" | "handoff" | "user_message" | "tool_result" | "mcp_provider_connected" | "mcp_provider_connected_unowned" | "authorization_requested" | "authorization_completed" | "tool_execution_started" | "message_updated" | "messages_summarized" | "turn_started" | "turn_completed" | "turn_failed" | "subagent_started" | "subagent_ended")[] | null | undefined;
12
+ types?: ("message" | "handoff" | "user_message" | "assistant_message" | "tool_result" | "compaction" | "mcp_provider_connected" | "mcp_provider_connected_unowned" | "authorization_requested" | "authorization_completed" | "tool_execution_started" | "guardian_action_reviewed" | "message_updated" | "message_handled" | "messages_summarized" | "turn_started" | "turn_routed" | "turn_context" | "structured_event" | "attachments_delivered" | "turn_completed" | "turn_failed" | "subagent_started" | "subagent_ended")[] | null | undefined;
13
13
  };
14
14
  execute?: ((input: unknown, options: import("./definition").ToolExecuteOptions) => {
15
15
  [x: string]: unknown;
@@ -63,7 +63,7 @@ interface BaseToolRuntimeContext {
63
63
  * Scheduled/web turns use an internal id such as `agent-dispatch:{id}`.
64
64
  * Do not parse as Slack unless the value starts with `slack:`.
65
65
  */
66
- conversationId?: string;
66
+ conversationId: string;
67
67
  /** Location associated with this Conversation. */
68
68
  locationId?: string;
69
69
  /** Runtime-owned default outbound destination for this invocation. */
@@ -16,7 +16,7 @@ export declare function createWatchResourceEventsTool(context: ToolRuntimeContex
16
16
  };
17
17
  execute?: ((input: unknown, options: import("./definition").ToolExecuteOptions) => {
18
18
  id: string;
19
- subscription_status: "completed" | "active" | "cancelled";
19
+ subscription_status: "completed" | "cancelled" | "active";
20
20
  identifier: string;
21
21
  events: string[];
22
22
  expiresAtMs: number;
@@ -39,7 +39,7 @@ export declare function createWatchResourceEventsTool(context: ToolRuntimeContex
39
39
  match?: Record<string, unknown> | undefined;
40
40
  } | Promise<{
41
41
  id: string;
42
- subscription_status: "completed" | "active" | "cancelled";
42
+ subscription_status: "completed" | "cancelled" | "active";
43
43
  identifier: string;
44
44
  events: string[];
45
45
  expiresAtMs: number;
@@ -8,14 +8,14 @@ import {
8
8
  getConversationStore,
9
9
  parseDestination,
10
10
  sameDestination
11
- } from "./chunk-IZDYYYGP.js";
11
+ } from "./chunk-43LODHJM.js";
12
12
  import {
13
13
  getDefaultRedisStateAdapterFor,
14
14
  getStateAdapter
15
- } from "./chunk-DUKIDPF6.js";
15
+ } from "./chunk-DOP3FIQC.js";
16
16
  import {
17
17
  getChatConfig
18
- } from "./chunk-6UDPINOX.js";
18
+ } from "./chunk-AD64YMEC.js";
19
19
  import {
20
20
  parseStoredSlackActor
21
21
  } from "./chunk-N7TMSOZH.js";
@@ -23,7 +23,7 @@ import {
23
23
  isRecord,
24
24
  toOptionalNumber,
25
25
  toOptionalString
26
- } from "./chunk-3S7ULUWW.js";
26
+ } from "./chunk-3CVEE6LA.js";
27
27
 
28
28
  // src/chat/task-execution/state.ts
29
29
  import { randomUUID } from "crypto";
@@ -248,9 +248,12 @@ function normalizeConversation(conversationId, value) {
248
248
  if (storedConversationId !== conversationId || typeof createdAtMs !== "number" || typeof lastActivityAtMs !== "number" || typeof updatedAtMs !== "number" || !execution || value.destination !== void 0 && !destination) {
249
249
  return void 0;
250
250
  }
251
- if (execution.pendingMessages.length > 0 && execution.pendingMessages.some(
252
- (message) => message.destination ? !destination || !sameDestination(message.destination, destination) : Boolean(destination)
253
- )) {
251
+ if (execution.pendingMessages.length > 0 && execution.pendingMessages.some((message) => {
252
+ if (!message.destination) {
253
+ return false;
254
+ }
255
+ return !destination || !sameDestination(message.destination, destination);
256
+ })) {
254
257
  return void 0;
255
258
  }
256
259
  return {
@@ -636,10 +639,10 @@ async function writeConversation(state, lock, conversation) {
636
639
  });
637
640
  }
638
641
  function assertSameOptionalConversationDestination(args) {
639
- if (!args.current && !args.next) {
642
+ if (!args.next || !args.current) {
640
643
  return;
641
644
  }
642
- if (args.current && args.next && sameDestination(args.current, args.next)) {
645
+ if (sameDestination(args.current, args.next)) {
643
646
  return;
644
647
  }
645
648
  throw new Error(
@@ -19,23 +19,23 @@ import {
19
19
  releaseConversationWork,
20
20
  requestAnotherSlice,
21
21
  startConversationWork
22
- } from "./chunk-Z3QAXJR7.js";
22
+ } from "./chunk-2IBDVE62.js";
23
23
  import {
24
24
  ConversationQueueMessageRejectedError
25
25
  } from "./chunk-JAL3CH4G.js";
26
26
  import {
27
27
  getTurnRequestDeadline
28
- } from "./chunk-MLSQX2EX.js";
28
+ } from "./chunk-BRKB5R7P.js";
29
29
  import {
30
30
  getChatConfig,
31
31
  isProviderRetryError
32
- } from "./chunk-6UDPINOX.js";
32
+ } from "./chunk-AD64YMEC.js";
33
33
  import {
34
34
  logException,
35
35
  logInfo,
36
36
  logWarn,
37
37
  withLogContext
38
- } from "./chunk-3S7ULUWW.js";
38
+ } from "./chunk-3CVEE6LA.js";
39
39
 
40
40
  // src/chat/task-execution/worker.ts
41
41
  var CONVERSATION_WORK_DEFER_DELAY_MS = 15e3;
@@ -276,7 +276,13 @@ async function processConversationWorkInContext(message, options) {
276
276
  }
277
277
  return { status: "no_work" };
278
278
  }
279
- const destination = initial.destination;
279
+ let destination = initial.destination;
280
+ if (!destination && options.conversationStore) {
281
+ const stored = await options.conversationStore.get({ conversationId });
282
+ if (stored && !stored.lineage) {
283
+ destination = stored.destination;
284
+ }
285
+ }
280
286
  const lease = await startConversationWork({
281
287
  conversationId,
282
288
  conversationStore: options.conversationStore,
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-PEQXYSSE.js";
13
13
  import {
14
14
  JUNIOR_VERSION
15
- } from "./chunk-6VOYP4M6.js";
15
+ } from "./chunk-YXSBZRP7.js";
16
16
 
17
17
  // src/deployment.ts
18
18
  var JUNIOR_HEARTBEAT_ROUTE = "/api/internal/heartbeat";