prettyplay 0.0.2__py3-none-any.whl

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 (75) hide show
  1. prettyplay/.usages/lifecycle.md +117 -0
  2. prettyplay/.usages/steps.md +169 -0
  3. prettyplay/__init__.py +18 -0
  4. prettyplay/cache/.usages/addressing.md +44 -0
  5. prettyplay/cache/.usages/budgets.md +51 -0
  6. prettyplay/cache/.usages/storage.md +32 -0
  7. prettyplay/cache/__init__.py +8 -0
  8. prettyplay/cache/budgets.py +93 -0
  9. prettyplay/cache/models.py +55 -0
  10. prettyplay/cache/store.py +276 -0
  11. prettyplay/cache/text.py +36 -0
  12. prettyplay/config/.usages/configuration.md +246 -0
  13. prettyplay/config/__init__.py +6 -0
  14. prettyplay/config/loader.py +336 -0
  15. prettyplay/config/models.py +288 -0
  16. prettyplay/driver/.usages/error_kinds.md +26 -0
  17. prettyplay/driver/.usages/plumbing.md +52 -0
  18. prettyplay/driver/__init__.py +11 -0
  19. prettyplay/driver/errors.py +76 -0
  20. prettyplay/driver/page.py +175 -0
  21. prettyplay/driver/session.py +330 -0
  22. prettyplay/engine/.usages/generation.md +157 -0
  23. prettyplay/engine/.usages/healing.md +61 -0
  24. prettyplay/engine/__init__.py +19 -0
  25. prettyplay/engine/attempts.py +80 -0
  26. prettyplay/engine/classification.py +70 -0
  27. prettyplay/engine/compliance.py +125 -0
  28. prettyplay/engine/execution.py +48 -0
  29. prettyplay/engine/generator.py +1110 -0
  30. prettyplay/engine/groups/.usages/recovery.md +71 -0
  31. prettyplay/engine/groups/__init__.py +7 -0
  32. prettyplay/engine/groups/diagnosis.py +128 -0
  33. prettyplay/engine/groups/outcome.py +55 -0
  34. prettyplay/engine/groups/recovery.py +491 -0
  35. prettyplay/engine/healer.py +149 -0
  36. prettyplay/engine/polling/.usages/settle.md +55 -0
  37. prettyplay/engine/polling/__init__.py +6 -0
  38. prettyplay/engine/polling/settle.py +98 -0
  39. prettyplay/engine/polling/window.py +72 -0
  40. prettyplay/engine/renderer/.usages/memory.md +24 -0
  41. prettyplay/engine/renderer/.usages/rendering.md +44 -0
  42. prettyplay/engine/renderer/.usages/validation.md +20 -0
  43. prettyplay/engine/renderer/__init__.py +7 -0
  44. prettyplay/engine/renderer/memory.py +37 -0
  45. prettyplay/engine/renderer/render.py +184 -0
  46. prettyplay/engine/renderer/validation.py +76 -0
  47. prettyplay/engine/steering/.usages/steering.md +95 -0
  48. prettyplay/engine/steering/__init__.py +5 -0
  49. prettyplay/engine/steering/steering.py +765 -0
  50. prettyplay/engine/text.py +41 -0
  51. prettyplay/executor.py +654 -0
  52. prettyplay/failures/.usages/taxonomy.md +131 -0
  53. prettyplay/failures/__init__.py +25 -0
  54. prettyplay/failures/errors.py +359 -0
  55. prettyplay/groups.py +276 -0
  56. prettyplay/llm/.usages/classification.md +31 -0
  57. prettyplay/llm/.usages/providers.md +127 -0
  58. prettyplay/llm/.usages/transport.md +81 -0
  59. prettyplay/llm/__init__.py +38 -0
  60. prettyplay/llm/_request.py +823 -0
  61. prettyplay/llm/anthropic_provider.py +468 -0
  62. prettyplay/llm/models.py +273 -0
  63. prettyplay/llm/openai_provider.py +444 -0
  64. prettyplay/llm/provider.py +279 -0
  65. prettyplay/reporting/.usages/hooks.md +61 -0
  66. prettyplay/reporting/__init__.py +6 -0
  67. prettyplay/reporting/hooks.py +47 -0
  68. prettyplay/reporting/reporter.py +70 -0
  69. prettyplay/runtime.py +81 -0
  70. prettyplay/scenario.py +469 -0
  71. prettyplay-0.0.2.dist-info/METADATA +515 -0
  72. prettyplay-0.0.2.dist-info/RECORD +75 -0
  73. prettyplay-0.0.2.dist-info/WHEEL +5 -0
  74. prettyplay-0.0.2.dist-info/licenses/LICENSE +28 -0
  75. prettyplay-0.0.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,95 @@
