UNPKG

@code-yeongyu/senpi

Version:

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

150 lines • 7.39 kB
import { type BrandProfile } from "./core/brand.ts"; /** * Detect if we're running as a Bun compiled binary. * Bun binaries have import.meta.url containing "$bunfs", "~BUN", or "%7EBUN" (Bun's virtual filesystem path) */ export declare const isBunBinary: boolean; /** Detect if Bun is the runtime (compiled binary or bun run) */ export declare const isBunRuntime: boolean; export declare const isBundledNode: boolean; export type InstallMethod = "bun-binary" | "npm" | "pnpm" | "yarn" | "bun" | "unknown"; interface SelfUpdateCommandStep { command: string; args: string[]; display: string; } export interface SelfUpdateCommand extends SelfUpdateCommandStep { steps?: SelfUpdateCommandStep[]; } export type SelfUpdatePackageTarget = string | { packageName: string; installSpec?: string; }; export declare function detectInstallMethod(): InstallMethod; export declare function getSelfUpdateCommand(packageName: string, npmCommand?: string[], updatePackageTarget?: SelfUpdatePackageTarget): SelfUpdateCommand | undefined; export declare function getSelfUpdateUnavailableInstruction(packageName: string, npmCommand?: string[], updatePackageTarget?: SelfUpdatePackageTarget): string; export declare function getUpdateInstruction(packageName: string): string; /** * Get the base directory for resolving package assets (themes, package.json, README.md, CHANGELOG.md). * - For Bun binary: returns the directory containing the executable * - For Node.js and tsx: returns the package root containing package.json * - Ignores Bun binary metadata copied into dist/ when the package root is available */ export declare function findNodePackageDir(startDir: string): string; export declare function getPackageDir(): string; /** * Where the package manager installed this package. Equals `getPackageDir()` except in a process * running from its runtime snapshot (`runtime-snapshot/`), whose assets live in the snapshot. */ export declare function getInstallPackageDir(): string; /** * Get path to built-in themes directory (shipped with package) * - For Bun binary: theme/ next to executable * - For Node.js (dist/): dist/modes/interactive/theme/ * - For tsx (src/): src/modes/interactive/theme/ */ export declare function getThemesDir(): string; /** * Get path to HTML export template directory (shipped with package) * - For Bun binary: export-html/ next to executable * - For Node.js (dist/): dist/core/export-html/ * - For tsx (src/): src/core/export-html/ */ export declare function getExportTemplateDir(): string; /** Get path to package.json */ export declare function getPackageJsonPath(): string; /** Get path to README.md */ export declare function getReadmePath(): string; /** Get path to docs directory */ export declare function getDocsPath(): string; /** Get path to examples directory */ export declare function getExamplesPath(): string; /** Get path to CHANGELOG.md */ export declare function getChangelogPath(): string; /** * Get path to built-in interactive assets directory. * - For Bun binary: assets/ next to executable * - For Node.js (dist/): dist/modes/interactive/assets/ * - For tsx (src/): src/modes/interactive/assets/ */ export declare function getInteractiveAssetsDir(): string; /** Get path to a bundled interactive asset */ export declare function getBundledInteractiveAssetPath(name: string): string; /** * A distribution repackaging this engine injects its brand once. The profile is consumed * here - which also scrubs the variable - so every process spawned later inherits a clean * environment and keeps the engine's own identity. */ export declare const BRAND: BrandProfile | undefined; export declare const PACKAGE_NAME: string; export declare const APP_NAME: string; /** Command-line name; brands whose binary differs from their display name set this. */ export declare const APP_COMMAND: string; export declare const APP_TITLE: string; export declare const CONFIG_DIR_NAME: string; /** True when the brand stores agent state directly under the config dir, with no `agent` segment. */ export declare const CONFIG_FLAT_LAYOUT: boolean; export declare const VERSION: string; /** Version shown to users; VERSION stays the engine version used for update comparisons. */ export declare const DISPLAY_VERSION: string; /** Primary environment prefix for this product; legacy prefixes stay readable. */ export declare const ENV_PREFIX: string; export declare const ENV_AGENT_DIR: string; export declare const ENV_SESSION_DIR: string; export declare function expandTildePath(path: string): string; /** * Base URL of an opt-in `/share` viewer, or undefined. There is no default: a * viewer receives the gist id, so only one the user configured is used (#3524). */ export declare function getShareViewerBase(): string | undefined; /** True when `/share` is switched off for this machine (`<PREFIX>_DISABLE_SHARE=1`). */ export declare function isShareDisabledByEnvironment(): boolean; /** Marker file that identifies a flat-layout config directory. */ export declare const FLAT_LAYOUT_SENTINEL = "settings.json"; /** * Resolve the agent config directory from an explicit environment. * * A flat-layout brand keeps its state directly under the config directory, so it looks for * the settings file as proof rather than for an `agent` subdirectory - the config directory * name may also be used by unrelated project tooling. */ export declare function resolveAgentDir(cwd: string, homeDir: string, envDir?: string): string; /** A test run resolved the real user's agent directory, where its writes would land in live state (#3867). */ export declare class RealAgentDirInTestError extends Error { readonly name = "RealAgentDirInTestError"; readonly agentDir: string; constructor(agentDir: string); } /** * Throws `RealAgentDirInTestError` when a senpi test run (`SENPI_TEST_AGENT_DIR_GUARD=1`) resolves an agent * directory inside the real user's brand config directory. The real home comes from the account * database, not `$HOME`, so a test that redirects `$HOME` to a temp dir still resolves freely. */ export declare function assertAgentDirAllowedInTests(agentDir: string, activeConfigDirName: string, env?: NodeJS.ProcessEnv): void; /** Get the agent config directory (e.g., ~/.senpi/agent/) */ export declare function getAgentDir(): string; /** * Short, display-only spelling of the agent directory for help text and tips, e.g. * `~/.omo` for a flat brand or `~/.senpi/agent` for the engine layout. */ export declare function agentDirLabel(): string; /** Get path to user's custom themes directory */ export declare function getCustomThemesDir(): string; /** Get path to models.json */ export declare function getModelsPath(): string; /** Get path to auth.json */ export declare function getAuthPath(): string; /** Get path to settings.json */ export declare function getSettingsPath(): string; /** Get path to tools directory */ export declare function getToolsDir(): string; /** Get path to managed binaries directory (fd, rg) */ export declare function getBinDir(): string; /** Get path to prompt templates directory */ export declare function getPromptsDir(): string; /** Get path to sessions directory */ export declare function getSessionsDir(): string; /** Get path to debug log file */ export declare function getDebugLogPath(): string; export {}; //# sourceMappingURL=config.d.ts.map