@sentry/junior 0.186.0 → 0.188.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-4B3Z4WRK.js → agent-hooks-5RQEVLQD.js} +11 -11
  2. package/dist/api.js +32 -32
  3. package/dist/app.js +67 -91
  4. package/dist/{catalog-runtime-AFJCAOHC.js → catalog-runtime-L4A6BJ3U.js} +4 -4
  5. package/dist/chat/agent/types.d.ts +16 -17
  6. package/dist/chat/agent-invocations/types.d.ts +72 -0
  7. package/dist/chat/api-turns/{accepted-reply.d.ts → assistant-message.d.ts} +3 -2
  8. package/dist/chat/api-turns/cancellation.d.ts +0 -1
  9. package/dist/chat/api-turns/mailbox-input.d.ts +0 -3
  10. package/dist/chat/api-turns/routing.d.ts +22 -21
  11. package/dist/chat/api-turns/work.d.ts +2 -2
  12. package/dist/chat/conversations/location.d.ts +4 -9
  13. package/dist/chat/conversations/store.d.ts +17 -7
  14. package/dist/chat/event-tasks/tool-support.d.ts +6 -0
  15. package/dist/chat/resource-events/actor.d.ts +7 -0
  16. package/dist/chat/services/turn-session-routing.d.ts +10 -9
  17. package/dist/chat/task-execution/slack-resource-event.d.ts +13 -5
  18. package/dist/chat/task-input.d.ts +22 -0
  19. package/dist/{chunk-YXSBZRP7.js → chunk-32XSSFZV.js} +1 -1
  20. package/dist/{chunk-HKFLRIBD.js → chunk-3HEZWDS5.js} +2 -2
  21. package/dist/{chunk-INQHUE72.js → chunk-6FGN7ZEG.js} +6 -2
  22. package/dist/{chunk-TXLBLGNQ.js → chunk-6JZGXLL2.js} +5 -5
  23. package/dist/{chunk-H7X2G2KS.js → chunk-6YGFBU3A.js} +12 -12
  24. package/dist/{chunk-MCLWOBPN.js → chunk-AW77HH54.js} +23 -19
  25. package/dist/{chunk-2U7EPTRZ.js → chunk-CDSLOYOR.js} +5 -5
  26. package/dist/{chunk-CM6RTYSO.js → chunk-CIG6WI7Q.js} +9 -6
  27. package/dist/{chunk-7EOWT62G.js → chunk-CVBDVIF4.js} +1 -1
  28. package/dist/{chunk-QBL2AVFF.js → chunk-CZRWU4ZM.js} +2 -2
  29. package/dist/{chunk-GQMQCY7H.js → chunk-ERZMACYA.js} +3 -3
  30. package/dist/{chunk-FFYDRLXW.js → chunk-FIUCHYT6.js} +1 -1
  31. package/dist/{chunk-VQIWBJOP.js → chunk-HCIVBCP5.js} +1 -1
  32. package/dist/{chunk-43LODHJM.js → chunk-IUUQWIG2.js} +14 -31
  33. package/dist/{chunk-7EU4YSZ4.js → chunk-LODJKINF.js} +140 -123
  34. package/dist/{chunk-2IBDVE62.js → chunk-MQDIIFZM.js} +4 -4
  35. package/dist/{chunk-NRMAOGRS.js → chunk-NZLZ4KYZ.js} +1 -1
  36. package/dist/{chunk-PZZOGHVR.js → chunk-PSHMPRIU.js} +1 -1
  37. package/dist/{chunk-AD64YMEC.js → chunk-Q7O74WOO.js} +2 -2
  38. package/dist/{chunk-JFPY6XFF.js → chunk-QCGNHSMA.js} +6 -6
  39. package/dist/{chunk-OZG7E22Y.js → chunk-QDHJTKPE.js} +5 -5
  40. package/dist/{chunk-3CVEE6LA.js → chunk-QIMN3FXL.js} +1 -1
  41. package/dist/{chunk-64WF2GQ3.js → chunk-QIOUTXTZ.js} +1 -1
  42. package/dist/{chunk-VXL2LBPK.js → chunk-QVH6FW3T.js} +13 -3
  43. package/dist/{chunk-GSB3NTNS.js → chunk-RMB7CERI.js} +34 -36
  44. package/dist/{chunk-EWRPUXE3.js → chunk-SC67CH3C.js} +18 -14
  45. package/dist/{chunk-VQZYIVYN.js → chunk-UVUXFRYN.js} +6 -6
  46. package/dist/{chunk-DHYZ4VKG.js → chunk-VFZAUQ5V.js} +97 -47
  47. package/dist/{chunk-QU3URVWG.js → chunk-W2DDJCPS.js} +8 -8
  48. package/dist/{chunk-STOCCPWH.js → chunk-W42ENMJW.js} +1 -1
  49. package/dist/{chunk-BRKB5R7P.js → chunk-WGZJ5SU4.js} +1 -1
  50. package/dist/{chunk-O6GQO7VP.js → chunk-WW2Y7JIA.js} +26 -23
  51. package/dist/{chunk-HWXP6RHG.js → chunk-X55FOVZO.js} +3 -3
  52. package/dist/{chunk-ACGWTJ74.js → chunk-XI4PVY2T.js} +3 -3
  53. package/dist/{chunk-CV5CPRVG.js → chunk-XJIPMHKI.js} +3 -3
  54. package/dist/{chunk-VOGOTEW7.js → chunk-Z5SKZE5B.js} +2 -2
  55. package/dist/{chunk-DOP3FIQC.js → chunk-ZX7RSBQ6.js} +1 -1
  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 +36 -0
  62. package/dist/db/schema.d.ts +36 -0
  63. package/dist/{db-7XL4UPAE.js → db-YPRZAA2T.js} +6 -6
  64. package/dist/instrumentation.js +3 -3
  65. package/dist/nitro.js +6 -6
  66. package/dist/{oauth-callback-server-RAOYHWDI.js → oauth-callback-server-DBBIR3XG.js} +28 -28
  67. package/dist/{runner-KMPBWRPM.js → runner-FKVFFPLO.js} +20 -20
  68. package/dist/{skills-IPCALGLQ.js → skills-4RBAZEMV.js} +5 -5
  69. package/dist/spawn-CO7QFCNJ.js +41 -0
  70. package/dist/task-runner-DUGZGI7V.js +34 -0
  71. package/dist/{validation-BSRCCX6N.js → validation-E6Z5LHZM.js} +5 -5
  72. package/dist/version.js +1 -1
  73. package/dist/{work-T6UFTOJY.js → work-OFTXWOK4.js} +21 -21
  74. package/dist/{worker-L35OG7VA.js → worker-OMWNOKTJ.js} +10 -10
  75. package/package.json +4 -4
  76. package/dist/spawn-OSOWTMBG.js +0 -41
  77. package/dist/task-runner-IQNBA3RY.js +0 -34
