cerebrex 0.3.1 โ†’ 0.4.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.
Files changed (4) hide show
  1. package/LICENSE +130 -0
  2. package/README.md +305 -0
  3. package/dist/index.js +376 -391
  4. package/package.json +16 -2
package/LICENSE ADDED
@@ -0,0 +1,130 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other transformations
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by You, including the original version of the Work and any
49
+ modifications or additions to that Work or Derivative Works of the Work.
50
+
51
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
52
+ whom a Contribution has been received by the Licensor.
53
+
54
+ 2. Grant of Copyright License. Subject to the terms and conditions of
55
+ this License, each Contributor hereby grants to You a perpetual,
56
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
57
+ copyright license to reproduce, prepare Derivative Works of,
58
+ publicly display, publicly perform, sublicense, and distribute the
59
+ Work and such Derivative Works in Source or Object form.
60
+
61
+ 3. Grant of Patent License. Subject to the terms and conditions of
62
+ this License, each Contributor hereby grants to You a perpetual,
63
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
64
+ (except as stated in this section) patent license to make, have made,
65
+ use, offer to sell, sell, import, and otherwise transfer the Work,
66
+ where such license applies only to those patent claims licensable
67
+ by such Contributor that are necessarily infringed by their
68
+ Contribution(s) alone or by the combination of their Contribution(s)
69
+ with the Work to which such Contribution(s) was submitted. If You
70
+ institute patent litigation against any entity (including a cross-claim
71
+ or counterclaim in a lawsuit) alleging that the Work or any
72
+ Contribution embodied within the Work constitutes direct or contributory
73
+ patent infringement, then any patent licenses granted to You under
74
+ this License for that Work shall terminate as of the date such
75
+ litigation is filed.
76
+
77
+ 4. Redistribution. You may reproduce and distribute copies of the
78
+ Work or Derivative Works thereof in any medium, with or without
79
+ modifications, and in Source or Object form, provided that You
80
+ meet the following conditions:
81
+
82
+ (a) You must give any other recipients of the Work or Derivative
83
+ Works a copy of this License; and
84
+
85
+ (b) You must cause any modified files to carry prominent notices
86
+ stating that You changed the files; and
87
+
88
+ (c) You must retain, in the Source form of any Derivative Works
89
+ that You distribute, all copyright, patent, trademark, and
90
+ attribution notices from the Source form of the Work,
91
+ excluding those notices that do not pertain to any part of
92
+ the Derivative Works; and
93
+
94
+ (d) If the Work includes a "NOTICE" text file, You must include a
95
+ readable copy of the attribution notices contained within such
96
+ NOTICE file, in the Derivative Works that You distribute.
97
+
98
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
99
+ any Contribution intentionally submitted for inclusion in the Work
100
+ by You to the Licensor shall be under the terms and conditions of
101
+ this License, without any additional terms or conditions.
102
+
103
+ 6. Trademarks. This License does not grant permission to use the trade
104
+ names, trademarks, service marks, or product names of the Licensor,
105
+ including "CerebreX", "A Real Cool Co.", and associated logos,
106
+ except as required for reasonable and customary use in describing the
107
+ origin of the Work and reproducing the content of the NOTICE file.
108
+
109
+ 7. Disclaimer of Warranty. Unless required by applicable law or
110
+ agreed to in writing, Licensor provides the Work on an "AS IS" BASIS,
111
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
112
+
113
+ 8. Limitation of Liability. In no event and under no legal theory,
114
+ whether in tort, contract, or otherwise, shall any Contributor be
115
+ liable for damages, including any direct, indirect, special,
116
+ incidental, or exemplary damages arising out of this License or
117
+ out of the use or inability to use the Work.
118
+
119
+ 9. Accepting Warranty or Additional Liability. While redistributing
120
+ the Work or Derivative Works thereof, You may offer and charge a fee
121
+ for acceptance of support, warranty, indemnity, or other liability
122
+ obligations and rights consistent with this License.
123
+
124
+ END OF TERMS AND CONDITIONS
125
+
126
+ Copyright 2026 A Real Cool Co. โ€” Josef Douglas Charles McClammey
127
+ Licensed under the Apache License, Version 2.0.
128
+ You may not use this file except in compliance with the License.
129
+ You may obtain a copy of the License at:
130
+ http://www.apache.org/licenses/LICENSE-2.0
package/README.md ADDED
@@ -0,0 +1,305 @@
1
+ <div align="center">
2
+
3
+ # CerebreX
4
+
5
+ ### The Open-Source Agent Infrastructure OS
6
+
7
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](./LICENSE)
8
+ [![CI](https://github.com/therealcoolnerd/CerebreX/actions/workflows/ci.yml/badge.svg)](https://github.com/therealcoolnerd/CerebreX/actions/workflows/ci.yml)
9
+ [![npm version](https://img.shields.io/npm/v/cerebrex.svg)](https://www.npmjs.com/package/cerebrex)
10
+ [![GitHub Stars](https://img.shields.io/github/stars/therealcoolnerd/CerebreX?style=social)](https://github.com/therealcoolnerd/CerebreX)
11
+ [![Issues](https://img.shields.io/github/issues/therealcoolnerd/CerebreX)](https://github.com/therealcoolnerd/CerebreX/issues)
12
+
13
+ **Build. Test. Remember. Coordinate. Publish.**
14
+ The complete infrastructure layer for AI agents โ€” in one CLI.
15
+
16
+ [๐Ÿš€ Quickstart](#-quickstart) ยท [๐Ÿ—‚ Structure](#-monorepo-structure) ยท [๐Ÿ›ฃ Roadmap](#-roadmap) ยท [๐Ÿ› Issues](https://github.com/therealcoolnerd/CerebreX/issues)
17
+
18
+ </div>
19
+
20
+ ---
21
+
22
+ > **Status: v0.4.0 โ€” Registry Web UI live, all 6 CLI modules on npm**
23
+ > `npm install -g cerebrex` โ€” FORGE, TRACE, MEMEX, AUTH, REGISTRY, and HIVE are all working.
24
+ >
25
+ > **Live:** Registry UI โ†’ `https://cerebrex-registry.therealjosefdmcclammey.workers.dev`
26
+ > **Live:** Trace Explorer โ†’ `https://cerebrex-registry.therealjosefdmcclammey.workers.dev/ui/trace`
27
+ >
28
+ > **Website: Coming Soon** โ€” `https://therealcool.site`
29
+
30
+ ---
31
+
32
+ ## What is CerebreX?
33
+
34
+ CerebreX is an open-source **Agent Infrastructure OS** โ€” the complete toolchain developers need to build reliable, observable, and secure AI agents.
35
+
36
+ Six modules. One CLI. One registry. One coordination layer.
37
+
38
+ | Module | Command | Status | What It Does |
39
+ |--------|---------|--------|-------------|
40
+ | ๐Ÿ”จ **FORGE** | `cerebrex build` | โœ… Working | Generate production MCP servers from any OpenAPI spec |
41
+ | ๐Ÿ” **TRACE** | `cerebrex trace` | โœ… Working | Record agent execution + visual web dashboard |
42
+ | ๐Ÿง  **MEMEX** | `cerebrex memex` | โœ… Working | Persistent memory with SHA-256 integrity + TTL |
43
+ | ๐Ÿ”‘ **AUTH** | `cerebrex auth` | โœ… Working | Secure token storage for registry authentication |
44
+ | ๐Ÿ“ฆ **REGISTRY** | `cerebrex publish` | โœ… Working | Publish and install MCP servers (live registry + web UI) |
45
+ | ๐Ÿ **HIVE** | `cerebrex hive` | โœ… Working | Multi-agent coordination with JWT auth |
46
+
47
+ ---
48
+
49
+ ## โšก Quickstart
50
+
51
+ ```bash
52
+ npm install -g cerebrex
53
+ cerebrex --help
54
+ ```
55
+
56
+ Or build from source (requires [Bun](https://bun.sh)):
57
+
58
+ ```bash
59
+ git clone https://github.com/therealcoolnerd/CerebreX.git
60
+ cd CerebreX/cerebrex
61
+ bun install
62
+ cd packages/types && bun run build && cd ../..
63
+ cd packages/core && bun run build && cd ../..
64
+ cd packages/registry-client && bun run build && cd ../..
65
+ cd apps/cli && bun run build
66
+ node dist/index.js --help
67
+ ```
68
+
69
+ ---
70
+
71
+ ## ๐Ÿ”จ FORGE โ€” MCP Server Generation
72
+
73
+ Generate a production-ready MCP server from any OpenAPI spec:
74
+
75
+ ```bash
76
+ # From a URL
77
+ cerebrex build --spec https://petstore3.swagger.io/api/v3/openapi.json --output ./my-server
78
+
79
+ # From a local file
80
+ cerebrex build --spec ./openapi.yaml --output ./my-server
81
+ ```
82
+
83
+ Output is a Cloudflare Workers project with:
84
+ - Zod input validation on every tool
85
+ - MCP-compliant stdio/SSE/Streamable HTTP transports
86
+ - Ready for `wrangler deploy`
87
+
88
+ ---
89
+
90
+ ## ๐Ÿ” TRACE โ€” Agent Execution Recording
91
+
92
+ ```bash
93
+ # Start recording (runs in foreground, default port 7432)
94
+ cerebrex trace start --session my-agent --port 7432
95
+
96
+ # From your agent, push steps:
97
+ # POST http://localhost:7432/step
98
+ # Body: { "type": "tool_call", "toolName": "listPets", "inputs": {}, "latencyMs": 42 }
99
+
100
+ # Stop and save
101
+ cerebrex trace stop --session my-agent
102
+
103
+ # View in terminal
104
+ cerebrex trace view --session my-agent
105
+
106
+ # View in visual web dashboard (opens browser)
107
+ cerebrex trace view --session my-agent --web
108
+
109
+ # Or use the hosted Trace Explorer (no CLI required)
110
+ # https://cerebrex-registry.therealjosefdmcclammey.workers.dev/ui/trace
111
+
112
+ # List all saved sessions
113
+ cerebrex trace list
114
+ ```
115
+
116
+ Traces are saved to `~/.cerebrex/traces/`.
117
+
118
+ ---
119
+
120
+ ## ๐Ÿง  MEMEX โ€” Persistent Agent Memory
121
+
122
+ ```bash
123
+ # Store a value
124
+ cerebrex memex set "user-pref" "dark mode" --namespace ui
125
+
126
+ # Retrieve it
127
+ cerebrex memex get "user-pref" --namespace ui
128
+
129
+ # List all memory
130
+ cerebrex memex list
131
+
132
+ # With TTL (auto-expires after 3600 seconds)
133
+ cerebrex memex set "session-ctx" "..." --ttl 3600
134
+
135
+ # Delete a key
136
+ cerebrex memex delete "user-pref" --namespace ui
137
+
138
+ # List all namespaces
139
+ cerebrex memex namespaces
140
+ ```
141
+
142
+ All writes are SHA-256 checksummed. Reads verify integrity before returning.
143
+ Storage: `~/.cerebrex/memex/<namespace>.json` โ€” local, no cloud required.
144
+
145
+ ---
146
+
147
+ ## ๐Ÿ”‘ AUTH โ€” Secure Credentials
148
+
149
+ ```bash
150
+ cerebrex auth login # store token at ~/.cerebrex/.credentials (mode 0600)
151
+ cerebrex auth status # check current auth state
152
+ cerebrex auth logout # remove stored token
153
+ ```
154
+
155
+ `CEREBREX_TOKEN` env var always takes precedence over stored credentials.
156
+
157
+ ---
158
+
159
+ ## ๐Ÿ“ฆ REGISTRY โ€” Publish & Install MCP Servers
160
+
161
+ Registry API: `https://cerebrex-registry.therealjosefdmcclammey.workers.dev`
162
+ Registry UI: `https://cerebrex-registry.therealjosefdmcclammey.workers.dev` (browser)
163
+
164
+ ```bash
165
+ cerebrex auth login # authenticate first
166
+ cerebrex validate ./my-server # validate before publishing
167
+ cerebrex validate ./my-server --strict # + OWASP checks
168
+ cerebrex publish --dir ./my-server # publish to registry
169
+ cerebrex install my-mcp-server # install from registry
170
+ ```
171
+
172
+ ---
173
+
174
+ ## ๐Ÿ HIVE โ€” Multi-Agent Coordination
175
+
176
+ ```bash
177
+ # Initialize a HIVE coordinator
178
+ cerebrex hive init --name my-hive
179
+
180
+ # Start the coordinator (runs on port 7433)
181
+ cerebrex hive start
182
+
183
+ # In another terminal โ€” register an agent and get a JWT
184
+ cerebrex hive register --id agent-1 --name "Summarizer" --capabilities summarize,classify
185
+
186
+ # Check who's connected
187
+ cerebrex hive status
188
+
189
+ # Send a task to an agent (use the JWT printed by register)
190
+ cerebrex hive send --agent agent-1 --type summarize --payload '{"text":"..."}' --token <JWT>
191
+ ```
192
+
193
+ HIVE runs a local HTTP coordinator with JWT-signed agent authentication.
194
+ Agents register, receive tasks, and report results back via the REST API.
195
+ State is persisted to `~/.cerebrex/hive/state.json`.
196
+
197
+ ---
198
+
199
+ ## ๐ŸŒ Web UI
200
+
201
+ The CerebreX registry includes a browser-based UI served directly from the Worker โ€” no install required.
202
+
203
+ | URL | What It Does |
204
+ |-----|-------------|
205
+ | `/` | Registry browser โ€” search packages, view details, copy install commands |
206
+ | `/ui/trace` | Hosted Trace Explorer โ€” drag-and-drop JSON trace files, full visual timeline |
207
+
208
+ ---
209
+
210
+ ## ๐Ÿ—‚ Monorepo Structure
211
+
212
+ ```
213
+ CerebreX/
214
+ โ”œโ”€โ”€ apps/
215
+ โ”‚ โ”œโ”€โ”€ cli/ # cerebrex CLI โ€” the main published package
216
+ โ”‚ โ”‚ โ”œโ”€โ”€ src/
217
+ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ commands/ # build, trace, memex, auth, hive, other-commands
218
+ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ core/ # forge/, trace/, memex/ engines + dashboard
219
+ โ”‚ โ”‚ โ””โ”€โ”€ dist/ # built output (git-ignored, built by CI)
220
+ โ”‚ โ””โ”€โ”€ dashboard/ # Standalone trace explorer HTML
221
+ โ”‚ โ””โ”€โ”€ src/index.html
222
+ โ”œโ”€โ”€ workers/
223
+ โ”‚ โ””โ”€โ”€ registry/ # Cloudflare Worker โ€” live registry backend + Web UI
224
+ โ”‚ โ”œโ”€โ”€ src/index.ts # REST API (D1 + KV) + embedded HTML pages
225
+ โ”‚ โ”œโ”€โ”€ schema.sql # D1 database schema
226
+ โ”‚ โ””โ”€โ”€ wrangler.toml
227
+ โ”œโ”€โ”€ packages/
228
+ โ”‚ โ”œโ”€โ”€ core/ # @cerebrex/core โ€” shared utilities
229
+ โ”‚ โ”œโ”€โ”€ types/ # @cerebrex/types โ€” shared TypeScript types
230
+ โ”‚ โ””โ”€โ”€ registry-client/ # @cerebrex/registry โ€” registry API client
231
+ โ”œโ”€โ”€ .github/
232
+ โ”‚ โ””โ”€โ”€ workflows/
233
+ โ”‚ โ”œโ”€โ”€ ci.yml # build + typecheck on push/PR
234
+ โ”‚ โ”œโ”€โ”€ publish.yml # npm publish on GitHub release
235
+ โ”‚ โ””โ”€โ”€ deploy-registry.yml # auto-deploy registry Worker
236
+ โ””โ”€โ”€ turbo.json
237
+ ```
238
+
239
+ ---
240
+
241
+ ## ๐Ÿ”’ Security
242
+
243
+ Built security-first, aligned with the [OWASP Top 10 for Agentic Applications (2025)](https://genai.owasp.org).
244
+
245
+ - **Memory Integrity** โ€” All MEMEX writes are SHA-256 checksummed. Reads verify before returning.
246
+ - **Zero Hardcoded Secrets** โ€” `cerebrex validate` scans for hardcoded credentials and blocks deploy.
247
+ - **Input Validation** โ€” Zod schemas validate every tool input in generated MCP servers.
248
+ - **Secure Credentials** โ€” Auth tokens stored at `~/.cerebrex/.credentials` (mode 0600).
249
+ - **JWT Agent Auth** โ€” HIVE uses HMAC-SHA256 signed JWTs for all agent communications.
250
+
251
+ Found a vulnerability? Please read our [Security Policy](./SECURITY.md) and report it privately.
252
+
253
+ ---
254
+
255
+ ## ๐Ÿค Contributing
256
+
257
+ Contributions are welcome. CerebreX is a solo-built open-source project โ€” PRs, issues, and feedback all help.
258
+
259
+ ```bash
260
+ git clone https://github.com/therealcoolnerd/CerebreX.git
261
+ cd CerebreX/cerebrex
262
+ bun install
263
+ cd packages/types && bun run build && cd ../..
264
+ cd packages/core && bun run build && cd ../..
265
+ cd packages/registry-client && bun run build && cd ../..
266
+ cd apps/cli && bun run build
267
+ # Open a PR against main
268
+ ```
269
+
270
+ ---
271
+
272
+ ## ๐Ÿ›ฃ Roadmap
273
+
274
+ - [x] FORGE โ€” MCP server generation from OpenAPI *(v0.1)*
275
+ - [x] TRACE โ€” Real HTTP event server, step recording + replay *(v0.2)*
276
+ - [x] MEMEX โ€” Persistent agent memory, SHA-256 integrity, TTL *(v0.2)*
277
+ - [x] AUTH โ€” Secure token storage, `cerebrex auth login/logout/status` *(v0.2)*
278
+ - [x] VALIDATE โ€” Real MCP + OWASP compliance checks *(v0.2)*
279
+ - [x] CI/CD โ€” GitHub Actions build + npm publish pipeline *(v0.2)*
280
+ - [x] npm package live โ€” `npm install -g cerebrex` *(v0.2.1)*
281
+ - [x] Web dashboard โ€” Visual trace explorer (`cerebrex trace view --web`) *(v0.3)*
282
+ - [x] Registry backend โ€” Cloudflare Worker + D1 + KV *(v0.3)*
283
+ - [x] HIVE โ€” Multi-agent JWT coordination (init/start/register/status/send) *(v0.3)*
284
+ - [x] Web UI โ€” Registry browser + hosted trace explorer (Worker-embedded) *(v0.4)*
285
+ - [ ] Website โ€” `therealcool.site` *(coming soon)*
286
+ - [ ] Custom domain โ€” `registry.cerebrex.dev` *(next)*
287
+ - [ ] Real registry auth โ€” account registration + token validation *(v0.5)*
288
+ - [ ] Agent test runner โ€” `cerebrex test` with replay + assertions *(v0.5)*
289
+ - [ ] Enterprise tier + on-prem *(v1.0)*
290
+
291
+ ---
292
+
293
+ ## ๐Ÿ“„ License
294
+
295
+ CerebreX is open source under the [Apache 2.0 License](./LICENSE).
296
+
297
+ ---
298
+
299
+ <div align="center">
300
+
301
+ Built by [therealcoolnerd](https://github.com/therealcoolnerd) ยท Gulf Coast, Mississippi
302
+
303
+ *"The developer who builds the standard wins the ecosystem."*
304
+
305
+ </div>