claude-smart 0.2.42 → 0.2.44
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 +3 -3
- package/README.md +1 -1
- package/bin/claude-smart.js +2 -2
- package/package.json +9 -3
- package/plugin/.claude-plugin/plugin.json +9 -3
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/README.md +23 -3
- package/plugin/pyproject.toml +3 -3
- package/plugin/scripts/_lib.sh +91 -0
- package/plugin/scripts/backend-service.sh +51 -4
- package/plugin/scripts/cli.sh +3 -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 +1 -0
- package/plugin/scripts/hook_entry.sh +6 -3
- package/plugin/scripts/smart-install.sh +3 -2
- package/plugin/src/README.md +57 -0
- 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 +126 -5
- package/plugin/vendor/reflexio/.env.example +62 -0
- package/plugin/vendor/reflexio/LICENSE +201 -0
- package/plugin/vendor/reflexio/README.md +338 -0
- package/plugin/vendor/reflexio/pyproject.toml +274 -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 +265 -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 +964 -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 +1112 -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 +768 -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 +333 -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 +622 -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 +2868 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/README.md +34 -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 +562 -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 +359 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/image_utils.py +55 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/litellm_client.py +1871 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/llm_utils.py +140 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/model_defaults.py +479 -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 +338 -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 +288 -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 +187 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/rerank/llm_reranker.py +148 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/tools.py +716 -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_consolidation/v2.3.1.prompt.md +69 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.3.2.prompt.md +71 -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 +283 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.2.2.prompt.md +234 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.2.3.prompt.md +244 -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 +137 -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/README.md +58 -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 +336 -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 +1668 -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/embedding_text.py +62 -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 +358 -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 +535 -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 +779 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/tools.py +1125 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extractor_config_utils.py +94 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extractor_interaction_utils.py +251 -0
- package/plugin/vendor/reflexio/reflexio/server/services/generation_service.py +702 -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 +1045 -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 +772 -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 +737 -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 +803 -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 +80 -0
- package/plugin/vendor/reflexio/reflexio/server/services/search/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/service_utils.py +756 -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 +1298 -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 +384 -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 +572 -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,250 @@
|
|
|
1
|
+
from abc import abstractmethod
|
|
2
|
+
|
|
3
|
+
from reflexio.models.api_schema.domain import (
|
|
4
|
+
DeleteUserInteractionRequest,
|
|
5
|
+
DeleteUserProfileRequest,
|
|
6
|
+
Interaction,
|
|
7
|
+
Status,
|
|
8
|
+
UserProfile,
|
|
9
|
+
)
|
|
10
|
+
from reflexio.models.api_schema.retriever_schema import (
|
|
11
|
+
SearchInteractionRequest,
|
|
12
|
+
SearchUserProfileRequest,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ProfileMixin:
|
|
17
|
+
"""Mixin for profile and interaction CRUD methods."""
|
|
18
|
+
|
|
19
|
+
# read methods
|
|
20
|
+
@abstractmethod
|
|
21
|
+
def get_all_profiles(
|
|
22
|
+
self,
|
|
23
|
+
limit: int = 100,
|
|
24
|
+
status_filter: list[Status | None] | None = None,
|
|
25
|
+
) -> list[UserProfile]:
|
|
26
|
+
raise NotImplementedError
|
|
27
|
+
|
|
28
|
+
@abstractmethod
|
|
29
|
+
def get_all_interactions(self, limit: int = 100) -> list[Interaction]:
|
|
30
|
+
raise NotImplementedError
|
|
31
|
+
|
|
32
|
+
@abstractmethod
|
|
33
|
+
def get_user_profile(
|
|
34
|
+
self,
|
|
35
|
+
user_id: str,
|
|
36
|
+
status_filter: list[Status | None] | None = None,
|
|
37
|
+
) -> list[UserProfile]:
|
|
38
|
+
raise NotImplementedError
|
|
39
|
+
|
|
40
|
+
@abstractmethod
|
|
41
|
+
def get_user_interaction(self, user_id: str) -> list[Interaction]:
|
|
42
|
+
raise NotImplementedError
|
|
43
|
+
|
|
44
|
+
# create or update methods
|
|
45
|
+
@abstractmethod
|
|
46
|
+
def add_user_profile(self, user_id: str, user_profiles: list[UserProfile]) -> None:
|
|
47
|
+
"""Add the user profile for a given user id."""
|
|
48
|
+
raise NotImplementedError
|
|
49
|
+
|
|
50
|
+
@abstractmethod
|
|
51
|
+
def add_user_interaction(self, user_id: str, interaction: Interaction) -> None:
|
|
52
|
+
raise NotImplementedError
|
|
53
|
+
|
|
54
|
+
@abstractmethod
|
|
55
|
+
def add_user_interactions_bulk(
|
|
56
|
+
self, user_id: str, interactions: list[Interaction]
|
|
57
|
+
) -> None:
|
|
58
|
+
"""Add multiple user interactions with batched embedding generation.
|
|
59
|
+
|
|
60
|
+
Args:
|
|
61
|
+
user_id: The user ID
|
|
62
|
+
interactions: List of interactions to add
|
|
63
|
+
"""
|
|
64
|
+
raise NotImplementedError
|
|
65
|
+
|
|
66
|
+
# delete methods
|
|
67
|
+
@abstractmethod
|
|
68
|
+
def delete_user_interaction(self, request: DeleteUserInteractionRequest) -> None:
|
|
69
|
+
raise NotImplementedError
|
|
70
|
+
|
|
71
|
+
@abstractmethod
|
|
72
|
+
def delete_user_profile(self, request: DeleteUserProfileRequest) -> None:
|
|
73
|
+
raise NotImplementedError
|
|
74
|
+
|
|
75
|
+
@abstractmethod
|
|
76
|
+
def update_user_profile_by_id(
|
|
77
|
+
self, user_id: str, profile_id: str, new_profile: UserProfile
|
|
78
|
+
) -> None:
|
|
79
|
+
raise NotImplementedError
|
|
80
|
+
|
|
81
|
+
@abstractmethod
|
|
82
|
+
def delete_all_interactions_for_user(self, user_id: str) -> None:
|
|
83
|
+
raise NotImplementedError
|
|
84
|
+
|
|
85
|
+
@abstractmethod
|
|
86
|
+
def delete_all_profiles_for_user(self, user_id: str) -> None:
|
|
87
|
+
raise NotImplementedError
|
|
88
|
+
|
|
89
|
+
@abstractmethod
|
|
90
|
+
def delete_all_profiles(self) -> None:
|
|
91
|
+
"""Delete all profiles across all users."""
|
|
92
|
+
raise NotImplementedError
|
|
93
|
+
|
|
94
|
+
@abstractmethod
|
|
95
|
+
def delete_all_interactions(self) -> None:
|
|
96
|
+
"""Delete all interactions across all users."""
|
|
97
|
+
raise NotImplementedError
|
|
98
|
+
|
|
99
|
+
@abstractmethod
|
|
100
|
+
def count_all_interactions(self) -> int:
|
|
101
|
+
"""Count total interactions across all users.
|
|
102
|
+
|
|
103
|
+
Returns:
|
|
104
|
+
int: Total number of interactions
|
|
105
|
+
"""
|
|
106
|
+
raise NotImplementedError
|
|
107
|
+
|
|
108
|
+
@abstractmethod
|
|
109
|
+
def count_all_profiles(self) -> int:
|
|
110
|
+
"""Count total profiles across all users without hydrating rows.
|
|
111
|
+
|
|
112
|
+
Cheap alternative to ``len(get_all_profiles(...))`` — avoids
|
|
113
|
+
loading every profile row (including embedding BLOBs) just to
|
|
114
|
+
take a count. Used by publish-path diagnostics that snapshot
|
|
115
|
+
totals before and after a run.
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
int: Total number of profiles across all users
|
|
119
|
+
"""
|
|
120
|
+
raise NotImplementedError
|
|
121
|
+
|
|
122
|
+
@abstractmethod
|
|
123
|
+
def delete_oldest_interactions(self, count: int) -> int:
|
|
124
|
+
"""Delete the oldest N interactions based on created_at timestamp.
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
count (int): Number of oldest interactions to delete
|
|
128
|
+
|
|
129
|
+
Returns:
|
|
130
|
+
int: Number of interactions actually deleted
|
|
131
|
+
"""
|
|
132
|
+
raise NotImplementedError
|
|
133
|
+
|
|
134
|
+
@abstractmethod
|
|
135
|
+
def update_all_profiles_status(
|
|
136
|
+
self,
|
|
137
|
+
old_status: Status | None,
|
|
138
|
+
new_status: Status | None,
|
|
139
|
+
user_ids: list[str] | None = None,
|
|
140
|
+
) -> int:
|
|
141
|
+
"""Update all profiles with old_status to new_status atomically.
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
old_status: The current status to match (None for CURRENT)
|
|
145
|
+
new_status: The new status to set (None for CURRENT)
|
|
146
|
+
user_ids: Optional list of user_ids to filter updates. If None, updates all users.
|
|
147
|
+
|
|
148
|
+
Returns:
|
|
149
|
+
int: Number of profiles updated
|
|
150
|
+
"""
|
|
151
|
+
raise NotImplementedError
|
|
152
|
+
|
|
153
|
+
@abstractmethod
|
|
154
|
+
def get_profiles_by_ids(
|
|
155
|
+
self,
|
|
156
|
+
user_id: str,
|
|
157
|
+
profile_ids: list[str],
|
|
158
|
+
status_filter: list[Status | None] | None = None,
|
|
159
|
+
) -> list[UserProfile]:
|
|
160
|
+
"""Fetch the subset of a user's profiles whose ids are in the list.
|
|
161
|
+
|
|
162
|
+
Server-side filter on (``user_id``, ``profile_id IN (...)``) so
|
|
163
|
+
callers (e.g. the reflection service resolving a small set of
|
|
164
|
+
cited profile ids) avoid scanning every profile for the user.
|
|
165
|
+
|
|
166
|
+
Args:
|
|
167
|
+
user_id (str): Owning user id.
|
|
168
|
+
profile_ids (list[str]): Profile ids to fetch. Empty list
|
|
169
|
+
returns ``[]`` without hitting storage.
|
|
170
|
+
status_filter (list[Status | None] | None): Statuses to
|
|
171
|
+
include. ``None`` (default) means CURRENT only — same
|
|
172
|
+
default as ``get_user_profile`` for consistency.
|
|
173
|
+
|
|
174
|
+
Returns:
|
|
175
|
+
list[UserProfile]: Matching profiles. Order is unspecified.
|
|
176
|
+
Ids that do not exist (or do not match the user / status
|
|
177
|
+
filter) are silently omitted.
|
|
178
|
+
"""
|
|
179
|
+
raise NotImplementedError
|
|
180
|
+
|
|
181
|
+
@abstractmethod
|
|
182
|
+
def archive_profile_by_id(self, user_id: str, profile_id: str) -> bool:
|
|
183
|
+
"""Atomically archive a single profile by id, only if currently CURRENT.
|
|
184
|
+
|
|
185
|
+
Flips the row's ``status`` from ``None`` (CURRENT) to
|
|
186
|
+
``Status.ARCHIVED``. No-op when the profile does not exist or is
|
|
187
|
+
already non-current.
|
|
188
|
+
|
|
189
|
+
Args:
|
|
190
|
+
user_id (str): Owning user id.
|
|
191
|
+
profile_id (str): The profile id to archive.
|
|
192
|
+
|
|
193
|
+
Returns:
|
|
194
|
+
bool: True if a row was archived; False otherwise.
|
|
195
|
+
"""
|
|
196
|
+
raise NotImplementedError
|
|
197
|
+
|
|
198
|
+
@abstractmethod
|
|
199
|
+
def delete_all_profiles_by_status(self, status: Status) -> int:
|
|
200
|
+
"""Delete all profiles with the given status atomically.
|
|
201
|
+
|
|
202
|
+
Args:
|
|
203
|
+
status: The status of profiles to delete
|
|
204
|
+
|
|
205
|
+
Returns:
|
|
206
|
+
int: Number of profiles deleted
|
|
207
|
+
"""
|
|
208
|
+
raise NotImplementedError
|
|
209
|
+
|
|
210
|
+
@abstractmethod
|
|
211
|
+
def get_user_ids_with_status(self, status: Status | None) -> list[str]:
|
|
212
|
+
"""Get list of unique user_ids that have profiles with the given status.
|
|
213
|
+
|
|
214
|
+
Args:
|
|
215
|
+
status: The status to filter by (None for CURRENT)
|
|
216
|
+
|
|
217
|
+
Returns:
|
|
218
|
+
list[str]: List of unique user_ids
|
|
219
|
+
"""
|
|
220
|
+
raise NotImplementedError
|
|
221
|
+
|
|
222
|
+
@abstractmethod
|
|
223
|
+
def delete_profiles_by_ids(self, profile_ids: list[str]) -> int:
|
|
224
|
+
"""Delete profiles by their IDs.
|
|
225
|
+
|
|
226
|
+
Args:
|
|
227
|
+
profile_ids (list[str]): List of profile IDs to delete
|
|
228
|
+
|
|
229
|
+
Returns:
|
|
230
|
+
int: Number of profiles deleted
|
|
231
|
+
"""
|
|
232
|
+
raise NotImplementedError
|
|
233
|
+
|
|
234
|
+
# Search methods
|
|
235
|
+
@abstractmethod
|
|
236
|
+
def search_interaction(
|
|
237
|
+
self,
|
|
238
|
+
search_interaction_request: SearchInteractionRequest,
|
|
239
|
+
query_embedding: list[float] | None = None,
|
|
240
|
+
) -> list[Interaction]:
|
|
241
|
+
raise NotImplementedError
|
|
242
|
+
|
|
243
|
+
@abstractmethod
|
|
244
|
+
def search_user_profile(
|
|
245
|
+
self,
|
|
246
|
+
search_user_profile_request: SearchUserProfileRequest,
|
|
247
|
+
status_filter: list[Status | None] | None = None,
|
|
248
|
+
query_embedding: list[float] | None = None,
|
|
249
|
+
) -> list[UserProfile]:
|
|
250
|
+
raise NotImplementedError
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
from abc import abstractmethod
|
|
2
|
+
|
|
3
|
+
from reflexio.models.api_schema.domain import Request
|
|
4
|
+
from reflexio.models.api_schema.internal_schema import (
|
|
5
|
+
RequestInteractionDataModel,
|
|
6
|
+
SessionDescriptor,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class RequestMixin:
|
|
11
|
+
"""Mixin for request CRUD methods."""
|
|
12
|
+
|
|
13
|
+
@abstractmethod
|
|
14
|
+
def add_request(self, request: Request) -> None:
|
|
15
|
+
"""Add a request to storage.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
request: Request object to store
|
|
19
|
+
"""
|
|
20
|
+
raise NotImplementedError
|
|
21
|
+
|
|
22
|
+
@abstractmethod
|
|
23
|
+
def get_request(self, request_id: str) -> Request | None:
|
|
24
|
+
"""Get a request by its ID.
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
request_id: The request ID to retrieve
|
|
28
|
+
|
|
29
|
+
Returns:
|
|
30
|
+
Request object if found, None otherwise
|
|
31
|
+
"""
|
|
32
|
+
raise NotImplementedError
|
|
33
|
+
|
|
34
|
+
@abstractmethod
|
|
35
|
+
def delete_request(self, request_id: str) -> None:
|
|
36
|
+
"""Delete a request by its ID.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
request_id: The request ID to delete
|
|
40
|
+
"""
|
|
41
|
+
raise NotImplementedError
|
|
42
|
+
|
|
43
|
+
@abstractmethod
|
|
44
|
+
def delete_session(self, session_id: str) -> int:
|
|
45
|
+
"""Delete all requests and interactions in a session.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
session_id: The session ID to delete
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
int: Number of requests deleted
|
|
52
|
+
"""
|
|
53
|
+
raise NotImplementedError
|
|
54
|
+
|
|
55
|
+
@abstractmethod
|
|
56
|
+
def delete_all_requests(self) -> None:
|
|
57
|
+
"""Delete all requests and their associated interactions."""
|
|
58
|
+
raise NotImplementedError
|
|
59
|
+
|
|
60
|
+
@abstractmethod
|
|
61
|
+
def delete_requests_by_ids(self, request_ids: list[str]) -> int:
|
|
62
|
+
"""Delete requests and their associated interactions by request IDs.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
request_ids (list[str]): List of request IDs to delete
|
|
66
|
+
|
|
67
|
+
Returns:
|
|
68
|
+
int: Number of requests deleted
|
|
69
|
+
"""
|
|
70
|
+
raise NotImplementedError
|
|
71
|
+
|
|
72
|
+
@abstractmethod
|
|
73
|
+
def get_sessions(
|
|
74
|
+
self,
|
|
75
|
+
user_id: str | None = None,
|
|
76
|
+
request_id: str | None = None,
|
|
77
|
+
session_id: str | None = None,
|
|
78
|
+
start_time: int | None = None,
|
|
79
|
+
end_time: int | None = None,
|
|
80
|
+
top_k: int | None = 30,
|
|
81
|
+
offset: int = 0,
|
|
82
|
+
) -> dict[str, list[RequestInteractionDataModel]]:
|
|
83
|
+
"""Get requests with their associated interactions, grouped by session_id.
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
user_id (str, optional): User ID to filter requests.
|
|
87
|
+
request_id (str, optional): Specific request ID to retrieve
|
|
88
|
+
session_id (str, optional): Specific session ID to retrieve
|
|
89
|
+
start_time (int, optional): Start timestamp for filtering
|
|
90
|
+
end_time (int, optional): End timestamp for filtering
|
|
91
|
+
top_k (int, optional): Maximum number of requests to return
|
|
92
|
+
offset (int): Number of requests to skip for pagination. Defaults to 0.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
dict[str, list[RequestInteractionDataModel]]: Dictionary mapping session_id to list of RequestInteractionDataModel objects
|
|
96
|
+
"""
|
|
97
|
+
raise NotImplementedError
|
|
98
|
+
|
|
99
|
+
@abstractmethod
|
|
100
|
+
def get_rerun_user_ids(
|
|
101
|
+
self,
|
|
102
|
+
user_id: str | None = None,
|
|
103
|
+
start_time: int | None = None,
|
|
104
|
+
end_time: int | None = None,
|
|
105
|
+
source: str | None = None,
|
|
106
|
+
agent_version: str | None = None,
|
|
107
|
+
) -> list[str]:
|
|
108
|
+
"""Get distinct user IDs that have matching requests for rerun workflows.
|
|
109
|
+
|
|
110
|
+
Args:
|
|
111
|
+
user_id (str, optional): Restrict to a specific user ID.
|
|
112
|
+
start_time (int, optional): Start timestamp for request filtering.
|
|
113
|
+
end_time (int, optional): End timestamp for request filtering.
|
|
114
|
+
source (str, optional): Restrict to requests from a source.
|
|
115
|
+
agent_version (str, optional): Restrict to requests with an agent version.
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
list[str]: Distinct user IDs matching the filters.
|
|
119
|
+
"""
|
|
120
|
+
raise NotImplementedError
|
|
121
|
+
|
|
122
|
+
@abstractmethod
|
|
123
|
+
def get_requests_by_session(self, user_id: str, session_id: str) -> list[Request]:
|
|
124
|
+
"""Get all requests for a specific session.
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
user_id (str): User ID to filter requests
|
|
128
|
+
session_id (str): Session ID to filter by
|
|
129
|
+
|
|
130
|
+
Returns:
|
|
131
|
+
list[Request]: List of Request objects in the session
|
|
132
|
+
"""
|
|
133
|
+
raise NotImplementedError
|
|
134
|
+
|
|
135
|
+
@abstractmethod
|
|
136
|
+
def get_session_ids_in_window(
|
|
137
|
+
self, from_ts: int, to_ts: int
|
|
138
|
+
) -> list[SessionDescriptor]:
|
|
139
|
+
"""Return one descriptor per distinct (user_id, session_id, agent_version, source) tuple with at least one request whose ``created_at`` falls inside ``[from_ts, to_ts]``.
|
|
140
|
+
|
|
141
|
+
A session that records requests under multiple ``agent_version`` or
|
|
142
|
+
``source`` values within the window yields one descriptor per distinct
|
|
143
|
+
combination, so regen workers can invoke ``run_group_evaluation`` once
|
|
144
|
+
per (user, session, agent_version, source) tuple without conflating
|
|
145
|
+
runs from different agent versions.
|
|
146
|
+
|
|
147
|
+
Args:
|
|
148
|
+
from_ts (int): Inclusive lower bound (Unix seconds).
|
|
149
|
+
to_ts (int): Inclusive upper bound (Unix seconds).
|
|
150
|
+
|
|
151
|
+
Returns:
|
|
152
|
+
list[SessionDescriptor]: Deduped descriptors ordered by session_id.
|
|
153
|
+
"""
|
|
154
|
+
raise NotImplementedError
|
package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_shadow_verdicts.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"""Storage interface for per-turn shadow comparison verdicts (F1).
|
|
2
|
+
|
|
3
|
+
Declares the methods every storage implementation MAY implement to expose the
|
|
4
|
+
``shadow_comparison_verdicts`` table used by the per-turn Reflexio-vs-Shadow
|
|
5
|
+
comparison feature.
|
|
6
|
+
|
|
7
|
+
The default implementations raise :class:`NotImplementedError`. Concrete
|
|
8
|
+
backends that support the feature (currently :class:`SQLiteStorage`) override
|
|
9
|
+
these methods via their own mixin. Backends that don't (currently
|
|
10
|
+
:class:`DiskStorage`, :class:`SupabaseStorage` — added in later tasks) will
|
|
11
|
+
surface a clear ``NotImplementedError`` at call time rather than
|
|
12
|
+
``AttributeError``.
|
|
13
|
+
|
|
14
|
+
This intentionally follows the :class:`StallStateMixin` precedent so adding
|
|
15
|
+
a new backend-optional feature does not break the instantiation contract of
|
|
16
|
+
existing backends.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
from typing import TYPE_CHECKING
|
|
22
|
+
|
|
23
|
+
if TYPE_CHECKING:
|
|
24
|
+
from reflexio.models.api_schema.eval_overview_schema import (
|
|
25
|
+
ShadowComparisonVerdict,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class ShadowVerdictsMixin:
|
|
30
|
+
"""Default no-op shadow_comparison_verdicts interface for storage backends.
|
|
31
|
+
|
|
32
|
+
Subclasses that support the feature must override every method. The
|
|
33
|
+
methods below raise :class:`NotImplementedError` so callers see a
|
|
34
|
+
clear error message naming the backend rather than ``AttributeError``.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
def save_shadow_comparison_verdict(
|
|
38
|
+
self, verdict: ShadowComparisonVerdict
|
|
39
|
+
) -> ShadowComparisonVerdict:
|
|
40
|
+
"""Persist a verdict and return the row with the assigned ``verdict_id``.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
verdict (ShadowComparisonVerdict): The verdict to persist. The
|
|
44
|
+
``verdict_id`` field is ignored on save — storage assigns
|
|
45
|
+
the autoincrement key.
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
ShadowComparisonVerdict: The same verdict with ``verdict_id``
|
|
49
|
+
replaced by the storage-assigned primary key.
|
|
50
|
+
|
|
51
|
+
Raises:
|
|
52
|
+
NotImplementedError: When the backend does not support shadow
|
|
53
|
+
comparison verdicts.
|
|
54
|
+
"""
|
|
55
|
+
raise NotImplementedError(
|
|
56
|
+
f"{type(self).__name__} does not support shadow_comparison_verdicts"
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
def get_shadow_comparison_verdict(
|
|
60
|
+
self, verdict_id: int
|
|
61
|
+
) -> ShadowComparisonVerdict | None:
|
|
62
|
+
"""Fetch one verdict by its autoincrement primary key.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
verdict_id (int): The storage-assigned key returned by
|
|
66
|
+
:meth:`save_shadow_comparison_verdict`.
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
ShadowComparisonVerdict | None: The verdict if present, else
|
|
70
|
+
``None``.
|
|
71
|
+
|
|
72
|
+
Raises:
|
|
73
|
+
NotImplementedError: When the backend does not support shadow
|
|
74
|
+
comparison verdicts.
|
|
75
|
+
"""
|
|
76
|
+
raise NotImplementedError(
|
|
77
|
+
f"{type(self).__name__} does not support shadow_comparison_verdicts"
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
def get_shadow_comparison_verdicts(
|
|
81
|
+
self,
|
|
82
|
+
from_ts: int,
|
|
83
|
+
to_ts: int,
|
|
84
|
+
judge_prompt_version: str,
|
|
85
|
+
) -> list[ShadowComparisonVerdict]:
|
|
86
|
+
"""Fetch verdicts in ``[from_ts, to_ts]`` for one pinned prompt version.
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
from_ts (int): Inclusive lower bound of ``created_at``, in Unix
|
|
90
|
+
epoch seconds (UTC).
|
|
91
|
+
to_ts (int): Inclusive upper bound of ``created_at``, in Unix
|
|
92
|
+
epoch seconds (UTC).
|
|
93
|
+
judge_prompt_version (str): The pinned ``shadow_comparison``
|
|
94
|
+
prompt version. Filtering by this prevents rubric-mixing in
|
|
95
|
+
the dashboard headline metric — verdicts produced under an
|
|
96
|
+
older rubric stay in storage but do not contaminate the
|
|
97
|
+
current trend.
|
|
98
|
+
|
|
99
|
+
Returns:
|
|
100
|
+
list[ShadowComparisonVerdict]: Matching verdicts in chronological
|
|
101
|
+
order (ascending ``created_at``).
|
|
102
|
+
|
|
103
|
+
Raises:
|
|
104
|
+
NotImplementedError: When the backend does not support shadow
|
|
105
|
+
comparison verdicts.
|
|
106
|
+
"""
|
|
107
|
+
raise NotImplementedError(
|
|
108
|
+
f"{type(self).__name__} does not support shadow_comparison_verdicts"
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
def delete_shadow_comparison_verdicts_by_session(self, session_id: str) -> int:
|
|
112
|
+
"""Remove all verdicts for one session.
|
|
113
|
+
|
|
114
|
+
Used by the regen worker's delete-after-save pattern: a re-eval
|
|
115
|
+
run computes fresh verdicts, persists them, then clears the prior
|
|
116
|
+
ones to avoid double-counting.
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
session_id (str): The session whose verdicts should be removed.
|
|
120
|
+
|
|
121
|
+
Returns:
|
|
122
|
+
int: Number of rows deleted.
|
|
123
|
+
|
|
124
|
+
Raises:
|
|
125
|
+
NotImplementedError: When the backend does not support shadow
|
|
126
|
+
comparison verdicts.
|
|
127
|
+
"""
|
|
128
|
+
raise NotImplementedError(
|
|
129
|
+
f"{type(self).__name__} does not support shadow_comparison_verdicts"
|
|
130
|
+
)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""Abstract ShareLink storage operations.
|
|
2
|
+
|
|
3
|
+
Each BaseStorage subclass (SQLite, Supabase, Postgres) must implement these methods.
|
|
4
|
+
Storage instances are org-scoped, so org_id is not a method parameter.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from abc import abstractmethod
|
|
8
|
+
|
|
9
|
+
from reflexio.models.api_schema.domain import ShareLink
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ShareLinkMixin:
|
|
13
|
+
"""Mixin defining share link CRUD operations on a per-org data storage."""
|
|
14
|
+
|
|
15
|
+
@abstractmethod
|
|
16
|
+
def create_share_link(
|
|
17
|
+
self,
|
|
18
|
+
token: str,
|
|
19
|
+
resource_type: str,
|
|
20
|
+
resource_id: str,
|
|
21
|
+
expires_at: int | None,
|
|
22
|
+
created_by_email: str | None,
|
|
23
|
+
) -> ShareLink:
|
|
24
|
+
"""Create a new share link.
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
token (str): The share token (unique).
|
|
28
|
+
resource_type (str): Type of resource (e.g., "profile", "user_playbook").
|
|
29
|
+
resource_id (str): ID of the resource being shared.
|
|
30
|
+
expires_at (int | None): Optional Unix timestamp of expiration.
|
|
31
|
+
created_by_email (str | None): Optional email of creator.
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
ShareLink: The created share link with id and created_at populated.
|
|
35
|
+
"""
|
|
36
|
+
raise NotImplementedError
|
|
37
|
+
|
|
38
|
+
@abstractmethod
|
|
39
|
+
def get_share_link_by_token(self, token: str) -> ShareLink | None:
|
|
40
|
+
"""Look up a share link by its token.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
token (str): The share token.
|
|
44
|
+
|
|
45
|
+
Returns:
|
|
46
|
+
ShareLink | None: The share link if found, else None.
|
|
47
|
+
"""
|
|
48
|
+
raise NotImplementedError
|
|
49
|
+
|
|
50
|
+
@abstractmethod
|
|
51
|
+
def get_share_link_by_resource(
|
|
52
|
+
self, resource_type: str, resource_id: str
|
|
53
|
+
) -> ShareLink | None:
|
|
54
|
+
"""Look up an existing share link for a specific resource (for dedup).
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
resource_type (str): Type of resource.
|
|
58
|
+
resource_id (str): ID of the resource.
|
|
59
|
+
|
|
60
|
+
Returns:
|
|
61
|
+
ShareLink | None: The existing share link if any, else None.
|
|
62
|
+
"""
|
|
63
|
+
raise NotImplementedError
|
|
64
|
+
|
|
65
|
+
@abstractmethod
|
|
66
|
+
def get_share_links(self) -> list[ShareLink]:
|
|
67
|
+
"""Return all share links for this org.
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
list[ShareLink]: All share links, ordered by created_at ascending.
|
|
71
|
+
"""
|
|
72
|
+
raise NotImplementedError
|
|
73
|
+
|
|
74
|
+
@abstractmethod
|
|
75
|
+
def delete_share_link(self, link_id: int) -> bool:
|
|
76
|
+
"""Delete a share link by ID.
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
link_id (int): The share link ID.
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
bool: True if deleted, False if not found.
|
|
83
|
+
"""
|
|
84
|
+
raise NotImplementedError
|
|
85
|
+
|
|
86
|
+
@abstractmethod
|
|
87
|
+
def delete_all_share_links(self) -> int:
|
|
88
|
+
"""Delete all share links for this org.
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
int: Number of links deleted.
|
|
92
|
+
"""
|
|
93
|
+
raise NotImplementedError
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""Stall state interface for storage backends.
|
|
2
|
+
|
|
3
|
+
Declares the methods every storage implementation MUST implement to expose
|
|
4
|
+
the singleton stall_state row used by the credit-stall notification flow.
|
|
5
|
+
|
|
6
|
+
The default implementations raise :class:`NotImplementedError`. Concrete
|
|
7
|
+
backends that support the stall_state feature override these methods via
|
|
8
|
+
their own mixin. Backends without stall_state support will surface a clear
|
|
9
|
+
``NotImplementedError`` at call time rather than ``AttributeError``.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
from datetime import datetime
|
|
15
|
+
from typing import TYPE_CHECKING
|
|
16
|
+
|
|
17
|
+
if TYPE_CHECKING:
|
|
18
|
+
from reflexio.server.services.storage.sqlite_storage._stall_state import (
|
|
19
|
+
StallReason,
|
|
20
|
+
StallState,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class StallStateMixin:
|
|
25
|
+
"""Default no-op stall_state interface for storage backends.
|
|
26
|
+
|
|
27
|
+
Subclasses that support the stall_state feature must override every method.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
def get_stall_state(self) -> StallState:
|
|
31
|
+
"""Return the current stall row.
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
StallState: Current snapshot of the singleton stall row.
|
|
35
|
+
|
|
36
|
+
Raises:
|
|
37
|
+
NotImplementedError: When the backend does not support stall_state.
|
|
38
|
+
"""
|
|
39
|
+
raise NotImplementedError(f"{type(self).__name__} does not support stall_state")
|
|
40
|
+
|
|
41
|
+
def upsert_stall_state(
|
|
42
|
+
self,
|
|
43
|
+
*,
|
|
44
|
+
reason: StallReason,
|
|
45
|
+
stalled_at: datetime,
|
|
46
|
+
reset_estimate: datetime | None,
|
|
47
|
+
error_message: str,
|
|
48
|
+
) -> None:
|
|
49
|
+
"""Mark the singleton as stalled with the given reason.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
reason (StallReason): The stall reason discriminator.
|
|
53
|
+
stalled_at (datetime): When the stall was first detected.
|
|
54
|
+
reset_estimate (datetime | None): Estimated reset time, if known.
|
|
55
|
+
error_message (str): Raw error text for debugging.
|
|
56
|
+
|
|
57
|
+
Raises:
|
|
58
|
+
NotImplementedError: When the backend does not support stall_state.
|
|
59
|
+
"""
|
|
60
|
+
raise NotImplementedError(f"{type(self).__name__} does not support stall_state")
|
|
61
|
+
|
|
62
|
+
def mark_stall_notified(self) -> None:
|
|
63
|
+
"""Set ``notified_in_cc=1`` for the current stall.
|
|
64
|
+
|
|
65
|
+
Raises:
|
|
66
|
+
NotImplementedError: When the backend does not support stall_state.
|
|
67
|
+
"""
|
|
68
|
+
raise NotImplementedError(f"{type(self).__name__} does not support stall_state")
|
|
69
|
+
|
|
70
|
+
def clear_stall_state(self) -> None:
|
|
71
|
+
"""Mark the singleton clean — clears all stall fields atomically.
|
|
72
|
+
|
|
73
|
+
Raises:
|
|
74
|
+
NotImplementedError: When the backend does not support stall_state.
|
|
75
|
+
"""
|
|
76
|
+
raise NotImplementedError(f"{type(self).__name__} does not support stall_state")
|