@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,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SANDBOX_WORKSPACE_ROOT,
|
|
3
3
|
getStateAdapter
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KU6ALEJC.js";
|
|
5
5
|
import {
|
|
6
6
|
createPluginAnnotations,
|
|
7
7
|
isConversationChannel,
|
|
8
8
|
isConversationScopedChannel,
|
|
9
9
|
isDmChannel,
|
|
10
10
|
normalizeSlackConversationId
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-YRWJ3KEU.js";
|
|
12
12
|
import {
|
|
13
13
|
getDb
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ZRQUQJUV.js";
|
|
15
15
|
import {
|
|
16
16
|
botConfig,
|
|
17
17
|
completeObject,
|
|
18
18
|
embedTexts,
|
|
19
19
|
standardModelId
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-DS27ZBSP.js";
|
|
21
21
|
import {
|
|
22
22
|
isActorUserId,
|
|
23
23
|
parseActorUserId
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
logException,
|
|
27
27
|
logInfo,
|
|
28
28
|
logWarn
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-72Z3HNTQ.js";
|
|
30
30
|
import {
|
|
31
31
|
parseSlackChannelReferenceId,
|
|
32
32
|
parseSlackMessageTs,
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
|
|
36
36
|
// src/chat/plugins/agent-hooks.ts
|
|
37
37
|
import {
|
|
38
|
+
promptContextSchema,
|
|
38
39
|
promptMessageSchema,
|
|
39
40
|
resourceEventSchema
|
|
40
41
|
} from "@sentry/junior-plugin-api";
|
|
@@ -426,8 +427,9 @@ var PLUGIN_ROUTE_METHODS = /* @__PURE__ */ new Set([
|
|
|
426
427
|
"ALL"
|
|
427
428
|
]);
|
|
428
429
|
var PLUGIN_PROMPT_CONTRIBUTION_TOTAL_MAX_CHARS = 16e3;
|
|
430
|
+
var PLUGIN_PROMPT_CONTEXT_MAX_BYTES = 8e3;
|
|
431
|
+
var PLUGIN_PROMPT_CONTEXT_TOTAL_MAX_BYTES = 16e3;
|
|
429
432
|
var systemPromptMessageArraySchema = z.array(promptMessageSchema);
|
|
430
|
-
var userPromptMessageArraySchema = z.array(promptMessageSchema);
|
|
431
433
|
function isRecord(value) {
|
|
432
434
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
433
435
|
}
|
|
@@ -492,6 +494,53 @@ function toPromptContributionContext(args) {
|
|
|
492
494
|
text: args.message.text
|
|
493
495
|
};
|
|
494
496
|
}
|
|
497
|
+
function normalizePromptContext(value) {
|
|
498
|
+
const serialized = JSON.stringify(value);
|
|
499
|
+
if (serialized === void 0 || Buffer.byteLength(serialized, "utf8") > PLUGIN_PROMPT_CONTEXT_MAX_BYTES) {
|
|
500
|
+
throw new TypeError("Plugin prompt context exceeded its serialized budget");
|
|
501
|
+
}
|
|
502
|
+
const parsed = JSON.parse(serialized);
|
|
503
|
+
if (!isRecord(parsed)) {
|
|
504
|
+
throw new TypeError("Plugin prompt context must be a JSON object");
|
|
505
|
+
}
|
|
506
|
+
return parsed;
|
|
507
|
+
}
|
|
508
|
+
function toUserPromptContributionContext(args) {
|
|
509
|
+
const message = promptMessageSchema.safeParse(args.value);
|
|
510
|
+
if (message.success) {
|
|
511
|
+
return toPromptContributionContext({
|
|
512
|
+
hookName: "userPrompt",
|
|
513
|
+
index: args.index,
|
|
514
|
+
message: message.data,
|
|
515
|
+
pluginName: args.pluginName
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
if (!isRecord(args.value) || typeof args.value.renderPrompt !== "function") {
|
|
519
|
+
return void 0;
|
|
520
|
+
}
|
|
521
|
+
const context = promptContextSchema.safeParse(args.value.context);
|
|
522
|
+
if (!context.success) {
|
|
523
|
+
return void 0;
|
|
524
|
+
}
|
|
525
|
+
const text = promptMessageSchema.safeParse({
|
|
526
|
+
text: args.value.renderPrompt()
|
|
527
|
+
});
|
|
528
|
+
if (!text.success) {
|
|
529
|
+
return void 0;
|
|
530
|
+
}
|
|
531
|
+
return {
|
|
532
|
+
id: `userPrompt:${args.index}`,
|
|
533
|
+
pluginName: args.pluginName,
|
|
534
|
+
text: text.data.text,
|
|
535
|
+
context: {
|
|
536
|
+
content: normalizePromptContext(context.data.content),
|
|
537
|
+
kind: context.data.kind,
|
|
538
|
+
loadedAtMs: Date.now(),
|
|
539
|
+
pluginName: args.pluginName,
|
|
540
|
+
version: context.data.version
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
}
|
|
495
544
|
function logInvalidPromptContributions(args) {
|
|
496
545
|
logWarn(
|
|
497
546
|
"plugin_prompt_contribution_result_invalid",
|
|
@@ -606,6 +655,7 @@ async function getPluginSystemPromptContributions(source) {
|
|
|
606
655
|
async function getPluginUserPromptContributions(args) {
|
|
607
656
|
const contributions = [];
|
|
608
657
|
let totalChars = 0;
|
|
658
|
+
let totalContextBytes = 0;
|
|
609
659
|
for (const plugin of getPlugins()) {
|
|
610
660
|
const pluginName = plugin.manifest.name;
|
|
611
661
|
const hook = plugin.hooks?.userPrompt;
|
|
@@ -619,27 +669,38 @@ async function getPluginUserPromptContributions(args) {
|
|
|
619
669
|
if (rawResult === void 0) {
|
|
620
670
|
continue;
|
|
621
671
|
}
|
|
622
|
-
|
|
623
|
-
if (!result.success) {
|
|
672
|
+
if (!Array.isArray(rawResult)) {
|
|
624
673
|
logInvalidPromptContributions({
|
|
625
674
|
hookName: "userPrompt",
|
|
626
675
|
pluginName
|
|
627
676
|
});
|
|
628
677
|
continue;
|
|
629
678
|
}
|
|
630
|
-
const acceptedContributions =
|
|
631
|
-
(
|
|
679
|
+
const acceptedContributions = rawResult.map(
|
|
680
|
+
(value, index) => toUserPromptContributionContext({ index, pluginName, value })
|
|
681
|
+
);
|
|
682
|
+
if (acceptedContributions.some((contribution) => !contribution)) {
|
|
683
|
+
logInvalidPromptContributions({
|
|
632
684
|
hookName: "userPrompt",
|
|
633
|
-
index,
|
|
634
|
-
message,
|
|
635
685
|
pluginName
|
|
636
|
-
})
|
|
686
|
+
});
|
|
687
|
+
continue;
|
|
688
|
+
}
|
|
689
|
+
const validContributions = acceptedContributions.filter(
|
|
690
|
+
(contribution) => contribution !== void 0
|
|
637
691
|
);
|
|
638
|
-
const pluginContributionChars =
|
|
692
|
+
const pluginContributionChars = validContributions.reduce(
|
|
639
693
|
(sum, contribution) => sum + contribution.text.length,
|
|
640
694
|
0
|
|
641
695
|
);
|
|
642
|
-
|
|
696
|
+
const pluginContextBytes = validContributions.reduce(
|
|
697
|
+
(sum, contribution) => sum + (contribution.context ? Buffer.byteLength(
|
|
698
|
+
JSON.stringify(contribution.context.content),
|
|
699
|
+
"utf8"
|
|
700
|
+
) : 0),
|
|
701
|
+
0
|
|
702
|
+
);
|
|
703
|
+
if (totalChars + pluginContributionChars > PLUGIN_PROMPT_CONTRIBUTION_TOTAL_MAX_CHARS || totalContextBytes + pluginContextBytes > PLUGIN_PROMPT_CONTEXT_TOTAL_MAX_BYTES) {
|
|
643
704
|
logWarn(
|
|
644
705
|
"plugin_user_prompt_contribution_budget_exceeded",
|
|
645
706
|
{},
|
|
@@ -651,7 +712,8 @@ async function getPluginUserPromptContributions(args) {
|
|
|
651
712
|
continue;
|
|
652
713
|
}
|
|
653
714
|
totalChars += pluginContributionChars;
|
|
654
|
-
|
|
715
|
+
totalContextBytes += pluginContextBytes;
|
|
716
|
+
contributions.push(...validContributions);
|
|
655
717
|
} catch (error) {
|
|
656
718
|
logWarn(
|
|
657
719
|
"plugin_user_prompt_hook_failed",
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
persistAuthPauseTurnState,
|
|
13
13
|
requireTurnFailureEventId,
|
|
14
14
|
scheduleSessionCompletedPluginTasks
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-LN765Y4N.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-6G45D3YG.js";
|
|
42
43
|
import {
|
|
43
44
|
JUNIOR_THREAD_STATE_TTL_MS,
|
|
44
45
|
TurnSliceLimitExceededError,
|
|
@@ -68,30 +69,30 @@ import {
|
|
|
68
69
|
recordDeliveredAssistantMessage,
|
|
69
70
|
turnHasReply,
|
|
70
71
|
updateConversationStats
|
|
71
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-27KWTFP6.js";
|
|
72
73
|
import {
|
|
73
74
|
getDashboardConversationLink,
|
|
74
75
|
getPluginSlackConversationLink
|
|
75
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-STUI6NIL.js";
|
|
76
77
|
import {
|
|
77
78
|
acquireActiveLock,
|
|
78
79
|
getDefaultRedisStateAdapterFor,
|
|
79
80
|
getStateAdapter
|
|
80
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-KU6ALEJC.js";
|
|
81
82
|
import {
|
|
82
83
|
SlackActionError,
|
|
83
84
|
getHeaderString,
|
|
84
85
|
getSlackClient,
|
|
85
86
|
isDmChannel,
|
|
86
87
|
normalizeSlackConversationId
|
|
87
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-YRWJ3KEU.js";
|
|
88
89
|
import {
|
|
89
90
|
getConversationEventStore,
|
|
90
91
|
getConversationStore,
|
|
91
92
|
parseDestination,
|
|
92
93
|
requireSlackDestination,
|
|
93
94
|
sameDestination
|
|
94
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-ZRQUQJUV.js";
|
|
95
96
|
import {
|
|
96
97
|
FUNCTION_TIMEOUT_BUFFER_SECONDS,
|
|
97
98
|
botConfig,
|
|
@@ -100,7 +101,7 @@ import {
|
|
|
100
101
|
getRuntimeMetadata,
|
|
101
102
|
normalizeSlackEmojiName,
|
|
102
103
|
standardModelId
|
|
103
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-DS27ZBSP.js";
|
|
104
105
|
import {
|
|
105
106
|
parseSlackThreadId,
|
|
106
107
|
readSlackRawMessageContext,
|
|
@@ -109,15 +110,15 @@ import {
|
|
|
109
110
|
} from "./chunk-FXOYURO4.js";
|
|
110
111
|
import {
|
|
111
112
|
discoverSkills
|
|
112
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-AKG4TZNH.js";
|
|
113
114
|
import {
|
|
114
115
|
pluginCatalogRuntime
|
|
115
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-CU7HTGNI.js";
|
|
116
117
|
import {
|
|
117
118
|
buildOAuthTokenRequest,
|
|
118
119
|
hasRequiredOAuthScope,
|
|
119
120
|
parseOAuthTokenResponse
|
|
120
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-5O3JDQDG.js";
|
|
121
122
|
import {
|
|
122
123
|
createSlackResumeActor,
|
|
123
124
|
isUserActor,
|
|
@@ -128,7 +129,7 @@ import {
|
|
|
128
129
|
logException,
|
|
129
130
|
logInfo,
|
|
130
131
|
logWarn
|
|
131
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-72Z3HNTQ.js";
|
|
132
133
|
import {
|
|
133
134
|
isRecord,
|
|
134
135
|
toOptionalNumber,
|
|
@@ -2986,7 +2987,8 @@ async function scheduleAgentContinue(request, options = {}) {
|
|
|
2986
2987
|
}
|
|
2987
2988
|
|
|
2988
2989
|
// src/handlers/oauth-html.ts
|
|
2989
|
-
function htmlCallbackResponse(title, message, status) {
|
|
2990
|
+
function htmlCallbackResponse(title, message, status, options = {}) {
|
|
2991
|
+
const footerMessage = options.footerMessage ?? "You can close this tab and return to Junior.";
|
|
2990
2992
|
const html = `<!DOCTYPE html>
|
|
2991
2993
|
<html>
|
|
2992
2994
|
<head><title>${title}</title></head>
|
|
@@ -2994,13 +2996,19 @@ function htmlCallbackResponse(title, message, status) {
|
|
|
2994
2996
|
<div style="text-align: center; max-width: 480px;">
|
|
2995
2997
|
<h1>${title}</h1>
|
|
2996
2998
|
<p>${message}</p>
|
|
2997
|
-
<p style="margin-top: 2rem; color: #666; font-size: 0.9em;"
|
|
2999
|
+
<p style="margin-top: 2rem; color: #666; font-size: 0.9em;">${footerMessage}</p>
|
|
2998
3000
|
</div>
|
|
2999
3001
|
</body>
|
|
3000
3002
|
</html>`;
|
|
3001
3003
|
return new Response(html, {
|
|
3002
3004
|
status,
|
|
3003
|
-
headers: {
|
|
3005
|
+
headers: {
|
|
3006
|
+
"Cache-Control": "no-store",
|
|
3007
|
+
"Content-Security-Policy": "default-src 'none'; style-src 'unsafe-inline'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'",
|
|
3008
|
+
"Content-Type": "text/html; charset=utf-8",
|
|
3009
|
+
"Referrer-Policy": "no-referrer",
|
|
3010
|
+
"X-Content-Type-Options": "nosniff"
|
|
3011
|
+
}
|
|
3004
3012
|
});
|
|
3005
3013
|
}
|
|
3006
3014
|
|
|
@@ -3051,7 +3059,10 @@ function htmlResponse(kind, options) {
|
|
|
3051
3059
|
...CALLBACK_PAGES.success,
|
|
3052
3060
|
message: "Your MCP access is connected. Junior will continue the paused request in the local client."
|
|
3053
3061
|
} : CALLBACK_PAGES[kind];
|
|
3054
|
-
return
|
|
3062
|
+
const footerMessage = kind === "success" && !options?.local ? "You can close this tab and return to Slack." : void 0;
|
|
3063
|
+
return htmlCallbackResponse(page.title, page.message, page.status, {
|
|
3064
|
+
footerMessage
|
|
3065
|
+
});
|
|
3055
3066
|
}
|
|
3056
3067
|
async function persistCompletedReplyState(channelId, threadTs, sessionId, reply) {
|
|
3057
3068
|
const threadId = `slack:${channelId}:${threadTs}`;
|
|
@@ -3467,7 +3478,10 @@ async function GET(request, provider, waitUntil, options) {
|
|
|
3467
3478
|
callbackError,
|
|
3468
3479
|
"mcp_oauth_callback_failed",
|
|
3469
3480
|
{},
|
|
3470
|
-
{
|
|
3481
|
+
{
|
|
3482
|
+
"app.credential.provider": provider,
|
|
3483
|
+
...getMcpProviderErrorAttributes(callbackError)
|
|
3484
|
+
},
|
|
3471
3485
|
"Failed to process MCP OAuth callback"
|
|
3472
3486
|
);
|
|
3473
3487
|
return htmlResponse("failure");
|
|
@@ -3633,6 +3647,14 @@ async function publishAppHomeView(slackClient, userId, userTokenStore) {
|
|
|
3633
3647
|
function htmlErrorResponse(title, message, status) {
|
|
3634
3648
|
return htmlCallbackResponse(escapeXml(title), escapeXml(message), status);
|
|
3635
3649
|
}
|
|
3650
|
+
function oauthTokenErrorAttributes(provider, endpoint, status) {
|
|
3651
|
+
return {
|
|
3652
|
+
"app.credential.provider": provider,
|
|
3653
|
+
"app.oauth.error.phase": "token_exchange",
|
|
3654
|
+
"server.address": new URL(endpoint).hostname,
|
|
3655
|
+
...status !== void 0 ? { "http.response.status_code": status } : {}
|
|
3656
|
+
};
|
|
3657
|
+
}
|
|
3636
3658
|
async function persistCompletedOAuthReplyState(args) {
|
|
3637
3659
|
const currentState = await getPersistedThreadState(args.conversationId);
|
|
3638
3660
|
const conversation = coerceThreadConversationState(currentState);
|
|
@@ -4060,6 +4082,12 @@ async function GET2(request, provider, waitUntil, options) {
|
|
|
4060
4082
|
body: tokenRequest.body
|
|
4061
4083
|
});
|
|
4062
4084
|
} catch {
|
|
4085
|
+
logWarn(
|
|
4086
|
+
"oauth_token_exchange_failed",
|
|
4087
|
+
{},
|
|
4088
|
+
oauthTokenErrorAttributes(provider, providerConfig.tokenEndpoint),
|
|
4089
|
+
"OAuth token exchange request failed"
|
|
4090
|
+
);
|
|
4063
4091
|
return htmlErrorResponse(
|
|
4064
4092
|
"Connection failed",
|
|
4065
4093
|
"Failed to exchange the authorization code. Please try again.",
|
|
@@ -4067,6 +4095,16 @@ async function GET2(request, provider, waitUntil, options) {
|
|
|
4067
4095
|
);
|
|
4068
4096
|
}
|
|
4069
4097
|
if (!tokenResponse.ok) {
|
|
4098
|
+
logWarn(
|
|
4099
|
+
"oauth_token_exchange_failed",
|
|
4100
|
+
{},
|
|
4101
|
+
oauthTokenErrorAttributes(
|
|
4102
|
+
provider,
|
|
4103
|
+
providerConfig.tokenEndpoint,
|
|
4104
|
+
tokenResponse.status
|
|
4105
|
+
),
|
|
4106
|
+
"OAuth token exchange was rejected"
|
|
4107
|
+
);
|
|
4070
4108
|
return htmlErrorResponse(
|
|
4071
4109
|
"Connection failed",
|
|
4072
4110
|
"The token exchange with the provider failed. Please try again.",
|
|
@@ -4080,6 +4118,16 @@ async function GET2(request, provider, waitUntil, options) {
|
|
|
4080
4118
|
treatEmptyScopeAsUnreported: providerConfig.treatEmptyScopeAsUnreported
|
|
4081
4119
|
});
|
|
4082
4120
|
} catch {
|
|
4121
|
+
logWarn(
|
|
4122
|
+
"oauth_token_exchange_failed",
|
|
4123
|
+
{},
|
|
4124
|
+
oauthTokenErrorAttributes(
|
|
4125
|
+
provider,
|
|
4126
|
+
providerConfig.tokenEndpoint,
|
|
4127
|
+
tokenResponse.status
|
|
4128
|
+
),
|
|
4129
|
+
"OAuth token exchange returned an invalid response"
|
|
4130
|
+
);
|
|
4083
4131
|
return htmlErrorResponse(
|
|
4084
4132
|
"Connection failed",
|
|
4085
4133
|
"The provider returned an incomplete token response. Please try again.",
|
|
@@ -4164,21 +4212,14 @@ async function GET2(request, provider, waitUntil, options) {
|
|
|
4164
4212
|
})
|
|
4165
4213
|
);
|
|
4166
4214
|
}
|
|
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
|
-
});
|
|
4215
|
+
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.`;
|
|
4216
|
+
const footerMessage = stored.destination?.platform === "local" ? "You can close this tab and return to Junior." : "You can close this tab and return to Slack.";
|
|
4217
|
+
return htmlCallbackResponse(
|
|
4218
|
+
escapeXml(`${providerLabel} account connected`),
|
|
4219
|
+
escapeXml(statusMessage),
|
|
4220
|
+
200,
|
|
4221
|
+
{ footerMessage: escapeXml(footerMessage) }
|
|
4222
|
+
);
|
|
4182
4223
|
}
|
|
4183
4224
|
|
|
4184
4225
|
// src/chat/local/credential-sync.ts
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
} from "./chunk-4ZNGQH7C.js";
|
|
7
7
|
import {
|
|
8
8
|
getSlackBotToken
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DS27ZBSP.js";
|
|
10
10
|
import {
|
|
11
11
|
logWarn,
|
|
12
12
|
setSpanAttributes,
|
|
13
13
|
setSpanStatus,
|
|
14
14
|
withSpan
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-72Z3HNTQ.js";
|
|
16
16
|
import {
|
|
17
17
|
parseSlackChannelReferenceId
|
|
18
18
|
} from "./chunk-F3B2YJ76.js";
|
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
TURN_REASONING_LEVELS,
|
|
10
10
|
getChatConfig,
|
|
11
11
|
modelProfileSchema
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DS27ZBSP.js";
|
|
13
13
|
import {
|
|
14
14
|
juniorDestinations
|
|
15
15
|
} from "./chunk-VFUK3X5B.js";
|
|
16
16
|
import {
|
|
17
17
|
normalizeIdentityEmail
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-72Z3HNTQ.js";
|
|
19
19
|
import {
|
|
20
20
|
parseSlackChannelReferenceId,
|
|
21
21
|
parseSlackTeamId
|
|
@@ -943,6 +943,14 @@ var turnRoutedEventDataSchema = z2.object({
|
|
|
943
943
|
confidence: z2.number().min(0).max(1).optional(),
|
|
944
944
|
source: z2.enum(["configured", "inherited", "router"])
|
|
945
945
|
}).strict();
|
|
946
|
+
var turnContextEventDataSchema = z2.object({
|
|
947
|
+
type: z2.literal("turn_context"),
|
|
948
|
+
turnId: z2.string().min(1),
|
|
949
|
+
pluginName: z2.string().min(1),
|
|
950
|
+
kind: z2.string().min(1).max(64),
|
|
951
|
+
version: z2.number().int().positive(),
|
|
952
|
+
content: z2.record(z2.string(), z2.unknown())
|
|
953
|
+
}).strict();
|
|
946
954
|
var turnCompletedEventDataSchema = z2.object({
|
|
947
955
|
type: z2.literal("turn_completed"),
|
|
948
956
|
turnId: z2.string().min(1),
|
|
@@ -984,6 +992,7 @@ var appendableConversationEventDataSchema = z2.union([
|
|
|
984
992
|
messageHandledEventDataSchema,
|
|
985
993
|
messagesSummarizedEventDataSchema,
|
|
986
994
|
turnStartedEventDataSchema,
|
|
995
|
+
turnContextEventDataSchema,
|
|
987
996
|
turnRoutedEventDataSchema,
|
|
988
997
|
turnCompletedEventDataSchema,
|
|
989
998
|
turnFailedEventDataSchema,
|
|
@@ -1007,6 +1016,7 @@ var KNOWN_CONVERSATION_EVENT_TYPES = [
|
|
|
1007
1016
|
"message_handled",
|
|
1008
1017
|
"messages_summarized",
|
|
1009
1018
|
"turn_started",
|
|
1019
|
+
"turn_context",
|
|
1010
1020
|
"turn_routed",
|
|
1011
1021
|
"turn_completed",
|
|
1012
1022
|
"turn_failed",
|
package/dist/cli/chat.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAgentRunner,
|
|
3
3
|
executeAgentRun
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-NHZEUHKH.js";
|
|
5
5
|
import "../chunk-DIB4GX3G.js";
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-6G45D3YG.js";
|
|
7
|
+
import "../chunk-27KWTFP6.js";
|
|
8
8
|
import "../chunk-HDSDCEPK.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-FAWBONPC.js";
|
|
10
10
|
import "../chunk-MU6HHZEN.js";
|
|
11
11
|
import "../chunk-PDO5BLNM.js";
|
|
12
12
|
import "../chunk-UIE3R5XU.js";
|
|
13
13
|
import {
|
|
14
14
|
loadAppPluginSet
|
|
15
15
|
} from "../chunk-Y2CM7HXH.js";
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
16
|
+
import "../chunk-STUI6NIL.js";
|
|
17
|
+
import "../chunk-KU6ALEJC.js";
|
|
18
|
+
import "../chunk-YRWJ3KEU.js";
|
|
19
|
+
import "../chunk-ZRQUQJUV.js";
|
|
20
20
|
import "../chunk-RXRQJF7Y.js";
|
|
21
21
|
import "../chunk-4ZNGQH7C.js";
|
|
22
|
-
import "../chunk-
|
|
22
|
+
import "../chunk-DS27ZBSP.js";
|
|
23
23
|
import "../chunk-VFUK3X5B.js";
|
|
24
24
|
import "../chunk-FXOYURO4.js";
|
|
25
|
-
import "../chunk-
|
|
26
|
-
import "../chunk-
|
|
27
|
-
import "../chunk-
|
|
25
|
+
import "../chunk-AKG4TZNH.js";
|
|
26
|
+
import "../chunk-CU7HTGNI.js";
|
|
27
|
+
import "../chunk-5O3JDQDG.js";
|
|
28
28
|
import "../chunk-W3U3YQYI.js";
|
|
29
29
|
import "../chunk-HZF5P5UN.js";
|
|
30
|
-
import "../chunk-
|
|
30
|
+
import "../chunk-72Z3HNTQ.js";
|
|
31
31
|
import "../chunk-OB42YVAE.js";
|
|
32
32
|
import "../chunk-F3B2YJ76.js";
|
|
33
33
|
import "../chunk-6GWA276C.js";
|
|
34
34
|
import "../chunk-B3IT5END.js";
|
|
35
35
|
import "../chunk-3V7OFJZC.js";
|
|
36
|
-
import "../chunk-
|
|
37
|
-
import "../chunk-
|
|
36
|
+
import "../chunk-WUNPRM76.js";
|
|
37
|
+
import "../chunk-3GE3F4LT.js";
|
|
38
38
|
import "../chunk-MLKGABMK.js";
|
|
39
39
|
|
|
40
40
|
// src/cli/chat.ts
|
|
@@ -157,10 +157,10 @@ async function configureLocalChatPlugins(pluginSet) {
|
|
|
157
157
|
databaseModule
|
|
158
158
|
] = await Promise.all([
|
|
159
159
|
import("../plugins-IUJA4VBU.js"),
|
|
160
|
-
import("../agent-hooks-
|
|
161
|
-
import("../catalog-runtime-
|
|
162
|
-
import("../validation-
|
|
163
|
-
import("../db-
|
|
160
|
+
import("../agent-hooks-5IK4LPLP.js"),
|
|
161
|
+
import("../catalog-runtime-MTUYW3AA.js"),
|
|
162
|
+
import("../validation-74EIKKE6.js"),
|
|
163
|
+
import("../db-J2ITKS63.js")
|
|
164
164
|
]);
|
|
165
165
|
const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
|
|
166
166
|
const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
|
|
@@ -224,8 +224,8 @@ function localDevServerUrl() {
|
|
|
224
224
|
async function prepareLocalChatRun(io, pluginSet) {
|
|
225
225
|
defaultStateAdapterForLocalChat();
|
|
226
226
|
await configureLocalChatPlugins(pluginSet);
|
|
227
|
-
const { runLocalAgentTurn } = await import("../runner-
|
|
228
|
-
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-
|
|
227
|
+
const { runLocalAgentTurn } = await import("../runner-53V5GIQM.js");
|
|
228
|
+
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-NQYKBT24.js");
|
|
229
229
|
const { createLocalOAuthState } = await import("../oauth-relay-3ZU72UGL.js");
|
|
230
230
|
const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-CDFAP67O.js");
|
|
231
231
|
const agentRunner = createAgentRunner(executeAgentRun);
|
package/dist/cli/check.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseSkillFile
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-AKG4TZNH.js";
|
|
4
|
+
import "../chunk-CU7HTGNI.js";
|
|
5
5
|
import {
|
|
6
6
|
parseInlinePluginManifest,
|
|
7
7
|
parsePluginManifest
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-5O3JDQDG.js";
|
|
9
9
|
import "../chunk-W3U3YQYI.js";
|
|
10
10
|
import "../chunk-HZF5P5UN.js";
|
|
11
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-72Z3HNTQ.js";
|
|
12
12
|
import "../chunk-OB42YVAE.js";
|
|
13
13
|
import "../chunk-F3B2YJ76.js";
|
|
14
14
|
import "../chunk-6GWA276C.js";
|
|
@@ -18,8 +18,8 @@ import {
|
|
|
18
18
|
JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
|
|
19
19
|
JUNIOR_HEARTBEAT_ROUTE,
|
|
20
20
|
LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import "../chunk-
|
|
21
|
+
} from "../chunk-WUNPRM76.js";
|
|
22
|
+
import "../chunk-3GE3F4LT.js";
|
|
23
23
|
import "../chunk-MLKGABMK.js";
|
|
24
24
|
|
|
25
25
|
// src/cli/check.ts
|
package/dist/cli/main.js
CHANGED
|
@@ -22,7 +22,7 @@ async function runInit(dir) {
|
|
|
22
22
|
await mod.runInit(dir);
|
|
23
23
|
}
|
|
24
24
|
async function runSnapshotCreate() {
|
|
25
|
-
const mod = await import("./snapshot-
|
|
25
|
+
const mod = await import("./snapshot-create.js");
|
|
26
26
|
await mod.runSnapshotCreate();
|
|
27
27
|
}
|
|
28
28
|
async function runCheck(dir) {
|
package/dist/cli/plugins.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
validatePluginEgressCredentialHooks,
|
|
3
3
|
validatePluginRegistrations
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-W5JEQQEA.js";
|
|
5
5
|
import {
|
|
6
6
|
pluginCatalogConfigFromPluginSet,
|
|
7
7
|
pluginCliRegistrationsFromPluginSet,
|
|
@@ -14,31 +14,31 @@ import {
|
|
|
14
14
|
createPluginLogger,
|
|
15
15
|
setPlugins,
|
|
16
16
|
validatePlugins
|
|
17
|
-
} from "../chunk-
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
17
|
+
} from "../chunk-STUI6NIL.js";
|
|
18
|
+
import "../chunk-KU6ALEJC.js";
|
|
19
|
+
import "../chunk-YRWJ3KEU.js";
|
|
20
20
|
import {
|
|
21
21
|
getDb
|
|
22
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-ZRQUQJUV.js";
|
|
23
23
|
import "../chunk-RXRQJF7Y.js";
|
|
24
24
|
import "../chunk-4ZNGQH7C.js";
|
|
25
|
-
import "../chunk-
|
|
25
|
+
import "../chunk-DS27ZBSP.js";
|
|
26
26
|
import "../chunk-VFUK3X5B.js";
|
|
27
27
|
import "../chunk-FXOYURO4.js";
|
|
28
28
|
import {
|
|
29
29
|
pluginCatalogRuntime
|
|
30
|
-
} from "../chunk-
|
|
31
|
-
import "../chunk-
|
|
30
|
+
} from "../chunk-CU7HTGNI.js";
|
|
31
|
+
import "../chunk-5O3JDQDG.js";
|
|
32
32
|
import "../chunk-W3U3YQYI.js";
|
|
33
33
|
import "../chunk-HZF5P5UN.js";
|
|
34
|
-
import "../chunk-
|
|
34
|
+
import "../chunk-72Z3HNTQ.js";
|
|
35
35
|
import "../chunk-OB42YVAE.js";
|
|
36
36
|
import "../chunk-F3B2YJ76.js";
|
|
37
37
|
import "../chunk-6GWA276C.js";
|
|
38
38
|
import "../chunk-B3IT5END.js";
|
|
39
39
|
import "../chunk-3V7OFJZC.js";
|
|
40
|
-
import "../chunk-
|
|
41
|
-
import "../chunk-
|
|
40
|
+
import "../chunk-WUNPRM76.js";
|
|
41
|
+
import "../chunk-3GE3F4LT.js";
|
|
42
42
|
import "../chunk-MLKGABMK.js";
|
|
43
43
|
|
|
44
44
|
// src/cli/plugins.ts
|