@sentry/junior 0.150.1 → 0.152.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/{agent-hooks-G4LEACQB.js → agent-hooks-U66Q3X2P.js} +10 -10
  2. package/dist/api/schema/conversation.d.ts +35 -4
  3. package/dist/api/schema.d.ts +1 -1
  4. package/dist/api/schema.js +3 -1
  5. package/dist/api.js +81 -38
  6. package/dist/app.js +129 -206
  7. package/dist/{catalog-runtime-ZRSNE2MH.js → catalog-runtime-CVCR7SND.js} +5 -5
  8. package/dist/chat/agent/skills.d.ts +5 -4
  9. package/dist/chat/agent/tools.d.ts +5 -5
  10. package/dist/chat/api-turns/authorization.d.ts +23 -0
  11. package/dist/chat/conversations/history.d.ts +12 -3
  12. package/dist/chat/conversations/projection.d.ts +7 -3
  13. package/dist/chat/mcp/tool-manager.d.ts +0 -4
  14. package/dist/chat/runtime/agent-run-outcome.d.ts +4 -0
  15. package/dist/chat/tools/search-conversation-events.d.ts +1 -1
  16. package/dist/chat/tools/skill/call-mcp-tool.d.ts +0 -1
  17. package/dist/chat/tools/skill/load-skill.d.ts +2 -5
  18. package/dist/chat/tools/types.d.ts +1 -2
  19. package/dist/{chunk-2AWDPNP7.js → chunk-3PCKG4BT.js} +16 -10
  20. package/dist/{chunk-2Z7YX5PI.js → chunk-3UJ3QYRV.js} +156 -19
  21. package/dist/{chunk-IQW6RFXG.js → chunk-5LDOQV7Y.js} +72 -218
  22. package/dist/{chunk-JBYWR6FW.js → chunk-67VR4BJK.js} +5 -5
  23. package/dist/{chunk-5NOHC2Z4.js → chunk-732P2RBQ.js} +1 -1
  24. package/dist/{chunk-3WIFZBJL.js → chunk-7TZM33YX.js} +1 -1
  25. package/dist/{chunk-JVOLC6JZ.js → chunk-AYPU5T5L.js} +4 -4
  26. package/dist/{chunk-TZRYLW3R.js → chunk-CLX3T7Q3.js} +1 -1
  27. package/dist/{chunk-JUBPTYNO.js → chunk-ELAVLP7Z.js} +1 -1
  28. package/dist/{chunk-LSI3EKZQ.js → chunk-ETXLHT3S.js} +4 -4
  29. package/dist/{chunk-N6QJAPZS.js → chunk-I4LR7MS2.js} +45 -11
  30. package/dist/{chunk-6ZYGORV4.js → chunk-KC47ZY6Q.js} +2 -2
  31. package/dist/{chunk-6A24WEKX.js → chunk-KC5XZBRB.js} +4 -4
  32. package/dist/{chunk-D2PVJU5E.js → chunk-KTYC3GDO.js} +3 -3
  33. package/dist/{chunk-AD6N2KNE.js → chunk-KW2MGCW5.js} +5 -5
  34. package/dist/{chunk-QO3OSJDS.js → chunk-LETPYIDF.js} +1 -1
  35. package/dist/{chunk-6IWDFUXW.js → chunk-M6PWM3OK.js} +1 -1
  36. package/dist/{chunk-LWFHRWJI.js → chunk-N2472SQK.js} +8 -8
  37. package/dist/{chunk-QNSV46AW.js → chunk-NF733C66.js} +6 -6
  38. package/dist/{chunk-FGP5W3NS.js → chunk-OEECXAGT.js} +2 -2
  39. package/dist/{chunk-SZ74ECCC.js → chunk-QKPIW2CY.js} +6 -6
  40. package/dist/{chunk-4JV7GUUH.js → chunk-RCBAXKMB.js} +1 -1
  41. package/dist/{chunk-QZGYKKH6.js → chunk-SDMVFTH4.js} +173 -70
  42. package/dist/chunk-SFYDSI34.js +89 -0
  43. package/dist/{chunk-W3FQZAX5.js → chunk-TSQMITMQ.js} +6 -6
  44. package/dist/{chunk-IZE2EGCX.js → chunk-UFKSILED.js} +5 -5
  45. package/dist/{chunk-3JVUWLR7.js → chunk-UG5UCHHJ.js} +15 -1
  46. package/dist/{chunk-OWLJZ6I7.js → chunk-VD6CRYCT.js} +1 -1
  47. package/dist/{chunk-2DIRU2C2.js → chunk-WZN4RQ64.js} +1 -1
  48. package/dist/{chunk-KFHJQYKQ.js → chunk-X4RM4TBW.js} +1 -1
  49. package/dist/{chunk-B2YA2G26.js → chunk-X6JP6AMX.js} +1 -1
  50. package/dist/{chunk-GZ25ZSTX.js → chunk-XTLF7C4I.js} +11 -4
  51. package/dist/{chunk-R53UTQ2Q.js → chunk-Z5WLTGME.js} +1 -1
  52. package/dist/cli/chat.js +30 -30
  53. package/dist/cli/check.js +6 -6
  54. package/dist/cli/plugins.js +13 -13
  55. package/dist/cli/snapshot-create.js +9 -9
  56. package/dist/cli/upgrade.js +7 -7
  57. package/dist/{db-WRA5ZHYE.js → db-HQAZQASY.js} +7 -7
  58. package/dist/handlers/mcp-oauth-callback.d.ts +3 -0
  59. package/dist/handlers/oauth-callback.d.ts +3 -0
  60. package/dist/instrumentation.js +4 -4
  61. package/dist/nitro.js +2 -2
  62. package/dist/{oauth-callback-server-QWAYG3MI.js → oauth-callback-server-OJONZ7T3.js} +23 -24
  63. package/dist/{runner-5JQ54J6P.js → runner-BIJAVQDX.js} +14 -16
  64. package/dist/{skills-3YD55WPO.js → skills-SIPNY4AT.js} +6 -6
  65. package/dist/spawn-ABDIBQT6.js +38 -0
  66. package/dist/{validation-ZXE3IRSB.js → validation-KRPOY5RQ.js} +6 -6
  67. package/dist/version.js +1 -1
  68. package/dist/{work-7G2U64WI.js → work-KS3JOEI2.js} +17 -17
  69. package/dist/{worker-HJM2FZNI.js → worker-CZ5KNZUI.js} +11 -11
  70. package/migrations/0025_mcp_credential_subject.sql +8 -0
  71. package/migrations/meta/0025_snapshot.json +2275 -0
  72. package/migrations/meta/_journal.json +7 -0
  73. package/package.json +5 -5
  74. package/dist/chat/pi/derived-state.d.ts +0 -5
  75. package/dist/chunk-4CODA7P5.js +0 -43
  76. package/dist/chunk-XED3H34M.js +0 -48
  77. package/dist/spawn-OOO26XDL.js +0 -38
