@sentry/junior 0.313.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 (108) hide show
  1. package/dist/{adapter-CYAvJzZS.js → adapter-JARQvoLw.js} +1 -2
  2. package/dist/{adapter-context-CVsHoVSf.js → adapter-context-B4BrJZuS.js} +2 -2
  3. package/dist/{admin-Cyhb4TwZ.js → admin-BXGAySz0.js} +1 -1
  4. package/dist/{agent-runner-B5y9MsT-.js → agent-runner-qZU5TR8i.js} +797 -118
  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 +334 -100
  11. package/dist/{app-DA8-hCMj.d.ts → app-D7tKnw9a.d.ts} +4 -21
  12. package/dist/app.d.ts +2 -2
  13. package/dist/app.js +80 -169
  14. package/dist/{background-compaction-queue-iZXadLV3.js → background-compaction-queue-C_uIBUvS.js} +6 -67
  15. package/dist/callback-C8SdXCwr.js +68 -0
  16. package/dist/{catalog-runtime-kkE3hvCX.js → catalog-runtime-BLKtnUL3.js} +1 -1
  17. package/dist/{channel-access-mt7K6dPh.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-CWbwKj0j.js → config-BIfHKNXN.js} +40 -35
  27. package/dist/{continue-in-slack-CxyFzdlF.js → continue-in-slack-fnmD2Ifb.js} +5 -7
  28. package/dist/{conversation-feed-BEXLD3Me.js → conversation-feed-DdFQuQDR.js} +1 -1
  29. package/dist/{logging-DNt-qOIO.js → conversation-privacy-DtZhI91r.js} +188 -2
  30. package/dist/{conversation-turn-B35eu0uz.js → conversation-turn-DScuDYmN.js} +418 -33
  31. package/dist/create-CrNt4Ewu.js +212 -0
  32. package/dist/{credential-sync-DWTOEQrm.js → credential-sync-CtqsGjj1.js} +14 -17
  33. package/dist/{credentialed-Dyv8b-lu.js → credentialed-dWRA3-oJ.js} +910 -426
  34. package/dist/{db-PwSRzWWn.js → db-BTmLKZrp.js} +2235 -38
  35. package/dist/{db-DYGcXYl3.d.ts → db-DcmzbA55.d.ts} +2 -2
  36. package/dist/{history-CYstOMKX.js → history-CneKY7_V.js} +19 -1
  37. package/dist/{html-DidUcRhI.js → html-B8rBt7F4.js} +5 -7
  38. package/dist/{install-2urLLXNt.js → install-OtFboxOM.js} +2 -2
  39. package/dist/instrumentation.js +2 -2
  40. package/dist/{lineage-BXplQAVH.js → lineage-EULJkGO1.js} +1 -2
  41. package/dist/{list-DyIyReSV.js → list-C5400AlJ.js} +235 -77
  42. package/dist/{turn-membership-DTR3SaKD.js → mailbox-turn-DL3Lvsm0.js} +4698 -587
  43. package/dist/markers-DUP8aBOp.js +323 -0
  44. package/dist/{media-B0pZJ0bG.js → media-FYM-Bl3H.js} +33 -8
  45. package/dist/{message-Z5YKC-Af.js → message-DuDelZFr.js} +16 -29
  46. package/dist/{model-input-BhPJYdSV.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-ByvDdcdY.js → oauth-callback-server-DX2fQ7Nq.js} +2 -2
  50. package/dist/{oauth-relay-D-kK0yoN.js → oauth-relay-PwPMdZJv.js} +1 -1
  51. package/dist/{plugins-Bkk0XRo2.js → plugins-BXMdNdyA.js} +1 -1
  52. package/dist/{registry-POH4bZC4.js → registry-D6kS6xYH.js} +1402 -64
  53. package/dist/{resolve-CWtBNSKP.js → resolve-D8CPJcNK.js} +3 -3
  54. package/dist/result-D090hxr5.js +402 -0
  55. package/dist/{runner-CsZ_VRxp.js → runner-BU7fgrm-.js} +7 -8
  56. package/dist/{sandbox-egress-signals-FbCk1FkN.js → sandbox-egress-signals-BUmVrsoG.js} +1 -1
  57. package/dist/{schema-DojR2uCL.js → schema-7gW9vBpJ.js} +90 -9
  58. package/dist/{schema-DBf18QPS.d.ts → schema-BB6E0wyV.d.ts} +138 -5
  59. package/dist/{service-account-CDYb9hfX.js → service-account-plA-uzIB.js} +6 -5
  60. package/dist/{skills-B0jP4whm.js → skills-CIosT6bS.js} +3 -3
  61. package/dist/{slack-conversation-unfurl-D26t9kBC.js → slack-conversation-unfurl-CBgZqth6.js} +8 -10
  62. package/dist/{spawn-BjljgExZ.js → spawn-DRjdzh3R.js} +9 -17
  63. package/dist/{start-conversation-DbVujrwO.js → start-conversation-a4NXH4X9.js} +12 -15
  64. package/dist/{store-CjXrp-Up.js → store-BuhF1QDm.js} +2 -4
  65. package/dist/{task-queue-Cwlatjz3.js → task-queue-CrRjFzOh.js} +5 -16
  66. package/dist/{task-runner--Ke8KSMf.js → task-runner-C-pXsgHM.js} +104 -50
  67. package/dist/{thread-context-B8exINEe.js → thread-context-CDX4dSZd.js} +8 -9
  68. package/dist/turn-session-routing-CZTRU8IY.js +116 -0
  69. package/dist/turn-wake-Bzq1Efrm.js +154 -0
  70. package/dist/user-customization-B27StpVQ.js +9 -0
  71. package/dist/{validation-Ce0qbMlT.js → validation-bTq88sya.js} +1 -1
  72. package/dist/{vercel-queue-q4z8w5QO.js → vercel-queue-nL0Hq3hr.js} +32 -147
  73. package/dist/{version-DFh4n9nr.js → version-DGUa1dZK.js} +1 -1
  74. package/dist/version.js +1 -1
  75. package/dist/{warmup-D5hzqTcp.js → warmup-CCOuIwAS.js} +639 -137
  76. package/dist/{worker-CDg9Lbpg.js → worker-AkZg7Dg1.js} +5 -6
  77. package/migrations/0160_money_micro_usd_repair.sql +99 -0
  78. package/migrations/0161_agent_config_backfill.sql +34 -0
  79. package/migrations/0162_inbox_item_deliveries.sql +15 -0
  80. package/migrations/0163_pg_trgm.sql +2 -0
  81. package/migrations/0164_search_indexes.sql +4 -0
  82. package/migrations/0165_drop_legacy_archive_columns.sql +4 -0
  83. package/migrations/0166_memory_prefix_index.sql +1 -0
  84. package/migrations/0167_todo_search_indexes.sql +2 -0
  85. package/migrations/0168_todo_inbox_items.sql +4 -0
  86. package/migrations/0169_drop_code_urls.sql +2 -0
  87. package/migrations/meta/0160_snapshot.json +6515 -0
  88. package/migrations/meta/0161_snapshot.json +6278 -0
  89. package/migrations/meta/0162_snapshot.json +6404 -0
  90. package/migrations/meta/0163_snapshot.json +6404 -0
  91. package/migrations/meta/0164_snapshot.json +6466 -0
  92. package/migrations/meta/0165_snapshot.json +6466 -0
  93. package/migrations/meta/0166_snapshot.json +6494 -0
  94. package/migrations/meta/0167_snapshot.json +6525 -0
  95. package/migrations/meta/0168_snapshot.json +6525 -0
  96. package/migrations/meta/0169_snapshot.json +6513 -0
  97. package/migrations/meta/_journal.json +70 -0
  98. package/package.json +9 -18
  99. package/skills/design-automation-skill/SKILL.md +2 -3
  100. package/dist/actor-BsBdxDXQ.js +0 -208
  101. package/dist/conversation-privacy-BrMiDN61.js +0 -189
  102. package/dist/executor-CgWyWfYz.js +0 -1858
  103. package/dist/fan-out-Cod-yEHG.js +0 -10
  104. package/dist/ingest-B0AggUEC.js +0 -7931
  105. package/dist/request-deadline-BUiRYQYj.js +0 -24
  106. package/dist/service-account-o15pZWcJ.js +0 -931
  107. package/dist/state-BTawTCme.js +0 -161
  108. package/dist/statuses-BKwqCPhj.js +0 -69
@@ -1,10 +1,8 @@
1
- import { E as withSpan, m as logInfo, p as logException } from "./logging-DNt-qOIO.js";
2
- import { r as getChatConfig } from "./config-CWbwKj0j.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.313.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-DFh4n9nr.js";
1
+ export { t as JUNIOR_VERSION } from "./version-DGUa1dZK.js";