豆包复刻:原生安卓(Compose + 内嵌 Termux)+ Web / Windows

一个界面照着豆包抠的 AI 助手。主力是安卓端,完全离线自主:不依赖电脑、
不需要另外装 Termux。

安卓端
- 原生 Jetpack Compose,7 个页面,配色/圆角/间距对着真机截图量出来的
- 完整动效:抽屉滑入、页面切换、气泡淡入上移、面板底部升起、typing 三点、按钮回弹
- 内置 Termux:bash/apt/pkg 388 个命令、真 pty 终端;
  pty 不可用的 ROM 上自动降级成命令控制台
- APK 内嵌 CPython 3.13(Chaquopy),AI 内核跑在手机上
- 设备能力:定位 / 陀螺仪 / 加速度计 / 光线 / 电量 / 剪贴板
- 语音:朗读 + 语音输入,火山豆包音色 / OpenAI 兼容 / 设备自带三级引擎

AI 能力
- 10 家 OpenAI 兼容提供商:方舟 / OpenAI / DeepSeek / Kimi / 智谱 /
  通义 / 硅基流动 / OpenRouter / 本地 Ollama / 自定义
- 思考强度按各家支持情况发不同字段(thinking / reasoning_effort / 不发),
  认不出来的一律不发,避免给不支持的厂商发字段直接 400
- MCP 三种传输(http / stdio / inproc)、工具热加载、文件上传、权限模式

跨端
- 安卓走原生 Compose,Web / Windows 走 Lynx
- Node 与 Python 两份内核接口逐字段一致,关键路径都有对拍脚本

自检脚本(都不需要真 Key)
- verify-phone.mjs          设备端 24 项验收
- verify-speech.mjs         语音链路 31 项,两份内核各跑一遍
- parity-thinking.mjs       思考强度映射对拍
- probe-settings-wipe.mjs   设置防清空攻击测试
- mock-llm.mjs              假的 OpenAI + 火山语音服务

许可 MIT;第三方组件(Termux Apache-2.0、Chaquopy、Compose、LynxJS、Electron)
的授权见 LICENSE。
This commit is contained in:
l
2026-10-09 14:09:36 +08:00
commit f056bcf45a
308 changed files with 46874 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
/**
* 扫 Kotlin/Java 注释里有没有 "块注释嵌套" 的雷:
* Kotlin 的 /* ... *\/ 是**可以嵌套**的,注释里只要出现一个 "斜杠星号"(比如写通配路径 lib/*.so),
* 就会开一层新的块注释,导致后面的代码全被注释掉 ——
* 报错却是莫名其妙的 "Unresolved reference" / "Unclosed comment",很难查。
*
* 用法: node scripts/scan-nested-comment.mjs <dir>
*/
import fs from 'node:fs';
import path from 'node:path';
const root = process.argv[2];
if (!root) {
console.error('用法: node scripts/scan-nested-comment.mjs <目录>');
process.exit(2);
}
const BAD = /\/\*[^*\s]/; // 注释内容里再出现 /*
let hits = 0;
function walk(dir) {
for (const entry of fs.readdirSync(dir)) {
const full = path.join(dir, entry);
const stat = fs.statSync(full);
if (stat.isDirectory()) {
walk(full);
continue;
}
if (!/\.(kt|java)$/.test(entry)) continue;
const lines = fs.readFileSync(full, 'utf8').split('\n');
let inComment = false;
lines.forEach((line, index) => {
const trimmed = line.trim();
if (!inComment && (trimmed.startsWith('/*') || trimmed.startsWith('/**'))) {
inComment = true;
return;
}
if (inComment) {
if (trimmed.includes('*/')) {
inComment = false;
return;
}
// 注释正文里出现了 /* 就危险
if (line.includes('/*')) {
hits += 1;
console.log(` ⚠️ ${path.relative(root, full)}:${index + 1} ${trimmed}`);
}
}
});
}
}
console.log(`扫 ${root} …`);
walk(root);
console.log(hits === 0 ? '没有发现嵌套注释风险' : `发现 ${hits} 处风险`);