@sentry/junior 0.169.0 → 0.171.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 (75) hide show
  1. package/dist/{agent-hooks-YGKANST4.js → agent-hooks-UXIRPATC.js} +16 -11
  2. package/dist/api.js +33 -32
  3. package/dist/app.js +35 -35
  4. package/dist/catalog-runtime-PQCGQUXA.js +16 -0
  5. package/dist/chat/conversations/sql/store.d.ts +7 -0
  6. package/dist/chat/conversations/store.d.ts +14 -0
  7. package/dist/chat/sandbox/snapshot/store.d.ts +28 -0
  8. package/dist/chat/slack/channel.d.ts +0 -13
  9. package/dist/chat/slack/ids.d.ts +7 -1
  10. package/dist/chat/slack/tool-support/channel-target.d.ts +6 -5
  11. package/dist/chat/workspaces/store.d.ts +1 -10
  12. package/dist/chat/workspaces/types.d.ts +14 -1
  13. package/dist/{chunk-Q62IHFIH.js → chunk-2AYWP7PZ.js} +6 -270
  14. package/dist/{chunk-VRMPMOAT.js → chunk-3AX2WCFV.js} +2 -2
  15. package/dist/{chunk-OU2DMDUI.js → chunk-4TKPTFSO.js} +1 -1
  16. package/dist/{chunk-MKEHLCSM.js → chunk-5GF7HQOP.js} +70 -11
  17. package/dist/{chunk-S6JDUILF.js → chunk-5ML752HJ.js} +8 -8
  18. package/dist/{chunk-2VK3CYSL.js → chunk-5TZ2DKVU.js} +1 -1
  19. package/dist/{chunk-EEKFF74Y.js → chunk-62WK6FLT.js} +183 -69
  20. package/dist/{chunk-FSH6HT5C.js → chunk-6RRTVWAD.js} +1 -1
  21. package/dist/{chunk-7MA4HV4W.js → chunk-6ZWRNC4D.js} +1 -1
  22. package/dist/{chunk-ELOZI777.js → chunk-AOAOBZJQ.js} +18 -18
  23. package/dist/{chunk-BDUENQD3.js → chunk-CGA4ERJ5.js} +1 -1
  24. package/dist/chunk-CVHKLS7B.js +399 -0
  25. package/dist/{chunk-HWXQZCKV.js → chunk-CWTWZKWH.js} +7 -7
  26. package/dist/{chunk-23IKSW3E.js → chunk-FI5A2RF6.js} +1 -1
  27. package/dist/{chunk-FIMO3IDW.js → chunk-HKWEMKK4.js} +32 -4
  28. package/dist/{chunk-65QX23BY.js → chunk-HWXXFINO.js} +13 -13
  29. package/dist/{chunk-7RIHHVFN.js → chunk-IZSMYLCS.js} +11 -11
  30. package/dist/{chunk-URM4KBIU.js → chunk-JNYIJHFF.js} +1 -1
  31. package/dist/{chunk-JNK444WM.js → chunk-KUYIW4BD.js} +2 -2
  32. package/dist/{chunk-WYNLAO2K.js → chunk-M5QJJMFK.js} +4 -4
  33. package/dist/{chunk-V7YE4WCP.js → chunk-M63DETLL.js} +7 -4
  34. package/dist/{chunk-BOZCSRAR.js → chunk-MFFU45QO.js} +1 -1
  35. package/dist/{chunk-73XNLM4O.js → chunk-O2SUZKWU.js} +5 -5
  36. package/dist/{chunk-WF3WTELH.js → chunk-POF7HORW.js} +6 -6
  37. package/dist/{chunk-5Z7QQYHV.js → chunk-QHBHUCDS.js} +7 -7
  38. package/dist/{chunk-TMZOUVEP.js → chunk-SIOO3CCL.js} +1 -1
  39. package/dist/{chunk-MPLBAWGP.js → chunk-UC35XHGT.js} +2 -2
  40. package/dist/{chunk-VVQYG2GD.js → chunk-UTG3IY2C.js} +63 -100
  41. package/dist/{chunk-JJUZK6P2.js → chunk-VGWC4KG2.js} +5 -9
  42. package/dist/{chunk-YTVYU5IF.js → chunk-WCWPRFHZ.js} +1 -1
  43. package/dist/{chunk-ECBD46QI.js → chunk-WIUGVE66.js} +6 -6
  44. package/dist/{chunk-EPXPE5Y5.js → chunk-XHBYNJNZ.js} +2 -2
  45. package/dist/{chunk-ZXCVYSTS.js → chunk-Y5RRKS67.js} +5 -5
  46. package/dist/{chunk-5OUQCD2J.js → chunk-Y6DW6AVG.js} +1 -1
  47. package/dist/{chunk-N7V2WPZV.js → chunk-YURMXTZF.js} +1 -1
  48. package/dist/cli/chat.js +34 -34
  49. package/dist/cli/check.js +8 -8
  50. package/dist/cli/plugins.js +15 -15
  51. package/dist/cli/snapshot-create.js +14 -13
  52. package/dist/cli/upgrade.js +9 -9
  53. package/dist/db/schema/snapshots.d.ts +254 -0
  54. package/dist/db/schema/workspaces.d.ts +0 -68
  55. package/dist/db/schema.d.ts +251 -69
  56. package/dist/{db-CA3AJ2BU.js → db-EHCO5WGL.js} +8 -8
  57. package/dist/instrumentation.js +4 -4
  58. package/dist/nitro.js +2 -2
  59. package/dist/{oauth-callback-server-JVWWSDT5.js → oauth-callback-server-O7CH6FOJ.js} +25 -25
  60. package/dist/{runner-CMDQJDCH.js → runner-3D5AGGUD.js} +19 -15
  61. package/dist/{sandbox-egress-signals-U3ZX7C5W.js → sandbox-egress-signals-DXOOBSBI.js} +3 -3
  62. package/dist/{skills-GYJ4MBNQ.js → skills-6IW3DDW2.js} +8 -8
  63. package/dist/spawn-5LKOLABU.js +37 -0
  64. package/dist/{validation-55EBPZHH.js → validation-RCLP4EU4.js} +8 -8
  65. package/dist/version.js +1 -1
  66. package/dist/{work-N7CBTARL.js → work-L54N7O65.js} +21 -21
  67. package/dist/worker-VJCSXI5L.js +24 -0
  68. package/migrations/0032_workspace_snapshots_table.sql +69 -0
  69. package/migrations/meta/0032_snapshot.json +2892 -0
  70. package/migrations/meta/_journal.json +8 -1
  71. package/package.json +5 -5
  72. package/dist/catalog-runtime-BFDMFZV4.js +0 -16
  73. package/dist/chunk-BVREIWBD.js +0 -131
  74. package/dist/spawn-KSP4DKK6.js +0 -37
  75. package/dist/worker-CGMUVQ2Q.js +0 -24
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getTurnRequestDeadline
3
- } from "./chunk-OU2DMDUI.js";
3
+ } from "./chunk-4TKPTFSO.js";
4
4
  import {
5
5
  CONVERSATION_WORK_CHECK_IN_INTERVAL_MS,
6
6
  CONVERSATION_WORK_MAX_RETRIES,
@@ -21,20 +21,20 @@ import {
21
21
  releaseConversationWork,
22
22
  requestAnotherSlice,
23
23
  startConversationWork
24
- } from "./chunk-ZXCVYSTS.js";
24
+ } from "./chunk-Y5RRKS67.js";
25
25
  import {
26
26
  ConversationQueueMessageRejectedError
27
27
  } from "./chunk-JAL3CH4G.js";
28
28
  import {
29
29
  getChatConfig,
30
30
  isProviderRetryError
31
- } from "./chunk-MPLBAWGP.js";
31
+ } from "./chunk-UC35XHGT.js";
32
32
  import {
33
33
  logException,
34
34
  logInfo,
35
35
  logWarn,
36
36
  withLogContext
37
- } from "./chunk-FSH6HT5C.js";
37
+ } from "./chunk-6RRTVWAD.js";
38
38
 
39
39
  // src/chat/task-execution/worker.ts
40
40
  var CONVERSATION_WORK_DEFER_DELAY_MS = 15e3;
@@ -11,6 +11,7 @@ import { z as z2 } from "zod";
11
11
  var slackChannelIdSchema = z2.string().regex(/^[CDG][A-Z0-9]+$/).brand();
12
12
  var slackTeamIdSchema = z2.string().regex(/^T[A-Z0-9]+$/).brand();
13
13
  var slackUserIdSchema = z2.string().regex(/^[UW][A-Z0-9]+$/).brand();
14
+ var SLACK_CHANNEL_MENTION_RE = /^<#([CDG][A-Z0-9]+)(?:\|[^>]*)?>$/;
14
15
  function slackChannelReferenceCandidate(value) {
15
16
  const trimmed = value.trim();
16
17
  if (!trimmed.startsWith("slack:")) {
@@ -32,10 +33,12 @@ function parseSlackChannelId(value) {
32
33
  }
33
34
  function parseSlackChannelReferenceId(value) {
34
35
  if (typeof value !== "string") return void 0;
35
- const parsed = slackChannelIdSchema.safeParse(
36
- slackChannelReferenceCandidate(value)
37
- );
38
- return parsed.success ? parsed.data : void 0;
36
+ const trimmed = value.trim();
37
+ const mentionMatch = SLACK_CHANNEL_MENTION_RE.exec(trimmed);
38
+ if (mentionMatch?.[1]) {
39
+ return parseSlackChannelId(mentionMatch[1]);
40
+ }
41
+ return parseSlackChannelId(slackChannelReferenceCandidate(trimmed));
39
42
  }
40
43
  function parseSlackTeamId(value) {
41
44
  if (typeof value !== "string") return void 0;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getStateAdapter
3
- } from "./chunk-N7V2WPZV.js";
3
+ } from "./chunk-YURMXTZF.js";
4
4
  import {
5
5
  getClient
6
6
  } from "./chunk-6GWA276C.js";
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  persistConversationMessages
3
- } from "./chunk-ECBD46QI.js";
3
+ } from "./chunk-WIUGVE66.js";
4
4
  import {
5
5
  JUNIOR_THREAD_STATE_TTL_MS
6
6
  } from "./chunk-3Y47VMHV.js";
