@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.
Files changed (101) hide show
  1. package/dist/adapter-context-BdVnSuY5.js +43 -0
  2. package/dist/{admin-CRJHvCGg.js → admin-AfeAdS3J.js} +2 -2
  3. package/dist/{agent-runner-H4YhvNBj.js → agent-runner-BP8_DLUv.js} +4688 -13870
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +7 -8
  6. package/dist/api.d.ts +13 -12
  7. package/dist/api.js +268 -118
  8. package/dist/{app-HDZglaIu.d.ts → app-Dd9v1mNx.d.ts} +15 -15
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +99 -330
  11. package/dist/{automation-Cva5ZOwW.js → automation-D9MvhOWY.js} +3 -1
  12. package/dist/{background-compaction-queue-CNrZ3QcU.js → background-compaction-queue-xaE05jxH.js} +97 -206
  13. package/dist/{briefs-x6Mzwxmg.js → briefs-D8i-dKTp.js} +4 -4
  14. package/dist/{catalog-runtime-BEY6EGRi.js → catalog-runtime-d1EM6Z0V.js} +2 -2
  15. package/dist/cli/chat.d.ts +1 -1
  16. package/dist/cli/chat.js +21 -21
  17. package/dist/cli/check.js +8 -8
  18. package/dist/cli/env.d.ts +1 -0
  19. package/dist/cli/env.js +8 -7
  20. package/dist/cli/init.js +13 -4
  21. package/dist/cli/main.js +4 -4
  22. package/dist/cli/plugins.js +6 -6
  23. package/dist/cli/snapshot-create.js +7 -5
  24. package/dist/cli/upgrade.d.ts +2 -2
  25. package/dist/cli/upgrade.js +5 -5
  26. package/dist/{config-CmjhyqgB.js → config-oGM7KA9M.js} +44 -63
  27. package/dist/{connections-CfIRm0xv.js → connections-BlikzEJv.js} +6 -6
  28. package/dist/{continue-in-slack-DPoABVkB.js → continue-in-slack-BZnYifiG.js} +5 -6
  29. package/dist/{conversation-BNXfq6Lb.js → conversation-CY1jnBiC.js} +1 -1
  30. package/dist/{conversation-feed-CfpyFMHP.js → conversation-feed-BZJRk6UV.js} +2 -1
  31. package/dist/{conversation-privacy-0CM0V2qK.js → conversation-privacy-Cx515ddM.js} +7 -7
  32. package/dist/{conversation-turn-C0sxyvS-.js → conversation-turn-DAhRdX4m.js} +20 -24
  33. package/dist/{credential-sync-tEMKZ_8M.js → credential-sync-DfhmWFeo.js} +18 -20
  34. package/dist/{db-Czra10QW.js → db-C-2tFxk3.js} +326 -17
  35. package/dist/{db-BdUHQhrC.d.ts → db-DPqcEM9_.d.ts} +25 -25
  36. package/dist/{executor-D_023K0H.js → executor-NVfS8aQ2.js} +51 -10
  37. package/dist/{history-IjdmO_r6.js → history-UZ3M2M9r.js} +13 -10
  38. package/dist/install-CHLrpRZc.js +228 -0
  39. package/dist/instrumentation.d.ts +4 -4
  40. package/dist/instrumentation.js +10 -10
  41. package/dist/{lineage-DmMIE0VL.js → lineage-HGLhd_-N.js} +2 -2
  42. package/dist/{logging-DcjLDDqi.js → logging-DiyqRLBx.js} +24 -20
  43. package/dist/{message-C0JY9RJP.js → message-CkCOcbFH.js} +9 -9
  44. package/dist/{model-input-CBp-p24N.js → model-input-DmoPPtPE.js} +5 -10
  45. package/dist/nitro.d.ts +1 -1
  46. package/dist/nitro.js +7 -6
  47. package/dist/{oauth-callback-server-BRq9QNhU.js → oauth-callback-server-CIf_6YmA.js} +5 -4
  48. package/dist/{oauth-relay-DRzq73b6.js → oauth-relay-DAmfVmJu.js} +3 -6
  49. package/dist/{package-discovery-DJhGdS4c.js → package-discovery-x4AvVhMj.js} +1 -1
  50. package/dist/{plugin-module-Cf5gVPWP.js → plugin-module-Cv2ETe8Y.js} +1 -1
  51. package/dist/{plugins-BBX07Jzt.js → plugins-Bkk0XRo2.js} +3 -3
  52. package/dist/{projection-CQNDOi82.js → projection-DBq8tsA5.js} +489 -223
  53. package/dist/{prompt-DLUB5m72.js → prompt-D2KlJopL.js} +15 -5
  54. package/dist/{queue-CZyYgPF0.d.ts → queue-CbEHUO0l.d.ts} +1 -1
  55. package/dist/queue-DFaOscp5.js +115 -0
  56. package/dist/{registry-Dj377ADs.js → registry-Bu0Z9BEO.js} +37 -37
  57. package/dist/{resolve-DJkh9Fky.js → resolve-DXuA3G0g.js} +4 -229
  58. package/dist/{result-C8iIpDl1.js → result-DpiNseDA.js} +11 -16
  59. package/dist/rolldown-runtime-BKpuH2hG.js +26 -0
  60. package/dist/{runner-DZqrOy8C.js → runner-iu1heRFv.js} +10 -10
  61. package/dist/{sandbox-egress-signals-CGwH86S9.js → sandbox-egress-signals-2HFYDcQf.js} +1 -1
  62. package/dist/{schema-CdZFn7Qd.d.ts → schema-DHMOaRzC.d.ts} +959 -41
  63. package/dist/{schema-DyHXiQKI.js → schema-DvfX3Gq_.js} +141 -40
  64. package/dist/{secrets-DebYU866.js → secrets-DHaJ5TTn.js} +4 -4
  65. package/dist/{sentry-BRTJqumy.js → sentry-CPbZjomA.js} +3 -28
  66. package/dist/{sentry-route-name-BhwWnfqj.js → sentry-route-name-C6EIzAGP.js} +1 -1
  67. package/dist/{service-account-suY004dx.js → service-account-BcT5LR7V.js} +271 -20
  68. package/dist/{service-account-D6jGR4a1.js → service-account-xYkaQTrw.js} +3 -3
  69. package/dist/{session-stop-BLmfFI3d.js → session-stop-BLLp1IP_.js} +1098 -1110
  70. package/dist/{skills-CmNG0dHb.js → skills-CNAGH4ju.js} +6 -9
  71. package/dist/{slack-conversation-unfurl-Bty-DlHe.js → slack-conversation-unfurl-DYnqe5ci.js} +10 -14
  72. package/dist/{spawn-CNjkpXpk.js → spawn-cGasWW33.js} +7 -7
  73. package/dist/{state-CEbZuZD6.js → state-CDS6h_Wv.js} +34 -5
  74. package/dist/{stop-Bjy2-K4H.js → stop-DMMA67yT.js} +896 -196
  75. package/dist/{store-DmV4CoNr.js → store-Dgs7Oe44.js} +5 -5
  76. package/dist/{task-queue-AhG1tSXR.js → task-queue-DcF0nhhz.js} +3 -3
  77. package/dist/{task-runner-BMxZI3o7.js → task-runner-BGXF7Fo7.js} +15 -20
  78. package/dist/{thread-context-CXLnbg7g.js → thread-context-BPky1KBe.js} +12 -12
  79. package/dist/{store-Epv6t4vV.js → turn-session-routing-DGvn9MSl.js} +384 -13
  80. package/dist/{turn-user-message-DsUZi9gn.js → turn-user-message-19CkuUvM.js} +3 -3
  81. package/dist/{validation-DOz8X9BU.js → validation-lu1DgjNQ.js} +2 -2
  82. package/dist/vercel.js +1 -1
  83. package/dist/{version-CGMRmMPK.js → version-Uo3c94Dx.js} +1 -1
  84. package/dist/version.js +1 -1
  85. package/dist/{viewer-H3EsMWtJ.js → viewer-BPQHMx3-.js} +3 -3
  86. package/dist/warmup-H8uLvW9e.js +13946 -0
  87. package/dist/{statuses-Hn-HsOph.js → web-message-id-lNodcCOI.js} +136 -1
  88. package/dist/{worker-ClphajjD.js → worker-B-pM_-3K.js} +9 -12
  89. package/migrations/0108_conversation_embeddings.sql +13 -0
  90. package/migrations/0109_user_preferences.sql +1 -0
  91. package/migrations/0110_code_change_repository_state_index.sql +1 -0
  92. package/migrations/meta/0108_snapshot.json +4688 -0
  93. package/migrations/meta/0109_snapshot.json +4925 -0
  94. package/migrations/meta/0110_snapshot.json +4952 -0
  95. package/migrations/meta/_journal.json +22 -1
  96. package/package.json +16 -17
  97. package/dist/adapter-CNjGEJO9.js +0 -303
  98. package/dist/reporting-window-DopzcOHh.js +0 -137
  99. package/dist/turn-session-routing-BD3-jJl7.js +0 -380
  100. package/dist/users-BxvYclQg.js +0 -424
  101. package/dist/warmup-CdU5hR49.js +0 -3715
