fable-engine 1.3.7__tar.gz → 1.3.9__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.
Files changed (165) hide show
  1. {fable_engine-1.3.7/fable_engine.egg-info → fable_engine-1.3.9}/PKG-INFO +44 -27
  2. {fable_engine-1.3.7 → fable_engine-1.3.9}/README.md +43 -26
  3. {fable_engine-1.3.7 → fable_engine-1.3.9}/docs/stop-ai-agents-writing-too-early.md +42 -17
  4. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/actions/system3.py +49 -4
  5. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/browser.py +58 -3
  6. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/fable_session.json +19 -2
  7. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/schema.py +19 -2
  8. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/scrapers/base.py +27 -1
  9. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/server.py +1 -1
  10. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/session.py +1 -1
  11. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/updater.py +38 -17
  12. {fable_engine-1.3.7 → fable_engine-1.3.9/fable_engine.egg-info}/PKG-INFO +44 -27
  13. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine.egg-info/SOURCES.txt +1 -0
  14. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_mode/__init__.py +1 -1
  15. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_mode/launcher.py +56 -2
  16. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/system3/evolution.py +75 -0
  17. {fable_engine-1.3.7 → fable_engine-1.3.9}/pyproject.toml +1 -1
  18. {fable_engine-1.3.7 → fable_engine-1.3.9}/setup.py +1 -1
  19. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_auto_updater.py +185 -0
  20. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_scrapers.py +20 -0
  21. fable_engine-1.3.9/tests/test_shell_call.py +58 -0
  22. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_skill_distribution.py +27 -2
  23. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_stealth_browser.py +42 -0
  24. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_system3.py +52 -0
  25. {fable_engine-1.3.7 → fable_engine-1.3.9}/LICENSE +0 -0
  26. {fable_engine-1.3.7 → fable_engine-1.3.9}/MANIFEST.in +0 -0
  27. {fable_engine-1.3.7 → fable_engine-1.3.9}/docs/ai-evidence-adjudicator.md +0 -0
  28. {fable_engine-1.3.7 → fable_engine-1.3.9}/docs/fable-v1-v2-migration.md +0 -0
  29. {fable_engine-1.3.7 → fable_engine-1.3.9}/docs/fable-v2-architecture.md +0 -0
  30. {fable_engine-1.3.7 → fable_engine-1.3.9}/docs/system3-architecture.md +0 -0
  31. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_compressor.py +0 -0
  32. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/__init__.py +0 -0
  33. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/actions/__init__.py +0 -0
  34. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/actions/cas.py +0 -0
  35. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/actions/deliberation.py +0 -0
  36. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/actions/fleet.py +0 -0
  37. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/actions/lifecycle.py +0 -0
  38. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/actions/scrapers.py +0 -0
  39. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/adjudicator.py +0 -0
  40. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/cas.py +0 -0
  41. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/guards.py +0 -0
  42. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/scrapers/__init__.py +0 -0
  43. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/scrapers/arxiv.py +0 -0
  44. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/scrapers/github.py +0 -0
  45. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/scrapers/reddit.py +0 -0
  46. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/scrapers/web.py +0 -0
  47. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/scrapers/x.py +0 -0
  48. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/scrapers/youtube.py +0 -0
  49. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine/test_server.py +0 -0
  50. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine.egg-info/dependency_links.txt +0 -0
  51. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine.egg-info/entry_points.txt +0 -0
  52. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_engine.egg-info/top_level.txt +0 -0
  53. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_mode/__main__.py +0 -0
  54. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_mode/adapters.py +0 -0
  55. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_mode/installer.py +0 -0
  56. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_mode/manifest.py +0 -0
  57. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_mode/resources.json +0 -0
  58. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_mode/safety.py +0 -0
  59. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_mode/skill_bundle.py +0 -0
  60. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_mode_entry.py +0 -0
  61. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/__init__.py +0 -0
  62. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/adapters.py +0 -0
  63. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/coder_fleet/__init__.py +0 -0
  64. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/coder_fleet/ast_tools.py +0 -0
  65. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/coder_fleet/compute.py +0 -0
  66. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/coder_fleet/design_engine.py +0 -0
  67. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/coder_fleet/diagnostics.py +0 -0
  68. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/coder_fleet/fleet_dispatcher.py +0 -0
  69. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/coder_fleet/mock_auditor.py +0 -0
  70. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/coder_fleet/mutation.py +0 -0
  71. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/coder_fleet/property_oracle.py +0 -0
  72. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/coder_fleet/receipt_attestor.py +0 -0
  73. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/coder_fleet/red_team_swarm.py +0 -0
  74. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/coder_fleet/sandbox_executor.py +0 -0
  75. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/coder_fleet/test_harness.py +0 -0
  76. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/coder_fleet/vector_engine.py +0 -0
  77. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/coder_fleet/visual.py +0 -0
  78. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/coder_fleet/workspace.py +0 -0
  79. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/cortical/__init__.py +0 -0
  80. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/cortical/plasticity_engine.py +0 -0
  81. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/execution_broker.py +0 -0
  82. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/proof_engine.py +0 -0
  83. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/protocol.py +0 -0
  84. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/runtime.py +0 -0
  85. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/system3/__init__.py +0 -0
  86. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/system3/causal.py +0 -0
  87. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/system3/dialectical.py +0 -0
  88. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/system3/executive.py +0 -0
  89. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/system3/free_energy.py +0 -0
  90. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/system3/hyperbolic.py +0 -0
  91. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/system3/induction.py +0 -0
  92. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/system3/kripke.py +0 -0
  93. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/system3/oracle.py +0 -0
  94. {fable_engine-1.3.7 → fable_engine-1.3.9}/fable_v2/verifiers.py +0 -0
  95. {fable_engine-1.3.7 → fable_engine-1.3.9}/rules/AGENTS.md +0 -0
  96. {fable_engine-1.3.7 → fable_engine-1.3.9}/rules/GEMINI.md +0 -0
  97. {fable_engine-1.3.7 → fable_engine-1.3.9}/rules/fable-mode.md +0 -0
  98. {fable_engine-1.3.7 → fable_engine-1.3.9}/setup.cfg +0 -0
  99. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/SKILL.md +0 -0
  100. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/cortex/concurrency.md +0 -0
  101. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/cortex/design_3d.md +0 -0
  102. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/cortex/frontend_design.md +0 -0
  103. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/cortex/process.md +0 -0
  104. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/cortex/python.md +0 -0
  105. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/cortex/research.md +0 -0
  106. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/cortex/rust.md +0 -0
  107. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/cortex/security.md +0 -0
  108. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/cortex/synaptic_matrix.json +0 -0
  109. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/cortex/system.md +0 -0
  110. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/cortex/target.md +0 -0
  111. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/examples/autonomous-agentic-migration.md +0 -0
  112. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/examples/breakthrough-algorithm-synthesis.md +0 -0
  113. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/examples/deepthink-analysis-proof.md +0 -0
  114. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/examples/distributed-system-design.md +0 -0
  115. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/examples/swe-bench-pro-debugging.md +0 -0
  116. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/examples/weak_model_ollama_setup.md +0 -0
  117. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/aaa-threejs-game-engine.md +0 -0
  118. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/adversarial-code-review-swarm.md +0 -0
  119. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/agentic-execution.md +0 -0
  120. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/anti-slop-frontend-architecture.md +0 -0
  121. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/architectural-blueprinting.md +0 -0
  122. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/cinematic-design-engine.md +0 -0
  123. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/cognitive-protocol.md +0 -0
  124. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/deepthink-mode.md +0 -0
  125. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/design-system.md +0 -0
  126. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/design-tokens-and-typographies.md +0 -0
  127. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/goal-rubric-and-pipeline-automation.md +0 -0
  128. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/hebbian-cortical-plasticity.md +0 -0
  129. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/innovation-engine.md +0 -0
  130. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/interleaved-verification.md +0 -0
  131. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/model-velocity-calibration.md +0 -0
  132. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/prompt-scaffolds.md +0 -0
  133. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/proof-architecture.md +0 -0
  134. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/svg-craft-and-vector-design.md +0 -0
  135. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/system2-session-engine.md +0 -0
  136. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/system3-meta-cognition.md +0 -0
  137. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/visual-imagination-engine.md +0 -0
  138. {fable_engine-1.3.7 → fable_engine-1.3.9}/skills/fable-mode/references/weak-model-frontier-uplift.md +0 -0
  139. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/__init__.py +0 -0
  140. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_adjudicator.py +0 -0
  141. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_anti_loop_circuit_breaker.py +0 -0
  142. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_coder_fleet.py +0 -0
  143. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_delegation_compiler.py +0 -0
  144. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_descriptor_boundaries.py +0 -0
  145. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_design_engine.py +0 -0
  146. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_epistemic_evidence_validator.py +0 -0
  147. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_execution_broker.py +0 -0
  148. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_fable_v2.py +0 -0
  149. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_fleet_transitions.py +0 -0
  150. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_fsm_redteam_evolution.py +0 -0
  151. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_goal_rubric_and_pipeline.py +0 -0
  152. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_hebbian_plasticity.py +0 -0
  153. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_packaging_runtime.py +0 -0
  154. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_proof_engine.py +0 -0
  155. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_red_team_seal_path.py +0 -0
  156. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_red_team_swarm.py +0 -0
  157. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_redteam_remediation.py +0 -0
  158. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_registration_transaction.py +0 -0
  159. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_requested_regressions.py +0 -0
  160. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_server_actions.py +0 -0
  161. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_server_frontier_actions.py +0 -0
  162. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_server_protocol.py +0 -0
  163. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_system3_deep_integration.py +0 -0
  164. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_system3_frontier.py +0 -0
  165. {fable_engine-1.3.7 → fable_engine-1.3.9}/tests/test_vector_engine.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: fable-engine