7
7
  import {
8
8
  getDb
9
- } from "./chunk-FIMO3IDW.js";
9
+ } from "./chunk-HKWEMKK4.js";
10
10
  import {
11
11
  juniorLocationConfigurations
12
- } from "./chunk-MKEHLCSM.js";
12
+ } from "./chunk-5GF7HQOP.js";
13
13
  import {
14
14
  getStateAdapter
15
- } from "./chunk-N7V2WPZV.js";
15
+ } from "./chunk-YURMXTZF.js";
16
16
  import {
17
17
  juniorDestinations
18
18
  } from "./chunk-VFUK3X5B.js";
@@ -20,7 +20,7 @@ import {
20
20
  isRecord,
21
21
  toOptionalNumber,
22
22
  toOptionalString
23
- } from "./chunk-FSH6HT5C.js";
23
+ } from "./chunk-6RRTVWAD.js";
24
24
 
25
25
  // src/chat/conversations/turn-lifecycle.ts
26
26
  var ConversationTurnLifecycleService = class {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  appendAndEnqueueInboundMessage
3
- } from "./chunk-ZXCVYSTS.js";
3
+ } from "./chunk-Y5RRKS67.js";
4
4
  import {
5
5
  ConversationTurnLifecycleService,
6
6
  getPersistedSandboxState,
7
7
  getPersistedThreadState,
8
8
  persistThreadStateById
9
- } from "./chunk-73XNLM4O.js";
9
+ } from "./chunk-O2SUZKWU.js";
10
10
  import {
11
11
  AgentInvocationBusyError,
12
12
  AgentInvocationLimitError,
@@ -15,7 +15,7 @@ import {
15
15
  agentBindingSchema,
16
16
  agentInvocationSchema,
17
17
  createAgentInvocationSchema
18
- } from "./chunk-5Z7QQYHV.js";
18
+ } from "./chunk-QHBHUCDS.js";
19
19
  import {
20
20
  TurnInputCommitLostError,
21
21
  failTurnRecord,
@@ -26,16 +26,16 @@ import {
26
26
  isTurnInputCommitLostError,
27
27
  openConversationProjection,
28
28
  saveTurnCheckpoint
29
- } from "./chunk-ECBD46QI.js";
29
+ } from "./chunk-WIUGVE66.js";
30
30
  import {
31
31
  getConversationEventStore,
32
32
  getConversationStore,
33
33
  getSqlExecutor
34
- } from "./chunk-FIMO3IDW.js";
34
+ } from "./chunk-HKWEMKK4.js";
35
35
  import {
36
36
  juniorAgentBindings,
37
37
  juniorAgentInvocations
38
- } from "./chunk-MKEHLCSM.js";
38
+ } from "./chunk-5GF7HQOP.js";
39
39
 
40
40
  // src/chat/agent-invocations/work.ts
41
41
  import { z } from "zod";
@@ -4,27 +4,27 @@ import {
4
4
  import {
5
5
  formatProviderLabel,
6
6
  startOAuthFlow
7
- } from "./chunk-HWXQZCKV.js";
7
+ } from "./chunk-CWTWZKWH.js";
8
8
  import {
9
9
  parseSandboxEgressAuthRequiredSignal
10
- } from "./chunk-7MA4HV4W.js";
10
+ } from "./chunk-6ZWRNC4D.js";
11
11
  import {
12
12
  abandonReplacedPendingAuth,
13
13
  canReusePendingAuthLink,
14
14
  recordAuthorizationRequested
15
- } from "./chunk-ECBD46QI.js";
15
+ } from "./chunk-WIUGVE66.js";
16
16
  import {
17
17
  AGENT_INVOCATION_MAILBOX_STATUSES
18
- } from "./chunk-MKEHLCSM.js";
18
+ } from "./chunk-5GF7HQOP.js";
19
19
  import {
20
20
  TURN_REASONING_LEVELS
21
- } from "./chunk-MPLBAWGP.js";
21
+ } from "./chunk-UC35XHGT.js";
22
22
  import {
23
23
  pluginCatalogRuntime
24
- } from "./chunk-TMZOUVEP.js";
24
+ } from "./chunk-SIOO3CCL.js";
25
25
  import {
26
26
  credentialContextSchema
27
- } from "./chunk-BDUENQD3.js";
27
+ } from "./chunk-CGA4ERJ5.js";
28
28
 
