@zibby/core 0.1.8 → 0.1.9
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 +1 -1
- package/src/index.js +10 -7
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -101,7 +101,8 @@ export async function runTest(specPath, config = {}) {
|
|
|
101
101
|
const testSpec = readFileSync(specPath, 'utf-8');
|
|
102
102
|
|
|
103
103
|
const adapter = null;
|
|
104
|
-
|
|
104
|
+
const { agent: localAgent, error: localAgentError } = await loadLocalAgent(cwd, agentConfig);
|
|
105
|
+
let agent = localAgent;
|
|
105
106
|
|
|
106
107
|
if (!agent && config.fallbackAgentModule) {
|
|
107
108
|
const mod = config.fallbackAgentModule;
|
|
@@ -111,6 +112,10 @@ export async function runTest(specPath, config = {}) {
|
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
|
|
115
|
+
if (!agent && localAgentError) {
|
|
116
|
+
console.warn(`⚠️ Failed to load local agent: ${localAgentError}`);
|
|
117
|
+
}
|
|
118
|
+
|
|
114
119
|
if (!agent) {
|
|
115
120
|
throw new Error(
|
|
116
121
|
`No agent found. Please run:\n` +
|
|
@@ -271,7 +276,7 @@ async function loadLocalAgent(cwd, config) {
|
|
|
271
276
|
const localAgentPath = pathJoin(cwd, '.zibby/graph.js');
|
|
272
277
|
|
|
273
278
|
if (!fsExistsSync(localAgentPath)) {
|
|
274
|
-
return null;
|
|
279
|
+
return { agent: null, error: null };
|
|
275
280
|
}
|
|
276
281
|
|
|
277
282
|
const agentModule = await import(pathToFileURL(localAgentPath).href);
|
|
@@ -311,8 +316,7 @@ async function loadLocalAgent(cwd, config) {
|
|
|
311
316
|
}
|
|
312
317
|
|
|
313
318
|
if (!AgentClass) {
|
|
314
|
-
|
|
315
|
-
return null;
|
|
319
|
+
return { agent: null, error: 'Could not find any WorkflowAgent export in local graph.js' };
|
|
316
320
|
}
|
|
317
321
|
|
|
318
322
|
if (!AgentClass.name?.includes('auto-detected')) {
|
|
@@ -320,10 +324,9 @@ async function loadLocalAgent(cwd, config) {
|
|
|
320
324
|
}
|
|
321
325
|
}
|
|
322
326
|
|
|
323
|
-
return new AgentClass(config);
|
|
327
|
+
return { agent: new AgentClass(config), error: null };
|
|
324
328
|
} catch (error) {
|
|
325
|
-
|
|
326
|
-
return null;
|
|
329
|
+
return { agent: null, error: error.message };
|
|
327
330
|
}
|
|
328
331
|
}
|
|
329
332
|
|