mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-22 16:25:51 +00:00
chore: 删除 agentSdkTypes 中三个 not-implemented stub
移除 watchScheduledTasks、buildMissedTaskNotification、connectRemoteControl 三个 stub 函数(函数体仅 throw new Error('not implemented')),以及仅被这些 stub 引用的孤儿类型(ScheduledTasksHandle、ConnectRemoteControlOptions、RemoteControlHandle、InboundPrompt 等)。
全仓零外部引用。buildMissedTaskNotification 在 src/utils/cronScheduler.ts 有真实可用实现,未受影响。
Co-Authored-By: glm-5.2 <zai-org@claude-code-best.win>
This commit is contained in:
@@ -35,7 +35,6 @@ export * from './sdk/toolTypes.js'
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
SDKMessage,
|
|
||||||
SDKResultMessage,
|
SDKResultMessage,
|
||||||
SDKSessionInfo,
|
SDKSessionInfo,
|
||||||
SDKUserMessage,
|
SDKUserMessage,
|
||||||
@@ -306,144 +305,6 @@ export type CronJitterConfig = {
|
|||||||
recurringMaxAgeMs: number
|
recurringMaxAgeMs: number
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Event yielded by `watchScheduledTasks()`.
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
export type ScheduledTaskEvent =
|
|
||||||
| { type: 'fire'; task: CronTask }
|
|
||||||
| { type: 'missed'; tasks: CronTask[] }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle returned by `watchScheduledTasks()`.
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
export type ScheduledTasksHandle = {
|
|
||||||
/** Async stream of fire/missed events. Drain with `for await`. */
|
|
||||||
events(): AsyncGenerator<ScheduledTaskEvent>
|
|
||||||
/**
|
|
||||||
* Epoch ms of the soonest scheduled fire across all loaded tasks, or null
|
|
||||||
* if nothing is scheduled. Useful for deciding whether to tear down an
|
|
||||||
* idle agent subprocess or keep it warm for an imminent fire.
|
|
||||||
*/
|
|
||||||
getNextFireTime(): number | null
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Watch `<dir>/.claude/scheduled_tasks.json` and yield events as tasks fire.
|
|
||||||
*
|
|
||||||
* Acquires the per-directory scheduler lock (PID-based liveness) so a REPL
|
|
||||||
* session in the same dir won't double-fire. Releases the lock and closes
|
|
||||||
* the file watcher when the signal aborts.
|
|
||||||
*
|
|
||||||
* - `fire` — a task whose cron schedule was met. One-shot tasks are already
|
|
||||||
* deleted from the file when this yields; recurring tasks are rescheduled
|
|
||||||
* (or deleted if aged out).
|
|
||||||
* - `missed` — one-shot tasks whose window passed while the daemon was down.
|
|
||||||
* Yielded once on initial load; a background delete removes them from the
|
|
||||||
* file shortly after.
|
|
||||||
*
|
|
||||||
* Intended for daemon architectures that own the scheduler externally and
|
|
||||||
* spawn the agent via `query()`; the agent subprocess (`-p` mode) does not
|
|
||||||
* run its own scheduler.
|
|
||||||
*
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
export function watchScheduledTasks(_opts: {
|
|
||||||
dir: string
|
|
||||||
signal: AbortSignal
|
|
||||||
getJitterConfig?: () => CronJitterConfig
|
|
||||||
}): ScheduledTasksHandle {
|
|
||||||
throw new Error('not implemented')
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Format missed one-shot tasks into a prompt that asks the model to confirm
|
|
||||||
* with the user (via AskUserQuestion) before executing.
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
export function buildMissedTaskNotification(_missed: CronTask[]): string {
|
|
||||||
throw new Error('not implemented')
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A user message typed on claude.ai, extracted from the bridge WS.
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
export type InboundPrompt = {
|
|
||||||
content: string | unknown[]
|
|
||||||
uuid?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Options for connectRemoteControl.
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
export type ConnectRemoteControlOptions = {
|
|
||||||
dir: string
|
|
||||||
name?: string
|
|
||||||
workerType?: string
|
|
||||||
branch?: string
|
|
||||||
gitRepoUrl?: string | null
|
|
||||||
getAccessToken: () => string | undefined
|
|
||||||
baseUrl: string
|
|
||||||
orgUUID: string
|
|
||||||
model: string
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle returned by connectRemoteControl. Write query() yields in,
|
|
||||||
* read inbound prompts out. See src/assistant/daemonBridge.ts for full
|
|
||||||
* field documentation.
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
export type RemoteControlHandle = {
|
|
||||||
sessionUrl: string
|
|
||||||
environmentId: string
|
|
||||||
bridgeSessionId: string
|
|
||||||
write(msg: SDKMessage): void
|
|
||||||
sendResult(): void
|
|
||||||
sendControlRequest(req: unknown): void
|
|
||||||
sendControlResponse(res: unknown): void
|
|
||||||
sendControlCancelRequest(requestId: string): void
|
|
||||||
inboundPrompts(): AsyncGenerator<InboundPrompt>
|
|
||||||
controlRequests(): AsyncGenerator<unknown>
|
|
||||||
permissionResponses(): AsyncGenerator<unknown>
|
|
||||||
onStateChange(
|
|
||||||
cb: (
|
|
||||||
state: 'ready' | 'connected' | 'reconnecting' | 'failed',
|
|
||||||
detail?: string,
|
|
||||||
) => void,
|
|
||||||
): void
|
|
||||||
teardown(): Promise<void>
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hold a claude.ai remote-control bridge connection from a daemon process.
|
|
||||||
*
|
|
||||||
* The daemon owns the WebSocket in the PARENT process — if the agent
|
|
||||||
* subprocess (spawned via `query()`) crashes, the daemon respawns it while
|
|
||||||
* claude.ai keeps the same session. Contrast with `query.enableRemoteControl`
|
|
||||||
* which puts the WS in the CHILD process (dies with the agent).
|
|
||||||
*
|
|
||||||
* Pipe `query()` yields through `write()` + `sendResult()`. Read
|
|
||||||
* `inboundPrompts()` (user typed on claude.ai) into `query()`'s input
|
|
||||||
* stream. Handle `controlRequests()` locally (interrupt → abort, set_model
|
|
||||||
* → reconfigure).
|
|
||||||
*
|
|
||||||
* Skips the `tengu_ccr_bridge` gate and policy-limits check — @internal
|
|
||||||
* caller is pre-entitled. OAuth is still required (env var or keychain).
|
|
||||||
*
|
|
||||||
* Returns null on no-OAuth or registration failure.
|
|
||||||
*
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
export async function connectRemoteControl(
|
|
||||||
_opts: ConnectRemoteControlOptions,
|
|
||||||
): Promise<RemoteControlHandle | null> {
|
|
||||||
throw new Error('not implemented')
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 会话钩子事件名(与 `HOOK_EVENTS` / settings schema 一致)。 */
|
/** 会话钩子事件名(与 `HOOK_EVENTS` / settings schema 一致)。 */
|
||||||
export type HookEvent = (typeof HOOK_EVENTS)[number] // 与 `coreSchemas.HOOK_EVENTS` 逐项对应
|
export type HookEvent = (typeof HOOK_EVENTS)[number] // 与 `coreSchemas.HOOK_EVENTS` 逐项对应
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user