1
+ # Interactive steering
2
+
3
+ Domain: the opt-in REPL that rescues a terminally stuck step with engineer guidance. Audience: engineers running generation sessions locally.
4
+
5
+ ## When the dialog opens
6
+
7
+ The step executor opens the dialog at the exact moment an `IncurableStepError` would propagate — budget exhausted,
8
+ incurable verdict, failed-check final classification — when `interactive` is on and the run is not strict. It never
9
+ opens on `product_defect` (a dialog must never repaint a red test green), never in replay-strict, and never when the
10
+ LLM is unavailable. The dialog receives the per-step attempt history the engine loops grew — anchored by record 0,
11
+ the original cached code — and continues growing it; the history survives the dialog.
12
+
13
+ ## The dialog
14
+
15
+ ```text
16
+ ── step "click Checkout" — about to raise IncurableStepError ──────────
17
+ code: items = page.get_by_role("listitem")
18
+ assert items.count() > 1
19
+ error: IncurableStepError: the generation budget is exhausted
20
+ ---
21
+ step: click Checkout
22
+ error: TimeoutError: Timeout 10000ms exceeded
23
+ ---
24
+ received: … / cause: … / Call log: …
25
+ ---
26
+ explanation: the button is behind the "Terms" modal
27
+ recommendation: dismiss the modal first, then click
28
+ url: https://shop.example.com/cart
29
+ shot: /tmp/prettyplay-steering-abc123.png
30
+
31
+ commands: snapshot | screenshot | error | code | quit
32
+ guidance> the modal has id=terms — close it via page.get_by_label("Close").click() first
33
+ ⟳ regenerating with USER GUIDANCE — the complete candidate code is printed
34
+ run? [y/N] y
35
+ ✓ step green — healed step written to the cache
36
+ ```
37
+
38
+ - The banner shows the step, the failed code, the terminal error render, the current page
39
+ URL, the screenshot path and the commands — no snapshot fragment; the full snapshot
40
+ stays behind the `snapshot` command and in every request
41
+ - Local commands answer without the LLM: `snapshot` prints the full accessibility snapshot,
42
+ `screenshot` writes a full PNG to a temporary file and prints the path, `error` and `code`
43
+ reprint the stored texts
44
+ - Every other line is guidance: one regeneration request carrying the step type, the
45
+ prepared instruction, a USER GUIDANCE block, the current page URL and the grown attempt history
46
+ as the HISTORY block — record 0 anchors the original failure
47
+ - The banner and every guided request carry the prepared instruction — with INPUTS and RESULTS blocks when the
48
+ step carries inputs or declarations; the model never sees raw Jinja
49
+ - A green turn: execute → validate the returned result (a violation is a red turn with the deterministic text) →
50
+ the compliance gate → the captures publish to the test memory together with the write-back; a rejected, failed
51
+ or gate-blocked turn publishes nothing
52
+ - Every turn shows the complete generated code and asks `run? [y/N]`: `y` executes against
53
+ the live page; `n`, Enter or `quit` aborts the turn without execution and the guidance
54
+ prompt reopens — the rejected candidate lands in the history as a completed record with
55
+ the outcome `rejected by the engineer, not executed` and the same URL on both sides
56
+ - Every completed turn — executed or rejected — enters the shared per-step history in full:
57
+ the outcome label, the `URL before -> after` pair of the turn, the complete code, the
58
+ complete outcome; nothing is collapsed or truncated
59
+ - A red turn shows the complete error and returns to the guidance prompt immediately — no
60
+ re-execution loop, the settle window does not re-arm inside the dialog
61
+ - `quit`, EOF (Ctrl+D), SIGINT (Ctrl+C) and an unreadable stdin (a captured CI stream) end
62
+ the dialog and the original terminal failure propagates — nothing hangs
63
+
64
+ A group step's guidance requests carry the group context — the group prompt and the
65
+ group-marked previous steps; the banner is unchanged.
66
+
67
+ ## Effects
68
+
69
+ - A green turn writes the healed step back to the cache — only after the successful execution — and reports
70
+ on_healed; the test continues
71
+ - Guidance is one-shot: it lands in the log, never in the cache file
72
+ - Interactive attempts consume no generation or healing budgets — the human in the loop is the bound
73
+
74
+ ## The compliance gate of a guided heal
75
+
76
+ A guided candidate that executes successfully is verified on two dimensions before the
77
+ write-back — instruction compliance and step adequacy, judged from the step type and the
78
+ shared attempt history — the same gate as unattended generation:
79
+
80
+ - a high finding of either dimension never reaches the cache: the dialog shows it, the turn
81
+ lands in the history with the violation text and the guidance prompt reopens — steer the
82
+ model to fix the finding
83
+ - medium and low findings pass with a WARNING naming the instructions
84
+ - a malformed verdict (ComplianceVerdictError) or provider unavailability
85
+ (LLMUnavailableError) ends the dialog — the gate failure is shown in the dialog and
86
+ logged as a WARNING naming the step before the dialog ends, so the engineer sees why the
87
+ green candidate was not written back; the original terminal failure propagates and
88
+ nothing is cached
89
+ - the gate adds no budget consumption: interactive attempts stay free, the human in the
90
+ loop is the bound
91
+
92
+ ## Rules
93
+
94
+ - Opt-in by design: `interactive` defaults to false; PRETTYPLAY_INTERACTIVE must never leak into CI environments
95
+ - The dialog is a v1 terminal surface: no chat mode, no manual code paste — every turn must have a measurable outcome
@@ -0,0 +1,5 @@
1
+ """Facade of the prettyplay.engine.steering cell: the interactive steering dialog."""
2
+
3
+ from .steering import StepSteering
4
+
5
+ __all__ = ["StepSteering"]