nexus-prime 3.3.0 โ 3.5.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 +88 -3
- package/dist/agents/adapters/mcp.d.ts.map +1 -1
- package/dist/agents/adapters/mcp.js +247 -0
- package/dist/agents/adapters/mcp.js.map +1 -1
- package/dist/cli.js +116 -0
- package/dist/cli.js.map +1 -1
- package/dist/dashboard/index.html +84 -14
- package/dist/dashboard/server.d.ts +1 -0
- package/dist/dashboard/server.d.ts.map +1 -1
- package/dist/dashboard/server.js +198 -17
- package/dist/dashboard/server.js.map +1 -1
- package/dist/engines/automation-runtime.d.ts +76 -0
- package/dist/engines/automation-runtime.d.ts.map +1 -0
- package/dist/engines/automation-runtime.js +278 -0
- package/dist/engines/automation-runtime.js.map +1 -0
- package/dist/engines/event-bus.d.ts +46 -1
- package/dist/engines/event-bus.d.ts.map +1 -1
- package/dist/engines/event-bus.js.map +1 -1
- package/dist/engines/federation.d.ts +43 -16
- package/dist/engines/federation.d.ts.map +1 -1
- package/dist/engines/federation.js +117 -28
- package/dist/engines/federation.js.map +1 -1
- package/dist/engines/hook-runtime.d.ts +58 -0
- package/dist/engines/hook-runtime.d.ts.map +1 -0
- package/dist/engines/hook-runtime.js +278 -0
- package/dist/engines/hook-runtime.js.map +1 -0
- package/dist/engines/memory.d.ts +29 -0
- package/dist/engines/memory.d.ts.map +1 -1
- package/dist/engines/memory.js +113 -0
- package/dist/engines/memory.js.map +1 -1
- package/dist/engines/runtime-assets.d.ts +11 -0
- package/dist/engines/runtime-assets.d.ts.map +1 -1
- package/dist/engines/runtime-assets.js +343 -33
- package/dist/engines/runtime-assets.js.map +1 -1
- package/dist/engines/security-shield.d.ts +38 -0
- package/dist/engines/security-shield.d.ts.map +1 -0
- package/dist/engines/security-shield.js +104 -0
- package/dist/engines/security-shield.js.map +1 -0
- package/dist/phantom/runtime.d.ts +60 -3
- package/dist/phantom/runtime.d.ts.map +1 -1
- package/dist/phantom/runtime.js +412 -6
- package/dist/phantom/runtime.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,11 +2,16 @@
|
|
|
2
2
|
<h1>๐งฌ Nexus Prime</h1>
|
|
3
3
|
<p><strong>The Cognitive Operating System for Multi-Agent Swarms</strong></p>
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/nexus-prime)
|
|
6
|
+
[](https://www.npmjs.com/package/nexus-prime)
|
|
6
7
|
[](LICENSE)
|
|
7
8
|
[](https://github.com/topics/agentic-os)
|
|
8
9
|
[](https://github.com/sir-ad/nexus-prime/actions)
|
|
9
10
|
[](https://nodejs.org)
|
|
11
|
+
<!-- traffic-badges:start -->
|
|
12
|
+
[](https://github.com/sir-ad/nexus-prime)
|
|
13
|
+
[](https://github.com/sir-ad/nexus-prime)
|
|
14
|
+
<!-- traffic-badges:end -->
|
|
10
15
|
|
|
11
16
|
<!-- AI / Agentic Widgets -->
|
|
12
17
|
[](https://github.com/topics/ai)
|
|
@@ -31,6 +36,9 @@ npx nexus-prime mcp
|
|
|
31
36
|
|
|
32
37
|
**Nexus Prime** is a local-first coding-agent operating system. Exposed as an MCP (Model Context Protocol) server or integrated programmatically, it provides single and multi-agent systems with **persistent memory, selectable runtime backends, guarded live skills, workflow artifacts, a live dashboard, and parallel Git-worktree execution with verification.**
|
|
33
38
|
|
|
39
|
+
**Website:** [sir-ad.github.io/nexus-prime](https://sir-ad.github.io/nexus-prime/)
|
|
40
|
+
**Documentation:** [Knowledge Base](https://sir-ad.github.io/nexus-prime/knowledge-base.html) ยท [Integrations](https://sir-ad.github.io/nexus-prime/integrations.html) ยท [Architecture Diagrams](https://sir-ad.github.io/nexus-prime/architecture-diagrams.html)
|
|
41
|
+
|
|
34
42
|
---
|
|
35
43
|
|
|
36
44
|
<details>
|
|
@@ -106,7 +114,7 @@ Nexus Prime significantly reduces cognitive load and token expenditure compared
|
|
|
106
114
|
|
|
107
115
|
---
|
|
108
116
|
|
|
109
|
-
## ๐๏ธ Swarm Topology
|
|
117
|
+
## ๐๏ธ Architecture & Swarm Topology
|
|
110
118
|
|
|
111
119
|
Nexus Prime enables true parallelization by isolating agents into dynamically generated Git worktrees. Inter-worker communication happens over the local **POD Network**, and merges are mediated by the **Merge Oracle**.
|
|
112
120
|
|
|
@@ -132,12 +140,68 @@ sequenceDiagram
|
|
|
132
140
|
M-->>U: JSON-RPC Response
|
|
133
141
|
```
|
|
134
142
|
|
|
143
|
+
### ๐ Phantom Swarm Execution Topology
|
|
144
|
+
|
|
145
|
+
The original Phantom concept remains central to Nexus Prime: `GhostPass()` evaluates risk, workers execute in isolated worktrees, the entanglement layer shares runtime state, and the Merge Oracle decides what lands back on the main branch.
|
|
146
|
+
|
|
147
|
+
```text
|
|
148
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
149
|
+
โ SWARM EXECUTION TOPOLOGY โ
|
|
150
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
151
|
+
โ โ
|
|
152
|
+
โ [Main Branch] โโโถ GhostPass() (Risk Analysis) โ
|
|
153
|
+
โ โ โ
|
|
154
|
+
โ โโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโ โ
|
|
155
|
+
โ โ โ โ โ
|
|
156
|
+
โ [Worktree A] [Worktree B] [Worktree C] โ
|
|
157
|
+
โ (UX Agent) (API Agent) (DB Agent) โ
|
|
158
|
+
โ โ โ โ โ
|
|
159
|
+
โ โโโโโโฌโโโโโโโโโโดโโโโโโโโโโฌโโโโโ โ
|
|
160
|
+
โ โ โ โ
|
|
161
|
+
โ โผ โผ โ
|
|
162
|
+
โ Entanglement Engine (Quantum-Inspired Hilbert Space) โ
|
|
163
|
+
โ โ โ
|
|
164
|
+
โ โผ โผ โ
|
|
165
|
+
โ Merge Oracle (Byzantine Consensus + Hierarchical Synthesis) โ
|
|
166
|
+
โ โ โ
|
|
167
|
+
โ โผ โ
|
|
168
|
+
โ [Main Branch] โโโ Commit & State Collapse โ
|
|
169
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
170
|
+
```
|
|
171
|
+
|
|
135
172
|
<div align="center">
|
|
136
173
|
<img src="./docs/assets/screenshots/swarm_trace.png" alt="Swarm Induction Trace" width="80%">
|
|
137
174
|
<br>
|
|
138
175
|
<i>Mandatory Induction: A 7-worker swarm coordinating via POD Network.</i>
|
|
139
176
|
</div>
|
|
140
177
|
|
|
178
|
+
### Execution Protocol (Agent Orchestrator)
|
|
179
|
+
|
|
180
|
+
When invoking `nexus_spawn_workers`, workflow execution, or a runtime swarm task, Nexus Prime follows explicit routing patterns rather than improvised worker fan-out:
|
|
181
|
+
|
|
182
|
+
| Request Intent | Sub-Agents Spawned | Execution Order |
|
|
183
|
+
| :--- | :--- | :--- |
|
|
184
|
+
| Full stack feature | UX Designer + Backend Engineer | Parallel, cross-communicating via POD |
|
|
185
|
+
| Database migration | DB Architect + Backend Engineer | Sequential, schema first |
|
|
186
|
+
| Bug hunt | 3x QA / verifier workers | Parallel competitive |
|
|
187
|
+
| Refactor module | Senior Coder + Security / verifier pass | Sequential pipeline |
|
|
188
|
+
|
|
189
|
+
```typescript
|
|
190
|
+
import { PhantomSwarm } from 'nexus-prime/orchestrator';
|
|
191
|
+
|
|
192
|
+
const swarm = new PhantomSwarm();
|
|
193
|
+
|
|
194
|
+
const results = await swarm.dispatch({
|
|
195
|
+
goal: 'Migrate user settings to Postgres',
|
|
196
|
+
agents: ['db-migrator', 'api-refactor'],
|
|
197
|
+
topology: 'parallel-mesh',
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
swarm.on('consensus.reach', (state) => {
|
|
201
|
+
console.log(`Merged ${state.filesResolved} files with ${state.confidence}% certainty.`);
|
|
202
|
+
});
|
|
203
|
+
```
|
|
204
|
+
|
|
141
205
|
---
|
|
142
206
|
|
|
143
207
|
## ๐ง Core Capabilities
|
|
@@ -249,6 +313,27 @@ nexus-prime setup status
|
|
|
249
313
|
|
|
250
314
|
## ๐ Changelog
|
|
251
315
|
|
|
316
|
+
### v3.4.0 "Dashboard Overhaul"
|
|
317
|
+
- **Heartbeat Throttling**: Eliminated refresh storm from client heartbeats โ graph stays stable.
|
|
318
|
+
- **Smart Empty States**: Token dial, event filters, and graph all show context-aware placeholder UI.
|
|
319
|
+
- **14 Default Skills**: session-start-research, prompt-architect, architecture-scout, debug-forensics, refactor-guardian, documentation-writer, dependency-auditor, performance-profiler + original 6.
|
|
320
|
+
- **3 Default Workflows**: full-audit-loop, research-and-implement, release-pipeline โ auto-seeded on first load.
|
|
321
|
+
- **Graph Caching**: Memory topology preserves last-known-good state during refreshes.
|
|
322
|
+
- **Version & User Display**: Header now shows package version and git username correctly.
|
|
323
|
+
- **README Audit**: Updated changelog, fixed maintainer reference, verified all screenshot paths.
|
|
324
|
+
|
|
325
|
+
### v3.3.0 "Dashboard Polish"
|
|
326
|
+
- **Tool Spend Tracker**: Estimated cost visualization for token usage across sessions.
|
|
327
|
+
- **Skill UI**: In-dashboard skill creation form and seed button for default skills.
|
|
328
|
+
- **Tool Detection**: Improved client heuristic detection via environment variables and process scanning.
|
|
329
|
+
- **Dashboard Stability**: Fixed flickering, memory graph load order, and token dial responsiveness.
|
|
330
|
+
|
|
331
|
+
### v3.2.0 "Runtime Closure"
|
|
332
|
+
- **Topology Console**: Rebuilt dashboard with memory graph, run graph, and POD network visualization.
|
|
333
|
+
- **SSE Live Stream**: Server-Sent Events for real-time event broadcasting with exponential backoff.
|
|
334
|
+
- **Backend Registry**: Selectable memory, compression, and DSL compiler backends.
|
|
335
|
+
- **Security Hardening**: Content Security Policy headers and input sanitization.
|
|
336
|
+
|
|
252
337
|
### v3.0.0 "The Pulse Update"
|
|
253
338
|
- **POD Telemetry**: Real-time heartbeat visualization of worker sync.
|
|
254
339
|
- **Improved Tokens**: Optimized HyperTune for large monorepo traversal.
|
|
@@ -285,5 +370,5 @@ nexus-prime setup status
|
|
|
285
370
|
|
|
286
371
|
<div align="center">
|
|
287
372
|
<strong>License:</strong> MIT <br>
|
|
288
|
-
<strong>
|
|
373
|
+
<strong>Maintainer:</strong> <a href="https://github.com/sir-ad">Adarsh Agrahari (sir-ad)</a>
|
|
289
374
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/agents/adapters/mcp.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/agents/adapters/mcp.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AA2K5C,qBAAa,UAAW,YAAW,OAAO;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAG,KAAK,CAAU;IACtB,SAAS,UAAS;IAClB,MAAM,EAAE,MAAM,EAAE,CAAM;IAEtB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAC,CAAa;IAC9B,OAAO,CAAC,SAAS,CAA4C;IAC7D,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,OAAO,CAAC,CAAkB;IAElC,OAAO,CAAC,GAAG;;IAmBX,OAAO,CAAC,gBAAgB;IAkCxB,WAAW,CAAC,KAAK,EAAE,UAAU;IAI7B,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,iBAAiB;YA0iBX,cAAc;IAuoC5B,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE;IAItC,OAAO,CAAC,IAAI;IAmBN,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAOxB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAkB3B,IAAI,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IACnD,OAAO,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;CAC1C"}
|
|
@@ -474,6 +474,112 @@ export class MCPAdapter {
|
|
|
474
474
|
required: ['workflowId'],
|
|
475
475
|
},
|
|
476
476
|
},
|
|
477
|
+
{
|
|
478
|
+
name: 'nexus_hook_generate',
|
|
479
|
+
description: 'Generate a runtime hook artifact for checkpoint and system-event execution.',
|
|
480
|
+
inputSchema: {
|
|
481
|
+
type: 'object',
|
|
482
|
+
properties: {
|
|
483
|
+
name: { type: 'string', description: 'Hook name' },
|
|
484
|
+
description: { type: 'string', description: 'Hook description' },
|
|
485
|
+
trigger: { type: 'string', enum: ['run.created', 'before-read', 'before-mutate', 'before-verify', 'retry', 'run.failed', 'run.verified', 'promotion.approved', 'memory.stored', 'shield.blocked'], description: 'Hook trigger' },
|
|
486
|
+
riskClass: { type: 'string', enum: ['read', 'orchestrate', 'mutate'], description: 'Risk class for the hook' },
|
|
487
|
+
scope: { type: 'string', enum: ['session', 'worker', 'global'], description: 'Initial hook scope' }
|
|
488
|
+
},
|
|
489
|
+
required: ['name', 'description', 'trigger'],
|
|
490
|
+
},
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
name: 'nexus_hook_deploy',
|
|
494
|
+
description: 'Deploy or promote a hook artifact for future runs.',
|
|
495
|
+
inputSchema: {
|
|
496
|
+
type: 'object',
|
|
497
|
+
properties: {
|
|
498
|
+
hookId: { type: 'string', description: 'Hook artifact ID or exact name' },
|
|
499
|
+
scope: { type: 'string', enum: ['session', 'worker', 'global'], description: 'Deployment scope' }
|
|
500
|
+
},
|
|
501
|
+
required: ['hookId'],
|
|
502
|
+
},
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
name: 'nexus_hook_revoke',
|
|
506
|
+
description: 'Revoke a runtime hook artifact.',
|
|
507
|
+
inputSchema: {
|
|
508
|
+
type: 'object',
|
|
509
|
+
properties: {
|
|
510
|
+
hookId: { type: 'string', description: 'Hook artifact ID or exact name' }
|
|
511
|
+
},
|
|
512
|
+
required: ['hookId'],
|
|
513
|
+
},
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
name: 'nexus_automation_generate',
|
|
517
|
+
description: 'Generate a runtime automation artifact for event, schedule, or connector triggers.',
|
|
518
|
+
inputSchema: {
|
|
519
|
+
type: 'object',
|
|
520
|
+
properties: {
|
|
521
|
+
name: { type: 'string', description: 'Automation name' },
|
|
522
|
+
description: { type: 'string', description: 'Automation description' },
|
|
523
|
+
triggerMode: { type: 'string', enum: ['event', 'schedule', 'connector'], description: 'Trigger mode' },
|
|
524
|
+
eventTrigger: { type: 'string', enum: ['run.created', 'before-read', 'before-mutate', 'before-verify', 'retry', 'run.failed', 'run.verified', 'promotion.approved', 'memory.stored', 'shield.blocked'], description: 'Event trigger when triggerMode=event' },
|
|
525
|
+
scope: { type: 'string', enum: ['session', 'worker', 'global'], description: 'Initial automation scope' }
|
|
526
|
+
},
|
|
527
|
+
required: ['name', 'description'],
|
|
528
|
+
},
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
name: 'nexus_automation_deploy',
|
|
532
|
+
description: 'Deploy or promote an automation artifact.',
|
|
533
|
+
inputSchema: {
|
|
534
|
+
type: 'object',
|
|
535
|
+
properties: {
|
|
536
|
+
automationId: { type: 'string', description: 'Automation artifact ID or exact name' },
|
|
537
|
+
scope: { type: 'string', enum: ['session', 'worker', 'global'], description: 'Deployment scope' }
|
|
538
|
+
},
|
|
539
|
+
required: ['automationId'],
|
|
540
|
+
},
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
name: 'nexus_automation_run',
|
|
544
|
+
description: 'Run an automation artifact through the real execution runtime.',
|
|
545
|
+
inputSchema: {
|
|
546
|
+
type: 'object',
|
|
547
|
+
properties: {
|
|
548
|
+
automationId: { type: 'string', description: 'Automation artifact ID or exact name' },
|
|
549
|
+
goal: { type: 'string', description: 'Optional override goal' }
|
|
550
|
+
},
|
|
551
|
+
required: ['automationId'],
|
|
552
|
+
},
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
name: 'nexus_automation_revoke',
|
|
556
|
+
description: 'Revoke a runtime automation artifact.',
|
|
557
|
+
inputSchema: {
|
|
558
|
+
type: 'object',
|
|
559
|
+
properties: {
|
|
560
|
+
automationId: { type: 'string', description: 'Automation artifact ID or exact name' }
|
|
561
|
+
},
|
|
562
|
+
required: ['automationId'],
|
|
563
|
+
},
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
name: 'nexus_memory_audit',
|
|
567
|
+
description: 'Audit stored memories for duplicates, contradictions, quarantine candidates, and promotion safety.',
|
|
568
|
+
inputSchema: {
|
|
569
|
+
type: 'object',
|
|
570
|
+
properties: {
|
|
571
|
+
limit: { type: 'number', description: 'Maximum memories to scan' }
|
|
572
|
+
},
|
|
573
|
+
},
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
name: 'nexus_federation_status',
|
|
577
|
+
description: 'Return local federation status, peer inventory, relay learnings, and active peer links.',
|
|
578
|
+
inputSchema: {
|
|
579
|
+
type: 'object',
|
|
580
|
+
properties: {},
|
|
581
|
+
},
|
|
582
|
+
},
|
|
477
583
|
{
|
|
478
584
|
name: 'nexus_run_status',
|
|
479
585
|
description: 'Return the current recorded state of a runtime execution run.',
|
|
@@ -1234,6 +1340,142 @@ export class MCPAdapter {
|
|
|
1234
1340
|
return { content: [{ type: 'text', text: `โ Workflow runtime error: ${error.message}` }] };
|
|
1235
1341
|
}
|
|
1236
1342
|
}
|
|
1343
|
+
case 'nexus_hook_generate': {
|
|
1344
|
+
const name = String(request.params.arguments?.name ?? '');
|
|
1345
|
+
const description = String(request.params.arguments?.description ?? '');
|
|
1346
|
+
const trigger = String(request.params.arguments?.trigger ?? 'run.created');
|
|
1347
|
+
const riskClass = String(request.params.arguments?.riskClass ?? 'orchestrate');
|
|
1348
|
+
const scope = String(request.params.arguments?.scope ?? 'session');
|
|
1349
|
+
const artifact = this.getRuntime().generateHook({ name, description, trigger, riskClass, scope });
|
|
1350
|
+
return {
|
|
1351
|
+
content: [{
|
|
1352
|
+
type: 'text',
|
|
1353
|
+
text: `๐ช Hook generated\nID: ${artifact.hookId}\nName: ${artifact.name}\nTrigger: ${artifact.trigger}\nScope: ${artifact.scope}`,
|
|
1354
|
+
}],
|
|
1355
|
+
};
|
|
1356
|
+
}
|
|
1357
|
+
case 'nexus_hook_deploy': {
|
|
1358
|
+
const hookId = String(request.params.arguments?.hookId ?? '');
|
|
1359
|
+
const scope = String(request.params.arguments?.scope ?? 'session');
|
|
1360
|
+
const runtime = this.getRuntime();
|
|
1361
|
+
const known = runtime.listHooks().find((hook) => hook.hookId === hookId || hook.name === hookId);
|
|
1362
|
+
const artifact = known ? runtime.deployHook(known.hookId, scope) : undefined;
|
|
1363
|
+
if (!artifact) {
|
|
1364
|
+
return { content: [{ type: 'text', text: `โ Hook not found: ${hookId}` }] };
|
|
1365
|
+
}
|
|
1366
|
+
nexusEventBus.emit('hook.deploy', { hookId: artifact.hookId, scope: artifact.scope, status: artifact.rolloutStatus });
|
|
1367
|
+
return {
|
|
1368
|
+
content: [{
|
|
1369
|
+
type: 'text',
|
|
1370
|
+
text: `๐ช Hook deployed\nID: ${artifact.hookId}\nName: ${artifact.name}\nScope: ${artifact.scope}\nRollout: ${artifact.rolloutStatus}`,
|
|
1371
|
+
}],
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1374
|
+
case 'nexus_hook_revoke': {
|
|
1375
|
+
const hookId = String(request.params.arguments?.hookId ?? '');
|
|
1376
|
+
const runtime = this.getRuntime();
|
|
1377
|
+
const known = runtime.listHooks().find((hook) => hook.hookId === hookId || hook.name === hookId);
|
|
1378
|
+
const artifact = known ? runtime.revokeHook(known.hookId) : undefined;
|
|
1379
|
+
if (!artifact) {
|
|
1380
|
+
return { content: [{ type: 'text', text: `โ Hook not found: ${hookId}` }] };
|
|
1381
|
+
}
|
|
1382
|
+
nexusEventBus.emit('hook.revoke', { hookId: artifact.hookId, status: artifact.rolloutStatus });
|
|
1383
|
+
return {
|
|
1384
|
+
content: [{
|
|
1385
|
+
type: 'text',
|
|
1386
|
+
text: `๐งฏ Hook revoked\nID: ${artifact.hookId}\nName: ${artifact.name}\nRollout: ${artifact.rolloutStatus}`,
|
|
1387
|
+
}],
|
|
1388
|
+
};
|
|
1389
|
+
}
|
|
1390
|
+
case 'nexus_automation_generate': {
|
|
1391
|
+
const name = String(request.params.arguments?.name ?? '');
|
|
1392
|
+
const description = String(request.params.arguments?.description ?? '');
|
|
1393
|
+
const triggerMode = String(request.params.arguments?.triggerMode ?? 'event');
|
|
1394
|
+
const eventTrigger = request.params.arguments?.eventTrigger ? String(request.params.arguments?.eventTrigger) : undefined;
|
|
1395
|
+
const scope = String(request.params.arguments?.scope ?? 'session');
|
|
1396
|
+
const artifact = this.getRuntime().generateAutomation({ name, description, triggerMode, eventTrigger, scope });
|
|
1397
|
+
return {
|
|
1398
|
+
content: [{
|
|
1399
|
+
type: 'text',
|
|
1400
|
+
text: `๐ค Automation generated\nID: ${artifact.automationId}\nName: ${artifact.name}\nTrigger Mode: ${artifact.triggerMode}\nScope: ${artifact.scope}`,
|
|
1401
|
+
}],
|
|
1402
|
+
};
|
|
1403
|
+
}
|
|
1404
|
+
case 'nexus_automation_deploy': {
|
|
1405
|
+
const automationId = String(request.params.arguments?.automationId ?? '');
|
|
1406
|
+
const scope = String(request.params.arguments?.scope ?? 'session');
|
|
1407
|
+
const runtime = this.getRuntime();
|
|
1408
|
+
const known = runtime.listAutomations().find((automation) => automation.automationId === automationId || automation.name === automationId);
|
|
1409
|
+
const artifact = known ? runtime.deployAutomation(known.automationId, scope) : undefined;
|
|
1410
|
+
if (!artifact) {
|
|
1411
|
+
return { content: [{ type: 'text', text: `โ Automation not found: ${automationId}` }] };
|
|
1412
|
+
}
|
|
1413
|
+
nexusEventBus.emit('automation.deploy', { automationId: artifact.automationId, scope: artifact.scope, status: artifact.rolloutStatus });
|
|
1414
|
+
return {
|
|
1415
|
+
content: [{
|
|
1416
|
+
type: 'text',
|
|
1417
|
+
text: `๐ค Automation deployed\nID: ${artifact.automationId}\nName: ${artifact.name}\nScope: ${artifact.scope}\nRollout: ${artifact.rolloutStatus}`,
|
|
1418
|
+
}],
|
|
1419
|
+
};
|
|
1420
|
+
}
|
|
1421
|
+
case 'nexus_automation_run': {
|
|
1422
|
+
const automationId = String(request.params.arguments?.automationId ?? '');
|
|
1423
|
+
const goalOverride = request.params.arguments?.goal ? String(request.params.arguments.goal) : undefined;
|
|
1424
|
+
try {
|
|
1425
|
+
const execution = await this.getRuntime().runAutomation(automationId, goalOverride);
|
|
1426
|
+
return {
|
|
1427
|
+
content: [{
|
|
1428
|
+
type: 'text',
|
|
1429
|
+
text: [
|
|
1430
|
+
`๐ค Automation Runtime โ ${summarizeExecution(execution)}`,
|
|
1431
|
+
`Run ID: ${execution.runId}`,
|
|
1432
|
+
`Artifacts: ${execution.artifactsPath}`,
|
|
1433
|
+
`Automations: ${execution.activeAutomations.map((automation) => automation.name).join(', ') || 'none'}`,
|
|
1434
|
+
`Result: ${execution.result}`,
|
|
1435
|
+
].join('\n'),
|
|
1436
|
+
}],
|
|
1437
|
+
};
|
|
1438
|
+
}
|
|
1439
|
+
catch (error) {
|
|
1440
|
+
return { content: [{ type: 'text', text: `โ Automation runtime error: ${error.message}` }] };
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
case 'nexus_automation_revoke': {
|
|
1444
|
+
const automationId = String(request.params.arguments?.automationId ?? '');
|
|
1445
|
+
const runtime = this.getRuntime();
|
|
1446
|
+
const known = runtime.listAutomations().find((automation) => automation.automationId === automationId || automation.name === automationId);
|
|
1447
|
+
const artifact = known ? runtime.revokeAutomation(known.automationId) : undefined;
|
|
1448
|
+
if (!artifact) {
|
|
1449
|
+
return { content: [{ type: 'text', text: `โ Automation not found: ${automationId}` }] };
|
|
1450
|
+
}
|
|
1451
|
+
nexusEventBus.emit('automation.revoke', { automationId: artifact.automationId, status: artifact.rolloutStatus });
|
|
1452
|
+
return {
|
|
1453
|
+
content: [{
|
|
1454
|
+
type: 'text',
|
|
1455
|
+
text: `๐งฏ Automation revoked\nID: ${artifact.automationId}\nName: ${artifact.name}\nRollout: ${artifact.rolloutStatus}`,
|
|
1456
|
+
}],
|
|
1457
|
+
};
|
|
1458
|
+
}
|
|
1459
|
+
case 'nexus_memory_audit': {
|
|
1460
|
+
const limit = Number(request.params.arguments?.limit ?? 80);
|
|
1461
|
+
const audit = this.getRuntime().auditMemory(limit) ?? { scanned: 0, quarantined: [], findings: [] };
|
|
1462
|
+
nexusEventBus.emit('memory.audit', { scanned: audit.scanned, quarantined: audit.quarantined.length });
|
|
1463
|
+
return {
|
|
1464
|
+
content: [{
|
|
1465
|
+
type: 'text',
|
|
1466
|
+
text: JSON.stringify(audit, null, 2),
|
|
1467
|
+
}],
|
|
1468
|
+
};
|
|
1469
|
+
}
|
|
1470
|
+
case 'nexus_federation_status': {
|
|
1471
|
+
const snapshot = this.getRuntime().getNetworkStatus();
|
|
1472
|
+
return {
|
|
1473
|
+
content: [{
|
|
1474
|
+
type: 'text',
|
|
1475
|
+
text: JSON.stringify(snapshot, null, 2),
|
|
1476
|
+
}],
|
|
1477
|
+
};
|
|
1478
|
+
}
|
|
1237
1479
|
case 'nexus_run_status': {
|
|
1238
1480
|
const runId = String(request.params.arguments?.runId ?? '');
|
|
1239
1481
|
const run = this.getRuntime().getRun(runId);
|
|
@@ -1251,7 +1493,12 @@ export class MCPAdapter {
|
|
|
1251
1493
|
workers: run.workerResults.length,
|
|
1252
1494
|
verifiedWorkers: run.workerResults.filter((worker) => worker.verified).length,
|
|
1253
1495
|
workflows: run.activeWorkflows.map((workflow) => workflow.name),
|
|
1496
|
+
hooks: run.activeHooks.map((hook) => hook.name),
|
|
1497
|
+
automations: run.activeAutomations.map((automation) => automation.name),
|
|
1254
1498
|
promotions: run.promotionDecisions,
|
|
1499
|
+
shield: run.shieldDecisions,
|
|
1500
|
+
memoryChecks: run.memoryChecks,
|
|
1501
|
+
federation: run.federationState,
|
|
1255
1502
|
backends: run.selectedBackends,
|
|
1256
1503
|
}, null, 2),
|
|
1257
1504
|
}],
|