@sentry/junior 0.78.0 → 0.80.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-OFDNZJB2.js → agent-hooks-ZGTDOXQY.js} +11 -10
- package/dist/api-reference.d.ts +1 -1
- package/dist/app.js +39 -41
- package/dist/catalog-runtime-IVWRAPSI.js +12 -0
- package/dist/chat/conversation-privacy.d.ts +4 -0
- package/dist/chat/plugins/catalog-runtime.d.ts +1 -0
- package/dist/chat/plugins/registry.d.ts +27 -26
- package/dist/chat/sentry-payload-filter.d.ts +14 -0
- package/dist/chat/sentry.d.ts +1 -1
- package/dist/chat/state/session-log.d.ts +84 -0
- package/dist/chat/tools/advisor/tool.d.ts +1 -0
- package/dist/chat/tools/definition.d.ts +6 -0
- package/dist/{chunk-LUNMJQ7D.js → chunk-2AJ4TEKE.js} +6 -6
- package/dist/{chunk-ST6YNAXG.js → chunk-3DA7X2U3.js} +6 -3
- package/dist/{chunk-PNGAJ75P.js → chunk-3JKTVW4R.js} +7 -8
- package/dist/{chunk-Q6XFTRV5.js → chunk-4XHCVBXH.js} +2 -2
- package/dist/{chunk-Z4CIQ3EB.js → chunk-66NX7MNW.js} +1 -1
- package/dist/{chunk-Q3XNY442.js → chunk-6APU57E6.js} +1 -3
- package/dist/{chunk-T77LUIX3.js → chunk-ABRNFE3N.js} +7 -211
- package/dist/chunk-DR75T7J3.js +225 -0
- package/dist/{chunk-KIDP757T.js → chunk-FAGWUF44.js} +17 -7
- package/dist/{chunk-OJ53FYVG.js → chunk-FTMXFBDC.js} +14 -0
- package/dist/{chunk-RARSKPVT.js → chunk-GUO4EE7L.js} +2 -2
- package/dist/{chunk-2ECJXSVQ.js → chunk-IOBSRZK5.js} +1 -1
- package/dist/{chunk-EJN6G5A2.js → chunk-KF7522P3.js} +5 -19
- package/dist/{chunk-C2YBH4S6.js → chunk-LX5GBMEP.js} +6 -6
- package/dist/{chunk-237T7XAN.js → chunk-PQ2U2AO3.js} +3 -3
- package/dist/{chunk-YLVJRYTD.js → chunk-TW23AT22.js} +190 -196
- package/dist/{chunk-2MSW5BZY.js → chunk-W2QGQCKG.js} +129 -62
- package/dist/{chunk-Y3EG7S7P.js → chunk-WCXVEQPI.js} +7 -8
- package/dist/{chunk-LXTPBU4K.js → chunk-X2FL5ZH5.js} +1 -1
- package/dist/{chunk-SSWBYEFH.js → chunk-Y3YUOEAZ.js} +13 -7
- package/dist/{chunk-QDQVOMBA.js → chunk-YA2JCC7G.js} +165 -14
- package/dist/{chunk-VALUBQ7R.js → chunk-ZPCGQRFJ.js} +1 -1
- package/dist/cli/chat.js +12 -10
- package/dist/cli/check.js +7 -7
- package/dist/cli/main.js +1 -1
- package/dist/cli/plugins.js +17 -16
- package/dist/cli/snapshot-warmup.js +14 -15
- package/dist/cli/upgrade.js +20 -22
- package/dist/db-GQJKBX5W.js +18 -0
- package/dist/instrumentation.js +76 -3
- package/dist/nitro.js +8 -7
- package/dist/reporting/conversations.d.ts +30 -0
- package/dist/reporting.d.ts +1 -1
- package/dist/reporting.js +115 -24
- package/dist/{runner-WW4GJFUB.js → runner-JOVPVMIH.js} +18 -17
- package/dist/{sentry-4CP5NNQ5.js → sentry-EGFOV3DH.js} +5 -3
- package/dist/validation-TN6HMZAD.js +15 -0
- package/package.json +4 -4
- package/dist/db-NGQ3JCMF.js +0 -17
- package/dist/registry-RRIDPJBT.js +0 -46
- package/dist/validation-MDMYBRFB.js +0 -15
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseActorUserId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZPCGQRFJ.js";
|
|
4
4
|
import {
|
|
5
5
|
discoverInstalledPluginPackageContent,
|
|
6
6
|
normalizePluginPackageNames,
|
|
7
7
|
pluginRoots
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6APU57E6.js";
|
|
9
9
|
import {
|
|
10
10
|
logInfo,
|
|
11
11
|
logWarn,
|
|
12
12
|
setSpanAttributes
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-KF7522P3.js";
|
|
14
14
|
|
|
15
15
|
// src/chat/plugins/registry.ts
|
|
16
16
|
import { readFileSync, readdirSync, statSync } from "fs";
|
|
@@ -1569,8 +1569,6 @@ function createOAuthBearerBroker(manifest, credentials, deps) {
|
|
|
1569
1569
|
}
|
|
1570
1570
|
|
|
1571
1571
|
// src/chat/plugins/registry.ts
|
|
1572
|
-
var loadedPluginState;
|
|
1573
|
-
var pluginConfig;
|
|
1574
1572
|
function getLoggedPluginNames() {
|
|
1575
1573
|
const globalState = globalThis;
|
|
1576
1574
|
globalState.__juniorLoggedPluginNames ??= /* @__PURE__ */ new Set();
|
|
@@ -1636,8 +1634,8 @@ function registerPluginManifest(state, manifest, pluginDir, skillsDir, migration
|
|
|
1636
1634
|
state.domainToPlugin.set(domain, manifest.name);
|
|
1637
1635
|
}
|
|
1638
1636
|
}
|
|
1639
|
-
function registerYamlPluginManifest(state, raw, pluginDir) {
|
|
1640
|
-
const manifest = parsePluginManifest(raw, pluginDir,
|
|
1637
|
+
function registerYamlPluginManifest(state, raw, pluginDir, config) {
|
|
1638
|
+
const manifest = parsePluginManifest(raw, pluginDir, config);
|
|
1641
1639
|
const candidateSkillsDir = path.join(pluginDir, "skills");
|
|
1642
1640
|
const hasSkillsDir = (() => {
|
|
1643
1641
|
try {
|
|
@@ -1666,15 +1664,17 @@ function normalizePluginRoots(roots) {
|
|
|
1666
1664
|
}
|
|
1667
1665
|
return resolved;
|
|
1668
1666
|
}
|
|
1669
|
-
function getPluginCatalogSource() {
|
|
1670
|
-
const packagedContent = discoverConfiguredPluginPackageContent(
|
|
1667
|
+
function getPluginCatalogSource(runtime) {
|
|
1668
|
+
const packagedContent = discoverConfiguredPluginPackageContent(
|
|
1669
|
+
runtime.pluginConfig
|
|
1670
|
+
);
|
|
1671
1671
|
const localRoots = normalizePluginRoots(pluginRoots());
|
|
1672
1672
|
const manifestRoots = normalizePluginRoots([
|
|
1673
1673
|
...localRoots,
|
|
1674
1674
|
...packagedContent.manifestRoots
|
|
1675
1675
|
]);
|
|
1676
1676
|
const packagedSkillRoots = normalizePluginRoots(packagedContent.skillRoots);
|
|
1677
|
-
const inlineManifests = pluginConfig?.inlineManifests ?? [];
|
|
1677
|
+
const inlineManifests = runtime.pluginConfig?.inlineManifests ?? [];
|
|
1678
1678
|
return {
|
|
1679
1679
|
inlineManifests,
|
|
1680
1680
|
manifestRoots,
|
|
@@ -1693,7 +1693,7 @@ function getPluginCatalogSource() {
|
|
|
1693
1693
|
),
|
|
1694
1694
|
packagedSkillRoots,
|
|
1695
1695
|
packageNames: [...packagedContent.packageNames].sort(),
|
|
1696
|
-
pluginConfig: pluginConfig ?? {}
|
|
1696
|
+
pluginConfig: runtime.pluginConfig ?? {}
|
|
1697
1697
|
})
|
|
1698
1698
|
};
|
|
1699
1699
|
}
|
|
@@ -1722,7 +1722,7 @@ function packageContentByName(packagedContent, packageName) {
|
|
|
1722
1722
|
(pkg) => pkg.packageName === packageName
|
|
1723
1723
|
);
|
|
1724
1724
|
}
|
|
1725
|
-
function registerInlineManifests(state, source) {
|
|
1725
|
+
function registerInlineManifests(state, source, config) {
|
|
1726
1726
|
const migrationOwners = /* @__PURE__ */ new Map();
|
|
1727
1727
|
for (const definition of source.inlineManifests) {
|
|
1728
1728
|
const pkg = definition.packageName ? packageContentByName(source.packagedContent, definition.packageName) : void 0;
|
|
@@ -1734,7 +1734,7 @@ function registerInlineManifests(state, source) {
|
|
|
1734
1734
|
const manifest = parseInlinePluginManifest(
|
|
1735
1735
|
definition.manifest,
|
|
1736
1736
|
dir,
|
|
1737
|
-
|
|
1737
|
+
config
|
|
1738
1738
|
);
|
|
1739
1739
|
if (migrationsDir) {
|
|
1740
1740
|
const owner = migrationOwners.get(migrationsDir);
|
|
@@ -1748,17 +1748,17 @@ function registerInlineManifests(state, source) {
|
|
|
1748
1748
|
registerPluginManifest(state, manifest, dir, skillsDir, migrationsDir);
|
|
1749
1749
|
}
|
|
1750
1750
|
}
|
|
1751
|
-
function discoverConfiguredPluginPackageContent() {
|
|
1751
|
+
function discoverConfiguredPluginPackageContent(config) {
|
|
1752
1752
|
return discoverInstalledPluginPackageContent(process.cwd(), {
|
|
1753
|
-
packageNames:
|
|
1753
|
+
packageNames: config?.packages
|
|
1754
1754
|
});
|
|
1755
1755
|
}
|
|
1756
|
-
function buildLoadedPluginState(source) {
|
|
1756
|
+
function buildLoadedPluginState(source, config) {
|
|
1757
1757
|
const state = createLoadedPluginState(source.signature);
|
|
1758
1758
|
for (const skillRoot of source.packagedSkillRoots) {
|
|
1759
1759
|
state.packageSkillRoots.add(skillRoot);
|
|
1760
1760
|
}
|
|
1761
|
-
registerInlineManifests(state, source);
|
|
1761
|
+
registerInlineManifests(state, source, config);
|
|
1762
1762
|
const roots = source.manifestRoots;
|
|
1763
1763
|
for (const pluginsRoot of roots) {
|
|
1764
1764
|
let entries;
|
|
@@ -1787,7 +1787,7 @@ function buildLoadedPluginState(source) {
|
|
|
1787
1787
|
}
|
|
1788
1788
|
if (hasRootManifest) {
|
|
1789
1789
|
const rawRootManifest = readFileSync(manifestPath, "utf8");
|
|
1790
|
-
registerYamlPluginManifest(state, rawRootManifest, pluginsRoot);
|
|
1790
|
+
registerYamlPluginManifest(state, rawRootManifest, pluginsRoot, config);
|
|
1791
1791
|
continue;
|
|
1792
1792
|
}
|
|
1793
1793
|
}
|
|
@@ -1820,10 +1820,10 @@ function buildLoadedPluginState(source) {
|
|
|
1820
1820
|
} catch {
|
|
1821
1821
|
continue;
|
|
1822
1822
|
}
|
|
1823
|
-
registerYamlPluginManifest(state, raw, pluginDir);
|
|
1823
|
+
registerYamlPluginManifest(state, raw, pluginDir, config);
|
|
1824
1824
|
}
|
|
1825
1825
|
}
|
|
1826
|
-
for (const name of Object.keys(
|
|
1826
|
+
for (const name of Object.keys(config?.manifests ?? {})) {
|
|
1827
1827
|
if (!state.pluginsByName.has(name)) {
|
|
1828
1828
|
throw new Error(
|
|
1829
1829
|
`plugins.manifests.${name} does not match a loaded plugin`
|
|
@@ -1856,174 +1856,185 @@ function logLoadedPlugins(state) {
|
|
|
1856
1856
|
);
|
|
1857
1857
|
}
|
|
1858
1858
|
}
|
|
1859
|
-
function ensurePluginsLoaded() {
|
|
1860
|
-
const source = getPluginCatalogSource();
|
|
1861
|
-
if (loadedPluginState?.signature === source.signature) {
|
|
1862
|
-
return loadedPluginState;
|
|
1859
|
+
function ensurePluginsLoaded(runtime) {
|
|
1860
|
+
const source = getPluginCatalogSource(runtime);
|
|
1861
|
+
if (runtime.loadedPluginState?.signature === source.signature) {
|
|
1862
|
+
return runtime.loadedPluginState;
|
|
1863
1863
|
}
|
|
1864
|
-
const state = buildLoadedPluginState(source);
|
|
1865
|
-
loadedPluginState = state;
|
|
1864
|
+
const state = buildLoadedPluginState(source, runtime.pluginConfig);
|
|
1865
|
+
runtime.loadedPluginState = state;
|
|
1866
1866
|
logLoadedPlugins(state);
|
|
1867
1867
|
return state;
|
|
1868
1868
|
}
|
|
1869
|
-
function
|
|
1870
|
-
const
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
}
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
}
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1869
|
+
function createPluginCatalogRuntime() {
|
|
1870
|
+
const runtime = {};
|
|
1871
|
+
return {
|
|
1872
|
+
setConfig(config) {
|
|
1873
|
+
const previousConfig = clonePluginCatalogConfig(runtime.pluginConfig);
|
|
1874
|
+
runtime.pluginConfig = normalizePluginCatalogConfig(config);
|
|
1875
|
+
return previousConfig;
|
|
1876
|
+
},
|
|
1877
|
+
parseConfiguredInlineManifest(manifest, dir) {
|
|
1878
|
+
return parseInlinePluginManifest(manifest, dir, runtime.pluginConfig);
|
|
1879
|
+
},
|
|
1880
|
+
getPackageContent() {
|
|
1881
|
+
return discoverConfiguredPluginPackageContent(runtime.pluginConfig);
|
|
1882
|
+
},
|
|
1883
|
+
getSignature() {
|
|
1884
|
+
return ensurePluginsLoaded(runtime).signature;
|
|
1885
|
+
},
|
|
1886
|
+
getCapabilityProviders() {
|
|
1887
|
+
const state = ensurePluginsLoaded(runtime);
|
|
1888
|
+
return state.pluginDefinitions.map((plugin) => ({
|
|
1889
|
+
provider: plugin.manifest.name,
|
|
1890
|
+
capabilities: [...plugin.manifest.capabilities],
|
|
1891
|
+
configKeys: [...plugin.manifest.configKeys],
|
|
1892
|
+
...plugin.manifest.target ? {
|
|
1893
|
+
target: {
|
|
1894
|
+
...plugin.manifest.target,
|
|
1895
|
+
...plugin.manifest.target.commandFlags ? { commandFlags: [...plugin.manifest.target.commandFlags] } : {}
|
|
1896
|
+
}
|
|
1897
|
+
} : {}
|
|
1898
|
+
}));
|
|
1899
|
+
},
|
|
1900
|
+
getProviders() {
|
|
1901
|
+
return [...ensurePluginsLoaded(runtime).pluginDefinitions];
|
|
1902
|
+
},
|
|
1903
|
+
getMigrationRoots() {
|
|
1904
|
+
const state = ensurePluginsLoaded(runtime);
|
|
1905
|
+
return [...state.pluginMigrationRoots.entries()].map(([pluginName, dir]) => ({ pluginName, dir })).sort((left, right) => left.pluginName.localeCompare(right.pluginName));
|
|
1906
|
+
},
|
|
1907
|
+
getMcpProviders() {
|
|
1908
|
+
return ensurePluginsLoaded(runtime).pluginDefinitions.filter(
|
|
1909
|
+
(plugin) => Boolean(plugin.manifest.mcp)
|
|
1910
|
+
);
|
|
1911
|
+
},
|
|
1912
|
+
getRuntimeDependencies() {
|
|
1913
|
+
const state = ensurePluginsLoaded(runtime);
|
|
1914
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1915
|
+
const deps = [];
|
|
1916
|
+
for (const plugin of state.pluginDefinitions) {
|
|
1917
|
+
for (const dep of plugin.manifest.runtimeDependencies ?? []) {
|
|
1918
|
+
const key = dep.type === "npm" ? `${dep.type}:${dep.package}:${dep.version}` : "package" in dep ? `${dep.type}:package:${dep.package}` : `${dep.type}:url:${dep.url}:${dep.sha256}`;
|
|
1919
|
+
if (seen.has(key)) {
|
|
1920
|
+
continue;
|
|
1921
|
+
}
|
|
1922
|
+
seen.add(key);
|
|
1923
|
+
deps.push(dep);
|
|
1924
|
+
}
|
|
1890
1925
|
}
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
}
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
}
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1926
|
+
return deps.sort((left, right) => {
|
|
1927
|
+
if (left.type !== right.type) {
|
|
1928
|
+
return left.type.localeCompare(right.type);
|
|
1929
|
+
}
|
|
1930
|
+
const leftIdentity = "package" in left ? `package:${left.package}` : `url:${left.url}:${left.sha256}`;
|
|
1931
|
+
const rightIdentity = "package" in right ? `package:${right.package}` : `url:${right.url}:${right.sha256}`;
|
|
1932
|
+
if (leftIdentity !== rightIdentity) {
|
|
1933
|
+
return leftIdentity.localeCompare(rightIdentity);
|
|
1934
|
+
}
|
|
1935
|
+
if (left.type === "npm" && right.type === "npm") {
|
|
1936
|
+
return left.version.localeCompare(right.version);
|
|
1937
|
+
}
|
|
1938
|
+
return 0;
|
|
1939
|
+
});
|
|
1940
|
+
},
|
|
1941
|
+
getRuntimePostinstall() {
|
|
1942
|
+
const state = ensurePluginsLoaded(runtime);
|
|
1943
|
+
const commands = [];
|
|
1944
|
+
for (const plugin of state.pluginDefinitions) {
|
|
1945
|
+
for (const command of plugin.manifest.runtimePostinstall ?? []) {
|
|
1946
|
+
commands.push({
|
|
1947
|
+
cmd: command.cmd,
|
|
1948
|
+
...command.args ? { args: [...command.args] } : {},
|
|
1949
|
+
...command.sudo !== void 0 ? { sudo: command.sudo } : {}
|
|
1950
|
+
});
|
|
1951
|
+
}
|
|
1915
1952
|
}
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
return
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
}
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1953
|
+
return commands;
|
|
1954
|
+
},
|
|
1955
|
+
getOAuthConfig(provider) {
|
|
1956
|
+
const plugin = ensurePluginsLoaded(runtime).pluginsByName.get(provider);
|
|
1957
|
+
if (!plugin?.manifest.oauth) return void 0;
|
|
1958
|
+
const oauth = plugin.manifest.oauth;
|
|
1959
|
+
return {
|
|
1960
|
+
clientIdEnv: oauth.clientIdEnv,
|
|
1961
|
+
clientSecretEnv: oauth.clientSecretEnv,
|
|
1962
|
+
authorizeEndpoint: oauth.authorizeEndpoint,
|
|
1963
|
+
tokenEndpoint: oauth.tokenEndpoint,
|
|
1964
|
+
...oauth.scope ? { scope: oauth.scope } : {},
|
|
1965
|
+
...oauth.authorizeParams ? { authorizeParams: { ...oauth.authorizeParams } } : {},
|
|
1966
|
+
...oauth.tokenAuthMethod ? { tokenAuthMethod: oauth.tokenAuthMethod } : {},
|
|
1967
|
+
...oauth.tokenExtraHeaders ? { tokenExtraHeaders: { ...oauth.tokenExtraHeaders } } : {},
|
|
1968
|
+
...oauth.treatEmptyScopeAsUnreported ? { treatEmptyScopeAsUnreported: true } : {},
|
|
1969
|
+
callbackPath: `/api/oauth/callback/${plugin.manifest.name}`
|
|
1970
|
+
};
|
|
1971
|
+
},
|
|
1972
|
+
getSkillRoots() {
|
|
1973
|
+
const state = ensurePluginsLoaded(runtime);
|
|
1974
|
+
return [
|
|
1975
|
+
.../* @__PURE__ */ new Set([
|
|
1976
|
+
...state.pluginDefinitions.flatMap(
|
|
1977
|
+
(plugin) => plugin.skillsDir ? [plugin.skillsDir] : []
|
|
1978
|
+
),
|
|
1979
|
+
...state.packageSkillRoots
|
|
1980
|
+
])
|
|
1981
|
+
];
|
|
1982
|
+
},
|
|
1983
|
+
getForSkillPath(skillPath) {
|
|
1984
|
+
const state = ensurePluginsLoaded(runtime);
|
|
1985
|
+
const resolvedSkillPath = path.resolve(skillPath);
|
|
1986
|
+
return state.pluginDefinitions.find((plugin) => {
|
|
1987
|
+
if (!plugin.skillsDir) {
|
|
1988
|
+
return false;
|
|
1989
|
+
}
|
|
1990
|
+
const resolvedSkillsDir = path.resolve(plugin.skillsDir);
|
|
1991
|
+
return resolvedSkillPath === resolvedSkillsDir || resolvedSkillPath.startsWith(`${resolvedSkillsDir}${path.sep}`);
|
|
1992
|
+
});
|
|
1993
|
+
},
|
|
1994
|
+
getDefinition(provider) {
|
|
1995
|
+
return ensurePluginsLoaded(runtime).pluginsByName.get(provider);
|
|
1996
|
+
},
|
|
1997
|
+
getDisplayName(provider) {
|
|
1998
|
+
return ensurePluginsLoaded(runtime).pluginsByName.get(provider)?.manifest.displayName;
|
|
1999
|
+
},
|
|
2000
|
+
isProvider(provider) {
|
|
2001
|
+
return ensurePluginsLoaded(runtime).pluginsByName.has(provider);
|
|
2002
|
+
},
|
|
2003
|
+
isCapability(capability) {
|
|
2004
|
+
return ensurePluginsLoaded(runtime).capabilityToPlugin.has(capability);
|
|
2005
|
+
},
|
|
2006
|
+
isConfigKey(key) {
|
|
2007
|
+
return ensurePluginsLoaded(runtime).pluginConfigKeys.has(key);
|
|
2008
|
+
},
|
|
2009
|
+
createBroker(provider, deps) {
|
|
2010
|
+
const plugin = ensurePluginsLoaded(runtime).pluginsByName.get(provider);
|
|
2011
|
+
if (!plugin) {
|
|
2012
|
+
throw new Error(`Unknown plugin provider: "${provider}"`);
|
|
2013
|
+
}
|
|
2014
|
+
const { credentials, name } = plugin.manifest;
|
|
2015
|
+
if (!credentials && !plugin.manifest.apiHeaders) {
|
|
2016
|
+
throw new Error(
|
|
2017
|
+
`Provider "${name}" has no credentials or API headers configured`
|
|
2018
|
+
);
|
|
2019
|
+
}
|
|
2020
|
+
let broker;
|
|
2021
|
+
if (!credentials) {
|
|
2022
|
+
broker = createApiHeadersBroker(plugin.manifest);
|
|
2023
|
+
} else {
|
|
2024
|
+
broker = createOAuthBearerBroker(plugin.manifest, credentials, deps);
|
|
2025
|
+
}
|
|
2026
|
+
setSpanAttributes({
|
|
2027
|
+
"app.plugin.name": name,
|
|
2028
|
+
"app.plugin.capabilities": plugin.manifest.capabilities,
|
|
2029
|
+
"app.plugin.has_oauth": Boolean(plugin.manifest.oauth)
|
|
1944
2030
|
});
|
|
2031
|
+
return broker;
|
|
1945
2032
|
}
|
|
1946
|
-
}
|
|
1947
|
-
return commands;
|
|
1948
|
-
}
|
|
1949
|
-
function getPluginOAuthConfig(provider) {
|
|
1950
|
-
const plugin = ensurePluginsLoaded().pluginsByName.get(provider);
|
|
1951
|
-
if (!plugin?.manifest.oauth) return void 0;
|
|
1952
|
-
const oauth = plugin.manifest.oauth;
|
|
1953
|
-
return {
|
|
1954
|
-
clientIdEnv: oauth.clientIdEnv,
|
|
1955
|
-
clientSecretEnv: oauth.clientSecretEnv,
|
|
1956
|
-
authorizeEndpoint: oauth.authorizeEndpoint,
|
|
1957
|
-
tokenEndpoint: oauth.tokenEndpoint,
|
|
1958
|
-
...oauth.scope ? { scope: oauth.scope } : {},
|
|
1959
|
-
...oauth.authorizeParams ? { authorizeParams: { ...oauth.authorizeParams } } : {},
|
|
1960
|
-
...oauth.tokenAuthMethod ? { tokenAuthMethod: oauth.tokenAuthMethod } : {},
|
|
1961
|
-
...oauth.tokenExtraHeaders ? { tokenExtraHeaders: { ...oauth.tokenExtraHeaders } } : {},
|
|
1962
|
-
...oauth.treatEmptyScopeAsUnreported ? { treatEmptyScopeAsUnreported: true } : {},
|
|
1963
|
-
callbackPath: `/api/oauth/callback/${plugin.manifest.name}`
|
|
1964
2033
|
};
|
|
1965
2034
|
}
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
.../* @__PURE__ */ new Set([
|
|
1970
|
-
...state.pluginDefinitions.flatMap(
|
|
1971
|
-
(plugin) => plugin.skillsDir ? [plugin.skillsDir] : []
|
|
1972
|
-
),
|
|
1973
|
-
...state.packageSkillRoots
|
|
1974
|
-
])
|
|
1975
|
-
];
|
|
1976
|
-
}
|
|
1977
|
-
function getPluginForSkillPath(skillPath) {
|
|
1978
|
-
const state = ensurePluginsLoaded();
|
|
1979
|
-
const resolvedSkillPath = path.resolve(skillPath);
|
|
1980
|
-
return state.pluginDefinitions.find((plugin) => {
|
|
1981
|
-
if (!plugin.skillsDir) {
|
|
1982
|
-
return false;
|
|
1983
|
-
}
|
|
1984
|
-
const resolvedSkillsDir = path.resolve(plugin.skillsDir);
|
|
1985
|
-
return resolvedSkillPath === resolvedSkillsDir || resolvedSkillPath.startsWith(`${resolvedSkillsDir}${path.sep}`);
|
|
1986
|
-
});
|
|
1987
|
-
}
|
|
1988
|
-
function getPluginDefinition(provider) {
|
|
1989
|
-
return ensurePluginsLoaded().pluginsByName.get(provider);
|
|
1990
|
-
}
|
|
1991
|
-
function getPluginDisplayName(provider) {
|
|
1992
|
-
return ensurePluginsLoaded().pluginsByName.get(provider)?.manifest.displayName;
|
|
1993
|
-
}
|
|
1994
|
-
function isPluginProvider(provider) {
|
|
1995
|
-
return ensurePluginsLoaded().pluginsByName.has(provider);
|
|
1996
|
-
}
|
|
1997
|
-
function isPluginCapability(capability) {
|
|
1998
|
-
return ensurePluginsLoaded().capabilityToPlugin.has(capability);
|
|
1999
|
-
}
|
|
2000
|
-
function isPluginConfigKey(key) {
|
|
2001
|
-
return ensurePluginsLoaded().pluginConfigKeys.has(key);
|
|
2002
|
-
}
|
|
2003
|
-
function createPluginBroker(provider, deps) {
|
|
2004
|
-
const plugin = ensurePluginsLoaded().pluginsByName.get(provider);
|
|
2005
|
-
if (!plugin) {
|
|
2006
|
-
throw new Error(`Unknown plugin provider: "${provider}"`);
|
|
2007
|
-
}
|
|
2008
|
-
const { credentials, name } = plugin.manifest;
|
|
2009
|
-
if (!credentials && !plugin.manifest.apiHeaders) {
|
|
2010
|
-
throw new Error(
|
|
2011
|
-
`Provider "${name}" has no credentials or API headers configured`
|
|
2012
|
-
);
|
|
2013
|
-
}
|
|
2014
|
-
let broker;
|
|
2015
|
-
if (!credentials) {
|
|
2016
|
-
broker = createApiHeadersBroker(plugin.manifest);
|
|
2017
|
-
} else {
|
|
2018
|
-
broker = createOAuthBearerBroker(plugin.manifest, credentials, deps);
|
|
2019
|
-
}
|
|
2020
|
-
setSpanAttributes({
|
|
2021
|
-
"app.plugin.name": name,
|
|
2022
|
-
"app.plugin.capabilities": plugin.manifest.capabilities,
|
|
2023
|
-
"app.plugin.has_oauth": Boolean(plugin.manifest.oauth)
|
|
2024
|
-
});
|
|
2025
|
-
return broker;
|
|
2026
|
-
}
|
|
2035
|
+
|
|
2036
|
+
// src/chat/plugins/catalog-runtime.ts
|
|
2037
|
+
var pluginCatalogRuntime = createPluginCatalogRuntime();
|
|
2027
2038
|
|
|
2028
2039
|
export {
|
|
2029
2040
|
parsePluginManifest,
|
|
@@ -2035,22 +2046,5 @@ export {
|
|
|
2035
2046
|
resolveAuthTokenPlaceholder,
|
|
2036
2047
|
buildOAuthTokenRequest,
|
|
2037
2048
|
parseOAuthTokenResponse,
|
|
2038
|
-
|
|
2039
|
-
getPluginPackageContent,
|
|
2040
|
-
getPluginCatalogSignature,
|
|
2041
|
-
getPluginCapabilityProviders,
|
|
2042
|
-
getPluginProviders,
|
|
2043
|
-
getPluginMigrationRoots,
|
|
2044
|
-
getPluginMcpProviders,
|
|
2045
|
-
getPluginRuntimeDependencies,
|
|
2046
|
-
getPluginRuntimePostinstall,
|
|
2047
|
-
getPluginOAuthConfig,
|
|
2048
|
-
getPluginSkillRoots,
|
|
2049
|
-
getPluginForSkillPath,
|
|
2050
|
-
getPluginDefinition,
|
|
2051
|
-
getPluginDisplayName,
|
|
2052
|
-
isPluginProvider,
|
|
2053
|
-
isPluginCapability,
|
|
2054
|
-
isPluginConfigKey,
|
|
2055
|
-
createPluginBroker
|
|
2049
|
+
pluginCatalogRuntime
|
|
2056
2050
|
};
|