@sentry/junior 0.304.0 → 0.306.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-B1IpoELr.js → adapter-context-CnY-i32r.js} +2 -2
- package/dist/{admin-BnVFGo_z.js → admin-BLLdLnXh.js} +2 -2
- package/dist/{agent-runner-CoEeZSRh.js → agent-runner-BaLjEjPR.js} +312 -204
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +7 -8
- package/dist/api.d.ts +19 -4
- package/dist/api.js +137 -40
- package/dist/{app-Cs157Zc5.d.ts → app-DvYbM9UD.d.ts} +2 -2
- package/dist/app.d.ts +1 -1
- package/dist/app.js +489 -445
- package/dist/{background-compaction-queue-WLPNSF_b.js → background-compaction-queue-D2wzxtGU.js} +7 -3
- package/dist/{briefs-CagVVefw.js → briefs-DvyzXfrF.js} +3 -3
- package/dist/{catalog-runtime-B8ZXvXWm.js → catalog-runtime-B1R-nHd3.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 +5 -5
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -3
- package/dist/{config-DdO1BNcw.js → config-DUD-zMvp.js} +111 -13
- package/dist/{connections-D20kp0j5.js → connections-CDhsqPcC.js} +6 -6
- package/dist/{continue-in-slack-BKEVMBj1.js → continue-in-slack-BXQizz9o.js} +5 -5
- package/dist/{conversation-BOqdRtUx.js → conversation--f85g4zL.js} +132 -132
- package/dist/{conversation-feed-CgpgP7yi.js → conversation-feed-BNs9KiqC.js} +1 -1
- package/dist/{conversation-privacy-L1SK_v0V.js → conversation-privacy-YE54gMN8.js} +1 -1
- package/dist/{conversation-turn-BptVJylj.js → conversation-turn-BzdmrHb0.js} +22 -40
- package/dist/{credential-sync-D1J1CGzL.js → credential-sync-Cdm-e1vJ.js} +14 -13
- package/dist/{db-EKJnkrIb.js → db-DV2ZUb1Y.js} +90 -11
- package/dist/{db-zbN5ZV_o.d.ts → db-pH357Dkt.d.ts} +1 -1
- package/dist/{executor-CoIZmFK8.js → executor-CjNhwwnj.js} +47 -4
- package/dist/{history-m2-ceTTX.js → history-N7IVbUom.js} +5 -1
- package/dist/{install-BT2Pf6HP.js → install-DbD7C5td.js} +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{lineage-C5DGQCS_.js → lineage-BFdIPb3o.js} +2 -2
- package/dist/{logging-QSZuMcvo.js → logging-oYpJYr-S.js} +1 -1
- package/dist/{message-TtxftRHj.js → message-BBPcMKJY.js} +8 -8
- package/dist/{model-input-BHXfA29g.js → model-input-DYYF3a8B.js} +3 -3
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +4 -4
- package/dist/{oauth-callback-server-B0enqHtZ.js → oauth-callback-server-C7Q987su.js} +2 -2
- package/dist/{projection-CNKK7doO.js → projection-CWXDE0f6.js} +7740 -6165
- package/dist/{prompt-DSjhoKu5.js → prompt-P3eRqO8C.js} +15 -7
- package/dist/{queue-CDxkit82.js → queue-7FSijgqG.js} +4 -4
- package/dist/{registry-DBDNUUmz.js → registry-1pzXmplY.js} +1 -1
- package/dist/{resolve-CQLhMWSu.js → resolve-n87oXY-d.js} +3 -3
- package/dist/{result-B-pauj42.js → result-BmF9v9bv.js} +9 -9
- package/dist/{runner-B3KxKks5.js → runner-4j7ZsxP5.js} +13 -15
- package/dist/{sandbox-egress-signals-DJJX9ClG.js → sandbox-egress-signals-BRQI8HvT.js} +1 -1
- package/dist/{automation-CuA3yEcD.js → schedule-CHPWQn-x.js} +347 -5
- package/dist/{schema-CKcu-IK6.d.ts → schema-CVbIjrF3.d.ts} +71 -1
- package/dist/{schema-Bx0Mlo32.js → schema-D7iIEh6t.js} +52 -6
- package/dist/{service-account-DQLqkSVv.js → service-account-BDQ9xzta.js} +3 -3
- package/dist/{service-account-2HmlNPvy.js → service-account-DzQiOmqa.js} +5 -5
- package/dist/{session-stop-DEeZKqbX.js → session-stop-BQxgHR4X.js} +919 -168
- package/dist/{skills-2UrD7JkN.js → skills-CPf4vNuC.js} +2 -2
- package/dist/{slack-conversation-unfurl-Dd129Uov.js → slack-conversation-unfurl-B1KEptUg.js} +10 -9
- package/dist/{spawn-eMho9HDJ.js → spawn-CjGddiAU.js} +6 -6
- package/dist/{state-Bveuc4Zh.js → state-9wfj6aSD.js} +4 -4
- package/dist/{stop-D_ltJLDS.js → stop-CsQGuN5n.js} +62 -118
- package/dist/{store-COeYnPL_.js → store-Dz3YZ7gQ.js} +5 -5
- package/dist/{task-queue-CBIDXZpV.js → task-queue-CFlrJguF.js} +3 -3
- package/dist/{task-runner-CJF7zIJL.js → task-runner-frzlUvFD.js} +8 -9
- package/dist/{thread-context-Cg0jt0aE.js → thread-context-C4QuZlM8.js} +8 -91
- package/dist/turn-session-routing-BXaubz2w.js +244 -0
- package/dist/{turn-user-message-tcom1RYd.js → turn-user-message-DNC0eRZ7.js} +3 -3
- package/dist/users-XCCKn3xW.js +181 -0
- package/dist/{validation-EU91JwIT.js → validation-L5fdjmFX.js} +1 -1
- package/dist/{version-BYRPhY5G.js → version-BFmuwgxP.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-Cf8ISkAc.js → viewer-DKOeHpv3.js} +3 -3
- package/dist/{warmup-TgY4S1vx.js → warmup-mTMIatCV.js} +271 -279
- package/dist/{web-message-id-lNodcCOI.js → web-message-id-CUaSiGme.js} +16 -1
- package/dist/{worker-C6Uq4OKD.js → worker-Bz4KNxjI.js} +7 -7
- package/migrations/0114_plan_items.sql +22 -0
- package/migrations/meta/0114_snapshot.json +5203 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +6 -6
- package/dist/schedule-cP0AACm1.js +0 -344
- package/dist/turn-session-routing-CaY3Tp8m.js +0 -1792
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import { i as getChatConfig } from "./config-
|
|
2
|
+
import { i as getChatConfig } from "./config-DUD-zMvp.js";
|
|
3
3
|
import { a as isSlackUserId, d as parseSlackChannelReferenceId, f as parseSlackTeamId, s as parseActorUserId } from "./actor-D2iXzvlN.js";
|
|
4
|
-
import {
|
|
5
|
-
import { c as newConversationEventSchema, h as usageSchema, l as encodeHistoryPayload, o as decodeStoredConversationEvent, r as conversationEventDataSchema, s as historyReplacementSchema } from "./history-
|
|
6
|
-
import { G as normalizeIdentityEmail, U as GOOGLE_IDENTITY_PROVIDER, h as logWarn } from "./logging-
|
|
4
|
+
import { D as juniorConversationEvents, E as isUserInstruction, F as juniorConversations, I as juniorIdentities, L as juniorUsers, N as juniorAttachments, P as juniorMessageAttachments, R as juniorDestinations, T as juniorConversationMetrics, b as juniorConversationParticipants, k as juniorConversationAnnotations, t as createJuniorSqlExecutor, w as CONVERSATION_METRICS, x as juniorConversationBindings } from "./executor-CjNhwwnj.js";
|
|
5
|
+
import { c as newConversationEventSchema, h as usageSchema, l as encodeHistoryPayload, o as decodeStoredConversationEvent, r as conversationEventDataSchema, s as historyReplacementSchema } from "./history-N7IVbUom.js";
|
|
6
|
+
import { G as normalizeIdentityEmail, U as GOOGLE_IDENTITY_PROVIDER, h as logWarn } from "./logging-oYpJYr-S.js";
|
|
7
7
|
import * as z from "zod";
|
|
8
8
|
import { createHash, randomUUID } from "node:crypto";
|
|
9
9
|
import { and, asc, desc, eq, gt, gte, inArray, isNull, lt, lte, ne, or, sql } from "drizzle-orm";
|
|
@@ -971,6 +971,17 @@ async function saveUserTimezone(db, userId, timezone, nowMs) {
|
|
|
971
971
|
updatedAt: dateFromMs$1(nowMs)
|
|
972
972
|
}).where(and(eq(juniorUsers.id, userId), sql`${juniorUsers.timezone} is distinct from ${timezone}`));
|
|
973
973
|
}
|
|
974
|
+
/** Return the Slack user most recently linked to a Junior user. */
|
|
975
|
+
async function linkedSlackUser(db, userId) {
|
|
976
|
+
const row = (await db.select({
|
|
977
|
+
teamId: juniorIdentities.providerTenantId,
|
|
978
|
+
slackUserId: juniorIdentities.providerSubjectId
|
|
979
|
+
}).from(juniorIdentities).where(and(eq(juniorIdentities.userId, userId), eq(juniorIdentities.kind, "user"), eq(juniorIdentities.provider, "slack"))).orderBy(desc(juniorIdentities.updatedAt)).limit(1))[0];
|
|
980
|
+
return row?.teamId ? {
|
|
981
|
+
teamId: row.teamId,
|
|
982
|
+
userId: row.slackUserId
|
|
983
|
+
} : void 0;
|
|
984
|
+
}
|
|
974
985
|
/** Persist one provider identity observation and link verified emails to users. */
|
|
975
986
|
async function upsertIdentity(executor, identity, nowMs = Date.now()) {
|
|
976
987
|
return await upsertIdentityRecord(executor, identity, void 0, nowMs);
|
|
@@ -997,6 +1008,45 @@ async function findUserByVerifiedEmails(executor, emails) {
|
|
|
997
1008
|
}).from(juniorUsers).where(inArray(juniorUsers.primaryEmailNormalized, Array.from(normalized))).limit(2);
|
|
998
1009
|
return rows.length === 1 ? rows[0] : void 0;
|
|
999
1010
|
}
|
|
1011
|
+
const linkedSlackIdentity = alias(juniorIdentities, "linked_slack_identity");
|
|
1012
|
+
const linkedSlackUserColumns = {
|
|
1013
|
+
displayName: juniorUsers.displayName,
|
|
1014
|
+
email: juniorUsers.primaryEmail,
|
|
1015
|
+
slackUserId: linkedSlackIdentity.providerSubjectId,
|
|
1016
|
+
userId: juniorUsers.id
|
|
1017
|
+
};
|
|
1018
|
+
function singleLinkedSlackUser(rows) {
|
|
1019
|
+
const [row] = rows;
|
|
1020
|
+
if (rows.length !== 1 || !row) return void 0;
|
|
1021
|
+
return {
|
|
1022
|
+
slackUserId: row.slackUserId,
|
|
1023
|
+
user: {
|
|
1024
|
+
id: row.userId,
|
|
1025
|
+
email: row.email,
|
|
1026
|
+
...row.displayName ? { displayName: row.displayName } : void 0
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
/**
|
|
1031
|
+
* Find the one Slack user in a workspace who is linked to an exact provider
|
|
1032
|
+
* Identity, and the User behind both.
|
|
1033
|
+
*
|
|
1034
|
+
* Only the provider account id from an account-linking flow matches. Handles,
|
|
1035
|
+
* emails, and display names never match. Return undefined when no Slack user
|
|
1036
|
+
* or more than one Slack user matches.
|
|
1037
|
+
*/
|
|
1038
|
+
async function findLinkedSlackUser(executor, args) {
|
|
1039
|
+
return singleLinkedSlackUser(await executor.db().select(linkedSlackUserColumns).from(juniorIdentities).innerJoin(linkedSlackIdentity, and(eq(linkedSlackIdentity.userId, juniorIdentities.userId), eq(linkedSlackIdentity.kind, "user"), eq(linkedSlackIdentity.provider, "slack"), eq(linkedSlackIdentity.providerTenantId, args.slackTeamId))).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(and(eq(juniorIdentities.kind, "user"), eq(juniorIdentities.provider, args.provider), eq(juniorIdentities.providerTenantId, ""), eq(juniorIdentities.providerSubjectId, args.providerSubjectId))).limit(2));
|
|
1040
|
+
}
|
|
1041
|
+
/**
|
|
1042
|
+
* Find the one Slack user in a workspace whose User has this primary email.
|
|
1043
|
+
*
|
|
1044
|
+
* The caller must have verified that the person sent from this address.
|
|
1045
|
+
* Return undefined when no Slack user or more than one Slack user matches.
|
|
1046
|
+
*/
|
|
1047
|
+
async function findSlackUserByPrimaryEmail(executor, args) {
|
|
1048
|
+
return singleLinkedSlackUser(await executor.db().select(linkedSlackUserColumns).from(juniorUsers).innerJoin(linkedSlackIdentity, eq(linkedSlackIdentity.userId, juniorUsers.id)).where(and(eq(juniorUsers.primaryEmailNormalized, args.normalizedEmail), eq(linkedSlackIdentity.kind, "user"), eq(linkedSlackIdentity.provider, "slack"), eq(linkedSlackIdentity.providerTenantId, args.slackTeamId))).limit(2));
|
|
1049
|
+
}
|
|
1000
1050
|
/** Remove one exact provider identity owned by a workspace Slack user. */
|
|
1001
1051
|
async function deleteProviderIdentityForSlackUser(executor, slackTeamId, slackUserId, provider, providerSubjectId) {
|
|
1002
1052
|
const userId = (await executor.db().select({ userId: juniorIdentities.userId }).from(juniorIdentities).where(and(eq(juniorIdentities.kind, "user"), eq(juniorIdentities.provider, "slack"), eq(juniorIdentities.providerTenantId, slackTeamId), eq(juniorIdentities.providerSubjectId, slackUserId))).limit(1))[0]?.userId;
|
|
@@ -1333,6 +1383,8 @@ function conversationKindFromRow(row) {
|
|
|
1333
1383
|
const ROOT = {
|
|
1334
1384
|
delivery: "location",
|
|
1335
1385
|
promptMode: "conversation",
|
|
1386
|
+
idleNeedsPendingWork: false,
|
|
1387
|
+
waitsForSignIn: true,
|
|
1336
1388
|
gated: false,
|
|
1337
1389
|
failureNotice: "none",
|
|
1338
1390
|
sessionTasks: true,
|
|
@@ -1348,15 +1400,19 @@ const ROOT = {
|
|
|
1348
1400
|
};
|
|
1349
1401
|
const PERSON_IN_THREAD = {
|
|
1350
1402
|
...ROOT,
|
|
1403
|
+
promptMode: "thread",
|
|
1404
|
+
sender: "person",
|
|
1351
1405
|
sessionTasks: false,
|
|
1352
1406
|
tools: {
|
|
1353
1407
|
...ROOT.tools,
|
|
1354
1408
|
agents: "none"
|
|
1355
1409
|
}
|
|
1356
1410
|
};
|
|
1357
|
-
const
|
|
1411
|
+
const CHILD_AGENT_TURN = {
|
|
1358
1412
|
delivery: "conversation",
|
|
1359
1413
|
promptMode: "child_agent",
|
|
1414
|
+
idleNeedsPendingWork: false,
|
|
1415
|
+
waitsForSignIn: false,
|
|
1360
1416
|
gated: true,
|
|
1361
1417
|
failureNotice: "none",
|
|
1362
1418
|
sessionTasks: false,
|
|
@@ -1370,14 +1426,28 @@ const AGENT_IN_THREAD = {
|
|
|
1370
1426
|
noReply: true
|
|
1371
1427
|
}
|
|
1372
1428
|
};
|
|
1429
|
+
const AGENT_IN_THREAD = {
|
|
1430
|
+
...CHILD_AGENT_TURN,
|
|
1431
|
+
promptMode: "thread",
|
|
1432
|
+
sender: "agent"
|
|
1433
|
+
};
|
|
1434
|
+
const THREAD_TOOLS = {
|
|
1435
|
+
...AGENT_IN_THREAD.tools,
|
|
1436
|
+
reviewDesk: PERSON_IN_THREAD.tools.reviewDesk,
|
|
1437
|
+
subscriptions: PERSON_IN_THREAD.tools.subscriptions,
|
|
1438
|
+
userCustomization: PERSON_IN_THREAD.tools.userCustomization
|
|
1439
|
+
};
|
|
1373
1440
|
const AGENT_IN_TASK = {
|
|
1374
|
-
...
|
|
1441
|
+
...CHILD_AGENT_TURN,
|
|
1375
1442
|
missingAnswerError: "No reply was sent.",
|
|
1376
1443
|
failureNotice: "parent"
|
|
1377
1444
|
};
|
|
1378
1445
|
const AUTOMATION_RUN = {
|
|
1379
1446
|
delivery: "conversation",
|
|
1380
1447
|
promptMode: "automation",
|
|
1448
|
+
sender: "automation",
|
|
1449
|
+
idleNeedsPendingWork: true,
|
|
1450
|
+
waitsForSignIn: true,
|
|
1381
1451
|
gated: true,
|
|
1382
1452
|
failureNotice: "none",
|
|
1383
1453
|
sessionTasks: true,
|
|
@@ -1387,21 +1457,28 @@ const AUTOMATION_RUN = {
|
|
|
1387
1457
|
reportBlocked: "automation"
|
|
1388
1458
|
}
|
|
1389
1459
|
};
|
|
1460
|
+
const PERSON_IN_AUTOMATION = {
|
|
1461
|
+
...ROOT,
|
|
1462
|
+
promptMode: "automation",
|
|
1463
|
+
sender: "person"
|
|
1464
|
+
};
|
|
1390
1465
|
/** Return the behavior of one Turn. */
|
|
1391
1466
|
function turnBehavior(args) {
|
|
1392
1467
|
if (args.kind === "root") return ROOT;
|
|
1393
|
-
if (args.kind === "automation") return args.personInput ?
|
|
1468
|
+
if (args.kind === "automation") return args.personInput ? PERSON_IN_AUTOMATION : AUTOMATION_RUN;
|
|
1394
1469
|
if (args.kind === "thread") return args.personInput ? PERSON_IN_THREAD : AGENT_IN_THREAD;
|
|
1395
1470
|
if (!args.personInput) return AGENT_IN_TASK;
|
|
1396
1471
|
throw new Error("A task Conversation cannot have a person's input");
|
|
1397
1472
|
}
|
|
1398
1473
|
/**
|
|
1399
|
-
* Return the Turn
|
|
1400
|
-
*
|
|
1474
|
+
* Return the tools that every Turn of one Prompt mode lists. A Turn of a mode
|
|
1475
|
+
* with two senders can list more than its own tools. The listed tools that it
|
|
1476
|
+
* cannot use are disabled.
|
|
1401
1477
|
*/
|
|
1402
1478
|
function promptModeTurnTools(mode) {
|
|
1403
1479
|
if (mode === "automation") return AUTOMATION_RUN.tools;
|
|
1404
1480
|
if (mode === "child_agent") return AGENT_IN_TASK.tools;
|
|
1481
|
+
if (mode === "thread") return THREAD_TOOLS;
|
|
1405
1482
|
return ROOT.tools;
|
|
1406
1483
|
}
|
|
1407
1484
|
/** Return whether a Conversation of this kind has no parent. */
|
|
@@ -2432,7 +2509,8 @@ var SqlConversationEventStore = class {
|
|
|
2432
2509
|
/**
|
|
2433
2510
|
* Add the authors of Turn input messages to the conversation.
|
|
2434
2511
|
* Only people who start a Turn join it. Thread context, such as backfilled
|
|
2435
|
-
* or skipped messages,
|
|
2512
|
+
* or skipped messages, and Event Messages keep their author without
|
|
2513
|
+
* membership.
|
|
2436
2514
|
*/
|
|
2437
2515
|
async recordTurnInputParticipants(conversationId, inputMessageIds) {
|
|
2438
2516
|
const rows = await this.executor.db().select().from(juniorConversationEvents).where(and(eq(juniorConversationEvents.conversationId, conversationId), eq(juniorConversationEvents.type, "message"), inArray(sql`${juniorConversationEvents.payload}->>'messageId'`, [...inputMessageIds])));
|
|
@@ -2441,6 +2519,7 @@ var SqlConversationEventStore = class {
|
|
|
2441
2519
|
for (const row of rows) {
|
|
2442
2520
|
const { data } = eventFromRow(row);
|
|
2443
2521
|
if (!row.actorIdentityId || data.type !== "message") continue;
|
|
2522
|
+
if (data.meta?.["eventType"]) continue;
|
|
2444
2523
|
const unarchives = eventUnarchivesConversation(data);
|
|
2445
2524
|
const isPerson = await recordConversationParticipant(this.executor, {
|
|
2446
2525
|
actorIdentityId: row.actorIdentityId,
|
|
@@ -2736,4 +2815,4 @@ async function closeDb() {
|
|
|
2736
2815
|
current = void 0;
|
|
2737
2816
|
await previous?.db.close();
|
|
2738
2817
|
}
|
|
2739
|
-
export {
|
|
2818
|
+
export { getStateAdapter as $, conversationKindFromRow as A, findLinkedSlackUser as B, withConversationMutationLock as C, postsRunNotices as D, isTopLevelKind as E, findActorIdentityId as F, recordGoogleSignIn as G, findUserByVerifiedEmails as H, resolveActorIdentityId as I, clearCachedUser as J, saveUserTimezone as K, saveActorAvatar as L, setFirstConversationLocation as M, startLocationThread as N, promptModeTurnTools as O, SYSTEM_IDENTITY_ID as P, getDefaultRedisStateAdapterFor as Q, deleteProviderIdentityForSlackUser as R, createSqlStore as S, sameDestination as St, isPersonInput as T, linkedSlackUser as U, findSlackUserByPrimaryEmail as V, readUserTimezone as W, createCache as X, readCachedUserByEmail as Y, disconnectStateAdapter as Z, readConversationTrees as _, nextDetailVersion as _t, getConversationStore as a, withLock as at, lastMessageAtSql as b, parseDestination as bt, hasAnnotationKey as c, parseSessionSource as ct, eventFromRow as d, agentTurnTotalTokens as dt, getStateValues as et, copyMessageLinks as f, agentTurnUsageSchema as ft, conversationDescendants as g, conversationDetailTouch as gt, conversationAncestors as h, rootConversationIsArchived as ht, getConversationMessageSearchStore as i, fenceLock as it, locationFromRow as j, turnBehavior as k, treeHasAnnotationKey as l, addAgentTurnUsage as lt, withConversationEventLock as m, resolveRootConversationId as mt, db_exports as n, MUTATION_LOCK_TTL_MS as nt, getDb as o, claimProviderConversation as ot, deleteMessageLinks as p, hasAgentTurnUsage as pt, upsertLinkedIdentity as q, getConversationEventStore as r, acquireActiveLock as rt, getSqlExecutor as s, getConversationIdByProviderConversation as st, closeDb as t, setStateValues as tt, createSqlConversationEventStore as u, agentTurnCostUsd as ut, setArchivedAt as v, touchConversationDetail as vt, deliversFinalText as w, userMessageQueries as x, requireSlackDestination as xt, loadConversationSlackTenantIds as y, createSlackDestination as yt, deleteProviderIdentityForUser as z };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { h as logWarn, p as logException } from "./logging-
|
|
1
|
+
import { h as logWarn, p as logException } from "./logging-oYpJYr-S.js";
|
|
2
2
|
import { _ as withScope } from "./sentry-CPbZjomA.js";
|
|
3
|
-
import "./config-
|
|
3
|
+
import "./config-DUD-zMvp.js";
|
|
4
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
5
|
import { sql } from "drizzle-orm";
|
|
6
|
-
import { bigint, boolean, check, customType, date, doublePrecision, foreignKey, index, integer, jsonb, pgTable, primaryKey, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
|
|
6
|
+
import { bigint, boolean, check, customType, date, doublePrecision, foreignKey, index, integer, jsonb, pgSequence, pgTable, primaryKey, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
|
|
7
7
|
import { Pool as Pool$1, neon } from "@neondatabase/serverless";
|
|
8
8
|
import { drizzle } from "drizzle-orm/neon-serverless";
|
|
9
9
|
import { Agent } from "undici";
|
|
@@ -784,6 +784,48 @@ const juniorReviewItemSlackCards = pgTable("junior_review_item_slack_cards", {
|
|
|
784
784
|
channelId: text("channel_id").notNull(),
|
|
785
785
|
messageTs: text("message_ts").notNull()
|
|
786
786
|
}, (table) => [primaryKey({ columns: [table.itemId, table.conversationId] })]);
|
|
787
|
+
// src/db/schema/plan-items.ts
|
|
788
|
+
/**
|
|
789
|
+
* Gives each Plan item its id and each change its version. One sequence
|
|
790
|
+
* serves every Conversation, so history that a fork copies from its parent
|
|
791
|
+
* never shows a version that the fork's own plan reuses.
|
|
792
|
+
*/
|
|
793
|
+
const juniorPlanItemVersionSeq = pgSequence("junior_plan_item_version_seq");
|
|
794
|
+
/**
|
|
795
|
+
* One Plan item: work that a Conversation has not finished. At most one
|
|
796
|
+
* assignee: a Conversation (the plan's own agent or one of its child agents)
|
|
797
|
+
* or a User. An item without one belongs to the plan's own agent.
|
|
798
|
+
* `changed_by_user_id` is set when a person made the latest change, and null
|
|
799
|
+
* when the plan's own agent did. Both User keys block deleting the User, as
|
|
800
|
+
* Conversation participants do: setting them null would turn a person's item
|
|
801
|
+
* into the agent's and hide an unseen change from `<plan-delta>`.
|
|
802
|
+
*/
|
|
803
|
+
const juniorPlanItems = pgTable("junior_plan_items", {
|
|
804
|
+
conversationId: text("conversation_id").notNull(),
|
|
805
|
+
id: bigint("id", { mode: "number" }).notNull(),
|
|
806
|
+
title: text("title").notNull(),
|
|
807
|
+
notes: text("notes"),
|
|
808
|
+
status: text("status").$type().notNull(),
|
|
809
|
+
assigneeConversationId: text("assignee_conversation_id"),
|
|
810
|
+
assigneeUserId: text("assignee_user_id").references(() => juniorUsers.id),
|
|
811
|
+
version: bigint("version", { mode: "number" }).notNull(),
|
|
812
|
+
changedByUserId: text("changed_by_user_id").references(() => juniorUsers.id),
|
|
813
|
+
createdAt: timestamptz("created_at").notNull(),
|
|
814
|
+
updatedAt: timestamptz("updated_at").notNull()
|
|
815
|
+
}, (table) => [
|
|
816
|
+
primaryKey({
|
|
817
|
+
name: "junior_plan_items_pk",
|
|
818
|
+
columns: [table.conversationId, table.id]
|
|
819
|
+
}),
|
|
820
|
+
foreignKey({
|
|
821
|
+
name: "junior_plan_items_conversation_id_fk",
|
|
822
|
+
columns: [table.conversationId],
|
|
823
|
+
foreignColumns: [juniorConversations.conversationId]
|
|
824
|
+
}).onDelete("cascade"),
|
|
825
|
+
check("junior_plan_items_status_check", sql`${table.status} in ('pending', 'in_progress', 'blocked', 'done', 'cancelled')`),
|
|
826
|
+
check("junior_plan_items_assignee_check", sql`${table.assigneeConversationId} is null or ${table.assigneeUserId} is null`),
|
|
827
|
+
uniqueIndex("junior_plan_items_in_progress_uidx").on(table.conversationId, sql`coalesce(${table.assigneeConversationId}, ${table.assigneeUserId}, ${table.conversationId})`).where(sql`${table.status} = 'in_progress'`)
|
|
828
|
+
]);
|
|
787
829
|
// src/db/schema/push-subscriptions.ts
|
|
788
830
|
/**
|
|
789
831
|
* One browser Web Push subscription for one user. A user can have one row for
|
|
@@ -879,6 +921,7 @@ const juniorSqlSchema = {
|
|
|
879
921
|
juniorReviewItemConversations,
|
|
880
922
|
juniorReviewItemSlackCards,
|
|
881
923
|
juniorReviewItems,
|
|
924
|
+
juniorPlanItems,
|
|
882
925
|
juniorPushSubscriptions,
|
|
883
926
|
juniorSnapshots,
|
|
884
927
|
juniorStats,
|
|
@@ -1374,4 +1417,4 @@ function createJuniorSqlExecutor(args) {
|
|
|
1374
1417
|
statementTimeoutMs
|
|
1375
1418
|
});
|
|
1376
1419
|
}
|
|
1377
|
-
export {
|
|
1420
|
+
export { juniorCodeChanges as A, juniorConversationBriefs as C, juniorConversationEvents as D, isUserInstruction as E, juniorConversations as F, juniorIdentities as I, juniorUsers as L, juniorAttachmentUploads as M, juniorAttachments as N, juniorApiTokens as O, juniorMessageAttachments as P, juniorDestinations as R, juniorConversationEmbeddings as S, juniorConversationMetrics as T, juniorAgentBindings as _, juniorPushSubscriptions as a, juniorConversationParticipants as b, juniorReviewItemAssignees as c, juniorReviewItems as d, juniorAutomationRuns as f, juniorLocationConfigurations as g, juniorStats as h, juniorWorkspaces as i, juniorCodeRepositories as j, juniorConversationAnnotations as k, juniorReviewItemConversations as l, juniorAutomations as m, juniorSnapshots as n, juniorPlanItemVersionSeq as o, juniorAutomationVersions as p, juniorWorkspaceRepos as r, juniorPlanItems as s, createJuniorSqlExecutor as t, juniorReviewItemSlackCards as u, juniorAgentInvocations as v, CONVERSATION_METRICS as w, juniorConversationBindings as x, juniorConversationReadPositions as y, juniorArtifacts as z };
|
|
@@ -100,7 +100,11 @@ function encodeHistoryPayload(data) {
|
|
|
100
100
|
model: message["model"],
|
|
101
101
|
provider: message["provider"],
|
|
102
102
|
usage: message["usage"],
|
|
103
|
-
toolCallId: message["toolCallId"]
|
|
103
|
+
toolCallId: message["toolCallId"],
|
|
104
|
+
stopReason: message["stopReason"],
|
|
105
|
+
timestamp: message["timestamp"],
|
|
106
|
+
toolName: message["toolName"],
|
|
107
|
+
isError: message["isError"]
|
|
104
108
|
}
|
|
105
109
|
};
|
|
106
110
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { E as withSpan, b as setSpanAttributes } from "./logging-
|
|
1
|
+
import { Ca as SANDBOX_WORKSPACE_ROOT, ka as runNonInteractiveCommand, ya as SANDBOX_COMMAND_PATH } from "./projection-CWXDE0f6.js";
|
|
2
|
+
import { E as withSpan, b as setSpanAttributes } from "./logging-oYpJYr-S.js";
|
|
3
3
|
// src/chat/sandbox/resources.ts
|
|
4
4
|
let configuredResources;
|
|
5
5
|
function resourcesFromEnv() {
|
package/dist/instrumentation.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { a as getClient, c as init, i as getActiveSpan, o as getGlobalScope, p as spanToJSON, s as getTraceData } from "./sentry-CPbZjomA.js";
|
|
2
|
-
import { n as getCurrentConversationPrivacy } from "./conversation-privacy-
|
|
2
|
+
import { n as getCurrentConversationPrivacy } from "./conversation-privacy-YE54gMN8.js";
|
|
3
3
|
import { n as isPushServiceHost } from "./push-endpoint-CO-nomUd.js";
|
|
4
4
|
import { n as redactSandboxEgressProxyPath } from "./proxy-path-BHYoKZdq.js";
|
|
5
5
|
import { n as promoteHttpRouteName, r as routeNameMiddleware, t as nameRequestRoute } from "./sentry-route-name-C6EIzAGP.js";
|
|
6
6
|
import { t as consumePrivateTraceResultMarker } from "./private-trace-result-CE7_lEdq.js";
|
|
7
|
-
import { B as getDeploymentServiceVersion, V as getDeploymentTelemetryAttributes } from "./logging-
|
|
7
|
+
import { B as getDeploymentServiceVersion, V as getDeploymentTelemetryAttributes } from "./logging-oYpJYr-S.js";
|
|
8
8
|
import { performance } from "node:perf_hooks";
|
|
9
9
|
import { subscribe, unsubscribe } from "node:diagnostics_channel";
|
|
10
10
|
// src/chat/pi/gateway-request-timing.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as conversationKindFromRow, o as getDb } from "./db-
|
|
2
|
-
import {
|
|
1
|
+
import { A as conversationKindFromRow, o as getDb } from "./db-DV2ZUb1Y.js";
|
|
2
|
+
import { F as juniorConversations } from "./executor-CjNhwwnj.js";
|
|
3
3
|
import { desc, eq, sql } from "drizzle-orm";
|
|
4
4
|
// src/chat/conversations/lineage.ts
|
|
5
5
|
/**
|
|
@@ -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-CPbZjomA.js";
|
|
2
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
2
|
+
import { t as JUNIOR_VERSION } from "./version-BFmuwgxP.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";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import { M as toolInvocationDestination, j as actorFromRun } from "./agent-runner-
|
|
3
|
-
import {
|
|
4
|
-
import { a as enqueueAgentMessageToParent } from "./result-
|
|
5
|
-
import {
|
|
6
|
-
import { n as botConfig } from "./config-
|
|
7
|
-
import { P as SYSTEM_IDENTITY_ID, a as getConversationStore, o as getDb } from "./db-
|
|
8
|
-
import {
|
|
9
|
-
import { r as appendAndEnqueueInboundMessage } from "./store-
|
|
2
|
+
import { M as toolInvocationDestination, j as actorFromRun } from "./agent-runner-BaLjEjPR.js";
|
|
3
|
+
import { $t as readChildConversationSender, Bt as getActiveAgentInvocationForConversation, Cn as findChildAgentConversationId, Sn as AgentMessageTargetError, Tn as PARENT_AGENT_TARGET, Ut as getLatestAgentInvocationForConversation, un as enqueueAgentInvocation, vn as createAgentInvocationForMessage, xn as AgentMessagePausedError } from "./warmup-mTMIatCV.js";
|
|
4
|
+
import { a as enqueueAgentMessageToParent } from "./result-BmF9v9bv.js";
|
|
5
|
+
import { Fa as readConversationAccessFromSql, Ma as canAccessConversation } from "./projection-CWXDE0f6.js";
|
|
6
|
+
import { Z as renderUntrustedTag, n as botConfig } from "./config-DUD-zMvp.js";
|
|
7
|
+
import { P as SYSTEM_IDENTITY_ID, a as getConversationStore, o as getDb } from "./db-DV2ZUb1Y.js";
|
|
8
|
+
import { $ as postAutomatedTurnLimitNoticeForConversation, F as EVENT_WAIT_MS, ot as admitAutomatedTurn } from "./session-stop-BQxgHR4X.js";
|
|
9
|
+
import { r as appendAndEnqueueInboundMessage } from "./store-Dz3YZ7gQ.js";
|
|
10
10
|
// src/chat/agent-invocations/top-level-message.ts
|
|
11
11
|
const AGENT_MESSAGE_EVENT_NAMESPACE = "junior";
|
|
12
12
|
/** Event type of a message from another top-level agent. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import { s as getSqlExecutor } from "./db-
|
|
3
|
-
import { h as isVisionImageMediaType, m as detectImageMediaType } from "./web-message-id-
|
|
4
|
-
import {
|
|
2
|
+
import { s as getSqlExecutor } from "./db-DV2ZUb1Y.js";
|
|
3
|
+
import { h as isVisionImageMediaType, m as detectImageMediaType } from "./web-message-id-CUaSiGme.js";
|
|
4
|
+
import { co as readLiveAttachment } from "./projection-CWXDE0f6.js";
|
|
5
5
|
// src/chat/attachments/model-input.ts
|
|
6
6
|
var model_input_exports = /* @__PURE__ */ __exportAll({ loadInputAttachments: () => loadInputAttachments });
|
|
7
7
|
/** Largest file that Slack and web send to the model in the prompt. */
|
package/dist/nitro.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as JuniorPluginSet } from "./plugins-B_0Cr0MO.js";
|
|
2
|
-
import { i as JuniorDashboardOptions } from "./app-
|
|
2
|
+
import { i as JuniorDashboardOptions } from "./app-DvYbM9UD.js";
|
|
3
3
|
import { withSentryConfig as withSentryConfig$1 } from "@sentry/nitro";
|
|
4
4
|
type SentryNitroConfig = Parameters<typeof withSentryConfig$1>[0];
|
|
5
5
|
type SentryNitroOptions = NonNullable<Parameters<typeof withSentryConfig$1>[1]>;
|
package/dist/nitro.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-x4AvVhMj.js";
|
|
2
2
|
import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-Bkk0XRo2.js";
|
|
3
|
-
import { o as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, t as CACHE_WARMUP_QUEUE_TOPIC } from "./queue-
|
|
4
|
-
import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-
|
|
5
|
-
import { s as resolveConversationWorkQueueTopic, t as BACKGROUND_COMPACTION_QUEUE_TOPIC } from "./background-compaction-queue-
|
|
6
|
-
import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, B as getDeploymentServiceVersion, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_CRON_SCHEDULE, I as JUNIOR_RETENTION_ROUTE, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_CRON_SCHEDULE, N as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, k as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE } from "./logging-
|
|
3
|
+
import { o as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, t as CACHE_WARMUP_QUEUE_TOPIC } from "./queue-7FSijgqG.js";
|
|
4
|
+
import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-CFlrJguF.js";
|
|
5
|
+
import { s as resolveConversationWorkQueueTopic, t as BACKGROUND_COMPACTION_QUEUE_TOPIC } from "./background-compaction-queue-D2wzxtGU.js";
|
|
6
|
+
import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, B as getDeploymentServiceVersion, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_CRON_SCHEDULE, I as JUNIOR_RETENTION_ROUTE, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_CRON_SCHEDULE, N as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, k as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE } from "./logging-oYpJYr-S.js";
|
|
7
7
|
import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cv2ETe8Y.js";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-
|
|
2
|
-
import {
|
|
1
|
+
import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-Cdm-e1vJ.js";
|
|
2
|
+
import { Bn as createUserTokenStore } from "./projection-CWXDE0f6.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;
|