All files / src/sdk/runtimes index.ts

100% Statements 8/8
100% Branches 5/5
100% Functions 2/2
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54        27x                                                 20x 20x 1x   19x                           2x 1x     1x    
import { claudeRuntime } from './claude.js';
import { piRuntime } from './pi.js';
import type { Runtime, RuntimeName } from './types.js';
 
const RUNTIMES: Partial<Record<RuntimeName, Runtime>> = {
  claude: claudeRuntime,
  pi: piRuntime,
};
 
export { claudeRuntime } from './claude.js';
export { piRuntime } from './pi.js';
export type {
  AuxiliaryRunRequest,
  AuxiliaryRunResult,
  AuxiliaryTask,
  AuxiliaryTool,
  Runtime,
  RuntimeName,
  SynthesisRunRequest,
  SynthesisTask,
  SkillRunOptions,
  SkillRunRequest,
  SkillRunResponse,
  SkillRunResult,
  SkillRunStatus,
} from './types.js';
 
/** Return the runtime adapter for model-backed execution. */
export function getRuntime(name: RuntimeName = 'pi'): Runtime {
  const runtime = RUNTIMES[name];
  if (!runtime) {
    throw new Error(`Unsupported runtime: ${name}`);
  }
  return runtime;
}
 
export interface RuntimeProviderOptionsInput {
  pathToClaudeCodeExecutable?: string;
}
 
/**
 * Build provider-specific runtime options at the runtime boundary.
 */
export function getRuntimeProviderOptions(
  name: RuntimeName,
  options: RuntimeProviderOptionsInput
): unknown {
  if (name === 'claude') {
    return { pathToClaudeCodeExecutable: options.pathToClaudeCodeExecutable };
  }
 
  return undefined;
}