MCPcopy
hub / github.com/continuedev/continue / unrollBlocks

Function unrollBlocks

packages/config-yaml/src/load/unroll.ts:367–684  ·  view source on GitHub ↗
(
  assistant: ConfigYaml,
  registry: Registry,
  injectBlocks: PackageIdentifier[] | undefined,
  allowlistedBlocks?: PackageSlug[],
  blocklistedBlocks?: PackageSlug[],
  injectRequestOptions?: RequestOptions,
)

Source from the content-addressed store, hash-verified

365}
366
367export async function unrollBlocks(
368 assistant: ConfigYaml,
369 registry: Registry,
370 injectBlocks: PackageIdentifier[] | undefined,
371 allowlistedBlocks?: PackageSlug[],
372 blocklistedBlocks?: PackageSlug[],
373 injectRequestOptions?: RequestOptions,
374): Promise<ConfigResult<AssistantUnrolled>> {
375 const errors: ConfigValidationError[] = [];
376
377 const unrolledAssistant: AssistantUnrolled = {
378 name: assistant.name,
379 version: assistant.version,
380 requestOptions: assistant.requestOptions,
381 };
382
383 if (injectRequestOptions) {
384 unrolledAssistant.requestOptions = mergeConfigYamlRequestOptions(
385 assistant.requestOptions,
386 injectRequestOptions,
387 );
388 } else {
389 unrolledAssistant.requestOptions = assistant.requestOptions;
390 }
391
392 const sections: (keyof Omit<
393 ConfigYaml,
394 | "name"
395 | "version"
396 | "rules"
397 | "schema"
398 | "metadata"
399 | "env"
400 | "requestOptions"
401 >)[] = ["models", "context", "data", "mcpServers", "prompts", "docs"];
402
403 // Process all sections in parallel
404 const sectionPromises = sections.map(async (section) => {
405 if (!assistant[section]) {
406 return { section, blocks: null };
407 }
408
409 // Process all blocks in this section in parallel
410 const blockPromises = assistant[section].map(
411 async (unrolledBlock, index) => {
412 // "uses/with" block
413 if ("uses" in unrolledBlock) {
414 try {
415 const blockIdentifier = decodePackageIdentifier(unrolledBlock.uses);
416
417 if (
418 !isPackageAllowed(
419 blockIdentifier,
420 allowlistedBlocks,
421 blocklistedBlocks,
422 )
423 ) {
424 throw new Error(

Callers 2

Calls 15

isDuplicatedMethod · 0.95
decodePackageIdentifierFunction · 0.85
isPackageAllowedFunction · 0.85
encodePackageSlugFunction · 0.85
encodePackageIdentifierFunction · 0.85
resolveBlockFunction · 0.85
mergeOverridesFunction · 0.85
replaceInputsWithSecretsFunction · 0.85
renderTemplateDataFunction · 0.85
extractFQSNMapFunction · 0.85

Tested by

no test coverage detected