@sentry/junior 0.288.0 → 0.289.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 (76) hide show
  1. package/dist/{adapter-Cikcqdty.js → adapter-tE1wnl0T.js} +1 -1
  2. package/dist/{admin-BcSxHuTB.js → admin-BmsPbmO_.js} +2 -2
  3. package/dist/{agent-runner-9MXyWUL8.js → agent-runner-bvl8U5uH.js} +343 -103
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +6 -7
  6. package/dist/api.d.ts +1 -1
  7. package/dist/api.js +281 -254
  8. package/dist/{app-BUklJVBe.d.ts → app-Cu454FXq.d.ts} +2 -4
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +92 -64
  11. package/dist/assistant-reply-1N9oxyyb.js +58 -0
  12. package/dist/{automation-DDXwHQs5.js → automation-DWbjJltM.js} +1 -1
  13. package/dist/{background-compaction-queue-CjllSPir.js → background-compaction-queue-D36oCldp.js} +4 -4
  14. package/dist/{briefs-DW9iuolG.js → briefs-CV-1qkXa.js} +3 -4
  15. package/dist/{catalog-runtime-B3gfH58M.js → catalog-runtime-BNK4uJVZ.js} +1 -1
  16. package/dist/cli/chat.js +14 -14
  17. package/dist/cli/check.js +3 -3
  18. package/dist/cli/main.js +3 -3
  19. package/dist/cli/plugins.js +4 -4
  20. package/dist/cli/snapshot-create.js +4 -4
  21. package/dist/cli/upgrade.d.ts +1 -1
  22. package/dist/cli/upgrade.js +3 -3
  23. package/dist/{config-CLJcyYEF.js → config-DHAy7XlP.js} +4 -41
  24. package/dist/{connections-BtdJftow.js → connections-C3VmH3cf.js} +7 -129
  25. package/dist/{conversation-DhoqHtQ7.js → conversation-CwC8K3RZ.js} +8 -8
  26. package/dist/{conversation-pending-messages-DHV0S4uF.js → conversation-pending-messages-B0cuLReP.js} +1 -1
  27. package/dist/{conversation-privacy-BPirIVlX.js → conversation-privacy-Bky_veSp.js} +1 -1
  28. package/dist/{credential-sync-Co8Q2xRW.js → credential-sync-dY9o0YSj.js} +13 -13
  29. package/dist/{db-Co7DTYYh.js → db-BS2Kql3j.js} +56 -31
  30. package/dist/{db-zIs8-Ba3.d.ts → db-BebRmhsH.d.ts} +5 -1
  31. package/dist/{executor-m0kIN71Q.js → executor-cc4nH86C.js} +35 -9
  32. package/dist/instrumentation.js +2 -2
  33. package/dist/{logging-DbD-dErY.js → logging-CtCJmt9p.js} +2 -2
  34. package/dist/{history-IjdmO_r6.js → media-BepyEUNm.js} +85 -1
  35. package/dist/{message-DKTdTYm-.js → message-C5VuRcP9.js} +9 -9
  36. package/dist/nitro.d.ts +1 -1
  37. package/dist/nitro.js +2 -2
  38. package/dist/{oauth-callback-server-CpbepSbp.js → oauth-callback-server-KRrYUZ35.js} +2 -2
  39. package/dist/{projection-BViECfYu.js → projection-BFJG58TG.js} +153 -119
  40. package/dist/{prompt-KT6MaDHN.js → prompt-D15oftoL.js} +183 -3
  41. package/dist/{registry-D-Acyjhh.js → registry-C_JrgqUz.js} +1 -1
  42. package/dist/{resolve-gkT2R66z.js → resolve-Cn_7JfP-.js} +3 -3
  43. package/dist/{result-DHmCFEt8.js → result-CIbQFLp6.js} +16 -10
  44. package/dist/{runner-DBKjGjH-.js → runner-BwmaMJVO.js} +8 -8
  45. package/dist/{sandbox-egress-signals-9n8hqx29.js → sandbox-egress-signals-BOQ8gn7i.js} +1 -1
  46. package/dist/{schema-DxicIQbc.js → schema-Bptz19Ja.js} +14 -9
  47. package/dist/{schema-B_6aOcx5.d.ts → schema-DQaFSkZZ.d.ts} +13 -5
  48. package/dist/{service-account-CDlC9ssy.js → service-account-AGw_pANb.js} +3 -3
  49. package/dist/{service-account-Bi0HsY6w.js → service-account-CLZfF8O1.js} +3 -3
  50. package/dist/{session-stop-BWOsuo8p.js → session-stop-CbzKf7UI.js} +41 -30
  51. package/dist/{skills-DO5K68Rq.js → skills-CcAJBquq.js} +2 -2
  52. package/dist/{spawn-BBqZDcPa.js → spawn-BvAk2vTI.js} +5 -5
  53. package/dist/{stop-WC97cmHz.js → stop-BQU4u7la.js} +123 -213
  54. package/dist/{store-ByR1Lr7e.js → store-DE7NJOvQ.js} +3 -3
  55. package/dist/{task-runner-B-Ewf8TX.js → task-runner-Q_7duP_T.js} +13 -17
  56. package/dist/{turn-failure-response-CpdPoZSl.js → turn-failure-response-aWZLfUM8.js} +8 -8
  57. package/dist/{validation-B4sbIoES.js → validation-BOoPeIJR.js} +1 -1
  58. package/dist/{version-D6lpuAgL.js → version-Db0MFy61.js} +1 -1
  59. package/dist/version.js +1 -1
  60. package/dist/{viewer-CeP27tC3.js → viewer-FFEFu9In.js} +4 -4
  61. package/dist/{warmup-P_GJCL1c.js → warmup-DDzrA9Gv.js} +260 -60
  62. package/dist/{work-DI7x1Slm.js → work-BBJK458E.js} +14 -14
  63. package/dist/{worker-CYPTOT4j.js → worker-2iU5RFyq.js} +6 -30
  64. package/migrations/0091_conversation_participant_unsubscribed_index.sql +20 -0
  65. package/migrations/0092_turn_metric_actor.sql +12 -0
  66. package/migrations/0093_participant_root_actor_backfill.sql +18 -0
  67. package/migrations/0094_conversation_delivery_paused_at.sql +1 -0
  68. package/migrations/meta/0091_snapshot.json +4410 -0
  69. package/migrations/meta/0092_snapshot.json +4446 -0
  70. package/migrations/meta/0093_snapshot.json +4446 -0
  71. package/migrations/meta/0094_snapshot.json +4452 -0
  72. package/migrations/meta/_journal.json +28 -0
  73. package/package.json +5 -5
  74. package/dist/assistant-reply-mj47jMRV.js +0 -65
  75. package/dist/core-model-BTt5E5b0.js +0 -182
  76. package/dist/media-BAHvgkok.js +0 -85
