@sentry/junior 0.242.0 → 0.244.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 (67) hide show
  1. package/dist/{admin-C54kvHVC.js → admin-CF9lQg0M.js} +1 -1
  2. package/dist/{agent-hooks-BVttjZvb.js → agent-hooks-Cj_rSeWd.js} +22 -12
  3. package/dist/agent-invocations-BO6ddZax.js +177 -0
  4. package/dist/{agent-runner-BTgnxJ7g.js → agent-runner-DtEtbaOb.js} +646 -70
  5. package/dist/api/schema.d.ts +67 -1
  6. package/dist/api/schema.js +4 -4
  7. package/dist/api.js +53 -22
  8. package/dist/{app-MEd7wbF0.d.ts → app-DRLh-8zs.d.ts} +5 -0
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +41 -24
  11. package/dist/{briefs-CKUsv9F1.js → briefs-BMzTiGJO.js} +4 -4
  12. package/dist/{catalog-runtime-C2YkfMZz.js → catalog-runtime-CpxhLwZG.js} +1 -1
  13. package/dist/cli/chat.js +12 -12
  14. package/dist/cli/check.js +3 -3
  15. package/dist/cli/main.js +2 -2
  16. package/dist/cli/plugins.js +4 -4
  17. package/dist/cli/snapshot-create.js +3 -3
  18. package/dist/cli/upgrade.js +3 -3
  19. package/dist/{client-D51G-Jdg.js → client-BVaGEb1-.js} +2 -2
  20. package/dist/{config-C6Uu3Re9.js → config-q9xXVN_5.js} +7 -2
  21. package/dist/{conversation-DwD-vquD.js → conversation-BxvgH64Q.js} +5 -1
  22. package/dist/{conversation-privacy-CzL47nXs.js → conversation-privacy-Dyh_63Ee.js} +1 -1
  23. package/dist/{credential-sync-DvDaE-Uj.js → credential-sync-Bsn-6m16.js} +14 -14
  24. package/dist/{executor-CGUukwus.js → executor-DA7eHhmC.js} +5 -124
  25. package/dist/{history-BLTUgFYO.js → history-Nte1oVed.js} +4 -0
  26. package/dist/{images-DSxZt5vk.js → images-CvMreau5.js} +3 -3
  27. package/dist/instrumentation.js +2 -2
  28. package/dist/{job-queue-hLylM9cy.js → job-queue-mVyF9jgv.js} +1 -1
  29. package/dist/{logging-BdZ_mK3q.js → logging-z7_w-KN_.js} +1 -1
  30. package/dist/nitro.d.ts +1 -1
  31. package/dist/nitro.js +3 -3
  32. package/dist/{oauth-authorization-BokpeHv-.js → oauth-authorization-Db1yGVvG.js} +1 -1
  33. package/dist/{oauth-callback-server-C3BOSmT_.js → oauth-callback-server-_MfOtSxS.js} +2 -2
  34. package/dist/{pending-auth-DOzL4D24.js → pending-auth-OndKPW4M.js} +2 -2
  35. package/dist/{profile-2gPzzMib.js → profile-yeKVNECl.js} +4 -4
  36. package/dist/{prompt-CMU-B4FA.js → prompt-CX36ZlbV.js} +1 -1
  37. package/dist/{registry-XJkXDNK2.js → registry-DvzzL8-v.js} +1 -1
  38. package/dist/{resolve-DhcdtDt6.js → resolve-4u5gEU04.js} +2 -2
  39. package/dist/{runner-CGyrnIPm.js → runner-Y6A6pww4.js} +10 -10
  40. package/dist/{sandbox-egress-signals-D6F3OZJP.js → sandbox-egress-signals-D7AOkuoe.js} +1 -1
  41. package/dist/{schema-Cabm4jcj.js → schema-Dyyi9oRc.js} +35 -3
  42. package/dist/{skills-C6PqcBPU.js → skills-DFduSvuO.js} +2 -2
  43. package/dist/{spawn-DL9x3T1o.js → spawn-DYg7jhhR.js} +7 -5
  44. package/dist/{task-queue-vZnBGu9B.js → task-queue-BQ0vnumm.js} +3 -3
  45. package/dist/{task-runner-C-c0t5F5.js → task-runner-D4jvUpFV.js} +12 -11
  46. package/dist/{tasks-EqCtmUJ2.js → tasks-DBZAgTx7.js} +49 -17
  47. package/dist/{thread-state-B8IKs_J8.js → thread-state-hj70P2Cp.js} +7 -7
  48. package/dist/{turn-failure-response-BS7OO1BE.js → turn-failure-response-S2pwtR8b.js} +9 -9
  49. package/dist/{turn-lifecycle-Cxrt8qMD.js → turn-lifecycle-CNFOMAJq.js} +1 -1
  50. package/dist/{turn-session-routing-BlGt2AUb.js → turn-session-routing-1eTgv6ns.js} +1 -1
  51. package/dist/{validation-C8hci6pj.js → validation-DcsBjzdi.js} +1 -1
  52. package/dist/{version-CjnHQ8aY.js → version-DVCHJYcY.js} +1 -1
  53. package/dist/version.js +1 -1
  54. package/dist/{viewer-BOgEy5zC.js → viewer-BBnCMR1g.js} +6 -8
  55. package/dist/{web-authorization-DSMV5tMK.js → web-authorization-CTltRLsB.js} +6 -6
  56. package/dist/{web-input-TD5P9jdo.js → web-input-CIsRGF07.js} +227 -31
  57. package/dist/{work-D39OAwP1.js → work-fje9VXgQ.js} +111 -225
  58. package/dist/{worker-CWiLgCWH.js → worker-Byd2Et9r.js} +5 -5
  59. package/migrations/0050_agent_invocation_parent_mailbox.sql +4 -0
  60. package/migrations/0051_agent_invocation_parent_tool_call.sql +1 -0
  61. package/migrations/0052_agent_invocation_title.sql +1 -0
  62. package/migrations/meta/0050_snapshot.json +3753 -0
  63. package/migrations/meta/0051_snapshot.json +3759 -0
  64. package/migrations/meta/0052_snapshot.json +3765 -0
  65. package/migrations/meta/_journal.json +22 -1
  66. package/package.json +5 -5
  67. package/dist/destinations-BeBiJeEM.js +0 -29
