claude-smart 0.2.41 → 0.2.43
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.
- package/.claude-plugin/marketplace.json +17 -0
- package/README.md +1 -1
- package/bin/claude-smart.js +86 -48
- package/package.json +10 -3
- package/plugin/.claude-plugin/plugin.json +9 -3
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/README.md +2 -2
- package/plugin/dashboard/next.config.ts +9 -1
- package/plugin/pyproject.toml +2 -2
- package/plugin/scripts/_lib.sh +91 -0
- package/plugin/scripts/backend-service.sh +46 -15
- package/plugin/scripts/cli.sh +29 -1
- package/plugin/scripts/codex-hook.js +72 -4
- package/plugin/scripts/dashboard-build.sh +1 -0
- package/plugin/scripts/dashboard-service.sh +1 -0
- package/plugin/scripts/ensure-plugin-root.sh +7 -14
- package/plugin/scripts/hook_entry.sh +1 -0
- package/plugin/scripts/smart-install.sh +18 -2
- package/plugin/src/claude_smart/cli.py +72 -38
- package/plugin/src/claude_smart/context_format.py +11 -12
- package/plugin/src/claude_smart/cs_cite.py +26 -12
- package/plugin/src/claude_smart/ids.py +13 -5
- package/plugin/uv.lock +1 -1
- package/plugin/vendor/reflexio/.env.example +53 -0
- package/plugin/vendor/reflexio/LICENSE +201 -0
- package/plugin/vendor/reflexio/README.md +338 -0
- package/plugin/vendor/reflexio/pyproject.toml +271 -0
- package/plugin/vendor/reflexio/reflexio/README.md +184 -0
- package/plugin/vendor/reflexio/reflexio/__init__.py +166 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/README.md +109 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/backends.py +175 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/bench.py +642 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/embed_cache.py +330 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/report.py +317 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/results/report.md +43 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/results/results.json +4478 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/scenarios.py +134 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/seed.py +255 -0
- package/plugin/vendor/reflexio/reflexio/cli/README.md +287 -0
- package/plugin/vendor/reflexio/reflexio/cli/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/cli/__main__.py +56 -0
- package/plugin/vendor/reflexio/reflexio/cli/_client.py +86 -0
- package/plugin/vendor/reflexio/reflexio/cli/app.py +127 -0
- package/plugin/vendor/reflexio/reflexio/cli/bootstrap_config.py +266 -0
- package/plugin/vendor/reflexio/reflexio/cli/codex_auth.py +503 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/admin_cmd.py +65 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/agent_playbooks.py +503 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/api.py +114 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/auth.py +109 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/config_cmd.py +511 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/doctor.py +127 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/embeddings.py +53 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/interactions.py +478 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/profiles.py +303 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/services.py +289 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/setup_cmd.py +961 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/shortcuts.py +285 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/status_cmd.py +143 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/user_playbooks.py +373 -0
- package/plugin/vendor/reflexio/reflexio/cli/env_loader.py +284 -0
- package/plugin/vendor/reflexio/reflexio/cli/errors.py +217 -0
- package/plugin/vendor/reflexio/reflexio/cli/log_format.py +247 -0
- package/plugin/vendor/reflexio/reflexio/cli/output.py +867 -0
- package/plugin/vendor/reflexio/reflexio/cli/paths.py +41 -0
- package/plugin/vendor/reflexio/reflexio/cli/run_services.py +391 -0
- package/plugin/vendor/reflexio/reflexio/cli/state.py +204 -0
- package/plugin/vendor/reflexio/reflexio/cli/stop_services.py +96 -0
- package/plugin/vendor/reflexio/reflexio/cli/utils.py +329 -0
- package/plugin/vendor/reflexio/reflexio/client/__init__.py +3 -0
- package/plugin/vendor/reflexio/reflexio/client/cache.py +150 -0
- package/plugin/vendor/reflexio/reflexio/client/client.py +2613 -0
- package/plugin/vendor/reflexio/reflexio/defaults.py +23 -0
- package/plugin/vendor/reflexio/reflexio/integrations/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/.clawhubignore +7 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/README.md +274 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/TESTING.md +517 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/hook/handler.js +473 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/package-lock.json +2156 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/package.json +18 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/hook/handler.ts +241 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/hook/setup.ts +140 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/index.ts +130 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/publish.ts +113 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/search.ts +52 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/server.ts +103 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/sqlite-buffer.ts +156 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/user-id.ts +134 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/openclaw.plugin.json +41 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/package.json +17 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/rules/reflexio.md +24 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/reflexio/SKILL.md +48 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/publish_clawhub.sh +278 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/references/HOOK.md +164 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/scripts/install.sh +36 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/scripts/uninstall.sh +35 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/publish.test.ts +27 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/search.test.ts +31 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/server.test.ts +42 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/setup.test.ts +49 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/sqlite-buffer.test.ts +91 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/user-id.test.ts +50 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tsconfig.json +16 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/types/openclaw.d.ts +230 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/vitest.config.ts +13 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/README.md +120 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/TESTING.md +168 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/package-lock.json +1657 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/package.json +16 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/HEARTBEAT.md +6 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/README.md +84 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/SKILL.md +194 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/_meta.json +6 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/agents/reflexio-extractor.md +45 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/hook/handler.ts +214 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/hook/setup.ts +55 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/index.ts +327 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/consolidate.ts +233 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/dedup.ts +80 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/io.ts +155 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/openclaw-cli.ts +67 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/search.ts +33 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/write-playbook.ts +76 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/write-profile.ts +79 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/openclaw.plugin.json +46 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/package.json +18 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/prompts/README.md +36 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/prompts/full_consolidation.md +56 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/prompts/playbook_extraction.md +217 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/prompts/profile_extraction.md +132 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/skills/reflexio-consolidate/SKILL.md +33 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/skills/reflexio-embedded/SKILL.md +194 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/references/HOOK.md +18 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/references/architecture.md +49 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/references/comparison.md +31 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/references/future-work.md +47 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/references/porting-notes.md +52 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/scripts/install.sh +52 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/scripts/uninstall.sh +36 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/consolidate.test.ts +135 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/dedup.test.ts +104 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/io.test.ts +175 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/search.test.ts +66 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/smoke-test.ts +140 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/write-playbook.test.ts +93 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/write-profile.test.ts +174 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tsconfig.json +16 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/types/openclaw.d.ts +230 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/vitest.config.ts +7 -0
- package/plugin/vendor/reflexio/reflexio/lib/__init__.py +23 -0
- package/plugin/vendor/reflexio/reflexio/lib/_agent_playbook.py +310 -0
- package/plugin/vendor/reflexio/reflexio/lib/_base.py +225 -0
- package/plugin/vendor/reflexio/reflexio/lib/_config.py +83 -0
- package/plugin/vendor/reflexio/reflexio/lib/_dashboard.py +266 -0
- package/plugin/vendor/reflexio/reflexio/lib/_generation.py +176 -0
- package/plugin/vendor/reflexio/reflexio/lib/_interactions.py +334 -0
- package/plugin/vendor/reflexio/reflexio/lib/_operations.py +153 -0
- package/plugin/vendor/reflexio/reflexio/lib/_profiles.py +545 -0
- package/plugin/vendor/reflexio/reflexio/lib/_reflection.py +52 -0
- package/plugin/vendor/reflexio/reflexio/lib/_search.py +167 -0
- package/plugin/vendor/reflexio/reflexio/lib/_storage_labels.py +103 -0
- package/plugin/vendor/reflexio/reflexio/lib/_user_playbook.py +288 -0
- package/plugin/vendor/reflexio/reflexio/lib/reflexio_lib.py +27 -0
- package/plugin/vendor/reflexio/reflexio/models/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/braintrust_schema.py +141 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/common.py +41 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/__init__.py +3 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/entities.py +1103 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/enums.py +63 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/eval_overview_schema.py +487 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/internal_schema.py +28 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/pending_tool_call_schema.py +83 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/retriever_schema.py +766 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/service_schemas.py +9 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/stall_state_schema.py +32 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/__init__.py +3 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/converters.py +177 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/entities.py +129 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/enums.py +25 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/validators.py +280 -0
- package/plugin/vendor/reflexio/reflexio/models/config_schema.py +908 -0
- package/plugin/vendor/reflexio/reflexio/models/py.typed +0 -0
- package/plugin/vendor/reflexio/reflexio/server/OVERVIEW.md +90 -0
- package/plugin/vendor/reflexio/reflexio/server/README.md +616 -0
- package/plugin/vendor/reflexio/reflexio/server/__init__.py +210 -0
- package/plugin/vendor/reflexio/reflexio/server/__main__.py +132 -0
- package/plugin/vendor/reflexio/reflexio/server/_auth.py +25 -0
- package/plugin/vendor/reflexio/reflexio/server/api.py +2714 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/account_api.py +143 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/health_api.py +91 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/pending_tool_call_api.py +572 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/precondition_checks.py +66 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/publisher_api.py +540 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/request_context.py +50 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/stall_state_api.py +100 -0
- package/plugin/vendor/reflexio/reflexio/server/cache/__init__.py +15 -0
- package/plugin/vendor/reflexio/reflexio/server/cache/reflexio_cache.py +208 -0
- package/plugin/vendor/reflexio/reflexio/server/correlation.py +46 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/__init__.py +30 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/embedding_service.py +110 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/image_utils.py +55 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/litellm_client.py +1595 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/llm_utils.py +112 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/model_defaults.py +469 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/claude_code_provider.py +1122 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/claude_code_stream_parser.py +197 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/embedding_service_provider.py +210 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/local_embedding_provider.py +213 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/nomic_embedding_provider.py +255 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/rerank/__init__.py +6 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/rerank/cross_encoder_reranker.py +177 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/rerank/llm_reranker.py +148 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/tools.py +699 -0
- package/plugin/vendor/reflexio/reflexio/server/operation_limiter.py +179 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/_dispatchers.py +54 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/README.md +121 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/agent_success_evaluation/v1.0.0.prompt.md +58 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/agent_success_evaluation_with_comparison/v1.0.0.prompt.md +76 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/answer_synthesis/v1.5.2.prompt.md +88 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/compress_session_for_query/v1.3.0.prompt.md +31 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/document_expansion/v1.0.0.prompt.md +20 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.0.0.prompt.md +53 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.1.0.prompt.md +57 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.2.0.prompt.md +68 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.3.0.prompt.md +70 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.4.0.prompt.md +77 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.5.0.prompt.md +82 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.6.0.prompt.md +83 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_aggregation/v2.1.0.prompt.md +193 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_aggregation/v2.2.0.prompt.md +206 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v1.0.0-deprecated.prompt.md +66 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v1.0.0.prompt.md +43 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v1.1.0.prompt.md +46 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.0.0-deprecated.prompt.md +64 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.0.0.prompt.md +39 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.1.0.prompt.md +39 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.2.0.prompt.md +47 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.3.0.prompt.md +58 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.0.2.prompt.md +254 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.1.0.prompt.md +274 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.2.0.prompt.md +279 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v1.0.0.prompt.md +73 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v2.0.0.prompt.md +86 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.0.0.prompt.md +97 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.1.0.prompt.md +119 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.2.0.prompt.md +123 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.3.0.prompt.md +127 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main/v1.0.0.prompt.md +14 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main/v1.1.0.prompt.md +24 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main/v1.2.0.prompt.md +29 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main_expert/v1.0.0.prompt.md +11 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main_expert/v1.1.0.prompt.md +21 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main_expert/v1.2.0.prompt.md +25 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_optimizer_judge/v1.0.0.prompt.md +37 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_optimizer_judge/v1.1.0.prompt.md +40 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_optimizer_judge/v1.2.0.prompt.md +36 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_should_generate/v1.0.0.prompt.md +45 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_should_generate/v2.0.0.prompt.md +81 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_should_generate/v3.0.0.prompt.md +80 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_should_generate_expert/v1.0.0.prompt.md +34 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_deduplication/v1.0.0.prompt.md +116 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_should_generate/v1.0.0.prompt.md +33 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_should_generate_override/v1.0.0.prompt.md +16 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_instruction_start/v1.0.0.prompt.md +140 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_instruction_start/v1.1.0.prompt.md +160 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_main/v1.0.0.prompt.md +14 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/query_reformulation/v1.0.0.prompt.md +19 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/rerank_relevance/v1.1.0.prompt.md +44 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/shadow_comparison/v1.0.0.prompt.md +43 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/shadow_content_evaluation/v1.0.0.prompt.md +33 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_evaluation/prompt_evaluation_dataset/feedback_extraction_main_v1.jsonl +10 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_evaluation/prompt_evaluation_dataset/profile_update_main_v1.jsonl +10 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_manager.py +280 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_schema.py +11 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/_eval_health.py +131 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluation_constants.py +60 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluation_service.py +228 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluation_utils.py +87 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluator.py +372 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/delayed_group_evaluator.py +156 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/group_evaluation_runner.py +340 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/regen_jobs.py +471 -0
- package/plugin/vendor/reflexio/reflexio/server/services/base_generation_service.py +1626 -0
- package/plugin/vendor/reflexio/reflexio/server/services/braintrust/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/braintrust/_cron.py +196 -0
- package/plugin/vendor/reflexio/reflexio/server/services/braintrust/_encryption.py +101 -0
- package/plugin/vendor/reflexio/reflexio/server/services/braintrust/client.py +167 -0
- package/plugin/vendor/reflexio/reflexio/server/services/braintrust/service.py +281 -0
- package/plugin/vendor/reflexio/reflexio/server/services/configurator/base_configurator.py +179 -0
- package/plugin/vendor/reflexio/reflexio/server/services/configurator/config_storage.py +62 -0
- package/plugin/vendor/reflexio/reflexio/server/services/configurator/configurator.py +87 -0
- package/plugin/vendor/reflexio/reflexio/server/services/configurator/local_file_config_storage.py +187 -0
- package/plugin/vendor/reflexio/reflexio/server/services/configurator/test_config_storage.py +162 -0
- package/plugin/vendor/reflexio/reflexio/server/services/deduplication_utils.py +112 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/distribution.py +33 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/eval_sampler.py +126 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/group_aggregation.py +192 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/hero_state.py +75 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/rule_attribution.py +97 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/service.py +515 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/shadow_aggregation.py +90 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/agent_run_records.py +91 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/invariants.py +303 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/outcome.py +25 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/pending_tool_call_dispatch.py +351 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/plan.py +138 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/prior_answer_search.py +217 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/resumable_agent.py +468 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/resume_scheduler.py +171 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/resume_worker.py +777 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/tools.py +1125 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extractor_config_utils.py +91 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extractor_interaction_utils.py +251 -0
- package/plugin/vendor/reflexio/reflexio/server/services/generation_service.py +689 -0
- package/plugin/vendor/reflexio/reflexio/server/services/operation_state_utils.py +835 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/README.md +89 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_aggregator.py +1388 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_consolidator.py +960 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_extractor.py +436 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_generation_service.py +808 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_service_constants.py +28 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_service_utils.py +362 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/__init__.py +24 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/assistant_webhook.py +246 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/gepa_adapter.py +291 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/judge.py +97 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/models.py +96 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/optimizer.py +645 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/rollout.py +35 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/scenario_resolver.py +93 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/scheduler.py +174 -0
- package/plugin/vendor/reflexio/reflexio/server/services/pre_retrieval/__init__.py +26 -0
- package/plugin/vendor/reflexio/reflexio/server/services/pre_retrieval/_document_expander.py +179 -0
- package/plugin/vendor/reflexio/reflexio/server/services/pre_retrieval/_query_reformulator.py +297 -0
- package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_deduplicator.py +741 -0
- package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_extractor.py +462 -0
- package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_generation_service.py +734 -0
- package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_generation_service_utils.py +290 -0
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/__init__.py +17 -0
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/reflection_extractor.py +247 -0
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/reflection_service.py +800 -0
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/reflection_service_utils.py +146 -0
- package/plugin/vendor/reflexio/reflexio/server/services/retrieval/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/retrieval/relevance_floor.py +70 -0
- package/plugin/vendor/reflexio/reflexio/server/services/search/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/service_utils.py +671 -0
- package/plugin/vendor/reflexio/reflexio/server/services/shadow_comparison/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/server/services/shadow_comparison/judge.py +184 -0
- package/plugin/vendor/reflexio/reflexio/server/services/shadow_comparison/outcome.py +81 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/constants.py +2 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/error.py +11 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/retention.py +154 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/retention_mixin.py +155 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/__init__.py +59 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_agent_run.py +1253 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_base.py +1945 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_extras.py +600 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_operations.py +346 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_playbook.py +1378 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_profiles.py +747 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_requests.py +263 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_shadow_verdicts.py +193 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_share_links.py +166 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_stall_state.py +217 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/__init__.py +153 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_agent_run.py +372 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_base.py +71 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_extras.py +235 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_operations.py +170 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_playbook.py +677 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_profiles.py +250 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_requests.py +154 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_shadow_verdicts.py +130 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_share_links.py +93 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_stall_state.py +76 -0
- package/plugin/vendor/reflexio/reflexio/server/services/unified_search_service.py +568 -0
- package/plugin/vendor/reflexio/reflexio/server/site_var/README.md +77 -0
- package/plugin/vendor/reflexio/reflexio/server/site_var/feature_flags.py +116 -0
- package/plugin/vendor/reflexio/reflexio/server/site_var/site_var_manager.py +263 -0
- package/plugin/vendor/reflexio/reflexio/server/site_var/site_var_sources/feature_flags.json +13 -0
- package/plugin/vendor/reflexio/reflexio/server/site_var/site_var_sources/llm_model_setting.json +7 -0
- package/plugin/vendor/reflexio/reflexio/server/tracing.py +158 -0
- package/plugin/vendor/reflexio/reflexio/server/usage_metrics.py +113 -0
- package/plugin/vendor/reflexio/reflexio/server/uvicorn_logging.py +76 -0
- package/plugin/vendor/reflexio/reflexio/test_support/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/test_support/llm_fixtures.py +62 -0
- package/plugin/vendor/reflexio/reflexio/test_support/llm_mock.py +242 -0
- package/plugin/vendor/reflexio/reflexio/test_support/llm_model_registry.py +129 -0
- package/plugin/vendor/reflexio/reflexio/test_support/skip_decorators.py +43 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"""Authentication and configuration setup commands."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
from typing import Annotated
|
|
7
|
+
|
|
8
|
+
import typer
|
|
9
|
+
|
|
10
|
+
from reflexio.cli.env_loader import get_env_path, set_env_var
|
|
11
|
+
from reflexio.cli.errors import handle_errors
|
|
12
|
+
from reflexio.cli.output import mask_api_key, print_auth_status, render
|
|
13
|
+
|
|
14
|
+
app = typer.Typer(help="Authentication and configuration setup.")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@app.command()
|
|
18
|
+
@handle_errors
|
|
19
|
+
def login(
|
|
20
|
+
ctx: typer.Context,
|
|
21
|
+
api_key: Annotated[
|
|
22
|
+
str | None,
|
|
23
|
+
typer.Option("--api-key", help="Reflexio API key"),
|
|
24
|
+
] = None,
|
|
25
|
+
server_url: Annotated[
|
|
26
|
+
str | None,
|
|
27
|
+
typer.Option("--server-url", help="Backend API server URL"),
|
|
28
|
+
] = None,
|
|
29
|
+
) -> None:
|
|
30
|
+
"""Save authentication credentials to ~/.reflexio/.env.
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
ctx: Typer context with CliState in ctx.obj
|
|
34
|
+
api_key: API key to store
|
|
35
|
+
server_url: Backend API server URL to store
|
|
36
|
+
"""
|
|
37
|
+
if not server_url and not api_key:
|
|
38
|
+
typer.echo("Nothing saved — provide --api-key and/or --server-url.")
|
|
39
|
+
return
|
|
40
|
+
|
|
41
|
+
env_path = get_env_path()
|
|
42
|
+
env_path.parent.mkdir(parents=True, exist_ok=True)
|
|
43
|
+
|
|
44
|
+
if server_url:
|
|
45
|
+
set_env_var(env_path, "REFLEXIO_URL", server_url)
|
|
46
|
+
if api_key:
|
|
47
|
+
set_env_var(env_path, "REFLEXIO_API_KEY", api_key)
|
|
48
|
+
|
|
49
|
+
json_mode: bool = ctx.obj.json_mode
|
|
50
|
+
if json_mode:
|
|
51
|
+
render({"env_path": str(env_path)}, json_mode=True)
|
|
52
|
+
else:
|
|
53
|
+
print(f"Credentials saved to {env_path}")
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@app.command()
|
|
57
|
+
@handle_errors
|
|
58
|
+
def status(
|
|
59
|
+
ctx: typer.Context,
|
|
60
|
+
) -> None:
|
|
61
|
+
"""Show current authentication status from environment.
|
|
62
|
+
|
|
63
|
+
Args:
|
|
64
|
+
ctx: Typer context with CliState in ctx.obj
|
|
65
|
+
"""
|
|
66
|
+
env_path = get_env_path()
|
|
67
|
+
env_exists = env_path.exists()
|
|
68
|
+
raw_key = os.environ.get("REFLEXIO_API_KEY", "")
|
|
69
|
+
raw_url = os.environ.get("REFLEXIO_URL", "")
|
|
70
|
+
|
|
71
|
+
json_mode: bool = ctx.obj.json_mode
|
|
72
|
+
if json_mode:
|
|
73
|
+
render(
|
|
74
|
+
{
|
|
75
|
+
"url": raw_url,
|
|
76
|
+
"api_key": mask_api_key(raw_key),
|
|
77
|
+
"env_path": str(env_path),
|
|
78
|
+
"env_exists": env_exists,
|
|
79
|
+
},
|
|
80
|
+
json_mode=True,
|
|
81
|
+
)
|
|
82
|
+
else:
|
|
83
|
+
print_auth_status(
|
|
84
|
+
url=raw_url,
|
|
85
|
+
api_key=raw_key,
|
|
86
|
+
env_path=str(env_path),
|
|
87
|
+
env_exists=env_exists,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
@app.command()
|
|
92
|
+
@handle_errors
|
|
93
|
+
def logout(
|
|
94
|
+
ctx: typer.Context,
|
|
95
|
+
) -> None:
|
|
96
|
+
"""Remove stored credentials by deleting the .env file.
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
ctx: Typer context with CliState in ctx.obj
|
|
100
|
+
"""
|
|
101
|
+
env_path = get_env_path()
|
|
102
|
+
if env_path.exists():
|
|
103
|
+
env_path.unlink()
|
|
104
|
+
|
|
105
|
+
json_mode: bool = ctx.obj.json_mode
|
|
106
|
+
if json_mode:
|
|
107
|
+
render({"message": "Logged out"}, json_mode=True)
|
|
108
|
+
else:
|
|
109
|
+
print("Logged out. Env file removed.")
|
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
"""Configuration management commands (show, set, storage, pull)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import TYPE_CHECKING, Annotated
|
|
8
|
+
|
|
9
|
+
import typer
|
|
10
|
+
|
|
11
|
+
from reflexio.cli.errors import EXIT_NETWORK, EXIT_VALIDATION, CliError, handle_errors
|
|
12
|
+
from reflexio.cli.output import (
|
|
13
|
+
print_error,
|
|
14
|
+
print_info,
|
|
15
|
+
print_storage_credentials,
|
|
16
|
+
render,
|
|
17
|
+
)
|
|
18
|
+
from reflexio.cli.state import get_client
|
|
19
|
+
from reflexio.lib._storage_labels import mask_secret, mask_url
|
|
20
|
+
from reflexio.models.api_schema.service_schemas import MyConfigResponse
|
|
21
|
+
|
|
22
|
+
if TYPE_CHECKING:
|
|
23
|
+
from reflexio.client.client import ReflexioClient
|
|
24
|
+
|
|
25
|
+
app = typer.Typer(help="View and update server configuration.")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _resolve_data(data: str) -> dict:
|
|
29
|
+
"""Resolve a JSON data string, supporting @filepath syntax.
|
|
30
|
+
|
|
31
|
+
If the string starts with '@', reads the file at the given path
|
|
32
|
+
and parses it as JSON. Otherwise, parses the string directly.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
data: JSON string or @filepath reference
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
dict: Parsed configuration data
|
|
39
|
+
"""
|
|
40
|
+
if data.startswith("@"):
|
|
41
|
+
return json.loads(Path(data[1:]).read_text())
|
|
42
|
+
return json.loads(data)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@app.command()
|
|
46
|
+
@handle_errors
|
|
47
|
+
def show(
|
|
48
|
+
ctx: typer.Context,
|
|
49
|
+
show_all: Annotated[
|
|
50
|
+
bool,
|
|
51
|
+
typer.Option(
|
|
52
|
+
"--all",
|
|
53
|
+
help="Show all fields including unset optional settings with defaults",
|
|
54
|
+
),
|
|
55
|
+
] = False,
|
|
56
|
+
) -> None:
|
|
57
|
+
"""Show current server configuration.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
ctx: Typer context with CliState in ctx.obj
|
|
61
|
+
show_all: If True, include all fields (even None/default) in output
|
|
62
|
+
"""
|
|
63
|
+
from reflexio.cli.bootstrap_config import default_config_path
|
|
64
|
+
|
|
65
|
+
client = get_client(ctx)
|
|
66
|
+
resp = client.get_config()
|
|
67
|
+
|
|
68
|
+
config_path = default_config_path()
|
|
69
|
+
config_exists = config_path.exists()
|
|
70
|
+
# `MyConfigResponse` owns the `data` envelope field, so local-file
|
|
71
|
+
# state ships under `meta` for this command — unlike `config local`
|
|
72
|
+
# and `auth status`, where the file path IS the primary data.
|
|
73
|
+
local_config_meta = {
|
|
74
|
+
"path": str(config_path),
|
|
75
|
+
"exists": config_exists,
|
|
76
|
+
"using_defaults": not config_exists,
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
json_mode: bool = ctx.obj.json_mode
|
|
80
|
+
if json_mode:
|
|
81
|
+
render(
|
|
82
|
+
resp,
|
|
83
|
+
json_mode=True,
|
|
84
|
+
exclude_none=not show_all,
|
|
85
|
+
meta={"local_config": local_config_meta},
|
|
86
|
+
)
|
|
87
|
+
else:
|
|
88
|
+
config_data = (
|
|
89
|
+
resp.model_dump(mode="json", exclude_none=not show_all)
|
|
90
|
+
if hasattr(resp, "model_dump")
|
|
91
|
+
else resp
|
|
92
|
+
)
|
|
93
|
+
suffix = "" if config_exists else " (not found — showing defaults)"
|
|
94
|
+
print_info(f"Local config file: {config_path}{suffix}")
|
|
95
|
+
print_info("Server configuration:")
|
|
96
|
+
print(json.dumps(config_data, indent=2, default=str))
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
@app.command(name="local")
|
|
100
|
+
@handle_errors
|
|
101
|
+
def show_local(ctx: typer.Context) -> None:
|
|
102
|
+
"""Show locally persisted settings (no server required).
|
|
103
|
+
|
|
104
|
+
Reads the local config file and resolves the effective storage backend
|
|
105
|
+
using the priority chain: CLI flag > env var > config file > default.
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
ctx: Typer context with CliState in ctx.obj
|
|
109
|
+
"""
|
|
110
|
+
from reflexio.cli.bootstrap_config import (
|
|
111
|
+
default_config_path,
|
|
112
|
+
load_storage_from_config,
|
|
113
|
+
resolve_storage,
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
persisted = load_storage_from_config()
|
|
117
|
+
resolved = resolve_storage(None) # full resolution without CLI flag
|
|
118
|
+
config_path = default_config_path()
|
|
119
|
+
config_exists = config_path.exists()
|
|
120
|
+
resolved_mode = "local" if resolved == "sqlite" else "cloud"
|
|
121
|
+
|
|
122
|
+
json_mode: bool = ctx.obj.json_mode
|
|
123
|
+
|
|
124
|
+
data = {
|
|
125
|
+
"config_file": str(config_path),
|
|
126
|
+
"config_file_exists": config_exists,
|
|
127
|
+
"persisted_storage": persisted,
|
|
128
|
+
"resolved_storage": resolved,
|
|
129
|
+
"resolved_mode": resolved_mode,
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if json_mode:
|
|
133
|
+
render(data, json_mode=True)
|
|
134
|
+
else:
|
|
135
|
+
path_suffix = "" if config_exists else " (not found — showing defaults)"
|
|
136
|
+
persisted_label = persisted or "(not set)"
|
|
137
|
+
resolved_suffix = " (default)" if persisted is None else ""
|
|
138
|
+
print_info(f"Config file: {config_path}{path_suffix}")
|
|
139
|
+
print_info(f"Persisted storage: {persisted_label}")
|
|
140
|
+
print_info(
|
|
141
|
+
f"Resolved storage: {resolved} (mode: {resolved_mode}){resolved_suffix}"
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
@app.command(name="set")
|
|
146
|
+
@handle_errors
|
|
147
|
+
def set_config(
|
|
148
|
+
ctx: typer.Context,
|
|
149
|
+
data: Annotated[
|
|
150
|
+
str | None,
|
|
151
|
+
typer.Option("--data", help="JSON string or @filepath with config data"),
|
|
152
|
+
] = None,
|
|
153
|
+
file: Annotated[
|
|
154
|
+
Path | None,
|
|
155
|
+
typer.Option("--file", help="Path to JSON config file"),
|
|
156
|
+
] = None,
|
|
157
|
+
) -> None:
|
|
158
|
+
"""Update server configuration.
|
|
159
|
+
|
|
160
|
+
Provide configuration data via --data (inline JSON or @filepath) or --file.
|
|
161
|
+
|
|
162
|
+
Args:
|
|
163
|
+
ctx: Typer context with CliState in ctx.obj
|
|
164
|
+
data: JSON string or @filepath with configuration data
|
|
165
|
+
file: Path to a JSON configuration file
|
|
166
|
+
"""
|
|
167
|
+
if not data and not file:
|
|
168
|
+
raise CliError(
|
|
169
|
+
error_type="validation",
|
|
170
|
+
message="Must provide either --data or --file",
|
|
171
|
+
hint="Use --data '{...}' or --data @path/to/config.json or --file path/to/config.json",
|
|
172
|
+
exit_code=EXIT_VALIDATION,
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
if data and file:
|
|
176
|
+
raise CliError(
|
|
177
|
+
error_type="validation",
|
|
178
|
+
message="Cannot provide both --data and --file",
|
|
179
|
+
exit_code=EXIT_VALIDATION,
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
try:
|
|
183
|
+
if data:
|
|
184
|
+
config_data = _resolve_data(data)
|
|
185
|
+
else:
|
|
186
|
+
assert file is not None # guaranteed by guard above # noqa: S101
|
|
187
|
+
config_data = json.loads(file.read_text())
|
|
188
|
+
except (json.JSONDecodeError, FileNotFoundError, OSError) as exc:
|
|
189
|
+
raise CliError(
|
|
190
|
+
error_type="validation",
|
|
191
|
+
message=f"Failed to parse config data: {exc}",
|
|
192
|
+
exit_code=EXIT_VALIDATION,
|
|
193
|
+
) from exc
|
|
194
|
+
|
|
195
|
+
client = get_client(ctx)
|
|
196
|
+
resp = client.set_config(config_data)
|
|
197
|
+
|
|
198
|
+
json_mode: bool = ctx.obj.json_mode
|
|
199
|
+
if json_mode:
|
|
200
|
+
render(resp, json_mode=True)
|
|
201
|
+
else:
|
|
202
|
+
print_info("Configuration updated")
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def _build_partial_from_fields(fields: list[str]) -> dict:
|
|
206
|
+
"""Parse repeated ``--field name=value`` pairs into a partial dict.
|
|
207
|
+
|
|
208
|
+
Plain values are kept as strings. Use the ``:json:`` prefix to pass
|
|
209
|
+
a JSON literal (numbers, booleans, null, arrays, objects). Names
|
|
210
|
+
may include exactly one ``.`` to set a single-level nested key —
|
|
211
|
+
multiple dotted entries with the same top-level key merge into the
|
|
212
|
+
same dict. Deeper nesting is intentionally not supported; use
|
|
213
|
+
``--data`` for arbitrary JSON.
|
|
214
|
+
|
|
215
|
+
Args:
|
|
216
|
+
fields: List of ``name=value`` (or ``a.b=value``) strings.
|
|
217
|
+
|
|
218
|
+
Returns:
|
|
219
|
+
dict: Top-level partial dict ready to ship to ``update_config``.
|
|
220
|
+
|
|
221
|
+
Raises:
|
|
222
|
+
CliError: For malformed inputs (missing ``=``, more than one
|
|
223
|
+
dot, conflicting top-level keys, invalid JSON literal).
|
|
224
|
+
"""
|
|
225
|
+
partial: dict = {}
|
|
226
|
+
for spec in fields:
|
|
227
|
+
if "=" not in spec:
|
|
228
|
+
raise CliError(
|
|
229
|
+
error_type="validation",
|
|
230
|
+
message=f"--field expects 'name=value', got: {spec!r}",
|
|
231
|
+
exit_code=EXIT_VALIDATION,
|
|
232
|
+
)
|
|
233
|
+
name, _, value_str = spec.partition("=")
|
|
234
|
+
if value_str.startswith(":json:"):
|
|
235
|
+
try:
|
|
236
|
+
value: object = json.loads(value_str[len(":json:") :])
|
|
237
|
+
except json.JSONDecodeError as exc:
|
|
238
|
+
raise CliError(
|
|
239
|
+
error_type="validation",
|
|
240
|
+
message=f"--field {name}: invalid JSON value: {exc}",
|
|
241
|
+
exit_code=EXIT_VALIDATION,
|
|
242
|
+
) from exc
|
|
243
|
+
else:
|
|
244
|
+
value = value_str
|
|
245
|
+
if "." in name:
|
|
246
|
+
top, _, child = name.partition(".")
|
|
247
|
+
if "." in child:
|
|
248
|
+
raise CliError(
|
|
249
|
+
error_type="validation",
|
|
250
|
+
message=(
|
|
251
|
+
f"--field supports at most one dot in name (got {name!r}); "
|
|
252
|
+
"for deeper nesting use --data"
|
|
253
|
+
),
|
|
254
|
+
exit_code=EXIT_VALIDATION,
|
|
255
|
+
)
|
|
256
|
+
existing = partial.setdefault(top, {})
|
|
257
|
+
if not isinstance(existing, dict):
|
|
258
|
+
raise CliError(
|
|
259
|
+
error_type="validation",
|
|
260
|
+
message=(
|
|
261
|
+
f"--field {name}: conflicts with prior --field {top}=<scalar>"
|
|
262
|
+
),
|
|
263
|
+
exit_code=EXIT_VALIDATION,
|
|
264
|
+
)
|
|
265
|
+
existing[child] = value
|
|
266
|
+
else:
|
|
267
|
+
if isinstance(partial.get(name), dict):
|
|
268
|
+
raise CliError(
|
|
269
|
+
error_type="validation",
|
|
270
|
+
message=(
|
|
271
|
+
f"--field {name}: conflicts with prior --field "
|
|
272
|
+
f"{name}.<child>=..."
|
|
273
|
+
),
|
|
274
|
+
exit_code=EXIT_VALIDATION,
|
|
275
|
+
)
|
|
276
|
+
partial[name] = value
|
|
277
|
+
return partial
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
@app.command(name="update")
|
|
281
|
+
@handle_errors
|
|
282
|
+
def update_config(
|
|
283
|
+
ctx: typer.Context,
|
|
284
|
+
data: Annotated[
|
|
285
|
+
str | None,
|
|
286
|
+
typer.Option(
|
|
287
|
+
"--data", help="JSON string or @filepath with partial config data"
|
|
288
|
+
),
|
|
289
|
+
] = None,
|
|
290
|
+
file: Annotated[
|
|
291
|
+
Path | None,
|
|
292
|
+
typer.Option("--file", help="Path to JSON file with partial config"),
|
|
293
|
+
] = None,
|
|
294
|
+
fields: Annotated[
|
|
295
|
+
list[str] | None,
|
|
296
|
+
typer.Option(
|
|
297
|
+
"--field",
|
|
298
|
+
help=(
|
|
299
|
+
"Set a single field as 'name=value'. Repeatable. Use "
|
|
300
|
+
"':json:' prefix for numeric/bool/null. Use 'a.b' for "
|
|
301
|
+
"one level of nesting."
|
|
302
|
+
),
|
|
303
|
+
),
|
|
304
|
+
] = None,
|
|
305
|
+
) -> None:
|
|
306
|
+
"""Apply a partial update to the org config (PATCH-style).
|
|
307
|
+
|
|
308
|
+
Unlike ``set``, this does a server-side merge with the existing
|
|
309
|
+
config — you only specify the fields you want to change. Useful for
|
|
310
|
+
flipping a single backend without re-supplying ``storage_config``.
|
|
311
|
+
|
|
312
|
+
.. warning::
|
|
313
|
+
The merge is **top-level shallow only**. Nested objects (e.g.
|
|
314
|
+
``storage_config``, ``profile_extractor_config``,
|
|
315
|
+
``user_playbook_extractor_config``) are replaced wholesale -- to mutate
|
|
316
|
+
a field inside either extractor config you must resend that extractor
|
|
317
|
+
object fully populated. For surgical nested edits prefer
|
|
318
|
+
``reflexio config get`` -> edit JSON -> ``reflexio config set``.
|
|
319
|
+
|
|
320
|
+
Args:
|
|
321
|
+
ctx: Typer context with CliState in ctx.obj
|
|
322
|
+
data: JSON string or ``@filepath`` with the partial config payload.
|
|
323
|
+
file: Path to a JSON file with the partial config payload.
|
|
324
|
+
fields: Repeatable ``name=value`` pairs (see ``_build_partial_from_fields``).
|
|
325
|
+
"""
|
|
326
|
+
sources_present = sum(x is not None for x in (data, file, fields))
|
|
327
|
+
if sources_present == 0:
|
|
328
|
+
raise CliError(
|
|
329
|
+
error_type="validation",
|
|
330
|
+
message="Must provide one of --data, --file, or one or more --field",
|
|
331
|
+
hint=(
|
|
332
|
+
"Examples: --data '{\"shadow_mode_enabled\":true}' | "
|
|
333
|
+
"--file partial.json | --field skip_should_run_check=true"
|
|
334
|
+
),
|
|
335
|
+
exit_code=EXIT_VALIDATION,
|
|
336
|
+
)
|
|
337
|
+
if sources_present > 1:
|
|
338
|
+
raise CliError(
|
|
339
|
+
error_type="validation",
|
|
340
|
+
message="Cannot mix --data / --file / --field",
|
|
341
|
+
exit_code=EXIT_VALIDATION,
|
|
342
|
+
)
|
|
343
|
+
|
|
344
|
+
try:
|
|
345
|
+
if data is not None:
|
|
346
|
+
partial = _resolve_data(data)
|
|
347
|
+
elif file is not None:
|
|
348
|
+
partial = json.loads(file.read_text())
|
|
349
|
+
else:
|
|
350
|
+
assert fields is not None # noqa: S101 - guard above
|
|
351
|
+
partial = _build_partial_from_fields(fields)
|
|
352
|
+
except (json.JSONDecodeError, FileNotFoundError, OSError) as exc:
|
|
353
|
+
raise CliError(
|
|
354
|
+
error_type="validation",
|
|
355
|
+
message=f"Failed to parse config data: {exc}",
|
|
356
|
+
exit_code=EXIT_VALIDATION,
|
|
357
|
+
) from exc
|
|
358
|
+
|
|
359
|
+
if not isinstance(partial, dict):
|
|
360
|
+
raise CliError(
|
|
361
|
+
error_type="validation",
|
|
362
|
+
message="Partial config must be a JSON object",
|
|
363
|
+
exit_code=EXIT_VALIDATION,
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
client = get_client(ctx)
|
|
367
|
+
resp = client.update_config(partial)
|
|
368
|
+
|
|
369
|
+
json_mode: bool = ctx.obj.json_mode
|
|
370
|
+
if json_mode:
|
|
371
|
+
render(resp, json_mode=True)
|
|
372
|
+
else:
|
|
373
|
+
print_info("Configuration updated")
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
# ---------------------------------------------------------------------------
|
|
377
|
+
# Storage credential inspection / pull (backed by GET /api/my_config)
|
|
378
|
+
# ---------------------------------------------------------------------------
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
def _mask_storage_config(storage_config: dict) -> dict:
|
|
382
|
+
"""Return a masked copy of a serialized StorageConfig.
|
|
383
|
+
|
|
384
|
+
Keeps field names + structure intact so users can see *which* fields
|
|
385
|
+
are set without exposing the secret material. URL-like values go
|
|
386
|
+
through :func:`mask_url`, everything else through :func:`mask_secret`.
|
|
387
|
+
"""
|
|
388
|
+
masked: dict = {}
|
|
389
|
+
for key, value in storage_config.items():
|
|
390
|
+
if value is None:
|
|
391
|
+
masked[key] = None
|
|
392
|
+
elif not isinstance(value, str):
|
|
393
|
+
masked[key] = value
|
|
394
|
+
elif "url" in key.lower() or "://" in value:
|
|
395
|
+
masked[key] = mask_url(value)
|
|
396
|
+
else:
|
|
397
|
+
masked[key] = mask_secret(value)
|
|
398
|
+
return masked
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
def _fetch_my_config(client: ReflexioClient) -> MyConfigResponse:
|
|
402
|
+
"""Call ``client.get_my_config()`` and wrap any failure in a CliError.
|
|
403
|
+
|
|
404
|
+
``reflexio config storage`` hits the ``GET /api/my_config`` endpoint and
|
|
405
|
+
needs uniform error framing on transport failures, so we centralise the
|
|
406
|
+
try/except here.
|
|
407
|
+
|
|
408
|
+
Args:
|
|
409
|
+
client: A configured ``ReflexioClient`` instance.
|
|
410
|
+
|
|
411
|
+
Returns:
|
|
412
|
+
MyConfigResponse: The server's response on success.
|
|
413
|
+
|
|
414
|
+
Raises:
|
|
415
|
+
CliError: When the underlying HTTP call raises. 404 is framed
|
|
416
|
+
as "the server doesn't expose this endpoint yet";
|
|
417
|
+
everything else is a generic network error.
|
|
418
|
+
"""
|
|
419
|
+
import requests
|
|
420
|
+
|
|
421
|
+
try:
|
|
422
|
+
return client.get_my_config()
|
|
423
|
+
except requests.HTTPError as exc:
|
|
424
|
+
if exc.response is not None and exc.response.status_code == 404:
|
|
425
|
+
raise CliError(
|
|
426
|
+
error_type="api",
|
|
427
|
+
message=(
|
|
428
|
+
f"{client.base_url}/api/my_config returned 404 — the "
|
|
429
|
+
"server is reachable but doesn't expose this endpoint."
|
|
430
|
+
),
|
|
431
|
+
hint=(
|
|
432
|
+
"The backend may be running a version that "
|
|
433
|
+
"predates '/api/my_config'. Ask the server "
|
|
434
|
+
"operator to upgrade, or point REFLEXIO_URL at a "
|
|
435
|
+
"deployment that exposes this endpoint."
|
|
436
|
+
),
|
|
437
|
+
exit_code=EXIT_NETWORK,
|
|
438
|
+
) from exc
|
|
439
|
+
raise CliError(
|
|
440
|
+
error_type="network",
|
|
441
|
+
message=f"Failed to reach {client.base_url}/api/my_config: {exc}",
|
|
442
|
+
hint="Confirm REFLEXIO_URL + REFLEXIO_API_KEY, then try again.",
|
|
443
|
+
exit_code=EXIT_NETWORK,
|
|
444
|
+
) from exc
|
|
445
|
+
except requests.ConnectionError as exc:
|
|
446
|
+
raise CliError(
|
|
447
|
+
error_type="network",
|
|
448
|
+
message=f"Failed to reach {client.base_url}/api/my_config: {exc}",
|
|
449
|
+
hint="Confirm REFLEXIO_URL + REFLEXIO_API_KEY, then try again.",
|
|
450
|
+
exit_code=EXIT_NETWORK,
|
|
451
|
+
) from exc
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
@app.command()
|
|
455
|
+
@handle_errors
|
|
456
|
+
def storage(
|
|
457
|
+
ctx: typer.Context,
|
|
458
|
+
reveal: Annotated[
|
|
459
|
+
bool,
|
|
460
|
+
typer.Option(
|
|
461
|
+
"--reveal",
|
|
462
|
+
help="Print the raw credentials instead of a masked summary",
|
|
463
|
+
),
|
|
464
|
+
] = False,
|
|
465
|
+
) -> None:
|
|
466
|
+
"""Show the storage credentials the server has on file for your org.
|
|
467
|
+
|
|
468
|
+
Calls ``GET /api/my_config``. The default output masks credentials
|
|
469
|
+
so it's safe to paste into bug reports; pass ``--reveal`` to print
|
|
470
|
+
the unmasked values when copying to a new machine.
|
|
471
|
+
|
|
472
|
+
Args:
|
|
473
|
+
ctx: Typer context with CliState in ctx.obj
|
|
474
|
+
reveal: When True, print unmasked credentials after confirmation.
|
|
475
|
+
"""
|
|
476
|
+
client = get_client(ctx)
|
|
477
|
+
resp = _fetch_my_config(client)
|
|
478
|
+
|
|
479
|
+
json_mode: bool = ctx.obj.json_mode
|
|
480
|
+
|
|
481
|
+
if not resp.success or not resp.storage_config:
|
|
482
|
+
if json_mode:
|
|
483
|
+
render(resp, json_mode=True)
|
|
484
|
+
else:
|
|
485
|
+
print_error(resp.message or "No storage configured for this org")
|
|
486
|
+
return
|
|
487
|
+
|
|
488
|
+
payload: dict = dict(resp.storage_config)
|
|
489
|
+
|
|
490
|
+
if reveal and not json_mode:
|
|
491
|
+
if not typer.confirm(
|
|
492
|
+
"This will print your raw storage credentials. Continue?",
|
|
493
|
+
default=False,
|
|
494
|
+
):
|
|
495
|
+
raise typer.Abort()
|
|
496
|
+
display = payload
|
|
497
|
+
else:
|
|
498
|
+
display = _mask_storage_config(payload)
|
|
499
|
+
|
|
500
|
+
if json_mode:
|
|
501
|
+
render(
|
|
502
|
+
{"storage_type": resp.storage_type, "storage_config": display},
|
|
503
|
+
json_mode=True,
|
|
504
|
+
)
|
|
505
|
+
return
|
|
506
|
+
|
|
507
|
+
print_storage_credentials(
|
|
508
|
+
resp.storage_type,
|
|
509
|
+
display,
|
|
510
|
+
revealed=reveal,
|
|
511
|
+
)
|