@sentry/junior 0.137.0 → 0.139.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-hooks-MZOKEP3J.js → agent-hooks-MJXMD7JP.js} +11 -9
- package/dist/api/schema/task.d.ts +100 -1
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +9 -1
- package/dist/api.js +202 -55
- package/dist/app.d.ts +7 -0
- package/dist/app.js +601 -1356
- package/dist/{catalog-runtime-MD66YLFV.js → catalog-runtime-GCCFYPIK.js} +6 -6
- package/dist/chat/agent/request.d.ts +44 -4
- package/dist/chat/agent-dispatch/heartbeat.d.ts +5 -0
- package/dist/chat/agent-dispatch/types.d.ts +1 -1
- package/dist/chat/agent-invocations/errors.d.ts +8 -0
- package/dist/chat/agent-invocations/spawn.d.ts +12 -0
- package/dist/chat/agent-invocations/store.d.ts +44 -0
- package/dist/chat/agent-invocations/types.d.ts +449 -0
- package/dist/chat/agent-invocations/work.d.ts +31 -0
- package/dist/chat/config.d.ts +1 -0
- package/dist/chat/conversations/sql/store.d.ts +8 -0
- package/dist/chat/conversations/store.d.ts +7 -0
- package/dist/chat/credentials/context.d.ts +14 -0
- package/dist/chat/experimental.d.ts +16 -0
- package/dist/chat/resource-events/actor.d.ts +23 -0
- package/dist/chat/runtime/agent-runner.d.ts +2 -1
- package/dist/chat/services/auth-pause.d.ts +0 -1
- package/dist/chat/services/mcp-auth-orchestration.d.ts +3 -2
- package/dist/chat/services/plugin-auth-orchestration.d.ts +3 -2
- package/dist/chat/state/turn-session.d.ts +1 -5
- package/dist/chat/task-execution/state.d.ts +23 -11
- package/dist/chat/task-execution/store.d.ts +20 -11
- package/dist/chat/task-execution/worker.d.ts +2 -2
- package/dist/chat/tasks/execution-stats.d.ts +34 -3
- package/dist/chat/tasks/read.d.ts +3 -1
- package/dist/chat/tools/runtime/spawn-agent.d.ts +31 -0
- package/dist/chat/tools/types.d.ts +2 -0
- package/dist/{chunk-T6Z5S6PQ.js → chunk-2ECYPYKP.js} +1 -1
- package/dist/chunk-3T2JAGRH.js +115 -0
- package/dist/chunk-3Y47VMHV.js +6 -0
- package/dist/chunk-4V4QIYJH.js +41 -0
- package/dist/{chunk-SYCX4DOK.js → chunk-5GSZWRE2.js} +434 -65
- package/dist/chunk-5IDFPCON.js +46 -0
- package/dist/{chunk-36EG34YI.js → chunk-6OHTDR4F.js} +1 -1
- package/dist/chunk-6SU2DT27.js +441 -0
- package/dist/{chunk-UG6ZYPBI.js → chunk-75I3UBIL.js} +73 -60
- package/dist/chunk-AEQISMMU.js +711 -0
- package/dist/{chunk-5PNJMOY5.js → chunk-C2N6MNO4.js} +9 -2
- package/dist/{chunk-BZAMASJP.js → chunk-CXH25EL4.js} +2 -2
- package/dist/{chunk-K2NCQJKH.js → chunk-DW4PMHNW.js} +3 -3
- package/dist/chunk-EM225ITJ.js +56 -0
- package/dist/{chunk-UOXATPSI.js → chunk-G52UXKGO.js} +7 -5
- package/dist/chunk-GI52BW74.js +207 -0
- package/dist/{chunk-3Q342EJJ.js → chunk-GWQSZT4C.js} +2 -2
- package/dist/{chunk-EPBBYMNE.js → chunk-HUO3UTAQ.js} +1 -1
- package/dist/{chunk-WPPXIAFB.js → chunk-IIESAYDL.js} +17 -434
- package/dist/chunk-IUFM5JWV.js +24 -0
- package/dist/{chunk-UZQ4VY3M.js → chunk-J3S57AXY.js} +1 -1
- package/dist/{chunk-DQXAAVTR.js → chunk-J6EJQCHY.js} +46 -1471
- package/dist/{chunk-6ZK6FZIV.js → chunk-KCBZSJRU.js} +6 -27
- package/dist/chunk-MQ5RYATN.js +1523 -0
- package/dist/{chunk-5G34IEK2.js → chunk-MXTVUV3I.js} +2 -56
- package/dist/{chunk-YRPC6MJY.js → chunk-MXVD2BDS.js} +1 -1
- package/dist/{chunk-POBSY47Q.js → chunk-PJW6U46K.js} +337 -306
- package/dist/chunk-Q6QZTTLS.js +55 -0
- package/dist/{chunk-ZFS67WIR.js → chunk-QTBKPZDA.js} +57 -6
- package/dist/chunk-R776HKPK.js +81 -0
- package/dist/{chunk-77VDLF3Z.js → chunk-RUIXF3YQ.js} +10 -0
- package/dist/chunk-U27DSXKB.js +714 -0
- package/dist/{chunk-XZ7NPXAB.js → chunk-U7CMWQ7Z.js} +1 -1
- package/dist/{chunk-RB4NJKEX.js → chunk-UDBUS533.js} +125 -51
- package/dist/chunk-WQRX57EA.js +668 -0
- package/dist/chunk-WZH4JV7R.js +320 -0
- package/dist/{chunk-HCIVH3JS.js → chunk-YCTDA7BD.js} +28 -0
- package/dist/{chunk-YNFERGKP.js → chunk-YGZ2OLXL.js} +1 -1
- package/dist/{chunk-EWDSB24B.js → chunk-ZQCGQMF2.js} +16 -776
- package/dist/{chunk-KJ4HGRHN.js → chunk-ZYQSPQYR.js} +515 -601
- package/dist/cli/chat.js +68 -29
- package/dist/cli/check.js +7 -7
- package/dist/cli/plugins.js +15 -13
- package/dist/cli/snapshot-create.js +11 -10
- package/dist/cli/upgrade.js +8 -8
- package/dist/conversation-work-KATFHLG3.js +56 -0
- package/dist/db/schema/agent-invocations.d.ts +544 -0
- package/dist/db/schema/task-executions.d.ts +23 -2
- package/dist/db/schema.d.ts +563 -2
- package/dist/{db-66E7VDNC.js → db-UXPPGHDF.js} +7 -7
- package/dist/experimental-HH6OM6UH.js +13 -0
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +4 -3
- package/dist/{oauth-callback-server-7QPD4Q7P.js → oauth-callback-server-4ZYMD5UA.js} +28 -19
- package/dist/{runner-L2BKJKOD.js → runner-MZSEONRZ.js} +32 -18
- package/dist/{sandbox-egress-signals-A5HWIQH4.js → sandbox-egress-signals-EKPAVWQL.js} +2 -2
- package/dist/{skills-HOQ2NSPW.js → skills-IMVPXSQ7.js} +7 -7
- package/dist/spawn-S5LSVOCE.js +38 -0
- package/dist/{validation-ENHI7S2C.js → validation-ZKCY2BVR.js} +7 -7
- package/dist/version.js +1 -1
- package/dist/work-GG3XDYRX.js +46 -0
- package/dist/worker-23AUELCJ.js +24 -0
- package/migrations/0021_first_warhawk.sql +35 -0
- package/migrations/0022_task_execution_status.sql +3 -0
- package/migrations/meta/0021_snapshot.json +2176 -0
- package/migrations/meta/0022_snapshot.json +2186 -0
- package/migrations/meta/_journal.json +15 -1
- package/package.json +4 -4
- package/dist/chunk-6QW2RRQT.js +0 -233
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// src/chat/conversations/turn-lifecycle.ts
|
|
2
|
+
var ConversationTurnLifecycleService = class {
|
|
3
|
+
constructor(events) {
|
|
4
|
+
this.events = events;
|
|
5
|
+
}
|
|
6
|
+
events;
|
|
7
|
+
/** Record the turn start once after every input message is durable. */
|
|
8
|
+
async start(input) {
|
|
9
|
+
await this.events.append(input.conversationId, [
|
|
10
|
+
{
|
|
11
|
+
idempotencyKey: `turn:${input.turnId}:started`,
|
|
12
|
+
createdAtMs: input.createdAtMs,
|
|
13
|
+
data: {
|
|
14
|
+
type: "turn_started",
|
|
15
|
+
turnId: input.turnId,
|
|
16
|
+
inputMessageIds: input.inputMessageIds,
|
|
17
|
+
surface: input.surface
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
]);
|
|
21
|
+
}
|
|
22
|
+
/** Record successful or intentional-silence completion once. */
|
|
23
|
+
async complete(input) {
|
|
24
|
+
await this.events.append(input.conversationId, [
|
|
25
|
+
{
|
|
26
|
+
idempotencyKey: `turn:${input.turnId}:terminal`,
|
|
27
|
+
createdAtMs: input.createdAtMs,
|
|
28
|
+
data: {
|
|
29
|
+
type: "turn_completed",
|
|
30
|
+
turnId: input.turnId,
|
|
31
|
+
outcome: input.outcome
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
]);
|
|
35
|
+
}
|
|
36
|
+
/** Record a classified failure once without accepting raw error details. */
|
|
37
|
+
async fail(input) {
|
|
38
|
+
await this.events.append(input.conversationId, [
|
|
39
|
+
{
|
|
40
|
+
idempotencyKey: `turn:${input.turnId}:terminal`,
|
|
41
|
+
createdAtMs: input.createdAtMs,
|
|
42
|
+
data: {
|
|
43
|
+
type: "turn_failed",
|
|
44
|
+
turnId: input.turnId,
|
|
45
|
+
failureCode: input.failureCode,
|
|
46
|
+
...input.eventId ? { eventId: input.eventId } : {}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
]);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export {
|
|
54
|
+
ConversationTurnLifecycleService
|
|
55
|
+
};
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
juniorConversations,
|
|
6
6
|
juniorIdentities,
|
|
7
7
|
juniorUsers
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-UDBUS533.js";
|
|
9
9
|
import {
|
|
10
10
|
TURN_REASONING_LEVELS,
|
|
11
11
|
getChatConfig,
|
|
12
12
|
modelProfileSchema
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-75I3UBIL.js";
|
|
14
14
|
import {
|
|
15
15
|
juniorDestinations
|
|
16
16
|
} from "./chunk-VFUK3X5B.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./chunk-F3B2YJ76.js";
|
|
21
21
|
import {
|
|
22
22
|
normalizeIdentityEmail
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-2ECYPYKP.js";
|
|
24
24
|
|
|
25
25
|
// src/chat/conversations/sql/store.ts
|
|
26
26
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
@@ -259,6 +259,12 @@ function privacyFromLocationRow(row) {
|
|
|
259
259
|
|
|
260
260
|
// src/chat/conversations/sql/store.ts
|
|
261
261
|
var CONVERSATION_MUTATION_LOCK_PREFIX = "junior_conversation";
|
|
262
|
+
async function withConversationMutationLock(executor, conversationId, callback) {
|
|
263
|
+
return await executor.withLock(
|
|
264
|
+
`${CONVERSATION_MUTATION_LOCK_PREFIX}:${conversationId}`,
|
|
265
|
+
async () => await executor.transaction(callback)
|
|
266
|
+
);
|
|
267
|
+
}
|
|
262
268
|
function now() {
|
|
263
269
|
return Date.now();
|
|
264
270
|
}
|
|
@@ -549,6 +555,49 @@ var SqlStore = class {
|
|
|
549
555
|
async bindProviderConversation(args) {
|
|
550
556
|
await bindProviderConversation(this.executor, args);
|
|
551
557
|
}
|
|
558
|
+
async createChild(args) {
|
|
559
|
+
const nowMs = args.nowMs ?? now();
|
|
560
|
+
await this.withConversationMutation(args.parentConversationId, async () => {
|
|
561
|
+
await this.withConversationMutation(
|
|
562
|
+
args.childConversationId,
|
|
563
|
+
async () => {
|
|
564
|
+
const existing = await this.get({
|
|
565
|
+
conversationId: args.childConversationId
|
|
566
|
+
});
|
|
567
|
+
if (existing) {
|
|
568
|
+
if (existing.lineage?.parentConversationId !== args.parentConversationId) {
|
|
569
|
+
throw new Error(
|
|
570
|
+
`Conversation lineage changed for ${args.childConversationId}`
|
|
571
|
+
);
|
|
572
|
+
}
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
const parent = await this.get({
|
|
576
|
+
conversationId: args.parentConversationId
|
|
577
|
+
});
|
|
578
|
+
if (!parent) {
|
|
579
|
+
throw new Error(
|
|
580
|
+
`Conversation parent is missing for ${args.childConversationId}`
|
|
581
|
+
);
|
|
582
|
+
}
|
|
583
|
+
if (parent.lineage) {
|
|
584
|
+
throw new Error("Recursive agent delegation is not enabled");
|
|
585
|
+
}
|
|
586
|
+
const child = {
|
|
587
|
+
...emptyConversation({
|
|
588
|
+
conversationId: args.childConversationId,
|
|
589
|
+
nowMs,
|
|
590
|
+
source: args.source
|
|
591
|
+
}),
|
|
592
|
+
lineage: {
|
|
593
|
+
parentConversationId: args.parentConversationId
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
await this.upsertConversation({ conversation: child });
|
|
597
|
+
}
|
|
598
|
+
);
|
|
599
|
+
});
|
|
600
|
+
}
|
|
552
601
|
async get(args) {
|
|
553
602
|
const row = await this.readConversationRow(args.conversationId);
|
|
554
603
|
if (!row) {
|
|
@@ -695,9 +744,10 @@ var SqlStore = class {
|
|
|
695
744
|
}
|
|
696
745
|
/** Serialize all durable mutations for one conversation inside a SQL transaction. */
|
|
697
746
|
async withConversationMutation(conversationId, callback) {
|
|
698
|
-
return await
|
|
699
|
-
|
|
700
|
-
|
|
747
|
+
return await withConversationMutationLock(
|
|
748
|
+
this.executor,
|
|
749
|
+
conversationId,
|
|
750
|
+
callback
|
|
701
751
|
);
|
|
702
752
|
}
|
|
703
753
|
async readConversationRow(conversationId) {
|
|
@@ -1666,6 +1716,7 @@ export {
|
|
|
1666
1716
|
parseSessionSource,
|
|
1667
1717
|
bindProviderConversation,
|
|
1668
1718
|
locationFromRow,
|
|
1719
|
+
withConversationMutationLock,
|
|
1669
1720
|
instructionProvenanceFor,
|
|
1670
1721
|
contextProvenance,
|
|
1671
1722
|
sameActorIdentity,
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// src/chat/agent/request.ts
|
|
2
|
+
function isAgentRunFeatureDisabled(policy, feature) {
|
|
3
|
+
return policy?.disabledFeatures?.includes(feature) ?? false;
|
|
4
|
+
}
|
|
5
|
+
var RetryableDeliveryError = class extends Error {
|
|
6
|
+
constructor(cause) {
|
|
7
|
+
super("Assistant delivery was transient or ambiguous", { cause });
|
|
8
|
+
this.name = "RetryableDeliveryError";
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
function actorFromRouting(routing) {
|
|
12
|
+
if (routing.dispatch?.actor) {
|
|
13
|
+
return routing.dispatch.actor;
|
|
14
|
+
}
|
|
15
|
+
if (routing.actor) {
|
|
16
|
+
return routing.actor;
|
|
17
|
+
}
|
|
18
|
+
if (routing.credentialContext && !("type" in routing.credentialContext.actor)) {
|
|
19
|
+
return routing.credentialContext.actor;
|
|
20
|
+
}
|
|
21
|
+
return void 0;
|
|
22
|
+
}
|
|
23
|
+
function assertRunRoutingConsistency(request) {
|
|
24
|
+
const { destination, source } = request.routing;
|
|
25
|
+
if (source.platform !== destination.platform) {
|
|
26
|
+
throw new TypeError("Run source and destination platforms do not match");
|
|
27
|
+
}
|
|
28
|
+
if (source.platform === "slack" && destination.platform === "slack") {
|
|
29
|
+
if (source.teamId !== destination.teamId) {
|
|
30
|
+
throw new TypeError("Slack source and destination teams do not match");
|
|
31
|
+
}
|
|
32
|
+
} else if (source.platform === "local" && destination.platform === "local") {
|
|
33
|
+
if (source.conversationId !== destination.conversationId) {
|
|
34
|
+
throw new TypeError(
|
|
35
|
+
"Local source and destination conversation IDs do not match"
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
if (request.routing.surface !== "internal" && destination.conversationId !== request.conversationId) {
|
|
39
|
+
throw new TypeError(
|
|
40
|
+
"Local source, destination, and run conversation IDs do not match"
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const actor = request.routing.dispatch?.actor ?? request.routing.actor;
|
|
45
|
+
if (!actor || actor.platform === "system") {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (actor.platform !== destination.platform) {
|
|
49
|
+
throw new TypeError(
|
|
50
|
+
`Actor platform "${actor.platform}" does not match destination platform "${destination.platform}"`
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
if (actor.platform === "slack" && destination.platform === "slack" && actor.teamId !== destination.teamId) {
|
|
54
|
+
throw new TypeError("Slack actor team does not match destination team");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function toolInvocationDestination(routing) {
|
|
58
|
+
if (routing.destination.platform !== "slack" || !routing.toolChannelId) {
|
|
59
|
+
return routing.destination;
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
platform: "slack",
|
|
63
|
+
teamId: routing.destination.teamId,
|
|
64
|
+
channelId: routing.toolChannelId
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function surfaceFromRouting(routing) {
|
|
68
|
+
if (routing.surface) {
|
|
69
|
+
return routing.surface;
|
|
70
|
+
}
|
|
71
|
+
return routing.source.platform === "slack" ? "slack" : "internal";
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export {
|
|
75
|
+
isAgentRunFeatureDisabled,
|
|
76
|
+
RetryableDeliveryError,
|
|
77
|
+
actorFromRouting,
|
|
78
|
+
assertRunRoutingConsistency,
|
|
79
|
+
toolInvocationDestination,
|
|
80
|
+
surfaceFromRouting
|
|
81
|
+
};
|
|
@@ -74,6 +74,15 @@ var credentialContextSchema = z.union([
|
|
|
74
74
|
subject: credentialSubjectSchema.optional()
|
|
75
75
|
}).strict()
|
|
76
76
|
]);
|
|
77
|
+
function credentialContextForActor(actor, subject) {
|
|
78
|
+
if (actor.platform === "system") {
|
|
79
|
+
return subject ? { actor, subject } : { actor };
|
|
80
|
+
}
|
|
81
|
+
if (subject) {
|
|
82
|
+
throw new TypeError("Delegated credential subjects require a system actor");
|
|
83
|
+
}
|
|
84
|
+
return { actor: { type: "user", userId: actor.userId } };
|
|
85
|
+
}
|
|
77
86
|
function credentialUserSubjectId(context) {
|
|
78
87
|
if ("type" in context.actor) {
|
|
79
88
|
return context.actor.userId;
|
|
@@ -84,5 +93,6 @@ function credentialUserSubjectId(context) {
|
|
|
84
93
|
export {
|
|
85
94
|
credentialSubjectSchema,
|
|
86
95
|
credentialContextSchema,
|
|
96
|
+
credentialContextForActor,
|
|
87
97
|
credentialUserSubjectId
|
|
88
98
|
};
|