@myvillage/cli 1.23.1 → 1.23.3
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/package.json
CHANGED
|
@@ -37,9 +37,24 @@ export async function getMCPTools(agentDir, agentConfig) {
|
|
|
37
37
|
|
|
38
38
|
try {
|
|
39
39
|
// AI SDK v6 moved the MCP client into a separate package
|
|
40
|
-
// (`@ai-sdk/mcp`).
|
|
41
|
-
//
|
|
42
|
-
|
|
40
|
+
// (`@ai-sdk/mcp`). Walk through every plausible export shape so we
|
|
41
|
+
// survive ESM-vs-CJS interop quirks and future renames — and if
|
|
42
|
+
// none match, throw a *useful* error listing what the module
|
|
43
|
+
// actually exposes instead of the cryptic "X is not a function".
|
|
44
|
+
const mcpModule = await import('@ai-sdk/mcp');
|
|
45
|
+
const createMCPClient =
|
|
46
|
+
mcpModule.experimental_createMCPClient
|
|
47
|
+
?? mcpModule.createMCPClient
|
|
48
|
+
?? mcpModule.default?.experimental_createMCPClient
|
|
49
|
+
?? mcpModule.default?.createMCPClient;
|
|
50
|
+
if (typeof createMCPClient !== 'function') {
|
|
51
|
+
throw new Error(
|
|
52
|
+
`@ai-sdk/mcp loaded but no createMCPClient export found. `
|
|
53
|
+
+ `Module exports: [${Object.keys(mcpModule).sort().join(', ') || '(empty)'}]. `
|
|
54
|
+
+ `If you upgraded the CLI via 'npm update', try a clean reinstall: `
|
|
55
|
+
+ `npm uninstall -g @myvillage/cli && npm install -g @myvillage/cli`
|
|
56
|
+
);
|
|
57
|
+
}
|
|
43
58
|
let client;
|
|
44
59
|
|
|
45
60
|
if (server.url) {
|
|
@@ -430,7 +430,15 @@ export async function agentStartCommand(name) {
|
|
|
430
430
|
}
|
|
431
431
|
console.log(brand.teal(` Logs: myvillage agent logs ${name}\n`));
|
|
432
432
|
} else {
|
|
433
|
-
spinner.fail(`Agent "${name}" failed to start
|
|
433
|
+
spinner.fail(`Agent "${name}" failed to start.`);
|
|
434
|
+
// Try to surface the most recent error log entry so the developer
|
|
435
|
+
// doesn't have to dig through a JSONL file by hand.
|
|
436
|
+
const recent = readAgentLogs(name, { limit: 30 });
|
|
437
|
+
const lastError = [...recent].reverse().find(e => e.type === 'error');
|
|
438
|
+
if (lastError?.error) {
|
|
439
|
+
console.log(chalk.red(` ${lastError.error}`));
|
|
440
|
+
}
|
|
441
|
+
console.log(brand.teal(` Full logs: myvillage agent logs ${name}\n`));
|
|
434
442
|
}
|
|
435
443
|
} catch (err) {
|
|
436
444
|
spinner.fail(`Failed to start agent: ${err.message}`);
|