a3s-code-core 9.0.0

A3S Code Core - Embeddable AI agent library with tool execution
Documentation
[package]
name = "a3s-code-core"
version = "9.0.0"
edition = "2021"
authors = ["A3S Lab Team"]
license = "MIT"
repository = "https://github.com/A3S-Lab/Code"
description = "A3S Code Core - Embeddable AI agent library with tool execution"

[lib]
name = "a3s_code_core"
path = "src/lib.rs"

[[example]]
name = "telemetry_collector_qualification"
required-features = ["telemetry"]

[[example]]
name = "durable_memory_semantic_refresh_benchmark"
required-features = ["durable-memory-sqlite"]

[[example]]
name = "durable_memory_prod1_host"
required-features = ["dm-prod1-host"]

[[example]]
name = "workspace_persistent_index_benchmark"
required-features = ["a3s-vec-fts"]

[[example]]
name = "workspace_persistent_index_production"
required-features = ["a3s-vec-fts"]

[[example]]
name = "flow_graph_benchmark"
required-features = ["advanced-harness"]

[[example]]
name = "evaluation_substrate_benchmark"
required-features = ["advanced-harness"]

[[test]]
name = "test_extensibility_real_llm"
path = "tests/test_extensibility_real_llm.rs"
required-features = ["advanced-harness"]

[[test]]
name = "typed_decision_layer_c"
path = "tests/typed_decision_layer_c.rs"
required-features = ["apofasi"]

[[test]]
name = "typed_decision_perf"
path = "tests/typed_decision_perf.rs"
required-features = ["apofasi"]

[dependencies]
# Internal crates
a3s-effect = "0.1.0"
a3s-common = "0.1.1"
a3s-memory = { version = "0.1.4", git = "https://github.com/A3S-Lab/Memory.git", rev = "97a5e885d196be77dc1823ad86238e77d942ed73" }
a3s-lane = "0.5"
# Pin the Search release so the browser-engine and Moli adapter APIs cannot
# drift underneath the Code runtime manager.
a3s-search = { version = "=3.1.4", git = "https://github.com/A3S-Lab/Search.git", rev = "e38555cebb5a0fe9a982bde72700971262ac0773", default-features = false }
# Flow engine is optional: thin coding builds do not project named workflows.
# Enabled by `dynamic-workflow` (and therefore `advanced-harness`).
a3s-flow = { version = "=1.1.0", git = "https://github.com/A3S-Lab/Flow.git", rev = "2948ad51a1395177764766c3ddf7e44338f9e374", default-features = false, optional = true }
a3s-sandbox = { version = "=0.2.1", git = "https://github.com/A3S-Lab/Sandbox.git", rev = "2b8687892bbb4a5e3d6e74fca42949a3f186d236" }
# Typed System-1 decisions (Apofasi). Optional so thin coding builds stay
# ML-free; lexical/router path only unless `apofasi-infer` is enabled.
a3s-apofasi = { version = "=0.1.1", git = "https://github.com/A3S-Lab/Apofasi.git", rev = "0bc3961d3183f9d2692c0406967765866bc914d6", default-features = false, features = ["router"], optional = true }
# Pure-Rust a3s-vec FTS engine for the workspace lexical index. Optional so
# minimal builds keep the portable BM25 scorer without pulling the engine.
a3s-vec = { version = "=0.1.8", optional = true }
# Async runtime
tokio = { version = "1.35", features = [
    "rt-multi-thread", "sync", "time", "io-util",
    "process", "fs", "macros"
] }
tokio-stream = { version = "0.1", features = ["net"] }
tokio-util = { version = "0.7", features = ["codec"] }

# Serialization
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
lsp-types = "=0.97.0"
url = "=2.5.8"
percent-encoding = "2.3"
# Full JSON Schema validation for structured model output. Remote/file
# resolvers stay disabled so an untrusted schema cannot trigger ambient I/O.
jsonschema = { version = "0.47", default-features = false }
serde_yaml = "0.9"
toml = "0.8"

# ACL config parsing
a3s-acl = "=0.3.0"

# Error handling
anyhow = "1.0"
thiserror = "1.0"

