vidbyte-cli 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 (269) hide show
  1. vidbyte_cli/__init__.py +11 -0
  2. vidbyte_cli/__main__.py +6 -0
  3. vidbyte_cli/cli.py +18 -0
  4. vidbyte_cli/commands/__init__.py +86 -0
  5. vidbyte_cli/commands/agent_options.py +53 -0
  6. vidbyte_cli/commands/agents/__init__.py +31 -0
  7. vidbyte_cli/commands/agents/suggestion/__init__.py +38 -0
  8. vidbyte_cli/commands/agents/suggestion/prompts/__init__.py +3 -0
  9. vidbyte_cli/commands/agents/suggestion/prompts/all_categories.md +5 -0
  10. vidbyte_cli/commands/agents/suggestion/prompts/approaches.md +100 -0
  11. vidbyte_cli/commands/agents/suggestion/prompts/avoid.md +100 -0
  12. vidbyte_cli/commands/agents/suggestion/prompts/blockers.md +100 -0
  13. vidbyte_cli/commands/agents/suggestion/prompts/capability.md +100 -0
  14. vidbyte_cli/commands/agents/suggestion/prompts/categories.md +5 -0
  15. vidbyte_cli/commands/agents/suggestion/prompts/category.md +5 -0
  16. vidbyte_cli/commands/agents/suggestion/prompts/completed.md +100 -0
  17. vidbyte_cli/commands/agents/suggestion/prompts/constraint.md +100 -0
  18. vidbyte_cli/commands/agents/suggestion/prompts/context.md +100 -0
  19. vidbyte_cli/commands/agents/suggestion/prompts/count.md +5 -0
  20. vidbyte_cli/commands/agents/suggestion/prompts/critic_model.md +100 -0
  21. vidbyte_cli/commands/agents/suggestion/prompts/decision.md +100 -0
  22. vidbyte_cli/commands/agents/suggestion/prompts/dry_run.md +5 -0
  23. vidbyte_cli/commands/agents/suggestion/prompts/extra_compute.md +5 -0
  24. vidbyte_cli/commands/agents/suggestion/prompts/feedback_accept.md +7 -0
  25. vidbyte_cli/commands/agents/suggestion/prompts/feedback_group.md +7 -0
  26. vidbyte_cli/commands/agents/suggestion/prompts/feedback_project.md +100 -0
  27. vidbyte_cli/commands/agents/suggestion/prompts/feedback_reason.md +98 -0
  28. vidbyte_cli/commands/agents/suggestion/prompts/feedback_reject.md +7 -0
  29. vidbyte_cli/commands/agents/suggestion/prompts/feedback_suggestion.md +101 -0
  30. vidbyte_cli/commands/agents/suggestion/prompts/files.md +100 -0
  31. vidbyte_cli/commands/agents/suggestion/prompts/forbidden.md +100 -0
  32. vidbyte_cli/commands/agents/suggestion/prompts/goal.md +100 -0
  33. vidbyte_cli/commands/agents/suggestion/prompts/handoff.md +7 -0
  34. vidbyte_cli/commands/agents/suggestion/prompts/horizon.md +5 -0
  35. vidbyte_cli/commands/agents/suggestion/prompts/hypotheses.md +100 -0
  36. vidbyte_cli/commands/agents/suggestion/prompts/idea.md +100 -0
  37. vidbyte_cli/commands/agents/suggestion/prompts/in_progress.md +100 -0
  38. vidbyte_cli/commands/agents/suggestion/prompts/input.md +100 -0
  39. vidbyte_cli/commands/agents/suggestion/prompts/library.py +29 -0
  40. vidbyte_cli/commands/agents/suggestion/prompts/max_messages.md +5 -0
  41. vidbyte_cli/commands/agents/suggestion/prompts/max_output_tokens.md +5 -0
  42. vidbyte_cli/commands/agents/suggestion/prompts/max_total_tokens.md +5 -0
  43. vidbyte_cli/commands/agents/suggestion/prompts/mistakes.md +100 -0
  44. vidbyte_cli/commands/agents/suggestion/prompts/outcomes.md +100 -0
  45. vidbyte_cli/commands/agents/suggestion/prompts/project.md +100 -0
  46. vidbyte_cli/commands/agents/suggestion/prompts/project_create.md +7 -0
  47. vidbyte_cli/commands/agents/suggestion/prompts/project_description.md +98 -0
  48. vidbyte_cli/commands/agents/suggestion/prompts/project_group.md +7 -0
  49. vidbyte_cli/commands/agents/suggestion/prompts/project_key.md +96 -0
  50. vidbyte_cli/commands/agents/suggestion/prompts/project_list.md +7 -0
  51. vidbyte_cli/commands/agents/suggestion/prompts/project_title.md +99 -0
  52. vidbyte_cli/commands/agents/suggestion/prompts/provider.md +5 -0
  53. vidbyte_cli/commands/agents/suggestion/prompts/question.md +100 -0
  54. vidbyte_cli/commands/agents/suggestion/prompts/risks.md +100 -0
  55. vidbyte_cli/commands/agents/suggestion/prompts/rounds.md +5 -0
  56. vidbyte_cli/commands/agents/suggestion/prompts/run.md +5 -0
  57. vidbyte_cli/commands/agents/suggestion/prompts/success.md +100 -0
  58. vidbyte_cli/commands/agents/suggestion/prompts/timeout.md +5 -0
  59. vidbyte_cli/commands/agents/suggestion/prompts/trajectory.md +100 -0
  60. vidbyte_cli/commands/agents/suggestion/prompts/view.md +5 -0
  61. vidbyte_cli/commands/agents/suggestion/prompts/view_all.md +5 -0
  62. vidbyte_cli/commands/agents/suggestion/render.py +77 -0
  63. vidbyte_cli/commands/agents/suggestion/request_builder.py +240 -0
  64. vidbyte_cli/commands/agents/suggestion/suggest.py +154 -0
  65. vidbyte_cli/commands/agents/suggestion/suggestion_categories.py +77 -0
  66. vidbyte_cli/commands/agents/suggestion/suggestion_feedback.py +85 -0
  67. vidbyte_cli/commands/agents/suggestion/suggestion_handoff.py +67 -0
  68. vidbyte_cli/commands/agents/suggestion/suggestion_projects.py +95 -0
  69. vidbyte_cli/commands/auth/__init__.py +0 -0
  70. vidbyte_cli/commands/auth/login.py +100 -0
  71. vidbyte_cli/commands/auth/logout.py +41 -0
  72. vidbyte_cli/commands/auth/whoami.py +51 -0
  73. vidbyte_cli/commands/billing/__init__.py +20 -0
  74. vidbyte_cli/commands/billing/prompts/__init__.py +1 -0
  75. vidbyte_cli/commands/billing/prompts/confirm.md +16 -0
  76. vidbyte_cli/commands/billing/prompts/group.md +13 -0
  77. vidbyte_cli/commands/billing/prompts/idempotency_key.md +16 -0
  78. vidbyte_cli/commands/billing/prompts/library.py +18 -0
  79. vidbyte_cli/commands/billing/prompts/top_up.md +16 -0
  80. vidbyte_cli/commands/billing/top_up.py +65 -0
  81. vidbyte_cli/commands/config/__init__.py +0 -0
  82. vidbyte_cli/commands/config/get.py +45 -0
  83. vidbyte_cli/commands/config/set.py +39 -0
  84. vidbyte_cli/commands/provider/__init__.py +9 -0
  85. vidbyte_cli/commands/provider/login.py +102 -0
  86. vidbyte_cli/commands/provider/logout.py +45 -0
  87. vidbyte_cli/commands/provider/whoami.py +49 -0
  88. vidbyte_cli/commands/research/__init__.py +5 -0
  89. vidbyte_cli/commands/research/add.py +41 -0
  90. vidbyte_cli/commands/research/options.py +134 -0
  91. vidbyte_cli/commands/research/render.py +157 -0
  92. vidbyte_cli/commands/research/resume.py +37 -0
  93. vidbyte_cli/commands/research/start.py +37 -0
  94. vidbyte_cli/commands/research/status.py +32 -0
  95. vidbyte_cli/commands/research/thread.py +30 -0
  96. vidbyte_cli/commands/research/threads.py +35 -0
  97. vidbyte_cli/commands/research/watch.py +93 -0
  98. vidbyte_cli/commands/runtime/__init__.py +23 -0
  99. vidbyte_cli/commands/runtime/adversarial_team.py +41 -0
  100. vidbyte_cli/commands/runtime/doctor.py +44 -0
  101. vidbyte_cli/commands/runtime/list.py +47 -0
  102. vidbyte_cli/commands/runtime/persistence.py +141 -0
  103. vidbyte_cli/commands/runtime/same_host_ensemble.py +221 -0
  104. vidbyte_cli/commands/runtime/stages.py +553 -0
  105. vidbyte_cli/commands/runtime/task_board.py +1342 -0
  106. vidbyte_cli/commands/setup/__init__.py +0 -0
  107. vidbyte_cli/commands/setup/doctor.py +64 -0
  108. vidbyte_cli/commands/setup/prompts/__init__.py +1 -0
  109. vidbyte_cli/commands/setup/prompts/browser.md +7 -0
  110. vidbyte_cli/commands/setup/prompts/library.py +18 -0
  111. vidbyte_cli/commands/setup/prompts/star.md +13 -0
  112. vidbyte_cli/commands/setup/star.py +132 -0
  113. vidbyte_cli/lib/__init__.py +0 -0
  114. vidbyte_cli/lib/api/__init__.py +0 -0
  115. vidbyte_cli/lib/api/client.py +236 -0
  116. vidbyte_cli/lib/api/endpoints/__init__.py +0 -0
  117. vidbyte_cli/lib/api/endpoints/auth.py +24 -0
  118. vidbyte_cli/lib/api/endpoints/billing.py +36 -0
  119. vidbyte_cli/lib/api/endpoints/research.py +103 -0
  120. vidbyte_cli/lib/api/endpoints/runtime.py +113 -0
  121. vidbyte_cli/lib/api/problem.py +86 -0
  122. vidbyte_cli/lib/api/response.py +101 -0
  123. vidbyte_cli/lib/api/retry.py +116 -0
  124. vidbyte_cli/lib/api/runtime_payment.py +89 -0
  125. vidbyte_cli/lib/auth/__init__.py +16 -0
  126. vidbyte_cli/lib/auth/credentials.py +223 -0
  127. vidbyte_cli/lib/auth/input.py +59 -0
  128. vidbyte_cli/lib/auth/keyring_store.py +126 -0
  129. vidbyte_cli/lib/auth/provider_credentials.py +157 -0
  130. vidbyte_cli/lib/auth/provider_input.py +54 -0
  131. vidbyte_cli/lib/auth/provider_resolver.py +89 -0
  132. vidbyte_cli/lib/auth/provider_store.py +149 -0
  133. vidbyte_cli/lib/auth/provider_verifier.py +219 -0
  134. vidbyte_cli/lib/auth/resolver.py +63 -0
  135. vidbyte_cli/lib/auth/verifier.py +38 -0
  136. vidbyte_cli/lib/config/__init__.py +25 -0
  137. vidbyte_cli/lib/config/atomic.py +47 -0
  138. vidbyte_cli/lib/config/config.py +141 -0
  139. vidbyte_cli/lib/config/migration.py +81 -0
  140. vidbyte_cli/lib/config/models.py +145 -0
  141. vidbyte_cli/lib/config/paths.py +66 -0
  142. vidbyte_cli/lib/config/resolver.py +137 -0
  143. vidbyte_cli/lib/constants/__init__.py +1 -0
  144. vidbyte_cli/lib/constants/runtime.py +186 -0
  145. vidbyte_cli/lib/errors/__init__.py +12 -0
  146. vidbyte_cli/lib/errors/cli_error.py +86 -0
  147. vidbyte_cli/lib/errors/codes.py +43 -0
  148. vidbyte_cli/lib/errors/failures.py +2910 -0
  149. vidbyte_cli/lib/errors/handler.py +72 -0
  150. vidbyte_cli/lib/files/__init__.py +6 -0
  151. vidbyte_cli/lib/files/documents.py +94 -0
  152. vidbyte_cli/lib/files/store.py +156 -0
  153. vidbyte_cli/lib/io/__init__.py +16 -0
  154. vidbyte_cli/lib/io/attachments.py +129 -0
  155. vidbyte_cli/lib/io/codex_attachments.py +47 -0
  156. vidbyte_cli/lib/io/prompt.py +71 -0
  157. vidbyte_cli/lib/io/streams.py +37 -0
  158. vidbyte_cli/lib/io/terminal.py +66 -0
  159. vidbyte_cli/lib/output/__init__.py +7 -0
  160. vidbyte_cli/lib/output/formats.py +29 -0
  161. vidbyte_cli/lib/output/manager.py +95 -0
  162. vidbyte_cli/lib/output/models.py +49 -0
  163. vidbyte_cli/lib/runtime/__init__.py +9 -0
  164. vidbyte_cli/lib/runtime/application.py +134 -0
  165. vidbyte_cli/lib/runtime/context.py +250 -0
  166. vidbyte_cli/lib/runtime/options.py +159 -0
  167. vidbyte_cli/lib/runtime/version.py +30 -0
  168. vidbyte_cli/lib/runtime_primitives/__init__.py +28 -0
  169. vidbyte_cli/lib/runtime_primitives/executor.py +54 -0
  170. vidbyte_cli/lib/runtime_primitives/gate.py +105 -0
  171. vidbyte_cli/lib/runtime_primitives/hosts.py +45 -0
  172. vidbyte_cli/lib/runtime_primitives/planner.py +79 -0
  173. vidbyte_cli/lib/runtime_primitives/stages.py +338 -0
  174. vidbyte_cli/lib/runtime_primitives/task_board.py +982 -0
  175. vidbyte_cli/lib/runtime_primitives/task_board_checkpoints.py +473 -0
  176. vidbyte_cli/lib/runtime_primitives/task_board_system.md +33 -0
  177. vidbyte_cli/lib/runtime_primitives/task_board_tasks.py +111 -0
  178. vidbyte_cli/lib/runtime_primitives/verification.py +68 -0
  179. vidbyte_cli/services/__init__.py +5 -0
  180. vidbyte_cli/services/ensemble/__init__.py +7 -0
  181. vidbyte_cli/services/ensemble/prompts/__init__.py +6 -0
  182. vidbyte_cli/services/ensemble/prompts/implementer_system.md +546 -0
  183. vidbyte_cli/services/ensemble/prompts/implementer_turn.md +49 -0
  184. vidbyte_cli/services/ensemble/prompts/library.py +188 -0
  185. vidbyte_cli/services/ensemble/prompts/planner_system.md +728 -0
  186. vidbyte_cli/services/ensemble/prompts/planner_turn.md +6 -0
  187. vidbyte_cli/services/ensemble/prompts/role_system.md +104 -0
  188. vidbyte_cli/services/ensemble/prompts/role_turn.md +19 -0
  189. vidbyte_cli/services/ensemble/prompts/selector_final_turn.md +19 -0
  190. vidbyte_cli/services/ensemble/prompts/selector_round_turn.md +17 -0
  191. vidbyte_cli/services/ensemble/prompts/selector_system.md +89 -0
  192. vidbyte_cli/services/ensemble/runner.py +30 -0
  193. vidbyte_cli/services/ensemble/sdk.py +134 -0
  194. vidbyte_cli/services/ensemble/service.py +233 -0
  195. vidbyte_cli/services/ensemble/settings.py +60 -0
  196. vidbyte_cli/services/persistence/__init__.py +6 -0
  197. vidbyte_cli/services/persistence/prompts/__init__.py +6 -0
  198. vidbyte_cli/services/persistence/prompts/library.py +46 -0
  199. vidbyte_cli/services/persistence/prompts/persistence_system.md +1 -0
  200. vidbyte_cli/services/persistence/prompts/persistence_turn.md +3 -0
  201. vidbyte_cli/services/persistence/runner.py +35 -0
  202. vidbyte_cli/services/persistence/session.py +116 -0
  203. vidbyte_cli/services/suggestions/__init__.py +7 -0
  204. vidbyte_cli/services/suggestions/categories.py +270 -0
  205. vidbyte_cli/services/suggestions/context.py +222 -0
  206. vidbyte_cli/services/suggestions/extra_compute.py +53 -0
  207. vidbyte_cli/services/suggestions/handoff.py +173 -0
  208. vidbyte_cli/services/suggestions/message_tools.py +47 -0
  209. vidbyte_cli/services/suggestions/project.py +253 -0
  210. vidbyte_cli/services/suggestions/prompts/__init__.py +1 -0
  211. vidbyte_cli/services/suggestions/prompts/categories/__init__.py +3 -0
  212. vidbyte_cli/services/suggestions/prompts/categories/adjacent_opportunity.md +37 -0
  213. vidbyte_cli/services/suggestions/prompts/categories/alternative.md +38 -0
  214. vidbyte_cli/services/suggestions/prompts/categories/big_bets.md +37 -0
  215. vidbyte_cli/services/suggestions/prompts/categories/bottleneck.md +38 -0
  216. vidbyte_cli/services/suggestions/prompts/categories/business_growth.md +38 -0
  217. vidbyte_cli/services/suggestions/prompts/categories/completion.md +37 -0
  218. vidbyte_cli/services/suggestions/prompts/categories/continuation.md +37 -0
  219. vidbyte_cli/services/suggestions/prompts/categories/coordination.md +37 -0
  220. vidbyte_cli/services/suggestions/prompts/categories/creative_exploration.md +37 -0
  221. vidbyte_cli/services/suggestions/prompts/categories/cross_domain.md +37 -0
  222. vidbyte_cli/services/suggestions/prompts/categories/delegation.md +37 -0
  223. vidbyte_cli/services/suggestions/prompts/categories/experiment.md +37 -0
  224. vidbyte_cli/services/suggestions/prompts/categories/feedback.md +37 -0
  225. vidbyte_cli/services/suggestions/prompts/categories/goal_clarification.md +37 -0
  226. vidbyte_cli/services/suggestions/prompts/categories/immediate_next_steps.md +37 -0
  227. vidbyte_cli/services/suggestions/prompts/categories/investigation.md +37 -0
  228. vidbyte_cli/services/suggestions/prompts/categories/learning.md +37 -0
  229. vidbyte_cli/services/suggestions/prompts/categories/leverage.md +37 -0
  230. vidbyte_cli/services/suggestions/prompts/categories/long_term_directions.md +37 -0
  231. vidbyte_cli/services/suggestions/prompts/categories/preparation.md +37 -0
  232. vidbyte_cli/services/suggestions/prompts/categories/prerequisite.md +37 -0
  233. vidbyte_cli/services/suggestions/prompts/categories/prioritization.md +37 -0
  234. vidbyte_cli/services/suggestions/prompts/categories/product_experience.md +37 -0
  235. vidbyte_cli/services/suggestions/prompts/categories/quick_wins.md +37 -0
  236. vidbyte_cli/services/suggestions/prompts/categories/reframing.md +37 -0
  237. vidbyte_cli/services/suggestions/prompts/categories/risk_prevention.md +37 -0
  238. vidbyte_cli/services/suggestions/prompts/categories/simplification.md +37 -0
  239. vidbyte_cli/services/suggestions/prompts/categories/stop_or_defer.md +37 -0
  240. vidbyte_cli/services/suggestions/prompts/categories/strategy.md +37 -0
  241. vidbyte_cli/services/suggestions/prompts/categories/technical_possibilities.md +37 -0
  242. vidbyte_cli/services/suggestions/prompts/categories/verification.md +37 -0
  243. vidbyte_cli/services/suggestions/prompts/critic.md +209 -0
  244. vidbyte_cli/services/suggestions/prompts/critic_message.md +8 -0
  245. vidbyte_cli/services/suggestions/prompts/generator.md +64 -0
  246. vidbyte_cli/services/suggestions/prompts/library.py +72 -0
  247. vidbyte_cli/services/suggestions/prompts/message_generator_argument.md +1 -0
  248. vidbyte_cli/services/suggestions/prompts/message_generator_tool.md +1 -0
  249. vidbyte_cli/services/suggestions/prompts/message_parent_argument.md +1 -0
  250. vidbyte_cli/services/suggestions/prompts/message_parent_tool.md +1 -0
  251. vidbyte_cli/services/suggestions/prompts/message_receipt.md +1 -0
  252. vidbyte_cli/services/suggestions/prompts/revision.md +8 -0
  253. vidbyte_cli/services/suggestions/sdk.py +228 -0
  254. vidbyte_cli/services/suggestions/selection.py +78 -0
  255. vidbyte_cli/services/suggestions/service.py +540 -0
  256. vidbyte_cli/types/__init__.py +0 -0
  257. vidbyte_cli/types/api.py +101 -0
  258. vidbyte_cli/types/attachments.py +79 -0
  259. vidbyte_cli/types/ensemble.py +189 -0
  260. vidbyte_cli/types/provider.py +62 -0
  261. vidbyte_cli/types/research.py +260 -0
  262. vidbyte_cli/types/runtime.py +1098 -0
  263. vidbyte_cli/types/suggestions.py +518 -0
  264. vidbyte_cli-0.1.0.dist-info/METADATA +335 -0
  265. vidbyte_cli-0.1.0.dist-info/RECORD +269 -0
  266. vidbyte_cli-0.1.0.dist-info/WHEEL +5 -0
  267. vidbyte_cli-0.1.0.dist-info/entry_points.txt +2 -0
  268. vidbyte_cli-0.1.0.dist-info/licenses/LICENSE +21 -0
  269. vidbyte_cli-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,186 @@