29
29
  // src/chat/services/auth-pause.ts
30
30
  var AuthorizationPauseError = class extends Error {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createPluginCatalogRuntime
3
- } from "./chunk-JNK444WM.js";
3
+ } from "./chunk-KUYIW4BD.js";
4
4
 
5
5
  // src/chat/plugins/catalog-runtime.ts
6
6
  var pluginCatalogRuntime = createPluginCatalogRuntime();
@@ -3,7 +3,7 @@ import {
3
3
  toCanonicalInputMessage,
4
4
  toCanonicalOutputMessage,
5
5
  toGenAiMessagesTraceAttributes
6
- } from "./chunk-23IKSW3E.js";
6
+ } from "./chunk-FI5A2RF6.js";
7
7
  import {
8
8
  extractGenAiUsageAttributes,
9
9
  logException,
@@ -11,7 +11,7 @@ import {
11
11
  normalizeGenAiFinishReason,
12
12
  serializeGenAiAttribute,
13
13
  withSpan
14
- } from "./chunk-FSH6HT5C.js";
14
+ } from "./chunk-6RRTVWAD.js";
15
15
 
16
16
  // src/chat/services/provider-error.ts
17
17
  var ProviderError = class extends Error {
@@ -7,7 +7,7 @@ import {
7
7
  PluginCredentialFailureError,
8
8
  agentNameSchema,
9
9
  createPluginAuthOrchestration
10
- } from "./chunk-5Z7QQYHV.js";
10
+ } from "./chunk-QHBHUCDS.js";
11
11
  import {
12
12
  authorizationId
13
13
  } from "./chunk-DIB4GX3G.js";
@@ -32,7 +32,7 @@ import {
32
32
  searchSlackUsers,
33
33
  selectPluginGrant,
34
34
  toMcpProviderError
35
- } from "./chunk-S6JDUILF.js";
35
+ } from "./chunk-5ML752HJ.js";
36
36
  import {
37
37
  RetryableDeliveryError,
38
38
  actorFromRun,
@@ -48,15 +48,14 @@ import {
48
48
  getSlackMessagePermalink,
49
49
  resolveBaseUrl,
50
50
  uploadFilesToConversation
51
- } from "./chunk-HWXQZCKV.js";
51
+ } from "./chunk-CWTWZKWH.js";
52
52
  import {
53
53
  parseSandboxEgressAuthRequiredSignal,
54
54
  parseSandboxEgressPermissionDeniedSignal,
55
55
  sandboxEgressCredentialContextSchema,
56
56
  sandboxEgressCredentialLeaseSchema
57
- } from "./chunk-7MA4HV4W.js";
57
+ } from "./chunk-6ZWRNC4D.js";
58
58
  import {
59
- SANDBOX_RUNTIME,
60
59
  SCHEDULED_TASK_SYSTEM_ACTOR,
61
60
  compactEventTask,
62
61
  createEventTask,
@@ -88,10 +87,10 @@ import {
88
87
  scheduledTaskAttributes,
89
88
  storeAttachments,
90
89
  writableEventTask
91
- } from "./chunk-JJUZK6P2.js";
90
+ } from "./chunk-VGWC4KG2.js";
92
91
  import {
93
92
  parseSlackThreadId
94
- } from "./chunk-EPXPE5Y5.js";
93
+ } from "./chunk-XHBYNJNZ.js";
95
94
  import {
96
95
  AGENTS_REMOVAL_NOTICE,
97
96
  AGENTS_REPLACEMENT_NOTICE,
@@ -162,17 +161,15 @@ import {
162
161
  stripRuntimeTurnContext,
163
162
  trimTrailingAssistantMessages,
164
163
  truncateText
165
- } from "./chunk-ECBD46QI.js";
164
+ } from "./chunk-WIUGVE66.js";
166
165
  import {
167
166
  JUNIOR_THREAD_STATE_TTL_MS
168
167
  } from "./chunk-3Y47VMHV.js";
