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

Function createRuntimeHostActivationContext

packages/cli/src/activation-command.ts:809–853  ·  view source on GitHub ↗
(
  input: MakaActivationContextInput,
)

Source from the content-addressed store, hash-verified

807}
808
809async function createRuntimeHostActivationContext(
810 input: MakaActivationContextInput,
811): Promise<MakaActivationContext> {
812 const connected = await connectRuntimeHostCli({
813 rootPath: input.stateRoot,
814 surface: 'activation',
815 });
816 try {
817 const target = resolveRuntimeHostCliTarget(connected.catalog, {
818 ...(input.requestedConnectionSlug ? { connectionSlug: input.requestedConnectionSlug } : {}),
819 ...(input.requestedModel ? { model: input.requestedModel } : {}),
820 });
821 const runContext = createRuntimeHostRunContext(connected.connection, connected.catalog, {
822 surface: 'activation',
823 workspaceRoot: input.stateRoot,
824 cwd: input.cwd,
825 requestedConnectionSlug: target.connection.slug,
826 requestedModel: target.model,
827 ...(input.sessionCwdOverride ? { sessionCwdOverride: { ...input.sessionCwdOverride } } : {}),
828 ...(input.maxSteps !== undefined ? { maxSteps: input.maxSteps } : {}),
829 ...(input.runOutcomeObserver ? { runOutcomeObserver: input.runOutcomeObserver } : {}),
830 });
831 return {
832 runtime: runContext.runtime,
833 target: {
834 connection: {
835 slug: target.connection.slug,
836 name: target.connection.name,
837 providerType: target.connection.providerType,
838 enabled: target.connection.enabled,
839 defaultModel: target.model,
840 },
841 model: target.model,
842 },
843 cwd: input.cwd,
844 close: async () => {
845 await runContext.close();
846 await connected.close();
847 },
848 };
849 } catch (error) {
850 await connected.close().catch(() => undefined);
851 throw error;
852 }
853}
854
855async function listRuntimeHostActivationSessions(stateRoot: string): Promise<SessionSummary[]> {
856 const connected = await connectRuntimeHostCli({

Callers

nothing calls this directly

Calls 4

connectRuntimeHostCliFunction · 0.85
closeMethod · 0.65

Tested by

no test coverage detected