package/dist/app.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  processConversationWork
3
- } from "./chunk-LSI3EKZQ.js";
3
+ } from "./chunk-ETXLHT3S.js";
4
4
  import {
5
5
  bindSpawnAgent
6
- } from "./chunk-QO3OSJDS.js";
6
+ } from "./chunk-LETPYIDF.js";
7
7
  import {
8
8
  createAgentInvocationWorker,
9
9
  enqueueAgentInvocation,
10
10
  listPendingAgentInvocationMailboxAppends,
11
11
  routeAgentInvocationWork
12
- } from "./chunk-W3FQZAX5.js";
12
+ } from "./chunk-TSQMITMQ.js";
13
13
  import {
14
14
  GET as GET2,
15
15
  GET2 as GET3,
@@ -36,25 +36,22 @@ import {
36
36
  startSlackProcessingReaction,
37
37
  stripLeadingBotMention,
38
38
  wakePausedTurn
39
- } from "./chunk-QZGYKKH6.js";
39
+ } from "./chunk-SDMVFTH4.js";
40
40
  import "./chunk-FA6POGLH.js";
41
41
  import {
42
42
  getTurnRequestDeadline,
43
43
  runWithTurnRequestDeadline
44
- } from "./chunk-R53UTQ2Q.js";
45
- import {
46
- completeAuthPauseTurn,
47
- persistAuthPauseTurnState
48
- } from "./chunk-XED3H34M.js";
44
+ } from "./chunk-Z5WLTGME.js";
49
45
  import {
50
46
  GET,
51
47
  conversationVisibilityFromSlackChannelType,
52
48
  createApiTurnWorker,
49
+ lookupSlackUser,
53
50
  resolveSlackChannelTypeFromMessage,
54
51
  resolveSlackConversationContext,
55
52
  routeApiTurnWork
56
- } from "./chunk-2Z7YX5PI.js";
57
- import "./chunk-4CODA7P5.js";
53
+ } from "./chunk-3UJ3QYRV.js";
54
+ import "./chunk-SFYDSI34.js";
58
55
  import {
59
56
  CONVERSATION_WORK_STALE_ENQUEUE_MS,
60
57
  appendAndEnqueueInboundMessage,
@@ -65,10 +62,11 @@ import {
65
62
  isInvalidConversationRecordError,
66
63
  listActiveConversationIds,
67
64
  removeActiveConversation
68
- } from "./chunk-JVOLC6JZ.js";
65
+ } from "./chunk-AYPU5T5L.js";
69
66
  import {
70
67
  buildDeliveredTurnStatePatch,
71
68
  claimDispatchMailboxAppend,
69
+ completeAuthPauseTurn,
72
70
  confirmDispatchMailboxAppend,
73
71
  createOrGetDispatch,
74
72
  finalizeFailedTurnReplyWithEvent,
@@ -89,12 +87,13 @@ import {
89
87
  markDispatchCompleted,
90
88
  markDispatchFailed,
91
89
  markDispatchRunning,
90
+ persistAuthPauseTurnState,
92
91
  processPluginTask,
93
92
  recordTaskExecution,
94
93
  requireTurnFailureEventId,
95
94
  resolveTurnSessionRouting,
96
95
  scheduleSessionCompletedPluginTasks
97
- } from "./chunk-N6QJAPZS.js";
96
+ } from "./chunk-I4LR7MS2.js";
98
97
  import {
99
98
  ConversationTurnLifecycleService,
100
99
  coerceThreadConversationState,
@@ -104,7 +103,7 @@ import {
104
103
  persistThreadRuntimeState,
105
104
  persistThreadState,
106
105
  persistThreadStateById
107
- } from "./chunk-JBYWR6FW.js";
106
+ } from "./chunk-67VR4BJK.js";
108
107
  import "./chunk-UTL3MHPC.js";
