@sentry/junior 0.121.0 → 0.122.1
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-CQDGDBCP.js → agent-hooks-65WXVKKX.js} +8 -8
- package/dist/api.js +14 -14
- package/dist/app.js +604 -997
- package/dist/{catalog-runtime-AD3YNTTM.js → catalog-runtime-VNNMSKCB.js} +5 -5
- package/dist/chat/agent/index.d.ts +19 -2
- package/dist/chat/agent/request.d.ts +8 -8
- package/dist/chat/agent/resume.d.ts +1 -3
- package/dist/chat/agent/retry-usage.d.ts +8 -0
- package/dist/chat/agent/skills.d.ts +0 -9
- package/dist/chat/conversations/messages.d.ts +7 -0
- package/dist/chat/conversations/projection.d.ts +16 -0
- package/dist/chat/logging.d.ts +46 -13
- package/dist/chat/mcp/tool-manager.d.ts +11 -0
- package/dist/chat/plugins/agent-hooks.d.ts +8 -0
- package/dist/chat/runtime/processing-reaction.d.ts +2 -4
- package/dist/chat/runtime/slack-runtime.d.ts +2 -2
- package/dist/chat/services/assistant-reply.d.ts +16 -0
- package/dist/chat/services/empty-output-continuation.d.ts +20 -0
- package/dist/chat/services/turn-failure-response.d.ts +1 -3
- package/dist/chat/services/turn-result.d.ts +0 -5
- package/dist/chat/services/turn-session-record.d.ts +0 -11
- package/dist/chat/tool-support/zod-tool.d.ts +11 -6
- package/dist/chat/tools/execute-tool.d.ts +1 -33
- package/dist/chat/tools/execution/tool-error-handler.d.ts +2 -2
- package/dist/chat/tools/query-conversation-events.d.ts +3 -1
- package/dist/chat/tools/sandbox/bash.d.ts +1 -33
- package/dist/chat/tools/sandbox/edit-file.d.ts +1 -33
- package/dist/chat/tools/sandbox/find-files.d.ts +1 -33
- package/dist/chat/tools/sandbox/grep.d.ts +1 -33
- package/dist/chat/tools/sandbox/list-dir.d.ts +1 -33
- package/dist/chat/tools/sandbox/read-file.d.ts +1 -33
- package/dist/chat/tools/sandbox/write-file.d.ts +1 -33
- package/dist/{chunk-VWBKDPMQ.js → chunk-3KYLHUVC.js} +487 -686
- package/dist/{chunk-JZ47AFSH.js → chunk-4JPJTFUH.js} +37 -45
- package/dist/{chunk-ET2SDCNV.js → chunk-4ZV2GNHX.js} +16 -31
- package/dist/{chunk-WUP7NWMP.js → chunk-73TQBD5S.js} +1 -1
- package/dist/{chunk-Z2XXPUZG.js → chunk-BXT63TNS.js} +2061 -2015
- package/dist/{chunk-JYDIBXFY.js → chunk-GPQLJDT5.js} +13 -19
- package/dist/{chunk-LE77HHF3.js → chunk-HGREP4UX.js} +1 -1
- package/dist/{chunk-XDRGYDED.js → chunk-IEE5CSAP.js} +1 -1
- package/dist/{chunk-D2EMOH3N.js → chunk-LZ4XXS76.js} +3 -3
- package/dist/{chunk-254MFDOF.js → chunk-M7KAZXTE.js} +2 -2
- package/dist/{chunk-ITMEXX5H.js → chunk-MSDKKTRG.js} +4 -4
- package/dist/{chunk-UXQ5XSA2.js → chunk-PXPBBOIU.js} +2 -2
- package/dist/{chunk-IK4QSS5H.js → chunk-PYS4QZAF.js} +1 -1
- package/dist/{chunk-7HYV7KFM.js → chunk-QE33ATQW.js} +83 -92
- package/dist/{chunk-HDFGNU5E.js → chunk-S7G34U75.js} +3 -1
- package/dist/{chunk-IDXLBKPS.js → chunk-TI7SYDD4.js} +11 -22
- package/dist/{chunk-3DBMANUI.js → chunk-U5PRRZMZ.js} +22 -45
- package/dist/{chunk-KLUMVJRQ.js → chunk-VLRECFIC.js} +133 -206
- package/dist/{chunk-UURFXX66.js → chunk-WFJ2EG4E.js} +1 -1
- package/dist/{chunk-TRECK7RV.js → chunk-XBYNPBPQ.js} +14 -29
- package/dist/cli/chat.js +22 -22
- package/dist/cli/check.js +6 -6
- package/dist/cli/plugins.js +11 -11
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +6 -6
- package/dist/{db-7HQT2SXQ.js → db-36HXKAKH.js} +6 -6
- package/dist/instrumentation.js +3 -3
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-VHTUCNHK.js → oauth-callback-server-UKOO7KKP.js} +15 -15
- package/dist/{runner-3ONPZRED.js → runner-M66KMCQ7.js} +62 -51
- package/dist/{skills-WGAYGGPA.js → skills-TTXTVFOG.js} +6 -6
- package/dist/{validation-ZIWNBG4D.js → validation-TGASRGNN.js} +6 -6
- package/dist/version.js +1 -1
- package/package.json +8 -8
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./chunk-6GWA276C.js";
|
|
14
14
|
import {
|
|
15
15
|
getDeploymentTelemetryAttributes
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-PYS4QZAF.js";
|
|
17
17
|
|
|
18
18
|
// src/chat/logging.ts
|
|
19
19
|
import path from "path";
|
|
@@ -100,6 +100,7 @@ function normalizeIdentityEmail(email) {
|
|
|
100
100
|
|
|
101
101
|
// src/chat/logging.ts
|
|
102
102
|
var MAX_STRING_VALUE = 1200;
|
|
103
|
+
var EVENT_NAME_PATTERN = /^[a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*)+$/;
|
|
103
104
|
var SECRETS_RE = [
|
|
104
105
|
/\b(sk-[A-Za-z0-9_-]{20,})\b/g,
|
|
105
106
|
/\b(xox[baprs]-[A-Za-z0-9-]{10,})\b/g,
|
|
@@ -332,6 +333,16 @@ function redactSecrets(input) {
|
|
|
332
333
|
function toSnakeCase(value) {
|
|
333
334
|
return value.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^a-zA-Z0-9_]+/g, "_").replace(/^_+|_+$/g, "").toLowerCase();
|
|
334
335
|
}
|
|
336
|
+
function normalizeEventName(value) {
|
|
337
|
+
const segments = value.trim().split(".").map(toSnakeCase).filter(Boolean);
|
|
338
|
+
const normalized = segments.length === 0 ? "log.record.emitted" : segments.length === 1 ? `app.${segments[0]}` : segments.join(".");
|
|
339
|
+
if (process.env.NODE_ENV !== "production" && (!EVENT_NAME_PATTERN.test(value) || value !== normalized)) {
|
|
340
|
+
throw new Error(
|
|
341
|
+
`Invalid log event name "${value}"; use lowercase dot-delimited namespaces`
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
return normalized;
|
|
345
|
+
}
|
|
335
346
|
function isSemanticKey(key) {
|
|
336
347
|
return /^[a-z][a-z0-9_]*(\.[a-z0-9_][a-z0-9_-]*)+$/.test(key);
|
|
337
348
|
}
|
|
@@ -340,6 +351,9 @@ function normalizeAttributeKey(key) {
|
|
|
340
351
|
if (mapped) {
|
|
341
352
|
return mapped;
|
|
342
353
|
}
|
|
354
|
+
if (key === "trace_id" || key === "span_id" || key === "trace_flags") {
|
|
355
|
+
return key;
|
|
356
|
+
}
|
|
343
357
|
if (isSemanticKey(key)) {
|
|
344
358
|
return key;
|
|
345
359
|
}
|
|
@@ -449,7 +463,7 @@ function toEmittedLogRecord(record) {
|
|
|
449
463
|
const body = toOptionalString(rawBody) ?? record.message.map(
|
|
450
464
|
(segment) => typeof segment === "string" ? segment : String(segment ?? "")
|
|
451
465
|
).join("");
|
|
452
|
-
const eventName = toOptionalString(attributes["event.name"]) ?? "
|
|
466
|
+
const eventName = toOptionalString(attributes["event.name"]) ?? "log.record.emitted";
|
|
453
467
|
return {
|
|
454
468
|
level: fromLogTapeLevel(record.level),
|
|
455
469
|
eventName,
|
|
@@ -592,7 +606,7 @@ function formatConsoleValue(value) {
|
|
|
592
606
|
return quoteConsoleValue(value);
|
|
593
607
|
}
|
|
594
608
|
function shouldShowConsoleDestinationName(eventName) {
|
|
595
|
-
return /^(
|
|
609
|
+
return /^(app_home|oauth|queue|slash_command|slack|webhook)\./.test(
|
|
596
610
|
eventName
|
|
597
611
|
);
|
|
598
612
|
}
|
|
@@ -600,7 +614,7 @@ function shouldShowConsoleModel(level, eventName) {
|
|
|
600
614
|
if (level === "warn" || level === "error") {
|
|
601
615
|
return true;
|
|
602
616
|
}
|
|
603
|
-
return eventName.startsWith("
|
|
617
|
+
return eventName.startsWith("ai.") || eventName.startsWith("assistant.") || eventName === "agent.turn.started" || eventName === "agent.turn.completed" || eventName === "agent.turn.provider_error";
|
|
604
618
|
}
|
|
605
619
|
function shouldHideConsoleAttribute(level, eventName, key, attributes) {
|
|
606
620
|
if (CONSOLE_ALWAYS_HIDDEN_KEYS.has(key)) {
|
|
@@ -621,10 +635,10 @@ function shouldHideConsoleAttribute(level, eventName, key, attributes) {
|
|
|
621
635
|
if (key === "gen_ai.request.model" && !shouldShowConsoleModel(level, eventName)) {
|
|
622
636
|
return true;
|
|
623
637
|
}
|
|
624
|
-
if (key === "gen_ai.provider.name" && eventName.startsWith("
|
|
638
|
+
if (key === "gen_ai.provider.name" && eventName.startsWith("agent.tool_call.") && level !== "warn" && level !== "error") {
|
|
625
639
|
return true;
|
|
626
640
|
}
|
|
627
|
-
if (key === "gen_ai.operation.name" && eventName.startsWith("
|
|
641
|
+
if (key === "gen_ai.operation.name" && eventName.startsWith("agent.tool_call.")) {
|
|
628
642
|
return true;
|
|
629
643
|
}
|
|
630
644
|
return false;
|
|
@@ -673,7 +687,7 @@ function booleanConsoleToken(label, value) {
|
|
|
673
687
|
return typeof value === "boolean" ? `${label}=${value ? "yes" : "no"}` : void 0;
|
|
674
688
|
}
|
|
675
689
|
function shouldShowPrettyCorrelation(eventName) {
|
|
676
|
-
return !(eventName === "
|
|
690
|
+
return !(eventName === "plugin.loaded" || eventName === "startup.discovery.completed" || eventName.endsWith(".loaded"));
|
|
677
691
|
}
|
|
678
692
|
function getPrettyConsoleSummaryTokens(level, eventName, attributes) {
|
|
679
693
|
const tokens = [];
|
|
@@ -683,7 +697,7 @@ function getPrettyConsoleSummaryTokens(level, eventName, attributes) {
|
|
|
683
697
|
);
|
|
684
698
|
pushPrettyConsoleToken(
|
|
685
699
|
tokens,
|
|
686
|
-
eventName.startsWith("
|
|
700
|
+
eventName.startsWith("plugin.heartbeat.") ? stringConsoleToken("plugin", attributes["app.plugin.name"]) : toOptionalString(attributes["app.plugin.name"]) ?? void 0
|
|
687
701
|
);
|
|
688
702
|
pushPrettyConsoleToken(
|
|
689
703
|
tokens,
|
|
@@ -733,7 +747,7 @@ function getPrettyConsoleSummaryTokens(level, eventName, attributes) {
|
|
|
733
747
|
);
|
|
734
748
|
}
|
|
735
749
|
const filePath = toOptionalString(attributes["file.path"]);
|
|
736
|
-
if (filePath && eventName.endsWith("
|
|
750
|
+
if (filePath && eventName.endsWith(".loaded")) {
|
|
737
751
|
pushPrettyConsoleToken(tokens, toRelativeConsolePath(filePath));
|
|
738
752
|
}
|
|
739
753
|
if (shouldShowPrettyCorrelation(eventName)) {
|
|
@@ -860,7 +874,7 @@ function emitDirect(level, eventName, body, attributes) {
|
|
|
860
874
|
function emitRecord(category, level, eventName, attrs = {}, body) {
|
|
861
875
|
ensureLoggerBackend();
|
|
862
876
|
const traceAttributes = getTraceCorrelationAttributes();
|
|
863
|
-
const normalizedEventName =
|
|
877
|
+
const normalizedEventName = normalizeEventName(eventName);
|
|
864
878
|
const message = body ? redactSecrets(body) : normalizedEventName;
|
|
865
879
|
const source = getLogSource([...ROOT_LOGGER_CATEGORY, ...category]);
|
|
866
880
|
const contextAttributes = ownsLogTapeBackend ? void 0 : getBoundLogAttributes();
|
|
@@ -914,7 +928,7 @@ var log = {
|
|
|
914
928
|
error(eventName, attrs = {}, body) {
|
|
915
929
|
emit("error", eventName, attrs, body);
|
|
916
930
|
},
|
|
917
|
-
exception(eventName, error, attrs = {}, body
|
|
931
|
+
exception(eventName, error, attrs = {}, body) {
|
|
918
932
|
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
919
933
|
emit(
|
|
920
934
|
"error",
|
|
@@ -926,17 +940,14 @@ var log = {
|
|
|
926
940
|
"exception.message": normalizedError.message,
|
|
927
941
|
"exception.stacktrace": normalizedError.stack
|
|
928
942
|
},
|
|
929
|
-
body
|
|
943
|
+
body
|
|
930
944
|
);
|
|
931
945
|
let eventId;
|
|
932
946
|
const sentryWithScope = withScope;
|
|
933
947
|
const sentryCaptureException = captureException;
|
|
934
948
|
if (typeof sentryWithScope === "function" && typeof sentryCaptureException === "function") {
|
|
935
949
|
sentryWithScope((scope) => {
|
|
936
|
-
setSentryScopeContext(scope,
|
|
937
|
-
...getBoundLogContext(),
|
|
938
|
-
...context
|
|
939
|
-
});
|
|
950
|
+
setSentryScopeContext(scope, getBoundLogContext());
|
|
940
951
|
for (const [key, value] of Object.entries(
|
|
941
952
|
mergeAttributes(getBoundLogAttributes(), attrs)
|
|
942
953
|
)) {
|
|
@@ -947,12 +958,7 @@ var log = {
|
|
|
947
958
|
return eventId;
|
|
948
959
|
}
|
|
949
960
|
if (typeof sentryCaptureException === "function") {
|
|
950
|
-
setSentryUser(
|
|
951
|
-
sentryUserIdentityFromContext({
|
|
952
|
-
...getBoundLogContext(),
|
|
953
|
-
...context
|
|
954
|
-
})
|
|
955
|
-
);
|
|
961
|
+
setSentryUser(sentryUserIdentityFromContext(getBoundLogContext()));
|
|
956
962
|
eventId = sentryCaptureException(normalizedError);
|
|
957
963
|
}
|
|
958
964
|
return eventId;
|
|
@@ -1007,7 +1013,7 @@ function createChatSdkLoggerImpl(category, minimumLevel) {
|
|
|
1007
1013
|
emitRecord(
|
|
1008
1014
|
category,
|
|
1009
1015
|
level === "warn" ? "warn" : level,
|
|
1010
|
-
level === "error" ? "
|
|
1016
|
+
level === "error" ? "chat_sdk.log.error" : level === "warn" ? "chat_sdk.log.warn" : "chat_sdk.log",
|
|
1011
1017
|
args.length > 0 ? {
|
|
1012
1018
|
"app.log.args": args.length === 1 ? args[0] : args
|
|
1013
1019
|
} : {},
|
|
@@ -1071,14 +1077,6 @@ function createLogContextFromRequest(request, context = {}) {
|
|
|
1071
1077
|
userAgent: request.headers.get("user-agent") ?? void 0
|
|
1072
1078
|
};
|
|
1073
1079
|
}
|
|
1074
|
-
function toSpanAttributes(context) {
|
|
1075
|
-
const attrs = contextToAttributes(context);
|
|
1076
|
-
return Object.fromEntries(
|
|
1077
|
-
Object.entries(attrs).filter(
|
|
1078
|
-
([, value]) => typeof value === "string" && value.length > 0
|
|
1079
|
-
)
|
|
1080
|
-
);
|
|
1081
|
-
}
|
|
1082
1080
|
function setSentryTagsFromContext(context) {
|
|
1083
1081
|
const attrs = contextToAttributes(context);
|
|
1084
1082
|
for (const [key, value] of Object.entries(attrs)) {
|
|
@@ -1161,24 +1159,18 @@ function setAttributesOnSpan(span, attributes) {
|
|
|
1161
1159
|
span.setAttribute(key, value);
|
|
1162
1160
|
}
|
|
1163
1161
|
}
|
|
1164
|
-
function logInfo(eventName,
|
|
1165
|
-
log.info(eventName,
|
|
1162
|
+
function logInfo(eventName, attributes = {}) {
|
|
1163
|
+
log.info(eventName, attributes);
|
|
1166
1164
|
}
|
|
1167
|
-
function logWarn(eventName,
|
|
1168
|
-
log.warn(eventName,
|
|
1165
|
+
function logWarn(eventName, attributes = {}) {
|
|
1166
|
+
log.warn(eventName, attributes);
|
|
1169
1167
|
}
|
|
1170
|
-
function logError(eventName,
|
|
1171
|
-
log.error(eventName,
|
|
1168
|
+
function logError(eventName, attributes = {}) {
|
|
1169
|
+
log.error(eventName, attributes);
|
|
1172
1170
|
}
|
|
1173
|
-
function logException(error, eventName,
|
|
1171
|
+
function logException(error, eventName, attributes = {}) {
|
|
1174
1172
|
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
1175
|
-
return log.exception(
|
|
1176
|
-
eventName,
|
|
1177
|
-
normalizedError,
|
|
1178
|
-
{ ...toSpanAttributes(context), ...attributes },
|
|
1179
|
-
body,
|
|
1180
|
-
context
|
|
1181
|
-
);
|
|
1173
|
+
return log.exception(eventName, normalizedError, attributes);
|
|
1182
1174
|
}
|
|
1183
1175
|
function setTags(context = {}) {
|
|
1184
1176
|
updateLogContext(context, contextToAttributes(context));
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
logInfo,
|
|
6
6
|
logWarn,
|
|
7
7
|
setSpanAttributes
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-4JPJTFUH.js";
|
|
9
9
|
import {
|
|
10
10
|
discoverInstalledPluginPackageContent,
|
|
11
11
|
normalizePluginPackageNames
|
|
@@ -1837,15 +1837,10 @@ function buildLoadedPluginState(source, config) {
|
|
|
1837
1837
|
try {
|
|
1838
1838
|
rootStat = statSync(pluginsRoot);
|
|
1839
1839
|
} catch (error) {
|
|
1840
|
-
logWarn(
|
|
1841
|
-
"
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
"file.directory": pluginsRoot,
|
|
1845
|
-
"exception.message": error instanceof Error ? error.message : String(error)
|
|
1846
|
-
},
|
|
1847
|
-
"Failed to read plugin root"
|
|
1848
|
-
);
|
|
1840
|
+
logWarn("plugin.root.read.failed", {
|
|
1841
|
+
"file.directory": pluginsRoot,
|
|
1842
|
+
"exception.message": error instanceof Error ? error.message : String(error)
|
|
1843
|
+
});
|
|
1849
1844
|
continue;
|
|
1850
1845
|
}
|
|
1851
1846
|
if (rootStat.isDirectory()) {
|
|
@@ -1865,15 +1860,10 @@ function buildLoadedPluginState(source, config) {
|
|
|
1865
1860
|
try {
|
|
1866
1861
|
entries = readdirSync(pluginsRoot);
|
|
1867
1862
|
} catch (error) {
|
|
1868
|
-
logWarn(
|
|
1869
|
-
"
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
"file.directory": pluginsRoot,
|
|
1873
|
-
"exception.message": error instanceof Error ? error.message : String(error)
|
|
1874
|
-
},
|
|
1875
|
-
"Failed to read plugin root"
|
|
1876
|
-
);
|
|
1863
|
+
logWarn("plugin.root.read.failed", {
|
|
1864
|
+
"file.directory": pluginsRoot,
|
|
1865
|
+
"exception.message": error instanceof Error ? error.message : String(error)
|
|
1866
|
+
});
|
|
1877
1867
|
continue;
|
|
1878
1868
|
}
|
|
1879
1869
|
for (const entry of entries.sort()) {
|
|
@@ -1912,18 +1902,13 @@ function logLoadedPlugins(state) {
|
|
|
1912
1902
|
continue;
|
|
1913
1903
|
}
|
|
1914
1904
|
loggedPluginNames.add(plugin.manifest.name);
|
|
1915
|
-
logInfo(
|
|
1916
|
-
"
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
"file.directory": plugin.dir,
|
|
1923
|
-
...plugin.skillsDir ? { "app.file.skill_directory": plugin.skillsDir } : {}
|
|
1924
|
-
},
|
|
1925
|
-
"Loaded plugin"
|
|
1926
|
-
);
|
|
1905
|
+
logInfo("plugin.loaded", {
|
|
1906
|
+
"app.plugin.name": plugin.manifest.name,
|
|
1907
|
+
"app.plugin.config_key_count": plugin.manifest.configKeys.length,
|
|
1908
|
+
"app.plugin.has_mcp": Boolean(plugin.manifest.mcp),
|
|
1909
|
+
"file.directory": plugin.dir,
|
|
1910
|
+
...plugin.skillsDir ? { "app.file.skill_directory": plugin.skillsDir } : {}
|
|
1911
|
+
});
|
|
1927
1912
|
}
|
|
1928
1913
|
}
|
|
1929
1914
|
function ensurePluginsLoaded(runtime) {
|