@@ -97,10 +97,10 @@ function encodeHistoryPayload(data) {
97
97
  payload: {
98
98
  message: JSON.stringify(message),
99
99
  provenance,
100
- model: message.model,
101
- provider: message.provider,
102
- usage: message.usage,
103
- toolCallId: message.toolCallId
100
+ model: message["model"],
101
+ provider: message["provider"],
102
+ usage: message["usage"],
103
+ toolCallId: message["toolCallId"]
104
104
  }
105
105
  };
106
106
  }
@@ -109,13 +109,16 @@ function decodeHistoryPayload(type, payload) {
109
109
  const fields = messageFieldsSchema.parse(payload);
110
110
  if (type === "handoff" || type === "compaction") return {
111
111
  ...fields,
112
- replacementHistory: z.array(replacementEntrySchema).parse(fields.replacementHistory).map(({ item, ...entry }) => ({
113
- ...entry,
114
- item: JSON.parse(item)
115
- }))
112
+ replacementHistory: z.array(replacementEntrySchema).parse(fields["replacementHistory"]).map(({ item, ...entry }) => {
113
+ const parsedItem = JSON.parse(item);
114
+ return {
115
+ ...entry,
116
+ item: parsedItem
117
+ };
118
+ })
116
119
  };
117
- const message = messageFieldsSchema.parse(JSON.parse(z.string().parse(fields.message)));
118
- if (fields.provenance !== void 0) message.provenance = fields.provenance;
120
+ const message = messageFieldsSchema.parse(JSON.parse(z.string().parse(fields["message"])));
121
+ if (fields["provenance"] !== void 0) message["provenance"] = fields["provenance"];
119
122
  return message;
120
123
  }
121
124
  // src/chat/conversations/history.ts
