castlearq 0.1.0__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.
- castlearq-0.1.0/LICENSE +202 -0
- castlearq-0.1.0/PKG-INFO +11 -0
- castlearq-0.1.0/README.md +310 -0
- castlearq-0.1.0/app/__init__.py +17 -0
- castlearq-0.1.0/app/api.py +1400 -0
- castlearq-0.1.0/app/application_wiring.py +274 -0
- castlearq-0.1.0/app/artifact_selection.py +136 -0
- castlearq-0.1.0/app/boundary_adapter.py +586 -0
- castlearq-0.1.0/app/chat.py +463 -0
- castlearq-0.1.0/app/compatibility.py +304 -0
- castlearq-0.1.0/app/compatibility_domain.py +238 -0
- castlearq-0.1.0/app/compatibility_evaluator.py +403 -0
- castlearq-0.1.0/app/compatibility_knowledge.py +245 -0
- castlearq-0.1.0/app/downloads/__init__.py +44 -0
- castlearq-0.1.0/app/downloads/cleanup.py +110 -0
- castlearq-0.1.0/app/downloads/downloader.py +446 -0
- castlearq-0.1.0/app/downloads/inspection.py +108 -0
- castlearq-0.1.0/app/downloads/planner.py +259 -0
- castlearq-0.1.0/app/downloads/recovery.py +65 -0
- castlearq-0.1.0/app/evaluate_compatibility.py +257 -0
- castlearq-0.1.0/app/evaluation_adapter.py +217 -0
- castlearq-0.1.0/app/evaluation_composition.py +129 -0
- castlearq-0.1.0/app/evaluation_pipeline.py +139 -0
- castlearq-0.1.0/app/evaluation_policy.py +265 -0
- castlearq-0.1.0/app/execute_model.py +356 -0
- castlearq-0.1.0/app/execution.py +306 -0
- castlearq-0.1.0/app/execution_service.py +142 -0
- castlearq-0.1.0/app/gguf_reader.py +104 -0
- castlearq-0.1.0/app/gpu_diagnosis.py +287 -0
- castlearq-0.1.0/app/gpu_recipes.py +128 -0
- castlearq-0.1.0/app/gpu_setup.py +361 -0
- castlearq-0.1.0/app/hardware.py +380 -0
- castlearq-0.1.0/app/initial_knowledge.py +1053 -0
- castlearq-0.1.0/app/knowledge_bridge.py +196 -0
- castlearq-0.1.0/app/main.py +1315 -0
- castlearq-0.1.0/app/manifest_migration.py +203 -0
- castlearq-0.1.0/app/model_catalog.py +75 -0
- castlearq-0.1.0/app/model_domain.py +323 -0
- castlearq-0.1.0/app/model_identity.py +80 -0
- castlearq-0.1.0/app/model_store.py +353 -0
- castlearq-0.1.0/app/models.py +88 -0
- castlearq-0.1.0/app/observation_domain.py +371 -0
- castlearq-0.1.0/app/observation_knowledge.py +210 -0
- castlearq-0.1.0/app/observation_probe.py +836 -0
- castlearq-0.1.0/app/platform.py +126 -0
- castlearq-0.1.0/app/remediation.py +272 -0
- castlearq-0.1.0/app/remediation_verification.py +343 -0
- castlearq-0.1.0/app/resolver.py +121 -0
- castlearq-0.1.0/app/run_service.py +398 -0
- castlearq-0.1.0/app/runner.py +317 -0
- castlearq-0.1.0/app/runtime_metrics.py +76 -0
- castlearq-0.1.0/app/runtimes.py +369 -0
- castlearq-0.1.0/app/selection.py +120 -0
- castlearq-0.1.0/app/session.py +223 -0
- castlearq-0.1.0/app/sources/__init__.py +20 -0
- castlearq-0.1.0/app/sources/base.py +29 -0
- castlearq-0.1.0/app/sources/huggingface.py +240 -0
- castlearq-0.1.0/app/version.py +21 -0
- castlearq-0.1.0/castlearq.egg-info/PKG-INFO +11 -0
- castlearq-0.1.0/castlearq.egg-info/SOURCES.txt +123 -0
- castlearq-0.1.0/castlearq.egg-info/dependency_links.txt +1 -0
- castlearq-0.1.0/castlearq.egg-info/entry_points.txt +2 -0
- castlearq-0.1.0/castlearq.egg-info/top_level.txt +1 -0
- castlearq-0.1.0/pyproject.toml +25 -0
- castlearq-0.1.0/setup.cfg +4 -0
- castlearq-0.1.0/tests/test_api.py +694 -0
- castlearq-0.1.0/tests/test_application_wiring.py +343 -0
- castlearq-0.1.0/tests/test_artifact_selection.py +149 -0
- castlearq-0.1.0/tests/test_b930_packaging.py +124 -0
- castlearq-0.1.0/tests/test_boundary_adapter.py +419 -0
- castlearq-0.1.0/tests/test_chat.py +755 -0
- castlearq-0.1.0/tests/test_chat_sessions.py +1439 -0
- castlearq-0.1.0/tests/test_compatibility.py +139 -0
- castlearq-0.1.0/tests/test_compatibility_domain.py +362 -0
- castlearq-0.1.0/tests/test_compatibility_evaluator.py +447 -0
- castlearq-0.1.0/tests/test_compatibility_knowledge.py +404 -0
- castlearq-0.1.0/tests/test_download_cleanup.py +225 -0
- castlearq-0.1.0/tests/test_download_cli.py +644 -0
- castlearq-0.1.0/tests/test_download_inspection.py +173 -0
- castlearq-0.1.0/tests/test_download_planner.py +173 -0
- castlearq-0.1.0/tests/test_download_recovery.py +70 -0
- castlearq-0.1.0/tests/test_downloader.py +749 -0
- castlearq-0.1.0/tests/test_environment_observation.py +1154 -0
- castlearq-0.1.0/tests/test_evaluate_compatibility.py +302 -0
- castlearq-0.1.0/tests/test_evaluation_adapter.py +400 -0
- castlearq-0.1.0/tests/test_evaluation_composition.py +868 -0
- castlearq-0.1.0/tests/test_evaluation_pipeline.py +295 -0
- castlearq-0.1.0/tests/test_evaluation_policy.py +391 -0
- castlearq-0.1.0/tests/test_execute_model.py +834 -0
- castlearq-0.1.0/tests/test_execute_model_wiring.py +438 -0
- castlearq-0.1.0/tests/test_execution.py +161 -0
- castlearq-0.1.0/tests/test_execution_integration.py +251 -0
- castlearq-0.1.0/tests/test_execution_preflight.py +178 -0
- castlearq-0.1.0/tests/test_execution_service.py +217 -0
- castlearq-0.1.0/tests/test_gguf_reader.py +61 -0
- castlearq-0.1.0/tests/test_gpu_diagnosis.py +472 -0
- castlearq-0.1.0/tests/test_gpu_diagnosis_cli.py +377 -0
- castlearq-0.1.0/tests/test_gpu_recipes.py +163 -0
- castlearq-0.1.0/tests/test_gpu_setup.py +259 -0
- castlearq-0.1.0/tests/test_hardware.py +119 -0
- castlearq-0.1.0/tests/test_huggingface.py +216 -0
- castlearq-0.1.0/tests/test_initial_knowledge.py +299 -0
- castlearq-0.1.0/tests/test_knowledge_bridge.py +355 -0
- castlearq-0.1.0/tests/test_main.py +854 -0
- castlearq-0.1.0/tests/test_main_chat.py +392 -0
- castlearq-0.1.0/tests/test_main_execute.py +454 -0
- castlearq-0.1.0/tests/test_manifest_migration.py +196 -0
- castlearq-0.1.0/tests/test_model_domain.py +475 -0
- castlearq-0.1.0/tests/test_model_identity.py +209 -0
- castlearq-0.1.0/tests/test_model_store.py +347 -0
- castlearq-0.1.0/tests/test_observation_knowledge.py +360 -0
- castlearq-0.1.0/tests/test_platform.py +217 -0
- castlearq-0.1.0/tests/test_remediation.py +378 -0
- castlearq-0.1.0/tests/test_remediation_verification.py +277 -0
- castlearq-0.1.0/tests/test_resolver.py +240 -0
- castlearq-0.1.0/tests/test_run_service_errors.py +134 -0
- castlearq-0.1.0/tests/test_runner.py +334 -0
- castlearq-0.1.0/tests/test_runtime_capability.py +247 -0
- castlearq-0.1.0/tests/test_runtime_metrics.py +165 -0
- castlearq-0.1.0/tests/test_runtimes.py +45 -0
- castlearq-0.1.0/tests/test_selection.py +185 -0
- castlearq-0.1.0/tests/test_session.py +156 -0
- castlearq-0.1.0/tests/test_shared_preparation.py +200 -0
- castlearq-0.1.0/tests/test_source_plan_output.py +138 -0
- castlearq-0.1.0/tests/test_verify_cli.py +180 -0
castlearq-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
castlearq-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: castlearq
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CastleArq — Local AI Runtime Architecture
|
|
5
|
+
Author-email: Nicolás Bruna <brunafuentealba@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://www.nicobrunaf.dev/projects/castlearq/
|
|
8
|
+
Project-URL: Repository, https://github.com/NicolasBruna24/CastleArq
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Dynamic: license-file
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
# CastleArq
|
|
2
|
+
|
|
3
|
+
CastleArq es un gestor y orquestador local de artifacts de IA. Descubre y
|
|
4
|
+
diagnostica un runtime local, gestiona modelos GGUF, evalúa compatibilidad,
|
|
5
|
+
selecciona el backend disponible y ejecuta prompts con llama.cpp.
|
|
6
|
+
|
|
7
|
+
CastleArq no reemplaza a llama.cpp: el runtime, sus drivers y sus modelos son
|
|
8
|
+
dependencias externas que debe proporcionar el usuario.
|
|
9
|
+
|
|
10
|
+
## What is CastleArq?
|
|
11
|
+
|
|
12
|
+
CastleArq ofrece un flujo local para:
|
|
13
|
+
|
|
14
|
+
- descubrir y diagnosticar el runtime oficial `llama`;
|
|
15
|
+
- consultar el catálogo de modelos;
|
|
16
|
+
- descargar explícitamente artifacts GGUF;
|
|
17
|
+
- almacenarlos y volver a listarlos localmente;
|
|
18
|
+
- validar compatibilidad y seleccionar backend;
|
|
19
|
+
- ejecutar un primer prompt o una sesión chat.
|
|
20
|
+
|
|
21
|
+
La documentación técnica de arquitectura, contratos, evaluación y ejecución
|
|
22
|
+
está en [`docs/`](docs/). El usuario no necesita leerla para completar el
|
|
23
|
+
flujo básico.
|
|
24
|
+
|
|
25
|
+
## Requirements
|
|
26
|
+
|
|
27
|
+
- Linux como baseline actual.
|
|
28
|
+
- Python `>=3.10`.
|
|
29
|
+
- Un entorno virtual de Python.
|
|
30
|
+
- `llama.cpp` proporcionado externamente, con el ejecutable oficial `llama`
|
|
31
|
+
disponible en `PATH`.
|
|
32
|
+
|
|
33
|
+
CastleArq no incluye llama.cpp, modelos, drivers, Vulkan, CUDA, ROCm ni otros
|
|
34
|
+
stacks de GPU. El flujo normal no requiere `sudo` y no modifica el sistema.
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
Desde un checkout:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
python3 -m venv .venv
|
|
42
|
+
. .venv/bin/activate
|
|
43
|
+
pip install .
|
|
44
|
+
castlearq --version
|
|
45
|
+
castlearq --help
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
También puede instalarse desde un wheel o sdist construido previamente. Por
|
|
49
|
+
ejemplo, con un wheel local:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install dist/castlearq-0.1.0-py3-none-any.whl
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
La instalación no necesita `PYTHONPATH` ni el código fuente después de
|
|
56
|
+
instalarse. El paquete no contiene modelos.
|
|
57
|
+
|
|
58
|
+
## Runtime setup
|
|
59
|
+
|
|
60
|
+
CastleArq requiere el ejecutable `llama`; no instala ni compila llama.cpp.
|
|
61
|
+
Comprueba primero que el launcher esté en el `PATH`:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
command -v llama
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Después consulta el estado que CastleArq puede observar:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
castlearq runtime
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
La salida muestra el runtime, launcher, executable resuelto, versión, build,
|
|
74
|
+
estado de disponibilidad y capabilities detectadas.
|
|
75
|
+
|
|
76
|
+
| Estado | Significado | Acción |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| `AVAILABLE` | Runtime utilizable | Continuar con modelos. |
|
|
79
|
+
| `NOT_FOUND` | `llama` no está disponible | Proporcionar llama.cpp externamente. |
|
|
80
|
+
| `FOUND_UNUSABLE` | Se encontró un path no utilizable | Revisar path, permisos y tipo de ejecutable. |
|
|
81
|
+
| `PROBE_ERROR` | La validación no pudo completarse | Revisar el `reason`, instalación o build de llama.cpp. |
|
|
82
|
+
| `UNKNOWN` | No hay evidencia suficiente | Revisar el `reason` y repetir el diagnóstico. |
|
|
83
|
+
|
|
84
|
+
`llama` es el launcher oficial. `llama-cli`, `llama-server` y `llama.app` no
|
|
85
|
+
sustituyen automáticamente a `llama` para la ejecución de CastleArq 0.1.x.
|
|
86
|
+
|
|
87
|
+
## First model
|
|
88
|
+
|
|
89
|
+
Consulta el catálogo y elige el `MODEL_ID` canónico:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
castlearq models
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Descarga explícitamente el artifact:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
castlearq download qwen2.5-coder-7b-instruct
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
La descarga requiere conexión con la fuente remota. Si el catálogo ofrece
|
|
102
|
+
varias variantes, puedes seleccionar una con:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
castlearq download MODEL_ID --quantization QUANTIZATION
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
o indicar un archivo concreto con `--filename` cuando corresponda. No se
|
|
109
|
+
asume que un modelo remoto permanezca disponible para siempre.
|
|
110
|
+
|
|
111
|
+
En este flujo:
|
|
112
|
+
|
|
113
|
+
- **model**: el modelo lógico que quieres usar;
|
|
114
|
+
- **`MODEL_ID`**: el identificador canónico que acepta la CLI;
|
|
115
|
+
- **artifact**: el archivo concreto que se descarga y almacena;
|
|
116
|
+
- **GGUF**: el formato del artifact usado por el runtime actual;
|
|
117
|
+
- **quantization**: la variante de precisión/tamaño elegida;
|
|
118
|
+
- **filename**: el nombre exacto del artifact.
|
|
119
|
+
|
|
120
|
+
## Verify local artifacts
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
castlearq list
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
`list` muestra los artifacts locales con su model ID, filename, quantización,
|
|
127
|
+
tamaño y estado. Los artifacts se reutilizan en ejecuciones posteriores.
|
|
128
|
+
|
|
129
|
+
El ModelStore oficial es independiente del checkout:
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
$XDG_DATA_HOME/castlearq/models
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
y el fallback es:
|
|
136
|
+
|
|
137
|
+
```text
|
|
138
|
+
~/.local/share/castlearq/models
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
`~/.local/share/localai-hub/models` es únicamente compatibilidad legacy; no es
|
|
142
|
+
la ruta recomendada para nuevas instalaciones. No es necesario editar manifests
|
|
143
|
+
ni mover modelos manualmente para usar CastleArq.
|
|
144
|
+
|
|
145
|
+
## First execution
|
|
146
|
+
|
|
147
|
+
La interfaz recomendada para el primer uso es `execute`:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
castlearq execute qwen2.5-coder-7b-instruct "Reply with exactly B9.34-OK"
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Un prompt exitoso muestra la respuesta del modelo en stdout. El runtime
|
|
154
|
+
puede escribir mensajes de carga y generación, y CastleArq puede mostrar
|
|
155
|
+
warnings en stderr. Un warning no implica por sí solo que la ejecución haya
|
|
156
|
+
fallado.
|
|
157
|
+
|
|
158
|
+
- exit code `0`: ejecución exitosa;
|
|
159
|
+
- exit code `1`: fallo operativo;
|
|
160
|
+
- exit code `2`: argumentos o uso incorrecto.
|
|
161
|
+
|
|
162
|
+
La salida exacta puede variar con el modelo y el prompt. Un resultado exitoso
|
|
163
|
+
debe incluir salida generada y código `0`.
|
|
164
|
+
|
|
165
|
+
La interfaz `run` también existe y es compatible:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
castlearq run qwen2.5-coder-7b-instruct --prompt "Reply with exactly B9.34-OK"
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
`run` y `execute` no son aliases sintácticos: `run` recibe `--prompt`, mientras
|
|
172
|
+
que `execute` recibe el prompt como argumento. Usa `execute` para el primer
|
|
173
|
+
flujo recomendado y conserva `run` como interfaz existente.
|
|
174
|
+
|
|
175
|
+
## Model management
|
|
176
|
+
|
|
177
|
+
El ciclo básico es:
|
|
178
|
+
|
|
179
|
+
```text
|
|
180
|
+
models → choose MODEL_ID → download → list → execute
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
`models` descubre el catálogo, `download` adquiere el artifact explícitamente,
|
|
184
|
+
`list` comprueba el almacenamiento local y `execute` ejecuta un prompt. Repetir
|
|
185
|
+
`execute` no vuelve a descargar el modelo.
|
|
186
|
+
|
|
187
|
+
## Troubleshooting
|
|
188
|
+
|
|
189
|
+
### `llama` no encontrado
|
|
190
|
+
|
|
191
|
+
Comprueba:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
command -v llama
|
|
195
|
+
castlearq runtime
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Si aparece `NOT_FOUND`, proporciona llama.cpp externamente y vuelve a ejecutar
|
|
199
|
+
`castlearq runtime`. CastleArq no lo instalará automáticamente.
|
|
200
|
+
|
|
201
|
+
### Runtime `FOUND_UNUSABLE`
|
|
202
|
+
|
|
203
|
+
CastleArq encontró un path, pero no puede usarlo como launcher. Revisa el path
|
|
204
|
+
devuelto, los permisos, el tipo de archivo y la instalación/build del runtime.
|
|
205
|
+
|
|
206
|
+
### Runtime `PROBE_ERROR`
|
|
207
|
+
|
|
208
|
+
CastleArq encontró el launcher pero no pudo validar la interfaz. Lee `Reason`,
|
|
209
|
+
revisa la instalación/build de llama.cpp y vuelve a ejecutar el diagnóstico.
|
|
210
|
+
Esto no demuestra por sí solo una incompatibilidad universal.
|
|
211
|
+
|
|
212
|
+
### Artifact inexistente
|
|
213
|
+
|
|
214
|
+
Consulta el catálogo y el ModelStore:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
castlearq list
|
|
218
|
+
castlearq models
|
|
219
|
+
castlearq download MODEL_ID
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Artifact inválido o incompleto
|
|
223
|
+
|
|
224
|
+
Revisa `castlearq list`. No intentes ejecutar un artifact cuyo estado no sea
|
|
225
|
+
utilizable. Si el artifact no está descargado, vuelve a usar `download`; el
|
|
226
|
+
comando existente conserva la semántica de validación y no publica un
|
|
227
|
+
artifact que no cumpla sus verificaciones.
|
|
228
|
+
|
|
229
|
+
### Incompatibilidad
|
|
230
|
+
|
|
231
|
+
La ejecución puede bloquearse por modelo, artifact, memoria, quantization o
|
|
232
|
+
capabilities. Revisa `castlearq models`, `castlearq list` y `castlearq runtime`
|
|
233
|
+
antes de elegir otro artifact o prompt.
|
|
234
|
+
|
|
235
|
+
### Backend unavailable
|
|
236
|
+
|
|
237
|
+
Consulta las capabilities:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
castlearq runtime
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
No asumas que un backend anunciado por el hardware está disponible en el
|
|
244
|
+
runtime. Usa un backend compatible con lo detectado.
|
|
245
|
+
|
|
246
|
+
### Admission denied
|
|
247
|
+
|
|
248
|
+
CastleArq bloqueó la ejecución según la evaluación actual. Lee el motivo
|
|
249
|
+
mostrado; no hay una instrucción para forzar la ejecución.
|
|
250
|
+
|
|
251
|
+
### Execution failure
|
|
252
|
+
|
|
253
|
+
Revisa el error y el stderr de la ejecución, y contrasta:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
castlearq runtime
|
|
257
|
+
castlearq list
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
El fallo del proceso no significa automáticamente que falte el runtime o el
|
|
261
|
+
artifact.
|
|
262
|
+
|
|
263
|
+
### Download failure
|
|
264
|
+
|
|
265
|
+
Revisa conectividad, la disponibilidad de la fuente remota, el `MODEL_ID`, la
|
|
266
|
+
selección de quantization/filename y vuelve a ejecutar:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
castlearq download MODEL_ID
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### CLI usage error
|
|
273
|
+
|
|
274
|
+
Consulta:
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
castlearq --help
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
El exit code `2` indica uso incorrecto, como argumentos faltantes o flags no
|
|
281
|
+
válidos.
|
|
282
|
+
|
|
283
|
+
## Architecture
|
|
284
|
+
|
|
285
|
+
La documentación de arquitectura y los contratos técnicos están en
|
|
286
|
+
[`docs/`](docs/). Incluye decisiones de runtime discovery, capability,
|
|
287
|
+
compatibility, admission, ModelStore y execution. Es material opcional para el
|
|
288
|
+
flujo de usuario.
|
|
289
|
+
|
|
290
|
+
## Development
|
|
291
|
+
|
|
292
|
+
Desde un checkout, el mecanismo compatible es:
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
python3 -m app.main --help
|
|
296
|
+
python3 -m app.main --version
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Los tests se ejecutan con pytest:
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
python3 -m pytest
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
El desarrollo desde checkout no es necesario para usar el paquete instalado.
|
|
306
|
+
|
|
307
|
+
## License
|
|
308
|
+
|
|
309
|
+
Licensed under the Apache License, Version 2.0. See [`LICENSE`](LICENSE) for
|
|
310
|
+
the full text.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
# Copyright 2026 Nicolas Bruna
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
"""CastleArq application package."""
|
|
17
|
+
|