runTrainer(file?) | core/runner.ts | What arkor start calls under the hood. Resolves the entry, picks the trainer (preferring arkor, then trainer, then default export), runs start() + wait(). |
readCredentials() / writeCredentials() / ensureCredentials() | core/credentials.ts | Read or write ~/.arkor/credentials.json. readCredentials returns null when the file is absent or its content is corrupt (invalid JSON), so a truncated file is treated like a missing one; it rethrows only when the file is present but unreadable (EACCES / EIO / EISDIR), so a valid-but-temporarily-locked login is never silently discarded. ensureCredentials returns the existing record if present, and when credentials are absent or corrupt it warns and bootstraps a fresh anonymous identity (calls requestAnonymousToken and persists it); it throws when the file is present-but-unreadable or the anonymous-token bootstrap itself fails (network / token-endpoint error). writeCredentials writes atomically (temp file + rename). The file is assumed to be SDK-written. |
requestAnonymousToken(baseUrl, kind?) | core/credentials.ts | Mint a fresh anonymous token directly. The CLI uses this on arkor login --anonymous and on first arkor dev. |
credentialsPath() | core/credentials.ts | Absolute path to ~/.arkor/credentials.json. |
readState(cwd?) / writeState(state, cwd?) / statePath(cwd?) | core/state.ts | Read or write .arkor/state.json (project routing). |
isArkor(value) | core/arkor.ts | Type guard for the manifest. |
CloudApiClient | core/client.ts | Typed client for the cloud API. Exposes listDeployments / createDeployment / createDeploymentKey etc. for managing *.arkor.app inference URLs. See Deployments for the full method list and examples. |
CloudApiError | core/client.ts | Error class thrown by CloudApiClient on non-2xx responses. Carries .status and the structured { error } body verbatim; branch on instanceof CloudApiError && err.status === 409 to handle slug collisions, etc. |
defaultArkorCloudApiUrl(credentials?) | core/credentials.ts | Resolve the cloud API base URL the SDK should target. Priority: ARKOR_CLOUD_API_URL env var → the URL stored on the loaded credentials (anonymous credentials carry it from signup; OAuth credentials carry it since arkor login was updated to persist the auth-time URL) → the production endpoint. Use this when constructing a CloudApiClient from readCredentials() / ensureCredentials() so a script keeps targeting the same staging / self-hosted control plane the user authenticated against. |