fr-cli 2.4.2__tar.gz → 2.6.0__tar.gz
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.
- {fr_cli-2.4.2/fr_cli.egg-info → fr_cli-2.6.0}/PKG-INFO +21 -2
- {fr_cli-2.4.2 → fr_cli-2.6.0}/README.md +19 -1
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/README.md +14 -4
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/WEAPON.MD +11 -43
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/__init__.py +1 -1
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/addon/plugin.py +1 -2
- fr_cli-2.6.0/fr_cli/agent/artifact_detector.py +153 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/agent/builtins/db.py +11 -9
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/agent/builtins/local.py +4 -6
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/agent/builtins/rag.py +20 -129
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/agent/builtins/rag_watcher_daemon.py +1 -1
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/agent/builtins/remote.py +18 -15
- fr_cli-2.6.0/fr_cli/agent/builtins/spider/__init__.py +14 -0
- fr_cli-2.6.0/fr_cli/agent/builtins/spider/analyzer.py +157 -0
- fr_cli-2.6.0/fr_cli/agent/builtins/spider/crawler.py +220 -0
- fr_cli-2.6.0/fr_cli/agent/builtins/spider/deps.py +83 -0
- fr_cli-2.6.0/fr_cli/agent/builtins/spider/evasion.py +231 -0
- fr_cli-2.6.0/fr_cli/agent/builtins/spider/fetcher.py +256 -0
- fr_cli-2.6.0/fr_cli/agent/builtins/spider/memory.py +84 -0
- fr_cli-2.6.0/fr_cli/agent/builtins/stock.py +395 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/agent/client.py +61 -22
- fr_cli-2.6.0/fr_cli/agent/dispatch.py +90 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/agent/executor.py +33 -33
- fr_cli-2.6.0/fr_cli/agent/generator.py +213 -0
- fr_cli-2.6.0/fr_cli/agent/hermes/__init__.py +64 -0
- fr_cli-2.6.0/fr_cli/agent/hermes/engine.py +487 -0
- fr_cli-2.6.0/fr_cli/agent/hermes/managers.py +251 -0
- fr_cli-2.6.0/fr_cli/agent/hermes/models.py +141 -0
- fr_cli-2.6.0/fr_cli/agent/hermes/scheduler.py +47 -0
- fr_cli-2.6.0/fr_cli/agent/hermes_daemon.py +449 -0
- fr_cli-2.6.0/fr_cli/agent/hermes_daemon_process.py +125 -0
- fr_cli-2.6.0/fr_cli/agent/hermes_manager.py +199 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/agent/manager.py +32 -28
- fr_cli-2.6.0/fr_cli/agent/master.py +109 -0
- fr_cli-2.6.0/fr_cli/agent/master_loop.py +269 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/agent/master_prompt.py +7 -2
- fr_cli-2.6.0/fr_cli/agent/master_prompt_builder.py +120 -0
- fr_cli-2.6.0/fr_cli/agent/master_reflect.py +177 -0
- fr_cli-2.6.0/fr_cli/agent/master_storage.py +185 -0
- fr_cli-2.6.0/fr_cli/agent/review_queue.py +136 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/agent/server.py +67 -14
- fr_cli-2.6.0/fr_cli/agent/shell_mode.py +52 -0
- fr_cli-2.6.0/fr_cli/agent/swarm.py +174 -0
- fr_cli-2.6.0/fr_cli/agent/swarm_resolver.py +310 -0
- fr_cli-2.6.0/fr_cli/agent/workflow.py +283 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/breakthrough/update.py +48 -39
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/command/executor.py +87 -47
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/command/registered/agent_data_mcp.py +28 -25
- fr_cli-2.6.0/fr_cli/command/registered/charts.py +45 -0
- fr_cli-2.6.0/fr_cli/command/registered/dynamic_build.py +133 -0
- fr_cli-2.6.0/fr_cli/command/registered/fs.py +144 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/command/registered/image.py +5 -4
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/command/registered/main_routes.py +1 -1
- fr_cli-2.6.0/fr_cli/command/registered/network.py +61 -0
- fr_cli-2.6.0/fr_cli/command/registered/ocr.py +26 -0
- fr_cli-2.6.0/fr_cli/command/registered/remote.py +55 -0
- fr_cli-2.6.0/fr_cli/command/registered/services.py +366 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/command/registered/session_config.py +76 -42
- fr_cli-2.6.0/fr_cli/command/registered/swarm.py +35 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/command/registered/web.py +7 -6
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/command/registry.py +187 -20
- fr_cli-2.6.0/fr_cli/command/security.py +93 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/conf/config.py +18 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/conf/paths.py +17 -3
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/core/chat.py +178 -4
- fr_cli-2.6.0/fr_cli/core/core.py +572 -0
- fr_cli-2.6.0/fr_cli/core/error_ledger.py +91 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/core/errors.py +0 -3
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/core/intent.py +7 -3
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/core/llm.py +1 -2
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/core/model_factory.py +15 -15
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/core/optimizations.py +3 -5
- fr_cli-2.6.0/fr_cli/core/plan/__init__.py +50 -0
- fr_cli-2.6.0/fr_cli/core/plan/executor.py +182 -0
- fr_cli-2.6.0/fr_cli/core/plan/generator.py +158 -0
- fr_cli-2.6.0/fr_cli/core/plan/prompts.py +102 -0
- fr_cli-2.6.0/fr_cli/core/plan/storage.py +56 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/core/preferences.py +1 -1
- fr_cli-2.6.0/fr_cli/core/result.py +84 -0
- fr_cli-2.6.0/fr_cli/core/store.py +75 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/core/stream.py +0 -1
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/core/sysmon.py +2 -5
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/core/thinking.py +5 -2
- fr_cli-2.6.0/fr_cli/core/usage.py +87 -0
- fr_cli-2.6.0/fr_cli/dynamic_builder/__init__.py +19 -0
- fr_cli-2.6.0/fr_cli/dynamic_builder/code_generator.py +90 -0
- fr_cli-2.6.0/fr_cli/dynamic_builder/dependency_manager.py +118 -0
- fr_cli-2.6.0/fr_cli/dynamic_builder/gap_analyzer.py +161 -0
- fr_cli-2.6.0/fr_cli/dynamic_builder/planner.py +106 -0
- fr_cli-2.6.0/fr_cli/dynamic_builder/registry_manager.py +223 -0
- fr_cli-2.6.0/fr_cli/dynamic_builder/runner.py +172 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/gatekeeper/daemon.py +0 -1
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/gatekeeper/manager.py +27 -29
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/lang/translations/en.py +4 -3
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/lang/translations/zh.py +4 -3
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/main.py +9 -88
- fr_cli-2.6.0/fr_cli/memory/compress.py +160 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/memory/history.py +9 -12
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/memory/session.py +8 -15
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/repl/actions.py +1 -1
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/repl/batch.py +0 -2
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/repl/bootstrap.py +2 -6
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/repl/commands/__init__.py +6 -1
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/repl/commands/_common.py +29 -23
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/repl/commands/agent.py +20 -31
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/repl/commands/base.py +7 -21
- fr_cli-2.6.0/fr_cli/repl/commands/build.py +82 -0
- fr_cli-2.6.0/fr_cli/repl/commands/config/__init__.py +22 -0
- fr_cli-2.6.0/fr_cli/repl/commands/config/key.py +207 -0
- fr_cli-2.6.0/fr_cli/repl/commands/config/misc.py +106 -0
- fr_cli-2.6.0/fr_cli/repl/commands/config/model.py +239 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/repl/commands/cron.py +2 -20
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/repl/commands/dataframe.py +1 -21
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/repl/commands/dev.py +1 -21
- fr_cli-2.6.0/fr_cli/repl/commands/fs.py +46 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/repl/commands/mcp.py +1 -21
- fr_cli-2.6.0/fr_cli/repl/commands/ocr.py +224 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/repl/commands/rag.py +1 -21
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/repl/commands/remote_agent.py +6 -25
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/repl/commands/session.py +2 -14
- fr_cli-2.6.0/fr_cli/repl/commands/stock.py +127 -0
- fr_cli-2.6.0/fr_cli/repl/commands/system/__init__.py +42 -0
- fr_cli-2.6.0/fr_cli/repl/commands/system/autostart.py +52 -0
- fr_cli-2.6.0/fr_cli/repl/commands/system/context.py +80 -0
- fr_cli-2.6.0/fr_cli/repl/commands/system/hermes_cmd.py +213 -0
- fr_cli-2.6.0/fr_cli/repl/commands/system/launcher.py +39 -0
- fr_cli-2.6.0/fr_cli/repl/commands/system/server.py +61 -0
- fr_cli-2.6.0/fr_cli/repl/commands/system/setup.py +15 -0
- fr_cli-2.6.0/fr_cli/repl/commands/system/status.py +89 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/repl/commands/system.py +26 -42
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/repl/queue.py +1 -1
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/repl/quick_actions.py +2 -5
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/repl/router.py +26 -4
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/repl/scenarios.py +3 -2
- fr_cli-2.6.0/fr_cli/security/policy.py +60 -0
- fr_cli-2.6.0/fr_cli/security/security.py +133 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/ui/banner.py +2 -3
- fr_cli-2.6.0/fr_cli/ui/prompt/__init__.py +39 -0
- fr_cli-2.6.0/fr_cli/ui/prompt/completer.py +359 -0
- fr_cli-2.6.0/fr_cli/ui/prompt/fallback.py +89 -0
- fr_cli-2.6.0/fr_cli/ui/prompt/status.py +80 -0
- fr_cli-2.6.0/fr_cli/ui/prompt/tui.py +384 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/ui/ui.py +1 -1
- fr_cli-2.6.0/fr_cli/weapon/charts.py +223 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/weapon/cron.py +28 -4
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/weapon/dataframe.py +18 -10
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/weapon/disk.py +39 -35
- fr_cli-2.6.0/fr_cli/weapon/fs.py +415 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/weapon/launcher.py +8 -8
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/weapon/loader.py +5 -1
- fr_cli-2.6.0/fr_cli/weapon/m365.py +446 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/weapon/mail.py +20 -19
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/weapon/mcp.py +131 -182
- fr_cli-2.6.0/fr_cli/weapon/network.py +189 -0
- fr_cli-2.6.0/fr_cli/weapon/ocr.py +289 -0
- fr_cli-2.6.0/fr_cli/weapon/remote.py +132 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/weapon/vision.py +10 -9
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/weapon/web.py +20 -15
- {fr_cli-2.4.2 → fr_cli-2.6.0/fr_cli.egg-info}/PKG-INFO +21 -2
- fr_cli-2.6.0/fr_cli.egg-info/SOURCES.txt +231 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli.egg-info/requires.txt +1 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/pyproject.toml +23 -1
- fr_cli-2.6.0/tests/test_a2a_and_providers.py +148 -0
- fr_cli-2.6.0/tests/test_agent_create.py +181 -0
- fr_cli-2.6.0/tests/test_agent_manager_store.py +38 -0
- fr_cli-2.6.0/tests/test_agent_server.py +144 -0
- fr_cli-2.6.0/tests/test_artifact_detector.py +47 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/tests/test_batch_mode.py +0 -3
- fr_cli-2.6.0/tests/test_builtin_tools.py +169 -0
- fr_cli-2.6.0/tests/test_charts.py +139 -0
- fr_cli-2.6.0/tests/test_context_compress.py +146 -0
- fr_cli-2.6.0/tests/test_cron_persist.py +41 -0
- fr_cli-2.6.0/tests/test_dynamic_builder.py +190 -0
- fr_cli-2.6.0/tests/test_dynamic_builder_selftest.py +89 -0
- fr_cli-2.6.0/tests/test_gap_analyzer.py +109 -0
- fr_cli-2.6.0/tests/test_gatekeeper_store.py +39 -0
- fr_cli-2.6.0/tests/test_hermes.py +326 -0
- fr_cli-2.6.0/tests/test_hermes_daemon.py +189 -0
- fr_cli-2.6.0/tests/test_hermes_demo.py +151 -0
- fr_cli-2.6.0/tests/test_hermes_manager.py +66 -0
- fr_cli-2.6.0/tests/test_hermes_memory.py +94 -0
- fr_cli-2.6.0/tests/test_hermes_subtasks.py +181 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/tests/test_integration_real.py +23 -22
- fr_cli-2.6.0/tests/test_json_store.py +71 -0
- fr_cli-2.6.0/tests/test_m365_mail.py +231 -0
- fr_cli-2.6.0/tests/test_master_evolution.py +126 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/tests/test_master_prompt_fix.py +0 -1
- fr_cli-2.6.0/tests/test_mcp_real.py +40 -0
- fr_cli-2.6.0/tests/test_memory_store.py +66 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/tests/test_model_config.py +15 -18
- {fr_cli-2.4.2 → fr_cli-2.6.0}/tests/test_no_color_prompt_toolkit.py +0 -18
- fr_cli-2.6.0/tests/test_ocr.py +224 -0
- fr_cli-2.6.0/tests/test_plan.py +298 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/tests/test_plugin_exec.py +0 -3
- fr_cli-2.6.0/tests/test_repl_autostart.py +63 -0
- fr_cli-2.6.0/tests/test_repl_status.py +68 -0
- fr_cli-2.6.0/tests/test_result.py +37 -0
- fr_cli-2.6.0/tests/test_review_queue.py +66 -0
- fr_cli-2.6.0/tests/test_security.py +206 -0
- fr_cli-2.6.0/tests/test_security_autonomous.py +130 -0
- fr_cli-2.6.0/tests/test_stock.py +171 -0
- fr_cli-2.6.0/tests/test_swarm.py +259 -0
- fr_cli-2.6.0/tests/test_usage.py +87 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/tests/test_vfs_diff.py +11 -15
- fr_cli-2.6.0/tests/test_workflow.py +143 -0
- fr_cli-2.4.2/fr_cli/agent/a2a.py +0 -568
- fr_cli-2.4.2/fr_cli/agent/acp.py +0 -199
- fr_cli-2.4.2/fr_cli/agent/artifact_detector.py +0 -106
- fr_cli-2.4.2/fr_cli/agent/builtins/powerful_agent_template.py +0 -923
- fr_cli-2.4.2/fr_cli/agent/builtins/spider.py +0 -951
- fr_cli-2.4.2/fr_cli/agent/coding_helper.py +0 -811
- fr_cli-2.4.2/fr_cli/agent/context_files.py +0 -160
- fr_cli-2.4.2/fr_cli/agent/gateway.py +0 -234
- fr_cli-2.4.2/fr_cli/agent/generator.py +0 -105
- fr_cli-2.4.2/fr_cli/agent/hermes.py +0 -344
- fr_cli-2.4.2/fr_cli/agent/hermes_daemon.py +0 -266
- fr_cli-2.4.2/fr_cli/agent/image_and_parallel.py +0 -1013
- fr_cli-2.4.2/fr_cli/agent/master.py +0 -607
- fr_cli-2.4.2/fr_cli/agent/personality.py +0 -237
- fr_cli-2.4.2/fr_cli/agent/plugin_system.py +0 -195
- fr_cli-2.4.2/fr_cli/agent/shell_mode.py +0 -181
- fr_cli-2.4.2/fr_cli/agent/skills.py +0 -227
- fr_cli-2.4.2/fr_cli/agent/workflow.py +0 -174
- fr_cli-2.4.2/fr_cli/agent/workflow_system/__init__.py +0 -14
- fr_cli-2.4.2/fr_cli/agent/workflow_system/engine.py +0 -414
- fr_cli-2.4.2/fr_cli/agent/workflow_system/executor.py +0 -217
- fr_cli-2.4.2/fr_cli/agent/workflow_system/manager.py +0 -84
- fr_cli-2.4.2/fr_cli/agent/workflow_system/models.py +0 -195
- fr_cli-2.4.2/fr_cli/agent/workflow_system/monitor.py +0 -68
- fr_cli-2.4.2/fr_cli/agent/workflow_system/tools.py +0 -224
- fr_cli-2.4.2/fr_cli/agent/workflow_system.py +0 -23
- fr_cli-2.4.2/fr_cli/command/handlers/__init__.py +0 -15
- fr_cli-2.4.2/fr_cli/command/handlers/agent.py +0 -73
- fr_cli-2.4.2/fr_cli/command/handlers/app.py +0 -31
- fr_cli-2.4.2/fr_cli/command/handlers/config.py +0 -167
- fr_cli-2.4.2/fr_cli/command/handlers/cron.py +0 -56
- fr_cli-2.4.2/fr_cli/command/handlers/dataframe.py +0 -34
- fr_cli-2.4.2/fr_cli/command/handlers/disk.py +0 -84
- fr_cli-2.4.2/fr_cli/command/handlers/fs.py +0 -95
- fr_cli-2.4.2/fr_cli/command/handlers/mail.py +0 -81
- fr_cli-2.4.2/fr_cli/command/handlers/mcp.py +0 -46
- fr_cli-2.4.2/fr_cli/command/handlers/other.py +0 -34
- fr_cli-2.4.2/fr_cli/command/handlers/session.py +0 -79
- fr_cli-2.4.2/fr_cli/command/handlers/system.py +0 -189
- fr_cli-2.4.2/fr_cli/command/handlers/vision.py +0 -38
- fr_cli-2.4.2/fr_cli/command/handlers/web.py +0 -34
- fr_cli-2.4.2/fr_cli/command/registered/fs.py +0 -84
- fr_cli-2.4.2/fr_cli/command/registered/services.py +0 -236
- fr_cli-2.4.2/fr_cli/command/security.py +0 -30
- fr_cli-2.4.2/fr_cli/core/core.py +0 -280
- fr_cli-2.4.2/fr_cli/repl/commands/config.py +0 -512
- fr_cli-2.4.2/fr_cli/repl/commands/fs.py +0 -66
- fr_cli-2.4.2/fr_cli/repl/commands.py +0 -43
- fr_cli-2.4.2/fr_cli/security/security.py +0 -50
- fr_cli-2.4.2/fr_cli/ui/prompt.py +0 -856
- fr_cli-2.4.2/fr_cli/ui/splash.py +0 -340
- fr_cli-2.4.2/fr_cli/ui/web_config.py +0 -239
- fr_cli-2.4.2/fr_cli/weapon/fs.py +0 -309
- fr_cli-2.4.2/fr_cli.egg-info/SOURCES.txt +0 -165
- fr_cli-2.4.2/tests/test_a2a_and_providers.py +0 -447
- fr_cli-2.4.2/tests/test_new_features.py +0 -449
- {fr_cli-2.4.2 → fr_cli-2.6.0}/LICENSE +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/MANIFEST.in +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/agent/__init__.py +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/agent/builtins/__init__.py +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/agent/builtins/_utils.py +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/agent/remote.py +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/assets/splash.jpeg +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/command/__init__.py +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/conf/__init__.py +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/conf/default_models.yaml +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/conf/wizard.py +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/core/cache.py +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/core/project.py +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/core/recommender.py +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/gatekeeper/__init__.py +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/lang/i18n.py +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/lang/translations/__init__.py +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/memory/context.py +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/repl/__init__.py +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/ui/buddha.py +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli/ui/markdown.py +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli.egg-info/dependency_links.txt +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli.egg-info/entry_points.txt +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/fr_cli.egg-info/top_level.txt +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/setup.cfg +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/tests/test_help_update.py +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/tests/test_new_providers.py +0 -0
- {fr_cli-2.4.2 → fr_cli-2.6.0}/tests/test_prompt_completion.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fr-cli
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.6.0
|
|
4
4
|
Summary: 凡人打字机 - 支持多模型(Zhipu/DeepSeek/Kimi/Qwen/StepFun/MiniMax/Spark/Doubao/MiMo)的终极全能终端工具
|
|
5
5
|
Author: FANREN CLI Author
|
|
6
6
|
License-Expression: MIT
|
|
@@ -30,6 +30,7 @@ Requires-Dist: mcp>=1.6.0
|
|
|
30
30
|
Requires-Dist: pyyaml>=6.0.0
|
|
31
31
|
Requires-Dist: prompt_toolkit>=3.0.0
|
|
32
32
|
Requires-Dist: Pillow>=10.0.0
|
|
33
|
+
Requires-Dist: pymupdf>=1.23.0
|
|
33
34
|
Provides-Extra: data
|
|
34
35
|
Requires-Dist: pandas>=1.5.0; extra == "data"
|
|
35
36
|
Requires-Dist: openpyxl>=3.0.0; extra == "data"
|
|
@@ -108,7 +109,7 @@ Dynamic: license-file
|
|
|
108
109
|
|
|
109
110
|
### 🎯 特色功能
|
|
110
111
|
- **视觉能力**:图片生成 (CogView) 与多模态识别 (GLM-4V)
|
|
111
|
-
- **邮件收发**:支持 IMAP/SMTP
|
|
112
|
+
- **邮件收发**:支持 IMAP/SMTP 与 Microsoft 365 现代认证(OAuth2 + MFA,防头注入)
|
|
112
113
|
- **定时任务**:后台定时执行命令(shlex 安全解析)
|
|
113
114
|
- **云盘集成**:百度/阿里/OneDrive 网盘
|
|
114
115
|
- **插件系统**:AI 生成代码自动保存为插件(子进程隔离)
|
|
@@ -176,6 +177,15 @@ fr-cli
|
|
|
176
177
|
/mcp_add <名> <命令> [参数] 添加 MCP 服务器
|
|
177
178
|
/mcp_del <名> 删除 MCP 服务器
|
|
178
179
|
|
|
180
|
+
/mail setup 配置 IMAP/SMTP 邮箱
|
|
181
|
+
/mail inbox 查看收件箱
|
|
182
|
+
/mail read <id> 读取邮件
|
|
183
|
+
/mail send <to> <sub> <body> 发送邮件
|
|
184
|
+
/m365_config setup 配置 Microsoft 365 邮箱(OAuth2 + MFA)
|
|
185
|
+
/m365_inbox 查看 Microsoft 365 收件箱
|
|
186
|
+
/m365_read <id> 读取 Microsoft 365 邮件
|
|
187
|
+
/m365_send <to> <sub> <body> 发送 Microsoft 365 邮件
|
|
188
|
+
|
|
179
189
|
/help 查看帮助
|
|
180
190
|
/exit 退出
|
|
181
191
|
```
|
|
@@ -467,6 +477,15 @@ fr_cli/
|
|
|
467
477
|
- QQ/163 邮箱需使用「授权码」而非登录密码
|
|
468
478
|
- 授权码在邮箱设置 → 账户 → 开启 IMAP/SMTP 服务后生成
|
|
469
479
|
|
|
480
|
+
**Q: Microsoft 365 / Outlook 邮箱如何使用?**
|
|
481
|
+
Microsoft 365 已禁用基本认证,需使用 OAuth2 现代认证:
|
|
482
|
+
1. 在 Azure AD 注册应用,添加 `Mail.Read`、`Mail.Send`、`User.Read` 委派权限
|
|
483
|
+
2. 复制 Application (client) ID 和 Directory (tenant) ID
|
|
484
|
+
3. 执行 `/m365_config setup`,按向导完成设备码或授权码登录(支持 MFA)
|
|
485
|
+
4. 之后使用 `/m365_inbox`、`/m365_read <id>`、`/m365_send <to> <sub> <body>`
|
|
486
|
+
|
|
487
|
+
Token 缓存于 `~/.fr_cli/m365.json`,文件权限 `0o600`。
|
|
488
|
+
|
|
470
489
|
**Q: 搜索功能无法使用?**
|
|
471
490
|
```bash
|
|
472
491
|
pip install requests
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
### 🎯 特色功能
|
|
36
36
|
- **视觉能力**:图片生成 (CogView) 与多模态识别 (GLM-4V)
|
|
37
|
-
- **邮件收发**:支持 IMAP/SMTP
|
|
37
|
+
- **邮件收发**:支持 IMAP/SMTP 与 Microsoft 365 现代认证(OAuth2 + MFA,防头注入)
|
|
38
38
|
- **定时任务**:后台定时执行命令(shlex 安全解析)
|
|
39
39
|
- **云盘集成**:百度/阿里/OneDrive 网盘
|
|
40
40
|
- **插件系统**:AI 生成代码自动保存为插件(子进程隔离)
|
|
@@ -102,6 +102,15 @@ fr-cli
|
|
|
102
102
|
/mcp_add <名> <命令> [参数] 添加 MCP 服务器
|
|
103
103
|
/mcp_del <名> 删除 MCP 服务器
|
|
104
104
|
|
|
105
|
+
/mail setup 配置 IMAP/SMTP 邮箱
|
|
106
|
+
/mail inbox 查看收件箱
|
|
107
|
+
/mail read <id> 读取邮件
|
|
108
|
+
/mail send <to> <sub> <body> 发送邮件
|
|
109
|
+
/m365_config setup 配置 Microsoft 365 邮箱(OAuth2 + MFA)
|
|
110
|
+
/m365_inbox 查看 Microsoft 365 收件箱
|
|
111
|
+
/m365_read <id> 读取 Microsoft 365 邮件
|
|
112
|
+
/m365_send <to> <sub> <body> 发送 Microsoft 365 邮件
|
|
113
|
+
|
|
105
114
|
/help 查看帮助
|
|
106
115
|
/exit 退出
|
|
107
116
|
```
|
|
@@ -393,6 +402,15 @@ fr_cli/
|
|
|
393
402
|
- QQ/163 邮箱需使用「授权码」而非登录密码
|
|
394
403
|
- 授权码在邮箱设置 → 账户 → 开启 IMAP/SMTP 服务后生成
|
|
395
404
|
|
|
405
|
+
**Q: Microsoft 365 / Outlook 邮箱如何使用?**
|
|
406
|
+
Microsoft 365 已禁用基本认证,需使用 OAuth2 现代认证:
|
|
407
|
+
1. 在 Azure AD 注册应用,添加 `Mail.Read`、`Mail.Send`、`User.Read` 委派权限
|
|
408
|
+
2. 复制 Application (client) ID 和 Directory (tenant) ID
|
|
409
|
+
3. 执行 `/m365_config setup`,按向导完成设备码或授权码登录(支持 MFA)
|
|
410
|
+
4. 之后使用 `/m365_inbox`、`/m365_read <id>`、`/m365_send <to> <sub> <body>`
|
|
411
|
+
|
|
412
|
+
Token 缓存于 `~/.fr_cli/m365.json`,文件权限 `0o600`。
|
|
413
|
+
|
|
396
414
|
**Q: 搜索功能无法使用?**
|
|
397
415
|
```bash
|
|
398
416
|
pip install requests
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
**🇨🇳 中文简介**
|
|
6
6
|
|
|
7
|
-
支持:多模型 AI 对话(智谱/DeepSeek/Kimi/Qwen/StepFun/MiniMax/讯飞星火)、MasterAgent 自我进化主控、思维模式切换(direct/CoT/ToT/ReAct)、文件沙盒操作、联网搜索(SSRF
|
|
7
|
+
支持:多模型 AI 对话(智谱/DeepSeek/Kimi/Qwen/StepFun/MiniMax/讯飞星火)、MasterAgent 自我进化主控、思维模式切换(direct/CoT/ToT/ReAct)、文件沙盒操作、联网搜索(SSRF 防护)、图片生成与识别、邮件收发(IMAP/SMTP + Microsoft 365 OAuth2/MFA)、定时任务(shlex 安全解析)、云盘集成、会话记忆、按日期自动存档、插件进化(子进程隔离)、四阶安全拦截、Shell 管道直通 AI。
|
|
8
8
|
|
|
9
9
|
**🇺🇸 English Intro**
|
|
10
10
|
|
|
11
|
-
The ultimate all-knowing terminal tool supporting multiple LLM providers (Zhipu/DeepSeek/Kimi/Qwen/StepFun/MiniMax/Spark). Supports AI chat, MasterAgent self-evolving controller, thinking modes (direct/CoT/ToT/ReAct), virtual filesystem, web search (SSRF-protected), image generation & vision, email, cron jobs (shlex-safe), cloud drive, session memory, auto date-based archiving, self-evolving plugins (subprocess-isolated), and powerful Shell piping.
|
|
11
|
+
The ultimate all-knowing terminal tool supporting multiple LLM providers (Zhipu/DeepSeek/Kimi/Qwen/StepFun/MiniMax/Spark). Supports AI chat, MasterAgent self-evolving controller, thinking modes (direct/CoT/ToT/ReAct), virtual filesystem, web search (SSRF-protected), image generation & vision, email (IMAP/SMTP + Microsoft 365 OAuth2/MFA), cron jobs (shlex-safe), cloud drive, session memory, auto date-based archiving, self-evolving plugins (subprocess-isolated), and powerful Shell piping.
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
@@ -51,6 +51,14 @@ fr-cli
|
|
|
51
51
|
/mcp_list 列出 MCP 服务器及工具
|
|
52
52
|
/mcp_add <名> <命令> [参数] 添加 MCP 服务器
|
|
53
53
|
/mcp_del <名> 删除 MCP 服务器
|
|
54
|
+
/mail setup 配置 IMAP/SMTP 邮箱
|
|
55
|
+
/mail inbox 查看收件箱
|
|
56
|
+
/mail read <id> 读取邮件
|
|
57
|
+
/mail send <to> <sub> <body> 发送邮件
|
|
58
|
+
/m365_config setup 配置 Microsoft 365 邮箱(OAuth2 + MFA)
|
|
59
|
+
/m365_inbox 查看 Microsoft 365 收件箱
|
|
60
|
+
/m365_read <id> 读取 Microsoft 365 邮件
|
|
61
|
+
/m365_send <to> <sub> <body> 发送 Microsoft 365 邮件
|
|
54
62
|
/help 查看全部命令
|
|
55
63
|
/exit 退出
|
|
56
64
|
```
|
|
@@ -98,7 +106,8 @@ fr_cli/
|
|
|
98
106
|
│ ├── fs.py # 虚拟文件系统 VFS
|
|
99
107
|
│ ├── web.py # 网络搜索与网页抓取(SSRF 防护)
|
|
100
108
|
│ ├── vision.py # 图片生成 (CogView) / 多模态 (GLM-4V)
|
|
101
|
-
│ ├── mail.py #
|
|
109
|
+
│ ├── mail.py # 邮件客户端(IMAP/SMTP,防头注入)
|
|
110
|
+
│ ├── m365.py # Microsoft 365 邮件客户端(OAuth2 + MFA)
|
|
102
111
|
│ ├── disk.py # 云盘适配器
|
|
103
112
|
│ ├── cron.py # 定时任务(shlex + shell=False)
|
|
104
113
|
│ ├── launcher.py # 本地应用启动器(跨平台)
|
|
@@ -131,10 +140,11 @@ fr_cli/
|
|
|
131
140
|
## 📦 可选依赖
|
|
132
141
|
|
|
133
142
|
```bash
|
|
134
|
-
pip install fr-cli[all] #
|
|
143
|
+
pip install fr-cli[all] # 全功能(含网盘 / Microsoft 365)
|
|
135
144
|
pip install fr-cli[baidu] # 百度网盘
|
|
136
145
|
pip install fr-cli[aliyun] # 阿里云盘
|
|
137
146
|
pip install fr-cli[onedrive] # OneDrive
|
|
147
|
+
pip install fr-cli[cloud] # 网盘 + Microsoft 365(含 msal)
|
|
138
148
|
```
|
|
139
149
|
|
|
140
150
|
---
|
|
@@ -28,6 +28,14 @@
|
|
|
28
28
|
- **调用方式**: mail_inbox, mail_read, mail_send
|
|
29
29
|
- **触发关键词**: 邮件, mail, email, 发邮件, 收件箱, inbox, 发送邮件, 查看邮件
|
|
30
30
|
|
|
31
|
+
## m365_email
|
|
32
|
+
- **名称**: Microsoft 365 邮件工具
|
|
33
|
+
- **功能**: 通过 Microsoft Graph API 查看收件箱、读取邮件、发送邮件,支持 MFA
|
|
34
|
+
- **程序路径**: fr_cli/weapon/m365.py
|
|
35
|
+
- **调用方式**: m365_inbox, m365_read, m365_send
|
|
36
|
+
- **配置命令**: /m365_config setup
|
|
37
|
+
- **触发关键词**: m365, microsoft 365, outlook 365, 微软邮箱, Office 365
|
|
38
|
+
|
|
31
39
|
## web_search
|
|
32
40
|
- **名称**: 网络搜索工具
|
|
33
41
|
- **功能**: 搜索网络内容和获取网页
|
|
@@ -128,11 +136,9 @@
|
|
|
128
136
|
|
|
129
137
|
## builtin_rag
|
|
130
138
|
- **名称**: @RAG 本地知识库助手
|
|
131
|
-
- **功能**: ChromaDB 向量检索 +
|
|
132
|
-
- 向量检索:使用 all-MiniLM-L6-v2 嵌入模型,检索 top-
|
|
133
|
-
-
|
|
134
|
-
- 大模型判定:让 LLM 从 top-3 中评估相关性/完整性/准确性,选出最佳片段 ★【最佳】
|
|
135
|
-
- 最终生成:优先基于最佳片段回答,可综合其他片段补充
|
|
139
|
+
- **功能**: ChromaDB 向量检索 + 大模型综合生成。后台自动向量化监控目录。支持两种监控模式:
|
|
140
|
+
- 向量检索:使用 all-MiniLM-L6-v2 嵌入模型,检索 top-8 相关片段
|
|
141
|
+
- 综合生成:将检索到的片段一次性交给大模型,由其综合回答并标注来源
|
|
136
142
|
- 内置模式(daemon 线程):`/rag_dir <目录>` 后自动启动
|
|
137
143
|
- 独立模式(系统进程):`/rag_watch start [目录] [--interval N]`,退出终端后仍继续运行
|
|
138
144
|
- **程序路径**: fr_cli/agent/builtins/rag.py
|
|
@@ -187,44 +193,6 @@
|
|
|
187
193
|
|
|
188
194
|
---
|
|
189
195
|
|
|
190
|
-
## a2a_protocol
|
|
191
|
-
- **名称**: Agent2Agent Protocol (A2A) - Agent 互操作协议
|
|
192
|
-
- **功能**: 支持 Agent 之间的互操作,实现 Agent 发现、注册、能力匹配、任务委托和结果返回
|
|
193
|
-
- **程序路径**: fr_cli/agent/a2a.py
|
|
194
|
-
- **调用方式**:
|
|
195
|
-
- AI 调用: `agent_call({"name": "Agent名", "user_input": "任务描述"})`
|
|
196
|
-
- 发现: `discover_all_agents()` 获取所有可用 Agent
|
|
197
|
-
- 注册: `AgentRegistry.register(agent_info)`
|
|
198
|
-
- **触发关键词**: agent, agent_call, A2A, agent互操作, 委托任务, 多agent协作
|
|
199
|
-
|
|
200
|
-
核心组件:
|
|
201
|
-
- AgentRegistry: Agent 注册表(单例模式),管理所有 Agent 的注册与发现
|
|
202
|
-
- AgentInfo: Agent 信息,包含名称、类型、描述、能力列表、端点等
|
|
203
|
-
- A2AClient: A2A 客户端,用于调用其他 Agent
|
|
204
|
-
- A2AServer: A2A 服务器,提供 HTTP 接口供远程调用
|
|
205
|
-
- TaskRequest/TaskResult: 任务请求和结果数据结构
|
|
206
|
-
|
|
207
|
-
使用示例:
|
|
208
|
-
```
|
|
209
|
-
# MasterAgent 可自动发现并调用其他 Agent
|
|
210
|
-
>>> 帮我调用 code-agent 生成一个快速排序算法
|
|
211
|
-
🧙 仙人 【调用:agent_call({"name": "code-agent", "user_input": "生成快速排序算法"})】
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
Agent 能力类型:
|
|
215
|
-
- code_generation: 代码生成
|
|
216
|
-
- code_review: 代码审查
|
|
217
|
-
- data_analysis: 数据分析
|
|
218
|
-
- web_search: 网络搜索
|
|
219
|
-
- file_operation: 文件操作
|
|
220
|
-
- database: 数据库操作
|
|
221
|
-
- image_processing: 图像处理
|
|
222
|
-
- text_generation: 文本生成
|
|
223
|
-
- translation: 翻译
|
|
224
|
-
- general: 通用能力
|
|
225
|
-
|
|
226
|
-
---
|
|
227
|
-
|
|
228
196
|
## provider_management
|
|
229
197
|
- **名称**: 模型提供商管理
|
|
230
198
|
- **功能**: 管理多个 AI 模型提供商(道统),支持配置、切换、查看
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
"""
|
|
5
5
|
import re, subprocess, sys
|
|
6
6
|
from fr_cli.conf.paths import PLUGIN_DIR
|
|
7
|
-
from pathlib import Path
|
|
8
7
|
from fr_cli.lang.i18n import T
|
|
9
8
|
from fr_cli.ui.ui import RED, DIM, RESET
|
|
10
9
|
|
|
@@ -67,4 +66,4 @@ else:
|
|
|
67
66
|
except subprocess.TimeoutExpired:
|
|
68
67
|
print(f"{RED}⏳ {T('err_posix', lang)} Timeout (15s){RESET}")
|
|
69
68
|
except Exception as e:
|
|
70
|
-
print(f"{RED}{T('err_posix', lang)} {e}{RESET}")
|
|
69
|
+
print(f"{RED}{T('err_posix', lang)} {e}{RESET}")
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AI 回复产物检测器 —— 统一检测插件/Agent 代码结构
|
|
3
|
+
|
|
4
|
+
提取自 core/chat.py 与 agent/master.py 的公共逻辑,
|
|
5
|
+
消除重复代码,保证行为一致性。
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from fr_cli.ui.ui import RED, GREEN, YELLOW, DIM, RESET
|
|
9
|
+
from fr_cli.lang.i18n import T
|
|
10
|
+
from fr_cli.addon.plugin import extract_code, PLUGIN_DIR
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def install_plugin(name: str, code: str, state) -> tuple:
|
|
14
|
+
"""安装插件到插件目录。返回 (success, message)。"""
|
|
15
|
+
safe_name = "".join(c for c in name if c.isalnum() or c == '_')
|
|
16
|
+
if not safe_name:
|
|
17
|
+
return False, "名称无效,仅允许字母/数字/下划线"
|
|
18
|
+
if hasattr(state, 'security') and state.security:
|
|
19
|
+
if not state.security.check("sec_write", f"/{safe_name}"):
|
|
20
|
+
return False, "安全校验未通过"
|
|
21
|
+
PLUGIN_DIR.mkdir(parents=True, exist_ok=True)
|
|
22
|
+
p_path = PLUGIN_DIR / f"{safe_name}.py"
|
|
23
|
+
p_path.write_text(code, encoding='utf-8')
|
|
24
|
+
if hasattr(state, 'plugins'):
|
|
25
|
+
state.plugins[safe_name] = str(p_path)
|
|
26
|
+
return True, safe_name
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def install_agent(name: str, code: str, state) -> tuple:
|
|
30
|
+
"""安装 Agent 分身。返回 (success, message)。"""
|
|
31
|
+
safe_name = "".join(c for c in name if c.isalnum() or c == '_')
|
|
32
|
+
if not safe_name:
|
|
33
|
+
return False, "名称无效,仅允许字母/数字/下划线"
|
|
34
|
+
from fr_cli.agent.manager import (
|
|
35
|
+
create_agent_dir, save_agent_code, save_persona, save_skills, agent_exists
|
|
36
|
+
)
|
|
37
|
+
create_agent_dir(safe_name)
|
|
38
|
+
save_agent_code(safe_name, code)
|
|
39
|
+
if not agent_exists(safe_name):
|
|
40
|
+
save_persona(safe_name, f"#{safe_name}\n\n由 AI 对话创建的 Agent 分身。")
|
|
41
|
+
save_skills(safe_name, "## 技能\n\n- 执行自定义 Python 逻辑\n- 入口: run(context, **kwargs)")
|
|
42
|
+
return True, safe_name
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def detect_plugin_artifact(
|
|
46
|
+
txt: str, lang: str, state, interactive: bool = True, task_id: str = None
|
|
47
|
+
) -> bool:
|
|
48
|
+
"""检测 AI 回复中的插件代码结构,提示用户保存或加入审核队列。
|
|
49
|
+
|
|
50
|
+
:param txt: AI 回复文本
|
|
51
|
+
:param lang: 界面语言
|
|
52
|
+
:param state: AppState 实例(需有 security 和 plugins 属性)
|
|
53
|
+
:param interactive: 是否交互式询问名称;False 时进入后台审核队列
|
|
54
|
+
:param task_id: 关联的 Hermes 任务 id,用于后台队列溯源
|
|
55
|
+
:return: 是否检测到并处理了插件
|
|
56
|
+
"""
|
|
57
|
+
if not txt or "def run(args='')" not in txt or "```python" not in txt:
|
|
58
|
+
return False
|
|
59
|
+
|
|
60
|
+
code = extract_code(txt)
|
|
61
|
+
if not code or "def run" not in code or len(code) <= 50:
|
|
62
|
+
return False
|
|
63
|
+
|
|
64
|
+
if not interactive:
|
|
65
|
+
from fr_cli.agent.review_queue import PersistentReviewQueue
|
|
66
|
+
queue = PersistentReviewQueue()
|
|
67
|
+
queue.add(
|
|
68
|
+
artifact_type="plugin",
|
|
69
|
+
code=code,
|
|
70
|
+
task_id=task_id,
|
|
71
|
+
metadata={"lang": lang},
|
|
72
|
+
)
|
|
73
|
+
print(f"{YELLOW}⚡ 后台检测到插件代码,已加入 Hermes 审核队列{RESET}")
|
|
74
|
+
return True
|
|
75
|
+
|
|
76
|
+
try:
|
|
77
|
+
pname = input(f"{YELLOW}{T('artifact_detect', lang)}{RESET}").strip()
|
|
78
|
+
if not pname:
|
|
79
|
+
return False
|
|
80
|
+
|
|
81
|
+
safe_name = "".join(c for c in pname if c.isalnum() or c == '_')
|
|
82
|
+
if not safe_name:
|
|
83
|
+
print(f"{RED}名称无效,仅允许字母/数字/下划线{RESET}")
|
|
84
|
+
return False
|
|
85
|
+
|
|
86
|
+
ok, msg = install_plugin(safe_name, code, state)
|
|
87
|
+
if not ok:
|
|
88
|
+
print(f"{RED}{msg}{RESET}")
|
|
89
|
+
return False
|
|
90
|
+
print(f"{GREEN}{T('ok_forged', lang, msg)}{RESET}")
|
|
91
|
+
return True
|
|
92
|
+
except EOFError:
|
|
93
|
+
return False
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def detect_agent_artifact(
|
|
97
|
+
txt: str, lang: str, state, interactive: bool = True, task_id: str = None
|
|
98
|
+
) -> bool:
|
|
99
|
+
"""检测 AI 回复中的 Agent 分身代码结构,提示用户保存或加入审核队列。
|
|
100
|
+
|
|
101
|
+
:param txt: AI 回复文本
|
|
102
|
+
:param lang: 界面语言
|
|
103
|
+
:param state: AppState 实例(仅用于安全校验,可选)
|
|
104
|
+
:param interactive: 是否交互式询问名称;False 时进入后台审核队列
|
|
105
|
+
:param task_id: 关联的 Hermes 任务 id,用于后台队列溯源
|
|
106
|
+
:return: 是否检测到并处理了 Agent
|
|
107
|
+
"""
|
|
108
|
+
if not txt or "def run(context," not in txt or "```python" not in txt:
|
|
109
|
+
return False
|
|
110
|
+
|
|
111
|
+
code = extract_code(txt)
|
|
112
|
+
if not code or "def run(context," not in code or len(code) <= 50:
|
|
113
|
+
return False
|
|
114
|
+
|
|
115
|
+
if not interactive:
|
|
116
|
+
from fr_cli.agent.review_queue import PersistentReviewQueue
|
|
117
|
+
queue = PersistentReviewQueue()
|
|
118
|
+
queue.add(
|
|
119
|
+
artifact_type="agent",
|
|
120
|
+
code=code,
|
|
121
|
+
task_id=task_id,
|
|
122
|
+
metadata={"lang": lang},
|
|
123
|
+
)
|
|
124
|
+
print(f"{YELLOW}⚡ 后台检测到 Agent 分身代码,已加入 Hermes 审核队列{RESET}")
|
|
125
|
+
return True
|
|
126
|
+
|
|
127
|
+
try:
|
|
128
|
+
aname = input(f"{YELLOW}⚡ 检测到 Agent 分身结构,赐名 (回车放弃): {RESET}").strip()
|
|
129
|
+
if not aname:
|
|
130
|
+
return False
|
|
131
|
+
|
|
132
|
+
safe_name = "".join(c for c in aname if c.isalnum() or c == '_')
|
|
133
|
+
if not safe_name:
|
|
134
|
+
print(f"{RED}名称无效,仅允许字母/数字/下划线{RESET}")
|
|
135
|
+
return False
|
|
136
|
+
|
|
137
|
+
from fr_cli.agent.manager import agent_exists
|
|
138
|
+
if agent_exists(safe_name):
|
|
139
|
+
confirm = input(
|
|
140
|
+
f"{YELLOW}Agent [{safe_name}] 已存在,是否覆盖? [y/N]: {RESET}"
|
|
141
|
+
).strip().lower()
|
|
142
|
+
if confirm not in ("y", "yes"):
|
|
143
|
+
print(f"{DIM}已取消。{RESET}")
|
|
144
|
+
return False
|
|
145
|
+
ok, msg = install_agent(safe_name, code, state)
|
|
146
|
+
if not ok:
|
|
147
|
+
print(f"{RED}{msg}{RESET}")
|
|
148
|
+
return False
|
|
149
|
+
print(f"{GREEN}✅ Agent [{msg}] 已保存。{RESET}")
|
|
150
|
+
print(f"{DIM} 运行: /agent_run {msg} [参数]{RESET}")
|
|
151
|
+
return True
|
|
152
|
+
except EOFError:
|
|
153
|
+
return False
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"""
|
|
7
7
|
from fr_cli.conf.config import load_namespace, save_namespace
|
|
8
8
|
from fr_cli.conf.paths import DATABASE_FILE
|
|
9
|
+
from fr_cli.core.result import Result
|
|
9
10
|
|
|
10
11
|
_NS_KEY = "databases"
|
|
11
12
|
DB_CFG_PATH = DATABASE_FILE # 保留用于一次性迁移
|
|
@@ -163,12 +164,12 @@ def _has_multiple_statements(sql: str) -> bool:
|
|
|
163
164
|
|
|
164
165
|
|
|
165
166
|
def _exec_sql(conn, sql, db_type):
|
|
166
|
-
"""执行 SQL
|
|
167
|
+
"""执行 SQL 并返回 Result。"""
|
|
167
168
|
cursor = conn.cursor()
|
|
168
169
|
try:
|
|
169
170
|
sql = sql.strip()
|
|
170
171
|
if _has_multiple_statements(sql):
|
|
171
|
-
return
|
|
172
|
+
return Result.fail("禁止执行多条 SQL 语句(检测到语句分隔符 ';')")
|
|
172
173
|
sql = sql.rstrip(";")
|
|
173
174
|
cursor.execute(sql)
|
|
174
175
|
|
|
@@ -176,16 +177,16 @@ def _exec_sql(conn, sql, db_type):
|
|
|
176
177
|
if sql.lower().startswith("select") or sql.lower().startswith("show") or sql.lower().startswith("desc"):
|
|
177
178
|
rows = cursor.fetchall()
|
|
178
179
|
if db_type == "mysql":
|
|
179
|
-
return rows
|
|
180
|
+
return Result.ok(rows)
|
|
180
181
|
else:
|
|
181
182
|
# 将 pyodbc/psycopg2 的行转为字典列表
|
|
182
183
|
cols = [desc[0] for desc in cursor.description] if cursor.description else []
|
|
183
|
-
return [{cols[i]: row[i] for i in range(len(cols))} for row in rows]
|
|
184
|
+
return Result.ok([{cols[i]: row[i] for i in range(len(cols))} for row in rows])
|
|
184
185
|
else:
|
|
185
186
|
conn.commit()
|
|
186
|
-
return f"受影响行数: {cursor.rowcount}"
|
|
187
|
+
return Result.ok(f"受影响行数: {cursor.rowcount}")
|
|
187
188
|
except Exception as e:
|
|
188
|
-
return
|
|
189
|
+
return Result.fail(str(e))
|
|
189
190
|
|
|
190
191
|
|
|
191
192
|
def handle_db(user_input, state):
|
|
@@ -259,10 +260,11 @@ def handle_db(user_input, state):
|
|
|
259
260
|
print(f"{DIM}已取消。{RESET}")
|
|
260
261
|
return
|
|
261
262
|
|
|
262
|
-
|
|
263
|
-
if
|
|
264
|
-
print(f"{RED}❌ 执行失败: {
|
|
263
|
+
exec_result = _exec_sql(conn, sql_text, db_cfg["type"])
|
|
264
|
+
if exec_result.is_fail():
|
|
265
|
+
print(f"{RED}❌ 执行失败: {exec_result.error}{RESET}")
|
|
265
266
|
else:
|
|
267
|
+
result = exec_result.unwrap()
|
|
266
268
|
if isinstance(result, list):
|
|
267
269
|
print(f"\n{GREEN}返回 {len(result)} 行:{RESET}")
|
|
268
270
|
for i, row in enumerate(result[:20]):
|
|
@@ -86,7 +86,7 @@ def handle_local(user_input, state):
|
|
|
86
86
|
if ps_exe:
|
|
87
87
|
res = subprocess.run([ps_exe, "-Command", cmd_text], capture_output=True, text=True, timeout=30)
|
|
88
88
|
else:
|
|
89
|
-
res = _run_cmd_safely(cmd_text, timeout=30
|
|
89
|
+
res = _run_cmd_safely(cmd_text, timeout=30)
|
|
90
90
|
else:
|
|
91
91
|
res = _run_cmd_safely(cmd_text, timeout=30)
|
|
92
92
|
out = res.stdout + res.stderr
|
|
@@ -106,14 +106,12 @@ def handle_local(user_input, state):
|
|
|
106
106
|
print(f"{RED}❌ 执行失败: {e}{RESET}")
|
|
107
107
|
|
|
108
108
|
|
|
109
|
-
def _run_cmd_safely(cmd_text: str, timeout: int = 30
|
|
110
|
-
"""
|
|
109
|
+
def _run_cmd_safely(cmd_text: str, timeout: int = 30):
|
|
110
|
+
"""安全执行命令:始终使用 shlex.split + shell=False,禁止回退到 shell=True。"""
|
|
111
111
|
try:
|
|
112
112
|
cmd_list = shlex.split(cmd_text)
|
|
113
113
|
except ValueError:
|
|
114
|
-
# shlex 解析失败(包含未闭合引号等)——
|
|
115
|
-
if allow_shell:
|
|
116
|
-
return subprocess.run(cmd_text, shell=True, capture_output=True, text=True, timeout=timeout)
|
|
114
|
+
# shlex 解析失败(包含未闭合引号等)—— 拒绝执行,不回退到 shell=True
|
|
117
115
|
return subprocess.CompletedProcess(args=cmd_text, returncode=1, stdout="", stderr="命令解析失败")
|
|
118
116
|
if not cmd_list:
|
|
119
117
|
return subprocess.CompletedProcess(args=cmd_text, returncode=1, stdout="", stderr="空命令")
|