claude-smart 0.2.45 → 0.2.47
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 +47 -10
- package/bin/claude-smart.js +535 -23
- package/package.json +22 -3
- package/plugin/.claude-plugin/plugin.json +4 -2
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/README.md +27 -6
- package/plugin/commands/clear-all.md +1 -0
- package/plugin/commands/dashboard.md +1 -0
- package/plugin/commands/learn.md +1 -0
- package/plugin/commands/restart.md +1 -0
- package/plugin/commands/show.md +1 -0
- package/plugin/dashboard/app/configure/env/page.tsx +40 -14
- package/plugin/dashboard/app/configure/server/page.tsx +51 -1
- package/plugin/dashboard/app/layout.tsx +20 -0
- package/plugin/dashboard/app/preferences/[id]/page.tsx +8 -8
- package/plugin/dashboard/app/skills/project/[id]/page.tsx +7 -3
- package/plugin/dashboard/app/skills/shared/[id]/page.tsx +10 -3
- package/plugin/dashboard/lib/claude-settings-file.ts +20 -10
- package/plugin/dashboard/lib/reflexio-client.ts +16 -0
- package/plugin/dashboard/lib/status.ts +10 -3
- package/plugin/dashboard/lib/types.ts +18 -6
- package/plugin/hooks/codex-hooks.json +0 -1
- package/plugin/opencode/assistant-buffer.ts +108 -0
- package/plugin/opencode/dist/assistant-buffer.js +96 -0
- package/plugin/opencode/dist/internal.js +12 -0
- package/plugin/opencode/dist/payload.js +85 -0
- package/plugin/opencode/dist/server.mjs +232 -0
- package/plugin/opencode/internal.ts +18 -0
- package/plugin/opencode/package.json +3 -0
- package/plugin/opencode/payload.ts +90 -0
- package/plugin/opencode/server.mts +251 -0
- package/plugin/opencode/tsconfig.json +13 -0
- package/plugin/pyproject.toml +25 -4
- package/plugin/scripts/_lib.sh +5 -1
- package/plugin/scripts/backend-service.sh +22 -2
- package/plugin/scripts/ensure-plugin-root.sh +4 -4
- package/plugin/scripts/hook_entry.sh +1 -1
- package/plugin/scripts/opencode-claude-compat +4 -0
- package/plugin/scripts/opencode-claude-compat.cmd +3 -0
- package/plugin/scripts/opencode-claude-compat.js +225 -0
- package/plugin/scripts/smart-install.sh +17 -9
- package/plugin/src/README.md +1 -1
- package/plugin/src/claude_smart/cli.py +498 -12
- package/plugin/src/claude_smart/context_format.py +9 -9
- package/plugin/src/claude_smart/cs_cite.py +66 -19
- package/plugin/src/claude_smart/env_config.py +12 -4
- package/plugin/src/claude_smart/events/session_start.py +26 -7
- package/plugin/src/claude_smart/events/stop.py +1 -1
- package/plugin/src/claude_smart/ids.py +1 -1
- package/plugin/src/claude_smart/reflexio_adapter.py +5 -5
- package/plugin/src/claude_smart/runtime.py +7 -1
- package/plugin/uv.lock +5 -5
- package/plugin/vendor/reflexio/.env.example +54 -30
- package/plugin/vendor/reflexio/README.md +17 -11
- package/plugin/vendor/reflexio/pyproject.toml +13 -1
- package/plugin/vendor/reflexio/reflexio/README.md +4 -1
- package/plugin/vendor/reflexio/reflexio/cli/README.md +9 -7
- package/plugin/vendor/reflexio/reflexio/cli/__main__.py +10 -1
- package/plugin/vendor/reflexio/reflexio/cli/bootstrap_config.py +22 -5
- package/plugin/vendor/reflexio/reflexio/cli/commands/interactions.py +34 -4
- package/plugin/vendor/reflexio/reflexio/cli/commands/profiles.py +12 -7
- package/plugin/vendor/reflexio/reflexio/cli/commands/services.py +13 -6
- package/plugin/vendor/reflexio/reflexio/cli/commands/setup_cmd.py +212 -52
- package/plugin/vendor/reflexio/reflexio/cli/commands/shortcuts.py +15 -2
- package/plugin/vendor/reflexio/reflexio/cli/env_loader.py +292 -22
- package/plugin/vendor/reflexio/reflexio/cli/log_format.py +29 -4
- package/plugin/vendor/reflexio/reflexio/cli/run_services.py +17 -8
- package/plugin/vendor/reflexio/reflexio/cli/stop_services.py +13 -10
- package/plugin/vendor/reflexio/reflexio/cli/utils.py +44 -1
- package/plugin/vendor/reflexio/reflexio/client/client.py +154 -13
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/README.md +135 -257
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/npm/openclaw-smart/bin/openclaw-smart.js +13 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/npm/openclaw-smart/package.json +15 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/README.md +38 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/index.ts +151 -110
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/openclaw.plugin.json +20 -10
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/package.json +28 -6
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/pyproject.toml +42 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/_lib.sh +371 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/backend-log-runner.sh +33 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/backend-service.sh +271 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/cli.sh +68 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/dashboard-open.sh +15 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/ensure-plugin-root.sh +84 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/hook_entry.sh +106 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/npm-cli.js +219 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/smart-install.sh +269 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/clear-all/SKILL.md +8 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/dashboard/SKILL.md +8 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/learn/SKILL.md +10 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/reflexio/SKILL.md +15 -44
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/restart/SKILL.md +6 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/show/SKILL.md +8 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/cli.py +634 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/context_format.py +224 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/context_inject.py +79 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/after_tool_call.py +160 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/agent_end.py +187 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/before_prompt_build.py +69 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/before_tool_call.py +30 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/session_end.py +36 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/session_start.py +130 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/hook.py +131 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/ids.py +94 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/internal_call.py +75 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/oc_cite.py +196 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/optimizer_assistant.py +272 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/publish.py +96 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/query_compose.py +66 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/reflexio_adapter.py +336 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/runtime.py +47 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/stall_banner.py +61 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/state.py +323 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/integration/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/integration/test_e2e_session_loop.py +190 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/integration/test_publish_to_local_reflexio_integration.py +112 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/integration/test_recursion_guard_integration.py +86 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/integration/test_search_inject_integration.py +144 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_cli.py +184 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_events_after_tool_call.py +142 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_events_agent_end.py +233 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_events_before_prompt_build.py +116 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_events_before_tool_call.py +35 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_events_session_end.py +47 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_events_session_start.py +109 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_hook_dispatch.py +117 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_ids.py +41 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_internal_call.py +50 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_oc_cite.py +88 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_publish.py +48 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_query_compose.py +48 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_reflexio_adapter.py +188 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_runtime.py +41 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_state.py +235 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests-ts/__mocks__/plugin-entry-stub.ts +6 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests-ts/test_npm_cli.test.ts +56 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests-ts/test_shim_dispatch.test.ts +171 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tsconfig.build.json +18 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/{tsconfig.json → plugin/tsconfig.json} +2 -2
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/uv.lock +3835 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/vitest.config.ts +18 -0
- package/plugin/vendor/reflexio/reflexio/lib/_agent_playbook.py +246 -10
- package/plugin/vendor/reflexio/reflexio/lib/_base.py +15 -0
- package/plugin/vendor/reflexio/reflexio/lib/_config.py +11 -4
- package/plugin/vendor/reflexio/reflexio/lib/_generation.py +17 -5
- package/plugin/vendor/reflexio/reflexio/lib/_lineage_parity_readers.py +187 -0
- package/plugin/vendor/reflexio/reflexio/lib/_profiles.py +224 -21
- package/plugin/vendor/reflexio/reflexio/lib/_reflection.py +1 -1
- package/plugin/vendor/reflexio/reflexio/lib/_search.py +52 -25
- package/plugin/vendor/reflexio/reflexio/lib/_user_playbook.py +11 -1
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/entities.py +127 -38
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/enums.py +4 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/governance.py +117 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/eval_overview_schema.py +64 -41
- package/plugin/vendor/reflexio/reflexio/models/api_schema/internal_schema.py +19 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/pending_tool_call_schema.py +12 -5
- package/plugin/vendor/reflexio/reflexio/models/api_schema/retriever_schema.py +97 -3
- package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/converters.py +5 -1
- package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/entities.py +5 -1
- package/plugin/vendor/reflexio/reflexio/models/config_schema.py +104 -7
- package/plugin/vendor/reflexio/reflexio/models/structured_output.py +148 -0
- package/plugin/vendor/reflexio/reflexio/server/OVERVIEW.md +3 -3
- package/plugin/vendor/reflexio/reflexio/server/README.md +58 -33
- package/plugin/vendor/reflexio/reflexio/server/__init__.py +29 -5
- package/plugin/vendor/reflexio/reflexio/server/__main__.py +2 -2
- package/plugin/vendor/reflexio/reflexio/server/api.py +899 -103
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/precondition_checks.py +7 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/request_context.py +4 -2
- package/plugin/vendor/reflexio/reflexio/server/auth.py +90 -0
- package/plugin/vendor/reflexio/reflexio/server/billing_meter.py +173 -0
- package/plugin/vendor/reflexio/reflexio/server/billing_signals.py +64 -0
- package/plugin/vendor/reflexio/reflexio/server/cache/reflexio_cache.py +46 -16
- package/plugin/vendor/reflexio/reflexio/server/env_utils.py +65 -0
- package/plugin/vendor/reflexio/reflexio/server/extensions.py +213 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/embedding_service.py +19 -4
- package/plugin/vendor/reflexio/reflexio/server/llm/litellm_client.py +264 -77
- package/plugin/vendor/reflexio/reflexio/server/llm/llm_utils.py +69 -7
- package/plugin/vendor/reflexio/reflexio/server/llm/model_defaults.py +4 -4
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/claude_code_provider.py +1 -1
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/embedding_service_provider.py +75 -16
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/openclaw_provider.py +280 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/rerank/cross_encoder_reranker.py +12 -1
- package/plugin/vendor/reflexio/reflexio/server/llm/token_accounting.py +48 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/tools.py +107 -17
- package/plugin/vendor/reflexio/reflexio/server/operation_limiter.py +360 -4
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.6.0.prompt.md +1 -1
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.7.0.prompt.md +85 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_aggregation/v2.2.0.prompt.md +1 -1
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_aggregation/v2.3.0.prompt.md +253 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.3.2.prompt.md +1 -1
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.3.3.prompt.md +74 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.2.3.prompt.md +1 -1
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.3.0.prompt.md +266 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.4.0.prompt.md +278 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.3.0.prompt.md +1 -1
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.4.0.prompt.md +137 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main/v1.2.0.prompt.md +1 -1
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main/v1.3.0.prompt.md +34 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_instruction_start/v1.0.0.prompt.md +5 -12
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_instruction_start/v1.1.0.prompt.md +5 -12
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_instruction_start/v1.2.0.prompt.md +155 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/tagging/v1.0.0.prompt.md +23 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_manager.py +89 -32
- package/plugin/vendor/reflexio/reflexio/server/services/README.md +28 -11
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/README.md +22 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluation_constants.py +4 -2
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluation_utils.py +1 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/components/__init__.py +7 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/{agent_success_evaluator.py → components/evaluator.py} +3 -16
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/regen_jobs.py +28 -72
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/{group_evaluation_runner.py → runner.py} +12 -10
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/{delayed_group_evaluator.py → scheduler.py} +10 -2
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/{agent_success_evaluation_service.py → service.py} +36 -1
- package/plugin/vendor/reflexio/reflexio/server/services/base_generation_service.py +160 -0
- package/plugin/vendor/reflexio/reflexio/server/services/configurator/base_configurator.py +5 -0
- package/plugin/vendor/reflexio/reflexio/server/services/deduplication_utils.py +1 -1
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/README.md +9 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/components/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/{rule_attribution.py → components/rule_attribution.py} +10 -9
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/eval_sampler.py +15 -24
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/service.py +238 -164
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/README.md +31 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/outcome.py +13 -3
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/pending_tool_call_dispatch.py +3 -2
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/resumable_agent.py +32 -118
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/resume_worker.py +47 -16
- package/plugin/vendor/reflexio/reflexio/server/services/generation_service.py +105 -23
- package/plugin/vendor/reflexio/reflexio/server/services/governance/config.py +52 -0
- package/plugin/vendor/reflexio/reflexio/server/services/governance/service.py +378 -0
- package/plugin/vendor/reflexio/reflexio/server/services/governance/subject_refs.py +34 -0
- package/plugin/vendor/reflexio/reflexio/server/services/lineage/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/lineage/gc_scheduler.py +219 -0
- package/plugin/vendor/reflexio/reflexio/server/services/lineage/resolve.py +98 -0
- package/plugin/vendor/reflexio/reflexio/server/services/operation_state_utils.py +26 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/README.md +18 -11
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/aggregation_prompt_processing.py +100 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/components/__init__.py +5 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/{playbook_aggregator.py → components/aggregator.py} +334 -178
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/{playbook_consolidator.py → components/consolidator.py} +168 -62
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/{playbook_extractor.py → components/extractor.py} +5 -1
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_edit_apply.py +74 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_service_utils.py +33 -3
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/{playbook_generation_service.py → service.py} +121 -19
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/README.md +10 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/models.py +2 -1
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/optimizer.py +178 -30
- package/plugin/vendor/reflexio/reflexio/server/services/pre_retrieval/README.md +9 -0
- package/plugin/vendor/reflexio/reflexio/server/services/profile/components/__init__.py +17 -0
- package/plugin/vendor/reflexio/reflexio/server/services/profile/{profile_deduplicator.py → components/consolidator.py} +7 -6
- package/plugin/vendor/reflexio/reflexio/server/services/profile/{profile_extractor.py → components/extractor.py} +31 -22
- package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_generation_service_utils.py +6 -13
- package/plugin/vendor/reflexio/reflexio/server/services/profile/{profile_generation_service.py → service.py} +32 -50
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/__init__.py +4 -8
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/components/__init__.py +7 -0
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/reflection_service_utils.py +12 -1
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/{reflection_service.py → service.py} +36 -16
- package/plugin/vendor/reflexio/reflexio/server/services/retrieval/recency.py +211 -0
- package/plugin/vendor/reflexio/reflexio/server/services/retrieval/relevance_floor.py +99 -6
- package/plugin/vendor/reflexio/reflexio/server/services/service_utils.py +36 -1
- package/plugin/vendor/reflexio/reflexio/server/services/shadow_comparison/README.md +8 -0
- package/plugin/vendor/reflexio/reflexio/server/services/shadow_comparison/outcome.py +1 -2
- package/plugin/vendor/reflexio/reflexio/server/services/storage/error.py +31 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/governance_validation.py +681 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/retention.py +9 -9
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/__init__.py +16 -2
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_agent_run.py +4 -1
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_base.py +644 -197
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_extras.py +106 -119
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_governance.py +1965 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_lineage.py +630 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_operations.py +38 -6
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_playbook.py +31 -1369
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_profiles.py +756 -210
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_requests.py +148 -34
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_shadow_verdicts.py +23 -9
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_stall_state.py +5 -2
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/playbook/__init__.py +13 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/playbook/_agent.py +952 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/playbook/_eval_results.py +189 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/playbook/_optimization.py +247 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/playbook/_source_linkage.py +145 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/playbook/_user.py +838 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/__init__.py +150 -23
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_agent_run.py +2 -8
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_base.py +5 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_extras.py +40 -57
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_governance.py +148 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_lineage.py +215 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_operations.py +20 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_playbook.py +4 -677
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_profiles.py +134 -1
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_requests.py +62 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_retrieval_log.py +51 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_shadow_verdicts.py +17 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/playbook/__init__.py +13 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/playbook/_agent.py +365 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/playbook/_eval_results.py +124 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/playbook/_optimization.py +85 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/playbook/_source_linkage.py +47 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/playbook/_user.py +333 -0
- package/plugin/vendor/reflexio/reflexio/server/services/tagging/README.md +8 -0
- package/plugin/vendor/reflexio/reflexio/server/services/tagging/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/server/services/tagging/service.py +200 -0
- package/plugin/vendor/reflexio/reflexio/server/services/tagging/tagging_scheduler.py +149 -0
- package/plugin/vendor/reflexio/reflexio/server/services/unified_search_service.py +372 -34
- package/plugin/vendor/reflexio/reflexio/server/site_var/README.md +2 -1
- package/plugin/vendor/reflexio/reflexio/server/site_var/feature_flags.py +120 -1
- package/plugin/vendor/reflexio/reflexio/server/site_var/site_var_sources/feature_flags.json +4 -0
- package/plugin/vendor/reflexio/reflexio/server/site_var/site_var_sources/search_settings.json +5 -0
- package/plugin/vendor/reflexio/reflexio/server/tracing.py +30 -0
- package/plugin/vendor/reflexio/reflexio/server/usage_metrics.py +18 -0
- package/plugin/vendor/reflexio/reflexio/test_support/llm_mock.py +61 -26
- package/plugin/vendor/reflexio/reflexio/test_support/llm_model_registry.py +41 -4
- package/scripts/setup-claude-smart.sh +8 -3
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/TESTING.md +0 -517
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/hook/handler.js +0 -473
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/package-lock.json +0 -2156
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/package.json +0 -18
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/hook/handler.ts +0 -241
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/hook/setup.ts +0 -140
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/publish.ts +0 -113
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/search.ts +0 -52
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/server.ts +0 -103
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/sqlite-buffer.ts +0 -156
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/user-id.ts +0 -134
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/rules/reflexio.md +0 -24
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/publish_clawhub.sh +0 -278
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/references/HOOK.md +0 -164
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/scripts/install.sh +0 -36
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/scripts/uninstall.sh +0 -35
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/publish.test.ts +0 -27
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/search.test.ts +0 -31
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/server.test.ts +0 -42
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/setup.test.ts +0 -49
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/sqlite-buffer.test.ts +0 -91
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/user-id.test.ts +0 -50
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/vitest.config.ts +0 -13
- package/plugin/vendor/reflexio/reflexio/server/_auth.py +0 -25
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/group_aggregation.py +0 -192
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/invariants.py +0 -303
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/plan.py +0 -138
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/tools.py +0 -1125
- /package/plugin/vendor/reflexio/reflexio/integrations/{__init__.py → openclaw/plugin/src/openclaw_smart/__init__.py} +0 -0
- /package/plugin/vendor/reflexio/reflexio/integrations/openclaw/{types → plugin/types}/openclaw.d.ts +0 -0
- /package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/{distribution.py → components/distribution.py} +0 -0
- /package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/{hero_state.py → components/hero_state.py} +0 -0
- /package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/{shadow_aggregation.py → components/shadow_aggregation.py} +0 -0
- /package/plugin/vendor/reflexio/reflexio/server/services/reflection/{reflection_extractor.py → components/extractor.py} +0 -0
|
@@ -33,7 +33,7 @@ _PROVIDERS: dict[str, dict[str, str]] = {
|
|
|
33
33
|
},
|
|
34
34
|
"anthropic": {
|
|
35
35
|
"env_var": "ANTHROPIC_API_KEY",
|
|
36
|
-
"model": "claude-sonnet-
|
|
36
|
+
"model": "claude-sonnet-5",
|
|
37
37
|
"display": "Anthropic",
|
|
38
38
|
},
|
|
39
39
|
"gemini": {
|
|
@@ -53,7 +53,7 @@ _PROVIDERS: dict[str, dict[str, str]] = {
|
|
|
53
53
|
},
|
|
54
54
|
"minimax": {
|
|
55
55
|
"env_var": "MINIMAX_API_KEY",
|
|
56
|
-
"model": "MiniMax-
|
|
56
|
+
"model": "MiniMax-M3",
|
|
57
57
|
"display": "MiniMax",
|
|
58
58
|
},
|
|
59
59
|
"dashscope": {
|
|
@@ -275,12 +275,13 @@ def _write_embedding_model_to_org_config(model_name: str) -> None:
|
|
|
275
275
|
model_name: Canonical model name to persist
|
|
276
276
|
(e.g. ``"local/minilm-l6-v2"``).
|
|
277
277
|
"""
|
|
278
|
+
from reflexio.cli.bootstrap_config import default_org_id
|
|
278
279
|
from reflexio.models.config_schema import LLMConfig
|
|
279
280
|
from reflexio.server.services.configurator.local_file_config_storage import (
|
|
280
281
|
LocalFileConfigStorage,
|
|
281
282
|
)
|
|
282
283
|
|
|
283
|
-
storage = LocalFileConfigStorage(
|
|
284
|
+
storage = LocalFileConfigStorage(default_org_id())
|
|
284
285
|
config = storage.load_config()
|
|
285
286
|
if config.llm_config is None:
|
|
286
287
|
config.llm_config = LLMConfig(embedding_model_name=model_name)
|
|
@@ -385,7 +386,7 @@ def _choose_embedding_provider(env_path: Path, *, embedding_flag: str) -> str |
|
|
|
385
386
|
return _provider_display(provider_key)
|
|
386
387
|
|
|
387
388
|
|
|
388
|
-
_LOCAL_SERVER_URL = "http://localhost:
|
|
389
|
+
_LOCAL_SERVER_URL = "http://localhost:8061"
|
|
389
390
|
|
|
390
391
|
|
|
391
392
|
def _prompt_local_sqlite(env_path: Path) -> str:
|
|
@@ -544,8 +545,72 @@ def _prompt_storage(env_path: Path) -> str:
|
|
|
544
545
|
raise typer.Exit(1)
|
|
545
546
|
|
|
546
547
|
|
|
547
|
-
|
|
548
|
-
|
|
548
|
+
_OPENCLAW_PLUGIN_ID = "reflexio-openclaw-smart"
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
def _openclaw_plugin_dir() -> Path:
|
|
552
|
+
"""Resolve the absolute path of the bundled openclaw-smart plugin dir."""
|
|
553
|
+
import reflexio
|
|
554
|
+
|
|
555
|
+
pkg_dir = Path(reflexio.__file__).parent
|
|
556
|
+
return pkg_dir / "integrations" / "openclaw" / "plugin"
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
def _write_openclaw_env(env_path: Path, openclaw_bin: str) -> None:
|
|
560
|
+
"""Persist the openclaw CLI path and local-CLI opt-in to ``~/.reflexio/.env``."""
|
|
561
|
+
_set_env_var(env_path, "OPENCLAW_BIN", openclaw_bin)
|
|
562
|
+
_set_env_var(env_path, "OPENCLAW_SMART_USE_LOCAL_CLI", "1")
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
def _remove_env_keys(env_path: Path, keys: tuple[str, ...]) -> None:
|
|
566
|
+
"""Delete the given keys from a ``.env`` file. Silent on missing file/keys."""
|
|
567
|
+
if not env_path.exists():
|
|
568
|
+
return
|
|
569
|
+
lines = env_path.read_text().splitlines()
|
|
570
|
+
drop = {f"{k}=" for k in keys}
|
|
571
|
+
kept = [line for line in lines if not any(line.startswith(p) for p in drop)]
|
|
572
|
+
if len(kept) != len(lines):
|
|
573
|
+
env_path.write_text("\n".join(kept) + ("\n" if kept else ""))
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
def _read_env_key(env_path: Path | None, key: str) -> str | None:
|
|
577
|
+
"""Read a simple KEY=value assignment from a .env file."""
|
|
578
|
+
if env_path is None or not env_path.exists():
|
|
579
|
+
return None
|
|
580
|
+
prefix = f"{key}="
|
|
581
|
+
for line in env_path.read_text().splitlines():
|
|
582
|
+
stripped = line.strip()
|
|
583
|
+
if not stripped or stripped.startswith("#") or not stripped.startswith(prefix):
|
|
584
|
+
continue
|
|
585
|
+
return stripped[len(prefix) :].strip().strip('"').strip("'") or None
|
|
586
|
+
return None
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
def _run_smart_install(plugin_dir: Path) -> None:
|
|
590
|
+
"""Run the plugin's first-run installer so uv/.venv land before first hook."""
|
|
591
|
+
script = plugin_dir / "scripts" / "smart-install.sh"
|
|
592
|
+
if not script.exists():
|
|
593
|
+
typer.echo(f"Warning: {script} missing, skipping first-run install")
|
|
594
|
+
return
|
|
595
|
+
proc = subprocess.run(["bash", str(script)], capture_output=True, text=True)
|
|
596
|
+
if proc.returncode != 0:
|
|
597
|
+
typer.echo(
|
|
598
|
+
"Warning: smart-install.sh exited "
|
|
599
|
+
f"{proc.returncode}; first session may take longer to bootstrap"
|
|
600
|
+
)
|
|
601
|
+
if proc.stderr:
|
|
602
|
+
typer.echo(proc.stderr.strip())
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
def _install_openclaw_integration(env_path: Path) -> bool:
|
|
606
|
+
"""Install the openclaw-smart plugin into openClaw via the plugin system.
|
|
607
|
+
|
|
608
|
+
Writes ``OPENCLAW_BIN`` and ``OPENCLAW_SMART_USE_LOCAL_CLI=1`` to
|
|
609
|
+
``~/.reflexio/.env``, installs and enables the bundled plugin, runs the
|
|
610
|
+
first-run installer, and verifies the plugin is loaded.
|
|
611
|
+
|
|
612
|
+
Args:
|
|
613
|
+
env_path (Path): Path to the ``~/.reflexio/.env`` file to update.
|
|
549
614
|
|
|
550
615
|
Returns:
|
|
551
616
|
bool: True if the plugin was verified as registered.
|
|
@@ -553,57 +618,89 @@ def _install_openclaw_integration() -> bool:
|
|
|
553
618
|
Raises:
|
|
554
619
|
typer.Exit: If the openclaw CLI is not found on PATH.
|
|
555
620
|
"""
|
|
556
|
-
|
|
621
|
+
openclaw_bin = shutil.which("openclaw")
|
|
622
|
+
if not openclaw_bin:
|
|
557
623
|
typer.echo("Error: openclaw CLI not found. Install from https://openclaw.ai")
|
|
558
624
|
raise typer.Exit(1)
|
|
559
625
|
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
pkg_dir = Path(reflexio.__file__).parent
|
|
563
|
-
plugin_dir = pkg_dir / "integrations" / "openclaw" / "plugin"
|
|
564
|
-
|
|
626
|
+
plugin_dir = _openclaw_plugin_dir()
|
|
565
627
|
if not plugin_dir.exists():
|
|
566
628
|
typer.echo(f"Error: plugin directory not found at {plugin_dir}")
|
|
567
629
|
raise typer.Exit(1)
|
|
568
630
|
|
|
631
|
+
_write_openclaw_env(env_path, openclaw_bin)
|
|
632
|
+
|
|
633
|
+
# Use the resolved absolute path for every subprocess invocation so a
|
|
634
|
+
# mid-setup PATH change (a sibling install, a shell rc reload) can't
|
|
635
|
+
# silently flip us to a different ``openclaw`` binary partway through.
|
|
636
|
+
# Mirrors the same lookup discipline the runtime hooks use via OPENCLAW_BIN.
|
|
637
|
+
cli = openclaw_bin
|
|
638
|
+
|
|
569
639
|
# Clean install: remove any existing installation and stale extension dir
|
|
570
640
|
subprocess.run(
|
|
571
|
-
[
|
|
641
|
+
[cli, "plugins", "uninstall", "--force", _OPENCLAW_PLUGIN_ID],
|
|
572
642
|
check=False,
|
|
573
643
|
capture_output=True,
|
|
574
644
|
text=True,
|
|
575
645
|
)
|
|
576
|
-
stale_ext = Path.home() / ".openclaw" / "extensions" /
|
|
646
|
+
stale_ext = Path.home() / ".openclaw" / "extensions" / _OPENCLAW_PLUGIN_ID
|
|
577
647
|
shutil.rmtree(stale_ext, ignore_errors=True)
|
|
578
648
|
|
|
579
|
-
# Install plugin and restart gateway so inspect sees the new state
|
|
580
649
|
try:
|
|
581
650
|
subprocess.run(
|
|
582
|
-
[
|
|
651
|
+
[cli, "plugins", "install", str(plugin_dir)],
|
|
583
652
|
check=True,
|
|
584
653
|
capture_output=True,
|
|
585
654
|
text=True,
|
|
586
655
|
)
|
|
587
656
|
subprocess.run(
|
|
588
|
-
[
|
|
657
|
+
[cli, "plugins", "enable", _OPENCLAW_PLUGIN_ID],
|
|
589
658
|
check=True,
|
|
590
659
|
capture_output=True,
|
|
591
660
|
text=True,
|
|
592
661
|
)
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
662
|
+
# Conversation-access opt-in is required for non-bundled plugins to
|
|
663
|
+
# receive typed hooks (agent_end, before_prompt_build, etc.). Without
|
|
664
|
+
# this, the gateway silently drops every plugin-side hook dispatch
|
|
665
|
+
# with: '[plugins] typed hook "agent_end" blocked because non-bundled
|
|
666
|
+
# plugins must set ...hooks.allowConversationAccess=true'.
|
|
667
|
+
access_cfg = subprocess.run(
|
|
668
|
+
[
|
|
669
|
+
cli,
|
|
670
|
+
"config",
|
|
671
|
+
"set",
|
|
672
|
+
f"plugins.entries.{_OPENCLAW_PLUGIN_ID}.hooks.allowConversationAccess",
|
|
673
|
+
"true",
|
|
674
|
+
],
|
|
675
|
+
check=False,
|
|
596
676
|
capture_output=True,
|
|
597
677
|
text=True,
|
|
598
678
|
)
|
|
679
|
+
if access_cfg.returncode != 0:
|
|
680
|
+
typer.echo(
|
|
681
|
+
"Error: could not persist openClaw conversation-access permission: "
|
|
682
|
+
f"{access_cfg.stderr or access_cfg.stdout}"
|
|
683
|
+
)
|
|
684
|
+
raise typer.Exit(1)
|
|
599
685
|
except subprocess.CalledProcessError as exc:
|
|
600
686
|
typer.echo(f"Error: openclaw command failed: {exc.stderr or exc.stdout}")
|
|
601
687
|
raise typer.Exit(1) from exc
|
|
602
688
|
|
|
689
|
+
# First-run: warm uv venv so the next hook isn't billed for cold install
|
|
690
|
+
_run_smart_install(plugin_dir)
|
|
691
|
+
|
|
692
|
+
# Gateway restart is best-effort — older openclaw builds may not expose it
|
|
693
|
+
subprocess.run(
|
|
694
|
+
[cli, "gateway", "restart"],
|
|
695
|
+
check=False,
|
|
696
|
+
capture_output=True,
|
|
697
|
+
text=True,
|
|
698
|
+
)
|
|
699
|
+
|
|
603
700
|
# Verify — match exact "Status: loaded" to avoid false positives from
|
|
604
701
|
# "not loaded" or "unloaded"
|
|
605
702
|
result = subprocess.run(
|
|
606
|
-
[
|
|
703
|
+
[cli, "plugins", "inspect", _OPENCLAW_PLUGIN_ID],
|
|
607
704
|
capture_output=True,
|
|
608
705
|
text=True,
|
|
609
706
|
)
|
|
@@ -612,32 +709,46 @@ def _install_openclaw_integration() -> bool:
|
|
|
612
709
|
return True
|
|
613
710
|
|
|
614
711
|
typer.echo(
|
|
615
|
-
"Error: Plugin not loaded -- check 'openclaw plugins inspect
|
|
712
|
+
f"Error: Plugin not loaded -- check 'openclaw plugins inspect {_OPENCLAW_PLUGIN_ID}'"
|
|
616
713
|
)
|
|
617
714
|
return False
|
|
618
715
|
|
|
619
716
|
|
|
620
|
-
def _uninstall_openclaw() -> None:
|
|
621
|
-
"""Remove the
|
|
717
|
+
def _uninstall_openclaw(env_path: Path | None = None, purge: bool = False) -> None:
|
|
718
|
+
"""Remove the openclaw-smart integration from openClaw.
|
|
719
|
+
|
|
720
|
+
Args:
|
|
721
|
+
env_path (Path | None): Path to ``~/.reflexio/.env`` to strip the
|
|
722
|
+
``OPENCLAW_BIN`` / ``OPENCLAW_SMART_USE_LOCAL_CLI`` keys from. ``None``
|
|
723
|
+
skips the .env cleanup.
|
|
724
|
+
purge (bool): Also delete ``~/.openclaw-smart/`` state directory.
|
|
725
|
+
"""
|
|
622
726
|
typer.confirm(
|
|
623
|
-
"This will remove the Reflexio integration from
|
|
727
|
+
"This will remove the Reflexio integration from openClaw. Continue?",
|
|
624
728
|
abort=True,
|
|
625
729
|
)
|
|
626
|
-
|
|
730
|
+
cli = _read_env_key(env_path, "OPENCLAW_BIN") or shutil.which("openclaw")
|
|
731
|
+
if cli:
|
|
627
732
|
subprocess.run(
|
|
628
|
-
[
|
|
733
|
+
[cli, "plugins", "disable", _OPENCLAW_PLUGIN_ID],
|
|
629
734
|
check=False,
|
|
630
735
|
capture_output=True,
|
|
631
736
|
text=True,
|
|
632
737
|
)
|
|
633
738
|
subprocess.run(
|
|
634
|
-
[
|
|
739
|
+
[cli, "plugins", "uninstall", "--force", _OPENCLAW_PLUGIN_ID],
|
|
635
740
|
check=False,
|
|
636
741
|
capture_output=True,
|
|
637
742
|
text=True,
|
|
638
743
|
)
|
|
639
744
|
else:
|
|
640
|
-
typer.echo(
|
|
745
|
+
typer.echo(
|
|
746
|
+
"Warning: openclaw CLI not found in OPENCLAW_BIN or PATH, "
|
|
747
|
+
"skipping plugin removal"
|
|
748
|
+
)
|
|
749
|
+
|
|
750
|
+
if env_path is not None:
|
|
751
|
+
_remove_env_keys(env_path, ("OPENCLAW_BIN", "OPENCLAW_SMART_USE_LOCAL_CLI"))
|
|
641
752
|
|
|
642
753
|
# Remove setup markers
|
|
643
754
|
from reflexio.cli.paths import reflexio_home
|
|
@@ -648,7 +759,27 @@ def _uninstall_openclaw() -> None:
|
|
|
648
759
|
marker.unlink(missing_ok=True)
|
|
649
760
|
typer.echo(f"Removed setup marker: {marker}")
|
|
650
761
|
|
|
651
|
-
|
|
762
|
+
if purge:
|
|
763
|
+
state_dir = Path.home() / ".openclaw-smart"
|
|
764
|
+
if state_dir.exists():
|
|
765
|
+
shutil.rmtree(state_dir, ignore_errors=True)
|
|
766
|
+
typer.echo(f"Removed plugin state: {state_dir}")
|
|
767
|
+
|
|
768
|
+
typer.echo("Reflexio integration fully removed from openClaw.")
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
def _repair_openclaw() -> None:
|
|
772
|
+
"""Re-run the plugin's first-run installer and clear any failure marker."""
|
|
773
|
+
plugin_dir = _openclaw_plugin_dir()
|
|
774
|
+
if not plugin_dir.exists():
|
|
775
|
+
typer.echo(f"Error: plugin directory not found at {plugin_dir}")
|
|
776
|
+
raise typer.Exit(1)
|
|
777
|
+
failure_marker = Path.home() / ".openclaw-smart" / "install-failed"
|
|
778
|
+
if failure_marker.exists():
|
|
779
|
+
failure_marker.unlink()
|
|
780
|
+
typer.echo(f"Cleared {failure_marker}")
|
|
781
|
+
_run_smart_install(plugin_dir)
|
|
782
|
+
typer.echo("Repair complete. Restart openClaw to pick up the refreshed env.")
|
|
652
783
|
|
|
653
784
|
|
|
654
785
|
@app.command("openclaw")
|
|
@@ -656,7 +787,27 @@ def openclaw(
|
|
|
656
787
|
uninstall: Annotated[
|
|
657
788
|
bool,
|
|
658
789
|
typer.Option(
|
|
659
|
-
"--uninstall", help="Remove the Reflexio integration from
|
|
790
|
+
"--uninstall", help="Remove the Reflexio integration from openClaw"
|
|
791
|
+
),
|
|
792
|
+
] = False,
|
|
793
|
+
repair: Annotated[
|
|
794
|
+
bool,
|
|
795
|
+
typer.Option(
|
|
796
|
+
"--repair",
|
|
797
|
+
help=(
|
|
798
|
+
"Re-run the plugin first-run installer and clear any failure "
|
|
799
|
+
"marker without reinstalling the plugin in openClaw."
|
|
800
|
+
),
|
|
801
|
+
),
|
|
802
|
+
] = False,
|
|
803
|
+
purge: Annotated[
|
|
804
|
+
bool,
|
|
805
|
+
typer.Option(
|
|
806
|
+
"--purge",
|
|
807
|
+
help=(
|
|
808
|
+
"With --uninstall: also delete ~/.openclaw-smart/ state "
|
|
809
|
+
"(buffered sessions, install markers, logs). Destructive."
|
|
810
|
+
),
|
|
660
811
|
),
|
|
661
812
|
] = False,
|
|
662
813
|
embedding: Annotated[
|
|
@@ -671,9 +822,28 @@ def openclaw(
|
|
|
671
822
|
),
|
|
672
823
|
] = "auto",
|
|
673
824
|
) -> None:
|
|
674
|
-
"""Set up (or remove) the
|
|
825
|
+
"""Set up (or remove) the openclaw-smart integration for openClaw."""
|
|
826
|
+
# Resolve the user-global .env path up front; all three flows write to it.
|
|
827
|
+
from reflexio.cli.env_loader import ensure_user_env_for_setup
|
|
828
|
+
|
|
829
|
+
env_path = ensure_user_env_for_setup()
|
|
830
|
+
if env_path is None:
|
|
831
|
+
typer.echo("Error: could not locate or create a .env file")
|
|
832
|
+
raise typer.Exit(1)
|
|
833
|
+
|
|
834
|
+
if repair and (uninstall or purge):
|
|
835
|
+
typer.echo("Error: --repair cannot be combined with --uninstall or --purge")
|
|
836
|
+
raise typer.Exit(1)
|
|
837
|
+
if purge and not uninstall:
|
|
838
|
+
typer.echo("Error: --purge requires --uninstall")
|
|
839
|
+
raise typer.Exit(1)
|
|
840
|
+
|
|
841
|
+
if repair:
|
|
842
|
+
_repair_openclaw()
|
|
843
|
+
return
|
|
844
|
+
|
|
675
845
|
if uninstall:
|
|
676
|
-
_uninstall_openclaw()
|
|
846
|
+
_uninstall_openclaw(env_path=env_path, purge=purge)
|
|
677
847
|
return
|
|
678
848
|
|
|
679
849
|
if embedding not in _VALID_EMBEDDING_FLAGS:
|
|
@@ -683,26 +853,15 @@ def openclaw(
|
|
|
683
853
|
)
|
|
684
854
|
raise typer.Exit(1)
|
|
685
855
|
|
|
686
|
-
# Step 1:
|
|
687
|
-
# from a worktree or project root that happens to contain its own .env
|
|
688
|
-
# would otherwise pollute that file via load_reflexio_env's CWD-first
|
|
689
|
-
# search. Setup writes are user-global, not project-local.
|
|
690
|
-
from reflexio.cli.env_loader import ensure_user_env_for_setup
|
|
691
|
-
|
|
692
|
-
env_path = ensure_user_env_for_setup()
|
|
693
|
-
if env_path is None:
|
|
694
|
-
typer.echo("Error: could not locate or create a .env file")
|
|
695
|
-
raise typer.Exit(1)
|
|
696
|
-
|
|
697
|
-
# Step 2: LLM provider
|
|
856
|
+
# Step 1: LLM provider
|
|
698
857
|
display_name, model, _provider_key = _prompt_llm_provider(env_path)
|
|
699
858
|
|
|
700
|
-
# Step
|
|
859
|
+
# Step 2: Storage. Decided BEFORE the embedding step because Managed /
|
|
701
860
|
# Self-hosted modes own their own embedding config server-side, and a
|
|
702
861
|
# local override would just shadow the operator's choice.
|
|
703
862
|
storage_label = _prompt_storage(env_path)
|
|
704
863
|
|
|
705
|
-
# Step
|
|
864
|
+
# Step 2.5: Upfront embedding-provider step. Local is the default when
|
|
706
865
|
# chromadb is importable; the choice persists to org config so it
|
|
707
866
|
# survives later cloud-key changes. Skipped for remote storage modes
|
|
708
867
|
# for the reason above.
|
|
@@ -711,12 +870,13 @@ def openclaw(
|
|
|
711
870
|
if not is_remote:
|
|
712
871
|
embedding_label = _choose_embedding_provider(env_path, embedding_flag=embedding)
|
|
713
872
|
|
|
714
|
-
# Step
|
|
873
|
+
# Step 3: Install openclaw-smart integration
|
|
715
874
|
typer.echo("")
|
|
716
|
-
hook_ok = _install_openclaw_integration()
|
|
875
|
+
hook_ok = _install_openclaw_integration(env_path)
|
|
717
876
|
|
|
718
|
-
|
|
719
|
-
|
|
877
|
+
hook_status = (
|
|
878
|
+
_OPENCLAW_PLUGIN_ID if hook_ok else f"{_OPENCLAW_PLUGIN_ID} (unverified)"
|
|
879
|
+
)
|
|
720
880
|
|
|
721
881
|
typer.echo("")
|
|
722
882
|
typer.echo("Setup complete!")
|
|
@@ -727,7 +887,7 @@ def openclaw(
|
|
|
727
887
|
typer.echo(f" Plugin: {hook_status}")
|
|
728
888
|
typer.echo("")
|
|
729
889
|
typer.echo("Next steps:")
|
|
730
|
-
typer.echo(" 1. Restart
|
|
890
|
+
typer.echo(" 1. Restart openClaw gateway: openclaw gateway restart")
|
|
731
891
|
typer.echo(
|
|
732
892
|
" 2. Start a conversation -- Reflexio will capture and learn automatically"
|
|
733
893
|
)
|
|
@@ -39,6 +39,7 @@ def _build_publish_args(
|
|
|
39
39
|
stdin: bool,
|
|
40
40
|
skip_aggregation: bool,
|
|
41
41
|
force_extraction: bool,
|
|
42
|
+
evaluation_only: bool,
|
|
42
43
|
) -> list[str]:
|
|
43
44
|
"""Assemble the argv the ``interactions publish`` command expects.
|
|
44
45
|
|
|
@@ -49,7 +50,7 @@ def _build_publish_args(
|
|
|
49
50
|
|
|
50
51
|
Args:
|
|
51
52
|
user_id: Optional user identifier.
|
|
52
|
-
session_id:
|
|
53
|
+
session_id: Required session identifier for publish requests.
|
|
53
54
|
source: Source tag recorded on the interaction.
|
|
54
55
|
agent_version: Optional agent version tag.
|
|
55
56
|
wait: When True, wait for processing to complete.
|
|
@@ -61,6 +62,8 @@ def _build_publish_args(
|
|
|
61
62
|
skip_aggregation: When True, skip post-extract aggregation.
|
|
62
63
|
force_extraction: When True, bypass all extraction gates
|
|
63
64
|
(stride_size, cheap pre-filter, LLM should_run).
|
|
65
|
+
evaluation_only: When True, store for session-level evaluation
|
|
66
|
+
only and skip profile/playbook extraction.
|
|
64
67
|
|
|
65
68
|
Returns:
|
|
66
69
|
list[str]: argv list ready to hand to ``interactions_app(...)``.
|
|
@@ -89,6 +92,8 @@ def _build_publish_args(
|
|
|
89
92
|
args.append("--skip-aggregation")
|
|
90
93
|
if force_extraction:
|
|
91
94
|
args.append("--force-extraction")
|
|
95
|
+
if evaluation_only:
|
|
96
|
+
args.append("--evaluation-only")
|
|
92
97
|
return args
|
|
93
98
|
|
|
94
99
|
|
|
@@ -108,7 +113,7 @@ def register_shortcuts(app: typer.Typer) -> None:
|
|
|
108
113
|
typer.Option("--user-id", help="User identifier (optional if in payload)"),
|
|
109
114
|
] = None,
|
|
110
115
|
session_id: Annotated[
|
|
111
|
-
str | None, typer.Option("--session-id", help="
|
|
116
|
+
str | None, typer.Option("--session-id", help="Required session ID")
|
|
112
117
|
] = None,
|
|
113
118
|
source: Annotated[str, typer.Option(help="Source tag")] = "cli",
|
|
114
119
|
agent_version: Annotated[
|
|
@@ -147,6 +152,13 @@ def register_shortcuts(app: typer.Typer) -> None:
|
|
|
147
152
|
help="Bypass all extraction gates (stride_size, cheap pre-filter, LLM should_run) and always run extractors",
|
|
148
153
|
),
|
|
149
154
|
] = False,
|
|
155
|
+
evaluation_only: Annotated[
|
|
156
|
+
bool,
|
|
157
|
+
typer.Option(
|
|
158
|
+
"--evaluation-only",
|
|
159
|
+
help="Store for session-level evaluation only and skip profile/playbook extraction",
|
|
160
|
+
),
|
|
161
|
+
] = False,
|
|
150
162
|
) -> None:
|
|
151
163
|
"""Publish interactions (shortcut for: interactions publish)."""
|
|
152
164
|
from reflexio.cli.commands.interactions import app as interactions_app
|
|
@@ -164,6 +176,7 @@ def register_shortcuts(app: typer.Typer) -> None:
|
|
|
164
176
|
stdin=stdin,
|
|
165
177
|
skip_aggregation=skip_aggregation,
|
|
166
178
|
force_extraction=force_extraction,
|
|
179
|
+
evaluation_only=evaluation_only,
|
|
167
180
|
)
|
|
168
181
|
|
|
169
182
|
# Propagate context
|