@sentry/junior 0.211.0 → 0.213.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-XXC-9m0B.js → agent-I74ocTD9.js} +19 -19
- package/dist/{agent-hooks-7vR8uZw2.js → agent-hooks-CdRPMAIE.js} +207 -47
- package/dist/{agent-runner-CqXaUvvQ.js → agent-runner-B81eojZx.js} +5 -5
- package/dist/api/schema.js +2 -2
- package/dist/api.d.ts +1 -1
- package/dist/api.js +72 -33
- package/dist/{app-gyu3D9Gn.d.ts → app-D4nNdzPG.d.ts} +1 -1
- package/dist/app.d.ts +1 -1
- package/dist/app.js +31 -31
- package/dist/{auth-pause-state-r-1vEoSX.js → auth-pause-state-BeY0ljFA.js} +6 -6
- package/dist/{briefs-DIj_YgLE.js → briefs-BVIBIvY1.js} +4 -4
- package/dist/{catalog-runtime-BMMLIpxX.js → catalog-runtime-nNOUcF0O.js} +1 -1
- package/dist/{checkpoint-B6jEtGHN.js → checkpoint-BBfOHMai.js} +7 -7
- package/dist/cli/chat.js +13 -13
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +1 -1
- package/dist/cli/plugins.js +3 -3
- package/dist/cli/snapshot-create.js +3 -3
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -3
- package/dist/{client-BBPo9KiG.js → client-HV5MI31k.js} +2 -2
- package/dist/{config-DMq-uJAV.js → config-DFAtlLoY.js} +2 -2
- package/dist/{conversation-AA4R1VUn.js → conversation-CRWntH-A.js} +19 -19
- package/dist/{conversation-privacy-D99FrYrV.js → conversation-privacy-cpqWNIJp.js} +1 -1
- package/dist/{credential-sync-Cz1T9Ws-.js → credential-sync--5BV3QNF.js} +20 -20
- package/dist/{db-D74z7BZH.d.ts → db-Ca9Nt5ci.d.ts} +1 -1
- package/dist/{execution-stats-BkCnuVBv.js → execution-stats-BjUUUOM8.js} +3 -4
- package/dist/{executor-B5VURdwg.js → executor-BTrFBTlg.js} +39 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{job-queue-DUs_jnBa.js → job-queue-CEKc-Fos.js} +1 -1
- package/dist/{logging-CXQcqM-W.js → logging-BBIO8nx4.js} +1 -1
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-B0KXcd24.js → oauth-callback-server-BDbi0GuG.js} +2 -2
- package/dist/{pending-auth-CxZjizu_.js → pending-auth-YFna7Jtg.js} +2 -2
- package/dist/{profile-8K6D5LHD.js → profile-JxMky6PH.js} +4 -4
- package/dist/{prompt-C1IA4qkj.js → prompt-kRlibHYT.js} +1 -1
- package/dist/{registry-DUa5NdZP.js → registry-BpzPQJAy.js} +1 -1
- package/dist/{resolve-E_-QQ8pM.js → resolve-CygYPkMg.js} +2 -2
- package/dist/{runner-Bf0HnWqY.js → runner-NyIU3zAg.js} +9 -9
- package/dist/{sandbox-egress-signals-BW9FzWoQ.js → sandbox-egress-signals-3UbZEFoN.js} +1 -1
- package/dist/{schema-CwTeb-BF.js → schema-xHUgeh46.js} +1 -1
- package/dist/short-title-CCAI4K8n.js +65 -0
- package/dist/{skills-B1f5Ku_s.js → skills-DqgB34uh.js} +2 -2
- package/dist/{spawn-BsOCLy8T.js → spawn-BUerJdfD.js} +2 -2
- package/dist/{stats-CrITkCy5.js → stats-CAV_taik.js} +5 -5
- package/dist/{store-Det8MQ9g.d.ts → store-DoewL5mG.d.ts} +3 -2
- package/dist/{task-queue-CcqJCAUd.js → task-queue-CcODaB31.js} +3 -3
- package/dist/{task-runner-7IOXx_Uo.js → task-runner-BY358TR3.js} +8 -8
- package/dist/{thread-state-Y3PGLZQa.js → thread-state-DsLsunrt.js} +5 -5
- package/dist/{turn-execution-Bm6Xbaoi.js → turn-execution-CFdT_jiq.js} +3 -3
- package/dist/{turn-lifecycle-Czzk8ila.js → turn-lifecycle-ofsiIkCp.js} +1 -1
- package/dist/{validation-A2SMrAkJ.js → validation-DyZEuf_c.js} +1 -1
- package/dist/{version-CfRx6f_C.js → version-Rvkbcp_Z.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{web-authorization-DN3cJuLB.js → web-authorization-BRFPi8xN.js} +1 -1
- package/dist/{web-input-lJH42B_R.js → web-input-PmIax5-U.js} +4 -4
- package/dist/{work-CRHJu3hb.js → work-xudMvrk2.js} +9 -9
- package/dist/{worker-D6oTNemM.js → worker-EwmMphqi.js} +5 -5
- package/migrations/0042_conversation_metrics.sql +26 -0
- package/migrations/meta/0042_snapshot.json +3610 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +5 -5
- package/dist/usage-DHJ3ng2s.js +0 -166
|
@@ -295,6 +295,13 @@
|
|
|
295
295
|
"when": 1789051768523,
|
|
296
296
|
"tag": "0041_automation_outcomes_backfill",
|
|
297
297
|
"breakpoints": true
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"idx": 42,
|
|
301
|
+
"version": "7",
|
|
302
|
+
"when": 1789152226086,
|
|
303
|
+
"tag": "0042_conversation_metrics",
|
|
304
|
+
"breakpoints": true
|
|
298
305
|
}
|
|
299
306
|
]
|
|
300
307
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.213.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"pg": "^8.16.3",
|
|
86
86
|
"yaml": "^2.9.0",
|
|
87
87
|
"zod": "^4.5.4",
|
|
88
|
-
"@sentry/junior-plugin-api": "0.
|
|
88
|
+
"@sentry/junior-plugin-api": "0.213.0"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
91
|
"@emnapi/core": "^1.10.0",
|
|
@@ -104,9 +104,9 @@
|
|
|
104
104
|
"typescript": "^6.0.3",
|
|
105
105
|
"vercel": "^54.4.0",
|
|
106
106
|
"vitest": "^4.1.7",
|
|
107
|
-
"@sentry/junior-github": "0.
|
|
108
|
-
"@sentry/junior-
|
|
109
|
-
"@sentry/junior-
|
|
107
|
+
"@sentry/junior-github": "0.213.0",
|
|
108
|
+
"@sentry/junior-testing": "0.0.0",
|
|
109
|
+
"@sentry/junior-memory": "0.213.0"
|
|
110
110
|
},
|
|
111
111
|
"scripts": {
|
|
112
112
|
"build": "tsdown",
|
package/dist/usage-DHJ3ng2s.js
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { f as logWarn } from "./logging-CXQcqM-W.js";
|
|
2
|
-
import { n as botConfig } from "./config-DMq-uJAV.js";
|
|
3
|
-
import { P as usageSchema } from "./conversation-AA4R1VUn.js";
|
|
4
|
-
const TITLE_PROMPTS = {
|
|
5
|
-
conversation: [
|
|
6
|
-
"Generate a concise 5-8 word conversation title from the first user message below.",
|
|
7
|
-
"Capture the user's main request.",
|
|
8
|
-
"Reply with ONLY the title, with no quotes or trailing punctuation."
|
|
9
|
-
],
|
|
10
|
-
task: [
|
|
11
|
-
"Generate a concise 5-8 word task title from the task instruction below.",
|
|
12
|
-
"Capture the task's main purpose.",
|
|
13
|
-
"Reply with ONLY the title, with no quotes or trailing punctuation."
|
|
14
|
-
]
|
|
15
|
-
};
|
|
16
|
-
/** Collapse whitespace and cap a candidate short title. */
|
|
17
|
-
function normalizeShortTitle(value) {
|
|
18
|
-
return value.replace(/\s+/g, " ").trim().slice(0, 60);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Deterministic display title when no generated title is stored.
|
|
22
|
-
* Uses the first non-empty line of the source text, capped like generated titles.
|
|
23
|
-
*/
|
|
24
|
-
function fallbackShortTitle(sourceText, fallback = "Untitled") {
|
|
25
|
-
return normalizeShortTitle(sourceText.split(/\r?\n/).map((line) => line.trim()).find((line) => line.length > 0) ?? "") || fallback;
|
|
26
|
-
}
|
|
27
|
-
/** Generate a short title with the fast model, or return undefined on failure. */
|
|
28
|
-
async function generateShortTitle(args) {
|
|
29
|
-
const sourceText = args.sourceText.trim();
|
|
30
|
-
if (!sourceText) return void 0;
|
|
31
|
-
try {
|
|
32
|
-
return normalizeShortTitle((await args.completeText({
|
|
33
|
-
modelId: botConfig.fastModelId,
|
|
34
|
-
temperature: 0,
|
|
35
|
-
promptName: `junior.${args.kind}_title`,
|
|
36
|
-
messages: [{
|
|
37
|
-
role: "user",
|
|
38
|
-
content: [
|
|
39
|
-
...TITLE_PROMPTS[args.kind],
|
|
40
|
-
"",
|
|
41
|
-
args.kind === "conversation" ? `First user message: ${sourceText.slice(0, 500)}` : `Task instruction: ${sourceText.slice(0, 500)}`
|
|
42
|
-
].join("\n"),
|
|
43
|
-
timestamp: Date.now()
|
|
44
|
-
}],
|
|
45
|
-
metadata: { modelId: botConfig.fastModelId }
|
|
46
|
-
})).text) || void 0;
|
|
47
|
-
} catch (error) {
|
|
48
|
-
logWarn(`${args.kind}.title.generation.failed`, { "exception.message": error instanceof Error ? error.message : String(error) });
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Prefer an explicit task title when provided; otherwise generate one from the
|
|
54
|
-
* instruction with the fast model.
|
|
55
|
-
*/
|
|
56
|
-
async function resolveTaskTitle(args) {
|
|
57
|
-
const explicit = normalizeShortTitle(args.title ?? "");
|
|
58
|
-
if (explicit) return explicit;
|
|
59
|
-
return generateShortTitle({
|
|
60
|
-
completeText: args.completeText,
|
|
61
|
-
kind: "task",
|
|
62
|
-
sourceText: args.instruction
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
//#endregion
|
|
66
|
-
//#region src/chat/usage.ts
|
|
67
|
-
const agentTurnUsageSchema = usageSchema;
|
|
68
|
-
const COMPONENT_USAGE_FIELDS = [
|
|
69
|
-
"inputTokens",
|
|
70
|
-
"outputTokens",
|
|
71
|
-
"cachedInputTokens",
|
|
72
|
-
"cacheCreationTokens"
|
|
73
|
-
];
|
|
74
|
-
const COST_COMPONENT_FIELDS = [
|
|
75
|
-
"input",
|
|
76
|
-
"output",
|
|
77
|
-
"cacheRead",
|
|
78
|
-
"cacheWrite"
|
|
79
|
-
];
|
|
80
|
-
/** Return whether any token counter is present on a usage record. */
|
|
81
|
-
function hasAgentTurnUsage(usage) {
|
|
82
|
-
return Boolean(usage && (Object.entries(usage).some(([field, value]) => field !== "cost" && typeof value === "number" && Number.isFinite(value)) || Object.values(usage.cost ?? {}).some((value) => typeof value === "number" && Number.isFinite(value))));
|
|
83
|
-
}
|
|
84
|
-
function getFiniteCount(value) {
|
|
85
|
-
return typeof value === "number" && Number.isFinite(value) ? Math.max(0, Math.floor(value)) : void 0;
|
|
86
|
-
}
|
|
87
|
-
function getFiniteCost(value) {
|
|
88
|
-
return typeof value === "number" && Number.isFinite(value) ? Math.max(0, value) : void 0;
|
|
89
|
-
}
|
|
90
|
-
function addCost(left, right) {
|
|
91
|
-
return Math.round(((left ?? 0) + right) * 0xe8d4a51000) / 0xe8d4a51000;
|
|
92
|
-
}
|
|
93
|
-
function getComponentTotal(usage) {
|
|
94
|
-
let total;
|
|
95
|
-
for (const field of COMPONENT_USAGE_FIELDS) {
|
|
96
|
-
const value = getFiniteCount(usage[field]);
|
|
97
|
-
if (value === void 0) continue;
|
|
98
|
-
total = (total ?? 0) + value;
|
|
99
|
-
}
|
|
100
|
-
return total;
|
|
101
|
-
}
|
|
102
|
-
/** Estimated total USD cost from one usage record, when any cost field is present. */
|
|
103
|
-
function agentTurnCostUsd(usage) {
|
|
104
|
-
if (!usage?.cost) return void 0;
|
|
105
|
-
const total = getFiniteCost(usage.cost.total);
|
|
106
|
-
if (total !== void 0) return total;
|
|
107
|
-
let componentTotal = 0;
|
|
108
|
-
let hasComponent = false;
|
|
109
|
-
for (const field of COST_COMPONENT_FIELDS) {
|
|
110
|
-
const value = getFiniteCost(usage.cost[field]);
|
|
111
|
-
if (value === void 0) continue;
|
|
112
|
-
hasComponent = true;
|
|
113
|
-
componentTotal = addCost(componentTotal, value);
|
|
114
|
-
}
|
|
115
|
-
return hasComponent ? componentTotal : void 0;
|
|
116
|
-
}
|
|
117
|
-
/** Total token count from one usage record, preferring component counters. */
|
|
118
|
-
function agentTurnTotalTokens(usage) {
|
|
119
|
-
if (!usage) return void 0;
|
|
120
|
-
const componentTotal = getComponentTotal(usage);
|
|
121
|
-
if (componentTotal !== void 0) return componentTotal;
|
|
122
|
-
return getFiniteCount(usage.totalTokens);
|
|
123
|
-
}
|
|
124
|
-
/** Aggregate token usage across slices without double-counting provider totals. */
|
|
125
|
-
function addAgentTurnUsage(...usages) {
|
|
126
|
-
const components = {};
|
|
127
|
-
let componentTotal;
|
|
128
|
-
let totalOnlyTokens;
|
|
129
|
-
let reasoningTokens;
|
|
130
|
-
const cost = {};
|
|
131
|
-
for (const usage of usages) {
|
|
132
|
-
if (!usage) continue;
|
|
133
|
-
const reasoning = getFiniteCount(usage.reasoningTokens);
|
|
134
|
-
if (reasoning !== void 0) reasoningTokens = (reasoningTokens ?? 0) + reasoning;
|
|
135
|
-
if (usage.cost) for (const field of [...COST_COMPONENT_FIELDS, "total"]) {
|
|
136
|
-
const value = getFiniteCost(usage.cost[field]);
|
|
137
|
-
if (value === void 0) continue;
|
|
138
|
-
cost[field] = addCost(cost[field], value);
|
|
139
|
-
}
|
|
140
|
-
const usageComponentTotal = getComponentTotal(usage);
|
|
141
|
-
if (usageComponentTotal !== void 0) {
|
|
142
|
-
componentTotal = (componentTotal ?? 0) + usageComponentTotal;
|
|
143
|
-
for (const field of COMPONENT_USAGE_FIELDS) {
|
|
144
|
-
const value = getFiniteCount(usage[field]);
|
|
145
|
-
if (value === void 0) continue;
|
|
146
|
-
components[field] = (components[field] ?? 0) + value;
|
|
147
|
-
}
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
150
|
-
const totalTokens = getFiniteCount(usage.totalTokens);
|
|
151
|
-
if (totalTokens !== void 0) totalOnlyTokens = (totalOnlyTokens ?? 0) + totalTokens;
|
|
152
|
-
}
|
|
153
|
-
if (totalOnlyTokens !== void 0) return {
|
|
154
|
-
totalTokens: totalOnlyTokens + (componentTotal ?? 0),
|
|
155
|
-
...reasoningTokens !== void 0 ? { reasoningTokens } : void 0,
|
|
156
|
-
...Object.keys(cost).length > 0 ? { cost } : void 0
|
|
157
|
-
};
|
|
158
|
-
const result = {
|
|
159
|
-
...components,
|
|
160
|
-
...reasoningTokens !== void 0 ? { reasoningTokens } : void 0,
|
|
161
|
-
...Object.keys(cost).length > 0 ? { cost } : void 0
|
|
162
|
-
};
|
|
163
|
-
return hasAgentTurnUsage(result) ? result : void 0;
|
|
164
|
-
}
|
|
165
|
-
//#endregion
|
|
166
|
-
export { hasAgentTurnUsage as a, resolveTaskTitle as c, agentTurnUsageSchema as i, agentTurnCostUsd as n, fallbackShortTitle as o, agentTurnTotalTokens as r, generateShortTitle as s, addAgentTurnUsage as t };
|