milpa-sdk 0.1.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.
Files changed (82) hide show
  1. milpa_sdk-0.1.0a1/.gitignore +23 -0
  2. milpa_sdk-0.1.0a1/.milpa-manifest.json +11 -0
  3. milpa_sdk-0.1.0a1/AGENTS.md +54 -0
  4. milpa_sdk-0.1.0a1/CHANGELOG.md +36 -0
  5. milpa_sdk-0.1.0a1/LICENSE +201 -0
  6. milpa_sdk-0.1.0a1/NOTICE +26 -0
  7. milpa_sdk-0.1.0a1/PKG-INFO +187 -0
  8. milpa_sdk-0.1.0a1/README.md +159 -0
  9. milpa_sdk-0.1.0a1/SOURCE.md +33 -0
  10. milpa_sdk-0.1.0a1/ci/borrador/README.md +79 -0
  11. milpa_sdk-0.1.0a1/ci/borrador/woodpecker-publicar.yml +134 -0
  12. milpa_sdk-0.1.0a1/docs/01-manifiesto/01-el-problema.md +46 -0
  13. milpa_sdk-0.1.0a1/docs/01-manifiesto/02-la-solucion.md +72 -0
  14. milpa_sdk-0.1.0a1/docs/01-manifiesto/03-que-no-hace.md +46 -0
  15. milpa_sdk-0.1.0a1/docs/01-manifiesto/README.md +34 -0
  16. milpa_sdk-0.1.0a1/docs/02-diagramas/D01-contexto.md +73 -0
  17. milpa_sdk-0.1.0a1/docs/02-diagramas/D01-contexto.mmd +27 -0
  18. milpa_sdk-0.1.0a1/docs/02-diagramas/D02-flujo-manifest-perfil-reporte.md +69 -0
  19. milpa_sdk-0.1.0a1/docs/02-diagramas/D02-flujo-manifest-perfil-reporte.mmd +18 -0
  20. milpa_sdk-0.1.0a1/docs/02-diagramas/D03-perfiles-y-nucleo-invariante.md +59 -0
  21. milpa_sdk-0.1.0a1/docs/02-diagramas/D03-perfiles-y-nucleo-invariante.mmd +14 -0
  22. milpa_sdk-0.1.0a1/docs/02-diagramas/D04-fronteras-bloqueadas.md +85 -0
  23. milpa_sdk-0.1.0a1/docs/02-diagramas/D04-fronteras-bloqueadas.mmd +33 -0
  24. milpa_sdk-0.1.0a1/docs/02-diagramas/D05-que-es-milpa-y-que-no.md +71 -0
  25. milpa_sdk-0.1.0a1/docs/02-diagramas/D05-que-es-milpa-y-que-no.mmd +18 -0
  26. milpa_sdk-0.1.0a1/docs/02-diagramas/README.md +48 -0
  27. milpa_sdk-0.1.0a1/docs/03-operacion/01-instalacion.md +80 -0
  28. milpa_sdk-0.1.0a1/docs/03-operacion/02-comandos.md +117 -0
  29. milpa_sdk-0.1.0a1/docs/03-operacion/03-que-no-esta-implementado.md +53 -0
  30. milpa_sdk-0.1.0a1/docs/03-operacion/README.md +33 -0
  31. milpa_sdk-0.1.0a1/docs/04-contratos/01-api-publica.md +80 -0
  32. milpa_sdk-0.1.0a1/docs/04-contratos/02-manifest.md +89 -0
  33. milpa_sdk-0.1.0a1/docs/04-contratos/03-perfiles.md +77 -0
  34. milpa_sdk-0.1.0a1/docs/04-contratos/04-axiomas.md +53 -0
  35. milpa_sdk-0.1.0a1/docs/04-contratos/05-decisiones.md +41 -0
  36. milpa_sdk-0.1.0a1/docs/04-contratos/06-fuentes-de-verdad.md +61 -0
  37. milpa_sdk-0.1.0a1/docs/04-contratos/README.md +36 -0
  38. milpa_sdk-0.1.0a1/docs/INDEX.md +81 -0
  39. milpa_sdk-0.1.0a1/docs/PLAN_IMPLEMENTACION.md +253 -0
  40. milpa_sdk-0.1.0a1/docs/QUICKSTART.md +31 -0
  41. milpa_sdk-0.1.0a1/docs/api/README.md +25 -0
  42. milpa_sdk-0.1.0a1/docs/architecture/DIAGRAMS.md +35 -0
  43. milpa_sdk-0.1.0a1/docs/asilo/arquitectura/ADR-001-asilo.md +43 -0
  44. milpa_sdk-0.1.0a1/docs/asilo/arquitectura/axiomas.md +30 -0
  45. milpa_sdk-0.1.0a1/docs/asilo/seguridad/pii-policy.md +32 -0
  46. milpa_sdk-0.1.0a1/docs/referencias.md +151 -0
  47. milpa_sdk-0.1.0a1/examples/README.md +16 -0
  48. milpa_sdk-0.1.0a1/governance/README.md +63 -0
  49. milpa_sdk-0.1.0a1/governance/ai-trace-allowlist.txt +17 -0
  50. milpa_sdk-0.1.0a1/governance/decisions/ADR-001-perfiles-como-codigo.md +33 -0
  51. milpa_sdk-0.1.0a1/governance/decisions/ADR-002-versionado-y-releases-codeberg.md +65 -0
  52. milpa_sdk-0.1.0a1/governance/decisions/ADR-003-research-como-carpeta-opcional.md +40 -0
  53. milpa_sdk-0.1.0a1/governance/decisions/ADR-004-frontera-canon-y-proyeccion.md +32 -0
  54. milpa_sdk-0.1.0a1/governance/decisions/ADR-005-archivo-de-agente-neutral.md +51 -0
  55. milpa_sdk-0.1.0a1/governance/decisions/ADR-006-validacion-solo-lectura.md +27 -0
  56. milpa_sdk-0.1.0a1/governance/decisions/ADR-007-herencia-canonica-no-fingida.md +23 -0
  57. milpa_sdk-0.1.0a1/mkdocs.yml +118 -0
  58. milpa_sdk-0.1.0a1/pyproject.toml +55 -0
  59. milpa_sdk-0.1.0a1/reports/2026-08-23-kasai-crew-readiness.md +33 -0
  60. milpa_sdk-0.1.0a1/reports/2026-08-24-manifest-y-estructura.md +38 -0
  61. milpa_sdk-0.1.0a1/reports/2026-09-22-mejoras-desde-horcon.md +191 -0
  62. milpa_sdk-0.1.0a1/reports/README.md +14 -0
  63. milpa_sdk-0.1.0a1/research/README.md +33 -0
  64. milpa_sdk-0.1.0a1/research/RESEARCH_PROMPT_MILPA_SDK.md +132 -0
  65. milpa_sdk-0.1.0a1/research/responses/.gitkeep +0 -0
  66. milpa_sdk-0.1.0a1/scripts/check_no_ai_traces.py +302 -0
  67. milpa_sdk-0.1.0a1/scripts/hooks/commit-msg +3 -0
  68. milpa_sdk-0.1.0a1/scripts/hooks/pre-commit +5 -0
  69. milpa_sdk-0.1.0a1/scripts/install-hooks.sh +11 -0
  70. milpa_sdk-0.1.0a1/src/milpa/__init__.py +35 -0
  71. milpa_sdk-0.1.0a1/src/milpa/cli.py +53 -0
  72. milpa_sdk-0.1.0a1/src/milpa/domains.py +34 -0
  73. milpa_sdk-0.1.0a1/src/milpa/errors.py +35 -0
  74. milpa_sdk-0.1.0a1/src/milpa/manifest.py +170 -0
  75. milpa_sdk-0.1.0a1/src/milpa/profiles.py +193 -0
  76. milpa_sdk-0.1.0a1/src/milpa/roles.py +30 -0
  77. milpa_sdk-0.1.0a1/tests/unit/test_api_publica.py +36 -0
  78. milpa_sdk-0.1.0a1/tests/unit/test_cli.py +37 -0
  79. milpa_sdk-0.1.0a1/tests/unit/test_manifest.py +102 -0
  80. milpa_sdk-0.1.0a1/tests/unit/test_perfiles.py +70 -0
  81. milpa_sdk-0.1.0a1/tests/unit/test_structure_validation.py +43 -0
  82. milpa_sdk-0.1.0a1/tmp/.gitkeep +0 -0
