API reference
Cockpit server API
The Express backend of the Cockpit: routes, jobs, auth, workspace containment.
46 modules, 285 documented exports. Version v0.8. All packages.
ui/server/src
- auth-1Exports: AuthConfigError, DEFAULT_SESSION_TTL_HOURS, SESSION_COOKIE, STATE_COOKIE, createAuth, isLoopbackHost, parseAllowedLogins, parseCookies, ...
- autoCommitCommit-on-save for the Cockpit — the trigger half, which is `ui/` (proprietary-future) because it is policy and lifecycle, not computation. Exports: AutoCommitError, DIRTY_ANSWERS, MAX_COALESCE_MS, answerDirtyPrompt, endSession, flushSession, getCommitConfig, getSessionStatus, ...
- cloneApislice A -- REST surface for cloning a public repository into the workspace, and for connecting a local project to a remote ("origin"). Exports: createCloneRouter, createRemoteRouter, remoteStatus
- cloneAuthslice B -- the one-time access token for cloning a PRIVATE repository. Exports: ASKPASS_SCRIPT, AUTH_MESSAGE, AUTH_MESSAGE_WITH_TOKEN, MAX_TOKEN_LENGTH, TOKEN_USERNAME, createAskpass, feedToken, looksLikeAuthFailure, ...
- cloneJobs-1Exports: CLONE_STAMP, DEFAULT_MAX_BYTES, DEFAULT_TIMEOUT_MS, MARKER_PREFIX, cloneArgs, cloneEnv, createCloneJobs, dirBytes, ...
- commandRunnerRuns one of the core CLI's exported functions (create/refactor/research/ importCommand from src/cli.mjs) and turns its console output into a structured result the frontend can render — in particular, splitting out the... Exports: CommandTimeoutError, DEFAULT_COMMAND_TIMEOUT_SEC, resolveCommandTimeoutMs, runCapturing, withDir
- componentsApiThe Components screen's API. Exports: MAX_COMPONENT_BYTES, MAX_EDIT_BYTES, componentDescribe, componentSave, componentsIndex, componentSource, createComponentsRouter, listComponents
- coreExecutorthe executor seam: WHICH implementation runs a core activity for the Cockpit. Exports: ExecutionError, CLI_BIN_ENV, CLI_TIMEOUT_ENV, DEFAULT_CLI_TIMEOUT_MS, parseValidateOutput, resolveCliBin, resolveExecutionMode, runValidate
- devServer-1Exports: DEFAULT_KILL_GRACE_MS, DEFAULT_PORT_BASE, DEFAULT_STARTUP_TIMEOUT_MS, REFUSALS, RESERVED_PORTS, busyPortFrom, createDevServerService, findFreePort, ...
- devServerApiREST surface for the target app's dev server (see devServer.mjs). Exports: createDevServerRouter
- dirBrowseThin HTTP-shaped adapter over src/dir-browser.mjs (all listing/allowlist/ symlink logic lives in core, reusable and tested there). Exports: handleBrowse
- flowApiFlow view: the read-only server half of the Browser pane's Files | Flow switch. Exports: clearFlowCache, featureFlow, flowFilePaths, projectSignature
- gitThe narrowest possible git interface the Cockpit needs. Exports: GitError, branchExists, commit, createBranch, currentBranch, git, hasStagedChanges, headSha, ...
- gitUrlslice A -- what a "clone this repository" request is allowed to name. Exports: CloneInputError, DEFAULT_CLONE_HOSTS, MAX_SLUG_LENGTH, MAX_URL_LENGTH, isPublicAddress, parseCloneUrl, resolveCloneHosts, validateBranch, ...
- health-1Exports: DEFAULT_MIN_FREE_MB, HEALTH_CACHE_MS, checkDir, createHealth, freeBytesOf, probeWritable, resolveMinFreeBytes
- logBufferA small, bounded, in-memory ring buffer of recent server/command output for the cockpit's Logs tab. Exports: MAX_ENTRIES, MAX_TEXT, serverLog, createLogBuffer, handleLogs
- ollamaThin wrapper around Ollama's local HTTP API (default http://localhost:11434, overridable via OLLAMA_HOST for anyone running it on a non-default port/host). Exports: getOllamaStatus, listOllamaModels, removeOllamaModel, startOllamaPull
- pageChangesthin glue between the core change tracker (src/file-change-tracker.mjs), the core diff view model (src/text-diff.mjs) and the Pages Editor routes. Exports: pageChangeTracker, adoptOwnWrite, describePageChange
- pagesEditor.golden.casesGolden-case corpus for the Pages Editor's deterministic JSX operations. Exports: REPLACEMENTS, SNIPPETS, SOURCES, normalizeGolden, runGoldenCases
- pagesEditorBackend for epic #48 (visual page/JSX tree editor) — #49 pages browser, #50 JSX tree parse, #52 snippet save-back, #53 props inspector, #54 auto-map, #56 enforcement guard. Exports: PagesEditorError, addChildInSnippet, applyAutoMap, applyWrapConfirm, buildAttributeSnippet, buildComponentUsageJsx, buildPaletteInsertion, buildProviderUsageStatement, ...
- pageSourcePages Editor source view: the full text of one page file plus live diagnostics for it. Exports: readPageSource
- planApiREST surface for Plan mode. Exports: createPlanRouter
- planService-1Exports: MAX_SEEDS, MAX_STEPS, MAX_TEXT, NOT_OFFERED, PATH_ARGS, checkPlan, cockpitErrors, createPlanService, ...
- processesApiREST surface for the Processes drawer. Exports: LOCAL_ACTOR, createProcessesRouter
- processesService-1Exports: CONTROL_EVENTS, LOG_TAIL, createProcessesService, processView, versionedSummary
- processesSocketlive updates for the Processes drawer. Exports: attachProcessesSocket
- projectGuard"Is there a project, and is its root inside the workspace?". Exports: NO_PROJECT_BODY, OUTSIDE_ROOT_BODY, containedProjectRoot, requireProject, rootEscapesWorkspace
- projectNavClick-to-navigate: the server half. Exports: openReference, resolveProjectFile, viewPage, viewProjectFile
- reviewAnalysesan analysis is a Process: one plan, one step, flow `review.analyze` (src/plan.mjs). Exports: ANALYSIS_FLOW, ANALYSIS_STEP, KEEP_FINISHED, analysisPlan, composeExecutors, createAnalyses, createResults, createReviewExecutor, ...
- reviewApiREST surface for Review mode. Exports: MAX_HEADS, createReviewRouter, slimReport
- reviewJobs-1Exports: createReviewJobs
- reviewPlansthe "expected scope" source for Review mode: the saved plans of the CURRENT PROJECT, which are the plans of the processes in the process store (a process stores its plan verbatim, #287). Exports: createPlanSource, expectedOf
- reviewRefsthe Review mode's list source: LOCAL BRANCHES, read with `git for-each-ref`. Exports: localBranches, commitsAhead, defaultBase, listLocalBranches, resolveListed
- reviewRunnerruns ONE analysis in a forked child process (reviewWorker.mjs), so the synchronous PR-health engine can never stall the Cockpit server's request thread. Exports: CANCEL_GRACE_MS, JOB_TIMEOUT_MS, WORKER, forkRunner
- reviewWorkerruns ONE analysis in a child process, so the synchronous PR-health engine (seconds on a big change) can never stall the Cockpit server's request thread. Exports: MAX_SUMMARIZED, analyse, summarizeChangedUnits
- settingsIn-memory settings for the UI server: which LLM provider each distinct LLM-touching capability should use, and which Construct project directory every command targets. Exports: getBrowseRoots, getProjectDir, getSettings, preloadProject, updateSettings
- testRunsrunning a feature's tests is a Process: one plan, one step, flow `test.run` (src/plan.mjs), exactly like a Review-mode analysis (reviewAnalyses.mjs, #351). Exports: KEEP_FINISHED_RUNS, TEST_RUN_FLOW, TEST_RUN_STEP, TEST_RUN_WORKER, createRunResults, createTestRunExecutor, createTestRunJobs, createTestRuns, ...
- testsApithe Tests tab's REST surface: list a feature's tests with the scenario coverage table, read one test, clone a locked generated test, and (re)generate a feature's locked tests. Exports: createTestsRouter
- testsEnvcan Playwright launch Chromium on this machine? Exports: environmentState
- unitsApiThin REST adapter over src/engine/unitSummary.mjs (deterministic unit summaries for bots and the Cockpit). Exports: featuresIndex, featureSummary, unitsIndex, unitSummary
- validateApi`GET /api/validate`: runs the same validation `construct validate` runs (aggregateValidation + DEFAULT_ENFORCERS from the core) against the current project's root and returns the violations as data. Exports: MAX_VIOLATIONS, handleValidate, handleValidateForProject
- wizardSocketWebSocket endpoint for the `import --route` guided wizard — the one inherently multi-turn, chat-shaped flow in Construct. Exports: attachWizardSocket
- workflowsViewerBackend for epic #57. Exports: editWorkflowFile, listWorkflowFeatures, listWorkflowFiles, readWorkflowMachines, readWorkflowNarrative, resolveWorkflowFile
- workspaceThe workspace boundary. Exports: WorkspaceError, MAX_PATH_LENGTH, contain, containInWorkspace, containOrNull, isInside, relativeToWorkspace, resetWorkspaceRootForTests, ...
- wsUpgradeTwo WebSocketServers cannot both be built with `{ server, path }`: ws aborts an upgrade whose path is not its own with a 400, so the first one attached would refuse the second one's connections. Exports: pathnameOf, refuseUnknownUpgrades, routeUpgrade