MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / createListHost

Function createListHost

apps/cli/src/commands/cli/list.ts:105–138  ·  view source on GitHub ↗
(options: BaseListOptions, hostOptions: ListHostOptions)

Source from the content-addressed store, hash-verified

103}
104
105async function createListHost(options: BaseListOptions, hostOptions: ListHostOptions): Promise<ExtensionHost> {
106 const workspacePath = resolveWorkspacePath(options.workspace)
107 const extensionPath = resolveExtensionPath(options.extension)
108 const apiKey = options.apiKey || getApiKeyFromEnv("openrouter")
109
110 const extensionHostOptions: ExtensionHostOptions = {
111 mode: "code",
112 reasoningEffort: undefined,
113 user: null,
114 provider: "openrouter",
115 model: openRouterDefaultModelId,
116 apiKey,
117 workspacePath,
118 extensionPath,
119 nonInteractive: true,
120 ephemeral: hostOptions.ephemeral,
121 debug: options.debug ?? false,
122 exitOnComplete: true,
123 exitOnError: false,
124 disableOutput: true,
125 }
126
127 const host = new ExtensionHost(extensionHostOptions)
128
129 await host.activate()
130
131 // Best effort wait; mode/commands requests can still succeed without this.
132 await pWaitFor(() => host.client.isInitialized(), {
133 interval: 25,
134 timeout: 2_000,
135 }).catch(() => undefined)
136
137 return host
138}
139
140/**
141 * Send a request to the extension and wait for a matching response message.

Callers 1

Calls 5

activateMethod · 0.95
resolveExtensionPathFunction · 0.85
getApiKeyFromEnvFunction · 0.85
resolveWorkspacePathFunction · 0.70
isInitializedMethod · 0.45

Tested by

no test coverage detected