higpertext-cli 0.8.0__py3-none-any.whl

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 (335) hide show
  1. config/adapters_config.json +450 -0
  2. config/antigravity_agent_template.json +31 -0
  3. config/app_config.json +174 -0
  4. config/context_engine.json +33 -0
  5. config/environments/model_defaults.json +5 -0
  6. config/governance/branching_strategy.json +36 -0
  7. config/governance/deployment_gates.json +30 -0
  8. config/governance/guidelines_contract.json +54 -0
  9. config/governance/quality_gates.json +39 -0
  10. config/governance/section_rules.json +22 -0
  11. config/governance/security_guardrails.json +52 -0
  12. config/hooks/README.md +35 -0
  13. config/hooks/custom/test_output_limiter.json +9 -0
  14. config/hooks/global/session_prompt.json +9 -0
  15. config/htx_config.json +24 -0
  16. config/profile_learner.json +18 -0
  17. config/profiles/base_agent.json +40 -0
  18. config/profiles/base_auditor.json +19 -0
  19. config/profiles/base_developer.json +19 -0
  20. config/profiles/base_operator.json +16 -0
  21. config/profiles/global.json +33 -0
  22. config/profiles/software_developer.json +23 -0
  23. config/router_content.json +137 -0
  24. config/semantic_graph.json +66 -0
  25. config/workflows/ado_release_flow.json +38 -0
  26. config/workflows/docs-update.json +33 -0
  27. config/workflows/governance-check.yaml +26 -0
  28. config/workflows/guidelines-sync.json +40 -0
  29. config/workflows/higpertext-build.json +73 -0
  30. config/workflows/higpertext-plan.json +38 -0
  31. config/workflows/higpertext-review.json +41 -0
  32. config/workflows/pr-quality-check.json +56 -0
  33. config/workflows/quality-remediation.json +57 -0
  34. higpertext/__init__.py +18 -0
  35. higpertext/adapters/__init__.py +27 -0
  36. higpertext/adapters/adapter_utils.py +604 -0
  37. higpertext/adapters/claude_adapter/__init__.py +0 -0
  38. higpertext/adapters/claude_adapter/claude_adapter.py +154 -0
  39. higpertext/adapters/copilot_adapter/__init__.py +0 -0
  40. higpertext/adapters/copilot_adapter/copilot_adapter.py +231 -0
  41. higpertext/adapters/gemini_adapter/__init__.py +0 -0
  42. higpertext/adapters/gemini_adapter/gemini_adapter.py +211 -0
  43. higpertext/adapters/llm_formatter.py +46 -0
  44. higpertext/adapters/open_code_adapter/__init__.py +0 -0
  45. higpertext/adapters/open_code_adapter/open_code_adapter.py +480 -0
  46. higpertext/capabilities/capabilities_runner.py +216 -0
  47. higpertext/capabilities/common/agent-builder.json +54 -0
  48. higpertext/capabilities/common/agent-sync.json +34 -0
  49. higpertext/capabilities/common/code-skeletonizer.json +35 -0
  50. higpertext/capabilities/common/commit-report.json +42 -0
  51. higpertext/capabilities/common/context-assembler.json +37 -0
  52. higpertext/capabilities/common/context-budget-report.json +15 -0
  53. higpertext/capabilities/common/dep-manager.json +43 -0
  54. higpertext/capabilities/common/docs-sync.json +14 -0
  55. higpertext/capabilities/common/doctor.json +18 -0
  56. higpertext/capabilities/common/efficiency-meter.json +31 -0
  57. higpertext/capabilities/common/env-catalog.json +13 -0
  58. higpertext/capabilities/common/env-clean.json +14 -0
  59. higpertext/capabilities/common/env-logs.json +16 -0
  60. higpertext/capabilities/common/env-runner.json +23 -0
  61. higpertext/capabilities/common/env-status.json +13 -0
  62. higpertext/capabilities/common/env-stop.json +14 -0
  63. higpertext/capabilities/common/env-template.json +14 -0
  64. higpertext/capabilities/common/error-context-locator.json +23 -0
  65. higpertext/capabilities/common/eval-agent.json +33 -0
  66. higpertext/capabilities/common/file-map.json +17 -0
  67. higpertext/capabilities/common/governance-exception.json +54 -0
  68. higpertext/capabilities/common/graph-query.json +59 -0
  69. higpertext/capabilities/common/graph-rebuild.json +31 -0
  70. higpertext/capabilities/common/graph-visualize.json +37 -0
  71. higpertext/capabilities/common/grep-search.json +176 -0
  72. higpertext/capabilities/common/higpertext-tester.json +25 -0
  73. higpertext/capabilities/common/hook-health.json +19 -0
  74. higpertext/capabilities/common/hook-sync-check.json +19 -0
  75. higpertext/capabilities/common/hooks-manager.json +55 -0
  76. higpertext/capabilities/common/knowledge-asker.json +27 -0
  77. higpertext/capabilities/common/list-rules.json +27 -0
  78. higpertext/capabilities/common/llm-invoke.json +59 -0
  79. higpertext/capabilities/common/load-rules.json +37 -0
  80. higpertext/capabilities/common/memory-manager.json +65 -0
  81. higpertext/capabilities/common/quality-scan.json +21 -0
  82. higpertext/capabilities/common/quality-updater.json +35 -0
  83. higpertext/capabilities/common/rag-index.json +17 -0
  84. higpertext/capabilities/common/report-viewer.json +24 -0
  85. higpertext/capabilities/common/roadmap-report.json +37 -0
  86. higpertext/capabilities/common/scripts/_env_cli.py +65 -0
  87. higpertext/capabilities/common/scripts/agent_builder.py +60 -0
  88. higpertext/capabilities/common/scripts/agent_sync.py +56 -0
  89. higpertext/capabilities/common/scripts/ask_higpertext.py +38 -0
  90. higpertext/capabilities/common/scripts/code_skeletonizer.py +225 -0
  91. higpertext/capabilities/common/scripts/commit_report.py +134 -0
  92. higpertext/capabilities/common/scripts/context_assembler.py +70 -0
  93. higpertext/capabilities/common/scripts/context_budget_report.py +53 -0
  94. higpertext/capabilities/common/scripts/dep_manager.py +81 -0
  95. higpertext/capabilities/common/scripts/docs_sync.py +981 -0
  96. higpertext/capabilities/common/scripts/doctor.py +144 -0
  97. higpertext/capabilities/common/scripts/efficiency_meter.py +83 -0
  98. higpertext/capabilities/common/scripts/env_catalog.py +47 -0
  99. higpertext/capabilities/common/scripts/env_clean.py +30 -0
  100. higpertext/capabilities/common/scripts/env_logs.py +32 -0
  101. higpertext/capabilities/common/scripts/env_runner.py +53 -0
  102. higpertext/capabilities/common/scripts/env_status.py +38 -0
  103. higpertext/capabilities/common/scripts/env_stop.py +30 -0
  104. higpertext/capabilities/common/scripts/env_template.py +73 -0
  105. higpertext/capabilities/common/scripts/error_context_locator.py +138 -0
  106. higpertext/capabilities/common/scripts/eval_agent.py +80 -0
  107. higpertext/capabilities/common/scripts/file_map.py +95 -0
  108. higpertext/capabilities/common/scripts/governance_exception.py +116 -0
  109. higpertext/capabilities/common/scripts/graph_query.py +104 -0
  110. higpertext/capabilities/common/scripts/graph_rebuild.py +107 -0
  111. higpertext/capabilities/common/scripts/graph_visualize.py +76 -0
  112. higpertext/capabilities/common/scripts/grep_search.py +648 -0
  113. higpertext/capabilities/common/scripts/higpertext_tester.py +102 -0
  114. higpertext/capabilities/common/scripts/hook_health.py +149 -0
  115. higpertext/capabilities/common/scripts/hook_sync_check.py +134 -0
  116. higpertext/capabilities/common/scripts/hooks_manager.py +171 -0
  117. higpertext/capabilities/common/scripts/list_rules.py +175 -0
  118. higpertext/capabilities/common/scripts/llm_invoke.py +135 -0
  119. higpertext/capabilities/common/scripts/load_rules.py +379 -0
  120. higpertext/capabilities/common/scripts/memory_manager.py +210 -0
  121. higpertext/capabilities/common/scripts/presentation_engine.py +63 -0
  122. higpertext/capabilities/common/scripts/quality_scan.py +132 -0
  123. higpertext/capabilities/common/scripts/rag_index.py +39 -0
  124. higpertext/capabilities/common/scripts/report_viewer.py +106 -0
  125. higpertext/capabilities/common/scripts/roadmap_report.py +73 -0
  126. higpertext/capabilities/common/scripts/search_router.py +111 -0
  127. higpertext/capabilities/common/scripts/semantic_diff.py +166 -0
  128. higpertext/capabilities/common/scripts/semantic_search.py +43 -0
  129. higpertext/capabilities/common/scripts/session_control.py +136 -0
  130. higpertext/capabilities/common/scripts/smart_read.py +232 -0
  131. higpertext/capabilities/common/scripts/subagent_executor.py +143 -0
  132. higpertext/capabilities/common/scripts/sync_agents.py +353 -0
  133. higpertext/capabilities/common/scripts/task_decomposer.py +78 -0
  134. higpertext/capabilities/common/scripts/telemetry_report.py +36 -0
  135. higpertext/capabilities/common/search-router.json +24 -0
  136. higpertext/capabilities/common/semantic-diff.json +40 -0
  137. higpertext/capabilities/common/semantic-search.json +19 -0
  138. higpertext/capabilities/common/session-clean.json +20 -0
  139. higpertext/capabilities/common/session-start.json +44 -0
  140. higpertext/capabilities/common/smart-read.json +28 -0
  141. higpertext/capabilities/common/subagent-executor.json +25 -0
  142. higpertext/capabilities/common/sync-agents.json +32 -0
  143. higpertext/capabilities/common/task-decomposer.json +37 -0
  144. higpertext/capabilities/common/telemetry-report.json +23 -0
  145. higpertext/capabilities/git/__init__.py +0 -0
  146. higpertext/capabilities/git/committer.json +61 -0
  147. higpertext/capabilities/git/diff.json +33 -0
  148. higpertext/capabilities/git/ls-files.json +44 -0
  149. higpertext/capabilities/git/rm.json +27 -0
  150. higpertext/capabilities/git/scripts/__init__.py +0 -0
  151. higpertext/capabilities/git/scripts/commit_changes.py +1077 -0
  152. higpertext/capabilities/git/scripts/git_diff.py +171 -0
  153. higpertext/capabilities/git/scripts/git_ls_files.py +376 -0
  154. higpertext/capabilities/git/scripts/git_rm.py +62 -0
  155. higpertext/capabilities/security/k8s-auditor.json +33 -0
  156. higpertext/capabilities/security/scripts/k8s_auditor.py +307 -0
  157. higpertext/capabilities/security/scripts/secret_scanner.py +235 -0
  158. higpertext/capabilities/security/secret-scanner.json +32 -0
  159. higpertext/hooks/__init__.py +28 -0
  160. higpertext/hooks/_compat.py +27 -0
  161. higpertext/hooks/hook_tasks/__init__.py +1 -0
  162. higpertext/hooks/hook_tasks/_rules/__init__.py +0 -0
  163. higpertext/hooks/hook_tasks/_rules/bash_rules.py +635 -0
  164. higpertext/hooks/hook_tasks/_rules/context_engine_rule.py +79 -0
  165. higpertext/hooks/hook_tasks/_rules/context_rules.py +199 -0
  166. higpertext/hooks/hook_tasks/_rules/governance_adapter.py +72 -0
  167. higpertext/hooks/hook_tasks/_rules/profile_rules.json +25 -0
  168. higpertext/hooks/hook_tasks/_rules/quality_rules.py +86 -0
  169. higpertext/hooks/hook_tasks/_rules/security_rules.py +214 -0
  170. higpertext/hooks/hook_tasks/_rules/session_rules.py +316 -0
  171. higpertext/hooks/hook_tasks/_rules/telemetry_rules.py +121 -0
  172. higpertext/hooks/hook_tasks/audit_logger_hook.py +28 -0
  173. higpertext/hooks/hook_tasks/hook_bash_guard.py +101 -0
  174. higpertext/hooks/hook_tasks/hook_code_quality.py +48 -0
  175. higpertext/hooks/hook_tasks/hook_context_hint.py +46 -0
  176. higpertext/hooks/hook_tasks/hook_context_manager.py +44 -0
  177. higpertext/hooks/hook_tasks/hook_io.py +122 -0
  178. higpertext/hooks/hook_tasks/hook_loop_guard.py +182 -0
  179. higpertext/hooks/hook_tasks/hook_post_observer.py +54 -0
  180. higpertext/hooks/hook_tasks/hook_read_guard.py +85 -0
  181. higpertext/hooks/hook_tasks/hook_security_guard.py +81 -0
  182. higpertext/hooks/hook_tasks/hook_session_prompt.py +83 -0
  183. higpertext/hooks/hook_tasks/hook_session_stop.py +115 -0
  184. higpertext/hooks/hook_tasks/hook_utils.py +144 -0
  185. higpertext/hooks/hook_tasks/session_guard_hook.py +23 -0
  186. higpertext/hooks/hook_tasks/telemetry_utils.py +176 -0
  187. higpertext/hooks/hook_tasks/test_echo_hook.py +33 -0
  188. higpertext/hooks/hook_tasks/webhook_hook.py +54 -0
  189. higpertext/hooks/hook_tasks/workflow_runner_hook.py +49 -0
  190. higpertext/hooks/hooks_catalog.json +116 -0
  191. higpertext/kernel/__init__.py +63 -0
  192. higpertext/kernel/_compat.py +138 -0
  193. higpertext/kernel/app_config.py +117 -0
  194. higpertext/kernel/application/__init__.py +13 -0
  195. higpertext/kernel/application/agent_registry.py +102 -0
  196. higpertext/kernel/application/capability_manager.py +61 -0
  197. higpertext/kernel/application/commit_reporter.py +247 -0
  198. higpertext/kernel/application/context_builder.py +166 -0
  199. higpertext/kernel/application/context_engine.py +409 -0
  200. higpertext/kernel/application/engine.py +41 -0
  201. higpertext/kernel/application/env_runtime.py +174 -0
  202. higpertext/kernel/application/environment_manager.py +154 -0
  203. higpertext/kernel/application/governance.py +192 -0
  204. higpertext/kernel/application/hook_registry.py +102 -0
  205. higpertext/kernel/application/hook_renderer.py +720 -0
  206. higpertext/kernel/application/ports.py +49 -0
  207. higpertext/kernel/application/profile_learner.py +358 -0
  208. higpertext/kernel/application/profile_service.py +205 -0
  209. higpertext/kernel/application/profile_services.py +6 -0
  210. higpertext/kernel/application/profile_use_cases.py +93 -0
  211. higpertext/kernel/application/rag_service.py +75 -0
  212. higpertext/kernel/application/roadmap_reporter.py +178 -0
  213. higpertext/kernel/application/semantic_engine.py +258 -0
  214. higpertext/kernel/application/session_services.py +33 -0
  215. higpertext/kernel/application/skill_hook_compiler.py +85 -0
  216. higpertext/kernel/application/telemetry.py +326 -0
  217. higpertext/kernel/application/workflow_manager.py +176 -0
  218. higpertext/kernel/config_paths.py +66 -0
  219. higpertext/kernel/domain/__init__.py +12 -0
  220. higpertext/kernel/domain/agent_registry.py +23 -0
  221. higpertext/kernel/domain/commit_reporter.py +155 -0
  222. higpertext/kernel/domain/compilers.py +7 -0
  223. higpertext/kernel/domain/context_engine.py +319 -0
  224. higpertext/kernel/domain/entities.py +51 -0
  225. higpertext/kernel/domain/env_runtime.py +62 -0
  226. higpertext/kernel/domain/governance.py +198 -0
  227. higpertext/kernel/domain/hook_models.py +29 -0
  228. higpertext/kernel/domain/profile_learner.py +186 -0
  229. higpertext/kernel/domain/rag.py +70 -0
  230. higpertext/kernel/domain/repositories.py +8 -0
  231. higpertext/kernel/domain/roadmap_reporter.py +80 -0
  232. higpertext/kernel/domain/semantic_engine.py +107 -0
  233. higpertext/kernel/engine.py +42 -0
  234. higpertext/kernel/htx_resolver.py +69 -0
  235. higpertext/kernel/infrastructure/__init__.py +13 -0
  236. higpertext/kernel/infrastructure/agent_registry.py +40 -0
  237. higpertext/kernel/infrastructure/cache/capability_cache.py +319 -0
  238. higpertext/kernel/infrastructure/capability_helper.py +40 -0
  239. higpertext/kernel/infrastructure/cli/__init__.py +1 -0
  240. higpertext/kernel/infrastructure/cli/agent_commands.py +62 -0
  241. higpertext/kernel/infrastructure/cli/arguments.py +39 -0
  242. higpertext/kernel/infrastructure/cli/capability_command_builder.py +86 -0
  243. higpertext/kernel/infrastructure/cli/capability_task_service.py +234 -0
  244. higpertext/kernel/infrastructure/cli/cli_search.py +234 -0
  245. higpertext/kernel/infrastructure/cli/parameter_contracts.py +83 -0
  246. higpertext/kernel/infrastructure/cli/parser_builder.py +122 -0
  247. higpertext/kernel/infrastructure/cli/profile_commands.py +89 -0
  248. higpertext/kernel/infrastructure/cli/roadmap_commands.py +117 -0
  249. higpertext/kernel/infrastructure/cli/router.py +1110 -0
  250. higpertext/kernel/infrastructure/cli/session_commands.py +36 -0
  251. higpertext/kernel/infrastructure/cli/task_commands.py +23 -0
  252. higpertext/kernel/infrastructure/cli/task_result_reporter.py +56 -0
  253. higpertext/kernel/infrastructure/cli/workflow_commands.py +25 -0
  254. higpertext/kernel/infrastructure/compilers/__init__.py +3 -0
  255. higpertext/kernel/infrastructure/compilers/factory.py +27 -0
  256. higpertext/kernel/infrastructure/compilers/graph_compiler.py +20 -0
  257. higpertext/kernel/infrastructure/compilers/guide_compiler.py +50 -0
  258. higpertext/kernel/infrastructure/compilers/hook_compiler.py +69 -0
  259. higpertext/kernel/infrastructure/compilers/playbook_compiler.py +154 -0
  260. higpertext/kernel/infrastructure/context_engine.py +303 -0
  261. higpertext/kernel/infrastructure/database/local_vector_store.py +99 -0
  262. higpertext/kernel/infrastructure/deployment/__init__.py +1 -0
  263. higpertext/kernel/infrastructure/deployment/resource_deployer.py +283 -0
  264. higpertext/kernel/infrastructure/diagnostics/__init__.py +1 -0
  265. higpertext/kernel/infrastructure/diagnostics/health.py +191 -0
  266. higpertext/kernel/infrastructure/env_runtime.py +227 -0
  267. higpertext/kernel/infrastructure/execution/__init__.py +1 -0
  268. higpertext/kernel/infrastructure/execution/parallel.py +188 -0
  269. higpertext/kernel/infrastructure/execution/resilience.py +155 -0
  270. higpertext/kernel/infrastructure/file_repositories.py +213 -0
  271. higpertext/kernel/infrastructure/governance.py +198 -0
  272. higpertext/kernel/infrastructure/hook_config_loader.py +53 -0
  273. higpertext/kernel/infrastructure/hook_webhook_dispatcher.py +61 -0
  274. higpertext/kernel/infrastructure/hook_workflow_bridge.py +60 -0
  275. higpertext/kernel/infrastructure/llm/__init__.py +6 -0
  276. higpertext/kernel/infrastructure/llm/provider.py +46 -0
  277. higpertext/kernel/infrastructure/llm/providers/__init__.py +0 -0
  278. higpertext/kernel/infrastructure/llm/providers/anthropic_provider.py +94 -0
  279. higpertext/kernel/infrastructure/llm/providers/gemini_embeddings.py +74 -0
  280. higpertext/kernel/infrastructure/llm/providers/gemini_provider.py +101 -0
  281. higpertext/kernel/infrastructure/llm/providers/ollama_provider.py +110 -0
  282. higpertext/kernel/infrastructure/llm/providers/openai_provider.py +98 -0
  283. higpertext/kernel/infrastructure/llm/registry.py +81 -0
  284. higpertext/kernel/infrastructure/logger.py +303 -0
  285. higpertext/kernel/infrastructure/output_store.py +70 -0
  286. higpertext/kernel/infrastructure/parser/__init__.py +1 -0
  287. higpertext/kernel/infrastructure/parser/code_chunker.py +144 -0
  288. higpertext/kernel/infrastructure/parser/language/__init__.py +14 -0
  289. higpertext/kernel/infrastructure/parser/language/base.py +41 -0
  290. higpertext/kernel/infrastructure/parser/language/powershell_parser.py +35 -0
  291. higpertext/kernel/infrastructure/parser/language/python_parser.py +98 -0
  292. higpertext/kernel/infrastructure/parser/language/typescript_parser.py +91 -0
  293. higpertext/kernel/infrastructure/parser/semantic_graph.py +409 -0
  294. higpertext/kernel/infrastructure/presentation/__init__.py +1 -0
  295. higpertext/kernel/infrastructure/presentation/html_renderer.py +137 -0
  296. higpertext/kernel/infrastructure/presentation/markdown_renderer.py +84 -0
  297. higpertext/kernel/infrastructure/presentation/markdown_report_renderer.py +97 -0
  298. higpertext/kernel/infrastructure/profile_store.py +28 -0
  299. higpertext/kernel/infrastructure/semantic_engine.py +289 -0
  300. higpertext/kernel/infrastructure/telemetry_reporter.py +132 -0
  301. higpertext/kernel/infrastructure/validation/__init__.py +1 -0
  302. higpertext/kernel/infrastructure/validation/contract_validator.py +163 -0
  303. higpertext/kernel/pkg_resources.py +38 -0
  304. higpertext/kernel/session_manager.py +319 -0
  305. higpertext/templates/env/generic-shell.yaml +21 -0
  306. higpertext/templates/env/node-vitest.yaml +27 -0
  307. higpertext/templates/env/python-pytest.yaml +29 -0
  308. higpertext/templates/html/commit_body.html +20 -0
  309. higpertext/templates/html/commit_diff.html +4 -0
  310. higpertext/templates/html/commit_index.html +29 -0
  311. higpertext/templates/html/commit_layer.html +11 -0
  312. higpertext/templates/html/commit_shell.html +28 -0
  313. higpertext/templates/html/graph_visualize.html +86 -0
  314. higpertext/templates/html/roadmap_body.html +12 -0
  315. higpertext/templates/html/roadmap_phase.html +5 -0
  316. higpertext/templates/html/roadmap_shell.html +29 -0
  317. higpertext/templates/markdown/commit_report.md +18 -0
  318. higpertext/templates/markdown/efficiency_report.md +12 -0
  319. higpertext/templates/markdown/roadmap_report.md +25 -0
  320. higpertext/templates/skills/best-practices.md +7 -0
  321. higpertext/templates/skills/clean-code.md +8 -0
  322. higpertext/templates/skills/ddd-standards.md +7 -0
  323. higpertext/templates/skills/tdd-practices.md +7 -0
  324. higpertext/templates/subagents/architect.md +7 -0
  325. higpertext/templates/subagents/test-engineer.md +7 -0
  326. higpertext/templates/workflows/build.json +23 -0
  327. higpertext/templates/workflows/compact.json +21 -0
  328. higpertext/templates/workflows/plan.json +59 -0
  329. higpertext/templates/workflows/review.json +26 -0
  330. higpertext/templates/workflows/spec.json +27 -0
  331. higpertext_cli-0.8.0.dist-info/METADATA +35 -0
  332. higpertext_cli-0.8.0.dist-info/RECORD +335 -0
  333. higpertext_cli-0.8.0.dist-info/WHEEL +5 -0
  334. higpertext_cli-0.8.0.dist-info/entry_points.txt +2 -0
  335. higpertext_cli-0.8.0.dist-info/top_level.txt +2 -0
