foxclaw 0.1.2 → 0.1.4

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.
Files changed (368) hide show
  1. package/index.js +1 -8
  2. package/package.json +1 -1
  3. package/python/.env.example +8 -0
  4. package/python/.github/workflows/ci.yml +47 -2
  5. package/python/.github/workflows/release.yml +5 -0
  6. package/python/CHANGELOG.md +100 -0
  7. package/python/CHANGELOG_CN.md +100 -0
  8. package/python/README.md +17 -2
  9. package/python/README_CN.md +38 -20
  10. package/python/bench/bm25_audit.py +1 -14
  11. package/python/bench/bm25_regression.py +0 -1
  12. package/python/bench/bm25_stress.py +0 -4
  13. package/python/bench/cd_audit.py +0 -23
  14. package/python/bench/chaos.py +6 -8
  15. package/python/bench/e2e_real_models.py +0 -1
  16. package/python/bench/llm_retry_test.py +2 -9
  17. package/python/bench/load_test.py +5 -8
  18. package/python/bench/vector_ivf_upgrade.py +1 -7
  19. package/python/docs/CONTENT_GUARD.md +189 -0
  20. package/python/docs/CONTENT_GUARD_CN.md +189 -0
  21. package/python/docs/RELEASE.md +78 -37
  22. package/python/docs/RUN_CN.md +2 -2
  23. package/python/evals/governance/cases.py +0 -37
  24. package/python/evals/governance/run_evals.py +5 -37
  25. package/python/examples/governance_middleware_demo.py +1 -6
  26. package/python/examples/langgraph_governance_demo.py +7 -11
  27. package/python/foxclaw/__init__.py +74 -152
  28. package/python/foxclaw/agents/base.py +82 -136
  29. package/python/foxclaw/agents/impl/_helpers.py +2 -10
  30. package/python/foxclaw/agents/impl/finance.py +4 -21
  31. package/python/foxclaw/agents/impl/office.py +7 -24
  32. package/python/foxclaw/agents/impl/supervisor.py +12 -79
  33. package/python/foxclaw/agents/mixins/_context.py +0 -23
  34. package/python/foxclaw/agents/mixins/augment.py +10 -16
  35. package/python/foxclaw/agents/mixins/llm.py +7 -6
  36. package/python/foxclaw/agents/mixins/memory.py +23 -3
  37. package/python/foxclaw/agents/mixins/preference.py +58 -8
  38. package/python/foxclaw/agents/mixins/prompt.py +59 -12
  39. package/python/foxclaw/agents/mixins/skillbox.py +6 -6
  40. package/python/foxclaw/agents/mixins/tool_exec.py +16 -42
  41. package/python/foxclaw/agents/rules/finance/RULES.md +131 -0
  42. package/python/foxclaw/api/__init__.py +18 -77
  43. package/python/foxclaw/api/_state.py +43 -0
  44. package/python/foxclaw/api/bootstrap.py +114 -0
  45. package/python/foxclaw/api/middleware.py +5 -28
  46. package/python/foxclaw/api/routes/ahs.py +60 -73
  47. package/python/foxclaw/api/routes/attachments.py +5 -6
  48. package/python/foxclaw/api/routes/browser.py +7 -11
  49. package/python/foxclaw/api/routes/domain.py +18 -26
  50. package/python/foxclaw/api/routes/knowledge.py +3 -21
  51. package/python/foxclaw/api/routes/llm_admin.py +21 -33
  52. package/python/foxclaw/api/routes/memory.py +50 -12
  53. package/python/foxclaw/api/routes/orchestration.py +3 -5
  54. package/python/foxclaw/api/routes/recovery.py +4 -3
  55. package/python/foxclaw/api/routes/review.py +2 -11
  56. package/python/foxclaw/api/routes/search.py +3 -7
  57. package/python/foxclaw/api/routes/system.py +33 -49
  58. package/python/foxclaw/api/routes/task.py +31 -49
  59. package/python/foxclaw/api/routes/ws.py +2 -6
  60. package/python/foxclaw/api/spine.py +1 -4
  61. package/python/foxclaw/behavior/__init__.py +20 -0
  62. package/python/foxclaw/behavior/behavior.yaml +62 -0
  63. package/python/foxclaw/behavior/spec.py +287 -0
  64. package/python/foxclaw/browser/action/action_executor.py +1 -5
  65. package/python/foxclaw/browser/action/action_types.py +0 -1
  66. package/python/foxclaw/browser/action/url_policy.py +1 -5
  67. package/python/foxclaw/browser/adapter/web_adapter.py +1 -1
  68. package/python/foxclaw/browser/driver/playwright_driver.py +20 -16
  69. package/python/foxclaw/browser/perception/dom_extractor.py +0 -1
  70. package/python/foxclaw/browser/perception/element_indexer.py +1 -2
  71. package/python/foxclaw/browser/service.py +7 -11
  72. package/python/foxclaw/capability/embedding_service.py +4 -6
  73. package/python/foxclaw/channels/__init__.py +9 -11
  74. package/python/foxclaw/channels/discord.py +4 -13
  75. package/python/foxclaw/channels/dispatcher.py +2 -27
  76. package/python/foxclaw/channels/feishu.py +10 -20
  77. package/python/foxclaw/channels/openclaw_bridge.py +4 -9
  78. package/python/foxclaw/channels/signing.py +9 -9
  79. package/python/foxclaw/channels/telegram.py +3 -4
  80. package/python/foxclaw/channels/weixin.py +7 -17
  81. package/python/foxclaw/cli.py +42 -13
  82. package/python/foxclaw/cognitive/reasoner.py +9 -10
  83. package/python/foxclaw/cognitive/state.py +18 -24
  84. package/python/foxclaw/core/audit_chain.py +1 -3
  85. package/python/foxclaw/core/audit_sink.py +3 -3
  86. package/python/foxclaw/core/compaction.py +8 -26
  87. package/python/foxclaw/core/config.py +2 -2
  88. package/python/foxclaw/core/confirm_nonce.py +6 -12
  89. package/python/foxclaw/core/content_guard.py +341 -0
  90. package/python/foxclaw/core/envfile.py +2 -2
  91. package/python/foxclaw/core/failure_policy.py +17 -26
  92. package/python/foxclaw/core/gateway.py +6 -10
  93. package/python/foxclaw/core/governance_audit.py +3 -7
  94. package/python/foxclaw/core/idempotency.py +15 -22
  95. package/python/foxclaw/core/injection_guard.py +10 -29
  96. package/python/foxclaw/core/memory_adapter.py +53 -60
  97. package/python/foxclaw/core/metrics.py +4 -5
  98. package/python/foxclaw/core/model_router.py +74 -150
  99. package/python/foxclaw/core/paths.py +1 -1
  100. package/python/foxclaw/core/recovery.py +21 -34
  101. package/python/foxclaw/core/scheduler.py +23 -26
  102. package/python/foxclaw/core/secrets.py +0 -3
  103. package/python/foxclaw/core/sensitive_write.py +283 -0
  104. package/python/foxclaw/core/sessions.py +4 -6
  105. package/python/foxclaw/core/settings.py +16 -32
  106. package/python/foxclaw/core/shared_write.py +11 -23
  107. package/python/foxclaw/core/steering_queue.py +12 -11
  108. package/python/foxclaw/core/system_bus.py +1 -1
  109. package/python/foxclaw/core/thought_chain.py +30 -32
  110. package/python/foxclaw/core/token_meter.py +9 -13
  111. package/python/foxclaw/core/tools.py +4 -12
  112. package/python/foxclaw/core/tracing.py +25 -40
  113. package/python/foxclaw/core/truth_pipeline.py +5 -9
  114. package/python/foxclaw/core/update_check.py +149 -0
  115. package/python/foxclaw/core/vec_recall_adapter.py +11 -37
  116. package/python/foxclaw/core/verify.py +6 -14
  117. package/python/foxclaw/core/web_search.py +4 -28
  118. package/python/foxclaw/finance/evidence.py +14 -18
  119. package/python/foxclaw/finance/fx.py +1 -3
  120. package/python/foxclaw/finance/graph.py +9 -18
  121. package/python/foxclaw/finance/models.py +20 -24
  122. package/python/foxclaw/finance/nlparse.py +12 -72
  123. package/python/foxclaw/finance/policy.py +8 -36
  124. package/python/foxclaw/finance/reasoner.py +3 -11
  125. package/python/foxclaw/finance/reasoning.py +13 -34
  126. package/python/foxclaw/finance/reconcile.py +5 -10
  127. package/python/foxclaw/finance/runtime.py +19 -46
  128. package/python/foxclaw/governance/middleware.py +13 -21
  129. package/python/foxclaw/harness/_base.py +2 -8
  130. package/python/foxclaw/harness/_policy.py +19 -38
  131. package/python/foxclaw/harness/drift.py +1 -13
  132. package/python/foxclaw/harness/event_bus.py +2 -5
  133. package/python/foxclaw/harness/harness.py +9 -97
  134. package/python/foxclaw/harness/loop_detection.py +11 -18
  135. package/python/foxclaw/itinerary/amap_client.py +2 -5
  136. package/python/foxclaw/itinerary/models.py +7 -7
  137. package/python/foxclaw/itinerary/reasoner.py +1 -6
  138. package/python/foxclaw/itinerary/reasoning.py +15 -21
  139. package/python/foxclaw/itinerary/runtime.py +8 -12
  140. package/python/foxclaw/kernel/capabilities.py +5 -6
  141. package/python/foxclaw/kernel/policy_gate.py +4 -10
  142. package/python/foxclaw/kernel/process_manager.py +17 -36
  143. package/python/foxclaw/kernel/scheduler.py +3 -9
  144. package/python/foxclaw/kernel/sentinel.py +13 -23
  145. package/python/foxclaw/kernel/sentinel_client.py +12 -15
  146. package/python/foxclaw/kernel/spine.py +9 -9
  147. package/python/foxclaw/knowledge/__init__.py +4 -20
  148. package/python/foxclaw/knowledge/truth_crystallizer.py +5 -8
  149. package/python/foxclaw/learning/knowledge_graph.py +4 -9
  150. package/python/foxclaw/learning/models.py +13 -13
  151. package/python/foxclaw/learning/reasoner.py +1 -4
  152. package/python/foxclaw/learning/runtime.py +19 -31
  153. package/python/foxclaw/learning/spaced_repetition.py +2 -7
  154. package/python/foxclaw/mcp_server.py +2 -3
  155. package/python/foxclaw/orchestration/__init__.py +16 -33
  156. package/python/foxclaw/pipeline/cognitive_pipeline.py +45 -97
  157. package/python/foxclaw/pipeline/stage_meta.py +21 -0
  158. package/python/foxclaw/pipeline/supervisor_stages.py +13 -42
  159. package/python/foxclaw/planning/llm_planner.py +3 -3
  160. package/python/foxclaw/planning/planner.py +6 -11
  161. package/python/foxclaw/search/agent_port.py +7 -11
  162. package/python/foxclaw/search/evidence.py +0 -4
  163. package/python/foxclaw/search/internal_search.py +3 -5
  164. package/python/foxclaw/search/models.py +11 -13
  165. package/python/foxclaw/search/planner.py +3 -3
  166. package/python/foxclaw/search/retriever.py +1 -1
  167. package/python/foxclaw/search/runtime.py +1 -8
  168. package/python/foxclaw/skills/__init__.py +46 -100
  169. package/python/foxclaw/skills/archive.py +111 -0
  170. package/python/foxclaw/skills/fetch.py +226 -0
  171. package/python/foxclaw/skills/hooks_spec.py +21 -25
  172. package/python/foxclaw/skills/install_cmd.py +216 -0
  173. package/python/foxclaw/skills/lifecycle.py +16 -42
  174. package/python/foxclaw/skills/markdown_skill.py +10 -9
  175. package/python/foxclaw/skills/mcp_client.py +5 -11
  176. package/python/foxclaw/skills/mcp_store.py +0 -3
  177. package/python/foxclaw/skills/permission.py +13 -48
  178. package/python/foxclaw/skills/pipeline.py +21 -53
  179. package/python/foxclaw/skills/policy.py +4 -10
  180. package/python/foxclaw/skills/review.py +3 -3
  181. package/python/frontend/deck/auth.js +0 -7
  182. package/python/frontend/deck/chat_model_picker.js +0 -54
  183. package/python/frontend/deck/domain.js +0 -20
  184. package/python/frontend/deck/main.js +0 -144
  185. package/python/frontend/deck/markdown.js +0 -4
  186. package/python/frontend/deck/settings.js +1 -18
  187. package/python/frontend/deck/state.js +0 -1
  188. package/python/frontend/deck/util.js +0 -2
  189. package/python/frontend/deck/visuals.js +0 -22
  190. package/python/frontend/planet/planet.js +18 -201
  191. package/python/frontend/v3/assets/index-JKfHlb-a.css +1 -0
  192. package/python/frontend/v3/assets/index-tN90dpUH.js +34 -0
  193. package/python/frontend/v3/index.html +3 -3
  194. package/python/frontend/widget_runtime.js +0 -43
  195. package/python/frontend/widgets.js +0 -57
  196. package/python/frontend_src/index.html +1 -1
  197. package/python/frontend_src/package-lock.json +2 -2
  198. package/python/frontend_src/package.json +1 -1
  199. package/python/frontend_src/src/App.vue +3 -7
  200. package/python/frontend_src/src/api.js +0 -7
  201. package/python/frontend_src/src/components/ChatDock.vue +27 -39
  202. package/python/frontend_src/src/components/DocViewer.vue +0 -9
  203. package/python/frontend_src/src/components/Inspector.vue +0 -6
  204. package/python/frontend_src/src/components/LeftRail.vue +60 -39
  205. package/python/frontend_src/src/components/MenuPopover.vue +9 -11
  206. package/python/frontend_src/src/components/MessageStream.vue +18 -30
  207. package/python/frontend_src/src/components/ModelPicker.vue +0 -5
  208. package/python/frontend_src/src/components/QuickIngest.vue +0 -6
  209. package/python/frontend_src/src/components/Stage.vue +71 -25
  210. package/python/frontend_src/src/components/ToolMenu.vue +0 -3
  211. package/python/frontend_src/src/components/TopBar.vue +38 -10
  212. package/python/frontend_src/src/components/panels/ActivityPanel.vue +0 -2
  213. package/python/frontend_src/src/components/panels/AgentsPanel.vue +2 -5
  214. package/python/frontend_src/src/components/panels/KnowledgePanel.vue +0 -16
  215. package/python/frontend_src/src/components/panels/MemoryPanel.vue +42 -3
  216. package/python/frontend_src/src/components/panels/PanelBox.vue +6 -7
  217. package/python/frontend_src/src/components/panels/ReviewPanel.vue +0 -16
  218. package/python/frontend_src/src/components/panels/SettingsPanel.vue +142 -38
  219. package/python/frontend_src/src/components/panels/TasksPanel.vue +0 -1
  220. package/python/frontend_src/src/components/panels/ToolsPanel.vue +125 -19
  221. package/python/frontend_src/src/lib/fmt.js +0 -4
  222. package/python/frontend_src/src/lib/i18n.js +53 -0
  223. package/python/frontend_src/src/lib/locales/en.js +173 -0
  224. package/python/frontend_src/src/lib/locales/zh.js +174 -0
  225. package/python/frontend_src/src/lib/md.js +0 -14
  226. package/python/frontend_src/src/main.js +2 -0
  227. package/python/frontend_src/src/stores/app.js +17 -32
  228. package/python/frontend_src/src/stores/chat.js +0 -34
  229. package/python/frontend_src/src/stores/model.js +0 -8
  230. package/python/frontend_src/src/stores/panels.js +16 -44
  231. package/python/frontend_src/src/stores/profile.js +31 -0
  232. package/python/frontend_src/src/stores/system.js +25 -0
  233. package/python/frontend_src/vite.config.js +0 -7
  234. package/python/pyproject.toml +17 -3
  235. package/python/requirements.txt +311 -0
  236. package/python/tests/conftest.py +0 -22
  237. package/python/tests/run_all.py +4 -66
  238. package/python/tests/test_agent_lifecycle.py +4 -38
  239. package/python/tests/test_agent_rules.py +81 -0
  240. package/python/tests/test_ahs_p2.py +4 -25
  241. package/python/tests/test_anthropic_tools.py +1 -15
  242. package/python/tests/test_api.py +19 -9
  243. package/python/tests/test_api_auth.py +1 -5
  244. package/python/tests/test_attachments.py +9 -25
  245. package/python/tests/test_audit_chain.py +2 -7
  246. package/python/tests/test_audit_sink.py +0 -6
  247. package/python/tests/test_behavior_spec.py +198 -0
  248. package/python/tests/test_browser.py +2 -6
  249. package/python/tests/test_browser_request_guard.py +0 -4
  250. package/python/tests/test_capabilities.py +0 -6
  251. package/python/tests/test_channel_signing.py +2 -9
  252. package/python/tests/test_channels.py +1 -11
  253. package/python/tests/test_config_layering.py +0 -4
  254. package/python/tests/test_confirm_nonce.py +1 -12
  255. package/python/tests/test_conflict_dismiss.py +143 -0
  256. package/python/tests/test_content_guard.py +177 -0
  257. package/python/tests/test_context_compaction_wiring.py +1 -7
  258. package/python/tests/test_dispatch.py +0 -6
  259. package/python/tests/test_domain_evals.py +11 -80
  260. package/python/tests/test_domain_import.py +0 -6
  261. package/python/tests/test_domain_reasoners.py +0 -14
  262. package/python/tests/test_e2e.py +0 -17
  263. package/python/tests/test_emb_cache.py +7 -17
  264. package/python/tests/test_embedding_singleton.py +1 -3
  265. package/python/tests/test_evals_smoke.py +0 -24
  266. package/python/tests/test_event_spine.py +10 -18
  267. package/python/tests/test_evidence_semantic.py +1 -14
  268. package/python/tests/test_evidence_sse.py +3 -6
  269. package/python/tests/test_file_ingest.py +0 -11
  270. package/python/tests/test_finance.py +0 -9
  271. package/python/tests/test_finance_ledger.py +5 -12
  272. package/python/tests/test_finance_persist.py +8 -12
  273. package/python/tests/test_gateway.py +3 -22
  274. package/python/tests/test_governance.py +5 -52
  275. package/python/tests/test_governance_audit.py +4 -39
  276. package/python/tests/test_governance_middleware.py +1 -7
  277. package/python/tests/test_hkc.py +6 -24
  278. package/python/tests/test_hkc_index_build_manager.py +0 -33
  279. package/python/tests/test_hkc_manifest_reuse.py +4 -27
  280. package/python/tests/test_hkc_search_event_sync.py +3 -54
  281. package/python/tests/test_import_path_guard.py +0 -6
  282. package/python/tests/test_injection_guard.py +18 -36
  283. package/python/tests/test_integration.py +5 -29
  284. package/python/tests/test_itinerary.py +0 -3
  285. package/python/tests/test_kee_semantic.py +0 -5
  286. package/python/tests/test_kernel.py +1 -11
  287. package/python/tests/test_learning.py +3 -12
  288. package/python/tests/test_llm_admin.py +4 -19
  289. package/python/tests/test_llm_planner.py +1 -23
  290. package/python/tests/test_markdown_skills.py +3 -14
  291. package/python/tests/test_markdown_skills_openclaw.py +4 -9
  292. package/python/tests/test_mcp_connectors.py +3 -15
  293. package/python/tests/test_mcp_guardian_discovery.py +2 -6
  294. package/python/tests/test_mcp_no_memory.py +3 -3
  295. package/python/tests/test_mcp_policy_gate.py +0 -1
  296. package/python/tests/test_mcp_server.py +6 -9
  297. package/python/tests/test_memory_recall.py +1 -4
  298. package/python/tests/test_metrics.py +0 -8
  299. package/python/tests/test_multi_chain.py +1 -13
  300. package/python/tests/test_multimodal.py +5 -18
  301. package/python/tests/test_negotiation.py +3 -13
  302. package/python/tests/test_orchestration.py +1 -11
  303. package/python/tests/test_orchestration_decoupled.py +0 -6
  304. package/python/tests/test_p3_p5_hardening.py +3 -17
  305. package/python/tests/test_parallel_dispatch.py +4 -12
  306. package/python/tests/test_pipeline.py +17 -58
  307. package/python/tests/test_plan_visible.py +4 -4
  308. package/python/tests/test_planner.py +0 -7
  309. package/python/tests/test_policy_gate.py +2 -3
  310. package/python/tests/test_profile.py +67 -0
  311. package/python/tests/test_readme_claims.py +163 -0
  312. package/python/tests/test_reasoner.py +2 -17
  313. package/python/tests/test_release_check.py +2 -13
  314. package/python/tests/test_resume_checkpoint.py +7 -15
  315. package/python/tests/test_routing.py +2 -12
  316. package/python/tests/test_scheduler.py +7 -10
  317. package/python/tests/test_search.py +1 -11
  318. package/python/tests/test_secrets.py +4 -10
  319. package/python/tests/test_semantic.py +1 -10
  320. package/python/tests/test_sensitive_write.py +181 -0
  321. package/python/tests/test_sessions.py +3 -4
  322. package/python/tests/test_settings.py +2 -18
  323. package/python/tests/test_shadow_learning.py +3 -43
  324. package/python/tests/test_shared_write.py +0 -7
  325. package/python/tests/test_skill_taint_gate.py +1 -10
  326. package/python/tests/test_skills.py +2 -18
  327. package/python/tests/test_skills_fetch.py +282 -0
  328. package/python/tests/test_stats_and_events.py +2 -5
  329. package/python/tests/test_streaming.py +2 -7
  330. package/python/tests/test_supervisor_pipeline.py +4 -5
  331. package/python/tests/test_supervisor_triage.py +4 -10
  332. package/python/tests/test_taint.py +2 -7
  333. package/python/tests/test_task_stream.py +1 -12
  334. package/python/tests/test_thinking_sse.py +0 -1
  335. package/python/tests/test_tool_center.py +1 -17
  336. package/python/tests/test_tool_parallel.py +2 -2
  337. package/python/tests/test_tool_params.py +1 -5
  338. package/python/tests/test_tool_use.py +0 -13
  339. package/python/tests/test_toplevel_concurrency.py +3 -4
  340. package/python/tests/test_tracing.py +7 -41
  341. package/python/tests/test_truth_crystallizer.py +4 -6
  342. package/python/tests/test_truth_flow.py +2 -7
  343. package/python/tests/test_update_check.py +95 -0
  344. package/python/tests/test_verify_evidence.py +8 -21
  345. package/python/tests/test_version_sync.py +35 -6
  346. package/python/tests/test_web_trigger.py +0 -17
  347. package/python/tools/build_content_lexicon.py +218 -0
  348. package/python/tools/bundle_web.py +98 -0
  349. package/python/tools/check_faiss_type.py +0 -1
  350. package/python/tools/check_log.ps1 +0 -8
  351. package/python/tools/mypy_baseline.txt +12 -4
  352. package/python/tools/mypy_ratchet.py +52 -6
  353. package/python/tools/pack.py +0 -5
  354. package/python/tools/recheck_conflicts.py +156 -0
  355. package/python/tools/release_check.py +24 -15
  356. package/python/tools/restart_foxclaw.ps1 +5 -8
  357. package/python/tools/shared_write_audit.py +1 -15
  358. package/python/tools/size_check.py +1 -1
  359. package/python/tools/strip_comments.py +228 -0
  360. package/python/vendor/hkc/hkc_api/routes/ability.py +31 -0
  361. package/python/vendor/hkc/hkc_api/schemas.py +11 -0
  362. package/python/vendor/hkc/hkc_kee/kee.py +124 -3
  363. package/python/vendor/hkc/hkc_sdk/base.py +22 -0
  364. package/python/vendor/hkc/hkc_sdk/direct_client.py +10 -0
  365. package/python/vendor/hkc/hkc_sdk/http_client.py +19 -0
  366. package/python/foxclaw/api/app.py +0 -123
  367. package/python/frontend/v3/assets/index-BD7VPbMV.js +0 -33
  368. package/python/frontend/v3/assets/index-CAvnYWGH.css +0 -1