@@ -0,0 +1,23 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ venv/
5
+ dist/
6
+ build/
7
+ *.egg-info/
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ .coverage
11
+ htmlcov/
12
+ .env
13
+ .DS_Store
14
+ tmp/*
15
+ !tmp/.gitkeep
16
+ # Sitio de documentación ensamblado por `horcon docs build .` (ver mkdocs.yml)
17
+ tmp/site-src/
18
+ tmp/site/
19
+
20
+ # Config local de herramientas de agente (nunca se versiona)
21
+ .claude/
22
+ .cursor/
23
+ .aider*
@@ -0,0 +1,11 @@
1
+ {
2
+ "id": "milpa-sdk",
3
+ "role": "library",
4
+ "profile": "library",
5
+ "level": 2,
6
+ "parent": "../",
7
+ "anchor": "José Ruiz",
8
+ "scope": "SDK del ecosistema Milpa: manifests, perfiles de estructura, roles y fronteras de dominio",
9
+ "inherits": [],
10
+ "overrides": []
11
+ }
@@ -0,0 +1,54 @@
1
+ # Agente — milpa-sdk
2
+
3
+ > Contrato de arranque. Todo lo que no está aquí se **enlaza**, no se copia.
4
+ > Metodología: [`SOURCE.md`](SOURCE.md) · Mapa documental: [`docs/INDEX.md`](docs/INDEX.md)
5
+
6
+ ## Qué es este repo
7
+
8
+ Librería Python distribuible (perfil Milpa `library`). Implementa el modelo de ecosistema de
9
+ MILPA: manifests, perfiles de estructura, roles y fronteras de dominio. **No** define el
10
+ canon: lo proyecta.
11
+
12
+ ## Axiomas
13
+
14
+ Una regla que el sistema no puede violar. Estado y verificación en
15
+ [`docs/asilo/arquitectura/axiomas.md`](docs/asilo/arquitectura/axiomas.md).
16
+
17
+ | ID | Axioma |
18
+ |----|--------|
19
+ | AX-01 | Los seis perfiles son proyección del doc 21; este repo no define canon |
20
+ | AX-02 | Todo manifest nuevo declara perfil; el puente legacy infiere con advertencia visible |
21
+ | AX-03 | `validate_structure` no modifica el filesystem |
22
+ | AX-04 | El núcleo invariante es idéntico en los seis perfiles |
23
+ | AX-05 | Ningún secreto se escribe en el repo, incluidos tests y fixtures |
24
+
25
+ ## Reglas
26
+
27
+ 1. **Los perfiles son espejo del doc 21.** `src/milpa/profiles.py` no inventa perfiles:
28
+ refleja `21-perfiles-de-estructura-por-tipo-de-proyecto.md`. Agregar un perfil aquí sin
29
+ agregarlo allá crea dos verdades.
30
+ 2. **El manifest gana siempre.** Si no declara perfil, se aplica la regla de compatibilidad
31
+ del doc 21 y se emite advertencia; no se adivina en silencio.
32
+ 3. **Validar no es corregir.** `validate_structure` reporta lo que falta; no crea carpetas.
33
+ El scaffolding vigente es `kasai-crew scaffold` y vive fuera del SDK.
34
+ 4. **src-layout es obligatorio.** El paquete vive en `src/milpa/`, nunca en la raíz.
35
+ 5. **Nunca borrar ni renombrar carpetas del núcleo invariante** de un nodo ajeno.
36
+
37
+ ## Alcance
38
+
39
+ | Puedes | No puedes |
40
+ |--------|-----------|
41
+ | Editar `src/`, `tests/`, `docs/`, `examples/` | Cambiar un perfil sin ADR en ambos planos |
42
+ | Agregar validaciones | Hacer que `validate_structure` cree o borre carpetas |
43
+ | Proponer un perfil nuevo en `reports/` | Añadirlo a `PROFILES` por cuenta propia |
44
+ | Crear ADRs en `governance/decisions/` | Publicar a PyPI |
45
+
46
+ Los hallazgos que no son código van a `reports/` como `YYYY-MM-DD-tema.md`.
47
+
48
+ ## Done
49
+
50
+ - [ ] `pytest` pasa.
51
+ - [ ] El doc 21 cambió también, si cambió la tabla de perfiles.
52
+ - [ ] `CHANGELOG.md` actualizado si cambió la API pública.
53
+ - [ ] Todo doc nuevo enlazado desde `docs/INDEX.md`.
54
+ - [ ] `scripts/check_no_ai_traces.py` pasa (lo aplica el hook `pre-commit`).
@@ -0,0 +1,36 @@
1
+ # Changelog
2
+
3
+ Formato basado en [Keep a Changelog](https://keepachangelog.com/es-ES/1.1.0/).
4
+ Versionado según [Semantic Versioning](https://semver.org/lang/es/).
5
+
6
+ ## [0.1.0a1] — 2026-09-24
7
+
8
+ ### Cambiado
9
+ - `Manifest` acepta extensiones namespaced opcionales bajo `extensions`, conservando el núcleo
10
+ estricto de MILPA para que integradores como Horcón puedan declarar metadata propia sin añadir
11
+ campos desconocidos al contrato estructural.
12
+
13
+ ### Cambiado
14
+ - `pyproject.toml` declara `[project.urls]` (Homepage, Repository, Issues, Changelog) hacia el
15
+ repositorio real en Codeberg, verificados en vivo (200) el 2026-09-22.
16
+ - `README.md` reescrito como portada de PyPI: problema y audiencia en dos párrafos, analogía de
17
+ la milpa con doble crédito (la milpa mesoamericana viva y el curso que propuso la analogía) y
18
+ enlace a por qué MILPA no es "tres roles de agentes", aviso explícito de que `require_role` y
19
+ `domain_boundary` no están en `__all__`, y enlaces a documentación, código, changelog e
20
+ incidencias.
21
+ - `LICENSE` contiene el texto completo de Apache-2.0; antes era solo el aviso de 18
22
+ líneas, que no cumple la sección 4(a) de la propia licencia.
23
+ - Metadatos de licencia según PEP 639 (`license = "Apache-2.0"`, `license-files`).
24
+ - La versión se deriva del tag git vía `hatch-vcs`; ya no se escribe en `pyproject.toml` (ver ADR-002).
25
+
26
+ ### Añadido
27
+ - Loader estricto y acotado de `.milpa-manifest.json`, con detección de claves
28
+ duplicadas y migración legacy visible.
29
+ - Validación de estructura determinista y de sólo lectura, incluida política segura
30
+ para enlaces simbólicos.
31
+ - Comando `milpa validate [ruta] [--json]` para aplicar el perfil al propio repo.
32
+ - `NOTICE` con la atribución de copyright y la reserva de marca.
33
+ - `research/` como ruta opcional en los perfiles `software-single` y `library` (ADR-003).
34
+ - Esqueleto inicial con perfil Milpa `library`.
35
+ - Modelo de los seis perfiles de estructura (doc 21) en `milpa.profiles`.
36
+ - Contratos declarados para `load_manifest`, `validate_structure`, `require_role` y `domain_boundary`.
@@ -0,0 +1,201 @@
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, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Kasai Labs
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,26 @@
1
+ MILPA SDK
2
+ Copyright 2026 Kasai Labs
3
+
4
+ This product includes software developed at Kasai Labs
5
+ (https://codeberg.org/kasailabs).
6
+
7
+ --------------------------------------------------------------------------------
8
+ Marcas / Trademarks
9
+ --------------------------------------------------------------------------------
10
+
11
+ "ASILO", "MILPA" y "Kasai Labs" son marcas de Kasai Labs.
12
+
13
+ La Licencia Apache 2.0 concede derechos sobre el **código**, no sobre las marcas.
14
+ Su seccion 6 ("Trademarks") excluye expresamente los nombres comerciales, marcas
15
+ registradas y marcas de servicio del licenciante.
16
+
17
+ En la practica esto significa que puedes usar, modificar y redistribuir este
18
+ software, incluso comercialmente, pero **no** puedes dar a entender que tu
19
+ version derivada es MILPA oficial ni esta avalada por Kasai Labs.
20
+
21
+ --------------------------------------------------------------------------------
22
+ Metodologia
23
+ --------------------------------------------------------------------------------
24
+
25
+ Este repositorio es una implementacion de referencia. La metodologia MILPA en si
26
+ se documenta en el plano de planeacion (ver SOURCE.md) y no se licencia aqui.
@@ -0,0 +1,187 @@
1
+ Metadata-Version: 2.5
2
+ Name: milpa-sdk
3
+ Version: 0.1.0a1
4
+ Summary: SDK del ecosistema Milpa: manifests, perfiles de estructura, roles y fronteras de dominio
5
+ Project-URL: Homepage, https://codeberg.org/kasailabs/milpa-sdk
6
+ Project-URL: Repository, https://codeberg.org/kasailabs/milpa-sdk
7
+ Project-URL: Issues, https://codeberg.org/kasailabs/milpa-sdk/issues
8
+ Project-URL: Changelog, https://codeberg.org/kasailabs/milpa-sdk/src/branch/main/CHANGELOG.md
9
+ Author: Kasai Labs
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Keywords: agents,ecosystem,governance,monorepo,project-structure
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: pydantic>=2.7
22
+ Requires-Dist: pyyaml>=6.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest-cov>=5.0; extra == 'dev'
25
+ Requires-Dist: pytest>=8.0; extra == 'dev'
26
+ Requires-Dist: ruff>=0.5; extra == 'dev'
27
+ Description-Content-Type: text/markdown
28
+
29
+ # milpa-sdk
30
+
31
+ > Implementación Python de referencia **candidata** para una proyección versionada de MILPA.
32
+ > Aspira a leer manifests, validar perfiles sin mutar y ofrecer puntos de decisión para roles
33
+ > y dominios; no define la metodología ni convierte carpetas en una ontología.
34
+
35
+ **Perfil Milpa:** `library` (P5) · **Distribución prevista:** PyPI `milpa-sdk` · **Estado:** alpha parcial no publicable
36
+
37
+ ## Qué resuelve y para quién
38
+
39
+ Un conjunto de repositorios donde cada equipo —y cada agente de software que los lee— decide por
40
+ su cuenta dónde van la documentación, las decisiones y los reportes es un campo sin letreros:
41
+ para saber qué hay en cada parcela hay que recorrerla entera. `milpa-sdk` lee un letrero por
42
+ repositorio (`.milpa-manifest.json`) y comprueba, sin tocar nada, si tiene las carpetas que su
43
+ tipo declarado exige.
44
+
45
+ Es para quien mantiene varios repositorios —personas o agentes de software que actúan sobre
46
+ ellos— y quiere una comprobación de estructura reproducible en vez de una convención escrita en
47
+ prosa que nadie audita.
48
+
49
+ **Analogía, con su origen.** El nombre y la imagen se apoyan, de forma didáctica, en la milpa
50
+ mesoamericana: un policultivo vivo, sostenido durante generaciones por las comunidades que lo
51
+ cultivan, en el que distintas plantas comparten una misma parcela porque siguen un patrón
52
+ conocido; la FAO lo reconoció en 2022 como Sistema Importante del Patrimonio Agrícola Mundial
53
+ (FAO, s.f.; ver [`docs/referencias.md`](docs/referencias.md)). La analogía es del curso que la
54
+ propuso para explicar por qué conviene un patrón compartido, no una lista de roles: **MILPA no
55
+ es "tres roles de agentes"**, es estructura de proyecto, niveles de certeza, reglas negativas y
56
+ responsabilidad. Los roles operativos de un sistema multiagente (coordinador, ejecutor, crítico,
57
+ compuerta determinista, autoridad humana) son cinco y los define la taxonomía del ecosistema, no
58
+ este SDK. Detalle completo en
59
+ [D05 — qué es MILPA y qué no](docs/02-diagramas/D05-que-es-milpa-y-que-no.md).
60
+
61
+ ## TL;DR
62
+
63
+ - `load_manifest` ya lee JSON estricto, acotado y sin ejecutar contenido.
64
+ - `validate_structure` y `milpa validate` revisan un perfil sin modificar el repositorio.
65
+ - `inherits` sólo se conserva como dato: todavía no se resuelve ni amplía autoridad.
66
+ - roles, dominios, identidad y enforcement siguen bloqueados.
67
+ - Los perfiles son una proyección candidata hasta fijar revisión y digest del canon.
68
+ - Empieza por el [manifiesto](docs/01-manifiesto/README.md), los
69
+ [diagramas](docs/02-diagramas/README.md) o el [índice](docs/INDEX.md) completo.
70
+
71
+ ---
72
+
73
+ ## Documentación
74
+
75
+ Cuatro niveles, de lo general a lo particular, según el estándar documental de Horcón. Ruta de
76
+ lectura: [manifiesto](docs/01-manifiesto/README.md) (sin tecnicismos) →
77
+ [diagramas](docs/02-diagramas/README.md) → [operación](docs/03-operacion/README.md) →
78
+ [contratos](docs/04-contratos/README.md); el mapa completo y la ruta por perfil están en
79
+ [`docs/INDEX.md`](docs/INDEX.md). El sitio se audita y construye con la CLI de Horcón desde la
80
+ raíz de este repo:
81
+
82
+ ```bash
83
+ ../horcon/.venv/bin/python -m horcon audit-docs . # frontmatter, navegación, enlaces
84
+ ../horcon/.venv/bin/python -m horcon docs build . # sitio en tmp/site/ (mkdocs --strict)
85
+ ../horcon/.venv/bin/python -m horcon docs serve . # servido en 127.0.0.1
86
+ ```
87
+
88
+ ---
89
+
90
+ ## Diseño objetivo
91
+
92
+ Si ASILO responde *"¿está permitida esta acción?"*, Milpa responde *"¿quién puede hacerla
93
+ y dónde vive lo que produce?"*.
94
+
95
+ | Capacidad | Objetivo | Estado actual |
96
+ |-----------|----------|---------------|
97
+ | **Manifests** | cargar y validar; herencia separada | loader estricto ejecutable; herencia pendiente |
98
+ | **Perfiles** | validar estructura en sólo lectura | catálogo y validación ejecutables |
99
+ | **Roles** | decidir con identidad confiable | stub; identidad/auditoría pendientes |
100
+ | **Dominios** | autorizar y delegar enforcement a un adapter | stub; no impone RLS por sí solo |
101
+
102
+ Un decorador no puede impedir que un backend ignore una decisión. El diseño debe separar
103
+ PDP (decidir) de PEP (aplicar en filesystem, herramienta o almacenamiento) y probar ambos.
104
+
105
+ `require_role` (`milpa.roles`) y `domain_boundary` (`milpa.domains`) son importables por ruta de
106
+ módulo, pero lanzan `NotImplementedError` en cuanto se llaman y **no están en `__all__`**
107
+ (`src/milpa/__init__.py`; fijado por `tests/unit/test_api_publica.py`): no forman parte de la API
108
+ pública del paquete. El contrato símbolo por símbolo, con su estado y su prueba, está en
109
+ [`docs/04-contratos/01-api-publica.md`](docs/04-contratos/01-api-publica.md).
110
+
111
+ ## Preparación local
112
+
113
+ El paquete aún no está publicado. Para trabajar desde el clon:
114
+
115
+ ```bash
116
+ python3 --version # debe ser 3.11 o posterior
117
+ python3 -m venv .venv
118
+ source .venv/bin/activate
119
+ python -m pip install -e '.[dev]'
120
+ milpa validate .
121
+ ```
122
+
123
+ ## API ejecutable
124
+
125
+ ```python
126
+ from milpa import load_manifest, validate_structure
127
+
128
+ manifest = load_manifest(".")
129
+ reporte = validate_structure(".", profile=manifest.profile)
130
+
131
+ if not reporte.ok:
132
+ for falta in reporte.missing:
133
+ print(f"falta: {falta}")
134
+ ```
135
+
136
+ El reporte sólo considera obligatorias las rutas `missing`; `unexpected` es informativo.
137
+ Los enlaces simbólicos no satisfacen una ruta obligatoria. Consulta
138
+ [qué no está implementado](docs/03-operacion/03-que-no-esta-implementado.md) antes de usarlo en
139
+ automatización.
140
+
141
+ ## Los seis perfiles actuales
142
+
143
+ El código contiene una transcripción manual del doc 21. El plan la reemplaza por una
144
+ proyección generada con revisión y digest para evitar dos fuentes de verdad:
145
+
146
+ | Perfil | Para qué |
147
+ |--------|----------|
148
+ | `node` | Nodo organizativo puro: verticales, capas, agrupadores |
149
+ | `product-dossier` | Producto en planeación (marca, tesis, features, MVP, roadmap) |
150
+ | `software-single` | Repo de implementación con un solo deployable |
151
+ | `software-monorepo` | Varios deployables que comparten librerías internas |
152
+ | `research` | Proyecto cuyo entregable es conocimiento verificable |
153
+ | `library` | Paquete publicable a un registro |
154
+
155
+ Todos comparten el mismo **núcleo invariante**; solo cambian las carpetas de dominio.
156
+
157
+ ## Relación prevista con asilo-core
158
+
159
+ Los paquetes deben permanecer independientes. Este ejemplo sólo ilustra una composición
160
+ futura: roles, dominios, política y HITL siguen bloqueados; `enforce_schema` sí valida forma,
161
+ pero no reemplaza esas capas:
162
+
163
+ ```python
164
+ @require_role("Contador") # Milpa: ¿quién?
165
+ @guardrail(".asilo/axioms.yaml") # ASILO: ¿está permitido?
166
+ @enforce_schema(ReporteFinanciero) # ASILO: ¿tiene la forma correcta?
167
+ def generar_reporte(prompt: str): ...
168
+ ```
169
+
170
+ ## Licencia
171
+
172
+ Apache-2.0 — texto completo en [`LICENSE`](LICENSE).
173
+
174
+ La marca MILPA **no** se licencia con el código (sección 6 de Apache-2.0); ver [`NOTICE`](NOTICE).
175
+
176
+ ## Enlaces
177
+
178
+ - Documentación completa (cuatro niveles): [`docs/INDEX.md`](docs/INDEX.md)
179
+ - Código fuente (Codeberg): <https://codeberg.org/kasailabs/milpa-sdk>
180
+ - Registro de cambios: [`CHANGELOG.md`](CHANGELOG.md)
181
+ - Incidencias: <https://codeberg.org/kasailabs/milpa-sdk/issues>
182
+
183
+ ## Estado de implementación
184
+
185
+ Ver [`docs/PLAN_IMPLEMENTACION.md`](docs/PLAN_IMPLEMENTACION.md). El slice manifest → perfil → reporte es ejecutable y
186
+ de sólo lectura. No usar roles o dominios como control de acceso real, resolver `inherits`
187
+ por cuenta propia ni ejecutar validaciones esperando que reparen un repositorio.