mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-20 15:25:50 +00:00
移除运行时函数体仅为 throw new Error 或 placeholder 的 stub: - createSdkMcpToolDefinition、createSdkMcpServer - query 函数重载与实现 - unstable_v2_* 系列函数 - session 操作 stub(getSessionMessages/listSessions/getSessionInfo/renameSession/tagSession/forkSession) - AbortError 类 保留所有 export type 重导出和类型别名(仍是公共类型面)。 Co-Authored-By: glm-5.2 <zai-org@claude-code-best.win>
111 lines
3.2 KiB
TypeScript
111 lines
3.2 KiB
TypeScript
/**
|
|
* Main entrypoint for Claude Code Agent SDK types.
|
|
*
|
|
* This file re-exports the public SDK API from:
|
|
* - sdk/coreTypes.ts - Common serializable types (messages, configs)
|
|
* - sdk/runtimeTypes.ts - Non-serializable types (callbacks, interfaces)
|
|
*
|
|
* SDK builders who need control protocol types should import from
|
|
* sdk/controlTypes.ts directly.
|
|
*/
|
|
|
|
import type {
|
|
CallToolResult,
|
|
ToolAnnotations,
|
|
} from '@modelcontextprotocol/sdk/types.js'
|
|
|
|
// Control protocol types for SDK builders (bridge subpath consumers)
|
|
/** @alpha */
|
|
export type {
|
|
SDKControlRequest,
|
|
SDKControlResponse,
|
|
} from './sdk/controlTypes.js'
|
|
// Re-export core types (common serializable types)
|
|
export * from './sdk/coreTypes.js'
|
|
// Re-export runtime types (callbacks, interfaces with methods)
|
|
export * from './sdk/runtimeTypes.js'
|
|
|
|
// Re-export settings types (generated from settings JSON schema)
|
|
export type { Settings } from './sdk/settingsTypes.generated.js'
|
|
// Re-export tool types (all marked @internal until SDK API stabilizes)
|
|
export * from './sdk/toolTypes.js'
|
|
|
|
// ============================================================================
|
|
// Functions
|
|
// ============================================================================
|
|
|
|
import type {
|
|
SDKResultMessage,
|
|
SDKSessionInfo,
|
|
SDKUserMessage,
|
|
} from './sdk/coreTypes.js'
|
|
// Import types needed for function signatures
|
|
import type {
|
|
AnyZodRawShape,
|
|
ForkSessionOptions,
|
|
ForkSessionResult,
|
|
GetSessionInfoOptions,
|
|
GetSessionMessagesOptions,
|
|
InferShape,
|
|
InternalOptions,
|
|
InternalQuery,
|
|
ListSessionsOptions,
|
|
McpSdkServerConfigWithInstance,
|
|
Options,
|
|
Query,
|
|
SDKSession,
|
|
SDKSessionOptions,
|
|
SdkMcpToolDefinition,
|
|
SessionMessage,
|
|
SessionMutationOptions,
|
|
} from './sdk/runtimeTypes.js'
|
|
// 与 settings / hooks schema 共用的钩子事件与 SessionEnd 退出原因字面量表
|
|
import { EXIT_REASONS, HOOK_EVENTS } from './sdk/coreSchemas.js'
|
|
|
|
export type {
|
|
ListSessionsOptions,
|
|
GetSessionInfoOptions,
|
|
SessionMutationOptions,
|
|
ForkSessionOptions,
|
|
ForkSessionResult,
|
|
SDKSessionInfo,
|
|
}
|
|
|
|
// ============================================================================
|
|
// Assistant daemon primitives (internal)
|
|
// ============================================================================
|
|
|
|
/**
|
|
* A scheduled task from `<dir>/.claude/scheduled_tasks.json`.
|
|
* @internal
|
|
*/
|
|
export type CronTask = {
|
|
id: string
|
|
cron: string
|
|
prompt: string
|
|
createdAt: number
|
|
recurring?: boolean
|
|
}
|
|
|
|
/**
|
|
* Cron scheduler tuning knobs (jitter + expiry). Sourced at runtime from the
|
|
* `tengu_kairos_cron_config` GrowthBook config in CLI sessions; daemon hosts
|
|
* pass this through `watchScheduledTasks({ getJitterConfig })` to get the
|
|
* same tuning.
|
|
* @internal
|
|
*/
|
|
export type CronJitterConfig = {
|
|
recurringFrac: number
|
|
recurringCapMs: number
|
|
oneShotMaxMs: number
|
|
oneShotFloorMs: number
|
|
oneShotMinuteMod: number
|
|
recurringMaxAgeMs: number
|
|
}
|
|
|
|
/** 会话钩子事件名(与 `HOOK_EVENTS` / settings schema 一致)。 */
|
|
export type HookEvent = (typeof HOOK_EVENTS)[number] // 与 `coreSchemas.HOOK_EVENTS` 逐项对应
|
|
|
|
/** `SessionEnd` 钩子等使用的进程退出原因枚举。 */
|
|
export type ExitReason = (typeof EXIT_REASONS)[number] // 与 `coreSchemas.EXIT_REASONS` 逐项对应
|