@@ -638,6 +638,34 @@
638
638
  "when": 1794222953219,
639
639
  "tag": "0090_guardian_review_time_index",
640
640
  "breakpoints": true
641
+ },
642
+ {
643
+ "idx": 91,
644
+ "version": "7",
645
+ "when": 1794245490321,
646
+ "tag": "0091_conversation_participant_unsubscribed_index",
647
+ "breakpoints": true
648
+ },
649
+ {
650
+ "idx": 92,
651
+ "version": "7",
652
+ "when": 1794248406305,
653
+ "tag": "0092_turn_metric_actor",
654
+ "breakpoints": true
655
+ },
656
+ {
657
+ "idx": 93,
658
+ "version": "7",
659
+ "when": 1794256116275,
660
+ "tag": "0093_participant_root_actor_backfill",
661
+ "breakpoints": true
662
+ },
663
+ {
664
+ "idx": 94,
665
+ "version": "7",
666
+ "when": 1794266800377,
667
+ "tag": "0094_conversation_delivery_paused_at",
668
+ "breakpoints": true
641
669
  }
642
670
  ]
643
671
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior",
3
- "version": "0.288.0",
3
+ "version": "0.289.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -94,7 +94,7 @@
94
94
  "web-push": "^3.6.7",
95
95
  "yaml": "^2.9.0",
