Packages

A stateless tool loop over llm_call: dispatch tools, pause for approval or input, resume, and stop at a step budget.

Current section

Files

Jump to
agent_call mix.exs
Raw

mix.exs

defmodule AgentCall.MixProject do
  use Mix.Project

  @source_url "https://github.com/gilbertwong96/agent_call"
  @version "0.2.0"

  def project do
    [
      app: :agent_call,
      version: @version,
      elixir: "~> 1.18",
      elixirc_paths: elixirc_paths(Mix.env()),
      start_permanent: Mix.env() == :prod,
      deps: deps(),
      description:
        "A stateless tool loop over llm_call: dispatch tools, pause for approval or input, resume, and stop at a step budget.",
      package: package(),
      docs: docs(),
      # Test support and the compiled README example are infrastructure, not
      # product code; coverage tracks lib.
      test_coverage: [
        ignore_modules: [
          ~r/^AgentCall\.(Fixtures|JournalStore|TestProvider|TestTools|TestHTTPServer|ThreadStore|Example)/
        ]
      ],
      dialyzer: [
        plt_add_apps: [:ex_unit],
        plt_local_path: "priv/plts",
        plt_core_path: "priv/plts/core"
      ],
      aliases: aliases()
    ]
  end

  # Run "mix help compile.app" to learn about applications.
  def application do
    [
      extra_applications: [:logger]
    ]
  end

  def cli do
    [
      preferred_envs: [ci: :test, "ci.compat": :test, bench: :test]
    ]
  end

  # The README's example is compiled in :dev and :test so it cannot rot; it is
  # not part of the package.
  defp elixirc_paths(:test), do: ["lib", "test/support", "examples"]
  defp elixirc_paths(:dev), do: ["lib", "examples"]
  defp elixirc_paths(_), do: ["lib"]

  # Run "mix help deps" to learn about dependencies.
  defp deps do
    [
      # `~> 0.5.0`, not `~> 0.5`: on a 0.x dependency `~> 0.5` still allows
      # 0.6 through 0.99, and `llm_call` ships breaking 0.x minors (0.4.0 replaced
      # the single `LlmCall.Finch` pool with one pool per scheme; 0.5.0 changed
      # `:message_start` from a `nil` delta to a `%StreamDelta.MessageStart{}`).
      # `Checkpoint` also pins `llm_call` struct shapes, so an untested minor is
      # not a drop-in.
      #
      # The floor is 0.5, not 0.4, because this library reads `id` and `model` off
      # that delta for a streamed turn (design §13). A 0.4.0 stream reports both
      # as nil, so on 0.4 a streamed and a completed turn disagree in fields this
      # library promises to fill.
      #
      # 0.4.0 was the floor before it, for a reason still in force: this library's
      # contract tells callers to read `cause.retryable?` (design §9.4, §23), and
      # 0.4.0 is the release that stopped reporting pool saturation and HTTP/2
      # connection failures as permanent. On 0.3.0 a caller following these docs
      # retries the wrong way.
      {:llm_call, "~> 0.5.0"},
      {:tool_call, "~> 0.4"},
      {:telemetry, "~> 1.0"},
      {:vibe_kit, "~> 0.1", only: [:dev, :test], runtime: false},
      {:ex_slop, "~> 0.4", only: [:dev, :test], runtime: false},
      # `reach 2.2.0` locks `ex_ast 0.16`, which supports Elixir 1.18 (matching
      # `llm_call`'s lock); newer reach requires an ex_ast that demands 1.19 and
      # would break the 1.18.6 CI leg.
      {:reach, "~> 2.2.0", only: [:dev, :test], runtime: false},
      {:ex_dna, "~> 1.0", only: [:dev, :test], runtime: false},
      {:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false},
      {:credo, "~> 1.0", only: [:dev, :test], runtime: false},
      {:spec_lint, "~> 0.1", only: [:dev, :test], runtime: false},
      {:ex_doc, "~> 0.38", only: :dev, runtime: false}
    ]
  end

  defp package do
    [
      licenses: ["MIT"],
      links: %{"GitHub" => @source_url},
      files: ~w(lib docs/design.md docs/roadmap.md README.md CHANGELOG.md LICENSE mix.exs
                .formatter.exs)
    ]
  end

  defp docs do
    [
      main: "readme",
      # The example module is compiled in :dev so it cannot rot; it is not
      # public API and is reached from the README instead of from the docs.
      filter_modules:
        ~r/^Elixir\.AgentCall(\.(?:Checkpoint|Context|Cancel|Error|Event|Input|Pending|Result|RuntimeTool|Thread|Usage|AgentTool))?$/,
      extras: ["README.md", "CHANGELOG.md", "docs/design.md", "docs/roadmap.md"],
      source_url: @source_url,
      # Pin the "view source" links to the release rather than the default
      # branch, which moves on after the tag.
      source_ref: "v#{@version}"
    ]
  end

  # The gate runs ExDNA with --max-clones 0: any clone fails it.
  @gate [
    "compile --warnings-as-errors",
    "test --cover",
    "credo --strict",
    "dialyzer",
    "spec_lint --warnings-as-errors",
    "ex_dna --max-clones 0",
    "reach.check --arch --dead-code --smells"
  ]

  defp aliases do
    [
      # `bench` prints the baseline `performance_test.exs` asserts ratios
      # against. It runs in :test because it leans on the fixture server, and it
      # is not part of the gate because absolute times track the machine.
      bench: ["run bench/run.exs"],
      # The format check runs on one toolchain only: the formatter reflows
      # between Elixir releases, so agreeing with a layout is a property of that
      # release rather than of this source. CI runs `ci` on the newest leg and
      # `ci.compat` on the others.
      ci: List.insert_at(@gate, 1, "format --check-formatted"),
      "ci.compat": @gate
    ]
  end
end