@sentry/junior 0.150.1 → 0.151.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 (71) hide show
  1. package/dist/{agent-hooks-G4LEACQB.js → agent-hooks-EYUAEBMA.js} +10 -10
  2. package/dist/api/schema/conversation.d.ts +24 -4
  3. package/dist/api/schema.js +1 -1
  4. package/dist/api.js +63 -35
  5. package/dist/app.js +123 -200
  6. package/dist/{catalog-runtime-ZRSNE2MH.js → catalog-runtime-2LCLLOBI.js} +5 -5
  7. package/dist/chat/agent/skills.d.ts +5 -4
  8. package/dist/chat/agent/tools.d.ts +5 -5
  9. package/dist/chat/conversations/history.d.ts +12 -3
  10. package/dist/chat/conversations/projection.d.ts +7 -3
  11. package/dist/chat/mcp/tool-manager.d.ts +0 -4
  12. package/dist/chat/runtime/agent-run-outcome.d.ts +4 -0
  13. package/dist/chat/tools/search-conversation-events.d.ts +1 -1
  14. package/dist/chat/tools/skill/call-mcp-tool.d.ts +0 -1
  15. package/dist/chat/tools/skill/load-skill.d.ts +2 -5
  16. package/dist/chat/tools/types.d.ts +1 -2
  17. package/dist/{chunk-TZRYLW3R.js → chunk-2MGJ64SL.js} +1 -1
  18. package/dist/{chunk-IQW6RFXG.js → chunk-3WOK4ZLX.js} +72 -218
  19. package/dist/{chunk-XED3H34M.js → chunk-4ABTAQYC.js} +3 -3
  20. package/dist/{chunk-KFHJQYKQ.js → chunk-5N3XLYBW.js} +1 -1
  21. package/dist/{chunk-JVOLC6JZ.js → chunk-6A46QL4O.js} +4 -4
  22. package/dist/{chunk-2DIRU2C2.js → chunk-6DLWRSGV.js} +1 -1
  23. package/dist/{chunk-OWLJZ6I7.js → chunk-6PGJPCN2.js} +1 -1
  24. package/dist/{chunk-AD6N2KNE.js → chunk-6WNWM5JD.js} +5 -5
  25. package/dist/{chunk-D2PVJU5E.js → chunk-AGSUPAD5.js} +2 -2
  26. package/dist/{chunk-W3FQZAX5.js → chunk-B7KWBJAR.js} +6 -6
  27. package/dist/{chunk-QO3OSJDS.js → chunk-C7D2ONB5.js} +1 -1
  28. package/dist/{chunk-LSI3EKZQ.js → chunk-CL5DT6D2.js} +4 -4
  29. package/dist/{chunk-FGP5W3NS.js → chunk-D22FO4LW.js} +2 -2
  30. package/dist/{chunk-6IWDFUXW.js → chunk-DJAOSWB6.js} +1 -1
  31. package/dist/{chunk-JBYWR6FW.js → chunk-EMB4VY7H.js} +5 -5
  32. package/dist/{chunk-R53UTQ2Q.js → chunk-H7ZMEHAN.js} +1 -1
  33. package/dist/{chunk-N6QJAPZS.js → chunk-J5LAA2LI.js} +9 -9
  34. package/dist/{chunk-2AWDPNP7.js → chunk-JIJOPRD4.js} +16 -10
  35. package/dist/{chunk-6A24WEKX.js → chunk-JSKTDBSS.js} +4 -4
  36. package/dist/{chunk-GZ25ZSTX.js → chunk-K3QXMZDU.js} +11 -4
  37. package/dist/{chunk-IZE2EGCX.js → chunk-KPQBQRNM.js} +5 -5
  38. package/dist/{chunk-SZ74ECCC.js → chunk-M6KRPBXC.js} +6 -6
  39. package/dist/{chunk-3WIFZBJL.js → chunk-OAPPJ3TM.js} +1 -1
  40. package/dist/{chunk-LWFHRWJI.js → chunk-OFRJXFTH.js} +8 -8
  41. package/dist/{chunk-2Z7YX5PI.js → chunk-OYRFUQOV.js} +106 -16
  42. package/dist/{chunk-6ZYGORV4.js → chunk-PQUV3NA5.js} +2 -2
  43. package/dist/{chunk-5NOHC2Z4.js → chunk-PWMVR2MD.js} +1 -1
  44. package/dist/{chunk-QNSV46AW.js → chunk-QVQBWWXQ.js} +6 -6
  45. package/dist/{chunk-4JV7GUUH.js → chunk-UDDCHQN2.js} +1 -1
  46. package/dist/{chunk-JUBPTYNO.js → chunk-WVXFEQXE.js} +1 -1
  47. package/dist/{chunk-3JVUWLR7.js → chunk-XN3QKNQX.js} +8 -1
  48. package/dist/{chunk-B2YA2G26.js → chunk-YN4W5SRJ.js} +1 -1
  49. package/dist/{chunk-QZGYKKH6.js → chunk-ZGSL5ARH.js} +50 -22
  50. package/dist/cli/chat.js +30 -30
  51. package/dist/cli/check.js +6 -6
  52. package/dist/cli/plugins.js +13 -13
  53. package/dist/cli/snapshot-create.js +9 -9
  54. package/dist/cli/upgrade.js +7 -7
  55. package/dist/{db-WRA5ZHYE.js → db-ALCBI4JZ.js} +7 -7
  56. package/dist/instrumentation.js +4 -4
  57. package/dist/nitro.js +2 -2
  58. package/dist/{oauth-callback-server-QWAYG3MI.js → oauth-callback-server-3RRMG62B.js} +23 -23
  59. package/dist/{runner-5JQ54J6P.js → runner-V6C3EELU.js} +14 -14
  60. package/dist/{skills-3YD55WPO.js → skills-43PFYZIZ.js} +6 -6
  61. package/dist/spawn-UZNNTNFU.js +38 -0
  62. package/dist/{validation-ZXE3IRSB.js → validation-4MNN6QKE.js} +6 -6
  63. package/dist/version.js +1 -1
  64. package/dist/{work-7G2U64WI.js → work-YZO6XTEB.js} +17 -17
  65. package/dist/{worker-HJM2FZNI.js → worker-42AR7323.js} +11 -11
  66. package/migrations/0025_mcp_credential_subject.sql +8 -0
  67. package/migrations/meta/0025_snapshot.json +2275 -0
  68. package/migrations/meta/_journal.json +7 -0
  69. package/package.json +4 -4
  70. package/dist/chat/pi/derived-state.d.ts +0 -5
  71. 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-CL5DT6D2.js";