109
108
  import {
110
109
  getVercelConversationWorkQueue,
@@ -123,7 +122,7 @@ import {
123
122
  import {
124
123
  validatePluginEgressCredentialHooks,
125
124
  validatePluginRegistrations
126
- } from "./chunk-OWLJZ6I7.js";
125
+ } from "./chunk-VD6CRYCT.js";
127
126
  import {
128
127
  defineJuniorPlugins,
129
128
  pluginCatalogConfigFromEnv,
@@ -156,18 +155,18 @@ import {
156
155
  setConfigDefaults,
157
156
  shouldEmitDevAgentTrace,
158
157
  shouldPropagateSandboxEgressTrace
159
- } from "./chunk-IQW6RFXG.js";
158
+ } from "./chunk-5LDOQV7Y.js";
160
159
  import {
161
160
  AuthorizationFlowDisabledError,
162
161
  PluginCredentialFailureError
163
- } from "./chunk-IZE2EGCX.js";
162
+ } from "./chunk-UFKSILED.js";
164
163
  import "./chunk-DIB4GX3G.js";
165
164
  import {
166
165
  createUserTokenStore,
167
166
  deleteMcpAuthSessionsForUserProvider,
168
167
  deleteMcpServerSessionId,
169
168
  deleteMcpStoredOAuthCredentials
170
- } from "./chunk-LWFHRWJI.js";
169
+ } from "./chunk-N2472SQK.js";
171
170
  import {
172
171
  RetryableDeliveryError
173
172
  } from "./chunk-RF6J3DIO.js";
@@ -175,7 +174,7 @@ import {
175
174
  formatProviderLabel,
176
175
  postSlackMessage,
177
176
  startOAuthFlow
178
- } from "./chunk-SZ74ECCC.js";
177
+ } from "./chunk-QKPIW2CY.js";
179
178
  import "./chunk-HUO3UTAQ.js";
180
179
  import {
181
180
  getExperimentalFeatures,
@@ -184,16 +183,16 @@ import {
184
183
  import {
185
184
  getSandboxResourceConfig,
186
185
  setSandboxResourceConfig
187
- } from "./chunk-6A24WEKX.js";
186
+ } from "./chunk-KC5XZBRB.js";
188
187
  import {
189
188
  createSchedulerSqlStore,
190
189
  findMatchingEventTasks,
191
190
  logScheduledTaskRunSkipped,
192
191
  scheduledTaskRunAttributes
193
- } from "./chunk-AD6N2KNE.js";
192
+ } from "./chunk-KW2MGCW5.js";
194
193
  import {
195
194
  parseSlackThreadId
196
- } from "./chunk-4JV7GUUH.js";
195
+ } from "./chunk-RCBAXKMB.js";
197
196
  import {
198
197
  ConversationTurnBoundaryError,
199
198
  CooperativeTurnYieldError,
@@ -243,7 +242,7 @@ import {
243
242
  trimTrailingAssistantMessages,
244
243
  turnHasReply,
245
244
  upsertConversationMessage
246
- } from "./chunk-2AWDPNP7.js";
245
+ } from "./chunk-3PCKG4BT.js";
247
246
  import "./chunk-3Y47VMHV.js";
248
247
  import "./chunk-PDO5BLNM.js";
249
248
  import "./chunk-UIE3R5XU.js";