@@ -0,0 +1,228 @@
1
+ import { _o as runNonInteractiveCommand, do as SANDBOX_WORKSPACE_ROOT, so as SANDBOX_COMMAND_PATH } from "./projection-DBq8tsA5.js";
2
+ import { E as withSpan, b as setSpanAttributes } from "./logging-DiyqRLBx.js";
3
+ // src/chat/sandbox/resources.ts
4
+ let configuredResources;
5
+ function resourcesFromEnv() {
6
+ const value = process.env["SANDBOX_VCPUS"]?.trim();
7
+ if (!value || !/^\d+$/.test(value)) return;
8
+ const vcpus = Number(value);
9
+ if (!Number.isSafeInteger(vcpus) || vcpus <= 0) return;
10
+ return { vcpus };
11
+ }
12
+ /** Return the app-level sandbox sizing override. */
13
+ function getSandboxResourceConfig() {
14
+ return configuredResources;
15
+ }
16
+ /** Replace app-level sandbox sizing and return the previous setting. */
17
+ function setSandboxResourceConfig(config) {
18
+ const previous = configuredResources;
19
+ if (config?.vcpus === void 0) {
20
+ configuredResources = void 0;
21
+ return previous;
22
+ }
23
+ if (!Number.isSafeInteger(config.vcpus) || config.vcpus <= 0) throw new Error("sandbox.vcpus must be a positive integer");
24
+ configuredResources = { vcpus: config.vcpus };
25
+ return previous;
26
+ }
27
+ /**
28
+ * Resolve sandbox sizing. A Workspace vCPU setting wins over the app setting,
29
+ * which wins over the legacy environment setting.
30
+ */
31
+ function getSandboxResources(workspace) {
32
+ if (workspace?.vcpus) return { vcpus: workspace.vcpus };
33
+ return configuredResources ?? resourcesFromEnv();
34
+ }
35
+ // src/chat/sandbox/snapshot/span.ts
36
+ /** Record the reusable snapshot selected for a new Sandbox. */
37
+ function setSnapshotSpanAttributes(snapshot) {
38
+ setSpanAttributes({
39
+ "app.sandbox.source": snapshot.snapshotId ? "snapshot" : "created",
40
+ "app.sandbox.snapshot.cache_hit": snapshot.cacheHit,
41
+ "app.sandbox.snapshot.resolve_outcome": snapshot.resolveOutcome,
42
+ ...snapshot.profileHash ? { "app.sandbox.snapshot.profile_hash": snapshot.profileHash } : void 0,
43
+ "app.sandbox.snapshot.dependency_count": snapshot.dependencyCount,
44
+ ...snapshot.rebuildReason ? { "app.sandbox.snapshot.rebuild_reason": snapshot.rebuildReason } : void 0
45
+ });
46
+ }
47
+ /** Record one stage of dependency snapshot resolution or creation. */
48
+ async function trace(name, op, attributes, callback) {
49
+ return await withSpan(name, op, {}, callback, attributes);
50
+ }
51
+ // src/chat/sandbox/snapshot/install.ts
52
+ async function runOrThrow(sandbox, params, label) {
53
+ const result = await runNonInteractiveCommand(sandbox, params);
54
+ if (result.exitCode === 0) return;
55
+ const detail = result.stderr.trim() || result.stdout.trim() || "command failed";
56
+ throw new Error(`${label} failed: ${detail}`);
57
+ }
58
+ async function tryRun(sandbox, params) {
59
+ return (await runNonInteractiveCommand(sandbox, params)).exitCode === 0;
60
+ }
61
+ async function installGh(sandbox, signal, timeoutMs) {
62
+ if (await tryRun(sandbox, {
63
+ cmd: "dnf",
64
+ args: [
65
+ "install",
66
+ "-y",
67
+ "gh"
68
+ ],
69
+ signal,
70
+ sudo: true,
71
+ timeoutMs
72
+ })) return;
73
+ if (!await tryRun(sandbox, {
74
+ cmd: "dnf",
75
+ args: [
76
+ "config-manager",
77
+ "addrepo",
78
+ "--from-repofile=https://cli.github.com/packages/rpm/gh-cli.repo"
79
+ ],
80
+ signal,
81
+ sudo: true,
82
+ timeoutMs
83
+ })) {
84
+ await runOrThrow(sandbox, {
85
+ cmd: "dnf",
86
+ args: [
87
+ "install",
88
+ "-y",
89
+ "dnf-command(config-manager)"
90
+ ],
91
+ signal,
92
+ sudo: true,
93
+ timeoutMs
94
+ }, "dnf install dnf-command(config-manager)");
95
+ await runOrThrow(sandbox, {
96
+ cmd: "dnf",
97
+ args: [
98
+ "config-manager",
99
+ "--add-repo",
100
+ "https://cli.github.com/packages/rpm/gh-cli.repo"
101
+ ],
102
+ signal,
103
+ sudo: true,
104
+ timeoutMs
105
+ }, "dnf config-manager --add-repo gh-cli.repo");
106
+ }
107
+ await runOrThrow(sandbox, {
108
+ cmd: "dnf",
109
+ args: [
110
+ "install",
111
+ "-y",
112
+ "gh",
113
+ "--repo",
114
+ "gh-cli"
115
+ ],
116
+ signal,
117
+ sudo: true,
118
+ timeoutMs
119
+ }, "dnf install gh --repo gh-cli");
120
+ }
121
+ function filePath(url, sha256) {
122
+ let basename = "package.rpm";
123
+ try {
124
+ const candidate = new URL(url).pathname.split("/").filter(Boolean).at(-1);
125
+ if (candidate) basename = candidate;
126
+ } catch {}
127
+ const sanitized = basename.replace(/[^a-zA-Z0-9._-]/g, "_");
128
+ return `/tmp/junior-runtime-${sha256.slice(0, 12)}-${sanitized}`;
129
+ }
130
+ async function installUrl(sandbox, dependency, signal, timeoutMs) {
131
+ const rpmPath = filePath(dependency.url, dependency.sha256);
132
+ await runOrThrow(sandbox, {
133
+ cmd: "curl",
134
+ args: [
135
+ "-fsSL",
136
+ dependency.url,
137
+ "-o",
138
+ rpmPath
139
+ ],
140
+ signal,
141
+ timeoutMs
142
+ }, `curl download ${dependency.url}`);
143
+ const checksum = await runNonInteractiveCommand(sandbox, {
144
+ cmd: "sha256sum",
145
+ args: [rpmPath],
146
+ signal,
147
+ timeoutMs
148
+ });
149
+ const expected = dependency.sha256;
150
+ const actual = checksum.stdout.trim().split(/\s+/)[0]?.toLowerCase();
151
+ if (checksum.exitCode !== 0) {
152
+ const detail = checksum.stderr.trim() || checksum.stdout.trim() || "command failed";
153
+ throw new Error(`sha256sum failed: ${detail}`);
154
+ }
155
+ if (!actual) throw new Error("sha256sum produced empty output");
156
+ if (actual !== expected) throw new Error(`checksum mismatch for ${dependency.url}: expected ${expected}, got ${actual}`);
157
+ await runOrThrow(sandbox, {
158
+ cmd: "dnf",
159
+ args: [
160
+ "install",
161
+ "-y",
162
+ rpmPath
163
+ ],
164
+ signal,
165
+ sudo: true,
166
+ timeoutMs
167
+ }, `dnf install ${dependency.url}`);
168
+ }
169
+ /** Install declared system and npm dependencies into a snapshot sandbox. */
170
+ async function dependencies(sandbox, values, signal, timeoutMs) {
171
+ const system = values.filter((dependency) => dependency.type === "system");
172
+ const npm = values.filter((dependency) => dependency.type === "npm").map((dependency) => `${dependency.package}@${dependency.version}`);
173
+ if (system.length > 0) await trace("sandbox.snapshot.install_system", "sandbox.snapshot.install.system", { "app.sandbox.snapshot.install.system_count": system.length }, async () => {
174
+ for (const dependency of system) {
175
+ signal?.throwIfAborted();
176
+ if ("url" in dependency) await installUrl(sandbox, dependency, signal, timeoutMs);
177
+ else if (dependency.package === "gh") await installGh(sandbox, signal, timeoutMs);
178
+ else await runOrThrow(sandbox, {
179
+ cmd: "dnf",
180
+ args: [
181
+ "install",
182
+ "-y",
183
+ dependency.package
184
+ ],
185
+ signal,
186
+ sudo: true,
187
+ timeoutMs
188
+ }, `dnf install ${dependency.package}`);
189
+ }
190
+ });
191
+ if (npm.length > 0) await trace("sandbox.snapshot.install_npm", "sandbox.snapshot.install.npm", { "app.sandbox.snapshot.install.npm_count": npm.length }, async () => {
192
+ await runOrThrow(sandbox, {
193
+ cmd: "npm",
194
+ args: [
195
+ "install",
196
+ "--global",
197
+ "--prefix",
198
+ `${SANDBOX_WORKSPACE_ROOT}/.junior`,
199
+ ...npm
200
+ ],
201
+ signal,
202
+ timeoutMs
203
+ }, "npm install");
204
+ });
205
+ }
206
+ /** Run declared postinstall commands after dependency binaries are available. */
207
+ async function postinstall(sandbox, commands, signal, timeoutMs) {
208
+ if (commands.length === 0) return;
209
+ await trace("sandbox.snapshot.runtime_postinstall", "sandbox.snapshot.runtime_postinstall", { "app.sandbox.snapshot.runtime_postinstall.count": commands.length }, async () => {
210
+ for (const command of commands) {
211
+ signal?.throwIfAborted();
212
+ const result = await runNonInteractiveCommand(sandbox, {
213
+ cmd: command.cmd,
214
+ args: command.args,
215
+ login: true,
216
+ path: SANDBOX_COMMAND_PATH,
217
+ signal,
218
+ timeoutMs,
219
+ ...command.sudo !== void 0 ? { sudo: command.sudo } : void 0
220
+ });
221
+ if (result.exitCode !== 0) {
222
+ const detail = result.stderr.trim() || result.stdout.trim() || "command failed";
223
+ throw new Error(`runtime-postinstall ${command.cmd} failed: ${detail}`);
224
+ }
225
+ }
226
+ });
227
+ }
228
+ export { getSandboxResourceConfig as a, trace as i, postinstall as n, getSandboxResources as o, setSnapshotSpanAttributes as r, setSandboxResourceConfig as s, dependencies as t };
@@ -12,11 +12,11 @@ export declare function nameRequestRoute(method: string, route: string): void;
12
12
  export declare function routeNameMiddleware(): MiddlewareHandler;
