agent-nuvira 1.14.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/LICENSE +21 -0
- package/README.md +891 -0
- package/dist/agent-sdk/src/agent.d.ts +118 -0
- package/dist/agent-sdk/src/agent.d.ts.map +1 -0
- package/dist/agent-sdk/src/agent.js +88 -0
- package/dist/agent-sdk/src/agent.js.map +1 -0
- package/dist/agent-sdk/src/index.d.ts +33 -0
- package/dist/agent-sdk/src/index.d.ts.map +1 -0
- package/dist/agent-sdk/src/index.js +32 -0
- package/dist/agent-sdk/src/index.js.map +1 -0
- package/dist/agent-sdk/src/register.d.ts +70 -0
- package/dist/agent-sdk/src/register.d.ts.map +1 -0
- package/dist/agent-sdk/src/register.js +181 -0
- package/dist/agent-sdk/src/register.js.map +1 -0
- package/dist/agent-sdk/src/scaffold.d.ts +50 -0
- package/dist/agent-sdk/src/scaffold.d.ts.map +1 -0
- package/dist/agent-sdk/src/scaffold.js +291 -0
- package/dist/agent-sdk/src/scaffold.js.map +1 -0
- package/dist/agent-sdk/src/testing.d.ts +187 -0
- package/dist/agent-sdk/src/testing.d.ts.map +1 -0
- package/dist/agent-sdk/src/testing.js +243 -0
- package/dist/agent-sdk/src/testing.js.map +1 -0
- package/dist/agent-sdk/src/types.d.ts +202 -0
- package/dist/agent-sdk/src/types.d.ts.map +1 -0
- package/dist/agent-sdk/src/types.js +11 -0
- package/dist/agent-sdk/src/types.js.map +1 -0
- package/dist/agents/agent.d.ts +132 -0
- package/dist/agents/agent.d.ts.map +1 -0
- package/dist/agents/agent.js +19 -0
- package/dist/agents/agent.js.map +1 -0
- package/dist/agents/agents/context-gatherer.d.ts +42 -0
- package/dist/agents/agents/context-gatherer.d.ts.map +1 -0
- package/dist/agents/agents/context-gatherer.js +366 -0
- package/dist/agents/agents/context-gatherer.js.map +1 -0
- package/dist/agents/agents/debugger.d.ts +58 -0
- package/dist/agents/agents/debugger.d.ts.map +1 -0
- package/dist/agents/agents/debugger.js +257 -0
- package/dist/agents/agents/debugger.js.map +1 -0
- package/dist/agents/agents/git-agent.d.ts +34 -0
- package/dist/agents/agents/git-agent.d.ts.map +1 -0
- package/dist/agents/agents/git-agent.js +200 -0
- package/dist/agents/agents/git-agent.js.map +1 -0
- package/dist/agents/agents/github-release-agent.d.ts +65 -0
- package/dist/agents/agents/github-release-agent.d.ts.map +1 -0
- package/dist/agents/agents/github-release-agent.js +439 -0
- package/dist/agents/agents/github-release-agent.js.map +1 -0
- package/dist/agents/agents/package-agent.d.ts +33 -0
- package/dist/agents/agents/package-agent.d.ts.map +1 -0
- package/dist/agents/agents/package-agent.js +233 -0
- package/dist/agents/agents/package-agent.js.map +1 -0
- package/dist/agents/agents/planner.d.ts +26 -0
- package/dist/agents/agents/planner.d.ts.map +1 -0
- package/dist/agents/agents/planner.js +222 -0
- package/dist/agents/agents/planner.js.map +1 -0
- package/dist/agents/agents/reviewer.d.ts +34 -0
- package/dist/agents/agents/reviewer.d.ts.map +1 -0
- package/dist/agents/agents/reviewer.js +159 -0
- package/dist/agents/agents/reviewer.js.map +1 -0
- package/dist/agents/agents/runner.d.ts +73 -0
- package/dist/agents/agents/runner.d.ts.map +1 -0
- package/dist/agents/agents/runner.js +299 -0
- package/dist/agents/agents/runner.js.map +1 -0
- package/dist/agents/agents/security-agent.d.ts +33 -0
- package/dist/agents/agents/security-agent.d.ts.map +1 -0
- package/dist/agents/agents/security-agent.js +184 -0
- package/dist/agents/agents/security-agent.js.map +1 -0
- package/dist/agents/agents/tester.d.ts +96 -0
- package/dist/agents/agents/tester.d.ts.map +1 -0
- package/dist/agents/agents/tester.js +410 -0
- package/dist/agents/agents/tester.js.map +1 -0
- package/dist/agents/agents/writer.d.ts +51 -0
- package/dist/agents/agents/writer.d.ts.map +1 -0
- package/dist/agents/agents/writer.js +384 -0
- package/dist/agents/agents/writer.js.map +1 -0
- package/dist/agents/context-vault.d.ts +49 -0
- package/dist/agents/context-vault.d.ts.map +1 -0
- package/dist/agents/context-vault.js +134 -0
- package/dist/agents/context-vault.js.map +1 -0
- package/dist/agents/orchestrator.d.ts +97 -0
- package/dist/agents/orchestrator.d.ts.map +1 -0
- package/dist/agents/orchestrator.js +696 -0
- package/dist/agents/orchestrator.js.map +1 -0
- package/dist/agents/utils/file-tree.d.ts +28 -0
- package/dist/agents/utils/file-tree.d.ts.map +1 -0
- package/dist/agents/utils/file-tree.js +93 -0
- package/dist/agents/utils/file-tree.js.map +1 -0
- package/dist/cli/agent.d.ts +25 -0
- package/dist/cli/agent.d.ts.map +1 -0
- package/dist/cli/agent.js +374 -0
- package/dist/cli/agent.js.map +1 -0
- package/dist/cli/benchmark.d.ts +24 -0
- package/dist/cli/benchmark.d.ts.map +1 -0
- package/dist/cli/benchmark.js +235 -0
- package/dist/cli/benchmark.js.map +1 -0
- package/dist/cli/cache.d.ts +12 -0
- package/dist/cli/cache.d.ts.map +1 -0
- package/dist/cli/cache.js +58 -0
- package/dist/cli/cache.js.map +1 -0
- package/dist/cli/chat.d.ts +37 -0
- package/dist/cli/chat.d.ts.map +1 -0
- package/dist/cli/chat.js +393 -0
- package/dist/cli/chat.js.map +1 -0
- package/dist/cli/commands.d.ts +24 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +18 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/config.d.ts +19 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +162 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/dashboard.d.ts +34 -0
- package/dist/cli/dashboard.d.ts.map +1 -0
- package/dist/cli/dashboard.js +126 -0
- package/dist/cli/dashboard.js.map +1 -0
- package/dist/cli/doctor.d.ts +68 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +585 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/edit.d.ts +11 -0
- package/dist/cli/edit.d.ts.map +1 -0
- package/dist/cli/edit.js +86 -0
- package/dist/cli/edit.js.map +1 -0
- package/dist/cli/execute.d.ts +25 -0
- package/dist/cli/execute.d.ts.map +1 -0
- package/dist/cli/execute.js +186 -0
- package/dist/cli/execute.js.map +1 -0
- package/dist/cli/federation.d.ts +31 -0
- package/dist/cli/federation.d.ts.map +1 -0
- package/dist/cli/federation.js +387 -0
- package/dist/cli/federation.js.map +1 -0
- package/dist/cli/history.d.ts +22 -0
- package/dist/cli/history.d.ts.map +1 -0
- package/dist/cli/history.js +140 -0
- package/dist/cli/history.js.map +1 -0
- package/dist/cli/init.d.ts +49 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +423 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/learn.d.ts +31 -0
- package/dist/cli/learn.d.ts.map +1 -0
- package/dist/cli/learn.js +320 -0
- package/dist/cli/learn.js.map +1 -0
- package/dist/cli/memory.d.ts +38 -0
- package/dist/cli/memory.d.ts.map +1 -0
- package/dist/cli/memory.js +295 -0
- package/dist/cli/memory.js.map +1 -0
- package/dist/cli/model-picker.d.ts +18 -0
- package/dist/cli/model-picker.d.ts.map +1 -0
- package/dist/cli/model-picker.js +225 -0
- package/dist/cli/model-picker.js.map +1 -0
- package/dist/cli/models.d.ts +11 -0
- package/dist/cli/models.d.ts.map +1 -0
- package/dist/cli/models.js +132 -0
- package/dist/cli/models.js.map +1 -0
- package/dist/cli/plan.d.ts +11 -0
- package/dist/cli/plan.d.ts.map +1 -0
- package/dist/cli/plan.js +94 -0
- package/dist/cli/plan.js.map +1 -0
- package/dist/cli/plugins.d.ts +15 -0
- package/dist/cli/plugins.d.ts.map +1 -0
- package/dist/cli/plugins.js +123 -0
- package/dist/cli/plugins.js.map +1 -0
- package/dist/cli/router.d.ts +20 -0
- package/dist/cli/router.d.ts.map +1 -0
- package/dist/cli/router.js +142 -0
- package/dist/cli/router.js.map +1 -0
- package/dist/cli/run.d.ts +22 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +110 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/sandbox.d.ts +27 -0
- package/dist/cli/sandbox.d.ts.map +1 -0
- package/dist/cli/sandbox.js +264 -0
- package/dist/cli/sandbox.js.map +1 -0
- package/dist/cli/sdk.d.ts +27 -0
- package/dist/cli/sdk.d.ts.map +1 -0
- package/dist/cli/sdk.js +204 -0
- package/dist/cli/sdk.js.map +1 -0
- package/dist/cli/stats.d.ts +18 -0
- package/dist/cli/stats.d.ts.map +1 -0
- package/dist/cli/stats.js +78 -0
- package/dist/cli/stats.js.map +1 -0
- package/dist/cli/team.d.ts +42 -0
- package/dist/cli/team.d.ts.map +1 -0
- package/dist/cli/team.js +473 -0
- package/dist/cli/team.js.map +1 -0
- package/dist/cli/workflow.d.ts +27 -0
- package/dist/cli/workflow.d.ts.map +1 -0
- package/dist/cli/workflow.js +347 -0
- package/dist/cli/workflow.js.map +1 -0
- package/dist/config/manager.d.ts +37 -0
- package/dist/config/manager.d.ts.map +1 -0
- package/dist/config/manager.js +147 -0
- package/dist/config/manager.js.map +1 -0
- package/dist/config/types.d.ts +53 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -0
- package/dist/context/cache.d.ts +27 -0
- package/dist/context/cache.d.ts.map +1 -0
- package/dist/context/cache.js +116 -0
- package/dist/context/cache.js.map +1 -0
- package/dist/context/history.d.ts +87 -0
- package/dist/context/history.d.ts.map +1 -0
- package/dist/context/history.js +249 -0
- package/dist/context/history.js.map +1 -0
- package/dist/context/parser.d.ts +61 -0
- package/dist/context/parser.d.ts.map +1 -0
- package/dist/context/parser.js +194 -0
- package/dist/context/parser.js.map +1 -0
- package/dist/federation/client.d.ts +49 -0
- package/dist/federation/client.d.ts.map +1 -0
- package/dist/federation/client.js +239 -0
- package/dist/federation/client.js.map +1 -0
- package/dist/federation/protocol.d.ts +155 -0
- package/dist/federation/protocol.d.ts.map +1 -0
- package/dist/federation/protocol.js +57 -0
- package/dist/federation/protocol.js.map +1 -0
- package/dist/federation/server.d.ts +25 -0
- package/dist/federation/server.d.ts.map +1 -0
- package/dist/federation/server.js +401 -0
- package/dist/federation/server.js.map +1 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +93 -0
- package/dist/index.js.map +1 -0
- package/dist/inference/factory.d.ts +20 -0
- package/dist/inference/factory.d.ts.map +1 -0
- package/dist/inference/factory.js +46 -0
- package/dist/inference/factory.js.map +1 -0
- package/dist/inference/gemini-adapter.d.ts +17 -0
- package/dist/inference/gemini-adapter.d.ts.map +1 -0
- package/dist/inference/gemini-adapter.js +176 -0
- package/dist/inference/gemini-adapter.js.map +1 -0
- package/dist/inference/groq-adapter.d.ts +17 -0
- package/dist/inference/groq-adapter.d.ts.map +1 -0
- package/dist/inference/groq-adapter.js +103 -0
- package/dist/inference/groq-adapter.js.map +1 -0
- package/dist/inference/interface.d.ts +49 -0
- package/dist/inference/interface.d.ts.map +1 -0
- package/dist/inference/interface.js +2 -0
- package/dist/inference/interface.js.map +1 -0
- package/dist/inference/local-adapter.d.ts +35 -0
- package/dist/inference/local-adapter.d.ts.map +1 -0
- package/dist/inference/local-adapter.js +311 -0
- package/dist/inference/local-adapter.js.map +1 -0
- package/dist/inference/model-catalog.d.ts +53 -0
- package/dist/inference/model-catalog.d.ts.map +1 -0
- package/dist/inference/model-catalog.js +306 -0
- package/dist/inference/model-catalog.js.map +1 -0
- package/dist/inference/nim-adapter.d.ts +17 -0
- package/dist/inference/nim-adapter.d.ts.map +1 -0
- package/dist/inference/nim-adapter.js +103 -0
- package/dist/inference/nim-adapter.js.map +1 -0
- package/dist/inference/openrouter-adapter.d.ts +17 -0
- package/dist/inference/openrouter-adapter.d.ts.map +1 -0
- package/dist/inference/openrouter-adapter.js +105 -0
- package/dist/inference/openrouter-adapter.js.map +1 -0
- package/dist/inference/sse.d.ts +20 -0
- package/dist/inference/sse.d.ts.map +1 -0
- package/dist/inference/sse.js +91 -0
- package/dist/inference/sse.js.map +1 -0
- package/dist/learning/agent-stats.d.ts +109 -0
- package/dist/learning/agent-stats.d.ts.map +1 -0
- package/dist/learning/agent-stats.js +240 -0
- package/dist/learning/agent-stats.js.map +1 -0
- package/dist/learning/benchmark.d.ts +161 -0
- package/dist/learning/benchmark.d.ts.map +1 -0
- package/dist/learning/benchmark.js +589 -0
- package/dist/learning/benchmark.js.map +1 -0
- package/dist/learning/cost-tracker.d.ts +101 -0
- package/dist/learning/cost-tracker.d.ts.map +1 -0
- package/dist/learning/cost-tracker.js +224 -0
- package/dist/learning/cost-tracker.js.map +1 -0
- package/dist/learning/feedback.d.ts +88 -0
- package/dist/learning/feedback.d.ts.map +1 -0
- package/dist/learning/feedback.js +169 -0
- package/dist/learning/feedback.js.map +1 -0
- package/dist/learning/hybrid-router.d.ts +201 -0
- package/dist/learning/hybrid-router.d.ts.map +1 -0
- package/dist/learning/hybrid-router.js +450 -0
- package/dist/learning/hybrid-router.js.map +1 -0
- package/dist/learning/model-compare.d.ts +76 -0
- package/dist/learning/model-compare.d.ts.map +1 -0
- package/dist/learning/model-compare.js +252 -0
- package/dist/learning/model-compare.js.map +1 -0
- package/dist/learning/model-router.d.ts +68 -0
- package/dist/learning/model-router.d.ts.map +1 -0
- package/dist/learning/model-router.js +140 -0
- package/dist/learning/model-router.js.map +1 -0
- package/dist/learning/pattern-extractor.d.ts +99 -0
- package/dist/learning/pattern-extractor.d.ts.map +1 -0
- package/dist/learning/pattern-extractor.js +310 -0
- package/dist/learning/pattern-extractor.js.map +1 -0
- package/dist/learning/scorer.d.ts +51 -0
- package/dist/learning/scorer.d.ts.map +1 -0
- package/dist/learning/scorer.js +64 -0
- package/dist/learning/scorer.js.map +1 -0
- package/dist/learning/self-improver.d.ts +48 -0
- package/dist/learning/self-improver.d.ts.map +1 -0
- package/dist/learning/self-improver.js +161 -0
- package/dist/learning/self-improver.js.map +1 -0
- package/dist/memory/embedder.d.ts +65 -0
- package/dist/memory/embedder.d.ts.map +1 -0
- package/dist/memory/embedder.js +424 -0
- package/dist/memory/embedder.js.map +1 -0
- package/dist/memory/memory-integration.d.ts +56 -0
- package/dist/memory/memory-integration.d.ts.map +1 -0
- package/dist/memory/memory-integration.js +95 -0
- package/dist/memory/memory-integration.js.map +1 -0
- package/dist/memory/trajectory-store.d.ts +149 -0
- package/dist/memory/trajectory-store.d.ts.map +1 -0
- package/dist/memory/trajectory-store.js +476 -0
- package/dist/memory/trajectory-store.js.map +1 -0
- package/dist/memory/vector-store.d.ts +78 -0
- package/dist/memory/vector-store.d.ts.map +1 -0
- package/dist/memory/vector-store.js +186 -0
- package/dist/memory/vector-store.js.map +1 -0
- package/dist/plugins/agent-plugin.d.ts +73 -0
- package/dist/plugins/agent-plugin.d.ts.map +1 -0
- package/dist/plugins/agent-plugin.js +199 -0
- package/dist/plugins/agent-plugin.js.map +1 -0
- package/dist/plugins/registry.d.ts +61 -0
- package/dist/plugins/registry.d.ts.map +1 -0
- package/dist/plugins/registry.js +67 -0
- package/dist/plugins/registry.js.map +1 -0
- package/dist/sandbox/images.d.ts +31 -0
- package/dist/sandbox/images.d.ts.map +1 -0
- package/dist/sandbox/images.js +129 -0
- package/dist/sandbox/images.js.map +1 -0
- package/dist/sandbox/manager.d.ts +134 -0
- package/dist/sandbox/manager.d.ts.map +1 -0
- package/dist/sandbox/manager.js +470 -0
- package/dist/sandbox/manager.js.map +1 -0
- package/dist/sandbox/types.d.ts +113 -0
- package/dist/sandbox/types.d.ts.map +1 -0
- package/dist/sandbox/types.js +107 -0
- package/dist/sandbox/types.js.map +1 -0
- package/dist/security/scanner.d.ts +53 -0
- package/dist/security/scanner.d.ts.map +1 -0
- package/dist/security/scanner.js +271 -0
- package/dist/security/scanner.js.map +1 -0
- package/dist/team/config.d.ts +50 -0
- package/dist/team/config.d.ts.map +1 -0
- package/dist/team/config.js +108 -0
- package/dist/team/config.js.map +1 -0
- package/dist/team/memory.d.ts +63 -0
- package/dist/team/memory.d.ts.map +1 -0
- package/dist/team/memory.js +282 -0
- package/dist/team/memory.js.map +1 -0
- package/dist/team/review.d.ts +123 -0
- package/dist/team/review.d.ts.map +1 -0
- package/dist/team/review.js +293 -0
- package/dist/team/review.js.map +1 -0
- package/dist/utils/env.d.ts +19 -0
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/env.js +250 -0
- package/dist/utils/env.js.map +1 -0
- package/dist/utils/logger.d.ts +11 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +45 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/web-dashboard/server.d.ts +59 -0
- package/dist/web-dashboard/server.d.ts.map +1 -0
- package/dist/web-dashboard/server.js +418 -0
- package/dist/web-dashboard/server.js.map +1 -0
- package/dist/workflow/registry.d.ts +127 -0
- package/dist/workflow/registry.d.ts.map +1 -0
- package/dist/workflow/registry.js +482 -0
- package/dist/workflow/registry.js.map +1 -0
- package/dist/workflow/templates.d.ts +93 -0
- package/dist/workflow/templates.d.ts.map +1 -0
- package/dist/workflow/templates.js +481 -0
- package/dist/workflow/templates.js.map +1 -0
- package/package.json +78 -0
- package/src/web-dashboard/public/assets/index-B08nDkSB.css +1 -0
- package/src/web-dashboard/public/assets/index-BKL8YOFD.js +135 -0
- package/src/web-dashboard/public/assets/index-BKL8YOFD.js.map +1 -0
- package/src/web-dashboard/public/index.html +13 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agent-nuvira/sdk/agent — Abstract base class for building custom agents.
|
|
3
|
+
*
|
|
4
|
+
* To create a custom agent:
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { Agent, type AgentContext, type AgentResult } from '@agent-nuvira/sdk';
|
|
7
|
+
*
|
|
8
|
+
* export class MyAgent extends Agent {
|
|
9
|
+
* readonly name = 'MyAgent';
|
|
10
|
+
* readonly description = 'Does something useful';
|
|
11
|
+
*
|
|
12
|
+
* async execute(context: AgentContext, callLLM: LLMCallFn): Promise<AgentResult> {
|
|
13
|
+
* // Read context artifacts, call the LLM, produce results
|
|
14
|
+
* return { success: true, summary: 'Task completed' };
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @module @agent-nuvira/sdk/agent
|
|
20
|
+
*/
|
|
21
|
+
import type { AgentContext, AgentResult, LLMCallFn } from './types.js';
|
|
22
|
+
/**
|
|
23
|
+
* Abstract base class for all specialized agents.
|
|
24
|
+
*
|
|
25
|
+
* Every agent in the system extends this class. Agents are executed by the
|
|
26
|
+
* Orchestrator, which provides them with a shared {@link AgentContext} and an
|
|
27
|
+
* {@link LLMCallFn} for invoking the configured language model.
|
|
28
|
+
*
|
|
29
|
+
* ## Agent Lifecycle
|
|
30
|
+
*
|
|
31
|
+
* 1. **Construct** — The agent is created by the orchestrator's agent registry
|
|
32
|
+
* 2. **Validate** — {@link validate} is called (override to check prerequisites)
|
|
33
|
+
* 3. **Execute** — {@link execute} is called with the full context and LLM function
|
|
34
|
+
* 4. **Cleanup** — {@link cleanup} is called regardless of success/failure
|
|
35
|
+
*
|
|
36
|
+
* ## Example
|
|
37
|
+
*
|
|
38
|
+
* ```ts
|
|
39
|
+
* class CodeFormatterAgent extends Agent {
|
|
40
|
+
* readonly name = 'CodeFormatter';
|
|
41
|
+
* readonly description = 'Formats source code using project conventions';
|
|
42
|
+
*
|
|
43
|
+
* async execute(context: AgentContext, callLLM: LLMCallFn): Promise<AgentResult> {
|
|
44
|
+
* const code = context.artifacts.find(a => a.path.endsWith('.ts'));
|
|
45
|
+
* if (!code) {
|
|
46
|
+
* return { success: false, summary: 'No TypeScript file found' };
|
|
47
|
+
* }
|
|
48
|
+
*
|
|
49
|
+
* const formatted = await callLLM(
|
|
50
|
+
* `Format this code:\n\`\`\`\n${code.content}\n\`\`\``
|
|
51
|
+
* );
|
|
52
|
+
*
|
|
53
|
+
* context.fileChanges.push({
|
|
54
|
+
* path: code.path,
|
|
55
|
+
* originalContent: code.content,
|
|
56
|
+
* newContent: formatted,
|
|
57
|
+
* status: 'modified',
|
|
58
|
+
* });
|
|
59
|
+
*
|
|
60
|
+
* return { success: true, summary: `Formatted ${code.path}` };
|
|
61
|
+
* }
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare abstract class Agent {
|
|
66
|
+
/** Human-readable agent name (e.g. "Planner", "Writer", "CodeFormatter") */
|
|
67
|
+
abstract readonly name: string;
|
|
68
|
+
/** Short description of what this agent does (used in planning and logging) */
|
|
69
|
+
abstract readonly description: string;
|
|
70
|
+
/**
|
|
71
|
+
* Execute the agent's specialized task.
|
|
72
|
+
*
|
|
73
|
+
* This is the main entry point. The agent should:
|
|
74
|
+
* 1. Read inputs from the shared context (`context.artifacts`, `context.goal`, etc.)
|
|
75
|
+
* 2. Call the LLM via `callLLM(prompt)` as needed
|
|
76
|
+
* 3. Write outputs to the shared context (`context.fileChanges`, `context.artifacts`)
|
|
77
|
+
* 4. Return an {@link AgentResult} indicating success/failure
|
|
78
|
+
*
|
|
79
|
+
* @param context Shared context bus — read inputs, write outputs
|
|
80
|
+
* @param callLLM Function to call the configured LLM with a prompt
|
|
81
|
+
* @returns Result indicating success/failure + summary
|
|
82
|
+
*/
|
|
83
|
+
abstract execute(context: AgentContext, callLLM: LLMCallFn): Promise<AgentResult>;
|
|
84
|
+
/**
|
|
85
|
+
* Validate that the agent can run with the given context.
|
|
86
|
+
* Override this to check prerequisites before execution.
|
|
87
|
+
*
|
|
88
|
+
* Default implementation returns `true` (no validation).
|
|
89
|
+
*
|
|
90
|
+
* @param context The shared context bus
|
|
91
|
+
* @returns `true` if the agent is ready to execute, or a string error message
|
|
92
|
+
*/
|
|
93
|
+
validate(_context: AgentContext): true | string;
|
|
94
|
+
/**
|
|
95
|
+
* Cleanup hook called after execution, regardless of success or failure.
|
|
96
|
+
* Override this to release resources, close connections, etc.
|
|
97
|
+
*
|
|
98
|
+
* Default implementation does nothing.
|
|
99
|
+
*/
|
|
100
|
+
cleanup(): void;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Metadata descriptor for registering an agent in the system.
|
|
104
|
+
* Used by {@link AgentRegistry} and the scaffolding tool.
|
|
105
|
+
*/
|
|
106
|
+
export interface AgentDescriptor {
|
|
107
|
+
/** Agent class constructor */
|
|
108
|
+
AgentClass: new () => Agent;
|
|
109
|
+
/** Human-readable name */
|
|
110
|
+
name: string;
|
|
111
|
+
/** Short description */
|
|
112
|
+
description: string;
|
|
113
|
+
/** Comma-separated tags for categorization (e.g. "code, analysis, format") */
|
|
114
|
+
tags?: string;
|
|
115
|
+
/** Agent type identifier used in task plans (defaults to kebab-case of name) */
|
|
116
|
+
agentType?: string;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/agent-sdk/src/agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,8BAAsB,KAAK;IACzB,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAE/B,+EAA+E;IAC/E,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAEtC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;IAEjF;;;;;;;;OAQG;IACH,QAAQ,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,GAAG,MAAM;IAI/C;;;;;OAKG;IACH,OAAO,IAAI,IAAI;CAGhB;AAID;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,8BAA8B;IAC9B,UAAU,EAAE,UAAU,KAAK,CAAC;IAC5B,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agent-nuvira/sdk/agent — Abstract base class for building custom agents.
|
|
3
|
+
*
|
|
4
|
+
* To create a custom agent:
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { Agent, type AgentContext, type AgentResult } from '@agent-nuvira/sdk';
|
|
7
|
+
*
|
|
8
|
+
* export class MyAgent extends Agent {
|
|
9
|
+
* readonly name = 'MyAgent';
|
|
10
|
+
* readonly description = 'Does something useful';
|
|
11
|
+
*
|
|
12
|
+
* async execute(context: AgentContext, callLLM: LLMCallFn): Promise<AgentResult> {
|
|
13
|
+
* // Read context artifacts, call the LLM, produce results
|
|
14
|
+
* return { success: true, summary: 'Task completed' };
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @module @agent-nuvira/sdk/agent
|
|
20
|
+
*/
|
|
21
|
+
// ─── Base Agent ─────────────────────────────────────────────────────────────
|
|
22
|
+
/**
|
|
23
|
+
* Abstract base class for all specialized agents.
|
|
24
|
+
*
|
|
25
|
+
* Every agent in the system extends this class. Agents are executed by the
|
|
26
|
+
* Orchestrator, which provides them with a shared {@link AgentContext} and an
|
|
27
|
+
* {@link LLMCallFn} for invoking the configured language model.
|
|
28
|
+
*
|
|
29
|
+
* ## Agent Lifecycle
|
|
30
|
+
*
|
|
31
|
+
* 1. **Construct** — The agent is created by the orchestrator's agent registry
|
|
32
|
+
* 2. **Validate** — {@link validate} is called (override to check prerequisites)
|
|
33
|
+
* 3. **Execute** — {@link execute} is called with the full context and LLM function
|
|
34
|
+
* 4. **Cleanup** — {@link cleanup} is called regardless of success/failure
|
|
35
|
+
*
|
|
36
|
+
* ## Example
|
|
37
|
+
*
|
|
38
|
+
* ```ts
|
|
39
|
+
* class CodeFormatterAgent extends Agent {
|
|
40
|
+
* readonly name = 'CodeFormatter';
|
|
41
|
+
* readonly description = 'Formats source code using project conventions';
|
|
42
|
+
*
|
|
43
|
+
* async execute(context: AgentContext, callLLM: LLMCallFn): Promise<AgentResult> {
|
|
44
|
+
* const code = context.artifacts.find(a => a.path.endsWith('.ts'));
|
|
45
|
+
* if (!code) {
|
|
46
|
+
* return { success: false, summary: 'No TypeScript file found' };
|
|
47
|
+
* }
|
|
48
|
+
*
|
|
49
|
+
* const formatted = await callLLM(
|
|
50
|
+
* `Format this code:\n\`\`\`\n${code.content}\n\`\`\``
|
|
51
|
+
* );
|
|
52
|
+
*
|
|
53
|
+
* context.fileChanges.push({
|
|
54
|
+
* path: code.path,
|
|
55
|
+
* originalContent: code.content,
|
|
56
|
+
* newContent: formatted,
|
|
57
|
+
* status: 'modified',
|
|
58
|
+
* });
|
|
59
|
+
*
|
|
60
|
+
* return { success: true, summary: `Formatted ${code.path}` };
|
|
61
|
+
* }
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export class Agent {
|
|
66
|
+
/**
|
|
67
|
+
* Validate that the agent can run with the given context.
|
|
68
|
+
* Override this to check prerequisites before execution.
|
|
69
|
+
*
|
|
70
|
+
* Default implementation returns `true` (no validation).
|
|
71
|
+
*
|
|
72
|
+
* @param context The shared context bus
|
|
73
|
+
* @returns `true` if the agent is ready to execute, or a string error message
|
|
74
|
+
*/
|
|
75
|
+
validate(_context) {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Cleanup hook called after execution, regardless of success or failure.
|
|
80
|
+
* Override this to release resources, close connections, etc.
|
|
81
|
+
*
|
|
82
|
+
* Default implementation does nothing.
|
|
83
|
+
*/
|
|
84
|
+
cleanup() {
|
|
85
|
+
// Override to add cleanup logic
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../../src/agent-sdk/src/agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,OAAgB,KAAK;IAsBzB;;;;;;;;OAQG;IACH,QAAQ,CAAC,QAAsB;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,OAAO;QACL,gCAAgC;IAClC,CAAC;CACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agent-nuvira/sdk — Agent-Nuvira Software Development Kit
|
|
3
|
+
*
|
|
4
|
+
* Build custom agents for the Agent-Nuvira multi-agent orchestration system.
|
|
5
|
+
*
|
|
6
|
+
* ## Quick Start
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { Agent, type AgentContext, type AgentResult, type LLMCallFn } from '@agent-nuvira/sdk';
|
|
10
|
+
*
|
|
11
|
+
* export class MyAgent extends Agent {
|
|
12
|
+
* readonly name = 'MyAgent';
|
|
13
|
+
* readonly description = 'Does something useful';
|
|
14
|
+
*
|
|
15
|
+
* async execute(context: AgentContext, callLLM: LLMCallFn): Promise<AgentResult> {
|
|
16
|
+
* return { success: true, summary: 'Done!' };
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* ## Sub-modules
|
|
22
|
+
*
|
|
23
|
+
* - `@agent-nuvira/sdk` — Base Agent class + core types
|
|
24
|
+
* - `@agent-nuvira/sdk/agent` — Agent class only
|
|
25
|
+
* - `@agent-nuvira/sdk/types` — Type definitions only
|
|
26
|
+
* - `@agent-nuvira/sdk/testing` — Testing utilities (mock context, mock LLM, assertions)
|
|
27
|
+
*
|
|
28
|
+
* @module @agent-nuvira/sdk
|
|
29
|
+
*/
|
|
30
|
+
export { Agent } from './agent.js';
|
|
31
|
+
export type { AgentDescriptor } from './agent.js';
|
|
32
|
+
export type { TaskStatus, TaskStep, Artifact, FileChange, AgentMessage, LLMCallFn, InferenceOptions, RateLimitInfo, RateLimitAction, OnRateLimit, AgentContext, AgentResult, OrchestratorOptions, OrchestrationResult, } from './types.js';
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent-sdk/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAIlD,YAAY,EAEV,UAAU,EACV,QAAQ,EAER,QAAQ,EACR,UAAU,EAEV,YAAY,EAEZ,SAAS,EACT,gBAAgB,EAEhB,aAAa,EACb,eAAe,EACf,WAAW,EAEX,YAAY,EACZ,WAAW,EAEX,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agent-nuvira/sdk — Agent-Nuvira Software Development Kit
|
|
3
|
+
*
|
|
4
|
+
* Build custom agents for the Agent-Nuvira multi-agent orchestration system.
|
|
5
|
+
*
|
|
6
|
+
* ## Quick Start
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { Agent, type AgentContext, type AgentResult, type LLMCallFn } from '@agent-nuvira/sdk';
|
|
10
|
+
*
|
|
11
|
+
* export class MyAgent extends Agent {
|
|
12
|
+
* readonly name = 'MyAgent';
|
|
13
|
+
* readonly description = 'Does something useful';
|
|
14
|
+
*
|
|
15
|
+
* async execute(context: AgentContext, callLLM: LLMCallFn): Promise<AgentResult> {
|
|
16
|
+
* return { success: true, summary: 'Done!' };
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* ## Sub-modules
|
|
22
|
+
*
|
|
23
|
+
* - `@agent-nuvira/sdk` — Base Agent class + core types
|
|
24
|
+
* - `@agent-nuvira/sdk/agent` — Agent class only
|
|
25
|
+
* - `@agent-nuvira/sdk/types` — Type definitions only
|
|
26
|
+
* - `@agent-nuvira/sdk/testing` — Testing utilities (mock context, mock LLM, assertions)
|
|
27
|
+
*
|
|
28
|
+
* @module @agent-nuvira/sdk
|
|
29
|
+
*/
|
|
30
|
+
// ─── Agent Base Class ───────────────────────────────────────────────────────
|
|
31
|
+
export { Agent } from './agent.js';
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agent-sdk/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,+EAA+E;AAE/E,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agent-nuvira/sdk/register — Register a custom agent with the orchestrator.
|
|
3
|
+
*
|
|
4
|
+
* Modifies `src/agents/orchestrator.ts` to:
|
|
5
|
+
* 1. Add an import statement for the custom agent class
|
|
6
|
+
* 2. Add a `case` to the `createAgent()` switch statement
|
|
7
|
+
* 3. Add an icon to the `AGENT_ICONS` map
|
|
8
|
+
*
|
|
9
|
+
* ## Usage
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { registerAgent } from '@agent-nuvira/sdk/register';
|
|
13
|
+
*
|
|
14
|
+
* const changes = registerAgent({
|
|
15
|
+
* sourceModule: './agents/my-agent.js',
|
|
16
|
+
* className: 'MyAgent',
|
|
17
|
+
* agentType: 'my-agent',
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @module @agent-nuvira/sdk/register
|
|
22
|
+
*/
|
|
23
|
+
/** Options for registering a custom agent */
|
|
24
|
+
export interface RegisterOptions {
|
|
25
|
+
/** Absolute or relative path to the orchestrator source file (default: auto-detected) */
|
|
26
|
+
orchestratorPath?: string;
|
|
27
|
+
/** The import module path for the agent class, relative to orchestrator.ts dir. Example: './agents/my-agent.js' */
|
|
28
|
+
sourceModule: string;
|
|
29
|
+
/** The exported class name to import. Example: 'MyAgent' */
|
|
30
|
+
className: string;
|
|
31
|
+
/** The agent type string used in task plans and the switch case. Example: 'my-agent' */
|
|
32
|
+
agentType: string;
|
|
33
|
+
/** Optional emoji icon for the AGENT_ICONS map (default: 🧩) */
|
|
34
|
+
icon?: string;
|
|
35
|
+
/** Optional human-readable name (defaults to className) */
|
|
36
|
+
name?: string;
|
|
37
|
+
}
|
|
38
|
+
/** Result of a register/unregister operation */
|
|
39
|
+
export interface RegisterResult {
|
|
40
|
+
/** Whether the operation succeeded */
|
|
41
|
+
success: boolean;
|
|
42
|
+
/** Human-readable message describing what happened */
|
|
43
|
+
message: string;
|
|
44
|
+
/** Files that were modified */
|
|
45
|
+
modifiedFiles: string[];
|
|
46
|
+
/** The agent type that was operated on */
|
|
47
|
+
agentType: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Register a custom agent with the orchestrator.
|
|
51
|
+
*
|
|
52
|
+
* Reads the orchestrator source file, adds the import and switch case,
|
|
53
|
+
* and writes the file back.
|
|
54
|
+
*/
|
|
55
|
+
export declare function registerAgent(options: RegisterOptions): RegisterResult;
|
|
56
|
+
/**
|
|
57
|
+
* Unregister a custom agent from the orchestrator.
|
|
58
|
+
*
|
|
59
|
+
* Removes the switch case and icon entry. If `className` is provided,
|
|
60
|
+
* also removes the matching import statement using an exact pattern
|
|
61
|
+
* (`import { className } from '...';`) to avoid accidentally removing
|
|
62
|
+
* built-in imports.
|
|
63
|
+
*/
|
|
64
|
+
export declare function unregisterAgent(options: {
|
|
65
|
+
orchestratorPath?: string;
|
|
66
|
+
agentType: string;
|
|
67
|
+
/** The exact exported class name. When provided, enables safe import removal. */
|
|
68
|
+
className?: string;
|
|
69
|
+
}): RegisterResult;
|
|
70
|
+
//# sourceMappingURL=register.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/agent-sdk/src/register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAWH,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,yFAAyF;IACzF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mHAAmH;IACnH,YAAY,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,wFAAwF;IACxF,SAAS,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,gDAAgD;AAChD,MAAM,WAAW,cAAc;IAC7B,sCAAsC;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;CACnB;AAID;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,cAAc,CAsEtE;AAID;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE;IACvC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,cAAc,CAqFjB"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agent-nuvira/sdk/register — Register a custom agent with the orchestrator.
|
|
3
|
+
*
|
|
4
|
+
* Modifies `src/agents/orchestrator.ts` to:
|
|
5
|
+
* 1. Add an import statement for the custom agent class
|
|
6
|
+
* 2. Add a `case` to the `createAgent()` switch statement
|
|
7
|
+
* 3. Add an icon to the `AGENT_ICONS` map
|
|
8
|
+
*
|
|
9
|
+
* ## Usage
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { registerAgent } from '@agent-nuvira/sdk/register';
|
|
13
|
+
*
|
|
14
|
+
* const changes = registerAgent({
|
|
15
|
+
* sourceModule: './agents/my-agent.js',
|
|
16
|
+
* className: 'MyAgent',
|
|
17
|
+
* agentType: 'my-agent',
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @module @agent-nuvira/sdk/register
|
|
22
|
+
*/
|
|
23
|
+
import { readFileSync, writeFileSync, existsSync } from 'node:fs';
|
|
24
|
+
import { resolve } from 'node:path';
|
|
25
|
+
// ─── Constants ──────────────────────────────────────────────────────────────
|
|
26
|
+
const DEFAULT_ICON = '🧩';
|
|
27
|
+
// ─── Registration Logic ─────────────────────────────────────────────────────
|
|
28
|
+
/**
|
|
29
|
+
* Register a custom agent with the orchestrator.
|
|
30
|
+
*
|
|
31
|
+
* Reads the orchestrator source file, adds the import and switch case,
|
|
32
|
+
* and writes the file back.
|
|
33
|
+
*/
|
|
34
|
+
export function registerAgent(options) {
|
|
35
|
+
const { orchestratorPath: inputPath, sourceModule, className, agentType, icon = DEFAULT_ICON, name = className } = options;
|
|
36
|
+
const orchestratorPath = inputPath || resolve(process.cwd(), 'src/agents/orchestrator.ts');
|
|
37
|
+
if (!existsSync(orchestratorPath)) {
|
|
38
|
+
return { success: false, message: `Orchestrator file not found at: ${orchestratorPath}`, modifiedFiles: [], agentType };
|
|
39
|
+
}
|
|
40
|
+
const originalContent = readFileSync(orchestratorPath, 'utf-8');
|
|
41
|
+
// ── 1. Check if already registered ──────────────────────────────────
|
|
42
|
+
if (originalContent.includes(`case '${agentType}':`)) {
|
|
43
|
+
return { success: true, message: `Agent '${agentType}' is already registered. No changes made.`, modifiedFiles: [], agentType };
|
|
44
|
+
}
|
|
45
|
+
// ── 2. Add import statement ─────────────────────────────────────────
|
|
46
|
+
const importStatement = `import { ${className} } from '${sourceModule}';`;
|
|
47
|
+
let newContent = originalContent;
|
|
48
|
+
if (!originalContent.includes(importStatement)) {
|
|
49
|
+
const importLines = newContent.match(/^import .+;$/gm);
|
|
50
|
+
if (importLines && importLines.length > 0) {
|
|
51
|
+
const lastImport = importLines[importLines.length - 1];
|
|
52
|
+
const insertPos = newContent.lastIndexOf(lastImport) + lastImport.length;
|
|
53
|
+
newContent = newContent.slice(0, insertPos) + '\n' + importStatement + newContent.slice(insertPos);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
return { success: false, message: 'Could not find import section in orchestrator file.', modifiedFiles: [], agentType };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// ── 3. Add case to createAgent switch ───────────────────────────────
|
|
60
|
+
const caseBlock = ` case '${agentType}':\n return new ${className}();`;
|
|
61
|
+
if (!newContent.includes(caseBlock)) {
|
|
62
|
+
const defaultPattern = 'default:\n return null;';
|
|
63
|
+
const defaultIndex = newContent.lastIndexOf(defaultPattern);
|
|
64
|
+
if (defaultIndex >= 0) {
|
|
65
|
+
newContent = newContent.slice(0, defaultIndex) + caseBlock + '\n\n ' + newContent.slice(defaultIndex);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
return { success: false, message: 'Could not find default case in createAgent switch.', modifiedFiles: [], agentType };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// ── 4. Add icon to AGENT_ICONS map ─────────────────────────────────
|
|
72
|
+
const iconLine = ` '${agentType}': '${icon}',`;
|
|
73
|
+
if (!newContent.includes(iconLine)) {
|
|
74
|
+
const iconsEndMarker = '};\n\nfunction createAgent';
|
|
75
|
+
const iconsEndIndex = newContent.lastIndexOf(iconsEndMarker);
|
|
76
|
+
if (iconsEndIndex >= 0) {
|
|
77
|
+
newContent = newContent.slice(0, iconsEndIndex) + iconLine + '\n' + newContent.slice(iconsEndIndex);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// ── 5. Write changes ────────────────────────────────────────────────
|
|
81
|
+
if (newContent === originalContent) {
|
|
82
|
+
return { success: true, message: `No changes needed for agent '${agentType}'. Already fully registered.`, modifiedFiles: [], agentType };
|
|
83
|
+
}
|
|
84
|
+
writeFileSync(orchestratorPath, newContent, 'utf-8');
|
|
85
|
+
const changes = [];
|
|
86
|
+
if (!originalContent.includes(importStatement))
|
|
87
|
+
changes.push('import');
|
|
88
|
+
if (!originalContent.includes(caseBlock))
|
|
89
|
+
changes.push('switch case');
|
|
90
|
+
if (!originalContent.includes(iconLine))
|
|
91
|
+
changes.push('icon');
|
|
92
|
+
return {
|
|
93
|
+
success: true,
|
|
94
|
+
message: `Registered agent '${agentType}' (${name}) with the orchestrator. Added: ${changes.join(', ') || 'nothing new'}.`,
|
|
95
|
+
modifiedFiles: [orchestratorPath],
|
|
96
|
+
agentType,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
// ─── Unregistration Logic ───────────────────────────────────────────────────
|
|
100
|
+
/**
|
|
101
|
+
* Unregister a custom agent from the orchestrator.
|
|
102
|
+
*
|
|
103
|
+
* Removes the switch case and icon entry. If `className` is provided,
|
|
104
|
+
* also removes the matching import statement using an exact pattern
|
|
105
|
+
* (`import { className } from '...';`) to avoid accidentally removing
|
|
106
|
+
* built-in imports.
|
|
107
|
+
*/
|
|
108
|
+
export function unregisterAgent(options) {
|
|
109
|
+
const { orchestratorPath: inputPath, agentType, className } = options;
|
|
110
|
+
const orchestratorPath = inputPath || resolve(process.cwd(), 'src/agents/orchestrator.ts');
|
|
111
|
+
if (!existsSync(orchestratorPath)) {
|
|
112
|
+
return { success: false, message: `Orchestrator file not found at: ${orchestratorPath}`, modifiedFiles: [], agentType };
|
|
113
|
+
}
|
|
114
|
+
const originalContent = readFileSync(orchestratorPath, 'utf-8');
|
|
115
|
+
if (!originalContent.includes(`case '${agentType}':`)) {
|
|
116
|
+
return { success: true, message: `Agent '${agentType}' is not registered. No changes needed.`, modifiedFiles: [], agentType };
|
|
117
|
+
}
|
|
118
|
+
let newContent = originalContent;
|
|
119
|
+
let changesMade = false;
|
|
120
|
+
// ── Remove the switch case block ──────────────────────────────────
|
|
121
|
+
// Matches the exact pattern added by registerAgent()
|
|
122
|
+
const caseRegex = new RegExp(` case '${escapeRegex(agentType)}':\\n return new \\w+\\(\\);\\n\\n `, 'g');
|
|
123
|
+
const afterCase = newContent.replace(caseRegex, '');
|
|
124
|
+
if (afterCase !== newContent) {
|
|
125
|
+
newContent = afterCase;
|
|
126
|
+
changesMade = true;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
// Fallback: try without trailing indent (for last case in switch)
|
|
130
|
+
const fallbackRegex = new RegExp(` case '${escapeRegex(agentType)}':\\n return new \\w+\\(\\);\\n`, 'g');
|
|
131
|
+
const afterFallback = newContent.replace(fallbackRegex, '');
|
|
132
|
+
if (afterFallback !== newContent) {
|
|
133
|
+
newContent = afterFallback;
|
|
134
|
+
changesMade = true;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// ── Remove the icon line ──────────────────────────────────────────
|
|
138
|
+
const iconRegex = new RegExp(` '${escapeRegex(agentType)}': '.[^']*',\\n`, 'g');
|
|
139
|
+
const afterIcon = newContent.replace(iconRegex, '');
|
|
140
|
+
if (afterIcon !== newContent) {
|
|
141
|
+
newContent = afterIcon;
|
|
142
|
+
changesMade = true;
|
|
143
|
+
}
|
|
144
|
+
// ── Remove the import (only with className for safety) ──────────────
|
|
145
|
+
let importRemoved = false;
|
|
146
|
+
if (className) {
|
|
147
|
+
const importRegex = new RegExp(`^import \\{ ${escapeRegex(className)} \\} from '[^']+';\n`, 'gm');
|
|
148
|
+
const afterImport = newContent.replace(importRegex, '');
|
|
149
|
+
// Collapse duplicate blank lines
|
|
150
|
+
const cleaned = afterImport.replace(/\n{3,}/g, '\n\n');
|
|
151
|
+
if (cleaned !== newContent) {
|
|
152
|
+
newContent = cleaned;
|
|
153
|
+
changesMade = true;
|
|
154
|
+
importRemoved = true;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (!changesMade) {
|
|
158
|
+
return {
|
|
159
|
+
success: true,
|
|
160
|
+
message: `Could not auto-remove traces of '${agentType}'. Pass --class-name <Name> for import removal. Manual cleanup in src/agents/orchestrator.ts may be needed.`,
|
|
161
|
+
modifiedFiles: [],
|
|
162
|
+
agentType,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
writeFileSync(orchestratorPath, newContent, 'utf-8');
|
|
166
|
+
const removed = ['switch case', 'icon'];
|
|
167
|
+
if (importRemoved)
|
|
168
|
+
removed.push('import');
|
|
169
|
+
return {
|
|
170
|
+
success: true,
|
|
171
|
+
message: `Unregistered agent '${agentType}' from the orchestrator. Removed: ${removed.join(', ')}.`,
|
|
172
|
+
modifiedFiles: [orchestratorPath],
|
|
173
|
+
agentType,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
// ─── Helpers ────────────────────────────────────────────────────────────────
|
|
177
|
+
/** Escape special regex characters in a string */
|
|
178
|
+
function escapeRegex(str) {
|
|
179
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/agent-sdk/src/register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SA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a;QAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAE1C,OAAO;QACL,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,uBAAuB,SAAS,qCAAqC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;QACnG,aAAa,EAAE,CAAC,gBAAgB,CAAC;QACjC,SAAS;KACV,CAAC;AACJ,CAAC;AAED,+EAA+E;AAE/E,kDAAkD;AAClD,SAAS,WAAW,CAAC,GAAW;IAC9B,OAAO,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agent-nuvira/sdk/scaffold — Scaffolding command for creating custom agent projects.
|
|
3
|
+
*
|
|
4
|
+
* Generates a complete, ready-to-extend agent package with:
|
|
5
|
+
* - TypeScript configuration
|
|
6
|
+
* - A custom agent class extending {@link Agent}
|
|
7
|
+
* - Unit tests using the {@link testing} utilities
|
|
8
|
+
* - Package.json with build/test scripts
|
|
9
|
+
*
|
|
10
|
+
* @module @agent-nuvira/sdk/scaffold
|
|
11
|
+
*/
|
|
12
|
+
/** Template type to scaffold */
|
|
13
|
+
export type ScaffoldTemplate = 'basic-agent' | 'full-agent' | 'agent-pack';
|
|
14
|
+
/** Options for scaffolding */
|
|
15
|
+
export interface ScaffoldOptions {
|
|
16
|
+
/** Output directory for the new agent project */
|
|
17
|
+
outDir: string;
|
|
18
|
+
/** Name of the agent class (PascalCase, e.g. "CodeFormatter") */
|
|
19
|
+
agentName: string;
|
|
20
|
+
/** Description of what the agent does */
|
|
21
|
+
description: string;
|
|
22
|
+
/** Template type (default: 'full-agent') */
|
|
23
|
+
template?: ScaffoldTemplate;
|
|
24
|
+
/** Agent type identifier for task plans (default: kebab-case of agentName) */
|
|
25
|
+
agentType?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Scaffold a new custom agent project.
|
|
29
|
+
*
|
|
30
|
+
* @returns An array of file paths that were created.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const files = scaffold({
|
|
35
|
+
* outDir: './my-custom-agent',
|
|
36
|
+
* agentName: 'CodeFormatter',
|
|
37
|
+
* description: 'Formats source code according to project conventions',
|
|
38
|
+
* });
|
|
39
|
+
* console.log(\`Created \${files.length} files\`);
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function scaffold(options: ScaffoldOptions): string[];
|
|
43
|
+
/**
|
|
44
|
+
* List available scaffold templates with descriptions.
|
|
45
|
+
*/
|
|
46
|
+
export declare function listTemplates(): Array<{
|
|
47
|
+
name: string;
|
|
48
|
+
description: string;
|
|
49
|
+
}>;
|
|
50
|
+
//# sourceMappingURL=scaffold.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../../src/agent-sdk/src/scaffold.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH,gCAAgC;AAChC,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,YAAY,GAAG,YAAY,CAAC;AAE3E,8BAA8B;AAC9B,MAAM,WAAW,eAAe;IAC9B,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,8EAA8E;IAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAgOD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,EAAE,CAoD3D;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAe5E"}
|