packages feed

baikai-0.5.0.0: baikai.cabal

cabal-version:   3.4
name:            baikai
version:         0.5.0.0
synopsis:        Unified Haskell interface for multiple AI providers
description:
  baikai provides a unified, provider-agnostic Haskell interface for working
  with multiple AI providers. It abstracts chat and streaming completions, tool
  use, model catalogs, cost accounting, and tracing behind a single API, with
  concrete provider implementations supplied by companion packages such as
  @baikai-claude@ and @baikai-openai@.

category:        AI
license:         BSD-3-Clause
license-file:    LICENSE
author:          Nadeem Bitar
maintainer:      nadeem@gmail.com
copyright:       (c) 2026 Nadeem Bitar
build-type:      Simple
extra-doc-files: CHANGELOG.md

common common-options
  ghc-options:
    -Wall -Wcompat -Widentities -Wincomplete-uni-patterns
    -Wincomplete-record-updates -Wredundant-constraints
    -fhide-source-paths -Wmissing-export-lists -Wpartial-fields
    -Wmissing-deriving-strategies

  -- Exhaustiveness is an error, not a warning. A non-exhaustive match
  -- is a crash the compiler already found: it fails at runtime, on
  -- whichever input reaches the missing branch, usually in front of a
  -- user. This is not hypothetical here — adding a constructor to
  -- AgentRunFailure left `failureExitCode` non-exhaustive and shipped a
  -- pattern-match failure on `baikai agent run --require-evidence`,
  -- because the warning scrolled past in a build log.
  --
  -- Promoted individually rather than through -Werror, which would also
  -- fail the build on warnings that are stylistic or that a future GHC
  -- invents, and would push people toward blanket suppression.
  ghc-options:
    -Werror=incomplete-patterns -Werror=incomplete-uni-patterns
    -Werror=incomplete-record-updates

  default-language:   GHC2024
  default-extensions:
    DeriveAnyClass
    DuplicateRecordFields
    OverloadedLabels
    OverloadedStrings

library
  import:          common-options
  hs-source-dirs:  src
  exposed-modules:
    Baikai
    Baikai.Agent
    Baikai.AgentAssets
    Baikai.Api
    Baikai.Auth
    Baikai.CacheRetention
    Baikai.Compat
    Baikai.Content
    Baikai.Context
    Baikai.Cost
    Baikai.Cost.Log
    Baikai.Cost.Pricing
    Baikai.Embedding
    Baikai.Error
    Baikai.Evidence
    Baikai.Evidence.Build
    Baikai.Interactive
    Baikai.Message
    Baikai.Model
    Baikai.Models.Generated
    Baikai.Options
    Baikai.Prelude
    Baikai.Provider
    Baikai.Provider.Cli.Internal
    Baikai.Provider.Registry
    Baikai.Response
    Baikai.ResponseFormat
    Baikai.StopReason
    Baikai.Stream
    Baikai.Stream.Event
    Baikai.ThinkingLevel
    Baikai.Tool
    Baikai.Trace
    Baikai.Trace.Event
    Baikai.Trace.Sink
    Baikai.Usage

  -- The cabal-generated version module. 'Baikai.Evidence.Build' reads
  -- it so an evidence record can name the build that produced it,
  -- centrally rather than through a literal in each of the five
  -- packages that construct evidence.
  other-modules:   Paths_baikai
  autogen-modules: Paths_baikai
  build-depends:
    , aeson              ^>=2.2
    , base               >=4.20  && <5
    , base16-bytestring  ^>=1.0
    , base64-bytestring  ^>=1.2
    , bytestring         ^>=0.12
    , containers         ^>=0.7
    , cryptohash-sha256  ^>=0.11
    , directory          ^>=1.3
    , filepath           ^>=1.5
    , generic-lens       ^>=2.3
    , lens               ^>=5.3
    , openai             ^>=2.5
    , process            ^>=1.6
    , scientific         ^>=0.3
    , streamly           >=0.11  && <0.13
    , streamly-core      >=0.3   && <0.5
    , text               ^>=2.1
    , time               ^>=1.14
    , unliftio-core      ^>=0.2
    , vector             ^>=0.13

executable baikai-gen-models
  import:         common-options
  hs-source-dirs: gen
  main-is:        GenModels.hs
  other-modules:  GenModelsCore
  build-depends:
    , aeson       ^>=2.2
    , baikai
    , base        >=4.20  && <5
    , bytestring  ^>=0.12
    , containers  ^>=0.7
    , directory   ^>=1.3
    , filepath    ^>=1.5
    , scientific  ^>=0.3
    , text        ^>=2.1

executable baikai-fetch-models
  import:         common-options
  hs-source-dirs: fetch
  main-is:        FetchModels.hs
  other-modules:  FetchModelsCore

  -- The main module is named @FetchModels@ (not @Main@) so the pure
  -- core can be compiled into the test suite alongside its own
  -- @Main.hs@ without a module-name clash.
  ghc-options:    -main-is FetchModels
  build-depends:
    , aeson            ^>=2.2
    , baikai
    , base             >=4.20  && <5
    , bytestring       ^>=0.12
    , containers       ^>=0.7
    , directory        ^>=1.3
    , filepath         ^>=1.5
    , generic-lens     ^>=2.3
    , http-client      ^>=0.7
    , http-client-tls  ^>=0.3
    , lens             ^>=5.3
    , scientific       ^>=0.3
    , text             ^>=2.1
    , vector           ^>=0.13

test-suite baikai-test
  import:             common-options
  type:               exitcode-stdio-1.0
  hs-source-dirs:     test fetch gen
  main-is:            Main.hs
  other-modules:
    AgentAssetsSpec
    AgentSpec
    CatalogSpec
    CliInternalSpec
    ContextSpec
    CostSpec
    EmbeddingSpec
    ErrorInfoSpec
    ErrorSpec
    EvidenceSpec
    FetchModelsCore
    FetchModelsSpec
    GenModelsCore
    GenModelsSpec
    HelpersSpec
    InteractiveSpec
    StreamSpec
    StrictEvidenceSpec
    SurfaceSpec
    ThinkingLevelSpec
    TraceSpec
    UsageSpec

  build-tool-depends: baikai:baikai-gen-models
  build-depends:
    , aeson
    , baikai
    , base
    , bytestring
    , containers
    , directory
    , filepath
    , generic-lens
    , lens
    , openai
    , process
    , scientific
    , stm
    , streamly-core     >=0.3 && <0.5
    , tasty
    , tasty-hunit
    , tasty-quickcheck
    , temporary
    , text
    , time
    , vector