@sentry/junior 0.210.2 → 0.212.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/{agent-DruBLdjK.js → agent-Cgc7jAIH.js} +353 -21
- package/dist/{agent-hooks-BYZAFpgB.js → agent-hooks-B2Yt2b88.js} +207 -47
- package/dist/{agent-runner-Be5K-k2o.js → agent-runner-CkNX-ynf.js} +5 -5
- package/dist/api/schema.js +2 -2
- package/dist/api.d.ts +1 -1
- package/dist/api.js +72 -33
- package/dist/{app-gyu3D9Gn.d.ts → app-D4nNdzPG.d.ts} +1 -1
- package/dist/app.d.ts +1 -1
- package/dist/app.js +32 -32
- package/dist/{auth-pause-state-DedOKgr4.js → auth-pause-state-BbcDkPac.js} +6 -6
- package/dist/{briefs-CQDK-Dj2.js → briefs-4-OVELML.js} +4 -4
- package/dist/{catalog-runtime-Ddk0rxU3.js → catalog-runtime-BvN_lNVo.js} +1 -1
- package/dist/{checkpoint-Cto3lP0d.js → checkpoint-EAQ5Xerb.js} +151 -528
- package/dist/cli/chat.js +13 -13
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +1 -1
- package/dist/cli/plugins.js +3 -3
- package/dist/cli/snapshot-create.js +3 -3
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -3
- package/dist/{client-Dstl8V7v.js → client-C1KycWNq.js} +2 -2
- package/dist/{config-QWyCRQ8L.js → config-C0-PnQoF.js} +2 -2
- package/dist/{conversation-AA4R1VUn.js → conversation-CRWntH-A.js} +19 -19
- package/dist/{conversation-privacy-BIClFm9b.js → conversation-privacy-BFzYxnTS.js} +1 -1
- package/dist/{credential-sync-MFTk0Zba.js → credential-sync-CZz6Vk6X.js} +20 -20
- package/dist/{db-D74z7BZH.d.ts → db-Ca9Nt5ci.d.ts} +1 -1
- package/dist/{execution-stats-BEax3h2o.js → execution-stats-CoDjBQbE.js} +3 -4
- package/dist/{executor-C5onDgaC.js → executor-CaVeGYeA.js} +39 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{job-queue-Dpfxr7U6.js → job-queue-BhaNX9DL.js} +1 -1
- package/dist/{logging-CKkKExae.js → logging-B5-PLvDo.js} +1 -1
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-W_3TiFJo.js → oauth-callback-server-G5q7i0Qp.js} +2 -2
- package/dist/{pending-auth-CUOLqzoR.js → pending-auth-CDndLOLO.js} +2 -2
- package/dist/{profile-DU-tdAeS.js → profile-BcZ6EBQ4.js} +4 -4
- package/dist/{prompt-C1IA4qkj.js → prompt-kRlibHYT.js} +1 -1
- package/dist/{registry-BiaaVqDO.js → registry-BIeo1ST6.js} +1 -1
- package/dist/{resolve-B178kFFr.js → resolve-BgAZ4KxF.js} +2 -2
- package/dist/{runner-CEw5Bd40.js → runner-Cqd0EG3G.js} +10 -10
- package/dist/{sandbox-egress-signals-R9n0mBQr.js → sandbox-egress-signals-DrOoklMj.js} +1 -1
- package/dist/{schema-CwTeb-BF.js → schema-xHUgeh46.js} +1 -1
- package/dist/short-title-CxQHLU3_.js +65 -0
- package/dist/{skills-DNxkkZnA.js → skills-DlrAH1on.js} +2 -2
- package/dist/{spawn-D_d9fLq3.js → spawn-BtMqHjwx.js} +2 -2
- package/dist/{stats-BvEUKgru.js → stats-D5OWazLs.js} +15 -7
- package/dist/{store-Det8MQ9g.d.ts → store-DoewL5mG.d.ts} +3 -2
- package/dist/{task-queue-DkaL57J_.js → task-queue-C-o2Q4O-.js} +3 -3
- package/dist/{task-runner-DDuflo-o.js → task-runner-Mt_TGUBH.js} +8 -8
- package/dist/{thread-state-fcmz8adQ.js → thread-state-C81fvhJu.js} +5 -5
- package/dist/{turn-execution-BNKloE6i.js → turn-execution-Ruj9SSJU.js} +3 -3
- package/dist/{turn-lifecycle-BEcSsBf7.js → turn-lifecycle-xIZNwgaq.js} +1 -1
- package/dist/{validation-CgH5VUx2.js → validation-sgYqCVwr.js} +1 -1
- package/dist/{version-CS4pJjG8.js → version-BE7Zf9Wx.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{web-authorization-D2ts7w_1.js → web-authorization-BXrGezGm.js} +1 -1
- package/dist/{web-input-Bxb1i41z.js → web-input-FJ7NNJDx.js} +4 -4
- package/dist/{work-HzD-98Ng.js → work-DlYdbVfB.js} +9 -9
- package/dist/{worker-DWDTNdyB.js → worker-BfxedsTU.js} +5 -5
- package/migrations/0042_conversation_metrics.sql +26 -0
- package/migrations/meta/0042_snapshot.json +3610 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +5 -5
- package/dist/usage-BU5d5wmV.js +0 -175
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import { F as isRecord$1, I as toOptionalNumber, L as toOptionalString } from "./logging-
|
|
2
|
-
import { a as getChatConfig } from "./config-
|
|
1
|
+
import { F as isRecord$1, I as toOptionalNumber, L as toOptionalString } from "./logging-B5-PLvDo.js";
|
|
2
|
+
import { a as getChatConfig } from "./config-C0-PnQoF.js";
|
|
3
3
|
import { _ as parseSlackMessageTs, d as parseStoredSlackActor, h as parseSlackTeamId, p as parseSlackChannelId } from "./context-Bplcgypl.js";
|
|
4
|
-
import { Gt as getDb, J as withSlackRetries, U as getSlackClient, Wt as getConversationStore,
|
|
4
|
+
import { Gt as getDb, J as withSlackRetries, U as getSlackClient, Wt as getConversationStore, fn as sameDestination, pt as JUNIOR_THREAD_STATE_TTL_MS, u as getPlugins, un as parseDestination } from "./agent-hooks-B2Yt2b88.js";
|
|
5
5
|
import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { C as getDefaultRedisStateAdapterFor, w as getStateAdapter } from "./profile-DU-tdAeS.js";
|
|
6
|
+
import { E as juniorConversations, a as juniorSchedulerRuns, c as juniorStats, l as juniorEventAutomations, o as juniorSchedulerTasks, w as juniorAttachments } from "./executor-CaVeGYeA.js";
|
|
7
|
+
import { C as getDefaultRedisStateAdapterFor, w as getStateAdapter } from "./profile-BcZ6EBQ4.js";
|
|
9
8
|
import "./vercel-queue-DIkVcfK4.js";
|
|
10
9
|
import { z } from "zod";
|
|
11
10
|
import { createHash, randomUUID } from "node:crypto";
|
|
12
11
|
import { and, asc, desc, eq, gte, inArray, isNotNull, isNull, lte, ne, notInArray, or, sql } from "drizzle-orm";
|
|
13
12
|
import { actorUserIdSchema, destinationSchema, destinationVisibilitySchema, eventMatchSchema, eventMatches, eventTypeSchema, normalizeEventIdentifier, slackDestinationSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
|
|
13
|
+
//#region src/chat/tools/execution/tool-input-error.ts
|
|
14
|
+
/** Thrown when a tool fails due to invalid model/user input, not a system error. */
|
|
15
|
+
var ToolInputError = class extends Error {
|
|
16
|
+
constructor(message, options) {
|
|
17
|
+
super(message, options);
|
|
18
|
+
this.name = "ToolInputError";
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
14
22
|
//#region src/chat/state/turn-id.ts
|
|
15
23
|
/** Build a stable turn identifier from a message ID. */
|
|
16
24
|
function buildDeterministicTurnId(messageId) {
|
|
@@ -2681,4 +2689,4 @@ async function readStats(start, end) {
|
|
|
2681
2689
|
return await getDb().select().from(juniorStats).where(and(gte(juniorStats.date, start), lte(juniorStats.date, end))).orderBy(asc(juniorStats.date), asc(juniorStats.namespace), asc(juniorStats.metric), asc(juniorStats.name));
|
|
2682
2690
|
}
|
|
2683
2691
|
//#endregion
|
|
2684
|
-
export { workspaceSnapshotFinishedEvent as $, eventAutomationTriggerAvailable as A, recordConversationRetry as At, createEventAutomation as B, hasRunnableConversationWork$1 as Bt, SCHEDULED_AUTOMATION_SYSTEM_ACTOR as C, drainConversationMailbox as Ct, eventAutomationMatchesDestination as D, hasRunnableConversationWork as Dt, eventAutomationListToolResultSchema as E, getConversationWorkState as Et, effectiveTaskOutcomes as F, startConversationWork as Ft, listDeletedEventAutomationsCreatedBy as G, makeStructuredToolOutput as Gt, eventAutomationBelongsToUser as H, isInvalidConversationRecordError as Ht, moveTaskOutcomes as I, stopConversationWork as It, listPublicEventAutomationsForTeams as J, listEventAutomationsCreatedBy as K, buildDeterministicAssistantMessageId as Kt, resolveTaskOutcomes as L, CONVERSATION_WORK_CHECK_IN_INTERVAL_MS as Lt, requireEventAutomationSlackContext as M, removeActiveConversation as Mt, requireSupportedEventAutomationTrigger as N, requestAnotherSlice as Nt, eventAutomationToolResult as O, listActiveConversationIds as Ot, writableEventAutomation as P, requestConversationWork as Pt, WORKSPACE_SNAPSHOT_READY_EVENT as Q, taskOutcomeInputSchema as R, CONVERSATION_WORK_STALE_ENQUEUE_MS as Rt, withScheduledAutomationLock as S, deadLetterAttempt as St, compactEventAutomation as T, getConversation as Tt, findMatchingEventAutomations as U, injectContinuationToolName as Ut, deleteEventAutomation as V, isFinalAttempt as Vt, getEventAutomation as W, juniorToolOutputSchema as Wt, getEventCatalog as X, saveEventAutomation as Y, WORKSPACE_SNAPSHOT_FAILED_EVENT as Z, parseScheduledAutomationRow as _, clearConsumedConversationWake as _t, requestAttachmentDeletion as a, normalizeCatalogEventIdentifier as at, saveScheduledAutomationInLock as b, completeConversationWork as bt, parseSlackThreadId as c, registeredEventTypeSchema as ct, resolveSlackChannelIdFromThreadId as d, ackMessages as dt, workspaceSnapshotWatch as et, createScheduledAutomation as f, appendAndEnqueueExclusiveInboundMessage as ft, listScheduledAutomationsForTeam as g, checkInConversationWork as gt, listScheduledAutomations as h, cancelHumanFacingPendingMessages as ht, readLiveAttachment as i, hasPluginEventCatalogEntries as it, registeredEventAutomationTriggerSchema as j, releaseConversationWork as jt, eventAutomationToolResultSchema as k, recordAttemptFailure as kt, readSlackRawMessageContext as l, registeredResourceTypeSchema as lt, listPublicScheduledAutomationsForTeams as m, beginConversationResume as mt, readStats as n, eventNamespaceSchema as nt, storeAttachment as o, pluginSupportsEvent as ot, isListedScheduledAutomation as p, appendAndEnqueueInboundMessage as pt, listEventAutomationsForTeam as q, buildDeterministicTurnId as qt, collectAttachmentGarbage as r, hasEventCatalogEntries as rt, storeAttachments as s, registeredEventMatchSchema as st, incrementStat as t, eventGuidance as tt, resolveSlackChannelIdFromMessage as u, requireSupportedEventMatch as ut, readScheduledAutomation as v, clearExpiredConversationLease as vt, scheduledRunSchema as w, ensureConversationWake as wt, scheduledRunId as x, countPendingConversationMessages as xt, saveScheduledAutomation as y, completeConversationStop as yt, collectEventAutomationMatchKeys as z, hasConversationStop as zt };
|
|
2692
|
+
export { workspaceSnapshotFinishedEvent as $, eventAutomationTriggerAvailable as A, recordConversationRetry as At, createEventAutomation as B, hasRunnableConversationWork$1 as Bt, SCHEDULED_AUTOMATION_SYSTEM_ACTOR as C, drainConversationMailbox as Ct, eventAutomationMatchesDestination as D, hasRunnableConversationWork as Dt, eventAutomationListToolResultSchema as E, getConversationWorkState as Et, effectiveTaskOutcomes as F, startConversationWork as Ft, listDeletedEventAutomationsCreatedBy as G, makeStructuredToolOutput as Gt, eventAutomationBelongsToUser as H, isInvalidConversationRecordError as Ht, moveTaskOutcomes as I, stopConversationWork as It, listPublicEventAutomationsForTeams as J, ToolInputError as Jt, listEventAutomationsCreatedBy as K, buildDeterministicAssistantMessageId as Kt, resolveTaskOutcomes as L, CONVERSATION_WORK_CHECK_IN_INTERVAL_MS as Lt, requireEventAutomationSlackContext as M, removeActiveConversation as Mt, requireSupportedEventAutomationTrigger as N, requestAnotherSlice as Nt, eventAutomationToolResult as O, listActiveConversationIds as Ot, writableEventAutomation as P, requestConversationWork as Pt, WORKSPACE_SNAPSHOT_READY_EVENT as Q, taskOutcomeInputSchema as R, CONVERSATION_WORK_STALE_ENQUEUE_MS as Rt, withScheduledAutomationLock as S, deadLetterAttempt as St, compactEventAutomation as T, getConversation as Tt, findMatchingEventAutomations as U, injectContinuationToolName as Ut, deleteEventAutomation as V, isFinalAttempt as Vt, getEventAutomation as W, juniorToolOutputSchema as Wt, getEventCatalog as X, saveEventAutomation as Y, WORKSPACE_SNAPSHOT_FAILED_EVENT as Z, parseScheduledAutomationRow as _, clearConsumedConversationWake as _t, requestAttachmentDeletion as a, normalizeCatalogEventIdentifier as at, saveScheduledAutomationInLock as b, completeConversationWork as bt, parseSlackThreadId as c, registeredEventTypeSchema as ct, resolveSlackChannelIdFromThreadId as d, ackMessages as dt, workspaceSnapshotWatch as et, createScheduledAutomation as f, appendAndEnqueueExclusiveInboundMessage as ft, listScheduledAutomationsForTeam as g, checkInConversationWork as gt, listScheduledAutomations as h, cancelHumanFacingPendingMessages as ht, readLiveAttachment as i, hasPluginEventCatalogEntries as it, registeredEventAutomationTriggerSchema as j, releaseConversationWork as jt, eventAutomationToolResultSchema as k, recordAttemptFailure as kt, readSlackRawMessageContext as l, registeredResourceTypeSchema as lt, listPublicScheduledAutomationsForTeams as m, beginConversationResume as mt, readStats as n, eventNamespaceSchema as nt, storeAttachment as o, pluginSupportsEvent as ot, isListedScheduledAutomation as p, appendAndEnqueueInboundMessage as pt, listEventAutomationsForTeam as q, buildDeterministicTurnId as qt, collectAttachmentGarbage as r, hasEventCatalogEntries as rt, storeAttachments as s, registeredEventMatchSchema as st, incrementStat as t, eventGuidance as tt, resolveSlackChannelIdFromMessage as u, requireSupportedEventMatch as ut, readScheduledAutomation as v, clearExpiredConversationLease as vt, scheduledRunSchema as w, ensureConversationWake as wt, scheduledRunId as x, countPendingConversationMessages as xt, saveScheduledAutomation as y, completeConversationStop as yt, collectEventAutomationMatchKeys as z, hasConversationStop as zt };
|
|
@@ -178,12 +178,13 @@ interface ConversationStore {
|
|
|
178
178
|
visibility?: ConversationPrivacy;
|
|
179
179
|
}): Promise<void>;
|
|
180
180
|
/**
|
|
181
|
-
*
|
|
182
|
-
*
|
|
181
|
+
* Store execution state and one Run's metrics.
|
|
182
|
+
* Conversation metric fields cache totals for existing readers.
|
|
183
183
|
*/
|
|
184
184
|
recordExecution(args: {
|
|
185
185
|
channelName?: string;
|
|
186
186
|
conversationId: string;
|
|
187
|
+
/** When this Run started. */
|
|
187
188
|
createdAtMs: number;
|
|
188
189
|
destination?: Destination;
|
|
189
190
|
execution: ConversationExecution;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { f as logWarn } from "./logging-
|
|
1
|
+
import { f as logWarn } from "./logging-B5-PLvDo.js";
|
|
2
2
|
import { a as signQueueMessage, i as QUEUE_SIGNATURE_MAX_AGE_MS, o as verifyQueueMessage, s as createVercelQueueClient } from "./vercel-queue-DIkVcfK4.js";
|
|
3
|
-
import { o as runWithTurnRequestDeadline } from "./job-queue-
|
|
3
|
+
import { o as runWithTurnRequestDeadline } from "./job-queue-BhaNX9DL.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { handleCallback, registerDevConsumer } from "@vercel/queue";
|
|
@@ -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-Mt_TGUBH.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-B4FMCO8f.js";
|
|
2
2
|
import { _ as parseSlackMessageTs, r as credentialSubjectSchema } from "./context-Bplcgypl.js";
|
|
3
|
-
import { At as createPluginConversationEvents, Gt as getDb, Q as readActorIdentity, Wt as getConversationStore, _t as createPluginState, bt as createPluginLogger, p as coreTaskRegistrations, pt as JUNIOR_THREAD_STATE_TTL_MS, u as getPlugins, vt as createPluginEmbedder, yt as createPluginModel } from "./agent-hooks-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { w as getStateAdapter } from "./profile-
|
|
7
|
-
import { u as recordAutomationExecution } from "./execution-stats-
|
|
8
|
-
import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-
|
|
9
|
-
import { i as pluginTaskParamsSchema, o as sendVercelPluginTask, r as pluginTaskId } from "./task-queue-
|
|
3
|
+
import { At as createPluginConversationEvents, Gt as getDb, Q as readActorIdentity, Wt as getConversationStore, _t as createPluginState, bt as createPluginLogger, p as coreTaskRegistrations, pt as JUNIOR_THREAD_STATE_TTL_MS, u as getPlugins, vt as createPluginEmbedder, yt as createPluginModel } from "./agent-hooks-B2Yt2b88.js";
|
|
4
|
+
import { G as sameActorIdentity } from "./conversation-CRWntH-A.js";
|
|
5
|
+
import { E as normalizeToolNameFromResult, O as stripRuntimeTurnContext, T as isToolResultMessage, Y as hydrateConversationMessages, _ as getPiMessageRole, s as getTurnRecord, w as isToolResultError, x as instructionTextForProjection } from "./checkpoint-EAQ5Xerb.js";
|
|
6
|
+
import { w as getStateAdapter } from "./profile-BcZ6EBQ4.js";
|
|
7
|
+
import { u as recordAutomationExecution } from "./execution-stats-CoDjBQbE.js";
|
|
8
|
+
import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-C81fvhJu.js";
|
|
9
|
+
import { i as pluginTaskParamsSchema, o as sendVercelPluginTask, r as pluginTaskId } from "./task-queue-C-o2Q4O-.js";
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
import { createHash } from "node:crypto";
|
|
12
12
|
import { destinationSchema, destinationVisibilitySchema, isSlackDestination, pluginRunContextSchema, replyAttributionSchema, sourceSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
|
|
@@ -345,7 +345,7 @@ function slackSourceForDestination(args) {
|
|
|
345
345
|
* Reads parent Conversations when this Conversation has no Destination.
|
|
346
346
|
*/
|
|
347
347
|
async function resolveConversationRouting(args) {
|
|
348
|
-
const conversationStore = args.conversationStore ?? (await import("./agent-hooks-
|
|
348
|
+
const conversationStore = args.conversationStore ?? (await import("./agent-hooks-B2Yt2b88.js").then((n) => n.Vt)).getConversationStore();
|
|
349
349
|
const chain = await loadConversationChain(args.conversationId, conversationStore);
|
|
350
350
|
let destination;
|
|
351
351
|
let source;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { F as isRecord, I as toOptionalNumber, L as toOptionalString } from "./logging-
|
|
2
|
-
import { Gt as getDb, pt as JUNIOR_THREAD_STATE_TTL_MS } from "./agent-hooks-
|
|
1
|
+
import { F as isRecord, I as toOptionalNumber, L as toOptionalString } from "./logging-B5-PLvDo.js";
|
|
2
|
+
import { Gt as getDb, pt as JUNIOR_THREAD_STATE_TTL_MS } from "./agent-hooks-B2Yt2b88.js";
|
|
3
3
|
import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
|
|
4
|
-
import { u as juniorLocationConfigurations } from "./executor-
|
|
5
|
-
import {
|
|
6
|
-
import { w as getStateAdapter } from "./profile-
|
|
4
|
+
import { u as juniorLocationConfigurations } from "./executor-CaVeGYeA.js";
|
|
5
|
+
import { X as persistConversationMessages } from "./checkpoint-EAQ5Xerb.js";
|
|
6
|
+
import { w as getStateAdapter } from "./profile-BcZ6EBQ4.js";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { randomUUID } from "node:crypto";
|
|
9
9
|
import { and, eq, sql } from "drizzle-orm";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Ht as getConversationEventStore } from "./agent-hooks-
|
|
2
|
-
import { n as runAgentWithTimeout } from "./agent-runner-
|
|
3
|
-
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-
|
|
1
|
+
import { Ht as getConversationEventStore } from "./agent-hooks-B2Yt2b88.js";
|
|
2
|
+
import { n as runAgentWithTimeout } from "./agent-runner-CkNX-ynf.js";
|
|
3
|
+
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-xIZNwgaq.js";
|
|
4
4
|
//#region src/chat/runtime/turn-execution.ts
|
|
5
5
|
/** An error thrown while the agent advances a Run. */
|
|
6
6
|
var AgentRunError = class extends Error {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ht as getConversationEventStore } from "./agent-hooks-
|
|
1
|
+
import { Ht as getConversationEventStore } from "./agent-hooks-B2Yt2b88.js";
|
|
2
2
|
//#region src/chat/conversations/turn-lifecycle.ts
|
|
3
3
|
/** Persist correlated turn lifecycle facts with retry-safe terminal exclusion. */
|
|
4
4
|
var ConversationTurnLifecycleService = class {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
2
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BvN_lNVo.js";
|
|
3
3
|
import { isDeepStrictEqual } from "node:util";
|
|
4
4
|
//#region src/chat/plugins/validation.ts
|
|
5
5
|
var validation_exports = /* @__PURE__ */ __exportAll({
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
1
|
+
import { t as JUNIOR_VERSION } from "./version-BE7Zf9Wx.js";
|
|
2
2
|
export { JUNIOR_VERSION };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { w as getStateAdapter } from "./profile-
|
|
1
|
+
import { w as getStateAdapter } from "./profile-BcZ6EBQ4.js";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
//#region src/chat/conversations/web-authorization.ts
|
|
4
4
|
const WEB_AUTHORIZATION_PREFIX = "junior:web_authorization:v1";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { f as logWarn } from "./logging-
|
|
2
|
-
import { s as getSlackBotToken } from "./config-
|
|
1
|
+
import { f as logWarn } from "./logging-B5-PLvDo.js";
|
|
2
|
+
import { s as getSlackBotToken } from "./config-C0-PnQoF.js";
|
|
3
3
|
import "./context-Bplcgypl.js";
|
|
4
|
-
import { K as normalizeSlackConversationId, Wt as getConversationStore } from "./agent-hooks-
|
|
5
|
-
import { c as parseSlackThreadId, ft as appendAndEnqueueExclusiveInboundMessage, pt as appendAndEnqueueInboundMessage, qt as buildDeterministicTurnId } from "./stats-
|
|
4
|
+
import { K as normalizeSlackConversationId, Wt as getConversationStore } from "./agent-hooks-B2Yt2b88.js";
|
|
5
|
+
import { c as parseSlackThreadId, ft as appendAndEnqueueExclusiveInboundMessage, pt as appendAndEnqueueInboundMessage, qt as buildDeterministicTurnId } from "./stats-D5OWazLs.js";
|
|
6
6
|
import { t as healthReportSchema } from "./reporting-schema-DosTN__Q.js";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { createHash } from "node:crypto";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
-
import { $ as AuthorizationFlowDisabledError, A as createAgentInvocationSchema, M as AgentInvocationLimitError, O as agentBindingSchema, f as PluginCredentialFailureError, j as AgentInvocationBusyError, k as agentInvocationSchema } from "./agent-
|
|
3
|
-
import { Ht as getConversationEventStore, Kt as getSqlExecutor, Wt as getConversationStore } from "./agent-hooks-
|
|
4
|
-
import { f as juniorAgentBindings, p as juniorAgentInvocations } from "./executor-
|
|
5
|
-
import {
|
|
6
|
-
import { pt as appendAndEnqueueInboundMessage } from "./stats-
|
|
7
|
-
import { _ as isTurnInputCommitLostError, h as getConversationTurnBoundaryError, p as TurnInputCommitLostError, s as getAssistantReplyText } from "./pending-auth-
|
|
8
|
-
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-
|
|
9
|
-
import { n as executeTurn, t as AgentRunError } from "./turn-execution-
|
|
10
|
-
import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState } from "./thread-state-
|
|
2
|
+
import { $ as AuthorizationFlowDisabledError, A as createAgentInvocationSchema, M as AgentInvocationLimitError, O as agentBindingSchema, f as PluginCredentialFailureError, j as AgentInvocationBusyError, k as agentInvocationSchema } from "./agent-Cgc7jAIH.js";
|
|
3
|
+
import { Ht as getConversationEventStore, Kt as getSqlExecutor, Wt as getConversationStore } from "./agent-hooks-B2Yt2b88.js";
|
|
4
|
+
import { f as juniorAgentBindings, p as juniorAgentInvocations } from "./executor-CaVeGYeA.js";
|
|
5
|
+
import { L as openConversationProjection, o as failTurnRecord, r as saveTurnCheckpoint, s as getTurnRecord, v as getTerminalAssistantMessages } from "./checkpoint-EAQ5Xerb.js";
|
|
6
|
+
import { pt as appendAndEnqueueInboundMessage } from "./stats-D5OWazLs.js";
|
|
7
|
+
import { _ as isTurnInputCommitLostError, h as getConversationTurnBoundaryError, p as TurnInputCommitLostError, s as getAssistantReplyText } from "./pending-auth-CDndLOLO.js";
|
|
8
|
+
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-xIZNwgaq.js";
|
|
9
|
+
import { n as executeTurn, t as AgentRunError } from "./turn-execution-Ruj9SSJU.js";
|
|
10
|
+
import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState } from "./thread-state-C81fvhJu.js";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { createHash } from "node:crypto";
|
|
13
13
|
import { and, asc, count, eq, inArray } from "drizzle-orm";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
-
import { b as isProviderRetryError } from "./client-
|
|
3
|
-
import { S as withLogContext, d as logInfo, f as logWarn, u as logException } from "./logging-
|
|
4
|
-
import { a as getChatConfig } from "./config-
|
|
5
|
-
import { At as recordConversationRetry, Ct as drainConversationMailbox, Et as getConversationWorkState, Ft as startConversationWork, Ht as isInvalidConversationRecordError, Nt as requestAnotherSlice, St as deadLetterAttempt, Vt as isFinalAttempt, _t as clearConsumedConversationWake, bt as completeConversationWork, dt as ackMessages, gt as checkInConversationWork, jt as releaseConversationWork, kt as recordAttemptFailure, mt as beginConversationResume, wt as ensureConversationWake, xt as countPendingConversationMessages, yt as completeConversationStop, zt as hasConversationStop } from "./stats-
|
|
2
|
+
import { b as isProviderRetryError } from "./client-C1KycWNq.js";
|
|
3
|
+
import { S as withLogContext, d as logInfo, f as logWarn, u as logException } from "./logging-B5-PLvDo.js";
|
|
4
|
+
import { a as getChatConfig } from "./config-C0-PnQoF.js";
|
|
5
|
+
import { At as recordConversationRetry, Ct as drainConversationMailbox, Et as getConversationWorkState, Ft as startConversationWork, Ht as isInvalidConversationRecordError, Nt as requestAnotherSlice, St as deadLetterAttempt, Vt as isFinalAttempt, _t as clearConsumedConversationWake, bt as completeConversationWork, dt as ackMessages, gt as checkInConversationWork, jt as releaseConversationWork, kt as recordAttemptFailure, mt as beginConversationResume, wt as ensureConversationWake, xt as countPendingConversationMessages, yt as completeConversationStop, zt as hasConversationStop } from "./stats-D5OWazLs.js";
|
|
6
6
|
import { c as ConversationQueueMessageRejectedError } from "./vercel-queue-DIkVcfK4.js";
|
|
7
|
-
import { a as getTurnRequestDeadline } from "./job-queue-
|
|
7
|
+
import { a as getTurnRequestDeadline } from "./job-queue-BhaNX9DL.js";
|
|
8
8
|
//#region 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,26 @@
|
|
|
1
|
+
CREATE TABLE "junior_conversation_metrics" (
|
|
2
|
+
"conversation_id" text NOT NULL,
|
|
3
|
+
"run_id" text NOT NULL,
|
|
4
|
+
"metric" text NOT NULL,
|
|
5
|
+
"value" double precision NOT NULL,
|
|
6
|
+
"occurred_at" timestamp with time zone NOT NULL,
|
|
7
|
+
"updated_at" timestamp with time zone NOT NULL,
|
|
8
|
+
CONSTRAINT "junior_conversation_metrics_conversation_id_run_id_metric_pk" PRIMARY KEY("conversation_id","run_id","metric")
|
|
9
|
+
);
|
|
10
|
+
--> statement-breakpoint
|
|
11
|
+
ALTER TABLE "junior_conversation_metrics" ADD CONSTRAINT "junior_conversation_metrics_conversation_id_junior_conversations_conversation_id_fk" FOREIGN KEY ("conversation_id") REFERENCES "public"."junior_conversations"("conversation_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
12
|
+
CREATE INDEX "junior_conversation_metrics_occurred_at_metric_idx" ON "junior_conversation_metrics" USING btree ("occurred_at","metric");--> statement-breakpoint
|
|
13
|
+
INSERT INTO "junior_conversation_metrics" ("conversation_id", "run_id", "metric", "value", "occurred_at", "updated_at")
|
|
14
|
+
SELECT conversation_id, coalesce(metric_run_id, 'legacy:' || conversation_id), metric, value, updated_at, updated_at
|
|
15
|
+
FROM junior_conversations
|
|
16
|
+
CROSS JOIN LATERAL (VALUES
|
|
17
|
+
('duration_ms', duration_ms::double precision),
|
|
18
|
+
('total_tokens', CASE WHEN coalesce(usage_json->>'inputTokens', usage_json->>'outputTokens', usage_json->>'cachedInputTokens', usage_json->>'cacheCreationTokens') IS NOT NULL THEN coalesce((usage_json->>'inputTokens')::double precision, 0) + coalesce((usage_json->>'outputTokens')::double precision, 0) + coalesce((usage_json->>'cachedInputTokens')::double precision, 0) + coalesce((usage_json->>'cacheCreationTokens')::double precision, 0) ELSE (usage_json->>'totalTokens')::double precision END),
|
|
19
|
+
('input_tokens', (usage_json->>'inputTokens')::double precision),
|
|
20
|
+
('output_tokens', (usage_json->>'outputTokens')::double precision),
|
|
21
|
+
('cached_input_tokens', (usage_json->>'cachedInputTokens')::double precision),
|
|
22
|
+
('cache_creation_tokens', (usage_json->>'cacheCreationTokens')::double precision),
|
|
23
|
+
('reasoning_tokens', (usage_json->>'reasoningTokens')::double precision),
|
|
24
|
+
('cost_usd', CASE WHEN usage_json->'cost'->>'total' IS NOT NULL THEN (usage_json->'cost'->>'total')::double precision WHEN coalesce(usage_json->'cost'->>'input', usage_json->'cost'->>'output', usage_json->'cost'->>'cacheRead', usage_json->'cost'->>'cacheWrite') IS NOT NULL THEN coalesce((usage_json->'cost'->>'input')::double precision, 0) + coalesce((usage_json->'cost'->>'output')::double precision, 0) + coalesce((usage_json->'cost'->>'cacheRead')::double precision, 0) + coalesce((usage_json->'cost'->>'cacheWrite')::double precision, 0) END)
|
|
25
|
+
) AS metric_rows(metric, value)
|
|
26
|
+
WHERE value IS NOT NULL AND value >= 0;
|