Commit Graph

10 Commits

Author SHA1 Message Date
9c3d2856a6 test(gui): 行为判据 + 接进 make test(此前无人能跑)
## 为什么加行为判据

`sse-backoff.test.mjs` 检查源码**形状**(有没有清零、上限自不自洽)。
但形状对 ≠ 行为对:把清零写到 `reader` 取流**之后**,形状检查照样通过,
而实际仍在用旧计数重连。

新判据 `sse-backoff-behavior.test.mjs` 从**真实源码**抽出退避表达式并
在 `node:vm` 沙箱里求值,用假状态记录实际等待。实测量化:

    历史累计 8 次后建连成功再断流 → 等 1000ms(改前会是 32000ms)
    连续 6 次「建连成功→断流」  → 1000,1000,1000,1000,1000,1000ms

## 变异测试(都抓到)

| 变异 | 形状判据 | 行为判据 |
| --- | --- | --- |
| 清零挪进 setTimeout 内 | 通过 | **红** ← 只有行为抓得到 |
| 删掉「建连后」清零 | **红** | 通过 ← 暴露了行为判据的盲区 |
| pump 上限改回 60000 | **红** | — |
| 30ms 改回 800ms | **红** | — |

第二行促成了「行为 0」:建连后清零原本不在被验证的路径上
(抽取锚点只抓 pump 那一处),补了独立检查。

## ★ 判据本身踩的坑(都写进文件注释)

1. **别包假 setTimeout**:`exprSrc` 本身就是延迟数值
   (`setTimeout(fn, <延迟>)` 的第二个参数),包一层让结果恒为 null,
   三项全红。
2. **别用 `new Function`**:等价于 eval,是安全反模式。改用 `node:vm`
   的 `runInNewContext`(官方受限环境,拿不到宿主作用域,带 1000ms 超时)。
3. **一个正则兼容两种幂运算形态会取错捕获组**:`Math.pow(2,x)` 比 `2 ** x`
   多一层括号 ⇒ 组数差 1 ⇒ `r[length-1]` 取到 NaN。
   最终形态是**定位与取值分离**:正则只定位(不捕获数字),数字单独取。
4. **`String.raw` 拼接正则不可用**:`\\.` 保持字面双反斜杠(去找字面的
   "\."),且拼接后捕获组编号不可控。

## ★ 这些判据此前没有任何入口会跑

`cmd/gui` 是**纯 Electron 目录**(0 个 `.go`、无 `go.mod`),Go 通配会
跳过它 ⇒ 判据挂着也没人执行。现已接入:

- `cmd/gui/package.json` 加 `"test"`
- `Makefile` 加 `test-gui` 目标,并挂进 `test`
- 无 node 时显式 SKIP 而不是静默通过

```bash
make test-gui     # 或 cd cmd/gui && npm test
```

## 顺带说明

`go test ./cmd/gui` 报 `no Go files [setup failed]` **不是回归**:
该目录 0 个 `.go` 文件,只有**显式点名**才报。仓库门禁用的三种形态
(`go test ./...`、`go test ./cmd/...`、Makefile 的 `test`)全部通过。
2026-09-28 08:16:51 +08:00
065732f42e chore(version): 客户端版本与内核对齐(唯一事实源 internal/meta.Version)
此前三份版本号互不相干:内核 1.4.0、GUI 1.0.0、鸿蒙 1.1.1。手工各改各的
必然漂移,所以把「对齐」做成机械动作而不是约定:

- deploy/scripts/sync-client-versions.sh:从 internal/meta.Version 读版本,
  同步 cmd/gui/package.json 与鸿蒙 AppScope/app.json5(versionName +
  versionCode=X*1e6+Y*1e3+Z);--check 给 CI/Makefile 做漂移门禁。
- Makefile 新增 sync-client-versions / check-client-versions;build-cli 也注入
  LDFLAGS,waiter 与 homed 同版本。
- 鸿蒙:新增 common/AppVersion.ets,从 bundleManager 读安装包 versionName,
  BridgeProtocol/BridgeCaps 里两处硬编码 '1.1.1' 改为读它——版本只剩
  app.json5 一份,杜绝第二真相。
- waiter:`-version` 打印版本,启动横幅与设备桥 hello 的 version 字段
  直接引用 internal/meta,与内核天然同源。

对齐后:GUI 1.4.0 / 鸿蒙 1.4.0(1004000) / waiter 1.4.0 / 内核 1.4.0。
2026-09-15 11:03:26 +08:00
a024dc3f5f feat: 设备桥共享库 + CLI全能力补齐 + GUI omniparse/computeruse 重构
- 抽取设备桥 WS 协议层为共享库 (internal/devicebridge/client/)
- CLI 补齐 11 项 caps 能力(screensee/screensue/speakeruse/camerasue/...)
- GUI 新增 omniparse 能力(Windows UIA 窗口解析)
- GUI computeruse 改用 koffi 直接调用 user32.dll,不再依赖 PowerShell C# 编译
- GUI computeruse JSON 解析兼容非标准格式 {x:500,y:300}
- 新增 mock-server 用于本地测试设备桥协议
- 新增 GUI DLL 桥接模块 (devicebridge_dll.js)
2026-08-23 20:17:38 +08:00
3f32006341 gui: 修复总网关认证(host域cookie注入+session.fetch登录+sl-session合并) & 连接持久化完整字段+网关徽标; vendor 本地 three.js 备用 2026-08-16 08:17:34 +08:00
4b0f2f332a feat: Linux packaging, SDK v0.7.1, fix rawmode conflict
- go.mod: SDK pseudo-version -> v0.7.1 (remote tag), go.sum updated
- cmd/waiter/rawmode_linux.go: remove (conflicts with raw_unix.go)
- cmd/gui/package.json: add rpm/AppImage Linux targets
- package/package-linux.sh: cross-distro packaging script (deb/tar.gz/rpm)
- package/linux/: DEBIAN control files, postinst/prerm, RPM spec
2026-07-20 11:03:43 +08:00
0edd7c0b47 feat: Windows NSIS installer, embedded icons, GUI auto-launch backend
- Add package/installer.nsi (Full/Server/Client) and toolchain.nsi
- Embed icon.ico (rounded corners) into homed.exe/waiter.exe via .syso
- GUI auto-launches homed.exe from parent dir (Windows only)
- GUI fallback connections.json from app resource dir
- Add initconfig command for config.db seeding
- Replace waiter rawmode* with raw_{unix,windows,other}.go
- Fix .gitignore: /homed instead of homed, add login.json
- Update icon.svg with rounded rect, new mascot.svg
2026-07-19 23:46:16 +08:00
10638f1308 feat: mascot integration - WebUI/GUI icons, chat avatar, system prompt, docs 2026-07-17 21:41:03 +08:00
69ceedf0ab feat: register embedding_model_path in ConfigRegistry instead of JSON config
- Add core.agent.embedding_model_path to seedDBValues and seedCoreDefs
- Wire cfgReg.GetString in main.go to AgentConfig.EmbeddingModelPath
- Follow existing core.agent.* ConfigRegistry pattern
2026-07-17 21:07:54 +08:00
d2aec1fd5f feat(gui): add electron-packager for app bundling 2026-07-17 12:56:31 +08:00
951d31cca0 feat: align GUI and CLI with WebUI - move GUI to cmd/gui/, add REPL+mgmt to waiter, enhance GUI features 2026-07-16 20:28:56 +08:00