@sentry/junior 0.174.0 → 0.176.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 (62) hide show
  1. package/dist/{agent-hooks-HBZUWB4D.js → agent-hooks-ZPCHKYXI.js} +13 -12
  2. package/dist/api.js +27 -27
  3. package/dist/app.js +272 -344
  4. package/dist/{catalog-runtime-J3R3LC7Y.js → catalog-runtime-3Z2Y5IP6.js} +5 -5
  5. package/dist/chat/agent-dispatch/heartbeat.d.ts +1 -1
  6. package/dist/chat/agent-dispatch/store.d.ts +3 -16
  7. package/dist/chat/resource-events/catalog.d.ts +2 -0
  8. package/dist/chat/resource-events/notification.d.ts +1 -1
  9. package/dist/chat/resource-events/tool-support.d.ts +4 -0
  10. package/dist/{chunk-47LO5GDT.js → chunk-2N7YRFMW.js} +12 -12
  11. package/dist/{chunk-RL23S5DG.js → chunk-5JB5JJO5.js} +1 -1
  12. package/dist/{chunk-2BNKQSPC.js → chunk-64EGCW34.js} +8 -16
  13. package/dist/{chunk-DIW6IQYK.js → chunk-665JOQEP.js} +6 -6
  14. package/dist/{chunk-WEL4NWRR.js → chunk-6NQJQP7O.js} +5 -5
  15. package/dist/{chunk-5EWBGDW2.js → chunk-AJEZETLT.js} +1 -1
  16. package/dist/{chunk-GWZBBIV6.js → chunk-B65VEBJV.js} +2 -2
  17. package/dist/{chunk-HJFWO72I.js → chunk-B6IOTX7W.js} +1 -1
  18. package/dist/{chunk-T5VGNZ7F.js → chunk-B7U2QBMT.js} +16 -58
  19. package/dist/{chunk-ZBWAXCR3.js → chunk-BNGK2J6X.js} +1 -1
  20. package/dist/{chunk-IYI7RPHU.js → chunk-CI4JX64I.js} +1 -1
  21. package/dist/{chunk-XOXKL2DL.js → chunk-CNC65LIX.js} +1 -1
  22. package/dist/{chunk-4ALVTB7F.js → chunk-COFZR2CO.js} +1 -1
  23. package/dist/{chunk-KIU7RKE5.js → chunk-CTYWFV6L.js} +6 -6
  24. package/dist/{chunk-VZFLAGFK.js → chunk-CUA5SZR5.js} +1 -1
  25. package/dist/{chunk-2E353AHN.js → chunk-DVHYQDGM.js} +1 -1
  26. package/dist/{chunk-BFNNCBTK.js → chunk-FNOLPLXJ.js} +4 -4
  27. package/dist/{chunk-GX2ISGLH.js → chunk-GYRGJVWR.js} +472 -903
  28. package/dist/{chunk-FFUNPZA2.js → chunk-H7KTMGNI.js} +1 -1
  29. package/dist/{chunk-OTAPFODZ.js → chunk-IPOB6IL5.js} +98 -96
  30. package/dist/{chunk-JVORBSUR.js → chunk-JHCAX7XY.js} +3 -3
  31. package/dist/{chunk-BLBKORDG.js → chunk-JIZ3RFER.js} +505 -11
  32. package/dist/{chunk-DRRUFZKZ.js → chunk-KYHHJ6LS.js} +1 -1
  33. package/dist/{chunk-N7Y3T47I.js → chunk-OKXHYVKE.js} +4 -4
  34. package/dist/{chunk-REUKFWLH.js → chunk-PS3ZPRL2.js} +1 -1
  35. package/dist/{chunk-7V25DLCB.js → chunk-Q374NKGS.js} +8 -8
  36. package/dist/{chunk-W6HVH5JJ.js → chunk-RSIHA3XC.js} +5 -5
  37. package/dist/{chunk-Z23POK2V.js → chunk-SBIQ5MZW.js} +1 -1
  38. package/dist/{chunk-WH7F67EN.js → chunk-SGLLADGQ.js} +17 -17
  39. package/dist/{chunk-AJMUVCXW.js → chunk-VUAHVGPY.js} +4 -4
  40. package/dist/{chunk-6FWEUJGH.js → chunk-VVLQGGJJ.js} +1 -1
  41. package/dist/{chunk-OXYAEFKS.js → chunk-Z2YZ6QLG.js} +2 -2
  42. package/dist/cli/chat.js +31 -31
  43. package/dist/cli/check.js +6 -6
  44. package/dist/cli/plugins.js +14 -13
  45. package/dist/cli/snapshot-create.js +10 -10
  46. package/dist/cli/upgrade.js +7 -7
  47. package/dist/{db-6JOWUGLP.js → db-63K2IY36.js} +7 -7
  48. package/dist/instrumentation.js +4 -4
  49. package/dist/nitro.js +2 -2
  50. package/dist/{oauth-callback-server-ZLOKNXOW.js → oauth-callback-server-JZXBDXGO.js} +24 -24
  51. package/dist/{runner-YD4J2GBE.js → runner-3KWZJVK6.js} +16 -16
  52. package/dist/{skills-YMSY2LFN.js → skills-TFQQ3WSE.js} +6 -6
  53. package/dist/spawn-3GVQNWFH.js +37 -0
  54. package/dist/{validation-KAOZ7UHD.js → validation-RKLSF2UH.js} +6 -6
  55. package/dist/version.js +1 -1
  56. package/dist/{work-ILZ3L7AD.js → work-RKDS3J2X.js} +19 -19
  57. package/dist/worker-5RJNDPYW.js +24 -0
  58. package/package.json +4 -4
  59. package/dist/chat/agent-dispatch/signing.d.ts +0 -14
  60. package/dist/handlers/agent-dispatch.d.ts +0 -12
  61. package/dist/spawn-ZVO5IUCR.js +0 -37
  62. package/dist/worker-D34ZL6RU.js +0 -24
@@ -7,7 +7,7 @@ import {
7
7
  PluginCredentialFailureError,
8
8
  agentNameSchema,
9
9
  createPluginAuthOrchestration
10
- } from "./chunk-W6HVH5JJ.js";
10
+ } from "./chunk-RSIHA3XC.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-7V25DLCB.js";
35
+ } from "./chunk-Q374NKGS.js";
36
36
  import {
37
37
  RetryableDeliveryError,
38
38
  actorFromRun,
@@ -48,7 +48,7 @@ import {
48
48
  getSlackMessagePermalink,
49
49
  resolveBaseUrl,
50
50
  uploadFilesToConversation
51
- } from "./chunk-DIW6IQYK.js";
51
+ } from "./chunk-665JOQEP.js";
52
52
  import {
53
53
  parseSandboxEgressAuthRequiredSignal,
54
54
  parseSandboxEgressPermissionDeniedSignal,
@@ -87,10 +87,10 @@ import {
87
87
  scheduledTaskAttributes,
88
88
  storeAttachments,
89
89
  writableEventTask
90
- } from "./chunk-OTAPFODZ.js";
90
+ } from "./chunk-IPOB6IL5.js";
91
91
  import {
92
92
  parseSlackThreadId
93
- } from "./chunk-5EWBGDW2.js";
93
+ } from "./chunk-AJEZETLT.js";
94
94
  import {
95
95
  AGENTS_REMOVAL_NOTICE,
96
96
  AGENTS_REPLACEMENT_NOTICE,
@@ -101,7 +101,6 @@ import {
101
101
  RIPGREP_EXCLUDED_GLOBS,
102
102
  SHORT_TITLE_MAX_LENGTH,
103
103
  TURN_CONTEXT_TAG,
104
- ToolInputError,
105
104
  TurnInputCommitLostError,
106
105
  TurnSliceLimitExceededError,
107
106
  abandonReplacedPendingAuth,
@@ -161,10 +160,7 @@ import {
161
160
  stripRuntimeTurnContext,
162
161
  trimTrailingAssistantMessages,
163
162
  truncateText
164
- } from "./chunk-2BNKQSPC.js";
165
- import {
166
- JUNIOR_THREAD_STATE_TTL_MS
167
- } from "./chunk-3Y47VMHV.js";
163
+ } from "./chunk-64EGCW34.js";
168
164
  import {
169
165
  bindSandboxFileSystem,
170
166
  createSandboxSession,
@@ -180,15 +176,24 @@ import {
180
176
  stopSession,
181
177
  throwSandboxOperationError,
182
178
  wrapSandboxSetupError
183
- } from "./chunk-BFNNCBTK.js";
179
+ } from "./chunk-FNOLPLXJ.js";
184
180
  import {
185
181
  privateTraceResultAttributes
186
182
  } from "./chunk-UIE3R5XU.js";
187
183
  import {
184
+ RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS,
185
+ RESOURCE_SUBSCRIPTION_MAX_TTL_MS,
186
+ RESOURCE_WATCH_TOOL_SOURCE,
188
187
  SANDBOX_RUNTIME,
188
+ STOP_WATCHING_TOOL_NAME,
189
189
  SlackActionError,
190
+ ToolInputError,
190
191
  WorkspaceValidationError,
192
+ canUseResourceEventSubscriptionTools,
193
+ cancelResourceEventSubscription,
194
+ cancelSubscriptions,
191
195
  createPluginHookRunner,
196
+ createResourceEventSubscription,
192
197
  createWorkspace,
193
198
  deleteWorkspace,
194
199
  downloadPrivateSlackFile,
@@ -203,16 +208,18 @@ import {
203
208
  getWorkspace,
204
209
  getWorkspaceByName,
205
210
  isConversationScopedChannel,
211
+ listResourceEventSubscriptions,
206
212
  listWorkspaces,
207
213
  normalizeSlackConversationId,
208
214
  readActorIdentity,
209
215
  recordResolvedWorkspaceSnapshot,
216
+ requireResourceWatchConversation,
210
217
  resolveChannelCapabilities,
211
218
  tryWorkspaceRepoCheckoutPath,
212
219
  updateWorkspace,
213
220
  withSlackRetries,
214
221
  workspaceRepoCheckoutPath
215
- } from "./chunk-BLBKORDG.js";
222
+ } from "./chunk-JIZ3RFER.js";
216
223
  import {
217
224
  KNOWN_CONVERSATION_EVENT_TYPES,
218
225
  contextProvenance,
@@ -224,11 +231,11 @@ import {
224
231
  instructionActors,
225
232
  instructionProvenanceFor,
226
233
  sameActorIdentity
227
- } from "./chunk-JVORBSUR.js";
234
+ } from "./chunk-JHCAX7XY.js";
228
235
  import {
229
236
  juniorArtifacts,
230
237
  juniorIdentities
231
- } from "./chunk-VZFLAGFK.js";
238
+ } from "./chunk-CUA5SZR5.js";
232
239
  import {
233
240
  SANDBOX_DATA_ROOT,
234
241
  SANDBOX_REPOS_ROOT,
@@ -243,10 +250,10 @@ import {
243
250
  sandboxSkillFile,
244
251
  sandboxSkillPathResolution,
245
252
  sleep
246
- } from "./chunk-XOXKL2DL.js";
253
+ } from "./chunk-CNC65LIX.js";
247
254
  import {
248
255
  getStateAdapter
249
- } from "./chunk-HJFWO72I.js";
256
+ } from "./chunk-B6IOTX7W.js";
250
257
  import {
251
258
  ACTIVE_TURN_COMPACTION_SUMMARY_PREFIX,
252
259
  COMPACTION_SUMMARY_PREFIX,
@@ -279,7 +286,7 @@ import {
279
286
  resolveGatewayCredential,
280
287
  resolveGatewayModel,
281
288
  unwrapCurrentInstruction
282
- } from "./chunk-OXYAEFKS.js";
289
+ } from "./chunk-Z2YZ6QLG.js";
283
290
  import {
284
291
  canExposeConversationPayload,
285
292
  resolveConversationPrivacy,
@@ -289,16 +296,16 @@ import {
289
296
  toGenAiMessagesTraceAttributes,
290
297
  toGenAiPayloadMetadata,
291
298
  toGenAiPayloadTraceAttributes
292
- } from "./chunk-FFUNPZA2.js";
299
+ } from "./chunk-H7KTMGNI.js";
293
300
  import {
294
301
  discoverSkills,
295
302
  findSkillByName,
296
303
  loadSkillsByName,
297
304
  parseSkillInvocation
298
- } from "./chunk-GWZBBIV6.js";
305
+ } from "./chunk-B65VEBJV.js";
299
306
  import {
300
307
  pluginCatalogRuntime
301
- } from "./chunk-RL23S5DG.js";
308
+ } from "./chunk-5JB5JJO5.js";
302
309
  import {
303
310
  CredentialUnavailableError,
304
311
  OAuthProviderError,
@@ -306,7 +313,7 @@ import {
306
313
  getOAuthProviderErrorAttributes,
307
314
  resolveAuthTokenPlaceholder,
308
315
  resolvePluginCommandEnv
309
- } from "./chunk-IYI7RPHU.js";
316
+ } from "./chunk-CI4JX64I.js";
310
317
  import {
311
318
  credentialUserSubjectId
312
319
  } from "./chunk-CGA4ERJ5.js";
@@ -336,7 +343,7 @@ import {
336
343
  summarizeMessageText,
337
344
  withLogContext,
338
345
  withSpan
339
- } from "./chunk-Z23POK2V.js";
346
+ } from "./chunk-SBIQ5MZW.js";
340
347
  import {
341
348
  startInactiveSpan,
342
349
  withActiveSpan
@@ -7555,452 +7562,19 @@ function createSpawnAgentTool(spawnAgent) {
7555
7562
  });
7556
7563
  }
7557
7564
 
7558
- // src/chat/resource-events/tool-support.ts
7559
- var STOP_WATCHING_TOOL_NAME = "stopWatchingResources";
7560
- var RESOURCE_WATCH_TOOL_SOURCE = {
7561
- id: "resource-watches",
7562
- description: "Inspect or stop resource watches for the current conversation."
7563
- };
7564
- function requireResourceWatchConversation(context) {
7565
- if (!context.conversationId) {
7566
- throw new ToolInputError(
7567
- "Resource event subscriptions require a conversation"
7568
- );
7569
- }
7570
- if (context.destination.platform !== "slack") {
7571
- throw new ToolInputError(
7572
- "Resource event subscriptions currently require Slack delivery"
7573
- );
7574
- }
7575
- if (!isSlackThreadConversationId(context.conversationId)) {
7576
- throw new ToolInputError(
7577
- "Resource event subscriptions require a Slack thread conversation"
7578
- );
7579
- }
7580
- return context.conversationId;
7581
- }
7582
- function canUseResourceEventSubscriptionTools(context) {
7583
- return context.destination.platform === "slack" && Boolean(
7584
- context.conversationId && isSlackThreadConversationId(context.conversationId)
7585
- );
7586
- }
7587
- function isSlackThreadConversationId(conversationId) {
7588
- const parts = conversationId.split(":");
7589
- return parts.length === 3 && parts[0] === "slack" && Boolean(parts[1]) && Boolean(parts[2]);
7590
- }
7591
-
7592
7565
  // src/chat/tools/list-resource-event-subscriptions.ts
7593
- import { z as z19 } from "zod";
7594
-
7595
- // src/chat/resource-events/store.ts
7596
- import { createHash } from "crypto";
7597
- import {
7598
- destinationSchema,
7599
- resourceEventTypeSchema
7600
- } from "@sentry/junior-plugin-api";
7601
7566
  import { z as z18 } from "zod";