4
4
  import {
5
5
  bindSpawnAgent
6
- } from "./chunk-QO3OSJDS.js";
6
+ } from "./chunk-C7D2ONB5.js";
7
7
  import {
8
8
  createAgentInvocationWorker,
9
9
  enqueueAgentInvocation,
10
10
  listPendingAgentInvocationMailboxAppends,
11
11
  routeAgentInvocationWork
12
- } from "./chunk-W3FQZAX5.js";
12
+ } from "./chunk-B7KWBJAR.js";
13
13
  import {
14
14
  GET as GET2,
15
15
  GET2 as GET3,
@@ -36,24 +36,25 @@ import {
36
36
  startSlackProcessingReaction,
37
37
  stripLeadingBotMention,
38
38
  wakePausedTurn
39
- } from "./chunk-QZGYKKH6.js";
39
+ } from "./chunk-ZGSL5ARH.js";
40
40
  import "./chunk-FA6POGLH.js";
41
41
  import {
42
42
  getTurnRequestDeadline,
43
43
  runWithTurnRequestDeadline
44
- } from "./chunk-R53UTQ2Q.js";
44
+ } from "./chunk-H7ZMEHAN.js";
45
45
  import {
46
46
  completeAuthPauseTurn,
47
47
  persistAuthPauseTurnState
48
- } from "./chunk-XED3H34M.js";
48
+ } from "./chunk-4ABTAQYC.js";
49
49
  import {
50
50
  GET,
51
51
  conversationVisibilityFromSlackChannelType,
52
52
  createApiTurnWorker,
53
+ lookupSlackUser,
53
54
  resolveSlackChannelTypeFromMessage,
54
55
  resolveSlackConversationContext,
55
56
  routeApiTurnWork
56
- } from "./chunk-2Z7YX5PI.js";
57
+ } from "./chunk-OYRFUQOV.js";
57
58
  import "./chunk-4CODA7P5.js";
