@sentry/junior 0.303.0 → 0.305.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-context-BdVnSuY5.js → adapter-context-BpvbUki8.js} +2 -2
- package/dist/{admin-AfeAdS3J.js → admin-CoDt35ny.js} +5 -5
- package/dist/{agent-runner-BP8_DLUv.js → agent-runner-C5d6rY5g.js} +600 -389
- package/dist/api/schema.d.ts +1 -1
- package/dist/api/schema.js +5 -5
- package/dist/api.d.ts +1 -1
- package/dist/api.js +59 -61
- package/dist/{app-Dd9v1mNx.d.ts → app-Cs157Zc5.d.ts} +5 -3
- package/dist/app.d.ts +1 -1
- package/dist/app.js +86 -82
- package/dist/{automation-D9MvhOWY.js → automation-CuA3yEcD.js} +1 -1
- package/dist/{background-compaction-queue-xaE05jxH.js → background-compaction-queue-BTqMIfTA.js} +7 -3
- package/dist/{briefs-D8i-dKTp.js → briefs-BRdznF7c.js} +11 -8
- package/dist/{catalog-runtime-d1EM6Z0V.js → catalog-runtime-J52Tej47.js} +1 -1
- package/dist/cli/chat.js +15 -15
- package/dist/cli/check.js +5 -5
- 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 +5 -5
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +4 -4
- package/dist/{config-oGM7KA9M.js → config-CBZp0udd.js} +101 -7
- package/dist/{connections-BlikzEJv.js → connections-BYmuJ6Vm.js} +6 -6
- package/dist/{continue-in-slack-BZnYifiG.js → continue-in-slack-Cvot6S38.js} +8 -8
- package/dist/{conversation-CY1jnBiC.js → conversation-BOqdRtUx.js} +4 -12
- package/dist/{conversation-feed-BZJRk6UV.js → conversation-feed-CgpgP7yi.js} +35 -2
- package/dist/{conversation-privacy-Cx515ddM.js → conversation-privacy-D2pOzBNl.js} +10 -2
- package/dist/{conversation-turn-DAhRdX4m.js → conversation-turn-CI8WDpnK.js} +17 -17
- package/dist/{credential-sync-DfhmWFeo.js → credential-sync-COqnZ1Dx.js} +14 -14
- package/dist/{db-C-2tFxk3.js → db-DU84dCVu.js} +169 -6
- package/dist/{db-DPqcEM9_.d.ts → db-zbN5ZV_o.d.ts} +2 -2
- package/dist/{executor-NVfS8aQ2.js → executor-CFyrgOu1.js} +43 -9
- package/dist/{history-UZ3M2M9r.js → history-m2-ceTTX.js} +8 -2
- package/dist/{install-CHLrpRZc.js → install-CQ76CfRw.js} +2 -2
- package/dist/instrumentation.js +7 -3
- package/dist/{lineage-HGLhd_-N.js → lineage-DLd2UxVP.js} +2 -2
- package/dist/{logging-DiyqRLBx.js → logging-BPNTQVFu.js} +1 -1
- package/dist/{message-CkCOcbFH.js → message-BWJLeQ5e.js} +8 -8
- package/dist/{model-input-DmoPPtPE.js → model-input-DoM9Ht-d.js} +2 -2
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +5 -5
- package/dist/{oauth-callback-server-CIf_6YmA.js → oauth-callback-server-DeHbnAQl.js} +2 -2
- package/dist/{projection-DBq8tsA5.js → projection-CcFBVFUo.js} +552 -63
- package/dist/{prompt-D2KlJopL.js → prompt-C5LREK2p.js} +185 -12
- package/dist/{queue-DFaOscp5.js → queue-B2AAL3ym.js} +4 -4
- package/dist/{registry-Bu0Z9BEO.js → registry-BjZZqKqi.js} +1 -1
- package/dist/{resolve-DXuA3G0g.js → resolve-CeJgXuH1.js} +3 -3
- package/dist/{result-DpiNseDA.js → result-icDrueyB.js} +8 -8
- package/dist/{runner-iu1heRFv.js → runner-nVfMkMMB.js} +9 -9
- package/dist/{sandbox-egress-signals-2HFYDcQf.js → sandbox-egress-signals-H9vQ5qRf.js} +1 -1
- package/dist/{schema-DvfX3Gq_.js → schema-Bx0Mlo32.js} +3 -3
- package/dist/{schema-DHMOaRzC.d.ts → schema-CKcu-IK6.d.ts} +43 -11
- package/dist/{service-account-BcT5LR7V.js → service-account-DU5865XA.js} +6 -5
- package/dist/{service-account-xYkaQTrw.js → service-account-Dw06p3zm.js} +5 -5
- package/dist/{session-stop-BLLp1IP_.js → session-stop-uotLtp4g.js} +181 -59
- package/dist/{skills-CNAGH4ju.js → skills-Bex1EaO5.js} +2 -2
- package/dist/{slack-conversation-unfurl-DYnqe5ci.js → slack-conversation-unfurl-EPG3riWF.js} +12 -11
- package/dist/{spawn-cGasWW33.js → spawn-CoD3vDuS.js} +6 -6
- package/dist/{state-CDS6h_Wv.js → state-nCR4Muhn.js} +4 -4
- package/dist/{stop-DMMA67yT.js → stop-BFVd0P0m.js} +170 -65
- package/dist/{store-Dgs7Oe44.js → store-Ca6G962n.js} +5 -5
- package/dist/{task-queue-DcF0nhhz.js → task-queue-BLPZU6kC.js} +3 -3
- package/dist/{task-runner-BGXF7Fo7.js → task-runner-xsOPIxCZ.js} +7 -7
- package/dist/{thread-context-BPky1KBe.js → thread-context-BOvZhsKK.js} +8 -8
- package/dist/{turn-session-routing-DGvn9MSl.js → turn-session-routing-2bW2qfeb.js} +8 -8
- package/dist/{turn-user-message-19CkuUvM.js → turn-user-message-BrhuyYrH.js} +3 -3
- package/dist/{validation-lu1DgjNQ.js → validation-BnY9K5WB.js} +1 -1
- package/dist/{version-Uo3c94Dx.js → version-qROlRQGF.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-BPQHMx3-.js → viewer-CxUiOraX.js} +3 -3
- package/dist/{warmup-H8uLvW9e.js → warmup--Gkz7iB-.js} +79 -476
- package/dist/{worker-B-pM_-3K.js → worker-DJ8d9fmD.js} +7 -7
- package/migrations/0111_attachment_kinds.sql +14 -0
- package/migrations/0112_attachment_url_fill.sql +51 -0
- package/migrations/0113_attachment_url_index.sql +1 -0
- package/migrations/meta/0099_snapshot.json +102 -326
- package/migrations/meta/0111_snapshot.json +5011 -0
- package/migrations/meta/0112_snapshot.json +5011 -0
- package/migrations/meta/0113_snapshot.json +5033 -0
- package/migrations/meta/_journal.json +21 -0
- package/package.json +7 -7
package/dist/cli/init.js
CHANGED
|
@@ -68,7 +68,7 @@ function writePnpmWorkspace(targetDir) {
|
|
|
68
68
|
minimumReleaseAgeExclude:
|
|
69
69
|
- "@sentry/*"
|
|
70
70
|
# pnpm fails the install when a dependency has an unreviewed build script.
|
|
71
|
-
# These are the
|
|
71
|
+
# These are the @sentry/junior runtime dependencies that have one.
|
|
72
72
|
allowBuilds:
|
|
73
73
|
"@google/genai": true
|
|
74
74
|
"@mongodb-js/zstd": true
|
package/dist/cli/main.js
CHANGED
|
@@ -45,13 +45,13 @@ async function runChat(argv, pluginSet) {
|
|
|
45
45
|
return await (await import("./chat.js")).runChat(argv, void 0, { pluginSet });
|
|
46
46
|
}
|
|
47
47
|
async function runAdmin(argv) {
|
|
48
|
-
return await (await import("../admin-
|
|
48
|
+
return await (await import("../admin-CoDt35ny.js")).runAdmin(argv);
|
|
49
49
|
}
|
|
50
50
|
async function runServiceAccount(argv) {
|
|
51
|
-
return await (await import("../service-account-
|
|
51
|
+
return await (await import("../service-account-Dw06p3zm.js")).runServiceAccount(argv);
|
|
52
52
|
}
|
|
53
53
|
async function runBriefs(argv) {
|
|
54
|
-
return await (await import("../briefs-
|
|
54
|
+
return await (await import("../briefs-BRdznF7c.js")).runBriefs(argv);
|
|
55
55
|
}
|
|
56
56
|
function topLevelCommand(argv) {
|
|
57
57
|
return (argv[0] === "--" ? argv.slice(1) : argv)[0];
|
package/dist/cli/plugins.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { o as getDb } from "../db-
|
|
2
|
-
import {
|
|
3
|
-
import { n as pluginCatalogRuntime } from "../catalog-runtime-
|
|
4
|
-
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-
|
|
1
|
+
import { o as getDb } from "../db-DU84dCVu.js";
|
|
2
|
+
import { _o as createPluginLogger, dr as validatePlugins, ur as setPlugins } from "../projection-CcFBVFUo.js";
|
|
3
|
+
import { n as pluginCatalogRuntime } from "../catalog-runtime-J52Tej47.js";
|
|
4
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-BnY9K5WB.js";
|
|
5
5
|
import { t as loadAppPluginSet } from "../plugin-module-Cv2ETe8Y.js";
|
|
6
6
|
import { a as pluginRuntimeRegistrationsFromPluginSet, i as pluginCliRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "../plugins-Bkk0XRo2.js";
|
|
7
7
|
import { stderr, stdout } from "node:process";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { i as getChatConfig } from "../config-
|
|
2
|
-
import { n as pluginCatalogRuntime } from "../catalog-runtime-
|
|
3
|
-
import { n as resolve } from "../resolve-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { i as getChatConfig } from "../config-CBZp0udd.js";
|
|
2
|
+
import { n as pluginCatalogRuntime } from "../catalog-runtime-J52Tej47.js";
|
|
3
|
+
import { n as resolve } from "../resolve-CeJgXuH1.js";
|
|
4
|
+
import { Za as SANDBOX_RUNTIME, ea as create } from "../projection-CcFBVFUo.js";
|
|
5
|
+
import { J as disconnectStateAdapter } from "../db-DU84dCVu.js";
|
|
6
6
|
// src/cli/snapshot-create.ts
|
|
7
7
|
const DEFAULT_TIMEOUT_MS = 6e5;
|
|
8
8
|
function progressMessage(phase) {
|
package/dist/cli/upgrade.d.ts
CHANGED
package/dist/cli/upgrade.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as getChatConfig } from "../config-
|
|
2
|
-
import { t as createJuniorSqlExecutor } from "../executor-
|
|
1
|
+
import { i as getChatConfig } from "../config-CBZp0udd.js";
|
|
2
|
+
import { t as createJuniorSqlExecutor } from "../executor-CFyrgOu1.js";
|
|
3
3
|
import { t as loadAppPluginSet } from "../plugin-module-Cv2ETe8Y.js";
|
|
4
|
-
import { t as createPluginCatalogRuntime } from "../registry-
|
|
4
|
+
import { t as createPluginCatalogRuntime } from "../registry-BjZZqKqi.js";
|
|
5
5
|
import { n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "../plugins-Bkk0XRo2.js";
|
|
6
6
|
import { basename, dirname, join, resolve } from "node:path";
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
@@ -64,7 +64,7 @@ function migrationResult(migrations, state) {
|
|
|
64
64
|
/** Reject legacy databases that must first run the bridge release upgrade. */
|
|
65
65
|
function assertSupportedMigrationState(state) {
|
|
66
66
|
if (!state.hasJuniorTables || state.appliedAt !== void 0) return;
|
|
67
|
-
throw new Error(`Existing
|
|
67
|
+
throw new Error(`Existing SQL tables have no core Drizzle migration history. Stop old workers, install @sentry/junior@${CORE_MIGRATION_BRIDGE_VERSION}, run \`junior upgrade\`, then restore this version and rerun \`junior upgrade\` before restarting workers.`);
|
|
68
68
|
}
|
|
69
69
|
/** Apply the packaged Drizzle migrations during `junior upgrade`. */
|
|
70
70
|
async function migrateSchema(executor) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-
|
|
3
|
-
import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-
|
|
2
|
+
import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-BPNTQVFu.js";
|
|
3
|
+
import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-D2pOzBNl.js";
|
|
4
4
|
import { AwsClient } from "aws4fetch";
|
|
5
5
|
import { del, get, issueSignedToken, presignUrl, put } from "@vercel/blob";
|
|
6
6
|
import * as z from "zod";
|
|
@@ -8,8 +8,9 @@ import { calculateCost, completeSimple, getEnvApiKey, getModels, registerApiProv
|
|
|
8
8
|
import { stream as streamAnthropic, streamSimple as streamSimpleAnthropic } from "@earendil-works/pi-ai/api/anthropic-messages";
|
|
9
9
|
import { createGatewayProvider } from "@ai-sdk/gateway";
|
|
10
10
|
import { getVercelOidcToken } from "@vercel/oidc";
|
|
11
|
-
import { Experimental_DecisionRefusalError, NoObjectGeneratedError, embedMany, experimental_decide, generateObject, rerank } from "ai";
|
|
11
|
+
import { Experimental_DecisionRefusalError, NoImageGeneratedError, NoObjectGeneratedError, embedMany, experimental_decide, generateImage, generateObject, generateText, rerank } from "ai";
|
|
12
12
|
import { createHash } from "node:crypto";
|
|
13
|
+
import { renderSystemMessageUpdate } from "@earendil-works/pi-ai";
|
|
13
14
|
// src/chat/optional-string.ts
|
|
14
15
|
/**
|
|
15
16
|
* Normalize optional env-style strings so blank values do not masquerade as
|
|
@@ -102,6 +103,21 @@ function createVercelAttachmentStorage() {
|
|
|
102
103
|
url: presignedUrl
|
|
103
104
|
};
|
|
104
105
|
},
|
|
106
|
+
async createDownloadUrl(input) {
|
|
107
|
+
const token = await issueSignedToken({
|
|
108
|
+
operations: ["get"],
|
|
109
|
+
pathname: input.key,
|
|
110
|
+
validUntil: input.expiresAtMs
|
|
111
|
+
});
|
|
112
|
+
const { presignedUrl } = await presignUrl(token, {
|
|
113
|
+
access: "private",
|
|
114
|
+
operation: "get",
|
|
115
|
+
pathname: input.key,
|
|
116
|
+
useCache: false,
|
|
117
|
+
validUntil: input.expiresAtMs
|
|
118
|
+
});
|
|
119
|
+
return presignedUrl;
|
|
120
|
+
},
|
|
105
121
|
async get(key, range) {
|
|
106
122
|
const result = await get(key, {
|
|
107
123
|
access: "private",
|
|
@@ -198,6 +214,10 @@ async function expectOk(response, operation) {
|
|
|
198
214
|
await drain(response);
|
|
199
215
|
if (!response.ok) throw new Error(`S3 ${operation} failed with status ${response.status}`);
|
|
200
216
|
}
|
|
217
|
+
/** Presigned URL lifetime in whole seconds, at least one. */
|
|
218
|
+
function expiresInSeconds(expiresAtMs) {
|
|
219
|
+
return String(Math.max(1, Math.ceil((expiresAtMs - Date.now()) / 1e3)));
|
|
220
|
+
}
|
|
201
221
|
/** Store private conversation attachments in an S3-compatible bucket. */
|
|
202
222
|
function createS3AttachmentStorage(config) {
|
|
203
223
|
const client = new AwsClient({
|
|
@@ -228,7 +248,7 @@ function createS3AttachmentStorage(config) {
|
|
|
228
248
|
},
|
|
229
249
|
async createUploadTarget(input) {
|
|
230
250
|
const url = new URL(objectUrl(config, input.key));
|
|
231
|
-
url.searchParams.set("X-Amz-Expires",
|
|
251
|
+
url.searchParams.set("X-Amz-Expires", expiresInSeconds(input.expiresAtMs));
|
|
232
252
|
const browserHeaders = {
|
|
233
253
|
"content-type": input.contentType,
|
|
234
254
|
"if-none-match": "*"
|
|
@@ -249,6 +269,14 @@ function createS3AttachmentStorage(config) {
|
|
|
249
269
|
})).url
|
|
250
270
|
};
|
|
251
271
|
},
|
|
272
|
+
async createDownloadUrl(input) {
|
|
273
|
+
const url = new URL(objectUrl(config, input.key));
|
|
274
|
+
url.searchParams.set("X-Amz-Expires", expiresInSeconds(input.expiresAtMs));
|
|
275
|
+
return (await client.sign(url.toString(), {
|
|
276
|
+
aws: { signQuery: true },
|
|
277
|
+
method: "GET"
|
|
278
|
+
})).url;
|
|
279
|
+
},
|
|
252
280
|
async get(key, range) {
|
|
253
281
|
const response = await client.fetch(objectUrl(config, key), range ? { headers: { range: rangeHeader(range) } } : void 0);
|
|
254
282
|
if (response.status === 404) {
|
|
@@ -764,6 +792,7 @@ function tokensForChars(chars, profile) {
|
|
|
764
792
|
}
|
|
765
793
|
function messageChars(message) {
|
|
766
794
|
switch (message.role) {
|
|
795
|
+
case "system": return renderSystemMessageUpdate(message).length;
|
|
767
796
|
case "user":
|
|
768
797
|
case "toolResult": return contentChars(message.content);
|
|
769
798
|
case "assistant": {
|
|
@@ -1043,6 +1072,7 @@ const GATEWAY_MODEL_OVERRIDES = {
|
|
|
1043
1072
|
},
|
|
1044
1073
|
compat: {
|
|
1045
1074
|
forceAdaptiveThinking: true,
|
|
1075
|
+
supportsMidConvoSystemMessages: true,
|
|
1046
1076
|
supportsTemperature: false
|
|
1047
1077
|
}
|
|
1048
1078
|
},
|
|
@@ -1089,7 +1119,8 @@ const GATEWAY_MODEL_OVERRIDES = {
|
|
|
1089
1119
|
thinkingLevelMap: {
|
|
1090
1120
|
xhigh: "xhigh",
|
|
1091
1121
|
max: "max"
|
|
1092
|
-
}
|
|
1122
|
+
},
|
|
1123
|
+
compat: { supportsMidConvoSystemMessages: true }
|
|
1093
1124
|
},
|
|
1094
1125
|
"openai/gpt-6-astra": {
|
|
1095
1126
|
id: "openai/gpt-6-astra",
|
|
@@ -1261,7 +1292,7 @@ async function completeText(params) {
|
|
|
1261
1292
|
}, startAttributes);
|
|
1262
1293
|
}
|
|
1263
1294
|
function logContextFromMetadata(modelId, metadata) {
|
|
1264
|
-
const conversationId = typeof metadata?.["conversationId"] === "string"
|
|
1295
|
+
const conversationId = typeof metadata?.["conversationId"] === "string" && metadata["conversationId"] ? metadata["conversationId"] : void 0;
|
|
1265
1296
|
const messageConversationId = typeof metadata?.["threadId"] === "string" ? metadata["threadId"] : void 0;
|
|
1266
1297
|
const destinationName = typeof metadata?.["channelId"] === "string" ? metadata["channelId"] : void 0;
|
|
1267
1298
|
const runId = typeof metadata?.["runId"] === "string" ? metadata["runId"] : void 0;
|
|
@@ -1523,6 +1554,66 @@ async function rerankTexts(params) {
|
|
|
1523
1554
|
throw providerError;
|
|
1524
1555
|
}
|
|
1525
1556
|
}
|
|
1557
|
+
const WEB_SEARCH_TOOL_NAME = "parallelSearch";
|
|
1558
|
+
/** Run one AI Gateway parallel search inside a `gen_ai.chat` span. */
|
|
1559
|
+
async function searchWeb(params) {
|
|
1560
|
+
const credential = await resolveGatewayCredential();
|
|
1561
|
+
const provider = createGatewayProvider({ apiKey: credential.token });
|
|
1562
|
+
return await withSpan(`${GEN_AI_OPERATION_CHAT} ${params.modelId}`, "gen_ai.chat", {}, async (setSpanAttributes) => {
|
|
1563
|
+
const response = await generateText({
|
|
1564
|
+
model: provider.chat(params.modelId),
|
|
1565
|
+
prompt: params.query,
|
|
1566
|
+
tools: { [WEB_SEARCH_TOOL_NAME]: provider.tools.parallelSearch({
|
|
1567
|
+
mode: "agentic",
|
|
1568
|
+
maxResults: params.maxResults
|
|
1569
|
+
}) },
|
|
1570
|
+
toolChoice: {
|
|
1571
|
+
type: "tool",
|
|
1572
|
+
toolName: WEB_SEARCH_TOOL_NAME
|
|
1573
|
+
},
|
|
1574
|
+
abortSignal: params.signal
|
|
1575
|
+
});
|
|
1576
|
+
const costUsd = gatewayCostUsd(response.providerMetadata);
|
|
1577
|
+
setSpanAttributes({
|
|
1578
|
+
"gen_ai.response.finish_reasons": [response.finishReason],
|
|
1579
|
+
...extractGenAiUsageAttributes(response.usage, costUsd !== void 0 ? { cost: { total: costUsd } } : void 0)
|
|
1580
|
+
});
|
|
1581
|
+
return {
|
|
1582
|
+
...costUsd !== void 0 ? { costUsd } : void 0,
|
|
1583
|
+
outputs: response.toolResults.filter((result) => result.toolName === WEB_SEARCH_TOOL_NAME).map((result) => result.output)
|
|
1584
|
+
};
|
|
1585
|
+
}, {
|
|
1586
|
+
"gen_ai.provider.name": GEN_AI_PROVIDER_NAME,
|
|
1587
|
+
"gen_ai.operation.name": GEN_AI_OPERATION_CHAT,
|
|
1588
|
+
"gen_ai.request.model": params.modelId,
|
|
1589
|
+
...params.promptName ? { "gen_ai.prompt.name": params.promptName } : void 0,
|
|
1590
|
+
"server.address": GEN_AI_SERVER_ADDRESS,
|
|
1591
|
+
"server.port": 443,
|
|
1592
|
+
"gen_ai.provider.auth_mode": credential.mode
|
|
1593
|
+
});
|
|
1594
|
+
}
|
|
1595
|
+
/** Generate or edit images with an AI Gateway image model. */
|
|
1596
|
+
async function generateImages(params) {
|
|
1597
|
+
const provider = createGatewayProvider({
|
|
1598
|
+
apiKey: await getGatewayApiKey(),
|
|
1599
|
+
...params.fetch ? { fetch: params.fetch } : void 0
|
|
1600
|
+
});
|
|
1601
|
+
try {
|
|
1602
|
+
const result = await generateImage({
|
|
1603
|
+
model: provider.imageModel(params.modelId),
|
|
1604
|
+
prompt: params.prompt,
|
|
1605
|
+
n: 1
|
|
1606
|
+
});
|
|
1607
|
+
const costUsd = gatewayCostUsd(result.providerMetadata);
|
|
1608
|
+
return {
|
|
1609
|
+
...costUsd !== void 0 ? { costUsd } : void 0,
|
|
1610
|
+
images: result.images
|
|
1611
|
+
};
|
|
1612
|
+
} catch (error) {
|
|
1613
|
+
if (NoImageGeneratedError.isInstance(error)) return { images: [] };
|
|
1614
|
+
throw error;
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1526
1617
|
// src/chat/slack/emoji.ts
|
|
1527
1618
|
const SLACK_EMOJI_NAME_RE = /^(?:[a-z0-9_+-]+)(?:::(?:skin-tone-[2-6]))?$/;
|
|
1528
1619
|
function normalizeSlackEmojiName(value) {
|
|
@@ -1655,6 +1746,7 @@ const DEFAULT_DECISION_MODEL_ID = "typesafe-ai/jev";
|
|
|
1655
1746
|
const DEFAULT_EMBEDDING_MODEL_ID = "openai/text-embedding-3-small";
|
|
1656
1747
|
const DEFAULT_RERANKING_MODEL_ID = "voyage/rerank-2.5-lite";
|
|
1657
1748
|
const DEFAULT_IMAGE_GENERATION_MODEL_ID = "openai/gpt-image-2";
|
|
1749
|
+
const DEFAULT_TRANSCRIPTION_MODEL_ID = "elevenlabs/scribe-v2";
|
|
1658
1750
|
const DEFAULT_VISION_MODEL_ID = resolveGatewayModel("openai/gpt-5.6-sol").id;
|
|
1659
1751
|
function validateGatewayModelId(raw) {
|
|
1660
1752
|
const trimmed = toOptionalTrimmed(raw);
|
|
@@ -1692,6 +1784,7 @@ function readBotConfig(env, functionMaxDurationSeconds) {
|
|
|
1692
1784
|
fastModelId,
|
|
1693
1785
|
guardianModelId,
|
|
1694
1786
|
imageGenerationModelId: toOptionalTrimmed(env["AI_IMAGE_MODEL"]) ?? DEFAULT_IMAGE_GENERATION_MODEL_ID,
|
|
1787
|
+
transcriptionModelId: toOptionalTrimmed(env["AI_TRANSCRIPTION_MODEL"]) ?? DEFAULT_TRANSCRIPTION_MODEL_ID,
|
|
1695
1788
|
embeddingModelId: validateEmbeddingModelId(env["AI_EMBEDDING_MODEL"]) ?? DEFAULT_EMBEDDING_MODEL_ID,
|
|
1696
1789
|
rerankingModelId: toOptionalTrimmed(env["AI_RERANKING_MODEL"]) ?? DEFAULT_RERANKING_MODEL_ID,
|
|
1697
1790
|
loadingMessages: parseLoadingMessages(env["JUNIOR_LOADING_MESSAGES"]),
|
|
@@ -1859,6 +1952,7 @@ function setBotModelConfig(config) {
|
|
|
1859
1952
|
if (config.guardianModelId !== void 0) botConfig.guardianModelId = requireModelId("guardianModelId", config.guardianModelId, validateGatewayModelId);
|
|
1860
1953
|
if (config.rerankingModelId !== void 0) botConfig.rerankingModelId = requireModelId("rerankingModelId", config.rerankingModelId, toOptionalTrimmed);
|
|
1861
1954
|
if (config.imageGenerationModelId !== void 0) botConfig.imageGenerationModelId = requireModelId("imageGenerationModelId", config.imageGenerationModelId, validateEmbeddingModelId);
|
|
1955
|
+
if (config.transcriptionModelId !== void 0) botConfig.transcriptionModelId = requireModelId("transcriptionModelId", config.transcriptionModelId, toOptionalTrimmed);
|
|
1862
1956
|
if (config.visionModelId !== void 0) botConfig.visionModelId = requireModelId("visionModelId", config.visionModelId, validateGatewayModelId);
|
|
1863
1957
|
if (config.refusalFallbackModelId !== void 0) botConfig.refusalFallbackModelId = requireModelId("refusalFallbackModelId", config.refusalFallbackModelId, validateGatewayModelId);
|
|
1864
1958
|
if (config.webSearchModelId !== void 0) botConfig.webSearchModelId = requireModelId("webSearchModelId", config.webSearchModelId, validateGatewayModelId);
|
|
@@ -1875,4 +1969,4 @@ function setSlackReactionConfig(overrides) {
|
|
|
1875
1969
|
if (overrides.processingReactionEmoji !== void 0) chatConfig.slack.processingReactionEmoji = parseReactionEmoji("processingReactionEmoji", overrides.processingReactionEmoji, chatConfig.slack.processingReactionEmoji);
|
|
1876
1970
|
if (overrides.completedReactionEmoji !== void 0) chatConfig.slack.completedReactionEmoji = parseReactionEmoji("completedReactionEmoji", overrides.completedReactionEmoji, chatConfig.slack.completedReactionEmoji);
|
|
1877
1971
|
}
|
|
1878
|
-
export {
|
|
1972
|
+
export { bufferBody as $, searchWeb as A, unwrapCurrentInstruction as B, completeObject as C, generateImages as D, gatewayCostUsd as E, textCharsForTokens as F, createProviderError as G, escapeXmlText as H, COMPACTION_SUMMARY_PREFIX as I, getProviderErrorUserMessage as J, findProviderError as K, hasCompactedConversationContext as L, estimateMessagesTokens as M, estimateRequestOverheadTokens as N, rerankTexts as O, estimateTextTokens as P, resolveGatewayCredential as Q, isCompactionSummaryText as R, completeDecision as S, embedTexts as T, ProviderError as U, escapeXml as V, createAssistantProviderError as W, isProviderRetryError as X, isProviderRefusal as Y, getGatewayApiKey as Z, TURN_REASONING_LEVELS as _, getRuntimeMetadata as a, GEN_AI_PROVIDER_NAME as b, getSlackClientSecret as c, restoreRuntimeConfig as d, getAttachmentStorage as et, setBotModelConfig as f, snapshotRuntimeConfig as g, setSlackReactionConfig as h, getChatConfig as i, requestPrefixAttributes as j, resolveGatewayModel as k, getSlackSigningSecret as l, setRuntimeLimits as m, botConfig as n, getSlackBotToken as o, setBotName as p, getProviderErrorAttributes as q, config_exports as r, getSlackClientId as s, DEFAULT_SQL_STATEMENT_TIMEOUT_MS as t, toOptionalTrimmed as tt, resetRuntimeConfig as u, toPiReasoningLevel as v, completeText as w, GEN_AI_SERVER_ADDRESS as x, normalizeSlackEmojiName as y, renderCurrentInstruction as z };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
3
|
-
import {
|
|
4
|
-
import { u as hasRequiredOAuthScope } from "./registry-
|
|
5
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
6
|
-
import { h as deleteMcpStoredOAuthCredentials, m as deleteMcpServerSessionId, p as deleteMcpAuthSessionsForUserProvider } from "./service-account-
|
|
1
|
+
import { da as startOAuthFlow } from "./projection-CcFBVFUo.js";
|
|
2
|
+
import { n as botConfig } from "./config-CBZp0udd.js";
|
|
3
|
+
import { R as deleteProviderIdentityForSlackUser, s as getSqlExecutor, z as deleteProviderIdentityForUser } from "./db-DU84dCVu.js";
|
|
4
|
+
import { u as hasRequiredOAuthScope } from "./registry-BjZZqKqi.js";
|
|
5
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-J52Tej47.js";
|
|
6
|
+
import { h as deleteMcpStoredOAuthCredentials, m as deleteMcpServerSessionId, p as deleteMcpAuthSessionsForUserProvider } from "./service-account-DU5865XA.js";
|
|
7
7
|
import { randomBytes } from "node:crypto";
|
|
8
8
|
// src/handlers/oauth-html.ts
|
|
9
9
|
/** Build pre-escaped callback HTML with the shared response security policy. */
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Ao as readLatestConversationBrief, Ca as getSlackMessagePermalink, Da as postSlackMessage, Lt as moveIdleConversationDestination, Sa as deleteSlackMessage, ki as getDashboardConversationLink, ma as formatSlackLink, pa as escapeSlackMrkdwnText } from "./projection-CcFBVFUo.js";
|
|
2
|
+
import { C as withConversationMutationLock, M as setFirstConversationLocation, X as getStateAdapter, a as getConversationStore, it as getConversationIdByProviderConversation, o as getDb, rt as claimProviderConversation, s as getSqlExecutor } from "./db-DU84dCVu.js";
|
|
3
3
|
import { u as parseSlackChannelId, v as parseSlackMessageTs } from "./actor-D2iXzvlN.js";
|
|
4
|
-
import {
|
|
5
|
-
import "./store-
|
|
6
|
-
import {
|
|
4
|
+
import { mr as joinPublicChannelForRead, pr as checkSlackChannelReadAccess } from "./warmup--Gkz7iB-.js";
|
|
5
|
+
import "./store-Ca6G962n.js";
|
|
6
|
+
import { I as juniorDestinations } from "./executor-CFyrgOu1.js";
|
|
7
7
|
import { and, eq } from "drizzle-orm";
|
|
8
8
|
// src/chat/slack/continue-in-slack.ts
|
|
9
9
|
/** Refusal for a move that cannot wait for the active Run. */
|
|
10
|
-
const BUSY = "Wait for
|
|
11
|
-
const THREAD_TAKEN = "This thread already has a
|
|
10
|
+
const BUSY = "Wait for the current reply to finish, then try again.";
|
|
11
|
+
const THREAD_TAKEN = "This Slack thread already has a conversation.";
|
|
12
12
|
const MOVED_ELSEWHERE = /* @__PURE__ */ new Error("Conversation already has a Location");
|
|
13
13
|
/**
|
|
14
14
|
* Return whether a Conversation can still move to a Slack thread.
|
|
@@ -25,7 +25,7 @@ function canContinueInSlack(conversation, access) {
|
|
|
25
25
|
}
|
|
26
26
|
/** Text for the first message of the Conversation in Slack. */
|
|
27
27
|
async function movedMessageText(conversation, actorName) {
|
|
28
|
-
const title = conversation.title ?? "
|
|
28
|
+
const title = conversation.title ?? "Untitled conversation";
|
|
29
29
|
const url = getDashboardConversationLink(conversation.conversationId);
|
|
30
30
|
const brief = await readLatestConversationBrief(getDb(), conversation.conversationId);
|
|
31
31
|
return [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as conversationTurnFailureReasonSchema, h as usageSchema, i as conversationTurnFailureCodeSchema } from "./history-
|
|
1
|
+
import { a as conversationTurnFailureReasonSchema, h as usageSchema, i as conversationTurnFailureCodeSchema } from "./history-m2-ceTTX.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
import { codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, objectFactFields, objectTypeSchema } from "@sentry/junior-plugin-api";
|
|
4
4
|
// src/chat/briefs/schema.ts
|
|
@@ -155,8 +155,8 @@ const messageAttachmentSchema = z.object({
|
|
|
155
155
|
contentType: z.string().min(1),
|
|
156
156
|
bytes: z.number().int().nonnegative(),
|
|
157
157
|
/**
|
|
158
|
-
* True for a large Slack file that Junior
|
|
159
|
-
* downloads it from Slack, so it has no preview.
|
|
158
|
+
* True for a large Slack file that Junior has not stored yet. A
|
|
159
|
+
* dashboard read downloads it from Slack, so it has no preview.
|
|
160
160
|
*/
|
|
161
161
|
pending: z.literal(true).optional()
|
|
162
162
|
}).strict();
|
|
@@ -424,14 +424,6 @@ const conversationEventsQuerySchema = z.union([
|
|
|
424
424
|
limit: conversationEventsLimitSchema
|
|
425
425
|
}).strict()
|
|
426
426
|
]);
|
|
427
|
-
const conversationFeedQuerySchema = z.object({
|
|
428
|
-
actorEmail: z.string().trim().email().transform((value) => value.toLowerCase()).optional(),
|
|
429
|
-
codeRepositoryId: z.string().uuid().optional(),
|
|
430
|
-
/** `nextCursor` from the previous page of the same feed. */
|
|
431
|
-
cursor: z.string().min(1).max(500).optional(),
|
|
432
|
-
q: z.string().trim().max(200).optional(),
|
|
433
|
-
status: z.enum(["active", "archived"]).default("active")
|
|
434
|
-
}).strict();
|
|
435
427
|
/** Client key that makes a retried send the same Message. */
|
|
436
428
|
const idempotencyKeySchema = z.string().trim().min(1).max(200);
|
|
437
429
|
const createConversationMessageBodySchema = z.object({
|
|
@@ -1024,4 +1016,4 @@ const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
|
|
|
1024
1016
|
sentryConversationUrl: z.string().optional(),
|
|
1025
1017
|
sourceTask: conversationSourceTaskSchema.optional()
|
|
1026
1018
|
}).strict().superRefine(validateConversationEvents);
|
|
1027
|
-
export {
|
|
1019
|
+
export { conversationBriefSchema as $, agentTypeSchema as A, messageCardText as B, createConversationMessageBodySchema as C, conversationChildAgentTotalsSchema as D, idempotencyKeySchema as E, renameConversationResponseSchema as F, MAX_INPUT_ATTACHMENTS as G, removedCardSchema as H, conversationReadPositionSchema as I, readMessageAttachments as J, inputFileSchema as K, reviewItemChangeRecordSchema as L, CONVERSATION_TITLE_MAX_LENGTH as M, conversationTitleSchema as N, AGENT_TYPES as O, renameConversationBodySchema as P, briefResourceLabel as Q, annotationCard as R, createConversationBodySchema as S, forkConversationResponseSchema as T, resolveMessageCards as U, readMessageCardRefs as V, MAX_ATTACHMENT_BYTES as W, briefLinkSchema as X, briefCodeChangeSchema as Y, briefOutcomeStatusSchema as Z, conversationReportMessageEventSchema as _, conversationActivityPreviewSchema as a, conversationSurfaceSchema as b, conversationAuxiliaryCostsSchema as c, conversationEventHistorySchema as d, parseBriefInput as et, conversationEventPageSchema as f, conversationReportEventSchema as g, conversationReportEventDataSchema as h, actorIdentitySchema as i, formatAgentTypes as j, agentTypeInstructions as k, conversationDetailQuerySchema as l, conversationParamsSchema as m, CONVERSATION_VERSION_HEADER as n, conversationAttachmentParamsSchema as o, conversationEventsQuerySchema as p, messageAttachmentSchema as q, acceptedConversationMessageSchema as r, conversationAttachmentQuerySchema as s, CONVERSATION_DETAIL_VERSION_HEADER as t, parseStoredBrief as tt, conversationDetailReportSchema as u, conversationReportStatusSchema as v, forkConversationBodySchema as w, conversationUsageSchema as x, conversationSummaryReportSchema as y, messageCardRef as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as reviewItemChangeRecordSchema, Z as briefOutcomeStatusSchema, i as actorIdentitySchema, q as messageAttachmentSchema, u as conversationDetailReportSchema, y as conversationSummaryReportSchema } from "./conversation-BOqdRtUx.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
// src/api/objects/cards.ts
|
|
4
4
|
const MAX_LABEL_CHARS = 256;
|
|
@@ -295,12 +295,45 @@ const conversationFeedBriefSchema = z.object({
|
|
|
295
295
|
status: briefOutcomeStatusSchema,
|
|
296
296
|
summary: z.string()
|
|
297
297
|
}).strict();
|
|
298
|
+
const conversationFeedIncludeSchema = z.enum(["links", "media"]);
|
|
299
|
+
/** Query of `GET /api/conversations`. */
|
|
300
|
+
const conversationFeedQuerySchema = z.object({
|
|
301
|
+
actorEmail: z.string().trim().email().transform((value) => value.toLowerCase()).optional(),
|
|
302
|
+
codeRepositoryId: z.string().uuid().optional(),
|
|
303
|
+
/** `nextCursor` from the previous page of the same feed. */
|
|
304
|
+
cursor: z.string().min(1).max(500).optional(),
|
|
305
|
+
/**
|
|
306
|
+
* Extra row content that costs a query, comma separated: `media` for
|
|
307
|
+
* each row's newest files, `links` for web links from its recent
|
|
308
|
+
* messages. Rows show them only where the viewer sees private content.
|
|
309
|
+
*/
|
|
310
|
+
include: z.string().default("").transform((value) => [...new Set(value.split(",").filter(Boolean))]).pipe(z.array(conversationFeedIncludeSchema)),
|
|
311
|
+
q: z.string().trim().max(200).optional(),
|
|
312
|
+
status: z.enum(["active", "archived"]).default("active")
|
|
313
|
+
}).strict();
|
|
314
|
+
/**
|
|
315
|
+
* One stored file of a Conversation that a feed row previews, newest first.
|
|
316
|
+
* Read it through the Conversation's attachment route.
|
|
317
|
+
*/
|
|
318
|
+
const conversationFeedMediaSchema = z.object({
|
|
319
|
+
contentType: z.string(),
|
|
320
|
+
filename: z.string(),
|
|
321
|
+
id: z.string().min(1)
|
|
322
|
+
}).strict();
|
|
298
323
|
/**
|
|
299
324
|
* A root in the feed, or one of its visible Threads. A Thread nests under
|
|
300
325
|
* its nearest visible Thread ancestor, or under the root. Tasks never show.
|
|
301
326
|
*/
|
|
302
327
|
const conversationFeedItemSchema = conversationSummaryReportSchema.extend({
|
|
303
328
|
brief: conversationFeedBriefSchema.optional(),
|
|
329
|
+
/**
|
|
330
|
+
* Web links from the Conversation's recent messages, newest first, for
|
|
331
|
+
* the row to resolve into cards. URLs only: never message text. Only
|
|
332
|
+
* with `include=links`.
|
|
333
|
+
*/
|
|
334
|
+
links: z.array(z.url()).max(3).optional(),
|
|
335
|
+
/** Only with `include=media`. */
|
|
336
|
+
media: z.array(conversationFeedMediaSchema).max(3).optional(),
|
|
304
337
|
threads: z.lazy(() => z.array(conversationFeedItemSchema)).optional()
|
|
305
338
|
});
|
|
306
339
|
const conversationFeedSchema = z.object({
|
|
@@ -310,4 +343,4 @@ const conversationFeedSchema = z.object({
|
|
|
310
343
|
/** Present when older conversations follow this page. */
|
|
311
344
|
nextCursor: z.string().optional()
|
|
312
345
|
}).strict();
|
|
313
|
-
export {
|
|
346
|
+
export { skillReportSchema as C, personObjectCard as D, messageObjectCard as E, webPageObjectCard as O, skillDetailReportSchema as S, conversationObjectCard as T, pluginPackageContentItemReportSchema as _, cancelConversationPendingMessagesResponseSchema as a, pluginsSchema as b, conversationPendingMessageDeliverySchema as c, conversationUnchangedDetailWithMailboxSchema as d, steerConversationPendingMessagesBodySchema as f, pluginOperationalReportSchema as g, pluginOperationalReportFeedSchema as h, cancelConversationPendingMessagesBodySchema as i, conversationPendingMessageSchema as l, healthReportSchema as m, conversationFeedQuerySchema as n, conversationDetailWithMailboxReportSchema as o, steerConversationPendingMessagesResponseSchema as p, conversationFeedSchema as r, conversationPendingAuthorizationSchema as s, conversationFeedBriefSchema as t, conversationPendingMessagesReportSchema as u, pluginPackageContentReportSchema as v, skillReportsSchema as w, runtimeInfoReportSchema as x, pluginSchema as y };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { h as logWarn } from "./logging-
|
|
1
|
+
import { h as logWarn } from "./logging-BPNTQVFu.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
|
+
import { renderSystemMessageUpdate } from "@earendil-works/pi-ai";
|
|
3
4
|
// src/chat/conversation-privacy.ts
|
|
4
5
|
const SAFE_METADATA_KEY_LIMIT = 20;
|
|
5
6
|
const conversationPrivacyStorage = new AsyncLocalStorage();
|
|
@@ -133,10 +134,17 @@ function toCanonicalOutputMessage(message) {
|
|
|
133
134
|
};
|
|
134
135
|
}
|
|
135
136
|
/**
|
|
136
|
-
* Map a pi-ai Message (user/assistant/toolResult) to the canonical
|
|
137
|
+
* Map a pi-ai Message (system/user/assistant/toolResult) to the canonical
|
|
137
138
|
* gen_ai.input.messages shape: `{ role, parts: [...] }`.
|
|
138
139
|
*/
|
|
139
140
|
function toCanonicalInputMessage(message) {
|
|
141
|
+
if (message.role === "system") return {
|
|
142
|
+
role: "system",
|
|
143
|
+
parts: [{
|
|
144
|
+
type: "text",
|
|
145
|
+
content: renderSystemMessageUpdate(message)
|
|
146
|
+
}]
|
|
147
|
+
};
|
|
140
148
|
if (message.role === "user") return {
|
|
141
149
|
role: "user",
|
|
142
150
|
parts: typeof message.content === "string" ? [{
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import { B as blockScheduledAutomation, E as notifyAutomationBlocked, X as blockEventAutomation, a as getPersistedThreadState, c as coerceThreadConversationState, g as getDispatchRecord, i as getPersistedSandboxState, k as readAutomationExecutionByConversationId, m as getDispatchIdForConversation, s as persistThreadStateById } from "./turn-session-routing-
|
|
3
|
-
import {
|
|
4
|
-
import { E as withSpan, S as setTags, h as logWarn, p as logException } from "./logging-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { c as buildDeliveredTurnStatePatch, l as loadPendingMessageCards, o as completeAuthPauseTurn, r as finalizeFailedTurnReplyWithEvent, t as buildTurnThreadContext } from "./thread-context-
|
|
8
|
-
import {
|
|
9
|
-
import { A as latestConversationMessageSeq, I as upsertConversationMessage, M as normalizeConversationText, N as recordDeliveredAssistantMessage, a as loadProjection, at as failTurnRecord, b as persistConversationMessages, bn as persistWithRetry, j as markConversationMessage,
|
|
10
|
-
import { R as buildDeterministicTurnId, _ as ConversationTurnLifecycleService, d as isTurnInputCommitLostError, g as startActiveTurn, h as markTurnFailed, l as getConversationTurnBoundaryError, s as TurnInputCommitLostError, t as getTurnUserMessage } from "./turn-user-message-
|
|
11
|
-
import { f as credentialContextForActor } from "./registry-
|
|
2
|
+
import { B as blockScheduledAutomation, E as notifyAutomationBlocked, X as blockEventAutomation, a as getPersistedThreadState, c as coerceThreadConversationState, g as getDispatchRecord, i as getPersistedSandboxState, k as readAutomationExecutionByConversationId, m as getDispatchIdForConversation, s as persistThreadStateById } from "./turn-session-routing-2bW2qfeb.js";
|
|
3
|
+
import { E as isTopLevelKind, T as isPersonInput, a as getConversationStore, k as turnBehavior, mt as nextDetailVersion, o as getDb, r as getConversationEventStore, s as getSqlExecutor } from "./db-DU84dCVu.js";
|
|
4
|
+
import { E as withSpan, S as setTags, h as logWarn, p as logException } from "./logging-BPNTQVFu.js";
|
|
5
|
+
import { J as readMessageAttachments } from "./conversation-BOqdRtUx.js";
|
|
6
|
+
import { N as juniorConversations } from "./executor-CFyrgOu1.js";
|
|
7
|
+
import { c as buildDeliveredTurnStatePatch, l as loadPendingMessageCards, o as completeAuthPauseTurn, r as finalizeFailedTurnReplyWithEvent, t as buildTurnThreadContext } from "./thread-context-BOvZhsKK.js";
|
|
8
|
+
import { Hn as AgentRunError, On as supersedeOpenMailboxTurns, Ot as resolveConversationDestination, Un as executeTurn, in as isParentMessageMeta, rn as childAgentTurnOptions, sn as readParentMessage, vn as completeCancelledConversationTurn, zn as createWebAuthorization } from "./warmup--Gkz7iB-.js";
|
|
9
|
+
import { A as latestConversationMessageSeq, Di as verifyTimerWatchCredentialSubject, I as upsertConversationMessage, M as normalizeConversationText, N as recordDeliveredAssistantMessage, a as loadProjection, at as failTurnRecord, b as persistConversationMessages, bn as persistWithRetry, j as markConversationMessage, nt as saveTurnCheckpoint, st as getTurnRecord, t as commitAcceptedReply, un as getAssistantReplyText, v as hydrateConversationMessages } from "./projection-CcFBVFUo.js";
|
|
10
|
+
import { R as buildDeterministicTurnId, _ as ConversationTurnLifecycleService, d as isTurnInputCommitLostError, g as startActiveTurn, h as markTurnFailed, l as getConversationTurnBoundaryError, s as TurnInputCommitLostError, t as getTurnUserMessage } from "./turn-user-message-BrhuyYrH.js";
|
|
11
|
+
import { f as credentialContextForActor } from "./registry-BjZZqKqi.js";
|
|
12
12
|
import { i as getActiveSpan, r as continueTrace } from "./sentry-CPbZjomA.js";
|
|
13
|
-
import { i as measureTurnCompactionWait } from "./agent-runner-
|
|
14
|
-
import { n as botConfig } from "./config-
|
|
15
|
-
import { D as turnInputFactsFromConversationMessage, E as sourceFromTurnInput, I as maybePostAutomatedTurnLimitNotice, M as isEventMailboxMetadata, N as renderEventBatchInputs, O as legacyWebMailboxMetadataSchema, P as timerWatchCredentialSubject,
|
|
16
|
-
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-
|
|
17
|
-
import { p as instructionProvenanceFor } from "./history-
|
|
18
|
-
import { o as isEventConversationMessage } from "./prompt-
|
|
19
|
-
import { t as readConversationLineage } from "./lineage-
|
|
13
|
+
import { i as measureTurnCompactionWait } from "./agent-runner-C5d6rY5g.js";
|
|
14
|
+
import { n as botConfig } from "./config-CBZp0udd.js";
|
|
15
|
+
import { D as turnInputFactsFromConversationMessage, E as sourceFromTurnInput, G as recordFinishedTurnForAutomatedLimit, I as maybePostAutomatedTurnLimitNotice, M as isEventMailboxMetadata, N as renderEventBatchInputs, O as legacyWebMailboxMetadataSchema, P as timerWatchCredentialSubject, c as loadReviewItemInput, f as buildSteeringPiMessage, g as withoutSavedSteeringMessages, j as eventBatchMessageMeta, m as instructionForInputs, p as instructionActorFor, s as eventReviewItemInputs, x as getEventBatchDelayMs } from "./session-stop-uotLtp4g.js";
|
|
16
|
+
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-xsOPIxCZ.js";
|
|
17
|
+
import { p as instructionProvenanceFor } from "./history-m2-ceTTX.js";
|
|
18
|
+
import { o as isEventConversationMessage } from "./prompt-C5LREK2p.js";
|
|
19
|
+
import { t as readConversationLineage } from "./lineage-DLd2UxVP.js";
|
|
20
20
|
import { isDeepStrictEqual } from "node:util";
|
|
21
21
|
import { createHash } from "node:crypto";
|
|
22
22
|
import { and, eq, isNotNull, isNull } from "drizzle-orm";
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { W as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-
|
|
1
|
+
import { Da as postSlackMessage, Yn as createUserTokenStore, Z as getConversationPendingAuth, Zn as resolvePluginOAuthAccount, ca as formatProviderLabel, d as recordAuthorizationCompleted, is as getSlackClient, la as parseOAuthStatePayload, st as getTurnRecord, u as recordAuthenticationLinked, ua as resolveBaseUrl } from "./projection-CcFBVFUo.js";
|
|
2
|
+
import { V as escapeXml, a as getRuntimeMetadata, n as botConfig } from "./config-CBZp0udd.js";
|
|
3
|
+
import { W as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-BPNTQVFu.js";
|
|
4
4
|
import { p as parseSlackUserId } from "./actor-D2iXzvlN.js";
|
|
5
|
-
import {
|
|
5
|
+
import { B as findUserByVerifiedEmails, I as resolveActorIdentityId, W as upsertLinkedIdentity, X as getStateAdapter, et as acquireActiveLock, s as getSqlExecutor } from "./db-DU84dCVu.js";
|
|
6
6
|
import { i as homeDir } from "./package-discovery-x4AvVhMj.js";
|
|
7
|
-
import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-
|
|
8
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
9
|
-
import { t as discoverSkills } from "./skills-
|
|
10
|
-
import { o as finalizeMcpAuthorization } from "./agent-runner-
|
|
11
|
-
import { O as getMcpProviderErrorAttributes, S as putMcpStoredOAuthCredentials, f as deleteMcpAuthSession, g as getMcpAuthSession, v as getMcpStoredOAuthCredentials } from "./service-account-
|
|
12
|
-
import { o as readIdentityById } from "./viewer-
|
|
7
|
+
import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-BjZZqKqi.js";
|
|
8
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-J52Tej47.js";
|
|
9
|
+
import { t as discoverSkills } from "./skills-Bex1EaO5.js";
|
|
10
|
+
import { o as finalizeMcpAuthorization } from "./agent-runner-C5d6rY5g.js";
|
|
11
|
+
import { O as getMcpProviderErrorAttributes, S as putMcpStoredOAuthCredentials, f as deleteMcpAuthSession, g as getMcpAuthSession, v as getMcpStoredOAuthCredentials } from "./service-account-DU5865XA.js";
|
|
12
|
+
import { o as readIdentityById } from "./viewer-CxUiOraX.js";
|
|
13
13
|
import { t as readJuniorSecret } from "./secrets-DHaJ5TTn.js";
|
|
14
|
-
import {
|
|
15
|
-
import { a as getPersistedThreadState, c as coerceThreadConversationState } from "./turn-session-routing-
|
|
16
|
-
import { i as readConnectedOAuthTokens, s as htmlCallbackResponse } from "./connections-
|
|
14
|
+
import { Bn as deleteWebAuthorization, L as lookupSlackUserProfile, Mn as wakeAuthorizedTurn, Nn as wakePausedTurn } from "./warmup--Gkz7iB-.js";
|
|
15
|
+
import { a as getPersistedThreadState, c as coerceThreadConversationState } from "./turn-session-routing-2bW2qfeb.js";
|
|
16
|
+
import { i as readConnectedOAuthTokens, s as htmlCallbackResponse } from "./connections-BYmuJ6Vm.js";
|
|
17
17
|
import { n as relayLocalOAuthCallback } from "./oauth-relay-DAmfVmJu.js";
|
|
18
18
|
import * as z from "zod";
|
|
19
19
|
import path from "node:path";
|
|
@@ -432,7 +432,7 @@ async function linkOAuthAccountIdentity(args) {
|
|
|
432
432
|
const actorUserId = await resolveOAuthActorUserId(args.actor);
|
|
433
433
|
const emailMatch = await findUserByVerifiedEmails(executor, args.verifiedEmails);
|
|
434
434
|
const userId = actorUserId ?? emailMatch?.userId;
|
|
435
|
-
if (!userId) throw new Error("OAuth account has no
|
|
435
|
+
if (!userId) throw new Error("OAuth account has no User to link");
|
|
436
436
|
const email = emailMatch?.userId === userId ? emailMatch.email : void 0;
|
|
437
437
|
await upsertLinkedIdentity(executor, userId, {
|
|
438
438
|
kind: "user",
|