@sentry/junior 0.287.0 → 0.289.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapter-CL-HUKgd.js → adapter-tE1wnl0T.js} +1 -1
- package/dist/{admin-C9urXVfi.js → admin-BmsPbmO_.js} +2 -2
- package/dist/{agent-runner-Bfnw551N.js → agent-runner-bvl8U5uH.js} +489 -165
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +7 -7
- package/dist/api.d.ts +1 -1
- package/dist/api.js +628 -238
- package/dist/{app-DBY5TnfY.d.ts → app-Cu454FXq.d.ts} +2 -2
- package/dist/app.d.ts +1 -1
- package/dist/app.js +550 -71
- package/dist/assistant-reply-1N9oxyyb.js +58 -0
- package/dist/{automation-DksGNDRO.js → automation-DWbjJltM.js} +2 -2
- package/dist/{background-compaction-queue-CYI909P5.js → background-compaction-queue-D36oCldp.js} +161 -90
- package/dist/{briefs-DaXiMWzT.js → briefs-CV-1qkXa.js} +3 -3
- package/dist/{catalog-runtime-BCIuBe4d.js → catalog-runtime-BNK4uJVZ.js} +1 -1
- package/dist/cli/chat.js +14 -14
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.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/{config-CkHcUMN7.js → config-DHAy7XlP.js} +363 -8
- package/dist/{connections-BnIj0wtx.js → connections-C3VmH3cf.js} +7 -129
- package/dist/{conversation-E7ZPJx2H.js → conversation-CwC8K3RZ.js} +22 -5
- package/dist/{conversation-pending-messages-DVch6YQw.js → conversation-pending-messages-B0cuLReP.js} +1 -1
- package/dist/{conversation-privacy-DF1hW0ja.js → conversation-privacy-Bky_veSp.js} +1 -1
- package/dist/{credential-sync-CzMar9hq.js → credential-sync-dY9o0YSj.js} +28 -20
- package/dist/{db-DJ11eZqq.js → db-BS2Kql3j.js} +81 -46
- package/dist/{db-YDKKDxlh.d.ts → db-BebRmhsH.d.ts} +10 -2
- package/dist/{executor-BY9TB31g.js → executor-cc4nH86C.js} +125 -18
- package/dist/instrumentation.js +2 -2
- package/dist/{logging-BO5zU6Mt.js → logging-CtCJmt9p.js} +3 -2
- package/dist/{media-Cz1ZiV1U.js → media-BepyEUNm.js} +5 -1
- package/dist/{message-CsUbuEc8.js → message-C5VuRcP9.js} +9 -9
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +19 -41
- package/dist/{oauth-callback-server-hiDKK0_n.js → oauth-callback-server-KRrYUZ35.js} +2 -2
- package/dist/{projection-CL_YWeGf.js → projection-BFJG58TG.js} +448 -721
- package/dist/{prompt-BHOEQSmf.js → prompt-D15oftoL.js} +5 -5
- package/dist/{registry-BriFLnaJ.js → registry-C_JrgqUz.js} +1 -1
- package/dist/{resolve-Bt6GgAiA.js → resolve-Cn_7JfP-.js} +3 -3
- package/dist/{result-Bo1TZu0Q.js → result-CIbQFLp6.js} +16 -10
- package/dist/{runner-D3YeCQgt.js → runner-BwmaMJVO.js} +8 -8
- package/dist/{sandbox-egress-signals-CcnSPP4S.js → sandbox-egress-signals-BOQ8gn7i.js} +1 -1
- package/dist/{schedule-BTp__wrw.js → schedule-cP0AACm1.js} +11 -2
- package/dist/{schema-BWE3RJEB.js → schema-Bptz19Ja.js} +72 -14
- package/dist/{schema-C6fsEwjo.d.ts → schema-DQaFSkZZ.d.ts} +122 -3
- package/dist/{service-account-DiQQuuw7.js → service-account-AGw_pANb.js} +3 -3
- package/dist/{service-account-r6fl0b-9.js → service-account-CLZfF8O1.js} +3 -3
- package/dist/{session-stop-B2Nut40V.js → session-stop-CbzKf7UI.js} +84 -31
- package/dist/{skills-CD5aJdzg.js → skills-CcAJBquq.js} +2 -2
- package/dist/{spawn-CalgZQiu.js → spawn-BvAk2vTI.js} +5 -5
- package/dist/{stop-kujZLbi0.js → stop-BQU4u7la.js} +893 -519
- package/dist/{store-DdIEUL1q.js → store-DE7NJOvQ.js} +4 -16
- package/dist/{task-runner-D_RDr2Hu.js → task-runner-Q_7duP_T.js} +31 -27
- package/dist/{turn-failure-response-B5nV1Er-.js → turn-failure-response-aWZLfUM8.js} +18 -9
- package/dist/{validation-K4pqwoVZ.js → validation-BOoPeIJR.js} +1 -1
- package/dist/{version-DBvhk1X9.js → version-Db0MFy61.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-DrMmFUul.js → viewer-FFEFu9In.js} +4 -4
- package/dist/warmup-DDzrA9Gv.js +967 -0
- package/dist/{work-ljRoODGu.js → work-BBJK458E.js} +16 -15
- package/dist/{worker-CYO1Q0Js.js → worker-2iU5RFyq.js} +7 -31
- package/migrations/0089_conversation_paused_status.sql +3 -0
- package/migrations/0090_guardian_review_time_index.sql +20 -0
- package/migrations/0091_conversation_participant_unsubscribed_index.sql +20 -0
- package/migrations/0092_turn_metric_actor.sql +12 -0
- package/migrations/0093_participant_root_actor_backfill.sql +18 -0
- package/migrations/0094_conversation_delivery_paused_at.sql +1 -0
- package/migrations/meta/0089_snapshot.json +4372 -0
- package/migrations/meta/0090_snapshot.json +4388 -0
- package/migrations/meta/0091_snapshot.json +4410 -0
- package/migrations/meta/0092_snapshot.json +4446 -0
- package/migrations/meta/0093_snapshot.json +4446 -0
- package/migrations/meta/0094_snapshot.json +4452 -0
- package/migrations/meta/_journal.json +42 -0
- package/package.json +6 -5
- package/dist/assistant-reply-u_PRYzuz.js +0 -65
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
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-
|
|
5
|
-
import { h as contextProvenance, m as agentInstructionProvenance, v as sameActorIdentity } from "./media-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { r as appendAndEnqueueInboundMessage } from "./store-
|
|
12
|
-
import { _t as
|
|
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-BFJG58TG.js";
|
|
2
|
+
import { n as botConfig } from "./config-DHAy7XlP.js";
|
|
3
|
+
import { T as SYSTEM_IDENTITY_ID, a as getConversationStore, r as getConversationEventStore, s as getSqlExecutor } from "./db-BS2Kql3j.js";
|
|
4
|
+
import { g as juniorAgentInvocations, h as juniorAgentBindings } from "./executor-cc4nH86C.js";
|
|
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-bvl8U5uH.js";
|
|
7
|
+
import { k as getTurnRequestDeadline } from "./background-compaction-queue-D36oCldp.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-aWZLfUM8.js";
|
|
9
|
+
import { n as getAssistantReplyText } from "./assistant-reply-1N9oxyyb.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-CbzKf7UI.js";
|
|
11
|
+
import { r as appendAndEnqueueInboundMessage } from "./store-DE7NJOvQ.js";
|
|
12
|
+
import { _t as persistThreadStateById, ht as getPersistedThreadState, mt as getPersistedSandboxState, vt as coerceThreadConversationState } from "./task-runner-Q_7duP_T.js";
|
|
13
13
|
import { isDeepStrictEqual } from "node:util";
|
|
14
14
|
import * as z from "zod";
|
|
15
15
|
import { and, eq } from "drizzle-orm";
|
|
@@ -124,7 +124,8 @@ async function createAgentInvocation(rawInput, nowMs = Date.now()) {
|
|
|
124
124
|
kind: input.kind,
|
|
125
125
|
parentConversationId: input.parentConversationId,
|
|
126
126
|
nowMs,
|
|
127
|
-
source: "internal"
|
|
127
|
+
source: "internal",
|
|
128
|
+
...input.title ? { title: input.title } : void 0
|
|
128
129
|
});
|
|
129
130
|
if (input.agentName) await getSqlExecutor().db().insert(juniorAgentBindings).values({
|
|
130
131
|
childConversationId,
|
|
@@ -302,7 +303,7 @@ function buildAgentInvocationInboundMessage(invocation, nowMs = Date.now()) {
|
|
|
302
303
|
/** Append one invocation to its child mailbox and send the normal queue wake. */
|
|
303
304
|
async function enqueueAgentInvocation(invocation, options) {
|
|
304
305
|
if (invocation.mailboxStatus === "appended" || isTerminalAgentInvocation(invocation)) return;
|
|
305
|
-
await recordSubagentStarted(invocation);
|
|
306
|
+
await recordSubagentStarted(invocation, options.eventMeta);
|
|
306
307
|
if (invocation.parentToolCallId !== void 0) await resumeStoppedConversationTree(invocation.childConversationId, invocation.createdAtMs);
|
|
307
308
|
const nowMs = options.nowMs ?? Date.now();
|
|
308
309
|
await appendAndEnqueueInboundMessage({
|
|
@@ -569,7 +570,7 @@ async function saveAgentInvocationResult(args) {
|
|
|
569
570
|
errorMessage: args.result.blocked.missing,
|
|
570
571
|
status: "blocked"
|
|
571
572
|
} : {
|
|
572
|
-
result: args.result.text,
|
|
573
|
+
result: args.result.text || (args.result.noReply?.note ?? ""),
|
|
573
574
|
status: "completed"
|
|
574
575
|
}
|
|
575
576
|
});
|
|
@@ -1,34 +1,10 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
function selectContiguousTurnBatch(messages) {
|
|
9
|
-
const first = messages[0];
|
|
10
|
-
if (!first) return [];
|
|
11
|
-
const nextTurnIndex = messages.findIndex((message) => message.input.authorId !== first.input.authorId || message.source !== first.source);
|
|
12
|
-
return messages.slice(0, nextTurnIndex === -1 ? messages.length : nextTurnIndex);
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* True when an interrupt can start its own attempt.
|
|
16
|
-
*
|
|
17
|
-
* A steered web message must not start a second Turn while a yielded Turn
|
|
18
|
-
* waits to resume. It stays pending for that Turn's drain or the next attempt.
|
|
19
|
-
*/
|
|
20
|
-
function isAttemptInterrupt(message, work) {
|
|
21
|
-
return message.delivery === "interrupt" && !(work.execution.status === "paused" && message.source === "web");
|
|
22
|
-
}
|
|
23
|
-
/** Prioritize interrupts while keeping each attempt to one Actor and Source. */
|
|
24
|
-
function selectAttemptMessages(work) {
|
|
25
|
-
const messages = work.messages;
|
|
26
|
-
const interrupts = messages.filter((message) => isAttemptInterrupt(message, work));
|
|
27
|
-
if (interrupts.length > 0) return selectContiguousTurnBatch(interrupts);
|
|
28
|
-
if (work.execution.status === "paused") return [];
|
|
29
|
-
const nonEventMessages = messages.filter((message) => message.source !== "event");
|
|
30
|
-
return selectContiguousTurnBatch(nonEventMessages.length > 0 ? nonEventMessages : messages);
|
|
31
|
-
}
|
|
2
|
+
import { At as isInvalidConversationRecordError, Dt as hasConversationStop, St as countPendingConversationMessages, kt as isFinalAttempt } from "./projection-BFJG58TG.js";
|
|
3
|
+
import { W as isProviderRetryError, i as getChatConfig } from "./config-DHAy7XlP.js";
|
|
4
|
+
import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-CtCJmt9p.js";
|
|
5
|
+
import { Ht as selectAttemptMessages, Vt as isAttemptInterrupt } from "./agent-runner-bvl8U5uH.js";
|
|
6
|
+
import { k as getTurnRequestDeadline, y as ConversationQueueMessageRejectedError } from "./background-compaction-queue-D36oCldp.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-DE7NJOvQ.js";
|
|
32
8
|
// src/chat/task-execution/worker.ts
|
|
33
9
|
var worker_exports = /* @__PURE__ */ __exportAll({
|
|
34
10
|
CONVERSATION_WORK_DEFER_DELAY_MS: () => CONVERSATION_WORK_DEFER_DELAY_MS,
|
|
@@ -218,7 +194,7 @@ async function processConversationWorkInContext(message, options) {
|
|
|
218
194
|
}
|
|
219
195
|
const pendingCount = initial ? countPendingConversationMessages(initial) : 0;
|
|
220
196
|
setSpanAttributes({ "app.worker.pending_count": pendingCount });
|
|
221
|
-
if (!initial
|
|
197
|
+
if (!initial?.needsRun) {
|
|
222
198
|
if (initial) await clearConsumedConversationWake({
|
|
223
199
|
conversationId,
|
|
224
200
|
conversationStore: options.conversationStore,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-- Before this migration runs, junior upgrade builds the marked index with
|
|
2
|
+
-- CREATE INDEX CONCURRENTLY, so the build below does not block writes.
|
|
3
|
+
DO $$
|
|
4
|
+
BEGIN
|
|
5
|
+
-- Even CREATE INDEX IF NOT EXISTS takes a write-blocking table lock.
|
|
6
|
+
IF to_regclass('junior_conversation_events_guardian_review_time_idx') IS NULL THEN
|
|
7
|
+
-- junior:concurrent-index
|
|
8
|
+
CREATE INDEX "junior_conversation_events_guardian_review_time_idx" ON "junior_conversation_events" USING btree ("created_at") WHERE "junior_conversation_events"."type" = 'guardian_action_reviewed';
|
|
9
|
+
END IF;
|
|
10
|
+
|
|
11
|
+
-- A failed concurrent build can leave an index that exists but cannot be used.
|
|
12
|
+
IF NOT EXISTS (
|
|
13
|
+
SELECT 1 FROM pg_index
|
|
14
|
+
WHERE indexrelid = 'junior_conversation_events_guardian_review_time_idx'::regclass
|
|
15
|
+
AND indrelid = 'junior_conversation_events'::regclass
|
|
16
|
+
AND indisvalid AND indisready
|
|
17
|
+
) THEN
|
|
18
|
+
RAISE EXCEPTION 'The Guardian review time index is not valid and ready. Repair the concurrent build before running junior upgrade.';
|
|
19
|
+
END IF;
|
|
20
|
+
END $$;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-- Before this migration runs, junior upgrade builds the marked index with
|
|
2
|
+
-- CREATE INDEX CONCURRENTLY, so the build below does not block writes.
|
|
3
|
+
DO $$
|
|
4
|
+
BEGIN
|
|
5
|
+
-- Even CREATE INDEX IF NOT EXISTS takes a write-blocking table lock.
|
|
6
|
+
IF to_regclass('junior_conversation_participants_unsubscribed_idx') IS NULL THEN
|
|
7
|
+
-- junior:concurrent-index
|
|
8
|
+
CREATE INDEX "junior_conversation_participants_unsubscribed_idx" ON "junior_conversation_participants" USING btree ("user_id","root_conversation_id") WHERE "junior_conversation_participants"."unsubscribed_at" is not null;
|
|
9
|
+
END IF;
|
|
10
|
+
|
|
11
|
+
-- A failed concurrent build can leave an index that exists but cannot be used.
|
|
12
|
+
IF NOT EXISTS (
|
|
13
|
+
SELECT 1 FROM pg_index
|
|
14
|
+
WHERE indexrelid = 'junior_conversation_participants_unsubscribed_idx'::regclass
|
|
15
|
+
AND indrelid = 'junior_conversation_participants'::regclass
|
|
16
|
+
AND indisvalid AND indisready
|
|
17
|
+
) THEN
|
|
18
|
+
RAISE EXCEPTION 'The conversation participant unsubscribed index is not valid and ready. Repair the concurrent build before running junior upgrade.';
|
|
19
|
+
END IF;
|
|
20
|
+
END $$;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
ALTER TABLE "junior_conversation_metrics" ADD COLUMN "actor_identity_id" text;--> statement-breakpoint
|
|
2
|
+
ALTER TABLE "junior_conversation_metrics" ADD CONSTRAINT "junior_conversation_metrics_actor_identity_id_junior_identities_id_fk" FOREIGN KEY ("actor_identity_id") REFERENCES "public"."junior_identities"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
3
|
+
CREATE INDEX "junior_conversation_metrics_actor_identity_occurred_at_idx" ON "junior_conversation_metrics" USING btree ("actor_identity_id","occurred_at");--> statement-breakpoint
|
|
4
|
+
-- Old metric rows do not record their Turn Actor. Use the Actor of the
|
|
5
|
+
-- metric row's Conversation, else the Actor of its root.
|
|
6
|
+
UPDATE "junior_conversation_metrics" AS "m"
|
|
7
|
+
SET "actor_identity_id" = coalesce("c"."actor_identity_id", "r"."actor_identity_id")
|
|
8
|
+
FROM "junior_conversations" AS "c"
|
|
9
|
+
LEFT JOIN "junior_conversations" AS "r"
|
|
10
|
+
ON "r"."conversation_id" = coalesce("c"."root_conversation_id", "c"."conversation_id")
|
|
11
|
+
WHERE "c"."conversation_id" = "m"."conversation_id"
|
|
12
|
+
AND "m"."actor_identity_id" IS NULL;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
-- Access and feeds read only Participant rows. Add the root Actor of each
|
|
2
|
+
-- root whose Identity got its User after the root was written.
|
|
3
|
+
INSERT INTO "junior_conversation_participants" (
|
|
4
|
+
"user_id",
|
|
5
|
+
"root_conversation_id",
|
|
6
|
+
"last_message_at"
|
|
7
|
+
)
|
|
8
|
+
SELECT
|
|
9
|
+
i."user_id",
|
|
10
|
+
c."conversation_id",
|
|
11
|
+
c."last_activity_at"
|
|
12
|
+
FROM "junior_conversations" AS c
|
|
13
|
+
INNER JOIN "junior_identities" AS i
|
|
14
|
+
ON i."id" = c."actor_identity_id"
|
|
15
|
+
WHERE c."parent_conversation_id" IS NULL
|
|
16
|
+
AND i."user_id" IS NOT NULL
|
|
17
|
+
AND i."kind" = 'user'
|
|
18
|
+
ON CONFLICT ("user_id", "root_conversation_id") DO NOTHING;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "junior_conversations" ADD COLUMN "delivery_paused_at" timestamp with time zone;
|