fix(build): 手动 patch SPM 链接 + 清孤儿文件让 Task 6 真正可编译

经过多轮 Xcode UI / SPM 解析失败,本 commit 合并以下修复:

pbxproj 手动 patch:
- 删除孤立的 mlx-swift XCRemoteSwiftPackageReference(版本 0.31.3 与
  mlx-swift-examples 2.29.1 锁定的 0.29.1..<0.30.0 冲突)
- 在 体己 target 加入 MLXLLM + MLXLMCommon 两个 product 依赖,绑定到
  mlx-swift-examples 包。补齐 PBXBuildFile + XCSwiftPackageProductDependency
  + packageProductDependencies + Frameworks build phase 4 处条目

LLMSession.swift 简化:
- 去掉 import MLX(避免需要把 mlx-swift transitive MLX/MLXFast/MLXNN 等
  5 个 product 也链上,大幅简化依赖)
- 移除 MLX.GPU.synchronize() 调用——研究笔记里建议的尾部同步对 AsyncStream
  数据正确性无影响,省一份直接 import 依赖

清理孤儿文件:
- 体己/AI/Theme.swift 和 体己/AI/TabBar.swift 是早期混乱中由出错的
  fix subagent 创建的占位 stub,跟 DesignSystem/Tokens.swift 重复声明
  enum Tj,导致 invalid redeclaration

附:Package.resolved 由 xcodebuild SPM resolve 生成,加入版本控制确保
团队成员锁定相同版本图。

** BUILD SUCCEEDED ** 验证通过(iPhone 17 Pro simulator)。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
link2026
2026-05-25 16:45:32 +08:00
parent f5f78e36a6
commit a02679a623
3 changed files with 109 additions and 5 deletions

View File

@@ -6,6 +6,11 @@
objectVersion = 77;
objects = {
/* Begin PBXBuildFile section */
FEED000000000000DEAD0001 /* MLXLLM in Frameworks */ = {isa = PBXBuildFile; productRef = FEED000000000000DEAD0003 /* MLXLLM */; };
FEED000000000000DEAD0002 /* MLXLMCommon in Frameworks */ = {isa = PBXBuildFile; productRef = FEED000000000000DEAD0004 /* MLXLMCommon */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
5E463D092FC403BC0089145B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
@@ -52,6 +57,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FEED000000000000DEAD0001 /* MLXLLM in Frameworks */,
FEED000000000000DEAD0002 /* MLXLMCommon in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -112,6 +119,8 @@
);
name = "体己";
packageProductDependencies = (
FEED000000000000DEAD0003 /* MLXLLM */,
FEED000000000000DEAD0004 /* MLXLMCommon */,
);
productName = "体己";
productReference = 5E463CF92FC403BB0089145B /* 体己.app */;
@@ -195,6 +204,9 @@
);
mainGroup = 5E463CF02FC403BB0089145B;
minimizedProjectReferenceProxies = 1;
packageReferences = (
5E9A1F872FC43C9A0097DD29 /* XCRemoteSwiftPackageReference "mlx-swift-examples" */,
);
preferredProjectObjectVersion = 77;
productRefGroup = 5E463CFA2FC403BB0089145B /* Products */;
projectDirPath = "";
@@ -615,6 +627,30 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
/* Begin XCRemoteSwiftPackageReference section */
5E9A1F872FC43C9A0097DD29 /* XCRemoteSwiftPackageReference "mlx-swift-examples" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/ml-explore/mlx-swift-examples";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 2.29.1;
};
};
/* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
FEED000000000000DEAD0003 /* MLXLLM */ = {
isa = XCSwiftPackageProductDependency;
package = 5E9A1F872FC43C9A0097DD29 /* XCRemoteSwiftPackageReference "mlx-swift-examples" */;
productName = MLXLLM;
};
FEED000000000000DEAD0004 /* MLXLMCommon */ = {
isa = XCSwiftPackageProductDependency;
package = 5E9A1F872FC43C9A0097DD29 /* XCRemoteSwiftPackageReference "mlx-swift-examples" */;
productName = MLXLMCommon;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 5E463CF12FC403BB0089145B /* Project object */;
}