MCPcopy Create free account
hub / github.com/apache/maka / createRuntimeHostRunContext

Function createRuntimeHostRunContext

packages/cli/src/runtime-host-run-command.ts:135–182  ·  view source on GitHub ↗
(
  connection: RuntimeHostConnection,
  catalog: RuntimeHostCliConnectionContext['catalog'],
  input: Parameters<MakaRunDeps['createContext']>[0],
  overrides: Partial<RuntimeHostRunContextDeps> = {},
)

Source from the content-addressed store, hash-verified

133}
134
135export function createRuntimeHostRunContext(
136 connection: RuntimeHostConnection,
137 catalog: RuntimeHostCliConnectionContext['catalog'],
138 input: Parameters<MakaRunDeps['createContext']>[0],
139 overrides: Partial<RuntimeHostRunContextDeps> = {},
140): MakaRunContext {
141 const target = resolveRuntimeHostCliTarget(catalog, {
142 ...(input.requestedConnectionSlug ? { connectionSlug: input.requestedConnectionSlug } : {}),
143 ...(input.requestedModel ? { model: input.requestedModel } : {}),
144 });
145 const contextDeps = {
146 createDriver: createRuntimeHostMakaSessionDriver,
147 ...overrides,
148 };
149 const driver = contextDeps.createDriver({
150 connection,
151 cwd: input.cwd,
152 llmConnectionSlug: target.connection.slug,
153 model: target.model,
154 permissionMode: 'ask',
155 executionLocation:
156 !input.hostProfileId || input.hostProfileId === 'local'
157 ? { kind: 'client_path' }
158 : { kind: 'host' },
159 ...(input.projectId ? { workspace: { kind: 'project', projectId: input.projectId } } : {}),
160 });
161 const runtime = new RuntimeHostRunRuntime(
162 connection,
163 driver,
164 input.runOutcomeObserver,
165 input.enableAgentGraph === true,
166 input.sessionCwdOverride,
167 input.maxSteps,
168 );
169 return {
170 runtime,
171 target: { connection: { slug: target.connection.slug }, model: target.model },
172 ...(input.enableAgentGraph
173 ? {
174 agentGraph: {
175 reserveActivity: () => ({ release: () => {} }),
176 waitForCompletion: (sessionId: string) => runtime.waitForGraphCompletion(sessionId),
177 },
178 }
179 : {}),
180 close: async () => runtime.close(),
181 };
182}
183
184async function prepareRuntimeHostRunInput(
185 connection: RuntimeHostConnection,

Callers 3

createFunction · 0.85

Calls 4

closeMethod · 0.95
createDriverMethod · 0.80

Tested by 1

createFunction · 0.68