Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PORT=3000
NODE_ENV=development
REDIS_URL=redis://127.0.0.1:6379
FRC_API_KEYS=frc_test_key,ayiti_gov_test_key
AYITI_API_KEY=ayiti_gov_test_key
FRC_DEFAULT_REGION=ht
AYITI_HTTP_TIMEOUT_MS=20000
# FRC_ALLOW_BUILTIN=1
# AYITI_HAITIDOCS_MCP=https://mcp.haitidocs.org
# AYITI_MEF_URL=https://www.mef.gouv.ht
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CI
on:
push:
branches: [main, "cursor/**"]
pull_request:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: [20, 22]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: npm
- run: npm install
- run: npm run lint
- run: npm test
env:
AYITI_HTTP_TIMEOUT_MS: "30000"
FRC_DEFAULT_REGION: ht
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,12 @@ node_modules/
dist/
build/
.env
.env.local
.netlify/
.gemini/
coverage/
*.vsix
.turbo/
.cache/
tmp/
*.tgz
9 changes: 9 additions & 0 deletions AYITI_OS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Ayiti OS (GoV)

Government-only model layer for FRC7. See root [README.md](./README.md) for full docs.

Live APIs:
- HaitiDocs MCP `https://mcp.haitidocs.org`
- HaitiDocs catalog `https://www.haitidocs.org/data/api/catalog.json`
- AyitiStats `https://ayitistats.org`
- Portals: MEF, DGI, BRH, OMRH, CNMP
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 EricksonAtHome

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
197 changes: 114 additions & 83 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,108 +1,139 @@
# 🚀 FRC (Fast Response Connection) Ecosystem
# FRC7 — Fast Response Connection

