Creates the initial state object for the data-source state machine, setting effective data source based on configuration and ingest token availability.
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 === "ingest" ? "ingest-only" : "cli-poll",
hasIngestToken,
transitioned: false,
});
}
/** Only path-resolution failures prove that the configured CLI is unavail
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key