Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .codex/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Codex-only runtime and model mapping.
# Shared roles and delegation-context policy are defined once in ../AGENTS.md.
# Keep this file compatible with Codex CLI 0.144.0-alpha.4 strict config.
# 仅供 Codex 使用的运行时与模型映射。
# 共享角色与委派上下文策略统一定义在 ../AGENTS.md。
# 本文件须兼容 Codex CLI 0.144.0-alpha.4 的严格配置校验。

[features]
multi_agent = true
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/ccache-restore/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ runs:
key: ${{ inputs.key }}
restore-keys: ${{ inputs.restore-keys }}

# Restored files keep their saved mtimes; ccache refreshes an entry's mtime on every hit
# and writes misses as new files, so anything newer than this mark is the job's working set.
# 恢复的文件保留保存时的 mtime;ccache 每次命中都会刷新条目的 mtime,未命中则写入新文件,
# 因此比此标记更新的文件即为本作业的工作集。
- name: Mark ccache working-set start
shell: bash
run: echo "CCACHE_WORKING_SET_START=$(date +%s)" >> "${GITHUB_ENV}"
3 changes: 1 addition & 2 deletions .github/actions/ccache-save/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ runs:
echo "::warning::Cannot list Actions caches; skipped pruning."
exit 0
fi
# Never prune unless the snapshot just saved is visible; otherwise the ref would lose
# its only warm cache.
# 仅当刚保存的快照可见时才清理,否则该 ref 会失去唯一的热缓存。
if ! awk -v key="${CACHE_KEY}" '$2 == key { found = 1 } END { exit !found }' <<< "${entries}"; then
echo "::notice::Saved snapshot ${CACHE_KEY} is not listed yet; skipped pruning."
exit 0
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup-build-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ runs:
echo "All requested build tools are preinstalled."
else
echo "Installing: ${missing[*]}"
# Package triggers rebuilding the man database add minutes on hosted runners.
# 安装软件包会触发重建 man 数据库,在托管 runner 上要多花几分钟。
sudo rm -f /var/lib/man-db/auto-update
sudo apt-get -o Acquire::Retries=3 update
sudo apt-get -o Acquire::Retries=3 install -y --no-install-recommends "${missing[@]}"
Expand Down
27 changes: 13 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
name: Build & GTest Regression Suite (CMake 3.19)
runs-on: ubuntu-latest
timeout-minutes: 45
# actions: write lets ccache-save prune superseded snapshots for this ref.
# actions: write 允许 ccache-save 清理本 ref 已被取代的快照。
permissions:
contents: read
actions: write
Expand All @@ -35,7 +35,7 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4

# CMake comes from the pinned 3.19 archive below; Java only needs to run PlantUML.
# CMake 来自下方固定的 3.19 归档;Java 仅用于运行 PlantUML。
- name: Set up Build Environment
uses: ./.github/actions/setup-build-env
with:
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
name: Production Backends ASan & UBSan
runs-on: ubuntu-latest
timeout-minutes: 60
# actions: write lets ccache-save prune superseded snapshots for this ref.
# actions: write 允许 ccache-save 清理本 ref 已被取代的快照。
permissions:
contents: read
actions: write
Expand All @@ -113,7 +113,7 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4

# sanitizer-runtime excludes the tooling tests that need Java.
# sanitizer-runtime 不包含需要 Java 的工具测试。
- name: Set up Build Environment
uses: ./.github/actions/setup-build-env
with:
Expand All @@ -134,7 +134,7 @@ jobs:
uses: ./.github/actions/ccache-restore
with:
path: ${{ env.CCACHE_DIR }}
# Restore the latest accessible snapshot; save a new one scoped to ref and commit sha
# 恢复最新的可访问快照;保存按 ref 和 commit sha 划分的新快照
key: sanitizer-ccache-v2-${{ runner.os }}-${{ env.TOOLCHAIN_ID }}-${{ github.ref }}-${{ github.sha }}
restore-keys: |
sanitizer-ccache-v2-${{ runner.os }}-${{ env.TOOLCHAIN_ID }}-${{ github.ref }}-
Expand All @@ -158,7 +158,7 @@ jobs:
name: Real GGUF Operator & Profile
runs-on: ubuntu-latest
timeout-minutes: 30
# actions: write lets ccache-save prune superseded snapshots for this ref.
# actions: write 允许 ccache-save 清理本 ref 已被取代的快照。
permissions:
contents: read
actions: write
Expand Down Expand Up @@ -196,8 +196,7 @@ jobs:
restore-keys: |
3rdparty-release-v1-${{ runner.os }}-${{ env.TOOLCHAIN_ID }}-

