@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
423 lines • 19.1 kB
TypeScript
import { type ConfigValue } from "@earendil-works/pi-ai/utils/config-reference";
import { type Static, Type } from "typebox";
export declare const LogLevelSchema: Type.TUnion<[Type.TLiteral<"debug">, Type.TLiteral<"info">, Type.TLiteral<"notice">, Type.TLiteral<"warning">, Type.TLiteral<"error">, Type.TLiteral<"critical">, Type.TLiteral<"alert">, Type.TLiteral<"emergency">]>;
export declare const ServerSchema: Type.TObject<{
type: Type.TOptional<Type.TUnion<[Type.TLiteral<"stdio">, Type.TLiteral<"http">]>>;
url: Type.TOptional<Type.TString>;
command: Type.TOptional<Type.TString>;
args: Type.TOptional<Type.TArray<Type.TUnion<[Type.TString, Type.TUnion<[Type.TObject<{
$file: Type.TString;
}>, Type.TObject<{
$env: Type.TString;
}>, Type.TObject<{
$concat: Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
$file: Type.TString;
}>, Type.TObject<{
$env: Type.TString;
}>]>>;
}>]>]>>>;
env: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TString, Type.TUnion<[Type.TObject<{
$file: Type.TString;
}>, Type.TObject<{
$env: Type.TString;
}>, Type.TObject<{
$concat: Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
$file: Type.TString;
}>, Type.TObject<{
$env: Type.TString;
}>]>>;
}>]>]>>>;
cwd: Type.TOptional<Type.TString>;
headers: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TString, Type.TUnion<[Type.TObject<{
$file: Type.TString;
}>, Type.TObject<{
$env: Type.TString;
}>, Type.TObject<{
$concat: Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
$file: Type.TString;
}>, Type.TObject<{
$env: Type.TString;
}>]>>;
}>]>]>>>;
auth: Type.TOptional<Type.TUnion<[Type.TLiteral<"bearer">, Type.TLiteral<"oauth">, Type.TLiteral<false>]>>;
bearerTokenEnv: Type.TOptional<Type.TString>;
oauth: Type.TOptional<Type.TObject<{
clientId: Type.TOptional<Type.TString>;
callbackPort: Type.TOptional<Type.TInteger>;
scopes: Type.TOptional<Type.TArray<Type.TString>>;
clientMetadataUrl: Type.TOptional<Type.TString>;
flow: Type.TOptional<Type.TUnion<[Type.TLiteral<"code">, Type.TLiteral<"client_credentials">]>>;
}>>;
enabled: Type.TOptional<Type.TBoolean>;
lifecycle: Type.TOptional<Type.TUnion<[Type.TLiteral<"lazy">, Type.TLiteral<"eager">, Type.TLiteral<"keep-alive">]>>;
idleTimeoutMin: Type.TOptional<Type.TNumber>;
requestTimeoutMs: Type.TOptional<Type.TNumber>;
connectTimeoutMs: Type.TOptional<Type.TNumber>;
startupTimeoutMs: Type.TOptional<Type.TNumber>;
includeTools: Type.TOptional<Type.TArray<Type.TString>>;
excludeTools: Type.TOptional<Type.TArray<Type.TString>>;
directTools: Type.TOptional<Type.TUnion<[Type.TBoolean, Type.TArray<Type.TString>]>>;
exposure: Type.TOptional<Type.TUnion<[Type.TLiteral<"auto">, Type.TLiteral<"direct">, Type.TLiteral<"search">, Type.TLiteral<"proxy">]>>;
logLevel: Type.TOptional<Type.TUnion<[Type.TLiteral<"debug">, Type.TLiteral<"info">, Type.TLiteral<"notice">, Type.TLiteral<"warning">, Type.TLiteral<"error">, Type.TLiteral<"critical">, Type.TLiteral<"alert">, Type.TLiteral<"emergency">]>>;
}>;
declare const SettingsSchema: Type.TObject<{
toolPrefix: Type.TOptional<Type.TString>;
searchThreshold: Type.TOptional<Type.TNumber>;
outputGuard: Type.TOptional<Type.TObject<{
maxBytes: Type.TOptional<Type.TNumber>;
maxLines: Type.TOptional<Type.TNumber>;
maxTokens: Type.TOptional<Type.TNumber>;
}>>;
importConfigs: Type.TOptional<Type.TArray<Type.TLiteral<"claude">>>;
oauthCallbackUrl: Type.TOptional<Type.TString>;
stubSwap: Type.TOptional<Type.TBoolean>;
nativeToolSearch: Type.TOptional<Type.TUnion<[Type.TLiteral<"auto">, Type.TBoolean]>>;
}>;
export declare const ConfigSchema: Type.TObject<{
settings: Type.TOptional<Type.TObject<{
toolPrefix: Type.TOptional<Type.TString>;
searchThreshold: Type.TOptional<Type.TNumber>;
outputGuard: Type.TOptional<Type.TObject<{
maxBytes: Type.TOptional<Type.TNumber>;
maxLines: Type.TOptional<Type.TNumber>;
maxTokens: Type.TOptional<Type.TNumber>;
}>>;
importConfigs: Type.TOptional<Type.TArray<Type.TLiteral<"claude">>>;
oauthCallbackUrl: Type.TOptional<Type.TString>;
stubSwap: Type.TOptional<Type.TBoolean>;
nativeToolSearch: Type.TOptional<Type.TUnion<[Type.TLiteral<"auto">, Type.TBoolean]>>;
}>>;
mcpServers: Type.TOptional<Type.TRecord<"^.*$", Type.TObject<{
type: Type.TOptional<Type.TUnion<[Type.TLiteral<"stdio">, Type.TLiteral<"http">]>>;
url: Type.TOptional<Type.TString>;
command: Type.TOptional<Type.TString>;
args: Type.TOptional<Type.TArray<Type.TUnion<[Type.TString, Type.TUnion<[Type.TObject<{
$file: Type.TString;
}>, Type.TObject<{
$env: Type.TString;
}>, Type.TObject<{
$concat: Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
$file: Type.TString;
}>, Type.TObject<{
$env: Type.TString;
}>]>>;
}>]>]>>>;
env: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TString, Type.TUnion<[Type.TObject<{
$file: Type.TString;
}>, Type.TObject<{
$env: Type.TString;
}>, Type.TObject<{
$concat: Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
$file: Type.TString;
}>, Type.TObject<{
$env: Type.TString;
}>]>>;
}>]>]>>>;
cwd: Type.TOptional<Type.TString>;
headers: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TString, Type.TUnion<[Type.TObject<{
$file: Type.TString;
}>, Type.TObject<{
$env: Type.TString;
}>, Type.TObject<{
$concat: Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
$file: Type.TString;
}>, Type.TObject<{
$env: Type.TString;
}>]>>;
}>]>]>>>;
auth: Type.TOptional<Type.TUnion<[Type.TLiteral<"bearer">, Type.TLiteral<"oauth">, Type.TLiteral<false>]>>;
bearerTokenEnv: Type.TOptional<Type.TString>;
oauth: Type.TOptional<Type.TObject<{
clientId: Type.TOptional<Type.TString>;
callbackPort: Type.TOptional<Type.TInteger>;
scopes: Type.TOptional<Type.TArray<Type.TString>>;
clientMetadataUrl: Type.TOptional<Type.TString>;
flow: Type.TOptional<Type.TUnion<[Type.TLiteral<"code">, Type.TLiteral<"client_credentials">]>>;
}>>;
enabled: Type.TOptional<Type.TBoolean>;
lifecycle: Type.TOptional<Type.TUnion<[Type.TLiteral<"lazy">, Type.TLiteral<"eager">, Type.TLiteral<"keep-alive">]>>;
idleTimeoutMin: Type.TOptional<Type.TNumber>;
requestTimeoutMs: Type.TOptional<Type.TNumber>;
connectTimeoutMs: Type.TOptional<Type.TNumber>;
startupTimeoutMs: Type.TOptional<Type.TNumber>;
includeTools: Type.TOptional<Type.TArray<Type.TString>>;
excludeTools: Type.TOptional<Type.TArray<Type.TString>>;
directTools: Type.TOptional<Type.TUnion<[Type.TBoolean, Type.TArray<Type.TString>]>>;
exposure: Type.TOptional<Type.TUnion<[Type.TLiteral<"auto">, Type.TLiteral<"direct">, Type.TLiteral<"search">, Type.TLiteral<"proxy">]>>;
logLevel: Type.TOptional<Type.TUnion<[Type.TLiteral<"debug">, Type.TLiteral<"info">, Type.TLiteral<"notice">, Type.TLiteral<"warning">, Type.TLiteral<"error">, Type.TLiteral<"critical">, Type.TLiteral<"alert">, Type.TLiteral<"emergency">]>>;
}>>>;
}>;
export type RawConfig = Static<typeof ConfigSchema>;
/** A server as declared: its `headers.*`, `env.*` and `args[]` may hold reference objects. */
export type McpServerDeclaredConfig = Static<typeof ServerSchema> & {
type: "stdio" | "http";
args: ConfigValue[];
enabled: boolean;
lifecycle: "lazy" | "eager" | "keep-alive";
connectTimeoutMs: number;
requestTimeoutMs: number;
startupTimeoutMs: number;
idleTimeoutMin: number;
exposure: "auto" | "direct" | "search" | "proxy";
logLevel: Static<typeof LogLevelSchema>;
};
/** One connection generation's snapshot: every reference replaced by the text it resolved to. */
export type McpServerConfig = Omit<McpServerDeclaredConfig, "args" | "env" | "headers"> & {
args: string[];
env?: Record<string, string>;
headers?: Record<string, string>;
};
/** Public raw type for extension-declared MCP servers. */
export type McpServerDeclaration = Static<typeof ServerSchema>;
export type McpSettings = Required<Pick<Static<typeof SettingsSchema>, "toolPrefix">> & Omit<Static<typeof SettingsSchema>, "toolPrefix">;
export type McpServerSource = "global" | "claude" | "project" | "skill" | "extension";
export type McpServerState = "enabled" | "disabled" | "untrusted";
export interface ResolvedMcpServer {
name: string;
source: McpServerSource;
sourcePath: string;
state: McpServerState;
transport?: "stdio" | "http";
configHash?: string;
config?: McpServerDeclaredConfig;
}
export interface ResolvedMcpConfig {
settings: McpSettings;
servers: Record<string, ResolvedMcpServer>;
diagnostics: string[];
}
export interface LoadMcpConfigOptions {
cwd: string;
agentDir?: string;
env?: Record<string, string | undefined>;
projectTrusted: boolean;
}
export declare function getServerEndpointValidationError(config: RawConfig): string | undefined;
export declare const validateConfig: import("typebox/compile").Validator<{}, Type.TObject<{
settings: Type.TOptional<Type.TObject<{
toolPrefix: Type.TOptional<Type.TString>;
searchThreshold: Type.TOptional<Type.TNumber>;
outputGuard: Type.TOptional<Type.TObject<{
maxBytes: Type.TOptional<Type.TNumber>;
maxLines: Type.TOptional<Type.TNumber>;
maxTokens: Type.TOptional<Type.TNumber>;
}>>;
importConfigs: Type.TOptional<Type.TArray<Type.TLiteral<"claude">>>;
oauthCallbackUrl: Type.TOptional<Type.TString>;
stubSwap: Type.TOptional<Type.TBoolean>;
nativeToolSearch: Type.TOptional<Type.TUnion<[Type.TLiteral<"auto">, Type.TBoolean]>>;
}>>;
mcpServers: Type.TOptional<Type.TRecord<"^.*$", Type.TObject<{
type: Type.TOptional<Type.TUnion<[Type.TLiteral<"stdio">, Type.TLiteral<"http">]>>;
url: Type.TOptional<Type.TString>;
command: Type.TOptional<Type.TString>;
args: Type.TOptional<Type.TArray<Type.TUnion<[Type.TString, Type.TUnion<[Type.TObject<{
$file: Type.TString;
}>, Type.TObject<{
$env: Type.TString;
}>, Type.TObject<{
$concat: Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
$file: Type.TString;
}>, Type.TObject<{
$env: Type.TString;
}>]>>;
}>]>]>>>;
env: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TString, Type.TUnion<[Type.TObject<{
$file: Type.TString;
}>, Type.TObject<{
$env: Type.TString;
}>, Type.TObject<{
$concat: Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
$file: Type.TString;
}>, Type.TObject<{
$env: Type.TString;
}>]>>;
}>]>]>>>;
cwd: Type.TOptional<Type.TString>;
headers: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TString, Type.TUnion<[Type.TObject<{
$file: Type.TString;
}>, Type.TObject<{
$env: Type.TString;
}>, Type.TObject<{
$concat: Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
$file: Type.TString;
}>, Type.TObject<{
$env: Type.TString;
}>]>>;
}>]>]>>>;
auth: Type.TOptional<Type.TUnion<[Type.TLiteral<"bearer">, Type.TLiteral<"oauth">, Type.TLiteral<false>]>>;
bearerTokenEnv: Type.TOptional<Type.TString>;
oauth: Type.TOptional<Type.TObject<{
clientId: Type.TOptional<Type.TString>;
callbackPort: Type.TOptional<Type.TInteger>;
scopes: Type.TOptional<Type.TArray<Type.TString>>;
clientMetadataUrl: Type.TOptional<Type.TString>;
flow: Type.TOptional<Type.TUnion<[Type.TLiteral<"code">, Type.TLiteral<"client_credentials">]>>;
}>>;
enabled: Type.TOptional<Type.TBoolean>;
lifecycle: Type.TOptional<Type.TUnion<[Type.TLiteral<"lazy">, Type.TLiteral<"eager">, Type.TLiteral<"keep-alive">]>>;
idleTimeoutMin: Type.TOptional<Type.TNumber>;
requestTimeoutMs: Type.TOptional<Type.TNumber>;
connectTimeoutMs: Type.TOptional<Type.TNumber>;
startupTimeoutMs: Type.TOptional<Type.TNumber>;
includeTools: Type.TOptional<Type.TArray<Type.TString>>;
excludeTools: Type.TOptional<Type.TArray<Type.TString>>;
directTools: Type.TOptional<Type.TUnion<[Type.TBoolean, Type.TArray<Type.TString>]>>;
exposure: Type.TOptional<Type.TUnion<[Type.TLiteral<"auto">, Type.TLiteral<"direct">, Type.TLiteral<"search">, Type.TLiteral<"proxy">]>>;
logLevel: Type.TOptional<Type.TUnion<[Type.TLiteral<"debug">, Type.TLiteral<"info">, Type.TLiteral<"notice">, Type.TLiteral<"warning">, Type.TLiteral<"error">, Type.TLiteral<"critical">, Type.TLiteral<"alert">, Type.TLiteral<"emergency">]>>;
}>>>;
}>, {
settings?: {
toolPrefix?: string | undefined;
searchThreshold?: number | undefined;
outputGuard?: {
maxBytes?: number | undefined;
maxLines?: number | undefined;
maxTokens?: number | undefined;
} | undefined;
importConfigs?: "claude"[] | undefined;
oauthCallbackUrl?: string | undefined;
stubSwap?: boolean | undefined;
nativeToolSearch?: "auto" | boolean | undefined;
} | undefined;
mcpServers?: Record<string, {
type?: "http" | "stdio" | undefined;
url?: string | undefined;
command?: string | undefined;
args?: (string | {
$file: string;
} | {
$env: string;
} | {
$concat: (string | {
$file: string;
} | {
$env: string;
})[];
})[] | undefined;
env?: Record<string, string | {
$file: string;
} | {
$env: string;
} | {
$concat: (string | {
$file: string;
} | {
$env: string;
})[];
}> | undefined;
cwd?: string | undefined;
headers?: Record<string, string | {
$file: string;
} | {
$env: string;
} | {
$concat: (string | {
$file: string;
} | {
$env: string;
})[];
}> | undefined;
auth?: "bearer" | "oauth" | false | undefined;
bearerTokenEnv?: string | undefined;
oauth?: {
clientId?: string | undefined;
callbackPort?: number | undefined;
scopes?: string[] | undefined;
clientMetadataUrl?: string | undefined;
flow?: "client_credentials" | "code" | undefined;
} | undefined;
enabled?: boolean | undefined;
lifecycle?: "eager" | "keep-alive" | "lazy" | undefined;
idleTimeoutMin?: number | undefined;
requestTimeoutMs?: number | undefined;
connectTimeoutMs?: number | undefined;
startupTimeoutMs?: number | undefined;
includeTools?: string[] | undefined;
excludeTools?: string[] | undefined;
directTools?: boolean | string[] | undefined;
exposure?: "auto" | "direct" | "proxy" | "search" | undefined;
logLevel?: "alert" | "critical" | "debug" | "emergency" | "error" | "info" | "notice" | "warning" | undefined;
}> | undefined;
}, {
settings?: {
toolPrefix?: string | undefined;
searchThreshold?: number | undefined;
outputGuard?: {
maxBytes?: number | undefined;
maxLines?: number | undefined;
maxTokens?: number | undefined;
} | undefined;
importConfigs?: "claude"[] | undefined;
oauthCallbackUrl?: string | undefined;
stubSwap?: boolean | undefined;
nativeToolSearch?: "auto" | boolean | undefined;
} | undefined;
mcpServers?: Record<string, {
type?: "http" | "stdio" | undefined;
url?: string | undefined;
command?: string | undefined;
args?: (string | {
$file: string;
} | {
$env: string;
} | {
$concat: (string | {
$file: string;
} | {
$env: string;
})[];
})[] | undefined;
env?: Record<string, string | {
$file: string;
} | {
$env: string;
} | {
$concat: (string | {
$file: string;
} | {
$env: string;
})[];
}> | undefined;
cwd?: string | undefined;
headers?: Record<string, string | {
$file: string;
} | {
$env: string;
} | {
$concat: (string | {
$file: string;
} | {
$env: string;
})[];
}> | undefined;
auth?: "bearer" | "oauth" | false | undefined;
bearerTokenEnv?: string | undefined;
oauth?: {
clientId?: string | undefined;
callbackPort?: number | undefined;
scopes?: string[] | undefined;
clientMetadataUrl?: string | undefined;
flow?: "client_credentials" | "code" | undefined;
} | undefined;
enabled?: boolean | undefined;
lifecycle?: "eager" | "keep-alive" | "lazy" | undefined;
idleTimeoutMin?: number | undefined;
requestTimeoutMs?: number | undefined;
connectTimeoutMs?: number | undefined;
startupTimeoutMs?: number | undefined;
includeTools?: string[] | undefined;
excludeTools?: string[] | undefined;
directTools?: boolean | string[] | undefined;
exposure?: "auto" | "direct" | "proxy" | "search" | undefined;
logLevel?: "alert" | "critical" | "debug" | "emergency" | "error" | "info" | "notice" | "warning" | undefined;
}> | undefined;
}>;
/**
* Validate a single extension-declared MCP server.
* Returns a descriptive error string, or null when valid.
*/
export declare function validateMcpServerDeclaration(name: string, raw: unknown): string | null;
export declare const defaultSettings: McpSettings;
export {};
//# sourceMappingURL=config-schema.d.ts.map