@sentry/junior 0.256.0 → 0.258.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 (106) hide show
  1. package/dist/{actor-BTtLaeWy.js → actor-tlxzqaRe.js} +3 -6
  2. package/dist/{admin-BhucwVfy.js → admin-My1SLGVO.js} +2 -3
  3. package/dist/{agent-hooks-DlSK8PQQ.js → agent-hooks-BJ_5mlRH.js} +71 -111
  4. package/dist/{agent-invocations-BY60iNw-.js → agent-invocations-Qfz7dWgU.js} +8 -13
  5. package/dist/{agent-runner-C6_cd61V.js → agent-runner-DGsFQw72.js} +278 -467
  6. package/dist/api/schema.d.ts +454 -448
  7. package/dist/api/schema.js +5 -5
  8. package/dist/api.d.ts +2 -12
  9. package/dist/api.js +189 -165
  10. package/dist/{app-B0gT1Slp.d.ts → app-PX2H1PxU.d.ts} +20 -37
  11. package/dist/app.d.ts +3 -3
  12. package/dist/app.js +565 -305
  13. package/dist/{assistant-reply-yn5G-YEG.js → assistant-reply-H1M-91oF.js} +3 -5
  14. package/dist/{automation-CHdlHVZP.js → automation-DWBFBenG.js} +6 -11
  15. package/dist/{briefs-U6Bi3IYw.js → briefs-vYoK85rJ.js} +8 -11
  16. package/dist/{cadence-D00SCzT1.js → cadence-R7Em4RjE.js} +1 -2
  17. package/dist/{catalog-runtime-DF5OWqCc.js → catalog-runtime-BN4DVxco.js} +3 -4
  18. package/dist/cli/chat.d.ts +2 -4
  19. package/dist/cli/chat.js +22 -24
  20. package/dist/cli/check.d.ts +1 -3
  21. package/dist/cli/check.js +4 -5
  22. package/dist/cli/env.d.ts +1 -3
  23. package/dist/cli/env.js +1 -2
  24. package/dist/cli/init.d.ts +1 -3
  25. package/dist/cli/init.js +3 -3
  26. package/dist/cli/main.d.ts +1 -3
  27. package/dist/cli/main.js +4 -5
  28. package/dist/cli/plugins.d.ts +2 -4
  29. package/dist/cli/plugins.js +7 -8
  30. package/dist/cli/run.d.ts +1 -2
  31. package/dist/cli/run.js +1 -2
  32. package/dist/cli/snapshot-create.d.ts +1 -3
  33. package/dist/cli/snapshot-create.js +4 -5
  34. package/dist/cli/upgrade.d.ts +3 -6
  35. package/dist/cli/upgrade.js +11 -17
  36. package/dist/{client-BVrAp-pq.js → client-DbyHuMFU.js} +9 -16
  37. package/dist/{config-DdBiDanf.js → config-_WO_AjCB.js} +18 -15
  38. package/dist/{connections-CG04HdpC.js → connections-ag_1JOhB.js} +21 -21
  39. package/dist/{conversation-T18Xlkx9.js → conversation-DjN3mlog.js} +11 -17
  40. package/dist/{conversation-privacy-CpSYOWnP.js → conversation-privacy-DHP_xnVj.js} +2 -3
  41. package/dist/{conversation-work-C6y3T5Hx.js → conversation-work-BaT_T6EB.js} +1 -2
  42. package/dist/{credential-sync-DKWNdcgm.js → credential-sync-B-CPX_ag.js} +89 -52
  43. package/dist/{db-Ca9Nt5ci.d.ts → db-BnRqQ7G5.d.ts} +1 -1
  44. package/dist/{executor-BroK9oKy.js → executor-RvG6kVe1.js} +58 -70
  45. package/dist/{experimental-Qn9rKLgx.js → experimental-BNK1l1jv.js} +2 -3
  46. package/dist/{history-9pO1Zd4Y.js → history-AY8rs-FR.js} +5 -9
  47. package/dist/{history-DvqWZlYX.d.ts → history-BgI33Kie.d.ts} +12 -20
  48. package/dist/{images-D0VZ5nv0.js → images-C2J_bj2g.js} +5 -6
  49. package/dist/instrumentation.d.ts +1 -3
  50. package/dist/instrumentation.js +6 -8
  51. package/dist/{job-queue-BbGg3gvu.js → job-queue-DVe37it2.js} +6 -12
  52. package/dist/{logging-tPQeUe2i.js → logging-DsHONhVm.js} +54 -24
  53. package/dist/{message-DdPGRYQP.js → message-DyitL8no.js} +5 -6
  54. package/dist/{model-profile-BwU8mqwD.js → model-profile-Bg8EoCKD.js} +2 -4
  55. package/dist/nitro.d.ts +3 -5
  56. package/dist/nitro.js +12 -17
  57. package/dist/{oauth-authorization-BA4Dt6a7.js → oauth-authorization-djQn5Nhy.js} +2 -4
  58. package/dist/{oauth-callback-server-B-2errCX.js → oauth-callback-server-CDby-pCn.js} +3 -4
  59. package/dist/{oauth-relay-CdCnu80W.js → oauth-relay-CTygMkNx.js} +2 -3
  60. package/dist/{package-discovery-BVvSnQBB.js → package-discovery-DJBompdd.js} +17 -21
  61. package/dist/{pending-auth-DT3MRVW8.js → pending-auth-D8J1uJUS.js} +37 -28
  62. package/dist/{plugin-module-CVvEUSMH.js → plugin-module-Cf5gVPWP.js} +1 -2
  63. package/dist/{plugins-CjfUP5gJ.d.ts → plugins-B11Mfkmv.d.ts} +0 -4
  64. package/dist/{plugins-egKWjgue.js → plugins-DOm9Y6qI.js} +2 -3
  65. package/dist/{private-trace-result-BLvBjy_e.js → private-trace-result-CE7_lEdq.js} +1 -2
  66. package/dist/{profile-Bb1zCVGP.js → profile-DpYjfKke.js} +16 -28
  67. package/dist/{prompt-C04mP1hu.js → prompt-xgpyMtg7.js} +5 -9
  68. package/dist/{queue-B5SnqRln.d.ts → queue-C37RbDVc.d.ts} +0 -2
  69. package/dist/{registry-CsNavQ_Z.js → registry-Du566MtJ.js} +57 -30
  70. package/dist/{resolve-B6ZZ9duG.js → resolve-ClCIgh8E.js} +7 -12
  71. package/dist/{result-j9nS0se-.js → result-BBbKA61B.js} +13 -17
  72. package/dist/{rolldown-runtime-B4FMCO8f.js → rolldown-runtime-nwUcYXjP.js} +1 -2
  73. package/dist/{runner-Y331DoZ5.js → runner-CCuqFSqx.js} +12 -13
  74. package/dist/{sandbox-egress-signals-BUfjEdHY.js → sandbox-egress-signals-DY1mbKF4.js} +2 -3
  75. package/dist/{schema-BBgv0MNf.js → schema-DrMh3NtR.js} +17 -27
  76. package/dist/{sentry-CgWZM_kV.js → sentry-BBUlHih9.js} +2 -3
  77. package/dist/{session-stop-q-6GNHx6.js → session-stop-CIoFiwwe.js} +57 -41
  78. package/dist/{skills-CyvTsR9M.js → skills-DyQBLIrK.js} +9 -9
  79. package/dist/{spawn-Do5mX3d_.js → spawn-Dqfeo7XP.js} +4 -5
  80. package/dist/{store-DoewL5mG.d.ts → store-CG0VJyye.d.ts} +0 -14
  81. package/dist/{store-D2It0ozF.js → store-DJLwq4x8.js} +13 -15
  82. package/dist/{task-queue-ZMk9bLRT.js → task-queue-BzW4MaWU.js} +5 -7
  83. package/dist/{task-runner-cIGU5VwJ.js → task-runner-D3qJh4fK.js} +22 -26
  84. package/dist/{tasks-CODtRzvX.js → tasks-CEXKTASS.js} +78 -79
  85. package/dist/{thread-state-BPkwVmvK.js → thread-state-W3f6kAtz.js} +13 -19
  86. package/dist/{turn-failure-response-ChmMeKar.js → turn-failure-response-CWx7aNIh.js} +16 -22
  87. package/dist/{turn-lifecycle-BUP7ZOVa.js → turn-lifecycle-C9JFst7-.js} +2 -3
  88. package/dist/{turn-session-routing-BcWM3PLm.js → turn-session-routing-CUxtfpr7.js} +2 -3
  89. package/dist/{validation-DCd69-cP.js → validation-BHRxa5G4.js} +3 -4
  90. package/dist/vercel.d.ts +1 -3
  91. package/dist/vercel.js +1 -2
  92. package/dist/{version-DBc4Qt_P.js → version-C0U6rHg0.js} +3 -5
  93. package/dist/{version-CnXZ614E.d.ts → version-Cc2OFd9G.d.ts} +0 -2
  94. package/dist/version.d.ts +1 -1
  95. package/dist/version.js +1 -2
  96. package/dist/{viewer-C-9nFKYr.js → viewer-CGvvRqKp.js} +61 -44
  97. package/dist/{web-input-Cv42P3ni.js → web-input-Keb5GRWj.js} +139 -198
  98. package/dist/{web-message-id-xPI_EFSC.js → web-message-id-CJSUiksE.js} +3 -6
  99. package/dist/{work-6UmVQq1V.js → work-DRcsJ3hV.js} +14 -16
  100. package/dist/{worker-DAoBZuZn.js → worker-Cjo-QqPq.js} +7 -8
  101. package/migrations/0059_automation_run_version.sql +2 -0
  102. package/migrations/0060_identity_signed_in_at.sql +1 -0
  103. package/migrations/meta/0059_snapshot.json +3619 -0
  104. package/migrations/meta/0060_snapshot.json +3465 -0
  105. package/migrations/meta/_journal.json +15 -1
  106. package/package.json +8 -6
