@sentry/junior 0.302.0 → 0.304.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 (100) hide show
  1. package/dist/{adapter-context-Cx9fn9B3.js → adapter-context-B1IpoELr.js} +2 -2
  2. package/dist/{admin-_poE5NKL.js → admin-BnVFGo_z.js} +5 -5
  3. package/dist/{agent-runner-CY9RvsTX.js → agent-runner-CoEeZSRh.js} +1461 -1248
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +6 -6
  6. package/dist/api.d.ts +13 -12
  7. package/dist/api.js +230 -105
  8. package/dist/{app-BpY3wtRP.d.ts → app-Cs157Zc5.d.ts} +17 -15
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +108 -96
  11. package/dist/{automation-Cva5ZOwW.js → automation-CuA3yEcD.js} +3 -1
  12. package/dist/{background-compaction-queue-CXFq1_Cz.js → background-compaction-queue-WLPNSF_b.js} +6 -6
  13. package/dist/{briefs-B3NG-pid.js → briefs-CagVVefw.js} +12 -9
  14. package/dist/{catalog-runtime-Dss0lSV6.js → catalog-runtime-B8ZXvXWm.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 +10 -10
  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 +6 -6
  26. package/dist/{config-CzeZiMKs.js → config-DdO1BNcw.js} +142 -67
  27. package/dist/{connections-CDYhMfrs.js → connections-D20kp0j5.js} +6 -6
  28. package/dist/{continue-in-slack-7Uf05ndC.js → continue-in-slack-BKEVMBj1.js} +8 -8
  29. package/dist/{conversation-BNXfq6Lb.js → conversation-BOqdRtUx.js} +4 -12
  30. package/dist/{conversation-feed-Clf_cv0n.js → conversation-feed-CgpgP7yi.js} +35 -2
  31. package/dist/{conversation-privacy-D9xnM5mK.js → conversation-privacy-L1SK_v0V.js} +16 -8
  32. package/dist/{conversation-turn-D7SEZgTG.js → conversation-turn-BptVJylj.js} +20 -23
  33. package/dist/{credential-sync-DoD0gW-j.js → credential-sync-D1J1CGzL.js} +19 -19
  34. package/dist/{db-B-gtnNjr.js → db-EKJnkrIb.js} +180 -17
  35. package/dist/{db-BdsCzytP.d.ts → db-zbN5ZV_o.d.ts} +26 -26
  36. package/dist/{executor-DZg20EqU.js → executor-CoIZmFK8.js} +55 -15
  37. package/dist/{history-IjdmO_r6.js → history-m2-ceTTX.js} +21 -12
  38. package/dist/{install-t1KQyTUs.js → install-BT2Pf6HP.js} +3 -3
  39. package/dist/instrumentation.d.ts +4 -4
  40. package/dist/instrumentation.js +15 -11
  41. package/dist/{lineage-C79GjoQr.js → lineage-C5DGQCS_.js} +2 -2
  42. package/dist/{logging-C9oDAg4M.js → logging-QSZuMcvo.js} +19 -19
  43. package/dist/{message-BLUCzJXN.js → message-TtxftRHj.js} +9 -9
  44. package/dist/{model-input-5jwNC45G.js → model-input-BHXfA29g.js} +4 -9
  45. package/dist/nitro.d.ts +1 -1
  46. package/dist/nitro.js +8 -8
  47. package/dist/{oauth-callback-server-BBl66vCb.js → oauth-callback-server-B0enqHtZ.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-CIBwgD3s.js → projection-CNKK7doO.js} +755 -221
  53. package/dist/{prompt-CRQbzp5e.js → prompt-DSjhoKu5.js} +185 -12
  54. package/dist/{queue-DtCDaIct.js → queue-CDxkit82.js} +4 -4
  55. package/dist/{queue-CZyYgPF0.d.ts → queue-CbEHUO0l.d.ts} +1 -1
  56. package/dist/{registry-DdFQHZ_d.js → registry-DBDNUUmz.js} +37 -37
  57. package/dist/{resolve-CdW4BdrK.js → resolve-CQLhMWSu.js} +3 -3
  58. package/dist/{result-oOMv1t4O.js → result-B-pauj42.js} +10 -15
  59. package/dist/rolldown-runtime-BKpuH2hG.js +26 -0
  60. package/dist/{runner-DqitLtm-.js → runner-B3KxKks5.js} +10 -10
  61. package/dist/{sandbox-egress-signals-Bw9I0yfJ.js → sandbox-egress-signals-DJJX9ClG.js} +1 -1
  62. package/dist/{schema-DnVQepWP.js → schema-Bx0Mlo32.js} +77 -13
  63. package/dist/{schema-BIFM-U1a.d.ts → schema-CKcu-IK6.d.ts} +562 -23
  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-CrZftRTb.js → service-account-2HmlNPvy.js} +49 -48
  68. package/dist/{service-account-B6mKAPVo.js → service-account-DQLqkSVv.js} +5 -5
  69. package/dist/{session-stop-DW63Z3kj.js → session-stop-DEeZKqbX.js} +132 -74
  70. package/dist/{skills-C16fz60Z.js → skills-2UrD7JkN.js} +6 -9
  71. package/dist/{slack-conversation-unfurl-BHhefEb7.js → slack-conversation-unfurl-Dd129Uov.js} +14 -18
  72. package/dist/{spawn-D_RnFYfy.js → spawn-eMho9HDJ.js} +7 -7
  73. package/dist/{legacy-web-actor-id-C-cEeWqL.js → state-Bveuc4Zh.js} +32 -32
  74. package/dist/{stop-7p1i08CY.js → stop-D_ltJLDS.js} +359 -171
  75. package/dist/{store-C28I0CVW.js → store-COeYnPL_.js} +5 -5
  76. package/dist/{task-queue-BVUJbQ28.js → task-queue-CBIDXZpV.js} +3 -3
  77. package/dist/{task-runner-CWi8j7Z6.js → task-runner-CJF7zIJL.js} +15 -18
  78. package/dist/{thread-context-D3-yYUd0.js → thread-context-Cg0jt0aE.js} +12 -12
  79. package/dist/{turn-session-routing-BFMS9ATF.js → turn-session-routing-CaY3Tp8m.js} +32 -32
  80. package/dist/{turn-user-message-C3-O8Omt.js → turn-user-message-tcom1RYd.js} +3 -3
  81. package/dist/{validation-BSFKUIb4.js → validation-EU91JwIT.js} +2 -2
  82. package/dist/vercel.js +1 -1
  83. package/dist/{version-BHHXNi-0.js → version-BYRPhY5G.js} +1 -1
  84. package/dist/version.js +1 -1
  85. package/dist/{viewer-B1SO21Qa.js → viewer-Cf8ISkAc.js} +3 -3
  86. package/dist/{warmup-Bz9bzkzN.js → warmup-TgY4S1vx.js} +202 -577
  87. package/dist/{worker-BspReIIK.js → worker-C6Uq4OKD.js} +9 -12
  88. package/migrations/0109_user_preferences.sql +1 -0
  89. package/migrations/0110_code_change_repository_state_index.sql +1 -0
  90. package/migrations/0111_attachment_kinds.sql +14 -0
  91. package/migrations/0112_attachment_url_fill.sql +51 -0
  92. package/migrations/0113_attachment_url_index.sql +1 -0
  93. package/migrations/meta/0099_snapshot.json +102 -326
  94. package/migrations/meta/0109_snapshot.json +4925 -0
  95. package/migrations/meta/0110_snapshot.json +4952 -0
  96. package/migrations/meta/0111_snapshot.json +5011 -0
  97. package/migrations/meta/0112_snapshot.json +5011 -0
  98. package/migrations/meta/0113_snapshot.json +5033 -0
  99. package/migrations/meta/_journal.json +36 -1
  100. package/package.json +16 -19
