I've been creating an interactive fiction game in javascript that uses an entity component system as described here. The problem I've encountered is in developing the AI system for the game. Ideally, I'd like to use Goal Oriented Action Planning (GOAP) for the AI. Unfortunately, this seems to be at odds with using an ECS, largely because the state pattern doesn't seem to work with such entity frameworks.
Here's a simple example of a series of actions that might be taken to achieve the goal of answering a phone within the game.
Goal: answer the phone when it rings
Walk to desk -> sit on chair -> pick up phone
The route taken to answering the phone might end up differing based on the presence of numerous other preconditions. Maybe there's an obstacle in the way, or perhaps the actor no longer has a chair to sit on. In addition to this, the actor may be given other priorities in a queue.
At the moment, even simple goals are causing headaches with a lot of conditional checks.
I'm wondering, it it possible to implement something like GOAP within such a game, and how would I go about accomplishing this? Or should I give up on using GOAP for some alternative AI system?