@ada-mcp/mcp-server 0.1.24 → 0.1.25
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/cli.cjs +103 -34
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -5578,15 +5578,60 @@ function isPluginModule(mod) {
|
|
|
5578
5578
|
const m = mod.manifest;
|
|
5579
5579
|
return !!m && typeof m.id === "string" && Array.isArray(m.platforms);
|
|
5580
5580
|
}
|
|
5581
|
+
function entryScriptDir() {
|
|
5582
|
+
const argv1 = process.argv[1]?.trim();
|
|
5583
|
+
if (!argv1) {
|
|
5584
|
+
return void 0;
|
|
5585
|
+
}
|
|
5586
|
+
try {
|
|
5587
|
+
return import_node_path6.default.dirname(import_node_path6.default.resolve(argv1));
|
|
5588
|
+
} catch {
|
|
5589
|
+
return void 0;
|
|
5590
|
+
}
|
|
5591
|
+
}
|
|
5581
5592
|
function resolvePluginDirs(explicitPluginDir) {
|
|
5582
|
-
const
|
|
5583
|
-
const
|
|
5593
|
+
const ordered = [];
|
|
5594
|
+
const push = (dir) => {
|
|
5595
|
+
const trimmed = dir?.trim();
|
|
5596
|
+
if (!trimmed) {
|
|
5597
|
+
return;
|
|
5598
|
+
}
|
|
5599
|
+
ordered.push(import_node_path6.default.resolve(trimmed));
|
|
5600
|
+
};
|
|
5601
|
+
push(explicitPluginDir);
|
|
5602
|
+
push(process.env.ADA_PLUGIN_DIR);
|
|
5603
|
+
const entryDir = entryScriptDir();
|
|
5604
|
+
if (entryDir) {
|
|
5605
|
+
push(import_node_path6.default.join(entryDir, "plugins"));
|
|
5606
|
+
push(import_node_path6.default.join(entryDir, "..", "plugins"));
|
|
5607
|
+
}
|
|
5608
|
+
if (typeof __filename === "string") {
|
|
5609
|
+
const fromModule = import_node_path6.default.dirname(__filename);
|
|
5610
|
+
push(import_node_path6.default.join(fromModule, "plugins"));
|
|
5611
|
+
push(import_node_path6.default.join(fromModule, "..", "plugins"));
|
|
5612
|
+
}
|
|
5613
|
+
const initCwd = process.env.INIT_CWD?.trim();
|
|
5614
|
+
if (initCwd) {
|
|
5615
|
+
push(import_node_path6.default.join(initCwd, "plugins"));
|
|
5616
|
+
push(import_node_path6.default.join(initCwd, "release", "plugins"));
|
|
5617
|
+
}
|
|
5584
5618
|
const cwd = process.cwd();
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5619
|
+
push(import_node_path6.default.join(cwd, "plugins"));
|
|
5620
|
+
push(import_node_path6.default.join(cwd, "release", "plugins"));
|
|
5621
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5622
|
+
return ordered.filter((dir) => {
|
|
5623
|
+
if (seen.has(dir)) {
|
|
5624
|
+
return false;
|
|
5625
|
+
}
|
|
5626
|
+
seen.add(dir);
|
|
5627
|
+
return true;
|
|
5628
|
+
});
|
|
5629
|
+
}
|
|
5630
|
+
function pluginDirHasModules(pluginDir) {
|
|
5631
|
+
if (!import_node_fs2.default.existsSync(pluginDir)) {
|
|
5632
|
+
return false;
|
|
5633
|
+
}
|
|
5634
|
+
return import_node_fs2.default.readdirSync(pluginDir, { withFileTypes: true }).some((ent) => ent.isFile() && (ent.name.endsWith(".cjs") || ent.name.endsWith(".js")));
|
|
5590
5635
|
}
|
|
5591
5636
|
function loadPluginFromModule(requireFn, moduleId) {
|
|
5592
5637
|
try {
|
|
@@ -5612,6 +5657,9 @@ function registerPluginsFromDirectory(host, pluginDir) {
|
|
|
5612
5657
|
if (!plugin) {
|
|
5613
5658
|
continue;
|
|
5614
5659
|
}
|
|
5660
|
+
if (host.listManifests().some((m) => m.id === plugin.manifest.id)) {
|
|
5661
|
+
continue;
|
|
5662
|
+
}
|
|
5615
5663
|
host.register(plugin);
|
|
5616
5664
|
loaded.push(plugin.manifest);
|
|
5617
5665
|
}
|
|
@@ -5631,12 +5679,14 @@ function registerPluginsFromModuleIds(host, moduleIds) {
|
|
|
5631
5679
|
return loaded;
|
|
5632
5680
|
}
|
|
5633
5681
|
function registerRuntimePlugins(host, options) {
|
|
5634
|
-
const manifests2 = [];
|
|
5635
5682
|
for (const pluginDir of resolvePluginDirs(options?.pluginDir)) {
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5683
|
+
if (!pluginDirHasModules(pluginDir)) {
|
|
5684
|
+
continue;
|
|
5685
|
+
}
|
|
5686
|
+
const loaded = registerPluginsFromDirectory(host, pluginDir);
|
|
5687
|
+
if (loaded.length > 0) {
|
|
5688
|
+
return loaded;
|
|
5689
|
+
}
|
|
5640
5690
|
}
|
|
5641
5691
|
const fallbackModuleIds = options?.moduleIds?.length ? options.moduleIds : DEFAULT_PLUGIN_MODULE_IDS;
|
|
5642
5692
|
return registerPluginsFromModuleIds(host, fallbackModuleIds);
|
|
@@ -18136,53 +18186,72 @@ var init_streamableHttp = __esm({
|
|
|
18136
18186
|
});
|
|
18137
18187
|
|
|
18138
18188
|
// src/executor.ts
|
|
18139
|
-
function
|
|
18140
|
-
if (process.env.ADA_PLUGIN_DIR?.trim()) {
|
|
18141
|
-
return;
|
|
18142
|
-
}
|
|
18189
|
+
function resolveBundledPluginDir() {
|
|
18143
18190
|
const candidates = [];
|
|
18144
|
-
|
|
18145
|
-
|
|
18146
|
-
|
|
18147
|
-
|
|
18191
|
+
const argv1 = process.argv[1]?.trim();
|
|
18192
|
+
if (argv1) {
|
|
18193
|
+
const entryDir = import_node_path11.default.dirname(import_node_path11.default.resolve(argv1));
|
|
18194
|
+
candidates.push(import_node_path11.default.join(entryDir, "plugins"));
|
|
18195
|
+
candidates.push(import_node_path11.default.join(entryDir, "..", "plugins"));
|
|
18148
18196
|
}
|
|
18149
18197
|
const dirname = globalThis.__dirname;
|
|
18150
18198
|
if (typeof dirname === "string") {
|
|
18199
|
+
candidates.push(import_node_path11.default.join(dirname, "plugins"));
|
|
18151
18200
|
candidates.push(import_node_path11.default.join(dirname, "..", "plugins"));
|
|
18152
18201
|
}
|
|
18202
|
+
try {
|
|
18203
|
+
const here = import_node_path11.default.dirname((0, import_node_url3.fileURLToPath)(import_meta.url));
|
|
18204
|
+
candidates.push(import_node_path11.default.join(here, "plugins"));
|
|
18205
|
+
candidates.push(import_node_path11.default.join(here, "..", "plugins"));
|
|
18206
|
+
} catch {
|
|
18207
|
+
}
|
|
18208
|
+
const seen = /* @__PURE__ */ new Set();
|
|
18153
18209
|
for (const dir of candidates) {
|
|
18154
|
-
|
|
18155
|
-
|
|
18156
|
-
|
|
18210
|
+
const resolved = import_node_path11.default.resolve(dir);
|
|
18211
|
+
if (seen.has(resolved) || !(0, import_node_fs4.existsSync)(resolved)) {
|
|
18212
|
+
continue;
|
|
18157
18213
|
}
|
|
18214
|
+
seen.add(resolved);
|
|
18215
|
+
return resolved;
|
|
18158
18216
|
}
|
|
18217
|
+
return void 0;
|
|
18159
18218
|
}
|
|
18160
|
-
function
|
|
18161
|
-
|
|
18219
|
+
function getPluginHost() {
|
|
18220
|
+
if (sharedHost) {
|
|
18221
|
+
return sharedHost;
|
|
18222
|
+
}
|
|
18223
|
+
const bundledDir = resolveBundledPluginDir();
|
|
18162
18224
|
const host = new PluginHost();
|
|
18163
|
-
registerRuntimePlugins(host);
|
|
18225
|
+
registerRuntimePlugins(host, bundledDir ? { pluginDir: bundledDir } : void 0);
|
|
18226
|
+
sharedHost = host;
|
|
18164
18227
|
return host;
|
|
18165
18228
|
}
|
|
18229
|
+
function getExecutor() {
|
|
18230
|
+
if (!sharedExecutor) {
|
|
18231
|
+
sharedExecutor = new TaskExecutor(getPluginHost());
|
|
18232
|
+
}
|
|
18233
|
+
return sharedExecutor;
|
|
18234
|
+
}
|
|
18166
18235
|
async function runCommand3(command) {
|
|
18167
|
-
return
|
|
18236
|
+
return getExecutor().execute(command);
|
|
18168
18237
|
}
|
|
18169
18238
|
async function runTaskset2(commands) {
|
|
18170
18239
|
const results = [];
|
|
18171
18240
|
for (const command of commands) {
|
|
18172
|
-
results.push(await
|
|
18241
|
+
results.push(await runCommand3(command));
|
|
18173
18242
|
}
|
|
18174
18243
|
return results;
|
|
18175
18244
|
}
|
|
18176
18245
|
function listActiveSessions() {
|
|
18177
|
-
return
|
|
18246
|
+
return getExecutor().listSessions();
|
|
18178
18247
|
}
|
|
18179
18248
|
async function closeSession(platform, sessionId, options) {
|
|
18180
|
-
return
|
|
18249
|
+
return getExecutor().closeSession(platform, sessionId, options);
|
|
18181
18250
|
}
|
|
18182
18251
|
async function closeAllSessions() {
|
|
18183
|
-
return
|
|
18252
|
+
return getExecutor().closeAllSessions();
|
|
18184
18253
|
}
|
|
18185
|
-
var import_node_fs4, import_node_path11, import_node_url3, import_meta,
|
|
18254
|
+
var import_node_fs4, import_node_path11, import_node_url3, import_meta, sharedHost, sharedExecutor;
|
|
18186
18255
|
var init_executor = __esm({
|
|
18187
18256
|
"src/executor.ts"() {
|
|
18188
18257
|
"use strict";
|
|
@@ -18192,8 +18261,8 @@ var init_executor = __esm({
|
|
|
18192
18261
|
init_src7();
|
|
18193
18262
|
init_src4();
|
|
18194
18263
|
import_meta = {};
|
|
18195
|
-
|
|
18196
|
-
sharedExecutor =
|
|
18264
|
+
sharedHost = null;
|
|
18265
|
+
sharedExecutor = null;
|
|
18197
18266
|
}
|
|
18198
18267
|
});
|
|
18199
18268
|
|