Slate is one package with several import paths. Most code needs only the first: Camera and its types. The others are for a browser page that draws controls, a host that shares one camera between callers, an MCP server, raw protocol work, and the darkgrade command inside another executable.
import { Camera } from '@darkgrade/slate'| Import path | For |
|---|---|
@darkgrade/slate | The camera API: Camera, its option and result types, its errors, and the workflows built on it (a multi-camera video take, shot analysis, power assessment). |
@darkgrade/slate/cli | The darkgrade command as a function, for an executable that embeds it. |
@darkgrade/slate/controls | The setting vocabulary and value conversions without any driver or USB code, for a browser page that draws controls. |
@darkgrade/slate/protocol | Raw PTP access, the vendor drivers, the registries of operations, properties and events, PTP/IP and wireless pairing. |
@darkgrade/slate/runtime | What a host embeds to share one camera between several callers: CameraRuntime with its per-camera queue, the operation list the MCP tools and the CLI are generated from, and cross-process ownership (HardwareCoordinator). |
@darkgrade/slate/runtime/browser | The runtime without any Node import: everything in ./runtime except cross-process ownership. |
@darkgrade/slate/runtime/mcp | The MCP server: one camera_ tool per public Camera operation, generated from the same list. |
@darkgrade/slate/runtime/ownership | Cross-process camera ownership with leases and heartbeats, for a host with more than one process. |
@darkgrade/slate/telemetry | Diagnostics sharing for an application that embeds Slate: one shared queue per process. |
@darkgrade/slate/telemetry/batch | The batch a client uploads, and its validation. |
@darkgrade/slate/telemetry/installation-store | A file store for the installation state. |
@darkgrade/slate/telemetry/protocol | The protocol evidence a diagnostic entry can carry, and its validation. |
@darkgrade/slate/telemetry/schema | The diagnostic entry schema, its limits and its validation. |
@darkgrade/slate/telemetry/settings | Where Node keeps the sharing preference and saved diagnostics, and the shared Node queue. |
@darkgrade/slate/telemetry/server | The collector. |
@darkgrade/slate/telemetry/postgres | The collector's Postgres database. |
Slate needs Node 22.18 or later. @modelcontextprotocol/server, zod and pg are optional peer dependencies, needed only by the entry points that name them below.
@darkgrade/slate
The camera API: Camera, its option and result types, its errors, and the workflows built on it (a multi-camera video take, shot analysis, power assessment).
import { Camera } from '@darkgrade/slate'Guide: Quickstart
Classes (14)
Classes (14)
| Export | What it is |
|---|---|
Camera | One camera, the same on every body that supports an operation. |
CameraClipNotFoundError | The camera confirmed it stopped recording, but no new finished clip appeared on the card in time. |
CameraConfirmationError | An acknowledged request whose fresh camera observation did not confirm the requested state. |
CameraOutcomeUnknownError | The command was sent but its result could not be confirmed. |
CameraRefusedError | The camera said no, or the value is not one it offers now. |
CameraUnsupportedError | This camera cannot do it right now; getCapabilities() says why. |
PTPDecodeError | A dataset arrived intact at the container level but could not be decoded. |
PTPDisconnectedError | The transport is gone (cable pulled, camera powered off, socket closed). |
PTPError | The base class of every protocol failure. |
PTPProtocolError | The camera answered with bytes that break ISO 15740 container framing for this transaction. |
PTPRecoveryRequiredError | The pipe may still contain an abandoned transaction and the automatic USB reset failed, or the transport has none (PTP/IP). |
PTPResponseError | The camera answered a transaction with a response code the caller cannot continue from. |
PTPTimeoutError | A transport phase did not complete in time. |
VideoTake | Device-independent take lifecycle shared by applications and MCP. |
Functions (25)
Functions (25)
| Export | What it is |
|---|---|
analyseShot() | Measures a picture's exposure, focus detail and colour, optionally with a vision-model review of the subject, as a ShotAnalysis. |
assessCameraPower() | Whether the battery lasts a planned recording with a reserve (5 minutes unless given), from the camera's own runtime estimate, never from the percentage. |
cameraControlContract() | Each qualification setting from one read of the controls: whether it is present and writable, its value and its choices. |
chooseIso() | The ISO among the values the camera offers that best corrects the analysed exposure; undefined when none applies or it is already set. |
chooseShutterSpeed() | Choose the closest advertised shutter to a 180-degree shutter angle. |
configureSlateTelemetry() | Sets the diagnostics client Slate reports to, or clears it with undefined. A browser application supplies its own persistent store this way. |
describeShot() | Reads ShotMetrics as words: exposure balanced, bright or dark; focus detail-visible or soft; colour neutral, cast or unknown. |
exifIso() | Read standard EXIF ISO, so locking Auto ISO preserves the camera's metered exposure. |
exposureSeconds() | An exposure time in seconds. An angle needs context.framesPerSecond; a named value such as Bulb gives undefined. |
identifyCamera() | Resolves USB identity without opening a device or starting any service. |
isValidatedModel() | Whether a model name is in validatedCameraModels, ignoring case and extra spaces. |
isVerifiedFeature() | Whether a vendor feature is confirmed on that model in verifiedFeatureModels. |
matchExposureTime() | Match an actual advertised value; do not round to a nearby camera setting. |
measureShot() | Measures RGB pixels (three bytes each, width by height) into ShotMetrics. |
normalizeCameraPower() | Normalize documented units; preserve unsupported/sentinel values as raw evidence. |
observeCameraEvents() | Counts the events a protocol session delivers during an operation, by code and name. |
optimiseShot() | Sets a shot up from a picture within a time budget: chooses among the values the camera offers, applies them through your callback and reports each change as a ShotSetupReport. |
parseExposureTime() | Reads text such as 1/250, 0.5", 180° or bulb, or an ExposureTime object, into an ExposureTime. Throws on input it cannot read. |
qualifyCameraSetting() | Writes one setting to a value the camera offers, reads it back and restores the original, also after a failed or ambiguous write. The caller owns the camera throughout. |
readCameraPower() | Reuse an owned camera session for battery telemetry over USB or Sony SDK Wi-Fi. |
readStandardCameraPower() | Read one standard battery descriptor on an already-owned PTP session. |
recordFirstContact() | Bodies outside the validated list get one bounded, read-only inventory (identity, every advertised property descriptor, storage IDs) recorded as a first-contact profile. |
resolveCameraControl() | The setting id for a name or alias, ignoring case, spaces, hyphens and underscores; undefined when none matches. |
runBenchmark() | Reads a connected, idle camera's full advertised inventory and a bounded number of numeric property descriptors, and reports each check. |
subjectFocusVerified() | Whether focus on the subject is verified: the camera confirmed focus, or a confident scene review saw the subject sharp. Edge contrast alone never counts. |
Constants (6)
Constants (6)
| Export | What it is |
|---|---|
cameraControlDefinitions | Canonical application vocabulary: ids, labels and search aliases (a vendor's own word is only an alias). |
DEFAULT_TRANSACTION_POLICY | The TransactionPolicy a camera uses unless told otherwise: 30 s per phase, up to 6 DeviceBusy retries within 2 s. |
defaultLoggerConfig | Inert by default: a logger takes over the console or draws in the terminal only when asked. |
qualificationSettings | Portable, deliberately small control contracts. |
validatedCameraModels | The single source of truth for which bodies Darkgrade has run on its physical test benches, keyed by the exact DeviceInfo model string. |
verifiedFeatureModels | Vendor features physically confirmed on specific bodies; anywhere else they are attempted, unverified. |
Types (105)
Types (105)
| Export | What it is |
|---|---|
Aperture | An aperture in Slate's one spelling: f/ and the f-number without trailing zeros (f/4, f/2.8). |
AspectRatio | The shape of the photo, or a crop of the sensor. |
AudioRecording | Movie sound, Canon only for now: On, Off or On (manual level). |
Battery | What the camera reports about its power now. |
BenchmarkCheck | One check of runBenchmark and how it went. |
BenchmarkOptions | What runBenchmark takes. |
CameraCapabilities | What getCapabilities resolves to: every setting, the lens, and which operations work now. |
CameraControlId | A setting id, such as iso or shutterSpeed. |
CameraControlInputs | What setControl accepts as a value, by setting id: an ExposureTimeInput for shutterSpeed, a number for colorTemperature and audioLevel, and a string for every other setting. |
CameraControlSession | The same control contract on an already-connected native PTP or vendor SDK session, including one typed getter and setter per typed setting (getShutterSpeed, setShutterSpeed, ...). |
CameraControlState | One setting as the camera reports it now: its value, the values it offers, and whether it can be written. |
CameraEventHandler | A handler for on: called with no arguments each time the event fires. |
CameraEventName | The events on delivers: settingsChanged and mediaAdded. |
CameraIdentification | What identifyCamera makes of a USB vendor and product ID, without opening the device. |
CameraIdentityCandidate | A camera line and model aliases that a cited source associates with one USB vendor/product ID. |
CameraInfo | What the body reports about itself. |
CameraLens | The attached lens as the camera reports it. |
CameraOptions | What new Camera() takes. |
CameraPower | A camera's battery and power reading, as readCameraPower returns it. |
CameraPowerAssessment | What assessCameraPower concludes for a planned recording. |
CameraRecordingState | What getRecordingState resolves to. |
CameraRecoveryOptions | Limits for recover. |
CameraRecoveryReport | What recover did: each software step, whether the camera answered afterwards, and whether only power or hub cycling is left. |
CameraRecoveryStep | One step of a recovery and how it went. |
CardPhoto | A photo confirmed on the card. |
CardStatus | One card slot as the camera reports it now. |
Clip | A finished movie file the camera wrote to its card during one recording. |
ColorTemperature | A colour temperature in kelvin. |
ComputerPhoto | A photo whose bytes reached this computer. |
ConnectOptions | How Camera.connect opens the camera. |
ContinuousAutofocus | Whether the camera keeps focusing before a half-press (Canon Continuous AF): On or Off. |
DetectionSubject | What subject detection looks for: People, Animals, Birds, ... |
DeviceDescriptor | Which device to open: a USB filter, or a host on the network. |
DigitalZoom | How far zoom reaches past the optics: Off is optical only. |
DiscoveredCamera | One attached camera found by Camera.discover(), without opening a session. |
DriveMode | A drive mode in Slate's one spelling ('Single', 'Continuous high', 'Self-timer 10 s', ...). |
EventParams | The parameters of a raw event, by name. |
ExposureCompensation | Exposure compensation in stops with one decimal and a sign: +0.7, -1.0, 0.0. |
ExposureContext | The frame rate that converting between a shutter angle and a duration needs. |
ExposureMode | Who picks the exposure: you (Manual), the camera (Program, Auto), or the two of you (aperture or shutter priority). |
ExposureModeAlias | The short forms setExposureMode also accepts: the mode-dial letters, and Canon's Av, Tv and Fv. |
ExposureTime | A shutter speed as a duration in seconds, an angle in degrees, or a named mode (bulb, time, flash-sync, auto). |
ExposureTimeInput | An ExposureTime, or text that parseExposureTime reads, such as 1/250, 0.5" or 180°. |
EyeSelection | Which eye subject detection focuses on: Auto, Right or Left; Off where a body can turn eye detection off (Canon). |
FlashMode | Whether and how the flash fires. |
FocusArea | Wide, Zone, Spot M, Tracking Spot M, ...; Sony's Flexible Spot is Spot, Lock-on AF is Tracking. |
FocusDirection | Which way nudgeFocus moves focus: near towards the camera, far away from it. |
FocusFrame | A frame the camera draws over its picture: its focus area, a detected face or a tracked subject. |
FocusMode | AF-S, AF-C or MF, and the other modes a body offers (AF-A, DMF, AF-F, ...). |
FocusNudge | What a focus nudge did. |
FocusResult | Whether autofocus confirmed focus: acquired, not-acquired or unknown. |
FocusStepSize | A small, medium or large manual-focus step, like the < << <<< buttons in vendor remote apps. |
FrameRate | A frame rate: 24p, 23.98p, 60p, 50i. |
Iso | An ISO sensitivity: ISO 800, Auto, and the Sony labels that are distinct settings rather than spellings (an extended sensitivity, the Multi Frame NR sensitivities). |
JpegQuality | How much a JPEG is compressed: finer keeps more detail in a bigger file. |
LiveViewFrame | What getLiveViewFrame resolves to: one picture and the frames the camera draws over it. |
LiveViewFrameOptions | What getLiveViewFrame takes. |
LiveViewOverlay | The camera's own on-screen info (menus, dialogs, shooting info), drawn to lay over the picture. |
LiveViewQuality | The live-view picture's quality: High is sharper, Low lighter on the connection. |
LoggerConfig | What the logger option of new Camera() takes. |
MediaDownloadOptions | Progress and cancel for downloadMedia. |
MediaItem | One file on the card, as listMedia lists it. |
MediaPreviewSize | The sizes getMediaPreview returns: thumbnail is the small one, preview a larger one. |
MeteringMode | Which part of the frame the camera measures light from. |
ObjectInfo | A file's PTP ObjectInfo dataset, as the camera sent it. |
OperationAvailability | One operation's availability now: an unsupported one says why, in words a user can act on. |
OperationParams | The parameters of a raw operation, by name, as protocolSession(camera).send takes them. |
OperationResponse | What a raw operation resolves to: the response code and parameters, with data when the operation returns any. |
Photo | What takePhoto resolves to: a CardPhoto for the destination card, a ComputerPhoto for computer and computerOnly. |
PhotoDestination | Where a photo goes: the camera's card; the card and this computer (its bytes come back); or this computer only, never saved to the card (computerOnly). |
PhotoFormat | A photo format, in each vendor codec's own spelling: 'RAW', 'RAW+JPEG', 'JPEG' on current Sony bodies; format and quality together ('RAW+JPEG Fine', 'HEIF Standard') on Sony bodies with one combined setting; Canon's format with its size ('RAW', 'cRAW+L', 'M'). |
PhotoSize | A photo size: Sony's codec names ('Large', 'Medium', 'Small'), or the pixel dimensions a standard body lists. |
PhotoVideoMode | Whether the camera is set up to take photos or record video. |
PictureProfile | A Sony Picture Profile ('Off', 'PP1' to 'PP11', 'PP LUT 1' to 'PP LUT 4'). |
PictureStyle | A look in Slate's one spelling: Canon Picture Style, Nikon Picture Control and Sony Creative Look or Creative Style ('Standard', 'Portrait', 'Monochrome', ...). |
PTPProtocolViolation | How a reply broke PTP container framing, on PTPProtocolError.violation. |
QualificationCamera | The camera qualifyCameraSetting drives: one read of its controls and one write of a setting. |
QualificationSetting | The settings qualifyCameraSetting can exercise. |
RawCompression | A NEF compression the body names; a raw number it reports without a name is not a value to write. |
RecoveryReport | What Camera.recover() did: each software step, whether the camera answered GetDeviceInfo afterwards, and whether only power or hub cycling is left. |
SettingInput | What the typed setter of a setting accepts. |
SettingValue | What the typed getter of a setting returns, and its setter resolves to. |
ShotAnalysis | What analyseShot measured in a picture, and how it reads the exposure, focus and colour. |
ShotMetrics | The numbers measureShot takes from the middle of a picture, leaving a 15% border out. |
ShotProperty | A setting as optimiseShot reads it: the fields of a CameraControlState it needs. |
ShotSetupReport | What optimiseShot changed, and whether the result was verified. |
ShutterSpeed | A shutter speed in Slate's one spelling, whatever the vendor calls it: '1/250', '30"', '0.3"', '180°', 'Bulb'. |
SubjectDetection | Whether the camera looks for faces, eyes and other subjects to focus on. |
TakeCamera | What VideoTake needs from each camera: the five steps of a take, which you implement over a Camera. |
TakeCameraState | One camera's part in a take: its state, when it started and stopped, and its clips. |
TakeMedia | One clip of a take. |
TakePhotoOptions | What takePhoto takes. |
TransactionPolicy | How long and how often Slate waits for a camera before giving up on a transaction. |
TransportInterface | What a transport implements to carry PTP for a Camera. |
TypedSettingId | The settings with a typed getter and setter. |
TypedSettingMethods | One getter and one setter per typed setting, declared once over setControl: setShutterSpeed is setControl('shutterSpeed', …) and resolves to the value the camera read back; the getter reads the current value. |
UnrecognizedValues | Raw values the camera reported that Slate has no name for. |
VerifiedFeature | A vendor feature confirmed on specific bodies on Darkgrade's benches, for isVerifiedFeature. |
VideoFormat | A video format: Sony's codec names (XAVC S 4K), Nikon's file type (H.265 10-bit (MOV)) or Canon's complete movie record. |
VideoQuality | A video quality (bit rate, sampling and depth), as the vendor codecs name it: 150M 4:2:0 10-bit. |
VideoTakeState | A take on several cameras as VideoTake publishes it: its stage and each camera's state. |
WhiteBalance | A white balance in Slate's one spelling, whatever the vendor calls it: Nikon's "Sunny" is 'Daylight', Canon's kebab-case codes are 'Auto', 'Shade', 'Color Temperature' and so on. |
ZoomDirection | Which way startZoom zooms: in towards the long end of the lens, out towards the wide end. |
ZoomOptions | What startZoom takes. |
ZoomSpeed | How fast startZoom moves the lens. |
@darkgrade/slate/cli
The darkgrade command as a function, for an executable that embeds it.
import { runDarkgradeCli } from '@darkgrade/slate/cli'
const exitCode = await runDarkgradeCli(process.argv.slice(2))Guide: CLI
Functions
| Export | What it is |
|---|---|
runDarkgradeCli() | Terminal command behavior shared by the thin darkgrade executable and other Node hosts. |
Types
| Export | What it is |
|---|---|
DarkgradeCliHost | What the embedding executable knows and Slate does not. |
@darkgrade/slate/controls
The setting vocabulary and value conversions without any driver or USB code, for a browser page that draws controls.
import { parseExposureTime } from '@darkgrade/slate/controls'Guide: Settings and values
Classes (5)
Classes (5)
| Export | What it is |
|---|---|
CameraClipNotFoundError | The camera confirmed it stopped recording, but no new finished clip appeared on the card in time. |
CameraConfirmationError | An acknowledged request whose fresh camera observation did not confirm the requested state. |
CameraOutcomeUnknownError | The command was sent but its result could not be confirmed. |
CameraRefusedError | The camera said no, or the value is not one it offers now. |
CameraUnsupportedError | This camera cannot do it right now; getCapabilities() says why. |
Functions (6)
Functions (6)
| Export | What it is |
|---|---|
exposureSeconds() | An exposure time in seconds. An angle needs context.framesPerSecond; a named value such as Bulb gives undefined. |
formatShutterSpeed() | The canonical spelling of an observed exposure; the camera's label is used only to keep a ratio. |
matchExposureTime() | Match an actual advertised value; do not round to a nearby camera setting. |
parseExposureTime() | Reads text such as 1/250, 0.5", 180° or bulb, or an ExposureTime object, into an ExposureTime. Throws on input it cannot read. |
resolveCameraControl() | The setting id for a name or alias, ignoring case, spaces, hyphens and underscores; undefined when none matches. |
unrecognizedValueLabel() | Hexadecimal for integers (0x1234), verbatim for text. |
Constants (3)
Constants (3)
| Export | What it is |
|---|---|
cameraControlDefinitions | Canonical application vocabulary: ids, labels and search aliases (a vendor's own word is only an alias). |
exposureModes | The exposure modes, as words. |
meteringModes | The metering modes, as words. |
Types (37)
Types (37)
| Export | What it is |
|---|---|
Aperture | An aperture in Slate's one spelling: f/ and the f-number without trailing zeros (f/4, f/2.8). |
CameraCapabilities | What getCapabilities resolves to: every setting, the lens, and which operations work now. |
CameraControlId | A setting id, such as iso or shutterSpeed. |
CameraControlInputs | What setControl accepts as a value, by setting id: an ExposureTimeInput for shutterSpeed, a number for colorTemperature and audioLevel, and a string for every other setting. |
CameraControlSession | The same control contract on an already-connected native PTP or vendor SDK session, including one typed getter and setter per typed setting (getShutterSpeed, setShutterSpeed, ...). |
CameraControlState | One setting as the camera reports it now: its value, the values it offers, and whether it can be written. |
CameraLens | The attached lens as the camera reports it. |
CameraRecordingState | What getRecordingState resolves to. |
ColorTemperature | A colour temperature in kelvin. |
ContinuousAutofocus | Whether the camera keeps focusing before a half-press (Canon Continuous AF): On or Off. |
DetectionSubject | What subject detection looks for: People, Animals, Birds, ... |
DigitalZoom | How far zoom reaches past the optics: Off is optical only. |
DriveMode | A drive mode in Slate's one spelling ('Single', 'Continuous high', 'Self-timer 10 s', ...). |
ExposureCompensation | Exposure compensation in stops with one decimal and a sign: +0.7, -1.0, 0.0. |
ExposureContext | The frame rate that converting between a shutter angle and a duration needs. |
ExposureMode | Who picks the exposure: you (Manual), the camera (Program, Auto), or the two of you (aperture or shutter priority). |
ExposureModeAlias | The short forms setExposureMode also accepts: the mode-dial letters, and Canon's Av, Tv and Fv. |
ExposureTime | A shutter speed as a duration in seconds, an angle in degrees, or a named mode (bulb, time, flash-sync, auto). |
ExposureTimeInput | An ExposureTime, or text that parseExposureTime reads, such as 1/250, 0.5" or 180°. |
EyeSelection | Which eye subject detection focuses on: Auto, Right or Left; Off where a body can turn eye detection off (Canon). |
FocusArea | Wide, Zone, Spot M, Tracking Spot M, ...; Sony's Flexible Spot is Spot, Lock-on AF is Tracking. |
FocusMode | AF-S, AF-C or MF, and the other modes a body offers (AF-A, DMF, AF-F, ...). |
Iso | An ISO sensitivity: ISO 800, Auto, and the Sony labels that are distinct settings rather than spellings (an extended sensitivity, the Multi Frame NR sensitivities). |
LiveViewQuality | The live-view picture's quality: High is sharper, Low lighter on the connection. |
MeteringMode | Which part of the frame the camera measures light from. |
OperationAvailability | One operation's availability now: an unsupported one says why, in words a user can act on. |
PhotoVideoMode | Whether the camera is set up to take photos or record video. |
PictureProfile | A Sony Picture Profile ('Off', 'PP1' to 'PP11', 'PP LUT 1' to 'PP LUT 4'). |
PictureStyle | A look in Slate's one spelling: Canon Picture Style, Nikon Picture Control and Sony Creative Look or Creative Style ('Standard', 'Portrait', 'Monochrome', ...). |
SettingInput | What the typed setter of a setting accepts. |
SettingValue | What the typed getter of a setting returns, and its setter resolves to. |
ShutterSpeed | A shutter speed in Slate's one spelling, whatever the vendor calls it: '1/250', '30"', '0.3"', '180°', 'Bulb'. |
SubjectDetection | Whether the camera looks for faces, eyes and other subjects to focus on. |
TypedSettingId | The settings with a typed getter and setter. |
TypedSettingMethods | One getter and one setter per typed setting, declared once over setControl: setShutterSpeed is setControl('shutterSpeed', …) and resolves to the value the camera read back; the getter reads the current value. |
UnrecognizedValues | Raw values the camera reported that Slate has no name for. |
WhiteBalance | A white balance in Slate's one spelling, whatever the vendor calls it: Nikon's "Sunny" is 'Daylight', Canon's kebab-case codes are 'Auto', 'Shade', 'Color Temperature' and so on. |
@darkgrade/slate/protocol
Raw PTP access, the vendor drivers, the registries of operations, properties and events, PTP/IP and wireless pairing. Unsupported: names follow each vendor's own protocol, and nothing here is confirmed the way Camera operations are.
import { protocolSession } from '@darkgrade/slate/protocol'Guides: Raw protocol access · Wi-Fi with PTP/IP
Classes (14)
Classes (14)
| Export | What it is |
|---|---|
CanonCamera | Canon publishes its PTP implementation only under NDA. |
NikonAccessoryController | One persistent Nikon PTP session. |
NikonEventDataCodec | Z6III SDK command reference rev 2, section 6.2.2.13: UINT32 record count, then UINT16 event code, UINT16 parameter count and UINT32 parameters per record. |
NikonMenuController | Navigation on the physically validated Z6III firmware only. |
NikonShotControls | Movie controls on one caller-owned persistent session. |
OpenEnumCodec | An enumeration whose wire values differ between bodies (a property one specification names and another body uses differently): a value with no name decodes as that raw value instead of failing, so a read keeps what the camera said. |
PTPIPTransactionCancelledError | A wire Cancel is a cancelled transaction, never an invented PTP response code. |
SonyBluetoothRemote | A bonded Bluetooth remote. |
SonyPtpVideoRecording | Native Sony PTP only: observed movie state, card identity and bounded-memory transfer. |
SonyRemoteSdkTransport | Transport adapter for an authenticated Sony Camera Remote SDK session. |
SonyVideoRecording | Camera-card take over the same official Sony SDK connection on USB or Wi-Fi. |
SonyWifiCamera | A camera session over Sony's Camera Remote SDK, authenticated over Wi-Fi only (never USB): the CameraSession operations it can serve, under the same names and results as the native driver. |
UsbVideoRecording | Persistent PTP movie recording, final-file discovery and bounded-memory transfer. |
VendorExtensionCamera | A camera from a vendor whose darkgrade support is limited to cited vendor operation definitions (Fujifilm, Panasonic, OM System/Olympus, Leica, Sigma). |
Functions (21)
Functions (21)
| Export | What it is |
|---|---|
compareSonyModels() | SDK feature contracts are comparison evidence, never a replacement for runtime advertisement. |
connectNikonWifiCamera() | Connect an already paired, active Nikon Camera Control profile. |
createEnumCodec() | An EnumCodec whose names are inferred from its values. |
createOpenEnumCodec() | An OpenEnumCodec whose names are inferred from its values. |
createSonySdkBridge() | Spawn an operator-installed official-SDK bridge; no SDK binaries are bundled. |
decodeNikonPairingCode() | Decode the Nikon 952B digit dataset; digits are numeric bytes, not ASCII. |
decodeSonyMonitoringFormat() | Decode the public SDK's packed CrMonitoringFormat without losing uint64 bits. |
discoverNikonWifiCameras() | One bounded, read-only mDNS browse on the chosen IPv4 network interface. |
encodeNikonAccessoryInfo() | Optional accessory metadata. |
encodeNikonAccessoryKey() | Five-byte accessory button state; the last two dial bytes remain neutral. |
isMovableFocusArea() | A focus area whose position can be moved: any spot, in Sony's words (Flexible Spot) or Slate's (Spot). |
pairNikonWifiProfile() | Pair an already selected Nikon Camera Control network profile over PTP/IP. |
prepareNikonManualExposure() | Enable remote Manual exposure on an owned idle Nikon session. |
protocolSession() | The protocol session of a Camera, the same object on every call. |
readNikonRecordingStatus() | Fresh read on an owned Nikon session, including bodies omitting this descriptor from DeviceInfo. |
readNikonWirelessStatus() | Read-only Nikon WTU capabilities; a USB profile bank is not proof of an active Wi-Fi connection. |
recordFullTransport() | Wrap before constructing the camera. |
requestNikonWifi() | Authenticate an existing smart-device registration and request its private WPA network. |
sonyMovieSlots() | Read the movie destination without changing the camera's recording-media selection. |
sonyWifiKeyboardCharacter() | Plan printable ASCII input without including input values in error messages. |
typeSonyWifiKeyboard() | Enter text in an empty Sony Wi-Fi SSID/password keyboard, then select OK. |
Constants (6)
Constants (6)
| Export | What it is |
|---|---|
ExternalDCIn | Z6 III command specification 2.00, section 6.5.14.1. |
MovieShutterMode | Z6 III command specification 2.00, sections 6.5.4.51 and 6.5.12.3. |
nikonOperationRegistry | 0x90ef DeleteWirelessProfile was observed, but its request layout was not captured. |
OBJECT_SIZE_UNREPORTED | ObjectCompressedSize when the object is 4 GiB or larger: its real size needs a 64-bit query. |
SONY_BLUETOOTH_REMOTE_SERVICE | Published RMT-P1BT protocol. |
SONY_CAMERA_BUTTONS | Upper 16 bits of the CameraButtonFunction payload (Camera Remote SDK CrCameraButtonFunction). |
Types (12)
Types (12)
| Export | What it is |
|---|---|
EventData | An event emitter for Node.js and browsers. |
NikonQueuedEvent | Nikon GetEventEx records carry a count for each event's UINT32 parameter words. |
NikonWifiAdvertisement | Nikon Royalmile advertises PTP endpoints through Bonjour. |
ObjectInfo | A file's PTP ObjectInfo dataset, as the camera sent it. |
ProtocolSession | Raw protocol access to one Camera, for bench diagnostics. |
SonyContentFile | Sony's ContentInfoList (Camera Control PTP 3 reference, "ContentInfoList"): the card's contents as the camera indexes them in Remote Control with Transfer Mode. |
SonyFrameKind | Sony's FocalFrameInfo (Camera Control PTP 3 reference, "FocalFrameInfo"): the frames the camera draws over live view (its focus area, detected faces and tracked subjects), carried in every live-view dataset. |
SonyKeyboardControls | Each button press must finish by refreshing image(). |
SonyKeyboardImage | Decoded 640 × 480 Sony OSD frame; the caller supplies PNG decoding. |
SonyRemoteSdkChannel | The wire channel opened by Sony Camera Remote SDK after SSH authentication. |
SonyWifiCameraModel | Any Sony body name is attempted; the bench-verified bodies stay named for completion. |
SonyWirelessConnection | verified is false when the named body (or an unnamed one) has not been confirmed on a bench. |
Also exported (124)
Also exported (124)
ArrayCodec BaseCodecRegistry baseCodecs BaseCodecType BitfieldCodec BitfieldFlag CameraDriverInstance CanonExtendedDeviceInfo CanonLiveViewFrame CanonLiveViewMagnification CanonNetworkState CanonPropertyState CanonRawEvent CanonUnknownPropertyState CodecBuilder CodecDefinition CodecInstance CodecType createBaseCodecs() CustomCodec CustomCodecType DataDirection DatatypeCode DatatypeDefinition DeviceInfo DeviceInfoCodec DevicePropCode EnumCodec EnumValue EventCode EventDefinition EventEmitter EventParameter formatRegistry GenericCamera genericEventRegistry genericOperationRegistry genericPropertyRegistry getDatatypeByCode() Int16Codec Int32Codec Int64Codec Int8Codec IPTransport IPTransportOptions LiveViewPanDirection MovieShutterAngle NIKON_BLUETOOTH_REMOTE_COMMAND NIKON_BLUETOOTH_REMOTE_SERVICE NikonAccessoryInfo NikonAccessoryKey NikonAccessorySoftwareConfirmationOptions NikonAccessoryState NikonBluetoothChannel NikonBluetoothKey NikonBluetoothRemote NikonCamera NikonFocusPointResult NikonFocusResult NikonLiveViewMetadata NikonMenuKey NikonMenuRunOptions NikonSmartDeviceChannel NikonWifiConnectionOptions NikonWifiPairingOptions ObjectInfoCodec OperationCode OperationDefinition ParameterDefinition parseSonyContentInfoList() parseSonyFocalFrameInfo() PropertyAccess PropertyDefinition PTPRegistry RangeCodec RangeSpec ResponseCode ResponseDefinition responseRegistry SONY_BLUETOOTH_REMOTE_COMMAND SONY_BLUETOOTH_REMOTE_NOTIFICATION SONY_SDK_PROPERTY_CODES SonyBluetoothChannel SonyBluetoothDirectAuthentication SonyBluetoothDirection SonyCamera SonyCameraButton SonyContent SonyContentInfoList sonyEventRegistry SonyFocalFrame SonyFocalFrameInfo sonyFormatRegistry sonyModelContracts SonyMonitoringFormat sonyMovieCard() sonyOperationRegistry SonyOsdImage sonyPreviewCapabilities() sonyPropertyRegistry SonyPropertyState sonyPtpMovieCard() SonyRemoteSdkChannelFactory SonyRemoteSdkConnectionOptions sonyResponseRegistry SonySdkBridge SonySdkBridgeOptions SonySdkProperty SonyWifiAuthentication StandardPropertyState StorageInfo StorageInfoCodec StringCodec TransportFactory TransportRecordingEntry TransportRecordingOptions TransportType Uint16Codec Uint32Codec Uint64Codec Uint8Codec USBTransport validateSonyWifiAuthentication() VendorIDs
@darkgrade/slate/runtime
What a host embeds to share one camera between several callers: CameraRuntime with its per-camera queue, the operation list the MCP tools and the CLI are generated from, and cross-process ownership (HardwareCoordinator). In a browser bundle this path resolves to the browser entry.
A bundler that honours the browser condition gets runtime/browser instead, the same as @darkgrade/slate/runtime/browser.
import { CameraRuntime } from '@darkgrade/slate/runtime'Guide: Host cameras for other processes
Classes
| Export | What it is |
|---|---|
CameraRuntime | One runtime per session-owning host. |
HardwareBusyError | Another operation or process holds the camera. Carries status (409), code (HARDWARE_BUSY) and retryAfterMilliseconds. |
HardwareCoordinator | Cross-process camera ownership, with reentrant nested calls on the same operation. |
HttpCameraClient | Connect to the existing owning host. |
OperationInputError | A call's inputs do not match the operation's parameters; nothing was sent to a camera. |
Functions
| Export | What it is |
|---|---|
killMacCameraDaemons() | Stops the macOS camera daemons that are running and returns the ones it stopped. |
readOperationInput() | Checks one call's inputs against the operation's parameters and converts them: numbers from numeric text, time to a Date. |
runOperation() | Runs one public operation on a Camera with inputs already read by readOperationInput. |
surfaceOperations() | Every public operation with its MCP and CLI names, in Camera's declaration order. |
Types
| Export | What it is |
|---|---|
CameraClient | What MCP and other remote frontends call: the public operations, by their library name. |
CameraOperationDescription | One public Camera method as the generator read it. |
CameraProvider | Platform hosts supply the connected Camera and physical services, never a second MCP-owned session. |
OperationFile | A file an operation returned: a live-view frame, a preview, a photo's or a download's bytes. |
OperationInput | One call's inputs by parameter name, as an MCP client or the command line gave them. |
OperationOutcome | An operation's result, as Slate returned it, with its bytes moved out into files. |
OperationParameter | One input of an operation, the same on every surface: a named MCP argument, and on the CLI a positional argument when required, otherwise a flag. |
OperationReply | An operation's result as it crosses a process: JSON, with any bytes the host saved by path. |
OwnershipStore | The store a HardwareCoordinator keeps its leases in, shared by every process that might open the same camera. |
SurfaceOperation | One public Camera operation with its MCP tool and CLI command names, as surfaceOperations() lists it. |
Also exported: surfaceOperation()
@darkgrade/slate/runtime/browser
The runtime without any Node import: everything in ./runtime except cross-process ownership.
import { HttpCameraClient } from '@darkgrade/slate/runtime/browser'Classes
| Export | What it is |
|---|---|
CameraRuntime | One runtime per session-owning host. |
HardwareBusyError | Another operation or process holds the camera. Carries status (409), code (HARDWARE_BUSY) and retryAfterMilliseconds. |
HttpCameraClient | Connect to the existing owning host. |
OperationInputError | A call's inputs do not match the operation's parameters; nothing was sent to a camera. |
Functions
| Export | What it is |
|---|---|
readOperationInput() | Checks one call's inputs against the operation's parameters and converts them: numbers from numeric text, time to a Date. |
runOperation() | Runs one public operation on a Camera with inputs already read by readOperationInput. |
surfaceOperations() | Every public operation with its MCP and CLI names, in Camera's declaration order. |
Types
| Export | What it is |
|---|---|
CameraClient | What MCP and other remote frontends call: the public operations, by their library name. |
CameraOperationDescription | One public Camera method as the generator read it. |
CameraProvider | Platform hosts supply the connected Camera and physical services, never a second MCP-owned session. |
OperationFile | A file an operation returned: a live-view frame, a preview, a photo's or a download's bytes. |
OperationInput | One call's inputs by parameter name, as an MCP client or the command line gave them. |
OperationOutcome | An operation's result, as Slate returned it, with its bytes moved out into files. |
OperationParameter | One input of an operation, the same on every surface: a named MCP argument, and on the CLI a positional argument when required, otherwise a flag. |
OperationReply | An operation's result as it crosses a process: JSON, with any bytes the host saved by path. |
SurfaceOperation | One public Camera operation with its MCP tool and CLI command names, as surfaceOperations() lists it. |
Also exported: surfaceOperation()
@darkgrade/slate/runtime/mcp
The MCP server: one camera_ tool per public Camera operation, generated from the same list. Needs the optional peer dependencies @modelcontextprotocol/server and zod.
import { serveStdio } from '@modelcontextprotocol/server/stdio'
import { HttpCameraClient } from '@darkgrade/slate/runtime'
import { createCameraMcpServer } from '@darkgrade/slate/runtime/mcp'
// Tools run on the cameras a host already holds.
const client = new HttpCameraClient(hostUrl)
await serveStdio(() => createCameraMcpServer(client))Guide: MCP
Functions
| Export | What it is |
|---|---|
cameraToolDefinitions() | One tool per public Camera operation, named and described from Camera itself: camera_ + the method in snake_case, with the method's inputs. |
registerCameraTools() | Registers the generated camera tools, plus camera_run_benchmark where the host offers it. |
toolError() | An MCP tool's error result; a busy camera keeps its code and retry hint for the client. |
Constants
| Export | What it is |
|---|---|
slateToolMeta | The _meta key on every tool Slate generates, with the Camera operation it runs. |
Types
| Export | What it is |
|---|---|
CameraToolDefinition | One generated camera tool: its MCP name, schema and annotations, and the operation it runs. |
CameraToolOptions | How a host that holds one camera serves the tools. |
Also exported: createCameraMcpServer()
@darkgrade/slate/runtime/ownership
Cross-process camera ownership with leases and heartbeats, for a host with more than one process.
import { HardwareCoordinator } from '@darkgrade/slate/runtime/ownership'Classes
| Export | What it is |
|---|---|
HardwareCoordinator | Cross-process camera ownership, with reentrant nested calls on the same operation. |
Constants
| Export | What it is |
|---|---|
OWNERSHIP_LEASE_MILLISECONDS | How long a claim lasts without a heartbeat, how often a held claim is renewed, and how often a waiting call retries. |
Types
| Export | What it is |
|---|---|
OwnershipStore | The store a HardwareCoordinator keeps its leases in, shared by every process that might open the same camera. |
Also exported: OWNERSHIP_HEARTBEAT_MILLISECONDS
@darkgrade/slate/telemetry
Diagnostics sharing for an application that embeds Slate: one shared queue per process.
Also importable as @darkgrade/slate/telemetry/application.
import { createApplicationDiagnostics } from '@darkgrade/slate/telemetry'Guide: Telemetry
Functions
| Export | What it is |
|---|---|
createApplicationDiagnostics() | Create once per application process and observe every camera through this shared queue. |
Also exported: ApplicationDiagnosticsOptions InstallationState InstallationStore validateInstallationState()
@darkgrade/slate/telemetry/batch
The batch a client uploads, and its validation.
import { validateBatch } from '@darkgrade/slate/telemetry/batch'Also exported: BATCH_SCHEMA DiagnosticBatch DIAGNOSTICS_NOTICE MAXIMUM_BATCH_CAMERAS NOTICE_VERSION validateBatch()
@darkgrade/slate/telemetry/installation-store
A file store for the installation state. The application supplies how it is protected.
import {
installationFileStore,
} from '@darkgrade/slate/telemetry/installation-store'Functions
| Export | What it is |
|---|---|
installationFileStore() | One owner per application. |
Also exported: CredentialProtection
@darkgrade/slate/telemetry/protocol
The protocol evidence a diagnostic entry can carry, and its validation.
import { isSafeProtocolProperty } from '@darkgrade/slate/telemetry/protocol'Functions
| Export | What it is |
|---|---|
validateProtocol() | Explicit numeric fields only. |
Also exported: isSafeProtocolProperty() ObservedSetting ProtocolCategory ProtocolEvidence ProtocolNumber StatePhase
@darkgrade/slate/telemetry/schema
The diagnostic entry schema, its limits and its validation.
import {
cameraHardwareFingerprint,
} from '@darkgrade/slate/telemetry/schema'Functions
| Export | What it is |
|---|---|
cameraHardwareFingerprint() | Stable across reconnects, firmware updates and installations; absent when no reliable body serial exists. |
redactMessage() | Removes paths, addresses and long identifiers (serials, object ids) from an error message. |
validateContribution() | Reject extra fields instead of silently accepting images, serials, paths or free-form logs. |
Constants
| Export | What it is |
|---|---|
CONTACT_CONFIRMATION_HOURS | The same, in hours, for help and messages. |
CONTACT_CONFIRMATION_MILLISECONDS | How long an emailed confirmation link works. |
isLegacyArgumentText() | Argument text as a collector from before 2026-12-02 accepts it. |
isSafeArgumentText() | A setting value as Slate spells it (1/250, F2.8, IPB (Standard), Nikon's Fine★, a Canon movie record's label), never a path. |
Types
| Export | What it is |
|---|---|
ApiCall | A public Camera operation as the caller asked for it: the operation table's name (setShutterSpeed) with its MCP tool and CLI command, where it came from, and how it ended. |
ApiCallArgument | One input of a public call. |
ApiCallError | A failed call's typed error. |
Also exported (14)
Also exported (14)
API_CALL_OUTCOMES API_CALL_SURFACES CameraContext Contribution DiagnosticEntry DISCLOSURE INSTALLATION_KEY installationIdOf() installationKey() isContributionId() MAXIMUM_BODY_BYTES MAXIMUM_ENTRIES Repeated SCHEMA
@darkgrade/slate/telemetry/settings
Where Node keeps the sharing preference and saved diagnostics, and the shared Node queue.
import { closeNodeDiagnostics } from '@darkgrade/slate/telemetry/settings'Functions
| Export | What it is |
|---|---|
flushNodeDiagnostics() | Bounded final delivery for process owners; never used on the camera-operation path. |
knownCameras() | Remembers, per USB identity a host asked for, the manufacturer and model the camera reported when it last answered there. |
localDiagnostics() | Per-process rotation avoids cross-process append/rotation races. |
nodeDiagnostics() | One queue and identity shared by all Slate cameras in this process; Studio and the CLI use the same file. |
reportedFacts() | Remembers, across processes, which unchanging protocol facts this installation already shared, so each camera connection does not upload the same inventory again. |
Constants
| Export | What it is |
|---|---|
sharedKnownCameras() | The installation's single record of which camera each USB identity last reported itself as. |
sharedReportedFacts() | The installation's single memory of protocol facts it has already shared. |
telemetryEndpoint() | An override changes the destination; opting out uses the saved preference or opt-out environment flags. |
Also exported: closeNodeDiagnostics() DEFAULT_TELEMETRY_URL saveDiagnosticProfile() settingsDirectory() sharedSettings()
@darkgrade/slate/telemetry/server
The collector. Importing it connects no database and starts no service.
import { createTelemetry } from '@darkgrade/slate/telemetry/server'Classes
| Export | What it is |
|---|---|
InvalidMatrixCursor | A page of the Matrix export was asked for with a cursor the collector cannot read. |
MatrixExportChanged | The Matrix export changed or expired between pages: restart the synchronisation from its first page. |
TelemetryError | The collector refuses a request: status is the HTTP status to answer with, retryAfterSeconds when to try again. |
Functions
| Export | What it is |
|---|---|
createTelemetry() | A single service stores diagnostics and consent state in Postgres. |
diagnosticPattern() | Deterministic validated diagnostics; a review label is independent of import eligibility. |
exportMatrixPage() | Import all validated diagnostics. |
exportReviewedPatterns() | Replace a downstream snapshot wholesale. |
operatorApi() | Server-to-server operator API. |
saveProtocolFinding() | Findings belong to original evidence. |
withdrawInstallation() | The operator route must authenticate separately before omitting the installation key hash. |
Constants
| Export | What it is |
|---|---|
CONTACT_CONFIRMATION_MILLISECONDS | How long an emailed confirmation link works. |
Also exported (14)
Also exported (14)
cleanupInstallation() cleanupWithdrawals() ContactMessage DAILY_BATCH_LIMIT Database investigate() MatrixSource ProtocolFinding resendContactSender() RETENTION_DAYS reviewDiagnostic() Row TelemetryOptions Transaction
@darkgrade/slate/telemetry/postgres
The collector's Postgres database. Needs the optional peer dependency pg.
import { postgresDatabase } from '@darkgrade/slate/telemetry/postgres'Functions
| Export | What it is |
|---|---|
postgresDatabase() | Private operational state, flat diagnostic events, and per-session summaries kept current at ingest. |
Constants
| Export | What it is |
|---|---|
unidentifiedPurges | One-time removal requested on 2026-11-14: events recorded with no camera identity before Slate learned to read it (the first commands of every connection that could not be matched to a session identity, and whole native Sony sessions). |
Also exported: unidentifiedPurge