@vibecodr/cli 0.2.11 → 1.0.0

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 (256) hide show
  1. package/CHANGELOG.md +57 -23
  2. package/MIGRATION.md +73 -0
  3. package/README.md +89 -72
  4. package/dist/auth/official-client.d.ts +6 -0
  5. package/dist/auth/official-client.d.ts.map +1 -0
  6. package/dist/auth/official-client.js +1 -0
  7. package/dist/auth/official-client.js.map +1 -0
  8. package/dist/auth/token-manager.d.ts +40 -0
  9. package/dist/auth/token-manager.d.ts.map +1 -0
  10. package/dist/auth/token-manager.js +1 -2
  11. package/dist/auth/token-manager.js.map +1 -0
  12. package/dist/bin/vc-tools.d.ts +3 -0
  13. package/dist/bin/vc-tools.d.ts.map +1 -0
  14. package/dist/bin/vc-tools.js +7 -0
  15. package/dist/bin/vc-tools.js.map +1 -0
  16. package/dist/bin/vibecodr-mcp.d.ts +3 -0
  17. package/dist/bin/vibecodr-mcp.d.ts.map +1 -0
  18. package/dist/bin/vibecodr-mcp.js +37 -0
  19. package/dist/bin/vibecodr-mcp.js.map +1 -0
  20. package/dist/cli/errors.d.ts +28 -0
  21. package/dist/cli/errors.d.ts.map +1 -0
  22. package/dist/cli/errors.js +1 -0
  23. package/dist/cli/errors.js.map +1 -0
  24. package/dist/cli/output.d.ts +16 -0
  25. package/dist/cli/output.d.ts.map +1 -0
  26. package/dist/cli/output.js +1 -0
  27. package/dist/cli/output.js.map +1 -0
  28. package/dist/cli/parse.d.ts +18 -0
  29. package/dist/cli/parse.d.ts.map +1 -0
  30. package/dist/cli/parse.js +1 -0
  31. package/dist/cli/parse.js.map +1 -0
  32. package/dist/clients/base.d.ts +20 -0
  33. package/dist/clients/base.d.ts.map +1 -0
  34. package/dist/clients/base.js +1 -0
  35. package/dist/clients/base.js.map +1 -0
  36. package/dist/clients/claude-code.d.ts +5 -0
  37. package/dist/clients/claude-code.d.ts.map +1 -0
  38. package/dist/clients/claude-code.js +88 -0
  39. package/dist/clients/claude-code.js.map +1 -0
  40. package/dist/clients/claude-desktop.d.ts +5 -0
  41. package/dist/clients/claude-desktop.d.ts.map +1 -0
  42. package/dist/clients/claude-desktop.js +97 -0
  43. package/dist/clients/claude-desktop.js.map +1 -0
  44. package/dist/clients/codex.d.ts +5 -0
  45. package/dist/clients/codex.d.ts.map +1 -0
  46. package/dist/clients/codex.js +1 -0
  47. package/dist/clients/codex.js.map +1 -0
  48. package/dist/clients/cursor.d.ts +5 -0
  49. package/dist/clients/cursor.d.ts.map +1 -0
  50. package/dist/clients/cursor.js +1 -1
  51. package/dist/clients/cursor.js.map +1 -0
  52. package/dist/clients/vscode.d.ts +5 -0
  53. package/dist/clients/vscode.d.ts.map +1 -0
  54. package/dist/clients/vscode.js +5 -1
  55. package/dist/clients/vscode.js.map +1 -0
  56. package/dist/clients/windsurf.d.ts +5 -0
  57. package/dist/clients/windsurf.d.ts.map +1 -0
  58. package/dist/clients/windsurf.js +1 -0
  59. package/dist/clients/windsurf.js.map +1 -0
  60. package/dist/commands/call.d.ts +9 -0
  61. package/dist/commands/call.d.ts.map +1 -0
  62. package/dist/commands/call.js +1 -0
  63. package/dist/commands/call.js.map +1 -0
  64. package/dist/commands/config.d.ts +3 -0
  65. package/dist/commands/config.d.ts.map +1 -0
  66. package/dist/commands/config.js +1 -0
  67. package/dist/commands/config.js.map +1 -0
  68. package/dist/commands/context.d.ts +15 -0
  69. package/dist/commands/context.d.ts.map +1 -0
  70. package/dist/commands/context.js +2 -5
  71. package/dist/commands/context.js.map +1 -0
  72. package/dist/commands/doctor.d.ts +3 -0
  73. package/dist/commands/doctor.d.ts.map +1 -0
  74. package/dist/commands/doctor.js +2 -1
  75. package/dist/commands/doctor.js.map +1 -0
  76. package/dist/commands/help.d.ts +3 -0
  77. package/dist/commands/help.d.ts.map +1 -0
  78. package/dist/commands/help.js +1 -0
  79. package/dist/commands/help.js.map +1 -0
  80. package/dist/commands/install.d.ts +3 -0
  81. package/dist/commands/install.d.ts.map +1 -0
  82. package/dist/commands/install.js +23 -5
  83. package/dist/commands/install.js.map +1 -0
  84. package/dist/commands/login.d.ts +3 -0
  85. package/dist/commands/login.d.ts.map +1 -0
  86. package/dist/commands/login.js +1 -0
  87. package/dist/commands/login.js.map +1 -0
  88. package/dist/commands/logout.d.ts +3 -0
  89. package/dist/commands/logout.d.ts.map +1 -0
  90. package/dist/commands/logout.js +1 -0
  91. package/dist/commands/logout.js.map +1 -0
  92. package/dist/commands/pulse-publish.d.ts +3 -0
  93. package/dist/commands/pulse-publish.d.ts.map +1 -0
  94. package/dist/commands/pulse-publish.js +1 -0
  95. package/dist/commands/pulse-publish.js.map +1 -0
  96. package/dist/commands/pulse-setup.d.ts +3 -0
  97. package/dist/commands/pulse-setup.d.ts.map +1 -0
  98. package/dist/commands/pulse-setup.js +5 -3
  99. package/dist/commands/pulse-setup.js.map +1 -0
  100. package/dist/commands/pulse.d.ts +3 -0
  101. package/dist/commands/pulse.d.ts.map +1 -0
  102. package/dist/commands/pulse.js +1 -0
  103. package/dist/commands/pulse.js.map +1 -0
  104. package/dist/commands/status.d.ts +3 -0
  105. package/dist/commands/status.d.ts.map +1 -0
  106. package/dist/commands/status.js +1 -0
  107. package/dist/commands/status.js.map +1 -0
  108. package/dist/commands/tools.d.ts +3 -0
  109. package/dist/commands/tools.d.ts.map +1 -0
  110. package/dist/commands/tools.js +1 -0
  111. package/dist/commands/tools.js.map +1 -0
  112. package/dist/commands/uninstall.d.ts +3 -0
  113. package/dist/commands/uninstall.d.ts.map +1 -0
  114. package/dist/commands/uninstall.js +12 -4
  115. package/dist/commands/uninstall.js.map +1 -0
  116. package/dist/commands/upload.d.ts +3 -0
  117. package/dist/commands/upload.d.ts.map +1 -0
  118. package/dist/commands/upload.js +1 -0
  119. package/dist/commands/upload.js.map +1 -0
  120. package/dist/commands/whoami.d.ts +3 -0
  121. package/dist/commands/whoami.d.ts.map +1 -0
  122. package/dist/commands/whoami.js +82 -0
  123. package/dist/commands/whoami.js.map +1 -0
  124. package/dist/core/interactive-input.d.ts +7 -0
  125. package/dist/core/interactive-input.d.ts.map +1 -0
  126. package/dist/core/interactive-input.js +1 -0
  127. package/dist/core/interactive-input.js.map +1 -0
  128. package/dist/core/mcp-client.d.ts +17 -0
  129. package/dist/core/mcp-client.d.ts.map +1 -0
  130. package/dist/core/mcp-client.js +1 -0
  131. package/dist/core/mcp-client.js.map +1 -0
  132. package/dist/core/redaction.d.ts +2 -0
  133. package/dist/core/redaction.d.ts.map +1 -0
  134. package/dist/core/redaction.js +36 -2
  135. package/dist/core/redaction.js.map +1 -0
  136. package/dist/core/renderers.d.ts +8 -0
  137. package/dist/core/renderers.d.ts.map +1 -0
  138. package/dist/core/renderers.js +1 -0
  139. package/dist/core/renderers.js.map +1 -0
  140. package/dist/doctor/run.d.ts +10 -0
  141. package/dist/doctor/run.d.ts.map +1 -0
  142. package/dist/doctor/run.js +12 -3
  143. package/dist/doctor/run.js.map +1 -0
  144. package/dist/legacy/cli/errors.d.ts +9 -0
  145. package/dist/legacy/cli/errors.d.ts.map +1 -0
  146. package/dist/legacy/cli/errors.js +23 -0
  147. package/dist/legacy/cli/errors.js.map +1 -0
  148. package/dist/legacy/cli/install.d.ts +24 -0
  149. package/dist/legacy/cli/install.d.ts.map +1 -0
  150. package/dist/legacy/cli/install.js +307 -0
  151. package/dist/legacy/cli/install.js.map +1 -0
  152. package/dist/legacy/cli/output.d.ts +17 -0
  153. package/dist/legacy/cli/output.d.ts.map +1 -0
  154. package/dist/legacy/cli/output.js +36 -0
  155. package/dist/legacy/cli/output.js.map +1 -0
  156. package/dist/legacy/cli/parser.d.ts +33 -0
  157. package/dist/legacy/cli/parser.d.ts.map +1 -0
  158. package/dist/legacy/cli/parser.js +177 -0
  159. package/dist/legacy/cli/parser.js.map +1 -0
  160. package/dist/legacy/cli/run.d.ts +11 -0
  161. package/dist/legacy/cli/run.d.ts.map +1 -0
  162. package/dist/legacy/cli/run.js +2947 -0
  163. package/dist/legacy/cli/run.js.map +1 -0
  164. package/dist/legacy/config/credential-store.d.ts +8 -0
  165. package/dist/legacy/config/credential-store.d.ts.map +1 -0
  166. package/dist/legacy/config/credential-store.js +52 -0
  167. package/dist/legacy/config/credential-store.js.map +1 -0
  168. package/dist/legacy/config/store.d.ts +63 -0
  169. package/dist/legacy/config/store.d.ts.map +1 -0
  170. package/dist/legacy/config/store.js +311 -0
  171. package/dist/legacy/config/store.js.map +1 -0
  172. package/dist/legacy/core/api-client.d.ts +45 -0
  173. package/dist/legacy/core/api-client.d.ts.map +1 -0
  174. package/dist/legacy/core/api-client.js +204 -0
  175. package/dist/legacy/core/api-client.js.map +1 -0
  176. package/dist/legacy/core/contracts.d.ts +488 -0
  177. package/dist/legacy/core/contracts.d.ts.map +1 -0
  178. package/dist/legacy/core/contracts.js +386 -0
  179. package/dist/legacy/core/contracts.js.map +1 -0
  180. package/dist/legacy/core/goal-coverage.d.ts +15 -0
  181. package/dist/legacy/core/goal-coverage.d.ts.map +1 -0
  182. package/dist/legacy/core/goal-coverage.js +169 -0
  183. package/dist/legacy/core/goal-coverage.js.map +1 -0
  184. package/dist/legacy/core/redaction.d.ts +4 -0
  185. package/dist/legacy/core/redaction.d.ts.map +1 -0
  186. package/dist/legacy/core/redaction.js +121 -0
  187. package/dist/legacy/core/redaction.js.map +1 -0
  188. package/dist/legacy/core/validators.d.ts +8 -0
  189. package/dist/legacy/core/validators.d.ts.map +1 -0
  190. package/dist/legacy/core/validators.js +102 -0
  191. package/dist/legacy/core/validators.js.map +1 -0
  192. package/dist/legacy/core/version.d.ts +3 -0
  193. package/dist/legacy/core/version.d.ts.map +1 -0
  194. package/dist/legacy/core/version.js +3 -0
  195. package/dist/legacy/core/version.js.map +1 -0
  196. package/dist/legacy/index.d.ts +8 -0
  197. package/dist/legacy/index.d.ts.map +1 -0
  198. package/dist/legacy/index.js +8 -0
  199. package/dist/legacy/index.js.map +1 -0
  200. package/dist/platform/browser.d.ts +7 -0
  201. package/dist/platform/browser.d.ts.map +1 -0
  202. package/dist/platform/browser.js +1 -0
  203. package/dist/platform/browser.js.map +1 -0
  204. package/dist/platform/exec.d.ts +3 -0
  205. package/dist/platform/exec.d.ts.map +1 -0
  206. package/dist/platform/exec.js +10 -1
  207. package/dist/platform/exec.js.map +1 -0
  208. package/dist/platform/paths.d.ts +9 -0
  209. package/dist/platform/paths.d.ts.map +1 -0
  210. package/dist/platform/paths.js +13 -0
  211. package/dist/platform/paths.js.map +1 -0
  212. package/dist/platform/prompt.d.ts +5 -0
  213. package/dist/platform/prompt.d.ts.map +1 -0
  214. package/dist/platform/prompt.js +1 -0
  215. package/dist/platform/prompt.js.map +1 -0
  216. package/dist/storage/config-store.d.ts +15 -0
  217. package/dist/storage/config-store.d.ts.map +1 -0
  218. package/dist/storage/config-store.js +1 -0
  219. package/dist/storage/config-store.js.map +1 -0
  220. package/dist/storage/file-lock.d.ts +7 -0
  221. package/dist/storage/file-lock.d.ts.map +1 -0
  222. package/dist/storage/file-lock.js +1 -0
  223. package/dist/storage/file-lock.js.map +1 -0
  224. package/dist/storage/install-manifest.d.ts +12 -0
  225. package/dist/storage/install-manifest.d.ts.map +1 -0
  226. package/dist/storage/install-manifest.js +1 -0
  227. package/dist/storage/install-manifest.js.map +1 -0
  228. package/dist/storage/secret-store.d.ts +36 -0
  229. package/dist/storage/secret-store.d.ts.map +1 -0
  230. package/dist/storage/secret-store.js +1 -0
  231. package/dist/storage/secret-store.js.map +1 -0
  232. package/dist/types/auth.d.ts +55 -0
  233. package/dist/types/auth.d.ts.map +1 -0
  234. package/dist/types/auth.js +1 -0
  235. package/dist/types/auth.js.map +1 -0
  236. package/dist/types/config.d.ts +29 -0
  237. package/dist/types/config.d.ts.map +1 -0
  238. package/dist/types/config.js +1 -0
  239. package/dist/types/config.js.map +1 -0
  240. package/dist/types/install.d.ts +26 -0
  241. package/dist/types/install.d.ts.map +1 -0
  242. package/dist/types/install.js +1 -0
  243. package/dist/types/install.js.map +1 -0
  244. package/docs/API-CONTRACT.md +606 -0
  245. package/docs/CLOUDFLARE-PRIMITIVE-FIT.md +212 -0
  246. package/docs/RELEASE-CHECKLIST.md +297 -0
  247. package/docs/SECURITY.md +227 -0
  248. package/docs/VALIDATION-MATRIX.md +58 -0
  249. package/docs/commands.md +49 -29
  250. package/docs/legacy/AGENT-TOOLKIT-RFC.md +1395 -0
  251. package/docs/legacy/CLI-GUIDELINES-AUDIT.md +95 -0
  252. package/docs/legacy/COMPLETION-AUDIT.md +542 -0
  253. package/docs/legacy/vc-tools-finetune.md +982 -0
  254. package/docs/legacy/vc-tools-goal-browser-run-containers.md +465 -0
  255. package/docs/legacy/vc-tools-goal-original.md +249 -0
  256. package/package.json +37 -8
