 adminandClaude
|
d2263b16c7
|
feat: 配置统一到 ~/.x/xtype/config.json,去掉 env/xop 注入
**影响**
- 配置从三处散落(~/.xtype-engine ~/ssw.ini + 运行时 env 注入)收成一个
~/.x/xtype/config.json:engine + llm{key,base-url,model} +
xunfei{appid,api-secret,api-key}。手改这一个文件即可切引擎 / 换凭据。
- 凭据从「运行时经 xop run --secret 注入 env」改为「明文存 config.json」
(目录 0700 / 文件 0600)。启动方式不再影响行为:open / 双击 / 命令行
读同一份配置,不再依赖 xop→open→LaunchServices 这条会被截断的 env 链。
- 旧路径 ~/.xtype-engine ~/ssw.ini 一律忽略,不迁移。
**改动**
- src/xtype.swift: 删 loadINI/normINIKey 与两处 ProcessInfo.environment 读取;
新增 XTypeConfig/parseConfig/ensureConfig(JSON 解析 + 首启写模板);
LLMConfig.load() 与 XunfeiEngine 凭据改读 config.json。
- src/build.sh: 删全部 xop run --secret 块,改普通 open;python3 只改
engine 字段(OrderedDict 保序,不动凭据);首启建目录 0700 / 配置 0600;
模式名非法直接报错退出。
- src/migrate-vault-to-config.sh: 一次性把 xop vault 凭据搬进 config.json,
用户手跑(明文不进 agent 上下文),幂等只补空缺。
- AGENTS.md 红线 5/6 重写(凭据只存 config.json、不再走 env 注入);
docs/xtype/README.md 引擎选择章节重写;docs/xtype/GOTCHAS.md §11 改写成
「凭据别走 env 注入,读文件」的教训。
Co-Authored-By: Claude <[email protected]>
|
2026-10-22 19:03:01 +08:00 |
|
 adminandClaude Code
|
d6861f34fd
|
feat: 激活 mic 延后到 role 判定通过后
影响
- 鼠标按到非输入框(空白桌面 / Finder)长按时,菜单栏 mic 图标不再亮起;
mic 路由只在 AX role 判定通过后(确认是输入框)才激活。
改动
- src/xtype.swift
- ASREngine protocol 新增 armRecording(),prepare() 注释改为「不碰 mic 路由」
- AppleEngine.prepare() 拆走 installTap + engine.start,新方法 armRecording() 接管(单 apple 分支)
- XunfeiEngine.prepare() 拆走 installTap + engine.start,新方法 armRecording() 接管
- AppleLLMEngine / DualEngine 新增 armRecording() 转发(dual 模式下 apple.useSharedTap=true 内部 no-op,xunfei 是 mic 唯一启动入口)
- AppleEngine.cancel() 加 if engine.isRunning 守卫,避免 armRecording 没跑过的部分状态 stop() 打 warning
- 长按 thread startRec() 在 Engine.ready check 之后插入 Engine.current.armRecording() 异步调用
- AGENTS.md
- 补 line 7(已存在,随会话合入):Swift 不接 ObjC NSException,新增 ObjC API 必须经 XTObjCRun 桥接
- 核心设计 +2 条:ObjCBridge 通用 helper、Dual 模式 AVAudioEngine 共享
Co-Authored-By: Claude Code <[email protected]>
|
2026-10-08 12:45:46 +08:00 |
|
 adminandClaude Code
