feat: 完成stub

This commit is contained in:
claude-code-best
2026-03-31 20:40:16 +08:00
parent c26d614fb2
commit bd756cc369
905 changed files with 3996 additions and 375 deletions

View File

@@ -0,0 +1,40 @@
// Re-export runtime values + type stubs for bundling
// Types are erased at runtime, but we need the value exports
export const HOOK_EVENTS = [
'PreToolUse',
'PostToolUse',
'PostToolUseFailure',
'Notification',
'UserPromptSubmit',
'SessionStart',
'SessionEnd',
'Stop',
'StopFailure',
'SubagentStart',
'SubagentStop',
'PreCompact',
'PostCompact',
'PermissionRequest',
'PermissionDenied',
'Setup',
'TeammateIdle',
'TaskCreated',
'TaskCompleted',
'Elicitation',
'ElicitationResult',
'ConfigChange',
'WorktreeCreate',
'WorktreeRemove',
'InstructionsLoaded',
'CwdChanged',
'FileChanged',
]
export const EXIT_REASONS = [
'clear',
'resume',
'logout',
'prompt_input_exit',
'other',
]

View File

@@ -441,3 +441,5 @@ export async function connectRemoteControl(
): Promise<RemoteControlHandle | null> {
throw new Error('not implemented')
}
export type HookEvent = any;
export type ExitReason = any;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
// Auto-generated type stub — replace with real implementation
export type StdoutMessage = any;
export type SDKControlInitializeRequest = any;
export type SDKControlInitializeResponse = any;
export type SDKControlMcpSetServersResponse = any;
export type SDKControlReloadPluginsResponse = any;
export type StdinMessage = any;
export type SDKPartialAssistantMessage = any;

View File

@@ -0,0 +1,16 @@
/**
* Stub: SDK Control Types (not yet published in open-source).
* Used by bridge/transport layer for the control protocol.
*/
export type SDKControlRequest = { type: string; [key: string]: unknown }
export type SDKControlResponse = { type: string; [key: string]: unknown }
export type StdoutMessage = any;
export type SDKControlInitializeRequest = any;
export type SDKControlInitializeResponse = any;
export type SDKControlMcpSetServersResponse = any;
export type SDKControlReloadPluginsResponse = any;
export type StdinMessage = any;
export type SDKPartialAssistantMessage = any;
export type SDKControlPermissionRequest = any;
export type SDKControlCancelRequest = any;
export type SDKControlRequestInner = any;

View File

@@ -0,0 +1,144 @@
/**
* Stub: Generated SDK core types.
*
* In the full build, this is auto-generated from coreSchemas.ts Zod schemas.
* Here we provide typed stubs for all the types referenced throughout the codebase.
*/
// Usage & Model
export type ModelUsage = {
inputTokens: number
outputTokens: number
cacheReadInputTokens: number
cacheCreationInputTokens: number
webSearchRequests: number
costUSD: number
contextWindow: number
maxOutputTokens: number
}
export type ApiKeySource = string
export type ModelInfo = {
name: string
displayName?: string
[key: string]: unknown
}
// MCP
export type McpServerConfigForProcessTransport = {
command: string
args: string[]
type?: "stdio"
env?: Record<string, string>
} & { scope: string; pluginSource?: string }
export type McpServerStatus = {
name: string
status: "connected" | "disconnected" | "error"
[key: string]: unknown
}
// Permissions
export type PermissionMode = string
export type PermissionResult =
| { behavior: "allow" }
| { behavior: "deny"; message?: string }
export type PermissionUpdate = {
path: string
permission: string
[key: string]: unknown
}
// Rewind
export type RewindFilesResult = {
filesChanged: string[]
[key: string]: unknown
}
// Account
export type AccountInfo = Record<string, unknown>
// Hook input types
export type HookInput = { hook_event_name: string; [key: string]: unknown }
export type HookJSONOutput = Record<string, unknown>
export type AsyncHookJSONOutput = Record<string, unknown>
export type SyncHookJSONOutput = Record<string, unknown>
export type PreToolUseHookInput = HookInput & { tool_name: string }
export type PostToolUseHookInput = HookInput & { tool_name: string }
export type PostToolUseFailureHookInput = HookInput & { tool_name: string }
export type PermissionRequestHookInput = HookInput & { tool_name: string }
export type PermissionDeniedHookInput = HookInput
export type NotificationHookInput = HookInput & { message: string }
export type UserPromptSubmitHookInput = HookInput & { prompt: string }
export type SessionStartHookInput = HookInput
export type SessionEndHookInput = HookInput & { exit_reason: string }
export type SetupHookInput = HookInput
export type StopHookInput = HookInput
export type StopFailureHookInput = HookInput
export type SubagentStartHookInput = HookInput
export type SubagentStopHookInput = HookInput
export type PreCompactHookInput = HookInput
export type PostCompactHookInput = HookInput
export type TeammateIdleHookInput = HookInput
export type TaskCreatedHookInput = HookInput
export type TaskCompletedHookInput = HookInput
export type ElicitationHookInput = HookInput
export type ElicitationResultHookInput = HookInput
export type ConfigChangeHookInput = HookInput
export type InstructionsLoadedHookInput = HookInput
export type CwdChangedHookInput = HookInput & { cwd: string }
export type FileChangedHookInput = HookInput & { path: string }
// SDK Message types
export type SDKMessage = { type: string; [key: string]: unknown }
export type SDKUserMessage = { type: "user"; content: unknown; uuid: string; [key: string]: unknown }
export type SDKUserMessageReplay = SDKUserMessage
export type SDKAssistantMessage = { type: "assistant"; content: unknown; [key: string]: unknown }
export type SDKAssistantMessageError = { type: "assistant_error"; error: unknown; [key: string]: unknown }
export type SDKPartialAssistantMessage = { type: "partial_assistant"; [key: string]: unknown }
export type SDKResultMessage = { type: "result"; [key: string]: unknown }
export type SDKResultSuccess = { type: "result_success"; [key: string]: unknown }
export type SDKSystemMessage = { type: "system"; [key: string]: unknown }
export type SDKStatusMessage = { type: "status"; [key: string]: unknown }
export type SDKToolProgressMessage = { type: "tool_progress"; [key: string]: unknown }
export type SDKCompactBoundaryMessage = { type: "compact_boundary"; [key: string]: unknown }
export type SDKPermissionDenial = { type: "permission_denial"; [key: string]: unknown }
export type SDKRateLimitInfo = { type: "rate_limit"; [key: string]: unknown }
export type SDKStatus = "active" | "idle" | "error" | string
export type SDKSessionInfo = {
sessionId: string
summary?: string
[key: string]: unknown
}
// Other referenced types
export type OutputFormat = { type: "json_schema"; schema: Record<string, unknown> }
export type ConfigScope = string
export type SdkBeta = string
export type ThinkingConfig = { type: string; [key: string]: unknown }
export type McpStdioServerConfig = { command: string; args: string[]; type: "stdio"; env?: Record<string, string> }
export type McpSSEServerConfig = { type: "sse"; url: string; [key: string]: unknown }
export type McpHttpServerConfig = { type: "http"; url: string; [key: string]: unknown }
export type McpSdkServerConfig = { type: "sdk"; [key: string]: unknown }
export type McpClaudeAIProxyServerConfig = { type: "claudeai-proxy"; [key: string]: unknown }
export type McpServerStatusConfig = { [key: string]: unknown }
export type McpSetServersResult = { [key: string]: unknown }
export type PermissionUpdateDestination = string
export type PermissionBehavior = string
export type PermissionRuleValue = string
export type PermissionDecisionClassification = string
export type PromptRequestOption = { [key: string]: unknown }
export type PromptRequest = { [key: string]: unknown }
export type PromptResponse = { [key: string]: unknown }
export type SlashCommand = { [key: string]: unknown }
export type AgentInfo = { [key: string]: unknown }
export type AgentMcpServerSpec = { [key: string]: unknown }
export type AgentDefinition = { [key: string]: unknown }
export type SettingSource = { [key: string]: unknown }
export type SdkPluginConfig = { [key: string]: unknown }
export type FastModeState = { [key: string]: unknown }