13
13
  /** Browser SDK settings and the current request's trace, for an HTML page. */
14
14
  export interface BrowserSentryConfig {
15
- baggage?: string;
15
+ baggage?: string | undefined;
16
16
  dsn: string;
17
- environment?: string;
18
- release?: string;
19
- sentryTrace?: string;
17
+ environment?: string | undefined;
18
+ release?: string | undefined;
19
+ sentryTrace?: string | undefined;
20
20
  tracesSampleRate: number;
21
21
  }
22
22
  /**
@@ -1,10 +1,10 @@
1
- import { a as getClient, c as init, i as getActiveSpan, o as getGlobalScope, p as spanToJSON, s as getTraceData } from "./sentry-BRTJqumy.js";
2
- import { B as getDeploymentTelemetryAttributes, z as getDeploymentServiceVersion } from "./logging-DcjLDDqi.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-0CM0V2qK.js";
1
+ import { a as getClient, c as init, i as getActiveSpan, o as getGlobalScope, p as spanToJSON, s as getTraceData } from "./sentry-CPbZjomA.js";
2
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-Cx515ddM.js";
3
+ import { n as isPushServiceHost } from "./push-endpoint-CO-nomUd.js";
4
4
  import { n as redactSandboxEgressProxyPath } from "./proxy-path-BHYoKZdq.js";
5
+ import { n as promoteHttpRouteName, r as routeNameMiddleware, t as nameRequestRoute } from "./sentry-route-name-C6EIzAGP.js";
5
6
  import { t as consumePrivateTraceResultMarker } from "./private-trace-result-CE7_lEdq.js";
6
- import { n as promoteHttpRouteName, r as routeNameMiddleware, t as nameRequestRoute } from "./sentry-route-name-BhwWnfqj.js";
7
- import { n as isPushServiceHost } from "./push-endpoint-CO-nomUd.js";
7
+ import { B as getDeploymentServiceVersion, V as getDeploymentTelemetryAttributes } from "./logging-DiyqRLBx.js";
8
8
  import { performance } from "node:perf_hooks";
9
9
  import { subscribe, unsubscribe } from "node:diagnostics_channel";
10
10
  // src/chat/pi/gateway-request-timing.ts
@@ -330,17 +330,17 @@ function getBoolean(value, fallback) {
330
330
  return fallback;
331
331
  }
332
332
  function getEnvironment() {
333
- return process.env.SENTRY_ENVIRONMENT ?? process.env.VERCEL_ENV ?? process.env.NODE_ENV;
333
+ return process.env["SENTRY_ENVIRONMENT"] ?? process.env["VERCEL_ENV"] ?? process.env["NODE_ENV"];
334
334
  }
335
335
  function getTracesSampleRate() {
336
- return getSampleRate(process.env.SENTRY_TRACES_SAMPLE_RATE, 1);
336
+ return getSampleRate(process.env["SENTRY_TRACES_SAMPLE_RATE"], 1);
337
337
  }
338
338
  /**
339
339
  * Read the settings a served page needs to send browser spans to the same
340
340
  * project, continuing the trace of the request that rendered it.
341
341
  */