@@ -0,0 +1,154 @@
1
+ """
2
+ higpertext Module — Auto-generated Documentation
3
+ """
4
+
5
+ from pathlib import Path
6
+ from higpertext.adapters.adapter_utils import (
7
+ HTX_CMD,
8
+ HTX_WORKFLOW_CMD,
9
+ load_session,
10
+ guidelines_lines,
11
+ session_lines,
12
+ capabilities_section,
13
+ workflows_section,
14
+ delegation_rule_lines,
15
+ workflow_trigger_lines,
16
+ project_refs_lines,
17
+ loop_guard_lines,
18
+ reasoning_style_lines,
19
+ )
20
+ from higpertext.kernel.app_config import ADAPTERS_CONFIG
21
+ _CFG = ADAPTERS_CONFIG["claude"]
22
+
23
+
24
+ def _header_lines(agent_name: str, profile: dict) -> list:
25
+ return [
26
+ line.format(
27
+ agent_name=agent_name,
28
+ agent_name_upper=agent_name.upper(),
29
+ system_prompt=profile["system_prompt"],
30
+ htx_cmd=HTX_CMD,
31
+ )
32
+ for line in _CFG["header_lines"]
33
+ ]
34
+
35
+
36
+ def _pair_programming_lines() -> list:
37
+ return list(_CFG["pair_programming_lines"])
38
+
39
+
40
+ def _behavior_lines(profile: dict) -> list:
41
+ behavior = list(_CFG["behavior_lines"])
42
+ if profile.get("governance_access"):
43
+ behavior.append(_CFG["behavior_governance_line"])
44
+ return behavior + [""]
45
+
46
+
47
+ def _execution_protocol_lines() -> list:
48
+ base_lines = [
49
+ line.format(htx_cmd=HTX_CMD)
50
+ for line in _CFG["execution_protocol_lines"]
51
+ ]
52
+ return base_lines + delegation_rule_lines()
53
+
54
+
55
+ def _token_rules_lines() -> list:
56
+ return list(_CFG["token_rules_lines"])
57
+
58
+
59
+ def _claude_md_index(agent_name: str) -> str:
60
+ """Genera un CLAUDE.md liviano que apunta al rules file como fuente de verdad.
61
+
62
+ Claude Code carga .claude/rules/*.md con prioridad; CLAUDE.md duplicar ese
63
+ contenido infla el contexto ~30KB por turno sin aportar información nueva.
64
+ """
65
+ return "\n".join(
66
+ [
67
+ line.format(
68
+ agent_name=agent_name,
69
+ htx_cmd=HTX_CMD,
70
+ htx_workflow_cmd=HTX_WORKFLOW_CMD,
71
+ )
72
+ for line in _CFG["claude_md_index"]
73
+ ]
74
+ )
75
+
76
+
77
+ def _write_outputs(target_dir: Path, agent_name: str, content: str) -> Path:
78
+ agents_file = target_dir / "AGENTS.md"
79
+ agents_file.write_text(content, encoding="utf-8")
80
+ # CLAUDE.md es un índice liviano; el contenido completo vive en .claude/rules/
81
+ (target_dir / "CLAUDE.md").write_text(_claude_md_index(agent_name), encoding="utf-8")
82
+ (target_dir / ".clauderules").write_text(content, encoding="utf-8")
83
+ try:
84
+ ag_dir = target_dir / ".agents" / "rules"
85
+ ag_dir.mkdir(parents=True, exist_ok=True)
86
+ (ag_dir / "higpertext_rules.md").write_text(content, encoding="utf-8")
87
+ except OSError: # nosec B110
88
+ pass
89
+ try:
90
+ cr_dir = target_dir / ".claude" / "rules"
91
+ if cr_dir.exists():
92
+ for f in cr_dir.glob("*.md"):
93
+ try:
94
+ f.unlink()
95
+ except OSError: # nosec B110
96
+ pass
97
+ cr_dir.mkdir(parents=True, exist_ok=True)
98
+ (cr_dir / f"{agent_name}.md").write_text(content, encoding="utf-8")
99
+ except OSError: # nosec B110
100
+ pass
101
+ return target_dir / ".claude" / "rules" / f"{agent_name}.md"
102
+
103
+
104
+ class ClaudeAdapter:
105
+ """Genera .clauderules para Claude Code basado en el contexto del higpertext Engine."""
106
+
107
+ @staticmethod
108
+ def generate_rules(context: dict, target_dir: Path) -> Path:
109
+ profile = context["profile"]
110
+ agent_name = profile["name"]
111
+ capabilities = context["active_capabilities"]
112
+ workflows = context.get("active_workflows", [])
113
+
114
+ lines = []
115
+ lines += _header_lines(agent_name, profile)
116
+ lines += _pair_programming_lines()
117
+ lines += _behavior_lines(profile)
118
+
119
+ guide_lines = guidelines_lines(Path(__file__))
120
+ if guide_lines:
121
+ lines += ["## Lineamientos activos de gobernanza", ""]
122
+ lines += [
123
+ "Estas reglas son de cumplimiento obligatorio en todo el desarrollo:",
124
+ "",
125
+ ]
126
+ lines += guide_lines
127
+ lines += ["---", ""]
128
+
129
+ lines += loop_guard_lines()
130
+ lines += reasoning_style_lines()
131
+ lines += _execution_protocol_lines()
132
+ lines += workflow_trigger_lines(workflows)
133
+ lines += _token_rules_lines()
134
+ lines += project_refs_lines(
135
+ target_dir,
136
+ header=(
137
+ "## REFERENCIAS DEL PROYECTO\n\n"
138
+ "Estos archivos de referencia están disponibles en el espacio de trabajo."
139
+ " **NO leas el archivo de memoria context.md en su totalidad en cada turno**;"
140
+ " en su lugar, consulta las memorias y la gobernanza dinámicamente usando"
141
+ " `common.knowledge-asker` para buscar entradas relevantes."
142
+ ),
143
+ )
144
+
145
+ session = load_session(target_dir)
146
+ lines += session_lines(session, target_dir, ".claude/skills")
147
+
148
+ lines += capabilities_section(capabilities)
149
+ lines += workflows_section(workflows)
150
+ lines.append(
151
+ "*higpertext Engine v5.0 — configuración auto-generada. No editar manualmente.*"
152
+ )
153
+
154
+ return _write_outputs(target_dir, agent_name, "\n".join(lines))
File without changes
@@ -0,0 +1,231 @@
1
+ """higpertext Copilot Adapter — genera configuración nativa para GitHub Copilot."""
2
+
3
+ from pathlib import Path
4
+ from higpertext.adapters.adapter_utils import (
5
+ HTX_CMD,
6
+ HTX_WORKFLOW_CMD,
7
+ load_session,
8
+ session_lines,
9
+ capabilities_section,
10
+ workflows_section,
11
+ delegation_rule_lines,
12
+ loop_guard_lines,
13
+ reasoning_style_lines,
14
+ )
15
+ from higpertext.kernel.app_config import ADAPTERS_CONFIG
16
+ _CFG = ADAPTERS_CONFIG["copilot"]
17
+
18
+
19
+ def _build_copilot_instructions_md(profile: dict, capabilities: list, workflows: list) -> str:
20
+ gov_text = _CFG["governance_enabled"] if profile.get("governance_access") else _CFG["governance_disabled"]
21
+ lines = [
22
+ line.format(
23
+ description=profile["description"],
24
+ system_prompt=profile["system_prompt"],
25
+ governance_access_text=gov_text,
26
+ htx_cmd=HTX_CMD,
27
+ htx_workflow_cmd=HTX_WORKFLOW_CMD,
28
+ )
29
+ for line in _CFG["working_rules_header"]
30
+ ]
31
+
32
+ lines += loop_guard_lines()
33
+ lines += reasoning_style_lines()
34
+ lines += delegation_rule_lines()
35
+ lines += capabilities_section(capabilities)
36
+ lines += workflows_section(workflows)
37
+ lines.append("*higpertext Engine v5.0 — auto-generated. Do not edit manually.*")
38
+ return "\n".join(lines)
39
+
40
+
41
+ # ---------------------------------------------------------------------------
42
+ # .github/rules/{name}.md — reglas extraídas por workflow
43
+ # ---------------------------------------------------------------------------
44
+
45
+
46
+ def _build_workflow_rules_md(wf: dict) -> str:
47
+ """Genera .github/rules/{name}.md con las reglas Do/Do not del workflow."""
48
+ wf_name = wf["id"].split(".")[-1]
49
+ lines = [
50
+ line.format(
51
+ wf_name=wf_name,
52
+ wf_description=wf.get("description", ""),
53
+ )
54
+ for line in _CFG["workflow_rules_header"]
55
+ ]
56
+ if wf.get("do"):
57
+ lines += ["## Do", ""]
58
+ for item in wf["do"]:
59
+ lines.append(f"- {item}")
60
+ lines.append("")
61
+ if wf.get("do_not"):
62
+ lines += ["## Do not", ""]
63
+ for item in wf["do_not"]:
64
+ lines.append(f"- {item}")
65
+ lines.append("")
66
+ lines.append("*higpertext Engine v5.0 — auto-generated.*")
67
+ return "\n".join(lines)
68
+
69
+
70
+ # ---------------------------------------------------------------------------
71
+ # .github/agents/{name}.md — agentes Copilot por workflow
72
+ # ---------------------------------------------------------------------------
73
+
74
+
75
+ def _build_workflow_agents_md(workflows: list) -> list[tuple[str, str]]:
76
+ """Genera .github/agents/{name}.md como agente Copilot por workflow activo.
77
+
78
+ Retorna lista de (filename, content).
79
+ """
80
+ files: list[tuple[str, str]] = []
81
+ for wf in workflows:
82
+ wf_name = wf["id"].split(".")[-1]
83
+ temperature = wf.get("temperature", 0.1)
84
+ allow_edit = "allow" if wf.get("allow_edit", False) else "deny"
85
+ allow_bash = "allow" if wf.get("allow_bash", False) else "deny"
86
+ when_to_use = wf.get("when_to_use", [wf.get("description", "")])
87
+
88
+ lines = [
89
+ line.format(
90
+ description=wf.get("description", ""),
91
+ temperature=temperature,
92
+ allow_edit=allow_edit,
93
+ allow_bash=allow_bash,
94
+ )
95
+ for line in _CFG["workflow_agents_header"]
96
+ ]
97
+ for item in (when_to_use if isinstance(when_to_use, list) else [when_to_use]):
98
+ lines.append(f"- {item}")
99
+
100
+ footer = [
101
+ line.format(wf_name=wf_name)
102
+ for line in _CFG["workflow_agents_footer"]
103
+ ]
104
+ lines += footer
105
+ files.append((f"{wf_name}.md", "\n".join(lines)))
106
+ return files
107
+
108
+
109
+ # ---------------------------------------------------------------------------
110
+ # .github/instructions/*.instructions.md
111
+ # ---------------------------------------------------------------------------
112
+
113
+
114
+ def _build_instructions_md(profile: dict, capabilities: list, workflows: list) -> list[tuple[str, str]]:
115
+ """Genera archivos .instructions.md por dominio de capabilities/workflows.
116
+
117
+ Retorna lista de (filename, content) para escribir en .github/instructions/.
118
+ """
119
+ files: list[tuple[str, str]] = []
120
+
121
+ for wf in workflows:
122
+ wf_name = wf["id"].split(".")[-1]
123
+ content = "\n".join(
124
+ [
125
+ line.format(
126
+ wf_name=wf_name,
127
+ wf_description=wf["description"],
128
+ htx_workflow_cmd=HTX_WORKFLOW_CMD,
129
+ )
130
+ for line in _CFG["instructions_template"]
131
+ ]
132
+ )
133
+ files.append((f"{wf_name}.instructions.md", content))
134
+
135
+ return files
136
+
137
+
138
+ # ---------------------------------------------------------------------------
139
+ # .github/skills/<name>/SKILL.md (misma lógica que otros adapters)
140
+ # ---------------------------------------------------------------------------
141
+
142
+
143
+ def _session_skills_subdir() -> str:
144
+ return ".github/skills"
145
+
146
+
147
+ # ---------------------------------------------------------------------------
148
+ # AGENTS.md (índice liviano — mismo patrón que OpenCode)
149
+ # ---------------------------------------------------------------------------
150
+
151
+
152
+ def _build_agents_md_index(profile: dict) -> str:
153
+ agent_name = profile["name"]
154
+ return "\n".join(
155
+ [
156
+ line.format(
157
+ agent_name=agent_name,
158
+ agent_name_upper=agent_name.upper(),
159
+ description=profile["description"],
160
+ htx_cmd=HTX_CMD,
161
+ htx_workflow_cmd=HTX_WORKFLOW_CMD,
162
+ )
163
+ for line in _CFG["agents_md_index"]
164
+ ]
165
+ )
166
+
167
+
168
+ # ---------------------------------------------------------------------------
169
+ # Adapter principal
170
+ # ---------------------------------------------------------------------------
171
+
172
+
173
+ class CopilotAdapter:
174
+ """Genera configuración nativa para GitHub Copilot basada en el perfil higpertext.
175
+
176
+ Estructura generada:
177
+ .github/
178
+ copilot-instructions.md
179
+ agents/
180
+ {name}.md ← agente Copilot por workflow activo
181
+ rules/
182
+ {name}.md ← reglas Do/Do not por workflow
183
+ instructions/
184
+ *.instructions.md ← índice de workflow por capability
185
+ copilot/
186
+ hooks/ ← scripts de hook por evento
187
+ AGENTS.md ← índice liviano
188
+ """
189
+
190
+ @staticmethod
191
+ def generate_rules(context: dict, project_root: Path) -> Path:
192
+ profile = context["profile"]
193
+ capabilities = context["active_capabilities"]
194
+ workflows = context.get("active_workflows", [])
195
+
196
+ github_dir = project_root / ".github"
197
+ github_dir.mkdir(exist_ok=True)
198
+
199
+ # ── 1. copilot-instructions.md ────────────────────────────────────────
200
+ instructions_content = _build_copilot_instructions_md(profile, capabilities, workflows)
201
+ instructions_file = github_dir / "copilot-instructions.md"
202
+ instructions_file.write_text(instructions_content, encoding="utf-8")
203
+
204
+ # ── 2. .github/agents/{name}.md ──────────────────────────────────────
205
+ agents_dir = github_dir / "agents"
206
+ agents_dir.mkdir(exist_ok=True)
207
+ for filename, content in _build_workflow_agents_md(workflows):
208
+ (agents_dir / filename).write_text(content, encoding="utf-8")
209
+
210
+ # ── 3. .github/rules/{name}.md ───────────────────────────────────────
211
+ rules_dir = github_dir / "rules"
212
+ rules_dir.mkdir(exist_ok=True)
213
+ for wf in workflows:
214
+ wf_name = wf["id"].split(".")[-1]
215
+ (rules_dir / f"{wf_name}.md").write_text(_build_workflow_rules_md(wf), encoding="utf-8")
216
+
217
+ # ── 4. .github/instructions/*.instructions.md ─────────────────────────
218
+ instr_dir = github_dir / "instructions"
219
+ instr_dir.mkdir(exist_ok=True)
220
+ for filename, content in _build_instructions_md(profile, capabilities, workflows):
221
+ (instr_dir / filename).write_text(content, encoding="utf-8")
222
+
223
+ # ── 5. AGENTS.md liviano en raíz ─────────────────────────────────────
224
+ agents_file = project_root / "AGENTS.md"
225
+ agents_file.write_text(_build_agents_md_index(profile), encoding="utf-8")
226
+
227
+ # ── 6. Sesión activa: skills ──────────────────────────────────────────
228
+ session = load_session(project_root)
229
+ _ = session_lines(session, project_root, _session_skills_subdir())
230
+
231
+ return instructions_file
File without changes
@@ -0,0 +1,211 @@
1
+ """higpertext Gemini Adapter — genera GEMINI.md para Google Gemini CLI."""
2
+
3
+ from pathlib import Path
4
+ from higpertext.adapters.adapter_utils import (
5
+ HTX_CMD,
6
+ load_session,
7
+ guidelines_lines,
8
+ session_lines,
9
+ capabilities_section,
10
+ workflows_section,
11
+ delegation_rule_lines,
12
+ workflow_trigger_lines,
13
+ hooks_section,
14
+ operational_lines,
15
+ project_refs_lines,
16
+ loop_guard_lines,
17
+ reasoning_style_lines,
18
+ )
19
+ from higpertext.kernel.app_config import ADAPTERS_CONFIG
20
+ _CFG = ADAPTERS_CONFIG["gemini"]
21
+
22
+
23
+ def _header_lines(agent_name: str, profile: dict) -> list:
24
+ governance_text = _CFG["governance_access_enabled"] if profile.get("governance_access") else _CFG["governance_access_disabled"]
25
+ return [
26
+ line.format(
27
+ re_generate_cmd="htx profile load <profile> --assistant gemini",
28
+ title_prefix="Gemini",
29
+ agent_name_upper=agent_name.upper(),
30
+ description=profile["description"],
31
+ system_prompt=profile["system_prompt"],
32
+ governance_access_text=governance_text,
33
+ htx_cmd=HTX_CMD,
34
+ )
35
+ for line in _CFG["header_lines"]
36
+ ]
37
+
38
+
39
+ class GeminiAdapter:
40
+ """Genera archivos GEMINI.md y AGENTS.md para Google Gemini y Antigravity CLI
41
+ basados en el contexto del higpertext Engine."""
42
+
43
+ @staticmethod
44
+ def generate_rules(context: dict, target_dir: Path) -> Path:
45
+ profile = context["profile"]
46
+ agent_name = profile["name"]
47
+ capabilities = context["active_capabilities"]
48
+ workflows = context.get("active_workflows", [])
49
+
50
+ def build_rule_content(
51
+ assistant_type: str,
52
+ session_skills_dir: str,
53
+ title_prefix: str,
54
+ load_cmd: str,
55
+ ) -> str:
56
+ governance_text = _CFG["governance_access_enabled"] if profile.get("governance_access") else _CFG["governance_access_disabled"]
57
+ lines = [
58
+ line.format(
59
+ re_generate_cmd=load_cmd,
60
+ title_prefix=title_prefix,
61
+ agent_name_upper=agent_name.upper(),
62
+ description=profile["description"],
63
+ system_prompt=profile["system_prompt"],
64
+ governance_access_text=governance_text,
65
+ htx_cmd=HTX_CMD,
66
+ )
67
+ for line in _CFG["header_lines"]
68
+ ]
69
+ guide_lines = guidelines_lines(Path(__file__))
70
+ if guide_lines:
71
+ lines += ["## ACTIVE GOVERNANCE GUIDELINES", ""]
72
+ lines += [
73
+ "These rules are MANDATORY across all development activities:",
74
+ "",
75
+ ]
76
+ lines += guide_lines
77
+ lines += ["---", ""]
78
+
79
+ lines += delegation_rule_lines(
80
+ title=_CFG["delegation_title"],
81
+ mandate=_CFG["delegation_mandate"],
82
+ hint=_CFG["delegation_hint"],
83
+ )
84
+ lines += workflow_trigger_lines(
85
+ workflows,
86
+ title=_CFG["workflow_trigger_title"],
87
+ mandate=_CFG["workflow_trigger_mandate"],
88
+ hint=_CFG["workflow_trigger_hint"],
89
+ )
90
+ lines += loop_guard_lines()
91
+ lines += reasoning_style_lines()
92
+
93
+ steps = [s.format(htx_cmd=HTX_CMD) for s in _CFG["operational_steps"]]
94
+ token_rules = list(_CFG["token_rules"])
95
+ lines += operational_lines(
96
+ title=_CFG["operational_title"],
97
+ steps=steps,
98
+ token_rules_title=_CFG["token_rules_title"],
99
+ token_rules=token_rules,
100
+ )
101
+ lines += project_refs_lines(
102
+ target_dir,
103
+ header=_CFG["project_refs_header"],
104
+ )
105
+ lines += hooks_section(target_dir, assistant_type, agent_name)
106
+ session = load_session(target_dir)
107
+ lines += session_lines(session, target_dir, session_skills_dir)
108
+ lines += capabilities_section(capabilities, label="## AVAILABLE CAPABILITIES")
109
+ lines += workflows_section(workflows, label="## AVAILABLE WORKFLOWS (PLAYBOOKS)")
110
+ lines.append(
111
+ "*higpertext Engine v5.0 — auto-generated agent configuration."
112
+ " Do not edit manually.*"
113
+ )
114
+ return "\n".join(lines)
115
+
116
+ # 1. Generate rules for Gemini (GEMINI.md)
117
+ gemini_content = build_rule_content(
118
+ "gemini",
119
+ ".gemini/skills",
120
+ "Gemini",
121
+ "htx profile load <profile> --assistant gemini",
122
+ )
123
+ gemini_file = target_dir / "GEMINI.md"
124
+ gemini_file.write_text(gemini_content, encoding="utf-8")
125
+
126
+ # 2. Generate rules for Antigravity (AGENTS.md)
127
+ antigravity_content = build_rule_content(
128
+ "antigravity",
129
+ ".agents/skills",
130
+ "Antigravity",
131
+ "htx profile load <profile> --assistant antigravity",
132
+ )
133
+ agents_file = target_dir / "AGENTS.md"
134
+ agents_file.write_text(antigravity_content, encoding="utf-8")
135
+
136
+ # Save to .agents/rules/higpertext_rules.md too
137
+ try:
138
+ ag_dir = target_dir / ".agents" / "rules"
139
+ ag_dir.mkdir(parents=True, exist_ok=True)
140
+ (ag_dir / "higpertext_rules.md").write_text(antigravity_content, encoding="utf-8")
141
+ except OSError: # nosec B110
142
+ pass
143
+
144
+ _GEMINI_DIR = ".gemini"
145
+
146
+ # 3. Create both .gemini/ and .agents/ subdirectories to be ready
147
+ for subdir in ["workflows", "skills", "subagents"]:
148
+ (target_dir / _GEMINI_DIR / subdir).mkdir(parents=True, exist_ok=True)
149
+ (target_dir / ".agents" / subdir).mkdir(parents=True, exist_ok=True)
150
+
151
+ # 4. Mirror dynamic workflows, skills, and subagents between both platforms
152
+ def _mirror_dirs(src_dir: Path, dest_dir: Path):
153
+ if not src_dir.exists():
154
+ return
155
+ dest_dir.mkdir(parents=True, exist_ok=True)
156
+ import shutil
157
+
158
+ for item in src_dir.iterdir():
159
+ if item.is_file():
160
+ shutil.copy2(item, dest_dir / item.name)
161
+ elif item.is_dir():
162
+ _mirror_dirs(item, dest_dir / item.name)
163
+
164
+ # Mirror workflows both ways
165
+ _mirror_dirs(target_dir / _GEMINI_DIR / "workflows", target_dir / ".agents" / "workflows")
166
+ _mirror_dirs(target_dir / ".agents" / "workflows", target_dir / _GEMINI_DIR / "workflows")
167
+
168
+ # Convert workflows to skills to enable slash commands detection
169
+ def _workflows_to_skills(workflows_dir: Path, skills_dir: Path):
170
+ if not workflows_dir.exists():
171
+ return
172
+ skills_dir.mkdir(parents=True, exist_ok=True)
173
+ for item in workflows_dir.iterdir():
174
+ if item.is_file() and item.suffix == ".md":
175
+ name = item.stem
176
+ dest_skill_dir = skills_dir / name
177
+ dest_skill_dir.mkdir(parents=True, exist_ok=True)
178
+ try:
179
+ content = item.read_text(encoding="utf-8")
180
+ if content.startswith("---"):
181
+ parts = content.split("---", 2)
182
+ if len(parts) >= 3:
183
+ frontmatter = parts[1]
184
+ body = parts[2]
185
+ if "name:" not in frontmatter:
186
+ frontmatter = f"\nname: {name}" + frontmatter
187
+ content = f"---{frontmatter}---{body}"
188
+ else:
189
+ content = f"---\nname: {name}\n---\n\n" + content
190
+ (dest_skill_dir / "SKILL.md").write_text(content, encoding="utf-8")
191
+ except OSError: # nosec B110
192
+ pass
193
+
194
+ _workflows_to_skills(
195
+ target_dir / _GEMINI_DIR / "workflows", target_dir / _GEMINI_DIR / "skills"
196
+ )
197
+ _workflows_to_skills(
198
+ target_dir / ".agents" / "workflows", target_dir / ".agents" / "skills"
199
+ )
200
+
201
+ # Mirror skills and subagents both ways
202
+ _mirror_dirs(target_dir / _GEMINI_DIR / "skills", target_dir / ".agents" / "skills")
203
+ _mirror_dirs(target_dir / ".agents" / "skills", target_dir / _GEMINI_DIR / "skills")
204
+ _mirror_dirs(target_dir / _GEMINI_DIR / "subagents", target_dir / ".agents" / "subagents")
205
+ _mirror_dirs(target_dir / ".agents" / "subagents", target_dir / _GEMINI_DIR / "subagents")
206
+
207
+ return gemini_file
208
+
209
+ @staticmethod
210
+ def on_init(context: dict, target_dir: Path) -> None:
211
+ GeminiAdapter.generate_rules(context, target_dir)
@@ -0,0 +1,46 @@
1
+ class LLMFormatter:
2
+ """
3
+ Convierte el contexto del higpertext Engine (Perfiles y Capacidades)
4
+ al formato nativo de Function Calling / Tool Use de las APIs de LLMs.
5
+ """
6
+
7
+ @staticmethod
8
+ def to_openai_tools(higpertext_context: dict) -> list:
9
+ """Convierte las capacidades activas al formato OpenAI/Gemini Tools."""
10
+ tools = []
11
+ for cap in higpertext_context.get("active_capabilities", []):
12
+ tool = {
13
+ "type": "function",
14
+ "function": {
15
+ "name": cap["id"].replace(".", "_").replace("-", "_"),
16
+ "description": cap["description"],
17
+ "parameters": {"type": "object", "properties": {}, "required": []},
18
+ },
19
+ }
20
+
21
+ # Mapear parámetros
22
+ for param in cap.get("parameters", []):
23
+ param_name = param["name"].replace("-", "_")
24
+ tool["function"]["parameters"]["properties"][param_name] = {
25
+ "type": param["type"],
26
+ "description": param["description"],
27
+ }
28
+ if param.get("required", False):
29
+ tool["function"]["parameters"]["required"].append(param_name)
30
+
31
+ tools.append(tool)
32
+
33
+ return tools
34
+
35
+ @staticmethod
36
+ def generate_system_prompt(higpertext_context: dict) -> str:
37
+ """Genera el System Prompt inyectando el perfil y reglas dinámicas."""
38
+ profile = higpertext_context.get("profile", {})
39
+ prompt = f"Rol: {profile.get('name', 'Agente higpertext').upper()}\n"
40
+ prompt += f"{profile.get('system_prompt', '')}\n\n"
41
+ prompt += "Reglas Generales:\n"
42
+ prompt += "1. Usa las herramientas proporcionadas para interactuar con el entorno.\n"
43
+ prompt += (
44
+ "2. Nunca intentes adivinar información técnica;" " extraela usando tus capacidades.\n"
45
+ )
46
+ return prompt
File without changes