@sentry/junior 0.116.1 → 0.118.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-GUAAS3XH.js → agent-hooks-J2FB7XD6.js} +8 -10
- 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/stats.d.ts +22 -0
- package/dist/api/schema.d.ts +2 -0
- package/dist/api/schema.js +7 -3
- package/dist/api/stats.d.ts +16 -0
- package/dist/api/user-pages/routes.d.ts +4 -0
- package/dist/api.js +192 -18
- package/dist/app.js +53 -46
- package/dist/{catalog-runtime-WMPC4J4U.js → catalog-runtime-UHHLU53I.js} +5 -5
- package/dist/chat/agent/prompt.d.ts +6 -2
- 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/plugins/user-pages.d.ts +15 -0
- package/dist/chat/plugins/viewer-actors.d.ts +6 -0
- package/dist/chat/prompt.d.ts +1 -2
- package/dist/chat/sandbox/paths.d.ts +2 -0
- package/dist/chat/sandbox/sandbox.d.ts +3 -1
- 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/sandbox/workspace.d.ts +1 -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/skills.d.ts +1 -2
- package/dist/chat/state/turn-session.d.ts +2 -0
- package/dist/chat/tools/index.d.ts +4 -1
- package/dist/chat/tools/query-conversation-events.d.ts +1 -1
- package/dist/chat/tools/sandbox/file-utils.d.ts +11 -0
- package/dist/chat/tools/sandbox/find-files.d.ts +2 -1
- package/dist/chat/tools/sandbox/grep.d.ts +2 -1
- package/dist/chat/tools/sandbox/view-image.d.ts +11 -0
- package/dist/chat/tools/types.d.ts +7 -0
- package/dist/{chunk-XA3VLFPK.js → chunk-3LGCVRBQ.js} +154 -20
- package/dist/{chunk-JPKGW6L6.js → chunk-3MUSSFMP.js} +78 -39
- package/dist/{chunk-7CSVG54J.js → chunk-3N3FMCKN.js} +30 -2
- package/dist/{chunk-VBMMMVVQ.js → chunk-4LPPH7Y6.js} +405 -446
- package/dist/{chunk-2YYPXQNQ.js → chunk-4SOQPUF4.js} +1 -1
- package/dist/{chunk-H35BDAUS.js → chunk-6BGUAOYP.js} +8 -8
- package/dist/{chunk-GDAXWEIJ.js → chunk-6K2QE2UI.js} +731 -424
- package/dist/{chunk-DLLW5ITL.js → chunk-7GADTCNS.js} +30 -9
- package/dist/{chunk-TC4ZEM2D.js → chunk-7SM3P4XR.js} +28 -1
- package/dist/{chunk-WKU7TY22.js → chunk-FIANEE7Z.js} +3 -1
- package/dist/{chunk-RXRQJF7Y.js → chunk-GCGJGSQL.js} +21 -0
- package/dist/{chunk-ZYHLNTC2.js → chunk-GT2ZUALJ.js} +584 -25
- package/dist/{chunk-KNCELO2M.js → chunk-HN6LFYG3.js} +1 -1
- package/dist/{chunk-N3C4XCRE.js → chunk-HWUBBHLK.js} +1 -1
- package/dist/{chunk-BFYVIOTS.js → chunk-KC5EE27Y.js} +13 -3
- package/dist/chunk-L72GDKSN.js +37 -0
- package/dist/{chunk-F3SWGSPG.js → chunk-MLZFK4KP.js} +1 -1
- package/dist/{chunk-RYFAVWP3.js → chunk-PJPKHGLG.js} +34 -15
- package/dist/{chunk-CY7NXM32.js → chunk-PWRFTDTY.js} +4 -2
- package/dist/{chunk-WLT72MRP.js → chunk-QWCF4RAC.js} +1 -1
- package/dist/{chunk-CGXLCMWI.js → chunk-S6R23MFB.js} +117 -17
- package/dist/{chunk-OY2PQQ4P.js → chunk-UXLYAVYL.js} +1 -1
- package/dist/cli/chat.js +23 -24
- package/dist/cli/check.js +6 -6
- package/dist/cli/main.js +1 -1
- package/dist/cli/plugins.js +12 -14
- package/dist/cli/{snapshot-warmup.js → snapshot-create.js} +17 -20
- package/dist/cli/upgrade.js +7 -7
- package/dist/db/schema/stats.d.ts +93 -0
- package/dist/db/schema.d.ts +94 -1
- package/dist/{db-FH4R5ZQ4.js → db-PMRHFSYL.js} +6 -6
- package/dist/handlers/oauth-html.d.ts +4 -2
- package/dist/instrumentation.js +2 -2
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-C2SSJ3FQ.js → oauth-callback-server-QJUC7S4X.js} +15 -17
- package/dist/{plugins-IUJA4VBU.js → plugins-HW4VWW6G.js} +1 -1
- package/dist/{runner-NAALFIXM.js → runner-PZMV6JQW.js} +10 -12
- package/dist/{skills-UN2JXYYF.js → skills-W4JETYSV.js} +6 -6
- package/dist/stats.d.ts +18 -0
- package/dist/{validation-EEF4ROHR.js → validation-IJLNHZSU.js} +6 -6
- package/dist/version.js +1 -1
- package/migrations/0011_sour_golden_guardian.sql +8 -0
- package/migrations/meta/0011_snapshot.json +1195 -0
- package/migrations/meta/_journal.json +8 -1
- package/package.json +5 -5
- package/dist/chat/sandbox/runtime-dependency-snapshots.d.ts +0 -20
- package/dist/chunk-4ZNGQH7C.js +0 -25
- package/dist/chunk-FAEALXEH.js +0 -517
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
persistAuthPauseTurnState,
|
|
13
13
|
requireTurnFailureEventId,
|
|
14
14
|
scheduleSessionCompletedPluginTasks
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-6BGUAOYP.js";
|
|
16
16
|
import {
|
|
17
17
|
buildSentryConversationUrl
|
|
18
18
|
} from "./chunk-4CODA7P5.js";
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
formatProviderLabel,
|
|
30
30
|
formatSlackLink,
|
|
31
31
|
getMcpAuthSession,
|
|
32
|
+
getMcpProviderErrorAttributes,
|
|
32
33
|
getMcpStoredOAuthCredentials,
|
|
33
34
|
normalizeSlackStatusText,
|
|
34
35
|
parseOAuthStatePayload,
|
|
@@ -38,7 +39,7 @@ import {
|
|
|
38
39
|
resolvePluginOAuthAccount,
|
|
39
40
|
splitSlackReplyText,
|
|
40
41
|
truncateStatusText
|
|
41
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-S6R23MFB.js";
|
|
42
43
|
import {
|
|
43
44
|
JUNIOR_THREAD_STATE_TTL_MS,
|
|
44
45
|
TurnSliceLimitExceededError,
|
|
@@ -68,30 +69,28 @@ import {
|
|
|
68
69
|
recordDeliveredAssistantMessage,
|
|
69
70
|
turnHasReply,
|
|
70
71
|
updateConversationStats
|
|
71
|
-
} from "./chunk-
|
|
72
|
-
import {
|
|
73
|
-
getDashboardConversationLink,
|
|
74
|
-
getPluginSlackConversationLink
|
|
75
|
-
} from "./chunk-ZYHLNTC2.js";
|
|
76
|
-
import {
|
|
77
|
-
acquireActiveLock,
|
|
78
|
-
getDefaultRedisStateAdapterFor,
|
|
79
|
-
getStateAdapter
|
|
80
|
-
} from "./chunk-7CSVG54J.js";
|
|
72
|
+
} from "./chunk-PJPKHGLG.js";
|
|
81
73
|
import {
|
|
82
74
|
SlackActionError,
|
|
75
|
+
getDashboardConversationLink,
|
|
83
76
|
getHeaderString,
|
|
77
|
+
getPluginSlackConversationLink,
|
|
84
78
|
getSlackClient,
|
|
85
79
|
isDmChannel,
|
|
86
80
|
normalizeSlackConversationId
|
|
87
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-GT2ZUALJ.js";
|
|
88
82
|
import {
|
|
89
83
|
getConversationEventStore,
|
|
90
84
|
getConversationStore,
|
|
91
85
|
parseDestination,
|
|
92
86
|
requireSlackDestination,
|
|
93
87
|
sameDestination
|
|
94
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-KC5EE27Y.js";
|
|
89
|
+
import {
|
|
90
|
+
acquireActiveLock,
|
|
91
|
+
getDefaultRedisStateAdapterFor,
|
|
92
|
+
getStateAdapter
|
|
93
|
+
} from "./chunk-3N3FMCKN.js";
|
|
95
94
|
import {
|
|
96
95
|
FUNCTION_TIMEOUT_BUFFER_SECONDS,
|
|
97
96
|
botConfig,
|
|
@@ -100,7 +99,7 @@ import {
|
|
|
100
99
|
getRuntimeMetadata,
|
|
101
100
|
normalizeSlackEmojiName,
|
|
102
101
|
standardModelId
|
|
103
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-PWRFTDTY.js";
|
|
104
103
|
import {
|
|
105
104
|
parseSlackThreadId,
|
|
106
105
|
readSlackRawMessageContext,
|
|
@@ -109,15 +108,15 @@ import {
|
|
|
109
108
|
} from "./chunk-FXOYURO4.js";
|
|
110
109
|
import {
|
|
111
110
|
discoverSkills
|
|
112
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-7GADTCNS.js";
|
|
113
112
|
import {
|
|
114
113
|
pluginCatalogRuntime
|
|
115
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-UXLYAVYL.js";
|
|
116
115
|
import {
|
|
117
116
|
buildOAuthTokenRequest,
|
|
118
117
|
hasRequiredOAuthScope,
|
|
119
118
|
parseOAuthTokenResponse
|
|
120
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-3LGCVRBQ.js";
|
|
121
120
|
import {
|
|
122
121
|
createSlackResumeActor,
|
|
123
122
|
isUserActor,
|
|
@@ -128,7 +127,7 @@ import {
|
|
|
128
127
|
logException,
|
|
129
128
|
logInfo,
|
|
130
129
|
logWarn
|
|
131
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-MLZFK4KP.js";
|
|
132
131
|
import {
|
|
133
132
|
isRecord,
|
|
134
133
|
toOptionalNumber,
|
|
@@ -2986,7 +2985,8 @@ async function scheduleAgentContinue(request, options = {}) {
|
|
|
2986
2985
|
}
|
|
2987
2986
|
|
|
2988
2987
|
// src/handlers/oauth-html.ts
|
|
2989
|
-
function htmlCallbackResponse(title, message, status) {
|
|
2988
|
+
function htmlCallbackResponse(title, message, status, options = {}) {
|
|
2989
|
+
const footerMessage = options.footerMessage ?? "You can close this tab and return to Junior.";
|
|
2990
2990
|
const html = `<!DOCTYPE html>
|
|
2991
2991
|
<html>
|
|
2992
2992
|
<head><title>${title}</title></head>
|
|
@@ -2994,13 +2994,19 @@ function htmlCallbackResponse(title, message, status) {
|
|
|
2994
2994
|
<div style="text-align: center; max-width: 480px;">
|
|
2995
2995
|
<h1>${title}</h1>
|
|
2996
2996
|
<p>${message}</p>
|
|
2997
|
-
<p style="margin-top: 2rem; color: #666; font-size: 0.9em;"
|
|
2997
|
+
<p style="margin-top: 2rem; color: #666; font-size: 0.9em;">${footerMessage}</p>
|
|
2998
2998
|
</div>
|
|
2999
2999
|
</body>
|
|
3000
3000
|
</html>`;
|
|
3001
3001
|
return new Response(html, {
|
|
3002
3002
|
status,
|
|
3003
|
-
headers: {
|
|
3003
|
+
headers: {
|
|
3004
|
+
"Cache-Control": "no-store",
|
|
3005
|
+
"Content-Security-Policy": "default-src 'none'; style-src 'unsafe-inline'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'",
|
|
3006
|
+
"Content-Type": "text/html; charset=utf-8",
|
|
3007
|
+
"Referrer-Policy": "no-referrer",
|
|
3008
|
+
"X-Content-Type-Options": "nosniff"
|
|
3009
|
+
}
|
|
3004
3010
|
});
|
|
3005
3011
|
}
|
|
3006
3012
|
|
|
@@ -3051,7 +3057,10 @@ function htmlResponse(kind, options) {
|
|
|
3051
3057
|
...CALLBACK_PAGES.success,
|
|
3052
3058
|
message: "Your MCP access is connected. Junior will continue the paused request in the local client."
|
|
3053
3059
|
} : CALLBACK_PAGES[kind];
|
|
3054
|
-
return
|
|
3060
|
+
const footerMessage = kind === "success" && !options?.local ? "You can close this tab and return to Slack." : void 0;
|
|
3061
|
+
return htmlCallbackResponse(page.title, page.message, page.status, {
|
|
3062
|
+
footerMessage
|
|
3063
|
+
});
|
|
3055
3064
|
}
|
|
3056
3065
|
async function persistCompletedReplyState(channelId, threadTs, sessionId, reply) {
|
|
3057
3066
|
const threadId = `slack:${channelId}:${threadTs}`;
|
|
@@ -3467,7 +3476,10 @@ async function GET(request, provider, waitUntil, options) {
|
|
|
3467
3476
|
callbackError,
|
|
3468
3477
|
"mcp_oauth_callback_failed",
|
|
3469
3478
|
{},
|
|
3470
|
-
{
|
|
3479
|
+
{
|
|
3480
|
+
"app.credential.provider": provider,
|
|
3481
|
+
...getMcpProviderErrorAttributes(callbackError)
|
|
3482
|
+
},
|
|
3471
3483
|
"Failed to process MCP OAuth callback"
|
|
3472
3484
|
);
|
|
3473
3485
|
return htmlResponse("failure");
|
|
@@ -3633,6 +3645,14 @@ async function publishAppHomeView(slackClient, userId, userTokenStore) {
|
|
|
3633
3645
|
function htmlErrorResponse(title, message, status) {
|
|
3634
3646
|
return htmlCallbackResponse(escapeXml(title), escapeXml(message), status);
|
|
3635
3647
|
}
|
|
3648
|
+
function oauthTokenErrorAttributes(provider, endpoint, status) {
|
|
3649
|
+
return {
|
|
3650
|
+
"app.credential.provider": provider,
|
|
3651
|
+
"app.oauth.error.phase": "token_exchange",
|
|
3652
|
+
"server.address": new URL(endpoint).hostname,
|
|
3653
|
+
...status !== void 0 ? { "http.response.status_code": status } : {}
|
|
3654
|
+
};
|
|
3655
|
+
}
|
|
3636
3656
|
async function persistCompletedOAuthReplyState(args) {
|
|
3637
3657
|
const currentState = await getPersistedThreadState(args.conversationId);
|
|
3638
3658
|
const conversation = coerceThreadConversationState(currentState);
|
|
@@ -4060,6 +4080,12 @@ async function GET2(request, provider, waitUntil, options) {
|
|
|
4060
4080
|
body: tokenRequest.body
|
|
4061
4081
|
});
|
|
4062
4082
|
} catch {
|
|
4083
|
+
logWarn(
|
|
4084
|
+
"oauth_token_exchange_failed",
|
|
4085
|
+
{},
|
|
4086
|
+
oauthTokenErrorAttributes(provider, providerConfig.tokenEndpoint),
|
|
4087
|
+
"OAuth token exchange request failed"
|
|
4088
|
+
);
|
|
4063
4089
|
return htmlErrorResponse(
|
|
4064
4090
|
"Connection failed",
|
|
4065
4091
|
"Failed to exchange the authorization code. Please try again.",
|
|
@@ -4067,6 +4093,16 @@ async function GET2(request, provider, waitUntil, options) {
|
|
|
4067
4093
|
);
|
|
4068
4094
|
}
|
|
4069
4095
|
if (!tokenResponse.ok) {
|
|
4096
|
+
logWarn(
|
|
4097
|
+
"oauth_token_exchange_failed",
|
|
4098
|
+
{},
|
|
4099
|
+
oauthTokenErrorAttributes(
|
|
4100
|
+
provider,
|
|
4101
|
+
providerConfig.tokenEndpoint,
|
|
4102
|
+
tokenResponse.status
|
|
4103
|
+
),
|
|
4104
|
+
"OAuth token exchange was rejected"
|
|
4105
|
+
);
|
|
4070
4106
|
return htmlErrorResponse(
|
|
4071
4107
|
"Connection failed",
|
|
4072
4108
|
"The token exchange with the provider failed. Please try again.",
|
|
@@ -4080,6 +4116,16 @@ async function GET2(request, provider, waitUntil, options) {
|
|
|
4080
4116
|
treatEmptyScopeAsUnreported: providerConfig.treatEmptyScopeAsUnreported
|
|
4081
4117
|
});
|
|
4082
4118
|
} catch {
|
|
4119
|
+
logWarn(
|
|
4120
|
+
"oauth_token_exchange_failed",
|
|
4121
|
+
{},
|
|
4122
|
+
oauthTokenErrorAttributes(
|
|
4123
|
+
provider,
|
|
4124
|
+
providerConfig.tokenEndpoint,
|
|
4125
|
+
tokenResponse.status
|
|
4126
|
+
),
|
|
4127
|
+
"OAuth token exchange returned an invalid response"
|
|
4128
|
+
);
|
|
4083
4129
|
return htmlErrorResponse(
|
|
4084
4130
|
"Connection failed",
|
|
4085
4131
|
"The provider returned an incomplete token response. Please try again.",
|
|
@@ -4164,21 +4210,14 @@ async function GET2(request, provider, waitUntil, options) {
|
|
|
4164
4210
|
})
|
|
4165
4211
|
);
|
|
4166
4212
|
}
|
|
4167
|
-
const statusMessage = stored.destination?.platform === "local" ? "Your request is continuing in the local Junior client." : resumesAgentTurn ? "Your request is being processed in Slack." :
|
|
4168
|
-
const
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
</div>
|
|
4176
|
-
</body>
|
|
4177
|
-
</html>`;
|
|
4178
|
-
return new Response(html, {
|
|
4179
|
-
status: 200,
|
|
4180
|
-
headers: { "Content-Type": "text/html; charset=utf-8" }
|
|
4181
|
-
});
|
|
4213
|
+
const statusMessage = stored.destination?.platform === "local" ? "Your request is continuing in the local Junior client." : resumesAgentTurn ? "Your request is being processed in Slack." : `Your ${providerLabel} account is connected.`;
|
|
4214
|
+
const footerMessage = stored.destination?.platform === "local" ? "You can close this tab and return to Junior." : "You can close this tab and return to Slack.";
|
|
4215
|
+
return htmlCallbackResponse(
|
|
4216
|
+
escapeXml(`${providerLabel} account connected`),
|
|
4217
|
+
escapeXml(statusMessage),
|
|
4218
|
+
200,
|
|
4219
|
+
{ footerMessage: escapeXml(footerMessage) }
|
|
4220
|
+
);
|
|
4182
4221
|
}
|
|
4183
4222
|
|
|
4184
4223
|
// src/chat/local/credential-sync.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getChatConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PWRFTDTY.js";
|
|
4
4
|
|
|
5
5
|
// src/chat/state/adapter.ts
|
|
6
6
|
import { createMemoryState } from "@chat-adapter/state-memory";
|
|
@@ -291,15 +291,43 @@ function sandboxSkillDir(skillName) {
|
|
|
291
291
|
function sandboxSkillFile(skillName) {
|
|
292
292
|
return `${sandboxSkillDir(skillName)}/SKILL.md`;
|
|
293
293
|
}
|
|
294
|
+
function sandboxSkillPathResolution(skillName) {
|
|
295
|
+
const skillDir = sandboxSkillDir(skillName);
|
|
296
|
+
return `Resolve relative paths in this skill against ${skillDir}. For bash commands from this skill, cd to ${skillDir} first or use absolute paths.`;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// src/chat/sleep.ts
|
|
300
|
+
function sleep(ms, signal) {
|
|
301
|
+
if (!signal) {
|
|
302
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
303
|
+
}
|
|
304
|
+
return new Promise((resolve, reject) => {
|
|
305
|
+
if (signal.aborted) {
|
|
306
|
+
reject(signal.reason);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
const timeoutId = setTimeout(() => {
|
|
310
|
+
signal.removeEventListener("abort", onAbort);
|
|
311
|
+
resolve();
|
|
312
|
+
}, ms);
|
|
313
|
+
const onAbort = () => {
|
|
314
|
+
clearTimeout(timeoutId);
|
|
315
|
+
reject(signal.reason);
|
|
316
|
+
};
|
|
317
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
318
|
+
});
|
|
319
|
+
}
|
|
294
320
|
|
|
295
321
|
export {
|
|
296
322
|
acquireActiveLock,
|
|
297
323
|
getDefaultRedisStateAdapterFor,
|
|
298
324
|
getStateAdapter,
|
|
299
325
|
disconnectStateAdapter,
|
|
326
|
+
sleep,
|
|
300
327
|
SANDBOX_WORKSPACE_ROOT,
|
|
301
328
|
SANDBOX_SKILLS_ROOT,
|
|
302
329
|
SANDBOX_DATA_ROOT,
|
|
303
330
|
sandboxSkillDir,
|
|
304
|
-
sandboxSkillFile
|
|
331
|
+
sandboxSkillFile,
|
|
332
|
+
sandboxSkillPathResolution
|
|
305
333
|
};
|