@sentry/junior 0.312.0 → 0.314.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 (115) hide show
  1. package/dist/{adapter-iIq7ihf7.js → adapter-JARQvoLw.js} +1 -2
  2. package/dist/{adapter-context-BRjEWRy1.js → adapter-context-B4BrJZuS.js} +2 -2
  3. package/dist/{admin-DhInw5K9.js → admin-BXGAySz0.js} +1 -1
  4. package/dist/{agent-runner-C9iDurwX.js → agent-runner-qZU5TR8i.js} +865 -138
  5. package/dist/agent-update-cS7Z9mnG.js +26 -0
  6. package/dist/agent-update-delivery-CZ5M8RDa.js +85 -0
  7. package/dist/api/schema.d.ts +2 -2
  8. package/dist/api/schema.js +6 -6
  9. package/dist/api.d.ts +1 -1
  10. package/dist/api.js +340 -106
  11. package/dist/{app-DRFrC8Mw.d.ts → app-D7tKnw9a.d.ts} +4 -21
  12. package/dist/app.d.ts +2 -2
  13. package/dist/app.js +80 -171
  14. package/dist/{background-compaction-queue-DrKi7w3d.js → background-compaction-queue-C_uIBUvS.js} +6 -17
  15. package/dist/{callback-mFlTUWWx.js → callback-C8SdXCwr.js} +4 -11
  16. package/dist/{catalog-runtime-D7xapBAX.js → catalog-runtime-BLKtnUL3.js} +1 -1
  17. package/dist/{channel-access-CJGfNTdn.js → channel-access-BOL29BG3.js} +6 -6
  18. package/dist/child-message--2G3Ft26.js +19 -0
  19. package/dist/cli/chat.js +18 -21
  20. package/dist/cli/check.js +4 -4
  21. package/dist/cli/main.js +2 -2
  22. package/dist/cli/plugins.js +5 -5
  23. package/dist/cli/snapshot-create.js +5 -5
  24. package/dist/cli/upgrade.d.ts +1 -1
  25. package/dist/cli/upgrade.js +23 -4
  26. package/dist/{config-kXB2Y5tl.js → config-BIfHKNXN.js} +40 -35
  27. package/dist/{continue-in-slack-O6pV5004.js → continue-in-slack-fnmD2Ifb.js} +5 -7
  28. package/dist/{conversation-feed-uNOv_x68.js → conversation-feed-DdFQuQDR.js} +13 -2
  29. package/dist/{logging-dQ9ZRGQ8.js → conversation-privacy-DtZhI91r.js} +188 -2
  30. package/dist/{conversation-turn-CeLbHqdw.js → conversation-turn-DScuDYmN.js} +465 -62
  31. package/dist/create-CrNt4Ewu.js +212 -0
  32. package/dist/{credential-sync-I8VBGk05.js → credential-sync-CtqsGjj1.js} +14 -18
  33. package/dist/{credentialed-Cb6E2phL.js → credentialed-dWRA3-oJ.js} +911 -429
  34. package/dist/{db-LAyyX8tk.js → db-BTmLKZrp.js} +2245 -50
  35. package/dist/{db-BbC5stfa.d.ts → db-DcmzbA55.d.ts} +2 -2
  36. package/dist/{history-CYstOMKX.js → history-CneKY7_V.js} +19 -1
  37. package/dist/{html-BCZ3Xtb_.js → html-B8rBt7F4.js} +5 -7
  38. package/dist/{install-DCFJFkC0.js → install-OtFboxOM.js} +2 -2
  39. package/dist/instrumentation.js +2 -2
  40. package/dist/{lineage-B_m-4TJw.js → lineage-EULJkGO1.js} +1 -2
  41. package/dist/{list-CN2QA2R9.js → list-C5400AlJ.js} +284 -113
  42. package/dist/{thread-state-DhPndWi1.js → mailbox-turn-DL3Lvsm0.js} +4830 -485
  43. package/dist/markers-DUP8aBOp.js +323 -0
  44. package/dist/{media-CYm1QD8T.js → media-FYM-Bl3H.js} +42 -14
  45. package/dist/{message-DSXGj1hM.js → message-DuDelZFr.js} +16 -15
  46. package/dist/{model-input--TrP9hYV.js → model-input-0osF3pBS.js} +3 -3
  47. package/dist/nitro.d.ts +2 -4
  48. package/dist/nitro.js +340 -13
  49. package/dist/{oauth-callback-server-DHCZC6B4.js → oauth-callback-server-DX2fQ7Nq.js} +2 -2
  50. package/dist/{oauth-relay-pPMGnDZt.js → oauth-relay-PwPMdZJv.js} +1 -1
  51. package/dist/{plugins-Bkk0XRo2.js → plugins-BXMdNdyA.js} +1 -1
  52. package/dist/{registry-CZOzddwu.js → registry-D6kS6xYH.js} +1402 -64
  53. package/dist/{statuses-_cRJHXK7.js → reporting-window-C4dbzDiR.js} +1 -27
  54. package/dist/{resolve-cKOQ14Dh.js → resolve-D8CPJcNK.js} +3 -3
  55. package/dist/result-D090hxr5.js +402 -0
  56. package/dist/{runner-DBfUW44l.js → runner-BU7fgrm-.js} +7 -8
  57. package/dist/{sandbox-egress-signals-BVF_xAm1.js → sandbox-egress-signals-BUmVrsoG.js} +1 -1
  58. package/dist/{schema-Bk9Nm2E8.js → schema-7gW9vBpJ.js} +91 -10
  59. package/dist/{schema-BEHKxr4I.d.ts → schema-BB6E0wyV.d.ts} +2105 -2753
  60. package/dist/{service-account-CVYsFjty.js → service-account-plA-uzIB.js} +6 -5
  61. package/dist/{skills-VTnhAJWm.js → skills-CIosT6bS.js} +3 -3
  62. package/dist/{slack-conversation-unfurl-fuLnF1jE.js → slack-conversation-unfurl-CBgZqth6.js} +8 -10
  63. package/dist/spawn-DRjdzh3R.js +46 -0
  64. package/dist/{start-conversation-CEn2KH1A.js → start-conversation-a4NXH4X9.js} +13 -202
  65. package/dist/{store-DFZaN-Ix.js → store-BuhF1QDm.js} +2 -4
  66. package/dist/{task-queue-Cx4Lmjyk.js → task-queue-CrRjFzOh.js} +5 -16
  67. package/dist/{task-runner-CbTwFA6k.js → task-runner-C-pXsgHM.js} +105 -51
  68. package/dist/{thread-context-BkAZDTX2.js → thread-context-CDX4dSZd.js} +8 -10
  69. package/dist/turn-session-routing-CZTRU8IY.js +116 -0
  70. package/dist/turn-wake-Bzq1Efrm.js +154 -0
  71. package/dist/user-customization-B27StpVQ.js +9 -0
  72. package/dist/{validation-nIzMtAVJ.js → validation-bTq88sya.js} +1 -1
  73. package/dist/{vercel-queue-hW90XzbG.js → vercel-queue-nL0Hq3hr.js} +32 -147
  74. package/dist/{version-Brbtz4Qf.js → version-DGUa1dZK.js} +1 -1
  75. package/dist/version.js +1 -1
  76. package/dist/{warmup-BDA5myRK.js → warmup-CCOuIwAS.js} +831 -3254
  77. package/dist/{worker-D63RcaVD.js → worker-AkZg7Dg1.js} +5 -6
  78. package/migrations/0158_keep_legacy_archive_columns.sql +5 -0
  79. package/migrations/0159_conversation_embeddings_fk_validate.sql +5 -0
  80. package/migrations/0160_money_micro_usd_repair.sql +99 -0
  81. package/migrations/0161_agent_config_backfill.sql +34 -0
  82. package/migrations/0162_inbox_item_deliveries.sql +15 -0
  83. package/migrations/0163_pg_trgm.sql +2 -0
  84. package/migrations/0164_search_indexes.sql +4 -0
  85. package/migrations/0165_drop_legacy_archive_columns.sql +4 -0
  86. package/migrations/0166_memory_prefix_index.sql +1 -0
  87. package/migrations/0167_todo_search_indexes.sql +2 -0
  88. package/migrations/0168_todo_inbox_items.sql +4 -0
  89. package/migrations/0169_drop_code_urls.sql +2 -0
  90. package/migrations/meta/0158_snapshot.json +6515 -0
  91. package/migrations/meta/0159_snapshot.json +6515 -0
  92. package/migrations/meta/0160_snapshot.json +6515 -0
  93. package/migrations/meta/0161_snapshot.json +6278 -0
  94. package/migrations/meta/0162_snapshot.json +6404 -0
  95. package/migrations/meta/0163_snapshot.json +6404 -0
  96. package/migrations/meta/0164_snapshot.json +6466 -0
  97. package/migrations/meta/0165_snapshot.json +6466 -0
  98. package/migrations/meta/0166_snapshot.json +6494 -0
  99. package/migrations/meta/0167_snapshot.json +6525 -0
  100. package/migrations/meta/0168_snapshot.json +6525 -0
  101. package/migrations/meta/0169_snapshot.json +6513 -0
  102. package/migrations/meta/_journal.json +84 -0
  103. package/package.json +9 -18
  104. package/skills/design-automation-skill/SKILL.md +2 -3
  105. package/dist/actor-BsBdxDXQ.js +0 -208
  106. package/dist/child-message-DcsritGf.js +0 -179
  107. package/dist/conversation-privacy-L4ja1_W6.js +0 -189
  108. package/dist/executor-SCub-fAq.js +0 -1860
  109. package/dist/fan-out-Cod-yEHG.js +0 -10
  110. package/dist/ingest-BDf3D50j.js +0 -3836
  111. package/dist/result-DcvEOe1r.js +0 -574
  112. package/dist/result-event-type-BdIJuZxg.js +0 -48
  113. package/dist/service-account-Ts4ulcrV.js +0 -931
  114. package/dist/spawn-vxAarlX5.js +0 -73
  115. package/dist/state-C1P3_Ywk.js +0 -161
