@sentry/junior 0.278.0 → 0.280.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 (90) hide show
  1. package/dist/{actor-B4DYygOB.js → actor-6jsm_v96.js} +1 -1
  2. package/dist/{adapter-BXosqTMx.js → adapter-DVN3iwf9.js} +1 -1
  3. package/dist/{admin-Thn7NfOi.js → admin-Q_UI--9W.js} +1 -1
  4. package/dist/{agent-runner-DE-43MPb.js → agent-runner-_PYLv4Qo.js} +79 -39
  5. package/dist/api/schema.d.ts +2 -2
  6. package/dist/api/schema.js +7 -7
  7. package/dist/api.d.ts +3 -3
  8. package/dist/api.js +184 -418
  9. package/dist/{app-CHNS-AX2.d.ts → app-CL2zzzE0.d.ts} +5 -5
  10. package/dist/app.d.ts +1 -1
  11. package/dist/app.js +462 -80
  12. package/dist/{assistant-reply-pauL6qyn.js → assistant-reply-DbebsAxi.js} +1 -1
  13. package/dist/{automation-DphoTRYl.js → automation-CPqRFjIa.js} +2 -2
  14. package/dist/{background-compaction-queue-CAL4A2y7.js → background-compaction-queue-B9lmh8Ml.js} +3 -3
  15. package/dist/{briefs-4fyPJJEu.js → briefs-Dej7V0Bz.js} +11 -10
  16. package/dist/{catalog-runtime-BoOb5oUv.js → catalog-runtime-DpN0sWQ6.js} +2 -2
  17. package/dist/cli/chat.js +16 -16
  18. package/dist/cli/check.js +3 -3
  19. package/dist/cli/main.js +4 -4
  20. package/dist/cli/plugins.js +5 -5
  21. package/dist/cli/snapshot-create.js +4 -4
  22. package/dist/cli/upgrade.d.ts +1 -1
  23. package/dist/cli/upgrade.js +4 -4
  24. package/dist/{client-v_OVYuHZ.js → client-h2A2ZPzY.js} +7 -3
  25. package/dist/{config-o2jLRY5J.js → config-CusBFORe.js} +3 -3
  26. package/dist/{connections-RC4NXAx8.js → connections-C4h6mGha.js} +11 -11
  27. package/dist/{conversation-CZfyQvdm.js → conversation-DExTZw8B.js} +22 -7
  28. package/dist/conversation-pending-messages-Dgz6hrJs.js +173 -0
  29. package/dist/{conversation-privacy-C23M8KaD.js → conversation-privacy-2cm6OpNg.js} +1 -1
  30. package/dist/{credential-sync-Dd0WyNfF.js → credential-sync-DK06Jgt-.js} +17 -17
  31. package/dist/{db-BjLzDJCt.d.ts → db-Dsvk1Tp1.d.ts} +2 -2
  32. package/dist/{executor-CJfsD0VX.js → executor-Cmr0J8W3.js} +152 -7
  33. package/dist/instrumentation.d.ts +12 -0
  34. package/dist/instrumentation.js +56 -23
  35. package/dist/{logging-dFaXvBRK.js → logging-CGnh65_X.js} +2 -2
  36. package/dist/{media-DTAA8Qs_.js → media-Dq9_svfQ.js} +1 -1
  37. package/dist/{message-DSwxIZet.js → message-RpAnqHPY.js} +10 -10
  38. package/dist/nitro.d.ts +1 -1
  39. package/dist/nitro.js +18 -6
  40. package/dist/{oauth-callback-server-CDcuCp27.js → oauth-callback-server-BBnhVKuX.js} +2 -2
  41. package/dist/{oauth-relay-C6ZAyJgf.js → oauth-relay-D6xxVywK.js} +2 -2
  42. package/dist/{package-discovery-DJBompdd.js → package-discovery-DJhGdS4c.js} +1 -1
  43. package/dist/{plugins-DOm9Y6qI.js → plugins-HYh_JOdw.js} +1 -1
  44. package/dist/{projection-BTge9wrH.js → projection-C1MghKyI.js} +257 -137
  45. package/dist/{prompt-DDtCnlHP.js → prompt-BcHg-BMy.js} +2 -2
  46. package/dist/proxy-path-BHYoKZdq.js +15 -0
  47. package/dist/{queue-C37RbDVc.d.ts → queue-CZyYgPF0.d.ts} +1 -1
  48. package/dist/{registry-Cp6CNmtP.js → registry-DR7DjX9H.js} +4 -4
  49. package/dist/{reporting-window-DgHgwQB3.js → reporting-window-B-QP9zX1.js} +28 -2
  50. package/dist/{resolve-B_7h2cXx.js → resolve-0Ful4oDv.js} +4 -4
  51. package/dist/{result-5LBEfnLX.js → result-Dd9kCuQ-.js} +12 -12
  52. package/dist/{runner-C5-S4oq-.js → runner-yiY8gUUu.js} +11 -11
  53. package/dist/{sandbox-egress-signals-B4GehT1L.js → sandbox-egress-signals-BzQVHCMz.js} +1 -1
  54. package/dist/{schema-Tr484cCC.d.ts → schema-BkMmF552.d.ts} +1232 -222
  55. package/dist/{schema-B5fpczDw.js → schema-C5pEgfHc.js} +30 -70
  56. package/dist/sentry-BRTJqumy.js +51 -0
  57. package/dist/sentry-DrKC2NeM.d.ts +1 -0
  58. package/dist/sentry-route-name-BhwWnfqj.js +51 -0
  59. package/dist/{service-account-Cq_dLrZJ.js → service-account-Cu7HFLZQ.js} +3 -3
  60. package/dist/{service-account-BkEv20zf.js → service-account-PIMpWZHF.js} +3 -3
  61. package/dist/{session-stop-BsS4qFS2.js → session-stop-CDEMsNtv.js} +14 -15
  62. package/dist/{skills-M0BA0_s6.js → skills-B2xIoe0f.js} +5 -5
  63. package/dist/{spawn-BO3y7H4d.js → spawn-C0DySQRV.js} +3 -3
  64. package/dist/{stop-D5R82Wla.js → stop-Dj5-nrAo.js} +740 -285
  65. package/dist/{store-BGBzQWNf.js → store-Dlio-o6u.js} +6 -6
  66. package/dist/{store-CGJZTEVz.js → store-QzOfDwKA.js} +3 -3
  67. package/dist/{task-queue-UD27ei2U.js → task-queue-Cp1V_XW3.js} +4 -4
  68. package/dist/{task-runner-noxjOjkM.js → task-runner-CQkkUj3o.js} +23 -11
  69. package/dist/{thread-state-BSu6rM6p.js → thread-state-Bn87cfzE.js} +4 -4
  70. package/dist/{turn-failure-response-wahwyPrZ.js → turn-failure-response-CQebxByj.js} +8 -8
  71. package/dist/{turn-lifecycle-Bo4Trccw.js → turn-lifecycle-CJJsOhXB.js} +1 -1
  72. package/dist/{turn-session-routing-DnSaaEpn.js → turn-session-routing-bmG330Cf.js} +10 -11
  73. package/dist/{validation-B9-8iKyw.js → validation-D1wcf7hp.js} +2 -2
  74. package/dist/{version-C7HejFP2.js → version-BeHSXUK6.js} +1 -1
  75. package/dist/version.js +1 -1
  76. package/dist/{viewer-DLXajQZE.js → viewer-BZ0Hp5Nb.js} +6 -7
  77. package/dist/{work-DRGSlfia.js → work-BTcCIbWu.js} +12 -12
  78. package/dist/{worker-BGh5Dwc6.js → worker-D3fDK6zc.js} +7 -7
  79. package/migrations/0077_drop_agent_invocation_model_profile.sql +1 -0
  80. package/migrations/0078_plugin_conversation_index.sql +20 -0
  81. package/migrations/0079_conversation_event_author_index.sql +20 -0
  82. package/migrations/meta/0077_snapshot.json +4141 -0
  83. package/migrations/meta/0078_snapshot.json +4175 -0
  84. package/migrations/meta/0079_snapshot.json +4203 -0
  85. package/migrations/meta/_journal.json +21 -0
  86. package/package.json +4 -4
  87. package/dist/agent-invocations-D7c4BQGc.js +0 -182
  88. package/dist/common-Eu6sx09c.js +0 -107
  89. package/dist/rolldown-runtime-nwUcYXjP.js +0 -27
  90. package/dist/sentry-MDkYAVPV.js +0 -23
