@sentry/junior 0.276.0 → 0.277.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-DoPR2jS-.js → adapter-BtfBHVM5.js} +1 -1
- package/dist/{admin-BJTT-kXb.js → admin-DzAKbZsm.js} +1 -1
- package/dist/{agent-invocations-CUWrrzkc.js → agent-invocations-Crs3XHhg.js} +5 -1
- package/dist/{agent-runner-sMpA5qGM.js → agent-runner-BsYAbniN.js} +151 -65
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +4 -4
- package/dist/api.d.ts +13 -2
- package/dist/api.js +137 -28
- package/dist/{app-DTj-yAQt.d.ts → app-BjEQwNVP.d.ts} +3 -3
- package/dist/app.d.ts +2 -2
- package/dist/app.js +65 -56
- package/dist/{assistant-reply-DbxKnBQF.js → assistant-reply-NebRGG4G.js} +1 -1
- package/dist/{automation-B8_mC68r.js → automation-Cql9h2vO.js} +1 -1
- package/dist/{background-compaction-queue-Bywqo1WJ.js → background-compaction-queue-hh18yCeU.js} +2 -2
- package/dist/{briefs-IL7QnCCR.js → briefs-BBo0Eimi.js} +4 -4
- package/dist/{catalog-runtime--sC2CYLQ.js → catalog-runtime-DE-F4Awo.js} +1 -1
- package/dist/cli/chat.d.ts +1 -1
- package/dist/cli/chat.js +14 -14
- package/dist/cli/check.js +3 -3
- 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 +3 -3
- package/dist/{client-7diKvInp.js → client-DZ8HTnYH.js} +2 -2
- package/dist/{config-Cb--cuv-.js → config-D5uUtrCP.js} +2 -2
- package/dist/{connections-C4-4fxaE.js → connections-Do24CGP5.js} +10 -10
- package/dist/{conversation-DppJ83Hw.js → conversation-SsASlWL7.js} +4 -6
- package/dist/{conversation-privacy-DTwdT3Pi.js → conversation-privacy-VuylvlKr.js} +1 -1
- package/dist/{credential-sync-Sl5RQCkS.js → credential-sync-BGQK3pOa.js} +13 -13
- package/dist/{db-Ck6TXQIx.d.ts → db-DEiwO5Sh.d.ts} +1 -1
- package/dist/{executor-BFKmqxYe.js → executor-hPfFTH0C.js} +13 -5
- package/dist/instrumentation.js +2 -2
- package/dist/{logging-B04X_eCB.js → logging-cI3T1dNc.js} +4 -2
- package/dist/{message-DQMFyyE-.js → message-DBwsAl7O.js} +9 -9
- package/dist/nitro.d.ts +2 -2
- package/dist/nitro.js +7 -3
- package/dist/{oauth-callback-server-BGq0_vQI.js → oauth-callback-server-DXrnbplb.js} +2 -2
- package/dist/{plugins-B_0Cr0MO.d.ts → plugins-DtmjkTza.d.ts} +1 -0
- package/dist/{projection-6dXaN0n-.js → projection-7EFIqzuj.js} +4476 -4348
- package/dist/{prompt-B4fQKGZR.js → prompt-oRfGsxd3.js} +1 -1
- package/dist/{registry-CEqKR_ld.js → registry-Bzefs7kT.js} +24 -8
- package/dist/{resolve-8I5DkrfI.js → resolve-CuiEY_2u.js} +3 -3
- package/dist/{result-BgAW90IM.js → result-DrcUtFaD.js} +9 -9
- package/dist/{runner-CSKDr_19.js → runner-CDE4CZ52.js} +11 -11
- package/dist/{sandbox-egress-signals-BxAT276e.js → sandbox-egress-signals-0tcmGd13.js} +1 -1
- package/dist/{schema-CaUWl2EV.d.ts → schema-B6N2nc6v.d.ts} +35 -10
- package/dist/{schema-Cal-EFdi.js → schema-Dzi3lkdP.js} +19 -4
- package/dist/{service-account-CtOab1Xz.js → service-account-BOz9pqOE.js} +3 -3
- package/dist/{service-account-CUuVJCKT.js → service-account-DIyz_9Uh.js} +3 -3
- package/dist/{session-stop-DK8LuPZW.js → session-stop-0juF_BP0.js} +17 -14
- package/dist/{skills-Bc0D7BGy.js → skills-CU5Is147.js} +2 -2
- package/dist/{spawn-DF_GUcd8.js → spawn-6C9jHH4b.js} +2 -2
- package/dist/{stop-DthSy-z8.js → stop-6FVG1c-r.js} +388 -153
- package/dist/{store-BgH2P3X9.js → store-DKs1WwdB.js} +3 -3
- package/dist/{store-C5uVTx2G.js → store-DtHZviJ1.js} +4 -4
- package/dist/{task-queue-C6ROM_XJ.js → task-queue-CcvFQE_p.js} +3 -3
- package/dist/{task-runner-BwAkjjVE.js → task-runner-DBkNejLl.js} +6 -6
- package/dist/{thread-state-BXjgk1pW.js → thread-state-4hjEIkIq.js} +4 -4
- package/dist/{turn-failure-response-CVI57qKL.js → turn-failure-response-BZNLydC3.js} +7 -7
- package/dist/{turn-lifecycle-CF6ibonp.js → turn-lifecycle-BhqYjaa4.js} +1 -1
- package/dist/{turn-session-routing-DddybdNu.js → turn-session-routing-jnLOfBHJ.js} +10 -10
- package/dist/{validation-BxF1nQbC.js → validation-BUFmsnKs.js} +1 -1
- package/dist/{version-CTzSbCmR.js → version-DJTk0ZCE.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-CQwBszc7.js → viewer-WY0RYE4E.js} +47 -12
- package/dist/{work-BHlShEQ6.js → work-C5AKvXJV.js} +10 -10
- package/dist/{worker-DhY9MnsH.js → worker-BcYVDVUy.js} +6 -6
- package/migrations/0074_conversation_participant_pins.sql +1 -0
- package/migrations/0075_conversation_detail_version.sql +1 -0
- package/migrations/0076_conversation_auto_archive.sql +5 -0
- package/migrations/meta/0074_snapshot.json +4076 -0
- package/migrations/meta/0075_snapshot.json +4299 -0
- package/migrations/meta/0076_snapshot.json +4363 -0
- package/migrations/meta/_journal.json +22 -1
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { At as recordConversationRetry$1, Dt as listActiveConversationIds$1, Ft as startConversationWork$1, It as steerWebPendingMessages$1, Lt as stopConversationWork$1, Mt as removeActiveConversation$1, Nt as requestAnotherSlice$1, Ot as markConversationWorkEnqueued$1, Pt as requestConversationWork$1, St as getConversationWorkState$1, _t as completeConversationStop$1, bt as drainConversationMailbox$1, dt as appendInboundMessage, ft as beginConversationResume$1, gt as clearExpiredConversationLease$1, ht as clearConsumedConversationWake$1, jt as releaseConversationWork$1, kt as recordAttemptFailure$1, lt as ackMessages$1, mt as checkInConversationWork$1, pt as cancelHumanFacingPendingMessages$1, ut as appendExclusiveInboundMessage, vt as completeConversationWork$1, xt as getConversation$1, yt as deadLetterAttempt$1 } from "./projection-
|
|
2
|
-
import { x as getConversationStore } from "./viewer-
|
|
3
|
-
import "./background-compaction-queue-
|
|
1
|
+
import { At as recordConversationRetry$1, Dt as listActiveConversationIds$1, Ft as startConversationWork$1, It as steerWebPendingMessages$1, Lt as stopConversationWork$1, Mt as removeActiveConversation$1, Nt as requestAnotherSlice$1, Ot as markConversationWorkEnqueued$1, Pt as requestConversationWork$1, St as getConversationWorkState$1, _t as completeConversationStop$1, bt as drainConversationMailbox$1, dt as appendInboundMessage, ft as beginConversationResume$1, gt as clearExpiredConversationLease$1, ht as clearConsumedConversationWake$1, jt as releaseConversationWork$1, kt as recordAttemptFailure$1, lt as ackMessages$1, mt as checkInConversationWork$1, pt as cancelHumanFacingPendingMessages$1, ut as appendExclusiveInboundMessage, vt as completeConversationWork$1, xt as getConversation$1, yt as deadLetterAttempt$1 } from "./projection-7EFIqzuj.js";
|
|
2
|
+
import { x as getConversationStore } from "./viewer-WY0RYE4E.js";
|
|
3
|
+
import "./background-compaction-queue-hh18yCeU.js";
|
|
4
4
|
// src/chat/task-execution/store.ts
|
|
5
5
|
function metadataStore(options) {
|
|
6
6
|
return options.conversationStore ?? getConversationStore();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { c as modelProfileSchema, u as TURN_REASONING_LEVELS } from "./model-profile-B998sjVd.js";
|
|
2
|
-
import { C as getSqlExecutor, x as getConversationStore } from "./viewer-
|
|
3
|
-
import { a as juniorAgentInvocations, i as juniorAgentBindings, n as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, t as AGENT_INVOCATION_MAILBOX_STATUSES } from "./agent-invocations-
|
|
4
|
-
import "./executor-
|
|
5
|
-
import { p as credentialContextSchema } from "./registry-
|
|
2
|
+
import { C as getSqlExecutor, x as getConversationStore } from "./viewer-WY0RYE4E.js";
|
|
3
|
+
import { a as juniorAgentInvocations, i as juniorAgentBindings, n as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, t as AGENT_INVOCATION_MAILBOX_STATUSES } from "./agent-invocations-Crs3XHhg.js";
|
|
4
|
+
import "./executor-hPfFTH0C.js";
|
|
5
|
+
import { p as credentialContextSchema } from "./registry-Bzefs7kT.js";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { and, asc, count, countDistinct, desc, eq, inArray, lt, ne, or, sql } from "drizzle-orm";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as logWarn } from "./logging-
|
|
2
|
-
import { _ as runWithTurnRequestDeadline, f as QUEUE_SIGNATURE_MAX_AGE_MS, h as getQueueProvider, m as verifyQueueMessage, p as signQueueMessage } from "./background-compaction-queue-
|
|
1
|
+
import { h as logWarn } from "./logging-cI3T1dNc.js";
|
|
2
|
+
import { _ as runWithTurnRequestDeadline, f as QUEUE_SIGNATURE_MAX_AGE_MS, h as getQueueProvider, m as verifyQueueMessage, p as signQueueMessage } from "./background-compaction-queue-hh18yCeU.js";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
// src/chat/queue/callback.ts
|
|
@@ -110,7 +110,7 @@ function pluginTaskCallback() {
|
|
|
110
110
|
maxDeliveries: PLUGIN_TASK_MAX_DELIVERIES,
|
|
111
111
|
onRejected: logPluginTaskQueueMessageRejected,
|
|
112
112
|
run: async (message) => {
|
|
113
|
-
const { processPluginTask } = await import("./task-runner-
|
|
113
|
+
const { processPluginTask } = await import("./task-runner-DBkNejLl.js").then((n) => n.r);
|
|
114
114
|
await processPluginTask(message);
|
|
115
115
|
},
|
|
116
116
|
topic: PLUGIN_TASK_QUEUE_TOPIC,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
-
import { $t as instructionTextForProjection,
|
|
2
|
+
import { $t as instructionTextForProjection, Bn as getPlugins, Jr as createPluginState, Jt as getPiMessageRole, Ma as createPluginLogger, Un as coreTaskRegistrations, Wa as createPluginConversationEvents, an as normalizeToolNameFromResult, co as createPluginCache, in as isToolResultMessage, it as getTurnRecord, rn as isToolResultError, sn as stripRuntimeTurnContext, va as createPluginEmbedder, x as hydrateConversationMessages, ya as createPluginModel } from "./projection-7EFIqzuj.js";
|
|
3
3
|
import { h as parseSlackMessageTs } from "./actor-B4DYygOB.js";
|
|
4
|
-
import { S as getDb, i as readActorIdentity, x as getConversationStore } from "./viewer-
|
|
4
|
+
import { S as getDb, i as readActorIdentity, x as getConversationStore } from "./viewer-WY0RYE4E.js";
|
|
5
5
|
import { _ as sameActorIdentity } from "./media-DstkkoNP.js";
|
|
6
|
-
import { r as getStateAdapter } from "./adapter-
|
|
7
|
-
import { t as resolveConversationRouting, u as getDispatchRecord } from "./turn-session-routing-
|
|
8
|
-
import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-
|
|
9
|
-
import { i as pluginTaskParamsSchema, r as pluginTaskId, s as sendVercelPluginTask } from "./task-queue-
|
|
6
|
+
import { r as getStateAdapter } from "./adapter-BtfBHVM5.js";
|
|
7
|
+
import { t as resolveConversationRouting, u as getDispatchRecord } from "./turn-session-routing-jnLOfBHJ.js";
|
|
8
|
+
import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-4hjEIkIq.js";
|
|
9
|
+
import { i as pluginTaskParamsSchema, r as pluginTaskId, s as sendVercelPluginTask } from "./task-queue-CcvFQE_p.js";
|
|
10
10
|
import { pluginRunContextSchema } from "@sentry/junior-plugin-api";
|
|
11
11
|
// src/chat/plugins/task-runner.ts
|
|
12
12
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as persistConversationMessages,
|
|
2
|
-
import {
|
|
3
|
-
import { S as getDb } from "./viewer-
|
|
4
|
-
import { r as getStateAdapter } from "./adapter-
|
|
1
|
+
import { S as persistConversationMessages, Vr as JUNIOR_THREAD_STATE_TTL_MS, lo as createDurableLocationConfigurationService } from "./projection-7EFIqzuj.js";
|
|
2
|
+
import { G as toOptionalNumber, K as toOptionalString, W as isRecord } from "./logging-cI3T1dNc.js";
|
|
3
|
+
import { S as getDb } from "./viewer-WY0RYE4E.js";
|
|
4
|
+
import { r as getStateAdapter } from "./adapter-BtfBHVM5.js";
|
|
5
5
|
// src/chat/state/conversation.ts
|
|
6
6
|
function defaultConversationState() {
|
|
7
7
|
return {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as findProviderError, h as ProviderError, v as getProviderErrorAttributes, y as getProviderErrorUserMessage } from "./client-
|
|
3
|
-
import {
|
|
1
|
+
import { F as markConversationMessage, Y as clearPendingAuth, pn as buildDeterministicTurnId, ro as listConversationAnnotations, x as hydrateConversationMessages } from "./projection-7EFIqzuj.js";
|
|
2
|
+
import { _ as findProviderError, h as ProviderError, v as getProviderErrorAttributes, y as getProviderErrorUserMessage } from "./client-DZ8HTnYH.js";
|
|
3
|
+
import { W as isRecord, t as buildTurnFailureResponse } from "./logging-cI3T1dNc.js";
|
|
4
4
|
import { h as parseSlackMessageTs } from "./actor-B4DYygOB.js";
|
|
5
|
-
import { S as getDb, y as getConversationEventStore } from "./viewer-
|
|
6
|
-
import {
|
|
7
|
-
import { O as parseAgentInvocationResultMessageId, Q as markTurnCompleted, Z as markTurnClosed, c as getAgentInvocation, m as getAgentInvocationTurnId } from "./store-
|
|
8
|
-
import { a as persistThreadStateById, o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-
|
|
5
|
+
import { S as getDb, y as getConversationEventStore } from "./viewer-WY0RYE4E.js";
|
|
6
|
+
import { B as removedCardSchema, V as resolveMessageCards, z as readMessageCardRefs } from "./conversation-SsASlWL7.js";
|
|
7
|
+
import { O as parseAgentInvocationResultMessageId, Q as markTurnCompleted, Z as markTurnClosed, c as getAgentInvocation, m as getAgentInvocationTurnId } from "./store-DtHZviJ1.js";
|
|
8
|
+
import { a as persistThreadStateById, o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-4hjEIkIq.js";
|
|
9
9
|
// src/chat/conversations/pending-cards.ts
|
|
10
10
|
/**
|
|
11
11
|
* Add the cards that tool results selected since the last visible assistant
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { y as getConversationEventStore } from "./viewer-
|
|
1
|
+
import { y as getConversationEventStore } from "./viewer-WY0RYE4E.js";
|
|
2
2
|
// src/chat/conversations/turn-lifecycle.ts
|
|
3
3
|
/** Persist correlated turn lifecycle facts with retry-safe terminal exclusion. */
|
|
4
4
|
var ConversationTurnLifecycleService = class {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
3
|
-
import { _ as runBestEffort, h as logWarn } from "./logging-
|
|
4
|
-
import {
|
|
5
|
-
import { s as juniorConversations } from "./agent-invocations-
|
|
6
|
-
import { d as juniorAutomations, l as juniorAutomationRuns, u as juniorAutomationVersions } from "./executor-
|
|
7
|
-
import { h as credentialSubjectSchema } from "./registry-
|
|
8
|
-
import { r as getStateAdapter } from "./adapter-
|
|
9
|
-
import { O as eventAutomationSchema, S as automationVersionSchema, j as scheduledAutomationSchema } from "./automation-
|
|
1
|
+
import { D as fallbackShortTitle, Gr as getDashboardTaskLink, Mi as postSlackMessage, Vr as JUNIOR_THREAD_STATE_TTL_MS, bi as escapeSlackMrkdwnText, ki as openSlackDirectMessage, qr as ToolInputError, xi as formatSlackLink } from "./projection-7EFIqzuj.js";
|
|
2
|
+
import { n as botConfig } from "./config-D5uUtrCP.js";
|
|
3
|
+
import { _ as runBestEffort, h as logWarn } from "./logging-cI3T1dNc.js";
|
|
4
|
+
import { J as agentTurnCostUsd, S as getDb, Y as agentTurnTotalTokens } from "./viewer-WY0RYE4E.js";
|
|
5
|
+
import { s as juniorConversations } from "./agent-invocations-Crs3XHhg.js";
|
|
6
|
+
import { d as juniorAutomations, l as juniorAutomationRuns, u as juniorAutomationVersions } from "./executor-hPfFTH0C.js";
|
|
7
|
+
import { h as credentialSubjectSchema } from "./registry-Bzefs7kT.js";
|
|
8
|
+
import { r as getStateAdapter } from "./adapter-BtfBHVM5.js";
|
|
9
|
+
import { O as eventAutomationSchema, S as automationVersionSchema, j as scheduledAutomationSchema } from "./automation-Cql9h2vO.js";
|
|
10
10
|
import { createHash } from "node:crypto";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { and, asc, count, desc, eq, gte, inArray, isNotNull, isNull, lte, max, ne, or, sql } from "drizzle-orm";
|
|
@@ -1584,7 +1584,7 @@ function slackSourceForDestination(args) {
|
|
|
1584
1584
|
* Reads parent Conversations when this Conversation has no Destination.
|
|
1585
1585
|
*/
|
|
1586
1586
|
async function resolveConversationRouting(args) {
|
|
1587
|
-
const conversationStore = args.conversationStore ?? (await import("./viewer-
|
|
1587
|
+
const conversationStore = args.conversationStore ?? (await import("./viewer-WY0RYE4E.js").then((n) => n.v)).getConversationStore();
|
|
1588
1588
|
const chain = await loadConversationChain(args.conversationId, conversationStore);
|
|
1589
1589
|
let destination;
|
|
1590
1590
|
let source;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime
|
|
2
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-DE-F4Awo.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.277.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-DJTk0ZCE.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
-
import { i as getChatConfig } from "./config-
|
|
3
|
-
import {
|
|
2
|
+
import { i as getChatConfig } from "./config-D5uUtrCP.js";
|
|
3
|
+
import { U as normalizeIdentityEmail, V as GOOGLE_IDENTITY_PROVIDER, h as logWarn } from "./logging-cI3T1dNc.js";
|
|
4
4
|
import { a as isSlackUserId, d as parseSlackChannelReferenceId, f as parseSlackTeamId, s as parseActorUserId } from "./actor-B4DYygOB.js";
|
|
5
|
-
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-
|
|
6
|
-
import { S as juniorConversationAnnotations, b as juniorConversationEvents, g as juniorConversationBindings, h as juniorConversationParticipants, t as createJuniorSqlExecutor, v as CONVERSATION_METRICS, y as juniorConversationMetrics } from "./executor-
|
|
5
|
+
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-Crs3XHhg.js";
|
|
6
|
+
import { S as juniorConversationAnnotations, b as juniorConversationEvents, g as juniorConversationBindings, h as juniorConversationParticipants, t as createJuniorSqlExecutor, v as CONVERSATION_METRICS, y as juniorConversationMetrics } from "./executor-hPfFTH0C.js";
|
|
7
7
|
import { d as newConversationEventSchema, f as encodeHistoryPayload, l as decodeStoredConversationEvent, n as detectImageMediaType, o as conversationEventDataSchema, u as historyReplacementSchema, v as usageSchema } from "./media-DstkkoNP.js";
|
|
8
8
|
import { a as withLock } from "./locks-D-0h111u.js";
|
|
9
9
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -167,6 +167,32 @@ function addAgentTurnUsage(...usages) {
|
|
|
167
167
|
};
|
|
168
168
|
return hasAgentTurnUsage(result) ? result : void 0;
|
|
169
169
|
}
|
|
170
|
+
// src/chat/conversations/sql/detail-version.ts
|
|
171
|
+
/** SQL that advances `detail_version` inside a `juniorConversations` set. */
|
|
172
|
+
const nextDetailVersion = sql`${juniorConversations.detailVersion} + 1`;
|
|
173
|
+
function bumpDetailVersion(db, conversationIds) {
|
|
174
|
+
return db.update(juniorConversations).set({ detailVersion: nextDetailVersion }).where(inArray(juniorConversations.conversationId, [...conversationIds]));
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Return a CTE that marks the detail report of each Conversation as changed,
|
|
178
|
+
* in the same statement as the write that it covers:
|
|
179
|
+
* `db.with(conversationDetailTouch(db, ids)).insert(table)`.
|
|
180
|
+
* Postgres runs a data-modifying CTE even when the statement does not read it,
|
|
181
|
+
* and both changes commit together.
|
|
182
|
+
*/
|
|
183
|
+
function conversationDetailTouch(db, conversationIds) {
|
|
184
|
+
return db.$with("conversation_detail_touch").as(bumpDetailVersion(db, conversationIds).returning({ conversationId: juniorConversations.conversationId }));
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Mark the detail report of each Conversation as changed, for a write that
|
|
188
|
+
* cannot carry `conversationDetailTouch`. Call it after that write, in the same
|
|
189
|
+
* transaction when there is one. A bump before the write lets a detail read
|
|
190
|
+
* store old content under the new version.
|
|
191
|
+
*/
|
|
192
|
+
async function touchConversationDetail(db, conversationIds) {
|
|
193
|
+
if (conversationIds.length === 0) return;
|
|
194
|
+
await bumpDetailVersion(db, conversationIds);
|
|
195
|
+
}
|
|
170
196
|
// src/chat/conversations/metrics.ts
|
|
171
197
|
function finite(value) {
|
|
172
198
|
return value !== void 0 && Number.isFinite(value) && value >= 0 ? value : void 0;
|
|
@@ -279,7 +305,8 @@ async function replaceConversationMetrics(executor, args) {
|
|
|
279
305
|
'reasoningTokens', ${metric("reasoning_tokens")},
|
|
280
306
|
'cost', ${cost}
|
|
281
307
|
))
|
|
282
|
-
end
|
|
308
|
+
end`,
|
|
309
|
+
detailVersion: nextDetailVersion
|
|
283
310
|
}).where(eq(juniorConversations.conversationId, args.conversationId));
|
|
284
311
|
}
|
|
285
312
|
// src/chat/source.ts
|
|
@@ -711,7 +738,10 @@ function visibilityFromLocationRow(row) {
|
|
|
711
738
|
/** Store a channel-level Location's first bound post as its thread. */
|
|
712
739
|
async function startLocationThread(executor, binding) {
|
|
713
740
|
const location = juniorConversations.location;
|
|
714
|
-
await executor.db().update(juniorConversations).set({
|
|
741
|
+
await executor.db().update(juniorConversations).set({
|
|
742
|
+
location: sql`${location} || jsonb_build_object('threadTs', ${binding.providerConversationId}::text)`,
|
|
743
|
+
detailVersion: nextDetailVersion
|
|
744
|
+
}).where(and(eq(juniorConversations.conversationId, binding.conversationId), sql`${location}->>'provider' = ${binding.provider}`, sql`${location}->>'teamId' = ${binding.providerTenantId}`, sql`${location}->>'channelId' = ${binding.providerDestinationId}`, isNull(sql`${location}->>'threadTs'`)));
|
|
715
745
|
}
|
|
716
746
|
// src/chat/conversations/sql/store.ts
|
|
717
747
|
const CONVERSATION_MUTATION_LOCK_PREFIX = "junior_conversation";
|
|
@@ -974,7 +1004,8 @@ var SqlStore = class {
|
|
|
974
1004
|
if (incomingIsFresh) await this.executor.db().update(juniorConversations).set({
|
|
975
1005
|
metricRunId: args.execution.runId,
|
|
976
1006
|
executionDurationMs: args.metrics.durationMs,
|
|
977
|
-
executionUsage: args.metrics.usage ?? null
|
|
1007
|
+
executionUsage: args.metrics.usage ?? null,
|
|
1008
|
+
detailVersion: nextDetailVersion
|
|
978
1009
|
}).where(eq(juniorConversations.conversationId, args.conversationId));
|
|
979
1010
|
}
|
|
980
1011
|
});
|
|
@@ -1096,7 +1127,8 @@ var SqlStore = class {
|
|
|
1096
1127
|
runId: sql`case when ${incomingExecutionIsFresh} then excluded.run_id else ${juniorConversations.runId} end`,
|
|
1097
1128
|
lastCheckpointAt: sql`case when ${incomingExecutionIsFresh} then coalesce(excluded.last_checkpoint_at, ${juniorConversations.lastCheckpointAt}) else ${juniorConversations.lastCheckpointAt} end`,
|
|
1098
1129
|
lastEnqueuedAt: sql`case when ${incomingExecutionIsFresh} then coalesce(excluded.last_enqueued_at, ${juniorConversations.lastEnqueuedAt}) else ${juniorConversations.lastEnqueuedAt} end`,
|
|
1099
|
-
rootConversationId: sql`coalesce(${juniorConversations.rootConversationId}, excluded.root_conversation_id)
|
|
1130
|
+
rootConversationId: sql`coalesce(${juniorConversations.rootConversationId}, excluded.root_conversation_id)`,
|
|
1131
|
+
detailVersion: nextDetailVersion
|
|
1100
1132
|
}
|
|
1101
1133
|
}).returning({
|
|
1102
1134
|
actorIdentityId: juniorConversations.actorIdentityId,
|
|
@@ -1177,7 +1209,8 @@ async function ensureConversationRow(executor, conversationId, atMs, options = {
|
|
|
1177
1209
|
set: {
|
|
1178
1210
|
lastActivityAt: sql`greatest(${juniorConversations.lastActivityAt}, excluded.last_activity_at)`,
|
|
1179
1211
|
updatedAt: sql`greatest(${juniorConversations.updatedAt}, excluded.updated_at)`,
|
|
1180
|
-
transcriptPurgedAt: null
|
|
1212
|
+
transcriptPurgedAt: null,
|
|
1213
|
+
detailVersion: nextDetailVersion
|
|
1181
1214
|
}
|
|
1182
1215
|
});
|
|
1183
1216
|
}
|
|
@@ -1413,7 +1446,8 @@ var SqlConversationEventStore = class {
|
|
|
1413
1446
|
});
|
|
1414
1447
|
rows.push(insertFromEvent(conversationId, seq++, historyVersion, event, actorIdentityId));
|
|
1415
1448
|
}
|
|
1416
|
-
|
|
1449
|
+
const db = this.executor.db();
|
|
1450
|
+
await db.with(conversationDetailTouch(db, [conversationId])).insert(juniorConversationEvents).values(rows);
|
|
1417
1451
|
for (const event of pending) if (event.data.type === "turn_started") await this.recordTurnInputParticipants(conversationId, event.data.inputMessageIds);
|
|
1418
1452
|
return rows.map((row) => ({
|
|
1419
1453
|
seq: row.seq,
|
|
@@ -1450,7 +1484,8 @@ var SqlConversationEventStore = class {
|
|
|
1450
1484
|
};
|
|
1451
1485
|
await ensureConversationRow(this.executor, conversationId, Date.now());
|
|
1452
1486
|
const historyVersion = currentHistoryVersion + 1;
|
|
1453
|
-
|
|
1487
|
+
const db = this.executor.db();
|
|
1488
|
+
await db.with(conversationDetailTouch(db, [conversationId])).insert(juniorConversationEvents).values(insertFromEvent(conversationId, cursor.nextSeq, historyVersion, parsed));
|
|
1454
1489
|
return {
|
|
1455
1490
|
status: "replaced",
|
|
1456
1491
|
historyVersion
|
|
@@ -1990,4 +2025,4 @@ async function readIdentityByIdFromSql(db, identityId) {
|
|
|
1990
2025
|
async function readIdentityById(identityId) {
|
|
1991
2026
|
return await readIdentityByIdFromSql(getDb(), identityId);
|
|
1992
2027
|
}
|
|
1993
|
-
export {
|
|
2028
|
+
export { createSlackDestination as $, locationFromRow as A, saveUserTimezone as B, getSqlExecutor as C, loadConversationSlackTenantIds as D, withConversationEventLock as E, deleteProviderIdentityForSlackUser as F, nextDetailVersion as G, bindProviderConversation as H, deleteProviderIdentityForUser as I, agentTurnCostUsd as J, touchConversationDetail as K, findUserByVerifiedEmails as L, SYSTEM_IDENTITY_ID as M, resolveActorIdentityId as N, createSqlStore as O, saveActorAvatar as P, resolveRootConversationId as Q, readUserTimezone as R, getDb as S, eventFromRow as T, parseSessionSource as U, upsertLinkedIdentity as V, conversationDetailTouch as W, agentTurnUsageSchema as X, agentTurnTotalTokens as Y, hasAgentTurnUsage as Z, closeDb as _, readActorIdentityFromSql as a, getConversationMessageSearchStore as b, readViewerAvatarUrl as c, updateViewerDisplayName as d, parseDestination as et, identityAvatarUrl as f, createCache as g, readUserAvatarUrls as h, readActorIdentity as i, startLocationThread as j, withConversationMutationLock as k, resolveViewerUser as l, readAvatarImage as m, findUserByEmailFromSql as n, sameDestination as nt, readIdentityById as o, parseAvatarUrl as p, addAgentTurnUsage as q, listAdminUsersFromSql as r, readIdentityByIdFromSql as s, findUserByEmail as t, requireSlackDestination as tt, setUserAdminFromSql as u, db_exports as v, createSqlConversationEventStore as w, getConversationStore as x, getConversationEventStore as y, recordGoogleSignIn as z };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { G as AuthorizationFlowDisabledError,
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
3
|
-
import { M as SYSTEM_IDENTITY_ID, x as getConversationStore, y as getConversationEventStore } from "./viewer-
|
|
1
|
+
import { G as AuthorizationFlowDisabledError, Ja as loadForkHistory, V as PluginCredentialFailureError, Wt as isTurnExecutionLimitExceededError, Yt as getTerminalAssistantMessages, et as saveTurnCheckpoint, it as getTurnRecord, l as openConversationProjection, rt as failTurnRecord, tt as abandonTurnRecord } from "./projection-7EFIqzuj.js";
|
|
2
|
+
import { n as botConfig } from "./config-D5uUtrCP.js";
|
|
3
|
+
import { M as SYSTEM_IDENTITY_ID, x as getConversationStore, y as getConversationEventStore } from "./viewer-WY0RYE4E.js";
|
|
4
4
|
import { _ as sameActorIdentity, p as agentInstructionProvenance } from "./media-DstkkoNP.js";
|
|
5
|
-
import { At as withoutSavedSteeringMessages, It as readBlockedReport, St as recordSubagentStarted, kt as buildSteeringPiMessage, xt as recordSubagentEnded, yt as stopChildAgentsOf } from "./agent-runner-
|
|
6
|
-
import { B as agentTypeInstructions, C as markAgentInvocationMailboxAppended, D as markAgentInvocationSteered, E as markAgentInvocationRunning, G as TurnInputCommitLostError, T as markAgentInvocationPaused, V as agentTypeStartsWithParentHistory, Y as isTurnInputCommitLostError, _ as getLatestAgentInvocationForConversation, b as listAgentInvocationsForConversation, c as getAgentInvocation, f as getAgentInvocationMessageId, i as createAgentInvocation, k as reportReplacedAgentInvocation, m as getAgentInvocationTurnId, n as NON_TERMINAL_AGENT_INVOCATION_STATUSES, q as getConversationTurnBoundaryError, r as completeAgentInvocation, s as getActiveAgentInvocationForConversation, t as ACTIVE_AGENT_INVOCATION_STATUSES, y as isTerminalAgentInvocation } from "./store-
|
|
7
|
-
import { n as getAssistantReplyText } from "./assistant-reply-
|
|
8
|
-
import { E as maybePostAutomatedTurnLimitNotice, M as recordFinishedTurnForAutomatedLimit, N as resetAutomatedTurnLimit } from "./session-stop-
|
|
9
|
-
import { r as appendAndEnqueueInboundMessage } from "./store-
|
|
10
|
-
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-
|
|
11
|
-
import { a as persistThreadStateById, n as getPersistedSandboxState, r as getPersistedThreadState } from "./thread-state-
|
|
5
|
+
import { At as withoutSavedSteeringMessages, It as readBlockedReport, St as recordSubagentStarted, kt as buildSteeringPiMessage, xt as recordSubagentEnded, yt as stopChildAgentsOf } from "./agent-runner-BsYAbniN.js";
|
|
6
|
+
import { B as agentTypeInstructions, C as markAgentInvocationMailboxAppended, D as markAgentInvocationSteered, E as markAgentInvocationRunning, G as TurnInputCommitLostError, T as markAgentInvocationPaused, V as agentTypeStartsWithParentHistory, Y as isTurnInputCommitLostError, _ as getLatestAgentInvocationForConversation, b as listAgentInvocationsForConversation, c as getAgentInvocation, f as getAgentInvocationMessageId, i as createAgentInvocation, k as reportReplacedAgentInvocation, m as getAgentInvocationTurnId, n as NON_TERMINAL_AGENT_INVOCATION_STATUSES, q as getConversationTurnBoundaryError, r as completeAgentInvocation, s as getActiveAgentInvocationForConversation, t as ACTIVE_AGENT_INVOCATION_STATUSES, y as isTerminalAgentInvocation } from "./store-DtHZviJ1.js";
|
|
7
|
+
import { n as getAssistantReplyText } from "./assistant-reply-NebRGG4G.js";
|
|
8
|
+
import { E as maybePostAutomatedTurnLimitNotice, M as recordFinishedTurnForAutomatedLimit, N as resetAutomatedTurnLimit } from "./session-stop-0juF_BP0.js";
|
|
9
|
+
import { r as appendAndEnqueueInboundMessage } from "./store-DKs1WwdB.js";
|
|
10
|
+
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-BhqYjaa4.js";
|
|
11
|
+
import { a as persistThreadStateById, n as getPersistedSandboxState, r as getPersistedThreadState } from "./thread-state-4hjEIkIq.js";
|
|
12
12
|
import { isDeepStrictEqual } from "node:util";
|
|
13
13
|
import { z } from "zod";
|
|
14
14
|
// src/chat/runtime/turn-execution.ts
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
-
import { Ct as hasConversationStop, Et as isInvalidConversationRecordError, Tt as isFinalAttempt } from "./projection-
|
|
3
|
-
import { b as isProviderRetryError } from "./client-
|
|
4
|
-
import { i as getChatConfig } from "./config-
|
|
5
|
-
import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-
|
|
6
|
-
import { g as getTurnRequestDeadline, v as ConversationQueueMessageRejectedError } from "./background-compaction-queue-
|
|
7
|
-
import { C as requestAnotherSlice, T as startConversationWork, b as recordConversationRetry, d as countPendingConversationMessages, f as deadLetterAttempt, g as getConversationWorkState, i as beginConversationResume, l as completeConversationStop, m as ensureConversationWake, o as checkInConversationWork, p as drainConversationMailbox, s as clearConsumedConversationWake, t as ackMessages, u as completeConversationWork, x as releaseConversationWork, y as recordAttemptFailure } from "./store-
|
|
2
|
+
import { Ct as hasConversationStop, Et as isInvalidConversationRecordError, Tt as isFinalAttempt } from "./projection-7EFIqzuj.js";
|
|
3
|
+
import { b as isProviderRetryError } from "./client-DZ8HTnYH.js";
|
|
4
|
+
import { i as getChatConfig } from "./config-D5uUtrCP.js";
|
|
5
|
+
import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-cI3T1dNc.js";
|
|
6
|
+
import { g as getTurnRequestDeadline, v as ConversationQueueMessageRejectedError } from "./background-compaction-queue-hh18yCeU.js";
|
|
7
|
+
import { C as requestAnotherSlice, T as startConversationWork, b as recordConversationRetry, d as countPendingConversationMessages, f as deadLetterAttempt, g as getConversationWorkState, i as beginConversationResume, l as completeConversationStop, m as ensureConversationWake, o as checkInConversationWork, p as drainConversationMailbox, s as clearConsumedConversationWake, t as ackMessages, u as completeConversationWork, x as releaseConversationWork, y as recordAttemptFailure } from "./store-DKs1WwdB.js";
|
|
8
8
|
// src/chat/task-execution/attempt-selection.ts
|
|
9
9
|
function selectContiguousTurnBatch(messages) {
|
|
10
10
|
const first = messages[0];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "junior_conversation_participants" ADD COLUMN "pinned_at" timestamp with time zone;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "junior_conversations" ADD COLUMN "detail_version" integer DEFAULT 0 NOT NULL;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
ALTER TABLE "junior_conversation_participants" ADD COLUMN "auto_archive" boolean;--> statement-breakpoint
|
|
2
|
+
ALTER TABLE "junior_users" ADD COLUMN "auto_archive_default" boolean DEFAULT false NOT NULL;--> statement-breakpoint
|
|
3
|
+
ALTER TABLE "junior_users" ADD COLUMN "auto_archive_grace_hours" integer DEFAULT 24 NOT NULL;--> statement-breakpoint
|
|
4
|
+
CREATE INDEX "junior_conversation_participants_auto_archive_idx" ON "junior_conversation_participants" USING btree ("user_id") WHERE "junior_conversation_participants"."auto_archive" and "junior_conversation_participants"."archived_at" is null;--> statement-breakpoint
|
|
5
|
+
CREATE INDEX "junior_conversation_participants_unarchived_activity_idx" ON "junior_conversation_participants" USING btree ("user_id","last_message_at","root_conversation_id") WHERE "junior_conversation_participants"."archived_at" is null;
|