@sentry/junior 0.271.0 → 0.273.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/{adapter-Bqbtr1RV.js → adapter-umap1cth.js} +1 -1
- package/dist/{admin-CWBjzyN0.js → admin-0o6E_3lo.js} +1 -1
- package/dist/{agent-runner-BiHsH8O_.js → agent-runner-D7Qz-lGO.js} +899 -631
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +5 -5
- package/dist/api.d.ts +1 -1
- package/dist/api.js +62 -537
- package/dist/{app-C81xfpNa.d.ts → app-BcyhJq8x.d.ts} +4 -9
- package/dist/app.d.ts +1 -1
- package/dist/app.js +673 -134
- package/dist/{assistant-reply-DgtX9DaJ.js → assistant-reply-wZ7i4OFa.js} +1 -1
- package/dist/{automation-Dwh_xcqM.js → automation-yffXcZt9.js} +1 -1
- package/dist/{briefs-0FeSJHQ3.js → briefs-CgMnlpIp.js} +4 -4
- package/dist/{catalog-runtime-Bw9kjGVu.js → catalog-runtime-TygDsPOU.js} +1 -1
- package/dist/cli/chat.js +15 -15
- package/dist/cli/check.js +3 -3
- package/dist/cli/init.js +1 -1
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -3
- package/dist/{client-B0jlQSgO.js → client-DhqbV0Fe.js} +63 -5
- package/dist/{reporting-schema-CZREhYc-.js → common-Eu6sx09c.js} +4 -1
- package/dist/{config-DrAeD8sr.js → config-C6FTd7PX.js} +7 -15
- package/dist/{connections-BzN2K0G9.js → connections-Dq72KajR.js} +11 -11
- package/dist/{conversation-AhOVzN_k.js → conversation-T4oabbBi.js} +22 -1
- package/dist/{conversation-privacy-D1NhUxyo.js → conversation-privacy-BeRgrsph.js} +1 -1
- package/dist/{credential-sync-DpNWl4yy.js → credential-sync-BmCbHAp4.js} +15 -16
- package/dist/{db-DSabI7jJ.d.ts → db-DOzBGLn5.d.ts} +11 -1
- package/dist/{executor-C2cRw0hZ.js → executor-BafgvQcc.js} +25 -7
- package/dist/instrumentation.js +114 -3
- package/dist/{job-queue-CEeLYkSj.js → job-queue-C4lphW9Y.js} +3 -3
- package/dist/{logging-DuwXUuIY.js → logging-CNs1e04n.js} +6 -1
- package/dist/message-CETC5lsl.js +186 -0
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-oM5TJt34.js → oauth-callback-server-DcQZsKMm.js} +2 -2
- package/dist/{credentialed-mh7HBqey.js → projection-BOpi891B.js} +4576 -49
- package/dist/{prompt-BPSdXYXV.js → prompt-B1ySjUyf.js} +1 -1
- package/dist/{registry-BPtbAVFo.js → registry-B-yUrv3h.js} +2 -2
- package/dist/{resolve-D44G1jJm.js → resolve-DqVtd4Q9.js} +3 -3
- package/dist/{result-CvP8c5bb.js → result-DQwTiLTw.js} +16 -12
- package/dist/{runner-FIGIKvk2.js → runner-Dco5qMq6.js} +11 -11
- package/dist/{sandbox-egress-signals-C_JzucwP.js → sandbox-egress-signals-DFc_9Mcv.js} +1 -1
- package/dist/{schema-DKZgO-xf.js → schema-5xHDGlBW.js} +10 -9
- package/dist/{schema-DPCvePop.d.ts → schema-9OGdsaxF.d.ts} +28 -3
- package/dist/{service-account-1mJGRAvx.js → service-account-CWfk9Cs-.js} +3 -3
- package/dist/{service-account-CHO3YXpt.js → service-account-smdPFWNy.js} +3 -3
- package/dist/{session-stop-DuUB1rwQ.js → session-stop-DaT_7tYa.js} +50 -24
- package/dist/{skills-DHK7L9Eo.js → skills-BbtJSF2-.js} +2 -2
- package/dist/{spawn-CKl_ySIq.js → spawn-Ceikdjkp.js} +2 -2
- package/dist/{list-DjJJ5K0x.js → stop-dKUc-x2K.js} +1017 -469
- package/dist/{store-Di0E4EvU.js → store-C1xuZcLd.js} +48 -31
- package/dist/{store-BF2XEeQz.js → store-DaxUuOmD.js} +3 -3
- package/dist/{task-queue-CC7IFtbT.js → task-queue-ymAh_-P1.js} +4 -4
- package/dist/{task-runner-DKZtMFwa.js → task-runner-vlH6pEm3.js} +6 -6
- package/dist/{thread-state-BQ1T3eeF.js → thread-state-BkUpE9Ae.js} +4 -5
- package/dist/{turn-failure-response-B5eSFoHn.js → turn-failure-response-DIsD7ip_.js} +7 -8
- package/dist/{turn-lifecycle-CTLEIEOn.js → turn-lifecycle-BdPKdPS8.js} +1 -1
- package/dist/turn-session-routing-BdCTDq9m.js +1625 -0
- package/dist/{validation-Cjo-3yt3.js → validation-BQjCfh84.js} +1 -1
- package/dist/{version-D30MBLLw.js → version-BpiFGZZW.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-D3jhuP66.js → viewer-C6Y1aXjZ.js} +49 -21
- package/dist/{work-CL9QwQcl.js → work-ChPh_YEh.js} +27 -39
- package/dist/{worker-S2P7IJDI.js → worker-Be_sK_ou.js} +6 -6
- package/migrations/0072_conversation_read_positions.sql +10 -0
- package/migrations/meta/0072_snapshot.json +4064 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +4 -4
- package/dist/message-CRe3WBKc.js +0 -59
- package/dist/turn-session-routing-BFVp8TbU.js +0 -6072
- package/migrations/AGENTS.md +0 -8
- package/dist/{oauth-relay-CTygMkNx.js → oauth-relay-C6ZAyJgf.js} +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as resolveLocalScheduleAtMs, i as isValidTimeZone, r as getZonedDateTimeParts, t as getFirstRunAtMs } from "./cadence-R7Em4RjE.js";
|
|
2
|
-
import { n as actorIdentitySchema } from "./conversation-
|
|
2
|
+
import { n as actorIdentitySchema } from "./conversation-T4oabbBi.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { actorUserIdSchema, destinationVisibilitySchema, eventMatchFieldsSchema, eventMatchSchema, eventReachSchema, eventTypeSchema, pluginEventTypeSchema, slackDestinationSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
|
|
5
5
|
// src/chat/scheduled-automations/schedule-intent.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as completeObject } from "./client-
|
|
1
|
+
import { i as completeObject } from "./client-DhqbV0Fe.js";
|
|
2
2
|
import { i as defaultModelId } from "./model-profile-B998sjVd.js";
|
|
3
|
-
import {
|
|
4
|
-
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-
|
|
3
|
+
import { K as briefCodeChangeSchema, X as parseBriefInput, d as conversationDetailReportSchema, p as conversationEventPageSchema } from "./conversation-T4oabbBi.js";
|
|
4
|
+
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-B1ySjUyf.js";
|
|
5
5
|
import { CLI_USAGE } from "./cli/run.js";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { z } from "zod";
|
|
@@ -267,7 +267,7 @@ async function parseRunOptions(argv) {
|
|
|
267
267
|
* `DATABASE_URL` at import, and `briefs pull` must work with only a token.
|
|
268
268
|
*/
|
|
269
269
|
async function configuredDefaultModelId() {
|
|
270
|
-
const { botConfig } = await import("./config-
|
|
270
|
+
const { botConfig } = await import("./config-C6FTd7PX.js").then((n) => n.r);
|
|
271
271
|
return defaultModelId(botConfig);
|
|
272
272
|
}
|
|
273
273
|
function apiUrl(baseUrl, pathname) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
-
import { t as createPluginCatalogRuntime } from "./registry-
|
|
2
|
+
import { t as createPluginCatalogRuntime } from "./registry-B-yUrv3h.js";
|
|
3
3
|
// src/chat/plugins/catalog-runtime.ts
|
|
4
4
|
var catalog_runtime_exports = /* @__PURE__ */ __exportAll({ pluginCatalogRuntime: () => pluginCatalogRuntime });
|
|
5
5
|
const pluginCatalogRuntime = createPluginCatalogRuntime();
|
package/dist/cli/chat.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-
|
|
1
|
+
import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-D7Qz-lGO.js";
|
|
2
2
|
import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -99,10 +99,10 @@ async function loadLocalPluginSet() {
|
|
|
99
99
|
async function configureLocalChatPlugins(pluginSet) {
|
|
100
100
|
const [pluginsModule, agentHooksModule, catalogRuntimeModule, validationModule, databaseModule] = await Promise.all([
|
|
101
101
|
import("../plugins-DOm9Y6qI.js").then((n) => n.o),
|
|
102
|
-
import("../
|
|
103
|
-
import("../catalog-runtime-
|
|
104
|
-
import("../validation-
|
|
105
|
-
import("../viewer-
|
|
102
|
+
import("../projection-BOpi891B.js").then((n) => n.Tn),
|
|
103
|
+
import("../catalog-runtime-TygDsPOU.js").then((n) => n.t),
|
|
104
|
+
import("../validation-BQjCfh84.js").then((n) => n.r),
|
|
105
|
+
import("../viewer-C6Y1aXjZ.js").then((n) => n.v)
|
|
106
106
|
]);
|
|
107
107
|
const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
|
|
108
108
|
const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
|
|
@@ -152,18 +152,18 @@ function localDevServerUrl() {
|
|
|
152
152
|
async function prepareLocalChatRun(io, pluginSet) {
|
|
153
153
|
defaultStateAdapterForLocalChat();
|
|
154
154
|
await configureLocalChatPlugins(pluginSet);
|
|
155
|
-
const { setBriefsConfig } = await import("../
|
|
155
|
+
const { setBriefsConfig } = await import("../projection-BOpi891B.js").then((n) => n.Ln);
|
|
156
156
|
setBriefsConfig({ enabled: true });
|
|
157
|
-
const { runLocalAgentTurn } = await import("../runner-
|
|
158
|
-
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-
|
|
159
|
-
const { createLocalOAuthState } = await import("../oauth-relay-
|
|
160
|
-
const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-
|
|
161
|
-
const { bindSpawnAgent } = await import("../spawn-
|
|
162
|
-
const { bindMessageAgent } = await import("../message-
|
|
163
|
-
const { createChildConversationWorker } = await import("../result-
|
|
164
|
-
const { skipInputBeforeConversationStop } = await import("../session-stop-
|
|
157
|
+
const { runLocalAgentTurn } = await import("../runner-Dco5qMq6.js");
|
|
158
|
+
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-DcQZsKMm.js");
|
|
159
|
+
const { createLocalOAuthState } = await import("../oauth-relay-C6ZAyJgf.js").then((n) => n.t);
|
|
160
|
+
const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-DFc_9Mcv.js");
|
|
161
|
+
const { bindSpawnAgent } = await import("../spawn-Ceikdjkp.js").then((n) => n.n);
|
|
162
|
+
const { bindMessageAgent } = await import("../message-CETC5lsl.js").then((n) => n.n);
|
|
163
|
+
const { createChildConversationWorker } = await import("../result-DQwTiLTw.js").then((n) => n.i);
|
|
164
|
+
const { skipInputBeforeConversationStop } = await import("../session-stop-DaT_7tYa.js").then((n) => n.r);
|
|
165
165
|
const { createLocalConversationWork } = await import("../conversation-work-BaT_T6EB.js");
|
|
166
|
-
const { processConversationWork } = await import("../worker-
|
|
166
|
+
const { processConversationWork } = await import("../worker-Be_sK_ou.js").then((n) => n.n);
|
|
167
167
|
let agentRunner;
|
|
168
168
|
const localConversationWork = createLocalConversationWork(async (message) => {
|
|
169
169
|
if (!agentRunner) throw new Error("Local agent runner is not ready");
|
package/dist/cli/check.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, P as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, k as JUNIOR_HEARTBEAT_ROUTE } from "../logging-
|
|
2
|
-
import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-
|
|
3
|
-
import { i as parseSkillFile } from "../skills-
|
|
1
|
+
import { D as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, P as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, k as JUNIOR_HEARTBEAT_ROUTE } from "../logging-CNs1e04n.js";
|
|
2
|
+
import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-B-yUrv3h.js";
|
|
3
|
+
import { i as parseSkillFile } from "../skills-BbtJSF2-.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import fs from "node:fs/promises";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
package/dist/cli/init.js
CHANGED
|
@@ -156,7 +156,6 @@ async function runInit(dir, log = console.log) {
|
|
|
156
156
|
SLACK_SIGNING_SECRET=
|
|
157
157
|
JUNIOR_SECRET=
|
|
158
158
|
JUNIOR_BOT_NAME=
|
|
159
|
-
JUNIOR_CROSS_ACTOR_MID_RUN_MODE=
|
|
160
159
|
AI_MODEL=
|
|
161
160
|
AI_FAST_MODEL=
|
|
162
161
|
AI_GUARDIAN_MODEL=
|
|
@@ -164,6 +163,7 @@ AI_HANDOFF_MODEL=
|
|
|
164
163
|
AI_MODEL_PROFILES=
|
|
165
164
|
AI_MEMORY_MODEL=
|
|
166
165
|
AI_EMBEDDING_MODEL=
|
|
166
|
+
AI_RERANKING_MODEL=
|
|
167
167
|
AI_VISION_MODEL=
|
|
168
168
|
AI_WEB_SEARCH_MODEL=
|
|
169
169
|
DATABASE_URL=
|
package/dist/cli/main.js
CHANGED
|
@@ -25,13 +25,13 @@ async function runChat(argv, pluginSet) {
|
|
|
25
25
|
return await (await import("./chat.js")).runChat(argv, void 0, { pluginSet });
|
|
26
26
|
}
|
|
27
27
|
async function runAdmin(argv) {
|
|
28
|
-
return await (await import("../admin-
|
|
28
|
+
return await (await import("../admin-0o6E_3lo.js")).runAdmin(argv);
|
|
29
29
|
}
|
|
30
30
|
async function runServiceAccount(argv) {
|
|
31
|
-
return await (await import("../service-account-
|
|
31
|
+
return await (await import("../service-account-CWfk9Cs-.js")).runServiceAccount(argv);
|
|
32
32
|
}
|
|
33
33
|
async function runBriefs(argv) {
|
|
34
|
-
return await (await import("../briefs-
|
|
34
|
+
return await (await import("../briefs-CgMnlpIp.js")).runBriefs(argv);
|
|
35
35
|
}
|
|
36
36
|
function topLevelCommand(argv) {
|
|
37
37
|
return (argv[0] === "--" ? argv.slice(1) : argv)[0];
|
package/dist/cli/plugins.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-
|
|
1
|
+
import { Ca as createPluginLogger, Fn as validatePlugins, Pn as setPlugins } from "../projection-BOpi891B.js";
|
|
2
|
+
import { S as getDb } from "../viewer-C6Y1aXjZ.js";
|
|
3
|
+
import { n as pluginCatalogRuntime } from "../catalog-runtime-TygDsPOU.js";
|
|
4
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-BQjCfh84.js";
|
|
5
5
|
import { a as pluginRuntimeRegistrationsFromPluginSet, i as pluginCliRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "../plugins-DOm9Y6qI.js";
|
|
6
6
|
import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
|
|
7
7
|
import { stderr, stdout } from "node:process";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as disconnectStateAdapter } from "../adapter-
|
|
4
|
-
import { n as resolve } from "../resolve-
|
|
1
|
+
import { Sr as create } from "../projection-BOpi891B.js";
|
|
2
|
+
import { n as pluginCatalogRuntime } from "../catalog-runtime-TygDsPOU.js";
|
|
3
|
+
import { t as disconnectStateAdapter } from "../adapter-umap1cth.js";
|
|
4
|
+
import { n as resolve } from "../resolve-DqVtd4Q9.js";
|
|
5
5
|
// src/cli/snapshot-create.ts
|
|
6
6
|
const DEFAULT_RUNTIME = "node22";
|
|
7
7
|
const DEFAULT_TIMEOUT_MS = 6e5;
|
package/dist/cli/upgrade.d.ts
CHANGED
package/dist/cli/upgrade.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as getChatConfig } from "../config-
|
|
2
|
-
import { t as createJuniorSqlExecutor } from "../executor-
|
|
3
|
-
import { t as createPluginCatalogRuntime } from "../registry-
|
|
1
|
+
import { i as getChatConfig } from "../config-C6FTd7PX.js";
|
|
2
|
+
import { t as createJuniorSqlExecutor } from "../executor-BafgvQcc.js";
|
|
3
|
+
import { t as createPluginCatalogRuntime } from "../registry-B-yUrv3h.js";
|
|
4
4
|
import { n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "../plugins-DOm9Y6qI.js";
|
|
5
5
|
import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
|
|
6
6
|
import { basename, dirname, join, resolve } from "node:path";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-
|
|
2
|
-
import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-
|
|
1
|
+
import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-CNs1e04n.js";
|
|
2
|
+
import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-BeRgrsph.js";
|
|
3
3
|
import { calculateCost, completeSimple, getEnvApiKey, getModels, registerApiProvider } from "@earendil-works/pi-ai/compat";
|
|
4
4
|
import { stream as streamAnthropic, streamSimple as streamSimpleAnthropic } from "@earendil-works/pi-ai/api/anthropic-messages";
|
|
5
5
|
import { createGatewayProvider } from "@ai-sdk/gateway";
|
|
6
6
|
import { getVercelOidcToken } from "@vercel/oidc";
|
|
7
|
-
import { Experimental_DecisionRefusalError, NoObjectGeneratedError, embedMany, experimental_decide, generateObject } from "ai";
|
|
7
|
+
import { Experimental_DecisionRefusalError, NoObjectGeneratedError, embedMany, experimental_decide, generateObject, rerank } from "ai";
|
|
8
8
|
// src/chat/optional-string.ts
|
|
9
9
|
/**
|
|
10
10
|
* Normalize optional env-style strings so blank values do not masquerade as
|
|
@@ -405,6 +405,7 @@ const GEN_AI_PROVIDER_NAME = GATEWAY_PROVIDER;
|
|
|
405
405
|
const GEN_AI_SERVER_ADDRESS = "ai-gateway.vercel.sh";
|
|
406
406
|
const GEN_AI_OPERATION_CHAT = "chat";
|
|
407
407
|
const GEN_AI_OPERATION_EMBEDDINGS = "embeddings";
|
|
408
|
+
const GEN_AI_OPERATION_RERANK = "rerank";
|
|
408
409
|
const GEN_AI_OPERATION_DECIDE = "decide";
|
|
409
410
|
const EMBEDDING_INPUT_COST_USD_PER_MILLION_TOKENS = {
|
|
410
411
|
"cohere/embed-v4.0": .12,
|
|
@@ -439,7 +440,13 @@ function extractText(message) {
|
|
|
439
440
|
function resolveGatewayModel(modelId) {
|
|
440
441
|
const matched = GATEWAY_MODEL_OVERRIDES[modelId] ?? getModels(GATEWAY_PROVIDER).find((model) => model.id === modelId);
|
|
441
442
|
if (!matched) throw new Error(`Unknown AI Gateway model id: ${modelId}`);
|
|
442
|
-
return
|
|
443
|
+
return {
|
|
444
|
+
...matched,
|
|
445
|
+
compat: {
|
|
446
|
+
...matched.compat,
|
|
447
|
+
sendSessionAffinityHeaders: true
|
|
448
|
+
}
|
|
449
|
+
};
|
|
443
450
|
}
|
|
444
451
|
/** Execute a direct chat completion inside a dedicated `gen_ai.chat` span. */
|
|
445
452
|
async function completeText(params) {
|
|
@@ -728,4 +735,55 @@ async function embedTexts(params) {
|
|
|
728
735
|
throw providerError;
|
|
729
736
|
}
|
|
730
737
|
}
|
|
731
|
-
|
|
738
|
+
/** Read the billed cost that AI Gateway reports in provider metadata. */
|
|
739
|
+
function gatewayCostUsd(providerMetadata) {
|
|
740
|
+
const cost = providerMetadata?.gateway?.cost;
|
|
741
|
+
const value = typeof cost === "string" ? Number(cost) : cost;
|
|
742
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
|
|
743
|
+
}
|
|
744
|
+
/** Score documents against one query through the host-owned AI Gateway provider. */
|
|
745
|
+
async function rerankTexts(params) {
|
|
746
|
+
const query = params.query.trim();
|
|
747
|
+
if (!query || params.documents.length === 0) throw new Error("Reranking query and documents are required.");
|
|
748
|
+
const credential = await resolveGatewayCredential();
|
|
749
|
+
const provider = createGatewayProvider({ apiKey: credential.token });
|
|
750
|
+
try {
|
|
751
|
+
return await withSpan(`${GEN_AI_OPERATION_RERANK} ${params.modelId}`, "gen_ai.rerank", logContextFromMetadata(params.modelId, params.metadata), async (setSpanAttributes) => {
|
|
752
|
+
const result = await rerank({
|
|
753
|
+
model: provider.rerankingModel(params.modelId),
|
|
754
|
+
query,
|
|
755
|
+
documents: params.documents
|
|
756
|
+
});
|
|
757
|
+
const scores = params.documents.map(() => NaN);
|
|
758
|
+
for (const { originalIndex, score } of result.ranking) scores[originalIndex] = score;
|
|
759
|
+
if (result.ranking.length !== params.documents.length || !scores.every(Number.isFinite)) throw createProviderError("Reranking provider returned invalid scores.", {
|
|
760
|
+
kind: "invalid_response",
|
|
761
|
+
modelId: params.modelId
|
|
762
|
+
});
|
|
763
|
+
const costUsd = gatewayCostUsd(result.providerMetadata);
|
|
764
|
+
if (costUsd !== void 0) setSpanAttributes(extractGenAiUsageAttributes({ cost: { total: costUsd } }));
|
|
765
|
+
return {
|
|
766
|
+
...costUsd !== void 0 ? { costUsd } : void 0,
|
|
767
|
+
scores
|
|
768
|
+
};
|
|
769
|
+
}, {
|
|
770
|
+
"gen_ai.provider.name": GEN_AI_PROVIDER_NAME,
|
|
771
|
+
"gen_ai.operation.name": GEN_AI_OPERATION_RERANK,
|
|
772
|
+
"gen_ai.request.model": params.modelId,
|
|
773
|
+
"server.address": GEN_AI_SERVER_ADDRESS,
|
|
774
|
+
"server.port": 443,
|
|
775
|
+
"gen_ai.provider.auth_mode": credential.mode,
|
|
776
|
+
"app.rerank.document.count": params.documents.length
|
|
777
|
+
});
|
|
778
|
+
} catch (error) {
|
|
779
|
+
const providerError = createProviderError(error, { modelId: params.modelId });
|
|
780
|
+
if (isProviderRetryError(providerError)) throw providerError;
|
|
781
|
+
logException(providerError, "ai.rerank.failed", {
|
|
782
|
+
"gen_ai.provider.name": GEN_AI_PROVIDER_NAME,
|
|
783
|
+
"gen_ai.operation.name": GEN_AI_OPERATION_RERANK,
|
|
784
|
+
"gen_ai.request.model": params.modelId
|
|
785
|
+
});
|
|
786
|
+
throw providerError;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
export { toOptionalTrimmed as C, resolveGatewayCredential as S, findProviderError as _, completeText as a, isProviderRetryError as b, resolveGatewayModel as c, isCompactionSummaryText as d, renderCurrentInstruction as f, createProviderError as g, ProviderError as h, completeObject as i, COMPACTION_SUMMARY_PREFIX as l, escapeXml as m, GEN_AI_SERVER_ADDRESS as n, embedTexts as o, unwrapCurrentInstruction as p, completeDecision as r, rerankTexts as s, GEN_AI_PROVIDER_NAME as t, hasCompactedConversationContext as u, getProviderErrorAttributes as v, getGatewayApiKey as x, getProviderErrorUserMessage as y };
|
|
@@ -101,4 +101,7 @@ const pluginOperationalReportFeedSchema = z.object({
|
|
|
101
101
|
reports: z.array(pluginOperationalReportSchema),
|
|
102
102
|
source: z.literal("plugins")
|
|
103
103
|
}).strict();
|
|
104
|
-
|
|
104
|
+
// src/api/schema/common.ts
|
|
105
|
+
/** Stable error body returned by Junior-owned REST endpoints. */
|
|
106
|
+
const apiErrorSchema = z.object({ error: z.string().min(1) }).strict();
|
|
107
|
+
export { pluginPackageContentItemReportSchema as a, pluginsSchema as c, skillReportsSchema as d, pluginOperationalReportSchema as i, runtimeInfoReportSchema as l, healthReportSchema as n, pluginPackageContentReportSchema as o, pluginOperationalReportFeedSchema as r, pluginSchema as s, apiErrorSchema as t, skillReportSchema as u };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
-
import {
|
|
3
|
-
import { h as logWarn } from "./logging-
|
|
2
|
+
import { C as toOptionalTrimmed, c as resolveGatewayModel } from "./client-DhqbV0Fe.js";
|
|
3
|
+
import { h as logWarn } from "./logging-CNs1e04n.js";
|
|
4
4
|
import { c as modelProfileSchema, d as parseTurnReasoningLevel, t as DEFAULT_MODEL_PROFILES, u as TURN_REASONING_LEVELS } from "./model-profile-B998sjVd.js";
|
|
5
5
|
import { AwsClient } from "aws4fetch";
|
|
6
6
|
// src/chat/attachments/s3.ts
|
|
@@ -149,7 +149,6 @@ var config_exports = /* @__PURE__ */ __exportAll({
|
|
|
149
149
|
resetRuntimeConfig: () => resetRuntimeConfig,
|
|
150
150
|
restoreRuntimeConfig: () => restoreRuntimeConfig,
|
|
151
151
|
setBotModelConfig: () => setBotModelConfig,
|
|
152
|
-
setCrossActorMidRunMode: () => setCrossActorMidRunMode,
|
|
153
152
|
setProfiles: () => setProfiles,
|
|
154
153
|
setRuntimeLimits: () => setRuntimeLimits,
|
|
155
154
|
setSlackReactionConfig: () => setSlackReactionConfig,
|
|
@@ -252,11 +251,6 @@ function parseConversationWorkEnabled(rawValue) {
|
|
|
252
251
|
if (value === "false") return false;
|
|
253
252
|
throw new Error("JUNIOR_CONVERSATION_WORK_ENABLED must be true or false");
|
|
254
253
|
}
|
|
255
|
-
function parseCrossActorMidRunMode(rawValue) {
|
|
256
|
-
const value = toOptionalTrimmed(rawValue) ?? "follow_up";
|
|
257
|
-
if (value === "follow_up" || value === "steer") return value;
|
|
258
|
-
throw new Error("JUNIOR_CROSS_ACTOR_MID_RUN_MODE must be follow_up or steer");
|
|
259
|
-
}
|
|
260
254
|
const DEFAULT_MODEL_ID = resolveGatewayModel(DEFAULT_MODEL_PROFILES.standard.modelId).id;
|
|
261
255
|
const DEFAULT_FAST_MODEL_ID = resolveGatewayModel("openai/gpt-6-luna").id;
|
|
262
256
|
const DEFAULT_GUARDIAN_MODEL_ID = resolveGatewayModel("openai/gpt-6-luna").id;
|
|
@@ -264,7 +258,8 @@ const DEFAULT_HANDOFF_MODEL_ID = resolveGatewayModel(DEFAULT_MODEL_PROFILES.hand
|
|
|
264
258
|
const DEFAULT_WEB_SEARCH_MODEL_ID = resolveGatewayModel("openai/gpt-6-luna").id;
|
|
265
259
|
const DEFAULT_DECISION_MODEL_ID = "typesafe-ai/jev";
|
|
266
260
|
const DEFAULT_EMBEDDING_MODEL_ID = "openai/text-embedding-3-small";
|
|
267
|
-
const
|
|
261
|
+
const DEFAULT_RERANKING_MODEL_ID = "voyage/rerank-2.5-lite";
|
|
262
|
+
const DEFAULT_IMAGE_GENERATION_MODEL_ID = "openai/gpt-image-2";
|
|
268
263
|
const DEFAULT_VISION_MODEL_ID = resolveGatewayModel("openai/gpt-5.6-sol").id;
|
|
269
264
|
function validateGatewayModelId(raw) {
|
|
270
265
|
const trimmed = toOptionalTrimmed(raw);
|
|
@@ -374,7 +369,6 @@ function readBotConfig(env, functionMaxDurationSeconds) {
|
|
|
374
369
|
return {
|
|
375
370
|
userName: toOptionalTrimmed(env.JUNIOR_BOT_NAME) ?? "junior",
|
|
376
371
|
defaultProfile: "standard",
|
|
377
|
-
crossActorMidRunMode: parseCrossActorMidRunMode(env.JUNIOR_CROSS_ACTOR_MID_RUN_MODE),
|
|
378
372
|
profiles: parseProfiles(env.AI_MODEL_PROFILES, modelId, handoffModelId),
|
|
379
373
|
contextWindowTokens: parseOptionalPositiveInteger("AI_MODEL_CONTEXT_WINDOW_TOKENS", env.AI_MODEL_CONTEXT_WINDOW_TOKENS) ?? DEFAULT_MODEL_CONTEXT_WINDOW_TOKENS,
|
|
380
374
|
reasoningLevel: reasoningLevel === void 0 ? void 0 : parseTurnReasoningLevel(reasoningLevel),
|
|
@@ -383,6 +377,7 @@ function readBotConfig(env, functionMaxDurationSeconds) {
|
|
|
383
377
|
guardianModelId,
|
|
384
378
|
imageGenerationModelId: toOptionalTrimmed(env.AI_IMAGE_MODEL) ?? DEFAULT_IMAGE_GENERATION_MODEL_ID,
|
|
385
379
|
embeddingModelId: validateEmbeddingModelId(env.AI_EMBEDDING_MODEL) ?? DEFAULT_EMBEDDING_MODEL_ID,
|
|
380
|
+
rerankingModelId: toOptionalTrimmed(env.AI_RERANKING_MODEL) ?? DEFAULT_RERANKING_MODEL_ID,
|
|
386
381
|
loadingMessages: parseLoadingMessages(env.JUNIOR_LOADING_MESSAGES),
|
|
387
382
|
visionModelId: env.AI_VISION_MODEL === void 0 ? DEFAULT_VISION_MODEL_ID : validateGatewayModelId(env.AI_VISION_MODEL),
|
|
388
383
|
maxAgentDepth: 0,
|
|
@@ -515,10 +510,6 @@ function setRuntimeLimits(limits) {
|
|
|
515
510
|
if (limits?.maxTurnCostUsd !== void 0) bot.maxTurnCostUsd = requirePositiveLimit("maxTurnCostUsd", limits.maxTurnCostUsd);
|
|
516
511
|
if (limits?.turnTimeoutMs !== void 0) bot.turnTimeoutMs = Math.min(requirePositiveLimit("turnTimeoutMs", limits.turnTimeoutMs), resolveMaxTurnTimeoutMs(chatConfig.functionMaxDurationSeconds));
|
|
517
512
|
}
|
|
518
|
-
/** Apply the Slack cross-actor steering mode from createApp(). */
|
|
519
|
-
function setCrossActorMidRunMode(mode) {
|
|
520
|
-
chatConfig.bot.crossActorMidRunMode = parseCrossActorMidRunMode(mode);
|
|
521
|
-
}
|
|
522
513
|
/** Return the chat configuration (parsed once at startup). */
|
|
523
514
|
function getChatConfig() {
|
|
524
515
|
return chatConfig;
|
|
@@ -547,6 +538,7 @@ function setBotModelConfig(config) {
|
|
|
547
538
|
if (config.embeddingModelId !== void 0) botConfig.embeddingModelId = requireModelId("embeddingModelId", config.embeddingModelId, validateEmbeddingModelId);
|
|
548
539
|
if (config.fastModelId !== void 0) botConfig.fastModelId = requireModelId("fastModelId", config.fastModelId, validateGatewayModelId);
|
|
549
540
|
if (config.guardianModelId !== void 0) botConfig.guardianModelId = requireModelId("guardianModelId", config.guardianModelId, validateGatewayModelId);
|
|
541
|
+
if (config.rerankingModelId !== void 0) botConfig.rerankingModelId = requireModelId("rerankingModelId", config.rerankingModelId, toOptionalTrimmed);
|
|
550
542
|
if (config.imageGenerationModelId !== void 0) botConfig.imageGenerationModelId = requireModelId("imageGenerationModelId", config.imageGenerationModelId, validateEmbeddingModelId);
|
|
551
543
|
if (config.visionModelId !== void 0) botConfig.visionModelId = requireModelId("visionModelId", config.visionModelId, validateGatewayModelId);
|
|
552
544
|
if (config.webSearchModelId !== void 0) botConfig.webSearchModelId = requireModelId("webSearchModelId", config.webSearchModelId, validateGatewayModelId);
|
|
@@ -566,4 +558,4 @@ function setSlackReactionConfig(overrides) {
|
|
|
566
558
|
if (overrides.processingReactionEmoji !== void 0) chatConfig.slack.processingReactionEmoji = parseReactionEmoji("processingReactionEmoji", overrides.processingReactionEmoji, chatConfig.slack.processingReactionEmoji);
|
|
567
559
|
if (overrides.completedReactionEmoji !== void 0) chatConfig.slack.completedReactionEmoji = parseReactionEmoji("completedReactionEmoji", overrides.completedReactionEmoji, chatConfig.slack.completedReactionEmoji);
|
|
568
560
|
}
|
|
569
|
-
export {
|
|
561
|
+
export { normalizeSlackEmojiName as _, getRuntimeMetadata as a, getSlackClientSecret as c, restoreRuntimeConfig as d, setBotModelConfig as f, snapshotRuntimeConfig as g, setSlackReactionConfig as h, getChatConfig as i, getSlackSigningSecret as l, setRuntimeLimits as m, botConfig as n, getSlackBotToken as o, setProfiles as p, config_exports as r, getSlackClientId as s, DEFAULT_SQL_STATEMENT_TIMEOUT_MS as t, resetRuntimeConfig as u, createS3AttachmentStorage as v };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
3
|
-
import { C as getSqlExecutor, F as
|
|
4
|
-
import { u as hasRequiredOAuthScope } from "./registry-
|
|
5
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
6
|
-
import { c as deleteMcpServerSessionId, l as deleteMcpStoredOAuthCredentials, s as deleteMcpAuthSessionsForUserProvider } from "./agent-runner-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { z } from "zod";
|
|
1
|
+
import { $ as loadTurnCheckpoint, Nr as startOAuthFlow, it as getTurnRecord, rt as failTurnRecord } from "./projection-BOpi891B.js";
|
|
2
|
+
import { n as botConfig } from "./config-C6FTd7PX.js";
|
|
3
|
+
import { C as getSqlExecutor, F as deleteProviderIdentityForSlackUser, I as deleteProviderIdentityForUser, y as getConversationEventStore } from "./viewer-C6Y1aXjZ.js";
|
|
4
|
+
import { u as hasRequiredOAuthScope } from "./registry-B-yUrv3h.js";
|
|
5
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-TygDsPOU.js";
|
|
6
|
+
import { c as deleteMcpServerSessionId, l as deleteMcpStoredOAuthCredentials, s as deleteMcpAuthSessionsForUserProvider } from "./agent-runner-D7Qz-lGO.js";
|
|
7
|
+
import { r as getStateAdapter } from "./adapter-umap1cth.js";
|
|
8
|
+
import { a as getVercelConversationWorkQueue } from "./job-queue-C4lphW9Y.js";
|
|
9
|
+
import { m as ensureConversationWake, w as requestConversationWork } from "./store-DaxUuOmD.js";
|
|
10
|
+
import { n as resolveTurnSessionRouting } from "./turn-session-routing-BdCTDq9m.js";
|
|
12
11
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
12
|
+
import { z } from "zod";
|
|
13
13
|
// src/chat/task-execution/authorized-turn.ts
|
|
14
14
|
/**
|
|
15
15
|
* OAuth callbacks save readiness, not agent history. The conversation worker
|
|
@@ -230,6 +230,15 @@ function annotationCard(annotation) {
|
|
|
230
230
|
title: value.label
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
|
+
// src/api/schema/conversation-read-position.ts
|
|
234
|
+
/**
|
|
235
|
+
* How far the signed-in viewer has read a Conversation transcript.
|
|
236
|
+
*
|
|
237
|
+
* `lastReadSeq` is the event sequence of the last transcript row the viewer
|
|
238
|
+
* saw. The server keeps the highest value it receives, so it only moves
|
|
239
|
+
* forward.
|
|
240
|
+
*/
|
|
241
|
+
const conversationReadPositionSchema = z.object({ lastReadSeq: z.number().int().nonnegative() }).strict();
|
|
233
242
|
// src/api/schema/child-agent-totals.ts
|
|
234
243
|
/**
|
|
235
244
|
* The part of a Conversation total that its child agents spent, at any depth.
|
|
@@ -305,6 +314,8 @@ const conversationPendingMessageDeliverySchema = z.enum(["defer", "interrupt"]);
|
|
|
305
314
|
/** One accepted mailbox message that has not reached durable history yet. */
|
|
306
315
|
const conversationPendingMessageSchema = z.object({
|
|
307
316
|
actorIdentity: actorIdentitySchema.optional(),
|
|
317
|
+
/** Identity id of the author. Detail `authors` maps it to the person. */
|
|
318
|
+
actorIdentityId: z.string().min(1).optional(),
|
|
308
319
|
createdAt: z.string().datetime(),
|
|
309
320
|
delivery: conversationPendingMessageDeliverySchema,
|
|
310
321
|
inboundMessageId: z.string().min(1),
|
|
@@ -462,6 +473,8 @@ const conversationReportMessageEventDataSchema = z.object({
|
|
|
462
473
|
]),
|
|
463
474
|
source: z.enum(["slack", "web"]).optional(),
|
|
464
475
|
actorIdentity: actorIdentitySchema.optional(),
|
|
476
|
+
/** Identity id of the author. Detail `authors` maps it to the person. */
|
|
477
|
+
actorIdentityId: z.string().min(1).optional(),
|
|
465
478
|
/** Agent invocation whose input this is. An agent wrote it, not a person. */
|
|
466
479
|
agentInvocationId: z.string().min(1).optional(),
|
|
467
480
|
eventType: z.string().min(1).optional(),
|
|
@@ -815,6 +828,8 @@ const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
|
|
|
815
828
|
agentTree: z.array(conversationAgentTreeNodeSchema).min(2).optional(),
|
|
816
829
|
/** The viewer can fork this conversation from an assistant reply. */
|
|
817
830
|
canFork: z.boolean().optional(),
|
|
831
|
+
/** How far the signed-in viewer has read. Absent until they read. */
|
|
832
|
+
readPosition: conversationReadPositionSchema.optional(),
|
|
818
833
|
forkedFromConversationId: z.string().optional(),
|
|
819
834
|
/** Title of the fork source, when the viewer can open it. */
|
|
820
835
|
forkedFromTitle: z.string().optional(),
|
|
@@ -827,6 +842,12 @@ const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
|
|
|
827
842
|
version: z.number().int().positive()
|
|
828
843
|
}).strict().optional(),
|
|
829
844
|
modelUsage: z.array(conversationModelUsageSchema).optional(),
|
|
845
|
+
/**
|
|
846
|
+
* Each person who wrote in the Conversation, by each of their Identity
|
|
847
|
+
* ids. Messages and pending messages name their author with
|
|
848
|
+
* `actorIdentityId`.
|
|
849
|
+
*/
|
|
850
|
+
authors: z.record(z.string(), actorIdentitySchema).optional(),
|
|
830
851
|
events: z.array(conversationReportEventSchema),
|
|
831
852
|
eventHistory: conversationEventHistorySchema,
|
|
832
853
|
previousCursor: z.string().min(1).optional(),
|
|
@@ -845,4 +866,4 @@ const conversationFeedSchema = z.object({
|
|
|
845
866
|
source: z.literal("conversation_index"),
|
|
846
867
|
generatedAt: z.string()
|
|
847
868
|
}).strict();
|
|
848
|
-
export { createConversationMessageBodySchema as A,
|
|
869
|
+
export { createConversationMessageBodySchema as A, readMessageCardRefs as B, conversationReportEventSchema as C, conversationSurfaceSchema as D, conversationSummaryReportSchema as E, conversationChildAgentTotalsSchema as F, readMessageAttachments as G, resolveMessageCards as H, conversationReadPositionSchema as I, briefOutcomeStatusSchema as J, briefCodeChangeSchema as K, annotationCard as L, forkConversationResponseSchema as M, steerConversationPendingMessagesBodySchema as N, conversationUsageSchema as O, steerConversationPendingMessagesResponseSchema as P, messageCardRef as R, conversationReportEventDataSchema as S, conversationReportStatusSchema as T, MAX_INPUT_IMAGES as U, removedCardSchema as V, MAX_INPUT_IMAGE_BYTES as W, parseBriefInput as X, conversationBriefSchema as Y, conversationParamsSchema as _, cancelConversationPendingMessagesBodySchema as a, conversationPendingMessageSchema as b, conversationAttachmentParamsSchema as c, conversationDetailReportSchema as d, conversationEventHistorySchema as f, conversationFeedSchema as g, conversationFeedQuerySchema as h, archiveConversationResponseSchema as i, forkConversationBodySchema as j, createConversationBodySchema as k, conversationAuxiliaryCostsSchema as l, conversationEventsQuerySchema as m, actorIdentitySchema as n, cancelConversationPendingMessagesResponseSchema as o, conversationEventPageSchema as p, briefLinkSchema as q, archiveConversationBodySchema as r, conversationActivityPreviewSchema as s, acceptedConversationMessageSchema as t, conversationDetailQuerySchema as u, conversationPendingAuthorizationSchema as v, conversationReportMessageEventSchema as w, conversationPendingMessagesReportSchema as x, conversationPendingMessageDeliverySchema as y, messageCardText as z };
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as getRuntimeMetadata, n as botConfig } from "./config-
|
|
4
|
-
import { R as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-
|
|
1
|
+
import { Ar as formatProviderLabel, Gi as getSlackClient, Kr as postSlackMessage, Mr as resolveBaseUrl, Sn as createUserTokenStore, X as getConversationPendingAuth, f as recordAuthenticationLinked, it as getTurnRecord, jr as parseOAuthStatePayload, p as recordAuthorizationCompleted, wn as resolvePluginOAuthAccount } from "./projection-BOpi891B.js";
|
|
2
|
+
import { m as escapeXml } from "./client-DhqbV0Fe.js";
|
|
3
|
+
import { a as getRuntimeMetadata, n as botConfig } from "./config-C6FTd7PX.js";
|
|
4
|
+
import { R as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-CNs1e04n.js";
|
|
5
5
|
import { p as parseSlackUserId } from "./actor-B4DYygOB.js";
|
|
6
|
-
import {
|
|
6
|
+
import { C as getSqlExecutor, L as findUserByVerifiedEmails, N as resolveActorIdentityId, V as upsertLinkedIdentity, o as readIdentityById } from "./viewer-C6Y1aXjZ.js";
|
|
7
7
|
import { i as homeDir } from "./package-discovery-DJBompdd.js";
|
|
8
|
-
import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-
|
|
9
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
10
|
-
import { t as discoverSkills } from "./skills-
|
|
11
|
-
import { a as finalizeMcpAuthorization, d as getMcpStoredOAuthCredentials, f as putMcpStoredOAuthCredentials, o as deleteMcpAuthSession, u as getMcpAuthSession, v as lookupSlackUserProfile } from "./agent-runner-
|
|
12
|
-
import { Dn as getSlackClient, Et as postSlackMessage, dt as parseOAuthStatePayload, ft as resolveBaseUrl, i as resolvePluginOAuthAccount, n as createUserTokenStore, ut as formatProviderLabel } from "./credentialed-mh7HBqey.js";
|
|
8
|
+
import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-B-yUrv3h.js";
|
|
9
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-TygDsPOU.js";
|
|
10
|
+
import { t as discoverSkills } from "./skills-BbtJSF2-.js";
|
|
11
|
+
import { a as finalizeMcpAuthorization, d as getMcpStoredOAuthCredentials, f as putMcpStoredOAuthCredentials, o as deleteMcpAuthSession, u as getMcpAuthSession, v as lookupSlackUserProfile } from "./agent-runner-D7Qz-lGO.js";
|
|
13
12
|
import { r as acquireActiveLock } from "./locks-D-0h111u.js";
|
|
14
|
-
import { r as getStateAdapter } from "./adapter-
|
|
15
|
-
import { _ as getMcpProviderErrorAttributes } from "./service-account-
|
|
16
|
-
import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-
|
|
17
|
-
import { c as deleteWebAuthorization, i as readConnectedOAuthTokens, m as wakePausedTurn, p as wakeAuthorizedTurn, u as htmlCallbackResponse } from "./connections-
|
|
18
|
-
import { n as relayLocalOAuthCallback } from "./oauth-relay-
|
|
13
|
+
import { r as getStateAdapter } from "./adapter-umap1cth.js";
|
|
14
|
+
import { _ as getMcpProviderErrorAttributes } from "./service-account-smdPFWNy.js";
|
|
15
|
+
import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-BkUpE9Ae.js";
|
|
16
|
+
import { c as deleteWebAuthorization, i as readConnectedOAuthTokens, m as wakePausedTurn, p as wakeAuthorizedTurn, u as htmlCallbackResponse } from "./connections-Dq72KajR.js";
|
|
17
|
+
import { n as relayLocalOAuthCallback } from "./oauth-relay-C6ZAyJgf.js";
|
|
19
18
|
import path from "node:path";
|
|
20
|
-
import { z } from "zod";
|
|
21
19
|
import { createHmac, createSecretKey, timingSafeEqual } from "node:crypto";
|
|
20
|
+
import { z } from "zod";
|
|
22
21
|
import { pluginStoredTokensSchema } from "@sentry/junior-plugin-api";
|
|
23
22
|
import fs from "node:fs";
|
|
24
23
|
// src/handlers/mcp-oauth-callback.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./schema-
|
|
1
|
+
import "./schema-9OGdsaxF.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { Destination, Source, locationSchema } from "@sentry/junior-plugin-api";
|
|
4
4
|
import "drizzle-orm/pg-core";
|
|
@@ -149,6 +149,16 @@ interface ConversationStore {
|
|
|
149
149
|
providerDestinationId: string;
|
|
150
150
|
providerTenantId?: string;
|
|
151
151
|
}): Promise<ConversationPrivacy | undefined>;
|
|
152
|
+
/**
|
|
153
|
+
* Store live visibility for a Destination that has no Conversation yet,
|
|
154
|
+
* such as a channel that an Automation moves to.
|
|
155
|
+
*/
|
|
156
|
+
recordDestinationVisibility(args: {
|
|
157
|
+
channelName?: string;
|
|
158
|
+
destination: Destination;
|
|
159
|
+
nowMs?: number;
|
|
160
|
+
visibility: ConversationPrivacy;
|
|
161
|
+
}): Promise<void>;
|
|
152
162
|
/**
|
|
153
163
|
* Resolve one Slack channel id from a known destination display name.
|
|
154
164
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./config-
|
|
2
|
-
import { p as logException } from "./logging-
|
|
1
|
+
import "./config-C6FTd7PX.js";
|
|
2
|
+
import { p as logException } from "./logging-CNs1e04n.js";
|
|
3
3
|
import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, f as timestamptz, i as juniorAgentBindings, l as juniorUsers, s as juniorConversations } from "./agent-invocations-C1RNOCs8.js";
|
|
4
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
5
|
import { sql } from "drizzle-orm";
|
|
@@ -239,8 +239,8 @@ const juniorConversationBindings = pgTable("junior_conversation_bindings", {
|
|
|
239
239
|
// src/db/schema/conversation-participants.ts
|
|
240
240
|
/**
|
|
241
241
|
* Materialized personal-feed membership for one linked user on one root
|
|
242
|
-
* conversation. Rows come from the root actor and from
|
|
243
|
-
*
|
|
242
|
+
* conversation. Rows come from the root actor and from the authors of Turn
|
|
243
|
+
* input messages. Thread context authors do not get a row.
|
|
244
244
|
*/
|
|
245
245
|
const juniorConversationParticipants = pgTable("junior_conversation_participants", {
|
|
246
246
|
userId: text("user_id").notNull().references(() => juniorUsers.id),
|
|
@@ -255,6 +255,23 @@ const juniorConversationParticipants = pgTable("junior_conversation_participants
|
|
|
255
255
|
index("junior_conversation_participants_user_activity_idx").on(table.userId, table.lastMessageAt.desc()),
|
|
256
256
|
index("junior_conversation_participants_root_idx").on(table.rootConversationId)
|
|
257
257
|
]);
|
|
258
|
+
// src/db/schema/conversation-read-positions.ts
|
|
259
|
+
/**
|
|
260
|
+
* How far one signed-in user has read one Conversation transcript.
|
|
261
|
+
*
|
|
262
|
+
* `last_read_seq` is the event sequence of the last transcript row the user
|
|
263
|
+
* saw. It only moves forward, so clients on several devices can write in any
|
|
264
|
+
* order.
|
|
265
|
+
*/
|
|
266
|
+
const juniorConversationReadPositions = pgTable("junior_conversation_read_positions", {
|
|
267
|
+
userId: text("user_id").notNull().references(() => juniorUsers.id),
|
|
268
|
+
conversationId: text("conversation_id").notNull().references(() => juniorConversations.conversationId),
|
|
269
|
+
lastReadSeq: integer("last_read_seq").notNull(),
|
|
270
|
+
updatedAt: timestamptz("updated_at").notNull()
|
|
271
|
+
}, (table) => [primaryKey({
|
|
272
|
+
name: "junior_conversation_read_positions_user_conversation_pk",
|
|
273
|
+
columns: [table.userId, table.conversationId]
|
|
274
|
+
})]);
|
|
258
275
|
// src/db/schema/location-configurations.ts
|
|
259
276
|
/** Durable user configuration entries scoped to provider Locations. */
|
|
260
277
|
const juniorLocationConfigurations = pgTable("junior_location_configurations", {
|
|
@@ -384,8 +401,8 @@ const juniorAutomationRuns = pgTable("junior_automation_runs", {
|
|
|
384
401
|
]);
|
|
385
402
|
// src/db/schema/review-items.ts
|
|
386
403
|
/**
|
|
387
|
-
* One Review item: something that needs a person.
|
|
388
|
-
* `
|
|
404
|
+
* One Review item: something that needs a person. An action item stores its
|
|
405
|
+
* `request`, and
|
|
389
406
|
* its `answer` after an assignee submits it. `closed_at` is set for `done`
|
|
390
407
|
* and `dismissed`. `closed_by_user_id` is null when an agent closed it.
|
|
391
408
|
*/
|
|
@@ -526,6 +543,7 @@ const juniorSqlSchema = {
|
|
|
526
543
|
juniorConversationBriefs,
|
|
527
544
|
juniorConversationBindings,
|
|
528
545
|
juniorConversationParticipants,
|
|
546
|
+
juniorConversationReadPositions,
|
|
529
547
|
juniorConversations,
|
|
530
548
|
juniorLocationConfigurations,
|
|
531
549
|
juniorDestinations,
|
|
@@ -788,4 +806,4 @@ function createJuniorSqlExecutor(args) {
|
|
|
788
806
|
statementTimeoutMs
|
|
789
807
|
});
|
|
790
808
|
}
|
|
791
|
-
export {
|
|
809
|
+
export { juniorCodeChanges as C, juniorArtifacts as E, juniorConversationAnnotations as S, juniorAttachments as T, juniorConversationBriefs as _, juniorReviewItemAssignees as a, juniorConversationEvents as b, juniorReviewItems as c, juniorAutomations as d, juniorStats as f, juniorConversationBindings as g, juniorConversationParticipants as h, juniorWorkspaces as i, juniorAutomationRuns as l, juniorConversationReadPositions as m, juniorSnapshots as n, juniorReviewItemConversations as o, juniorLocationConfigurations as p, juniorWorkspaceRepos as r, juniorReviewItemSlackCards as s, createJuniorSqlExecutor as t, juniorAutomationVersions as u, CONVERSATION_METRICS as v, juniorCodeRepositories as w, juniorApiTokens as x, juniorConversationMetrics as y };
|