@sentry/junior 0.242.0 → 0.243.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 (65) hide show
  1. package/dist/{admin-C54kvHVC.js → admin-DHOGoI03.js} +1 -1
  2. package/dist/{agent-hooks-BVttjZvb.js → agent-hooks-Cqo6ULp6.js} +12 -12
  3. package/dist/agent-invocations-BzRAZ_nj.js +176 -0
  4. package/dist/{agent-runner-BTgnxJ7g.js → agent-runner-BZOjoMlZ.js} +621 -69
  5. package/dist/api/schema.d.ts +53 -1
  6. package/dist/api/schema.js +4 -4
  7. package/dist/api.js +52 -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-C4GogKaB.js} +4 -4
  12. package/dist/{catalog-runtime-C2YkfMZz.js → catalog-runtime-jazDa-oO.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-Es79bknZ.js} +2 -2
  20. package/dist/{config-C6Uu3Re9.js → config-gype19qQ.js} +7 -2
  21. package/dist/{conversation-DwD-vquD.js → conversation-mt3yJ09u.js} +2 -1
  22. package/dist/{conversation-privacy-CzL47nXs.js → conversation-privacy-BIplVfmz.js} +1 -1
  23. package/dist/{credential-sync-DvDaE-Uj.js → credential-sync-BY97dkST.js} +14 -14
  24. package/dist/{executor-CGUukwus.js → executor-C7bsEF-c.js} +5 -124
  25. package/dist/{history-BLTUgFYO.js → history-DlsoHsoe.js} +1 -0
  26. package/dist/{images-DSxZt5vk.js → images-WmrEAtto.js} +3 -3
  27. package/dist/instrumentation.js +2 -2
  28. package/dist/{job-queue-hLylM9cy.js → job-queue-DQDesz8a.js} +1 -1
  29. package/dist/{logging-BdZ_mK3q.js → logging-CdZ1LQJ7.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-Di0KlyoJ.js} +1 -1
  33. package/dist/{oauth-callback-server-C3BOSmT_.js → oauth-callback-server-Cmog7Q3T.js} +2 -2
  34. package/dist/{pending-auth-DOzL4D24.js → pending-auth-CNAlGOyl.js} +2 -2
  35. package/dist/{profile-2gPzzMib.js → profile-qqt_2di0.js} +4 -4
  36. package/dist/{prompt-CMU-B4FA.js → prompt-D_cg2iqi.js} +1 -1
  37. package/dist/{registry-XJkXDNK2.js → registry-WOJKAIRI.js} +1 -1
  38. package/dist/{resolve-DhcdtDt6.js → resolve-C8VvY0lg.js} +2 -2
  39. package/dist/{runner-CGyrnIPm.js → runner-DojxjGmt.js} +10 -10
  40. package/dist/{sandbox-egress-signals-D6F3OZJP.js → sandbox-egress-signals-B7azPnsm.js} +1 -1
  41. package/dist/{schema-Cabm4jcj.js → schema-nQRsPWSr.js} +34 -3
  42. package/dist/{skills-C6PqcBPU.js → skills-Zj-9pbSU.js} +2 -2
  43. package/dist/{spawn-DL9x3T1o.js → spawn-DDJ5z9IC.js} +5 -4
  44. package/dist/{task-queue-vZnBGu9B.js → task-queue-CAi-XM8x.js} +3 -3
  45. package/dist/{task-runner-C-c0t5F5.js → task-runner-CIP2asjP.js} +12 -11
  46. package/dist/{tasks-EqCtmUJ2.js → tasks-Qx6Fos_R.js} +49 -17
  47. package/dist/{thread-state-B8IKs_J8.js → thread-state-BN_5S1bx.js} +7 -7
  48. package/dist/{turn-failure-response-BS7OO1BE.js → turn-failure-response-B1UW2T7a.js} +9 -9
  49. package/dist/{turn-lifecycle-Cxrt8qMD.js → turn-lifecycle-BzeE4sVD.js} +1 -1
  50. package/dist/{turn-session-routing-BlGt2AUb.js → turn-session-routing-DsvU39zW.js} +1 -1
  51. package/dist/{validation-C8hci6pj.js → validation-Dklx_nds.js} +1 -1
  52. package/dist/{version-CjnHQ8aY.js → version-BvG02ZTN.js} +1 -1
  53. package/dist/version.js +1 -1
  54. package/dist/{viewer-BOgEy5zC.js → viewer-B7qDM2DM.js} +6 -8
  55. package/dist/{web-authorization-DSMV5tMK.js → web-authorization-Cqv7bP19.js} +6 -6
  56. package/dist/{web-input-TD5P9jdo.js → web-input-CqnqSfzI.js} +227 -31
  57. package/dist/{work-D39OAwP1.js → work-D_BBvd4I.js} +111 -225
  58. package/dist/{worker-CWiLgCWH.js → worker-BWdV_5Ys.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/meta/0050_snapshot.json +3753 -0
  62. package/migrations/meta/0051_snapshot.json +3759 -0
  63. package/migrations/meta/_journal.json +15 -1
  64. package/package.json +5 -5
  65. 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-B7qDM2DM.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-Es79bknZ.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-CdZ1LQJ7.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-BIplVfmz.js";
6
+ import { i as getChatConfig, n as botConfig, o as getSlackBotToken } from "./config-gype19qQ.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-B7qDM2DM.js";
10
+ import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, s as juniorConversations } from "./agent-invocations-BzRAZ_nj.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-C7bsEF-c.js";
12
+ import { o as decodeStoredConversationEvent } from "./history-DlsoHsoe.js";
13
+ import { p as credentialSubjectSchema } from "./registry-WOJKAIRI.js";
14
+ import { B as parseBriefInput, C as conversationReportEventSchema, N as readMessageAttachments, W as readMessageCardRefs, z as conversationBriefSchema } from "./conversation-mt3yJ09u.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-qqt_2di0.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-D_cg2iqi.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";
@@ -0,0 +1,176 @@
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
+ actor: jsonb("actor_json").$type().notNull(),
156
+ credentialContext: jsonb("credential_context_json").$type(),
157
+ source: jsonb("source_json").$type().notNull(),
158
+ destination: jsonb("destination_json").$type().notNull(),
159
+ destinationVisibility: text("destination_visibility").$type(),
160
+ reasoningLevel: text("reasoning_level").$type(),
161
+ parentToolCallId: text("parent_tool_call_id"),
162
+ status: text("status").$type().notNull(),
163
+ mailboxStatus: text("mailbox_status").$type().notNull(),
164
+ parentMailboxStatus: text("parent_mailbox_status").$type(),
165
+ result: text("result"),
166
+ errorMessage: text("error_message"),
167
+ createdAt: timestamptz("created_at").notNull(),
168
+ updatedAt: timestamptz("updated_at").notNull(),
169
+ terminalAt: timestamptz("terminal_at")
170
+ }, (table) => [
171
+ index("junior_agent_invocations_child_idx").on(table.childConversationId),
172
+ index("junior_agent_invocations_mailbox_idx").on(table.mailboxStatus, table.createdAt),
173
+ index("junior_agent_invocations_parent_mailbox_idx").on(table.parentMailboxStatus, table.terminalAt)
174
+ ]);
175
+ //#endregion
176
+ 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 };