Skip to content

refactor(contracts): single-owner API contracts — cloud API is cloud-only, Box API owns box operations#748

Open
law-chain-hot wants to merge 5 commits into
mainfrom
refactor/single-owner-contracts
Open

refactor(contracts): single-owner API contracts — cloud API is cloud-only, Box API owns box operations#748
law-chain-hot wants to merge 5 commits into
mainfrom
refactor/single-owner-contracts

Conversation

@law-chain-hot

@law-chain-hot law-chain-hot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Architecture: single owner per contract

BEFORE — box operations & dead surface scattered across contracts
┌─────────────────────────────────────────────────────────────────────┐
│ Cloud API (NestJS openapi.json)   orgs/billing/keys ... + 4 box verbs │ ← box ops leak in
│ toolbox.deprecated  (68 endpoints)                only consumer: TS SDK│ ← dead
│ workspace.deprecated (Daytona alias)              0 consumers          │ ← dead
│ Box API (openapi/box.openapi.yaml)               box create/exec/...   │
└─────────────────────────────────────────────────────────────────────┘

RULE:  an endpoint lives where its capability lives
       engine can fulfil it      → Box API
       needs cloud ingredients   → Cloud API
       (signing keys, gateways, billing clock)

AFTER — one owner each
┌──────────────────────────────┐        ┌──────────────────────────────┐
│ Cloud API  (cloud-only)       │        │ Box API  (the only box-ops    │
│  orgs, billing, api keys,     │        │           contract)           │
│  audit, webhooks,             │        │  create / start / stop /      │
│  signed preview URLs, ssh,    │        │  delete, exec, files,         │
│  archive/recover, org reads   │        │  snapshots                    │
└──────────────────────────────┘        └──────────────────────────────┘
        served by NestJS                  served by apps/api/src/boxlite-rest
        + a drift-workflow guard: cloud spec must never re-grow
          /toolbox//exec//files//workspace; Box API spec stays tenancy-free

DELETED (the bulk of the line count):
  toolbox.deprecated (68 eps)  ·  workspace.deprecated  ·  4 box verbs in box.controller
  apps/libs/toolbox-api-client (generated, 0 callers)  ·  sdk-typescript (retired)
  dashboard Playground/VNC suite (flag default-off)

Why ~90k deletions is not as large as it looks

~95%  deleting GENERATED clients (api-client-go, toolbox-api-client) +
      the retired TS SDK + the dead Playground/VNC suite
~1–2k actual hand-written change: contract rewiring (verb ownership,
      metrics route, handwritten cloudBox Box-API client, drift guard)

Impact

  • Breaking: removes toolbox.deprecated (68 endpoints), workspace.deprecated, and 4 box verbs from box.controller. Only known consumer was the TS SDK (removed in this PR) — confirm no external callers before merge.
  • Dashboard: box create/start/stop/delete now go through the Box API (/v1/{org}/boxes); Playground/VNC retired.
  • Clients: api-client + api-client-go regenerated (ToolboxApi/WorkspaceApi + the verbs disappear); toolbox-api-client deleted.
  • Must merge before launch — afterwards these removals require a deprecation cycle.
  • Touches the same box files as feat(box): restore image-keyed warm-pool reuse and boot path #755/refactor(box): drop the dead userId field from the runner payload #757coordinate rebase timing with their author.

Stacked on #743 (base = chore/remove-ts-cloud-sdk). Merge order: #743#744#735 → this. Will be rebased and clients re-regenerated as those land. Must merge before launch — afterwards these endpoint removals become breaking changes requiring a deprecation cycle.

Summary

Give each REST contract a single owner, before launch locks them in:

  • Cloud API (NestJS-exported openapi.json) = cloud capabilities only: organizations, billing, keys, audit, webhooks, signed preview URLs, ssh access, archive/recover, rich org-scoped reads.
  • Box API (openapi/box.openapi.yaml, served by apps/api/src/boxlite-rest) = the only contract for box operations: create/start/stop/delete, exec, files, snapshots.

Ownership rule, one line: an endpoint lives where its capability lives — if the engine can fulfil it, it belongs to the Box API; if it needs cloud ingredients (signing keys, gateways, the billing clock), it belongs to the cloud API.

