agent-nuvira 1.18.0 โ†’ 1.19.0

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/README.md CHANGED
@@ -1339,7 +1339,7 @@ npx tsc --noEmit
1339
1339
 
1340
1340
  **Phases 1โ€“3 (25 phases) are complete.** Phase 4 (Industry Standards & Autonomous Polish) is in progress. See [UPGRADE_ROADMAP.md](./UPGRADE_ROADMAP.md) for the full implementation journey.
1341
1341
 
1342
- > ๐Ÿ“Š **Product strategy and pitch materials:** [PRODUCT_STRATEGY.md](./PRODUCT_STRATEGY.md) โ€” Competitive landscape, positioning map, OKR framework, and risk register. [PITCH_DECK.md](./PITCH_DECK.md) โ€” 10-slide investor presentation outline with talking points and data.
1342
+ > ๐Ÿ“Š **Architecture, strategy & contribution materials:** [ARCHITECTURE.md](./ARCHITECTURE.md) โ€” Modular execution engine design with 7 module specifications, extensibility/observability systems, and phased migration plan. [ARCHITECTURE_DIAGRAMS.md](./ARCHITECTURE_DIAGRAMS.md) โ€” Mermaid-rendered versions of all architecture diagrams (Module Architecture, Extensibility, Safe Execution, Data Flow, Observability Bus). [PRODUCT_STRATEGY.md](./PRODUCT_STRATEGY.md) โ€” Competitive landscape, positioning map, OKR framework, and risk register. [PITCH_DECK.md](./PITCH_DECK.md) โ€” 10-slide investor presentation outline with talking points and data. [CONTRIBUTING.md](./CONTRIBUTING.md) โ€” Quick-reference contributor guide with docs map, dev setup, and contribution workflow.
1343
1343
 
1344
1344
  | Phase | Feature | Status |
1345
1345
  |---|---|---|
@@ -0,0 +1,128 @@
1
+ /**
2
+ * ModuleRegistry โ€” Plugin-based module loading system for the agent execution engine.
3
+ *
4
+ * Replaces the hardcoded `createAgent()` switch statement with a registry that
5
+ * allows modules (agents) to be registered, discovered, and loaded at runtime.
6
+ * Built-in agents are pre-registered; custom agents can be added by plugins
7
+ * or via the SDK's `registerAgent()` function.
8
+ *
9
+ * @see ARCHITECTURE.md ยง4.1 โ€” Extensibility System
10
+ */
11
+ import { Agent } from './agent.js';
12
+ import type { EventBus } from '../observability/event-bus.js';
13
+ /** Factory function that creates a new Agent instance */
14
+ export type AgentFactory = () => Agent;
15
+ /** Metadata about a registered module */
16
+ export interface ModuleMetadata {
17
+ /** The agent type string used in task plans (e.g. 'planner', 'writer') */
18
+ agentType: string;
19
+ /** Human-readable name of the agent (e.g. 'Planner', 'Writer') */
20
+ name: string;
21
+ /** Short description of what this agent does */
22
+ description: string;
23
+ /** Emoji icon for the spinner / UI display */
24
+ icon: string;
25
+ /** Whether this module is built-in (true) or added by a plugin (false) */
26
+ isBuiltin: boolean;
27
+ }
28
+ /** Error thrown when a module lookup fails */
29
+ export declare class ModuleNotFoundError extends Error {
30
+ constructor(agentType: string);
31
+ }
32
+ /**
33
+ * ModuleRegistry โ€” Central registry for agent modules.
34
+ *
35
+ * Manages a collection of agent factories with metadata. Supports lookup,
36
+ * listing, and dynamic registration at runtime.
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * const registry = ModuleRegistry.createWithBuiltins();
41
+ * const planner = registry.getModule('planner'); // โ†’ PlannerAgent instance
42
+ * ```
43
+ */
44
+ export declare class ModuleRegistry {
45
+ /** Agent factory functions, keyed by agentType */
46
+ private factories;
47
+ /** Module metadata, keyed by agentType */
48
+ private metadata;
49
+ /** The event bus for emitting observability events */
50
+ private eventBus;
51
+ constructor(eventBus?: EventBus);
52
+ /**
53
+ * Register an agent module with the registry.
54
+ *
55
+ * @param agentType - The agent type string used in task plans
56
+ * @param factory - Factory function that returns a new Agent instance
57
+ * @param meta - Metadata describing the module
58
+ *
59
+ * @throws {Error} If `agentType` is already registered (use `override` to replace)
60
+ */
61
+ register(agentType: string, factory: AgentFactory, meta: Omit<ModuleMetadata, 'agentType' | 'isBuiltin'> & {
62
+ isBuiltin?: boolean;
63
+ }): void;
64
+ /**
65
+ * Register an agent module, silently replacing any existing registration.
66
+ * Useful for plugin overrides and hot-reload scenarios.
67
+ */
68
+ registerOrOverride(agentType: string, factory: AgentFactory, meta: Omit<ModuleMetadata, 'agentType' | 'isBuiltin'> & {
69
+ isBuiltin?: boolean;
70
+ }): void;
71
+ /**
72
+ * Unregister an agent module.
73
+ * Safe to call for non-existent agent types (no-op).
74
+ */
75
+ unregister(agentType: string): boolean;
76
+ /**
77
+ * Get an Agent instance for the given agent type.
78
+ *
79
+ * @param agentType - The agent type string (e.g. 'planner', 'writer')
80
+ * @returns A new Agent instance
81
+ * @throws {ModuleNotFoundError} If no module is registered for `agentType`
82
+ */
83
+ getModule(agentType: string): Agent;
84
+ /**
85
+ * Check if an agent type is registered.
86
+ */
87
+ hasModule(agentType: string): boolean;
88
+ /**
89
+ * Get metadata for a registered agent type.
90
+ * Returns undefined if the agent type is not registered.
91
+ */
92
+ getMetadata(agentType: string): ModuleMetadata | undefined;
93
+ /**
94
+ * List all registered modules, optionally filtered by a predicate.
95
+ */
96
+ listModules(filter?: (meta: ModuleMetadata) => boolean): ModuleMetadata[];
97
+ /**
98
+ * Get the icon for an agent type, or a default icon if not found.
99
+ */
100
+ getIcon(agentType: string): string;
101
+ /**
102
+ * Get the number of registered modules.
103
+ */
104
+ get size(): number;
105
+ /**
106
+ * Create a ModuleRegistry pre-populated with all built-in agents.
107
+ */
108
+ static createWithBuiltins(eventBus?: EventBus): ModuleRegistry;
109
+ }
110
+ /**
111
+ * Get or create the global ModuleRegistry singleton.
112
+ *
113
+ * First call creates a registry with all built-in agents pre-registered.
114
+ * Subsequent calls return the same instance.
115
+ * Use `resetModuleRegistry()` to clear and re-initialize (useful in tests).
116
+ */
117
+ export declare function getModuleRegistry(): ModuleRegistry;
118
+ /**
119
+ * Reset the global module registry.
120
+ * Primarily useful in tests to get a clean slate.
121
+ */
122
+ export declare function resetModuleRegistry(): void;
123
+ /**
124
+ * Set the global module registry (for dependency injection in tests).
125
+ * Returns the previous registry instance (or null).
126
+ */
127
+ export declare function setModuleRegistry(registry: ModuleRegistry): ModuleRegistry | null;
128
+ //# sourceMappingURL=module-regist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AAC,EAAE,OAAO,CAAA;KAAE,GAC9E,IAAI;IAiBP;;;OAGG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAetC;;;;;;OAMG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK;IAQnC;;OAEG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAIrC;;;OAGG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAI1D;;OAEG;IACH,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,OAAO,GAAG,cAAc,EAAE;IAKzE;;OAEG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAIlC;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAID;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,cAAc;CAiG/D;AAMD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CAKlD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,cAAc,GAAG,cAAc,GAAG,IAAI,CAIjF"}
@@ -0,0 +1,282 @@
1
+ /**
2
+ * ModuleRegistry โ€” Plugin-based module loading system for the agent execution engine.
3
+ *
4
+ * Replaces the hardcoded `createAgent()` switch statement with a registry that
5
+ * allows modules (agents) to be registered, discovered, and loaded at runtime.
6
+ * Built-in agents are pre-registered; custom agents can be added by plugins
7
+ * or via the SDK's `registerAgent()` function.
8
+ *
9
+ * @see ARCHITECTURE.md ยง4.1 โ€” Extensibility System
10
+ */
11
+ import { PlannerAgent } from './agents/planner.js';
12
+ import { ContextGathererAgent } from './agents/context-gatherer.js';
13
+ import { WriterAgent } from './agents/writer.js';
14
+ import { ReviewerAgent } from './agents/reviewer.js';
15
+ import { RunnerAgent } from './agents/runner.js';
16
+ import { TesterAgent } from './agents/tester.js';
17
+ import { DebuggerAgent } from './agents/debugger.js';
18
+ import { GitAgent } from './agents/git-agent.js';
19
+ import { PackageAgent } from './agents/package-agent.js';
20
+ import { GitHubReleaseAgent } from './agents/github-release-agent.js';
21
+ import { SecurityAgent } from './agents/security-agent.js';
22
+ import { SkillRunnerAgent } from './agents/skill-runner.js';
23
+ import { MCPAgent } from './agents/mcp-agent.js';
24
+ import { getEventBus, EventNames } from '../observability/event-bus.js';
25
+ /** Error thrown when a module lookup fails */
26
+ export class ModuleNotFoundError extends Error {
27
+ constructor(agentType) {
28
+ super(`No module registered for agent type: '${agentType}'`);
29
+ this.name = 'ModuleNotFoundError';
30
+ }
31
+ }
32
+ // โ”€โ”€โ”€ Registry Class โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
33
+ /**
34
+ * ModuleRegistry โ€” Central registry for agent modules.
35
+ *
36
+ * Manages a collection of agent factories with metadata. Supports lookup,
37
+ * listing, and dynamic registration at runtime.
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * const registry = ModuleRegistry.createWithBuiltins();
42
+ * const planner = registry.getModule('planner'); // โ†’ PlannerAgent instance
43
+ * ```
44
+ */
45
+ export class ModuleRegistry {
46
+ /** Agent factory functions, keyed by agentType */
47
+ factories = new Map();
48
+ /** Module metadata, keyed by agentType */
49
+ metadata = new Map();
50
+ /** The event bus for emitting observability events */
51
+ eventBus;
52
+ constructor(eventBus) {
53
+ this.eventBus = eventBus ?? getEventBus();
54
+ }
55
+ // โ”€โ”€ Registration โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
56
+ /**
57
+ * Register an agent module with the registry.
58
+ *
59
+ * @param agentType - The agent type string used in task plans
60
+ * @param factory - Factory function that returns a new Agent instance
61
+ * @param meta - Metadata describing the module
62
+ *
63
+ * @throws {Error} If `agentType` is already registered (use `override` to replace)
64
+ */
65
+ register(agentType, factory, meta) {
66
+ if (this.factories.has(agentType)) {
67
+ throw new Error(`Agent type '${agentType}' is already registered. Use unregister() first to replace.`);
68
+ }
69
+ this.factories.set(agentType, factory);
70
+ this.metadata.set(agentType, {
71
+ agentType,
72
+ name: meta.name,
73
+ description: meta.description,
74
+ icon: meta.icon,
75
+ isBuiltin: meta.isBuiltin ?? false,
76
+ });
77
+ this.eventBus.emit(EventNames.REGISTRY_MODULE_REGISTERED, {
78
+ agentType,
79
+ name: meta.name,
80
+ isBuiltin: meta.isBuiltin ?? false,
81
+ }, 'module-registry');
82
+ }
83
+ /**
84
+ * Register an agent module, silently replacing any existing registration.
85
+ * Useful for plugin overrides and hot-reload scenarios.
86
+ */
87
+ registerOrOverride(agentType, factory, meta) {
88
+ this.factories.set(agentType, factory);
89
+ this.metadata.set(agentType, {
90
+ agentType,
91
+ name: meta.name,
92
+ description: meta.description,
93
+ icon: meta.icon,
94
+ isBuiltin: meta.isBuiltin ?? false,
95
+ });
96
+ this.eventBus.emit(EventNames.REGISTRY_MODULE_REGISTERED, {
97
+ agentType,
98
+ name: meta.name,
99
+ isBuiltin: meta.isBuiltin ?? false,
100
+ }, 'module-registry');
101
+ }
102
+ /**
103
+ * Unregister an agent module.
104
+ * Safe to call for non-existent agent types (no-op).
105
+ */
106
+ unregister(agentType) {
107
+ const hadFactory = this.factories.delete(agentType);
108
+ this.metadata.delete(agentType);
109
+ if (hadFactory) {
110
+ this.eventBus.emit(EventNames.REGISTRY_MODULE_UNREGISTERED, {
111
+ agentType,
112
+ }, 'module-registry');
113
+ }
114
+ return hadFactory;
115
+ }
116
+ // โ”€โ”€ Lookup โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
117
+ /**
118
+ * Get an Agent instance for the given agent type.
119
+ *
120
+ * @param agentType - The agent type string (e.g. 'planner', 'writer')
121
+ * @returns A new Agent instance
122
+ * @throws {ModuleNotFoundError} If no module is registered for `agentType`
123
+ */
124
+ getModule(agentType) {
125
+ const factory = this.factories.get(agentType);
126
+ if (!factory) {
127
+ throw new ModuleNotFoundError(agentType);
128
+ }
129
+ return factory();
130
+ }
131
+ /**
132
+ * Check if an agent type is registered.
133
+ */
134
+ hasModule(agentType) {
135
+ return this.factories.has(agentType);
136
+ }
137
+ /**
138
+ * Get metadata for a registered agent type.
139
+ * Returns undefined if the agent type is not registered.
140
+ */
141
+ getMetadata(agentType) {
142
+ return this.metadata.get(agentType);
143
+ }
144
+ /**
145
+ * List all registered modules, optionally filtered by a predicate.
146
+ */
147
+ listModules(filter) {
148
+ const all = Array.from(this.metadata.values());
149
+ return filter ? all.filter(filter) : all;
150
+ }
151
+ /**
152
+ * Get the icon for an agent type, or a default icon if not found.
153
+ */
154
+ getIcon(agentType) {
155
+ return this.metadata.get(agentType)?.icon ?? 'โš™๏ธ';
156
+ }
157
+ /**
158
+ * Get the number of registered modules.
159
+ */
160
+ get size() {
161
+ return this.factories.size;
162
+ }
163
+ // โ”€โ”€ Factory methods โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
164
+ /**
165
+ * Create a ModuleRegistry pre-populated with all built-in agents.
166
+ */
167
+ static createWithBuiltins(eventBus) {
168
+ const registry = new ModuleRegistry(eventBus);
169
+ // Each registration includes: agentType, factory, and metadata
170
+ registry.register('planner', () => new PlannerAgent(), {
171
+ name: 'Planner',
172
+ description: 'Analyzes user goals and creates detailed execution plans',
173
+ icon: '๐Ÿ“‹',
174
+ isBuiltin: true,
175
+ });
176
+ registry.register('context-gatherer', () => new ContextGathererAgent(), {
177
+ name: 'Context Gatherer',
178
+ description: 'Scans the codebase and identifies relevant files',
179
+ icon: '๐Ÿ“‚',
180
+ isBuiltin: true,
181
+ });
182
+ registry.register('writer', () => new WriterAgent(), {
183
+ name: 'Writer',
184
+ description: 'Generates code changes based on the plan and context',
185
+ icon: 'โœ๏ธ',
186
+ isBuiltin: true,
187
+ });
188
+ registry.register('reviewer', () => new ReviewerAgent(), {
189
+ name: 'Reviewer',
190
+ description: 'Validates code changes for correctness, security, and quality',
191
+ icon: '๐Ÿ‘๏ธ',
192
+ isBuiltin: true,
193
+ });
194
+ registry.register('runner', () => new RunnerAgent(), {
195
+ name: 'Runner',
196
+ description: 'Executes shell commands and captures output',
197
+ icon: 'โ–ถ๏ธ',
198
+ isBuiltin: true,
199
+ });
200
+ registry.register('tester', () => new TesterAgent(), {
201
+ name: 'Tester',
202
+ description: 'Runs tests in a sandboxed environment',
203
+ icon: '๐Ÿงช',
204
+ isBuiltin: true,
205
+ });
206
+ registry.register('debugger', () => new DebuggerAgent(), {
207
+ name: 'Debugger',
208
+ description: 'Diagnoses test failures and iteratively applies fixes',
209
+ icon: '๐Ÿ›',
210
+ isBuiltin: true,
211
+ });
212
+ registry.register('git', () => new GitAgent(), {
213
+ name: 'Git',
214
+ description: 'Manages git operations (branch, commit, PR)',
215
+ icon: '๐Ÿ”€',
216
+ isBuiltin: true,
217
+ });
218
+ registry.register('package', () => new PackageAgent(), {
219
+ name: 'Package',
220
+ description: 'Manages package version, build, and npm publish',
221
+ icon: '๐Ÿ“ฆ',
222
+ isBuiltin: true,
223
+ });
224
+ registry.register('github-release', () => new GitHubReleaseAgent(), {
225
+ name: 'GitHub Release',
226
+ description: 'Creates GitHub releases with auto-generated changelogs',
227
+ icon: '๐Ÿท๏ธ',
228
+ isBuiltin: true,
229
+ });
230
+ registry.register('security', () => new SecurityAgent(), {
231
+ name: 'Security',
232
+ description: 'Scans for PII, prompt injection, and dangerous code patterns',
233
+ icon: '๐Ÿ”’',
234
+ isBuiltin: true,
235
+ });
236
+ registry.register('skill-runner', () => new SkillRunnerAgent(), {
237
+ name: 'SkillRunner',
238
+ description: 'Executes a compiled skill as a pre-filled task plan',
239
+ icon: '๐Ÿง ',
240
+ isBuiltin: true,
241
+ });
242
+ registry.register('mcp', () => new MCPAgent(), {
243
+ name: 'MCP',
244
+ description: 'Invokes MCP (Model Context Protocol) tools from connected servers',
245
+ icon: '๐Ÿ”Œ',
246
+ isBuiltin: true,
247
+ });
248
+ return registry;
249
+ }
250
+ }
251
+ // โ”€โ”€โ”€ Global Singleton โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
252
+ let _globalRegistry = null;
253
+ /**
254
+ * Get or create the global ModuleRegistry singleton.
255
+ *
256
+ * First call creates a registry with all built-in agents pre-registered.
257
+ * Subsequent calls return the same instance.
258
+ * Use `resetModuleRegistry()` to clear and re-initialize (useful in tests).
259
+ */
260
+ export function getModuleRegistry() {
261
+ if (!_globalRegistry) {
262
+ _globalRegistry = ModuleRegistry.createWithBuiltins();
263
+ }
264
+ return _globalRegistry;
265
+ }
266
+ /**
267
+ * Reset the global module registry.
268
+ * Primarily useful in tests to get a clean slate.
269
+ */
270
+ export function resetModuleRegistry() {
271
+ _globalRegistry = null;
272
+ }
273
+ /**
274
+ * Set the global module registry (for dependency injection in tests).
275
+ * Returns the previous registry instance (or null).
276
+ */
277
+ export function setModuleRegistry(registry) {
278
+ const previous = _globalRegistry;
279
+ _globalRegistry = registry;
280
+ return previous;
281
+ }
282
+ //# sourceMappingURL=module-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-registry.js","sourceRoot":"","sources":["../../src/agents/module-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,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CACF;AAED,+EAA+E;AAE/E,IAAI,eAAe,GAA0B,IAAI,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB;IAC/B,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,eAAe,GAAG,cAAc,CAAC,kBAAkB,EAAE,CAAC;IACxD,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB;IACjC,eAAe,GAAG,IAAI,CAAC;AACzB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAwB;IACxD,MAAM,QAAQ,GAAG,eAAe,CAAC;IACjC,eAAe,GAAG,QAAQ,CAAC;IAC3B,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -18,6 +18,8 @@
18
18
  */
19
19
  import { ConfigManager } from '../config/manager.js';
20
20
  import type { TaskStep } from './agent.js';
21
+ import { type ModuleRegistry } from './module-registry.js';
22
+ import type { EventBus } from '../observability/event-bus.js';
21
23
  /** Configuration for an orchestration session */
22
24
  export interface OrchestratorOptions {
23
25
  /** Inference provider type (default: from configManager) */
@@ -124,7 +126,11 @@ export interface OrchestrationResult {
124
126
  }
125
127
  export declare class Orchestrator {
126
128
  private configManager;
127
- constructor(configManager?: ConfigManager);
129
+ /** The module registry used for agent lookups */
130
+ private moduleRegistry;
131
+ /** The event bus for emitting observability events */
132
+ private eventBus;
133
+ constructor(configManager?: ConfigManager, moduleRegistry?: ModuleRegistry, eventBus?: EventBus);
128
134
  /**
129
135
  * Execute a multi-agent pipeline for the given goal.
130
136
  */
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../src/agents/orchestrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAOH,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAOrD,OAAO,KAAK,EAA0B,QAAQ,EAAe,MAAM,YAAY,CAAC;AAsEhF,iDAAi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pB"}
@@ -25,21 +25,11 @@ import { showModelPicker } from '../cli/model-picker.js';
25
25
  import { logger } from '../utils/logger.js';
26
26
  import { ContextVault } from './context-vault.js';
27
27
  import { buildProjectFileTree, truncateTree } from './utils/file-tree.js';
28
- import { PlannerAgent } from './agents/planner.js';
29
- import { ContextGathererAgent } from './agents/context-gatherer.js';
30
- import { WriterAgent } from './agents/writer.js';
31
- import { ReviewerAgent } from './agents/reviewer.js';
32
- import { RunnerAgent } from './agents/runner.js';
33
- import { TesterAgent, cleanupSandbox } from './agents/tester.js';
34
- import { DebuggerAgent } from './agents/debugger.js';
35
- import { GitAgent } from './agents/git-agent.js';
36
- import { PackageAgent } from './agents/package-agent.js';
37
- import { GitHubReleaseAgent } from './agents/github-release-agent.js';
38
- import { SecurityAgent } from './agents/security-agent.js';
39
- import { SkillRunnerAgent } from './agents/skill-runner.js';
40
- import { MCPAgent } from './agents/mcp-agent.js';
28
+ import { cleanupSandbox } from './agents/tester.js';
41
29
  import { getMCPManager, resetMCPManager } from '../mcp/manager.js';
42
30
  import { formatMcpToolsForPrompt } from './agents/mcp-agent.js';
31
+ import { getModuleRegistry } from './module-registry.js';
32
+ import { getEventBus, EventNames } from '../observability/event-bus.js';
43
33
  import { ContextPruner } from '../learning/context-pruner.js';
44
34
  import { ErrorRepairEngine } from '../learning/error-repair.js';
45
35
  import { scanForInjections, formatScanReport } from '../security/scanner.js';
@@ -77,61 +67,30 @@ async function tryResetDAG() {
77
67
  if (dagModule)
78
68
  dagModule.resetDAG();
79
69
  }
80
- // โ”€โ”€โ”€ Agent Registry โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
81
- // โ”€โ”€โ”€ Spinner Icons โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
82
- /** Icons for each agent type, shown in the spinner during execution */
83
- const AGENT_ICONS = {
84
- 'context-gatherer': '๐Ÿ“‚',
85
- 'planner': '๐Ÿ“‹',
86
- 'writer': 'โœ๏ธ',
87
- 'reviewer': '๐Ÿ‘๏ธ',
88
- 'tester': '๐Ÿงช',
89
- 'debugger': '๐Ÿ›',
90
- 'runner': 'โ–ถ๏ธ',
91
- 'git': '๐Ÿ”€',
92
- 'package': '๐Ÿ“ฆ',
93
- 'github-release': '๐Ÿท๏ธ',
94
- 'security': '๐Ÿ”’',
95
- 'skill-runner': '๐Ÿง ',
96
- 'mcp': '๐Ÿ”Œ',
97
- };
98
- function createAgent(agentType, _options) {
99
- switch (agentType) {
100
- case 'context-gatherer':
101
- return new ContextGathererAgent();
102
- case 'planner':
103
- return new PlannerAgent();
104
- case 'writer':
105
- return new WriterAgent();
106
- case 'reviewer':
107
- return new ReviewerAgent();
108
- case 'runner':
109
- return new RunnerAgent();
110
- case 'tester':
111
- return new TesterAgent();
112
- case 'debugger':
113
- return new DebuggerAgent();
114
- case 'git':
115
- return new GitAgent();
116
- case 'package':
117
- return new PackageAgent();
118
- case 'github-release':
119
- return new GitHubReleaseAgent();
120
- case 'security':
121
- return new SecurityAgent();
122
- case 'skill-runner':
123
- return new SkillRunnerAgent();
124
- case 'mcp':
125
- return new MCPAgent();
126
- default:
127
- return null;
70
+ // โ”€โ”€โ”€ Agent Registry Bridge โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
71
+ /**
72
+ * Create an agent instance by looking it up in the ModuleRegistry.
73
+ * Replaces the old hardcoded switch statement.
74
+ */
75
+ function createAgent(agentType, registry) {
76
+ try {
77
+ return registry.getModule(agentType);
78
+ }
79
+ catch {
80
+ return null;
128
81
  }
129
82
  }
130
83
  // โ”€โ”€โ”€ Orchestrator โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
131
84
  export class Orchestrator {
132
85
  configManager;
133
- constructor(configManager) {
86
+ /** The module registry used for agent lookups */
87
+ moduleRegistry;
88
+ /** The event bus for emitting observability events */
89
+ eventBus;
90
+ constructor(configManager, moduleRegistry, eventBus) {
134
91
  this.configManager = configManager ?? new ConfigManager();
92
+ this.moduleRegistry = moduleRegistry ?? getModuleRegistry();
93
+ this.eventBus = eventBus ?? getEventBus();
135
94
  }
136
95
  /**
137
96
  * Execute a multi-agent pipeline for the given goal.
@@ -142,6 +101,12 @@ export class Orchestrator {
142
101
  const defaultCallLLM = this.createLLMProvider(options);
143
102
  const agentResults = [];
144
103
  const contextFiles = [];
104
+ // โ”€โ”€ Emit: pipeline started event โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
105
+ this.eventBus.emit(EventNames.ORCHESTRATOR_PIPELINE_STARTED, {
106
+ goal,
107
+ provider: options.provider,
108
+ model: options.model,
109
+ }, 'orchestrator');
145
110
  // โ”€โ”€ 2b. Build project file tree and inject for Planner โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
146
111
  if (options.verbose)
147
112
  logger.highlight('\n๐Ÿ“‚ Scanning project structure...');
@@ -268,7 +233,7 @@ export class Orchestrator {
268
233
  else {
269
234
  if (options.verbose)
270
235
  logger.highlight('\n๐Ÿ“‹ Planning...');
271
- const planResult = await this.runAgent(new PlannerAgent(), vault, defaultCallLLM, options);
236
+ const planResult = await this.runAgent(this.moduleRegistry.getModule('planner'), vault, defaultCallLLM, options);
272
237
  agentResults.push({ agent: 'Planner', success: planResult.success, summary: planResult.summary });
273
238
  if (!planResult.success) {
274
239
  return this.buildResult(false, goal, agentResults, vault, {
@@ -471,6 +436,14 @@ export class Orchestrator {
471
436
  const completed = vault.context.taskPlan.filter((s) => s.status === 'completed').length;
472
437
  const total = vault.context.taskPlan.length;
473
438
  const hasFailures = vault.hasFailedTasks;
439
+ // โ”€โ”€ Emit: pipeline completed event โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
440
+ this.eventBus.emit(EventNames.ORCHESTRATOR_PIPELINE_COMPLETED, {
441
+ goal,
442
+ success: !hasFailures,
443
+ tasksCompleted: completed,
444
+ tasksTotal: total,
445
+ durationMs: Date.now() - startTime,
446
+ }, 'orchestrator');
474
447
  const summaryLines = [];
475
448
  summaryLines.push(hasFailures
476
449
  ? `Completed ${completed}/${total} tasks with some failures in ${elapsed}s`
@@ -616,9 +589,14 @@ export class Orchestrator {
616
589
  !['debugger', 'runner', 'tester'].includes(task.agentType);
617
590
  vault.updateTaskStatus(task.id, 'running');
618
591
  await tryUpdateDAGNode(task.id, { status: 'running' });
592
+ this.eventBus.emit(EventNames.ORCHESTRATOR_TASK_STARTED, {
593
+ taskId: task.id,
594
+ agentType: task.agentType,
595
+ description: task.description,
596
+ }, 'orchestrator');
619
597
  // Update spinner text to show which task is currently executing
620
598
  if (options.spinner) {
621
- const agentIcon = AGENT_ICONS[task.agentType] || 'โš™๏ธ';
599
+ const agentIcon = this.moduleRegistry.getIcon(task.agentType);
622
600
  const shortDesc = task.description.slice(0, 60);
623
601
  options.spinner.start(`${agentIcon} ${shortDesc}${task.description.length > 60 ? '...' : ''}`);
624
602
  }
@@ -656,7 +634,7 @@ export class Orchestrator {
656
634
  }
657
635
  return;
658
636
  }
659
- const agent = createAgent(task.agentType, options);
637
+ const agent = createAgent(task.agentType, this.moduleRegistry);
660
638
  if (!agent) {
661
639
  vault.updateTaskStatus(task.id, 'failed', `Unknown agent type: ${task.agentType}`);
662
640
  agentResults.push({
@@ -704,6 +682,12 @@ export class Orchestrator {
704
682
  status: result.success ? 'completed' : 'failed',
705
683
  summary: result.summary,
706
684
  });
685
+ this.eventBus.emit(EventNames.ORCHESTRATOR_TASK_COMPLETED, {
686
+ taskId: task.id,
687
+ agentType: task.agentType,
688
+ success: result.success,
689
+ summary: result.summary,
690
+ }, 'orchestrator');
707
691
  agentResults.push({ agent: task.agentType, success: result.success, summary: result.summary });
708
692
  // Track sandbox path for cleanup
709
693
  if (result.success && task.agentType === 'tester') {