@@ -1,7 +1,7 @@
1
- import { d as logException } from "./logging-tPQeUe2i.js";
2
- import { g as startSpanManual } from "./sentry-CgWZM_kV.js";
3
- import "./config-DdBiDanf.js";
4
- import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, f as timestamptz, i as juniorAgentBindings, l as juniorUsers, s as juniorConversations } from "./agent-invocations-BY60iNw-.js";
1
+ import { f as logException } from "./logging-DsHONhVm.js";
2
+ import { g as startSpanManual } from "./sentry-BBUlHih9.js";
3
+ import "./config-_WO_AjCB.js";
4
+ import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, f as timestamptz, i as juniorAgentBindings, l as juniorUsers, s as juniorConversations } from "./agent-invocations-Qfz7dWgU.js";
5
5
  import { AsyncLocalStorage } from "node:async_hooks";
6
6
  import { sql } from "drizzle-orm";
7
7
  import { bigint, boolean, check, date, doublePrecision, foreignKey, index, integer, jsonb, pgTable, primaryKey, text, uniqueIndex, uuid } from "drizzle-orm/pg-core";
@@ -12,7 +12,7 @@ import { SpanKind } from "@opentelemetry/api";
12
12
  import pg from "pg";
13
13
  import { drizzle as drizzle$1 } from "drizzle-orm/node-postgres";
