import type { Readable, Writable } from "node:stream"; import type { AgentSession, ContributionFileKind, InstructionInjector, Skill, SystemPromptContribution } from "./contracts.js"; import { type ActivatedKernelConfig } from "./index.js"; import type { AgentBundle } from "./node/agent-definitions.js"; import { type RpcSessionFactory } from "./rpc.js"; export type CliMode = "print" | "json" | "rpc"; export interface CliOptions { readonly mode: CliMode; readonly prompt?: string; readonly provider?: string; readonly model?: string; readonly session?: string; readonly system?: string; readonly context: readonly string[]; readonly compact?: number; readonly maxToolRounds?: number; readonly help: boolean; readonly discover: boolean; readonly discoverKinds: readonly ContributionFileKind[]; readonly noDiscovery: boolean; /** Parsed flag: `--agents-config ` points at the app config root holding * `agents//AGENT.md` bundles. Opt-in; default runs never scan it. */ readonly agentsConfig?: string; /** Runtime-populated (not a parsed flag): agent bundles discovered by `--agents-config` * via {@link discoverAgentBundles}. Host-owned resolution. */ readonly discoveredAgents: readonly AgentBundle[]; /** Runtime-populated (not a parsed flag): skills discovered by `--discover`, * threaded into `createSession` so the bootstrap can build a SkillRegistry. */ readonly discoveredSkills: readonly Skill[]; /** Runtime-populated (not a parsed flag): instruction injectors discovered by * `--discover`, selectable by name via `--instruction` (Task 8). */ readonly discoveredInjectors: readonly InstructionInjector[]; /** Parsed flag: `--instruction ` (repeatable). `false` disables injectors. */ readonly instructions: readonly string[]; /** Parsed flag: `--injector-file ` (repeatable); markdown → static injector. */ readonly injectorFiles: readonly string[]; /** Runtime-populated: `--instruction`/`--injector-file` resolved to live injectors. */ readonly resolvedInstructionInjectors: readonly InstructionInjector[]; /** Parsed flag: `--extension ` (repeatable). Loaded via {@link loadCliExtensions} * into {@link CliOptions.activatedExtensions} before session creation. */ readonly extensions: readonly string[]; /** Runtime-populated (not a parsed flag): activated contributions from `--extension` modules * (`kernel.load()` → `activateKernel()`). Merged into `createAgent()` by `agentSession`. */ readonly activatedExtensions?: ActivatedKernelConfig; /** Parsed flag: `--no-agents-md` / `--no-system-md` skip the corresponding auto-load. */ readonly noAgentsMd: boolean; readonly noSystemMd: boolean; /** Parsed flag: `--agents-md-file ` / `--system-md-file ` override read paths. */ readonly agentsMdFile?: string; readonly systemMdFile?: string; /** Runtime-populated: AGENTS.md/SYSTEM.md layers loaded from disk (print/json modes only; * RPC is host-owned). Threaded into `AgentConfig.systemPrompt` by `defaultCreateSession`. */ readonly systemPromptLayers: readonly SystemPromptContribution[]; } export interface CliRuntime { readonly stdin: Readable; readonly stdout: Writable; readonly stderr: Writable; readonly createSession?: (options: CliOptions) => AgentSession | Promise; readonly commands?: RpcSessionFactory["commands"]; /** Workspace root for `--discover`. Defaults to `process.cwd()`. */ readonly workspaceRoot?: string; /** Optional global root for SYSTEM.md auto-load (host-controlled). No default; * the CLI does not auto-touch the user's home directory. */ readonly globalRoot?: string; /** Override init template root (tests). */ readonly initTemplatesRoot?: string; /** Override template gallery root (tests). */ readonly initGalleryRoot?: string; /** Override version stamped by `prism init` (tests). */ readonly initPackageVersion?: string; /** Override provider-scaffold template root (tests). */ readonly providerTemplatesRoot?: string; /** Override version stamped by `prism providers add` (tests). */ readonly providerPackageVersion?: string; /** Working directory for relative `prism init` destinations (tests). */ readonly cwd?: string; /** Test injection for `prism dev`: overrides `@arnilo/prism-dev` resolution. */ readonly loadDevCli?: () => Promise; } export declare const usage = "Usage: prism [--mode print|json|rpc] [-p prompt] [options]\n prism init [--template ] [--list-templates] [--provider ] [--with-workflows] [--with-evals] [--force]\n prism providers add [--base-url ] [--env-key ] [--model ] [--force]\n prism dev [--port ] [--host ] (loopback inspector; delegates into @arnilo/prism-dev)\n\n\nOptions:\n -p, --prompt Prompt to run in print/json mode\n --provider Provider id from the init provider catalog ('mock' is built in;\n real providers need their @arnilo/prism-providers package +\n credential env var)\n --model Explicit model name\n --session Session id\n --system System instructions\n --context Context text\n --compact Auto-compaction threshold\n --max-tool-rounds Maximum tool rounds\n --discover Enable workspace contribution discovery (opt-in)\n --discover-kinds Kinds to discover (default: skill; skill,tool,context,instructions)\n --no-discovery Disable discovery even if --discover is set\n --extension Load a trusted extension module (repeatable). Relative paths load\n from the working directory; package names and absolute paths must\n be listed in PRISM_EXTENSION_ALLOWLIST (comma-separated).\n --agents-config App config root holding agents//AGENT.md bundles (opt-in)\n --no-agents-md Skip auto-loading /AGENTS.md\n --no-system-md Skip auto-loading the global SYSTEM.md layer\n --agents-md-file Read AGENTS.md from instead (trust-gated, source: app)\n --system-md-file Read SYSTEM.md from instead (source: user)\n -h, --help Show this help\n"; export declare function parseCliArgs(argv: readonly string[]): CliOptions; export declare function runCli(argv: readonly string[], runtime: CliRuntime): Promise; export declare function runPromptMode(session: AgentSession, options: CliOptions, stdout: Writable, mode: "print" | "json"): Promise; export declare class CliUsageError extends Error { }