@@ -263,7 +262,7 @@ import {
263
262
  verifyEventTaskCredentialSubject,
264
263
  verifyScheduledTaskCredentialSubject,
265
264
  verifySlackDirectCredentialSubject
266
- } from "./chunk-QNSV46AW.js";
265
+ } from "./chunk-NF733C66.js";
267
266
  import {
268
267
  SlackActionError,
269
268
  downloadPrivateSlackFile,
@@ -273,7 +272,7 @@ import {
273
272
  normalizeSlackConversationId,
274
273
  runWithSlackInstallationToken,
275
274
  runWithWorkspaceTeamId
276
- } from "./chunk-D2PVJU5E.js";
275
+ } from "./chunk-KTYC3GDO.js";
277
276
  import {
278
277
  contextProvenance,
279
278
  createSlackDestination,
@@ -286,19 +285,19 @@ import {
286
285
  requireSlackDestination,
287
286
  withConversationEventLock,
288
287
  withConversationMutationLock
289
- } from "./chunk-GZ25ZSTX.js";
288
+ } from "./chunk-XTLF7C4I.js";
290
289
  import {
291
290
  juniorAgentBindings,
292
291
  juniorAgentInvocations,
293
292
  juniorConversationEvents,
294
293
  juniorConversations
295
- } from "./chunk-KFHJQYKQ.js";
294
+ } from "./chunk-X4RM4TBW.js";
296
295
  import "./chunk-EM225ITJ.js";
297
296
  import {
298
297
  acquireActiveLock,
299
298
  getStateAdapter,
300
299
  withActiveLock
301
- } from "./chunk-B2YA2G26.js";
300
+ } from "./chunk-X6JP6AMX.js";
302
301
  import {
303
302
  STANDARD_MODEL_PROFILE,
304
303
  botConfig,
@@ -316,16 +315,16 @@ import {
316
315
  modelIdForProfile,
317
316
  setSlackReactionConfig,
318
317
  standardModelId
319
- } from "./chunk-FGP5W3NS.js";
318
+ } from "./chunk-OEECXAGT.js";
320
319
  import {
321
320
  juniorDestinations
322
321
  } from "./chunk-VFUK3X5B.js";
323
- import "./chunk-5NOHC2Z4.js";
324
- import "./chunk-6ZYGORV4.js";
322
+ import "./chunk-732P2RBQ.js";
323
+ import "./chunk-KC47ZY6Q.js";
325
324
  import {
326
325
  pluginCatalogRuntime
327
- } from "./chunk-2DIRU2C2.js";
328
- import "./chunk-TZRYLW3R.js";
326
+ } from "./chunk-WZN4RQ64.js";
327
+ import "./chunk-CLX3T7Q3.js";
329
328
  import {
330
329
  credentialContextForActor
331
330
  } from "./chunk-RUIXF3YQ.js";
@@ -359,7 +358,7 @@ import {
359
358
  withContext,
360
359
  withLogContext,
361
360
  withSpan
362
- } from "./chunk-3WIFZBJL.js";
361
+ } from "./chunk-7TZM33YX.js";
363
362
  import {
364
363
  continueTrace
365
364
  } from "./chunk-6GWA276C.js";
@@ -367,10 +366,10 @@ import "./chunk-OOUNJNMR.js";
367
366
  import "./chunk-H4HBKISO.js";
368
367
  import {
369
368
  JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE
370
- } from "./chunk-6IWDFUXW.js";
369
+ } from "./chunk-M6PWM3OK.js";
371
370
  import {
372
371
  JUNIOR_VERSION
373
- } from "./chunk-JUBPTYNO.js";
372
+ } from "./chunk-ELAVLP7Z.js";
374
373
  import "./chunk-MLKGABMK.js";
375
374
 
376
375
  // src/app.ts
@@ -2414,7 +2413,7 @@ import {
2414
2413
  Message,
2415
2414
  ThreadImpl
2416
2415
  } from "chat";
2417
- import { z as z4 } from "zod";
2416
+ import { z as z3 } from "zod";
2418
2417
 
2419
2418
  // src/chat/ingress/message-router.ts
