@sentry/junior 0.279.0 → 0.280.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/{actor-B4DYygOB.js → actor-6jsm_v96.js} +1 -1
- package/dist/{adapter-phTTgw7H.js → adapter-DVN3iwf9.js} +1 -1
- package/dist/{admin-PcpJDugZ.js → admin-Q_UI--9W.js} +1 -1
- package/dist/{agent-runner-DwvT1BY0.js → agent-runner-_PYLv4Qo.js} +26 -27
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +7 -7
- package/dist/api.d.ts +3 -3
- package/dist/api.js +181 -85
- package/dist/{app-DVs6noo7.d.ts → app-CL2zzzE0.d.ts} +4 -4
- package/dist/app.d.ts +1 -1
- package/dist/app.js +33 -34
- package/dist/{assistant-reply-BXfxczd7.js → assistant-reply-DbebsAxi.js} +1 -1
- package/dist/{automation-BehArCcq.js → automation-CPqRFjIa.js} +2 -2
- package/dist/{background-compaction-queue-CcbuLJrZ.js → background-compaction-queue-B9lmh8Ml.js} +3 -3
- package/dist/{briefs-Dd_ezwED.js → briefs-Dej7V0Bz.js} +5 -5
- package/dist/{catalog-runtime-BWVMeZhW.js → catalog-runtime-DpN0sWQ6.js} +1 -1
- package/dist/cli/chat.js +15 -15
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +3 -3
- 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 +3 -3
- package/dist/{client-Bpxe4vKa.js → client-h2A2ZPzY.js} +2 -2
- package/dist/{config-C_bmRhrJ.js → config-CusBFORe.js} +2 -2
- package/dist/{connections-B2rHe5W5.js → connections-C4h6mGha.js} +11 -11
- package/dist/{conversation-CIiJtx5q.js → conversation-DExTZw8B.js} +16 -6
- package/dist/{conversation-pending-messages-CnBvE6-6.js → conversation-pending-messages-Dgz6hrJs.js} +2 -2
- package/dist/{conversation-privacy-CzOfcz0U.js → conversation-privacy-2cm6OpNg.js} +1 -1
- package/dist/{credential-sync-Dal_unpv.js → credential-sync-DK06Jgt-.js} +16 -16
- package/dist/{db-CyLrV9C7.d.ts → db-Dsvk1Tp1.d.ts} +2 -2
- package/dist/{executor-BfYH-Wws.js → executor-Cmr0J8W3.js} +149 -6
- package/dist/instrumentation.js +2 -2
- package/dist/{logging-CkT3_Xxp.js → logging-CGnh65_X.js} +1 -1
- package/dist/{media-DTAA8Qs_.js → media-Dq9_svfQ.js} +1 -1
- package/dist/{message-Q5dkgaJ5.js → message-RpAnqHPY.js} +9 -9
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-BDRaqe8O.js → oauth-callback-server-BBnhVKuX.js} +2 -2
- package/dist/{oauth-relay-D0G3T16m.js → oauth-relay-D6xxVywK.js} +1 -1
- package/dist/{projection-DWxX7pb1.js → projection-C1MghKyI.js} +148 -106
- package/dist/{prompt--dwus7Y-.js → prompt-BcHg-BMy.js} +2 -2
- package/dist/{queue-C37RbDVc.d.ts → queue-CZyYgPF0.d.ts} +1 -1
- package/dist/{registry-DnrdeO4s.js → registry-DR7DjX9H.js} +3 -3
- package/dist/{reporting-window-DgHgwQB3.js → reporting-window-B-QP9zX1.js} +28 -2
- package/dist/{resolve-C_QXfqD_.js → resolve-0Ful4oDv.js} +4 -4
- package/dist/{result-DNmOxT-N.js → result-Dd9kCuQ-.js} +11 -11
- package/dist/{runner-zd_noJ1l.js → runner-yiY8gUUu.js} +11 -11
- package/dist/{sandbox-egress-signals-DQjv-nbG.js → sandbox-egress-signals-BzQVHCMz.js} +1 -1
- package/dist/{schema-e90H5FIN.d.ts → schema-BkMmF552.d.ts} +28 -5
- package/dist/{schema-CNJNzvr8.js → schema-C5pEgfHc.js} +30 -7
- package/dist/{service-account-BK26XlHo.js → service-account-Cu7HFLZQ.js} +3 -3
- package/dist/{service-account-CCH2Hv4h.js → service-account-PIMpWZHF.js} +3 -3
- package/dist/{session-stop-6Tf--T7G.js → session-stop-CDEMsNtv.js} +13 -14
- package/dist/{skills-BNrk8gi4.js → skills-B2xIoe0f.js} +3 -3
- package/dist/{spawn-C75hAB9l.js → spawn-C0DySQRV.js} +2 -2
- package/dist/{stop-RYbf7PWi.js → stop-Dj5-nrAo.js} +255 -144
- package/dist/{store-CO5vGjwD.js → store-Dlio-o6u.js} +6 -6
- package/dist/{store-G3h2djJU.js → store-QzOfDwKA.js} +3 -3
- package/dist/{task-queue-DlN58XeM.js → task-queue-Cp1V_XW3.js} +4 -4
- package/dist/{task-runner-B-Bdm23d.js → task-runner-CQkkUj3o.js} +8 -8
- package/dist/{thread-state-Cj_7Slru.js → thread-state-Bn87cfzE.js} +4 -4
- package/dist/{turn-failure-response-CE7gaoC7.js → turn-failure-response-CQebxByj.js} +8 -8
- package/dist/{turn-lifecycle-7sXwXLJ6.js → turn-lifecycle-CJJsOhXB.js} +1 -1
- package/dist/{turn-session-routing-FBdaH1zf.js → turn-session-routing-bmG330Cf.js} +10 -11
- package/dist/{validation-DLWxEzWW.js → validation-D1wcf7hp.js} +1 -1
- package/dist/{version-DtQ8WFIZ.js → version-BeHSXUK6.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-vsM8_90o.js → viewer-BZ0Hp5Nb.js} +5 -6
- package/dist/{work-DsoFRO_0.js → work-BTcCIbWu.js} +12 -12
- package/dist/{worker-6kZEsCXs.js → worker-D3fDK6zc.js} +6 -6
- package/package.json +5 -5
- package/dist/agent-invocations-CUg_SODU.js +0 -181
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Rr as JUNIOR_THREAD_STATE_TTL_MS,
|
|
2
|
-
import { G as toOptionalNumber, K as toOptionalString, W as isRecord } from "./logging-
|
|
3
|
-
import { S as getDb } from "./viewer-
|
|
4
|
-
import { r as getStateAdapter } from "./adapter-
|
|
1
|
+
import { Rr as JUNIOR_THREAD_STATE_TTL_MS, po as createDurableLocationConfigurationService, y as persistConversationMessages } from "./projection-C1MghKyI.js";
|
|
2
|
+
import { G as toOptionalNumber, K as toOptionalString, W as isRecord } from "./logging-CGnh65_X.js";
|
|
3
|
+
import { S as getDb } from "./viewer-BZ0Hp5Nb.js";
|
|
4
|
+
import { r as getStateAdapter } from "./adapter-DVN3iwf9.js";
|
|
5
5
|
// src/chat/state/conversation.ts
|
|
6
6
|
function defaultConversationState() {
|
|
7
7
|
return {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { K as clearPendingAuth, M as markConversationMessage,
|
|
2
|
-
import { b as getProviderErrorUserMessage, g as ProviderError, v as findProviderError, y as getProviderErrorAttributes } from "./client-
|
|
3
|
-
import { W as isRecord, t as buildTurnFailureResponse } from "./logging-
|
|
4
|
-
import { h as parseSlackMessageTs } from "./actor-
|
|
5
|
-
import { S as getDb, y as getConversationEventStore } from "./viewer-
|
|
6
|
-
import { M as readMessageCardRefs, N as removedCardSchema, P as resolveMessageCards } from "./conversation-
|
|
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-
|
|
1
|
+
import { K as clearPendingAuth, M as markConversationMessage, so as listConversationAnnotations, un as buildDeterministicTurnId, v as hydrateConversationMessages } from "./projection-C1MghKyI.js";
|
|
2
|
+
import { b as getProviderErrorUserMessage, g as ProviderError, v as findProviderError, y as getProviderErrorAttributes } from "./client-h2A2ZPzY.js";
|
|
3
|
+
import { W as isRecord, t as buildTurnFailureResponse } from "./logging-CGnh65_X.js";
|
|
4
|
+
import { h as parseSlackMessageTs } from "./actor-6jsm_v96.js";
|
|
5
|
+
import { S as getDb, y as getConversationEventStore } from "./viewer-BZ0Hp5Nb.js";
|
|
6
|
+
import { M as readMessageCardRefs, N as removedCardSchema, P as resolveMessageCards } from "./conversation-DExTZw8B.js";
|
|
7
|
+
import { O as parseAgentInvocationResultMessageId, Q as markTurnCompleted, Z as markTurnClosed, c as getAgentInvocation, m as getAgentInvocationTurnId } from "./store-Dlio-o6u.js";
|
|
8
|
+
import { a as persistThreadStateById, o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-Bn87cfzE.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-BZ0Hp5Nb.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,14 +1,13 @@
|
|
|
1
|
-
import { Ei as openSlackDirectMessage, Hr as getDashboardTaskLink, Rr as JUNIOR_THREAD_STATE_TTL_MS, Wr as ToolInputError, _i as escapeSlackMrkdwnText, ki as postSlackMessage, vi as formatSlackLink, w as fallbackShortTitle } from "./projection-
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
3
|
-
import { _ as runBestEffort, h as logWarn } from "./logging-
|
|
4
|
-
import { Q as agentTurnTotalTokens, S as getDb, Z as agentTurnCostUsd } from "./viewer-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { O as eventAutomationSchema, S as automationVersionSchema, j as scheduledAutomationSchema } from "./automation-BehArCcq.js";
|
|
1
|
+
import { Ei as openSlackDirectMessage, Hr as getDashboardTaskLink, Rr as JUNIOR_THREAD_STATE_TTL_MS, Wr as ToolInputError, _i as escapeSlackMrkdwnText, ki as postSlackMessage, vi as formatSlackLink, w as fallbackShortTitle } from "./projection-C1MghKyI.js";
|
|
2
|
+
import { n as botConfig } from "./config-CusBFORe.js";
|
|
3
|
+
import { _ as runBestEffort, h as logWarn } from "./logging-CGnh65_X.js";
|
|
4
|
+
import { Q as agentTurnTotalTokens, S as getDb, Z as agentTurnCostUsd } from "./viewer-BZ0Hp5Nb.js";
|
|
5
|
+
import { d as juniorAutomations, k as juniorConversations, l as juniorAutomationRuns, u as juniorAutomationVersions } from "./executor-Cmr0J8W3.js";
|
|
6
|
+
import { h as credentialSubjectSchema } from "./registry-DR7DjX9H.js";
|
|
7
|
+
import { r as getStateAdapter } from "./adapter-DVN3iwf9.js";
|
|
8
|
+
import { O as eventAutomationSchema, S as automationVersionSchema, j as scheduledAutomationSchema } from "./automation-CPqRFjIa.js";
|
|
10
9
|
import { createHash } from "node:crypto";
|
|
11
|
-
import
|
|
10
|
+
import * as z from "zod";
|
|
12
11
|
import { and, asc, count, desc, eq, gte, inArray, isNotNull, isNull, lte, max, ne, or, sql } from "drizzle-orm";
|
|
13
12
|
import { agentEventMatchSchema, anyResourceMatchFields, describeEventTrigger, destinationSchema, destinationVisibilitySchema, eventMatches, eventTriggerChoices, eventTriggerProblems, isSlackDestination, normalizeEventIdentifier, normalizeEventMatch, replyAttributionSchema, sourceSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
|
|
14
13
|
// src/chat/events/catalog.ts
|
|
@@ -1584,7 +1583,7 @@ function slackSourceForDestination(args) {
|
|
|
1584
1583
|
* Reads parent Conversations when this Conversation has no Destination.
|
|
1585
1584
|
*/
|
|
1586
1585
|
async function resolveConversationRouting(args) {
|
|
1587
|
-
const conversationStore = args.conversationStore ?? (await import("./viewer-
|
|
1586
|
+
const conversationStore = args.conversationStore ?? (await import("./viewer-BZ0Hp5Nb.js").then((n) => n.v)).getConversationStore();
|
|
1588
1587
|
const chain = await loadConversationChain(args.conversationId, conversationStore);
|
|
1589
1588
|
let destination;
|
|
1590
1589
|
let source;
|
|
@@ -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-DpN0sWQ6.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.280.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-BeHSXUK6.js";
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { i as getChatConfig } from "./config-
|
|
3
|
-
import { U as normalizeIdentityEmail, V as GOOGLE_IDENTITY_PROVIDER, h as logWarn } from "./logging-
|
|
4
|
-
import { a as isSlackUserId, d as parseSlackChannelReferenceId, f as parseSlackTeamId, s as parseActorUserId } from "./actor-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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-DTAA8Qs_.js";
|
|
2
|
+
import { i as getChatConfig } from "./config-CusBFORe.js";
|
|
3
|
+
import { U as normalizeIdentityEmail, V as GOOGLE_IDENTITY_PROVIDER, h as logWarn } from "./logging-CGnh65_X.js";
|
|
4
|
+
import { a as isSlackUserId, d as parseSlackChannelReferenceId, f as parseSlackTeamId, s as parseActorUserId } from "./actor-6jsm_v96.js";
|
|
5
|
+
import { A as juniorIdentities, M as juniorDestinations, O as conversationReadColumns, S as juniorConversationEvents, _ as juniorConversationParticipants, b as CONVERSATION_METRICS, j as juniorUsers, k as juniorConversations, t as createJuniorSqlExecutor, v as juniorConversationBindings, w as juniorConversationAnnotations, x as juniorConversationMetrics } from "./executor-Cmr0J8W3.js";
|
|
6
|
+
import { d as newConversationEventSchema, f as encodeHistoryPayload, l as decodeStoredConversationEvent, n as detectImageMediaType, o as conversationEventDataSchema, u as historyReplacementSchema, v as usageSchema } from "./media-Dq9_svfQ.js";
|
|
8
7
|
import { a as withLock } from "./locks-D-0h111u.js";
|
|
9
8
|
import { createHash, randomUUID } from "node:crypto";
|
|
10
9
|
import { and, asc, desc, eq, gt, gte, inArray, isNotNull, isNull, lt, lte, ne, or, sql } from "drizzle-orm";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { H as AuthorizationFlowDisabledError, Kt as getTerminalAssistantMessages, Q as abandonTurnRecord, R as PluginCredentialFailureError, Vt as isTurnExecutionLimitExceededError, Z as saveTurnCheckpoint,
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
3
|
-
import { F as SYSTEM_IDENTITY_ID, x as getConversationStore, y as getConversationEventStore } from "./viewer-
|
|
4
|
-
import { _ as sameActorIdentity, p as agentInstructionProvenance } from "./media-
|
|
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-
|
|
1
|
+
import { H as AuthorizationFlowDisabledError, Kt as getTerminalAssistantMessages, Q as abandonTurnRecord, Qa as loadForkHistory, R as PluginCredentialFailureError, Vt as isTurnExecutionLimitExceededError, Z as saveTurnCheckpoint, et as failTurnRecord, s as openConversationProjection, tt as getTurnRecord } from "./projection-C1MghKyI.js";
|
|
2
|
+
import { n as botConfig } from "./config-CusBFORe.js";
|
|
3
|
+
import { F as SYSTEM_IDENTITY_ID, x as getConversationStore, y as getConversationEventStore } from "./viewer-BZ0Hp5Nb.js";
|
|
4
|
+
import { _ as sameActorIdentity, p as agentInstructionProvenance } from "./media-Dq9_svfQ.js";
|
|
5
|
+
import { At as withoutSavedSteeringMessages, It as readBlockedReport, St as recordSubagentStarted, kt as buildSteeringPiMessage, xt as recordSubagentEnded, yt as stopChildAgentsOf } from "./agent-runner-_PYLv4Qo.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-Dlio-o6u.js";
|
|
7
|
+
import { n as getAssistantReplyText } from "./assistant-reply-DbebsAxi.js";
|
|
8
|
+
import { E as maybePostAutomatedTurnLimitNotice, M as recordFinishedTurnForAutomatedLimit, N as resetAutomatedTurnLimit } from "./session-stop-CDEMsNtv.js";
|
|
9
|
+
import { r as appendAndEnqueueInboundMessage } from "./store-QzOfDwKA.js";
|
|
10
|
+
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-CJJsOhXB.js";
|
|
11
|
+
import { a as persistThreadStateById, n as getPersistedSandboxState, r as getPersistedThreadState } from "./thread-state-Bn87cfzE.js";
|
|
12
12
|
import { isDeepStrictEqual } from "node:util";
|
|
13
|
-
import
|
|
13
|
+
import * as z from "zod";
|
|
14
14
|
// src/chat/runtime/turn-execution.ts
|
|
15
15
|
/** An error thrown while the agent advances a Run. */
|
|
16
16
|
var AgentRunError = class extends Error {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { Ct as isInvalidConversationRecordError, St as isFinalAttempt, bt as hasConversationStop } from "./projection-
|
|
3
|
-
import { x 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 isInvalidConversationRecordError, St as isFinalAttempt, bt as hasConversationStop } from "./projection-C1MghKyI.js";
|
|
3
|
+
import { x as isProviderRetryError } from "./client-h2A2ZPzY.js";
|
|
4
|
+
import { i as getChatConfig } from "./config-CusBFORe.js";
|
|
5
|
+
import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-CGnh65_X.js";
|
|
6
|
+
import { g as getTurnRequestDeadline, v as ConversationQueueMessageRejectedError } from "./background-compaction-queue-B9lmh8Ml.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-QzOfDwKA.js";
|
|
8
8
|
// src/chat/task-execution/attempt-selection.ts
|
|
9
9
|
function selectContiguousTurnBatch(messages) {
|
|
10
10
|
const first = messages[0];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.280.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"sharp": "^0.35.3",
|
|
92
92
|
"yaml": "^2.9.0",
|
|
93
93
|
"zod": "^4.5.4",
|
|
94
|
-
"@sentry/junior-plugin-api": "0.
|
|
94
|
+
"@sentry/junior-plugin-api": "0.280.0"
|
|
95
95
|
},
|
|
96
96
|
"peerDependencies": {
|
|
97
97
|
"bullmq": "^6.5.0",
|
|
@@ -126,9 +126,9 @@
|
|
|
126
126
|
"typescript": "^7.0.2",
|
|
127
127
|
"vercel": "^54.4.0",
|
|
128
128
|
"vitest": "^4.1.12",
|
|
129
|
-
"@sentry/junior-github": "0.
|
|
130
|
-
"@sentry/junior-
|
|
131
|
-
"@sentry/junior-
|
|
129
|
+
"@sentry/junior-github": "0.280.0",
|
|
130
|
+
"@sentry/junior-testing": "0.0.0",
|
|
131
|
+
"@sentry/junior-memory": "0.280.0"
|
|
132
132
|
},
|
|
133
133
|
"scripts": {
|
|
134
134
|
"build": "tsdown",
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { getTableColumns, sql } from "drizzle-orm";
|
|
3
|
-
import { boolean, index, integer, jsonb, pgTable, primaryKey, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
|
|
4
|
-
// src/db/schema/timestamps.ts
|
|
5
|
-
const timestamptz = (name) => timestamp(name, { withTimezone: true });
|
|
6
|
-
// src/db/schema/destinations.ts
|
|
7
|
-
const juniorDestinationKindSchema = z.enum([
|
|
8
|
-
"channel",
|
|
9
|
-
"dm",
|
|
10
|
-
"group",
|
|
11
|
-
"local_conversation",
|
|
12
|
-
"thread",
|
|
13
|
-
"web_session"
|
|
14
|
-
]);
|
|
15
|
-
const juniorDestinations = pgTable("junior_destinations", {
|
|
16
|
-
id: text("id").primaryKey(),
|
|
17
|
-
provider: text("provider").notNull(),
|
|
18
|
-
providerTenantId: text("provider_tenant_id").notNull().default(""),
|
|
19
|
-
providerDestinationId: text("provider_destination_id").notNull(),
|
|
20
|
-
kind: text("kind").$type().notNull(),
|
|
21
|
-
parentDestinationId: text("parent_destination_id"),
|
|
22
|
-
displayName: text("display_name"),
|
|
23
|
-
visibility: text("visibility").$type().notNull().default("unknown"),
|
|
24
|
-
metadata: jsonb("metadata_json"),
|
|
25
|
-
createdAt: timestamptz("created_at").notNull(),
|
|
26
|
-
updatedAt: timestamptz("updated_at").notNull()
|
|
27
|
-
}, (table) => [uniqueIndex("junior_destinations_provider_destination_uidx").on(table.provider, table.providerTenantId, table.providerDestinationId), index("junior_destinations_provider_kind_idx").on(table.provider, table.kind)]);
|
|
28
|
-
const juniorUsers = pgTable("junior_users", {
|
|
29
|
-
id: text("id").primaryKey(),
|
|
30
|
-
primaryEmail: text("primary_email").notNull(),
|
|
31
|
-
primaryEmailNormalized: text("primary_email_normalized").notNull(),
|
|
32
|
-
displayName: text("display_name"),
|
|
33
|
-
timezone: text("timezone"),
|
|
34
|
-
/** Text the user saved to change how Junior replies to them. */
|
|
35
|
-
customization: text("customization"),
|
|
36
|
-
/** Junior-wide admin role. Only the `junior admin` CLI changes it. */
|
|
37
|
-
isAdmin: boolean("is_admin").notNull().default(false),
|
|
38
|
-
/** Auto-archive this user's conversations when their work is done. */
|
|
39
|
-
autoArchiveDefault: boolean("auto_archive_default").notNull().default(false),
|
|
40
|
-
/** Hours done work and the conversation stay quiet before auto-archive. */
|
|
41
|
-
autoArchiveGraceHours: integer("auto_archive_grace_hours").notNull().default(24),
|
|
42
|
-
createdAt: timestamptz("created_at").notNull(),
|
|
43
|
-
updatedAt: timestamptz("updated_at").notNull()
|
|
44
|
-
}, (table) => [uniqueIndex("junior_users_primary_email_normalized_uidx").on(table.primaryEmailNormalized)]);
|
|
45
|
-
// src/db/schema/identities.ts
|
|
46
|
-
const juniorIdentities = pgTable("junior_identities", {
|
|
47
|
-
id: text("id").primaryKey(),
|
|
48
|
-
kind: text("kind").$type().notNull(),
|
|
49
|
-
provider: text("provider").notNull(),
|
|
50
|
-
providerTenantId: text("provider_tenant_id").notNull().default(""),
|
|
51
|
-
providerSubjectId: text("provider_subject_id").notNull(),
|
|
52
|
-
displayName: text("display_name"),
|
|
53
|
-
handle: text("handle"),
|
|
54
|
-
email: text("email"),
|
|
55
|
-
avatarUrl: text("avatar_url"),
|
|
56
|
-
metadata: jsonb("metadata_json"),
|
|
57
|
-
createdAt: timestamptz("created_at").notNull(),
|
|
58
|
-
updatedAt: timestamptz("updated_at").notNull(),
|
|
59
|
-
userId: text("user_id").references(() => juniorUsers.id),
|
|
60
|
-
emailNormalized: text("email_normalized"),
|
|
61
|
-
emailVerified: boolean("email_verified").notNull().default(false),
|
|
62
|
-
signedInAt: timestamptz("signed_in_at")
|
|
63
|
-
}, (table) => [
|
|
64
|
-
uniqueIndex("junior_identities_provider_subject_uidx").on(table.provider, table.providerTenantId, table.providerSubjectId),
|
|
65
|
-
index("junior_identities_user_idx").on(table.userId),
|
|
66
|
-
index("junior_identities_verified_email_idx").on(table.emailNormalized).where(sql`${table.emailVerified} = true AND ${table.emailNormalized} IS NOT NULL`),
|
|
67
|
-
index("junior_identities_kind_provider_idx").on(table.kind, table.provider)
|
|
68
|
-
]);
|
|
69
|
-
// src/db/schema/conversations.ts
|
|
70
|
-
const juniorConversations = pgTable("junior_conversations", {
|
|
71
|
-
conversationId: text("conversation_id").primaryKey(),
|
|
72
|
-
schemaVersion: integer("schema_version").notNull().default(1),
|
|
73
|
-
source: text("source").$type(),
|
|
74
|
-
/** Structured session Source locator; set-once on the conversation root. */
|
|
75
|
-
sessionSource: jsonb("source_json").$type(),
|
|
76
|
-
/** Complete Location associated with this Conversation. */
|
|
77
|
-
location: jsonb("location_json").$type(),
|
|
78
|
-
destinationId: text("destination_id").references(() => juniorDestinations.id),
|
|
79
|
-
destination: jsonb("destination_json").$type(),
|
|
80
|
-
actorIdentityId: text("actor_identity_id").references(() => juniorIdentities.id),
|
|
81
|
-
creatorIdentityId: text("creator_identity_id").references(() => juniorIdentities.id),
|
|
82
|
-
credentialSubjectIdentityId: text("credential_subject_identity_id").references(() => juniorIdentities.id),
|
|
83
|
-
actor: jsonb("actor_json").$type(),
|
|
84
|
-
channelName: text("channel_name"),
|
|
85
|
-
title: text("title"),
|
|
86
|
-
createdAt: timestamptz("created_at").notNull(),
|
|
87
|
-
lastActivityAt: timestamptz("last_activity_at").notNull(),
|
|
88
|
-
updatedAt: timestamptz("updated_at").notNull(),
|
|
89
|
-
executionUpdatedAt: timestamptz("execution_updated_at"),
|
|
90
|
-
executionStatus: text("execution_status").$type().notNull(),
|
|
91
|
-
runId: text("run_id"),
|
|
92
|
-
lastCheckpointAt: timestamptz("last_checkpoint_at"),
|
|
93
|
-
lastEnqueuedAt: timestamptz("last_enqueued_at"),
|
|
94
|
-
parentConversationId: text("parent_conversation_id").references(() => juniorConversations.conversationId),
|
|
95
|
-
forkedFromConversationId: text("forked_from_conversation_id").references(() => juniorConversations.conversationId, { onDelete: "set null" }),
|
|
96
|
-
quickQuestionAt: timestamptz("quick_question_at"),
|
|
97
|
-
rootConversationId: text("root_conversation_id").references(() => juniorConversations.conversationId),
|
|
98
|
-
transcriptPurgedAt: timestamptz("transcript_purged_at"),
|
|
99
|
-
/** Latest session stop. Automated input received before it is dropped. */
|
|
100
|
-
stoppedAt: timestamptz("stopped_at"),
|
|
101
|
-
durationMs: integer("duration_ms").notNull().default(0),
|
|
102
|
-
usage: jsonb("usage_json").$type(),
|
|
103
|
-
executionDurationMs: integer("execution_duration_ms").notNull().default(0),
|
|
104
|
-
executionUsage: jsonb("execution_usage_json").$type(),
|
|
105
|
-
metricRunId: text("metric_run_id"),
|
|
106
|
-
detailVersion: integer("detail_version").notNull().default(0),
|
|
107
|
-
legacyArchivedAt: timestamptz("archived_at")
|
|
108
|
-
}, (table) => [
|
|
109
|
-
index("junior_conversations_last_activity_idx").on(table.lastActivityAt.desc(), table.conversationId),
|
|
110
|
-
index("junior_conversations_active_idx").using("btree", sql`coalesce(${table.executionUpdatedAt}, ${table.updatedAt})`, table.conversationId).where(sql`${table.executionStatus} <> 'idle'`),
|
|
111
|
-
index("junior_conversations_destination_activity_idx").on(table.destinationId, table.lastActivityAt.desc()),
|
|
112
|
-
index("junior_conversations_actor_activity_idx").on(table.actorIdentityId, table.lastActivityAt.desc()),
|
|
113
|
-
index("junior_conversations_parent_idx").on(table.parentConversationId),
|
|
114
|
-
index("junior_conversations_forked_from_idx").on(table.forkedFromConversationId),
|
|
115
|
-
index("junior_conversations_root_idx").on(table.rootConversationId)
|
|
116
|
-
]);
|
|
117
|
-
/** Select runtime conversation fields without reading the legacy archive column. */
|
|
118
|
-
function conversationReadColumns() {
|
|
119
|
-
const { legacyArchivedAt, ...columns } = getTableColumns(juniorConversations);
|
|
120
|
-
return columns;
|
|
121
|
-
}
|
|
122
|
-
// src/db/schema/agent-invocations.ts
|
|
123
|
-
const AGENT_INVOCATION_STATUSES = [
|
|
124
|
-
"pending",
|
|
125
|
-
"running",
|
|
126
|
-
"paused",
|
|
127
|
-
"blocked",
|
|
128
|
-
"completed",
|
|
129
|
-
"failed",
|
|
130
|
-
"stopped"
|
|
131
|
-
];
|
|
132
|
-
const AGENT_INVOCATION_MAILBOX_STATUSES = ["pending", "appended"];
|
|
133
|
-
/**
|
|
134
|
-
* Parent mailbox append state. Only terminal invocations have a value.
|
|
135
|
-
* `replaced` means the child still had open work, so a later agent invocation
|
|
136
|
-
* on the same child sends the result instead. `skipped` means a stop ended
|
|
137
|
-
* the work, so the result is never used. `steered` means the agent invocation
|
|
138
|
-
* that was running read the input as a steering message, so its result covers
|
|
139
|
-
* this one.
|
|
140
|
-
*/
|
|
141
|
-
const AGENT_INVOCATION_PARENT_MAILBOX_STATUSES = [
|
|
142
|
-
"pending",
|
|
143
|
-
"appended",
|
|
144
|
-
"replaced",
|
|
145
|
-
"skipped",
|
|
146
|
-
"steered"
|
|
147
|
-
];
|
|
148
|
-
const juniorAgentBindings = pgTable("junior_agent_bindings", {
|
|
149
|
-
parentConversationId: text("parent_conversation_id").notNull().references(() => juniorConversations.conversationId),
|
|
150
|
-
name: text("name").notNull(),
|
|
151
|
-
childConversationId: text("child_conversation_id").notNull().references(() => juniorConversations.conversationId)
|
|
152
|
-
}, (table) => [primaryKey({ columns: [table.parentConversationId, table.name] }), uniqueIndex("junior_agent_bindings_child_idx").on(table.childConversationId)]);
|
|
153
|
-
const juniorAgentInvocations = pgTable("junior_agent_invocations", {
|
|
154
|
-
invocationId: text("invocation_id").primaryKey(),
|
|
155
|
-
parentConversationId: text("parent_conversation_id").notNull().references(() => juniorConversations.conversationId),
|
|
156
|
-
childConversationId: text("child_conversation_id").notNull().references(() => juniorConversations.conversationId),
|
|
157
|
-
agentName: text("agent_name"),
|
|
158
|
-
input: text("input").notNull(),
|
|
159
|
-
title: text("title"),
|
|
160
|
-
actor: jsonb("actor_json").$type().notNull(),
|
|
161
|
-
credentialContext: jsonb("credential_context_json").$type(),
|
|
162
|
-
source: jsonb("source_json").$type().notNull(),
|
|
163
|
-
destination: jsonb("destination_json").$type().notNull(),
|
|
164
|
-
destinationVisibility: text("destination_visibility").$type(),
|
|
165
|
-
agentType: text("agent_type").$type(),
|
|
166
|
-
reasoningLevel: text("reasoning_level").$type(),
|
|
167
|
-
parentToolCallId: text("parent_tool_call_id"),
|
|
168
|
-
status: text("status").$type().notNull(),
|
|
169
|
-
mailboxStatus: text("mailbox_status").$type().notNull(),
|
|
170
|
-
parentMailboxStatus: text("parent_mailbox_status").$type(),
|
|
171
|
-
result: text("result"),
|
|
172
|
-
errorMessage: text("error_message"),
|
|
173
|
-
createdAt: timestamptz("created_at").notNull(),
|
|
174
|
-
updatedAt: timestamptz("updated_at").notNull(),
|
|
175
|
-
terminalAt: timestamptz("terminal_at")
|
|
176
|
-
}, (table) => [
|
|
177
|
-
index("junior_agent_invocations_child_idx").on(table.childConversationId),
|
|
178
|
-
index("junior_agent_invocations_mailbox_idx").on(table.mailboxStatus, table.createdAt),
|
|
179
|
-
index("junior_agent_invocations_parent_mailbox_idx").on(table.parentMailboxStatus, table.terminalAt)
|
|
180
|
-
]);
|
|
181
|
-
export { juniorAgentInvocations as a, juniorIdentities as c, juniorDestinations as d, timestamptz as f, juniorAgentBindings as i, juniorUsers as l, AGENT_INVOCATION_PARENT_MAILBOX_STATUSES as n, conversationReadColumns as o, AGENT_INVOCATION_STATUSES as r, juniorConversations as s, AGENT_INVOCATION_MAILBOX_STATUSES as t, juniorDestinationKindSchema as u };
|