physical_byte_agent/vitest.config.ts
d-robotics 06a19a61e8 refactor: 重构为生产级 pi Agent 项目(散装脚本 → npm 库包 + 单一 barrel 装配)
- 工程形态:@d-robotics/physical-byte-agent npm 库包
  - 单一 barrel src/extensions/index.ts 装配 21 域扩展(package.json pi.extensions 清单 + .pi/extensions/index.ts 重导出,pi 自动加载)
  - src/agent.ts PhysicalByteAgent(launch() 程序化调 createAgentSession + verifyAssembly() 离线自检)
  - bin/pba.ts CLI、models.json(glm-5.2 条目)、README.md、AGENTS.md
- 命名:全部域命名(glm-provider/safety-gate/flash/jtag-debugger/loop-orchestrator…),去掉 F 编号
- 架构:内联逻辑 + 顶层仅 import type(esbuild 擦除)+ 工厂内动态 import defineTool/Type
  - 逻辑离线可单测(不解析 pi),工厂在真 pi 内装配;fail-closed 语义保留
- 两命门:glm-provider.ts buildGlmModelConfig()(thinkingFormat:qwen + maxTokens:8192 + thinkingLevelMap 全 null)+ detectEmptyOutput();normalizeHexArg() + makeHexNormalizingPrepareArguments()
- 验证:tsc --noEmit 0 错(对 src/types/pi.d.ts 类型镜像)+ vitest 732 用例/21 文件全绿 + tsx 离线装配冒烟 21 扩展全就位
- 密钥铁律:grep sk-nAm 在 src/tests/bin/.pi = 0,key 全程 ${DROBOTICS_LLM_KEY} 占位

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-13 19:54:20 +08:00

27 lines
1.1 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { fileURLToPath } from "node:url";
import { defineConfig } from "vitest/config";
// 运行时解析到真 pi 源码(.ts,无需构建 pi 即可跑逻辑测试)。
// tsc 类型检查走 src/types/pi.d.ts 镜像(见 tsconfig.json paths)。
const PI_PACKAGES = fileURLToPath(new URL("../pi/packages", import.meta.url));
export default defineConfig({
test: {
globals: true,
environment: "node",
testTimeout: 15000,
include: ["tests/**/*.test.ts"],
reporters: ["default"],
},
resolve: {
alias: [
{ find: /^@earendil-works\/pi-ai$/, replacement: `${PI_PACKAGES}/ai/src/index.ts` },
{ find: /^@earendil-works\/pi-coding-agent$/, replacement: `${PI_PACKAGES}/coding-agent/src/index.ts` },
{ find: /^@earendil-works\/pi-agent-core$/, replacement: `${PI_PACKAGES}/agent/src/index.ts` },
{ find: /^@earendil-works\/pi-protocol$/, replacement: `${PI_PACKAGES}/protocol/src/index.ts` },
{ find: /^@earendil-works\/pi-client$/, replacement: `${PI_PACKAGES}/client/src/index.ts` },
{ find: /^@mariozechner\/pi-ai$/, replacement: `${PI_PACKAGES}/ai/src/index.ts` },
],
},
});