context-compiler 0.7.2__tar.gz → 0.7.3__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.
- {context_compiler-0.7.2 → context_compiler-0.7.3}/AGENTS.md +10 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/PKG-INFO +7 -7
- {context_compiler-0.7.2 → context_compiler-0.7.3}/README.md +6 -6
- {context_compiler-0.7.2 → context_compiler-0.7.3}/docs/DescriptionAndMilestones.md +6 -6
- {context_compiler-0.7.2 → context_compiler-0.7.3}/docs/DesignPhilosophy.md +4 -4
- {context_compiler-0.7.2 → context_compiler-0.7.3}/docs/llm-preprocessor.md +4 -5
- {context_compiler-0.7.2 → context_compiler-0.7.3}/docs/multi-engine.md +3 -3
- {context_compiler-0.7.2 → context_compiler-0.7.3}/examples/integrations/README.md +1 -1
- {context_compiler-0.7.2 → context_compiler-0.7.3}/examples/integrations/litellm/README.md +1 -1
- {context_compiler-0.7.2 → context_compiler-0.7.3}/examples/integrations/litellm_proxy/README.md +1 -1
- {context_compiler-0.7.2 → context_compiler-0.7.3}/examples/integrations/openwebui/README.md +5 -5
- {context_compiler-0.7.2 → context_compiler-0.7.3}/experimental/preprocessor/README.md +5 -5
- {context_compiler-0.7.2 → context_compiler-0.7.3}/pyproject.toml +1 -1
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/README.md +12 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/api/public-api-v1.json +2 -1
- context_compiler-0.7.3/tests/fixtures/conformance/checkpoint/008_export_checkpoint_json_wrapper_shape.json +38 -0
- context_compiler-0.7.3/tests/fixtures/conformance/checkpoint/009_import_checkpoint_json_restores_authoritative_state_no_pending.json +39 -0
- context_compiler-0.7.3/tests/fixtures/conformance/checkpoint/010_checkpoint_json_round_trip_state_and_pending_parity.json +37 -0
- context_compiler-0.7.3/tests/fixtures/conformance/checkpoint/011_pending_clarification_through_checkpoint_json_restore_yes_resolution.json +45 -0
- context_compiler-0.7.3/tests/fixtures/conformance/checkpoint/012_import_checkpoint_json_malformed_rejected.json +25 -0
- context_compiler-0.7.3/tests/fixtures/conformance/checkpoint/013_import_checkpoint_json_invalid_shape_rejected.json +25 -0
- context_compiler-0.7.3/tests/fixtures/conformance/checkpoint/014_import_checkpoint_json_invalid_authoritative_state_rejected.json +25 -0
- context_compiler-0.7.3/tests/fixtures/conformance/checkpoint/015_import_checkpoint_json_invalid_payload_is_all_or_nothing.json +42 -0
- context_compiler-0.7.3/tests/fixtures/conformance/controller/001_step_update_envelope_and_state_snapshot.json +39 -0
- context_compiler-0.7.3/tests/fixtures/conformance/controller/002_preview_mutating_update_reports_would_mutate_and_no_live_mutation.json +58 -0
- context_compiler-0.7.3/tests/fixtures/conformance/controller/003_preview_idempotent_update_reports_non_mutating.json +69 -0
- context_compiler-0.7.3/tests/fixtures/conformance/controller/004_preview_clarify_reports_non_mutating_and_restores_pending.json +54 -0
- context_compiler-0.7.3/tests/fixtures/conformance/controller/005_preview_pending_yes_reports_mutation_but_preserves_live_pending.json +67 -0
- context_compiler-0.7.3/tests/fixtures/conformance/controller/006_state_diff_structural_changes.json +52 -0
- context_compiler-0.7.3/tests/fixtures/preprocessor/parse-canonical-directive-prohibit-peanuts.json +6 -0
- context_compiler-0.7.3/tests/fixtures/preprocessor/parse-malformed-near-miss-rejected.json +6 -0
- context_compiler-0.7.3/tests/fixtures/preprocessor/parse-multiple-directives-rejected.json +6 -0
- context_compiler-0.7.3/tests/fixtures/preprocessor/parse-no-directive-sentinel.json +6 -0
- context_compiler-0.7.3/tests/fixtures/preprocessor/parse-source-input-structured-json-directive-self-accepted.json +7 -0
- context_compiler-0.7.3/tests/fixtures/preprocessor/parse-unknown-directive-like-rejected.json +6 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_fixtures.py +59 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/uv.lock +1 -1
- {context_compiler-0.7.2 → context_compiler-0.7.3}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/.github/pull_request_template.md +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/.github/workflows/ci.yml +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/.github/workflows/publish-pypi.yml +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/.github/workflows/stress-tests.yml +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/.gitignore +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/.pre-commit-config.yaml +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/CODE_OF_CONDUCT.md +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/CONTRIBUTING.md +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/LICENSE +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/SECURITY.md +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/demos/01_llm_contradiction_clarify.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/demos/02_llm_constraint_guardrail.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/demos/03_llm_premise_guardrail.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/demos/04_llm_tool_denylist_guardrail.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/demos/05_llm_prompt_drift_vs_state.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/demos/06_llm_context_compaction.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/demos/07_llm_prompt_vs_state.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/demos/08_llm_replacement_precondition.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/demos/09_llm_pending_clarification.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/demos/README.md +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/demos/__init__.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/demos/common.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/demos/llm_client.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/demos/run_demo.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/docs/DirectiveGrammarSpec.md +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/docs/README.md +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/docs/demos-results.md +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/evals/litellm_proxy_additional_findings.md +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/evals/litellm_proxy_behavioral_comparisons.md +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/evals/swe-bench/README.md +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/evals/swe-bench/RUBRIC.md +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/evals/swe-bench/manifest.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/evals/swe-bench/swe-bench.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/evals/swe-bench/tasks/django__django-12453.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/evals/swe-bench/tasks/django__django-13158.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/evals/swe-bench/tasks/django__django-13964.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/evals/swe-bench/tasks/django__django-15252.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/evals/swe-bench/tasks/matplotlib__matplotlib-23299.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/evals/swe-bench/tasks/psf__requests-1963.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/examples/01_persistent_guardrails.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/examples/02_configuration_and_correction.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/examples/03_ambiguity_with_clarification.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/examples/04_tool_governance_denylist.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/examples/05_llm_integration_pattern.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/examples/06_transcript_replay.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/examples/07_single_policy_correction.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/examples/README.md +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/examples/_util.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/examples/integrations/litellm/basic.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/examples/integrations/litellm/with_preprocessor.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/examples/integrations/litellm_proxy/config.example.yaml +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/examples/integrations/litellm_proxy/context_compiler_precall_hook.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/examples/integrations/litellm_proxy/context_compiler_precall_hook_with_preprocessor.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/examples/integrations/openwebui/open_webui_pipe.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/examples/integrations/openwebui/open_webui_pipe_with_preprocessor.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/experimental/__init__.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/experimental/preprocessor/__init__.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/experimental/preprocessor/constants.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/experimental/preprocessor/heuristic_preprocessor.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/experimental/preprocessor/output_validation.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/experimental/preprocessor/prompt_utils.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/experimental/preprocessor/prompts/default.txt +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/experimental/preprocessor/prompts/llama.txt +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/host_support/__init__.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/host_support/confirmation.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/host_support/provider_mode.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/src/context_compiler/__init__.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/src/context_compiler/const.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/src/context_compiler/controller.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/src/context_compiler/decision_constants.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/src/context_compiler/engine.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/src/context_compiler/observability.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/src/context_compiler/repl.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/checkpoint/001_import_checkpoint_non_object_rejected.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/checkpoint/002_import_checkpoint_unsupported_version_rejected.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/checkpoint/003_import_checkpoint_invalid_pending_shape_rejected.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/checkpoint/004_import_checkpoint_invalid_replacement_shape_rejected.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/checkpoint/005_import_checkpoint_invalid_authoritative_state_rejected_atomically.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/checkpoint/006_import_checkpoint_pending_null_clears_existing_pending.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/checkpoint/007_import_checkpoint_pending_absent_clears_existing_pending.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/state-json/001_export_json_canonical_sorted_compact.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/state-json/002_import_json_invalid_json_rejected.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/state-json/003_import_json_non_object_rejected.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/state-json/004_import_json_unsupported_version_rejected.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/state-json/005_import_json_empty_normalized_policy_key_rejected_atomically.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/state-json/006_import_json_valid_normalized_policy_key_accepted.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/step/001_set_premise_update.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/step/002_use_item_normalization.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/step/003_conflict_prohibit_clarify.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/step/004_remove_policy_missing_idempotent_update.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/step/005_exact_prefix_passthrough_leading_space.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/step/006_near_miss_set_premise_to.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/step/007_near_miss_change_premise_missing_to.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/step/008_replace_missing_source_clarify_prompt.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/step/009_pending_affirmative_normalized_token.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/step/010_pending_negative_normalized_token.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/step/011_pending_unmatched_reuses_prompt.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/step/012_clear_premise_populated_update.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/step/013_clear_premise_already_null_update.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/step/014_reset_policies_populated_update.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/step/015_reset_policies_already_empty_update.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/step/016_clear_state_populated_update.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/step/017_clear_state_already_empty_update.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/step/018_pending_affirmative_punctuation_token.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/step/019_pending_negative_punctuation_token.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/transcript/001_user_only_replay_state.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/transcript/002_non_string_user_content_ignored.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/transcript/003_stops_at_first_clarify_later_yes.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/conformance/transcript/004_stops_at_first_clarify_later_no.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/controller/preview_clarify_no_mutation.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/controller/preview_idempotent_no_mutation.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/engine-regression/structured/README.md +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/engine-regression/structured/expected/contradiction_clarify.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/engine-regression/structured/expected/pending_clarify_no.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/engine-regression/structured/expected/pending_clarify_unmatched.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/engine-regression/structured/expected/pending_clarify_yes.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/engine-regression/structured/expected/premise_lifecycle.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/engine-regression/structured/expected/replacement_clarify.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/engine-regression/structured/scenarios/contradiction_clarify.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/engine-regression/structured/scenarios/pending_clarify_no.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/engine-regression/structured/scenarios/pending_clarify_unmatched.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/engine-regression/structured/scenarios/pending_clarify_yes.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/engine-regression/structured/scenarios/premise_lifecycle.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/engine-regression/structured/scenarios/replacement_clarify.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/admin-alias-remove-policies-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/admin-alias-reset-policy-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/ambiguous-directive-adjacent.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/canonical-directive-bracket-wrapper.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/canonical-directive-case-normalized-use-docker.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/canonical-directive-clear-state-period.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/canonical-directive-clear-state.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/canonical-directive-paren-wrapper.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/canonical-directive-prohibit-peanuts.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/canonical-directive-quoted-payload-use-docker.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/canonical-directive-reset-policies-bang.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/canonical-directive-whitespace-collapsed-use-docker.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/fenced-code-block-directive-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/inline-prose-code-directive-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/list-prefix-directive-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/malformed-replacement-instead-docker-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/meta-prefix-directive-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/mixed-directive-task-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/mixed-intent-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/modal-please-clear-state-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/multiline-multi-directive-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/natural-language-dont-use-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/near-miss-change-premise-missing-to-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/near-miss-change-premise-to-empty-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/near-miss-prohibit-empty-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/near-miss-remove-policy-empty-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/near-miss-set-premise-empty-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/near-miss-set-premise-to-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/near-miss-use-empty-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/near-miss-use-instead-of-missing-new-item-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/near-miss-use-instead-of-missing-old-item-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/nested-wrapper-clear-state-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/ordinary-non-directive.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/parse-source-input-fenced-code-rejected.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/parse-source-input-inline-prose-code-rejected.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/parse-source-input-mixed-directive-task-rejected.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/parse-source-input-multiline-rejected.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/parse-source-input-question-form-rejected.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/parse-source-input-quoted-payload-locked.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/parse-source-input-reported-speech-rejected.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/parse-source-input-safe-canonical-use-docker.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/parse-source-input-safe-canonicalization-use-docker.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/public-api-v1.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/question-can-you-use-docker-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/question-use-docker-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/quoted-exact-use-docker-backtick-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/quoted-exact-use-docker-single-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/quoted-exact-use-docker-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/quoted-reported-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/reported-speech-docs-say-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/sentence-adjacent-directive-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/unsupported-alias-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/validator-invalid-json-shape-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/validator-malformed-json-text-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/validator-malformed-sentinel-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/validator-malformed-text-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/validator-multi-candidate-directive-unknown.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/validator-sentinel-no-directive.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/validator-source-input-allow-safe-directive.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/validator-source-input-block-change-premise-rewrite.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/validator-source-input-block-set-premise-rewrite.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/fixtures/preprocessor/validator-structured-json-directive.json +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_04_grammar_edge_cases.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_04_llm_tool_governance.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_07_llm_prompt_engineering_comparison.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_api_contract_fixture.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_controller.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_decision_constants.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_demo_01_04_behavior.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_demo_05_prompt_contract.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_demo_07_output_clarity.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_demo_08_09_behavior.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_demo_compaction.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_demo_oracle_properties.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_engine.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_example_integrations_imports.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_examples.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_examples_behavior.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_examples_smoke.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_host_confirmation.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_host_observability.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_litellm_checkpoint_integration.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_litellm_integration_error_paths.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_litellm_preprocessor_model_config.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_llm_client.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_llm_demos.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_openwebui_pipe.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_openwebui_preprocessor_pipe.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_precompiler_prompt_utils.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_preprocessor_api_contract_fixture.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_preprocessor_conformance.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_preprocessor_heuristic.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_preprocessor_heuristic_properties.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_preprocessor_output_validation.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_preprocessor_validator_properties.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_properties.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_provider_helper.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_repl.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_repl_coverage.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_repl_properties.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_run_demo.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_smoke.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_structured_regression.py +0 -0
- {context_compiler-0.7.2 → context_compiler-0.7.3}/tests/test_transcript_replay.py +0 -0
|
@@ -75,6 +75,7 @@ Prefer modern typing syntax:
|
|
|
75
75
|
|
|
76
76
|
## PR guidance
|
|
77
77
|
- Never open or merge a PR targeting `main` from `main`; always use a feature branch.
|
|
78
|
+
- Always use the repository PR template when creating or updating PR descriptions.
|
|
78
79
|
- PR titles must use the same format as commits: `<type>: <summary>`.
|
|
79
80
|
- PR descriptions should include:
|
|
80
81
|
- what changed
|
|
@@ -82,6 +83,11 @@ Prefer modern typing syntax:
|
|
|
82
83
|
- Do not include a dedicated "Validation" section in PR text.
|
|
83
84
|
- Keep PR scope aligned to the requested task; if scope grows, ask for guidance before expanding.
|
|
84
85
|
|
|
86
|
+
## Issue guidance
|
|
87
|
+
- Always use the repository issue templates when creating or updating issues.
|
|
88
|
+
- Use `bug_report` for defects and regressions.
|
|
89
|
+
- Use `feature_request` for new capabilities or enhancements.
|
|
90
|
+
|
|
85
91
|
## CI
|
|
86
92
|
Do not modify GitHub CI workflows unless explicitly asked.
|
|
87
93
|
|
|
@@ -105,6 +111,10 @@ Prefer plain, concrete wording when accurate. Examples:
|
|
|
105
111
|
|
|
106
112
|
Avoid describing features only in architectural terms when a behavior-first explanation is possible.
|
|
107
113
|
|
|
114
|
+
Prefer direct subjects and strong verbs.
|
|
115
|
+
Avoid noun stacks and passive phrasing when a simpler active sentence is clearer.
|
|
116
|
+
Use simpler wording unless technical precision requires formal terminology.
|
|
117
|
+
|
|
108
118
|
Specification and contract documents are different:
|
|
109
119
|
- preserve precise terminology
|
|
110
120
|
- preserve unambiguous behavioral guarantees
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: context-compiler
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.3
|
|
4
4
|
Summary: Deterministic conversational state engine for LLM applications.
|
|
5
5
|
Project-URL: Homepage, https://github.com/rlippmann/context-compiler
|
|
6
6
|
Project-URL: Repository, https://github.com/rlippmann/context-compiler
|
|
@@ -40,11 +40,11 @@ Description-Content-Type: text/markdown
|
|
|
40
40
|
[](https://pypi.org/project/context-compiler/)
|
|
41
41
|
[](https://pypi.org/project/context-compiler/)
|
|
42
42
|
|
|
43
|
-
Some behaviors require explicit host-side state
|
|
43
|
+
Some behaviors require explicit host-side state handling.
|
|
44
44
|
|
|
45
45
|
Context Compiler is a deterministic host-side state layer for LLM applications.
|
|
46
|
-
It
|
|
47
|
-
|
|
46
|
+
It applies explicit premise and policy updates so state changes stay fixed and
|
|
47
|
+
repeatable.
|
|
48
48
|
|
|
49
49
|
## What prompting and reinjection can do
|
|
50
50
|
|
|
@@ -59,17 +59,17 @@ pending confirmations from checkpoints.
|
|
|
59
59
|
## What prompting cannot do by itself
|
|
60
60
|
|
|
61
61
|
Prompt text (including reinjected state text) helps, but it does not give your
|
|
62
|
-
app
|
|
62
|
+
app clear rules for when state can change. By itself, it does not provide:
|
|
63
63
|
|
|
64
64
|
- rules your app controls for state changes
|
|
65
65
|
- replacement precondition checks (`use X instead of Y` when `Y` may be absent)
|
|
66
66
|
- confirmation flows that must complete before anything else changes
|
|
67
|
-
- clear
|
|
67
|
+
- clear rules for when to block a change
|
|
68
68
|
- reliable checkpoint restore for both saved state and pending confirmation flow
|
|
69
69
|
|
|
70
70
|
## What Context Compiler provides
|
|
71
71
|
|
|
72
|
-
Context Compiler provides fixed host-side state
|
|
72
|
+
Context Compiler provides fixed host-side state handling:
|
|
73
73
|
|
|
74
74
|
- deterministic directive handling for explicit user state changes
|
|
75
75
|
- clarification instead of silent overwrite for blocked/ambiguous changes
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
[](https://pypi.org/project/context-compiler/)
|
|
5
5
|
[](https://pypi.org/project/context-compiler/)
|
|
6
6
|
|
|
7
|
-
Some behaviors require explicit host-side state
|
|
7
|
+
Some behaviors require explicit host-side state handling.
|
|
8
8
|
|
|
9
9
|
Context Compiler is a deterministic host-side state layer for LLM applications.
|
|
10
|
-
It
|
|
11
|
-
|
|
10
|
+
It applies explicit premise and policy updates so state changes stay fixed and
|
|
11
|
+
repeatable.
|
|
12
12
|
|
|
13
13
|
## What prompting and reinjection can do
|
|
14
14
|
|
|
@@ -23,17 +23,17 @@ pending confirmations from checkpoints.
|
|
|
23
23
|
## What prompting cannot do by itself
|
|
24
24
|
|
|
25
25
|
Prompt text (including reinjected state text) helps, but it does not give your
|
|
26
|
-
app
|
|
26
|
+
app clear rules for when state can change. By itself, it does not provide:
|
|
27
27
|
|
|
28
28
|
- rules your app controls for state changes
|
|
29
29
|
- replacement precondition checks (`use X instead of Y` when `Y` may be absent)
|
|
30
30
|
- confirmation flows that must complete before anything else changes
|
|
31
|
-
- clear
|
|
31
|
+
- clear rules for when to block a change
|
|
32
32
|
- reliable checkpoint restore for both saved state and pending confirmation flow
|
|
33
33
|
|
|
34
34
|
## What Context Compiler provides
|
|
35
35
|
|
|
36
|
-
Context Compiler provides fixed host-side state
|
|
36
|
+
Context Compiler provides fixed host-side state handling:
|
|
37
37
|
|
|
38
38
|
- deterministic directive handling for explicit user state changes
|
|
39
39
|
- clarification instead of silent overwrite for blocked/ambiguous changes
|
|
@@ -10,9 +10,9 @@ conversations, and state can conflict over time.
|
|
|
10
10
|
This project adds a deterministic state layer that is independent of the model.
|
|
11
11
|
The model handles interpretation and generation; the engine handles premise and
|
|
12
12
|
policies. Only explicit user directives can change state.
|
|
13
|
-
|
|
14
|
-
without
|
|
15
|
-
|
|
13
|
+
When the model reasons and the engine owns state, behavior stays reliable
|
|
14
|
+
without retraining the model. The system never derives authoritative state from
|
|
15
|
+
model responses.
|
|
16
16
|
The goal is not to make the model smarter, but to make interactions
|
|
17
17
|
predictable: once a statement is corrected or scoped, future responses
|
|
18
18
|
must respect that change.
|
|
@@ -64,7 +64,7 @@ After correcting or constraining the assistant once, the behavior remains consis
|
|
|
64
64
|
### M3 — Cross-Session Recall (implemented, engine-level / host-enabled)
|
|
65
65
|
|
|
66
66
|
**Goal**
|
|
67
|
-
|
|
67
|
+
Help apps safely reuse saved exported state.
|
|
68
68
|
|
|
69
69
|
**Core capability:**
|
|
70
70
|
|
|
@@ -77,8 +77,8 @@ Extend app-level workflows around persisted exported state safely and intentiona
|
|
|
77
77
|
|
|
78
78
|
**Deliverables:**
|
|
79
79
|
|
|
80
|
-
- App-side storage
|
|
81
|
-
- App-side storage
|
|
80
|
+
- App-side storage and recovery patterns built on the existing import/export API
|
|
81
|
+
- App-side storage and recovery patterns for checkpoint object and checkpoint JSON restore
|
|
82
82
|
|
|
83
83
|
**User-visible outcome:**
|
|
84
84
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## The Problem with Implicit State
|
|
4
4
|
|
|
5
|
-
Modern LLM applications
|
|
5
|
+
Modern LLM applications often manage conversational state implicitly: the model reads the transcript, infers active constraints, and generates a response. This works well for short conversations and simple tasks.
|
|
6
6
|
|
|
7
7
|
It breaks down reliably in longer conversations, correction flows, and multi-turn constraint management. Constraints drift. Corrections get partially applied or treated as additive rather than authoritative replacements. Contradictions accumulate instead of resolving. The model interprets intent rather than enforcing it.
|
|
8
8
|
|
|
@@ -16,7 +16,7 @@ Explicit state management is not a new idea. Earlier AI systems maintained struc
|
|
|
16
16
|
|
|
17
17
|
The core insight is simple: maintain an explicit active set of rules rather than inferring the relevant context from history each time. What is in the active set is known with certainty. What is not in it is not active.
|
|
18
18
|
|
|
19
|
-
These approaches succeeded in narrow, well-defined domains
|
|
19
|
+
These approaches succeeded in narrow, well-defined domains because explicit state gives guarantees that implicit inference cannot. The limitation was not state management itself. Handling natural language and ambiguity was the hard part, and that work consumed most of the design effort.
|
|
20
20
|
|
|
21
21
|
Modern LLMs handle natural language interpretation and generation far more effectively than earlier systems. This changes the calculus: the language interface problem is largely addressed. As end-to-end neural approaches became dominant, many systems shifted toward transcript-driven implicit state management, assuming a capable model could handle state implicitly.
|
|
22
22
|
|
|
@@ -26,8 +26,8 @@ That assumption is incorrect in practice, for the structural reason described ab
|
|
|
26
26
|
|
|
27
27
|
Context Compiler applies explicit state management to the modern LLM context, with a clear division of responsibilities:
|
|
28
28
|
|
|
29
|
-
- The LLM handles what it
|
|
30
|
-
- The deterministic engine handles what probabilistic systems handle poorly
|
|
29
|
+
- The LLM handles what it does well: language understanding, reasoning, generation, and ambiguity in user intent
|
|
30
|
+
- The deterministic engine handles what probabilistic systems handle poorly: keep explicit state across turns, enforce constraints, and make corrections replace prior state instead of competing with it
|
|
31
31
|
|
|
32
32
|
The preprocessor layer bridges the two: it uses the LLM's language understanding to translate natural language directive intent into canonical form, which the deterministic engine can then process reliably. Fuzzy where it needs to be fuzzy, deterministic where determinism matters.
|
|
33
33
|
|
|
@@ -15,8 +15,7 @@ layer. Do not rely on repo-relative preprocessor paths.
|
|
|
15
15
|
|
|
16
16
|
## Architectural framing
|
|
17
17
|
|
|
18
|
-
The preprocessor
|
|
19
|
-
state changes.
|
|
18
|
+
The preprocessor helps your app, but it does not own state changes.
|
|
20
19
|
|
|
21
20
|
Model/tool-description translation can help with simple direct cases, but
|
|
22
21
|
integrations should not rely on model intent translation alone to decide when
|
|
@@ -25,10 +24,10 @@ state changes.
|
|
|
25
24
|
In simpler hosts without an embedded model, this preprocessor provides a
|
|
26
25
|
conservative translation path.
|
|
27
26
|
|
|
28
|
-
In model-assisted hosts, the app still
|
|
27
|
+
In model-assisted hosts, the app still validates outputs before applying them.
|
|
29
28
|
|
|
30
29
|
Both paths send canonical directives to the same deterministic engine. The
|
|
31
|
-
engine
|
|
30
|
+
engine controls state updates.
|
|
32
31
|
|
|
33
32
|
In MCP/tool-calling environments, over-eager tool calling on conversational or
|
|
34
33
|
ambiguous input is a known failure mode. Conservative preprocessing and
|
|
@@ -36,7 +35,7 @@ validation help reduce unintended mutation.
|
|
|
36
35
|
|
|
37
36
|
## Required flow
|
|
38
37
|
|
|
39
|
-
Recommended
|
|
38
|
+
Recommended flow:
|
|
40
39
|
|
|
41
40
|
1. heuristic preprocessing
|
|
42
41
|
2. validate candidate output
|
|
@@ -73,7 +73,7 @@ Introduce multiple engines only when you need **independent lifecycle or isolati
|
|
|
73
73
|
## Combining Policies from Multiple Sources
|
|
74
74
|
|
|
75
75
|
If you need to combine constraints from separate sources, do it explicitly in
|
|
76
|
-
host code
|
|
76
|
+
host code: replay directives through `step(...)` into a target engine.
|
|
77
77
|
|
|
78
78
|
Pattern:
|
|
79
79
|
|
|
@@ -81,5 +81,5 @@ Pattern:
|
|
|
81
81
|
2. Replay each directive via `engine.step(...)`
|
|
82
82
|
3. Handle any returned `clarify` decisions explicitly
|
|
83
83
|
|
|
84
|
-
This keeps conflict handling in normal engine
|
|
85
|
-
|
|
84
|
+
This keeps conflict handling in normal engine behavior and avoids adding merge
|
|
85
|
+
rules to core state APIs.
|
|
@@ -29,7 +29,7 @@ See the LiteLLM examples README for setup and usage:
|
|
|
29
29
|
- Context Compiler runs before each LLM call.
|
|
30
30
|
- If result is `clarify`, show the question and do not call the LLM.
|
|
31
31
|
- If result is `passthrough`, send normal user input.
|
|
32
|
-
- If result is `update`, use updated state and call the model with saved state
|
|
32
|
+
- If result is `update`, use updated state and call the model with saved state in the prompt.
|
|
33
33
|
|
|
34
34
|
## LiteLLM Proxy
|
|
35
35
|
|
|
@@ -105,7 +105,7 @@ Use `llama` only for LLM-only preprocessing with Llama-family models.
|
|
|
105
105
|
|
|
106
106
|
## Usage pattern
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
You can import these files as integration references in host applications.
|
|
109
109
|
|
|
110
110
|
- Import `handle_turn(...)` from either `basic.py` or `with_preprocessor.py`.
|
|
111
111
|
- Create and retain an engine instance in host/session state.
|
{context_compiler-0.7.2 → context_compiler-0.7.3}/examples/integrations/litellm_proxy/README.md
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# LiteLLM Proxy (pre-call hook)
|
|
2
2
|
|
|
3
3
|
This example shows how to run Context Compiler inside a LiteLLM proxy pre-call hook.
|
|
4
|
-
The hook applies fixed state
|
|
4
|
+
The hook applies fixed state rules before any upstream model call.
|
|
5
5
|
|
|
6
6
|
Available hook files:
|
|
7
7
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Open WebUI Pipe Integration
|
|
2
2
|
|
|
3
|
-
Examples of Open WebUI Pipe Functions that
|
|
3
|
+
Examples of Open WebUI Pipe Functions that use Context Compiler.
|
|
4
4
|
|
|
5
5
|
Tested target: Open WebUI `v0.8.12` (latest at time of testing).
|
|
6
|
-
|
|
6
|
+
Validated at runtime on stock Docker Open WebUI with a real backend model provider.
|
|
7
7
|
|
|
8
8
|
Compatibility note: OpenWebUI `0.9.x` changed `Users.get_user_by_id` to async.
|
|
9
9
|
These examples support both sync (`0.8.x`) and async (`0.9.x`) user lookup.
|
|
@@ -49,11 +49,11 @@ If using `open_webui_pipe_with_preprocessor.py`:
|
|
|
49
49
|
- Optional: set `PREPROCESSOR_MODEL_ID` to route fallback precompilation through
|
|
50
50
|
a separate model. If unset, fallback uses `BASE_MODEL_ID`.
|
|
51
51
|
- Fallback routing is Open WebUI-native (no LiteLLM dependency for this pipe).
|
|
52
|
-
- The heuristic preprocessor is intentionally conservative
|
|
52
|
+
- The heuristic preprocessor is intentionally conservative and high-precision, and
|
|
53
53
|
may abstain on mixed-prose natural language (for example, `i think we should
|
|
54
54
|
use docker`). In those cases, behavior may remain passthrough unless fallback
|
|
55
55
|
precompilation returns a validated canonical directive.
|
|
56
|
-
-
|
|
56
|
+
- If you configure invalid model ids, the pipe returns explicit runtime errors:
|
|
57
57
|
- `BASE_MODEL_ID` not found in Open WebUI models
|
|
58
58
|
- `PREPROCESSOR_MODEL_ID` not found in Open WebUI models
|
|
59
59
|
|
|
@@ -80,7 +80,7 @@ Use the Open WebUI model picker/list to copy exact model ids for `BASE_MODEL_ID`
|
|
|
80
80
|
- No Redis/DB/external storage.
|
|
81
81
|
- No Filters or Pipelines.
|
|
82
82
|
- No production hardening.
|
|
83
|
-
-
|
|
83
|
+
- Tied to Open WebUI internal helper/import paths by version.
|
|
84
84
|
|
|
85
85
|
## Manual Validation
|
|
86
86
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Experimental Preprocessor Package
|
|
2
2
|
|
|
3
|
-
This package provides optional
|
|
4
|
-
Compiler
|
|
3
|
+
This package provides optional preprocessing helpers for app integrations with
|
|
4
|
+
Context Compiler.
|
|
5
5
|
|
|
6
6
|
It is experimental and separate from the deterministic core engine in `src/`.
|
|
7
7
|
|
|
8
|
-
Model
|
|
9
|
-
model output is not safe
|
|
8
|
+
Model or tool-description translation can help in simple direct cases, but raw
|
|
9
|
+
model output is not safe for state changes on its own. The app must validate
|
|
10
10
|
outputs before applying them.
|
|
11
11
|
|
|
12
12
|
In MCP/tool-calling environments, over-eager tool calling on conversational or
|
|
@@ -65,7 +65,7 @@ Raw preprocessor/LLM outputs must not be passed directly to the compiler.
|
|
|
65
65
|
Raw model output must never directly change state.
|
|
66
66
|
|
|
67
67
|
The preprocessor does not expand directive grammar. It may emit only validated
|
|
68
|
-
canonical directives
|
|
68
|
+
canonical directives that the compiler accepts.
|
|
69
69
|
|
|
70
70
|
Conservative boundary policy:
|
|
71
71
|
|
|
@@ -73,6 +73,18 @@ Portable checkpoint import contract coverage for
|
|
|
73
73
|
`engine.import_checkpoint(...)`, including deterministic validation/error
|
|
74
74
|
boundaries, atomic failure behavior, and pending-clarification clearing semantics.
|
|
75
75
|
|
|
76
|
+
## Controller fixtures
|
|
77
|
+
|
|
78
|
+
For [`conformance/controller/`](conformance/controller/):
|
|
79
|
+
|
|
80
|
+
Portable controller contract coverage for:
|
|
81
|
+
|
|
82
|
+
* `step(engine, user_input)` result envelope and state snapshot
|
|
83
|
+
* `preview(engine, user_input)` result envelope, `would_mutate`, and non-mutation of live engine state
|
|
84
|
+
* `state_diff(state_before, state_after)` deterministic structural diff output
|
|
85
|
+
|
|
86
|
+
These fixtures keep a minimal, language-neutral contract matrix for controller APIs.
|
|
87
|
+
|
|
76
88
|
## Source of truth
|
|
77
89
|
|
|
78
90
|
Fixtures reflect current Python behavior and tests.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "checkpoint_export_checkpoint_json_wrapper_shape",
|
|
3
|
+
"kind": "checkpoint",
|
|
4
|
+
"initial_state": {
|
|
5
|
+
"premise": null,
|
|
6
|
+
"policies": {},
|
|
7
|
+
"version": 2
|
|
8
|
+
},
|
|
9
|
+
"prelude": [
|
|
10
|
+
"set premise concise replies",
|
|
11
|
+
"use docker"
|
|
12
|
+
],
|
|
13
|
+
"action": {
|
|
14
|
+
"fn": "export_checkpoint_json"
|
|
15
|
+
},
|
|
16
|
+
"expected": {
|
|
17
|
+
"payload_json_parseable": true,
|
|
18
|
+
"payload_object": {
|
|
19
|
+
"checkpoint_version": 1,
|
|
20
|
+
"authoritative_state": {
|
|
21
|
+
"premise": "concise replies",
|
|
22
|
+
"policies": {
|
|
23
|
+
"docker": "use"
|
|
24
|
+
},
|
|
25
|
+
"version": 2
|
|
26
|
+
},
|
|
27
|
+
"pending": null
|
|
28
|
+
},
|
|
29
|
+
"has_pending_clarification": false,
|
|
30
|
+
"state": {
|
|
31
|
+
"premise": "concise replies",
|
|
32
|
+
"policies": {
|
|
33
|
+
"docker": "use"
|
|
34
|
+
},
|
|
35
|
+
"version": 2
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "checkpoint_import_checkpoint_json_restores_authoritative_state_no_pending",
|
|
3
|
+
"kind": "checkpoint",
|
|
4
|
+
"initial_state": {
|
|
5
|
+
"premise": null,
|
|
6
|
+
"policies": {},
|
|
7
|
+
"version": 2
|
|
8
|
+
},
|
|
9
|
+
"action": {
|
|
10
|
+
"fn": "import_checkpoint_json",
|
|
11
|
+
"payload": "{\"authoritative_state\":{\"policies\":{\"pytest\":\"use\"},\"premise\":\"baseline\",\"version\":2},\"checkpoint_version\":1,\"pending\":null}"
|
|
12
|
+
},
|
|
13
|
+
"expected": {
|
|
14
|
+
"has_pending_clarification": false,
|
|
15
|
+
"state": {
|
|
16
|
+
"premise": "baseline",
|
|
17
|
+
"policies": {
|
|
18
|
+
"pytest": "use"
|
|
19
|
+
},
|
|
20
|
+
"version": 2
|
|
21
|
+
},
|
|
22
|
+
"followup": {
|
|
23
|
+
"input": "yes",
|
|
24
|
+
"decision": {
|
|
25
|
+
"kind": "passthrough",
|
|
26
|
+
"state": null,
|
|
27
|
+
"prompt_to_user": null
|
|
28
|
+
},
|
|
29
|
+
"state": {
|
|
30
|
+
"premise": "baseline",
|
|
31
|
+
"policies": {
|
|
32
|
+
"pytest": "use"
|
|
33
|
+
},
|
|
34
|
+
"version": 2
|
|
35
|
+
},
|
|
36
|
+
"has_pending_clarification": false
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "checkpoint_checkpoint_json_round_trip_state_and_pending_parity",
|
|
3
|
+
"kind": "checkpoint",
|
|
4
|
+
"initial_state": {
|
|
5
|
+
"premise": null,
|
|
6
|
+
"policies": {},
|
|
7
|
+
"version": 2
|
|
8
|
+
},
|
|
9
|
+
"prelude": [
|
|
10
|
+
"use kubectl instead of docker"
|
|
11
|
+
],
|
|
12
|
+
"action": {
|
|
13
|
+
"fn": "checkpoint_json_round_trip"
|
|
14
|
+
},
|
|
15
|
+
"expected": {
|
|
16
|
+
"state": {
|
|
17
|
+
"premise": null,
|
|
18
|
+
"policies": {},
|
|
19
|
+
"version": 2
|
|
20
|
+
},
|
|
21
|
+
"has_pending_clarification": true,
|
|
22
|
+
"followup": {
|
|
23
|
+
"input": "maybe",
|
|
24
|
+
"decision": {
|
|
25
|
+
"kind": "clarify",
|
|
26
|
+
"state": null,
|
|
27
|
+
"prompt_to_user": "Did you mean to use \"kubectl\" instead?"
|
|
28
|
+
},
|
|
29
|
+
"state": {
|
|
30
|
+
"premise": null,
|
|
31
|
+
"policies": {},
|
|
32
|
+
"version": 2
|
|
33
|
+
},
|
|
34
|
+
"has_pending_clarification": true
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "checkpoint_pending_clarification_through_checkpoint_json_restore_yes_resolution",
|
|
3
|
+
"kind": "checkpoint",
|
|
4
|
+
"initial_state": {
|
|
5
|
+
"premise": null,
|
|
6
|
+
"policies": {},
|
|
7
|
+
"version": 2
|
|
8
|
+
},
|
|
9
|
+
"prelude": [
|
|
10
|
+
"use kubectl instead of docker"
|
|
11
|
+
],
|
|
12
|
+
"action": {
|
|
13
|
+
"fn": "checkpoint_json_round_trip"
|
|
14
|
+
},
|
|
15
|
+
"expected": {
|
|
16
|
+
"state": {
|
|
17
|
+
"premise": null,
|
|
18
|
+
"policies": {},
|
|
19
|
+
"version": 2
|
|
20
|
+
},
|
|
21
|
+
"has_pending_clarification": true,
|
|
22
|
+
"followup": {
|
|
23
|
+
"input": "yes",
|
|
24
|
+
"decision": {
|
|
25
|
+
"kind": "update",
|
|
26
|
+
"state": {
|
|
27
|
+
"premise": null,
|
|
28
|
+
"policies": {
|
|
29
|
+
"kubectl": "use"
|
|
30
|
+
},
|
|
31
|
+
"version": 2
|
|
32
|
+
},
|
|
33
|
+
"prompt_to_user": null
|
|
34
|
+
},
|
|
35
|
+
"state": {
|
|
36
|
+
"premise": null,
|
|
37
|
+
"policies": {
|
|
38
|
+
"kubectl": "use"
|
|
39
|
+
},
|
|
40
|
+
"version": 2
|
|
41
|
+
},
|
|
42
|
+
"has_pending_clarification": false
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "checkpoint_import_checkpoint_json_malformed_rejected",
|
|
3
|
+
"kind": "checkpoint",
|
|
4
|
+
"initial_state": {
|
|
5
|
+
"premise": null,
|
|
6
|
+
"policies": {},
|
|
7
|
+
"version": 2
|
|
8
|
+
},
|
|
9
|
+
"action": {
|
|
10
|
+
"fn": "import_checkpoint_json",
|
|
11
|
+
"payload": "{"
|
|
12
|
+
},
|
|
13
|
+
"expected": {
|
|
14
|
+
"error": {
|
|
15
|
+
"type": "ValueError",
|
|
16
|
+
"message_contains": "Invalid JSON payload"
|
|
17
|
+
},
|
|
18
|
+
"has_pending_clarification": false,
|
|
19
|
+
"state": {
|
|
20
|
+
"premise": null,
|
|
21
|
+
"policies": {},
|
|
22
|
+
"version": 2
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "checkpoint_import_checkpoint_json_invalid_shape_rejected",
|
|
3
|
+
"kind": "checkpoint",
|
|
4
|
+
"initial_state": {
|
|
5
|
+
"premise": null,
|
|
6
|
+
"policies": {},
|
|
7
|
+
"version": 2
|
|
8
|
+
},
|
|
9
|
+
"action": {
|
|
10
|
+
"fn": "import_checkpoint_json",
|
|
11
|
+
"payload": "[]"
|
|
12
|
+
},
|
|
13
|
+
"expected": {
|
|
14
|
+
"error": {
|
|
15
|
+
"type": "ValueError",
|
|
16
|
+
"message_contains": "Invalid checkpoint payload"
|
|
17
|
+
},
|
|
18
|
+
"has_pending_clarification": false,
|
|
19
|
+
"state": {
|
|
20
|
+
"premise": null,
|
|
21
|
+
"policies": {},
|
|
22
|
+
"version": 2
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "checkpoint_import_checkpoint_json_invalid_authoritative_state_rejected",
|
|
3
|
+
"kind": "checkpoint",
|
|
4
|
+
"initial_state": {
|
|
5
|
+
"premise": null,
|
|
6
|
+
"policies": {},
|
|
7
|
+
"version": 2
|
|
8
|
+
},
|
|
9
|
+
"action": {
|
|
10
|
+
"fn": "import_checkpoint_json",
|
|
11
|
+
"payload": "{\"checkpoint_version\":1,\"authoritative_state\":{\"premise\":null,\"policies\":[],\"version\":2},\"pending\":null}"
|
|
12
|
+
},
|
|
13
|
+
"expected": {
|
|
14
|
+
"error": {
|
|
15
|
+
"type": "ValueError",
|
|
16
|
+
"message_contains": "Invalid state payload"
|
|
17
|
+
},
|
|
18
|
+
"has_pending_clarification": false,
|
|
19
|
+
"state": {
|
|
20
|
+
"premise": null,
|
|
21
|
+
"policies": {},
|
|
22
|
+
"version": 2
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "checkpoint_import_checkpoint_json_invalid_payload_is_all_or_nothing",
|
|
3
|
+
"kind": "checkpoint",
|
|
4
|
+
"initial_state": {
|
|
5
|
+
"premise": null,
|
|
6
|
+
"policies": {},
|
|
7
|
+
"version": 2
|
|
8
|
+
},
|
|
9
|
+
"prelude": [
|
|
10
|
+
"use kubectl instead of docker"
|
|
11
|
+
],
|
|
12
|
+
"action": {
|
|
13
|
+
"fn": "import_checkpoint_json",
|
|
14
|
+
"payload": "{\"checkpoint_version\":1,\"authoritative_state\":{\"premise\":\"new premise\",\"policies\":{\"pytest\":\"use\"},\"version\":2},\"pending\":{\"kind\":\"replacement\",\"replacement\":{\"kind\":\"use_only\",\"new_item\":\"kubectl\",\"old_item\":\"docker\"},\"prompt_to_user\":\"confirm?\"}}"
|
|
15
|
+
},
|
|
16
|
+
"expected": {
|
|
17
|
+
"error": {
|
|
18
|
+
"type": "ValueError",
|
|
19
|
+
"message_contains": "Invalid checkpoint payload"
|
|
20
|
+
},
|
|
21
|
+
"has_pending_clarification": true,
|
|
22
|
+
"state": {
|
|
23
|
+
"premise": null,
|
|
24
|
+
"policies": {},
|
|
25
|
+
"version": 2
|
|
26
|
+
},
|
|
27
|
+
"followup": {
|
|
28
|
+
"input": "maybe",
|
|
29
|
+
"decision": {
|
|
30
|
+
"kind": "clarify",
|
|
31
|
+
"state": null,
|
|
32
|
+
"prompt_to_user": "Did you mean to use \"kubectl\" instead?"
|
|
33
|
+
},
|
|
34
|
+
"state": {
|
|
35
|
+
"premise": null,
|
|
36
|
+
"policies": {},
|
|
37
|
+
"version": 2
|
|
38
|
+
},
|
|
39
|
+
"has_pending_clarification": true
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|