169
168
  import {
170
169
  bindSandboxFileSystem,
171
170
  createSandboxSession,
172
- ensureDockerDaemon,
173
171
  getSandboxResources,
174
172
  getVercelSandboxCredentials,
175
- hash,
176
173
  isAlreadyExistsError,
177
174
  isMissingError,
178
175
  isSandboxCommandStreamInterruptedError,
@@ -183,11 +180,12 @@ import {
183
180
  stopSession,
184
181
  throwSandboxOperationError,
185
182
  wrapSandboxSetupError
186
- } from "./chunk-Q62IHFIH.js";
183
+ } from "./chunk-2AYWP7PZ.js";
187
184
  import {
188
185
  privateTraceResultAttributes
189
186
  } from "./chunk-UIE3R5XU.js";
190
187
  import {
188
+ SANDBOX_RUNTIME,
191
189
  SlackActionError,
192
190
  WorkspaceValidationError,
193
191
  createPluginHookRunner,
@@ -214,7 +212,7 @@ import {
214
212
  updateWorkspace,
215
213
  withSlackRetries,
216
214
  workspaceRepoCheckoutPath
217
- } from "./chunk-EEKFF74Y.js";
215
+ } from "./chunk-62WK6FLT.js";
218
216
  import {
219
217
  KNOWN_CONVERSATION_EVENT_TYPES,
220
218
  contextProvenance,
@@ -226,11 +224,11 @@ import {
226
224
  instructionActors,
227
225
  instructionProvenanceFor,
228
226
  sameActorIdentity
229
- } from "./chunk-FIMO3IDW.js";
227
+ } from "./chunk-HKWEMKK4.js";
230
228
  import {
231
229
  juniorArtifacts,
232
230
  juniorIdentities
233
- } from "./chunk-MKEHLCSM.js";
231
+ } from "./chunk-5GF7HQOP.js";
234
232
  import {
235
233
  SANDBOX_DATA_ROOT,
236
234
  SANDBOX_REPOS_ROOT,
@@ -238,15 +236,17 @@ import {
238
236
  SANDBOX_WORKSPACE_ROOT,
239
237
  buildCommandScript,
240
238
  buildNonInteractiveShellScript,
239
+ ensureDockerDaemon,
240
+ hash,
241
241
  runNonInteractiveCommand,
242
242
  sandboxSkillDir,
243
243
  sandboxSkillFile,
244
244
  sandboxSkillPathResolution,
245
245
  sleep
246
- } from "./chunk-BVREIWBD.js";
246
+ } from "./chunk-CVHKLS7B.js";
247
247
  import {
248
248
  getStateAdapter
249
- } from "./chunk-N7V2WPZV.js";
249
+ } from "./chunk-YURMXTZF.js";
250
250
  import {
251
251
  ACTIVE_TURN_COMPACTION_SUMMARY_PREFIX,
252
252
  COMPACTION_SUMMARY_PREFIX,
@@ -279,7 +279,7 @@ import {
279
279
  resolveGatewayCredential,
280
280
  resolveGatewayModel,
281
281
  unwrapCurrentInstruction
282
- } from "./chunk-MPLBAWGP.js";
282
+ } from "./chunk-UC35XHGT.js";
283
283
  import {
284
284
  canExposeConversationPayload,
285
285
  resolveConversationPrivacy,
@@ -289,16 +289,16 @@ import {
289
289
  toGenAiMessagesTraceAttributes,
290
290
  toGenAiPayloadMetadata,
291
291
  toGenAiPayloadTraceAttributes
292
- } from "./chunk-23IKSW3E.js";
292
+ } from "./chunk-FI5A2RF6.js";
293
293
  import {
294
294
  discoverSkills,
295
295
  findSkillByName,
296
296
  loadSkillsByName,
297
297
  parseSkillInvocation
298
- } from "./chunk-VRMPMOAT.js";
298
+ } from "./chunk-3AX2WCFV.js";
299
299
  import {
300
300
  pluginCatalogRuntime
301
- } from "./chunk-TMZOUVEP.js";
301
+ } from "./chunk-SIOO3CCL.js";
302
302
  import {
303
303
  CredentialUnavailableError,
304
304
  OAuthProviderError,
@@ -306,16 +306,18 @@ import {
306
306
  getOAuthProviderErrorAttributes,
307
307
  resolveAuthTokenPlaceholder,
308
308
  resolvePluginCommandEnv
309
- } from "./chunk-JNK444WM.js";
309
+ } from "./chunk-KUYIW4BD.js";
310
310
  import {
311
311
  credentialUserSubjectId
312
- } from "./chunk-BDUENQD3.js";
312
+ } from "./chunk-CGA4ERJ5.js";
313
313
  import {
314
314
  isUserActor,
315
315
  parseSlackChannelId,
316
+ parseSlackChannelReferenceId,
316
317
  parseSlackMessageTs,
318
+ parseSlackTeamId,
317
319
  parseSlackUserId
318
- } from "./chunk-V7YE4WCP.js";
320
+ } from "./chunk-M63DETLL.js";
319
321
  import {
320
322
  extractGenAiUsageAttributes,
321
323
  extractGenAiUsageSummary,
@@ -334,7 +336,7 @@ import {
334
336
  summarizeMessageText,
335
337
  withLogContext,
336
338
  withSpan
337
- } from "./chunk-FSH6HT5C.js";
339
+ } from "./chunk-6RRTVWAD.js";
338
340
  import {
339
341
  startInactiveSpan,
340
342
  withActiveSpan
@@ -9661,58 +9663,6 @@ async function joinPublicChannel(channelId) {
9661
9663
  { action: "conversations.join", idempotent: true }
9662
9664
  );
9663
9665
  }
