Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

fix(agntcy): report SDKs missing the command API as not configured (#4409)

ordinary being11e4c2beb292
diff --git a/v3/@claude-flow/cli/__tests__/agntcy/agntcy-commands.test.ts b/v3/@claude-flow/cli/__tests__/agntcy/agntcy-commands.test.ts
index dab1ebd6b8..3ed240bc9b 100644
--- a/v3/@claude-flow/cli/__tests__/agntcy/agntcy-commands.test.ts
+++ b/v3/@claude-flow/cli/__tests__/agntcy/agntcy-commands.test.ts
@@ -86,6 +86,17 @@ describe('agntcy command scaffold (ADR-380) — not-configured fallback', () =>
expect(status.reason).toMatch(/resolved/);
});
+ it('reports not configured when the installed SDK lacks the required export', async () => {
+ const status = await detectAgntcyRuntime(
+ { [AGNTCY_ENDPOINT_ENV]: 'https://slim.example.com' },
+ 'node:fs',
+ ['createSlimTransport'],
+ );
+ expect(status.configured).toBe(false);
+ expect(status.reason).toMatch(/does not export createSlimTransport/);
+ expect(status.endpoint).toBe('https://slim.example.com');
+ });
+
it('still degrades gracefully if the optional package genuinely is not installed', async () => {
// Regression guard for the "works without AGNTCY installed" contract
// this file's header describes — simulate a MODULE_NOT_FOUND by
diff --git a/v3/@claude-flow/cli/src/commands/agntcy/publish.ts b/v3/@claude-flow/cli/src/commands/agntcy/publish.ts
index 8154ca5c48..159ba751cf 100644
--- a/v3/@claude-flow/cli/src/commands/agntcy/publish.ts
+++ b/v3/@claude-flow/cli/src/commands/agntcy/publish.ts
@@ -124,7 +124,7 @@ const publishCommand: Command = {
// Step 2 (stub, requires the not-yet-published runtime): the actual
// Directory publish call.
- const status = await detectAgntcyRuntime();
+ const status = await detectAgntcyRuntime(process.env, AGNTCY_PACKAGE_NAME, ['publishAgentRecord']);
if (!status.configured) {
output.printInfo(AGNTCY_NOT_CONFIGURED_MESSAGE);
diff --git a/v3/@claude-flow/cli/src/commands/agntcy/runtime.ts b/v3/@claude-flow/cli/src/commands/agntcy/runtime.ts
index 4256e26c72..301ea8f5da 100644
--- a/v3/@claude-flow/cli/src/commands/agntcy/runtime.ts
+++ b/v3/@claude-flow/cli/src/commands/agntcy/runtime.ts
@@ -115,10 +115,14 @@ export interface AgntcyRuntimeStatus {
* @param packageName Injectable for tests (to simulate "package not
* installed" without needing to actually uninstall the real optional
* dependency); defaults to {@link AGNTCY_PACKAGE_NAME}.
+ * @param requiredExports Function names the caller will use. A resolved module
+ * missing any of them is reported as not configured, with the missing names
+ * in `reason`, instead of failing later at the call site.
*/
export async function detectAgntcyRuntime(
env: NodeJS.ProcessEnv = process.env,
packageName: string = AGNTCY_PACKAGE_NAME,
+ requiredExports: readonly string[] = [],
): Promise<AgntcyRuntimeStatus> {
const endpoint = env[AGNTCY_ENDPOINT_ENV];
if (!endpoint) {
@@ -131,7 +135,19 @@ export async function detectAgntcyRuntime(
// `await import('pg')`). Never a static `import` — a static import
// would make @claude-flow/cli fail to build/run when the package is
// absent, which is the one thing ADR-150/ADR-380 forbid.
- await import(packageName);
+ const mod = await import(packageName);
+ if (requiredExports.length > 0) {
+ const missing = requiredExports.filter(
+ (name) => typeof (mod as Record<string, unknown>)[name] !== 'function',
+ );
+ if (missing.length > 0) {
+ return {
+ configured: false,
+ reason: `${packageName} resolved but does not export ${missing.join(', ')}; the installed SDK API is not the one this command implements`,
+ endpoint,
+ };
+ }
+ }
return { configured: true, reason: `${packageName} resolved`, endpoint };
} catch (error) {
const code = (error as NodeJS.ErrnoException | undefined)?.code;
diff --git a/v3/@claude-flow/cli/src/commands/agntcy/swarm-join.ts b/v3/@claude-flow/cli/src/commands/agntcy/swarm-join.ts
index 40cb185338..152899382b 100644
--- a/v3/@claude-flow/cli/src/commands/agntcy/swarm-join.ts
+++ b/v3/@claude-flow/cli/src/commands/agntcy/swarm-join.ts
@@ -69,7 +69,7 @@ const joinCommand: Command = {
return { success: false, exitCode: 1 };
}
- const status = await detectAgntcyRuntime();
+ const status = await detectAgntcyRuntime(process.env, AGNTCY_PACKAGE_NAME, ['joinGroup']);
if (!status.configured) {
output.printInfo(AGNTCY_NOT_CONFIGURED_MESSAGE);
diff --git a/v3/@claude-flow/cli/src/commands/agntcy/transport.ts b/v3/@claude-flow/cli/src/commands/agntcy/transport.ts
index 5a2082495c..b696ba0111 100644
--- a/v3/@claude-flow/cli/src/commands/agntcy/transport.ts
+++ b/v3/@claude-flow/cli/src/commands/agntcy/transport.ts
@@ -54,7 +54,7 @@ const useCommand: Command = {
return { success: false, exitCode: 1 };
}
- const status = await detectAgntcyRuntime();
+ const status = await detectAgntcyRuntime(process.env, AGNTCY_PACKAGE_NAME, ['createSlimTransport']);
if (!status.configured) {
output.printInfo(AGNTCY_NOT_CONFIGURED_MESSAGE);