/** * ADR-510 §2.2 — give a headless `claude -p` worker its ruflo plugins. * * Every place ruflo builds a `claude -p` command line passes its argv and env * through `withHeadlessPlugins`. It appends `--plugin-dir ` per plugin * in the worker profile (default: ruflo-mods) and sets * `CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1` unless the caller set it (a caller's * `0` stays `0`). A caller's own `--plugin-dir` for the same plugin is never * duplicated. * * A plugin that cannot be resolved does not stop the worker: it is logged once * per process ("plugin not found; worker runs without it") and returned * in `missing` for the worker's status. * * Profile override: `RUFLO_HEADLESS_PLUGINS` is a comma list of plugin names; * `none` (or an empty value) turns plugin loading off. * * Permission mode: Claude Code 2.1.302 starts a `claude -p` with no * permission mode in `manual` mode on third-party providers, with telemetry * off, or on a fresh install. A headless worker has nobody to answer a prompt, * so a print-mode argv without its own `--permission-mode` or * `--dangerously-skip-permissions` gets `--permission-mode auto` — the mode * first-party installs already started in. `RUFLO_HEADLESS_PERMISSION_MODE` * picks another mode; `none` (or an empty value) passes no flag. */ import { type ResolveOptions, type PluginPaths } from './plugin-paths.js'; export declare const DEFAULT_WORKER_PLUGINS: readonly string[]; export declare const PROFILE_ENV = "RUFLO_HEADLESS_PLUGINS"; export declare const PERMISSION_MODE_ENV = "RUFLO_HEADLESS_PERMISSION_MODE"; export declare const DEFAULT_HEADLESS_PERMISSION_MODE = "auto"; export interface HeadlessPluginOptions extends ResolveOptions { /** Plugin names to load; defaults to the env profile, else DEFAULT_WORKER_PLUGINS. */ profile?: readonly string[]; /** Where the once-per-process warning goes (default: stderr). */ warn?: (line: string) => void; /** Injectable resolver, for tests. */ resolver?: (names: readonly string[], opts: ResolveOptions) => PluginPaths; } export interface HeadlessPluginResult { argv: string[]; env: E; /** Plugins loaded via --plugin-dir by this call (not the caller's own). */ added: string[]; /** Plugins in the profile that could not be resolved. */ missing: string[]; } /** For tests: forget which missing plugins were already logged. */ export declare function resetHeadlessPluginWarnings(): void; /** The worker profile: explicit, else RUFLO_HEADLESS_PLUGINS, else ruflo-mods. */ export declare function workerProfile(env?: NodeJS.ProcessEnv, explicit?: readonly string[]): string[]; /** Every `--plugin-dir` value already in argv (both `--plugin-dir x` and `--plugin-dir=x`). */ export declare function existingPluginDirs(argv: readonly string[]): string[]; /** * The `--permission-mode` args to append to a headless argv: none when the * argv is not print mode or already sets a mode, else the env choice * (default `auto`). An unknown mode is ignored with the default used instead. */ export declare function headlessPermissionArgs(argv: readonly string[], env?: NodeJS.ProcessEnv): string[]; export declare function withHeadlessPlugins>(argv: readonly string[], env: E, opts?: HeadlessPluginOptions): HeadlessPluginResult; //# sourceMappingURL=headless-plugins.d.ts.map