14
14
  import { migrate as migrate$1 } from "drizzle-orm/node-postgres/migrator";
15
- //#region src/db/schema/artifacts.ts
15
+ // src/db/schema/artifacts.ts
16
16
  /** Durable metadata for conversation-owned public artifacts. */
17
17
  const juniorArtifacts = pgTable("junior_artifacts", {
18
18
  /** Public identity used in `/public/artifacts/<id>.<ext>`. */
@@ -32,8 +32,7 @@ const juniorArtifacts = pgTable("junior_artifacts", {
32
32
  index("junior_artifacts_gc_idx").on(table.deleteRequestedAt, table.createdAt),
33
33
  index("junior_artifacts_conversation_idx").on(table.conversationId)
34
34
  ]);
35
- //#endregion
36
- //#region src/db/schema/attachments.ts
35
+ // src/db/schema/attachments.ts
37
36
  /** Durable metadata for files owned by one conversation. */
38
37
  const juniorAttachments = pgTable("junior_attachments", {
39
38
  id: text("id").primaryKey(),
@@ -58,8 +57,7 @@ const juniorAttachments = pgTable("junior_attachments", {
58
57
  index("junior_attachments_provider_idx").on(table.conversationId, table.provider, table.providerId),
59
58
  index("junior_attachments_gc_idx").on(table.storageProvider, table.deleteRequestedAt, table.createdAt)
60
59
  ]);
61
- //#endregion
62
- //#region src/db/schema/code.ts
60
+ // src/db/schema/code.ts
63
61
  /** Repository known to Junior through an installed code plugin. */
64
62
  const juniorCodeRepositories = pgTable("junior_code_repositories", {
65
63
  id: uuid("id").primaryKey(),
@@ -91,8 +89,7 @@ const juniorCodeChanges = pgTable("junior_code_changes", {
91
89
  index("junior_code_changes_closed_at_idx").on(table.closedAt),
92
90
  index("junior_code_changes_open_idx").on(table.id).where(sql`${table.state} = 'open'`)
93
91
  ]);
94
- //#endregion
95
- //#region src/db/schema/conversation-annotations.ts
92
+ // src/db/schema/conversation-annotations.ts
96
93
  const juniorConversationAnnotations = pgTable("junior_conversation_annotations", {
97
94
  conversationId: text("conversation_id").notNull(),
98
95
  plugin: text("plugin").notNull(),
@@ -114,8 +111,7 @@ const juniorConversationAnnotations = pgTable("junior_conversation_annotations",
114
111
  columns: [table.conversationId],
115
112
  foreignColumns: [juniorConversations.conversationId]
116
113
  }).onDelete("cascade")]);
117
- //#endregion
118
- //#region src/db/schema/api-tokens.ts
114
+ // src/db/schema/api-tokens.ts
119
115
  const juniorApiTokens = pgTable("junior_api_tokens", {
120
116
  id: text("id").primaryKey(),
121
117
  ownerEmailNormalized: text("owner_email_normalized").notNull(),
@@ -127,8 +123,7 @@ const juniorApiTokens = pgTable("junior_api_tokens", {
127
123
  lastUsedAt: timestamptz("last_used_at"),
128
124
  revokedAt: timestamptz("revoked_at")
129
125
  }, (table) => [uniqueIndex("junior_api_tokens_token_hash_uidx").on(table.tokenHash), index("junior_api_tokens_owner_email_idx").on(table.ownerEmailNormalized)]);
130
- //#endregion
131
- //#region src/db/schema/conversation-events.ts
126
+ // src/db/schema/conversation-events.ts
132
127
  /**
133
128
  * Append-only canonical conversation history. `history_version` partitions
134
129
  * model-history replacements, while `(conversation_id, seq)` is the stable
@@ -163,8 +158,7 @@ const juniorConversationEvents = pgTable("junior_conversation_events", {
163
158
  index("junior_conversation_events_message_search_idx").using("gin", sql`to_tsvector('english', ${table.payload}->>'text')`).where(sql`${table.type} = 'message'`),
164
159
  uniqueIndex("junior_conversation_events_idempotency_idx").on(table.conversationId, table.idempotencyKey)
165
160
  ]);
166
- //#endregion
167
- //#region src/db/schema/conversation-metrics.ts
161
+ // src/db/schema/conversation-metrics.ts
168
162
  const CONVERSATION_METRICS = [
169
163
  "duration_ms",
170
164
  "total_tokens",
@@ -199,8 +193,7 @@ const juniorConversationMetrics = pgTable("junior_conversation_metrics", {
199
193
  }),
200
194
  index("junior_conversation_metrics_occurred_at_metric_idx").on(table.occurredAt, table.metric)
201
195
  ]);
202
- //#endregion
203
- //#region src/db/schema/conversation-briefs.ts
196
+ // src/db/schema/conversation-briefs.ts
204
197
  /** Append-only Brief versions produced for completed Conversation turns. */
205
198
  const juniorConversationBriefs = pgTable("junior_conversation_briefs", {
206
199
  conversationId: text("conversation_id").notNull(),
@@ -226,8 +219,7 @@ const juniorConversationBriefs = pgTable("junior_conversation_briefs", {
226
219
  index("junior_conversation_briefs_conversation_version_idx").on(table.conversationId, table.version.desc()),
227
220
  index("junior_conversation_briefs_search_idx").using("gin", sql`to_tsvector('english', ${table.searchText})`)
228
221
  ]);
229
- //#endregion
230
- //#region src/db/schema/conversation-bindings.ts
222
+ // src/db/schema/conversation-bindings.ts
231
223
  /** Provider conversation coordinates bound to Junior's opaque durable conversation id. */
232
224
  const juniorConversationBindings = pgTable("junior_conversation_bindings", {
233
225
  conversationId: text("conversation_id").notNull().references(() => juniorConversations.conversationId),
@@ -245,8 +237,7 @@ const juniorConversationBindings = pgTable("junior_conversation_bindings", {
245
237
  table.providerConversationId
246
238
  ]
247
239
  }), index("junior_conversation_bindings_conversation_idx").on(table.conversationId)]);
248
- //#endregion
249
- //#region src/db/schema/conversation-participants.ts
240
+ // src/db/schema/conversation-participants.ts
250
241
  /**
251
242
  * Materialized personal-feed membership for one linked user on one root
252
243
  * conversation. Rows come from the root actor and from durable human user
@@ -265,8 +256,7 @@ const juniorConversationParticipants = pgTable("junior_conversation_participants
265
256
  index("junior_conversation_participants_user_activity_idx").on(table.userId, table.lastMessageAt.desc()),
266
257
  index("junior_conversation_participants_root_idx").on(table.rootConversationId)
267
258
  ]);
268
- //#endregion
269
- //#region src/db/schema/location-configurations.ts
259
+ // src/db/schema/location-configurations.ts
270
260
  /** Durable user configuration entries scoped to provider Locations. */
271
261
  const juniorLocationConfigurations = pgTable("junior_location_configurations", {
272
262
  locationId: text("location_id").notNull().references(() => juniorDestinations.id, { onDelete: "cascade" }),
@@ -277,8 +267,7 @@ const juniorLocationConfigurations = pgTable("junior_location_configurations", {
277
267
  source: text("source"),
278
268
  expiresAt: text("expires_at")
279
269
  }, (table) => [primaryKey({ columns: [table.locationId, table.key] })]);
280
- //#endregion
281
- //#region src/db/schema/stats.ts
270
+ // src/db/schema/stats.ts
282
271
  /**
283
272
  * Daily named counters used by Junior and loaded plugins.
284
273
  * TODO: store hour keys when dashboard 24h workspace usage needs hourly bars.
@@ -299,8 +288,7 @@ const juniorStats = pgTable("junior_stats", {
299
288
  table.name
300
289
  ]
301
290
  })]);
302
- //#endregion
303
- //#region src/db/schema/automations.ts
291
+ // src/db/schema/automations.ts
304
292
  /**
305
293
  * One row per Automation of either kind. `record` holds the fields that have
306
294
  * no column. Each write also copies the nested fields that queries filter or
@@ -337,20 +325,42 @@ const juniorAutomations = pgTable("junior_automations", {
337
325
  index("junior_automations_next_run_due_idx").on(table.nextRunAtMs, table.createdAtMs, table.id).where(sql`${table.status} = 'active' AND ${table.nextRunAtMs} IS NOT NULL`),
338
326
  index("junior_automations_match_idx").on(table.namespace, table.identifier, table.createdAtMs, table.id).where(sql`${table.status} <> 'deleted'`)
339
327
  ]);
340
- //#endregion
341
- //#region src/db/schema/automation-runs.ts
328
+ // src/db/schema/automation-versions.ts
329
+ /** One saved Automation definition. Lifecycle and scheduler state are not versioned. */
330
+ const juniorAutomationVersions = pgTable("junior_automation_versions", {
331
+ automationId: text("automation_id").notNull(),
332
+ /** Starts at 1 and increases by 1 for each saved definition change. */
333
+ version: integer("version").notNull(),
334
+ createdAtMs: bigint("created_at_ms", { mode: "number" }).notNull(),
335
+ /** Slack principal that saved this definition. Null when unknown. */
336
+ editedBy: jsonb("edited_by"),
337
+ definition: jsonb("definition").notNull()
338
+ }, (table) => [primaryKey({
339
+ name: "junior_automation_versions_pk",
340
+ columns: [table.automationId, table.version]
341
+ }), foreignKey({
342
+ name: "junior_automation_versions_automation_id_fk",
343
+ columns: [table.automationId],
344
+ foreignColumns: [juniorAutomations.id]
345
+ }).onDelete("cascade")]);
346
+ // src/db/schema/automation-runs.ts
342
347
  /**
343
348
  * One dispatch of an Automation, from claim or dispatch to its outcome. A
344
349
  * Scheduled automation run id is `<automation id>:<scheduled time>`. An event
345
350
  * automation run id is its dispatch id. Automation code sets
346
351
  * `conversation_id` when it dispatches the run. A run that was skipped, or
347
352
  * that failed before dispatch, has no Conversation.
353
+ *
354
+ * `automation_version` is the Automation version that the run dispatched. It
355
+ * shows which instruction ran and who saved it after the definition changes.
356
+ * It is null before dispatch, and when no saved version matched.
348
357
  */
349
358
  const juniorAutomationRuns = pgTable("junior_automation_runs", {
350
359
  id: text("id").primaryKey(),
351
360
  automationId: text("automation_id").notNull().references(() => juniorAutomations.id, { onDelete: "cascade" }),
352
361
  conversationId: text("conversation_id").unique().references(() => juniorConversations.conversationId),
353
362
  status: text("status").$type().notNull(),
363
+ automationVersion: integer("automation_version"),
354
364
  scheduledForMs: bigint("scheduled_for_ms", { mode: "number" }),
355
365
  attempt: integer("attempt"),
356
366
  claimedAtMs: bigint("claimed_at_ms", { mode: "number" }),
@@ -360,32 +370,17 @@ const juniorAutomationRuns = pgTable("junior_automation_runs", {
360
370
  errorMessage: text("error_message"),
361
371
  resultMessageTs: text("result_message_ts")
362
372
  }, (table) => [
373
+ foreignKey({
374
+ name: "junior_automation_runs_automation_version_fk",
375
+ columns: [table.automationId, table.automationVersion],
376
+ foreignColumns: [juniorAutomationVersions.automationId, juniorAutomationVersions.version]
377
+ }),
363
378
  check("junior_automation_runs_status_check", sql`${table.status} in ('pending', 'running', 'completed', 'failed', 'blocked', 'skipped')`),
364
379
  index("junior_automation_runs_automation_idx").on(table.automationId, table.completedAtMs),
365
380
  index("junior_automation_runs_completed_idx").on(table.completedAtMs),
366
381
  index("junior_automation_runs_incomplete_idx").on(table.automationId, table.scheduledForMs).where(sql`${table.status} in ('pending', 'running')`)
367
382
  ]);
368
- //#endregion
369
- //#region src/db/schema/automation-versions.ts
370
- /** One saved Automation definition. Lifecycle and scheduler state are not versioned. */
371
- const juniorAutomationVersions = pgTable("junior_automation_versions", {
372
- automationId: text("automation_id").notNull(),
373
- /** Starts at 1 and increases by 1 for each saved definition change. */
374
- version: integer("version").notNull(),
375
- createdAtMs: bigint("created_at_ms", { mode: "number" }).notNull(),
376
- /** Slack principal that saved this definition. Null when unknown. */
377
- editedBy: jsonb("edited_by"),
378
- definition: jsonb("definition").notNull()
379
- }, (table) => [primaryKey({
380
- name: "junior_automation_versions_pk",
381
- columns: [table.automationId, table.version]
382
- }), foreignKey({
383
- name: "junior_automation_versions_automation_id_fk",
384
- columns: [table.automationId],
385
- foreignColumns: [juniorAutomations.id]
386
- }).onDelete("cascade")]);
387
- //#endregion
388
- //#region src/db/schema/workspaces.ts
383
+ // src/db/schema/workspaces.ts
389
384
  /** Named recipe used to prepare a reusable Sandbox. */
390
385
  const juniorWorkspaces = pgTable("junior_workspaces", {
391
386
  id: text("id").primaryKey(),
@@ -404,8 +399,7 @@ const juniorWorkspaceRepos = pgTable("junior_workspace_repos", {
404
399
  table.provider,
405
400
  table.repo
406
401
  ] })]);
407
- //#endregion
408
- //#region src/db/schema/snapshots.ts
402
+ // src/db/schema/snapshots.ts
409
403
  /**
410
404
  * Sandbox snapshot build and ready artifact for one Workspace recipe.
411
405
  * A ready row keeps its builder owner until the snapshot is discarded.
@@ -439,8 +433,7 @@ const juniorSnapshots = pgTable("junior_snapshots", {
439
433
  uniqueIndex("junior_snapshots_active_build_uidx").on(table.workspaceId, table.profileHash).where(sql`${table.status} = 'building'`),
440
434
  index("junior_snapshots_workspace_status_idx").on(table.workspaceId, table.status)
441
435
  ]);
442
- //#endregion
443
- //#region src/db/schema.ts
436
+ // src/db/schema.ts
444
437
  const juniorSqlSchema = {
445
438
  juniorArtifacts,
446
439
  juniorAttachments,
@@ -468,8 +461,7 @@ const juniorSqlSchema = {
468
461
  juniorWorkspaceRepos,
469
462
  juniorWorkspaces
470
463
  };
471
- //#endregion
472
- //#region src/db/tracing.ts
464
+ // src/db/tracing.ts
473
465
  const traced = Symbol("junior.db.traced");
474
466
  const MAX_QUERY_TEXT_LENGTH = 1e4;
475
467
  const MAX_QUERY_SUMMARY_LENGTH = 255;
@@ -741,14 +733,13 @@ function traceQueries(client, options) {
741
733
  });
742
734
  return client;
743
735
  }
744
- //#endregion
745
- //#region src/db/neon.ts
736
+ // src/db/neon.ts
746
737
  var NeonExecutor = class {
747
- pool;
748
- connectionString;
749
738
  transactionClient = new AsyncLocalStorage();
750
739
  savepointId = 0;
751
740
  isolatedQueryId = 0;
741
+ pool;
742
+ connectionString;
752
743
  constructor(pool, connectionString) {
753
744
  this.pool = pool;
754
745
  this.connectionString = connectionString;
@@ -865,15 +856,14 @@ function createNeonJuniorSqlExecutor(args) {
865
856
  });
866
857
  return new NeonExecutor(pool, args.connectionString);
867
858
  }
868
- //#endregion
869
- //#region src/db/postgres.ts
859
+ // src/db/postgres.ts
870
860
  const { Pool: Pool$1 } = pg;
871
861
  var PostgresExecutor = class {
872
- pool;
873
- connectionString;
874
862
  transactionClient = new AsyncLocalStorage();
875
863
  savepointId = 0;
876
864
  isolatedQueryId = 0;
865
+ pool;
866
+ connectionString;
877
867
  constructor(pool, connectionString) {
878
868
  this.pool = pool;
879
869
  this.connectionString = connectionString;
@@ -991,8 +981,7 @@ function createPostgresJuniorSqlExecutor(args) {
991
981
  });
992
982
  return new PostgresExecutor(pool, args.connectionString);
993
983
  }
994
- //#endregion
995
- //#region src/db/executor.ts
984
+ // src/db/executor.ts
996
985
  /** Create the SQL executor appropriate for the configured database URL. */
997
986
  function createJuniorSqlExecutor(args) {
998
987
  const statementTimeoutMs = args.statementTimeoutMs ?? 3e4;
@@ -1005,5 +994,4 @@ function createJuniorSqlExecutor(args) {
1005
994
  statementTimeoutMs
1006
995
  });
1007
996
  }
1008
- //#endregion
1009
- export { juniorConversationAnnotations as _, juniorAutomationVersions as a, juniorAttachments as b, juniorStats as c, juniorConversationBindings as d, juniorConversationBriefs as f, juniorApiTokens as g, juniorConversationEvents as h, juniorWorkspaces as i, juniorLocationConfigurations as l, juniorConversationMetrics as m, juniorSnapshots as n, juniorAutomationRuns as o, CONVERSATION_METRICS as p, juniorWorkspaceRepos as r, juniorAutomations as s, createJuniorSqlExecutor as t, juniorConversationParticipants as u, juniorCodeChanges as v, juniorArtifacts as x, juniorCodeRepositories as y };
997
+ export { juniorConversationAnnotations as _, juniorAutomationRuns as a, juniorAttachments as b, juniorStats as c, juniorConversationBindings as d, juniorConversationBriefs as f, juniorApiTokens as g, juniorConversationEvents as h, juniorWorkspaces as i, juniorLocationConfigurations as l, juniorConversationMetrics as m, juniorSnapshots as n, juniorAutomationVersions as o, CONVERSATION_METRICS as p, juniorWorkspaceRepos as r, juniorAutomations as s, createJuniorSqlExecutor as t, juniorConversationParticipants as u, juniorCodeChanges as v, juniorArtifacts as x, juniorCodeRepositories as y };
@@ -1,5 +1,5 @@
1
- import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- //#region src/chat/experimental.ts
1
+ import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
+ // src/chat/experimental.ts
3
3
  var experimental_exports = /* @__PURE__ */ __exportAll({
4
4
  EXPERIMENTAL_FEATURES: () => EXPERIMENTAL_FEATURES,
5
5
  getExperimentalFeatures: () => getExperimentalFeatures,
@@ -46,5 +46,4 @@ function getExperimentalFeatures() {
46
46
  function isExperimentalFeatureEnabled(feature) {
47
47
  return configuredExperimental[feature] === true;
48
48
  }
49
- //#endregion
50
49
  export { setExperimentalFeatures as i, getExperimentalFeatures as n, isExperimentalFeatureEnabled as r, experimental_exports as t };
@@ -1,7 +1,7 @@
1
- import { l as TURN_REASONING_LEVELS, s as modelProfileSchema } from "./model-profile-BwU8mqwD.js";
1
+ import { l as TURN_REASONING_LEVELS, s as modelProfileSchema } from "./model-profile-Bg8EoCKD.js";
2
2
  import { z } from "zod";
3
3
  import { actorSchema } from "@sentry/junior-plugin-api";
4
- //#region src/usage-schema.ts
4
+ // src/usage-schema.ts
5
5
  const usageCostSchema = z.object({
6
6
  input: z.number().finite().nonnegative().optional(),
7
7
  output: z.number().finite().nonnegative().optional(),
@@ -18,8 +18,7 @@ const usageSchema = z.object({
18
18
  totalTokens: z.number().int().nonnegative().optional(),
19
19
  cost: usageCostSchema.optional()
20
20
  }).strict();
21
- //#endregion
22
- //#region src/chat/conversations/provenance.ts
21
+ // src/chat/conversations/provenance.ts
23
22
  /**
24
23
  * Durable message attribution shared by storage and projections.
25
24
  * Attribution never grants credential authority.
@@ -69,8 +68,7 @@ function instructionActors(provenance) {
69
68
  }
70
69
  return actors;
71
70
  }
72
- //#endregion
73
- //#region src/chat/conversations/history-payload.ts
71
+ // src/chat/conversations/history-payload.ts
74
72
  const messageFieldsSchema = z.record(z.string(), z.unknown());
75
73
  const replacementEntrySchema = z.object({ item: z.string() }).passthrough();
76
74
  /** Identify history events that store message fields as JSON strings. */
@@ -121,8 +119,7 @@ function decodeHistoryPayload(type, payload) {
121
119
  if (fields.provenance !== void 0) message.provenance = fields.provenance;
122
120
  return message;
123
121
  }
124
- //#endregion
125
- //#region src/chat/conversations/history.ts
122
+ // src/chat/conversations/history.ts
126
123
  /**
127
124
  * Durable conversation event history port.
128
125
  *
@@ -524,5 +521,4 @@ const newConversationEventSchema = z.object({
524
521
  idempotencyKey: z.string().min(1).optional(),
525
522
  createdAtMs: z.number().finite()
526
523
  }).strict();
527
- //#endregion
528
524
  export { conversationTurnFailureReasonSchema as a, newConversationEventSchema as c, contextProvenance as d, instructionActors as f, usageSchema as h, conversationTurnFailureCodeSchema as i, encodeHistoryPayload as l, sameActorIdentity as m, agentHistoryItemSchema as n, decodeStoredConversationEvent as o, instructionProvenanceFor as p, conversationEventDataSchema as r, historyReplacementSchema as s, KNOWN_CONVERSATION_EVENT_TYPES as t, agentInstructionProvenance as u };
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import { ConversationAnnotation, OwnedObjectAnnotation } from "@sentry/junior-plugin-api";
3
- //#region src/chat/attachments/input.d.ts
4
3
  /** Bound JSON image input below the hosting platform's request size limit. */
5
4
  declare const MAX_INPUT_IMAGE_BYTES: number;
6
5
  declare const MAX_INPUT_IMAGES = 3;
@@ -8,9 +7,9 @@ declare const MAX_INPUT_IMAGES = 3;
8
7
  declare const inputImageSchema: z.ZodObject<{
9
8
  filename: z.ZodString;
10
9
  contentType: z.ZodEnum<{
11
- "image/png": "image/png";
12
- "image/jpeg": "image/jpeg";
13
10
  "image/gif": "image/gif";
11
+ "image/jpeg": "image/jpeg";
12
+ "image/png": "image/png";
14
13
  "image/webp": "image/webp";
15
14
  }>;
16
15
  data: z.ZodString;
@@ -24,8 +23,6 @@ declare const messageAttachmentSchema: z.ZodObject<{
24
23
  bytes: z.ZodNumber;
25
24
  }, z.core.$strict>;
26
25
  type MessageAttachment = z.output<typeof messageAttachmentSchema>;
27
- //#endregion
28
- //#region src/chat/automations/card.d.ts
29
26
  /** Saved automation facts shown with a Message, not a live status view. */
30
27
  declare const automationCardSchema: z.ZodObject<{
31
28
  kind: z.ZodLiteral<"automation">;
@@ -37,8 +34,6 @@ declare const automationCardSchema: z.ZodObject<{
37
34
  warning: z.ZodNullable<z.ZodString>;
38
35
  }, z.core.$strict>;
39
36
  type AutomationCard = z.output<typeof automationCardSchema>;
40
- //#endregion
41
- //#region src/chat/conversations/cards.d.ts
42
37
  /** Facts for delivery and display. Messages store only references. */
43
38
  type MessageCard = OwnedObjectAnnotation | AutomationCard;
44
39
  /** Render each built-in card with its own text format. */
@@ -52,8 +47,6 @@ declare const messageCardRefSchema: z.ZodObject<{
52
47
  type MessageCardRef = z.output<typeof messageCardRefSchema>;
53
48
  /** Resolve current saved facts without fetching providers or changing history. */
54
49
  declare function resolveMessageCards(refs: readonly MessageCardRef[], annotations: readonly ConversationAnnotation[]): OwnedObjectAnnotation[];
55
- //#endregion
56
- //#region src/chat/conversations/history.d.ts
57
50
  /** Where a failed turn stopped. */
58
51
  declare const conversationTurnFailureCodeSchema: z.ZodEnum<{
59
52
  agent_run_failed: "agent_run_failed";
@@ -66,21 +59,20 @@ declare const conversationTurnFailureCodeSchema: z.ZodEnum<{
66
59
  * Values are fixed labels only. Do not store raw exception text.
67
60
  */
68
61
  declare const conversationTurnFailureReasonSchema: z.ZodEnum<{
69
- unknown: "unknown";
70
- capacity: "capacity";
71
62
  auth: "auth";
72
- permission: "permission";
73
- rate_limit: "rate_limit";
74
- timeout: "timeout";
75
- network: "network";
76
- server: "server";
63
+ capacity: "capacity";
64
+ content_policy: "content_policy";
65
+ empty_output: "empty_output";
77
66
  invalid_request: "invalid_request";
78
67
  invalid_response: "invalid_response";
68
+ network: "network";
69
+ permission: "permission";
79
70
  quota: "quota";
80
- content_policy: "content_policy";
81
- empty_output: "empty_output";
82
- tool_errors: "tool_errors";
71
+ rate_limit: "rate_limit";
72
+ server: "server";
83
73
  suppressed_output: "suppressed_output";
74
+ timeout: "timeout";
75
+ tool_errors: "tool_errors";
76
+ unknown: "unknown";
84
77
  }>;
85
- //#endregion
86
78
  export { resolveMessageCards as a, MAX_INPUT_IMAGES as c, messageCardText as i, MAX_INPUT_IMAGE_BYTES as l, conversationTurnFailureReasonSchema as n, AutomationCard as o, MessageCard as r, InputImage as s, conversationTurnFailureCodeSchema as t, MessageAttachment as u };
@@ -1,8 +1,8 @@
1
- import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { D as storeAttachment, T as readLiveAttachment } from "./agent-runner-C6_cd61V.js";
3
- import { f as getSqlExecutor } from "./viewer-C-9nFKYr.js";
4
- import { L as detectImageMediaType } from "./conversation-T18Xlkx9.js";
5
- //#region src/chat/attachments/images.ts
1
+ import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
+ import { D as storeAttachment, T as readLiveAttachment } from "./agent-runner-DGsFQw72.js";
3
+ import { f as getSqlExecutor } from "./viewer-CGvvRqKp.js";
4
+ import { L as detectImageMediaType } from "./conversation-DjN3mlog.js";
5
+ // src/chat/attachments/images.ts
6
6
  var images_exports = /* @__PURE__ */ __exportAll({
7
7
  decodeInputImages: () => decodeInputImages,
8
8
  loadInputImages: () => loadInputImages,
@@ -61,5 +61,4 @@ async function loadInputImages(args) {
61
61
  };
62
62
  }));
63
63
  }
64
- //#endregion
65
64
  export { images_exports as n, storeInputImages as r, decodeInputImages as t };
@@ -1,4 +1,2 @@
1
- //#region src/instrumentation.d.ts
2
1
  /** Initialize Sentry for the Junior runtime. Call at the top of your entry point. */
3
- export declare function initSentry(): void;
4
- //#endregion
2
+ export declare function initSentry(): void;
@@ -1,8 +1,8 @@
1
- import { N as getDeploymentServiceVersion, P as getDeploymentTelemetryAttributes } from "./logging-tPQeUe2i.js";
2
- import { _ as vercelAIIntegration, a as getClient, b as withStreamedSpan, c as init, o as getGlobalScope } from "./sentry-CgWZM_kV.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-CpSYOWnP.js";
4
- import { t as consumePrivateTraceResultMarker } from "./private-trace-result-BLvBjy_e.js";
5
- //#region src/chat/sentry-payload-filter.ts
1
+ import { F as getDeploymentTelemetryAttributes, P as getDeploymentServiceVersion } from "./logging-DsHONhVm.js";
2
+ import { _ as vercelAIIntegration, a as getClient, b as withStreamedSpan, c as init, o as getGlobalScope } from "./sentry-BBUlHih9.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-DHP_xnVj.js";
4
+ import { t as consumePrivateTraceResultMarker } from "./private-trace-result-CE7_lEdq.js";
5
+ // src/chat/sentry-payload-filter.ts
6
6
  const PAYLOAD_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
7
7
  "app.message.input",
8
8
  "app.message.output",
@@ -106,8 +106,7 @@ function scrubPrivateSentryLog(log) {
106
106
  scrubContainer(log);
107
107
  return log;
108
108
  }
109
- //#endregion
110
- //#region src/instrumentation.ts
109
+ // src/instrumentation.ts
111
110
  function getSampleRate(value, fallback) {
112
111
  if (!value) return fallback;
113
112
  const parsed = Number(value);
@@ -160,5 +159,4 @@ function initSentry() {
160
159
  });
161
160
  getGlobalScope().setAttributes(deploymentSpanAttributes);
162
161
  }
163
- //#endregion
164
162
  export { initSentry };
@@ -1,4 +1,4 @@
1
- import { i as getChatConfig } from "./config-DdBiDanf.js";
1
+ import { i as getChatConfig } from "./config-_WO_AjCB.js";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  import { z } from "zod";
4
4
  import { createHash, createHmac, timingSafeEqual } from "node:crypto";
@@ -22,8 +22,7 @@ var ConversationQueueMessageRejectedError = class extends Error {
22
22
  function isConversationQueueMessageRejectedError(error) {
23
23
  return error instanceof ConversationQueueMessageRejectedError;
24
24
  }
25
- //#endregion
26
- //#region src/chat/runtime/request-deadline.ts
25
+ // src/chat/runtime/request-deadline.ts
27
26
  const requestDeadlineStorage = new AsyncLocalStorage();
28
27
  function createTurnRequestDeadline(startedAtMs) {
29
28
  return {
@@ -40,8 +39,7 @@ function runWithTurnRequestDeadline(callback, startedAtMs = Date.now()) {
40
39
  if (requestDeadlineStorage.getStore()) return callback();
41
40
  return requestDeadlineStorage.run(createTurnRequestDeadline(startedAtMs), callback);
42
41
  }
43
- //#endregion
44
- //#region src/chat/vercel-queue-client.ts
42
+ // src/chat/vercel-queue-client.ts
45
43
  function defaultQueueClientOptions() {
46
44
  if (process.env.VERCEL_DEPLOYMENT_ID?.trim()) return {};
47
45
  return { deploymentId: null };
@@ -50,8 +48,7 @@ function defaultQueueClientOptions() {
50
48
  function createVercelQueueClient() {
51
49
  return new QueueClient(defaultQueueClientOptions());
52
50
  }
53
- //#endregion
54
- //#region src/chat/queue/sign.ts
51
+ // src/chat/queue/sign.ts
55
52
  /** Sign and check queue messages before public callbacks run them. */
56
53
  const QUEUE_SIGNATURE_MAX_AGE_MS = 36e5;
57
54
  function secret() {
@@ -137,8 +134,7 @@ function verifyQueueMessage(config, value, nowMs = Date.now()) {
137
134
  message: message.data
138
135
  };
139
136
  }
140
- //#endregion
141
- //#region src/chat/task-execution/queue-signing.ts
137
+ // src/chat/task-execution/queue-signing.ts
142
138
  const conversationQueueSign = {
143
139
  context: "junior.conversation_work_queue.v2",
144
140
  schema: conversationQueueMessageSchema,
@@ -183,8 +179,7 @@ function getVercelConversationWorkQueue() {
183
179
  defaultQueue ??= createVercelConversationWorkQueue();
184
180
  return defaultQueue;
185
181
  }
186
- //#endregion
187
- //#region src/chat/sandbox/snapshot/job-queue.ts
182
+ // src/chat/sandbox/snapshot/job-queue.ts
188
183
  /** Send Workspace snapshot build messages. */
189
184
  const SIGNATURE_CONTEXT = "junior.workspace_snapshot_queue.v1";
190
185
  const SIGNATURE_VERSION = "v1";
@@ -222,5 +217,4 @@ async function sendWorkspaceSnapshotJob(message) {
222
217
  async function sendNextWorkspaceSnapshotJob(message) {
223
218
  await send(message);
224
219
  }
225
- //#endregion
226
220
  export { getVercelConversationWorkQueue as a, QUEUE_SIGNATURE_MAX_AGE_MS as c, createVercelQueueClient as d, getTurnRequestDeadline as f, isConversationQueueMessageRejectedError as g, conversationQueueMessageSchema as h, verifyWorkspaceSnapshotJobMessage as i, signQueueMessage as l, ConversationQueueMessageRejectedError as m, sendNextWorkspaceSnapshotJob as n, resolveConversationWorkQueueTopic as o, runWithTurnRequestDeadline as p, sendWorkspaceSnapshotJob as r, verifyConversationQueueMessage as s, WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC as t, verifyQueueMessage as u };