@sentry/junior 0.290.0 → 0.292.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/bin/junior.mjs +19 -15
- package/dist/{adapter-CHMVy-j0.js → adapter-Cigb1MTr.js} +1 -1
- package/dist/{admin-C45Ap5Tn.js → admin-BO9V7vnn.js} +2 -2
- package/dist/{agent-runner-CZjf6MOQ.js → agent-runner-BuH7EHrX.js} +35 -28
- package/dist/api/schema.d.ts +1 -1
- package/dist/api/schema.js +4 -4
- package/dist/api.d.ts +1 -1
- package/dist/api.js +27 -27
- package/dist/{app-BB1j2krL.d.ts → app-C47PT68y.d.ts} +2 -2
- package/dist/app.d.ts +1 -1
- package/dist/app.js +29 -29
- package/dist/{assistant-reply-BtIV0hq6.js → assistant-reply-ZjLRGHm2.js} +1 -1
- package/dist/{automation-DWbjJltM.js → automation-CrsYnvdV.js} +1 -1
- package/dist/{background-compaction-queue-2gKhjRD3.js → background-compaction-queue-CqZBPe9g.js} +4 -4
- package/dist/{briefs-BGke_Cz5.js → briefs-DZrhXJss.js} +3 -3
- package/dist/{catalog-runtime-BSOlVfXi.js → catalog-runtime-Cj9I0dco.js} +1 -1
- package/dist/cli/chat.js +14 -14
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.d.ts +5 -0
- package/dist/cli/main.js +25 -6
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +4 -3
- package/dist/{config-DHDub41t.js → config-BerMjSVL.js} +2 -2
- package/dist/{connections-BAb0fedk.js → connections-BWmTOVPB.js} +6 -6
- package/dist/{conversation-CwC8K3RZ.js → conversation-CtjR1Zcx.js} +7 -1
- package/dist/{conversation-pending-messages-B0cuLReP.js → conversation-pending-messages-Cd7ShwBs.js} +1 -1
- package/dist/{conversation-privacy-QRdLPH-9.js → conversation-privacy-BMfbOUCo.js} +1 -1
- package/dist/{credential-sync-YIMGiRk7.js → credential-sync-DZDij2CU.js} +13 -13
- package/dist/{db-DCSmv9tz.d.ts → db-7glZCI18.d.ts} +1 -1
- package/dist/{db-DBHig2sI.js → db-BlfjuqzW.js} +8 -5
- package/dist/{executor-DKrtH0k_.js → executor-ikZvFaMD.js} +54 -6
- package/dist/instrumentation.js +2 -2
- package/dist/{logging-f24cZPEj.js → logging-CTCH5jOy.js} +1 -1
- package/dist/{message-BbBOajiX.js → message-C1ID1tKi.js} +9 -9
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-rHJYjFoz.js → oauth-callback-server-CStBgDU7.js} +2 -2
- package/dist/{projection-D-9aVaHj.js → projection-DY93nCfX.js} +11 -11
- package/dist/{prompt-C7SZhNDy.js → prompt-exicBZeb.js} +4 -4
- package/dist/{registry-CwA-kSjW.js → registry-X_xdFY9L.js} +1 -1
- package/dist/{resolve-B5WJgt9k.js → resolve-B9dYN-nS.js} +3 -3
- package/dist/{result-B2sCVIwl.js → result-CC8bV8Fl.js} +8 -8
- package/dist/{runner-CZq7wyIh.js → runner-D44qp4rc.js} +8 -8
- package/dist/{sandbox-egress-signals-C4d6Pa9a.js → sandbox-egress-signals-BrH6DWkt.js} +1 -1
- package/dist/{schema-DQaFSkZZ.d.ts → schema-CC2RxDAV.d.ts} +5 -0
- package/dist/{schema-Bptz19Ja.js → schema-CVV5r-qP.js} +3 -3
- package/dist/{service-account-B6OJtplS.js → service-account-89JZHWCE.js} +3 -3
- package/dist/{service-account-BC73M8rj.js → service-account-DoNZuJb-.js} +3 -3
- package/dist/{session-stop-1cku9Vm3.js → session-stop-DNucbmPf.js} +11 -11
- package/dist/{skills-BFopj5ID.js → skills-BeUfmYXL.js} +2 -2
- package/dist/{spawn-B-1JlJwH.js → spawn-CIAcfcvZ.js} +5 -5
- package/dist/{stop-CJweYiOH.js → stop-Ckd3735h.js} +89 -32
- package/dist/{store-CK869JpC.js → store-CS0xoqXW.js} +3 -3
- package/dist/{task-runner-XmXL9E-k.js → task-runner-DjjHCX_m.js} +11 -11
- package/dist/{turn-failure-response-hhpek6Fn.js → turn-failure-response-D0bwI462.js} +8 -8
- package/dist/{validation-DHQjCRFx.js → validation-Cvx_AupF.js} +1 -1
- package/dist/{version-DQgCf4FE.js → version-BrDx4Fzc.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-DG97nzP4.js → viewer-4CxdwLLQ.js} +3 -3
- package/dist/{warmup-C00-jOoN.js → warmup-B62hd4lD.js} +8 -8
- package/dist/{work-Ch3EWO6u.js → work-Cu315oJl.js} +11 -11
- package/dist/{worker-B8kyM1fB.js → worker-4ClZu6ry.js} +6 -6
- package/migrations/0095_web_linked_slack_identity_repair.sql +252 -0
- package/migrations/meta/0095_snapshot.json +4452 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +5 -5
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { Fa as createPluginEmbedder, Gi as openSlackDirectMessage, Hn as coreTaskRegistrations, Ia as createPluginModel, Ii as escapeSlackMrkdwnText, Ja as createPluginModelCostRecorder, Ji as postSlackMessage, Li as formatSlackLink, Mo as createDurableLocationConfigurationService, Ya as createPluginLogger, an as instructionTextForProjection, b as persistConversationMessages, dn as normalizeToolNameFromResult, en as getPiMessageRole, jo as createPluginCache, li as ToolInputError, ln as isToolResultError, oi as getDashboardTaskLink, oo as createPluginConversationEvents, ot as getTurnRecord, pn as stripRuntimeTurnContext, ti as JUNIOR_THREAD_STATE_TTL_MS, ui as createPluginState, un as isToolResultMessage, v as hydrateConversationMessages, w as fallbackShortTitle, zn as getPlugins } from "./projection-
|
|
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 { Fa as createPluginEmbedder, Gi as openSlackDirectMessage, Hn as coreTaskRegistrations, Ia as createPluginModel, Ii as escapeSlackMrkdwnText, Ja as createPluginModelCostRecorder, Ji as postSlackMessage, Li as formatSlackLink, Mo as createDurableLocationConfigurationService, Ya as createPluginLogger, an as instructionTextForProjection, b as persistConversationMessages, dn as normalizeToolNameFromResult, en as getPiMessageRole, jo as createPluginCache, li as ToolInputError, ln as isToolResultError, oi as getDashboardTaskLink, oo as createPluginConversationEvents, ot as getTurnRecord, pn as stripRuntimeTurnContext, ti as JUNIOR_THREAD_STATE_TTL_MS, ui as createPluginState, un as isToolResultMessage, v as hydrateConversationMessages, w as fallbackShortTitle, zn as getPlugins } from "./projection-DY93nCfX.js";
|
|
3
|
+
import { n as botConfig } from "./config-BerMjSVL.js";
|
|
4
|
+
import { E as withSpan, G as isRecord$1, K as toOptionalNumber, _ as runBestEffort, h as logWarn, q as toOptionalString } from "./logging-CTCH5jOy.js";
|
|
5
5
|
import { h as parseSlackMessageTs } from "./actor-6jsm_v96.js";
|
|
6
|
-
import { H as agentTurnTotalTokens, V as agentTurnCostUsd, a as getConversationStore, o as getDb } from "./db-
|
|
7
|
-
import { A as juniorConversations, d as juniorAutomationVersions, f as juniorAutomations, u as juniorAutomationRuns } from "./executor-
|
|
6
|
+
import { H as agentTurnTotalTokens, V as agentTurnCostUsd, a as getConversationStore, o as getDb } from "./db-BlfjuqzW.js";
|
|
7
|
+
import { A as juniorConversations, d as juniorAutomationVersions, f as juniorAutomations, u as juniorAutomationRuns } from "./executor-ikZvFaMD.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 { r as getStateAdapter } from "./adapter-
|
|
12
|
-
import { c as pluginTaskParamsSchema, d as sendVercelPluginTask, s as pluginTaskId } from "./background-compaction-queue-
|
|
13
|
-
import { O as eventAutomationSchema, S as automationVersionSchema, j as scheduledAutomationSchema } from "./automation-
|
|
9
|
+
import { h as credentialSubjectSchema } from "./registry-X_xdFY9L.js";
|
|
10
|
+
import { i as readActorIdentity } from "./viewer-4CxdwLLQ.js";
|
|
11
|
+
import { r as getStateAdapter } from "./adapter-Cigb1MTr.js";
|
|
12
|
+
import { c as pluginTaskParamsSchema, d as sendVercelPluginTask, s as pluginTaskId } from "./background-compaction-queue-CqZBPe9g.js";
|
|
13
|
+
import { O as eventAutomationSchema, S as automationVersionSchema, j as scheduledAutomationSchema } from "./automation-CrsYnvdV.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-BlfjuqzW.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 { E as buildConversationContext, To as listConversationAnnotations, X as clearPendingAuth, j as markConversationMessage, v as hydrateConversationMessages } from "./projection-
|
|
2
|
-
import { H as getProviderErrorAttributes, U as getProviderErrorUserMessage, V as findProviderError, g as TURN_REASONING_LEVELS, z as ProviderError } from "./config-
|
|
3
|
-
import { G as isRecord, b as setSpanAttributes, t as buildTurnFailureResponse } from "./logging-
|
|
1
|
+
import { E as buildConversationContext, To as listConversationAnnotations, X as clearPendingAuth, j as markConversationMessage, v as hydrateConversationMessages } from "./projection-DY93nCfX.js";
|
|
2
|
+
import { H as getProviderErrorAttributes, U as getProviderErrorUserMessage, V as findProviderError, g as TURN_REASONING_LEVELS, z as ProviderError } from "./config-BerMjSVL.js";
|
|
3
|
+
import { G as isRecord, b as setSpanAttributes, t as buildTurnFailureResponse } from "./logging-CTCH5jOy.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 { B as resolveMessageCards, R as readMessageCardRefs, z as removedCardSchema } from "./conversation-
|
|
5
|
+
import { o as getDb, r as getConversationEventStore, s as getSqlExecutor } from "./db-BlfjuqzW.js";
|
|
6
|
+
import { g as juniorAgentInvocations } from "./executor-ikZvFaMD.js";
|
|
7
|
+
import { p as credentialContextSchema } from "./registry-X_xdFY9L.js";
|
|
8
|
+
import { B as resolveMessageCards, R as readMessageCardRefs, z as removedCardSchema } from "./conversation-CtjR1Zcx.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 { _t as persistThreadStateById, ht as getPersistedThreadState, vt as coerceThreadConversationState } from "./task-runner-
|
|
10
|
+
import { _t as persistThreadStateById, ht as getPersistedThreadState, vt as coerceThreadConversationState } from "./task-runner-DjjHCX_m.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-Cj9I0dco.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.292.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-BrDx4Fzc.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { H as GOOGLE_IDENTITY_PROVIDER, W as normalizeIdentityEmail, h as logWarn } from "./logging-
|
|
2
|
-
import { E as findActorIdentityId, o as getDb } from "./db-
|
|
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-CTCH5jOy.js";
|
|
2
|
+
import { E as findActorIdentityId, o as getDb } from "./db-BlfjuqzW.js";
|
|
3
|
+
import { M as juniorUsers, j as juniorIdentities } from "./executor-ikZvFaMD.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";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { n as captureMessage, v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { Ya as createPluginLogger, jo as createPluginCache, zn as getPlugins } from "./projection-
|
|
3
|
-
import { E as resolveGatewayModel, W as isProviderRetryError, i as getChatConfig } from "./config-
|
|
4
|
-
import { E as withSpan, h as logWarn, m as logInfo, x as setSpanStatus } from "./logging-
|
|
5
|
-
import { K as rootConversationIsArchived, a as getConversationStore, o as getDb, s as getSqlExecutor } from "./db-
|
|
6
|
-
import { A as juniorConversations, C as isUserInstruction, j as juniorIdentities, w as juniorConversationEvents } from "./executor-
|
|
7
|
-
import { u as completeText } from "./prompt-
|
|
8
|
-
import { r as getStateAdapter } from "./adapter-
|
|
9
|
-
import { E as sendCacheWarmup } from "./background-compaction-queue-
|
|
2
|
+
import { Ya as createPluginLogger, jo as createPluginCache, zn as getPlugins } from "./projection-DY93nCfX.js";
|
|
3
|
+
import { E as resolveGatewayModel, W as isProviderRetryError, i as getChatConfig } from "./config-BerMjSVL.js";
|
|
4
|
+
import { E as withSpan, h as logWarn, m as logInfo, x as setSpanStatus } from "./logging-CTCH5jOy.js";
|
|
5
|
+
import { K as rootConversationIsArchived, a as getConversationStore, o as getDb, s as getSqlExecutor } from "./db-BlfjuqzW.js";
|
|
6
|
+
import { A as juniorConversations, C as isUserInstruction, j as juniorIdentities, w as juniorConversationEvents } from "./executor-ikZvFaMD.js";
|
|
7
|
+
import { u as completeText } from "./prompt-exicBZeb.js";
|
|
8
|
+
import { r as getStateAdapter } from "./adapter-Cigb1MTr.js";
|
|
9
|
+
import { E as sendCacheWarmup } from "./background-compaction-queue-CqZBPe9g.js";
|
|
10
10
|
import { streamSimple } from "@earendil-works/pi-ai/compat";
|
|
11
11
|
import { promisify } from "node:util";
|
|
12
12
|
import { randomUUID } from "node:crypto";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { H as PluginCredentialFailureError, K as AuthorizationFlowDisabledError, Sn as renderTag, Xt as isTurnExecutionLimitExceededError, at as failTurnRecord, et as lostWorkerBeforeFirstSave, ho as loadForkHistory, nt as saveTurnCheckpoint, ot as getTurnRecord, rt as abandonTurnRecord, s as openConversationProjection, tn as getTerminalAssistantMessages, tt as pauseLostWorkerTurn, v as hydrateConversationMessages, vn as escapeClosingTags } from "./projection-
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
3
|
-
import { T as SYSTEM_IDENTITY_ID, a as getConversationStore, r as getConversationEventStore, s as getSqlExecutor } from "./db-
|
|
4
|
-
import { g as juniorAgentInvocations, h as juniorAgentBindings } from "./executor-
|
|
1
|
+
import { H as PluginCredentialFailureError, K as AuthorizationFlowDisabledError, Sn as renderTag, Xt as isTurnExecutionLimitExceededError, at as failTurnRecord, et as lostWorkerBeforeFirstSave, ho as loadForkHistory, nt as saveTurnCheckpoint, ot as getTurnRecord, rt as abandonTurnRecord, s as openConversationProjection, tn as getTerminalAssistantMessages, tt as pauseLostWorkerTurn, v as hydrateConversationMessages, vn as escapeClosingTags } from "./projection-DY93nCfX.js";
|
|
2
|
+
import { n as botConfig } from "./config-BerMjSVL.js";
|
|
3
|
+
import { T as SYSTEM_IDENTITY_ID, a as getConversationStore, r as getConversationEventStore, s as getSqlExecutor } from "./db-BlfjuqzW.js";
|
|
4
|
+
import { g as juniorAgentInvocations, h as juniorAgentBindings } from "./executor-ikZvFaMD.js";
|
|
5
5
|
import { h as contextProvenance, m as agentInstructionProvenance, v as sameActorIdentity } from "./media-BepyEUNm.js";
|
|
6
|
-
import { Dt as stopChildAgentsOf, Gt as finishTurn, Mt as supersedeOpenMailboxTurns, Ot as recordSubagentEnded, Ut as AgentRunError, Wt as executeTurn, an as AgentNameInUseError, kt as recordSubagentStarted, rn as AgentMessageQueueFullError, tn as AgentInvocationLimitError } from "./agent-runner-
|
|
7
|
-
import { k as getTurnRequestDeadline } from "./background-compaction-queue-
|
|
8
|
-
import { $ as getUnnamedAgentConversationId, A as markAgentInvocationPaused, C as isTerminalAgentInvocation, H as agentTypeStartsWithParentHistory, J as getAgentInvocationMessageId, L as agentBindingSchema, M as markAgentInvocationSteered, N as reportReplacedAgentInvocation, O as markAgentInvocationMailboxAppended, Q as getNamedAgentConversationId, T as listOpenAgentInvocations, V as agentTypeInstructions, W as getAgentInvocationId, X as getAgentInvocationTurnId, Z as getChildAgentLockName, _ as completeAgentInvocation, at as getConversationTurnBoundaryError, f as ConversationTurnLifecycleService, g as NON_TERMINAL_AGENT_INVOCATION_STATUSES, h as ACTIVE_AGENT_INVOCATION_STATUSES, j as markAgentInvocationRunning, rt as TurnInputCommitLostError, st as isTurnInputCommitLostError, v as getActiveAgentInvocationForConversation, w as listAgentInvocationsForConversation, x as getLatestAgentInvocationForConversation, y as getAgentInvocation, z as createAgentInvocationSchema } from "./turn-failure-response-
|
|
9
|
-
import { n as getAssistantReplyText } from "./assistant-reply-
|
|
10
|
-
import { $ as withoutSavedSteeringMessages, B as maybePostAutomatedTurnLimitNotice, K as recordFinishedTurnForAutomatedLimit, X as buildSteeringPiMessage, Z as instructionForInputs, ct as readBlockedReport, h as parseWebMessages, i as resumeStoppedConversationTree, p as listActiveMailboxTurns, q as resetAutomatedTurnLimit, u as getActiveConversationTurnId } from "./session-stop-
|
|
11
|
-
import { r as appendAndEnqueueInboundMessage } from "./store-
|
|
12
|
-
import { _t as persistThreadStateById, ht as getPersistedThreadState, mt as getPersistedSandboxState, vt as coerceThreadConversationState } from "./task-runner-
|
|
6
|
+
import { Dt as stopChildAgentsOf, Gt as finishTurn, Mt as supersedeOpenMailboxTurns, Ot as recordSubagentEnded, Ut as AgentRunError, Wt as executeTurn, an as AgentNameInUseError, kt as recordSubagentStarted, rn as AgentMessageQueueFullError, tn as AgentInvocationLimitError } from "./agent-runner-BuH7EHrX.js";
|
|
7
|
+
import { k as getTurnRequestDeadline } from "./background-compaction-queue-CqZBPe9g.js";
|
|
8
|
+
import { $ as getUnnamedAgentConversationId, A as markAgentInvocationPaused, C as isTerminalAgentInvocation, H as agentTypeStartsWithParentHistory, J as getAgentInvocationMessageId, L as agentBindingSchema, M as markAgentInvocationSteered, N as reportReplacedAgentInvocation, O as markAgentInvocationMailboxAppended, Q as getNamedAgentConversationId, T as listOpenAgentInvocations, V as agentTypeInstructions, W as getAgentInvocationId, X as getAgentInvocationTurnId, Z as getChildAgentLockName, _ as completeAgentInvocation, at as getConversationTurnBoundaryError, f as ConversationTurnLifecycleService, g as NON_TERMINAL_AGENT_INVOCATION_STATUSES, h as ACTIVE_AGENT_INVOCATION_STATUSES, j as markAgentInvocationRunning, rt as TurnInputCommitLostError, st as isTurnInputCommitLostError, v as getActiveAgentInvocationForConversation, w as listAgentInvocationsForConversation, x as getLatestAgentInvocationForConversation, y as getAgentInvocation, z as createAgentInvocationSchema } from "./turn-failure-response-D0bwI462.js";
|
|
9
|
+
import { n as getAssistantReplyText } from "./assistant-reply-ZjLRGHm2.js";
|
|
10
|
+
import { $ as withoutSavedSteeringMessages, B as maybePostAutomatedTurnLimitNotice, K as recordFinishedTurnForAutomatedLimit, X as buildSteeringPiMessage, Z as instructionForInputs, ct as readBlockedReport, h as parseWebMessages, i as resumeStoppedConversationTree, p as listActiveMailboxTurns, q as resetAutomatedTurnLimit, u as getActiveConversationTurnId } from "./session-stop-DNucbmPf.js";
|
|
11
|
+
import { r as appendAndEnqueueInboundMessage } from "./store-CS0xoqXW.js";
|
|
12
|
+
import { _t as persistThreadStateById, ht as getPersistedThreadState, mt as getPersistedSandboxState, vt as coerceThreadConversationState } from "./task-runner-DjjHCX_m.js";
|
|
13
13
|
import { isDeepStrictEqual } from "node:util";
|
|
14
14
|
import * as z from "zod";
|
|
15
15
|
import { and, eq } from "drizzle-orm";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { At as isInvalidConversationRecordError, Dt as hasConversationStop, St as countPendingConversationMessages, kt as isFinalAttempt } from "./projection-
|
|
3
|
-
import { W as isProviderRetryError, i as getChatConfig } from "./config-
|
|
4
|
-
import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-
|
|
5
|
-
import { Ht as selectAttemptMessages, Vt as isAttemptInterrupt } from "./agent-runner-
|
|
6
|
-
import { k as getTurnRequestDeadline, y as ConversationQueueMessageRejectedError } from "./background-compaction-queue-
|
|
7
|
-
import { C as startConversationWork, b as releaseConversationWork, c as clearConsumedConversationWake, d as completeConversationWork, f as deadLetterAttempt, g as getConversationWorkState, i as beginConversationResume, m as ensureConversationWake, o as checkInConversationWork, p as drainConversationMailbox, t as ackMessages, u as completeConversationStop, v as recordAttemptFailure, x as requestAnotherSlice, y as recordConversationRetry } from "./store-
|
|
2
|
+
import { At as isInvalidConversationRecordError, Dt as hasConversationStop, St as countPendingConversationMessages, kt as isFinalAttempt } from "./projection-DY93nCfX.js";
|
|
3
|
+
import { W as isProviderRetryError, i as getChatConfig } from "./config-BerMjSVL.js";
|
|
4
|
+
import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-CTCH5jOy.js";
|
|
5
|
+
import { Ht as selectAttemptMessages, Vt as isAttemptInterrupt } from "./agent-runner-BuH7EHrX.js";
|
|
6
|
+
import { k as getTurnRequestDeadline, y as ConversationQueueMessageRejectedError } from "./background-compaction-queue-CqZBPe9g.js";
|
|
7
|
+
import { C as startConversationWork, b as releaseConversationWork, c as clearConsumedConversationWake, d as completeConversationWork, f as deadLetterAttempt, g as getConversationWorkState, i as beginConversationResume, m as ensureConversationWake, o as checkInConversationWork, p as drainConversationMailbox, t as ackMessages, u as completeConversationStop, v as recordAttemptFailure, x as requestAnotherSlice, y as recordConversationRetry } from "./store-CS0xoqXW.js";
|
|
8
8
|
// src/chat/task-execution/worker.ts
|
|
9
9
|
var worker_exports = /* @__PURE__ */ __exportAll({
|
|
10
10
|
CONVERSATION_WORK_DEFER_DELAY_MS: () => CONVERSATION_WORK_DEFER_DELAY_MS,
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
-- Before #3066, a dashboard post into a Slack thread copied the poster's
|
|
2
|
+
-- email onto the thread starter's Slack Identity when Slack had returned no
|
|
3
|
+
-- email for the starter. The copied email linked that Identity to the
|
|
4
|
+
-- poster's User. The link made the poster a Participant of every root that
|
|
5
|
+
-- the Identity started or sent a Turn in.
|
|
6
|
+
--
|
|
7
|
+
-- Evidence: a Slack instruction stores the Actor from the Slack profile in
|
|
8
|
+
-- `provenance.actor`. Slack is the only source that may give a Slack Identity
|
|
9
|
+
-- its email, so an instruction with the Identity's Slack user and email
|
|
10
|
+
-- proves that email. Nothing else proves it. In the same way, an instruction
|
|
11
|
+
-- with the Identity's Slack user and name proves that the name came from
|
|
12
|
+
-- Slack.
|
|
13
|
+
--
|
|
14
|
+
-- A candidate is a Slack user Identity when all of these are true:
|
|
15
|
+
-- - It has a User and a verified email, and no evidence proves that email.
|
|
16
|
+
-- - The User's web Identity, with that same email, wrote an event in a
|
|
17
|
+
-- Conversation of a root that the Slack Identity started.
|
|
18
|
+
--
|
|
19
|
+
-- Slack emails are unique in a workspace, so one User has at most one
|
|
20
|
+
-- correct Slack Identity in each team. Repair a candidate only when evidence
|
|
21
|
+
-- proves exactly one other Slack Identity of its User in its team. Leave
|
|
22
|
+
-- every other candidate as it is. Without that proof, the data cannot tell a
|
|
23
|
+
-- victim from a person whose own link came through this path, or whose
|
|
24
|
+
-- events retention removed.
|
|
25
|
+
--
|
|
26
|
+
-- One statement repairs every table, so each part reads the same rows. The
|
|
27
|
+
-- migration reports its counts with `RAISE INFO`, and `junior upgrade`
|
|
28
|
+
-- prints them. The report has no identifiers.
|
|
29
|
+
DO $$
|
|
30
|
+
DECLARE
|
|
31
|
+
"report" record;
|
|
32
|
+
BEGIN
|
|
33
|
+
-- junior:bounded-backfill: changes only rows of damaged Identities, their Users, and the roots they started or sent Turns in. #3065 found few of these.
|
|
34
|
+
WITH "slack_actors" AS (
|
|
35
|
+
SELECT DISTINCT
|
|
36
|
+
"e"."payload"->'provenance'->'actor'->>'userId' AS "subject",
|
|
37
|
+
lower(btrim("e"."payload"->'provenance'->'actor'->>'email')) AS "email",
|
|
38
|
+
btrim("e"."payload"->'provenance'->'actor'->>'fullName') AS "full_name"
|
|
39
|
+
FROM "junior_conversation_events" AS "e"
|
|
40
|
+
WHERE "e"."type" = 'user_message'
|
|
41
|
+
AND "e"."payload"->'provenance'->>'authority' = 'instruction'
|
|
42
|
+
AND "e"."payload"->'provenance'->'actor'->>'platform' = 'slack'
|
|
43
|
+
),
|
|
44
|
+
"slack_evidence" AS (
|
|
45
|
+
SELECT DISTINCT "subject", "email"
|
|
46
|
+
FROM "slack_actors"
|
|
47
|
+
WHERE "email" IS NOT NULL
|
|
48
|
+
),
|
|
49
|
+
"proven" AS (
|
|
50
|
+
SELECT "slack"."id", "slack"."user_id", "slack"."provider_tenant_id",
|
|
51
|
+
"slack"."display_name"
|
|
52
|
+
FROM "junior_identities" AS "slack"
|
|
53
|
+
INNER JOIN "slack_evidence" AS "ev"
|
|
54
|
+
ON "ev"."subject" = "slack"."provider_subject_id"
|
|
55
|
+
AND "ev"."email" = "slack"."email_normalized"
|
|
56
|
+
WHERE "slack"."kind" = 'user'
|
|
57
|
+
AND "slack"."provider" = 'slack'
|
|
58
|
+
AND "slack"."user_id" IS NOT NULL
|
|
59
|
+
),
|
|
60
|
+
"web_posts" AS (
|
|
61
|
+
SELECT DISTINCT "web"."user_id", "web"."email_normalized",
|
|
62
|
+
coalesce("c"."root_conversation_id", "c"."conversation_id") AS "root_id"
|
|
63
|
+
FROM "junior_identities" AS "web"
|
|
64
|
+
INNER JOIN "junior_conversation_events" AS "posted"
|
|
65
|
+
ON "posted"."actor_identity_id" = "web"."id"
|
|
66
|
+
INNER JOIN "junior_conversations" AS "c"
|
|
67
|
+
ON "c"."conversation_id" = "posted"."conversation_id"
|
|
68
|
+
WHERE "web"."kind" = 'user'
|
|
69
|
+
AND "web"."provider" = 'junior'
|
|
70
|
+
AND "web"."user_id" IS NOT NULL
|
|
71
|
+
),
|
|
72
|
+
"candidates" AS (
|
|
73
|
+
SELECT DISTINCT "slack"."id" AS "identity_id", "slack"."user_id",
|
|
74
|
+
"slack"."provider_tenant_id"
|
|
75
|
+
FROM "junior_identities" AS "slack"
|
|
76
|
+
INNER JOIN "junior_conversations" AS "root"
|
|
77
|
+
ON "root"."actor_identity_id" = "slack"."id"
|
|
78
|
+
AND "root"."parent_conversation_id" IS NULL
|
|
79
|
+
INNER JOIN "web_posts" AS "w"
|
|
80
|
+
ON "w"."root_id" = "root"."conversation_id"
|
|
81
|
+
AND "w"."user_id" = "slack"."user_id"
|
|
82
|
+
AND "w"."email_normalized" = "slack"."email_normalized"
|
|
83
|
+
WHERE "slack"."kind" = 'user'
|
|
84
|
+
AND "slack"."provider" = 'slack'
|
|
85
|
+
AND "slack"."user_id" IS NOT NULL
|
|
86
|
+
AND "slack"."email_verified"
|
|
87
|
+
AND "slack"."id" NOT IN (SELECT "id" FROM "proven")
|
|
88
|
+
),
|
|
89
|
+
"damaged" AS (
|
|
90
|
+
SELECT "candidate"."identity_id", "candidate"."user_id"
|
|
91
|
+
FROM "candidates" AS "candidate"
|
|
92
|
+
WHERE (
|
|
93
|
+
SELECT count(*)
|
|
94
|
+
FROM "proven" AS "kept"
|
|
95
|
+
WHERE "kept"."user_id" = "candidate"."user_id"
|
|
96
|
+
AND "kept"."provider_tenant_id" = "candidate"."provider_tenant_id"
|
|
97
|
+
) = 1
|
|
98
|
+
),
|
|
99
|
+
-- Roots where the link made the poster a Participant: roots that the damaged
|
|
100
|
+
-- Identity started, and roots where it sent a Turn.
|
|
101
|
+
"affected_roots" AS (
|
|
102
|
+
SELECT "d"."user_id", "root"."conversation_id" AS "root_id"
|
|
103
|
+
FROM "damaged" AS "d"
|
|
104
|
+
INNER JOIN "junior_conversations" AS "root"
|
|
105
|
+
ON "root"."actor_identity_id" = "d"."identity_id"
|
|
106
|
+
AND "root"."parent_conversation_id" IS NULL
|
|
107
|
+
UNION
|
|
108
|
+
SELECT "d"."user_id",
|
|
109
|
+
coalesce("c"."root_conversation_id", "c"."conversation_id") AS "root_id"
|
|
110
|
+
FROM "damaged" AS "d"
|
|
111
|
+
INNER JOIN "junior_conversation_events" AS "e"
|
|
112
|
+
ON "e"."actor_identity_id" = "d"."identity_id"
|
|
113
|
+
INNER JOIN "junior_conversations" AS "c"
|
|
114
|
+
ON "c"."conversation_id" = "e"."conversation_id"
|
|
115
|
+
),
|
|
116
|
+
-- Keep a row when the User started the root or wrote in it through an
|
|
117
|
+
-- Identity that is not damaged.
|
|
118
|
+
"removed_participants" AS (
|
|
119
|
+
DELETE FROM "junior_conversation_participants" AS "p"
|
|
120
|
+
USING "affected_roots" AS "a"
|
|
121
|
+
WHERE "p"."user_id" = "a"."user_id"
|
|
122
|
+
AND "p"."root_conversation_id" = "a"."root_id"
|
|
123
|
+
AND NOT EXISTS (
|
|
124
|
+
SELECT 1
|
|
125
|
+
FROM "junior_conversations" AS "root"
|
|
126
|
+
INNER JOIN "junior_identities" AS "starter"
|
|
127
|
+
ON "starter"."id" = "root"."actor_identity_id"
|
|
128
|
+
WHERE "root"."conversation_id" = "a"."root_id"
|
|
129
|
+
AND "starter"."user_id" = "a"."user_id"
|
|
130
|
+
AND "starter"."id" NOT IN (SELECT "identity_id" FROM "damaged")
|
|
131
|
+
)
|
|
132
|
+
AND NOT EXISTS (
|
|
133
|
+
SELECT 1
|
|
134
|
+
FROM "junior_conversations" AS "c"
|
|
135
|
+
INNER JOIN "junior_conversation_events" AS "e"
|
|
136
|
+
ON "e"."conversation_id" = "c"."conversation_id"
|
|
137
|
+
INNER JOIN "junior_identities" AS "author"
|
|
138
|
+
ON "author"."id" = "e"."actor_identity_id"
|
|
139
|
+
WHERE coalesce("c"."root_conversation_id", "c"."conversation_id") = "a"."root_id"
|
|
140
|
+
AND "author"."user_id" = "a"."user_id"
|
|
141
|
+
AND "author"."id" NOT IN (SELECT "identity_id" FROM "damaged")
|
|
142
|
+
)
|
|
143
|
+
RETURNING 1
|
|
144
|
+
),
|
|
145
|
+
-- The link gave the poster's User the starter's name when the User had none.
|
|
146
|
+
-- Later dashboard posts copy the User name to the poster's web Identity, and
|
|
147
|
+
-- the next save of that Identity copies it back to the User. So the web
|
|
148
|
+
-- Identity name is not evidence. A name is the starter's when Slack evidence
|
|
149
|
+
-- proves it for the damaged Identity and no proven Slack Identity of the User
|
|
150
|
+
-- has it. Clear it on the User and on the User's web Identities. The next
|
|
151
|
+
-- save of a kept Identity gives the User a name again.
|
|
152
|
+
"stolen_names" AS (
|
|
153
|
+
SELECT DISTINCT "u"."id" AS "user_id", "u"."display_name"
|
|
154
|
+
FROM "damaged" AS "d"
|
|
155
|
+
INNER JOIN "junior_identities" AS "slack" ON "slack"."id" = "d"."identity_id"
|
|
156
|
+
INNER JOIN "junior_users" AS "u" ON "u"."id" = "d"."user_id"
|
|
157
|
+
WHERE "u"."display_name" = "slack"."display_name"
|
|
158
|
+
AND EXISTS (
|
|
159
|
+
SELECT 1
|
|
160
|
+
FROM "slack_actors" AS "a"
|
|
161
|
+
WHERE "a"."subject" = "slack"."provider_subject_id"
|
|
162
|
+
AND "a"."full_name" = "slack"."display_name"
|
|
163
|
+
)
|
|
164
|
+
AND NOT EXISTS (
|
|
165
|
+
SELECT 1
|
|
166
|
+
FROM "proven" AS "kept"
|
|
167
|
+
WHERE "kept"."user_id" = "d"."user_id"
|
|
168
|
+
AND "kept"."display_name" = "u"."display_name"
|
|
169
|
+
)
|
|
170
|
+
),
|
|
171
|
+
"renamed_users" AS (
|
|
172
|
+
UPDATE "junior_users" AS "u"
|
|
173
|
+
SET "display_name" = NULL,
|
|
174
|
+
"updated_at" = now()
|
|
175
|
+
FROM "stolen_names" AS "n"
|
|
176
|
+
WHERE "u"."id" = "n"."user_id"
|
|
177
|
+
RETURNING 1
|
|
178
|
+
),
|
|
179
|
+
"renamed_web_identities" AS (
|
|
180
|
+
UPDATE "junior_identities" AS "web"
|
|
181
|
+
SET "display_name" = NULL,
|
|
182
|
+
"updated_at" = now()
|
|
183
|
+
FROM "stolen_names" AS "n"
|
|
184
|
+
WHERE "web"."user_id" = "n"."user_id"
|
|
185
|
+
AND "web"."kind" = 'user'
|
|
186
|
+
AND "web"."provider" = 'junior'
|
|
187
|
+
AND "web"."display_name" = "n"."display_name"
|
|
188
|
+
RETURNING 1
|
|
189
|
+
),
|
|
190
|
+
-- The detail report of these roots shows the root Actor and Participants.
|
|
191
|
+
"touched_roots" AS (
|
|
192
|
+
UPDATE "junior_conversations" AS "root"
|
|
193
|
+
SET "detail_version" = "root"."detail_version" + 1
|
|
194
|
+
WHERE "root"."conversation_id" IN (SELECT "root_id" FROM "affected_roots")
|
|
195
|
+
RETURNING 1
|
|
196
|
+
),
|
|
197
|
+
-- Put the Identity back to its state before the link. Slack gave it no
|
|
198
|
+
-- email, so a later Slack Turn cannot link it again. The same write copied
|
|
199
|
+
-- the poster's name when Slack gave none, so clear a name that matches the
|
|
200
|
+
-- poster's web Identity unless Slack evidence proves it. The next Slack Turn
|
|
201
|
+
-- of the Identity saves its own name again.
|
|
202
|
+
"unlinked" AS (
|
|
203
|
+
UPDATE "junior_identities" AS "i"
|
|
204
|
+
SET "user_id" = NULL,
|
|
205
|
+
"email" = NULL,
|
|
206
|
+
"email_normalized" = NULL,
|
|
207
|
+
"email_verified" = false,
|
|
208
|
+
"display_name" = CASE
|
|
209
|
+
WHEN EXISTS (
|
|
210
|
+
SELECT 1
|
|
211
|
+
FROM "junior_identities" AS "web"
|
|
212
|
+
WHERE "web"."user_id" = "d"."user_id"
|
|
213
|
+
AND "web"."provider" = 'junior'
|
|
214
|
+
AND "web"."display_name" = "i"."display_name"
|
|
215
|
+
) AND NOT EXISTS (
|
|
216
|
+
SELECT 1
|
|
217
|
+
FROM "slack_actors" AS "a"
|
|
218
|
+
WHERE "a"."subject" = "i"."provider_subject_id"
|
|
219
|
+
AND "a"."full_name" = "i"."display_name"
|
|
220
|
+
) THEN NULL
|
|
221
|
+
ELSE "i"."display_name"
|
|
222
|
+
END,
|
|
223
|
+
"updated_at" = now()
|
|
224
|
+
FROM "damaged" AS "d"
|
|
225
|
+
WHERE "i"."id" = "d"."identity_id"
|
|
226
|
+
RETURNING 1
|
|
227
|
+
)
|
|
228
|
+
SELECT
|
|
229
|
+
(SELECT count(*) FROM "candidates") AS "candidates",
|
|
230
|
+
(SELECT count(*) FROM "unlinked") AS "repaired",
|
|
231
|
+
(SELECT count(*) FROM "candidates" AS "c"
|
|
232
|
+
WHERE NOT EXISTS (
|
|
233
|
+
SELECT 1 FROM "proven" AS "p"
|
|
234
|
+
WHERE "p"."user_id" = "c"."user_id"
|
|
235
|
+
AND "p"."provider_tenant_id" = "c"."provider_tenant_id"
|
|
236
|
+
)) AS "skipped_unproven",
|
|
237
|
+
(SELECT count(*) FROM "candidates" AS "c"
|
|
238
|
+
WHERE (
|
|
239
|
+
SELECT count(*) FROM "proven" AS "p"
|
|
240
|
+
WHERE "p"."user_id" = "c"."user_id"
|
|
241
|
+
AND "p"."provider_tenant_id" = "c"."provider_tenant_id"
|
|
242
|
+
) > 1) AS "skipped_many_proven",
|
|
243
|
+
(SELECT count(*) FROM "removed_participants") AS "participants",
|
|
244
|
+
(SELECT count(*) FROM "touched_roots") AS "roots",
|
|
245
|
+
(SELECT count(*) FROM "renamed_users") AS "users_renamed",
|
|
246
|
+
(SELECT count(*) FROM "renamed_web_identities") AS "web_identities_renamed"
|
|
247
|
+
INTO "report";
|
|
248
|
+
RAISE INFO '0095 Slack Identity repair: % candidates, % repaired, % skipped with no proven Slack Identity, % skipped with more than one, % Participant rows removed, % roots updated, % User names and % web Identity names cleared',
|
|
249
|
+
"report"."candidates", "report"."repaired", "report"."skipped_unproven",
|
|
250
|
+
"report"."skipped_many_proven", "report"."participants", "report"."roots",
|
|
251
|
+
"report"."users_renamed", "report"."web_identities_renamed";
|
|
252
|
+
END $$;
|