# Logging (tracing only — no OTel)
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }

# OpenTelemetry (optional — requires `telemetry` feature)
opentelemetry = { version = "0.27", optional = true }
opentelemetry_sdk = { version = "0.27", features = ["rt-tokio"], optional = true }
opentelemetry-otlp = { version = "0.27", features = ["tonic", "http-proto", "hyper-client"], optional = true }
tracing-opentelemetry = { version = "0.28", optional = true }

# Async utilities
futures = "0.3"
rayon = "1.10"
async-trait = "0.1"
async-stream = "0.3"

# HTTP client for LLM APIs
reqwest = { version = "0.12", default-features = false, features = ["json", "stream", "rustls-tls"] }

# File operations
glob = "0.3"
ignore = "0.4"
notify = "8"
aes-gcm = "0.10"

# Diff for edit tool
similar = "2.4"

# Home directory for project memory
dirs = "5.0"

# Regex for template substitution
regex = "1.10"

# SHA256 for security provider
sha256 = "1.5"
sha2 = "0.10"

# Shell argument parsing
shell-words = "1.1"

# HTML to text/markdown conversion (web_fetch)
html2text = "0.16"
htmd = "0.5"
# PDF text extraction for web_fetch (optional; enabled by local-code).
lopdf = { version = "0.42", optional = true }
# Moli browser archive unpack (headless-search only)
zip = { version = "0.6", default-features = false, features = ["deflate"], optional = true }
flate2 = { version = "1.0", optional = true }
tar = { version = "0.4", optional = true }
tempfile = "3.10"
fs2 = "0.4"

# Base64 for image encoding
base64 = "0.21"

# Bytes for streaming
bytes = "1.5"

# Pin for futures
pin-project-lite = "0.2"

# UUID
uuid = { version = "1.6", features = ["v4", "serde"] }

# Time handling
chrono = { version = "0.4", features = ["serde"] }
rquickjs = { version = "0.11.0", features = ["futures"] }

# S3-compatible workspace backend (optional, gated by `s3` feature)
# Redis client for the `DM-PROD1` host qualification harness only. The remote
# vector index and distributed lease live in
# `examples/durable_memory_prod1_host`; no library module depends on Redis.
redis = { version = "0.32.7", default-features = false, features = ["tokio-comp", "script"], optional = true }
aws-sdk-s3 = { version = "1", default-features = false, features = ["rt-tokio", "rustls"], optional = true }
aws-credential-types = { version = "1", optional = true }
aws-smithy-types = { version = "1", optional = true }
aws-smithy-runtime-api = { version = "1", optional = true }

[target.'cfg(unix)'.dependencies]
libc = "0.2"