1
+ """Canonical values for admission checks and persistent Codex execution.
2
+
3
+ Commands and the persistence adapter share progress copy; gate checks share reasons.
4
+ Provider credentials and model prompts never belong in this module.
5
+ """
6
+
7
+ from enum import IntEnum, StrEnum
8
+
9
+
10
+ class AdmissionReason(StrEnum):
11
+ """Closed vocabulary for local receipt checks, with explicit success."""
12
+
13
+ PASSED = "passed"
14
+ MISSING = "grant_missing"
15
+ CAPABILITY_MISMATCH = "grant_capability_mismatch"
16
+ PRICE_MISMATCH = "grant_price_mismatch"
17
+ LOCATION_OR_ID_INVALID = "grant_location_or_id_invalid"
18
+ TOKEN_MISSING = "grant_token_missing"
19
+ TIME_INVALID = "grant_time_invalid"
20
+ EXPIRED = "grant_expired"
21
+ TTL_INVALID = "grant_ttl_invalid"
22
+ VERIFICATION_KEY_MISSING = "grant_verification_key_missing"
23
+ SIGNATURE_INVALID = "grant_signature_invalid"
24
+ SIGNED_CLAIMS_MISMATCH = "grant_signed_claims_mismatch"
25
+ RECEIPT_MISMATCH = "grant_receipt_mismatch"
26
+
27
+
28
+ class PersistenceLimit(IntEnum):
29
+ """Execution bounds independent of the agent's answer content."""
30
+
31
+ TURN_TIMEOUT_SECONDS = 3600
32
+
33
+
34
+ class AttachmentLimit(IntEnum):
35
+ """Boundaries for one explicit attachment bundle before an agent starts."""
36
+
37
+ MAX_FILES = 50
38
+ MAX_FILE_BYTES = 1_000_000
39
+ MAX_TOTAL_BYTES = 8_000_000
40
+
41
+
42
+ class AttachmentImageSuffix(StrEnum):
43
+ """Image suffixes that the Codex adapter can pass as native local-image inputs."""
44
+
45
+ GIF = ".gif"
46
+ JPEG = ".jpeg"
47
+ JPG = ".jpg"
48
+ PNG = ".png"
49
+ WEBP = ".webp"
50
+
51
+
52
+ class PersistenceCodexConfig(StrEnum):
53
+ """Child-only provider configuration; no native login state is changed."""
54
+
55
+ PROVIDER = 'model_provider="vidbyte_openai"'
56
+ NAME = 'model_providers.vidbyte_openai.name="OpenAI"'
57
+ BASE_URL = 'model_providers.vidbyte_openai.base_url="https://api.openai.com/v1"'
58
+ ENV_KEY = 'model_providers.vidbyte_openai.env_key="OPENAI_API_KEY"'
59
+ WIRE_API = 'model_providers.vidbyte_openai.wire_api="responses"'
60
+
61
+
62
+ class TaskBoardLimit(IntEnum):
63
+ """Execution bounds for one ordered task-board invocation."""
64
+
65
+ # One board task is a whole unit of agent work, not a chat turn: a decomposed task can
66
+ # legitimately hold a coding agent for days. Five days is the ceiling that stops a wedged
67
+ # child process from running forever, not a budget the caller is expected to approach.
68
+ TURN_TIMEOUT_SECONDS = 5 * 24 * 60 * 60
69
+ MAX_TASKS = 500
70
+ # A board task is one whole Markdown task file's worth of instructions, so it shares the
71
+ # 20,000-character contract every other local runtime task already uses.
72
+ MAX_TASK_CHARS = 20_000
73
+ MAX_WINDOW = 25
74
+ MIN_SUBTASKS = 2
75
+ MAX_SUBTASKS = 10
76
+
77
+
78
+ class TaskBoardCodexConfig(StrEnum):
79
+ """Child-only provider configuration; no native login state is changed."""
80
+
81
+ PROVIDER = 'model_provider="vidbyte_openai"'
82
+ NAME = 'model_providers.vidbyte_openai.name="OpenAI"'
83
+ BASE_URL = 'model_providers.vidbyte_openai.base_url="https://api.openai.com/v1"'
84
+ ENV_KEY = 'model_providers.vidbyte_openai.env_key="OPENAI_API_KEY"'
85
+ WIRE_API = 'model_providers.vidbyte_openai.wire_api="responses"'
86
+
87
+
88
+ class TaskBoardProgress(StrEnum):
89
+ """Product-facing milestones; task copy describes intent, not observed work."""
90
+
91
+ PREPARING = (
92
+ "Preparing your task board and checking that Codex can run in this working directory."
93
+ )
94
+ CREDENTIALS = "Loading your OpenAI credentials to run the board with your own API account."
95
+ ADMISSION = "Requesting the two-cent Vidbyte admission for this task-board run."
96
+ VERIFYING = "Verifying your admission receipt before starting work on your board."
97
+ ADMITTED = "Your admission is verified. Preparing Codex to work through your board."
98
+ TASK_STARTING = "Working through board tasks in order with Codex."
99
+ TASK_RETRYING = "Retrying the current board task with the same prior summaries."
100
+ DAG_PLAN_READY = (
101
+ "Board dependencies checked. Running each task after the tasks it depends on with Codex."
102
+ )
103
+ TASK_SKIPPED = (
104
+ "Skipping a board task whose dependency did not complete. "
105
+ "Continuing with tasks that can still run."
106
+ )
107
+ TASK_FAILED = (
108
+ "A board task did not complete after retries. "
109
+ "Recording what happened and continuing with the remaining tasks."
110
+ )
111
+ DECOMPOSE_ISOLATED = (
112
+ "Decomposition is on: agents see only their own task; window context is off."
113
+ )
114
+ COMPLETE = "Codex has worked through the requested board tasks. Returning the summaries."
115
+
116
+
117
+ class PersistenceProgress(StrEnum):
118
+ """Product-facing milestones; continuation copy describes intent, not observed work."""
119
+
120
+ PREPARING = "Preparing your task and checking that Codex can run in this working directory."
121
+ CREDENTIALS = "Loading your OpenAI credentials to run the task with your own API account."
122
+ ADMISSION = "Requesting the two-cent Vidbyte admission for this persistence session."
123
+ X402_ADMISSION = "Paying the two-cent admission through x402."
124
+ VERIFYING = "Verifying your admission payment in Vidbyte before starting work on your task."
125
+ ADMITTED = "Your admission is verified. Preparing Codex to work on your task."
126
+ STARTING = "Starting your original task in Codex, with your request preserved exactly."
127
+ INITIAL_COMPLETE = (
128
+ "Codex has returned its first response. Continuing in the same conversation "
129
+ "to give it more opportunities to improve the result."
130
+ )
131
+ EARLY = (
132
+ "Asking Codex to build on its work and look for ways to better satisfy your original task."
133
+ )
134
+ MIDDLE = (
135
+ "Continuing the same task with another request to revisit gaps and strengthen the result."
136
+ )
137
+ LATE = "Giving Codex more time to refine its work while keeping your original request in view."
138
+ FINAL = "Requesting the final improvement pass before returning the result to you."
139
+ COMPLETE = "Codex has completed the requested persistence passes. Returning its final response."
140
+
141
+
142
+ class RuntimePaymentConfig:
143
+ """Reviewed EVM payment bounds; cents remain separate from provider token usage."""
144
+
145
+ PRIVATE_KEY_ENV = "VIDBYTE_X402_PRIVATE_KEY"
146
+ NETWORK_ENV = "VIDBYTE_X402_NETWORK"
147
+ DEFAULT_NETWORK = "eip155:8453"
148
+ NETWORKS = ("eip155:8453", "eip155:84532")
149
+ MAX_CHALLENGE_CHARACTERS = 16384
150
+ MAX_AUTHORIZATION_SECONDS = 3600
151
+ MICROUNITS_PER_CENT = 10000
152
+ PERSISTENCE_CENTS = 2
153
+
154
+
155
+ class StagesLimit(IntEnum):
156
+ """Execution bounds for the stages primitive."""
157
+
158
+ # Review of PR #36 raised this ceiling from 10 to 25: a staged skill such as a design-doc
159
+ # flow decomposes further than the original estimate, and every stage past the ceiling has
160
+ # to be split across two paid runs. The admission stays one cent however many stages run.
161
+ MAX_STAGES = 25
162
+ TURN_TIMEOUT_SECONDS = 3600
163
+
164
+
165
+ class StagesCodexConfig(StrEnum):
166
+ """Child-only provider configuration; no native login state is changed."""
167
+
168
+ PROVIDER = 'model_provider="vidbyte_openai"'
169
+ NAME = 'model_providers.vidbyte_openai.name="OpenAI"'
170
+ BASE_URL = 'model_providers.vidbyte_openai.base_url="https://api.openai.com/v1"'
171
+ ENV_KEY = 'model_providers.vidbyte_openai.env_key="OPENAI_API_KEY"'
172
+ WIRE_API = 'model_providers.vidbyte_openai.wire_api="responses"'
173
+
174
+
175
+ class StagesProgress(StrEnum):
176
+ """Product-facing milestones for staged local execution."""
177
+
178
+ PREPARING = "Preparing your task and checking that Codex can run in this working directory."
179
+ CREDENTIALS = "Loading your OpenAI credentials to run the stages with your own API account."
180
+ ADMISSION = "Requesting the one-cent Vidbyte admission for this stages run."
181
+ VERIFYING = "Verifying your admission receipt before starting the first stage."
182
+ ADMITTED = "Your admission is verified. Preparing a fresh Codex agent per stage."
183
+ STAGE_STARTING = "Starting the next stage with its own Codex agent."
184
+ STAGE_RETRYING = "Retrying the current stage with a fresh Codex agent."
185
+ STAGE_COMPLETE = "A stage returned its response. Continuing with the next stage."
186
+ COMPLETE = "Codex has completed every requested stage. Returning the final response."
@@ -0,0 +1,12 @@
1
+ """Public typed-error contracts. Importing this pulls in Click and the output layer.
2
+
3
+ Keep it out of the minimal `import vidbyte_cli` path: the package root resolves a version
4
+ without loading command or presentation dependencies. Concrete failures live in
5
+ `failures.py` and are imported from there directly by the code that raises them.
6
+ """
7
+
8
+ from .cli_error import CliError
9
+ from .codes import CliErrorCode, ExitCode
10
+ from .handler import ErrorHandler
11
+
12
+ __all__ = ["CliError", "CliErrorCode", "ErrorHandler", "ExitCode"]
@@ -0,0 +1,86 @@
1
+ """The user-safe exception every command and service raises instead of printing.
2
+
3
+ A CliError serves two callers at once. A human gets `message` and `hint`; an agent also gets
4
+ the non-sensitive `description`/`trace`/`file_path` triple, which is what lets it repair its
5
+ own invocation without a transcript. Subclasses in `failures.py` own that prose, so a raise
6
+ site stays one line and every failure of a kind reads identically.
7
+
8
+ `cause` is the one field that may hold backend, credential, or filesystem detail. It is
9
+ private on purpose: no renderer may serialize it, and debug traces show frames only.
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ import inspect
15
+ from pathlib import Path
16
+ from types import FrameType
17
+ from typing import ClassVar
18
+
19
+ from pydantic import JsonValue
20
+
21
+ from .codes import CliErrorCode, ExitCode
22
+
23
+ # Frames inside this package are error plumbing, never the site that actually failed.
24
+ _ERRORS_PACKAGE = Path(__file__).resolve().parent
25
+ # `.../vidbyte_cli/lib/errors` -> the directory holding the package, so reported paths are
26
+ # relative and identical whether the CLI runs from a checkout or an installed wheel.
27
+ _PACKAGE_PARENT = _ERRORS_PACKAGE.parents[2]
28
+
29
+
30
+ class CliError(Exception):
31
+ """A classified CLI failure whose message and metadata are safe to display."""
32
+
33
+ # Subclasses fix the classification; only Click may override exit_code per instance.
34
+ code: ClassVar[CliErrorCode] = CliErrorCode.OPERATION_FAILED
35
+ exit_status: ClassVar[ExitCode] = ExitCode.OPERATIONAL_FAILURE
36
+ retryable: ClassVar[bool] = False
37
+
38
+ def __init__(
39
+ self,
40
+ message: str,
41
+ description: str,
42
+ trace: str,
43
+ *,
44
+ exit_code: int | None = None,
45
+ hint: str | None = None,
46
+ request_id: str | None = None,
47
+ remediation: dict[str, JsonValue] | None = None,
48
+ cause: Exception | None = None,
49
+ ) -> None:
50
+ super().__init__(message)
51
+ self.message = message
52
+ self.description = description
53
+ self.trace = trace
54
+ self.file_path = self._origin_file()
55
+ self.exit_code = int(self.exit_status if exit_code is None else exit_code)
56
+ self.hint = hint
57
+ self.request_id = request_id
58
+ self.remediation = remediation
59
+ self.cause = cause
60
+
61
+ @property
62
+ def code_value(self) -> str:
63
+ # Output protocols depend on a plain string without importing this enum package.
64
+ return self.code.value
65
+
66
+ @staticmethod
67
+ def _origin_file() -> str:
68
+ # An agent's next action is opening a file, and a path hand-written per subclass goes
69
+ # stale the moment code moves. The first frame outside this package is the command or
70
+ # service that actually failed, so derive it instead of declaring it.
71
+ frame: FrameType | None = inspect.currentframe()
72
+ while frame is not None:
73
+ # Resolve before comparing: a frame's filename may be relative to the cwd.
74
+ path = Path(frame.f_code.co_filename).resolve()
75
+ if path.parent != _ERRORS_PACKAGE:
76
+ return CliError._package_path(path)
77
+ frame = frame.f_back
78
+ return CliError._package_path(Path(__file__).resolve())
79
+
80
+ @staticmethod
81
+ def _package_path(path: Path) -> str:
82
+ # Frames outside the package (Click, the interpreter) have no meaningful repository
83
+ # location, so report the bare filename rather than an absolute machine path.
84
+ if not path.is_relative_to(_PACKAGE_PARENT):
85
+ return path.name
86
+ return path.relative_to(_PACKAGE_PARENT).as_posix()
@@ -0,0 +1,43 @@
1
+ """The stable error and exit vocabulary the CLI publishes to shells and agents.
2
+
3
+ Every value here is a public contract: a shipped code string may not be reworded and a
4
+ shipped exit number may not be reassigned. Prose belongs to the `CliError` subclasses in
5
+ `failures.py`, so automation branches on identity while messages keep improving.
6
+
7
+ Several codes deliberately share one exit status — statuses are coarse shell signals, codes
8
+ are precise machine semantics.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ from enum import IntEnum, StrEnum
14
+
15
+
16
+ class CliErrorCode(StrEnum):
17
+ """Stable failure identity for users and automation."""
18
+
19
+ INVALID_ARGUMENT = "INVALID_ARGUMENT"
20
+ AUTH_REQUIRED = "AUTH_REQUIRED"
21
+ CREDIT_EXHAUSTED = "CREDIT_EXHAUSTED"
22
+ API_UNAVAILABLE = "API_UNAVAILABLE"
23
+ API_PROTOCOL_ERROR = "API_PROTOCOL_ERROR"
24
+ CONFIG_INVALID = "CONFIG_INVALID"
25
+ CONFIG_WRITE_CONFLICT = "CONFIG_WRITE_CONFLICT"
26
+ CREDENTIAL_STORE_UNAVAILABLE = "CREDENTIAL_STORE_UNAVAILABLE"
27
+ OPERATION_FAILED = "OPERATION_FAILED"
28
+ NOT_IMPLEMENTED = "NOT_IMPLEMENTED"
29
+ INTERRUPTED = "INTERRUPTED"
30
+ INTERNAL_ERROR = "INTERNAL_ERROR"
31
+
32
+
33
+ class ExitCode(IntEnum):
34
+ """Stable shell statuses documented by the CLI."""
35
+
36
+ SUCCESS = 0
37
+ OPERATIONAL_FAILURE = 1
38
+ USAGE = 2
39
+ PARTIAL_OUTCOME = 3
40
+ AUTHENTICATION = 4
41
+ CREDIT_EXHAUSTED = 5
42
+ SOFTWARE = 70
43
+ INTERRUPTED = 130