diff --git a/src/cli/program/register.agent.ts b/src/cli/program/register.agent.ts index 0928892a927..48bb5995c15 100644 --- a/src/cli/program/register.agent.ts +++ b/src/cli/program/register.agent.ts @@ -16,6 +16,12 @@ type AgentsIdentityModule = typeof import("../../commands/agents.commands.identi type AgentsListModule = typeof import("../../commands/agents.commands.list.js"); type GlobalStateModule = typeof import("../../global-state.js"); +let agentsBindModulePromise: Promise | undefined; + +function loadAgentsBindModule(): Promise { + return (agentsBindModulePromise ??= import("../../commands/agents.commands.bind.js")); +} + async function loadAgentCliCommand(): Promise { return (await import("../../commands/agent-via-gateway.js")).agentCliCommand; } @@ -25,15 +31,15 @@ async function loadAgentsAddCommand(): Promise { - return (await import("../../commands/agents.commands.bind.js")).agentsBindCommand; + return (await loadAgentsBindModule()).agentsBindCommand; } async function loadAgentsBindingsCommand(): Promise { - return (await import("../../commands/agents.commands.bind.js")).agentsBindingsCommand; + return (await loadAgentsBindModule()).agentsBindingsCommand; } async function loadAgentsUnbindCommand(): Promise { - return (await import("../../commands/agents.commands.bind.js")).agentsUnbindCommand; + return (await loadAgentsBindModule()).agentsUnbindCommand; } async function loadAgentsDeleteCommand(): Promise {