9664
- async function listPublicChannels(input = {}) {
9665
- const client = getSlackClient();
9666
- const targetLimit = Math.max(1, Math.min(input.limit ?? 1e3, 1e3));
9667
- const maxPages = Math.max(1, Math.min(input.maxPages ?? 10, 20));
9668
- const channels = [];
9669
- let cursor;
9670
- let pages = 0;
9671
- while (channels.length < targetLimit && pages < maxPages) {
9672
- pages += 1;
9673
- const pageLimit = Math.max(1, Math.min(200, targetLimit - channels.length));
9674
- const response = await withSlackRetries(
9675
- () => client.conversations.list({
9676
- types: "public_channel",
9677
- exclude_archived: true,
9678
- limit: pageLimit,
9679
- cursor
9680
- }),
9681
- 3,
9682
- { action: "conversations.list", idempotent: true }
9683
- );
9684
- const batch = response.channels ?? [];
9685
- for (const item of batch) {
9686
- if (typeof item.id !== "string" || !item.id) {
9687
- continue;
9688
- }
9689
- if (item.is_private === true) {
9690
- continue;
9691
- }
9692
- channels.push({
9693
- id: item.id,
9694
- ...typeof item.name === "string" && item.name ? { name: item.name } : {},
9695
- ...typeof item.is_member === "boolean" ? { isMember: item.is_member } : {},
9696
- ...typeof item.is_archived === "boolean" ? { isArchived: item.is_archived } : {}
9697
- });
9698
- }
9699
- cursor = response.response_metadata?.next_cursor || void 0;
9700
- if (!cursor) {
9701
- break;
9702
- }
9703
- }
9704
- return channels.slice(0, targetLimit);
9705
- }
9706
- async function resolvePublicChannelByName(channelName) {
9707
- const normalized = channelName.trim().replace(/^#/, "").toLowerCase();
9708
- if (!normalized) {
9709
- return void 0;
9710
- }
9711
- const channels = await listPublicChannels();
9712
- return channels.find(
9713
- (channel) => channel.name?.trim().toLowerCase() === normalized
9714
- );
9715
- }
9716
9666
 
9717
9667
  // src/chat/slack/tool-support/channel-access.ts
9718
9668
  var DENIED_PRIVATE = "Cannot read this Slack conversation because it is private. Only the current conversation or public channels are readable.";
@@ -9806,44 +9756,47 @@ async function joinPublicChannelForRead(args) {
9806
9756
 
9807
9757
  // src/chat/slack/tool-support/channel-target.ts
9808
9758
  import { z as z35 } from "zod";
9809
- var slackChannelRefParam = z35.string().trim().min(1).max(80).describe("Slack channel ID or public channel name.");
9759
+ var SLACK_CHANNEL_REF_MAX_LENGTH = 160;
9760
+ var slackChannelRefParam = z35.string().trim().min(1).max(SLACK_CHANNEL_REF_MAX_LENGTH).describe(
9761
+ "Slack channel id (`C123`), mention (`<#C123>` / `<#C123|name>`), Junior slack reference (`slack:C123`), or a channel name Junior already knows in this workspace."
9762
+ );
9810
9763
  async function resolveSlackChannelRef(input) {
9811
9764
  const trimmed = input.value.trim();
9812
9765
  if (!trimmed) {
9813
9766
  throw new ToolInputError(
9814
- `Invalid \`${input.field}\`. Provide a Slack channel id like \`C123\` or a public channel name like \`#proj-foo\`.`
9767
+ `Invalid \`${input.field}\`. Use a channel id (\`C123\`), a Slack mention (\`<#C123>\`), a Junior slack reference (\`slack:C123\`), or a channel name Junior already knows.`
9815
9768
  );
9816
9769
  }
9817
- const channelId = parseSlackChannelId(trimmed);
9770
+ const channelId = parseSlackChannelReferenceId(trimmed);
9818
9771
  if (channelId) {
9772
+ return { channelId };
9773
+ }
9774
+ const known = await getConversationStore().findSlackDestinationByName({
9775
+ teamId: input.teamId,
9776
+ channelName: trimmed
9777
+ });
9778
+ const knownChannelId = known ? parseSlackChannelId(known.channelId) : void 0;
9779
+ if (known && knownChannelId) {
9819
9780
  return {
9820
- channelId,
9821
- resolvedFromName: false
9781
+ channelId: knownChannelId,
9782
+ ...known.channelName ? { channelName: known.channelName } : {}
9822
9783
  };
9823
9784
  }
9824
- const match = await resolvePublicChannelByName(trimmed);
9825
- if (!match) {
9826
- throw new ToolInputError(
9827
- `No public Slack channel named \`${trimmed}\` was found. Use an exact public channel name or a channel id.`
9828
- );
9829
- }
9830
- return {
9831
- channelId: match.id,
9832
- ...match.name ? { channelName: match.name } : {},
9833
- resolvedFromName: true
9834
- };
9785
+ throw new ToolInputError(
9786
+ `Unknown \`${input.field}\` \`${trimmed}\`. Use a channel id (\`C123\`), a Slack mention (\`<#C123>\`), a link, or a channel name Junior has already seen in this workspace. Public search can discover channels; plain names are not scanned from Slack.`
9787
+ );
9835
9788
  }
9836
9789
  async function resolveOptionalSlackChannelRef(input) {
9837
9790
  if (input.value !== void 0) {
9838
9791
  return resolveSlackChannelRef({
9839
9792
  field: input.field ?? "channel_id",
9840
- value: input.value
9793
+ value: input.value,
9794
+ teamId: input.teamId
9841
9795
  });
9842
9796
  }
9843
9797
  if (input.defaultChannelId) {
9844
9798
  return {
9845
- channelId: input.defaultChannelId,
9846
- resolvedFromName: false
9799
+ channelId: input.defaultChannelId
9847
9800
  };
9848
9801
  }
9849
9802
  throw new ToolInputError(
@@ -9869,7 +9822,8 @@ function createSlackChannelJoinTool(context) {
9869
9822
  execute: async ({ channel_id }) => {
9870
9823
  const target = await resolveSlackChannelRef({
9871
9824
  field: "channel_id",
9872
- value: channel_id
9825
+ value: channel_id,
9826
+ teamId: context.teamId
9873
9827
  });
9874
9828
  const access = await checkSlackChannelReadAccess({
9875
9829
  currentChannelIds: [
@@ -10013,7 +9967,8 @@ function createSlackChannelListMessagesTool(context) {
10013
9967
  const target = await resolveOptionalSlackChannelRef({
10014
9968
  field: "channel_id",
10015
9969
  value: channel_id,
10016
- defaultChannelId: context.destinationChannelId
9970
+ defaultChannelId: context.destinationChannelId,
9971
+ teamId: context.teamId
10017
9972
  });
10018
9973
  const targetChannelId = target.channelId;
10019
9974
  const access = await checkSlackChannelReadAccess({
@@ -10171,7 +10126,8 @@ async function resolveSearchFilters(input) {
10171
10126
  if (input.channel_id != null && input.channel_id.trim() !== "") {
10172
10127
  const target = await resolveSlackChannelRef({
10173
10128
  field: "channel_id",
10174
- value: input.channel_id
10129
+ value: input.channel_id,
10130
+ teamId: input.teamId
10175
10131
  });
10176
10132
  channelId = target.channelId;
10177
10133
  }
@@ -10216,7 +10172,13 @@ function createSlackConversationMessageSearchTool(scope, currentConversationId)
10216
10172
  }).strict(),
10217
10173
  outputSchema: conversationMessageSearchOutputSchema,
10218
10174
  execute: async (input) => {
10219
- const filters = await resolveSearchFilters(input);
10175
+ const teamId = parseSlackTeamId(scope.providerTenantId);
10176
+ if (!teamId) {
10177
+ throw new ToolInputError(
10178
+ "Cannot search retained messages without a valid Slack workspace id."
10179
+ );
10180
+ }
10181
+ const filters = await resolveSearchFilters({ ...input, teamId });
10220
10182
  const store = getConversationMessageSearchStore();
10221
10183
  const matches = await store.search({
10222
10184
  currentConversationId,
@@ -12093,7 +12055,8 @@ function createSlackThreadReadTool(context) {
12093
12055
  }
12094
12056
  const target = await resolveSlackChannelRef({
12095
12057
  field: "channel_id",
12096
- value: channel_id
12058
+ value: channel_id,
12059
+ teamId: context.teamId
12097
12060
  });
12098
12061
  channelId = target.channelId;
12099
12062
  messageTs = parsedTs.value;
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  ToolInputError
3
- } from "./chunk-ECBD46QI.js";
3
+ } from "./chunk-WIUGVE66.js";
4
4
  import {
5
5
  canRouteResourceEvents,
6
6
  getPlugins
7
- } from "./chunk-EEKFF74Y.js";
7
+ } from "./chunk-62WK6FLT.js";
8
8
  import {
9
9
  getDb
10
- } from "./chunk-FIMO3IDW.js";
10
+ } from "./chunk-HKWEMKK4.js";
11
11
  import {
12
12
  juniorAttachments,
13
13
  juniorConversations,
@@ -15,16 +15,13 @@ import {
15
15
  juniorSchedulerRuns,
16
16
  juniorSchedulerTasks,
17
17
  juniorStats
18
- } from "./chunk-MKEHLCSM.js";
18
+ } from "./chunk-5GF7HQOP.js";
19
19
  import {
20
20
  juniorDestinations
21
21
  } from "./chunk-VFUK3X5B.js";
22
22
  import {
23
23
  logInfo
24
- } from "./chunk-FSH6HT5C.js";
25
-
26
- // src/chat/sandbox/snapshot/runtime.ts
27
- var SANDBOX_RUNTIME = "node22";
24
+ } from "./chunk-6RRTVWAD.js";
28
25
 
29
26
  // src/chat/event-tasks/store.ts
30
27
  import { and, asc, desc, eq, inArray, or, sql } from "drizzle-orm";
@@ -1902,7 +1899,6 @@ export {
1902
1899
  juniorToolOutputSchema,
1903
1900
  injectContinuationToolName,
1904
1901
  makeStructuredToolOutput,
1905
- SANDBOX_RUNTIME,
1906
1902
  eventNamespaceSchema,
1907
1903
  registeredEventTypeSchema,
1908
1904
  registeredResourceTypeSchema,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  JUNIOR_VERSION
3
- } from "./chunk-5OUQCD2J.js";
3
+ } from "./chunk-Y6DW6AVG.js";
4
4
 
5
5
  // src/deployment.ts
6
6
  var JUNIOR_HEARTBEAT_ROUTE = "/api/internal/heartbeat";
@@ -13,35 +13,35 @@ import {
13
13
  instructionProvenanceFor,
14
14
  sanitizePostgresJson,
15
15
  withConversationEventLock
16
- } from "./chunk-FIMO3IDW.js";
16
+ } from "./chunk-HKWEMKK4.js";
17
17
  import {
18
18
  SANDBOX_REPOS_ROOT,
19
19
  SANDBOX_WORKSPACE_ROOT,
20
20
  sleep
21
- } from "./chunk-BVREIWBD.js";
21
+ } from "./chunk-CVHKLS7B.js";
22
22
  import {
23
23
  MUTATION_LOCK_TTL_MS,
24
24
  fenceLock,
25
25
  getStateAdapter,
26
26
  withLock
27
- } from "./chunk-N7V2WPZV.js";
27
+ } from "./chunk-YURMXTZF.js";
28
28
  import {
29
29
  botConfig,
30
30
  completeText,
31
31
  escapeXml,
32
32
  resolveGatewayModel,
33
33
  unwrapCurrentInstruction
34
- } from "./chunk-MPLBAWGP.js";
34
+ } from "./chunk-UC35XHGT.js";
35
35
  import {
36
36
  parseSlackMessageTs,
37
37
  toStoredSlackActor
38
- } from "./chunk-V7YE4WCP.js";
38
+ } from "./chunk-M63DETLL.js";
39
39
  import {
40
40
  getActiveTraceId,
41
41
  logException,
42
42
  logWarn,
43
43
  setSpanAttributes
44
- } from "./chunk-FSH6HT5C.js";
44
+ } from "./chunk-6RRTVWAD.js";
45
45
 
46
46
  // src/chat/turn-context-tag.ts
47
47
  var TURN_CONTEXT_TAG = "runtime-turn-context";
@@ -2,10 +2,10 @@ import {
2
2
  parseSlackChannelId,
3
3
  parseSlackMessageTs,
4
4
  parseSlackTeamId
5
- } from "./chunk-V7YE4WCP.js";
5
+ } from "./chunk-M63DETLL.js";
6
6
  import {
7
7
  toOptionalString
8
- } from "./chunk-FSH6HT5C.js";
8
+ } from "./chunk-6RRTVWAD.js";
9
9
 
10
10
  // src/chat/slack/context.ts
11
11
  import { z } from "zod";