defmodule PtcRunner.MixProject do use Mix.Project def project do [ app: :ptc_runner, version: "0.12.0", elixir: "~> 1.15", start_permanent: Mix.env() == :prod, elixirc_paths: elixirc_paths(Mix.env()), deps: deps(), aliases: aliases(), usage_rules: usage_rules(), name: "PtcRunner", description: "A BEAM-native Elixir library for Programmatic Tool Calling (PTC) with a lispy DSL (subset of Clojure). PTC lets LLMs generate small programs that orchestrate multiple tool calls and data transformations in code.", source_url: "https://github.com/andreasronge/ptc_runner", docs: docs(), package: package(), test_coverage: [ summary: [threshold: 0], ignore_modules: [ ~r/^Mix\.Tasks\./, ~r/^PtcRunner\.TestSupport\./, PtcRunner.TypeExtractorFixtures, # Livebook widget: whole body is `if Code.ensure_loaded?(Kino.JS)`; # kino is an optional dep absent in test, so it never compiles here. PtcRunner.Kino.TraceTree, # Dev/conformance tool gated behind Babashka + `--include clojure`; # only production callers are Mix tasks, not runtime code. PtcRunner.Lisp.ClojureValidator, # Bare display structs: they only carry data for their # Inspect/String.Chars/Jason.Encoder impls (separate modules); # zero executable lines of their own. PtcRunner.Lisp.Format.Fn, PtcRunner.Lisp.Format.Builtin, PtcRunner.Lisp.Format.Var, PtcRunner.Lisp.Format.SymbolRef, PtcRunner.Lisp.Format.RegexLiteral ] ], dialyzer: [ plt_core_path: "priv/plts", plt_file: {:no_warn, "priv/plts/project.plt"}, plt_add_apps: [:ex_unit, :mix, :req, :req_llm, :recon], ignore_warnings: ".dialyzer_ignore.exs", list_unused_filters: true ] ] end # Run "mix help compile.app" to learn about applications. def application do [ extra_applications: [:logger], env: [ model_registry: PtcRunner.LLM.DefaultRegistry, llm_adapter: PtcRunner.LLM.ReqLLMAdapter ] ] end def cli do [ preferred_envs: [precommit: :test, prepush: :test, coverage: :test] ] end defp elixirc_paths(:test), do: ["lib", "test/support"] defp elixirc_paths(_), do: ["lib"] # Generated dependency rules in AGENTS.md. Link bulky rules rather than # inlining them so the repo's own instructions stay readable. defp usage_rules do [ file: "AGENTS.md", usage_rules: [ {:usage_rules, link: :markdown, sub_rules: []}, {"usage_rules:elixir", link: :markdown, main: false}, {"usage_rules:otp", link: :markdown, main: false} ] ] end # Run "mix help deps" to learn about dependencies. defp deps do [ {:jason, "~> 1.4"}, {:nimble_parsec, "~> 1.4"}, {:telemetry, "~> 1.0"}, {:stream_data, "~> 1.1", only: [:test, :dev]}, {:credo, "~> 1.7", only: [:dev, :test], runtime: false}, {:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false}, {:ex_doc, "~> 0.31", only: :dev, runtime: false}, {:req, "~> 0.5", optional: true}, {:req_llm, "~> 1.8", optional: true}, {:kino, "~> 0.14", optional: true}, {:ptc_viewer, path: "ptc_viewer", only: [:test, :dev]}, {:usage_rules, "~> 1.2", only: :dev, runtime: false}, {:ex_dna, "~> 1.5", only: [:dev, :test], runtime: false}, {:recon, "~> 2.5", only: [:dev, :test], runtime: false}, {:benchee, "~> 1.3", only: [:dev, :test], runtime: false} ] end defp aliases do [ precommit: [ "format --check-formatted", "compile --warnings-as-errors", "xref graph --format cycles --label compile-connected --fail-above 0", "credo --strict", "schema.gen", "ptc.validate_spec", "test --warnings-as-errors", "cmd --cd demo mix test --color", "cmd --cd ptc_viewer mix test --color" ], # Slower checks kept out of the per-commit loop; run before pushing. # CI runs dialyzer + the unused-deps check on every PR regardless. prepush: [ "dialyzer", "deps.unlock --check-unused" ], coverage: [ "test --cover" ], "schema.gen": [ "run -e 'File.write!(\"priv/ptc_schema.json\", Jason.encode!(PtcRunner.Schema.to_json_schema(), pretty: true))'" ] ] end defp docs do [ main: "readme", groups_for_modules: [ Core: [ PtcRunner, PtcRunner.Context, PtcRunner.Step, PtcRunner.Tool, PtcRunner.Schema, PtcRunner.Sandbox, PtcRunner.Template, PtcRunner.Mustache, PtcRunner.Chunker, PtcRunner.Dotenv, PtcRunner.Turn ], SubAgent: [ PtcRunner.SubAgent, PtcRunner.SubAgent.Compiler, PtcRunner.SubAgent.CompiledAgent, PtcRunner.SubAgent.Definition, PtcRunner.SubAgent.Chaining, PtcRunner.SubAgent.Loop, PtcRunner.SubAgent.Loop.Budget, PtcRunner.SubAgent.Loop.JsonHandler, PtcRunner.SubAgent.Loop.LLMRetry, PtcRunner.SubAgent.Loop.Metrics, PtcRunner.SubAgent.Loop.ResponseHandler, PtcRunner.SubAgent.Loop.ReturnValidation, PtcRunner.SubAgent.Loop.State, PtcRunner.SubAgent.Loop.StepAssembler, PtcRunner.SubAgent.Loop.TextMode, PtcRunner.SubAgent.Loop.ToolNormalizer, PtcRunner.SubAgent.Loop.TurnFeedback, PtcRunner.SubAgent.Compaction, PtcRunner.SubAgent.Compaction.Context, PtcRunner.SubAgent.Compaction.Trim, PtcRunner.SubAgent.Debug, PtcRunner.SubAgentError, PtcRunner.SubAgent.JsonParser, PtcRunner.SubAgent.KeyNormalizer, PtcRunner.SubAgent.LLMResolver, PtcRunner.SubAgent.ProgressRenderer, PtcRunner.SubAgent.PromptExpander, PtcRunner.SubAgent.Validator ], "SubAgent — Signatures": [ PtcRunner.SubAgent.Signature, PtcRunner.SubAgent.Signature.Coercion, PtcRunner.SubAgent.Signature.Parser, PtcRunner.SubAgent.Signature.ParserHelpers, PtcRunner.SubAgent.Signature.Renderer, PtcRunner.SubAgent.Signature.TypeResolver, PtcRunner.SubAgent.Signature.Validator, PtcRunner.SubAgent.TypeExtractor, PtcRunner.SubAgent.Sigils ], "SubAgent — Prompts & Tools": [ PtcRunner.SubAgent.SystemPrompt, PtcRunner.SubAgent.SystemPrompt.Output, PtcRunner.SubAgent.Namespace, PtcRunner.SubAgent.Namespace.Data, PtcRunner.SubAgent.Namespace.ExecutionHistory, PtcRunner.SubAgent.Namespace.Tool, PtcRunner.SubAgent.Namespace.TypeVocabulary, PtcRunner.SubAgent.Namespace.User, PtcRunner.SubAgent.BuiltinTools, PtcRunner.SubAgent.LLMTool, PtcRunner.SubAgent.SubAgentTool, PtcRunner.SubAgent.ToolSchema, PtcRunner.SubAgent.Telemetry, PtcRunner.Prompts, PtcRunner.PromptLoader ], "PTC-Lisp": [ PtcRunner.Lisp, PtcRunner.Lisp.Parser, PtcRunner.Lisp.Analyze, PtcRunner.Lisp.Analyze.Conditionals, PtcRunner.Lisp.Analyze.Definitions, PtcRunner.Lisp.Analyze.Iteration, PtcRunner.Lisp.Analyze.Patterns, PtcRunner.Lisp.Analyze.ShortFn, PtcRunner.Lisp.AST, PtcRunner.Lisp.CoreAST, PtcRunner.Lisp.CoreToSource, PtcRunner.Lisp.Env, PtcRunner.Lisp.LanguageSpec, PtcRunner.Lisp.Registry, PtcRunner.Lisp.SpecValidator, PtcRunner.Lisp.ClojureValidator, PtcRunner.Lisp.DataKeys, PtcRunner.Lisp.SymbolCounter, PtcRunner.Lisp.Formatter ], "PTC-Lisp — Evaluation": [ PtcRunner.Lisp.Eval, PtcRunner.Lisp.Eval.Apply, PtcRunner.Lisp.Eval.Context, PtcRunner.Lisp.Eval.Helpers, PtcRunner.Lisp.Eval.Patterns, PtcRunner.Lisp.Runtime, PtcRunner.Lisp.Runtime.Callable, PtcRunner.Lisp.Runtime.Collection, PtcRunner.Lisp.Runtime.Collection.Normalize, PtcRunner.Lisp.Runtime.Collection.Select, PtcRunner.Lisp.Runtime.Collection.Transform, PtcRunner.Lisp.Runtime.FlexAccess, PtcRunner.Lisp.Runtime.Interop, PtcRunner.Lisp.Runtime.MapOps, PtcRunner.Lisp.Runtime.Math, PtcRunner.Lisp.Runtime.Predicates, PtcRunner.Lisp.Runtime.Regex, PtcRunner.Lisp.Runtime.SpecialValues, PtcRunner.Lisp.Runtime.String, PtcRunner.Lisp.ExecutionError, PtcRunner.ToolExecutionError, PtcRunner.Lisp.TypeError ], LLM: [ PtcRunner.LLM, PtcRunner.LLM.Registry, PtcRunner.LLM.DefaultRegistry, PtcRunner.LLM.ReqLLMAdapter ], Observability: [ PtcRunner.Tracer, PtcRunner.Tracer.Timeline, PtcRunner.TraceContext, PtcRunner.TraceLog, PtcRunner.TraceLog.Analyzer, PtcRunner.TraceLog.Collector, PtcRunner.TraceLog.Event, PtcRunner.TraceLog.Handler, PtcRunner.Metrics.Statistics, PtcRunner.Metrics.TurnAnalysis, PtcRunner.Kino.TraceTree ] ], extras: [ "README.md", "LICENSE", # SubAgent Guides (learning path) "docs/guides/subagent-getting-started.md", "docs/guides/subagent-llm-setup.md", "docs/guides/subagent-text-mode.md", "docs/guides/text-mode-ptc-compute.md", "docs/guides/subagent-concepts.md", "docs/guides/subagent-patterns.md", "docs/guides/subagent-ptc-transport.md", "docs/guides/subagent-navigator.md", "docs/guides/subagent-rlm-patterns.md", "docs/guides/subagent-testing.md", "docs/guides/subagent-troubleshooting.md", "docs/guides/subagent-observability.md", "docs/guides/subagent-compaction.md", "docs/guides/subagent-advanced.md", "docs/guides/subagent-prompts.md", # Integration Guides "docs/guides/phoenix-streaming.md", "docs/guides/structured-output-callbacks.md", # MCP Server {"mcp_server/README.md", [filename: "mcp-server-readme", title: "MCP Server README"]}, {"mcp_server/DEVELOPMENT.md", [filename: "mcp-server-development", title: "MCP Server Development"]}, "docs/mcp-server-cli.md", "docs/mcp-server.md", "docs/guides/mcp-getting-started.md", "docs/upstream-runtime.md", "docs/aggregator-mode.md", "docs/agentic-mode.md", "docs/mcp-debug.md", "docs/mcp-server-configuration.md", "docs/mcp-server-http-deployment.md", # Reference "docs/signature-syntax.md", "docs/benchmark-eval.md", # PTC-Lisp "docs/ptc-lisp-specification.md", "docs/clojure-conformance-gaps.md", # Generated Reference (mix ptc.gen_docs) "docs/function-reference.md", "docs/java-interop.md", "docs/conformance/index.md", "docs/conformance/clojure-core-audit.md", "docs/conformance/clojure-string-audit.md", "docs/conformance/clojure-set-audit.md", "docs/conformance/clojure-walk-audit.md", "docs/conformance/java-math-audit.md", "docs/conformance/java-lang-boolean-audit.md", "docs/conformance/java-lang-double-audit.md", "docs/conformance/java-lang-float-audit.md", "docs/conformance/java-lang-integer-audit.md", "docs/conformance/java-lang-long-audit.md", "docs/conformance/java-lang-string-audit.md", "docs/conformance/java-lang-system-audit.md", "docs/conformance/java-time-local-date-audit.md", "docs/conformance/java-time-instant-audit.md", "docs/conformance/java-time-duration-audit.md", "docs/conformance/java-time-period-audit.md", "docs/conformance/java-util-date-audit.md", # Livebooks "livebooks/ptc_runner_playground.livemd", "livebooks/ptc_runner_llm_agent.livemd", "livebooks/output_modes_in_app_loops.livemd", "livebooks/joke_workflow.livemd", "livebooks/observability_and_tracing.livemd", "livebooks/prompt_caching.livemd" ], groups_for_extras: [ "SubAgent Guides": ~r/docs\/guides\/(subagent-.+|text-mode-ptc-compute)\.md/, "Integration Guides": ~r/docs\/guides\/(phoenix-|structured-).+\.md/, "Upstream Runtime": ~r/docs\/(upstream-runtime|aggregator-mode)\.md/, "MCP Server": ~r/mcp_server\/(README|DEVELOPMENT)\.md|docs\/(mcp-server|mcp-server-cli|mcp-server-configuration|mcp-server-http-deployment|mcp-debug|agentic-mode)\.md|docs\/guides\/mcp-getting-started\.md/, Reference: ~r/docs\/(signature-syntax|benchmark-eval|ptc-lisp-.+|clojure-.+|function-reference|java-.+|reference\/.+)\.md|docs\/conformance\/.+\.md/, Livebooks: ~r/livebooks\/.+\.livemd/ ], assets: %{"images" => "images"}, before_closing_body_tag: &before_closing_body_tag/1 ] end defp before_closing_body_tag(:html) do """ """ end defp before_closing_body_tag(_), do: "" defp package do [ files: ~w(lib docs .formatter.exs mix.exs README.md LICENSE CHANGELOG.md usage-rules.md usage-rules priv/function_audit.exs priv/functions.exs priv/java_compat_audit.exs priv/prompts priv/ptc_schema.json priv/spec), licenses: ["MIT"], links: %{ "GitHub" => "https://github.com/andreasronge/ptc_runner", "Changelog" => "https://github.com/andreasronge/ptc_runner/blob/main/CHANGELOG.md" } ] end end