@sentry/junior 0.115.0 → 0.116.1
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/{agent-hooks-4EUUXP2F.js → agent-hooks-GUAAS3XH.js} +9 -9
- package/dist/api/conversations/detail.d.ts +18 -0
- package/dist/api/conversations/event-page.d.ts +1 -1
- package/dist/api/conversations/events.d.ts +1 -1
- package/dist/api/people/profile.d.ts +2 -2
- package/dist/api/people/shared.d.ts +1 -1
- package/dist/api/personal-tokens/create.d.ts +11 -0
- package/dist/api/personal-tokens/list.d.ts +12 -0
- package/dist/api/personal-tokens/revoke.d.ts +5 -0
- package/dist/api/personal-tokens/routes.d.ts +4 -0
- package/dist/api/plugins.d.ts +0 -1
- package/dist/api/route.d.ts +1 -1
- package/dist/api/schema/conversation.d.ts +18 -0
- package/dist/api/schema/person.d.ts +3 -3
- package/dist/api/schema/personal-token.d.ts +38 -0
- package/dist/api/schema.d.ts +2 -0
- package/dist/api/schema.js +15 -3
- package/dist/api.d.ts +1 -0
- package/dist/api.js +179 -39
- package/dist/app.js +1035 -853
- package/dist/{catalog-runtime-Y32UEQLB.js → catalog-runtime-WMPC4J4U.js} +5 -5
- package/dist/chat/agent/request.d.ts +1 -0
- package/dist/chat/agent/resume.d.ts +1 -0
- package/dist/chat/agent/sandbox.d.ts +1 -0
- package/dist/chat/agent/tools.d.ts +1 -0
- package/dist/chat/agent-dispatch/context.d.ts +2 -0
- package/dist/chat/agent-dispatch/heartbeat.d.ts +11 -5
- package/dist/chat/agent-dispatch/signing.d.ts +14 -5
- package/dist/chat/agent-dispatch/store.d.ts +36 -15
- package/dist/chat/agent-dispatch/types.d.ts +23 -10
- package/dist/chat/agent-dispatch/work.d.ts +58 -0
- package/dist/chat/app/factory.d.ts +12 -3
- package/dist/chat/conversations/history.d.ts +285 -290
- package/dist/chat/conversations/projection.d.ts +2 -2
- package/dist/chat/mcp/tool-manager.d.ts +2 -1
- package/dist/chat/pi/conversation-events.d.ts +6 -2
- package/dist/chat/plugins/annotations.d.ts +8 -0
- package/dist/chat/plugins/registry.d.ts +0 -3
- package/dist/chat/plugins/types.d.ts +0 -2
- package/dist/chat/runtime/agent-continue-runner.d.ts +4 -0
- package/dist/chat/runtime/reply-executor.d.ts +6 -1
- package/dist/chat/runtime/slack-resume.d.ts +5 -1
- package/dist/chat/runtime/turn-input.d.ts +3 -0
- package/dist/chat/sandbox/sandbox.d.ts +2 -1
- package/dist/chat/sandbox/session.d.ts +2 -11
- package/dist/chat/sandbox/workspace.d.ts +10 -2
- package/dist/chat/services/turn-session-record.d.ts +14 -1
- package/dist/chat/slack/dispatch-turn.d.ts +25 -0
- package/dist/chat/state/turn-session.d.ts +11 -0
- package/dist/chat/tool-support/text-range-result.d.ts +3 -0
- package/dist/chat/tool-support/zod-tool.d.ts +1 -0
- package/dist/chat/tools/definition.d.ts +3 -10
- package/dist/chat/tools/query-conversation-events.d.ts +68 -0
- package/dist/chat/tools/sandbox/file-utils.d.ts +8 -1
- package/dist/chat/tools/sandbox/find-files.d.ts +2 -1
- package/dist/chat/tools/sandbox/grep.d.ts +2 -1
- package/dist/{chunk-6V762AB4.js → chunk-2YYPXQNQ.js} +1 -1
- package/dist/{chunk-MIAKQNYX.js → chunk-6ZK6FZIV.js} +1 -1
- package/dist/{chunk-67CVNDJ7.js → chunk-7CSVG54J.js} +1 -1
- package/dist/{chunk-HWCQRGLL.js → chunk-BFYVIOTS.js} +105 -37
- package/dist/{chunk-LYA2AB5G.js → chunk-CGXLCMWI.js} +8 -52
- package/dist/{chunk-SYJT7AKB.js → chunk-CY7NXM32.js} +1 -1
- package/dist/{chunk-2QG4MZQ7.js → chunk-DLLW5ITL.js} +2 -2
- package/dist/{chunk-NVUQSFWX.js → chunk-F3SWGSPG.js} +3 -15
- package/dist/{chunk-CWEZEPD4.js → chunk-FAEALXEH.js} +68 -2
- package/dist/{chunk-43RYMWJ2.js → chunk-GDAXWEIJ.js} +809 -213
- package/dist/{chunk-AGLQYELI.js → chunk-H35BDAUS.js} +170 -170
- package/dist/{chunk-YCLO7D7M.js → chunk-JPKGW6L6.js} +77 -26
- package/dist/{chunk-G5SX4UPR.js → chunk-KNCELO2M.js} +2 -2
- package/dist/{chunk-FHC4JUSF.js → chunk-N3C4XCRE.js} +1 -2
- package/dist/{chunk-6FKLPVF3.js → chunk-OY2PQQ4P.js} +1 -1
- package/dist/{chunk-6OPTF4BQ.js → chunk-PE44LDDQ.js} +0 -1
- package/dist/{chunk-JQFJO5WH.js → chunk-RXRQJF7Y.js} +74 -17
- package/dist/{chunk-CEYOL62C.js → chunk-RYFAVWP3.js} +120 -20
- package/dist/{chunk-G36V2YGB.js → chunk-TC4ZEM2D.js} +33 -1
- package/dist/{chunk-PVZHG2XZ.js → chunk-VBMMMVVQ.js} +112 -35
- package/dist/{chunk-SG5WAA7H.js → chunk-WKU7TY22.js} +0 -3
- package/dist/{chunk-TVE25LPW.js → chunk-WLT72MRP.js} +1 -1
- package/dist/{chunk-EW5MLKT5.js → chunk-XA3VLFPK.js} +1 -55
- package/dist/{chunk-RAVKCKXA.js → chunk-ZYHLNTC2.js} +20 -5
- package/dist/cli/chat.js +23 -23
- package/dist/cli/check.js +6 -6
- package/dist/cli/plugins.js +13 -13
- package/dist/cli/snapshot-warmup.js +8 -8
- package/dist/cli/upgrade.js +7 -7
- package/dist/db/schema/api-tokens.d.ts +160 -0
- package/dist/db/schema/conversation-annotations.d.ts +142 -0
- package/dist/db/schema.d.ts +305 -1
- package/dist/{db-KBSJHAZU.js → db-FH4R5ZQ4.js} +6 -6
- package/dist/handlers/agent-dispatch.d.ts +7 -3
- package/dist/instrumentation.js +2 -2
- package/dist/nitro.js +5 -5
- package/dist/{oauth-callback-server-EYRMJTCS.js → oauth-callback-server-C2SSJ3FQ.js} +18 -18
- package/dist/personal-tokens/store.d.ts +27 -0
- package/dist/{plugins-PZMDS7AT.js → plugins-IUJA4VBU.js} +1 -1
- package/dist/reporting-schema.d.ts +0 -2
- package/dist/{runner-RQGZ5Z2S.js → runner-NAALFIXM.js} +12 -12
- package/dist/{skills-JJQIE3BT.js → skills-UN2JXYYF.js} +6 -6
- package/dist/{validation-MZ47PZP5.js → validation-EEF4ROHR.js} +6 -6
- package/dist/version.js +1 -1
- package/migrations/0008_sticky_rage.sql +14 -0
- package/migrations/0009_slippery_harrier.sql +12 -0
- package/migrations/0010_native_conversation_history.sql +142 -0
- package/migrations/meta/0008_snapshot.json +1076 -0
- package/migrations/meta/0009_snapshot.json +1146 -0
- package/migrations/meta/0010_snapshot.json +1190 -0
- package/migrations/meta/_journal.json +22 -1
- package/package.json +5 -6
- package/dist/chat/agent-dispatch/runner.d.ts +0 -13
- package/dist/chat/capabilities/catalog.d.ts +0 -16
- package/dist/{chunk-KNFROR7R.js → chunk-5I6ORJUY.js} +1 -1
|
@@ -4,18 +4,18 @@ import {
|
|
|
4
4
|
juniorConversations,
|
|
5
5
|
juniorIdentities,
|
|
6
6
|
juniorUsers
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RXRQJF7Y.js";
|
|
8
8
|
import {
|
|
9
9
|
TURN_REASONING_LEVELS,
|
|
10
10
|
getChatConfig,
|
|
11
11
|
modelProfileSchema
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-CY7NXM32.js";
|
|
13
13
|
import {
|
|
14
14
|
juniorDestinations
|
|
15
15
|
} from "./chunk-VFUK3X5B.js";
|
|
16
16
|
import {
|
|
17
17
|
normalizeIdentityEmail
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-F3SWGSPG.js";
|
|
19
19
|
import {
|
|
20
20
|
parseSlackChannelReferenceId,
|
|
21
21
|
parseSlackTeamId
|
|
@@ -59,12 +59,6 @@ function sameDestination(left, right) {
|
|
|
59
59
|
}
|
|
60
60
|
return false;
|
|
61
61
|
}
|
|
62
|
-
function destinationKey(destination) {
|
|
63
|
-
if (destination.platform === "local") {
|
|
64
|
-
return destination.conversationId;
|
|
65
|
-
}
|
|
66
|
-
return `slack:${destination.teamId}:${destination.channelId}`;
|
|
67
|
-
}
|
|
68
62
|
|
|
69
63
|
// src/chat/identities/sql.ts
|
|
70
64
|
import { randomUUID } from "crypto";
|
|
@@ -741,9 +735,11 @@ import {
|
|
|
741
735
|
asc as asc2,
|
|
742
736
|
desc as desc2,
|
|
743
737
|
eq as eq3,
|
|
738
|
+
gt,
|
|
744
739
|
gte,
|
|
745
740
|
inArray,
|
|
746
741
|
isNotNull,
|
|
742
|
+
lt,
|
|
747
743
|
lte,
|
|
748
744
|
sql as sql4
|
|
749
745
|
} from "drizzle-orm";
|
|
@@ -796,20 +792,31 @@ var handoffModelProfileSchema = modelProfileSchema.refine(
|
|
|
796
792
|
(profile) => profile !== "standard",
|
|
797
793
|
"handoff profile must not be standard"
|
|
798
794
|
);
|
|
799
|
-
var
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
provenance: conversationMessageProvenanceSchema
|
|
803
|
-
}).
|
|
804
|
-
var
|
|
805
|
-
type: z2.literal("
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
795
|
+
var userMessageEventDataSchema = z2.object({
|
|
796
|
+
type: z2.literal("user_message"),
|
|
797
|
+
role: z2.never().optional(),
|
|
798
|
+
provenance: conversationMessageProvenanceSchema
|
|
799
|
+
}).passthrough();
|
|
800
|
+
var assistantMessageEventDataSchema = z2.object({
|
|
801
|
+
type: z2.literal("assistant_message"),
|
|
802
|
+
role: z2.never().optional()
|
|
803
|
+
}).passthrough();
|
|
804
|
+
var toolResultEventDataSchema = z2.object({
|
|
805
|
+
type: z2.literal("tool_result"),
|
|
806
|
+
role: z2.never().optional()
|
|
807
|
+
}).passthrough();
|
|
808
|
+
var agentHistoryItemSchema = z2.discriminatedUnion("type", [
|
|
809
|
+
userMessageEventDataSchema,
|
|
810
|
+
assistantMessageEventDataSchema,
|
|
811
|
+
toolResultEventDataSchema
|
|
812
|
+
]);
|
|
813
|
+
var nativeReplacementHistoryItemSchema = z2.object({
|
|
814
|
+
item: agentHistoryItemSchema,
|
|
815
|
+
// Preserve the copied item's position when a turn resumes. Synthetic
|
|
816
|
+
// summary and handoff items have no source event.
|
|
810
817
|
sourceEventSeq: z2.number().int().nonnegative().optional()
|
|
811
|
-
});
|
|
812
|
-
var replacementHistorySchema = z2.array(
|
|
818
|
+
}).strict();
|
|
819
|
+
var replacementHistorySchema = z2.array(nativeReplacementHistoryItemSchema);
|
|
813
820
|
var compactionDetailsSchema = z2.object({
|
|
814
821
|
reason: z2.literal("capacity"),
|
|
815
822
|
estimatedInputTokens: z2.number().int().nonnegative(),
|
|
@@ -839,12 +846,6 @@ var historyReplacementEventDataSchema = z2.discriminatedUnion("type", [
|
|
|
839
846
|
replacementHistory: replacementHistorySchema
|
|
840
847
|
}).strict()
|
|
841
848
|
]);
|
|
842
|
-
var legacyRollbackEventDataSchema = z2.object({
|
|
843
|
-
type: z2.literal("rollback"),
|
|
844
|
-
modelProfile: modelProfileSchema,
|
|
845
|
-
modelId: z2.string().min(1),
|
|
846
|
-
replacementHistory: replacementHistorySchema
|
|
847
|
-
}).strict();
|
|
848
849
|
var historyReplacementSchema = z2.object({
|
|
849
850
|
data: historyReplacementEventDataSchema,
|
|
850
851
|
createdAtMs: z2.number().finite()
|
|
@@ -975,7 +976,7 @@ var subagentEndedEventDataSchema = z2.object({
|
|
|
975
976
|
var appendableConversationEventDataSchema = z2.union([
|
|
976
977
|
messageEventDataSchema,
|
|
977
978
|
messageUpdatedEventDataSchema,
|
|
978
|
-
|
|
979
|
+
agentHistoryItemSchema,
|
|
979
980
|
mcpProviderConnectedEventDataSchema,
|
|
980
981
|
authorizationRequestedEventDataSchema,
|
|
981
982
|
authorizationCompletedEventDataSchema,
|
|
@@ -991,13 +992,14 @@ var appendableConversationEventDataSchema = z2.union([
|
|
|
991
992
|
]);
|
|
992
993
|
var conversationEventDataSchema = z2.union([
|
|
993
994
|
appendableConversationEventDataSchema,
|
|
994
|
-
historyReplacementEventDataSchema
|
|
995
|
-
legacyRollbackEventDataSchema
|
|
995
|
+
historyReplacementEventDataSchema
|
|
996
996
|
]);
|
|
997
|
-
var
|
|
997
|
+
var KNOWN_CONVERSATION_EVENT_TYPES = [
|
|
998
998
|
"message",
|
|
999
999
|
"message_updated",
|
|
1000
|
-
"
|
|
1000
|
+
"user_message",
|
|
1001
|
+
"assistant_message",
|
|
1002
|
+
"tool_result",
|
|
1001
1003
|
"mcp_provider_connected",
|
|
1002
1004
|
"authorization_requested",
|
|
1003
1005
|
"authorization_completed",
|
|
@@ -1011,9 +1013,9 @@ var knownConversationEventTypeSchema = z2.enum([
|
|
|
1011
1013
|
"subagent_started",
|
|
1012
1014
|
"subagent_ended",
|
|
1013
1015
|
"handoff",
|
|
1014
|
-
"compaction"
|
|
1015
|
-
|
|
1016
|
-
|
|
1016
|
+
"compaction"
|
|
1017
|
+
];
|
|
1018
|
+
var knownConversationEventTypeSchema = z2.enum(KNOWN_CONVERSATION_EVENT_TYPES);
|
|
1017
1019
|
var unknownConversationEventDataSchema = z2.object({
|
|
1018
1020
|
type: z2.literal("unknown"),
|
|
1019
1021
|
originalType: z2.string().min(1),
|
|
@@ -1270,6 +1272,16 @@ var SqlConversationEventStore = class {
|
|
|
1270
1272
|
).orderBy(asc2(juniorConversationEvents.seq));
|
|
1271
1273
|
return rows.map(eventFromRow);
|
|
1272
1274
|
}
|
|
1275
|
+
async loadLatestInstruction(conversationId) {
|
|
1276
|
+
const [row] = await this.executor.db().select().from(juniorConversationEvents).where(
|
|
1277
|
+
and3(
|
|
1278
|
+
eq3(juniorConversationEvents.conversationId, conversationId),
|
|
1279
|
+
eq3(juniorConversationEvents.type, "user_message"),
|
|
1280
|
+
sql4`${juniorConversationEvents.payload}->'provenance'->>'authority' = 'instruction'`
|
|
1281
|
+
)
|
|
1282
|
+
).orderBy(desc2(juniorConversationEvents.seq)).limit(1);
|
|
1283
|
+
return row ? eventFromRow(row) : void 0;
|
|
1284
|
+
}
|
|
1273
1285
|
async loadMessageHistory(conversationId) {
|
|
1274
1286
|
const [compactionRow] = await this.executor.db().select().from(juniorConversationEvents).where(
|
|
1275
1287
|
and3(
|
|
@@ -1292,6 +1304,61 @@ var SqlConversationEventStore = class {
|
|
|
1292
1304
|
const rows = await this.executor.db().select().from(juniorConversationEvents).where(eq3(juniorConversationEvents.conversationId, conversationId)).orderBy(asc2(juniorConversationEvents.seq));
|
|
1293
1305
|
return rows.map(eventFromRow);
|
|
1294
1306
|
}
|
|
1307
|
+
async query(conversationId, query) {
|
|
1308
|
+
if (query.limit < 1) {
|
|
1309
|
+
throw new Error("Conversation event query limit must be at least 1");
|
|
1310
|
+
}
|
|
1311
|
+
if (query.afterSeq !== void 0 && query.beforeSeq !== void 0 && query.afterSeq >= query.beforeSeq) {
|
|
1312
|
+
return { events: [], hasOlder: false, hasNewer: false };
|
|
1313
|
+
}
|
|
1314
|
+
const typeFilter = query.types && query.types.length > 0 ? inArray(juniorConversationEvents.type, [...query.types]) : void 0;
|
|
1315
|
+
const bounds = and3(
|
|
1316
|
+
eq3(juniorConversationEvents.conversationId, conversationId),
|
|
1317
|
+
query.afterSeq === void 0 ? void 0 : gt(juniorConversationEvents.seq, query.afterSeq),
|
|
1318
|
+
query.beforeSeq === void 0 ? void 0 : lt(juniorConversationEvents.seq, query.beforeSeq),
|
|
1319
|
+
typeFilter
|
|
1320
|
+
);
|
|
1321
|
+
const newestFirst = query.afterSeq === void 0;
|
|
1322
|
+
const rows = await this.executor.db().select().from(juniorConversationEvents).where(bounds).orderBy(
|
|
1323
|
+
newestFirst ? desc2(juniorConversationEvents.seq) : asc2(juniorConversationEvents.seq)
|
|
1324
|
+
).limit(query.limit + 1);
|
|
1325
|
+
const overflow = rows.length > query.limit;
|
|
1326
|
+
const pageRows = overflow ? rows.slice(0, query.limit) : rows;
|
|
1327
|
+
const events = (newestFirst ? [...pageRows].reverse() : pageRows).map(
|
|
1328
|
+
eventFromRow
|
|
1329
|
+
);
|
|
1330
|
+
if (events.length === 0) {
|
|
1331
|
+
return { events, hasOlder: false, hasNewer: false };
|
|
1332
|
+
}
|
|
1333
|
+
const firstSeq = events[0].seq;
|
|
1334
|
+
const lastSeq = events[events.length - 1].seq;
|
|
1335
|
+
const hasOlder = newestFirst && overflow ? true : await this.hasMatchingEvent({
|
|
1336
|
+
conversationId,
|
|
1337
|
+
beforeSeq: firstSeq,
|
|
1338
|
+
typeFilter
|
|
1339
|
+
});
|
|
1340
|
+
const hasNewer = !newestFirst && overflow ? true : await this.hasMatchingEvent({
|
|
1341
|
+
conversationId,
|
|
1342
|
+
afterSeq: lastSeq,
|
|
1343
|
+
typeFilter
|
|
1344
|
+
});
|
|
1345
|
+
return { events, hasOlder, hasNewer };
|
|
1346
|
+
}
|
|
1347
|
+
/** Return whether any matching event exists inside the exclusive seq window. */
|
|
1348
|
+
async hasMatchingEvent(args) {
|
|
1349
|
+
if (args.afterSeq !== void 0 && args.beforeSeq !== void 0 && args.afterSeq >= args.beforeSeq) {
|
|
1350
|
+
return false;
|
|
1351
|
+
}
|
|
1352
|
+
const [row] = await this.executor.db().select({ seq: juniorConversationEvents.seq }).from(juniorConversationEvents).where(
|
|
1353
|
+
and3(
|
|
1354
|
+
eq3(juniorConversationEvents.conversationId, args.conversationId),
|
|
1355
|
+
args.afterSeq === void 0 ? void 0 : gt(juniorConversationEvents.seq, args.afterSeq),
|
|
1356
|
+
args.beforeSeq === void 0 ? void 0 : lt(juniorConversationEvents.seq, args.beforeSeq),
|
|
1357
|
+
args.typeFilter
|
|
1358
|
+
)
|
|
1359
|
+
).limit(1);
|
|
1360
|
+
return row !== void 0;
|
|
1361
|
+
}
|
|
1295
1362
|
/** Read the next sequence and active model-history version. */
|
|
1296
1363
|
async readCursor(conversationId) {
|
|
1297
1364
|
const rows = await this.executor.db().select({
|
|
@@ -1436,10 +1503,11 @@ export {
|
|
|
1436
1503
|
parseDestination,
|
|
1437
1504
|
requireSlackDestination,
|
|
1438
1505
|
sameDestination,
|
|
1439
|
-
destinationKey,
|
|
1440
1506
|
instructionProvenanceFor,
|
|
1441
1507
|
contextProvenance,
|
|
1442
1508
|
instructionActors,
|
|
1509
|
+
agentHistoryItemSchema,
|
|
1510
|
+
KNOWN_CONVERSATION_EVENT_TYPES,
|
|
1443
1511
|
decodeStoredConversationEvent,
|
|
1444
1512
|
sanitizePostgresJson,
|
|
1445
1513
|
withConversationEventLock,
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getInterruptionMarker
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RYFAVWP3.js";
|
|
4
4
|
import {
|
|
5
5
|
createPluginLogger,
|
|
6
6
|
getPlugins
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZYHLNTC2.js";
|
|
8
8
|
import {
|
|
9
9
|
acquireActiveLock,
|
|
10
10
|
getStateAdapter
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-7CSVG54J.js";
|
|
12
12
|
import {
|
|
13
13
|
SlackActionError,
|
|
14
14
|
getSlackClient,
|
|
15
15
|
isDmChannel,
|
|
16
16
|
normalizeSlackConversationId,
|
|
17
17
|
withSlackRetries
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-FAEALXEH.js";
|
|
19
19
|
import {
|
|
20
20
|
getDb,
|
|
21
21
|
parseDestination
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-BFYVIOTS.js";
|
|
23
23
|
import {
|
|
24
24
|
sleep
|
|
25
25
|
} from "./chunk-4ZNGQH7C.js";
|
|
26
26
|
import {
|
|
27
27
|
normalizeSlackEmojiName
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-CY7NXM32.js";
|
|
29
29
|
import {
|
|
30
30
|
pluginCatalogRuntime
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-OY2PQQ4P.js";
|
|
32
32
|
import {
|
|
33
33
|
logInfo,
|
|
34
34
|
logWarn
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-F3SWGSPG.js";
|
|
36
36
|
import {
|
|
37
37
|
isRecord
|
|
38
38
|
} from "./chunk-OB42YVAE.js";
|
|
@@ -41,49 +41,6 @@ import {
|
|
|
41
41
|
parseSlackUserId
|
|
42
42
|
} from "./chunk-F3B2YJ76.js";
|
|
43
43
|
|
|
44
|
-
// src/chat/capabilities/catalog.ts
|
|
45
|
-
var cachedCatalog;
|
|
46
|
-
function getCapabilityCatalog() {
|
|
47
|
-
const signature = pluginCatalogRuntime.getSignature();
|
|
48
|
-
if (cachedCatalog?.signature === signature) return cachedCatalog;
|
|
49
|
-
const providers = pluginCatalogRuntime.getCapabilityProviders();
|
|
50
|
-
const capabilityToProvider = /* @__PURE__ */ new Map();
|
|
51
|
-
for (const provider of providers) {
|
|
52
|
-
for (const capability of provider.capabilities) {
|
|
53
|
-
if (capabilityToProvider.has(capability)) {
|
|
54
|
-
throw new Error(
|
|
55
|
-
`Duplicate capability registration for "${capability}"`
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
capabilityToProvider.set(capability, provider);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
cachedCatalog = { signature, providers, capabilityToProvider };
|
|
62
|
-
return cachedCatalog;
|
|
63
|
-
}
|
|
64
|
-
var catalogLogged = false;
|
|
65
|
-
function logCapabilityCatalogLoadedOnce() {
|
|
66
|
-
if (catalogLogged) return;
|
|
67
|
-
catalogLogged = true;
|
|
68
|
-
const { providers } = getCapabilityCatalog();
|
|
69
|
-
const capabilityNames = providers.flatMap((p) => p.capabilities).sort();
|
|
70
|
-
const configKeys = [
|
|
71
|
-
...new Set(providers.flatMap((p) => p.configKeys))
|
|
72
|
-
].sort();
|
|
73
|
-
logInfo(
|
|
74
|
-
"capability_catalog_loaded",
|
|
75
|
-
{},
|
|
76
|
-
{
|
|
77
|
-
"app.capability.providers": providers.map((p) => p.provider),
|
|
78
|
-
"app.capability.count": capabilityNames.length,
|
|
79
|
-
"app.capability.names": capabilityNames,
|
|
80
|
-
"app.config.key_count": configKeys.length,
|
|
81
|
-
"app.config.keys": configKeys
|
|
82
|
-
},
|
|
83
|
-
"Loaded capability provider catalog"
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
44
|
// src/chat/capabilities/router.ts
|
|
88
45
|
var ProviderCredentialRouter = class {
|
|
89
46
|
brokersByProvider;
|
|
@@ -167,7 +124,6 @@ function createUserTokenStore() {
|
|
|
167
124
|
return new StateAdapterTokenStore(getStateAdapter());
|
|
168
125
|
}
|
|
169
126
|
function createProviderCredentialRouter(userTokenStore) {
|
|
170
|
-
logCapabilityCatalogLoadedOnce();
|
|
171
127
|
const brokersByProvider = {};
|
|
172
128
|
for (const plugin of pluginCatalogRuntime.getProviders()) {
|
|
173
129
|
const { name } = plugin.manifest;
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./chunk-6GWA276C.js";
|
|
14
14
|
import {
|
|
15
15
|
getDeploymentTelemetryAttributes
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WLT72MRP.js";
|
|
17
17
|
|
|
18
18
|
// src/chat/logging.ts
|
|
19
19
|
import path from "path";
|
|
@@ -186,11 +186,7 @@ var CONSOLE_ALWAYS_HIDDEN_KEYS = /* @__PURE__ */ new Set([
|
|
|
186
186
|
"url.path",
|
|
187
187
|
"user_agent.original"
|
|
188
188
|
]);
|
|
189
|
-
var CONSOLE_DROP_WHEN_COUNTED_KEYS = /* @__PURE__ */ new Set([
|
|
190
|
-
"app.capability.names",
|
|
191
|
-
"app.capability.providers",
|
|
192
|
-
"app.config.keys"
|
|
193
|
-
]);
|
|
189
|
+
var CONSOLE_DROP_WHEN_COUNTED_KEYS = /* @__PURE__ */ new Set(["app.config.keys"]);
|
|
194
190
|
var CONSOLE_PREVIEW_KEYS = /* @__PURE__ */ new Set([
|
|
195
191
|
"gen_ai.input.messages",
|
|
196
192
|
"gen_ai.output.messages",
|
|
@@ -677,7 +673,7 @@ function booleanConsoleToken(label, value) {
|
|
|
677
673
|
return typeof value === "boolean" ? `${label}=${value ? "yes" : "no"}` : void 0;
|
|
678
674
|
}
|
|
679
675
|
function shouldShowPrettyCorrelation(eventName) {
|
|
680
|
-
return !(eventName === "plugin_loaded" || eventName === "startup_discovery_summary" || eventName
|
|
676
|
+
return !(eventName === "plugin_loaded" || eventName === "startup_discovery_summary" || eventName.endsWith("_loaded"));
|
|
681
677
|
}
|
|
682
678
|
function getPrettyConsoleSummaryTokens(level, eventName, attributes) {
|
|
683
679
|
const tokens = [];
|
|
@@ -689,10 +685,6 @@ function getPrettyConsoleSummaryTokens(level, eventName, attributes) {
|
|
|
689
685
|
tokens,
|
|
690
686
|
eventName.startsWith("plugin_heartbeat") ? stringConsoleToken("plugin", attributes["app.plugin.name"]) : toOptionalString(attributes["app.plugin.name"]) ?? void 0
|
|
691
687
|
);
|
|
692
|
-
pushPrettyConsoleToken(
|
|
693
|
-
tokens,
|
|
694
|
-
numericConsoleToken("caps", attributes["app.plugin.capability_count"])
|
|
695
|
-
);
|
|
696
688
|
pushPrettyConsoleToken(
|
|
697
689
|
tokens,
|
|
698
690
|
numericConsoleToken("config", attributes["app.plugin.config_key_count"])
|
|
@@ -713,10 +705,6 @@ function getPrettyConsoleSummaryTokens(level, eventName, attributes) {
|
|
|
713
705
|
tokens,
|
|
714
706
|
numericConsoleToken("skills", attributes["app.skill.count"])
|
|
715
707
|
);
|
|
716
|
-
pushPrettyConsoleToken(
|
|
717
|
-
tokens,
|
|
718
|
-
numericConsoleToken("capabilities", attributes["app.capability.count"])
|
|
719
|
-
);
|
|
720
708
|
pushPrettyConsoleToken(
|
|
721
709
|
tokens,
|
|
722
710
|
numericConsoleToken("config", attributes["app.config.key_count"])
|
|
@@ -1,19 +1,83 @@
|
|
|
1
|
+
import {
|
|
2
|
+
juniorConversationAnnotations
|
|
3
|
+
} from "./chunk-RXRQJF7Y.js";
|
|
1
4
|
import {
|
|
2
5
|
sleep
|
|
3
6
|
} from "./chunk-4ZNGQH7C.js";
|
|
4
7
|
import {
|
|
5
8
|
getSlackBotToken
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CY7NXM32.js";
|
|
7
10
|
import {
|
|
8
11
|
logWarn,
|
|
9
12
|
setSpanAttributes,
|
|
10
13
|
setSpanStatus,
|
|
11
14
|
withSpan
|
|
12
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-F3SWGSPG.js";
|
|
13
16
|
import {
|
|
14
17
|
parseSlackChannelReferenceId
|
|
15
18
|
} from "./chunk-F3B2YJ76.js";
|
|
16
19
|
|
|
20
|
+
// src/chat/plugins/annotations.ts
|
|
21
|
+
import { and, desc, eq } from "drizzle-orm";
|
|
22
|
+
import {
|
|
23
|
+
conversationAnnotationInputSchema
|
|
24
|
+
} from "@sentry/junior-plugin-api";
|
|
25
|
+
function createPluginAnnotations(args) {
|
|
26
|
+
return {
|
|
27
|
+
async upsert(input) {
|
|
28
|
+
const annotation = conversationAnnotationInputSchema.parse(input);
|
|
29
|
+
const now = /* @__PURE__ */ new Date();
|
|
30
|
+
await args.db.insert(juniorConversationAnnotations).values({
|
|
31
|
+
annotation,
|
|
32
|
+
conversationId: args.conversationId,
|
|
33
|
+
createdAt: now,
|
|
34
|
+
key: annotation.key,
|
|
35
|
+
kind: annotation.kind,
|
|
36
|
+
plugin: args.plugin,
|
|
37
|
+
updatedAt: now
|
|
38
|
+
}).onConflictDoUpdate({
|
|
39
|
+
target: [
|
|
40
|
+
juniorConversationAnnotations.conversationId,
|
|
41
|
+
juniorConversationAnnotations.plugin,
|
|
42
|
+
juniorConversationAnnotations.kind,
|
|
43
|
+
juniorConversationAnnotations.key
|
|
44
|
+
],
|
|
45
|
+
set: { annotation, updatedAt: now }
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
async remove(kind, key) {
|
|
49
|
+
await args.db.delete(juniorConversationAnnotations).where(
|
|
50
|
+
and(
|
|
51
|
+
eq(
|
|
52
|
+
juniorConversationAnnotations.conversationId,
|
|
53
|
+
args.conversationId
|
|
54
|
+
),
|
|
55
|
+
eq(juniorConversationAnnotations.plugin, args.plugin),
|
|
56
|
+
eq(juniorConversationAnnotations.kind, kind),
|
|
57
|
+
eq(juniorConversationAnnotations.key, key)
|
|
58
|
+
)
|
|
59
|
+
);
|
|
60
|
+
},
|
|
61
|
+
async list() {
|
|
62
|
+
return (await listConversationAnnotations(args.db, args.conversationId)).filter((a) => a.plugin === args.plugin);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
async function listConversationAnnotations(db, conversationId) {
|
|
67
|
+
const rows = await db.select().from(juniorConversationAnnotations).where(eq(juniorConversationAnnotations.conversationId, conversationId)).orderBy(desc(juniorConversationAnnotations.updatedAt));
|
|
68
|
+
return rows.flatMap((row) => {
|
|
69
|
+
const parsed = conversationAnnotationInputSchema.safeParse(row.annotation);
|
|
70
|
+
return parsed.success ? [
|
|
71
|
+
{
|
|
72
|
+
...parsed.data,
|
|
73
|
+
plugin: row.plugin,
|
|
74
|
+
createdAt: row.createdAt.toISOString(),
|
|
75
|
+
updatedAt: row.updatedAt.toISOString()
|
|
76
|
+
}
|
|
77
|
+
] : [];
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
17
81
|
// src/chat/slack/client.ts
|
|
18
82
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
19
83
|
import { WebClient } from "@slack/web-api";
|
|
@@ -435,6 +499,8 @@ async function downloadPrivateSlackFile(url) {
|
|
|
435
499
|
}
|
|
436
500
|
|
|
437
501
|
export {
|
|
502
|
+
createPluginAnnotations,
|
|
503
|
+
listConversationAnnotations,
|
|
438
504
|
runWithWorkspaceTeamId,
|
|
439
505
|
getWorkspaceTeamId,
|
|
440
506
|
SlackActionError,
|