Roo-Code/packages/cloud/src/CloudAPI.ts
davincidreams be83bb6698 feat: port Claude Code CLI features and add parallel agent/worktree support
- Port session memory compaction, microcompact, hooks system, and
  prompt-too-long retry from the Claude Code CLI source
- Add spawn_parallel_tasks tool with serial queue drain fan-out pattern
- Add worktree isolation: new_task/spawn_parallel_tasks accept a worktree
  param; ClineProvider creates/cleans up git worktrees per child task
- Add completionPayload: attempt_completion result parsed as JSON and
  aggregated across parallel tasks for structured fan-in
- Fix workspacePath priority so explicit override always wins over parent
- Emit TaskSpawned event from delegateParentAndOpenChild
- Scope MCP hub to per-task workspacePath for worktree-aware mcp.json
- Fix microCompact bugs: touched flag, off-by-one threshold, keepRecent:0
- Fix lazy OutputChannel init in hooks executor to avoid test failures
- Fix pre-existing lint warnings across src, packages/cloud, webview-ui

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 23:50:56 -04:00

52 lines
1.8 KiB
TypeScript

import { type AuthService, type ShareVisibility, type ShareResponse } from "@roo-code/types"
import { getRooCodeApiUrl } from "./config.js"
import { CloudAPIError } from "./errors.js"
interface CloudAPIRequestOptions extends Omit<RequestInit, "headers"> {
timeout?: number
headers?: Record<string, string>
}
export class CloudAPI {
private authService: AuthService
private log: (...args: unknown[]) => void
private baseUrl: string
constructor(authService: AuthService, log?: (...args: unknown[]) => void) {
this.authService = authService
this.log = log || console.log
this.baseUrl = getRooCodeApiUrl()
}
// Cloud features disabled — all HTTP methods are no-ops.
private async request<T>(
_endpoint: string,
_options: CloudAPIRequestOptions & {
parseResponse?: (data: unknown) => T
} = {},
): Promise<T> {
// No-op: cloud features disabled
throw new CloudAPIError("Cloud features are disabled in this fork", 0, undefined)
}
private async handleErrorResponse(_response: Response, _endpoint: string): Promise<never> {
throw new CloudAPIError("Cloud features are disabled in this fork", 0, undefined)
}
async shareTask(_taskId: string, _visibility: ShareVisibility = "organization"): Promise<ShareResponse> {
this.log("[CloudAPI] Cloud features disabled — shareTask is a no-op")
throw new CloudAPIError("Cloud features are disabled in this fork", 0, undefined)
}
async bridgeConfig() {
this.log("[CloudAPI] Cloud features disabled — bridgeConfig is a no-op")
throw new CloudAPIError("Cloud features are disabled in this fork", 0, undefined)
}
async creditBalance(): Promise<number> {
this.log("[CloudAPI] Cloud features disabled — creditBalance is a no-op")
throw new CloudAPIError("Cloud features are disabled in this fork", 0, undefined)
}
}