whiletrue 0.1.0__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 (98) hide show
  1. whiletrue/__init__.py +0 -0
  2. whiletrue/__main__.py +3 -0
  3. whiletrue/abort.py +79 -0
  4. whiletrue/basics/__init__.py +99 -0
  5. whiletrue/basics/agent.py +249 -0
  6. whiletrue/basics/comments.py +113 -0
  7. whiletrue/basics/diff_size.py +80 -0
  8. whiletrue/basics/exec_.py +84 -0
  9. whiletrue/basics/history.py +117 -0
  10. whiletrue/basics/human.py +201 -0
  11. whiletrue/basics/json_source.py +35 -0
  12. whiletrue/basics/markdown_source.py +55 -0
  13. whiletrue/basics/process.py +99 -0
  14. whiletrue/basics/sessions.py +62 -0
  15. whiletrue/basics/set_.py +29 -0
  16. whiletrue/basics/shell.py +98 -0
  17. whiletrue/basics/wake.py +27 -0
  18. whiletrue/claude_code/__init__.py +58 -0
  19. whiletrue/claude_code/endpoint.py +143 -0
  20. whiletrue/claude_code/headless.py +181 -0
  21. whiletrue/claude_code/interactive.py +344 -0
  22. whiletrue/claude_code/learnings.py +32 -0
  23. whiletrue/claude_code/panes.py +164 -0
  24. whiletrue/claude_code/plugin/.claude-plugin/plugin.json +5 -0
  25. whiletrue/claude_code/plugin/hook.py +44 -0
  26. whiletrue/claude_code/plugin/hooks/hooks.json +81 -0
  27. whiletrue/claude_code/plugin/mcp_server.py +98 -0
  28. whiletrue/claude_code/session.py +345 -0
  29. whiletrue/claude_code/transcript.py +123 -0
  30. whiletrue/cli/__init__.py +15 -0
  31. whiletrue/cli/__main__.py +3 -0
  32. whiletrue/cli/app.py +550 -0
  33. whiletrue/cli/common.py +36 -0
  34. whiletrue/cli/gates.py +156 -0
  35. whiletrue/cli/ops.py +339 -0
  36. whiletrue/cli/panel.py +198 -0
  37. whiletrue/cli/registry.py +143 -0
  38. whiletrue/cli/templates.py +24 -0
  39. whiletrue/codex/__init__.py +14 -0
  40. whiletrue/codex/runner.py +243 -0
  41. whiletrue/control/__init__.py +38 -0
  42. whiletrue/control/chain.py +61 -0
  43. whiletrue/control/loop.py +139 -0
  44. whiletrue/control/map_.py +101 -0
  45. whiletrue/control/parallel.py +32 -0
  46. whiletrue/control/retry.py +100 -0
  47. whiletrue/control/sequence.py +40 -0
  48. whiletrue/control/switch.py +67 -0
  49. whiletrue/core/__init__.py +260 -0
  50. whiletrue/core/caps.py +139 -0
  51. whiletrue/core/comments.py +80 -0
  52. whiletrue/core/composite.py +140 -0
  53. whiletrue/core/config.py +461 -0
  54. whiletrue/core/context.py +177 -0
  55. whiletrue/core/duration.py +19 -0
  56. whiletrue/core/events.py +94 -0
  57. whiletrue/core/expr.py +85 -0
  58. whiletrue/core/history.py +83 -0
  59. whiletrue/core/lock.py +86 -0
  60. whiletrue/core/memory_store.py +352 -0
  61. whiletrue/core/module.py +146 -0
  62. whiletrue/core/outcomes.py +82 -0
  63. whiletrue/core/registry.py +129 -0
  64. whiletrue/core/replay.py +58 -0
  65. whiletrue/core/runner.py +98 -0
  66. whiletrue/core/runtime.py +538 -0
  67. whiletrue/core/source.py +45 -0
  68. whiletrue/core/store.py +207 -0
  69. whiletrue/core/template.py +60 -0
  70. whiletrue/core/validate.py +142 -0
  71. whiletrue/core/wake.py +117 -0
  72. whiletrue/core/workspace.py +55 -0
  73. whiletrue/git/__init__.py +31 -0
  74. whiletrue/git/modules.py +128 -0
  75. whiletrue/git/workspaces.py +77 -0
  76. whiletrue/github/__init__.py +30 -0
  77. whiletrue/github/client.py +269 -0
  78. whiletrue/github/filebacked.py +87 -0
  79. whiletrue/github/memory.py +96 -0
  80. whiletrue/github/plugin.py +343 -0
  81. whiletrue/github/specs.py +39 -0
  82. whiletrue/opencode/__init__.py +25 -0
  83. whiletrue/opencode/runner.py +186 -0
  84. whiletrue/py.typed +0 -0
  85. whiletrue/recipes/issue-loop.yaml +59 -0
  86. whiletrue/recipes/ralph.yaml +14 -0
  87. whiletrue/recipes/review-pass.yaml +27 -0
  88. whiletrue/recipes/review-respond.yaml +22 -0
  89. whiletrue/store_sqlite/__init__.py +6 -0
  90. whiletrue/store_sqlite/migrations.py +132 -0
  91. whiletrue/store_sqlite/sqlite_store.py +537 -0
  92. whiletrue/tmux/__init__.py +11 -0
  93. whiletrue/tmux/controller.py +197 -0
  94. whiletrue-0.1.0.dist-info/METADATA +48 -0
  95. whiletrue-0.1.0.dist-info/RECORD +98 -0
  96. whiletrue-0.1.0.dist-info/WHEEL +4 -0
  97. whiletrue-0.1.0.dist-info/entry_points.txt +2 -0
  98. whiletrue-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,27 @@
