--- title: "Workflow, protocol and runtime types" description: "The TypeScript types of Slate's workflows (takes on several cameras, shot setup, preflight), the connection under a Camera, and a host that shares cameras." url: https://darkgrade.com/docs/slate/reference/types-workflow last_updated: 2026-12-04 docs_index: https://darkgrade.com/docs/llms.txt --- # Workflow, protocol and runtime types > The TypeScript types of Slate's workflows (takes on several cameras, shot setup, preflight), the connection under a Camera, and a host that shares cameras. > ## Documentation Index > Fetch the complete documentation index at: https://darkgrade.com/docs/llms.txt > Use this file to discover all available pages before exploring further. The types around `Camera`: the workflows built on it, the connection under it, and the host that shares cameras between callers. This is one of the 5 pages of the [types reference](https://darkgrade.com/docs/slate/reference/types.md), which names every type. A field ending in `?` may be absent: Slate leaves out what a camera does not report, and never guesses it. ```typescript import type { CameraClient, CameraProvider } from '@darkgrade/slate/runtime' ``` | Group | Types | | - | - | | [Workflows](#workflows) | [`BenchmarkCheck`](#benchmarkcheck) [`BenchmarkOptions`](#benchmarkoptions) [`QualificationCamera`](#qualificationcamera) [`QualificationSetting`](#qualificationsetting) [`VideoTakeState`](#videotakestate) [`TakeCamera`](#takecamera) [`TakeCameraState`](#takecamerastate) [`TakeMedia`](#takemedia) [`ShotAnalysis`](#shotanalysis) [`ShotMetrics`](#shotmetrics) [`ShotSetupReport`](#shotsetupreport) [`ShotProperty`](#shotproperty) [`CameraPower`](#camerapower) [`CameraPowerAssessment`](#camerapowerassessment) | | [Protocol and transport](#protocol-and-transport) | [`ObjectInfo`](#objectinfo) [`DeviceDescriptor`](#devicedescriptor) [`TransportInterface`](#transportinterface) [`OperationParams`](#operationparams) [`OperationResponse`](#operationresponse) [`EventParams`](#eventparams) [`TransactionPolicy`](#transactionpolicy) [`PTPProtocolViolation`](#ptpprotocolviolation) [`LoggerConfig`](#loggerconfig) | | [Runtime](#runtime) | [`CameraClient`](#cameraclient) [`CameraProvider`](#cameraprovider) [`OperationReply`](#operationreply) [`OperationFile`](#operationfile) [`OperationInput`](#operationinput) [`SurfaceOperation`](#surfaceoperation) [`OwnershipStore`](#ownershipstore) | ## Workflows The types of the workflows built on [`Camera`](https://darkgrade.com/docs/slate/getting_started/camera.md): [takes on several cameras](https://darkgrade.com/docs/slate/guides/video-takes.md), [shot analysis and setup](https://darkgrade.com/docs/slate/guides/shot-setup.md) and [checks before a shoot](https://darkgrade.com/docs/slate/guides/preflight.md). ### BenchmarkCheck One check of `runBenchmark` and how it went. ```typescript interface BenchmarkCheck { name: string passed: boolean durationMilliseconds: number error?: 'operation-failed' | 'deadline' | 'cancelled' } ``` #### BenchmarkCheck fields **`name`** · `string` Which check. **`passed`** · `boolean` Whether it succeeded. **`durationMilliseconds`** · `number` How long it took. **`error?`** · `'operation-failed' | 'deadline' | 'cancelled'` Why it did not pass: the operation failed, the deadline passed, or the run was cancelled. ### BenchmarkOptions What `runBenchmark` takes. Every field is optional. ```typescript interface BenchmarkOptions { photo?: boolean liveView?: boolean purpose?: 'benchmark' | 'first-contact' signal?: AbortSignal timeoutMilliseconds?: number maximumProperties?: number onProgress?: (check: BenchmarkCheck) => void flushEvidence?: () => Promise } ``` #### BenchmarkOptions fields **`photo?`** · `boolean` · default `false` Take one photo and transfer it. **`liveView?`** · `boolean` · default `false` Transfer one live-view frame. **`purpose?`** · `'benchmark' | 'first-contact'` 'first-contact' is the automatic read-only inventory: no capture, live view or storage mode change. **`signal?`** · `AbortSignal` Cancels the run. **`timeoutMilliseconds?`** · `number` · default `180000` The deadline for the whole run, from 1 to 300,000. **`maximumProperties?`** · `number` · default `128` The most property descriptors to read, from 1 to 512. **`onProgress?`** · `(check: BenchmarkCheck) => void` Called with each check as it finishes. See [`BenchmarkCheck`](https://darkgrade.com/docs/slate/reference/types-workflow.md#benchmarkcheck). **`flushEvidence?`** · `() => Promise` Hosts can drain their bounded telemetry queue between inventory phases. ### QualificationCamera The camera `qualifyCameraSetting` drives: one read of its controls and one write of a setting. ```typescript interface QualificationCamera { read: () => Promise<{ controls?: Partial< Record > }> set: ( setting: QualificationSetting, value: Value, ) => Promise } ``` #### QualificationCamera fields **`read`** · `function` Reads the current controls. See [`QualificationSetting`](https://darkgrade.com/docs/slate/reference/types-workflow.md#qualificationsetting). **`set`** · `function` Writes one setting. See [`QualificationSetting`](https://darkgrade.com/docs/slate/reference/types-workflow.md#qualificationsetting). ### QualificationSetting The settings `qualifyCameraSetting` can exercise. ```typescript type QualificationSetting = typeof qualificationSettings[number] ``` #### Every value (4) `shutterSpeed` `aperture` `iso` `whiteBalance` ### VideoTakeState A take on several cameras as `VideoTake` publishes it: its stage and each camera's state. See [Record a take on several cameras](https://darkgrade.com/docs/slate/guides/video-takes.md). ```typescript interface VideoTakeState { id: string name: string stage: 'preparing' | 'armed' | 'recording' | 'stopping' | 'review' | 'collecting' | 'complete' | 'attention' createdAt: string maximumMinutes: number error?: string stopRequested?: boolean startedAt?: string stoppedAt?: string startSkewMilliseconds?: number cameras: TakeCameraState[] } ``` #### VideoTakeState fields **`id`** · `string` The id given to the constructor. **`name`** · `string` The take's name, at most 100 characters; `Untitled take` when none was given. **`stage`** · `union` Where the take is. `attention` and `review` wait for a person. **`createdAt`** · `string` When the take was made, as an ISO 8601 time. **`maximumMinutes`** · `number` The safety stop, from 1 to 120 minutes. **`error?`** · `string` What went wrong with the take as a whole. **`stopRequested?`** · `boolean` True once a stop was asked for. **`startedAt?`** · `string` When recording started, as an ISO 8601 time. **`stoppedAt?`** · `string` When recording stopped, as an ISO 8601 time. **`startSkewMilliseconds?`** · `number` The time between the first camera's start and the last one's. **`cameras`** · `TakeCameraState[]` Each camera's part of the take. See [`TakeCameraState`](https://darkgrade.com/docs/slate/reference/types-workflow.md#takecamerastate). ### TakeCamera What `VideoTake` needs from each camera: the five steps of a take, which you implement over a [`Camera`](https://darkgrade.com/docs/slate/getting_started/camera.md). ```typescript interface TakeCamera { prepare: () => Promise start: () => Promise<{ recordingConfirmed:boolean evidence:string }> stop: () => Promise<{ stopped:boolean media:TakeMedia[] warning?:string }> collect: ( media:TakeMedia[], progress:(bytes:number,total:number)=>void, ) => Promise close: () => Promise } ``` #### TakeCamera fields **`prepare`** · `() => Promise` Gets the camera ready to record. **`start`** · `() => Promise<{recordingConfirmed:boolean;evidence:string}>` Starts recording, and says whether the camera confirmed it and on what evidence. **`stop`** · `function` Stops recording and lists the new clips. See [`TakeMedia`](https://darkgrade.com/docs/slate/reference/types-workflow.md#takemedia). **`collect`** · `function` Copies the clips off the camera, reporting progress, and returns them. See [`TakeMedia`](https://darkgrade.com/docs/slate/reference/types-workflow.md#takemedia). **`close`** · `() => Promise` Releases the camera. ### TakeCameraState One camera's part in a take: its state, when it started and stopped, and its clips. stopRequestedAt precedes the first adapter stop attempt; stoppedAt includes card finalization/media discovery. ```typescript interface TakeCameraState { camera: string state: 'preparing' | 'ready' | 'recording' | 'stopping' | 'stopped' | 'collected' | 'error' | 'uncertain' recordingConfirmed?: boolean startedAt?: string stopRequestedAt?: string stoppedAt?: string evidence?: string error?: string warning?: string media: TakeMedia[] transferredBytes?: number totalBytes?: number transferRecovery?: string } ``` #### TakeCameraState fields **`camera`** · `string` The camera's key in the map given to `VideoTake`. **`state`** · `union` Where this camera is in the take. `uncertain`: its start was sent and not confirmed. **`recordingConfirmed?`** · `boolean` Whether the camera confirmed that it was recording. **`startedAt?`** · `string` When its start returned, as an ISO 8601 time. **`stopRequestedAt?`** · `string` When its first stop attempt began, as an ISO 8601 time. **`stoppedAt?`** · `string` When it had stopped and its clips were found, as an ISO 8601 time. **`evidence?`** · `string` What the start was confirmed by, in words. **`error?`** · `string` What went wrong on this camera. **`warning?`** · `string` Something to check that did not fail the take. **`media`** · `TakeMedia[]` Its clips. See [`TakeMedia`](https://darkgrade.com/docs/slate/reference/types-workflow.md#takemedia). **`transferredBytes?`** · `number` Bytes copied so far while collecting. **`totalBytes?`** · `number` Bytes to copy in all. **`transferRecovery?`** · `string` Set while an interrupted transfer is being retried. ### TakeMedia One clip of a take. ```typescript interface TakeMedia { id: string filename: string bytes: number downloadUrl?: string verified: boolean } ``` #### TakeMedia fields **`id`** · `string` The clip's id on its camera. **`filename`** · `string` Its file name. **`bytes`** · `number` Its size in bytes. **`downloadUrl?`** · `string` Where the collected copy is, once it is collected. **`verified`** · `boolean` Whether the collected copy was verified. ### ShotAnalysis What `analyseShot` measured in a picture, and how it reads the exposure, focus and colour. See [Analyse and set up a shot](https://darkgrade.com/docs/slate/guides/shot-setup.md). ```typescript interface ShotAnalysis { metrics: ShotMetrics effectiveIso?: number exposure: 'balanced' | 'bright' | 'dark' focus: 'detail-visible' | 'soft' colour: 'neutral' | 'cast' | 'unknown' method: string durationMilliseconds: number scene?: { subject: string focus: boolean colour: boolean confidence: number } } ``` #### ShotAnalysis fields **`metrics`** · `ShotMetrics` The measurements the three readings below are made from. See [`ShotMetrics`](https://darkgrade.com/docs/slate/reference/types-workflow.md#shotmetrics). **`effectiveIso?`** · `number` The ISO in the picture's EXIF, when it has one. **`exposure`** · `'balanced' | 'bright' | 'dark'` How the exposure reads: clipped or very bright, dark, or in between. **`focus`** · `'detail-visible' | 'soft'` Whether edge detail is visible. Edge contrast describes the picture; it cannot prove the subject is in focus. **`colour`** · `'neutral' | 'cast' | 'unknown'` Whether near-grey pixels are neutral or carry a cast; `unknown` when the picture has too few of them. **`method`** · `string` How the picture was analysed, in words. **`durationMilliseconds`** · `number` How long the analysis took. **`scene?`** · `object` A local vision model's review of the subject, present only when one was already running. ### ShotMetrics The numbers `measureShot` takes from the middle of a picture, leaving a 15% border out. ```typescript interface ShotMetrics { median: number p95: number clipped: number dark: number detail: number neutralPixels: number redBlueRatio: number } ``` #### ShotMetrics fields **`median`** · `number` Median brightness (luma), 0 to 1. **`p95`** · `number` 95th-percentile brightness, 0 to 1. **`clipped`** · `number` The share of pixels clipped to white, 0 to 1. **`dark`** · `number` The share of pixels darker than 0.08, 0 to 1. **`detail`** · `number` Edge detail: the mean squared Laplacian of brightness. **`neutralPixels`** · `number` The share of pixels that are near grey, 0 to 1. **`redBlueRatio`** · `number` Red over blue across the near-grey pixels; about 1 is neutral. ### ShotSetupReport What `optimiseShot` changed, and whether the result was verified. ```typescript interface ShotSetupReport { status: 'verified' | 'attention' | 'unavailable' summary: string durationMilliseconds: number changes: { setting: string before: string after: string verified: boolean reverted?: boolean attempted?: string }[] analysis?: ShotAnalysis before?: ShotAnalysis error?: string budgetExceeded?: boolean imageVerified?: boolean focusVerified?: boolean exposureVerified?: boolean } ``` #### ShotSetupReport fields **`status`** · `'verified' | 'attention' | 'unavailable'` `verified`: the exposure measured in range and every change read back. `attention`: something still needs a person. `optimiseShot` returns only these two. **`summary`** · `string` The result in a sentence. **`durationMilliseconds`** · `number` How long the setup took. **`changes`** · `object` Each setting written: its value before and after, and whether it read back. **`analysis?`** · `ShotAnalysis` The picture after the changes. See [`ShotAnalysis`](https://darkgrade.com/docs/slate/reference/types-workflow.md#shotanalysis). **`before?`** · `ShotAnalysis` The picture before any change. See [`ShotAnalysis`](https://darkgrade.com/docs/slate/reference/types-workflow.md#shotanalysis). **`error?`** · `string` What stopped the setup, when something did. **`budgetExceeded?`** · `boolean` True when the time budget ran out. **`imageVerified?`** · `boolean` Whether `analysis` is of a picture taken after the last change. **`focusVerified?`** · `boolean` Whether focus on the subject was confirmed, by the camera or by the scene review. **`exposureVerified?`** · `boolean` Whether the exposure measured in range with fixed ISO and shutter speed, each change read back. ### ShotProperty A setting as `optimiseShot` reads it: the fields of a [`CameraControlState`](https://darkgrade.com/docs/slate/reference/types-capabilities.md#cameracontrolstate) it needs. ```typescript interface ShotProperty { value?: string allowedValues?: string[] writable?: boolean enabled?: boolean } ``` #### ShotProperty fields **`value?`** · `string` The current value. **`allowedValues?`** · `string[]` The values the camera offers now. **`writable?`** · `boolean` Whether the camera accepts a write now. **`enabled?`** · `boolean` Whether the setting applies in the camera's current mode. ### CameraPower A camera's battery and power reading, as `readCameraPower` returns it. Camera telemetry only. A configured outlet or USB cable is not power-source evidence. ```typescript interface CameraPower { observedAt: string lastRefreshError?: string source: string percent?: number level?: 'empty' | 'low' | 'medium' | 'high' | 'full' powerSource: 'battery' | 'dc' | 'usb' | 'poe' | 'unknown' remainingMinutes?: number charging?: boolean batteryPresent?: boolean raw: Record } ``` #### CameraPower fields **`observedAt`** · `string` When the camera was read, as an ISO 8601 time. **`lastRefreshError?`** · `string` Why the latest read failed, when it did. **`source`** · `string` Which reading it came from, such as `ptp-battery-level`, `canon-eos-ptp` or `sony-sdk`. **`percent?`** · `number` 0–100, when the camera reports a percentage. **`level?`** · `'empty' | 'low' | 'medium' | 'high' | 'full'` The camera's coarse level, when it reports one. **`powerSource`** · `'battery' | 'dc' | 'usb' | 'poe' | 'unknown'` What powers the camera; `unknown` unless the camera says. **`remainingMinutes?`** · `number` The camera's own estimate of the minutes left. **`charging?`** · `boolean` True only when explicitly reported; external power does not imply charging. **`batteryPresent?`** · `boolean` Whether a battery is in the camera, when it says. **`raw`** · `Record` The raw property values the reading was made from. ### CameraPowerAssessment What `assessCameraPower` concludes for a planned recording. See [Checks before a shoot](https://darkgrade.com/docs/slate/guides/preflight.md). ```typescript interface CameraPowerAssessment { status: 'pass' | 'warn' | 'fail' summary: string runtimeVerified: boolean reserveMinutes: number } ``` #### CameraPowerAssessment fields **`status`** · `'pass' | 'warn' | 'fail'` `pass`, `warn` or `fail` for the planned recording. **`summary`** · `string` The verdict in a sentence. **`runtimeVerified`** · `boolean` True only when the camera's own estimate covers the planned minutes and the reserve. **`reserveMinutes`** · `number` The reserve that was asked for. ## Protocol and transport The connection under a [`Camera`](https://darkgrade.com/docs/slate/getting_started/camera.md): [timeouts and logging](https://darkgrade.com/docs/slate/guides/timeouts-and-logging.md) and [raw protocol access](https://darkgrade.com/docs/slate/guides/protocol.md). ### ObjectInfo A file's PTP [ObjectInfo dataset](https://darkgrade.com/docs/slate/ptp-reference/datasets/object-info-dataset.md), as the camera sent it. [`takePhoto`](https://darkgrade.com/docs/slate/getting_started/camera.md#takephoto) returns it with `includeInfo`. ```typescript interface ObjectInfo { storageID: number objectFormat: number objectFormatDecoded: string protectionStatus: number objectCompressedSize: number thumbFormat: number thumbFormatDecoded: string thumbCompressedSize: number thumbPixWidth: number thumbPixHeight: number imagePixWidth: number imagePixHeight: number imageBitDepth: number parentObject: number associationType: number associationDesc: number sequenceNumber: number filename: string captureDate: string modificationDate: string keywords: string } ``` #### ObjectInfo fields **`storageID`** · `number` The StorageID of the card the object is on. **`objectFormat`** · `number` The object's format code. **`objectFormatDecoded`** · `string` The name of that format, or `Unknown_0x…` when Slate has none. **`protectionStatus`** · `number` `0` for no protection, `1` for read-only. **`objectCompressedSize`** · `number` The size in bytes; `0xffffffff` when the object is 4 GiB or larger. **`thumbFormat`** · `number` The thumbnail's format code. **`thumbFormatDecoded`** · `string` The name of that format. **`thumbCompressedSize`** · `number` The thumbnail's size in bytes. **`thumbPixWidth`** · `number` The thumbnail's width in pixels. **`thumbPixHeight`** · `number` The thumbnail's height in pixels. **`imagePixWidth`** · `number` The picture's width in pixels. **`imagePixHeight`** · `number` The picture's height in pixels. **`imageBitDepth`** · `number` The picture's bit depth. **`parentObject`** · `number` The ObjectHandle of the folder it is in; `0` at the top of the card. **`associationType`** · `number` For a folder, the kind of association; `0` for a file. **`associationDesc`** · `number` More about the association, when the type defines it. **`sequenceNumber`** · `number` Its place in a sequence, when it is part of one. **`filename`** · `string` The file name on the card. **`captureDate`** · `string` When it was captured, as a PTP date-time string in the camera's local time. **`modificationDate`** · `string` When it was last changed, in the same form. **`keywords`** · `string` Keywords, when the camera sets any. ### DeviceDescriptor Which device to open: a USB filter, or a host on the network. See [Choose a camera](https://darkgrade.com/docs/slate/guides/multiple-cameras.md). ```typescript interface DeviceDescriptor { usb?: { filters: Array<{ vendorId?: number productId?: number classCode?: number subclassCode?: number protocolCode?: number serialNumber?: string }> exclusionFilters?: Array<{ vendorId?: number productId?: number classCode?: number subclassCode?: number protocolCode?: number serialNumber?: string }> } ip?: { host: string port?: number protocol?: 'ptp/ip' | 'upnp' localAddress?: string } } ``` #### DeviceDescriptor fields **`usb?`** · `object` Which USB device to open: one matching any of `filters` and none of `exclusionFilters`. **`ip?`** · `object` A camera on the network, for a PTP/IP transport. ### TransportInterface What a transport implements to carry PTP for a [`Camera`](https://darkgrade.com/docs/slate/getting_started/camera.md). USB is built in; `IPTransport` is [PTP/IP](https://darkgrade.com/docs/slate/getting_started/ptp-ip.md). ```typescript interface TransportInterface { connect: (device?: DeviceDescriptor) => Promise disconnect: () => Promise send: ( data: Uint8Array, sessionId: number, transactionId: number, ) => Promise receive: ( maxLength: number, sessionId: number, transactionId: number, ) => Promise isConnected: () => boolean classRequestReset: () => Promise resetPort?: () => Promise getType: () => TransportType connectionKind?: () => 'usb' | 'wifi' | 'ip' isLittleEndian: () => boolean on?: (handler: (event: PTPEvent) => void) => void off?: (handler: (event: PTPEvent) => void) => void } ``` #### TransportInterface fields **`connect`** · `(device?: DeviceDescriptor) => Promise` Opens the device. See [`DeviceDescriptor`](https://darkgrade.com/docs/slate/reference/types-workflow.md#devicedescriptor). **`disconnect`** · `() => Promise` Closes it. **`send`** · `function` Sends one container. **`receive`** · `function` Reads one container of up to `maxLength` bytes. **`isConnected`** · `() => boolean` Whether the device is open. **`classRequestReset`** · `() => Promise` The still-image class's Device Reset Request. **`resetPort?`** · `() => Promise` Resets the device's USB port and releases it, as if it were unplugged and replugged. Clears a pipe a crashed host left mid-transfer, which a Device Reset Request does not. The transport must be connected again afterwards. **`getType`** · `() => TransportType` Which kind of transport this is. **`connectionKind?`** · `() => 'usb' | 'wifi' | 'ip'` The connection as [`Camera.getInfo()`](https://darkgrade.com/docs/slate/getting_started/camera.md#getinfo) reports it, for a transport that is not what getType() implies (Sony's authenticated SDK channel runs over Wi-Fi IP but is not PTP/IP). Without it: USB or PTP/IP. **`isLittleEndian`** · `() => boolean` Get endianness for this transport PTP datasets and both USB and PTP/IP packet fields use little-endian encoding. **`on?`** · `(handler: (event: PTPEvent) => void) => void` Calls `handler` with each PTP event the device sends. **`off?`** · `(handler: (event: PTPEvent) => void) => void` Stops `handler`. ### OperationParams The parameters of a raw operation, by name, as `protocolSession(camera).send` takes them. See [Raw protocol access](https://darkgrade.com/docs/slate/guides/protocol.md). ```typescript type OperationParams< Op extends { operationParameters: readonly unknown[] }, > = Op['operationParameters'] extends readonly [] ? Record : BuildParamObject ``` ### OperationResponse What a raw operation resolves to: the response code and parameters, with `data` when the operation returns any. ```typescript type OperationResponse = Op extends { dataCodec: infer C } ? { code: number; parameters?: number[]; data: CodecType } : Op extends { dataDirection: 'out' } ? { code: number; parameters?: number[]; data: Uint8Array } : { code: number; parameters?: number[] } ``` ### EventParams The parameters of a raw event, by name. ```typescript type EventParams = E['parameters'] extends readonly [] ? Record : BuildEventParamObject ``` ### TransactionPolicy How long and how often Slate waits for a camera before giving up on a transaction. ```typescript interface TransactionPolicy { timeoutMilliseconds: number minimumThroughputBytesPerSecond: number deviceBusyRetries: number deviceBusyBackoffMilliseconds: number deviceBusyBudgetMilliseconds: number automaticUSBReset: boolean recoverTransport?: (failure: PTPErrorContext) => Promise } ``` #### TransactionPolicy fields **`timeoutMilliseconds`** · `number` · default `30000` Base time a single send or receive phase may take. **`minimumThroughputBytesPerSecond`** · `number` · default `2097152` Large data phases get extra time at this rate on top of the base timeout. **`deviceBusyRetries`** · `number` · default `6` Standard (0x1xxx) operations answered DeviceBusy are retried at most this many times. **`deviceBusyBackoffMilliseconds`** · `number` · default `50` First retry delay; each further retry doubles it. **`deviceBusyBudgetMilliseconds`** · `number` · default `2000` Retries stop once this much time has passed since the first attempt; the last delay is shortened to fit. **`automaticUSBReset`** · `boolean` · default `true` After a timeout or framing violation on a USB transport, automatically send the still-image class Device Reset Request, wait for the abandoned I/O to settle and reopen the session before the next command. On by default. If the automatic reset fails, later commands fail with PTPRecoveryRequiredError until a disconnect/connect. Transports without a class reset (PTP/IP) always latch instead. **`recoverTransport?`** · `(failure: PTPErrorContext) => Promise` Caller-owned recovery that replaces the automatic USB reset, for example to honor recording/lease guards. It must settle outstanding transport I/O before resolving and must not call this camera's queued methods. Failed or pending recovery blocks further commands; use an explicit disconnect/connect to establish a new transport instead. ### PTPProtocolViolation How a reply broke PTP container framing, on [`PTPProtocolError.violation`](https://darkgrade.com/docs/slate/reference/errors.md#ptpprotocolerror). ```typescript type PTPProtocolViolation = | 'short-container' | 'truncated-container' | 'unexpected-container-type' | 'transaction-mismatch' | 'operation-mismatch' ``` ### LoggerConfig What the `logger` option of `new Camera()` takes. See [Timeouts and logging](https://darkgrade.com/docs/slate/guides/timeouts-and-logging.md). ```typescript type LoggerConfig = { expanded?: boolean captureConsole?: boolean renderInTerminal?: boolean maxTransactions?: number } ``` #### LoggerConfig fields **`expanded?`** · `boolean` · default `true` Shows each entry's detail in the terminal view; `false` shows one line per entry. **`captureConsole?`** · `boolean` · default `false` Routes `console.log`, `console.info`, `console.warn` and `console.error` into the logger's view. Node only. **`renderInTerminal?`** · `boolean` · default `false` Draws a live view of every transaction in the terminal. Node only. **`maxTransactions?`** · `number` · default `1000` Transactions kept in memory; older ones are dropped, with any data they carried. ## Runtime What a host that shares cameras is written against. These are imported from `@darkgrade/slate/runtime`, not the main entry. [Host cameras for other processes](https://darkgrade.com/docs/slate/guides/runtime.md) shows them at work. ### CameraClient What MCP and other remote frontends call: the public operations, by their library name. ```typescript interface CameraClient { discover: () => Promise operation: ( camera: string, name: string, input?: OperationInput, ) => Promise benchmark?: (camera: string) => Promise } ``` #### CameraClient fields **`discover`** · `() => Promise` [`Camera.discover()`](https://darkgrade.com/docs/slate/getting_started/camera.md#cameradiscover): the attached cameras, without opening one. See [`DiscoveredCamera`](https://darkgrade.com/docs/slate/reference/types-results.md#discoveredcamera). **`operation`** · `function` Runs one public Camera operation on the host's camera with this identity. See [`OperationInput`](https://darkgrade.com/docs/slate/reference/types-workflow.md#operationinput), [`OperationReply`](https://darkgrade.com/docs/slate/reference/types-workflow.md#operationreply). **`benchmark?`** · `(camera: string) => Promise` The deep benchmark workflow, `runBenchmark`, where the host offers it. ### CameraProvider Platform hosts supply the connected Camera and physical services, never a second MCP-owned session. The runtime runs every operation through Camera itself, so hosts keep no vendor tables. ```typescript interface CameraProvider { discover: () => Promise camera: (camera: string) => Camera | Promise assertAllowed: ( camera: string, operation: string, ) => void | Promise saveFile?: ( camera: string, file: OperationFile, ) => Promise benchmark?: (camera: string) => Promise } ``` #### CameraProvider fields **`discover`** · `() => Promise` See [`DiscoveredCamera`](https://darkgrade.com/docs/slate/reference/types-results.md#discoveredcamera). **`camera`** · `(camera: string) => Camera | Promise` The Camera the host holds for this identity, already connected or ready for [`connect`](https://darkgrade.com/docs/slate/getting_started/camera.md#connect). See [`Camera`](https://darkgrade.com/docs/slate/getting_started/camera.md). **`assertAllowed`** · `(camera: string, operation: string) => void | Promise` Throws (for example HardwareBusyError) when this operation may not run now. **`saveFile?`** · `(camera: string, file: OperationFile) => Promise` Keeps a returned file where the client can read it; the path is returned in the reply. See [`OperationFile`](https://darkgrade.com/docs/slate/reference/types-workflow.md#operationfile). **`benchmark?`** · `(camera: string) => Promise` ### OperationReply An operation's result as it crosses a process: JSON, with any bytes the host saved by path. ```typescript interface OperationReply { result: unknown files: { role: OperationFile['role'] name: string mimeType: string bytes: number path?: string }[] images?: { mimeType: string; base64: string }[] } ``` #### OperationReply fields **`result`** · `unknown` **`files`** · `object` The files the operation returned, without their bytes; `path` where the host saved one. See [`OperationFile`](https://darkgrade.com/docs/slate/reference/types-workflow.md#operationfile). **`images?`** · `{ mimeType: string; base64: string }[]` Image files inline (live-view frames and previews), for clients that show pictures. ### OperationFile A file an operation returned: a live-view frame, a preview, a photo's or a download's bytes. ```typescript interface OperationFile { role: 'photo' | 'frame' | 'overlay' | 'preview' | 'download' name: string mimeType: string data: Uint8Array } ``` #### OperationFile fields **`role`** · `'photo' | 'frame' | 'overlay' | 'preview' | 'download'` **`name`** · `string` A name to save it under. **`mimeType`** · `string` **`data`** · `Uint8Array` ### OperationInput One call's inputs by parameter name, as an MCP client or the command line gave them. ```typescript type OperationInput = Readonly> ``` ### SurfaceOperation One public [`Camera`](https://darkgrade.com/docs/slate/getting_started/camera.md) operation with its MCP tool and CLI command names, as `surfaceOperations()` lists it. ```typescript interface SurfaceOperation extends CameraOperationDescription { mcpTool: string cliCommand: string immediate: boolean readOnly: boolean name: string static?: boolean summary: string parameters: readonly OperationParameter[] } ``` #### SurfaceOperation fields **`mcpTool`** · `string` `camera_take_photo`. **`cliCommand`** · `string` `darkgrade camera take-photo` (`darkgrade cameras` for discover). **`immediate`** · `boolean` Stopping never waits behind other camera work, so these run as soon as they are asked for. **`readOnly`** · `boolean` Reads without changing the camera. **`name`** · `string` The library's method name ([`takePhoto`](https://darkgrade.com/docs/slate/getting_started/camera.md#takephoto)); [`discover`](https://darkgrade.com/docs/slate/getting_started/camera.md#cameradiscover) is the static `Camera.discover`. **`static?`** · `boolean` **`summary`** · `string` The first sentence of the method's doc comment. **`parameters`** · `readonly OperationParameter[]` ### OwnershipStore The store a `HardwareCoordinator` keeps its leases in, shared by every process that might open the same camera. You implement it. ```typescript interface OwnershipStore { claimHardwareResource: ( resource: string, owner: string, purpose: string, lifetimeMilliseconds: number, ) => boolean heartbeatHardwareOwner: ( owner: string, lifetimeMilliseconds: number, ) => unknown releaseHardwareOwner: (owner: string) => unknown hardwareOwners: () => unknown[] } ``` #### OwnershipStore fields **`claimHardwareResource`** · `function` **`heartbeatHardwareOwner`** · `(owner: string, lifetimeMilliseconds: number) => unknown` **`releaseHardwareOwner`** · `(owner: string) => unknown` **`hardwareOwners`** · `() => unknown[]` ## Other types > [card] [Option types](https://darkgrade.com/docs/slate/reference/types-options.md) > > The types you pass to `Camera`: its constructor options, and the options and choices of its methods. > [card] [Result types](https://darkgrade.com/docs/slate/reference/types-results.md) > > The types `Camera` hands back: what each method resolves to, what an event carries, and what `recover()` reports. > [card] [Capability types](https://darkgrade.com/docs/slate/reference/types-capabilities.md) > > The types that say what the connected camera is and can do now: what `getCapabilities()` returns, what `setControl` takes, and which model was identified. > [card] [Setting value types](https://darkgrade.com/docs/slate/reference/types-setting-values.md) > > One type per setting: the values its getter returns and its setter takes, with the types the typed getters and setters are declared with. ## Related > [card] [Camera](https://darkgrade.com/docs/slate/getting_started/camera.md) > > The class: constructor, every method, what each returns and throws. > [card] [Settings](https://darkgrade.com/docs/slate/reference/settings.md) > > Every setting id with its values, getter, setter and vendor properties. > [card] [Types](https://darkgrade.com/docs/slate/reference/types.md) > > Every exported type, field by field. > [card] [Errors](https://darkgrade.com/docs/slate/reference/errors.md) > > Every error class: when it is thrown and what to do. > [card] [Entry points](https://darkgrade.com/docs/slate/reference/entry-points.md) > > Every import path of the package and what it exports.