@sentry/junior 0.293.0 → 0.295.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/{admin-uuecrKuD.js → admin-ifgjyfpF.js} +2 -2
- package/dist/{agent-runner-DHq1pjUg.js → agent-runner-DjMTPWEO.js} +192 -100
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +5 -5
- package/dist/api.d.ts +1 -1
- package/dist/api.js +73 -29
- package/dist/{app-fWzCHFIb.d.ts → app-uiTzRbvq.d.ts} +5 -3
- package/dist/app.d.ts +2 -2
- package/dist/app.js +64 -74
- package/dist/{automation-BE3z19VN.js → automation-yJX3C7i3.js} +3 -3
- package/dist/{background-compaction-queue-D7ncdEa6.js → background-compaction-queue-DUkHZjmL.js} +7 -9
- package/dist/{briefs-NpgMEFh1.js → briefs-CbNYM-q2.js} +3 -3
- package/dist/{catalog-runtime-DwbTyNRD.js → catalog-runtime-DgouZKZm.js} +1 -1
- package/dist/cli/chat.d.ts +1 -1
- package/dist/cli/chat.js +15 -15
- package/dist/cli/check.js +3 -3
- package/dist/cli/init.js +2 -0
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.d.ts +1 -1
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +2 -2
- package/dist/cli/upgrade.js +7 -74
- package/dist/{config-B4b-NXH5.js → config-DvnTPCfp.js} +58 -7
- package/dist/{connections-Dz_AQg5p.js → connections-CWaIVl_1.js} +6 -6
- package/dist/{conversation-CtjR1Zcx.js → conversation-CMkSmi02.js} +3 -11
- package/dist/{conversation-pending-messages-1Kad1Mif.js → conversation-feed-BVAOga0H.js} +27 -2
- package/dist/{conversation-privacy-DRsSgLGO.js → conversation-privacy-DPjv4SnA.js} +1 -1
- package/dist/{credential-sync-ClCnnGVj.js → credential-sync-BhbaZfmO.js} +16 -15
- package/dist/{db-BbpttyKH.d.ts → db-CCUqQe0E.d.ts} +13 -6
- package/dist/{db-CoA7_Xqu.js → db-Dts2XvLu.js} +144 -7
- package/dist/{executor-SWyHhit0.js → executor-Ck73J0wP.js} +64 -10
- package/dist/instrumentation.js +2 -2
- package/dist/{logging-BN5drSEZ.js → logging-9OAq-fdg.js} +2 -1
- package/dist/{message-D4qjpW1C.js → message-CtaPzC7m.js} +9 -9
- package/dist/nitro.d.ts +2 -2
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-Xi-mTLOV.js → oauth-callback-server-C_LXY1d4.js} +2 -2
- package/dist/{oauth-relay-D6xxVywK.js → oauth-relay-CsfIazeF.js} +2 -1
- package/dist/{plugins-DtmjkTza.d.ts → plugins-B_0Cr0MO.d.ts} +0 -1
- package/dist/{projection-DXl4ftyL.js → projection-BzJQncZV.js} +251 -161
- package/dist/{prompt-Dmx6IfWZ.js → prompt-Cbq5b4SO.js} +5 -6
- package/dist/{registry-DosVt9f9.js → registry-cbpOxO4M.js} +3 -13
- package/dist/{resolve-BDjWJC9s.js → resolve-t-pmRdwS.js} +3 -3
- package/dist/{result-CaAFpf4B.js → result-DhgjR3nQ.js} +8 -8
- package/dist/{runner-h96Mkss6.js → runner-CHv9X9TH.js} +8 -8
- package/dist/{sandbox-egress-signals-rK91BW7i.js → sandbox-egress-signals-Yy3fSCbg.js} +1 -1
- package/dist/{schema-C_v8wb80.js → schema-BhneuGYv.js} +39 -7
- package/dist/{schema-CHsBmXIj.d.ts → schema-TSEisVJR.d.ts} +87 -14
- package/dist/secrets-DebYU866.js +18 -0
- package/dist/{service-account-WUMVuqVL.js → service-account-C4rBP8ne.js} +3 -3
- package/dist/{service-account-BpGpScaT.js → service-account-DjPIwCMj.js} +42 -26
- package/dist/{session-stop-xYK15HUu.js → session-stop-DkxI5vc3.js} +20 -775
- package/dist/{skills-DHApyCjj.js → skills-BZE2DP8I.js} +2 -2
- package/dist/{spawn-BQQrwGNe.js → spawn-BvULxIiu.js} +5 -5
- package/dist/{adapter-CMJfmHso.js → state-CO9ETDzk.js} +132 -2
- package/dist/{stop-CBeD6_Gs.js → stop-CL-rdtQb.js} +85 -32
- package/dist/{store-xtibD98L.js → store-DgD78_NK.js} +3 -3
- package/dist/{task-runner-BYPN4BEO.js → task-runner-CKOj6xla.js} +11 -11
- package/dist/{turn-failure-response-jNVl00MD.js → turn-failure-response-BTSo6SMJ.js} +8 -8
- package/dist/{validation-DGeB_moV.js → validation-CXeYgBzq.js} +1 -1
- package/dist/{version-C6nqU3Qc.js → version-AQa7Fr2H.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-9KLQibjn.js → viewer-Bqkb678l.js} +3 -3
- package/dist/warmup-h6u1e9n0.js +1869 -0
- package/dist/{work-xwX6unUE.js → work-yN_GAuXY.js} +11 -11
- package/dist/{worker-CiCCfwd4.js → worker-Hl7N292I.js} +6 -6
- package/migrations/0062_plugin_report_index.sql +1 -20
- package/migrations/0078_plugin_conversation_index.sql +1 -20
- package/migrations/0079_conversation_event_author_index.sql +1 -20
- package/migrations/0080_conversation_event_latest_message_indexes.sql +2 -27
- package/migrations/0090_guardian_review_time_index.sql +1 -20
- package/migrations/0091_conversation_participant_unsubscribed_index.sql +1 -20
- package/migrations/0097_conversation_kind_automation.sql +6 -0
- package/migrations/0098_review_item_plugin_actions.sql +5 -0
- package/migrations/0099_conversation_last_message_at.sql +1 -0
- package/migrations/0100_automation_task_kind_repair.sql +48 -0
- package/migrations/meta/0097_snapshot.json +4490 -0
- package/migrations/meta/0098_snapshot.json +4490 -0
- package/migrations/meta/0099_snapshot.json +4720 -0
- package/migrations/meta/0100_snapshot.json +4496 -0
- package/migrations/meta/_journal.json +28 -0
- package/package.json +5 -5
- package/dist/assistant-reply-CIApSfor.js +0 -58
- package/dist/warmup-7S6z068f.js +0 -993
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { h as logWarn } from "./logging-
|
|
2
|
+
import { h as logWarn } from "./logging-9OAq-fdg.js";
|
|
3
3
|
import { s as skillRoots } from "./package-discovery-DJhGdS4c.js";
|
|
4
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
4
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-DgouZKZm.js";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import * as z from "zod";
|
|
7
7
|
import fs from "node:fs/promises";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
3
|
-
import {
|
|
4
|
-
import { A as juniorConversations } from "./executor-
|
|
5
|
-
import { en as AgentDepthLimitError, hn as toolInvocationDestination, mn as actorFromRun } from "./agent-runner-
|
|
6
|
-
import { n as createAndEnqueueAgentInvocation } from "./work-
|
|
2
|
+
import { n as botConfig } from "./config-DvnTPCfp.js";
|
|
3
|
+
import { O as conversationKindFromRow, o as getDb } from "./db-Dts2XvLu.js";
|
|
4
|
+
import { A as juniorConversations } from "./executor-Ck73J0wP.js";
|
|
5
|
+
import { en as AgentDepthLimitError, hn as toolInvocationDestination, mn as actorFromRun } from "./agent-runner-DjMTPWEO.js";
|
|
6
|
+
import { n as createAndEnqueueAgentInvocation } from "./work-yN_GAuXY.js";
|
|
7
7
|
import { desc, eq, sql } from "drizzle-orm";
|
|
8
8
|
// src/chat/conversations/lineage.ts
|
|
9
9
|
/**
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { i as getChatConfig } from "./config-
|
|
1
|
+
import { i as getChatConfig } from "./config-DvnTPCfp.js";
|
|
2
|
+
import { h as logWarn } from "./logging-9OAq-fdg.js";
|
|
2
3
|
import { t as ACTIVE_LOCK_TTL_MS } from "./locks-D-0h111u.js";
|
|
4
|
+
import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
|
|
3
5
|
import { createMemoryState } from "@chat-adapter/state-memory";
|
|
4
6
|
import { createRedisState } from "@chat-adapter/state-redis";
|
|
5
7
|
// src/chat/state/adapter.ts
|
|
@@ -253,4 +255,132 @@ async function disconnectStateAdapter() {
|
|
|
253
255
|
redisStateAdapter = void 0;
|
|
254
256
|
}
|
|
255
257
|
}
|
|
256
|
-
|
|
258
|
+
// src/chat/encryption/secret.ts
|
|
259
|
+
/**
|
|
260
|
+
* Encrypt secrets that Junior keeps at rest, such as provider credentials.
|
|
261
|
+
*
|
|
262
|
+
* AES-256-GCM with keys from `JUNIOR_ENCRYPTION_KEYS` (see `keyring.ts`).
|
|
263
|
+
* Each value is bound to a context, usually its storage key, and to its key
|
|
264
|
+
* id as additional authenticated data. A value copied to another key does not
|
|
265
|
+
* decrypt.
|
|
266
|
+
*
|
|
267
|
+
* New values use the active key. Any listed key decrypts. A value from a key
|
|
268
|
+
* that is not active reports `stale`, so its owner can save it again with the
|
|
269
|
+
* active key. A value that cannot be decrypted gives `UnreadableSecretError`:
|
|
270
|
+
* `unknown_key` when its key id is not listed, `invalid` when it is malformed,
|
|
271
|
+
* altered, or bound to another context.
|
|
272
|
+
*
|
|
273
|
+
* There is no per-value salt. The keys are random, not passwords, and each
|
|
274
|
+
* value has a random IV. The storage key in the AAD already names the
|
|
275
|
+
* identity that owns the value.
|
|
276
|
+
*
|
|
277
|
+
* Envelope: `jenc:v1:<keyId>:<iv>.<ciphertext>.<tag>` (base64url parts).
|
|
278
|
+
*/
|
|
279
|
+
const ENVELOPE_PREFIX = "jenc:v1:";
|
|
280
|
+
const ALGORITHM = "aes-256-gcm";
|
|
281
|
+
const IV_BYTES = 12;
|
|
282
|
+
const TAG_BYTES = 16;
|
|
283
|
+
/** A stored secret that cannot be decrypted with the configured keys. */
|
|
284
|
+
var UnreadableSecretError = class extends Error {
|
|
285
|
+
reason;
|
|
286
|
+
constructor(reason) {
|
|
287
|
+
super(reason === "unknown_key" ? "Stored secret was encrypted with a key that is not configured" : "Stored secret is malformed or failed authentication");
|
|
288
|
+
this.name = "UnreadableSecretError";
|
|
289
|
+
this.reason = reason;
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
function additionalData(keyId, context) {
|
|
293
|
+
return Buffer.from(`${ENVELOPE_PREFIX}${keyId}\0${context}`, "utf8");
|
|
294
|
+
}
|
|
295
|
+
/** Check whether a stored value is an encryption envelope. */
|
|
296
|
+
function isEncryptedSecret(value) {
|
|
297
|
+
return typeof value === "string" && value.startsWith(ENVELOPE_PREFIX);
|
|
298
|
+
}
|
|
299
|
+
/** Encrypt one secret with the active key and bind it to `context`. */
|
|
300
|
+
function encryptSecret(plaintext, context, keyring = getChatConfig().encryption) {
|
|
301
|
+
const { id, key } = keyring.active;
|
|
302
|
+
const iv = randomBytes(IV_BYTES);
|
|
303
|
+
const cipher = createCipheriv(ALGORITHM, key, iv, { authTagLength: TAG_BYTES });
|
|
304
|
+
cipher.setAAD(additionalData(id, context));
|
|
305
|
+
const parts = [
|
|
306
|
+
iv,
|
|
307
|
+
Buffer.concat([cipher.update(plaintext, "utf8"), cipher.final()]),
|
|
308
|
+
cipher.getAuthTag()
|
|
309
|
+
].map((part) => part.toString("base64url"));
|
|
310
|
+
return `${ENVELOPE_PREFIX}${id}:${parts.join(".")}`;
|
|
311
|
+
}
|
|
312
|
+
/** Decrypt an `encryptSecret` envelope with the same `context`. */
|
|
313
|
+
function decryptSecret(envelope, context, keyring = getChatConfig().encryption) {
|
|
314
|
+
if (!isEncryptedSecret(envelope)) throw new Error("Stored secret is not an encryption envelope");
|
|
315
|
+
const [keyId, payload] = envelope.slice(8).split(":");
|
|
316
|
+
const [iv, ciphertext, tag] = (payload ?? "").split(".").map((part) => Buffer.from(part, "base64url"));
|
|
317
|
+
if (!keyId || !iv || iv.length !== IV_BYTES || !ciphertext || !tag || tag.length !== TAG_BYTES) throw new UnreadableSecretError("invalid");
|
|
318
|
+
const match = keyring.keys.find((candidate) => candidate.id === keyId);
|
|
319
|
+
if (!match) throw new UnreadableSecretError("unknown_key");
|
|
320
|
+
const decipher = createDecipheriv(ALGORITHM, match.key, iv, { authTagLength: TAG_BYTES });
|
|
321
|
+
decipher.setAAD(additionalData(keyId, context));
|
|
322
|
+
decipher.setAuthTag(tag);
|
|
323
|
+
let text;
|
|
324
|
+
try {
|
|
325
|
+
text = Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString("utf8");
|
|
326
|
+
} catch {
|
|
327
|
+
throw new UnreadableSecretError("invalid");
|
|
328
|
+
}
|
|
329
|
+
return {
|
|
330
|
+
stale: match.id !== keyring.active.id,
|
|
331
|
+
text
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
// src/chat/encryption/state.ts
|
|
335
|
+
/**
|
|
336
|
+
* Decrypt one stored envelope. The storage key is the encryption context.
|
|
337
|
+
* A value that cannot be decrypted, such as one from a key that is no longer
|
|
338
|
+
* configured or one that was altered, reads as missing. The owner then asks
|
|
339
|
+
* for the credential again and saves it with the active key.
|
|
340
|
+
*/
|
|
341
|
+
function decode(key, envelope) {
|
|
342
|
+
let decrypted;
|
|
343
|
+
try {
|
|
344
|
+
decrypted = decryptSecret(envelope, key);
|
|
345
|
+
} catch (error) {
|
|
346
|
+
if (!(error instanceof UnreadableSecretError)) throw error;
|
|
347
|
+
logWarn("encryption.secret_unreadable", { "error.type": error.reason });
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
return {
|
|
351
|
+
stale: decrypted.stale,
|
|
352
|
+
value: JSON.parse(decrypted.text)
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Wrap a state adapter so values are JSON-encoded and encrypted before they
|
|
357
|
+
* reach storage. Keys and TTLs stay readable. Use it for credentials and
|
|
358
|
+
* other secrets; delete, lock, and keep plain state on the base adapter.
|
|
359
|
+
*/
|
|
360
|
+
function createEncryptedState(state) {
|
|
361
|
+
return {
|
|
362
|
+
async get(key) {
|
|
363
|
+
const stored = await state.get(key);
|
|
364
|
+
if (!isEncryptedSecret(stored)) return void 0;
|
|
365
|
+
return decode(key, stored)?.value;
|
|
366
|
+
},
|
|
367
|
+
async set(key, value, ttlMs) {
|
|
368
|
+
await state.set(key, encryptSecret(JSON.stringify(value), key), ttlMs);
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Read a value and report whether it is stale: encrypted with a key that is
|
|
374
|
+
* not active, or saved before encryption. Long-lived owners save stale values
|
|
375
|
+
* again, so they move to the active key.
|
|
376
|
+
*/
|
|
377
|
+
async function readEncryptedState(state, key) {
|
|
378
|
+
const stored = await state.get(key);
|
|
379
|
+
if (stored === null || stored === void 0) return void 0;
|
|
380
|
+
if (!isEncryptedSecret(stored)) return {
|
|
381
|
+
stale: true,
|
|
382
|
+
value: stored
|
|
383
|
+
};
|
|
384
|
+
return decode(key, stored);
|
|
385
|
+
}
|
|
386
|
+
export { getStateAdapter as a, getDefaultRedisStateAdapterFor as i, readEncryptedState as n, getStateValues as o, disconnectStateAdapter as r, setStateValues as s, createEncryptedState as t };
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import { h as startSpan } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { $ as loadTurnCheckpoint, $
|
|
3
|
-
import { A as estimateTextTokens, E as resolveGatewayModel,
|
|
4
|
-
import { E as withSpan, G as isRecord, K as toOptionalNumber, S as setTags, T as withLogContext, b as setSpanAttributes, f as logError, h as logWarn, m as logInfo, n as createChatSdkLogger, o as getActiveTraceContext, p as logException, q as toOptionalString, s as getActiveTraceId, t as buildTurnFailureResponse, y as setSentryUser } from "./logging-
|
|
5
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
2
|
+
import { $ as loadTurnCheckpoint, $a as createConversationAccessReader, A as latestConversationMessageSeq, Ao as lookupSlackUser, Bi as normalizeSlackStatusText, Bn as getPlugins, D as estimateConversationMessagesTokens, Do as listConversationAnnotationsById, E as buildConversationContext, En as createUserTokenStore, Eo as listConversationAnnotations, F as turnHasReply, Gi as getSlackMessagePermalink, H as PluginCredentialFailureError, Hi as truncateStatusText, I as upsertConversationMessage, Io as configValueSchema, Jt as buildTurnErrorResponse, K as AuthorizationFlowDisabledError, Li as escapeSlackMrkdwnText, M as normalizeConversationText, N as recordDeliveredAssistantMessage, Nt as moveIdleConversationDestination, O as getConversationMessageSlackTs, On as webActorUserIds, P as trimConversationMessages, Po as createPluginCache, Qa as canAddConversationMessages, Qt as persistWithRetry, Ri as formatSlackLink, Ro as piMessageFromHistoryItem, Rt as releaseInboundMessage, S as resolveConversationTitle, So as slackAttachmentsVersionQuery, Ui as addReactionToMessage, Wi as deleteSlackMessage, X as clearPendingAuth, Xa as createPluginLogger, Xi as removeReactionFromMessage, Yi as postSlackMessage, _o as notInheritedByForkChild, a as loadProjection, aa as getHeaderString, ao as conversationViewerMarks, at as failTurnRecord, b as persistConversationMessages, bo as readAttachmentVisionSummary, br as isOnlyAssignee, ca as isDmChannel, ct as recordTurnSummary, d as recordAuthorizationCompleted, da as withSlackRetries, do as readConversationEventPageAfter, eo as readConversationAccessFromSql, et as lostWorkerBeforeFirstSave, fo as readConversationEventPageAround, gr as canActOnReviewItem, h as recordSubscribedReplyRoute, ho as buildSentryConversationUrl, i as loadConversationProjection, io as conversationPinnedForUser, it as completeTurnRecord, j as markConversationMessage, jo as lookupSlackUserNames, k as isHumanConversationMessage, la as normalizeSlackConversationId, lo as readLatestConversationBrief, lr as listReplyActionItems, mn as trimTrailingAssistantMessages, n as commitMessages, na as SlackActionError, no as conversationIsMemberRoot, nt as saveTurnCheckpoint, o as loadTurnProjection, oa as getSlackClient, oo as viewerMarksFromParticipant, ot as getTurnRecord, pr as takeReviewItem, ra as downloadPrivateSlackFile, ri as getDashboardConversationLink, ro as conversationIsNotUnsubscribedRoot, rr as closeReviewItem, rt as abandonTurnRecord, sr as getReviewItem, st as listTurnSummaries, t as commitAcceptedReply, to as conversationHasParticipantUser, tt as pauseLostWorkerTurn, uo as readConversationEventPage, ur as listWaitingConversations, v as hydrateConversationMessages, vo as getSlackFileId, w as fallbackShortTitle, wr as reviewItemNeedsSomeone, xo as recordSlackAttachment, y as persistConversationMessageWindow, yr as canUserReadReviewItem, zr as cancelSubscriptions } from "./projection-BzJQncZV.js";
|
|
3
|
+
import { A as estimateTextTokens, E as resolveGatewayModel, K as isProviderRetryError, L as escapeXml, c as getSlackClientSecret, i as getChatConfig, j as textCharsForTokens, l as getSlackSigningSecret, n as botConfig, o as getSlackBotToken, s as getSlackClientId, v as normalizeSlackEmojiName } from "./config-DvnTPCfp.js";
|
|
4
|
+
import { E as withSpan, G as isRecord, K as toOptionalNumber, S as setTags, T as withLogContext, b as setSpanAttributes, f as logError, h as logWarn, m as logInfo, n as createChatSdkLogger, o as getActiveTraceContext, p as logException, q as toOptionalString, s as getActiveTraceId, t as buildTurnFailureResponse, y as setSentryUser } from "./logging-9OAq-fdg.js";
|
|
5
|
+
import { t as JUNIOR_VERSION } from "./version-AQa7Fr2H.js";
|
|
6
6
|
import { f as parseSlackTeamId, h as parseSlackMessageTs, i as isActorUserId, n as createSlackActor, o as isUserActor, r as createSlackResumeActor, s as parseActorUserId, t as createActor, u as parseSlackChannelId } from "./actor-6jsm_v96.js";
|
|
7
|
-
import {
|
|
8
|
-
import { A as juniorConversations, D as juniorCodeChanges, E as juniorConversationAnnotations, M as juniorUsers, N as juniorDestinations, _ as juniorConversationReadPositions, b as juniorConversationBriefs, j as juniorIdentities, l as juniorReviewItems, s as juniorReviewItemConversations, v as juniorConversationParticipants, w as juniorConversationEvents } from "./executor-
|
|
7
|
+
import { A as setFirstConversationLocation, C as deliversFinalText, E as postsRunNotices, F as saveActorAvatar, G as getConversationIdByProviderConversation, K as parseSessionSource, O as conversationKindFromRow, P as resolveActorIdentityId, Q as resolveRootConversationId, S as withConversationMutationLock, T as isTopLevelKind, W as claimProviderConversation, X as agentTurnUsageSchema, Z as hasAgentTurnUsage, _ as setArchivedAt, a as getConversationStore, at as requireSlackDestination, g as readConversationTrees, k as locationFromRow, m as conversationAncestors, o as getDb, p as withConversationEventLock, q as addAgentTurnUsage, r as getConversationEventStore, rt as createSlackDestination, s as getSqlExecutor, tt as nextDetailVersion, v as loadConversationSlackTenantIds, y as lastMessageAtSql } from "./db-Dts2XvLu.js";
|
|
8
|
+
import { A as juniorConversations, D as juniorCodeChanges, E as juniorConversationAnnotations, M as juniorUsers, N as juniorDestinations, _ as juniorConversationReadPositions, b as juniorConversationBriefs, j as juniorIdentities, l as juniorReviewItems, s as juniorReviewItemConversations, v as juniorConversationParticipants, w as juniorConversationEvents } from "./executor-Ck73J0wP.js";
|
|
9
9
|
import { _ as instructionProvenanceFor, a as KNOWN_CONVERSATION_EVENT_TYPES, h as contextProvenance, i as isVisionImageMediaType, r as detectImageMediaType } from "./media-BepyEUNm.js";
|
|
10
|
-
import { d as actorLogContext, f as credentialContextForActor } from "./registry-
|
|
11
|
-
import { A as runWithSlackInstallation, At as cancelSignInWait, B as listThreadReplies, Bt as canShareTurn, Dt as stopChildAgentsOf, Et as stopChildAgentsBelow, F as resolveSlackChannelIdFromThreadId, Ft as getPausedTurnRequest, I as checkSlackChannelReadAccess, Jt as withTurnSpan, Kt as getTurnInputSpanAttributes, L as joinPublicChannelForRead, Lt as wakePausedTurn, M as parseSlackThreadId, N as readSlackRawMessageContext, Nt as supersedeTurnForInput, P as resolveSlackChannelIdFromMessage, Pt as createPausedTurns, R as getConversationInfo, Rt as getTurnAuthorization, S as createSlackReviewItemShow, St as markConversationRead, Tt as throwApiError, Ut as AgentRunError, V as resolveDestinationVisibility, Wt as executeTurn, X as readConversationSourceTask, Xt as getWebAuthorization, Zt as canPauseConversationDelivery, at as deliverReviewItemChange, b as renderAttachmentText, ct as acceptsWebMessages, dt as createAndEnqueueConversation, ft as createConversationId, gn as shouldEmitDevAgentTrace, ht as decodeInputImages, i as buildAuthPauseResponse, jt as createConversationTurnWorker, lt as appendAndEnqueueWebMessage, mt as webActorFromUser, n as executeAgentRun, on as listedConversation, p as latestProgressStatus, pn as RetryableDeliveryError, pt as recordWebConversationActivity, qt as turnInputTelemetry, t as createAgentRunner, x as renderBlockText, xt as conversationReadPositionQuery, yt as storeAttachment, zt as canJoinTurn } from "./agent-runner-
|
|
12
|
-
import { a as EVENT_SYSTEM_ACTOR, c as completeDecision, o as isEventConversationMessage, u as completeText } from "./prompt-
|
|
10
|
+
import { d as actorLogContext, f as credentialContextForActor } from "./registry-cbpOxO4M.js";
|
|
11
|
+
import { A as runWithSlackInstallation, At as cancelSignInWait, B as listThreadReplies, Bt as canShareTurn, Dt as stopChildAgentsOf, Et as stopChildAgentsBelow, F as resolveSlackChannelIdFromThreadId, Ft as getPausedTurnRequest, I as checkSlackChannelReadAccess, Jt as withTurnSpan, Kt as getTurnInputSpanAttributes, L as joinPublicChannelForRead, Lt as wakePausedTurn, M as parseSlackThreadId, N as readSlackRawMessageContext, Nt as supersedeTurnForInput, P as resolveSlackChannelIdFromMessage, Pt as createPausedTurns, R as getConversationInfo, Rt as getTurnAuthorization, S as createSlackReviewItemShow, St as markConversationRead, Tt as throwApiError, Ut as AgentRunError, V as resolveDestinationVisibility, Wt as executeTurn, X as readConversationSourceTask, Xt as getWebAuthorization, Zt as canPauseConversationDelivery, at as deliverReviewItemChange, b as renderAttachmentText, ct as acceptsWebMessages, dt as createAndEnqueueConversation, ft as createConversationId, gn as shouldEmitDevAgentTrace, ht as decodeInputImages, i as buildAuthPauseResponse, jt as createConversationTurnWorker, lt as appendAndEnqueueWebMessage, mt as webActorFromUser, n as executeAgentRun, on as listedConversation, p as latestProgressStatus, pn as RetryableDeliveryError, pt as recordWebConversationActivity, qt as turnInputTelemetry, t as createAgentRunner, x as renderBlockText, xt as conversationReadPositionQuery, yt as storeAttachment, zt as canJoinTurn } from "./agent-runner-DjMTPWEO.js";
|
|
12
|
+
import { a as EVENT_SYSTEM_ACTOR, c as completeDecision, o as isEventConversationMessage, u as completeText } from "./prompt-Cbq5b4SO.js";
|
|
13
13
|
import { r as acquireActiveLock } from "./locks-D-0h111u.js";
|
|
14
|
-
import { f as identityAvatarUrl, h as readUserAvatarUrls } from "./viewer-
|
|
15
|
-
import { a as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { n as
|
|
21
|
-
import { $ as withoutSavedSteeringMessages, B as maybePostAutomatedTurnLimitNotice, H as resolveSlackReplyTarget, K as recordFinishedTurnForAutomatedLimit, U as sendSlackReply, X as buildSteeringPiMessage, b as conversationSubtree, c as loadReviewItemInput,
|
|
14
|
+
import { f as identityAvatarUrl, h as readUserAvatarUrls } from "./viewer-Bqkb678l.js";
|
|
15
|
+
import { a as getStateAdapter, o as getStateValues, s as setStateValues } from "./state-CO9ETDzk.js";
|
|
16
|
+
import { U as readMessageAttachments, d as conversationEventPageSchema, l as conversationDetailReportSchema } from "./conversation-CMkSmi02.js";
|
|
17
|
+
import { t as readJuniorSecret } from "./secrets-DebYU866.js";
|
|
18
|
+
import { D as getAssistantReplyText, S as finishedRunReply, T as runDispatchOutcome, c as listConversationWork, l as readLastUserMessageAtByConversation, s as isConversationWorkDone } from "./warmup-h6u1e9n0.js";
|
|
19
|
+
import { g as getVercelConversationWorkQueue, k as getTurnRequestDeadline } from "./background-compaction-queue-DUkHZjmL.js";
|
|
20
|
+
import { a as persistAuthPauseTurnState, at as getConversationTurnBoundaryError, b as getChildAgentLabel, c as getTurnUserSlackMessageTs, ct as isTurnInputDeferredError, d as loadThreadContextTrimFloor, dt as markTurnFailed, ft as startActiveTurn, i as completeAuthPauseTurn, it as TurnInputDeferredError, l as buildDeliveredTurnStatePatch, lt as markTurnClosed, m as loadPendingMessageCards, mt as buildDeterministicTurnId, n as getAgentTurnDiagnosticsAttributes, nt as CooperativeTurnYieldError, o as getTurnUserMessage, ot as isCooperativeTurnYieldError, p as getTurnLifecycle, pt as buildDeterministicAssistantMessageId, r as requireTurnFailureEventId, rt as TurnInputCommitLostError, s as getTurnUserReplyAttachmentContext, st as isTurnInputCommitLostError, t as finalizeFailedTurnReplyWithEvent, tt as ConversationTurnBoundaryError, u as buildTurnThreadContext, ut as markTurnCompleted } from "./turn-failure-response-BTSo6SMJ.js";
|
|
21
|
+
import { $ as withoutSavedSteeringMessages, B as maybePostAutomatedTurnLimitNotice, H as resolveSlackReplyTarget, K as recordFinishedTurnForAutomatedLimit, U as sendSlackReply, X as buildSteeringPiMessage, b as conversationSubtree, c as loadReviewItemInput, g as resolveMailboxTurnWork, l as savedInputInstruction, o as skipInputAfterConversationStop, r as markConversationsStopped, rt as isExperimentalFeatureEnabled, x as conversationSubtreeColumns, y as legacyWebMailboxMetadataSchema } from "./session-stop-DkxI5vc3.js";
|
|
22
22
|
import { b as normalizeUserInputAnswer, p as webMessageId, y as isEmptyUserInputAnswer } from "./reporting-window-B3Ze-Qnt.js";
|
|
23
|
-
import { T as stopConversationWork, a as cancelHumanFacingPendingMessages, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, s as claimInboundMessage, w as steerWebPendingMessages } from "./store-
|
|
24
|
-
import { _ as markDispatchBlocked, a as claimDispatchMailboxAppend, at as readAutomationTitlesByConversationId, b as markDispatchRunning, c as getDispatchConversationId, d as getDispatchRecord, dt as getLocationConfigurationService, f as getDispatchTurnId, ft as getPersistedSandboxState, g as markDispatchAwaitingResume, gt as coerceThreadConversationState, ht as persistThreadStateById, lt as resolveConversationRouting, m as isTerminalDispatchStatus, mt as persistThreadRuntimeState, n as scheduleSessionCompletedPluginTasks, o as confirmDispatchMailboxAppend, pt as getPersistedThreadState, u as getDispatchInputMessageId, ut as resolveTurnSessionRouting, v as markDispatchCompleted, y as markDispatchFailed } from "./task-runner-
|
|
25
|
-
import {
|
|
26
|
-
import { r as endActiveAgentInvocations, s as resolveThreadTurnWork } from "./work-
|
|
27
|
-
import { a as withAgentInvocationResultActors, n as enqueueAgentInvocationResult, t as createChildConversationWorker } from "./result-
|
|
28
|
-
import { t as bindMessageAgent } from "./message-
|
|
29
|
-
import { r as readConversationLineage, t as bindSpawnAgent } from "./spawn-
|
|
23
|
+
import { T as stopConversationWork, a as cancelHumanFacingPendingMessages, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, s as claimInboundMessage, w as steerWebPendingMessages } from "./store-DgD78_NK.js";
|
|
24
|
+
import { _ as markDispatchBlocked, a as claimDispatchMailboxAppend, at as readAutomationTitlesByConversationId, b as markDispatchRunning, c as getDispatchConversationId, d as getDispatchRecord, dt as getLocationConfigurationService, f as getDispatchTurnId, ft as getPersistedSandboxState, g as markDispatchAwaitingResume, gt as coerceThreadConversationState, ht as persistThreadStateById, lt as resolveConversationRouting, m as isTerminalDispatchStatus, mt as persistThreadRuntimeState, n as scheduleSessionCompletedPluginTasks, o as confirmDispatchMailboxAppend, pt as getPersistedThreadState, u as getDispatchInputMessageId, ut as resolveTurnSessionRouting, v as markDispatchCompleted, y as markDispatchFailed } from "./task-runner-CKOj6xla.js";
|
|
25
|
+
import { l as conversationPendingMessagesReportSchema, n as conversationFeedSchema, p as healthReportSchema, t as conversationFeedBriefSchema } from "./conversation-feed-BVAOga0H.js";
|
|
26
|
+
import { r as endActiveAgentInvocations, s as resolveThreadTurnWork } from "./work-yN_GAuXY.js";
|
|
27
|
+
import { a as withAgentInvocationResultActors, n as enqueueAgentInvocationResult, t as createChildConversationWorker } from "./result-DhgjR3nQ.js";
|
|
28
|
+
import { t as bindMessageAgent } from "./message-CtaPzC7m.js";
|
|
29
|
+
import { r as readConversationLineage, t as bindSpawnAgent } from "./spawn-BvULxIiu.js";
|
|
30
30
|
import { createHash, createHmac, timingSafeEqual } from "node:crypto";
|
|
31
31
|
import * as z from "zod";
|
|
32
|
-
import { and, asc, desc, eq, gt, inArray, isNotNull, isNull, lte, max, ne, or, sql } from "drizzle-orm";
|
|
32
|
+
import { and, asc, count, desc, eq, gt, inArray, isNotNull, isNull, lte, max, ne, or, sql } from "drizzle-orm";
|
|
33
33
|
import { conversationSidebarAnnotationSchema, createSlackSource, objectTypeSchema } from "@sentry/junior-plugin-api";
|
|
34
34
|
import { alias } from "drizzle-orm/pg-core";
|
|
35
35
|
import { Message, ThreadImpl, stringifyMarkdown } from "chat";
|
|
@@ -55,6 +55,10 @@ const agentDispatchMailboxMetadataSchema = z.object({
|
|
|
55
55
|
kind: z.literal("agent_dispatch")
|
|
56
56
|
}).strict();
|
|
57
57
|
const AGENT_DISPATCH_MAX_AGE_MS = 864e5;
|
|
58
|
+
/** Return whether a dispatch is a Scheduled or Event automation run. */
|
|
59
|
+
function isAutomationRun(dispatch) {
|
|
60
|
+
return dispatch.source.kind === "scheduled_automation" || dispatch.source.kind === "event_automation";
|
|
61
|
+
}
|
|
58
62
|
/** Restore the exact actor, credential, and dispatch routing for every slice. */
|
|
59
63
|
function buildDispatchRoutingContext(dispatch) {
|
|
60
64
|
return {
|
|
@@ -68,7 +72,7 @@ function buildDispatchRoutingContext(dispatch) {
|
|
|
68
72
|
replyAttribution: dispatch.replyAttribution,
|
|
69
73
|
outcomes: dispatch.outcomes,
|
|
70
74
|
...dispatch.skill ? { skill: dispatch.skill } : void 0,
|
|
71
|
-
...dispatch
|
|
75
|
+
...isAutomationRun(dispatch) ? { declaresResult: true } : void 0
|
|
72
76
|
},
|
|
73
77
|
surface: "api"
|
|
74
78
|
};
|
|
@@ -102,6 +106,7 @@ async function enqueueAgentDispatch(dispatch, options) {
|
|
|
102
106
|
activityAtMs: claimedDispatch.createdAtMs,
|
|
103
107
|
conversationId: getDispatchConversationId(claimedDispatch),
|
|
104
108
|
destination: claimedDispatch.destination,
|
|
109
|
+
kind: isAutomationRun(claimedDispatch) ? "automation" : "root",
|
|
105
110
|
nowMs,
|
|
106
111
|
source: "plugin",
|
|
107
112
|
sessionSource: claimedDispatch.source,
|
|
@@ -1164,7 +1169,6 @@ async function summarizeImageWithVision(args) {
|
|
|
1164
1169
|
if (!visionModelId) return;
|
|
1165
1170
|
return (await args.completeText({
|
|
1166
1171
|
modelId: visionModelId,
|
|
1167
|
-
temperature: 0,
|
|
1168
1172
|
maxTokens: args.maxTokens,
|
|
1169
1173
|
operation: "vision_summary",
|
|
1170
1174
|
cost: args.cost,
|
|
@@ -7154,7 +7158,7 @@ const conversationCursorPayloadSchema = z.object({
|
|
|
7154
7158
|
version: z.literal(1)
|
|
7155
7159
|
}).strict();
|
|
7156
7160
|
function cursorSecret() {
|
|
7157
|
-
const secret =
|
|
7161
|
+
const secret = readJuniorSecret();
|
|
7158
7162
|
if (!secret) throw new Error("Cannot sign conversation cursor without JUNIOR_SECRET");
|
|
7159
7163
|
return secret;
|
|
7160
7164
|
}
|
|
@@ -9226,7 +9230,26 @@ async function readConversationDetail(conversationId, options = {}) {
|
|
|
9226
9230
|
async function pinConversation(viewer, conversationId, body) {
|
|
9227
9231
|
if (!(await readConversationAccessFromSql(getDb(), [conversationId], viewer)).get(conversationId)?.isParticipant) throwApiError(404, "Conversation not found.");
|
|
9228
9232
|
const executor = getSqlExecutor();
|
|
9229
|
-
return await executor.transaction(() =>
|
|
9233
|
+
return await executor.transaction(async () => {
|
|
9234
|
+
const db = executor.db();
|
|
9235
|
+
const result = await setPin(db, viewer, conversationId, body.pinned);
|
|
9236
|
+
recordPinUsage(body.pinned ? "pin" : "unpin", await countViewerPins(db, viewer));
|
|
9237
|
+
return result;
|
|
9238
|
+
});
|
|
9239
|
+
}
|
|
9240
|
+
/**
|
|
9241
|
+
* Tag the request span with a pin change and the viewer's pin count after
|
|
9242
|
+
* it. Pins stay manual; this shows how much people use them.
|
|
9243
|
+
*/
|
|
9244
|
+
function recordPinUsage(action, pinnedCount) {
|
|
9245
|
+
setSpanAttributes({
|
|
9246
|
+
"app.conversation.pin.action": action,
|
|
9247
|
+
"app.conversation.pin.count": pinnedCount
|
|
9248
|
+
});
|
|
9249
|
+
}
|
|
9250
|
+
async function countViewerPins(db, viewer) {
|
|
9251
|
+
const [row] = await db.select({ pins: count() }).from(juniorConversationParticipants).where(and(eq(juniorConversationParticipants.userId, viewer.id), isNotNull(juniorConversationParticipants.pinnedAt)));
|
|
9252
|
+
return row?.pins ?? 0;
|
|
9230
9253
|
}
|
|
9231
9254
|
async function setPin(db, viewer, conversationId, pinned) {
|
|
9232
9255
|
const [conversation] = await db.select({
|
|
@@ -9237,7 +9260,7 @@ async function setPin(db, viewer, conversationId, pinned) {
|
|
|
9237
9260
|
rootConversationId: juniorConversations.rootConversationId
|
|
9238
9261
|
}).from(juniorConversations).where(eq(juniorConversations.conversationId, conversationId)).limit(1).for("no key update");
|
|
9239
9262
|
if (!conversation) throwApiError(404, "Conversation not found.");
|
|
9240
|
-
if (conversationKindFromRow(conversation)
|
|
9263
|
+
if (!isTopLevelKind(conversationKindFromRow(conversation))) throwApiError(409, `A child conversation cannot be pinned or unpinned. It uses its root's pin: ${conversation.rootConversationId ?? conversation.parentConversationId}.`);
|
|
9241
9264
|
if (!pinned) {
|
|
9242
9265
|
await db.update(juniorConversationParticipants).set({
|
|
9243
9266
|
pinnedAt: null,
|
|
@@ -9272,6 +9295,7 @@ async function reorderPinnedConversations(viewer, body) {
|
|
|
9272
9295
|
const participants = juniorConversationParticipants;
|
|
9273
9296
|
const positions = sql.join(ids.map((id, index) => sql`when ${id} then ${index}::integer`), sql` `);
|
|
9274
9297
|
const updated = await getDb().update(participants).set({ pinPosition: sql`case ${participants.rootConversationId} ${positions} else ${participants.pinPosition} + ${ids.length}::integer end` }).where(and(eq(participants.userId, viewer.id), isNotNull(participants.pinnedAt))).returning({ rootConversationId: participants.rootConversationId });
|
|
9298
|
+
recordPinUsage("reorder", updated.length);
|
|
9275
9299
|
const updatedIds = new Set(updated.map((row) => row.rootConversationId));
|
|
9276
9300
|
return { conversationIds: ids.filter((id) => updatedIds.has(id)) };
|
|
9277
9301
|
}
|
|
@@ -9411,6 +9435,29 @@ async function readConversationActivityPreviews(db, conversationIds) {
|
|
|
9411
9435
|
}
|
|
9412
9436
|
return previews;
|
|
9413
9437
|
}
|
|
9438
|
+
// src/api/conversations/feed-brief.ts
|
|
9439
|
+
/**
|
|
9440
|
+
* Read the latest Brief version of each Conversation on a feed page, in one
|
|
9441
|
+
* query. A lateral limit reads one row per Conversation from the
|
|
9442
|
+
* (conversation, version) key, so long Brief histories do not slow the feed.
|
|
9443
|
+
* Callers show the result only when the viewer can see private content.
|
|
9444
|
+
*/
|
|
9445
|
+
async function readConversationFeedBriefs(db, conversationIds) {
|
|
9446
|
+
if (conversationIds.length === 0) return /* @__PURE__ */ new Map();
|
|
9447
|
+
const content = juniorConversationBriefs.content;
|
|
9448
|
+
const latest = db.select({
|
|
9449
|
+
intent: sql`${content}->>'intent'`.as("intent"),
|
|
9450
|
+
status: sql`${content}->'outcome'->>'status'`.as("status"),
|
|
9451
|
+
summary: sql`${content}->>'summary'`.as("summary")
|
|
9452
|
+
}).from(juniorConversationBriefs).where(eq(juniorConversationBriefs.conversationId, juniorConversations.conversationId)).orderBy(desc(juniorConversationBriefs.version)).limit(1).as("latest_brief");
|
|
9453
|
+
const rows = await db.select({
|
|
9454
|
+
conversationId: juniorConversations.conversationId,
|
|
9455
|
+
intent: latest.intent,
|
|
9456
|
+
status: latest.status,
|
|
9457
|
+
summary: latest.summary
|
|
9458
|
+
}).from(juniorConversations).innerJoinLateral(latest, sql`true`).where(inArray(juniorConversations.conversationId, conversationIds));
|
|
9459
|
+
return new Map(rows.map(({ conversationId, ...brief }) => [conversationId, conversationFeedBriefSchema.parse(brief)]));
|
|
9460
|
+
}
|
|
9414
9461
|
// src/api/conversations/list.ts
|
|
9415
9462
|
const CONVERSATION_FEED_LIMIT = 50;
|
|
9416
9463
|
function feedMember(filter) {
|
|
@@ -9440,6 +9487,7 @@ function conversationCodeRepositoryFilter(repositoryId, viewerUserId) {
|
|
|
9440
9487
|
async function conversationRows(db, { codeRepository, conversationIds, filter, includePrivateBriefs = false, limit, query, status }) {
|
|
9441
9488
|
return db.select({
|
|
9442
9489
|
...conversationRecordColumns,
|
|
9490
|
+
lastMessageAt: sql`coalesce(${juniorConversations.lastMessageAt}, ${lastMessageAtSql(db)})`.mapWith(juniorConversations.lastMessageAt),
|
|
9443
9491
|
awaitingAuthorization: treeAwaitsAuthorization(juniorConversations.conversationId)
|
|
9444
9492
|
}).from(juniorConversations).leftJoin(juniorDestinations, conversationRecordJoins.location).leftJoin(juniorIdentities, conversationRecordJoins.identity).leftJoin(juniorUsers, conversationRecordJoins.user).where(and(listedConversation(), conversationFeedMembershipFilter(status, filter), conversationIds ? inArray(juniorConversations.conversationId, conversationIds) : void 0, codeRepository ? conversationCodeRepositoryFilter(codeRepository.id, codeRepository.viewerUserId) : void 0, query ? or(sql`strpos(lower(coalesce(${juniorConversations.title}, '')), ${query}) > 0`, sql`exists (
|
|
9445
9493
|
select 1
|
|
@@ -9457,7 +9505,7 @@ async function conversationRows(db, { codeRepository, conversationIds, filter, i
|
|
|
9457
9505
|
}
|
|
9458
9506
|
/**
|
|
9459
9507
|
* Read the viewer's active conversations that wait on them but fall outside
|
|
9460
|
-
* the newest page. Needs
|
|
9508
|
+
* the newest page. Needs you shows every conversation that waits on the
|
|
9461
9509
|
* viewer, so an old one must come back to the feed.
|
|
9462
9510
|
*/
|
|
9463
9511
|
async function waitingRowsOutsidePage(db, filter, page) {
|
|
@@ -9588,7 +9636,7 @@ async function readConversationFeedFromSql(options = {}) {
|
|
|
9588
9636
|
if (filter?.kind === "viewer" && status === "active") rows.push(...await waitingRowsOutsidePage(db, filter, rows));
|
|
9589
9637
|
const conversations = rows.map((row) => conversationFromRecordRow(row));
|
|
9590
9638
|
const conversationIds = conversations.map((conversation) => conversation.conversationId);
|
|
9591
|
-
const [accessByConversation, viewerMarksByConversation, annotationsByConversation, auxiliaryCostsByRoot, metricsByRoot, participantsByConversation, teamDomainByTeamId, { work: conversationWork, lastUserMessageAt: lastUserMessageAtByConversation }, activityPreviewByConversation, automationTitleByConversation, firstHumanMessageTextByConversation, unreadConversationIds] = await Promise.all([
|
|
9639
|
+
const [accessByConversation, viewerMarksByConversation, annotationsByConversation, auxiliaryCostsByRoot, metricsByRoot, participantsByConversation, teamDomainByTeamId, { work: conversationWork, lastUserMessageAt: lastUserMessageAtByConversation }, activityPreviewByConversation, briefByConversation, automationTitleByConversation, firstHumanMessageTextByConversation, unreadConversationIds] = await Promise.all([
|
|
9592
9640
|
readConversationAccessFromSql(db, conversationIds, options.viewer),
|
|
9593
9641
|
conversationViewerMarks(db, conversationIds, filter ? feedMember(filter) : void 0),
|
|
9594
9642
|
listConversationAnnotationsById(db, conversationIds),
|
|
@@ -9601,6 +9649,7 @@ async function readConversationFeedFromSql(options = {}) {
|
|
|
9601
9649
|
lastUserMessageAt: await readLastUserMessageAtByConversation(db, work.assignedIds.filter((conversationId) => work.finishedAtById[conversationId]))
|
|
9602
9650
|
})),
|
|
9603
9651
|
readConversationActivityPreviews(db, conversationIds),
|
|
9652
|
+
readConversationFeedBriefs(db, conversationIds),
|
|
9604
9653
|
readAutomationTitlesByConversationId(conversations),
|
|
9605
9654
|
readFirstHumanMessageTexts(db, conversations),
|
|
9606
9655
|
filter?.kind === "viewer" ? readUnreadConversationIds(db, conversationIds, filter.userId) : /* @__PURE__ */ new Set()
|
|
@@ -9641,15 +9690,19 @@ async function readConversationFeedFromSql(options = {}) {
|
|
|
9641
9690
|
};
|
|
9642
9691
|
const annotations = access?.canViewPrivateContent ? annotationsByConversation.get(conversation.conversationId) ?? [] : [];
|
|
9643
9692
|
const activityPreview = visibleActivityPreviews.get(conversation.conversationId);
|
|
9693
|
+
const brief = access?.canViewPrivateContent ? briefByConversation.get(conversation.conversationId) : void 0;
|
|
9644
9694
|
const participants = access?.canViewPrivateContent ? participantsByConversation.get(conversation.conversationId) : void 0;
|
|
9645
9695
|
const threads = threadsByRoot.get(conversation.conversationId);
|
|
9696
|
+
const lastMessageAt = row.lastMessageAt?.toISOString();
|
|
9646
9697
|
return {
|
|
9647
9698
|
...summary,
|
|
9648
9699
|
...work,
|
|
9649
9700
|
...row.awaitingAuthorization ? { awaitingAuthorization: true } : void 0,
|
|
9701
|
+
...lastMessageAt ? { lastMessageAt } : void 0,
|
|
9650
9702
|
...threads ? { threads } : void 0,
|
|
9651
9703
|
...participants && participants.length > 0 ? { participants } : void 0,
|
|
9652
9704
|
...activityPreview ? { activityPreview } : void 0,
|
|
9705
|
+
...brief ? { brief } : void 0,
|
|
9653
9706
|
...annotations.length > 0 ? { annotations } : void 0,
|
|
9654
9707
|
...sidebarAnnotationsByConversation[conversation.conversationId] ? { sidebarAnnotations: sidebarAnnotationsByConversation[conversation.conversationId] } : void 0,
|
|
9655
9708
|
isPriority: isConversationPriority({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Bt as requestConversationWork$1, Ct as deadLetterAttempt$1, Et as getConversationWorkState$1, Ft as recordAttemptFailure$1, Ht as steerWebPendingMessages$1, It as recordConversationRetry$1, Lt as releaseConversationWork$1, Mt as markConversationWorkEnqueued$1, Ot as hasRunnableConversationWork, Rt as releaseInboundMessage, Tt as getConversation$1, Ut as stopConversationWork$1, Vt as startConversationWork$1, _t as claimInboundMessage$1, bt as completeConversationStop$1, dt as ackMessages$1, ft as appendExclusiveInboundMessage, gt as checkInConversationWork$1, ht as cancelHumanFacingPendingMessages$1, jt as listActiveConversationIds$1, mt as beginConversationResume$1, pt as appendInboundMessage, vt as clearConsumedConversationWake$1, wt as drainConversationMailbox$1, xt as completeConversationWork$1, yt as clearExpiredConversationLease$1, zt as requestAnotherSlice$1 } from "./projection-
|
|
2
|
-
import { a as getConversationStore } from "./db-
|
|
3
|
-
import "./background-compaction-queue-
|
|
1
|
+
import { Bt as requestConversationWork$1, Ct as deadLetterAttempt$1, Et as getConversationWorkState$1, Ft as recordAttemptFailure$1, Ht as steerWebPendingMessages$1, It as recordConversationRetry$1, Lt as releaseConversationWork$1, Mt as markConversationWorkEnqueued$1, Ot as hasRunnableConversationWork, Rt as releaseInboundMessage, Tt as getConversation$1, Ut as stopConversationWork$1, Vt as startConversationWork$1, _t as claimInboundMessage$1, bt as completeConversationStop$1, dt as ackMessages$1, ft as appendExclusiveInboundMessage, gt as checkInConversationWork$1, ht as cancelHumanFacingPendingMessages$1, jt as listActiveConversationIds$1, mt as beginConversationResume$1, pt as appendInboundMessage, vt as clearConsumedConversationWake$1, wt as drainConversationMailbox$1, xt as completeConversationWork$1, yt as clearExpiredConversationLease$1, zt as requestAnotherSlice$1 } from "./projection-BzJQncZV.js";
|
|
2
|
+
import { a as getConversationStore } from "./db-Dts2XvLu.js";
|
|
3
|
+
import "./background-compaction-queue-DUkHZjmL.js";
|
|
4
4
|
// src/chat/task-execution/store.ts
|
|
5
5
|
function metadataStore(options) {
|
|
6
6
|
return options.conversationStore ?? getConversationStore();
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import {
|
|
3
|
-
import { n as botConfig } from "./config-
|
|
4
|
-
import { E as withSpan, G as isRecord$1, K as toOptionalNumber, _ as runBestEffort, h as logWarn, q as toOptionalString } from "./logging-
|
|
2
|
+
import { Bn as getPlugins, Fo as createDurableLocationConfigurationService, Ia as createPluginEmbedder, Ki as openSlackDirectMessage, La as createPluginModel, Li as escapeSlackMrkdwnText, Po as createPluginCache, Ri as formatSlackLink, Un as coreTaskRegistrations, Xa as createPluginLogger, Ya as createPluginModelCostRecorder, Yi as postSlackMessage, an as instructionTextForProjection, b as persistConversationMessages, di as createPluginState, dn as normalizeToolNameFromResult, en as getPiMessageRole, ln as isToolResultError, ni as JUNIOR_THREAD_STATE_TTL_MS, ot as getTurnRecord, pn as stripRuntimeTurnContext, si as getDashboardTaskLink, so as createPluginConversationEvents, ui as ToolInputError, un as isToolResultMessage, v as hydrateConversationMessages, w as fallbackShortTitle } from "./projection-BzJQncZV.js";
|
|
3
|
+
import { n as botConfig } from "./config-DvnTPCfp.js";
|
|
4
|
+
import { E as withSpan, G as isRecord$1, K as toOptionalNumber, _ as runBestEffort, h as logWarn, q as toOptionalString } from "./logging-9OAq-fdg.js";
|
|
5
5
|
import { h as parseSlackMessageTs } from "./actor-6jsm_v96.js";
|
|
6
|
-
import {
|
|
7
|
-
import { A as juniorConversations, d as juniorAutomationVersions, f as juniorAutomations, u as juniorAutomationRuns } from "./executor-
|
|
6
|
+
import { J as agentTurnCostUsd, Y as agentTurnTotalTokens, a as getConversationStore, o as getDb } from "./db-Dts2XvLu.js";
|
|
7
|
+
import { A as juniorConversations, d as juniorAutomationVersions, f as juniorAutomations, u as juniorAutomationRuns } from "./executor-Ck73J0wP.js";
|
|
8
8
|
import { v as sameActorIdentity } from "./media-BepyEUNm.js";
|
|
9
|
-
import { h as credentialSubjectSchema } from "./registry-
|
|
10
|
-
import { i as readActorIdentity } from "./viewer-
|
|
11
|
-
import {
|
|
12
|
-
import { c as pluginTaskParamsSchema, d as sendVercelPluginTask, s as pluginTaskId } from "./background-compaction-queue-
|
|
13
|
-
import { B as automationTaskColumns, H as automationTaskSchema, M as scheduledAutomationSchema, S as automationVersionSchema, V as automationTaskDescription, k as eventAutomationSchema, z as automationSkillNameSchema } from "./automation-
|
|
9
|
+
import { h as credentialSubjectSchema } from "./registry-cbpOxO4M.js";
|
|
10
|
+
import { i as readActorIdentity } from "./viewer-Bqkb678l.js";
|
|
11
|
+
import { a as getStateAdapter } from "./state-CO9ETDzk.js";
|
|
12
|
+
import { c as pluginTaskParamsSchema, d as sendVercelPluginTask, s as pluginTaskId } from "./background-compaction-queue-DUkHZjmL.js";
|
|
13
|
+
import { B as automationTaskColumns, H as automationTaskSchema, M as scheduledAutomationSchema, S as automationVersionSchema, V as automationTaskDescription, k as eventAutomationSchema, z as automationSkillNameSchema } from "./automation-yJX3C7i3.js";
|
|
14
14
|
import { createHash } from "node:crypto";
|
|
15
15
|
import * as z from "zod";
|
|
16
16
|
import { and, asc, count, desc, eq, gte, inArray, isNotNull, isNull, lte, max, ne, or, sql } from "drizzle-orm";
|
|
@@ -349,7 +349,7 @@ function slackSourceForDestination(args) {
|
|
|
349
349
|
* Reads parent Conversations when this Conversation has no Destination.
|
|
350
350
|
*/
|
|
351
351
|
async function resolveConversationRouting(args) {
|
|
352
|
-
const conversationStore = args.conversationStore ?? (await import("./db-
|
|
352
|
+
const conversationStore = args.conversationStore ?? (await import("./db-Dts2XvLu.js").then((n) => n.n)).getConversationStore();
|
|
353
353
|
const chain = await loadConversationChain(args.conversationId, conversationStore);
|
|
354
354
|
let destination;
|
|
355
355
|
let source;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { H as
|
|
3
|
-
import { G as isRecord, b as setSpanAttributes, t as buildTurnFailureResponse } from "./logging-
|
|
1
|
+
import { E as buildConversationContext, Eo as listConversationAnnotations, X as clearPendingAuth, j as markConversationMessage, v as hydrateConversationMessages } from "./projection-BzJQncZV.js";
|
|
2
|
+
import { H as findProviderError, U as getProviderErrorAttributes, W as getProviderErrorUserMessage, g as TURN_REASONING_LEVELS, z as ProviderError } from "./config-DvnTPCfp.js";
|
|
3
|
+
import { G as isRecord, b as setSpanAttributes, t as buildTurnFailureResponse } from "./logging-9OAq-fdg.js";
|
|
4
4
|
import { h as parseSlackMessageTs } from "./actor-6jsm_v96.js";
|
|
5
|
-
import { o as getDb, r as getConversationEventStore, s as getSqlExecutor } from "./db-
|
|
6
|
-
import { g as juniorAgentInvocations } from "./executor-
|
|
7
|
-
import { p as credentialContextSchema } from "./registry-
|
|
8
|
-
import {
|
|
5
|
+
import { o as getDb, r as getConversationEventStore, s as getSqlExecutor } from "./db-Dts2XvLu.js";
|
|
6
|
+
import { g as juniorAgentInvocations } from "./executor-Ck73J0wP.js";
|
|
7
|
+
import { p as credentialContextSchema } from "./registry-cbpOxO4M.js";
|
|
8
|
+
import { L as readMessageCardRefs, R as removedCardSchema, z as resolveMessageCards } from "./conversation-CMkSmi02.js";
|
|
9
9
|
import { C as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, S as AGENT_INVOCATION_MAILBOX_STATUSES } from "./reporting-window-B3Ze-Qnt.js";
|
|
10
|
-
import { gt as coerceThreadConversationState, ht as persistThreadStateById, pt as getPersistedThreadState } from "./task-runner-
|
|
10
|
+
import { gt as coerceThreadConversationState, ht as persistThreadStateById, pt as getPersistedThreadState } from "./task-runner-CKOj6xla.js";
|
|
11
11
|
import { createHash } from "node:crypto";
|
|
12
12
|
import * as z from "zod";
|
|
13
13
|
import { and, asc, desc, eq, inArray, or, sql } from "drizzle-orm";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
2
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-DgouZKZm.js";
|
|
3
3
|
import { isDeepStrictEqual } from "node:util";
|
|
4
4
|
// src/chat/plugins/validation.ts
|
|
5
5
|
var validation_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.
|
|
2
|
+
var version = "0.295.0";
|
|
3
3
|
// src/version.ts
|
|
4
4
|
/** Installed Junior package version, or `unknown` when package metadata is unavailable. */
|
|
5
5
|
const JUNIOR_VERSION = typeof version === "string" && version.trim() ? version : "unknown";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as JUNIOR_VERSION } from "./version-
|
|
1
|
+
export { t as JUNIOR_VERSION } from "./version-AQa7Fr2H.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { H as GOOGLE_IDENTITY_PROVIDER, W as normalizeIdentityEmail, h as logWarn } from "./logging-
|
|
2
|
-
import {
|
|
3
|
-
import { M as juniorUsers, j as juniorIdentities } from "./executor-
|
|
1
|
+
import { H as GOOGLE_IDENTITY_PROVIDER, W as normalizeIdentityEmail, h as logWarn } from "./logging-9OAq-fdg.js";
|
|
2
|
+
import { N as findActorIdentityId, o as getDb } from "./db-Dts2XvLu.js";
|
|
3
|
+
import { M as juniorUsers, j as juniorIdentities } from "./executor-Ck73J0wP.js";
|
|
4
4
|
import { r as detectImageMediaType } from "./media-BepyEUNm.js";
|
|
5
5
|
import { a as withLock } from "./locks-D-0h111u.js";
|
|
6
6
|
import { createHash, randomUUID } from "node:crypto";
|