[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.61", features = ["Win32_Foundation", "Win32_Storage_FileSystem", "Win32_System_JobObjects", "Win32_System_Threading"] }

[features]
# Thin coding-harness default (`HARNESS-CONV5`): agent loop, tools, identity,
# events, and a3s-vec FTS. Advanced evaluation/research/workflows (including
# Flow projection via `dynamic-workflow`), browser search, S3, and
# telemetry require explicit profiles/features.
default = ["local-code"]
# ---------------------------------------------------------------------------
# Release profiles (KRN-10). Embedders select a profile instead of composing
# native/runtime dependencies by hand; each profile documents the surface it
# adds over `minimal`.
# ---------------------------------------------------------------------------
# Governed agent loop, workspace tools, identity/events — no browser, a3s-vec
# FTS, S3, telemetry, or Advanced harness modules.
minimal = []
# Minimal plus the workspace persistent a3s-vec FTS lexical path, in-tree
# trigram pruning for workspace `grep` candidates, and PDF text extraction
# for `web_fetch`.
local-code = ["a3s-vec-fts", "grep-trigram", "web-fetch-pdf"]
# Local code plus durable SQLite memory vectors, browser-backed web search, and
# Advanced evaluation/research/workflow surfaces.
scientific = ["local-code", "durable-memory-sqlite", "headless-search", "advanced-harness"]
# Local code plus S3 workspaces and OpenTelemetry export.
server = ["local-code", "s3", "telemetry"]
# Every optional surface.
full = ["scientific", "server"]
# Advanced harness: evaluation substrate, research contracts, state graphs,
# Flow projection, and programmable dynamic workflows (`HARNESS-CONV3`).
evaluation = []
research = ["evaluation"]
state-graph = []
# Programmable workflows plus named Flow capability projection (`HOST-FLOW1`).
dynamic-workflow = ["state-graph", "dep:a3s-flow"]
advanced-harness = ["evaluation", "research", "state-graph", "dynamic-workflow"]
# Enable the locally durable SQLite vector index for semantic-memory hosts.
durable-memory-sqlite = ["a3s-memory/sqlite"]
# Build the `DM-PROD1` host qualification harness
# (`examples/durable_memory_prod1_host`). It injects a Redis-backed
# `VectorIndex` and a Redis lease into `DurableMemorySession`, so it is the only
# surface that needs the Redis client. Deliberately excluded from every release
# profile and from `ci-all`.
dm-prod1-host = ["dep:redis"]
# Enable browser-backed search plus managed browser lifecycle
# APIs. Moli is the runtime default and is downloaded on first headless use when
# no packaged or user-provided executable is available; Chrome/Chromium and
# Lightpanda remain selectable through configuration. HTTP/RSS and native API
# search remain available when default features are disabled.
headless-search = [
    "a3s-search/moli",
    "a3s-search/lightpanda",
    "dep:zip",
    "dep:flate2",
    "dep:tar",
]
# Compile the pure-Rust a3s-vec FTS adapter for workspace lexical retrieval.
a3s-vec-fts = ["dep:a3s-vec"]
# Enable in-tree trigram pruning for workspace `grep` candidates (tgrep-style
# fail-open filter). Exact regex matching stays owned by Code; no crates.io
# git dep (`tgrep-core` is unpublished). Included in `local-code`.
grep-trigram = []
# Extract text from PDF responses in `web_fetch` (lopdf). Included in `local-code`.
web-fetch-pdf = ["dep:lopdf"]
# Enable OpenTelemetry OTLP export for traces and metrics.
# When active, `TelemetryConfig::init()` sets up OTLP exporter + tracing subscriber.
telemetry = [
    "dep:opentelemetry",
    "dep:opentelemetry_sdk",
    "dep:opentelemetry-otlp",
    "dep:tracing-opentelemetry",
]
# Enable the S3-compatible workspace backend (`S3WorkspaceBackend`).
# Brings in the AWS Rust SDK and is safe to point at any S3-compatible
# endpoint (AWS S3, MinIO, RustFS, Cloudflare R2, ...).
s3 = [
    "dep:aws-sdk-s3",
    "dep:aws-credential-types",
    "dep:aws-smithy-types",
    "dep:aws-smithy-runtime-api",
]
# Typed System-1 decisions via A3S Apofasi (lexical + script router).
# Not part of `local-code` / `scientific` / `full` — hosts opt in explicitly.
# Call sites, GatePolicy thresholds, and product routing stay host-owned.
apofasi = ["dep:a3s-apofasi"]
# Neural checkpoint path (Candle). Requires bundled weights; keeps ML off
# the default Apofasi surface.
apofasi-infer = ["apofasi", "a3s-apofasi/infer"]
# Apple Silicon Metal for Apofasi neural forwards. Not part of `ci-all`:
# `--all-features` would pull objc2 onto Linux/Windows runners.
apofasi-metal = ["apofasi-infer", "a3s-apofasi/metal"]
# Every optional surface that is safe on Linux/Windows CI hosts.
# Prefer this over `--all-features` outside macOS.
ci-all = ["full", "apofasi", "apofasi-infer"]

[dev-dependencies]
# Deterministically advance the exponential stream-retry backoff in async tests.
tokio = { version = "1.35", features = ["test-util"] }
# HTTP mocking for the RemoteGitBackend (and any future HTTP-backed workspace
# provider). Production code does not depend on wiremock.
wiremock = "0.6"
# Self-signed cert generation for mTLS happy-path tests. Production code does
# not depend on rcgen.
rcgen = "0.13"
async-trait = "0.1"