@sentry/junior 0.306.0 → 0.307.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/{adapter-context-CnY-i32r.js → adapter-context-HrBTD8rJ.js} +2 -2
- package/dist/{admin-BLLdLnXh.js → admin-B78_KmfR.js} +2 -2
- package/dist/{agent-runner-BaLjEjPR.js → agent-runner-DxivxUYd.js} +226 -137
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +4 -4
- package/dist/api.d.ts +1 -1
- package/dist/api.js +328 -298
- package/dist/{app-DvYbM9UD.d.ts → app-EZur8cVC.d.ts} +12 -3
- package/dist/app.d.ts +2 -2
- package/dist/app.js +84 -44
- package/dist/background-compaction-queue-HlljT9ql.js +231 -0
- package/dist/{briefs-DvyzXfrF.js → briefs-DR8mp-TK.js} +2 -2
- package/dist/{catalog-runtime-B1R-nHd3.js → catalog-runtime-Se9idiDR.js} +1 -1
- package/dist/cli/chat.d.ts +1 -1
- package/dist/cli/chat.js +17 -16
- package/dist/cli/check.js +58 -48
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.d.ts +1 -1
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +5 -5
- package/dist/cli/upgrade.d.ts +2 -2
- package/dist/cli/upgrade.js +3 -8
- package/dist/{config-DUD-zMvp.js → config-DY5c1E0l.js} +74 -38
- package/dist/{connections-CDhsqPcC.js → connections-C-SqzubG.js} +10 -8
- package/dist/{continue-in-slack-BXQizz9o.js → continue-in-slack-DNkrrWuQ.js} +5 -5
- package/dist/{conversation-privacy-YE54gMN8.js → conversation-privacy-CVj9vSrP.js} +1 -1
- package/dist/{conversation-turn-BzdmrHb0.js → conversation-turn-CkzrIfJ2.js} +19 -47
- package/dist/{credential-sync-Cdm-e1vJ.js → credential-sync-B9CIkgOT.js} +28 -28
- package/dist/{db-DV2ZUb1Y.js → db-C21CyyTE.js} +140 -11
- package/dist/{db-pH357Dkt.d.ts → db-C41UgdBj.d.ts} +1 -1
- package/dist/{executor-CjNhwwnj.js → executor-DfNoVVGd.js} +93 -32
- package/dist/{install-DbD7C5td.js → install-lYZs8UCL.js} +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{lineage-BFdIPb3o.js → lineage-BJTSY53A.js} +2 -2
- package/dist/{logging-oYpJYr-S.js → logging-DjW7LjgJ.js} +1 -1
- package/dist/{message-BBPcMKJY.js → message-BPPZpdoZ.js} +8 -8
- package/dist/{model-input-DYYF3a8B.js → model-input-DKqiLFGa.js} +3 -3
- package/dist/nitro.d.ts +2 -2
- package/dist/nitro.js +12 -5
- package/dist/{oauth-callback-server-C7Q987su.js → oauth-callback-server-OJP8Y4Ca.js} +2 -2
- package/dist/{oauth-relay-DAmfVmJu.js → oauth-relay-KwDz41Z3.js} +1 -1
- package/dist/{plugins-B_0Cr0MO.d.ts → plugins-fBrz8PCV.d.ts} +2 -0
- package/dist/{projection-CWXDE0f6.js → projection-D47mlszd.js} +1112 -693
- package/dist/{prompt-P3eRqO8C.js → prompt-DuWH_YIb.js} +3 -3
- package/dist/{registry-1pzXmplY.js → registry-yht0oxq6.js} +19 -9
- package/dist/{resolve-n87oXY-d.js → resolve-gZ-hVMYl.js} +3 -3
- package/dist/{result-BmF9v9bv.js → result-CP99Ok0_.js} +13 -11
- package/dist/{runner-4j7ZsxP5.js → runner-eVlnUkY7.js} +9 -9
- package/dist/{sandbox-egress-signals-BRQI8HvT.js → sandbox-egress-signals-DZL_0lnG.js} +1 -1
- package/dist/{schedule-CHPWQn-x.js → schedule-BG1tEbRF.js} +34 -4
- package/dist/{schema-CVbIjrF3.d.ts → schema-CRXcj4fj.d.ts} +350 -143
- package/dist/{schema-D7iIEh6t.js → schema-D4jdesIu.js} +12 -4
- package/dist/{service-account-DzQiOmqa.js → service-account-CZneZHh7.js} +8 -6
- package/dist/{service-account-BDQ9xzta.js → service-account-tI3LBg2_.js} +3 -3
- package/dist/{session-stop-BQxgHR4X.js → session-stop-D3S7mSkX.js} +36 -23
- package/dist/{skills-CPf4vNuC.js → skills-Bm6uSO9V.js} +32 -28
- package/dist/{slack-conversation-unfurl-B1KEptUg.js → slack-conversation-unfurl-BeBvg3xU.js} +10 -10
- package/dist/{spawn-CjGddiAU.js → spawn-vhMAmLuh.js} +6 -6
- package/dist/{state-9wfj6aSD.js → state-3Yiy2FvP.js} +4 -4
- package/dist/{stop-CsQGuN5n.js → stop-Bh53GUoX.js} +146 -158
- package/dist/{store-Dz3YZ7gQ.js → store-BZJdHYR7.js} +5 -5
- package/dist/{background-compaction-queue-D2wzxtGU.js → task-queue-BEl5G38v.js} +164 -180
- package/dist/{task-runner-frzlUvFD.js → task-runner-C6Bujc6h.js} +11 -8
- package/dist/{thread-context-C4QuZlM8.js → thread-context-DxMQGGd_.js} +6 -6
- package/dist/{turn-session-routing-BXaubz2w.js → turn-session-routing-CmQY0T60.js} +24 -5
- package/dist/{turn-user-message-DNC0eRZ7.js → turn-user-message-Dfbr3Ud9.js} +3 -3
- package/dist/{users-XCCKn3xW.js → users-6rSdqXXk.js} +1 -1
- package/dist/{validation-L5fdjmFX.js → validation--hsjOLRL.js} +1 -1
- package/dist/{version-BFmuwgxP.js → version-9iMT25Hq.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-DKOeHpv3.js → viewer-De1vmuEA.js} +3 -3
- package/dist/{warmup-mTMIatCV.js → warmup-C0IblNtf.js} +596 -281
- package/dist/{web-message-id-CUaSiGme.js → web-message-id-BT8Mg8LL.js} +1 -1
- package/dist/{worker-Bz4KNxjI.js → worker-CiyRr2q7.js} +8 -7
- package/migrations/0115_automation_creator_slack_index.sql +1 -0
- package/migrations/0116_conversation_event_search.sql +25 -0
- package/migrations/0117_automation_last_run.sql +46 -0
- package/migrations/0118_automation_last_run_index.sql +1 -0
- package/migrations/0119_money_micro_usd.sql +29 -0
- package/migrations/0120_conversation_cost_micro_usd.sql +8 -0
- package/migrations/meta/0115_snapshot.json +5225 -0
- package/migrations/meta/0116_snapshot.json +5388 -0
- package/migrations/meta/0117_snapshot.json +5413 -0
- package/migrations/meta/0118_snapshot.json +5428 -0
- package/migrations/meta/0119_snapshot.json +5441 -0
- package/migrations/meta/0120_snapshot.json +5441 -0
- package/migrations/meta/_journal.json +42 -0
- package/package.json +10 -9
- package/dist/queue-7FSijgqG.js +0 -115
- package/dist/secrets-DHaJ5TTn.js +0 -18
- package/dist/task-queue-CFlrJguF.js +0 -89
package/dist/cli/chat.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as loadAppPluginSet } from "../plugin-module-Cv2ETe8Y.js";
|
|
2
|
-
import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-
|
|
2
|
+
import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-DxivxUYd.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
5
5
|
import { stderr, stdin, stdout } from "node:process";
|
|
@@ -99,10 +99,10 @@ async function loadLocalPluginSet() {
|
|
|
99
99
|
async function configureLocalChatPlugins(pluginSet) {
|
|
100
100
|
const [pluginsModule, agentHooksModule, catalogRuntimeModule, validationModule, databaseModule] = await Promise.all([
|
|
101
101
|
import("../plugins-Bkk0XRo2.js").then((n) => n.o),
|
|
102
|
-
import("../projection-
|
|
103
|
-
import("../catalog-runtime-
|
|
104
|
-
import("../validation
|
|
105
|
-
import("../db-
|
|
102
|
+
import("../projection-D47mlszd.js").then((n) => n.Cn),
|
|
103
|
+
import("../catalog-runtime-Se9idiDR.js").then((n) => n.t),
|
|
104
|
+
import("../validation--hsjOLRL.js").then((n) => n.r),
|
|
105
|
+
import("../db-C21CyyTE.js").then((n) => n.n)
|
|
106
106
|
]);
|
|
107
107
|
const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
|
|
108
108
|
const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
|
|
@@ -152,19 +152,20 @@ function localDevServerUrl() {
|
|
|
152
152
|
async function prepareLocalChatRun(io, pluginSet) {
|
|
153
153
|
defaultStateAdapterForLocalChat();
|
|
154
154
|
await configureLocalChatPlugins(pluginSet);
|
|
155
|
-
const { setBriefsConfig } = await import("../projection-
|
|
155
|
+
const { setBriefsConfig, setEventEmbeddingsConfig } = await import("../projection-D47mlszd.js").then((n) => n.Bn);
|
|
156
156
|
setBriefsConfig({ enabled: true });
|
|
157
|
-
|
|
158
|
-
const {
|
|
159
|
-
const {
|
|
160
|
-
const {
|
|
161
|
-
const {
|
|
162
|
-
const {
|
|
163
|
-
const {
|
|
164
|
-
const {
|
|
165
|
-
const {
|
|
157
|
+
setEventEmbeddingsConfig({ enabled: true });
|
|
158
|
+
const { runLocalAgentTurn } = await import("../runner-eVlnUkY7.js");
|
|
159
|
+
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-OJP8Y4Ca.js");
|
|
160
|
+
const { createLocalOAuthState } = await import("../oauth-relay-KwDz41Z3.js").then((n) => n.t);
|
|
161
|
+
const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-DZL_0lnG.js");
|
|
162
|
+
const { bindSpawnAgent } = await import("../spawn-vhMAmLuh.js").then((n) => n.n);
|
|
163
|
+
const { bindMessageAgent } = await import("../message-BPPZpdoZ.js").then((n) => n.n);
|
|
164
|
+
const { createChildConversationWorker, createDeliverToParent } = await import("../result-CP99Ok0_.js").then((n) => n.o);
|
|
165
|
+
const { createConversationTurnWorker } = await import("../conversation-turn-CkzrIfJ2.js").then((n) => n.t);
|
|
166
|
+
const { skipInputAfterConversationStop } = await import("../session-stop-D3S7mSkX.js").then((n) => n.a);
|
|
166
167
|
const { createLocalConversationWork } = await import("../conversation-work-BaT_T6EB.js");
|
|
167
|
-
const { processConversationWork } = await import("../worker-
|
|
168
|
+
const { processConversationWork } = await import("../worker-CiyRr2q7.js").then((n) => n.n);
|
|
168
169
|
let agentRunner;
|
|
169
170
|
const localConversationWork = createLocalConversationWork(async (message) => {
|
|
170
171
|
if (!agentRunner) throw new Error("Local agent runner is not ready");
|
package/dist/cli/check.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { i as parseSkillFile } from "../skills-
|
|
2
|
-
import { N as JUNIOR_HEARTBEAT_ROUTE, R as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-
|
|
3
|
-
import {
|
|
1
|
+
import { i as parseSkillFile } from "../skills-Bm6uSO9V.js";
|
|
2
|
+
import { N as JUNIOR_HEARTBEAT_ROUTE, R as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-DjW7LjgJ.js";
|
|
3
|
+
import { b as parsePluginManifest, y as parseInlinePluginManifest } from "../registry-yht0oxq6.js";
|
|
4
|
+
import pLimit from "p-limit";
|
|
4
5
|
import path from "node:path";
|
|
5
6
|
import fs from "node:fs/promises";
|
|
6
7
|
import { pathToFileURL } from "node:url";
|
|
@@ -94,12 +95,16 @@ async function collectPackageWarnings(rootDir, packages) {
|
|
|
94
95
|
const packageSpecByName = new Map(packages.map((declaredPackage) => [declaredPackage.name, declaredPackage.spec]));
|
|
95
96
|
const coreVersion = comparableVersion(await readInstalledPackageVersion(rootDir, "@sentry/junior") ?? packageSpecByName.get("@sentry/junior"));
|
|
96
97
|
if (!coreVersion) return warnings;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (!await packageHasPluginContent(rootDir, declaredPackage.name))
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
const limit = pLimit(8);
|
|
99
|
+
const pluginVersions = await Promise.all(packages.filter((declaredPackage) => declaredPackage.name.startsWith("@sentry/junior-")).map((declaredPackage) => limit(async () => {
|
|
100
|
+
if (!await packageHasPluginContent(rootDir, declaredPackage.name)) return;
|
|
101
|
+
const version = comparableVersion(await readInstalledPackageVersion(rootDir, declaredPackage.name) ?? declaredPackage.spec);
|
|
102
|
+
return {
|
|
103
|
+
name: declaredPackage.name,
|
|
104
|
+
version
|
|
105
|
+
};
|
|
106
|
+
})));
|
|
107
|
+
for (const plugin of pluginVersions) if (plugin?.version && plugin.version !== coreVersion) warnings.push(`${path.join(rootDir, "package.json")}: ${plugin.name} version ${plugin.version} does not match @sentry/junior version ${coreVersion}`);
|
|
103
108
|
return warnings;
|
|
104
109
|
}
|
|
105
110
|
async function validateSkillDirectory(skillDir, duplicateNames) {
|
|
@@ -210,25 +215,33 @@ function isPluginRegistrationLike(value) {
|
|
|
210
215
|
return isRecord(value) && isRecord(value["manifest"]);
|
|
211
216
|
}
|
|
212
217
|
async function collectPackageJsPluginSources(packageDir, packageName) {
|
|
218
|
+
if (packageName === "@sentry/junior") return [];
|
|
213
219
|
const entryPath = await resolvePackageEntryPath(packageDir);
|
|
214
220
|
if (!entryPath) return [];
|
|
221
|
+
const errorSource = (manifestPath, error) => ({
|
|
222
|
+
pluginDir: packageDir,
|
|
223
|
+
packageName,
|
|
224
|
+
manifestPath,
|
|
225
|
+
errors: [`${manifestPath}: ${error instanceof Error ? error.message : String(error)}`]
|
|
226
|
+
});
|
|
215
227
|
let moduleExports;
|
|
216
228
|
try {
|
|
217
229
|
moduleExports = await import(pathToFileURL(entryPath).href);
|
|
218
|
-
} catch {
|
|
219
|
-
return [];
|
|
230
|
+
} catch (error) {
|
|
231
|
+
return [errorSource(entryPath, error)];
|
|
220
232
|
}
|
|
221
233
|
const pluginSources = [];
|
|
222
234
|
for (const [exportName, exportedValue] of Object.entries(moduleExports).sort(([left], [right]) => left.localeCompare(right))) {
|
|
223
235
|
if (!isPluginFactoryExport(exportName, exportedValue)) continue;
|
|
236
|
+
const manifestPath = `${entryPath}#${exportName}`;
|
|
224
237
|
let registration;
|
|
225
238
|
try {
|
|
226
239
|
registration = await exportedValue();
|
|
227
|
-
} catch {
|
|
240
|
+
} catch (error) {
|
|
241
|
+
pluginSources.push(errorSource(manifestPath, error));
|
|
228
242
|
continue;
|
|
229
243
|
}
|
|
230
244
|
if (!isPluginRegistrationLike(registration)) continue;
|
|
231
|
-
const manifestPath = `${entryPath}#${exportName}`;
|
|
232
245
|
try {
|
|
233
246
|
pluginSources.push({
|
|
234
247
|
pluginDir: packageDir,
|
|
@@ -237,12 +250,7 @@ async function collectPackageJsPluginSources(packageDir, packageName) {
|
|
|
237
250
|
manifest: parseInlinePluginManifest(registration.manifest, packageDir)
|
|
238
251
|
});
|
|
239
252
|
} catch (error) {
|
|
240
|
-
pluginSources.push(
|
|
241
|
-
pluginDir: packageDir,
|
|
242
|
-
packageName,
|
|
243
|
-
manifestPath,
|
|
244
|
-
errors: [`${manifestPath}: ${error instanceof Error ? error.message : String(error)}`]
|
|
245
|
-
});
|
|
253
|
+
pluginSources.push(errorSource(manifestPath, error));
|
|
246
254
|
}
|
|
247
255
|
}
|
|
248
256
|
return pluginSources;
|
|
@@ -255,30 +263,30 @@ async function collectPluginDirectories(rootDir) {
|
|
|
255
263
|
} catch {
|
|
256
264
|
return pluginDirs;
|
|
257
265
|
}
|
|
258
|
-
|
|
259
|
-
|
|
266
|
+
const limit = pLimit(8);
|
|
267
|
+
await Promise.all(entries.filter((entry) => entry.isDirectory()).map((entry) => limit(async () => {
|
|
260
268
|
const pluginDir = path.join(contentRoot(rootDir, "plugins"), entry.name);
|
|
261
269
|
if (await pathIsFile(path.join(pluginDir, "plugin.yaml"))) pluginDirs.push(pluginDir);
|
|
262
|
-
}
|
|
270
|
+
})));
|
|
263
271
|
return pluginDirs.sort((left, right) => left.localeCompare(right));
|
|
264
272
|
}
|
|
265
273
|
async function collectPackagedContent(rootDir, packages) {
|
|
266
274
|
const pluginSources = [];
|
|
267
275
|
const skillRoots = [];
|
|
268
|
-
|
|
276
|
+
const limit = pLimit(8);
|
|
277
|
+
await Promise.all(packages.map(async (declaredPackage) => {
|
|
269
278
|
const packageDir = packageInstallDir(rootDir, declaredPackage.name);
|
|
270
|
-
if (!await pathIsDirectory(packageDir))
|
|
279
|
+
if (!await limit(() => pathIsDirectory(packageDir))) return;
|
|
271
280
|
const rootManifestPath = path.join(packageDir, "plugin.yaml");
|
|
272
|
-
const hasRootManifest = await pathIsFile(rootManifestPath);
|
|
273
281
|
const packageSkillsRoot = path.join(packageDir, "skills");
|
|
274
|
-
const hasPackageSkills = await pathIsDirectory(packageSkillsRoot);
|
|
282
|
+
const [hasRootManifest, hasPackageSkills] = await Promise.all([limit(() => pathIsFile(rootManifestPath)), limit(() => pathIsDirectory(packageSkillsRoot))]);
|
|
275
283
|
if (hasRootManifest) pluginSources.push({
|
|
276
284
|
pluginDir: packageDir,
|
|
277
285
|
manifestPath: rootManifestPath,
|
|
278
286
|
packageName: declaredPackage.name
|
|
279
287
|
});
|
|
280
288
|
else if (hasPackageSkills) {
|
|
281
|
-
const jsPluginSources = await collectPackageJsPluginSources(packageDir, declaredPackage.name);
|
|
289
|
+
const jsPluginSources = await limit(() => collectPackageJsPluginSources(packageDir, declaredPackage.name));
|
|
282
290
|
if (jsPluginSources.length > 0) pluginSources.push(...jsPluginSources);
|
|
283
291
|
else skillRoots.push({
|
|
284
292
|
root: packageSkillsRoot,
|
|
@@ -288,20 +296,20 @@ async function collectPackagedContent(rootDir, packages) {
|
|
|
288
296
|
const nestedPluginsRoot = path.join(packageDir, "plugins");
|
|
289
297
|
let nestedEntries;
|
|
290
298
|
try {
|
|
291
|
-
nestedEntries = await fs.readdir(nestedPluginsRoot, { withFileTypes: true });
|
|
299
|
+
nestedEntries = await limit(() => fs.readdir(nestedPluginsRoot, { withFileTypes: true }));
|
|
292
300
|
} catch {
|
|
293
|
-
|
|
301
|
+
return;
|
|
294
302
|
}
|
|
295
|
-
|
|
296
|
-
if (!entry.isDirectory()) continue;
|
|
303
|
+
await Promise.all(nestedEntries.filter((entry) => entry.isDirectory()).map(async (entry) => {
|
|
297
304
|
const pluginDir = path.join(nestedPluginsRoot, entry.name);
|
|
298
|
-
|
|
305
|
+
const manifestPath = path.join(pluginDir, "plugin.yaml");
|
|
306
|
+
if (await limit(() => pathIsFile(manifestPath))) pluginSources.push({
|
|
299
307
|
pluginDir,
|
|
300
|
-
manifestPath
|
|
308
|
+
manifestPath,
|
|
301
309
|
packageName: declaredPackage.name
|
|
302
310
|
});
|
|
303
|
-
}
|
|
304
|
-
}
|
|
311
|
+
}));
|
|
312
|
+
}));
|
|
305
313
|
return {
|
|
306
314
|
pluginSources: pluginSources.sort((left, right) => `${left.packageName}:${left.pluginDir}`.localeCompare(`${right.packageName}:${right.pluginDir}`)),
|
|
307
315
|
skillRoots: skillRoots.sort((left, right) => `${left.packageName}:${left.root}`.localeCompare(`${right.packageName}:${right.root}`))
|
|
@@ -434,18 +442,24 @@ async function validateDeploymentConfig(rootDir, packages) {
|
|
|
434
442
|
async function validateAppSourceFiles(rootDir, registeredConfigKeys) {
|
|
435
443
|
const errors = [];
|
|
436
444
|
const warnings = [];
|
|
437
|
-
|
|
445
|
+
const sources = await Promise.all([
|
|
438
446
|
"server.ts",
|
|
439
447
|
"server.js",
|
|
440
448
|
"nitro.config.ts"
|
|
441
|
-
]) {
|
|
449
|
+
].map(async (fileName) => {
|
|
442
450
|
const sourcePath = path.join(rootDir, fileName);
|
|
443
|
-
let source;
|
|
444
451
|
try {
|
|
445
|
-
|
|
452
|
+
return {
|
|
453
|
+
sourcePath,
|
|
454
|
+
source: await fs.readFile(sourcePath, "utf8")
|
|
455
|
+
};
|
|
446
456
|
} catch {
|
|
447
|
-
|
|
457
|
+
return;
|
|
448
458
|
}
|
|
459
|
+
}));
|
|
460
|
+
for (const file of sources) {
|
|
461
|
+
if (!file) continue;
|
|
462
|
+
const { source, sourcePath } = file;
|
|
449
463
|
if (/\bpluginPackages\s*:/.test(source)) errors.push(`${sourcePath}: pluginPackages is no longer supported. Export a defineJuniorPlugins(...) set and point juniorNitro({ plugins: "./plugins" }) at it.`);
|
|
450
464
|
if (/\bplugins\s*:\s*\{\s*packages\s*:/.test(source)) errors.push(`${sourcePath}: plugins.packages is no longer supported. Export a defineJuniorPlugins(...) set and point juniorNitro({ plugins: "./plugins" }) at it.`);
|
|
451
465
|
for (const defaultsBlock of source.matchAll(/\bconfigDefaults\s*:\s*\{([\s\S]*?)\}/g)) {
|
|
@@ -474,14 +488,12 @@ async function validateAppFiles(appDir) {
|
|
|
474
488
|
};
|
|
475
489
|
}
|
|
476
490
|
async function hasJuniorAppMarkers(appDir) {
|
|
477
|
-
|
|
491
|
+
return (await Promise.all([...[
|
|
478
492
|
"SOUL.md",
|
|
479
493
|
"WORLD.md",
|
|
480
494
|
"DESCRIPTION.md",
|
|
481
495
|
"ABOUT.md"
|
|
482
|
-
])
|
|
483
|
-
for (const dirName of ["skills", "plugins"]) if (await pathIsDirectory(path.join(appDir, dirName))) return true;
|
|
484
|
-
return false;
|
|
496
|
+
].map((fileName) => pathIsFile(path.join(appDir, fileName))), ...["skills", "plugins"].map((dirName) => pathIsDirectory(path.join(appDir, dirName)))])).includes(true);
|
|
485
497
|
}
|
|
486
498
|
async function runCheck(rootDir = process.cwd(), io = DEFAULT_IO) {
|
|
487
499
|
const resolvedRoot = path.resolve(rootDir);
|
|
@@ -496,10 +508,8 @@ async function runCheck(rootDir = process.cwd(), io = DEFAULT_IO) {
|
|
|
496
508
|
manifestPath: path.join(pluginDir, "plugin.yaml")
|
|
497
509
|
})), ...packagedPluginSources];
|
|
498
510
|
const appSkillDirs = await collectSkillDirectories(contentRoot(resolvedRoot, "skills"));
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
const packagedSkillDirsByPackage = /* @__PURE__ */ new Map();
|
|
502
|
-
for (const skillRoot of packagedContent.skillRoots) packagedSkillDirsByPackage.set(skillRoot.packageName, await collectSkillDirectories(skillRoot.root));
|
|
511
|
+
const limit = pLimit(8);
|
|
512
|
+
const [pluginSkillDirs, packagedSkillDirsByPackage] = await Promise.all([Promise.all(pluginSources.map(({ pluginDir }) => limit(async () => [pluginDir, await collectSkillDirectories(path.join(pluginDir, "skills"))]))).then((entries) => new Map(entries)), Promise.all(packagedContent.skillRoots.map((skillRoot) => limit(async () => [skillRoot.packageName, await collectSkillDirectories(skillRoot.root)]))).then((entries) => new Map(entries))]);
|
|
503
513
|
const packagedStandaloneSkillDirs = [...packagedSkillDirsByPackage.values()].flat();
|
|
504
514
|
const appAndLocalPluginSkillDirs = [...appSkillDirs, ...appPluginDirs.flatMap((pluginDir) => pluginSkillDirs.get(pluginDir) ?? [])].sort((left, right) => left.localeCompare(right));
|
|
505
515
|
const packagedSkillDirs = [...packagedPluginSources.flatMap(({ pluginDir }) => pluginSkillDirs.get(pluginDir) ?? []), ...packagedStandaloneSkillDirs].sort((left, right) => left.localeCompare(right));
|
package/dist/cli/main.js
CHANGED
|
@@ -45,13 +45,13 @@ async function runChat(argv, pluginSet) {
|
|
|
45
45
|
return await (await import("./chat.js")).runChat(argv, void 0, { pluginSet });
|
|
46
46
|
}
|
|
47
47
|
async function runAdmin(argv) {
|
|
48
|
-
return await (await import("../admin-
|
|
48
|
+
return await (await import("../admin-B78_KmfR.js")).runAdmin(argv);
|
|
49
49
|
}
|
|
50
50
|
async function runServiceAccount(argv) {
|
|
51
|
-
return await (await import("../service-account-
|
|
51
|
+
return await (await import("../service-account-tI3LBg2_.js")).runServiceAccount(argv);
|
|
52
52
|
}
|
|
53
53
|
async function runBriefs(argv) {
|
|
54
|
-
return await (await import("../briefs-
|
|
54
|
+
return await (await import("../briefs-DR8mp-TK.js")).runBriefs(argv);
|
|
55
55
|
}
|
|
56
56
|
function topLevelCommand(argv) {
|
|
57
57
|
return (argv[0] === "--" ? argv.slice(1) : argv)[0];
|
package/dist/cli/plugins.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as JuniorPluginSet } from "../plugins-
|
|
1
|
+
import { n as JuniorPluginSet } from "../plugins-fBrz8PCV.js";
|
|
2
2
|
import { PluginCliIo } from "@sentry/junior-plugin-api";
|
|
3
3
|
export type PluginCommandIo = PluginCliIo;
|
|
4
4
|
export interface CliPluginCommandDispatcher {
|
package/dist/cli/plugins.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { o as getDb } from "../db-
|
|
2
|
-
import {
|
|
3
|
-
import { n as pluginCatalogRuntime } from "../catalog-runtime-
|
|
4
|
-
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation
|
|
1
|
+
import { o as getDb } from "../db-C21CyyTE.js";
|
|
2
|
+
import { Fn as setPlugins, In as validatePlugins, Ua as createPluginLogger } from "../projection-D47mlszd.js";
|
|
3
|
+
import { n as pluginCatalogRuntime } from "../catalog-runtime-Se9idiDR.js";
|
|
4
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation--hsjOLRL.js";
|
|
5
5
|
import { t as loadAppPluginSet } from "../plugin-module-Cv2ETe8Y.js";
|
|
6
6
|
import { a as pluginRuntimeRegistrationsFromPluginSet, i as pluginCliRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "../plugins-Bkk0XRo2.js";
|
|
7
7
|
import { stderr, stdout } from "node:process";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { i as getChatConfig } from "../config-
|
|
2
|
-
import { n as pluginCatalogRuntime } from "../catalog-runtime-
|
|
3
|
-
import { n as resolve } from "../resolve-
|
|
4
|
-
import {
|
|
5
|
-
import { Z as disconnectStateAdapter } from "../db-
|
|
1
|
+
import { i as getChatConfig } from "../config-DY5c1E0l.js";
|
|
2
|
+
import { n as pluginCatalogRuntime } from "../catalog-runtime-Se9idiDR.js";
|
|
3
|
+
import { n as resolve } from "../resolve-gZ-hVMYl.js";
|
|
4
|
+
import { Ki as create, wa as SANDBOX_RUNTIME } from "../projection-D47mlszd.js";
|
|
5
|
+
import { Z as disconnectStateAdapter } from "../db-C21CyyTE.js";
|
|
6
6
|
// src/cli/snapshot-create.ts
|
|
7
7
|
const DEFAULT_TIMEOUT_MS = 6e5;
|
|
8
8
|
function progressMessage(phase) {
|
package/dist/cli/upgrade.d.ts
CHANGED
package/dist/cli/upgrade.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import { i as getChatConfig } from "../config-
|
|
2
|
-
import { t as createJuniorSqlExecutor } from "../executor-
|
|
1
|
+
import { i as getChatConfig } from "../config-DY5c1E0l.js";
|
|
2
|
+
import { n as isPostgresErrorCode, t as createJuniorSqlExecutor } from "../executor-DfNoVVGd.js";
|
|
3
3
|
import { t as loadAppPluginSet } from "../plugin-module-Cv2ETe8Y.js";
|
|
4
|
-
import { t as createPluginCatalogRuntime } from "../registry-
|
|
4
|
+
import { t as createPluginCatalogRuntime } from "../registry-yht0oxq6.js";
|
|
5
5
|
import { n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "../plugins-Bkk0XRo2.js";
|
|
6
6
|
import { basename, dirname, join, resolve } from "node:path";
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
8
|
import { readMigrationFiles } from "drizzle-orm/migrator";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
10
|
import { createJiti } from "jiti";
|
|
11
|
-
// src/db/postgres-error.ts
|
|
12
|
-
/** Return whether an unknown PostgreSQL failure has the requested SQLSTATE. */
|
|
13
|
-
function isPostgresErrorCode(error, code) {
|
|
14
|
-
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
15
|
-
}
|
|
16
11
|
// src/chat/conversations/sql/migrations.ts
|
|
17
12
|
/** SQL schema migrations for durable Junior records. */
|
|
18
13
|
const CORE_MIGRATION_BRIDGE_VERSION = "0.107.1";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-
|
|
3
|
-
import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-
|
|
2
|
+
import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-DjW7LjgJ.js";
|
|
3
|
+
import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-CVj9vSrP.js";
|
|
4
|
+
import pLimit from "p-limit";
|
|
4
5
|
import { AwsClient } from "aws4fetch";
|
|
5
6
|
import { del, get, issueSignedToken, presignUrl, put } from "@vercel/blob";
|
|
6
7
|
import * as z from "zod";
|
|
@@ -172,6 +173,7 @@ function createAttachmentStorage(config) {
|
|
|
172
173
|
}
|
|
173
174
|
}
|
|
174
175
|
// src/chat/attachments/s3.ts
|
|
176
|
+
const S3_DELETE_CONCURRENCY = 8;
|
|
175
177
|
function readRequiredSetting(env, name) {
|
|
176
178
|
const value = toOptionalTrimmed(env[name]);
|
|
177
179
|
if (value === void 0) throw new Error(`${name} is required when JUNIOR_ATTACHMENT_STORAGE_PROVIDER is s3`);
|
|
@@ -291,14 +293,15 @@ function createS3AttachmentStorage(config) {
|
|
|
291
293
|
return response.body;
|
|
292
294
|
},
|
|
293
295
|
async delete(keys) {
|
|
294
|
-
|
|
296
|
+
const limit = pLimit(S3_DELETE_CONCURRENCY);
|
|
297
|
+
await Promise.all(keys.map((key) => limit(async () => {
|
|
295
298
|
const response = await client.fetch(objectUrl(config, key), { method: "DELETE" });
|
|
296
299
|
if (response.status === 404) {
|
|
297
300
|
await drain(response);
|
|
298
301
|
return;
|
|
299
302
|
}
|
|
300
303
|
await expectOk(response, "delete");
|
|
301
|
-
}));
|
|
304
|
+
})));
|
|
302
305
|
}
|
|
303
306
|
};
|
|
304
307
|
}
|
|
@@ -423,6 +426,45 @@ async function resolveGatewayCredential() {
|
|
|
423
426
|
async function getGatewayApiKey() {
|
|
424
427
|
return (await resolveGatewayCredential()).token;
|
|
425
428
|
}
|
|
429
|
+
// src/chat/pi/object-completion.ts
|
|
430
|
+
/**
|
|
431
|
+
* Output tokens added on top of the object size that a caller asks for.
|
|
432
|
+
* Reasoning models spend output tokens before they write the object, and the
|
|
433
|
+
* provider counts both against one `maxOutputTokens` limit. With Guardian's
|
|
434
|
+
* 2,000-token assessment, this keeps the 8,000 limit its evals pass at.
|
|
435
|
+
*/
|
|
436
|
+
const STRUCTURED_OUTPUT_REASONING_TOKENS = 6e3;
|
|
437
|
+
/**
|
|
438
|
+
* Output token limit for an object of `objectTokens`, with room for reasoning.
|
|
439
|
+
* It never exceeds the model's own output limit, which providers enforce.
|
|
440
|
+
*/
|
|
441
|
+
function structuredOutputTokenLimit(objectTokens, modelMaxTokens) {
|
|
442
|
+
if (objectTokens === void 0) return void 0;
|
|
443
|
+
const limit = objectTokens + STRUCTURED_OUTPUT_REASONING_TOKENS;
|
|
444
|
+
return modelMaxTokens !== void 0 ? Math.min(limit, modelMaxTokens) : limit;
|
|
445
|
+
}
|
|
446
|
+
/** Span attributes for the finish reason and usage of one object completion. */
|
|
447
|
+
function objectCompletionAttributes(finishReason, usage) {
|
|
448
|
+
const reasoningTokens = usage?.outputTokenDetails?.reasoningTokens;
|
|
449
|
+
return {
|
|
450
|
+
...finishReason ? { "gen_ai.response.finish_reasons": [finishReason] } : void 0,
|
|
451
|
+
...extractGenAiUsageAttributes(usage),
|
|
452
|
+
...reasoningTokens !== void 0 ? { "gen_ai.usage.reasoning.output_tokens": reasoningTokens } : void 0
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Keep only the fixed message and stack of a failed structured output. The SDK
|
|
457
|
+
* error's `text` and its parse or validation cause hold the raw model output.
|
|
458
|
+
* A `length` finish gets its own error, so a spent budget is not reported as a
|
|
459
|
+
* malformed object.
|
|
460
|
+
*/
|
|
461
|
+
function structuredOutputErrorCause(error) {
|
|
462
|
+
const spentBudget = error.finishReason === "length";
|
|
463
|
+
const cause = new Error(spentBudget ? "Structured output hit the output token limit" : error.message);
|
|
464
|
+
cause.name = spentBudget ? "StructuredOutputLengthError" : error.name;
|
|
465
|
+
cause.stack = error.stack;
|
|
466
|
+
return cause;
|
|
467
|
+
}
|
|
426
468
|
// src/chat/services/provider-error.ts
|
|
427
469
|
/** Structured failure produced at an AI provider boundary. */
|
|
428
470
|
var ProviderError = class extends Error {
|
|
@@ -576,25 +618,25 @@ function findProviderError(error) {
|
|
|
576
618
|
current = current.cause;
|
|
577
619
|
}
|
|
578
620
|
}
|
|
621
|
+
const TEMPORARY_PROVIDER_ERROR = "The model provider had a temporary connection problem. Please try again.";
|
|
622
|
+
const PROVIDER_ERROR_MESSAGES = {
|
|
623
|
+
capacity: "The selected model is temporarily unavailable because it is at capacity. Please try again shortly.",
|
|
624
|
+
rate_limit: "The model is rate-limited. Please try again shortly.",
|
|
625
|
+
timeout: TEMPORARY_PROVIDER_ERROR,
|
|
626
|
+
network: TEMPORARY_PROVIDER_ERROR,
|
|
627
|
+
server: TEMPORARY_PROVIDER_ERROR,
|
|
628
|
+
auth: "The model provider rejected the configured credentials. This needs an administrator or configuration fix.",
|
|
629
|
+
permission: "The model provider denied access to this model or request. Ask an administrator to check model access, organization policy, and region availability.",
|
|
630
|
+
quota: "The model provider's usage quota has been exhausted. This needs an administrator or billing configuration fix.",
|
|
631
|
+
content_policy: "The model provider blocked this request under its content policy. Please revise the request and try again.",
|
|
632
|
+
invalid_request: "The model provider rejected this request as invalid. Please revise the request or ask an administrator to check the model configuration.",
|
|
633
|
+
invalid_response: "The model provider returned an invalid response. Please try again.",
|
|
634
|
+
unknown: "The model provider returned an error. Please try again."
|
|
635
|
+
};
|
|
579
636
|
/** Return stable, sanitized copy suitable for a terminal user response. */
|
|
580
637
|
function getProviderErrorUserMessage(error) {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
case "rate_limit": {
|
|
584
|
-
const seconds = error.retryAfterMs ? Math.max(1, Math.ceil(error.retryAfterMs / 1e3)) : void 0;
|
|
585
|
-
return seconds ? `The model is rate-limited. Please try again in about ${seconds} seconds.` : "The model is rate-limited. Please try again shortly.";
|
|
586
|
-
}
|
|
587
|
-
case "timeout":
|
|
588
|
-
case "network":
|
|
589
|
-
case "server": return "The model provider had a temporary connection problem. Please try again.";
|
|
590
|
-
case "auth": return "The model provider rejected the configured credentials. This needs an administrator or configuration fix.";
|
|
591
|
-
case "permission": return "The model provider denied access to this model or request. Ask an administrator to check model access, organization policy, and region availability.";
|
|
592
|
-
case "quota": return "The model provider's usage quota has been exhausted. This needs an administrator or billing configuration fix.";
|
|
593
|
-
case "content_policy": return "The model provider blocked this request under its content policy. Please revise the request and try again.";
|
|
594
|
-
case "invalid_request": return "The model provider rejected this request as invalid. Please revise the request or ask an administrator to check the model configuration.";
|
|
595
|
-
case "invalid_response": return "The model provider returned an invalid response. Please try again.";
|
|
596
|
-
default: return "The model provider returned an error. Please try again.";
|
|
597
|
-
}
|
|
638
|
+
if (error.kind === "rate_limit" && error.retryAfterMs) return `The model is rate-limited. Please try again in about ${Math.max(1, Math.ceil(error.retryAfterMs / 1e3))} seconds.`;
|
|
639
|
+
return PROVIDER_ERROR_MESSAGES[error.kind];
|
|
598
640
|
}
|
|
599
641
|
/** Return safe structured fields for terminal failure telemetry. */
|
|
600
642
|
function getProviderErrorAttributes(error) {
|
|
@@ -1285,9 +1327,12 @@ function embeddingCostUsd(modelId, inputTokens) {
|
|
|
1285
1327
|
function extractText(message) {
|
|
1286
1328
|
return (message.content ?? []).filter((part) => part.type === "text" && typeof part.text === "string").map((part) => part.text ?? "").join("").trim();
|
|
1287
1329
|
}
|
|
1330
|
+
function findGatewayModel(modelId) {
|
|
1331
|
+
return GATEWAY_MODEL_OVERRIDES[modelId] ?? getModels(GATEWAY_PROVIDER).find((model) => model.id === modelId);
|
|
1332
|
+
}
|
|
1288
1333
|
/** Resolve gateway models through local overrides, then Pi's bundled catalog. */
|
|
1289
1334
|
function resolveGatewayModel(modelId) {
|
|
1290
|
-
const matched =
|
|
1335
|
+
const matched = findGatewayModel(modelId);
|
|
1291
1336
|
if (!matched) throw new Error(`Unknown AI Gateway model id: ${modelId}`);
|
|
1292
1337
|
return {
|
|
1293
1338
|
...matched,
|
|
@@ -1435,18 +1480,9 @@ function bestEffortObjectCompletionCost(modelId, usage) {
|
|
|
1435
1480
|
return;
|
|
1436
1481
|
}
|
|
1437
1482
|
}
|
|
1438
|
-
/**
|
|
1439
|
-
* Keep only the fixed message and stack of a failed structured output. The SDK
|
|
1440
|
-
* error's `text` and its parse or validation cause hold the raw model output.
|
|
1441
|
-
*/
|
|
1442
|
-
function structuredOutputErrorCause(error) {
|
|
1443
|
-
const cause = new Error(error.message);
|
|
1444
|
-
cause.name = error.name;
|
|
1445
|
-
cause.stack = error.stack;
|
|
1446
|
-
return cause;
|
|
1447
|
-
}
|
|
1448
1483
|
/** Execute a schema-constrained completion using the AI SDK structured output path. */
|
|
1449
1484
|
async function completeObject(params) {
|
|
1485
|
+
const maxOutputTokens = structuredOutputTokenLimit(params.maxTokens, findGatewayModel(params.modelId)?.maxTokens);
|
|
1450
1486
|
const credential = await resolveGatewayCredential();
|
|
1451
1487
|
const provider = createGatewayProvider({ apiKey: credential.token });
|
|
1452
1488
|
let result;
|
|
@@ -1457,13 +1493,13 @@ async function completeObject(params) {
|
|
|
1457
1493
|
schema: params.schema,
|
|
1458
1494
|
prompt: params.prompt,
|
|
1459
1495
|
...params.system !== void 0 ? { system: params.system } : void 0,
|
|
1460
|
-
...
|
|
1496
|
+
...maxOutputTokens !== void 0 ? { maxOutputTokens } : void 0,
|
|
1461
1497
|
...params.signal !== void 0 ? { abortSignal: params.signal } : void 0
|
|
1498
|
+
}).catch((error) => {
|
|
1499
|
+
if (NoObjectGeneratedError.isInstance(error)) setSpanAttributes(objectCompletionAttributes(error.finishReason, error.usage));
|
|
1500
|
+
throw error;
|
|
1462
1501
|
});
|
|
1463
|
-
setSpanAttributes(
|
|
1464
|
-
"gen_ai.response.finish_reasons": [result.finishReason],
|
|
1465
|
-
...extractGenAiUsageAttributes(result.usage)
|
|
1466
|
-
});
|
|
1502
|
+
setSpanAttributes(objectCompletionAttributes(result.finishReason, result.usage));
|
|
1467
1503
|
return result;
|
|
1468
1504
|
}, {
|
|
1469
1505
|
"gen_ai.provider.name": GEN_AI_PROVIDER_NAME,
|
|
@@ -1475,7 +1511,7 @@ async function completeObject(params) {
|
|
|
1475
1511
|
"server.port": 443,
|
|
1476
1512
|
"gen_ai.provider.auth_mode": credential.mode,
|
|
1477
1513
|
...params.thinkingLevel ? { "gen_ai.request.reasoning.level": params.thinkingLevel } : void 0,
|
|
1478
|
-
...
|
|
1514
|
+
...maxOutputTokens !== void 0 ? { "gen_ai.request.max_tokens": maxOutputTokens } : void 0
|
|
1479
1515
|
});
|
|
1480
1516
|
} catch (error) {
|
|
1481
1517
|
if (NoObjectGeneratedError.isInstance(error)) throw createProviderError(structuredOutputErrorCause(error), {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
3
|
-
import { R as deleteProviderIdentityForSlackUser, s as getSqlExecutor, z as deleteProviderIdentityForUser } from "./db-
|
|
4
|
-
import {
|
|
5
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
6
|
-
import { h as deleteMcpStoredOAuthCredentials, m as deleteMcpServerSessionId, p as deleteMcpAuthSessionsForUserProvider } from "./service-account-
|
|
1
|
+
import { ia as startOAuthFlow } from "./projection-D47mlszd.js";
|
|
2
|
+
import { n as botConfig } from "./config-DY5c1E0l.js";
|
|
3
|
+
import { R as deleteProviderIdentityForSlackUser, s as getSqlExecutor, z as deleteProviderIdentityForUser } from "./db-C21CyyTE.js";
|
|
4
|
+
import { d as hasRequiredOAuthScope } from "./registry-yht0oxq6.js";
|
|
5
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-Se9idiDR.js";
|
|
6
|
+
import { h as deleteMcpStoredOAuthCredentials, m as deleteMcpServerSessionId, p as deleteMcpAuthSessionsForUserProvider } from "./service-account-CZneZHh7.js";
|
|
7
|
+
import pLimit from "p-limit";
|
|
7
8
|
import { randomBytes } from "node:crypto";
|
|
8
9
|
// src/handlers/oauth-html.ts
|
|
9
10
|
/** Build pre-escaped callback HTML with the shared response security policy. */
|
|
@@ -194,7 +195,8 @@ function connectablePlugin(provider) {
|
|
|
194
195
|
/** List OAuth plugins and the user's connection state for each one. */
|
|
195
196
|
async function listConnections(userId, userTokenStore) {
|
|
196
197
|
const plugins = pluginCatalogRuntime.getProviders().filter((plugin) => Boolean(plugin.manifest.oauth));
|
|
197
|
-
|
|
198
|
+
const limit = pLimit(8);
|
|
199
|
+
return await Promise.all(plugins.map((plugin) => limit(async () => {
|
|
198
200
|
const tokens = await readConnectedOAuthTokens(userId, plugin, userTokenStore);
|
|
199
201
|
const account = tokens?.account;
|
|
200
202
|
return {
|
|
@@ -207,7 +209,7 @@ async function listConnections(userId, userTokenStore) {
|
|
|
207
209
|
...account.url ? { url: account.url } : void 0
|
|
208
210
|
} } : void 0
|
|
209
211
|
};
|
|
210
|
-
}));
|
|
212
|
+
})));
|
|
211
213
|
}
|
|
212
214
|
/** True when the provider is an installed plugin with user OAuth. */
|
|
213
215
|
function isConnectableProvider(provider) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Ft as moveIdleConversationDestination,
|
|
2
|
-
import { $ as getStateAdapter, C as withConversationMutationLock, M as setFirstConversationLocation, a as getConversationStore, o as getDb, ot as claimProviderConversation, s as getSqlExecutor, st as getConversationIdByProviderConversation } from "./db-
|
|
1
|
+
import { Ft as moveIdleConversationDestination, Is as escapeSlackMrkdwnText, Ls as formatSlackLink, cs as getSlackMessagePermalink, ec as getDashboardConversationLink, fs as postSlackMessage, no as readLatestConversationBrief, ss as deleteSlackMessage } from "./projection-D47mlszd.js";
|
|
2
|
+
import { $ as getStateAdapter, C as withConversationMutationLock, M as setFirstConversationLocation, a as getConversationStore, o as getDb, ot as claimProviderConversation, s as getSqlExecutor, st as getConversationIdByProviderConversation } from "./db-C21CyyTE.js";
|
|
3
3
|
import { u as parseSlackChannelId, v as parseSlackMessageTs } from "./actor-D2iXzvlN.js";
|
|
4
|
-
import {
|
|
5
|
-
import "./store-
|
|
6
|
-
import {
|
|
4
|
+
import { fr as checkSlackChannelReadAccess, pr as joinPublicChannelForRead } from "./warmup-C0IblNtf.js";
|
|
5
|
+
import "./store-BZJdHYR7.js";
|
|
6
|
+
import { V as juniorDestinations } from "./executor-DfNoVVGd.js";
|
|
7
7
|
import { and, eq } from "drizzle-orm";
|
|
8
8
|
// src/chat/slack/continue-in-slack.ts
|
|
9
9
|
/** Refusal for a move that cannot wait for the active Run. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as logWarn } from "./logging-
|
|
1
|
+
import { h as logWarn } from "./logging-DjW7LjgJ.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
import { renderSystemMessageUpdate } from "@earendil-works/pi-ai";
|
|
4
4
|
// src/chat/conversation-privacy.ts
|