58
59
  import {
59
60
  CONVERSATION_WORK_STALE_ENQUEUE_MS,
@@ -65,7 +66,7 @@ import {
65
66
  isInvalidConversationRecordError,
66
67
  listActiveConversationIds,
67
68
  removeActiveConversation
68
- } from "./chunk-JVOLC6JZ.js";
69
+ } from "./chunk-6A46QL4O.js";
69
70
  import {
70
71
  buildDeliveredTurnStatePatch,
71
72
  claimDispatchMailboxAppend,
@@ -94,7 +95,7 @@ import {
94
95
  requireTurnFailureEventId,
95
96
  resolveTurnSessionRouting,
96
97
  scheduleSessionCompletedPluginTasks
97
- } from "./chunk-N6QJAPZS.js";
98
+ } from "./chunk-J5LAA2LI.js";
98
99
  import {
99
100
  ConversationTurnLifecycleService,
100
101
  coerceThreadConversationState,
@@ -104,7 +105,7 @@ import {
104
105
  persistThreadRuntimeState,
105
106
  persistThreadState,
106
107
  persistThreadStateById
107
- } from "./chunk-JBYWR6FW.js";
108
+ } from "./chunk-EMB4VY7H.js";
108
109
  import "./chunk-UTL3MHPC.js";
109
110
  import {
110
111
  getVercelConversationWorkQueue,
@@ -123,7 +124,7 @@ import {
123
124
  import {
124
125
  validatePluginEgressCredentialHooks,
125
126
  validatePluginRegistrations
126
- } from "./chunk-OWLJZ6I7.js";
127
+ } from "./chunk-6PGJPCN2.js";
127
128
  import {
128
129
  defineJuniorPlugins,
129
130
  pluginCatalogConfigFromEnv,
@@ -156,18 +157,18 @@ import {
156
157
  setConfigDefaults,
157
158
  shouldEmitDevAgentTrace,
158
159
  shouldPropagateSandboxEgressTrace
159
- } from "./chunk-IQW6RFXG.js";
160
+ } from "./chunk-3WOK4ZLX.js";
160
161
  import {
161
162
  AuthorizationFlowDisabledError,
162
163
  PluginCredentialFailureError
163
- } from "./chunk-IZE2EGCX.js";
164
+ } from "./chunk-KPQBQRNM.js";
164
165
  import "./chunk-DIB4GX3G.js";
165
166
  import {
166
167
  createUserTokenStore,
167
168
  deleteMcpAuthSessionsForUserProvider,
168
169
  deleteMcpServerSessionId,
169
170
  deleteMcpStoredOAuthCredentials
170
- } from "./chunk-LWFHRWJI.js";
171
+ } from "./chunk-OFRJXFTH.js";
171
172
  import {
172
173
  RetryableDeliveryError
173
174
  } from "./chunk-RF6J3DIO.js";
@@ -175,7 +176,7 @@ import {
175
176
  formatProviderLabel,
176
177
  postSlackMessage,
177
178
  startOAuthFlow
178
- } from "./chunk-SZ74ECCC.js";
179
+ } from "./chunk-M6KRPBXC.js";
179
180
  import "./chunk-HUO3UTAQ.js";
180
181
  import {
181
182
  getExperimentalFeatures,
@@ -184,16 +185,16 @@ import {
184
185
  import {
185
186
  getSandboxResourceConfig,
186
187
  setSandboxResourceConfig
187
- } from "./chunk-6A24WEKX.js";
188
+ } from "./chunk-JSKTDBSS.js";
188
189
  import {
189
190
  createSchedulerSqlStore,
190
191
  findMatchingEventTasks,
191
192
  logScheduledTaskRunSkipped,
192
193
  scheduledTaskRunAttributes
193
- } from "./chunk-AD6N2KNE.js";
194
+ } from "./chunk-6WNWM5JD.js";
194
195
  import {
195
196
  parseSlackThreadId
196
- } from "./chunk-4JV7GUUH.js";
197
+ } from "./chunk-UDDCHQN2.js";
197
198
  import {
198
199
  ConversationTurnBoundaryError,
199
200
  CooperativeTurnYieldError,
@@ -243,7 +244,7 @@ import {
243
244
  trimTrailingAssistantMessages,
244
245
  turnHasReply,
245
246
  upsertConversationMessage
246
- } from "./chunk-2AWDPNP7.js";
247
+ } from "./chunk-JIJOPRD4.js";
247
248
  import "./chunk-3Y47VMHV.js";
248
249
  import "./chunk-PDO5BLNM.js";
249
250
  import "./chunk-UIE3R5XU.js";
@@ -263,7 +264,7 @@ import {
263
264
  verifyEventTaskCredentialSubject,
264
265
  verifyScheduledTaskCredentialSubject,
265
266
  verifySlackDirectCredentialSubject
266
- } from "./chunk-QNSV46AW.js";
267
+ } from "./chunk-QVQBWWXQ.js";
267
268
  import {
268
269
  SlackActionError,
269
270
  downloadPrivateSlackFile,
@@ -273,7 +274,7 @@ import {
273
274
  normalizeSlackConversationId,
274
275
  runWithSlackInstallationToken,
275
276
  runWithWorkspaceTeamId
276
- } from "./chunk-D2PVJU5E.js";
277
+ } from "./chunk-AGSUPAD5.js";
277
278
  import {
278
279
  contextProvenance,
279
280
  createSlackDestination,
@@ -286,19 +287,19 @@ import {
286
287
  requireSlackDestination,
287
288
  withConversationEventLock,
288
289
  withConversationMutationLock
289
- } from "./chunk-GZ25ZSTX.js";
290
+ } from "./chunk-K3QXMZDU.js";
290
291
  import {
291
292
  juniorAgentBindings,
292
293
  juniorAgentInvocations,
293
294
  juniorConversationEvents,
294
295
  juniorConversations
295
- } from "./chunk-KFHJQYKQ.js";
296
+ } from "./chunk-5N3XLYBW.js";
296
297
  import "./chunk-EM225ITJ.js";
297
298
  import {
298
299
  acquireActiveLock,
299
300
  getStateAdapter,
300
301
  withActiveLock
301
- } from "./chunk-B2YA2G26.js";
302
+ } from "./chunk-YN4W5SRJ.js";
302
303
  import {
303
304
  STANDARD_MODEL_PROFILE,
304
305
  botConfig,
@@ -316,16 +317,16 @@ import {
316
317
  modelIdForProfile,
317
318
  setSlackReactionConfig,
318
319
  standardModelId
319
- } from "./chunk-FGP5W3NS.js";
320
+ } from "./chunk-D22FO4LW.js";
320
321
  import {
321
322
  juniorDestinations
322
323
  } from "./chunk-VFUK3X5B.js";
323
- import "./chunk-5NOHC2Z4.js";
324
- import "./chunk-6ZYGORV4.js";
324
+ import "./chunk-PWMVR2MD.js";
325
+ import "./chunk-PQUV3NA5.js";
325
326
  import {
326
327
  pluginCatalogRuntime
327
- } from "./chunk-2DIRU2C2.js";
328
- import "./chunk-TZRYLW3R.js";
328
+ } from "./chunk-6DLWRSGV.js";
329
+ import "./chunk-2MGJ64SL.js";
329
330
  import {
330
331
  credentialContextForActor
331
332
  } from "./chunk-RUIXF3YQ.js";
@@ -359,7 +360,7 @@ import {
359
360
  withContext,
360
361
  withLogContext,
361
362
  withSpan
362
- } from "./chunk-3WIFZBJL.js";
363
+ } from "./chunk-OAPPJ3TM.js";
363
364
  import {
364
365
  continueTrace
365
366
  } from "./chunk-6GWA276C.js";
@@ -367,10 +368,10 @@ import "./chunk-OOUNJNMR.js";
367
368
  import "./chunk-H4HBKISO.js";
368
369
  import {
369
370
  JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE
370
- } from "./chunk-6IWDFUXW.js";
371
+ } from "./chunk-DJAOSWB6.js";
371
372
  import {
372
373
  JUNIOR_VERSION
373
- } from "./chunk-JUBPTYNO.js";
374
+ } from "./chunk-WVXFEQXE.js";
374
375
  import "./chunk-MLKGABMK.js";
375
376
 
376
377
  // src/app.ts
@@ -2414,7 +2415,7 @@ import {
2414
2415
  Message,
2415
2416
  ThreadImpl
2416
2417
  } from "chat";
2417
- import { z as z4 } from "zod";
2418
+ import { z as z3 } from "zod";
2418
2419
 
2419
2420
  // src/chat/ingress/message-router.ts
