Phase 3. - server.mjs loads only site.agents.enabled, passing per-agent settings - each console agent exports a manifest + register(host, settings); QA reads heartbeatMin/autofix from settings (env fallback) - catalog.mjs folds the runtime (console) agents into agents.json/AGENTS.md via their manifest exports — one registry for pipeline + runtime agents Verified: disabling 'qa' in the roster removes /qa/run + the heartbeat.
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* AstroAgent console runner — bootstrap.
|
|
*
|
|
* Loads the generic host, then registers ONLY the agents this project enables
|
|
* (astroagent.config.json → agents.enabled, exposed via site.agents), passing
|
|
* each its per-agent settings. Each capability is a module under ./agents/
|
|
* exporting register(host, settings).
|
|
*
|
|
* Runs AS the confined agent user, binds 127.0.0.1, reached only through nginx
|
|
* (auth_request against the PHP admin session). Node built-ins only.
|
|
*/
|
|
|
|
import { host } from "./host.mjs";
|
|
import { site } from "./site.mjs";
|
|
|
|
const { enabled, settings } = site.agents;
|
|
|
|
for (const name of enabled) {
|
|
try {
|
|
const mod = await import(`./agents/${name}.mjs`);
|
|
if (typeof mod.register === "function") {
|
|
mod.register(host, settings[name] || {});
|
|
console.log(`[console] agent enabled: ${name}`);
|
|
} else {
|
|
console.warn(`[console] agent '${name}' has no register() — skipped`);
|
|
}
|
|
} catch (err) {
|
|
console.error(`[console] agent '${name}' failed to load: ${err.message}`);
|
|
}
|
|
}
|
|
|
|
host.listen();
|