342
342
  function getBrowserSentryConfig() {
343
- const dsn = process.env.SENTRY_DSN?.trim();
343
+ const dsn = process.env["SENTRY_DSN"]?.trim();
344
344
  if (!dsn) return void 0;
345
345
  const trace = getTraceData();
346
346
  return {
@@ -355,8 +355,8 @@ function getBrowserSentryConfig() {
355
355
  /** Initialize Sentry for the Junior runtime. Call at the top of your entry point. */
356
356
  function initSentry() {
357
357
  if (getClient()) return;
358
- const dsn = process.env.SENTRY_DSN;
359
- const enableLogs = getBoolean(process.env.SENTRY_ENABLE_LOGS, Boolean(dsn));
358
+ const dsn = process.env["SENTRY_DSN"];
359
+ const enableLogs = getBoolean(process.env["SENTRY_ENABLE_LOGS"], Boolean(dsn));
360
360
  const serviceVersion = getDeploymentServiceVersion();
361
361
  const deploymentSpanAttributes = getDeploymentTelemetryAttributes();
362
362
  init({
@@ -1,5 +1,5 @@
1
- import { D as conversationKindFromRow, o as getDb } from "./db-Czra10QW.js";
2
- import { j as juniorConversations } from "./executor-D_023K0H.js";
1
+ import { O as conversationKindFromRow, o as getDb } from "./db-C-2tFxk3.js";
2
+ import { M as juniorConversations } from "./executor-NVfS8aQ2.js";
3
3
  import { desc, eq, sql } from "drizzle-orm";
4
4
  // src/chat/conversations/lineage.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { _ as withScope, d as setTag, f as setUser, h as startSpan, i as getActiveSpan, l as logger, n as captureMessage, p as spanToJSON, s as getTraceData, t as captureException } from "./sentry-BRTJqumy.js";
2
- import { t as JUNIOR_VERSION } from "./version-CGMRmMPK.js";
1
+ import { _ as withScope, d as setTag, f as setUser, h as startSpan, i as getActiveSpan, l as logger, n as captureMessage, p as spanToJSON, s as getTraceData, t as captureException } from "./sentry-CPbZjomA.js";
2
+ import { t as JUNIOR_VERSION } from "./version-Uo3c94Dx.js";
3
3
  import path from "node:path";
4
4
  import { styleText } from "node:util";
5
5
  import { ConfigError, configureSync, getConfig, getLogger } from "@logtape/logtape";
@@ -127,17 +127,21 @@ function toOptionalTrimmed(value) {
127
127
  }
128
128
  /** Resolve the deployment version used for release and telemetry correlation. */
129
129
  function getDeploymentServiceVersion() {
130
- const configuredRelease = toOptionalTrimmed(process.env.SENTRY_RELEASE);
130
+ const configuredRelease = toOptionalTrimmed(process.env["SENTRY_RELEASE"]);
131
131
  if (configuredRelease) return configuredRelease;
132
- const deploymentRevision = toOptionalTrimmed(process.env.VERCEL_GIT_COMMIT_SHA);
132
+ const deploymentRevision = toOptionalTrimmed(process.env["VERCEL_GIT_COMMIT_SHA"]);
133
133
  return deploymentRevision ? `${JUNIOR_VERSION}+${deploymentRevision}` : void 0;
134
134
  }
135
+ /** Vercel deployment that runs this process. Unset outside Vercel. */
136
+ function getDeploymentId() {
137
+ return toOptionalTrimmed(process.env["VERCEL_DEPLOYMENT_ID"]);
138
+ }
135
139
  /** Resolve deployment-scoped telemetry attributes from host environment. */
136
140
  function getDeploymentTelemetryAttributes() {
137
141
  const attributes = {};
138
142
  const serviceVersion = getDeploymentServiceVersion();
139
- const deploymentId = toOptionalTrimmed(process.env.VERCEL_DEPLOYMENT_ID);
140
- const region = toOptionalTrimmed(process.env.VERCEL_REGION);
143
+ const deploymentId = getDeploymentId();
144
+ const region = toOptionalTrimmed(process.env["VERCEL_REGION"]);
141
145
  attributes["app.junior.version"] = JUNIOR_VERSION;
142
146
  attributes["service.instance.id"] = SERVICE_INSTANCE_ID;
143
147
  if (region) attributes["cloud.region"] = region;
@@ -276,7 +280,7 @@ const SENTRY_TAG_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
276
280
  "url.path"
277
281
  ]);
278
282
  function getSentryEnvironment() {
279
- return (process.env.SENTRY_ENVIRONMENT ?? process.env.VERCEL_ENV ?? process.env.NODE_ENV ?? "").trim().toLowerCase();
283
+ return (process.env["SENTRY_ENVIRONMENT"] ?? process.env["VERCEL_ENV"] ?? process.env["NODE_ENV"] ?? "").trim().toLowerCase();
280
284
  }
281
285
  /** Marks an audit event. Sentry keeps it in production. */
282
286
  const AUDIT_LOG_ATTRIBUTE = "app.log.audit";
@@ -284,17 +288,17 @@ function shouldSuppressInfoLog(level, attributes) {
284
288
  return getSentryEnvironment() === "production" && level === "info" && attributes[AUDIT_LOG_ATTRIBUTE] !== true;
285
289
  }
286
290
  function shouldEmitConsole(level) {
287
- if (process.env.NODE_ENV === "test") return level === "error";
291
+ if (process.env["NODE_ENV"] === "test") return level === "error";
288
292
  return true;
289
293
  }
290
294
  function isDevelopmentLoggingMode() {
291
- if (process.env.NODE_ENV !== "development") return false;
292
- if (process.env.CI) return false;
295
+ if (process.env["NODE_ENV"] !== "development") return false;
296
+ if (process.env["CI"]) return false;
293
297
  return true;
294
298
  }
295
299
  function shouldUseDevelopmentConsoleFormat() {
296
300
  if (!isDevelopmentLoggingMode()) return false;
297
- return process.env.JUNIOR_LOG_FORMAT?.trim().toLowerCase() !== "structured";
301
+ return process.env["JUNIOR_LOG_FORMAT"]?.trim().toLowerCase() !== "structured";
298
302
  }
299
303
  function shouldUsePrettyConsole(level) {
300
304
  if (level === "warn" || level === "error") return false;
@@ -302,8 +306,8 @@ function shouldUsePrettyConsole(level) {
302
306
  }
303
307
  function shouldUseConsoleColor() {
304
308
  if (!shouldUseDevelopmentConsoleFormat()) return false;
305
- if (process.env.NO_COLOR) return false;
306
- return process.env.FORCE_COLOR?.trim() === "1" || Boolean(process.stdout?.isTTY) || Boolean(process.stderr?.isTTY);
309
+ if (process.env["NO_COLOR"]) return false;
310
+ return process.env["FORCE_COLOR"]?.trim() === "1" || Boolean(process.stdout?.isTTY) || Boolean(process.stderr?.isTTY);
307
311
  }
308
312
  function formatConsoleTimestamp(timestamp) {
309
313
  if (shouldUseDevelopmentConsoleFormat()) return timestamp.toTimeString().slice(0, 8);
@@ -382,7 +386,7 @@ function toSnakeCase(value) {
382
386
  function normalizeEventName(value) {
383
387
  const segments = value.trim().split(".").map(toSnakeCase).filter(Boolean);
384
388
  const normalized = segments.length === 0 ? "log.record.emitted" : segments.length === 1 ? `app.${segments[0]}` : segments.join(".");
385
- if (process.env.NODE_ENV !== "production" && (!EVENT_NAME_PATTERN.test(value) || value !== normalized)) throw new Error(`Invalid log event name "${value}"; use lowercase dot-delimited namespaces`);
389
+ if (process.env["NODE_ENV"] !== "production" && (!EVENT_NAME_PATTERN.test(value) || value !== normalized)) throw new Error(`Invalid log event name "${value}"; use lowercase dot-delimited namespaces`);
386
390
  return normalized;
387
391
  }
388
392
  function isSemanticKey(key) {
@@ -435,8 +439,8 @@ function getTraceCorrelationAttributes() {
435
439
  if (!span) return {};
436
440
  const json = spanToJSON(span);
437
441
  const attrs = {};
438
- if (json.trace_id) attrs.trace_id = json.trace_id;
439
- if (json.span_id) attrs.span_id = json.span_id;
442
+ if (json.trace_id) attrs["trace_id"] = json.trace_id;
443
+ if (json.span_id) attrs["span_id"] = json.span_id;
440
444
  return attrs;
441
445
  } catch {
442
446
  return {};
@@ -634,7 +638,7 @@ function booleanConsoleToken(label, value) {
634
638
  return typeof value === "boolean" ? `${label}=${value ? "yes" : "no"}` : void 0;
635
639
  }
636
640
  function shouldShowPrettyCorrelation(eventName) {
637
- return !(eventName === "plugin.loaded" || eventName === "startup.discovery.completed" || eventName.endsWith(".loaded"));
641
+ return !(eventName === "startup.discovery.completed" || eventName.endsWith(".loaded"));
638
642
  }
639
643
  function getPrettyConsoleSummaryTokens(level, eventName, attributes) {
640
644
  const tokens = [];
@@ -1181,13 +1185,13 @@ const PI_COST_FIELDS = [
1181
1185
  function readPiUsage(source) {
1182
1186
  const record = asRecord(source);
1183
1187
  if (!record) return {};
1184
- const usage = asRecord(record.usage) ?? record;
1188
+ const usage = asRecord(record["usage"]) ?? record;
1185
1189
  const summary = {};
1186
1190
  for (const [piKey, ourKey] of PI_USAGE_FIELDS) {
1187
1191
  const value = toFiniteTokenCount(usage[piKey]) ?? toFiniteTokenCount(usage[ourKey]);
1188
1192
  if (value !== void 0) summary[ourKey] = value;
1189
1193
  }
1190
- const piCost = asRecord(usage.cost);
1194
+ const piCost = asRecord(usage["cost"]);
1191
1195
  if (piCost) {
1192
1196
  const cost = {};
1193
1197
  for (const field of PI_COST_FIELDS) {
@@ -1249,4 +1253,4 @@ function extractGenAiUsageAttributes(...sources) {
1249
1253
  ...cost?.total !== void 0 ? { "app.cost.total_usd": cost.total } : void 0
1250
1254
  };
1251
1255
  }
1252
- export { JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE as A, getDeploymentTelemetryAttributes as B, summarizeMessageText as C, JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE as D, withSpan as E, JUNIOR_RETENTION_CRON_SCHEDULE as F, isRecord as G, GOOGLE_IDENTITY_PROVIDER as H, JUNIOR_RETENTION_ROUTE as I, toOptionalNumber as K, JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE as L, JUNIOR_HEARTBEAT_CRON_SCHEDULE as M, JUNIOR_HEARTBEAT_ROUTE as N, JUNIOR_AUTO_ARCHIVE_ROUTE as O, JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE as P, LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION as R, setTags as S, withLogContext as T, isNativeIdentityProvider as U, runWithLogAttributes as V, normalizeIdentityEmail as W, runBestEffort as _, extractGenAiUsageSummary as a, setSpanAttributes as b, getLogContextAttributes as c, logAudit as d, logError as f, normalizeGenAiFinishReason as g, logWarn as h, extractGenAiUsageAttributes as i, JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE as j, JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE as k, getLogContextAttributesForSpan as l, logInfo as m, createChatSdkLogger as n, getActiveTraceContext as o, logException as p, toOptionalString as q, createRequestContext as r, getActiveTraceId as s, buildTurnFailureResponse as t, getTracePropagationHeaders as u, serializeGenAiAttribute as v, withContext as w, setSpanStatus as x, setSentryUser as y, getDeploymentServiceVersion as z };
1256
+ export { JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE as A, getDeploymentServiceVersion as B, summarizeMessageText as C, JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE as D, withSpan as E, JUNIOR_RETENTION_CRON_SCHEDULE as F, normalizeIdentityEmail as G, runWithLogAttributes as H, JUNIOR_RETENTION_ROUTE as I, toOptionalString as J, isRecord as K, JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE as L, JUNIOR_HEARTBEAT_CRON_SCHEDULE as M, JUNIOR_HEARTBEAT_ROUTE as N, JUNIOR_AUTO_ARCHIVE_ROUTE as O, JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE as P, LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION as R, setTags as S, withLogContext as T, GOOGLE_IDENTITY_PROVIDER as U, getDeploymentTelemetryAttributes as V, isNativeIdentityProvider as W, runBestEffort as _, extractGenAiUsageSummary as a, setSpanAttributes as b, getLogContextAttributes as c, logAudit as d, logError as f, normalizeGenAiFinishReason as g, logWarn as h, extractGenAiUsageAttributes as i, JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE as j, JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE as k, getLogContextAttributesForSpan as l, logInfo as m, createChatSdkLogger as n, getActiveTraceContext as o, logException as p, toOptionalNumber as q, createRequestContext as r, getActiveTraceId as s, buildTurnFailureResponse as t, getTracePropagationHeaders as u, serializeGenAiAttribute as v, withContext as w, setSpanStatus as x, setSentryUser as y, getDeploymentId as z };
@@ -1,12 +1,12 @@
1
- import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { Jn as renderUntrustedTag, vo as canAccessConversation, xo as readConversationAccessFromSql } from "./projection-CQNDOi82.js";
3
- import { n as botConfig } from "./config-CmjhyqgB.js";
4
- import { a as getConversationStore, j as SYSTEM_IDENTITY_ID, o as getDb } from "./db-Czra10QW.js";
5
- import { Ft as toolInvocationDestination, Pt as actorFromRun } from "./agent-runner-H4YhvNBj.js";
6
- import { M as EVENT_WAIT_MS, Z as postAutomatedTurnLimitNoticeForConversation, nt as admitAutomatedTurn } from "./session-stop-BLmfFI3d.js";
7
- import { A as readChildConversationSender, H as enqueueAgentInvocation, Z as createAgentInvocationForMessage, at as findChildAgentConversationId, g as getActiveAgentInvocationForConversation, lt as PARENT_AGENT_TARGET, rt as AgentMessageTargetError, tt as AgentMessagePausedError, y as getLatestAgentInvocationForConversation } from "./warmup-CdU5hR49.js";
8
- import { r as appendAndEnqueueInboundMessage } from "./store-DmV4CoNr.js";
9
- import { a as enqueueAgentMessageToParent } from "./result-C8iIpDl1.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
+ import { A as actorFromRun, j as toolInvocationDestination } from "./agent-runner-BP8_DLUv.js";
3
+ import { An as PARENT_AGENT_TARGET, Cn as createAgentInvocationForMessage, Dn as AgentMessageTargetError, En as AgentMessagePausedError, Gt as getActiveAgentInvocationForConversation, Jt as getLatestAgentInvocationForConversation, On as findChildAgentConversationId, hn as enqueueAgentInvocation, in as readChildConversationSender } from "./warmup-H8uLvW9e.js";
4
+ import { a as enqueueAgentMessageToParent } from "./result-DpiNseDA.js";
5
+ import { Co as readConversationAccessFromSql, Jn as renderUntrustedTag, bo as canAccessConversation } from "./projection-DBq8tsA5.js";
6
+ import { n as botConfig } from "./config-oGM7KA9M.js";
7
+ import { M as SYSTEM_IDENTITY_ID, a as getConversationStore, o as getDb } from "./db-C-2tFxk3.js";
8
+ import { H as admitAutomatedTurn, L as postAutomatedTurnLimitNoticeForConversation, k as EVENT_WAIT_MS } from "./session-stop-BLLp1IP_.js";
9
+ import { r as appendAndEnqueueInboundMessage } from "./store-Dgs7Oe44.js";
10
10
  // src/chat/agent-invocations/top-level-message.ts
11
11
  const AGENT_MESSAGE_EVENT_NAMESPACE = "junior";
12
12
  /** Event type of a message from another top-level agent. */
@@ -1,14 +1,9 @@
1
- import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { s as getSqlExecutor } from "./db-Czra10QW.js";
3
- import { vt as readLiveAttachment } from "./agent-runner-H4YhvNBj.js";
4
- import { m as isVisionImageMediaType, p as detectImageMediaType } from "./statuses-Hn-HsOph.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
+ import { s as getSqlExecutor } from "./db-C-2tFxk3.js";
3
+ import { h as isVisionImageMediaType, m as detectImageMediaType } from "./web-message-id-lNodcCOI.js";
4
+ import { Nt as readLiveAttachment } from "./warmup-H8uLvW9e.js";
5
5
  // src/chat/attachments/model-input.ts
6
- var model_input_exports = /* @__PURE__ */ __exportAll({
7
- MAX_MODEL_ATTACHMENTS: () => 3,
8
- MAX_MODEL_ATTACHMENT_BYTES: () => MAX_MODEL_ATTACHMENT_BYTES,
9
- buildStoredAttachmentPromptText: () => buildStoredAttachmentPromptText,
10
- loadInputAttachments: () => loadInputAttachments
11
- });
6
+ var model_input_exports = /* @__PURE__ */ __exportAll({ loadInputAttachments: () => loadInputAttachments });
12
7
  /** Largest file that Slack and web send to the model in the prompt. */
13
8
  const MAX_MODEL_ATTACHMENT_BYTES = 5242880;
14
9
  /** Tell the model how to read a stored file that the prompt does not carry. */
package/dist/nitro.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { i as JuniorDashboardOptions } from "./app-HDZglaIu.js";
2
1
  import { n as JuniorPluginSet } from "./plugins-B_0Cr0MO.js";
2
+ import { i as JuniorDashboardOptions } from "./app-Dd9v1mNx.js";
3
3
  import { withSentryConfig as withSentryConfig$1 } from "@sentry/nitro";
4
4
  type SentryNitroConfig = Parameters<typeof withSentryConfig$1>[0];
5
5
  type SentryNitroOptions = NonNullable<Parameters<typeof withSentryConfig$1>[1]>;
package/dist/nitro.js CHANGED
@@ -1,9 +1,10 @@
1
- import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_CRON_SCHEDULE, I as JUNIOR_RETENTION_ROUTE, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_CRON_SCHEDULE, N as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, k as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE, z as getDeploymentServiceVersion } from "./logging-DcjLDDqi.js";
2
- import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-DJhGdS4c.js";
3
- import { a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, g as CACHE_WARMUP_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, u as resolveConversationWorkQueueTopic } from "./background-compaction-queue-CNrZ3QcU.js";
4
- import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-AhG1tSXR.js";
5
- import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-BBX07Jzt.js";
6
- import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cf5gVPWP.js";
1
+ import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-x4AvVhMj.js";
2
+ import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-Bkk0XRo2.js";
3
+ import { o as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, t as CACHE_WARMUP_QUEUE_TOPIC } from "./queue-DFaOscp5.js";
4
+ import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-DcF0nhhz.js";
5
+ import { s as resolveConversationWorkQueueTopic, t as BACKGROUND_COMPACTION_QUEUE_TOPIC } from "./background-compaction-queue-xaE05jxH.js";
6
+ import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, B as getDeploymentServiceVersion, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_CRON_SCHEDULE, I as JUNIOR_RETENTION_ROUTE, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_CRON_SCHEDULE, N as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, k as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE } from "./logging-DiyqRLBx.js";
7
+ import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cv2ETe8Y.js";
7
8
  import path from "node:path";
8
9
  import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
9
10
  import { withSentryConfig as withSentryConfig$1 } from "@sentry/nitro";
@@ -1,5 +1,5 @@
1
- import { Zn as createUserTokenStore } from "./projection-CQNDOi82.js";
2
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-tEMKZ_8M.js";
1
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-DfhmWFeo.js";
2
+ import { Zn as createUserTokenStore } from "./projection-DBq8tsA5.js";
3
3
  import { createServer } from "node:http";
4
4
  // src/chat/local/oauth-callback-server.ts
5
5
  const LOCAL_OAUTH_TIMEOUT_MS = 6e5;
@@ -28,7 +28,7 @@ async function startLocalOAuthCallbackServer() {
28
28
  pendingAuthorization = void 0;
29
29
  completeAuthorization(authorization, /* @__PURE__ */ new Error("Local OAuth authorization canceled"));
30
30
  };
31
- const server = createServer(async (incoming, outgoing) => {
31
+ const handleRequest = async (incoming, outgoing) => {
32
32
  const host = incoming.headers.host ?? "127.0.0.1";
33
33
  let requestUrl;
34
34
  try {
@@ -80,7 +80,8 @@ async function startLocalOAuthCallbackServer() {
80
80
  if (!outgoing.headersSent) outgoing.writeHead(500).end("Authorization callback failed");
81
81
  completeAuthorization(authorization, error instanceof Error ? error : new Error(String(error)));
82
82
  }
83
- });
83
+ };
84
+ const server = createServer((incoming, outgoing) => void handleRequest(incoming, outgoing));
84
85
  await new Promise((resolve, reject) => {
85
86
  server.once("error", reject);
86
87
  server.listen(0, "127.0.0.1", () => {
@@ -1,13 +1,10 @@
1
- import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { t as readJuniorSecret } from "./secrets-DebYU866.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
+ import { t as readJuniorSecret } from "./secrets-DHaJ5TTn.js";
3
3
  import * as z from "zod";
4
4
  import { randomBytes } from "node:crypto";
5
5
  import { SignJWT, jwtVerify } from "jose";
6
6
  // src/chat/local/oauth-relay.ts
7
- var oauth_relay_exports = /* @__PURE__ */ __exportAll({
8
- createLocalOAuthState: () => createLocalOAuthState,
9
- relayLocalOAuthCallback: () => relayLocalOAuthCallback
10
- });
7
+ var oauth_relay_exports = /* @__PURE__ */ __exportAll({ createLocalOAuthState: () => createLocalOAuthState });
11
8
  const LOCAL_OAUTH_STATE_PREFIX = "jr-local";
12
9
  const LOCAL_OAUTH_TOKEN_CONTEXT = "junior.local-oauth-relay.v1";
13
10
  const LOCAL_OAUTH_TOKEN_TTL = "10m";
@@ -1,4 +1,4 @@
1
- import { v as __exportAll } from "./sentry-BRTJqumy.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
2
  import { createRequire } from "node:module";
3
3
  import path from "node:path";
4
4
  import fs, { statSync } from "node:fs";
@@ -64,7 +64,7 @@ function assertPluginSet(value, source) {
64
64
  /** Load a resolved plugin module and return its configured plugin set. */
65
65
  async function loadPluginSetFromModule(moduleRef, importModule = async (ref) => await import(ref.importUrl)) {
66
66
  const mod = await importModule(moduleRef);
67
- return assertPluginSet(moduleRef.exportName === "default" ? mod.default : mod[moduleRef.exportName], `${moduleRef.importUrl}#${moduleRef.exportName}`);
67
+ return assertPluginSet(moduleRef.exportName === "default" ? mod["default"] : mod[moduleRef.exportName], `${moduleRef.importUrl}#${moduleRef.exportName}`);
68
68
  }
69
69
  /** Load an app-local `./plugins` module when one exists. */
70
70
  async function loadAppPluginSet(cwd, importModule) {
@@ -1,4 +1,4 @@
1
- import { v as __exportAll } from "./sentry-BRTJqumy.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
2
  // src/plugins.ts
3
3
  var plugins_exports = /* @__PURE__ */ __exportAll({
4
4
  defineJuniorPlugins: () => defineJuniorPlugins,
@@ -71,7 +71,7 @@ function pluginCatalogConfigFromPluginSet(pluginSet) {
71
71
  };
72
72
  }
73
73
  function readEnvPluginPackages(env = process.env) {
74
- const value = env.JUNIOR_PLUGIN_PACKAGES;
74
+ const value = env["JUNIOR_PLUGIN_PACKAGES"];
75
75
  if (!value) return;
76
76
  let parsed;
77
77
  try {
@@ -79,7 +79,7 @@ function readEnvPluginPackages(env = process.env) {
79
79
  } catch (error) {
80
80
  throw new Error("JUNIOR_PLUGIN_PACKAGES must be valid JSON", { cause: error });
81
81
  }
82
- if (!Array.isArray(parsed) || parsed.some((item) => typeof item !== "string" || !item.trim())) throw new Error("JUNIOR_PLUGIN_PACKAGES must be a JSON array of package names");
82
+ if (!Array.isArray(parsed) || !parsed.every((item) => typeof item === "string" && item.trim() !== "")) throw new Error("JUNIOR_PLUGIN_PACKAGES must be a JSON array of package names");
83
83
  return parsed;
84
84
  }
85
85
  /** Build the manifest catalog config implied by plugin package env. */