# Fall back to this job's main snapshot before the default gate's differently
# configured cache.
# 先回退到本作业的 main 快照,再回退到默认门禁那份配置不同的缓存。
- name: Restore CCache
uses: ./.github/actions/ccache-restore
with:
Expand Down Expand Up @@ -233,7 +232,7 @@ jobs:
name: Whisper ASR Backend & Real Profile
runs-on: ubuntu-latest
timeout-minutes: 30
# actions: write lets ccache-save prune superseded snapshots for this ref.
# actions: write 允许 ccache-save 清理本 ref 已被取代的快照。
permissions:
contents: read
actions: write
Expand Down Expand Up @@ -308,15 +307,15 @@ jobs:

kite-llm:
name: kiteLLM Private Release & Real GGUF
# Fork PRs and Dependabot do not receive repository secrets. Keep this job
# on trusted events; do not switch it to pull_request_target.
# Fork PR 和 Dependabot 拿不到仓库 secrets。本作业只在可信事件上运行,
# 不要改为 pull_request_target。
if: >-
github.actor != 'dependabot[bot]' &&
(github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository)
runs-on: ubuntu-24.04
timeout-minutes: 20
# actions: write lets ccache-save prune superseded snapshots for this ref.
# actions: write 允许 ccache-save 清理本 ref 已被取代的快照。
permissions:
contents: read
actions: write
Expand Down Expand Up @@ -364,8 +363,8 @@ jobs:
kite-ccache-${{ runner.os }}-${{ github.ref }}-
kite-ccache-${{ runner.os }}-

# Only the public model artifacts are cached. Private kiteLLM headers, libraries and
# linked executables must not enter this public repository's caches/artifacts.
# 只缓存公开的模型文件。私有 kiteLLM 头文件、库和链接后的可执行文件
# 不得进入本公开仓库的缓存或制品。
- name: Cache Pinned Kite Demo Models
uses: actions/cache@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-cache-cleanup.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: PR Cache Cleanup

