* feat: trace Codex requests via Langfuse native SDK Codex has no OpenAI SDK client for Langfuse's usual swap trick, so log one generation per request through langfuse's native SDK instead. Tracing failures never affect the returned Codex response. * docs: note Codex Langfuse tracing support * fix: trace every Codex request, close every generation - Move the Langfuse generation inside _send so the compaction sub-request gets its own trace too, not just the main request. - Derive traced model/input from the wire body (post extra_body override, post response-item-ID stripping) instead of the pre-normalized one. - Wrap package detection in the same try/except as the SDK call, so a broken find_spec() can't turn a valid Codex request into an error. - Make generation finalization idempotent and cancellation-safe via try/except/else/finally, so update() failures or a cancelled request no longer leave a generation open. - Add tests for compaction tracing, update() failures, and cancellation. * docs: fix cli-reference.md langfuse plugin row * fix: don't trace a rejected compaction as success - Add a validate hook to _send so a transport-successful compaction reply with no usable item traces as an error, not a success. - Add regression tests for a find_spec() failure, for the traced model/input matching the actual wire body (extra_body override, ID-stripped replayed items), and for the rejected-compaction case. * fix: convert LLMUsage to dict for Langfuse usage_details LLMResponse.usage is now the LLMUsage dataclass upstream, not a plain dict - Langfuse's usage_details param needs the latter. * fix: satisfy basedpyright strict on compaction items * fix(providers): normalize Codex Langfuse cache usage * fix(providers): migrate Langfuse tracing to SDK 4 --------- Co-authored-by: chengyongru <chengyongru.ai@gmail.com>
203 lines
5.1 KiB
TOML
203 lines
5.1 KiB
TOML
[project]
|
|
name = "nanobot-ai"
|
|
version = "0.3.5"
|
|
description = "A lightweight personal AI assistant framework"
|
|
readme = { file = "README.md", content-type = "text/markdown" }
|
|
requires-python = ">=3.11"
|
|
license = {text = "MIT"}
|
|
authors = [
|
|
{name = "Xubin Ren"},
|
|
{name = "the nanobot contributors"}
|
|
]
|
|
keywords = ["ai", "agent", "chatbot"]
|
|
classifiers = [
|
|
"Development Status :: 3 - Alpha",
|
|
"Intended Audience :: Developers",
|
|
"License :: OSI Approved :: MIT License",
|
|
"Programming Language :: Python :: 3.11",
|
|
"Programming Language :: Python :: 3.12",
|
|
]
|
|
license-files = [
|
|
"LICENSE",
|
|
"THIRD_PARTY_NOTICES.md",
|
|
]
|
|
|
|
dependencies = [
|
|
"typer>=0.20.0,<1.0.0",
|
|
"anthropic>=0.100.0,<1.0.0",
|
|
"pydantic>=2.12.0,<3.0.0",
|
|
"pydantic-settings>=2.12.0,<3.0.0",
|
|
# Feishu's lark-oapi currently requires websockets<16; core supports 15 and 16.
|
|
"websockets>=15.0,<17.0",
|
|
"httpx[socks]>=0.28.0,<1.0.0",
|
|
"aiohttp>=3.14.3,<4.0.0",
|
|
"yarl>=1.17.0,<2.0.0",
|
|
"cryptography>=46.0.0",
|
|
"ddgs>=9.5.5,<10.0.0",
|
|
"oauth-cli-kit>=0.1.6,<1.0.0",
|
|
"loguru>=0.7.3,<1.0.0",
|
|
"readability-lxml>=0.8.4,<1.0.0",
|
|
"lxml-html-clean>=0.4.0,<1.0.0",
|
|
"rich>=14.0.0,<15.0.0",
|
|
"qrcode[pil]>=8.0",
|
|
"pillow>=11.0,<13.0",
|
|
"croniter>=6.0.0,<7.0.0",
|
|
"prompt-toolkit>=3.0.50,<4.0.0",
|
|
"setproctitle>=1.3.7,<2.0.0; sys_platform != 'win32'",
|
|
"questionary>=2.0.0,<3.0.0",
|
|
"mcp>=1.26.0,<2.0.0",
|
|
"json-repair>=0.57.0,<1.0.0",
|
|
"chardet>=3.0.2,<6.0.0",
|
|
"openai>=2.8.0",
|
|
"tiktoken>=0.12.0,<1.0.0",
|
|
"jinja2>=3.1.0,<4.0.0",
|
|
"dulwich>=0.22.0,<1.0.0",
|
|
"rapidfuzz>=3.14.6,<4.0.0",
|
|
"pyyaml>=6.0,<7.0.0",
|
|
"filelock>=3.25.2",
|
|
"watchfiles>=1.1.1,<2.0.0",
|
|
"packaging>=24.0",
|
|
"tzdata>=2025.2",
|
|
"tzlocal>=5.3.1,<6.0.0",
|
|
"defusedxml>=0.7.1,<1.0.0",
|
|
"pypdf>=5.0.0,<6.0.0",
|
|
"python-docx>=1.1.0,<2.0.0",
|
|
"openpyxl>=3.1.0,<4.0.0",
|
|
"python-pptx>=1.0.0,<2.0.0",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
api = [
|
|
"aiohttp>=3.9.0,<4.0.0",
|
|
]
|
|
azure = [
|
|
"azure-identity>=1.19.0,<2.0.0",
|
|
]
|
|
bedrock = [
|
|
"boto3>=1.43.0",
|
|
"botocore>=1.43.0,<2.0.0",
|
|
]
|
|
documents = [
|
|
# Compatibility extra: document readers are bundled since v0.2.3.
|
|
"defusedxml>=0.7.1,<1.0.0",
|
|
"pypdf>=5.0.0,<6.0.0",
|
|
"python-docx>=1.1.0,<2.0.0",
|
|
"openpyxl>=3.1.0,<4.0.0",
|
|
"python-pptx>=1.0.0,<2.0.0",
|
|
]
|
|
langfuse = [
|
|
"langfuse>=4.7.0,<5.0.0",
|
|
]
|
|
pdf = [
|
|
# Compatibility extra: PDF reading is bundled since v0.2.3.
|
|
"pypdf>=5.0.0,<6.0.0",
|
|
]
|
|
olostep = [
|
|
"olostep>=0.1.0; python_version < '3.14'",
|
|
]
|
|
dev = [
|
|
"hatchling",
|
|
"pytest>=9.0.0,<10.0.0",
|
|
"pytest-asyncio>=1.3.0,<2.0.0",
|
|
"aiohttp>=3.9.0,<4.0.0",
|
|
"pytest-cov>=6.0.0,<7.0.0",
|
|
"pytest-xdist>=3.8.0,<4.0.0",
|
|
"ruff>=0.1.0",
|
|
"basedpyright>=1.39.0,<2.0.0",
|
|
"pymupdf>=1.25.0",
|
|
"pypdf>=5.0.0,<6.0.0",
|
|
"python-docx>=1.1.0,<2.0.0",
|
|
"openpyxl>=3.1.0,<4.0.0",
|
|
"python-pptx>=1.0.0,<2.0.0",
|
|
"python-socketio>=5.16.0,<6.0.0",
|
|
"msgpack>=1.1.0,<2.0.0",
|
|
]
|
|
|
|
[project.scripts]
|
|
nanobot = "nanobot.cli.entry:main"
|
|
nanobot-desktop-tui = "nanobot.cli.desktop_tui:main"
|
|
|
|
# Third-party tool plugins register here. Built-in tools are discovered
|
|
# automatically via pkgutil scanning in ToolLoader.discover().
|
|
# [project.entry-points."nanobot.tools"]
|
|
# my_plugin = "my_package.plugins:MyTool"
|
|
|
|
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[tool.hatch.metadata]
|
|
allow-direct-references = true
|
|
|
|
[tool.hatch.build.hooks.custom]
|
|
# Implementation lives in the conventional `hatch_build.py` at the repo root.
|
|
|
|
[tool.hatch.build]
|
|
include = [
|
|
"nanobot/**/*.py",
|
|
"nanobot/webui/mcp_presets.json",
|
|
"nanobot/templates/**/*.md",
|
|
"nanobot/skills/**/*.md",
|
|
"nanobot/skills/**/*.sh",
|
|
"nanobot/channels/*/webui/**/*",
|
|
"nanobot/web/dist/**/*",
|
|
]
|
|
# nanobot/web/dist/ is produced by `cd webui && bun run build` and is
|
|
# git-ignored. List it as an artifact so hatch ships it in both wheel and
|
|
# sdist even though VCS does not track it.
|
|
artifacts = [
|
|
"nanobot/web/dist/**/*",
|
|
]
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["nanobot"]
|
|
exclude = ["nanobot/channels/*/tests/**"]
|
|
|
|
[tool.hatch.build.targets.wheel.sources]
|
|
"nanobot" = "nanobot"
|
|
|
|
[tool.hatch.build.targets.sdist]
|
|
include = [
|
|
"docs/**/*.md",
|
|
"nanobot/",
|
|
"nanobot/web/dist/",
|
|
"hatch_build.py",
|
|
"README.md",
|
|
"LICENSE",
|
|
"THIRD_PARTY_NOTICES.md",
|
|
"pyproject.toml",
|
|
]
|
|
exclude = ["nanobot/channels/*/tests/**", "docs/plans/**", "docs/superpowers/**"]
|
|
|
|
[tool.ruff]
|
|
line-length = 100
|
|
target-version = "py311"
|
|
|
|
[tool.ruff.lint]
|
|
select = ["E", "F", "I", "N", "W"]
|
|
ignore = ["E501"]
|
|
|
|
[tool.basedpyright]
|
|
include = ["nanobot"]
|
|
exclude = ["**/tests"]
|
|
typeCheckingMode = "strict"
|
|
pythonVersion = "3.11"
|
|
|
|
[tool.pytest.ini_options]
|
|
asyncio_mode = "auto"
|
|
testpaths = ["tests", "nanobot/channels"]
|
|
|
|
[tool.coverage.run]
|
|
source = ["nanobot"]
|
|
omit = ["tests/*", "**/tests/*"]
|
|
|
|
[tool.coverage.report]
|
|
fail_under = 75
|
|
exclude_lines = [
|
|
"pragma: no cover",
|
|
"def __repr__",
|
|
"raise NotImplementedError",
|
|
"if __name__ == .__main__.:",
|
|
"if TYPE_CHECKING:",
|
|
]
|