@@ -0,0 +1,606 @@
1
+ # vc-tools API Contract
2
+
3
+ `vc-tools` is a separate CLI for Vibecodr Tools Cloud. It is not the existing
4
+ Vibecodr CLI and it does not execute browser or sandbox work locally.
5
+
6
+ The CLI talks to a hosted Vibecodr Tools API. The API owns Cloudflare
7
+ credentials, Browser Run usage, Sandbox execution, queues, workflows, R2
8
+ artifacts, quotas, audit logs, and policy decisions.
9
+
10
+ This repository includes the live Cloudflare Worker at `src/hosted/worker.ts`
11
+ with `wrangler.jsonc`. `VC_TOOLS_PROVIDER_MODE=live` is deployed for
12
+ `https://tools.vibecodr.space`; after security-sensitive Worker changes, the
13
+ release gate treats `live-hosted-production` as hosted-required until fresh
14
+ production smoke evidence is captured. Contract mode remains available in tests
15
+ and safe local checks to validate route shape, MCP metadata, auth failure
16
+ behavior, dashboard shell, and quota/audit-shaped tool acceptance without
17
+ spending Browser Run or Sandbox resources.
18
+
19
+ ## External Platform Assumptions
20
+
21
+ These assumptions were checked against Cloudflare documentation on 2026-05-17:
22
+
23
+ - Browser Run has Quick Actions for common stateless browser tasks such as
24
+ screenshots, PDFs, markdown extraction, HTML/content extraction, and bounded
25
+ crawl tasks, and Browser Sessions for direct control through Playwright,
26
+ Puppeteer, CDP, or Stagehand.
27
+ - Current Browser Run docs make Quick Actions the direct fit for common bounded
28
+ browser tasks, with Browser Sessions and session reuse reserved for direct
29
+ Playwright/Puppeteer/CDP/Stagehand control. This strengthens the `vc-tools`
30
+ Quick Actions default; it does not move browser execution into the local CLI.
31
+ - Browser Run Quick Actions require a Cloudflare API token with
32
+ `Browser Rendering - Edit`, and responses expose `X-Browser-Ms-Used` for
33
+ browser time accounting.
34
+ - Browser Run Quick Actions use separate timeout knobs. `goToOptions.timeout`
35
+ is capped at 60 seconds, while operation timers such as `actionTimeout` and
36
+ `pdfOptions.timeout` can be longer. `vc-tools` maps its product timeout to the
37
+ operation timer and clamps navigation timeout to Cloudflare's current limit.
38
+ - Browser Run `/crawl` starts an async provider crawl job, then results are read
39
+ from `/crawl/{job_id}`. `vc-tools` stores the completed crawl response as a
40
+ hosted artifact and meters returned browser seconds plus completed pages when
41
+ the provider reports them.
42
+ - Browser Sessions remain the paid browser provider for agent tasks. `vc-tools`
43
+ keeps Quick Actions as the default for stateless browser work, while
44
+ `browser.agent_task` is admitted and reserved in D1, then executed through the
45
+ `BROWSER_AGENT_WORKFLOW` Cloudflare Workflow using the `BROWSER` binding. It
46
+ allows up to 20 minutes on Creator and 1 hour on Pro, closes on 10 minutes of
47
+ idle/no-progress time, and always stores a bounded artifact before closing the
48
+ browser.
49
+ - Cloudflare Workers limits still cap Queue Consumers at 15 minutes of
50
+ wall-clock time. Cloudflare Workflows provide durable step execution with
51
+ per-step retries and resume behavior, so long paid browser agent tasks belong
52
+ in the Workflow lane instead of a Queue consumer.
53
+ - Browser Run requests self-identify through non-configurable headers and bot
54
+ detection IDs. Vibecodr may use those signals narrowly for owned-surface
55
+ proof/testing allowlisting, but not as a general bypass of public target
56
+ safety.
57
+ - Remote MCP uses Streamable HTTP. Local MCP uses stdio. SSE is legacy for
58
+ remote MCP and should only be retained for compatibility.
59
+ - Cloudflare Agents SDK recommends `createMcpHandler()` for stateless remote
60
+ MCP tools and `McpAgent` when per-session state is needed.
61
+ - Cloudflare Sandbox SDK runs untrusted code in isolated container-backed
62
+ environments and exposes command execution, files, background processes, and
63
+ preview URLs from Workers applications.
64
+ - Cloudflare Containers currently expose `standard-1` (1/2 vCPU, 4 GiB memory,
65
+ 8 GB disk) and `standard-2` (1 vCPU, 6 GiB memory, 12 GB disk) instance types.
66
+ `vc-tools` uses `standard-1` for Creator sandbox jobs and `standard-2` for Pro
67
+ sandbox jobs.
68
+ - Cloudflare Dynamic Workers load Worker code at runtime with `load(code)` for
69
+ one-time execution or `get(id, callback)` for cached/warm reuse. They are the
70
+ right future substrate for agent-authored Worker modules, but they do not
71
+ replace Browser Run for Chrome automation or Sandbox SDK for shell/container
72
+ execution.
73
+ - Cloudflare Durable Object Facets let a supervisor Durable Object load
74
+ dynamically generated code with isolated facet SQLite storage. They are a
75
+ future fit for supervised user-defined durable reducers/objects, not for the
76
+ platform-owned quota, audit, billing, artifact, or grant authority path.
77
+ - Cloudflare Queues DLQs preserve messages that exceed retry limits instead of
78
+ silently deleting them; vc-tools configures `vc-tools-jobs` with
79
+ `max_retries=3` and `vc-tools-jobs-dlq`, and retry deliveries of already
80
+ failed jobs do not re-run cost-bearing provider work.
81
+
82
+ The detailed primitive-fit decision lives in
83
+ `docs/CLOUDFLARE-PRIMITIVE-FIT.md`.
84
+
85
+ ## Live Cloudflare Resources
86
+
87
+ The production deployment uses these isolated `vc-tools` resources:
88
+
89
+ - Worker: `vc-tools-api`
90
+ - Custom domain: `https://tools.vibecodr.space`
91
+ - Browser Run Quick Actions secrets:
92
+ `VC_TOOLS_BROWSER_RUN_ACCOUNT_ID` and `VC_TOOLS_BROWSER_RUN_API_TOKEN`
93
+ - Operator kill switches: `VC_TOOLS_PAUSE_COST_BEARING_JOBS`,
94
+ `VC_TOOLS_DISABLE_BROWSER_RUN`, `VC_TOOLS_DISABLE_BROWSER_SESSIONS`, and
95
+ `VC_TOOLS_DISABLE_SANDBOX` deny matching cost-bearing capabilities before D1
96
+ job insertion or Queue/Workflow dispatch, write `tools.cost_bearing_paused`,
97
+ and return `ops.cost_bearing_paused`.
98
+ - Browser Run binding: `BROWSER` for the paid Browser Session agent-task lane
99
+ - Workflow: `vc-tools-browser-agent-task` bound as `BROWSER_AGENT_WORKFLOW` for
100
+ durable paid Browser Session execution
101
+ - Sandbox SDK Creator container and Durable Object class: `Sandbox` (`standard-1`)
102
+ - Sandbox SDK Pro container and Durable Object class: `ProSandbox` (`standard-2`)
103
+ - D1 database: `vc-tools-db`
104
+ - D1 migration: `migrations/0001_live_schema.sql`
105
+ - D1 actor-scope migration: `migrations/0002_actor_scope.sql`
106
+ - D1 quota-reservation migration: `migrations/0003_quota_reservations.sql`
107
+ - D1 sandbox-quota migration: `migrations/0004_sandbox_quota_reservations.sql`
108
+ - D1 operator-alert dedupe migration:
109
+ `migrations/0005_operator_alert_dedupe.sql`
110
+ - D1 scheduled-QA migration: `migrations/0006_scheduled_qa.sql`
111
+ - R2 bucket: `vc-tools-artifacts`
112
+ - Queue: `vc-tools-jobs`
113
+ - Queue metrics binding: `JOB_DLQ` bound to `vc-tools-jobs-dlq`
114
+ - Dead-letter queue: `vc-tools-jobs-dlq`
115
+
116
+ Dynamic Workers, Durable Object Facets, and Dynamic Workflows for
117
+ runtime-loaded user code are intentionally not part of the v1 live resource set.
118
+ Cloudflare Workflows are part of v1 only for the platform-owned
119
+ `browser.agent_task` execution lane. Add dynamic-code primitives only for an
120
+ explicitly named capability family, and only after quota reservation, audit,
121
+ least-privilege binding/proxy design, egress denial by default, timeout,
122
+ cancellation, and no-secret-leak tests exist.
123
+
124
+ Every live tool call writes an actor-scoped audit event before the job is
125
+ atomically reserved in D1 and before the Queue message is sent or Workflow
126
+ instance is created. Browser URL inputs are revalidated on the hosted side, DNS
127
+ preflight only accepts A/AAAA address records, and redirect-chain preflight
128
+ follows a bounded manual HEAD chain so unsafe redirect targets are rejected
129
+ before cost-bearing dispatch. Stateless browser tools use Browser Run Quick
130
+ Actions when the hosted Worker has the required Browser Run API secret. Queue
131
+ consumers refuse `browser.agent_task`; that lane is owned by
132
+ `BROWSER_AGENT_WORKFLOW`. Browser execution still refuses to start above the
133
+ configurable account-wide hard cap and returns provider 429 responses to the
134
+ retry/defer path instead of marking the job failed on first rate-limit pressure.
135
+ Paid Agent Computer sandbox jobs have public HTTP(S) egress by default so
136
+ agents can install packages and read public documentation without a curated host
137
+ list. Cloudflare Sandbox host policy denies local/private/link-local/metadata/
138
+ internal CIDR and hostname patterns, HTTPS interception is enabled on the
139
+ Sandbox classes, and the hosted outbound handler revalidates each HTTP(S)
140
+ request with URL-credential, private-host, internal suffix, and public-DNS
141
+ checks before forwarding it. Raw non-HTTP internet stays closed by the Sandbox
142
+ startup policy. Paid browser agent
143
+ tasks store closure metadata in the job result/artifact and emit
144
+ `tools.browser_agent.*` plus Workflow dispatch/failure audit events so
145
+ idle/max-duration/action-failure closure is visible after the browser closes.
146
+
147
+ ## Endpoints
148
+
149
+ The default production API base is:
150
+
151
+ `https://tools.vibecodr.space`
152
+
153
+ All endpoints below are versioned under `/v1`.
154
+
155
+ | CLI surface | Method and path | Purpose |
156
+ | --- | --- | --- |
157
+ | `login` browser/device start | `POST https://api.vibecodr.space/auth/vc-tools/device/start` | Start a short-lived browser approval session for the human CLI login path |
158
+ | `login` browser/device approval | `POST https://api.vibecodr.space/auth/vc-tools/device/approve` | Signed-in Vibecodr browser session approves the terminal code without receiving a grant secret |
159
+ | `login` browser/device polling | `POST https://api.vibecodr.space/auth/vc-tools/device/token` | CLI redeems its private device code for a short-lived `vc-tools` grant plus a durable scoped API key when available |
160
+ | `login --credential-file` / `--credential-stdin` exchange or verification | `POST https://api.vibecodr.space/auth/cli/exchange` or `GET /v1/me` | Accept a vc-tools grant, Clerk OAuth access token, or scoped Clerk API key without making users pick the credential type |
161
+ | `status` / `auth status` | `GET /v1/me`, `GET /v1/health` | Inspect local config, winning credential source, stored credential availability, authenticated identity, and hosted availability |
162
+ | `auth diagnose` | `GET /v1/me` when a credential is available | Explain which auth/config source is active, whether native/file credential storage is readable, and what to do next without printing secrets |
163
+ | `auth export-agent-env` | local credential export only | Write the durable local credential when available, otherwise the cached short-lived grant, and print the matching `VC_TOOLS_CREDENTIAL_FILE=...` or `VC_TOOLS_TOKEN_FILE=...` assignment without printing the secret |
164
+ | `start` / `setup` | `GET /v1/me`, `GET /v1/health`, `GET /v1/mcp/connection`, `GET /v1/usage` | Verify the approved Agent Computer and return account, health, connection, and capacity state |
165
+ | `try` | `GET /v1/me`, `GET /v1/health`, `GET /v1/mcp/connection`, `GET /v1/usage`, `POST /v1/tools/test`, `GET /v1/jobs/{jobId}`, `GET /v1/artifacts/{artifactId}/download` | Run a first-success check for auth, hosted API, public Browser work, hosted computer work, proof saving, and usage readback |
166
+ | `agent connect` / `connect` | `GET /v1/mcp/connection` | Return Streamable HTTP MCP endpoint metadata plus agent-native tool names |
167
+ | `tools list` | `GET /v1/tools` | List granted agent tool descriptors and canonical hosted capabilities |
168
+ | `tools test` | `POST /v1/tools/test` | Submit one bounded capability test; advanced/debug surface |
169
+ | `work list` / `jobs list` | `GET /v1/jobs?limit=1..100` | List recent hosted work |
170
+ | `work show` / `jobs status` | `GET /v1/jobs/{jobId}` | Read one work item/job |
171
+ | `work follow` | repeated `GET /v1/jobs/{jobId}`, optional `GET /v1/artifacts/{artifactId}/download` | Poll one work item until terminal and optionally save its proof artifact |
172
+ | `work cancel` / `jobs cancel` | `POST /v1/jobs/{jobId}/cancel` | Cancel a queued/running work item |
173
+ | `proof list` / `artifacts list` | `GET /v1/artifacts?limit=1..100` | List saved proof/artifacts |
174
+ | `proof show` / `artifacts get` | `GET /v1/artifacts/{artifactId}` | Read proof/artifact metadata |
175
+ | `proof save` / `artifacts pull` | `GET /v1/artifacts/{artifactId}/download` | Download artifact bytes |
176
+ | `artifacts create` | `POST /v1/artifacts` | Upload a local file as a saved artifact; advanced/debug surface |
177
+ | `artifacts delete` | `DELETE /v1/artifacts/{artifactId}` | Delete actor-scoped artifact metadata and R2 bytes |
178
+ | `whoami` | `GET /v1/me` | Read authenticated user, workspace, and plan identity |
179
+ | `usage` / `limits` | `GET /v1/usage` | Read quota and spend state with allotted limits, numeric usage, and quota progress |
180
+ | `grants` / `grants list` | `GET /v1/grants` | Read effective tool grants |
181
+ | `retention show` | `GET /v1/retention` | Read retention policy |
182
+ | `retention set` | `PATCH /v1/retention` | Update retention policy |
183
+ | `scheduled-qa list` | `GET /v1/scheduled-qa` | List actor-scoped scheduled Browser Quick Action checks |
184
+ | `scheduled-qa create` | `POST /v1/scheduled-qa` | Create a plan-capped recurring Browser Quick Action for a public HTTPS URL |
185
+ | `scheduled-qa pause` / `resume` | `PATCH /v1/scheduled-qa/{scheduledQaId}` | Pause, resume, or run a scheduled QA config now |
186
+ | `scheduled-qa delete` | `DELETE /v1/scheduled-qa/{scheduledQaId}` | Delete an actor-scoped scheduled QA config |
187
+ | `plans` | `GET /v1/plans` | Read plan packaging and limits |
188
+
189
+ Default CLI output is split by audience. Human and default `--json` output are
190
+ user/agent product contracts: `start`, `usage`, `plans`, `doctor`, and
191
+ connection commands return the account, connection, tools, capacity, and next
192
+ actions needed to use the Agent Computer. They do not include operator launch
193
+ metadata, future/internal offering classifications, overage meters, provider
194
+ mode, scopes, token kind, internal alert configuration, COGS, webhook/ntfy
195
+ configuration, or hosted account-pressure internals. `--details` expands
196
+ user-debugging data. `--operator` is server-gated and only works for actors
197
+ authorized to read internal launch metadata.
198
+
199
+ Browser and computer aliases submit hosted work, wait for terminal status by
200
+ default, and summarize the result. `--out ./proof` saves the terminal artifact
201
+ without requiring the caller to copy a job or artifact ID. `--no-wait` returns
202
+ the queued hosted job response for advanced callers. `--details` includes the
203
+ raw work/proof identifiers.
204
+
205
+ Agent Computer command payloads default to public HTTP(S) network availability
206
+ for paid hosted runs. The CLI also accepts `--network public` and
207
+ `--network off`; no user flag enables private, local, metadata, or internal
208
+ network destinations.
209
+
210
+ Plain `vc-tools start` is the standard connection path; it uses `login` internally
211
+ when the Agent Computer has no local credential yet. The login step follows the
212
+ device-login shape: the CLI receives a private `device_code`, shows a user-checkable
213
+ `user_code`, opens `/settings/vc-tools/approve?vc_tools_code=...`, and polls the parent
214
+ API until the signed-in browser session approves that code. The approval
215
+ response is browser-safe metadata only; the signed grant and durable scoped API
216
+ key are returned only to the polling CLI that holds the private device code.
217
+ Sessions are stored in the parent API D1 database as hashes and become
218
+ single-use when redeemed.
219
+
220
+ `/v1/me` omits `user.email` when the grant has no real account email instead of
221
+ substituting a synthetic `@vibecodr.local` identity. Human output should prefer
222
+ account handle/workspace labels, then a real email, then stable ids.
223
+
224
+ Generic file/stdin credential login remains the standard non-interactive path
225
+ for agents, CI, and web agents that can pass a secret through an existing secure
226
+ secret channel. The CLI identifies vc-tools grants, Clerk OAuth access tokens,
227
+ and scoped Clerk API keys from their shape so agents do not need a credential
228
+ type decision. All vc-tools grant minting uses the parent Vibecodr API, and
229
+ vc-tools grants are audience-bound to `vibecodr:vc-tools` so hosted Tools cannot
230
+ accidentally accept broader Vibecodr CLI/API authority.
231
+
232
+ Local auth is account-wide. The CLI stores one durable credential when it has
233
+ one, plus a cached short-lived vc-tools grant. Cached grants are access
234
+ artifacts; they are refreshed from the durable credential when expired. A raw
235
+ vc-tools grant can still be cached for controlled automation, but it is not
236
+ refreshable and may require `vc-tools start` or a fresh credential file after
237
+ expiry.
238
+
239
+ Production vc-tools grants use asymmetric ES256 signing. The parent API signs
240
+ with private `CLI_GRANT_PRIVATE_JWK`; hosted Tools verifies only against
241
+ `VC_TOOLS_CLI_GRANT_PUBLIC_JWKS`. Grant headers must include `kid`; grant
242
+ payloads must include `iss`, `aud`, `sub`, `scp`, effective `plan`,
243
+ `grant_profile`, `iat`, `nbf`, `exp`, and `jti`. Hosted Tools denies unknown
244
+ `kid`, audience/issuer mismatch, non-`vc_tools` grant profiles, missing
245
+ `vc-tools:use`, missing per-tool capability scope, expired/not-yet-valid
246
+ grants, and configured revoked `jti` values. Legacy shared-HMAC grants require
247
+ explicit beta/internal compatibility flags, are not the public production
248
+ shape, and should be removed by 2026-06-30 after live ES256 smoke and
249
+ migration.
250
+
251
+ ## Remote MCP Contract
252
+
253
+ The remote MCP endpoint is:
254
+
255
+ `https://tools.vibecodr.space/mcp`
256
+
257
+ It uses Streamable HTTP and supports these JSON-RPC methods in contract mode:
258
+
259
+ - `initialize`
260
+ - `notifications/initialized`
261
+ - `ping`
262
+ - `tools/list`
263
+ - `tools/call`
264
+
265
+ `tools/list` exposes deterministic agent-native tool names and JSON schemas.
266
+ Each descriptor also includes the canonical hosted capability it maps to.
267
+ `tools/call` accepts the agent-native names below, plus canonical capability
268
+ names for advanced callers, and returns a quota/audit-shaped contract response
269
+ unless the hosted provider mode is later set to `live`.
270
+
271
+ Primary agent tool names:
272
+
273
+ - `browser.render` -> `browser.render_url`
274
+ - `browser.screenshot` -> `browser.screenshot_url`
275
+ - `browser.read` -> `browser.extract_markdown`
276
+ - `browser.pdf` -> `browser.render_pdf`
277
+ - `browser.crawl` -> `browser.crawl_site`
278
+ - `browser.snapshot` -> `browser.agent_task`
279
+ - `computer.run` -> `sandbox.run_command`
280
+ - `computer.test` -> `sandbox.run_tests`
281
+ - `proof.get` -> `artifact.get`
282
+ - `usage.status` -> `usage.read`
283
+ - `work.status` -> `job.status`
284
+ - `work.cancel` -> `job.cancel`
285
+
286
+ ## Capability Names
287
+
288
+ The CLI validates and submits only these v1 capability names:
289
+
290
+ - `browser.render_url`
291
+ - `browser.screenshot_url`
292
+ - `browser.extract_markdown`
293
+ - `browser.render_pdf`
294
+ - `browser.crawl_site`
295
+ - `browser.agent_task`
296
+ - `sandbox.run_command`
297
+ - `sandbox.run_tests`
298
+ - `artifact.create`
299
+ - `artifact.get`
300
+ - `usage.read`
301
+ - `job.status`
302
+ - `job.cancel`
303
+
304
+ The CLI and hosted API also accept documented aliases for agent/human ergonomics:
305
+
306
+ - `browser.ask` -> `browser.agent_task`
307
+ - `browser.read` -> `browser.extract_markdown`
308
+ - `browser.render` -> `browser.render_url`
309
+ - `browser.screenshot` -> `browser.screenshot_url`
310
+ - `browser.markdown` -> `browser.extract_markdown`
311
+ - `browser.pdf` -> `browser.render_pdf`
312
+ - `browser.crawl` -> `browser.crawl_site`
313
+ - `browser.agent` / `browser.session` -> `browser.agent_task`
314
+ - `browser.snapshot` -> `browser.agent_task`
315
+ - `computer.run` -> `sandbox.run_command`
316
+ - `computer.test` / `computer.tests` -> `sandbox.run_tests`
317
+ - `sandbox.run` -> `sandbox.run_command`
318
+ - `sandbox.tests` -> `sandbox.run_tests`
319
+ - `proof.get` -> `artifact.get`
320
+ - `usage` / `usage.status` / `limits` / `limits.read` -> `usage.read`
321
+ - `work.status` -> `job.status`
322
+ - `work.cancel` -> `job.cancel`
323
+
324
+ ## Launch Packaging
325
+
326
+ The local launch package includes:
327
+
328
+ - Free plan with limited public-page Quick Actions: 30 VC Tool credits/month,
329
+ 10/day, 1 concurrent run, 30s browser-run cap, no Sandbox, no Browser
330
+ Sessions, no scheduled QA
331
+ - Creator at `$19/mo`, included with the existing Vibecodr Creator subscription:
332
+ 600 VC Tool credits/month, 90/day, 2 concurrent runs, Quick Actions by
333
+ default, 60s stateless browser-run cap, Workflow-owned Browser Sessions for
334
+ agent tasks up to 20 minutes with 10-minute idle closure, 50 crawl pages/run,
335
+ 500 crawl pages/month, 30 scheduled QA runs/month with a 12-hour minimum
336
+ interval
337
+ - Pro at `$39/mo`, included with the existing Vibecodr Pro subscription
338
+ - Pro includes 3,000 VC Tool credits/month, 400/day, 5 concurrent runs, Quick
339
+ Actions by default, capped Workflow-owned Browser Sessions for agent tasks up
340
+ to 1 hour with 10-minute idle closure, 180s stateless Quick Action cap, 250
341
+ crawl pages/run, 5,000 crawl pages/month, and 300 scheduled QA runs/month
342
+ - no standalone vc-tools Stripe catalog; Vibecodr subscription state is the paid-plan SSOT
343
+ - `/v1/plans` and local fallback constants are packaging/reference data, not
344
+ actor entitlement authority. The authoritative actor state is the
345
+ authenticated `/v1/usage` snapshot plus the same hosted quota checks that run
346
+ before cost-bearing work. Open-source client edits cannot raise hosted
347
+ entitlement, quota, billing state, or provider access.
348
+ - `/v1/plans`, `/v1/usage`, `/v1/health`, and `/v1/mcp/connection` are
349
+ audience-filtered by default. Public/default payloads are buyer/agent-safe.
350
+ Details mode may include expanded user diagnostics. Operator mode requires an
351
+ internal-metadata actor and is the only place for future/internal launch
352
+ metadata, overage-meter compatibility data, provider mode, alert plumbing, or
353
+ account-pressure internals.
354
+ - `/v1/usage`, non-operator `/v1/inspect`, and public health/readiness payloads
355
+ are user-safe surfaces. They must not expose actor ids, hosted account caps,
356
+ provider account pressure, operator alert configuration, ntfy/webhook topics,
357
+ internal API binding state, or other operator-only readiness details.
358
+ - VC Tool credits, browser seconds, sandbox-compute time, artifact-storage,
359
+ retention, concurrency, crawl, and scheduled-QA meters; build minutes remain a
360
+ separate subscription ledger and must not be borrowed by vc-tools
361
+ - Scheduled QA is a gated-beta hosted lane. It stores actor-scoped
362
+ `scheduled_qa_configs` rows in D1, only accepts public HTTPS Browser Quick
363
+ Actions (`browser.render`, `browser.screenshot`, `browser.markdown`, and
364
+ `browser.pdf`), and the Worker cron enqueues due runs into the same D1 jobs
365
+ and Queue path used by manual tool calls. Each due run is checked against the
366
+ active plan's monthly scheduled-QA allowance, browser quota, concurrency, DNS
367
+ and redirect safety, artifact storage, and audit-before-cost policy before
368
+ the Queue message is sent. Scheduled QA never opens an Agent Browser session
369
+ and never accepts cookies, credentials, custom auth headers, storage state, or
370
+ private-network targets.
371
+ - artifact upload caps are plan-owned hosted limits: Free has no artifact
372
+ upload lane, Creator allows 100 MiB/file, and Pro allows 500 MiB/file
373
+ - total artifact storage is also plan-owned: artifact writes check active
374
+ actor storage before R2 writes, insert D1 artifact metadata with a quota
375
+ predicate, and delete newly written R2 bytes if the D1 reservation loses a
376
+ race
377
+ - sandbox jobs reserve monthly sandbox seconds before queue insertion and
378
+ reconcile the reservation on terminal/cancelled jobs, so
379
+ `sandboxMinutesMonthly` is enforced before cost-bearing Sandbox work starts.
380
+ Creator sandbox tasks are capped at 10 minutes, Pro sandbox tasks are capped
381
+ at 30 minutes, and both paid plans allow up to 2 active sandbox tasks per user
382
+ - account-wide hosted breakers are separate from customer plan caps: customer
383
+ caps protect product packaging and spend, while provider/account caps protect
384
+ Cloudflare account pressure. The hosted queue is capped at 30 concurrent
385
+ consumer invocations, hosted Browser/Sandbox work defaults to a soft cap of 24
386
+ and hard cap of 30 active jobs, configurable through
387
+ `VC_TOOLS_HOSTED_ACCOUNT_SOFT_CAP` and
388
+ `VC_TOOLS_HOSTED_ACCOUNT_HARD_CAP`, Browser Run jobs default to a soft cap
389
+ of 24 and hard cap of 30 concurrent browser jobs, configurable through
390
+ `VC_TOOLS_BROWSER_RUN_ACCOUNT_SOFT_CAP` and
391
+ `VC_TOOLS_BROWSER_RUN_ACCOUNT_HARD_CAP`, and Sandbox jobs default to a soft
392
+ cap of 24 and hard cap of 30 concurrent hosted sandboxes, configurable through
393
+ `VC_TOOLS_SANDBOX_ACCOUNT_SOFT_CAP` and
394
+ `VC_TOOLS_SANDBOX_ACCOUNT_HARD_CAP`. Paid user-facing Sandbox containers are
395
+ split by plan: Creator routes to `Sandbox` on `standard-1` and Pro routes to
396
+ `ProSandbox` on `standard-2`, each with `max_instances: 30` while
397
+ D1/Queue/Workflow account caps keep total active hosted work bounded.
398
+ Emergency operator kill switches are separate from those caps:
399
+ `VC_TOOLS_PAUSE_COST_BEARING_JOBS=true` pauses all Browser/Sandbox work,
400
+ `VC_TOOLS_DISABLE_BROWSER_RUN=true` pauses Browser Run Quick Actions and
401
+ crawl, `VC_TOOLS_DISABLE_BROWSER_SESSIONS=true` pauses paid
402
+ `browser.agent_task`, and `VC_TOOLS_DISABLE_SANDBOX=true` pauses Sandbox.
403
+ These flags return `503 ops.cost_bearing_paused`, write an audit row, and do
404
+ not insert a D1 job or dispatch Queue/Workflow work.
405
+ Crossing 70%, 85%, or 95% account-wide pressure, or crossing a configured
406
+ account-wide soft cap, emits a sanitized `E-VIBECODR-VC-TOOLS-SOFT-CAP`
407
+ operator alert through the internal-api email/ntfy fanout and optional
408
+ vc-tools webhook/ntfy secrets. Per-user quota, usage, and concurrency limits
409
+ remain enforced, metered, and audit-visible, but they do not send operator
410
+ alert email because they represent customer-plan pressure rather than total
411
+ platform capacity pressure.
412
+ Scheduled account-level Queue backlog, DLQ backlog, and artifact-storage
413
+ growth checks use the same operator alert lane with `queue.backlog_messages`,
414
+ `queue.dlq_messages`, and `artifact.storage_gb` surfaces.
415
+ Expired-artifact cleanup failures emit a separate account-scoped
416
+ `E-VIBECODR-VC-TOOLS-RETENTION-CLEANUP-FAILED` alert with
417
+ `retention.cleanup_failed`; internal-api keeps filtering any `source=vc-tools`
418
+ payload whose details carry `scope=user` before email/ntfy fanout.
419
+ Browser Run and Sandbox execution-health degradation emits
420
+ `E-VIBECODR-VC-TOOLS-EXECUTION-HEALTH-DEGRADED` with
421
+ `browser.failure_rate`, `browser.timeout_rate`, `sandbox.failure_rate`, or
422
+ `sandbox.timeout_rate` based on recent terminal job rows. These alerts are
423
+ account-scoped operational health signals, not per-user quota notifications.
424
+ Unexpected hosted Worker 500s emit the account-scoped
425
+ `E-VIBECODR-VC-TOOLS-HOSTED-WORKER-5XX` alert with
426
+ `hosted.worker_5xx`; payloads include only the method, sanitized path pattern,
427
+ HTTP status, and sanitized error message, never query strings, bearer tokens,
428
+ request bodies, or actor identifiers.
429
+ Hosted API/MCP auth failures write anonymous `auth.failed` audit metrics with
430
+ the semantic auth error code and sanitized path. The scheduled Worker pass
431
+ aggregates those rows over `VC_TOOLS_AUTH_FAILURE_WINDOW_MINUTES` and emits
432
+ `E-VIBECODR-VC-TOOLS-AUTH-FAILURE-ANOMALY` / `auth.failure_anomaly` only when
433
+ `VC_TOOLS_AUTH_FAILURE_ALERT_THRESHOLD` is crossed. This is an account-level
434
+ anomaly alert for broken auth config, abuse, or client exchange regressions;
435
+ it does not preserve tokens, query strings, request bodies, or actor
436
+ identifiers in either the metric or the alert.
437
+ Cloudflare spend anomaly checks are account-level only. The scheduled Worker
438
+ estimates current-month raw Cloudflare usage cost from internal vc-tools
439
+ meters (`browser-minute`, plan-split `sandbox-compute-minute`, `crawl-page`,
440
+ and active artifact GB-month exposure) plus env-configured COGS assumptions,
441
+ then emits `E-VIBECODR-VC-TOOLS-CLOUDFLARE-SPEND-ANOMALY` /
442
+ `cloudflare.estimated_spend_usd` when
443
+ `VC_TOOLS_CLOUDFLARE_SPEND_SOFT_USD` is crossed. This internal alert is a
444
+ platform early-warning signal, not an invoice-backed billing source; operators
445
+ must compare it with Cloudflare Billable Usage / Budget Alerts before changing
446
+ thresholds. Per-user COGS stays analytics-only and must not fan out to
447
+ email/ntfy/webhook.
448
+ Workflow-owned Browser Sessions remain a capped paid lane and must not be
449
+ opened above an operator-approved account cap.
450
+ - operator alerts are deduped in D1 through
451
+ `operator_alert_dedupe(alert_key, reset_window)`. Active-capacity alerts reset
452
+ hourly; Cloudflare spend anomaly alerts reset monthly by billing period.
453
+ Duplicate crossings in the same reset window increment a suppression counter
454
+ and write an audit event instead of sending another notification.
455
+ Missing notifier bindings also write an audit event, so release smoke can
456
+ distinguish "alert generated" from "operator channel configured."
457
+ - unsafe URL and quota denials are D1 audit metrics, not notification fanout:
458
+ live hosted API/MCP denials write `tools.denied_unsafe_url` or
459
+ `tools.denied_quota` with the authenticated actor, capability, and semantic
460
+ denial code so COGS/ops analysis can see friction and denied demand without
461
+ emailing operators for individual user-plan pressure.
462
+ - admission fairness reports global queued-ahead and actor queued-ahead
463
+ metadata on accepted work without adding a universal delay to interactive
464
+ tools. Scheduled QA may still spread due runs with bounded Queue per-message
465
+ delays, while per-plan concurrency and account caps remain the primary
466
+ fairness controls for live user actions.
467
+ - dashboard sections for overview, usage, activity, artifacts, grants, retention,
468
+ billing, and internal COGS; hosted dashboard and inspection routes require
469
+ bearer auth. In live mode `/dashboard/usage` reads D1-backed usage for the
470
+ authenticated actor, and `/dashboard/cogs` shows internal-only cost pressure
471
+ estimates from env-configured per-surface assumptions.
472
+ - named workspace/project/user tool grants for browser, sandbox, artifacts,
473
+ activity status, and crawl
474
+
475
+ ## Security Envelope
476
+
477
+ Browser mode policy:
478
+
479
+ - Public web mode is the default. Agents can inspect, render, screenshot, make
480
+ PDFs, extract markdown, and crawl public HTTPS targets, returning hosted
481
+ artifacts.
482
+ - Authenticated web mode is future Pro/beta only. A user must knowingly grant
483
+ access to a specific session, account, or site, with retention, recording,
484
+ consent, and audit policy settled before implementation.
485
+ - Owned-surface mode is narrow and internal: Vibecodr-owned domains may
486
+ recognize controlled Browser Run traffic so proof/testing flows are not
487
+ blocked by our own WAF or bot controls.
488
+ - Blocked unsafe targets must explain the specific boundary: public HTTPS only,
489
+ no URL credentials, no private/internal network resolution, and no unsafe
490
+ redirect target.
491
+
492
+ The CLI performs pre-cost validation before API calls:
493
+
494
+ - API URLs must use HTTPS unless local development explicitly opts into
495
+ `--allow-insecure-local-api` or `VC_TOOLS_ALLOW_INSECURE_LOCAL_API=true`.
496
+ - Browser URL targets must be HTTPS.
497
+ - Browser URL targets must not contain credentials.
498
+ - Browser tool input must not include cookies, credentials, authorization
499
+ headers, custom auth headers, storage state, sessions, or secrets. The hosted
500
+ Worker rejects those fields before provider execution.
501
+ - Browser URL targets must not be localhost, private IP, loopback, link-local,
502
+ multicast, unspecified, IPv4-mapped IPv6, NAT64, 6to4, or obvious internal
503
+ hostnames.
504
+ - Hosted browser admission performs DNS and bounded redirect-chain preflight so
505
+ public hostnames resolving or redirecting to private/internal targets are
506
+ rejected before cost-bearing dispatch.
507
+ - Sandbox work is never executed locally by the CLI.
508
+ - Sandbox egress defaults to public HTTP(S) for paid Agent Computer runs so
509
+ agents can fetch public packages, docs, and APIs. The CLI accepts
510
+ `--network public` (default) and `--network off`; private, local, link-local,
511
+ metadata, and internal destinations remain blocked by hosted policy regardless
512
+ of any flag.
513
+ - Mutating commands require `--yes`.
514
+ - Public human login uses the parent Vibecodr Auth/API boundary:
515
+ `POST /auth/vc-tools/device/start`, `POST /auth/vc-tools/device/approve`,
516
+ and `POST /auth/vc-tools/device/token`. The browser approves only a user code;
517
+ the signed grant and durable scoped API key are returned only to the polling
518
+ CLI with the private device code.
519
+ - Public automation login uses Vibecodr Auth as the credential exchange boundary:
520
+ `--credential-file`, `--credential-stdin`, and `VC_TOOLS_CREDENTIAL_FILE`
521
+ accept a vc-tools grant, Clerk OAuth access token, or scoped Clerk API key.
522
+ Clerk credentials are sent only to `POST /auth/cli/exchange`, which verifies
523
+ the credential with Clerk and returns a short-lived scoped `vc-tools` CLI
524
+ grant.
525
+ - The CLI stores the durable browser-issued or user-supplied credential when
526
+ available, plus a cached short-lived grant. Private device codes and browser
527
+ approval responses are never persisted by `vc-tools`.
528
+ - Direct grants are preferably resolved from `VC_TOOLS_CREDENTIAL_FILE`,
529
+ `VC_TOOLS_TOKEN_FILE`, `--credential-file`, `--credential-stdin`, or the local
530
+ credential store and are redacted from all output and errors.
531
+ - Direct secret value flags and value-bearing secret environment variables
532
+ (`--credential`, `--token`, `VC_TOOLS_CREDENTIAL`, `VC_TOOLS_TOKEN`) remain
533
+ compatibility inputs, but public UX and docs should prefer plain browser login
534
+ for humans and file/stdin/native credential paths for agents and automation.
535
+ - `VC_TOOLS_AUTH_API_URL` can override the exchange endpoint for local testing;
536
+ it follows the same HTTPS-by-default URL validation as `VC_TOOLS_API_URL`.
537
+ - Artifact upload and download paths are workspace-bounded. `artifacts pull`
538
+ may write to a directory, an explicit file path inside the workspace, or a
539
+ caller-provided `--filename` inside a directory output.
540
+ - Artifact deletion is actor-scoped, requires explicit CLI confirmation, removes
541
+ the D1 shelf row and R2 bytes, and lets usage readback recompute active
542
+ artifact storage from remaining non-expired rows.
543
+
544
+ Hosted safety defaults required by this contract:
545
+
546
+ - Hosted auth accepts scoped Vibecodr CLI grants with `vc-tools:use` plus a
547
+ requested tool scope such as `vc-tools:browser.render_url` or `vc-tools:*`,
548
+ verified by public JWKS, and an explicitly configured static-token fallback
549
+ for controlled deployments.
550
+ - Browser/device-backed `vc-tools` grants receive `vc-tools:use` plus
551
+ `vc-tools:*` after a signed-in Vibecodr user approves the matching terminal
552
+ code. The hosted service validates the `vibecodr:vc-tools` audience before any
553
+ tool or MCP work.
554
+ - OAuth-backed `vc-tools` grants receive `vc-tools:use` plus `vc-tools:*` after
555
+ the parent Vibecodr API verifies the Clerk OAuth access token client id and
556
+ `openid` scope.
557
+ - API-key-backed `vc-tools` grants are least-privilege: only Clerk API key
558
+ scopes beginning with `vc-tools:` are copied into the signed grant, and the
559
+ exchange rejects keys without `vc-tools:use` or `vc-tools:*`.
560
+ - Live hosted work records, artifacts, usage rows, retention policies, and audit rows are scoped
561
+ to the authenticated actor.
562
+ - No authenticated third-party browsing by default.
563
+ - Paid sandbox public HTTP(S) egress is available by default, with private,
564
+ local, link-local, metadata, and internal destinations denied.
565
+ - No browser recording by default.
566
+ - No unlimited crawl by default.
567
+ - All tool calls are quota checked and audit logged before cost-bearing work.
568
+ - Retention uses the actor policy or active plan artifact-retention limit rather
569
+ than a hard-coded lifetime, policy writes cannot exceed the active plan cap,
570
+ expired artifacts are hidden from reads, and scheduled cleanup deletes expired
571
+ R2 objects and D1 rows.
572
+
573
+ ## Stable Output Contract
574
+
575
+ Every `--json` response is shaped as:
576
+
577
+ ```json
578
+ {
579
+ "ok": true,
580
+ "data": {},
581
+ "warnings": []
582
+ }
583
+ ```
584
+
585
+ Errors are shaped as:
586
+
587
+ ```json
588
+ {
589
+ "ok": false,
590
+ "error": {
591
+ "code": "input.invalid_url",
592
+ "message": "Browser URL must use https.",
593
+ "status": 2
594
+ }
595
+ }
596
+ ```
597
+
598
+ Exit codes:
599
+
600
+ - `0`: success
601
+ - `1`: remote/API failure or unexpected failure
602
+ - `2`: invalid CLI input
603
+ - `3`: missing authentication
604
+ - `4`: explicit confirmation required
605
+ - `5`: configuration or local file error
606
+ - `6`: upstream unavailable