@sentry/junior 0.301.0 → 0.303.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-BdVnSuY5.js +43 -0
- package/dist/{admin-CRJHvCGg.js → admin-AfeAdS3J.js} +2 -2
- package/dist/{agent-runner-H4YhvNBj.js → agent-runner-BP8_DLUv.js} +4688 -13870
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +7 -8
- package/dist/api.d.ts +13 -12
- package/dist/api.js +268 -118
- package/dist/{app-HDZglaIu.d.ts → app-Dd9v1mNx.d.ts} +15 -15
- package/dist/app.d.ts +1 -1
- package/dist/app.js +99 -330
- package/dist/{automation-Cva5ZOwW.js → automation-D9MvhOWY.js} +3 -1
- package/dist/{background-compaction-queue-CNrZ3QcU.js → background-compaction-queue-xaE05jxH.js} +97 -206
- package/dist/{briefs-x6Mzwxmg.js → briefs-D8i-dKTp.js} +4 -4
- package/dist/{catalog-runtime-BEY6EGRi.js → catalog-runtime-d1EM6Z0V.js} +2 -2
- package/dist/cli/chat.d.ts +1 -1
- package/dist/cli/chat.js +21 -21
- package/dist/cli/check.js +8 -8
- package/dist/cli/env.d.ts +1 -0
- package/dist/cli/env.js +8 -7
- package/dist/cli/init.js +13 -4
- package/dist/cli/main.js +4 -4
- package/dist/cli/plugins.js +6 -6
- package/dist/cli/snapshot-create.js +7 -5
- package/dist/cli/upgrade.d.ts +2 -2
- package/dist/cli/upgrade.js +5 -5
- package/dist/{config-CmjhyqgB.js → config-oGM7KA9M.js} +44 -63
- package/dist/{connections-CfIRm0xv.js → connections-BlikzEJv.js} +6 -6
- package/dist/{continue-in-slack-DPoABVkB.js → continue-in-slack-BZnYifiG.js} +5 -6
- package/dist/{conversation-BNXfq6Lb.js → conversation-CY1jnBiC.js} +1 -1
- package/dist/{conversation-feed-CfpyFMHP.js → conversation-feed-BZJRk6UV.js} +2 -1
- package/dist/{conversation-privacy-0CM0V2qK.js → conversation-privacy-Cx515ddM.js} +7 -7
- package/dist/{conversation-turn-C0sxyvS-.js → conversation-turn-DAhRdX4m.js} +20 -24
- package/dist/{credential-sync-tEMKZ_8M.js → credential-sync-DfhmWFeo.js} +18 -20
- package/dist/{db-Czra10QW.js → db-C-2tFxk3.js} +326 -17
- package/dist/{db-BdUHQhrC.d.ts → db-DPqcEM9_.d.ts} +25 -25
- package/dist/{executor-D_023K0H.js → executor-NVfS8aQ2.js} +51 -10
- package/dist/{history-IjdmO_r6.js → history-UZ3M2M9r.js} +13 -10
- package/dist/install-CHLrpRZc.js +228 -0
- package/dist/instrumentation.d.ts +4 -4
- package/dist/instrumentation.js +10 -10
- package/dist/{lineage-DmMIE0VL.js → lineage-HGLhd_-N.js} +2 -2
- package/dist/{logging-DcjLDDqi.js → logging-DiyqRLBx.js} +24 -20
- package/dist/{message-C0JY9RJP.js → message-CkCOcbFH.js} +9 -9
- package/dist/{model-input-CBp-p24N.js → model-input-DmoPPtPE.js} +5 -10
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +7 -6
- package/dist/{oauth-callback-server-BRq9QNhU.js → oauth-callback-server-CIf_6YmA.js} +5 -4
- package/dist/{oauth-relay-DRzq73b6.js → oauth-relay-DAmfVmJu.js} +3 -6
- package/dist/{package-discovery-DJhGdS4c.js → package-discovery-x4AvVhMj.js} +1 -1
- package/dist/{plugin-module-Cf5gVPWP.js → plugin-module-Cv2ETe8Y.js} +1 -1
- package/dist/{plugins-BBX07Jzt.js → plugins-Bkk0XRo2.js} +3 -3
- package/dist/{projection-CQNDOi82.js → projection-DBq8tsA5.js} +489 -223
- package/dist/{prompt-DLUB5m72.js → prompt-D2KlJopL.js} +15 -5
- package/dist/{queue-CZyYgPF0.d.ts → queue-CbEHUO0l.d.ts} +1 -1
- package/dist/queue-DFaOscp5.js +115 -0
- package/dist/{registry-Dj377ADs.js → registry-Bu0Z9BEO.js} +37 -37
- package/dist/{resolve-DJkh9Fky.js → resolve-DXuA3G0g.js} +4 -229
- package/dist/{result-C8iIpDl1.js → result-DpiNseDA.js} +11 -16
- package/dist/rolldown-runtime-BKpuH2hG.js +26 -0
- package/dist/{runner-DZqrOy8C.js → runner-iu1heRFv.js} +10 -10
- package/dist/{sandbox-egress-signals-CGwH86S9.js → sandbox-egress-signals-2HFYDcQf.js} +1 -1
- package/dist/{schema-CdZFn7Qd.d.ts → schema-DHMOaRzC.d.ts} +959 -41
- package/dist/{schema-DyHXiQKI.js → schema-DvfX3Gq_.js} +141 -40
- package/dist/{secrets-DebYU866.js → secrets-DHaJ5TTn.js} +4 -4
- package/dist/{sentry-BRTJqumy.js → sentry-CPbZjomA.js} +3 -28
- package/dist/{sentry-route-name-BhwWnfqj.js → sentry-route-name-C6EIzAGP.js} +1 -1
- package/dist/{service-account-suY004dx.js → service-account-BcT5LR7V.js} +271 -20
- package/dist/{service-account-D6jGR4a1.js → service-account-xYkaQTrw.js} +3 -3
- package/dist/{session-stop-BLmfFI3d.js → session-stop-BLLp1IP_.js} +1098 -1110
- package/dist/{skills-CmNG0dHb.js → skills-CNAGH4ju.js} +6 -9
- package/dist/{slack-conversation-unfurl-Bty-DlHe.js → slack-conversation-unfurl-DYnqe5ci.js} +10 -14
- package/dist/{spawn-CNjkpXpk.js → spawn-cGasWW33.js} +7 -7
- package/dist/{state-CEbZuZD6.js → state-CDS6h_Wv.js} +34 -5
- package/dist/{stop-Bjy2-K4H.js → stop-DMMA67yT.js} +896 -196
- package/dist/{store-DmV4CoNr.js → store-Dgs7Oe44.js} +5 -5
- package/dist/{task-queue-AhG1tSXR.js → task-queue-DcF0nhhz.js} +3 -3
- package/dist/{task-runner-BMxZI3o7.js → task-runner-BGXF7Fo7.js} +15 -20
- package/dist/{thread-context-CXLnbg7g.js → thread-context-BPky1KBe.js} +12 -12
- package/dist/{store-Epv6t4vV.js → turn-session-routing-DGvn9MSl.js} +384 -13
- package/dist/{turn-user-message-DsUZi9gn.js → turn-user-message-19CkuUvM.js} +3 -3
- package/dist/{validation-DOz8X9BU.js → validation-lu1DgjNQ.js} +2 -2
- package/dist/vercel.js +1 -1
- package/dist/{version-CGMRmMPK.js → version-Uo3c94Dx.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-H3EsMWtJ.js → viewer-BPQHMx3-.js} +3 -3
- package/dist/warmup-H8uLvW9e.js +13946 -0
- package/dist/{statuses-Hn-HsOph.js → web-message-id-lNodcCOI.js} +136 -1
- package/dist/{worker-ClphajjD.js → worker-B-pM_-3K.js} +9 -12
- package/migrations/0108_conversation_embeddings.sql +13 -0
- package/migrations/0109_user_preferences.sql +1 -0
- package/migrations/0110_code_change_repository_state_index.sql +1 -0
- package/migrations/meta/0108_snapshot.json +4688 -0
- package/migrations/meta/0109_snapshot.json +4925 -0
- package/migrations/meta/0110_snapshot.json +4952 -0
- package/migrations/meta/_journal.json +22 -1
- package/package.json +16 -17
- 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
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as completeObject$1, S as completeDecision$1, w as completeText$1 } from "./config-
|
|
2
|
-
import { _ as runBestEffort, a as extractGenAiUsageSummary } from "./logging-
|
|
3
|
-
import {
|
|
4
|
-
import { Q as briefOutcomeStatusSchema, et as conversationBriefSchema, tt as parseBriefInput } from "./conversation-
|
|
1
|
+
import { C as completeObject$1, S as completeDecision$1, T as embedTexts$1, w as completeText$1 } from "./config-oGM7KA9M.js";
|
|
2
|
+
import { _ as runBestEffort, a as extractGenAiUsageSummary } from "./logging-DiyqRLBx.js";
|
|
3
|
+
import { at as agentTurnCostUsd, r as getConversationEventStore } from "./db-C-2tFxk3.js";
|
|
4
|
+
import { Q as briefOutcomeStatusSchema, et as conversationBriefSchema, tt as parseBriefInput } from "./conversation-CY1jnBiC.js";
|
|
5
5
|
import * as z from "zod";
|
|
6
6
|
import { conversationEventPresentationSchema, defineConversationEvent } from "@sentry/junior-plugin-api";
|
|
7
7
|
// src/chat/conversations/structured-events.ts
|
|
@@ -180,6 +180,16 @@ async function completeDecision(params) {
|
|
|
180
180
|
await recordCost(params, result.costUsd);
|
|
181
181
|
return result;
|
|
182
182
|
}
|
|
183
|
+
/** Embed texts with the configured embedding model and attribute the cost. */
|
|
184
|
+
async function embedTexts(params) {
|
|
185
|
+
const { cost, operation: _operation, ...rest } = params;
|
|
186
|
+
const result = await embedTexts$1({
|
|
187
|
+
...rest,
|
|
188
|
+
..."conversationId" in cost ? { metadata: { conversationId: cost.conversationId } } : void 0
|
|
189
|
+
});
|
|
190
|
+
await recordCost(params, result.costUsd);
|
|
191
|
+
return result;
|
|
192
|
+
}
|
|
183
193
|
// src/chat/briefs/generate.ts
|
|
184
194
|
const MAX_INPUT_CHARS = 6e4;
|
|
185
195
|
const MAX_MESSAGE_TEXT_CHARS = 4e3;
|
|
@@ -705,4 +715,4 @@ Rules:
|
|
|
705
715
|
- Cite a URL only when its exact full string occurs in an entry, evidence, or the previous Brief. Return cited URLs in \`urls\`. Core adds code changes and resources separately.
|
|
706
716
|
- Keep the summary under 600 characters, intent under 400 characters, outcome text under 600 characters, and each other string under 400 characters.
|
|
707
717
|
`;
|
|
708
|
-
export { EVENT_SYSTEM_ACTOR as a, completeDecision as c,
|
|
718
|
+
export { renderJuniorNativeConversationEvent as _, EVENT_SYSTEM_ACTOR as a, completeDecision as c, embedTexts as d, JUNIOR_NATIVE_EVENT_NAMESPACE as f, conversationNoteEvent as g, authenticationUnlinkedEvent as h, EVENT_MESSAGE_AUTHOR as i, completeObject as l, authenticationLinkedEvent as m, briefEntriesFromReportEvents as n, isEventConversationMessage as o, agentsInstructionsUpdatedEvent as p, EVENT_AUTHOR_ID as r, generateBrief as s, BRIEF_PROMPT as t, completeText as u };
|
|
@@ -7,7 +7,7 @@ declare const conversationQueueMessageSchema: z.ZodObject<{
|
|
|
7
7
|
/** Conversation work hint accepted by the queue callback and worker. */
|
|
8
8
|
type ConversationQueueMessage = z.output<typeof conversationQueueMessageSchema>;
|
|
9
9
|
interface ConversationQueueSendOptions {
|
|
10
|
-
delayMs?: number;
|
|
10
|
+
delayMs?: number | undefined;
|
|
11
11
|
idempotencyKey?: string;
|
|
12
12
|
}
|
|
13
13
|
interface ConversationQueueSendResult {
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { i as getChatConfig } from "./config-oGM7KA9M.js";
|
|
2
|
+
import { h as logWarn } from "./logging-DiyqRLBx.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-xaE05jxH.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-H8uLvW9e.js").then((n) => n.s);
|
|
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,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as normalizePluginPackageNames, o as pluginRoots, t as discoverInstalledPluginPackageContent } from "./package-discovery-x4AvVhMj.js";
|
|
2
|
+
import { b as setSpanAttributes, h as logWarn, m as logInfo } from "./logging-DiyqRLBx.js";
|
|
2
3
|
import { o as isUserActor, s as parseActorUserId } from "./actor-D2iXzvlN.js";
|
|
3
|
-
import { n as normalizePluginPackageNames, o as pluginRoots, t as discoverInstalledPluginPackageContent } from "./package-discovery-DJhGdS4c.js";
|
|
4
4
|
import * as z from "zod";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
@@ -305,7 +305,7 @@ function manifestConfigPatch(config) {
|
|
|
305
305
|
setDefined(result, "command-env", config.commandEnv);
|
|
306
306
|
setDefined(result, "env-vars", config.envVars);
|
|
307
307
|
if (config.credentials !== void 0) {
|
|
308
|
-
if (!config.credentials) result
|
|
308
|
+
if (!config.credentials) result["credentials"] = null;
|
|
309
309
|
else {
|
|
310
310
|
const credentials = {};
|
|
311
311
|
setDefined(credentials, "type", config.credentials.type);
|
|
@@ -313,13 +313,13 @@ function manifestConfigPatch(config) {
|
|
|
313
313
|
setDefined(credentials, "api-headers", config.credentials.apiHeaders);
|
|
314
314
|
setDefined(credentials, "auth-token-env", config.credentials.authTokenEnv);
|
|
315
315
|
setDefined(credentials, "auth-token-placeholder", config.credentials.authTokenPlaceholder);
|
|
316
|
-
result
|
|
316
|
+
result["credentials"] = credentials;
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
setDefined(result, "runtime-dependencies", config.runtimeDependencies);
|
|
320
320
|
setDefined(result, "runtime-postinstall", config.runtimePostinstall);
|
|
321
321
|
if (config.mcp !== void 0) {
|
|
322
|
-
if (!config.mcp) result
|
|
322
|
+
if (!config.mcp) result["mcp"] = null;
|
|
323
323
|
else {
|
|
324
324
|
const mcp = {};
|
|
325
325
|
setDefined(mcp, "transport", config.mcp.transport);
|
|
@@ -329,11 +329,11 @@ function manifestConfigPatch(config) {
|
|
|
329
329
|
setDefined(mcp, "oauth-client", config.mcp.oauthClient && mcpOauthClientSource(config.mcp.oauthClient));
|
|
330
330
|
setDefined(mcp, "allowed-tools", config.mcp.allowedTools);
|
|
331
331
|
setDefined(mcp, "wrapped-tools", config.mcp.wrappedTools);
|
|
332
|
-
result
|
|
332
|
+
result["mcp"] = mcp;
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
335
|
if (config.oauth !== void 0) {
|
|
336
|
-
if (!config.oauth) result
|
|
336
|
+
if (!config.oauth) result["oauth"] = null;
|
|
337
337
|
else {
|
|
338
338
|
const oauth = {};
|
|
339
339
|
setDefined(oauth, "client-id-env", config.oauth.clientIdEnv);
|
|
@@ -345,18 +345,18 @@ function manifestConfigPatch(config) {
|
|
|
345
345
|
setDefined(oauth, "token-auth-method", config.oauth.tokenAuthMethod);
|
|
346
346
|
setDefined(oauth, "token-extra-headers", config.oauth.tokenExtraHeaders);
|
|
347
347
|
setDefined(oauth, "treat-empty-scope-as-unreported", config.oauth.treatEmptyScopeAsUnreported);
|
|
348
|
-
result
|
|
348
|
+
result["oauth"] = oauth;
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
|
-
if (config.accounts !== void 0) result
|
|
351
|
+
if (config.accounts !== void 0) result["accounts"] = config.accounts && accountsSource(config.accounts);
|
|
352
352
|
if (config.target !== void 0) {
|
|
353
|
-
if (!config.target) result
|
|
353
|
+
if (!config.target) result["target"] = null;
|
|
354
354
|
else {
|
|
355
355
|
const target = {};
|
|
356
356
|
setDefined(target, "type", config.target.type);
|
|
357
357
|
setDefined(target, "config-key", config.target.configKey);
|
|
358
358
|
setDefined(target, "command-flags", config.target.commandFlags);
|
|
359
|
-
result
|
|
359
|
+
result["target"] = target;
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
362
|
return result;
|
|
@@ -382,7 +382,7 @@ function mergeManifestConfig(base, patch, options = {}) {
|
|
|
382
382
|
return merged;
|
|
383
383
|
}
|
|
384
384
|
function applyManifestConfig(source, config) {
|
|
385
|
-
const name = source
|
|
385
|
+
const name = source["name"];
|
|
386
386
|
if (typeof name !== "string") return source;
|
|
387
387
|
const manifestConfig = config?.manifests?.[name];
|
|
388
388
|
if (manifestConfig && "name" in manifestConfig) throw new Error("plugins.manifests cannot change plugin names");
|
|
@@ -478,7 +478,7 @@ function assertCommandEnvHostRefsAreExplicitlyExposed(commandEnv, envVars, plugi
|
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
480
|
function normalizeCredentials(data, name) {
|
|
481
|
-
if (data
|
|
481
|
+
if (data["type"] !== "oauth-bearer") throw new Error(`Plugin ${name} has unsupported credentials.type: "${String(data["type"])}"`);
|
|
482
482
|
const result = oauthBearerCredentialsSchema.safeParse(data);
|
|
483
483
|
if (!result.success) throw new Error(issueMessage(result.error, `Plugin ${name} credentials`));
|
|
484
484
|
if (!result.data.domains) throw new Error(`Plugin ${name} credentials requires domains`);
|
|
@@ -602,7 +602,7 @@ function expandEnvPlaceholders(template, envVars, context) {
|
|
|
602
602
|
}
|
|
603
603
|
function normalizeMcp(data, envVars, name) {
|
|
604
604
|
const prepared = { ...data };
|
|
605
|
-
if (typeof prepared
|
|
605
|
+
if (typeof prepared["url"] === "string") prepared["url"] = expandEnvPlaceholders(prepared["url"], envVars, `Plugin ${name} mcp.url`);
|
|
606
606
|
const result = mcpSourceSchema.safeParse(prepared);
|
|
607
607
|
if (!result.success) throw new Error(issueMessage(result.error, `Plugin ${name} mcp`));
|
|
608
608
|
const headers = result.data.headers ? normalizeStringMap(result.data.headers, `Plugin ${name} mcp.headers`, { forbiddenKeys: FORBIDDEN_API_HEADER_NAMES }) : void 0;
|
|
@@ -668,20 +668,20 @@ function parseManifestSource(parsedSource, dir, config, options) {
|
|
|
668
668
|
if (!sourceResult.success) {
|
|
669
669
|
const issue = sourceResult.error.issues[0];
|
|
670
670
|
const path = formatPath(issue?.path ?? []);
|
|
671
|
-
if (path === "name") throw new Error(`Invalid plugin name in ${dir}: "${parsedSource
|
|
671
|
+
if (path === "name") throw new Error(`Invalid plugin name in ${dir}: "${String(parsedSource["name"])}"`);
|
|
672
672
|
if (path === "description") throw new Error(`Invalid plugin description in ${dir}`);
|
|
673
|
-
if (path === "config-keys") throw new Error(`Plugin ${String(parsedSource
|
|
674
|
-
if (path === "domains") throw new Error(`Plugin ${String(parsedSource
|
|
675
|
-
if (path === "api-headers") throw new Error(`Plugin ${String(parsedSource
|
|
676
|
-
if (path === "command-env") throw new Error(`Plugin ${String(parsedSource
|
|
677
|
-
if (path === "credentials") throw new Error(`Plugin ${String(parsedSource
|
|
678
|
-
if (path === "runtime-dependencies") throw new Error(`Plugin ${String(parsedSource
|
|
679
|
-
if (path === "runtime-postinstall") throw new Error(`Plugin ${String(parsedSource
|
|
680
|
-
if (path === "env-vars") throw new Error(`Plugin ${String(parsedSource
|
|
681
|
-
if (path === "mcp") throw new Error(`Plugin ${String(parsedSource
|
|
682
|
-
if (path === "oauth") throw new Error(`Plugin ${String(parsedSource
|
|
683
|
-
if (path === "accounts") throw new Error(`Plugin ${String(parsedSource
|
|
684
|
-
if (path === "target") throw new Error(`Plugin ${String(parsedSource
|
|
673
|
+
if (path === "config-keys") throw new Error(`Plugin ${String(parsedSource["name"] ?? "unknown")} config-keys must be an array when provided`);
|
|
674
|
+
if (path === "domains") throw new Error(`Plugin ${String(parsedSource["name"] ?? "unknown")} ${path} must be a non-empty array of domains`);
|
|
675
|
+
if (path === "api-headers") throw new Error(`Plugin ${String(parsedSource["name"] ?? "unknown")} api-headers must be an object when provided`);
|
|
676
|
+
if (path === "command-env") throw new Error(`Plugin ${String(parsedSource["name"] ?? "unknown")} command-env must be an object when provided`);
|
|
677
|
+
if (path === "credentials") throw new Error(`Plugin ${String(parsedSource["name"] ?? "unknown")} credentials must be an object when provided`);
|
|
678
|
+
if (path === "runtime-dependencies") throw new Error(`Plugin ${String(parsedSource["name"] ?? "unknown")} runtime-dependencies must be an array`);
|
|
679
|
+
if (path === "runtime-postinstall") throw new Error(`Plugin ${String(parsedSource["name"] ?? "unknown")} runtime-postinstall must be an array`);
|
|
680
|
+
if (path === "env-vars") throw new Error(`Plugin ${String(parsedSource["name"] ?? "unknown")} env-vars must be an object`);
|
|
681
|
+
if (path === "mcp") throw new Error(`Plugin ${String(parsedSource["name"] ?? "unknown")} mcp must be an object`);
|
|
682
|
+
if (path === "oauth") throw new Error(`Plugin ${String(parsedSource["name"] ?? "unknown")} oauth must be an object`);
|
|
683
|
+
if (path === "accounts") throw new Error(`Plugin ${String(parsedSource["name"] ?? "unknown")} accounts must be an object`);
|
|
684
|
+
if (path === "target") throw new Error(`Plugin ${String(parsedSource["name"] ?? "unknown")} target must be an object`);
|
|
685
685
|
throw new Error(issue?.message ?? `Invalid plugin manifest in ${dir}`);
|
|
686
686
|
}
|
|
687
687
|
const data = sourceResult.data;
|
|
@@ -762,7 +762,7 @@ function parsePluginManifest(raw, dir, config) {
|
|
|
762
762
|
try {
|
|
763
763
|
parsedYaml = parse(raw);
|
|
764
764
|
} catch (error) {
|
|
765
|
-
throw new Error(`Invalid plugin manifest in ${dir}: ${error instanceof Error ? error.message : String(error)}
|
|
765
|
+
throw new Error(`Invalid plugin manifest in ${dir}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
766
766
|
}
|
|
767
767
|
if (!parsedYaml || typeof parsedYaml !== "object" || Array.isArray(parsedYaml)) throw new Error(`Invalid plugin manifest in ${dir}: expected an object`);
|
|
768
768
|
return parseManifestSource(parsedYaml, dir, config);
|
|
@@ -1034,7 +1034,7 @@ async function readBoundedOAuthErrorBody(response) {
|
|
|
1034
1034
|
}
|
|
1035
1035
|
/** Preserve small OAuth error responses while bounding bodies before SDK parsing. */
|
|
1036
1036
|
function fetchWithBoundedOAuthErrorBodies(fetchFn = globalThis.fetch, onErrorResponseStatus) {
|
|
1037
|
-
return
|
|
1037
|
+
return async (input, init) => {
|
|
1038
1038
|
const response = await fetchFn(input, init);
|
|
1039
1039
|
if (response.ok) return response;
|
|
1040
1040
|
onErrorResponseStatus?.(response.status);
|
|
@@ -1050,7 +1050,7 @@ function fetchWithBoundedOAuthErrorBodies(fetchFn = globalThis.fetch, onErrorRes
|
|
|
1050
1050
|
status: response.status,
|
|
1051
1051
|
statusText: response.statusText
|
|
1052
1052
|
});
|
|
1053
|
-
}
|
|
1053
|
+
};
|
|
1054
1054
|
}
|
|
1055
1055
|
// src/chat/plugins/command-env.ts
|
|
1056
1056
|
const ENV_PLACEHOLDER_RE$1 = /\$\{([A-Z_][A-Z0-9_]*)\}/g;
|
|
@@ -1161,8 +1161,8 @@ function buildOAuthTokenRequest(input) {
|
|
|
1161
1161
|
const payload = { ...input.payload };
|
|
1162
1162
|
if (input.tokenAuthMethod === "basic") headers.set("Authorization", `Basic ${Buffer.from(`${input.clientId}:${input.clientSecret}`).toString("base64")}`);
|
|
1163
1163
|
else {
|
|
1164
|
-
payload
|
|
1165
|
-
payload
|
|
1164
|
+
payload["client_id"] = input.clientId;
|
|
1165
|
+
payload["client_secret"] = input.clientSecret;
|
|
1166
1166
|
}
|
|
1167
1167
|
const contentType = headers.get("Content-Type") ?? DEFAULT_TOKEN_CONTENT_TYPE;
|
|
1168
1168
|
const serializedHeaders = {};
|
|
@@ -1178,11 +1178,11 @@ function buildOAuthTokenRequest(input) {
|
|
|
1178
1178
|
function parseOAuthTokenResponse(data, requestedScope, options) {
|
|
1179
1179
|
const response = requireTokenResponseObject(data);
|
|
1180
1180
|
const accessToken = requireNonEmptyTokenField(response, "access_token");
|
|
1181
|
-
const resolvedRefreshToken = response
|
|
1181
|
+
const resolvedRefreshToken = response["refresh_token"] === void 0 ? options?.refreshToken : requireNonEmptyTokenField(response, "refresh_token");
|
|
1182
1182
|
if (!resolvedRefreshToken) throw new Error("OAuth token response missing refresh_token");
|
|
1183
|
-
const expiresIn = response
|
|
1184
|
-
const refreshTokenExpiresIn = response
|
|
1185
|
-
const responseScope = response
|
|
1183
|
+
const expiresIn = response["expires_in"];
|
|
1184
|
+
const refreshTokenExpiresIn = response["refresh_token_expires_in"];
|
|
1185
|
+
const responseScope = response["scope"];
|
|
1186
1186
|
let scope;
|
|
1187
1187
|
if (responseScope !== void 0) {
|
|
1188
1188
|
if (typeof responseScope !== "string") throw new Error("OAuth token response returned invalid scope");
|
|
@@ -1542,7 +1542,7 @@ function logLoadedPlugins(state) {
|
|
|
1542
1542
|
for (const plugin of [...state.pluginDefinitions].sort((left, right) => left.manifest.name.localeCompare(right.manifest.name))) {
|
|
1543
1543
|
if (loggedPluginNames.has(plugin.manifest.name)) continue;
|
|
1544
1544
|
loggedPluginNames.add(plugin.manifest.name);
|
|
1545
|
-
logInfo("plugin.loaded", {
|
|
1545
|
+
logInfo("plugin.manifest.loaded", {
|
|
1546
1546
|
"app.plugin.name": plugin.manifest.name,
|
|
1547
1547
|
"app.plugin.config_key_count": plugin.manifest.configKeys.length,
|
|
1548
1548
|
"app.plugin.has_mcp": Boolean(plugin.manifest.mcp),
|
|
@@ -1,232 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { i as trace, n as postinstall, o as getSandboxResources, t as dependencies } from "./install-CHLrpRZc.js";
|
|
2
|
+
import { ia as isStale, na as create, oa as getSandboxProvider, os as sleep } from "./projection-DBq8tsA5.js";
|
|
3
|
+
import { J as getStateAdapter } from "./db-C-2tFxk3.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,23 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
+
import { D as turnBehavior, M as SYSTEM_IDENTITY_ID, a as getConversationStore } from "./db-C-2tFxk3.js";
|
|
3
|
+
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-BLLp1IP_.js";
|
|
4
|
+
import { a as EVENT_SYSTEM_ACTOR } from "./prompt-D2KlJopL.js";
|
|
5
|
+
import { f as credentialContextForActor } from "./registry-Bu0Z9BEO.js";
|
|
6
|
+
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-19CkuUvM.js";
|
|
7
|
+
import { _ as getConversationWorkState, r as appendAndEnqueueInboundMessage } from "./store-Dgs7Oe44.js";
|
|
8
|
+
import { $t as markAgentInvocationParentMailboxAppended, Ht as listUnreportedSiblingAgents, Jt as getLatestAgentInvocationForConversation, Ut as NON_TERMINAL_AGENT_INVOCATION_STATUSES, Wt as TERMINAL_AGENT_INVOCATION_STATUSES, Xt as listAgentInvocationsForConversation, Yt as isTerminalAgentInvocation, an as routeChildInput, cn as logDroppedParentMessage, dn as createAgentInvocationWorker, en as reportReplacedWithoutOpenWork, gn as resolveAgentInvocationId, hn as enqueueAgentInvocation, in as readChildConversationSender, ln as parentMessageText, mn as endAgentInvocationsOfStoppedWork, nn as childAgentInput, pn as endActiveAgentInvocations, rn as getChildAgentInputSender, tn as sendsResultToParent, un as readParentMessage, wn as createAgentInvocationFromLatest } from "./warmup-H8uLvW9e.js";
|
|
9
|
+
import { Jn as renderUntrustedTag } from "./projection-DBq8tsA5.js";
|
|
10
|
+
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";
|
|
11
11
|
import { actorSchema } from "@sentry/junior-plugin-api";
|
|
12
12
|
// src/chat/agent-invocations/result.ts
|
|
13
13
|
var result_exports = /* @__PURE__ */ __exportAll({
|
|
14
14
|
createChildConversationWorker: () => createChildConversationWorker,
|
|
15
|
-
createDeliverToParent: () => createDeliverToParent
|
|
16
|
-
createEndStoppedChildWork: () => createEndStoppedChildWork,
|
|
17
|
-
enqueueAgentInvocationResult: () => enqueueAgentInvocationResult,
|
|
18
|
-
enqueueAgentMessageToParent: () => enqueueAgentMessageToParent,
|
|
19
|
-
enqueueChildResultToParent: () => enqueueChildResultToParent,
|
|
20
|
-
withAgentInvocationResultActors: () => withAgentInvocationResultActors
|
|
15
|
+
createDeliverToParent: () => createDeliverToParent
|
|
21
16
|
});
|
|
22
17
|
const AGENT_INVOCATION_RESULT_MAX_LENGTH = 12e3;
|
|
23
18
|
/**
|