@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
107 lines • 4.33 kB
TypeScript
/**
* CLI argument parsing and help display
*/
import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
import type { ExtensionFlag } from "../core/extensions/types.ts";
import type { SpawnedBy } from "../core/session-lifecycle-types.ts";
import type { TuiMode } from "../core/settings-manager.ts";
import { type ToolRuntimeKind } from "./tool-runtime.ts";
export type Mode = "text" | "json" | "rpc";
export interface Args {
provider?: string;
model?: string;
apiKey?: string;
systemPrompt?: string;
appendSystemPrompt?: string[];
thinking?: ThinkingLevel;
continue?: boolean;
resume?: boolean;
help?: boolean;
version?: boolean;
mode?: Mode;
name?: string;
noSession?: boolean;
session?: string;
attach?: string;
sessionId?: string;
spawnedBy?: SpawnedBy;
fork?: string;
rebind?: string;
sessionDir?: string;
models?: string[];
tools?: string[];
excludeTools?: string[];
noTools?: boolean;
noBuiltinTools?: boolean;
extensions?: string[];
noExtensions?: boolean;
print?: boolean;
export?: string;
noSkills?: boolean;
skills?: string[];
promptTemplates?: string[];
noPromptTemplates?: boolean;
themes?: string[];
useTheme?: string;
noThemes?: boolean;
noContextFiles?: boolean;
listModels?: string | true;
printPromptSizes?: boolean;
listTips?: boolean;
offline?: boolean;
tuiMode?: TuiMode;
verbose?: boolean;
projectTrustOverride?: boolean;
/** Launch the experimental grok interactive chrome. */
grokNeo?: boolean;
/** Serve independently routed plain-RPC sessions over one host. */
multiSession?: boolean;
/** Start the engine as a hand: loopless tool execution for a remote loop on `<agentDir>/rpc/hand.sock`. */
hand?: boolean;
/** Start the headless engine: the machine-owned multi-session host on `<agentDir>/rpc/headless.sock`. */
headless?: boolean;
presenterBootstrapFd?: number;
mcpPresenterEnforcement?: boolean;
/**
* Opt non-interactive app modes (notably RPC) into engine-side session auto-titling.
* Deprecated for shared hosts: prefer per-session `open_session.auto_title`.
*/
autoTitleSessions?: boolean;
/** Multi-session RPC listener: stdio://, unix://, unix:///path, or a socket path. */
listen?: string;
/** Explicit session runtime for a multi-session host; `resolveSessionRuntime` owns the default. */
sessionRuntime?: SessionRuntimeKind;
/** Explicit tool runtime; `resolveToolRuntime` owns the default and the env fallback. */
toolRuntime?: ToolRuntimeKind;
messages: string[];
fileArgs: string[];
/** A bare `-` argument: read stdin to EOF even when a prompt argument is given. */
readStdin?: boolean;
/** Unknown flags (potentially extension flags) - map of flag name to value */
unknownFlags: Map<string, boolean | string>;
diagnostics: Array<{
type: "warning" | "error";
message: string;
}>;
}
declare const SESSION_RUNTIMES: readonly ["in-process", "worker"];
/** Where a multi-session host runs its sessions: in the host process, or one worker isolate each. */
export type SessionRuntimeKind = (typeof SESSION_RUNTIMES)[number];
export declare function isSessionRuntimeKind(value: string): value is SessionRuntimeKind;
/**
* Session runtime of a multi-session host. A `--listen` SOCKET host is the
* machine-wide daemon every client shares: it runs every session IN the host
* process, so there is no worker isolate per session and no worker cap. stdio
* hosts and embedders keep the worker runtime unchanged. An explicit
* `--session-runtime` always wins over both defaults.
*/
export declare function resolveSessionRuntime(parsed: Pick<Args, "sessionRuntime" | "listen" | "headless">): SessionRuntimeKind;
export declare function isValidThinkingLevel(level: string): level is ThinkingLevel;
export declare function normalizeSessionName(value: string): string | undefined;
export declare function parseArgs(args: string[], options?: {
grokNeoEnabled?: boolean;
booleanExtensionFlags?: ReadonlySet<string>;
}): Args;
export declare function printHelp(extensionFlags?: ExtensionFlag[], grokNeoEnabled?: boolean): void;
export {};
//# sourceMappingURL=args.d.ts.map