Skip to content

Commit 7323d8f

Browse files
Initial release: AI Maestro Gateway Services
Multi-gateway monorepo for AI Maestro mesh network: - Email Gateway (Mandrill webhooks, IMAP/SMTP) - Slack Gateway (Socket Mode, Events API) - Discord Gateway (discord.js, Gateway Intents) - WhatsApp Gateway (Baileys, WhatsApp Web) Features: - Unified content security (34 injection patterns, trust-based wrapping) - Timing-safe authentication across all gateways - Management APIs (activity logs, config, stats) - Docker + docker-compose deployment - CI/CD with GitHub Actions - ESLint + TypeScript strict mode Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0 parents  commit 7323d8f

117 files changed

Lines changed: 22477 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: 22
19+
20+
- name: Install root dependencies
21+
run: npm install
22+
23+
- name: Lint
24+
run: npm run lint
25+
26+
build:
27+
runs-on: ubuntu-latest
28+
29+
strategy:
30+
matrix:
31+
gateway: [discord-gateway, slack-gateway, email-gateway, whatsapp-gateway]
32+
33+
defaults:
34+
run:
35+
working-directory: ${{ matrix.gateway }}
36+
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- uses: actions/setup-node@v4
41+
with:
42+
node-version: 22
43+
cache: npm
44+
cache-dependency-path: ${{ matrix.gateway }}/package-lock.json
45+
46+
- name: Install dependencies
47+
run: npm ci
48+
49+
- name: Type check
50+
run: npm run typecheck --if-present
51+
52+
- name: Test
53+
run: npm test --if-present

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules/
2+
dist/
3+
.env
4+
.env.*
5+
!.env.example
6+
credentials/
7+
credentials.yaml
8+
*.bak

CONTRIBUTING.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Contributing to AI Maestro Gateways
2+
3+
Thank you for your interest in contributing! This guide will help you get started.
4+
5+
## How to Contribute
6+
7+
1. **Fork** the repository
8+
2. **Create a branch** for your feature or fix (`git checkout -b feature/my-change`)
9+
3. **Make your changes** and write tests if applicable
10+
4. **Run type checks** to ensure nothing is broken
11+
5. **Commit** with a clear message describing the change
12+
6. **Open a Pull Request** against `main`
13+
14+
## Development Setup
15+
16+
### Prerequisites
17+
18+
- Node.js 22+
19+
- npm 10+
20+
21+
### Getting Started
22+
23+
Each gateway is an independent Node.js project. To work on a specific gateway:
24+
25+
```bash
26+
cd discord-gateway # or slack-gateway, email-gateway, whatsapp-gateway
27+
cp .env.example .env # configure your local environment
28+
npm install
29+
npm run dev # start with file watching
30+
```
31+
32+
### Running Type Checks
33+
34+
```bash
35+
cd <gateway-dir>
36+
npm run typecheck # runs tsc --noEmit
37+
```
38+
39+
### Running Tests
40+
41+
```bash
42+
cd <gateway-dir>
43+
npm test # if tests exist for that gateway
44+
```
45+
46+
## Code Style
47+
48+
- **Language:** TypeScript (strict mode)
49+
- **Module system:** ESM (`"type": "module"` in package.json)
50+
- **Runtime:** tsx (TypeScript execution without build step)
51+
- **Formatting:** Use consistent indentation (2 spaces)
52+
- **Naming:** camelCase for variables/functions, PascalCase for types/interfaces
53+
- **Imports:** Use `.js` extensions in import paths (required for ESM)
54+
- **Error handling:** Always handle errors gracefully; log with `[CONTEXT]` prefixes
55+
56+
## Pull Requests
57+
58+
- Keep PRs focused on a single change
59+
- Include a clear description of what the PR does and why
60+
- Reference any related issues
61+
- Make sure type checks pass before requesting review
62+
- Update `.env.example` if you add new environment variables
63+
- Update the gateway's README if you change behavior
64+
65+
## Adding a New Gateway
66+
67+
To add a new gateway to the monorepo:
68+
69+
1. **Create the directory** at the repo root (e.g., `telegram-gateway/`)
70+
2. **Initialize the project:**
71+
```bash
72+
mkdir telegram-gateway && cd telegram-gateway
73+
npm init -y
74+
```
75+
3. **Follow the existing structure:**
76+
```
77+
telegram-gateway/
78+
├── .env.example # All env vars with placeholder values
79+
├── .gitignore # node_modules, dist, .env
80+
├── Dockerfile # Multi-stage build (see other gateways)
81+
├── ecosystem.config.cjs # pm2 configuration
82+
├── package.json # Scripts: start, dev, typecheck
83+
├── tsconfig.json
84+
└── src/
85+
├── config.ts # Load env vars with dotenv
86+
├── content-security.ts # Trust model + injection scanning
87+
├── inbound.ts # Platform -> AI Maestro
88+
├── outbound.ts # AI Maestro -> Platform
89+
├── server.ts # Express health/management + main()
90+
└── types.ts # TypeScript interfaces
91+
```
92+
4. **Implement the content security module** with the standard trust model (operator/external) and injection pattern scanner
93+
5. **Add a health endpoint** at `GET /health`
94+
6. **Add the gateway** to the CI matrix in `.github/workflows/ci.yml`
95+
7. **Add a service** to `docker-compose.yml`
96+
8. **Create a Dockerfile** following the multi-stage pattern
97+
9. **Update the root README** with the new gateway info

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 23blocks-OS
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)