@sentry/junior 0.300.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.
Files changed (81) hide show
  1. package/dist/adapter-context-Cx9fn9B3.js +43 -0
  2. package/dist/{admin-UrTniSPO.js → admin-_poE5NKL.js} +2 -2
  3. package/dist/{agent-runner-bY4_0UPm.js → agent-runner-CY9RvsTX.js} +1367 -10649
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +6 -7
  6. package/dist/api.d.ts +1 -1
  7. package/dist/api.js +124 -67
  8. package/dist/{app-D-AcIcCV.d.ts → app-BpY3wtRP.d.ts} +3 -3
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +71 -299
  11. package/dist/{automation-Dw82oQ-h.js → automation-Cva5ZOwW.js} +1 -1
  12. package/dist/{background-compaction-queue-B6U3060-.js → background-compaction-queue-CXFq1_Cz.js} +94 -203
  13. package/dist/{briefs-DqiwWu-n.js → briefs-B3NG-pid.js} +3 -3
  14. package/dist/{catalog-runtime-D1oYNv04.js → catalog-runtime-Dss0lSV6.js} +1 -1
  15. package/dist/cli/chat.js +15 -15
  16. package/dist/cli/check.js +3 -3
  17. package/dist/cli/main.js +3 -3
  18. package/dist/cli/plugins.js +4 -4
  19. package/dist/cli/snapshot-create.js +4 -4
  20. package/dist/cli/upgrade.d.ts +1 -1
  21. package/dist/cli/upgrade.js +3 -3
  22. package/dist/{config-9nHoFiJP.js → config-CzeZiMKs.js} +2 -2
  23. package/dist/{connections-DZjTN3JC.js → connections-CDYhMfrs.js} +6 -6
  24. package/dist/{continue-in-slack-Dtv7_U42.js → continue-in-slack-7Uf05ndC.js} +5 -6
  25. package/dist/{conversation-Dyjq2CZ8.js → conversation-BNXfq6Lb.js} +11 -1
  26. package/dist/{conversation-feed-CcDxlrlQ.js → conversation-feed-Clf_cv0n.js} +2 -1
  27. package/dist/{conversation-privacy-D-5HTXjS.js → conversation-privacy-D9xnM5mK.js} +1 -1
  28. package/dist/{conversation-turn-Cxl8WZD7.js → conversation-turn-D7SEZgTG.js} +16 -17
  29. package/dist/{credential-sync-C49ClwDX.js → credential-sync-DoD0gW-j.js} +13 -15
  30. package/dist/{db-BJNo6fK5.js → db-B-gtnNjr.js} +314 -5
  31. package/dist/{db-2resqBh1.d.ts → db-BdsCzytP.d.ts} +1 -1
  32. package/dist/{executor-DBIaOeJ_.js → executor-DZg20EqU.js} +39 -4
  33. package/dist/install-t1KQyTUs.js +228 -0
  34. package/dist/instrumentation.js +2 -2
  35. package/dist/{state-zSilNpbi.js → legacy-web-actor-id-C-cEeWqL.js} +33 -4
  36. package/dist/{lineage-0dereG7H.js → lineage-C79GjoQr.js} +2 -2
  37. package/dist/{logging-BIclibct.js → logging-C9oDAg4M.js} +7 -3
  38. package/dist/{message-dkOl-Iii.js → message-BLUCzJXN.js} +8 -8
  39. package/dist/{model-input-CLo9TaUd.js → model-input-5jwNC45G.js} +3 -3
  40. package/dist/nitro.d.ts +1 -1
  41. package/dist/nitro.js +4 -3
  42. package/dist/{oauth-callback-server-WmpjfJgQ.js → oauth-callback-server-BBl66vCb.js} +2 -2
  43. package/dist/{projection-w_X-zi7v.js → projection-CIBwgD3s.js} +437 -97
  44. package/dist/{prompt-B1Xw46-S.js → prompt-CRQbzp5e.js} +15 -5
  45. package/dist/queue-DtCDaIct.js +115 -0
  46. package/dist/{registry-BmP5vnlj.js → registry-DdFQHZ_d.js} +1 -1
  47. package/dist/{resolve-goo34bJK.js → resolve-CdW4BdrK.js} +4 -229
  48. package/dist/{result-PVBeU0Wf.js → result-oOMv1t4O.js} +9 -9
  49. package/dist/{runner-DKrfvNV6.js → runner-DqitLtm-.js} +9 -9
  50. package/dist/{sandbox-egress-signals-DsUcqrI0.js → sandbox-egress-signals-Bw9I0yfJ.js} +1 -1
  51. package/dist/{schema-Dns-sTas.d.ts → schema-BIFM-U1a.d.ts} +470 -30
  52. package/dist/{schema-C9iNFz5n.js → schema-DnVQepWP.js} +76 -31
  53. package/dist/{service-account-CMAAloAL.js → service-account-B6mKAPVo.js} +3 -3
  54. package/dist/{service-account-CmowamcB.js → service-account-CrZftRTb.js} +257 -6
  55. package/dist/{session-stop-BcAXze8a.js → session-stop-DW63Z3kj.js} +1103 -1007
  56. package/dist/{skills-DfsazET6.js → skills-C16fz60Z.js} +2 -2
  57. package/dist/{slack-conversation-unfurl-CzQonuWz.js → slack-conversation-unfurl-BHhefEb7.js} +8 -7
  58. package/dist/{spawn-C7o0FDDp.js → spawn-D_RnFYfy.js} +6 -6
  59. package/dist/{stop-CFOujp8C.js → stop-7p1i08CY.js} +941 -2311
  60. package/dist/{store-E3x2Fg_F.js → store-C28I0CVW.js} +5 -5
  61. package/dist/{task-queue-D-hCqdZW.js → task-queue-BVUJbQ28.js} +3 -3
  62. package/dist/{task-runner-vohUPLHe.js → task-runner-CWi8j7Z6.js} +6 -8
  63. package/dist/{thread-context-BzvdkgI9.js → thread-context-D3-yYUd0.js} +8 -8
  64. package/dist/{store-Dkeis_8o.js → turn-session-routing-BFMS9ATF.js} +382 -11
  65. package/dist/{turn-user-message-D5RnVmxQ.js → turn-user-message-C3-O8Omt.js} +3 -3
  66. package/dist/{validation-BbWikeSa.js → validation-BSFKUIb4.js} +1 -1
  67. package/dist/{version-GVBMW2jA.js → version-BHHXNi-0.js} +1 -1
  68. package/dist/version.js +1 -1
  69. package/dist/{viewer-BpxRliyO.js → viewer-B1SO21Qa.js} +3 -3
  70. package/dist/warmup-Bz9bzkzN.js +13927 -0
  71. package/dist/{statuses-Hn-HsOph.js → web-message-id-lNodcCOI.js} +136 -1
  72. package/dist/{worker-Cbd-iuwZ.js → worker-BspReIIK.js} +7 -7
  73. package/migrations/0108_conversation_embeddings.sql +13 -0
  74. package/migrations/meta/0108_snapshot.json +4688 -0
  75. package/migrations/meta/_journal.json +7 -0
  76. package/package.json +10 -8
  77. package/dist/adapter-S5UkjNK3.js +0 -303
  78. package/dist/reporting-window-DopzcOHh.js +0 -137
  79. package/dist/turn-session-routing-Bo_LxFum.js +0 -380
  80. package/dist/users-2bggndVg.js +0 -424
  81. package/dist/warmup-BW2qwnal.js +0 -3693
