@sentry/junior 0.257.0 → 0.259.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/{actor-BTtLaeWy.js → actor-tlxzqaRe.js} +3 -6
- package/dist/adapter-Bn0gFVSF.js +270 -0
- package/dist/{admin-DgIkm6Vy.js → admin-C8xz2f10.js} +2 -3
- package/dist/{agent-hooks-BjtTzvru.js → agent-hooks-B00FaKdP.js} +70 -109
- package/dist/{agent-invocations-Bdu3ROfo.js → agent-invocations-Qfz7dWgU.js} +6 -12
- package/dist/{agent-runner-D7OboVb3.js → agent-runner-CPSd7rKm.js} +324 -742
- package/dist/api/schema.d.ts +442 -447
- package/dist/api/schema.js +6 -6
- package/dist/api.d.ts +2 -12
- package/dist/api.js +165 -158
- package/dist/{app-BsU5QNBd.d.ts → app-Bbxrehjf.d.ts} +25 -45
- package/dist/app.d.ts +3 -3
- package/dist/app.js +206 -321
- package/dist/{assistant-reply-CbTPebzL.js → assistant-reply-CqthTerd.js} +3 -5
- package/dist/{automation-CHdlHVZP.js → automation-DWBFBenG.js} +6 -11
- package/dist/{briefs-oLOldnDM.js → briefs-DNYbQ9cD.js} +8 -11
- package/dist/{cadence-D00SCzT1.js → cadence-R7Em4RjE.js} +1 -2
- package/dist/{catalog-runtime-CZzhGQ7F.js → catalog-runtime-B8SuFPGb.js} +3 -4
- package/dist/cli/chat.d.ts +2 -4
- package/dist/cli/chat.js +22 -24
- package/dist/cli/check.d.ts +1 -3
- package/dist/cli/check.js +4 -5
- package/dist/cli/env.d.ts +1 -3
- package/dist/cli/env.js +1 -2
- package/dist/cli/init.d.ts +1 -3
- package/dist/cli/init.js +3 -3
- package/dist/cli/main.d.ts +1 -3
- package/dist/cli/main.js +8 -5
- package/dist/cli/plugins.d.ts +2 -4
- package/dist/cli/plugins.js +7 -8
- package/dist/cli/run.d.ts +3 -3
- package/dist/cli/run.js +3 -3
- package/dist/cli/snapshot-create.d.ts +1 -3
- package/dist/cli/snapshot-create.js +5 -5
- package/dist/cli/upgrade.d.ts +3 -6
- package/dist/cli/upgrade.js +11 -17
- package/dist/{client-D8HnkOQX.js → client-BZdxgKyL.js} +64 -18
- package/dist/{config-CJRnWK9H.js → config-Deqpfpg9.js} +21 -15
- package/dist/{connections-ClYrKzpX.js → connections-9gJkfS85.js} +179 -20
- package/dist/{conversation-CKNLYBJt.js → conversation-DjN3mlog.js} +8 -15
- package/dist/{conversation-privacy-C8b1nphZ.js → conversation-privacy-CFhNKxp-.js} +2 -3
- package/dist/{conversation-work-C6y3T5Hx.js → conversation-work-BaT_T6EB.js} +1 -2
- package/dist/{credential-sync-BXfohNmJ.js → credential-sync-BABGymK3.js} +23 -190
- package/dist/{db-Ca9Nt5ci.d.ts → db-BnRqQ7G5.d.ts} +1 -1
- package/dist/{executor-Do0THDRR.js → executor-Bb3eQb8q.js} +30 -52
- package/dist/{experimental-CQIvMUO7.js → experimental-BNK1l1jv.js} +2 -4
- package/dist/{history-9pO1Zd4Y.js → history-AY8rs-FR.js} +5 -9
- package/dist/{history-DvqWZlYX.d.ts → history-BgI33Kie.d.ts} +12 -20
- package/dist/{images-BN_BiBXF.js → images-BbSdVHC6.js} +5 -6
- package/dist/instrumentation.d.ts +1 -3
- package/dist/instrumentation.js +6 -8
- package/dist/{job-queue-B6SV9uVa.js → job-queue-vdGU-5ge.js} +6 -12
- package/dist/{logging-CWxiIuCF.js → logging-BStXN56b.js} +7 -12
- package/dist/{message-TUOdbSBW.js → message-DRf6m4uO.js} +5 -6
- package/dist/{model-profile-BwU8mqwD.js → model-profile-Bg8EoCKD.js} +2 -4
- package/dist/nitro.d.ts +3 -5
- package/dist/nitro.js +12 -17
- package/dist/{oauth-authorization-BA4Dt6a7.js → oauth-authorization-djQn5Nhy.js} +2 -4
- package/dist/{oauth-callback-server-Dj5UJODo.js → oauth-callback-server-JmOgLcGl.js} +3 -4
- package/dist/{oauth-relay-CdCnu80W.js → oauth-relay-CTygMkNx.js} +2 -3
- package/dist/{package-discovery-BVvSnQBB.js → package-discovery-DJBompdd.js} +17 -21
- package/dist/{pending-auth-s_QFribU.js → pending-auth-rG5U_QS1.js} +92 -83
- package/dist/{plugin-module-CVvEUSMH.js → plugin-module-Cf5gVPWP.js} +1 -2
- package/dist/{plugins-CjfUP5gJ.d.ts → plugins-B_0Cr0MO.d.ts} +5 -5
- package/dist/{plugins-egKWjgue.js → plugins-DOm9Y6qI.js} +2 -3
- package/dist/{private-trace-result-BLvBjy_e.js → private-trace-result-CE7_lEdq.js} +1 -2
- package/dist/{profile-h-72wM78.js → profile-qBM6B_-V.js} +14 -295
- package/dist/{prompt-DyoEj9c2.js → prompt-xgpyMtg7.js} +5 -9
- package/dist/{queue-B5SnqRln.d.ts → queue-C37RbDVc.d.ts} +0 -2
- package/dist/{registry-sLTr-sV9.js → registry-B_M_x_iS.js} +56 -30
- package/dist/{resolve-ncQPZROQ.js → resolve-BzpuLh8c.js} +8 -12
- package/dist/{result-C883vngT.js → result-DEZH_AnZ.js} +13 -17
- package/dist/{rolldown-runtime-B4FMCO8f.js → rolldown-runtime-nwUcYXjP.js} +1 -2
- package/dist/{runner-CzYImdOF.js → runner-BqQlG10t.js} +12 -13
- package/dist/{sandbox-egress-signals-CZbMINHI.js → sandbox-egress-signals-DCq3WLs5.js} +2 -3
- package/dist/{schema-Dy69D4Ge.js → schema-CF9HqNRY.js} +30 -27
- package/dist/{sentry-CgWZM_kV.js → sentry-BBUlHih9.js} +2 -3
- package/dist/service-account-BqTBkyD7.js +120 -0
- package/dist/service-account-BzhW7kXu.js +661 -0
- package/dist/{session-stop-CQjKd4a2.js → session-stop-CV65ZlU3.js} +23 -33
- package/dist/{skills-C22SLruK.js → skills-CiWS5_Ub.js} +9 -9
- package/dist/{spawn-DY9CLXDL.js → spawn-BSAQ7UQZ.js} +4 -5
- package/dist/{store-DXFIQy-G.js → store-B1GES4gC.js} +13 -15
- package/dist/{store-DoewL5mG.d.ts → store-CG0VJyye.d.ts} +0 -14
- package/dist/{task-queue-B17vV0La.js → task-queue-BAeGEMjJ.js} +5 -7
- package/dist/{task-runner-DUjvzYXj.js → task-runner-BlGhcQPi.js} +22 -26
- package/dist/{tasks-D_WIJtvO.js → tasks-DieKX3d4.js} +63 -78
- package/dist/{thread-state-Ch4yuCqG.js → thread-state-DpSWS4Rr.js} +13 -19
- package/dist/{turn-failure-response-C5nBKC4S.js → turn-failure-response-DQljogGJ.js} +16 -22
- package/dist/{turn-lifecycle-CO-ylUmV.js → turn-lifecycle-BLgrkV_L.js} +2 -3
- package/dist/{turn-session-routing-B3LWooK5.js → turn-session-routing-BlajheOU.js} +2 -3
- package/dist/{validation-CXYxaNYx.js → validation-23d7K9tX.js} +3 -4
- package/dist/vercel.d.ts +1 -3
- package/dist/vercel.js +1 -2
- package/dist/{version-BcdZy2zg.js → version-B_XumRx-.js} +3 -5
- package/dist/{version-CnXZ614E.d.ts → version-Cc2OFd9G.d.ts} +0 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -2
- package/dist/{viewer-DSZXygMU.js → viewer-B2_ABsYi.js} +26 -57
- package/dist/{web-input-B9Bv0_lR.js → web-input-BZDyxpzR.js} +101 -158
- package/dist/{web-message-id-xPI_EFSC.js → web-message-id-CJSUiksE.js} +3 -6
- package/dist/{work-nAfDSUFP.js → work-D3QKiV0O.js} +14 -16
- package/dist/{worker-vGXZ6XFT.js → worker-C8mUjYf9.js} +7 -8
- package/package.json +10 -9
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import {
|
|
3
|
-
import { T as withSpan, a as extractGenAiUsageSummary, b as setSpanStatus, f as logException, m as logWarn, p as logInfo, y as setSpanAttributes, z as isRecord$1 } from "./logging-
|
|
4
|
-
import { a as getClient$1 } from "./sentry-
|
|
5
|
-
import { t as canExposeConversationPayload } from "./conversation-privacy-
|
|
6
|
-
import { i as getChatConfig, n as botConfig, o as getSlackBotToken } from "./config-
|
|
7
|
-
import { r as defaultModelId } from "./model-profile-
|
|
8
|
-
import { d as parseSlackTeamId, g as parseSlackMessageTs, i as isActorUserId, o as parseActorUserId, u as parseSlackChannelReferenceId } from "./actor-
|
|
9
|
-
import {
|
|
10
|
-
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, s as juniorConversations } from "./agent-invocations-
|
|
11
|
-
import { _ as juniorConversationAnnotations, b as juniorAttachments, f as juniorConversationBriefs, h as juniorConversationEvents, i as juniorWorkspaces, n as juniorSnapshots, r as juniorWorkspaceRepos, u as juniorConversationParticipants, v as juniorCodeChanges, y as juniorCodeRepositories } from "./executor-
|
|
12
|
-
import { o as decodeStoredConversationEvent } from "./history-
|
|
13
|
-
import { h as credentialSubjectSchema } from "./registry-
|
|
14
|
-
import { C as conversationReportEventSchema, F as readMessageAttachments, H as conversationBriefSchema, U as parseBriefInput, q as readMessageCardRefs } from "./conversation-
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
+
import { i as completeObject, o as embedTexts } from "./client-BZdxgKyL.js";
|
|
3
|
+
import { T as withSpan, a as extractGenAiUsageSummary, b as setSpanStatus, f as logException, m as logWarn, p as logInfo, y as setSpanAttributes, z as isRecord$1 } from "./logging-BStXN56b.js";
|
|
4
|
+
import { a as getClient$1 } from "./sentry-BBUlHih9.js";
|
|
5
|
+
import { t as canExposeConversationPayload } from "./conversation-privacy-CFhNKxp-.js";
|
|
6
|
+
import { i as getChatConfig, n as botConfig, o as getSlackBotToken } from "./config-Deqpfpg9.js";
|
|
7
|
+
import { r as defaultModelId } from "./model-profile-Bg8EoCKD.js";
|
|
8
|
+
import { d as parseSlackTeamId, g as parseSlackMessageTs, i as isActorUserId, o as parseActorUserId, u as parseSlackChannelReferenceId } from "./actor-tlxzqaRe.js";
|
|
9
|
+
import { D as hasAgentTurnUsage, M as readUserTimezone, P as saveUserTimezone, c as getConversationEventStore, d as getDb, f as getSqlExecutor, g as createSqlStore, i as resolveViewerUser, r as readActorIdentity } from "./viewer-B2_ABsYi.js";
|
|
10
|
+
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, s as juniorConversations } from "./agent-invocations-Qfz7dWgU.js";
|
|
11
|
+
import { _ as juniorConversationAnnotations, b as juniorAttachments, f as juniorConversationBriefs, h as juniorConversationEvents, i as juniorWorkspaces, n as juniorSnapshots, r as juniorWorkspaceRepos, u as juniorConversationParticipants, v as juniorCodeChanges, y as juniorCodeRepositories } from "./executor-Bb3eQb8q.js";
|
|
12
|
+
import { o as decodeStoredConversationEvent } from "./history-AY8rs-FR.js";
|
|
13
|
+
import { h as credentialSubjectSchema } from "./registry-B_M_x_iS.js";
|
|
14
|
+
import { C as conversationReportEventSchema, F as readMessageAttachments, H as conversationBriefSchema, U as parseBriefInput, q as readMessageCardRefs } from "./conversation-DjN3mlog.js";
|
|
15
|
+
import { E as SANDBOX_WORKSPACE_ROOT, S as sleep$1, l as isSandboxMissingError, n as hash, v as getVercelSandboxCredentials, x as runNonInteractiveCommand } from "./profile-qBM6B_-V.js";
|
|
16
|
+
import { n as getDefaultRedisStateAdapterFor, r as getStateAdapter } from "./adapter-Bn0gFVSF.js";
|
|
17
|
+
import { i as isValidTimeZone } from "./cadence-R7Em4RjE.js";
|
|
18
|
+
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-xgpyMtg7.js";
|
|
18
19
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
19
20
|
import { z } from "zod";
|
|
20
21
|
import { createHash, createHmac, randomUUID, timingSafeEqual } from "node:crypto";
|
|
@@ -23,7 +24,7 @@ import { codeChangeInputSchema, conversationAnnotationInputSchema, conversationE
|
|
|
23
24
|
import { alias } from "drizzle-orm/pg-core";
|
|
24
25
|
import { WebClient } from "@slack/web-api";
|
|
25
26
|
import { Sandbox } from "@vercel/sandbox";
|
|
26
|
-
|
|
27
|
+
// src/chat/conversations/structured-events.ts
|
|
27
28
|
/** Reserved namespace for Junior-owned conversation metadata events. */
|
|
28
29
|
const JUNIOR_NATIVE_EVENT_NAMESPACE = "junior";
|
|
29
30
|
const authenticationEventContentSchema = z.object({
|
|
@@ -156,8 +157,7 @@ function renderJuniorNativeConversationEvent(args) {
|
|
|
156
157
|
const presentation = definition.renderEvent(definition.parse(args.content));
|
|
157
158
|
return presentation === void 0 ? void 0 : conversationEventPresentationSchema.parse(presentation);
|
|
158
159
|
}
|
|
159
|
-
|
|
160
|
-
//#region src/chat/slack/workspace-context.ts
|
|
160
|
+
// src/chat/slack/workspace-context.ts
|
|
161
161
|
const workspaceTeamIdStorage = new AsyncLocalStorage();
|
|
162
162
|
/** Run a callback with the Slack workspace team ID for the inbound webhook. */
|
|
163
163
|
function runWithWorkspaceTeamId(teamId, fn) {
|
|
@@ -168,8 +168,7 @@ function runWithWorkspaceTeamId(teamId, fn) {
|
|
|
168
168
|
function getWorkspaceTeamId() {
|
|
169
169
|
return workspaceTeamIdStorage.getStore();
|
|
170
170
|
}
|
|
171
|
-
|
|
172
|
-
//#region src/chat/slack/client.ts
|
|
171
|
+
// src/chat/slack/client.ts
|
|
173
172
|
var SlackActionError = class extends Error {
|
|
174
173
|
code;
|
|
175
174
|
apiError;
|
|
@@ -507,8 +506,7 @@ async function downloadPrivateSlackFile(url) {
|
|
|
507
506
|
"app.slack.method": "files.download"
|
|
508
507
|
});
|
|
509
508
|
}
|
|
510
|
-
|
|
511
|
-
//#region src/chat/slack/user.ts
|
|
509
|
+
// src/chat/slack/user.ts
|
|
512
510
|
const slackUserInfoSchema = z.object({
|
|
513
511
|
ok: z.literal(true),
|
|
514
512
|
user: z.object({
|
|
@@ -577,8 +575,7 @@ async function lookupSlackUser(teamId, userId) {
|
|
|
577
575
|
return null;
|
|
578
576
|
}
|
|
579
577
|
}
|
|
580
|
-
|
|
581
|
-
//#region src/chat/identities/timezone.ts
|
|
578
|
+
// src/chat/identities/timezone.ts
|
|
582
579
|
const DEFAULT_TIMEZONE = "America/Los_Angeles";
|
|
583
580
|
/** The install timezone, used when Junior does not know a person's timezone. */
|
|
584
581
|
function defaultTimezone() {
|
|
@@ -597,8 +594,7 @@ async function resolveUserTimezone(args) {
|
|
|
597
594
|
}
|
|
598
595
|
return (args.userId ? await readUserTimezone(args.db, args.userId) : void 0) ?? defaultTimezone();
|
|
599
596
|
}
|
|
600
|
-
|
|
601
|
-
//#region src/chat/plugins/annotations.ts
|
|
597
|
+
// src/chat/plugins/annotations.ts
|
|
602
598
|
function annotationFromRow(row) {
|
|
603
599
|
const parsed = conversationAnnotationInputSchema.safeParse(row.annotation);
|
|
604
600
|
if (!parsed.success) return void 0;
|
|
@@ -661,8 +657,7 @@ async function listConversationAnnotationsById(db, conversationIds) {
|
|
|
661
657
|
}
|
|
662
658
|
return byConversation;
|
|
663
659
|
}
|
|
664
|
-
|
|
665
|
-
//#region src/chat/conversations/annotation-results.ts
|
|
660
|
+
// src/chat/conversations/annotation-results.ts
|
|
666
661
|
/** Save object annotations and retain returned facts in the tool result. */
|
|
667
662
|
async function saveObjectAnnotations(conversationId, plugin, value) {
|
|
668
663
|
const annotations = objectAnnotationSchema.array().parse(value);
|
|
@@ -699,8 +694,7 @@ async function annotateToolResult(conversationId, plugin, result) {
|
|
|
699
694
|
};
|
|
700
695
|
return annotated;
|
|
701
696
|
}
|
|
702
|
-
|
|
703
|
-
//#region src/chat/conversations/sql/privacy.ts
|
|
697
|
+
// src/chat/conversations/sql/privacy.ts
|
|
704
698
|
const privacyRoot = alias(juniorConversations, "privacy_root");
|
|
705
699
|
/** Accept only a structurally valid persisted root as privacy authority. */
|
|
706
700
|
async function readRootCandidate(executor, conversationId) {
|
|
@@ -713,7 +707,7 @@ async function readRootCandidate(executor, conversationId) {
|
|
|
713
707
|
rootParentConversationId: privacyRoot.parentConversationId,
|
|
714
708
|
rootRootConversationId: privacyRoot.rootConversationId
|
|
715
709
|
}).from(juniorConversations).leftJoin(privacyRoot, eq(privacyRoot.conversationId, juniorConversations.rootConversationId)).where(eq(juniorConversations.conversationId, conversationId)))[0];
|
|
716
|
-
return row
|
|
710
|
+
return row !== void 0 && row.requestedRootConversationId !== null && (row.requestedParentConversationId !== null || row.requestedRootConversationId === row.requestedConversationId) && row.rootConversationId === row.requestedRootConversationId && row.rootRootConversationId === row.rootConversationId && row.rootParentConversationId === null && row.rootDestinationId !== null ? {
|
|
717
711
|
destinationId: row.rootDestinationId,
|
|
718
712
|
rootConversationId: row.rootConversationId
|
|
719
713
|
} : void 0;
|
|
@@ -740,8 +734,7 @@ async function resolveRootVisibility(executor, conversationId) {
|
|
|
740
734
|
};
|
|
741
735
|
return readCandidateVisibility(executor, candidate);
|
|
742
736
|
}
|
|
743
|
-
|
|
744
|
-
//#region src/chat/briefs/events.ts
|
|
737
|
+
// src/chat/briefs/events.ts
|
|
745
738
|
/** Durable cost and size record for one stored Brief version. */
|
|
746
739
|
const briefUpdatedEvent = defineConversationEvent({
|
|
747
740
|
name: "brief_updated",
|
|
@@ -761,8 +754,7 @@ const briefUpdatedEvent = defineConversationEvent({
|
|
|
761
754
|
};
|
|
762
755
|
}
|
|
763
756
|
});
|
|
764
|
-
|
|
765
|
-
//#region src/chat/slack/attachments.ts
|
|
757
|
+
// src/chat/slack/attachments.ts
|
|
766
758
|
/** Save the vision summary for a stored Slack attachment. */
|
|
767
759
|
async function recordSlackAttachment(args) {
|
|
768
760
|
await args.db.db().update(juniorAttachments).set({ visionSummary: args.visionSummary }).where(and(eq(juniorAttachments.id, args.attachmentId), eq(juniorAttachments.conversationId, args.conversationId), isNull(juniorAttachments.deleteRequestedAt)));
|
|
@@ -789,8 +781,7 @@ function getSlackFileId(attachment) {
|
|
|
789
781
|
if (metadataId) return metadataId;
|
|
790
782
|
return (attachment.url ?? attachment.fetchMetadata?.url ?? "").match(/(?:^|[-/])(F[A-Z0-9]+)(?:[-/]|$)/i)?.[1];
|
|
791
783
|
}
|
|
792
|
-
|
|
793
|
-
//#region src/api/conversations/message-attachments.ts
|
|
784
|
+
// src/api/conversations/message-attachments.ts
|
|
794
785
|
/** Resolve saved Slack file references without exposing private storage details. */
|
|
795
786
|
async function hydrateMessageAttachments(db, conversationId, events) {
|
|
796
787
|
const messages = events.flatMap((event) => event.data.type === "message" ? [event.data] : []);
|
|
@@ -818,8 +809,7 @@ function slackFileIds(meta) {
|
|
|
818
809
|
const ids = meta?.slackFileIds ?? meta?.imageFileIds;
|
|
819
810
|
return Array.isArray(ids) ? ids.filter((id) => typeof id === "string") : [];
|
|
820
811
|
}
|
|
821
|
-
|
|
822
|
-
//#region src/chat/sentry-links.ts
|
|
812
|
+
// src/chat/sentry-links.ts
|
|
823
813
|
function getSentryOrgSlug() {
|
|
824
814
|
return process.env.SENTRY_ORG_SLUG?.trim() || void 0;
|
|
825
815
|
}
|
|
@@ -855,8 +845,7 @@ function buildSentryEventUrl(eventId) {
|
|
|
855
845
|
query: { query: eventId }
|
|
856
846
|
});
|
|
857
847
|
}
|
|
858
|
-
|
|
859
|
-
//#region src/api/conversations/event-model.ts
|
|
848
|
+
// src/api/conversations/event-model.ts
|
|
860
849
|
/** Apply recorded model choices without carrying a previous turn's settings forward. */
|
|
861
850
|
function conversationEventModel(data, current) {
|
|
862
851
|
if (data.type === "turn_started") return void 0;
|
|
@@ -895,8 +884,7 @@ function conversationEventModelCall(data) {
|
|
|
895
884
|
...hasAgentTurnUsage(usage) ? { usage } : void 0
|
|
896
885
|
};
|
|
897
886
|
}
|
|
898
|
-
|
|
899
|
-
//#region src/api/conversations/events.ts
|
|
887
|
+
// src/api/conversations/events.ts
|
|
900
888
|
/** Canonical event types that can contribute to the reporting projection. */
|
|
901
889
|
const conversationReportSourceEventTypes = [
|
|
902
890
|
"message",
|
|
@@ -1318,8 +1306,7 @@ function projectConversationReportEventPage(args) {
|
|
|
1318
1306
|
}
|
|
1319
1307
|
return projected;
|
|
1320
1308
|
}
|
|
1321
|
-
|
|
1322
|
-
//#region src/api/conversations/event-page.ts
|
|
1309
|
+
// src/api/conversations/event-page.ts
|
|
1323
1310
|
const conversationEventColumns = getTableColumns(juniorConversationEvents);
|
|
1324
1311
|
const MIN_SCAN_SIZE = 64;
|
|
1325
1312
|
/** Read bounded canonical rows while excluding model-only replacement history. */
|
|
@@ -1430,8 +1417,7 @@ async function readConversationEventPage(executor, args) {
|
|
|
1430
1417
|
...projected.length > events.length && events[0] ? { previousSeq: events[0].seq } : void 0
|
|
1431
1418
|
};
|
|
1432
1419
|
}
|
|
1433
|
-
|
|
1434
|
-
//#region src/chat/briefs/input.ts
|
|
1420
|
+
// src/chat/briefs/input.ts
|
|
1435
1421
|
const EVENT_PAGE_SIZE = 500;
|
|
1436
1422
|
async function readReportEventsThrough(executor, conversationId, throughSeq) {
|
|
1437
1423
|
const pages = [];
|
|
@@ -1500,8 +1486,7 @@ async function briefInputFromSql(executor, conversationId, throughSeq) {
|
|
|
1500
1486
|
}))
|
|
1501
1487
|
});
|
|
1502
1488
|
}
|
|
1503
|
-
|
|
1504
|
-
//#region src/chat/briefs/operational-report.ts
|
|
1489
|
+
// src/chat/briefs/operational-report.ts
|
|
1505
1490
|
const DAY_MS$1 = 864e5;
|
|
1506
1491
|
const WINDOWS = [
|
|
1507
1492
|
7,
|
|
@@ -1595,8 +1580,7 @@ async function buildBriefsOperationalReport(args) {
|
|
|
1595
1580
|
}]
|
|
1596
1581
|
};
|
|
1597
1582
|
}
|
|
1598
|
-
|
|
1599
|
-
//#region src/chat/briefs/store.ts
|
|
1583
|
+
// src/chat/briefs/store.ts
|
|
1600
1584
|
function briefVersionFromRow(row) {
|
|
1601
1585
|
return {
|
|
1602
1586
|
conversationId: row.conversationId,
|
|
@@ -1654,8 +1638,7 @@ async function readLatestConversationBrief(db, conversationId) {
|
|
|
1654
1638
|
const rows = await db.select().from(juniorConversationBriefs).where(eq(juniorConversationBriefs.conversationId, conversationId)).orderBy(desc(juniorConversationBriefs.version)).limit(1);
|
|
1655
1639
|
return rows[0] ? briefVersionFromRow(rows[0]) : void 0;
|
|
1656
1640
|
}
|
|
1657
|
-
|
|
1658
|
-
//#region src/chat/briefs/task.ts
|
|
1641
|
+
// src/chat/briefs/task.ts
|
|
1659
1642
|
const BRIEF_LOCK_TTL_MS = 6e5;
|
|
1660
1643
|
function hasUserInstruction(run) {
|
|
1661
1644
|
return run.transcript.some((entry) => entry.type === "message" && entry.role === "user" && entry.provenance?.authority === "instruction");
|
|
@@ -1766,8 +1749,7 @@ const briefsTaskRegistration = {
|
|
|
1766
1749
|
await updateConversationBrief(context);
|
|
1767
1750
|
} } }
|
|
1768
1751
|
};
|
|
1769
|
-
|
|
1770
|
-
//#region src/chat/plugins/conversation-events.ts
|
|
1752
|
+
// src/chat/plugins/conversation-events.ts
|
|
1771
1753
|
function registeredDefinition(plugin, value) {
|
|
1772
1754
|
return plugin.conversationEvents?.find((definition) => definition === value.definition);
|
|
1773
1755
|
}
|
|
@@ -1804,8 +1786,7 @@ function renderPluginConversationEvent(args) {
|
|
|
1804
1786
|
if (!definition) return void 0;
|
|
1805
1787
|
return definition.renderEvent(definition.parse(args.content));
|
|
1806
1788
|
}
|
|
1807
|
-
|
|
1808
|
-
//#region src/api/conversations/membership.ts
|
|
1789
|
+
// src/api/conversations/membership.ts
|
|
1809
1790
|
/** True when the viewer is a materialized participant on this root conversation. */
|
|
1810
1791
|
function conversationHasParticipantUser(userId) {
|
|
1811
1792
|
const participant = getDb().select({ rootConversationId: juniorConversationParticipants.rootConversationId }).from(juniorConversationParticipants).where(and(eq(juniorConversationParticipants.rootConversationId, juniorConversations.conversationId), eq(juniorConversationParticipants.userId, userId)));
|
|
@@ -1860,8 +1841,7 @@ async function conversationIdsWithParticipantUser(db, conversationIds, userId) {
|
|
|
1860
1841
|
const rows = await db.select({ rootConversationId: juniorConversationParticipants.rootConversationId }).from(juniorConversationParticipants).where(and(eq(juniorConversationParticipants.userId, userId), inArray(juniorConversationParticipants.rootConversationId, [...conversationIds])));
|
|
1861
1842
|
return new Set(rows.map((row) => row.rootConversationId));
|
|
1862
1843
|
}
|
|
1863
|
-
|
|
1864
|
-
//#region src/api/conversations/access.ts
|
|
1844
|
+
// src/api/conversations/access.ts
|
|
1865
1845
|
const rootConversation = alias(juniorConversations, "access_root_conversation");
|
|
1866
1846
|
const rootDestination = alias(juniorDestinations, "access_root_destination");
|
|
1867
1847
|
const rootIdentity = alias(juniorIdentities, "access_root_identity");
|
|
@@ -1901,8 +1881,7 @@ async function readConversationAccessFromSql(db, conversationIds, viewer) {
|
|
|
1901
1881
|
}];
|
|
1902
1882
|
}));
|
|
1903
1883
|
}
|
|
1904
|
-
|
|
1905
|
-
//#region src/chat/plugins/conversation-event-reader.ts
|
|
1884
|
+
// src/chat/plugins/conversation-event-reader.ts
|
|
1906
1885
|
function registeredEventName$1(plugin, eventName) {
|
|
1907
1886
|
if (!plugin.conversationEvents?.some((definition) => definition.eventName === eventName)) throw new TypeError(`Plugin "${plugin.manifest.name}" did not register event "${eventName}"`);
|
|
1908
1887
|
return eventName;
|
|
@@ -1924,8 +1903,7 @@ function createPluginConversationEventReader(plugin) {
|
|
|
1924
1903
|
}));
|
|
1925
1904
|
} };
|
|
1926
1905
|
}
|
|
1927
|
-
|
|
1928
|
-
//#region src/chat/plugins/conversation-event-stats.ts
|
|
1906
|
+
// src/chat/plugins/conversation-event-stats.ts
|
|
1929
1907
|
const DAY_MS = 864e5;
|
|
1930
1908
|
const costRowSchema = z.object({
|
|
1931
1909
|
costUsd: z.number().finite().nonnegative(),
|
|
@@ -2006,8 +1984,7 @@ function createPluginConversationEventStats(plugin, now = Date.now) {
|
|
|
2006
1984
|
}
|
|
2007
1985
|
};
|
|
2008
1986
|
}
|
|
2009
|
-
|
|
2010
|
-
//#region src/chat/plugins/logging.ts
|
|
1987
|
+
// src/chat/plugins/logging.ts
|
|
2011
1988
|
/** Create the host logger exposed to plugin hooks. */
|
|
2012
1989
|
function createPluginLogger(plugin) {
|
|
2013
1990
|
return {
|
|
@@ -2033,8 +2010,7 @@ function createPluginLogger(plugin) {
|
|
|
2033
2010
|
}
|
|
2034
2011
|
};
|
|
2035
2012
|
}
|
|
2036
|
-
|
|
2037
|
-
//#region src/chat/plugins/model.ts
|
|
2013
|
+
// src/chat/plugins/model.ts
|
|
2038
2014
|
/** Create the host-owned structured model capability exposed to plugins. */
|
|
2039
2015
|
function createPluginModel(pluginName, options = {}, runtime = {}) {
|
|
2040
2016
|
return { async completeObject(input) {
|
|
@@ -2072,8 +2048,7 @@ function createPluginEmbedder(pluginName, runtime = {}) {
|
|
|
2072
2048
|
});
|
|
2073
2049
|
} };
|
|
2074
2050
|
}
|
|
2075
|
-
|
|
2076
|
-
//#region src/chat/plugins/state.ts
|
|
2051
|
+
// src/chat/plugins/state.ts
|
|
2077
2052
|
const MAX_PLUGIN_STATE_KEY_LENGTH = 512;
|
|
2078
2053
|
function hashKeyPart(value) {
|
|
2079
2054
|
return createHash("sha256").update(value).digest("hex").slice(0, 32);
|
|
@@ -2130,8 +2105,7 @@ function createPluginState(plugin, adapter) {
|
|
|
2130
2105
|
}
|
|
2131
2106
|
};
|
|
2132
2107
|
}
|
|
2133
|
-
|
|
2134
|
-
//#region src/chat/dashboard-link.ts
|
|
2108
|
+
// src/chat/dashboard-link.ts
|
|
2135
2109
|
let dashboardConversationLinkOptions;
|
|
2136
2110
|
function withHttps(host) {
|
|
2137
2111
|
return /^https?:\/\//.test(host) ? host : `https://${host}`;
|
|
@@ -2181,12 +2155,10 @@ function getDashboardObjectIconLink(icon) {
|
|
|
2181
2155
|
if (url.protocol !== "https:" || url.hostname === "localhost") return void 0;
|
|
2182
2156
|
return url.href;
|
|
2183
2157
|
}
|
|
2184
|
-
|
|
2185
|
-
//#region src/chat/state/ttl.ts
|
|
2158
|
+
// src/chat/state/ttl.ts
|
|
2186
2159
|
/** Retain expiring conversation/runtime state long enough for resume and dashboard history. */
|
|
2187
2160
|
const JUNIOR_THREAD_STATE_TTL_MS = 6048e5;
|
|
2188
|
-
|
|
2189
|
-
//#region src/chat/events/timer-index.ts
|
|
2161
|
+
// src/chat/events/timer-index.ts
|
|
2190
2162
|
const DUE_KEY = "junior:watches:due";
|
|
2191
2163
|
const CLAIM_MS = 12e4;
|
|
2192
2164
|
const BATCH_SIZE = 25;
|
|
@@ -2257,8 +2229,7 @@ async function updateTimerIndex(state, operation) {
|
|
|
2257
2229
|
await state.releaseLock(lock);
|
|
2258
2230
|
}
|
|
2259
2231
|
}
|
|
2260
|
-
|
|
2261
|
-
//#region src/chat/credentials/subject.ts
|
|
2232
|
+
// src/chat/credentials/subject.ts
|
|
2262
2233
|
const CREDENTIAL_SUBJECT_HMAC_CONTEXT = "junior.credential_subject.v1";
|
|
2263
2234
|
const CREDENTIAL_SUBJECT_SIGNATURE_VERSION = "v1";
|
|
2264
2235
|
function getCredentialSubjectSecret() {
|
|
@@ -2444,8 +2415,7 @@ function verifyTimerWatchCredentialSubject(input) {
|
|
|
2444
2415
|
subject.userId
|
|
2445
2416
|
])), binding.signature);
|
|
2446
2417
|
}
|
|
2447
|
-
|
|
2448
|
-
//#region src/chat/events/store.ts
|
|
2418
|
+
// src/chat/events/store.ts
|
|
2449
2419
|
const EVENT_PREFIX = "junior:resource_event_subscription:v5";
|
|
2450
2420
|
const INDEX_LOCK_TTL_MS = 1e4;
|
|
2451
2421
|
const SUBSCRIPTION_LOCK_TTL_MS = 1e4;
|
|
@@ -2832,8 +2802,7 @@ async function deliverWatch(input) {
|
|
|
2832
2802
|
return delivered;
|
|
2833
2803
|
}, input.waitDeadlineMs);
|
|
2834
2804
|
}
|
|
2835
|
-
|
|
2836
|
-
//#region src/chat/events/tool-support.ts
|
|
2805
|
+
// src/chat/events/tool-support.ts
|
|
2837
2806
|
/** Default lifetime for temporary watches. */
|
|
2838
2807
|
const RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS = 12096e5;
|
|
2839
2808
|
/** Hard upper bound for temporary watches. */
|
|
@@ -2843,8 +2812,7 @@ const RESOURCE_WATCH_TOOL_SOURCE = {
|
|
|
2843
2812
|
id: "resource-watches",
|
|
2844
2813
|
description: "Inspect or stop watches for the current conversation and its child agents."
|
|
2845
2814
|
};
|
|
2846
|
-
|
|
2847
|
-
//#region src/chat/slack/tool-support/context.ts
|
|
2815
|
+
// src/chat/slack/tool-support/context.ts
|
|
2848
2816
|
/** Resolve Slack tool context from the Conversation Location. */
|
|
2849
2817
|
function getSlackToolContext(context) {
|
|
2850
2818
|
const source = context.source.kind === "slack" ? context.source : void 0;
|
|
@@ -2882,8 +2850,7 @@ function isSlackMessageTurn(context) {
|
|
|
2882
2850
|
function slackMessageTurnDisabledReason(context) {
|
|
2883
2851
|
return isSlackMessageTurn(context) ? void 0 : "It needs a Turn that a person started with a Slack message.";
|
|
2884
2852
|
}
|
|
2885
|
-
|
|
2886
|
-
//#region src/chat/slack/tool-support/channel-capabilities.ts
|
|
2853
|
+
// src/chat/slack/tool-support/channel-capabilities.ts
|
|
2887
2854
|
/** Resolve channel capabilities from a Slack channel ID. */
|
|
2888
2855
|
function resolveChannelCapabilities(channelId) {
|
|
2889
2856
|
return {
|
|
@@ -2893,8 +2860,7 @@ function resolveChannelCapabilities(channelId) {
|
|
|
2893
2860
|
canAddReactions: isConversationScopedChannel(channelId)
|
|
2894
2861
|
};
|
|
2895
2862
|
}
|
|
2896
|
-
|
|
2897
|
-
//#region src/chat/workspaces/checkout-path.ts
|
|
2863
|
+
// src/chat/workspaces/checkout-path.ts
|
|
2898
2864
|
/** Derive the fixed sandbox checkout path for one repository, or undefined when invalid. */
|
|
2899
2865
|
function tryWorkspaceRepoCheckoutPath(repo) {
|
|
2900
2866
|
const name = repo.split("/").filter(Boolean).at(-1);
|
|
@@ -2907,8 +2873,7 @@ function workspaceRepoCheckoutPath(repo) {
|
|
|
2907
2873
|
if (!path) throw new Error(`Invalid repository name for checkout path: ${repo}`);
|
|
2908
2874
|
return path;
|
|
2909
2875
|
}
|
|
2910
|
-
|
|
2911
|
-
//#region src/chat/sandbox/snapshot/builder-sandbox.ts
|
|
2876
|
+
// src/chat/sandbox/snapshot/builder-sandbox.ts
|
|
2912
2877
|
/** Resume the named Sandbox that owns one Workspace snapshot build. */
|
|
2913
2878
|
async function getWorkspaceSnapshotBuilder(name, signal) {
|
|
2914
2879
|
const credentials = getVercelSandboxCredentials();
|
|
@@ -2938,12 +2903,10 @@ async function deleteWorkspaceSnapshotBuilders(names) {
|
|
|
2938
2903
|
}
|
|
2939
2904
|
if (hasError) throw firstError;
|
|
2940
2905
|
}
|
|
2941
|
-
|
|
2942
|
-
//#region src/chat/sandbox/snapshot/runtime.ts
|
|
2906
|
+
// src/chat/sandbox/snapshot/runtime.ts
|
|
2943
2907
|
/** Runtime used to build and start reusable Sandbox snapshots. */
|
|
2944
2908
|
const SANDBOX_RUNTIME = "node22";
|
|
2945
|
-
|
|
2946
|
-
//#region src/chat/sandbox/snapshot/store.ts
|
|
2909
|
+
// src/chat/sandbox/snapshot/store.ts
|
|
2947
2910
|
function builderNames(rows) {
|
|
2948
2911
|
return [...new Set(rows.map((row) => row.sandboxName).filter((name) => Boolean(name)))];
|
|
2949
2912
|
}
|
|
@@ -3075,8 +3038,7 @@ async function setWorkspaceSnapshotBuild(workspaceId, build, options = {}) {
|
|
|
3075
3038
|
}).onConflictDoNothing().returning({ id: juniorSnapshots.id })).length > 0;
|
|
3076
3039
|
});
|
|
3077
3040
|
}
|
|
3078
|
-
|
|
3079
|
-
//#region src/chat/workspaces/validation.ts
|
|
3041
|
+
// src/chat/workspaces/validation.ts
|
|
3080
3042
|
const WORKSPACE_NAME_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;
|
|
3081
3043
|
const PROVIDER_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;
|
|
3082
3044
|
const REPO_PATTERN = /^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/;
|
|
@@ -3128,8 +3090,7 @@ function normalizeWorkspaceRecipe(input) {
|
|
|
3128
3090
|
repos
|
|
3129
3091
|
};
|
|
3130
3092
|
}
|
|
3131
|
-
|
|
3132
|
-
//#region src/chat/workspaces/store.ts
|
|
3093
|
+
// src/chat/workspaces/store.ts
|
|
3133
3094
|
function workspaceFromRows(row, repos, snapshot) {
|
|
3134
3095
|
return {
|
|
3135
3096
|
id: row.id,
|
|
@@ -3288,8 +3249,7 @@ async function deleteWorkspace(id) {
|
|
|
3288
3249
|
await cleanupSnapshotBuilders(id, result.builderNames);
|
|
3289
3250
|
return result.deleted;
|
|
3290
3251
|
}
|
|
3291
|
-
|
|
3292
|
-
//#region src/chat/code/store.ts
|
|
3252
|
+
// src/chat/code/store.ts
|
|
3293
3253
|
/** Record the latest details for one code change created by Junior. */
|
|
3294
3254
|
async function recordCodeChange(db, provider, input) {
|
|
3295
3255
|
const change = codeChangeInputSchema.parse(input);
|
|
@@ -3357,8 +3317,7 @@ async function associateCodeChangeConversations(db, provider, input) {
|
|
|
3357
3317
|
ORDER BY value
|
|
3358
3318
|
)` }).where(and(eq(juniorCodeChanges.provider, provider), eq(juniorCodeChanges.providerId, input.providerId)));
|
|
3359
3319
|
}
|
|
3360
|
-
|
|
3361
|
-
//#region src/chat/code/publisher.ts
|
|
3320
|
+
// src/chat/code/publisher.ts
|
|
3362
3321
|
/** Connect a plugin to Junior's code records. */
|
|
3363
3322
|
function createCodeChangePublisher(provider) {
|
|
3364
3323
|
return {
|
|
@@ -3370,8 +3329,7 @@ function createCodeChangePublisher(provider) {
|
|
|
3370
3329
|
}
|
|
3371
3330
|
};
|
|
3372
3331
|
}
|
|
3373
|
-
|
|
3374
|
-
//#region src/chat/briefs/registration.ts
|
|
3332
|
+
// src/chat/briefs/registration.ts
|
|
3375
3333
|
var registration_exports = /* @__PURE__ */ __exportAll({
|
|
3376
3334
|
coreTaskRegistrations: () => coreTaskRegistrations,
|
|
3377
3335
|
isBriefsEnabled: () => isBriefsEnabled,
|
|
@@ -3392,8 +3350,7 @@ function isBriefsEnabled() {
|
|
|
3392
3350
|
function coreTaskRegistrations() {
|
|
3393
3351
|
return isBriefsEnabled() ? [briefsTaskRegistration] : [];
|
|
3394
3352
|
}
|
|
3395
|
-
|
|
3396
|
-
//#region src/chat/plugins/agent-hooks.ts
|
|
3353
|
+
// src/chat/plugins/agent-hooks.ts
|
|
3397
3354
|
var agent_hooks_exports = /* @__PURE__ */ __exportAll({
|
|
3398
3355
|
PluginHookDeniedError: () => PluginHookDeniedError,
|
|
3399
3356
|
applyPluginFormatMarkdown: () => applyPluginFormatMarkdown,
|
|
@@ -3777,9 +3734,11 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
|
|
|
3777
3734
|
}
|
|
3778
3735
|
};
|
|
3779
3736
|
const resolveActor = context.resolveActorIdentity ?? (async () => void 0);
|
|
3737
|
+
const automationUrl = (context.source.kind === "event_automation" || context.source.kind === "scheduled_automation") && context.source.automationId ? getDashboardTaskLink(context.source.automationId) : void 0;
|
|
3780
3738
|
const common = {
|
|
3781
3739
|
...basePluginContext(plugin),
|
|
3782
3740
|
annotations,
|
|
3741
|
+
...automationUrl ? { automationLink: { url: automationUrl } } : void 0,
|
|
3783
3742
|
conversationId: context.conversationId,
|
|
3784
3743
|
locationId: context.locationId,
|
|
3785
3744
|
...slackContext ? { slack: slackContext } : void 0,
|
|
@@ -4094,7 +4053,10 @@ function sanitizeOperationalReport(args) {
|
|
|
4094
4053
|
categories: widget.categories.slice(-100).map((category, categoryIndex) => ({
|
|
4095
4054
|
id: operationalReportText(category.id, OPERATIONAL_REPORT_MAX_LABEL_LENGTH) ?? `${widgetIndex}:${categoryIndex}`,
|
|
4096
4055
|
label: operationalReportText(category.label, OPERATIONAL_REPORT_MAX_LABEL_LENGTH) ?? String(categoryIndex + 1),
|
|
4097
|
-
values: Object.fromEntries(seriesEntries.map(({ sanitizedSeries, sourceKey }) =>
|
|
4056
|
+
values: Object.fromEntries(seriesEntries.map(({ sanitizedSeries, sourceKey }) => {
|
|
4057
|
+
const value = category.values[sourceKey];
|
|
4058
|
+
return [sanitizedSeries.key, value !== void 0 && Number.isFinite(value) ? value : 0];
|
|
4059
|
+
}))
|
|
4098
4060
|
})),
|
|
4099
4061
|
id,
|
|
4100
4062
|
series,
|
|
@@ -4370,5 +4332,4 @@ function createPluginHookRunner(input = {}) {
|
|
|
4370
4332
|
}
|
|
4371
4333
|
};
|
|
4372
4334
|
}
|
|
4373
|
-
//#endregion
|
|
4374
4335
|
export { bindSlackDirectCredentialSubject as $, authenticationUnlinkedEvent as $t, getWorkspaceSnapshotBuilder as A, resolveRootVisibility as At, STOP_WATCHING_TOOL_NAME as B, getFilePermalink as Bt, WorkspaceValidationError as C, readLatestConversationBrief as Ct, setWorkspaceSnapshotBuild as D, matchSlackAttachments as Dt, setWorkspaceSnapshot as E, getSlackFileId as Et, isSlackMessageTurn as F, defaultTimezone as Ft, createWatch as G, normalizeSlackConversationId as Gt, cancelWatch as H, getSlackClient as Ht, slackMessageTurnDisabledReason as I, resolveUserTimezone as It, getWatch as J, getWorkspaceTeamId as Jt, deliverWatch as K, runWithSlackInstallationToken as Kt, RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS as L, lookupSlackUser as Lt, workspaceRepoCheckoutPath as M, createPluginAnnotations as Mt, resolveChannelCapabilities as N, listConversationAnnotations as Nt, SANDBOX_RUNTIME as O, readAttachmentVisionSummary as Ot, getSlackToolContext as P, listConversationAnnotationsById as Pt, bindScheduledAutomationCredentialSubject as Q, authenticationLinkedEvent as Qt, RESOURCE_SUBSCRIPTION_MAX_TTL_MS as R, SlackActionError as Rt, updateWorkspace as S, createPluginConversationEvents as St, loadSnapshotsForProfile as T, buildSentryConversationUrl as Tt, collectEventMatchKeys as U, isConversationScopedChannel as Ut, cancelSubscriptions as V, getHeaderString as Vt, createTimerWatch as W, isDmChannel as Wt, takeDueTimerWatches as X, JUNIOR_NATIVE_EVENT_NAMESPACE as Xt, listWatches as Y, runWithWorkspaceTeamId as Yt, bindEventAutomationCredentialSubject as Z, agentsInstructionsUpdatedEvent as Zt, deleteWorkspace as _, conversationHasParticipantEmail as _t, getPluginRoutes as a, getDashboardConversationLink as at, listWorkspaces as b, conversationNotArchivedForUser as bt, getPluginTools as c, setDashboardConversationLinkOptions as ct, setPlugins as d, createPluginModel as dt, conversationNoteEvent as en, verifyEventAutomationCredentialSubject as et, validatePlugins as f, createPluginLogger as ft, createWorkspace as g, conversationArchivedForUser as gt, setBriefsConfig as h, conversationArchivedForEmail as ht, getPluginApiRoutes as i, JUNIOR_THREAD_STATE_TTL_MS as it, tryWorkspaceRepoCheckoutPath as j, saveObjectAnnotations as jt, deleteWorkspaceSnapshotBuilders as k, recordSlackAttachment as kt, getPluginUserPromptContributions as l, createPluginState as lt, registration_exports as m, conversationArchiveTimes as mt, applyPluginFormatMarkdown as n, verifySlackDirectCredentialSubject as nt, getPluginSlackConversationLink as o, getDashboardObjectIconLink as ot, coreTaskRegistrations as p, readConversationAccessFromSql as pt, findMatchingWatches as q, withSlackRetries as qt, createPluginHookRunner as r, verifyTimerWatchCredentialSubject as rt, getPluginSystemPromptContributions as s, getDashboardTaskLink as st, agent_hooks_exports as t, verifyScheduledAutomationCredentialSubject as tt, getPlugins as u, createPluginEmbedder as ut, getWorkspace as v, conversationHasParticipantUser as vt, invalidateReadySnapshot as w, readConversationEventPage as wt, listWorkspacesByRepository as x, viewerConversationMembership as xt, getWorkspaceByName as y, conversationNotArchivedForEmail as yt, RESOURCE_WATCH_TOOL_SOURCE as z, downloadPrivateSlackFile as zt };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { getTableColumns, sql } from "drizzle-orm";
|
|
3
3
|
import { boolean, index, integer, jsonb, pgTable, primaryKey, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
|
|
4
|
-
|
|
4
|
+
// src/db/schema/timestamps.ts
|
|
5
5
|
const timestamptz = (name) => timestamp(name, { withTimezone: true });
|
|
6
|
-
|
|
7
|
-
//#region src/db/schema/destinations.ts
|
|
6
|
+
// src/db/schema/destinations.ts
|
|
8
7
|
const juniorDestinationKindSchema = z.enum([
|
|
9
8
|
"channel",
|
|
10
9
|
"dm",
|
|
@@ -26,8 +25,7 @@ const juniorDestinations = pgTable("junior_destinations", {
|
|
|
26
25
|
createdAt: timestamptz("created_at").notNull(),
|
|
27
26
|
updatedAt: timestamptz("updated_at").notNull()
|
|
28
27
|
}, (table) => [uniqueIndex("junior_destinations_provider_destination_uidx").on(table.provider, table.providerTenantId, table.providerDestinationId), index("junior_destinations_provider_kind_idx").on(table.provider, table.kind)]);
|
|
29
|
-
|
|
30
|
-
//#region src/db/schema/users.ts
|
|
28
|
+
// src/db/schema/users.ts
|
|
31
29
|
const juniorUsers = pgTable("junior_users", {
|
|
32
30
|
id: text("id").primaryKey(),
|
|
33
31
|
primaryEmail: text("primary_email").notNull(),
|
|
@@ -39,8 +37,7 @@ const juniorUsers = pgTable("junior_users", {
|
|
|
39
37
|
createdAt: timestamptz("created_at").notNull(),
|
|
40
38
|
updatedAt: timestamptz("updated_at").notNull()
|
|
41
39
|
}, (table) => [uniqueIndex("junior_users_primary_email_normalized_uidx").on(table.primaryEmailNormalized)]);
|
|
42
|
-
|
|
43
|
-
//#region src/db/schema/identities.ts
|
|
40
|
+
// src/db/schema/identities.ts
|
|
44
41
|
const juniorIdentities = pgTable("junior_identities", {
|
|
45
42
|
id: text("id").primaryKey(),
|
|
46
43
|
kind: text("kind").$type().notNull(),
|
|
@@ -64,8 +61,7 @@ const juniorIdentities = pgTable("junior_identities", {
|
|
|
64
61
|
index("junior_identities_verified_email_idx").on(table.emailNormalized).where(sql`${table.emailVerified} = true AND ${table.emailNormalized} IS NOT NULL`),
|
|
65
62
|
index("junior_identities_kind_provider_idx").on(table.kind, table.provider)
|
|
66
63
|
]);
|
|
67
|
-
|
|
68
|
-
//#region src/db/schema/conversations.ts
|
|
64
|
+
// src/db/schema/conversations.ts
|
|
69
65
|
const juniorConversations = pgTable("junior_conversations", {
|
|
70
66
|
conversationId: text("conversation_id").primaryKey(),
|
|
71
67
|
schemaVersion: integer("schema_version").notNull().default(1),
|
|
@@ -116,8 +112,7 @@ function conversationReadColumns() {
|
|
|
116
112
|
const { legacyArchivedAt, ...columns } = getTableColumns(juniorConversations);
|
|
117
113
|
return columns;
|
|
118
114
|
}
|
|
119
|
-
|
|
120
|
-
//#region src/db/schema/agent-invocations.ts
|
|
115
|
+
// src/db/schema/agent-invocations.ts
|
|
121
116
|
const AGENT_INVOCATION_STATUSES = [
|
|
122
117
|
"pending",
|
|
123
118
|
"running",
|
|
@@ -176,5 +171,4 @@ const juniorAgentInvocations = pgTable("junior_agent_invocations", {
|
|
|
176
171
|
index("junior_agent_invocations_mailbox_idx").on(table.mailboxStatus, table.createdAt),
|
|
177
172
|
index("junior_agent_invocations_parent_mailbox_idx").on(table.parentMailboxStatus, table.terminalAt)
|
|
178
173
|
]);
|
|
179
|
-
//#endregion
|
|
180
174
|
export { juniorAgentInvocations as a, juniorIdentities as c, juniorDestinations as d, timestamptz as f, juniorAgentBindings as i, juniorUsers as l, AGENT_INVOCATION_PARENT_MAILBOX_STATUSES as n, conversationReadColumns as o, AGENT_INVOCATION_STATUSES as r, juniorConversations as s, AGENT_INVOCATION_MAILBOX_STATUSES as t, juniorDestinationKindSchema as u };
|