UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

40 lines • 2.02 kB
/** * Lazy boundary for the Claude Agent SDK runtime module. * * `@anthropic-ai/claude-agent-sdk`'s entrypoint is a ~1.2 MB single-file * bundle that every CLI start parses and evaluates today, even though only the * claude-sdk-oauth streaming lane ever calls into it. This module owns the one * deferred import; `sdk-boundary.ts` keeps the synchronous `getSdkBoundary()` * surface its callers depend on and simply refuses to hand out SDK functions * before {@link loadClaudeAgentSdk} has resolved. * * That split is what keeps the deferral honest: the SDK's `query` and * `createSdkMcpServer` are synchronous, so their call sites cannot await. Every * one of them is reached from an async entry point that awaits this loader * first (the `streamAnthropicSubscription` async body, `reattachSession`, * `verifyRestoredTranscript`), so the module is always resident by the time a * synchronous member is read — and a future call site that forgets to preload * fails loudly and locally instead of silently regressing startup. * * Follows the repository's documented lazy-boundary pattern * (`packages/ai/src/api/*.lazy.ts`); `test/startup-import-graph.test.ts` fails * if a static edge to the SDK reappears. */ import type { createSdkMcpServer, getSessionMessages, query, resolveSettings } from "@anthropic-ai/claude-agent-sdk"; export type ClaudeAgentSdkModule = { query: typeof query; createSdkMcpServer: typeof createSdkMcpServer; getSessionMessages: typeof getSessionMessages; resolveSettings: typeof resolveSettings; }; /** * Loads the SDK once and caches it. Concurrent callers share the in-flight * promise; a failed load is not cached, so a later attempt can retry. */ export declare function loadClaudeAgentSdk(): Promise<ClaudeAgentSdkModule>; /** * The loaded SDK, or `undefined` when nothing has awaited * {@link loadClaudeAgentSdk} yet. */ export declare function loadedClaudeAgentSdk(): ClaudeAgentSdkModule | undefined; //# sourceMappingURL=sdk-boundary.lazy.d.ts.map