agents-relay 2.0.15 → 2.0.16
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-support.js +10 -5
- package/package.json +1 -1
package/dist/cli-support.js
CHANGED
|
@@ -102,22 +102,27 @@ export async function resolveEventBus(args, probe) {
|
|
|
102
102
|
const explicit = hasArg(args, '--events');
|
|
103
103
|
const requested = arg(args, '--events');
|
|
104
104
|
const natsUrl = arg(args, '--nats-url', process.env.NEO_NATS_URL || 'nats://127.0.0.1:4222');
|
|
105
|
+
if (!explicit && hasArg(args, '--file'))
|
|
106
|
+
return { bus: undefined, transport: 'none', source: 'local', natsUrl };
|
|
105
107
|
if (explicit && requested !== 'nats')
|
|
106
108
|
return { bus: undefined, transport: 'none', source: 'explicit', natsUrl };
|
|
107
109
|
const bus = new NatsEventBus(natsUrl, arg(args, '--subject-prefix', 'neo.events.job'));
|
|
108
110
|
if (explicit)
|
|
109
111
|
return { bus, transport: 'nats', source: 'explicit', natsUrl };
|
|
110
112
|
const reachable = probe ? await probe(bus) : await bus.ping().then(() => true, () => false);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
await bus.close().catch(() => undefined);
|
|
114
|
+
if (!reachable)
|
|
113
115
|
return { bus: undefined, transport: 'none', source: 'unavailable', natsUrl };
|
|
114
|
-
}
|
|
115
|
-
return { bus, transport: 'nats', source: 'auto', natsUrl };
|
|
116
|
+
return { bus: new NatsEventBus(natsUrl, arg(args, '--subject-prefix', 'neo.events.job')), transport: 'nats', source: 'auto', natsUrl };
|
|
116
117
|
}
|
|
117
118
|
export function eventBusResolutionMessage(resolution) {
|
|
118
119
|
if (resolution.transport === 'nats')
|
|
119
120
|
return `event transport: nats (${resolution.source === 'auto' ? 'auto-detected' : 'explicit'})`;
|
|
120
|
-
|
|
121
|
+
if (resolution.source === 'explicit')
|
|
122
|
+
return 'event transport: none (explicit)';
|
|
123
|
+
if (resolution.source === 'local')
|
|
124
|
+
return 'event transport: none (local mode)';
|
|
125
|
+
return 'event transport: none (NATS unavailable)';
|
|
121
126
|
}
|
|
122
127
|
export async function eventBus(args) {
|
|
123
128
|
const resolution = await resolveEventBus(args);
|