7602
- var RESOURCE_EVENT_PREFIX = "junior:resource_event_subscription:v3";
7603
- var INDEX_LOCK_TTL_MS = 1e4;
7604
- var SUBSCRIPTION_LOCK_TTL_MS = 1e4;
7605
- var SUBSCRIPTION_LOCK_WAIT_MS = 1e4;
7606
- var SUBSCRIPTION_LOCK_RETRY_MS = 25;
7607
- var SUBSCRIPTION_LOCK_HEARTBEAT_MS = 3e3;
7608
- var subscriptionStatusSchema = z18.enum(["active", "cancelled", "completed"]);
7609
- var subscriptionIdIndexSchema = z18.array(z18.string().min(1));
7610
- var subscriptionSchema = z18.object({
7611
- conversationId: z18.string().min(1),
7612
- createdAtMs: z18.number().finite(),
7613
- destination: destinationSchema,
7614
- events: z18.array(resourceEventTypeSchema).min(1),
7615
- expiresAtMs: z18.number().finite(),
7567
+ var listedResourceWatchSchema = z18.object({
7616
7568
  id: z18.string().min(1),
7617
- intent: z18.string().min(1),
7618
7569
  label: z18.string().min(1),
7619
- namespace: z18.string().min(1),
7620
7570
  identifier: z18.string().min(1),
7571
+ namespace: z18.string().min(1),
7621
7572
  resourceType: z18.string().min(1),
7622
- status: subscriptionStatusSchema,
7623
- updatedAtMs: z18.number().finite()
7624
- }).strict();
7625
- function digest(value) {
7626
- return createHash("sha256").update(value).digest("hex").slice(0, 32);
7627
- }
7628
- function subscriptionKey(id) {
7629
- return `${RESOURCE_EVENT_PREFIX}:record:${id}`;
7630
- }
7631
- function subscriptionLockKey(id) {
7632
- return `${RESOURCE_EVENT_PREFIX}:lock:${id}`;
7633
- }
7634
- function resourceIndexKey(teamId, namespace, identifier) {
7635
- return `${RESOURCE_EVENT_PREFIX}:resource:${digest(`${teamId}\0${namespace}\0${identifier}`)}`;
7636
- }
7637
- function subscriptionTeamId(destination) {
7638
- if (destination.platform !== "slack") {
7639
- throw new Error("Resource event subscriptions require a Slack destination");
7640
- }
7641
- return destination.teamId;
7642
- }
7643
- function conversationIndexKey(conversationId) {
7644
- return `${RESOURCE_EVENT_PREFIX}:conversation:${digest(conversationId)}`;
7645
- }
7646
- function indexLockKey(key) {
7647
- return `${key}:lock`;
7648
- }
7649
- async function sleep2(ms) {
7650
- await new Promise((resolve2) => {
7651
- const timer = setTimeout(resolve2, ms);
7652
- timer.unref?.();
7653
- });
7654
- }
7655
- async function acquireSubscriptionLock(state, subscriptionId, waitDeadlineMs = Date.now() + SUBSCRIPTION_LOCK_WAIT_MS) {
7656
- while (true) {
7657
- const lock = await state.acquireLock(
7658
- subscriptionLockKey(subscriptionId),
7659
- SUBSCRIPTION_LOCK_TTL_MS
7660
- );
7661
- if (lock) {
7662
- return lock;
7663
- }
7664
- if (Date.now() >= waitDeadlineMs) {
7665
- throw new Error(
7666
- `Could not acquire resource event subscription lock for ${subscriptionId}`
7667
- );
7668
- }
7669
- await sleep2(SUBSCRIPTION_LOCK_RETRY_MS);
7670
- }
7671
- }
7672
- async function withSubscriptionLock(state, subscriptionId, callback, waitDeadlineMs) {
7673
- const lock = await acquireSubscriptionLock(
7674
- state,
7675
- subscriptionId,
7676
- waitDeadlineMs
7677
- );
7678
- let lockLostError;
7679
- let heartbeatError;
7680
- let heartbeat;
7681
- const timer = setInterval(() => {
7682
- if (heartbeat) {
7683
- return;
7684
- }
7685
- heartbeat = state.extendLock(lock, SUBSCRIPTION_LOCK_TTL_MS).then((extended) => {
7686
- if (extended) {
7687
- heartbeatError = void 0;
7688
- } else {
7689
- lockLostError = new Error(
7690
- `Resource event subscription lock was lost for ${subscriptionId}`
7691
- );
7692
- }
7693
- }).catch((error) => {
7694
- heartbeatError = error instanceof Error ? error : new Error(`Failed to extend subscription lock: ${String(error)}`);
7695
- }).finally(() => {
7696
- heartbeat = void 0;
7697
- });
7698
- }, SUBSCRIPTION_LOCK_HEARTBEAT_MS);
7699
- timer.unref?.();
7700
- let result;
7701
- try {
7702
- result = await callback();
7703
- } finally {
7704
- clearInterval(timer);
7705
- await heartbeat;
7706
- await state.releaseLock(lock);
7707
- }
7708
- const lockError = lockLostError ?? heartbeatError;
7709
- if (lockError) {
7710
- throw lockError;
7711
- }
7712
- return result;
7713
- }
7714
- function ttlUntil(expiresAtMs, nowMs) {
7715
- return Math.max(1, expiresAtMs - nowMs);
7716
- }
7717
- async function readSubscriptionIdIndex(state, key) {
7718
- const value = await state.get(key);
7719
- if (value === void 0 || value === null) {
7720
- return [];
7721
- }
7722
- return subscriptionIdIndexSchema.parse(value);
7723
- }
7724
- function buildSubscriptionId(input) {
7725
- const eventKey = [...new Set(input.events)].sort().join("\0");
7726
- return `resub_${digest(
7727
- `${input.teamId}\0${input.namespace}\0${input.identifier}\0${input.conversationId}\0${eventKey}`
7728
- )}`;
7729
- }
7730
- async function withIndexLock(state, key, callback) {
7731
- const lock = await state.acquireLock(indexLockKey(key), INDEX_LOCK_TTL_MS);
7732
- if (!lock) {
7733
- throw new Error(`Could not acquire resource event index lock for ${key}`);
7734
- }
7735
- try {
7736
- return await callback();
7737
- } finally {
7738
- await state.releaseLock(lock);
7739
- }
7740
- }
7741
- async function addToIndex(state, key, subscriptionId, nowMs) {
7742
- await withIndexLock(state, key, async () => {
7743
- const ids = [...new Set(await readSubscriptionIdIndex(state, key))];
7744
- const next = ids.includes(subscriptionId) ? ids : [...ids, subscriptionId];
7745
- await state.set(key, next, await indexTtlMs(state, next, nowMs));
7746
- });
7747
- }
7748
- async function removeFromIndex(state, key, subscriptionId, nowMs) {
7749
- await withIndexLock(state, key, async () => {
7750
- const existing = await readSubscriptionIdIndex(state, key);
7751
- const next = existing.filter((id) => id !== subscriptionId);
7752
- await state.set(key, next, await indexTtlMs(state, next, nowMs));
7753
- });
7754
- }
7755
- async function indexTtlMs(state, subscriptionIds, nowMs) {
7756
- const records = await Promise.all(
7757
- subscriptionIds.map(
7758
- async (id) => parseSubscription(await state.get(subscriptionKey(id)))
7759
- )
7760
- );
7761
- const latestExpiresAtMs = Math.max(
7762
- nowMs,
7763
- ...records.filter(
7764
- (record2) => record2 !== void 0 && activeAt(record2, nowMs)
7765
- ).map((record2) => record2.expiresAtMs)
7766
- );
7767
- return ttlUntil(latestExpiresAtMs, nowMs);
7768
- }
7769
- function parseSubscription(value) {
7770
- if (value === void 0 || value === null) {
7771
- return void 0;
7772
- }
7773
- return subscriptionSchema.parse(value);
7774
- }
7775
- function activeAt(subscription, nowMs) {
7776
- return subscription.status === "active" && subscription.expiresAtMs > nowMs;
7777
- }
7778
- function matchesEvent(subscription, input) {
7779
- return subscription.namespace === input.namespace && subscription.identifier === input.identifier && subscriptionTeamId(subscription.destination) === input.teamId && subscription.events.includes(input.eventType) && activeAt(subscription, input.nowMs);
7780
- }
7781
- async function createResourceEventSubscription(input, options = {}) {
7782
- const state = options.state ?? getStateAdapter();
7783
- await state.connect();
7784
- const nowMs = options.nowMs ?? Date.now();
7785
- const events = [...new Set(input.events.map((event) => event.trim()))].filter(
7786
- Boolean
7787
- );
7788
- if (events.length === 0) {
7789
- throw new Error("Resource event subscription requires at least one event");
7790
- }
7791
- if (input.expiresAtMs <= nowMs) {
7792
- throw new Error("Resource event subscription expiry must be in the future");
7793
- }
7794
- const id = buildSubscriptionId({
7795
- conversationId: input.conversationId,
7796
- events,
7797
- namespace: input.namespace,
7798
- identifier: input.identifier,
7799
- teamId: subscriptionTeamId(input.destination)
7800
- });
7801
- const record2 = {
7802
- conversationId: input.conversationId,
7803
- createdAtMs: nowMs,
7804
- destination: input.destination,
7805
- events,
7806
- expiresAtMs: input.expiresAtMs,
7807
- id,
7808
- intent: input.intent,
7809
- label: input.label,
7810
- namespace: input.namespace,
7811
- identifier: input.identifier,
7812
- resourceType: input.resourceType,
7813
- status: "active",
7814
- updatedAtMs: nowMs
7815
- };
7816
- const parsed = subscriptionSchema.parse(record2);
7817
- await state.set(
7818
- subscriptionKey(id),
7819
- parsed,
7820
- ttlUntil(parsed.expiresAtMs, nowMs)
7821
- );
7822
- await addToIndex(
7823
- state,
7824
- resourceIndexKey(
7825
- subscriptionTeamId(parsed.destination),
7826
- input.namespace,
7827
- input.identifier
7828
- ),
7829
- id,
7830
- nowMs
7831
- );
7832
- await addToIndex(
7833
- state,
7834
- conversationIndexKey(input.conversationId),
7835
- id,
7836
- nowMs
7837
- );
7838
- return parsed;
7839
- }
7840
- async function listResourceEventSubscriptions(input) {
7841
- const state = input.state ?? getStateAdapter();
7842
- await state.connect();
7843
- const nowMs = input.nowMs ?? Date.now();
7844
- const ids = await readSubscriptionIdIndex(
7845
- state,
7846
- conversationIndexKey(input.conversationId)
7847
- );
7848
- const records = await Promise.all(
7849
- ids.map(
7850
- async (id) => parseSubscription(await state.get(subscriptionKey(id)))
7851
- )
7852
- );
7853
- return records.filter(
7854
- (record2) => record2 !== void 0 && record2.conversationId === input.conversationId && activeAt(record2, nowMs)
7855
- ).sort((left, right) => left.createdAtMs - right.createdAtMs);
7856
- }
7857
- async function cancelResourceEventSubscription(input) {
7858
- const state = input.state ?? getStateAdapter();
7859
- await state.connect();
7860
- return await withSubscriptionLock(state, input.id, async () => {
7861
- const current = parseSubscription(
7862
- await state.get(subscriptionKey(input.id))
7863
- );
7864
- if (!current || current.conversationId !== input.conversationId) {
7865
- return void 0;
7866
- }
7867
- const nowMs = input.nowMs ?? Date.now();
7868
- const next = {
7869
- ...current,
7870
- status: "cancelled",
7871
- updatedAtMs: nowMs
7872
- };
7873
- await state.set(
7874
- subscriptionKey(input.id),
7875
- next,
7876
- JUNIOR_THREAD_STATE_TTL_MS
7877
- );
7878
- await removeFromIndex(
7879
- state,
7880
- resourceIndexKey(
7881
- subscriptionTeamId(current.destination),
7882
- current.namespace,
7883
- current.identifier
7884
- ),
7885
- input.id,
7886
- nowMs
7887
- );
7888
- await removeFromIndex(
7889
- state,
7890
- conversationIndexKey(current.conversationId),
7891
- input.id,
7892
- nowMs
7893
- );
7894
- return next;
7895
- });
7896
- }
7897
- async function cancelSubscriptions(input) {
7898
- const subscriptions = await listResourceEventSubscriptions(input);
7899
- for (const subscription of subscriptions) {
7900
- await cancelResourceEventSubscription({
7901
- conversationId: input.conversationId,
7902
- id: subscription.id,
7903
- nowMs: input.nowMs,
7904
- state: input.state
7905
- });
7906
- }
7907
- }
7908
- async function findMatchingResourceEventSubscriptions(input) {
7909
- const state = input.state ?? getStateAdapter();
7910
- await state.connect();
7911
- const nowMs = input.nowMs ?? Date.now();
7912
- const ids = await readSubscriptionIdIndex(
7913
- state,
7914
- resourceIndexKey(input.teamId, input.namespace, input.identifier)
7915
- );
7916
- const records = await Promise.all(
7917
- ids.map(
7918
- async (id) => parseSubscription(await state.get(subscriptionKey(id)))
7919
- )
7920
- );
7921
- return records.filter(
7922
- (record2) => record2 !== void 0 && matchesEvent(record2, {
7923
- eventType: input.eventType,
7924
- nowMs,
7925
- namespace: input.namespace,
7926
- identifier: input.identifier,
7927
- teamId: input.teamId
7928
- })
7929
- );
7930
- }
7931
- async function deliverResourceEventSubscription(input) {
7932
- const state = input.state ?? getStateAdapter();
7933
- await state.connect();
7934
- return await withSubscriptionLock(
7935
- state,
7936
- input.subscription.id,
7937
- async () => {
7938
- const nowMs = input.nowMs ?? Date.now();
7939
- const current = parseSubscription(
7940
- await state.get(subscriptionKey(input.subscription.id))
7941
- );
7942
- if (!current || !matchesEvent(current, {
7943
- eventType: input.eventType,
7944
- nowMs,
7945
- namespace: input.namespace,
7946
- identifier: input.identifier,
7947
- teamId: input.teamId
7948
- })) {
7949
- return false;
7950
- }
7951
- const delivered = await input.deliver(current);
7952
- if (input.terminal) {
7953
- const latest = parseSubscription(
7954
- await state.get(subscriptionKey(current.id))
7955
- );
7956
- if (!latest || latest.status !== current.status || latest.updatedAtMs !== current.updatedAtMs) {
7957
- return delivered;
7958
- }
7959
- const next = {
7960
- ...current,
7961
- status: "completed",
7962
- updatedAtMs: nowMs
7963
- };
7964
- await state.set(
7965
- subscriptionKey(current.id),
7966
- next,
7967
- JUNIOR_THREAD_STATE_TTL_MS
7968
- );
7969
- await removeFromIndex(
7970
- state,
7971
- resourceIndexKey(
7972
- subscriptionTeamId(current.destination),
7973
- current.namespace,
7974
- current.identifier
7975
- ),
7976
- current.id,
7977
- nowMs
7978
- );
7979
- await removeFromIndex(
7980
- state,
7981
- conversationIndexKey(current.conversationId),
7982
- current.id,
7983
- nowMs
7984
- );
7985
- }
7986
- return delivered;
7987
- },
7988
- input.waitDeadlineMs
7989
- );
7990
- }
7991
-
7992
- // src/chat/tools/list-resource-event-subscriptions.ts
7993
- var listedResourceWatchSchema = z19.object({
7994
- id: z19.string().min(1),
7995
- label: z19.string().min(1),
7996
- identifier: z19.string().min(1),
7997
- namespace: z19.string().min(1),
7998
- resourceType: z19.string().min(1),
7999
- events: z19.array(z19.string().min(1)).min(1),
8000
- intent: z19.string().min(1),
8001
- expiresAtMs: z19.number().finite()
7573
+ events: z18.array(z18.string().min(1)).min(1),
7574
+ intent: z18.string().min(1),
7575
+ expiresAtMs: z18.number().finite()
8002
7576
  }).strict();
8003
- var resultDataSchema = z19.object({ subscriptions: z19.array(listedResourceWatchSchema) }).strict();
7577
+ var resultDataSchema = z18.object({ subscriptions: z18.array(listedResourceWatchSchema) }).strict();
8004
7578
  var outputSchema = juniorToolOutputSchema.extend({
8005
7579
  ...resultDataSchema.shape
8006
7580
  }).strict();
@@ -8015,7 +7589,7 @@ function createListResourceEventSubscriptionsTool(context) {
8015
7589
  description: "List active resource event subscriptions for the current conversation.",
8016
7590
  exposure: "deferred",
8017
7591
  source: RESOURCE_WATCH_TOOL_SOURCE,
8018
- inputSchema: z19.object({}).strict(),
7592
+ inputSchema: z18.object({}).strict(),
8019
7593
  outputSchema,
8020
7594
  async execute() {
8021
7595
  const conversationId = requireResourceWatchConversation(context);
@@ -8042,20 +7616,20 @@ function createListResourceEventSubscriptionsTool(context) {
8042
7616
  }
8043
7617
 
8044
7618
  // src/chat/tools/search-resource-event-types.ts
8045
- import { z as z20 } from "zod";
7619
+ import { z as z19 } from "zod";
8046
7620
  var DEFAULT_SEARCH_RESULTS = 10;
8047
7621
  var MAX_SEARCH_RESULTS = 20;
8048
- var searchedResourceTypeSchema = z20.object({
8049
- namespace: z20.string(),
8050
- type: z20.string(),
8051
- supportedEvents: z20.array(z20.string()),
8052
- suggestedEvents: z20.array(z20.string()).optional()
7622
+ var searchedResourceTypeSchema = z19.object({
7623
+ namespace: z19.string(),
7624
+ type: z19.string(),
7625
+ supportedEvents: z19.array(z19.string()),
7626
+ suggestedEvents: z19.array(z19.string()).optional()
8053
7627
  }).strict();
8054
7628
  var outputSchema2 = juniorToolOutputSchema.extend({
8055
- query: z20.string().nullable(),
8056
- namespace: z20.string().nullable(),
8057
- totalMatches: z20.number().int().nonnegative(),
8058
- resourceTypes: z20.array(searchedResourceTypeSchema)
7629
+ query: z19.string().nullable(),
7630
+ namespace: z19.string().nullable(),
7631
+ totalMatches: z19.number().int().nonnegative(),
7632
+ resourceTypes: z19.array(searchedResourceTypeSchema)
8059
7633
  }).strict();
8060
7634
  function normalizeSearchText(value) {
8061
7635
  return value.toLowerCase().replace(/[^a-z0-9_.-]+/g, " ").trim();
@@ -8081,12 +7655,12 @@ function createSearchResourceEventTypesTool(catalog) {
8081
7655
  readOnlyHint: true
8082
7656
  },
8083
7657
  description: "Search the resource event types currently enabled by plugins without creating anything. Use watchResourceEvents to receive temporary updates in the current Slack thread; use createEventTask to execute a durable instruction for matching events. When explaining results, preserve that distinction. This tool does not watch a resource, create a task, or enumerate concrete resources.",
8084
- inputSchema: z20.object({
8085
- query: z20.string().nullable().describe(
7658
+ inputSchema: z19.object({
7659
+ query: z19.string().nullable().describe(
8086
7660
  "Optional terms matching a namespace, resource type, or event name. Empty lists all enabled resource event types."
8087
7661
  ).optional(),
8088
7662
  namespace: eventNamespaceSchema(catalog).nullable().describe("Optional enabled plugin namespace to search within.").optional(),
8089
- maxResults: z20.number().int().min(1).max(MAX_SEARCH_RESULTS).nullable().describe("Maximum matching resource types to return.").optional()
7663
+ maxResults: z19.number().int().min(1).max(MAX_SEARCH_RESULTS).nullable().describe("Maximum matching resource types to return.").optional()
8090
7664
  }).strict(),
8091
7665
  outputSchema: outputSchema2,
8092
7666
  async execute({ query, namespace, maxResults }) {
@@ -8124,10 +7698,10 @@ function createSearchResourceEventTypesTool(catalog) {
8124
7698
  }
8125
7699
 
8126
7700
  // src/chat/tools/stop-watching-resources.ts
8127
- import { z as z21 } from "zod";
8128
- var resultDataSchema2 = z21.object({
8129
- watching_status: z21.literal("stopped"),
8130
- stoppedIds: z21.array(z21.string().min(1))
7701
+ import { z as z20 } from "zod";
7702
+ var resultDataSchema2 = z20.object({
7703
+ watching_status: z20.literal("stopped"),
7704
+ stoppedIds: z20.array(z20.string().min(1))
8131
7705
  }).strict();
8132
7706
  var outputSchema3 = juniorToolOutputSchema.extend({
8133
7707
  ...resultDataSchema2.shape
@@ -8143,7 +7717,7 @@ function createStopWatchingResourcesTool(context) {
8143
7717
  description: "Stop one resource watch in the current Slack thread by id. Omit id only when the user explicitly asks to stop every watch in this thread. Infer terse stop requests from context, inspect active watches when the target is unclear, and call this tool before confirming that watching stopped.",
8144
7718
  exposure: "deferred",
8145
7719
  source: RESOURCE_WATCH_TOOL_SOURCE,
8146
- inputSchema: z21.object({ id: z21.string().min(1).nullable().optional() }).strict(),
7720
+ inputSchema: z20.object({ id: z20.string().min(1).nullable().optional() }).strict(),
8147
7721
  outputSchema: outputSchema3,
8148
7722
  async execute({ id }) {
8149
7723
  const conversationId = requireResourceWatchConversation(context);
@@ -8178,26 +7752,24 @@ function createStopWatchingResourcesTool(context) {
8178
7752
  }
8179
7753
 
8180
7754
  // src/chat/tools/watch-resource-events.ts
8181
- import { z as z22 } from "zod";
8182
- var DEFAULT_TTL_MS = 14 * 24 * 60 * 60 * 1e3;
8183
- var MAX_TTL_MS = 30 * 24 * 60 * 60 * 1e3;
7755
+ import { z as z21 } from "zod";
8184
7756
  function inputSchema(catalog) {
8185
- return z22.object({
8186
- identifier: z22.string().trim().min(1).describe("Plugin-defined resource identifier."),
7757
+ return z21.object({
7758
+ identifier: z21.string().trim().min(1).describe("Plugin-defined resource identifier."),
8187
7759
  namespace: eventNamespaceSchema(catalog).describe(
8188
7760
  "Enabled plugin namespace for this resource."
8189
7761
  ),
8190
7762
  resourceType: registeredResourceTypeSchema(catalog).describe(
8191
7763
  "Plugin-defined resource type."
8192
7764
  ),
8193
- label: z22.string().trim().min(1).max(500).describe("Human-readable resource label."),
8194
- events: z22.array(registeredEventTypeSchema(catalog)).min(1).describe(
7765
+ label: z21.string().trim().min(1).max(500).describe("Human-readable resource label."),
7766
+ events: z21.array(registeredEventTypeSchema(catalog)).min(1).describe(
8195
7767
  "High-signal event names to deliver to this conversation when they occur."
8196
7768
  ),
8197
- intent: z22.string().trim().min(1).max(4e3).describe(
7769
+ intent: z21.string().trim().min(1).max(4e3).describe(
8198
7770
  "Concise reason this conversation wants these events, used when an event arrives."
8199
7771
  ),
8200
- ttlMs: z22.coerce.number().describe(
7772
+ ttlMs: z21.coerce.number().describe(
8201
7773
  "How long to keep the subscription active. Defaults to 14 days and must not exceed 30 days."
8202
7774
  ).optional()
8203
7775
  }).strict().superRefine((subscription, context) => {
@@ -8217,19 +7789,19 @@ function inputSchema(catalog) {
8217
7789
  });
8218
7790
  });
8219
7791
  }
8220
- var stopWatchingActionSchema = z22.object({
8221
- execution_tool: z22.literal("executeTool"),
8222
- execution_example: z22.object({
8223
- tool_name: z22.literal(STOP_WATCHING_TOOL_NAME),
8224
- arguments: z22.object({ id: z22.string().min(1) }).strict()
7792
+ var stopWatchingActionSchema = z21.object({
7793
+ execution_tool: z21.literal("executeTool"),
7794
+ execution_example: z21.object({
7795
+ tool_name: z21.literal(STOP_WATCHING_TOOL_NAME),
7796
+ arguments: z21.object({ id: z21.string().min(1) }).strict()
8225
7797
  }).strict()
8226
7798
  }).strict();
8227
- var resultDataSchema3 = z22.object({
8228
- id: z22.string().min(1),
8229
- subscription_status: z22.enum(["active", "cancelled", "completed"]),
8230
- identifier: z22.string().min(1),
8231
- events: z22.array(z22.string().min(1)).min(1),
8232
- expiresAtMs: z22.number().finite(),
7799
+ var resultDataSchema3 = z21.object({
7800
+ id: z21.string().min(1),
7801
+ subscription_status: z21.enum(["active", "cancelled", "completed"]),
7802
+ identifier: z21.string().min(1),
7803
+ events: z21.array(z21.string().min(1)).min(1),
7804
+ expiresAtMs: z21.number().finite(),
8233
7805
  stop_watching: stopWatchingActionSchema
8234
7806
  }).strict();
8235
7807
  var outputSchema4 = juniorToolOutputSchema.extend({
@@ -8239,11 +7811,11 @@ function cleanStrings(values) {
8239
7811
  return [...new Set(values.map((value) => value.trim()).filter(Boolean))];
8240
7812
  }
8241
7813
  function ttlMs(input) {
8242
- if (input.ttlMs === void 0) return DEFAULT_TTL_MS;
7814
+ if (input.ttlMs === void 0) return RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS;
8243
7815
  if (!Number.isFinite(input.ttlMs) || input.ttlMs <= 0) {
8244
7816
  throw new ToolInputError("ttlMs must be a positive finite number");
8245
7817
  }
8246
- if (input.ttlMs > MAX_TTL_MS) {
7818
+ if (input.ttlMs > RESOURCE_SUBSCRIPTION_MAX_TTL_MS) {
8247
7819
  throw new ToolInputError("Resource watches cannot exceed 30 days");
8248
7820
  }
8249
7821
  return input.ttlMs;
@@ -8333,14 +7905,14 @@ function createResourceEventTools(context, catalog) {
8333
7905
  }
8334
7906
 
8335
7907
  // src/chat/tools/create-event-task.ts
8336
- import { createHash as createHash2 } from "crypto";
8337
- import { z as z23 } from "zod";
7908
+ import { createHash } from "crypto";
7909
+ import { z as z22 } from "zod";
8338
7910
  function buildEventTaskId(args) {
8339
7911
  const toolCallId = args.toolCallId?.trim();
8340
7912
  if (!toolCallId) {
8341
7913
  throw new Error("Event task creation requires a tool-call identity.");
8342
7914
  }
8343
- const digest2 = createHash2("sha256").update(
7915
+ const digest = createHash("sha256").update(
8344
7916
  JSON.stringify({
8345
7917
  actor: args.userId,
8346
7918
  channel: args.channelId,
@@ -8348,7 +7920,7 @@ function buildEventTaskId(args) {
8348
7920
  team: args.teamId
8349
7921
  })
8350
7922
  ).digest("hex").slice(0, 32);
8351
- return `evt_${digest2}`;
7923
+ return `evt_${digest}`;
8352
7924
  }
8353
7925
  function createEventTaskTool(context, catalog) {
8354
7926
  const trigger = registeredEventTaskTriggerSchema(catalog);
@@ -8362,13 +7934,13 @@ function createEventTaskTool(context, catalog) {
8362
7934
  },
8363
7935
  executionMode: "sequential",
8364
7936
  description: "Create a durable event task that executes the supplied instruction for every matching resource event. Use for whenever-this-happens-do-X automation; ordinary watch, notify, or tell-me-when requests use watchResourceEvents instead. The task remains configured for this Slack channel or DM until deleted and may use the creator's connected credentials. Prefer a subscribable tool result when available.",
8365
- inputSchema: z23.object({
8366
- task: z23.string().trim().min(1).max(4e3),
8367
- title: z23.string().trim().min(1).max(SHORT_TITLE_MAX_LENGTH).nullable().describe(
7937
+ inputSchema: z22.object({
7938
+ task: z22.string().trim().min(1).max(4e3),
7939
+ title: z22.string().trim().min(1).max(SHORT_TITLE_MAX_LENGTH).nullable().describe(
8368
7940
  "Optional short display title. Omit or use null to generate one from the task instruction."
8369
7941
  ).optional(),
8370
7942
  trigger,
8371
- credentialMode: z23.enum(["creator", "system"]).nullable().describe(
7943
+ credentialMode: z22.enum(["creator", "system"]).nullable().describe(
8372
7944
  "Use creator to make the task creator's connected credentials available, or system when the creator says not to use them. Omit or use null for the creator default."
8373
7945
  ).optional()
8374
7946
  }).strict(),
@@ -8437,7 +8009,7 @@ function createEventTaskTool(context, catalog) {
8437
8009
  }
8438
8010
 
8439
8011
  // src/chat/tools/delete-event-task.ts
8440
- import { z as z24 } from "zod";
8012
+ import { z as z23 } from "zod";
8441
8013
  function createDeleteEventTaskTool(context, catalog) {
8442
8014
  return zodTool({
8443
8015
  approvalMode: "review",
@@ -8449,7 +8021,7 @@ function createDeleteEventTaskTool(context, catalog) {
8449
8021
  },
8450
8022
  executionMode: "sequential",
8451
8023
  description: "Delete an event task from this Slack channel or DM, including a task created from another thread in the same destination.",
8452
- inputSchema: z24.object({ taskId: z24.string().min(1) }).strict(),
8024
+ inputSchema: z23.object({ taskId: z23.string().min(1) }).strict(),
8453
8025
  outputSchema: eventTaskToolResultSchema,
8454
8026
  async execute({ taskId }) {
8455
8027
  const current = await writableEventTask(context, taskId);
@@ -8465,7 +8037,7 @@ function createDeleteEventTaskTool(context, catalog) {
8465
8037
  }
8466
8038
 
8467
8039
  // src/chat/tools/list-event-tasks.ts
8468
- import { z as z25 } from "zod";
8040
+ import { z as z24 } from "zod";
8469
8041
  var MAX_LISTED_EVENT_TASKS = 50;
8470
8042
  function createListEventTasksTool(context, catalog) {
8471
8043
  return zodTool({
@@ -8476,7 +8048,7 @@ function createListEventTasksTool(context, catalog) {
8476
8048
  readOnlyHint: true
8477
8049
  },
8478
8050
  description: "List event tasks for this Slack channel or DM, including tasks created from other threads in the same destination. A false triggerAvailable value means the task remains stored but its plugin event is not currently enabled.",
8479
- inputSchema: z25.object({}).strict(),
8051
+ inputSchema: z24.object({}).strict(),
8480
8052
  outputSchema: eventTaskListToolResultSchema,
8481
8053
  async execute() {
8482
8054
  const { destination } = requireEventTaskSlackContext(context);
@@ -8491,7 +8063,7 @@ function createListEventTasksTool(context, catalog) {
8491
8063
  }
8492
8064
 
8493
8065
  // src/chat/tools/update-event-task.ts
8494
- import { z as z26 } from "zod";
8066
+ import { z as z25 } from "zod";
8495
8067
  function changesEventTaskTrigger(current, next) {
8496
8068
  const currentEvents = [...current.events].sort();
8497
8069
  const nextEvents = [...next.events].sort();
@@ -8508,11 +8080,11 @@ function createUpdateEventTaskTool(context, catalog) {
8508
8080
  },
8509
8081
  executionMode: "sequential",
8510
8082
  description: "Update the instruction, registered trigger, or credential use for an event task in this Slack channel or DM. Event tasks created from other threads in the same destination are manageable here.",
8511
- inputSchema: z26.object({
8512
- taskId: z26.string().min(1),
8513
- task: z26.string().trim().min(1).max(4e3).nullable().optional(),
8083
+ inputSchema: z25.object({
8084
+ taskId: z25.string().min(1),
8085
+ task: z25.string().trim().min(1).max(4e3).nullable().optional(),
8514
8086
  trigger: registeredEventTaskTriggerSchema(catalog).nullable().optional(),
8515
- credentialMode: z26.enum(["system", "creator"]).nullable().describe(
8087
+ credentialMode: z25.enum(["system", "creator"]).nullable().describe(
8516
8088
  "Set creator to make the task's original creator credentials available, or system to disable them. Creator always means the task's createdBy actor, never the current requester. Only that original creator may enable creator mode. Omit or use null to leave unchanged."
8517
8089
  ).optional()
8518
8090
  }).strict(),
@@ -8597,16 +8169,16 @@ function createEventTaskTools(context, catalog) {
8597
8169
  }
8598
8170
 
8599
8171
  // src/chat/scheduled-tasks/tools/create.ts
8600
- import { z as z29 } from "zod";
8172
+ import { z as z28 } from "zod";
8601
8173
 
8602
8174
  // src/chat/scheduled-tasks/schedule-intent.ts
8603
- import { z as z27 } from "zod";
8604
- var localDateSchema = z27.string().regex(/^\d{4}-\d{2}-\d{2}$/, "Use a local date in YYYY-MM-DD format.");
8605
- var localTimeSchema = z27.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "Use local time in HH:MM format.");
8606
- var timezoneSchema = z27.string().min(1).max(80).describe(
8175
+ import { z as z26 } from "zod";
8176
+ var localDateSchema = z26.string().regex(/^\d{4}-\d{2}-\d{2}$/, "Use a local date in YYYY-MM-DD format.");
8177
+ var localTimeSchema = z26.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "Use local time in HH:MM format.");
8178
+ var timezoneSchema = z26.string().min(1).max(80).describe(
8607
8179
  "IANA timezone, for example America/Los_Angeles. Omit or use null for the scheduler default."
8608
8180
  ).nullable().optional();
8609
- var weekdaySchema = z27.enum([
8181
+ var weekdaySchema = z26.enum([
8610
8182
  "sunday",
8611
8183
  "monday",
8612
8184
  "tuesday",
@@ -8615,17 +8187,17 @@ var weekdaySchema = z27.enum([
8615
8187
  "friday",
8616
8188
  "saturday"
8617
8189
  ]);
8618
- var oneOffScheduleIntentSchema = z27.object({
8619
- kind: z27.literal("one_off").describe("A schedule that runs once."),
8190
+ var oneOffScheduleIntentSchema = z26.object({
8191
+ kind: z26.literal("one_off").describe("A schedule that runs once."),
8620
8192
  timezone: timezoneSchema,
8621
- timing: z27.discriminatedUnion("type", [
8622
- z27.object({
8623
- type: z27.literal("after").describe("Run after a relative delay from the server clock."),
8624
- value: z27.number().int().positive().max(1e5),
8625
- unit: z27.enum(["second", "minute", "hour", "day", "week"])
8193
+ timing: z26.discriminatedUnion("type", [
8194
+ z26.object({
8195
+ type: z26.literal("after").describe("Run after a relative delay from the server clock."),
8196
+ value: z26.number().int().positive().max(1e5),
8197
+ unit: z26.enum(["second", "minute", "hour", "day", "week"])
8626
8198
  }).strict(),
8627
- z27.object({
8628
- type: z27.literal("at").describe("Run at an explicit local calendar date and time."),
8199
+ z26.object({
8200
+ type: z26.literal("at").describe("Run at an explicit local calendar date and time."),
8629
8201
  date: localDateSchema.describe(
8630
8202
  "Requested local calendar date in YYYY-MM-DD format."
8631
8203
  ),
@@ -8635,16 +8207,16 @@ var oneOffScheduleIntentSchema = z27.object({
8635
8207
  }).strict()
8636
8208
  ]).describe("Relative delay or explicit local time for the one-off run.")
8637
8209
  }).strict();
8638
- var recurringScheduleIntentSchema = z27.object({
8639
- kind: z27.literal("recurring").describe("A repeating calendar schedule."),
8640
- frequency: z27.enum(["daily", "weekly", "monthly", "yearly"]).describe("Recurring tasks can run at most once per day."),
8641
- interval: z27.number().int().positive().max(365).describe("Repeat every N frequency units. Defaults to 1.").nullable().optional(),
8210
+ var recurringScheduleIntentSchema = z26.object({
8211
+ kind: z26.literal("recurring").describe("A repeating calendar schedule."),
8212
+ frequency: z26.enum(["daily", "weekly", "monthly", "yearly"]).describe("Recurring tasks can run at most once per day."),
8213
+ interval: z26.number().int().positive().max(365).describe("Repeat every N frequency units. Defaults to 1.").nullable().optional(),
8642
8214
  time: localTimeSchema.describe(
8643
8215
  "Local wall-clock time for each occurrence in HH:MM format."
8644
8216
  ),
8645
- weekdays: z27.array(weekdaySchema).min(1).max(7).describe("Required for weekly schedules.").nullable().optional(),
8646
- day_of_month: z27.number().int().min(1).max(31).describe("Required for monthly and yearly schedules.").nullable().optional(),
8647
- month: z27.number().int().min(1).max(12).describe("Required for yearly schedules, where January is 1.").nullable().optional(),
8217
+ weekdays: z26.array(weekdaySchema).min(1).max(7).describe("Required for weekly schedules.").nullable().optional(),
8218
+ day_of_month: z26.number().int().min(1).max(31).describe("Required for monthly and yearly schedules.").nullable().optional(),
8219
+ month: z26.number().int().min(1).max(12).describe("Required for yearly schedules, where January is 1.").nullable().optional(),
8648
8220
  start_date: localDateSchema.describe(
8649
8221
  "Optional local calendar date that anchors the recurrence. Omit to start with the next matching occurrence."
8650
8222
  ).nullable().optional(),
@@ -8693,7 +8265,7 @@ var recurringScheduleIntentSchema = z27.object({
8693
8265
  });
8694
8266
  }
8695
8267
  });
8696
- var scheduleIntentSchema = z27.union([
8268
+ var scheduleIntentSchema = z26.union([
8697
8269
  oneOffScheduleIntentSchema,
8698
8270
  recurringScheduleIntentSchema
8699
8271
  ]);
@@ -8849,11 +8421,11 @@ function compileScheduleIntent(args) {
8849
8421
  }
8850
8422
 
8851
8423
  // src/chat/scheduled-tasks/tool-support.ts
8852
- import { createHash as createHash3 } from "crypto";
8424
+ import { createHash as createHash2 } from "crypto";
8853
8425
  import {
8854
8426
  sourceSchema
8855
8427
  } from "@sentry/junior-plugin-api";
8856
- import { z as z28 } from "zod";
8428
+ import { z as z27 } from "zod";
8857
8429
 
8858
8430
  // src/chat/scheduled-tasks/identity.ts
8859
8431
  var SLACK_USER_ID_PATTERN = /^[UW][A-Z0-9]{5,}$/;
@@ -8890,36 +8462,36 @@ function sanitizeScheduledTaskPrincipal(principal) {
8890
8462
  var TASK_ID_PREFIX = "sched";
8891
8463
  var MAX_LISTED_TASKS = 50;
8892
8464
  var DEFAULT_SCHEDULE_TIMEZONE = "America/Los_Angeles";
8893
- var compactTaskResultSchema = z28.object({
8894
- id: z28.string(),
8895
- status: z28.enum(["active", "blocked", "completed", "deleted"]),
8896
- task: z28.string(),
8897
- schedule: z28.string(),
8898
- timezone: z28.string(),
8899
- recurrence: z28.unknown().nullable(),
8900
- next_run_at: z28.string().nullable(),
8901
- destination: z28.object({
8902
- platform: z28.literal("slack"),
8903
- team_id: z28.string().min(1),
8904
- channel_id: z28.string().min(1)
8465
+ var compactTaskResultSchema = z27.object({
8466
+ id: z27.string(),
8467
+ status: z27.enum(["active", "blocked", "completed", "deleted"]),
8468
+ task: z27.string(),
8469
+ schedule: z27.string(),
8470
+ timezone: z27.string(),
8471
+ recurrence: z27.unknown().nullable(),
8472
+ next_run_at: z27.string().nullable(),
8473
+ destination: z27.object({
8474
+ platform: z27.literal("slack"),
8475
+ team_id: z27.string().min(1),
8476
+ channel_id: z27.string().min(1)
8905
8477
  }).strict(),
8906
- conversation_access: z28.object({
8907
- audience: z28.enum(["direct", "group", "channel"]),
8908
- visibility: z28.enum(["private", "public"])
8478
+ conversation_access: z27.object({
8479
+ audience: z27.enum(["direct", "group", "channel"]),
8480
+ visibility: z27.enum(["private", "public"])
8909
8481
  }).strict(),
8910
- credential_mode: z28.enum(["system", "creator"]),
8911
- dashboard_url: z28.string().url().nullable(),
8912
- last_run_at: z28.string().nullable(),
8913
- run_now_at: z28.string().nullable()
8482
+ credential_mode: z27.enum(["system", "creator"]),
8483
+ dashboard_url: z27.string().url().nullable(),
8484
+ last_run_at: z27.string().nullable(),
8485
+ run_now_at: z27.string().nullable()
8914
8486
  }).strict();
8915
8487
  var scheduleTaskToolResultSchema = juniorToolOutputSchema.extend({
8916
- target: z28.string(),
8488
+ target: z27.string(),
8917
8489
  task: compactTaskResultSchema
8918
8490
  }).strict();
8919
8491
  var scheduleListToolResultSchema = juniorToolOutputSchema.extend({
8920
- target: z28.string(),
8921
- tasks: z28.array(compactTaskResultSchema),
8922
- truncated: z28.boolean()
8492
+ target: z27.string(),
8493
+ tasks: z27.array(compactTaskResultSchema),
8494
+ truncated: z27.boolean()
8923
8495
  }).strict();
8924
8496
  function throwToolInputError(error) {
8925
8497
  throw new ToolInputError(error);
@@ -9049,7 +8621,7 @@ function buildTaskId(args) {
9049
8621
  if (!toolCallId) {
9050
8622
  throw new Error("Scheduler task creation requires a tool-call identity.");
9051
8623
  }
9052
- const digest2 = createHash3("sha256").update(
8624
+ const digest = createHash2("sha256").update(
9053
8625
  JSON.stringify({
9054
8626
  actor: args.actor.slackUserId,
9055
8627
  channel: args.destination.channelId,
@@ -9058,7 +8630,7 @@ function buildTaskId(args) {
9058
8630
  team: args.destination.teamId
9059
8631
  })
9060
8632
  ).digest("hex").slice(0, 32);
9061
- return `${TASK_ID_PREFIX}_${digest2}`;
8633
+ return `${TASK_ID_PREFIX}_${digest}`;
9062
8634
  }
9063
8635
  function schedulerStore(context) {
9064
8636
  return context.store;
@@ -9085,15 +8657,15 @@ function createSlackScheduleCreateTaskTool(context) {
9085
8657
  },
9086
8658
  description: "Create a one-time or recurring Junior task in the active Slack conversation when the user asks Junior to do work later or repeatedly.",
9087
8659
  executionMode: "sequential",
9088
- inputSchema: z29.object({
9089
- task: z29.string().min(1).max(4e3),
9090
- title: z29.string().trim().min(1).max(SHORT_TITLE_MAX_LENGTH).nullable().describe(
8660
+ inputSchema: z28.object({
8661
+ task: z28.string().min(1).max(4e3),
8662
+ title: z28.string().trim().min(1).max(SHORT_TITLE_MAX_LENGTH).nullable().describe(
9091
8663
  "Optional short display title. Omit or use null to generate one from the task instruction."
9092
8664
  ).optional(),
9093
8665
  schedule: scheduleIntentSchema.describe(
9094
8666
  "When the task runs. The scheduler computes the exact next run from this intent and the server clock."
9095
8667
  ),
9096
- credential_mode: z29.enum(["creator", "system"]).nullable().describe(
8668
+ credential_mode: z28.enum(["creator", "system"]).nullable().describe(
9097
8669
  "Use creator to make the task creator's connected credentials available, or system when the creator says not to use them. Omit or use null for the creator default."
9098
8670
  ).optional()
9099
8671
  }).strict(),
@@ -9192,7 +8764,7 @@ function createSlackScheduleCreateTaskTool(context) {
9192
8764
  }
9193
8765
 
9194
8766
  // src/chat/scheduled-tasks/tools/delete.ts
9195
- import { z as z30 } from "zod";
8767
+ import { z as z29 } from "zod";
9196
8768
  function createSlackScheduleDeleteTaskTool(context) {
9197
8769
  return zodTool({
9198
8770
  approvalMode: "review",
@@ -9204,8 +8776,8 @@ function createSlackScheduleDeleteTaskTool(context) {
9204
8776
  },
9205
8777
  description: "Delete one scheduled Junior task from the active Slack conversation. Use only task IDs returned for this conversation. Do not delete schedules from threads, other channels, or another user's DM.",
9206
8778
  executionMode: "sequential",
9207
- inputSchema: z30.object({
9208
- task_id: z30.string().min(1).describe(
8779
+ inputSchema: z29.object({
8780
+ task_id: z29.string().min(1).describe(
9209
8781
  "ID of the task to delete. Must be from this active Slack conversation."
9210
8782
  )
9211
8783
  }),
@@ -9229,12 +8801,12 @@ function createSlackScheduleDeleteTaskTool(context) {
9229
8801
  }
9230
8802
 
9231
8803
  // src/chat/slack/id-param.ts
9232
- import { z as z31 } from "zod";
8804
+ import { z as z30 } from "zod";
9233
8805
  function slackChannelIdParam(description) {
9234
- return z31.string().min(1).describe(description);
8806
+ return z30.string().min(1).describe(description);
9235
8807
  }
9236
8808
  function slackUserIdParam(description) {
9237
- return z31.string().min(1).describe(description);
8809
+ return z30.string().min(1).describe(description);
9238
8810
  }
9239
8811
  function parseRequiredSlackChannelIdParam(field, value) {
9240
8812
  const channelId = parseSlackChannelId(value);
@@ -9258,7 +8830,7 @@ function parseRequiredSlackUserIdParam(field, value) {
9258
8830
  }
9259
8831
 
9260
8832
  // src/chat/scheduled-tasks/tools/list.ts
9261
- import { z as z32 } from "zod";
8833
+ import { z as z31 } from "zod";
9262
8834
  function taskMatchesQuery(task, query) {
9263
8835
  const normalized = query.toLowerCase();
9264
8836
  return [
@@ -9278,11 +8850,11 @@ function createSlackScheduleListTasksTool(context) {
9278
8850
  openWorldHint: false,
9279
8851
  readOnlyHint: true
9280
8852
  },
9281
- inputSchema: z32.object({
8853
+ inputSchema: z31.object({
9282
8854
  channel_id: slackChannelIdParam(
9283
8855
  "Current destination channel ID to filter by. Use the ID from a channel mention; do not guess."
9284
8856
  ).nullable().optional(),
9285
- query: z32.string().trim().min(1).max(200).nullable().describe("Text to match in the requester's scheduled tasks.").optional()
8857
+ query: z31.string().trim().min(1).max(200).nullable().describe("Text to match in the requester's scheduled tasks.").optional()
9286
8858
  }).strict(),
9287
8859
  outputSchema: scheduleListToolResultSchema,
9288
8860
  execute: async (input) => {
@@ -9330,7 +8902,7 @@ function createSlackScheduleListTasksTool(context) {
9330
8902
  }
9331
8903
 
9332
8904
  // src/chat/scheduled-tasks/tools/run-now.ts
9333
- import { z as z33 } from "zod";
8905
+ import { z as z32 } from "zod";
9334
8906
  function createSlackScheduleRunTaskNowTool(context) {
9335
8907
  return zodTool({
9336
8908
  approvalMode: "review",
@@ -9342,8 +8914,8 @@ function createSlackScheduleRunTaskNowTool(context) {
9342
8914
  },
9343
8915
  description: "Queue an existing active scheduled Junior task to run as soon as possible, without changing its cadence. Use when the user asks to run an existing scheduled task now. Use only task IDs returned for this conversation.",
9344
8916
  executionMode: "sequential",
9345
- inputSchema: z33.object({
9346
- task_id: z33.string().min(1).describe(
8917
+ inputSchema: z32.object({
8918
+ task_id: z32.string().min(1).describe(
9347
8919
  "ID of the active task to run now. Must be from this active Slack conversation."
9348
8920
  )
9349
8921
  }),
@@ -9371,7 +8943,7 @@ function createSlackScheduleRunTaskNowTool(context) {
9371
8943
  }
9372
8944
 
9373
8945
  // src/chat/scheduled-tasks/tools/update.ts
9374
- import { z as z34 } from "zod";
8946
+ import { z as z33 } from "zod";
9375
8947
  function createSlackScheduleUpdateTaskTool(context) {
9376
8948
  return zodTool({
9377
8949
  approvalMode: "review",
@@ -9383,17 +8955,17 @@ function createSlackScheduleUpdateTaskTool(context) {
9383
8955
  },
9384
8956
  description: `Update a scheduled task. To move the requester's task into this Slack conversation, set destination to "here".`,
9385
8957
  executionMode: "sequential",
9386
- inputSchema: z34.object({
9387
- task_id: z34.string().min(1).describe("Scheduled task ID returned by slackScheduleListTasks."),
9388
- task: z34.string().min(1).max(4e3).optional(),
8958
+ inputSchema: z33.object({
8959
+ task_id: z33.string().min(1).describe("Scheduled task ID returned by slackScheduleListTasks."),
8960
+ task: z33.string().min(1).max(4e3).optional(),
9389
8961
  schedule: scheduleIntentSchema.describe("Complete replacement schedule. Omit to keep it unchanged.").nullable().optional(),
9390
- status: z34.enum(["active", "blocked"]).describe(
8962
+ status: z33.enum(["active", "blocked"]).describe(
9391
8963
  "Set active to resume a blocked task, or blocked to stop dispatch."
9392
8964
  ).optional(),
9393
- destination: z34.literal("here").nullable().describe(
8965
+ destination: z33.literal("here").nullable().describe(
9394
8966
  `Set to "here" to move the creator's task into this Slack conversation. Omit to keep its destination.`
9395
8967
  ).optional(),
9396
- credential_mode: z34.enum(["system", "creator"]).nullable().describe(
8968
+ credential_mode: z33.enum(["system", "creator"]).nullable().describe(
9397
8969
  "Use creator credentials or system credentials. Only the task creator may enable creator mode. Omit to keep unchanged."
9398
8970
  ).optional()
9399
8971
  }).strict(),
@@ -9755,9 +9327,9 @@ async function joinPublicChannelForRead(args) {
9755
9327
  }
9756
9328
 
9757
9329
  // src/chat/slack/tool-support/channel-target.ts
9758
- import { z as z35 } from "zod";
9330
+ import { z as z34 } from "zod";
9759
9331
  var SLACK_CHANNEL_REF_MAX_LENGTH = 160;
9760
- var slackChannelRefParam = z35.string().trim().min(1).max(SLACK_CHANNEL_REF_MAX_LENGTH).describe(
9332
+ var slackChannelRefParam = z34.string().trim().min(1).max(SLACK_CHANNEL_REF_MAX_LENGTH).describe(
9761
9333
  "Slack channel id (`C123`), mention (`<#C123>` / `<#C123|name>`), Junior slack reference (`slack:C123`), or a channel name Junior already knows in this workspace."
9762
9334
  );
9763
9335
  async function resolveSlackChannelRef(input) {
@@ -9805,7 +9377,7 @@ async function resolveOptionalSlackChannelRef(input) {
9805
9377
  }
9806
9378
 
9807
9379
  // src/chat/slack/tools/channel-join.ts
9808
- import { z as z36 } from "zod";
9380
+ import { z as z35 } from "zod";
9809
9381
  function createSlackChannelJoinTool(context) {
9810
9382
  return zodTool({
9811
9383
  description: "Join a public Slack channel.",
@@ -9815,7 +9387,7 @@ function createSlackChannelJoinTool(context) {
9815
9387
  openWorldHint: true,
9816
9388
  readOnlyHint: false
9817
9389
  },
9818
- inputSchema: z36.object({
9390
+ inputSchema: z35.object({
9819
9391
  channel_id: slackChannelRefParam
9820
9392
  }),
9821
9393
  outputSchema: juniorToolOutputSchema,
@@ -9872,11 +9444,11 @@ function createSlackChannelJoinTool(context) {
9872
9444
  }
9873
9445
 
9874
9446
  // src/chat/slack/timestamp-param.ts
9875
- import { z as z37 } from "zod";
9447
+ import { z as z36 } from "zod";
9876
9448
  function slackTimestampParam(description) {
9877
- return z37.preprocess(
9449
+ return z36.preprocess(
9878
9450
  (value) => typeof value === "number" && Number.isFinite(value) ? String(value) : value,
9879
- z37.string().min(1)
9451
+ z36.string().min(1)
9880
9452
  ).describe(description);
9881
9453
  }
9882
9454
  function parseSlackTimestampParam(field, value) {
@@ -9904,10 +9476,10 @@ function parseRequiredSlackTimestampParam(field, value) {
9904
9476
  }
9905
9477
 
9906
9478
  // src/chat/slack/tools/channel-list-messages.ts
9907
- import { z as z38 } from "zod";
9908
- var booleanInput2 = (description) => z38.preprocess(
9479
+ import { z as z37 } from "zod";
9480
+ var booleanInput2 = (description) => z37.preprocess(
9909
9481
  (value) => value === "true" ? true : value === "false" ? false : value,
9910
- z38.boolean()
9482
+ z37.boolean()
9911
9483
  ).describe(description);
9912
9484
  function normalizeRangeTimestamp(field, value, targetChannelId) {
9913
9485
  if (value === void 0) {
@@ -9939,10 +9511,10 @@ function createSlackChannelListMessagesTool(context) {
9939
9511
  openWorldHint: true,
9940
9512
  readOnlyHint: true
9941
9513
  },
9942
- inputSchema: z38.object({
9514
+ inputSchema: z37.object({
9943
9515
  channel_id: slackChannelRefParam.optional(),
9944
- limit: z38.coerce.number().int().min(1).max(1e3).describe("Maximum number of messages to return across pages.").optional(),
9945
- cursor: z38.string().min(1).describe("Optional cursor to continue from a prior call.").optional(),
9516
+ limit: z37.coerce.number().int().min(1).max(1e3).describe("Maximum number of messages to return across pages.").optional(),
9517
+ cursor: z37.string().min(1).describe("Optional cursor to continue from a prior call.").optional(),
9946
9518
  oldest: slackTimestampParam(
9947
9519
  "Oldest message timestamp (Slack ts) for range filtering."
9948
9520
  ).optional(),
@@ -9952,7 +9524,7 @@ function createSlackChannelListMessagesTool(context) {
9952
9524
  inclusive: booleanInput2(
9953
9525
  "Whether oldest/latest bounds should be inclusive."
9954
9526
  ).optional(),
9955
- max_pages: z38.coerce.number().int().min(1).max(10).describe("Maximum number of API pages to traverse in a single call.").optional()
9527
+ max_pages: z37.coerce.number().int().min(1).max(10).describe("Maximum number of API pages to traverse in a single call.").optional()
9956
9528
  }),
9957
9529
  outputSchema: juniorToolOutputSchema,
9958
9530
  execute: async ({
@@ -10075,7 +9647,7 @@ function createSlackChannelListMessagesTool(context) {
10075
9647
  }
10076
9648
 
10077
9649
  // src/chat/slack/tools/conversation-message-search.ts
10078
- import { z as z39 } from "zod";
9650
+ import { z as z38 } from "zod";
10079
9651
 
10080
9652
  // src/chat/conversations/tool-source.ts
10081
9653
  var CONVERSATIONS_TOOL_SOURCE = {
@@ -10087,23 +9659,23 @@ var CONVERSATIONS_TOOL_SOURCE = {
10087
9659
  var DEFAULT_LIMIT = 20;
10088
9660
  var MAX_LIMIT = 50;
10089
9661
  var conversationMessageSearchOutputSchema = juniorToolOutputSchema.extend({
10090
- after: z39.string().datetime().optional(),
10091
- annotation: z39.string().min(1).optional(),
10092
- before: z39.string().datetime().optional(),
10093
- channel_id: z39.string().min(1).optional(),
10094
- count: z39.number().int().nonnegative(),
10095
- query: z39.string().optional(),
10096
- matches: z39.array(
10097
- z39.object({
10098
- channel_id: z39.string().min(1),
10099
- channel_name: z39.string().min(1).optional(),
10100
- conversation_id: z39.string().min(1),
10101
- excerpt: z39.string(),
10102
- message_id: z39.string().min(1),
10103
- message_role: z39.enum(["assistant", "user"]),
10104
- message_timestamp: z39.string().datetime(),
10105
- permalink: z39.string().url().optional(),
10106
- thread_ts: z39.string().min(1)
9662
+ after: z38.string().datetime().optional(),
9663
+ annotation: z38.string().min(1).optional(),
9664
+ before: z38.string().datetime().optional(),
9665
+ channel_id: z38.string().min(1).optional(),
9666
+ count: z38.number().int().nonnegative(),
9667
+ query: z38.string().optional(),
9668
+ matches: z38.array(
9669
+ z38.object({
9670
+ channel_id: z38.string().min(1),
9671
+ channel_name: z38.string().min(1).optional(),
9672
+ conversation_id: z38.string().min(1),
9673
+ excerpt: z38.string(),
9674
+ message_id: z38.string().min(1),
9675
+ message_role: z38.enum(["assistant", "user"]),
9676
+ message_timestamp: z38.string().datetime(),
9677
+ permalink: z38.string().url().optional(),
9678
+ thread_ts: z38.string().min(1)
10107
9679
  }).strict()
10108
9680
  )
10109
9681
  });
@@ -10158,15 +9730,15 @@ function createSlackConversationMessageSearchTool(scope, currentConversationId)
10158
9730
  openWorldHint: false,
10159
9731
  readOnlyHint: true
10160
9732
  },
10161
- inputSchema: z39.object({
10162
- after: z39.string().datetime().nullable().describe("Include conversations active at or after this timestamp.").optional(),
10163
- annotation: z39.string().trim().min(1).max(256).nullable().describe(
9733
+ inputSchema: z38.object({
9734
+ after: z38.string().datetime().nullable().describe("Include conversations active at or after this timestamp.").optional(),
9735
+ annotation: z38.string().trim().min(1).max(256).nullable().describe(
10164
9736
  "Linked resource key. Matches that key, or nested children that continue with #."
10165
9737
  ).optional(),
10166
- before: z39.string().datetime().nullable().describe("Include conversations active before this timestamp.").optional(),
9738
+ before: z38.string().datetime().nullable().describe("Include conversations active before this timestamp.").optional(),
10167
9739
  channel_id: slackChannelRefParam.nullable().optional(),
10168
- query: z39.string().trim().min(1).max(200).nullable().describe("Words or phrase to match in message text.").optional(),
10169
- limit: z39.number().int().min(1).max(MAX_LIMIT).describe(
9740
+ query: z38.string().trim().min(1).max(200).nullable().describe("Words or phrase to match in message text.").optional(),
9741
+ limit: z38.number().int().min(1).max(MAX_LIMIT).describe(
10170
9742
  `Maximum conversations. Default ${DEFAULT_LIMIT}; max ${MAX_LIMIT}.`
10171
9743
  ).nullable().optional()
10172
9744
  }).strict(),
@@ -10225,13 +9797,13 @@ function createSlackConversationMessageSearchTool(scope, currentConversationId)
10225
9797
  }
10226
9798
 
10227
9799
  // src/chat/slack/tools/public-search.ts
10228
- import { z as z40 } from "zod";
9800
+ import { z as z39 } from "zod";
10229
9801
  var DEFAULT_LIMIT2 = 10;
10230
9802
  var DEFAULT_CONTENT_TYPES = ["messages"];
10231
9803
  var CONTENT_TYPES = ["messages", "files", "channels", "users"];
10232
- var unixTimestampParam = z40.coerce.number().int().nonnegative();
9804
+ var unixTimestampParam = z39.coerce.number().int().nonnegative();
10233
9805
  function optionalUnixTimestampParam(description) {
10234
- return z40.preprocess(
9806
+ return z39.preprocess(
10235
9807
  (value) => typeof value === "string" && value.trim() === "" ? void 0 : value,
10236
9808
  unixTimestampParam.optional()
10237
9809
  ).describe(description);
@@ -10245,64 +9817,64 @@ function normalizeOptionalUnixTimestamp(value) {
10245
9817
  }
10246
9818
  return unixTimestampParam.parse(value);
10247
9819
  }
10248
- var searchMessageSchema = z40.object({
10249
- author_name: z40.string().min(1).optional().describe("Author display name."),
10250
- author_user_id: z40.string().min(1).optional().describe("Author user ID."),
10251
- channel_id: z40.string().min(1).describe("Channel ID."),
10252
- channel_name: z40.string().min(1).optional().describe("Channel name."),
10253
- message_ts: z40.string().min(1).describe("Message timestamp."),
10254
- content: z40.string().describe("Message text."),
10255
- is_author_bot: z40.boolean().optional().describe("Whether the author is a bot."),
10256
- permalink: z40.string().url().describe("Message permalink.")
9820
+ var searchMessageSchema = z39.object({
9821
+ author_name: z39.string().min(1).optional().describe("Author display name."),
9822
+ author_user_id: z39.string().min(1).optional().describe("Author user ID."),
9823
+ channel_id: z39.string().min(1).describe("Channel ID."),
9824
+ channel_name: z39.string().min(1).optional().describe("Channel name."),
9825
+ message_ts: z39.string().min(1).describe("Message timestamp."),
9826
+ content: z39.string().describe("Message text."),
9827
+ is_author_bot: z39.boolean().optional().describe("Whether the author is a bot."),
9828
+ permalink: z39.string().url().describe("Message permalink.")
10257
9829
  });
10258
- var searchFileSchema = z40.object({
10259
- file_id: z40.string().min(1).describe("File ID."),
10260
- title: z40.string().min(1).optional().describe("File title."),
10261
- name: z40.string().min(1).optional().describe("File name."),
10262
- filetype: z40.string().min(1).optional().describe("File type."),
10263
- user_id: z40.string().min(1).optional().describe("Uploader user ID."),
10264
- user_name: z40.string().min(1).optional().describe("Uploader user name."),
10265
- channel_id: z40.string().min(1).optional().describe("Channel ID."),
10266
- channel_name: z40.string().min(1).optional().describe("Channel name."),
10267
- permalink: z40.string().url().optional().describe("File permalink."),
10268
- content: z40.string().min(1).optional().describe("File preview or content snippet.")
9830
+ var searchFileSchema = z39.object({
9831
+ file_id: z39.string().min(1).describe("File ID."),
9832
+ title: z39.string().min(1).optional().describe("File title."),
9833
+ name: z39.string().min(1).optional().describe("File name."),
9834
+ filetype: z39.string().min(1).optional().describe("File type."),
9835
+ user_id: z39.string().min(1).optional().describe("Uploader user ID."),
9836
+ user_name: z39.string().min(1).optional().describe("Uploader user name."),
9837
+ channel_id: z39.string().min(1).optional().describe("Channel ID."),
9838
+ channel_name: z39.string().min(1).optional().describe("Channel name."),
9839
+ permalink: z39.string().url().optional().describe("File permalink."),
9840
+ content: z39.string().min(1).optional().describe("File preview or content snippet.")
10269
9841
  });
10270
- var searchChannelSchema = z40.object({
10271
- channel_id: z40.string().min(1).describe("Channel ID."),
10272
- channel_name: z40.string().min(1).optional().describe("Channel name."),
10273
- is_private: z40.boolean().optional().describe("Whether the channel is private."),
10274
- is_member: z40.boolean().optional().describe("Whether the bot is a member."),
10275
- topic: z40.string().min(1).optional().describe("Channel topic."),
10276
- purpose: z40.string().min(1).optional().describe("Channel purpose."),
10277
- permalink: z40.string().url().optional().describe("Channel permalink.")
9842
+ var searchChannelSchema = z39.object({
9843
+ channel_id: z39.string().min(1).describe("Channel ID."),
9844
+ channel_name: z39.string().min(1).optional().describe("Channel name."),
9845
+ is_private: z39.boolean().optional().describe("Whether the channel is private."),
9846
+ is_member: z39.boolean().optional().describe("Whether the bot is a member."),
9847
+ topic: z39.string().min(1).optional().describe("Channel topic."),
9848
+ purpose: z39.string().min(1).optional().describe("Channel purpose."),
9849
+ permalink: z39.string().url().optional().describe("Channel permalink.")
10278
9850
  });
10279
- var searchUserSchema = z40.object({
10280
- user_id: z40.string().min(1).describe("User ID."),
10281
- user_name: z40.string().min(1).optional().describe("Username."),
10282
- real_name: z40.string().min(1).optional().describe("Real name."),
10283
- display_name: z40.string().min(1).optional().describe("Display name."),
10284
- title: z40.string().min(1).optional().describe("Profile title."),
10285
- permalink: z40.string().url().optional().describe("Profile permalink.")
9851
+ var searchUserSchema = z39.object({
9852
+ user_id: z39.string().min(1).describe("User ID."),
9853
+ user_name: z39.string().min(1).optional().describe("Username."),
9854
+ real_name: z39.string().min(1).optional().describe("Real name."),
9855
+ display_name: z39.string().min(1).optional().describe("Display name."),
9856
+ title: z39.string().min(1).optional().describe("Profile title."),
9857
+ permalink: z39.string().url().optional().describe("Profile permalink.")
10286
9858
  });
10287
9859
  var publicSearchOutputSchema = juniorToolOutputSchema.extend({
10288
- query: z40.string().describe("Search query."),
10289
- content_types: z40.array(z40.enum(CONTENT_TYPES)).describe("Content types included in the search."),
10290
- count: z40.number().int().nonnegative().describe("Total matched results."),
10291
- messages: z40.array(searchMessageSchema).describe("Matched messages."),
10292
- files: z40.array(searchFileSchema).describe("Matched files."),
10293
- channels: z40.array(searchChannelSchema).describe("Matched channels."),
10294
- users: z40.array(searchUserSchema).describe("Matched users."),
10295
- next_cursor: z40.string().min(1).optional().describe("Cursor for the next result page.")
9860
+ query: z39.string().describe("Search query."),
9861
+ content_types: z39.array(z39.enum(CONTENT_TYPES)).describe("Content types included in the search."),
9862
+ count: z39.number().int().nonnegative().describe("Total matched results."),
9863
+ messages: z39.array(searchMessageSchema).describe("Matched messages."),
9864
+ files: z39.array(searchFileSchema).describe("Matched files."),
9865
+ channels: z39.array(searchChannelSchema).describe("Matched channels."),
9866
+ users: z39.array(searchUserSchema).describe("Matched users."),
9867
+ next_cursor: z39.string().min(1).optional().describe("Cursor for the next result page.")
10296
9868
  });
10297
- var nonEmptyString = z40.string().trim().min(1);
10298
- var optionalWireString = z40.preprocess((value) => {
9869
+ var nonEmptyString = z39.string().trim().min(1);
9870
+ var optionalWireString = z39.preprocess((value) => {
10299
9871
  if (typeof value !== "string") {
10300
9872
  return void 0;
10301
9873
  }
10302
9874
  const trimmed = value.trim();
10303
9875
  return trimmed === "" ? void 0 : trimmed;
10304
9876
  }, nonEmptyString.optional());
10305
- var optionalWireUrl = z40.preprocess((value) => {
9877
+ var optionalWireUrl = z39.preprocess((value) => {
10306
9878
  if (typeof value !== "string") {
10307
9879
  return void 0;
10308
9880
  }
@@ -10316,20 +9888,20 @@ var optionalWireUrl = z40.preprocess((value) => {
10316
9888
  } catch {
10317
9889
  return void 0;
10318
9890
  }
10319
- }, z40.string().url().optional());
10320
- var optionalWireBoolean = z40.preprocess(
9891
+ }, z39.string().url().optional());
9892
+ var optionalWireBoolean = z39.preprocess(
10321
9893
  (value) => typeof value === "boolean" ? value : void 0,
10322
- z40.boolean().optional()
9894
+ z39.boolean().optional()
10323
9895
  );
10324
- var slackSearchMessageWireSchema = z40.object({
9896
+ var slackSearchMessageWireSchema = z39.object({
10325
9897
  author_name: optionalWireString,
10326
9898
  author_user_id: optionalWireString,
10327
9899
  channel_id: nonEmptyString,
10328
9900
  channel_name: optionalWireString,
10329
9901
  message_ts: nonEmptyString,
10330
- content: z40.string(),
9902
+ content: z39.string(),
10331
9903
  is_author_bot: optionalWireBoolean,
10332
- permalink: z40.string().url()
9904
+ permalink: z39.string().url()
10333
9905
  }).transform(
10334
9906
  (value) => ({
10335
9907
  channel_id: value.channel_id,
@@ -10342,7 +9914,7 @@ var slackSearchMessageWireSchema = z40.object({
10342
9914
  ...value.is_author_bot !== void 0 ? { is_author_bot: value.is_author_bot } : {}
10343
9915
  })
10344
9916
  );
10345
- var slackSearchFileWireSchema = z40.object({
9917
+ var slackSearchFileWireSchema = z39.object({
10346
9918
  id: optionalWireString,
10347
9919
  file_id: optionalWireString,
10348
9920
  title: optionalWireString,
@@ -10376,7 +9948,7 @@ var slackSearchFileWireSchema = z40.object({
10376
9948
  ...value.content ?? value.preview ? { content: value.content ?? value.preview } : {}
10377
9949
  };
10378
9950
  });
10379
- var slackSearchChannelWireSchema = z40.object({
9951
+ var slackSearchChannelWireSchema = z39.object({
10380
9952
  id: optionalWireString,
10381
9953
  channel_id: optionalWireString,
10382
9954
  name: optionalWireString,
@@ -10401,7 +9973,7 @@ var slackSearchChannelWireSchema = z40.object({
10401
9973
  ...value.permalink ? { permalink: value.permalink } : {}
10402
9974
  };
10403
9975
  });
10404
- var slackSearchUserWireSchema = z40.object({
9976
+ var slackSearchUserWireSchema = z39.object({
10405
9977
  id: optionalWireString,
10406
9978
  user_id: optionalWireString,
10407
9979
  name: optionalWireString,
@@ -10425,12 +9997,12 @@ var slackSearchUserWireSchema = z40.object({
10425
9997
  ...value.permalink ? { permalink: value.permalink } : {}
10426
9998
  };
10427
9999
  });
10428
- var slackSearchResponseSchema = z40.object({
10429
- results: z40.object({
10430
- messages: z40.array(z40.unknown()).default([]),
10431
- files: z40.array(z40.unknown()).default([]),
10432
- channels: z40.array(z40.unknown()).default([]),
10433
- users: z40.array(z40.unknown()).default([]),
10000
+ var slackSearchResponseSchema = z39.object({
10001
+ results: z39.object({
10002
+ messages: z39.array(z39.unknown()).default([]),
10003
+ files: z39.array(z39.unknown()).default([]),
10004
+ channels: z39.array(z39.unknown()).default([]),
10005
+ users: z39.array(z39.unknown()).default([]),
10434
10006
  // Slack often returns "" on the final page; omit rather than fail the parse.
10435
10007
  next_cursor: optionalWireString
10436
10008
  }).default({
@@ -10479,15 +10051,15 @@ function createSlackPublicSearchTool(actionToken) {
10479
10051
  openWorldHint: true,
10480
10052
  readOnlyHint: true
10481
10053
  },
10482
- inputSchema: z40.object({
10483
- query: z40.string().trim().min(1).max(500).describe("Slack search query."),
10484
- content_types: z40.array(z40.enum(CONTENT_TYPES)).min(1).max(4).describe("Content types to include. Defaults to messages.").optional(),
10054
+ inputSchema: z39.object({
10055
+ query: z39.string().trim().min(1).max(500).describe("Slack search query."),
10056
+ content_types: z39.array(z39.enum(CONTENT_TYPES)).min(1).max(4).describe("Content types to include. Defaults to messages.").optional(),
10485
10057
  after: optionalUnixTimestampParam("Unix timestamp lower bound."),
10486
10058
  before: optionalUnixTimestampParam("Unix timestamp upper bound."),
10487
- cursor: z40.string().min(1).describe("Cursor for the next result page.").optional(),
10488
- limit: z40.coerce.number().int().min(1).max(20).describe("Maximum results to return; Slack allows at most 20.").optional(),
10489
- sort: z40.enum(["score", "timestamp"]).describe("Rank by relevance or timestamp.").optional(),
10490
- sort_dir: z40.enum(["asc", "desc"]).describe("Sort direction.").optional()
10059
+ cursor: z39.string().min(1).describe("Cursor for the next result page.").optional(),
10060
+ limit: z39.coerce.number().int().min(1).max(20).describe("Maximum results to return; Slack allows at most 20.").optional(),
10061
+ sort: z39.enum(["score", "timestamp"]).describe("Rank by relevance or timestamp.").optional(),
10062
+ sort_dir: z39.enum(["asc", "desc"]).describe("Sort direction.").optional()
10491
10063
  }),
10492
10064
  outputSchema: publicSearchOutputSchema,
10493
10065
  execute: async ({
@@ -10572,7 +10144,7 @@ function createSlackPublicSearchTool(actionToken) {
10572
10144
  }
10573
10145
 
10574
10146
  // src/chat/slack/tools/message-add-reaction.ts
10575
- import { z as z41 } from "zod";
10147
+ import { z as z40 } from "zod";
10576
10148
 
10577
10149
  // src/chat/tools/idempotency.ts
10578
10150
  function stableSerialize(value) {
@@ -10603,8 +10175,8 @@ function createSlackMessageAddReactionTool(context, state) {
10603
10175
  readOnlyHint: false
10604
10176
  },
10605
10177
  description: "Add an emoji reaction to the current inbound Slack message.",
10606
- inputSchema: z41.object({
10607
- emoji: z41.string().min(1).max(64).describe(
10178
+ inputSchema: z40.object({
10179
+ emoji: z40.string().min(1).max(64).describe(
10608
10180
  "Slack emoji alias name to react with (for example `thumbsup`, `white_check_mark`, or `thumbsup::skin-tone-6`). Optional surrounding colons are allowed."
10609
10181
  )
10610
10182
  }),
@@ -10652,15 +10224,15 @@ function createSlackMessageAddReactionTool(context, state) {
10652
10224
  }
10653
10225
 
10654
10226
  // src/chat/slack/tools/send-files.ts
10655
- import { createHash as createHash4 } from "crypto";
10656
- import { z as z42 } from "zod";
10227
+ import { createHash as createHash3 } from "crypto";
10228
+ import { z as z41 } from "zod";
10657
10229
  var sendFilesResultSchema = juniorToolOutputSchema.extend({
10658
- deduplicated: z42.boolean().optional(),
10659
- attachment_refs: z42.array(
10660
- z42.object({
10661
- id: z42.string().min(1),
10230
+ deduplicated: z41.boolean().optional(),
10231
+ attachment_refs: z41.array(
10232
+ z41.object({
10233
+ id: z41.string().min(1),
10662
10234
  // Same noun as storage, delivery events, and the report API.
10663
- filename: z42.string().min(1)
10235
+ filename: z41.string().min(1)
10664
10236
  })
10665
10237
  )
10666
10238
  });
@@ -10672,7 +10244,7 @@ function normalizeFiles(files) {
10672
10244
  }));
10673
10245
  }
10674
10246
  function fileContentDigest(data) {
10675
- return createHash4("sha256").update(data).digest("hex");
10247
+ return createHash3("sha256").update(data).digest("hex");
10676
10248
  }
10677
10249
  function fileOperationInput(files) {
10678
10250
  return files.map((file) => ({
@@ -10692,8 +10264,8 @@ function createSendFilesTool(context, state, materializeFile, attachments) {
10692
10264
  readOnlyHint: false
10693
10265
  },
10694
10266
  description: "Send one or more sandbox files into the active Slack conversation.",
10695
- inputSchema: z42.object({
10696
- files: z42.array(sandboxFileReferenceSchema).min(1).describe(
10267
+ inputSchema: z41.object({
10268
+ files: z41.array(sandboxFileReferenceSchema).min(1).describe(
10697
10269
  "One or more existing sandbox files. Objects returned by imageGenerate or webFetch can be passed unchanged."
10698
10270
  )
10699
10271
  }),
@@ -11120,7 +10692,7 @@ async function readCanvas(canvasIdOrUrl) {
11120
10692
  }
11121
10693
 
11122
10694
  // src/chat/slack/tools/canvas/create.ts
11123
- import { z as z43 } from "zod";
10695
+ import { z as z42 } from "zod";
11124
10696
  function createSlackCanvasCreateTool(context, state) {
11125
10697
  return zodTool({
11126
10698
  annotations: {
@@ -11130,9 +10702,9 @@ function createSlackCanvasCreateTool(context, state) {
11130
10702
  readOnlyHint: false
11131
10703
  },
11132
10704
  description: "Create a Slack canvas in the active channel.",
11133
- inputSchema: z43.object({
11134
- title: z43.string().min(1).max(160).describe("Canvas title."),
11135
- markdown: z43.string().min(1).describe("Canvas markdown body content.")
10705
+ inputSchema: z42.object({
10706
+ title: z42.string().min(1).max(160).describe("Canvas title."),
10707
+ markdown: z42.string().min(1).describe("Canvas markdown body content.")
11136
10708
  }),
11137
10709
  outputSchema: juniorToolOutputSchema,
11138
10710
  execute: async ({ title, markdown }) => {
@@ -11176,8 +10748,8 @@ function createSlackCanvasCreateTool(context, state) {
11176
10748
  }
11177
10749
 
11178
10750
  // src/chat/slack/tool-support/canvas/context.ts
11179
- import { z as z44 } from "zod";
11180
- var slackCanvasRefParam = z44.string().min(1).describe("Slack canvas/file ID or canvas/docs URL.");
10751
+ import { z as z43 } from "zod";
10752
+ var slackCanvasRefParam = z43.string().min(1).describe("Slack canvas/file ID or canvas/docs URL.");
11181
10753
  function resolveCanvasTarget(canvas) {
11182
10754
  const canvasId = extractCanvasId(canvas);
11183
10755
  if (!canvasId) {
@@ -11190,26 +10762,26 @@ function resolveCanvasTarget(canvas) {
11190
10762
  }
11191
10763
 
11192
10764
  // src/chat/slack/tools/canvas/edit.ts
11193
- import { z as z45 } from "zod";
10765
+ import { z as z44 } from "zod";
11194
10766
  function prepareCanvasEditArguments(input) {
11195
10767
  return prepareTextReplacementArguments(input);
11196
10768
  }
11197
- var editReplacementSchema2 = z45.object({
11198
- oldText: z45.string().min(1).describe(
10769
+ var editReplacementSchema2 = z44.object({
10770
+ oldText: z44.string().min(1).describe(
11199
10771
  "Exact Canvas markdown to replace. It must be unique in the current Canvas body and must not overlap another edit."
11200
10772
  ),
11201
- newText: z45.string().describe("Replacement Canvas markdown for this edit.")
10773
+ newText: z44.string().describe("Replacement Canvas markdown for this edit.")
11202
10774
  });
11203
10775
  var slackCanvasEditOutputSchema = juniorToolOutputSchema.extend({
11204
- canvas_id: z45.string().optional(),
11205
- title: z45.string().optional(),
11206
- permalink: z45.string().optional(),
11207
- diff: z45.string().optional(),
11208
- first_changed_line: z45.number().int().positive().optional(),
11209
- replacements: z45.number().int().nonnegative().optional(),
11210
- normalized_heading_count: z45.number().int().nonnegative().optional(),
11211
- summary: z45.string().optional(),
11212
- deduplicated: z45.boolean().optional()
10776
+ canvas_id: z44.string().optional(),
10777
+ title: z44.string().optional(),
10778
+ permalink: z44.string().optional(),
10779
+ diff: z44.string().optional(),
10780
+ first_changed_line: z44.number().int().positive().optional(),
10781
+ replacements: z44.number().int().nonnegative().optional(),
10782
+ normalized_heading_count: z44.number().int().nonnegative().optional(),
10783
+ summary: z44.string().optional(),
10784
+ deduplicated: z44.boolean().optional()
11213
10785
  }).strict();
11214
10786
  function createSlackCanvasEditTool(state) {
11215
10787
  return zodTool({
@@ -11222,9 +10794,9 @@ function createSlackCanvasEditTool(state) {
11222
10794
  description: "Edit a Slack canvas with exact markdown replacements. Returns a diff.",
11223
10795
  prepareArguments: prepareCanvasEditArguments,
11224
10796
  executionMode: "sequential",
11225
- inputSchema: z45.object({
10797
+ inputSchema: z44.object({
11226
10798
  canvas: slackCanvasRefParam,
11227
- edits: z45.array(editReplacementSchema2).min(1).describe(
10799
+ edits: z44.array(editReplacementSchema2).min(1).describe(
11228
10800
  "Exact replacements matched against the current Canvas body, not incrementally."
11229
10801
  )
11230
10802
  }),
@@ -11277,18 +10849,18 @@ function createSlackCanvasEditTool(state) {
11277
10849
  }
11278
10850
 
11279
10851
  // src/chat/slack/tools/canvas/read.ts
11280
- import { z as z46 } from "zod";
10852
+ import { z as z45 } from "zod";
11281
10853
  var slackCanvasReadOutputSchema = juniorToolOutputSchema.extend({
11282
- canvas_id: z46.string().optional(),
11283
- title: z46.string().optional(),
11284
- permalink: z46.string().optional(),
11285
- mimetype: z46.string().optional(),
11286
- filetype: z46.string().optional(),
11287
- original_byte_length: z46.number().int().nonnegative().optional(),
11288
- content: z46.string().optional(),
11289
- start_line: z46.number().int().positive().optional(),
11290
- end_line: z46.number().int().nonnegative().optional(),
11291
- total_lines: z46.number().int().nonnegative().optional()
10854
+ canvas_id: z45.string().optional(),
10855
+ title: z45.string().optional(),
10856
+ permalink: z45.string().optional(),
10857
+ mimetype: z45.string().optional(),
10858
+ filetype: z45.string().optional(),
10859
+ original_byte_length: z45.number().int().nonnegative().optional(),
10860
+ content: z45.string().optional(),
10861
+ start_line: z45.number().int().positive().optional(),
10862
+ end_line: z45.number().int().nonnegative().optional(),
10863
+ total_lines: z45.number().int().nonnegative().optional()
11292
10864
  }).strict();
11293
10865
  function createSlackCanvasReadTool() {
11294
10866
  return zodTool({
@@ -11299,10 +10871,10 @@ function createSlackCanvasReadTool() {
11299
10871
  openWorldHint: true,
11300
10872
  readOnlyHint: true
11301
10873
  },
11302
- inputSchema: z46.object({
10874
+ inputSchema: z45.object({
11303
10875
  canvas: slackCanvasRefParam,
11304
- offset: z46.coerce.number().int().min(1).describe("1-indexed line number to start reading from.").optional(),
11305
- limit: z46.coerce.number().int().min(1).describe("Maximum number of lines to read. Defaults to 1000.").optional()
10876
+ offset: z45.coerce.number().int().min(1).describe("1-indexed line number to start reading from.").optional(),
10877
+ limit: z45.coerce.number().int().min(1).describe("Maximum number of lines to read. Defaults to 1000.").optional()
11306
10878
  }),
11307
10879
  outputSchema: slackCanvasReadOutputSchema,
11308
10880
  execute: async ({ canvas, offset, limit }) => {
@@ -11338,7 +10910,7 @@ function createSlackCanvasReadTool() {
11338
10910
  }
11339
10911
 
11340
10912
  // src/chat/slack/tools/canvas/write.ts
11341
- import { z as z47 } from "zod";
10913
+ import { z as z46 } from "zod";
11342
10914
  function createSlackCanvasWriteTool(state) {
11343
10915
  return zodTool({
11344
10916
  annotations: {
@@ -11349,9 +10921,9 @@ function createSlackCanvasWriteTool(state) {
11349
10921
  },
11350
10922
  description: "Replace the full markdown body of a Slack canvas.",
11351
10923
  executionMode: "sequential",
11352
- inputSchema: z47.object({
10924
+ inputSchema: z46.object({
11353
10925
  canvas: slackCanvasRefParam,
11354
- content: z47.string().describe("UTF-8 markdown content to write.")
10926
+ content: z46.string().describe("UTF-8 markdown content to write.")
11355
10927
  }),
11356
10928
  outputSchema: juniorToolOutputSchema,
11357
10929
  execute: async ({ canvas, content }) => {
@@ -11573,12 +11145,12 @@ async function updateListItem(input) {
11573
11145
  }
11574
11146
 
11575
11147
  // src/chat/slack/tool-support/list/params.ts
11576
- import { z as z48 } from "zod";
11577
- var slackListIdParam = z48.string().min(1).describe("Slack list ID.");
11578
- var slackListItemIdParam = z48.string().min(1).describe("Slack list item ID.");
11148
+ import { z as z47 } from "zod";
11149
+ var slackListIdParam = z47.string().min(1).describe("Slack list ID.");
11150
+ var slackListItemIdParam = z47.string().min(1).describe("Slack list item ID.");
11579
11151
 
11580
11152
  // src/chat/slack/tools/list/add-items.ts
11581
- import { z as z49 } from "zod";
11153
+ import { z as z48 } from "zod";
11582
11154
  function createSlackListAddItemsTool(state) {
11583
11155
  return zodTool({
11584
11156
  annotations: {
@@ -11588,13 +11160,13 @@ function createSlackListAddItemsTool(state) {
11588
11160
  readOnlyHint: false
11589
11161
  },
11590
11162
  description: "Add tasks to a Slack list.",
11591
- inputSchema: z49.object({
11163
+ inputSchema: z48.object({
11592
11164
  list_id: slackListIdParam,
11593
- items: z49.array(z49.string().min(1)).min(1).max(25).describe("List item titles to create."),
11165
+ items: z48.array(z48.string().min(1)).min(1).max(25).describe("List item titles to create."),
11594
11166
  assignee_user_id: slackUserIdParam(
11595
11167
  "Optional Slack user ID assigned to all created items."
11596
11168
  ).optional(),
11597
- due_date: z49.string().regex(/^\d{4}-\d{2}-\d{2}$/).describe("Optional due date in YYYY-MM-DD format.").optional()
11169
+ due_date: z48.string().regex(/^\d{4}-\d{2}-\d{2}$/).describe("Optional due date in YYYY-MM-DD format.").optional()
11598
11170
  }),
11599
11171
  outputSchema: juniorToolOutputSchema,
11600
11172
  execute: async ({ list_id, items, assignee_user_id, due_date }) => {
@@ -11633,7 +11205,7 @@ function createSlackListAddItemsTool(state) {
11633
11205
  }
11634
11206
 
11635
11207
  // src/chat/slack/tools/list/create.ts
11636
- import { z as z50 } from "zod";
11208
+ import { z as z49 } from "zod";
11637
11209
  function createSlackListCreateTool(state) {
11638
11210
  return zodTool({
11639
11211
  annotations: {
@@ -11643,8 +11215,8 @@ function createSlackListCreateTool(state) {
11643
11215
  readOnlyHint: false
11644
11216
  },
11645
11217
  description: "Create a Slack todo list.",
11646
- inputSchema: z50.object({
11647
- name: z50.string().min(1).max(160).describe("Name for the new Slack list.")
11218
+ inputSchema: z49.object({
11219
+ name: z49.string().min(1).max(160).describe("Name for the new Slack list.")
11648
11220
  }),
11649
11221
  outputSchema: juniorToolOutputSchema,
11650
11222
  execute: async ({ name }) => {
@@ -11669,7 +11241,7 @@ function createSlackListCreateTool(state) {
11669
11241
  }
11670
11242
 
11671
11243
  // src/chat/slack/tools/list/get-items.ts
11672
- import { z as z51 } from "zod";
11244
+ import { z as z50 } from "zod";
11673
11245
  function createSlackListGetItemsTool() {
11674
11246
  return zodTool({
11675
11247
  description: "Read items from a Slack list.",
@@ -11679,9 +11251,9 @@ function createSlackListGetItemsTool() {
11679
11251
  openWorldHint: true,
11680
11252
  readOnlyHint: true
11681
11253
  },
11682
- inputSchema: z51.object({
11254
+ inputSchema: z50.object({
11683
11255
  list_id: slackListIdParam,
11684
- limit: z51.coerce.number().int().min(1).max(200).describe("Maximum number of list items to return.").optional()
11256
+ limit: z50.coerce.number().int().min(1).max(200).describe("Maximum number of list items to return.").optional()
11685
11257
  }),
11686
11258
  outputSchema: juniorToolOutputSchema,
11687
11259
  execute: async ({ list_id, limit }) => {
@@ -11696,23 +11268,23 @@ function createSlackListGetItemsTool() {
11696
11268
  }
11697
11269
 
11698
11270
  // src/chat/slack/tools/list/update-item.ts
11699
- import { z as z52 } from "zod";
11700
- var booleanInput3 = (description) => z52.preprocess(
11271
+ import { z as z51 } from "zod";
11272
+ var booleanInput3 = (description) => z51.preprocess(
11701
11273
  (value) => value === "true" ? true : value === "false" ? false : value,
11702
- z52.boolean()
11274
+ z51.boolean()
11703
11275
  ).describe(description);
11704
- var updateListItemInputSchema = z52.union([
11705
- z52.object({
11276
+ var updateListItemInputSchema = z51.union([
11277
+ z51.object({
11706
11278
  list_id: slackListIdParam,
11707
11279
  item_id: slackListItemIdParam,
11708
11280
  completed: booleanInput3("Optional completion status update."),
11709
- title: z52.string().min(1).describe("Optional new item title.").optional()
11281
+ title: z51.string().min(1).describe("Optional new item title.").optional()
11710
11282
  }),
11711
- z52.object({
11283
+ z51.object({
11712
11284
  list_id: slackListIdParam,
11713
11285
  item_id: slackListItemIdParam,
11714
11286
  completed: booleanInput3("Optional completion status update.").optional(),
11715
- title: z52.string().min(1).describe("Optional new item title.")
11287
+ title: z51.string().min(1).describe("Optional new item title.")
11716
11288
  })
11717
11289
  ]);
11718
11290
  function createSlackListUpdateItemTool(state) {
@@ -11760,7 +11332,7 @@ function createSlackListUpdateItemTool(state) {
11760
11332
  }
11761
11333
 
11762
11334
  // src/chat/slack/tools/thread-read.ts
11763
- import { z as z53 } from "zod";
11335
+ import { z as z52 } from "zod";
11764
11336
 
11765
11337
  // src/chat/slack/tool-support/slack-message-url.ts
11766
11338
  var SLACK_HOST_PATTERN = /^[a-z0-9-]+\.slack(?:-gov)?\.com$/;
@@ -12026,14 +11598,14 @@ function createSlackThreadReadTool(context) {
12026
11598
  openWorldHint: true,
12027
11599
  readOnlyHint: true
12028
11600
  },
12029
- inputSchema: z53.object({
12030
- url: z53.string().min(1).describe("Slack message archive URL.").optional(),
11601
+ inputSchema: z52.object({
11602
+ url: z52.string().min(1).describe("Slack message archive URL.").optional(),
12031
11603
  channel_id: slackChannelRefParam.optional(),
12032
11604
  ts: slackTimestampParam(
12033
11605
  "Slack message timestamp. May be the thread root or any message in the thread."
12034
11606
  ).optional(),
12035
- limit: z53.coerce.number().int().min(1).max(1e3).describe("Maximum number of thread messages to fetch.").optional(),
12036
- max_pages: z53.coerce.number().int().min(1).max(10).describe("Maximum number of Slack API pages to traverse.").optional()
11607
+ limit: z52.coerce.number().int().min(1).max(1e3).describe("Maximum number of thread messages to fetch.").optional(),
11608
+ max_pages: z52.coerce.number().int().min(1).max(10).describe("Maximum number of Slack API pages to traverse.").optional()
12037
11609
  }),
12038
11610
  outputSchema: juniorToolOutputSchema,
12039
11611
  execute: async ({ url, channel_id, ts, limit, max_pages }) => {
@@ -12160,7 +11732,7 @@ function createSlackThreadReadTool(context) {
12160
11732
  // src/chat/tools/user-lookup.ts
12161
11733
  import { and, eq, or, sql } from "drizzle-orm";
12162
11734
  import { alias } from "drizzle-orm/pg-core";
12163
- import { z as z54 } from "zod";
11735
+ import { z as z53 } from "zod";
12164
11736
  var linkedSlackIdentity = alias(juniorIdentities, "user_lookup_slack_identity");
12165
11737
  function explicitUserLookupError(error) {
12166
11738
  if (error.apiError === "user_not_found" || error.code === "not_found") {
@@ -12309,9 +11881,9 @@ function createUserLookupTool(teamId, providers) {
12309
11881
  openWorldHint: true,
12310
11882
  readOnlyHint: true
12311
11883
  },
12312
- inputSchema: z54.object({
12313
- provider: z54.enum(providers).describe("Enabled identity provider to query."),
12314
- query: z54.string().trim().min(1).describe("Provider subject ID, handle, Slack email, or Slack name.")
11884
+ inputSchema: z53.object({
11885
+ provider: z53.enum(providers).describe("Enabled identity provider to query."),
11886
+ query: z53.string().trim().min(1).describe("Provider subject ID, handle, Slack email, or Slack name.")
12315
11887
  }).strict(),
12316
11888
  outputSchema: juniorToolOutputSchema,
12317
11889
  execute: async ({ provider, query }) => {
@@ -12331,18 +11903,18 @@ function createUserLookupTool(teamId, providers) {
12331
11903
  }
12332
11904
 
12333
11905
  // src/chat/tools/system-time.ts
12334
- import { z as z55 } from "zod";
12335
- var systemTimeInputSchema = z55.object({
12336
- timezone: z55.string().trim().min(1).optional().describe(
11906
+ import { z as z54 } from "zod";
11907
+ var systemTimeInputSchema = z54.object({
11908
+ timezone: z54.string().trim().min(1).optional().describe(
12337
11909
  "Optional IANA timezone, for example America/Los_Angeles. When set, iso_local and timezone_offset_minutes are for that zone."
12338
11910
  )
12339
11911
  });
12340
11912
  var systemTimeOutputSchema = juniorToolOutputSchema.extend({
12341
- unix_ms: z55.number(),
12342
- iso_utc: z55.string(),
12343
- iso_local: z55.string(),
12344
- timezone: z55.string().nullable(),
12345
- timezone_offset_minutes: z55.number()
11913
+ unix_ms: z54.number(),
11914
+ iso_utc: z54.string(),
11915
+ iso_local: z54.string(),
11916
+ timezone: z54.string().nullable(),
11917
+ timezone_offset_minutes: z54.number()
12346
11918
  });
12347
11919
  function createSystemTimeTool() {
12348
11920
  return zodTool({
@@ -12422,10 +11994,10 @@ function getTimeZoneOffsetMinutes(timestampMs, timezone) {
12422
11994
  }
12423
11995
 
12424
11996
  // src/chat/tools/publish-image.ts
12425
- import { z as z56 } from "zod";
11997
+ import { z as z55 } from "zod";
12426
11998
 
12427
11999
  // src/chat/artifacts/store.ts
12428
- import { createHash as createHash5, randomUUID as randomUUID3 } from "crypto";
12000
+ import { createHash as createHash4, randomUUID as randomUUID3 } from "crypto";
12429
12001
  import { and as and2, eq as eq2, isNull } from "drizzle-orm";
12430
12002
  var MAX_IMAGE_BYTES = 10 * 1024 * 1024;
12431
12003
  var IMAGE_TYPES = {
@@ -12508,7 +12080,7 @@ async function publishImage(args) {
12508
12080
  );
12509
12081
  }
12510
12082
  const baseUrl = resolvePublicBaseUrl(args.publicBaseUrl);
12511
- const sha256 = createHash5("sha256").update(args.body).digest("hex");
12083
+ const sha256 = createHash4("sha256").update(args.body).digest("hex");
12512
12084
  const now = args.now ?? /* @__PURE__ */ new Date();
12513
12085
  const [existing] = await args.db.db().select({
12514
12086
  id: juniorArtifacts.id
@@ -12623,10 +12195,10 @@ function unpublishedArtifactHeaders() {
12623
12195
 
12624
12196
  // src/chat/tools/publish-image.ts
12625
12197
  var outputSchema5 = juniorToolOutputSchema.extend({
12626
- bytes: z56.number().int().positive(),
12627
- content_type: z56.string().min(1),
12628
- public: z56.literal(true),
12629
- url: z56.string().url()
12198
+ bytes: z55.number().int().positive(),
12199
+ content_type: z55.string().min(1),
12200
+ public: z55.literal(true),
12201
+ url: z55.string().url()
12630
12202
  });
12631
12203
  function createPublishImageTool(args) {
12632
12204
  return zodTool({
@@ -12640,8 +12212,8 @@ function createPublishImageTool(args) {
12640
12212
  description: "Publish one sandbox image to a durable public HTTPS URL. Anyone on the internet with the URL can view the image. Use only when an external destination needs a public image URL. Do not use for private file sharing or private conversation storage. Supports PNG, JPEG, GIF, and WebP up to 10 MB.",
12641
12213
  describeProposal: ({ path: path8 }) => `Publish sandbox image ${path8} to a public internet URL.`,
12642
12214
  executionMode: "sequential",
12643
- inputSchema: z56.object({
12644
- path: z56.string().min(1).describe("Exact sandbox path of an existing image file.")
12215
+ inputSchema: z55.object({
12216
+ path: z55.string().min(1).describe("Exact sandbox path of an existing image file.")
12645
12217
  }).strict(),
12646
12218
  outputSchema: outputSchema5,
12647
12219
  async execute({ path: path8 }) {
@@ -12674,10 +12246,10 @@ function createPublishImageTool(args) {
12674
12246
  }
12675
12247
 
12676
12248
  // src/chat/tools/unpublish-image.ts
12677
- import { z as z57 } from "zod";
12249
+ import { z as z56 } from "zod";
12678
12250
  var outputSchema6 = juniorToolOutputSchema.extend({
12679
- filename: z57.string().min(1),
12680
- unpublished: z57.literal(true)
12251
+ filename: z56.string().min(1),
12252
+ unpublished: z56.literal(true)
12681
12253
  });
12682
12254
  function createUnpublishImageTool(args) {
12683
12255
  return zodTool({
@@ -12691,8 +12263,8 @@ function createUnpublishImageTool(args) {
12691
12263
  description: "Unpublish one public image previously published in this conversation so its public URL stops serving. Pass the public artifact URL or `<id>.<ext>` filename. Only images owned by this conversation can be unpublished. Republishing the same image bytes later in this conversation restores a live URL for this conversation. Does not remove copies already fetched by browsers or GitHub.",
12692
12264
  describeProposal: ({ ref }) => `Unpublish public image ${ref}.`,
12693
12265
  executionMode: "sequential",
12694
- inputSchema: z57.object({
12695
- ref: z57.string().min(1).describe(
12266
+ inputSchema: z56.object({
12267
+ ref: z56.string().min(1).describe(
12696
12268
  "Public artifact URL or artifact filename (`<id>.<ext>`)."
12697
12269
  )
12698
12270
  }).strict(),
@@ -12712,27 +12284,27 @@ function createUnpublishImageTool(args) {
12712
12284
  }
12713
12285
 
12714
12286
  // src/chat/tools/search-conversation-events.ts
12715
- import { z as z58 } from "zod";
12287
+ import { z as z57 } from "zod";
12716
12288
  var DEFAULT_LIMIT3 = 25;
12717
12289
  var MAX_LIMIT2 = 100;
12718
12290
  var MAX_EVENT_DATA_BYTES = 4e3;
12719
12291
  var MAX_EVENTS_JSON_BYTES = 2e4;
12720
12292
  var MAX_IDENTITY_CHARS = 256;
12721
12293
  var textEncoder = new TextEncoder();
12722
- var knownEventTypeSchema = z58.enum(KNOWN_CONVERSATION_EVENT_TYPES);
12723
- var projectedEventSchema = z58.object({
12724
- seq: z58.number().int().nonnegative().describe("Stable event position for pagination."),
12725
- history_version: z58.number().int().nonnegative().describe("Agent history generation after replacement."),
12726
- created_at: z58.iso.datetime().describe("When the event was recorded."),
12727
- idempotency_key: z58.string().min(1).optional().describe("Retry-stable event identity, when assigned."),
12728
- data: z58.record(z58.string(), z58.unknown()).describe("Bounded event data.")
12294
+ var knownEventTypeSchema = z57.enum(KNOWN_CONVERSATION_EVENT_TYPES);
12295
+ var projectedEventSchema = z57.object({
12296
+ seq: z57.number().int().nonnegative().describe("Stable event position for pagination."),
12297
+ history_version: z57.number().int().nonnegative().describe("Agent history generation after replacement."),
12298
+ created_at: z57.iso.datetime().describe("When the event was recorded."),
12299
+ idempotency_key: z57.string().min(1).optional().describe("Retry-stable event identity, when assigned."),
12300
+ data: z57.record(z57.string(), z57.unknown()).describe("Bounded event data.")
12729
12301
  }).strict();
12730
12302
  var searchConversationEventsOutputSchema = juniorToolOutputSchema.extend({
12731
- conversation_id: z58.string().min(1),
12732
- events: z58.array(projectedEventSchema),
12733
- has_older: z58.boolean().describe("Whether matching older events exist."),
12734
- has_newer: z58.boolean().describe("Whether matching newer events exist."),
12735
- omitted_event_count: z58.number().int().nonnegative().optional().describe("Events omitted by the response byte limit.")
12303
+ conversation_id: z57.string().min(1),
12304
+ events: z57.array(projectedEventSchema),
12305
+ has_older: z57.boolean().describe("Whether matching older events exist."),
12306
+ has_newer: z57.boolean().describe("Whether matching newer events exist."),
12307
+ omitted_event_count: z57.number().int().nonnegative().optional().describe("Events omitted by the response byte limit.")
12736
12308
  });
12737
12309
  function createSearchConversationEventsTool(context) {
12738
12310
  return zodTool({
@@ -12745,16 +12317,16 @@ function createSearchConversationEventsTool(context) {
12745
12317
  openWorldHint: false,
12746
12318
  readOnlyHint: true
12747
12319
  },
12748
- inputSchema: z58.object({
12749
- conversation_id: z58.string().trim().min(1).nullable().describe(
12320
+ inputSchema: z57.object({
12321
+ conversation_id: z57.string().trim().min(1).nullable().describe(
12750
12322
  "Conversation ID to search. Omit or null for the current conversation."
12751
12323
  ).optional(),
12752
- after_seq: z58.number().int().nonnegative().nullable().describe("Exclusive event sequence lower bound; returns ascending.").optional(),
12753
- before_seq: z58.number().int().nonnegative().nullable().describe("Exclusive event sequence upper bound.").optional(),
12754
- limit: z58.number().int().min(1).max(MAX_LIMIT2).nullable().describe(
12324
+ after_seq: z57.number().int().nonnegative().nullable().describe("Exclusive event sequence lower bound; returns ascending.").optional(),
12325
+ before_seq: z57.number().int().nonnegative().nullable().describe("Exclusive event sequence upper bound.").optional(),
12326
+ limit: z57.number().int().min(1).max(MAX_LIMIT2).nullable().describe(
12755
12327
  `Maximum events. Default ${DEFAULT_LIMIT3}; max ${MAX_LIMIT2}.`
12756
12328
  ).optional(),
12757
- types: z58.array(knownEventTypeSchema).min(1).nullable().describe("Event types to include; omit for all types.").optional()
12329
+ types: z57.array(knownEventTypeSchema).min(1).nullable().describe("Event types to include; omit for all types.").optional()
12758
12330
  }).strict(),
12759
12331
  outputSchema: searchConversationEventsOutputSchema,
12760
12332
  execute: async (input) => {
@@ -13000,10 +12572,10 @@ function stripReplacementHistoryField(value) {
13000
12572
  }
13001
12573
 
13002
12574
  // src/chat/tools/handoff/tool.ts
13003
- import { z as z59 } from "zod";
12575
+ import { z as z58 } from "zod";
13004
12576
  var HANDOFF_TOOL_NAME = "handoff";
13005
12577
  function createHandoffTool(handoff) {
13006
- const profileSchema = z59.enum(handoff.profiles);
12578
+ const profileSchema = z58.enum(handoff.profiles);
13007
12579
  const handoffResultSchema = juniorToolOutputSchema.extend({
13008
12580
  model_profile: modelProfileSchema
13009
12581
  });
@@ -13017,7 +12589,7 @@ function createHandoffTool(handoff) {
13017
12589
  },
13018
12590
  description: `Switch to another execution profile and continue the same task. Profiles: ${profileNames}. Call this as the only tool.`,
13019
12591
  executionMode: "sequential",
13020
- inputSchema: z59.object({
12592
+ inputSchema: z58.object({
13021
12593
  profile: profileSchema.describe("Target execution profile")
13022
12594
  }).strict(),
13023
12595
  outputSchema: handoffResultSchema,
@@ -13038,7 +12610,7 @@ function createHandoffTool(handoff) {
13038
12610
  }
13039
12611
 
13040
12612
  // src/chat/tools/web/fetch-tool.ts
13041
- import { z as z60 } from "zod";
12613
+ import { z as z59 } from "zod";
13042
12614
 
13043
12615
  // src/chat/tools/web/constants.ts
13044
12616
  var USER_AGENT = "junior-bot/0.1";
@@ -13487,9 +13059,9 @@ function createWebFetchTool(hooks, options = {}) {
13487
13059
  openWorldHint: true,
13488
13060
  readOnlyHint: true
13489
13061
  },
13490
- inputSchema: z60.object({
13491
- url: z60.string().min(1).describe("HTTP(S) URL to fetch."),
13492
- max_chars: z60.coerce.number().int().min(500).max(MAX_FETCH_CHARS).describe("Optional maximum number of extracted characters to return.").optional()
13062
+ inputSchema: z59.object({
13063
+ url: z59.string().min(1).describe("HTTP(S) URL to fetch."),
13064
+ max_chars: z59.coerce.number().int().min(500).max(MAX_FETCH_CHARS).describe("Optional maximum number of extracted characters to return.").optional()
13493
13065
  }),
13494
13066
  outputSchema: juniorToolOutputSchema,
13495
13067
  execute: async ({ url, max_chars }) => {
@@ -13534,7 +13106,7 @@ function createWebFetchTool(hooks, options = {}) {
13534
13106
  }
13535
13107
 
13536
13108
  // src/chat/tools/web/search.ts
13537
- import { z as z61 } from "zod";
13109
+ import { z as z60 } from "zod";
13538
13110
  import { generateText } from "ai";
13539
13111
  import { createGatewayProvider } from "@ai-sdk/gateway";
13540
13112
  var SEARCH_TIMEOUT_MS = 6e4;
@@ -13576,9 +13148,9 @@ function createWebSearchTool(modelId, override) {
13576
13148
  openWorldHint: true,
13577
13149
  readOnlyHint: true
13578
13150
  },
13579
- inputSchema: z61.object({
13580
- query: z61.string().min(1).max(500).describe("Search query."),
13581
- max_results: z61.coerce.number().int().min(1).max(MAX_RESULTS2).describe("Max results to return.").optional()
13151
+ inputSchema: z60.object({
13152
+ query: z60.string().min(1).max(500).describe("Search query."),
13153
+ max_results: z60.coerce.number().int().min(1).max(MAX_RESULTS2).describe("Max results to return.").optional()
13582
13154
  }),
13583
13155
  outputSchema: juniorToolOutputSchema,
13584
13156
  execute: async ({ query, max_results }) => {
@@ -13620,7 +13192,7 @@ function createWebSearchTool(modelId, override) {
13620
13192
  }
13621
13193
 
13622
13194
  // src/chat/tools/sandbox/write-file.ts
13623
- import { z as z62 } from "zod";
13195
+ import { z as z61 } from "zod";
13624
13196
  function createWriteFileTool() {
13625
13197
  return zodTool({
13626
13198
  annotations: {
@@ -13631,9 +13203,9 @@ function createWriteFileTool() {
13631
13203
  },
13632
13204
  description: "Write UTF-8 content to a file in the sandbox workspace. Use for intentional file creation or deliberate full-file replacement after validation; use editFile instead for targeted changes to existing files. Do not use for exploratory analysis-only turns.",
13633
13205
  executionMode: "sequential",
13634
- inputSchema: z62.object({
13635
- path: z62.string().min(1).describe("Path to write in the sandbox workspace."),
13636
- content: z62.string().describe("UTF-8 file content to write.")
13206
+ inputSchema: z61.object({
13207
+ path: z61.string().min(1).describe("Path to write in the sandbox workspace."),
13208
+ content: z61.string().describe("UTF-8 file content to write.")
13637
13209
  }),
13638
13210
  outputSchema: juniorToolOutputSchema,
13639
13211
  execute: async () => {
@@ -13645,7 +13217,7 @@ function createWriteFileTool() {
13645
13217
  }
13646
13218
 
13647
13219
  // src/chat/workspaces/tools.ts
13648
- import { z as z63 } from "zod";
13220
+ import { z as z62 } from "zod";
13649
13221
  async function tryRecordWorkspaceSwitchStat(workspace) {
13650
13222
  if (!process.env.DATABASE_URL) return;
13651
13223
  try {
@@ -13662,16 +13234,16 @@ async function tryRecordWorkspaceSwitchStat(workspace) {
13662
13234
  });
13663
13235
  }
13664
13236
  }
13665
- var repoSchema = z63.object({
13666
- provider: z63.string(),
13667
- repo: z63.string(),
13668
- checkout_path: z63.string()
13237
+ var repoSchema = z62.object({
13238
+ provider: z62.string(),
13239
+ repo: z62.string(),
13240
+ checkout_path: z62.string()
13669
13241
  });
13670
- var workspaceSchema = z63.object({
13671
- id: z63.string(),
13672
- name: z63.string(),
13673
- setup_script: z63.string(),
13674
- repos: z63.array(repoSchema)
13242
+ var workspaceSchema = z62.object({
13243
+ id: z62.string(),
13244
+ name: z62.string(),
13245
+ setup_script: z62.string(),
13246
+ repos: z62.array(repoSchema)
13675
13247
  });
13676
13248
  function view(workspace) {
13677
13249
  return {
@@ -13692,18 +13264,18 @@ function workspaceProviderNames() {
13692
13264
  }
13693
13265
  function workspaceWriteSchemas(providers) {
13694
13266
  const providerNames = providers.map((provider) => `\`${provider}\``).join(", ");
13695
- const repoInputSchema = z63.object({
13696
- provider: z63.enum(providers).describe(`Repository provider. Supported: ${providerNames}.`),
13697
- repo: z63.string().trim().min(1).describe("Repository in owner/name format.")
13267
+ const repoInputSchema = z62.object({
13268
+ provider: z62.enum(providers).describe(`Repository provider. Supported: ${providerNames}.`),
13269
+ repo: z62.string().trim().min(1).describe("Repository in owner/name format.")
13698
13270
  }).strict();
13699
- const workspaceInputSchema = z63.object({
13700
- name: z63.string().trim().min(1).describe(
13271
+ const workspaceInputSchema = z62.object({
13272
+ name: z62.string().trim().min(1).describe(
13701
13273
  "Workspace name. Use lowercase letters, digits, underscores, or hyphens."
13702
13274
  ),
13703
- setup_script: z63.string().nullable().describe(
13275
+ setup_script: z62.string().nullable().describe(
13704
13276
  "Optional shell script to run after repository checkout whenever this Workspace starts. Omit or use null for no setup script."
13705
13277
  ).optional(),
13706
- repos: z63.array(repoInputSchema).max(32).describe("Complete repository list.")
13278
+ repos: z62.array(repoInputSchema).max(32).describe("Complete repository list.")
13707
13279
  }).strict();
13708
13280
  return { providerNames, workspaceInputSchema };
13709
13281
  }
@@ -13778,7 +13350,7 @@ function createWorkspaceWriteTools(providers) {
13778
13350
  },
13779
13351
  description: `Replace an install-wide Workspace recipe. Repository providers: ${providerNames}. Use the Workspace ID returned by listWorkspaces.`,
13780
13352
  inputSchema: workspaceInputSchema.extend({
13781
- id: z63.string().uuid().describe("Workspace ID from listWorkspaces.")
13353
+ id: z62.string().uuid().describe("Workspace ID from listWorkspaces.")
13782
13354
  }).strict(),
13783
13355
  prepareArguments(args) {
13784
13356
  const input = args;
@@ -13811,11 +13383,11 @@ function createWorkspaceWriteTools(providers) {
13811
13383
  readOnlyHint: false
13812
13384
  },
13813
13385
  description: "Delete one install-wide Workspace recipe. Use the Workspace ID returned by listWorkspaces.",
13814
- inputSchema: z63.object({
13815
- id: z63.string().uuid().describe("Workspace ID from listWorkspaces.")
13386
+ inputSchema: z62.object({
13387
+ id: z62.string().uuid().describe("Workspace ID from listWorkspaces.")
13816
13388
  }).strict(),
13817
13389
  outputSchema: juniorToolOutputSchema.extend({
13818
- deleted: z63.literal(true)
13390
+ deleted: z62.literal(true)
13819
13391
  }),
13820
13392
  async execute({ id }) {
13821
13393
  const deleted = await workspaceWrite(() => deleteWorkspace(id));
@@ -13840,10 +13412,10 @@ function createWorkspaceTools(context) {
13840
13412
  readOnlyHint: true
13841
13413
  },
13842
13414
  description: "List named repository workspaces that can replace the current sandbox.",
13843
- inputSchema: z63.object({}).strict(),
13415
+ inputSchema: z62.object({}).strict(),
13844
13416
  outputSchema: juniorToolOutputSchema.extend({
13845
- active_workspace_id: z63.string().nullable(),
13846
- workspaces: z63.array(workspaceSchema)
13417
+ active_workspace_id: z62.string().nullable(),
13418
+ workspaces: z62.array(workspaceSchema)
13847
13419
  }),
13848
13420
  async execute() {
13849
13421
  return {
@@ -13861,8 +13433,8 @@ function createWorkspaceTools(context) {
13861
13433
  readOnlyHint: false
13862
13434
  },
13863
13435
  description: "Replace the current sandbox with a named preconfigured repository workspace. Files in the prior sandbox do not carry over.",
13864
- inputSchema: z63.object({
13865
- name: z63.string().trim().min(1).describe("Exact workspace name.")
13436
+ inputSchema: z62.object({
13437
+ name: z62.string().trim().min(1).describe("Exact workspace name.")
13866
13438
  }).strict(),
13867
13439
  outputSchema: juniorToolOutputSchema.extend({
13868
13440
  workspace: workspaceSchema
@@ -14604,7 +14176,7 @@ function handleToolExecutionError(error, toolName, toolCallId, shouldTrace, conv
14604
14176
  }
14605
14177
 
14606
14178
  // src/chat/tools/execute-tool.ts
14607
- import { z as z64 } from "zod";
14179
+ import { z as z63 } from "zod";
14608
14180
  var EXECUTE_TOOL_NAME = "executeTool";
14609
14181
  function createExecuteToolTool() {
14610
14182
  return zodTool({
@@ -14616,11 +14188,11 @@ function createExecuteToolTool() {
14616
14188
  },
14617
14189
  description: "Execute any catalog tool by exact tool_name from searchTools or a tool-result execution hint. Put tool-specific parameters inside arguments.",
14618
14190
  executionMode: "sequential",
14619
- inputSchema: z64.object({
14620
- tool_name: z64.string().min(1).describe(
14191
+ inputSchema: z63.object({
14192
+ tool_name: z63.string().min(1).describe(
14621
14193
  "Exact catalog tool_name returned by searchTools or a tool-result execution hint."
14622
14194
  ),
14623
- arguments: z64.record(z64.string(), z64.unknown()).describe(
14195
+ arguments: z63.record(z63.string(), z63.unknown()).describe(
14624
14196
  'Arguments matching the selected catalog tool schema, for example { "query": "..." }.'
14625
14197
  ).optional()
14626
14198
  }).strict(),
@@ -14660,7 +14232,7 @@ function planToolExposure(tools) {
14660
14232
  }
14661
14233
 
14662
14234
  // src/chat/tools/search-tools.ts
14663
- import { z as z65 } from "zod";
14235
+ import { z as z64 } from "zod";
14664
14236
  var SEARCH_TOOLS_NAME = "searchTools";
14665
14237
  var DEFAULT_MAX_RESULTS2 = 5;
14666
14238
  var MAX_RESULTS3 = 20;
@@ -14705,29 +14277,29 @@ var SEARCH_STOP_WORDS = /* @__PURE__ */ new Set([
14705
14277
  "you",
14706
14278
  "your"
14707
14279
  ]);
14708
- var searchToolsSourceSchema = z65.object({
14709
- id: z65.string(),
14710
- description: z65.string()
14280
+ var searchToolsSourceSchema = z64.object({
14281
+ id: z64.string(),
14282
+ description: z64.string()
14711
14283
  }).strict();
14712
- var searchToolsToolSchema = z65.object({
14713
- tool_name: z65.string(),
14714
- description: z65.string(),
14715
- exposure: z65.enum(["direct", "deferred", "modelOnly", "hidden"]),
14716
- source: z65.string().optional(),
14717
- input_schema: z65.unknown(),
14718
- call_notes: z65.array(z65.string()),
14719
- annotations: z65.record(z65.string(), z65.unknown())
14284
+ var searchToolsToolSchema = z64.object({
14285
+ tool_name: z64.string(),
14286
+ description: z64.string(),
14287
+ exposure: z64.enum(["direct", "deferred", "modelOnly", "hidden"]),
14288
+ source: z64.string().optional(),
14289
+ input_schema: z64.unknown(),
14290
+ call_notes: z64.array(z64.string()),
14291
+ annotations: z64.record(z64.string(), z64.unknown())
14720
14292
  }).strict();
14721
14293
  var searchToolsOutputSchema = juniorToolOutputSchema.extend({
14722
- query: z65.string().nullable(),
14723
- source: z65.string().nullable(),
14724
- sources: z65.array(searchToolsSourceSchema),
14725
- total_catalog_tools: z65.number().int().nonnegative(),
14726
- total_eligible_tools: z65.number().int().nonnegative(),
14727
- total_matches: z65.number().int().nonnegative(),
14728
- returned_tools: z65.number().int().nonnegative(),
14729
- execution_tool: z65.literal("executeTool"),
14730
- tools: z65.array(searchToolsToolSchema)
14294
+ query: z64.string().nullable(),
14295
+ source: z64.string().nullable(),
14296
+ sources: z64.array(searchToolsSourceSchema),
14297
+ total_catalog_tools: z64.number().int().nonnegative(),
14298
+ total_eligible_tools: z64.number().int().nonnegative(),
14299
+ total_matches: z64.number().int().nonnegative(),
14300
+ returned_tools: z64.number().int().nonnegative(),
14301
+ execution_tool: z64.literal("executeTool"),
14302
+ tools: z64.array(searchToolsToolSchema)
14731
14303
  }).strict();
14732
14304
  function terms(value) {
14733
14305
  const chunks = value.match(/[\p{L}\p{N}]+/gu) ?? [];
@@ -14938,14 +14510,14 @@ function createSearchToolsTool(catalogTools) {
14938
14510
  openWorldHint: false,
14939
14511
  readOnlyHint: true
14940
14512
  },
14941
- inputSchema: z65.object({
14942
- query: z65.string().nullable().describe(
14513
+ inputSchema: z64.object({
14514
+ query: z64.string().nullable().describe(
14943
14515
  "Optional search terms describing the tool, owner, action, or arguments needed. Empty string lists catalog tools."
14944
14516
  ).optional(),
14945
- source: z65.string().nullable().describe(
14517
+ source: z64.string().nullable().describe(
14946
14518
  "Optional source id to search within, such as a plugin source returned in sources."
14947
14519
  ).optional(),
14948
- max_results: z65.number().int().min(1).max(MAX_RESULTS3).nullable().describe("Maximum matching catalog tool descriptors to return.").optional()
14520
+ max_results: z64.number().int().min(1).max(MAX_RESULTS3).nullable().describe("Maximum matching catalog tool descriptors to return.").optional()
14949
14521
  }).strict(),
14950
14522
  outputSchema: searchToolsOutputSchema,
14951
14523
  privateTraceResult: (result) => ({
@@ -16204,7 +15776,7 @@ function createPluginEgress(deps) {
16204
15776
  }
16205
15777
 
16206
15778
  // src/chat/services/guardian-action-review.ts
16207
- import { z as z66 } from "zod";
15779
+ import { z as z65 } from "zod";
16208
15780
 
16209
15781
  // src/chat/services/guardian-action-policy.ts
16210
15782
  var GUARDIAN_ACTION_POLICY = `You are judging one planned Junior agent action.
@@ -16272,17 +15844,17 @@ Assess the exact action's intrinsic risk and whether the user's intent authorize
16272
15844
  - Keep the reason to one concise, specific sentence grounded in the main risk or authorization fact. For ask, name the exact action, target, and material side effects the user must confirm.`;
16273
15845
 
16274
15846
  // src/chat/services/guardian-action-review.ts
16275
- var guardianDecisionSchema = z66.object({
16276
- decision: z66.enum(["allow", "ask", "deny"]),
16277
- reason: z66.string().trim().min(1).max(500),
16278
- riskLevel: z66.enum(["low", "medium", "high", "critical"]),
16279
- userAuthorization: z66.enum(["high", "medium", "low", "unknown"])
15847
+ var guardianDecisionSchema = z65.object({
15848
+ decision: z65.enum(["allow", "ask", "deny"]),
15849
+ reason: z65.string().trim().min(1).max(500),
15850
+ riskLevel: z65.enum(["low", "medium", "high", "critical"]),
15851
+ userAuthorization: z65.enum(["high", "medium", "low", "unknown"])
16280
15852
  }).strict();
16281
15853
  var GUARDIAN_REVIEW_TIMEOUT_MS = 6e4;
16282
15854
  var GUARDIAN_REVIEW_MAX_TOKENS = 2e3;
16283
15855
  var MAX_PROPOSAL_CHARS = 192e3;
16284
15856
  function guardianPrompt(proposal) {
16285
- const proposalJson = JSON.stringify(z66.json().parse(proposal), null, 2);
15857
+ const proposalJson = JSON.stringify(z65.json().parse(proposal), null, 2);
16286
15858
  if (proposalJson.length > MAX_PROPOSAL_CHARS) {
16287
15859
  throw new Error(
16288
15860
  `Guardian action proposal exceeds ${MAX_PROPOSAL_CHARS} characters.`
@@ -18878,9 +18450,6 @@ export {
18878
18450
  normalizeSandboxEgressTracePropagationDomains,
18879
18451
  shouldPropagateSandboxEgressTrace,
18880
18452
  resolveSandboxEgressProviderForHost,
18881
- cancelSubscriptions,
18882
- findMatchingResourceEventSubscriptions,
18883
- deliverResourceEventSubscription,
18884
18453
  sanitizeScheduledTaskPrincipal,
18885
18454
  listThreadReplies,
18886
18455
  renderBlockText,