UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

94 lines • 4.73 kB
/** * Brand profile resolution. * * A distribution that repackages this engine (for example the `omo-ai` package) injects a * single JSON environment variable describing how the product presents itself. The engine * parses it once at startup and then REMOVES it from the environment, so nested processes * spawned by tools inherit a clean environment and keep the engine's own identity. * * Absent or malformed input leaves every brand-derived value at its standalone default, so a * plain install behaves exactly as it did before this module existed. */ /** Environment variable carrying the JSON brand profile. */ export declare const BRAND_ENV_VAR = "SENPI_BRAND"; /** * Where a repackaging distribution publishes itself. Without this the engine keeps checking * its own package, which would advertise an update the branded product cannot install. */ export interface BrandUpdateChannel { /** Registry package that ships the branded product, e.g. `omo-ai`. */ readonly packageName: string; /** Dist-tag the product publishes on, e.g. `beta`. */ readonly distTag: string; /** Command shown to the user, e.g. `npm i -g omo-ai@beta`. */ readonly command: string; /** Release notes URL; `{version}` is replaced with the available version. */ readonly changelogUrl?: string; } export interface BrandChangelog { readonly path: string; readonly version?: string; } export interface BrandProfile { /** Product name shown to users and to the model. */ readonly name: string; /** Executable name used in shell-command contexts when it differs from the display name. */ readonly command?: string; /** Version shown in the header, terminal titles and `--version`. */ readonly displayVersion?: string; /** Config directory name, e.g. `.omo`. */ readonly configDir: string; /** When true the agent state lives directly under the config directory, with no `agent` segment. */ readonly flatLayout: boolean; /** Prefix for the product's environment variables, e.g. `OMO`. */ readonly envPrefix: string; /** Product token used in the outgoing user agent. */ readonly userAgent: string; /** Product token used as the provider-side originator, when the distribution overrides it. */ readonly originator?: string; /** Product logo for the sign-in result pages, as a base64 image data URI. */ readonly logo?: string; /** Update channel of the branded product; absent means the product manages updates itself. */ readonly update?: BrandUpdateChannel; readonly changelog?: BrandChangelog; /** * Absolute paths of the distribution's own extensions, which its launcher passes with `--extension` on every * start. A host the distribution runs loads them too, so an attaching start never counts them as flags it cannot * apply (oh-my-openagent#14465). */ readonly extensions?: readonly string[]; } /** * Parses a brand profile. Returns undefined for absent, malformed, or nameless input; a * malformed profile is reported once on stderr and never throws, because a broken brand * must not stop the agent from starting. */ export declare function parseBrandProfile(raw: string | undefined): BrandProfile | undefined; /** * Parses the brand profile without touching the environment. * * The CLI entrypoint re-spawns the real agent as a child process and hands it `process.env`, * so the variable has to survive that hop. Scrubbing therefore happens explicitly in the * process that actually runs the agent - see `scrubBrandFromEnvironment`. */ export declare function consumeBrandProfile(env?: NodeJS.ProcessEnv): BrandProfile | undefined; /** * Removes the brand variable so tools spawning the engine again inherit a clean environment * and keep the engine's own identity. Called once the profile has been resolved by the * process that runs the agent loop. */ export declare function scrubBrandFromEnvironment(env?: NodeJS.ProcessEnv): void; /** * The active brand profile, resolved (and scrubbed from the environment) on first use. */ export declare function brandProfile(): BrandProfile | undefined; /** exported for tests only */ export declare function resetBrandProfileForTests(): void; /** Environment variable names for one setting, most specific first. */ export declare function brandEnvNames(suffix: string, profile?: BrandProfile | undefined): string[]; /** * Reads one setting across the brand's prefix and the legacy prefixes, returning the first * DEFINED value so that an explicitly empty value keeps its existing meaning. */ export declare function envValue(suffix: string, env?: NodeJS.ProcessEnv): string | undefined; //# sourceMappingURL=brand.d.ts.map