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.
- config/adapters_config.json +450 -0
- config/antigravity_agent_template.json +31 -0
- config/app_config.json +174 -0
- config/context_engine.json +33 -0
- config/environments/model_defaults.json +5 -0
- config/governance/branching_strategy.json +36 -0
- config/governance/deployment_gates.json +30 -0
- config/governance/guidelines_contract.json +54 -0
- config/governance/quality_gates.json +39 -0
- config/governance/section_rules.json +22 -0
- config/governance/security_guardrails.json +52 -0
- config/hooks/README.md +35 -0
- config/hooks/custom/test_output_limiter.json +9 -0
- config/hooks/global/session_prompt.json +9 -0
- config/htx_config.json +24 -0
- config/profile_learner.json +18 -0
- config/profiles/base_agent.json +40 -0
- config/profiles/base_auditor.json +19 -0
- config/profiles/base_developer.json +19 -0
- config/profiles/base_operator.json +16 -0
- config/profiles/global.json +33 -0
- config/profiles/software_developer.json +23 -0
- config/router_content.json +137 -0
- config/semantic_graph.json +66 -0
- config/workflows/ado_release_flow.json +38 -0
- config/workflows/docs-update.json +33 -0
- config/workflows/governance-check.yaml +26 -0
- config/workflows/guidelines-sync.json +40 -0
- config/workflows/higpertext-build.json +73 -0
- config/workflows/higpertext-plan.json +38 -0
- config/workflows/higpertext-review.json +41 -0
- config/workflows/pr-quality-check.json +56 -0
- config/workflows/quality-remediation.json +57 -0
- higpertext/__init__.py +18 -0
- higpertext/adapters/__init__.py +27 -0
- higpertext/adapters/adapter_utils.py +604 -0
- higpertext/adapters/claude_adapter/__init__.py +0 -0
- higpertext/adapters/claude_adapter/claude_adapter.py +154 -0
- higpertext/adapters/copilot_adapter/__init__.py +0 -0
- higpertext/adapters/copilot_adapter/copilot_adapter.py +231 -0
- higpertext/adapters/gemini_adapter/__init__.py +0 -0
- higpertext/adapters/gemini_adapter/gemini_adapter.py +211 -0
- higpertext/adapters/llm_formatter.py +46 -0
- higpertext/adapters/open_code_adapter/__init__.py +0 -0
- higpertext/adapters/open_code_adapter/open_code_adapter.py +480 -0
- higpertext/capabilities/capabilities_runner.py +216 -0
- higpertext/capabilities/common/agent-builder.json +54 -0
- higpertext/capabilities/common/agent-sync.json +34 -0
- higpertext/capabilities/common/code-skeletonizer.json +35 -0
- higpertext/capabilities/common/commit-report.json +42 -0
- higpertext/capabilities/common/context-assembler.json +37 -0
- higpertext/capabilities/common/context-budget-report.json +15 -0
- higpertext/capabilities/common/dep-manager.json +43 -0
- higpertext/capabilities/common/docs-sync.json +14 -0
- higpertext/capabilities/common/doctor.json +18 -0
- higpertext/capabilities/common/efficiency-meter.json +31 -0
- higpertext/capabilities/common/env-catalog.json +13 -0
- higpertext/capabilities/common/env-clean.json +14 -0
- higpertext/capabilities/common/env-logs.json +16 -0
- higpertext/capabilities/common/env-runner.json +23 -0
- higpertext/capabilities/common/env-status.json +13 -0
- higpertext/capabilities/common/env-stop.json +14 -0
- higpertext/capabilities/common/env-template.json +14 -0
- higpertext/capabilities/common/error-context-locator.json +23 -0
- higpertext/capabilities/common/eval-agent.json +33 -0
- higpertext/capabilities/common/file-map.json +17 -0
- higpertext/capabilities/common/governance-exception.json +54 -0
- higpertext/capabilities/common/graph-query.json +59 -0
- higpertext/capabilities/common/graph-rebuild.json +31 -0
- higpertext/capabilities/common/graph-visualize.json +37 -0
- higpertext/capabilities/common/grep-search.json +176 -0
- higpertext/capabilities/common/higpertext-tester.json +25 -0
- higpertext/capabilities/common/hook-health.json +19 -0
- higpertext/capabilities/common/hook-sync-check.json +19 -0
- higpertext/capabilities/common/hooks-manager.json +55 -0
- higpertext/capabilities/common/knowledge-asker.json +27 -0
- higpertext/capabilities/common/list-rules.json +27 -0
- higpertext/capabilities/common/llm-invoke.json +59 -0
- higpertext/capabilities/common/load-rules.json +37 -0
- higpertext/capabilities/common/memory-manager.json +65 -0
- higpertext/capabilities/common/quality-scan.json +21 -0
- higpertext/capabilities/common/quality-updater.json +35 -0
- higpertext/capabilities/common/rag-index.json +17 -0
- higpertext/capabilities/common/report-viewer.json +24 -0
- higpertext/capabilities/common/roadmap-report.json +37 -0
- higpertext/capabilities/common/scripts/_env_cli.py +65 -0
- higpertext/capabilities/common/scripts/agent_builder.py +60 -0
- higpertext/capabilities/common/scripts/agent_sync.py +56 -0
- higpertext/capabilities/common/scripts/ask_higpertext.py +38 -0
- higpertext/capabilities/common/scripts/code_skeletonizer.py +225 -0
- higpertext/capabilities/common/scripts/commit_report.py +134 -0
- higpertext/capabilities/common/scripts/context_assembler.py +70 -0
- higpertext/capabilities/common/scripts/context_budget_report.py +53 -0
- higpertext/capabilities/common/scripts/dep_manager.py +81 -0
- higpertext/capabilities/common/scripts/docs_sync.py +981 -0
- higpertext/capabilities/common/scripts/doctor.py +144 -0
- higpertext/capabilities/common/scripts/efficiency_meter.py +83 -0
- higpertext/capabilities/common/scripts/env_catalog.py +47 -0
- higpertext/capabilities/common/scripts/env_clean.py +30 -0
- higpertext/capabilities/common/scripts/env_logs.py +32 -0
- higpertext/capabilities/common/scripts/env_runner.py +53 -0
- higpertext/capabilities/common/scripts/env_status.py +38 -0
- higpertext/capabilities/common/scripts/env_stop.py +30 -0
- higpertext/capabilities/common/scripts/env_template.py +73 -0
- higpertext/capabilities/common/scripts/error_context_locator.py +138 -0
- higpertext/capabilities/common/scripts/eval_agent.py +80 -0
- higpertext/capabilities/common/scripts/file_map.py +95 -0
- higpertext/capabilities/common/scripts/governance_exception.py +116 -0
- higpertext/capabilities/common/scripts/graph_query.py +104 -0
- higpertext/capabilities/common/scripts/graph_rebuild.py +107 -0
- higpertext/capabilities/common/scripts/graph_visualize.py +76 -0
- higpertext/capabilities/common/scripts/grep_search.py +648 -0
- higpertext/capabilities/common/scripts/higpertext_tester.py +102 -0
- higpertext/capabilities/common/scripts/hook_health.py +149 -0
- higpertext/capabilities/common/scripts/hook_sync_check.py +134 -0
- higpertext/capabilities/common/scripts/hooks_manager.py +171 -0
- higpertext/capabilities/common/scripts/list_rules.py +175 -0
- higpertext/capabilities/common/scripts/llm_invoke.py +135 -0
- higpertext/capabilities/common/scripts/load_rules.py +379 -0
- higpertext/capabilities/common/scripts/memory_manager.py +210 -0
- higpertext/capabilities/common/scripts/presentation_engine.py +63 -0
- higpertext/capabilities/common/scripts/quality_scan.py +132 -0
- higpertext/capabilities/common/scripts/rag_index.py +39 -0
- higpertext/capabilities/common/scripts/report_viewer.py +106 -0
- higpertext/capabilities/common/scripts/roadmap_report.py +73 -0
- higpertext/capabilities/common/scripts/search_router.py +111 -0
- higpertext/capabilities/common/scripts/semantic_diff.py +166 -0
- higpertext/capabilities/common/scripts/semantic_search.py +43 -0
- higpertext/capabilities/common/scripts/session_control.py +136 -0
- higpertext/capabilities/common/scripts/smart_read.py +232 -0
- higpertext/capabilities/common/scripts/subagent_executor.py +143 -0
- higpertext/capabilities/common/scripts/sync_agents.py +353 -0
- higpertext/capabilities/common/scripts/task_decomposer.py +78 -0
- higpertext/capabilities/common/scripts/telemetry_report.py +36 -0
- higpertext/capabilities/common/search-router.json +24 -0
- higpertext/capabilities/common/semantic-diff.json +40 -0
- higpertext/capabilities/common/semantic-search.json +19 -0
- higpertext/capabilities/common/session-clean.json +20 -0
- higpertext/capabilities/common/session-start.json +44 -0
- higpertext/capabilities/common/smart-read.json +28 -0
- higpertext/capabilities/common/subagent-executor.json +25 -0
- higpertext/capabilities/common/sync-agents.json +32 -0
- higpertext/capabilities/common/task-decomposer.json +37 -0
- higpertext/capabilities/common/telemetry-report.json +23 -0
- higpertext/capabilities/git/__init__.py +0 -0
- higpertext/capabilities/git/committer.json +61 -0
- higpertext/capabilities/git/diff.json +33 -0
- higpertext/capabilities/git/ls-files.json +44 -0
- higpertext/capabilities/git/rm.json +27 -0
- higpertext/capabilities/git/scripts/__init__.py +0 -0
- higpertext/capabilities/git/scripts/commit_changes.py +1077 -0
- higpertext/capabilities/git/scripts/git_diff.py +171 -0
- higpertext/capabilities/git/scripts/git_ls_files.py +376 -0
- higpertext/capabilities/git/scripts/git_rm.py +62 -0
- higpertext/capabilities/security/k8s-auditor.json +33 -0
- higpertext/capabilities/security/scripts/k8s_auditor.py +307 -0
- higpertext/capabilities/security/scripts/secret_scanner.py +235 -0
- higpertext/capabilities/security/secret-scanner.json +32 -0
- higpertext/hooks/__init__.py +28 -0
- higpertext/hooks/_compat.py +27 -0
- higpertext/hooks/hook_tasks/__init__.py +1 -0
- higpertext/hooks/hook_tasks/_rules/__init__.py +0 -0
- higpertext/hooks/hook_tasks/_rules/bash_rules.py +635 -0
- higpertext/hooks/hook_tasks/_rules/context_engine_rule.py +79 -0
- higpertext/hooks/hook_tasks/_rules/context_rules.py +199 -0
- higpertext/hooks/hook_tasks/_rules/governance_adapter.py +72 -0
- higpertext/hooks/hook_tasks/_rules/profile_rules.json +25 -0
- higpertext/hooks/hook_tasks/_rules/quality_rules.py +86 -0
- higpertext/hooks/hook_tasks/_rules/security_rules.py +214 -0
- higpertext/hooks/hook_tasks/_rules/session_rules.py +316 -0
- higpertext/hooks/hook_tasks/_rules/telemetry_rules.py +121 -0
- higpertext/hooks/hook_tasks/audit_logger_hook.py +28 -0
- higpertext/hooks/hook_tasks/hook_bash_guard.py +101 -0
- higpertext/hooks/hook_tasks/hook_code_quality.py +48 -0
- higpertext/hooks/hook_tasks/hook_context_hint.py +46 -0
- higpertext/hooks/hook_tasks/hook_context_manager.py +44 -0
- higpertext/hooks/hook_tasks/hook_io.py +122 -0
- higpertext/hooks/hook_tasks/hook_loop_guard.py +182 -0
- higpertext/hooks/hook_tasks/hook_post_observer.py +54 -0
- higpertext/hooks/hook_tasks/hook_read_guard.py +85 -0
- higpertext/hooks/hook_tasks/hook_security_guard.py +81 -0
- higpertext/hooks/hook_tasks/hook_session_prompt.py +83 -0
- higpertext/hooks/hook_tasks/hook_session_stop.py +115 -0
- higpertext/hooks/hook_tasks/hook_utils.py +144 -0
- higpertext/hooks/hook_tasks/session_guard_hook.py +23 -0
- higpertext/hooks/hook_tasks/telemetry_utils.py +176 -0
- higpertext/hooks/hook_tasks/test_echo_hook.py +33 -0
- higpertext/hooks/hook_tasks/webhook_hook.py +54 -0
- higpertext/hooks/hook_tasks/workflow_runner_hook.py +49 -0
- higpertext/hooks/hooks_catalog.json +116 -0
- higpertext/kernel/__init__.py +63 -0
- higpertext/kernel/_compat.py +138 -0
- higpertext/kernel/app_config.py +117 -0
- higpertext/kernel/application/__init__.py +13 -0
- higpertext/kernel/application/agent_registry.py +102 -0
- higpertext/kernel/application/capability_manager.py +61 -0
- higpertext/kernel/application/commit_reporter.py +247 -0
- higpertext/kernel/application/context_builder.py +166 -0
- higpertext/kernel/application/context_engine.py +409 -0
- higpertext/kernel/application/engine.py +41 -0
- higpertext/kernel/application/env_runtime.py +174 -0
- higpertext/kernel/application/environment_manager.py +154 -0
- higpertext/kernel/application/governance.py +192 -0
- higpertext/kernel/application/hook_registry.py +102 -0
- higpertext/kernel/application/hook_renderer.py +720 -0
- higpertext/kernel/application/ports.py +49 -0
- higpertext/kernel/application/profile_learner.py +358 -0
- higpertext/kernel/application/profile_service.py +205 -0
- higpertext/kernel/application/profile_services.py +6 -0
- higpertext/kernel/application/profile_use_cases.py +93 -0
- higpertext/kernel/application/rag_service.py +75 -0
- higpertext/kernel/application/roadmap_reporter.py +178 -0
- higpertext/kernel/application/semantic_engine.py +258 -0
- higpertext/kernel/application/session_services.py +33 -0
- higpertext/kernel/application/skill_hook_compiler.py +85 -0
- higpertext/kernel/application/telemetry.py +326 -0
- higpertext/kernel/application/workflow_manager.py +176 -0
- higpertext/kernel/config_paths.py +66 -0
- higpertext/kernel/domain/__init__.py +12 -0
- higpertext/kernel/domain/agent_registry.py +23 -0
- higpertext/kernel/domain/commit_reporter.py +155 -0
- higpertext/kernel/domain/compilers.py +7 -0
- higpertext/kernel/domain/context_engine.py +319 -0
- higpertext/kernel/domain/entities.py +51 -0
- higpertext/kernel/domain/env_runtime.py +62 -0
- higpertext/kernel/domain/governance.py +198 -0
- higpertext/kernel/domain/hook_models.py +29 -0
- higpertext/kernel/domain/profile_learner.py +186 -0
- higpertext/kernel/domain/rag.py +70 -0
- higpertext/kernel/domain/repositories.py +8 -0
- higpertext/kernel/domain/roadmap_reporter.py +80 -0
- higpertext/kernel/domain/semantic_engine.py +107 -0
- higpertext/kernel/engine.py +42 -0
- higpertext/kernel/htx_resolver.py +69 -0
- higpertext/kernel/infrastructure/__init__.py +13 -0
- higpertext/kernel/infrastructure/agent_registry.py +40 -0
- higpertext/kernel/infrastructure/cache/capability_cache.py +319 -0
- higpertext/kernel/infrastructure/capability_helper.py +40 -0
- higpertext/kernel/infrastructure/cli/__init__.py +1 -0
- higpertext/kernel/infrastructure/cli/agent_commands.py +62 -0
- higpertext/kernel/infrastructure/cli/arguments.py +39 -0
- higpertext/kernel/infrastructure/cli/capability_command_builder.py +86 -0
- higpertext/kernel/infrastructure/cli/capability_task_service.py +234 -0
- higpertext/kernel/infrastructure/cli/cli_search.py +234 -0
- higpertext/kernel/infrastructure/cli/parameter_contracts.py +83 -0
- higpertext/kernel/infrastructure/cli/parser_builder.py +122 -0
- higpertext/kernel/infrastructure/cli/profile_commands.py +89 -0
- higpertext/kernel/infrastructure/cli/roadmap_commands.py +117 -0
- higpertext/kernel/infrastructure/cli/router.py +1110 -0
- higpertext/kernel/infrastructure/cli/session_commands.py +36 -0
- higpertext/kernel/infrastructure/cli/task_commands.py +23 -0
- higpertext/kernel/infrastructure/cli/task_result_reporter.py +56 -0
- higpertext/kernel/infrastructure/cli/workflow_commands.py +25 -0
- higpertext/kernel/infrastructure/compilers/__init__.py +3 -0
- higpertext/kernel/infrastructure/compilers/factory.py +27 -0
- higpertext/kernel/infrastructure/compilers/graph_compiler.py +20 -0
- higpertext/kernel/infrastructure/compilers/guide_compiler.py +50 -0
- higpertext/kernel/infrastructure/compilers/hook_compiler.py +69 -0
- higpertext/kernel/infrastructure/compilers/playbook_compiler.py +154 -0
- higpertext/kernel/infrastructure/context_engine.py +303 -0
- higpertext/kernel/infrastructure/database/local_vector_store.py +99 -0
- higpertext/kernel/infrastructure/deployment/__init__.py +1 -0
- higpertext/kernel/infrastructure/deployment/resource_deployer.py +283 -0
- higpertext/kernel/infrastructure/diagnostics/__init__.py +1 -0
- higpertext/kernel/infrastructure/diagnostics/health.py +191 -0
- higpertext/kernel/infrastructure/env_runtime.py +227 -0
- higpertext/kernel/infrastructure/execution/__init__.py +1 -0
- higpertext/kernel/infrastructure/execution/parallel.py +188 -0
- higpertext/kernel/infrastructure/execution/resilience.py +155 -0
- higpertext/kernel/infrastructure/file_repositories.py +213 -0
- higpertext/kernel/infrastructure/governance.py +198 -0
- higpertext/kernel/infrastructure/hook_config_loader.py +53 -0
- higpertext/kernel/infrastructure/hook_webhook_dispatcher.py +61 -0
- higpertext/kernel/infrastructure/hook_workflow_bridge.py +60 -0
- higpertext/kernel/infrastructure/llm/__init__.py +6 -0
- higpertext/kernel/infrastructure/llm/provider.py +46 -0
- higpertext/kernel/infrastructure/llm/providers/__init__.py +0 -0
- higpertext/kernel/infrastructure/llm/providers/anthropic_provider.py +94 -0
- higpertext/kernel/infrastructure/llm/providers/gemini_embeddings.py +74 -0
- higpertext/kernel/infrastructure/llm/providers/gemini_provider.py +101 -0
- higpertext/kernel/infrastructure/llm/providers/ollama_provider.py +110 -0
- higpertext/kernel/infrastructure/llm/providers/openai_provider.py +98 -0
- higpertext/kernel/infrastructure/llm/registry.py +81 -0
- higpertext/kernel/infrastructure/logger.py +303 -0
- higpertext/kernel/infrastructure/output_store.py +70 -0
- higpertext/kernel/infrastructure/parser/__init__.py +1 -0
- higpertext/kernel/infrastructure/parser/code_chunker.py +144 -0
- higpertext/kernel/infrastructure/parser/language/__init__.py +14 -0
- higpertext/kernel/infrastructure/parser/language/base.py +41 -0
- higpertext/kernel/infrastructure/parser/language/powershell_parser.py +35 -0
- higpertext/kernel/infrastructure/parser/language/python_parser.py +98 -0
- higpertext/kernel/infrastructure/parser/language/typescript_parser.py +91 -0
- higpertext/kernel/infrastructure/parser/semantic_graph.py +409 -0
- higpertext/kernel/infrastructure/presentation/__init__.py +1 -0
- higpertext/kernel/infrastructure/presentation/html_renderer.py +137 -0
- higpertext/kernel/infrastructure/presentation/markdown_renderer.py +84 -0
- higpertext/kernel/infrastructure/presentation/markdown_report_renderer.py +97 -0
- higpertext/kernel/infrastructure/profile_store.py +28 -0
- higpertext/kernel/infrastructure/semantic_engine.py +289 -0
- higpertext/kernel/infrastructure/telemetry_reporter.py +132 -0
- higpertext/kernel/infrastructure/validation/__init__.py +1 -0
- higpertext/kernel/infrastructure/validation/contract_validator.py +163 -0
- higpertext/kernel/pkg_resources.py +38 -0
- higpertext/kernel/session_manager.py +319 -0
- higpertext/templates/env/generic-shell.yaml +21 -0
- higpertext/templates/env/node-vitest.yaml +27 -0
- higpertext/templates/env/python-pytest.yaml +29 -0
- higpertext/templates/html/commit_body.html +20 -0
- higpertext/templates/html/commit_diff.html +4 -0
- higpertext/templates/html/commit_index.html +29 -0
- higpertext/templates/html/commit_layer.html +11 -0
- higpertext/templates/html/commit_shell.html +28 -0
- higpertext/templates/html/graph_visualize.html +86 -0
- higpertext/templates/html/roadmap_body.html +12 -0
- higpertext/templates/html/roadmap_phase.html +5 -0
- higpertext/templates/html/roadmap_shell.html +29 -0
- higpertext/templates/markdown/commit_report.md +18 -0
- higpertext/templates/markdown/efficiency_report.md +12 -0
- higpertext/templates/markdown/roadmap_report.md +25 -0
- higpertext/templates/skills/best-practices.md +7 -0
- higpertext/templates/skills/clean-code.md +8 -0
- higpertext/templates/skills/ddd-standards.md +7 -0
- higpertext/templates/skills/tdd-practices.md +7 -0
- higpertext/templates/subagents/architect.md +7 -0
- higpertext/templates/subagents/test-engineer.md +7 -0
- higpertext/templates/workflows/build.json +23 -0
- higpertext/templates/workflows/compact.json +21 -0
- higpertext/templates/workflows/plan.json +59 -0
- higpertext/templates/workflows/review.json +26 -0
- higpertext/templates/workflows/spec.json +27 -0
- higpertext_cli-0.8.0.dist-info/METADATA +35 -0
- higpertext_cli-0.8.0.dist-info/RECORD +335 -0
- higpertext_cli-0.8.0.dist-info/WHEEL +5 -0
- higpertext_cli-0.8.0.dist-info/entry_points.txt +2 -0
- higpertext_cli-0.8.0.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": [
|
|
3
|
+
{
|
|
4
|
+
"id": "hook_bash_guard",
|
|
5
|
+
"event": "PreToolUse",
|
|
6
|
+
"matcher": "Bash",
|
|
7
|
+
"script": "src/higpertext/hooks/hook_tasks/hook_bash_guard.py",
|
|
8
|
+
"description": "Evalúa en cadena todas las reglas Bash: bloques duros, grep/find, git, docs, list-rules, load-rules, exit, higpertext-enforcer.",
|
|
9
|
+
"timeout": 10,
|
|
10
|
+
"enabled": true,
|
|
11
|
+
"assistants": [],
|
|
12
|
+
"profiles": [],
|
|
13
|
+
"capability_id": ""
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"id": "hook_code_quality",
|
|
17
|
+
"event": "PreToolUse",
|
|
18
|
+
"matcher": "Write|Edit",
|
|
19
|
+
"script": "src/higpertext/hooks/hook_tasks/hook_code_quality.py",
|
|
20
|
+
"description": "Evalúa calidad de código Python antes de escribir: longitud de funciones y clases.",
|
|
21
|
+
"timeout": 10,
|
|
22
|
+
"enabled": true,
|
|
23
|
+
"assistants": [],
|
|
24
|
+
"profiles": [
|
|
25
|
+
"software_developer",
|
|
26
|
+
"devsecops",
|
|
27
|
+
"ado_admin"
|
|
28
|
+
],
|
|
29
|
+
"capability_id": "ado_admin.code-quality"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "hook_read_guard",
|
|
33
|
+
"event": "PreToolUse",
|
|
34
|
+
"matcher": "Read",
|
|
35
|
+
"script": "src/higpertext/hooks/hook_tasks/hook_read_guard.py",
|
|
36
|
+
"description": "Bloquea lecturas completas de archivos grandes y recomienda smart-read o skeletonizer.",
|
|
37
|
+
"timeout": 5,
|
|
38
|
+
"enabled": true,
|
|
39
|
+
"assistants": [],
|
|
40
|
+
"profiles": [],
|
|
41
|
+
"capability_id": "common.smart-read"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"id": "hook_security_guard_pre",
|
|
45
|
+
"event": "PreToolUse",
|
|
46
|
+
"matcher": "Bash|PowerShell|Read|Write|Edit",
|
|
47
|
+
"script": "src/higpertext/hooks/hook_tasks/hook_security_guard.py",
|
|
48
|
+
"description": "Bloquea comandos y rutas sensibles según security_guardrails.json.",
|
|
49
|
+
"timeout": 5,
|
|
50
|
+
"enabled": true,
|
|
51
|
+
"assistants": [],
|
|
52
|
+
"profiles": [],
|
|
53
|
+
"capability_id": "security.vuln-resolver"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"id": "hook_security_guard_post",
|
|
57
|
+
"event": "PostToolUse",
|
|
58
|
+
"matcher": "",
|
|
59
|
+
"script": "src/higpertext/hooks/hook_tasks/hook_security_guard.py",
|
|
60
|
+
"description": "Enmascara secretos detectados en outputs de herramientas.",
|
|
61
|
+
"timeout": 5,
|
|
62
|
+
"enabled": true,
|
|
63
|
+
"assistants": [],
|
|
64
|
+
"profiles": [],
|
|
65
|
+
"capability_id": "security.vuln-resolver"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"id": "hook_post_observer",
|
|
69
|
+
"event": "PostToolUse",
|
|
70
|
+
"matcher": "",
|
|
71
|
+
"script": "src/higpertext/hooks/hook_tasks/hook_post_observer.py",
|
|
72
|
+
"description": "Registra telemetría de tokens y actividad tras cada tool call.",
|
|
73
|
+
"timeout": 5,
|
|
74
|
+
"enabled": true,
|
|
75
|
+
"assistants": [],
|
|
76
|
+
"profiles": [],
|
|
77
|
+
"capability_id": ""
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"id": "hook_session_prompt",
|
|
81
|
+
"event": "UserPromptSubmit",
|
|
82
|
+
"matcher": "",
|
|
83
|
+
"script": "src/higpertext/hooks/hook_tasks/hook_session_prompt.py",
|
|
84
|
+
"description": "Inyecta estado de sesión higpertext y contexto de skills activas en cada prompt.",
|
|
85
|
+
"timeout": 10,
|
|
86
|
+
"enabled": true,
|
|
87
|
+
"assistants": [],
|
|
88
|
+
"profiles": [],
|
|
89
|
+
"capability_id": "common.session-start"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"id": "hook_session_stop",
|
|
93
|
+
"event": "Stop",
|
|
94
|
+
"matcher": "",
|
|
95
|
+
"script": "src/higpertext/hooks/hook_tasks/hook_session_stop.py",
|
|
96
|
+
"description": "Al cerrar el turno, verifica commits pendientes y recuerda ejecutar session-clean.",
|
|
97
|
+
"timeout": 10,
|
|
98
|
+
"enabled": true,
|
|
99
|
+
"assistants": [],
|
|
100
|
+
"profiles": [],
|
|
101
|
+
"capability_id": "common.session-clean"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"id": "hook_context_manager",
|
|
105
|
+
"event": "PreCompact",
|
|
106
|
+
"matcher": "",
|
|
107
|
+
"script": "src/higpertext/hooks/hook_tasks/hook_context_manager.py",
|
|
108
|
+
"description": "Preserva estado higpertext crítico (sesión, skills, perfil) antes de compresión de contexto.",
|
|
109
|
+
"timeout": 5,
|
|
110
|
+
"enabled": true,
|
|
111
|
+
"assistants": [],
|
|
112
|
+
"profiles": [],
|
|
113
|
+
"capability_id": ""
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from higpertext.kernel.htx_resolver import get_htx_cmd, HTX_CMD, HTX_WORKFLOW_CMD
|
|
2
|
+
from higpertext.kernel.engine import HigpertextEngine
|
|
3
|
+
from higpertext.kernel.session_manager import SessionManager
|
|
4
|
+
from higpertext.kernel.pkg_resources import (
|
|
5
|
+
installed_src_root,
|
|
6
|
+
resolve_resource,
|
|
7
|
+
pkg_data_root,
|
|
8
|
+
)
|
|
9
|
+
from higpertext.kernel.application.environment_manager import EnvironmentManager
|
|
10
|
+
from higpertext.kernel.infrastructure.validation.contract_validator import (
|
|
11
|
+
ContractValidator,
|
|
12
|
+
)
|
|
13
|
+
from higpertext.kernel.infrastructure.execution.parallel import (
|
|
14
|
+
ParallelExecutor,
|
|
15
|
+
build_step_groups,
|
|
16
|
+
StepGroup,
|
|
17
|
+
)
|
|
18
|
+
from higpertext.kernel.infrastructure.execution.resilience import (
|
|
19
|
+
get_resilience_manager,
|
|
20
|
+
CircuitBreaker,
|
|
21
|
+
CircuitState,
|
|
22
|
+
ResilienceManager,
|
|
23
|
+
)
|
|
24
|
+
from higpertext.kernel.infrastructure.cache.capability_cache import (
|
|
25
|
+
get_capability_cache,
|
|
26
|
+
CapabilityCache,
|
|
27
|
+
CacheEntry,
|
|
28
|
+
)
|
|
29
|
+
from higpertext.kernel.infrastructure.diagnostics.health import run_health_check
|
|
30
|
+
from higpertext.kernel.infrastructure.parser.semantic_graph import (
|
|
31
|
+
SemanticGraphGenerator,
|
|
32
|
+
)
|
|
33
|
+
from higpertext.kernel.infrastructure.cli.parameter_contracts import (
|
|
34
|
+
normalize_and_validate_params,
|
|
35
|
+
ParameterValidation,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
__all__ = [
|
|
39
|
+
"get_htx_cmd",
|
|
40
|
+
"HTX_CMD",
|
|
41
|
+
"HTX_WORKFLOW_CMD",
|
|
42
|
+
"HigpertextEngine",
|
|
43
|
+
"EnvironmentManager",
|
|
44
|
+
"SessionManager",
|
|
45
|
+
"ContractValidator",
|
|
46
|
+
"ParallelExecutor",
|
|
47
|
+
"build_step_groups",
|
|
48
|
+
"StepGroup",
|
|
49
|
+
"get_resilience_manager",
|
|
50
|
+
"CircuitBreaker",
|
|
51
|
+
"CircuitState",
|
|
52
|
+
"ResilienceManager",
|
|
53
|
+
"get_capability_cache",
|
|
54
|
+
"CapabilityCache",
|
|
55
|
+
"CacheEntry",
|
|
56
|
+
"run_health_check",
|
|
57
|
+
"SemanticGraphGenerator",
|
|
58
|
+
"normalize_and_validate_params",
|
|
59
|
+
"ParameterValidation",
|
|
60
|
+
"installed_src_root",
|
|
61
|
+
"resolve_resource",
|
|
62
|
+
"pkg_data_root",
|
|
63
|
+
]
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"""Single shim — all kernel re-exports from infrastructure/application layers."""
|
|
2
|
+
|
|
3
|
+
# CLI
|
|
4
|
+
from higpertext.kernel.app_config import ( # noqa: F401
|
|
5
|
+
ASSISTANT_IGNORE_FILES as _ASSISTANT_IGNORE,
|
|
6
|
+
GUIDE_SPECS as _GUIDE_SPECS,
|
|
7
|
+
PROFILES_SECTION as _PROFILES_SECTION,
|
|
8
|
+
RULES_SECTION as _RULES_SECTION,
|
|
9
|
+
)
|
|
10
|
+
from higpertext.kernel.infrastructure.cli.router import ( # noqa: F401
|
|
11
|
+
ROOT_DIR,
|
|
12
|
+
POSTMORTEM_DIR,
|
|
13
|
+
GOVERNANCE_DIR,
|
|
14
|
+
DOCS_DIR,
|
|
15
|
+
_ADAPTER_MAP,
|
|
16
|
+
_parse_kv_args,
|
|
17
|
+
HigpertextHub,
|
|
18
|
+
_add_task_ask_subparsers,
|
|
19
|
+
_add_profile_init_subparsers,
|
|
20
|
+
_add_session_workflow_subparsers,
|
|
21
|
+
_add_health_subparser,
|
|
22
|
+
_add_roadmap_subparser,
|
|
23
|
+
_build_parser,
|
|
24
|
+
_parse_session_resources,
|
|
25
|
+
_start_session,
|
|
26
|
+
_dispatch_session,
|
|
27
|
+
_dispatch_workflow,
|
|
28
|
+
_dispatch_command,
|
|
29
|
+
_dispatch_roadmap,
|
|
30
|
+
_dispatch_profile_learn,
|
|
31
|
+
_dispatch_non_task,
|
|
32
|
+
main,
|
|
33
|
+
)
|
|
34
|
+
from higpertext.kernel.infrastructure.cli.cli_search import ( # noqa: F401
|
|
35
|
+
HigpertextSearchMixin,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
# Application services
|
|
39
|
+
from higpertext.kernel.application.environment_manager import ( # noqa: F401
|
|
40
|
+
EnvironmentManager,
|
|
41
|
+
)
|
|
42
|
+
from higpertext.kernel.session_manager import SessionManager # noqa: F401
|
|
43
|
+
from higpertext.kernel.application.capability_manager import ( # noqa: F401
|
|
44
|
+
CapabilityManager,
|
|
45
|
+
)
|
|
46
|
+
from higpertext.kernel.application.workflow_manager import ( # noqa: F401
|
|
47
|
+
WorkflowManager,
|
|
48
|
+
)
|
|
49
|
+
from higpertext.kernel.application.profile_services import ( # noqa: F401
|
|
50
|
+
ProfileApplicationService,
|
|
51
|
+
ProfileManager,
|
|
52
|
+
)
|
|
53
|
+
from higpertext.kernel.application.profile_service import ( # noqa: F401
|
|
54
|
+
ProfileService,
|
|
55
|
+
)
|
|
56
|
+
from higpertext.kernel.application.context_builder import ( # noqa: F401
|
|
57
|
+
SessionContextBuilder,
|
|
58
|
+
_UNIVERSAL_SKILLS,
|
|
59
|
+
_UNIVERSAL_SUBAGENTS,
|
|
60
|
+
)
|
|
61
|
+
from higpertext.kernel.application.engine import ( # noqa: F401
|
|
62
|
+
ApplicationHigpertextEngine,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
# Infrastructure
|
|
66
|
+
from higpertext.kernel.infrastructure.validation.contract_validator import ( # noqa: F401
|
|
67
|
+
ContractValidator,
|
|
68
|
+
)
|
|
69
|
+
from higpertext.kernel.infrastructure.cache.capability_cache import ( # noqa: F401
|
|
70
|
+
CapabilityCache,
|
|
71
|
+
CacheEntry,
|
|
72
|
+
get_capability_cache,
|
|
73
|
+
)
|
|
74
|
+
from higpertext.kernel.infrastructure.execution.parallel import ( # noqa: F401
|
|
75
|
+
ParallelExecutor,
|
|
76
|
+
build_step_groups,
|
|
77
|
+
StepGroup,
|
|
78
|
+
)
|
|
79
|
+
from higpertext.kernel.infrastructure.execution.resilience import ( # noqa: F401
|
|
80
|
+
get_resilience_manager,
|
|
81
|
+
CircuitBreaker,
|
|
82
|
+
CircuitState,
|
|
83
|
+
ResilienceManager,
|
|
84
|
+
)
|
|
85
|
+
from higpertext.kernel.infrastructure.diagnostics.health import ( # noqa: F401
|
|
86
|
+
run_health_check,
|
|
87
|
+
)
|
|
88
|
+
from higpertext.kernel.infrastructure.parser.semantic_graph import ( # noqa: F401
|
|
89
|
+
SemanticGraphGenerator,
|
|
90
|
+
IgnoreChecker,
|
|
91
|
+
)
|
|
92
|
+
from higpertext.kernel.infrastructure.parser.language.python_parser import _ASTVisitor as PythonASTVisitor # noqa: F401
|
|
93
|
+
from higpertext.kernel.infrastructure.parser.language.base import ParseResult as _ParseResult
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def _empty_parse_result(note: str = "") -> dict: # noqa: F401
|
|
97
|
+
return _ParseResult(summary=note).to_dict()
|
|
98
|
+
from higpertext.kernel.infrastructure.presentation.markdown_renderer import ( # noqa: F401
|
|
99
|
+
MarkdownRenderer,
|
|
100
|
+
)
|
|
101
|
+
from higpertext.kernel.infrastructure.cli.parameter_contracts import ( # noqa: F401
|
|
102
|
+
normalize_and_validate_params,
|
|
103
|
+
ParameterValidation,
|
|
104
|
+
)
|
|
105
|
+
from higpertext.kernel.infrastructure.deployment.resource_deployer import ( # noqa: F401
|
|
106
|
+
ResourceDeployer,
|
|
107
|
+
_NO_SKILLS_MSG,
|
|
108
|
+
_NO_SUBAGENTS_MSG,
|
|
109
|
+
)
|
|
110
|
+
from higpertext.kernel.infrastructure.capability_helper import ( # noqa: F401
|
|
111
|
+
CapabilityHelper,
|
|
112
|
+
)
|
|
113
|
+
from higpertext.kernel.infrastructure.file_repositories import ( # noqa: F401
|
|
114
|
+
FileProfileRepository,
|
|
115
|
+
FileSessionRepository,
|
|
116
|
+
)
|
|
117
|
+
from higpertext.kernel.infrastructure.llm.registry import LLMRegistry # noqa: F401
|
|
118
|
+
|
|
119
|
+
# Application ports
|
|
120
|
+
from higpertext.kernel.application.ports import ( # noqa: F401
|
|
121
|
+
IProfileRepository,
|
|
122
|
+
ICapabilityRepository,
|
|
123
|
+
)
|
|
124
|
+
from higpertext.kernel.domain.entities import Profile, Capability # noqa: F401
|
|
125
|
+
|
|
126
|
+
# Adapters
|
|
127
|
+
from higpertext.adapters.gemini_adapter.gemini_adapter import ( # noqa: F401
|
|
128
|
+
GeminiAdapter,
|
|
129
|
+
)
|
|
130
|
+
from higpertext.adapters.claude_adapter.claude_adapter import ( # noqa: F401
|
|
131
|
+
ClaudeAdapter,
|
|
132
|
+
)
|
|
133
|
+
from higpertext.adapters.copilot_adapter.copilot_adapter import ( # noqa: F401
|
|
134
|
+
CopilotAdapter,
|
|
135
|
+
)
|
|
136
|
+
from higpertext.adapters.open_code_adapter.open_code_adapter import ( # noqa: F401
|
|
137
|
+
OpenCodeAdapter,
|
|
138
|
+
)
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"""Single source of truth for application-level static constants, driven by src/config/app_config.json."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
import json
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from higpertext.kernel.config_paths import PROJECT_ROOT as _ROOT
|
|
8
|
+
|
|
9
|
+
_CONFIG_FILE = _ROOT / "src" / "config" / "app_config.json"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _load() -> dict:
|
|
13
|
+
return json.loads(_CONFIG_FILE.read_text(encoding="utf-8"))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
_CFG = _load()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def get(section: str, key: str, default=None):
|
|
20
|
+
"""Return a value from app_config.json by section and key."""
|
|
21
|
+
return _CFG.get(section, {}).get(key, default)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# ── router_content.json ───────────────────────────────────────────────────────
|
|
25
|
+
_ROUTER_FILE = _ROOT / "src" / "config" / "router_content.json"
|
|
26
|
+
_RC = json.loads(_ROUTER_FILE.read_text(encoding="utf-8"))
|
|
27
|
+
|
|
28
|
+
IGNORE_PATTERNS: list[str] = _RC["ignore_patterns"]
|
|
29
|
+
ASSISTANT_IGNORE_FILES: dict[str, list[str]] = _RC["assistant_ignore_files"]
|
|
30
|
+
GITIGNORE_SECTION: str = "\n".join(_RC["gitignore_section"])
|
|
31
|
+
GUIDE_SPECS: dict[str, dict] = _RC["guide_specs"]
|
|
32
|
+
PROFILES_SECTION: list[str] = _RC["profiles_section"]
|
|
33
|
+
RULES_SECTION: list[str] = _RC["rules_section"]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# ── session ───────────────────────────────────────────────────────────────────
|
|
37
|
+
DEFAULT_ASSISTANT: str = _CFG["session"]["default_assistant"]
|
|
38
|
+
DEFAULT_PROFILE: str = _CFG["session"]["default_profile"]
|
|
39
|
+
GLOBAL_PROFILE_NAMES: frozenset[str] = frozenset(_CFG["session"]["global_profile_names"])
|
|
40
|
+
ASSISTANTS: list[str] = _CFG["session"]["assistants"]
|
|
41
|
+
APPEND_ASSISTANTS: set[str] = set(_CFG["session"]["append_assistants"])
|
|
42
|
+
|
|
43
|
+
# ── logger ────────────────────────────────────────────────────────────────────
|
|
44
|
+
LOGGER_NAME: str = _CFG["logger"]["name"]
|
|
45
|
+
LOG_FILE: str = _CFG["logger"]["log_file"]
|
|
46
|
+
|
|
47
|
+
# ── store ─────────────────────────────────────────────────────────────────────
|
|
48
|
+
REPORTS_DIR: str = _CFG["store"]["reports_dir"]
|
|
49
|
+
INDEX_FILE: str = _CFG["store"]["index_file"]
|
|
50
|
+
TELEMETRY_FILE: str = _CFG["store"]["telemetry_file"]
|
|
51
|
+
PROFILE_FILE: str = _CFG["store"]["profile_file"]
|
|
52
|
+
AGENTS_DIR: str = _CFG["store"]["agents_dir"]
|
|
53
|
+
SETTINGS_FILE: str = _CFG["store"]["settings_file"]
|
|
54
|
+
ENVIRONMENT_FILE: str = _CFG["store"]["environment_file"]
|
|
55
|
+
SESSION_FILE: str = _CFG["store"]["session_file"]
|
|
56
|
+
|
|
57
|
+
# ── cache ─────────────────────────────────────────────────────────────────────
|
|
58
|
+
CACHE_DIR: str = _CFG["cache"]["cache_dir"]
|
|
59
|
+
CACHE_FILE_GLOB: str = _CFG["cache"]["file_glob"]
|
|
60
|
+
NO_CACHE_CAPABILITIES: frozenset[str] = frozenset(_CFG["cache"]["no_cache_capabilities"])
|
|
61
|
+
|
|
62
|
+
# ── deployment ────────────────────────────────────────────────────────────────
|
|
63
|
+
AGENT_JSON: str = _CFG["deployment"]["agent_json"]
|
|
64
|
+
PLAYBOOKS: tuple[str, ...] = tuple(_CFG["deployment"]["playbooks"])
|
|
65
|
+
NO_SKILLS_MSG: str = _CFG["deployment"]["no_skills_message"]
|
|
66
|
+
NO_SUBAGENTS_MSG: str = _CFG["deployment"]["no_subagents_message"]
|
|
67
|
+
|
|
68
|
+
# ── providers ─────────────────────────────────────────────────────────────────
|
|
69
|
+
OLLAMA_BASE_URL: str = _CFG["providers"]["ollama_base_url"]
|
|
70
|
+
|
|
71
|
+
# ── context ───────────────────────────────────────────────────────────────────
|
|
72
|
+
UNIVERSAL_SKILLS: list[str] = _CFG["context"]["universal_skills"]
|
|
73
|
+
LOG_SEP: str = _CFG["context"]["log_sep"]
|
|
74
|
+
|
|
75
|
+
# ── docs ──────────────────────────────────────────────────────────────────────
|
|
76
|
+
INDEX_LINK: str = _CFG["docs"]["index_link"]
|
|
77
|
+
|
|
78
|
+
# ── rules ─────────────────────────────────────────────────────────────────────
|
|
79
|
+
PINNED_CAPABILITIES: list[str] = _CFG["rules"]["pinned_capabilities"]
|
|
80
|
+
CLI_NAME: str = _CFG["rules"]["cli_name"]
|
|
81
|
+
|
|
82
|
+
# ── assistants ────────────────────────────────────────────────────────────────
|
|
83
|
+
# {assistant: (workflows_dir, skills_dir, agents_dir)}
|
|
84
|
+
ASSISTANT_PATHS: dict[str, tuple[str, str, str]] = {
|
|
85
|
+
k: tuple(v) for k, v in _CFG["assistants"]["paths"].items() # type: ignore[misc]
|
|
86
|
+
}
|
|
87
|
+
SKILL_DIRS: dict[str, str] = _CFG["assistants"]["skill_dirs"]
|
|
88
|
+
AGENT_DIRS: dict[str, str] = _CFG["assistants"]["agent_dirs"]
|
|
89
|
+
ASSISTANT_ROOT_DIRS: dict[str, str] = _CFG["assistants"]["root_dirs"]
|
|
90
|
+
ASSISTANT_DISPLAY_NAMES: dict[str, str] = _CFG["assistants"]["display_names"]
|
|
91
|
+
RULES_DESTINATIONS_REL: dict[str, str] = _CFG["assistants"]["rules_destinations"]
|
|
92
|
+
IGNORE_TOOLS: frozenset[str] = frozenset(_CFG["assistants"]["ignore_tools"])
|
|
93
|
+
ASSISTANT_HOOKS_DIRS: dict[str, str] = _CFG["assistants"]["hooks_dirs"]
|
|
94
|
+
ASSISTANT_ALIASES: dict[str, str] = _CFG["assistants"]["aliases"]
|
|
95
|
+
|
|
96
|
+
# ── profiles ──────────────────────────────────────────────────────────────────
|
|
97
|
+
RESERVED_PROFILES: frozenset[str] = frozenset(_CFG["profiles"]["reserved"])
|
|
98
|
+
|
|
99
|
+
# ── git ───────────────────────────────────────────────────────────────────────
|
|
100
|
+
GIT_STATUS_LABELS: dict[str, str] = _CFG["git"]["status_labels"]
|
|
101
|
+
|
|
102
|
+
# ── telemetry_reporter ────────────────────────────────────────────────────────
|
|
103
|
+
_TR = _CFG["telemetry_reporter"]
|
|
104
|
+
TELEMETRY_BOX_WIDTH: int = _TR["box_width"]
|
|
105
|
+
TELEMETRY_BAR_WIDTH: int = _TR["bar_width"]
|
|
106
|
+
TELEMETRY_EMPTY_TITLE: str = _TR["empty_state"]["title"]
|
|
107
|
+
TELEMETRY_EMPTY_LINES: list[str] = _TR["empty_state"]["lines"]
|
|
108
|
+
TELEMETRY_SECTION_LABELS: dict[str, str] = _TR["section_labels"]
|
|
109
|
+
TELEMETRY_ACTIVITY_ICONS: dict[str, str] = _TR["activity_icons"]
|
|
110
|
+
|
|
111
|
+
# ── antigravity_agent_template ────────────────────────────────────────────────
|
|
112
|
+
_AGT_FILE = _ROOT / "src" / "config" / "antigravity_agent_template.json"
|
|
113
|
+
ANTIGRAVITY_AGENT_TEMPLATE: dict = json.loads(_AGT_FILE.read_text(encoding="utf-8"))
|
|
114
|
+
|
|
115
|
+
# ── adapters_config ───────────────────────────────────────────────────────────
|
|
116
|
+
_ADAPT_FILE = _ROOT / "src" / "config" / "adapters_config.json"
|
|
117
|
+
ADAPTERS_CONFIG: dict = json.loads(_ADAPT_FILE.read_text(encoding="utf-8"))
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Application layer init
|
|
2
|
+
from higpertext.kernel.application.governance import GovernanceEnforcer, ExceptionRegistry
|
|
3
|
+
from higpertext.kernel.application.agent_registry import RegisterAgentUseCase, ListAgentsUseCase, SyncAgentUseCase
|
|
4
|
+
from higpertext.kernel.application.env_runtime import EnvironmentService
|
|
5
|
+
from higpertext.kernel.application.commit_reporter import CommitParser, ImpactAnalyzer, ReportBuilder, CommitAnalysis
|
|
6
|
+
from higpertext.kernel.application.roadmap_reporter import ProgressAnalyzer, RoadmapParser, RoadmapReportBuilder, RoadmapAnalysis
|
|
7
|
+
from higpertext.kernel.application.profile_learner import ProfileExtractor, ProfileUpdater, WeightsCalibrator
|
|
8
|
+
from higpertext.kernel.application.profile_use_cases import GetAgentContextUseCase, ValidateProfileUseCase
|
|
9
|
+
from higpertext.kernel.application.ports import ICapabilityRepository, IProfileRepository, ISessionRepository, IWorkflowRepository
|
|
10
|
+
from higpertext.kernel.application.telemetry import TelemetryCollector, TelemetryAggregator, get_collector
|
|
11
|
+
from higpertext.kernel.application.context_engine import ContextAssembler, EfficiencyMeter, TaskDecomposer
|
|
12
|
+
from higpertext.kernel.application.semantic_engine import ClusterService, ContextRanker, GraphBuilder
|
|
13
|
+
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from datetime import datetime, timezone
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
import json
|
|
5
|
+
import shutil
|
|
6
|
+
|
|
7
|
+
from higpertext.kernel.config_paths import WORKSPACE_DIR_NAME
|
|
8
|
+
from higpertext.kernel.domain.agent_registry import AgentRecord, SyncResult, IAgentRegistryRepository
|
|
9
|
+
|
|
10
|
+
# Expuestos para mocking en tests
|
|
11
|
+
try:
|
|
12
|
+
from higpertext.kernel.application.hook_renderer import HookRenderer
|
|
13
|
+
from higpertext.kernel.application.skill_hook_compiler import SkillHookCompiler
|
|
14
|
+
except ImportError:
|
|
15
|
+
HookRenderer = None # type: ignore
|
|
16
|
+
SkillHookCompiler = None # type: ignore
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class RegisterAgentUseCase:
|
|
20
|
+
def __init__(self, repo: IAgentRegistryRepository) -> None:
|
|
21
|
+
self._repo = repo
|
|
22
|
+
|
|
23
|
+
def execute(self, name: str, path: str, profile: str) -> AgentRecord:
|
|
24
|
+
if not Path(path).exists():
|
|
25
|
+
raise ValueError(f"path does not exist: {path}")
|
|
26
|
+
if self._repo.find_by_name(name) is not None:
|
|
27
|
+
raise ValueError(f"Agent '{name}' already registered")
|
|
28
|
+
record = AgentRecord(
|
|
29
|
+
name=name,
|
|
30
|
+
path=path,
|
|
31
|
+
profile=profile,
|
|
32
|
+
registered_at=datetime.now(tz=timezone.utc).isoformat(),
|
|
33
|
+
)
|
|
34
|
+
agents = self._repo.load()
|
|
35
|
+
self._repo.save([*agents, record])
|
|
36
|
+
return record
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class ListAgentsUseCase:
|
|
40
|
+
def __init__(self, repo: IAgentRegistryRepository) -> None:
|
|
41
|
+
self._repo = repo
|
|
42
|
+
|
|
43
|
+
def execute(self) -> list[AgentRecord]:
|
|
44
|
+
return self._repo.load()
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class SyncAgentUseCase:
|
|
48
|
+
def __init__(self, repo: IAgentRegistryRepository, engine_root: Path) -> None:
|
|
49
|
+
self._repo = repo
|
|
50
|
+
self._engine_root = engine_root
|
|
51
|
+
|
|
52
|
+
def execute(self, name: str | None, assistant: str) -> list[SyncResult]:
|
|
53
|
+
agents = self._repo.load()
|
|
54
|
+
targets = [a for a in agents if name is None or a.name == name]
|
|
55
|
+
return [self._sync_one(rec, assistant) for rec in targets]
|
|
56
|
+
|
|
57
|
+
def _sync_one(self, rec: AgentRecord, assistant: str) -> SyncResult:
|
|
58
|
+
try:
|
|
59
|
+
agent_path = Path(rec.path)
|
|
60
|
+
caps = self._read_capabilities(rec.profile)
|
|
61
|
+
self._seed_hook_definitions(agent_path)
|
|
62
|
+
if SkillHookCompiler and HookRenderer:
|
|
63
|
+
SkillHookCompiler(agent_path).compile(rec.profile, caps)
|
|
64
|
+
HookRenderer(agent_path).render(assistant, rec.profile)
|
|
65
|
+
self._copy_profile(rec.profile, agent_path)
|
|
66
|
+
return SyncResult(name=rec.name, success=True, message="ok")
|
|
67
|
+
except Exception as exc:
|
|
68
|
+
return SyncResult(name=rec.name, success=False, message=str(exc))
|
|
69
|
+
|
|
70
|
+
def _seed_hook_definitions(self, agent_path: Path) -> None:
|
|
71
|
+
"""Copia las definiciones de hooks del motor al hooks_config del agente."""
|
|
72
|
+
motor_cfg = self._engine_root / WORKSPACE_DIR_NAME / "config" / "hooks_config.json"
|
|
73
|
+
agent_cfg = agent_path / WORKSPACE_DIR_NAME / "config" / "hooks_config.json"
|
|
74
|
+
if not motor_cfg.exists() or not agent_cfg.exists():
|
|
75
|
+
return
|
|
76
|
+
try:
|
|
77
|
+
motor_data = json.loads(motor_cfg.read_text(encoding="utf-8"))
|
|
78
|
+
agent_data = json.loads(agent_cfg.read_text(encoding="utf-8"))
|
|
79
|
+
agent_data["hooks"] = motor_data.get("hooks", [])
|
|
80
|
+
agent_cfg.write_text(
|
|
81
|
+
json.dumps(agent_data, indent=2, ensure_ascii=False), encoding="utf-8"
|
|
82
|
+
)
|
|
83
|
+
except (OSError, json.JSONDecodeError):
|
|
84
|
+
pass
|
|
85
|
+
|
|
86
|
+
def _read_capabilities(self, profile: str) -> list[str]:
|
|
87
|
+
prof_file = self._engine_root / "src" / "config" / "profiles" / f"{profile}.json"
|
|
88
|
+
if not prof_file.exists():
|
|
89
|
+
return []
|
|
90
|
+
try:
|
|
91
|
+
data = json.loads(prof_file.read_text(encoding="utf-8"))
|
|
92
|
+
return data.get("capabilities", [])
|
|
93
|
+
except (OSError, json.JSONDecodeError):
|
|
94
|
+
return []
|
|
95
|
+
|
|
96
|
+
def _copy_profile(self, profile: str, agent_path: Path) -> None:
|
|
97
|
+
src = self._engine_root / "src" / "config" / "profiles" / f"{profile}.json"
|
|
98
|
+
if not src.exists():
|
|
99
|
+
return
|
|
100
|
+
dest_dir = agent_path / "src" / "config" / "profiles"
|
|
101
|
+
dest_dir.mkdir(parents=True, exist_ok=True)
|
|
102
|
+
shutil.copy2(src, dest_dir / f"{profile}.json")
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""higpertext Capability Manager — loads and lists capability definitions (Application)."""
|
|
2
|
+
from higpertext.kernel.config_paths import WORKSPACE_DIR_NAME
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import json
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class CapabilityManager:
|
|
10
|
+
def __init__(self, capabilities_dir: Path):
|
|
11
|
+
self.capabilities_dir = capabilities_dir
|
|
12
|
+
|
|
13
|
+
def _get_custom_capabilities_dir(self) -> Path:
|
|
14
|
+
project_root = Path(os.getcwd()).resolve()
|
|
15
|
+
return project_root / WORKSPACE_DIR_NAME / "capabilities"
|
|
16
|
+
|
|
17
|
+
def _get_all_capability_files(self) -> list:
|
|
18
|
+
files = list(self.capabilities_dir.rglob("*.json"))
|
|
19
|
+
custom_dir = self._get_custom_capabilities_dir()
|
|
20
|
+
if custom_dir.exists():
|
|
21
|
+
files.extend(custom_dir.rglob("*.json"))
|
|
22
|
+
return files
|
|
23
|
+
|
|
24
|
+
def load_capability(self, capability_id: str) -> dict:
|
|
25
|
+
custom_dir = self._get_custom_capabilities_dir()
|
|
26
|
+
for file in self._get_all_capability_files():
|
|
27
|
+
try:
|
|
28
|
+
with open(file, "r", encoding="utf-8") as f:
|
|
29
|
+
cap = json.load(f)
|
|
30
|
+
if (
|
|
31
|
+
cap.get("id") == capability_id
|
|
32
|
+
or cap.get("id", "").split(".")[-1] == capability_id
|
|
33
|
+
):
|
|
34
|
+
# Anota el directorio base para resolución de entrypoint
|
|
35
|
+
if custom_dir in file.parents:
|
|
36
|
+
cap.setdefault("_base_dir", str(file.parent))
|
|
37
|
+
return cap
|
|
38
|
+
except json.JSONDecodeError:
|
|
39
|
+
continue
|
|
40
|
+
raise FileNotFoundError(f"Capacidad no encontrada: {capability_id}")
|
|
41
|
+
|
|
42
|
+
def list_capabilities(self) -> list:
|
|
43
|
+
caps = []
|
|
44
|
+
for file in self._get_all_capability_files():
|
|
45
|
+
try:
|
|
46
|
+
with open(file, "r", encoding="utf-8") as f:
|
|
47
|
+
cap = json.load(f)
|
|
48
|
+
caps.append({"id": cap.get("id"), "name": cap.get("name")})
|
|
49
|
+
except json.JSONDecodeError:
|
|
50
|
+
continue
|
|
51
|
+
return caps
|
|
52
|
+
|
|
53
|
+
def get_all_capabilities_data(self) -> list:
|
|
54
|
+
caps = []
|
|
55
|
+
for file in self._get_all_capability_files():
|
|
56
|
+
try:
|
|
57
|
+
with open(file, "r", encoding="utf-8") as f:
|
|
58
|
+
caps.append(json.load(f))
|
|
59
|
+
except json.JSONDecodeError:
|
|
60
|
+
continue
|
|
61
|
+
return caps
|