@sentry/junior 0.67.3 → 0.68.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/app.js +3 -84
- package/dist/chat/slack/footer.d.ts +2 -7
- package/package.json +3 -3
package/dist/app.js
CHANGED
|
@@ -12762,51 +12762,6 @@ function escapeSlackMrkdwn(text) {
|
|
|
12762
12762
|
function escapeSlackLinkUrl(url) {
|
|
12763
12763
|
return url.replaceAll("&", "&").replaceAll("<", "%3C").replaceAll(">", "%3E");
|
|
12764
12764
|
}
|
|
12765
|
-
function formatSlackTokenCount(value) {
|
|
12766
|
-
if (value >= 1e6) {
|
|
12767
|
-
const millions = value / 1e6;
|
|
12768
|
-
return `${parseFloat(millions.toFixed(2))}m`;
|
|
12769
|
-
}
|
|
12770
|
-
if (value >= 1e3) {
|
|
12771
|
-
const thousands = value / 1e3;
|
|
12772
|
-
return `${parseFloat(thousands.toFixed(1))}k`;
|
|
12773
|
-
}
|
|
12774
|
-
return `${value}`;
|
|
12775
|
-
}
|
|
12776
|
-
function formatSlackDuration(durationMs) {
|
|
12777
|
-
if (durationMs < 1e3) {
|
|
12778
|
-
return `${durationMs}ms`;
|
|
12779
|
-
}
|
|
12780
|
-
const totalSeconds = Math.round(durationMs / 1e3);
|
|
12781
|
-
if (totalSeconds < 10) {
|
|
12782
|
-
const precise = durationMs / 1e3;
|
|
12783
|
-
return `${precise.toFixed(1).replace(/\.0$/, "")}s`;
|
|
12784
|
-
}
|
|
12785
|
-
if (totalSeconds < 60) {
|
|
12786
|
-
return `${totalSeconds}s`;
|
|
12787
|
-
}
|
|
12788
|
-
const minutes = Math.floor(totalSeconds / 60);
|
|
12789
|
-
const seconds = totalSeconds % 60;
|
|
12790
|
-
if (seconds === 0) {
|
|
12791
|
-
return `${minutes}m`;
|
|
12792
|
-
}
|
|
12793
|
-
return `${minutes}m${seconds}s`;
|
|
12794
|
-
}
|
|
12795
|
-
function resolveTotalTokens(usage) {
|
|
12796
|
-
if (!usage) {
|
|
12797
|
-
return void 0;
|
|
12798
|
-
}
|
|
12799
|
-
const components = [
|
|
12800
|
-
usage.inputTokens,
|
|
12801
|
-
usage.outputTokens,
|
|
12802
|
-
usage.cachedInputTokens,
|
|
12803
|
-
usage.cacheCreationTokens
|
|
12804
|
-
].filter((value) => value !== void 0);
|
|
12805
|
-
if (components.length > 0) {
|
|
12806
|
-
return components.reduce((sum, value) => sum + value, 0);
|
|
12807
|
-
}
|
|
12808
|
-
return usage.totalTokens;
|
|
12809
|
-
}
|
|
12810
12765
|
function buildSlackReplyFooter(args) {
|
|
12811
12766
|
const items = [];
|
|
12812
12767
|
const conversationId = args.conversationId?.trim();
|
|
@@ -12821,26 +12776,6 @@ function buildSlackReplyFooter(args) {
|
|
|
12821
12776
|
}
|
|
12822
12777
|
items.push(idItem);
|
|
12823
12778
|
}
|
|
12824
|
-
const totalTokens = resolveTotalTokens(args.usage);
|
|
12825
|
-
if (totalTokens !== void 0) {
|
|
12826
|
-
items.push({
|
|
12827
|
-
label: "Tokens",
|
|
12828
|
-
value: formatSlackTokenCount(totalTokens)
|
|
12829
|
-
});
|
|
12830
|
-
}
|
|
12831
|
-
if (typeof args.durationMs === "number" && Number.isFinite(args.durationMs)) {
|
|
12832
|
-
const durationMs = Math.max(0, Math.floor(args.durationMs));
|
|
12833
|
-
items.push({
|
|
12834
|
-
label: "Time",
|
|
12835
|
-
value: formatSlackDuration(durationMs)
|
|
12836
|
-
});
|
|
12837
|
-
}
|
|
12838
|
-
if (args.thinkingLevel) {
|
|
12839
|
-
items.push({
|
|
12840
|
-
label: "Thinking",
|
|
12841
|
-
value: args.thinkingLevel
|
|
12842
|
-
});
|
|
12843
|
-
}
|
|
12844
12779
|
return items.length > 0 ? { items } : void 0;
|
|
12845
12780
|
}
|
|
12846
12781
|
function buildSlackReplyBlocks(text, footer) {
|
|
@@ -13585,10 +13520,7 @@ async function runAgentDispatchSlice(callback, deps = {}) {
|
|
|
13585
13520
|
channelId: dispatch.destination.channelId,
|
|
13586
13521
|
posts: planSlackReplyPosts({ reply: deliveryReply }),
|
|
13587
13522
|
footer: buildSlackReplyFooter({
|
|
13588
|
-
conversationId
|
|
13589
|
-
durationMs: deliveryReply.diagnostics.durationMs,
|
|
13590
|
-
thinkingLevel: deliveryReply.diagnostics.thinkingLevel,
|
|
13591
|
-
usage: deliveryReply.diagnostics.usage
|
|
13523
|
+
conversationId
|
|
13592
13524
|
}),
|
|
13593
13525
|
fileUploadFailureMode: "strict"
|
|
13594
13526
|
});
|
|
@@ -15821,10 +15753,6 @@ async function resumeSlackTurn(args) {
|
|
|
15821
15753
|
status.start();
|
|
15822
15754
|
const generateReply = runArgs.generateReply ?? generateAssistantReply;
|
|
15823
15755
|
const replyContext = createResumeReplyContext(runArgs, status);
|
|
15824
|
-
const priorSessionRecord = replyContext.correlation?.conversationId && replyContext.correlation?.turnId ? await getAgentTurnSessionRecord(
|
|
15825
|
-
replyContext.correlation.conversationId,
|
|
15826
|
-
replyContext.correlation.turnId
|
|
15827
|
-
) : void 0;
|
|
15828
15756
|
const replyPromise = generateReply(runArgs.messageText, replyContext);
|
|
15829
15757
|
const replyTimeoutMs = resolveReplyTimeoutMs(runArgs.replyTimeoutMs);
|
|
15830
15758
|
let reply = typeof replyTimeoutMs === "number" ? await Promise.race([
|
|
@@ -15847,13 +15775,7 @@ async function resumeSlackTurn(args) {
|
|
|
15847
15775
|
});
|
|
15848
15776
|
await status.stop();
|
|
15849
15777
|
const footer = buildSlackReplyFooter({
|
|
15850
|
-
conversationId: runArgs.replyContext?.correlation?.conversationId ?? lockKey
|
|
15851
|
-
durationMs: typeof priorSessionRecord?.cumulativeDurationMs === "number" || typeof reply.diagnostics.durationMs === "number" ? (priorSessionRecord?.cumulativeDurationMs ?? 0) + (reply.diagnostics.durationMs ?? 0) : void 0,
|
|
15852
|
-
thinkingLevel: reply.diagnostics.thinkingLevel,
|
|
15853
|
-
usage: addAgentTurnUsage(
|
|
15854
|
-
priorSessionRecord?.cumulativeUsage,
|
|
15855
|
-
reply.diagnostics.usage
|
|
15856
|
-
) ?? reply.diagnostics.usage
|
|
15778
|
+
conversationId: runArgs.replyContext?.correlation?.conversationId ?? lockKey
|
|
15857
15779
|
});
|
|
15858
15780
|
await postSlackApiReplyPosts({
|
|
15859
15781
|
channelId: runArgs.channelId,
|
|
@@ -20416,10 +20338,7 @@ function createReplyToThread(deps) {
|
|
|
20416
20338
|
);
|
|
20417
20339
|
const plannedPosts = planSlackReplyPosts({ reply });
|
|
20418
20340
|
const replyFooter = buildSlackReplyFooter({
|
|
20419
|
-
conversationId
|
|
20420
|
-
durationMs: reply.diagnostics.durationMs,
|
|
20421
|
-
thinkingLevel: reply.diagnostics.thinkingLevel,
|
|
20422
|
-
usage: reply.diagnostics.usage
|
|
20341
|
+
conversationId
|
|
20423
20342
|
});
|
|
20424
20343
|
const shouldUseSlackFooter = Boolean(replyFooter) && Boolean(channelId && threadTs) && thread.adapter?.name === "slack";
|
|
20425
20344
|
if (plannedPosts.length > 0) {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { TurnThinkingSelection } from "@/chat/services/turn-thinking-level";
|
|
2
|
-
import type { AgentTurnUsage } from "@/chat/usage";
|
|
3
1
|
interface SlackMrkdwnTextObject {
|
|
4
2
|
text: string;
|
|
5
3
|
type: "mrkdwn";
|
|
@@ -27,15 +25,12 @@ export interface SlackReplyFooter {
|
|
|
27
25
|
items: SlackReplyFooterItem[];
|
|
28
26
|
}
|
|
29
27
|
/**
|
|
30
|
-
* Build
|
|
28
|
+
* Build the compact conversation footer for the finalized Slack reply.
|
|
31
29
|
*
|
|
32
|
-
*
|
|
30
|
+
* Detailed turn metrics stay in the dashboard instead of Slack-visible copy.
|
|
33
31
|
*/
|
|
34
32
|
export declare function buildSlackReplyFooter(args: {
|
|
35
33
|
conversationId?: string;
|
|
36
|
-
durationMs?: number;
|
|
37
|
-
thinkingLevel?: TurnThinkingSelection["thinkingLevel"];
|
|
38
|
-
usage?: AgentTurnUsage;
|
|
39
34
|
}): SlackReplyFooter | undefined;
|
|
40
35
|
/** Build Slack blocks for a reply chunk using the Slack-flavored markdown block for the body. */
|
|
41
36
|
export declare function buildSlackReplyBlocks(text: string, footer: SlackReplyFooter | undefined): SlackMessageBlock[] | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.68.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"node-html-markdown": "^2.0.0",
|
|
66
66
|
"yaml": "^2.9.0",
|
|
67
67
|
"zod": "^4.4.3",
|
|
68
|
-
"@sentry/junior-plugin-api": "0.
|
|
68
|
+
"@sentry/junior-plugin-api": "0.68.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@types/node": "^25.9.1",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"typescript": "^6.0.3",
|
|
78
78
|
"vercel": "^54.4.0",
|
|
79
79
|
"vitest": "^4.1.7",
|
|
80
|
-
"@sentry/junior-scheduler": "0.
|
|
80
|
+
"@sentry/junior-scheduler": "0.68.0"
|
|
81
81
|
},
|
|
82
82
|
"scripts": {
|
|
83
83
|
"build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",
|