@sentry/junior 0.181.1 → 0.183.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.
- package/dist/{agent-hooks-KO56HJ74.js → agent-hooks-SNRBZYAU.js} +11 -11
- package/dist/api/code/overview.d.ts +35 -0
- package/dist/api/code/routes.d.ts +4 -0
- package/dist/api/schema/code.d.ts +75 -0
- package/dist/api/schema.d.ts +2 -0
- package/dist/api/schema.js +9 -1
- package/dist/api.js +347 -149
- package/dist/app-adapter.d.ts +85 -0
- package/dist/app.d.ts +6 -1
- package/dist/app.js +380 -501
- package/dist/{catalog-runtime-CJTFLCK3.js → catalog-runtime-3I3JOIIH.js} +4 -4
- package/dist/chat/agent-invocations/store.d.ts +4 -2
- package/dist/chat/agent-invocations/work.d.ts +1 -3
- package/dist/chat/api-turns/adapter-conversations.d.ts +15 -0
- package/dist/chat/api-turns/stop.d.ts +12 -0
- package/dist/chat/api-turns/work.d.ts +9 -1
- package/dist/chat/app/conversation-work.d.ts +1 -1
- package/dist/chat/app/factory.d.ts +3 -3
- package/dist/chat/app/services.d.ts +3 -3
- package/dist/chat/code/publisher.d.ts +3 -0
- package/dist/chat/code/store.d.ts +9 -0
- package/dist/chat/event-tasks/store.d.ts +10 -0
- package/dist/chat/event-tasks/tool-support.d.ts +7 -1
- package/dist/chat/event-tasks/types.d.ts +1 -0
- package/dist/chat/experimental.d.ts +1 -1
- package/dist/chat/ingress/slack-webhook.d.ts +1 -1
- package/dist/chat/plugins/agent-hooks.d.ts +5 -0
- package/dist/chat/{runtime/slack-runtime.d.ts → providers/slack/runtime.d.ts} +2 -2
- package/dist/chat/{runtime/reply-executor.d.ts → providers/slack/turn.d.ts} +10 -9
- package/dist/chat/resource-events/catalog.d.ts +11 -1
- package/dist/chat/resource-events/store.d.ts +17 -1
- package/dist/chat/runtime/turn-execution.d.ts +30 -0
- package/dist/chat/services/subscribed-decision.d.ts +2 -1
- package/dist/chat/slack/dispatch-turn.d.ts +12 -14
- package/dist/chat/task-execution/slack-work.d.ts +1 -1
- package/dist/chat/tools/create-event-task.d.ts +3 -0
- package/dist/chat/tools/delete-event-task.d.ts +2 -0
- package/dist/chat/tools/list-event-tasks.d.ts +2 -0
- package/dist/chat/tools/list-resource-event-subscriptions.d.ts +2 -0
- package/dist/chat/tools/search-resource-event-types.d.ts +10 -0
- package/dist/chat/tools/update-event-task.d.ts +3 -0
- package/dist/chat/tools/watch-resource-events.d.ts +3 -0
- package/dist/{chunk-DTRCZOHE.js → chunk-24OJZ5OU.js} +6 -6
- package/dist/{chunk-Z2UG4FBT.js → chunk-2ADFGSUS.js} +1 -1
- package/dist/{chunk-RULGB5NX.js → chunk-2EPYYVJC.js} +9 -9
- package/dist/{chunk-VRS6WDK5.js → chunk-2LYHWMR4.js} +1 -1
- package/dist/{chunk-XQ56HNH5.js → chunk-35PM4YY5.js} +6 -6
- package/dist/{chunk-6TB7JN63.js → chunk-37IQ6DGU.js} +3 -3
- package/dist/{chunk-MR36BRPE.js → chunk-3HJ4F4L7.js} +4 -4
- package/dist/{chunk-4WYHL4EH.js → chunk-3L7CWDQQ.js} +1 -1
- package/dist/{chunk-CJRUBOJI.js → chunk-4WGFWHWP.js} +1 -1
- package/dist/{chunk-VHSBLFNT.js → chunk-56XONJPF.js} +1 -1
- package/dist/{chunk-ULM7P4EQ.js → chunk-6UXDTPEN.js} +233 -173
- package/dist/{chunk-WDNA4LML.js → chunk-AHMWPFIW.js} +188 -11
- package/dist/{chunk-YCW6RZGX.js → chunk-AX3UDIMA.js} +3 -3
- package/dist/{chunk-HG6HNOTQ.js → chunk-AYW7J6K4.js} +130 -200
- package/dist/{chunk-DXK3VTVP.js → chunk-E3OBGRHN.js} +1 -1
- package/dist/{chunk-7UF37LNL.js → chunk-EENQGEIP.js} +1 -1
- package/dist/{chunk-HRTW7FFX.js → chunk-FJMTMGBC.js} +1 -1
- package/dist/{chunk-H6MPFFBE.js → chunk-G2B2XZQW.js} +1 -1
- package/dist/{chunk-4GOZBB22.js → chunk-HUK5XIZL.js} +63 -7
- package/dist/{chunk-DINF4LMR.js → chunk-IO6KFXYE.js} +160 -97
- package/dist/{chunk-KH2SL2HT.js → chunk-KTXOGLNE.js} +2 -2
- package/dist/{chunk-S63LNPIV.js → chunk-LMNMMESF.js} +2 -2
- package/dist/{chunk-2CZ63QCL.js → chunk-LZBPGX5A.js} +1 -1
- package/dist/{chunk-PJ7EGFME.js → chunk-PLZT45VC.js} +5 -5
- package/dist/{chunk-ZQQWJMHE.js → chunk-QI5JW5AG.js} +6 -6
- package/dist/{chunk-IWRPJ3J5.js → chunk-QZV76CM4.js} +58 -32
- package/dist/{chunk-YFJDRORU.js → chunk-R767Y7QV.js} +202 -90
- package/dist/{chunk-4OSVTPYQ.js → chunk-SQHFVIMZ.js} +1 -1
- package/dist/{chunk-J4ID4ZI6.js → chunk-T5MTGX2E.js} +19 -19
- package/dist/{chunk-NRF23QZ4.js → chunk-V64JCZUV.js} +3 -3
- package/dist/{chunk-GITIZ6TZ.js → chunk-VOV3SCM3.js} +1 -1
- package/dist/{chunk-S5X2VQOD.js → chunk-W46NIB5H.js} +3 -2
- package/dist/{chunk-XL3C4NAR.js → chunk-W5JMPEBO.js} +9 -9
- package/dist/{chunk-HPFHC7YR.js → chunk-WOKJRLM2.js} +5 -5
- package/dist/chunk-WVIA7V3M.js +975 -0
- package/dist/{chunk-QA6RE6IB.js → chunk-X52ESOBP.js} +3 -3
- package/dist/cli/chat.js +35 -37
- package/dist/cli/check.js +5 -5
- package/dist/cli/plugins.js +12 -12
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +6 -6
- package/dist/db/schema/code.d.ts +367 -0
- package/dist/db/schema.d.ts +367 -1
- package/dist/{db-4PXTD3OH.js → db-K2VMNLHQ.js} +6 -6
- package/dist/{experimental-SIJSRDJD.js → experimental-P5FZM4CU.js} +1 -1
- package/dist/instrumentation.js +3 -3
- package/dist/nitro.js +6 -6
- package/dist/{oauth-callback-server-TQWNEVR6.js → oauth-callback-server-DZZMTKSS.js} +26 -26
- package/dist/{runner-G5HLQA43.js → runner-IIAKWDXI.js} +18 -18
- package/dist/{skills-BNNNRYNT.js → skills-EXIQ7BP5.js} +5 -5
- package/dist/spawn-ZR6OOEAN.js +37 -0
- package/dist/task-runner-C52HYCVD.js +32 -0
- package/dist/{validation-IJSBB6JR.js → validation-XUGIWBJF.js} +5 -5
- package/dist/version.js +1 -1
- package/dist/{work-5FQI4P2A.js → work-G4RLJ634.js} +18 -18
- package/dist/worker-R2JEHK67.js +22 -0
- package/migrations/0036_complex_rage.sql +32 -0
- package/migrations/meta/0036_snapshot.json +3186 -0
- package/migrations/meta/_journal.json +8 -1
- package/package.json +6 -5
- package/dist/api/acp/route.d.ts +0 -13
- package/dist/chunk-CZYNWPWD.js +0 -930
- package/dist/spawn-U2RKOFP2.js +0 -37
- package/dist/task-runner-CDZJBEXP.js +0 -32
- package/dist/worker-KJ362GVB.js +0 -22
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
ToolInputError,
|
|
3
3
|
canRouteResourceEvents,
|
|
4
4
|
getPlugins
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-AHMWPFIW.js";
|
|
6
6
|
import {
|
|
7
7
|
getDb
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AX3UDIMA.js";
|
|
9
9
|
import {
|
|
10
10
|
juniorAttachments,
|
|
11
11
|
juniorConversations,
|
|
@@ -13,118 +13,54 @@ import {
|
|
|
13
13
|
juniorSchedulerRuns,
|
|
14
14
|
juniorSchedulerTasks,
|
|
15
15
|
juniorStats
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-6UXDTPEN.js";
|
|
17
17
|
import {
|
|
18
18
|
juniorDestinations
|
|
19
19
|
} from "./chunk-VFUK3X5B.js";
|
|
20
20
|
import {
|
|
21
21
|
getSlackBotToken
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-LMNMMESF.js";
|
|
23
23
|
import {
|
|
24
24
|
logWarn
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-LZBPGX5A.js";
|
|
26
26
|
|
|
27
|
-
// src/chat/
|
|
27
|
+
// src/chat/event-tasks/store.ts
|
|
28
28
|
import {
|
|
29
|
-
|
|
29
|
+
resourceEventMatches
|
|
30
30
|
} from "@sentry/junior-plugin-api";
|
|
31
|
-
import { z } from "zod";
|
|
32
|
-
function enumSchema(values, unavailableMessage) {
|
|
33
|
-
if (values.length === 0) {
|
|
34
|
-
return z.string().refine(() => false, unavailableMessage);
|
|
35
|
-
}
|
|
36
|
-
return z.enum(values);
|
|
37
|
-
}
|
|
38
|
-
function eventNamespaceSchema(catalog) {
|
|
39
|
-
return enumSchema(
|
|
40
|
-
Object.keys(catalog).sort(),
|
|
41
|
-
"No resource event namespaces are enabled."
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
function registeredEventTypeSchema(catalog) {
|
|
45
|
-
return enumSchema(
|
|
46
|
-
[
|
|
47
|
-
...new Set(
|
|
48
|
-
Object.values(catalog).flatMap(
|
|
49
|
-
(registration) => registration.resourceTypes.flatMap(
|
|
50
|
-
(resourceType) => resourceType.supportedEvents
|
|
51
|
-
)
|
|
52
|
-
)
|
|
53
|
-
)
|
|
54
|
-
].sort(),
|
|
55
|
-
"No resource event types are enabled."
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
function registeredResourceTypeSchema(catalog) {
|
|
59
|
-
return enumSchema(
|
|
60
|
-
[
|
|
61
|
-
...new Set(
|
|
62
|
-
Object.values(catalog).flatMap(
|
|
63
|
-
(registration) => registration.resourceTypes.map((resourceType) => resourceType.type)
|
|
64
|
-
)
|
|
65
|
-
)
|
|
66
|
-
].sort(),
|
|
67
|
-
"No resource types are enabled."
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
function pluginSupportsEvent(catalog, namespace, resourceType, eventType) {
|
|
71
|
-
return catalog[namespace]?.resourceTypes.find((candidate) => candidate.type === resourceType)?.supportedEvents.includes(eventType) ?? false;
|
|
72
|
-
}
|
|
73
|
-
function resourceEventGuidance(catalog, namespace, resourceType, eventType) {
|
|
74
|
-
return catalog[namespace]?.resourceTypes.find(
|
|
75
|
-
(candidate) => candidate.type === resourceType
|
|
76
|
-
)?.guidance?.[eventType];
|
|
77
|
-
}
|
|
78
|
-
function normalizeEventIdentifier(catalog, namespace, identifier) {
|
|
79
|
-
return normalizeResourceEventIdentifier(catalog[namespace], identifier);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// src/chat/resource-events/runtime-catalog.ts
|
|
83
|
-
function getResourceEventCatalog() {
|
|
84
|
-
if (!canRouteResourceEvents()) return {};
|
|
85
|
-
return Object.fromEntries(
|
|
86
|
-
getPlugins().flatMap((plugin) => {
|
|
87
|
-
const registration = plugin.resourceEvents;
|
|
88
|
-
if (!registration || registration.isEnabled?.() === false) {
|
|
89
|
-
return [];
|
|
90
|
-
}
|
|
91
|
-
return [[plugin.manifest.name, registration]];
|
|
92
|
-
})
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// src/chat/event-tasks/store.ts
|
|
97
31
|
import { and, asc, desc, eq, inArray, or, sql } from "drizzle-orm";
|
|
98
32
|
|
|
99
33
|
// src/chat/event-tasks/types.ts
|
|
100
34
|
import {
|
|
101
35
|
actorUserIdSchema,
|
|
102
36
|
destinationVisibilitySchema,
|
|
37
|
+
resourceEventMatchSchema,
|
|
103
38
|
resourceEventTypeSchema,
|
|
104
39
|
slackDestinationSchema
|
|
105
40
|
} from "@sentry/junior-plugin-api";
|
|
106
|
-
import { z
|
|
41
|
+
import { z } from "zod";
|
|
107
42
|
var EVENT_TASK_IDENTIFIER_MAX_LENGTH = 300;
|
|
108
|
-
var eventTaskPrincipalSchema =
|
|
43
|
+
var eventTaskPrincipalSchema = z.object({
|
|
109
44
|
slackUserId: actorUserIdSchema,
|
|
110
|
-
fullName:
|
|
111
|
-
userName:
|
|
45
|
+
fullName: z.string().optional(),
|
|
46
|
+
userName: z.string().optional()
|
|
112
47
|
}).strict();
|
|
113
|
-
var eventTaskTriggerSchema =
|
|
114
|
-
events:
|
|
115
|
-
label:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
48
|
+
var eventTaskTriggerSchema = z.object({
|
|
49
|
+
events: z.array(resourceEventTypeSchema).min(1),
|
|
50
|
+
label: z.string().min(1),
|
|
51
|
+
match: resourceEventMatchSchema.optional(),
|
|
52
|
+
namespace: z.string().min(1),
|
|
53
|
+
identifier: z.string().min(1).max(EVENT_TASK_IDENTIFIER_MAX_LENGTH),
|
|
54
|
+
resourceType: z.string().min(1)
|
|
119
55
|
}).strict();
|
|
120
|
-
var eventTaskSchema =
|
|
121
|
-
id:
|
|
122
|
-
createdAtMs:
|
|
56
|
+
var eventTaskSchema = z.object({
|
|
57
|
+
id: z.string().min(1),
|
|
58
|
+
createdAtMs: z.number().finite(),
|
|
123
59
|
createdBy: eventTaskPrincipalSchema,
|
|
124
|
-
credentialMode:
|
|
60
|
+
credentialMode: z.enum(["system", "creator"]),
|
|
125
61
|
destination: slackDestinationSchema,
|
|
126
62
|
destinationVisibility: destinationVisibilitySchema,
|
|
127
|
-
task:
|
|
63
|
+
task: z.object({ text: z.string().min(1) }).strict(),
|
|
128
64
|
trigger: eventTaskTriggerSchema
|
|
129
65
|
}).strict();
|
|
130
66
|
|
|
@@ -220,6 +156,33 @@ async function listPublicEventTasksForTeams(db, teamIds, limit) {
|
|
|
220
156
|
).orderBy(desc(juniorEventTasks.createdAtMs), desc(juniorEventTasks.id)).limit(limit);
|
|
221
157
|
return rows.map(parseTask);
|
|
222
158
|
}
|
|
159
|
+
async function collectEventTaskMatchKeys(db, input) {
|
|
160
|
+
const eventTypes = new Set(
|
|
161
|
+
input.eventTypes.map((eventType) => eventType.trim()).filter(Boolean)
|
|
162
|
+
);
|
|
163
|
+
const identifiers = [
|
|
164
|
+
...new Set(input.identifiers.map((value) => value.trim()).filter(Boolean))
|
|
165
|
+
];
|
|
166
|
+
if (eventTypes.size === 0 || identifiers.length === 0) return [];
|
|
167
|
+
const rows = await db.select({ task: juniorEventTasks.task, title: juniorEventTasks.title }).from(juniorEventTasks).where(
|
|
168
|
+
and(
|
|
169
|
+
eq(juniorEventTasks.teamId, input.teamId),
|
|
170
|
+
eq(juniorEventTasks.namespace, input.namespace),
|
|
171
|
+
inArray(juniorEventTasks.identifier, identifiers)
|
|
172
|
+
)
|
|
173
|
+
).orderBy(asc(juniorEventTasks.createdAtMs), asc(juniorEventTasks.id));
|
|
174
|
+
const keys = /* @__PURE__ */ new Set();
|
|
175
|
+
for (const row of rows) {
|
|
176
|
+
const task = parseTask(row);
|
|
177
|
+
if (!task.trigger.events.some((eventType) => eventTypes.has(eventType))) {
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
for (const key of Object.keys(task.trigger.match ?? {})) {
|
|
181
|
+
keys.add(key);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return [...keys].sort();
|
|
185
|
+
}
|
|
223
186
|
async function findMatchingEventTasks(db, event, teamId) {
|
|
224
187
|
const rows = await db.select({ task: juniorEventTasks.task, title: juniorEventTasks.title }).from(juniorEventTasks).where(
|
|
225
188
|
and(
|
|
@@ -228,7 +191,145 @@ async function findMatchingEventTasks(db, event, teamId) {
|
|
|
228
191
|
eq(juniorEventTasks.identifier, event.identifier)
|
|
229
192
|
)
|
|
230
193
|
).orderBy(asc(juniorEventTasks.createdAtMs), asc(juniorEventTasks.id));
|
|
231
|
-
return rows.map(parseTask).filter(
|
|
194
|
+
return rows.map(parseTask).filter(
|
|
195
|
+
(task) => task.trigger.events.includes(event.eventType) && resourceEventMatches(task.trigger.match, event.data)
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// src/chat/resource-events/catalog.ts
|
|
200
|
+
import {
|
|
201
|
+
normalizeResourceEventIdentifier,
|
|
202
|
+
resourceEventMatchSchema as resourceEventMatchSchema2
|
|
203
|
+
} from "@sentry/junior-plugin-api";
|
|
204
|
+
import { z as z2 } from "zod";
|
|
205
|
+
function enumSchema(values, unavailableMessage) {
|
|
206
|
+
if (values.length === 0) {
|
|
207
|
+
return z2.string().refine(() => false, unavailableMessage);
|
|
208
|
+
}
|
|
209
|
+
return z2.enum(values);
|
|
210
|
+
}
|
|
211
|
+
function eventNamespaceSchema(catalog) {
|
|
212
|
+
return enumSchema(
|
|
213
|
+
Object.keys(catalog).sort(),
|
|
214
|
+
"No resource event namespaces are enabled."
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
function registeredEventTypeSchema(catalog) {
|
|
218
|
+
return enumSchema(
|
|
219
|
+
[
|
|
220
|
+
...new Set(
|
|
221
|
+
Object.values(catalog).flatMap(
|
|
222
|
+
(registration) => registration.resourceTypes.flatMap(
|
|
223
|
+
(resourceType) => resourceType.supportedEvents
|
|
224
|
+
)
|
|
225
|
+
)
|
|
226
|
+
)
|
|
227
|
+
].sort(),
|
|
228
|
+
"No resource event types are enabled."
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
function registeredResourceTypeSchema(catalog) {
|
|
232
|
+
return enumSchema(
|
|
233
|
+
[
|
|
234
|
+
...new Set(
|
|
235
|
+
Object.values(catalog).flatMap(
|
|
236
|
+
(registration) => registration.resourceTypes.map((resourceType) => resourceType.type)
|
|
237
|
+
)
|
|
238
|
+
)
|
|
239
|
+
].sort(),
|
|
240
|
+
"No resource types are enabled."
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
function pluginSupportsEvent(catalog, namespace, resourceType, eventType) {
|
|
244
|
+
return catalog[namespace]?.resourceTypes.find((candidate) => candidate.type === resourceType)?.supportedEvents.includes(eventType) ?? false;
|
|
245
|
+
}
|
|
246
|
+
function resourceEventGuidance(catalog, namespace, resourceType, eventType) {
|
|
247
|
+
return catalog[namespace]?.resourceTypes.find(
|
|
248
|
+
(candidate) => candidate.type === resourceType
|
|
249
|
+
)?.guidance?.[eventType];
|
|
250
|
+
}
|
|
251
|
+
function resourceEventMatchFields(catalog, namespace, resourceType) {
|
|
252
|
+
return catalog[namespace]?.resourceTypes.find(
|
|
253
|
+
(candidate) => candidate.type === resourceType
|
|
254
|
+
)?.matchFields;
|
|
255
|
+
}
|
|
256
|
+
function registeredResourceEventMatchSchema() {
|
|
257
|
+
return resourceEventMatchSchema2.optional().describe(
|
|
258
|
+
"Optional exact values from the resource type matchFields. A single value must equal the event data. A list means the event value may be any one entry. Omit a key to ignore it. Unmatched events are dropped with no agent turn."
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
function requireSupportedResourceEventMatch(catalog, input) {
|
|
262
|
+
const match = input.match;
|
|
263
|
+
if (!match || Object.keys(match).length === 0) return void 0;
|
|
264
|
+
const fields = resourceEventMatchFields(
|
|
265
|
+
catalog,
|
|
266
|
+
input.namespace,
|
|
267
|
+
input.resourceType
|
|
268
|
+
);
|
|
269
|
+
if (!fields || Object.keys(fields).length === 0) {
|
|
270
|
+
throw new ToolInputError(
|
|
271
|
+
`Resource type "${input.namespace}:${input.resourceType}" does not support match.`
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
const normalized = {};
|
|
275
|
+
for (const [key, value] of Object.entries(match)) {
|
|
276
|
+
const field = fields[key];
|
|
277
|
+
if (!field) {
|
|
278
|
+
throw new ToolInputError(
|
|
279
|
+
`Resource type "${input.namespace}:${input.resourceType}" does not support match key "${key}".`
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
if (Array.isArray(value)) {
|
|
283
|
+
if (field.kind === "boolean") {
|
|
284
|
+
throw new ToolInputError(
|
|
285
|
+
`Match key "${key}" is boolean and cannot use a list.`
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
for (const entry of value) {
|
|
289
|
+
if (typeof entry !== field.kind) {
|
|
290
|
+
throw new ToolInputError(
|
|
291
|
+
`Match key "${key}" expects ${field.kind} values.`
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
if (field.enum && typeof entry === "string" && !field.enum.includes(entry)) {
|
|
295
|
+
throw new ToolInputError(
|
|
296
|
+
`Match key "${key}" does not allow value "${entry}".`
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
normalized[key] = [...new Set(value)];
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
if (typeof value !== field.kind) {
|
|
304
|
+
throw new ToolInputError(
|
|
305
|
+
`Match key "${key}" expects a ${field.kind} value.`
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
if (field.enum && typeof value === "string" && !field.enum.includes(value)) {
|
|
309
|
+
throw new ToolInputError(
|
|
310
|
+
`Match key "${key}" does not allow value "${value}".`
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
normalized[key] = value;
|
|
314
|
+
}
|
|
315
|
+
return Object.keys(normalized).length > 0 ? normalized : void 0;
|
|
316
|
+
}
|
|
317
|
+
function normalizeEventIdentifier(catalog, namespace, identifier) {
|
|
318
|
+
return normalizeResourceEventIdentifier(catalog[namespace], identifier);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// src/chat/resource-events/runtime-catalog.ts
|
|
322
|
+
function getResourceEventCatalog() {
|
|
323
|
+
if (!canRouteResourceEvents()) return {};
|
|
324
|
+
return Object.fromEntries(
|
|
325
|
+
getPlugins().flatMap((plugin) => {
|
|
326
|
+
const registration = plugin.resourceEvents;
|
|
327
|
+
if (!registration || registration.isEnabled?.() === false) {
|
|
328
|
+
return [];
|
|
329
|
+
}
|
|
330
|
+
return [[plugin.manifest.name, registration]];
|
|
331
|
+
})
|
|
332
|
+
);
|
|
232
333
|
}
|
|
233
334
|
|
|
234
335
|
// src/stats.ts
|
|
@@ -407,6 +508,7 @@ var compactEventTaskResultSchema = z5.object({
|
|
|
407
508
|
resourceType: z5.string().min(1),
|
|
408
509
|
label: z5.string().min(1),
|
|
409
510
|
events: z5.array(z5.string().min(1)).min(1),
|
|
511
|
+
match: z5.record(z5.string(), z5.unknown()).optional(),
|
|
410
512
|
credentialMode: z5.enum(["system", "creator"]),
|
|
411
513
|
createdBy: eventTaskPrincipalSchema,
|
|
412
514
|
triggerAvailable: z5.boolean()
|
|
@@ -424,7 +526,8 @@ function registeredEventTaskTriggerSchema(catalog) {
|
|
|
424
526
|
identifier: z5.string().trim().min(1).max(EVENT_TASK_IDENTIFIER_MAX_LENGTH),
|
|
425
527
|
resourceType: registeredResourceTypeSchema(catalog),
|
|
426
528
|
label: z5.string().trim().min(1).max(500),
|
|
427
|
-
events: z5.array(registeredEventTypeSchema(catalog)).min(1)
|
|
529
|
+
events: z5.array(registeredEventTypeSchema(catalog)).min(1),
|
|
530
|
+
match: registeredResourceEventMatchSchema()
|
|
428
531
|
}).strict();
|
|
429
532
|
}
|
|
430
533
|
function requireSupportedEventTaskTrigger(catalog, trigger) {
|
|
@@ -440,6 +543,11 @@ function requireSupportedEventTaskTrigger(catalog, trigger) {
|
|
|
440
543
|
);
|
|
441
544
|
}
|
|
442
545
|
}
|
|
546
|
+
return requireSupportedResourceEventMatch(catalog, {
|
|
547
|
+
match: trigger.match,
|
|
548
|
+
namespace: trigger.namespace,
|
|
549
|
+
resourceType: trigger.resourceType
|
|
550
|
+
});
|
|
443
551
|
}
|
|
444
552
|
function requireEventTaskSlackContext(context) {
|
|
445
553
|
if (context.source.platform !== "slack" || context.destination.platform !== "slack" || context.actor?.platform !== "slack" || context.actor.teamId !== context.source.teamId) {
|
|
@@ -489,6 +597,7 @@ function compactEventTask(task, catalog) {
|
|
|
489
597
|
resourceType: task.trigger.resourceType,
|
|
490
598
|
label: task.trigger.label,
|
|
491
599
|
events: task.trigger.events,
|
|
600
|
+
...task.trigger.match ? { match: task.trigger.match } : void 0,
|
|
492
601
|
credentialMode: task.credentialMode,
|
|
493
602
|
createdBy: task.createdBy,
|
|
494
603
|
triggerAvailable: eventTaskTriggerAvailable(task, catalog)
|
|
@@ -1138,6 +1247,8 @@ export {
|
|
|
1138
1247
|
registeredResourceTypeSchema,
|
|
1139
1248
|
pluginSupportsEvent,
|
|
1140
1249
|
resourceEventGuidance,
|
|
1250
|
+
registeredResourceEventMatchSchema,
|
|
1251
|
+
requireSupportedResourceEventMatch,
|
|
1141
1252
|
normalizeEventIdentifier,
|
|
1142
1253
|
getResourceEventCatalog,
|
|
1143
1254
|
getEventTask,
|
|
@@ -1148,6 +1259,7 @@ export {
|
|
|
1148
1259
|
eventTaskBelongsToUser,
|
|
1149
1260
|
listEventTasksCreatedBy,
|
|
1150
1261
|
listPublicEventTasksForTeams,
|
|
1262
|
+
collectEventTaskMatchKeys,
|
|
1151
1263
|
findMatchingEventTasks,
|
|
1152
1264
|
eventTaskToolResultSchema,
|
|
1153
1265
|
eventTaskListToolResultSchema,
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
buildSentryConversationUrl,
|
|
6
6
|
deleteWebAuthorization
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-4WGFWHWP.js";
|
|
8
8
|
import {
|
|
9
9
|
buildDeliveredTurnStatePatch,
|
|
10
10
|
finalizeFailedTurnReplyWithEvent,
|
|
@@ -15,11 +15,11 @@ import {
|
|
|
15
15
|
getTurnUserSlackMessageTs,
|
|
16
16
|
persistAuthPauseTurnState,
|
|
17
17
|
requireTurnFailureEventId
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-WOKJRLM2.js";
|
|
19
19
|
import {
|
|
20
20
|
resolveTurnSessionRouting,
|
|
21
21
|
scheduleSessionCompletedPluginTasks
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-W5JMPEBO.js";
|
|
23
23
|
import {
|
|
24
24
|
ConversationTurnLifecycleService
|
|
25
25
|
} from "./chunk-M3QYTBQ6.js";
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
getPersistedSandboxState,
|
|
31
31
|
getPersistedThreadState,
|
|
32
32
|
persistThreadStateById
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-PLZT45VC.js";
|
|
34
34
|
import {
|
|
35
35
|
createUserTokenStore,
|
|
36
36
|
deleteMcpAuthSession,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
lookupSlackUserProfile,
|
|
42
42
|
resolvePluginOAuthAccount,
|
|
43
43
|
runAgentWithTimeout
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-2EPYYVJC.js";
|
|
45
45
|
import {
|
|
46
46
|
RetryableDeliveryError
|
|
47
47
|
} from "./chunk-RF6J3DIO.js";
|
|
@@ -57,17 +57,17 @@ import {
|
|
|
57
57
|
removeReactionFromMessage,
|
|
58
58
|
resolveBaseUrl,
|
|
59
59
|
truncateStatusText
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-QI5JW5AG.js";
|
|
61
61
|
import {
|
|
62
62
|
parseSlackThreadId,
|
|
63
63
|
readSlackRawMessageContext,
|
|
64
64
|
resolveSlackChannelIdFromMessage,
|
|
65
65
|
resolveSlackChannelIdFromThreadId
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-SQHFVIMZ.js";
|
|
67
67
|
import {
|
|
68
68
|
ensureConversationWake,
|
|
69
69
|
requestConversationWork
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-HUK5XIZL.js";
|
|
71
71
|
import {
|
|
72
72
|
CooperativeTurnYieldError,
|
|
73
73
|
clearPendingAuth,
|
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
isCooperativeTurnYieldError,
|
|
77
77
|
isPendingAuthLatestRequest,
|
|
78
78
|
markTurnFailed
|
|
79
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-56XONJPF.js";
|
|
80
80
|
import {
|
|
81
81
|
TurnSliceLimitExceededError,
|
|
82
82
|
abandonTurnRecord,
|
|
@@ -96,13 +96,13 @@ import {
|
|
|
96
96
|
recordTurnSummary,
|
|
97
97
|
saveTurnCheckpoint,
|
|
98
98
|
turnHasReply
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-24OJZ5OU.js";
|
|
100
100
|
import {
|
|
101
101
|
getVercelConversationWorkQueue
|
|
102
102
|
} from "./chunk-DKIJ2RP5.js";
|
|
103
103
|
import {
|
|
104
104
|
getTurnRequestDeadline
|
|
105
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-FJMTMGBC.js";
|
|
106
106
|
import {
|
|
107
107
|
SlackActionError,
|
|
108
108
|
getDashboardConversationLink,
|
|
@@ -111,18 +111,18 @@ import {
|
|
|
111
111
|
getSlackClient,
|
|
112
112
|
isDmChannel,
|
|
113
113
|
normalizeSlackConversationId
|
|
114
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-AHMWPFIW.js";
|
|
115
115
|
import {
|
|
116
116
|
getConversationEventStore,
|
|
117
117
|
getSqlExecutor,
|
|
118
118
|
requireSlackDestination,
|
|
119
119
|
upsertIdentity,
|
|
120
120
|
upsertLinkedIdentity
|
|
121
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-AX3UDIMA.js";
|
|
122
122
|
import {
|
|
123
123
|
acquireActiveLock,
|
|
124
124
|
getStateAdapter
|
|
125
|
-
} from "./chunk-
|
|
125
|
+
} from "./chunk-G2B2XZQW.js";
|
|
126
126
|
import {
|
|
127
127
|
botConfig,
|
|
128
128
|
defaultModelId,
|
|
@@ -130,18 +130,18 @@ import {
|
|
|
130
130
|
getChatConfig,
|
|
131
131
|
getRuntimeMetadata,
|
|
132
132
|
normalizeSlackEmojiName
|
|
133
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-LMNMMESF.js";
|
|
134
134
|
import {
|
|
135
135
|
discoverSkills
|
|
136
|
-
} from "./chunk-
|
|
136
|
+
} from "./chunk-KTXOGLNE.js";
|
|
137
137
|
import {
|
|
138
138
|
pluginCatalogRuntime
|
|
139
|
-
} from "./chunk-
|
|
139
|
+
} from "./chunk-E3OBGRHN.js";
|
|
140
140
|
import {
|
|
141
141
|
buildOAuthTokenRequest,
|
|
142
142
|
hasRequiredOAuthScope,
|
|
143
143
|
parseOAuthTokenResponse
|
|
144
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-EENQGEIP.js";
|
|
145
145
|
import {
|
|
146
146
|
createSlackResumeActor,
|
|
147
147
|
isUserActor,
|
|
@@ -160,7 +160,7 @@ import {
|
|
|
160
160
|
setTags,
|
|
161
161
|
toOptionalString,
|
|
162
162
|
withLogContext
|
|
163
|
-
} from "./chunk-
|
|
163
|
+
} from "./chunk-LZBPGX5A.js";
|
|
164
164
|
|
|
165
165
|
// src/chat/slack/assistant-thread/status-render.ts
|
|
166
166
|
var DEFAULT_STATUS_CONTEXTS = {
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from "./chunk-7H2VZTWN.js";
|
|
7
7
|
import {
|
|
8
8
|
runWithTurnRequestDeadline
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FJMTMGBC.js";
|
|
10
10
|
import {
|
|
11
11
|
logWarn
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-LZBPGX5A.js";
|
|
13
13
|
|
|
14
14
|
// src/chat/plugins/task-queue.ts
|
|
15
15
|
import { createHash } from "crypto";
|
|
@@ -129,7 +129,7 @@ function pluginTaskCallback() {
|
|
|
129
129
|
onRejected: logPluginTaskQueueMessageRejected,
|
|
130
130
|
// Load the runner on first use so this module can send without a cycle.
|
|
131
131
|
run: async (message) => {
|
|
132
|
-
const { processPluginTask } = await import("./task-runner-
|
|
132
|
+
const { processPluginTask } = await import("./task-runner-C52HYCVD.js");
|
|
133
133
|
await processPluginTask(message);
|
|
134
134
|
},
|
|
135
135
|
topic: PLUGIN_TASK_QUEUE_TOPIC,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "@sentry/junior",
|
|
4
|
-
version: "0.
|
|
4
|
+
version: "0.183.0",
|
|
5
5
|
private: false,
|
|
6
6
|
publishConfig: {
|
|
7
7
|
access: "public"
|
|
@@ -69,7 +69,6 @@ var package_default = {
|
|
|
69
69
|
"test:coverage": "vitest run --maxWorkers=4 --coverage --reporter=default --reporter=junit --outputFile.junit=coverage/results.junit.xml"
|
|
70
70
|
},
|
|
71
71
|
dependencies: {
|
|
72
|
-
"@agentclientprotocol/sdk": "1.3.0",
|
|
73
72
|
"@ai-sdk/gateway": "^3.0.119",
|
|
74
73
|
"@chat-adapter/slack": "4.29.0",
|
|
75
74
|
"@chat-adapter/state-memory": "4.29.0",
|
|
@@ -105,11 +104,13 @@ var package_default = {
|
|
|
105
104
|
zod: "catalog:"
|
|
106
105
|
},
|
|
107
106
|
devDependencies: {
|
|
107
|
+
"@agentclientprotocol/sdk": "1.3.0",
|
|
108
108
|
"@emnapi/core": "^1.10.0",
|
|
109
109
|
"@emnapi/runtime": "^1.10.0",
|
|
110
110
|
"@hono/node-server": "1.19.14",
|
|
111
111
|
"@oxlint/plugins": "1.79.0",
|
|
112
112
|
"@sentry/junior-github": "workspace:*",
|
|
113
|
+
"@sentry/junior-acp": "workspace:*",
|
|
113
114
|
"@sentry/junior-memory": "workspace:*",
|
|
114
115
|
"@sentry/junior-testing": "workspace:*",
|
|
115
116
|
"@types/node": "^25.9.1",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
coerceThreadConversationState,
|
|
3
3
|
getPersistedThreadState
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PLZT45VC.js";
|
|
5
5
|
import {
|
|
6
6
|
pluginTaskId,
|
|
7
7
|
pluginTaskParamsSchema,
|
|
8
8
|
sendVercelPluginTask
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-V64JCZUV.js";
|
|
10
10
|
import {
|
|
11
11
|
getPiMessageRole,
|
|
12
12
|
getTurnRecord,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
isToolResultMessage,
|
|
17
17
|
normalizeToolNameFromResult,
|
|
18
18
|
stripRuntimeTurnContext
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-24OJZ5OU.js";
|
|
20
20
|
import {
|
|
21
21
|
createPluginConversationEvents,
|
|
22
22
|
createPluginEmbedder,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
createPluginState,
|
|
26
26
|
getPlugins,
|
|
27
27
|
readActorIdentity
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-AHMWPFIW.js";
|
|
29
29
|
import {
|
|
30
30
|
JUNIOR_THREAD_STATE_TTL_MS
|
|
31
31
|
} from "./chunk-3Y47VMHV.js";
|
|
@@ -33,14 +33,14 @@ import {
|
|
|
33
33
|
getConversationStore,
|
|
34
34
|
getDb,
|
|
35
35
|
sameActorIdentity
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-AX3UDIMA.js";
|
|
37
37
|
import {
|
|
38
38
|
juniorConversations,
|
|
39
39
|
juniorTaskExecutions
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-6UXDTPEN.js";
|
|
41
41
|
import {
|
|
42
42
|
getStateAdapter
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-G2B2XZQW.js";
|
|
44
44
|
import {
|
|
45
45
|
credentialSubjectSchema
|
|
46
46
|
} from "./chunk-CEMMLV5L.js";
|
|
@@ -49,14 +49,14 @@ import {
|
|
|
49
49
|
} from "./chunk-N7TMSOZH.js";
|
|
50
50
|
import {
|
|
51
51
|
logWarn
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-LZBPGX5A.js";
|
|
53
53
|
|
|
54
54
|
// src/chat/plugins/task-runner.ts
|
|
55
55
|
import { pluginRunContextSchema } from "@sentry/junior-plugin-api";
|
|
56
56
|
|
|
57
57
|
// src/chat/services/turn-session-routing.ts
|
|
58
58
|
async function resolveTurnSessionRouting(args) {
|
|
59
|
-
const conversationStore = args.conversationStore ?? (await import("./db-
|
|
59
|
+
const conversationStore = args.conversationStore ?? (await import("./db-K2VMNLHQ.js")).getConversationStore();
|
|
60
60
|
const conversation = await conversationStore.get({
|
|
61
61
|
conversationId: args.conversationId
|
|
62
62
|
});
|