@@ -1,10 +1,10 @@
1
- import { _ as withScope } from "./sentry-BRTJqumy.js";
2
- import "./config-CzeZiMKs.js";
3
- import { h as logWarn, p as logException } from "./logging-C9oDAg4M.js";
1
+ import { h as logWarn, p as logException } from "./logging-QSZuMcvo.js";
2
+ import { _ as withScope } from "./sentry-CPbZjomA.js";
3
+ import "./config-DdO1BNcw.js";
4
4
  import { AsyncLocalStorage } from "node:async_hooks";
5
5
  import { sql } from "drizzle-orm";
6
6
  import { bigint, boolean, check, customType, date, doublePrecision, foreignKey, index, integer, jsonb, pgTable, primaryKey, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
7
- import { Pool, neon } from "@neondatabase/serverless";
7
+ import { Pool as Pool$1, neon } from "@neondatabase/serverless";
8
8
  import { drizzle } from "drizzle-orm/neon-serverless";
9
9
  import { Agent } from "undici";
10
10
  import { readMigrationFiles } from "drizzle-orm/migrator";
@@ -62,6 +62,11 @@ const juniorUsers = pgTable("junior_users", {
62
62
  autoArchiveDefault: boolean("auto_archive_default").notNull().default(false),
63
63
  /** Hours done work and the conversation stay quiet before auto-archive. */
64
64
  autoArchiveGraceHours: integer("auto_archive_grace_hours").notNull().default(24),
65
+ /**
66
+ * Small per-user choices, such as an experiment opt-in, that can come
67
+ * and go without a migration. `api/user-settings.ts` owns the keys.
68
+ */
69
+ preferences: jsonb("preferences").$type().notNull().default({}),
65
70
  createdAt: timestamptz("created_at").notNull(),
66
71
  updatedAt: timestamptz("updated_at").notNull()
67
72
  }, (table) => [uniqueIndex("junior_users_primary_email_normalized_uidx").on(table.primaryEmailNormalized)]);
@@ -157,12 +162,18 @@ const juniorConversations = pgTable("junior_conversations", {
157
162
  index("junior_conversations_root_idx").on(table.rootConversationId)
158
163
  ]);
159
164
  // src/db/schema/attachments.ts
160
- /** Durable metadata for files owned by one conversation. */
165
+ /**
166
+ * What a Message carries: a stored file (`file`) or a web link that its text
167
+ * names (`url`). Rows are owned by one Conversation, and a repeat of the same
168
+ * thing in that Conversation reuses its row.
169
+ */
161
170
  const juniorAttachments = pgTable("junior_attachments", {
162
171
  id: text("id").primaryKey(),
172
+ /** `file` or `url`. Only `file` rows have storage and file fields. */
173
+ kind: text("kind").notNull().default("file"),
163
174
  conversationId: text("conversation_id").notNull().references(() => juniorConversations.conversationId, { onDelete: "cascade" }),
164
175
  /** Service that stores the file bytes. */
165
- storageProvider: text("storage_provider").notNull(),
176
+ storageProvider: text("storage_provider"),
166
177
  /**
167
178
  * Object key of the stored bytes. Null for a file that Junior records
168
179
  * without storing, such as a large Slack file.
@@ -172,9 +183,15 @@ const juniorAttachments = pgTable("junior_attachments", {
172
183
  provider: text("provider"),
173
184
  /** File id assigned by the source provider. */
174
185
  providerId: text("provider_id"),
175
- filename: text("filename").notNull(),
176
- contentType: text("content_type").notNull(),
177
- bytes: integer("bytes").notNull(),
186
+ /**
187
+ * File name of a file. The column keeps its old name until no worker
188
+ * that reads `filename` runs.
189
+ */
190
+ title: text("filename"),
191
+ contentType: text("content_type"),
192
+ bytes: integer("bytes"),
193
+ /** Web link of a `url` row, as its message text wrote it. */
194
+ url: text("url"),
178
195
  /** Digest of the stored bytes. Null when `storage_key` is null. */
179
196
  sha256: text("sha256"),
180
197
  visionSummary: text("vision_summary"),
@@ -184,9 +201,30 @@ const juniorAttachments = pgTable("junior_attachments", {
184
201
  }, (table) => [
185
202
  index("junior_attachments_conversation_idx").on(table.conversationId),
186
203
  index("junior_attachments_provider_idx").on(table.conversationId, table.provider, table.providerId),
187
- index("junior_attachments_gc_idx").on(table.storageProvider, table.deleteRequestedAt, table.createdAt)
204
+ index("junior_attachments_gc_idx").on(table.storageProvider, table.deleteRequestedAt, table.createdAt),
205
+ uniqueIndex("junior_attachments_conversation_url_idx").on(table.conversationId, table.url).where(sql`${table.url} IS NOT NULL`)
188
206
  ]);
189
207
  /**
208
+ * Where each stored message event uses an Attachment. `seq` is the seq of the
209
+ * first save of its message, as in the transcript. `position` is the 1-based
210
+ * order of a link in the message text, and null for an Attachment that is not
211
+ * in the text. No foreign keys, so creating the table locks no existing
212
+ * table.
213
+ */
214
+ const juniorMessageAttachments = pgTable("junior_message_attachments", {
215
+ conversationId: text("conversation_id").notNull(),
216
+ seq: integer("seq").notNull(),
217
+ attachmentId: text("attachment_id").notNull(),
218
+ position: integer("position")
219
+ }, (table) => [primaryKey({
220
+ name: "junior_message_attachments_pk",
221
+ columns: [
222
+ table.conversationId,
223
+ table.seq,
224
+ table.attachmentId
225
+ ]
226
+ })]);
227
+ /**
190
228
  * Browser uploads that wait for a web Message.
191
229
  *
192
230
  * A row binds one object key to the viewer, Conversation, and Message
@@ -241,6 +279,7 @@ const juniorCodeChanges = pgTable("junior_code_changes", {
241
279
  index("junior_code_changes_opened_at_idx").on(table.openedAt),
242
280
  index("junior_code_changes_merged_at_idx").on(table.mergedAt),
243
281
  index("junior_code_changes_closed_at_idx").on(table.closedAt),
282
+ index("junior_code_changes_repository_state_idx").on(table.repositoryId, table.state, table.updatedAt.desc()),
244
283
  index("junior_code_changes_open_idx").on(table.id).where(sql`${table.state} = 'open'`)
245
284
  ]);
246
285
  // src/db/schema/conversation-annotations.ts
@@ -818,6 +857,7 @@ const juniorSqlSchema = {
818
857
  juniorArtifacts,
819
858
  juniorAttachmentUploads,
820
859
  juniorAttachments,
860
+ juniorMessageAttachments,
821
861
  juniorCodeChanges,
822
862
  juniorCodeRepositories,
823
863
  juniorConversationAnnotations,
@@ -988,7 +1028,7 @@ function warnWebSocketFailure(name, error, failure) {
988
1028
  * proxy's cached backend connection, so the batch skips that handshake. The
989
1029
  * warm path stays on WebSocket. `connect()` and transactions are unchanged.
990
1030
  */
991
- var OverflowPool = class extends Pool {
1031
+ var OverflowPool = class extends Pool$1 {
992
1032
  pendingAcquires = 0;
993
1033
  webSocketOnly = new AsyncLocalStorage();
994
1034
  sql;
@@ -1060,7 +1100,7 @@ var OverflowPool = class extends Pool {
1060
1100
  this.connect((error, client) => {
1061
1101
  this.pendingAcquires--;
1062
1102
  if (client) resolve(client);
1063
- else reject(error);
1103
+ else reject(error ?? /* @__PURE__ */ new Error("pg pool returned no client"));
1064
1104
  });
1065
1105
  });
1066
1106
  }
@@ -1200,7 +1240,7 @@ function createNeonJuniorSqlExecutor(args) {
1200
1240
  return new NeonExecutor(pool, dispatcher);
1201
1241
  }
1202
1242
  // src/db/postgres.ts
1203
- const { Pool: Pool$1 } = pg;
1243
+ const { Pool } = pg;
1204
1244
  var PostgresExecutor = class {
1205
1245
  transactionClient = new AsyncLocalStorage();
1206
1246
  savepointId = 0;
@@ -1307,7 +1347,7 @@ var PostgresExecutor = class {
1307
1347
  };
1308
1348
  /** Create the shared Node Postgres-backed Junior SQL executor. */
1309
1349
  function createPostgresJuniorSqlExecutor(args) {
1310
- const pool = new Pool$1({
1350
+ const pool = new Pool({
1311
1351
  application_name: args.applicationName,
1312
1352
  connectionString: args.connectionString,
1313
1353
  max: 3,
@@ -1334,4 +1374,4 @@ function createJuniorSqlExecutor(args) {
1334
1374
  statementTimeoutMs
1335
1375
  });
1336
1376
  }
1337
- export { juniorAttachmentUploads as A, juniorConversationMetrics as C, juniorConversationAnnotations as D, juniorApiTokens as E, juniorDestinations as F, juniorArtifacts as I, juniorConversations as M, juniorIdentities as N, juniorCodeChanges as O, juniorUsers as P, CONVERSATION_METRICS as S, juniorConversationEvents as T, juniorConversationReadPositions as _, juniorPushSubscriptions as a, juniorConversationEmbeddings as b, juniorReviewItemSlackCards as c, juniorAutomationVersions as d, juniorAutomations as f, juniorAgentInvocations as g, juniorAgentBindings as h, juniorWorkspaces as i, juniorAttachments as j, juniorCodeRepositories as k, juniorReviewItems as l, juniorLocationConfigurations as m, juniorSnapshots as n, juniorReviewItemAssignees as o, juniorStats as p, juniorWorkspaceRepos as r, juniorReviewItemConversations as s, createJuniorSqlExecutor as t, juniorAutomationRuns as u, juniorConversationParticipants as v, isUserInstruction as w, juniorConversationBriefs as x, juniorConversationBindings as y };
1377
+ export { juniorAttachmentUploads as A, juniorConversationMetrics as C, juniorConversationAnnotations as D, juniorApiTokens as E, juniorUsers as F, juniorDestinations as I, juniorArtifacts as L, juniorMessageAttachments as M, juniorConversations as N, juniorCodeChanges as O, juniorIdentities as P, CONVERSATION_METRICS as S, juniorConversationEvents as T, juniorConversationReadPositions as _, juniorPushSubscriptions as a, juniorConversationEmbeddings as b, juniorReviewItemSlackCards as c, juniorAutomationVersions as d, juniorAutomations as f, juniorAgentInvocations as g, juniorAgentBindings as h, juniorWorkspaces as i, juniorAttachments as j, juniorCodeRepositories as k, juniorReviewItems as l, juniorLocationConfigurations as m, juniorSnapshots as n, juniorReviewItemAssignees as o, juniorStats as p, juniorWorkspaceRepos as r, juniorReviewItemConversations as s, createJuniorSqlExecutor as t, juniorAutomationRuns as u, juniorConversationParticipants as v, isUserInstruction as w, juniorConversationBriefs as x, juniorConversationBindings as y };
@@ -72,7 +72,7 @@ const messageFieldsSchema = z.record(z.string(), z.unknown());
72
72
  const replacementEntrySchema = z.object({ item: z.string() }).passthrough();
73
73
  /** Identify history events that store message fields as JSON strings. */
74
74
  function isEncodedHistoryType(type) {
75
- return type === "user_message" || type === "assistant_message" || type === "tool_result" || type === "handoff" || type === "compaction";
75
+ return type === "user_message" || type === "assistant_message" || type === "tool_result" || type === "system_message" || type === "handoff" || type === "compaction";
76
76
  }
77
77
  /** Encode agent history before SQL can change keys or string contents. */
78
78
  function encodeHistoryPayload(data) {
@@ -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
@@ -141,6 +144,10 @@ const toolResultEventDataSchema = z.object({
141
144
  type: z.literal("tool_result"),
142
145
  role: z.never().optional()
143
146
  }).passthrough();
147
+ const systemMessageEventDataSchema = z.object({
148
+ type: z.literal("system_message"),
149
+ role: z.never().optional()
150
+ }).passthrough();
144
151
  /**
145
152
  * One replayable agent-history item. Junior owns `type` and user provenance,
146
153
  * forbids the provider `role` discriminator, and leaves preserved message
@@ -149,7 +156,8 @@ const toolResultEventDataSchema = z.object({
149
156
  const agentHistoryItemSchema = z.discriminatedUnion("type", [
150
157
  userMessageEventDataSchema,
151
158
  assistantMessageEventDataSchema,
152
- toolResultEventDataSchema
159
+ toolResultEventDataSchema,
160
+ systemMessageEventDataSchema
153
161
  ]);
154
162
  const nativeReplacementHistoryItemSchema = z.object({
155
163
  item: agentHistoryItemSchema,
@@ -465,6 +473,7 @@ const KNOWN_CONVERSATION_EVENT_TYPES = [
465
473
  "user_message",
466
474
  "assistant_message",
467
475
  "tool_result",
476
+ "system_message",
468
477
  "mcp_provider_connected",
469
478
  "mcp_provider_connected_unowned",
470
479
  "authorization_requested",
@@ -1,9 +1,9 @@
1
- import { ao as SANDBOX_COMMAND_PATH, ho as runNonInteractiveCommand, lo as SANDBOX_WORKSPACE_ROOT } from "./projection-CIBwgD3s.js";
2
- import { E as withSpan, b as setSpanAttributes } from "./logging-C9oDAg4M.js";
1
+ import { ao as SANDBOX_COMMAND_PATH, ho as runNonInteractiveCommand, lo as SANDBOX_WORKSPACE_ROOT } from "./projection-CNKK7doO.js";
2
+ import { E as withSpan, b as setSpanAttributes } from "./logging-QSZuMcvo.js";
3
3
  // src/chat/sandbox/resources.ts
4
4
  let configuredResources;
5
5
  function resourcesFromEnv() {
6
- const value = process.env.SANDBOX_VCPUS?.trim();
6
+ const value = process.env["SANDBOX_VCPUS"]?.trim();
7
7
  if (!value || !/^\d+$/.test(value)) return;
8
8
  const vcpus = Number(value);
9
9
  if (!Number.isSafeInteger(vcpus) || vcpus <= 0) return;
@@ -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 getDeploymentServiceVersion, V as getDeploymentTelemetryAttributes } from "./logging-C9oDAg4M.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-D9xnM5mK.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-L1SK_v0V.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-QSZuMcvo.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
@@ -274,7 +274,10 @@ function scrubContainer(container) {
274
274
  scrubSensitiveUrlAttributes(container.data);
275
275
  scrubSensitiveUrlAttributes(container.attributes);
276
276
  }
277
- /** Remove private conversation payloads and boundary secrets from error events. */
277
+ /**
278
+ * Remove private conversation payloads and boundary secrets from error and
279
+ * user feedback events.
280
+ */
278
281
  function scrubPrivateSentryEvent(event) {
279
282
  scrubContainer(event);
280
283
  scrubSensitiveRequest(event.request);
@@ -330,17 +333,17 @@ function getBoolean(value, fallback) {
330
333
  return fallback;
331
334
  }
332
335
  function getEnvironment() {
333
- return process.env.SENTRY_ENVIRONMENT ?? process.env.VERCEL_ENV ?? process.env.NODE_ENV;
336
+ return process.env["SENTRY_ENVIRONMENT"] ?? process.env["VERCEL_ENV"] ?? process.env["NODE_ENV"];
334
337
  }
335
338
  function getTracesSampleRate() {
336
- return getSampleRate(process.env.SENTRY_TRACES_SAMPLE_RATE, 1);
339
+ return getSampleRate(process.env["SENTRY_TRACES_SAMPLE_RATE"], 1);
337
340
  }
338
341
  /**
339
342
  * Read the settings a served page needs to send browser spans to the same
340
343
  * project, continuing the trace of the request that rendered it.
341
344
  */
342
345
  function getBrowserSentryConfig() {
343
- const dsn = process.env.SENTRY_DSN?.trim();
346
+ const dsn = process.env["SENTRY_DSN"]?.trim();
344
347
  if (!dsn) return void 0;
345
348
  const trace = getTraceData();
346
349
  return {
@@ -355,8 +358,8 @@ function getBrowserSentryConfig() {
355
358
  /** Initialize Sentry for the Junior runtime. Call at the top of your entry point. */
356
359
  function initSentry() {
357
360
  if (getClient()) return;
358
- const dsn = process.env.SENTRY_DSN;
359
- const enableLogs = getBoolean(process.env.SENTRY_ENABLE_LOGS, Boolean(dsn));
361
+ const dsn = process.env["SENTRY_DSN"];
362
+ const enableLogs = getBoolean(process.env["SENTRY_ENABLE_LOGS"], Boolean(dsn));
360
363
  const serviceVersion = getDeploymentServiceVersion();
361
364
  const deploymentSpanAttributes = getDeploymentTelemetryAttributes();
362
365
  init({
@@ -394,6 +397,7 @@ function initSentry() {
394
397
  integrations: (defaultIntegrations) => defaultIntegrations.filter((integration) => !MANUAL_GEN_AI_INTEGRATIONS.has(integration.name))
395
398
  });
396
399
  getGlobalScope().setAttributes(deploymentSpanAttributes);
400
+ getGlobalScope().addEventProcessor((event) => event.type === "feedback" ? scrubPrivateSentryEvent(event) : event);
397
401
  subscribeGatewayRequestTiming();
398
402
  }
399
403
  export { getBrowserSentryConfig, initSentry, nameRequestRoute, routeNameMiddleware };
@@ -1,5 +1,5 @@
1
- import { O as conversationKindFromRow, o as getDb } from "./db-B-gtnNjr.js";
2
- import { M as juniorConversations } from "./executor-DZg20EqU.js";
1
+ import { A as conversationKindFromRow, o as getDb } from "./db-EKJnkrIb.js";
2
+ import { N as juniorConversations } from "./executor-CoIZmFK8.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-BHHXNi-0.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-BYRPhY5G.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,21 +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
135
  /** Vercel deployment that runs this process. Unset outside Vercel. */
136
136
  function getDeploymentId() {
137
- return toOptionalTrimmed(process.env.VERCEL_DEPLOYMENT_ID);
137
+ return toOptionalTrimmed(process.env["VERCEL_DEPLOYMENT_ID"]);
138
138
  }
139
139
  /** Resolve deployment-scoped telemetry attributes from host environment. */
140
140
  function getDeploymentTelemetryAttributes() {
141
141
  const attributes = {};
142
142
  const serviceVersion = getDeploymentServiceVersion();
143
143
  const deploymentId = getDeploymentId();
144
- const region = toOptionalTrimmed(process.env.VERCEL_REGION);
144
+ const region = toOptionalTrimmed(process.env["VERCEL_REGION"]);
145
145
  attributes["app.junior.version"] = JUNIOR_VERSION;
146
146
  attributes["service.instance.id"] = SERVICE_INSTANCE_ID;
147
147
  if (region) attributes["cloud.region"] = region;
@@ -280,7 +280,7 @@ const SENTRY_TAG_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
280
280
  "url.path"
281
281
  ]);
282
282
  function getSentryEnvironment() {
283
- 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();
284
284
  }
285
285
  /** Marks an audit event. Sentry keeps it in production. */
286
286
  const AUDIT_LOG_ATTRIBUTE = "app.log.audit";
@@ -288,17 +288,17 @@ function shouldSuppressInfoLog(level, attributes) {
288
288
  return getSentryEnvironment() === "production" && level === "info" && attributes[AUDIT_LOG_ATTRIBUTE] !== true;
289
289
  }
290
290
  function shouldEmitConsole(level) {
291
- if (process.env.NODE_ENV === "test") return level === "error";
291
+ if (process.env["NODE_ENV"] === "test") return level === "error";
292
292
  return true;
293
293
  }
294
294
  function isDevelopmentLoggingMode() {
295
- if (process.env.NODE_ENV !== "development") return false;
296
- if (process.env.CI) return false;
295
+ if (process.env["NODE_ENV"] !== "development") return false;
296
+ if (process.env["CI"]) return false;
297
297
  return true;
298
298
  }
299
299
  function shouldUseDevelopmentConsoleFormat() {
300
300
  if (!isDevelopmentLoggingMode()) return false;
301
- return process.env.JUNIOR_LOG_FORMAT?.trim().toLowerCase() !== "structured";
301
+ return process.env["JUNIOR_LOG_FORMAT"]?.trim().toLowerCase() !== "structured";
302
302
  }
303
303
  function shouldUsePrettyConsole(level) {
304
304
  if (level === "warn" || level === "error") return false;
@@ -306,8 +306,8 @@ function shouldUsePrettyConsole(level) {
306
306
  }
307
307
  function shouldUseConsoleColor() {
308
308
  if (!shouldUseDevelopmentConsoleFormat()) return false;
309
- if (process.env.NO_COLOR) return false;
310
- 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);
311
311
  }
312
312
  function formatConsoleTimestamp(timestamp) {
313
313
  if (shouldUseDevelopmentConsoleFormat()) return timestamp.toTimeString().slice(0, 8);
@@ -386,7 +386,7 @@ function toSnakeCase(value) {
386
386
  function normalizeEventName(value) {
387
387
  const segments = value.trim().split(".").map(toSnakeCase).filter(Boolean);
388
388
  const normalized = segments.length === 0 ? "log.record.emitted" : segments.length === 1 ? `app.${segments[0]}` : segments.join(".");
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`);
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`);
390
390
  return normalized;
391
391
  }
392
392
  function isSemanticKey(key) {
@@ -439,8 +439,8 @@ function getTraceCorrelationAttributes() {
439
439
  if (!span) return {};
440
440
  const json = spanToJSON(span);
441
441
  const attrs = {};
442
- if (json.trace_id) attrs.trace_id = json.trace_id;
443
- 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;
444
444
  return attrs;
445
445
  } catch {
446
446
  return {};
@@ -638,7 +638,7 @@ function booleanConsoleToken(label, value) {
638
638
  return typeof value === "boolean" ? `${label}=${value ? "yes" : "no"}` : void 0;
639
639
  }
640
640
  function shouldShowPrettyCorrelation(eventName) {
641
- return !(eventName === "plugin.loaded" || eventName === "startup.discovery.completed" || eventName.endsWith(".loaded"));
641
+ return !(eventName === "startup.discovery.completed" || eventName.endsWith(".loaded"));
642
642
  }
643
643
  function getPrettyConsoleSummaryTokens(level, eventName, attributes) {
644
644
  const tokens = [];
@@ -1185,13 +1185,13 @@ const PI_COST_FIELDS = [
1185
1185
  function readPiUsage(source) {
1186
1186
  const record = asRecord(source);
1187
1187
  if (!record) return {};
1188
- const usage = asRecord(record.usage) ?? record;
1188
+ const usage = asRecord(record["usage"]) ?? record;
1189
1189
  const summary = {};
1190
1190
  for (const [piKey, ourKey] of PI_USAGE_FIELDS) {
1191
1191
  const value = toFiniteTokenCount(usage[piKey]) ?? toFiniteTokenCount(usage[ourKey]);
1192
1192
  if (value !== void 0) summary[ourKey] = value;
1193
1193
  }
1194
- const piCost = asRecord(usage.cost);
1194
+ const piCost = asRecord(usage["cost"]);
1195
1195
  if (piCost) {
1196
1196
  const cost = {};
1197
1197
  for (const field of PI_COST_FIELDS) {
@@ -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-CIBwgD3s.js";
3
- import { n as botConfig } from "./config-CzeZiMKs.js";
4
- import { M as SYSTEM_IDENTITY_ID, a as getConversationStore, o as getDb } from "./db-B-gtnNjr.js";
5
- import { A as actorFromRun, j as toolInvocationDestination } from "./agent-runner-CY9RvsTX.js";
6
- import { H as admitAutomatedTurn, L as postAutomatedTurnLimitNoticeForConversation, k as EVENT_WAIT_MS } from "./session-stop-DW63Z3kj.js";
7
- import { Dn as findChildAgentConversationId, En as AgentMessageTargetError, Sn as createAgentInvocationForMessage, Tn as AgentMessagePausedError, Wt as getActiveAgentInvocationForConversation, kn as PARENT_AGENT_TARGET, mn as enqueueAgentInvocation, qt as getLatestAgentInvocationForConversation, rn as readChildConversationSender } from "./warmup-Bz9bzkzN.js";
8
- import { r as appendAndEnqueueInboundMessage } from "./store-C28I0CVW.js";
9
- import { a as enqueueAgentMessageToParent } from "./result-oOMv1t4O.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
+ import { M as toolInvocationDestination, j as actorFromRun } from "./agent-runner-CoEeZSRh.js";
3
+ import { Cn as AgentMessagePausedError, Dn as PARENT_AGENT_TARGET, Gt as getLatestAgentInvocationForConversation, Ht as getActiveAgentInvocationForConversation, Tn as findChildAgentConversationId, bn as createAgentInvocationForMessage, fn as enqueueAgentInvocation, tn as readChildConversationSender, wn as AgentMessageTargetError } from "./warmup-TgY4S1vx.js";
4
+ import { a as enqueueAgentMessageToParent } from "./result-B-pauj42.js";
5
+ import { Kn as renderUntrustedTag, vo as canAccessConversation, xo as readConversationAccessFromSql } from "./projection-CNKK7doO.js";
6
+ import { n as botConfig } from "./config-DdO1BNcw.js";
7
+ import { P as SYSTEM_IDENTITY_ID, a as getConversationStore, o as getDb } from "./db-EKJnkrIb.js";
8
+ import { H as admitAutomatedTurn, L as postAutomatedTurnLimitNoticeForConversation, k as EVENT_WAIT_MS } from "./session-stop-DEeZKqbX.js";
9
+ import { r as appendAndEnqueueInboundMessage } from "./store-COeYnPL_.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-B-gtnNjr.js";
3
- import { Mt as readLiveAttachment } from "./warmup-Bz9bzkzN.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
+ import { s as getSqlExecutor } from "./db-EKJnkrIb.js";
4
3
  import { h as isVisionImageMediaType, m as detectImageMediaType } from "./web-message-id-lNodcCOI.js";
4
+ import { Jo as readLiveAttachment } from "./projection-CNKK7doO.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-BpY3wtRP.js";
2
1
  import { n as JuniorPluginSet } from "./plugins-B_0Cr0MO.js";
2
+ import { i as JuniorDashboardOptions } from "./app-Cs157Zc5.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,10 +1,10 @@
1
- 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-C9oDAg4M.js";
2
- import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-DJhGdS4c.js";
3
- import { s as resolveConversationWorkQueueTopic, t as BACKGROUND_COMPACTION_QUEUE_TOPIC } from "./background-compaction-queue-CXFq1_Cz.js";
4
- import { o as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, t as CACHE_WARMUP_QUEUE_TOPIC } from "./queue-DtCDaIct.js";
5
- import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-BVUJbQ28.js";
6
- import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-BBX07Jzt.js";
7
- 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-CDxkit82.js";
4
+ import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-CBIDXZpV.js";
5
+ import { s as resolveConversationWorkQueueTopic, t as BACKGROUND_COMPACTION_QUEUE_TOPIC } from "./background-compaction-queue-WLPNSF_b.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-QSZuMcvo.js";
7
+ import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cv2ETe8Y.js";
8
8
  import path from "node:path";
9
9
  import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
10
10
  import { withSentryConfig as withSentryConfig$1 } from "@sentry/nitro";
@@ -121,7 +121,7 @@ function copyIfExists(source, target) {
121
121
  function dashboardAssetPath(packageDir, fileName) {
122
122
  const candidates = [path.join(packageDir, fileName), path.join(packageDir, "dist", fileName)];
123
123
  for (const candidate of candidates) if (existsSync(candidate)) return candidate;
124
- throw new Error(`Junior dashboard asset ${fileName} was not built; run pnpm --filter @sentry/junior-dashboard build before building Nitro`);
124
+ throw new Error(`Dashboard asset ${fileName} was not built; run pnpm --filter @sentry/junior-dashboard build before building Nitro`);
125
125
  }
126
126
  function copyRootIntoServerOutput(cwd, serverRoot, root) {
127
127
  copyIfExists(root, resolveServerOutputPath(cwd, serverRoot, root));
@@ -1,5 +1,5 @@
1
- import { Zn as createUserTokenStore } from "./projection-CIBwgD3s.js";
2
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-DoD0gW-j.js";
1
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-D1J1CGzL.js";
2
+ import { Yn as createUserTokenStore } from "./projection-CNKK7doO.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. */