Skip to content

Commit

Permalink
Pop out fetchSubSeed from growSubSeed.
Browse files Browse the repository at this point in the history
Part of #20.
  • Loading branch information
jkomoros committed Jul 29, 2023
1 parent 69405bc commit 766bd82
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/grow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,13 @@ import {
randomEmbedding
} from './llm.js';

const growSubSeed = async (parent : Seed, env : Environment, ref : SeedReference) : Promise<Value> => {
const fetchSubSeed = async (parent : Seed, ref : SeedReference) : Promise<Seed> => {
const absoluteRef = makeAbsolute(ref, parent.location);
const seed = await parent.garden.seed(absoluteRef);
return await parent.garden.seed(absoluteRef);
};

const growSubSeed = async (parent : Seed, env : Environment, ref : SeedReference) : Promise<Value> => {
const seed = await fetchSubSeed(parent, ref);
if (seed.private) {
if (seed.location != parent.location) throw new Error(`${seed.id} is a private seed, it cannot be run from seed from a different packet ${parent.id}`);
}
Expand Down

0 comments on commit 766bd82

Please sign in to comment.