@sentry/junior 0.285.0 → 0.286.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-DN5AB4VU.js → adapter-JQZaJ-B_.js} +1 -1
- package/dist/{admin-DOITMKnn.js → admin-Dm2bimJ-.js} +1 -1
- package/dist/{agent-runner-BsWhHe4N.js → agent-runner-DGCwOEyL.js} +1567 -1048
- package/dist/api/schema.d.ts +1 -1
- package/dist/api/schema.js +5 -5
- package/dist/api.d.ts +1 -1
- package/dist/api.js +70 -92
- package/dist/{app-DyMs9330.d.ts → app-BKq0JzWx.d.ts} +2 -3
- package/dist/app.d.ts +1 -1
- package/dist/app.js +37 -40
- package/dist/{assistant-reply-9Jip5bsr.js → assistant-reply-CAPafcUY.js} +1 -1
- package/dist/{automation-Mk8aaHzy.js → automation-B-jJN_gM.js} +1 -1
- package/dist/{background-compaction-queue-DXkLsWoH.js → background-compaction-queue-Btu2oab_.js} +137 -3
- package/dist/{briefs-Cl8-nK9B.js → briefs-UMeYehUe.js} +4 -4
- package/dist/{catalog-runtime-Bte6jRB2.js → catalog-runtime-Bym8GVdh.js} +1 -1
- package/dist/cli/chat.js +14 -14
- 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 +5 -6
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -3
- package/dist/{client-DDbBucBw.js → client-B0aAs7wC.js} +2 -2
- package/dist/{config-DqFnykQT.js → config-B9f9Lqo5.js} +1 -1
- package/dist/{connections-DA4LT9LL.js → connections-CQ7p0aNJ.js} +16 -50
- package/dist/{conversation-D8kVoCrP.js → conversation-BusI2uzj.js} +15 -6
- package/dist/{conversation-pending-messages-BvROq1bq.js → conversation-pending-messages-DwehU0Fd.js} +1 -1
- package/dist/{conversation-privacy-D0j_h70R.js → conversation-privacy-Cd_nZZBM.js} +1 -1
- package/dist/{credential-sync-hcsYatw-.js → credential-sync-DmiJi_At.js} +13 -13
- package/dist/{db-BhHZSuFw.d.ts → db-C5zi4ecs.d.ts} +4 -4
- package/dist/{executor-BLEMIgIZ.js → executor-Dipi2Ixl.js} +11 -17
- package/dist/instrumentation.js +2 -2
- package/dist/{logging-BfORLKoq.js → logging-CMFhLLj4.js} +1 -1
- package/dist/{media-Bu9C6lz0.js → media-B-BpXo41.js} +14 -2
- package/dist/{message-DqjuKzUx.js → message-D1xLljUF.js} +9 -9
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +2 -3
- package/dist/{oauth-callback-server-CFSRzu1n.js → oauth-callback-server-DCAFIUQr.js} +2 -2
- package/dist/{projection-DliWYrnT.js → projection-CoeMNxJ4.js} +286 -212
- package/dist/{prompt-BvIUzY4y.js → prompt-C9OQEfan.js} +1 -1
- package/dist/{registry-rC7MCxu8.js → registry-u-sFYtx_.js} +1 -1
- package/dist/{resolve-Biu8Qw3u.js → resolve-DYqgL3Eo.js} +3 -3
- package/dist/{result-DxJMCX47.js → result-CescSwAw.js} +8 -8
- package/dist/{runner-BQJSFLKg.js → runner-Cr67a8TB.js} +16 -12
- package/dist/{sandbox-egress-signals-6aMxJSDn.js → sandbox-egress-signals-DLOazy5W.js} +1 -1
- package/dist/{schema-BasXTvi2.js → schema-BUSi3sgv.js} +5 -5
- package/dist/{schema-BUviRAs8.d.ts → schema-Ih60j59-.d.ts} +44 -7
- package/dist/{service-account-BI5Wgx22.js → service-account-CGEqz9wG.js} +3 -3
- package/dist/{service-account-CAE-_1dR.js → service-account-CsKxktLk.js} +3 -3
- package/dist/{session-stop-CA-jOJ84.js → session-stop-CGz5DByb.js} +22 -20
- package/dist/{skills-B22duVJU.js → skills-COCqf61f.js} +2 -2
- package/dist/{spawn-BB2_4VYn.js → spawn-C8F_iXWO.js} +13 -2
- package/dist/{stop-DioIcEAu.js → stop-GyFZkHuQ.js} +242 -952
- package/dist/{store-Dn4W7qgH.js → store-D0-8plWp.js} +3 -3
- package/dist/{turn-session-routing-CGMKrYOj.js → task-runner-xPuQmEot.js} +1439 -993
- package/dist/{store-B26LV6UP.js → turn-failure-response-BOviBdT-.js} +331 -5
- package/dist/{validation-TzhfQABF.js → validation-DZDKorGz.js} +1 -1
- package/dist/{version-DSk8CFvA.js → version-BTIz7fGi.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-1Ea81s0b.js → viewer-CH-ASQzh.js} +39 -36
- package/dist/{work-ybG4_q5C.js → work-C75_IM5e.js} +92 -87
- package/dist/{worker-ccSyZRNz.js → worker-Dl47I729.js} +6 -6
- package/migrations/0086_shared_archive.sql +31 -0
- package/migrations/0087_child_location.sql +64 -0
- package/migrations/meta/0086_snapshot.json +4366 -0
- package/migrations/meta/0087_snapshot.json +4366 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +5 -4
- package/dist/task-queue-Bt0IoR2i.js +0 -139
- package/dist/task-runner-D8lddjzp.js +0 -290
- package/dist/thread-state-CrFk3K_7.js +0 -173
- package/dist/turn-failure-response-DaJ04qVj.js +0 -224
- package/dist/turn-lifecycle-C2mXS7AZ.js +0 -58
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
3
|
-
import { C as getSqlExecutor, G as deleteProviderIdentityForSlackUser,
|
|
4
|
-
import { u as hasRequiredOAuthScope } from "./registry-
|
|
5
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
6
|
-
import { c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { randomBytes, randomUUID } from "node:crypto";
|
|
1
|
+
import { Ri as startOAuthFlow, Z as loadTurnCheckpoint, it as getTurnRecord, rt as failTurnRecord } from "./projection-CoeMNxJ4.js";
|
|
2
|
+
import { n as botConfig } from "./config-B9f9Lqo5.js";
|
|
3
|
+
import { C as getSqlExecutor, G as deleteProviderIdentityForUser, W as deleteProviderIdentityForSlackUser, x as getConversationStore, y as getConversationEventStore } from "./viewer-CH-ASQzh.js";
|
|
4
|
+
import { u as hasRequiredOAuthScope } from "./registry-u-sFYtx_.js";
|
|
5
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-Bym8GVdh.js";
|
|
6
|
+
import { c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-DGCwOEyL.js";
|
|
7
|
+
import { _ as getVercelConversationWorkQueue } from "./background-compaction-queue-Btu2oab_.js";
|
|
8
|
+
import { T as requestConversationWork, h as ensureConversationWake } from "./store-D0-8plWp.js";
|
|
9
|
+
import { mt as resolveTurnSessionRouting } from "./task-runner-xPuQmEot.js";
|
|
10
|
+
import { randomBytes } from "node:crypto";
|
|
12
11
|
import * as z from "zod";
|
|
13
12
|
// src/chat/task-execution/authorized-turn.ts
|
|
14
13
|
/**
|
|
@@ -25,7 +24,7 @@ const authorizationSchema = z.object({
|
|
|
25
24
|
configuration: z.record(z.string(), z.unknown()).optional(),
|
|
26
25
|
toolChannelId: z.string().optional()
|
|
27
26
|
});
|
|
28
|
-
function authorizationKey
|
|
27
|
+
function authorizationKey(turn) {
|
|
29
28
|
return `turn:${turn.turnId}:authorization:${turn.version}`;
|
|
30
29
|
}
|
|
31
30
|
/** Save authorization for this parked boundary without changing model history. */
|
|
@@ -33,7 +32,7 @@ async function recordTurnAuthorization(args) {
|
|
|
33
32
|
const turn = await getTurnRecord(args.conversationId, args.turnId);
|
|
34
33
|
if (!turn || turn.state !== "paused" || turn.resumeReason !== "auth") return;
|
|
35
34
|
await getConversationEventStore().append(args.conversationId, [{
|
|
36
|
-
idempotencyKey: authorizationKey
|
|
35
|
+
idempotencyKey: authorizationKey(turn),
|
|
37
36
|
createdAtMs: Date.now(),
|
|
38
37
|
data: {
|
|
39
38
|
type: "structured_event",
|
|
@@ -53,7 +52,7 @@ async function recordTurnAuthorization(args) {
|
|
|
53
52
|
}
|
|
54
53
|
/** Read authorization for the exact pause; a later auth pause needs its own callback. */
|
|
55
54
|
async function getTurnAuthorization(turn) {
|
|
56
|
-
const event = await getConversationEventStore().loadByIdempotencyKey(turn.conversationId, authorizationKey
|
|
55
|
+
const event = await getConversationEventStore().loadByIdempotencyKey(turn.conversationId, authorizationKey(turn));
|
|
57
56
|
if (event?.data.type !== "structured_event") return void 0;
|
|
58
57
|
return authorizationSchema.parse(event.data.content);
|
|
59
58
|
}
|
|
@@ -91,9 +90,10 @@ async function getPausedTurnRequest(args) {
|
|
|
91
90
|
/** Wake the conversation worker for a paused turn. */
|
|
92
91
|
async function wakePausedTurn(request, options = {}) {
|
|
93
92
|
const nowMs = options.nowMs ?? Date.now();
|
|
93
|
+
const conversation = await (options.conversationStore ?? getConversationStore()).get({ conversationId: request.conversationId });
|
|
94
94
|
await requestConversationWork({
|
|
95
95
|
conversationId: request.conversationId,
|
|
96
|
-
destination: request.destination,
|
|
96
|
+
destination: conversation && conversation.kind !== "root" ? void 0 : request.destination,
|
|
97
97
|
nowMs,
|
|
98
98
|
state: options.state
|
|
99
99
|
});
|
|
@@ -290,40 +290,6 @@ function htmlCallbackResponse(title, message, status, options = {}) {
|
|
|
290
290
|
}
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
|
-
// src/chat/conversations/web-authorization.ts
|
|
294
|
-
const WEB_AUTHORIZATION_PREFIX = "junior:web_authorization:v1";
|
|
295
|
-
const WEB_AUTHORIZATION_TTL_MS = 864e5;
|
|
296
|
-
function authorizationKey(conversationId, actorId) {
|
|
297
|
-
return `${WEB_AUTHORIZATION_PREFIX}:${conversationId}:${actorId}`;
|
|
298
|
-
}
|
|
299
|
-
/** Build authorization delivery for one web turn. */
|
|
300
|
-
function createWebAuthorization(args) {
|
|
301
|
-
return {
|
|
302
|
-
createState: async () => randomUUID(),
|
|
303
|
-
deliver: async (request) => {
|
|
304
|
-
await getStateAdapter().set(authorizationKey(args.conversationId, args.actorId), JSON.stringify({
|
|
305
|
-
...request,
|
|
306
|
-
...args
|
|
307
|
-
}), WEB_AUTHORIZATION_TTL_MS);
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
/** Read the pending authorization request for one web actor. */
|
|
312
|
-
async function getWebAuthorization(args) {
|
|
313
|
-
const value = await getStateAdapter().get(authorizationKey(args.conversationId, args.actorId));
|
|
314
|
-
if (typeof value !== "string") return void 0;
|
|
315
|
-
try {
|
|
316
|
-
const parsed = JSON.parse(value);
|
|
317
|
-
if (parsed.actorId !== args.actorId || parsed.conversationId !== args.conversationId || typeof parsed.authorizationUrl !== "string" || typeof parsed.label !== "string" || typeof parsed.completionText !== "string") return;
|
|
318
|
-
return parsed;
|
|
319
|
-
} catch {
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
/** Remove a web authorization request after the parked turn continues. */
|
|
324
|
-
async function deleteWebAuthorization(args) {
|
|
325
|
-
await getStateAdapter().delete(authorizationKey(args.conversationId, args.actorId));
|
|
326
|
-
}
|
|
327
293
|
// src/chat/credentials/unlink-provider.ts
|
|
328
294
|
/** Remove one provider connection and its exact stored account identity. */
|
|
329
295
|
async function unlinkProvider(userId, provider, userTokenStore, slackTeamId) {
|
|
@@ -401,4 +367,4 @@ async function disconnectConnection(userId, provider, userTokenStore) {
|
|
|
401
367
|
if (tokens?.account) await deleteProviderIdentityForUser(getSqlExecutor(), userId, provider, tokens.account.id);
|
|
402
368
|
await unlinkProvider(userId, provider, userTokenStore);
|
|
403
369
|
}
|
|
404
|
-
export { startConnection as a,
|
|
370
|
+
export { startConnection as a, createPausedTurns as c, wakePausedTurn as d, getTurnAuthorization as f, readConnectedOAuthTokens as i, getPausedTurnRequest as l, isConnectableProvider as n, unlinkProvider as o, listConnections as r, htmlCallbackResponse as s, disconnectConnection as t, wakeAuthorizedTurn as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as conversationTurnFailureCodeSchema, l as conversationTurnFailureReasonSchema, n as INPUT_IMAGE_TYPES, y as usageSchema } from "./media-
|
|
1
|
+
import { c as conversationTurnFailureCodeSchema, l as conversationTurnFailureReasonSchema, n as INPUT_IMAGE_TYPES, y as usageSchema } from "./media-B-BpXo41.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
import { codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, objectFactFields, objectTypeSchema } from "@sentry/junior-plugin-api";
|
|
4
4
|
// src/chat/briefs/schema.ts
|
|
@@ -437,11 +437,6 @@ const conversationSummaryReportSchema = z.object({
|
|
|
437
437
|
kind: conversationKindSchema,
|
|
438
438
|
/** Present on Threads and Tasks. */
|
|
439
439
|
parentConversationId: z.string().min(1).optional(),
|
|
440
|
-
/**
|
|
441
|
-
* Present on Threads and Tasks: when the child was archived for everyone,
|
|
442
|
-
* or null. `archivedAt` stays the viewer's archive of the root.
|
|
443
|
-
*/
|
|
444
|
-
childArchivedAt: z.string().datetime().nullable().optional(),
|
|
445
440
|
isParticipant: z.boolean(),
|
|
446
441
|
visibility: z.enum(["private", "public"]).optional(),
|
|
447
442
|
status: conversationReportStatusSchema,
|
|
@@ -451,6 +446,10 @@ const conversationSummaryReportSchema = z.object({
|
|
|
451
446
|
surface: conversationSurfaceSchema,
|
|
452
447
|
actorIdentity: actorIdentitySchema.optional(),
|
|
453
448
|
participants: z.array(actorIdentitySchema).optional(),
|
|
449
|
+
/**
|
|
450
|
+
* When this Conversation was archived for everyone, or null. It shows
|
|
451
|
+
* only while it and every ancestor are unarchived.
|
|
452
|
+
*/
|
|
454
453
|
archivedAt: z.string().datetime().nullable().optional(),
|
|
455
454
|
pinnedAt: z.string().datetime().nullable().optional(),
|
|
456
455
|
/** The viewer's place in Pinned. Unset until they reorder their pins. */
|
|
@@ -513,6 +512,8 @@ const conversationReportMessageEventDataSchema = z.object({
|
|
|
513
512
|
/** Agent invocation whose input this is. An agent wrote it, not a person. */
|
|
514
513
|
agentInvocationId: z.string().min(1).optional(),
|
|
515
514
|
eventType: z.string().min(1).optional(),
|
|
515
|
+
/** Namespace of the first Event, such as `github`. */
|
|
516
|
+
eventNamespace: z.string().min(1).optional(),
|
|
516
517
|
eventObjectType: objectTypeSchema.optional(),
|
|
517
518
|
explicitMention: z.boolean().optional(),
|
|
518
519
|
quiet: z.literal(true).optional(),
|
|
@@ -668,6 +669,13 @@ const conversationReportAttachmentsDeliveredEventDataSchema = z.object({
|
|
|
668
669
|
type: z.literal("attachments_delivered"),
|
|
669
670
|
attachments: z.array(messageAttachmentSchema).min(1)
|
|
670
671
|
}).strict();
|
|
672
|
+
/** Junior text that a plugin tool posted to its provider. */
|
|
673
|
+
const conversationReportReplyPostedEventDataSchema = z.object({
|
|
674
|
+
type: z.literal("reply_posted"),
|
|
675
|
+
plugin: z.string().min(1),
|
|
676
|
+
text: z.string().min(1),
|
|
677
|
+
url: z.string().url().optional()
|
|
678
|
+
}).strict();
|
|
671
679
|
const conversationReportCompactionEventDataSchema = z.object({
|
|
672
680
|
type: z.literal("compaction"),
|
|
673
681
|
modelId: z.string().min(1).optional(),
|
|
@@ -711,6 +719,7 @@ const conversationReportEventDataSchema = z.discriminatedUnion("type", [
|
|
|
711
719
|
conversationReportTurnContextEventDataSchema,
|
|
712
720
|
conversationReportStructuredEventDataSchema,
|
|
713
721
|
conversationReportAttachmentsDeliveredEventDataSchema,
|
|
722
|
+
conversationReportReplyPostedEventDataSchema,
|
|
714
723
|
conversationReportGuardianActionReviewedEventDataSchema,
|
|
715
724
|
conversationReportCompactionEventDataSchema,
|
|
716
725
|
conversationReportSubagentEventDataSchema
|
package/dist/{conversation-pending-messages-BvROq1bq.js → conversation-pending-messages-DwehU0Fd.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as reviewItemChangeRecordSchema, i as actorIdentitySchema, l as conversationDetailReportSchema, z as messageAttachmentSchema } from "./conversation-
|
|
1
|
+
import { A as reviewItemChangeRecordSchema, i as actorIdentitySchema, l as conversationDetailReportSchema, z as messageAttachmentSchema } from "./conversation-BusI2uzj.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
// src/reporting-schema.ts
|
|
4
4
|
const healthReportSchema = z.object({
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { m as escapeXml } from "./client-
|
|
3
|
-
import { a as getRuntimeMetadata, n as botConfig } from "./config-
|
|
4
|
-
import { H as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-
|
|
1
|
+
import { Bn as resolvePluginOAuthAccount, Fi as formatProviderLabel, Ii as parseOAuthStatePayload, In as createUserTokenStore, J as getConversationPendingAuth, Li as resolveBaseUrl, Zi as postSlackMessage, d as recordAuthorizationCompleted, it as getTurnRecord, sa as getSlackClient, u as recordAuthenticationLinked } from "./projection-CoeMNxJ4.js";
|
|
2
|
+
import { m as escapeXml } from "./client-B0aAs7wC.js";
|
|
3
|
+
import { a as getRuntimeMetadata, n as botConfig } from "./config-B9f9Lqo5.js";
|
|
4
|
+
import { H as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-CMFhLLj4.js";
|
|
5
5
|
import { p as parseSlackUserId } from "./actor-6jsm_v96.js";
|
|
6
|
-
import { C as getSqlExecutor,
|
|
6
|
+
import { C as getSqlExecutor, H as resolveActorIdentityId, K as findUserByVerifiedEmails, X as upsertLinkedIdentity, o as readIdentityById } from "./viewer-CH-ASQzh.js";
|
|
7
7
|
import { i as homeDir } from "./package-discovery-DJhGdS4c.js";
|
|
8
|
-
import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-
|
|
9
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
10
|
-
import { t as discoverSkills } from "./skills-
|
|
11
|
-
import { d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, y as lookupSlackUserProfile } from "./agent-runner-
|
|
8
|
+
import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-u-sFYtx_.js";
|
|
9
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-Bym8GVdh.js";
|
|
10
|
+
import { t as discoverSkills } from "./skills-COCqf61f.js";
|
|
11
|
+
import { Mt as deleteWebAuthorization, d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, y as lookupSlackUserProfile } from "./agent-runner-DGCwOEyL.js";
|
|
12
12
|
import { r as acquireActiveLock } from "./locks-D-0h111u.js";
|
|
13
|
-
import { r as getStateAdapter } from "./adapter-
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
13
|
+
import { r as getStateAdapter } from "./adapter-JQZaJ-B_.js";
|
|
14
|
+
import { _t as getPersistedThreadState, bt as coerceThreadConversationState } from "./task-runner-xPuQmEot.js";
|
|
15
|
+
import { _ as getMcpProviderErrorAttributes } from "./service-account-CGEqz9wG.js";
|
|
16
|
+
import { d as wakePausedTurn, i as readConnectedOAuthTokens, s as htmlCallbackResponse, u as wakeAuthorizedTurn } from "./connections-CQ7p0aNJ.js";
|
|
17
17
|
import { n as relayLocalOAuthCallback } from "./oauth-relay-D6xxVywK.js";
|
|
18
18
|
import path from "node:path";
|
|
19
19
|
import { createHmac, createSecretKey, timingSafeEqual } from "node:crypto";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./schema-
|
|
1
|
+
import "./schema-Ih60j59-.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
import "drizzle-orm";
|
|
4
4
|
import { Destination, Source, locationSchema } from "@sentry/junior-plugin-api";
|
|
@@ -99,10 +99,10 @@ interface Conversation {
|
|
|
99
99
|
/** Immutable parent Conversation. */
|
|
100
100
|
parentConversationId?: string;
|
|
101
101
|
/**
|
|
102
|
-
* When
|
|
103
|
-
* and a person's message write it; `upsertConversation` does not.
|
|
102
|
+
* When the Conversation was archived for everyone. Only archive, auto-archive,
|
|
103
|
+
* pin, and a person's message write it; `upsertConversation` does not.
|
|
104
104
|
*/
|
|
105
|
-
|
|
105
|
+
archivedAtMs?: number;
|
|
106
106
|
/** Optional provider coordinates associated with this Conversation. */
|
|
107
107
|
location?: Location;
|
|
108
108
|
actor?: StoredSlackActor;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./config-
|
|
2
|
-
import { p as logException } from "./logging-
|
|
1
|
+
import "./config-B9f9Lqo5.js";
|
|
2
|
+
import { p as logException } from "./logging-CMFhLLj4.js";
|
|
3
3
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
|
-
import {
|
|
4
|
+
import { sql } from "drizzle-orm";
|
|
5
5
|
import { bigint, boolean, check, date, doublePrecision, foreignKey, index, integer, jsonb, pgTable, primaryKey, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
|
|
6
6
|
import { Pool } from "@neondatabase/serverless";
|
|
7
7
|
import { drizzle } from "drizzle-orm/neon-serverless";
|
|
@@ -115,7 +115,8 @@ const juniorConversations = pgTable("junior_conversations", {
|
|
|
115
115
|
lastEnqueuedAt: timestamptz("last_enqueued_at"),
|
|
116
116
|
parentConversationId: text("parent_conversation_id").references(() => juniorConversations.conversationId),
|
|
117
117
|
kind: text("kind").$type(),
|
|
118
|
-
|
|
118
|
+
archivedAt: timestamptz("archived_at"),
|
|
119
|
+
legacyChildArchivedAt: timestamptz("child_archived_at"),
|
|
119
120
|
forkedFromConversationId: text("forked_from_conversation_id").references(() => juniorConversations.conversationId, { onDelete: "set null" }),
|
|
120
121
|
quickQuestionAt: timestamptz("quick_question_at"),
|
|
121
122
|
rootConversationId: text("root_conversation_id").references(() => juniorConversations.conversationId),
|
|
@@ -131,8 +132,7 @@ const juniorConversations = pgTable("junior_conversations", {
|
|
|
131
132
|
executionDurationMs: integer("execution_duration_ms").notNull().default(0),
|
|
132
133
|
executionUsage: jsonb("execution_usage_json").$type(),
|
|
133
134
|
metricRunId: text("metric_run_id"),
|
|
134
|
-
detailVersion: integer("detail_version").notNull().default(0)
|
|
135
|
-
legacyArchivedAt: timestamptz("archived_at")
|
|
135
|
+
detailVersion: integer("detail_version").notNull().default(0)
|
|
136
136
|
}, (table) => [
|
|
137
137
|
check("junior_conversations_kind_check", sql`${table.kind} in ('root', 'thread', 'task')`),
|
|
138
138
|
check("junior_conversations_kind_parent_check", sql`${table.kind} is null or ((${table.kind} = 'root') = (${table.parentConversationId} is null))`),
|
|
@@ -144,11 +144,6 @@ const juniorConversations = pgTable("junior_conversations", {
|
|
|
144
144
|
index("junior_conversations_forked_from_idx").on(table.forkedFromConversationId),
|
|
145
145
|
index("junior_conversations_root_idx").on(table.rootConversationId)
|
|
146
146
|
]);
|
|
147
|
-
/** Select runtime conversation fields without reading the legacy archive column. */
|
|
148
|
-
function conversationReadColumns() {
|
|
149
|
-
const { legacyArchivedAt, ...columns } = getTableColumns(juniorConversations);
|
|
150
|
-
return columns;
|
|
151
|
-
}
|
|
152
147
|
// src/db/schema/attachments.ts
|
|
153
148
|
/** Durable metadata for files owned by one conversation. */
|
|
154
149
|
const juniorAttachments = pgTable("junior_attachments", {
|
|
@@ -377,12 +372,12 @@ const juniorConversationParticipants = pgTable("junior_conversation_participants
|
|
|
377
372
|
userId: text("user_id").notNull().references(() => juniorUsers.id),
|
|
378
373
|
rootConversationId: text("root_conversation_id").notNull().references(() => juniorConversations.conversationId),
|
|
379
374
|
lastMessageAt: timestamptz("last_message_at").notNull(),
|
|
380
|
-
|
|
375
|
+
legacyArchivedAt: timestamptz("archived_at"),
|
|
381
376
|
pinnedAt: timestamptz("pinned_at"),
|
|
382
377
|
/**
|
|
383
378
|
* The viewer's place for this pin in the Pinned section, from a drag
|
|
384
|
-
* reorder. Null until the first reorder, and cleared on unpin
|
|
385
|
-
*
|
|
379
|
+
* reorder. Null until the first reorder, and cleared on unpin and
|
|
380
|
+
* re-pin. Null pins sort first, by activity.
|
|
386
381
|
*/
|
|
387
382
|
pinPosition: integer("pin_position"),
|
|
388
383
|
/**
|
|
@@ -397,8 +392,7 @@ const juniorConversationParticipants = pgTable("junior_conversation_participants
|
|
|
397
392
|
}),
|
|
398
393
|
index("junior_conversation_participants_user_activity_idx").on(table.userId, table.lastMessageAt.desc()),
|
|
399
394
|
index("junior_conversation_participants_root_idx").on(table.rootConversationId),
|
|
400
|
-
index("junior_conversation_participants_auto_archive_idx").on(table.userId).where(sql`${table.autoArchive}
|
|
401
|
-
index("junior_conversation_participants_unarchived_activity_idx").on(table.userId, table.lastMessageAt, table.rootConversationId).where(sql`${table.archivedAt} is null`)
|
|
395
|
+
index("junior_conversation_participants_auto_archive_idx").on(table.userId).where(sql`${table.autoArchive}`)
|
|
402
396
|
]);
|
|
403
397
|
// src/db/schema/conversation-read-positions.ts
|
|
404
398
|
/**
|
|
@@ -1001,4 +995,4 @@ function createJuniorSqlExecutor(args) {
|
|
|
1001
995
|
statementTimeoutMs
|
|
1002
996
|
});
|
|
1003
997
|
}
|
|
1004
|
-
export {
|
|
998
|
+
export { juniorConversations as A, isUserInstruction as C, juniorCodeChanges as D, juniorConversationAnnotations as E, juniorUsers as M, juniorDestinations as N, juniorCodeRepositories as O, juniorArtifacts as P, juniorConversationMetrics as S, juniorApiTokens as T, juniorConversationReadPositions as _, juniorPushSubscriptions as a, juniorConversationBriefs as b, juniorReviewItemSlackCards as c, juniorAutomationVersions as d, juniorAutomations as f, juniorAgentInvocations as g, juniorAgentBindings as h, juniorWorkspaces as i, juniorIdentities as j, juniorAttachments as k, juniorReviewItems as l, juniorLocationConfigurations as m, juniorSnapshots as n, juniorReviewItemAssignees as o, juniorStats as p, juniorWorkspaceRepos as r, juniorReviewItemConversations as s, createJuniorSqlExecutor as t, juniorAutomationRuns as u, juniorConversationParticipants as v, juniorConversationEvents as w, CONVERSATION_METRICS as x, juniorConversationBindings as y };
|
package/dist/instrumentation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as getClient, c as init, i as getActiveSpan, o as getGlobalScope, p as spanToJSON, s as getTraceData } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { R as getDeploymentServiceVersion, z as getDeploymentTelemetryAttributes } from "./logging-
|
|
3
|
-
import { n as getCurrentConversationPrivacy } from "./conversation-privacy-
|
|
2
|
+
import { R as getDeploymentServiceVersion, z as getDeploymentTelemetryAttributes } from "./logging-CMFhLLj4.js";
|
|
3
|
+
import { n as getCurrentConversationPrivacy } from "./conversation-privacy-Cd_nZZBM.js";
|
|
4
4
|
import { n as redactSandboxEgressProxyPath } from "./proxy-path-BHYoKZdq.js";
|
|
5
5
|
import { t as consumePrivateTraceResultMarker } from "./private-trace-result-CE7_lEdq.js";
|
|
6
6
|
import { n as promoteHttpRouteName, r as routeNameMiddleware, t as nameRequestRoute } from "./sentry-route-name-BhwWnfqj.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as withScope, d as setTag, f as setUser, h as startSpan, i as getActiveSpan, l as logger, n as captureMessage, p as spanToJSON, s as getTraceData, t as captureException } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
2
|
+
import { t as JUNIOR_VERSION } from "./version-BTIz7fGi.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { styleText } from "node:util";
|
|
5
5
|
import { ConfigError, configureSync, getConfig, getLogger } from "@logtape/logtape";
|
|
@@ -274,7 +274,7 @@ const messagesSummarizedEventDataSchema = z.object({
|
|
|
274
274
|
createdAtMs: z.number(),
|
|
275
275
|
id: z.string().min(1),
|
|
276
276
|
summary: z.string()
|
|
277
|
-
}).strict())
|
|
277
|
+
}).strict()).optional()
|
|
278
278
|
}).strict();
|
|
279
279
|
/** Product surface that owns a durable conversation turn. */
|
|
280
280
|
const conversationTurnSurfaceSchema = z.enum([
|
|
@@ -315,7 +315,9 @@ const turnStartedEventDataSchema = z.object({
|
|
|
315
315
|
type: z.literal("turn_started"),
|
|
316
316
|
turnId: z.string().min(1),
|
|
317
317
|
inputMessageIds: z.array(z.string().min(1)).min(1),
|
|
318
|
-
surface: conversationTurnSurfaceSchema
|
|
318
|
+
surface: conversationTurnSurfaceSchema,
|
|
319
|
+
/** Highest Message seq known when the Turn built its thread context. */
|
|
320
|
+
threadContextThroughSeq: z.number().int().nonnegative().optional()
|
|
319
321
|
}).strict().refine((data) => new Set(data.inputMessageIds).size === data.inputMessageIds.length, "turn input message ids must be unique");
|
|
320
322
|
const legacyTurnRoutedEventDataSchema = z.object({
|
|
321
323
|
type: z.literal("turn_routed"),
|
|
@@ -357,6 +359,14 @@ const attachmentsDeliveredEventDataSchema = z.object({
|
|
|
357
359
|
toolCallId: z.string().min(1).optional(),
|
|
358
360
|
turnId: z.string().min(1).optional()
|
|
359
361
|
}).strict();
|
|
362
|
+
/** Host-owned transcript item for a reply that a plugin tool posted. */
|
|
363
|
+
const replyPostedEventDataSchema = z.object({
|
|
364
|
+
type: z.literal("reply_posted"),
|
|
365
|
+
plugin: z.string().min(1),
|
|
366
|
+
text: z.string().min(1),
|
|
367
|
+
url: z.string().url().optional(),
|
|
368
|
+
toolCallId: z.string().min(1)
|
|
369
|
+
}).strict();
|
|
360
370
|
const turnCompletedEventDataSchema = z.object({
|
|
361
371
|
type: z.literal("turn_completed"),
|
|
362
372
|
turnId: z.string().min(1),
|
|
@@ -428,6 +438,7 @@ const appendableConversationEventDataSchema = z.union([
|
|
|
428
438
|
turnContextEventDataSchema,
|
|
429
439
|
structuredConversationEventDataSchema,
|
|
430
440
|
attachmentsDeliveredEventDataSchema,
|
|
441
|
+
replyPostedEventDataSchema,
|
|
431
442
|
turnCompletedEventDataSchema,
|
|
432
443
|
turnFailedEventDataSchema,
|
|
433
444
|
subagentStartedEventDataSchema,
|
|
@@ -462,6 +473,7 @@ const KNOWN_CONVERSATION_EVENT_TYPES = [
|
|
|
462
473
|
"turn_context",
|
|
463
474
|
"structured_event",
|
|
464
475
|
"attachments_delivered",
|
|
476
|
+
"reply_posted",
|
|
465
477
|
"turn_routed",
|
|
466
478
|
"turn_completed",
|
|
467
479
|
"turn_failed",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { Qa as
|
|
3
|
-
import { n as botConfig } from "./config-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { r as appendAndEnqueueInboundMessage } from "./store-
|
|
9
|
-
import {
|
|
10
|
-
import { r as enqueueAgentMessageToParent } from "./result-
|
|
2
|
+
import { Qa as canAccessConversation, eo as readConversationAccessFromSql, yn as renderUntrustedTag } from "./projection-CoeMNxJ4.js";
|
|
3
|
+
import { n as botConfig } from "./config-B9f9Lqo5.js";
|
|
4
|
+
import { S as getDb, V as SYSTEM_IDENTITY_ID, x as getConversationStore } from "./viewer-CH-ASQzh.js";
|
|
5
|
+
import { Gt as actorFromRun, It as AgentMessagePausedError, Kt as toolInvocationDestination, Rt as AgentMessageTargetError } from "./agent-runner-DGCwOEyL.js";
|
|
6
|
+
import { F as PARENT_AGENT_TARGET, v as getActiveAgentInvocationForConversation } from "./turn-failure-response-BOviBdT-.js";
|
|
7
|
+
import { G as admitAutomatedTurn, S as EVENT_WAIT_MS, V as postAutomatedTurnLimitNoticeForConversation } from "./session-stop-CGz5DByb.js";
|
|
8
|
+
import { r as appendAndEnqueueInboundMessage } from "./store-D0-8plWp.js";
|
|
9
|
+
import { a as enqueueAgentInvocation, c as createAgentInvocationForMessage, u as findChildAgentConversationId } from "./work-C75_IM5e.js";
|
|
10
|
+
import { r as enqueueAgentMessageToParent } from "./result-CescSwAw.js";
|
|
11
11
|
// src/chat/agent-invocations/top-level-message.ts
|
|
12
12
|
const AGENT_MESSAGE_EVENT_NAMESPACE = "junior";
|
|
13
13
|
/** Event type of a message from another top-level agent. */
|
package/dist/nitro.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as JuniorDashboardOptions } from "./app-
|
|
1
|
+
import { i as JuniorDashboardOptions } from "./app-BKq0JzWx.js";
|
|
2
2
|
import { n as JuniorPluginSet } from "./plugins-DtmjkTza.js";
|
|
3
3
|
import { withSentryConfig as withSentryConfig$1 } from "@sentry/nitro";
|
|
4
4
|
type SentryNitroConfig = Parameters<typeof withSentryConfig$1>[0];
|
package/dist/nitro.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { A as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_ROUTE, I as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_ROUTE, N as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_RETENTION_CRON_SCHEDULE, R as getDeploymentServiceVersion, j as JUNIOR_HEARTBEAT_CRON_SCHEDULE, k as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE } from "./logging-
|
|
1
|
+
import { A as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_ROUTE, I as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_ROUTE, N as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_RETENTION_CRON_SCHEDULE, R as getDeploymentServiceVersion, j as JUNIOR_HEARTBEAT_CRON_SCHEDULE, k as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE } from "./logging-CMFhLLj4.js";
|
|
2
2
|
import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-DJhGdS4c.js";
|
|
3
|
-
import { a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC,
|
|
3
|
+
import { a as PLUGIN_TASK_QUEUE_TOPIC, p as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, v as resolveConversationWorkQueueTopic } from "./background-compaction-queue-Btu2oab_.js";
|
|
4
4
|
import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-HYh_JOdw.js";
|
|
5
|
-
import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-Bt0IoR2i.js";
|
|
6
5
|
import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cf5gVPWP.js";
|
|
7
6
|
import path from "node:path";
|
|
8
7
|
import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-
|
|
1
|
+
import { In as createUserTokenStore } from "./projection-CoeMNxJ4.js";
|
|
2
|
+
import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-DmiJi_At.js";
|
|
3
3
|
import { createServer } from "node:http";
|
|
4
4
|
// src/chat/local/oauth-callback-server.ts
|
|
5
5
|
const LOCAL_OAUTH_TIMEOUT_MS = 6e5;
|