@@ -1,7 +1,7 @@
1
- import { C as completeObject$1, S as completeDecision$1, w as completeText$1 } from "./config-9nHoFiJP.js";
2
- import { _ as runBestEffort, a as extractGenAiUsageSummary } from "./logging-BIclibct.js";
3
- import { Y as agentTurnCostUsd, r as getConversationEventStore } from "./db-BJNo6fK5.js";
4
- import { Q as briefOutcomeStatusSchema, et as conversationBriefSchema, tt as parseBriefInput } from "./conversation-Dyjq2CZ8.js";
1
+ import { C as completeObject$1, S as completeDecision$1, T as embedTexts$1, w as completeText$1 } from "./config-CzeZiMKs.js";
2
+ import { _ as runBestEffort, a as extractGenAiUsageSummary } from "./logging-C9oDAg4M.js";
3
+ import { at as agentTurnCostUsd, r as getConversationEventStore } from "./db-B-gtnNjr.js";
4
+ import { Q as briefOutcomeStatusSchema, et as conversationBriefSchema, tt as parseBriefInput } from "./conversation-BNXfq6Lb.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, JUNIOR_NATIVE_EVENT_NAMESPACE as d, agentsInstructionsUpdatedEvent as f, renderJuniorNativeConversationEvent as g, conversationNoteEvent as h, EVENT_MESSAGE_AUTHOR as i, completeObject as l, authenticationUnlinkedEvent as m, briefEntriesFromReportEvents as n, isEventConversationMessage as o, authenticationLinkedEvent as p, EVENT_AUTHOR_ID as r, generateBrief as s, BRIEF_PROMPT as t, completeText as u };
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 };
@@ -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-BIclibct.js";
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 { $i as create, ns as sleep, po as runNonInteractiveCommand, ra as getSandboxProvider, ro as SANDBOX_COMMAND_PATH, so as SANDBOX_WORKSPACE_ROOT, ta as isStale } from "./projection-w_X-zi7v.js";
2
- import { E as withSpan, b as setSpanAttributes } from "./logging-BIclibct.js";
3
- import { r as getStateAdapter } from "./adapter-S5UkjNK3.js";
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 { setSnapshotSpanAttributes as a, setSandboxResourceConfig as c, postinstall as i, resolve as n, getSandboxResourceConfig as o, dependencies as r, getSandboxResources as s, getCachedSnapshot as t };
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-w_X-zi7v.js";
3
- import { E as turnBehavior, a as getConversationStore, j as SYSTEM_IDENTITY_ID } from "./db-BJNo6fK5.js";
4
- import { f as credentialContextForActor } from "./registry-BmP5vnlj.js";
5
- import { a as EVENT_SYSTEM_ACTOR } from "./prompt-B1Xw46-S.js";
6
- import { D as parseEventMessages, E as listActiveMailboxTurns, I as renderEventBatchInputs, L as timerWatchCredentialSubject, M as EVENT_WAIT_MS, O as resolveMailboxTurnWork, P as eventBatchMessageMeta, s as eventReviewItemInputs, t as getConversationStoppedAtMs, w as getEventBatchDelayMs } from "./session-stop-BcAXze8a.js";
7
- import { A as readChildConversationSender, B as endActiveAgentInvocations, D as sendsResultToParent, E as reportReplacedWithoutOpenWork, F as parentMessageText, H as enqueueAgentInvocation, L as readParentMessage, O as childAgentInput, P as logDroppedParentMessage, Q as createAgentInvocationFromLatest, R as createAgentInvocationWorker, T as markAgentInvocationParentMailboxAppended, U as resolveAgentInvocationId, V as endAgentInvocationsOfStoppedWork, b as isTerminalAgentInvocation, h as TERMINAL_AGENT_INVOCATION_STATUSES, j as routeChildInput, k as getChildAgentInputSender, m as NON_TERMINAL_AGENT_INVOCATION_STATUSES, p as listUnreportedSiblingAgents, x as listAgentInvocationsForConversation, y as getLatestAgentInvocationForConversation } from "./warmup-BW2qwnal.js";
8
- 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-D5RnVmxQ.js";
9
- import { _ as getConversationWorkState, r as appendAndEnqueueInboundMessage } from "./store-E3x2Fg_F.js";
10
- import { S as agentInvocationResultEventType, v as AGENT_INVOCATION_EVENT_NAMESPACE, x as AGENT_REPLY_EVENT_TYPE, y as AGENT_MESSAGE_EVENT_TYPE } from "./statuses-Hn-HsOph.js";
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-w_X-zi7v.js";
2
- import { S as setTags, T as withLogContext, p as logException } from "./logging-BIclibct.js";
3
- import { a as getConversationStore, j as SYSTEM_IDENTITY_ID, r as getConversationEventStore } from "./db-BJNo6fK5.js";
4
- import { f as credentialContextForActor } from "./registry-BmP5vnlj.js";
5
- import { V as messageCardText } from "./conversation-Dyjq2CZ8.js";
6
- import { _ as ConversationTurnLifecycleService, g as startActiveTurn, h as markTurnFailed } from "./turn-user-message-D5RnVmxQ.js";
7
- import { a as getPersistedThreadState, c as coerceThreadConversationState, i as getPersistedSandboxState, s as persistThreadStateById } from "./turn-session-routing-Bo_LxFum.js";
8
- import { c as buildDeliveredTurnStatePatch, l as loadPendingMessageCards, o as completeAuthPauseTurn, r as finalizeFailedTurnReplyWithEvent, t as buildTurnThreadContext } from "./thread-context-BzvdkgI9.js";
9
- import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-vohUPLHe.js";
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
+ import { V as messageCardText } from "./conversation-BNXfq6Lb.js";
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 { Ga as sandboxEgressSignalsResponseSchema } from "./projection-w_X-zi7v.js";
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;