@sentry/junior 0.116.0 → 0.117.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-67NFITDH.js → agent-hooks-5IK4LPLP.js} +8 -8
- package/dist/api/conversations/detail.d.ts +7 -0
- package/dist/api/conversations/event-list.d.ts +7 -0
- package/dist/api/conversations/events.d.ts +1 -1
- package/dist/api/schema/conversation.d.ts +28 -0
- package/dist/api/schema.js +1 -1
- package/dist/api.js +25 -12
- package/dist/app.js +32 -30
- package/dist/{catalog-runtime-CWZY6GTH.js → catalog-runtime-MTUYW3AA.js} +5 -5
- package/dist/chat/agent/prompt.d.ts +2 -0
- package/dist/chat/agent/request.d.ts +2 -1
- package/dist/chat/agent/resume.d.ts +2 -0
- package/dist/chat/agent/tools.d.ts +1 -0
- package/dist/chat/conversations/history.d.ts +22 -1
- package/dist/chat/conversations/projection.d.ts +6 -0
- package/dist/chat/mcp/client.d.ts +4 -0
- package/dist/chat/mcp/errors.d.ts +22 -1
- package/dist/chat/oauth-response.d.ts +21 -0
- package/dist/chat/plugins/prompt.d.ts +9 -0
- package/dist/chat/plugins/types.d.ts +2 -21
- package/dist/chat/sandbox/snapshot/install.d.ts +6 -0
- package/dist/chat/sandbox/snapshot/profile.d.ts +14 -0
- package/dist/chat/sandbox/snapshot/resolve.d.ts +22 -0
- package/dist/chat/sandbox/snapshot/span.d.ts +2 -0
- package/dist/chat/services/context-compaction-marker.d.ts +1 -0
- package/dist/chat/services/turn-session-record.d.ts +2 -0
- package/dist/chat/state/turn-session.d.ts +2 -0
- package/dist/chat/tools/query-conversation-events.d.ts +1 -1
- package/dist/chat/tools/sandbox/view-image.d.ts +11 -0
- package/dist/chat/tools/types.d.ts +7 -0
- package/dist/{chunk-OF5FODBL.js → chunk-27KWTFP6.js} +33 -12
- package/dist/{chunk-MGH5ADQS.js → chunk-3GE3F4LT.js} +1 -1
- package/dist/{chunk-JZPQ5K4V.js → chunk-5O3JDQDG.js} +154 -20
- package/dist/{chunk-PGKWXHYJ.js → chunk-6G45D3YG.js} +114 -10
- package/dist/{chunk-3JOGUT46.js → chunk-72Z3HNTQ.js} +1 -1
- package/dist/{chunk-6RQ5GCWH.js → chunk-AKG4TZNH.js} +2 -2
- package/dist/{chunk-TC4ZEM2D.js → chunk-BFIRIZPH.js} +9 -0
- package/dist/{chunk-25GU5B5E.js → chunk-CU7HTGNI.js} +1 -1
- package/dist/{chunk-PZGPCOSD.js → chunk-DS27ZBSP.js} +4 -2
- package/dist/{chunk-3H45VOBZ.js → chunk-FAWBONPC.js} +404 -391
- package/dist/{chunk-53ZKTQO6.js → chunk-KU6ALEJC.js} +1 -1
- package/dist/{chunk-UEVLIYK5.js → chunk-LN765Y4N.js} +6 -6
- package/dist/{chunk-4DD6AOCG.js → chunk-LUMEBOWC.js} +1 -1
- package/dist/{chunk-5UNB623T.js → chunk-NHZEUHKH.js} +514 -344
- package/dist/{chunk-VZCSLYCE.js → chunk-STUI6NIL.js} +78 -16
- package/dist/{chunk-BXLS3I4W.js → chunk-W5JEQQEA.js} +1 -1
- package/dist/{chunk-VKZ6WVAY.js → chunk-WEK3V5RI.js} +73 -32
- package/dist/{chunk-N7TMYLF2.js → chunk-WUNPRM76.js} +1 -1
- package/dist/{chunk-CI3VK7X5.js → chunk-YRWJ3KEU.js} +2 -2
- package/dist/{chunk-KBNDFU6J.js → chunk-ZRQUQJUV.js} +12 -2
- package/dist/cli/chat.js +21 -21
- package/dist/cli/check.js +6 -6
- package/dist/cli/main.js +1 -1
- package/dist/cli/plugins.js +11 -11
- package/dist/cli/{snapshot-warmup.js → snapshot-create.js} +17 -19
- package/dist/cli/upgrade.js +5 -5
- package/dist/{db-57FHVGGQ.js → db-J2ITKS63.js} +5 -5
- package/dist/handlers/oauth-html.d.ts +4 -2
- package/dist/instrumentation.js +2 -2
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-PAQRPXZX.js → oauth-callback-server-NQYKBT24.js} +15 -15
- package/dist/{runner-4ISZYJEX.js → runner-53V5GIQM.js} +10 -10
- package/dist/{skills-UE2KXQMB.js → skills-BU3ZMLVB.js} +6 -6
- package/dist/{validation-PO5LHTJT.js → validation-74EIKKE6.js} +6 -6
- package/dist/version.js +1 -1
- package/package.json +6 -6
- package/dist/chat/sandbox/runtime-dependency-snapshots.d.ts +0 -20
|
@@ -1,38 +1,41 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getInterruptionMarker
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-27KWTFP6.js";
|
|
4
4
|
import {
|
|
5
5
|
createPluginLogger,
|
|
6
6
|
getPlugins
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-STUI6NIL.js";
|
|
8
8
|
import {
|
|
9
9
|
acquireActiveLock,
|
|
10
10
|
getStateAdapter
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-KU6ALEJC.js";
|
|
12
12
|
import {
|
|
13
13
|
SlackActionError,
|
|
14
14
|
getSlackClient,
|
|
15
15
|
isDmChannel,
|
|
16
16
|
normalizeSlackConversationId,
|
|
17
17
|
withSlackRetries
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-YRWJ3KEU.js";
|
|
19
19
|
import {
|
|
20
20
|
getDb,
|
|
21
21
|
parseDestination
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-ZRQUQJUV.js";
|
|
23
23
|
import {
|
|
24
24
|
sleep
|
|
25
25
|
} from "./chunk-4ZNGQH7C.js";
|
|
26
26
|
import {
|
|
27
27
|
normalizeSlackEmojiName
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-DS27ZBSP.js";
|
|
29
29
|
import {
|
|
30
30
|
pluginCatalogRuntime
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-CU7HTGNI.js";
|
|
32
|
+
import {
|
|
33
|
+
fetchWithBoundedOAuthErrorBodies
|
|
34
|
+
} from "./chunk-5O3JDQDG.js";
|
|
32
35
|
import {
|
|
33
36
|
logInfo,
|
|
34
37
|
logWarn
|
|
35
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-72Z3HNTQ.js";
|
|
36
39
|
import {
|
|
37
40
|
isRecord
|
|
38
41
|
} from "./chunk-OB42YVAE.js";
|
|
@@ -903,6 +906,79 @@ async function startOAuthFlow(provider, input) {
|
|
|
903
906
|
};
|
|
904
907
|
}
|
|
905
908
|
|
|
909
|
+
// src/chat/mcp/errors.ts
|
|
910
|
+
var McpProviderError = class extends Error {
|
|
911
|
+
phase;
|
|
912
|
+
provider;
|
|
913
|
+
missingSession;
|
|
914
|
+
resourceHost;
|
|
915
|
+
status;
|
|
916
|
+
constructor(details) {
|
|
917
|
+
super(`MCP provider ${details.phase.replace("_", " ")} failed`);
|
|
918
|
+
this.name = "McpProviderError";
|
|
919
|
+
this.phase = details.phase;
|
|
920
|
+
this.provider = details.provider;
|
|
921
|
+
this.missingSession = details.missingSession;
|
|
922
|
+
this.resourceHost = details.resourceHost;
|
|
923
|
+
this.status = details.status;
|
|
924
|
+
}
|
|
925
|
+
};
|
|
926
|
+
function providerStatus(error) {
|
|
927
|
+
if (!error || typeof error !== "object") {
|
|
928
|
+
return void 0;
|
|
929
|
+
}
|
|
930
|
+
const value = error;
|
|
931
|
+
const status = typeof value.status === "number" ? value.status : typeof value.code === "number" ? value.code : void 0;
|
|
932
|
+
return status !== void 0 && status >= 100 && status <= 599 ? status : void 0;
|
|
933
|
+
}
|
|
934
|
+
function toMcpProviderError(error, details) {
|
|
935
|
+
if (error instanceof McpProviderError) {
|
|
936
|
+
return error;
|
|
937
|
+
}
|
|
938
|
+
return new McpProviderError({
|
|
939
|
+
...details,
|
|
940
|
+
status: details.status ?? providerStatus(error)
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
function getMcpProviderErrorAttributes(error) {
|
|
944
|
+
if (!(error instanceof McpProviderError)) {
|
|
945
|
+
return {};
|
|
946
|
+
}
|
|
947
|
+
return {
|
|
948
|
+
"app.credential.provider": error.provider,
|
|
949
|
+
"app.mcp.error.phase": error.phase,
|
|
950
|
+
...error.status !== void 0 ? { "http.response.status_code": error.status } : {},
|
|
951
|
+
...error.resourceHost ? { "server.address": error.resourceHost } : {}
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
var McpToolError = class extends Error {
|
|
955
|
+
constructor(message) {
|
|
956
|
+
super(message);
|
|
957
|
+
this.name = "McpToolError";
|
|
958
|
+
}
|
|
959
|
+
};
|
|
960
|
+
function getMcpAwareErrorType(error, fallback) {
|
|
961
|
+
if (error instanceof McpToolError) {
|
|
962
|
+
return "tool_error";
|
|
963
|
+
}
|
|
964
|
+
if (error instanceof McpProviderError) {
|
|
965
|
+
return "mcp_provider_error";
|
|
966
|
+
}
|
|
967
|
+
return error instanceof Error ? error.name : fallback;
|
|
968
|
+
}
|
|
969
|
+
function getMcpAwareErrorMessage(error) {
|
|
970
|
+
return error instanceof Error ? error.message : String(error);
|
|
971
|
+
}
|
|
972
|
+
function getMcpAwareTelemetryMessage(error, _privacy) {
|
|
973
|
+
if (error instanceof McpToolError) {
|
|
974
|
+
return "MCP tool call failed";
|
|
975
|
+
}
|
|
976
|
+
if (error instanceof McpProviderError) {
|
|
977
|
+
return error.message;
|
|
978
|
+
}
|
|
979
|
+
return getMcpAwareErrorMessage(error);
|
|
980
|
+
}
|
|
981
|
+
|
|
906
982
|
// src/chat/mcp/auth-store.ts
|
|
907
983
|
import {
|
|
908
984
|
sourceSchema as sourceSchema2
|
|
@@ -1414,14 +1490,36 @@ async function finalizeMcpAuthorization(provider, authSessionId, authorizationCo
|
|
|
1414
1490
|
if (mcp.headers && Object.keys(mcp.headers).length > 0) {
|
|
1415
1491
|
requestInit.headers = new Headers(mcp.headers);
|
|
1416
1492
|
}
|
|
1493
|
+
let providerStatus2;
|
|
1417
1494
|
const transport = new StreamableHTTPClientTransport(new URL(mcp.url), {
|
|
1418
1495
|
...Object.keys(requestInit).length > 0 ? { requestInit } : {},
|
|
1419
|
-
authProvider
|
|
1496
|
+
authProvider,
|
|
1497
|
+
fetch: fetchWithBoundedOAuthErrorBodies(void 0, (status) => {
|
|
1498
|
+
providerStatus2 = status;
|
|
1499
|
+
})
|
|
1420
1500
|
});
|
|
1501
|
+
let failure;
|
|
1421
1502
|
try {
|
|
1422
1503
|
await transport.finishAuth(authorizationCode);
|
|
1423
|
-
}
|
|
1504
|
+
} catch (error) {
|
|
1505
|
+
failure = toMcpProviderError(error, {
|
|
1506
|
+
phase: "oauth_callback",
|
|
1507
|
+
provider,
|
|
1508
|
+
resourceHost: new URL(mcp.url).hostname,
|
|
1509
|
+
status: providerStatus2
|
|
1510
|
+
});
|
|
1511
|
+
}
|
|
1512
|
+
try {
|
|
1424
1513
|
await transport.close();
|
|
1514
|
+
} catch (error) {
|
|
1515
|
+
failure ??= toMcpProviderError(error, {
|
|
1516
|
+
phase: "oauth_callback",
|
|
1517
|
+
provider,
|
|
1518
|
+
resourceHost: new URL(mcp.url).hostname
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
if (failure) {
|
|
1522
|
+
throw failure;
|
|
1425
1523
|
}
|
|
1426
1524
|
const nextSession = await getMcpAuthSession(authSessionId);
|
|
1427
1525
|
if (!nextSession) {
|
|
@@ -1853,6 +1951,12 @@ export {
|
|
|
1853
1951
|
resolveBaseUrl,
|
|
1854
1952
|
deliverOAuthAuthorization,
|
|
1855
1953
|
startOAuthFlow,
|
|
1954
|
+
McpProviderError,
|
|
1955
|
+
toMcpProviderError,
|
|
1956
|
+
getMcpProviderErrorAttributes,
|
|
1957
|
+
McpToolError,
|
|
1958
|
+
getMcpAwareErrorType,
|
|
1959
|
+
getMcpAwareTelemetryMessage,
|
|
1856
1960
|
getMcpAuthSession,
|
|
1857
1961
|
patchMcpAuthSession,
|
|
1858
1962
|
deleteMcpAuthSession,
|
|
@@ -155,6 +155,14 @@ var conversationReportTurnRoutedEventDataSchema = z2.object({
|
|
|
155
155
|
confidence: z2.number().min(0).max(1).optional(),
|
|
156
156
|
source: z2.enum(["configured", "inherited", "router"])
|
|
157
157
|
}).strict();
|
|
158
|
+
var conversationReportTurnContextEventDataSchema = z2.object({
|
|
159
|
+
type: z2.literal("turn_context"),
|
|
160
|
+
turnId: z2.string().min(1),
|
|
161
|
+
pluginName: z2.string().min(1),
|
|
162
|
+
kind: z2.string().min(1),
|
|
163
|
+
version: z2.number().int().positive(),
|
|
164
|
+
content: z2.record(z2.string(), z2.unknown())
|
|
165
|
+
}).strict();
|
|
158
166
|
var conversationReportCompactionEventDataSchema = z2.object({
|
|
159
167
|
type: z2.literal("compaction"),
|
|
160
168
|
modelProfile: z2.string().min(1).optional(),
|
|
@@ -193,6 +201,7 @@ var conversationReportEventDataSchema = z2.discriminatedUnion("type", [
|
|
|
193
201
|
conversationReportMessageHandledEventDataSchema,
|
|
194
202
|
conversationReportToolCallsEventDataSchema,
|
|
195
203
|
conversationReportTurnLifecycleEventDataSchema,
|
|
204
|
+
conversationReportTurnContextEventDataSchema,
|
|
196
205
|
conversationReportTurnRoutedEventDataSchema,
|
|
197
206
|
conversationReportCompactionEventDataSchema,
|
|
198
207
|
conversationReportHandoffEventDataSchema,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
normalizeGenAiFinishReason,
|
|
13
13
|
serializeGenAiAttribute,
|
|
14
14
|
withSpan
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-72Z3HNTQ.js";
|
|
16
16
|
|
|
17
17
|
// src/chat/config.ts
|
|
18
18
|
import { getModel as getModel2 } from "@earendil-works/pi-ai/compat";
|
|
@@ -272,10 +272,11 @@ function unwrapCurrentInstruction(text) {
|
|
|
272
272
|
|
|
273
273
|
// src/chat/services/context-compaction-marker.ts
|
|
274
274
|
var COMPACTION_SUMMARY_PREFIX = "Context compaction summary for future Junior turns:";
|
|
275
|
+
var ACTIVE_TURN_COMPACTION_SUMMARY_PREFIX = "Active-turn context checkpoint. If no newer user instruction follows this checkpoint, continue the same unfinished task now using the authoritative instructions above and this summary as internal continuation state. If a newer user instruction follows, treat this checkpoint as prior context and follow that newer instruction. Do not reply with a plan or summary solely because this checkpoint appeared:";
|
|
275
276
|
var MODEL_HANDOFF_SUMMARY_PREFIX = "Model handoff checkpoint. Continue the outstanding request now using this summary as the complete prior context:";
|
|
276
277
|
function isCompactionSummaryText(text) {
|
|
277
278
|
const normalized = (unwrapCurrentInstruction(text) ?? text).trimStart();
|
|
278
|
-
return normalized.startsWith(COMPACTION_SUMMARY_PREFIX) || normalized.startsWith(MODEL_HANDOFF_SUMMARY_PREFIX);
|
|
279
|
+
return normalized.startsWith(COMPACTION_SUMMARY_PREFIX) || normalized.startsWith(ACTIVE_TURN_COMPACTION_SUMMARY_PREFIX) || normalized.startsWith(MODEL_HANDOFF_SUMMARY_PREFIX);
|
|
279
280
|
}
|
|
280
281
|
function hasCompactedConversationContext(messages) {
|
|
281
282
|
return messages.some((message) => {
|
|
@@ -934,6 +935,7 @@ export {
|
|
|
934
935
|
renderCurrentInstruction,
|
|
935
936
|
unwrapCurrentInstruction,
|
|
936
937
|
COMPACTION_SUMMARY_PREFIX,
|
|
938
|
+
ACTIVE_TURN_COMPACTION_SUMMARY_PREFIX,
|
|
937
939
|
MODEL_HANDOFF_SUMMARY_PREFIX,
|
|
938
940
|
isCompactionSummaryText,
|
|
939
941
|
hasCompactedConversationContext,
|