backbone-agents 4.0.0a1__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.
@@ -0,0 +1,46 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ dist/
9
+ *.egg-info/
10
+ .eggs/
11
+
12
+ # Virtual environments
13
+ .venv/
14
+ venv/
15
+ env/
16
+
17
+ # Secrets (CRITICAL — never commit)
18
+ .env
19
+ .env.*
20
+ !.env.example
21
+
22
+ # Testing
23
+ .pytest_cache/
24
+ .coverage
25
+ htmlcov/
26
+
27
+ # Linting
28
+ .ruff_cache/
29
+ .mypy_cache/
30
+
31
+ # Logs
32
+ *.log
33
+
34
+ # Backups (exp2/ legacy — never ship)
35
+ *.bak
36
+ *.bak2
37
+ *.bak3
38
+ *.bak4
39
+ *.pym
40
+
41
+ # IDE
42
+ .vscode/
43
+ .idea/
44
+ *.swp
45
+ # v4.0a archived baselines (kept for reference, not shipped)
46
+ _archive/
@@ -0,0 +1,35 @@
1
+ # Changelog
2
+
3
+ All notable changes to Backbone Agents are documented here.
4
+
5
+ ## [4.0.0a1] - 2026-11-01
6
+
7
+ ### Added — البنية المعمارية v4.0
8
+ - `compilers/base.py`: `CompilerPlugin` Protocol + `REGISTRY` + `write_generated`.
9
+ - `compilers/langgraph.py`: `LangGraphCompiler` class.
10
+ - `compilers/pydantic_ai.py`: `PydanticAICompiler` class.
11
+ - `compilers/__init__.py`: Auto-registration على الاستيراد.
12
+ - `cli_v4.py`: CLI جديد يستخدم `REGISTRY` (بدلاً من `importlib`).
13
+ - `pyproject.toml`: هيكل حزمة قابل للنشر على PyPI (hatchling).
14
+ - `.gitignore`: حماية `.env` و`*.bak` و`__pycache__`.
15
+
16
+ ### Changed — إعادة هيكلة من `exp2/` إلى حزمة
17
+ - `backbone.py` → `backbone_agents/cli.py` (يبقى كمرجع v3.1).
18
+ - `linter.py` → `backbone_agents/linter.py`.
19
+ - `export_langgraph.py` → `backbone_agents/compilers/langgraph.py`.
20
+ - `export_pydantic_ai.py` → `backbone_agents/compilers/pydantic_ai.py`.
21
+
22
+ ### Fixed
23
+ - `langgraph.py`: `from linter import` → `from ..linter import`.
24
+ - `langgraph.py`: حذف `sys.path.insert` (لم يعد لازماً).
25
+ - المسارات الثابتة (`BASE_DIR`, `PROJECT_PATH`, `OUTPUT_PATH`) — أصبحت معاملات في `compile(contract, output_dir)`.
26
+
27
+ ### Preserved — ما لم نلمسه
28
+ - كل دوال `emit_*` في `langgraph.py` و`pydantic_ai.py`.
29
+ - منطق `linter.py`.
30
+ - `cli.py` (v3.1 CLI) — يبقى كمرجع تاريخي.
31
+
32
+ ### Known Limitations (v4.0.0a1)
33
+ - `cli.py` القديم لا يعمل بعد التثبيت العالمي (يفترض بنية مسطحة).
34
+ - `cli_v4.py` هو البديل الوظيفي.
35
+ - لا Web UI، لا OpenTelemetry، لا Benchmark — هذه v4.4+.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Backbone System Authors
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,0 +1,190 @@
1
+ Metadata-Version: 2.5
2
+ Name: backbone-agents
3
+ Version: 4.0.0a1
4
+ Summary: Agent Compiler — Contract is the single source of truth. Arabic-first, framework-agnostic.
5
+ Project-URL: Homepage, https://github.com/backbone-system/backbone-agents
6
+ Project-URL: Repository, https://github.com/backbone-system/backbone-agents
7
+ Author: Backbone System Authors
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Keywords: agents,arabic,compiler,langgraph,llm,pydantic-ai
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Natural Language :: Arabic
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Requires-Python: >=3.10
19
+ Requires-Dist: langchain-google-genai>=2.0
20
+ Requires-Dist: langgraph>=0.2
21
+ Requires-Dist: pydantic-ai-slim[google]>=0.1
22
+ Requires-Dist: pydantic>=2.6
23
+ Requires-Dist: python-dotenv>=1.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: mypy>=1.10; extra == 'dev'
26
+ Requires-Dist: pytest-cov>=5.0; extra == 'dev'
27
+ Requires-Dist: pytest>=8.0; extra == 'dev'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # Backbone Agents
31
+
32
+ > **مترجم وكلاء (Agent Compiler).** العقد هو المصدر الوحيد للحقيقة. الكود إسقاط منه.
33
+ > **Agent Compiler.** The contract is the single source of truth. Code is a projection.
34
+
35
+ ---
36
+
37
+ ## ما هو Backbone Agents؟
38
+
39
+ **Backbone Agents** هو أول مترجم وكلاء (Agent Compiler) مفتوح المصدر بالعربية.
40
+ يقرأ **عقداً** (contract) بصيغة JSON، ويُنتج كوداً جاهزاً للتشغيل لإطار عمل الوكلاء الذي تختاره — دون تغيير سطر واحد في العقد.
41
+
42
+ ### الفكرة المحورية
43
+
44
+ ```
45
+ ┌─────────────┐
46
+ │ Contract │ ← المصدر الوحيد للحقيقة
47
+ │ (JSON) │
48
+ └──────┬──────┘
49
+ │
50
+ ┌────────┼────────┐
51
+ ▼ ▼ ▼
52
+ LangGraph Pydantic Future
53
+ AI Framework
54
+ ```
55
+
56
+ **نفس العقد** → **كود LangGraph** أو **كود Pydantic AI** أو **أي إطار مستقبلي**.
57
+ **صفر تغييرات في العقد.** **صفر تغييرات في CLI.**
58
+
59
+ ### لماذا هذا مهم؟
60
+
61
+ معظم أطر الوكلاء (LangGraph, CrewAI, AutoGen, Pydantic AI) تُجبرك على كتابة كود خاص بها.
62
+ إذا قررت تغيير الإطار، تُعيد كتابة كل شيء. **Backbone يكسر هذه الحلقة:**
63
+
64
+ - **العقد** يبقى ثابتاً.
65
+ - **الإطار** يصبح تفصيلاً تنفيذياً.
66
+ - **الاختبار** يبقى على مستوى العقد، لا الكود.
67
+
68
+ ---
69
+
70
+ ## التركيب (Installation)
71
+
72
+ ```bash
73
+ pip install backbone-agents
74
+ ```
75
+
76
+ التركيب من المصدر (للمطورين):
77
+
78
+ ```bash
79
+ git clone https://github.com/backbone-system/backbone-agents.git
80
+ cd backbone-agents
81
+ pip install -e ".[dev]"
82
+ ```
83
+
84
+ ---
85
+
86
+ ## الاستخدام السريع
87
+
88
+ ### 1. أنشئ عقداً
89
+
90
+ ```json
91
+ {
92
+ "project_metadata": {
93
+ "name": "hello_router",
94
+ "selected_pattern": "router"
95
+ },
96
+ "agents": [
97
+ {
98
+ "role_id": "message_router",
99
+ "in_scope": ["greeting", "farewell"],
100
+ "out_of_scope": ["coding", "math"]
101
+ },
102
+ {
103
+ "role_id": "greeter",
104
+ "in_scope": ["greeting"]
105
+ },
106
+ {
107
+ "role_id": "fareweller",
108
+ "in_scope": ["farewell"]
109
+ }
110
+ ],
111
+ "artifact_flow": []
112
+ }
113
+ ```
114
+
115
+ ### 2. افحص العقد
116
+
117
+ ```bash
118
+ backbone lint hello_router
119
+ ```
120
+
121
+ ### 3. صدّر الكود
122
+
123
+ ```bash
124
+ # إلى LangGraph
125
+ backbone export hello_router --target langgraph
126
+
127
+ # أو إلى Pydantic AI
128
+ backbone export hello_router --target pydantic_ai
129
+ ```
130
+
131
+ **نفس العقد، إطاران مختلفان، صفر تغييرات.**
132
+
133
+ ---
134
+
135
+ ## الأنماط المدعومة (Patterns)
136
+
137
+ | النمط | الوصف |
138
+ |---|---|
139
+ | `router` | وكيل تصنيف يوجّه إلى وكلاء متخصصين |
140
+ | `debate` | مناظرة 3 أدوار + حكم |
141
+ | `sequential` | تدفق خطي A → B → C |
142
+
143
+ **3 أنماط × إطاران مدعومان = 6 توليفات تعمل.**
144
+
145
+ ---
146
+
147
+ ## البنية المعمارية
148
+
149
+ ```
150
+ src/backbone_agents/
151
+ ├── cli.py ← v3.1 CLI (مرجع تاريخي)
152
+ ├── cli_v4.py ← v4.0 CLI (يستخدم REGISTRY)
153
+ ├── linter.py ← 5 فحوصات للعقد
154
+ ├── compilers/
155
+ │ ├── base.py ← Protocol + REGISTRY
156
+ │ ├── langgraph.py ← LangGraphCompiler
157
+ │ └── pydantic_ai.py ← PydanticAICompiler
158
+ └── templates/ ← عقود جاهزة
159
+ ```
160
+
161
+ ---
162
+
163
+ ## إضافة إطار جديد (Extending)
164
+
165
+ أضف ملفاً واحداً في `src/backbone_agents/compilers/`:
166
+
167
+ ```python
168
+ # compilers/crewai.py
169
+ from .base import write_generated
170
+
171
+ class CrewAICompiler:
172
+ name = "crewai"
173
+ supported_patterns = ("sequential", "router")
174
+
175
+ def compile(self, contract, output_dir):
176
+ # ... توليد الكود ...
177
+ return [write_generated(output_dir, "crew.py", code)]
178
+ ```
179
+
180
+ ثم سطر واحد في `compilers/__init__.py`. **انتهى.**
181
+
182
+ ---
183
+
184
+ ## الترخيص
185
+
186
+ MIT — راجع [LICENSE](LICENSE).
187
+
188
+ ---
189
+
190
+ **Backbone Agents** — لأن العقد يجب أن يكون هو المصدر الوحيد للحقيقة.
@@ -0,0 +1,161 @@
1
+ # Backbone Agents
2
+
3
+ > **مترجم وكلاء (Agent Compiler).** العقد هو المصدر الوحيد للحقيقة. الكود إسقاط منه.
4
+ > **Agent Compiler.** The contract is the single source of truth. Code is a projection.
5
+
6
+ ---
7
+
8
+ ## ما هو Backbone Agents؟
9
+
10
+ **Backbone Agents** هو أول مترجم وكلاء (Agent Compiler) مفتوح المصدر بالعربية.
11
+ يقرأ **عقداً** (contract) بصيغة JSON، ويُنتج كوداً جاهزاً للتشغيل لإطار عمل الوكلاء الذي تختاره — دون تغيير سطر واحد في العقد.
12
+
13
+ ### الفكرة المحورية
14
+
15
+ ```
16
+ ┌─────────────┐
17
+ │ Contract │ ← المصدر الوحيد للحقيقة
18
+ │ (JSON) │
19
+ └──────┬──────┘
20
+ │
21
+ ┌────────┼────────┐
22
+ ▼ ▼ ▼
23
+ LangGraph Pydantic Future
24
+ AI Framework
25
+ ```
26
+
27
+ **نفس العقد** → **كود LangGraph** أو **كود Pydantic AI** أو **أي إطار مستقبلي**.
28
+ **صفر تغييرات في العقد.** **صفر تغييرات في CLI.**
29
+
30
+ ### لماذا هذا مهم؟
31
+
32
+ معظم أطر الوكلاء (LangGraph, CrewAI, AutoGen, Pydantic AI) تُجبرك على كتابة كود خاص بها.
33
+ إذا قررت تغيير الإطار، تُعيد كتابة كل شيء. **Backbone يكسر هذه الحلقة:**
34
+
35
+ - **العقد** يبقى ثابتاً.
36
+ - **الإطار** يصبح تفصيلاً تنفيذياً.
37
+ - **الاختبار** يبقى على مستوى العقد، لا الكود.
38
+
39
+ ---
40
+
41
+ ## التركيب (Installation)
42
+
43
+ ```bash
44
+ pip install backbone-agents
45
+ ```
46
+
47
+ التركيب من المصدر (للمطورين):
48
+
49
+ ```bash
50
+ git clone https://github.com/backbone-system/backbone-agents.git
51
+ cd backbone-agents
52
+ pip install -e ".[dev]"
53
+ ```
54
+
55
+ ---
56
+
57
+ ## الاستخدام السريع
58
+
59
+ ### 1. أنشئ عقداً
60
+
61
+ ```json
62
+ {
63
+ "project_metadata": {
64
+ "name": "hello_router",
65
+ "selected_pattern": "router"
66
+ },
67
+ "agents": [
68
+ {
69
+ "role_id": "message_router",
70
+ "in_scope": ["greeting", "farewell"],
71
+ "out_of_scope": ["coding", "math"]
72
+ },
73
+ {
74
+ "role_id": "greeter",
75
+ "in_scope": ["greeting"]
76
+ },
77
+ {
78
+ "role_id": "fareweller",
79
+ "in_scope": ["farewell"]
80
+ }
81
+ ],
82
+ "artifact_flow": []
83
+ }
84
+ ```
85
+
86
+ ### 2. افحص العقد
87
+
88
+ ```bash
89
+ backbone lint hello_router
90
+ ```
91
+
92
+ ### 3. صدّر الكود
93
+
94
+ ```bash
95
+ # إلى LangGraph
96
+ backbone export hello_router --target langgraph
97
+
98
+ # أو إلى Pydantic AI
99
+ backbone export hello_router --target pydantic_ai
100
+ ```
101
+
102
+ **نفس العقد، إطاران مختلفان، صفر تغييرات.**
103
+
104
+ ---
105
+
106
+ ## الأنماط المدعومة (Patterns)
107
+
108
+ | النمط | الوصف |
109
+ |---|---|
110
+ | `router` | وكيل تصنيف يوجّه إلى وكلاء متخصصين |
111
+ | `debate` | مناظرة 3 أدوار + حكم |
112
+ | `sequential` | تدفق خطي A → B → C |
113
+
114
+ **3 أنماط × إطاران مدعومان = 6 توليفات تعمل.**
115
+
116
+ ---
117
+
118
+ ## البنية المعمارية
119
+
120
+ ```
121
+ src/backbone_agents/
122
+ ├── cli.py ← v3.1 CLI (مرجع تاريخي)
123
+ ├── cli_v4.py ← v4.0 CLI (يستخدم REGISTRY)
124
+ ├── linter.py ← 5 فحوصات للعقد
125
+ ├── compilers/
126
+ │ ├── base.py ← Protocol + REGISTRY
127
+ │ ├── langgraph.py ← LangGraphCompiler
128
+ │ └── pydantic_ai.py ← PydanticAICompiler
129
+ └── templates/ ← عقود جاهزة
130
+ ```
131
+
132
+ ---
133
+
134
+ ## إضافة إطار جديد (Extending)
135
+
136
+ أضف ملفاً واحداً في `src/backbone_agents/compilers/`:
137
+
138
+ ```python
139
+ # compilers/crewai.py
140
+ from .base import write_generated
141
+
142
+ class CrewAICompiler:
143
+ name = "crewai"
144
+ supported_patterns = ("sequential", "router")
145
+
146
+ def compile(self, contract, output_dir):
147
+ # ... توليد الكود ...
148
+ return [write_generated(output_dir, "crew.py", code)]
149
+ ```
150
+
151
+ ثم سطر واحد في `compilers/__init__.py`. **انتهى.**
152
+
153
+ ---
154
+
155
+ ## الترخيص
156
+
157
+ MIT — راجع [LICENSE](LICENSE).
158
+
159
+ ---
160
+
161
+ **Backbone Agents** — لأن العقد يجب أن يكون هو المصدر الوحيد للحقيقة.
@@ -0,0 +1,72 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "backbone-agents"
7
+ version = "4.0.0a1"
8
+ description = "Agent Compiler — Contract is the single source of truth. Arabic-first, framework-agnostic."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "MIT" }
12
+ authors = [{ name = "Backbone System Authors" }]
13
+ keywords = ["agents", "llm", "compiler", "langgraph", "pydantic-ai", "arabic"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3.10",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Natural Language :: Arabic",
22
+ ]
23
+ dependencies = [
24
+ "langgraph>=0.2",
25
+ "langchain-google-genai>=2.0",
26
+ "pydantic>=2.6",
27
+ "pydantic-ai-slim[google]>=0.1",
28
+ "python-dotenv>=1.0",
29
+ ]
30
+
31
+ [project.optional-dependencies]
32
+ dev = [
33
+ "pytest>=8.0",
34
+ "pytest-cov>=5.0",
35
+ "mypy>=1.10",
36
+ ]
37
+
38
+ [project.scripts]
39
+ backbone = "backbone_agents.cli_v4:main"
40
+
41
+ [project.urls]
42
+ Homepage = "https://github.com/backbone-system/backbone-agents"
43
+ Repository = "https://github.com/backbone-system/backbone-agents"
44
+
45
+ [tool.hatch.build.targets.wheel]
46
+ packages = ["src/backbone_agents"]
47
+
48
+ [tool.ruff]
49
+ line-length = 100
50
+ target-version = "py310"
51
+
52
+ [tool.mypy]
53
+ python_version = "3.10"
54
+ strict = false
55
+ ignore_missing_imports = true
56
+
57
+ [tool.pytest.ini_options]
58
+ testpaths = ["tests"]
59
+ addopts = "-v --tb=short"
60
+ [tool.hatch.build.targets.sdist]
61
+ include = [
62
+ "src/backbone_agents",
63
+ "README.md",
64
+ "LICENSE",
65
+ "CHANGELOG.md",
66
+ ]
67
+ exclude = [
68
+ "_archive",
69
+ "examples",
70
+ "tests",
71
+ ".venv",
72
+ ]
@@ -0,0 +1,6 @@
1
+ """Backbone Agents — Agent Compiler.
2
+
3
+ Contract is the single source of truth. Code is a projection.
4
+ """
5
+ __version__ = "4.0.0a1"
6
+ __all__ = ["__version__"]