@sentry/junior 0.296.0 → 0.298.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/{admin-z_lgDi-z.js → admin-BF3DbYGf.js} +2 -2
- package/dist/{agent-runner-HoQiUKLL.js → agent-runner-Q9GkoerG.js} +407 -1895
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +7 -7
- package/dist/api.d.ts +1 -1
- package/dist/api.js +38 -267
- package/dist/{app-C75Ft-A_.d.ts → app-DOg_mCtV.d.ts} +7 -2
- package/dist/app.d.ts +1 -1
- package/dist/app.js +64 -44
- package/dist/attempt-selection-ClP3MMPr.js +61 -0
- package/dist/{automation-yJX3C7i3.js → automation-Cn8qmbdr.js} +1 -1
- package/dist/{background-compaction-queue-Cre1wFt9.js → background-compaction-queue-BZhGFOK6.js} +4 -88
- package/dist/{briefs-BXECHduJ.js → briefs-CQrCRF6-.js} +3 -3
- package/dist/{catalog-runtime-CpCmlD9L.js → catalog-runtime-DZeD2WbL.js} +1 -1
- package/dist/cli/chat.js +19 -15
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -3
- package/dist/{config-CCPHvTqx.js → config-BOByVnxe.js} +2 -2
- package/dist/{connections-B5pWh8e2.js → connections-BNN5cJam.js} +6 -6
- package/dist/{conversation-CMkSmi02.js → conversation-DCkzvxqB.js} +51 -17
- package/dist/{conversation-feed-BVAOga0H.js → conversation-feed-CMA12Rjs.js} +1 -1
- package/dist/{conversation-privacy-CZD5soDW.js → conversation-privacy-C0eRxsgb.js} +1 -1
- package/dist/conversation-turn-D9qvcDX6.js +805 -0
- package/dist/{credential-sync-DwLkIvXI.js → credential-sync-B_iUpxGL.js} +14 -13
- package/dist/{db-C1M1y-bh.js → db-CoMNr2Zm.js} +43 -15
- package/dist/{db-B3iyr_Or.d.ts → db-DoMcnYol.d.ts} +13 -1
- package/dist/{executor-DUSEwXaO.js → executor-C-m8VrzX.js} +14 -6
- package/dist/instrumentation.js +2 -2
- package/dist/{logging-D0svFM8r.js → logging-CJTi5niy.js} +1 -1
- package/dist/{message-BFnIwKpx.js → message-Q6_5DAWR.js} +15 -13
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -2
- package/dist/{session-stop-hYNTNpVf.js → notification-Bv25xbj0.js} +11 -930
- package/dist/{oauth-callback-server-BXRtD6Fk.js → oauth-callback-server-CH5XAyo-.js} +2 -2
- package/dist/{projection-B6VS7kbo.js → projection-BgwEE36_.js} +333 -106
- package/dist/{prompt-CD11tfG8.js → prompt-DXc9DYT9.js} +4 -4
- package/dist/prompt-input-BUr4J9RO.js +1424 -0
- package/dist/{registry-CHewwYEo.js → registry-9XwqSnM-.js} +1 -1
- package/dist/reporting-window-DopzcOHh.js +137 -0
- package/dist/{resolve-1owMH4qo.js → resolve-DUIAbcRL.js} +3 -3
- package/dist/result-C2Vn8QGn.js +463 -0
- package/dist/{runner-BtWvJslp.js → runner-CXGtw-Mc.js} +9 -8
- package/dist/{sandbox-egress-signals-ByftwJVt.js → sandbox-egress-signals-Di3S_dO7.js} +1 -1
- package/dist/{schema-Ct1Zf2xy.d.ts → schema-BnbZ-rKv.d.ts} +14 -107
- package/dist/{schema-D2iGyYIp.js → schema-Dyp7racy.js} +11 -48
- package/dist/{service-account-BZEuMKdo.js → service-account-DM3KBBeG.js} +3 -3
- package/dist/{service-account-DLoeoHww.js → service-account-GzAMUQ8a.js} +3 -3
- package/dist/session-stop-D4i7e6iT.js +181 -0
- package/dist/{skills-DXgd5Inh.js → skills-DCK9SD_l.js} +2 -2
- package/dist/{spawn-YeqlNDv8.js → spawn-6cX6xE9G.js} +6 -5
- package/dist/{state-C3CbtD_m.js → state-CSuA2J1V.js} +2 -2
- package/dist/{stop-Cze_pEL8.js → stop-Dh2DfwpK.js} +66 -159
- package/dist/{store-CZ9vqR4P.js → store-B1zepKG8.js} +11 -4
- package/dist/{task-runner-CMiNGsER.js → store-DrA17Fbz.js} +939 -1593
- package/dist/task-queue-D1rXWfFN.js +89 -0
- package/dist/task-runner-CT4M8oDz.js +291 -0
- package/dist/thread-context-DnqUkbzN.js +248 -0
- package/dist/turn-cancel-l460pfGW.js +201 -0
- package/dist/turn-session-routing-VXDVXLRl.js +380 -0
- package/dist/{turn-failure-response-pXhZ2wMK.js → turn-user-message-BSPmkm7X.js} +181 -392
- package/dist/turn-wake-DVFVXyhX.js +161 -0
- package/dist/{reporting-window-B3Ze-Qnt.js → user-input-request-CXNIov9n.js} +24 -143
- package/dist/{validation-Du7NdkOR.js → validation-zxAJBDDy.js} +1 -1
- package/dist/{version-EN3Wnq-R.js → version-DcZ40a0g.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-Agxi_o5c.js → viewer-CgiGjW10.js} +3 -3
- package/dist/warmup-CwKbxQLl.js +2698 -0
- package/dist/{worker-BALVdWbv.js → worker-CbDUzaBA.js} +20 -8
- package/migrations/0102_code_change_last_activity.sql +1 -0
- package/migrations/0103_agent_invocation_fork.sql +8 -0
- package/migrations/meta/0102_snapshot.json +4502 -0
- package/migrations/meta/0103_snapshot.json +4509 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +4 -4
- package/dist/result-CEqQFrEf.js +0 -305
- package/dist/result-event-type-DD6BAgT7.js +0 -11
- package/dist/warmup-CY2ArYag.js +0 -2017
- package/dist/work-EA98F0ia.js +0 -768
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { L as escapeXml, a as getRuntimeMetadata, n as botConfig } from "./config-
|
|
3
|
-
import { U as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-
|
|
1
|
+
import { Hn as createUserTokenStore, Kn as resolvePluginOAuthAccount, Sa as getSlackClient, Xi as parseOAuthStatePayload, Yi as formatProviderLabel, Z as getConversationPendingAuth, Zi as resolveBaseUrl, d as recordAuthorizationCompleted, da as postSlackMessage, ot as getTurnRecord, u as recordAuthenticationLinked } from "./projection-BgwEE36_.js";
|
|
2
|
+
import { L as escapeXml, a as getRuntimeMetadata, n as botConfig } from "./config-BOByVnxe.js";
|
|
3
|
+
import { U as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-CJTi5niy.js";
|
|
4
4
|
import { p as parseSlackUserId } from "./actor-6jsm_v96.js";
|
|
5
|
-
import { H as upsertLinkedIdentity, P as resolveActorIdentityId, R as findUserByVerifiedEmails, s as getSqlExecutor } from "./db-
|
|
5
|
+
import { H as upsertLinkedIdentity, P as resolveActorIdentityId, R as findUserByVerifiedEmails, s as getSqlExecutor } from "./db-CoMNr2Zm.js";
|
|
6
6
|
import { i as homeDir } from "./package-discovery-DJhGdS4c.js";
|
|
7
|
-
import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-
|
|
8
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
9
|
-
import { t as discoverSkills } from "./skills-
|
|
10
|
-
import {
|
|
7
|
+
import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-9XwqSnM-.js";
|
|
8
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-DZeD2WbL.js";
|
|
9
|
+
import { t as discoverSkills } from "./skills-DCK9SD_l.js";
|
|
10
|
+
import { b as lookupSlackUserProfile, d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession } from "./agent-runner-Q9GkoerG.js";
|
|
11
11
|
import { r as acquireActiveLock } from "./locks-D-0h111u.js";
|
|
12
|
-
import { o as readIdentityById } from "./viewer-
|
|
13
|
-
import { a as getStateAdapter } from "./state-
|
|
12
|
+
import { o as readIdentityById } from "./viewer-CgiGjW10.js";
|
|
13
|
+
import { a as getStateAdapter } from "./state-CSuA2J1V.js";
|
|
14
14
|
import { t as readJuniorSecret } from "./secrets-DebYU866.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
15
|
+
import { a as getPersistedThreadState, c as coerceThreadConversationState } from "./turn-session-routing-VXDVXLRl.js";
|
|
16
|
+
import { i as wakePausedTurn, r as wakeAuthorizedTurn, s as deleteWebAuthorization } from "./turn-wake-DVFVXyhX.js";
|
|
17
|
+
import { _ as getMcpProviderErrorAttributes } from "./service-account-GzAMUQ8a.js";
|
|
18
|
+
import { i as readConnectedOAuthTokens, s as htmlCallbackResponse } from "./connections-BNN5cJam.js";
|
|
18
19
|
import { n as relayLocalOAuthCallback } from "./oauth-relay-CsfIazeF.js";
|
|
19
20
|
import path from "node:path";
|
|
20
21
|
import { createHmac, createSecretKey, timingSafeEqual } from "node:crypto";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { i as getChatConfig } from "./config-
|
|
3
|
-
import { H as GOOGLE_IDENTITY_PROVIDER, W as normalizeIdentityEmail, h as logWarn } from "./logging-
|
|
2
|
+
import { i as getChatConfig } from "./config-BOByVnxe.js";
|
|
3
|
+
import { H as GOOGLE_IDENTITY_PROVIDER, W as normalizeIdentityEmail, h as logWarn } from "./logging-CJTi5niy.js";
|
|
4
4
|
import { a as isSlackUserId, d as parseSlackChannelReferenceId, f as parseSlackTeamId, s as parseActorUserId } from "./actor-6jsm_v96.js";
|
|
5
|
-
import { A as juniorConversations, C as isUserInstruction, E as juniorConversationAnnotations, M as juniorUsers, N as juniorDestinations, S as juniorConversationMetrics, j as juniorIdentities, t as createJuniorSqlExecutor, v as juniorConversationParticipants, w as juniorConversationEvents, x as CONVERSATION_METRICS, y as juniorConversationBindings } from "./executor-
|
|
5
|
+
import { A as juniorConversations, C as isUserInstruction, E as juniorConversationAnnotations, M as juniorUsers, N as juniorDestinations, S as juniorConversationMetrics, j as juniorIdentities, t as createJuniorSqlExecutor, v as juniorConversationParticipants, w as juniorConversationEvents, x as CONVERSATION_METRICS, y as juniorConversationBindings } from "./executor-C-m8VrzX.js";
|
|
6
6
|
import { d as historyReplacementSchema, f as newConversationEventSchema, p as encodeHistoryPayload, s as conversationEventDataSchema, u as decodeStoredConversationEvent, y as usageSchema } from "./media-BepyEUNm.js";
|
|
7
7
|
import { randomUUID } from "node:crypto";
|
|
8
8
|
import { and, asc, desc, eq, gt, gte, inArray, isNull, lt, lte, ne, or, sql } from "drizzle-orm";
|
|
@@ -374,13 +374,22 @@ async function getConversationIdByProviderConversation(executor, args) {
|
|
|
374
374
|
}
|
|
375
375
|
/**
|
|
376
376
|
* Bind provider coordinates to a durable conversation unless another
|
|
377
|
-
* conversation has them. Return
|
|
377
|
+
* conversation has them. Return the conversation that has them.
|
|
378
378
|
*/
|
|
379
|
-
async function
|
|
380
|
-
|
|
379
|
+
async function claimProviderConversationOwner(executor, args) {
|
|
380
|
+
const ownerId = (await executor.db().insert(juniorConversationBindings).values({
|
|
381
381
|
...args,
|
|
382
382
|
createdAt: /* @__PURE__ */ new Date()
|
|
383
|
-
}).onConflictDoNothing().returning({ conversationId: juniorConversationBindings.conversationId }))[0]?.conversationId ?? await getConversationIdByProviderConversation(executor, args)
|
|
383
|
+
}).onConflictDoNothing().returning({ conversationId: juniorConversationBindings.conversationId }))[0]?.conversationId ?? await getConversationIdByProviderConversation(executor, args);
|
|
384
|
+
if (!ownerId) throw new Error("Provider conversation binding disappeared during claim");
|
|
385
|
+
return ownerId;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Bind provider coordinates to a durable conversation unless another
|
|
389
|
+
* conversation has them. Return whether they belong to this conversation.
|
|
390
|
+
*/
|
|
391
|
+
async function claimProviderConversation(executor, args) {
|
|
392
|
+
return await claimProviderConversationOwner(executor, args) === args.conversationId;
|
|
384
393
|
}
|
|
385
394
|
/** Bind provider coordinates to a durable conversation in the caller's SQL scope. */
|
|
386
395
|
async function bindProviderConversation(executor, args) {
|
|
@@ -855,44 +864,56 @@ const ROOT = {
|
|
|
855
864
|
delivery: "location",
|
|
856
865
|
promptMode: "conversation",
|
|
857
866
|
gated: false,
|
|
867
|
+
failureNotice: "none",
|
|
868
|
+
sessionTasks: true,
|
|
858
869
|
tools: {
|
|
859
870
|
agents: "children",
|
|
860
871
|
reviewDesk: true,
|
|
861
872
|
subscriptions: true,
|
|
862
873
|
userCustomization: true,
|
|
863
|
-
reply:
|
|
874
|
+
reply: "none",
|
|
864
875
|
reportBlocked: "none",
|
|
865
876
|
noReply: true
|
|
866
877
|
}
|
|
867
878
|
};
|
|
868
879
|
const PERSON_IN_THREAD = {
|
|
869
880
|
...ROOT,
|
|
881
|
+
sessionTasks: false,
|
|
870
882
|
tools: {
|
|
871
883
|
...ROOT.tools,
|
|
872
884
|
agents: "none"
|
|
873
885
|
}
|
|
874
886
|
};
|
|
875
|
-
const
|
|
887
|
+
const AGENT_IN_THREAD = {
|
|
876
888
|
delivery: "conversation",
|
|
877
889
|
promptMode: "child_agent",
|
|
878
|
-
gated:
|
|
890
|
+
gated: true,
|
|
891
|
+
failureNotice: "none",
|
|
892
|
+
sessionTasks: false,
|
|
879
893
|
tools: {
|
|
880
894
|
agents: "children_and_parent",
|
|
881
895
|
reviewDesk: false,
|
|
882
896
|
subscriptions: false,
|
|
883
897
|
userCustomization: false,
|
|
884
|
-
reply:
|
|
898
|
+
reply: "parent",
|
|
885
899
|
reportBlocked: "parent",
|
|
886
900
|
noReply: true
|
|
887
901
|
}
|
|
888
902
|
};
|
|
903
|
+
const AGENT_IN_TASK = {
|
|
904
|
+
...AGENT_IN_THREAD,
|
|
905
|
+
missingAnswerError: "No reply was sent.",
|
|
906
|
+
failureNotice: "parent"
|
|
907
|
+
};
|
|
889
908
|
const AUTOMATION_RUN = {
|
|
890
909
|
delivery: "conversation",
|
|
891
910
|
promptMode: "automation",
|
|
892
911
|
gated: true,
|
|
912
|
+
failureNotice: "none",
|
|
913
|
+
sessionTasks: true,
|
|
893
914
|
tools: {
|
|
894
915
|
...ROOT.tools,
|
|
895
|
-
reply:
|
|
916
|
+
reply: "automation",
|
|
896
917
|
reportBlocked: "automation"
|
|
897
918
|
}
|
|
898
919
|
};
|
|
@@ -900,8 +921,8 @@ const AUTOMATION_RUN = {
|
|
|
900
921
|
function turnBehavior(args) {
|
|
901
922
|
if (args.kind === "root") return ROOT;
|
|
902
923
|
if (args.kind === "automation") return args.personInput ? ROOT : AUTOMATION_RUN;
|
|
903
|
-
if (
|
|
904
|
-
if (args.
|
|
924
|
+
if (args.kind === "thread") return args.personInput ? PERSON_IN_THREAD : AGENT_IN_THREAD;
|
|
925
|
+
if (!args.personInput) return AGENT_IN_TASK;
|
|
905
926
|
throw new Error("A task Conversation cannot have a person's input");
|
|
906
927
|
}
|
|
907
928
|
/** Return whether a Conversation of this kind has no parent. */
|
|
@@ -1083,6 +1104,13 @@ var SqlStore = class {
|
|
|
1083
1104
|
async bindProviderConversation(args) {
|
|
1084
1105
|
await bindProviderConversation(this.executor, args);
|
|
1085
1106
|
}
|
|
1107
|
+
async claimProviderConversation(args) {
|
|
1108
|
+
const { atMs, ...binding } = args;
|
|
1109
|
+
return await this.executor.transaction(async () => {
|
|
1110
|
+
await ensureConversationRow(this.executor, binding.conversationId, atMs, { activity: "preserve" });
|
|
1111
|
+
return await claimProviderConversationOwner(this.executor, binding);
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1086
1114
|
async createChild(args) {
|
|
1087
1115
|
const nowMs = args.nowMs ?? now();
|
|
1088
1116
|
await this.withConversationMutation(args.parentConversationId, async () => {
|
|
@@ -2072,4 +2100,4 @@ async function closeDb() {
|
|
|
2072
2100
|
current = void 0;
|
|
2073
2101
|
await previous?.db.close();
|
|
2074
2102
|
}
|
|
2075
|
-
export {
|
|
2103
|
+
export { conversationDetailTouch as $, setFirstConversationLocation as A, recordGoogleSignIn as B, deliversFinalText as C, turnBehavior as D, postsRunNotices as E, saveActorAvatar as F, parseSessionSource as G, upsertLinkedIdentity as H, deleteProviderIdentityForSlackUser as I, agentTurnTotalTokens as J, addAgentTurnUsage as K, deleteProviderIdentityForUser as L, SYSTEM_IDENTITY_ID as M, findActorIdentityId as N, conversationKindFromRow as O, resolveActorIdentityId as P, rootConversationIsArchived as Q, findUserByVerifiedEmails as R, withConversationMutationLock as S, isTopLevelKind as T, claimProviderConversation as U, saveUserTimezone as V, getConversationIdByProviderConversation as W, hasAgentTurnUsage as X, agentTurnUsageSchema as Y, resolveRootConversationId as Z, setArchivedAt as _, getConversationStore as a, sameDestination as at, userMessageQueries as b, conversationIdsWithAnnotation as c, createSqlConversationEventStore as d, nextDetailVersion as et, eventFromRow as f, readConversationTrees as g, conversationDescendants as h, getConversationMessageSearchStore as i, requireSlackDestination as it, startLocationThread as j, locationFromRow as k, hasAnnotationKey as l, conversationAncestors as m, db_exports as n, createSlackDestination as nt, getDb as o, withConversationEventLock as p, agentTurnCostUsd as q, getConversationEventStore as r, parseDestination as rt, getSqlExecutor as s, closeDb as t, touchConversationDetail as tt, treeHasAnnotationKey as u, loadConversationSlackTenantIds as v, isPersonInput as w, createSqlStore as x, lastMessageAtSql as y, readUserTimezone as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./schema-
|
|
1
|
+
import "./schema-BnbZ-rKv.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
import "drizzle-orm";
|
|
4
4
|
import { Destination, Source, locationSchema } from "@sentry/junior-plugin-api";
|
|
@@ -168,6 +168,18 @@ interface ConversationStore {
|
|
|
168
168
|
providerTenantId: string;
|
|
169
169
|
providerConversationId: string;
|
|
170
170
|
}): Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* Claim one provider conversation for the Conversation that starts in it,
|
|
173
|
+
* unless another Conversation started there first. Return the owner.
|
|
174
|
+
*/
|
|
175
|
+
claimProviderConversation(args: {
|
|
176
|
+
atMs: number;
|
|
177
|
+
conversationId: string;
|
|
178
|
+
provider: string;
|
|
179
|
+
providerDestinationId: string;
|
|
180
|
+
providerTenantId: string;
|
|
181
|
+
providerConversationId: string;
|
|
182
|
+
}): Promise<string>;
|
|
171
183
|
/** Read confirmed public/private visibility for one destination. */
|
|
172
184
|
getDestinationVisibility(args: {
|
|
173
185
|
provider: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as withScope } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import "./config-
|
|
3
|
-
import { h as logWarn, p as logException } from "./logging-
|
|
2
|
+
import "./config-BOByVnxe.js";
|
|
3
|
+
import { h as logWarn, p as logException } from "./logging-CJTi5niy.js";
|
|
4
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
5
|
import { sql } from "drizzle-orm";
|
|
6
6
|
import { bigint, boolean, check, date, doublePrecision, foreignKey, index, integer, jsonb, pgTable, primaryKey, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
|
|
@@ -195,6 +195,8 @@ const juniorCodeChanges = pgTable("junior_code_changes", {
|
|
|
195
195
|
id: uuid("id").primaryKey(),
|
|
196
196
|
closedAt: timestamptz("closed_at"),
|
|
197
197
|
conversationIds: text("conversation_ids").array().notNull().default(sql`ARRAY[]::text[]`),
|
|
198
|
+
/** Latest push, review, or comment by a person, from the code plugin. */
|
|
199
|
+
lastActivityAt: timestamptz("last_activity_at"),
|
|
198
200
|
mergedAt: timestamptz("merged_at"),
|
|
199
201
|
number: integer("number").notNull(),
|
|
200
202
|
openedAt: timestamptz("opened_at").notNull(),
|
|
@@ -456,6 +458,7 @@ const juniorAgentInvocations = pgTable("junior_agent_invocations", {
|
|
|
456
458
|
destination: jsonb("destination_json").$type().notNull(),
|
|
457
459
|
destinationVisibility: text("destination_visibility").$type(),
|
|
458
460
|
agentType: text("agent_type").$type(),
|
|
461
|
+
fork: boolean("fork").notNull().default(false),
|
|
459
462
|
reasoningLevel: text("reasoning_level").$type(),
|
|
460
463
|
parentToolCallId: text("parent_tool_call_id"),
|
|
461
464
|
status: text("status").$type().notNull(),
|
|
@@ -895,11 +898,11 @@ async function applyMigrations(executor, config) {
|
|
|
895
898
|
}
|
|
896
899
|
// src/db/neon.ts
|
|
897
900
|
const POOL_MAX = 10;
|
|
898
|
-
function
|
|
901
|
+
function toWebSocketError(error, failure) {
|
|
899
902
|
if (error instanceof Error) return error;
|
|
900
903
|
const event = error ?? {};
|
|
901
904
|
const reason = typeof event.message === "string" && event.message || event.error instanceof Error && event.error.message || typeof event.type === "string" && event.type || String(error);
|
|
902
|
-
return new Error(`WebSocket
|
|
905
|
+
return new Error(`WebSocket ${failure}: ${reason}`, event.error === void 0 ? void 0 : { cause: event.error });
|
|
903
906
|
}
|
|
904
907
|
/**
|
|
905
908
|
* Sends a pool query over Neon's SQL-over-HTTP endpoint when no idle
|
|
@@ -956,7 +959,7 @@ var OverflowPool = class extends Pool {
|
|
|
956
959
|
client.release();
|
|
957
960
|
return;
|
|
958
961
|
}
|
|
959
|
-
logException(
|
|
962
|
+
logException(toWebSocketError(error, "connect failed"), "db.pool.client.connect_failed", { "app.db.driver": "neon" });
|
|
960
963
|
});
|
|
961
964
|
}
|
|
962
965
|
/** Keep every pool query in `callback` on WebSocket. */
|
|
@@ -1117,7 +1120,12 @@ function createNeonJuniorSqlExecutor(args) {
|
|
|
1117
1120
|
dispatcher
|
|
1118
1121
|
});
|
|
1119
1122
|
pool.on("error", (error) => {
|
|
1120
|
-
|
|
1123
|
+
const failure = toWebSocketError(error, "idle client failed");
|
|
1124
|
+
logWarn("db.pool.client.failed", {
|
|
1125
|
+
"app.db.driver": "neon",
|
|
1126
|
+
"error.type": failure.name,
|
|
1127
|
+
"exception.message": failure.message
|
|
1128
|
+
});
|
|
1121
1129
|
});
|
|
1122
1130
|
if (onInfo) forwardInfoMessages(pool, onInfo);
|
|
1123
1131
|
return new NeonExecutor(pool, dispatcher);
|
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 { B as getDeploymentTelemetryAttributes, z as getDeploymentServiceVersion } from "./logging-
|
|
3
|
-
import { n as getCurrentConversationPrivacy } from "./conversation-privacy-
|
|
2
|
+
import { B as getDeploymentTelemetryAttributes, z as getDeploymentServiceVersion } from "./logging-CJTi5niy.js";
|
|
3
|
+
import { n as getCurrentConversationPrivacy } from "./conversation-privacy-C0eRxsgb.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-DcZ40a0g.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,21 +1,22 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import {
|
|
3
|
-
import { n as botConfig } from "./config-
|
|
4
|
-
import { M as SYSTEM_IDENTITY_ID, a as getConversationStore, o as getDb } from "./db-
|
|
5
|
-
import {
|
|
6
|
-
import { I as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
2
|
+
import { go as readConversationAccessFromSql, po as canAccessConversation, zn as renderUntrustedTag } from "./projection-BgwEE36_.js";
|
|
3
|
+
import { n as botConfig } from "./config-BOByVnxe.js";
|
|
4
|
+
import { M as SYSTEM_IDENTITY_ID, a as getConversationStore, o as getDb } from "./db-CoMNr2Zm.js";
|
|
5
|
+
import { Ft as actorFromRun, It as toolInvocationDestination } from "./agent-runner-Q9GkoerG.js";
|
|
6
|
+
import { I as findChildAgentConversationId, M as AgentMessagePausedError, O as createAgentInvocationForMessage, P as AgentMessageTargetError, x as enqueueAgentInvocation } from "./warmup-CwKbxQLl.js";
|
|
7
|
+
import { C as getActiveAgentInvocationForConversation, E as getLatestAgentInvocationForConversation, W as PARENT_AGENT_TARGET } from "./turn-user-message-BSPmkm7X.js";
|
|
8
|
+
import { b as postAutomatedTurnLimitNoticeForConversation, t as EVENT_WAIT_MS, w as admitAutomatedTurn } from "./notification-Bv25xbj0.js";
|
|
9
|
+
import { r as appendAndEnqueueInboundMessage } from "./store-B1zepKG8.js";
|
|
10
|
+
import { a as enqueueAgentMessageToParent } from "./result-C2Vn8QGn.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. */
|
|
14
14
|
const TOP_LEVEL_AGENT_MESSAGE_EVENT_TYPE = "agent.top_level_message";
|
|
15
15
|
/**
|
|
16
16
|
* Check that a top-level agent can message another top-level agent under
|
|
17
|
-
* `policies/conversation-access.md`.
|
|
18
|
-
*
|
|
17
|
+
* `policies/conversation-access.md`. Public agents can message each other.
|
|
18
|
+
* A private agent can message only agents at its own Destination, such as
|
|
19
|
+
* another thread in the same private Slack channel.
|
|
19
20
|
* Every target that the sender cannot reach gets the same error, so the
|
|
20
21
|
* error does not show that a private Conversation exists.
|
|
21
22
|
*/
|
|
@@ -33,7 +34,7 @@ async function requireTopLevelAgentAccess(args) {
|
|
|
33
34
|
requester: sender,
|
|
34
35
|
target: receiver
|
|
35
36
|
})) throw notReachable;
|
|
36
|
-
if (sender.visibility !== "public") throw new AgentMessageTargetError(`"${args.to}" is a public conversation and this conversation is private. A private conversation
|
|
37
|
+
if (receiver.visibility === "public" && sender.visibility !== "public") throw new AgentMessageTargetError(`"${args.to}" is a public conversation and this conversation is private. A private conversation can message only conversations in its own channel or DM`);
|
|
37
38
|
}
|
|
38
39
|
function renderTopLevelMessageInput(args) {
|
|
39
40
|
return renderUntrustedTag("agent-message", {
|
|
@@ -115,9 +116,10 @@ function bindMessageAgent(run, options) {
|
|
|
115
116
|
call.signal?.throwIfAborted();
|
|
116
117
|
const queue = typeof options.queue === "function" ? options.queue() : options.queue;
|
|
117
118
|
if (input.to === "parent") {
|
|
118
|
-
const sender = await getActiveAgentInvocationForConversation(run.conversationId);
|
|
119
|
+
const sender = await getActiveAgentInvocationForConversation(run.conversationId) ?? await getLatestAgentInvocationForConversation(run.conversationId);
|
|
119
120
|
if (!sender) throw new AgentMessageTargetError("This conversation has no parent agent");
|
|
120
121
|
await enqueueAgentMessageToParent({
|
|
122
|
+
actor,
|
|
121
123
|
messageKey: `${run.turnId}:${call.toolCallId}`,
|
|
122
124
|
queue,
|
|
123
125
|
sender,
|
package/dist/nitro.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as JuniorDashboardOptions } from "./app-
|
|
1
|
+
import { i as JuniorDashboardOptions } from "./app-DOg_mCtV.js";
|
|
2
2
|
import { n as JuniorPluginSet } from "./plugins-B_0Cr0MO.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,7 +1,8 @@
|
|
|
1
|
-
import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, 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, z as getDeploymentServiceVersion } from "./logging-
|
|
1
|
+
import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, 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, z as getDeploymentServiceVersion } from "./logging-CJTi5niy.js";
|
|
2
2
|
import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-DJhGdS4c.js";
|
|
3
|
-
import {
|
|
3
|
+
import { a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, h as CACHE_WARMUP_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, u as resolveConversationWorkQueueTopic } from "./background-compaction-queue-BZhGFOK6.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-D1rXWfFN.js";
|
|
5
6
|
import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cf5gVPWP.js";
|
|
6
7
|
import path from "node:path";
|
|
7
8
|
import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
|