[![CI](https://github.com/EricksonAtHome/FRC7/actions/workflows/ci.yml/badge.svg)](https://github.com/EricksonAtHome/FRC7/actions/workflows/ci.yml)
[![Netlify Status](https://api.netlify.com/api/v1/badges/d6402a4e-7305-4f49-bd1c-c41798ee15da/deploy-status)](https://app.netlify.com/projects/frc7/deploys)

Welcome to the **Fast Response Connection (FRC)** ecosystem. FRC is a next-generation distributed AI execution platform and scripting language.
**FRC7** is a distributed AI execution platform with a declarative language (**FRCL**), a production gateway, and **Ayiti OS (GoV)** — Haitian government models wired to real public APIs.

What started as a simple declarative language (`.frcl`) has evolved through 9 levels of complexity into a full-scale, cloud-native, distributed AI network capable of executing models securely across global regional nodes.
![FRC](https://raw.githubusercontent.com/EricksonAtHome/FRC7/refs/heads/main/img/1n8jky1n8jky1n8j.png)

This repository serves as the **master monorepo** for the entire FRC project. It contains every layer of the architecture: from the lightweight language parser to the production Kubernetes cluster setup.
## What's new in 7.1

![FRC Image](https://raw.githubusercontent.com/EricksonAtHome/FRC7/refs/heads/main/img/1n8jky1n8jky1n8j.png)
- **Ayiti OS GoV models only by default** (`ayiti.search`, `ayiti.stats`, `ayiti.dgi`, …)
- **Live HaitiDocs MCP + JSON APIs** (search, indicators, documents)
- **Ministry portals** — MEF, DGI, BRH, OMRH, CNMP (+ AyitiStats)
- **New APIs**: `/v1/batch`, `/v1/lint`, `/v1/metrics`, `/v1/worker/tick`, webhooks
- **New models**: `ayiti.translate`, `ayiti.alert`, citizen triage, UXP envelopes
- **FRCL upgrades**: `lang`, `webhook`, `retry`, `batch`, comments, URL idents
- **Control panel** UI for Ayiti OS
- **Tests + CI** on Node 20/22

## 🧠 What is FRC?
## Quick start

At its core, **FRC** solves the problem of decentralized AI execution. Instead of building monolithic AI apps, FRC allows developers to write simple, declarative scripts (using the **FRCL** language) that instruct a network to:

1. Parse the intent.
2. Route the task to the nearest global node (EU, US, ASIA).
3. Queue the task asynchronously using Redis.
4. Execute the AI model and stream the result back to the client.

## 📂 Directory Breakdown & Capabilities

Here is a thorough explanation of every component folder in this repository, why it exists, and how to use it.

### 1. `frcl-extension/` (Developer Tooling)

- **What it is:** A Visual Studio Code extension.
- **Why it exists:** FRC has its own language syntax (`.frcl`). To make the developer experience seamless, this extension provides native syntax highlighting, intelligent auto-completion, and colorization for `.frcl` files inside VS Code.
- **What you can do:** Compile it using `vsce package` and install the `.vsix` file into your IDE to get proper FRC code styling.

### 2. `dev-installer/` (The AI Project Brain)

- **What it is:** A Python-based orchestration and scaffolding tool.
- **Why it exists:** This represents "Level 4" of the system—an autonomous project generator. Instead of manually setting up Next.js or Docker projects, you describe what you want in FRCL, and this Python engine scaffolds the entire project.
- **What you can do:** Run `python installer.py` to auto-generate full-stack applications.

### 3. `frc-node/` (The Autonomous Meta-System)

- **What it is:** A theoretical Python implementation of the advanced concepts (Levels 5 through 9).
- **Why it exists:** It explores how FRC functions as a "living" system without a UI. It includes logic for `Self-Adaptive Nodes` (auto-healing), `Global Routing` (zero-trust security), and `Self-Rewriting` architectures where the system writes its own deployment code based on server stress.
- **What you can do:** Explore files like `self_evolving_node.py` to study autonomous system architectures and self-scaling mathematical models.

### 4. `frc-runtime/` & `frc-real/` (The Core Engine Basics)

- **What it is:** The earliest, foundational JavaScript implementations of the FRC execution engine.
- **Why it exists:** To bridge the gap between the `.frcl` script and the actual machine execution. It contains the raw string parsers that extract instructions like `use model models5` and turn them into JSON payloads.
- **What you can do:** Run the CLI (`node cli/frc.js`) to parse raw text files locally.

### 5. `frc-v1/` & `frc-v2/` (The Production Backends)

- **What it is:** Grounded, production-ready backend architectures using Node.js, Express, and Redis.
- **Why it exists:** This translates the theoretical routing into real software engineering.
- **`v1`** is a simple monolithic API and worker.
- **`v2`** is the **Production System**. It introduces `x-api-key` authentication, an Express API Gateway, and a Redis Job Queue. The gateway pushes tasks to Redis, and multi-node Docker workers pull jobs off the queue asynchronously.
- **What you can do:** `cd frc-v2` and run `docker-compose up` to launch a fully distributed job queue and worker cluster on your local machine.
```bash
npm install
npm test
npm run demo # ayiti.translate local demo
npm run demo:ayiti # live HaitiDocs search
npm run start:gateway # http://127.0.0.1:3000
npm start -w @frc/control-panel # http://127.0.0.1:8787
```

### 6. `frc-cluster/` (The Multi-Region Blueprint)
```bash
# CLI
npx frc models
npx frc exec ayiti.citizen "Mwen bezwen NIF nan DGI"
npx frc lint demo.frcl
npx frc health
npx frc run examples/ayiti/search.frcl
```

- **What it is:** A simulated global compute network using Docker Compose.
- **Why it exists:** It proves that FRC can scale globally. It launches an API Gateway alongside three independent regional nodes (`node-eu`, `node-us`, `node-asia`).
- **What you can do:** Send a request to the Gateway with a header `x-country: US`, and watch the Gateway intelligently proxy the request specifically to the US Node container.
## Architecture

### 7. `frc-k8s/` (The Enterprise Cloud Architecture)
```
Client / CLI / Control Panel / Arduino
FRC7 Gateway — auth · lint · batch · geo-route (HT default)
Redis queue + job results + webhooks
@frc/engine → Ayiti OS GoV models
HaitiDocs MCP/JSON · AyitiStats · .gouv.ht portals
```

- **What it is:** A comprehensive suite of Kubernetes configuration manifests (`.yaml`).
- **Why it exists:** To transition FRC from "local Docker" to a real Cloud-Native platform (like AWS EKS or Google GKE). It includes Deployments, Services, an Ingress router, and Horizontal Pod Autoscalers (HPA).
- **What you can do:** Apply this directly to a Kubernetes cluster (`kubectl apply -f k8s/`) to spin up auto-scaling regional nodes that react to real-time CPU utilization.
## Ayiti OS (GoV) models

| Model | Purpose |
|---|---|
| `ayiti.search` | HaitiDocs knowledge search |
| `ayiti.stats` | Indicator catalog / SDMX series |
| `ayiti.docs` | Official document lookup |
| `ayiti.mef` / `ayiti.dgi` / `ayiti.brh` / `ayiti.omrh` / `ayiti.cnmp` | Ministry desks |
| `ayiti.citizen` | Intent triage → ministry model |
| `ayiti.translate` | Kreyòl / FR / EN civic glossary assist |
| `ayiti.alert` | Public alert brief from open sources |
| `ayiti.uxp` | Inter-agency exchange envelope |

Generic models like `models5` are **rejected** unless `FRC_ALLOW_BUILTIN=1` (demo only: `echo`, `summarizer`, `coder`).

## HTTP API

| Method | Path | Description |
|---|---|---|
| `GET` | `/health` | Liveness + Ayiti probe summary |
| `GET` | `/v1/models` | Allowed GoV models |
| `GET` | `/v1/metrics` | Queue counters |
| `POST` | `/v1/run/:model` | Sync/async model run |
| `POST` | `/v1/execute` | Full FRCL script |
| `POST` | `/v1/batch` | Up to 20 jobs |
| `POST` | `/v1/lint` | FRCL validation |
| `GET` | `/v1/jobs/:id` | Job status/result |
| `POST` | `/v1/worker/tick` | Process one queued job |

Auth: `x-api-key: ayiti_gov_test_key` (dev).

### 8. `frc-netlify-live/` & `frc-control-panel/` (The Serverless Edge)
```bash
curl -s localhost:3000/v1/run/ayiti.search \
-H 'content-type: application/json' \
-H 'x-api-key: ayiti_gov_test_key' \
-d '{"input":"BRH inflation","sync":true,"region":"ht"}'
```

- **What it is:** The Global Control Panel built on Netlify Serverless Edge Functions.
- **Why it exists:** Because running the heavy AI compute directly on the frontend is inefficient. The Netlify app serves purely as a **Smart Router and UI**. It uses Netlify's native IP/Geo-headers (`x-nf-country`) to instantly detect where the user is located, and forwards the payload to the nearest external `frc.systems` cluster.
- **What you can do:** Push this to Netlify to instantly deploy a globally distributed Edge Router with zero server maintenance.
## FRCL example

### 9. `arduino_example/` (The Hardware IoT Client)
```frcl
set env "prod"
region ht
lang ht

- **What it is:** C++ hardware logic for microcontrollers like the ESP32 and Arduino boards.
- **Why FRC makes IoT better:** Traditional hardware requires complex backend logic, heavy MQTT brokers, or tight coupling to a specific cloud provider to process AI logic. FRC abstracts all of this. An Arduino board simply makes a lightweight HTTP `POST` request containing FRCL instructions, and the FRC cloud network instantly parses it, routes it globally, executes the AI model, and returns a clean JSON response.
- **How developers can use it for testing:** Developers can flash `arduino_example.ino` onto an ESP32, connect it to WiFi, and immediately see live responses from `frc.systems` in their Serial Monitor. This provides a zero-friction playground to test latency and AI model outputs on real physical devices.
- **Using it in your own apps:** You can directly embed this HTTP architecture into smart home sensors, robotics, or industrial monitoring tools. For example, a temperature sensor could send raw data to an FRC node, where an AI model analyzes it and returns an instruction (e.g., "turn_on_cooling") directly to the microcontroller.
use model "ayiti.citizen"

## 🛠️ Usage (Singularity CLI)
run model ayiti.citizen {
input "Mwen bezwen NIF nan DGI"
retry 1
}

The FRC CLI interfaces with the self-modifying ecosystem.
print result
```

```bash
# Execute model globally
frc run models5
## Monorepo layout

# Trigger Level 9 Singularity Loop (Self-Rewriting Ecosystem)
frc singularity
| Path | Role |
|---|---|
| `packages/frcl` | Language tokenizer / parser / lint |
| `packages/engine` | Execution + model policy |
| `packages/core` | Auth, regions, Redis/memory queue, webhooks, metrics |
| `packages/ayiti-gov` | Government models + Haiti API clients |
| `packages/sdk` | JS client |
| `apps/gateway` | Production API |
| `apps/cli` | `frc` CLI |
| `apps/control-panel` | Browser UI |
| `examples/` | Sample `.frcl` scripts |
| `frc-v1` … `frc-k8s` | Legacy infra packages (reference) |

# View dynamic ecosystem map
frc nodes
```
## Configuration

## 🛠️ The FRC Execution Flow
Copy `.env.example` → `.env`:

No matter which folder you are looking at, the systemic logic of FRC remains uniform:
- `AYITI_API_KEY` / `FRC_API_KEYS`
- `REDIS_URL` (optional — memory fallback)
- `AYITI_HAITIDOCS_MCP` / portal URL overrides
- `FRC_ALLOW_BUILTIN=1` for local non-gov demos

1. **Client Request**: A developer, dashboard, or hardware device sends FRCL script instructions.
2. **Global Router (Netlify / Ingress)**: Evaluates user location and traffic.
3. **API Gateway (Express)**: Authenticates API keys and secures the payload.
4. **Broker (Redis)**: Buffers the tasks to prevent system crashes during high traffic.
5. **Execution Nodes (Docker / K8s)**: Asynchronously grabs the job, runs the AI model, and returns the result.
## License

This repository is the complete blueprint for an enterprise-scale AI operating system.
MIT
17 changes: 17 additions & 0 deletions apps/cli/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@frc/cli",
"version": "7.1.0",
"type": "module",
"bin": { "frc": "src/index.js" },
"scripts": {
"frc": "node src/index.js",
"test": "node --test test/*.test.js"
},
"dependencies": {
"@frc/frcl": "7.1.0",
"@frc/engine": "7.1.0",
"@frc/core": "7.1.0",
"@ayiti/gov": "7.1.0"
},
"license": "MIT"
}
Loading
Loading