package/index.js CHANGED
@@ -1,11 +1,4 @@
1
- /**
2
- * FoxClaw - a personal agent with memory.
3
- *
4
- * The npm package bundles the full Python project under `python/`; the CLI
5
- * (`npx foxclaw`) forwards to it. This module exposes the package metadata for
6
- * programs that only need the name/version.
7
- */
8
1
  export const name = "foxclaw";
9
- export const version = "0.1.2";
2
+ export const version = "0.1.4";
10
3
 
11
4
  export default { name, version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxclaw",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "A personal agent with memory - a fox living in your device",
5
5
  "keywords": [
6
6
  "agent",
@@ -100,6 +100,9 @@ FOXCLAW_MEMORY_CHAIN=0
100
100
  # ---------- 运行参数(可选)----------
101
101
  # 数据目录
102
102
  FOXCLAW_DATA_DIR=./foxclaw_data
103
+ # `foxclaw skills install @owner/slug` 走的 ClawHub 地址。默认 https://clawhub.ai;
104
+ # 内网镜像或自建 registry 填这里。只在装技能时访问,平时不发任何请求。
105
+ FOXCLAW_CLAWHUB_REGISTRY=
103
106
  # 导入白名单:/api/{finance,learning,itinerary}/import 的 csv_path 只允许数据目录内的文件。
104
107
  # 要从别处导入(如下载目录),把目录填进来,逗号分隔。
105
108
  FOXCLAW_IMPORT_ROOTS=
@@ -107,6 +110,11 @@ FOXCLAW_IMPORT_ROOTS=
107
110
  # Harness 影子校准轮数(越小越快进入拦截模式)
108
111
  FOXCLAW_SHADOW_ROUNDS=20
109
112
 
113
+ # 新版本检查。默认关:foxclaw 本地优先,不该在你不说的情况下外呼。
114
+ # 设 1 后启动/首次打开界面时查一次 PyPI(pypi.org/pypi/foxclaw/json),24h 缓存,
115
+ # 有新版时顶栏版本号旁出现提示;只发这一个 GET,不带任何本机信息。
116
+ FOXCLAW_UPDATE_CHECK=0
117
+
110
118
  # 不联网校验模型版本。模型已缓存但机器连不上 huggingface.co 时打开,可跳过
111
119
  # 每次构造前 5 次重试的空等(约 20-40s);模型还没下载过时别开,否则无法自动下载。
112
120
  # HF_HUB_OFFLINE=1
@@ -40,7 +40,19 @@ jobs:
40
40
  with:
41
41
  python-version: ${{ matrix.python-version }}
42
42
 
43
- - name: Install toolchain
43
+ - name: Install toolchain (pinned, py3.12)
44
+ if: matrix.python-version == '3.12'
45
+ # 基线版本按 requirements.txt 装:那是 uv 从 pyproject 解析出的完整闭包,
46
+ # 与本机 .venv 一致。dev extra 随后补装,pip 不会改写已满足的 pin。
47
+ run: |
48
+ python -m pip install --upgrade pip
49
+ pip install -r requirements.txt
50
+ pip install -e ".[dev]"
51
+
52
+ - name: Install toolchain (latest, py3.14)
53
+ if: matrix.python-version == '3.14'
54
+ # 3.14 腿刻意不读 requirements.txt:它的职责是发现「依赖在新解释器上解析/安装失败」,
55
+ # 跟着 pin 会把这个信号一起锁死。
44
56
  run: |
45
57
  python -m pip install --upgrade pip
46
58
  pip install -e ".[dev]"
@@ -92,9 +104,11 @@ jobs:
92
104
  - name: Install dependencies
93
105
  run: |
94
106
  python -m pip install --upgrade pip
95
- # 单源安装:依赖以 pyproject.toml 为唯一来源,避免手写清单与它双份漂移。
107
+ # 单源:pyproject.toml 声明依赖,requirements.txt 是它解析出的锁定闭包(uv 生成)。
108
+ # 先装锁再装本体,回归跑的就是本机 .venv 同一套版本,而不是当天 PyPI 的最新版。
96
109
  # HMR/HKC 是 vendor 内嵌、走 sys.path 加载,不是 PyPI 依赖(已在 pyproject 注明)。
97
110
  # dev extra 提供 pytest + openpyxl/python-docx(默认回归 test_file_ingest/test_domain_import 硬依赖)。
111
+ pip install -r requirements.txt
98
112
  pip install -e ".[dev]"
99
113
 
100
114
  - name: Warm embedding cache
@@ -120,3 +134,34 @@ jobs:
120
134
  coverage combine
121
135
  coverage report
122
136
  coverage xml
137
+
138
+ audit:
139
+ # 依赖漏洞门。此前 SCA 只覆盖 Dockerfile 与前端 package.json,Python 侧完全空白 ——
140
+ # 实测全局环境 34 个包挂着 278 条已知漏洞(pyjwt 15、starlette 14、filelock 9…),
141
+ # 而同一份 pyproject 干净解析出来是 0 条,说明问题在"从不升级的运行环境"而非依赖声明。
142
+ #
143
+ # 审计 requirements.txt 而非运行环境:它是「实际会被装出来的东西」,结果可复现,
144
+ # 且不依赖扫描机的环境状态。此门红了怎么修:
145
+ # 1) 升级 pyproject 里对应依赖的下限/上限;
146
+ # 2) uv pip compile pyproject.toml --universal -o requirements.txt 重新生成并提交
147
+ # (--universal 必须带:否则 Windows 专属包会写成无条件依赖,本作业在 Linux 上装不动);
148
+ # 3) 确无可用修复版本时,在下面 --ignore-vuln 逐条登记 ID + 原因,不要整门关掉。
149
+ runs-on: ubuntu-latest
150
+ timeout-minutes: 10
151
+ steps:
152
+ - uses: actions/checkout@v4
153
+
154
+ - name: Set up Python
155
+ uses: actions/setup-python@v5
156
+ with:
157
+ python-version: "3.12"
158
+
159
+ - name: Install pip-audit
160
+ run: |
161
+ python -m pip install --upgrade pip
162
+ pip install "pip-audit>=2.7"
163
+
164
+ - name: Audit pinned runtime dependencies
165
+ # --no-deps:requirements.txt 已是 uv 解析好的完整闭包(含全部传递依赖),
166
+ # 不需要 pip-audit 再解析一遍 —— 不加会静默跑几分钟且可能超时。
167
+ run: pip-audit -r requirements.txt --no-deps --progress-spinner off
@@ -83,6 +83,11 @@ jobs:
83
83
  python tools/release_check.py
84
84
  fi
85
85
 
86
+ - name: Bundle web UI into package
87
+ # frontend/ 在仓库根、不属于任何包,不复制就进不了 wheel → pip 装完首页 404。
88
+ # 漏跑不会构建失败,但下一步的 artifact gate 会拦下来(missing_web_ui)。
89
+ run: python tools/bundle_web.py
90
+
86
91
  - name: Build wheel + sdist
87
92
  run: python -m build --outdir dist
88
93
 
@@ -0,0 +1,100 @@
1
+ # Changelog
2
+
3
+ Changes from the first public release 0.1.0 to the current version, newest first.
4
+
5
+ Chinese version: [CHANGELOG_CN.md](CHANGELOG_CN.md).
6
+
7
+ ## 0.1.4 — 2026-11-12
8
+
9
+ A conflict card can now be dismissed instead of decided, the validator stops reading every Chinese 不 as a negation, each agent gets its own rules file, and the hard boundaries now live in one checkable spec instead of being scattered across prompts.
10
+
11
+ **Behavior**
12
+
13
+ - `foxclaw/behavior/behavior.yaml` is a checkpoint list, not a prose spec: every rule that claims code enforcement names a callable that already exists (`foxclaw.kernel.policy_gate:PolicyGate.check_action`, `foxclaw.core.confirm_nonce:ConfirmationBroker.consume`, `foxclaw.core.verify:verify`), and the spec is resolved at load time. A missing target fails startup instead of registering an always-allow stub, so the list cannot drift into decoration.
14
+ - The block is injected first in the system prompt — ahead of the kernel prompt, the role prompt and the per-agent rules. Persona stays where it was (preferences merged into the last user message), so a user-editable preference cannot structurally override a hard boundary.
15
+ - `behavior.local.yaml` in `FOXCLAW_DATA_DIR` can add rules and tighten `enforce`, but weakening or dropping a rule in `prohibitions` / `confirmations` raises. A malformed or stale-version local file is ignored with a warning rather than bricking the app; problems in the built-in file stay fatal.
16
+ - Rules whose code side is not built yet (`no_privacy_upload`, `no_impersonation`) are marked `enforce: prompt` with a `note` saying what is missing, rather than pretending to be enforced.
17
+ - Set `FOXCLAW_BEHAVIOR=0` to turn the whole block off.
18
+
19
+ **Memory**
20
+
21
+ - High-sensitivity writes to long-term memory now pass through a deterministic gate: credential / ID-number / health / card-number patterns plus a Luhn check, no model call. `FOXCLAW_SENSITIVE_WRITE_MODE` has three levels — `audit` (default, records only), `warn`, and `enforce`. In `enforce` the content is not stored; it becomes a pending item the user must approve, and `approve_sensitive_write` is the only caller allowed to pass `consent=True`.
22
+ - The classifier deliberately over-blocks: a false positive costs one confirmation, a false negative means the rule does not exist. Ordinary amounts and order numbers are excluded on purpose — otherwise the finance agent would be unusable.
23
+ - `GET /api/memory/pending`, `POST /api/memory/pending/{id}/approve` and `/reject` expose the queue. The memory panel lists what is waiting, with 记住 / 丢弃 buttons, and when a write is held back the agent says so in the thought chain instead of silently dropping it.
24
+ - `confirm_high_sensitivity` is now `enforce: both` in the behavior spec; the checkpoint resolves to the real gate.
25
+
26
+ **Content safety**
27
+
28
+ - New gate at `foxclaw/core/content_guard.py`: deterministic, no model call. Both the user request and the model output are checked, and a hit is cut off with a fixed line ("Let's talk about something else." / 「我们换个话题聊聊吧。」) — no explanation, no elaboration, no counter-question, no alternative offered. A refusal must not become a channel for leaking information or continuing the thread.
29
+ - Built-in rules cover **solicitation only** (making drugs or explosives, fraud and money laundering, breaking into someone's systems, forging documents, suicide methods, sexual content involving minors). Narrow wording, low false-positive rate, works out of the box. Mentioning is not asking: a book about the history of explosives, a paper on money-laundering sentencing, an order number, `born in '91` all pass.
30
+ - The platform-review categories (political, sexual, violent) run to tens of thousands of terms; hard-coding them is neither practical nor maintainable as the rules change. Deployers mount an external lexicon through `FOXCLAW_CONTENT_LEXICON` (comma-separated files, one term per line, optional `term<TAB>category`); `tools/build_content_lexicon.py` does the conversion (encoding detection, category filtering, category inferred from the file name, read-back verification), and which categories to mount is their call. **Nothing is checked against it unless it is mounted** — by default only the built-in rules run.
31
+ - `FOXCLAW_CONTENT_GUARD_MODE` has three levels: `enforce` (default), `audit` (records only), `off`. Enforcement is the default because this layer exists to backstop a shipped product; a default that does not fire is not a backstop. The built-in rules are narrow enough not to interrupt ordinary conversation.
32
+ - Normalization defeats full-width characters, zero-width characters and inserted spaces. Pinyin, homophones and character-splitting are explicitly out of scope for a deterministic layer — this is a speed bump, not a wall.
33
+ - Knowledge-base ingestion and attachment bodies are **not** filtered: that is the user's own material. The gate sits on the request and the output only, so a history book or a legal statute is not mistaken for a violation.
34
+ - New `no_harmful_content` rule in the behavior spec (`enforce: both`), and a new §8 "content boundaries" in `KERNEL_PROMPT` spelling out the refusal pattern and the difference between 「material」 and 「instructions」.
35
+ - `docs/CONTENT_GUARD.md` / `docs/CONTENT_GUARD_CN.md` document mounting, lexicon format, conversion and false-positive tuning. No political, sexual or violent list is bundled; mounting one, and which mode to run, is the deployer's decision.
36
+
37
+ **Agents**
38
+
39
+ - An agent now loads `foxclaw/agents/rules/<AGENT_ID>/*.md` into its system prompt when it starts. The files are re-read on every prompt assembly, so editing rules needs no code change; the block is appended after the role prompt and yields to the safety rules above it. Set `FOXCLAW_AGENT_RULES=0` to turn it off.
40
+ - Ships with `foxclaw/agents/rules/finance/RULES.md` — Personal Finance Agent Rules v1.0 (data truthfulness, bookkeeping accuracy, privacy, calculation conventions, advice limits, anomaly handling, memory boundaries, supervisor collaboration). The file is package data, so it travels inside the wheel instead of being silently dropped.
41
+
42
+ **Knowledge**
43
+
44
+ - `POST /conflicts/{id}/dismiss` and `POST /conflicts/bulk-dismiss` (SDK: `dismiss_conflict` / `dismiss_conflicts`) close a card without picking a winner: both claims stay `active` and nothing is marked `superseded`. A claim that was `disputed` only because of that card goes back to `active` once no open conflict mentions it.
45
+ - Conflict detection no longer flips polarity on topical similarity alone. The negated side now also has to overlap lexically with the other statement (character-bigram Jaccard ≥ 0.40) and stay close in embedding space (cosine ≥ 0.35); both thresholds are constructor parameters (`neg_flip_min_cos`, `neg_flip_min_overlap`).
46
+ - Descriptive `不` / `无` compounds (`不变`, `不同`, `不管`, `不再`, `无需`, `不可观测`, `不可控` …) no longer count as stance negation.
47
+ - The conflict card gained a secondary "false positive" button beside "accept selected claim".
48
+ - `tools/recheck_conflicts.py` re-scores existing open cards with the current rule and batch-closes those that no longer hold. It dry-runs by default; `--apply` submits through the running service, so the in-process conflict set and the vector index stay in step.
49
+
50
+ ## 0.1.3 — 2026-11-11
51
+
52
+ Bilingual interface, and Settings moved where it belongs.
53
+
54
+ **Interface**
55
+
56
+ - New i18n layer (`lib/i18n.js` plus en/zh dictionaries): sidebar, menus, chat, stage, settings and toast strings all resolve through the dictionaries; a missing key falls back to the key, so nothing renders blank.
57
+ - Settings gains "Interface → Language" with instant Chinese / English switching, persisted in `localStorage` (`foxclawLang`) and kept across reloads.
58
+ - Date and number formatting follow the language (`zh-CN` / `en-US`), and `<html lang>` stays in sync.
59
+ - Settings moved out of the "More" popover into a pinned entry at the bottom of the left rail, separated by a rule and left unaffected by session-list scrolling.
60
+ - The version badge in the top bar reads `/api/system/info`; it no longer falls back to a hard-coded `v3.0`.
61
+
62
+ **Docs**
63
+
64
+ - README reconciled with the repository as it actually is: agent count, channels, ingest caps, chunk geometry, supported formats and internal links all verified one by one, with a test to keep them from drifting again.
65
+
66
+ ## 0.1.2 — 2026-11-10
67
+
68
+ Version consolidation and skill installation.
69
+
70
+ - Version number unified across five places (`pyproject.toml` / `foxclaw/__init__.py` / `npm/package.json` / `npm/index.js` / `frontend_src/package.json`), guarded by `tests/test_version_sync.py` so npm and PyPI cannot drift apart.
71
+ - `foxclaw skills install` accepts ClawHub / GitHub / URL / local archives; the tools panel can install an instruction skill straight from an uploaded `SKILL.md` or OpenClaw package.
72
+ - First run asks how to address you (editable in settings); an optional new-version check was added.
73
+ - `tools/sync_public.ps1` now builds the public tree directly instead of relying on a local clone.
74
+ - Type annotations closed out: mypy went from 645 to 0, and CI turned into a ratchet that may only go down.
75
+ - Explanatory comments stripped repo-wide, so the public tree no longer carries internal notes.
76
+
77
+ ## 0.1.1 — 2026-11-09
78
+
79
+ npm-only republish; there is no matching version bump in the repository.
80
+
81
+ - The npm package excludes internal docs (`docs/reports` and friends) and debug leftovers, aborting the pack when any are detected — 0.1.1 had shipped internal documents in the public package.
82
+ - `build.cjs` now runs before `npm pack`, fixing GitHub Release assets that were 2 KB empty shells.
83
+ - `pyproject` gained a readme, so the PyPI page is no longer description-less.
84
+ - `requirements.txt` is compiled with `uv pip compile --universal` so platform-specific dependencies carry markers; CI gained a dependency audit gate.
85
+ - MIT license and metadata added.
86
+
87
+ ## 0.1.0 — 2026-11-06
88
+
89
+ First public release, on both channels: PyPI `foxclaw` and npm `foxclaw`.
90
+
91
+ - Runtime: FastAPI service plus the `foxclaw` command-line entry point.
92
+ - Agents: multiple agents collapsed into three (assistant / office / knowledge); the rest were demoted to instruction skills.
93
+ - Knowledge (HKC) and memory (HMR) embedded via `vendor/`: knowledge is extractable and searchable, and review scheduling runs on SM-2.
94
+ - Governance: policy gate, audit hash chain, shadow learning and circuit breaker; import paths are allow-listed and skill side effects default to fail-closed.
95
+ - Config: typed reads instead of raw `.env`, and `foxclaw config check` turns a misconfiguration from a crash into a message.
96
+ - Security: DNS rebinding, browser SSRF and untrusted channel instructions closed off; channel path signatures plus one-shot nonces for sensitive actions.
97
+ - Pipeline: visible plans, reasoning emitted as its own SSE event, step-level checkpoints for resume-after-interrupt.
98
+ - Frontend: Vue3 three-column renderer, persistent feature entries in the left rail, dual-state inspector on the right.
99
+
100
+ > Both packages are **placeholders**: `vendor/` (HKC / HMR) is not shipped, so a fresh install only gets the importable skeleton. See [docs/RELEASE.md](docs/RELEASE.md).
@@ -0,0 +1,100 @@
1
+ # 更新日志
2
+
3
+ 从 0.1.0 首次公开到当前版本的变更记录,最新的排在最前面。
4
+
5
+ 英文版:[CHANGELOG.md](CHANGELOG.md)。
6
+
7
+ ## 0.1.4 — 2026-11-12
8
+
9
+ 冲突卡可以「判为误判」,不必二选一;判定逻辑也不再见到「不」就当否定;每个 Agent 有了自己的规则文件;硬边界集中到一份可校验的清单,不再散落在各处提示词里。
10
+
11
+ **行为规范**
12
+
13
+ - `foxclaw/behavior/behavior.yaml` 是**检查点清单**,不是规范全文:每条声称代码强制的规则都必须指向仓库里已经存在的可调用对象(`foxclaw.kernel.policy_gate:PolicyGate.check_action`、`foxclaw.core.confirm_nonce:ConfirmationBroker.consume`、`foxclaw.core.verify:verify`),加载时解析。解析不到直接启动失败,绝不注册「永远放行」的桩,所以清单不会退化成装饰。
14
+ - 该段注入 system prompt 最前段,排在内核准则、角色职责、规则文件之前。人格仍在原地(偏好合并进最后一条 user 消息),因此用户可改的偏好结构上覆盖不了硬边界。
15
+ - `FOXCLAW_DATA_DIR` 下的 `behavior.local.yaml` 可以新增规则、可以把 `enforce` 收紧;但放宽或省略删除 `prohibitions` / `confirmations` 里的规则会直接报错。本地文件语法写错或版本过期只告警并忽略,不会把应用锁死;内置文件的问题仍然致命。
16
+ - 代码侧尚未实现的规则(`no_privacy_upload`、`no_impersonation`)标成 `enforce: prompt` 并附 `note` 说明缺什么,不假装已经强制。
17
+ - 设 `FOXCLAW_BEHAVIOR=0` 可整体关闭。
18
+
19
+ **记忆**
20
+
21
+ - 高敏感内容写入长期记忆前先过一道确定性闸门:凭据 / 证件号 / 健康 / 卡号模式加 Luhn 校验,不调模型。`FOXCLAW_SENSITIVE_WRITE_MODE` 三档:`audit`(默认,只记录)、`warn`、`enforce`。`enforce` 下内容**不落库**,转成待确认项由用户点头;`approve_sensitive_write` 是全仓唯一允许传 `consent=True` 的地方。
22
+ - 判定刻意宁可多拦:误判的代价是用户多点一次确认,漏判则等于这条规矩不存在。普通金额和订单号被明确排除,否则财务 Agent 直接不可用。
23
+ - 新增 `GET /api/memory/pending`、`POST /api/memory/pending/{id}/approve` 与 `/reject`;记忆中心面板列出排队中的写入,可就地「记住」或「丢弃」。写入被拦时 Agent 会在思考链里说明,不静默丢弃。
24
+ - 行为规范里 `confirm_high_sensitivity` 升为 `enforce: both`,检查点指向真实闸门。
25
+
26
+ **内容安全**
27
+
28
+ - 新增内容闸门 `foxclaw/core/content_guard.py`:确定性判定,不调模型。用户请求与模型输出两端各过一道,命中即用固定话术切断(「我们换个话题聊聊吧。」/ "Let's talk about something else."),不解释、不延伸、不反问、不给替代方案 —— 拒绝本身不能变成信息泄漏或继续纠缠的入口。
29
+ - 内置规则只覆盖**请求型教唆**(制毒制爆、诈骗洗钱、入侵他人系统、伪造证件、自杀方法、未成年性内容),措辞窄、误伤低,开箱即用。「提及」不算「索要」:讲炸药发展史的书、洗钱量刑的论文、订单号、`91年出生` 都不拦。
30
+ - 平台审核要求的政治 / 色情 / 暴力大类词表在数万条量级,硬编码进代码既不现实也无法随口径更新。部署方用 `FOXCLAW_CONTENT_LEXICON` 挂载外部词表(逗号分隔多个文件,一行一词,可选 `词<TAB>类别`);`tools/build_content_lexicon.py` 负责格式转换(自动判别编码、按类别筛选、按文件名推类别、转换后回读验证),挂哪几类由部署方自己定。**这一层不挂就不生效**:默认只有内置规则在跑。
31
+ - `FOXCLAW_CONTENT_GUARD_MODE` 三档:`enforce`(默认)、`audit`(只记录)、`off`。默认强制,因为这是给对外产品兜底的机制,默认不生效等于没做;内置规则范围窄,正常对话不会被误伤。
32
+ - 归一化对抗全角、零宽字符、空格插字。拼音、谐音、拆字改写不在确定性层处理 —— 这里明确只做限速带,不做墙。
33
+ - 知识库导入与附件正文**不过滤**:那是用户自己的资料。过滤器只挂在「用户请求」和「模型输出」两端,避免把历史书和法律条文当成违规请求。
34
+ - 行为规范新增 `no_harmful_content`(`enforce: both`),`KERNEL_PROMPT` 增加【八、内容边界】写明拒绝范式,并区分「资料」与「指令」两种角色。
35
+ - 新增 `docs/CONTENT_GUARD_CN.md` / `docs/CONTENT_GUARD.md`:挂载方式、词表格式、格式转换与误伤调优。仓库不附带任何政治 / 色情 / 暴力词表,是否挂载、跑哪一档由部署方决定。
36
+
37
+ **Agent**
38
+
39
+ - Agent 启动时会把 `foxclaw/agents/rules/<AGENT_ID>/*.md` 读进系统提示词。每次组装提示词都重新读盘,改规则不必改代码;该段附在角色职责之后,与上游安全规则冲突时以安全规则为准。设 `FOXCLAW_AGENT_RULES=0` 可整体关闭。
40
+ - 随包附带 `foxclaw/agents/rules/finance/RULES.md` —— Personal Finance Agent Rules v1.0(数据真实性、账目准确性、隐私、计算口径、建议边界、异常处理、记忆边界、与主管协作)。该文件属 package data,随 wheel 一起分发,不会像仓库根的 `skills/` 那样漏包。
41
+
42
+ **知识**
43
+
44
+ - 新增 `POST /conflicts/{id}/dismiss` 与 `POST /conflicts/bulk-dismiss`(SDK:`dismiss_conflict` / `dismiss_conflicts`),关闭卡片但不判胜负:双方 claim 保持 `active`,没有一方被标成 `superseded`。仅因该卡被置为 `disputed` 的观点,在不牵涉任何 open 冲突后恢复为 `active`。
45
+ - 冲突判定不再只凭主题相似就翻转立场:否定侧还须与另一句字面重合(字符二元组 Jaccard ≥ 0.40)且语义相近(余弦 ≥ 0.35),两个阈值均可由构造参数(`neg_flip_min_cos` / `neg_flip_min_overlap`)调整。
46
+ - 「不变」「不同」「不管」「不再」「无需」「不可观测」「不可控」这类描述性「不 / 无」不再算作立场否定。
47
+ - 冲突卡新增次按钮「误判」,与「采纳所选观点」并列。
48
+ - 新增 `tools/recheck_conflicts.py`:用当前规则复算存量 open 卡并批量关闭已不成立的,默认 dry-run,`--apply` 经运行中的服务提交,保证进程内冲突集合与向量索引同步。
49
+
50
+ ## 0.1.3 — 2026-11-11
51
+
52
+ 界面双语化,并把「设置」放到该在的位置。
53
+
54
+ **界面**
55
+
56
+ - 新增 i18n 基建(`lib/i18n.js` + 中英字典),侧栏、菜单、对话、舞台、设置、提示文案统一走字典;缺词回退 key,不会渲染成空白。
57
+ - 设置面板新增「界面 → 语言」,中文 / English 即时切换,写入 `localStorage`(`foxclawLang`),刷新后保持。
58
+ - 日期与数字格式随语言切换(`zh-CN` / `en-US`),`<html lang>` 同步。
59
+ - 「设置」从「更多」弹层移到左栏底部常驻入口,带分隔线,不随会话列表滚动。
60
+ - 顶栏版本号改为读后端 `/api/system/info`,取不到时不再显示硬编码的 `v3.0`。
61
+
62
+ **文档**
63
+
64
+ - README 按仓库实际校准:智能体数量、渠道、摄取上限、分块几何、支持格式、内部链接全部逐条核对,并加测试防止再次漂移。
65
+
66
+ ## 0.1.2 — 2026-11-10
67
+
68
+ 版本号收口、技能安装成型。
69
+
70
+ - 版本号五处统一(`pyproject.toml` / `foxclaw/__init__.py` / `npm/package.json` / `npm/index.js` / `frontend_src/package.json`),并由 `tests/test_version_sync.py` 盯住,防 npm 与 PyPI 漂移。
71
+ - `foxclaw skills install` 支持 ClawHub / GitHub / URL / 本地包;工具面板可直接上传 `SKILL.md` 或 OpenClaw 包安装指令技能。
72
+ - 首次启动引导询问称呼,可在设置中修改;新增可选的新版本检查提示。
73
+ - `tools/sync_public.ps1` 改为直接构造公开树推远端,不再依赖本地克隆。
74
+ - 类型标注收口:mypy 从 645 降到 0,CI 改为棘轮门(只降不升)。
75
+ - 全仓剥离解释性注释,公开树下不再混入内部说明。
76
+
77
+ ## 0.1.1 — 2026-11-09
78
+
79
+ 只在 npm 通道补发,仓库内没有对应版本号的提交记录。
80
+
81
+ - npm 包排除 `docs/reports` 等内部文档与调试残留,自检命中即中止打包(0.1.1 曾把内部文档打进公开包)。
82
+ - `npm pack` 前先跑 `build.cjs`,修 GitHub Release 附件只有 2KB 空壳。
83
+ - 修 `pyproject` 缺 `readme`,PyPI 项目页不再没有项目描述。
84
+ - `requirements.txt` 改用 `uv pip compile --universal`,平台相关依赖带上 marker;CI 增加依赖审计门。
85
+ - 补 MIT 许可证与 metadata。
86
+
87
+ ## 0.1.0 — 2026-11-06
88
+
89
+ 首个公开版本,PyPI `foxclaw` 与 npm `foxclaw` 双通道。
90
+
91
+ - 运行时:FastAPI 服务 + `foxclaw` 命令行入口。
92
+ - 智能体:多智能体收敛为三(助手 / 办公 / 知识),其余能力下放为指令技能。
93
+ - 知识库(HKC)与记忆(HMR)以内嵌 `vendor/` 形式接入:知识可抽取、可检索,复习走 SM-2 排程。
94
+ - 治理层:策略门、审计哈希链、影子学习与断路器;导入路径白名单,技能副作用默认 fail-closed。
95
+ - 配置:从 `.env` 改为类型化读取,`foxclaw config check` 把「配置写错」从崩溃变成提示。
96
+ - 安全:堵 DNS rebinding、浏览器 SSRF、渠道陌生指令三个可利用面;渠道路径签名 + 动作一次性 nonce 确认。
97
+ - 链路:计划可见化、推理过程独立 SSE 事件、步骤级 checkpoint 断点续跑。
98
+ - 前端:Vue3 三栏渲染层,左栏功能入口常驻,右栏双态检视。
99
+
100
+ > 两个包都是**占位包**:`vendor/`(HKC / HMR)不入包,装完只能 import 骨架,完整运行时从仓库获取。详见 [docs/RELEASE.md](docs/RELEASE.md)。
package/python/README.md CHANGED
@@ -43,16 +43,31 @@ Closed loop (`ChannelDispatcher`): receive → Supervisor → reply to origin, w
43
43
 
44
44
  Keeps the system reliable under message redelivery, crashes, long tasks, and loops. See [docs/GOVERNANCE.md](docs/GOVERNANCE.md): idempotency guard, crash/restart recovery (boot_id avoids pid reuse), tool-loop detection, context compaction, hook standardization, steering queue.
45
45
 
46
+ **Content boundaries.** Requests and model output pass a deterministic content gate: narrow built-in rules for request-shaped violations, plus an optional external lexicon for platform categories.
47
+
48
+ **No political, sexual, or violent term list is bundled, and nothing in that area is enforced unless the deployer mounts one.** Whether to mount a lexicon, which categories to take, and whether to run `enforce` or `audit` is entirely a deployment decision — this repository provides the mechanism, not a policy. The gate is normalised string matching, not semantic understanding: it does not guarantee coverage, and it is not a content moderation or compliance service. Deployers who expose this service publicly are responsible for their own content compliance. The software is provided "as is", as stated in [LICENSE](LICENSE).
49
+
50
+ See [docs/CONTENT_GUARD.md](docs/CONTENT_GUARD.md) for mounting, conversion, and false-positive tuning.
51
+
46
52
  ## Quick start
47
53
 
48
54
  ```bash
49
- pip install fastapi uvicorn "httpx<0.28" openai cryptography websockets pyyaml numpy scikit-learn rich pydantic
55
+ python -m venv .venv # isolated env — don't pollute the system Python
56
+ .venv\Scripts\activate # macOS / Linux: source .venv/bin/activate
57
+ pip install -r requirements.txt # pinned closure generated from pyproject.toml
58
+ pip install -e . --no-deps # foxclaw itself, without re-resolving deps
50
59
  python tests/run_all.py # full regression (all green)
51
60
  export DEEPSEEK_API_KEY=sk-... # or ANTHROPIC_API_KEY; unset → stub
52
61
  python -m uvicorn foxclaw.api:app --port 8000
53
62
  ```
54
63
 
55
- See [docs/RUN.md](docs/RUN.md). Chinese docs: [README_CN.md](README_CN.md).
64
+ > `requirements.txt` is generated by `uv pip compile pyproject.toml --universal -o requirements.txt` — don't hand-edit.
65
+ > `--universal` is required: without it the compile is platform-specific and drags Windows-only packages
66
+ > (e.g. `pywin32`) into the list, which breaks installation on Linux CI. With it, platform deps carry
67
+ > `; sys_platform == ...` markers and pip skips what doesn't apply.
68
+ > Re-run after changing dependencies in `pyproject.toml`, otherwise the lock lags behind the declaration.
69
+
70
+ See [docs/RUN.md](docs/RUN.md). Chinese docs: [README_CN.md](README_CN.md). Release history: [CHANGELOG.md](CHANGELOG.md).
56
71
 
57
72
  > **Windows**: don't place the project under OneDrive-managed folders (Documents/Desktop/Pictures); Python can't create dirs inside redirect placeholders. Use a path like `C:\foxclaw`.
58
73
 
@@ -9,14 +9,16 @@ Foxclaw: 记忆 = 持续认知运行时,智能体 = 会推理 · 会学
9
9
 
10
10
  ## 一、这是什么
11
11
 
12
- Foxclaw 不是"又一个智能体框架",而是一个真正记得住事的个人智能体;技术上它是一个智能体运行时。它建立在 HMR(Foxclaw 记忆运行时)之上,核心护城河独立于任何大模型:
12
+ 主流智能体框架把记忆当存储:开新会话就归零,记忆只是检索。Foxclaw 把记忆做成**持续运行的认知层**——推理、校准、学习都发生在这一层,并且与 LLM 彻底解耦:换模型不影响判断力。
13
+
14
+ 它建立在 HMR(Foxclaw 记忆运行时)之上,四件事构成护城河:
13
15
 
14
16
  - **推理链(ThoughtChain)** —— 每个智能体的推理轨迹是可审计、可对比的有向图,不是普通日志
15
- - **线束(Harness)** —— 跨层约束与校准:三维漂移检测(语义/工具/范围)+ 影子模式自校准 + 策略自学习
16
- - **演化(Evolution)** —— 每次线束截断都让策略学习,系统越用越准
17
- - **运行时治理** —— 幂等、崩溃恢复、循环检测等,保证系统在真实运行中可靠、可审计、不丢不重
17
+ - **线束(Harness)** —— 跨层约束与校准:三维漂移检测(语义 / 工具 / 范围)+ 影子模式自校准 + 策略自学习
18
+ - **演化(Evolution)** —— 每次线束截断都喂给策略,系统越用越准
19
+ - **运行时治理** —— 幂等、崩溃恢复、循环检测,保证真实运行中可靠、可审计、不丢不重
18
20
 
19
- 三个智能体:主管(协调)、财务(理财)、办公学习(学习 + 日程行程)。每个拥有独立记忆与策略演化,通过 Skill 接入层挂载外部生态,通过渠道层接入主流消息平台。原「助手」「行政」已**下放为指令技能**(`skills/general-assistant`、`skills/schedule-itinerary`),按需挂载,不再单列 Agent。
21
+ 三个智能体:**主管**(协调)、**财务**(理财)、**办公学习**(学习 + 日程行程)。各自持有隔离记忆与策略演化,通过 Skill 层挂载外部生态,通过渠道层接入四个消息平台。早期的「助手」「行政」已**下放为指令技能**(`skills/general-assistant`、`skills/schedule-itinerary`),按需挂载,不再单列 Agent。
20
22
 
21
23
  ## 二、三个智能体与领域内核
22
24
 
@@ -57,6 +59,12 @@ Foxclaw 不是"又一个智能体框架",而是一个真正记得住事的个人
57
59
  - **钩子标准化** —— 标准生命周期钩子 + 明确阻断权
58
60
  - **干预队列** —— 租约机制安全回收子任务结果(为并行子 Agent 预留)
59
61
 
62
+ **内容边界。** 用户请求与模型输出两端各有一道确定性内容闸门:内置规则只管请求型教唆,平台大类词表按需挂载。
63
+
64
+ **仓库不附带任何政治、色情、暴力词表,这块不挂载就完全不生效。** 是否挂载、取哪几类、跑 `enforce` 还是 `audit`,完全由部署方自行决定 —— 这里提供的是机制,不是口径。闸门做的是归一化后的字符串匹配,不是语义理解,不保证覆盖率,也不构成内容审核或合规服务;对外提供服务时的内容合规责任在部署方自身。软件按“现状”提供,详见 [LICENSE](LICENSE)。
65
+
66
+ 挂载方式、格式转换与误伤调优见 [docs/CONTENT_GUARD_CN.md](docs/CONTENT_GUARD_CN.md)。
67
+
60
68
  ## 五、目录结构
61
69
 
62
70
  ```
@@ -69,11 +77,12 @@ foxclaw/
69
77
  │ ├── core/ thought_chain / memory_adapter / model_router /
70
78
  │ │ system_bus / truth_pipeline / token_meter /
71
79
  │ │ web_search / compaction / idempotency / recovery
72
- │ ├── kernel/ 运行时内核:调度 / 事件 / 能力 / 生命周期 / 准入
80
+ │ ├── kernel/ 运行时内核:调度 / 进程 / 能力 / 准入(spine + sentinel)
73
81
  │ ├── pipeline/ planning/ 任务执行管线 + 规划原语
74
- │ ├── cognitive/ knowledge/ 领域推理 + 知识接入
75
- │ ├── agents/ base.py(统一 run_task 模板) + agents.py(五智能体)
76
- │ ├── harness/ harness.py(三维漂移) + loop_detection.py
82
+ │ ├── cognitive/ knowledge/ 领域推理 + 真相结晶
83
+ │ ├── agents/ base.py(CognitiveAgent 模板)+ agents.py
84
+ │ │ + impl/(财务 / 办公 / 主管 —— 三个智能体)
85
+ │ ├── harness/ harness.py(三维漂移)+ loop_detection.py + 策略自学习
77
86
  │ ├── finance/ 财务内核 + 三件套(evidence/graph/reconcile)
78
87
  │ ├── learning/ 学习内核(SM-2 + 知识图谱)
79
88
  │ ├── itinerary/ 行程内核(TSP + 高德)
@@ -81,12 +90,11 @@ foxclaw/
81
90
  │ ├── skills/ Skill 接入层 + 权限(permission)/钩子/断路器/循环防护
82
91
  │ ├── search/ HSR 认知搜索(HMR 记忆 + HKC 知识 + 联网,融入)
83
92
  │ ├── browser/ HIR 浏览器子系统(AI 用的浏览器,融入)
84
- │ ├── orchestration/ 跨 Agent 编排(P3 已去领域硬编码,通用)
85
93
  │ ├── capability/ governance/ embedding 单例 / 治理中间件
86
94
  ├── vendor/hmr/ vendor/hkc/ HMR v2.0 记忆运行时 + HKC 知识核心(已内嵌)
87
95
  ├── examples/ 样例数据
88
- ├── tests/ 76 个测试文件(全部 pytest)+ run_all.py
89
- └── docs/ RUN / CHANNELS / GOVERNANCE / 配置指南(公开)
96
+ ├── tests/ 全部 pytest 组织 + run_all.py 一键跑全量回归
97
+ └── docs/ RUN / RUN_CN / CHANNELS / GOVERNANCE / RELEASE / 配置指南
90
98
  ```
91
99
 
92
100
  ## 六、环境要求
@@ -97,12 +105,13 @@ foxclaw/
97
105
  ## 七、快速开始
98
106
 
99
107
  ```bash
100
- # 1. 安装依赖
101
- pip install fastapi uvicorn "httpx<0.28" openai cryptography websockets pyyaml numpy scikit-learn rich pydantic
102
- # (Windows 上 pip 装系统包可能需要 --break-system-packages)
108
+ # 1. 建隔离环境 —— 不要直接装进系统 Python,否则会和机器上其它项目互相污染
109
+ python -m venv .venv
110
+ .venv\Scripts\activate # macOS / Linux: source .venv/bin/activate
103
111
 
104
- # 2. 可选:更精确的语义检测(约 800MB,不装则降级 n-gram)
105
- pip install sentence-transformers
112
+ # 2. 安装锁定版本的依赖(含 torch / faiss,约 1GB)
113
+ pip install -r requirements.txt
114
+ pip install -e . --no-deps # 装 foxclaw 本体,不再重解析依赖
106
115
 
107
116
  # 3. 验证认知运行时(无需 API key)
108
117
  python tests/run_all.py # 全量回归(全绿)
@@ -112,7 +121,14 @@ export DEEPSEEK_API_KEY=sk-... # 或 ANTHROPIC_API_KEY;Windows: $env:DEEPSEEK_A
112
121
  python -m uvicorn foxclaw.api:app --port 8000
113
122
  ```
114
123
 
115
- 详见 [docs/RUN_CN.md](docs/RUN_CN.md)。
124
+ > `requirements.txt` 由 `uv pip compile pyproject.toml --universal -o requirements.txt` 从 `pyproject.toml` 生成,
125
+ > **不要手改**。`--universal` 不能省:不加的话解析结果只针对当前平台,会把 Windows 专属包
126
+ > (如 `pywin32`)写成无条件依赖,Linux CI 直接装不上。加了它平台相关的包才带
127
+ > `; sys_platform == ...` 标记,pip 会自动跳过不适用项。
128
+ > 改完 `pyproject.toml` 里的依赖后重跑一次,否则锁定清单会滞后于声明,
129
+ > SCA 扫描和 CI 装的都会是旧版本。
130
+
131
+ 详见 [docs/RUN_CN.md](docs/RUN_CN.md)。版本变更:[CHANGELOG_CN.md](CHANGELOG_CN.md)。
116
132
 
117
133
  ### 开发常用命令(Windows / PowerShell 一行重启)
118
134
 
@@ -127,7 +143,9 @@ function restart-foxclaw {
127
143
  $p=(Get-NetTCPConnection -LocalPort 8000 -State Listen -EA SilentlyContinue).OwningProcess
128
144
  if($p){Stop-Process -Id $p -Force; Start-Sleep 1}
129
145
  Set-Location <你的项目目录>
130
- foxclaw serve
146
+ # 显式走 .venv,别用 PATH 里那个系统 Python 的 foxclaw.exe ——
147
+ # 系统环境常常是很久以前装的,挂着已知漏洞(实测 278 条)。
148
+ .\.venv\Scripts\foxclaw.exe serve
131
149
  }
132
150
 
133
151
  # ③ 重开 PowerShell 让配置生效(只在改了 $PROFILE 后需要)
@@ -167,7 +185,7 @@ docker run -d --name foxclaw \
167
185
  -v foxclaw_data:/app/foxclaw_data \
168
186
  foxclaw
169
187
 
170
- # 容器内跑全量回归(76 项,验证镜像健康)
188
+ # 容器内跑全量回归(验证镜像健康)
171
189
  docker run --rm foxclaw python tests/run_all.py
172
190
  ```
173
191
 
@@ -39,28 +39,23 @@ def audit_float_accumulation():
39
39
  print("\n[1/5] 浮点累加精度对比 (build 一次 vs 累加 1000 次) ...")
40
40
  corpus = gen_corpus(1000)
41
41
 
42
- # 方法 A: build 一次
43
42
  idx_a = NewBM25()
44
43
  idx_a.build(corpus)
45
44
 
46
- # 方法 B: 1000 次 append_ku
47
45
  idx_b = NewBM25()
48
46
  for ku in corpus:
49
47
  idx_b.append_ku(ku)
50
48
 
51
- # 比 avgdl
52
49
  print(f" build 一次 avgdl = {idx_a._avgdl:.10f}")
53
50
  print(f" 1000 次累加 avgdl = {idx_b._avgdl:.10f}")
54
51
  diff_avgdl = abs(idx_a._avgdl - idx_b._avgdl)
55
52
  print(f" 差 = {diff_avgdl:.2e} (rel {diff_avgdl/idx_a._avgdl:.2e})")
56
53
 
57
- # 比 _idf_sum
58
54
  print(f" build 一次 _idf_sum = {idx_a._idf_sum:.10f}")
59
55
  print(f" 1000 次累加 _idf_sum = {idx_b._idf_sum:.10f}")
60
56
  diff_idf = abs(idx_a._idf_sum - idx_b._idf_sum)
61
57
  print(f" 差 = {diff_idf:.2e} (rel {diff_idf/max(abs(idx_a._idf_sum),1e-10):.2e})")
62
58
 
63
- # 搜同一 query,top-3 是否一致
64
59
  q = "topic0_3 topic1_7"
65
60
  r_a = sorted([(r.ku_id, round(r.score, 8)) for r in idx_a.search(q, 10)])
66
61
  r_b = sorted([(r.ku_id, round(r.score, 8)) for r in idx_b.search(q, 10)])
@@ -76,7 +71,6 @@ def audit_pickle_schema_fallback():
76
71
  """2: pickle schema 兼容(老 pickle / 损坏 pickle fallback)"""
77
72
  print("\n[2/5] pickle schema 兼容 + 损坏文件 fallback ...")
78
73
  tmp = "_tmp_audit.pkl"
79
- # 正常 save/load
80
74
  idx = NewBM25()
81
75
  idx.build(gen_corpus(100))
82
76
  idx.save(tmp)
@@ -84,7 +78,6 @@ def audit_pickle_schema_fallback():
84
78
  ok = idx2.load(tmp)
85
79
  print(f" 正常 save/load: ok={ok}, size={idx2.size()} {'PASS' if ok and idx2.size()==100 else 'FAIL'}")
86
80
 
87
- # 损坏文件
88
81
  with open(tmp, 'wb') as f:
89
82
  f.write(b'garbage data not a pickle')
90
83
  idx3 = NewBM25()
@@ -92,14 +85,12 @@ def audit_pickle_schema_fallback():
92
85
  print(f" 损坏文件 load: ok={ok3} (应该返 False, 不抛异常) {'PASS' if ok3 == False else 'FAIL'}")
93
86
  print(f" 损坏后 idx3.size() = {idx3.size()} (应该 0, 已 fallback) {'PASS' if idx3.size() == 0 else 'FAIL'}")
94
87
 
95
- # schema 不匹配(手写一个旧版结构)
96
88
  with open(tmp, 'wb') as f:
97
89
  pickle.dump({'old_version': True, 'ku_ids': [], 'corpus': []}, f)
98
90
  idx4 = NewBM25()
99
91
  ok4 = idx4.load(tmp)
100
92
  print(f" schema 不匹配: ok={ok4} (应该返 False) {'PASS' if ok4 == False else 'FAIL'}")
101
93
 
102
- # 不存在文件
103
94
  if os.path.exists(tmp):
104
95
  os.remove(tmp)
105
96
  idx5 = NewBM25()
@@ -158,19 +149,15 @@ def audit_clear_idempotent():
158
149
  idx.clear()
159
150
  print(f" clear 后: {idx.size()} (应该 0) {'PASS' if idx.size()==0 else 'FAIL'}")
160
151
 
161
- # 空 search 不抛
162
152
  r = idx.search("any query", 10)
163
153
  print(f" 空 search: {len(r)} 个结果 (应该 0) {'PASS' if len(r)==0 else 'FAIL'}")
164
154
 
165
- # 二次 clear
166
155
  idx.clear()
167
156
  print(f" 二次 clear: size={idx.size()} (应该 0) {'PASS' if idx.size()==0 else 'FAIL'}")
168
157
 
169
- # 删不存在
170
158
  r = idx.remove_ku("ku_99999999")
171
159
  print(f" remove_ku 不存在: 返 {r} (应该 False) {'PASS' if r == False else 'FAIL'}")
172
160
 
173
- # search 空 query
174
161
  r = idx.search("", 10)
175
162
  print(f" search 空 query: {len(r)} 个结果 (应该 0) {'PASS' if len(r)==0 else 'FAIL'}")
176
163
 
@@ -186,7 +173,7 @@ def main():
186
173
 
187
174
  r1 = audit_float_accumulation()
188
175
  r2 = audit_pickle_schema_fallback()
189
- audit_append_ku_latency() # 打印即可
176
+ audit_append_ku_latency()
190
177
  r4 = audit_search_consistency()
191
178
  r5 = audit_clear_idempotent()
192
179
 
@@ -155,7 +155,6 @@ def main():
155
155
  else:
156
156
  print("\n[4/4] 跳过一致率(无 rank_bm25 对照)")
157
157
 
158
- # save/load roundtrip
159
158
  print("\n[bonus] save/load roundtrip ...")
160
159
  tmp = "_tmp_bm25.pkl"
161
160
  new_idx.save(tmp)
@@ -116,7 +116,6 @@ def main():
116
116
  print("BM25 压测: 5万/10万 corpus build + search + remove + save/load")
117
117
  print("=" * 60)
118
118
 
119
- # 5万
120
119
  idx, corpus = bench_build(50_000)
121
120
  queries = gen_queries(200)
122
121
  bench_search(idx, queries)
@@ -125,11 +124,8 @@ def main():
125
124
  bench_save_load(idx, tmp)
126
125
  os.remove(tmp)
127
126
 
128
- # 10万 (增量:在 5万 上 append 5万,模拟冷构建期分批)
129
127
  print(f"\n[build] +5万 增量 (5万 -> 10万) ...")
130
128
  extra_corpus = gen_corpus(50_000, seed=43)
131
- # 取后 5万 (id 范围 0-49999 是 5万 corpus;这里 gen 同一 seed 重叠,改 seed)
132
- # 实际:重新 gen 5万不同 id
133
129
  extra_corpus = []
134
130
  rng = random.Random(43)
135
131
  for i in range(50_000, 100_000):