Commits

  1. refactor(api) — delete toolbox.deprecated.* (68 endpoints; their only real consumer was the TS SDK removed in chore(apps): remove TypeScript cloud SDK (re-apply #738 onto main) #743) and workspace.deprecated.* (legacy Daytona alias, zero consumers); delete the four box verbs from box.controller (now owned by boxlite-rest); add cloud-optional create fields (labels/public/auto_stop_interval/auto_delete_interval) to the Box API contract (local engines ignore them); rewire metrics capture to the /api/v1 routes.
  2. refactor(dashboard)cloudBox.ts becomes a small handwritten Box API client; create/start/stop/delete mutations and bulk actions switch to /v1/{org}/boxes (create re-reads the full org-scoped Box via getBox, so UI types are unchanged); delete the dead Playground suite, VNC chain (route was hidden, flag default-false, feature retired), useBoxSession (zero consumers), and ToolboxApi wiring. Adds a unit test for the contract translation (GiB→MiB etc.).
  3. chore(clients) — regenerate api-client (TS) + api-client-go in the CI-faithful box pipeline (ToolboxApi/WorkspaceApi and the verbs disappear); delete apps/libs/toolbox-api-client entirely (zero callers); add a contract boundary guard to the drift workflow: cloud spec must never re-grow /toolbox//exec//files//workspace paths, Box API spec must stay tenancy-free.

What still overlaps (by design, documented)

Cloud getBox/paginated list stay on the cloud API: they are org-scoped metadata reads (region, labels, billing states) the engine cannot serve — per the ownership rule they are cloud capabilities that happen to be about a box. Same for signed URLs/ssh/archive/recover.

Consumer safety (each verified in code)

Consumer Impact
Web terminal none — signed port URL + iframe, never touched toolbox
Box create/list/start/stop/delete in dashboard migrated to Box API door; full vite build + vitest green
Observability tabs none — analytics client
SDKs/CLI (REST mode) none — they already speak the Box API contract
Internal Go services (proxy, runner poller) none — they use for-runner/state endpoints, untouched; go build green
External api-client/api-client-go users ToolboxApi/WorkspaceApi/verbs removed — acceptable pre-launch, all endpoints were marked Deprecated

Verification

  • nx test api green (incl. new mapper spec); tsc --noEmit clean.
  • Dashboard vite build --minify false: 0 TS errors (baseline-equal); vitest 6/6.
  • go build ./... green for api-client-go and apps/proxy. (apps/runner cmd link needs libboxlite.a, not built in this worktree — environment-only, packages compile.)
  • Regenerated cloud spec contains no /toolbox/, /workspace, or verb paths; boundary guard dry-run clean both directions.

Out of scope / follow-ups

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 300 files, which is 150 over the limit of 150.

To get a review, narrow the scope:
• coderabbit review --type committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9c207acd-24f8-4da0-8bdb-830850a066d0

📥 Commits

Reviewing files that changed from the base of the PR and between 707fb80 and 999a2e2.

📒 Files selected for processing (300)
  • .github/workflows/api-client-drift.yml
  • apps/api-client-go/.openapi-generator/FILES
  • apps/api-client-go/api/openapi.yaml
  • apps/api-client-go/api_box.go
  • apps/api-client-go/api_toolbox.go
  • apps/api-client-go/api_workspace.go
  • apps/api-client-go/client.go
  • apps/api-client-go/model_box.go
  • apps/api-client-go/model_box_info.go
  • apps/api-client-go/model_command.go
  • apps/api-client-go/model_completion_context.go
  • apps/api-client-go/model_completion_item.go
  • apps/api-client-go/model_completion_list.go
  • apps/api-client-go/model_compressed_screenshot_response.go
  • apps/api-client-go/model_computer_use_start_response.go
  • apps/api-client-go/model_computer_use_status_response.go
  • apps/api-client-go/model_computer_use_stop_response.go
  • apps/api-client-go/model_create_box.go
  • apps/api-client-go/model_create_session_request.go
  • apps/api-client-go/model_create_workspace.go
  • apps/api-client-go/model_display_info_response.go
  • apps/api-client-go/model_download_files.go
  • apps/api-client-go/model_execute_request.go
  • apps/api-client-go/model_execute_response.go
  • apps/api-client-go/model_file_info.go
  • apps/api-client-go/model_file_status.go
  • apps/api-client-go/model_git_add_request.go
  • apps/api-client-go/model_git_branch_request.go
  • apps/api-client-go/model_git_checkout_request.go
  • apps/api-client-go/model_git_clone_request.go
  • apps/api-client-go/model_git_commit_info.go
  • apps/api-client-go/model_git_commit_request.go
  • apps/api-client-go/model_git_commit_response.go
  • apps/api-client-go/model_git_delete_branch_request.go
  • apps/api-client-go/model_git_repo_request.go
  • apps/api-client-go/model_git_status.go
  • apps/api-client-go/model_keyboard_hotkey_request.go
  • apps/api-client-go/model_keyboard_press_request.go
  • apps/api-client-go/model_keyboard_type_request.go
  • apps/api-client-go/model_list_branch_response.go
  • apps/api-client-go/model_lsp_completion_params.go
  • apps/api-client-go/model_lsp_document_request.go
  • apps/api-client-go/model_lsp_location.go
  • apps/api-client-go/model_lsp_server_request.go
  • apps/api-client-go/model_lsp_symbol.go
  • apps/api-client-go/model_match.go
  • apps/api-client-go/model_mouse_click_request.go
  • apps/api-client-go/model_mouse_click_response.go
  • apps/api-client-go/model_mouse_drag_request.go
  • apps/api-client-go/model_mouse_drag_response.go
  • apps/api-client-go/model_mouse_move_request.go
  • apps/api-client-go/model_mouse_move_response.go
  • apps/api-client-go/model_mouse_position.go
  • apps/api-client-go/model_mouse_scroll_request.go
  • apps/api-client-go/model_mouse_scroll_response.go
  • apps/api-client-go/model_position.go
  • apps/api-client-go/model_process_errors_response.go
  • apps/api-client-go/model_process_logs_response.go
  • apps/api-client-go/model_process_restart_response.go
  • apps/api-client-go/model_process_status_response.go
  • apps/api-client-go/model_project_dir_response.go
  • apps/api-client-go/model_pty_create_request.go
  • apps/api-client-go/model_pty_create_response.go
  • apps/api-client-go/model_pty_list_response.go
  • apps/api-client-go/model_pty_resize_request.go
  • apps/api-client-go/model_pty_session_info.go
  • apps/api-client-go/model_range.go
  • apps/api-client-go/model_region_screenshot_response.go
  • apps/api-client-go/model_replace_request.go
  • apps/api-client-go/model_replace_result.go
  • apps/api-client-go/model_screenshot_response.go
  • apps/api-client-go/model_search_files_response.go
  • apps/api-client-go/model_session.go
  • apps/api-client-go/model_session_execute_request.go
  • apps/api-client-go/model_session_execute_response.go
  • apps/api-client-go/model_user_home_dir_response.go
  • apps/api-client-go/model_windows_response.go
  • apps/api-client-go/model_work_dir_response.go
  • apps/api-client-go/model_workspace.go
  • apps/api-client-go/model_workspace_port_preview_url.go
  • apps/api/Dockerfile
  • apps/api/src/box/box.module.ts
  • apps/api/src/box/controllers/box.controller.ts
  • apps/api/src/box/controllers/toolbox.deprecated.controller.ts
  • apps/api/src/box/controllers/workspace.deprecated.controller.ts
  • apps/api/src/box/dto/create-workspace.deprecated.dto.ts
  • apps/api/src/box/dto/toolbox.deprecated.dto.ts
  • apps/api/src/box/dto/workspace-port-preview-url.deprecated.dto.ts
  • apps/api/src/box/dto/workspace.deprecated.dto.ts
  • apps/api/src/box/services/toolbox.deprecated.service.ts
  • apps/api/src/boxlite-rest/boxlite-proxy.controller.ts
  • apps/api/src/boxlite-rest/dto/create-box.dto.ts
  • apps/api/src/boxlite-rest/mappers/box-to-box.mapper.spec.ts
  • apps/api/src/boxlite-rest/mappers/box-to-box.mapper.ts
  • apps/api/src/interceptors/metrics.interceptor.ts
  • apps/dashboard/.storybook/main.ts
  • apps/dashboard/project.json
  • apps/dashboard/src/App.tsx
  • apps/dashboard/src/api/apiClient.ts
  • apps/dashboard/src/components/BoxTable/BoxTableActions.tsx
  • apps/dashboard/src/components/BoxTable/columns.tsx
  • apps/dashboard/src/components/BoxTable/index.tsx
  • apps/dashboard/src/components/BoxTable/types.ts
  • apps/dashboard/src/components/BoxTable/useBoxTable.ts
  • apps/dashboard/src/components/Playground/ActionForm.tsx
  • apps/dashboard/src/components/Playground/ActionRunButton.tsx
  • apps/dashboard/src/components/Playground/Box/CodeSnippets/code-language.test.ts
  • apps/dashboard/src/components/Playground/Box/CodeSnippets/index.ts
  • apps/dashboard/src/components/Playground/Box/CodeSnippets/python.ts
  • apps/dashboard/src/components/Playground/Box/CodeSnippets/types.ts
  • apps/dashboard/src/components/Playground/Box/CodeSnippets/typescript.ts
  • apps/dashboard/src/components/Playground/Box/CodeSnippets/utils.ts
  • apps/dashboard/src/components/Playground/Box/CodeSnippetsResponse.tsx
  • apps/dashboard/src/components/Playground/Box/Parameters/FileSystem.tsx
  • apps/dashboard/src/components/Playground/Box/Parameters/GitOperations.tsx
  • apps/dashboard/src/components/Playground/Box/Parameters/Management.tsx
  • apps/dashboard/src/components/Playground/Box/Parameters/ProcessCodeExecution.tsx
  • apps/dashboard/src/components/Playground/Box/Parameters/index.tsx
  • apps/dashboard/src/components/Playground/Inputs/CheckboxInput.tsx
  • apps/dashboard/src/components/Playground/Inputs/InlineInputFormControl.tsx
  • apps/dashboard/src/components/Playground/Inputs/Label.tsx
  • apps/dashboard/src/components/Playground/Inputs/NumberInput.tsx
  • apps/dashboard/src/components/Playground/Inputs/SelectInput.tsx
  • apps/dashboard/src/components/Playground/Inputs/StackedInputFormControl.tsx
  • apps/dashboard/src/components/Playground/Inputs/TextInput.tsx
  • apps/dashboard/src/components/Playground/PlaygroundLayout.tsx
  • apps/dashboard/src/components/Playground/ResponseCard.tsx
  • apps/dashboard/src/components/Playground/Terminal/Description.tsx
  • apps/dashboard/src/components/Playground/Terminal/WebTerminal.tsx
  • apps/dashboard/src/components/Playground/VNC/DesktopWindowResponse.tsx
  • apps/dashboard/src/components/Playground/VNC/Interaction/Display.tsx
  • apps/dashboard/src/components/Playground/VNC/Interaction/Keyboard.tsx
  • apps/dashboard/src/components/Playground/VNC/Interaction/Mouse.tsx
  • apps/dashboard/src/components/Playground/VNC/Interaction/Screenshot.tsx
  • apps/dashboard/src/components/Playground/VNC/Interaction/index.tsx
  • apps/dashboard/src/components/Playground/Window.tsx
  • apps/dashboard/src/components/boxes/BoxContentTabs.tsx
  • apps/dashboard/src/components/boxes/BoxDetails.tsx
  • apps/dashboard/src/components/boxes/BoxVncFullscreen.tsx
  • apps/dashboard/src/components/boxes/BoxVncTab.tsx
  • apps/dashboard/src/components/boxes/SearchParams.ts
  • apps/dashboard/src/components/boxes/index.ts
  • apps/dashboard/src/contexts/BoxSessionContext.tsx
  • apps/dashboard/src/contexts/PlaygroundContext.tsx
  • apps/dashboard/src/enums/FeatureFlags.ts
  • apps/dashboard/src/enums/Playground.ts
  • apps/dashboard/src/enums/RoutePath.ts
  • apps/dashboard/src/hooks/mutations/useArchiveBoxMutation.ts
  • apps/dashboard/src/hooks/mutations/useCreateBoxMutation.tsx
  • apps/dashboard/src/hooks/mutations/useDeleteBoxMutation.ts
  • apps/dashboard/src/hooks/mutations/useStartBoxMutation.ts
  • apps/dashboard/src/hooks/mutations/useStartVncMutation.ts
  • apps/dashboard/src/hooks/mutations/useStopBoxMutation.ts
  • apps/dashboard/src/hooks/queries/queryKeys.ts
  • apps/dashboard/src/hooks/queries/useVncSessionQuery.ts
  • apps/dashboard/src/hooks/queries/useVncStatusQuery.ts
  • apps/dashboard/src/hooks/useBoxSession.ts
  • apps/dashboard/src/hooks/usePlayground.ts
  • apps/dashboard/src/hooks/usePlaygroundBox.tsx
  • apps/dashboard/src/lib/cloudBox.test.ts
  • apps/dashboard/src/lib/cloudBox.ts
  • apps/dashboard/src/lib/dashboard-features.test.ts
  • apps/dashboard/src/lib/dashboard-features.ts
  • apps/dashboard/src/lib/playground.tsx
  • apps/dashboard/src/pages/Boxes.tsx
  • apps/dashboard/src/pages/Playground.tsx
  • apps/dashboard/src/providers/BoxSessionProvider.tsx
  • apps/dashboard/src/providers/PlaygroundBoxProvider.tsx
  • apps/dashboard/src/providers/PlaygroundProvider.tsx
  • apps/dashboard/tsconfig.app.json
  • apps/dashboard/vite.config.mts
  • apps/eslint.config.mjs
  • apps/infra-local/scripts/stack-up.sh
  • apps/libs/api-client/src/.openapi-generator/FILES
  • apps/libs/api-client/src/api.ts
  • apps/libs/api-client/src/api/box-api.ts
  • apps/libs/api-client/src/api/toolbox-api.ts
  • apps/libs/api-client/src/api/workspace-api.ts
  • apps/libs/api-client/src/docs/Box.md
  • apps/libs/api-client/src/docs/BoxApi.md
  • apps/libs/api-client/src/docs/BoxInfo.md
  • apps/libs/api-client/src/docs/Command.md
  • apps/libs/api-client/src/docs/CompletionContext.md
  • apps/libs/api-client/src/docs/CompletionItem.md
  • apps/libs/api-client/src/docs/CompletionList.md
  • apps/libs/api-client/src/docs/CompressedScreenshotResponse.md
  • apps/libs/api-client/src/docs/ComputerUseStartResponse.md
  • apps/libs/api-client/src/docs/ComputerUseStatusResponse.md
  • apps/libs/api-client/src/docs/ComputerUseStopResponse.md
  • apps/libs/api-client/src/docs/CreateBox.md
  • apps/libs/api-client/src/docs/CreateSessionRequest.md
  • apps/libs/api-client/src/docs/CreateWorkspace.md
  • apps/libs/api-client/src/docs/DisplayInfoResponse.md
  • apps/libs/api-client/src/docs/DownloadFiles.md
  • apps/libs/api-client/src/docs/ExecuteRequest.md
  • apps/libs/api-client/src/docs/ExecuteResponse.md
  • apps/libs/api-client/src/docs/FileInfo.md
  • apps/libs/api-client/src/docs/FileStatus.md
  • apps/libs/api-client/src/docs/GitAddRequest.md
  • apps/libs/api-client/src/docs/GitBranchRequest.md
  • apps/libs/api-client/src/docs/GitCheckoutRequest.md
  • apps/libs/api-client/src/docs/GitCloneRequest.md
  • apps/libs/api-client/src/docs/GitCommitInfo.md
  • apps/libs/api-client/src/docs/GitCommitRequest.md
  • apps/libs/api-client/src/docs/GitCommitResponse.md
  • apps/libs/api-client/src/docs/GitDeleteBranchRequest.md
  • apps/libs/api-client/src/docs/GitRepoRequest.md
  • apps/libs/api-client/src/docs/GitStatus.md
  • apps/libs/api-client/src/docs/KeyboardHotkeyRequest.md
  • apps/libs/api-client/src/docs/KeyboardPressRequest.md
  • apps/libs/api-client/src/docs/KeyboardTypeRequest.md
  • apps/libs/api-client/src/docs/ListBranchResponse.md
  • apps/libs/api-client/src/docs/LspCompletionParams.md
  • apps/libs/api-client/src/docs/LspDocumentRequest.md
  • apps/libs/api-client/src/docs/LspLocation.md
  • apps/libs/api-client/src/docs/LspServerRequest.md
  • apps/libs/api-client/src/docs/LspSymbol.md
  • apps/libs/api-client/src/docs/Match.md
  • apps/libs/api-client/src/docs/MouseClickRequest.md
  • apps/libs/api-client/src/docs/MouseClickResponse.md
  • apps/libs/api-client/src/docs/MouseDragRequest.md
  • apps/libs/api-client/src/docs/MouseDragResponse.md
  • apps/libs/api-client/src/docs/MouseMoveRequest.md
  • apps/libs/api-client/src/docs/MouseMoveResponse.md
  • apps/libs/api-client/src/docs/MousePosition.md
  • apps/libs/api-client/src/docs/MouseScrollRequest.md
  • apps/libs/api-client/src/docs/MouseScrollResponse.md
  • apps/libs/api-client/src/docs/Position.md
  • apps/libs/api-client/src/docs/ProcessErrorsResponse.md
  • apps/libs/api-client/src/docs/ProcessLogsResponse.md
  • apps/libs/api-client/src/docs/ProcessRestartResponse.md
  • apps/libs/api-client/src/docs/ProcessStatusResponse.md
  • apps/libs/api-client/src/docs/ProjectDirResponse.md
  • apps/libs/api-client/src/docs/PtyCreateRequest.md
  • apps/libs/api-client/src/docs/PtyCreateResponse.md
  • apps/libs/api-client/src/docs/PtyListResponse.md
  • apps/libs/api-client/src/docs/PtyResizeRequest.md
  • apps/libs/api-client/src/docs/PtySessionInfo.md
  • apps/libs/api-client/src/docs/Range.md
  • apps/libs/api-client/src/docs/RegionScreenshotResponse.md
  • apps/libs/api-client/src/docs/ReplaceRequest.md
  • apps/libs/api-client/src/docs/ReplaceResult.md
  • apps/libs/api-client/src/docs/ScreenshotResponse.md
  • apps/libs/api-client/src/docs/SearchFilesResponse.md
  • apps/libs/api-client/src/docs/Session.md
  • apps/libs/api-client/src/docs/SessionExecuteRequest.md
  • apps/libs/api-client/src/docs/SessionExecuteResponse.md
  • apps/libs/api-client/src/docs/ToolboxApi.md
  • apps/libs/api-client/src/docs/UserHomeDirResponse.md
  • apps/libs/api-client/src/docs/WindowsResponse.md
  • apps/libs/api-client/src/docs/WorkDirResponse.md
  • apps/libs/api-client/src/docs/Workspace.md
  • apps/libs/api-client/src/docs/WorkspaceApi.md
  • apps/libs/api-client/src/docs/WorkspacePortPreviewUrl.md
  • apps/libs/api-client/src/models/box-info.ts
  • apps/libs/api-client/src/models/box.ts
  • apps/libs/api-client/src/models/command.ts
  • apps/libs/api-client/src/models/completion-context.ts
  • apps/libs/api-client/src/models/completion-item.ts
  • apps/libs/api-client/src/models/completion-list.ts
  • apps/libs/api-client/src/models/compressed-screenshot-response.ts
  • apps/libs/api-client/src/models/computer-use-start-response.ts
  • apps/libs/api-client/src/models/computer-use-status-response.ts
  • apps/libs/api-client/src/models/computer-use-stop-response.ts
  • apps/libs/api-client/src/models/create-box.ts
  • apps/libs/api-client/src/models/create-session-request.ts
  • apps/libs/api-client/src/models/create-workspace.ts
  • apps/libs/api-client/src/models/display-info-response.ts
  • apps/libs/api-client/src/models/download-files.ts
  • apps/libs/api-client/src/models/execute-request.ts
  • apps/libs/api-client/src/models/execute-response.ts
  • apps/libs/api-client/src/models/file-info.ts
  • apps/libs/api-client/src/models/file-status.ts
  • apps/libs/api-client/src/models/git-add-request.ts
  • apps/libs/api-client/src/models/git-branch-request.ts
  • apps/libs/api-client/src/models/git-checkout-request.ts
  • apps/libs/api-client/src/models/git-clone-request.ts
  • apps/libs/api-client/src/models/git-commit-info.ts
  • apps/libs/api-client/src/models/git-commit-request.ts
  • apps/libs/api-client/src/models/git-commit-response.ts
  • apps/libs/api-client/src/models/git-delete-branch-request.ts
  • apps/libs/api-client/src/models/git-repo-request.ts
  • apps/libs/api-client/src/models/git-status.ts
  • apps/libs/api-client/src/models/index.ts
  • apps/libs/api-client/src/models/keyboard-hotkey-request.ts
  • apps/libs/api-client/src/models/keyboard-press-request.ts
  • apps/libs/api-client/src/models/keyboard-type-request.ts
  • apps/libs/api-client/src/models/list-branch-response.ts
  • apps/libs/api-client/src/models/lsp-completion-params.ts
  • apps/libs/api-client/src/models/lsp-document-request.ts
  • apps/libs/api-client/src/models/lsp-location.ts
  • apps/libs/api-client/src/models/lsp-server-request.ts
  • apps/libs/api-client/src/models/lsp-symbol.ts
  • apps/libs/api-client/src/models/match.ts
  • apps/libs/api-client/src/models/mouse-click-request.ts
  • apps/libs/api-client/src/models/mouse-click-response.ts
  • apps/libs/api-client/src/models/mouse-drag-request.ts
  • apps/libs/api-client/src/models/mouse-drag-response.ts
  • apps/libs/api-client/src/models/mouse-move-request.ts
  • apps/libs/api-client/src/models/mouse-move-response.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/single-owner-contracts

Comment @coderabbitai help to get the list of available commands and usage tips.

law-chain-hot and others added 5 commits June 13, 2026 19:02
- Remove the publishable apps/libs/sdk-typescript project and its
Nx/build references.
- Replace Dashboard's prior @boxlite-ai/sdk usage with a
Dashboard-private cloudBox adapter backed by generated REST clients.
- Remove TypeScript Cloud SDK playground snippets so the UI no longer
teaches users to install @boxlite-ai/sdk.

The large diff is not because the delete itself is complicated. It is
because `apps/libs/sdk-typescript` had two roles mixed together: it was
a customer-facing package, and Dashboard was also importing it as an
internal cloud box facade.

Legend:
- `*** DELETE TARGET ***` = the package this PR removes.
- `*** REMOVED USER SURFACE ***` = user-facing code/docs path removed
because it advertised that package.
- `[kept]` = still exists after this PR.
- `[new internal]` = Dashboard-only replacement, not a public SDK.

```text
BEFORE

*** REMOVED USER SURFACE ***
+------------------------------------------------+
| Playground TypeScript snippet                  |
| tells users: npm install @boxlite-ai/sdk       |
+-------------------------+----------------------+
                          |
                          | teaches users this package exists
                          v
+------------------------------------------------+      imports       +------------------------------------------------+
| Dashboard Playground                           | -----------------> | *** DELETE TARGET ***                          |
| hooks/providers/VNC/snippets                   |                    | apps/libs/sdk-typescript                       |
|                                                |                    | public package: @boxlite-ai/sdk                |
+------------------------------------------------+                    +-------------------------+----------------------+
                                                                                              |
                                                                                              | wraps
                                                                                              v
                                                                             +------------------------------------------------+
                                                                             | [kept] generated REST API clients             |
                                                                             | api-client / toolbox-api-client               |
                                                                             +-------------------------+----------------------+
                                                                                                       |
                                                                                                       | HTTP
                                                                                                       v
                                                                             +------------------------------------------------+
                                                                             | [kept] BoxLite API / toolbox runtime          |
                                                                             +------------------------------------------------+

Build graph tied to the delete target:
Dashboard tsconfig alias -> Vite SDK alias/polyfills -> Nx dependency -> Docker COPY -> eslint exception
```

```text
AFTER

*** REMOVED USER SURFACE ***
+------------------------------------------------+
| Playground TypeScript snippet                  |
| npm install @boxlite-ai/sdk                    |
|                                                |
| STATUS: DELETED                                |
+------------------------------------------------+

*** DELETE TARGET ***
+------------------------------------------------+
| apps/libs/sdk-typescript                       |
| public package: @boxlite-ai/sdk                |
|                                                |
| STATUS: DELETED                                |
+------------------------------------------------+

Dashboard internal path, after removing the public SDK dependency:

+------------------------------------------------+      imports       +------------------------------------------------+
| [kept] Dashboard Playground                    | -----------------> | [new internal] Dashboard-private cloudBox       |
| hooks/providers/VNC/snippets                   |                    | apps/dashboard/src/lib/cloudBox.ts             |
|                                                |                    | small adapter; not published to customers      |
+------------------------------------------------+                    +-------------------------+----------------------+
                                                                                              |
                                                                                              | calls
                                                                                              v
                                                                             +------------------------------------------------+
                                                                             | [kept] generated REST API clients             |
                                                                             | api-client / toolbox-api-client               |
                                                                             +-------------------------+----------------------+
                                                                                                       |
                                                                                                       | HTTP
                                                                                                       v
                                                                             +------------------------------------------------+
                                                                             | [kept] BoxLite API / toolbox runtime          |
                                                                             +------------------------------------------------+

Build graph cleanup after deleting the target:
No @boxlite-ai/sdk alias -> no SDK Vite polyfills -> no Nx build edge -> no Docker COPY -> no SDK lint exception
```

So the diff fans out into four necessary buckets:

1. Delete the public SDK project itself: `apps/libs/sdk-typescript/**`.
2. Keep Dashboard working by replacing SDK imports with
`apps/dashboard/src/lib/cloudBox.ts`.
3. Stop advertising the removed SDK in Playground code snippets.
4. Remove build-system references that would otherwise point at a
deleted project.

- NX_DAEMON=false corepack yarn nx build dashboard
--configuration=development --nxBail=true --output-style=stream
- NX_DAEMON=false corepack yarn nx build api --configuration=development
--nxBail=true --output-style=stream
- make lint:apps
- rg -n "@boxlite-ai/sdk|sdk-typescript" . -S
…oolbox/workspace surfaces and box verbs

- Delete toolbox.deprecated.{controller,service,dto} (68 proxy endpoints).
  Their only real consumer was the TypeScript cloud SDK removed in #743;
  the dashboard Playground/VNC routes that also called them are dark.
- Delete workspace.deprecated.controller + dtos (legacy Daytona alias
  surface, zero consumers).
- Delete createBox/deleteBox/startBox/stopBox from box.controller.
  Box verbs are now owned solely by the Box API contract
  (openapi/box.openapi.yaml), served by boxlite-rest. Cloud-capability
  endpoints (signed URLs, ssh, archive, recover, paginated reads, getBox)
  stay: they consume cloud-only ingredients the engine cannot provide.
- boxlite-rest CreateBoxDto + box.openapi.yaml: add cloud-optional create
  fields (labels/public/auto_stop_interval/auto_delete_interval) so the
  dashboard create form can speak the Box API dialect. Local engine
  servers ignore them (serde drops unknown fields).
- metrics.interceptor: move box-create/start/stop capture from the
  removed /api/box routes to the /api/v1 boxes routes.
- apps/api/Dockerfile: drop the toolbox-api-client COPY (package removed
  later in this branch).
… the dead Playground/VNC chain

- cloudBox.ts rewritten as a small handwritten client for the Box API
  contract (openapi/box.openapi.yaml, served by boxlite-rest):
  toBoxApiCreateRequest mapping + create/start/stop/delete helpers
  calling /v1/{org}/boxes through the ApiClient axios instance.
- create/start/stop/delete mutations and Boxes.tsx bulk actions switch
  from the generated boxApi verbs (removed from the cloud contract in
  the previous commit) to those helpers. Create re-reads the full
  organization-scoped Box via boxApi.getBox so caller types stay
  unchanged. All call sites fail fast on a missing organization.
- Delete dead code: the Playground suite (pages/components/providers/
  contexts/hooks/lib), VNC components and queries (BoxVncTab/Fullscreen,
  useVncSession/StatusQuery, useStartVncMutation), useBoxSession (zero
  consumers — terminals use useBoxSessionContext + useTerminalSessionQuery),
  useArchiveBoxMutation (byte-duplicate of useStopBoxMutation, zero
  importers), vnc/playground enums, feature flags, routes, queryKeys,
  and the ToolboxApi wiring in apiClient.ts.
- Add cloudBox.test.ts covering the contract translation (GiB→MiB,
  networkBlockAll→network.mode, cloud-only field passthrough).
- tsconfig.app.json: drop the toolbox-api-client path mapping.
…d cloud spec; drop toolbox-api-client; add contract boundary CI guard

- apps/libs/api-client (TS) and apps/api-client-go regenerated from the
  slimmed cloud spec in the CI-faithful BoxLite-box pipeline: the
  ToolboxApi/WorkspaceApi classes, their models, and the four box verb
  operations disappear from both clients.
- apps/libs/toolbox-api-client deleted entirely. It was the generated TS
  client for the in-box daemon contract; its last consumer was a
  type-only import removed with the Playground.
- api-client-drift workflow: stop regenerating the removed package and
  add a contract boundary guard — the exported cloud spec must not
  re-grow /toolbox//exec//files//workspace paths, and
  openapi/box.openapi.yaml must stay tenancy-free
  (organizationId//organizations/billing).
- apps/tsconfig.base.json: drop the toolbox-api-client path mapping.
@law-chain-hot law-chain-hot force-pushed the refactor/single-owner-contracts branch from 15c2913 to 999a2e2 Compare June 13, 2026 11:10
@law-chain-hot law-chain-hot marked this pull request as ready for review June 13, 2026 11:11
@law-chain-hot law-chain-hot requested a review from a team as a code owner June 13, 2026 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant