load("@crates//:defs.bzl", "aliases", "all_crate_deps")

load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_proc_macro", "rust_test")



filegroup(

    name = "cargo_manifest",

    srcs = ["Cargo.toml"],

    visibility = ["//visibility:public"],

)



filegroup(

    name = "package_runfiles",

    srcs = glob(["Cargo.toml", "**/*"], exclude = ["BUILD", "BUILD.bazel"], allow_empty = True),

    visibility = ["//visibility:public"],

)



rust_library(
    name = "meerkat_comms",
    aliases = aliases(package_name = "meerkat-comms"),
    crate_name = "meerkat_comms",
    crate_root = "src/lib.rs",
    crate_features = [
        "capability",
        "integration-real-tests",
    ],
    edition = "2024",
    compile_data = [
        "Cargo.toml",
        "skills/mob-communication/SKILL.md",
        "skills/multi-agent-comms/SKILL.md",
    ],
    srcs = glob(["src/**/*.rs"]),
    visibility = ["//visibility:public"],
    rustc_env = {
        "CARGO_PKG_VERSION": "0.7.27",
        "CARGO_MANIFEST_DIR": "./meerkat-comms",
    },
    proc_macro_deps = all_crate_deps(
        package_name = "meerkat-comms",
        proc_macro = True,
    ),
    deps = [
        "//meerkat-capabilities:meerkat_capabilities",
        "//meerkat-contracts:meerkat_contracts",
        "//meerkat-core:meerkat_core",
        "//meerkat-skills:meerkat_skills",
    ] + all_crate_deps(
        package_name = "meerkat-comms",
        normal = True,
    ),
)

rust_library(
    name = "meerkat_comms_agent_factory_build",
    aliases = aliases(package_name = "meerkat-comms"),
    crate_name = "meerkat_comms",
    crate_root = "src/lib.rs",
    crate_features = [
        "capability",
        "integration-real-tests",
    ],
    edition = "2024",
    compile_data = [
        "Cargo.toml",
        "skills/mob-communication/SKILL.md",
        "skills/multi-agent-comms/SKILL.md",
    ],
    srcs = glob(["src/**/*.rs"]),
    visibility = [
        "//meerkat:__pkg__",
    ],
    rustc_env = {
        "CARGO_PKG_VERSION": "0.7.27",
        "CARGO_MANIFEST_DIR": "./meerkat-comms",
    },
    proc_macro_deps = all_crate_deps(
        package_name = "meerkat-comms",
        proc_macro = True,
    ),
    deps = [
        "//meerkat:meerkat_capabilities_agent_factory_build",
        "//meerkat:meerkat_contracts_agent_factory_build",
        "//meerkat:meerkat_core_agent_factory_build",
        "//meerkat:meerkat_skills_agent_factory_build",
    ] + all_crate_deps(
        package_name = "meerkat-comms",
        normal = True,
    ),
)

rust_test(
    name = "meerkat_comms_unit_test",
    aliases = aliases(
        package_name = "meerkat-comms",
        normal = True,
        normal_dev = True,
        proc_macro = True,
        proc_macro_dev = True,
    ),
    crate_name = "meerkat_comms",
    crate_root = "src/lib.rs",
    crate_features = [
        "capability",
        "integration-real-tests",
    ],
    edition = "2024",
    compile_data = [
        "Cargo.toml",
        "skills/mob-communication/SKILL.md",
        "skills/multi-agent-comms/SKILL.md",
    ],
    srcs = glob(["src/**/*.rs"]),
    visibility = ["//visibility:public"],
    rustc_env = {
        "CARGO_PKG_VERSION": "0.7.27",
        "CARGO_MANIFEST_DIR": "./meerkat-comms",
    },
    tags = [
        "fast",
        "unit",
    ],
    size = "small",
    data = [
        ":package_runfiles",
    ],
    env = {
        "RUST_MIN_STACK": "16777216",
    },
    proc_macro_deps = all_crate_deps(
        package_name = "meerkat-comms",
        proc_macro = True,
        proc_macro_dev = True,
    ),
    deps = [
        "//meerkat-capabilities:meerkat_capabilities",
        "//meerkat-contracts:meerkat_contracts",
        "//meerkat-core:meerkat_core",
        "//meerkat-runtime:meerkat_runtime_test_support",
        "//meerkat-skills:meerkat_skills",
    ] + all_crate_deps(
        package_name = "meerkat-comms",
        normal = True,
        normal_dev = True,
    ),
)

rust_test(
    name = "e2e_test",
    aliases = aliases(
        package_name = "meerkat-comms",
        normal = True,
        normal_dev = True,
        proc_macro = True,
        proc_macro_dev = True,
    ),
    crate_name = "e2e",
    crate_root = "tests/e2e.rs",
    crate_features = [
        "capability",
        "integration-real-tests",
    ],
    edition = "2024",
    compile_data = [
        "Cargo.toml",
        "skills/mob-communication/SKILL.md",
        "skills/multi-agent-comms/SKILL.md",
    ],
    srcs = [
        "tests/e2e.rs",
    ],
    visibility = ["//visibility:public"],
    rustc_env = {
        "CARGO_PKG_VERSION": "0.7.27",
        "CARGO_BIN_NAME": "e2e",
        "CARGO_MANIFEST_DIR": "./meerkat-comms",
    },
    tags = [
        "e2e",
        "integration",
        "required-feature",
    ],
    data = [],
    env = {
        "RUST_MIN_STACK": "16777216",
    },
    proc_macro_deps = all_crate_deps(
        package_name = "meerkat-comms",
        proc_macro = True,
        proc_macro_dev = True,
    ),
    deps = [
        "//meerkat-capabilities:meerkat_capabilities",
        "//meerkat-comms:meerkat_comms",
        "//meerkat-contracts:meerkat_contracts",
        "//meerkat-core:meerkat_core",
        "//meerkat-runtime:meerkat_runtime_test_support",
        "//meerkat-skills:meerkat_skills",
    ] + all_crate_deps(
        package_name = "meerkat-comms",
        normal = True,
        normal_dev = True,
    ),
)

rust_test(
    name = "embedded_skill_registration_test",
    aliases = aliases(
        package_name = "meerkat-comms",
        normal = True,
        normal_dev = True,
        proc_macro = True,
        proc_macro_dev = True,
    ),
    crate_name = "embedded_skill_registration",
    crate_root = "tests/embedded_skill_registration.rs",
    crate_features = [
        "capability",
        "integration-real-tests",
    ],
    edition = "2024",
    compile_data = [
        "Cargo.toml",
        "skills/mob-communication/SKILL.md",
        "skills/multi-agent-comms/SKILL.md",
    ],
    srcs = [
        "tests/embedded_skill_registration.rs",
    ],
    visibility = ["//visibility:public"],
    rustc_env = {
        "CARGO_PKG_VERSION": "0.7.27",
        "CARGO_BIN_NAME": "embedded_skill_registration",
        "CARGO_MANIFEST_DIR": "./meerkat-comms",
    },
    tags = [
        "fast",
    ],
    size = "small",
    data = [],
    env = {
        "RUST_MIN_STACK": "16777216",
    },
    proc_macro_deps = all_crate_deps(
        package_name = "meerkat-comms",
        proc_macro = True,
        proc_macro_dev = True,
    ),
    deps = [
        "//meerkat-capabilities:meerkat_capabilities",
        "//meerkat-comms:meerkat_comms",
        "//meerkat-contracts:meerkat_contracts",
        "//meerkat-core:meerkat_core",
        "//meerkat-runtime:meerkat_runtime_test_support",
        "//meerkat-skills:meerkat_skills",
    ] + all_crate_deps(
        package_name = "meerkat-comms",
        normal = True,
        normal_dev = True,
    ),
)

rust_test(
    name = "inbox_admission_toctou_test",
    aliases = aliases(
        package_name = "meerkat-comms",
        normal = True,
        normal_dev = True,
        proc_macro = True,
        proc_macro_dev = True,
    ),
    crate_name = "inbox_admission_toctou",
    crate_root = "tests/inbox_admission_toctou.rs",
    crate_features = [
        "capability",
        "integration-real-tests",
    ],
    edition = "2024",
    compile_data = [
        "Cargo.toml",
        "skills/mob-communication/SKILL.md",
        "skills/multi-agent-comms/SKILL.md",
    ],
    srcs = [
        "tests/inbox_admission_toctou.rs",
    ],
    visibility = ["//visibility:public"],
    rustc_env = {
        "CARGO_PKG_VERSION": "0.7.27",
        "CARGO_BIN_NAME": "inbox_admission_toctou",
        "CARGO_MANIFEST_DIR": "./meerkat-comms",
    },
    tags = [
        "fast",
    ],
    size = "small",
    data = [],
    env = {
        "RUST_MIN_STACK": "16777216",
    },
    proc_macro_deps = all_crate_deps(
        package_name = "meerkat-comms",
        proc_macro = True,
        proc_macro_dev = True,
    ),
    deps = [
        "//meerkat-capabilities:meerkat_capabilities",
        "//meerkat-comms:meerkat_comms",
        "//meerkat-contracts:meerkat_contracts",
        "//meerkat-core:meerkat_core",
        "//meerkat-runtime:meerkat_runtime_test_support",
        "//meerkat-skills:meerkat_skills",
    ] + all_crate_deps(
        package_name = "meerkat-comms",
        normal = True,
        normal_dev = True,
    ),
)

rust_test(
    name = "inproc_canonical_peer_routing_test",
    aliases = aliases(
        package_name = "meerkat-comms",
        normal = True,
        normal_dev = True,
        proc_macro = True,
        proc_macro_dev = True,
    ),
    crate_name = "inproc_canonical_peer_routing",
    crate_root = "tests/inproc_canonical_peer_routing.rs",
    crate_features = [
        "capability",
        "integration-real-tests",
    ],
    edition = "2024",
    compile_data = [
        "Cargo.toml",
        "skills/mob-communication/SKILL.md",
        "skills/multi-agent-comms/SKILL.md",
    ],
    srcs = [
        "tests/inproc_canonical_peer_routing.rs",
    ],
    visibility = ["//visibility:public"],
    rustc_env = {
        "CARGO_PKG_VERSION": "0.7.27",
        "CARGO_BIN_NAME": "inproc_canonical_peer_routing",
        "CARGO_MANIFEST_DIR": "./meerkat-comms",
    },
    tags = [
        "fast",
    ],
    size = "small",
    data = [],
    env = {
        "RUST_MIN_STACK": "16777216",
    },
    proc_macro_deps = all_crate_deps(
        package_name = "meerkat-comms",
        proc_macro = True,
        proc_macro_dev = True,
    ),
    deps = [
        "//meerkat-capabilities:meerkat_capabilities",
        "//meerkat-comms:meerkat_comms",
        "//meerkat-contracts:meerkat_contracts",
        "//meerkat-core:meerkat_core",
        "//meerkat-runtime:meerkat_runtime_test_support",
        "//meerkat-skills:meerkat_skills",
    ] + all_crate_deps(
        package_name = "meerkat-comms",
        normal = True,
        normal_dev = True,
    ),
)

rust_test(
    name = "router_ambiguous_name_typed_error_test",
    aliases = aliases(
        package_name = "meerkat-comms",
        normal = True,
        normal_dev = True,
        proc_macro = True,
        proc_macro_dev = True,
    ),
    crate_name = "router_ambiguous_name_typed_error",
    crate_root = "tests/router_ambiguous_name_typed_error.rs",
    crate_features = [
        "capability",
        "integration-real-tests",
    ],
    edition = "2024",
    compile_data = [
        "Cargo.toml",
        "skills/mob-communication/SKILL.md",
        "skills/multi-agent-comms/SKILL.md",
    ],
    srcs = [
        "tests/router_ambiguous_name_typed_error.rs",
    ],
    visibility = ["//visibility:public"],
    rustc_env = {
        "CARGO_PKG_VERSION": "0.7.27",
        "CARGO_BIN_NAME": "router_ambiguous_name_typed_error",
        "CARGO_MANIFEST_DIR": "./meerkat-comms",
    },
    tags = [
        "fast",
    ],
    size = "small",
    data = [],
    env = {
        "RUST_MIN_STACK": "16777216",
    },
    proc_macro_deps = all_crate_deps(
        package_name = "meerkat-comms",
        proc_macro = True,
        proc_macro_dev = True,
    ),
    deps = [
        "//meerkat-capabilities:meerkat_capabilities",
        "//meerkat-comms:meerkat_comms",
        "//meerkat-contracts:meerkat_contracts",
        "//meerkat-core:meerkat_core",
        "//meerkat-runtime:meerkat_runtime_test_support",
        "//meerkat-skills:meerkat_skills",
    ] + all_crate_deps(
        package_name = "meerkat-comms",
        normal = True,
        normal_dev = True,
    ),
)

rust_test(
    name = "router_integration_test",
    aliases = aliases(
        package_name = "meerkat-comms",
        normal = True,
        normal_dev = True,
        proc_macro = True,
        proc_macro_dev = True,
    ),
    crate_name = "router_integration",
    crate_root = "tests/router_integration.rs",
    crate_features = [
        "capability",
        "integration-real-tests",
    ],
    edition = "2024",
    compile_data = [
        "Cargo.toml",
        "skills/mob-communication/SKILL.md",
        "skills/multi-agent-comms/SKILL.md",
    ],
    srcs = [
        "tests/router_integration.rs",
    ],
    visibility = ["//visibility:public"],
    rustc_env = {
        "CARGO_PKG_VERSION": "0.7.27",
        "CARGO_BIN_NAME": "router_integration",
        "CARGO_MANIFEST_DIR": "./meerkat-comms",
    },
    tags = [
        "integration",
        "required-feature",
    ],
    data = [],
    env = {
        "RUST_MIN_STACK": "16777216",
    },
    proc_macro_deps = all_crate_deps(
        package_name = "meerkat-comms",
        proc_macro = True,
        proc_macro_dev = True,
    ),
    deps = [
        "//meerkat-capabilities:meerkat_capabilities",
        "//meerkat-comms:meerkat_comms",
        "//meerkat-contracts:meerkat_contracts",
        "//meerkat-core:meerkat_core",
        "//meerkat-runtime:meerkat_runtime_test_support",
        "//meerkat-skills:meerkat_skills",
    ] + all_crate_deps(
        package_name = "meerkat-comms",
        normal = True,
        normal_dev = True,
    ),
)

rust_test(
    name = "trust_duplicate_name_ok_duplicate_id_rejected_test",
    aliases = aliases(
        package_name = "meerkat-comms",
        normal = True,
        normal_dev = True,
        proc_macro = True,
        proc_macro_dev = True,
    ),
    crate_name = "trust_duplicate_name_ok_duplicate_id_rejected",
    crate_root = "tests/trust_duplicate_name_ok_duplicate_id_rejected.rs",
    crate_features = [
        "capability",
        "integration-real-tests",
    ],
    edition = "2024",
    compile_data = [
        "Cargo.toml",
        "skills/mob-communication/SKILL.md",
        "skills/multi-agent-comms/SKILL.md",
    ],
    srcs = [
        "tests/trust_duplicate_name_ok_duplicate_id_rejected.rs",
    ],
    visibility = ["//visibility:public"],
    rustc_env = {
        "CARGO_PKG_VERSION": "0.7.27",
        "CARGO_BIN_NAME": "trust_duplicate_name_ok_duplicate_id_rejected",
        "CARGO_MANIFEST_DIR": "./meerkat-comms",
    },
    tags = [
        "fast",
    ],
    size = "small",
    data = [],
    env = {
        "RUST_MIN_STACK": "16777216",
    },
    proc_macro_deps = all_crate_deps(
        package_name = "meerkat-comms",
        proc_macro = True,
        proc_macro_dev = True,
    ),
    deps = [
        "//meerkat-capabilities:meerkat_capabilities",
        "//meerkat-comms:meerkat_comms",
        "//meerkat-contracts:meerkat_contracts",
        "//meerkat-core:meerkat_core",
        "//meerkat-runtime:meerkat_runtime_test_support",
        "//meerkat-skills:meerkat_skills",
    ] + all_crate_deps(
        package_name = "meerkat-comms",
        normal = True,
        normal_dev = True,
    ),
)

test_suite(
    name = "fast_tests",
    tests = [
        ":embedded_skill_registration_test",
        ":inbox_admission_toctou_test",
        ":inproc_canonical_peer_routing_test",
        ":meerkat_comms_unit_test",
        ":router_ambiguous_name_typed_error_test",
        ":trust_duplicate_name_ok_duplicate_id_rejected_test",
    ],
)
