@sentry/junior 0.246.0 → 0.247.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/{admin-Bh-MYw-j.js → admin-BGwaqDMs.js} +1 -1
- package/dist/{agent-hooks-DpklSWZg.js → agent-hooks-C72ByH0C.js} +11 -11
- package/dist/{agent-invocations-BO6ddZax.js → agent-invocations-D_YoNnAn.js} +8 -2
- package/dist/{agent-runner-DSKpHjHW.js → agent-runner-DsAFAKKs.js} +451 -2412
- package/dist/api/schema.js +2 -2
- package/dist/api.js +24 -21
- package/dist/{app-BYB7szGb.d.ts → app-4t4mPTdS.d.ts} +8 -1
- package/dist/app.d.ts +1 -1
- package/dist/app.js +30 -27
- package/dist/assistant-reply-ChOzcTBS.js +45 -0
- package/dist/{briefs-cZ5vWqP_.js → briefs-Dc7qZrhc.js} +4 -4
- package/dist/{catalog-runtime-CTaQXYqS.js → catalog-runtime-DS1k7fUG.js} +1 -1
- package/dist/cli/chat.js +22 -16
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +3 -3
- package/dist/cli/upgrade.js +3 -3
- package/dist/{client--xtsAxKP.js → client-BVnfNd3D.js} +2 -2
- package/dist/{config-BK53Ip5C.js → config-CgWvImQL.js} +2 -2
- package/dist/{conversation-CvBG57Io.js → conversation-CYsbVFLx.js} +71 -1
- package/dist/{conversation-privacy-BDBFw6Ws.js → conversation-privacy-D3TdVM9H.js} +1 -1
- package/dist/{credential-sync-BiuhC9Ds.js → credential-sync-DLw3jkv-.js} +14 -14
- package/dist/{executor-bmmuRY-w.js → executor-DQazjeGA.js} +3 -3
- package/dist/{images-DZliDtSH.js → images-C3e5E-p_.js} +4 -21
- package/dist/instrumentation.js +2 -2
- package/dist/{job-queue-Cz3M7gg4.js → job-queue-BEUqRhjC.js} +1 -1
- package/dist/{logging-DVtMYOdD.js → logging-CZEc8_v4.js} +1 -1
- package/dist/message-BIJa7lKh.js +59 -0
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -3
- package/dist/{oauth-authorization-By_MVRDC.js → oauth-authorization-BA4Dt6a7.js} +1 -45
- package/dist/{oauth-callback-server-BrUo6w1e.js → oauth-callback-server-R9OSdLP1.js} +2 -2
- package/dist/{pending-auth-BuQLZ6dK.js → pending-auth-Oo5AQhaf.js} +2 -2
- package/dist/{profile-BevMNSlr.js → profile-aVLDAirh.js} +4 -4
- package/dist/{prompt-C9Q9cjD3.js → prompt-ZG1UCxjF.js} +1 -1
- package/dist/{registry-C2rSEio1.js → registry-CtaDOOM5.js} +1 -1
- package/dist/{resolve-qPhrznTf.js → resolve-Bdw4hu7s.js} +2 -2
- package/dist/result-DNgmkASh.js +463 -0
- package/dist/{runner-CNh5eMWx.js → runner-BUSScEu5.js} +11 -10
- package/dist/{sandbox-egress-signals-BnDEKu8d.js → sandbox-egress-signals-E9r8bf9G.js} +1 -1
- package/dist/{schema-BWMRg8JS.js → schema-tyd6hALh.js} +2 -2
- package/dist/session-stop-CAhBfBUT.js +782 -0
- package/dist/{skills-C6zJbudq.js → skills-DQy-mmBC.js} +2 -2
- package/dist/{spawn-C3efZSx3.js → spawn-DQ_MVWZ6.js} +3 -2
- package/dist/store-DjLA8GKs.js +1417 -0
- package/dist/{task-queue-BX4vG6uA.js → task-queue-BT2h_t8I.js} +3 -3
- package/dist/{task-runner-T51kll0U.js → task-runner-CiPepjIB.js} +11 -11
- package/dist/{tasks-B9OIjl2K.js → tasks-DMmRrIVl.js} +9 -9
- package/dist/{thread-state-AGZtVyXp.js → thread-state-ehZYGpX9.js} +7 -7
- package/dist/{turn-failure-response-DJ8KU2bo.js → turn-failure-response-D7J10z7l.js} +9 -9
- package/dist/{turn-lifecycle-DZJkJ95q.js → turn-lifecycle-Buswqs90.js} +1 -1
- package/dist/{turn-session-routing-mRqLbMZW.js → turn-session-routing-Bw-yiSb4.js} +1 -1
- package/dist/{validation-Dg0Ihxzo.js → validation-DTguegIe.js} +1 -1
- package/dist/{version-Deub4try.js → version-BrZSE5du.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-D5hbx6TE.js → viewer-BlAozHer.js} +4 -4
- package/dist/{web-authorization-DCxixz5S.js → web-authorization-DwyTlkAg.js} +6 -6
- package/dist/{web-input-0sorYVLh.js → web-input-DSYxI7Wi.js} +43 -208
- package/dist/{work-rm2X7jj4.js → work-CRBXkJoU.js} +89 -13
- package/dist/{worker-bnGsAOP3.js → worker-BVJKM9Ja.js} +7 -7
- package/migrations/0053_conversation_stopped_at.sql +1 -0
- package/migrations/0054_flowery_rage.sql +1 -0
- package/migrations/meta/0053_snapshot.json +3771 -0
- package/migrations/meta/0054_snapshot.json +3777 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +6 -5
- package/dist/message-BSN-Ma5f.js +0 -317
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
2
|
+
import { $ as getAgentInvocation, G as recordSubagentStarted, H as stopChildAgentsOf, Ht as readBlockedReport, It as buildSteeringPiMessage, J as createAgentInvocation, Lt as withoutSavedSteeringMessages, Q as getActiveAgentInvocationForConversation, Vt as AuthorizationFlowDisabledError, W as recordSubagentEnded, at as getAgentInvocationTurnId, ct as isTerminalAgentInvocation, dt as markAgentInvocationMailboxAppended, gt as reportReplacedAgentInvocation, ht as markAgentInvocationSteered, m as PluginCredentialFailureError, mt as markAgentInvocationRunning, pt as markAgentInvocationPaused, q as completeAgentInvocation, rt as getAgentInvocationMessageId, st as getLatestAgentInvocationForConversation } from "./agent-runner-DsAFAKKs.js";
|
|
3
|
+
import { n as botConfig } from "./config-CgWvImQL.js";
|
|
4
|
+
import { c as getConversationEventStore, u as getConversationStore } from "./viewer-BlAozHer.js";
|
|
5
|
+
import { f as instructionProvenanceFor, p as sameActorIdentity } from "./history-Nte1oVed.js";
|
|
6
|
+
import { At as openConversationProjection, J as saveTurnCheckpoint, Q as getTurnRecord, Y as abandonTurnRecord, Z as failTurnRecord, ct as getTerminalAssistantMessages } from "./tasks-DMmRrIVl.js";
|
|
7
|
+
import { c as isTurnInputCommitLostError, i as TurnInputCommitLostError, o as getConversationTurnBoundaryError } from "./oauth-authorization-BA4Dt6a7.js";
|
|
8
|
+
import { n as getAssistantReplyText } from "./assistant-reply-ChOzcTBS.js";
|
|
9
|
+
import { A as recordFinishedTurnForAutomatedLimit, j as resetAutomatedTurnLimit, k as maybePostAutomatedTurnLimitNotice } from "./session-stop-CAhBfBUT.js";
|
|
10
|
+
import { r as appendAndEnqueueInboundMessage } from "./store-DjLA8GKs.js";
|
|
11
|
+
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-Buswqs90.js";
|
|
12
|
+
import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState } from "./thread-state-ehZYGpX9.js";
|
|
13
|
+
import { isDeepStrictEqual } from "node:util";
|
|
8
14
|
import { z } from "zod";
|
|
9
15
|
//#region src/chat/runtime/turn-execution.ts
|
|
10
16
|
/** An error thrown while the agent advances a Run. */
|
|
@@ -50,6 +56,7 @@ async function executeTurn(agentRunner, run, saveResult) {
|
|
|
50
56
|
//#endregion
|
|
51
57
|
//#region src/chat/agent-invocations/work.ts
|
|
52
58
|
var work_exports = /* @__PURE__ */ __exportAll({
|
|
59
|
+
agentInvocationRunPolicy: () => agentInvocationRunPolicy,
|
|
53
60
|
buildAgentInvocationInboundMessage: () => buildAgentInvocationInboundMessage,
|
|
54
61
|
createAgentInvocationWorker: () => createAgentInvocationWorker,
|
|
55
62
|
createAndEnqueueAgentInvocation: () => createAndEnqueueAgentInvocation,
|
|
@@ -61,6 +68,18 @@ const agentInvocationMailboxMetadataSchema = z.object({
|
|
|
61
68
|
agentInvocationId: z.string().min(1),
|
|
62
69
|
kind: z.literal("agent_invocation")
|
|
63
70
|
}).strict();
|
|
71
|
+
/** Map a durable invocation's model settings and depth to the child Run policy. */
|
|
72
|
+
function agentInvocationRunPolicy(invocation, canSpawn) {
|
|
73
|
+
return {
|
|
74
|
+
disabledFeatures: canSpawn ? ["handoff", "interactive-auth"] : [
|
|
75
|
+
"handoff",
|
|
76
|
+
"interactive-auth",
|
|
77
|
+
"subagents"
|
|
78
|
+
],
|
|
79
|
+
...invocation.modelProfile ? { modelProfile: invocation.modelProfile } : void 0,
|
|
80
|
+
...invocation.reasoningLevel ? { reasoning: invocation.reasoningLevel } : void 0
|
|
81
|
+
};
|
|
82
|
+
}
|
|
64
83
|
/** Build destinationless mailbox work that references one durable invocation. */
|
|
65
84
|
function buildAgentInvocationInboundMessage(invocation, nowMs = Date.now()) {
|
|
66
85
|
return {
|
|
@@ -123,6 +142,53 @@ async function resolveAgentInvocationId(context) {
|
|
|
123
142
|
const latest = await getLatestAgentInvocationForConversation(context.conversationId);
|
|
124
143
|
return latest?.status === "stopped" ? latest.invocationId : void 0;
|
|
125
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Give queued parent messages to the running agent invocation of a child as
|
|
147
|
+
* steering messages. A message joins only with the Actor and credentials of
|
|
148
|
+
* the running Turn. The first message that does not match stops the scan, so
|
|
149
|
+
* it and every later message wait for the current work. Each message that
|
|
150
|
+
* joins ends as `steered`, and the running agent invocation reports for it.
|
|
151
|
+
*/
|
|
152
|
+
function createAgentMessageSteeringDrain(context, running) {
|
|
153
|
+
const turnId = getAgentInvocationTurnId(running.invocationId);
|
|
154
|
+
return async (accept) => {
|
|
155
|
+
const accepted = [];
|
|
156
|
+
await context.attempt.drain(async (pending) => {
|
|
157
|
+
const readIds = [];
|
|
158
|
+
const joining = [];
|
|
159
|
+
for (const message of pending) {
|
|
160
|
+
const metadata = agentInvocationMailboxMetadataSchema.safeParse(message.input.metadata);
|
|
161
|
+
if (!metadata.success) continue;
|
|
162
|
+
const candidate = await getAgentInvocation(metadata.data.agentInvocationId);
|
|
163
|
+
if (!candidate?.parentToolCallId || candidate.invocationId === running.invocationId) continue;
|
|
164
|
+
if (isTerminalAgentInvocation(candidate)) {
|
|
165
|
+
if (candidate.parentMailboxStatus === "steered") readIds.push(message.inboundMessageId);
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
if (!sameActorIdentity(candidate.actor, running.actor) || !isDeepStrictEqual(candidate.credentialContext, running.credentialContext)) break;
|
|
169
|
+
joining.push(candidate);
|
|
170
|
+
readIds.push(message.inboundMessageId);
|
|
171
|
+
}
|
|
172
|
+
if (joining.length === 0) return readIds;
|
|
173
|
+
const saved = (await getTurnRecord(running.childConversationId, turnId))?.piMessages ?? [];
|
|
174
|
+
const messages = withoutSavedSteeringMessages(saved, joining.map((candidate) => ({
|
|
175
|
+
provenance: instructionProvenanceFor(candidate.actor),
|
|
176
|
+
text: candidate.input,
|
|
177
|
+
timestampMs: candidate.createdAtMs
|
|
178
|
+
})), buildSteeringPiMessage);
|
|
179
|
+
if (messages.length > 0) {
|
|
180
|
+
await accept(messages);
|
|
181
|
+
accepted.push(...messages);
|
|
182
|
+
}
|
|
183
|
+
for (const candidate of joining) {
|
|
184
|
+
const terminal = await markAgentInvocationSteered(candidate.invocationId);
|
|
185
|
+
if (terminal && isTerminalAgentInvocation(terminal)) await recordSubagentEnded(terminal);
|
|
186
|
+
}
|
|
187
|
+
return readIds;
|
|
188
|
+
}, { deferred: true });
|
|
189
|
+
return accepted;
|
|
190
|
+
};
|
|
191
|
+
}
|
|
126
192
|
/** Project the terminal invocation into the idempotent turn lifecycle. */
|
|
127
193
|
async function persistTerminalLifecycle(invocation) {
|
|
128
194
|
const lifecycle = new ConversationTurnLifecycleService(getConversationEventStore());
|
|
@@ -207,6 +273,19 @@ async function saveAgentInvocationResult(args) {
|
|
|
207
273
|
source: args.invocation.source,
|
|
208
274
|
surface: "internal"
|
|
209
275
|
});
|
|
276
|
+
if (args.invocation.parentToolCallId) await resetAutomatedTurnLimit({ conversationId: args.invocation.childConversationId });
|
|
277
|
+
else if (args.invocation.source.kind !== "agent_invocation") {
|
|
278
|
+
const maxTurns = botConfig.maxConsecutiveAutomatedTurns;
|
|
279
|
+
await maybePostAutomatedTurnLimitNotice({
|
|
280
|
+
conversationId: args.invocation.childConversationId,
|
|
281
|
+
maxTurns,
|
|
282
|
+
update: await recordFinishedTurnForAutomatedLimit({
|
|
283
|
+
conversationId: args.invocation.childConversationId,
|
|
284
|
+
maxTurns,
|
|
285
|
+
source: args.invocation.source
|
|
286
|
+
})
|
|
287
|
+
});
|
|
288
|
+
}
|
|
210
289
|
const terminal = await completeAgentInvocation({
|
|
211
290
|
invocationId: args.invocation.invocationId,
|
|
212
291
|
...failed ? {
|
|
@@ -270,7 +349,7 @@ function createAgentInvocationWorker(agentRunner, options = {}) {
|
|
|
270
349
|
};
|
|
271
350
|
const finish = async (terminal) => {
|
|
272
351
|
if (!terminal || !isTerminalAgentInvocation(terminal)) return;
|
|
273
|
-
await persistTerminalLifecycle(terminal);
|
|
352
|
+
if (terminal.parentMailboxStatus !== "steered") await persistTerminalLifecycle(terminal);
|
|
274
353
|
await report(terminal);
|
|
275
354
|
};
|
|
276
355
|
let acknowledged = context.attempt.messages.length === 0;
|
|
@@ -351,6 +430,7 @@ function createAgentInvocationWorker(agentRunner, options = {}) {
|
|
|
351
430
|
try {
|
|
352
431
|
outcome = await executeTurn(agentRunner, {
|
|
353
432
|
conversationId: invocation.childConversationId,
|
|
433
|
+
parentConversationId: invocation.parentConversationId,
|
|
354
434
|
turnId,
|
|
355
435
|
runId: invocation.invocationId,
|
|
356
436
|
instruction: { text: invocation.input },
|
|
@@ -362,14 +442,10 @@ function createAgentInvocationWorker(agentRunner, options = {}) {
|
|
|
362
442
|
...location ? { location } : void 0,
|
|
363
443
|
surface: "internal",
|
|
364
444
|
...stopSignal ? { signal: stopSignal } : void 0,
|
|
365
|
-
|
|
366
|
-
"handoff",
|
|
367
|
-
"interactive-auth",
|
|
368
|
-
"subagents"
|
|
369
|
-
],
|
|
370
|
-
reasoning: invocation.reasoningLevel,
|
|
445
|
+
...agentInvocationRunPolicy(invocation, canSpawn),
|
|
371
446
|
state: { sandboxRef },
|
|
372
447
|
durability: {
|
|
448
|
+
drainSteeringMessages: createAgentMessageSteeringDrain(context, invocation),
|
|
373
449
|
onInputCommitted: acknowledge,
|
|
374
450
|
shouldYield: context.shouldYield,
|
|
375
451
|
onSandboxRefChanged: async (nextSandboxRef) => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { f as
|
|
2
|
+
import { v as isProviderRetryError } from "./client-BVnfNd3D.js";
|
|
3
|
+
import { C as withLogContext, d as logException, f as logInfo, p as logWarn } from "./logging-CZEc8_v4.js";
|
|
4
|
+
import { i as getChatConfig } from "./config-CgWvImQL.js";
|
|
5
|
+
import { f as getTurnRequestDeadline, m as ConversationQueueMessageRejectedError } from "./job-queue-BEUqRhjC.js";
|
|
6
|
+
import { C as requestAnotherSlice, M as isInvalidConversationRecordError, T as startConversationWork, b as recordConversationRetry, d as countPendingConversationMessages, f as deadLetterAttempt, g as getConversationWorkState, i as beginConversationResume, j as isFinalAttempt, k as hasConversationStop, 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-DjLA8GKs.js";
|
|
7
7
|
//#region src/chat/task-execution/worker.ts
|
|
8
8
|
var worker_exports = /* @__PURE__ */ __exportAll({
|
|
9
9
|
CONVERSATION_WORK_DEFER_DELAY_MS: () => CONVERSATION_WORK_DEFER_DELAY_MS,
|
|
@@ -262,12 +262,12 @@ async function processConversationWorkInContext(message, options) {
|
|
|
262
262
|
"app.lease.expires_at_ms": lease.leaseExpiresAtMs,
|
|
263
263
|
"app.worker.soft_yield_deadline_ms": softYieldDeadlineMs
|
|
264
264
|
});
|
|
265
|
-
const drain = (handle) => drainConversationMailbox({
|
|
265
|
+
const drain = (handle, drainOptions) => drainConversationMailbox({
|
|
266
266
|
conversationId,
|
|
267
267
|
leaseToken: lease.leaseToken,
|
|
268
268
|
conversationStore: options.conversationStore,
|
|
269
269
|
handle: async (messages) => {
|
|
270
|
-
const candidates = messages.filter((message) => message.delivery === "interrupt" && (attemptSelectedMessageIds.has(message.inboundMessageId) || !attemptStartMessageIds.has(message.inboundMessageId)));
|
|
270
|
+
const candidates = drainOptions?.deferred ? messages : messages.filter((message) => message.delivery === "interrupt" && (attemptSelectedMessageIds.has(message.inboundMessageId) || !attemptStartMessageIds.has(message.inboundMessageId)));
|
|
271
271
|
if (candidates.length === 0) return [];
|
|
272
272
|
return await handle(candidates) ?? candidates.map((message) => message.inboundMessageId);
|
|
273
273
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "junior_conversations" ADD COLUMN "stopped_at" timestamp with time zone;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "junior_agent_invocations" ADD COLUMN "model_profile" text;
|