diff --git a/src/entrypoints/agentSdkTypes.ts b/src/entrypoints/agentSdkTypes.ts index a2fee8b27..e1662a356 100644 --- a/src/entrypoints/agentSdkTypes.ts +++ b/src/entrypoints/agentSdkTypes.ts @@ -35,7 +35,6 @@ export * from './sdk/toolTypes.js' // ============================================================================ import type { - SDKMessage, SDKResultMessage, SDKSessionInfo, SDKUserMessage, @@ -306,144 +305,6 @@ export type CronJitterConfig = { 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 - /** - * 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 `/.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 - controlRequests(): AsyncGenerator - permissionResponses(): AsyncGenerator - onStateChange( - cb: ( - state: 'ready' | 'connected' | 'reconnecting' | 'failed', - detail?: string, - ) => void, - ): void - teardown(): Promise -} - -/** - * 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 { - throw new Error('not implemented') -} - /** 会话钩子事件名(与 `HOOK_EVENTS` / settings schema 一致)。 */ export type HookEvent = (typeof HOOK_EVENTS)[number] // 与 `coreSchemas.HOOK_EVENTS` 逐项对应