dialectical-framework 2.1.5__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.
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/PKG-INFO +1 -1
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/pyproject.toml +1 -1
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/consultant/consultant.py +40 -2
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/views.py +15 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/bedrock_provider.py +63 -4
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/call_census.py +127 -1
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/use_brain.py +21 -2
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/LICENSE +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/PATENTS +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/README.md +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/advisor.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/build_policy.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/migration.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/reply_hygiene.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/system_prompts.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/tools/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/tools/anchor.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/tools/deepen.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/tools/explore.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/tools/ingest.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/tools/note.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/tools/record_decision.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/tools/scoped.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/advisor/tools/sync.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/agent_context.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/analyst.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/skills/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/skills/anchor_theses.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/skills/edit_perspective.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/skills/expand_polarities.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/skills/find_polarities.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/skills/introduce_polarity.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/skills/sketch_tetrad.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/skills/surface_theses.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/system_prompts.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/tools/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/analyst/tools/place_statement.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/app_spec.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/apps.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/consultant/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/conversation_facilitator.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/execution_report.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/explorer.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/skills/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/skills/build_wheels.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/skills/explore_transformations.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/skills/generate_synthesis.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/system_prompts.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/tools/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/tools/create_nexus.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/tools/expand_nexus.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/tools/generate_synthesis.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/explorer/tools/present_exploration.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/add_input.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/audit_feasibility.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/create_dx_input.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/digest_input.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/discard.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/get_schema.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/inspect_node.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/present_analysis.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/query_graph.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/read_digest.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/orchestrator/tools/read_input.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/reasonable_concern.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/stream_events.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/toolsets.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/turn_timing.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/ac_re_taxonomy.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/action_extraction.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/add_input.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/ai_dto/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/ai_dto/statement_dto.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/ai_dto/statements_deck_dto.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/antithesis_classification.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/antithesis_extraction.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/antithetical_thesis_detection.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/aspect_classification.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/aspect_generation.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/attribution_check.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/build_status.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/causality/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/causality/causality_estimator.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/causality/causality_estimator_balanced.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/causality/causality_estimator_criteria.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/causality/causality_estimator_desirable.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/causality/causality_estimator_feasible.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/causality/causality_estimator_realistic.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/causality/causality_normalizer.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/causality/estimator_resolver.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/causality_estimation.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/control_statements_check.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/create_dx_input.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/create_nexus.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/decision_coherence_check.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/decision_confirmation_check.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/diagonal_oppositions_check.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/dialectical_context.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/discard.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/display_text_edit.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/expand_nexus.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/perspective_combination.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/perspective_validation.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/positive_ac_re_apex_derivation.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/record_decision.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/scoring_scales.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/source_digest.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/statement_classification.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/statement_deduplication.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/statement_headline.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/statement_placement.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/synthesis_generation.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/tetrad_candidates.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/tetrad_grounding.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/tetrad_sketch.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/thesis_extraction.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/thesis_fit_check.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/transformation_audit.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/transformation_generation.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/transformation_sketch.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/concerns/view_sketch.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/dialectical_reasoning.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/enums/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/enums/causality_preset.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/enums/di.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/events/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/events/graph_event.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/events/graph_event_bus.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/events/progress_event.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/exceptions/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/exceptions/node_errors.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/exceptions/provider_errors.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/exceptions/resolver_errors.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/composite_input_resolver.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/dialexity_input_resolver.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/estimation_manager.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/mixins/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/mixins/incremental_build_mixin.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/mixins/intent_mixin.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/mixins/persistable_mixin.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/assessable_entity.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/base_node.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/case.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/cycle.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/decision.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/estimation.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/ideas.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/input.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/nexus.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/note.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/perspective.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/polarity.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/rationale.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/statement.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/synthesis.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/transformation.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/transition.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/nodes/wheel.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationship_manager.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/action_reflection_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/belongs_to_cycle_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/belongs_to_nexus_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/changed_to_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/contradiction_of_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/critiques_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/distilled_to_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/estimates_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/explains_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/grounded_in_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/has_input_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/has_statement_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/has_wheel_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/immutable_structure.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/is_source_of_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/is_target_of_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/negative_side_of_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/opposite_direction_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/opposite_of_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/polarity_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/positive_side_of_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/provides_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/relationships/synthesis_of_relationship.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/rendering.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/case_repository.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/cycle_repository.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/decision_repository.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/input_repository.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/nexus_repository.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/node_repository.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/note_repository.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/perspective_repository.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/polarity_repository.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/schema_repository.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/statement_repository.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/transformation_repository.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/repositories/wheel_repository.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/scope_context.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/verbatim_input_resolver.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/wheel_segment.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/wheel_segment_polar_pair.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/protocols/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/protocols/has_config.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/protocols/input_resolver.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/py.typed +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/settings.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/settings_context.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/__init__.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/async_drain.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/chunking.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/concurrency.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/dc_replace.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/decompose_probability_uniformly.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/edge_context.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/effect_logger.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/format_compat.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/input_context.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/order_transitions.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/progress.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/retry_accounting.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/sequence_generation.py +0 -0
- {dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/utils/thinking_compat.py +0 -0
- {dialectical_framework-2.1.5 → 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.
|
|
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.
|
|
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
|
-
|
|
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
|
{dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/graph/views.py
RENAMED
|
@@ -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
|
-
|
|
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
|
-
|
|
491
|
-
|
|
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
|
-
|
|
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,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dialectical_framework-2.1.5 → dialectical_framework-2.1.6}/src/dialectical_framework/agents/apps.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|