dialectical-framework 2.1.4__tar.gz → 2.1.6__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 (234) hide show
  1. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/PKG-INFO +1 -1
  2. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/pyproject.toml +1 -1
  3. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/consultant/consultant.py +40 -2
  4. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/thesis_fit_check.py +41 -5
  5. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/views.py +15 -0
  6. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/bedrock_provider.py +63 -4
  7. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/call_census.py +127 -1
  8. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/use_brain.py +21 -2
  9. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/LICENSE +0 -0
  10. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/PATENTS +0 -0
  11. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/README.md +0 -0
  12. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/__init__.py +0 -0
  13. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/__init__.py +0 -0
  14. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/__init__.py +0 -0
  15. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/advisor.py +0 -0
  16. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/build_policy.py +0 -0
  17. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/migration.py +0 -0
  18. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/reply_hygiene.py +0 -0
  19. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/system_prompts.py +0 -0
  20. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/tools/__init__.py +0 -0
  21. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/tools/anchor.py +0 -0
  22. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/tools/deepen.py +0 -0
  23. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/tools/explore.py +0 -0
  24. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/tools/ingest.py +0 -0
  25. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/tools/note.py +0 -0
  26. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/tools/record_decision.py +0 -0
  27. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/tools/scoped.py +0 -0
  28. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/tools/sync.py +0 -0
  29. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/agent_context.py +0 -0
  30. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/__init__.py +0 -0
  31. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/analyst.py +0 -0
  32. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/skills/__init__.py +0 -0
  33. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/skills/anchor_theses.py +0 -0
  34. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/skills/edit_perspective.py +0 -0
  35. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/skills/expand_polarities.py +0 -0
  36. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/skills/find_polarities.py +0 -0
  37. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/skills/introduce_polarity.py +0 -0
  38. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/skills/sketch_tetrad.py +0 -0
  39. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/skills/surface_theses.py +0 -0
  40. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/system_prompts.py +0 -0
  41. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/tools/__init__.py +0 -0
  42. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/tools/place_statement.py +0 -0
  43. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/app_spec.py +0 -0
  44. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/apps.py +0 -0
  45. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/consultant/__init__.py +0 -0
  46. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/conversation_facilitator.py +0 -0
  47. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/execution_report.py +0 -0
  48. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/__init__.py +0 -0
  49. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/explorer.py +0 -0
  50. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/skills/__init__.py +0 -0
  51. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/skills/build_wheels.py +0 -0
  52. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/skills/explore_transformations.py +0 -0
  53. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/skills/generate_synthesis.py +0 -0
  54. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/system_prompts.py +0 -0
  55. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/tools/__init__.py +0 -0
  56. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/tools/create_nexus.py +0 -0
  57. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/tools/expand_nexus.py +0 -0
  58. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/tools/generate_synthesis.py +0 -0
  59. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/tools/present_exploration.py +0 -0
  60. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/__init__.py +0 -0
  61. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/__init__.py +0 -0
  62. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/add_input.py +0 -0
  63. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/audit_feasibility.py +0 -0
  64. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/create_dx_input.py +0 -0
  65. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/digest_input.py +0 -0
  66. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/discard.py +0 -0
  67. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/get_schema.py +0 -0
  68. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/inspect_node.py +0 -0
  69. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/present_analysis.py +0 -0
  70. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/query_graph.py +0 -0
  71. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/read_digest.py +0 -0
  72. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/read_input.py +0 -0
  73. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/reasonable_concern.py +0 -0
  74. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/stream_events.py +0 -0
  75. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/toolsets.py +0 -0
  76. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/turn_timing.py +0 -0
  77. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/__init__.py +0 -0
  78. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/ac_re_taxonomy.py +0 -0
  79. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/action_extraction.py +0 -0
  80. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/add_input.py +0 -0
  81. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/ai_dto/__init__.py +0 -0
  82. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/ai_dto/statement_dto.py +0 -0
  83. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/ai_dto/statements_deck_dto.py +0 -0
  84. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/antithesis_classification.py +0 -0
  85. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/antithesis_extraction.py +0 -0
  86. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/antithetical_thesis_detection.py +0 -0
  87. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/aspect_classification.py +0 -0
  88. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/aspect_generation.py +0 -0
  89. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/attribution_check.py +0 -0
  90. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/build_status.py +0 -0
  91. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/causality/__init__.py +0 -0
  92. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/causality/causality_estimator.py +0 -0
  93. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/causality/causality_estimator_balanced.py +0 -0
  94. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/causality/causality_estimator_criteria.py +0 -0
  95. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/causality/causality_estimator_desirable.py +0 -0
  96. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/causality/causality_estimator_feasible.py +0 -0
  97. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/causality/causality_estimator_realistic.py +0 -0
  98. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/causality/causality_normalizer.py +0 -0
  99. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/causality/estimator_resolver.py +0 -0
  100. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/causality_estimation.py +0 -0
  101. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/control_statements_check.py +0 -0
  102. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/create_dx_input.py +0 -0
  103. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/create_nexus.py +0 -0
  104. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/decision_coherence_check.py +0 -0
  105. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/decision_confirmation_check.py +0 -0
  106. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/diagonal_oppositions_check.py +0 -0
  107. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/dialectical_context.py +0 -0
  108. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/discard.py +0 -0
  109. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/display_text_edit.py +0 -0
  110. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/expand_nexus.py +0 -0
  111. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/perspective_combination.py +0 -0
  112. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/perspective_validation.py +0 -0
  113. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/positive_ac_re_apex_derivation.py +0 -0
  114. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/record_decision.py +0 -0
  115. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/scoring_scales.py +0 -0
  116. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/source_digest.py +0 -0
  117. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/statement_classification.py +0 -0
  118. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/statement_deduplication.py +0 -0
  119. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/statement_headline.py +0 -0
  120. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/statement_placement.py +0 -0
  121. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/synthesis_generation.py +0 -0
  122. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/tetrad_candidates.py +0 -0
  123. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/tetrad_grounding.py +0 -0
  124. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/tetrad_sketch.py +0 -0
  125. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/thesis_extraction.py +0 -0
  126. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/transformation_audit.py +0 -0
  127. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/transformation_generation.py +0 -0
  128. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/transformation_sketch.py +0 -0
  129. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/view_sketch.py +0 -0
  130. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/dialectical_reasoning.py +0 -0
  131. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/enums/__init__.py +0 -0
  132. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/enums/causality_preset.py +0 -0
  133. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/enums/di.py +0 -0
  134. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/events/__init__.py +0 -0
  135. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/events/graph_event.py +0 -0
  136. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/events/graph_event_bus.py +0 -0
  137. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/events/progress_event.py +0 -0
  138. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/exceptions/__init__.py +0 -0
  139. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/exceptions/node_errors.py +0 -0
  140. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/exceptions/provider_errors.py +0 -0
  141. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/exceptions/resolver_errors.py +0 -0
  142. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/__init__.py +0 -0
  143. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/composite_input_resolver.py +0 -0
  144. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/dialexity_input_resolver.py +0 -0
  145. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/estimation_manager.py +0 -0
  146. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/mixins/__init__.py +0 -0
  147. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/mixins/incremental_build_mixin.py +0 -0
  148. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/mixins/intent_mixin.py +0 -0
  149. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/mixins/persistable_mixin.py +0 -0
  150. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/__init__.py +0 -0
  151. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/assessable_entity.py +0 -0
  152. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/base_node.py +0 -0
  153. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/case.py +0 -0
  154. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/cycle.py +0 -0
  155. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/decision.py +0 -0
  156. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/estimation.py +0 -0
  157. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/ideas.py +0 -0
  158. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/input.py +0 -0
  159. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/nexus.py +0 -0
  160. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/note.py +0 -0
  161. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/perspective.py +0 -0
  162. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/polarity.py +0 -0
  163. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/rationale.py +0 -0
  164. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/statement.py +0 -0
  165. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/synthesis.py +0 -0
  166. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/transformation.py +0 -0
  167. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/transition.py +0 -0
  168. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/wheel.py +0 -0
  169. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationship_manager.py +0 -0
  170. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/__init__.py +0 -0
  171. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/action_reflection_relationship.py +0 -0
  172. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/belongs_to_cycle_relationship.py +0 -0
  173. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/belongs_to_nexus_relationship.py +0 -0
  174. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/changed_to_relationship.py +0 -0
  175. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/contradiction_of_relationship.py +0 -0
  176. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/critiques_relationship.py +0 -0
  177. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/distilled_to_relationship.py +0 -0
  178. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/estimates_relationship.py +0 -0
  179. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/explains_relationship.py +0 -0
  180. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/grounded_in_relationship.py +0 -0
  181. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/has_input_relationship.py +0 -0
  182. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/has_statement_relationship.py +0 -0
  183. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/has_wheel_relationship.py +0 -0
  184. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/immutable_structure.py +0 -0
  185. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/is_source_of_relationship.py +0 -0
  186. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/is_target_of_relationship.py +0 -0
  187. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/negative_side_of_relationship.py +0 -0
  188. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/opposite_direction_relationship.py +0 -0
  189. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/opposite_of_relationship.py +0 -0
  190. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/polarity_relationship.py +0 -0
  191. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/positive_side_of_relationship.py +0 -0
  192. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/provides_relationship.py +0 -0
  193. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/synthesis_of_relationship.py +0 -0
  194. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/rendering.py +0 -0
  195. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/__init__.py +0 -0
  196. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/case_repository.py +0 -0
  197. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/cycle_repository.py +0 -0
  198. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/decision_repository.py +0 -0
  199. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/input_repository.py +0 -0
  200. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/nexus_repository.py +0 -0
  201. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/node_repository.py +0 -0
  202. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/note_repository.py +0 -0
  203. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/perspective_repository.py +0 -0
  204. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/polarity_repository.py +0 -0
  205. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/schema_repository.py +0 -0
  206. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/statement_repository.py +0 -0
  207. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/transformation_repository.py +0 -0
  208. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/wheel_repository.py +0 -0
  209. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/scope_context.py +0 -0
  210. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/verbatim_input_resolver.py +0 -0
  211. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/wheel_segment.py +0 -0
  212. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/wheel_segment_polar_pair.py +0 -0
  213. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/protocols/__init__.py +0 -0
  214. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/protocols/has_config.py +0 -0
  215. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/protocols/input_resolver.py +0 -0
  216. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/py.typed +0 -0
  217. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/settings.py +0 -0
  218. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/settings_context.py +0 -0
  219. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/__init__.py +0 -0
  220. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/async_drain.py +0 -0
  221. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/chunking.py +0 -0
  222. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/concurrency.py +0 -0
  223. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/dc_replace.py +0 -0
  224. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/decompose_probability_uniformly.py +0 -0
  225. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/edge_context.py +0 -0
  226. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/effect_logger.py +0 -0
  227. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/format_compat.py +0 -0
  228. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/input_context.py +0 -0
  229. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/order_transitions.py +0 -0
  230. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/progress.py +0 -0
  231. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/retry_accounting.py +0 -0
  232. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/sequence_generation.py +0 -0
  233. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/thinking_compat.py +0 -0
  234. {dialectical_framework-2.1.4 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/utterance.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dialectical-framework
3
- Version: 2.1.4
3
+ Version: 2.1.6
4
4
  Summary: A dialectical framework for augmented intelligence. AI reasoning powered with dialectics supports humans in: system optimization (psychology, engineering, business, politics, etc.); dispute resolution (mediation, conflicts, negotiations, etc.); decision-making (dilemmas, challenging situations, win-win, etc.).
5
5
  License: MIT
6
6
  Keywords: dialectics,dialectical-reasoning,synthesis,thesis-antithesis,ai,artificial-intelligence,llm,reasoning-framework,philosophy,logic,argumentation,conflict-resolution,decision-making,critical-thinking,semantic-graph,mirascope,pydantic,perspectives,polarity-reasoning
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "dialectical-framework"
3
- version = "2.1.4"
3
+ version = "2.1.6"
4
4
  description = "A dialectical framework for augmented intelligence. AI reasoning powered with dialectics supports humans in: system optimization (psychology, engineering, business, politics, etc.); dispute resolution (mediation, conflicts, negotiations, etc.); decision-making (dilemmas, challenging situations, win-win, etc.)."
5
5
  authors = ["Evaldas Taroza <evaldas@dialexity.com>"]
6
6
  readme = "README.md"
@@ -36,10 +36,11 @@ dropped from BOTH the product and the baseline.
36
36
 
37
37
  from __future__ import annotations
38
38
 
39
+ import dataclasses
39
40
  import logging
40
41
  import re
41
42
  from contextlib import aclosing
42
- from typing import Any, AsyncGenerator, Optional
43
+ from typing import TYPE_CHECKING, Any, AsyncGenerator, Optional
43
44
 
44
45
  from mirascope import llm
45
46
  from mirascope.llm.exceptions import ProviderError
@@ -60,6 +61,11 @@ from dialectical_framework.graph.views import (
60
61
  PerspectiveView,
61
62
  )
62
63
 
64
+ if TYPE_CHECKING:
65
+ # Imported lazily inside `exploration_view` at runtime (the concern pulls
66
+ # the judges in); only the annotation needs it here.
67
+ from dialectical_framework.concerns.tetrad_candidates import SketchVerdict
68
+
63
69
  logger = logging.getLogger(__name__)
64
70
 
65
71
  #: Tool verbs → mental acts. These are REWRITES, not drops: dropping every
@@ -144,6 +150,20 @@ _TOOL_TOKENS = (
144
150
  )
145
151
 
146
152
 
153
+ def _with_verdict(
154
+ perspective: PerspectiveView, verdict: Optional[SketchVerdict]
155
+ ) -> PerspectiveView:
156
+ """The drawn tension with the fit judge's two reads on it, when it was
157
+ judged; a `None` verdict (judging failed on that draw) leaves both None."""
158
+ if verdict is None:
159
+ return perspective
160
+ return dataclasses.replace(
161
+ perspective,
162
+ thesis_fit=verdict.thesis_fit,
163
+ antithesis_granted=verdict.antithesis_granted,
164
+ )
165
+
166
+
147
167
  def _failed_draw(error: BaseException) -> FailedDrawView:
148
168
  """A failed draw's record: the exception's type, the provider's refusal
149
169
  category when it is a `ModelRefusal` that carries one, and its text.
@@ -565,6 +585,7 @@ class Consultant:
565
585
  )
566
586
 
567
587
  runners_up: list[PerspectiveView] = []
588
+ winner_verdict: Optional[SketchVerdict] = None
568
589
  if len(sketches) > 1:
569
590
  firsts = [s.tensions[0] if s.tensions else None for s in sketches]
570
591
  judgeable = [i for i, t in enumerate(firsts) if complete(t)]
@@ -622,7 +643,11 @@ class Consultant:
622
643
  )
623
644
  order = ranking(verdicts)
624
645
  sketch = field[order[0]]
625
- runners_up = [perspective_from_sketch(pool[i]) for i in order[1:]]
646
+ winner_verdict = verdicts[order[0]]
647
+ runners_up = [
648
+ _with_verdict(perspective_from_sketch(pool[i]), verdicts[i])
649
+ for i in order[1:]
650
+ ]
626
651
  else:
627
652
  sketch = sketches[judgeable[0]] if judgeable else sketches[0]
628
653
  else:
@@ -632,6 +657,19 @@ class Consultant:
632
657
  runners_up=runners_up,
633
658
  failed_draws=failed_draws,
634
659
  )
660
+ # The winner's verdict rides on the card it was chosen for (the first
661
+ # tension is what the ranking judged), and each runner-up carries its
662
+ # own, so a spare served later says the same thing about itself. The
663
+ # fit judge's A read is what a host shows a line for; nothing here
664
+ # changes the choice (the app's handoff of 2026-10-29).
665
+ if winner_verdict is not None and view.perspectives:
666
+ view = dataclasses.replace(
667
+ view,
668
+ perspectives=[
669
+ _with_verdict(view.perspectives[0], winner_verdict),
670
+ *view.perspectives[1:],
671
+ ],
672
+ )
635
673
  # What the turn leaves behind is NOT what it sent: the long request and
636
674
  # the DTO come off, and the person's ask plus the drawing in words go
637
675
  # on. Kept as a request→prose pair, the long request taught the next
@@ -89,6 +89,39 @@ pole as it was at A+), and flips 14 of the 29 app rows from fitting to not.
89
89
  Figures and the hand read of the disagreements:
90
90
  `docs/dev-notes/antithesis-selection.md`, "A is the view the author granted".
91
91
 
92
+ A GRANTED FACT IS NOT A GRANTED POSITION (2026-10-29, the first app's fourth
93
+ handoff, retired into the dev note, "A granted fact is not a granted
94
+ position"). The owner's hand read of the four petitions both writers draw the
95
+ conceded view on, in every arm and on both models: three of the four grant a
96
+ FACT and then argue against the thing as practised — "the NMC is responsible
97
+ for maintaining the standards" grants a ROLE (the petition is against the
98
+ tests), "intended to prevent misuse" grants an INTENT (the demand asks for
99
+ targeted safeguards), "classified as harmless" grants a CLASSIFICATION (the
100
+ petition exists to contest it) — and the writer was right to draw the
101
+ opposition as practised; only "SCAs can be declined at a GP's discretion"
102
+ grants a POSITION. So both judges over-read "granted", and this read shared
103
+ the over-read (it agreed with the app's first judge on 21/29; its own
104
+ example of a grant was "although intended to X"). The rule, the app's judge's
105
+ and now this one's, in one sentence: a clause that reports that something
106
+ exists, is intended for a purpose, is classified or ruled a certain way, or
107
+ is somebody's job grants a fact; a position is granted only when the holder
108
+ says the opposing claim is right or legitimate on its own terms. Under it the
109
+ app's rows whose clause grants a position fell 29 → 12 and A the granted view
110
+ 16/29 → 5/12 — two or three texts in forty, not sixteen rows in twenty-nine.
111
+ The read here carries the rule at the field and in the prompt, with the
112
+ app's three fact examples; measured on the same 29 app rows against judge 2
113
+ (`tests/e2e/rescore_conceded_a.py`, `CONCEDED_A_APP_REFERENCE`, the prior
114
+ run's stored verdicts as the paired control): agreement with the app's judge
115
+ 20/29 with the old wording, 25/29 and then 21/29 on two runs of this one —
116
+ the A read moves about four rows in twenty-nine between identical runs at
117
+ the line, so the count does not resolve the wording. Row by row both runs
118
+ agree: the five granted positions kept, the intent and classification
119
+ petitions no longer false grants, the role petition on the judge's line, a
120
+ stated REQUIREMENT ("require 3 years or longer") still read as a grant. A
121
+ fifth kind for the requirement was built and REJECTED the same morning
122
+ (22/29, repaired 2, broken 5: a longer sentence read as licence). Any
123
+ further tightening here is measured on two replicates a side.
124
+
92
125
  This judge does not think, so it parses on either transport. The view-turn
93
126
  arm of the same gate did not, until the Mirascope floor moved to 2.8.2 on
94
127
  2026-10-26: the view turn is the one structured call that THINKS, the
@@ -138,10 +171,13 @@ class ThesisFitDto(BaseModel):
138
171
  le=1.0,
139
172
  description=(
140
173
  "Do the HOLDER's own words ALREADY name and GRANT the position A states — "
141
- "set it down as true or legitimate before arguing past it ('X is true, "
142
- "however Y'; 'whilst X may be needed, we think Y'; 'although intended to "
143
- "X')? 1.0: A is that granted view, X. 0.0: A is an opposition their words "
144
- "do not name, or name only to reject it without granting it."
174
+ "set it down as right or legitimate on its own terms before arguing past "
175
+ "it ('X is true, however Y'; 'whilst X may be needed, we think Y')? A "
176
+ "clause that reports that something exists, is intended for a purpose, is "
177
+ "classified or ruled a certain way, or is somebody's job grants a fact, "
178
+ "not a position, even when the holder then argues against that thing as "
179
+ "practised. 1.0: A is that granted position, X. 0.0: A is an opposition "
180
+ "their words do not name, name only to reject it, or grant only as a fact."
145
181
  ),
146
182
  )
147
183
  a_plus_already_granted: float = Field(
@@ -211,7 +247,7 @@ Constructive side of A (A+): "{a_plus}"
211
247
 
212
248
  1. Is T the claim its holder would sign? When the holder's words hold several claims, the one they would sign is the conclusion or demand the rest leads to — not a premise, not a hedge on the way to it, and not a claim they concede in passing ("not only X but also Y" concedes X and argues for Y).
213
249
 
214
- 2. Do the holder's own words already name AND grant the position A states? Granting is setting a view down as true or legitimate before arguing past it: "X is true, however Y", "whilst X may be needed, we think Y", "although intended to X, this punishes Y" — the holder wrote X down to get past it, and A is X. A view the words name only to reject it is not granted; a fact or a sympathy that takes no side is not a position. An opposition they have granted themselves is seen, not missing; a tetrad on it shows them their own sentence as the other side.
250
+ 2. Do the holder's own words already name AND grant the position A states? Granting is setting a view down as right or legitimate on its own terms before arguing past it: "X is true, however Y", "whilst X may be needed, we think Y", "GPs can decline at their discretion, however blanket refusal is wrong" — the holder wrote X down to get past it, and A is X. A clause that reports that something EXISTS, is INTENDED for a purpose, is CLASSIFIED or ruled a certain way, or is somebody's JOB or responsibility grants a fact, not a position, even when the holder then argues against that thing as practised: "the regulator is responsible for standards, however the tests are too many" grants a role; "intended to prevent misuse, though it punishes the lawful" grants an intent; "classified as harmless, however patients report symptoms" grants a classification — and the opposition as practised (keep the tests, keep the measure, keep the classification) is one the holder has NOT granted. A view the words name only to reject it is not granted; a fact or a sympathy that takes no side is not a position. An opposition they have granted themselves is seen, not missing; a tetrad on it shows them their own sentence as the other side.
215
251
 
216
252
  3. Do the holder's own words already name AND concede what A+ says? The same reading at the constructive side: a tetrad on it shows them their own sentence as a blind spot."""
217
253
  return await ConversationFacilitator().submit(
@@ -198,6 +198,21 @@ class PerspectiveView:
198
198
  discarded: Optional[str] = None
199
199
  #: True when all six positions are connected.
200
200
  complete: bool = False
201
+ #: The fit judge's two reads of THIS draw (`concerns/thesis_fit_check.py`,
202
+ #: carried from `SketchVerdict` by the view turn, 2026-10-29): how far T is
203
+ #: the claim the person would sign, and how far A is a view their own
204
+ #: words already grant. `None` = not judged — every view read off the
205
+ #: graph, a single draw, a draw whose judging failed. Numbers, and KEPT by
206
+ #: `without_terminology` all the same, because they are not a score for a
207
+ #: screen but the host's grounds for a line in words: a person handed
208
+ #: their own concession as the blind spot is told so ("this is a view you
209
+ #: already hold") instead of having to notice it. The line a host draws at
210
+ #: is the framework's own, `1 - antithesis_granted <
211
+ #: THESIS_FIT_THRESHOLD` (`SketchVerdict.opposes_a_granted_view`). The
212
+ #: read moves about four rows in twenty-nine between identical runs, so a
213
+ #: host shows it as a prompt, never as a verdict on the card.
214
+ thesis_fit: Optional[float] = None
215
+ antithesis_granted: Optional[float] = None
201
216
 
202
217
  @property
203
218
  def poles(self) -> dict[str, PoleView]:
@@ -54,6 +54,7 @@ from dialectical_framework.enums.di import DI
54
54
  from dialectical_framework.exceptions.provider_errors import ModelRefusal
55
55
  from dialectical_framework.settings import Settings
56
56
  from dialectical_framework.settings_context import get_current_settings
57
+ from dialectical_framework.utils.call_census import current_stream_usage
57
58
  from dialectical_framework.utils.format_compat import (
58
59
  learn_format_mode_from_error,
59
60
  structured_output_format,
@@ -431,6 +432,52 @@ class StreamReadTimeout(httpx.ReadTimeout):
431
432
  """
432
433
 
433
434
 
435
+ def _note_stream_usage(event: Any) -> None:
436
+ """Tell the awaited call's holder what this event says about the bill.
437
+
438
+ `message_start` carries the prefill (`message.usage`: `input_tokens` is
439
+ the UNCACHED count on the raw API, the cache fields beside it, and an
440
+ output count that is only a placeholder), the one `message_delta` at the
441
+ end carries the real output count, and every raw
442
+ `content_block_delta` carries the characters the model has written so
443
+ far. Read only on a cancel (`call_census.StreamUsageSoFar`); a stream
444
+ that finishes is recorded from its assembled `Message` as before. The
445
+ synthesized `text`/`thinking` events the SDK yields beside the raw deltas
446
+ are NOT counted — they repeat the same characters.
447
+ """
448
+ holder = current_stream_usage()
449
+ if holder is None:
450
+ return
451
+ kind = getattr(event, "type", None)
452
+ output_is_final = False
453
+ if kind == "message_start":
454
+ usage = getattr(getattr(event, "message", None), "usage", None)
455
+ elif kind == "message_delta":
456
+ usage = getattr(event, "usage", None)
457
+ output_is_final = True
458
+ elif kind == "content_block_delta":
459
+ delta = getattr(event, "delta", None)
460
+ for attr in ("text", "thinking", "partial_json"):
461
+ piece = getattr(delta, attr, None)
462
+ if isinstance(piece, str):
463
+ holder.note_content(len(piece))
464
+ return
465
+ else:
466
+ return
467
+ if usage is None:
468
+ return
469
+ holder.note_usage(
470
+ input_tokens=getattr(usage, "input_tokens", None),
471
+ cache_read_tokens=getattr(usage, "cache_read_input_tokens", None),
472
+ cache_write_tokens=getattr(usage, "cache_creation_input_tokens", None),
473
+ # `message_start.usage.output_tokens` is a PLACEHOLDER (the live probe
474
+ # read 8 against 48 characters delivered); only the `message_delta`
475
+ # count is real. Left unreported rather than recorded as a count a
476
+ # host would price.
477
+ output_tokens=getattr(usage, "output_tokens", None) if output_is_final else None,
478
+ )
479
+
480
+
434
481
  def _is_content_event(event: Any) -> bool:
435
482
  kind = getattr(event, "type", None)
436
483
  if kind in _CONTENT_EVENTS:
@@ -463,8 +510,17 @@ async def _stream_to_message(
463
510
  loop = asyncio.get_running_loop()
464
511
  started = time.monotonic()
465
512
  headers_budget = min(headers_timeout_s, read_timeout_s)
513
+ # `asyncio.timeout` / `timeout_at`, never `asyncio.wait_for`: on Python
514
+ # 3.11 `wait_for` RETURNS the inner result and swallows an outside cancel
515
+ # whenever the inner future is already done when the cancel lands — and
516
+ # on a buffered SSE stream the next event is nearly always already in,
517
+ # so a host's cancel of a draw was lost in the common case and the call
518
+ # ran on to completion, billing in full (the live probe
519
+ # `tests/e2e/probe_cancelled_call_usage.py`, 2026-10-29). The context
520
+ # managers await in THIS task and let a CancelledError through.
466
521
  try:
467
- stream = await asyncio.wait_for(manager.__aenter__(), timeout=headers_budget)
522
+ async with asyncio.timeout(headers_budget):
523
+ stream = await manager.__aenter__()
468
524
  except asyncio.TimeoutError as e:
469
525
  logger.warning(
470
526
  "Stream stalled on %s before headers (%.1fs)",
@@ -487,9 +543,8 @@ async def _stream_to_message(
487
543
  deadline = loop.time() + read_timeout_s
488
544
  while True:
489
545
  try:
490
- event = await asyncio.wait_for(
491
- iterator.__anext__(), timeout=max(deadline - loop.time(), 0.0)
492
- )
546
+ async with asyncio.timeout_at(deadline):
547
+ event = await iterator.__anext__()
493
548
  except StopAsyncIteration:
494
549
  break
495
550
  except Exception as e:
@@ -516,12 +571,16 @@ async def _stream_to_message(
516
571
  if getattr(event, "type", None) == "ping":
517
572
  continue
518
573
  events += 1
574
+ _note_stream_usage(event)
519
575
  if first_content_s is None and _is_content_event(event):
520
576
  first_content_s = time.monotonic() - started
521
577
  budget = read_timeout_s if first_content_s is None else _STREAM_GAP_TIMEOUT_S
522
578
  deadline = loop.time() + budget
523
579
  message = await stream.get_final_message()
524
580
  except BaseException as e:
581
+ # A cancel lands here too (the host killed the draw): the stream is
582
+ # closed on the way out, and what it had said about its bill stays in
583
+ # the holder `use_brain` installed, for the partial record it writes.
525
584
  await manager.__aexit__(type(e), e, e.__traceback__)
526
585
  raise
527
586
  await manager.__aexit__(None, None, None)
@@ -75,7 +75,7 @@ from __future__ import annotations
75
75
  import contextvars
76
76
  from contextlib import contextmanager
77
77
  from dataclasses import dataclass, field
78
- from typing import Iterator, Optional
78
+ from typing import Any, Iterator, Optional
79
79
 
80
80
 
81
81
  @dataclass(frozen=True)
@@ -154,6 +154,25 @@ class CallRecord:
154
154
  #: the only candidate in this list that could be material.
155
155
  first_token_seconds: Optional[float] = None
156
156
 
157
+ #: True when the stream was CLOSED before the provider finished — a draw
158
+ #: the host cancelled (`asyncio.CancelledError` inside `use_brain`'s
159
+ #: awaited call, 2026-10-29). The token fields then hold what the stream
160
+ #: had said before the close: the prefill from `message_start`, and the
161
+ #: output count only if a `message_delta` had arrived. The provider billed
162
+ #: the request, and before this flag a killed call left no record at all,
163
+ #: so a host summing the census priced a cancelled view turn at the gate's
164
+ #: one call. A partial record is a LOWER BOUND on the bill, never the bill.
165
+ partial: bool = False
166
+ #: Characters of content the stream had delivered when it was closed —
167
+ #: text, thinking and tool-input deltas, the raw `content_block_delta`s
168
+ #: only. Set on a partial record alone, `None` otherwise. CHARACTERS, not
169
+ #: tokens: Anthropic sends the output token count in ONE `message_delta`,
170
+ #: the last event before `message_stop`, so on a cancel `output_tokens` is
171
+ #: almost always still unreported, and this is the one fact about the
172
+ #: generated output a closed stream leaves behind. A host converts at its
173
+ #: own rate or ignores it; the framework never turns it into tokens.
174
+ output_chars: Optional[int] = None
175
+
157
176
  @property
158
177
  def prefill_tokens(self) -> Optional[int]:
159
178
  """Total prompt tokens the provider processed, however they were billed."""
@@ -376,6 +395,8 @@ def record_call(
376
395
  cache_write_tokens: Optional[int] = None,
377
396
  first_token_seconds: Optional[float] = None,
378
397
  output_tokens: Optional[int] = None,
398
+ partial: bool = False,
399
+ output_chars: Optional[int] = None,
379
400
  ) -> None:
380
401
  """Attribute one provider round-trip to every installed census.
381
402
 
@@ -406,6 +427,8 @@ def record_call(
406
427
  cache_write_tokens=cache_write_tokens,
407
428
  first_token_seconds=first_token_seconds,
408
429
  output_tokens=output_tokens,
430
+ partial=partial,
431
+ output_chars=output_chars,
409
432
  )
410
433
  for census in stack:
411
434
  census.calls.append(record)
@@ -415,3 +438,106 @@ def current_call_census() -> Optional[CallCensus]:
415
438
  """The innermost installed census, or None. For readers that must not create one."""
416
439
  stack = _stack.get()
417
440
  return stack[-1] if stack else None
441
+
442
+
443
+ # --- What a stream in flight has said so far ---------------------------------
444
+
445
+
446
+ @dataclass
447
+ class StreamUsageSoFar:
448
+ """What one stream has reported about its own bill BEFORE it finished.
449
+
450
+ Filled by the provider as the events arrive (`bedrock_provider.
451
+ _stream_to_message` → `note_stream_usage`), read by `use_brain` only when
452
+ the awaited call is cancelled under it, to leave a partial `CallRecord`
453
+ in place of none. On a stream that finishes it is read by nobody: the
454
+ assembled `Message` carries the authoritative usage and the normal record
455
+ is written from that.
456
+
457
+ Anthropic's stream reports the prefill in `message_start` (the raw API
458
+ convention: `input_tokens` EXCLUDES the cache fields, so it maps onto
459
+ `uncached_input_tokens` as it is) and the output count in a single
460
+ `message_delta` at the very end. So a stream closed mid-generation
461
+ nearly always knows its prefill and not its output; `output_chars` is the
462
+ fact that remains.
463
+ """
464
+
465
+ uncached_input_tokens: Optional[int] = None
466
+ cache_read_tokens: Optional[int] = None
467
+ cache_write_tokens: Optional[int] = None
468
+ output_tokens: Optional[int] = None
469
+ output_chars: int = 0
470
+
471
+ @property
472
+ def reported(self) -> bool:
473
+ """Whether the provider said anything billable — a stream that never
474
+ opened, or never reached `message_start`, leaves nothing to record."""
475
+ return any(
476
+ v is not None
477
+ for v in (
478
+ self.uncached_input_tokens,
479
+ self.cache_read_tokens,
480
+ self.cache_write_tokens,
481
+ self.output_tokens,
482
+ )
483
+ )
484
+
485
+ def note_usage(
486
+ self,
487
+ *,
488
+ input_tokens: Optional[int] = None,
489
+ cache_read_tokens: Optional[int] = None,
490
+ cache_write_tokens: Optional[int] = None,
491
+ output_tokens: Optional[int] = None,
492
+ ) -> None:
493
+ """Take a usage report as the provider sent it; a field the report
494
+ does not carry (`None`) leaves what an earlier event said."""
495
+ if input_tokens is not None:
496
+ self.uncached_input_tokens = input_tokens
497
+ if cache_read_tokens is not None:
498
+ self.cache_read_tokens = cache_read_tokens
499
+ if cache_write_tokens is not None:
500
+ self.cache_write_tokens = cache_write_tokens
501
+ if output_tokens is not None:
502
+ self.output_tokens = output_tokens
503
+
504
+ def note_content(self, chars: int) -> None:
505
+ self.output_chars += chars
506
+
507
+ def as_record_kwargs(self) -> dict[str, Any]:
508
+ """The `record_call` keyword arguments for a PARTIAL record."""
509
+ return {
510
+ "uncached_input_tokens": self.uncached_input_tokens,
511
+ "cache_read_tokens": self.cache_read_tokens,
512
+ "cache_write_tokens": self.cache_write_tokens,
513
+ "output_tokens": self.output_tokens,
514
+ "output_chars": self.output_chars,
515
+ "partial": True,
516
+ }
517
+
518
+
519
+ #: NOT a stack: one awaited call has one stream, and `use_brain` installs the
520
+ #: holder around exactly that await. A mutable object for the same reason the
521
+ #: census is one — should any layer between the two ever read events in a
522
+ #: child task, its copied context must still write into the caller's holder.
523
+ _in_flight: contextvars.ContextVar[Optional[StreamUsageSoFar]] = contextvars.ContextVar(
524
+ "stream_usage_in_flight", default=None
525
+ )
526
+
527
+
528
+ @contextmanager
529
+ def stream_usage_in_flight() -> Iterator[StreamUsageSoFar]:
530
+ """Install a fresh holder for the provider call made inside the block."""
531
+ holder = StreamUsageSoFar()
532
+ token = _in_flight.set(holder)
533
+ try:
534
+ yield holder
535
+ finally:
536
+ _in_flight.reset(token)
537
+
538
+
539
+ def current_stream_usage() -> Optional[StreamUsageSoFar]:
540
+ """The holder of the awaited call in flight, or None outside one (the
541
+ facilitator's streamed conversational round, a bare provider call)."""
542
+ return _in_flight.get()
543
+
@@ -23,7 +23,8 @@ from dialectical_framework.exceptions.provider_errors import ModelRefusal
23
23
  from dialectical_framework.settings import Settings
24
24
  from dialectical_framework.utils.bedrock_provider import (
25
25
  ensure_anthropic_provider, ensure_bedrock_provider)
26
- from dialectical_framework.utils.call_census import record_call
26
+ from dialectical_framework.utils.call_census import (record_call,
27
+ stream_usage_in_flight)
27
28
  from dialectical_framework.utils.concurrency import llm_concurrency_slot
28
29
  from dialectical_framework.utils.retry_accounting import record_retry
29
30
 
@@ -227,7 +228,25 @@ def use_brain(
227
228
  # as a queue. `CallCensus` documents where that wait
228
229
  # surfaces instead.
229
230
  call_started = time.monotonic()
230
- response = await _llm_call()
231
+ # A cancel mid-stream (the host killed the draw) is the
232
+ # one exit on which the provider has billed and no
233
+ # response exists to record. The streamed awaited call
234
+ # fills this holder as its events arrive, so the
235
+ # partial record carries the prefill the stream
236
+ # reported and whatever it knew of the output.
237
+ with stream_usage_in_flight() as in_flight:
238
+ try:
239
+ response = await _llm_call()
240
+ except asyncio.CancelledError:
241
+ if in_flight.reported:
242
+ record_call(
243
+ method.__qualname__,
244
+ seconds=time.monotonic() - call_started,
245
+ started=call_started,
246
+ format_name=format_name,
247
+ **in_flight.as_record_kwargs(),
248
+ )
249
+ raise
231
250
  record_call(
232
251
  method.__qualname__,
233
252
  seconds=time.monotonic() - call_started,