agent-contracts 0.22.6 → 0.22.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -51063,24 +51063,39 @@ function mergeDsl(base, project) {
51063
51063
 
51064
51064
  // src/resolver/resolve.ts
51065
51065
  import { dirname as dirname3, resolve as resolvePath } from "path";
51066
- async function resolve4(projectDirOrFile) {
51067
- const absPath = resolvePath(projectDirOrFile);
51068
- const projectResult = await loadDsl(absPath);
51069
- const projectData = projectResult.data;
51070
- const extendsValue = projectData["extends"];
51066
+ async function resolveExtendsChain(data, filePath, seen) {
51067
+ const extendsValue = data["extends"];
51071
51068
  if (typeof extendsValue !== "string") {
51072
- return {
51073
- data: projectData,
51074
- projectPath: projectResult.filePath
51075
- };
51069
+ return { data, basePaths: [] };
51076
51070
  }
51077
- const projectDir = dirname3(projectResult.filePath);
51071
+ const projectDir = dirname3(filePath);
51078
51072
  const baseResult = await resolveBase(extendsValue, projectDir);
51079
- const merged = mergeDsl(baseResult.data, projectData);
51073
+ const basePath = baseResult.filePath;
51074
+ if (seen.has(basePath)) {
51075
+ throw new BaseResolveError(
51076
+ `Circular extends detected: ${basePath}`
51077
+ );
51078
+ }
51079
+ seen.add(basePath);
51080
+ const { data: resolvedBase, basePaths: ancestorPaths } = await resolveExtendsChain(baseResult.data, basePath, seen);
51081
+ const merged = mergeDsl(resolvedBase, data);
51080
51082
  return {
51081
51083
  data: merged,
51084
+ basePaths: [...ancestorPaths, basePath]
51085
+ };
51086
+ }
51087
+ async function resolve4(projectDirOrFile) {
51088
+ const absPath = resolvePath(projectDirOrFile);
51089
+ const projectResult = await loadDsl(absPath);
51090
+ const { data, basePaths } = await resolveExtendsChain(
51091
+ projectResult.data,
51092
+ projectResult.filePath,
51093
+ /* @__PURE__ */ new Set()
51094
+ );
51095
+ return {
51096
+ data,
51082
51097
  projectPath: projectResult.filePath,
51083
- basePath: baseResult.filePath
51098
+ basePaths
51084
51099
  };
51085
51100
  }
51086
51101