@sentry/junior 0.300.0 → 0.302.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.
- package/dist/adapter-context-Cx9fn9B3.js +43 -0
- package/dist/{admin-UrTniSPO.js → admin-_poE5NKL.js} +2 -2
- package/dist/{agent-runner-bY4_0UPm.js → agent-runner-CY9RvsTX.js} +1367 -10649
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +6 -7
- package/dist/api.d.ts +1 -1
- package/dist/api.js +124 -67
- package/dist/{app-D-AcIcCV.d.ts → app-BpY3wtRP.d.ts} +3 -3
- package/dist/app.d.ts +1 -1
- package/dist/app.js +71 -299
- package/dist/{automation-Dw82oQ-h.js → automation-Cva5ZOwW.js} +1 -1
- package/dist/{background-compaction-queue-B6U3060-.js → background-compaction-queue-CXFq1_Cz.js} +94 -203
- package/dist/{briefs-DqiwWu-n.js → briefs-B3NG-pid.js} +3 -3
- package/dist/{catalog-runtime-D1oYNv04.js → catalog-runtime-Dss0lSV6.js} +1 -1
- package/dist/cli/chat.js +15 -15
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -3
- package/dist/{config-9nHoFiJP.js → config-CzeZiMKs.js} +2 -2
- package/dist/{connections-DZjTN3JC.js → connections-CDYhMfrs.js} +6 -6
- package/dist/{continue-in-slack-Dtv7_U42.js → continue-in-slack-7Uf05ndC.js} +5 -6
- package/dist/{conversation-Dyjq2CZ8.js → conversation-BNXfq6Lb.js} +11 -1
- package/dist/{conversation-feed-CcDxlrlQ.js → conversation-feed-Clf_cv0n.js} +2 -1
- package/dist/{conversation-privacy-D-5HTXjS.js → conversation-privacy-D9xnM5mK.js} +1 -1
- package/dist/{conversation-turn-Cxl8WZD7.js → conversation-turn-D7SEZgTG.js} +16 -17
- package/dist/{credential-sync-C49ClwDX.js → credential-sync-DoD0gW-j.js} +13 -15
- package/dist/{db-BJNo6fK5.js → db-B-gtnNjr.js} +314 -5
- package/dist/{db-2resqBh1.d.ts → db-BdsCzytP.d.ts} +1 -1
- package/dist/{executor-DBIaOeJ_.js → executor-DZg20EqU.js} +39 -4
- package/dist/install-t1KQyTUs.js +228 -0
- package/dist/instrumentation.js +2 -2
- package/dist/{state-zSilNpbi.js → legacy-web-actor-id-C-cEeWqL.js} +33 -4
- package/dist/{lineage-0dereG7H.js → lineage-C79GjoQr.js} +2 -2
- package/dist/{logging-BIclibct.js → logging-C9oDAg4M.js} +7 -3
- package/dist/{message-dkOl-Iii.js → message-BLUCzJXN.js} +8 -8
- package/dist/{model-input-CLo9TaUd.js → model-input-5jwNC45G.js} +3 -3
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +4 -3
- package/dist/{oauth-callback-server-WmpjfJgQ.js → oauth-callback-server-BBl66vCb.js} +2 -2
- package/dist/{projection-w_X-zi7v.js → projection-CIBwgD3s.js} +437 -97
- package/dist/{prompt-B1Xw46-S.js → prompt-CRQbzp5e.js} +15 -5
- package/dist/queue-DtCDaIct.js +115 -0
- package/dist/{registry-BmP5vnlj.js → registry-DdFQHZ_d.js} +1 -1
- package/dist/{resolve-goo34bJK.js → resolve-CdW4BdrK.js} +4 -229
- package/dist/{result-PVBeU0Wf.js → result-oOMv1t4O.js} +9 -9
- package/dist/{runner-DKrfvNV6.js → runner-DqitLtm-.js} +9 -9
- package/dist/{sandbox-egress-signals-DsUcqrI0.js → sandbox-egress-signals-Bw9I0yfJ.js} +1 -1
- package/dist/{schema-Dns-sTas.d.ts → schema-BIFM-U1a.d.ts} +470 -30
- package/dist/{schema-C9iNFz5n.js → schema-DnVQepWP.js} +76 -31
- package/dist/{service-account-CMAAloAL.js → service-account-B6mKAPVo.js} +3 -3
- package/dist/{service-account-CmowamcB.js → service-account-CrZftRTb.js} +257 -6
- package/dist/{session-stop-BcAXze8a.js → session-stop-DW63Z3kj.js} +1103 -1007
- package/dist/{skills-DfsazET6.js → skills-C16fz60Z.js} +2 -2
- package/dist/{slack-conversation-unfurl-CzQonuWz.js → slack-conversation-unfurl-BHhefEb7.js} +8 -7
- package/dist/{spawn-C7o0FDDp.js → spawn-D_RnFYfy.js} +6 -6
- package/dist/{stop-CFOujp8C.js → stop-7p1i08CY.js} +941 -2311
- package/dist/{store-E3x2Fg_F.js → store-C28I0CVW.js} +5 -5
- package/dist/{task-queue-D-hCqdZW.js → task-queue-BVUJbQ28.js} +3 -3
- package/dist/{task-runner-vohUPLHe.js → task-runner-CWi8j7Z6.js} +6 -8
- package/dist/{thread-context-BzvdkgI9.js → thread-context-D3-yYUd0.js} +8 -8
- package/dist/{store-Dkeis_8o.js → turn-session-routing-BFMS9ATF.js} +382 -11
- package/dist/{turn-user-message-D5RnVmxQ.js → turn-user-message-C3-O8Omt.js} +3 -3
- package/dist/{validation-BbWikeSa.js → validation-BSFKUIb4.js} +1 -1
- package/dist/{version-GVBMW2jA.js → version-BHHXNi-0.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-BpxRliyO.js → viewer-B1SO21Qa.js} +3 -3
- package/dist/warmup-Bz9bzkzN.js +13927 -0
- package/dist/{statuses-Hn-HsOph.js → web-message-id-lNodcCOI.js} +136 -1
- package/dist/{worker-Cbd-iuwZ.js → worker-BspReIIK.js} +7 -7
- package/migrations/0108_conversation_embeddings.sql +13 -0
- package/migrations/meta/0108_snapshot.json +4688 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +10 -8
- package/dist/adapter-S5UkjNK3.js +0 -303
- package/dist/reporting-window-DopzcOHh.js +0 -137
- package/dist/turn-session-routing-Bo_LxFum.js +0 -380
- package/dist/users-2bggndVg.js +0 -424
- package/dist/warmup-BW2qwnal.js +0 -3693
package/dist/{background-compaction-queue-B6U3060-.js → background-compaction-queue-CXFq1_Cz.js}
RENAMED
|
@@ -1,10 +1,50 @@
|
|
|
1
|
-
import { i as getChatConfig } from "./config-
|
|
2
|
-
import { E as withSpan,
|
|
1
|
+
import { i as getChatConfig } from "./config-CzeZiMKs.js";
|
|
2
|
+
import { E as withSpan, m as logInfo, p as logException } from "./logging-C9oDAg4M.js";
|
|
3
3
|
import { t as readJuniorSecret } from "./secrets-DebYU866.js";
|
|
4
4
|
import * as z from "zod";
|
|
5
5
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
6
|
import { createHash, createHmac, timingSafeEqual } from "node:crypto";
|
|
7
7
|
import { QueueClient, handleCallback, registerDevConsumer } from "@vercel/queue";
|
|
8
|
+
/** Validate the v2 conversation work hint sent through Vercel Queue. */
|
|
9
|
+
const conversationQueueMessageSchema = z.object({
|
|
10
|
+
schemaVersion: z.literal(2),
|
|
11
|
+
conversationId: z.string().trim().min(1)
|
|
12
|
+
}).strict();
|
|
13
|
+
var ConversationQueueMessageRejectedError = class extends Error {
|
|
14
|
+
conversationId;
|
|
15
|
+
reason;
|
|
16
|
+
constructor(reason, message, options = {}) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.name = "ConversationQueueMessageRejectedError";
|
|
19
|
+
this.reason = reason;
|
|
20
|
+
this.conversationId = options.conversationId;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
/** Return whether an error means the queue message was permanently rejected. */
|
|
24
|
+
function isConversationQueueMessageRejectedError(error) {
|
|
25
|
+
return error instanceof ConversationQueueMessageRejectedError;
|
|
26
|
+
}
|
|
27
|
+
/** Build the idempotency key of a wake that one worker event sends. */
|
|
28
|
+
function nudgeIdempotencyKey(reason, conversationId, nowMs) {
|
|
29
|
+
return `${reason}:${conversationId}:${nowMs}`;
|
|
30
|
+
}
|
|
31
|
+
// src/chat/runtime/request-deadline.ts
|
|
32
|
+
const requestDeadlineStorage = new AsyncLocalStorage();
|
|
33
|
+
function createTurnRequestDeadline(startedAtMs) {
|
|
34
|
+
return {
|
|
35
|
+
startedAtMs,
|
|
36
|
+
deadlineAtMs: startedAtMs + Math.max(1, getChatConfig().functionMaxDurationSeconds * 1e3 - 2e4)
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** Return the host request deadline inherited by the current async turn. */
|
|
40
|
+
function getTurnRequestDeadline() {
|
|
41
|
+
return requestDeadlineStorage.getStore();
|
|
42
|
+
}
|
|
43
|
+
/** Run work with one host request deadline shared by nested queued turns. */
|
|
44
|
+
function runWithTurnRequestDeadline(callback, startedAtMs = Date.now()) {
|
|
45
|
+
if (requestDeadlineStorage.getStore()) return callback();
|
|
46
|
+
return requestDeadlineStorage.run(createTurnRequestDeadline(startedAtMs), callback);
|
|
47
|
+
}
|
|
8
48
|
// src/chat/queue/bullmq.ts
|
|
9
49
|
const MAX_ATTEMPTS = 50;
|
|
10
50
|
const MAX_BACKOFF_MS = 3e4;
|
|
@@ -99,7 +139,7 @@ async function startWorker(consumers) {
|
|
|
99
139
|
} };
|
|
100
140
|
}
|
|
101
141
|
/** Add one job on a Redis client that is open only for this send. */
|
|
102
|
-
async function send
|
|
142
|
+
async function send(topic, payload, options = {}) {
|
|
103
143
|
const { bullmq, connection } = await connect();
|
|
104
144
|
const queue = new bullmq.Queue(topic, { connection });
|
|
105
145
|
try {
|
|
@@ -126,7 +166,7 @@ async function send$1(topic, payload, options = {}) {
|
|
|
126
166
|
/** Queue provider backed by BullMQ, for local development only. */
|
|
127
167
|
const bullmqQueueProvider = {
|
|
128
168
|
messagingSystem: "bullmq",
|
|
129
|
-
send
|
|
169
|
+
send,
|
|
130
170
|
createCallback: () => async () => new Response("This queue provider does not push messages", { status: 404 }),
|
|
131
171
|
startWorker
|
|
132
172
|
};
|
|
@@ -168,73 +208,6 @@ const vercelQueueProvider = {
|
|
|
168
208
|
function getQueueProvider() {
|
|
169
209
|
return getChatConfig().queue.provider === "bullmq" ? bullmqQueueProvider : vercelQueueProvider;
|
|
170
210
|
}
|
|
171
|
-
// src/chat/runtime/request-deadline.ts
|
|
172
|
-
const requestDeadlineStorage = new AsyncLocalStorage();
|
|
173
|
-
function createTurnRequestDeadline(startedAtMs) {
|
|
174
|
-
return {
|
|
175
|
-
startedAtMs,
|
|
176
|
-
deadlineAtMs: startedAtMs + Math.max(1, getChatConfig().functionMaxDurationSeconds * 1e3 - 2e4)
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
/** Return the host request deadline inherited by the current async turn. */
|
|
180
|
-
function getTurnRequestDeadline() {
|
|
181
|
-
return requestDeadlineStorage.getStore();
|
|
182
|
-
}
|
|
183
|
-
/** Run work with one host request deadline shared by nested queued turns. */
|
|
184
|
-
function runWithTurnRequestDeadline(callback, startedAtMs = Date.now()) {
|
|
185
|
-
if (requestDeadlineStorage.getStore()) return callback();
|
|
186
|
-
return requestDeadlineStorage.run(createTurnRequestDeadline(startedAtMs), callback);
|
|
187
|
-
}
|
|
188
|
-
// src/chat/queue/callback.ts
|
|
189
|
-
/** Shared queue callback wiring for signed messages. */
|
|
190
|
-
/** Build the HTTP callback and local-dev consumer for one signed queue. */
|
|
191
|
-
function queueCallback(options) {
|
|
192
|
-
const consume = async (message, metadata) => {
|
|
193
|
-
if (options.skip?.(metadata)) return;
|
|
194
|
-
try {
|
|
195
|
-
await runWithTurnRequestDeadline(() => options.run(message, metadata));
|
|
196
|
-
} catch (error) {
|
|
197
|
-
const reason = options.permanentError?.(error);
|
|
198
|
-
if (!reason) throw error;
|
|
199
|
-
options.onRejected(reason, metadata, error);
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
const handler = async (value, metadata) => {
|
|
203
|
-
if (options.skip?.(metadata)) return;
|
|
204
|
-
const checked = options.verify(value);
|
|
205
|
-
if (checked.status === "rejected") {
|
|
206
|
-
options.onRejected(checked.reason, metadata);
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
if (checked.status === "unavailable") throw new Error(`Queue message verification unavailable: ${checked.reason}`);
|
|
210
|
-
await consume(checked.message, metadata);
|
|
211
|
-
};
|
|
212
|
-
const retry = (error, metadata) => {
|
|
213
|
-
const reason = options.permanentError?.(error);
|
|
214
|
-
if (reason) {
|
|
215
|
-
options.onRejected(reason, metadata, error);
|
|
216
|
-
return { acknowledge: true };
|
|
217
|
-
}
|
|
218
|
-
if (options.maxDeliveries !== null && metadata.deliveryCount >= options.maxDeliveries) return { acknowledge: true };
|
|
219
|
-
};
|
|
220
|
-
const consumer = {
|
|
221
|
-
consumerGroup: options.consumerGroup,
|
|
222
|
-
handler,
|
|
223
|
-
retry,
|
|
224
|
-
topic: options.topic,
|
|
225
|
-
visibilityTimeoutSeconds: options.visibilityTimeoutSeconds
|
|
226
|
-
};
|
|
227
|
-
return {
|
|
228
|
-
/** Run a message that an in-process queue already trusts. */
|
|
229
|
-
consume,
|
|
230
|
-
consumer,
|
|
231
|
-
create: () => getQueueProvider().createCallback(consumer),
|
|
232
|
-
registerDev: () => {
|
|
233
|
-
if (process.env.NODE_ENV !== "development") return;
|
|
234
|
-
return getQueueProvider().registerDevConsumer?.(consumer);
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
211
|
// src/chat/queue/sign.ts
|
|
239
212
|
/** Sign and check queue messages before public callbacks run them. */
|
|
240
213
|
const QUEUE_SIGNATURE_MAX_AGE_MS = 36e5;
|
|
@@ -318,100 +291,6 @@ function verifyQueueMessage(config, value, nowMs = Date.now()) {
|
|
|
318
291
|
message: message.data
|
|
319
292
|
};
|
|
320
293
|
}
|
|
321
|
-
// src/chat/cache-warming/queue.ts
|
|
322
|
-
/** Send and receive delayed cache warmup messages. */
|
|
323
|
-
/** Deploy topic name. Keep stable for Vercel queue wiring. */
|
|
324
|
-
const CACHE_WARMUP_QUEUE_TOPIC = "junior_cache_warmups";
|
|
325
|
-
const CACHE_WARMUP_DEV_CONSUMER_GROUP = "junior_cache_warmups_dev";
|
|
326
|
-
const cacheWarmupSign = {
|
|
327
|
-
context: "junior.cache_warmup_queue.v1",
|
|
328
|
-
schema: z.discriminatedUnion("kind", [z.object({
|
|
329
|
-
kind: z.literal("warmup"),
|
|
330
|
-
conversationId: z.string().min(1),
|
|
331
|
-
cycle: z.number().int().positive(),
|
|
332
|
-
generation: z.string().min(1),
|
|
333
|
-
cacheExpiresAtMs: z.number().int().positive()
|
|
334
|
-
}).strict(), z.object({
|
|
335
|
-
kind: z.literal("horizon"),
|
|
336
|
-
conversationId: z.string().min(1),
|
|
337
|
-
generation: z.string().min(1)
|
|
338
|
-
}).strict()]),
|
|
339
|
-
signatureVersion: "v1",
|
|
340
|
-
parts: (message) => [
|
|
341
|
-
message.kind,
|
|
342
|
-
message.conversationId,
|
|
343
|
-
message.generation,
|
|
344
|
-
message.kind === "warmup" ? String(message.cycle) : "",
|
|
345
|
-
message.kind === "warmup" ? String(message.cacheExpiresAtMs) : ""
|
|
346
|
-
]
|
|
347
|
-
};
|
|
348
|
-
/** Send a cache warming message that is delivered after `delayMs`. */
|
|
349
|
-
async function sendCacheWarmup(message, delayMs) {
|
|
350
|
-
await getQueueProvider().send(CACHE_WARMUP_QUEUE_TOPIC, signQueueMessage(cacheWarmupSign, message), {
|
|
351
|
-
delaySeconds: Math.max(0, Math.floor(delayMs / 1e3)),
|
|
352
|
-
retentionSeconds: message.kind === "warmup" ? Math.min(QUEUE_SIGNATURE_MAX_AGE_MS / 1e3, Math.ceil(Math.max(0, delayMs) / 1e3) + 120) : QUEUE_SIGNATURE_MAX_AGE_MS / 1e3,
|
|
353
|
-
idempotencyKey: `cache-warmup_${message.generation}_${message.kind === "warmup" ? message.cycle : message.kind}`
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
function logCacheWarmupRejected(reason, metadata, error) {
|
|
357
|
-
logWarn("cache_warming.queue_message.rejected", {
|
|
358
|
-
"app.queue.consumer_group": metadata.consumerGroup,
|
|
359
|
-
"app.queue.delivery_count": metadata.deliveryCount,
|
|
360
|
-
"app.queue.message_id": metadata.messageId,
|
|
361
|
-
"app.queue.reject_reason": reason,
|
|
362
|
-
"app.queue.topic_name": metadata.topicName,
|
|
363
|
-
...error instanceof Error ? { "exception.message": error.message } : void 0
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
function cacheWarmupCallback() {
|
|
367
|
-
return queueCallback({
|
|
368
|
-
consumerGroup: CACHE_WARMUP_DEV_CONSUMER_GROUP,
|
|
369
|
-
maxDeliveries: 1,
|
|
370
|
-
onRejected: logCacheWarmupRejected,
|
|
371
|
-
run: async (message) => {
|
|
372
|
-
const { runCacheWarmup } = await import("./warmup-BW2qwnal.js").then((n) => n.o);
|
|
373
|
-
await runCacheWarmup(message);
|
|
374
|
-
},
|
|
375
|
-
skip: () => !getChatConfig().cacheWarmingEnabled,
|
|
376
|
-
topic: CACHE_WARMUP_QUEUE_TOPIC,
|
|
377
|
-
verify: (value) => verifyQueueMessage(cacheWarmupSign, value)
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
/** Create the HTTP route for cache warmup messages. */
|
|
381
|
-
function createVercelCacheWarmupCallback() {
|
|
382
|
-
return cacheWarmupCallback().create();
|
|
383
|
-
}
|
|
384
|
-
/** Return the queue consumer for cache warmups, for a pulling queue worker. */
|
|
385
|
-
function cacheWarmupQueueConsumer() {
|
|
386
|
-
return cacheWarmupCallback().consumer;
|
|
387
|
-
}
|
|
388
|
-
/** Receive cache warmup messages during local development. */
|
|
389
|
-
function registerVercelCacheWarmupDevConsumer() {
|
|
390
|
-
return cacheWarmupCallback().registerDev();
|
|
391
|
-
}
|
|
392
|
-
/** Validate the v2 conversation work hint sent through Vercel Queue. */
|
|
393
|
-
const conversationQueueMessageSchema = z.object({
|
|
394
|
-
schemaVersion: z.literal(2),
|
|
395
|
-
conversationId: z.string().trim().min(1)
|
|
396
|
-
}).strict();
|
|
397
|
-
var ConversationQueueMessageRejectedError = class extends Error {
|
|
398
|
-
conversationId;
|
|
399
|
-
reason;
|
|
400
|
-
constructor(reason, message, options = {}) {
|
|
401
|
-
super(message);
|
|
402
|
-
this.name = "ConversationQueueMessageRejectedError";
|
|
403
|
-
this.reason = reason;
|
|
404
|
-
this.conversationId = options.conversationId;
|
|
405
|
-
}
|
|
406
|
-
};
|
|
407
|
-
/** Return whether an error means the queue message was permanently rejected. */
|
|
408
|
-
function isConversationQueueMessageRejectedError(error) {
|
|
409
|
-
return error instanceof ConversationQueueMessageRejectedError;
|
|
410
|
-
}
|
|
411
|
-
/** Build the idempotency key of a wake that one worker event sends. */
|
|
412
|
-
function nudgeIdempotencyKey(reason, conversationId, nowMs) {
|
|
413
|
-
return `${reason}:${conversationId}:${nowMs}`;
|
|
414
|
-
}
|
|
415
294
|
// src/chat/task-execution/queue-signing.ts
|
|
416
295
|
const conversationQueueSign = {
|
|
417
296
|
context: "junior.conversation_work_queue.v2",
|
|
@@ -466,43 +345,55 @@ function getVercelConversationWorkQueue() {
|
|
|
466
345
|
defaultQueue ??= createVercelConversationWorkQueue();
|
|
467
346
|
return defaultQueue;
|
|
468
347
|
}
|
|
469
|
-
// src/chat/
|
|
470
|
-
/**
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
const
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
};
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
348
|
+
// src/chat/queue/callback.ts
|
|
349
|
+
/** Shared queue callback wiring for signed messages. */
|
|
350
|
+
/** Build the HTTP callback and local-dev consumer for one signed queue. */
|
|
351
|
+
function queueCallback(options) {
|
|
352
|
+
const consume = async (message, metadata) => {
|
|
353
|
+
if (options.skip?.(metadata)) return;
|
|
354
|
+
try {
|
|
355
|
+
await runWithTurnRequestDeadline(() => options.run(message, metadata));
|
|
356
|
+
} catch (error) {
|
|
357
|
+
const reason = options.permanentError?.(error);
|
|
358
|
+
if (!reason) throw error;
|
|
359
|
+
options.onRejected(reason, metadata, error);
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
const handler = async (value, metadata) => {
|
|
363
|
+
if (options.skip?.(metadata)) return;
|
|
364
|
+
const checked = options.verify(value);
|
|
365
|
+
if (checked.status === "rejected") {
|
|
366
|
+
options.onRejected(checked.reason, metadata);
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
if (checked.status === "unavailable") throw new Error(`Queue message verification unavailable: ${checked.reason}`);
|
|
370
|
+
await consume(checked.message, metadata);
|
|
371
|
+
};
|
|
372
|
+
const retry = (error, metadata) => {
|
|
373
|
+
const reason = options.permanentError?.(error);
|
|
374
|
+
if (reason) {
|
|
375
|
+
options.onRejected(reason, metadata, error);
|
|
376
|
+
return { acknowledge: true };
|
|
377
|
+
}
|
|
378
|
+
if (options.maxDeliveries !== null && metadata.deliveryCount >= options.maxDeliveries) return { acknowledge: true };
|
|
379
|
+
};
|
|
380
|
+
const consumer = {
|
|
381
|
+
consumerGroup: options.consumerGroup,
|
|
382
|
+
handler,
|
|
383
|
+
retry,
|
|
384
|
+
topic: options.topic,
|
|
385
|
+
visibilityTimeoutSeconds: options.visibilityTimeoutSeconds
|
|
386
|
+
};
|
|
387
|
+
return {
|
|
388
|
+
/** Run a message that an in-process queue already trusts. */
|
|
389
|
+
consume,
|
|
390
|
+
consumer,
|
|
391
|
+
create: () => getQueueProvider().createCallback(consumer),
|
|
392
|
+
registerDev: () => {
|
|
393
|
+
if (process.env.NODE_ENV !== "development") return;
|
|
394
|
+
return getQueueProvider().registerDevConsumer?.(consumer);
|
|
395
|
+
}
|
|
396
|
+
};
|
|
506
397
|
}
|
|
507
398
|
// src/chat/services/background-compaction-queue.ts
|
|
508
399
|
/**
|
|
@@ -543,4 +434,4 @@ const vercelBackgroundCompactionQueue = { send: async (message) => {
|
|
|
543
434
|
retentionSeconds: QUEUE_SIGNATURE_MAX_AGE_MS / 1e3
|
|
544
435
|
});
|
|
545
436
|
} };
|
|
546
|
-
export {
|
|
437
|
+
export { nudgeIdempotencyKey as _, queueCallback as a, verifyConversationQueueMessage as c, verifyQueueMessage as d, getQueueProvider as f, isConversationQueueMessageRejectedError as g, conversationQueueMessageSchema as h, verifyBackgroundCompactionMessage as i, QUEUE_SIGNATURE_MAX_AGE_MS as l, ConversationQueueMessageRejectedError as m, backgroundCompactionId as n, getVercelConversationWorkQueue as o, getTurnRequestDeadline as p, vercelBackgroundCompactionQueue as r, resolveConversationWorkQueueTopic as s, BACKGROUND_COMPACTION_QUEUE_TOPIC as t, signQueueMessage as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as completeObject, n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-
|
|
2
|
-
import { $ as briefResourceLabel, X as briefCodeChangeSchema, f as conversationEventPageSchema, tt as parseBriefInput, u as conversationDetailReportSchema } from "./conversation-
|
|
1
|
+
import { l as completeObject, n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-CRQbzp5e.js";
|
|
2
|
+
import { $ as briefResourceLabel, X as briefCodeChangeSchema, f as conversationEventPageSchema, tt as parseBriefInput, u as conversationDetailReportSchema } from "./conversation-BNXfq6Lb.js";
|
|
3
3
|
import { CLI_USAGE } from "./cli/run.js";
|
|
4
4
|
import * as z from "zod";
|
|
5
5
|
import path from "node:path";
|
|
@@ -262,7 +262,7 @@ async function parseRunOptions(argv) {
|
|
|
262
262
|
* token.
|
|
263
263
|
*/
|
|
264
264
|
async function configuredBriefModelId() {
|
|
265
|
-
const { botConfig } = await import("./config-
|
|
265
|
+
const { botConfig } = await import("./config-CzeZiMKs.js").then((n) => n.r);
|
|
266
266
|
return botConfig.fastModelId;
|
|
267
267
|
}
|
|
268
268
|
function apiUrl(baseUrl, pathname) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { t as createPluginCatalogRuntime } from "./registry-
|
|
2
|
+
import { t as createPluginCatalogRuntime } from "./registry-DdFQHZ_d.js";
|
|
3
3
|
// src/chat/plugins/catalog-runtime.ts
|
|
4
4
|
var catalog_runtime_exports = /* @__PURE__ */ __exportAll({ pluginCatalogRuntime: () => pluginCatalogRuntime });
|
|
5
5
|
const pluginCatalogRuntime = createPluginCatalogRuntime();
|
package/dist/cli/chat.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-
|
|
1
|
+
import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-CY9RvsTX.js";
|
|
2
2
|
import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -99,10 +99,10 @@ async function loadLocalPluginSet() {
|
|
|
99
99
|
async function configureLocalChatPlugins(pluginSet) {
|
|
100
100
|
const [pluginsModule, agentHooksModule, catalogRuntimeModule, validationModule, databaseModule] = await Promise.all([
|
|
101
101
|
import("../plugins-BBX07Jzt.js").then((n) => n.o),
|
|
102
|
-
import("../projection-
|
|
103
|
-
import("../catalog-runtime-
|
|
104
|
-
import("../validation-
|
|
105
|
-
import("../db-
|
|
102
|
+
import("../projection-CIBwgD3s.js").then((n) => n.er),
|
|
103
|
+
import("../catalog-runtime-Dss0lSV6.js").then((n) => n.t),
|
|
104
|
+
import("../validation-BSFKUIb4.js").then((n) => n.r),
|
|
105
|
+
import("../db-B-gtnNjr.js").then((n) => n.n)
|
|
106
106
|
]);
|
|
107
107
|
const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
|
|
108
108
|
const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
|
|
@@ -152,19 +152,19 @@ function localDevServerUrl() {
|
|
|
152
152
|
async function prepareLocalChatRun(io, pluginSet) {
|
|
153
153
|
defaultStateAdapterForLocalChat();
|
|
154
154
|
await configureLocalChatPlugins(pluginSet);
|
|
155
|
-
const { setBriefsConfig } = await import("../projection-
|
|
155
|
+
const { setBriefsConfig } = await import("../projection-CIBwgD3s.js").then((n) => n.hr);
|
|
156
156
|
setBriefsConfig({ enabled: true });
|
|
157
|
-
const { runLocalAgentTurn } = await import("../runner-
|
|
158
|
-
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-
|
|
157
|
+
const { runLocalAgentTurn } = await import("../runner-DqitLtm-.js");
|
|
158
|
+
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-BBl66vCb.js");
|
|
159
159
|
const { createLocalOAuthState } = await import("../oauth-relay-DRzq73b6.js").then((n) => n.t);
|
|
160
|
-
const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-
|
|
161
|
-
const { bindSpawnAgent } = await import("../spawn-
|
|
162
|
-
const { bindMessageAgent } = await import("../message-
|
|
163
|
-
const { createChildConversationWorker, createDeliverToParent } = await import("../result-
|
|
164
|
-
const { createConversationTurnWorker } = await import("../conversation-turn-
|
|
165
|
-
const { skipInputAfterConversationStop } = await import("../session-stop-
|
|
160
|
+
const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-Bw9I0yfJ.js");
|
|
161
|
+
const { bindSpawnAgent } = await import("../spawn-D_RnFYfy.js").then((n) => n.n);
|
|
162
|
+
const { bindMessageAgent } = await import("../message-BLUCzJXN.js").then((n) => n.n);
|
|
163
|
+
const { createChildConversationWorker, createDeliverToParent } = await import("../result-oOMv1t4O.js").then((n) => n.o);
|
|
164
|
+
const { createConversationTurnWorker } = await import("../conversation-turn-D7SEZgTG.js").then((n) => n.t);
|
|
165
|
+
const { skipInputAfterConversationStop } = await import("../session-stop-DW63Z3kj.js").then((n) => n.a);
|
|
166
166
|
const { createLocalConversationWork } = await import("../conversation-work-BaT_T6EB.js");
|
|
167
|
-
const { processConversationWork } = await import("../worker-
|
|
167
|
+
const { processConversationWork } = await import("../worker-BspReIIK.js").then((n) => n.n);
|
|
168
168
|
let agentRunner;
|
|
169
169
|
const localConversationWork = createLocalConversationWork(async (message) => {
|
|
170
170
|
if (!agentRunner) throw new Error("Local agent runner is not ready");
|
package/dist/cli/check.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { N as JUNIOR_HEARTBEAT_ROUTE, R as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-
|
|
2
|
-
import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-
|
|
3
|
-
import { i as parseSkillFile } from "../skills-
|
|
1
|
+
import { N as JUNIOR_HEARTBEAT_ROUTE, R as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-C9oDAg4M.js";
|
|
2
|
+
import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-DdFQHZ_d.js";
|
|
3
|
+
import { i as parseSkillFile } from "../skills-C16fz60Z.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import fs from "node:fs/promises";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
package/dist/cli/main.js
CHANGED
|
@@ -45,13 +45,13 @@ async function runChat(argv, pluginSet) {
|
|
|
45
45
|
return await (await import("./chat.js")).runChat(argv, void 0, { pluginSet });
|
|
46
46
|
}
|
|
47
47
|
async function runAdmin(argv) {
|
|
48
|
-
return await (await import("../admin-
|
|
48
|
+
return await (await import("../admin-_poE5NKL.js")).runAdmin(argv);
|
|
49
49
|
}
|
|
50
50
|
async function runServiceAccount(argv) {
|
|
51
|
-
return await (await import("../service-account-
|
|
51
|
+
return await (await import("../service-account-B6mKAPVo.js")).runServiceAccount(argv);
|
|
52
52
|
}
|
|
53
53
|
async function runBriefs(argv) {
|
|
54
|
-
return await (await import("../briefs-
|
|
54
|
+
return await (await import("../briefs-B3NG-pid.js")).runBriefs(argv);
|
|
55
55
|
}
|
|
56
56
|
function topLevelCommand(argv) {
|
|
57
57
|
return (argv[0] === "--" ? argv.slice(1) : argv)[0];
|
package/dist/cli/plugins.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as getDb } from "../db-
|
|
3
|
-
import { n as pluginCatalogRuntime } from "../catalog-runtime-
|
|
4
|
-
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-
|
|
1
|
+
import { _o as createPluginLogger, fr as setPlugins, pr as validatePlugins } from "../projection-CIBwgD3s.js";
|
|
2
|
+
import { o as getDb } from "../db-B-gtnNjr.js";
|
|
3
|
+
import { n as pluginCatalogRuntime } from "../catalog-runtime-Dss0lSV6.js";
|
|
4
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-BSFKUIb4.js";
|
|
5
5
|
import { a as pluginRuntimeRegistrationsFromPluginSet, i as pluginCliRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "../plugins-BBX07Jzt.js";
|
|
6
6
|
import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
|
|
7
7
|
import { stderr, stdout } from "node:process";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as pluginCatalogRuntime } from "../catalog-runtime-
|
|
4
|
-
import { n as resolve } from "../resolve-
|
|
1
|
+
import { Za as SANDBOX_RUNTIME, ea as create } from "../projection-CIBwgD3s.js";
|
|
2
|
+
import { K as disconnectStateAdapter } from "../db-B-gtnNjr.js";
|
|
3
|
+
import { n as pluginCatalogRuntime } from "../catalog-runtime-Dss0lSV6.js";
|
|
4
|
+
import { n as resolve } from "../resolve-CdW4BdrK.js";
|
|
5
5
|
// src/cli/snapshot-create.ts
|
|
6
6
|
const DEFAULT_TIMEOUT_MS = 6e5;
|
|
7
7
|
function progressMessage(phase) {
|
package/dist/cli/upgrade.d.ts
CHANGED
package/dist/cli/upgrade.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as getChatConfig } from "../config-
|
|
2
|
-
import { t as createJuniorSqlExecutor } from "../executor-
|
|
3
|
-
import { t as createPluginCatalogRuntime } from "../registry-
|
|
1
|
+
import { i as getChatConfig } from "../config-CzeZiMKs.js";
|
|
2
|
+
import { t as createJuniorSqlExecutor } from "../executor-DZg20EqU.js";
|
|
3
|
+
import { t as createPluginCatalogRuntime } from "../registry-DdFQHZ_d.js";
|
|
4
4
|
import { n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "../plugins-BBX07Jzt.js";
|
|
5
5
|
import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
|
|
6
6
|
import { basename, dirname, join, resolve } from "node:path";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-
|
|
3
|
-
import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-
|
|
2
|
+
import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-C9oDAg4M.js";
|
|
3
|
+
import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-D9xnM5mK.js";
|
|
4
4
|
import { AwsClient } from "aws4fetch";
|
|
5
5
|
import { del, get, issueSignedToken, presignUrl, put } from "@vercel/blob";
|
|
6
6
|
import * as z from "zod";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
3
|
-
import {
|
|
4
|
-
import { u as hasRequiredOAuthScope } from "./registry-
|
|
5
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
6
|
-
import {
|
|
1
|
+
import { da as startOAuthFlow } from "./projection-CIBwgD3s.js";
|
|
2
|
+
import { n as botConfig } from "./config-CzeZiMKs.js";
|
|
3
|
+
import { I as deleteProviderIdentityForSlackUser, L as deleteProviderIdentityForUser, s as getSqlExecutor } from "./db-B-gtnNjr.js";
|
|
4
|
+
import { u as hasRequiredOAuthScope } from "./registry-DdFQHZ_d.js";
|
|
5
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-Dss0lSV6.js";
|
|
6
|
+
import { h as deleteMcpStoredOAuthCredentials, m as deleteMcpServerSessionId, p as deleteMcpAuthSessionsForUserProvider } from "./service-account-CrZftRTb.js";
|
|
7
7
|
import { randomBytes } from "node:crypto";
|
|
8
8
|
// src/handlers/oauth-html.ts
|
|
9
9
|
/** Build pre-escaped callback HTML with the shared response security policy. */
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ao as readLatestConversationBrief, Ca as getSlackMessagePermalink, Da as postSlackMessage, Lt as moveIdleConversationDestination, Sa as deleteSlackMessage, ki as getDashboardConversationLink, ma as formatSlackLink, pa as escapeSlackMrkdwnText } from "./projection-CIBwgD3s.js";
|
|
2
2
|
import { u as parseSlackChannelId, v as parseSlackMessageTs } from "./actor-D2iXzvlN.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import "./store-
|
|
7
|
-
import { c as joinPublicChannelForRead, s as checkSlackChannelReadAccess } from "./users-2bggndVg.js";
|
|
3
|
+
import { A as setFirstConversationLocation, J as getStateAdapter, a as getConversationStore, nt as getConversationIdByProviderConversation, o as getDb, s as getSqlExecutor, tt as claimProviderConversation, x as withConversationMutationLock } from "./db-B-gtnNjr.js";
|
|
4
|
+
import { F as juniorDestinations } from "./executor-DZg20EqU.js";
|
|
5
|
+
import { _r as joinPublicChannelForRead, gr as checkSlackChannelReadAccess } from "./warmup-Bz9bzkzN.js";
|
|
6
|
+
import "./store-C28I0CVW.js";
|
|
8
7
|
import { and, eq } from "drizzle-orm";
|
|
9
8
|
// src/chat/slack/continue-in-slack.ts
|
|
10
9
|
/** Refusal for a move that cannot wait for the active Run. */
|
|
@@ -338,6 +338,15 @@ const conversationChildAgentTotalsSchema = z.object({
|
|
|
338
338
|
cumulativeDurationMs: z.number(),
|
|
339
339
|
cumulativeUsage: usageSchema.optional()
|
|
340
340
|
}).strict();
|
|
341
|
+
// src/api/schema/object-preview-image.ts
|
|
342
|
+
/**
|
|
343
|
+
* One saved preview image of an object, such as a pull request screenshot,
|
|
344
|
+
* at 1x and 2x. Both name the Junior image route, never the image host.
|
|
345
|
+
*/
|
|
346
|
+
const objectPreviewImageSchema = z.object({
|
|
347
|
+
src: z.string().startsWith("/api/images/"),
|
|
348
|
+
srcSet: z.string().min(1)
|
|
349
|
+
}).strict();
|
|
341
350
|
// src/api/schema/conversation.ts
|
|
342
351
|
const conversationReportStatusSchema = z.enum([
|
|
343
352
|
"active",
|
|
@@ -485,7 +494,8 @@ const conversationSourceTaskSchema = z.object({
|
|
|
485
494
|
const conversationAnnotationReportSchema = conversationAnnotationInputSchema.and(z.object({
|
|
486
495
|
plugin: z.string().min(1),
|
|
487
496
|
createdAt: z.string().datetime(),
|
|
488
|
-
updatedAt: z.string().datetime()
|
|
497
|
+
updatedAt: z.string().datetime(),
|
|
498
|
+
previewImages: z.array(objectPreviewImageSchema).optional()
|
|
489
499
|
}));
|
|
490
500
|
const conversationActivityPreviewSchema = z.object({
|
|
491
501
|
createdAt: z.string().datetime(),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as messageAttachmentSchema, Q as briefOutcomeStatusSchema, R as reviewItemChangeRecordSchema, b as conversationSummaryReportSchema, i as actorIdentitySchema, u as conversationDetailReportSchema } from "./conversation-
|
|
1
|
+
import { J as messageAttachmentSchema, Q as briefOutcomeStatusSchema, R as reviewItemChangeRecordSchema, b as conversationSummaryReportSchema, i as actorIdentitySchema, u as conversationDetailReportSchema } from "./conversation-BNXfq6Lb.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
// src/api/objects/cards.ts
|
|
4
4
|
const MAX_LABEL_CHARS = 256;
|
|
@@ -100,6 +100,7 @@ function webPageObjectCard(args) {
|
|
|
100
100
|
type: "web_page",
|
|
101
101
|
...args.siteName ? { siteName: truncate(args.siteName, MAX_FACT_CHARS) } : void 0,
|
|
102
102
|
...args.author ? { author: truncate(args.author, MAX_FACT_CHARS) } : void 0,
|
|
103
|
+
...args.media ? { media: args.media } : void 0,
|
|
103
104
|
...args.thumbnailUrl ? { thumbnailUrl: args.thumbnailUrl } : void 0
|
|
104
105
|
}
|
|
105
106
|
};
|