@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
32 lines • 917 B
JavaScript
let loaded;
let loading;
/**
* 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 function loadClaudeAgentSdk() {
if (loaded)
return Promise.resolve(loaded);
loading ??= import("@anthropic-ai/claude-agent-sdk")
.then((module) => {
loaded = {
query: module.query,
createSdkMcpServer: module.createSdkMcpServer,
getSessionMessages: module.getSessionMessages,
resolveSettings: module.resolveSettings,
};
return loaded;
})
.finally(() => {
loading = undefined;
});
return loading;
}
/**
* The loaded SDK, or `undefined` when nothing has awaited
* {@link loadClaudeAgentSdk} yet.
*/
export function loadedClaudeAgentSdk() {
return loaded;
}
//# sourceMappingURL=sdk-boundary.lazy.js.map