@sentry/junior 0.126.1 → 0.127.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 (57) hide show
  1. package/dist/{agent-hooks-U5YGLX6Y.js → agent-hooks-HMCMFIIO.js} +8 -8
  2. package/dist/api/people/spend.d.ts +4 -0
  3. package/dist/api/people/spend.query.d.ts +3 -0
  4. package/dist/api/schema/person.d.ts +9 -0
  5. package/dist/api/schema.d.ts +2 -2
  6. package/dist/api/schema.js +3 -1
  7. package/dist/api.js +133 -33
  8. package/dist/app.js +29 -29
  9. package/dist/{catalog-runtime-OUPLWD7F.js → catalog-runtime-MI5UNBZ7.js} +5 -5
  10. package/dist/chat/plugins/agent-hooks.d.ts +4 -2
  11. package/dist/chat/resource-events/catalog.d.ts +21 -0
  12. package/dist/chat/resource-events/ingest.d.ts +1 -1
  13. package/dist/chat/resource-events/notification.d.ts +2 -2
  14. package/dist/chat/resource-events/store.d.ts +9 -9
  15. package/dist/chat/resource-events/tool-support.d.ts +10 -0
  16. package/dist/chat/task-execution/slack-work.d.ts +4 -4
  17. package/dist/chat/tools/list-resource-event-subscriptions.d.ts +80 -0
  18. package/dist/chat/tools/resource-events.d.ts +2 -1
  19. package/dist/chat/tools/search-resource-event-types.d.ts +60 -0
  20. package/dist/chat/tools/stop-watching-resources.d.ts +50 -0
  21. package/dist/chat/tools/watch-resource-events.d.ts +105 -0
  22. package/dist/{chunk-QMK2VF6K.js → chunk-2M6LYDTB.js} +1 -1
  23. package/dist/{chunk-JKV244BI.js → chunk-2N6EL22B.js} +1 -1
  24. package/dist/{chunk-OG6E44DH.js → chunk-4H2NZPFJ.js} +6 -6
  25. package/dist/{chunk-7VF3JAVF.js → chunk-6DU2ZNF7.js} +7 -7
  26. package/dist/{chunk-6ZBSTNYN.js → chunk-AFJF3RGU.js} +9 -0
  27. package/dist/{chunk-7ZMY4GCG.js → chunk-AKL3BAYJ.js} +1 -1
  28. package/dist/{chunk-PD6J33TO.js → chunk-AYICPT5T.js} +1 -1
  29. package/dist/{chunk-YUPNY2HZ.js → chunk-C7AVHH3H.js} +2 -2
  30. package/dist/{chunk-HXWOZ4HG.js → chunk-FVIU6NQO.js} +1 -1
  31. package/dist/{chunk-R3GXQJEE.js → chunk-JNYR4G7A.js} +2 -2
  32. package/dist/{chunk-W3JHZHAN.js → chunk-JXQWTNDI.js} +1 -1
  33. package/dist/{chunk-WIIPHGJY.js → chunk-L7L7RYJM.js} +2 -2
  34. package/dist/{chunk-U36WL4OL.js → chunk-NK7QVIMJ.js} +1 -1
  35. package/dist/{chunk-Y2QRKPI7.js → chunk-NYVMPADK.js} +1 -1
  36. package/dist/{chunk-S4LM6UB7.js → chunk-PDG3BSOD.js} +2 -2
  37. package/dist/{chunk-F2ARYRKC.js → chunk-SH7HDO2D.js} +1 -1
  38. package/dist/{chunk-YZHA2L7P.js → chunk-TLMI3Q4Q.js} +35 -12
  39. package/dist/{chunk-GLNB2R42.js → chunk-UEMGGJZD.js} +12 -12
  40. package/dist/{chunk-YFE6VNHU.js → chunk-VHUMNUJL.js} +1 -1
  41. package/dist/{chunk-KBW6J5GA.js → chunk-WXP2ZXC7.js} +4 -4
  42. package/dist/{chunk-QVSYR5CV.js → chunk-YSOZT72W.js} +4 -4
  43. package/dist/{chunk-SD2VFSN6.js → chunk-Z5LLJNTL.js} +669 -390
  44. package/dist/cli/chat.js +23 -23
  45. package/dist/cli/check.js +6 -6
  46. package/dist/cli/plugins.js +11 -11
  47. package/dist/cli/snapshot-create.js +9 -9
  48. package/dist/cli/upgrade.js +6 -6
  49. package/dist/{db-FQID26JW.js → db-N4EY57ZJ.js} +6 -6
  50. package/dist/instrumentation.js +4 -4
  51. package/dist/nitro.js +2 -2
  52. package/dist/{oauth-callback-server-Z5MHHKFD.js → oauth-callback-server-O62UOQSS.js} +16 -16
  53. package/dist/{runner-PGPGKYSF.js → runner-SRHRD3NX.js} +10 -10
  54. package/dist/{skills-BCQHR636.js → skills-V6X3JVVA.js} +6 -6
  55. package/dist/{validation-QP3FYBLZ.js → validation-ZZXZELGH.js} +6 -6
  56. package/dist/version.js +1 -1
  57. package/package.json +6 -6
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getConversationEventStore,
3
3
  getDb