@@ -1,10 +1,8 @@
1
- import { E as withSpan, m as logInfo, p as logException } from "./logging-dQ9ZRGQ8.js";
2
- import { r as getChatConfig } from "./config-kXB2Y5tl.js";
3
- import "./fan-out-Cod-yEHG.js";
1
+ import { F as withSpan } from "./conversation-privacy-DtZhI91r.js";
2
+ import { r as getChatConfig } from "./config-BIfHKNXN.js";
4
3
  import * as z from "zod";
5
- import pLimit from "p-limit";
6
- import { createHash, createHmac, timingSafeEqual } from "node:crypto";
7
- import { QueueClient, handleCallback, registerDevConsumer } from "@vercel/queue";
4
+ import { createHmac, timingSafeEqual } from "node:crypto";
5
+ import { PollingQueueClient, QueueClient } from "@vercel/queue";
8
6
  // src/chat/secrets.ts
9
7
  /** Read the server secret that signs internal tokens and payloads. */
10
8
  function readJuniorSecret() {
@@ -22,141 +20,36 @@ function readSchedulerSecret() {
22
20
  function readWebPushPrivateKey() {
23
21
  return process.env["JUNIOR_WEB_PUSH_PRIVATE_KEY"]?.trim();
24
22
  }
25
- // src/chat/queue/bullmq.ts
26
- const MAX_ATTEMPTS = 50;
27
- const MAX_BACKOFF_MS = 3e4;
28
- const COMPLETED_JOB_AGE_SECONDS = 3600;
29
- const FAILED_JOB_AGE_SECONDS = 86400;
30
- /**
31
- * Import a module by a name held in a variable.
32
- *
33
- * Bundlers follow a literal `import("bullmq")` and put BullMQ into the
34
- * production server, even though production never selects this provider.
35
- * Node resolves this import when the app runs instead.
36
- */
37
- function importAtRuntime(specifier) {
38
- return import(
39
- /* @vite-ignore */
40
- specifier
41
- );
42
- }
43
- function bullmqConfig() {
44
- const config = getChatConfig().queue;
45
- if (config.provider !== "bullmq") throw new Error("The BullMQ queue provider is not configured");
46
- return config;
47
- }
48
- /** Load BullMQ and open a Redis client that the caller must close. */
49
- async function connect() {
50
- const [bullmq, redis] = await Promise.all([importAtRuntime("bullmq"), importAtRuntime("redis")]).catch((error) => {
51
- throw new Error("JUNIOR_QUEUE_PROVIDER=bullmq needs the bullmq and redis packages installed", { cause: error });
52
- });
53
- const client = redis.createClient({ url: bullmqConfig().redisUrl });
54
- try {
55
- await client.connect();
56
- return {
57
- bullmq,
58
- connection: bullmq.createNodeRedisClient(client)
59
- };
60
- } catch (error) {
61
- client.destroy();
62
- throw error;
63
- }
64
- }
65
- /** BullMQ job ids must not contain ":", and Junior's keys do. */
66
- function toJobId(idempotencyKey) {
67
- return `k-${createHash("sha256").update(idempotencyKey).digest("base64url")}`;
68
- }
69
- function metadataFor(job, consumer) {
70
- return {
71
- consumerGroup: consumer.consumerGroup,
72
- createdAt: new Date(job.timestamp),
73
- deliveryCount: job.attemptsMade + 1,
74
- messageId: job.id ?? "",
75
- topicName: consumer.topic
76
- };
77
- }
78
- async function processJob(job, consumer) {
79
- const { payload, retentionSeconds } = job.data;
80
- if (retentionSeconds !== void 0 && Date.now() - job.timestamp > retentionSeconds * 1e3) return;
81
- const metadata = metadataFor(job, consumer);
82
- try {
83
- await consumer.handler(payload, metadata);
84
- } catch (error) {
85
- if (consumer.retry(error, metadata)?.acknowledge) return;
86
- throw error;
87
- }
88
- }
89
- /** Start one BullMQ worker for each consumer, on a Redis client it owns. */
90
- async function startWorker(consumers) {
91
- const { bullmq, connection } = await connect();
92
- const concurrency = bullmqConfig().workerConcurrency;
93
- const workers = consumers.map((consumer) => {
94
- const worker = new bullmq.Worker(consumer.topic, (job) => processJob(job, consumer), {
95
- concurrency,
96
- connection,
97
- ...consumer.visibilityTimeoutSeconds !== void 0 && { lockDuration: consumer.visibilityTimeoutSeconds * 1e3 },
98
- settings: { backoffStrategy: (attemptsMade) => Math.min(1e3 * 2 ** (attemptsMade - 1), MAX_BACKOFF_MS) }
99
- });
100
- worker.on("error", (error) => {
101
- logException(error, "queue.bullmq.worker.exception", { "messaging.destination.name": consumer.topic });
102
- });
103
- return worker;
104
- });
105
- logInfo("queue.bullmq.worker.started", {
106
- "app.queue.worker_concurrency": concurrency,
107
- "messaging.destination.names": consumers.map((consumer) => consumer.topic)
108
- });
109
- return { close: async () => {
110
- try {
111
- const limit = pLimit(8);
112
- const failures = (await Promise.allSettled(workers.map((worker) => limit(() => worker.close())))).flatMap((result) => result.status === "rejected" ? [result.reason] : []);
113
- if (failures.length > 0) throw new AggregateError(failures, "BullMQ workers did not close");
114
- } finally {
115
- await connection.quit();
116
- }
117
- } };
118
- }
119
- /** Add one job on a Redis client that is open only for this send. */
120
- async function send(topic, payload, options = {}) {
121
- const { bullmq, connection } = await connect();
122
- const queue = new bullmq.Queue(topic, { connection });
123
- try {
124
- const job = await queue.add(topic, {
125
- payload,
126
- retentionSeconds: options.retentionSeconds
127
- }, {
128
- attempts: MAX_ATTEMPTS,
129
- backoff: { type: "custom" },
130
- delay: options.delaySeconds ? options.delaySeconds * 1e3 : void 0,
131
- jobId: options.idempotencyKey ? toJobId(options.idempotencyKey) : void 0,
132
- removeOnComplete: { age: COMPLETED_JOB_AGE_SECONDS },
133
- removeOnFail: { age: FAILED_JOB_AGE_SECONDS }
134
- });
135
- return job.id ? { messageId: job.id } : {};
136
- } finally {
137
- try {
138
- await queue.close();
139
- } finally {
140
- await connection.quit();
141
- }
142
- }
143
- }
144
- /** Queue provider backed by BullMQ, for local development only. */
145
- const bullmqQueueProvider = {
146
- messagingSystem: "bullmq",
147
- send,
148
- createCallback: () => async () => new Response("This queue provider does not push messages", { status: 404 }),
149
- startWorker
150
- };
151
23
  // src/chat/queue/vercel.ts
152
24
  function defaultQueueClientOptions() {
25
+ const { apiUrl } = getChatConfig().queue;
26
+ if (apiUrl) return {
27
+ deploymentId: null,
28
+ resolveBaseUrl: () => new URL(apiUrl),
29
+ token: "local"
30
+ };
153
31
  if (process.env["VERCEL_DEPLOYMENT_ID"]?.trim()) return {};
154
32
  return { deploymentId: null };
155
33
  }
156
- let client;
157
- function getVercelQueueClient() {
158
- client ??= new QueueClient(defaultQueueClientOptions());
159
- return client;
34
+ function vercelQueueClients() {
35
+ const options = defaultQueueClientOptions();
36
+ const client = new QueueClient(options);
37
+ if (!options?.resolveBaseUrl) return {
38
+ callbacks: client,
39
+ send: client.send
40
+ };
41
+ return {
42
+ callbacks: client,
43
+ send: new PollingQueueClient({
44
+ ...options,
45
+ region: "iad1"
46
+ }).send
47
+ };
48
+ }
49
+ let clients;
50
+ function getVercelQueueClients() {
51
+ clients ??= vercelQueueClients();
52
+ return clients;
160
53
  }
161
54
  function visibility(consumer) {
162
55
  return consumer.visibilityTimeoutSeconds === void 0 ? {} : { visibilityTimeoutSeconds: consumer.visibilityTimeoutSeconds };
@@ -165,26 +58,18 @@ function visibility(consumer) {
165
58
  const vercelQueueProvider = {
166
59
  messagingSystem: "vercel_queue",
167
60
  send: async (topic, payload, options) => {
168
- const { messageId } = await getVercelQueueClient().send(topic, payload, options);
61
+ const { messageId } = await getVercelQueueClients().send(topic, payload, options);
169
62
  return messageId ? { messageId } : {};
170
63
  },
171
- createCallback: (consumer) => handleCallback(consumer.handler, {
172
- retry: consumer.retry,
173
- ...visibility(consumer)
174
- }),
175
- registerDevConsumer: (consumer) => registerDevConsumer({
176
- client: getVercelQueueClient(),
177
- consumerGroup: consumer.consumerGroup,
178
- handler: consumer.handler,
64
+ createCallback: (consumer) => getVercelQueueClients().callbacks.handleCallback(consumer.handler, {
179
65
  retry: consumer.retry,
180
- topic: consumer.topic,
181
66
  ...visibility(consumer)
182
67
  })
183
68
  };
184
69
  // src/chat/queue/provider.ts
185
70
  /** Return the queue provider for this deployment. */
186
71
  function getQueueProvider() {
187
- return getChatConfig().queue.provider === "bullmq" ? bullmqQueueProvider : vercelQueueProvider;
72
+ return vercelQueueProvider;
188
73
  }
189
74
  // src/chat/queue/sign.ts
190
75
  /** Sign and check queue messages before public callbacks run them. */
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.312.0";
2
+ var version = "0.314.0";
3
3
  // src/version.ts
4
4
  /** Installed Junior package version, or `unknown` when package metadata is unavailable. */
5
5
  const JUNIOR_VERSION = typeof version === "string" && version.trim() ? version : "unknown";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export { t as JUNIOR_VERSION } from "./version-Brbtz4Qf.js";
1
+ export { t as JUNIOR_VERSION } from "./version-DGUa1dZK.js";