View File

@@ -0,0 +1,2 @@
// Auto-generated type stub — replace with real implementation
export type EffortLevel = any;

View File

@@ -0,0 +1,63 @@
/**
* Stub: SDK Runtime Types (not yet published in open-source).
* Non-serializable types: callbacks, interfaces with methods.
*/
export type AnyZodRawShape = Record<string, any>
export type InferShape<T extends AnyZodRawShape> = { [K in keyof T]: any }
export type ForkSessionOptions = { dir?: string; upToMessageId?: string; title?: string }
export type ForkSessionResult = { sessionId: string }
export type GetSessionInfoOptions = { dir?: string }
export type GetSessionMessagesOptions = { dir?: string; limit?: number; offset?: number; includeSystemMessages?: boolean }
export type ListSessionsOptions = { dir?: string; limit?: number; offset?: number }
export type SessionMutationOptions = { dir?: string }
export type SessionMessage = { role: string; content: unknown; [key: string]: unknown }
export interface SDKSession {
sessionId: string
prompt(input: string | AsyncIterable<unknown>): Promise<unknown>
abort(): void
[key: string]: unknown
}
export type SDKSessionOptions = {
model?: string
systemPrompt?: string
[key: string]: unknown
}
export interface SdkMcpToolDefinition<T extends AnyZodRawShape = AnyZodRawShape> {
name: string
description: string
inputSchema: T
handler: (args: InferShape<T>, extra: unknown) => Promise<unknown>
[key: string]: unknown
}
export type McpSdkServerConfigWithInstance = {
name: string
version?: string
tools?: SdkMcpToolDefinition[]
[key: string]: unknown
}
export interface Options {
model?: string
systemPrompt?: string
[key: string]: unknown
}
export interface InternalOptions extends Options {
[key: string]: unknown
}
export interface Query {
[Symbol.asyncIterator](): AsyncIterator<unknown>
[key: string]: unknown
}
export interface InternalQuery extends Query {
[key: string]: unknown
}
export type EffortLevel = any;

View File

@@ -0,0 +1,10 @@
/**
* Stub: SDK Utility Types.
*/
export type NonNullableUsage = {
inputTokens: number
outputTokens: number
cacheReadInputTokens: number
cacheCreationInputTokens: number
[key: string]: unknown
}

View File

@@ -0,0 +1,4 @@
/**
* Stub: SDK Settings Types (generated from settings JSON schema).
*/
export type Settings = Record<string, unknown>

View File

@@ -0,0 +1,9 @@
/**
* Stub: SDK Tool Types.
*/
export type SdkToolDefinition = {
name: string
description: string
inputSchema: Record<string, unknown>
[key: string]: unknown
}

View File

@@ -0,0 +1,2 @@
// Auto-generated type stub — replace with real implementation
export type getIsNonInteractiveSession = any;

View File

@@ -0,0 +1,2 @@
// Auto-generated type stub — replace with real implementation
export type getDefaultAppState = any;