context-compiler 0.9.0.dev5__tar.gz → 0.9.0.dev6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/PKG-INFO +1 -1
  2. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/pyproject.toml +1 -1
  3. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/src/context_compiler/grammar.py +33 -27
  4. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/.gitignore +0 -0
  5. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/LICENSE +0 -0
  6. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/README.md +0 -0
  7. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/demos/01_llm_contradiction_error.py +0 -0
  8. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/demos/02_llm_constraint_guardrail.py +0 -0
  9. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/demos/03_llm_premise_guardrail.py +0 -0
  10. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/demos/04_llm_tool_denylist_guardrail.py +0 -0
  11. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/demos/05_llm_prompt_drift_vs_state.py +0 -0
  12. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/demos/06_llm_context_compaction.py +0 -0
  13. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/demos/07_llm_prompt_vs_state.py +0 -0
  14. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/demos/08_llm_replacement_precondition.py +0 -0
  15. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/demos/09_llm_confirmation_no_directive.py +0 -0
  16. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/demos/README.md +0 -0
  17. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/demos/__init__.py +0 -0
  18. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/demos/common.py +0 -0
  19. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/demos/llm_client.py +0 -0
  20. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/demos/run_demo.py +0 -0
  21. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/examples/01_persistent_guardrails.py +0 -0
  22. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/examples/02_configuration_and_correction.py +0 -0
  23. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/examples/03_ambiguity_with_error.py +0 -0
  24. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/examples/04_tool_governance_denylist.py +0 -0
  25. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/examples/05_llm_integration_pattern.py +0 -0
  26. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/examples/06_step_sequence_and_state_restore.py +0 -0
  27. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/examples/07_single_policy_correction.py +0 -0
  28. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/examples/README.md +0 -0
  29. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/examples/_util.py +0 -0
  30. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/host_support/__init__.py +0 -0
  31. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/host_support/provider_mode.py +0 -0
  32. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/src/context_compiler/__init__.py +0 -0
  33. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/src/context_compiler/const.py +0 -0
  34. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/src/context_compiler/decision_helpers.py +0 -0
  35. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/src/context_compiler/engine.py +0 -0
  36. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/src/context_compiler/py.typed +0 -0
  37. {context_compiler-0.9.0.dev5 → context_compiler-0.9.0.dev6}/src/context_compiler/repl.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: context-compiler
3
- Version: 0.9.0.dev5
3
+ Version: 0.9.0.dev6
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
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "context-compiler"
7
- version = "0.9.0dev5"
7
+ version = "0.9.0dev6"
8
8
  description = "Deterministic conversational state engine for LLM applications."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -23,7 +23,12 @@ class DirectiveKind(StrEnum):
23
23
 
24
24
  @dataclass(frozen=True, slots=True)
25
25
  class ValidatedDirective:
26
- """Classify text as one canonical directive kind without exposing operands."""
26
+ """Classify accepted input text as one canonical directive kind.
27
+
28
+ ``text`` preserves the accepted input text used for classification rather
29
+ than a canonical rendered representation, so caller casing and formatting
30
+ may remain visible here.
31
+ """
27
32
 
28
33
  text: str
29
34
  kind: DirectiveKind
@@ -31,7 +36,13 @@ class ValidatedDirective:
31
36
 
32
37
  @dataclass(frozen=True, slots=True)
33
38
  class CanonicalDirective:
34
- """Represent one parsed canonical directive and its named operands."""
39
+ """Represent one parsed canonical directive and its named operands.
40
+
41
+ ``text`` preserves the original accepted input text. It may retain caller
42
+ formatting or casing and is not canonical serialized directive text; use
43
+ :func:`render_directive` to produce canonical directive text from semantic
44
+ kind and operands.
45
+ """
35
46
 
36
47
  text: str
37
48
  kind: DirectiveKind
@@ -182,10 +193,11 @@ def _operand_starts_with_token(value: str, token: str) -> bool:
182
193
  def match_canonical_directive_start(text: str, start: int) -> int | None:
183
194
  """Locate a canonical directive prefix at a given character position.
184
195
 
185
- This classifies whether canonical directive syntax begins at ``start`` and,
186
- when it does, returns the index immediately after the directive keyword
187
- prefix. It does not parse operands, validate the full directive payload, or
188
- evaluate multi-directive state semantics.
196
+ This is a shallow syntax-start matcher: it classifies whether canonical
197
+ directive syntax begins at ``start`` and, when it does, returns the index
198
+ immediately after the directive keyword prefix. It does not parse operands,
199
+ validate the full directive payload, or evaluate multi-directive state
200
+ semantics.
189
201
  """
190
202
  if start < 0 or start >= len(text):
191
203
  return None
@@ -246,10 +258,11 @@ def _match_directive_token(
246
258
  def contains_multiple_canonical_directives(text: str) -> bool:
247
259
  """Report whether text contains more than one canonical directive start.
248
260
 
249
- This detects compound directive text by looking for multiple canonical
250
- directive prefixes in the same input. It does not parse directive operands,
251
- repair malformed text, or determine whether a whole string should be
252
- accepted as a single directive.
261
+ This detects compound directive structure by looking for multiple canonical
262
+ directive prefixes in the same input. It is not a replacement for full
263
+ directive validation, and it does not parse directive operands, repair
264
+ malformed text, or determine whether a whole string should be accepted as a
265
+ single directive.
253
266
  """
254
267
  first_start = match_canonical_directive_start(text, 0)
255
268
  if first_start is None:
@@ -290,8 +303,10 @@ def decompose_directive(text: str) -> CanonicalDirective | None:
290
303
 
291
304
  This determines whether ``text`` is a single canonical directive and, when
292
305
  it is, returns the directive kind plus canonical operand names with the
293
- original operand text preserved. It does not repair input, infer intent, or
294
- evaluate directive effects against compiler state.
306
+ original operand text preserved. Callers can determine whether ``text`` is
307
+ a complete canonical directive by checking whether this returns a non-`None`
308
+ result. It does not repair input, infer intent, or evaluate directive
309
+ effects against compiler state.
295
310
  """
296
311
  trimmed_text = _trim_ascii_whitespace(text)
297
312
  if trimmed_text == "":
@@ -398,9 +413,11 @@ def validate_directive(text: str) -> ValidatedDirective | None:
398
413
  """Classify whether text is a canonical directive.
399
414
 
400
415
  This determines whether ``text`` belongs to one canonical directive family
401
- and returns only the normalized semantic kind needed for classification. It
402
- does not expose operands, render directives, repair malformed text, or
403
- evaluate any state transition.
416
+ and returns only the normalized semantic kind needed for classification.
417
+ Callers can determine whether ``text`` is a canonical directive by checking
418
+ whether this returns a non-`None` result while only receiving
419
+ classification information. It does not expose operands, render directives,
420
+ repair malformed text, or evaluate any state transition.
404
421
  """
405
422
  parsed = decompose_directive(text)
406
423
  if parsed is None:
@@ -408,18 +425,8 @@ def validate_directive(text: str) -> ValidatedDirective | None:
408
425
  return ValidatedDirective(text=parsed.text, kind=parsed.kind)
409
426
 
410
427
 
411
- def is_canonical_directive(text: str) -> bool:
412
- """Return whether text is exactly one canonical directive.
413
-
414
- This provides boolean directive classification for callers that only need a
415
- yes-or-no answer. It does not parse operands, explain rejection reasons, or
416
- perform validation beyond canonical grammar recognition.
417
- """
418
- return validate_directive(text) is not None
419
-
420
-
421
428
  def render_directive(kind: DirectiveKind, /, **operands: str) -> str:
422
- """Render canonical directive text from a semantic kind and operands.
429
+ """Produce canonical directive text from a semantic kind and operands.
423
430
 
424
431
  This determines the exact canonical spelling for an existing grammar
425
432
  capability and rejects operand combinations that would not round-trip as the
@@ -466,7 +473,6 @@ __all__ = [
466
473
  "ValidatedDirective",
467
474
  "contains_multiple_canonical_directives",
468
475
  "decompose_directive",
469
- "is_canonical_directive",
470
476
  "match_canonical_directive_start",
471
477
  "render_directive",
472
478
  "validate_directive",