@sentry/junior 0.301.0 → 0.302.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-context-Cx9fn9B3.js +43 -0
- package/dist/{admin-CRJHvCGg.js → admin-_poE5NKL.js} +2 -2
- package/dist/{agent-runner-H4YhvNBj.js → agent-runner-CY9RvsTX.js} +1380 -10601
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +4 -5
- package/dist/api.d.ts +1 -1
- package/dist/api.js +91 -68
- package/dist/{app-HDZglaIu.d.ts → app-BpY3wtRP.d.ts} +2 -2
- package/dist/app.d.ts +1 -1
- package/dist/app.js +66 -296
- package/dist/{background-compaction-queue-CNrZ3QcU.js → background-compaction-queue-CXFq1_Cz.js} +94 -203
- package/dist/{briefs-x6Mzwxmg.js → briefs-B3NG-pid.js} +2 -2
- package/dist/{catalog-runtime-BEY6EGRi.js → catalog-runtime-Dss0lSV6.js} +1 -1
- package/dist/cli/chat.js +15 -15
- 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-CmjhyqgB.js → config-CzeZiMKs.js} +2 -2
- package/dist/{connections-CfIRm0xv.js → connections-CDYhMfrs.js} +6 -6
- package/dist/{continue-in-slack-DPoABVkB.js → continue-in-slack-7Uf05ndC.js} +5 -6
- package/dist/{conversation-feed-CfpyFMHP.js → conversation-feed-Clf_cv0n.js} +1 -0
- package/dist/{conversation-privacy-0CM0V2qK.js → conversation-privacy-D9xnM5mK.js} +1 -1
- package/dist/{conversation-turn-C0sxyvS-.js → conversation-turn-D7SEZgTG.js} +15 -16
- package/dist/{credential-sync-tEMKZ_8M.js → credential-sync-DoD0gW-j.js} +13 -15
- package/dist/{db-Czra10QW.js → db-B-gtnNjr.js} +314 -5
- package/dist/{db-BdUHQhrC.d.ts → db-BdsCzytP.d.ts} +1 -1
- package/dist/{executor-D_023K0H.js → executor-DZg20EqU.js} +39 -4
- package/dist/install-t1KQyTUs.js +228 -0
- package/dist/instrumentation.js +2 -2
- package/dist/{state-CEbZuZD6.js → legacy-web-actor-id-C-cEeWqL.js} +33 -4
- package/dist/{lineage-DmMIE0VL.js → lineage-C79GjoQr.js} +2 -2
- package/dist/{logging-DcjLDDqi.js → logging-C9oDAg4M.js} +7 -3
- package/dist/{message-C0JY9RJP.js → message-BLUCzJXN.js} +8 -8
- package/dist/{model-input-CBp-p24N.js → model-input-5jwNC45G.js} +3 -3
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +4 -3
- package/dist/{oauth-callback-server-BRq9QNhU.js → oauth-callback-server-BBl66vCb.js} +2 -2
- package/dist/{projection-CQNDOi82.js → projection-CIBwgD3s.js} +282 -64
- package/dist/{prompt-DLUB5m72.js → prompt-CRQbzp5e.js} +14 -4
- package/dist/queue-DtCDaIct.js +115 -0
- package/dist/{registry-Dj377ADs.js → registry-DdFQHZ_d.js} +1 -1
- package/dist/{resolve-DJkh9Fky.js → resolve-CdW4BdrK.js} +4 -229
- package/dist/{result-C8iIpDl1.js → result-oOMv1t4O.js} +9 -9
- package/dist/{runner-DZqrOy8C.js → runner-DqitLtm-.js} +8 -8
- package/dist/{sandbox-egress-signals-CGwH86S9.js → sandbox-egress-signals-Bw9I0yfJ.js} +1 -1
- package/dist/{schema-CdZFn7Qd.d.ts → schema-BIFM-U1a.d.ts} +441 -30
- package/dist/{schema-DyHXiQKI.js → schema-DnVQepWP.js} +66 -29
- package/dist/{service-account-D6jGR4a1.js → service-account-B6mKAPVo.js} +3 -3
- package/dist/{service-account-suY004dx.js → service-account-CrZftRTb.js} +257 -6
- package/dist/{session-stop-BLmfFI3d.js → session-stop-DW63Z3kj.js} +543 -548
- package/dist/{skills-CmNG0dHb.js → skills-C16fz60Z.js} +2 -2
- package/dist/{slack-conversation-unfurl-Bty-DlHe.js → slack-conversation-unfurl-BHhefEb7.js} +8 -7
- package/dist/{spawn-CNjkpXpk.js → spawn-D_RnFYfy.js} +6 -6
- package/dist/{stop-Bjy2-K4H.js → stop-7p1i08CY.js} +724 -106
- package/dist/{store-DmV4CoNr.js → store-C28I0CVW.js} +5 -5
- package/dist/{task-queue-AhG1tSXR.js → task-queue-BVUJbQ28.js} +3 -3
- package/dist/{task-runner-BMxZI3o7.js → task-runner-CWi8j7Z6.js} +6 -8
- package/dist/{thread-context-CXLnbg7g.js → thread-context-D3-yYUd0.js} +7 -7
- package/dist/{store-Epv6t4vV.js → turn-session-routing-BFMS9ATF.js} +381 -10
- package/dist/{turn-user-message-DsUZi9gn.js → turn-user-message-C3-O8Omt.js} +3 -3
- package/dist/{validation-DOz8X9BU.js → validation-BSFKUIb4.js} +1 -1
- package/dist/{version-CGMRmMPK.js → version-BHHXNi-0.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-H3EsMWtJ.js → viewer-B1SO21Qa.js} +3 -3
- package/dist/warmup-Bz9bzkzN.js +13927 -0
- package/dist/{statuses-Hn-HsOph.js → web-message-id-lNodcCOI.js} +136 -1
- package/dist/{worker-ClphajjD.js → worker-BspReIIK.js} +7 -7
- package/migrations/0108_conversation_embeddings.sql +13 -0
- package/migrations/meta/0108_snapshot.json +4688 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +8 -6
- package/dist/adapter-CNjGEJO9.js +0 -303
- package/dist/reporting-window-DopzcOHh.js +0 -137
- package/dist/turn-session-routing-BD3-jJl7.js +0 -380
- package/dist/users-BxvYclQg.js +0 -424
- package/dist/warmup-CdU5hR49.js +0 -3715
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { i as getChatConfig } from "./config-CzeZiMKs.js";
|
|
2
|
+
import { h as logWarn } from "./logging-C9oDAg4M.js";
|
|
3
|
+
import { a as queueCallback, d as verifyQueueMessage, f as getQueueProvider, l as QUEUE_SIGNATURE_MAX_AGE_MS, u as signQueueMessage } from "./background-compaction-queue-CXFq1_Cz.js";
|
|
4
|
+
import * as z from "zod";
|
|
5
|
+
import { createHash } from "node:crypto";
|
|
6
|
+
// src/chat/sandbox/snapshot/job-queue.ts
|
|
7
|
+
/** Send Workspace snapshot build messages. */
|
|
8
|
+
const SIGNATURE_CONTEXT = "junior.workspace_snapshot_queue.v1";
|
|
9
|
+
const SIGNATURE_VERSION = "v1";
|
|
10
|
+
const WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC = "junior_workspace_snapshots";
|
|
11
|
+
const workspaceSnapshotJobSign = {
|
|
12
|
+
context: SIGNATURE_CONTEXT,
|
|
13
|
+
schema: z.object({
|
|
14
|
+
workspaceId: z.string().uuid(),
|
|
15
|
+
profileHash: z.string().min(1)
|
|
16
|
+
}).strict(),
|
|
17
|
+
signatureVersion: SIGNATURE_VERSION,
|
|
18
|
+
parts: (message) => [message.workspaceId, message.profileHash]
|
|
19
|
+
};
|
|
20
|
+
function jobId(message) {
|
|
21
|
+
return `workspace-snapshot_${createHash("sha256").update(message.workspaceId).update("\0").update(message.profileHash).digest("hex").slice(0, 32)}`;
|
|
22
|
+
}
|
|
23
|
+
/** Sign a Workspace snapshot job for tests and local checks. */
|
|
24
|
+
function signWorkspaceSnapshotJobMessage(message, nowMs = Date.now()) {
|
|
25
|
+
return signQueueMessage(workspaceSnapshotJobSign, message, nowMs);
|
|
26
|
+
}
|
|
27
|
+
/** Check that a recent queue message came from Junior. */
|
|
28
|
+
function verifyWorkspaceSnapshotJobMessage(value, nowMs = Date.now()) {
|
|
29
|
+
return verifyQueueMessage(workspaceSnapshotJobSign, value, nowMs);
|
|
30
|
+
}
|
|
31
|
+
async function send(message, idempotencyKey) {
|
|
32
|
+
const options = { retentionSeconds: QUEUE_SIGNATURE_MAX_AGE_MS / 1e3 };
|
|
33
|
+
if (idempotencyKey) options.idempotencyKey = idempotencyKey;
|
|
34
|
+
await getQueueProvider().send(WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, signWorkspaceSnapshotJobMessage(message), options);
|
|
35
|
+
}
|
|
36
|
+
/** Send a job unless the same Workspace build already has one. */
|
|
37
|
+
async function sendWorkspaceSnapshotJob(message) {
|
|
38
|
+
await send(message, jobId(message));
|
|
39
|
+
}
|
|
40
|
+
/** Send the next job for a Workspace build that is still running. */
|
|
41
|
+
async function sendNextWorkspaceSnapshotJob(message) {
|
|
42
|
+
await send(message);
|
|
43
|
+
}
|
|
44
|
+
// src/chat/cache-warming/queue.ts
|
|
45
|
+
/** Send and receive delayed cache warmup messages. */
|
|
46
|
+
/** Deploy topic name. Keep stable for Vercel queue wiring. */
|
|
47
|
+
const CACHE_WARMUP_QUEUE_TOPIC = "junior_cache_warmups";
|
|
48
|
+
const CACHE_WARMUP_DEV_CONSUMER_GROUP = "junior_cache_warmups_dev";
|
|
49
|
+
const cacheWarmupSign = {
|
|
50
|
+
context: "junior.cache_warmup_queue.v1",
|
|
51
|
+
schema: z.discriminatedUnion("kind", [z.object({
|
|
52
|
+
kind: z.literal("warmup"),
|
|
53
|
+
conversationId: z.string().min(1),
|
|
54
|
+
cycle: z.number().int().positive(),
|
|
55
|
+
generation: z.string().min(1),
|
|
56
|
+
cacheExpiresAtMs: z.number().int().positive()
|
|
57
|
+
}).strict(), z.object({
|
|
58
|
+
kind: z.literal("horizon"),
|
|
59
|
+
conversationId: z.string().min(1),
|
|
60
|
+
generation: z.string().min(1)
|
|
61
|
+
}).strict()]),
|
|
62
|
+
signatureVersion: "v1",
|
|
63
|
+
parts: (message) => [
|
|
64
|
+
message.kind,
|
|
65
|
+
message.conversationId,
|
|
66
|
+
message.generation,
|
|
67
|
+
message.kind === "warmup" ? String(message.cycle) : "",
|
|
68
|
+
message.kind === "warmup" ? String(message.cacheExpiresAtMs) : ""
|
|
69
|
+
]
|
|
70
|
+
};
|
|
71
|
+
/** Send a cache warming message that is delivered after `delayMs`. */
|
|
72
|
+
async function sendCacheWarmup(message, delayMs) {
|
|
73
|
+
await getQueueProvider().send(CACHE_WARMUP_QUEUE_TOPIC, signQueueMessage(cacheWarmupSign, message), {
|
|
74
|
+
delaySeconds: Math.max(0, Math.floor(delayMs / 1e3)),
|
|
75
|
+
retentionSeconds: message.kind === "warmup" ? Math.min(QUEUE_SIGNATURE_MAX_AGE_MS / 1e3, Math.ceil(Math.max(0, delayMs) / 1e3) + 120) : QUEUE_SIGNATURE_MAX_AGE_MS / 1e3,
|
|
76
|
+
idempotencyKey: `cache-warmup_${message.generation}_${message.kind === "warmup" ? message.cycle : message.kind}`
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function logCacheWarmupRejected(reason, metadata, error) {
|
|
80
|
+
logWarn("cache_warming.queue_message.rejected", {
|
|
81
|
+
"app.queue.consumer_group": metadata.consumerGroup,
|
|
82
|
+
"app.queue.delivery_count": metadata.deliveryCount,
|
|
83
|
+
"app.queue.message_id": metadata.messageId,
|
|
84
|
+
"app.queue.reject_reason": reason,
|
|
85
|
+
"app.queue.topic_name": metadata.topicName,
|
|
86
|
+
...error instanceof Error ? { "exception.message": error.message } : void 0
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function cacheWarmupCallback() {
|
|
90
|
+
return queueCallback({
|
|
91
|
+
consumerGroup: CACHE_WARMUP_DEV_CONSUMER_GROUP,
|
|
92
|
+
maxDeliveries: 1,
|
|
93
|
+
onRejected: logCacheWarmupRejected,
|
|
94
|
+
run: async (message) => {
|
|
95
|
+
const { runCacheWarmup } = await import("./warmup-Bz9bzkzN.js").then((n) => n.o);
|
|
96
|
+
await runCacheWarmup(message);
|
|
97
|
+
},
|
|
98
|
+
skip: () => !getChatConfig().cacheWarmingEnabled,
|
|
99
|
+
topic: CACHE_WARMUP_QUEUE_TOPIC,
|
|
100
|
+
verify: (value) => verifyQueueMessage(cacheWarmupSign, value)
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/** Create the HTTP route for cache warmup messages. */
|
|
104
|
+
function createVercelCacheWarmupCallback() {
|
|
105
|
+
return cacheWarmupCallback().create();
|
|
106
|
+
}
|
|
107
|
+
/** Return the queue consumer for cache warmups, for a pulling queue worker. */
|
|
108
|
+
function cacheWarmupQueueConsumer() {
|
|
109
|
+
return cacheWarmupCallback().consumer;
|
|
110
|
+
}
|
|
111
|
+
/** Receive cache warmup messages during local development. */
|
|
112
|
+
function registerVercelCacheWarmupDevConsumer() {
|
|
113
|
+
return cacheWarmupCallback().registerDev();
|
|
114
|
+
}
|
|
115
|
+
export { sendCacheWarmup as a, sendWorkspaceSnapshotJob as c, registerVercelCacheWarmupDevConsumer as i, verifyWorkspaceSnapshotJobMessage as l, cacheWarmupQueueConsumer as n, WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC as o, createVercelCacheWarmupCallback as r, sendNextWorkspaceSnapshotJob as s, CACHE_WARMUP_QUEUE_TOPIC as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as setSpanAttributes, h as logWarn, m as logInfo } from "./logging-
|
|
1
|
+
import { b as setSpanAttributes, h as logWarn, m as logInfo } from "./logging-C9oDAg4M.js";
|
|
2
2
|
import { o as isUserActor, s as parseActorUserId } from "./actor-D2iXzvlN.js";
|
|
3
3
|
import { n as normalizePluginPackageNames, o as pluginRoots, t as discoverInstalledPluginPackageContent } from "./package-discovery-DJhGdS4c.js";
|
|
4
4
|
import * as z from "zod";
|
|
@@ -1,232 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ea as create, ia as getSandboxProvider, is as sleep, na as isStale } from "./projection-CIBwgD3s.js";
|
|
2
|
+
import { J as getStateAdapter } from "./db-B-gtnNjr.js";
|
|
3
|
+
import { i as trace, n as postinstall, o as getSandboxResources, t as dependencies } from "./install-t1KQyTUs.js";
|
|
4
4
|
import * as z from "zod";
|
|
5
|
-
// src/chat/sandbox/resources.ts
|
|
6
|
-
let configuredResources;
|
|
7
|
-
function resourcesFromEnv() {
|
|
8
|
-
const value = process.env.SANDBOX_VCPUS?.trim();
|
|
9
|
-
if (!value || !/^\d+$/.test(value)) return;
|
|
10
|
-
const vcpus = Number(value);
|
|
11
|
-
if (!Number.isSafeInteger(vcpus) || vcpus <= 0) return;
|
|
12
|
-
return { vcpus };
|
|
13
|
-
}
|
|
14
|
-
/** Return the app-level sandbox sizing override. */
|
|
15
|
-
function getSandboxResourceConfig() {
|
|
16
|
-
return configuredResources;
|
|
17
|
-
}
|
|
18
|
-
/** Replace app-level sandbox sizing and return the previous setting. */
|
|
19
|
-
function setSandboxResourceConfig(config) {
|
|
20
|
-
const previous = configuredResources;
|
|
21
|
-
if (config?.vcpus === void 0) {
|
|
22
|
-
configuredResources = void 0;
|
|
23
|
-
return previous;
|
|
24
|
-
}
|
|
25
|
-
if (!Number.isSafeInteger(config.vcpus) || config.vcpus <= 0) throw new Error("sandbox.vcpus must be a positive integer");
|
|
26
|
-
configuredResources = { vcpus: config.vcpus };
|
|
27
|
-
return previous;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Resolve sandbox sizing. A Workspace vCPU setting wins over the app setting,
|
|
31
|
-
* which wins over the legacy environment setting.
|
|
32
|
-
*/
|
|
33
|
-
function getSandboxResources(workspace) {
|
|
34
|
-
if (workspace?.vcpus) return { vcpus: workspace.vcpus };
|
|
35
|
-
return configuredResources ?? resourcesFromEnv();
|
|
36
|
-
}
|
|
37
|
-
// src/chat/sandbox/snapshot/span.ts
|
|
38
|
-
/** Record the reusable snapshot selected for a new Sandbox. */
|
|
39
|
-
function setSnapshotSpanAttributes(snapshot) {
|
|
40
|
-
setSpanAttributes({
|
|
41
|
-
"app.sandbox.source": snapshot.snapshotId ? "snapshot" : "created",
|
|
42
|
-
"app.sandbox.snapshot.cache_hit": snapshot.cacheHit,
|
|
43
|
-
"app.sandbox.snapshot.resolve_outcome": snapshot.resolveOutcome,
|
|
44
|
-
...snapshot.profileHash ? { "app.sandbox.snapshot.profile_hash": snapshot.profileHash } : void 0,
|
|
45
|
-
"app.sandbox.snapshot.dependency_count": snapshot.dependencyCount,
|
|
46
|
-
...snapshot.rebuildReason ? { "app.sandbox.snapshot.rebuild_reason": snapshot.rebuildReason } : void 0
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
/** Record one stage of dependency snapshot resolution or creation. */
|
|
50
|
-
async function trace(name, op, attributes, callback) {
|
|
51
|
-
return await withSpan(name, op, {}, callback, attributes);
|
|
52
|
-
}
|
|
53
|
-
// src/chat/sandbox/snapshot/install.ts
|
|
54
|
-
async function runOrThrow(sandbox, params, label) {
|
|
55
|
-
const result = await runNonInteractiveCommand(sandbox, params);
|
|
56
|
-
if (result.exitCode === 0) return;
|
|
57
|
-
const detail = result.stderr.trim() || result.stdout.trim() || "command failed";
|
|
58
|
-
throw new Error(`${label} failed: ${detail}`);
|
|
59
|
-
}
|
|
60
|
-
async function tryRun(sandbox, params) {
|
|
61
|
-
return (await runNonInteractiveCommand(sandbox, params)).exitCode === 0;
|
|
62
|
-
}
|
|
63
|
-
async function installGh(sandbox, signal, timeoutMs) {
|
|
64
|
-
if (await tryRun(sandbox, {
|
|
65
|
-
cmd: "dnf",
|
|
66
|
-
args: [
|
|
67
|
-
"install",
|
|
68
|
-
"-y",
|
|
69
|
-
"gh"
|
|
70
|
-
],
|
|
71
|
-
signal,
|
|
72
|
-
sudo: true,
|
|
73
|
-
timeoutMs
|
|
74
|
-
})) return;
|
|
75
|
-
if (!await tryRun(sandbox, {
|
|
76
|
-
cmd: "dnf",
|
|
77
|
-
args: [
|
|
78
|
-
"config-manager",
|
|
79
|
-
"addrepo",
|
|
80
|
-
"--from-repofile=https://cli.github.com/packages/rpm/gh-cli.repo"
|
|
81
|
-
],
|
|
82
|
-
signal,
|
|
83
|
-
sudo: true,
|
|
84
|
-
timeoutMs
|
|
85
|
-
})) {
|
|
86
|
-
await runOrThrow(sandbox, {
|
|
87
|
-
cmd: "dnf",
|
|
88
|
-
args: [
|
|
89
|
-
"install",
|
|
90
|
-
"-y",
|
|
91
|
-
"dnf-command(config-manager)"
|
|
92
|
-
],
|
|
93
|
-
signal,
|
|
94
|
-
sudo: true,
|
|
95
|
-
timeoutMs
|
|
96
|
-
}, "dnf install dnf-command(config-manager)");
|
|
97
|
-
await runOrThrow(sandbox, {
|
|
98
|
-
cmd: "dnf",
|
|
99
|
-
args: [
|
|
100
|
-
"config-manager",
|
|
101
|
-
"--add-repo",
|
|
102
|
-
"https://cli.github.com/packages/rpm/gh-cli.repo"
|
|
103
|
-
],
|
|
104
|
-
signal,
|
|
105
|
-
sudo: true,
|
|
106
|
-
timeoutMs
|
|
107
|
-
}, "dnf config-manager --add-repo gh-cli.repo");
|
|
108
|
-
}
|
|
109
|
-
await runOrThrow(sandbox, {
|
|
110
|
-
cmd: "dnf",
|
|
111
|
-
args: [
|
|
112
|
-
"install",
|
|
113
|
-
"-y",
|
|
114
|
-
"gh",
|
|
115
|
-
"--repo",
|
|
116
|
-
"gh-cli"
|
|
117
|
-
],
|
|
118
|
-
signal,
|
|
119
|
-
sudo: true,
|
|
120
|
-
timeoutMs
|
|
121
|
-
}, "dnf install gh --repo gh-cli");
|
|
122
|
-
}
|
|
123
|
-
function filePath(url, sha256) {
|
|
124
|
-
let basename = "package.rpm";
|
|
125
|
-
try {
|
|
126
|
-
const candidate = new URL(url).pathname.split("/").filter(Boolean).at(-1);
|
|
127
|
-
if (candidate) basename = candidate;
|
|
128
|
-
} catch {}
|
|
129
|
-
const sanitized = basename.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
130
|
-
return `/tmp/junior-runtime-${sha256.slice(0, 12)}-${sanitized}`;
|
|
131
|
-
}
|
|
132
|
-
async function installUrl(sandbox, dependency, signal, timeoutMs) {
|
|
133
|
-
const rpmPath = filePath(dependency.url, dependency.sha256);
|
|
134
|
-
await runOrThrow(sandbox, {
|
|
135
|
-
cmd: "curl",
|
|
136
|
-
args: [
|
|
137
|
-
"-fsSL",
|
|
138
|
-
dependency.url,
|
|
139
|
-
"-o",
|
|
140
|
-
rpmPath
|
|
141
|
-
],
|
|
142
|
-
signal,
|
|
143
|
-
timeoutMs
|
|
144
|
-
}, `curl download ${dependency.url}`);
|
|
145
|
-
const checksum = await runNonInteractiveCommand(sandbox, {
|
|
146
|
-
cmd: "sha256sum",
|
|
147
|
-
args: [rpmPath],
|
|
148
|
-
signal,
|
|
149
|
-
timeoutMs
|
|
150
|
-
});
|
|
151
|
-
const expected = dependency.sha256;
|
|
152
|
-
const actual = checksum.stdout.trim().split(/\s+/)[0]?.toLowerCase();
|
|
153
|
-
if (checksum.exitCode !== 0) {
|
|
154
|
-
const detail = checksum.stderr.trim() || checksum.stdout.trim() || "command failed";
|
|
155
|
-
throw new Error(`sha256sum failed: ${detail}`);
|
|
156
|
-
}
|
|
157
|
-
if (!actual) throw new Error("sha256sum produced empty output");
|
|
158
|
-
if (actual !== expected) throw new Error(`checksum mismatch for ${dependency.url}: expected ${expected}, got ${actual}`);
|
|
159
|
-
await runOrThrow(sandbox, {
|
|
160
|
-
cmd: "dnf",
|
|
161
|
-
args: [
|
|
162
|
-
"install",
|
|
163
|
-
"-y",
|
|
164
|
-
rpmPath
|
|
165
|
-
],
|
|
166
|
-
signal,
|
|
167
|
-
sudo: true,
|
|
168
|
-
timeoutMs
|
|
169
|
-
}, `dnf install ${dependency.url}`);
|
|
170
|
-
}
|
|
171
|
-
/** Install declared system and npm dependencies into a snapshot sandbox. */
|
|
172
|
-
async function dependencies(sandbox, values, signal, timeoutMs) {
|
|
173
|
-
const system = values.filter((dependency) => dependency.type === "system");
|
|
174
|
-
const npm = values.filter((dependency) => dependency.type === "npm").map((dependency) => `${dependency.package}@${dependency.version}`);
|
|
175
|
-
if (system.length > 0) await trace("sandbox.snapshot.install_system", "sandbox.snapshot.install.system", { "app.sandbox.snapshot.install.system_count": system.length }, async () => {
|
|
176
|
-
for (const dependency of system) {
|
|
177
|
-
signal?.throwIfAborted();
|
|
178
|
-
if ("url" in dependency) await installUrl(sandbox, dependency, signal, timeoutMs);
|
|
179
|
-
else if (dependency.package === "gh") await installGh(sandbox, signal, timeoutMs);
|
|
180
|
-
else await runOrThrow(sandbox, {
|
|
181
|
-
cmd: "dnf",
|
|
182
|
-
args: [
|
|
183
|
-
"install",
|
|
184
|
-
"-y",
|
|
185
|
-
dependency.package
|
|
186
|
-
],
|
|
187
|
-
signal,
|
|
188
|
-
sudo: true,
|
|
189
|
-
timeoutMs
|
|
190
|
-
}, `dnf install ${dependency.package}`);
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
if (npm.length > 0) await trace("sandbox.snapshot.install_npm", "sandbox.snapshot.install.npm", { "app.sandbox.snapshot.install.npm_count": npm.length }, async () => {
|
|
194
|
-
await runOrThrow(sandbox, {
|
|
195
|
-
cmd: "npm",
|
|
196
|
-
args: [
|
|
197
|
-
"install",
|
|
198
|
-
"--global",
|
|
199
|
-
"--prefix",
|
|
200
|
-
`${SANDBOX_WORKSPACE_ROOT}/.junior`,
|
|
201
|
-
...npm
|
|
202
|
-
],
|
|
203
|
-
signal,
|
|
204
|
-
timeoutMs
|
|
205
|
-
}, "npm install");
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
/** Run declared postinstall commands after dependency binaries are available. */
|
|
209
|
-
async function postinstall(sandbox, commands, signal, timeoutMs) {
|
|
210
|
-
if (commands.length === 0) return;
|
|
211
|
-
await trace("sandbox.snapshot.runtime_postinstall", "sandbox.snapshot.runtime_postinstall", { "app.sandbox.snapshot.runtime_postinstall.count": commands.length }, async () => {
|
|
212
|
-
for (const command of commands) {
|
|
213
|
-
signal?.throwIfAborted();
|
|
214
|
-
const result = await runNonInteractiveCommand(sandbox, {
|
|
215
|
-
cmd: command.cmd,
|
|
216
|
-
args: command.args,
|
|
217
|
-
login: true,
|
|
218
|
-
path: SANDBOX_COMMAND_PATH,
|
|
219
|
-
signal,
|
|
220
|
-
timeoutMs,
|
|
221
|
-
...command.sudo !== void 0 ? { sudo: command.sudo } : void 0
|
|
222
|
-
});
|
|
223
|
-
if (result.exitCode !== 0) {
|
|
224
|
-
const detail = result.stderr.trim() || result.stdout.trim() || "command failed";
|
|
225
|
-
throw new Error(`runtime-postinstall ${command.cmd} failed: ${detail}`);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
5
|
// src/chat/sandbox/snapshot/resolve.ts
|
|
231
6
|
const SNAPSHOT_CACHE_PREFIX = "junior:sandbox_snapshot_profile:v2";
|
|
232
7
|
const SNAPSHOT_LOCK_PREFIX = "junior:sandbox_snapshot_lock";
|
|
@@ -444,4 +219,4 @@ async function resolve(params) {
|
|
|
444
219
|
};
|
|
445
220
|
});
|
|
446
221
|
}
|
|
447
|
-
export {
|
|
222
|
+
export { resolve as n, getCachedSnapshot as t };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { Jn as renderUntrustedTag } from "./projection-
|
|
3
|
-
import {
|
|
4
|
-
import { f as credentialContextForActor } from "./registry-
|
|
5
|
-
import { a as EVENT_SYSTEM_ACTOR } from "./prompt-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
2
|
+
import { Jn as renderUntrustedTag } from "./projection-CIBwgD3s.js";
|
|
3
|
+
import { D as turnBehavior, M as SYSTEM_IDENTITY_ID, a as getConversationStore } from "./db-B-gtnNjr.js";
|
|
4
|
+
import { f as credentialContextForActor } from "./registry-DdFQHZ_d.js";
|
|
5
|
+
import { a as EVENT_SYSTEM_ACTOR } from "./prompt-CRQbzp5e.js";
|
|
6
|
+
import { C as listActiveMailboxTurns, N as renderEventBatchInputs, P as timerWatchCredentialSubject, T as resolveMailboxTurnWork, j as eventBatchMessageMeta, k as EVENT_WAIT_MS, s as eventReviewItemInputs, t as getConversationStoppedAtMs, w as parseEventMessages, x as getEventBatchDelayMs } from "./session-stop-DW63Z3kj.js";
|
|
7
|
+
import { $t as reportReplacedWithoutOpenWork, Cn as createAgentInvocationFromLatest, Ht as NON_TERMINAL_AGENT_INVOCATION_STATUSES, Jt as isTerminalAgentInvocation, Qt as markAgentInvocationParentMailboxAppended, Ut as TERMINAL_AGENT_INVOCATION_STATUSES, Vt as listUnreportedSiblingAgents, Yt as listAgentInvocationsForConversation, cn as parentMessageText, en as sendsResultToParent, fn as endActiveAgentInvocations, hn as resolveAgentInvocationId, in as routeChildInput, ln as readParentMessage, mn as enqueueAgentInvocation, nn as getChildAgentInputSender, pn as endAgentInvocationsOfStoppedWork, qt as getLatestAgentInvocationForConversation, rn as readChildConversationSender, sn as logDroppedParentMessage, tn as childAgentInput, un as createAgentInvocationWorker } from "./warmup-Bz9bzkzN.js";
|
|
8
|
+
import { C as agentInvocationResultEventType, S as AGENT_REPLY_EVENT_TYPE, b as AGENT_MESSAGE_EVENT_TYPE, y as AGENT_INVOCATION_EVENT_NAMESPACE } from "./web-message-id-lNodcCOI.js";
|
|
9
|
+
import { A as getAgentInvocationResultMessageId, C as ownAgentInvocation, D as getAgentInvocationIdForMessage, E as getAgentInvocationIdForEvents, F as getTurnReplyKey, M as getAgentReplyMessageId, O as getAgentInvocationIdForResult, R as buildDeterministicTurnId, S as listChildMessages, b as hasAgentInvocationReply, j as getAgentInvocationTurnId, y as childMessageSenderMetadata } from "./turn-user-message-C3-O8Omt.js";
|
|
10
|
+
import { _ as getConversationWorkState, r as appendAndEnqueueInboundMessage } from "./store-C28I0CVW.js";
|
|
11
11
|
import { actorSchema } from "@sentry/junior-plugin-api";
|
|
12
12
|
// src/chat/agent-invocations/result.ts
|
|
13
13
|
var result_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { A as latestConversationMessageSeq, I as upsertConversationMessage, M as normalizeConversationText, N as recordDeliveredAssistantMessage, W as authorizationId, a as loadProjection, b as persistConversationMessages, bn as persistWithRetry, d as recordAuthorizationCompleted, j as markConversationMessage, nt as saveTurnCheckpoint, t as commitAcceptedReply, un as getAssistantReplyText, v as hydrateConversationMessages } from "./projection-
|
|
2
|
-
import { S as setTags, T as withLogContext, p as logException } from "./logging-
|
|
3
|
-
import {
|
|
4
|
-
import { f as credentialContextForActor } from "./registry-
|
|
1
|
+
import { A as latestConversationMessageSeq, I as upsertConversationMessage, M as normalizeConversationText, N as recordDeliveredAssistantMessage, W as authorizationId, a as loadProjection, b as persistConversationMessages, bn as persistWithRetry, d as recordAuthorizationCompleted, j as markConversationMessage, nt as saveTurnCheckpoint, t as commitAcceptedReply, un as getAssistantReplyText, v as hydrateConversationMessages } from "./projection-CIBwgD3s.js";
|
|
2
|
+
import { S as setTags, T as withLogContext, p as logException } from "./logging-C9oDAg4M.js";
|
|
3
|
+
import { M as SYSTEM_IDENTITY_ID, a as getConversationStore, r as getConversationEventStore } from "./db-B-gtnNjr.js";
|
|
4
|
+
import { f as credentialContextForActor } from "./registry-DdFQHZ_d.js";
|
|
5
5
|
import { V as messageCardText } from "./conversation-BNXfq6Lb.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { c as buildDeliveredTurnStatePatch, l as loadPendingMessageCards, o as completeAuthPauseTurn, r as finalizeFailedTurnReplyWithEvent, t as buildTurnThreadContext } from "./thread-context-
|
|
9
|
-
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-
|
|
6
|
+
import { a as getPersistedThreadState, c as coerceThreadConversationState, i as getPersistedSandboxState, s as persistThreadStateById } from "./turn-session-routing-BFMS9ATF.js";
|
|
7
|
+
import { _ as ConversationTurnLifecycleService, g as startActiveTurn, h as markTurnFailed } from "./turn-user-message-C3-O8Omt.js";
|
|
8
|
+
import { c as buildDeliveredTurnStatePatch, l as loadPendingMessageCards, o as completeAuthPauseTurn, r as finalizeFailedTurnReplyWithEvent, t as buildTurnThreadContext } from "./thread-context-D3-yYUd0.js";
|
|
9
|
+
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-CWi8j7Z6.js";
|
|
10
10
|
import { randomUUID } from "node:crypto";
|
|
11
11
|
import { createLocalSource, localDestinationSchema } from "@sentry/junior-plugin-api";
|
|
12
12
|
// src/chat/local/runner.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { qa as sandboxEgressSignalsResponseSchema } from "./projection-
|
|
1
|
+
import { qa as sandboxEgressSignalsResponseSchema } from "./projection-CIBwgD3s.js";
|
|
2
2
|
// src/chat/local/sandbox-egress-signals.ts
|
|
3
3
|
const SANDBOX_EGRESS_SIGNALS_PATH = "/api/internal/sandbox-egress/signals";
|
|
4
4
|
const LOCAL_DEV_SERVER_TIMEOUT_MS = 1e3;
|