202279c6d9
新增 Core、Engine、Runtime、SQLite、Provider、MCP、Skill、Codex、CLI 与 DAG crate 补齐 OpenAI endpoint 配置、Provider 实例/协议路由和统一工具权限边界 加入持久化、lease、checkpoint、reconciliation、审批恢复与消息历史回归 加入独立 workspace CI、依赖边界、能力集和 Fake Agent 测试脚本 同步建设计划、TODO、架构、测试与验收文档
102 lines
3.7 KiB
Bash
Executable File
102 lines
3.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# 在一个明确的临时目录复制 workspace(排除构建产物),再从复制品运行
|
|
# metadata、依赖边界和 cargo check。这样可以发现误用父仓库相对路径的
|
|
# crate,而不需要把当前目录初始化为第二个 Git 仓库或修改用户 refs。
|
|
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|
workspace_root="$(cd -- "$script_dir/.." && pwd)"
|
|
workspace_manifest="$workspace_root/Cargo.toml"
|
|
temp_parent="${AGENT_RUNTIME_VERIFY_TMPDIR:-${HOME:?HOME 未设置}/data/tmp}"
|
|
mkdir -p -- "$temp_parent"
|
|
# Resolve an optional relative override before using it as a cargo working
|
|
# directory. This keeps the copy check independent of the caller's cwd.
|
|
temp_parent="$(cd -- "$temp_parent" && pwd)"
|
|
copy_root="$(mktemp -d "$temp_parent/agent-runtime-independent.XXXXXX")"
|
|
cleanup() {
|
|
rm -rf -- "$copy_root"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
if ! command -v tar >/dev/null 2>&1; then
|
|
echo "tar is required to create the isolated workspace copy" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# tar 的输入和输出目录都由上面的绝对路径确定,不会触碰 workspace 外的
|
|
# 用户文件。除 target/.git 外,复制边界还明确过滤任意层级的环境文件、真实
|
|
# agent.toml、SQLite 数据/WAL/SHM、日志、缓存和编辑器临时文件;精确的
|
|
# agent.toml.example 不匹配这些规则,会保留为安全配置模板。
|
|
tar -C "$workspace_root" \
|
|
--exclude='./target' \
|
|
--exclude='target' \
|
|
--exclude='*/target' \
|
|
--exclude='./.git' \
|
|
--exclude='.git' \
|
|
--exclude='*/.git' \
|
|
--exclude='.env*' \
|
|
--exclude='*/.env*' \
|
|
--exclude='agent.toml' \
|
|
--exclude='*/agent.toml' \
|
|
--exclude='*.db' \
|
|
--exclude='*.db-*' \
|
|
--exclude='*.sqlite' \
|
|
--exclude='*.sqlite-*' \
|
|
--exclude='*.sqlite3' \
|
|
--exclude='*.sqlite3-*' \
|
|
--exclude='*.wal' \
|
|
--exclude='*.shm' \
|
|
--exclude='*-wal' \
|
|
--exclude='*-shm' \
|
|
--exclude='*-journal' \
|
|
--exclude='*.log' \
|
|
--exclude='*.log.*' \
|
|
--exclude='logs' \
|
|
--exclude='*/logs' \
|
|
--exclude='cache' \
|
|
--exclude='*/cache' \
|
|
--exclude='*.cache' \
|
|
--exclude='.cache' \
|
|
--exclude='*/.cache' \
|
|
--exclude='.pytest_cache' \
|
|
--exclude='*/.pytest_cache' \
|
|
--exclude='__pycache__' \
|
|
--exclude='*/__pycache__' \
|
|
--exclude='.tmp-test' \
|
|
--exclude='*/.tmp-test' \
|
|
--exclude='.tmp-*' \
|
|
--exclude='*/.tmp-*' \
|
|
--exclude='*.tmp' \
|
|
--exclude='*.temp' \
|
|
--exclude='*.swp' \
|
|
-cf - . | tar -C "$copy_root" -xf -
|
|
|
|
# Cargo/TLS 等工具会尊重 TMPDIR;显式创建复制品内的临时目录,避免在某些
|
|
# runner 上因为目录不存在而回退到宿主机临时目录。
|
|
mkdir -p -- "$copy_root/tmp"
|
|
|
|
copied_manifest="$copy_root/Cargo.toml"
|
|
cargo metadata --locked --manifest-path "$copied_manifest" --format-version 1 \
|
|
>/dev/null
|
|
# 故意不传 manifest,并从复制目录之外调用,回归检查依赖脚本不会把 caller
|
|
# cwd 当成 workspace 根目录。
|
|
(
|
|
cd "$temp_parent"
|
|
"$copy_root/scripts/check-dependencies.sh"
|
|
)
|
|
|
|
# 同一份复制品还要通过发布前 manifest/文件边界预检;这一步仍然只读本地
|
|
# Cargo metadata 和 package 清单,不连接 registry,也不上传 crate。
|
|
(
|
|
cd "$temp_parent"
|
|
TMPDIR="$copy_root/tmp" "$copy_root/scripts/check-package-manifests.sh"
|
|
)
|
|
|
|
# 从复制目录之外调用 cargo,确保构建不依赖当前父仓库的工作目录;
|
|
# 使用本轮明确的临时父目录,避免把用户的 HOME 或仓库路径当作构建根。
|
|
cd "$temp_parent"
|
|
TMPDIR="$copy_root/tmp" cargo check --locked --manifest-path "$copied_manifest" \
|
|
--workspace --all-targets
|
|
|
|
echo "independent workspace check passed (temporary copy will be cleaned: $copy_root)"
|