2420
2419
  function normalizeIncomingSlackThreadId(threadId, message) {
@@ -2584,91 +2583,6 @@ async function ensureSlackMessageActorIdentity(message, teamId, lookupSlackUser2
2584
2583
  return actor;
2585
2584
  }
2586
2585
 
2587
- // src/chat/slack/user.ts
2588
- import { z as z3 } from "zod";
2589
- var slackUserInfoSchema = z3.object({
2590
- ok: z3.literal(true),
2591
- user: z3.object({
2592
- name: z3.string().nullish(),
2593
- profile: z3.object({
2594
- email: z3.string().nullish(),
2595
- real_name: z3.string().nullish()
2596
- }).optional()
2597
- })
2598
- });
2599
- var USER_CACHE_TTL_MS = 5 * 60 * 1e3;
2600
- var userCache = /* @__PURE__ */ new Map();
2601
- function userCacheKey(teamId, userId) {
2602
- return `${teamId}:${userId}`;
2603
- }
2604
- function readFromCache(teamId, userId) {
2605
- const hit = userCache.get(userCacheKey(teamId, userId));
2606
- if (!hit) return null;
2607
- if (hit.expiresAt < Date.now()) {
2608
- userCache.delete(userCacheKey(teamId, userId));
2609
- return null;
2610
- }
2611
- return hit.value;
2612
- }
2613
- function writeToCache(teamId, userId, value) {
2614
- userCache.set(userCacheKey(teamId, userId), {
2615
- value,
2616
- expiresAt: Date.now() + USER_CACHE_TTL_MS
2617
- });
2618
- }
2619
- async function lookupSlackUser(teamId, userId) {
2620
- if (!teamId || !userId) {
2621
- return null;
2622
- }
2623
- const cached = readFromCache(teamId, userId);
2624
- if (cached) {
2625
- return cached;
2626
- }
2627
- const token = getSlackBotToken();
2628
- if (!token) {
2629
- return null;
2630
- }
2631
- try {
2632
- const response = await fetch(
2633
- `https://slack.com/api/users.info?user=${encodeURIComponent(userId)}`,
2634
- {
2635
- headers: {
2636
- authorization: `Bearer ${token}`
2637
- }
2638
- }
2639
- );
2640
- if (!response.ok) {
2641
- logWarn("slack.user.lookup.failed", {
2642
- "enduser.id": userId,
2643
- "app.slack.team_id": teamId,
2644
- "http.response.status_code": response.status
2645
- });
2646
- return null;
2647
- }
2648
- const parsed = slackUserInfoSchema.safeParse(await response.json());
2649
- if (!parsed.success) {
2650
- return null;
2651
- }
2652
- const payload = parsed.data;
2653
- const userName = payload.user.name?.trim() || void 0;
2654
- const fullName = payload.user.profile?.real_name?.trim() || void 0;
2655
- const result = {
2656
- userName,
2657
- fullName,
2658
- email: payload.user.profile?.email?.trim() || void 0
2659
- };
2660
- writeToCache(teamId, userId, result);
2661
- return result;
2662
- } catch (error) {
2663
- logWarn("slack.user.lookup.failed", {
2664
- "enduser.id": userId,
2665
- "app.slack.team_id": teamId,
2666
- "exception.message": error instanceof Error ? error.message : String(error)
2667
- });
2668
- return null;
2669
- }
2670
- }
2671
-
2672
2586
  // src/chat/resource-events/actor.ts
2673
2587
  var RESOURCE_EVENT_SLACK_AUTHOR_ID = "UJRNEVENT";
2674
2588
  var RESOURCE_EVENT_SYSTEM_ACTOR = {
@@ -2690,17 +2604,17 @@ function stripLeadingSteeringOverride(text) {
2690
2604
  }
2691
2605
 
2692
2606
  // src/chat/task-execution/slack-work.ts
2693
- var slackConversationRouteSchema = z4.enum(["mention", "subscribed"]);
2607
+ var slackConversationRouteSchema = z3.enum(["mention", "subscribed"]);
2694
2608
  function hasSteeringOverride(text) {
2695
2609
  return stripLeadingSteeringOverride(text) !== text;
2696
2610
  }
2697
- var serializedDateSchema = z4.iso.datetime();
2698
- var mdastPointSchema = z4.object({
2699
- column: z4.number().int().positive(),
2700
- line: z4.number().int().positive(),
2701
- offset: z4.number().int().nonnegative().optional()
2611
+ var serializedDateSchema = z3.iso.datetime();
2612
+ var mdastPointSchema = z3.object({
2613
+ column: z3.number().int().positive(),
2614
+ line: z3.number().int().positive(),
2615
+ offset: z3.number().int().nonnegative().optional()
2702
2616
  }).strict();
2703
- var mdastPositionSchema = z4.object({
2617
+ var mdastPositionSchema = z3.object({
2704
2618
  end: mdastPointSchema,
2705
2619
  start: mdastPointSchema
2706
2620
  }).strict();
@@ -2812,7 +2726,7 @@ function isFormattedContentNode(value) {
2812
2726
  return false;
2813
2727
  }
2814
2728
  }
2815
- var formattedContentSchema = z4.custom(
2729
+ var formattedContentSchema = z3.custom(
2816
2730
  (value) => {
2817
2731
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
2818
2732
  return false;
@@ -2822,79 +2736,79 @@ var formattedContentSchema = z4.custom(
2822
2736
  },
2823
2737
  "must be a valid formatted-content root"
2824
2738
  );
2825
- var serializedMessageSchema = z4.object({
2826
- _type: z4.literal("chat:Message"),
2827
- attachments: z4.array(
2828
- z4.object({
2829
- type: z4.enum(["image", "file", "video", "audio"]),
2830
- url: z4.string().optional(),
2831
- name: z4.string().optional(),
2832
- mimeType: z4.string().optional(),
2833
- size: z4.number().finite().optional(),
2834
- width: z4.number().finite().optional(),
2835
- height: z4.number().finite().optional(),
2836
- fetchMetadata: z4.record(z4.string(), z4.string()).optional()
2739
+ var serializedMessageSchema = z3.object({
2740
+ _type: z3.literal("chat:Message"),
2741
+ attachments: z3.array(
2742
+ z3.object({
2743
+ type: z3.enum(["image", "file", "video", "audio"]),
2744
+ url: z3.string().optional(),
2745
+ name: z3.string().optional(),
2746
+ mimeType: z3.string().optional(),
2747
+ size: z3.number().finite().optional(),
2748
+ width: z3.number().finite().optional(),
2749
+ height: z3.number().finite().optional(),
2750
+ fetchMetadata: z3.record(z3.string(), z3.string()).optional()
2837
2751
  }).strict()
2838
2752
  ),
2839
- author: z4.object({
2840
- userId: z4.string(),
2841
- userName: z4.string(),
2842
- fullName: z4.string(),
2843
- isBot: z4.union([z4.boolean(), z4.literal("unknown")]),
2844
- isMe: z4.boolean()
2753
+ author: z3.object({
2754
+ userId: z3.string(),
2755
+ userName: z3.string(),
2756
+ fullName: z3.string(),
2757
+ isBot: z3.union([z3.boolean(), z3.literal("unknown")]),
2758
+ isMe: z3.boolean()
2845
2759
  }).strict(),
2846
2760
  formatted: formattedContentSchema,
2847
- id: z4.string().min(1),
2848
- isMention: z4.boolean().optional(),
2849
- links: z4.array(
2850
- z4.object({
2851
- url: z4.string(),
2852
- title: z4.string().optional(),
2853
- description: z4.string().optional(),
2854
- imageUrl: z4.string().optional(),
2855
- siteName: z4.string().optional()
2761
+ id: z3.string().min(1),
2762
+ isMention: z3.boolean().optional(),
2763
+ links: z3.array(
2764
+ z3.object({
2765
+ url: z3.string(),
2766
+ title: z3.string().optional(),
2767
+ description: z3.string().optional(),
2768
+ imageUrl: z3.string().optional(),
2769
+ siteName: z3.string().optional()
2856
2770
  }).strict()
2857
2771
  ).optional(),
2858
- metadata: z4.object({
2772
+ metadata: z3.object({
2859
2773
  dateSent: serializedDateSchema,
2860
- edited: z4.boolean(),
2774
+ edited: z3.boolean(),
2861
2775
  editedAt: serializedDateSchema.optional()
2862
2776
  }).strict(),
2863
- raw: z4.unknown(),
2864
- text: z4.string(),
2865
- threadId: z4.string().min(1)
2777
+ raw: z3.unknown(),
2778
+ text: z3.string(),
2779
+ threadId: z3.string().min(1)
2866
2780
  }).strict();
2867
- var serializedThreadSchema = z4.object({
2868
- _type: z4.literal("chat:Thread"),
2869
- adapterName: z4.literal("slack"),
2870
- channelId: z4.string().min(1),
2871
- channelVisibility: z4.enum(["private", "workspace", "external", "unknown"]).optional(),
2781
+ var serializedThreadSchema = z3.object({
2782
+ _type: z3.literal("chat:Thread"),
2783
+ adapterName: z3.literal("slack"),
2784
+ channelId: z3.string().min(1),
2785
+ channelVisibility: z3.enum(["private", "workspace", "external", "unknown"]).optional(),
2872
2786
  currentMessage: serializedMessageSchema.optional(),
2873
- id: z4.string().min(1),
2874
- isDM: z4.boolean()
2787
+ id: z3.string().min(1),
2788
+ isDM: z3.boolean()
2875
2789
  }).strict();
2876
- var slackInstallationSchema = z4.object({
2877
- enterpriseId: z4.string().optional(),
2878
- isEnterpriseInstall: z4.boolean().optional(),
2879
- teamId: z4.string().optional()
2790
+ var slackInstallationSchema = z3.object({
2791
+ enterpriseId: z3.string().optional(),
2792
+ isEnterpriseInstall: z3.boolean().optional(),
2793
+ teamId: z3.string().optional()
2880
2794
  }).strict();
2881
- var slackConversationMessageMetadataBaseSchema = z4.object({
2795
+ var slackConversationMessageMetadataBaseSchema = z3.object({
2882
2796
  installation: slackInstallationSchema.optional(),
2883
2797
  message: serializedMessageSchema,
2884
- platform: z4.literal("slack"),
2798
+ platform: z3.literal("slack"),
2885
2799
  route: slackConversationRouteSchema,
2886
2800
  thread: serializedThreadSchema
2887
2801
  });
2888
- var slackConversationMessageMetadataSchema = z4.union([
2802
+ var slackConversationMessageMetadataSchema = z3.union([
2889
2803
  slackConversationMessageMetadataBaseSchema.strict(),
2890
2804
  slackConversationMessageMetadataBaseSchema.extend({
2891
- kind: z4.literal("resource_event"),
2892
- resourceEvent: z4.object({
2893
- eventKey: z4.string(),
2894
- eventType: z4.string(),
2895
- namespace: z4.string(),
2896
- identifier: z4.string(),
2897
- subscriptionId: z4.string()
2805
+ kind: z3.literal("resource_event"),
2806
+ resourceEvent: z3.object({
2807
+ eventKey: z3.string(),
2808
+ eventType: z3.string(),
2809
+ namespace: z3.string(),
2810
+ identifier: z3.string(),
2811
+ subscriptionId: z3.string()
2898
2812
  }).strict()
2899
2813
  }).strict()
2900
2814
  ]);
@@ -3116,16 +3030,23 @@ function createSlackConversationWorker(options) {
3116
3030
  context.destination,
3117
3031
  "Slack paused-turn recovery"
3118
3032
  );
3119
- await runWithSlackInstallation({
3120
- adapter,
3121
- installation: { teamId: destination.teamId },
3122
- state,
3123
- task: async () => {
3124
- await options.runNextPausedTurn(context.conversationId, {
3125
- shouldYield: context.shouldYield
3126
- });
3033
+ try {
3034
+ await runWithSlackInstallation({
3035
+ adapter,
3036
+ installation: { teamId: destination.teamId },
3037
+ state,
3038
+ task: async () => {
3039
+ await options.runNextPausedTurn(context.conversationId, {
3040
+ shouldYield: context.shouldYield
3041
+ });
3042
+ }
3043
+ });
3044
+ } catch (error) {
3045
+ if (isCooperativeTurnYieldError(error)) {
3046
+ return { status: "yielded" };
3127
3047
  }
3128
- });
3048
+ throw error;
3049
+ }
3129
3050
  return { status: "completed" };
3130
3051
  }
3131
3052
  const latestRecord = records[records.length - 1];
@@ -4290,7 +4211,7 @@ function registerVercelPluginTaskDevConsumer() {
4290
4211
  }
4291
4212
 
4292
4213
  // src/chat/services/subscribed-decision.ts
4293
- import { z as z5 } from "zod";
4214
+ import { z as z4 } from "zod";
4294
4215
 
4295
4216
  // src/chat/services/subscribed-reply-router-policy.ts
4296
4217
  function buildSubscribedReplyRouterPolicy(assistantName) {
@@ -4335,13 +4256,13 @@ Assess conversation floor ownership and whether the latest message continues wor
4335
4256
  }
4336
4257
 
4337
4258
  // src/chat/services/subscribed-decision.ts
4338
- var replyDecisionSchema = z5.object({
4339
- should_reply: z5.boolean().describe("Whether Junior should respond to this thread message."),
4340
- should_unsubscribe: z5.boolean().describe(
4259
+ var replyDecisionSchema = z4.object({
4260
+ should_reply: z4.boolean().describe("Whether Junior should respond to this thread message."),
4261
+ should_unsubscribe: z4.boolean().describe(
4341
4262
  "Whether Junior should unsubscribe from this thread because the user clearly asked it to stop participating."
4342
4263
  ),
4343
- confidence: z5.number().min(0).max(1).describe("Classifier confidence from 0 to 1."),
4344
- reason: z5.string().describe("Short reason for the decision; use an empty string if none.")
4264
+ confidence: z4.number().min(0).max(1).describe("Classifier confidence from 0 to 1."),
4265
+ reason: z4.string().describe("Short reason for the decision; use an empty string if none.")
4345
4266
  }).strict();
4346
4267
  var ROUTER_CONFIDENCE_THRESHOLD = 0.7;
4347
4268
  var ROUTER_CLASSIFIER_MAX_TOKENS = 400;
@@ -6047,11 +5968,11 @@ function getMessageTimestamp(message) {
6047
5968
  }
6048
5969
 
6049
5970
  // src/chat/slack/action-token.ts
6050
- import { z as z6 } from "zod";
6051
- var slackActionTokenSchema = z6.string().trim().min(1).brand();
6052
- var slackMessageEnvelopeSchema = z6.object({
6053
- raw: z6.object({
6054
- action_token: z6.unknown().optional()
5971
+ import { z as z5 } from "zod";
5972
+ var slackActionTokenSchema = z5.string().trim().min(1).brand();
5973
+ var slackMessageEnvelopeSchema = z5.object({
5974
+ raw: z5.object({
5975
+ action_token: z5.unknown().optional()
6055
5976
  }).optional()
6056
5977
  });
6057
5978
  function readSlackActionToken(message) {
@@ -7074,7 +6995,7 @@ function createReplyToThread(deps) {
7074
6995
  }
7075
6996
  if (outcome.status === "suspended") {
7076
6997
  options.onTurnOutcome?.({ outcome: "awaiting_resume" });
7077
- if (options.shouldYield?.()) {
6998
+ if (options.shouldYield && (options.shouldYield() || outcome.reason === "timeout")) {
7078
6999
  shouldPersistFailureState = false;
7079
7000
  throw new CooperativeTurnYieldError();
7080
7001
  }
@@ -9175,12 +9096,14 @@ async function createApp(options) {
9175
9096
  app.get("/health", () => GET());
9176
9097
  app.get("/api/oauth/callback/mcp/:provider", (c) => {
9177
9098
  return GET2(c.req.raw, c.req.param("provider"), waitUntil, {
9178
- agentRunner
9099
+ agentRunner,
9100
+ conversationWorkQueue: getVercelConversationWorkQueue()
9179
9101
  });
9180
9102
  });
9181
9103
  app.get("/api/oauth/callback/:provider", (c) => {
9182
9104
  return GET3(c.req.raw, c.req.param("provider"), waitUntil, {
9183
- agentRunner
9105
+ agentRunner,
9106
+ conversationWorkQueue: getVercelConversationWorkQueue()
9184
9107
  });
9185
9108
  });
9186
9109
  app.get("/api/internal/sandbox-egress/signals", (c) => {
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-2DIRU2C2.js";
4
- import "./chunk-TZRYLW3R.js";
3
+ } from "./chunk-WZN4RQ64.js";
4
+ import "./chunk-CLX3T7Q3.js";
5
5
  import "./chunk-RUIXF3YQ.js";
6
6
  import "./chunk-HZF5P5UN.js";
7
7
  import "./chunk-F3B2YJ76.js";
8
- import "./chunk-3WIFZBJL.js";
8
+ import "./chunk-7TZM33YX.js";
9
9
  import "./chunk-6GWA276C.js";
10
10
  import "./chunk-OOUNJNMR.js";
11
11
  import "./chunk-H4HBKISO.js";
12
- import "./chunk-6IWDFUXW.js";
13
- import "./chunk-JUBPTYNO.js";
12
+ import "./chunk-M6PWM3OK.js";
13
+ import "./chunk-ELAVLP7Z.js";
14
14
  import "./chunk-MLKGABMK.js";
15
15
  export {
16
16
  pluginCatalogRuntime
@@ -7,10 +7,11 @@ export declare function upsertActiveSkill(activeSkills: Skill[], next: Skill): v
7
7
  export declare function discoverRunSkills(args: {
8
8
  skillDirs?: string[];
9
9
  }): Promise<SkillMetadata[]>;
10
- /** Rehydrate active skill handles from durable Pi history and explicit invocation. */
11
- export declare function restoreSkillRuntime(args: {
10
+ /** Load the explicit skill, or recover the last skill loaded in a resumed turn. */
11
+ export declare function loadRunSkill(args: {
12
12
  activeSkills: Skill[];
13
+ currentTurnMessages: readonly PiMessage[];
13
14
  invokedSkill: SkillMetadata | null;
14
- priorPiMessages: PiMessage[] | undefined;
15
+ resumed: boolean;
15
16
  skillSandbox: SkillSandbox;
16
- }): Promise<void>;
17
+ }): Promise<Skill | null>;
@@ -2,10 +2,11 @@
2
2
  * Run tool wiring.
3
3
  *
4
4
  * Builds everything the agent can act through for one run slice: the sandbox
5
- * access, MCP and plugin auth orchestration, MCP
6
- * provider restoration from durable history, and the Pi-facing tool surfaces
7
- * (main-agent tools plus runtime control tools). Auth pauses raised while
8
- * restoring providers are thrown here so the run parks before prompting.
5
+ * access, MCP and plugin auth orchestration, credential-subject-owned MCP
6
+ * provider
7
+ * restoration, and the Pi-facing tool surfaces (main-agent tools plus runtime
8
+ * control tools). Auth pauses raised while restoring providers are thrown
9
+ * here so the run parks before prompting.
9
10
  */
10
11
  import type { AgentTool } from "@earendil-works/pi-agent-core";
11
12
  import type { FileUpload } from "chat";
@@ -51,7 +52,6 @@ interface ToolWiringArgs {
51
52
  onFatalToolError(error: Error): void;
52
53
  onSandboxRefChanged: (sandboxRef: SandboxRef) => void;
53
54
  preAgentPromptMessages: () => PiMessage[];
54
- priorPiMessages: PiMessage[] | undefined;
55
55
  recordConnectedMcpProvider: (provider: string) => Promise<void>;
56
56
  requestHandoff?: ToolRuntimeContext["handoff"];
57
57
  resume: ResumeState;