@@ -2,29 +2,29 @@ import {
2
2
  coerceThreadConversationState,
3
3
  getPersistedThreadState,
4
4
  persistThreadStateById
5
- } from "./chunk-CM6RTYSO.js";
5
+ } from "./chunk-CIG6WI7Q.js";
6
6
  import {
7
7
  buildDeterministicTurnId,
8
8
  clearPendingAuth,
9
9
  markTurnClosed,
10
10
  markTurnCompleted
11
- } from "./chunk-VOGOTEW7.js";
11
+ } from "./chunk-Z5SKZE5B.js";
12
12
  import {
13
13
  hydrateConversationMessages,
14
14
  markConversationMessage
15
- } from "./chunk-H7X2G2KS.js";
15
+ } from "./chunk-6YGFBU3A.js";
16
16
  import {
17
17
  ProviderError,
18
18
  findProviderError,
19
19
  getProviderErrorAttributes,
20
20
  getProviderErrorUserMessage
21
- } from "./chunk-AD64YMEC.js";
21
+ } from "./chunk-Q7O74WOO.js";
22
22
  import {
23
23
  parseSlackMessageTs
24
24
  } from "./chunk-N7TMSOZH.js";
25
25
  import {
26
26
  buildTurnFailureResponse
27
- } from "./chunk-3CVEE6LA.js";
27
+ } from "./chunk-QIMN3FXL.js";
28
28
 