4
- } from "./chunk-S4LM6UB7.js";
4
+ } from "./chunk-PDG3BSOD.js";
5
5
  import {
6
6
  juniorConversationAnnotations,
7
7
  juniorConversationEvents,
@@ -12,14 +12,14 @@ import {
12
12
  SANDBOX_WORKSPACE_ROOT,
13
13
  getStateAdapter,
14
14
  sleep
15
- } from "./chunk-F2ARYRKC.js";
15
+ } from "./chunk-SH7HDO2D.js";
16
16
  import {
17
17
  botConfig,
18
18
  completeObject,
19
19
  embedTexts,
20
20
  getSlackBotToken,
21
21
  standardModelId
22
- } from "./chunk-WIIPHGJY.js";
22
+ } from "./chunk-L7L7RYJM.js";
23
23
  import {
24
24
  isActorUserId,
25
25
  parseActorUserId
@@ -37,14 +37,16 @@ import {
37
37
  setSpanAttributes,
38
38
  setSpanStatus,
39
39
  withSpan
40
- } from "./chunk-PD6J33TO.js";
40
+ } from "./chunk-AYICPT5T.js";
41
41
 
42
42
  // src/chat/plugins/agent-hooks.ts
43
43
  import {
44
44
  missingToolAnnotationKeys,
45
+ normalizeResourceEventIdentifier,
45
46
  promptContextSchema,
46
47
  promptMessageSchema,
47
- resourceEventSchema
48
+ pluginResourceEventsSchema,
49
+ resourceEventInputSchema
48
50
  } from "@sentry/junior-plugin-api";
49
51
 
50
52
  // src/chat/plugins/annotations.ts