96
96
  "zod": "^4.5.4",
97
- "@sentry/junior-plugin-api": "0.288.0"
97
+ "@sentry/junior-plugin-api": "0.289.0"
98
98
  },
99
99
  "peerDependencies": {
100
100
  "bullmq": "^6.5.0",
@@ -130,9 +130,9 @@
130
130
  "typescript": "^7.0.2",
131
131
  "vercel": "^54.4.0",
132
132
  "vitest": "^4.1.12",
133
- "@sentry/junior-github": "0.288.0",
134
- "@sentry/junior-memory": "0.288.0",
135
- "@sentry/junior-testing": "0.0.0"
133
+ "@sentry/junior-testing": "0.0.0",
134
+ "@sentry/junior-github": "0.289.0",
135
+ "@sentry/junior-memory": "0.289.0"
136
136
  },
137
137
  "scripts": {
138
138
  "build": "tsdown",
@@ -1,65 +0,0 @@
1
- import { en as extractAssistantText } from "./projection-BViECfYu.js";
2
- // src/chat/no-reply.ts
3
- const NO_REPLY_MARKER = "[[NO_REPLY]]";
4
- /**
5
- * Trailing marker for a Quiet message: an Event Turn reply that Junior stores
6
- * but does not deliver to the Location.
7
- */
8
- const QUIET_MARKER = "[[QUIET]]";
9
- /**
10
- * True when one assistant message ends with the silence marker, or is only
11
- * the quiet marker. Mid-sentence mentions do not match. Detection is per
12
- * message only.
13
- */
14
- function isNoReplyMarker(text) {
15
- const trimmed = text.trim();
16
- return trimmed.endsWith("[[NO_REPLY]]") || trimmed === "[[QUIET]]";
17
- }
18
- /**
19
- * Return the text before a trailing quiet marker, or undefined when the text
20
- * does not end with one. Mid-sentence mentions do not match.
21
- */
22
- function stripQuietMarker(text) {
23
- const trimmed = text.trimEnd();
24
- if (!trimmed.endsWith("[[QUIET]]")) return void 0;
25
- return trimmed.slice(0, -9).trimEnd();
26
- }
27
- // src/chat/services/assistant-reply.ts
28
- const THINKING_XML_BLOCK_PATTERN = /[ \t]*<thinking\b[^>]*>[\s\S]*?<\/thinking>[ \t]*(?:\r?\n)?/gi;
29
- const FENCED_CODE_BLOCK_PATTERN = /```[\s\S]*?```/g;
30
- /** Remove provider reasoning wrappers while preserving fenced code examples. */
31
- function sanitizeAssistantText(text) {
32
- let result = "";
33
- let cursor = 0;
34
- for (const match of text.matchAll(FENCED_CODE_BLOCK_PATTERN)) {
35
- const start = match.index;
36
- if (start === void 0) continue;
37
- result += text.slice(cursor, start).replace(THINKING_XML_BLOCK_PATTERN, "");
38
- result += match[0];
39
- cursor = start + match[0].length;
40
- }
41
- return (result + text.slice(cursor).replace(THINKING_XML_BLOCK_PATTERN, "")).trim();
42
- }
43
- /** Decide whether one completed assistant message becomes a reply. */
44
- function decideReply(message) {
45
- if (message.content.some((part) => part.type === "toolCall")) return { kind: "suppress" };
46
- const text = sanitizeAssistantText(extractAssistantText(message));
47
- if (!text) return { kind: "empty" };
48
- if (isNoReplyMarker(text)) return { kind: "suppress" };
49
- const quietText = stripQuietMarker(text);
50
- if (quietText === void 0) return {
51
- kind: "deliver",
52
- text
53
- };
54
- return {
55
- kind: "deliver",
56
- text: quietText,
57
- quiet: true
58
- };
59
- }
60
- /** Return destination-visible reply text when the message is deliverable. */
61
- function getAssistantReplyText(message) {
62
- const decision = decideReply(message);
63
- return decision.kind === "deliver" ? decision.text : void 0;
64
- }
65
- export { QUIET_MARKER as a, NO_REPLY_MARKER as i, getAssistantReplyText as n, isNoReplyMarker as o, sanitizeAssistantText as r, decideReply as t };
@@ -1,182 +0,0 @@
1
- import { C as completeText$1, S as completeObject$1, x as completeDecision$1 } from "./config-CLJcyYEF.js";
2
- import { _ as runBestEffort, a as extractGenAiUsageSummary } from "./logging-DbD-dErY.js";
3
- import { W as agentTurnCostUsd, r as getConversationEventStore } from "./db-Co7DTYYh.js";
4
- import * as z from "zod";
5
- import { conversationEventPresentationSchema, defineConversationEvent } from "@sentry/junior-plugin-api";
6
- // src/chat/conversations/structured-events.ts
7
- /** Reserved namespace for Junior-owned conversation metadata events. */
8
- const JUNIOR_NATIVE_EVENT_NAMESPACE = "junior";
9
- const authenticationEventContentSchema = z.object({
10
- accountLabel: z.string().trim().min(1).max(120).optional(),
11
- actorId: z.string().min(1),
12
- authorizationId: z.string().min(1).optional(),
13
- provider: z.string().regex(/^[a-z][a-z0-9-]*$/),
14
- providerLabel: z.string().trim().min(1).max(80).optional()
15
- }).strict();
16
- const agentsInstructionsUpdatedContentSchema = z.object({
17
- action: z.enum([
18
- "loaded",
19
- "replaced",
20
- "cleared"
21
- ]),
22
- directory: z.string().trim().min(1).max(500).optional(),
23
- fingerprint: z.string().trim().min(1).max(128),
24
- sources: z.array(z.object({
25
- content: z.string().min(1).max(32768),
26
- path: z.string().trim().min(1).max(500)
27
- }).strict()).max(32),
28
- textBytes: z.number().int().nonnegative().optional()
29
- }).strict();
30
- function providerTitle(content) {
31
- return content.providerLabel?.trim() || content.provider;
32
- }
33
- function agentsInstructionsTitle(action) {
34
- if (action === "loaded") return "Loaded AGENTS.md";
35
- if (action === "replaced") return "Updated AGENTS.md";
36
- return "Cleared AGENTS.md";
37
- }
38
- function sourceFilename(sourcePath) {
39
- return sourcePath.split("/").at(-1) || sourcePath;
40
- }
41
- function formatBytes(bytes) {
42
- if (bytes < 1024) return `${bytes} bytes`;
43
- const kilobytes = bytes / 1024;
44
- return `${Number.isInteger(kilobytes) ? kilobytes : kilobytes.toFixed(1)} KB`;
45
- }
46
- function agentsInstructionsPreview(content) {
47
- const source = content.sources[0];
48
- if (!source) return void 0;
49
- const filename = sourceFilename(source.path);
50
- const label = content.sources.length === 1 ? filename : `${content.sources.length} AGENTS.md files`;
51
- return typeof content.textBytes === "number" ? `${label} · ${formatBytes(content.textBytes)}` : label;
52
- }
53
- /** Junior-owned account-link transcript event. */
54
- const authenticationLinkedEvent = defineConversationEvent({
55
- name: "authentication_linked",
56
- version: 1,
57
- schema: authenticationEventContentSchema,
58
- renderEvent(event) {
59
- const provider = providerTitle(event);
60
- return {
61
- icon: "link",
62
- title: `${provider} connected`,
63
- ...event.accountLabel ? { preview: `Connected as \`${event.accountLabel}\`` } : void 0,
64
- details: [{
65
- title: `${provider} connected`,
66
- ...event.accountLabel ? { description: `Connected as \`${event.accountLabel}\`` } : void 0,
67
- metadata: [event.provider]
68
- }]
69
- };
70
- }
71
- });
72
- /** Junior-owned account-unlink transcript event. */
73
- const authenticationUnlinkedEvent = defineConversationEvent({
74
- name: "authentication_unlinked",
75
- version: 1,
76
- schema: authenticationEventContentSchema,
77
- renderEvent(event) {
78
- const provider = providerTitle(event);
79
- return {
80
- icon: "key",
81
- title: `${provider} disconnected`,
82
- details: [{
83
- title: `${provider} disconnected`,
84
- metadata: [event.provider]
85
- }]
86
- };
87
- }
88
- });
89
- /** Junior-owned AGENTS.md bootstrap transition for the dashboard timeline. */
90
- const agentsInstructionsUpdatedEvent = defineConversationEvent({
91
- name: "agents_instructions_updated",
92
- version: 1,
93
- schema: agentsInstructionsUpdatedContentSchema,
94
- renderEvent(event) {
95
- const title = agentsInstructionsTitle(event.action);
96
- const preview = agentsInstructionsPreview(event);
97
- return {
98
- icon: "brain",
99
- title,
100
- ...preview ? { preview } : void 0,
101
- ...event.sources.length > 0 ? { details: event.sources.map((source) => ({
102
- title: sourceFilename(source.path),
103
- content: source.content
104
- })) } : void 0
105
- };
106
- }
107
- });
108
- /** Core-written Conversation note. `notes.ts` owns when the model sees it. */
109
- const conversationNoteEvent = defineConversationEvent({
110
- name: "conversation_note",
111
- version: 1,
112
- schema: z.object({ text: z.string().trim().min(1).max(500) }).strict(),
113
- renderEvent(event) {
114
- return {
115
- icon: "info",
116
- title: "Note for the next Turn",
117
- preview: event.text
118
- };
119
- }
120
- });
121
- const NATIVE_EVENT_DEFINITIONS = [
122
- authenticationLinkedEvent,
123
- authenticationUnlinkedEvent,
124
- agentsInstructionsUpdatedEvent,
125
- conversationNoteEvent
126
- ];
127
- /** Resolve a registered Junior-native conversation event definition. */
128
- function getJuniorNativeEventDefinition(args) {
129
- return NATIVE_EVENT_DEFINITIONS.find((definition) => definition.eventName === args.name && definition.version === args.version);
130
- }
131
- /** Render one Junior-native event through its active definition. */
132
- function renderJuniorNativeConversationEvent(args) {
133
- if (args.namespace !== "junior") return void 0;
134
- const definition = getJuniorNativeEventDefinition(args);
135
- if (!definition) return void 0;
136
- const presentation = definition.renderEvent(definition.parse(args.content));
137
- return presentation === void 0 ? void 0 : conversationEventPresentationSchema.parse(presentation);
138
- }
139
- // src/chat/core-model.ts
140
- function gatewayParams(params) {
141
- const { cost: _cost, operation, ...rest } = params;
142
- return {
143
- ...rest,
144
- promptName: `junior.${operation}`
145
- };
146
- }
147
- async function recordCost(attribution, costUsd) {
148
- const { cost, operation } = attribution;
149
- if (costUsd === void 0 || !("conversationId" in cost)) return;
150
- await runBestEffort(async () => {
151
- await getConversationEventStore().append(cost.conversationId, [{
152
- createdAtMs: Date.now(),
153
- data: {
154
- type: "structured_event",
155
- namespace: JUNIOR_NATIVE_EVENT_NAMESPACE,
156
- name: operation,
157
- version: 1,
158
- ...cost.turnId ? { turnId: cost.turnId } : void 0,
159
- content: { costUsd }
160
- }
161
- }], { activity: "preserve" });
162
- }, "model_cost.record.failed", { "gen_ai.prompt.name": `junior.${operation}` });
163
- }
164
- /** Run a text completion and attribute its cost. */
165
- async function completeText(params) {
166
- const result = await completeText$1(gatewayParams(params));
167
- await recordCost(params, agentTurnCostUsd(extractGenAiUsageSummary(result.message)));
168
- return result;
169
- }
170
- /** Run a schema-constrained completion and attribute its cost. */
171
- async function completeObject(params) {
172
- const result = await completeObject$1(gatewayParams(params));
173
- await recordCost(params, result.costUsd);
174
- return result;
175
- }
176
- /** Answer decision questions and attribute the cost. */
177
- async function completeDecision(params) {
178
- const result = await completeDecision$1(gatewayParams(params));
179
- await recordCost(params, result.costUsd);
180
- return result;
181
- }
182
- export { agentsInstructionsUpdatedEvent as a, conversationNoteEvent as c, JUNIOR_NATIVE_EVENT_NAMESPACE as i, renderJuniorNativeConversationEvent as l, completeObject as n, authenticationLinkedEvent as o, completeText as r, authenticationUnlinkedEvent as s, completeDecision as t };
@@ -1,85 +0,0 @@
1
- // src/chat/attachments/media.ts
2
- const INPUT_IMAGE_TYPES = [
3
- "image/png",
4
- "image/jpeg",
5
- "image/gif",
6
- "image/webp"
7
- ];
8
- /** Video types that browsers play in a `<video>` element. */
9
- const INLINE_VIDEO_TYPES = ["video/mp4", "video/webm"];
10
- /** Leading bytes of each accepted image type. `null` matches any byte. */
11
- const IMAGE_SIGNATURES = [
12
- {
13
- mediaType: "image/png",
14
- bytes: [
15
- 137,
16
- 80,
17
- 78,
18
- 71,
19
- 13,
20
- 10,
21
- 26,
22
- 10
23
- ]
24
- },
25
- {
26
- mediaType: "image/jpeg",
27
- bytes: [
28
- 255,
29
- 216,
30
- 255
31
- ]
32
- },
33
- {
34
- mediaType: "image/gif",
35
- bytes: [
36
- 71,
37
- 73,
38
- 70,
39
- 56,
40
- 55,
41
- 97
42
- ]
43
- },
44
- {
45
- mediaType: "image/gif",
46
- bytes: [
47
- 71,
48
- 73,
49
- 70,
50
- 56,
51
- 57,
52
- 97
53
- ]
54
- },
55
- {
56
- mediaType: "image/webp",
57
- bytes: [
58
- 82,
59
- 73,
60
- 70,
61
- 70,
62
- null,
63
- null,
64
- null,
65
- null,
66
- 87,
67
- 69,
68
- 66,
69
- 80
70
- ]
71
- }
72
- ];
73
- /**
74
- * Detect an accepted image type from file bytes. Use this instead of a file
75
- * name or declared content type, which can be wrong.
76
- */
77
- function detectImageMediaType(data) {
78
- return IMAGE_SIGNATURES.find(({ bytes }) => data.length >= bytes.length && bytes.every((byte, index) => byte === null || data[index] === byte))?.mediaType;
79
- }
80
- /** Report whether a media type is a raster image accepted by vision models. */
81
- function isVisionImageMediaType(mediaType) {
82
- const normalized = mediaType.split(";", 1)[0]?.trim().toLowerCase();
83
- return normalized ? INPUT_IMAGE_TYPES.some((type) => type === normalized) : false;
84
- }
85
- export { isVisionImageMediaType as i, INPUT_IMAGE_TYPES as n, detectImageMediaType as r, INLINE_VIDEO_TYPES as t };