Add demo operator scaffold and CLI
This commit is contained in:
28
src/demo-operator/demoRunner.ts
Normal file
28
src/demo-operator/demoRunner.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { InMemoryDemoEventBus } from "./demoEventBus";
|
||||
import { DemoJournal } from "./demoJournal";
|
||||
import { createDemoAgents } from "./demoRegistry";
|
||||
|
||||
export async function startDemo() {
|
||||
const bus = new InMemoryDemoEventBus();
|
||||
const journal = new DemoJournal();
|
||||
|
||||
const agents = createDemoAgents();
|
||||
|
||||
const ctx = {
|
||||
bus,
|
||||
journal,
|
||||
log: (msg: string, meta?: unknown) => {
|
||||
if (meta) {
|
||||
console.log(`[DEMO] ${msg}`, meta);
|
||||
} else {
|
||||
console.log(`[DEMO] ${msg}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
for (const agent of agents) {
|
||||
await agent.init(ctx);
|
||||
}
|
||||
|
||||
return { bus, journal, agents };
|
||||
}
|
||||
Reference in New Issue
Block a user