29
29
  // src/chat/runtime/delivered-turn-state.ts
30
30
  function buildDeliveredTurnStatePatch(args) {
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-PEQXYSSE.js";
13
13
  import {
14
14
  JUNIOR_VERSION
15
- } from "./chunk-YXSBZRP7.js";
15
+ } from "./chunk-32XSSFZV.js";
16
16
 
17
17
  // src/deployment.ts
18
18
  var JUNIOR_HEARTBEAT_ROUTE = "/api/internal/heartbeat";
@@ -12,7 +12,7 @@ import {
12
12
  logInfo,
13
13
  logWarn,
14
14
  setSpanAttributes
15
- } from "./chunk-3CVEE6LA.js";
15
+ } from "./chunk-QIMN3FXL.js";
16
16
 
17
17
  // src/chat/plugins/manifest.ts
18
18
  import { z } from "zod";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-VFUK3X5B.js";
5
5
  import {
6
6
  DEFAULT_SQL_STATEMENT_TIMEOUT_MS
7
- } from "./chunk-AD64YMEC.js";
7
+ } from "./chunk-Q7O74WOO.js";
8
8
 
9
9
  // src/db/neon.ts
10
10
  import { AsyncLocalStorage } from "async_hooks";
@@ -137,13 +137,19 @@ var juniorConversations = pgTable4(
137
137
  schemaVersion: integer2("schema_version").notNull().default(1),
138
138
  source: text4("source").$type(),
139
139
  /** Structured session Source locator; set-once on the conversation root. */
140
+ // TODO(dcramer): Remove source_json after every stored Conversation has a
141
+ // complete Location and all readers use it for provider context.
140
142
  sessionSource: jsonb2("source_json").$type(),
141
143
  originType: text4("origin_type"),
142
144
  originId: text4("origin_id"),
143
145
  originRunId: text4("origin_run_id"),
146
+ // TODO(dcramer): Rename destination_id to location_id after all deployed
147
+ // readers and writers use the singular Conversation Location contract.
144
148
  destinationId: text4("destination_id").references(
145
149
  () => juniorDestinations.id
146
150
  ),
151
+ // TODO(dcramer): Drop destination_json after every row uses location_id and
152
+ // no supported worker writes the legacy JSON value.
147
153
  destination: jsonb2("destination_json").$type(),
148
154
  actorIdentityId: text4("actor_identity_id").references(
149
155
  () => juniorIdentities.id
@@ -422,6 +428,8 @@ var juniorConversationBindings = pgTable10(
422
428
  conversationId: text10("conversation_id").notNull().references(() => juniorConversations.conversationId),
423
429
  provider: text10("provider").notNull(),
424
430
  providerTenantId: text10("provider_tenant_id").notNull().default(""),
431
+ // TODO(dcramer): Rename provider_destination_id with the Location SQL
432
+ // migration. It identifies the provider place that contains the thread.
425
433
  providerDestinationId: text10("provider_destination_id").notNull(),
426
434
  providerConversationId: text10("provider_conversation_id").notNull(),
427
435
  createdAt: timestamptz("created_at").notNull()
@@ -660,7 +668,8 @@ var juniorSchedulerTasks = pgTable17(
660
668
  {
661
669
  id: text17("id").primaryKey(),
662
670
  teamId: text17("team_id").notNull(),
663
- // TODO(v0.128.0): Remove after v0.127.x runtimes no longer write this column.
671
+ // TODO(dcramer): Remove after v0.127.x runtimes are unsupported and no
672
+ // supported runtime writes this column.
664
673
  creatorSlackUserId: text17("creator_slack_user_id"),
665
674
  creatorIdentityId: text17("creator_identity_id"),
666
675
  status: text17("status").notNull(),
@@ -672,7 +681,8 @@ var juniorSchedulerTasks = pgTable17(
672
681
  record: jsonb7("record").$type().notNull()
673
682
  },
674
683
  (table) => [
675
- // TODO(v0.128.0): Remove with creatorSlackUserId.
684
+ // TODO(dcramer): Remove after no supported runtime reads or writes the
685
+ // legacy creatorSlackUserId column.
676
686
  index13("junior_scheduler_tasks_creator_idx").on(table.teamId, table.creatorSlackUserId, table.createdAtMs, table.id).where(sql6`${table.status} <> 'deleted'`),
677
687
  index13("junior_scheduler_tasks_creator_identity_idx").on(table.creatorIdentityId, table.createdAtMs, table.id).where(
678
688
  sql6`${table.status} <> 'deleted' AND ${table.creatorIdentityId} IS NOT NULL`
@@ -7,7 +7,7 @@ import {
7
7
  PluginCredentialFailureError,
8
8
  agentNameSchema,
9
9
  createPluginAuthOrchestration
10
- } from "./chunk-TXLBLGNQ.js";
10
+ } from "./chunk-6JZGXLL2.js";
11
11
  import {
12
12
  parseSandboxEgressAuthRequiredSignal,
13
13
  parseSandboxEgressPermissionDeniedSignal,
@@ -38,7 +38,7 @@ import {
38
38
  searchSlackUsers,
39
39
  selectPluginGrant,
40
40
  toMcpProviderError
41
- } from "./chunk-QU3URVWG.js";
41
+ } from "./chunk-W2DDJCPS.js";
42
42
  import {
43
43
  addReactionToMessage,
44
44
  deliverOAuthAuthorization,
@@ -46,7 +46,7 @@ import {
46
46
  getSlackMessagePermalink,
47
47
  resolveBaseUrl,
48
48
  uploadFilesToConversation
49
- } from "./chunk-VQZYIVYN.js";
49
+ } from "./chunk-UVUXFRYN.js";
50
50
  import {
51
51
  SCHEDULED_TASK_SYSTEM_ACTOR,
52
52
  WORKSPACE_SNAPSHOT_FAILED_EVENT,
@@ -87,10 +87,10 @@ import {
87
87
  workspaceSnapshotFinishedEvent,
88
88
  workspaceSnapshotWatch,
89
89
  writableEventTask
90
- } from "./chunk-DHYZ4VKG.js";
90
+ } from "./chunk-VFZAUQ5V.js";
91
91
  import {
92
92
  parseSlackThreadId
93
- } from "./chunk-7EOWT62G.js";
93
+ } from "./chunk-CVBDVIF4.js";
94
94
  import {
95
95
  RetryableDeliveryError,
96
96
  actorFromRun,
@@ -98,7 +98,7 @@ import {
98
98
  isAgentRunFeatureDisabled,
99
99
  surfaceFromRun,
100
100
  toolInvocationDestination
101
- } from "./chunk-INQHUE72.js";
101
+ } from "./chunk-6FGN7ZEG.js";
102
102
  import {
103
103
  CooperativeTurnYieldError,
104
104
  NO_REPLY_MARKER,
@@ -111,7 +111,7 @@ import {
111
111
  isNoReplyMarker,
112
112
  isTurnInputCommitLostError,
113
113
  sanitizeAssistantText
114
- } from "./chunk-VOGOTEW7.js";
114
+ } from "./chunk-Z5SKZE5B.js";
115
115
  import {
116
116
  AGENTS_REMOVAL_NOTICE,
117
117
  AGENTS_REPLACEMENT_NOTICE,
@@ -171,7 +171,7 @@ import {
171
171
  stripRuntimeTurnContext,
172
172
  trimTrailingAssistantMessages,
173
173
  truncateText
174
- } from "./chunk-H7X2G2KS.js";
174
+ } from "./chunk-6YGFBU3A.js";
175
175
  import {
176
176
  bindSandboxFileSystem,
177
177
  createSandboxSession,
@@ -182,7 +182,7 @@ import {
182
182
  resolve,
183
183
  setSnapshotSpanAttributes,
184
184
  stopSession
185
- } from "./chunk-CV5CPRVG.js";
185
+ } from "./chunk-XJIPMHKI.js";
186
186
  import {
187
187
  privateTraceResultAttributes
188
188
  } from "./chunk-UIE3R5XU.js";
@@ -195,7 +195,7 @@ import {
195
195
  } from "./chunk-DKIJ2RP5.js";
196
196
  import {
197
197
  getTurnRequestDeadline
198
- } from "./chunk-BRKB5R7P.js";
198
+ } from "./chunk-WGZJ5SU4.js";
199
199
  import {
200
200
  RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS,
201
201
  RESOURCE_SUBSCRIPTION_MAX_TTL_MS,
@@ -239,19 +239,19 @@ import {
239
239
  updateWorkspace,
240
240
  withSlackRetries,
241
241
  workspaceRepoCheckoutPath
242
- } from "./chunk-JFPY6XFF.js";
242
+ } from "./chunk-QCGNHSMA.js";
243
243
  import {
244
244
  getConversationEventStore,
245
245
  getConversationMessageSearchStore,
246
246
  getConversationStore,
247
247
  getDb,
248
248
  getSqlExecutor
249
- } from "./chunk-43LODHJM.js";
249
+ } from "./chunk-IUUQWIG2.js";
250
250
  import {
251
251
  juniorArtifacts,
252
252
  juniorIdentities,
253
253
  juniorSchedulerRuns
254
- } from "./chunk-VXL2LBPK.js";
254
+ } from "./chunk-QVH6FW3T.js";
255
255
  import {
256
256
  SANDBOX_DATA_ROOT,
257
257
  SANDBOX_REPOS_ROOT,
@@ -282,12 +282,12 @@ import {
282
282
  throwSandboxOperationError,
283
283
  workspaceSnapshotNotReadyUserMessage,
284
284
  wrapSandboxSetupError
285
- } from "./chunk-HWXP6RHG.js";
285
+ } from "./chunk-X55FOVZO.js";
286
286
  import {
287
287
  fenceLock,
288
288
  getStateAdapter,
289
289
  withLock
290
- } from "./chunk-DOP3FIQC.js";
290
+ } from "./chunk-ZX7RSBQ6.js";
291
291
  import {
292
292
  KNOWN_CONVERSATION_EVENT_TYPES,
293
293
  contextProvenance,
@@ -320,7 +320,7 @@ import {
320
320
  resolveGatewayCredential,
321
321
  resolveGatewayModel,
322
322
  unwrapCurrentInstruction
323
- } from "./chunk-AD64YMEC.js";
323
+ } from "./chunk-Q7O74WOO.js";
324
324
  import {
325
325
  ModelProfileNotConfiguredError,
326
326
  TURN_REASONING_LEVELS,
@@ -337,16 +337,16 @@ import {
337
337
  toGenAiMessagesTraceAttributes,
338
338
  toGenAiPayloadMetadata,
339
339
  toGenAiPayloadTraceAttributes
340
- } from "./chunk-FFYDRLXW.js";
340
+ } from "./chunk-FIUCHYT6.js";
341
341
  import {
342
342
  discoverSkills,
343
343
  findSkillByName,
344
344
  loadSkillsByName,
345
345
  parseSkillInvocation
346
- } from "./chunk-HKFLRIBD.js";
346
+ } from "./chunk-3HEZWDS5.js";
347
347
  import {
348
348
  pluginCatalogRuntime
349
- } from "./chunk-NRMAOGRS.js";
349
+ } from "./chunk-NZLZ4KYZ.js";
350
350
  import {
351
351
  CredentialUnavailableError,
352
352
  OAuthProviderError,
@@ -354,7 +354,7 @@ import {
354
354
  getOAuthProviderErrorAttributes,
355
355
  resolveAuthTokenPlaceholder,
356
356
  resolvePluginCommandEnv
357
- } from "./chunk-64WF2GQ3.js";
357
+ } from "./chunk-QIOUTXTZ.js";
358
358
  import {
359
359
  credentialContextForActor,
360
360
  credentialUserSubjectId
@@ -390,7 +390,7 @@ import {
390
390
  summarizeMessageText,
391
391
  withLogContext,
392
392
  withSpan
393
- } from "./chunk-3CVEE6LA.js";
393
+ } from "./chunk-QIMN3FXL.js";
394
394
  import {
395
395
  startInactiveSpan,
396
396
  withActiveSpan
@@ -888,12 +888,13 @@ function buildTurnResult(input) {
888
888
  const rawPrimaryText = sanitizeAssistantText(
889
889
  terminalAssistantMessages.map((message) => extractAssistantText(message)).join("\n\n")
890
890
  ).trim();
891
- const exactNoReplyMarker = isNoReplyMarker(rawPrimaryText);
892
- const mixedNoReplyMarker = !exactNoReplyMarker && containsNoReplyMarker(rawPrimaryText);
893
- const noReplyRequested = exactNoReplyMarker || mixedNoReplyMarker;
894
- const primaryText = noReplyRequested ? "" : terminalAssistantMessages.map((message) => decideReply(message)).filter(
891
+ const primaryText = terminalAssistantMessages.map((message) => decideReply(message)).filter(
895
892
  (output) => output.kind === "deliver"
896
893
  ).map((output) => output.text).join("\n\n");
894
+ const terminalTexts = terminalAssistantMessages.map(
895
+ (message) => sanitizeAssistantText(extractAssistantText(message))
896
+ );
897
+ const noReplyRequested = !primaryText && terminalTexts.some((text) => isNoReplyMarker(text)) && terminalTexts.every((text) => !text || isNoReplyMarker(text));
897
898
  const toolErrorCount = toolResults.filter((result) => result.isError).length;
898
899
  const reactionPerformed = toolResults.some(
899
900
  (result) => !isToolResultError(result) && normalizeToolNameFromResult(result) === "addReaction"
@@ -903,7 +904,7 @@ function buildTurnResult(input) {
903
904
  const stopReason = typeof lastAssistant?.stopReason === "string" ? lastAssistant.stopReason : void 0;
904
905
  const errorMessage = typeof lastAssistant?.errorMessage === "string" ? lastAssistant.errorMessage : void 0;
905
906
  const isProviderError = stopReason === "error";
906
- if (exactNoReplyMarker) {
907
+ if (noReplyRequested) {
907
908
  const markerCategory = reactionPerformed ? "reaction" : "none";
908
909
  const markerAttributes = {
909
910
  "app.ai.no_reply_marker": true,
@@ -913,7 +914,7 @@ function buildTurnResult(input) {
913
914
  if (!isProviderError) {
914
915
  logInfo("ai.no_reply_marker.accepted", markerAttributes);
915
916
  }
916
- } else if (mixedNoReplyMarker) {
917
+ } else if (containsNoReplyMarker(rawPrimaryText)) {
917
918
  logWarn("ai.no_reply_marker.mixed_text", {
918
919
  "app.ai.no_reply_marker": true,
919
920
  "app.ai.no_reply_marker_mode": "mixed"
@@ -13504,7 +13505,7 @@ function createSearchConversationEventsTool(context) {
13504
13505
  const targetRootConversationId = await resolveRootConversationId(
13505
13506
  conversationStore,
13506
13507
  conversationId,
13507
- target.lineage?.parentConversationId
13508
+ target.parentConversationId
13508
13509
  );
13509
13510
  const targetRoot = targetRootConversationId === conversationId ? target : await conversationStore.get({
13510
13511
  conversationId: targetRootConversationId
@@ -13542,7 +13543,7 @@ async function resolveAccessScope(conversationStore, context, currentConversatio
13542
13543
  const currentRootConversationId = current ? await resolveRootConversationId(
13543
13544
  conversationStore,
13544
13545
  currentConversationId,
13545
- current.lineage?.parentConversationId
13546
+ current.parentConversationId
13546
13547
  ) : currentConversationId;
13547
13548
  if (context.source.platform === "slack") {
13548
13549
  return {
@@ -13580,10 +13581,10 @@ async function resolveRootConversationId(conversationStore, conversationId, pare
13580
13581
  if (!parent) {
13581
13582
  return conversationId;
13582
13583
  }
13583
- if (!parent.lineage?.parentConversationId) {
13584
+ if (!parent.parentConversationId) {
13584
13585
  return parent.conversationId;
13585
13586
  }
13586
- cursor = parent.lineage.parentConversationId;
13587
+ cursor = parent.parentConversationId;
13587
13588
  }
13588
13589
  return conversationId;
13589
13590
  }
@@ -17389,9 +17390,6 @@ async function wireAgentTools(args) {
17389
17390
  const runSource = args.run.source;
17390
17391
  const credentialUserId = args.run.credentialContext ? credentialUserSubjectId(args.run.credentialContext) : void 0;
17391
17392
  const userTokenStore = createUserTokenStore();
17392
- const conversation = await getConversationStore().get({
17393
- conversationId: args.run.conversationId
17394
- });
17395
17393
  const pluginHooks = createPluginHookRunner({
17396
17394
  actor: args.currentActor,
17397
17395
  actors: args.currentActors
@@ -17478,7 +17476,7 @@ async function wireAgentTools(args) {
17478
17476
  );
17479
17477
  const commonToolRuntimeContext = {
17480
17478
  conversationId: args.run.conversationId,
17481
- ...conversation?.location ? { locationId: conversation.location.id } : void 0,
17479
+ ...args.run.source.location ? { locationId: args.run.source.location.id } : void 0,
17482
17480
  userText: args.userInput,
17483
17481
  configuration: args.configurationValues,
17484
17482
  egress: createPluginEgress({
@@ -19127,7 +19125,7 @@ async function executeAgentRunInPrivacyContext(run, conversationPrivacy, runLogC
19127
19125
  return;
19128
19126
  }
19129
19127
  try {
19130
- await delivery(message);
19128
+ await delivery.send(message);
19131
19129
  acceptedToolFreeAssistant = true;
19132
19130
  } catch (error) {
19133
19131
  assistantMessageDeliveryError = new AssistantMessageDeliveryError(
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  AgentRunError,
3
3
  executeTurn
4
- } from "./chunk-GQMQCY7H.js";
4
+ } from "./chunk-ERZMACYA.js";
5
5
  import {
6
6
  ConversationTurnLifecycleService
7
- } from "./chunk-STOCCPWH.js";
7
+ } from "./chunk-W42ENMJW.js";
8
8
  import {
9
9
  getPersistedSandboxState,
10
10
  getPersistedThreadState,
11
11
  persistThreadStateById
12
- } from "./chunk-CM6RTYSO.js";
12
+ } from "./chunk-CIG6WI7Q.js";
13
13
  import {
14
14
  AgentInvocationBusyError,
15
15
  AgentInvocationLimitError,
@@ -18,32 +18,32 @@ import {
18
18
  agentBindingSchema,
19
19
  agentInvocationSchema,
20
20
  createAgentInvocationSchema
21
- } from "./chunk-TXLBLGNQ.js";
21
+ } from "./chunk-6JZGXLL2.js";
22
22
  import {
23
23
  appendAndEnqueueInboundMessage
24
- } from "./chunk-2IBDVE62.js";
24
+ } from "./chunk-MQDIIFZM.js";
25
25
  import {
26
26
  TurnInputCommitLostError,
27
27
  getAssistantReplyText,
28
28
  getConversationTurnBoundaryError,
29
29
  isTurnInputCommitLostError
30
- } from "./chunk-VOGOTEW7.js";
30
+ } from "./chunk-Z5SKZE5B.js";
31
31
  import {
32
32
  failTurnRecord,
33
33
  getTerminalAssistantMessages,
34
34
  getTurnRecord,
35
35
  openConversationProjection,
36
36
  saveTurnCheckpoint
37
- } from "./chunk-H7X2G2KS.js";
37
+ } from "./chunk-6YGFBU3A.js";
38
38
  import {
39
39
  getConversationEventStore,
40
40
  getConversationStore,
41
41
  getSqlExecutor
42
- } from "./chunk-43LODHJM.js";
42
+ } from "./chunk-IUUQWIG2.js";
43
43
  import {
44
44
  juniorAgentBindings,
45
45
  juniorAgentInvocations
46
- } from "./chunk-VXL2LBPK.js";
46
+ } from "./chunk-QVH6FW3T.js";
47
47
 
48
48
  // src/chat/agent-invocations/work.ts
49
49
  import { z } from "zod";
@@ -518,6 +518,7 @@ function createAgentInvocationWorker(agentRunner) {
518
518
  );
519
519
  let sandboxRef;
520
520
  let history;
521
+ let location;
521
522
  try {
522
523
  if (invocation.childConversationId !== context.conversationId) {
523
524
  throw new Error(
@@ -556,6 +557,9 @@ function createAgentInvocationWorker(agentRunner) {
556
557
  ]);
557
558
  sandboxRef = getPersistedSandboxState(persisted);
558
559
  history = projection.messages;
560
+ location = (await getConversationStore().get({
561
+ conversationId: invocation.parentConversationId
562
+ }))?.location;
559
563
  } catch (error) {
560
564
  if (isInvocationInputCommitLost(error)) {
561
565
  return { status: "lost_lease" };
@@ -591,12 +595,12 @@ function createAgentInvocationWorker(agentRunner) {
591
595
  destination: invocation.destination,
592
596
  destinationVisibility: invocation.destinationVisibility,
593
597
  publishExternally: context.publishExternally,
594
- source: invocation.source,
598
+ source: location ? { ...invocation.source, location } : invocation.source,
595
599
  surface: "internal",
596
- // TODO(#881, #883): Child runs may still need a path to force
597
- // interactive auth when a delegated tool requires credentials the
598
- // parent already has authority to request. Today background children
599
- // hard-fail instead of pausing for an OAuth link.
600
+ // TODO(dcramer): Issues #881 and #883 track a path for child runs to
601
+ // force interactive auth when a delegated tool requires credentials
602
+ // the parent can request. Today background children hard-fail instead
603
+ // of pausing for an OAuth link.
600
604
  disabledFeatures: ["handoff", "interactive-auth", "subagents"],
601
605
  reasoning: invocation.reasoningLevel,
602
606
  state: {
@@ -5,19 +5,19 @@ import {
5
5
  isDmChannel,
6
6
  normalizeSlackConversationId,
7
7
  withSlackRetries
8
- } from "./chunk-JFPY6XFF.js";
8
+ } from "./chunk-QCGNHSMA.js";
9
9
  import {
10
10
  parseDestination
11
- } from "./chunk-43LODHJM.js";
11
+ } from "./chunk-IUUQWIG2.js";
12
12
  import {
13
13
  getStateAdapter
14
- } from "./chunk-DOP3FIQC.js";
14
+ } from "./chunk-ZX7RSBQ6.js";
15
15
  import {
16
16
  normalizeSlackEmojiName
17
- } from "./chunk-AD64YMEC.js";
17
+ } from "./chunk-Q7O74WOO.js";
18
18
  import {
19
19
  pluginCatalogRuntime
20
- } from "./chunk-NRMAOGRS.js";
20
+ } from "./chunk-NZLZ4KYZ.js";
21
21
  import {
22
22
  parseSlackMessageTs,
23
23
  parseSlackUserId
@@ -26,7 +26,7 @@ import {
26
26
  isRecord,
27
27
  logInfo,
28
28
  logWarn
29
- } from "./chunk-3CVEE6LA.js";
29
+ } from "./chunk-QIMN3FXL.js";
30
30
 
31
31
  // src/chat/slack/outbound.ts
32
32
  var MAX_SLACK_MESSAGE_TEXT_CHARS = 4e4;