2420
2421
  function normalizeIncomingSlackThreadId(threadId, message) {
@@ -2584,91 +2585,6 @@ async function ensureSlackMessageActorIdentity(message, teamId, lookupSlackUser2
2584
2585
  return actor;
2585
2586
  }
2586
2587
 
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
2588
  // src/chat/resource-events/actor.ts
2673
2589
  var RESOURCE_EVENT_SLACK_AUTHOR_ID = "UJRNEVENT";
2674
2590
  var RESOURCE_EVENT_SYSTEM_ACTOR = {
@@ -2690,17 +2606,17 @@ function stripLeadingSteeringOverride(text) {
2690
2606
  }
2691
2607
 
2692
2608
  // src/chat/task-execution/slack-work.ts
2693
- var slackConversationRouteSchema = z4.enum(["mention", "subscribed"]);
2609
+ var slackConversationRouteSchema = z3.enum(["mention", "subscribed"]);
2694
2610
  function hasSteeringOverride(text) {
2695
2611
  return stripLeadingSteeringOverride(text) !== text;
2696
2612
  }
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()
2613
+ var serializedDateSchema = z3.iso.datetime();
2614
+ var mdastPointSchema = z3.object({
2615
+ column: z3.number().int().positive(),
2616
+ line: z3.number().int().positive(),
2617
+ offset: z3.number().int().nonnegative().optional()
2702
2618
  }).strict();
2703
- var mdastPositionSchema = z4.object({
2619
+ var mdastPositionSchema = z3.object({
2704
2620
  end: mdastPointSchema,
2705
2621
  start: mdastPointSchema
2706
2622
  }).strict();
@@ -2812,7 +2728,7 @@ function isFormattedContentNode(value) {
2812
2728
  return false;
2813
2729
  }
2814
2730
  }
2815
- var formattedContentSchema = z4.custom(
2731
+ var formattedContentSchema = z3.custom(
2816
2732
  (value) => {
2817
2733
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
2818
2734
  return false;
@@ -2822,79 +2738,79 @@ var formattedContentSchema = z4.custom(
2822
2738
  },
2823
2739
  "must be a valid formatted-content root"
2824
2740
  );
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()
2741
+ var serializedMessageSchema = z3.object({
2742
+ _type: z3.literal("chat:Message"),
2743
+ attachments: z3.array(
2744
+ z3.object({
2745
+ type: z3.enum(["image", "file", "video", "audio"]),
2746
+ url: z3.string().optional(),
2747
+ name: z3.string().optional(),
2748
+ mimeType: z3.string().optional(),
2749
+ size: z3.number().finite().optional(),
2750
+ width: z3.number().finite().optional(),
2751
+ height: z3.number().finite().optional(),
2752
+ fetchMetadata: z3.record(z3.string(), z3.string()).optional()
2837
2753
  }).strict()
2838
2754
  ),
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()
2755
+ author: z3.object({
2756
+ userId: z3.string(),
2757
+ userName: z3.string(),
2758
+ fullName: z3.string(),
2759
+ isBot: z3.union([z3.boolean(), z3.literal("unknown")]),
2760
+ isMe: z3.boolean()
2845
2761
  }).strict(),
2846
2762
  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()
2763
+ id: z3.string().min(1),
2764
+ isMention: z3.boolean().optional(),
2765
+ links: z3.array(
2766
+ z3.object({
2767
+ url: z3.string(),
2768
+ title: z3.string().optional(),
2769
+ description: z3.string().optional(),
2770
+ imageUrl: z3.string().optional(),
2771
+ siteName: z3.string().optional()
2856
2772
  }).strict()
2857
2773
  ).optional(),
2858
- metadata: z4.object({
2774
+ metadata: z3.object({
2859
2775
  dateSent: serializedDateSchema,
2860
- edited: z4.boolean(),
2776
+ edited: z3.boolean(),
2861
2777
  editedAt: serializedDateSchema.optional()
2862
2778
  }).strict(),
2863
- raw: z4.unknown(),
2864
- text: z4.string(),
2865
- threadId: z4.string().min(1)
2779
+ raw: z3.unknown(),
2780
+ text: z3.string(),
2781
+ threadId: z3.string().min(1)
2866
2782
  }).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(),
2783
+ var serializedThreadSchema = z3.object({
2784
+ _type: z3.literal("chat:Thread"),
2785
+ adapterName: z3.literal("slack"),
2786
+ channelId: z3.string().min(1),
2787
+ channelVisibility: z3.enum(["private", "workspace", "external", "unknown"]).optional(),
2872
2788
  currentMessage: serializedMessageSchema.optional(),
2873
- id: z4.string().min(1),
2874
- isDM: z4.boolean()
2789
+ id: z3.string().min(1),
2790
+ isDM: z3.boolean()
2875
2791
  }).strict();
2876
- var slackInstallationSchema = z4.object({
2877
- enterpriseId: z4.string().optional(),
2878
- isEnterpriseInstall: z4.boolean().optional(),
2879
- teamId: z4.string().optional()
2792
+ var slackInstallationSchema = z3.object({
2793
+ enterpriseId: z3.string().optional(),
2794
+ isEnterpriseInstall: z3.boolean().optional(),
2795
+ teamId: z3.string().optional()
2880
2796
  }).strict();
2881
- var slackConversationMessageMetadataBaseSchema = z4.object({
2797
+ var slackConversationMessageMetadataBaseSchema = z3.object({
2882
2798
  installation: slackInstallationSchema.optional(),
2883
2799
  message: serializedMessageSchema,
2884
- platform: z4.literal("slack"),
2800
+ platform: z3.literal("slack"),
2885
2801
  route: slackConversationRouteSchema,
2886
2802
  thread: serializedThreadSchema
2887
2803
  });
2888
- var slackConversationMessageMetadataSchema = z4.union([
2804
+ var slackConversationMessageMetadataSchema = z3.union([
2889
2805
  slackConversationMessageMetadataBaseSchema.strict(),
2890
2806
  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()
2807
+ kind: z3.literal("resource_event"),
2808
+ resourceEvent: z3.object({
2809
+ eventKey: z3.string(),
2810
+ eventType: z3.string(),
2811
+ namespace: z3.string(),
2812
+ identifier: z3.string(),
2813
+ subscriptionId: z3.string()
2898
2814
  }).strict()
2899
2815
  }).strict()
2900
2816
  ]);
@@ -3116,16 +3032,23 @@ function createSlackConversationWorker(options) {
3116
3032
  context.destination,
3117
3033
  "Slack paused-turn recovery"
3118
3034
  );
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
- });
3035
+ try {
3036
+ await runWithSlackInstallation({
3037
+ adapter,
3038
+ installation: { teamId: destination.teamId },
3039
+ state,
3040
+ task: async () => {
3041
+ await options.runNextPausedTurn(context.conversationId, {
3042
+ shouldYield: context.shouldYield
3043
+ });
3044
+ }
3045
+ });
3046
+ } catch (error) {
3047
+ if (isCooperativeTurnYieldError(error)) {
3048
+ return { status: "yielded" };
3127
3049
  }
3128
- });
3050
+ throw error;
3051
+ }
3129
3052
  return { status: "completed" };
3130
3053
  }
3131
3054
  const latestRecord = records[records.length - 1];
@@ -4290,7 +4213,7 @@ function registerVercelPluginTaskDevConsumer() {
4290
4213
  }
4291
4214
 
4292
4215
  // src/chat/services/subscribed-decision.ts
4293
- import { z as z5 } from "zod";
4216
+ import { z as z4 } from "zod";
4294
4217
 
4295
4218
  // src/chat/services/subscribed-reply-router-policy.ts
4296
4219
  function buildSubscribedReplyRouterPolicy(assistantName) {
@@ -4335,13 +4258,13 @@ Assess conversation floor ownership and whether the latest message continues wor
4335
4258
  }
4336
4259
 
4337
4260
  // 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(
4261
+ var replyDecisionSchema = z4.object({
4262
+ should_reply: z4.boolean().describe("Whether Junior should respond to this thread message."),
4263
+ should_unsubscribe: z4.boolean().describe(
4341
4264
  "Whether Junior should unsubscribe from this thread because the user clearly asked it to stop participating."
4342
4265
  ),
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.")
4266
+ confidence: z4.number().min(0).max(1).describe("Classifier confidence from 0 to 1."),
4267
+ reason: z4.string().describe("Short reason for the decision; use an empty string if none.")
4345
4268
  }).strict();
4346
4269
  var ROUTER_CONFIDENCE_THRESHOLD = 0.7;
4347
4270
  var ROUTER_CLASSIFIER_MAX_TOKENS = 400;
@@ -6047,11 +5970,11 @@ function getMessageTimestamp(message) {
6047
5970
  }
6048
5971
 
6049
5972
  // 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()
5973
+ import { z as z5 } from "zod";
5974
+ var slackActionTokenSchema = z5.string().trim().min(1).brand();
5975
+ var slackMessageEnvelopeSchema = z5.object({
5976
+ raw: z5.object({
5977
+ action_token: z5.unknown().optional()
6055
5978
  }).optional()
6056
5979
  });
6057
5980
  function readSlackActionToken(message) {
@@ -7074,7 +6997,7 @@ function createReplyToThread(deps) {
7074
6997
  }
7075
6998
  if (outcome.status === "suspended") {
7076
6999
  options.onTurnOutcome?.({ outcome: "awaiting_resume" });
7077
- if (options.shouldYield?.()) {
7000
+ if (options.shouldYield && (options.shouldYield() || outcome.reason === "timeout")) {
7078
7001
  shouldPersistFailureState = false;
7079
7002
  throw new CooperativeTurnYieldError();
7080
7003
  }
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-2DIRU2C2.js";
4
- import "./chunk-TZRYLW3R.js";
3
+ } from "./chunk-6DLWRSGV.js";
4
+ import "./chunk-2MGJ64SL.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-OAPPJ3TM.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-DJAOSWB6.js";
13
+ import "./chunk-WVXFEQXE.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;