@sentry/junior 0.299.0 → 0.301.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-AgCNqqsG.js → adapter-CNjGEJO9.js} +5 -4
- package/dist/{admin-1VwEXztm.js → admin-CRJHvCGg.js} +2 -2
- package/dist/{agent-runner-Ciet8_nn.js → agent-runner-H4YhvNBj.js} +514 -270
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +6 -7
- package/dist/api.d.ts +1 -1
- package/dist/api.js +327 -61
- package/dist/{app--ky-Eu33.d.ts → app-HDZglaIu.d.ts} +14 -3
- package/dist/app.d.ts +1 -1
- package/dist/app.js +60 -220
- package/dist/{automation-M3RFJUBf.js → automation-Cva5ZOwW.js} +2 -2
- package/dist/{background-compaction-queue-CnimvRdk.js → background-compaction-queue-CNrZ3QcU.js} +8 -4
- package/dist/{briefs-CwzvgdCa.js → briefs-x6Mzwxmg.js} +3 -3
- package/dist/{catalog-runtime-DaBaHY7u.js → catalog-runtime-BEY6EGRi.js} +1 -1
- package/dist/cli/chat.js +16 -16
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.js +5 -5
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +4 -4
- package/dist/{config-CAXIpWQb.js → config-CmjhyqgB.js} +39 -8
- package/dist/{connections-Dy0hPdUq.js → connections-CfIRm0xv.js} +6 -6
- package/dist/{continue-in-slack-DIOjFj76.js → continue-in-slack-DPoABVkB.js} +6 -6
- package/dist/{conversation-fCWD9Az3.js → conversation-BNXfq6Lb.js} +30 -9
- package/dist/{conversation-feed-BPK8vkkZ.js → conversation-feed-CfpyFMHP.js} +23 -2
- package/dist/{conversation-privacy-DUgtRkf8.js → conversation-privacy-0CM0V2qK.js} +1 -1
- package/dist/{conversation-turn-DkJB6yMF.js → conversation-turn-C0sxyvS-.js} +17 -17
- package/dist/{credential-sync-RX24Y8aY.js → credential-sync-tEMKZ_8M.js} +15 -15
- package/dist/{db-B07FtU9g.d.ts → db-BdUHQhrC.d.ts} +1 -1
- package/dist/{db-COYOGzYS.js → db-Czra10QW.js} +13 -8
- package/dist/{executor-BWmAgSyi.js → executor-D_023K0H.js} +9 -4
- package/dist/instrumentation.js +14 -5
- package/dist/{lineage-D-5jm_oj.js → lineage-DmMIE0VL.js} +2 -2
- package/dist/{logging-DPLEa8Bn.js → logging-DcjLDDqi.js} +1 -1
- package/dist/{message-BIHR1yRk.js → message-C0JY9RJP.js} +8 -8
- package/dist/{model-input-BPZYH8Nd.js → model-input-CBp-p24N.js} +4 -4
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +4 -4
- package/dist/{oauth-callback-server-R7qvSzFG.js → oauth-callback-server-BRq9QNhU.js} +2 -2
- package/dist/{plugins-CBW2Prb_.js → plugins-BBX07Jzt.js} +1 -1
- package/dist/{projection-DEdP1q6f.js → projection-CQNDOi82.js} +911 -671
- package/dist/{prompt-4M98h_tC.js → prompt-DLUB5m72.js} +4 -4
- package/dist/{registry-BTKmKM-r.js → registry-Dj377ADs.js} +2 -2
- package/dist/{resolve-B8hXNVZ3.js → resolve-DJkh9Fky.js} +3 -3
- package/dist/{result-g-XAaOj6.js → result-C8iIpDl1.js} +9 -9
- package/dist/{runner-BlPSA5A8.js → runner-DZqrOy8C.js} +9 -9
- package/dist/{sandbox-egress-signals-Pai-MzEY.js → sandbox-egress-signals-CGwH86S9.js} +1 -1
- package/dist/{schema-DbuWR-DN.d.ts → schema-CdZFn7Qd.d.ts} +248 -6
- package/dist/{schema-BNnY_trV.js → schema-DyHXiQKI.js} +28 -16
- package/dist/{service-account-BYGZ08DQ.js → service-account-D6jGR4a1.js} +3 -3
- package/dist/{service-account-9OLNQMyz.js → service-account-suY004dx.js} +4 -4
- package/dist/{session-stop-2XJrcNCy.js → session-stop-BLmfFI3d.js} +121 -46
- package/dist/{skills-DpBQoeHV.js → skills-CmNG0dHb.js} +2 -2
- package/dist/{slack-conversation-unfurl-BcDIWo67.js → slack-conversation-unfurl-Bty-DlHe.js} +7 -7
- package/dist/{spawn-09GssFod.js → spawn-CNjkpXpk.js} +6 -6
- package/dist/{state-Cufq0_rH.js → state-CEbZuZD6.js} +2 -2
- package/dist/{statuses-B8mUfghF.js → statuses-Hn-HsOph.js} +86 -2
- package/dist/{stop-U7iUrR1g.js → stop-Bjy2-K4H.js} +967 -93
- package/dist/{store-BHiaHCQu.js → store-DmV4CoNr.js} +5 -5
- package/dist/{store-CSgUTMdv.js → store-Epv6t4vV.js} +9 -9
- package/dist/{task-queue-bMNq0clp.js → task-queue-AhG1tSXR.js} +3 -3
- package/dist/{task-runner-B__rxwxU.js → task-runner-BMxZI3o7.js} +8 -8
- package/dist/{thread-context-d0ceWbVT.js → thread-context-CXLnbg7g.js} +8 -8
- package/dist/{turn-session-routing-BVZHBFCF.js → turn-session-routing-BD3-jJl7.js} +5 -5
- package/dist/{turn-user-message-BEw7acTP.js → turn-user-message-DsUZi9gn.js} +3 -3
- package/dist/{users-BK3dbxZL.js → users-BxvYclQg.js} +3 -3
- package/dist/{validation-BDVJjO2E.js → validation-DOz8X9BU.js} +1 -1
- package/dist/{version-DQgZoQ3D.js → version-CGMRmMPK.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-CAWfFo29.js → viewer-H3EsMWtJ.js} +16 -114
- package/dist/{warmup-9ySPacF9.js → warmup-CdU5hR49.js} +51 -27
- package/dist/{worker-D8jJO-WO.js → worker-ClphajjD.js} +24 -20
- package/migrations/0107_attachment_deferred_download.sql +2 -0
- package/migrations/meta/0107_snapshot.json +4617 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +10 -8
- package/dist/media-BAHvgkok.js +0 -85
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.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-DcjLDDqi.js";
|
|
3
|
+
import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-0CM0V2qK.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";
|
|
@@ -33,7 +33,7 @@ function createMemoryAttachmentStorage() {
|
|
|
33
33
|
objects,
|
|
34
34
|
provider: "memory",
|
|
35
35
|
async put(input) {
|
|
36
|
-
objects.set(input.key, Buffer.from(input.body));
|
|
36
|
+
objects.set(input.key, Buffer.from(await new Response(input.body).arrayBuffer()));
|
|
37
37
|
},
|
|
38
38
|
async get(key, range) {
|
|
39
39
|
const body = objects.get(key);
|
|
@@ -122,6 +122,13 @@ function createVercelAttachmentStorage() {
|
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
124
|
// src/chat/attachments/storage.ts
|
|
125
|
+
/** Stream bytes that are already in memory to `AttachmentStorage.put`. */
|
|
126
|
+
function bufferBody(data) {
|
|
127
|
+
return new ReadableStream({ start(controller) {
|
|
128
|
+
controller.enqueue(data);
|
|
129
|
+
controller.close();
|
|
130
|
+
} });
|
|
131
|
+
}
|
|
125
132
|
/** Build the HTTP `Range` request header value for one byte range. */
|
|
126
133
|
function rangeHeader(range) {
|
|
127
134
|
return `bytes=${range.start}-${range.end}`;
|
|
@@ -199,12 +206,23 @@ function createS3AttachmentStorage(config) {
|
|
|
199
206
|
secretAccessKey: config.secretAccessKey,
|
|
200
207
|
service: "s3"
|
|
201
208
|
});
|
|
209
|
+
const writeClient = new AwsClient({
|
|
210
|
+
accessKeyId: config.accessKeyId,
|
|
211
|
+
region: config.region,
|
|
212
|
+
retries: 0,
|
|
213
|
+
secretAccessKey: config.secretAccessKey,
|
|
214
|
+
service: "s3"
|
|
215
|
+
});
|
|
202
216
|
return {
|
|
203
217
|
provider: "s3",
|
|
204
218
|
async put(input) {
|
|
205
|
-
await expectOk(await
|
|
206
|
-
body:
|
|
207
|
-
headers: {
|
|
219
|
+
await expectOk(await writeClient.fetch(objectUrl(config, input.key), {
|
|
220
|
+
body: input.body,
|
|
221
|
+
headers: {
|
|
222
|
+
"content-length": String(input.bytes),
|
|
223
|
+
"content-type": input.contentType,
|
|
224
|
+
"x-amz-content-sha256": "UNSIGNED-PAYLOAD"
|
|
225
|
+
},
|
|
208
226
|
method: "PUT"
|
|
209
227
|
}), "put");
|
|
210
228
|
},
|
|
@@ -1201,6 +1219,10 @@ async function completeText(params) {
|
|
|
1201
1219
|
sessionId: params.sessionId,
|
|
1202
1220
|
onPayload: (payload) => {
|
|
1203
1221
|
setSpanAttributes(requestPrefixAttributes(payload));
|
|
1222
|
+
},
|
|
1223
|
+
onResponse: (response) => {
|
|
1224
|
+
const vercelId = response.headers["x-vercel-id"];
|
|
1225
|
+
if (vercelId) setSpanAttributes({ "app.ai.gateway.vercel_id": vercelId });
|
|
1204
1226
|
}
|
|
1205
1227
|
});
|
|
1206
1228
|
} catch (error) {
|
|
@@ -1221,7 +1243,8 @@ async function completeText(params) {
|
|
|
1221
1243
|
...outputMessagesAttribute ? { "gen_ai.output.messages": outputMessagesAttribute } : void 0,
|
|
1222
1244
|
...usageAttributes,
|
|
1223
1245
|
...message.stopReason ? { "gen_ai.response.finish_reasons": [normalizeGenAiFinishReason(message.stopReason)] } : void 0,
|
|
1224
|
-
...message.model ? { "gen_ai.response.model": message.model } : void 0
|
|
1246
|
+
...message.model ? { "gen_ai.response.model": message.model } : void 0,
|
|
1247
|
+
...message.responseId ? { "gen_ai.response.id": message.responseId } : void 0
|
|
1225
1248
|
});
|
|
1226
1249
|
if (message.stopReason === "error") {
|
|
1227
1250
|
const providerMessage = message.errorMessage?.trim() || "Unknown provider error";
|
|
@@ -1540,6 +1563,7 @@ var config_exports = /* @__PURE__ */ __exportAll({
|
|
|
1540
1563
|
resetRuntimeConfig: () => resetRuntimeConfig,
|
|
1541
1564
|
restoreRuntimeConfig: () => restoreRuntimeConfig,
|
|
1542
1565
|
setBotModelConfig: () => setBotModelConfig,
|
|
1566
|
+
setBotName: () => setBotName,
|
|
1543
1567
|
setRuntimeLimits: () => setRuntimeLimits,
|
|
1544
1568
|
setSlackReactionConfig: () => setSlackReactionConfig,
|
|
1545
1569
|
snapshotRuntimeConfig: () => snapshotRuntimeConfig
|
|
@@ -1858,9 +1882,16 @@ function setBotModelConfig(config) {
|
|
|
1858
1882
|
if (config.refusalFallbackModelId !== void 0) botConfig.refusalFallbackModelId = requireModelId("refusalFallbackModelId", config.refusalFallbackModelId, validateGatewayModelId);
|
|
1859
1883
|
if (config.webSearchModelId !== void 0) botConfig.webSearchModelId = requireModelId("webSearchModelId", config.webSearchModelId, validateGatewayModelId);
|
|
1860
1884
|
}
|
|
1885
|
+
/** Apply the bot name from createApp(). It overrides `JUNIOR_BOT_NAME`. */
|
|
1886
|
+
function setBotName(name) {
|
|
1887
|
+
if (name === void 0) return;
|
|
1888
|
+
const trimmed = toOptionalTrimmed(name);
|
|
1889
|
+
if (!trimmed) throw new Error("botName must not be empty");
|
|
1890
|
+
botConfig.userName = trimmed;
|
|
1891
|
+
}
|
|
1861
1892
|
/** Apply Slack reaction emoji overrides from createApp() options, validating names. */
|
|
1862
1893
|
function setSlackReactionConfig(overrides) {
|
|
1863
1894
|
if (overrides.processingReactionEmoji !== void 0) chatConfig.slack.processingReactionEmoji = parseReactionEmoji("processingReactionEmoji", overrides.processingReactionEmoji, chatConfig.slack.processingReactionEmoji);
|
|
1864
1895
|
if (overrides.completedReactionEmoji !== void 0) chatConfig.slack.completedReactionEmoji = parseReactionEmoji("completedReactionEmoji", overrides.completedReactionEmoji, chatConfig.slack.completedReactionEmoji);
|
|
1865
1896
|
}
|
|
1866
|
-
export {
|
|
1897
|
+
export { estimateRequestOverheadTokens as A, ProviderError as B, completeObject as C, resolveGatewayModel as D, rerankTexts as E, isCompactionSummaryText as F, getProviderErrorUserMessage as G, createProviderError as H, renderCurrentInstruction as I, getGatewayApiKey as J, isProviderRefusal as K, unwrapCurrentInstruction as L, textCharsForTokens as M, COMPACTION_SUMMARY_PREFIX as N, requestPrefixAttributes as O, hasCompactedConversationContext as P, toOptionalTrimmed as Q, escapeXml as R, completeDecision as S, embedTexts as T, findProviderError as U, createAssistantProviderError as V, getProviderErrorAttributes as W, bufferBody as X, resolveGatewayCredential as Y, getAttachmentStorage as Z, TURN_REASONING_LEVELS as _, getRuntimeMetadata as a, GEN_AI_PROVIDER_NAME as b, getSlackClientSecret as c, restoreRuntimeConfig as d, setBotModelConfig as f, snapshotRuntimeConfig as g, setSlackReactionConfig as h, getChatConfig as i, estimateTextTokens as j, estimateMessagesTokens as k, getSlackSigningSecret as l, setRuntimeLimits as m, botConfig as n, getSlackBotToken as o, setBotName as p, isProviderRetryError as q, config_exports as r, getSlackClientId as s, DEFAULT_SQL_STATEMENT_TIMEOUT_MS as t, resetRuntimeConfig as u, toPiReasoningLevel as v, completeText as w, GEN_AI_SERVER_ADDRESS as x, normalizeSlackEmojiName as y, escapeXmlText as z };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
3
|
-
import { F as deleteProviderIdentityForSlackUser, I as deleteProviderIdentityForUser, s as getSqlExecutor } from "./db-
|
|
4
|
-
import { u as hasRequiredOAuthScope } from "./registry-
|
|
5
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
6
|
-
import { c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-
|
|
1
|
+
import { da as startOAuthFlow } from "./projection-CQNDOi82.js";
|
|
2
|
+
import { n as botConfig } from "./config-CmjhyqgB.js";
|
|
3
|
+
import { F as deleteProviderIdentityForSlackUser, I as deleteProviderIdentityForUser, s as getSqlExecutor } from "./db-Czra10QW.js";
|
|
4
|
+
import { u as hasRequiredOAuthScope } from "./registry-Dj377ADs.js";
|
|
5
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BEY6EGRi.js";
|
|
6
|
+
import { c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-H4YhvNBj.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,10 +1,10 @@
|
|
|
1
|
-
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-CQNDOi82.js";
|
|
2
2
|
import { u as parseSlackChannelId, v as parseSlackMessageTs } from "./actor-D2iXzvlN.js";
|
|
3
|
-
import { G as claimProviderConversation, K as getConversationIdByProviderConversation, a as getConversationStore, k as setFirstConversationLocation, o as getDb, s as getSqlExecutor, x as withConversationMutationLock } from "./db-
|
|
4
|
-
import { P as juniorDestinations } from "./executor-
|
|
5
|
-
import { r as getStateAdapter } from "./adapter-
|
|
6
|
-
import "./store-
|
|
7
|
-
import { c as joinPublicChannelForRead, s as checkSlackChannelReadAccess } from "./users-
|
|
3
|
+
import { G as claimProviderConversation, K as getConversationIdByProviderConversation, a as getConversationStore, k as setFirstConversationLocation, o as getDb, s as getSqlExecutor, x as withConversationMutationLock } from "./db-Czra10QW.js";
|
|
4
|
+
import { P as juniorDestinations } from "./executor-D_023K0H.js";
|
|
5
|
+
import { r as getStateAdapter } from "./adapter-CNjGEJO9.js";
|
|
6
|
+
import "./store-DmV4CoNr.js";
|
|
7
|
+
import { c as joinPublicChannelForRead, s as checkSlackChannelReadAccess } from "./users-BxvYclQg.js";
|
|
8
8
|
import { and, eq } from "drizzle-orm";
|
|
9
9
|
// src/chat/slack/continue-in-slack.ts
|
|
10
10
|
/** Refusal for a move that cannot wait for the active Run. */
|
|
@@ -133,27 +133,32 @@ function parseBriefInput(input) {
|
|
|
133
133
|
}
|
|
134
134
|
// src/chat/attachments/input.ts
|
|
135
135
|
/**
|
|
136
|
-
* Largest file that
|
|
136
|
+
* Largest file that Junior stores from Slack or the web, or loads into the
|
|
137
|
+
* sandbox.
|
|
137
138
|
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* Keep this well below function memory.
|
|
139
|
+
* Every path streams the bytes, so this cap does not depend on function
|
|
140
|
+
* memory. It bounds transfer time and sandbox disk use.
|
|
141
141
|
*/
|
|
142
|
-
const
|
|
142
|
+
const MAX_ATTACHMENT_BYTES = 262144e3;
|
|
143
143
|
/** Most files on one web Message, as in one Slack message. */
|
|
144
144
|
const MAX_INPUT_ATTACHMENTS = 10;
|
|
145
145
|
/** File facts that a browser declares before it uploads the bytes. */
|
|
146
146
|
const inputFileSchema = z.object({
|
|
147
147
|
filename: z.string().trim().min(1).max(255),
|
|
148
148
|
contentType: z.string().trim().toLowerCase().max(127).regex(/^[a-z0-9][\w.+-]*\/[a-z0-9][\w.+-]*$/),
|
|
149
|
-
bytes: z.number().int().min(1).max(
|
|
149
|
+
bytes: z.number().int().min(1).max(MAX_ATTACHMENT_BYTES)
|
|
150
150
|
}).strict();
|
|
151
151
|
/** Safe attachment facts shared by mailbox input and transcript messages. */
|
|
152
152
|
const messageAttachmentSchema = z.object({
|
|
153
153
|
id: z.string().min(1),
|
|
154
154
|
filename: z.string().min(1),
|
|
155
155
|
contentType: z.string().min(1),
|
|
156
|
-
bytes: z.number().int().nonnegative()
|
|
156
|
+
bytes: z.number().int().nonnegative(),
|
|
157
|
+
/**
|
|
158
|
+
* True for a large Slack file that Junior never stores. Each read
|
|
159
|
+
* downloads it from Slack, so it has no preview.
|
|
160
|
+
*/
|
|
161
|
+
pending: z.literal(true).optional()
|
|
157
162
|
}).strict();
|
|
158
163
|
/** Read attachment metadata without exposing object storage keys or bytes. */
|
|
159
164
|
function readMessageAttachments(value) {
|
|
@@ -333,6 +338,15 @@ const conversationChildAgentTotalsSchema = z.object({
|
|
|
333
338
|
cumulativeDurationMs: z.number(),
|
|
334
339
|
cumulativeUsage: usageSchema.optional()
|
|
335
340
|
}).strict();
|
|
341
|
+
// src/api/schema/object-preview-image.ts
|
|
342
|
+
/**
|
|
343
|
+
* One saved preview image of an object, such as a pull request screenshot,
|
|
344
|
+
* at 1x and 2x. Both name the Junior image route, never the image host.
|
|
345
|
+
*/
|
|
346
|
+
const objectPreviewImageSchema = z.object({
|
|
347
|
+
src: z.string().startsWith("/api/images/"),
|
|
348
|
+
srcSet: z.string().min(1)
|
|
349
|
+
}).strict();
|
|
336
350
|
// src/api/schema/conversation.ts
|
|
337
351
|
const conversationReportStatusSchema = z.enum([
|
|
338
352
|
"active",
|
|
@@ -359,6 +373,12 @@ const conversationAttachmentParamsSchema = z.object({
|
|
|
359
373
|
attachmentId: z.string().min(1),
|
|
360
374
|
conversationId: z.string().min(1)
|
|
361
375
|
}).strict();
|
|
376
|
+
const conversationAttachmentQuerySchema = z.object({
|
|
377
|
+
/**
|
|
378
|
+
* Send `Content-Disposition: attachment` even for a type that previews
|
|
379
|
+
* inline, so a same-window download link saves the file.
|
|
380
|
+
*/
|
|
381
|
+
download: z.stringbool().optional() }).strict();
|
|
362
382
|
const conversationDetailQuerySchema = z.object({
|
|
363
383
|
/** Omit to get the latest three Turns, up to the default page limit. */
|
|
364
384
|
limit: z.coerce.number().int().min(1).max(1e3).optional(),
|
|
@@ -474,7 +494,8 @@ const conversationSourceTaskSchema = z.object({
|
|
|
474
494
|
const conversationAnnotationReportSchema = conversationAnnotationInputSchema.and(z.object({
|
|
475
495
|
plugin: z.string().min(1),
|
|
476
496
|
createdAt: z.string().datetime(),
|
|
477
|
-
updatedAt: z.string().datetime()
|
|
497
|
+
updatedAt: z.string().datetime(),
|
|
498
|
+
previewImages: z.array(objectPreviewImageSchema).optional()
|
|
478
499
|
}));
|
|
479
500
|
const conversationActivityPreviewSchema = z.object({
|
|
480
501
|
createdAt: z.string().datetime(),
|
|
@@ -1003,4 +1024,4 @@ const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
|
|
|
1003
1024
|
sentryConversationUrl: z.string().optional(),
|
|
1004
1025
|
sourceTask: conversationSourceTaskSchema.optional()
|
|
1005
1026
|
}).strict().superRefine(validateConversationEvents);
|
|
1006
|
-
export {
|
|
1027
|
+
export { briefResourceLabel as $, agentTypeInstructions as A, messageCardRef as B, createConversationBodySchema as C, idempotencyKeySchema as D, forkConversationResponseSchema as E, renameConversationBodySchema as F, MAX_ATTACHMENT_BYTES as G, readMessageCardRefs as H, renameConversationResponseSchema as I, messageAttachmentSchema as J, MAX_INPUT_ATTACHMENTS as K, conversationReadPositionSchema as L, formatAgentTypes as M, CONVERSATION_TITLE_MAX_LENGTH as N, conversationChildAgentTotalsSchema as O, conversationTitleSchema as P, briefOutcomeStatusSchema as Q, reviewItemChangeRecordSchema as R, conversationUsageSchema as S, forkConversationBodySchema as T, removedCardSchema as U, messageCardText as V, resolveMessageCards as W, briefCodeChangeSchema as X, readMessageAttachments as Y, briefLinkSchema as Z, conversationReportEventSchema as _, conversationActivityPreviewSchema as a, conversationSummaryReportSchema as b, conversationAuxiliaryCostsSchema as c, conversationEventHistorySchema as d, conversationBriefSchema as et, conversationEventPageSchema as f, conversationReportEventDataSchema as g, conversationParamsSchema as h, actorIdentitySchema as i, agentTypeSchema as j, AGENT_TYPES as k, conversationDetailQuerySchema as l, conversationFeedQuerySchema as m, CONVERSATION_VERSION_HEADER as n, parseStoredBrief as nt, conversationAttachmentParamsSchema as o, conversationEventsQuerySchema as p, inputFileSchema as q, acceptedConversationMessageSchema as r, conversationAttachmentQuerySchema as s, CONVERSATION_DETAIL_VERSION_HEADER as t, parseBriefInput as tt, conversationDetailReportSchema as u, conversationReportMessageEventSchema as v, createConversationMessageBodySchema as w, conversationSurfaceSchema as x, conversationReportStatusSchema as y, annotationCard as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { J as messageAttachmentSchema, Q as briefOutcomeStatusSchema, R as reviewItemChangeRecordSchema, b as conversationSummaryReportSchema, i as actorIdentitySchema, u as conversationDetailReportSchema } from "./conversation-BNXfq6Lb.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
// src/api/objects/cards.ts
|
|
4
4
|
const MAX_LABEL_CHARS = 256;
|
|
@@ -83,6 +83,27 @@ function messageObjectCard(args) {
|
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Build the card of one public web page from its oEmbed fields or meta
|
|
88
|
+
* tags. `thumbnailUrl` must be a Junior image path.
|
|
89
|
+
*/
|
|
90
|
+
function webPageObjectCard(args) {
|
|
91
|
+
return {
|
|
92
|
+
kind: "object",
|
|
93
|
+
objectType: "web_page",
|
|
94
|
+
key: args.url.slice(0, 256),
|
|
95
|
+
label: truncate(args.title, MAX_LABEL_CHARS),
|
|
96
|
+
title: truncate(args.title, 512),
|
|
97
|
+
url: args.url,
|
|
98
|
+
...args.description ? { description: truncate(args.description, MAX_SNIPPET_CHARS) } : void 0,
|
|
99
|
+
facts: {
|
|
100
|
+
type: "web_page",
|
|
101
|
+
...args.siteName ? { siteName: truncate(args.siteName, MAX_FACT_CHARS) } : void 0,
|
|
102
|
+
...args.author ? { author: truncate(args.author, MAX_FACT_CHARS) } : void 0,
|
|
103
|
+
...args.thumbnailUrl ? { thumbnailUrl: args.thumbnailUrl } : void 0
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
86
107
|
// src/reporting-schema.ts
|
|
87
108
|
const healthReportSchema = z.object({
|
|
88
109
|
status: z.literal("ok"),
|
|
@@ -288,4 +309,4 @@ const conversationFeedSchema = z.object({
|
|
|
288
309
|
/** Present when older conversations follow this page. */
|
|
289
310
|
nextCursor: z.string().optional()
|
|
290
311
|
}).strict();
|
|
291
|
-
export { skillReportsSchema as C, personObjectCard as E, skillReportSchema as S, messageObjectCard as T, pluginPackageContentReportSchema as _, conversationDetailWithMailboxReportSchema as a, runtimeInfoReportSchema as b, conversationPendingMessageSchema as c, steerConversationPendingMessagesBodySchema as d, steerConversationPendingMessagesResponseSchema as f, pluginPackageContentItemReportSchema as g, pluginOperationalReportSchema as h, cancelConversationPendingMessagesResponseSchema as i, conversationPendingMessagesReportSchema as l, pluginOperationalReportFeedSchema as m, conversationFeedSchema as n, conversationPendingAuthorizationSchema as o, healthReportSchema as p, cancelConversationPendingMessagesBodySchema as r, conversationPendingMessageDeliverySchema as s, conversationFeedBriefSchema as t, conversationUnchangedDetailWithMailboxSchema as u, pluginSchema as v, conversationObjectCard as w, skillDetailReportSchema as x, pluginsSchema as y };
|
|
312
|
+
export { skillReportsSchema as C, webPageObjectCard as D, personObjectCard as E, skillReportSchema as S, messageObjectCard as T, pluginPackageContentReportSchema as _, conversationDetailWithMailboxReportSchema as a, runtimeInfoReportSchema as b, conversationPendingMessageSchema as c, steerConversationPendingMessagesBodySchema as d, steerConversationPendingMessagesResponseSchema as f, pluginPackageContentItemReportSchema as g, pluginOperationalReportSchema as h, cancelConversationPendingMessagesResponseSchema as i, conversationPendingMessagesReportSchema as l, pluginOperationalReportFeedSchema as m, conversationFeedSchema as n, conversationPendingAuthorizationSchema as o, healthReportSchema as p, cancelConversationPendingMessagesBodySchema as r, conversationPendingMessageDeliverySchema as s, conversationFeedBriefSchema as t, conversationUnchangedDetailWithMailboxSchema as u, pluginSchema as v, conversationObjectCard as w, skillDetailReportSchema as x, pluginsSchema as y };
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { i as getActiveSpan, r as continueTrace, v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { A as latestConversationMessageSeq,
|
|
3
|
-
import { n as botConfig } from "./config-
|
|
4
|
-
import { E as withSpan, S as setTags, h as logWarn, p as logException } from "./logging-
|
|
5
|
-
import { C as isPersonInput, E as turnBehavior, a as getConversationStore, nt as nextDetailVersion, o as getDb, r as getConversationEventStore, s as getSqlExecutor, w as isTopLevelKind } from "./db-
|
|
6
|
-
import { j as juniorConversations } from "./executor-
|
|
2
|
+
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-CQNDOi82.js";
|
|
3
|
+
import { n as botConfig } from "./config-CmjhyqgB.js";
|
|
4
|
+
import { E as withSpan, S as setTags, h as logWarn, p as logException } from "./logging-DcjLDDqi.js";
|
|
5
|
+
import { C as isPersonInput, E as turnBehavior, a as getConversationStore, nt as nextDetailVersion, o as getDb, r as getConversationEventStore, s as getSqlExecutor, w as isTopLevelKind } from "./db-Czra10QW.js";
|
|
6
|
+
import { j as juniorConversations } from "./executor-D_023K0H.js";
|
|
7
7
|
import { p as instructionProvenanceFor } from "./history-IjdmO_r6.js";
|
|
8
|
-
import { f as credentialContextForActor } from "./registry-
|
|
9
|
-
import {
|
|
10
|
-
import { o as isEventConversationMessage } from "./prompt-
|
|
11
|
-
import {
|
|
12
|
-
import { A as turnInputFactsFromConversationMessage, F as isEventMailboxMetadata, I as renderEventBatchInputs, L as timerWatchCredentialSubject, P as eventBatchMessageMeta, X as maybePostAutomatedTurnLimitNotice, c as loadReviewItemInput, f as buildSteeringPiMessage, g as withoutSavedSteeringMessages, j as legacyWebMailboxMetadataSchema, k as sourceFromTurnInput, m as instructionForInputs,
|
|
13
|
-
import { Et as executeTurn, L as readParentMessage, M as childAgentTurnOptions, N as isParentMessageMeta, St as createWebAuthorization, Tt as AgentRunError, Y as completeCancelledConversationTurn, dt as supersedeOpenMailboxTurns } from "./warmup-
|
|
14
|
-
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-
|
|
15
|
-
import { a as getPersistedThreadState, c as coerceThreadConversationState, i as getPersistedSandboxState, s as persistThreadStateById } from "./turn-session-routing-
|
|
16
|
-
import { H as blockEventAutomation, M as blockScheduledAutomation, c as getDispatchRecord, o as getDispatchIdForConversation, v as notifyAutomationBlocked, x as readAutomationExecutionByConversationId } from "./store-
|
|
17
|
-
import { t as readConversationLineage } from "./lineage-
|
|
18
|
-
import { c as buildDeliveredTurnStatePatch, l as loadPendingMessageCards, o as completeAuthPauseTurn, r as finalizeFailedTurnReplyWithEvent, t as buildTurnThreadContext } from "./thread-context-
|
|
19
|
-
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-
|
|
8
|
+
import { f as credentialContextForActor } from "./registry-Dj377ADs.js";
|
|
9
|
+
import { dt as resolveConversationDestination, i as measureTurnCompactionWait } from "./agent-runner-H4YhvNBj.js";
|
|
10
|
+
import { o as isEventConversationMessage } from "./prompt-DLUB5m72.js";
|
|
11
|
+
import { Y as readMessageAttachments } from "./conversation-BNXfq6Lb.js";
|
|
12
|
+
import { A as turnInputFactsFromConversationMessage, F as isEventMailboxMetadata, I as renderEventBatchInputs, L as timerWatchCredentialSubject, P as eventBatchMessageMeta, X as maybePostAutomatedTurnLimitNotice, c as loadReviewItemInput, f as buildSteeringPiMessage, g as withoutSavedSteeringMessages, j as legacyWebMailboxMetadataSchema, k as sourceFromTurnInput, m as instructionForInputs, p as instructionActorFor, rt as recordFinishedTurnForAutomatedLimit, s as eventReviewItemInputs, w as getEventBatchDelayMs } from "./session-stop-BLmfFI3d.js";
|
|
13
|
+
import { Et as executeTurn, L as readParentMessage, M as childAgentTurnOptions, N as isParentMessageMeta, St as createWebAuthorization, Tt as AgentRunError, Y as completeCancelledConversationTurn, dt as supersedeOpenMailboxTurns } from "./warmup-CdU5hR49.js";
|
|
14
|
+
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-DsUZi9gn.js";
|
|
15
|
+
import { a as getPersistedThreadState, c as coerceThreadConversationState, i as getPersistedSandboxState, s as persistThreadStateById } from "./turn-session-routing-BD3-jJl7.js";
|
|
16
|
+
import { H as blockEventAutomation, M as blockScheduledAutomation, c as getDispatchRecord, o as getDispatchIdForConversation, v as notifyAutomationBlocked, x as readAutomationExecutionByConversationId } from "./store-Epv6t4vV.js";
|
|
17
|
+
import { t as readConversationLineage } from "./lineage-DmMIE0VL.js";
|
|
18
|
+
import { c as buildDeliveredTurnStatePatch, l as loadPendingMessageCards, o as completeAuthPauseTurn, r as finalizeFailedTurnReplyWithEvent, t as buildTurnThreadContext } from "./thread-context-CXLnbg7g.js";
|
|
19
|
+
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-BMxZI3o7.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,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { U as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-
|
|
1
|
+
import { Da as postSlackMessage, Xo as getSlackClient, Z as getConversationPendingAuth, Zn as createUserTokenStore, ca as formatProviderLabel, d as recordAuthorizationCompleted, la as parseOAuthStatePayload, st as getTurnRecord, tr as resolvePluginOAuthAccount, u as recordAuthenticationLinked, ua as resolveBaseUrl } from "./projection-CQNDOi82.js";
|
|
2
|
+
import { R as escapeXml, a as getRuntimeMetadata, n as botConfig } from "./config-CmjhyqgB.js";
|
|
3
|
+
import { U as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-DcjLDDqi.js";
|
|
4
4
|
import { p as parseSlackUserId } from "./actor-D2iXzvlN.js";
|
|
5
|
-
import { L as findUserByVerifiedEmails, N as resolveActorIdentityId, V as upsertLinkedIdentity, s as getSqlExecutor } from "./db-
|
|
6
|
-
import { r as getStateAdapter, s as acquireActiveLock } from "./adapter-
|
|
5
|
+
import { L as findUserByVerifiedEmails, N as resolveActorIdentityId, V as upsertLinkedIdentity, s as getSqlExecutor } from "./db-Czra10QW.js";
|
|
6
|
+
import { r as getStateAdapter, s as acquireActiveLock } from "./adapter-CNjGEJO9.js";
|
|
7
7
|
import { i as homeDir } from "./package-discovery-DJhGdS4c.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 { d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession } from "./agent-runner-
|
|
12
|
-
import { o as readIdentityById } from "./viewer-
|
|
8
|
+
import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-Dj377ADs.js";
|
|
9
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BEY6EGRi.js";
|
|
10
|
+
import { t as discoverSkills } from "./skills-CmNG0dHb.js";
|
|
11
|
+
import { d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession } from "./agent-runner-H4YhvNBj.js";
|
|
12
|
+
import { o as readIdentityById } from "./viewer-H3EsMWtJ.js";
|
|
13
13
|
import { t as readJuniorSecret } from "./secrets-DebYU866.js";
|
|
14
|
-
import { Ct as deleteWebAuthorization, gt as wakePausedTurn, ht as wakeAuthorizedTurn } from "./warmup-
|
|
15
|
-
import { a as getPersistedThreadState, c as coerceThreadConversationState } from "./turn-session-routing-
|
|
16
|
-
import { _ as getMcpProviderErrorAttributes } from "./service-account-
|
|
17
|
-
import { r as lookupSlackUserProfile } from "./users-
|
|
18
|
-
import { i as readConnectedOAuthTokens, s as htmlCallbackResponse } from "./connections-
|
|
14
|
+
import { Ct as deleteWebAuthorization, gt as wakePausedTurn, ht as wakeAuthorizedTurn } from "./warmup-CdU5hR49.js";
|
|
15
|
+
import { a as getPersistedThreadState, c as coerceThreadConversationState } from "./turn-session-routing-BD3-jJl7.js";
|
|
16
|
+
import { _ as getMcpProviderErrorAttributes } from "./service-account-suY004dx.js";
|
|
17
|
+
import { r as lookupSlackUserProfile } from "./users-BxvYclQg.js";
|
|
18
|
+
import { i as readConnectedOAuthTokens, s as htmlCallbackResponse } from "./connections-CfIRm0xv.js";
|
|
19
19
|
import { n as relayLocalOAuthCallback } from "./oauth-relay-DRzq73b6.js";
|
|
20
20
|
import * as z from "zod";
|
|
21
21
|
import path from "node:path";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { i as getChatConfig } from "./config-
|
|
3
|
-
import { H as GOOGLE_IDENTITY_PROVIDER, W as normalizeIdentityEmail, h as logWarn } from "./logging-
|
|
2
|
+
import { i as getChatConfig } from "./config-CmjhyqgB.js";
|
|
3
|
+
import { H as GOOGLE_IDENTITY_PROVIDER, W as normalizeIdentityEmail, h as logWarn } from "./logging-DcjLDDqi.js";
|
|
4
4
|
import { a as isSlackUserId, d as parseSlackChannelReferenceId, f as parseSlackTeamId, s as parseActorUserId } from "./actor-D2iXzvlN.js";
|
|
5
|
-
import { C as isUserInstruction, E as juniorConversationAnnotations, M as juniorIdentities, N as juniorUsers, P as juniorDestinations, S as juniorConversationMetrics, j as juniorConversations, t as createJuniorSqlExecutor, v as juniorConversationParticipants, w as juniorConversationEvents, x as CONVERSATION_METRICS, y as juniorConversationBindings } from "./executor-
|
|
5
|
+
import { C as isUserInstruction, E as juniorConversationAnnotations, M as juniorIdentities, N as juniorUsers, P as juniorDestinations, S as juniorConversationMetrics, j as juniorConversations, t as createJuniorSqlExecutor, v as juniorConversationParticipants, w as juniorConversationEvents, x as CONVERSATION_METRICS, y as juniorConversationBindings } from "./executor-D_023K0H.js";
|
|
6
6
|
import { c as newConversationEventSchema, h as usageSchema, l as encodeHistoryPayload, o as decodeStoredConversationEvent, r as conversationEventDataSchema, s as historyReplacementSchema } from "./history-IjdmO_r6.js";
|
|
7
|
-
import { l as withLock, r as getStateAdapter } from "./adapter-
|
|
7
|
+
import { l as withLock, r as getStateAdapter } from "./adapter-CNjGEJO9.js";
|
|
8
8
|
import * as z from "zod";
|
|
9
9
|
import { randomUUID } from "node:crypto";
|
|
10
10
|
import { and, asc, desc, eq, gt, gte, inArray, isNull, lt, lte, ne, or, sql } from "drizzle-orm";
|
|
@@ -400,6 +400,10 @@ async function bindProviderConversation(executor, args) {
|
|
|
400
400
|
// src/chat/state/cache.ts
|
|
401
401
|
const MAX_CACHE_KEY_LENGTH = 512;
|
|
402
402
|
const LOAD_WAIT_MS = 1e4;
|
|
403
|
+
/** The prefix of every state key of one cache namespace. */
|
|
404
|
+
function cacheKeyPrefix(namespace) {
|
|
405
|
+
return `junior:cache:${namespace}:`;
|
|
406
|
+
}
|
|
403
407
|
/**
|
|
404
408
|
* Create a cache in the state adapter under `junior:cache:{namespace}:`.
|
|
405
409
|
* Entries are wrapped, so `null` and `false` values are cache hits.
|
|
@@ -408,7 +412,7 @@ function createCache(state, namespace) {
|
|
|
408
412
|
return { async getOrLoad(key, load, options) {
|
|
409
413
|
if (!key.trim()) throw new Error("Cache key is required");
|
|
410
414
|
if (key.length > MAX_CACHE_KEY_LENGTH) throw new Error("Cache key exceeds the maximum length");
|
|
411
|
-
const cacheKey =
|
|
415
|
+
const cacheKey = `${cacheKeyPrefix(namespace)}${key}`;
|
|
412
416
|
const cached = async () => options?.refresh ? void 0 : await state.get(cacheKey) ?? void 0;
|
|
413
417
|
await state.connect();
|
|
414
418
|
const hit = await cached();
|
|
@@ -443,7 +447,8 @@ function createCache(state, namespace) {
|
|
|
443
447
|
const USER_TTL_MS = 864e5;
|
|
444
448
|
const MISSING_TTL_MS = 6e4;
|
|
445
449
|
const SETTLE_MS = 1e4;
|
|
446
|
-
|
|
450
|
+
/** The cache namespace of every key in this cache. */
|
|
451
|
+
const USER_CACHE_NAMESPACE = "identities";
|
|
447
452
|
const cachedUserSchema = z.object({
|
|
448
453
|
identities: z.array(z.object({
|
|
449
454
|
avatarUrl: z.string().nullable(),
|
|
@@ -467,10 +472,10 @@ const versionSchema = z.object({
|
|
|
467
472
|
writtenAtMs: z.number()
|
|
468
473
|
});
|
|
469
474
|
function versionKey(userId) {
|
|
470
|
-
return
|
|
475
|
+
return `${cacheKeyPrefix(USER_CACHE_NAMESPACE)}version:${userId}`;
|
|
471
476
|
}
|
|
472
477
|
function cache() {
|
|
473
|
-
return createCache(getStateAdapter(),
|
|
478
|
+
return createCache(getStateAdapter(), USER_CACHE_NAMESPACE);
|
|
474
479
|
}
|
|
475
480
|
async function readVersion(userId) {
|
|
476
481
|
const state = getStateAdapter();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as withScope } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import "./config-
|
|
3
|
-
import { h as logWarn, p as logException } from "./logging-
|
|
2
|
+
import "./config-CmjhyqgB.js";
|
|
3
|
+
import { h as logWarn, p as logException } from "./logging-DcjLDDqi.js";
|
|
4
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
5
|
import { sql } from "drizzle-orm";
|
|
6
6
|
import { bigint, boolean, check, date, doublePrecision, foreignKey, index, integer, jsonb, pgTable, primaryKey, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
|
|
@@ -163,7 +163,11 @@ const juniorAttachments = pgTable("junior_attachments", {
|
|
|
163
163
|
conversationId: text("conversation_id").notNull().references(() => juniorConversations.conversationId, { onDelete: "cascade" }),
|
|
164
164
|
/** Service that stores the file bytes. */
|
|
165
165
|
storageProvider: text("storage_provider").notNull(),
|
|
166
|
-
|
|
166
|
+
/**
|
|
167
|
+
* Object key of the stored bytes. Null for a file that Junior records
|
|
168
|
+
* without storing, such as a large Slack file.
|
|
169
|
+
*/
|
|
170
|
+
storageKey: text("storage_key"),
|
|
167
171
|
/** Provider that supplied the file. */
|
|
168
172
|
provider: text("provider"),
|
|
169
173
|
/** File id assigned by the source provider. */
|
|
@@ -171,7 +175,8 @@ const juniorAttachments = pgTable("junior_attachments", {
|
|
|
171
175
|
filename: text("filename").notNull(),
|
|
172
176
|
contentType: text("content_type").notNull(),
|
|
173
177
|
bytes: integer("bytes").notNull(),
|
|
174
|
-
|
|
178
|
+
/** Digest of the stored bytes. Null when `storage_key` is null. */
|
|
179
|
+
sha256: text("sha256"),
|
|
175
180
|
visionSummary: text("vision_summary"),
|
|
176
181
|
createdAt: timestamptz("created_at").notNull(),
|
|
177
182
|
/** Set when conversation purge marks the attachment unavailable. */
|
package/dist/instrumentation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as getClient, c as init, i as getActiveSpan, o as getGlobalScope, p as spanToJSON, s as getTraceData } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { B as getDeploymentTelemetryAttributes, z as getDeploymentServiceVersion } from "./logging-
|
|
3
|
-
import { n as getCurrentConversationPrivacy } from "./conversation-privacy-
|
|
2
|
+
import { B as getDeploymentTelemetryAttributes, z as getDeploymentServiceVersion } from "./logging-DcjLDDqi.js";
|
|
3
|
+
import { n as getCurrentConversationPrivacy } from "./conversation-privacy-0CM0V2qK.js";
|
|
4
4
|
import { n as redactSandboxEgressProxyPath } from "./proxy-path-BHYoKZdq.js";
|
|
5
5
|
import { t as consumePrivateTraceResultMarker } from "./private-trace-result-CE7_lEdq.js";
|
|
6
6
|
import { n as promoteHttpRouteName, r as routeNameMiddleware, t as nameRequestRoute } from "./sentry-route-name-BhwWnfqj.js";
|
|
@@ -162,7 +162,7 @@ const SECRET_HEADER_NAMES = /* @__PURE__ */ new Set([
|
|
|
162
162
|
"x-slack-signature"
|
|
163
163
|
]);
|
|
164
164
|
const SDK_REQUEST_HEADER_PREFIX = "http.request.header.";
|
|
165
|
-
const
|
|
165
|
+
const SPAN_METHOD = /^[A-Z]+$/;
|
|
166
166
|
/**
|
|
167
167
|
* Drop the query and fragment, hide the sandbox egress credential token, and
|
|
168
168
|
* keep only the host of a push endpoint.
|
|
@@ -174,8 +174,17 @@ function scrubUrl(value) {
|
|
|
174
174
|
return redactSandboxEgressProxyPath(url);
|
|
175
175
|
}
|
|
176
176
|
function scrubSpanName(name) {
|
|
177
|
-
const
|
|
178
|
-
|
|
177
|
+
const space = name.indexOf(" ");
|
|
178
|
+
if (space < 1) return name;
|
|
179
|
+
const method = name.slice(0, space);
|
|
180
|
+
const target = name.slice(space + 1);
|
|
181
|
+
const isUrl = [
|
|
182
|
+
"https://",
|
|
183
|
+
"http://",
|
|
184
|
+
"/"
|
|
185
|
+
].some((prefix) => target.startsWith(prefix));
|
|
186
|
+
if (!SPAN_METHOD.test(method) || !isUrl || /\s/.test(target)) return name;
|
|
187
|
+
return `${method} ${scrubUrl(target)}`;
|
|
179
188
|
}
|
|
180
189
|
function isSecretHeaderAttribute(key) {
|
|
181
190
|
const lowerKey = key.toLowerCase();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as conversationKindFromRow, o as getDb } from "./db-
|
|
2
|
-
import { j as juniorConversations } from "./executor-
|
|
1
|
+
import { D as conversationKindFromRow, o as getDb } from "./db-Czra10QW.js";
|
|
2
|
+
import { j as juniorConversations } from "./executor-D_023K0H.js";
|
|
3
3
|
import { desc, eq, sql } from "drizzle-orm";
|
|
4
4
|
// src/chat/conversations/lineage.ts
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as withScope, d as setTag, f as setUser, h as startSpan, i as getActiveSpan, l as logger, n as captureMessage, p as spanToJSON, s as getTraceData, t as captureException } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
2
|
+
import { t as JUNIOR_VERSION } from "./version-CGMRmMPK.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { styleText } from "node:util";
|
|
5
5
|
import { ConfigError, configureSync, getConfig, getLogger } from "@logtape/logtape";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { Jn as renderUntrustedTag,
|
|
3
|
-
import { n as botConfig } from "./config-
|
|
4
|
-
import { a as getConversationStore, j as SYSTEM_IDENTITY_ID, o as getDb } from "./db-
|
|
5
|
-
import {
|
|
6
|
-
import { M as EVENT_WAIT_MS, Z as postAutomatedTurnLimitNoticeForConversation,
|
|
7
|
-
import { A as readChildConversationSender, H as enqueueAgentInvocation, Z as createAgentInvocationForMessage, at as findChildAgentConversationId, g as getActiveAgentInvocationForConversation, lt as PARENT_AGENT_TARGET, rt as AgentMessageTargetError, tt as AgentMessagePausedError, y as getLatestAgentInvocationForConversation } from "./warmup-
|
|
8
|
-
import { r as appendAndEnqueueInboundMessage } from "./store-
|
|
9
|
-
import { a as enqueueAgentMessageToParent } from "./result-
|
|
2
|
+
import { Jn as renderUntrustedTag, vo as canAccessConversation, xo as readConversationAccessFromSql } from "./projection-CQNDOi82.js";
|
|
3
|
+
import { n as botConfig } from "./config-CmjhyqgB.js";
|
|
4
|
+
import { a as getConversationStore, j as SYSTEM_IDENTITY_ID, o as getDb } from "./db-Czra10QW.js";
|
|
5
|
+
import { Ft as toolInvocationDestination, Pt as actorFromRun } from "./agent-runner-H4YhvNBj.js";
|
|
6
|
+
import { M as EVENT_WAIT_MS, Z as postAutomatedTurnLimitNoticeForConversation, nt as admitAutomatedTurn } from "./session-stop-BLmfFI3d.js";
|
|
7
|
+
import { A as readChildConversationSender, H as enqueueAgentInvocation, Z as createAgentInvocationForMessage, at as findChildAgentConversationId, g as getActiveAgentInvocationForConversation, lt as PARENT_AGENT_TARGET, rt as AgentMessageTargetError, tt as AgentMessagePausedError, y as getLatestAgentInvocationForConversation } from "./warmup-CdU5hR49.js";
|
|
8
|
+
import { r as appendAndEnqueueInboundMessage } from "./store-DmV4CoNr.js";
|
|
9
|
+
import { a as enqueueAgentMessageToParent } from "./result-C8iIpDl1.js";
|
|
10
10
|
// src/chat/agent-invocations/top-level-message.ts
|
|
11
11
|
const AGENT_MESSAGE_EVENT_NAMESPACE = "junior";
|
|
12
12
|
/** Event type of a message from another top-level agent. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { s as getSqlExecutor } from "./db-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { s as getSqlExecutor } from "./db-Czra10QW.js";
|
|
3
|
+
import { vt as readLiveAttachment } from "./agent-runner-H4YhvNBj.js";
|
|
4
|
+
import { m as isVisionImageMediaType, p as detectImageMediaType } from "./statuses-Hn-HsOph.js";
|
|
5
5
|
// src/chat/attachments/model-input.ts
|
|
6
6
|
var model_input_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
MAX_MODEL_ATTACHMENTS: () => 3,
|
|
@@ -28,7 +28,7 @@ async function readStoredBytes(args) {
|
|
|
28
28
|
conversationId: args.conversationId,
|
|
29
29
|
db: getSqlExecutor()
|
|
30
30
|
});
|
|
31
|
-
if (!record || record.storageProvider !== args.storage.provider) throw new Error("Input attachment is no longer available.");
|
|
31
|
+
if (!record || record.storageProvider !== args.storage.provider || record.storageKey === null) throw new Error("Input attachment is no longer available.");
|
|
32
32
|
const body = await args.storage.get(record.storageKey);
|
|
33
33
|
if (!body) throw new Error("Input attachment contents are unavailable.");
|
|
34
34
|
const data = Buffer.from(await new Response(body).arrayBuffer());
|
package/dist/nitro.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as JuniorDashboardOptions } from "./app
|
|
1
|
+
import { i as JuniorDashboardOptions } from "./app-HDZglaIu.js";
|
|
2
2
|
import { n as JuniorPluginSet } from "./plugins-B_0Cr0MO.js";
|
|
3
3
|
import { withSentryConfig as withSentryConfig$1 } from "@sentry/nitro";
|
|
4
4
|
type SentryNitroConfig = Parameters<typeof withSentryConfig$1>[0];
|
package/dist/nitro.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_CRON_SCHEDULE, I as JUNIOR_RETENTION_ROUTE, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_CRON_SCHEDULE, N as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, k as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE, z as getDeploymentServiceVersion } from "./logging-
|
|
1
|
+
import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_CRON_SCHEDULE, I as JUNIOR_RETENTION_ROUTE, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_CRON_SCHEDULE, N as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, k as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE, z as getDeploymentServiceVersion } from "./logging-DcjLDDqi.js";
|
|
2
2
|
import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-DJhGdS4c.js";
|
|
3
|
-
import { a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC,
|
|
4
|
-
import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-
|
|
5
|
-
import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-
|
|
3
|
+
import { a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, g as CACHE_WARMUP_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, u as resolveConversationWorkQueueTopic } from "./background-compaction-queue-CNrZ3QcU.js";
|
|
4
|
+
import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-AhG1tSXR.js";
|
|
5
|
+
import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-BBX07Jzt.js";
|
|
6
6
|
import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cf5gVPWP.js";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Zn as createUserTokenStore } from "./projection-
|
|
2
|
-
import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-
|
|
1
|
+
import { Zn as createUserTokenStore } from "./projection-CQNDOi82.js";
|
|
2
|
+
import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-tEMKZ_8M.js";
|
|
3
3
|
import { createServer } from "node:http";
|
|
4
4
|
// src/chat/local/oauth-callback-server.ts
|
|
5
5
|
const LOCAL_OAUTH_TIMEOUT_MS = 6e5;
|