@sentry/junior 0.74.1 → 0.76.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/README.md +1 -1
- package/bin/junior.mjs +4 -66
- package/dist/agent-hooks-ZOE7RIED.js +37 -0
- package/dist/api-reference.d.ts +3 -1
- package/dist/app.js +5516 -5422
- package/dist/build/copy-build-content.d.ts +1 -1
- package/dist/build/virtual-config.d.ts +2 -2
- package/dist/chat/agent-dispatch/context.d.ts +2 -3
- package/dist/chat/agent-dispatch/runner.d.ts +2 -0
- package/dist/chat/agent-dispatch/types.d.ts +2 -1
- package/dist/chat/config.d.ts +3 -0
- package/dist/chat/credentials/state-adapter-token-store.d.ts +2 -0
- package/dist/chat/credentials/subject.d.ts +3 -3
- package/dist/chat/credentials/user-token-store.d.ts +17 -12
- package/dist/chat/db.d.ts +8 -0
- package/dist/chat/mcp/auth-store.d.ts +2 -1
- package/dist/chat/mcp/oauth.d.ts +2 -1
- package/dist/chat/oauth-flow.d.ts +3 -1
- package/dist/chat/pi/client.d.ts +15 -7
- package/dist/chat/plugins/agent-hooks.d.ts +20 -13
- package/dist/chat/plugins/auth/oauth-request.d.ts +11 -7
- package/dist/chat/plugins/credential-hooks.d.ts +6 -6
- package/dist/chat/plugins/logging.d.ts +2 -2
- package/dist/chat/plugins/model.d.ts +9 -0
- package/dist/chat/plugins/package-discovery.d.ts +2 -1
- package/dist/chat/plugins/prompt.d.ts +5 -0
- package/dist/chat/plugins/registry.d.ts +4 -0
- package/dist/chat/plugins/state.d.ts +3 -5
- package/dist/chat/plugins/task-callback.d.ts +5 -0
- package/dist/chat/plugins/task-message.d.ts +23 -0
- package/dist/chat/plugins/task-queue.d.ts +5 -0
- package/dist/chat/plugins/task-runner.d.ts +12 -0
- package/dist/chat/plugins/task-signing.d.ts +31 -0
- package/dist/chat/plugins/types.d.ts +1 -0
- package/dist/chat/plugins/validation.d.ts +5 -0
- package/dist/chat/prompt.d.ts +15 -1
- package/dist/chat/requester.d.ts +6 -5
- package/dist/chat/respond-helpers.d.ts +2 -0
- package/dist/chat/respond.d.ts +13 -2
- package/dist/chat/runtime/agent-continue-runner.d.ts +4 -0
- package/dist/chat/runtime/reply-executor.d.ts +5 -1
- package/dist/chat/runtime/slack-resume.d.ts +10 -2
- package/dist/chat/runtime/slack-runtime.d.ts +6 -1
- package/dist/chat/sandbox/egress-credentials.d.ts +8 -8
- package/dist/chat/sandbox/sandbox.d.ts +2 -2
- package/dist/chat/sentry.d.ts +1 -0
- package/dist/chat/services/mcp-auth-orchestration.d.ts +2 -1
- package/dist/chat/services/plugin-auth-orchestration.d.ts +2 -1
- package/dist/chat/services/subscribed-decision.d.ts +2 -2
- package/dist/chat/services/turn-session-record.d.ts +11 -7
- package/dist/chat/sql/db.d.ts +3 -0
- package/dist/chat/sql/executor.d.ts +7 -0
- package/dist/chat/sql/neon.d.ts +2 -4
- package/dist/chat/sql/postgres.d.ts +6 -0
- package/dist/chat/state/turn-session.d.ts +8 -5
- package/dist/chat/task-execution/state.d.ts +7 -2
- package/dist/chat/task-execution/worker.d.ts +1 -1
- package/dist/chat/tools/agent-tools.d.ts +9 -2
- package/dist/chat/tools/slack/context.d.ts +2 -2
- package/dist/chat/tools/types.d.ts +7 -4
- package/dist/chat/vercel-queue-client.d.ts +3 -0
- package/dist/{chunk-YOHFWWBV.js → chunk-2ECJXSVQ.js} +5 -107
- package/dist/{chunk-OR6NQJ5E.js → chunk-4SCWV7TJ.js} +3 -3
- package/dist/chunk-4UO6FK4G.js +64 -0
- package/dist/chunk-56TBVRJG.js +115 -0
- package/dist/{chunk-3BYAPS6B.js → chunk-EJN6G5A2.js} +17 -11
- package/dist/{chunk-SQGMG7OD.js → chunk-HHDUKWVG.js} +508 -149
- package/dist/{chunk-6UP2Z2RZ.js → chunk-JBASI5VV.js} +7 -7
- package/dist/chunk-KNFROR7R.js +127 -0
- package/dist/{chunk-HYHKTFG2.js → chunk-KOIMO7S3.js} +186 -910
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/chunk-NFTMTIP3.js +964 -0
- package/dist/chunk-NYKJ3KON.js +1082 -0
- package/dist/{chunk-SJHUF3DP.js → chunk-OJ53FYVG.js} +2 -10
- package/dist/{chunk-KVZL5NZS.js → chunk-Q3XNY442.js} +17 -7
- package/dist/{chunk-YRDS7VKO.js → chunk-Q6XFTRV5.js} +2 -2
- package/dist/chunk-R6Z5XWY3.js +1076 -0
- package/dist/chunk-RV5RYIJW.js +56 -0
- package/dist/chunk-SG5WAA7H.js +132 -0
- package/dist/chunk-ST6YNAXG.js +54 -0
- package/dist/{chunk-GM7HTXYC.js → chunk-T77LUIX3.js} +148 -151
- package/dist/{chunk-CYUI7JU5.js → chunk-VALUBQ7R.js} +22 -30
- package/dist/chunk-XBBC6W45.js +71 -0
- package/dist/chunk-Y2CM7HXH.js +111 -0
- package/dist/{chunk-F6HWCPOC.js → chunk-Y5OFBCBZ.js} +1 -1
- package/dist/{chunk-M4FLLXXD.js → chunk-Z4CIQ3EB.js} +5 -1
- package/dist/{chunk-7Q5YOUUT.js → chunk-ZLMBNBUG.js} +146 -52
- package/dist/{chunk-2LUZA3LY.js → chunk-ZQB37HUX.js} +11 -11
- package/dist/cli/chat.js +87 -8
- package/dist/cli/check.js +8 -7
- package/dist/cli/env.js +4 -53
- package/dist/cli/init.js +6 -1
- package/dist/cli/main.js +84 -0
- package/dist/cli/plugins.js +244 -0
- package/dist/cli/run.js +5 -52
- package/dist/cli/snapshot-warmup.js +12 -11
- package/dist/cli/upgrade.js +385 -26
- package/dist/db-7A7PFRGL.js +17 -0
- package/dist/deployment.d.ts +1 -0
- package/dist/handlers/sandbox-egress-route.d.ts +4 -0
- package/dist/handlers/slack-webhook.d.ts +4 -0
- package/dist/handlers/webhooks.d.ts +6 -13
- package/dist/instrumentation.js +14 -18
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +67 -101
- package/dist/plugin-module.d.ts +21 -0
- package/dist/plugins-PZMDS7AT.js +15 -0
- package/dist/plugins.d.ts +9 -5
- package/dist/registry-OIPAJU2O.js +46 -0
- package/dist/reporting/conversations.d.ts +3 -3
- package/dist/reporting.d.ts +6 -5
- package/dist/reporting.js +42 -28
- package/dist/{runner-27NP2TEO.js → runner-KPLNHDCV.js} +77 -19
- package/dist/sentry-4CP5NNQ5.js +31 -0
- package/dist/validation-SLA6IGF7.js +15 -0
- package/dist/vercel.js +1 -1
- package/package.json +14 -11
- package/dist/chat/conversations/configured.d.ts +0 -5
- package/dist/chat/conversations/state.d.ts +0 -4
- package/dist/chunk-2KG3PWR4.js +0 -17
- package/dist/chunk-JL2SLRAT.js +0 -1970
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SANDBOX_WORKSPACE_ROOT
|
|
3
3
|
} from "./chunk-G3E7SCME.js";
|
|
4
|
-
import {
|
|
5
|
-
getPluginRuntimeDependencies,
|
|
6
|
-
getPluginRuntimePostinstall
|
|
7
|
-
} from "./chunk-7Q5YOUUT.js";
|
|
8
4
|
import {
|
|
9
5
|
getStateAdapter
|
|
10
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-Y5OFBCBZ.js";
|
|
11
7
|
import {
|
|
12
8
|
toOptionalTrimmed
|
|
13
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-T77LUIX3.js";
|
|
10
|
+
import {
|
|
11
|
+
getPluginRuntimeDependencies,
|
|
12
|
+
getPluginRuntimePostinstall
|
|
13
|
+
} from "./chunk-ZLMBNBUG.js";
|
|
14
14
|
import {
|
|
15
15
|
withSpan
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-EJN6G5A2.js";
|
|
17
17
|
|
|
18
18
|
// src/chat/sandbox/runtime-dependency-snapshots.ts
|
|
19
19
|
import { createHash } from "crypto";
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// src/chat/vercel-queue-client.ts
|
|
2
|
+
import { QueueClient } from "@vercel/queue";
|
|
3
|
+
function defaultQueueClientOptions() {
|
|
4
|
+
if (process.env.VERCEL_DEPLOYMENT_ID?.trim()) {
|
|
5
|
+
return {};
|
|
6
|
+
}
|
|
7
|
+
return { deploymentId: null };
|
|
8
|
+
}
|
|
9
|
+
function createVercelQueueClient() {
|
|
10
|
+
return new QueueClient(defaultQueueClientOptions());
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// src/chat/plugins/task-message.ts
|
|
14
|
+
import { createHash } from "crypto";
|
|
15
|
+
import { z } from "zod";
|
|
16
|
+
var pluginTaskParamsSchema = z.object({
|
|
17
|
+
conversationId: z.string().min(1),
|
|
18
|
+
sessionId: z.string().min(1)
|
|
19
|
+
}).strict();
|
|
20
|
+
var pluginTaskQueueMessageSchema = z.object({
|
|
21
|
+
name: z.string().min(1),
|
|
22
|
+
params: pluginTaskParamsSchema,
|
|
23
|
+
plugin: z.string().min(1)
|
|
24
|
+
}).strict();
|
|
25
|
+
function pluginTaskId(args) {
|
|
26
|
+
const digest = createHash("sha256").update(args.plugin).update("\0").update(args.name).update("\0").update(args.params.conversationId).update("\0").update(args.params.sessionId).digest("hex").slice(0, 32);
|
|
27
|
+
return `plugin-task_${digest}`;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// src/chat/plugins/task-signing.ts
|
|
31
|
+
import { createHmac, timingSafeEqual } from "crypto";
|
|
32
|
+
import { z as z2 } from "zod";
|
|
33
|
+
var SIGNATURE_CONTEXT = "junior.plugin_task_queue.v1";
|
|
34
|
+
var SIGNATURE_VERSION = "v1";
|
|
35
|
+
var PLUGIN_TASK_QUEUE_SIGNATURE_MAX_SKEW_MS = 60 * 60 * 1e3;
|
|
36
|
+
var signedPluginTaskQueueMessageSchema = pluginTaskQueueMessageSchema.extend({
|
|
37
|
+
signature: z2.string().min(1).refine((value) => value.trim().length > 0),
|
|
38
|
+
signatureVersion: z2.literal(SIGNATURE_VERSION),
|
|
39
|
+
signedAtMs: z2.number().finite()
|
|
40
|
+
}).strict();
|
|
41
|
+
function queueSecret() {
|
|
42
|
+
return process.env.JUNIOR_SECRET?.trim() || void 0;
|
|
43
|
+
}
|
|
44
|
+
function signingPayload(message, signedAtMs) {
|
|
45
|
+
return [
|
|
46
|
+
SIGNATURE_CONTEXT,
|
|
47
|
+
signedAtMs,
|
|
48
|
+
message.plugin,
|
|
49
|
+
message.name,
|
|
50
|
+
message.params.conversationId,
|
|
51
|
+
message.params.sessionId
|
|
52
|
+
].join("\0");
|
|
53
|
+
}
|
|
54
|
+
function hmac(message, signedAtMs, secret) {
|
|
55
|
+
return createHmac("sha256", secret).update(signingPayload(message, signedAtMs)).digest("hex");
|
|
56
|
+
}
|
|
57
|
+
function parseSignedMessage(value) {
|
|
58
|
+
const parsed = signedPluginTaskQueueMessageSchema.safeParse(value);
|
|
59
|
+
return parsed.success ? parsed.data : void 0;
|
|
60
|
+
}
|
|
61
|
+
function signPluginTaskQueueMessage(message, nowMs = Date.now()) {
|
|
62
|
+
const secret = queueSecret();
|
|
63
|
+
if (!secret) {
|
|
64
|
+
throw new Error(
|
|
65
|
+
"Cannot sign plugin task queue message without JUNIOR_SECRET"
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
...message,
|
|
70
|
+
signedAtMs: nowMs,
|
|
71
|
+
signatureVersion: SIGNATURE_VERSION,
|
|
72
|
+
signature: hmac(message, nowMs, secret)
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function verifyPluginTaskQueueMessage(value, nowMs = Date.now()) {
|
|
76
|
+
const message = parseSignedMessage(value);
|
|
77
|
+
if (!message) {
|
|
78
|
+
return { status: "rejected", reason: "malformed" };
|
|
79
|
+
}
|
|
80
|
+
const secret = queueSecret();
|
|
81
|
+
if (!secret) {
|
|
82
|
+
return { status: "unavailable", reason: "missing_secret" };
|
|
83
|
+
}
|
|
84
|
+
if (!Number.isFinite(nowMs)) {
|
|
85
|
+
return { status: "unavailable", reason: "invalid_clock" };
|
|
86
|
+
}
|
|
87
|
+
if (Math.abs(nowMs - message.signedAtMs) > PLUGIN_TASK_QUEUE_SIGNATURE_MAX_SKEW_MS) {
|
|
88
|
+
return { status: "rejected", reason: "expired" };
|
|
89
|
+
}
|
|
90
|
+
const expected = Buffer.from(hmac(message, message.signedAtMs, secret));
|
|
91
|
+
const actual = Buffer.from(message.signature);
|
|
92
|
+
if (expected.length !== actual.length || !timingSafeEqual(expected, actual)) {
|
|
93
|
+
return { status: "rejected", reason: "signature_mismatch" };
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
status: "verified",
|
|
97
|
+
message: {
|
|
98
|
+
name: message.name,
|
|
99
|
+
params: message.params,
|
|
100
|
+
plugin: message.plugin
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// src/chat/plugins/task-queue.ts
|
|
106
|
+
var PLUGIN_TASK_QUEUE_TOPIC = "junior_plugin_tasks";
|
|
107
|
+
var PLUGIN_TASK_QUEUE_RETENTION_SECONDS = PLUGIN_TASK_QUEUE_SIGNATURE_MAX_SKEW_MS / 1e3;
|
|
108
|
+
async function sendVercelPluginTask(message) {
|
|
109
|
+
const client = createVercelQueueClient();
|
|
110
|
+
await client.send(
|
|
111
|
+
PLUGIN_TASK_QUEUE_TOPIC,
|
|
112
|
+
signPluginTaskQueueMessage(message),
|
|
113
|
+
{
|
|
114
|
+
idempotencyKey: pluginTaskId(message),
|
|
115
|
+
retentionSeconds: PLUGIN_TASK_QUEUE_RETENTION_SECONDS
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export {
|
|
121
|
+
pluginTaskParamsSchema,
|
|
122
|
+
pluginTaskId,
|
|
123
|
+
createVercelQueueClient,
|
|
124
|
+
verifyPluginTaskQueueMessage,
|
|
125
|
+
PLUGIN_TASK_QUEUE_TOPIC,
|
|
126
|
+
sendVercelPluginTask
|
|
127
|
+
};
|