1
+ # Review pass: a read-only reviewer returns a Verdict ({pass, reason}); on a fail the fixer
2
+ # runs with the verdict as input, then the review repeats. Exhausted rounds park the item.
3
+ composite: review-pass
4
+ params:
5
+ reviewer: { required: true } # agent file whose output is a Verdict
6
+ fixer: { required: true } # agent file that receives the Verdict
7
+ max_rounds: { default: 3 }
8
+ ports: { in: Any, out: Any }
9
+ pipeline:
10
+ loop:
11
+ max: "{{params.max_rounds}}"
12
+ until: "last.ok && last.value.approved"
13
+ do:
14
+ - agent: { uses: "{{params.reviewer}}" }
15
+ - id: route
16
+ switch:
17
+ on: "input.pass ? 'true' : 'false'"
18
+ cases: { "true": approve, "false": fix }
19
+ default: fix
20
+ do:
21
+ - id: approve
22
+ set: { value: { approved: true } }
23
+ - id: fix
24
+ sequence:
25
+ do:
26
+ - agent: { uses: "{{params.fixer}}" }
27
+ - set: { value: { approved: false } }
@@ -0,0 +1,22 @@
1
+ # Answer review comments. Run it as the `do:` of a `human.approve` gate: each time new comments
2
+ # arrive the gate hands them over as {comments: [...], input: ...}, and this recipe
3
+ # 1. has the responder agent classify each comment (question, change request, nit, approval,
4
+ # out of scope), make any code changes, and return one reply per comment;
5
+ # 2. checks the tests still pass (retrying the agent with the failure as feedback);
6
+ # 3. posts each reply in its own thread, prefixed [whiletrue] and only once;
7
+ # 4. fails while any comment is still unanswered.
8
+ # Agents reply but never resolve a human's thread; resolving is yours.
9
+ composite: review-respond
10
+ params:
11
+ responder: { required: true } # agent file whose `outputs` is { replies: CommentReplies }
12
+ gate: { default: pytest } # shell command that must pass after the changes
13
+ max: { default: 2 } # attempts for the responder before the item parks
14
+ ports: { in: Any, out: Any }
15
+ pipeline:
16
+ - id: respond
17
+ retry: { max: "{{params.max}}", feedback: true }
18
+ do:
19
+ - agent: { uses: "{{params.responder}}" }
20
+ - gate.shell: { run: "{{params.gate}}", pass_input: true }
21
+ - comments.reply: {}
22
+ - gate.comments_answered: {}
@@ -0,0 +1,6 @@
1
+ """SQLite StateStore (stdlib `sqlite3`, no native dependencies)."""
2
+
3
+ from whiletrue.store_sqlite.migrations import MIGRATIONS
4
+ from whiletrue.store_sqlite.sqlite_store import SqliteStore
5
+
6
+ __all__ = ["MIGRATIONS", "SqliteStore"]
@@ -0,0 +1,132 @@
1
+ """Ordered, append-only schema migrations. Never edit a shipped migration; add a new one."""
2
+
3
+ MIGRATIONS: tuple[str, ...] = (
4
+ """
5
+ CREATE TABLE runs (
6
+ id TEXT PRIMARY KEY,
7
+ pipeline_hash TEXT NOT NULL,
8
+ lockfile TEXT,
9
+ status TEXT NOT NULL,
10
+ started_at INTEGER NOT NULL,
11
+ ended_at INTEGER
12
+ );
13
+
14
+ CREATE TABLE items (
15
+ run_id TEXT NOT NULL REFERENCES runs(id),
16
+ id TEXT NOT NULL,
17
+ source_key TEXT NOT NULL,
18
+ state TEXT NOT NULL,
19
+ payload TEXT,
20
+ depends_on TEXT NOT NULL DEFAULT '[]',
21
+ PRIMARY KEY (run_id, id)
22
+ );
23
+
24
+ CREATE TABLE steps (
25
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
26
+ run_id TEXT NOT NULL REFERENCES runs(id),
27
+ item_id TEXT NOT NULL,
28
+ node_path TEXT NOT NULL,
29
+ attempt INTEGER NOT NULL,
30
+ status TEXT NOT NULL,
31
+ port TEXT,
32
+ input TEXT,
33
+ output TEXT,
34
+ cost_usd REAL NOT NULL DEFAULT 0,
35
+ error TEXT,
36
+ started_at INTEGER NOT NULL,
37
+ ended_at INTEGER
38
+ );
39
+ CREATE INDEX steps_by_item ON steps (run_id, item_id);
40
+
41
+ CREATE TABLE parks (
42
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
43
+ run_id TEXT NOT NULL REFERENCES runs(id),
44
+ item_id TEXT NOT NULL,
45
+ step_id INTEGER,
46
+ wake TEXT,
47
+ reason TEXT,
48
+ notes TEXT,
49
+ decided_by TEXT,
50
+ decided_at INTEGER,
51
+ created_at INTEGER NOT NULL
52
+ );
53
+
54
+ CREATE TABLE sessions (
55
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
56
+ run_id TEXT NOT NULL REFERENCES runs(id),
57
+ item_id TEXT,
58
+ runner TEXT NOT NULL,
59
+ session_id TEXT,
60
+ scope TEXT,
61
+ tmux_pane TEXT,
62
+ status TEXT NOT NULL
63
+ );
64
+
65
+ CREATE TABLE effects (
66
+ key TEXT PRIMARY KEY,
67
+ run_id TEXT NOT NULL REFERENCES runs(id),
68
+ status TEXT NOT NULL,
69
+ external_ref TEXT,
70
+ created_at INTEGER NOT NULL
71
+ );
72
+
73
+ CREATE TABLE learnings (
74
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
75
+ run_id TEXT,
76
+ scope TEXT NOT NULL,
77
+ note TEXT NOT NULL,
78
+ provenance TEXT,
79
+ created_at INTEGER NOT NULL
80
+ );
81
+
82
+ CREATE TABLE events (
83
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
84
+ run_id TEXT NOT NULL,
85
+ item_id TEXT,
86
+ step_id INTEGER,
87
+ type TEXT NOT NULL,
88
+ data TEXT NOT NULL,
89
+ ts INTEGER NOT NULL
90
+ );
91
+ CREATE INDEX events_by_run ON events (run_id, id);
92
+
93
+ CREATE TABLE cache (
94
+ key TEXT PRIMARY KEY,
95
+ value TEXT NOT NULL,
96
+ created_at INTEGER NOT NULL
97
+ );
98
+ """,
99
+ """
100
+ ALTER TABLE parks ADD COLUMN node_path TEXT NOT NULL DEFAULT '';
101
+ ALTER TABLE parks ADD COLUMN what TEXT NOT NULL DEFAULT '';
102
+ ALTER TABLE parks ADD COLUMN decision TEXT;
103
+ CREATE INDEX parks_by_item ON parks (item_id, node_path, run_id);
104
+
105
+ ALTER TABLE learnings ADD COLUMN status TEXT NOT NULL DEFAULT 'approved';
106
+
107
+ CREATE TABLE comments (
108
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
109
+ item_id TEXT NOT NULL,
110
+ source TEXT NOT NULL,
111
+ external_id TEXT NOT NULL,
112
+ thread TEXT,
113
+ author TEXT NOT NULL,
114
+ body TEXT NOT NULL,
115
+ url TEXT,
116
+ kind TEXT NOT NULL DEFAULT 'human',
117
+ answered INTEGER NOT NULL DEFAULT 0,
118
+ reply TEXT,
119
+ created_at INTEGER NOT NULL,
120
+ UNIQUE (item_id, source, external_id)
121
+ );
122
+
123
+ CREATE TABLE steers (
124
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
125
+ run_id TEXT NOT NULL,
126
+ item_id TEXT NOT NULL,
127
+ step TEXT NOT NULL,
128
+ prompt TEXT NOT NULL,
129
+ created_at INTEGER NOT NULL
130
+ );
131
+ """,
132
+ )