docs(hub): document the /api/v1 end state + complete the OpenAPI (thin CLI Step 14) - #295
Merged
Merged
Conversation
…n CLI Step 14)
Final step of the one-path plan: make the docs and the OpenAPI spec describe
the consolidated end state accurately — including the deliberate exceptions,
not an overstated "everything goes through /api/v1".
OpenAPI (api/v1/lib/openapi.ts): document the 8 routes that shipped without an
entry (boxes/:id/{agent,checkpoint,logs,rename}, checkpoints GET|DELETE, prune,
jobs GET, jobs/:id/login-code), add Checkpoints/Fleet tags + their schemas,
enrich Job (error/provider/name/agent/createdAt/login) and Box (the Step-3
adoption fields: sandboxId/originUrl/publicHost/image/webPort/previewUrls/
lastAgent/topology/shellCount). New guard test openapi-coverage.test.ts diffs
the App-Router route files against the document both ways — the "verification
checklist" the header always claimed but never had.
Docs: api.mdx (9 endpoints + one-path framing), deployed-hub.mdx (new "What
still needs your laptop" section — direct IO plane, local adoption, secrets.env
on both machines, the launcher-foreground-create exception, no-TTL parked
approvals; fixed the stale ls merge/on-hub/orphan description), configuration.mdx
(git.pushMode), architecture.md (End state: one path through /api/v1 + the four
exceptions), create-and-checkpoints.md + cloud-providers.md + hub-testing.md
(routing notes, custody/adoption §4b). CLAUDE.md: /api/events accepts Bearer
(same gate as /api/v1) — the cookie is an additional same-origin credential.
Tray (../agentbox-tray) is a host-side sibling repo unreachable from this box;
left as a documented follow-up per the step brief (needs the enriched Box
payload decoded in HubAPIBoxSource).
Verified e2e: built the standalone hub, restarted it, served
GET /api/v1/openapi.json lists all 37 routes with a perfect bijection to the
route files (0 missing, 0 stale); /api/v1/docs renders; web docs build green;
hub tests (122) + typecheck green.
Claude-Session: https://claude.ai/code/session_01P5tWZxdr38EUaF9tXFUFXB
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The api.mdx cross-link targeted #driving-a-box-from-your-laptop; the dedicated #what-still-needs-your-laptop section (added in this PR) is the exact answer. Claude-Session: https://claude.ai/code/session_01P5tWZxdr38EUaF9tXFUFXB
Owner
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 3c1786e. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Step 14 (final) of the one-path plan: make the docs and the OpenAPI spec describe the consolidated end state accurately — including the deliberate exceptions, not an overstated "everything goes through
/api/v1".OpenAPI (
apps/hub/app/(dashboard)/api/v1/lib/openapi.ts)Documented the 8 routes that shipped without an entry:
GET /boxes/:id/agent,POST /boxes/:id/checkpoint,GET /boxes/:id/logs,POST /boxes/:id/rename,GET|DELETE /checkpoints,POST /prune,GET /jobs,POST /jobs/:id/login-code. AddedCheckpoints/Fleettags + response schemas (CheckpointCreateResult/CheckpointListing/CheckpointRemoveResult/PruneResult/JobListItem/AgentState), enrichedJob(error/provider/name/agent/createdAt/login) andBox(the Step-3 adoption fields:sandboxId/originUrl/publicHost/image/webPort/previewUrls/lastAgent/topology/shellCount).rename/open/open-targets/hostswere already present.New guard test
apps/hub/test/openapi-coverage.test.tsdiffs the App-Router route files against the document both ways (fails on an undocumented route AND a documented path with no route file) — the "verification checklist" theopenapi.tsheader always claimed but never had.Docs
api.mdx— the 9 endpoints + Checkpoints/Fleet groups, plus the accurate "one path, IO plane excepted" framing.deployed-hub.mdx— a new "What still needs your laptop" section (direct IO plane; local adoption;secrets.envon both machines; the launcher-foreground-create exception; a no-TTL parked-approval callout), and corrected the stalelsmerge /on hub/orphandescription to the single-/api/v1/boxeslisting.configuration.mdx— documentedgit.pushMode(was missing).architecture.md— new "End state: one path through/api/v1" subsection with the four deliberate exceptions.create-and-checkpoints.md/cloud-providers.md/hub-testing.md— routing notes (create/checkpoint/prune moved behind the API), custody/adoption §4b, "why both modes".CLAUDE.md— fixed the stale claim:/api/eventsaccepts Bearer (same gate as/api/v1inproxy.ts); the cookie is an additional same-origin credential, not a replacement.cli.mdxleft as-is — already accurate and appropriately qualified.Why
The plan is titled "one path" and the temptation is to declare it fully achieved. It is very close, but four things are deliberately not on
/api/v1, and the docs now say so plainly: the direct IO plane (shell/attach/cp/download/code/open/url/screen) stays laptop-side — so local adoption stays andsecrets.envstays on both machines; the three agent launchers' local foreground create still builds inline (route-create.tssurvives); one custody/adminbyte-read fallback is allowlisted; the localhost hub binds0.0.0.0so the custody byte-read is loopback peer-gated; and parked approvals have no TTL.Tray — documented follow-up
../agentbox-trayis a host-side sibling repo and is not reachable from inside this AgentBox (/workspace's parent has noagentbox-tray). Per the step brief, the tray change is left as a documented follow-up (recorded in the plan doc): its SwiftBoxmodel (HubAPIBoxSource) should decode the enriched Step-3 fields now present onGET /api/v1/boxes. The hub API contract it speaks is otherwise unchanged.How verified (e2e)
GET /api/v1/openapi.jsonlists all 37 routes with a perfect bijection to the route files (0 missing, 0 stale) — the acceptance diff, run against the running server, not eyeballed.GET /api/v1/docsrenders (Scalar loads the spec).pnpm --filter @agentbox/web buildgreen (docs compile).pnpm --filter @agentbox/hub test(122) +typecheckgreen; prettier + eslint clean on the touched files.https://claude.ai/code/session_01P5tWZxdr38EUaF9tXFUFXB
Note
Low Risk
Documentation, OpenAPI metadata, and a coverage test only—no application logic changes in the diff.
Overview
Documents the thin-CLI “one path through
/api/v1” end state and brings the hand-authored OpenAPI spec in line with what actually ships, without changing hub runtime behavior.The
openapi.tsupdate adds the eight routes that were missing from the spec (rename, agent state, logs, per-box checkpoint, global checkpoints, prune, job list, login-code), new Checkpoints / Fleet tags and response schemas, and richerBox/Jobfields for adoption and create jobs.apps/hub/test/openapi-coverage.test.tsdiffs App Routerroute.tsfiles against documented paths in both directions so new routes can’t land undocumented and stale paths fail CI.Public and internal docs (
api.mdx,deployed-hub.mdx,architecture.md,create-and-checkpoints.md,cloud-providers.md,hub-testing.md, etc.) now state that box/fleet ops go through/api/v1, call out what still runs on the laptop (direct IO, adoption,secrets.env, launcher foreground create, custody/approval caveats), and fix outdated control-box listing/auth wording.CLAUDE.mdcorrects hub auth:/api/eventsaccepts Bearer like/api/v1; the cookie is an extra same-origin credential.configuration.mdxaddsgit.pushModeand is mostly table/formatting cleanup.The macOS tray sibling repo is explicitly left as a follow-up (decode enriched
Boxfields fromGET /api/v1/boxes).Reviewed by Cursor Bugbot for commit 3c1786e. Configure here.