|
dd0d1b4e74
|
fix: 复用 URLSession 避免 webSocketTask 抛 NSException + 全抛点桥接
影响: XType 在 ~8 分钟级会再次 SIGSEGV(crash 4F17E81B,
EXC_BAD_ACCESS 0xD,栈顶 webSocketTaskForRequest → objc_exception_throw
→ _Unwind_RaiseException);Swift 不接 ObjC NSException,任何抛 NSException
的 ObjC API 调用都会让进程 SIGSEGV。架构脆弱性:installTap / webSocketTask
都撞过,需要把剩余可能抛点也桥接。
改动:
- XunfeiEngine session 字段改为 private lazy var,与实例同生命周期
(进程级,永不 invalidate,deinit 兜底);反复 invalidate/create 让
self delegate 同时关联 invalidated 旧 session + 新 session,
webSocketTask(with:) 抛 INVALIDATED_SESSION
- cleanup() 不再 invalidateAndCancel session,只 cancel 旧 wsTask
- ObjCBridge.h/.m 加通用 XTObjCRun(void (^)(void)) helper:
包任意 Swift block,@try/@catch NSException,失败 NSLog reason 返回 1
- XunfeiEngine.prepare() 把 webSocketTask(with:) 用 XTObjCRun 包
(belt-and-suspenders:lazy session 已避免 invalidated 状态污染,
但加一层通用兜底)
- AppleEngine.prepare() 把 SFSpeechAudioBufferRecognitionRequest()
init 用 XTObjCRun 包;同时把 tap 回调从 [req] capture 改成
[weak self] + self?.request?.append(buf) 防 req 已 endAudio
后还在 fire 回调
- AppleEngine.beginTask() 把 recognitionTask(with:) 用 XTObjCRun 包
设计: 不动 AVAudioEngine stored init(改造成本/收益不划算);
后续新引入的 ObjC API 都需要走 XTObjCRun 兜底。
Co-Authored-By: Claude Code <[email protected]>
|
2026-10-08 12:08:27 +08:00 |
|
 adminandClaude Code
|
d7695c651c
|
fix: dual 模式 installTap 撞 crash + shared tap 让 apple 真正能识别
影响: dual 模式之前会在 17 小时级别概率触发 SIGSEGV(EXC_BAD_ACCESS 0xD)
— NSException 穿过 Swift 边界 → _Unwind_RaiseException(crash
0BE0B7B3-4EEF-48E8-B2FC-874281EDE95A 验证此路径);即便不崩,
apple 引擎的 tap 也被 xunfei 的 removeTap 抢走,apple 收不到
音频,xunfei 反复 ws close 1001 重试,dual 实际不可用。
改动:
- 新增 ObjCBridge.h/.m: ObjC @try/@catch (NSException *) 包
installTapOnBus,Swift 不接 ObjC 异常,桥接是唯一可靠手段
- XunfeiEngine.prepare() installTap 改用 XTObjCTryInstallTap,
失败 set lastErr + 清理 wsTask/session + return(不置 prepared)
- AppleEngine 加 useSharedTap 字段,dual 模式跳过自己装 tap/start
engine,只创建 SFSpeechAudioBufferRecognitionRequest
- XunfeiEngine 加 sharedTapForwarder 字段,tap 回调把同一份 PCM
转发给 apple.request.append(音频实时线程;SFSpeech 设计允许跨线程)
- DualEngine.prepare() 调整:apple 走 sharedTap,xunfei 接管 tap
+ 设 forwarder;共用 XunfeiEngine 的 AVAudioEngine + 一个 tap
- build.sh swiftc 加 -import-objc-header ObjCBridge.h 并把
ObjCBridge.m 加入编译
设计: 共享 XunfeiEngine 的 AVAudioEngine — macOS AVAudioSession.input
路由同一进程只能一个 stream,必须真正共享一个 AVAudioEngine;
不引入 SharedAudio 类,AppleEngine/XunfeiEngine 仍是独立
ASREngine,single/apple-llm/xunfei 单引擎场景行为不变
(useSharedTap/sharedTapForwarder 默认 false/nil)。
Co-Authored-By: Claude Code <[email protected]>
|
2026-10-08 11:45:54 +08:00 |
|
 adminandClaude Code
