codex-autorunner 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 (147) hide show
  1. codex_autorunner/__init__.py +3 -0
  2. codex_autorunner/bootstrap.py +151 -0
  3. codex_autorunner/cli.py +886 -0
  4. codex_autorunner/codex_cli.py +79 -0
  5. codex_autorunner/codex_runner.py +17 -0
  6. codex_autorunner/core/__init__.py +1 -0
  7. codex_autorunner/core/about_car.py +125 -0
  8. codex_autorunner/core/codex_runner.py +100 -0
  9. codex_autorunner/core/config.py +1465 -0
  10. codex_autorunner/core/doc_chat.py +547 -0
  11. codex_autorunner/core/docs.py +37 -0
  12. codex_autorunner/core/engine.py +720 -0
  13. codex_autorunner/core/git_utils.py +206 -0
  14. codex_autorunner/core/hub.py +756 -0
  15. codex_autorunner/core/injected_context.py +9 -0
  16. codex_autorunner/core/locks.py +57 -0
  17. codex_autorunner/core/logging_utils.py +158 -0
  18. codex_autorunner/core/notifications.py +465 -0
  19. codex_autorunner/core/optional_dependencies.py +41 -0
  20. codex_autorunner/core/prompt.py +107 -0
  21. codex_autorunner/core/prompts.py +275 -0
  22. codex_autorunner/core/request_context.py +21 -0
  23. codex_autorunner/core/runner_controller.py +116 -0
  24. codex_autorunner/core/runner_process.py +29 -0
  25. codex_autorunner/core/snapshot.py +576 -0
  26. codex_autorunner/core/state.py +156 -0
  27. codex_autorunner/core/update.py +567 -0
  28. codex_autorunner/core/update_runner.py +44 -0
  29. codex_autorunner/core/usage.py +1221 -0
  30. codex_autorunner/core/utils.py +108 -0
  31. codex_autorunner/discovery.py +102 -0
  32. codex_autorunner/housekeeping.py +423 -0
  33. codex_autorunner/integrations/__init__.py +1 -0
  34. codex_autorunner/integrations/app_server/__init__.py +6 -0
  35. codex_autorunner/integrations/app_server/client.py +1386 -0
  36. codex_autorunner/integrations/app_server/supervisor.py +206 -0
  37. codex_autorunner/integrations/github/__init__.py +10 -0
  38. codex_autorunner/integrations/github/service.py +889 -0
  39. codex_autorunner/integrations/telegram/__init__.py +1 -0
  40. codex_autorunner/integrations/telegram/adapter.py +1401 -0
  41. codex_autorunner/integrations/telegram/commands_registry.py +104 -0
  42. codex_autorunner/integrations/telegram/config.py +450 -0
  43. codex_autorunner/integrations/telegram/constants.py +154 -0
  44. codex_autorunner/integrations/telegram/dispatch.py +162 -0
  45. codex_autorunner/integrations/telegram/handlers/__init__.py +0 -0
  46. codex_autorunner/integrations/telegram/handlers/approvals.py +241 -0
  47. codex_autorunner/integrations/telegram/handlers/callbacks.py +72 -0
  48. codex_autorunner/integrations/telegram/handlers/commands.py +160 -0
  49. codex_autorunner/integrations/telegram/handlers/commands_runtime.py +5262 -0
  50. codex_autorunner/integrations/telegram/handlers/messages.py +477 -0
  51. codex_autorunner/integrations/telegram/handlers/selections.py +545 -0
  52. codex_autorunner/integrations/telegram/helpers.py +2084 -0
  53. codex_autorunner/integrations/telegram/notifications.py +164 -0
  54. codex_autorunner/integrations/telegram/outbox.py +174 -0
  55. codex_autorunner/integrations/telegram/rendering.py +102 -0
  56. codex_autorunner/integrations/telegram/retry.py +37 -0
  57. codex_autorunner/integrations/telegram/runtime.py +270 -0
  58. codex_autorunner/integrations/telegram/service.py +921 -0
  59. codex_autorunner/integrations/telegram/state.py +1223 -0
  60. codex_autorunner/integrations/telegram/transport.py +318 -0
  61. codex_autorunner/integrations/telegram/types.py +57 -0
  62. codex_autorunner/integrations/telegram/voice.py +413 -0
  63. codex_autorunner/manifest.py +150 -0
  64. codex_autorunner/routes/__init__.py +53 -0
  65. codex_autorunner/routes/base.py +470 -0
  66. codex_autorunner/routes/docs.py +275 -0
  67. codex_autorunner/routes/github.py +197 -0
  68. codex_autorunner/routes/repos.py +121 -0
  69. codex_autorunner/routes/sessions.py +137 -0
  70. codex_autorunner/routes/shared.py +137 -0
  71. codex_autorunner/routes/system.py +175 -0
  72. codex_autorunner/routes/terminal_images.py +107 -0
  73. codex_autorunner/routes/voice.py +128 -0
  74. codex_autorunner/server.py +23 -0
  75. codex_autorunner/spec_ingest.py +113 -0
  76. codex_autorunner/static/app.js +95 -0
  77. codex_autorunner/static/autoRefresh.js +209 -0
  78. codex_autorunner/static/bootstrap.js +105 -0
  79. codex_autorunner/static/bus.js +23 -0
  80. codex_autorunner/static/cache.js +52 -0
  81. codex_autorunner/static/constants.js +48 -0
  82. codex_autorunner/static/dashboard.js +795 -0
  83. codex_autorunner/static/docs.js +1514 -0
  84. codex_autorunner/static/env.js +99 -0
  85. codex_autorunner/static/github.js +168 -0
  86. codex_autorunner/static/hub.js +1511 -0
  87. codex_autorunner/static/index.html +622 -0
  88. codex_autorunner/static/loader.js +28 -0
  89. codex_autorunner/static/logs.js +690 -0
  90. codex_autorunner/static/mobileCompact.js +300 -0
  91. codex_autorunner/static/snapshot.js +116 -0
  92. codex_autorunner/static/state.js +87 -0
  93. codex_autorunner/static/styles.css +4966 -0
  94. codex_autorunner/static/tabs.js +50 -0
  95. codex_autorunner/static/terminal.js +21 -0
  96. codex_autorunner/static/terminalManager.js +3535 -0
  97. codex_autorunner/static/todoPreview.js +25 -0
  98. codex_autorunner/static/types.d.ts +8 -0
  99. codex_autorunner/static/utils.js +597 -0
  100. codex_autorunner/static/vendor/LICENSE.xterm +24 -0
  101. codex_autorunner/static/vendor/fonts/jetbrains-mono/JetBrainsMono-400-cyrillic-ext.woff2 +0 -0
  102. codex_autorunner/static/vendor/fonts/jetbrains-mono/JetBrainsMono-400-cyrillic.woff2 +0 -0
  103. codex_autorunner/static/vendor/fonts/jetbrains-mono/JetBrainsMono-400-greek.woff2 +0 -0
  104. codex_autorunner/static/vendor/fonts/jetbrains-mono/JetBrainsMono-400-latin-ext.woff2 +0 -0
  105. codex_autorunner/static/vendor/fonts/jetbrains-mono/JetBrainsMono-400-latin.woff2 +0 -0
  106. codex_autorunner/static/vendor/fonts/jetbrains-mono/JetBrainsMono-400-vietnamese.woff2 +0 -0
  107. codex_autorunner/static/vendor/fonts/jetbrains-mono/JetBrainsMono-500-cyrillic-ext.woff2 +0 -0
  108. codex_autorunner/static/vendor/fonts/jetbrains-mono/JetBrainsMono-500-cyrillic.woff2 +0 -0
  109. codex_autorunner/static/vendor/fonts/jetbrains-mono/JetBrainsMono-500-greek.woff2 +0 -0
  110. codex_autorunner/static/vendor/fonts/jetbrains-mono/JetBrainsMono-500-latin-ext.woff2 +0 -0
  111. codex_autorunner/static/vendor/fonts/jetbrains-mono/JetBrainsMono-500-latin.woff2 +0 -0
  112. codex_autorunner/static/vendor/fonts/jetbrains-mono/JetBrainsMono-500-vietnamese.woff2 +0 -0
  113. codex_autorunner/static/vendor/fonts/jetbrains-mono/JetBrainsMono-600-cyrillic-ext.woff2 +0 -0
  114. codex_autorunner/static/vendor/fonts/jetbrains-mono/JetBrainsMono-600-cyrillic.woff2 +0 -0
  115. codex_autorunner/static/vendor/fonts/jetbrains-mono/JetBrainsMono-600-greek.woff2 +0 -0
  116. codex_autorunner/static/vendor/fonts/jetbrains-mono/JetBrainsMono-600-latin-ext.woff2 +0 -0
  117. codex_autorunner/static/vendor/fonts/jetbrains-mono/JetBrainsMono-600-latin.woff2 +0 -0
  118. codex_autorunner/static/vendor/fonts/jetbrains-mono/JetBrainsMono-600-vietnamese.woff2 +0 -0
  119. codex_autorunner/static/vendor/fonts/jetbrains-mono/OFL.txt +93 -0
  120. codex_autorunner/static/vendor/xterm-addon-fit.js +2 -0
  121. codex_autorunner/static/vendor/xterm.css +209 -0
  122. codex_autorunner/static/vendor/xterm.js +2 -0
  123. codex_autorunner/static/voice.js +591 -0
  124. codex_autorunner/voice/__init__.py +39 -0
  125. codex_autorunner/voice/capture.py +349 -0
  126. codex_autorunner/voice/config.py +167 -0
  127. codex_autorunner/voice/provider.py +66 -0
  128. codex_autorunner/voice/providers/__init__.py +7 -0
  129. codex_autorunner/voice/providers/openai_whisper.py +345 -0
  130. codex_autorunner/voice/resolver.py +36 -0
  131. codex_autorunner/voice/service.py +210 -0
  132. codex_autorunner/web/__init__.py +1 -0
  133. codex_autorunner/web/app.py +1037 -0
  134. codex_autorunner/web/hub_jobs.py +181 -0
  135. codex_autorunner/web/middleware.py +552 -0
  136. codex_autorunner/web/pty_session.py +357 -0
  137. codex_autorunner/web/runner_manager.py +25 -0
  138. codex_autorunner/web/schemas.py +253 -0
  139. codex_autorunner/web/static_assets.py +430 -0
  140. codex_autorunner/web/terminal_sessions.py +78 -0
  141. codex_autorunner/workspace.py +16 -0
  142. codex_autorunner-0.1.0.dist-info/METADATA +240 -0
  143. codex_autorunner-0.1.0.dist-info/RECORD +147 -0
  144. codex_autorunner-0.1.0.dist-info/WHEEL +5 -0
  145. codex_autorunner-0.1.0.dist-info/entry_points.txt +3 -0
  146. codex_autorunner-0.1.0.dist-info/licenses/LICENSE +21 -0
  147. codex_autorunner-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,3 @@
