@sentry/junior 0.136.1 → 0.138.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-2KDSPPO4.js → agent-hooks-SCR74Q3E.js} +11 -9
- package/dist/api/conversations/projection.d.ts +1 -0
- package/dist/api/conversations/stats.d.ts +1 -0
- package/dist/api/schema/conversation.d.ts +2 -0
- package/dist/api/schema.js +1 -1
- package/dist/api.js +187 -46
- package/dist/app.d.ts +8 -1
- package/dist/app.js +519 -860
- package/dist/{catalog-runtime-WSZQGC4D.js → catalog-runtime-IU3QF4GG.js} +5 -5
- package/dist/chat/agent/request.d.ts +32 -2
- 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/configuration/defaults.d.ts +1 -1
- package/dist/chat/conversations/sql/store.d.ts +8 -0
- package/dist/chat/conversations/store.d.ts +9 -1
- package/dist/chat/experimental.d.ts +16 -0
- package/dist/chat/pi/client.d.ts +1 -8
- package/dist/chat/pi/gateway-auth.d.ts +16 -0
- package/dist/chat/runtime/agent-runner.d.ts +2 -1
- package/dist/chat/sandbox/docker.d.ts +17 -0
- package/dist/chat/services/agent-continue.d.ts +2 -0
- 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/services/subscribed-reply-router-policy.d.ts +12 -0
- package/dist/chat/services/turn-session-routing.d.ts +17 -0
- package/dist/chat/slack/message.d.ts +6 -1
- package/dist/chat/slack/source-link.d.ts +8 -2
- package/dist/chat/slack/team-domain.d.ts +4 -0
- package/dist/chat/source.d.ts +5 -5
- package/dist/chat/state/turn-session.d.ts +0 -2
- 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/tools/runtime/spawn-agent.d.ts +31 -0
- package/dist/chat/tools/types.d.ts +2 -0
- package/dist/chunk-3Y47VMHV.js +6 -0
- package/dist/chunk-5IDFPCON.js +46 -0
- package/dist/chunk-5LTJ4ITU.js +1523 -0
- package/dist/{chunk-KLBYCSLJ.js → chunk-5MXWHTCK.js} +17 -434
- package/dist/{chunk-CZZDCH3Q.js → chunk-A7WCHXZV.js} +206 -78
- package/dist/{chunk-4YQ6I6VF.js → chunk-BOLJOV5T.js} +2 -56
- package/dist/{chunk-XCZ6COFO.js → chunk-BYW4B4PR.js} +90 -54
- package/dist/{chunk-JQRTXJHD.js → chunk-C7ZVPO4Z.js} +2 -1
- package/dist/{chunk-MW2QRPGW.js → chunk-DCLLQGS6.js} +119 -50
- package/dist/{chunk-CDVCCOMF.js → chunk-E5UYAIKJ.js} +75 -1475
- package/dist/{chunk-3SUK3UXX.js → chunk-ELKW5FIB.js} +5 -5
- package/dist/chunk-EM225ITJ.js +56 -0
- package/dist/{chunk-Y6JNHTRD.js → chunk-FEUNPTGV.js} +34 -70
- package/dist/{chunk-TYNMSQKA.js → chunk-FNLBTB4K.js} +1 -1
- package/dist/{chunk-TRZSM67C.js → chunk-HCIVH3JS.js} +1 -0
- package/dist/chunk-HIWJWWMT.js +668 -0
- package/dist/chunk-IUFM5JWV.js +24 -0
- package/dist/{chunk-XWPA5KZF.js → chunk-JNNJZURV.js} +1 -1
- package/dist/{chunk-6ZK6FZIV.js → chunk-KCBZSJRU.js} +6 -27
- package/dist/{chunk-BG3KWWDJ.js → chunk-KDCHVT25.js} +1 -1
- package/dist/{chunk-VH6MI4L7.js → chunk-KFRHRSCJ.js} +1 -1
- package/dist/chunk-LPVUNO2W.js +320 -0
- package/dist/{chunk-G66RYKRS.js → chunk-N7WARMC6.js} +16 -776
- package/dist/chunk-PB3CXNVL.js +41 -0
- package/dist/chunk-Q6QZTTLS.js +55 -0
- package/dist/{chunk-3QNJOHKG.js → chunk-QS527AV5.js} +1 -1
- package/dist/chunk-R776HKPK.js +81 -0
- package/dist/{chunk-OTJMQYVP.js → chunk-RZIBSCYC.js} +517 -608
- package/dist/chunk-SD3OFRWY.js +714 -0
- package/dist/{chunk-HIRIWTWD.js → chunk-SIPKWSXK.js} +58 -10
- package/dist/chunk-TCS76X5D.js +441 -0
- package/dist/{chunk-UX2TNH5D.js → chunk-TDJCLNDH.js} +3 -3
- package/dist/{chunk-NVVBEJUB.js → chunk-TUUDXEXU.js} +336 -300
- package/dist/{chunk-22Z6MGMK.js → chunk-VPZFVJND.js} +1 -1
- package/dist/{chunk-RFDD3Z2I.js → chunk-YU5QUF67.js} +1 -1
- package/dist/chunk-ZBSMCXKV.js +710 -0
- package/dist/{chunk-FSYXYBWU.js → chunk-ZXNTJJIE.js} +2 -2
- package/dist/cli/chat.js +65 -26
- package/dist/cli/check.js +7 -7
- package/dist/cli/plugins.js +14 -12
- package/dist/cli/snapshot-create.js +10 -9
- package/dist/cli/upgrade.js +7 -7
- package/dist/conversation-work-KATFHLG3.js +56 -0
- package/dist/db/schema/agent-invocations.d.ts +544 -0
- package/dist/db/schema.d.ts +543 -1
- package/dist/{db-Z2NNL2JC.js → db-UO2IWXGA.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-PO3M5JMG.js → oauth-callback-server-MAQI43LX.js} +26 -18
- package/dist/{runner-QHQYZYJA.js → runner-PIUQEXKE.js} +26 -14
- package/dist/{skills-KXMT3DRA.js → skills-4ARJADHQ.js} +6 -6
- package/dist/spawn-G2AWPMCT.js +38 -0
- package/dist/{validation-Y42ULTT6.js → validation-S3EE3HWL.js} +6 -6
- package/dist/version.js +1 -1
- package/dist/work-UARRUAW3.js +46 -0
- package/dist/worker-DOCIRVD3.js +24 -0
- package/migrations/0021_first_warhawk.sql +35 -0
- package/migrations/meta/0021_snapshot.json +2176 -0
- package/migrations/meta/_journal.json +8 -1
- package/package.json +6 -5
|
@@ -3,19 +3,19 @@ import {
|
|
|
3
3
|
} from "./chunk-UTL3MHPC.js";
|
|
4
4
|
import {
|
|
5
5
|
parseSlackThreadId
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FNLBTB4K.js";
|
|
7
7
|
import {
|
|
8
8
|
normalizeSlackConversationId
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-TCS76X5D.js";
|
|
10
10
|
import {
|
|
11
11
|
getDb
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-SIPKWSXK.js";
|
|
13
13
|
import {
|
|
14
14
|
juniorTaskExecutions
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-DCLLQGS6.js";
|
|
16
16
|
import {
|
|
17
17
|
logWarn
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-JNNJZURV.js";
|
|
19
19
|
|
|
20
20
|
// src/handlers/health.ts
|
|
21
21
|
function readHealthReport() {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// src/chat/sandbox/paths.ts
|
|
2
|
+
function normalizeWorkspaceRoot(input) {
|
|
3
|
+
const candidate = (input ?? "").trim();
|
|
4
|
+
if (!candidate) {
|
|
5
|
+
return "/vercel/sandbox";
|
|
6
|
+
}
|
|
7
|
+
const normalized = candidate.replace(/\/+$/, "");
|
|
8
|
+
return normalized.startsWith("/") ? normalized : `/${normalized}`;
|
|
9
|
+
}
|
|
10
|
+
var SANDBOX_WORKSPACE_ROOT = normalizeWorkspaceRoot(
|
|
11
|
+
process.env.VERCEL_SANDBOX_WORKSPACE_DIR
|
|
12
|
+
);
|
|
13
|
+
var SANDBOX_SKILLS_ROOT = `${SANDBOX_WORKSPACE_ROOT}/skills`;
|
|
14
|
+
var SANDBOX_DATA_ROOT = `${SANDBOX_WORKSPACE_ROOT}/data`;
|
|
15
|
+
function sandboxSkillDir(skillName) {
|
|
16
|
+
return `${SANDBOX_SKILLS_ROOT}/${skillName}`;
|
|
17
|
+
}
|
|
18
|
+
function sandboxSkillFile(skillName) {
|
|
19
|
+
return `${sandboxSkillDir(skillName)}/SKILL.md`;
|
|
20
|
+
}
|
|
21
|
+
function sandboxSkillPathResolution(skillName) {
|
|
22
|
+
const skillDir = sandboxSkillDir(skillName);
|
|
23
|
+
return `Resolve relative paths in this skill against ${skillDir}. For bash commands from this skill, cd to ${skillDir} first or use absolute paths.`;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// src/chat/sleep.ts
|
|
27
|
+
function sleep(ms, signal) {
|
|
28
|
+
if (!signal) {
|
|
29
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
30
|
+
}
|
|
31
|
+
return new Promise((resolve, reject) => {
|
|
32
|
+
if (signal.aborted) {
|
|
33
|
+
reject(signal.reason);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const timeoutId = setTimeout(() => {
|
|
37
|
+
signal.removeEventListener("abort", onAbort);
|
|
38
|
+
resolve();
|
|
39
|
+
}, ms);
|
|
40
|
+
const onAbort = () => {
|
|
41
|
+
clearTimeout(timeoutId);
|
|
42
|
+
reject(signal.reason);
|
|
43
|
+
};
|
|
44
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
SANDBOX_WORKSPACE_ROOT,
|
|
50
|
+
SANDBOX_SKILLS_ROOT,
|
|
51
|
+
SANDBOX_DATA_ROOT,
|
|
52
|
+
sandboxSkillDir,
|
|
53
|
+
sandboxSkillFile,
|
|
54
|
+
sandboxSkillPathResolution,
|
|
55
|
+
sleep
|
|
56
|
+
};
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
persistThreadStateById,
|
|
23
23
|
stripRuntimeTurnContext,
|
|
24
24
|
updateConversationStats
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-TUUDXEXU.js";
|
|
26
26
|
import {
|
|
27
27
|
createPluginConversationEvents,
|
|
28
28
|
createPluginEmbedder,
|
|
@@ -30,26 +30,26 @@ import {
|
|
|
30
30
|
createPluginModel,
|
|
31
31
|
createPluginState,
|
|
32
32
|
getPlugins
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-5MXWHTCK.js";
|
|
34
34
|
import {
|
|
35
35
|
getDb,
|
|
36
36
|
sameActorIdentity
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-SIPKWSXK.js";
|
|
38
38
|
import {
|
|
39
39
|
getStateAdapter
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-BOLJOV5T.js";
|
|
41
41
|
import {
|
|
42
42
|
ProviderError,
|
|
43
43
|
findProviderError,
|
|
44
44
|
getProviderErrorAttributes,
|
|
45
45
|
getProviderErrorUserMessage
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-BYW4B4PR.js";
|
|
47
47
|
import {
|
|
48
48
|
parseSlackMessageTs
|
|
49
49
|
} from "./chunk-F3B2YJ76.js";
|
|
50
50
|
import {
|
|
51
51
|
buildTurnFailureResponse
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-JNNJZURV.js";
|
|
53
53
|
|
|
54
54
|
// src/chat/runtime/delivered-turn-state.ts
|
|
55
55
|
function buildDeliveredTurnStatePatch(args) {
|
|
@@ -82,6 +82,25 @@ import {
|
|
|
82
82
|
isPrivateSource,
|
|
83
83
|
pluginRunContextSchema
|
|
84
84
|
} from "@sentry/junior-plugin-api";
|
|
85
|
+
|
|
86
|
+
// src/chat/services/turn-session-routing.ts
|
|
87
|
+
async function resolveTurnSessionRouting(args) {
|
|
88
|
+
const conversationStore = args.conversationStore ?? (await import("./db-UO2IWXGA.js")).getConversationStore();
|
|
89
|
+
const conversation = await conversationStore.get({
|
|
90
|
+
conversationId: args.conversationId
|
|
91
|
+
});
|
|
92
|
+
if (!conversation?.destination || !conversation.sessionSource) {
|
|
93
|
+
throw new Error(
|
|
94
|
+
`Conversation ${args.conversationId} is missing durable routing metadata`
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
destination: conversation.destination,
|
|
99
|
+
source: conversation.sessionSource
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// src/chat/plugins/task-runner.ts
|
|
85
104
|
var PLUGIN_TASK_LOCK_TTL_MS = 5 * 60 * 1e3;
|
|
86
105
|
function isRecord(value) {
|
|
87
106
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
@@ -210,9 +229,8 @@ function messageExistedAtRunCompletion(message, completedAtMs) {
|
|
|
210
229
|
const messageTimestampMs = conversationMessageTimestampMs(message);
|
|
211
230
|
return messageTimestampMs !== void 0 && messageTimestampMs <= completedAtMs;
|
|
212
231
|
}
|
|
213
|
-
async function loadConversationContextTranscriptEntries(record) {
|
|
214
|
-
|
|
215
|
-
if (source?.platform !== "slack" || isPrivateSource(source)) {
|
|
232
|
+
async function loadConversationContextTranscriptEntries(record, source) {
|
|
233
|
+
if (source.platform !== "slack" || isPrivateSource(source)) {
|
|
216
234
|
return [];
|
|
217
235
|
}
|
|
218
236
|
const state = await getPersistedThreadState(record.conversationId);
|
|
@@ -274,30 +292,28 @@ async function loadPluginRun(params) {
|
|
|
274
292
|
if (record.state !== "completed") {
|
|
275
293
|
throw new Error("Completed plugin task session record is not completed");
|
|
276
294
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
);
|
|
281
|
-
}
|
|
295
|
+
const routing = await resolveTurnSessionRouting({
|
|
296
|
+
conversationId: params.conversationId
|
|
297
|
+
});
|
|
282
298
|
const runEntries = turnMessagesWithProvenance(record).map(
|
|
283
299
|
({ message, provenance }) => runTranscriptEntry(message, provenance, record.actor)
|
|
284
300
|
).filter((entry) => Boolean(entry));
|
|
285
301
|
const runMessageTexts = new Set(
|
|
286
302
|
runEntries.filter((entry) => entry.type === "message").map((entry) => entry.text)
|
|
287
303
|
);
|
|
288
|
-
const contextEntries = (await loadConversationContextTranscriptEntries(record)).filter(
|
|
304
|
+
const contextEntries = (await loadConversationContextTranscriptEntries(record, routing.source)).filter(
|
|
289
305
|
(entry) => entry.type !== "message" || !runMessageTexts.has(entry.text)
|
|
290
306
|
);
|
|
291
307
|
return pluginRunContextSchema.parse({
|
|
292
308
|
completedAtMs: record.updatedAtMs,
|
|
293
309
|
conversationId: record.conversationId,
|
|
294
|
-
destination:
|
|
310
|
+
destination: routing.destination,
|
|
295
311
|
// Derived from the full run provenance on the record, not the sliced or
|
|
296
312
|
// stripped transcript, so it reflects every committed instruction actor.
|
|
297
313
|
actors: record.actors,
|
|
298
314
|
...record.actor ? { actor: record.actor } : {},
|
|
299
315
|
runId: record.sessionId,
|
|
300
|
-
source:
|
|
316
|
+
source: routing.source,
|
|
301
317
|
transcript: [...contextEntries, ...runEntries]
|
|
302
318
|
});
|
|
303
319
|
}
|
|
@@ -471,58 +487,6 @@ function finalizeFailedTurnReplyWithEvent(args) {
|
|
|
471
487
|
};
|
|
472
488
|
}
|
|
473
489
|
|
|
474
|
-
// src/chat/conversations/turn-lifecycle.ts
|
|
475
|
-
var ConversationTurnLifecycleService = class {
|
|
476
|
-
constructor(events) {
|
|
477
|
-
this.events = events;
|
|
478
|
-
}
|
|
479
|
-
events;
|
|
480
|
-
/** Record the turn start once after every input message is durable. */
|
|
481
|
-
async start(input) {
|
|
482
|
-
await this.events.append(input.conversationId, [
|
|
483
|
-
{
|
|
484
|
-
idempotencyKey: `turn:${input.turnId}:started`,
|
|
485
|
-
createdAtMs: input.createdAtMs,
|
|
486
|
-
data: {
|
|
487
|
-
type: "turn_started",
|
|
488
|
-
turnId: input.turnId,
|
|
489
|
-
inputMessageIds: input.inputMessageIds,
|
|
490
|
-
surface: input.surface
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
]);
|
|
494
|
-
}
|
|
495
|
-
/** Record successful or intentional-silence completion once. */
|
|
496
|
-
async complete(input) {
|
|
497
|
-
await this.events.append(input.conversationId, [
|
|
498
|
-
{
|
|
499
|
-
idempotencyKey: `turn:${input.turnId}:terminal`,
|
|
500
|
-
createdAtMs: input.createdAtMs,
|
|
501
|
-
data: {
|
|
502
|
-
type: "turn_completed",
|
|
503
|
-
turnId: input.turnId,
|
|
504
|
-
outcome: input.outcome
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
]);
|
|
508
|
-
}
|
|
509
|
-
/** Record a classified failure once without accepting raw error details. */
|
|
510
|
-
async fail(input) {
|
|
511
|
-
await this.events.append(input.conversationId, [
|
|
512
|
-
{
|
|
513
|
-
idempotencyKey: `turn:${input.turnId}:terminal`,
|
|
514
|
-
createdAtMs: input.createdAtMs,
|
|
515
|
-
data: {
|
|
516
|
-
type: "turn_failed",
|
|
517
|
-
turnId: input.turnId,
|
|
518
|
-
failureCode: input.failureCode,
|
|
519
|
-
...input.eventId ? { eventId: input.eventId } : {}
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
]);
|
|
523
|
-
}
|
|
524
|
-
};
|
|
525
|
-
|
|
526
490
|
// src/chat/runtime/turn-user-message.ts
|
|
527
491
|
function getTurnUserMessage(conversation, sessionId) {
|
|
528
492
|
for (let index = conversation.messages.length - 1; index >= 0; index -= 1) {
|
|
@@ -589,13 +553,13 @@ export {
|
|
|
589
553
|
getTurnUserMessageId,
|
|
590
554
|
getTurnUserSlackMessageTs,
|
|
591
555
|
getTurnUserReplyAttachmentContext,
|
|
556
|
+
resolveTurnSessionRouting,
|
|
592
557
|
scheduleSessionCompletedPluginTasks,
|
|
593
558
|
processPluginTask,
|
|
594
559
|
getInterruptionMarker,
|
|
595
560
|
requireTurnFailureEventId,
|
|
596
561
|
getAgentTurnDiagnosticsAttributes,
|
|
597
562
|
finalizeFailedTurnReplyWithEvent,
|
|
598
|
-
ConversationTurnLifecycleService,
|
|
599
563
|
completeAuthPauseTurn,
|
|
600
564
|
persistAuthPauseTurnState
|
|
601
565
|
};
|
|
@@ -433,6 +433,7 @@ var conversationStatsItemSchema = z2.object({
|
|
|
433
433
|
tokens: z2.number().optional()
|
|
434
434
|
}).strict();
|
|
435
435
|
var conversationMetricDaySchema = z2.object({
|
|
436
|
+
conversations: z2.number(),
|
|
436
437
|
costUsd: z2.number().optional(),
|
|
437
438
|
date: z2.string(),
|
|
438
439
|
durationMs: z2.number(),
|