3
- Version: 1.3.7
3
+ Version: 1.3.9
4
4
  Summary: Independent deterministic System 2 cognitive engine and mechanical time-lock MCP server
5
5
  Author: REX-codebase
6
6
  License: MIT License
@@ -133,56 +133,73 @@ red-team swarm for code, and a sealed record of what was verified.
133
133
 
134
134
  <br/>
135
135
 
136
- ### Install
136
+ ### One package, two agent environments
137
+
138
+ Fable ships as one PyPI package. The same package contains the runtime, stdio
139
+ MCP server, and complete Agent Skill. Setup is explicit so installing an MCP
140
+ server never silently activates workspace instructions.
141
+
142
+ Run setup from the project the agent will work in:
137
143
 
138
144
  ```bash
139
- pip install fable-engine
145
+ uvx --from fable-engine==1.3.9 fable-mode setup --yes
140
146
  ```
141
147
 
142
- Or install the MCP server in your editor:
148
+ This resolves the pinned package in an isolated uv environment and copies the
149
+ bundled skill to `.agents/skills/fable-mode`. Use `--dry-run` to preview or
150
+ `--target <dir>` for another skill directory. For a persistent install, use:
143
151
 
144
- [![Install MCP server in VS Code](https://img.shields.io/badge/VS_Code-Install_MCP_server-007ACC?logo=visualstudiocode&logoColor=white)](vscode:mcp/install?%7B%22name%22%3A%22fable-engine%22%2C%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22--from%22%2C%22fable-engine%3D%3D1.3.7%22%2C%22fable-engine%22%5D%7D)
145
- [![Add to Cursor](https://img.shields.io/badge/Cursor-Add_MCP_server-black)](cursor://anysphere.cursor-deeplink/mcp/install?name=fable-engine&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyItLWZyb20iLCJmYWJsZS1lbmdpbmU9PTEuMy4zIiwiZmFibGUtZW5naW5lIl19)
152
+ ```bash
153
+ python -m pip install fable-engine
154
+ fable-mode setup --yes
155
+ ```
146
156
 
147
- These links configure Fable Engine for AI agents in VS Code Chat or Cursor. They do not install a standalone editor extension. Both use `uvx`, which downloads and runs the pinned PyPI release in an isolated environment.
157
+ Then choose only the invocation that matches the agent environment.
148
158
 
149
- Point your agent at the MCP server manually:
159
+ #### Native MCP client
160
+
161
+ Run `fable-engine` as the stdio server. For example:
150
162
 
151
163
  ```jsonc
152
- // Claude Code: claude mcp add fable-engine -- uvx --from fable-engine==1.3.7 fable-engine
153
- // Cursor: ~/.cursor/mcp.json
164
+ // Claude Code: claude mcp add fable-engine -- uvx --from fable-engine==1.3.9 fable-engine
165
+ // Cursor or another JSON-configured client:
154
166
  {
155
167
  "mcpServers": {
156
168
  "fable-engine": {
157
169
  "command": "uvx",
158
- "args": ["--from", "fable-engine==1.3.7", "fable-engine"]
170
+ "args": ["--from", "fable-engine==1.3.9", "fable-engine"]
159
171
  }
160
172
  }
161
173
  }
162
174
  ```
163
175
 
164
- Python 3.10+, zero runtime dependencies. Published on [PyPI as `fable-engine`](https://pypi.org/project/fable-engine/).
176
+ [![Install MCP server in VS Code](https://img.shields.io/badge/VS_Code-Install_MCP_server-007ACC?logo=visualstudiocode&logoColor=white)](vscode:mcp/install?%7B%22name%22%3A%22fable-engine%22%2C%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22--from%22%2C%22fable-engine%3D%3D1.3.9%22%2C%22fable-engine%22%5D%7D)
165
177
 
166
- <br/>
178
+ #### Shell sandbox with internet, no MCP host
167
179
 
168
- ### Optional: the Agent Skill
169
-
170
- Installing `fable-engine` gives your agent the MCP tools. It does not install
171
- or activate the Fable Mode Agent Skill - the prompt-side workflow in
172
- [`skills/fable-mode`](./skills/fable-mode/SKILL.md). Nothing in the package
173
- activates those instructions on its own; the skill is always a separate,
174
- explicit opt-in.
175
-
176
- The complete skill tree ships inside the wheel. To install it into your
177
- project's skills directory (the cross-client `.agents/skills/` convention):
180
+ The same package exposes a direct JSON transport. Pipe one `fable_session`
181
+ argument object to `fable-mode call`:
178
182
 
179
183
  ```bash
180
- uvx --from fable-engine==1.3.7 fable-mode install-skill --yes
184
+ printf '%s\n' '{"action":"create_session","session_name":"demo","objective":"Verify this change","time_budget_minutes":2}' \
185
+ | uvx --from fable-engine==1.3.9 fable-mode call
181
186
  ```
182
187
 
183
- This copies the skill to `.agents/skills/fable-mode`. Preview first with
184
- `--dry-run`, choose another location with `--target <dir>`, and reload your
185
- agent afterwards so it picks up the skill.
188
+ The command uses JSON Lines: one `fable_session` argument object per input line
189
+ and one JSON result per output line. Keep that process open for a full workflow so
190
+ the authority timer and session stay in the same trusted runtime. A one-line pipe
191
+ is useful for a single inspection call. Each uvx command can resolve an
192
+ isolated environment; `pip install` is better when the sandbox keeps a Python
193
+ environment between calls. Session data persists outside that environment in
194
+ Fable's data directory (`FABLE_DATA_DIR` can override it).
195
+
196
+ Python 3.10+, zero runtime dependencies. Published on [PyPI as `fable-engine`](https://pypi.org/project/fable-engine/).
197
+
198
+ #### Skill activation remains explicit
199
+
200
+ `setup` is the unified path. The older `install-skill` command remains as a
201
+ compatible alias for skill-only installation. Neither `fable-engine` nor
202
+ `pip install fable-engine` writes instructions into a workspace on its own.
186
203
 
187
204
  <br/>
188
205
 
@@ -90,56 +90,73 @@ red-team swarm for code, and a sealed record of what was verified.
90
90
 
91
91
  <br/>
92
92
 
93
- ### Install
93
+ ### One package, two agent environments
94
+
95
+ Fable ships as one PyPI package. The same package contains the runtime, stdio
96
+ MCP server, and complete Agent Skill. Setup is explicit so installing an MCP
97
+ server never silently activates workspace instructions.
98
+
99
+ Run setup from the project the agent will work in:
94
100
 
95
101
  ```bash
96
- pip install fable-engine
102
+ uvx --from fable-engine==1.3.9 fable-mode setup --yes
97
103
  ```
98
104
 
99
- Or install the MCP server in your editor:
105
+ This resolves the pinned package in an isolated uv environment and copies the
106
+ bundled skill to `.agents/skills/fable-mode`. Use `--dry-run` to preview or
107
+ `--target <dir>` for another skill directory. For a persistent install, use:
100
108
 
101
- [![Install MCP server in VS Code](https://img.shields.io/badge/VS_Code-Install_MCP_server-007ACC?logo=visualstudiocode&logoColor=white)](vscode:mcp/install?%7B%22name%22%3A%22fable-engine%22%2C%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22--from%22%2C%22fable-engine%3D%3D1.3.7%22%2C%22fable-engine%22%5D%7D)
102
- [![Add to Cursor](https://img.shields.io/badge/Cursor-Add_MCP_server-black)](cursor://anysphere.cursor-deeplink/mcp/install?name=fable-engine&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyItLWZyb20iLCJmYWJsZS1lbmdpbmU9PTEuMy4zIiwiZmFibGUtZW5naW5lIl19)
109
+ ```bash
110
+ python -m pip install fable-engine
111
+ fable-mode setup --yes
112
+ ```
103
113
 
104
- These links configure Fable Engine for AI agents in VS Code Chat or Cursor. They do not install a standalone editor extension. Both use `uvx`, which downloads and runs the pinned PyPI release in an isolated environment.
114
+ Then choose only the invocation that matches the agent environment.
105
115
 
106
- Point your agent at the MCP server manually:
116
+ #### Native MCP client
117
+
118
+ Run `fable-engine` as the stdio server. For example:
107
119
 
108
120
  ```jsonc
109
- // Claude Code: claude mcp add fable-engine -- uvx --from fable-engine==1.3.7 fable-engine
110
- // Cursor: ~/.cursor/mcp.json
121
+ // Claude Code: claude mcp add fable-engine -- uvx --from fable-engine==1.3.9 fable-engine
122
+ // Cursor or another JSON-configured client:
111
123
  {
112
124
  "mcpServers": {
113
125
  "fable-engine": {
114
126
  "command": "uvx",
115
- "args": ["--from", "fable-engine==1.3.7", "fable-engine"]
127
+ "args": ["--from", "fable-engine==1.3.9", "fable-engine"]
116
128
  }
117
129
  }
118
130
  }
119
131
  ```
120
132
 
121
- Python 3.10+, zero runtime dependencies. Published on [PyPI as `fable-engine`](https://pypi.org/project/fable-engine/).
133
+ [![Install MCP server in VS Code](https://img.shields.io/badge/VS_Code-Install_MCP_server-007ACC?logo=visualstudiocode&logoColor=white)](vscode:mcp/install?%7B%22name%22%3A%22fable-engine%22%2C%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22--from%22%2C%22fable-engine%3D%3D1.3.9%22%2C%22fable-engine%22%5D%7D)
122
134
 
123
- <br/>
135
+ #### Shell sandbox with internet, no MCP host
124
136
 
125
- ### Optional: the Agent Skill
126
-
127
- Installing `fable-engine` gives your agent the MCP tools. It does not install
128
- or activate the Fable Mode Agent Skill - the prompt-side workflow in
129
- [`skills/fable-mode`](./skills/fable-mode/SKILL.md). Nothing in the package
130
- activates those instructions on its own; the skill is always a separate,
131
- explicit opt-in.
132
-
133
- The complete skill tree ships inside the wheel. To install it into your
134
- project's skills directory (the cross-client `.agents/skills/` convention):
137
+ The same package exposes a direct JSON transport. Pipe one `fable_session`
138
+ argument object to `fable-mode call`:
135
139
 
136
140
  ```bash
137
- uvx --from fable-engine==1.3.7 fable-mode install-skill --yes
141
+ printf '%s\n' '{"action":"create_session","session_name":"demo","objective":"Verify this change","time_budget_minutes":2}' \
142
+ | uvx --from fable-engine==1.3.9 fable-mode call
138
143
  ```
139
144
 
140
- This copies the skill to `.agents/skills/fable-mode`. Preview first with
141
- `--dry-run`, choose another location with `--target <dir>`, and reload your
142
- agent afterwards so it picks up the skill.
145
+ The command uses JSON Lines: one `fable_session` argument object per input line
146
+ and one JSON result per output line. Keep that process open for a full workflow so
147
+ the authority timer and session stay in the same trusted runtime. A one-line pipe
148
+ is useful for a single inspection call. Each uvx command can resolve an
149
+ isolated environment; `pip install` is better when the sandbox keeps a Python
150
+ environment between calls. Session data persists outside that environment in
151
+ Fable's data directory (`FABLE_DATA_DIR` can override it).
152
+
153
+ Python 3.10+, zero runtime dependencies. Published on [PyPI as `fable-engine`](https://pypi.org/project/fable-engine/).
154
+
155
+ #### Skill activation remains explicit
156
+
157
+ `setup` is the unified path. The older `install-skill` command remains as a
158
+ compatible alias for skill-only installation. Neither `fable-engine` nor
159
+ `pip install fable-engine` writes instructions into a workspace on its own.
143
160
 
144
161
  <br/>
145
162
 
@@ -2,27 +2,45 @@
2
2
 
3
3
  AI coding agents often move from a plausible plan to editing files before they have gathered enough evidence. Fable Mode adds a mechanical session gate: the agent can inspect and reason, but the Fable Engine will not report write permission until the configured authority timer and proof prerequisites pass.
4
4
 
5
- Fable Mode is two separate pieces:
5
+ Fable Mode ships as one package with three parts:
6
6
 
7
- - **Fable Engine** is the MCP server that stores session state and enforces its gates.
8
- - **The Fable Mode Agent Skill** is the optional workflow that tells a compatible agent how to use those gates.
7
+ - **Fable Engine** is the stdio MCP server that stores session state and enforces its gates.
8
+ - **The Fable Mode Agent Skill** is the bundled workflow for compatible agents.
9
+ - **The shell transport** calls the same `fable_session` API when an agent has a shell and internet but no MCP host.
9
10
 
10
- Installing one does not silently activate the other.
11
+ The package is unified; activation stays explicit. Installing or launching the
12
+ server does not silently write Agent Skill instructions into a project.
11
13
 
12
- ## Install the engine
14
+ ## Set up from one package
13
15
 
14
- You need Python 3.10+ and [uv](https://docs.astral.sh/uv/getting-started/installation/).
16
+ You need Python 3.10+ and either [uv](https://docs.astral.sh/uv/getting-started/installation/) or pip.
15
17
 
16
- Run the pinned release without changing your global Python environment:
18
+ From the project the agent will work in:
17
19
 
18
20
  ```bash
19
- uvx --from fable-engine==1.3.7 fable-engine
21
+ uvx --from fable-engine==1.3.9 fable-mode setup --dry-run
22
+ uvx --from fable-engine==1.3.9 fable-mode setup --yes
20
23
  ```
21
24
 
25
+ `setup` copies the complete bundled skill to `.agents/skills/fable-mode`. Use
26
+ `--target <dir>` for another skill directory. The installer refuses to
27
+ overwrite local edits unless you pass `--force`.
28
+
29
+ For a persistent environment, install the same package once:
30
+
31
+ ```bash
32
+ python -m pip install fable-engine
33
+ fable-mode setup --yes
34
+ ```
35
+
36
+ ## Route A: an agent with native MCP access
37
+
38
+ Run `fable-engine` as its stdio MCP server.
39
+
22
40
  ### Claude Code
23
41
 
24
42
  ```bash
25
- claude mcp add fable-engine -- uvx --from fable-engine==1.3.7 fable-engine
43
+ claude mcp add fable-engine -- uvx --from fable-engine==1.3.9 fable-engine
26
44
  ```
27
45
 
28
46
  ### Cursor or another JSON-configured MCP client
@@ -32,26 +50,33 @@ claude mcp add fable-engine -- uvx --from fable-engine==1.3.7 fable-engine
32
50
  "mcpServers": {
33
51
  "fable-engine": {
34
52
  "command": "uvx",
35
- "args": ["--from", "fable-engine==1.3.7", "fable-engine"]
53
+ "args": ["--from", "fable-engine==1.3.9", "fable-engine"]
36
54
  }
37
55
  }
38
56
  }
39
57
  ```
40
58
 
41
- Restart or reload the client, then inspect its MCP tools. You should see `fable_session` plus the browser tools exposed by the server.
59
+ Restart or reload the client. Its tool list should include `fable_session`.
42
60
 
43
- ## Install the optional Agent Skill
61
+ ## Route B: an internet-enabled shell sandbox without MCP access
44
62
 
45
- From the root of the project where you want the skill:
63
+ Pipe one `fable_session` argument object to `fable-mode call`:
46
64
 
47
65
  ```bash
48
- uvx --from fable-engine==1.3.7 fable-mode install-skill --dry-run
49
- uvx --from fable-engine==1.3.7 fable-mode install-skill --yes
66
+ printf '%s\n' '{"action":"create_session","session_name":"parser-refactor","objective":"Refactor the parser without changing its public behavior","time_budget_minutes":2}' \
67
+ | uvx --from fable-engine==1.3.9 fable-mode call
50
68
  ```
51
69
 
52
- The default destination is `.agents/skills/fable-mode`. Use `--target <dir>` for a different skill directory. The installer refuses to overwrite local edits unless you pass `--force`.
70
+ The command uses JSON Lines and passes each object to the same Fable handler used
71
+ by MCP. It prints one machine-readable result per input line. Keep one process
72
+ open for the full Think -> Prove -> Attack -> Write workflow; restarting the
73
+ process intentionally starts a fresh authority clock. Invalid, empty, non-object,
74
+ or over-1-MiB requests fail with a nonzero exit code and write the error to stderr.
53
75
 
54
- Reload the agent after installation.
76
+ For later calls, send the same argument objects shown below. When repeated uvx
77
+ calls are undesirable, use the persistent pip installation and replace the
78
+ command after the pipe with `fable-mode call`. Session files live outside the
79
+ uvx environment; set `FABLE_DATA_DIR` to choose their location.
55
80
 
56
81
  ## Run a first session
57
82
 
@@ -282,11 +282,53 @@ def _handle_system3_evolve_paradigms(arguments: Dict[str, Any]) -> str:
282
282
  )
283
283
  pool.initialize_population(seed_paradigms=seed_paradigms)
284
284
 
285
- for _ in range(generations):
286
- pool.evolve_generation()
285
+ observed_scores = arguments.get("observed_fitness")
286
+ if isinstance(observed_scores, str):
287
+ try:
288
+ observed_scores = json.loads(observed_scores)
289
+ except Exception:
290
+ return "Error: 'observed_fitness' must be a JSON object keyed by genome ID or '*' default."
291
+
292
+ evolution_receipt = None
293
+ if observed_scores is not None:
294
+ if not isinstance(observed_scores, dict) or not observed_scores:
295
+ return "Error: 'observed_fitness' must be a non-empty object keyed by genome ID or '*' default."
296
+
297
+ def observed_evaluator(genome: CognitiveGenome) -> Dict[str, float]:
298
+ raw = observed_scores.get(genome.genome_id, observed_scores.get("*"))
299
+ if not isinstance(raw, dict):
300
+ raise ValueError(f"Missing observed fitness for genome '{genome.genome_id}' and no '*' default was supplied.")
301
+ normalized: Dict[str, float] = {}
302
+ for dim in pool.population[0].fitness_scores.keys() or []:
303
+ if dim in raw:
304
+ normalized[dim] = max(0.0, min(1.0, float(raw[dim])))
305
+ if not normalized:
306
+ from fable_v2.system3 import PARETO_DIMENSIONS
307
+ for dim in PARETO_DIMENSIONS:
308
+ if dim in raw:
309
+ normalized[dim] = max(0.0, min(1.0, float(raw[dim])))
310
+ if not normalized:
311
+ raise ValueError("Observed fitness rows must contain at least one recognized Pareto dimension.")
312
+ return normalized
313
+
314
+ try:
315
+ evolution_receipt = pool.evolve_until_stable(
316
+ observed_evaluator,
317
+ max_generations=generations,
318
+ patience=int(arguments.get("stagnation_patience", min(4, max(1, generations)))),
319
+ min_improvement=float(arguments.get("min_improvement", 0.001)),
320
+ weights=weights,
321
+ )
322
+ except (TypeError, ValueError) as exc:
323
+ return f"Error: Invalid observed fitness: {exc}"
324
+ else:
325
+ for _ in range(generations):
326
+ pool.evolve_generation()
287
327
 
288
328
  pareto_frontier = pool.get_pareto_frontier()
289
- best_genome = pool.get_best_genome(weights)
329
+ best_genome = pool.get_best_genome(weights) if evolution_receipt is None else max(
330
+ pool.population, key=lambda g: g.compute_scalar_fitness(weights)
331
+ )
290
332
 
291
333
  session = get_or_load_session(session_name)
292
334
  session.system3_gene_pools.append(pool.to_dict())
@@ -316,7 +358,10 @@ def _handle_system3_evolve_paradigms(arguments: Dict[str, Any]) -> str:
316
358
  f"- **Session**: `{session.session_name}`\n"
317
359
  f"- **Generations Evolved**: `{pool.generation_count}` (Population: `{len(pool.population)}`)\n"
318
360
  f"- **Rank 1 Pareto Frontier Size**: `{len(pareto_frontier)}` non-dominated solutions\n"
319
- f"- **Top Archetype**: **{best_genome.paradigm_name}** (`{best_genome.genome_id}`)\n\n"
361
+ f"- **Top Archetype**: **{best_genome.paradigm_name}** (`{best_genome.genome_id}`)\n"
362
+ f"- **Measured Loop**: `{'ACTIVE - external acceptance required' if evolution_receipt else 'structural heuristic mode'}`\n"
363
+ + (f"- **Stop Reason**: `{evolution_receipt['stop_reason']}`\n" if evolution_receipt else "")
364
+ + "\n"
320
365
  f"#### 🏆 Top Rank 1 Non-Dominated Pareto Frontier:\n"
321
366
  f"| ID | Paradigm | Lat | Tput | Mem | Fault | Mod | Sec | Token | Score |\n"
322
367
  f"|---|---|---|---|---|---|---|---|---|---|\n"
@@ -571,18 +571,69 @@ class StealthBrowserSession:
571
571
  self.scroll_y = max(0, min(self.scroll_y + delta_y, self.document_height - self.viewport_height))
572
572
  return self._build_status()
573
573
 
574
+ def _ancestor_form(self, elem: DOMElement) -> Optional[DOMElement]:
575
+ current = elem.parent
576
+ while current is not None:
577
+ if current.tag == "form":
578
+ return current
579
+ current = current.parent
580
+ return None
581
+
582
+ def _submit_get_form(self, form: DOMElement) -> Dict[str, Any]:
583
+ """Submit a GET form through normal navigation; never synthesize a write request."""
584
+ method = form.attrs.get("method", "get").strip().lower() or "get"
585
+ if method != "get":
586
+ return {
587
+ "status": "error",
588
+ "error": f"Form method '{method.upper()}' is unsupported because it may mutate remote state",
589
+ "element_id": form.element_id,
590
+ }
591
+ action = urllib.parse.urljoin(self.url, form.attrs.get("action") or self.url)
592
+ pairs: List[Tuple[str, str]] = []
593
+ stack = list(reversed(form.children))
594
+ while stack:
595
+ node = stack.pop()
596
+ stack.extend(reversed(node.children))
597
+ name = node.attrs.get("name", "").strip()
598
+ if not name or node.attrs.get("disabled") is not None:
599
+ continue
600
+ if node.tag == "textarea":
601
+ pairs.append((name, node.attrs.get("value", node.text)))
602
+ elif node.tag == "input":
603
+ input_type = node.attrs.get("type", "text").lower()
604
+ if input_type == "password":
605
+ return {
606
+ "status": "error",
607
+ "error": "GET form submission with a password field is blocked to prevent credential leakage",
608
+ "element_id": form.element_id,
609
+ }
610
+ if input_type in ("submit", "button", "reset", "file", "image"):
611
+ continue
612
+ if input_type in ("checkbox", "radio") and "checked" not in node.attrs:
613
+ continue
614
+ pairs.append((name, node.attrs.get("value", "on" if input_type in ("checkbox", "radio") else "")))
615
+ parsed = urllib.parse.urlsplit(action)
616
+ query = urllib.parse.parse_qsl(parsed.query, keep_blank_values=True) + pairs
617
+ target = urllib.parse.urlunsplit((parsed.scheme, parsed.netloc, parsed.path, urllib.parse.urlencode(query), parsed.fragment))
618
+ return self.open(target)
619
+
574
620
  def click(self, element_id: str) -> Dict[str, Any]:
575
- """Follow an element's link target; non-link controls are unsupported."""
621
+ """Follow a link or activate a safe GET form control."""
576
622
  elem = self.elements_by_id.get(element_id)
577
623
  if not elem:
578
- return {"error": f"Element '{element_id}' not found"}
624
+ return {"status": "error", "error": f"Element '{element_id}' not found"}
579
625
  href = elem.attrs.get("href")
580
626
  if href is not None:
581
627
  target_url = urllib.parse.urljoin(self.url, href)
582
628
  return self.open(target_url)
629
+ input_type = elem.attrs.get("type", "").lower()
630
+ if elem.tag == "button" or (elem.tag == "input" and input_type in ("submit", "image")):
631
+ form = self._ancestor_form(elem)
632
+ if form is not None:
633
+ return self._submit_get_form(form)
583
634
  return {
584
635
  "status": "error",
585
- "error": f"Click is unsupported for <{elem.tag}> elements without a link target",
636
+ "error": f"Click is unsupported for <{elem.tag}> elements without a link or safe GET form target",
586
637
  "element_id": element_id,
587
638
  }
588
639
 
@@ -672,6 +723,10 @@ class StealthBrowserSession:
672
723
  updated_value = current_value + " "
673
724
  elif key == "Enter" and target.tag == "textarea":
674
725
  updated_value = current_value + "\n"
726
+ elif key == "Enter" and target.tag == "input":
727
+ form = self._ancestor_form(target)
728
+ if form is not None:
729
+ return self._submit_get_form(form)
675
730
  elif len(key) == 1:
676
731
  updated_value = current_value + key
677
732
  if updated_value is not None and updated_value != current_value:
@@ -156,7 +156,7 @@
156
156
  "type": "number"
157
157
  },
158
158
  "curvature": {
159
- "description": "Sectional curvature c > 0 of Poincar\u00e9 manifold (default 1.0).",
159
+ "description": "Sectional curvature c > 0 of Poincaré manifold (default 1.0).",
160
160
  "type": "number"
161
161
  },
162
162
  "d_prior": {
@@ -167,7 +167,7 @@
167
167
  ]
168
168
  },
169
169
  "dimension": {
170
- "description": "Dimension of Poincar\u00e9 ball manifold (default 2).",
170
+ "description": "Dimension of Poincaré ball manifold (default 2).",
171
171
  "type": "integer"
172
172
  },
173
173
  "domain": {
@@ -597,6 +597,23 @@
597
597
  "user_prompt": {
598
598
  "description": "Alias for prompt: high-level design prompt describing desired web experience.",
599
599
  "type": "string"
600
+ },
601
+ "observed_fitness": {
602
+ "description": "Optional measured fitness object keyed by genome ID, with '*' as a default row. Enables bounded evidence-fed evolution and does not authorize deployment.",
603
+ "type": [
604
+ "object",
605
+ "string"
606
+ ]
607
+ },
608
+ "stagnation_patience": {
609
+ "description": "Measured generations without improvement before automatic evolution stops.",
610
+ "type": "integer",
611
+ "minimum": 1
612
+ },
613
+ "min_improvement": {
614
+ "description": "Minimum scalar measured-fitness gain required to reset stagnation.",
615
+ "type": "number",
616
+ "minimum": 0
600
617
  }
601
618
  },
602
619
  "required": [
@@ -306,6 +306,20 @@ TOOL_SCHEMA = {
306
306
  "description": "Optional dictionary of weights across the 10 Pareto dimensions.",
307
307
  "type": ["object", "string"]
308
308
  },
309
+ "observed_fitness": {
310
+ "description": "Optional measured fitness object keyed by genome ID, with '*' as a default row. Supplying it enables bounded evidence-fed evolution with stagnation stopping; values are clamped to [0, 1] and never authorize deployment.",
311
+ "type": ["object", "string"]
312
+ },
313
+ "stagnation_patience": {
314
+ "description": "Measured generations without improvement before automatic evolution stops (default min(4, generations)).",
315
+ "type": "integer",
316
+ "minimum": 1
317
+ },
318
+ "min_improvement": {
319
+ "description": "Minimum scalar measured-fitness gain required to reset stagnation (default 0.001).",
320
+ "type": "number",
321
+ "minimum": 0
322
+ },
309
323
  "task_complexity": {
310
324
  "type": "number",
311
325
  "description": "Task complexity index [0.0, 1.0] for tri-level cognitive arbitration."
@@ -625,11 +639,14 @@ BROWSER_TOOL_SCHEMAS = [
625
639
  },
626
640
  {
627
641
  "name": "browser_click",
628
- "description": "Navigates to the href of a link element by its stable element ID. Elements without an href are unsupported.",
642
+ "title": "Activate a safe browser target",
643
+ "annotations": {"title": "Activate a safe browser target", "readOnlyHint": False, "destructiveHint": False, "idempotentHint": False, "openWorldHint": True},
644
+ "outputSchema": {"type": "object", "additionalProperties": True},
645
+ "description": "Activates an href-bearing link or submits a GET form through normal browser navigation. POST and other form methods are refused, and GET forms containing password fields are blocked to prevent credential leakage. Returns the resulting page status or a bounded error without bypassing existing navigation controls.",
629
646
  "inputSchema": {
630
647
  "type": "object",
631
648
  "properties": {
632
- "element_id": {"type": "string", "description": "Stable element ID of an href-bearing link."},
649
+ "element_id": {"type": "string", "description": "Stable element ID of an href-bearing link or submit control inside a safe GET form."},
633
650
  "session_id": {"type": "string", "description": "Optional browser tab/session identifier."}
634
651
  },
635
652
  "required": ["element_id"]
@@ -8,6 +8,7 @@ clamped retry/backoff, response bounds, and explicit untrusted external content
8
8
  from __future__ import annotations
9
9
 
10
10
  import datetime
11
+ import hashlib
11
12
  import http.client
12
13
  import ipaddress
13
14
  import json
@@ -25,7 +26,7 @@ from typing import Any, Dict, List, Optional, Tuple
25
26
 
26
27
  logger = logging.getLogger("fable-engine.scrapers.base")
27
28
 
28
- USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 FableResearch/1.3.7"
29
+ USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 FableResearch/1.3.9"
29
30
 
30
31
  MAX_RETRY_DELAY_SECONDS = 10.0
31
32
 
@@ -173,6 +174,23 @@ class DomainRateLimiter:
173
174
  GLOBAL_RATE_LIMITER = DomainRateLimiter(min_interval_seconds=0.3)
174
175
 
175
176
 
177
+ def _canonical_origin(url: str) -> str:
178
+ """Return a stable, credential-free origin for provenance metadata."""
179
+ try:
180
+ parsed = urllib.parse.urlsplit(url)
181
+ if parsed.scheme.lower() not in ("http", "https") or not parsed.hostname:
182
+ return ""
183
+ host = parsed.hostname.lower().rstrip(".")
184
+ if ":" in host:
185
+ host = f"[{host}]"
186
+ port = parsed.port
187
+ default_port = 443 if parsed.scheme.lower() == "https" else 80
188
+ authority = host if port in (None, default_port) else f"{host}:{port}"
189
+ return f"{parsed.scheme.lower()}://{authority}"
190
+ except (TypeError, ValueError):
191
+ return ""
192
+
193
+
176
194
  @dataclass
177
195
  class ResearchResult:
178
196
  """Structured research retrieval result."""
@@ -189,6 +207,14 @@ class ResearchResult:
189
207
  def __post_init__(self):
190
208
  if "trust_level" not in self.metadata:
191
209
  self.metadata["trust_level"] = "untrusted_external_content"
210
+ # Every successful extraction carries deterministic integrity/provenance facts.
211
+ # This does not make external content trusted; it lets callers detect repeated,
212
+ # changed, or accidentally truncated evidence without source-specific code.
213
+ if self.ok:
214
+ encoded = self.content.encode("utf-8", errors="replace")
215
+ self.metadata.setdefault("content_bytes", len(encoded))
216
+ self.metadata.setdefault("content_sha256", hashlib.sha256(encoded).hexdigest())
217
+ self.metadata.setdefault("canonical_origin", _canonical_origin(self.canonical_url))
192
218
 
193
219
  def to_markdown(self) -> str:
194
220
  """Formats the structured research result as readable Markdown with explicit untrusted content boundaries."""
@@ -237,7 +237,7 @@ def main():
237
237
  },
238
238
  "serverInfo": {
239
239
  "name": "fable-engine",
240
- "version": "1.3.7"
240
+ "version": "1.3.9"
241
241
  }
242
242
  }
243
243
  })
@@ -1567,7 +1567,7 @@ class FableSession:
1567
1567
  def to_dict(self) -> Dict[str, Any]:
1568
1568
  """Serializes session to dictionary."""
1569
1569
  return {
1570
- "version": "1.3.7",
1570
+ "version": "1.3.9",
1571
1571
  "session_name": self.session_name,
1572
1572
  "session_id": self.session_id,
1573
1573
  "objective": self.objective,