|
e1eee03ed7
|
feat: 凭据走 xop env + 首次启动写 ~/.xtype-engine 模板
影响: XType.app 现在真正独立运行 —— 任何用户首次启动都立刻可用 apple 端侧,
凭据经 xop run --secret 在 build/启动时注入到子进程 env,不落磁盘不进 ~/ssw.ini。
改动:
- LLMConfig.load() 优先读 env (LLM_KEY/LLM_URL/LLM_MODEL),fallback ~/ssw.ini
- pickEngine() 首次启动 ~/.xtype-engine 缺失 → 写模板 + 提醒日志,默认 apple
- build.sh dual / apple-llm 模式 xop run 多带 llm_key/llm_url/llm_model 三件套
- build.sh 顶部注释区分 build-time xop / runtime ~/.xtype-engine / 独立 .app
设计: 不以 ~/ssw.ini 为主路径(它是个意外 —— 凭据应统一走 xop);
apple 作为无凭据兜底,保证任何用户的首次启动可用。
Co-Authored-By: Claude Code <[email protected]>
|
2026-10-07 16:05:01 +08:00 |
|
 adminandClaude Code
|
87915bf7e3
|
feat: editorApps 白名单 — Sublime/XStudio/VSCode 等 AX 不透编辑器可激活
影响:之前 Sublime Text(AX 树只有 window chrome)、XStudio console 插件
(AXUnknown)、VSCode(Electron,AX 残)长按一律进 skip 分支;现在按 bundle 白名单
走 "AX 不透明" 兜底,与 HexHub 同款 app 级激活。
改动:
- 新增 editorApps: Set<String>(Sublime 4/3、TextEdit、VSCode、Atom、CotEditor、XStudio)
- 长按分支新增一层 let role, let b = bundle, editorApps.contains(b) → startRec()
- 日志加 "allow: editor whitelist <bundle> role=<r> (fallback)"
Co-Authored-By: Claude Code <[email protected]>
|
2026-10-07 12:18:06 +08:00 |
|
 adminandClaude Code
|
63b41c9750
|
rename: voicetype → xtype (bundle id, paths, xop vault refs)
- bundle: com.xs.voicetype → com.xs.xtype;CFBundleName/Executable → XType
- 文件: src/voicetype.swift → src/xtype.swift;docs/voicetype/ → docs/xtype/
- 路径: /Applications/VoiceType.app → /Applications/XType.app;/tmp/voicetype.{log,build}
- 配置: ~/.voicetype-engine → ~/.xtype-engine
- 凭据 vault: xf_vt_{APPID,APISecret,APIKey} → xf_xt_*
- 文档: AGENTS.md / README.md / GOTCHAS.md 全量替换
- git remote: x/voicetype → x/xtype
影响 TCC:bundle id 变了,用户首次装需重新授三件套(麦/语音/辅助)。
用户操作:已 killall VoiceType + 删旧 .app + 迁 vault + remote set-url。
Co-Authored-By: Claude Code <[email protected]>
|
2026-10-07 11:01:09 +08:00 |
|
 adminandClaude Opus 5.5
|
6b88844d1b
|
fix: 点击太灵敏 — opaque app nudgeAX sleep 期间检测松手
`.press + 350ms` 进入激活分支时,AX-opaque app 会
nudgeAX(pid) + usleep(250ms)。阻塞期间用户可能已松手,
原代码 sleep 后继续推进到 .recording,导致"点击就出来"。
修法:usleep 后再查 buttonState,已松开 → .dead + cancel,
break 出 .press 分支,不再升级成录音。
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
2026-10-02 19:32:25 +08:00 |
|
 adminandClaude Opus 5.5
|
b380eaf252
|
voicetype: Apple 端侧 + LLM 异步精修,可选 xunfei/dual
新增 apple-llm 引擎(默认):Apple SFSpeechRecognizer → 贴原文 → LLM (~1s,
thinking=disabled) → 退格覆盖精修版。LLM 走 ~/ssw.ini [llm-api],无配置
静默回退 Apple 原文。
- 删 localClean(中文无空格,正则误伤'好啊'等正常词)
- pickEngine() 默认 apple-llm
- LLMCleaner 自动带 thinking: {type: 'disabled'} (GLM 7s+ → ~1s)
- build.sh 新增 apple / apple-llm 模式,默认 apple-llm
- README + AGENTS.md 同步更新
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
2026-10-02 19:23:47 +08:00 |
|