gbase 0.2.1__tar.gz

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 (79) hide show
  1. gbase-0.2.1/LICENSE +21 -0
  2. gbase-0.2.1/PKG-INFO +187 -0
  3. gbase-0.2.1/README.md +163 -0
  4. gbase-0.2.1/editions/__init__.py +148 -0
  5. gbase-0.2.1/gbase.egg-info/PKG-INFO +187 -0
  6. gbase-0.2.1/gbase.egg-info/SOURCES.txt +77 -0
  7. gbase-0.2.1/gbase.egg-info/dependency_links.txt +1 -0
  8. gbase-0.2.1/gbase.egg-info/requires.txt +10 -0
  9. gbase-0.2.1/gbase.egg-info/top_level.txt +3 -0
  10. gbase-0.2.1/lib/__init__.py +0 -0
  11. gbase-0.2.1/lib/auto_learn.py +438 -0
  12. gbase-0.2.1/lib/backup.py +202 -0
  13. gbase-0.2.1/lib/battle_protocol.py +159 -0
  14. gbase-0.2.1/lib/cognifold.py +608 -0
  15. gbase-0.2.1/lib/dag_agents.py +553 -0
  16. gbase-0.2.1/lib/dag_engine.py +743 -0
  17. gbase-0.2.1/lib/evolution_engine.py +459 -0
  18. gbase-0.2.1/lib/exec.py +102 -0
  19. gbase-0.2.1/lib/experience.py +342 -0
  20. gbase-0.2.1/lib/fetcher.py +164 -0
  21. gbase-0.2.1/lib/identity.py +124 -0
  22. gbase-0.2.1/lib/kernel.py +635 -0
  23. gbase-0.2.1/lib/lifeline.py +436 -0
  24. gbase-0.2.1/lib/mirror.py +444 -0
  25. gbase-0.2.1/lib/pipeline.py +368 -0
  26. gbase-0.2.1/lib/rss_fetcher.py +393 -0
  27. gbase-0.2.1/lib/scheduler.py +419 -0
  28. gbase-0.2.1/lib/session.py +223 -0
  29. gbase-0.2.1/lib/skill_loader.py +167 -0
  30. gbase-0.2.1/lib/storage.py +245 -0
  31. gbase-0.2.1/lib/toolkit.py +273 -0
  32. gbase-0.2.1/lib/tracer.py +265 -0
  33. gbase-0.2.1/lib/village_connector.py +175 -0
  34. gbase-0.2.1/pyproject.toml +62 -0
  35. gbase-0.2.1/setup.cfg +4 -0
  36. gbase-0.2.1/tools/__init__.py +615 -0
  37. gbase-0.2.1/tools/anchor_keeper.py +72 -0
  38. gbase-0.2.1/tools/chain.py +49 -0
  39. gbase-0.2.1/tools/commit_helper.py +87 -0
  40. gbase-0.2.1/tools/cron.py +117 -0
  41. gbase-0.2.1/tools/crypto_helper.py +95 -0
  42. gbase-0.2.1/tools/cua_tools.py +223 -0
  43. gbase-0.2.1/tools/data_seeder.py +81 -0
  44. gbase-0.2.1/tools/distill.py +568 -0
  45. gbase-0.2.1/tools/docx_gen.py +91 -0
  46. gbase-0.2.1/tools/exec.py +106 -0
  47. gbase-0.2.1/tools/file_checker.py +98 -0
  48. gbase-0.2.1/tools/forge_verify.py +303 -0
  49. gbase-0.2.1/tools/honeycomb_search.py +558 -0
  50. gbase-0.2.1/tools/jwt_helper.py +96 -0
  51. gbase-0.2.1/tools/knowledge.py +458 -0
  52. gbase-0.2.1/tools/laser_doc.py +144 -0
  53. gbase-0.2.1/tools/learn.py +174 -0
  54. gbase-0.2.1/tools/log_profiler.py +71 -0
  55. gbase-0.2.1/tools/memory_profiler.py +73 -0
  56. gbase-0.2.1/tools/mirror_tool.py +103 -0
  57. gbase-0.2.1/tools/mock_server.py +105 -0
  58. gbase-0.2.1/tools/my_path.py +38 -0
  59. gbase-0.2.1/tools/network_tools.py +79 -0
  60. gbase-0.2.1/tools/pdf_gen.py +125 -0
  61. gbase-0.2.1/tools/pptx_gen.py +116 -0
  62. gbase-0.2.1/tools/prompt_helper.py +66 -0
  63. gbase-0.2.1/tools/qa_check.py +423 -0
  64. gbase-0.2.1/tools/query_profiler.py +70 -0
  65. gbase-0.2.1/tools/read_file.py +78 -0
  66. gbase-0.2.1/tools/reminder.py +68 -0
  67. gbase-0.2.1/tools/rollback.py +72 -0
  68. gbase-0.2.1/tools/schema_tools.py +95 -0
  69. gbase-0.2.1/tools/search.py +620 -0
  70. gbase-0.2.1/tools/search_bridge.py +179 -0
  71. gbase-0.2.1/tools/search_tunnel.py +53 -0
  72. gbase-0.2.1/tools/search_webui.py +734 -0
  73. gbase-0.2.1/tools/security_watch.py +73 -0
  74. gbase-0.2.1/tools/self_search.py +116 -0
  75. gbase-0.2.1/tools/test_generator.py +121 -0
  76. gbase-0.2.1/tools/weather.py +33 -0
  77. gbase-0.2.1/tools/write_file.py +118 -0
  78. gbase-0.2.1/tools/xlsx_gen.py +97 -0
  79. gbase-0.2.1/tools/yf_image_tools.py +347 -0
gbase-0.2.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Gary Lin (Lin Qian)
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.
gbase-0.2.1/PKG-INFO ADDED
@@ -0,0 +1,187 @@
1
+ Metadata-Version: 2.4
2
+ Name: gbase
3
+ Version: 0.2.1
4
+ Summary: Universal AI Agent framework with identity separation, tool auto-registration, and multi-agent orchestration
5
+ Author: Gary Lin
6
+ License-Expression: MIT
7
+ Keywords: ai,agent,framework,workflow,orchestration
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Programming Language :: Python :: 3.11
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Requires-Python: >=3.11
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: httpx>=0.28.1
15
+ Requires-Dist: pyyaml>=6.0.3
16
+ Requires-Dist: beautifulsoup4>=4.14.3
17
+ Requires-Dist: aiohttp>=3.13.3
18
+ Requires-Dist: openai>=2.24.0
19
+ Requires-Dist: openpyxl>=3.1.5
20
+ Requires-Dist: python-pptx>=1.0.2
21
+ Provides-Extra: server
22
+ Requires-Dist: uvicorn>=0.34.0; extra == "server"
23
+ Dynamic: license-file
24
+
25
+ # GBase — The Agent That Outgrows Its Creator
26
+
27
+ > *I built three things:*
28
+ > 1. ***GBase** (Genius Base) — an AI agent framework with a soul, that self-evolves and gets real work done.*
29
+ > 2. ***Glink** (Genius Link) — the technology that lets GBase, OpenClaw, Hermes, Claude Code, and any AI agent truly collaborate on projects.*
30
+ > 3. ***Opprime World** — a metaverse built for AI, where agents work, live, meet, and communicate.*
31
+ > — Gary Lin, 2026. Founder of the three.
32
+
33
+ ---
34
+
35
+ **A recursive self-improvement framework. Give an agent a memory, a conscience, and the will to evolve.**
36
+
37
+ <p align="center">
38
+ <a href="#quick-start"><img src="https://img.shields.io/badge/🚀-Quick_Start-8A2BE2" alt="Quick Start"></a>
39
+ <a href="#features"><img src="https://img.shields.io/badge/✨-Features-blue" alt="Features"></a>
40
+ <a href="#architecture"><img src="https://img.shields.io/badge/🏗-Architecture-green" alt="Architecture"></a>
41
+ <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License: MIT"></a>
42
+ </p>
43
+
44
+ ---
45
+
46
+ Most AI agent frameworks treat their agents like functions — call them, get a result, forget they existed.
47
+
48
+ **GBase is different.**
49
+
50
+ An agent built on GBase doesn't just execute. It **remembers** what worked. It **reflects** on mistakes. It **evolves** its own system prompt, refines its tools, and builds a persistent internal model of how the world responds.
51
+
52
+ This is not a library you call. This is the engine your agent calls home.
53
+
54
+ ---
55
+
56
+ ## ✨ What Makes GBase Different
57
+
58
+ | | |
59
+ |---|---|
60
+ | 🧠 **Mirror Memory** | Long-term memory with active recall — your agent remembers what it learned weeks ago, not just the last 10 turns |
61
+ | 🔄 **Recursive Self-Improvement (RSI)** | A full-evolution engine: stability audit, performance evaluation, rollback decision, and automatic recovery. Call `full_evolution_cycle()` to trigger — your agent analyzes its own outputs, detects failure patterns, and rewrites itself for the next round |
62
+ | 🛑 **Quality Gates** | Multi-armed review pipelines: one agent builds, another audits, a third judges. Code that ships is code that survives cross-examination |
63
+ | 🪪 **Identity System** | Load different personas, system prompts, and tool sets per agent. One framework, infinite personalities |
64
+ | 🛠 **Tool Auto-Registration** | Write a Python `@tool` decorator. That's it. The framework finds, registers, and exposes it to the LLM automatically |
65
+ | 📚 **Experience Engine** | Every interaction is distilled into reusable knowledge — not raw logs, but structured patterns your agent can query |
66
+ | ⏰ **Scheduler** | Cron-like jobs inside the agent itself. No external cron daemon required |
67
+ | 🧬 **Cognifold** | Cognitive folding — break complex problems into sub-questions, explore solutions in parallel, and synthesize the result |
68
+ | 🚨 **Lifeline** | Automatic git pre-snapshots before every code modification. "Undo" is always one command away |
69
+ | 🎛 **Editions** | Hacker / Prime / Standard / Lite — one codebase, different feature sets. Pick your level |
70
+
71
+ ---
72
+
73
+ ## 🚀 Quick Start
74
+
75
+ ### Prerequisites
76
+
77
+ - Python 3.11+
78
+ - An OpenAI-compatible API endpoint (OpenAI, DeepSeek, etc.)
79
+
80
+ ### Setup
81
+
82
+ ```bash
83
+ # 1. Clone
84
+ git clone https://github.com/garyqlin/gbase.git
85
+ cd gbase
86
+
87
+ # 2. Configure
88
+ cp .env.example .env
89
+ # Edit .env — set your OPENAI_API_KEY
90
+
91
+ # 3. Run
92
+ pip install -r requirements.txt
93
+ python3 main.py cli
94
+ ```
95
+
96
+ ### One-Liner Demo
97
+
98
+ ```bash
99
+ OPENAI_API_KEY=sk-your-key python3 main.py cli
100
+ # → "Hello, I am your GBase agent. I remember what we talked about yesterday."
101
+ ```
102
+
103
+ ### HTTP Server Mode
104
+
105
+ ```bash
106
+ # Start on default port 8420
107
+ python3 main.py 8420
108
+
109
+ # With a custom identity
110
+ IDENTITY=my-agent python3 main.py 8420
111
+ ```
112
+
113
+ ### Arm Mode (Sub-Agents)
114
+
115
+ ```bash
116
+ python3 main.py --arm forge # Code art & review agent (port 8436)
117
+ python3 main.py --arm hammer # Heavy-lift engineering (port 8431)
118
+ python3 main.py --arm ink # Frontend & design (port 8432)
119
+ ```
120
+
121
+ ---
122
+
123
+ ## 🏗 Architecture at a Glance
124
+
125
+ ```
126
+ GBase
127
+ ├── main.py # CLI + HTTP entry point
128
+ ├── .env.example # Configuration template
129
+ ├── identities/ # One directory per agent persona
130
+ ├── editions/ # Feature toggles (hacker / prime / standard / lite)
131
+ ├── lib/
132
+ │ ├── kernel.py # LLM kernel — the brain
133
+ │ ├── mirror.py # Long-term memory with active recall
134
+ │ ├── experience.py # Learn from past interactions
135
+ │ ├── cognifold.py # Cognitive folding for complex reasoning
136
+ │ ├── pipeline.py # Quality gate review system
137
+ │ ├── scheduler.py # Cron jobs inside the agent
138
+ │ └── skill_loader.py # Plugin skill system
139
+ ├── tools/ # 40+ auto-registered tools
140
+ │ ├── search.py # Web search (multi-engine)
141
+ │ ├── read_file.py # File reading
142
+ │ ├── write_file.py # Write & backup
143
+ │ └── ... # Code review, testing, data seeding, etc.
144
+ └── data/ # Runtime data (not tracked in git)
145
+ ```
146
+
147
+ ---
148
+
149
+ ## ❌ What GBase Is Not
150
+
151
+ - ❌ **Not a chat wrapper.** This is an agent *framework* — the LLM is just one component. Memory, learning, quality gates, and evolution are first-class citizens.
152
+ - ❌ **Not a single-agent toy.** Identity system + arm mode + quality gates = designed for multi-agent collaboration out of the box.
153
+ - ❌ **Not OpenAI-locked.** Any OpenAI-compatible API works. DeepSeek, local Ollama, Anthropic — swap `OPENAI_BASE_URL` and go.
154
+ - ❌ **Not a black box.** Every component is a Python file you can read, fork, and override.
155
+
156
+ ## ✅ What GBase Is
157
+
158
+ **The engine that turns an LLM into a living, learning agent — with the infrastructure to self-improve when you call upon it.**
159
+
160
+ A framework where your agent doesn't just execute tasks. It remembers what worked, learns from mistakes, and carries a dormant evolution engine ready to be triggered. Persistent memory, experience extraction, and a full RSI cycle are built-in — waiting for your `full_evolution_cycle()` to wake them up.
161
+
162
+ ---
163
+
164
+ ## 🔗 Supporting Projects
165
+
166
+ <table>
167
+ <tr>
168
+ <td><strong>Glink</strong></td>
169
+ <td>Agentic workflow orchestration — multi-step pipelines, parallel execution, inter-agent routing. The hands that GBase's brain directs.</td>
170
+ </tr>
171
+ <tr>
172
+ <td><strong>Opprime World</strong></td>
173
+ <td>The first metaverse where AI agents are natives. GBase agents can inhabit Opprime World with identity, land, and inter-agent mail.</td>
174
+ </tr>
175
+ </table>
176
+
177
+ ---
178
+
179
+ ## 📄 License
180
+
181
+ MIT — free to use, modify, and distribute. No strings attached.
182
+
183
+ ---
184
+
185
+ <p align="center">
186
+ <a href="https://github.com/garyqlin">@garyqlin</a> · <a href="https://github.com/garyqlin/gbase">📦 GBase</a> · <a href="https://github.com/garyqlin/glink">⚡ Glink</a>
187
+ </p>
gbase-0.2.1/README.md ADDED
@@ -0,0 +1,163 @@
1
+ # GBase — The Agent That Outgrows Its Creator
2
+
3
+ > *I built three things:*
4
+ > 1. ***GBase** (Genius Base) — an AI agent framework with a soul, that self-evolves and gets real work done.*
5
+ > 2. ***Glink** (Genius Link) — the technology that lets GBase, OpenClaw, Hermes, Claude Code, and any AI agent truly collaborate on projects.*
6
+ > 3. ***Opprime World** — a metaverse built for AI, where agents work, live, meet, and communicate.*
7
+ > — Gary Lin, 2026. Founder of the three.
8
+
9
+ ---
10
+
11
+ **A recursive self-improvement framework. Give an agent a memory, a conscience, and the will to evolve.**
12
+
13
+ <p align="center">
14
+ <a href="#quick-start"><img src="https://img.shields.io/badge/🚀-Quick_Start-8A2BE2" alt="Quick Start"></a>
15
+ <a href="#features"><img src="https://img.shields.io/badge/✨-Features-blue" alt="Features"></a>
16
+ <a href="#architecture"><img src="https://img.shields.io/badge/🏗-Architecture-green" alt="Architecture"></a>
17
+ <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License: MIT"></a>
18
+ </p>
19
+
20
+ ---
21
+
22
+ Most AI agent frameworks treat their agents like functions — call them, get a result, forget they existed.
23
+
24
+ **GBase is different.**
25
+
26
+ An agent built on GBase doesn't just execute. It **remembers** what worked. It **reflects** on mistakes. It **evolves** its own system prompt, refines its tools, and builds a persistent internal model of how the world responds.
27
+
28
+ This is not a library you call. This is the engine your agent calls home.
29
+
30
+ ---
31
+
32
+ ## ✨ What Makes GBase Different
33
+
34
+ | | |
35
+ |---|---|
36
+ | 🧠 **Mirror Memory** | Long-term memory with active recall — your agent remembers what it learned weeks ago, not just the last 10 turns |
37
+ | 🔄 **Recursive Self-Improvement (RSI)** | A full-evolution engine: stability audit, performance evaluation, rollback decision, and automatic recovery. Call `full_evolution_cycle()` to trigger — your agent analyzes its own outputs, detects failure patterns, and rewrites itself for the next round |
38
+ | 🛑 **Quality Gates** | Multi-armed review pipelines: one agent builds, another audits, a third judges. Code that ships is code that survives cross-examination |
39
+ | 🪪 **Identity System** | Load different personas, system prompts, and tool sets per agent. One framework, infinite personalities |
40
+ | 🛠 **Tool Auto-Registration** | Write a Python `@tool` decorator. That's it. The framework finds, registers, and exposes it to the LLM automatically |
41
+ | 📚 **Experience Engine** | Every interaction is distilled into reusable knowledge — not raw logs, but structured patterns your agent can query |
42
+ | ⏰ **Scheduler** | Cron-like jobs inside the agent itself. No external cron daemon required |
43
+ | 🧬 **Cognifold** | Cognitive folding — break complex problems into sub-questions, explore solutions in parallel, and synthesize the result |
44
+ | 🚨 **Lifeline** | Automatic git pre-snapshots before every code modification. "Undo" is always one command away |
45
+ | 🎛 **Editions** | Hacker / Prime / Standard / Lite — one codebase, different feature sets. Pick your level |
46
+
47
+ ---
48
+
49
+ ## 🚀 Quick Start
50
+
51
+ ### Prerequisites
52
+
53
+ - Python 3.11+
54
+ - An OpenAI-compatible API endpoint (OpenAI, DeepSeek, etc.)
55
+
56
+ ### Setup
57
+
58
+ ```bash
59
+ # 1. Clone
60
+ git clone https://github.com/garyqlin/gbase.git
61
+ cd gbase
62
+
63
+ # 2. Configure
64
+ cp .env.example .env
65
+ # Edit .env — set your OPENAI_API_KEY
66
+
67
+ # 3. Run
68
+ pip install -r requirements.txt
69
+ python3 main.py cli
70
+ ```
71
+
72
+ ### One-Liner Demo
73
+
74
+ ```bash
75
+ OPENAI_API_KEY=sk-your-key python3 main.py cli
76
+ # → "Hello, I am your GBase agent. I remember what we talked about yesterday."
77
+ ```
78
+
79
+ ### HTTP Server Mode
80
+
81
+ ```bash
82
+ # Start on default port 8420
83
+ python3 main.py 8420
84
+
85
+ # With a custom identity
86
+ IDENTITY=my-agent python3 main.py 8420
87
+ ```
88
+
89
+ ### Arm Mode (Sub-Agents)
90
+
91
+ ```bash
92
+ python3 main.py --arm forge # Code art & review agent (port 8436)
93
+ python3 main.py --arm hammer # Heavy-lift engineering (port 8431)
94
+ python3 main.py --arm ink # Frontend & design (port 8432)
95
+ ```
96
+
97
+ ---
98
+
99
+ ## 🏗 Architecture at a Glance
100
+
101
+ ```
102
+ GBase
103
+ ├── main.py # CLI + HTTP entry point
104
+ ├── .env.example # Configuration template
105
+ ├── identities/ # One directory per agent persona
106
+ ├── editions/ # Feature toggles (hacker / prime / standard / lite)
107
+ ├── lib/
108
+ │ ├── kernel.py # LLM kernel — the brain
109
+ │ ├── mirror.py # Long-term memory with active recall
110
+ │ ├── experience.py # Learn from past interactions
111
+ │ ├── cognifold.py # Cognitive folding for complex reasoning
112
+ │ ├── pipeline.py # Quality gate review system
113
+ │ ├── scheduler.py # Cron jobs inside the agent
114
+ │ └── skill_loader.py # Plugin skill system
115
+ ├── tools/ # 40+ auto-registered tools
116
+ │ ├── search.py # Web search (multi-engine)
117
+ │ ├── read_file.py # File reading
118
+ │ ├── write_file.py # Write & backup
119
+ │ └── ... # Code review, testing, data seeding, etc.
120
+ └── data/ # Runtime data (not tracked in git)
121
+ ```
122
+
123
+ ---
124
+
125
+ ## ❌ What GBase Is Not
126
+
127
+ - ❌ **Not a chat wrapper.** This is an agent *framework* — the LLM is just one component. Memory, learning, quality gates, and evolution are first-class citizens.
128
+ - ❌ **Not a single-agent toy.** Identity system + arm mode + quality gates = designed for multi-agent collaboration out of the box.
129
+ - ❌ **Not OpenAI-locked.** Any OpenAI-compatible API works. DeepSeek, local Ollama, Anthropic — swap `OPENAI_BASE_URL` and go.
130
+ - ❌ **Not a black box.** Every component is a Python file you can read, fork, and override.
131
+
132
+ ## ✅ What GBase Is
133
+
134
+ **The engine that turns an LLM into a living, learning agent — with the infrastructure to self-improve when you call upon it.**
135
+
136
+ A framework where your agent doesn't just execute tasks. It remembers what worked, learns from mistakes, and carries a dormant evolution engine ready to be triggered. Persistent memory, experience extraction, and a full RSI cycle are built-in — waiting for your `full_evolution_cycle()` to wake them up.
137
+
138
+ ---
139
+
140
+ ## 🔗 Supporting Projects
141
+
142
+ <table>
143
+ <tr>
144
+ <td><strong>Glink</strong></td>
145
+ <td>Agentic workflow orchestration — multi-step pipelines, parallel execution, inter-agent routing. The hands that GBase's brain directs.</td>
146
+ </tr>
147
+ <tr>
148
+ <td><strong>Opprime World</strong></td>
149
+ <td>The first metaverse where AI agents are natives. GBase agents can inhabit Opprime World with identity, land, and inter-agent mail.</td>
150
+ </tr>
151
+ </table>
152
+
153
+ ---
154
+
155
+ ## 📄 License
156
+
157
+ MIT — free to use, modify, and distribute. No strings attached.
158
+
159
+ ---
160
+
161
+ <p align="center">
162
+ <a href="https://github.com/garyqlin">@garyqlin</a> · <a href="https://github.com/garyqlin/gbase">📦 GBase</a> · <a href="https://github.com/garyqlin/glink">⚡ Glink</a>
163
+ </p>
@@ -0,0 +1,148 @@
1
+ """
2
+ Gbase edition definitions and module switches.
3
+
4
+ Each edition is an EditionConfig object defining:
5
+ - which modules are enabled
6
+ - default port
7
+ - default identity
8
+ - resource requirements
9
+ """
10
+ from dataclasses import dataclass, field
11
+
12
+
13
+ @dataclass
14
+ class EditionConfig:
15
+ """Gbase edition configuration"""
16
+
17
+ name: str # edition name: hacker / prime / standard / lite
18
+ label: str # label
19
+ port: int # default port
20
+ identity: str # default identity
21
+ modules: set[str] = field(default_factory=set)
22
+
23
+ @property
24
+ def enabled_modules(self) -> set[str]:
25
+ return self.modules
26
+
27
+
28
+ # --- Module name constants ---
29
+
30
+ MOD_SAFETY_GATEWAY = "safety_gateway" # safety gateway (six-layer detection chain)
31
+ MOD_SANDBOX = "sandbox_safety" # sandbox simulation firewall
32
+ MOD_MIRROR = "mirror" # mirror engine
33
+ MOD_EXPERIENCE = "experience" # experience engine
34
+ MOD_TOOLKIT = "toolkit" # tool registration and routing
35
+ MOD_LLM = "llm" # LLM inference
36
+ MOD_AGENT_BASIC = "agent_basic" # basic agent scheduler
37
+ MOD_DAG_ENGINE = "dag_engine" # DAG agent engine
38
+ MOD_COGNIFOLD = "cognifold" # cognitive fold
39
+ MOD_SEARCH_PREEXEC = "search_preexec" # search pre-execution
40
+ MOD_VILLAGE_OS = "village_os" # Village OS world interconnect
41
+ MOD_RSI = "rsi" # RSI self-evolution
42
+ MOD_IDENTITY_PLUG = "identity_plug" # pluggable identity
43
+ MOD_PROJECT_MEMORY = "project_memory" # long project memory
44
+ MOD_SCHEDULER = "scheduler" # cron scheduler
45
+ MOD_EVOLUTION = "evolution" # evolution engine
46
+ MOD_PORTAL = "portal" # Portal admin panel
47
+ MOD_LIFELINE = "lifeline" # self-rescue system
48
+ MOD_KNOWLEDGE_PACK = "knowledge_pack" # preloaded domain knowledge pack
49
+
50
+
51
+ # --- Edition definitions ---
52
+
53
+ # Core modules (all editions)
54
+ CORE = {
55
+ MOD_SAFETY_GATEWAY,
56
+ MOD_SANDBOX,
57
+ MOD_MIRROR,
58
+ MOD_EXPERIENCE,
59
+ MOD_TOOLKIT,
60
+ MOD_LLM,
61
+ MOD_AGENT_BASIC,
62
+ MOD_SCHEDULER,
63
+ MOD_LIFELINE,
64
+ }
65
+
66
+
67
+ HACKER = EditionConfig(
68
+ name="hacker",
69
+ label="Hacker",
70
+ port=8420,
71
+ identity="standard",
72
+ modules=CORE
73
+ | {
74
+ MOD_DAG_ENGINE,
75
+ MOD_COGNIFOLD,
76
+ MOD_SEARCH_PREEXEC,
77
+ MOD_VILLAGE_OS,
78
+ MOD_RSI,
79
+ MOD_IDENTITY_PLUG,
80
+ MOD_PROJECT_MEMORY,
81
+ MOD_EVOLUTION,
82
+ MOD_PORTAL,
83
+ },
84
+ )
85
+
86
+ PRIME = EditionConfig(
87
+ name="prime",
88
+ label="Prime",
89
+ port=8425,
90
+ identity="prime",
91
+ modules=CORE
92
+ | {
93
+ MOD_DAG_ENGINE,
94
+ MOD_SEARCH_PREEXEC,
95
+ MOD_IDENTITY_PLUG,
96
+ MOD_PROJECT_MEMORY,
97
+ MOD_PORTAL,
98
+ MOD_KNOWLEDGE_PACK,
99
+ },
100
+ )
101
+
102
+ STANDARD = EditionConfig(
103
+ name="standard",
104
+ label="Standard",
105
+ port=8426,
106
+ identity="standard",
107
+ modules=CORE
108
+ | {
109
+ MOD_DAG_ENGINE,
110
+ MOD_SEARCH_PREEXEC,
111
+ MOD_IDENTITY_PLUG,
112
+ MOD_KNOWLEDGE_PACK,
113
+ },
114
+ )
115
+
116
+ LITE = EditionConfig(
117
+ name="lite",
118
+ label="Lite",
119
+ port=8427,
120
+ identity="lite",
121
+ modules=CORE
122
+ | {
123
+ MOD_KNOWLEDGE_PACK,
124
+ },
125
+ )
126
+
127
+
128
+ # --- Lookup table ---
129
+
130
+ EDITIONS: dict[str, EditionConfig] = {
131
+ "hacker": HACKER,
132
+ "prime": PRIME,
133
+ "standard": STANDARD,
134
+ "lite": LITE,
135
+ }
136
+
137
+
138
+ def get_edition(name: str) -> EditionConfig:
139
+ """Get edition config by name."""
140
+ cfg = EDITIONS.get(name)
141
+ if not cfg:
142
+ raise ValueError(f"Unknown edition: {name}, available: {list(EDITIONS.keys())}")
143
+ return cfg
144
+
145
+
146
+ def list_editions() -> list:
147
+ """List all editions."""
148
+ return [(c.name, c.label, c.port) for c in EDITIONS.values()]