@sentry/junior 0.117.0 → 0.119.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-5IK4LPLP.js → agent-hooks-NZSV4QQR.js} +9 -11
- package/dist/api/conversations/detail.d.ts +17 -0
- package/dist/api/conversations/event-list.d.ts +17 -0
- package/dist/api/schema/conversation.d.ts +68 -0
- package/dist/api/schema/stats.d.ts +22 -0
- package/dist/api/schema.d.ts +2 -0
- package/dist/api/schema.js +7 -3
- package/dist/api/stats.d.ts +16 -0
- package/dist/api/user-pages/routes.d.ts +4 -0
- package/dist/api.js +223 -20
- package/dist/app.js +43 -38
- package/dist/{catalog-runtime-MTUYW3AA.js → catalog-runtime-TAOYIZIZ.js} +5 -5
- package/dist/chat/agent/prompt.d.ts +4 -2
- package/dist/chat/plugins/user-pages.d.ts +15 -0
- package/dist/chat/plugins/viewer-actors.d.ts +6 -0
- package/dist/chat/prompt.d.ts +1 -2
- package/dist/chat/sandbox/paths.d.ts +2 -0
- package/dist/chat/sandbox/sandbox.d.ts +3 -1
- package/dist/chat/sandbox/workspace.d.ts +1 -0
- package/dist/chat/skills.d.ts +1 -2
- package/dist/chat/slack/tools/canvas/api.d.ts +2 -9
- package/dist/chat/slack/tools/canvas/markdown.d.ts +9 -0
- package/dist/chat/tools/index.d.ts +4 -1
- package/dist/chat/tools/sandbox/file-utils.d.ts +11 -0
- package/dist/chat/tools/sandbox/find-files.d.ts +2 -1
- package/dist/chat/tools/sandbox/grep.d.ts +2 -1
- package/dist/{chunk-6G45D3YG.js → chunk-4UIUDOOV.js} +16 -233
- package/dist/{chunk-LUMEBOWC.js → chunk-6ZR455DC.js} +2 -2
- package/dist/{chunk-STUI6NIL.js → chunk-BLQZACHV.js} +511 -14
- package/dist/{chunk-27KWTFP6.js → chunk-BNJEPYTC.js} +5 -14
- package/dist/{chunk-ZRQUQJUV.js → chunk-D3N4BPSL.js} +3 -3
- package/dist/{chunk-WKU7TY22.js → chunk-FIANEE7Z.js} +3 -1
- package/dist/{chunk-RXRQJF7Y.js → chunk-GCGJGSQL.js} +21 -0
- package/dist/{chunk-FAWBONPC.js → chunk-GKFDU3ZI.js} +5 -7
- package/dist/{chunk-FXOYURO4.js → chunk-HDFGNU5E.js} +1 -0
- package/dist/{chunk-3GE3F4LT.js → chunk-JLJLZS2N.js} +1 -1
- package/dist/{chunk-CU7HTGNI.js → chunk-JSTGI7TX.js} +1 -1
- package/dist/chunk-JXRAOOXQ.js +37 -0
- package/dist/{chunk-WUNPRM76.js → chunk-NUENIPQL.js} +1 -1
- package/dist/{chunk-BFIRIZPH.js → chunk-O2ULQJWR.js} +101 -2
- package/dist/{chunk-AKG4TZNH.js → chunk-QZ7XRJDB.js} +30 -9
- package/dist/{chunk-5O3JDQDG.js → chunk-R53UT2OI.js} +1 -1
- package/dist/{chunk-W5JEQQEA.js → chunk-TAGV4Z3J.js} +1 -1
- package/dist/{chunk-NHZEUHKH.js → chunk-TGIQN7QW.js} +388 -113
- package/dist/{chunk-KU6ALEJC.js → chunk-VJTWKJWQ.js} +30 -2
- package/dist/{chunk-DS27ZBSP.js → chunk-VLTWQQKH.js} +2 -2
- package/dist/{chunk-WEK3V5RI.js → chunk-YLYJIQRX.js} +226 -21
- package/dist/{chunk-LN765Y4N.js → chunk-ZFX4M743.js} +15 -9
- package/dist/{chunk-72Z3HNTQ.js → chunk-ZJ6IVZVO.js} +1 -1
- package/dist/cli/chat.js +24 -25
- package/dist/cli/check.js +6 -6
- package/dist/cli/init.js +2 -2
- package/dist/cli/plugins.js +13 -15
- package/dist/cli/snapshot-create.js +9 -10
- package/dist/cli/upgrade.js +8 -8
- package/dist/db/schema/stats.d.ts +93 -0
- package/dist/db/schema.d.ts +94 -1
- package/dist/{db-J2ITKS63.js → db-FWGP5CKY.js} +7 -7
- package/dist/instrumentation.js +3 -3
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-NQYKBT24.js → oauth-callback-server-PM3QNXJQ.js} +16 -18
- package/dist/{plugins-IUJA4VBU.js → plugins-HW4VWW6G.js} +1 -1
- package/dist/{runner-53V5GIQM.js → runner-DV55N6ZB.js} +11 -13
- package/dist/{skills-BU3ZMLVB.js → skills-MANV5ZK6.js} +6 -6
- package/dist/stats.d.ts +18 -0
- package/dist/{validation-74EIKKE6.js → validation-QGB4INTI.js} +6 -6
- package/dist/version.js +1 -1
- package/migrations/0011_sour_golden_guardian.sql +8 -0
- package/migrations/meta/0011_snapshot.json +1195 -0
- package/migrations/meta/_journal.json +8 -1
- package/package.json +5 -5
- package/dist/chunk-4ZNGQH7C.js +0 -25
- package/dist/chunk-YRWJ3KEU.js +0 -517
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SANDBOX_WORKSPACE_ROOT,
|
|
3
|
-
getStateAdapter
|
|
4
|
-
} from "./chunk-KU6ALEJC.js";
|
|
5
|
-
import {
|
|
3
|
+
getStateAdapter,
|
|
6
4
|
sleep
|
|
7
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-VJTWKJWQ.js";
|
|
8
6
|
import {
|
|
9
7
|
toOptionalTrimmed
|
|
10
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-VLTWQQKH.js";
|
|
11
9
|
import {
|
|
12
10
|
pluginCatalogRuntime
|
|
13
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-JSTGI7TX.js";
|
|
14
12
|
import {
|
|
15
13
|
setSpanAttributes,
|
|
16
14
|
setSpanStatus,
|
|
17
15
|
withSpan
|
|
18
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-ZJ6IVZVO.js";
|
|
19
17
|
|
|
20
18
|
// src/chat/sandbox/snapshot/profile.ts
|
|
21
19
|
import { createHash } from "crypto";
|
|
@@ -289,6 +289,7 @@ function toGenAiMessagesTraceAttributes(prefix, messages) {
|
|
|
289
289
|
return {
|
|
290
290
|
[`${prefix}.message_count`]: messages.length,
|
|
291
291
|
[`${prefix}.content_chars`]: contentChars,
|
|
292
|
+
[`${prefix}.messages.size`]: contentChars,
|
|
292
293
|
...roles.size > 0 ? { [`${prefix}.roles`]: [...roles] } : {},
|
|
293
294
|
...partTypes.size > 0 ? { [`${prefix}.part_types`]: [...partTypes] } : {}
|
|
294
295
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getDb
|
|
3
|
+
} from "./chunk-D3N4BPSL.js";
|
|
4
|
+
import {
|
|
5
|
+
juniorStats
|
|
6
|
+
} from "./chunk-GCGJGSQL.js";
|
|
7
|
+
|
|
8
|
+
// src/stats.ts
|
|
9
|
+
import { and, asc, gte, lte, sql } from "drizzle-orm";
|
|
10
|
+
function utcDate(nowMs) {
|
|
11
|
+
return new Date(nowMs).toISOString().slice(0, 10);
|
|
12
|
+
}
|
|
13
|
+
async function incrementStat(key, options = {}) {
|
|
14
|
+
const date = utcDate(options.nowMs ?? Date.now());
|
|
15
|
+
await getDb().insert(juniorStats).values({ ...key, date, count: 1 }).onConflictDoUpdate({
|
|
16
|
+
target: [
|
|
17
|
+
juniorStats.date,
|
|
18
|
+
juniorStats.namespace,
|
|
19
|
+
juniorStats.metric,
|
|
20
|
+
juniorStats.name
|
|
21
|
+
],
|
|
22
|
+
set: { count: sql`${juniorStats.count} + 1` }
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
async function readStats(start, end) {
|
|
26
|
+
return await getDb().select().from(juniorStats).where(and(gte(juniorStats.date, start), lte(juniorStats.date, end))).orderBy(
|
|
27
|
+
asc(juniorStats.date),
|
|
28
|
+
asc(juniorStats.namespace),
|
|
29
|
+
asc(juniorStats.metric),
|
|
30
|
+
asc(juniorStats.name)
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
incrementStat,
|
|
36
|
+
readStats
|
|
37
|
+
};
|
|
@@ -126,9 +126,64 @@ var conversationReportToolCallSchema = z2.object({
|
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
});
|
|
129
|
+
var conversationReportReasoningPartSchema = z2.object({
|
|
130
|
+
type: z2.literal("reasoning"),
|
|
131
|
+
text: z2.string().min(1).optional(),
|
|
132
|
+
redacted: z2.literal(true).optional()
|
|
133
|
+
}).strict().superRefine((data, context) => {
|
|
134
|
+
if (data.text === void 0 === (data.redacted !== true)) {
|
|
135
|
+
context.addIssue({
|
|
136
|
+
code: "custom",
|
|
137
|
+
message: "reasoning content must be text or explicitly redacted"
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
var conversationReportAssistantToolCallPartSchema = z2.object({
|
|
142
|
+
type: z2.literal("tool_call"),
|
|
143
|
+
toolCallId: z2.string().min(1)
|
|
144
|
+
}).strict();
|
|
145
|
+
var conversationReportAssistantMetadataSchema = z2.object({
|
|
146
|
+
parts: z2.array(
|
|
147
|
+
z2.discriminatedUnion("type", [
|
|
148
|
+
conversationReportReasoningPartSchema,
|
|
149
|
+
conversationReportAssistantToolCallPartSchema
|
|
150
|
+
])
|
|
151
|
+
).min(1)
|
|
152
|
+
}).strict();
|
|
129
153
|
var conversationReportToolCallsEventDataSchema = z2.object({
|
|
130
154
|
type: z2.literal("tool_calls"),
|
|
131
|
-
calls: z2.array(conversationReportToolCallSchema).min(1)
|
|
155
|
+
calls: z2.array(conversationReportToolCallSchema).min(1),
|
|
156
|
+
assistant: conversationReportAssistantMetadataSchema.optional()
|
|
157
|
+
}).strict().superRefine((data, context) => {
|
|
158
|
+
if (!data.assistant) return;
|
|
159
|
+
const callCounts = /* @__PURE__ */ new Map();
|
|
160
|
+
for (const call of data.calls) {
|
|
161
|
+
callCounts.set(
|
|
162
|
+
call.toolCallId,
|
|
163
|
+
(callCounts.get(call.toolCallId) ?? 0) + 1
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
const partCounts = /* @__PURE__ */ new Map();
|
|
167
|
+
for (const part of data.assistant.parts) {
|
|
168
|
+
if (part.type !== "tool_call") continue;
|
|
169
|
+
partCounts.set(
|
|
170
|
+
part.toolCallId,
|
|
171
|
+
(partCounts.get(part.toolCallId) ?? 0) + 1
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
if (callCounts.size !== partCounts.size || [...callCounts].some(
|
|
175
|
+
([toolCallId, count]) => partCounts.get(toolCallId) !== count
|
|
176
|
+
)) {
|
|
177
|
+
context.addIssue({
|
|
178
|
+
code: "custom",
|
|
179
|
+
path: ["assistant", "parts"],
|
|
180
|
+
message: "assistant tool parts must reference every call exactly once"
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
var conversationReportAssistantMessageEventDataSchema = z2.object({
|
|
185
|
+
type: z2.literal("assistant_message"),
|
|
186
|
+
parts: z2.array(conversationReportReasoningPartSchema).min(1)
|
|
132
187
|
}).strict();
|
|
133
188
|
var conversationReportTurnLifecycleEventDataSchema = z2.discriminatedUnion(
|
|
134
189
|
"state",
|
|
@@ -199,6 +254,7 @@ var conversationReportSubagentEventDataSchema = z2.object({
|
|
|
199
254
|
var conversationReportEventDataSchema = z2.discriminatedUnion("type", [
|
|
200
255
|
conversationReportMessageEventDataSchema,
|
|
201
256
|
conversationReportMessageHandledEventDataSchema,
|
|
257
|
+
conversationReportAssistantMessageEventDataSchema,
|
|
202
258
|
conversationReportToolCallsEventDataSchema,
|
|
203
259
|
conversationReportTurnLifecycleEventDataSchema,
|
|
204
260
|
conversationReportTurnContextEventDataSchema,
|
|
@@ -270,6 +326,31 @@ function validateConversationEvents(report, context) {
|
|
|
270
326
|
message: "redacted event history must redact tool payloads"
|
|
271
327
|
});
|
|
272
328
|
}
|
|
329
|
+
if (report.eventHistory.status === "redacted" && event.data.type === "assistant_message" && event.data.parts.some((part) => part.text !== void 0)) {
|
|
330
|
+
context.addIssue({
|
|
331
|
+
code: "custom",
|
|
332
|
+
path: ["events", index, "data"],
|
|
333
|
+
message: "redacted event history must redact assistant messages"
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
if (report.eventHistory.status === "available" && event.data.type === "assistant_message" && event.data.parts.some((part) => part.redacted === true)) {
|
|
337
|
+
context.addIssue({
|
|
338
|
+
code: "custom",
|
|
339
|
+
path: ["events", index, "data"],
|
|
340
|
+
message: "available event history must expose reasoning"
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
if (event.data.type === "tool_calls" && (report.eventHistory.status === "redacted" && event.data.assistant?.parts.some(
|
|
344
|
+
(part) => part.type === "reasoning" && part.text !== void 0
|
|
345
|
+
) || report.eventHistory.status === "available" && event.data.assistant?.parts.some(
|
|
346
|
+
(part) => part.type === "reasoning" && part.redacted === true
|
|
347
|
+
))) {
|
|
348
|
+
context.addIssue({
|
|
349
|
+
code: "custom",
|
|
350
|
+
path: ["events", index, "data", "assistant"],
|
|
351
|
+
message: "assistant reasoning must match event history visibility"
|
|
352
|
+
});
|
|
353
|
+
}
|
|
273
354
|
}
|
|
274
355
|
}
|
|
275
356
|
var conversationDetailReportSchema = conversationSummaryReportSchema.extend({
|
|
@@ -441,6 +522,22 @@ var createdPersonalTokenSchema = personalTokenMetadataSchema.extend({ token: z6.
|
|
|
441
522
|
var personalTokenParamsSchema = z6.object({ id: z6.string().uuid() }).strict();
|
|
442
523
|
var revokePersonalTokenResponseSchema = z6.object({ revoked: z6.literal(true) }).strict();
|
|
443
524
|
|
|
525
|
+
// src/api/schema/stats.ts
|
|
526
|
+
import { z as z7 } from "zod";
|
|
527
|
+
var statSchema = z7.object({
|
|
528
|
+
count: z7.number().int().nonnegative(),
|
|
529
|
+
date: z7.string(),
|
|
530
|
+
metric: z7.string().min(1),
|
|
531
|
+
name: z7.string().min(1),
|
|
532
|
+
namespace: z7.string().min(1)
|
|
533
|
+
}).strict();
|
|
534
|
+
var statsReportSchema = z7.object({
|
|
535
|
+
generatedAt: z7.string().datetime(),
|
|
536
|
+
stats: z7.array(statSchema),
|
|
537
|
+
windowEnd: z7.string(),
|
|
538
|
+
windowStart: z7.string()
|
|
539
|
+
}).strict();
|
|
540
|
+
|
|
444
541
|
export {
|
|
445
542
|
apiErrorSchema,
|
|
446
543
|
conversationParamsSchema,
|
|
@@ -471,5 +568,7 @@ export {
|
|
|
471
568
|
createPersonalTokenBodySchema,
|
|
472
569
|
createdPersonalTokenSchema,
|
|
473
570
|
personalTokenParamsSchema,
|
|
474
|
-
revokePersonalTokenResponseSchema
|
|
571
|
+
revokePersonalTokenResponseSchema,
|
|
572
|
+
statSchema,
|
|
573
|
+
statsReportSchema
|
|
475
574
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pluginCatalogRuntime
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JSTGI7TX.js";
|
|
4
4
|
import {
|
|
5
5
|
logWarn
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZJ6IVZVO.js";
|
|
7
7
|
import {
|
|
8
8
|
skillRoots
|
|
9
9
|
} from "./chunk-3V7OFJZC.js";
|
|
@@ -300,19 +300,41 @@ async function discoverSkills(options) {
|
|
|
300
300
|
};
|
|
301
301
|
return sorted;
|
|
302
302
|
}
|
|
303
|
+
function isCommonEnvironmentVariable(name) {
|
|
304
|
+
return [
|
|
305
|
+
"HOME",
|
|
306
|
+
"LANG",
|
|
307
|
+
"PATH",
|
|
308
|
+
"PWD",
|
|
309
|
+
"SHELL",
|
|
310
|
+
"TEMP",
|
|
311
|
+
"TERM",
|
|
312
|
+
"TMP",
|
|
313
|
+
"TMPDIR",
|
|
314
|
+
"USER",
|
|
315
|
+
"XDG_CONFIG_HOME"
|
|
316
|
+
].includes(name.toUpperCase());
|
|
317
|
+
}
|
|
303
318
|
function parseSkillInvocation(messageText, availableSkills) {
|
|
304
319
|
const trimmed = messageText.trim();
|
|
305
320
|
const escapePattern = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
306
|
-
const slashMatch = /(?:^|\s)\/([a-z0-9]+(?:-[a-z0-9]+)*)
|
|
321
|
+
const slashMatch = /(?:^|\s)\/([a-z0-9]+(?:-[a-z0-9]+)*)/i.exec(trimmed);
|
|
307
322
|
if (slashMatch) {
|
|
308
323
|
const skillName = slashMatch[1].toLowerCase();
|
|
309
324
|
if (!availableSkills.some((skill) => skill.name === skillName)) {
|
|
310
325
|
return null;
|
|
311
326
|
}
|
|
312
|
-
return {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
327
|
+
return { skillName };
|
|
328
|
+
}
|
|
329
|
+
const dollarPattern = /(?:^|\s)\$([a-z0-9]+(?:-[a-z0-9]+)*)/gi;
|
|
330
|
+
for (const match of trimmed.matchAll(dollarPattern)) {
|
|
331
|
+
const skillName = match[1].toLowerCase();
|
|
332
|
+
if (isCommonEnvironmentVariable(skillName)) {
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
if (availableSkills.some((skill) => skill.name === skillName)) {
|
|
336
|
+
return { skillName };
|
|
337
|
+
}
|
|
316
338
|
}
|
|
317
339
|
const namedSkill = availableSkills.find((skill) => {
|
|
318
340
|
if (skill.disableModelInvocation !== true) {
|
|
@@ -333,8 +355,7 @@ function parseSkillInvocation(messageText, availableSkills) {
|
|
|
333
355
|
return null;
|
|
334
356
|
}
|
|
335
357
|
return {
|
|
336
|
-
skillName: namedSkill.name
|
|
337
|
-
args: trimmed
|
|
358
|
+
skillName: namedSkill.name
|
|
338
359
|
};
|
|
339
360
|
}
|
|
340
361
|
function findSkillByName(skillName, available) {
|