Creates the initial state object for the data-source state machine, setting effective data source based on configuration and ingest token availability.
// Source: https://github.com/SweetSophia/openclaw-pixel-agents | License: MIT | Copyright 2026 Sherina
// Provided via justclaw.it.com; keep this notice with the code.
export type ConfiguredDataSource = "auto" | "cli" | "ingest";
export type EffectiveDataSource = "cli-poll" | "ingest-only";
export type CliFailureKind = "missing-executable" | "transient";
export type DataSourceState = Readonly<{
configured: ConfiguredDataSource;
effective: EffectiveDataSource;
hasIngestToken: boolean;
transitioned: boolean;
}>;
/** Create the initial state for the data-source finite-state machine. */
export function createInitialDataSourceState(
configured: ConfiguredDataSource,
hasIngestToken: boolean,
): DataSourceState {
return Object.freeze({
configured,
effective: configured ==
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key