@@ -1249,6 +1251,9 @@ function validatePlugins(plugins) {
1249
1251
  if (seen.has(name)) {
1250
1252
  throw new Error(`Duplicate plugin name "${name}"`);
1251
1253
  }
1254
+ if (plugin.resourceEvents !== void 0 && !pluginResourceEventsSchema.safeParse(plugin.resourceEvents).success) {
1255
+ throw new Error(`Plugin "${name}" resourceEvents is invalid`);
1256
+ }
1252
1257
  for (const [taskName, task] of Object.entries(plugin.tasks ?? {})) {
1253
1258
  if (!PLUGIN_TOOL_NAME_RE.test(taskName)) {
1254
1259
  throw new Error(
@@ -1525,6 +1530,21 @@ function routeMethods(route, pluginName) {
1525
1530
  }
1526
1531
  return methods;
1527
1532
  }
1533
+ function requirePublishedResourceEvent(plugin, eventType) {
1534
+ const registration = plugin.resourceEvents;
1535
+ if (!registration || registration.isEnabled?.() === false) {
1536
+ throw new Error(
1537
+ `Plugin "${plugin.manifest.name}" cannot publish resource events without an active registration`
1538
+ );
1539
+ }
1540
+ if (!registration.resourceTypes.some(
1541
+ (resourceType) => resourceType.supportedEvents.includes(eventType)
1542
+ )) {
1543
+ throw new Error(
1544
+ `Plugin "${plugin.manifest.name}" did not register resource event "${eventType}"`
1545
+ );
1546
+ }
1547
+ }
1528
1548
  function getPluginRoutes(options) {
1529
1549
  const routes = [];
1530
1550
  const seen = /* @__PURE__ */ new Set();
@@ -1546,13 +1566,16 @@ function getPluginRoutes(options) {
1546
1566
  },
1547
1567
  resourceEvents: {
1548
1568
  async publish(event) {
1549
- const parsed = resourceEventSchema.parse(event);
1550
- if (parsed.provider !== pluginName) {
1551
- throw new Error(
1552
- `Plugin "${pluginName}" cannot publish resource events for provider "${parsed.provider}"`
1553
- );
1554
- }
1555
- await options.resourceEvents.publish(parsed);
1569
+ const parsed = resourceEventInputSchema.parse(event);
1570
+ requirePublishedResourceEvent(plugin, parsed.eventType);
1571
+ await options.resourceEvents.publish({
1572
+ ...parsed,
1573
+ identifier: normalizeResourceEventIdentifier(
1574
+ plugin.resourceEvents,
1575
+ parsed.identifier
1576
+ ),
1577
+ namespace: pluginName
1578
+ });
1556
1579
  }
1557
1580
  }
1558
1581
  });
@@ -13,7 +13,7 @@ import {
13
13
  persistAuthPauseTurnState,
14
14
  requireTurnFailureEventId,
15
15
  scheduleSessionCompletedPluginTasks
16
- } from "./chunk-OG6E44DH.js";
16
+ } from "./chunk-4H2NZPFJ.js";
17
17
  import {
18
18
  buildSentryConversationUrl
19
19
  } from "./chunk-4CODA7P5.js";
@@ -40,7 +40,7 @@ import {
40
40
  resolveBaseUrl,
41
41
  resolvePluginOAuthAccount,
42
42
  truncateStatusText
43
- } from "./chunk-7VF3JAVF.js";
43
+ } from "./chunk-6DU2ZNF7.js";
44
44
  import {
45
45
  JUNIOR_THREAD_STATE_TTL_MS,
46
46
  TurnSliceLimitExceededError,
@@ -73,13 +73,13 @@ import {
73
73
  recordDeliveredAssistantMessage,
74
74
  turnHasReply,
75
75
  updateConversationStats
76
- } from "./chunk-KBW6J5GA.js";
76
+ } from "./chunk-WXP2ZXC7.js";
77
77
  import {
78
78
  parseSlackThreadId,
79
79
  readSlackRawMessageContext,
80
80
  resolveSlackChannelIdFromMessage,
81
81
  resolveSlackChannelIdFromThreadId
82
- } from "./chunk-QMK2VF6K.js";
82
+ } from "./chunk-2M6LYDTB.js";
83
83
  import {
84
84
  SlackActionError,
85
85
  getDashboardConversationLink,
@@ -88,19 +88,19 @@ import {
88
88
  getSlackClient,
89
89
  isDmChannel,
90
90
  normalizeSlackConversationId
91
- } from "./chunk-YZHA2L7P.js";
91
+ } from "./chunk-TLMI3Q4Q.js";
92
92
  import {
93
93
  getConversationEventStore,
94
94
  getConversationStore,
95
95
  parseDestination,
96
96
  requireSlackDestination,
97
97
  sameDestination
98
- } from "./chunk-S4LM6UB7.js";
98
+ } from "./chunk-PDG3BSOD.js";
99
99
  import {
100
100
  acquireActiveLock,
101
101
  getDefaultRedisStateAdapterFor,
102
102
  getStateAdapter
103
- } from "./chunk-F2ARYRKC.js";
103
+ } from "./chunk-SH7HDO2D.js";
104
104
  import {
105
105
  FUNCTION_TIMEOUT_BUFFER_SECONDS,
106
106
  botConfig,
@@ -109,18 +109,18 @@ import {
109
109
  getRuntimeMetadata,
110
110
  normalizeSlackEmojiName,
111
111
  standardModelId
112
- } from "./chunk-WIIPHGJY.js";
112
+ } from "./chunk-L7L7RYJM.js";
113
113
  import {
114
114
  discoverSkills
115
- } from "./chunk-R3GXQJEE.js";
115
+ } from "./chunk-JNYR4G7A.js";
116
116
  import {
117
117
  pluginCatalogRuntime
118
- } from "./chunk-JKV244BI.js";
118
+ } from "./chunk-2N6EL22B.js";
119
119
  import {
120
120
  buildOAuthTokenRequest,
121
121
  hasRequiredOAuthScope,
122
122
  parseOAuthTokenResponse
123
- } from "./chunk-HXWOZ4HG.js";
123
+ } from "./chunk-FVIU6NQO.js";
124
124
  import {
125
125
  createSlackResumeActor,
126
126
  isUserActor,
@@ -139,7 +139,7 @@ import {
139
139
  toOptionalNumber,
140
140
  toOptionalString,
141
141
  withLogContext
142
- } from "./chunk-PD6J33TO.js";
142
+ } from "./chunk-AYICPT5T.js";
143
143
  import {
144
144
  homeDir
145
145
  } from "./chunk-H4HBKISO.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getDb
