@sentry/junior 0.181.1 → 0.183.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/{agent-hooks-KO56HJ74.js → agent-hooks-SNRBZYAU.js} +11 -11
- package/dist/api/code/overview.d.ts +35 -0
- package/dist/api/code/routes.d.ts +4 -0
- package/dist/api/schema/code.d.ts +75 -0
- package/dist/api/schema.d.ts +2 -0
- package/dist/api/schema.js +9 -1
- package/dist/api.js +347 -149
- package/dist/app-adapter.d.ts +85 -0
- package/dist/app.d.ts +6 -1
- package/dist/app.js +380 -501
- package/dist/{catalog-runtime-CJTFLCK3.js → catalog-runtime-3I3JOIIH.js} +4 -4
- package/dist/chat/agent-invocations/store.d.ts +4 -2
- package/dist/chat/agent-invocations/work.d.ts +1 -3
- package/dist/chat/api-turns/adapter-conversations.d.ts +15 -0
- package/dist/chat/api-turns/stop.d.ts +12 -0
- package/dist/chat/api-turns/work.d.ts +9 -1
- package/dist/chat/app/conversation-work.d.ts +1 -1
- package/dist/chat/app/factory.d.ts +3 -3
- package/dist/chat/app/services.d.ts +3 -3
- package/dist/chat/code/publisher.d.ts +3 -0
- package/dist/chat/code/store.d.ts +9 -0
- package/dist/chat/event-tasks/store.d.ts +10 -0
- package/dist/chat/event-tasks/tool-support.d.ts +7 -1
- package/dist/chat/event-tasks/types.d.ts +1 -0
- package/dist/chat/experimental.d.ts +1 -1
- package/dist/chat/ingress/slack-webhook.d.ts +1 -1
- package/dist/chat/plugins/agent-hooks.d.ts +5 -0
- package/dist/chat/{runtime/slack-runtime.d.ts → providers/slack/runtime.d.ts} +2 -2
- package/dist/chat/{runtime/reply-executor.d.ts → providers/slack/turn.d.ts} +10 -9
- package/dist/chat/resource-events/catalog.d.ts +11 -1
- package/dist/chat/resource-events/store.d.ts +17 -1
- package/dist/chat/runtime/turn-execution.d.ts +30 -0
- package/dist/chat/services/subscribed-decision.d.ts +2 -1
- package/dist/chat/slack/dispatch-turn.d.ts +12 -14
- package/dist/chat/task-execution/slack-work.d.ts +1 -1
- package/dist/chat/tools/create-event-task.d.ts +3 -0
- package/dist/chat/tools/delete-event-task.d.ts +2 -0
- package/dist/chat/tools/list-event-tasks.d.ts +2 -0
- package/dist/chat/tools/list-resource-event-subscriptions.d.ts +2 -0
- package/dist/chat/tools/search-resource-event-types.d.ts +10 -0
- package/dist/chat/tools/update-event-task.d.ts +3 -0
- package/dist/chat/tools/watch-resource-events.d.ts +3 -0
- package/dist/{chunk-DTRCZOHE.js → chunk-24OJZ5OU.js} +6 -6
- package/dist/{chunk-Z2UG4FBT.js → chunk-2ADFGSUS.js} +1 -1
- package/dist/{chunk-RULGB5NX.js → chunk-2EPYYVJC.js} +9 -9
- package/dist/{chunk-VRS6WDK5.js → chunk-2LYHWMR4.js} +1 -1
- package/dist/{chunk-XQ56HNH5.js → chunk-35PM4YY5.js} +6 -6
- package/dist/{chunk-6TB7JN63.js → chunk-37IQ6DGU.js} +3 -3
- package/dist/{chunk-MR36BRPE.js → chunk-3HJ4F4L7.js} +4 -4
- package/dist/{chunk-4WYHL4EH.js → chunk-3L7CWDQQ.js} +1 -1
- package/dist/{chunk-CJRUBOJI.js → chunk-4WGFWHWP.js} +1 -1
- package/dist/{chunk-VHSBLFNT.js → chunk-56XONJPF.js} +1 -1
- package/dist/{chunk-ULM7P4EQ.js → chunk-6UXDTPEN.js} +233 -173
- package/dist/{chunk-WDNA4LML.js → chunk-AHMWPFIW.js} +188 -11
- package/dist/{chunk-YCW6RZGX.js → chunk-AX3UDIMA.js} +3 -3
- package/dist/{chunk-HG6HNOTQ.js → chunk-AYW7J6K4.js} +130 -200
- package/dist/{chunk-DXK3VTVP.js → chunk-E3OBGRHN.js} +1 -1
- package/dist/{chunk-7UF37LNL.js → chunk-EENQGEIP.js} +1 -1
- package/dist/{chunk-HRTW7FFX.js → chunk-FJMTMGBC.js} +1 -1
- package/dist/{chunk-H6MPFFBE.js → chunk-G2B2XZQW.js} +1 -1
- package/dist/{chunk-4GOZBB22.js → chunk-HUK5XIZL.js} +63 -7
- package/dist/{chunk-DINF4LMR.js → chunk-IO6KFXYE.js} +160 -97
- package/dist/{chunk-KH2SL2HT.js → chunk-KTXOGLNE.js} +2 -2
- package/dist/{chunk-S63LNPIV.js → chunk-LMNMMESF.js} +2 -2
- package/dist/{chunk-2CZ63QCL.js → chunk-LZBPGX5A.js} +1 -1
- package/dist/{chunk-PJ7EGFME.js → chunk-PLZT45VC.js} +5 -5
- package/dist/{chunk-ZQQWJMHE.js → chunk-QI5JW5AG.js} +6 -6
- package/dist/{chunk-IWRPJ3J5.js → chunk-QZV76CM4.js} +58 -32
- package/dist/{chunk-YFJDRORU.js → chunk-R767Y7QV.js} +202 -90
- package/dist/{chunk-4OSVTPYQ.js → chunk-SQHFVIMZ.js} +1 -1
- package/dist/{chunk-J4ID4ZI6.js → chunk-T5MTGX2E.js} +19 -19
- package/dist/{chunk-NRF23QZ4.js → chunk-V64JCZUV.js} +3 -3
- package/dist/{chunk-GITIZ6TZ.js → chunk-VOV3SCM3.js} +1 -1
- package/dist/{chunk-S5X2VQOD.js → chunk-W46NIB5H.js} +3 -2
- package/dist/{chunk-XL3C4NAR.js → chunk-W5JMPEBO.js} +9 -9
- package/dist/{chunk-HPFHC7YR.js → chunk-WOKJRLM2.js} +5 -5
- package/dist/chunk-WVIA7V3M.js +975 -0
- package/dist/{chunk-QA6RE6IB.js → chunk-X52ESOBP.js} +3 -3
- package/dist/cli/chat.js +35 -37
- package/dist/cli/check.js +5 -5
- package/dist/cli/plugins.js +12 -12
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +6 -6
- package/dist/db/schema/code.d.ts +367 -0
- package/dist/db/schema.d.ts +367 -1
- package/dist/{db-4PXTD3OH.js → db-K2VMNLHQ.js} +6 -6
- package/dist/{experimental-SIJSRDJD.js → experimental-P5FZM4CU.js} +1 -1
- package/dist/instrumentation.js +3 -3
- package/dist/nitro.js +6 -6
- package/dist/{oauth-callback-server-TQWNEVR6.js → oauth-callback-server-DZZMTKSS.js} +26 -26
- package/dist/{runner-G5HLQA43.js → runner-IIAKWDXI.js} +18 -18
- package/dist/{skills-BNNNRYNT.js → skills-EXIQ7BP5.js} +5 -5
- package/dist/spawn-ZR6OOEAN.js +37 -0
- package/dist/task-runner-C52HYCVD.js +32 -0
- package/dist/{validation-IJSBB6JR.js → validation-XUGIWBJF.js} +5 -5
- package/dist/version.js +1 -1
- package/dist/{work-5FQI4P2A.js → work-G4RLJ634.js} +18 -18
- package/dist/worker-R2JEHK67.js +22 -0
- package/migrations/0036_complex_rage.sql +32 -0
- package/migrations/meta/0036_snapshot.json +3186 -0
- package/migrations/meta/_journal.json +8 -1
- package/package.json +6 -5
- package/dist/api/acp/route.d.ts +0 -13
- package/dist/chunk-CZYNWPWD.js +0 -930
- package/dist/spawn-U2RKOFP2.js +0 -37
- package/dist/task-runner-CDZJBEXP.js +0 -32
- package/dist/worker-KJ362GVB.js +0 -22
|
@@ -5,8 +5,10 @@ import {
|
|
|
5
5
|
getConversationEventStore,
|
|
6
6
|
getDb,
|
|
7
7
|
getSqlExecutor
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AX3UDIMA.js";
|
|
9
9
|
import {
|
|
10
|
+
juniorCodeChanges,
|
|
11
|
+
juniorCodeRepositories,
|
|
10
12
|
juniorConversationAnnotations,
|
|
11
13
|
juniorConversationEvents,
|
|
12
14
|
juniorIdentities,
|
|
@@ -14,7 +16,7 @@ import {
|
|
|
14
16
|
juniorUsers,
|
|
15
17
|
juniorWorkspaceRepos,
|
|
16
18
|
juniorWorkspaces
|
|
17
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-6UXDTPEN.js";
|
|
18
20
|
import {
|
|
19
21
|
SANDBOX_WORKSPACE_ROOT,
|
|
20
22
|
getVercelSandboxCredentials,
|
|
@@ -22,17 +24,17 @@ import {
|
|
|
22
24
|
isSandboxMissingError,
|
|
23
25
|
runNonInteractiveCommand,
|
|
24
26
|
sleep
|
|
25
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-X52ESOBP.js";
|
|
26
28
|
import {
|
|
27
29
|
getStateAdapter
|
|
28
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-G2B2XZQW.js";
|
|
29
31
|
import {
|
|
30
32
|
botConfig,
|
|
31
33
|
completeObject,
|
|
32
34
|
defaultModelId,
|
|
33
35
|
embedTexts,
|
|
34
36
|
getSlackBotToken
|
|
35
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-LMNMMESF.js";
|
|
36
38
|
import {
|
|
37
39
|
isActorUserId,
|
|
38
40
|
parseActorUserId,
|
|
@@ -48,7 +50,7 @@ import {
|
|
|
48
50
|
setSpanAttributes,
|
|
49
51
|
setSpanStatus,
|
|
50
52
|
withSpan
|
|
51
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-LZBPGX5A.js";
|
|
52
54
|
|
|
53
55
|
// src/chat/plugins/agent-hooks.ts
|
|
54
56
|
import {
|
|
@@ -902,7 +904,10 @@ function createResourceEventTeamIdResolver() {
|
|
|
902
904
|
import { createHash as createHash2 } from "crypto";
|
|
903
905
|
import {
|
|
904
906
|
destinationSchema,
|
|
905
|
-
|
|
907
|
+
resourceEventMatchSchema,
|
|
908
|
+
resourceEventMatches,
|
|
909
|
+
resourceEventTypeSchema,
|
|
910
|
+
stableResourceEventMatchKey
|
|
906
911
|
} from "@sentry/junior-plugin-api";
|
|
907
912
|
import { z as z2 } from "zod";
|
|
908
913
|
var RESOURCE_EVENT_PREFIX = "junior:resource_event_subscription:v3";
|
|
@@ -922,6 +927,7 @@ var subscriptionSchema = z2.object({
|
|
|
922
927
|
id: z2.string().min(1),
|
|
923
928
|
intent: z2.string().min(1),
|
|
924
929
|
label: z2.string().min(1),
|
|
930
|
+
match: resourceEventMatchSchema.optional(),
|
|
925
931
|
namespace: z2.string().min(1),
|
|
926
932
|
identifier: z2.string().min(1),
|
|
927
933
|
resourceType: z2.string().min(1),
|
|
@@ -1029,9 +1035,9 @@ async function readSubscriptionIdIndex(state, key) {
|
|
|
1029
1035
|
}
|
|
1030
1036
|
function buildSubscriptionId(input) {
|
|
1031
1037
|
const eventKey = [...new Set(input.events)].sort().join("\0");
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
)}`;
|
|
1038
|
+
const matchKey = stableResourceEventMatchKey(input.match);
|
|
1039
|
+
const material = matchKey ? `${input.teamId}\0${input.namespace}\0${input.identifier}\0${input.conversationId}\0${eventKey}\0${matchKey}` : `${input.teamId}\0${input.namespace}\0${input.identifier}\0${input.conversationId}\0${eventKey}`;
|
|
1040
|
+
return `resub_${digest(material)}`;
|
|
1035
1041
|
}
|
|
1036
1042
|
async function withIndexLock(state, key, callback) {
|
|
1037
1043
|
const lock = await state.acquireLock(indexLockKey(key), INDEX_LOCK_TTL_MS);
|
|
@@ -1082,7 +1088,7 @@ function activeAt(subscription, nowMs) {
|
|
|
1082
1088
|
return subscription.status === "active" && subscription.expiresAtMs > nowMs;
|
|
1083
1089
|
}
|
|
1084
1090
|
function matchesEvent(subscription, input) {
|
|
1085
|
-
return subscription.namespace === input.namespace && subscription.identifier === input.identifier && subscriptionTeamId(subscription.destination) === input.teamId && subscription.events.includes(input.eventType) && activeAt(subscription, input.nowMs);
|
|
1091
|
+
return subscription.namespace === input.namespace && subscription.identifier === input.identifier && subscriptionTeamId(subscription.destination) === input.teamId && subscription.events.includes(input.eventType) && activeAt(subscription, input.nowMs) && resourceEventMatches(subscription.match, input.data);
|
|
1086
1092
|
}
|
|
1087
1093
|
async function createResourceEventSubscription(input, options = {}) {
|
|
1088
1094
|
const state = options.state ?? getStateAdapter();
|
|
@@ -1097,9 +1103,11 @@ async function createResourceEventSubscription(input, options = {}) {
|
|
|
1097
1103
|
if (input.expiresAtMs <= nowMs) {
|
|
1098
1104
|
throw new Error("Resource event subscription expiry must be in the future");
|
|
1099
1105
|
}
|
|
1106
|
+
const match = input.match && Object.keys(input.match).length > 0 ? input.match : void 0;
|
|
1100
1107
|
const id = buildSubscriptionId({
|
|
1101
1108
|
conversationId: input.conversationId,
|
|
1102
1109
|
events,
|
|
1110
|
+
match,
|
|
1103
1111
|
namespace: input.namespace,
|
|
1104
1112
|
identifier: input.identifier,
|
|
1105
1113
|
teamId: subscriptionTeamId(input.destination)
|
|
@@ -1113,6 +1121,7 @@ async function createResourceEventSubscription(input, options = {}) {
|
|
|
1113
1121
|
id,
|
|
1114
1122
|
intent: input.intent,
|
|
1115
1123
|
label: input.label,
|
|
1124
|
+
...match ? { match } : void 0,
|
|
1116
1125
|
namespace: input.namespace,
|
|
1117
1126
|
identifier: input.identifier,
|
|
1118
1127
|
resourceType: input.resourceType,
|
|
@@ -1211,6 +1220,42 @@ async function cancelSubscriptions(input) {
|
|
|
1211
1220
|
});
|
|
1212
1221
|
}
|
|
1213
1222
|
}
|
|
1223
|
+
async function collectResourceEventMatchKeys(input) {
|
|
1224
|
+
const state = input.state ?? getStateAdapter();
|
|
1225
|
+
await state.connect();
|
|
1226
|
+
const nowMs = input.nowMs ?? Date.now();
|
|
1227
|
+
const eventTypes = new Set(
|
|
1228
|
+
input.eventTypes.map((eventType) => eventType.trim()).filter(Boolean)
|
|
1229
|
+
);
|
|
1230
|
+
if (eventTypes.size === 0) return [];
|
|
1231
|
+
const keys = /* @__PURE__ */ new Set();
|
|
1232
|
+
const identifiers = new Set(
|
|
1233
|
+
input.identifiers.map((value) => value.trim()).filter(Boolean)
|
|
1234
|
+
);
|
|
1235
|
+
for (const identifier of identifiers) {
|
|
1236
|
+
const ids = await readSubscriptionIdIndex(
|
|
1237
|
+
state,
|
|
1238
|
+
resourceIndexKey(input.teamId, input.namespace, identifier)
|
|
1239
|
+
);
|
|
1240
|
+
const records = await Promise.all(
|
|
1241
|
+
ids.map(
|
|
1242
|
+
async (id) => parseSubscription(await state.get(subscriptionKey(id)))
|
|
1243
|
+
)
|
|
1244
|
+
);
|
|
1245
|
+
for (const record of records) {
|
|
1246
|
+
if (!record) continue;
|
|
1247
|
+
if (record.namespace !== input.namespace) continue;
|
|
1248
|
+
if (record.identifier !== identifier) continue;
|
|
1249
|
+
if (subscriptionTeamId(record.destination) !== input.teamId) continue;
|
|
1250
|
+
if (!activeAt(record, nowMs)) continue;
|
|
1251
|
+
if (!record.events.some((eventType) => eventTypes.has(eventType))) continue;
|
|
1252
|
+
for (const key of Object.keys(record.match ?? {})) {
|
|
1253
|
+
keys.add(key);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
return [...keys].sort();
|
|
1258
|
+
}
|
|
1214
1259
|
async function findMatchingResourceEventSubscriptions(input) {
|
|
1215
1260
|
const state = input.state ?? getStateAdapter();
|
|
1216
1261
|
await state.connect();
|
|
@@ -1226,6 +1271,7 @@ async function findMatchingResourceEventSubscriptions(input) {
|
|
|
1226
1271
|
);
|
|
1227
1272
|
return records.filter(
|
|
1228
1273
|
(record) => record !== void 0 && matchesEvent(record, {
|
|
1274
|
+
data: input.data,
|
|
1229
1275
|
eventType: input.eventType,
|
|
1230
1276
|
nowMs,
|
|
1231
1277
|
namespace: input.namespace,
|
|
@@ -1246,6 +1292,7 @@ async function deliverResourceEventSubscription(input) {
|
|
|
1246
1292
|
await state.get(subscriptionKey(input.subscription.id))
|
|
1247
1293
|
);
|
|
1248
1294
|
if (!current || !matchesEvent(current, {
|
|
1295
|
+
data: input.data,
|
|
1249
1296
|
eventType: input.eventType,
|
|
1250
1297
|
nowMs,
|
|
1251
1298
|
namespace: input.namespace,
|
|
@@ -2169,6 +2216,113 @@ async function deleteWorkspace(id) {
|
|
|
2169
2216
|
return result.deleted;
|
|
2170
2217
|
}
|
|
2171
2218
|
|
|
2219
|
+
// src/chat/code/store.ts
|
|
2220
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
2221
|
+
import { and as and6, eq as eq6, lte, sql as sql3 } from "drizzle-orm";
|
|
2222
|
+
import {
|
|
2223
|
+
codeChangeInputSchema
|
|
2224
|
+
} from "@sentry/junior-plugin-api";
|
|
2225
|
+
async function recordCodeChange(db, provider, input) {
|
|
2226
|
+
const change = codeChangeInputSchema.parse(input);
|
|
2227
|
+
const repositories = await db.insert(juniorCodeRepositories).values({
|
|
2228
|
+
id: randomUUID3(),
|
|
2229
|
+
name: change.repository.name,
|
|
2230
|
+
provider,
|
|
2231
|
+
providerId: change.repository.providerId,
|
|
2232
|
+
url: change.repository.url,
|
|
2233
|
+
updatedAt: change.updatedAt
|
|
2234
|
+
}).onConflictDoUpdate({
|
|
2235
|
+
target: [
|
|
2236
|
+
juniorCodeRepositories.provider,
|
|
2237
|
+
juniorCodeRepositories.providerId
|
|
2238
|
+
],
|
|
2239
|
+
set: {
|
|
2240
|
+
name: change.repository.name,
|
|
2241
|
+
...change.repository.url ? { url: change.repository.url } : void 0,
|
|
2242
|
+
updatedAt: change.updatedAt
|
|
2243
|
+
},
|
|
2244
|
+
where: lte(juniorCodeRepositories.updatedAt, change.updatedAt)
|
|
2245
|
+
}).returning({ id: juniorCodeRepositories.id });
|
|
2246
|
+
const existingRepositories = repositories[0] ? [] : await db.select({ id: juniorCodeRepositories.id }).from(juniorCodeRepositories).where(
|
|
2247
|
+
and6(
|
|
2248
|
+
eq6(juniorCodeRepositories.provider, provider),
|
|
2249
|
+
eq6(juniorCodeRepositories.providerId, change.repository.providerId)
|
|
2250
|
+
)
|
|
2251
|
+
).limit(1);
|
|
2252
|
+
const repositoryId = repositories[0]?.id ?? existingRepositories[0]?.id;
|
|
2253
|
+
if (!repositoryId) {
|
|
2254
|
+
throw new Error("Code repository upsert returned no row");
|
|
2255
|
+
}
|
|
2256
|
+
const conversationIds = sql3.join(
|
|
2257
|
+
change.conversationIds.map((conversationId) => sql3`${conversationId}`),
|
|
2258
|
+
sql3`, `
|
|
2259
|
+
);
|
|
2260
|
+
const values = {
|
|
2261
|
+
closedAt: change.closedAt ?? null,
|
|
2262
|
+
conversationIds: change.conversationIds.length > 0 ? sql3`ARRAY(
|
|
2263
|
+
SELECT DISTINCT value
|
|
2264
|
+
FROM unnest(
|
|
2265
|
+
${juniorCodeChanges.conversationIds}
|
|
2266
|
+
|| ARRAY[${conversationIds}]::text[]
|
|
2267
|
+
) AS value
|
|
2268
|
+
ORDER BY value
|
|
2269
|
+
)` : juniorCodeChanges.conversationIds,
|
|
2270
|
+
mergedAt: change.mergedAt ?? null,
|
|
2271
|
+
number: change.number,
|
|
2272
|
+
openedAt: change.openedAt,
|
|
2273
|
+
repositoryId,
|
|
2274
|
+
state: change.state,
|
|
2275
|
+
...change.title ? { title: change.title } : void 0,
|
|
2276
|
+
updatedAt: change.updatedAt,
|
|
2277
|
+
url: change.url ?? null
|
|
2278
|
+
};
|
|
2279
|
+
await db.insert(juniorCodeChanges).values({
|
|
2280
|
+
...values,
|
|
2281
|
+
conversationIds: change.conversationIds,
|
|
2282
|
+
id: randomUUID3(),
|
|
2283
|
+
provider,
|
|
2284
|
+
providerId: change.providerId
|
|
2285
|
+
}).onConflictDoUpdate({
|
|
2286
|
+
target: [juniorCodeChanges.provider, juniorCodeChanges.providerId],
|
|
2287
|
+
set: values,
|
|
2288
|
+
where: lte(juniorCodeChanges.updatedAt, change.updatedAt)
|
|
2289
|
+
});
|
|
2290
|
+
}
|
|
2291
|
+
async function associateCodeChangeConversations(db, provider, input) {
|
|
2292
|
+
if (input.conversationIds.length === 0) return;
|
|
2293
|
+
const conversationIds = sql3.join(
|
|
2294
|
+
input.conversationIds.map((conversationId) => sql3`${conversationId}`),
|
|
2295
|
+
sql3`, `
|
|
2296
|
+
);
|
|
2297
|
+
await db.update(juniorCodeChanges).set({
|
|
2298
|
+
conversationIds: sql3`ARRAY(
|
|
2299
|
+
SELECT DISTINCT value
|
|
2300
|
+
FROM unnest(
|
|
2301
|
+
${juniorCodeChanges.conversationIds}
|
|
2302
|
+
|| ARRAY[${conversationIds}]::text[]
|
|
2303
|
+
) AS value
|
|
2304
|
+
ORDER BY value
|
|
2305
|
+
)`
|
|
2306
|
+
}).where(
|
|
2307
|
+
and6(
|
|
2308
|
+
eq6(juniorCodeChanges.provider, provider),
|
|
2309
|
+
eq6(juniorCodeChanges.providerId, input.providerId)
|
|
2310
|
+
)
|
|
2311
|
+
);
|
|
2312
|
+
}
|
|
2313
|
+
|
|
2314
|
+
// src/chat/code/publisher.ts
|
|
2315
|
+
function createCodeChangePublisher(provider) {
|
|
2316
|
+
return {
|
|
2317
|
+
async associateConversations(input) {
|
|
2318
|
+
await associateCodeChangeConversations(getDb(), provider, input);
|
|
2319
|
+
},
|
|
2320
|
+
async record(input) {
|
|
2321
|
+
await recordCodeChange(getDb(), provider, input);
|
|
2322
|
+
}
|
|
2323
|
+
};
|
|
2324
|
+
}
|
|
2325
|
+
|
|
2172
2326
|
// src/chat/plugins/agent-hooks.ts
|
|
2173
2327
|
var PluginHookDeniedError = class extends Error {
|
|
2174
2328
|
constructor(message) {
|
|
@@ -2781,7 +2935,29 @@ function getPluginRoutes(options) {
|
|
|
2781
2935
|
plugin: pluginName
|
|
2782
2936
|
})
|
|
2783
2937
|
},
|
|
2938
|
+
codeChanges: createCodeChangePublisher(pluginName),
|
|
2784
2939
|
resourceEvents: {
|
|
2940
|
+
async neededMatchKeys(input) {
|
|
2941
|
+
if (!options.resourceEvents.neededMatchKeys) return [];
|
|
2942
|
+
const identifiers = [
|
|
2943
|
+
...new Set(
|
|
2944
|
+
input.identifiers.map(
|
|
2945
|
+
(identifier) => normalizeResourceEventIdentifier(
|
|
2946
|
+
plugin.resourceEvents,
|
|
2947
|
+
identifier
|
|
2948
|
+
)
|
|
2949
|
+
).filter(Boolean)
|
|
2950
|
+
)
|
|
2951
|
+
];
|
|
2952
|
+
if (identifiers.length === 0 || input.eventTypes.length === 0) {
|
|
2953
|
+
return [];
|
|
2954
|
+
}
|
|
2955
|
+
return await options.resourceEvents.neededMatchKeys({
|
|
2956
|
+
eventTypes: input.eventTypes,
|
|
2957
|
+
identifiers,
|
|
2958
|
+
namespace: pluginName
|
|
2959
|
+
});
|
|
2960
|
+
},
|
|
2785
2961
|
async publish(event) {
|
|
2786
2962
|
const parsed = resourceEventInputSchema.parse(event);
|
|
2787
2963
|
requirePublishedResourceEvent(plugin, parsed.eventType);
|
|
@@ -3429,6 +3605,7 @@ export {
|
|
|
3429
3605
|
listResourceEventSubscriptions,
|
|
3430
3606
|
cancelResourceEventSubscription,
|
|
3431
3607
|
cancelSubscriptions,
|
|
3608
|
+
collectResourceEventMatchKeys,
|
|
3432
3609
|
findMatchingResourceEventSubscriptions,
|
|
3433
3610
|
deliverResourceEventSubscription,
|
|
3434
3611
|
RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
juniorConversations,
|
|
9
9
|
juniorIdentities,
|
|
10
10
|
juniorUsers
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-6UXDTPEN.js";
|
|
12
12
|
import {
|
|
13
13
|
juniorDestinations
|
|
14
14
|
} from "./chunk-VFUK3X5B.js";
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
TURN_REASONING_LEVELS,
|
|
17
17
|
getChatConfig,
|
|
18
18
|
modelProfileSchema
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-LMNMMESF.js";
|
|
20
20
|
import {
|
|
21
21
|
parseActorUserId,
|
|
22
22
|
parseSlackChannelReferenceId,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
} from "./chunk-N7TMSOZH.js";
|
|
25
25
|
import {
|
|
26
26
|
normalizeIdentityEmail
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-LZBPGX5A.js";
|
|
28
28
|
|
|
29
29
|
// src/chat/conversations/sql/store.ts
|
|
30
30
|
import { randomUUID as randomUUID2 } from "crypto";
|