1
+ """Codex autorunner package."""
2
+
3
+ __all__ = ["cli", "core", "integrations", "routes", "server", "voice", "web"]
@@ -0,0 +1,151 @@
1
+ from pathlib import Path
2
+
3
+ import yaml
4
+
5
+ from .core.about_car import ensure_about_car_file_for_repo
6
+ from .core.config import CONFIG_FILENAME, DEFAULT_HUB_CONFIG, resolve_config_data
7
+ from .core.utils import atomic_write
8
+ from .manifest import load_manifest
9
+
10
+ GITIGNORE_CONTENT = "*"
11
+
12
+
13
+ def sample_todo() -> str:
14
+ return """# TODO\n\n- [ ] Replace this item with your first task\n- [ ] Add another task\n- [x] Example completed item\n"""
15
+
16
+
17
+ def sample_opinions() -> str:
18
+ return """# Opinions\n\n- Prefer small, well-tested changes.\n- Keep docs in sync with code.\n- Avoid unnecessary dependencies.\n"""
19
+
20
+
21
+ def sample_spec() -> str:
22
+ return """# Spec\n\n## Context\n- Add project background and goals here.\n\n## Requirements\n- Requirement 1\n- Requirement 2\n\n## Non-goals\n- Out of scope items\n"""
23
+
24
+
25
+ def sample_summary() -> str:
26
+ return """# Summary
27
+
28
+ This doc is the **user-facing report and handoff** for work done by CAR agents.
29
+
30
+ Use it for:
31
+ - Anything that requires **user action** or an **external party** (not agents).
32
+ - Unresolved decisions or blockers that agents can’t finish autonomously.
33
+ - A final condensed report once TODO is complete.
34
+
35
+ ## External/user actions
36
+ - (none)
37
+
38
+ ## Open questions / blockers
39
+ - (none)
40
+
41
+ ## Final report
42
+ - (pending)
43
+ """
44
+
45
+
46
+ def _seed_doc(path: Path, force: bool, content: str) -> None:
47
+ if path.exists() and not force:
48
+ return
49
+ path.write_text(content, encoding="utf-8")
50
+
51
+
52
+ def write_repo_config(repo_root: Path, force: bool = False) -> Path:
53
+ config_path = repo_root / CONFIG_FILENAME
54
+ if config_path.exists() and not force:
55
+ return config_path
56
+ config_path.parent.mkdir(parents=True, exist_ok=True)
57
+ with config_path.open("w", encoding="utf-8") as f:
58
+ yaml.safe_dump(
59
+ resolve_config_data(repo_root, "repo"),
60
+ f,
61
+ sort_keys=False,
62
+ )
63
+ return config_path
64
+
65
+
66
+ def write_hub_config(hub_root: Path, force: bool = False) -> Path:
67
+ config_path = hub_root / CONFIG_FILENAME
68
+ if config_path.exists() and not force:
69
+ return config_path
70
+ config_path.parent.mkdir(parents=True, exist_ok=True)
71
+ with config_path.open("w", encoding="utf-8") as f:
72
+ yaml.safe_dump(
73
+ resolve_config_data(hub_root, "hub"),
74
+ f,
75
+ sort_keys=False,
76
+ )
77
+ return config_path
78
+
79
+
80
+ def seed_repo_files(
81
+ repo_root: Path, force: bool = False, git_required: bool = True
82
+ ) -> None:
83
+ """
84
+ Initialize a repository's .codex-autorunner directory with defaults.
85
+ This is used by the CLI init path and hub auto-init discovery.
86
+ """
87
+ if git_required and not (repo_root / ".git").exists():
88
+ raise ValueError("Missing .git directory; pass git_required=False to bypass")
89
+
90
+ ca_dir = repo_root / ".codex-autorunner"
91
+ ca_dir.mkdir(parents=True, exist_ok=True)
92
+
93
+ gitignore_path = ca_dir / ".gitignore"
94
+ if not gitignore_path.exists() or force:
95
+ gitignore_path.write_text(GITIGNORE_CONTENT, encoding="utf-8")
96
+
97
+ write_repo_config(repo_root, force=force)
98
+
99
+ state_path = ca_dir / "state.json"
100
+ if not state_path.exists() or force:
101
+ atomic_write(
102
+ state_path,
103
+ '{\n "last_run_id": null,\n "status": "idle",\n "last_exit_code": null,\n "last_run_started_at": null,\n "last_run_finished_at": null,\n "runner_pid": null\n}\n',
104
+ )
105
+
106
+ log_path = ca_dir / "codex-autorunner.log"
107
+ if not log_path.exists() or force:
108
+ log_path.write_text("", encoding="utf-8")
109
+
110
+ _seed_doc(ca_dir / "TODO.md", force, sample_todo())
111
+ _seed_doc(ca_dir / "PROGRESS.md", force, "# Progress\n\n")
112
+ _seed_doc(ca_dir / "OPINIONS.md", force, sample_opinions())
113
+ _seed_doc(ca_dir / "SPEC.md", force, sample_spec())
114
+ _seed_doc(ca_dir / "SUMMARY.md", force, sample_summary())
115
+
116
+ # Seed an always-available briefing doc for interactive Codex sessions.
117
+ ensure_about_car_file_for_repo(
118
+ repo_root,
119
+ doc_paths={
120
+ "todo": ca_dir / "TODO.md",
121
+ "progress": ca_dir / "PROGRESS.md",
122
+ "opinions": ca_dir / "OPINIONS.md",
123
+ "spec": ca_dir / "SPEC.md",
124
+ "summary": ca_dir / "SUMMARY.md",
125
+ },
126
+ force=force,
127
+ )
128
+
129
+
130
+ def seed_hub_files(hub_root: Path, force: bool = False) -> None:
131
+ """
132
+ Initialize a hub workspace with defaults and a manifest.
133
+ """
134
+ ca_dir = hub_root / ".codex-autorunner"
135
+ ca_dir.mkdir(parents=True, exist_ok=True)
136
+
137
+ gitignore_path = ca_dir / ".gitignore"
138
+ if not gitignore_path.exists() or force:
139
+ gitignore_path.write_text(GITIGNORE_CONTENT, encoding="utf-8")
140
+
141
+ write_hub_config(hub_root, force=force)
142
+
143
+ manifest_path = hub_root / DEFAULT_HUB_CONFIG["hub"]["manifest"]
144
+ load_manifest(manifest_path, hub_root)
145
+
146
+ hub_state_path = ca_dir / "hub_state.json"
147
+ if not hub_state_path.exists() or force:
148
+ atomic_write(
149
+ hub_state_path,
150
+ '{\n "last_scan_at": null,\n "repos": []\n}\n',
151
+ )