3
- } from "./chunk-S4LM6UB7.js";
3
+ } from "./chunk-PDG3BSOD.js";
4
4
  import {
5
5
  juniorStats
6
6
  } from "./chunk-S4PUICSB.js";
@@ -16,17 +16,17 @@ import {
16
16
  instructionProvenanceFor,
17
17
  sanitizePostgresJson,
18
18
  withConversationEventLock
19
- } from "./chunk-S4LM6UB7.js";
19
+ } from "./chunk-PDG3BSOD.js";
20
20
  import {
21
21
  getStateAdapter,
22
22
  sleep
23
- } from "./chunk-F2ARYRKC.js";
23
+ } from "./chunk-SH7HDO2D.js";
24
24
  import {
25
25
  botConfig,
26
26
  escapeXml,
27
27
  resolveGatewayModel,
28
28
  unwrapCurrentInstruction
29
- } from "./chunk-WIIPHGJY.js";
29
+ } from "./chunk-L7L7RYJM.js";
30
30
  import {
31
31
  toStoredSlackActor
32
32
  } from "./chunk-HZF5P5UN.js";
@@ -41,7 +41,7 @@ import {
41
41
  setSpanAttributes,
42
42
  toOptionalNumber,
43
43
  toOptionalString
44
- } from "./chunk-PD6J33TO.js";
44
+ } from "./chunk-AYICPT5T.js";
45
45
 
46
46
  // src/chat/turn-context-tag.ts
47
47
  var TURN_CONTEXT_TAG = "runtime-turn-context";
@@ -2,18 +2,18 @@ import {
2
2
  SANDBOX_WORKSPACE_ROOT,
3
3
  getStateAdapter,
4
4
  sleep
5
- } from "./chunk-F2ARYRKC.js";
5
+ } from "./chunk-SH7HDO2D.js";
6
6
  import {
7
7
  toOptionalTrimmed
8
- } from "./chunk-WIIPHGJY.js";
8
+ } from "./chunk-L7L7RYJM.js";
9
9
  import {
10
10
  pluginCatalogRuntime
11
- } from "./chunk-JKV244BI.js";
11
+ } from "./chunk-2N6EL22B.js";
12
12
  import {
13
13
  setSpanAttributes,
14
14
  setSpanStatus,
15
15
  withSpan
16
- } from "./chunk-PD6J33TO.js";
16
+ } from "./chunk-AYICPT5T.js";
17
17
 
18
18
  // src/chat/sandbox/snapshot/profile.ts
19
19
  import { createHash } from "crypto";