Taskweft.Plans (taskweft_plans v0.3.0-dev.3)

Copy Markdown View Source

Bundled RECTGTN HTN planning domains and problems, embedded into this module at compile time.

taskweft_plans ships priv/plans/{domains,problems}/*.jsonld (plus a handful of *.notes.json siblings). Prior to this module, callers (e.g. taskweft_mcp's resource handlers) read those files off disk at runtime via :code.priv_dir(:taskweft_plans) — fragile under some release/ container packaging setups, where a dependency's priv/ can end up missing from the assembled release even though it's listed in package: files: (the same failure class taskweft/taskweft's Taskweft.JSONLD.Loader documents for its own bundled JSON schema: a path that resolves correctly under mix run but points at a directory that never exists in the runtime image).

Baking file content into the .beam at compile time sidesteps the packaging question entirely — the data travels with the module no matter how the release is assembled, and callers no longer need :code.priv_dir/1 at all. @external_resource on every bundled file makes mix compile recompile this module whenever a plan file changes, so the dev workflow (edit .jsonld, mix test) still works exactly as before.

Every getter returns the exact raw file bytes (not a decoded/re-encoded term) — this module has no JSON dependency, and byte-for-byte content is what MCP resource reads have always served.

Summary

Functions

Raw JSON-LD text for a bundled domain file, e.g. "blocks_world.jsonld".

Same as domain/1, raising if file is not bundled.

File names of every bundled domain, e.g. ["blocks_world.jsonld", ...].

File names of every bundled problem's .notes.json sibling.

File names of every bundled problem, e.g. ["blocks_world_1a.jsonld", ...].

Raw JSON-LD text for a bundled problem file, e.g. "blocks_world_1a.jsonld".

Same as problem/1, raising if file is not bundled.

Raw JSON text for a bundled problem's sibling .notes.json file (human/ LLM-facing status metadata, not part of the planning document itself), e.g. "work_queue.notes.json".

Functions

domain(file)

@spec domain(String.t()) :: {:ok, String.t()} | :error

Raw JSON-LD text for a bundled domain file, e.g. "blocks_world.jsonld".

domain!(file)

@spec domain!(String.t()) :: String.t()

Same as domain/1, raising if file is not bundled.

list_domains()

@spec list_domains() :: [String.t()]

File names of every bundled domain, e.g. ["blocks_world.jsonld", ...].

list_problem_notes()

@spec list_problem_notes() :: [String.t()]

File names of every bundled problem's .notes.json sibling.

list_problems()

@spec list_problems() :: [String.t()]

File names of every bundled problem, e.g. ["blocks_world_1a.jsonld", ...].

problem(file)

@spec problem(String.t()) :: {:ok, String.t()} | :error

Raw JSON-LD text for a bundled problem file, e.g. "blocks_world_1a.jsonld".

problem!(file)

@spec problem!(String.t()) :: String.t()

Same as problem/1, raising if file is not bundled.

problem_notes(file)

@spec problem_notes(String.t()) :: {:ok, String.t()} | :error

Raw JSON text for a bundled problem's sibling .notes.json file (human/ LLM-facing status metadata, not part of the planning document itself), e.g. "work_queue.notes.json".