# Pull request caches are only reachable from that pull request. Delete them once it closes so
# they do not push main snapshots out of the repository's Actions cache quota.
# PR 缓存只能被该 PR 访问。PR 关闭后即删除,
# 避免占用仓库 Actions 缓存配额而把 main 快照挤出去。
on:
pull_request:
types: [ closed ]
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ models/*_vocab.txt
# 4. 测试报告与运行日志 (Test Reports, GTest Outputs & Logs)
# ------------------------------------------------------------------------------
results/
# Demo run outputs; anchored so src/adapter/output/ converters stay tracked.
# Demo 运行输出;以 / 锚定,确保 src/adapter/output/ 下的 Converter 仍被跟踪。
/output/
*.log
*.tlog
Expand Down
11 changes: 5 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ target_include_directories(edgeflow_public_headers INTERFACE
$<BUILD_INTERFACE:${LLM_EDGEFLOW_GENERATED_INCLUDE_DIR}>
$<BUILD_INTERFACE:${edgeflow_public_include_dir}>)

# Source extensions use authoring contracts; they are not the dynamic SDK ABI.
# 源码扩展使用编写契约,不属于动态 SDK ABI。
add_library(edgeflow_extension_headers INTERFACE)
target_include_directories(edgeflow_extension_headers INTERFACE
"${PROJECT_SOURCE_DIR}/include")
Expand Down Expand Up @@ -114,9 +114,8 @@ include(cmake_ext/Pcre2.cmake)
# 引入第三方开源推理引擎 (ONNX Runtime & llama.cpp) 自动下载配置
include(cmake_ext/ThirdPartyEngines.cmake)

# Keep repository executables at build/ even though their CMake ownership is
# delegated to source subdirectories. Public commands and CI scripts rely on
# this stable artifact layout.
# 即使 CMake 归属已下放到各源码子目录,仓库可执行文件仍统一输出到 build/。
# 公开命令和 CI 脚本依赖这一稳定的产物布局。
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")

# 轻量运行时契约位于所有实现层下方;各层依赖 interface 只向下传播。
Expand Down Expand Up @@ -166,8 +165,8 @@ endfunction()

edgeflow_add_runtime_object_target(edgeflow_model_execution_objects
edgeflow_model_execution_dependencies)
# Vendor compilation stays inside the Backend implementations, including
# headers and definitions carried by imported runtime targets.
# 厂商编译只发生在 Backend 实现内部,
# 包括导入运行时目标携带的头文件和编译定义。
edgeflow_add_runtime_object_target(edgeflow_model_execution_backends_objects
edgeflow_model_execution_dependencies)
target_include_directories(edgeflow_model_execution_backends_objects PRIVATE
Expand Down
2 changes: 1 addition & 1 deletion cmake_ext/BuildAcceleration.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Developer build acceleration options shared by first-party and fetched targets.
# 第一方目标与拉取的依赖目标共用的开发构建加速选项。

set(LLM_EDGEFLOW_LINKER "auto" CACHE STRING
"Linker selection: auto, mold, lld, or system")
Expand Down
14 changes: 7 additions & 7 deletions cmake_ext/KiteLlm.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# User-authorized private GitHub dependency. Authentication remains in gh's
# credential store or GH_TOKEN; never materialize tokens in CMake/cache files.
# 经用户授权的私有 GitHub 依赖。认证信息保留在 gh 凭据存储或 GH_TOKEN 中;
# 绝不能把 token 写入 CMake 文件或缓存。
option(ENABLE_KITELLM "Download and link the pinned kiteLLM static release" OFF)
set(LLM_EDGEFLOW_HAS_KITELLM OFF)
if(NOT ENABLE_KITELLM)
Expand Down Expand Up @@ -29,7 +29,7 @@ set(_kite_asset "kiteLLM-${_kite_platform}.tar.gz")
set(_kite_cache "${LLM_EDGEFLOW_3RDPARTY_DIR}/kite_llm/${_kite_release}/${_kite_platform}")
set(_kite_archive "${_kite_cache}/${_kite_asset}")
file(MAKE_DIRECTORY "${_kite_cache}")
# Separate build directories share this archive cache.
# 不同构建目录共享此归档缓存。
file(LOCK "${_kite_cache}/.download.lock" GUARD PROCESS TIMEOUT 60)
if(NOT EXISTS "${_kite_archive}")
find_program(KITELLM_GH_EXECUTABLE NAMES gh)
Expand All @@ -39,8 +39,8 @@ if(NOT EXISTS "${_kite_archive}")
"with repository read access (CI: set GH_TOKEN).")
endif()
message(STATUS "[kiteLLM] Downloading chamsechan/kiteLLM ${_kite_release}/${_kite_asset}")
# Download into a staging directory so interrupted downloads never become a
# reusable archive. The checksum below is authoritative even if a tag moves.
# 先下载到暂存目录,避免中断的下载变成可复用的归档。
# 即使 tag 被移动,也以下方校验和为准。
set(_kite_download "${_kite_cache}/download")
file(MAKE_DIRECTORY "${_kite_download}")
execute_process(
Expand All @@ -66,8 +66,8 @@ if(NOT _kite_actual_sha256 STREQUAL _kite_sha256)
"Cached kiteLLM SHA-256 mismatch. Remove ${_kite_archive} and configure again.")
endif()

# Re-extract only verified bytes into this build, avoiding stale/tampered headers
# or libraries and machine-specific absolute paths from previous environments.
# 只把已校验的字节重新解压到本构建,避免残留或被篡改的头文件/库,
# 以及旧环境遗留的机器相关绝对路径。
set(_kite_extract "${CMAKE_BINARY_DIR}/_deps/kite_llm_release")
file(MAKE_DIRECTORY "${_kite_extract}")
execute_process(COMMAND "${CMAKE_COMMAND}" -E tar xzf "${_kite_archive}"
Expand Down
16 changes: 8 additions & 8 deletions cmake_ext/LayerHeaderViews.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Keep conventional include spellings while withholding other layers' headers
# from compiler search paths. LayerGuard still checks relative/absolute includes.
# 保留常规的 include 写法,同时不把其他层的头文件放进编译器搜索路径。
# LayerGuard 仍会检查相对/绝对路径 include。
function(edgeflow_header_view view_name)
set(view_dir "${PROJECT_BINARY_DIR}/layer_includes/${view_name}")
# Reconfiguration after a header removal must not retain a stale visible file.
# 删除头文件后重新配置时,不得残留过期的可见文件。
file(REMOVE_RECURSE "${view_dir}")
file(MAKE_DIRECTORY "${view_dir}")
foreach(header IN LISTS ARGN)
Expand All @@ -15,8 +15,8 @@ function(edgeflow_header_view view_name)
file(CREATE_LINK "${PROJECT_SOURCE_DIR}/${header}"
"${view_dir}/${include_path}" SYMBOLIC RESULT link_result)
if(NOT link_result STREQUAL "0")
# Platforms without symlink support track copies as configure dependencies;
# edits then trigger CMake before the next incremental compilation.
# 不支持符号链接的平台把副本登记为配置依赖;
# 编辑后会在下次增量编译前触发 CMake。
configure_file("${PROJECT_SOURCE_DIR}/${header}"
"${view_dir}/${include_path}" COPYONLY)
endif()
Expand Down Expand Up @@ -52,7 +52,7 @@ edgeflow_collect_headers(model_api_headers "${PROJECT_SOURCE_DIR}/include/engine
edgeflow_collect_headers(model_private_headers "${PROJECT_SOURCE_DIR}/src/engine")
edgeflow_header_view(model_execution ${model_api_headers} ${model_private_headers})

# Shared Node authoring contracts have one manifest for CMake and LayerGuard.
# 共享的 Node 编写契约只有一份清单,供 CMake 和 LayerGuard 共用。
set(node_contract_manifest "${PROJECT_SOURCE_DIR}/cmake_ext/node_core_contracts.txt")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${node_contract_manifest}")
file(STRINGS "${node_contract_manifest}" node_core_contracts)
Expand All @@ -74,8 +74,8 @@ edgeflow_collect_headers(integration_headers "${PROJECT_SOURCE_DIR}/include/adap
edgeflow_header_view(integration ${integration_headers} ${core_headers}
${model_api_headers} ${platform_mock_headers})

# Capture the actual evaluated target include paths, including transitive usage
# requirements, so the existing LayerGuard gate detects accidental broadening.
# 记录目标实际求值后的 include 路径 (含传递的使用要求),
# 以便现有 LayerGuard 门禁发现意外放宽。
function(edgeflow_generate_layer_compile_manifest)
set(content "set(layer_cxx [==[${CMAKE_CXX_COMPILER}]==])\n")
set(layer_cxx_flags "")
Expand Down
13 changes: 6 additions & 7 deletions cmake_ext/Pcre2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ if(_PCRE2_CACHE_VALID AND
else()
include(FetchContent)

# TextRuleMatchNode uses PCRE2 for Unicode-aware lookbehind and named captures.
# Keep the dependency private, source-built, pinned, and checksum-verified.
# TextRuleMatchNode 使用 PCRE2 实现 Unicode 感知的后行断言和命名捕获。
# 该依赖须保持私有、源码构建、版本固定并经校验和验证。
set(PCRE2_BUILD_PCRE2_8 ON CACHE BOOL "Build PCRE2 8-bit library" FORCE)
set(PCRE2_BUILD_PCRE2_16 OFF CACHE BOOL "Disable PCRE2 16-bit library" FORCE)
set(PCRE2_BUILD_PCRE2_32 OFF CACHE BOOL "Disable PCRE2 32-bit library" FORCE)
Expand All @@ -60,18 +60,17 @@ else()

FetchContent_MakeAvailable(pcre2)

# PCRE2 is an implementation detail of alg_sdk. Do not leak its C symbols from
# the public shared-library surface when statically linking on ELF/Mach-O.
# PCRE2 是 alg_sdk 的实现细节。在 ELF/Mach-O 上静态链接时,
# 不得从公开共享库导出其 C 符号。
if(TARGET pcre2-8-static AND CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(pcre2-8-static PRIVATE -fvisibility=hidden)
endif()

if(NOT TARGET edgeflow_pcre2)
add_library(edgeflow_pcre2 INTERFACE)
if(APPLE)
# Apple ld can mark every symbol pulled from a static archive as private.
# Link the archive by name so -hidden-l applies to the complete PCRE2 object
# set instead of exporting it through company_alg_sdk.dylib.
# Apple ld 可能把从静态归档拉入的符号全部设为私有。按名称链接该归档,
# 让 -hidden-l 作用于整个 PCRE2 目标文件集,而不是经由 company_alg_sdk.dylib 导出。
add_dependencies(edgeflow_pcre2 pcre2-8-static)
target_include_directories(
edgeflow_pcre2 SYSTEM INTERFACE "${pcre2_BINARY_DIR}/interface")
Expand Down
2 changes: 1 addition & 1 deletion cmake_ext/StbImage.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Pinned, verified image decoder. No third-party source is committed.
# 版本固定且经校验的图像解码器。不提交任何第三方源码。
set(_stb_commit "013ac3beddff3dbffafd5177e7972067cd2b5083")
set(_stb_sha "594c2fe35d49488b4382dbfaec8f98366defca819d916ac95becf3e75f4200b3")
set(_stb_dir "${CMAKE_SOURCE_DIR}/3rdparty/stb_image/${_stb_commit}")
Expand Down
8 changes: 4 additions & 4 deletions cmake_ext/ThirdPartyCacheMetadata.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ include_guard(GLOBAL)

include(CMakeParseArguments)

# Older CMake already preserves archive timestamps; the explicit switch was
# introduced in 3.24. Keep the same extraction behavior on every supported version.
# 较旧的 CMake 本就保留归档时间戳;显式开关在 3.24 才引入。
# 在所有支持的版本上保持相同的解压行为。
set(EDGEFLOW_FETCHCONTENT_TIMESTAMP_ARGS)
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24")
set(EDGEFLOW_FETCHCONTENT_TIMESTAMP_ARGS DOWNLOAD_EXTRACT_TIMESTAMP TRUE)
endif()

# Prepare an inspectable cache marker and report whether an existing cache was
# produced for the same pinned source and ABI-relevant build environment.
# 准备可检查的缓存标记,并报告现有缓存是否由相同的固定源码
# 和 ABI 相关构建环境生成。
function(edgeflow_prepare_third_party_cache)
set(_one_value_args
NAME VERSION SOURCE_SHA256 CACHE_DIR KIND MARKER_ROOT OUT_VALID OUT_MARKER)
Expand Down
7 changes: 3 additions & 4 deletions cmake_ext/ThirdPartyEngines.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ if(ENABLE_ONNXRUNTIME)
set(ORT_LIB_NAME "libonnxruntime.so")
endif()

# Select the pinned official package before inspecting the persistent cache,
# so the cache marker is tied to the exact platform archive.
# 先选定固定的官方包,再检查持久缓存,使缓存标记与具体平台归档对应。
if(APPLE)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64")
set(ORT_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.17.3/onnxruntime-osx-arm64-1.17.3.tgz")
Expand Down Expand Up @@ -113,8 +112,8 @@ if(ENABLE_LLAMACPP)
"70adb1b4cea5ee39f867792c78dc59320921eda7")
set(_LLAMA_SOURCE_SHA256
"94d215f1fd85ded40f4674eccdbd3caf4a9b0daa00b6d72255efec922c6d94a4")
# Resolve the pinned upstream BLAS defaults before inspecting the cache.
# These options must describe both source builds and imported archives.
# 先解析固定上游版本的 BLAS 默认值,再检查缓存。
# 这些选项须同时描述源码构建和导入的归档。
if(APPLE)
set(_llama_blas_default ON)
set(_llama_blas_vendor_default Apple)
Expand Down
Loading
Loading