2026-07-23 20:53:32 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
/**
|
framework(core): split console runner into host + pluggable agent modules
Phase 1 of the standalone agent framework. Pure refactor, behaviour identical:
- host.mjs: shared runtime (route registry, one runClaudeJson/runClaudeStream
replacing 5 inline spawns, build/git/phpCli, SSE job model, scheduler, core
/ping /auth /logout)
- agents/{in-page-console,project-builder,web-designer,qa}.mjs: each exports
register(host), owns its routes/triggers/persona
- server.mjs: bootstrap that loads host + registers agents
- web-designer exposes host.drainTasks; qa autofix kicks it
Verified: QA pass, Web Designer queue task, heartbeat, all endpoints.
2026-07-24 11:50:26 +00:00
|
|
|
* AstroAgent console runner — bootstrap.
|
2026-07-23 20:53:32 +00:00
|
|
|
*
|
2026-07-24 12:03:00 +00:00
|
|
|
* 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).
|
2026-07-23 20:53:32 +00:00
|
|
|
*
|
2026-07-24 12:03:00 +00:00
|
|
|
* 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.
|
2026-07-23 20:53:32 +00:00
|
|
|
*/
|
|
|
|
|
|
framework(core): split console runner into host + pluggable agent modules
Phase 1 of the standalone agent framework. Pure refactor, behaviour identical:
- host.mjs: shared runtime (route registry, one runClaudeJson/runClaudeStream
replacing 5 inline spawns, build/git/phpCli, SSE job model, scheduler, core
/ping /auth /logout)
- agents/{in-page-console,project-builder,web-designer,qa}.mjs: each exports
register(host), owns its routes/triggers/persona
- server.mjs: bootstrap that loads host + registers agents
- web-designer exposes host.drainTasks; qa autofix kicks it
Verified: QA pass, Web Designer queue task, heartbeat, all endpoints.
2026-07-24 11:50:26 +00:00
|
|
|
import { host } from "./host.mjs";
|
2026-07-24 12:03:00 +00:00
|
|
|
import { site } from "./site.mjs";
|
|
|
|
|
|
|
|
|
|
const { enabled, settings } = site.agents;
|
2026-07-23 20:53:32 +00:00
|
|
|
|
2026-07-24 12:03:00 +00:00
|
|
|
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}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-07-24 09:47:29 +00:00
|
|
|
|
framework(core): split console runner into host + pluggable agent modules
Phase 1 of the standalone agent framework. Pure refactor, behaviour identical:
- host.mjs: shared runtime (route registry, one runClaudeJson/runClaudeStream
replacing 5 inline spawns, build/git/phpCli, SSE job model, scheduler, core
/ping /auth /logout)
- agents/{in-page-console,project-builder,web-designer,qa}.mjs: each exports
register(host), owns its routes/triggers/persona
- server.mjs: bootstrap that loads host + registers agents
- web-designer exposes host.drainTasks; qa autofix kicks it
Verified: QA pass, Web Designer queue task, heartbeat, all endpoints.
2026-07-24 11:50:26 +00:00
|
|
|
host.listen();
|