@@ -1,15 +1,16 @@
1
- import "./config-o2jLRY5J.js";
2
- import { p as logException } from "./logging-dFaXvBRK.js";
3
- 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-D7c4BQGc.js";
1
+ import "./config-CusBFORe.js";
2
+ import { p as logException } from "./logging-CGnh65_X.js";
4
3
  import { AsyncLocalStorage } from "node:async_hooks";
5
- import { sql } from "drizzle-orm";
6
- import { bigint, boolean, check, date, doublePrecision, foreignKey, index, integer, jsonb, pgTable, primaryKey, text, uniqueIndex, uuid } from "drizzle-orm/pg-core";
4
+ import { getTableColumns, sql } from "drizzle-orm";
5
+ import { bigint, boolean, check, date, doublePrecision, foreignKey, index, integer, jsonb, pgTable, primaryKey, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
7
6
  import { Pool } from "@neondatabase/serverless";
8
7
  import { drizzle } from "drizzle-orm/neon-serverless";
9
8
  import { migrate } from "drizzle-orm/neon-serverless/migrator";
10
9
  import pg from "pg";
11
10
  import { drizzle as drizzle$1 } from "drizzle-orm/node-postgres";
12
11
  import { migrate as migrate$1 } from "drizzle-orm/node-postgres/migrator";
12
+ // src/db/schema/timestamps.ts
13
+ const timestamptz = (name) => timestamp(name, { withTimezone: true });
13
14
  // src/db/schema/artifacts.ts
14
15
  /** Durable metadata for conversation-owned public artifacts. */
15
16
  const juniorArtifacts = pgTable("junior_artifacts", {
@@ -30,6 +31,114 @@ const juniorArtifacts = pgTable("junior_artifacts", {
30
31
  index("junior_artifacts_gc_idx").on(table.deleteRequestedAt, table.createdAt),
31
32
  index("junior_artifacts_conversation_idx").on(table.conversationId)
32
33
  ]);
34
+ // src/db/schema/destinations.ts
35
+ const juniorDestinations = pgTable("junior_destinations", {
36
+ id: text("id").primaryKey(),
37
+ provider: text("provider").notNull(),
38
+ providerTenantId: text("provider_tenant_id").notNull().default(""),
39
+ providerDestinationId: text("provider_destination_id").notNull(),
40
+ kind: text("kind").$type().notNull(),
41
+ parentDestinationId: text("parent_destination_id"),
42
+ displayName: text("display_name"),
43
+ visibility: text("visibility").$type().notNull().default("unknown"),
44
+ metadata: jsonb("metadata_json"),
45
+ createdAt: timestamptz("created_at").notNull(),
46
+ updatedAt: timestamptz("updated_at").notNull()
47
+ }, (table) => [uniqueIndex("junior_destinations_provider_destination_uidx").on(table.provider, table.providerTenantId, table.providerDestinationId), index("junior_destinations_provider_kind_idx").on(table.provider, table.kind)]);
48
+ const juniorUsers = pgTable("junior_users", {
49
+ id: text("id").primaryKey(),
50
+ primaryEmail: text("primary_email").notNull(),
51
+ primaryEmailNormalized: text("primary_email_normalized").notNull(),
52
+ displayName: text("display_name"),
53
+ timezone: text("timezone"),
54
+ /** Text the user saved to change how Junior replies to them. */
55
+ customization: text("customization"),
56
+ /** Junior-wide admin role. Only the `junior admin` CLI changes it. */
57
+ isAdmin: boolean("is_admin").notNull().default(false),
58
+ /** Auto-archive this user's conversations when their work is done. */
59
+ autoArchiveDefault: boolean("auto_archive_default").notNull().default(false),
60
+ /** Hours done work and the conversation stay quiet before auto-archive. */
61
+ autoArchiveGraceHours: integer("auto_archive_grace_hours").notNull().default(24),
62
+ createdAt: timestamptz("created_at").notNull(),
63
+ updatedAt: timestamptz("updated_at").notNull()
64
+ }, (table) => [uniqueIndex("junior_users_primary_email_normalized_uidx").on(table.primaryEmailNormalized)]);
65
+ // src/db/schema/identities.ts
66
+ const juniorIdentities = pgTable("junior_identities", {
67
+ id: text("id").primaryKey(),
68
+ kind: text("kind").$type().notNull(),
69
+ provider: text("provider").notNull(),
70
+ providerTenantId: text("provider_tenant_id").notNull().default(""),
71
+ providerSubjectId: text("provider_subject_id").notNull(),
72
+ displayName: text("display_name"),
73
+ handle: text("handle"),
74
+ email: text("email"),
75
+ avatarUrl: text("avatar_url"),
76
+ metadata: jsonb("metadata_json"),
77
+ createdAt: timestamptz("created_at").notNull(),
78
+ updatedAt: timestamptz("updated_at").notNull(),
79
+ userId: text("user_id").references(() => juniorUsers.id),
80
+ emailNormalized: text("email_normalized"),
81
+ emailVerified: boolean("email_verified").notNull().default(false),
82
+ signedInAt: timestamptz("signed_in_at")
83
+ }, (table) => [
84
+ uniqueIndex("junior_identities_provider_subject_uidx").on(table.provider, table.providerTenantId, table.providerSubjectId),
85
+ index("junior_identities_user_idx").on(table.userId),
86
+ index("junior_identities_verified_email_idx").on(table.emailNormalized).where(sql`${table.emailVerified} = true AND ${table.emailNormalized} IS NOT NULL`),
87
+ index("junior_identities_kind_provider_idx").on(table.kind, table.provider)
88
+ ]);
89
+ // src/db/schema/conversations.ts
90
+ const juniorConversations = pgTable("junior_conversations", {
91
+ conversationId: text("conversation_id").primaryKey(),
92
+ schemaVersion: integer("schema_version").notNull().default(1),
93
+ source: text("source").$type(),
94
+ /** Structured session Source locator; set-once on the conversation root. */
95
+ sessionSource: jsonb("source_json").$type(),
96
+ /** Complete Location associated with this Conversation. */
97
+ location: jsonb("location_json").$type(),
98
+ destinationId: text("destination_id").references(() => juniorDestinations.id),
99
+ destination: jsonb("destination_json").$type(),
100
+ actorIdentityId: text("actor_identity_id").references(() => juniorIdentities.id),
101
+ creatorIdentityId: text("creator_identity_id").references(() => juniorIdentities.id),
102
+ credentialSubjectIdentityId: text("credential_subject_identity_id").references(() => juniorIdentities.id),
103
+ actor: jsonb("actor_json").$type(),
104
+ channelName: text("channel_name"),
105
+ title: text("title"),
106
+ createdAt: timestamptz("created_at").notNull(),
107
+ lastActivityAt: timestamptz("last_activity_at").notNull(),
108
+ updatedAt: timestamptz("updated_at").notNull(),
109
+ executionUpdatedAt: timestamptz("execution_updated_at"),
110
+ executionStatus: text("execution_status").$type().notNull(),
111
+ runId: text("run_id"),
112
+ lastCheckpointAt: timestamptz("last_checkpoint_at"),
113
+ lastEnqueuedAt: timestamptz("last_enqueued_at"),
114
+ parentConversationId: text("parent_conversation_id").references(() => juniorConversations.conversationId),
115
+ forkedFromConversationId: text("forked_from_conversation_id").references(() => juniorConversations.conversationId, { onDelete: "set null" }),
116
+ quickQuestionAt: timestamptz("quick_question_at"),
117
+ rootConversationId: text("root_conversation_id").references(() => juniorConversations.conversationId),
118
+ transcriptPurgedAt: timestamptz("transcript_purged_at"),
119
+ /** Latest session stop. Automated input received before it is dropped. */
120
+ stoppedAt: timestamptz("stopped_at"),
121
+ durationMs: integer("duration_ms").notNull().default(0),
122
+ usage: jsonb("usage_json").$type(),
123
+ executionDurationMs: integer("execution_duration_ms").notNull().default(0),
124
+ executionUsage: jsonb("execution_usage_json").$type(),
125
+ metricRunId: text("metric_run_id"),
126
+ detailVersion: integer("detail_version").notNull().default(0),
127
+ legacyArchivedAt: timestamptz("archived_at")
128
+ }, (table) => [
129
+ index("junior_conversations_last_activity_idx").on(table.lastActivityAt.desc(), table.conversationId),
130
+ index("junior_conversations_active_idx").using("btree", sql`coalesce(${table.executionUpdatedAt}, ${table.updatedAt})`, table.conversationId).where(sql`${table.executionStatus} <> 'idle'`),
131
+ index("junior_conversations_destination_activity_idx").on(table.destinationId, table.lastActivityAt.desc()),
132
+ index("junior_conversations_actor_activity_idx").on(table.actorIdentityId, table.lastActivityAt.desc()),
133
+ index("junior_conversations_parent_idx").on(table.parentConversationId),
134
+ index("junior_conversations_forked_from_idx").on(table.forkedFromConversationId),
135
+ index("junior_conversations_root_idx").on(table.rootConversationId)
136
+ ]);
137
+ /** Select runtime conversation fields without reading the legacy archive column. */
138
+ function conversationReadColumns() {
139
+ const { legacyArchivedAt, ...columns } = getTableColumns(juniorConversations);
140
+ return columns;
141
+ }
33
142
  // src/db/schema/attachments.ts
34
143
  /** Durable metadata for files owned by one conversation. */
35
144
  const juniorAttachments = pgTable("junior_attachments", {
@@ -153,7 +262,9 @@ const juniorConversationEvents = pgTable("junior_conversation_events", {
153
262
  index("junior_conversation_events_history_version_idx").on(table.conversationId, table.historyVersion, table.seq),
154
263
  index("junior_conversation_events_type_idx").on(table.conversationId, table.type, table.seq),
155
264
  index("junior_conversation_events_plugin_report_idx").on(sql`(${table.payload}->>'namespace')`, sql`(${table.payload}->>'name')`, table.createdAt).where(sql`${table.type} = 'structured_event'`),
265
+ index("junior_conversation_events_plugin_conversation_idx").on(table.conversationId, sql`(${table.payload}->>'namespace')`, sql`(${table.payload}->>'name')`, table.seq).where(sql`${table.type} = 'structured_event'`),
156
266
  index("junior_conversation_events_actor_identity_idx").on(table.actorIdentityId, table.conversationId, table.seq),
267
+ index("junior_conversation_events_author_idx").on(table.conversationId, table.actorIdentityId, table.seq).where(sql`${table.actorIdentityId} is not null`),
157
268
  index("junior_conversation_events_message_search_idx").using("gin", sql`to_tsvector('english', ${table.payload}->>'text')`).where(sql`${table.type} = 'message'`),
158
269
  uniqueIndex("junior_conversation_events_idempotency_idx").on(table.conversationId, table.idempotencyKey)
159
270
  ]);
@@ -280,6 +391,40 @@ const juniorConversationReadPositions = pgTable("junior_conversation_read_positi
280
391
  name: "junior_conversation_read_positions_user_conversation_pk",
281
392
  columns: [table.userId, table.conversationId]
282
393
  })]);
394
+ // src/db/schema/agent-invocations.ts
395
+ const juniorAgentBindings = pgTable("junior_agent_bindings", {
396
+ parentConversationId: text("parent_conversation_id").notNull().references(() => juniorConversations.conversationId),
397
+ name: text("name").notNull(),
398
+ childConversationId: text("child_conversation_id").notNull().references(() => juniorConversations.conversationId)
399
+ }, (table) => [primaryKey({ columns: [table.parentConversationId, table.name] }), uniqueIndex("junior_agent_bindings_child_idx").on(table.childConversationId)]);
400
+ const juniorAgentInvocations = pgTable("junior_agent_invocations", {
401
+ invocationId: text("invocation_id").primaryKey(),
402
+ parentConversationId: text("parent_conversation_id").notNull().references(() => juniorConversations.conversationId),
403
+ childConversationId: text("child_conversation_id").notNull().references(() => juniorConversations.conversationId),
404
+ agentName: text("agent_name"),
405
+ input: text("input").notNull(),
406
+ title: text("title"),
407
+ actor: jsonb("actor_json").$type().notNull(),
408
+ credentialContext: jsonb("credential_context_json").$type(),
409
+ source: jsonb("source_json").$type().notNull(),
410
+ destination: jsonb("destination_json").$type().notNull(),
411
+ destinationVisibility: text("destination_visibility").$type(),
412
+ agentType: text("agent_type").$type(),
413
+ reasoningLevel: text("reasoning_level").$type(),
414
+ parentToolCallId: text("parent_tool_call_id"),
415
+ status: text("status").$type().notNull(),
416
+ mailboxStatus: text("mailbox_status").$type().notNull(),
417
+ parentMailboxStatus: text("parent_mailbox_status").$type(),
418
+ result: text("result"),
419
+ errorMessage: text("error_message"),
420
+ createdAt: timestamptz("created_at").notNull(),
421
+ updatedAt: timestamptz("updated_at").notNull(),
422
+ terminalAt: timestamptz("terminal_at")
423
+ }, (table) => [
424
+ index("junior_agent_invocations_child_idx").on(table.childConversationId),
425
+ index("junior_agent_invocations_mailbox_idx").on(table.mailboxStatus, table.createdAt),
426
+ index("junior_agent_invocations_parent_mailbox_idx").on(table.parentMailboxStatus, table.terminalAt)
427
+ ]);
283
428
  // src/db/schema/location-configurations.ts
284
429
  /** Durable user configuration entries scoped to provider Locations. */
285
430
  const juniorLocationConfigurations = pgTable("junior_location_configurations", {
@@ -676,7 +821,7 @@ var NeonExecutor = class {
676
821
  function createNeonJuniorSqlExecutor(args) {
677
822
  const pool = new Pool({
678
823
  connectionString: args.connectionString,
679
- max: 3,
824
+ max: 10,
680
825
  statement_timeout: args.statementTimeoutMs
681
826
  });
682
827
  pool.on("error", (error) => {
@@ -814,4 +959,4 @@ function createJuniorSqlExecutor(args) {
814
959
  statementTimeoutMs
815
960
  });
816
961
  }
817
- export { juniorCodeChanges as C, juniorArtifacts as E, juniorConversationAnnotations as S, juniorAttachments as T, juniorConversationBriefs as _, juniorReviewItemAssignees as a, juniorConversationEvents as b, juniorReviewItems as c, juniorAutomations as d, juniorStats as f, juniorConversationBindings as g, juniorConversationParticipants as h, juniorWorkspaces as i, juniorAutomationRuns as l, juniorConversationReadPositions as m, juniorSnapshots as n, juniorReviewItemConversations as o, juniorLocationConfigurations as p, juniorWorkspaceRepos as r, juniorReviewItemSlackCards as s, createJuniorSqlExecutor as t, juniorAutomationVersions as u, CONVERSATION_METRICS as v, juniorCodeRepositories as w, juniorApiTokens as x, juniorConversationMetrics as y };
962
+ export { juniorIdentities as A, juniorApiTokens as C, juniorAttachments as D, juniorCodeRepositories as E, juniorDestinations as M, juniorArtifacts as N, conversationReadColumns as O, juniorConversationEvents as S, juniorCodeChanges as T, juniorConversationParticipants as _, juniorReviewItemAssignees as a, CONVERSATION_METRICS as b, juniorReviewItems as c, juniorAutomations as d, juniorStats as f, juniorConversationReadPositions as g, juniorAgentInvocations as h, juniorWorkspaces as i, juniorUsers as j, juniorConversations as k, juniorAutomationRuns as l, juniorAgentBindings as m, juniorSnapshots as n, juniorReviewItemConversations as o, juniorLocationConfigurations as p, juniorWorkspaceRepos as r, juniorReviewItemSlackCards as s, createJuniorSqlExecutor as t, juniorAutomationVersions as u, juniorConversationBindings as v, juniorConversationAnnotations as w, juniorConversationMetrics as x, juniorConversationBriefs as y };
@@ -1,3 +1,15 @@
1
+ import "./sentry-DrKC2NeM.js";
2
+ import { MiddlewareHandler } from "hono";
3
+ /**
4
+ * Name the current request span after a route pattern. Spans that end during
5
+ * the request take this name as their segment name.
6
+ */
7
+ export declare function nameRequestRoute(method: string, route: string): void;
8
+ /**
9
+ * Name the request span after the first route handler that matches in this
10
+ * app. Register it first in an app that another app calls through `fetch()`.
11
+ */
12
+ export declare function routeNameMiddleware(): MiddlewareHandler;
1
13
  /** Browser SDK settings and the current request's trace, for an HTML page. */
2
14
  export interface BrowserSentryConfig {
3
15
  baggage?: string;
@@ -1,7 +1,9 @@
1
- import { R as getDeploymentServiceVersion, z as getDeploymentTelemetryAttributes } from "./logging-dFaXvBRK.js";
2
- import { a as getClient, c as init, i as getActiveSpan, o as getGlobalScope, p as spanToJSON, s as getTraceData } from "./sentry-MDkYAVPV.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-C23M8KaD.js";
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 { R as getDeploymentServiceVersion, z as getDeploymentTelemetryAttributes } from "./logging-CGnh65_X.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-2cm6OpNg.js";
4
+ import { n as redactSandboxEgressProxyPath } from "./proxy-path-BHYoKZdq.js";
4
5
  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";
5
7
  import { performance } from "node:perf_hooks";
6
8
  import { subscribe, unsubscribe } from "node:diagnostics_channel";
7
9
  // src/chat/pi/gateway-request-timing.ts
@@ -130,14 +132,30 @@ const URL_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
130
132
  "url.path"
131
133
  ]);
132
134
  const SLACK_FILE_HOST = "files.slack.com";
133
- const OAUTH_CALLBACK_PATH = "/api/oauth/callback/";
134
- const LOCAL_CREDENTIAL_PATH = "/api/internal/local-oauth-credentials";
135
- const SECRET_HEADER_NAMES = /* @__PURE__ */ new Set(["x-junior-local-credential-signature", "x-junior-sandbox-egress-token"]);
136
- function stripQuery(value) {
137
- const queryIndex = value.indexOf("?");
138
- return queryIndex >= 0 ? value.slice(0, queryIndex) : value;
135
+ const SECRET_HEADER_NAMES = /* @__PURE__ */ new Set([
136
+ "authorization",
137
+ "forwarded",
138
+ "referer",
139
+ "vercel-forwarded-path",
140
+ "x-hub-signature",
141
+ "x-hub-signature-256",
142
+ "x-junior-local-credential-signature",
143
+ "x-junior-sandbox-egress-token",
144
+ "x-slack-signature"
145
+ ]);
146
+ const SDK_REQUEST_HEADER_PREFIX = "http.request.header.";
147
+ const URL_SPAN_NAME = /^([A-Z]+ )((?:https?:\/\/|\/)\S*)$/;
148
+ /** Drop the query and fragment, and hide the sandbox egress credential token. */
149
+ function scrubUrl(value) {
150
+ return redactSandboxEgressProxyPath(value.split(/[?#]/, 1)[0] ?? value);
151
+ }
152
+ function scrubSpanName(name) {
153
+ const match = URL_SPAN_NAME.exec(name);
154
+ return match ? `${match[1]}${scrubUrl(match[2] ?? "")}` : name;
139
155
  }
140
156
  function isSecretHeaderAttribute(key) {
157
+ const lowerKey = key.toLowerCase();
158
+ if (lowerKey.startsWith(SDK_REQUEST_HEADER_PREFIX) && SECRET_HEADER_NAMES.has(lowerKey.slice(20).replaceAll("_", "-"))) return true;
141
159
  const normalized = key.toLowerCase().replace(/[^a-z0-9]/g, "");
142
160
  return normalized.endsWith("xjuniorlocalcredentialsignature") || normalized.endsWith("xjuniorsandboxegresstoken");
143
161
  }
@@ -160,29 +178,23 @@ function scrubSensitiveUrlAttributes(attributes) {
160
178
  if (!attributes) return;
161
179
  delete attributes["url.query"];
162
180
  delete attributes["url.fragment"];
163
- const hasLocalCredentialUrl = [...URL_ATTRIBUTE_KEYS].some((key) => {
164
- const value = attributes[key];
165
- return typeof value === "string" && value.includes(LOCAL_CREDENTIAL_PATH);
166
- });
167
- for (const key of Object.keys(attributes)) if (isSecretHeaderAttribute(key) || hasLocalCredentialUrl && key === "http.request.body.data") delete attributes[key];
181
+ delete attributes["http.request.body.data"];
182
+ for (const key of Object.keys(attributes)) if (isSecretHeaderAttribute(key)) delete attributes[key];
168
183
  if (isSlackFileRequest(attributes)) {
169
184
  scrubSlackFileUrls(attributes);
170
185
  return;
171
186
  }
172
187
  for (const key of URL_ATTRIBUTE_KEYS) {
173
188
  const value = attributes[key];
174
- if (typeof value !== "string" || !value.includes(OAUTH_CALLBACK_PATH)) continue;
175
- attributes[key] = stripQuery(value);
189
+ if (typeof value === "string") attributes[key] = scrubUrl(value);
176
190
  }
177
191
  }
178
192
  function scrubSensitiveRequest(request) {
179
193
  if (!request) return;
180
194
  const url = request.url;
181
- if (url?.includes(OAUTH_CALLBACK_PATH)) {
182
- request.url = stripQuery(url);
183
- delete request.query_string;
184
- }
185
- if (url?.includes(LOCAL_CREDENTIAL_PATH)) delete request.data;
195
+ if (url !== void 0) request.url = scrubUrl(url);
196
+ delete request.query_string;
197
+ delete request.data;
186
198
  if (!request.headers) return;
187
199
  for (const key of Object.keys(request.headers)) if (SECRET_HEADER_NAMES.has(key.toLowerCase())) delete request.headers[key];
188
200
  }
@@ -216,6 +228,7 @@ function scrubContainer(container) {
216
228
  function scrubPrivateSentryEvent(event) {
217
229
  scrubContainer(event);
218
230
  scrubSensitiveRequest(event.request);
231
+ if (event.transaction) event.transaction = scrubSpanName(event.transaction);
219
232
  scrubContainer(event.contexts?.trace);
220
233
  for (const breadcrumb of event.breadcrumbs ?? []) scrubContainer(breadcrumb);
221
234
  return event;
@@ -223,6 +236,10 @@ function scrubPrivateSentryEvent(event) {
223
236
  /** Remove private conversation payloads and boundary secrets from streamed spans. */
224
237
  function scrubPrivateSentrySpan(span) {
225
238
  scrubContainer(span);
239
+ span.name = scrubSpanName(span.name);
240
+ const segmentName = span.attributes?.["sentry.segment.name"];
241
+ if (span.attributes && typeof segmentName === "string") span.attributes["sentry.segment.name"] = scrubSpanName(segmentName);
242
+ promoteHttpRouteName(span);
226
243
  return span;
227
244
  }
228
245
  /** Remove private conversation payloads and boundary secrets from structured logs. */
@@ -302,7 +319,23 @@ function initSentry() {
302
319
  attributes: { "url.path": "/_vercel/ping" }
303
320
  }],
304
321
  dataCollection: {
305
- httpBodies: ["incomingRequest"],
322
+ httpBodies: [],
323
+ httpHeaders: { request: { allow: [
324
+ "accept",
325
+ "baggage",
326
+ "content-encoding",
327
+ "content-length",
328
+ "content-type",
329
+ "host",
330
+ "sentry-trace",
331
+ "user-agent",
332
+ "x-github-delivery",
333
+ "x-github-event",
334
+ "x-slack-request-timestamp",
335
+ "x-slack-retry",
336
+ "x-vercel-id"
337
+ ] } },
338
+ urlQueryParams: false,
306
339
  databaseQueryData: false
307
340
  },
308
341
  beforeSend: scrubPrivateSentryEvent,
@@ -313,4 +346,4 @@ function initSentry() {
313
346
  getGlobalScope().setAttributes(deploymentSpanAttributes);
314
347
  subscribeGatewayRequestTiming();
315
348
  }
316
- export { getBrowserSentryConfig, initSentry };
349
+ export { getBrowserSentryConfig, initSentry, nameRequestRoute, routeNameMiddleware };
@@ -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-MDkYAVPV.js";
2
- import { t as JUNIOR_VERSION } from "./version-C7HejFP2.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-BRTJqumy.js";
2
+ import { t as JUNIOR_VERSION } from "./version-BeHSXUK6.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";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import * as z from "zod";
2
2
  import { actorSchema } from "@sentry/junior-plugin-api";
3
3
  // src/usage-schema.ts
4
4
  const usageCostSchema = z.object({
@@ -1,13 +1,13 @@
1
- import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { Aa as canAccessConversation, ja as readConversationAccessFromSql } from "./projection-BTge9wrH.js";
3
- import { n as botConfig } from "./config-o2jLRY5J.js";
4
- import { F as SYSTEM_IDENTITY_ID, S as getDb, x as getConversationStore } from "./viewer-DLXajQZE.js";
5
- import { Ft as toolInvocationDestination, Pt as actorFromRun } from "./agent-runner-DE-43MPb.js";
6
- import { F as findChildAgentConversationId, L as PARENT_AGENT_TARGET, N as AgentMessageTargetError, a as createAgentInvocationForMessage, j as AgentMessagePausedError, s as getActiveAgentInvocationForConversation } from "./store-BGBzQWNf.js";
7
- import { D as postAutomatedTurnLimitNoticeForConversation, a as EVENT_WAIT_MS, j as admitAutomatedTurn } from "./session-stop-BsS4qFS2.js";
8
- import { r as appendAndEnqueueInboundMessage } from "./store-CGJZTEVz.js";
9
- import { r as enqueueAgentMessageToParent } from "./result-5LBEfnLX.js";
10
- import { i as enqueueAgentInvocation } from "./work-DRGSlfia.js";
1
+ import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
+ import { Ma as readConversationAccessFromSql, ja as canAccessConversation } from "./projection-C1MghKyI.js";
3
+ import { n as botConfig } from "./config-CusBFORe.js";
4
+ import { F as SYSTEM_IDENTITY_ID, S as getDb, x as getConversationStore } from "./viewer-BZ0Hp5Nb.js";
5
+ import { Ft as toolInvocationDestination, Pt as actorFromRun } from "./agent-runner-_PYLv4Qo.js";
6
+ import { F as findChildAgentConversationId, L as PARENT_AGENT_TARGET, N as AgentMessageTargetError, a as createAgentInvocationForMessage, j as AgentMessagePausedError, s as getActiveAgentInvocationForConversation } from "./store-Dlio-o6u.js";
7
+ import { D as postAutomatedTurnLimitNoticeForConversation, a as EVENT_WAIT_MS, j as admitAutomatedTurn } from "./session-stop-CDEMsNtv.js";
8
+ import { r as appendAndEnqueueInboundMessage } from "./store-QzOfDwKA.js";
9
+ import { r as enqueueAgentMessageToParent } from "./result-Dd9kCuQ-.js";
10
+ import { i as enqueueAgentInvocation } from "./work-BTcCIbWu.js";
11
11
  // src/chat/agent-invocations/top-level-message.ts
12
12
  const AGENT_MESSAGE_EVENT_NAMESPACE = "junior";
13
13
  /** Event type of a message from another top-level agent. */
package/dist/nitro.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as JuniorDashboardOptions } from "./app-CHNS-AX2.js";
1
+ import { i as JuniorDashboardOptions } from "./app-CL2zzzE0.js";
2
2
  import { n as JuniorPluginSet } from "./plugins-DtmjkTza.js";
3
3
  import { withSentryConfig as withSentryConfig$1 } from "@sentry/nitro";
4
4
  type SentryNitroConfig = Parameters<typeof withSentryConfig$1>[0];
package/dist/nitro.js CHANGED
@@ -1,8 +1,8 @@
1
- import { A as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_ROUTE, I as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_ROUTE, N as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_RETENTION_CRON_SCHEDULE, R as getDeploymentServiceVersion, j as JUNIOR_HEARTBEAT_CRON_SCHEDULE, k as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE } from "./logging-dFaXvBRK.js";
2
- import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-DJBompdd.js";
3
- import { a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, u as resolveConversationWorkQueueTopic } from "./background-compaction-queue-CAL4A2y7.js";
4
- import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-DOm9Y6qI.js";
5
- import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-UD27ei2U.js";
1
+ import { A as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_ROUTE, I as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_ROUTE, N as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_RETENTION_CRON_SCHEDULE, R as getDeploymentServiceVersion, j as JUNIOR_HEARTBEAT_CRON_SCHEDULE, k as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE } from "./logging-CGnh65_X.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, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, u as resolveConversationWorkQueueTopic } from "./background-compaction-queue-B9lmh8Ml.js";
4
+ import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-HYh_JOdw.js";
5
+ import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-Cp1V_XW3.js";
6
6
  import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cf5gVPWP.js";
7
7
  import path from "node:path";
8
8
  import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
@@ -39,7 +39,7 @@ function globToRegex(pattern) {
39
39
  // src/build/copy-build-content.ts
40
40
  const DASHBOARD_PACKAGE_NAME = "@sentry/junior-dashboard";
41
41
  const JUNIOR_PACKAGE_NAME = "@sentry/junior";
42
- const DASHBOARD_ASSET_NAMES = ["client.js", "tailwind.css"];
42
+ const DASHBOARD_ASSET_NAMES = ["tailwind.css"];
43
43
  /** Copy app, built-in skill, and declared plugin content into server output. */
44
44
  function copyRuntimeContent(cwd, serverRoot, packageNames) {
45
45
  copyIfExists(path.join(cwd, "app"), path.join(serverRoot, "app"));
@@ -64,6 +64,12 @@ function copyDashboardAssets(cwd, serverRoot) {
64
64
  if (!packageDir) throw new Error(`createApp({ dashboard }) requires installing "${DASHBOARD_PACKAGE_NAME}"`);
65
65
  for (const fileName of DASHBOARD_ASSET_NAMES) copyIfExists(dashboardAssetPath(packageDir, fileName), path.join(serverRoot, "node_modules", DASHBOARD_PACKAGE_NAME, "dist", fileName));
66
66
  }
67
+ /** Find the dashboard folder of content-hashed browser files that Nitro serves as static assets. */
68
+ function resolveDashboardPublicAssetsDir(cwd) {
69
+ const packageDir = resolvePackageDir(cwd, DASHBOARD_PACKAGE_NAME);
70
+ if (!packageDir) throw new Error(`createApp({ dashboard }) requires installing "${DASHBOARD_PACKAGE_NAME}"`);
71
+ return dashboardAssetPath(packageDir, "public");
72
+ }
67
73
  /** Copy extra file patterns into server output for files the bundler cannot trace. */
68
74
  function copyIncludedFiles(cwd, serverRoot, patterns) {
69
75
  if (patterns === void 0) return;
@@ -289,6 +295,12 @@ function juniorNitro(options = {}) {
289
295
  const cwd = path.resolve(options.cwd ?? nitro.options.rootDir ?? process.cwd());
290
296
  const functionMaxDurationSeconds = configureVercelDeployment(nitro, options);
291
297
  applyRolldownTreeshakeWorkaround(nitro);
298
+ if (dashboardEnabled(options.dashboard)) nitro.options.publicAssets.push({
299
+ baseURL: "/_junior/dashboard/assets",
300
+ dir: resolveDashboardPublicAssetsDir(cwd),
301
+ fallthrough: false,
302
+ maxAge: 31536e3
303
+ });
292
304
  nitro.options.traceDeps = [...nitro.options.traceDeps ?? [], ...CODEMODE_TRACE_DEPS];
293
305
  const pluginSource = options.plugins;
294
306
  const pluginModule = isPluginModuleReference(pluginSource) ? resolvePluginModule(cwd, pluginSource) : void 0;
@@ -1,5 +1,5 @@
1
- import { wn as createUserTokenStore } from "./projection-BTge9wrH.js";
2
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-Dd0WyNfF.js";
1
+ import { wn as createUserTokenStore } from "./projection-C1MghKyI.js";
2
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-DK06Jgt-.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;
@@ -1,6 +1,6 @@
1
- import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
1
+ import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
2
  import { randomBytes } from "node:crypto";
3
- import { z } from "zod";
3
+ import * as z from "zod";
4
4
  import { SignJWT, jwtVerify } from "jose";
5
5
  // src/chat/local/oauth-relay.ts
6
6
  var oauth_relay_exports = /* @__PURE__ */ __exportAll({
@@ -1,4 +1,4 @@
1
- import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
1
+ import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
2
  import { createRequire } from "node:module";
3
3
  import path from "node:path";
4
4
  import fs, { statSync } from "node:fs";
@@ -1,4 +1,4 @@
1
- import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
1
+ import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
2
  // src/plugins.ts
3
3
  var plugins_exports = /* @__PURE__ */ __exportAll({
4
4
  defineJuniorPlugins: () => defineJuniorPlugins,