@@ -1,4 +1,4 @@
1
- import { a as setUserAdminFromSql, d as getDb, n as listAdminUsersFromSql } from "./viewer-BOgEy5zC.js";
1
+ import { a as setUserAdminFromSql, d as getDb, n as listAdminUsersFromSql } from "./viewer-BBnCMR1g.js";
2
2
  import { CLI_USAGE } from "./cli/run.js";
3
3
  //#region src/cli/admin.ts
4
4
  /**
@@ -1,20 +1,20 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { a as embedTexts, r as completeObject } from "./client-D51G-Jdg.js";
3
- import { I as isRecord$1, a as extractGenAiUsageSummary, d as logException, f as logInfo, p as logWarn, v as setSpanAttributes, w as withSpan, y as setSpanStatus } from "./logging-BdZ_mK3q.js";
2
+ import { a as embedTexts, r as completeObject } from "./client-BVaGEb1-.js";
3
+ import { I as isRecord$1, a as extractGenAiUsageSummary, d as logException, f as logInfo, p as logWarn, v as setSpanAttributes, w as withSpan, y as setSpanStatus } from "./logging-z7_w-KN_.js";
4
4
  import { a as getClient$1 } from "./sentry-CgWZM_kV.js";
5
- import { t as canExposeConversationPayload } from "./conversation-privacy-CzL47nXs.js";
6
- import { i as getChatConfig, n as botConfig, o as getSlackBotToken } from "./config-C6Uu3Re9.js";
5
+ import { t as canExposeConversationPayload } from "./conversation-privacy-Dyh_63Ee.js";
6
+ import { i as getChatConfig, n as botConfig, o as getSlackBotToken } from "./config-q9xXVN_5.js";
7
7
  import { r as defaultModelId } from "./model-profile-BwU8mqwD.js";
8
8
  import { d as parseSlackTeamId, g as parseSlackMessageTs, i as isActorUserId, o as parseActorUserId, u as parseSlackChannelReferenceId } from "./actor-BTtLaeWy.js";
9
- import { O as readUserTimezone, T as hasAgentTurnUsage, c as getConversationEventStore, d as getDb, f as getSqlExecutor, h as createSqlStore, i as resolveViewerUser, k as saveUserTimezone, r as readActorIdentity } from "./viewer-BOgEy5zC.js";
10
- import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
11
- import { C as juniorCodeChanges, D as juniorConversations, O as juniorIdentities, S as juniorConversationAnnotations, T as juniorAttachments, _ as juniorConversationBriefs, b as juniorConversationEvents, h as juniorConversationParticipants, i as juniorWorkspaces, k as juniorUsers, n as juniorSnapshots, r as juniorWorkspaceRepos, w as juniorCodeRepositories } from "./executor-CGUukwus.js";
12
- import { o as decodeStoredConversationEvent } from "./history-BLTUgFYO.js";
13
- import { p as credentialSubjectSchema } from "./registry-XJkXDNK2.js";
14
- import { B as parseBriefInput, C as conversationReportEventSchema, N as readMessageAttachments, W as readMessageCardRefs, z as conversationBriefSchema } from "./conversation-DwD-vquD.js";
15
- import { C as getDefaultRedisStateAdapterFor, N as SANDBOX_WORKSPACE_ROOT, k as sleep$1, l as isSandboxMissingError, n as hash, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-2gPzzMib.js";
9
+ import { O as readUserTimezone, T as hasAgentTurnUsage, c as getConversationEventStore, d as getDb, f as getSqlExecutor, h as createSqlStore, i as resolveViewerUser, k as saveUserTimezone, r as readActorIdentity } from "./viewer-BBnCMR1g.js";
10
+ import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, s as juniorConversations } from "./agent-invocations-BO6ddZax.js";
11
+ import { S as juniorAttachments, _ as juniorConversationEvents, b as juniorCodeChanges, f as juniorConversationParticipants, i as juniorWorkspaces, m as juniorConversationBriefs, n as juniorSnapshots, r as juniorWorkspaceRepos, x as juniorCodeRepositories, y as juniorConversationAnnotations } from "./executor-DA7eHhmC.js";
12
+ import { o as decodeStoredConversationEvent } from "./history-Nte1oVed.js";
13
+ import { p as credentialSubjectSchema } from "./registry-DvzzL8-v.js";
14
+ import { B as parseBriefInput, C as conversationReportEventSchema, N as readMessageAttachments, W as readMessageCardRefs, z as conversationBriefSchema } from "./conversation-BxvgH64Q.js";
15
+ import { C as getDefaultRedisStateAdapterFor, N as SANDBOX_WORKSPACE_ROOT, k as sleep$1, l as isSandboxMissingError, n as hash, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-yeKVNECl.js";
16
16
  import { i as isValidTimeZone } from "./cadence-D00SCzT1.js";
17
- import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-CMU-B4FA.js";
17
+ import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-CX36ZlbV.js";
18
18
  import { AsyncLocalStorage } from "node:async_hooks";
19
19
  import { z } from "zod";
20
20
  import { createHash, createHmac, randomUUID, timingSafeEqual } from "node:crypto";
@@ -1178,6 +1178,14 @@ function reportEventData(args) {
1178
1178
  default: return;
1179
1179
  }
1180
1180
  }
1181
+ function reportSubagentLabel(data, canExposePayload) {
1182
+ if (!canExposePayload) return {};
1183
+ return {
1184
+ ...data.agentName ? { agentName: data.agentName } : void 0,
1185
+ ...data.task ? { task: data.task } : void 0,
1186
+ ...data.title ? { title: data.title } : void 0
1187
+ };
1188
+ }
1181
1189
  /**
1182
1190
  * Project canonical events into the ordered reporting boundary.
1183
1191
  *
@@ -1254,6 +1262,7 @@ function projectConversationReportEventPage(args) {
1254
1262
  startedAt: new Date(event.createdAtMs).toISOString(),
1255
1263
  childConversationId: event.data.childConversationId,
1256
1264
  subagentKind: event.data.subagentKind,
1265
+ ...reportSubagentLabel(event.data, args.canExposePayload),
1257
1266
  status: "running",
1258
1267
  ...event.data.parentToolCallId ? { parentToolCallId: event.data.parentToolCallId } : void 0
1259
1268
  };
@@ -1266,6 +1275,7 @@ function projectConversationReportEventPage(args) {
1266
1275
  startedAt: new Date(started.createdAtMs).toISOString(),
1267
1276
  childConversationId: started.data.childConversationId,
1268
1277
  subagentKind: started.data.subagentKind,
1278
+ ...reportSubagentLabel(started.data, args.canExposePayload),
1269
1279
  ...started.data.parentToolCallId ? { parentToolCallId: started.data.parentToolCallId } : void 0,
1270
1280
  status: event.data.outcome === "success" ? "completed" : event.data.outcome
1271
1281
  };
@@ -0,0 +1,177 @@
1
+ import { z } from "zod";
2
+ import { getTableColumns, sql } from "drizzle-orm";
3
+ import { boolean, index, integer, jsonb, pgTable, primaryKey, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
4
+ //#region src/db/schema/timestamps.ts
5
+ const timestamptz = (name) => timestamp(name, { withTimezone: true });
6
+ //#endregion
7
+ //#region src/db/schema/destinations.ts
8
+ const juniorDestinationKindSchema = z.enum([
9
+ "channel",
10
+ "dm",
11
+ "group",
12
+ "local_conversation",
13
+ "thread",
14
+ "web_session"
15
+ ]);
16
+ const juniorDestinations = pgTable("junior_destinations", {
17
+ id: text("id").primaryKey(),
18
+ provider: text("provider").notNull(),
19
+ providerTenantId: text("provider_tenant_id").notNull().default(""),
20
+ providerDestinationId: text("provider_destination_id").notNull(),
21
+ kind: text("kind").$type().notNull(),
22
+ parentDestinationId: text("parent_destination_id"),
23
+ displayName: text("display_name"),
24
+ visibility: text("visibility").$type().notNull().default("unknown"),
25
+ metadata: jsonb("metadata_json"),
26
+ createdAt: timestamptz("created_at").notNull(),
27
+ updatedAt: timestamptz("updated_at").notNull()
28
+ }, (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)]);
29
+ //#endregion
30
+ //#region src/db/schema/users.ts
31
+ const juniorUsers = pgTable("junior_users", {
32
+ id: text("id").primaryKey(),
33
+ primaryEmail: text("primary_email").notNull(),
34
+ primaryEmailNormalized: text("primary_email_normalized").notNull(),
35
+ displayName: text("display_name"),
36
+ timezone: text("timezone"),
37
+ /** Junior-wide admin role. Only the `junior admin` CLI changes it. */
38
+ isAdmin: boolean("is_admin").notNull().default(false),
39
+ createdAt: timestamptz("created_at").notNull(),
40
+ updatedAt: timestamptz("updated_at").notNull()
41
+ }, (table) => [uniqueIndex("junior_users_primary_email_normalized_uidx").on(table.primaryEmailNormalized)]);
42
+ //#endregion
43
+ //#region src/db/schema/identities.ts
44
+ const juniorIdentities = pgTable("junior_identities", {
45
+ id: text("id").primaryKey(),
46
+ kind: text("kind").$type().notNull(),
47
+ provider: text("provider").notNull(),
48
+ providerTenantId: text("provider_tenant_id").notNull().default(""),
49
+ providerSubjectId: text("provider_subject_id").notNull(),
50
+ displayName: text("display_name"),
51
+ handle: text("handle"),
52
+ email: text("email"),
53
+ avatarUrl: text("avatar_url"),
54
+ metadata: jsonb("metadata_json"),
55
+ createdAt: timestamptz("created_at").notNull(),
56
+ updatedAt: timestamptz("updated_at").notNull(),
57
+ userId: text("user_id").references(() => juniorUsers.id),
58
+ emailNormalized: text("email_normalized"),
59
+ emailVerified: boolean("email_verified").notNull().default(false)
60
+ }, (table) => [
61
+ uniqueIndex("junior_identities_provider_subject_uidx").on(table.provider, table.providerTenantId, table.providerSubjectId),
62
+ index("junior_identities_user_idx").on(table.userId),
63
+ index("junior_identities_verified_email_idx").on(table.emailNormalized).where(sql`${table.emailVerified} = true AND ${table.emailNormalized} IS NOT NULL`),
64
+ index("junior_identities_kind_provider_idx").on(table.kind, table.provider)
65
+ ]);
66
+ //#endregion
67
+ //#region src/db/schema/conversations.ts
68
+ const juniorConversations = pgTable("junior_conversations", {
69
+ conversationId: text("conversation_id").primaryKey(),
70
+ schemaVersion: integer("schema_version").notNull().default(1),
71
+ source: text("source").$type(),
72
+ /** Structured session Source locator; set-once on the conversation root. */
73
+ sessionSource: jsonb("source_json").$type(),
74
+ originType: text("origin_type"),
75
+ originId: text("origin_id"),
76
+ originRunId: text("origin_run_id"),
77
+ /** Complete Location associated with this Conversation. */
78
+ location: jsonb("location_json").$type(),
79
+ destinationId: text("destination_id").references(() => juniorDestinations.id),
80
+ destination: jsonb("destination_json").$type(),
81
+ actorIdentityId: text("actor_identity_id").references(() => juniorIdentities.id),
82
+ creatorIdentityId: text("creator_identity_id").references(() => juniorIdentities.id),
83
+ credentialSubjectIdentityId: text("credential_subject_identity_id").references(() => juniorIdentities.id),
84
+ actor: jsonb("actor_json").$type(),
85
+ channelName: text("channel_name"),
86
+ title: text("title"),
87
+ createdAt: timestamptz("created_at").notNull(),
88
+ lastActivityAt: timestamptz("last_activity_at").notNull(),
89
+ updatedAt: timestamptz("updated_at").notNull(),
90
+ executionUpdatedAt: timestamptz("execution_updated_at"),
91
+ executionStatus: text("execution_status").$type().notNull(),
92
+ runId: text("run_id"),
93
+ lastCheckpointAt: timestamptz("last_checkpoint_at"),
94
+ lastEnqueuedAt: timestamptz("last_enqueued_at"),
95
+ parentConversationId: text("parent_conversation_id").references(() => juniorConversations.conversationId),
96
+ forkedFromConversationId: text("forked_from_conversation_id").references(() => juniorConversations.conversationId, { onDelete: "set null" }),
97
+ rootConversationId: text("root_conversation_id").references(() => juniorConversations.conversationId),
98
+ transcriptPurgedAt: timestamptz("transcript_purged_at"),
99
+ durationMs: integer("duration_ms").notNull().default(0),
100
+ usage: jsonb("usage_json").$type(),
101
+ executionDurationMs: integer("execution_duration_ms").notNull().default(0),
102
+ executionUsage: jsonb("execution_usage_json").$type(),
103
+ metricRunId: text("metric_run_id"),
104
+ legacyArchivedAt: timestamptz("archived_at")
105
+ }, (table) => [
106
+ index("junior_conversations_last_activity_idx").on(table.lastActivityAt.desc(), table.conversationId),
107
+ index("junior_conversations_active_idx").using("btree", sql`coalesce(${table.executionUpdatedAt}, ${table.updatedAt})`, table.conversationId).where(sql`${table.executionStatus} <> 'idle'`),
108
+ index("junior_conversations_destination_activity_idx").on(table.destinationId, table.lastActivityAt.desc()),
109
+ index("junior_conversations_actor_activity_idx").on(table.actorIdentityId, table.lastActivityAt.desc()),
110
+ index("junior_conversations_origin_idx").on(table.originType, table.originId, table.lastActivityAt.desc()),
111
+ index("junior_conversations_parent_idx").on(table.parentConversationId),
112
+ index("junior_conversations_forked_from_idx").on(table.forkedFromConversationId),
113
+ index("junior_conversations_root_idx").on(table.rootConversationId)
114
+ ]);
115
+ /** Select runtime conversation fields without reading the legacy archive column. */
116
+ function conversationReadColumns() {
117
+ const { legacyArchivedAt, ...columns } = getTableColumns(juniorConversations);
118
+ return columns;
119
+ }
120
+ //#endregion
121
+ //#region src/db/schema/agent-invocations.ts
122
+ const AGENT_INVOCATION_STATUSES = [
123
+ "pending",
124
+ "running",
125
+ "paused",
126
+ "blocked",
127
+ "completed",
128
+ "failed",
129
+ "stopped"
130
+ ];
131
+ const AGENT_INVOCATION_MAILBOX_STATUSES = ["pending", "appended"];
132
+ /**
133
+ * Parent mailbox append state. Only terminal invocations have a value.
134
+ * `replaced` means the child still had open work, so a later agent invocation
135
+ * on the same child sends the result instead. `skipped` means a stop ended
136
+ * the work, so the result is never used.
137
+ */
138
+ const AGENT_INVOCATION_PARENT_MAILBOX_STATUSES = [
139
+ "pending",
140
+ "appended",
141
+ "replaced",
142
+ "skipped"
143
+ ];
144
+ const juniorAgentBindings = pgTable("junior_agent_bindings", {
145
+ parentConversationId: text("parent_conversation_id").notNull().references(() => juniorConversations.conversationId),
146
+ name: text("name").notNull(),
147
+ childConversationId: text("child_conversation_id").notNull().references(() => juniorConversations.conversationId)
148
+ }, (table) => [primaryKey({ columns: [table.parentConversationId, table.name] }), uniqueIndex("junior_agent_bindings_child_idx").on(table.childConversationId)]);
149
+ const juniorAgentInvocations = pgTable("junior_agent_invocations", {
150
+ invocationId: text("invocation_id").primaryKey(),
151
+ parentConversationId: text("parent_conversation_id").notNull().references(() => juniorConversations.conversationId),
152
+ childConversationId: text("child_conversation_id").notNull().references(() => juniorConversations.conversationId),
153
+ agentName: text("agent_name"),
154
+ input: text("input").notNull(),
155
+ title: text("title"),
156
+ actor: jsonb("actor_json").$type().notNull(),
157
+ credentialContext: jsonb("credential_context_json").$type(),
158
+ source: jsonb("source_json").$type().notNull(),
159
+ destination: jsonb("destination_json").$type().notNull(),
160
+ destinationVisibility: text("destination_visibility").$type(),
161
+ reasoningLevel: text("reasoning_level").$type(),
162
+ parentToolCallId: text("parent_tool_call_id"),
163
+ status: text("status").$type().notNull(),
164
+ mailboxStatus: text("mailbox_status").$type().notNull(),
165
+ parentMailboxStatus: text("parent_mailbox_status").$type(),
166
+ result: text("result"),
167
+ errorMessage: text("error_message"),
168
+ createdAt: timestamptz("created_at").notNull(),
169
+ updatedAt: timestamptz("updated_at").notNull(),
170
+ terminalAt: timestamptz("terminal_at")
171
+ }, (table) => [
172
+ index("junior_agent_invocations_child_idx").on(table.childConversationId),
173
+ index("junior_agent_invocations_mailbox_idx").on(table.mailboxStatus, table.createdAt),
174
+ index("junior_agent_invocations_parent_mailbox_idx").on(table.parentMailboxStatus, table.terminalAt)
175
+ ]);
176
+ //#endregion
177
+ export { juniorAgentInvocations as a, juniorIdentities as c, juniorDestinations as d, timestamptz as f, juniorAgentBindings as i, juniorUsers as l, AGENT_INVOCATION_PARENT_MAILBOX_STATUSES as n, conversationReadColumns as o, AGENT_INVOCATION_STATUSES as r, juniorConversations as s, AGENT_INVOCATION_MAILBOX_STATUSES as t, juniorDestinationKindSchema as u };